@univerjs/preset-sheets-node-core 0.14.0-insiders.20251222-4efcfbb → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/umd/index.js +4 -4
- package/package.json +17 -17
package/lib/umd/index.js
CHANGED
|
@@ -7,13 +7,13 @@
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
// @univerjs/sheets/index
|
|
10
|
-
(function(g,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("@univerjs/core"),require("rxjs"),require("@univerjs/engine-formula"),require("rxjs/operators"),require("@univerjs/rpc")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","rxjs","@univerjs/engine-formula","rxjs/operators","@univerjs/rpc"],i):(g=typeof globalThis<"u"?globalThis:g||self,i(g.UniverSheets={},g.UniverCore,g.rxjs,g.UniverEngineFormula,g.rxjs.operators,g.UniverRpc))})(this,(function(g,i,O,K,Dt,ea){"use strict";var Qd=Object.defineProperty;var ec=(g,i,O)=>i in g?Qd(g,i,{enumerable:!0,configurable:!0,writable:!0,value:O}):g[i]=O;var f=(g,i,O)=>ec(g,typeof i!="symbol"?i+"":i,O);function ta(s,e,t){var r,a,l;if(e.t)return e.t;if(e.v===null)return null;const n=s.getStyleByCell(e),o=s.getStyleByCell(t);if(t.t===i.CellValueType.FORCE_STRING){if(!i.isTextFormat((r=o==null?void 0:o.n)==null?void 0:r.pattern)&&e.v!==void 0){if(i.isRealNum(e.v))return i.CellValueType.NUMBER;if(i.isBooleanString(`${e.v}`))return i.CellValueType.BOOLEAN}return i.CellValueType.FORCE_STRING}return na(n)?i.isTextFormat((a=n==null?void 0:n.n)==null?void 0:a.pattern)?i.CellValueType.STRING:ro(e,t):i.isTextFormat((l=o==null?void 0:o.n)==null?void 0:l.pattern)?i.CellValueType.STRING:ro(e,t)}function ro(s,e){return s.v!==void 0?Bn(s.v,s.t):Bn(e.v,e.t)}function na(s){var e;return!!((e=s==null?void 0:s.n)!=null&&e.pattern)}function Bn(s,e){return s===null?null:typeof s=="string"?i.isRealNum(s)?(+s==0||+s==1)&&e===i.CellValueType.BOOLEAN?i.CellValueType.BOOLEAN:e!==i.CellValueType.STRING&&e!==i.CellValueType.FORCE_STRING&&i.willLoseNumericPrecision(s)?i.CellValueType.FORCE_STRING:i.CellValueType.NUMBER:i.isBooleanString(s)?i.CellValueType.BOOLEAN:i.CellValueType.STRING:typeof s=="number"?(s===0||s===1)&&e===i.CellValueType.BOOLEAN?i.CellValueType.BOOLEAN:i.CellValueType.NUMBER:typeof s=="boolean"?i.CellValueType.BOOLEAN:i.CellValueType.FORCE_STRING}const ge=(s,e)=>{if(s.get(i.IUniverInstanceService).getUniverSheetInstance(e.unitId)==null)throw new Error("universheet is null error!");return{unitId:e.unitId,subUnitId:e.subUnitId,ranges:i.Tools.deepClone(e.ranges)}},j={id:"sheet.mutation.add-worksheet-merge",type:i.CommandType.MUTATION,handler:(s,e)=>{const n=s.get(i.IUniverInstanceService).getUniverSheetInstance(e.unitId);if(n==null)throw new Error("universheet is null error!");const o=n.getSheetBySheetId(e.subUnitId);if(!o)return!1;const a=o.getConfig().mergeData,l=e.ranges;for(let u=0;u<l.length;u++)a.push(l[u]);return o.getSpanModel().rebuild(a),!0}},sa=i.createInterceptorKey("CELL_CONTENT"),oa=i.createInterceptorKey("ROW_FILTERED"),Ve={CELL_CONTENT:sa,ROW_FILTERED:oa};var io=(s=>(s[s.DATA_VALIDATION=9]="DATA_VALIDATION",s[s.NUMFMT=10]="NUMFMT",s[s.CELL_IMAGE=11]="CELL_IMAGE",s))(io||{});const ao="sheet.interceptor.range-theme-id",lo="sheet.interceptor.ignore-range-theme";var ra=Object.getOwnPropertyDescriptor,ia=(s,e,t,n)=>{for(var o=n>1?void 0:n?ra(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},aa=(s,e)=>(t,n)=>e(t,n,s);const Hn=i.createInterceptorKey("BEFORE_CELL_EDIT"),tn=i.createInterceptorKey("AFTER_CELL_EDIT"),nn=i.createInterceptorKey("VALIDATE_CELL");g.SheetInterceptorService=class extends i.Disposable{constructor(t){super();f(this,"_interceptorsByName",new Map);f(this,"_commandInterceptors",[]);f(this,"_rangeInterceptors",[]);f(this,"_autoHeightInterceptors",[]);f(this,"_beforeCommandInterceptor",[]);f(this,"_afterCommandInterceptors",[]);f(this,"_workbookDisposables",new Map);f(this,"_worksheetDisposables",new Map);f(this,"_interceptorsDirty",!1);f(this,"_composedInterceptorByKey",new Map);f(this,"writeCellInterceptor",new i.InterceptorManager({BEFORE_CELL_EDIT:Hn,AFTER_CELL_EDIT:tn,VALIDATE_CELL:nn}));this._univerInstanceService=t,this.disposeWithMe(this._univerInstanceService.getTypeOfUnitAdded$(i.UniverInstanceType.UNIVER_SHEET).subscribe(n=>{this._interceptWorkbook(n)})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitDisposed$(i.UniverInstanceType.UNIVER_SHEET).subscribe(n=>this._disposeWorkbookInterceptor(n))),this.intercept(Ve.CELL_CONTENT,{priority:-1,effect:i.InterceptorEffectEnum.Style|i.InterceptorEffectEnum.Value,handler:n=>n}),this.disposeWithMe(this.writeCellInterceptor.intercept(tn,{priority:-1,handler:n=>n})),this.disposeWithMe(this.writeCellInterceptor.intercept(Hn,{priority:-1,handler:n=>n})),this.disposeWithMe(this.writeCellInterceptor.intercept(nn,{priority:-1,handler:n=>n}))}dispose(){super.dispose(),this._workbookDisposables.forEach(t=>t.dispose()),this._workbookDisposables.clear(),this._worksheetDisposables.forEach(t=>t.dispose()),this._worksheetDisposables.clear(),this._interceptorsByName.clear()}interceptCommand(t){if(this._commandInterceptors.includes(t))throw new Error("[SheetInterceptorService]: Interceptor already exists!");return this._commandInterceptors.push(t),this._commandInterceptors.sort((n,o)=>{var r,a;return((r=o.priority)!=null?r:0)-((a=n.priority)!=null?a:0)}),this.disposeWithMe(i.toDisposable(()=>i.remove(this._commandInterceptors,t)))}onCommandExecute(t){const n=this._commandInterceptors.map(o=>o.getMutations(t));return{preUndos:n.map(o=>{var r;return(r=o.preUndos)!=null?r:[]}).flat(),undos:n.map(o=>o.undos).flat(),preRedos:n.map(o=>{var r;return(r=o.preRedos)!=null?r:[]}).flat(),redos:n.map(o=>o.redos).flat()}}interceptAfterCommand(t){if(this._afterCommandInterceptors.includes(t))throw new Error("[SheetInterceptorService]: Interceptor already exists!");return this._afterCommandInterceptors.push(t),this._afterCommandInterceptors.sort((n,o)=>{var r,a;return((r=o.priority)!=null?r:0)-((a=n.priority)!=null?a:0)}),this.disposeWithMe(i.toDisposable(()=>i.remove(this._afterCommandInterceptors,t)))}afterCommandExecute(t){const n=this._afterCommandInterceptors.map(o=>o.getMutations(t));return{undos:n.map(o=>o.undos).flat(),redos:n.map(o=>o.redos).flat()}}interceptAutoHeight(t){if(this._autoHeightInterceptors.includes(t))throw new Error("[SheetInterceptorService]: Interceptor already exists!");return this._autoHeightInterceptors.push(t),this._autoHeightInterceptors.sort((n,o)=>{var r,a;return((r=o.priority)!=null?r:0)-((a=n.priority)!=null?a:0)}),this.disposeWithMe(i.toDisposable(()=>i.remove(this._autoHeightInterceptors,t)))}generateMutationsOfAutoHeight(t){const n=this._autoHeightInterceptors.map(o=>o.getMutations(t));return{preUndos:n.map(o=>{var r;return(r=o.preUndos)!=null?r:[]}).flat(),undos:n.map(o=>o.undos).flat(),preRedos:n.map(o=>{var r;return(r=o.preRedos)!=null?r:[]}).flat(),redos:n.map(o=>o.redos).flat()}}interceptBeforeCommand(t){if(this._beforeCommandInterceptor.includes(t))throw new Error("[SheetInterceptorService]: Interceptor already exists!");return this._beforeCommandInterceptor.push(t),this._beforeCommandInterceptor.sort((n,o)=>{var r,a;return((r=o.priority)!=null?r:0)-((a=n.priority)!=null?a:0)}),this.disposeWithMe(i.toDisposable(()=>i.remove(this._beforeCommandInterceptor,t)))}async beforeCommandExecute(t){return(await Promise.all(this._beforeCommandInterceptor.map(o=>o.performCheck(t)))).every(o=>o)}interceptRanges(t){if(this._rangeInterceptors.includes(t))throw new Error("[SheetInterceptorService]: Interceptor already exists!");return this._rangeInterceptors.push(t),this._rangeInterceptors.sort((n,o)=>{var r,a;return((r=o.priority)!=null?r:0)-((a=n.priority)!=null?a:0)}),this.disposeWithMe(i.toDisposable(()=>i.remove(this._rangeInterceptors,t)))}generateMutationsByRanges(t){const n=this._rangeInterceptors.map(o=>o.getMutations(t));return{preUndos:n.map(o=>{var r;return(r=o.preUndos)!=null?r:[]}).flat(),undos:n.map(o=>o.undos).flat(),preRedos:n.map(o=>{var r;return(r=o.preRedos)!=null?r:[]}).flat(),redos:n.map(o=>o.redos).flat()}}onWriteCell(t,n,o,r,a){const l={subUnitId:n.getSheetId(),unitId:t.getUnitId(),workbook:t,worksheet:n,row:o,col:r,origin:i.Tools.deepClone(a)};return this.writeCellInterceptor.fetchThroughInterceptors(tn)(a,l)}onValidateCell(t,n,o,r){const a={subUnitId:n.getSheetId(),unitId:t.getUnitId(),workbook:t,worksheet:n,row:o,col:r};return this.writeCellInterceptor.fetchThroughInterceptors(nn)(Promise.resolve(!0),a)}intercept(t,n){const o=t;this._interceptorsByName.has(o)||this._interceptorsByName.set(o,[]);const r=this._interceptorsByName.get(o);r.push(n);const a=r.sort((l,u)=>{var d,c;return((d=u.priority)!=null?d:0)-((c=l.priority)!=null?c:0)});if(this._interceptorsDirty=!0,o===Ve.CELL_CONTENT){const l=i.InterceptorEffectEnum.Style|i.InterceptorEffectEnum.Value;this._interceptorsByName.set(`${o}-${l}`,a);const u=i.InterceptorEffectEnum.Style|i.InterceptorEffectEnum.Value;return this._interceptorsByName.set(`${o}-${i.InterceptorEffectEnum.Style}`,a.filter(d=>((d.effect||u)&i.InterceptorEffectEnum.Style)>0)),this._interceptorsByName.set(`${o}-${i.InterceptorEffectEnum.Value}`,a.filter(d=>((d.effect||u)&i.InterceptorEffectEnum.Value)>0)),this.disposeWithMe(i.toDisposable(()=>{i.remove(this._interceptorsByName.get(o),n),i.remove(this._interceptorsByName.get(`${o}-${l}`),n),i.remove(this._interceptorsByName.get(`${o}-${i.InterceptorEffectEnum.Style}`),n),i.remove(this._interceptorsByName.get(`${o}-${i.InterceptorEffectEnum.Value}`),n)}))}else return this._interceptorsByName.set(o,a),this.disposeWithMe(i.toDisposable(()=>i.remove(this._interceptorsByName.get(o),n)))}fetchThroughInterceptors(t,n,o,r){const a=n===void 0?t:`${t}-${n}`,l=o!=null?o:a;let u=this._composedInterceptorByKey.get(l);if(!u||this._interceptorsDirty){let d=this._interceptorsByName.get(a);d&&r&&(d=d.filter(r)),u=i.composeInterceptors(d||[]),this._composedInterceptorByKey.set(l,u)}return u}_interceptWorkbook(t){const n=new i.DisposableCollection,o=t.getUnitId(),r=this,a=l=>{const u=l.getSheetId();l.__interceptViewModel(d=>{const c=new i.DisposableCollection;r._worksheetDisposables.set(uo(o,l),c),c.add(d.registerCellContentInterceptor({getCell(h,m,R,C,S){const I=l.getCellRaw(h,m);return r.fetchThroughInterceptors(Ve.CELL_CONTENT,R,C,S)(I,{unitId:o,subUnitId:u,row:h,col:m,worksheet:l,workbook:t,rawData:I})}})),c.add(d.registerRowFilteredInterceptor({getRowFiltered(h){return!!r.fetchThroughInterceptors(Ve.ROW_FILTERED)(!1,{unitId:o,subUnitId:u,row:h,workbook:t,worksheet:l})}}))})};t.getSheets().forEach(l=>a(l)),n.add(t.sheetCreated$.subscribe(l=>a(l))),n.add(i.toDisposable(()=>t.getSheets().forEach(l=>this._disposeSheetInterceptor(o,l)))),n.add(t.sheetDisposed$.subscribe(l=>this._disposeSheetInterceptor(o,l))),this._workbookDisposables.set(o,n)}_disposeWorkbookInterceptor(t){const n=t.getUnitId(),o=this._workbookDisposables.get(n);o&&(o.dispose(),this._workbookDisposables.delete(n))}_disposeSheetInterceptor(t,n){const o=uo(t,n),r=this._worksheetDisposables.get(o);r&&(r.dispose(),this._worksheetDisposables.delete(o))}},g.SheetInterceptorService=ia([aa(0,i.IUniverInstanceService)],g.SheetInterceptorService);function uo(s,e){return`${s}|${e.getSheetId()}`}const Z=s=>{const e={};return s.bg&&(e.bg={...s.bg}),s.ol&&(e.ol={...s.ol}),s.bd&&(e.bd={...s.bd}),s.cl&&(e.cl={...s.cl}),s.ht&&(e.ht=s.ht),s.vt&&(e.vt=s.vt),s.bl!==void 0&&(e.bl=s.bl),e};function la(s){const e={};if(s.length===1)return s[0];for(const t of s)t.bg&&(e.bg=t.bg),t.ol&&(e.ol=t.ol),t.bd&&(e.bd={...e.bd,...t.bd}),t.cl&&(e.cl=t.cl),t.ht&&(e.ht=t.ht),t.vt&&(e.vt=t.vt),t.bl!==void 0&&(e.bl=t.bl);return e}const J={wholeStyle:1,headerRowStyle:2,headerColumnStyle:4,firstRowStyle:8,secondRowStyle:16,lastRowStyle:32,firstColumnStyle:128,secondColumnStyle:256,lastColumnStyle:512};class $e{constructor(e,t){f(this,"_name");f(this,"wholeStyle",null);f(this,"headerRowStyle",null);f(this,"headerColumnStyle",null);f(this,"firstRowStyle",null);f(this,"secondRowStyle",null);f(this,"lastRowStyle",null);f(this,"firstColumnStyle",null);f(this,"secondColumnStyle",null);f(this,"lastColumnStyle",null);f(this,"_mergeCacheMap",new Map);t&&this.fromJson({...t,name:e}),this._name=e}getName(){return this._name}getWholeStyle(){return this.wholeStyle}setWholeStyle(e){this.wholeStyle=e,this._resetStyleCache()}getFirstRowStyle(){return this.firstRowStyle}setFirstRowStyle(e){this.firstRowStyle=e,this._resetStyleCache()}getSecondRowStyle(){return this.secondRowStyle}setSecondRowStyle(e){this.secondRowStyle=e,this._resetStyleCache()}getLastRowStyle(){return this.lastRowStyle}setLastRowStyle(e){this.lastRowStyle=e,this._resetStyleCache()}getFirstColumnStyle(){return this.firstColumnStyle}setFirstColumnStyle(e){this.firstColumnStyle=e,this._resetStyleCache()}getSecondColumnStyle(){return this.secondColumnStyle}setSecondColumnStyle(e){this.secondColumnStyle=e,this._resetStyleCache()}getLastColumnStyle(){return this.lastColumnStyle}setLastColumnStyle(e){this.lastColumnStyle=e,this._resetStyleCache()}getHeaderRowStyle(){return this.headerRowStyle}setHeaderRowStyle(e){this.headerRowStyle=e,this._resetStyleCache()}getHeaderColumnStyle(){return this.headerColumnStyle}setHeaderColumnStyle(e){this.headerColumnStyle=e,this._resetStyleCache()}getStyle(e,t,n,o,r){let a=0;return n&&(a=a|J.lastRowStyle),o&&(a=a|J.lastColumnStyle),e>=0&&t>=0&&(a=a|J.wholeStyle),e%2===1&&(a=a|(r?J.secondRowStyle:J.firstRowStyle)),e%2===0&&(a=a|(r?J.firstRowStyle:J.secondRowStyle)),e===0&&(a=a|J.headerRowStyle),t===0&&(a=a|J.headerColumnStyle),t%2===1&&(a=a|J.firstColumnStyle),t%2===0&&(a=a|J.secondColumnStyle),a===0?null:this._getMergeStyle(a)}_getMergeStyle(e){let t=this._mergeCacheMap.get(e);return t||(t=this._mergeStyle(e),this._mergeCacheMap.set(e,t)),t}_mergeStyle(e){const t=[];return this.wholeStyle&&e&J.wholeStyle&&t.push(this.wholeStyle),this.firstColumnStyle&&e&J.firstColumnStyle&&t.push(this.firstColumnStyle),this.secondColumnStyle&&e&J.secondColumnStyle&&t.push(this.secondColumnStyle),this.firstRowStyle&&e&J.firstRowStyle&&t.push(this.firstRowStyle),this.secondRowStyle&&e&J.secondRowStyle&&t.push(this.secondRowStyle),this.headerColumnStyle&&e&J.headerColumnStyle&&t.push(this.headerColumnStyle),this.lastColumnStyle&&e&J.lastColumnStyle&&t.push(this.lastColumnStyle),this.headerRowStyle&&e&J.headerRowStyle&&t.push(this.headerRowStyle),this.lastRowStyle&&e&J.lastRowStyle&&t.push(this.lastRowStyle),la(t)}_resetStyleCache(){this._mergeCacheMap.clear()}toJson(){const e={name:this._name};return this.wholeStyle&&(e.wholeStyle=Z(this.wholeStyle)),this.headerRowStyle&&(e.headerRowStyle=Z(this.headerRowStyle)),this.headerColumnStyle&&(e.headerColumnStyle=Z(this.headerColumnStyle)),this.firstRowStyle&&(e.firstRowStyle=Z(this.firstRowStyle)),this.secondRowStyle&&(e.secondRowStyle=Z(this.secondRowStyle)),this.lastRowStyle&&(e.lastRowStyle=Z(this.lastRowStyle)),this.firstColumnStyle&&(e.firstColumnStyle=Z(this.firstColumnStyle)),this.secondColumnStyle&&(e.secondColumnStyle=Z(this.secondColumnStyle)),this.lastColumnStyle&&(e.lastColumnStyle=Z(this.lastColumnStyle)),e}fromJson(e){this._name=e.name,e.wholeStyle&&(this.wholeStyle=Z(e.wholeStyle)),e.headerRowStyle&&(this.headerRowStyle=Z(e.headerRowStyle)),e.headerColumnStyle&&(this.headerColumnStyle=Z(e.headerColumnStyle)),e.firstRowStyle&&(this.firstRowStyle=Z(e.firstRowStyle)),e.secondRowStyle&&(this.secondRowStyle=Z(e.secondRowStyle)),e.lastRowStyle&&(this.lastRowStyle=Z(e.lastRowStyle)),e.firstColumnStyle&&(this.firstColumnStyle=Z(e.firstColumnStyle)),e.secondColumnStyle&&(this.secondColumnStyle=Z(e.secondColumnStyle)),e.lastColumnStyle&&(this.lastColumnStyle=Z(e.lastColumnStyle))}dispose(){this._mergeCacheMap.clear()}}const ua=(s,e,t)=>new $e(`light-${s}`,{headerRowStyle:{bg:{rgb:e}},firstColumnStyle:{bg:{rgb:"rgb(255, 255, 255)"}},secondColumnStyle:{bg:{rgb:t}},lastRowStyle:{bg:{rgb:e}}}),da=(s,e,t)=>new $e(`middle-${s}`,{headerRowStyle:{bg:{rgb:e}},headerColumnStyle:{bg:{rgb:t}},secondRowStyle:{bg:{rgb:t}},lastRowStyle:{bg:{rgb:e}},lastColumnStyle:{bg:{rgb:t}}}),ca=(s,e,t,n)=>new $e(`dark-${s}`,{headerRowStyle:{bg:{rgb:e},cl:{rgb:"rgb(255, 255, 255)"},ht:i.HorizontalAlign.CENTER,bl:i.BooleanNumber.TRUE},firstRowStyle:{bg:{rgb:t}},secondRowStyle:{bg:{rgb:n}},lastRowStyle:{bg:{rgb:e}}}),ha=[{baseName:"blue",header:"rgb(164, 202, 254)",color:"rgb(225, 239, 254)"},{baseName:"grey",header:"rgb(205, 208, 216)",color:"rgb(238, 239, 241)"},{baseName:"red",header:"rgb(248, 180, 180)",color:"rgb(253, 232, 232)"},{baseName:"orange",header:"rgb(253, 186, 140)",color:"rgb(254, 236, 220)"},{baseName:"yellow",header:"rgb(250, 200, 21)",color:"rgb(255, 244, 185)"},{baseName:"green",header:"rgb(132, 225, 188)",color:"rgb(222, 247, 236)"},{baseName:"azure",header:"rgb(126, 220, 226)",color:"rgb(213, 245, 246)"},{baseName:"indigo",header:"rgb(186, 198, 248)",color:"rgb(233, 237, 255)"},{baseName:"purple",header:"rgb(202, 191, 253)",color:"rgb(237, 235, 254)"},{baseName:"magenta",header:"rgb(248, 180, 217)",color:"rgb(252, 232, 243)"}],ma=[{baseName:"blue",rowHeader:"rgb(63, 131, 248)",colHeader:"rgb(195, 221, 253)"},{baseName:"grey",rowHeader:"rgb(95, 101, 116)",colHeader:"rgb(227, 229, 234)"},{baseName:"red",rowHeader:"rgb(240, 82, 82)",colHeader:"rgb(251, 213, 213)"},{baseName:"orange",rowHeader:"rgb(255, 90, 31)",colHeader:"rgb(252, 217, 189)"},{baseName:"yellow",rowHeader:"rgb(212, 157, 15)",colHeader:"rgb(252, 220, 106)"},{baseName:"green",rowHeader:"rgb(13, 164, 113)",colHeader:"rgb(188, 240, 218)"},{baseName:"azure",rowHeader:"rgb(6, 148, 162)",colHeader:"rgb(175, 236, 239)"},{baseName:"indigo",rowHeader:"rgb(70, 106, 247)",colHeader:"rgb(210, 218, 250)"},{baseName:"purple",rowHeader:"rgb(144, 97, 249)",colHeader:"rgb(220, 215, 254)"},{baseName:"magenta",rowHeader:"rgb(231, 70, 148)",colHeader:"rgb(250, 209, 232)"}],ga=[{baseName:"blue",rowHeader:"rgb(30, 66, 159)",firstRow:"rgb(195, 221, 253)",secondRow:"rgb(118, 169, 250)"},{baseName:"grey",rowHeader:"rgb(44, 48, 64)",firstRow:"rgb(227, 229, 234)",secondRow:"rgb(151, 157, 172)"},{baseName:"red",rowHeader:"rgb(155, 28, 28)",firstRow:"rgb(251, 213, 213)",secondRow:"rgb(249, 128, 128)"},{baseName:"orange",rowHeader:"rgb(180, 52, 3)",firstRow:"rgb(252, 217, 189)",secondRow:"rgb(255, 138, 76)"},{baseName:"yellow",rowHeader:"rgb(154, 109, 21)",firstRow:"rgb(252, 220, 106)",secondRow:"rgb(212, 157, 15)"},{baseName:"green",rowHeader:"rgb(4, 108, 78)",firstRow:"rgb(188, 240, 218)",secondRow:"rgb(49, 196, 141)"},{baseName:"azure",rowHeader:"rgb(3, 102, 114)",firstRow:"rgb(175, 236, 239)",secondRow:"rgb(22, 189, 202)"},{baseName:"indigo",rowHeader:"rgb(16, 51, 191)",firstRow:"rgb(210, 218, 250)",secondRow:"rgb(98, 128, 249)"},{baseName:"purple",rowHeader:"rgb(74, 29, 150)",firstRow:"rgb(220, 215, 254)",secondRow:"rgb(172, 148, 250)"},{baseName:"magenta",rowHeader:"rgb(153, 21, 75)",firstRow:"rgb(250, 209, 232)",secondRow:"rgb(241, 126, 184)"}],Ra=ha.map(({baseName:s,header:e,color:t})=>ua(s,e,t)),Ca=ma.map(({baseName:s,rowHeader:e,colHeader:t})=>da(s,e,t)),Sa=ga.map(({baseName:s,rowHeader:e,firstRow:t,secondRow:n})=>ca(s,e,t,n)),fa=[...Ra,...Ca,...Sa],co={headerRowStyle:{bg:{rgb:"rgb(68,114,196)"},cl:{rgb:"rgb(255,255,255)"},ht:i.HorizontalAlign.CENTER,bl:i.BooleanNumber.TRUE},firstRowStyle:{bg:{rgb:"rgb(217,225,242)"}}},Ia=new $e("default",co),va=new $e("default-last-row",{...co,lastRowStyle:{bd:{t:{s:i.BorderStyleTypes.THIN,cl:{rgb:"rgb(68,114,196)"}}},ht:i.HorizontalAlign.CENTER,bl:i.BooleanNumber.TRUE}});class pa{constructor(){f(this,"_toggleRanges",[])}refresh(e,t){const{startRow:n,endRow:o}=e,r=[];let a=0,l=!1,u=-1;for(let d=n;d<=o;d++){if(!t(d)){a++,a%2===1?l=!0:(l=!1,u!==-1&&(r.push([u,d-1]),u=-1));continue}a%2===1?l?u===-1&&(u=d):(l=!0,u=d):l&&(r.push([u,d-2]),l=!1,u=-1),d===o&&l&&r.push([u,d])}this._toggleRanges=r}getToggleRanges(){return this._toggleRanges.concat()}getIsToggled(e){let t=0,n=this._toggleRanges.length-1;for(;t<=n;){const o=Math.floor((t+n)/2),[r,a]=this._toggleRanges[o];if(e<r)n=o-1;else if(e>a)t=o+1;else return!0}return!1}}var wa=Object.getOwnPropertyDescriptor,Ma=(s,e,t,n)=>{for(var o=n>1?void 0:n?wa(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},Fn=(s,e)=>(t,n)=>e(t,n,s);const ya="SHEET_RANGE_THEME_MODEL_PLUGIN";g.SheetRangeThemeModel=class extends i.Disposable{constructor(t,n,o){super();f(this,"_rangeThemeStyleMap",new Map);f(this,"_rangeThemeStyleRuleMap",new Map);f(this,"_rTreeCollection",new Map);f(this,"_defaultRangeThemeMap",new Map);f(this,"_zebraCrossingCacheMap",new Map);f(this,"_rowVisibleFuncSet",new Map);f(this,"_rangeThemeMapChanged$",new O.Subject);f(this,"rangeThemeMapChange$",this._rangeThemeMapChanged$.asObservable());this._sheetInterceptorService=t,this._resourceManagerService=n,this._univerInstanceService=o,this._registerIntercept(),this._initSnapshot(),this._initDefaultTheme()}_initDefaultTheme(){this.registerDefaultRangeTheme(Ia),this.registerDefaultRangeTheme(va);for(const t of fa)this.registerDefaultRangeTheme(t)}_ensureRangeThemeStyleMap(t){return this._rangeThemeStyleMap.has(t)||this._rangeThemeStyleMap.set(t,new Map),this._rangeThemeStyleMap.get(t)}_ensureRangeThemeStyleRuleMap(t){return this._rangeThemeStyleRuleMap.has(t)||this._rangeThemeStyleRuleMap.set(t,new Map),this._rangeThemeStyleRuleMap.get(t)}_ensureRTreeCollection(t){return this._rTreeCollection.has(t)||this._rTreeCollection.set(t,new i.RTree),this._rTreeCollection.get(t)}getDefaultRangeThemeStyle(t){return this._defaultRangeThemeMap.get(t)}getCustomRangeThemeStyle(t,n){return this._ensureRangeThemeStyleMap(t).get(n)}_getSheetRowVisibleFuncSet(t,n){this._rowVisibleFuncSet.has(t)||this._rowVisibleFuncSet.set(t,new Map);const o=this._rowVisibleFuncSet.get(t);return o.has(n)||o.set(n,new Set),o.get(n)}_getSheetRowVisibleHasInit(t,n){var o;return!!(this._rowVisibleFuncSet.has(t)&&((o=this._rowVisibleFuncSet.get(t))!=null&&o.has(n)))}refreshSheetRowVisibleFuncSet(t,n){const o=this._getSheetRowVisibleFuncSet(t,n);o.clear();const r=this._univerInstanceService.getUnit(t);if(r){const a=r.getSheetBySheetId(n);if(a){const l=a.getRowCount(),u=a.getRowManager();for(let d=1;d<=l;d++)a.getRowVisible(d)?u.getRowHeight(d)===0&&o.add(d):o.add(d)}}}_ensureZebraCrossingCache(t,n,o){this._zebraCrossingCacheMap.has(t)||this._zebraCrossingCacheMap.set(t,new Map);const r=this._zebraCrossingCacheMap.get(t);r.has(n)||r.set(n,new Map);const a=r.get(n);return a.has(o)||a.set(o,new pa),a.get(o)}registerRangeThemeRule(t,n){const{unitId:o,subUnitId:r,range:a}=n,l=i.generateRandomId(),u=this._ensureRangeThemeStyleRuleMap(o),d=this._ensureRTreeCollection(o);u.set(l,{rangeInfo:n,themeName:t}),d.insert({unitId:o,sheetId:r,range:a,id:l}),this._getSheetRowVisibleHasInit(o,r)||this.refreshSheetRowVisibleFuncSet(o,r);const c=this._ensureZebraCrossingCache(o,r,l),h=this._getSheetRowVisibleFuncSet(o,r);c.refresh(a,m=>!h.has(m))}getRegisteredRangeThemeStyle(t){const{unitId:n,subUnitId:o,range:r}=t,a=this._ensureRTreeCollection(n),l=Array.from(a.bulkSearch([{unitId:n,sheetId:o,range:r}]));if(l[0]){const d=this._ensureRangeThemeStyleRuleMap(n).get(l[0]);if(d)return d.themeName}}refreshZebraCrossingCacheBySheet(t,n){this._zebraCrossingCacheMap.has(t)||this._zebraCrossingCacheMap.set(t,new Map);const o=this._zebraCrossingCacheMap.get(t);o.has(n)||o.set(n,new Map);const r=o.get(n);r&&r.forEach((a,l)=>{const d=this._ensureRangeThemeStyleRuleMap(t).get(l);d?a.refresh(d.rangeInfo.range,c=>!this._getSheetRowVisibleFuncSet(t,n).has(c)):r.delete(l)})}removeRangeThemeRule(t,n){const{unitId:o,subUnitId:r,range:a}=n,l=this._ensureRTreeCollection(o),u=Array.from(l.bulkSearch([{unitId:o,sheetId:r,range:a}])),d=this._ensureRangeThemeStyleRuleMap(o);for(let c=0;c<u.length;c++){const h=d.get(u[c]);if(h&&h.themeName===t){d.delete(u[c]),l.remove({unitId:o,sheetId:r,range:a,id:u[c]});const m=this._zebraCrossingCacheMap.get(o);if(m){const R=m.get(r);R&&R.delete(u[c])}break}}}registerDefaultRangeTheme(t){this._defaultRangeThemeMap.set(t.getName(),t),this._rangeThemeMapChanged$.next({type:"add",styleName:t.getName()})}unRegisterDefaultRangeTheme(t){this._defaultRangeThemeMap.delete(t),this._rangeThemeMapChanged$.next({type:"remove",styleName:t})}getRegisteredRangeThemes(){return Array.from(this._defaultRangeThemeMap.keys())}registerRangeThemeStyle(t,n){this._ensureRangeThemeStyleMap(t).set(n.getName(),n),this._rangeThemeMapChanged$.next({type:"add",styleName:n.getName()})}unregisterRangeThemeStyle(t,n){this._ensureRangeThemeStyleMap(t).delete(n),this._rangeThemeMapChanged$.next({type:"remove",styleName:n})}getALLRegisteredTheme(t){return Array.from(this._ensureRangeThemeStyleMap(t).keys())}getRangeThemeStyle(t,n){return this._defaultRangeThemeMap.has(n)?this._defaultRangeThemeMap.get(n):this._ensureRangeThemeStyleMap(t).get(n)}getCellStyle(t,n,o,r){const a={startRow:o,startColumn:r,endRow:o,endColumn:r},l=this._ensureRTreeCollection(t),u=Array.from(l.bulkSearch([{unitId:t,sheetId:n,range:a}]));if(u[0]){const c=this._ensureRangeThemeStyleRuleMap(t).get(u[0]);if(c){const{rangeInfo:h,themeName:m}=c,R=o-h.range.startRow,C=r-h.range.startColumn,S=this.getRangeThemeStyle(t,m),v=this._ensureZebraCrossingCache(t,n,u[0]).getIsToggled(o);if(S)return S.getStyle(R,C,o===h.range.endRow,r===h.range.endColumn,v)}}}_registerIntercept(){this.disposeWithMe(this._sheetInterceptorService.intercept(Ve.CELL_CONTENT,{id:ao,effect:i.InterceptorEffectEnum.Style,handler:(t,n,o)=>{const{row:r,col:a,unitId:l,subUnitId:u}=n,d=this.getCellStyle(l,u,r,a);if(d){const c=!t||t===n.rawData?{...n.rawData}:t;return c.themeStyle=d,o(c)}return o(t)}}))}toJson(t){const n=this._ensureRangeThemeStyleRuleMap(t),o=this._ensureRangeThemeStyleMap(t);if(o.size===0&&n.size===0)return"{}";const r={};n.forEach((l,u)=>{r[u]=l});const a={};return o.forEach((l,u)=>{a[u]=l.toJson()}),JSON.stringify({rangeThemeStyleRuleMap:r,rangeThemeStyleMapJson:a})}fromJSON(t,n){const{rangeThemeStyleRuleMap:o,rangeThemeStyleMapJson:r}=n;o&&Object.keys(o).forEach(a=>{const l=o[a],{themeName:u,rangeInfo:d}=l;u.startsWith("table")||(this.registerRangeThemeRule(u,d),this._ensureRTreeCollection(d.unitId).insert({unitId:a,sheetId:d.subUnitId,range:d.range,id:a}))}),r&&Object.keys(r).forEach(a=>{const l=r[a],u=new $e(l.name);u.fromJson(l),this._ensureRangeThemeStyleMap(t).set(u.getName(),u)})}deleteUnitId(t){this._rangeThemeStyleMap.delete(t),this._rangeThemeStyleRuleMap.delete(t),this._rTreeCollection.delete(t)}_initSnapshot(){this.disposeWithMe(this._resourceManagerService.registerPluginResource({toJson:t=>this.toJson(t),parseJson:t=>{if(!t)return{};try{return JSON.parse(t)}catch{return{}}},businesses:[i.UniverInstanceType.UNIVER_SHEET],pluginName:ya,onLoad:(t,n)=>{this.fromJSON(t,n)},onUnLoad:t=>{this.deleteUnitId(t)}}))}dispose(){super.dispose(),this._rangeThemeStyleMap.clear(),this._rangeThemeStyleRuleMap.clear(),this._defaultRangeThemeMap.clear(),this._rTreeCollection.clear(),this._zebraCrossingCacheMap.clear(),this._rowVisibleFuncSet.clear()}},g.SheetRangeThemeModel=Ma([Fn(0,i.Inject(g.SheetInterceptorService)),Fn(1,i.Inject(i.IResourceManagerService)),Fn(2,i.Inject(i.IUniverInstanceService))],g.SheetRangeThemeModel);function jn(s,e){const{unitId:t}=e,n=t?s.getUnit(t,i.UniverInstanceType.UNIVER_SHEET):s.getCurrentUnitOfType(i.UniverInstanceType.UNIVER_SHEET);return n?{workbook:n,unitId:n.getUnitId()}:null}function P(s,e={}){const{unitId:t,subUnitId:n}=e,o=t?s.getUnit(t,i.UniverInstanceType.UNIVER_SHEET):s.getCurrentUnitOfType(i.UniverInstanceType.UNIVER_SHEET);if(!o)return null;const r=n?o.getSheetBySheetId(n):o.getActiveSheet(!0);return r?{worksheet:r,workbook:o,unitId:o.getUnitId(),subUnitId:r.getSheetId()}:null}function pe(s,e){const{unitId:t,subUnitId:n}=e,o=s.getUnit(t,i.UniverInstanceType.UNIVER_SHEET);if(!o)return null;const r=o.getSheetBySheetId(n);return r?{worksheet:r,workbook:o}:null}const dt={id:"sheet.mutation.set-worksheet-range-theme-style",type:i.CommandType.MUTATION,handler:(s,e)=>{if(!P(s.get(i.IUniverInstanceService),e))return!1;const n=s.get(g.SheetRangeThemeModel),{unitId:o,subUnitId:r,range:a,themeName:l}=e;return n.registerRangeThemeRule(l,{range:a,unitId:o,subUnitId:r}),!0}},ho=(s,e)=>{const t=pe(s.get(i.IUniverInstanceService),e);if(!t)throw new Error("[SetWorksheetRangeThemeStyleMutation]: worksheet is null error!");const{worksheet:n}=t;return{unitId:e.unitId,subUnitId:n.getSheetId(),range:e.range,themeName:e.themeName}},ct={id:"sheet.mutation.remove-worksheet-range-theme-style",type:i.CommandType.MUTATION,handler:(s,e)=>{if(!P(s.get(i.IUniverInstanceService),e))return!1;const n=s.get(g.SheetRangeThemeModel),{unitId:o,subUnitId:r,range:a,themeName:l}=e;return n.removeRangeThemeRule(l,{range:a,unitId:o,subUnitId:r}),!0}},mo=(s,e)=>{const t=pe(s.get(i.IUniverInstanceService),e);if(!t)throw new Error("[DeleteWorksheetRangeThemeStyleMutationFactory]: worksheet is null error!");const{worksheet:n}=t;return{unitId:e.unitId,subUnitId:n.getSheetId(),range:e.range,themeName:e.themeName}},sn=(s,e)=>{if(s.get(i.IUniverInstanceService).getUniverSheetInstance(e.unitId)==null)throw new Error("universheet is null error!");return{unitId:e.unitId,subUnitId:e.subUnitId,range:e.range}},re={id:"sheet.mutation.insert-row",type:i.CommandType.MUTATION,handler:(s,e)=>{var C;const{unitId:t,subUnitId:n,range:o,rowInfo:r}=e,l=s.get(i.IUniverInstanceService).getUniverSheetInstance(t);if(l==null)throw new Error("universheet is null error!");const u=l.getSheetBySheetId(n);if(u==null)throw new Error("worksheet is null error!");const d=u.getRowManager().getRowData(),c={h:u.getConfig().defaultRowHeight,hd:0},h=o.startRow,m=o.endRow-o.startRow+1;for(let S=h;S<h+m;S++)r?i.insertMatrixArray(S,(C=r[S-o.startRow])!=null?C:c,d):i.insertMatrixArray(S,c,d);return u.setRowCount(u.getRowCount()+m),u.getCellMatrix().insertRows(o.startRow,m),!0}},At=(s,e)=>{if(s.get(i.IUniverInstanceService).getUniverSheetInstance(e.unitId)==null)throw new Error("universheet is null error!");return{unitId:e.unitId,subUnitId:e.subUnitId,range:e.range}},ie={id:"sheet.mutation.insert-col",type:i.CommandType.MUTATION,handler:(s,e)=>{var C;const n=s.get(i.IUniverInstanceService).getUniverSheetInstance(e.unitId);if(n==null)throw new Error("universheet is null error!");const o=n.getSheetBySheetId(e.subUnitId);if(!o)return!1;const r=o.getColumnManager(),{range:a,colInfo:l}=e,d=r.getColumnData(),c=a.startColumn,h=a.endColumn-a.startColumn+1,m=o.getConfig().defaultColumnWidth;for(let S=c;S<c+h;S++){const I={w:m,hd:0};l?i.insertMatrixArray(S,(C=l[S-a.startColumn])!=null?C:I,d):i.insertMatrixArray(S,I,d)}return o.setColumnCount(o.getColumnCount()+a.endColumn-a.startColumn+1),o.getCellMatrix().insertColumns(a.startColumn,h),!0}},Fe={id:"sheet.mutation.move-range",type:i.CommandType.MUTATION,handler:(s,e)=>{const{from:t,to:n}=e;if(!t||!n)return!1;const r=s.get(i.IUniverInstanceService).getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET);if(!r)return!1;const a=r.getSheetBySheetId(e.from.subUnitId),l=r.getSheetBySheetId(e.to.subUnitId);if(!a||!l)return!1;const u=a.getCellMatrix(),d=l.getCellMatrix();return new i.ObjectMatrix(t.value).forValue((c,h,m)=>{m==null?u.realDeleteValue(c,h):u.setValue(c,h,m)}),new i.ObjectMatrix(n.value).forValue((c,h,m)=>{m==null?d.realDeleteValue(c,h):d.setValue(c,h,m)}),!0}};function go(s,e){const{unitId:t,subUnitId:n,sourceRange:o,targetRange:r}=e,a=o.startRow>r.startRow,l=o.endRow-o.startRow+1;return a?{unitId:t,subUnitId:n,sourceRange:i.Rectangle.clone(r),targetRange:{...o,endRow:o.endRow+l,startRow:o.startRow+l}}:{unitId:t,subUnitId:n,targetRange:i.Rectangle.clone(o),sourceRange:{...r,endRow:r.endRow-l,startRow:r.startRow-l}}}const we={id:"sheet.mutation.move-rows",type:i.CommandType.MUTATION,handler:(s,e)=>{const{unitId:t,subUnitId:n,sourceRange:o,targetRange:r}=e,l=s.get(i.IUniverInstanceService).getUniverSheetInstance(t);if(!l)throw new Error("[MoveRowMutation] univerSheet is null!");const u=l.getSheetBySheetId(n);if(!u)throw new Error("[MoveRowMutation] worksheet is null!");const d=o.startRow,c=o.endRow-o.startRow+1,h=r.startRow,m=u.getRowManager().getRowData();return i.moveMatrixArray(d,c,h,m),u.getCellMatrix().moveRows(d,c,h),!0}};function Ro(s,e){const{unitId:t,subUnitId:n,sourceRange:o,targetRange:r}=e,a=o.startColumn>r.startColumn,l=o.endColumn-o.startColumn+1;return a?{unitId:t,subUnitId:n,sourceRange:i.Rectangle.clone(r),targetRange:{...o,endColumn:o.endColumn+l,startColumn:o.startColumn+l}}:{unitId:t,subUnitId:n,targetRange:i.Rectangle.clone(o),sourceRange:{...r,startColumn:r.startColumn-l,endColumn:r.endColumn-l}}}const Me={id:"sheet.mutation.move-columns",type:i.CommandType.MUTATION,handler:(s,e)=>{const{unitId:t,subUnitId:n,sourceRange:o,targetRange:r}=e,l=s.get(i.IUniverInstanceService).getUniverSheetInstance(t);if(!l)throw new Error("[MoveColumnMutation] univerSheet is null!");const u=l.getSheetBySheetId(n);if(!u)throw new Error("[MoveColumnMutation] worksheet is null!");const d=o.startColumn,c=o.endColumn-o.startColumn+1,h=r.startColumn,m=u.getColumnManager().getColumnData();return i.moveMatrixArray(d,c,h,m),u.getCellMatrix().moveColumns(d,c,h),!0}},_a=(s,e)=>{const o=e.getRowManager().getRowData(),r={},a=s.range,l=i.sliceMatrixArray(a.startRow,a.endRow,o),u=i.concatMatrixArray(r,l);return{unitId:s.unitId,subUnitId:s.subUnitId,range:s.range,rowInfo:u}},ae={id:"sheet.mutation.remove-rows",type:i.CommandType.MUTATION,handler:(s,e)=>{const n=s.get(i.IUniverInstanceService).getUniverSheetInstance(e.unitId);if(n==null)throw new Error("universheet is null error!");const o=n.getSheetBySheetId(e.subUnitId);if(!o)return!1;const r=e.range,l=o.getRowManager().getRowData();for(let c=r.startRow;c<=r.endRow;c++)o.getRowFiltered(c);const u=r.endRow-r.startRow+1;return i.spliceArray(r.startRow,u,l),o.getCellMatrix().removeRows(r.startRow,u),o.setRowCount(o.getRowCount()-u),!0}},ba=(s,e)=>{const n=s.get(i.IUniverInstanceService).getUniverSheetInstance(e.unitId);if(n==null)throw new Error("universheet is null error!");const o=n.getSheetBySheetId(e.subUnitId);if(o==null)throw new Error("worksheet is null error!");const l=o.getColumnManager().getColumnData(),u={},d=e.range,c=i.sliceMatrixArray(d.startColumn,d.endColumn,l),h=i.concatMatrixArray(u,c);return{unitId:e.unitId,subUnitId:e.subUnitId,range:e.range,colInfo:h}},ne={id:"sheet.mutation.remove-col",type:i.CommandType.MUTATION,handler:(s,e)=>{const n=s.get(i.IUniverInstanceService).getUniverSheetInstance(e.unitId);if(n==null)throw new Error("universheet is null error!");const o=n.getSheetBySheetId(e.subUnitId);if(!o)return!1;const r=e.range,l=o.getColumnManager().getColumnData(),u=r.endColumn-r.startColumn+1;return i.spliceArray(r.startColumn,u,l),o.setColumnCount(o.getColumnCount()-u),o.getCellMatrix().removeColumns(r.startColumn,u),!0}},le=(s,e)=>{const n=s.get(i.IUniverInstanceService).getUniverSheetInstance(e.unitId);if(n==null)throw new Error("universheet is null error!");const o=n.getSheetBySheetId(e.subUnitId);if(o==null)throw new Error("worksheet is null error!");const a=o.getConfig().mergeData,l=e.ranges,u=[];for(let d=0;d<l.length;d++)for(let c=a.length-1;c>=0;c--){const h=a[c],m=l[d];i.Rectangle.intersects(h,m)&&u.push(a[c])}return{unitId:e.unitId,subUnitId:e.subUnitId,ranges:u}},G={id:"sheet.mutation.remove-worksheet-merge",type:i.CommandType.MUTATION,handler:(s,e)=>{const n=s.get(i.IUniverInstanceService).getUniverSheetInstance(e.unitId);if(n==null)throw new Error("universheet is null error!");const o=n.getSheetBySheetId(e.subUnitId);if(!o)return!1;const a=o.getConfig().mergeData,l=e.ranges;for(let u=0;u<l.length;u++)for(let d=a.length-1;d>=0;d--){const c=a[d],h=l[u];i.Rectangle.intersects(c,h)&&a.splice(d,1)}return o.getSpanModel().rebuild(a),!0}},Co=s=>{const{order:e}=s,t={};return Object.keys(e).forEach(n=>{t[e[Number(n)]]=Number(n)}),{...s,order:t}},Wt={id:"sheet.mutation.reorder-range",type:i.CommandType.MUTATION,handler:(s,e)=>{const{subUnitId:t,unitId:n,range:o,order:r}=e,u=s.get(i.IUniverInstanceService).getUnit(n).getSheetBySheetId(t);if(!u)return!1;const d=new i.ObjectMatrix;i.Range.foreach(o,(h,m)=>{if(r.hasOwnProperty(h)){const R=r[h],C=i.Tools.deepClone(u.getCellRaw(R,m));d.setValue(h,m,C)}});const c=u.getCellMatrix();return d.forValue((h,m,R)=>{c.setValue(h,m,R)}),!0}};function Ea(s,e){if(s==null)return s;const t=i.Tools.deepClone(s);if(e==null)return t;const n={};return"h"in e&&(n.h=t.h),"ia"in e&&(n.ia=t.ia),"ah"in e&&(n.ah=t.ah),"hd"in e&&(n.hd=t.hd),"s"in e&&(n.s=t.s),"custom"in e&&(n.custom=t.custom),n}function Ta(s,e){if(s==null)return s;const t=i.Tools.deepClone(s);if(e==null)return t;const n={};return"w"in e&&(n.w=t.w),"hd"in e&&(n.hd=t.hd),"s"in e&&(n.s=t.s),"custom"in e&&(n.custom=t.custom),n}const So=(s,e)=>{const{unitId:t,subUnitId:n,columnData:o}=s,r={},a=e.getColumnManager();for(const l in o){const u=o[l],d=a.getColumn(Number(l));r[l]=Ta(d,u)}return{unitId:t,subUnitId:n,columnData:r}},ht={id:"sheet.mutation.set-col-data",type:i.CommandType.MUTATION,handler:(s,e)=>{const{columnData:t}=e,n=s.get(i.IUniverInstanceService),o=P(n,e);if(!o)return!1;const{worksheet:r}=o,a=r.getColumnManager();for(const l in t){const u=t[l];if(u==null){a.removeColumn(Number(l));continue}const d=a.getColumnOrCreate(Number(l));Object.assign(d,u)}return!0}},Ua=(s,e)=>{if(s.get(i.IUniverInstanceService).getUniverSheetInstance(e.unitId)==null)throw new Error("universheet is null error!");return{unitId:e.unitId,subUnitId:e.subUnitId,ranges:e.ranges}},mt={id:"sheet.mutation.set-col-hidden",type:i.CommandType.MUTATION,handler:(s,e)=>{const n=s.get(i.IUniverInstanceService).getUniverSheetInstance(e.unitId);if(!n)return!1;const o=n.getSheetBySheetId(e.subUnitId).getColumnManager();for(let r=0;r<e.ranges.length;r++){const a=e.ranges[r];for(let l=a.startColumn;l<a.endColumn+1;l++){const u=o.getColumnOrCreate(l);u!=null&&(u.hd=i.BooleanNumber.TRUE)}}return!0}},ka=(s,e)=>{if(s.get(i.IUniverInstanceService).getUniverSheetInstance(e.unitId)==null)throw new Error("universheet is null error!");return{unitId:e.unitId,subUnitId:e.subUnitId,ranges:e.ranges}},gt={id:"sheet.mutation.set-col-visible",type:i.CommandType.MUTATION,handler:(s,e)=>{const n=s.get(i.IUniverInstanceService).getUniverSheetInstance(e.unitId);if(!n)return!1;const o=n.getSheetBySheetId(e.subUnitId).getColumnManager();for(let r=0;r<e.ranges.length;r++){const a=e.ranges[r];for(let l=a.startColumn;l<a.endColumn+1;l++){const u=o.getColumnOrCreate(l);u!=null&&(u.hd=i.BooleanNumber.FALSE)}}return!0}},Rt={id:"sheet.mutation.set-gridlines-color",type:i.CommandType.MUTATION,handler:(s,e)=>{const t=P(s.get(i.IUniverInstanceService),e);if(!t)return!1;const{worksheet:n}=t,o=n.getConfig();return o.gridlinesColor=e.color,!0}};function Pa(s,e,t){var a;const n=s.getStyleByCell(e);n==null&&delete e.s,typeof t.s=="string"&&(t.s=s.get(t.s));const o=on(n,t.s?t.s:null);o&&(i.Tools.removeNull(o),Object.entries(o).forEach(([l,u])=>{typeof u=="object"&&u!==null&&Object.keys(u).length===0&&delete o[l]})),i.Tools.isEmptyObject(o)?delete e.s:e.s=s.setValue(o);const r=t.v?`${t.v}\r
|
|
10
|
+
(function(g,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("@univerjs/core"),require("rxjs"),require("@univerjs/engine-formula"),require("rxjs/operators"),require("@univerjs/rpc")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","rxjs","@univerjs/engine-formula","rxjs/operators","@univerjs/rpc"],i):(g=typeof globalThis<"u"?globalThis:g||self,i(g.UniverSheets={},g.UniverCore,g.rxjs,g.UniverEngineFormula,g.rxjs.operators,g.UniverRpc))})(this,(function(g,i,O,K,Dt,ea){"use strict";var Qd=Object.defineProperty;var ec=(g,i,O)=>i in g?Qd(g,i,{enumerable:!0,configurable:!0,writable:!0,value:O}):g[i]=O;var f=(g,i,O)=>ec(g,typeof i!="symbol"?i+"":i,O);function ta(s,e,t){var r,a,l;if(e.t)return e.t;if(e.v===null)return null;const n=s.getStyleByCell(e),o=s.getStyleByCell(t);if(t.t===i.CellValueType.FORCE_STRING){if(!i.isTextFormat((r=o==null?void 0:o.n)==null?void 0:r.pattern)&&e.v!==void 0){if(i.isRealNum(e.v))return i.CellValueType.NUMBER;if(i.isBooleanString(`${e.v}`))return i.CellValueType.BOOLEAN}return i.CellValueType.FORCE_STRING}return na(n)?i.isTextFormat((a=n==null?void 0:n.n)==null?void 0:a.pattern)?i.CellValueType.STRING:ro(e,t):i.isTextFormat((l=o==null?void 0:o.n)==null?void 0:l.pattern)?i.CellValueType.STRING:ro(e,t)}function ro(s,e){return s.v!==void 0?Bn(s.v,s.t):Bn(e.v,e.t)}function na(s){var e;return!!((e=s==null?void 0:s.n)!=null&&e.pattern)}function Bn(s,e){return s===null?null:typeof s=="string"?i.isRealNum(s)?(+s==0||+s==1)&&e===i.CellValueType.BOOLEAN?i.CellValueType.BOOLEAN:e!==i.CellValueType.STRING&&e!==i.CellValueType.FORCE_STRING&&i.willLoseNumericPrecision(s)?i.CellValueType.FORCE_STRING:i.CellValueType.NUMBER:i.isBooleanString(s)?i.CellValueType.BOOLEAN:i.CellValueType.STRING:typeof s=="number"?(s===0||s===1)&&e===i.CellValueType.BOOLEAN?i.CellValueType.BOOLEAN:i.CellValueType.NUMBER:typeof s=="boolean"?i.CellValueType.BOOLEAN:i.CellValueType.FORCE_STRING}function Hn(s,e){const{unitId:t}=e,n=t?s.getUnit(t,i.UniverInstanceType.UNIVER_SHEET):s.getCurrentUnitOfType(i.UniverInstanceType.UNIVER_SHEET);return n?{workbook:n,unitId:n.getUnitId()}:null}function P(s,e={}){const{unitId:t,subUnitId:n}=e,o=t?s.getUnit(t,i.UniverInstanceType.UNIVER_SHEET):s.getCurrentUnitOfType(i.UniverInstanceType.UNIVER_SHEET);if(!o)return null;const r=n?o.getSheetBySheetId(n):o.getActiveSheet(!0);return r?{worksheet:r,workbook:o,unitId:o.getUnitId(),subUnitId:r.getSheetId()}:null}function ne(s,e){const{unitId:t,subUnitId:n}=e,o=s.getUnit(t,i.UniverInstanceType.UNIVER_SHEET);if(!o)return null;const r=o.getSheetBySheetId(n);return r?{worksheet:r,workbook:o}:null}const Re=(s,e)=>{if(!ne(s.get(i.IUniverInstanceService),e))throw new Error("Workbook or worksheet is null error!");return{unitId:e.unitId,subUnitId:e.subUnitId,ranges:i.Tools.deepClone(e.ranges)}},j={id:"sheet.mutation.add-worksheet-merge",type:i.CommandType.MUTATION,handler:(s,e)=>{const t=ne(s.get(i.IUniverInstanceService),e);if(!t)throw new Error("Workbook or worksheet is null error!");const{worksheet:n}=t,r=n.getConfig().mergeData,a=e.ranges;for(let l=0;l<a.length;l++)r.push(a[l]);return n.getSpanModel().rebuild(r),!0}},sa=i.createInterceptorKey("CELL_CONTENT"),oa=i.createInterceptorKey("ROW_FILTERED"),Ve={CELL_CONTENT:sa,ROW_FILTERED:oa};var io=(s=>(s[s.DATA_VALIDATION=9]="DATA_VALIDATION",s[s.NUMFMT=10]="NUMFMT",s[s.CELL_IMAGE=11]="CELL_IMAGE",s))(io||{});const ao="sheet.interceptor.range-theme-id",lo="sheet.interceptor.ignore-range-theme";var ra=Object.getOwnPropertyDescriptor,ia=(s,e,t,n)=>{for(var o=n>1?void 0:n?ra(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},aa=(s,e)=>(t,n)=>e(t,n,s);const Fn=i.createInterceptorKey("BEFORE_CELL_EDIT"),tn=i.createInterceptorKey("AFTER_CELL_EDIT"),nn=i.createInterceptorKey("VALIDATE_CELL");g.SheetInterceptorService=class extends i.Disposable{constructor(t){super();f(this,"_interceptorsByName",new Map);f(this,"_commandInterceptors",[]);f(this,"_rangeInterceptors",[]);f(this,"_autoHeightInterceptors",[]);f(this,"_beforeCommandInterceptor",[]);f(this,"_afterCommandInterceptors",[]);f(this,"_workbookDisposables",new Map);f(this,"_worksheetDisposables",new Map);f(this,"_interceptorsDirty",!1);f(this,"_composedInterceptorByKey",new Map);f(this,"writeCellInterceptor",new i.InterceptorManager({BEFORE_CELL_EDIT:Fn,AFTER_CELL_EDIT:tn,VALIDATE_CELL:nn}));this._univerInstanceService=t,this.disposeWithMe(this._univerInstanceService.getTypeOfUnitAdded$(i.UniverInstanceType.UNIVER_SHEET).subscribe(n=>{this._interceptWorkbook(n)})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitDisposed$(i.UniverInstanceType.UNIVER_SHEET).subscribe(n=>this._disposeWorkbookInterceptor(n))),this.intercept(Ve.CELL_CONTENT,{priority:-1,effect:i.InterceptorEffectEnum.Style|i.InterceptorEffectEnum.Value,handler:n=>n}),this.disposeWithMe(this.writeCellInterceptor.intercept(tn,{priority:-1,handler:n=>n})),this.disposeWithMe(this.writeCellInterceptor.intercept(Fn,{priority:-1,handler:n=>n})),this.disposeWithMe(this.writeCellInterceptor.intercept(nn,{priority:-1,handler:n=>n}))}dispose(){super.dispose(),this._workbookDisposables.forEach(t=>t.dispose()),this._workbookDisposables.clear(),this._worksheetDisposables.forEach(t=>t.dispose()),this._worksheetDisposables.clear(),this._interceptorsByName.clear()}interceptCommand(t){if(this._commandInterceptors.includes(t))throw new Error("[SheetInterceptorService]: Interceptor already exists!");return this._commandInterceptors.push(t),this._commandInterceptors.sort((n,o)=>{var r,a;return((r=o.priority)!=null?r:0)-((a=n.priority)!=null?a:0)}),this.disposeWithMe(i.toDisposable(()=>i.remove(this._commandInterceptors,t)))}onCommandExecute(t){const n=this._commandInterceptors.map(o=>o.getMutations(t));return{preUndos:n.map(o=>{var r;return(r=o.preUndos)!=null?r:[]}).flat(),undos:n.map(o=>o.undos).flat(),preRedos:n.map(o=>{var r;return(r=o.preRedos)!=null?r:[]}).flat(),redos:n.map(o=>o.redos).flat()}}interceptAfterCommand(t){if(this._afterCommandInterceptors.includes(t))throw new Error("[SheetInterceptorService]: Interceptor already exists!");return this._afterCommandInterceptors.push(t),this._afterCommandInterceptors.sort((n,o)=>{var r,a;return((r=o.priority)!=null?r:0)-((a=n.priority)!=null?a:0)}),this.disposeWithMe(i.toDisposable(()=>i.remove(this._afterCommandInterceptors,t)))}afterCommandExecute(t){const n=this._afterCommandInterceptors.map(o=>o.getMutations(t));return{undos:n.map(o=>o.undos).flat(),redos:n.map(o=>o.redos).flat()}}interceptAutoHeight(t){if(this._autoHeightInterceptors.includes(t))throw new Error("[SheetInterceptorService]: Interceptor already exists!");return this._autoHeightInterceptors.push(t),this._autoHeightInterceptors.sort((n,o)=>{var r,a;return((r=o.priority)!=null?r:0)-((a=n.priority)!=null?a:0)}),this.disposeWithMe(i.toDisposable(()=>i.remove(this._autoHeightInterceptors,t)))}generateMutationsOfAutoHeight(t){const n=this._autoHeightInterceptors.map(o=>o.getMutations(t));return{preUndos:n.map(o=>{var r;return(r=o.preUndos)!=null?r:[]}).flat(),undos:n.map(o=>o.undos).flat(),preRedos:n.map(o=>{var r;return(r=o.preRedos)!=null?r:[]}).flat(),redos:n.map(o=>o.redos).flat()}}interceptBeforeCommand(t){if(this._beforeCommandInterceptor.includes(t))throw new Error("[SheetInterceptorService]: Interceptor already exists!");return this._beforeCommandInterceptor.push(t),this._beforeCommandInterceptor.sort((n,o)=>{var r,a;return((r=o.priority)!=null?r:0)-((a=n.priority)!=null?a:0)}),this.disposeWithMe(i.toDisposable(()=>i.remove(this._beforeCommandInterceptor,t)))}async beforeCommandExecute(t){return(await Promise.all(this._beforeCommandInterceptor.map(o=>o.performCheck(t)))).every(o=>o)}interceptRanges(t){if(this._rangeInterceptors.includes(t))throw new Error("[SheetInterceptorService]: Interceptor already exists!");return this._rangeInterceptors.push(t),this._rangeInterceptors.sort((n,o)=>{var r,a;return((r=o.priority)!=null?r:0)-((a=n.priority)!=null?a:0)}),this.disposeWithMe(i.toDisposable(()=>i.remove(this._rangeInterceptors,t)))}generateMutationsByRanges(t){const n=this._rangeInterceptors.map(o=>o.getMutations(t));return{preUndos:n.map(o=>{var r;return(r=o.preUndos)!=null?r:[]}).flat(),undos:n.map(o=>o.undos).flat(),preRedos:n.map(o=>{var r;return(r=o.preRedos)!=null?r:[]}).flat(),redos:n.map(o=>o.redos).flat()}}onWriteCell(t,n,o,r,a){const l={subUnitId:n.getSheetId(),unitId:t.getUnitId(),workbook:t,worksheet:n,row:o,col:r,origin:i.Tools.deepClone(a)};return this.writeCellInterceptor.fetchThroughInterceptors(tn)(a,l)}onValidateCell(t,n,o,r){const a={subUnitId:n.getSheetId(),unitId:t.getUnitId(),workbook:t,worksheet:n,row:o,col:r};return this.writeCellInterceptor.fetchThroughInterceptors(nn)(Promise.resolve(!0),a)}intercept(t,n){const o=t;this._interceptorsByName.has(o)||this._interceptorsByName.set(o,[]);const r=this._interceptorsByName.get(o);r.push(n);const a=r.sort((l,u)=>{var d,c;return((d=u.priority)!=null?d:0)-((c=l.priority)!=null?c:0)});if(this._interceptorsDirty=!0,o===Ve.CELL_CONTENT){const l=i.InterceptorEffectEnum.Style|i.InterceptorEffectEnum.Value;this._interceptorsByName.set(`${o}-${l}`,a);const u=i.InterceptorEffectEnum.Style|i.InterceptorEffectEnum.Value;return this._interceptorsByName.set(`${o}-${i.InterceptorEffectEnum.Style}`,a.filter(d=>((d.effect||u)&i.InterceptorEffectEnum.Style)>0)),this._interceptorsByName.set(`${o}-${i.InterceptorEffectEnum.Value}`,a.filter(d=>((d.effect||u)&i.InterceptorEffectEnum.Value)>0)),this.disposeWithMe(i.toDisposable(()=>{i.remove(this._interceptorsByName.get(o),n),i.remove(this._interceptorsByName.get(`${o}-${l}`),n),i.remove(this._interceptorsByName.get(`${o}-${i.InterceptorEffectEnum.Style}`),n),i.remove(this._interceptorsByName.get(`${o}-${i.InterceptorEffectEnum.Value}`),n)}))}else return this._interceptorsByName.set(o,a),this.disposeWithMe(i.toDisposable(()=>i.remove(this._interceptorsByName.get(o),n)))}fetchThroughInterceptors(t,n,o,r){const a=n===void 0?t:`${t}-${n}`,l=o!=null?o:a;let u=this._composedInterceptorByKey.get(l);if(!u||this._interceptorsDirty){let d=this._interceptorsByName.get(a);d&&r&&(d=d.filter(r)),u=i.composeInterceptors(d||[]),this._composedInterceptorByKey.set(l,u)}return u}_interceptWorkbook(t){const n=new i.DisposableCollection,o=t.getUnitId(),r=this,a=l=>{const u=l.getSheetId();l.__interceptViewModel(d=>{const c=new i.DisposableCollection;r._worksheetDisposables.set(uo(o,l),c),c.add(d.registerCellContentInterceptor({getCell(h,m,R,C,S){const I=l.getCellRaw(h,m);return r.fetchThroughInterceptors(Ve.CELL_CONTENT,R,C,S)(I,{unitId:o,subUnitId:u,row:h,col:m,worksheet:l,workbook:t,rawData:I})}})),c.add(d.registerRowFilteredInterceptor({getRowFiltered(h){return!!r.fetchThroughInterceptors(Ve.ROW_FILTERED)(!1,{unitId:o,subUnitId:u,row:h,workbook:t,worksheet:l})}}))})};t.getSheets().forEach(l=>a(l)),n.add(t.sheetCreated$.subscribe(l=>a(l))),n.add(i.toDisposable(()=>t.getSheets().forEach(l=>this._disposeSheetInterceptor(o,l)))),n.add(t.sheetDisposed$.subscribe(l=>this._disposeSheetInterceptor(o,l))),this._workbookDisposables.set(o,n)}_disposeWorkbookInterceptor(t){const n=t.getUnitId(),o=this._workbookDisposables.get(n);o&&(o.dispose(),this._workbookDisposables.delete(n))}_disposeSheetInterceptor(t,n){const o=uo(t,n),r=this._worksheetDisposables.get(o);r&&(r.dispose(),this._worksheetDisposables.delete(o))}},g.SheetInterceptorService=ia([aa(0,i.IUniverInstanceService)],g.SheetInterceptorService);function uo(s,e){return`${s}|${e.getSheetId()}`}const Z=s=>{const e={};return s.bg&&(e.bg={...s.bg}),s.ol&&(e.ol={...s.ol}),s.bd&&(e.bd={...s.bd}),s.cl&&(e.cl={...s.cl}),s.ht&&(e.ht=s.ht),s.vt&&(e.vt=s.vt),s.bl!==void 0&&(e.bl=s.bl),e};function la(s){const e={};if(s.length===1)return s[0];for(const t of s)t.bg&&(e.bg=t.bg),t.ol&&(e.ol=t.ol),t.bd&&(e.bd={...e.bd,...t.bd}),t.cl&&(e.cl=t.cl),t.ht&&(e.ht=t.ht),t.vt&&(e.vt=t.vt),t.bl!==void 0&&(e.bl=t.bl);return e}const J={wholeStyle:1,headerRowStyle:2,headerColumnStyle:4,firstRowStyle:8,secondRowStyle:16,lastRowStyle:32,firstColumnStyle:128,secondColumnStyle:256,lastColumnStyle:512};class Le{constructor(e,t){f(this,"_name");f(this,"wholeStyle",null);f(this,"headerRowStyle",null);f(this,"headerColumnStyle",null);f(this,"firstRowStyle",null);f(this,"secondRowStyle",null);f(this,"lastRowStyle",null);f(this,"firstColumnStyle",null);f(this,"secondColumnStyle",null);f(this,"lastColumnStyle",null);f(this,"_mergeCacheMap",new Map);t&&this.fromJson({...t,name:e}),this._name=e}getName(){return this._name}getWholeStyle(){return this.wholeStyle}setWholeStyle(e){this.wholeStyle=e,this._resetStyleCache()}getFirstRowStyle(){return this.firstRowStyle}setFirstRowStyle(e){this.firstRowStyle=e,this._resetStyleCache()}getSecondRowStyle(){return this.secondRowStyle}setSecondRowStyle(e){this.secondRowStyle=e,this._resetStyleCache()}getLastRowStyle(){return this.lastRowStyle}setLastRowStyle(e){this.lastRowStyle=e,this._resetStyleCache()}getFirstColumnStyle(){return this.firstColumnStyle}setFirstColumnStyle(e){this.firstColumnStyle=e,this._resetStyleCache()}getSecondColumnStyle(){return this.secondColumnStyle}setSecondColumnStyle(e){this.secondColumnStyle=e,this._resetStyleCache()}getLastColumnStyle(){return this.lastColumnStyle}setLastColumnStyle(e){this.lastColumnStyle=e,this._resetStyleCache()}getHeaderRowStyle(){return this.headerRowStyle}setHeaderRowStyle(e){this.headerRowStyle=e,this._resetStyleCache()}getHeaderColumnStyle(){return this.headerColumnStyle}setHeaderColumnStyle(e){this.headerColumnStyle=e,this._resetStyleCache()}getStyle(e,t,n,o,r){let a=0;return n&&(a=a|J.lastRowStyle),o&&(a=a|J.lastColumnStyle),e>=0&&t>=0&&(a=a|J.wholeStyle),e%2===1&&(a=a|(r?J.secondRowStyle:J.firstRowStyle)),e%2===0&&(a=a|(r?J.firstRowStyle:J.secondRowStyle)),e===0&&(a=a|J.headerRowStyle),t===0&&(a=a|J.headerColumnStyle),t%2===1&&(a=a|J.firstColumnStyle),t%2===0&&(a=a|J.secondColumnStyle),a===0?null:this._getMergeStyle(a)}_getMergeStyle(e){let t=this._mergeCacheMap.get(e);return t||(t=this._mergeStyle(e),this._mergeCacheMap.set(e,t)),t}_mergeStyle(e){const t=[];return this.wholeStyle&&e&J.wholeStyle&&t.push(this.wholeStyle),this.firstColumnStyle&&e&J.firstColumnStyle&&t.push(this.firstColumnStyle),this.secondColumnStyle&&e&J.secondColumnStyle&&t.push(this.secondColumnStyle),this.firstRowStyle&&e&J.firstRowStyle&&t.push(this.firstRowStyle),this.secondRowStyle&&e&J.secondRowStyle&&t.push(this.secondRowStyle),this.headerColumnStyle&&e&J.headerColumnStyle&&t.push(this.headerColumnStyle),this.lastColumnStyle&&e&J.lastColumnStyle&&t.push(this.lastColumnStyle),this.headerRowStyle&&e&J.headerRowStyle&&t.push(this.headerRowStyle),this.lastRowStyle&&e&J.lastRowStyle&&t.push(this.lastRowStyle),la(t)}_resetStyleCache(){this._mergeCacheMap.clear()}toJson(){const e={name:this._name};return this.wholeStyle&&(e.wholeStyle=Z(this.wholeStyle)),this.headerRowStyle&&(e.headerRowStyle=Z(this.headerRowStyle)),this.headerColumnStyle&&(e.headerColumnStyle=Z(this.headerColumnStyle)),this.firstRowStyle&&(e.firstRowStyle=Z(this.firstRowStyle)),this.secondRowStyle&&(e.secondRowStyle=Z(this.secondRowStyle)),this.lastRowStyle&&(e.lastRowStyle=Z(this.lastRowStyle)),this.firstColumnStyle&&(e.firstColumnStyle=Z(this.firstColumnStyle)),this.secondColumnStyle&&(e.secondColumnStyle=Z(this.secondColumnStyle)),this.lastColumnStyle&&(e.lastColumnStyle=Z(this.lastColumnStyle)),e}fromJson(e){this._name=e.name,e.wholeStyle&&(this.wholeStyle=Z(e.wholeStyle)),e.headerRowStyle&&(this.headerRowStyle=Z(e.headerRowStyle)),e.headerColumnStyle&&(this.headerColumnStyle=Z(e.headerColumnStyle)),e.firstRowStyle&&(this.firstRowStyle=Z(e.firstRowStyle)),e.secondRowStyle&&(this.secondRowStyle=Z(e.secondRowStyle)),e.lastRowStyle&&(this.lastRowStyle=Z(e.lastRowStyle)),e.firstColumnStyle&&(this.firstColumnStyle=Z(e.firstColumnStyle)),e.secondColumnStyle&&(this.secondColumnStyle=Z(e.secondColumnStyle)),e.lastColumnStyle&&(this.lastColumnStyle=Z(e.lastColumnStyle))}dispose(){this._mergeCacheMap.clear()}}const ua=(s,e,t)=>new Le(`light-${s}`,{headerRowStyle:{bg:{rgb:e}},firstColumnStyle:{bg:{rgb:"rgb(255, 255, 255)"}},secondColumnStyle:{bg:{rgb:t}},lastRowStyle:{bg:{rgb:e}}}),da=(s,e,t)=>new Le(`middle-${s}`,{headerRowStyle:{bg:{rgb:e}},headerColumnStyle:{bg:{rgb:t}},secondRowStyle:{bg:{rgb:t}},lastRowStyle:{bg:{rgb:e}},lastColumnStyle:{bg:{rgb:t}}}),ca=(s,e,t,n)=>new Le(`dark-${s}`,{headerRowStyle:{bg:{rgb:e},cl:{rgb:"rgb(255, 255, 255)"},ht:i.HorizontalAlign.CENTER,bl:i.BooleanNumber.TRUE},firstRowStyle:{bg:{rgb:t}},secondRowStyle:{bg:{rgb:n}},lastRowStyle:{bg:{rgb:e}}}),ha=[{baseName:"blue",header:"rgb(164, 202, 254)",color:"rgb(225, 239, 254)"},{baseName:"grey",header:"rgb(205, 208, 216)",color:"rgb(238, 239, 241)"},{baseName:"red",header:"rgb(248, 180, 180)",color:"rgb(253, 232, 232)"},{baseName:"orange",header:"rgb(253, 186, 140)",color:"rgb(254, 236, 220)"},{baseName:"yellow",header:"rgb(250, 200, 21)",color:"rgb(255, 244, 185)"},{baseName:"green",header:"rgb(132, 225, 188)",color:"rgb(222, 247, 236)"},{baseName:"azure",header:"rgb(126, 220, 226)",color:"rgb(213, 245, 246)"},{baseName:"indigo",header:"rgb(186, 198, 248)",color:"rgb(233, 237, 255)"},{baseName:"purple",header:"rgb(202, 191, 253)",color:"rgb(237, 235, 254)"},{baseName:"magenta",header:"rgb(248, 180, 217)",color:"rgb(252, 232, 243)"}],ma=[{baseName:"blue",rowHeader:"rgb(63, 131, 248)",colHeader:"rgb(195, 221, 253)"},{baseName:"grey",rowHeader:"rgb(95, 101, 116)",colHeader:"rgb(227, 229, 234)"},{baseName:"red",rowHeader:"rgb(240, 82, 82)",colHeader:"rgb(251, 213, 213)"},{baseName:"orange",rowHeader:"rgb(255, 90, 31)",colHeader:"rgb(252, 217, 189)"},{baseName:"yellow",rowHeader:"rgb(212, 157, 15)",colHeader:"rgb(252, 220, 106)"},{baseName:"green",rowHeader:"rgb(13, 164, 113)",colHeader:"rgb(188, 240, 218)"},{baseName:"azure",rowHeader:"rgb(6, 148, 162)",colHeader:"rgb(175, 236, 239)"},{baseName:"indigo",rowHeader:"rgb(70, 106, 247)",colHeader:"rgb(210, 218, 250)"},{baseName:"purple",rowHeader:"rgb(144, 97, 249)",colHeader:"rgb(220, 215, 254)"},{baseName:"magenta",rowHeader:"rgb(231, 70, 148)",colHeader:"rgb(250, 209, 232)"}],ga=[{baseName:"blue",rowHeader:"rgb(30, 66, 159)",firstRow:"rgb(195, 221, 253)",secondRow:"rgb(118, 169, 250)"},{baseName:"grey",rowHeader:"rgb(44, 48, 64)",firstRow:"rgb(227, 229, 234)",secondRow:"rgb(151, 157, 172)"},{baseName:"red",rowHeader:"rgb(155, 28, 28)",firstRow:"rgb(251, 213, 213)",secondRow:"rgb(249, 128, 128)"},{baseName:"orange",rowHeader:"rgb(180, 52, 3)",firstRow:"rgb(252, 217, 189)",secondRow:"rgb(255, 138, 76)"},{baseName:"yellow",rowHeader:"rgb(154, 109, 21)",firstRow:"rgb(252, 220, 106)",secondRow:"rgb(212, 157, 15)"},{baseName:"green",rowHeader:"rgb(4, 108, 78)",firstRow:"rgb(188, 240, 218)",secondRow:"rgb(49, 196, 141)"},{baseName:"azure",rowHeader:"rgb(3, 102, 114)",firstRow:"rgb(175, 236, 239)",secondRow:"rgb(22, 189, 202)"},{baseName:"indigo",rowHeader:"rgb(16, 51, 191)",firstRow:"rgb(210, 218, 250)",secondRow:"rgb(98, 128, 249)"},{baseName:"purple",rowHeader:"rgb(74, 29, 150)",firstRow:"rgb(220, 215, 254)",secondRow:"rgb(172, 148, 250)"},{baseName:"magenta",rowHeader:"rgb(153, 21, 75)",firstRow:"rgb(250, 209, 232)",secondRow:"rgb(241, 126, 184)"}],Ra=ha.map(({baseName:s,header:e,color:t})=>ua(s,e,t)),Ca=ma.map(({baseName:s,rowHeader:e,colHeader:t})=>da(s,e,t)),Sa=ga.map(({baseName:s,rowHeader:e,firstRow:t,secondRow:n})=>ca(s,e,t,n)),fa=[...Ra,...Ca,...Sa],co={headerRowStyle:{bg:{rgb:"rgb(68,114,196)"},cl:{rgb:"rgb(255,255,255)"},ht:i.HorizontalAlign.CENTER,bl:i.BooleanNumber.TRUE},firstRowStyle:{bg:{rgb:"rgb(217,225,242)"}}},Ia=new Le("default",co),va=new Le("default-last-row",{...co,lastRowStyle:{bd:{t:{s:i.BorderStyleTypes.THIN,cl:{rgb:"rgb(68,114,196)"}}},ht:i.HorizontalAlign.CENTER,bl:i.BooleanNumber.TRUE}});class pa{constructor(){f(this,"_toggleRanges",[])}refresh(e,t){const{startRow:n,endRow:o}=e,r=[];let a=0,l=!1,u=-1;for(let d=n;d<=o;d++){if(!t(d)){a++,a%2===1?l=!0:(l=!1,u!==-1&&(r.push([u,d-1]),u=-1));continue}a%2===1?l?u===-1&&(u=d):(l=!0,u=d):l&&(r.push([u,d-2]),l=!1,u=-1),d===o&&l&&r.push([u,d])}this._toggleRanges=r}getToggleRanges(){return this._toggleRanges.concat()}getIsToggled(e){let t=0,n=this._toggleRanges.length-1;for(;t<=n;){const o=Math.floor((t+n)/2),[r,a]=this._toggleRanges[o];if(e<r)n=o-1;else if(e>a)t=o+1;else return!0}return!1}}var wa=Object.getOwnPropertyDescriptor,Ma=(s,e,t,n)=>{for(var o=n>1?void 0:n?wa(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},jn=(s,e)=>(t,n)=>e(t,n,s);const ya="SHEET_RANGE_THEME_MODEL_PLUGIN";g.SheetRangeThemeModel=class extends i.Disposable{constructor(t,n,o){super();f(this,"_rangeThemeStyleMap",new Map);f(this,"_rangeThemeStyleRuleMap",new Map);f(this,"_rTreeCollection",new Map);f(this,"_defaultRangeThemeMap",new Map);f(this,"_zebraCrossingCacheMap",new Map);f(this,"_rowVisibleFuncSet",new Map);f(this,"_rangeThemeMapChanged$",new O.Subject);f(this,"rangeThemeMapChange$",this._rangeThemeMapChanged$.asObservable());this._sheetInterceptorService=t,this._resourceManagerService=n,this._univerInstanceService=o,this._registerIntercept(),this._initSnapshot(),this._initDefaultTheme()}_initDefaultTheme(){this.registerDefaultRangeTheme(Ia),this.registerDefaultRangeTheme(va);for(const t of fa)this.registerDefaultRangeTheme(t)}_ensureRangeThemeStyleMap(t){return this._rangeThemeStyleMap.has(t)||this._rangeThemeStyleMap.set(t,new Map),this._rangeThemeStyleMap.get(t)}_ensureRangeThemeStyleRuleMap(t){return this._rangeThemeStyleRuleMap.has(t)||this._rangeThemeStyleRuleMap.set(t,new Map),this._rangeThemeStyleRuleMap.get(t)}_ensureRTreeCollection(t){return this._rTreeCollection.has(t)||this._rTreeCollection.set(t,new i.RTree),this._rTreeCollection.get(t)}getDefaultRangeThemeStyle(t){return this._defaultRangeThemeMap.get(t)}getCustomRangeThemeStyle(t,n){return this._ensureRangeThemeStyleMap(t).get(n)}_getSheetRowVisibleFuncSet(t,n){this._rowVisibleFuncSet.has(t)||this._rowVisibleFuncSet.set(t,new Map);const o=this._rowVisibleFuncSet.get(t);return o.has(n)||o.set(n,new Set),o.get(n)}_getSheetRowVisibleHasInit(t,n){var o;return!!(this._rowVisibleFuncSet.has(t)&&((o=this._rowVisibleFuncSet.get(t))!=null&&o.has(n)))}refreshSheetRowVisibleFuncSet(t,n){const o=this._getSheetRowVisibleFuncSet(t,n);o.clear();const r=this._univerInstanceService.getUnit(t);if(r){const a=r.getSheetBySheetId(n);if(a){const l=a.getRowCount(),u=a.getRowManager();for(let d=1;d<=l;d++)a.getRowVisible(d)?u.getRowHeight(d)===0&&o.add(d):o.add(d)}}}_ensureZebraCrossingCache(t,n,o){this._zebraCrossingCacheMap.has(t)||this._zebraCrossingCacheMap.set(t,new Map);const r=this._zebraCrossingCacheMap.get(t);r.has(n)||r.set(n,new Map);const a=r.get(n);return a.has(o)||a.set(o,new pa),a.get(o)}registerRangeThemeRule(t,n){const{unitId:o,subUnitId:r,range:a}=n,l=i.generateRandomId(),u=this._ensureRangeThemeStyleRuleMap(o),d=this._ensureRTreeCollection(o);u.set(l,{rangeInfo:n,themeName:t}),d.insert({unitId:o,sheetId:r,range:a,id:l}),this._getSheetRowVisibleHasInit(o,r)||this.refreshSheetRowVisibleFuncSet(o,r);const c=this._ensureZebraCrossingCache(o,r,l),h=this._getSheetRowVisibleFuncSet(o,r);c.refresh(a,m=>!h.has(m))}getRegisteredRangeThemeStyle(t){const{unitId:n,subUnitId:o,range:r}=t,a=this._ensureRTreeCollection(n),l=Array.from(a.bulkSearch([{unitId:n,sheetId:o,range:r}]));if(l[0]){const d=this._ensureRangeThemeStyleRuleMap(n).get(l[0]);if(d)return d.themeName}}refreshZebraCrossingCacheBySheet(t,n){this._zebraCrossingCacheMap.has(t)||this._zebraCrossingCacheMap.set(t,new Map);const o=this._zebraCrossingCacheMap.get(t);o.has(n)||o.set(n,new Map);const r=o.get(n);r&&r.forEach((a,l)=>{const d=this._ensureRangeThemeStyleRuleMap(t).get(l);d?a.refresh(d.rangeInfo.range,c=>!this._getSheetRowVisibleFuncSet(t,n).has(c)):r.delete(l)})}removeRangeThemeRule(t,n){const{unitId:o,subUnitId:r,range:a}=n,l=this._ensureRTreeCollection(o),u=Array.from(l.bulkSearch([{unitId:o,sheetId:r,range:a}])),d=this._ensureRangeThemeStyleRuleMap(o);for(let c=0;c<u.length;c++){const h=d.get(u[c]);if(h&&h.themeName===t){d.delete(u[c]),l.remove({unitId:o,sheetId:r,range:a,id:u[c]});const m=this._zebraCrossingCacheMap.get(o);if(m){const R=m.get(r);R&&R.delete(u[c])}break}}}registerDefaultRangeTheme(t){this._defaultRangeThemeMap.set(t.getName(),t),this._rangeThemeMapChanged$.next({type:"add",styleName:t.getName()})}unRegisterDefaultRangeTheme(t){this._defaultRangeThemeMap.delete(t),this._rangeThemeMapChanged$.next({type:"remove",styleName:t})}getRegisteredRangeThemes(){return Array.from(this._defaultRangeThemeMap.keys())}registerRangeThemeStyle(t,n){this._ensureRangeThemeStyleMap(t).set(n.getName(),n),this._rangeThemeMapChanged$.next({type:"add",styleName:n.getName()})}unregisterRangeThemeStyle(t,n){this._ensureRangeThemeStyleMap(t).delete(n),this._rangeThemeMapChanged$.next({type:"remove",styleName:n})}getALLRegisteredTheme(t){return Array.from(this._ensureRangeThemeStyleMap(t).keys())}getRangeThemeStyle(t,n){return this._defaultRangeThemeMap.has(n)?this._defaultRangeThemeMap.get(n):this._ensureRangeThemeStyleMap(t).get(n)}getCellStyle(t,n,o,r){const a={startRow:o,startColumn:r,endRow:o,endColumn:r},l=this._ensureRTreeCollection(t),u=Array.from(l.bulkSearch([{unitId:t,sheetId:n,range:a}]));if(u[0]){const c=this._ensureRangeThemeStyleRuleMap(t).get(u[0]);if(c){const{rangeInfo:h,themeName:m}=c,R=o-h.range.startRow,C=r-h.range.startColumn,S=this.getRangeThemeStyle(t,m),v=this._ensureZebraCrossingCache(t,n,u[0]).getIsToggled(o);if(S)return S.getStyle(R,C,o===h.range.endRow,r===h.range.endColumn,v)}}}_registerIntercept(){this.disposeWithMe(this._sheetInterceptorService.intercept(Ve.CELL_CONTENT,{id:ao,effect:i.InterceptorEffectEnum.Style,handler:(t,n,o)=>{const{row:r,col:a,unitId:l,subUnitId:u}=n,d=this.getCellStyle(l,u,r,a);if(d){const c=!t||t===n.rawData?{...n.rawData}:t;return c.themeStyle=d,o(c)}return o(t)}}))}toJson(t){const n=this._ensureRangeThemeStyleRuleMap(t),o=this._ensureRangeThemeStyleMap(t);if(o.size===0&&n.size===0)return"{}";const r={};n.forEach((l,u)=>{r[u]=l});const a={};return o.forEach((l,u)=>{a[u]=l.toJson()}),JSON.stringify({rangeThemeStyleRuleMap:r,rangeThemeStyleMapJson:a})}fromJSON(t,n){const{rangeThemeStyleRuleMap:o,rangeThemeStyleMapJson:r}=n;o&&Object.keys(o).forEach(a=>{const l=o[a],{themeName:u,rangeInfo:d}=l;u.startsWith("table")||(this.registerRangeThemeRule(u,d),this._ensureRTreeCollection(d.unitId).insert({unitId:a,sheetId:d.subUnitId,range:d.range,id:a}))}),r&&Object.keys(r).forEach(a=>{const l=r[a],u=new Le(l.name);u.fromJson(l),this._ensureRangeThemeStyleMap(t).set(u.getName(),u)})}deleteUnitId(t){this._rangeThemeStyleMap.delete(t),this._rangeThemeStyleRuleMap.delete(t),this._rTreeCollection.delete(t)}_initSnapshot(){this.disposeWithMe(this._resourceManagerService.registerPluginResource({toJson:t=>this.toJson(t),parseJson:t=>{if(!t)return{};try{return JSON.parse(t)}catch{return{}}},businesses:[i.UniverInstanceType.UNIVER_SHEET],pluginName:ya,onLoad:(t,n)=>{this.fromJSON(t,n)},onUnLoad:t=>{this.deleteUnitId(t)}}))}dispose(){super.dispose(),this._rangeThemeStyleMap.clear(),this._rangeThemeStyleRuleMap.clear(),this._defaultRangeThemeMap.clear(),this._rTreeCollection.clear(),this._zebraCrossingCacheMap.clear(),this._rowVisibleFuncSet.clear()}},g.SheetRangeThemeModel=Ma([jn(0,i.Inject(g.SheetInterceptorService)),jn(1,i.Inject(i.IResourceManagerService)),jn(2,i.Inject(i.IUniverInstanceService))],g.SheetRangeThemeModel);const dt={id:"sheet.mutation.set-worksheet-range-theme-style",type:i.CommandType.MUTATION,handler:(s,e)=>{if(!P(s.get(i.IUniverInstanceService),e))return!1;const n=s.get(g.SheetRangeThemeModel),{unitId:o,subUnitId:r,range:a,themeName:l}=e;return n.registerRangeThemeRule(l,{range:a,unitId:o,subUnitId:r}),!0}},ho=(s,e)=>{const t=ne(s.get(i.IUniverInstanceService),e);if(!t)throw new Error("[SetWorksheetRangeThemeStyleMutation]: worksheet is null error!");const{worksheet:n}=t;return{unitId:e.unitId,subUnitId:n.getSheetId(),range:e.range,themeName:e.themeName}},ct={id:"sheet.mutation.remove-worksheet-range-theme-style",type:i.CommandType.MUTATION,handler:(s,e)=>{if(!P(s.get(i.IUniverInstanceService),e))return!1;const n=s.get(g.SheetRangeThemeModel),{unitId:o,subUnitId:r,range:a,themeName:l}=e;return n.removeRangeThemeRule(l,{range:a,unitId:o,subUnitId:r}),!0}},mo=(s,e)=>{const t=ne(s.get(i.IUniverInstanceService),e);if(!t)throw new Error("[DeleteWorksheetRangeThemeStyleMutationFactory]: worksheet is null error!");const{worksheet:n}=t;return{unitId:e.unitId,subUnitId:n.getSheetId(),range:e.range,themeName:e.themeName}},sn=(s,e)=>{if(s.get(i.IUniverInstanceService).getUniverSheetInstance(e.unitId)==null)throw new Error("universheet is null error!");return{unitId:e.unitId,subUnitId:e.subUnitId,range:e.range}},ie={id:"sheet.mutation.insert-row",type:i.CommandType.MUTATION,handler:(s,e)=>{var C;const{unitId:t,subUnitId:n,range:o,rowInfo:r}=e,l=s.get(i.IUniverInstanceService).getUniverSheetInstance(t);if(l==null)throw new Error("universheet is null error!");const u=l.getSheetBySheetId(n);if(u==null)throw new Error("worksheet is null error!");const d=u.getRowManager().getRowData(),c={h:u.getConfig().defaultRowHeight,hd:0},h=o.startRow,m=o.endRow-o.startRow+1;for(let S=h;S<h+m;S++)r?i.insertMatrixArray(S,(C=r[S-o.startRow])!=null?C:c,d):i.insertMatrixArray(S,c,d);return u.setRowCount(u.getRowCount()+m),u.getCellMatrix().insertRows(o.startRow,m),!0}},At=(s,e)=>{if(s.get(i.IUniverInstanceService).getUniverSheetInstance(e.unitId)==null)throw new Error("universheet is null error!");return{unitId:e.unitId,subUnitId:e.subUnitId,range:e.range}},ae={id:"sheet.mutation.insert-col",type:i.CommandType.MUTATION,handler:(s,e)=>{var C;const n=s.get(i.IUniverInstanceService).getUniverSheetInstance(e.unitId);if(n==null)throw new Error("universheet is null error!");const o=n.getSheetBySheetId(e.subUnitId);if(!o)return!1;const r=o.getColumnManager(),{range:a,colInfo:l}=e,d=r.getColumnData(),c=a.startColumn,h=a.endColumn-a.startColumn+1,m=o.getConfig().defaultColumnWidth;for(let S=c;S<c+h;S++){const I={w:m,hd:0};l?i.insertMatrixArray(S,(C=l[S-a.startColumn])!=null?C:I,d):i.insertMatrixArray(S,I,d)}return o.setColumnCount(o.getColumnCount()+a.endColumn-a.startColumn+1),o.getCellMatrix().insertColumns(a.startColumn,h),!0}},Fe={id:"sheet.mutation.move-range",type:i.CommandType.MUTATION,handler:(s,e)=>{const{from:t,to:n}=e;if(!t||!n)return!1;const r=s.get(i.IUniverInstanceService).getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET);if(!r)return!1;const a=r.getSheetBySheetId(e.from.subUnitId),l=r.getSheetBySheetId(e.to.subUnitId);if(!a||!l)return!1;const u=a.getCellMatrix(),d=l.getCellMatrix();return new i.ObjectMatrix(t.value).forValue((c,h,m)=>{m==null?u.realDeleteValue(c,h):u.setValue(c,h,m)}),new i.ObjectMatrix(n.value).forValue((c,h,m)=>{m==null?d.realDeleteValue(c,h):d.setValue(c,h,m)}),!0}};function go(s,e){const{unitId:t,subUnitId:n,sourceRange:o,targetRange:r}=e,a=o.startRow>r.startRow,l=o.endRow-o.startRow+1;return a?{unitId:t,subUnitId:n,sourceRange:i.Rectangle.clone(r),targetRange:{...o,endRow:o.endRow+l,startRow:o.startRow+l}}:{unitId:t,subUnitId:n,targetRange:i.Rectangle.clone(o),sourceRange:{...r,endRow:r.endRow-l,startRow:r.startRow-l}}}const we={id:"sheet.mutation.move-rows",type:i.CommandType.MUTATION,handler:(s,e)=>{const{unitId:t,subUnitId:n,sourceRange:o,targetRange:r}=e,l=s.get(i.IUniverInstanceService).getUniverSheetInstance(t);if(!l)throw new Error("[MoveRowMutation] univerSheet is null!");const u=l.getSheetBySheetId(n);if(!u)throw new Error("[MoveRowMutation] worksheet is null!");const d=o.startRow,c=o.endRow-o.startRow+1,h=r.startRow,m=u.getRowManager().getRowData();return i.moveMatrixArray(d,c,h,m),u.getCellMatrix().moveRows(d,c,h),!0}};function Ro(s,e){const{unitId:t,subUnitId:n,sourceRange:o,targetRange:r}=e,a=o.startColumn>r.startColumn,l=o.endColumn-o.startColumn+1;return a?{unitId:t,subUnitId:n,sourceRange:i.Rectangle.clone(r),targetRange:{...o,endColumn:o.endColumn+l,startColumn:o.startColumn+l}}:{unitId:t,subUnitId:n,targetRange:i.Rectangle.clone(o),sourceRange:{...r,startColumn:r.startColumn-l,endColumn:r.endColumn-l}}}const Me={id:"sheet.mutation.move-columns",type:i.CommandType.MUTATION,handler:(s,e)=>{const{unitId:t,subUnitId:n,sourceRange:o,targetRange:r}=e,l=s.get(i.IUniverInstanceService).getUniverSheetInstance(t);if(!l)throw new Error("[MoveColumnMutation] univerSheet is null!");const u=l.getSheetBySheetId(n);if(!u)throw new Error("[MoveColumnMutation] worksheet is null!");const d=o.startColumn,c=o.endColumn-o.startColumn+1,h=r.startColumn,m=u.getColumnManager().getColumnData();return i.moveMatrixArray(d,c,h,m),u.getCellMatrix().moveColumns(d,c,h),!0}},_a=(s,e)=>{const o=e.getRowManager().getRowData(),r={},a=s.range,l=i.sliceMatrixArray(a.startRow,a.endRow,o),u=i.concatMatrixArray(r,l);return{unitId:s.unitId,subUnitId:s.subUnitId,range:s.range,rowInfo:u}},le={id:"sheet.mutation.remove-rows",type:i.CommandType.MUTATION,handler:(s,e)=>{const n=s.get(i.IUniverInstanceService).getUniverSheetInstance(e.unitId);if(n==null)throw new Error("universheet is null error!");const o=n.getSheetBySheetId(e.subUnitId);if(!o)return!1;const r=e.range,l=o.getRowManager().getRowData();for(let c=r.startRow;c<=r.endRow;c++)o.getRowFiltered(c);const u=r.endRow-r.startRow+1;return i.spliceArray(r.startRow,u,l),o.getCellMatrix().removeRows(r.startRow,u),o.setRowCount(o.getRowCount()-u),!0}},ba=(s,e)=>{const n=s.get(i.IUniverInstanceService).getUniverSheetInstance(e.unitId);if(n==null)throw new Error("universheet is null error!");const o=n.getSheetBySheetId(e.subUnitId);if(o==null)throw new Error("worksheet is null error!");const l=o.getColumnManager().getColumnData(),u={},d=e.range,c=i.sliceMatrixArray(d.startColumn,d.endColumn,l),h=i.concatMatrixArray(u,c);return{unitId:e.unitId,subUnitId:e.subUnitId,range:e.range,colInfo:h}},se={id:"sheet.mutation.remove-col",type:i.CommandType.MUTATION,handler:(s,e)=>{const n=s.get(i.IUniverInstanceService).getUniverSheetInstance(e.unitId);if(n==null)throw new Error("universheet is null error!");const o=n.getSheetBySheetId(e.subUnitId);if(!o)return!1;const r=e.range,l=o.getColumnManager().getColumnData(),u=r.endColumn-r.startColumn+1;return i.spliceArray(r.startColumn,u,l),o.setColumnCount(o.getColumnCount()-u),o.getCellMatrix().removeColumns(r.startColumn,u),!0}},ue=(s,e)=>{const t=ne(s.get(i.IUniverInstanceService),e);if(!t)throw new Error("Workbook or worksheet is null error!");const{worksheet:n}=t,r=n.getConfig().mergeData,a=e.ranges,l=[];for(let u=0;u<a.length;u++)for(let d=r.length-1;d>=0;d--){const c=r[d],h=a[u];i.Rectangle.intersects(c,h)&&l.push(r[d])}return{unitId:e.unitId,subUnitId:e.subUnitId,ranges:l}},G={id:"sheet.mutation.remove-worksheet-merge",type:i.CommandType.MUTATION,handler:(s,e)=>{const t=ne(s.get(i.IUniverInstanceService),e);if(!t)throw new Error("Workbook or worksheet is null error!");const{worksheet:n}=t,r=n.getConfig().mergeData,a=e.ranges;for(let l=0;l<a.length;l++)for(let u=r.length-1;u>=0;u--){const d=r[u],c=a[l];i.Rectangle.intersects(d,c)&&r.splice(u,1)}return n.getSpanModel().rebuild(r),!0}},Co=s=>{const{order:e}=s,t={};return Object.keys(e).forEach(n=>{t[e[Number(n)]]=Number(n)}),{...s,order:t}},Wt={id:"sheet.mutation.reorder-range",type:i.CommandType.MUTATION,handler:(s,e)=>{const{subUnitId:t,unitId:n,range:o,order:r}=e,u=s.get(i.IUniverInstanceService).getUnit(n).getSheetBySheetId(t);if(!u)return!1;const d=new i.ObjectMatrix;i.Range.foreach(o,(h,m)=>{if(r.hasOwnProperty(h)){const R=r[h],C=i.Tools.deepClone(u.getCellRaw(R,m));d.setValue(h,m,C)}});const c=u.getCellMatrix();return d.forValue((h,m,R)=>{c.setValue(h,m,R)}),!0}};function Ea(s,e){if(s==null)return s;const t=i.Tools.deepClone(s);if(e==null)return t;const n={};return"h"in e&&(n.h=t.h),"ia"in e&&(n.ia=t.ia),"ah"in e&&(n.ah=t.ah),"hd"in e&&(n.hd=t.hd),"s"in e&&(n.s=t.s),"custom"in e&&(n.custom=t.custom),n}function Ta(s,e){if(s==null)return s;const t=i.Tools.deepClone(s);if(e==null)return t;const n={};return"w"in e&&(n.w=t.w),"hd"in e&&(n.hd=t.hd),"s"in e&&(n.s=t.s),"custom"in e&&(n.custom=t.custom),n}const So=(s,e)=>{const{unitId:t,subUnitId:n,columnData:o}=s,r={},a=e.getColumnManager();for(const l in o){const u=o[l],d=a.getColumn(Number(l));r[l]=Ta(d,u)}return{unitId:t,subUnitId:n,columnData:r}},ht={id:"sheet.mutation.set-col-data",type:i.CommandType.MUTATION,handler:(s,e)=>{const{columnData:t}=e,n=s.get(i.IUniverInstanceService),o=P(n,e);if(!o)return!1;const{worksheet:r}=o,a=r.getColumnManager();for(const l in t){const u=t[l];if(u==null){a.removeColumn(Number(l));continue}const d=a.getColumnOrCreate(Number(l));Object.assign(d,u)}return!0}},Ua=(s,e)=>{if(s.get(i.IUniverInstanceService).getUniverSheetInstance(e.unitId)==null)throw new Error("universheet is null error!");return{unitId:e.unitId,subUnitId:e.subUnitId,ranges:e.ranges}},mt={id:"sheet.mutation.set-col-hidden",type:i.CommandType.MUTATION,handler:(s,e)=>{const n=s.get(i.IUniverInstanceService).getUniverSheetInstance(e.unitId);if(!n)return!1;const o=n.getSheetBySheetId(e.subUnitId).getColumnManager();for(let r=0;r<e.ranges.length;r++){const a=e.ranges[r];for(let l=a.startColumn;l<a.endColumn+1;l++){const u=o.getColumnOrCreate(l);u!=null&&(u.hd=i.BooleanNumber.TRUE)}}return!0}},ka=(s,e)=>{if(s.get(i.IUniverInstanceService).getUniverSheetInstance(e.unitId)==null)throw new Error("universheet is null error!");return{unitId:e.unitId,subUnitId:e.subUnitId,ranges:e.ranges}},gt={id:"sheet.mutation.set-col-visible",type:i.CommandType.MUTATION,handler:(s,e)=>{const n=s.get(i.IUniverInstanceService).getUniverSheetInstance(e.unitId);if(!n)return!1;const o=n.getSheetBySheetId(e.subUnitId).getColumnManager();for(let r=0;r<e.ranges.length;r++){const a=e.ranges[r];for(let l=a.startColumn;l<a.endColumn+1;l++){const u=o.getColumnOrCreate(l);u!=null&&(u.hd=i.BooleanNumber.FALSE)}}return!0}},Rt={id:"sheet.mutation.set-gridlines-color",type:i.CommandType.MUTATION,handler:(s,e)=>{const t=P(s.get(i.IUniverInstanceService),e);if(!t)return!1;const{worksheet:n}=t,o=n.getConfig();return o.gridlinesColor=e.color,!0}};function Pa(s,e,t){var a;const n=s.getStyleByCell(e);n==null&&delete e.s,typeof t.s=="string"&&(t.s=s.get(t.s));const o=on(n,t.s?t.s:null);o&&(i.Tools.removeNull(o),Object.entries(o).forEach(([l,u])=>{typeof u=="object"&&u!==null&&Object.keys(u).length===0&&delete o[l]})),i.Tools.isEmptyObject(o)?delete e.s:e.s=s.setValue(o);const r=t.v?`${t.v}\r
|
|
11
11
|
`:"";!t.p&&e.p&&(r&&r!==((a=e.p.body)==null?void 0:a.dataStream)?delete e.p:Da(e.p,t.s?t.s:null))}function Na(s,e){if(!e||!Object.keys(e).length)return s;const t=i.Tools.deepClone(s!=null?s:{});for(const n in e)n==="bd"?t[n]=Oa(t[n]||{},e[n]):n in t||(t[n]=null);return t}function Oa(s,e){if(!e||!Object.keys(e).length)return s;for(const t in e)t in s||(s[t]=null);return s}function on(s,e,t=!1){if(e===null)return e;if(e===void 0)return s;const n=i.Tools.deepClone(s)||{};for(const o in e)t&&["bd","tr","td","ht","vt","tb","pd","bg"].includes(o)||(o in n&&o==="bd"?n[o]=Object.assign(n[o],e[o]):n[o]=e[o]);return"cl"in n&&("ul"in n&&n.ul&&(n.ul.cl=n.cl),"ol"in n&&n.ol&&(n.ol.cl=n.cl),"st"in n&&n.st&&(n.st.cl=n.cl)),n}function fo(s,e){return s.some(t=>t.startIndex===e)?fo(s,e+1):e}function Da(s,e){var a;if(s.body==null)return;Array.isArray(s.body.textRuns)||(s.body.textRuns=[]);let t=0;const n=[],o=((a=s.body)==null?void 0:a.paragraphs)||[];for(const l of s.body.textRuns){const{st:u,ed:d,ts:c={}}=l;if(t<u){const m={st:t,ed:u},R=on({},e,!0);R&&i.Tools.removeNull(R),i.Tools.isEmptyObject(R)||(m.ts=R),n.push(m)}const h=on(c,e,!0);h&&i.Tools.removeNull(h),i.Tools.isEmptyObject(h)?delete l.ts:l.ts=h,n.push(l),t=fo(o,d)}const r=s.body.dataStream.endsWith(`\r
|
|
12
|
-
`)?s.body.dataStream.length-2:s.body.dataStream.length;if(t<r){const l={st:t,ed:r},u=on({},e,!0);u&&i.Tools.removeNull(u),i.Tools.isEmptyObject(u)||(l.ts=u),n.push(l)}s.body.textRuns=i.normalizeTextRuns(n)}function Io(s,e){return e.v===void 0||e.v===null?e.v:s===i.CellValueType.NUMBER?Number(e.v):s===i.CellValueType.BOOLEAN?Aa(e.v)?1:0:s===i.CellValueType.STRING||s===i.CellValueType.FORCE_STRING?`${e.v}`:e.v}function Aa(s){if(typeof s=="string"){if(s.toUpperCase()==="TRUE")return!0;if(s.toUpperCase()==="FALSE")return!1;if(i.isSafeNumeric(s)){if(Number(s)===0)return!1;if(Number(s)===1)return!0}}if(typeof s=="number"){if(s===0)return!1;if(s===1)return!0}return typeof s=="boolean"?s:null}function Wa(s){return s==null?null:(s.f===void 0&&(s.f=null),s.si===void 0&&(s.si=null),s.p===void 0&&(s.p=null),s.v===void 0&&(s.v=null),s.t===void 0&&(s.t=null),s.s===void 0&&(s.s=null),s.custom===void 0&&(s.custom=null),s)}const ce=(s,e)=>{const{unitId:t,subUnitId:n,cellValue:o}=e,a=s.get(i.IUniverInstanceService).getUniverSheetInstance(t);if(a==null)throw new Error("workbook is null error!");const l=a.getSheetBySheetId(n);if(l==null)throw new Error("worksheet is null error!");const u=l.getCellMatrix(),d=a.getStyles(),c=new i.ObjectMatrix;return new i.ObjectMatrix(o).forValue((m,R,C)=>{const S=i.Tools.deepClone(u==null?void 0:u.getValue(m,R))||{},I=d.getStyleByCell(S),v=d.getStyleByCell(C);S.s=Na(I,v),c.setValue(m,R,Wa(S))}),{...e,options:{},cellValue:c.getMatrix()}},F={id:"sheet.mutation.set-range-values",type:i.CommandType.MUTATION,handler:(s,e)=>{const{cellValue:t,subUnitId:n,unitId:o}=e,a=s.get(i.IUniverInstanceService).getUnit(o);if(!a)return!1;const l=a.getSheetBySheetId(n);if(!l)return!1;const u=l.getCellMatrix(),d=a.getStyles();return new i.ObjectMatrix(t).forValue((h,m,R)=>{if(!R)u.realDeleteValue(h,m);else{let C=u.getValue(h,m)||{};C=$a(R,C,d),i.Tools.isEmptyObject(C)?u.realDeleteValue(h,m):u.setValue(h,m,C)}}),!0}},Va=new Set(["f","p","si","custom","ref","xf"]);function $a(s,e,t){const n=ta(t,s,e);return Object.keys(s).forEach(o=>{const r=o;if(Va.has(r)){const a=s[r];La(e,r,a)}else r==="v"?s.v!==void 0&&(e.v=Io(n,s)):r==="s"&&Pa(t,e,s)}),e.v!==void 0&&(e.t=n,e.v=Io(n,e)),e.v===null&&(delete e.t,delete e.v),e}function La(s,e,t){t===void 0||(t===null?delete s[e]:s[e]=t)}const vo=(s,e)=>{const{unitId:t,subUnitId:n,rowData:o}=s,r={},a=e.getRowManager();for(const l in o){const u=o[l],d=a.getRow(Number(l));r[l]=Ea(d,u)}return{unitId:t,subUnitId:n,rowData:r}},Ct={id:"sheet.mutation.set-row-data",type:i.CommandType.MUTATION,handler:(s,e)=>{const{rowData:t}=e,n=s.get(i.IUniverInstanceService),o=P(n,e);if(!o)return!1;const{worksheet:r}=o,a=r.getRowManager();for(const l in t){const u=t[l];if(u==null){a.removeRow(Number(l));continue}const d=a.getRowOrCreate(Number(l));Object.assign(d,u)}return!0}},Ba=(s,e)=>{if(s.get(i.IUniverInstanceService).getUniverSheetInstance(e.unitId)==null)throw new Error("universheet is null error!");return{unitId:e.unitId,subUnitId:e.subUnitId,ranges:e.ranges}},Je={id:"sheet.mutation.set-row-visible",type:i.CommandType.MUTATION,handler:(s,e)=>{const n=s.get(i.IUniverInstanceService).getUniverSheetInstance(e.unitId);if(n==null)throw new Error("universheet is null error!");const o=n.getSheetBySheetId(e.subUnitId).getRowManager();for(let r=0;r<e.ranges.length;r++){const a=e.ranges[r];for(let l=a.startRow;l<a.endRow+1;l++){const u=o.getRowOrCreate(l);u!=null&&(u.hd=0)}}return!0}},Ha=(s,e)=>{if(s.get(i.IUniverInstanceService).getUniverSheetInstance(e.unitId)==null)throw new Error("universheet is null error!");return{unitId:e.unitId,subUnitId:e.subUnitId,ranges:e.ranges}},Xe={id:"sheet.mutation.set-row-hidden",type:i.CommandType.MUTATION,handler:(s,e)=>{const n=s.get(i.IUniverInstanceService).getUniverSheetInstance(e.unitId);if(n==null)throw new Error("universheet is null error!");const o=n.getSheetBySheetId(e.subUnitId).getRowManager();for(let r=0;r<e.ranges.length;r++){const a=e.ranges[r];for(let l=a.startRow;l<a.endRow+1;l++){const u=o.getRowOrCreate(l);u!=null&&(u.hd=1)}}return!0}},Gn=(s,e)=>{const{unitId:t,subUnitId:n,ranges:o}=s,r={},a=e.getColumnManager();for(let l=0;l<o.length;l++){const u=o[l];for(let d=u.startColumn;d<u.endColumn+1;d++)r[d]=a.getColumnWidth(d)}return{unitId:t,subUnitId:n,ranges:o,colWidth:r}},Le={id:"sheet.mutation.set-worksheet-col-width",type:i.CommandType.MUTATION,handler:(s,e)=>{const t=s.get(i.IUniverInstanceService),n=P(t,e);if(!n)return!1;const{worksheet:o}=n,r=o.getColumnManager(),a=e.ranges;for(let l=0;l<a.length;l++){const u=a[l];for(let d=u.startColumn;d<u.endColumn+1;d++)o.getColVisible(d)&&(typeof e.colWidth=="number"?r.setColumnWidth(d,e.colWidth):i.Tools.isDefine(e.colWidth[d])&&r.setColumnWidth(d,e.colWidth[d]))}return!0}},po=(s,e)=>{const t=pe(s.get(i.IUniverInstanceService),e);if(!t)throw new Error("[SetWorksheetColumnCountUndoMutationFactory]: worksheet is null error!");return{unitId:e.unitId,subUnitId:e.subUnitId,columnCount:t.worksheet.getColumnCount()}},St={id:"sheet.mutation.set-worksheet-column-count",type:i.CommandType.MUTATION,handler:(s,e)=>{const t=s.get(i.IUniverInstanceService),n=pe(t,e);return n?(n.worksheet.setColumnCount(e.columnCount),!0):!1}},ft={id:"sheet.mutation.set-worksheet-default-style",type:i.CommandType.MUTATION,handler:(s,e)=>{const t=P(s.get(i.IUniverInstanceService),e);if(!t)return!1;const{worksheet:n}=t,{defaultStyle:o}=e;return n.setDefaultCellStyle(o),!0}},wo=(s,e)=>{const t=pe(s.get(i.IUniverInstanceService),e);if(!t)throw new Error("[SetWorksheetDefaultStyleMutationFactory]: worksheet is null error!");const{worksheet:n}=t;return{unitId:e.unitId,subUnitId:n.getSheetId(),defaultStyle:n.getDefaultCellStyle()}},Mo=(s,e)=>{const t=pe(s.get(i.IUniverInstanceService),e);if(!t)throw new Error("[SetWorksheetRowCountUndoMutationFactory]: worksheet is null error!");return{unitId:e.unitId,subUnitId:e.subUnitId,rowCount:t.worksheet.getRowCount()}},It={id:"sheet.mutation.set-worksheet-row-count",type:i.CommandType.MUTATION,handler:(s,e)=>{const t=s.get(i.IUniverInstanceService),n=pe(t,e);return n?(n.worksheet.setRowCount(e.rowCount),!0):!1}},yo=(s,e)=>{var l,u;const{unitId:t,subUnitId:n,ranges:o}=s,r={},a=e.getRowManager();for(const{startRow:d,endRow:c}of o)for(let h=d;h<c+1;h++)r[h]=(u=(l=a.getRow(h))==null?void 0:l.h)!=null?u:e.getConfig().defaultRowHeight;return{unitId:t,subUnitId:n,ranges:o,rowHeight:r}},zn=(s,e)=>{var l;const{unitId:t,subUnitId:n,ranges:o}=s,r={},a=e.getRowManager();for(const{startRow:u,endRow:d}of o)for(let c=u;c<=d;c++)r[c]=(l=a.getRow(c))==null?void 0:l.ia;return{unitId:t,subUnitId:n,ranges:o,autoHeightInfo:r}},Fa=(s,e)=>{var l,u;const{unitId:t,subUnitId:n,rowsAutoHeightInfo:o}=s,r=[],a=e.getRowManager();for(const d of o){const{row:c}=d;r.push({row:c,autoHeight:(u=(l=a.getRow(c))==null?void 0:l.ah)!=null?u:e.getConfig().defaultRowHeight})}return{unitId:t,subUnitId:n,rowsAutoHeightInfo:r}},Te={id:"sheet.mutation.set-worksheet-row-height",type:i.CommandType.MUTATION,handler:(s,e)=>{const{ranges:t,rowHeight:n}=e,o=s.get(i.IUniverInstanceService),r=P(o,e);if(!r)return!1;const{worksheet:a}=r,l=a.getRowManager();for(const{startRow:u,endRow:d}of t)for(let c=u;c<=d;c++)typeof n=="number"?l.setRowHeight(c,n):i.Tools.isDefine(n[c])&&l.setRowHeight(c,n[c]);return!0}},Re={id:"sheet.mutation.set-worksheet-row-is-auto-height",type:i.CommandType.MUTATION,handler:(s,e)=>{var l;const{ranges:t,autoHeightInfo:n}=e,o=s.get(i.IUniverInstanceService),r=P(o,e);if(!r)return!1;const a=r.worksheet.getRowManager();for(const{startRow:u,endRow:d}of t)for(let c=u;c<=d;c++){const h=a.getRowOrCreate(c);typeof n=="number"?h.ia=n:h.ia=(l=n[c])!=null?l:void 0}return!0}},qn={id:"sheet.mutation.set-worksheet-row-auto-height",type:i.CommandType.MUTATION,handler:(s,e)=>{const{rowsAutoHeightInfo:t}=e,n=s.get(i.IUniverInstanceService),o=P(n,e);if(!o)return!1;const r=o.worksheet.getRowManager();for(const{row:a,autoHeight:l}of t){const u=r.getRowOrCreate(a);u.ah=l}return!0}},vt={id:"sheet.mutation.toggle-gridlines",type:i.CommandType.MUTATION,handler:(s,e)=>{const t=P(s.get(i.IUniverInstanceService),e);if(!t)return!1;const{worksheet:n}=t,o=n.getConfig();return o.showGridlines=e.showGridlines,!0}},Ze={id:"sheet.operation.set-worksheet-active",type:i.CommandType.OPERATION,handler:(s,e)=>{const t=s.get(i.IUniverInstanceService).getUniverSheetInstance(e.unitId);if(!t)return!1;const n=t.getWorksheets();for(const[,o]of n)if(o.getSheetId()===e.subUnitId)return t.setActiveSheet(o),!0;return!1}};var _o=(s=>(s.SET_WORKSHEET_ROW_HEIGHT="sheet.mutation.set-worksheet-row-height",s.SET_WORKSHEET_ROW_IS_AUTO_HEIGHT="sheet.mutation.set-worksheet-row-is-auto-height",s.SET_WORKSHEET_ROW_AUTO_HEIGHT="sheet.mutation.set-worksheet-row-auto-height",s.SET_WORKSHEET_COL_WIDTH="sheet.mutation.set-worksheet-col-width",s.SET_WORKSHEET_ACTIVE="sheet.operation.set-worksheet-active",s.MOVE_ROWS="sheet.mutation.move-rows",s.MOVE_COLUMNS="sheet.mutation.move-columns",s.SET_COL_HIDDEN="sheet.mutation.set-col-hidden",s.SET_COL_VISIBLE="sheet.mutation.set-col-visible",s.SET_ROW_HIDDEN="sheet.mutation.set-row-hidden",s.SET_ROW_VISIBLE="sheet.mutation.set-row-visible",s.INSERT_COL="sheet.mutation.insert-col",s.INSERT_ROW="sheet.mutation.insert-row",s.REMOVE_COL="sheet.mutation.remove-col",s.REMOVE_ROW="sheet.mutation.remove-rows",s.TOGGLE_GRIDLINES="sheet.mutation.toggle-gridlines",s.SET_GRIDLINES_COLOR="sheet.mutation.set-gridlines-color",s))(_o||{}),bo=(s=>(s.SET_RANGE_VALUES="sheet.mutation.set-range-values",s.MOVE_RANGE="sheet.mutation.move-range",s.REMOVE_WORKSHEET_MERGE="sheet.mutation.remove-worksheet-merge",s.ADD_WORKSHEET_MERGE="sheet.mutation.add-worksheet-merge",s.REORDER_RANGE="sheet.mutation.reorder-range",s.SET_WORKSHEET_DEFAULT_STYLE="sheet.mutation.set-worksheet-default-style",s.SET_ROW_DATA="sheet.mutation.set-row-data",s.SET_COL_DATA="sheet.mutation.set-col-data",s.SET_WORKSHEET_RANGE_THEME_STYLE="sheet.mutation.set-worksheet-range-theme-style",s.DELETE_WORKSHEET_RANGE_THEME_STYLE="sheet.mutation.delete-worksheet-range-theme-style",s))(bo||{});const ja=[Te.id,Re.id,qn.id,Le.id,Ze.id,we.id,Me.id,mt.id,gt.id,Xe.id,Je.id,ie.id,re.id,ne.id,ae.id,vt.id,Rt.id,It.id,St.id],Ga=[F.id,Fe.id,G.id,j.id,Wt.id,ft.id,Ct.id,ht.id,dt.id,ct.id];function za(s){switch(s.id){case"sheet.mutation.set-range-values":{const e=s.params,t=new i.ObjectMatrix(e.cellValue).getDataRange();return t.endRow===-1?[]:e.cellValue?[{unitId:e.unitId,subUnitId:e.subUnitId,range:t}]:[]}case"sheet.mutation.move-range":{const e=s.params;return[{unitId:e.unitId,subUnitId:e.from.subUnitId,range:new i.ObjectMatrix(e.from.value).getRange()},{unitId:e.unitId,subUnitId:e.to.subUnitId,range:new i.ObjectMatrix(e.to.value).getRange()}]}case"sheet.mutation.remove-worksheet-merge":{const e=s.params;return e.ranges.map(t=>({unitId:e.unitId,subUnitId:e.subUnitId,range:t}))}case"sheet.mutation.add-worksheet-merge":{const e=s.params;return e.ranges.map(t=>({unitId:e.unitId,subUnitId:e.subUnitId,range:t}))}case"sheet.mutation.reorder-range":{const e=s.params;return[{unitId:e.unitId,subUnitId:e.subUnitId,range:e.range}]}case"sheet.mutation.set-worksheet-default-style":{const e=s.params;return[{unitId:e.unitId,subUnitId:e.subUnitId,range:{startRow:0,endRow:Number.MAX_SAFE_INTEGER,startColumn:0,endColumn:Number.MAX_SAFE_INTEGER}}]}case"sheet.mutation.set-row-data":{const e=s.params,t=Object.keys(e.rowData).map(Number);return t.length===0?[]:[{unitId:e.unitId,subUnitId:e.subUnitId,range:{startRow:Math.min(...t),endRow:Math.max(...t),startColumn:0,endColumn:Number.MAX_SAFE_INTEGER}}]}case"sheet.mutation.set-col-data":{const e=s.params,t=Object.keys(e.columnData).map(Number);return t.length===0?[]:[{unitId:e.unitId,subUnitId:e.subUnitId,range:{startRow:0,endRow:Number.MAX_SAFE_INTEGER,startColumn:Math.min(...t),endColumn:Math.max(...t)}}]}case"sheet.mutation.set-worksheet-range-theme-style":case"sheet.mutation.delete-worksheet-range-theme-style":{const e=s.params;return[{unitId:e.unitId,subUnitId:e.subUnitId,range:e.range}]}default:return[]}}function qa(s,e){switch(s.id){case"sheet.mutation.set-worksheet-row-height":case"sheet.mutation.set-worksheet-row-is-auto-height":{const t=s.params;return t.ranges.map(n=>({unitId:t.unitId,subUnitId:t.subUnitId,range:{...n,rangeType:i.RANGE_TYPE.ROW}}))}case"sheet.mutation.set-worksheet-row-auto-height":{const t=s.params;return t.rowsAutoHeightInfo.map(n=>({unitId:t.unitId,subUnitId:t.subUnitId,range:{startRow:n.row,endRow:n.row,startColumn:0,endColumn:e-1,rangeType:i.RANGE_TYPE.ROW}}))}case"sheet.mutation.set-worksheet-col-width":{const t=s.params;return t.ranges.map(n=>({unitId:t.unitId,subUnitId:t.subUnitId,range:{...n,rangeType:i.RANGE_TYPE.COLUMN}}))}case"sheet.mutation.move-rows":case"sheet.mutation.move-columns":{const t=s.params;return[{unitId:t.unitId,subUnitId:t.subUnitId,range:t.targetRange},{unitId:t.unitId,subUnitId:t.subUnitId,range:t.sourceRange}]}case"sheet.mutation.set-col-hidden":case"sheet.mutation.set-col-visible":{const t=s.params;return t.ranges.map(n=>({unitId:t.unitId,subUnitId:t.subUnitId,range:{...n,rangeType:i.RANGE_TYPE.COLUMN}}))}case"sheet.mutation.set-row-hidden":case"sheet.mutation.set-row-visible":{const t=s.params;return t.ranges.map(n=>({unitId:t.unitId,subUnitId:t.subUnitId,range:{...n,rangeType:i.RANGE_TYPE.ROW}}))}case"sheet.mutation.insert-col":{const t=s.params;return[{unitId:t.unitId,subUnitId:t.subUnitId,range:{...t.range,rangeType:i.RANGE_TYPE.COLUMN}}]}case"sheet.mutation.insert-row":{const t=s.params;return[{unitId:t.unitId,subUnitId:t.subUnitId,range:{...t.range,rangeType:i.RANGE_TYPE.ROW}}]}case"sheet.mutation.remove-col":{const t=s.params;return[{unitId:t.unitId,subUnitId:t.subUnitId,range:{...t.range,rangeType:i.RANGE_TYPE.COLUMN}}]}case"sheet.mutation.remove-rows":{const t=s.params;return[{unitId:t.unitId,subUnitId:t.subUnitId,range:{...t.range,rangeType:i.RANGE_TYPE.ROW}}]}case"sheet.mutation.toggle-gridlines":case"sheet.mutation.set-gridlines-color":return[];default:return[]}}function Eo(s){return s==null?!1:s.v!==void 0&&s.v!==null&&s.v!==""||s.p!==void 0}function je(s,e){return s&&s.spanAnchor?Eo(e.getValue(s.spanAnchor.startRow,s.spanAnchor.startColumn)):Eo(s)}function Ya(s,e,t,n,o){const r=s.getCellMatrix(),a=s.getSpanModel().getMergedCellRange(e,t,n,o),l=new i.ObjectMatrix;return r.forValue((u,d)=>{const c=r.getValue(u,d);c&&l.setValue(u,d,c)}),a.forEach(u=>{const{startColumn:d,startRow:c,endColumn:h,endRow:m}=u;i.createRowColIter(c,m,d,h).forEach((R,C)=>{R===c&&C===d&&l.setValue(R,C,{...r.getValue(R,C),spanAnchor:{startRow:c,endRow:m,startColumn:d,endColumn:h}}),(R!==c||C!==d)&&(l.realDeleteValue(R,C),l.setValue(R,C,{spanAnchor:{startRow:c,endRow:m,startColumn:d,endColumn:h}}))})}),l}function xa(s,e,t,n){const{startRow:o,startColumn:r,endRow:a}=s;let l=null,u=!1;for(let d=o;d<=a;d++){const c=e.getValue(d,r-t);if(u=u||je(c,e),!n&&u)break;c&&c.spanAnchor&&(l?l={startRow:Math.min(c.spanAnchor.startRow,l.startRow),startColumn:Math.min(c.spanAnchor.startColumn,l.startColumn),endRow:Math.max(c.spanAnchor.endRow,l.endRow),endColumn:Math.max(c.spanAnchor.endColumn,l.endColumn)}:l={startRow:c.spanAnchor.startRow,startColumn:c.spanAnchor.startColumn,endRow:c.spanAnchor.endRow,endColumn:c.spanAnchor.endColumn})}return u?(s.startColumn=s.startColumn-t,{spanAnchor:l,hasValue:!0,range:s}):l?{spanAnchor:i.Rectangle.simpleRangesIntersect(s,l)?l:null,hasValue:!1,range:s}:{spanAnchor:null,hasValue:!1,range:s}}function Ka(s,e,t,n){const{startRow:o,endColumn:r,endRow:a}=s;let l=null,u=!1;for(let d=o;d<=a;d++){const c=e.getValue(d,r+t);if(u=u||je(c,e),!n&&u)break;c&&c.spanAnchor&&(l?l={startRow:Math.min(c.spanAnchor.startRow,l.startRow),startColumn:Math.min(c.spanAnchor.startColumn,l.startColumn),endRow:Math.max(c.spanAnchor.endRow,l.endRow),endColumn:Math.max(c.spanAnchor.endColumn,l.endColumn)}:l={startRow:c.spanAnchor.startRow,startColumn:c.spanAnchor.startColumn,endRow:c.spanAnchor.endRow,endColumn:c.spanAnchor.endColumn})}return u?(s.endColumn=s.endColumn+t,{spanAnchor:l,hasValue:!0,range:s}):l?{spanAnchor:i.Rectangle.simpleRangesIntersect(s,l)?l:null,hasValue:!1,range:s}:{spanAnchor:null,hasValue:!1,range:s}}function Ja(s,e,t,n){const{startRow:o,startColumn:r,endColumn:a}=s;let l=null,u=!1;for(let d=r;d<=a;d++){const c=e.getValue(o-t,d);if(u=u||je(c,e),!n&&u)break;c&&c.spanAnchor&&(l?l={startRow:Math.min(c.spanAnchor.startRow,l.startRow),startColumn:Math.min(c.spanAnchor.startColumn,l.startColumn),endRow:Math.max(c.spanAnchor.endRow,l.endRow),endColumn:Math.max(c.spanAnchor.endColumn,l.endColumn)}:l={startRow:c.spanAnchor.startRow,startColumn:c.spanAnchor.startColumn,endRow:c.spanAnchor.endRow,endColumn:c.spanAnchor.endColumn})}return u?(s.startRow=s.startRow-t,{spanAnchor:l,hasValue:!0,range:s}):l?{spanAnchor:i.Rectangle.simpleRangesIntersect(s,l)?l:null,hasValue:!1,range:s}:{spanAnchor:null,hasValue:!1,range:s}}function Xa(s,e,t,n){const{startColumn:o,endColumn:r,endRow:a}=s;let l=null,u=!1;for(let d=o;d<=r;d++){const c=e.getValue(a+t,d);if(u=u||je(c,e),!n&&u)break;c&&c.spanAnchor&&(l?l={startRow:Math.min(c.spanAnchor.startRow,l.startRow),startColumn:Math.min(c.spanAnchor.startColumn,l.startColumn),endRow:Math.max(c.spanAnchor.endRow,l.endRow),endColumn:Math.max(c.spanAnchor.endColumn,l.endColumn)}:l={startRow:c.spanAnchor.startRow,startColumn:c.spanAnchor.startColumn,endRow:c.spanAnchor.endRow,endColumn:c.spanAnchor.endColumn})}return u?(s.endRow=s.endRow+t,{spanAnchor:l,hasValue:!0,range:s}):l?{spanAnchor:i.Rectangle.simpleRangesIntersect(s,l)?l:null,hasValue:!1,range:s}:{spanAnchor:null,hasValue:!1,range:s}}function Za({range:s,allMatrixWithSpan:e,directions:t,isWorksheetHasSpan:n,maxRow:o,maxColumn:r}){const{left:a,right:l,up:u,down:d}=t,{startRow:c,startColumn:h,endRow:m,endColumn:R}=s;let C=!1;if(a&&u&&c>0&&h>0){const S=e.getValue(c-1,h-1);je(S,e)&&(n&&S.spanAnchor?(s.startRow=S.spanAnchor.startRow,s.startColumn=S.spanAnchor.startColumn):(s.startRow=c-1,s.startColumn=h-1),C=!0)}if(l&&u&&c>0&&R<r-1){const S=e.getValue(c-1,R+1);je(S,e)&&(n&&S.spanAnchor?(s.startRow=S.spanAnchor.startRow,s.endColumn=S.spanAnchor.endColumn):(s.startRow=c-1,s.endColumn=R+1),C=!0)}if(a&&d&&m<o-1&&h>0){const S=e.getValue(m+1,h-1);je(S,e)&&(n&&S.spanAnchor?(s.endRow=S.spanAnchor.endRow,s.startColumn=S.spanAnchor.startColumn):(s.endRow=m+1,s.startColumn=h-1),C=!0)}if(l&&d&&m<o-1&&R<r-1){const S=e.getValue(m+1,R+1);je(S,e)&&(n&&S.spanAnchor?(s.endRow=S.spanAnchor.endRow,s.endColumn=S.spanAnchor.endColumn):(s.endRow=m+1,s.endColumn=R+1),C=!0)}return{hasValue:C,range:s}}function Qa(s,e,t){const n=t.getMaxRows(),o=t.getMaxColumns(),r=Ya(t,0,0,n-1,o-1),a=t.getSnapshot().mergeData.length>0,{left:l,right:u,up:d,down:c}=e;let h=!0,m={...s};const R=[];for(;h;){h=!1;const C=Za({range:m,allMatrixWithSpan:r,directions:e,isWorksheetHasSpan:a,maxRow:n,maxColumn:o});if(C.hasValue){m=C.range,h=!0;continue}if(d&&m.startRow!==0){const{hasValue:S,range:I,spanAnchor:v}=Ja(m,r,1,a);if(v&&R.push(v),S){m=I,h=!0;continue}}if(c&&m.endRow!==n-1){const{hasValue:S,range:I,spanAnchor:v}=Xa(m,r,1,a);if(v&&R.push(v),S){m=I,h=!0;continue}}if(l&&m.startColumn!==0){const{hasValue:S,range:I,spanAnchor:v}=xa(m,r,1,a);if(v&&R.push(v),S){m=I,h=!0;continue}}if(u&&m.endColumn!==o-1){const{hasValue:S,range:I,spanAnchor:v}=Ka(m,r,1,a);if(v&&R.push(v),S){m=I,h=!0;continue}}}return R.length>0&&(m=i.Rectangle.union(m,...R)),m}const To=s=>{const e=new i.ObjectMatrix;return s.forEach(t=>{i.Range.foreach(t,(n,o)=>{e.setValue(n,o,1)})}),e.forValue((t,n)=>{const o=e.getValue(t-1,n);o&&e.setValue(t,n,o+1)}),e},Uo=s=>{const e=s;return e.forValue((t,n)=>{const o=s.getValue(t-1,n);o&&e.setValue(t,n,o+1)}),e},ko=s=>{const e={area:0},t=(n,o)=>e.area<n?(e.area=n,e.range=o,!0):!1;return s.forValue((n,o,r)=>{let a=1,l=r;t(a*l,{startRow:n-l+1,endRow:n,startColumn:o,endColumn:o});const u={startRow:n-l+1,endRow:n,startColumn:0,endColumn:o};for(let d=o-1;d>=0&&s.getValue(n,d);d--){l=Math.min(s.getValue(n,d)||0,l),a++;const c=l*a;u.startColumn=d,u.startRow=n-l+1,t(c,u)}}),e},el=(s,e)=>{i.Range.foreach(e,(t,n)=>{s.realDeleteValue(t,n)});for(let t=e.startColumn;t<=e.endColumn;t++){const n=e.endRow+1;if(s.getValue(n,t)>0){s.setValue(n,t,1);let r=n+1;for(;s.getValue(r,t)>0;)s.setValue(r,t,s.getValue(r-1,t)+1),r++}}return s},Yn=s=>{const e=[];let t=ko(s);for(;t.area>0;)t.range&&(e.push(t.range),el(s,t.range)),t=ko(s);return e},xn=s=>{const e=To(s);return Yn(e)};class tl{constructor(){f(this,"_matrix",new i.ObjectMatrix)}add(...e){return e.forEach(t=>{i.Range.foreach(t,(n,o)=>{this._matrix.setValue(n,o,1)})}),this}subtract(...e){return e.forEach(t=>{i.Range.foreach(t,(n,o)=>{this._matrix.realDeleteValue(n,o)})}),this}merge(){const e=Uo(this._matrix);return Yn(e)}}const nl=1.5,sl="rgba(255, 255, 255, 0.01)";function ol(s){const{rangeWithCoord:e,primaryWithCoord:t,style:n}=s,o={range:{startRow:e.startRow,startColumn:e.startColumn,endRow:e.endRow,endColumn:e.endColumn,rangeType:e.rangeType,unitId:e.unitId,sheetId:e.sheetId},primary:null,style:n};return t!=null&&(o.primary=Po(t)),o}function Po(s){const{actualRow:e,actualColumn:t,isMerged:n,isMergedMainCell:o}=s,{startRow:r,startColumn:a,endRow:l,endColumn:u}=s.mergeInfo;return{actualRow:e,actualColumn:t,isMerged:n,isMergedMainCell:o,startRow:r,startColumn:a,endRow:l,endColumn:u}}var No=(s=>(s[s.Tab=1]="Tab",s[s.Comma=2]="Comma",s[s.Semicolon=4]="Semicolon",s[s.Space=8]="Space",s[s.Custom=16]="Custom",s))(No||{});class rl{constructor(){f(this,"_tabCount",0);f(this,"_commaCount",0);f(this,"_semicolonCount",0);f(this,"_spaceCount",0)}add(e){switch(e){case" ":this._tabCount++;break;case",":this._commaCount++;break;case";":this._semicolonCount++;break;case" ":this._spaceCount++;break}}update(e){e&&typeof e=="string"&&(e.includes(" ")&&this._tabCount++,e.includes(",")&&this._commaCount++,e.includes(";")&&this._semicolonCount++,e.trim().includes(" ")&&this._spaceCount++)}getDelimiter(){const e=Math.max(this._tabCount,this._commaCount,this._semicolonCount,this._spaceCount);return e===0||e===this._tabCount?1:e===this._commaCount?2:e===this._semicolonCount?4:e===this._spaceCount?8:1}}function il(s,e,t){const n=[];t!==void 0&&(s&16)>0&&n.push(t),(s&1)>0&&n.push(" "),(s&2)>0&&n.push(","),(s&4)>0&&n.push(";"),(s&8)>0&&n.push(" ");let o="";for(const a of n)o+=al(a);let r="[".concat(o,"]");return e&&(r+="+"),new RegExp(r)}function al(s){return s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const ll=s=>{var t;return((t=s.body)==null?void 0:t.dataStream.replace(/\r\n$/,""))||""};function ul(s){if(s!=null){if(s.p)return ll(s.p);if(s.v&&typeof s.v=="string")return s.v;if(s.t&&(s.t===i.CellValueType.FORCE_STRING||s.t===i.CellValueType.STRING))return String(s.v)}}function Oo(s,e,t,n,o=!1){const r=i.Range.transformRange(e,s),{startColumn:a,startRow:l,endColumn:u,endRow:d}=r;if(a!==u)throw new Error("The range must be in the same column.");if(t&&(t&16)>0&&(n===void 0||n.length!==1))throw new Error("The custom delimiter must a character.");const c=t===void 0,h=c?new rl:null,m=[];for(let p=l;p<=d;p++){const w=s.getCell(p,a),y=ul(w);m.push(y),h&&h.update(y)}const R=c?h.getDelimiter():t,C=il(R,o,n);let S=-1,I=0,v=0;const M=[];for(const p of m){if(p!==void 0){const w=String(p).split(C);S<0?S=w.length:S=Math.max(S,w.length),M.push(w),I=v}else M.push(void 0);v++}return{rs:M,maxLength:S===-1?0:S,lastRow:I}}const dl=(s,e,t="")=>s.reduce((n,o)=>{const r=o&&o[e];return typeof r!="string"?(console.warn(o,`${e} is not string`),n):(r?(n[r]||(n[r]=[]),n[r].push(o)):n[t].push(o),n)},{}),cl=(s=0)=>{let e=s;return function(){return e++}};function hl(s){return s==null?!1:s.v!==void 0&&s.v!==null&&s.v!==""||s.p!==void 0}function ml(s,e){for(let t=s.startRow;t<=s.endRow;t++)for(let n=s.startColumn;n<=s.endColumn;n++){const o=e.getCell(t,n);if(hl(o))return{startRow:t,startColumn:n,endRow:t,endColumn:n}}return null}function Kn(s){const e=new i.ObjectMatrix;return s.forEach(t=>{const{startRow:n,startColumn:o,endRow:r,endColumn:a}=t;for(let l=n;l<=r;l++)for(let u=o;u<=a;u++)e.setValue(l,u,null)}),e.clone()}function Do(s){const e=new i.ObjectMatrix;return s.forEach(t=>{const{startRow:n,startColumn:o,endRow:r,endColumn:a}=t;for(let l=n;l<=r;l++)for(let u=o;u<=a;u++)e.setValue(l,u,{v:null,p:null,f:null,si:null,custom:null})}),e.clone()}function gl(s){const e=new i.ObjectMatrix;return s.forEach(t=>{const{startRow:n,startColumn:o,endRow:r,endColumn:a}=t;for(let l=n;l<=r;l++)for(let u=o;u<=a;u++)e.setValue(l,u,{s:null})}),e.clone()}function Ao(s,e,t,n){const o=e.get(i.IUniverInstanceService),r=t?o.getUnit(t,i.UniverInstanceType.UNIVER_SHEET):o.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET),a=n?r==null?void 0:r.getSheetBySheetId(n):r==null?void 0:r.getActiveSheet();if(!a)return null;const{startRow:l,endRow:u,startColumn:d,endColumn:c}=s,h=[],m=[];for(let R=l;R<=u;R++)a.getRowFiltered(R)||h.push(R);for(let R=d;R<=c;R++)m.push(R);return{rows:h,cols:m}}function Vt(s,e,t,n){const o=[],r=[];for(const m of s){const R=Ao(m,e,t,n);R&&(o.push(...R.rows),r.push(...R.cols))}const a=Array.from(new Set(o)).sort((m,R)=>m-R),l=Array.from(new Set(r)).sort((m,R)=>m-R),u=[];function d(m){const R=[];let C=m[0];for(let S=1;S<m.length;S++)m[S]!==m[S-1]+1&&(R.push([C,m[S-1]]),C=m[S]);return R.push([C,m[m.length-1]]),R}const c=d(a),h=d(l);for(const[m,R]of c)for(const[C,S]of h)u.push({startRow:m,endRow:R,startColumn:C,endColumn:S});return u}var Wo=(s=>(s.OthersCanView="othersCanView",s.NoOneElseCanView="noOneElseCanView",s))(Wo||{}),Vo=(s=>(s.DesignedUserCanEdit="designedUserCanEdit",s.OnlyMe="onlyMe",s))(Vo||{});class X{constructor(){f(this,"_model",new Map);f(this,"_ruleChange$",new O.Subject);f(this,"ruleChange$",this._ruleChange$.asObservable());f(this,"_ruleRefresh$",new O.Subject);f(this,"ruleRefresh$",this._ruleRefresh$.asObservable());f(this,"_rangeRuleInitStateChange",new O.BehaviorSubject(!1));f(this,"rangeRuleInitStateChange$",this._rangeRuleInitStateChange.asObservable())}dispose(){this._ruleChange$.complete(),this._ruleRefresh$.complete()}ruleRefresh(e){this._ruleRefresh$.next(e)}getRangeRuleInitState(){return this._rangeRuleInitStateChange.value}changeRuleInitState(e){this._rangeRuleInitStateChange.next(e)}addRule(e,t,n){this._ensureRuleMap(e,t).set(n.id,n),this._ruleChange$.next({unitId:e,subUnitId:t,rule:n,type:"add"})}deleteRule(e,t,n){var r,a,l,u;const o=(a=(r=this._model.get(e))==null?void 0:r.get(t))==null?void 0:a.get(n);o&&((u=(l=this._model.get(e))==null?void 0:l.get(t))==null||u.delete(n),this._ruleChange$.next({unitId:e,subUnitId:t,rule:o,type:"delete"}))}setRule(e,t,n,o){var a,l;const r=this.getRule(e,t,n);r&&((l=(a=this._model.get(e))==null?void 0:a.get(t))==null||l.set(n,o),this._ruleChange$.next({unitId:e,subUnitId:t,oldRule:r,rule:o,type:"set"}))}getRule(e,t,n){var o,r;return(r=(o=this._model.get(e))==null?void 0:o.get(t))==null?void 0:r.get(n)}getSubunitRuleList(e,t){var o;return[...(((o=this._model.get(e))==null?void 0:o.get(t))||new Map).values()]}getSubunitRuleListLength(e,t){var o;const n=(o=this._model.get(e))==null?void 0:o.get(t);return n?n.size:0}_ensureRuleMap(e,t){let n=this._model.get(e);n||(n=new Map,this._model.set(e,n));let o=n.get(t);return o||(o=new Map,n.set(t,o)),o}toObject(){const e={};return[...this._model.keys()].forEach(n=>{const o=this._model.get(n),r=[...o.keys()];e[n]={},r.forEach(a=>{const l=o.get(a);e[n][a]=[...l.values()]})}),e}fromObject(e){const t=new Map;Object.keys(e).forEach(n=>{const o=e[n],r=new Map;Object.keys(o).forEach(a=>{const l=o[a].reduce((u,d)=>(u.set(d.id,d),u),new Map);r.set(a,l)}),t.set(n,r)}),this._model=t}deleteUnitModel(e){this._model.delete(e)}createRuleId(e,t){let n=i.generateRandomId(4);const o=this._ensureRuleMap(e,t);for(;o.has(n);)n=i.generateRandomId(4);return n}getTargetByPermissionId(e,t){const n=this._model.get(e);if(!n)return null;for(const[o,r]of n)for(const a of r.values())if(a.permissionId===t)return[e,o];return null}}const Rl=(s,e)=>{const t=s.get(X),n=e.ruleIds.map(r=>t.getRule(e.unitId,e.subUnitId,r)).filter(r=>!!r);return{id:Ce.id,params:{subUnitId:e.subUnitId,unitId:e.unitId,rules:n}}},Ue={id:"sheet.mutation.delete-range-protection",type:i.CommandType.MUTATION,handler:(s,e)=>{const{unitId:t,subUnitId:n,ruleIds:o}=e,r=s.get(X);return o.forEach(a=>{r.deleteRule(t,n,a)}),!0}},Cl=s=>{const e={...s,ruleIds:s.rules.map(t=>t.id)};return{id:Ue.id,params:e}},Ce={id:"sheet.mutation.add-range-protection",type:i.CommandType.MUTATION,handler:(s,e)=>{const{unitId:t,subUnitId:n,rules:o}=e,r=s.get(X);return o.forEach(a=>{r.addRule(t,n,a)}),!0}},$o={type:i.CommandType.COMMAND,id:"sheet.command.add-range-protection",async handler(s,e){if(!e)return!1;const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),o=s.get(X),{rule:r,permissionId:a}=e,{unitId:l,subUnitId:u,ranges:d,description:c,viewState:h,editState:m}=r,R=[{ranges:d,permissionId:a,id:o.createRuleId(l,u),description:c,unitType:r.unitType,unitId:l,subUnitId:u,viewState:h,editState:m}];if(await t.executeCommand(Ce.id,{unitId:l,subUnitId:u,rules:R})){const S=[{id:Ce.id,params:{unitId:l,subUnitId:u,rules:R}}],I=[{id:Ue.id,params:{unitId:l,subUnitId:u,ruleIds:R.map(v=>v.id)}}];n.pushUndoRedo({unitID:l,redoMutations:S,undoMutations:I})}return!0}};var Q=(s=>(s[s.MOVE_START=0]="MOVE_START",s[s.MOVING=1]="MOVING",s[s.MOVE_END=2]="MOVE_END",s[s.ONLY_SET=3]="ONLY_SET",s))(Q||{});class Lo extends i.Disposable{constructor(t){super();f(this,"_worksheetSelections",new Map);f(this,"_selectionMoveStart$",new O.Subject);f(this,"selectionMoveStart$",this._selectionMoveStart$.asObservable());f(this,"_selectionMoving$",new O.Subject);f(this,"selectionMoving$",this._selectionMoving$.asObservable());f(this,"_selectionMoveEnd$",new O.BehaviorSubject([]));f(this,"selectionMoveEnd$",this._selectionMoveEnd$.asObservable());f(this,"_selectionSet$",new O.BehaviorSubject([]));f(this,"selectionSet$",this._selectionSet$.asObservable());f(this,"selectionChanged$");f(this,"_beforeSelectionMoveEnd$",new O.BehaviorSubject([]));f(this,"beforeSelectionMoveEnd$",this._beforeSelectionMoveEnd$.asObservable());this._workbook=t,this.selectionChanged$=O.merge(this._selectionMoveEnd$,this._selectionSet$)}dispose(){super.dispose(),this._beforeSelectionMoveEnd$.complete(),this._selectionMoveEnd$.complete(),this._selectionMoving$.complete(),this._selectionMoveStart$.complete(),this._selectionSet$.complete(),this._workbook=null}addSelections(t,n){const o=this.getSelectionsOfWorksheet(t);o.push(...n),this._selectionSet$.next(o)}setSelections(t,n=[],o){switch(this.setSelectionsOfWorksheet(t,n),o){case Q.MOVE_START:this._selectionMoveStart$.next(n);break;case Q.MOVING:this._selectionMoving$.next(n);break;case Q.MOVE_END:this._beforeSelectionMoveEnd$.next(n),this._selectionMoveEnd$.next(n);break;case Q.ONLY_SET:{this._selectionSet$.next(n);break}default:this._selectionSet$.next(n);break}}getCurrentSelections(){return this._getCurrentSelections()}getSelectionOfWorksheet(t){return this.getSelectionsOfWorksheet(t)}getSelectionsOfWorksheet(t){return this._worksheetSelections.has(t)||this._worksheetSelections.set(t,[]),this._worksheetSelections.get(t)}setSelectionsOfWorksheet(t,n){this._worksheetSelections.set(t,[...n])}deleteSheetSelection(t){this._worksheetSelections.set(t,[])}clear(){this._worksheetSelections.clear(),this._selectionSet$.next([])}_getCurrentSelections(){return this.getSelectionsOfWorksheet(this._workbook.getActiveSheet().getSheetId())}getCurrentLastSelection(){const t=this._getCurrentSelections();return t[t.length-1]}}var Sl=Object.getOwnPropertyDescriptor,fl=(s,e,t,n)=>{for(var o=n>1?void 0:n?Sl(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},Il=(s,e)=>(t,n)=>e(t,n,s);g.SheetsSelectionsService=class extends i.RxDisposable{constructor(t){super();f(this,"_cellStylesCache",new Map);f(this,"selectionMoveStart$");f(this,"selectionMoving$");f(this,"selectionMoveEnd$");f(this,"selectionSet$");f(this,"selectionChanged$");f(this,"_workbookSelections",new Map);this._instanceSrv=t,this._init()}get _currentSelectionPos(){const t=this._instanceSrv.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET);if(!t)return null;const n=t.getActiveSheet();return{unitId:t.getUnitId(),sheetId:n.getSheetId()}}get currentSelectionParam(){return this._currentSelectionPos}_init(){const t=this._instanceSrv.getCurrentTypeOfUnit$(i.UniverInstanceType.UNIVER_SHEET).pipe(O.shareReplay(1),O.takeUntil(this.dispose$));this.selectionMoveStart$=t.pipe().pipe(O.switchMap(n=>n?this._ensureWorkbookSelection(n.getUnitId()).selectionMoveStart$:O.of())).pipe(O.takeUntil(this.dispose$)),this.selectionMoving$=t.pipe(O.switchMap(n=>n?this._ensureWorkbookSelection(n.getUnitId()).selectionMoving$:O.of())).pipe(O.takeUntil(this.dispose$)),this.selectionMoveEnd$=t.pipe(O.switchMap(n=>n?this._ensureWorkbookSelection(n.getUnitId()).selectionMoveEnd$:O.of([]))).pipe(O.takeUntil(this.dispose$)),this.selectionSet$=t.pipe(O.switchMap(n=>n?this._ensureWorkbookSelection(n.getUnitId()).selectionSet$:O.of([]))).pipe(O.takeUntil(this.dispose$)),this.selectionChanged$=t.pipe(O.switchMap(n=>n?this._ensureWorkbookSelection(n.getUnitId()).selectionChanged$:O.of([]))).pipe(O.distinctUntilChanged((n,o)=>n.length!==o.length?!1:n.length===0&&o.length===0?!0:n.every((r,a)=>JSON.stringify(r)===JSON.stringify(o[a]))),O.skip(1)).pipe(O.takeUntil(this.dispose$)),this.disposeWithMe(this._instanceSrv.getTypeOfUnitDisposed$(i.UniverInstanceType.UNIVER_SHEET).pipe(O.takeUntil(this.dispose$)).subscribe(n=>{this._removeWorkbookSelection(n.getUnitId())})),this.disposeWithMe(this.selectionChanged$.pipe(O.takeUntil(this.dispose$)).subscribe(()=>{this._cellStylesCache.clear()}))}dispose(){super.dispose(),this._cellStylesCache.clear(),this._workbookSelections.forEach(t=>t.dispose()),this._workbookSelections.clear(),this.selectionMoveStart$=O.of(null),this.selectionMoving$=O.of(null),this.selectionMoveEnd$=O.of([]),this.selectionSet$=O.of(null),this.selectionChanged$=O.of(null)}clear(){this._workbookSelections.forEach(t=>t.clear())}getCurrentSelections(){return this._getCurrentSelections()}getCurrentLastSelection(){const t=this._getCurrentSelections();return t==null?void 0:t[t.length-1]}addSelections(t,n,o){if(typeof t=="string"){this._ensureWorkbookSelection(t).addSelections(n,o);return}const r=this._currentSelectionPos;if(!r)throw new Error("[SheetsSelectionsService]: cannot find current selection position!");const{unitId:a,sheetId:l}=r;this._ensureWorkbookSelection(a).addSelections(l,t)}setSelections(t,n,o,r){if(typeof t=="string"&&typeof n=="string"){const d=t;this._ensureWorkbookSelection(d).setSelections(n,o||[],r!=null?r:Q.ONLY_SET);return}const a=this._currentSelectionPos;if(!a)throw new Error("[SheetsSelectionsService]: cannot find current selection position!");const{unitId:l,sheetId:u}=a;if(typeof t=="object"){const d=t!=null?t:o,c=n!=null?n:Q.ONLY_SET;this._ensureWorkbookSelection(l).setSelections(u,d,c)}}clearCurrentSelections(){this._getCurrentSelections().splice(0)}isOverlapping(){const t=this.getCurrentSelections();return t==null?!1:t.some(({range:n},o)=>t.some(({range:r},a)=>o===a?!1:n.startRow<=r.endRow&&n.endRow>=r.startRow&&n.startColumn<=r.endColumn&&n.endColumn>=r.startColumn))}_getCurrentSelections(){const t=this._currentSelectionPos;if(!t)return[];const{unitId:n,sheetId:o}=t;return this._ensureWorkbookSelection(n).getSelectionsOfWorksheet(o)}getWorkbookSelections(t){return this._ensureWorkbookSelection(t)}_ensureWorkbookSelection(t){let n=this._workbookSelections.get(t);if(!n){const o=this._instanceSrv.getUnit(t);if(!o)throw new Error(`[SheetsSelectionsService]: cannot resolve unit with id "${t}"!`);n=new Lo(o),this._workbookSelections.set(t,n)}return n}_removeWorkbookSelection(t){this._workbookSelections.delete(t)}getCellStylesProperty(t){var a;const n=(a=this._instanceSrv.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET))==null?void 0:a.getActiveSheet(),o=this.getCurrentSelections();if(!n||o.length===0)return{isAllValuesSame:!1,value:null};let r=null;for(let l=0;l<o.length;l++){const u=o[l],{startRow:d,endRow:c,startColumn:h,endColumn:m}=u.range;for(let R=d;R<=c;R++)for(let C=h;C<=m;C++){const S=`${R}_${C}`;let I;this._cellStylesCache.has(S)?I=this._cellStylesCache.get(S):(I=n.getComposedCellStyle(R,C),this._cellStylesCache.set(S,I));const v=I[t];if(r!=null&&!i.Tools.diffValue(r,v))return{isAllValuesSame:!1,value:null};r=v}}return{isAllValuesSame:!0,value:r}}},g.SheetsSelectionsService=fl([Il(0,i.IUniverInstanceService)],g.SheetsSelectionsService);const vl="DISABLE_NORMAL_SELECTIONS",pl="SELECTIONS_ENABLED",Bo="REF_SELECTIONS_ENABLED",rn={id:"sheet.command.clear-selection-all",type:i.CommandType.COMMAND,handler:(s,e)=>{var p;const t=s.get(i.IUniverInstanceService),n=s.get(i.ICommandService),o=s.get(g.SheetsSelectionsService),r=s.get(i.IUndoRedoService),a=s.get(g.SheetInterceptorService),l=t.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET);if(!l)return!1;const u=(e==null?void 0:e.unitId)||l.getUnitId(),d=l.getActiveSheet();if(!d)return!1;const c=(e==null?void 0:e.subUnitId)||d.getSheetId(),h=(e==null?void 0:e.ranges)||((p=o.getCurrentSelections())==null?void 0:p.map(w=>w.range));if(!(h!=null&&h.length))return!1;const m=Vt(h,s,u,c),R=[],C=[],S={subUnitId:c,unitId:u,cellValue:Kn(m)},I=ce(s,S);R.push({id:F.id,params:S}),C.push({id:F.id,params:I});const v=a.onCommandExecute({id:rn.id});return R.push(...v.redos),C.unshift(...v.undos),i.sequenceExecute(R,n)?(r.pushUndoRedo({unitID:u,undoMutations:C,redoMutations:R}),!0):!1}},an={id:"sheet.command.clear-selection-format",type:i.CommandType.COMMAND,handler:(s,e)=>{var p;const t=s.get(i.IUniverInstanceService),n=s.get(i.ICommandService),o=s.get(g.SheetsSelectionsService),r=s.get(i.IUndoRedoService),a=s.get(g.SheetInterceptorService),l=t.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET);if(!l)return!1;const u=(e==null?void 0:e.unitId)||l.getUnitId(),d=l.getActiveSheet();if(!d)return!1;const c=(e==null?void 0:e.subUnitId)||d.getSheetId(),h=(e==null?void 0:e.ranges)||((p=o.getCurrentSelections())==null?void 0:p.map(w=>w.range));if(!(h!=null&&h.length))return!1;const m=Vt(h,s,u,c),R=[],C=[],S={subUnitId:c,unitId:u,cellValue:gl(m)},I=ce(s,S);R.push({id:F.id,params:S}),C.push({id:F.id,params:I});const v=a.onCommandExecute({id:an.id});return R.push(...v.redos),C.unshift(...v.undos),i.sequenceExecute(R,n)?(r.pushUndoRedo({unitID:u,undoMutations:C,redoMutations:R}),!0):!1}};function $t(s,e,t=!0){const n=e.getMatrixWithMergedCells(...i.selectionToArray(s)),o=[];if(n.forValue((a,l,u)=>{if(u.colSpan!==void 0&&u.rowSpan!==void 0){const d={startRow:a,startColumn:l,endRow:a+u.rowSpan-1,endColumn:l+u.colSpan-1};i.Rectangle.contains(s,d)||o.push(d)}}),o.length===0)return s;const r=i.Rectangle.union(s,...o);return t?$t(r,e,t):r}function wl(s,e,t){let n=null;return t.getMatrixWithMergedCells(s,e,s,e).forValue((r,a,l)=>(n={actualRow:r,actualColumn:a,startRow:r,startColumn:a,isMerged:l.rowSpan!==void 0||l.colSpan!==void 0,isMergedMainCell:l.rowSpan!==void 0&&l.colSpan!==void 0,endRow:r+(l.rowSpan!==void 0?l.rowSpan-1:0),endColumn:a+(l.colSpan!==void 0?l.colSpan-1:0),rangeType:i.RANGE_TYPE.NORMAL},!1)),n||{actualColumn:e,actualRow:s,startRow:s,startColumn:e,endRow:s,endColumn:e,isMerged:!1,isMergedMainCell:!1,rangeType:i.RANGE_TYPE.NORMAL}}function Ml(s,e,t){const{startRow:n,startColumn:o,endRow:r,endColumn:a}=s;return Number.isNaN(n)&&(s.startRow=0),Number.isNaN(r)&&(s.endRow=e-1),Number.isNaN(o)&&(s.startColumn=0),Number.isNaN(a)&&(s.endColumn=t-1),s}function se(s,e){const t=Number.isNaN(s.startRow)?0:s.startRow,n=Number.isNaN(s.startColumn)?0:s.startColumn,o=e.getMergedCell(t,n);return o?{...o,actualRow:t,actualColumn:n,rangeType:i.RANGE_TYPE.NORMAL,isMerged:!0,isMergedMainCell:!0}:{startRow:t,startColumn:n,endRow:s.startRow,endColumn:s.startColumn,actualRow:t,actualColumn:n,rangeType:i.RANGE_TYPE.NORMAL,isMerged:!1,isMergedMainCell:!1}}const ke=(s,e,t)=>({id:q.id,params:{unitId:e.getUnitId(),subUnitId:t.getSheetId(),reveal:!0,selections:[{range:s,primary:se(s,t)}]}});function yl(s){if(!s)return!1;const{range:e,primary:t}=s;return i.Rectangle.equals(e,t)}function _l(s){function e(t,n){function o(r){for(let a=r.startRow;a<=r.endRow;a++)if(!s.getRowFiltered(a))for(let l=r.startColumn;l<=r.endColumn;l++)n(a,l,r)}o(t)}return{forOperableEach:e}}const Ho=s=>s.id!==ao;function Be(s,e,t,n,o,r,a){const l={};for(let u=e;u<=t;u++)for(let d=n;d<=o;d++){const c=r?s.getCellWithFilteredInterceptors(a,d,lo,Ho):s.getCellWithFilteredInterceptors(u,a,lo,Ho);!c||!c.s||(l[u]||(l[u]={}),l[u][d]={s:c.s})}for(const u in l){for(const d in l[u]){const c=l[u][d];c.s&&typeof c.s=="object"&&i.Tools.isEmptyObject(c.s)&&delete c.s,i.Tools.isEmptyObject(c)&&delete l[u][d]}i.Tools.isEmptyObject(l[u])&&delete l[u]}return l}var bl=Object.getOwnPropertyDescriptor,El=(s,e,t,n)=>{for(var o=n>1?void 0:n?bl(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},Tl=(s,e)=>(t,n)=>e(t,n,s);const Fo=i.createIdentifier("sheets-formula.ref-selections.service");g.RefSelectionsService=class extends g.SheetsSelectionsService{constructor(e){super(e)}_init(){const e=this._getAliveWorkbooks$().pipe(O.takeUntil(this.dispose$));this.selectionMoveStart$=e.pipe(O.switchMap(t=>O.merge(...t.map(n=>n.selectionMoveStart$)))),this.selectionMoving$=e.pipe(O.switchMap(t=>O.merge(...t.map(n=>n.selectionMoving$)))),this.selectionMoveEnd$=e.pipe(O.switchMap(t=>O.merge(...t.map(n=>n.selectionMoveEnd$)))),this.selectionSet$=e.pipe(O.switchMap(t=>O.merge(...t.map(n=>n.selectionSet$))))}dispose(){super.dispose(),this.selectionMoveStart$=O.of(null),this.selectionMoving$=O.of(null),this.selectionMoveEnd$=O.of(null),this.selectionSet$=O.of(null),delete this._instanceSrv,this._workbookSelections.clear()}_getAliveWorkbooks$(){const e=this._instanceSrv.getAllUnitsForType(i.UniverInstanceType.UNIVER_SHEET);e.forEach(n=>this._ensureWorkbookSelection(n.getUnitId()));const t=new O.BehaviorSubject(e);return this.disposeWithMe(this._instanceSrv.getTypeOfUnitAdded$(i.UniverInstanceType.UNIVER_SHEET).subscribe(n=>{this._ensureWorkbookSelection(n.getUnitId()),t.next([...t.getValue(),n])})),this.disposeWithMe(this._instanceSrv.getTypeOfUnitDisposed$(i.UniverInstanceType.UNIVER_SHEET).subscribe(n=>{this._removeWorkbookSelection(n.getUnitId()),t.next(t.getValue().filter(o=>o!==n))})),t.pipe(O.map(n=>n.map(o=>this._ensureWorkbookSelection(o.getUnitId()))))}},g.RefSelectionsService=El([Tl(0,i.IUniverInstanceService)],g.RefSelectionsService);function jo(s,e){const n=s.get(i.IContextService).getContextValue(Bo);return s.get(n&&!e?Fo:g.SheetsSelectionsService)}const q={id:"sheet.operation.set-selections",type:i.CommandType.OPERATION,handler:(s,e)=>{if(!e)return!1;const{selections:t,type:n,unitId:o,subUnitId:r}=e;return jo(s).setSelections(o,r,[...t],n),!0}},Go={id:"sheet.command.select-range",type:i.CommandType.COMMAND,handler:(s,e)=>{if(!e)return!1;const{unitId:t,subUnit:n,range:o}=e,r=s.get(i.ICommandService),a=P(s.get(i.IUniverInstanceService),e);if(!a)return!1;const l=[{range:o,primary:se(o,a.worksheet),style:null}];return r.syncExecuteCommand(q.id,{unitId:t,subUnitId:n,selections:l})}},zo="sheet.command.move-range",Qe={type:i.CommandType.COMMAND,id:zo,handler:async(s,e)=>{var M,p;const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),o=s.get(i.IUniverInstanceService),r=s.get(i.ErrorService),a=s.get(i.LocaleService),l=s.get(g.SheetInterceptorService),u=P(o);if(!u||!await l.beforeCommandExecute({id:Qe.id,params:e}))return!1;const{worksheet:c,subUnitId:h,unitId:m}=u,R=ln(s,{unitId:m,subUnitId:h,range:e.fromRange},{subUnitId:h,range:e.toRange});if(R===null)return r.emit(a.t("sheets.info.acrossMergedCell")),!1;const C=l.onCommandExecute({id:Qe.id,params:e}),S=[...(M=C.preRedos)!=null?M:[],...R.redos,...C.redos,{id:q.id,params:{unitId:m,subUnitId:h,selections:[{range:e.toRange,primary:Ul(e.fromRange,e.toRange,c)}],type:Q.MOVE_END}}],I=[...(p=C.preUndos)!=null?p:[],...R.undos,...C.undos,{id:q.id,params:{unitId:m,subUnitId:h,selections:[{range:e.fromRange,primary:se(e.fromRange,c)}],type:Q.MOVE_END}}];if(i.sequenceExecute(S,t).result){const{undos:w,redos:y}=l.generateMutationsOfAutoHeight({unitId:m,subUnitId:h,ranges:[e.fromRange,e.toRange]}),b=l.afterCommandExecute({id:Qe.id,params:e});return i.sequenceExecute([...b.redos,...y],t),n.pushUndoRedo({unitID:m,undoMutations:[...I,...b.undos,...w],redoMutations:[...S,...b.redos,...y]}),!0}return!1}};function ln(s,e,t,n=!1){const o=[],r=[],{range:a,subUnitId:l,unitId:u}=e,{range:d,subUnitId:c}=t,m=s.get(i.IUniverInstanceService).getUniverSheetInstance(u),R=m==null?void 0:m.getSheetBySheetId(c),C=m==null?void 0:m.getSheetBySheetId(l),S=R==null?void 0:R.getCellMatrix(),I=C==null?void 0:C.getCellMatrix();if(R&&C&&S&&I){const v=$t(d,R,!1);if(!i.Rectangle.equals(d,v)&&!n)return null;const M=new i.ObjectMatrix,p=new i.ObjectMatrix,w=new i.ObjectMatrix;i.Range.foreach(a,(T,E)=>{const N=I.getValue(T,E);if(M.setValue(T,E,i.Tools.deepClone(N)),N){const V=m==null?void 0:m.getStyles().get(N.s);w.setValue(T,E,i.Tools.deepClone(V))}p.setValue(T,E,null)});const y=new i.ObjectMatrix,b=new i.ObjectMatrix;i.Range.foreach(d,(T,E)=>{y.setValue(T,E,i.Tools.deepClone(S.getValue(T,E)))}),i.Range.foreach(a,(T,E)=>{const N=i.cellToRange(T,E),V=i.Rectangle.getRelativeRange(N,a),W=i.Rectangle.getPositionRange(V,d),$=i.Tools.deepClone(w.getValue(T,E)),L=i.Tools.deepClone(M.getValue(T,E));L&&$&&(L.s=$),b.setValue(W.startRow,W.startColumn,L)});const U={fromRange:e.range,toRange:t.range,from:{value:p.getMatrix(),subUnitId:l},to:{value:b.getMatrix(),subUnitId:c},unitId:u},k={fromRange:t.range,toRange:e.range,from:{value:M.getMatrix(),subUnitId:l},to:{value:y.getMatrix(),subUnitId:c},unitId:u};o.push({id:Fe.id,params:U}),r.push({id:Fe.id,params:k})}return{redos:o,undos:r}}function Ul(s,e,t){const n=s.startRow,o=s.startColumn,r=t.getMergedCell(n,o),a=se(e,t);if(r){const l=r.endRow-r.startRow+1,u=r.endColumn-r.startColumn+1;a.endRow=a.startRow+l-1,a.endColumn=a.startColumn+u-1,a.actualRow=a.startRow,a.actualColumn=a.startColumn,a.isMerged=!1,a.isMergedMainCell=!0}return a}var un=(s=>(s[s.UNIVER_UNKNOWN=0]="UNIVER_UNKNOWN",s[s.UNIVER_DOC=1]="UNIVER_DOC",s[s.UNIVER_SHEET=2]="UNIVER_SHEET",s[s.UNIVER_SLIDE=3]="UNIVER_SLIDE",s[s.UNIVER_PROJECT=4]="UNIVER_PROJECT",s[s.UNRECOGNIZED=-1]="UNRECOGNIZED",s))(un||{}),_=(s=>(s[s.View=0]="View",s[s.Edit=1]="Edit",s[s.ManageCollaborator=2]="ManageCollaborator",s[s.Print=3]="Print",s[s.Duplicate=4]="Duplicate",s[s.Comment=5]="Comment",s[s.Copy=6]="Copy",s[s.Share=7]="Share",s[s.Export=8]="Export",s[s.MoveWorksheet=9]="MoveWorksheet",s[s.DeleteWorksheet=10]="DeleteWorksheet",s[s.HideWorksheet=11]="HideWorksheet",s[s.RenameWorksheet=12]="RenameWorksheet",s[s.CreateWorksheet=13]="CreateWorksheet",s[s.SetWorksheetStyle=14]="SetWorksheetStyle",s[s.EditWorksheetCell=15]="EditWorksheetCell",s[s.InsertHyperlink=16]="InsertHyperlink",s[s.Sort=17]="Sort",s[s.Filter=18]="Filter",s[s.PivotTable=19]="PivotTable",s[s.FloatImg=20]="FloatImg",s[s.History=21]="History",s[s.RwHgtClWdt=22]="RwHgtClWdt",s[s.ViemRwHgtClWdt=23]="ViemRwHgtClWdt",s[s.ViewFilter=24]="ViewFilter",s[s.MoveSheet=25]="MoveSheet",s[s.DeleteSheet=26]="DeleteSheet",s[s.HideSheet=27]="HideSheet",s[s.CopySheet=28]="CopySheet",s[s.RenameSheet=29]="RenameSheet",s[s.CreateSheet=30]="CreateSheet",s[s.SelectProtectedCells=31]="SelectProtectedCells",s[s.SelectUnProtectedCells=32]="SelectUnProtectedCells",s[s.SetCellStyle=33]="SetCellStyle",s[s.SetCellValue=34]="SetCellValue",s[s.SetRowStyle=35]="SetRowStyle",s[s.SetColumnStyle=36]="SetColumnStyle",s[s.InsertRow=37]="InsertRow",s[s.InsertColumn=38]="InsertColumn",s[s.DeleteRow=39]="DeleteRow",s[s.DeleteColumn=40]="DeleteColumn",s[s.EditExtraObject=41]="EditExtraObject",s[s.Delete=42]="Delete",s[s.RecoverHistory=43]="RecoverHistory",s[s.ViewHistory=44]="ViewHistory",s[s.CreatePermissionObject=45]="CreatePermissionObject",s[s.UNRECOGNIZED=-1]="UNRECOGNIZED",s))(_||{}),D=(s=>(s[s.Unkonwn=0]="Unkonwn",s[s.Workbook=1]="Workbook",s[s.Worksheet=2]="Worksheet",s[s.SelectRange=3]="SelectRange",s[s.Document=4]="Document",s[s.Slide=5]="Slide",s[s.UNRECOGNIZED=-1]="UNRECOGNIZED",s))(D||{});class Se{constructor(e,t,n){f(this,"type",D.SelectRange);f(this,"subType",_.Edit);f(this,"status",i.PermissionStatus.INIT);f(this,"value",!0);f(this,"id");f(this,"unitId");f(this,"subUnitId");f(this,"permissionId");this.unitId=e,this.subUnitId=t,this.permissionId=n,this.id=`${D.SelectRange}.${_.Edit}.${n}`}}class dn{constructor(e,t,n){f(this,"type",D.SelectRange);f(this,"subType",_.View);f(this,"status",i.PermissionStatus.INIT);f(this,"value",!1);f(this,"id");f(this,"unitId");f(this,"subUnitId");f(this,"permissionId");this.unitId=e,this.subUnitId=t,this.permissionId=n,this.id=`${D.SelectRange}.${_.View}.${n}`}}class Jn{constructor(e){f(this,"id");f(this,"value",!0);f(this,"type",D.Workbook);f(this,"status",i.PermissionStatus.INIT);f(this,"subType",_.Comment);this.unitId=e,this.unitId=e,this.id=`${this.type}.${_.Comment}_${e}`}}class Xn{constructor(e){f(this,"id");f(this,"value",!0);f(this,"type",D.Workbook);f(this,"status",i.PermissionStatus.INIT);f(this,"subType",_.Copy);this.unitId=e,this.unitId=e,this.id=`${this.type}.${_.Copy}_${e}`}}class qo{constructor(e){f(this,"id");f(this,"value",!0);f(this,"type",D.Workbook);f(this,"subType",_.CopySheet);f(this,"status",i.PermissionStatus.INIT);this.unitId=e,this.unitId=e,this.id=`${this.type}.${_.CopySheet}_${e}`}}class Zn{constructor(e){f(this,"id");f(this,"value",!0);f(this,"type",D.Workbook);f(this,"status",i.PermissionStatus.INIT);f(this,"subType",_.CreatePermissionObject);this.unitId=e,this.unitId=e,this.id=`${this.type}.${_.CreatePermissionObject}_${e}`}}class Qn{constructor(e){f(this,"id");f(this,"value",!0);f(this,"type",D.Workbook);f(this,"status",i.PermissionStatus.INIT);f(this,"subType",_.CreateSheet);this.unitId=e,this.unitId=e,this.id=`${this.type}.${_.CreateSheet}_${e}`}}class Yo{constructor(e){f(this,"value",!0);f(this,"type",D.Workbook);f(this,"status",i.PermissionStatus.INIT);f(this,"id");f(this,"subType",_.DeleteColumn);this.unitId=e,this.id=`${this.type}.${_.DeleteColumn}_${e}`}}class xo{constructor(e){f(this,"value",!0);f(this,"type",D.Workbook);f(this,"status",i.PermissionStatus.INIT);f(this,"id");f(this,"subType",_.DeleteRow);this.unitId=e,this.id=`${this.type}.${_.DeleteRow}_${e}`}}class es{constructor(e){f(this,"id");f(this,"value",!0);f(this,"type",D.Workbook);f(this,"status",i.PermissionStatus.INIT);f(this,"subType",_.DeleteSheet);this.unitId=e,this.unitId=e,this.id=`${this.type}.${_.DeleteSheet}_${e}`}}class ts{constructor(e){f(this,"id");f(this,"value",!0);f(this,"type",D.Workbook);f(this,"status",i.PermissionStatus.INIT);f(this,"subType",_.Duplicate);this.unitId=e,this.unitId=e,this.id=`${this.type}.${_.Duplicate}_${e}`}}class he{constructor(e){f(this,"id");f(this,"value",!0);f(this,"type",D.Workbook);f(this,"status",i.PermissionStatus.INIT);f(this,"subType",_.Edit);this.unitId=e,this.unitId=e,this.id=`${this.type}.${_.Edit}_${e}`}}class ns{constructor(e){f(this,"id");f(this,"value",!0);f(this,"type",D.Workbook);f(this,"status",i.PermissionStatus.INIT);f(this,"subType",_.Export);this.unitId=e,this.unitId=e,this.id=`${this.type}.${_.Export}_${e}`}}class cn{constructor(e){f(this,"id");f(this,"value",!0);f(this,"type",D.Workbook);f(this,"status",i.PermissionStatus.INIT);f(this,"subType",_.HideSheet);this.unitId=e,this.unitId=e,this.id=`${this.type}.${_.HideSheet}_${e}`}}class Ko{constructor(e){f(this,"id");f(this,"value",!0);f(this,"type",D.Workbook);f(this,"status",i.PermissionStatus.INIT);f(this,"subType",_.History);this.unitId=e,this.unitId=e,this.id=`${this.type}.${_.History}_${e}`}}class Jo{constructor(e){f(this,"value",!0);f(this,"type",D.Workbook);f(this,"status",i.PermissionStatus.INIT);f(this,"id");f(this,"subType",_.InsertColumn);this.unitId=e,this.id=`${this.type}.${_.InsertColumn}_${e}`}}class Xo{constructor(e){f(this,"value",!0);f(this,"type",D.Workbook);f(this,"status",i.PermissionStatus.INIT);f(this,"id");f(this,"subType",_.InsertRow);this.unitId=e,this.id=`${this.type}.${_.InsertRow}_${e}`}}class hn{constructor(e){f(this,"id");f(this,"value",!0);f(this,"type",D.Workbook);f(this,"status",i.PermissionStatus.INIT);f(this,"subType",_.ManageCollaborator);this.unitId=e,this.unitId=e,this.id=`${this.type}.${_.ManageCollaborator}_${e}`}}class mn{constructor(e){f(this,"id");f(this,"value",!0);f(this,"type",D.Workbook);f(this,"status",i.PermissionStatus.INIT);f(this,"subType",_.MoveSheet);this.unitId=e,this.unitId=e,this.id=`${this.type}.${_.MoveSheet}_${e}`}}class ss{constructor(e){f(this,"id");f(this,"value",!0);f(this,"type",D.Workbook);f(this,"status",i.PermissionStatus.INIT);f(this,"subType",_.Print);this.unitId=e,this.unitId=e,this.id=`${this.type}.${_.Print}_${e}`}}class os{constructor(e){f(this,"id");f(this,"value",!0);f(this,"type",D.Workbook);f(this,"status",i.PermissionStatus.INIT);f(this,"subType",_.RecoverHistory);this.unitId=e,this.unitId=e,this.id=`${this.type}.${_.RecoverHistory}_${e}`}}class gn{constructor(e){f(this,"id");f(this,"value",!0);f(this,"type",D.Workbook);f(this,"status",i.PermissionStatus.INIT);f(this,"subType",_.RenameSheet);this.unitId=e,this.unitId=e,this.id=`${this.type}.${_.RenameSheet}_${e}`}}class rs{constructor(e){f(this,"id");f(this,"value",!0);f(this,"type",D.Workbook);f(this,"status",i.PermissionStatus.INIT);f(this,"subType",_.Share);this.unitId=e,this.unitId=e,this.id=`${this.type}.${_.Share}_${e}`}}class is{constructor(e){f(this,"id");f(this,"value",!0);f(this,"type",D.Workbook);f(this,"status",i.PermissionStatus.INIT);f(this,"subType",_.View);this.unitId=e,this.unitId=e,this.id=`${this.type}.${_.View}_${e}`}}class as{constructor(e){f(this,"id");f(this,"value",!0);f(this,"type",D.Workbook);f(this,"status",i.PermissionStatus.INIT);f(this,"subType",_.ViewHistory);this.unitId=e,this.unitId=e,this.id=`${this.type}.${_.ViewHistory}_${e}`}}class ls{constructor(e,t){f(this,"value",!0);f(this,"type",D.Worksheet);f(this,"status",i.PermissionStatus.INIT);f(this,"id");f(this,"subType",_.Copy);this.unitId=e,this.subUnitId=t,this.id=`${this.type}.${_.Copy}_${e}_${t}`}}class us{constructor(e,t){f(this,"value",!0);f(this,"type",D.Worksheet);f(this,"status",i.PermissionStatus.INIT);f(this,"id");f(this,"subType",_.DeleteColumn);this.unitId=e,this.subUnitId=t,this.id=`${this.type}.${_.DeleteColumn}_${e}_${t}`}}class ds{constructor(e,t){f(this,"value",!0);f(this,"type",D.Worksheet);f(this,"status",i.PermissionStatus.INIT);f(this,"id");f(this,"subType",_.Delete);this.unitId=e,this.subUnitId=t,this.id=`${this.type}.${_.Delete}_${e}_${t}`}}class cs{constructor(e,t){f(this,"value",!0);f(this,"type",D.Worksheet);f(this,"status",i.PermissionStatus.INIT);f(this,"id");f(this,"subType",_.DeleteRow);this.unitId=e,this.subUnitId=t,this.id=`${this.type}.${_.DeleteRow}_${e}_${t}`}}class fe{constructor(e,t){f(this,"value",!0);f(this,"type",D.Worksheet);f(this,"status",i.PermissionStatus.INIT);f(this,"id");f(this,"subType",_.Edit);this.unitId=e,this.subUnitId=t,this.id=`${this.type}.${_.Edit}_${e}_${t}`}}class hs{constructor(e,t){f(this,"value",!0);f(this,"type",D.Worksheet);f(this,"status",i.PermissionStatus.INIT);f(this,"id");f(this,"subType",_.EditExtraObject);this.unitId=e,this.subUnitId=t,this.id=`${this.type}.${_.EditExtraObject}_${e}_${t}`}}class ms{constructor(e,t){f(this,"value",!0);f(this,"type",D.Worksheet);f(this,"status",i.PermissionStatus.INIT);f(this,"id");f(this,"subType",_.Filter);this.unitId=e,this.subUnitId=t,this.id=`${this.type}.${_.Filter}_${e}_${t}`}}class gs{constructor(e,t){f(this,"value",!0);f(this,"type",D.Worksheet);f(this,"status",i.PermissionStatus.INIT);f(this,"id");f(this,"subType",_.InsertColumn);this.unitId=e,this.subUnitId=t,this.id=`${this.type}.${_.InsertColumn}_${e}_${t}`}}class Rs{constructor(e,t){f(this,"value",!0);f(this,"type",D.Worksheet);f(this,"status",i.PermissionStatus.INIT);f(this,"id");f(this,"subType",_.InsertHyperlink);this.unitId=e,this.subUnitId=t,this.id=`${this.type}.${_.InsertHyperlink}_${e}_${t}`}}class Cs{constructor(e,t){f(this,"value",!0);f(this,"type",D.Worksheet);f(this,"status",i.PermissionStatus.INIT);f(this,"id");f(this,"subType",_.InsertRow);this.unitId=e,this.subUnitId=t,this.id=`${this.type}.${_.InsertRow}_${e}_${t}`}}class Ss{constructor(e,t){f(this,"value",!0);f(this,"type",D.Worksheet);f(this,"status",i.PermissionStatus.INIT);f(this,"id");f(this,"subType",_.ManageCollaborator);this.unitId=e,this.subUnitId=t,this.id=`${this.type}.${_.ManageCollaborator}_${e}_${t}`}}class fs{constructor(e,t){f(this,"value",!0);f(this,"type",D.Worksheet);f(this,"status",i.PermissionStatus.INIT);f(this,"id");f(this,"subType",_.PivotTable);this.unitId=e,this.subUnitId=t,this.id=`${this.type}.${_.PivotTable}_${e}_${t}`}}class kl{constructor(e,t){f(this,"value",!0);f(this,"type",D.Worksheet);f(this,"status",i.PermissionStatus.INIT);f(this,"id");f(this,"subType",_.SelectProtectedCells);this.unitId=e,this.subUnitId=t,this.id=`${this.type}.${_.SelectProtectedCells}_${e}_${t}`}}class Pl{constructor(e,t){f(this,"value",!0);f(this,"type",D.Worksheet);f(this,"status",i.PermissionStatus.INIT);f(this,"id");f(this,"subType",_.SelectUnProtectedCells);this.unitId=e,this.subUnitId=t,this.id=`${this.type}.${_.SelectUnProtectedCells}_${e}_${t}`}}class Is{constructor(e,t){f(this,"value",!0);f(this,"type",D.Worksheet);f(this,"status",i.PermissionStatus.INIT);f(this,"id");f(this,"subType",_.SetCellStyle);this.unitId=e,this.subUnitId=t,this.id=`${this.type}.${_.SetCellStyle}_${e}_${t}`}}class Lt{constructor(e,t){f(this,"value",!0);f(this,"type",D.Worksheet);f(this,"status",i.PermissionStatus.INIT);f(this,"id");f(this,"subType",_.SetCellValue);this.unitId=e,this.subUnitId=t,this.id=`${this.type}.${_.SetCellValue}_${e}_${t}`}}class pt{constructor(e,t){f(this,"value",!0);f(this,"type",D.Worksheet);f(this,"status",i.PermissionStatus.INIT);f(this,"id");f(this,"subType",_.SetColumnStyle);this.unitId=e,this.subUnitId=t,this.id=`${this.type}.${_.SetColumnStyle}_${e}_${t}`}}class wt{constructor(e,t){f(this,"value",!0);f(this,"type",D.Worksheet);f(this,"status",i.PermissionStatus.INIT);f(this,"id");f(this,"subType",_.SetRowStyle);this.unitId=e,this.subUnitId=t,this.id=`${this.type}.${_.SetRowStyle}_${e}_${t}`}}class vs{constructor(e,t){f(this,"value",!0);f(this,"type",D.Worksheet);f(this,"status",i.PermissionStatus.INIT);f(this,"id");f(this,"subType",_.Sort);this.unitId=e,this.subUnitId=t,this.id=`${this.type}.${_.Sort}_${e}_${t}`}}class Bt{constructor(e,t){f(this,"value",!0);f(this,"type",D.Worksheet);f(this,"status",i.PermissionStatus.INIT);f(this,"id");f(this,"subType",_.View);this.unitId=e,this.subUnitId=t,this.id=`${this.type}.${_.View}_${e}_${t}`}}const Mt={id:"sheet.command.set-range-values",type:i.CommandType.COMMAND,handler:(s,e)=>{var V;const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),o=s.get(i.IUniverInstanceService),r=s.get(g.SheetsSelectionsService),a=s.get(g.SheetInterceptorService),l=s.get(i.IPermissionService),u=P(o,e);if(!u)return!1;const{subUnitId:d,unitId:c,workbook:h,worksheet:m}=u,{value:R,range:C,redoUndoId:S}=e,I=C?[C]:(V=r.getCurrentSelections())==null?void 0:V.map(W=>W.range);if(!I||!I.length||!l.getPermissionPoint(new fe(c,d).id))return!1;const v=new i.ObjectMatrix;let M;if(i.Tools.isArray(R))for(let W=0;W<I.length;W++){const{startRow:$,startColumn:L,endRow:Y,endColumn:z}=I[W];for(let x=0;x<=Y-$;x++)for(let oe=0;oe<=z-L;oe++)v.setValue(x+$,oe+L,R[x][oe])}else if(i.isICellData(R))for(let W=0;W<I.length;W++){const{startRow:$,startColumn:L,endRow:Y,endColumn:z}=I[W];for(let x=$;x<=Y;x++)for(let oe=L;oe<=z;oe++)v.setValue(x,oe,R)}else M=R;const p={subUnitId:d,unitId:c,cellValue:M!=null?M:v.getMatrix()},w=ce(s,p),y=i.mapObjectMatrix(p.cellValue,(W,$)=>m.getCellHeight(W,$)||void 0);if(!t.syncExecuteCommand(F.id,p))return!1;const{undos:U,redos:k}=a.onCommandExecute({id:Mt.id,params:p}),{undos:T,redos:E}=a.generateMutationsOfAutoHeight({unitId:c,subUnitId:d,ranges:I,cellHeights:new i.ObjectMatrix(y)});if(i.sequenceExecute([...k,...E],t).result){const W=ke(C!=null?C:v.getRange(),h,m);return n.pushUndoRedo({unitID:c,undoMutations:[{id:F.id,params:w},...U,...T,W],redoMutations:[{id:F.id,params:p},...k,...E,i.Tools.deepClone(W)],id:S}),!0}return!1}};function ps(s,e){const t=[],n=[],{unitId:o,subUnitId:r,range:a,shiftDimension:l,cellValue:u={}}=e,d=s.get(i.IUniverInstanceService),c=s.get(g.SheetInterceptorService),h=d.getUniverSheetInstance(o),m=h==null?void 0:h.getSheetBySheetId(r);if(m){const R=m.getCellMatrix(),C=R.getDataRange();if(a.startColumn<=C.endColumn||a.startRow<=C.endRow){let p,w;if(l===i.Dimension.COLUMNS){const b=Math.min(a.endRow,C.endRow);let U=0;for(let T=a.startRow;T<=b;T++){const E=R.getRow(T),N=E?i.getArrayLength(E)-1:0;U=Math.max(U,N)}p={startRow:a.startRow,startColumn:a.startColumn,endRow:b,endColumn:U};const k=a.endColumn-a.startColumn+1;w={startRow:a.startRow,startColumn:p.startColumn+k,endRow:b,endColumn:p.endColumn+k}}else{const b=Math.min(a.endColumn,C.endColumn),U=C.endRow;p={startRow:a.startRow,startColumn:a.startColumn,endRow:U,endColumn:b};const k=a.endRow-a.startRow+1;w={startRow:p.startRow+k,startColumn:a.startColumn,endRow:p.endRow+k,endColumn:b}}const y=ln(s,{unitId:o,subUnitId:r,range:p},{subUnitId:r,range:w},!0);y&&(t.push(...y.redos),n.push(...y.undos))}if(Object.entries(u).length===0)for(let p=a.startRow;p<=a.endRow;p++){u[p]||(u[p]={});for(let w=a.startColumn;w<=a.endColumn;w++)u[p][w]=null}const S={subUnitId:r,unitId:o,cellValue:u},I=ce(s,S),{undos:v,redos:M}=c.onCommandExecute({id:Mt.id,params:{...S,range:a}});t.push({id:F.id,params:S},...M),n.push({id:F.id,params:I},...v)}return{redo:t,undo:n}}function ws(s,e){const t=[],n=[],{unitId:o,subUnitId:r,range:a,shiftDimension:l}=e,u=s.get(i.IUniverInstanceService),d=s.get(g.SheetInterceptorService),c=u.getUniverSheetInstance(o),h=c==null?void 0:c.getSheetBySheetId(r);if(h){const m=h.getCellMatrix(),R=m.getDataRange(),C={subUnitId:r,unitId:o,cellValue:Kn([a])},S=ce(s,C),I=d.onCommandExecute({id:Mt.id,params:C});if(t.push({id:F.id,params:C},...I.redos),n.push(...I.undos,{id:F.id,params:S}),a.startColumn<=R.endColumn||a.startRow<=R.endRow){let v=null,M=null;if(l===i.Dimension.COLUMNS&&a.endColumn<R.endColumn){const p=Math.min(a.endRow,R.endRow);let w=0;for(let b=a.startRow;b<=p;b++){const U=m.getRow(b),k=U?i.getArrayLength(U)-1:0;w=Math.max(w,k)}v={startRow:a.startRow,startColumn:a.endColumn+1,endRow:p,endColumn:w};const y=a.endColumn-a.startColumn+1;M={startRow:a.startRow,startColumn:v.startColumn-y,endRow:p,endColumn:v.endColumn-y}}if(l===i.Dimension.ROWS&&a.endRow<R.endRow){const p=Math.min(a.endColumn,R.endColumn),w=R.endRow;v={startRow:a.endRow+1,startColumn:a.startColumn,endRow:w,endColumn:p};const y=a.endRow-a.startRow+1;M={startRow:v.startRow-y,startColumn:a.startColumn,endRow:v.endRow-y,endColumn:p}}if(v&&M){const p=ln(s,{unitId:o,subUnitId:r,range:v},{subUnitId:r,range:M},!0);p&&(t.push(...p.redos),n.push(...p.undos))}}}return{redo:t,undo:n}}function Nl(s,e,t,n,o,r){const{startRow:a,endRow:l,startColumn:u,endColumn:d}=e;if(o===i.Dimension.ROWS){const c=l-a+1;for(let h=t;h>=a;h--)for(let m=u;m<=d;m++){const R=s.getValue(h,m);R==null?s.realDeleteValue(h+c,m):s.setValue(h+c,m,R)}for(let h=l;h>=a;h--)for(let m=u;m<=d;m++)r&&r[h]&&r[h][m]?s.setValue(h,m,r[h][m]):s.realDeleteValue(h,m)}else if(o===i.Dimension.COLUMNS){const c=d-u+1;for(let h=a;h<=l;h++)for(let m=n;m>=u;m--){const R=s.getValue(h,m);R==null?s.realDeleteValue(h,m+c):s.setValue(h,m+c,R)}for(let h=a;h<=l;h++)for(let m=d;m>=u;m--)r&&r[h]&&r[h][m]?s.setValue(h,m,r[h][m]):s.realDeleteValue(h,m)}}function Ol(s,e,t,n,o){const{startRow:r,endRow:a,startColumn:l,endColumn:u}=e,d=a-r+1,c=u-l+1;if(o===i.Dimension.ROWS)for(let h=r;h<=t;h++)for(let m=l;m<=u;m++){const R=s.getValue(h+d,m);R==null?s.realDeleteValue(h,m):s.setValue(h,m,R)}else if(o===i.Dimension.COLUMNS)for(let h=r;h<=a;h++)for(let m=l;m<=n;m++){const R=s.getValue(h,m+c);R==null?s.realDeleteValue(h,m):s.setValue(h,m,R)}}const Zo="sheet.command.delete-range-move-left",Ge={type:i.CommandType.COMMAND,id:Zo,handler:async(s,e)=>{var w,y,b;const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),o=s.get(i.IUniverInstanceService),r=s.get(g.SheetsSelectionsService),a=s.get(g.SheetInterceptorService),l=P(o);if(!l)return!1;const{worksheet:u,workbook:d,subUnitId:c,unitId:h}=l;let m=e==null?void 0:e.range;if(m||(m=(w=r.getCurrentLastSelection())==null?void 0:w.range),!m)return!1;const R={range:m,subUnitId:c,unitId:h,shiftDimension:i.Dimension.COLUMNS},C=a.onCommandExecute({id:Ge.id,params:{range:m}}),{redo:S,undo:I}=ws(s,R),v=[...(y=C.preRedos)!=null?y:[],...S],M=[...C.undos,...I];if(v.push(...C.redos),v.push(ke(m,d,u)),M.push(...(b=C.preUndos)!=null?b:[]),i.sequenceExecute(v,t).result){const U=a.afterCommandExecute({id:Ge.id,params:{range:m}});return i.sequenceExecute(U.redos,t),M.push(...U.undos),v.push(...U.redos),n.pushUndoRedo({unitID:h,undoMutations:M.reverse(),redoMutations:v}),!0}return!1}},Qo="sheet.command.delete-range-move-up",ze={type:i.CommandType.COMMAND,id:Qo,handler:async(s,e)=>{var w,y,b;const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),o=s.get(i.IUniverInstanceService),r=s.get(g.SheetsSelectionsService),a=s.get(g.SheetInterceptorService),l=P(o);if(!l)return!1;const{unitId:u,subUnitId:d,workbook:c,worksheet:h}=l;let m=e==null?void 0:e.range;if(m||(m=(w=r.getCurrentLastSelection())==null?void 0:w.range),!m)return!1;const R={range:m,subUnitId:d,unitId:u,shiftDimension:i.Dimension.ROWS},C=a.onCommandExecute({id:ze.id,params:{range:m}}),{redo:S,undo:I}=ws(s,R),v=[...(y=C.preRedos)!=null?y:[],...S],M=[...C.undos,...I];if(v.push(...C.redos),v.push(ke(m,c,h)),M.push(...(b=C.preUndos)!=null?b:[]),i.sequenceExecute(v,t).result){const U=a.afterCommandExecute({id:ze.id,params:{range:m}});return i.sequenceExecute(U.redos,t),M.push(...U.undos),v.push(...U.redos),n.pushUndoRedo({unitID:u,undoMutations:M.reverse(),redoMutations:v}),!0}return!1}},Dl="sheet.command.insert-range-move-down",et={type:i.CommandType.COMMAND,id:"sheet.command.insert-range-move-down",handler:async(s,e)=>{var V,W,$;const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),o=s.get(i.IUniverInstanceService),r=s.get(g.SheetsSelectionsService),a=s.get(g.SheetInterceptorService),l=s.get(i.ErrorService),u=s.get(i.LocaleService);if(r.isOverlapping())return l.emit(u.t("sheets.info.overlappingSelections")),!1;const d=P(o);if(!d)return!1;const{unitId:c,subUnitId:h,worksheet:m,workbook:R}=d;let C=e==null?void 0:e.range;if(C||(C=(V=r.getCurrentLastSelection())==null?void 0:V.range),!C)return!1;const S=[],I=[],v=m.getCellMatrix(),M=v.getDataRange(),w=v.getSlice(M.startRow,M.endRow,C.startColumn,C.endColumn).getDataRange().endRow,y=Math.max(w+(C.endRow-C.startRow+1)-M.endRow,0);if(y>0){const L=C.startRow-1,Y=m.getRowHeight(L),z={unitId:c,subUnitId:h,range:{startRow:M.endRow+1,endRow:M.endRow+y,startColumn:M.startColumn,endColumn:M.endColumn},rowInfo:new Array(y).fill(void 0).map(()=>({h:Y,hd:i.BooleanNumber.FALSE}))};S.push({id:re.id,params:z});const x=sn(s,z);I.push({id:ae.id,params:x})}const b={};i.Range.foreach(C,(L,Y)=>{const z=m.getCell(L,Y);z&&(b[L]||(b[L]={}),b[L][Y]={s:z.s})});const U={range:C,subUnitId:h,unitId:c,shiftDimension:i.Dimension.ROWS,cellValue:b},{redo:k,undo:T}=ps(s,U);S.push(...k),I.push(...T);const E=a.onCommandExecute({id:et.id,params:{range:C}});if(S.push(...E.redos),S.push(ke(C,R,m)),I.push(...(W=E.preUndos)!=null?W:[]),S.unshift(...($=E.preRedos)!=null?$:[]),I.unshift(...E.undos),i.sequenceExecute(S,t)){const L=a.afterCommandExecute({id:et.id,params:{range:C}});return i.sequenceExecute(L.redos,t),I.push(...L.undos),S.push(...L.redos),n.pushUndoRedo({unitID:c,undoMutations:I.reverse(),redoMutations:S}),!0}return!1}},Ms="sheet.command.insert-range-move-right",yt={type:i.CommandType.COMMAND,id:Ms,handler:async(s,e)=>{var V,W,$;const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),o=s.get(i.IUniverInstanceService),r=s.get(g.SheetsSelectionsService),a=s.get(g.SheetInterceptorService),l=s.get(i.ErrorService),u=s.get(i.LocaleService);if(r.isOverlapping())return l.emit(u.t("sheets.info.overlappingSelections")),!1;const d=P(o);if(!d)return!1;const{workbook:c,worksheet:h,unitId:m,subUnitId:R}=d;let C=e==null?void 0:e.range;if(C||(C=(V=r.getCurrentLastSelection())==null?void 0:V.range),!C)return!1;const S=[],I=[],v=h.getCellMatrix(),M=v.getDataRange(),w=v.getSlice(C.startRow,C.endRow,M.startColumn,M.endColumn).getDataRange().endColumn,y=Math.max(w+(C.endColumn-C.startColumn+1)-M.endColumn,0);if(y>0){const L=C.startColumn-1,Y=h.getColumnWidth(L),z={unitId:m,subUnitId:R,range:{startRow:M.startRow+1,endRow:M.endRow,startColumn:M.endColumn+1,endColumn:M.endColumn+y},colInfo:new Array(y).fill(void 0).map(()=>({w:Y,hd:i.BooleanNumber.FALSE}))};S.push({id:ie.id,params:z});const x=At(s,z);I.push({id:ne.id,params:x})}const b={};i.Range.foreach(C,(L,Y)=>{const z=h.getCell(L,Y);!z||!z.s||(b[L]||(b[L]={}),b[L][Y]={s:z.s})});const U={range:C,subUnitId:R,unitId:m,shiftDimension:i.Dimension.COLUMNS,cellValue:b},{redo:k,undo:T}=ps(s,U);S.push(...k),I.push(...T);const E=a.onCommandExecute({id:yt.id,params:{range:C}});if(S.push(...E.redos),S.push(ke(C,c,h)),I.push(...(W=E.preUndos)!=null?W:[]),S.unshift(...($=E.preRedos)!=null?$:[]),I.unshift(...E.undos),i.sequenceExecute(S,t).result){const L=a.afterCommandExecute({id:yt.id,params:{range:C}});return i.sequenceExecute(L.redos,t),I.push(...L.undos),S.push(...L.redos),n.pushUndoRedo({unitID:m,undoMutations:I.reverse(),redoMutations:S}),!0}return!1}},er="sheet.command.insert-row",ye={type:i.CommandType.COMMAND,id:er,handler:async(s,e)=>{const t=s.get(i.ICommandService),n=s.get(g.SheetInterceptorService),{range:o,direction:r,unitId:a,subUnitId:l,cellValue:u}=e;return await n.beforeCommandExecute({id:ye.id,params:e})?t.syncExecuteCommand(ys.id,{range:o,direction:r,unitId:a,subUnitId:l,cellValue:u}):!1}},ys={type:i.CommandType.COMMAND,id:"sheet.command.insert-row-by-range",handler:(s,e)=>{var k,T,E,N;const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),o=s.get(i.IUniverInstanceService),r=s.get(g.SheetInterceptorService),a=P(o,e);if(!a)return!1;const{workbook:l,worksheet:u}=a,{range:d,direction:c,unitId:h,subUnitId:m,cellValue:R}=e,{startRow:C,endRow:S}=d;d.rangeType=i.RANGE_TYPE.ROW;const I=c===i.Direction.UP?C:C-1,v=u.getRowHeight(I),M={unitId:h,subUnitId:m,range:d,rowInfo:new Array(S-C+1).fill(void 0).map(()=>({h:v,hd:i.BooleanNumber.FALSE}))},p=sn(s,M),w=[{id:re.id,params:M}],y=[{id:ae.id,params:p}];R&&Object.keys(R).length>0&&w.push({id:F.id,params:{unitId:h,subUnitId:m,cellValue:R}});const b=r.onCommandExecute({id:ye.id,params:e});if(w.unshift(...(k=b.preRedos)!=null?k:[]),w.push(...(T=b.redos)!=null?T:[]),w.push(ke(d,l,u)),y.unshift(...(E=b.preUndos)!=null?E:[]),y.push(...(N=b.undos)!=null?N:[]),i.sequenceExecute(w,t).result){const V=r.afterCommandExecute({id:ye.id,params:e});return i.sequenceExecute(V.redos,t),w.push(...V.redos),y.push(...V.undos),n.pushUndoRedo({unitID:e.unitId,undoMutations:y,redoMutations:w}),!0}return!1}},tr={type:i.CommandType.COMMAND,id:"sheet.command.insert-row-before",handler:async(s,e)=>{var I;const n=(I=s.get(g.SheetsSelectionsService).getCurrentSelections())==null?void 0:I.map(v=>v.range);let o;if((n==null?void 0:n.length)===1)o=n[0];else return!1;const r=s.get(i.IUniverInstanceService),a=P(r);if(!a)return!1;const{worksheet:l,subUnitId:u,unitId:d}=a,c=e.value||0,h=o.startRow,m=o.startRow+c-1,R=0,C=l.getColumnCount()-1,S={unitId:d,subUnitId:u,direction:i.Direction.UP,range:{startRow:h,endRow:m,startColumn:R,endColumn:C},cellValue:Be(l,h,m,R,C,!0,h-1)};return s.get(i.ICommandService).executeCommand(ye.id,S)}},nr={type:i.CommandType.COMMAND,id:"sheet.command.insert-row-after",handler:async s=>{var S;const t=(S=s.get(g.SheetsSelectionsService).getCurrentSelections())==null?void 0:S.map(I=>I.range);let n;if((t==null?void 0:t.length)===1)n=t[0];else return!1;const o=s.get(i.IUniverInstanceService),r=P(o);if(!r)return!1;const{worksheet:a,unitId:l,subUnitId:u}=r,d=n.endRow-n.startRow+1,c=n.endRow+1,h=n.endRow+d,m=0,R=a.getColumnCount()-1,C={unitId:l,subUnitId:u,direction:i.Direction.DOWN,range:{startRow:c,endRow:h,startColumn:m,endColumn:R,rangeType:i.RANGE_TYPE.ROW},cellValue:Be(a,c,h,m,R,!0,n.endRow)};return s.get(i.ICommandService).executeCommand(ye.id,C)}},sr={type:i.CommandType.COMMAND,id:"sheet.command.insert-multi-rows-above",handler:async(s,e)=>{var v;const n=(v=s.get(g.SheetsSelectionsService).getCurrentSelections())==null?void 0:v.map(M=>M.range);let o;if((n==null?void 0:n.length)===1)o=n[0];else return!1;const r=s.get(i.IUniverInstanceService),a=P(r);if(!a)return!1;const{worksheet:l,unitId:u,subUnitId:d}=a,c=e.value||0,h=o.startRow,m=o.startRow+c-1,R=0,C=l.getColumnCount()-1,S=Be(l,h,m,R,C,!0,h-1),I={unitId:u,subUnitId:d,direction:i.Direction.UP,range:{startRow:h,endRow:m,startColumn:R,endColumn:C,rangeType:i.RANGE_TYPE.ROW},cellValue:S};return s.get(i.ICommandService).executeCommand(ye.id,I)}},or={type:i.CommandType.COMMAND,id:"sheet.command.insert-multi-rows-after",handler:async(s,e)=>{var I;const n=(I=s.get(g.SheetsSelectionsService).getCurrentSelections())==null?void 0:I.map(v=>v.range);let o;if((n==null?void 0:n.length)===1)o=n[0];else return!1;const r=s.get(i.IUniverInstanceService),a=P(r);if(!a)return!1;const{worksheet:l,unitId:u,subUnitId:d}=a,c=e.value||0,h=o.endRow+1,m=o.endRow+c,R=0,C=l.getColumnCount()-1,S={unitId:u,subUnitId:d,direction:i.Direction.DOWN,range:{startRow:h,endRow:m,startColumn:R,endColumn:C,rangeType:i.RANGE_TYPE.ROW},cellValue:Be(l,h,m,R,C,!0,o.endRow)};return s.get(i.ICommandService).executeCommand(ye.id,S)}},rr="sheet.command.insert-col",_e={type:i.CommandType.COMMAND,id:rr,handler:async(s,e)=>{const t=s.get(i.ICommandService),n=s.get(g.SheetInterceptorService),{range:o,direction:r,subUnitId:a,unitId:l,cellValue:u}=e;return await n.beforeCommandExecute({id:_e.id,params:e})?t.syncExecuteCommand(_s.id,{range:o,direction:r,unitId:l,subUnitId:a,cellValue:u}):!1}},_s={type:i.CommandType.COMMAND,id:"sheet.command.insert-col-by-range",handler:(s,e)=>{var U,k,T,E;const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),o=s.get(i.IUniverInstanceService),r=s.get(g.SheetInterceptorService),{range:a,direction:l,subUnitId:u,unitId:d,cellValue:c}=e,{startColumn:h,endColumn:m}=e.range;a.rangeType=i.RANGE_TYPE.COLUMN;const R=o.getUniverSheetInstance(e.unitId),C=R.getSheetBySheetId(e.subUnitId),S=l===i.Direction.LEFT?h:h-1,I=C.getColumnWidth(S),v={unitId:d,subUnitId:u,range:a,colInfo:new Array(m-h+1).fill(void 0).map(()=>({w:I,hd:i.BooleanNumber.FALSE}))},M=At(s,v),p=[{id:ie.id,params:v}],w=[{id:ne.id,params:M}];c&&p.push({id:F.id,params:{unitId:d,subUnitId:u,cellValue:c}});const y=r.onCommandExecute({id:_e.id,params:e});if(p.unshift(...(U=y.preRedos)!=null?U:[]),p.push(...(k=y.redos)!=null?k:[]),p.push(ke(a,R,C)),w.unshift(...(T=y.preUndos)!=null?T:[]),w.push(...(E=y.undos)!=null?E:[]),i.sequenceExecute(p,t).result){const N=r.afterCommandExecute({id:_e.id,params:e});return i.sequenceExecute(N.redos,t),p.push(...N.redos),w.push(...N.undos),n.pushUndoRedo({unitID:e.unitId,undoMutations:w.filter(Boolean),redoMutations:p.filter(Boolean)}),!0}return!1}},ir={type:i.CommandType.COMMAND,id:"sheet.command.insert-col-before",handler:async(s,e)=>{const n=s.get(g.SheetsSelectionsService).getCurrentSelections();let o;if((n==null?void 0:n.length)===1)o=n[0].range;else return!1;const r=s.get(i.IUniverInstanceService),a=P(r);if(!a)return!1;const{worksheet:l,unitId:u,subUnitId:d}=a,c=e.value||0,h=o.startColumn,m=o.startColumn+c-1,R=0,C=l.getRowCount()-1,S={unitId:u,subUnitId:d,direction:i.Direction.LEFT,range:{startColumn:h,endColumn:m,startRow:R,endRow:C,rangeType:i.RANGE_TYPE.COLUMN},cellValue:Be(l,R,C,h,m,!1,h-1)};return s.get(i.ICommandService).executeCommand(_e.id,S)}},ar={type:i.CommandType.COMMAND,id:"sheet.command.insert-col-after",handler:async s=>{const t=s.get(g.SheetsSelectionsService).getCurrentSelections();let n;if((t==null?void 0:t.length)===1)n=t[0].range;else return!1;const o=s.get(i.IUniverInstanceService),r=P(o);if(!r)return!1;const{worksheet:a,unitId:l,subUnitId:u}=r,d=n.endColumn-n.startColumn+1,c=n.endColumn+1,h=n.endColumn+d,m=0,R=a.getRowCount()-1,C={unitId:l,subUnitId:u,direction:i.Direction.RIGHT,range:{startColumn:c,endColumn:h,startRow:m,endRow:R},cellValue:Be(a,m,R,c,h,!1,n.endColumn)};return s.get(i.ICommandService).executeCommand(_e.id,C)}},lr={type:i.CommandType.COMMAND,id:"sheet.command.insert-multi-cols-before",handler:async(s,e)=>{const n=s.get(g.SheetsSelectionsService).getCurrentSelections();let o;if((n==null?void 0:n.length)===1)o=n[0].range;else return!1;const r=s.get(i.IUniverInstanceService),a=P(r);if(!a)return!1;const{worksheet:l,unitId:u,subUnitId:d}=a,c=e.value||0,h=o.startColumn,m=o.startColumn+c-1,R=0,C=l.getRowCount()-1,S={unitId:u,subUnitId:d,direction:i.Direction.LEFT,range:{startColumn:h,endColumn:m,startRow:R,endRow:C,rangeType:i.RANGE_TYPE.COLUMN},cellValue:Be(l,R,C,h,m,!1,h-1)};return s.get(i.ICommandService).executeCommand(_e.id,S)}},ur={type:i.CommandType.COMMAND,id:"sheet.command.insert-multi-cols-right",handler:async(s,e)=>{const n=s.get(g.SheetsSelectionsService).getCurrentSelections();let o;if((n==null?void 0:n.length)===1)o=n[0].range;else return!1;const r=s.get(i.IUniverInstanceService),a=P(r);if(!a)return!1;const{worksheet:l,unitId:u,subUnitId:d}=a,c=e.value||0,h=o.endColumn+1,m=o.endColumn+c,R=0,C=l.getRowCount()-1,S={unitId:u,subUnitId:d,direction:i.Direction.RIGHT,range:{startColumn:h,endColumn:m,startRow:R,endRow:C},cellValue:Be(l,R,C,h,m,!1,o.endColumn)};return s.get(i.ICommandService).executeCommand(_e.id,S)}},Rn="sheet.command.remove-row",bs={type:i.CommandType.COMMAND,id:"sheet.command.remove-row-by-range",handler:(s,e)=>{var I,v,M;if(!e)return!1;const t=s.get(i.IUniverInstanceService),n=P(t,e);if(!n)return!1;const{workbook:o,worksheet:r}=n,a=s.get(g.SheetInterceptorService),{range:l,unitId:u,subUnitId:d}=e,c=Vt([l],s,u,d).reverse(),h=[],m=[];c.forEach(p=>{const w=[],y=[],b={unitId:u,subUnitId:d,range:p},U=_a(b,r),k=r.getCellMatrix().getSlice(p.startRow,p.endRow,0,r.getColumnCount()-1),T={unitId:u,subUnitId:d,cellValue:k.getMatrix()};y.push({id:ae.id,params:b}),w.push({id:re.id,params:U}),w.push({id:F.id,params:T}),m.push(...y),h.unshift(...w)});const R=a.onCommandExecute({id:Rn,params:{range:l}}),C=s.get(i.ICommandService);if(i.sequenceExecute([...(I=R.preRedos)!=null?I:[],...m,...R.redos,ke(l,o,r)],C).result){const p=a.afterCommandExecute({id:Rn,params:{range:l}});return i.sequenceExecute(p.redos,C),s.get(i.IUndoRedoService).pushUndoRedo({unitID:u,undoMutations:[...(v=R.preUndos)!=null?v:[],...h,...R.undos,...p.undos],redoMutations:[...(M=R.preRedos)!=null?M:[],...m,...R.redos,...p.redos]}),!0}return!1}},Ht={type:i.CommandType.COMMAND,id:Rn,handler:async(s,e)=>{var m;const t=s.get(g.SheetsSelectionsService),n=s.get(g.SheetInterceptorService),o=s.get(i.ICommandService);let r=e==null?void 0:e.range;if(r||(r=(m=t.getCurrentLastSelection())==null?void 0:m.range),!r)return!1;const a=s.get(i.IUniverInstanceService),l=P(a);if(!l)return!1;const{worksheet:u,subUnitId:d,unitId:c}=l;return r={...r,startColumn:0,endColumn:Math.max(u.getMaxColumns()-1,0)},await n.beforeCommandExecute({id:Ht.id,params:{range:r}})?o.syncExecuteCommand(bs.id,{range:r,unitId:c,subUnitId:d}):!1}},Cn="sheet.command.remove-col",Es={type:i.CommandType.COMMAND,id:"sheet.command.remove-col-by-range",handler:(s,e)=>{var v,M,p;if(!e)return!1;const t=s.get(i.IUniverInstanceService),n=P(t,e);if(!n)return!1;const{workbook:o,worksheet:r}=n,a=s.get(g.SheetInterceptorService),{range:l,unitId:u,subUnitId:d}=e,c={unitId:u,subUnitId:d,range:l},h=ba(s,c),m=r.getCellMatrix().getSlice(0,r.getRowCount()-1,l.startColumn,l.endColumn),R={unitId:u,subUnitId:d,cellValue:m.getMatrix()},C=a.onCommandExecute({id:Cn,params:{range:l}}),S=s.get(i.ICommandService);if(i.sequenceExecute([...(v=C.preRedos)!=null?v:[],{id:ne.id,params:c},...C.redos,ke(l,o,r)],S).result){const w=a.afterCommandExecute({id:Cn,params:{range:l}});return i.sequenceExecute(w.redos,S),s.get(i.IUndoRedoService).pushUndoRedo({unitID:u,undoMutations:[...(M=C.preUndos)!=null?M:[],{id:ie.id,params:h},{id:F.id,params:R},...C.undos,...w.undos],redoMutations:[...(p=C.preRedos)!=null?p:[],{id:ne.id,params:c},...C.redos,...w.redos]}),!0}return!1}},Ft={type:i.CommandType.COMMAND,id:Cn,handler:async(s,e)=>{var m;const t=s.get(g.SheetsSelectionsService),n=s.get(g.SheetInterceptorService),o=s.get(i.ICommandService);let r=e==null?void 0:e.range;if(r||(r=(m=t.getCurrentLastSelection())==null?void 0:m.range),!r)return!1;const a=s.get(i.IUniverInstanceService),l=P(a);if(!l)return!1;const{worksheet:u,subUnitId:d,unitId:c}=l;return r={...r,startRow:0,endRow:Math.max(u.getMaxRows()-1,0)},await n.beforeCommandExecute({id:Ft.id,params:{range:r}})?o.syncExecuteCommand(Es.id,{range:r,unitId:c,subUnitId:d}):!1}},dr=(s,e)=>{const t=s.get(i.IUniverInstanceService),{subUnitId:n,unitId:o}=e,r=pe(t,e);if(!r)throw new Error("[RemoveSheetUndoMutationFactory]: Worksheet is null error!");const{workbook:a,worksheet:l}=r,u=l.getConfig();return{index:a.getConfig().sheetOrder.findIndex(h=>h===n),sheet:u,unitId:o}},He={id:"sheet.mutation.remove-sheet",type:i.CommandType.MUTATION,handler:(s,e)=>{const t=s.get(i.IUniverInstanceService),{subUnitId:n,unitId:o}=e,r=t.getUniverSheetInstance(o);return r?r.removeSheet(n):!1}};function Al(s,e){return e.getMergeData().some(t=>t.startRow<s&&s<=t.endRow)}function Wl(s,e){return e.getMergeData().some(t=>t.startColumn<s&&s<=t.endColumn)}const cr="sheet.command.move-rows",_t={id:cr,type:i.CommandType.COMMAND,handler:(s,e)=>{var V,W;const t=s.get(g.SheetsSelectionsService),{fromRange:{startRow:n},toRange:{startRow:o},range:r}=e,a=r?[mr(r)]:t.getCurrentSelections(),l=a==null?void 0:a.filter($=>$.range.rangeType===i.RANGE_TYPE.ROW&&$.range.startRow<=n&&n<=$.range.endRow);if((l==null?void 0:l.length)!==1)return!1;const u=s.get(g.SheetInterceptorService),d=s.get(i.IUniverInstanceService),c=P(d,e);if(!c)return!1;const{workbook:h,worksheet:m}=c,R=h.getUnitId(),C=m.getSheetId(),S=s.get(i.ErrorService),I=s.get(i.LocaleService),v=l[0].range,M=l[0].primary,p=$t(v,m,!1);if(!i.Rectangle.equals(v,p))return S.emit(I.t("sheets.info.partOfCell")),!1;if(Al(o,m))return S.emit(I.t("sheets.info.acrossMergedCell")),!1;const w={...v,startRow:o,endRow:o+v.endRow-v.startRow},y={unitId:R,subUnitId:C,sourceRange:v,targetRange:w},b=go(s,y),U=s.get(i.ICommandService),k=u.onCommandExecute({id:_t.id,params:e}),T=[...(V=k.preRedos)!=null?V:[],{id:we.id,params:y}],E=[...(W=k.preUndos)!=null?W:[],{id:we.id,params:b}];if(M){const L=o-n<0,Y=v.endRow-v.startRow+1,z=L?w:{...w,startRow:w.startRow-Y,endRow:w.endRow-Y},x={unitId:R,subUnitId:C,type:Q.MOVE_END,selections:[{range:z,primary:se(z,m),style:null}]},oe={unitId:R,subUnitId:C,type:Q.MOVE_END,selections:[{range:v,primary:M,style:null}]};T.push({id:q.id,params:x}),E.push({id:q.id,params:oe})}if(T.push(...k.redos),E.push(...k.undos),i.sequenceExecute(T,U).result){const $=u.afterCommandExecute({id:_t.id,params:e});return i.sequenceExecute($.redos,U),T.push(...$.redos),E.push(...$.undos),s.get(i.IUndoRedoService).pushUndoRedo({unitID:R,undoMutations:E,redoMutations:T}),!0}return!1}},hr="sheet.command.move-cols",bt={id:hr,type:i.CommandType.COMMAND,handler:(s,e)=>{var V,W;const t=s.get(g.SheetsSelectionsService),{fromRange:{startColumn:n},toRange:{startColumn:o},range:r}=e,a=r?[mr(r)]:t.getCurrentSelections(),l=a==null?void 0:a.filter($=>$.range.rangeType===i.RANGE_TYPE.COLUMN&&$.range.startColumn<=n&&n<=$.range.endColumn);if((l==null?void 0:l.length)!==1)return!1;const u=s.get(g.SheetInterceptorService),d=s.get(i.IUniverInstanceService),c=P(d,e);if(!c)return!1;const{workbook:h,worksheet:m}=c,R=h.getUnitId(),C=m.getSheetId(),S=s.get(i.ErrorService),I=s.get(i.LocaleService),v=l[0].range,M=l[0].primary,p=$t(v,m,!1);if(!i.Rectangle.equals(v,p))return S.emit(I.t("sheets.info.partOfCell")),!1;if(Wl(o,m))return S.emit(I.t("sheets.info.acrossMergedCell")),!1;const w={...v,startColumn:o,endColumn:o+v.endColumn-v.startColumn},y={unitId:R,subUnitId:C,sourceRange:v,targetRange:w},b=Ro(s,y),U=s.get(i.ICommandService),k=u.onCommandExecute({id:bt.id,params:e}),T=[...(V=k.preRedos)!=null?V:[],{id:Me.id,params:y}],E=[...(W=k.preUndos)!=null?W:[],{id:Me.id,params:b}];if(M){const $=v.endColumn-v.startColumn+1,z=o-n<0?w:{...w,startColumn:w.startColumn-$,endColumn:w.endColumn-$},x={unitId:R,subUnitId:C,type:Q.MOVE_END,selections:[{range:z,primary:se(z,m),style:null}]},oe={unitId:R,subUnitId:C,type:Q.MOVE_END,selections:[{range:v,primary:M,style:null}]};T.push({id:q.id,params:x}),E.push({id:q.id,params:oe})}if(T.push(...k.redos),E.push(...k.undos),i.sequenceExecute(T,U).result){const $=u.afterCommandExecute({id:bt.id,params:e});return i.sequenceExecute($.redos,U),T.push(...$.redos),E.push(...$.undos),s.get(i.IUndoRedoService).pushUndoRedo({unitID:R,undoMutations:E,redoMutations:T}),!0}return!1}};function mr(s){return{range:s,primary:null,style:null}}var Vl=Object.getOwnPropertyDescriptor,$l=(s,e,t,n)=>{for(var o=n>1?void 0:n?Vl(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},Ll=(s,e)=>(t,n)=>e(t,n,s);g.SheetSkeletonService=class extends i.Disposable{constructor(t){super();f(this,"_sheetSkeletonStore",new Map);this._injector=t,this.disposeWithMe(()=>{this._sheetSkeletonStore=new Map})}getSkeleton(t,n){if(this._sheetSkeletonStore.has(t))return this._sheetSkeletonStore.get(t).get(n)}setSkeleton(t,n,o){this._sheetSkeletonStore.has(t)||this._sheetSkeletonStore.set(t,new Map),this._sheetSkeletonStore.get(t).set(n,o)}deleteSkeleton(t,n){this._sheetSkeletonStore.has(t)&&this._sheetSkeletonStore.get(t).delete(n)}},g.SheetSkeletonService=$l([Ll(0,i.Inject(i.Injector))],g.SheetSkeletonService);function Ts(s,e){const t=new i.ObjectMatrix;return s.map(n=>i.Range.transformRange(n,e)).forEach(n=>{i.Range.foreach(n,(o,r)=>{const a=e.getCellHeight(o,r);a&&t.setValue(o,r,a)})}),t}const Bl=1e4;function jt(s,e){if(!e)return{suitableRanges:s,remainingRanges:[]};const t=e.worksheet.getColumnCount(),n=Math.ceil(Bl/t),o=[],r=[],a=e.getOffsetRelativeToRowCol(0,e.scrollY).row,l=s.map(d=>{let c;return a>=d.startRow&&a<=d.endRow?c=0:a<d.startRow?c=d.startRow-a:c=a-d.endRow,{range:d,distance:c,rowCount:d.endRow-d.startRow+1}});l.sort((d,c)=>d.distance!==c.distance?d.distance-c.distance:d.rowCount-c.rowCount);let u=0;for(const d of l)if(u+d.rowCount<=n)o.push(d.range),u+=d.rowCount;else{const c=n-u;if(c>0){const h={...d.range,endRow:d.range.startRow+c-1},m={...d.range,startRow:d.range.startRow+c};o.push(h),r.push(m),u=n}else r.push(d.range)}return{suitableRanges:o,remainingRanges:r}}function gr(s){let e=0;return s.forEach(()=>{e++}),e}const Rr="sheet.command.reorder-range",Sn={id:Rr,type:i.CommandType.COMMAND,handler:(s,e)=>{var p,w;const{subUnitId:t,unitId:n,range:o,order:r}=e,a=s.get(i.ICommandService),l={id:Wt.id,params:{unitId:n,subUnitId:t,order:r,range:o}},u={id:Wt.id,params:Co(l.params)},d=s.get(g.SheetInterceptorService),c=d.onCommandExecute({id:Sn.id,params:e}),h=[...(p=c.preRedos)!=null?p:[],l,...c.redos],m=[...(w=c.preUndos)!=null?w:[],u,...c.undos],R=i.sequenceExecute(h,a),{suitableRanges:C,remainingRanges:S}=jt([o],s.get(g.SheetSkeletonService).getSkeleton(n,t)),{undos:I,redos:v}=d.generateMutationsOfAutoHeight({unitId:n,subUnitId:t,ranges:[o],autoHeightRanges:C,lazyAutoHeightRanges:S}),M=d.afterCommandExecute({id:Sn.id,params:e});return R.result?(i.sequenceExecute([...M.redos,...v],a),s.get(i.IUndoRedoService).pushUndoRedo({unitID:n,undoMutations:[...m,...M.undos,...I],redoMutations:[...h,...M.redos,...v]}),!0):!1}},A={MoveRangeCommandId:zo,InsertRowCommandId:er,InsertColCommandId:rr,RemoveColCommandId:Cn,RemoveRowCommandId:Rn,DeleteRangeMoveLeftCommandId:Zo,DeleteRangeMoveUpCommandId:Qo,InsertRangeMoveDownCommandId:Dl,InsertRangeMoveRightCommandId:Ms,MoveColsCommandId:hr,MoveRowsCommandId:cr,ReorderRangeCommandId:Rr};var B=(s=>(s[s.Set=0]="Set",s[s.Delete=1]="Delete",s[s.HorizontalMove=2]="HorizontalMove",s[s.VerticalMove=3]="VerticalMove",s[s.Unknown=4]="Unknown",s))(B||{});const fn=Number.MAX_SAFE_INTEGER,Pe=s=>{const e={...s},t=Number.isNaN(e.startRow)&&Number.isNaN(e.endRow)&&!Number.isNaN(e.startColumn)&&!Number.isNaN(e.endColumn),n=Number.isNaN(e.startColumn)&&Number.isNaN(e.endColumn)&&!Number.isNaN(e.startRow)&&!Number.isNaN(e.endRow);return(e.rangeType===i.RANGE_TYPE.COLUMN||t)&&(e.startRow=0,e.endRow=fn),(e.rangeType===i.RANGE_TYPE.ROW||n)&&(e.startColumn=0,e.endColumn=fn),e.rangeType===i.RANGE_TYPE.ALL&&(e.startColumn=0,e.endColumn=fn,e.startRow=0,e.endRow=fn),e},me=s=>{let e=s.rangeType;return s.rangeType===i.RANGE_TYPE.COLUMN?e=i.RANGE_TYPE.ROW:s.rangeType===i.RANGE_TYPE.ROW&&(e=i.RANGE_TYPE.COLUMN),{startRow:s.startColumn,endRow:s.endColumn,startColumn:s.startRow,endColumn:s.endRow,rangeType:e}},Gt=(s,e,t)=>{const n={...t},o={...e},r=(S,I)=>{const v=Math.max(S.start,I.start),M=Math.min(S.end,I.end);return M<v?null:{start:v,end:M}},a=S=>S.end-S.start+1,l=(S,I)=>({start:S.start-I.start,end:S.start-I.start+S.end-S.start}),u=(S,I)=>({start:I.start+S.start,end:I.start+S.start+S.end-S.start}),d=e.start>s.start;if(d){const S=Math.min(s.end,e.start)-s.start+1;o.start-=S,o.end-=S}const c=a(s),h=c,m=r(s,n),R=m&&a(m)>=a(n);if(s.end<n.start)n.start-=c,n.end-=c;else if(m){const S=a(m);if(R){const I=l(n,s),v=u(I,o);n.start=v.start,n.end=v.end}else m.start>s.start?d?(n.end-=S+c,n.start-=c):n.end-=S:d?n.end-=S:n.start>s.start&&n.end>s.end?(n.start-=c,n.end-=c+S):n.end-=S}const C=r(o,n);return R||(o.start<=n.start?(n.start+=h,n.end+=h):C&&(d?o.end<=n.start||o.start<=n.start&&o.end>=n.start?(n.start+=h,n.end+=h):o.start>=n.start&&o.start<=n.end&&(n.end+=h):n.start<o.start&&n.end>o.start?n.end+=h:(n.start>=o.end||n.start>=o.start&&n.start<=o.end)&&(n.end+=h,n.start+=h))),{step:n.start-t.start,length:a(n)-a(t)}},Us=(s,e)=>{const{fromRange:t,toRange:n}=s.params||{};if(!n||!t)return[];const o=Pe(t),r=Pe(n),a=Pe(e),l=Gt({start:o.startRow,end:o.endRow},{start:r.startRow,end:r.endRow},{start:a.startRow,end:a.endRow});return l===null?[{type:B.Delete}]:[{type:B.VerticalMove,step:l.step||0,length:l.length||0}]},Hl=(s,e)=>{const{fromRange:t,toRange:n}=s.params||{};if(!t||!n)return[e];const o=t.startRow,r=t.endRow-t.startRow+1,a=n.startRow,l=new i.ObjectMatrix;return i.Range.foreach(e,(d,c)=>{l.setValue(d,c,1)}),l.moveRows(o,r,a),i.queryObjectMatrix(l,d=>d===1)},Fl=(s,e)=>{const{range:t,order:n}=s.params||{};if(!t||!n)return[e];const o=new i.ObjectMatrix;i.Range.foreach(e,(l,u)=>{o.setValue(l,u,1)});const r=new i.ObjectMatrix;return i.Range.foreach(t,(l,u)=>{var d;if(Object.prototype.hasOwnProperty.call(n,l)){const c=n[l],h=(d=o.getValue(c,u))!=null?d:0;r.setValue(l,u,h)}}),r.forValue((l,u,d)=>{o.setValue(l,u,d)}),i.queryObjectMatrix(o,l=>l===1)},ks=(s,e)=>{const{fromRange:t,toRange:n}=s.params||{};if(!n||!t)return[];const o=Pe(t),r=Pe(n),a=Pe(e),l=Gt({start:o.startColumn,end:o.endColumn},{start:r.startColumn,end:r.endColumn},{start:a.startColumn,end:a.endColumn});return l===null?[{type:B.Delete}]:[{type:B.HorizontalMove,step:l.step||0,length:l.length||0}]},jl=(s,e)=>{const{fromRange:t,toRange:n}=s.params||{};if(!t||!n)return[e];const o=t.startColumn,r=t.endColumn-t.startColumn+1,a=n.startColumn,l=new i.ObjectMatrix;return i.Range.foreach(e,(u,d)=>{l.setValue(u,d,1)}),l.moveColumns(o,r,a),i.queryObjectMatrix(l,u=>u===1)},Cr=(s,e)=>{var r,a;const t=(r=s.params)==null?void 0:r.toRange,n=(a=s.params)==null?void 0:a.fromRange;if(!t||!n)return[];const o=[];if(i.Rectangle.contains(t,e)&&o.push({type:B.Delete}),i.Rectangle.contains(n,e)){o.push({type:B.Delete});const l=i.Rectangle.getRelativeRange(e,n),u=i.Rectangle.getPositionRange(l,t);return[{type:B.Set,range:u}]}return o},Gl=(s,e)=>{var h,m;const t=(h=s.params)==null?void 0:h.toRange,n=(m=s.params)==null?void 0:m.fromRange;if(!t||!n)return[e];if(!i.Rectangle.intersects(n,e)&&!i.Rectangle.intersects(t,e))return[e];if(i.Rectangle.contains(n,e)){const R=i.Rectangle.getRelativeRange(e,n);return[i.Rectangle.getPositionRange(R,t)]}const o=new i.ObjectMatrix;i.Range.foreach(e,(R,C)=>{o.setValue(R,C,1)});const r=new i.ObjectMatrix,a=i.Rectangle.getIntersects(n,e);a&&i.Range.foreach(a,(R,C)=>{o.getValue(R,C)&&(o.setValue(R,C,void 0),r.setValue(R,C,1))});const l=t.startColumn-n.startColumn,u=t.startRow-n.startRow,d={startColumn:t.startColumn-l,endColumn:t.endColumn-l,startRow:t.startRow-u,endRow:t.endRow-u};return d&&i.Range.foreach(d,(R,C)=>{var v;const S=R+u,I=C+l;o.setValue(S,I,(v=r.getValue(R,C))!=null?v:0)}),i.queryObjectMatrix(o,R=>R===1)},tt=(s,e)=>{const t=Pe(s),n=Pe(e),o=a=>a.endColumn-a.startColumn+1,r=a=>a.endRow-a.startRow+1;if(t.startRow<=n.startRow&&t.endRow>=n.endRow){if(n.startColumn<t.startColumn&&n.endColumn>=t.startColumn&&n.endColumn<=t.endColumn||n.startColumn<t.startColumn&&n.endColumn>=t.endColumn){const a=i.Rectangle.getIntersects(n,t);if(a)return{step:0,length:-o(a)}}if(n.startColumn>=t.startColumn&&n.endColumn<=t.endColumn&&r(t)>=r(n))return null;if(n.startColumn>=t.startColumn&&n.startColumn<=t.endColumn&&n.endColumn>t.endColumn){const a=i.Rectangle.getIntersects(n,t);if(a){const l=-o(a);return{step:-(o(t)-o(a)),length:l}}}if(n.startColumn>t.endColumn)return{step:-o(t),length:0}}return{step:0,length:0}},Ps=(s,e)=>{var r;const t=(r=s.params)==null?void 0:r.range;if(!t)return[];const n=[],o=tt(t,e);if(!o)n.push({type:B.Delete});else{const{step:a,length:l}=o;n.push({type:B.HorizontalMove,step:a,length:l})}return n},Sr=(s,e,t)=>{var a;const n=(a=s.params)==null?void 0:a.range;if(!n)return[];const o=[];if(t&&t.length>0){let l=n.startRow;for(let u=n.startRow;u<=n.endRow;u++){if(t.includes(u)){if(u===l){l=u+1;continue}r({...n,startRow:l,endRow:u-1}),l=u+1;continue}u===n.endRow&&r({...n,startRow:l,endRow:n.endRow})}}else r(n);function r(l){const u=tt(me(l),me(e));if(!u)o.push({type:B.Delete});else{const{step:d,length:c}=u;o.push({type:B.VerticalMove,step:d,length:c})}}return o},zl=(s,e)=>{const{range:t,order:n}=s.params||{};if(!t||!n)return[];if(i.Rectangle.contains(t,e)&&e.endRow===e.startRow){const o=[],r=e.startRow;for(const a in n)if(n[a]===r){const l=Number(a);return o.push({type:B.VerticalMove,step:l-r,length:0}),o}return[]}return[]},nt=(s,e)=>{const t=Pe(s),n=Pe(e),o=r=>r.endColumn-r.startColumn+1;return t.startRow<=n.startRow&&t.endRow>=n.endRow?n.startColumn<t.startColumn&&n.endColumn>=t.startColumn&&n.endColumn<=t.endColumn||n.startColumn<t.startColumn&&n.endColumn>=t.endColumn?{step:0,length:o(t)}:n.startColumn>=t.startColumn&&n.endColumn<=t.endColumn||n.startColumn>=t.startColumn&&n.startColumn<=t.endColumn&&n.endColumn>t.endColumn||n.startColumn>=t.endColumn?{step:o(t),length:0}:{step:0,length:0}:{step:0,length:0}};function ql(s,e,t){const n=[];if(i.Rectangle.contains(e,t)&&n.push({type:B.Delete}),i.Rectangle.contains(s,t)){n.push({type:B.Delete});const o=i.Rectangle.getRelativeRange(t,s),r=i.Rectangle.getPositionRange(o,e);return[{type:B.Set,range:r}]}return n}const fr=(s,e)=>{var l;const t=(l=s.params)==null?void 0:l.range;if(!t)return[];const n=[],o=nt(me(t),me(e)),{step:r,length:a}=o;return n.push({type:B.VerticalMove,step:r,length:a}),n},Ir=(s,e)=>{var l;const t=(l=s.params)==null?void 0:l.range;if(!t)return[];const n=[],o=nt(t,e),{step:r,length:a}=o;return n.push({type:B.HorizontalMove,step:r,length:a}),n},vr=(s,e)=>{var l;const t=(l=s.params)==null?void 0:l.range;if(!t)return[];const n=[],o=nt(me(t),me(e)),{step:r,length:a}=o;return n.push({type:B.VerticalMove,step:r,length:a}),n},Yl=(s,e)=>{var u;const t=(u=s.params)==null?void 0:u.range;if(!t)return[e];const n=t.endRow-t.startRow+1,o={...t,startRow:t.startRow,endRow:Number.POSITIVE_INFINITY},r=i.Rectangle.subtract(e,o),a=i.Rectangle.getIntersects(o,e);if(!a)return[e];const l=new i.ObjectMatrix;return r.forEach(d=>{i.Range.foreach(d,(c,h)=>{l.setValue(c,h,1)})}),a&&i.Range.foreach(a,(d,c)=>{l.setValue(d+n,c,1)}),i.queryObjectMatrix(l,d=>d===1)},pr=(s,e)=>{var l;const t=(l=s.params)==null?void 0:l.range;if(!t)return[];const n=[],o=nt(t,e),{step:r,length:a}=o;return n.push({type:B.HorizontalMove,step:r,length:a}),n},xl=(s,e)=>{var u;const t=(u=s.params)==null?void 0:u.range;if(!t)return[e];const n=t.endColumn-t.startColumn+1,o={...t,startColumn:t.startColumn,endColumn:Number.POSITIVE_INFINITY},r=i.Rectangle.subtract(e,o),a=i.Rectangle.getIntersects(o,e);if(!a)return[e];const l=new i.ObjectMatrix;return r.forEach(d=>{i.Range.foreach(d,(c,h)=>{l.setValue(c,h,1)})}),a&&i.Range.foreach(a,(d,c)=>{l.setValue(d,c+n,1)}),i.queryObjectMatrix(l,d=>d===1)},wr=(s,e)=>{var r;const t=(r=s.params)==null?void 0:r.range;if(!t)return[];const n=[],o=tt(t,e);if(!o)n.push({type:B.Delete});else{const{step:a,length:l}=o;n.push({type:B.HorizontalMove,step:a,length:l})}return n},Kl=(s,e)=>{var d;const t=(d=s.params)==null?void 0:d.range;if(!t)return[e];const n={startRow:t.startRow,endRow:t.endRow,startColumn:t.startColumn,endColumn:Number.POSITIVE_INFINITY},o=t.endColumn-t.startColumn+1,r=i.Rectangle.getIntersects(t,e),a=i.Rectangle.subtract(e,n),l=i.Rectangle.getIntersects(n,e);if(!r&&!l)return[e];const u=new i.ObjectMatrix;return l&&i.Range.foreach(l,(c,h)=>{u.setValue(c,h-o,1)}),r&&i.Range.foreach(r,(c,h)=>{u.setValue(c,h-o,0)}),a.forEach(c=>{i.Range.foreach(c,(h,m)=>{u.setValue(h,m,1)})}),i.queryObjectMatrix(u,c=>c===1)},Mr=(s,e)=>{var r;const t=(r=s.params)==null?void 0:r.range;if(!t)return[];const n=[],o=tt(me(t),me(e));if(!o)n.push({type:B.Delete});else{const{step:a,length:l}=o;n.push({type:B.VerticalMove,step:a,length:l})}return n},Jl=(s,e)=>{var d;const t=(d=s.params)==null?void 0:d.range;if(!t)return[e];const n={...t,startRow:t.startRow,endRow:Number.POSITIVE_INFINITY},o=t.endRow-t.startRow+1,r=i.Rectangle.getIntersects(t,e),a=i.Rectangle.subtract(e,n),l=i.Rectangle.getIntersects(n,e);if(!r&&!l)return[e];const u=new i.ObjectMatrix;return l&&i.Range.foreach(l,(c,h)=>{u.setValue(c-o,h,1)}),r&&i.Range.foreach(r,(c,h)=>{u.setValue(c-o,h,0)}),a.forEach(c=>{i.Range.foreach(c,(h,m)=>{u.setValue(h,m,1)})}),i.queryObjectMatrix(u,c=>c===1)},Xl=(s,e)=>{var o;const t=(o=s.ranges)!=null?o:[s.range],n=new i.ObjectMatrix;return i.Range.foreach(e,(r,a)=>{n.setValue(r,a,1)}),t.forEach(r=>{const a=r.startRow,u=r.endRow-a+1;n.removeRows(a,u)}),i.queryObjectMatrix(n,r=>r===1)},Zl=(s,e)=>{const t=s.params,n=t.range.startRow,o=t.range.endRow-t.range.startRow+1;if(t.direction===i.Direction.UP){if(n<e.startRow)return[{...e,startRow:e.startRow+o,endRow:e.endRow+o}];if(n<=e.endRow)return[{...e,endRow:e.endRow+o}]}else{if(n<=e.startRow)return[{...e,startRow:e.startRow+o,endRow:e.endRow+o}];if(n<=e.endRow+1)return[{...e,endRow:e.endRow+o}]}return[e]},Ql=(s,e)=>{const t=s.params,n=t.range.startColumn,o=t.range.endColumn-t.range.startColumn+1;if(t.direction===i.Direction.LEFT){if(n<e.startColumn)return[{...e,startColumn:e.startColumn+o,endColumn:e.endColumn+o}];if(n<=e.endColumn)return[{...e,endColumn:e.endColumn+o}]}else{if(n<=e.startColumn)return[{...e,startColumn:e.startColumn+o,endColumn:e.endColumn+o}];if(n<=e.endColumn+1)return[{...e,endColumn:e.endColumn+o}]}return[e]},st=(s,e)=>{let t={...e};return s.forEach(n=>{switch(n.type){case B.Delete:{t=null;break}case B.HorizontalMove:{if(!t)return;t.startColumn+=n.step,t.endColumn+=n.step+(n.length||0);break}case B.VerticalMove:{if(!t)return;t.startRow+=n.step,t.endRow+=n.step+(n.length||0);break}case B.Set:{t=n.range;break}}}),t&&(t.endColumn<t.startColumn||t.endRow<t.startRow)?null:t},Ns=(s,e)=>{let t=[];switch(e.id){case A.DeleteRangeMoveLeftCommandId:{t=wr(e,s);break}case A.DeleteRangeMoveUpCommandId:{t=Mr(e,s);break}case A.InsertColCommandId:{t=Ir(e,s);break}case A.InsertRangeMoveDownCommandId:{t=vr(e,s);break}case A.InsertRangeMoveRightCommandId:{t=pr(e,s);break}case A.InsertRowCommandId:{t=fr(e,s);break}case A.MoveColsCommandId:{t=ks(e,s);break}case A.MoveRangeCommandId:{t=Cr(e,s);break}case A.MoveRowsCommandId:{t=Us(e,s);break}case A.RemoveColCommandId:{t=Ps(e,s);break}case A.RemoveRowCommandId:{t=Sr(e,s);break}case A.ReorderRangeCommandId:{t=zl(e,s);break}}return st(t,s)},eu=(s,e,t)=>[Ge.id,ze.id].includes(e.id)||_r(e,t).some(r=>i.Rectangle.intersects(r,s))?Ns(s,e):s,Os=(s,e)=>{let t=[];switch(e.id){case A.DeleteRangeMoveLeftCommandId:return Kl(e,s);case A.DeleteRangeMoveUpCommandId:return Jl(e,s);case A.InsertRangeMoveDownCommandId:return Yl(e,s);case A.InsertRangeMoveRightCommandId:return xl(e,s);case A.InsertColCommandId:return Ql(e,s);case A.InsertRowCommandId:return Zl(e,s);case A.MoveColsCommandId:return jl(e,s);case A.MoveRangeCommandId:return Gl(e,s);case A.MoveRowsCommandId:return Hl(e,s);case A.ReorderRangeCommandId:return Fl(e,s);case A.RemoveColCommandId:{t=Ps(e,s);break}case A.RemoveRowCommandId:return Xl(e.params,s)}const n=st(t,s);return n?[n]:[]},tu=(s,e,t)=>[Ge.id,ze.id,et.id,Ms].includes(e.id)||_r(e,t).some(r=>i.Rectangle.intersects(r,s))?Os(s,e):s;function yr(s,e){const{id:t,params:n}=e;let o={length:0,step:0,type:B.Unknown};switch(t){case He.id:o.type=B.Delete;break;case we.id:o=Gt({start:n.sourceRange.startRow,end:n.sourceRange.endRow},{start:n.targetRange.startRow,end:n.targetRange.endRow},{start:s.startRow,end:s.endRow}),o.type=B.VerticalMove;break;case Me.id:o=Gt({start:n.sourceRange.startColumn,end:n.sourceRange.endColumn},{start:n.targetRange.startColumn,end:n.targetRange.endColumn},{start:s.startColumn,end:s.endColumn}),o.type=B.HorizontalMove;break;case ne.id:o=tt(n.range,s),o?o.type=B.HorizontalMove:o={step:0,length:0,type:B.Delete};break;case ae.id:o=tt(me(n.range),me(s)),o?o.type=B.VerticalMove:o={step:0,length:0,type:B.Delete};break;case re.id:o=nt(me(n.range),me(s)),o.type=B.VerticalMove;break;case ie.id:o=nt(n.range,s),o.type=B.HorizontalMove;break;case Fe.id:{const r=n.fromRange||new i.ObjectMatrix(n.from).getRange(),a=n.toRange||new i.ObjectMatrix(n.to).getRange();o=ql(r,a,s)}break}return o?Array.isArray(o)?st(o,s):st([o],s):s}function _r(s,e){var n,o,r,a,l,u;const{selectionManagerService:t}=e;switch(s.id){case A.MoveColsCommandId:{const d=s.params;return[d.fromRange,{...d.toRange,startColumn:d.toRange.startColumn-.5,endColumn:d.toRange.endColumn-.5}]}case A.MoveRowsCommandId:{const d=s.params;return[d.fromRange,{...d.toRange,startRow:d.toRange.startRow-.5,endRow:d.toRange.startRow-.5}]}case A.MoveRangeCommandId:{const d=s;return[d.params.fromRange,d.params.toRange]}case A.InsertRowCommandId:{const c=s.params.range;return[{...c,startRow:c.startRow-.5,endRow:c.endRow-.5}]}case A.InsertColCommandId:{const c=s.params.range;return[{...c,startColumn:c.startColumn-.5,endColumn:c.endColumn-.5}]}case A.RemoveRowCommandId:return[s.params.range];case A.RemoveColCommandId:return[s.params.range];case A.DeleteRangeMoveUpCommandId:case A.InsertRangeMoveDownCommandId:{const c=((n=s.params)==null?void 0:n.range)||((r=(o=t.getCurrentSelections())==null?void 0:o.map(h=>h.range))==null?void 0:r[0]);return c?[c]:[]}case A.DeleteRangeMoveLeftCommandId:case A.InsertRangeMoveRightCommandId:{const c=((a=s.params)==null?void 0:a.range)||((u=(l=t.getCurrentSelections())==null?void 0:l.map(h=>h.range))==null?void 0:u[0]);return c?[c]:[]}case A.ReorderRangeCommandId:{const d=s,{range:c,order:h}=d.params,m=[];for(let R=c.startRow;R<=c.endRow;R++)R in h&&m.push({startRow:R,endRow:R,startColumn:c.startColumn,endColumn:c.endColumn});return m}}}function nu(s){switch(s.id){case Me.id:{const e=s.params;return[e.sourceRange,{...e.targetRange,startColumn:e.targetRange.startColumn-.5,endColumn:e.targetRange.startColumn-.5}]}case we.id:{const e=s.params;return[e.sourceRange,{...e.targetRange,startRow:e.targetRange.startRow-.5,endRow:e.targetRange.startRow-.5}]}case Fe.id:{const e=s.params;return[new i.ObjectMatrix(e.from.value).getRange(),new i.ObjectMatrix(e.to.value).getRange()]}case ie.id:{const t=s.params.range;return[{...t,startColumn:t.startColumn-.5,endColumn:t.startColumn-.5}]}case re.id:{const t=s.params.range;return[{...t,startRow:t.startRow-.5,endRow:t.startRow-.5}]}case ne.id:return[s.params.range];case ae.id:return[s.params.range]}}function su(s,e){var o,r,a,l,u,d;const t=s.get(i.IUniverInstanceService),n=s.get(g.SheetsSelectionsService);switch(e.id){case A.MoveColsCommandId:{const c=e.params,h=P(t,{unitId:c.unitId,subUnitId:c.subUnitId});return{unitId:h.unitId,subUnitId:h.subUnitId,ranges:[c.fromRange,{...c.toRange,startColumn:c.fromRange.startColumn<c.toRange.startColumn?c.fromRange.endColumn+1:c.toRange.startColumn,endColumn:c.fromRange.startColumn<c.toRange.startColumn?c.toRange.endColumn-1:c.fromRange.startColumn-1}]}}case A.MoveRowsCommandId:{const c=e.params,h=P(t,{unitId:c.unitId,subUnitId:c.subUnitId});return{unitId:h.unitId,subUnitId:h.subUnitId,ranges:[c.fromRange,{...c.toRange,startRow:c.fromRange.startRow<c.toRange.startRow?c.fromRange.endRow+1:c.toRange.startRow,endRow:c.fromRange.startRow<c.toRange.startRow?c.toRange.endRow-1:c.fromRange.startRow-1}]}}case A.MoveRangeCommandId:{const c=e.params,h=P(t);return{unitId:h.unitId,subUnitId:h.subUnitId,ranges:[c.fromRange,c.toRange]}}case A.InsertRowCommandId:{const c=e.params,h=c.range;return{unitId:c.unitId,subUnitId:c.subUnitId,ranges:[...h.startRow>0?[{...h,startRow:h.startRow-1,endRow:h.endRow-1}]:[],{...h,startRow:h.startRow,endRow:Number.MAX_SAFE_INTEGER}]}}case A.InsertColCommandId:{const c=e.params,h=c.range;return{unitId:c.unitId,subUnitId:c.subUnitId,ranges:[...h.startColumn>0?[{...h,startColumn:h.startColumn-1,endColumn:h.endColumn-1}]:[],{...h,startColumn:h.startColumn,endColumn:Number.MAX_SAFE_INTEGER}]}}case A.RemoveRowCommandId:{const h=e.params.range,m=P(t);return{unitId:m.unitId,subUnitId:m.subUnitId,ranges:[h,{...h,startRow:h.endRow+1,endRow:Number.MAX_SAFE_INTEGER}]}}case A.RemoveColCommandId:{const h=e.params.range,m=P(t);return{unitId:m.unitId,subUnitId:m.subUnitId,ranges:[h,{...h,startColumn:h.endColumn+1,endColumn:Number.MAX_SAFE_INTEGER}]}}case A.DeleteRangeMoveUpCommandId:case A.InsertRangeMoveDownCommandId:{const c=e,h=P(t),m=((o=c.params)==null?void 0:o.range)||((a=(r=n.getCurrentSelections())==null?void 0:r.map(R=>R.range))==null?void 0:a[0]);return m?{unitId:h.unitId,subUnitId:h.subUnitId,ranges:[m,{...m,startRow:m.endRow+1,endRow:Number.MAX_SAFE_INTEGER}]}:{unitId:h.unitId,subUnitId:h.subUnitId,ranges:[]}}case A.DeleteRangeMoveLeftCommandId:case A.InsertRangeMoveRightCommandId:{const h=((l=e.params)==null?void 0:l.range)||((d=(u=n.getCurrentSelections())==null?void 0:u.map(R=>R.range))==null?void 0:d[0]),m=P(t);return h?{unitId:m.unitId,subUnitId:m.subUnitId,ranges:[h,{...h,startColumn:h.endColumn+1,endColumn:Number.MAX_SAFE_INTEGER}]}:{unitId:m.unitId,subUnitId:m.subUnitId,ranges:[]}}case A.ReorderRangeCommandId:{const c=e,{range:h,order:m}=c.params,R=[];for(let S=h.startRow;S<=h.endRow;S++)S in m&&R.push({startRow:S,endRow:S,startColumn:h.startColumn,endColumn:h.endColumn});const C=P(t);return{unitId:C.unitId,subUnitId:C.subUnitId,ranges:R}}}}var ou=Object.getOwnPropertyDescriptor,ru=(s,e,t,n)=>{for(var o=n>1?void 0:n?ou(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},In=(s,e)=>(t,n)=>e(t,n,s);const iu=i.createInterceptorKey("MERGE_REDO"),au=i.createInterceptorKey("MERGE_UNDO"),Ie=Math.floor(Number.MAX_SAFE_INTEGER/10);class lu extends i.Disposable{constructor(e,t,n,o,r=!1){super(),this._unitId=e,this._subUnitId=t,this._range=n,this._callback=o,this._skipIntersects=r}onMutation(e){var o,r;if(((o=e.params)==null?void 0:o.unitId)!==this._unitId)return;if(e.id===Fe.id){const a=e.params;if(a.from.subUnitId!==this._subUnitId||a.to.subUnitId!==this._subUnitId)return}else if(((r=e.params)==null?void 0:r.subUnitId)!==this._subUnitId)return;if(!this._range)return;if(this._skipIntersects){if(e.id===He.id)return;const a=nu(e);if(a!=null&&a.some(l=>i.Rectangle.intersects(l,this._range)))return}const t=yr(this._range,e);if(t&&i.Rectangle.equals(t,this._range))return!1;const n=this._range;this._range=t,this._callback(n,t)}}g.RefRangeService=class extends i.Disposable{constructor(t,n,o,r){super();f(this,"interceptor",new i.InterceptorManager({MERGE_REDO:iu,MERGE_UNDO:au}));f(this,"_watchRanges",new Set);f(this,"_refRangeManagerMap",new Map);f(this,"_serializer",uu());f(this,"_onRefRangeChange",()=>{this._sheetInterceptorService.interceptCommand({getMutations:t=>{const n=this._univerInstanceService.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET).getActiveSheet(),o=br(this._univerInstanceService),r=Er(this._univerInstanceService);if(!n||!o||!r)return{redos:[],undos:[],preRedos:[],preUndos:[]};const u=((()=>{switch(t.id){case A.MoveColsCommandId:{const R=t.params,C=Math.min(R.fromRange.startColumn,R.toRange.startColumn);return this._checkRange([{...R.fromRange,startColumn:C,endColumn:Ie}],o,r)}case A.MoveRowsCommandId:{const R=t.params,C=Math.min(R.fromRange.startRow,R.toRange.startRow);return this._checkRange([{...R.fromRange,startRow:C,endRow:Ie}],o,r)}case A.MoveRangeCommandId:{const R=t;return this._checkRange([R.params.fromRange,R.params.toRange],o,r)}case A.InsertRowCommandId:{const C=t.params.range.startRow,S={startRow:Math.max(0,C-1),endRow:Ie,startColumn:0,endColumn:Ie,rangeType:i.RANGE_TYPE.ROW};return this._checkRange([S],o,r)}case A.InsertColCommandId:{const C=t.params.range.startColumn,S={startRow:0,endRow:Ie,startColumn:Math.max(0,C-1),endColumn:Ie,rangeType:i.RANGE_TYPE.COLUMN};return this._checkRange([S],o,r)}case A.RemoveRowCommandId:{const S={startRow:t.params.range.startRow,endRow:Ie,startColumn:0,endColumn:Ie,rangeType:i.RANGE_TYPE.ROW};return this._checkRange([S],o,r)}case A.RemoveColCommandId:{const C=t.params.range.startColumn,S={startRow:0,endRow:Ie,startColumn:C,endColumn:Ie,rangeType:i.RANGE_TYPE.COLUMN};return this._checkRange([S],o,r)}case A.DeleteRangeMoveUpCommandId:case A.InsertRangeMoveDownCommandId:{const C=t.params.range||Tr(this._selectionManagerService)[0],S={startRow:C.startRow,startColumn:C.startColumn,endColumn:C.endColumn,endRow:Ie};return this._checkRange([S],o,r)}case A.DeleteRangeMoveLeftCommandId:case A.InsertRangeMoveRightCommandId:{const C=t.params.range||Tr(this._selectionManagerService)[0],S={startRow:C.startRow,startColumn:C.startColumn,endColumn:Ie,endRow:C.endRow};return this._checkRange([S],o,r)}case A.ReorderRangeCommandId:{const R=t,{range:C,order:S}=R.params,I=[];for(let v=C.startRow;v<=C.endRow;v++)v in S&&I.push({startRow:v,endRow:v,startColumn:C.startColumn,endColumn:C.endColumn});return this._checkRange(I,o,r)}}})()||[]).reduce((R,C)=>{const S=C(t);return R.push(S),R},[]).reduce((R,C)=>{var S,I;return R.redos.push(...C.redos),R.undos.push(...C.undos),R.preRedos.push(...(S=C.preRedos)!=null?S:[]),R.preUndos.push(...(I=C.preUndos)!=null?I:[]),R},{redos:[],undos:[],preUndos:[],preRedos:[]}),d=this.interceptor.fetchThroughInterceptors(this.interceptor.getInterceptPoints().MERGE_REDO)(u.preRedos,null)||[],c=this.interceptor.fetchThroughInterceptors(this.interceptor.getInterceptPoints().MERGE_REDO)(u.redos,null)||[],h=this.interceptor.fetchThroughInterceptors(this.interceptor.getInterceptPoints().MERGE_UNDO)(u.preUndos,null)||[],m=this.interceptor.fetchThroughInterceptors(this.interceptor.getInterceptPoints().MERGE_UNDO)(u.undos,null)||[];return{redos:c,undos:m,preRedos:d,preUndos:h}}})});f(this,"_checkRange",(t,n,o)=>{const r=Ur(n,o),a=this._refRangeManagerMap.get(r);if(a){const l=new Set;return[...a.keys()].forEach(d=>{const c=a.get(d),h=this._serializer.deserialize(d),m={...h,startRow:+h.startRow,endRow:+h.endRow,startColumn:+h.startColumn,endColumn:+h.endColumn,rangeType:h.rangeType&&+h.rangeType};t.some(R=>i.Rectangle.intersects(R,m))&&c&&c.forEach(R=>{l.add(R)})}),[...l]}return[]});f(this,"registerRefRange",(t,n,o,r)=>{const a=o||br(this._univerInstanceService),l=r||Er(this._univerInstanceService);if(!a||!l)return i.toDisposable(()=>{});const u=Ur(a,l),d=this._serializer.serialize(t);let c=this._refRangeManagerMap.get(u);c||(c=new Map,this._refRangeManagerMap.set(u,c));const h=c.get(d);return h?h.add(n):c.set(d,new Set([n])),i.toDisposable(()=>{const m=c.get(d);m&&(m.delete(n),m.size||(c.delete(d),c.size||this._refRangeManagerMap.delete(u)))})});this._commandService=t,this._sheetInterceptorService=n,this._univerInstanceService=o,this._selectionManagerService=r,this._onRefRangeChange(),this.interceptor.intercept(this.interceptor.getInterceptPoints().MERGE_REDO,{priority:-1,handler:a=>a}),this.interceptor.intercept(this.interceptor.getInterceptPoints().MERGE_UNDO,{priority:-1,handler:a=>a})}watchRange(t,n,o,r,a){let l;this._watchRanges.size===0&&(l=this._commandService.onCommandExecuted(h=>{if(h.type!==i.CommandType.MUTATION)return!1;for(const m of this._watchRanges)m.onMutation(h)}));const u=new lu(t,n,o,r,a);this._watchRanges.add(u);const d=i.toDisposable(()=>{this._watchRanges.delete(u),this._watchRanges.size===0&&(l==null||l.dispose(),l=null)}),c=this.disposeWithMe(d);return i.toDisposable(()=>{c.dispose(),d.dispose()})}},g.RefRangeService=ru([In(0,i.ICommandService),In(1,i.Inject(g.SheetInterceptorService)),In(2,i.Inject(i.IUniverInstanceService)),In(3,i.Inject(g.SheetsSelectionsService))],g.RefRangeService);function br(s){return s.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET).getUnitId()}function Er(s){var e;return(e=s.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:e.getSheetId()}function Tr(s){var e;return((e=s.getCurrentSelections())==null?void 0:e.map(t=>t.range))||[]}function Ur(s,e){return`${s}_${e}`}function uu(){const s=["startRow","startColumn","endRow","endColumn","rangeType"];return{deserialize:t=>{const n=s.reduce((r,a,l)=>(r[String(l)]=a,r),{});return t.split("_").reduce((r,a,l)=>{const u=String(l);return a&&n[u]&&(r[n[u]]=a),r},{})},serialize:t=>s.reduce((n,o,r)=>{const a=t[o];return a!==void 0?`${n}${r>0?"_":""}${a}`:`${n}`},"")}}var du=Object.getOwnPropertyDescriptor,cu=(s,e,t,n)=>{for(var o=n>1?void 0:n?du(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},Et=(s,e)=>(t,n)=>e(t,n,s);const hu=[ie.id,re.id,ne.id,ae.id],mu=[we.id,Me.id];function Ds(s,e){let t=s;if(e!==void 0){const n=[];for(let o=0;o<t.length;o++){const{startRow:r,endRow:a,startColumn:l,endColumn:u}=t[o];if(e===i.Dimension.ROWS)for(let d=r;d<=a;d++){const c={startRow:d,endRow:d,startColumn:l,endColumn:u};n.push(c)}else if(e===i.Dimension.COLUMNS)for(let d=l;d<=u;d++){const c={startRow:r,endRow:a,startColumn:d,endColumn:d};n.push(c)}}t=n}return t}const kr=i.createInterceptorKey("mergeCellPermissionCheck");g.MergeCellController=class extends i.Disposable{constructor(t,n,o,r,a,l){super();f(this,"disposableCollection",new i.DisposableCollection);f(this,"interceptor",new i.InterceptorManager({MERGE_CELL_INTERCEPTOR_CHECK:kr}));this._commandService=t,this._refRangeService=n,this._univerInstanceService=o,this._injector=r,this._sheetInterceptorService=a,this._selectionManagerService=l,this._onRefRangeChange(),this._initCommandInterceptor(),this._commandExecutedListener()}_initCommandInterceptor(){const t=this;this._sheetInterceptorService.interceptCommand({getMutations(n){var o;switch(n.id){case rn.id:case an.id:{const r=t._univerInstanceService.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET),a=r.getUnitId(),l=r==null?void 0:r.getActiveSheet();if(!l)return{redos:[],undos:[]};const u=l.getSheetId(),d=l.getConfig().mergeData,c=(o=t._selectionManagerService.getCurrentSelections())==null?void 0:o.map(h=>h.range);if(c&&c.length>0&&c.some(m=>d.some(R=>i.Rectangle.intersects(R,m)))){const m={unitId:a,subUnitId:u,ranges:c},R=le(t._injector,m),C=[{id:G.id,params:m}],S=[{id:j.id,params:R}];return{redos:C,undos:S}}}}return{redos:[],undos:[]}}}),this._sheetInterceptorService.interceptRanges({getMutations:({unitId:n,subUnitId:o,ranges:r})=>{const a=[],l=[],u={redos:a,undos:l};if(!r||!r.length)return u;const d=P(this._univerInstanceService,{unitId:n,subUnitId:o});if(!d)return u;const{worksheet:c}=d,m=c.getMergeData().filter(R=>r.some(C=>i.Rectangle.intersects(R,C)));return m.length?(a.push({id:G.id,params:{unitId:n,subUnitId:o,ranges:m}}),l.push({id:j.id,params:{unitId:n,subUnitId:o,ranges:m}}),{undos:l,redos:a}):u}})}refRangeHandle(t,n,o){switch(t.id){case A.MoveColsCommandId:{const r=t.params;return this._handleMoveColsCommand(r,n,o)}case A.MoveRowsCommandId:{const r=t.params;return this._handleMoveRowsCommand(r,n,o)}case ye.id:{const r=t.params,a=r.unitId||n,l=r.subUnitId||o;return this._handleInsertRowCommand(r,a,l)}case _e.id:{const r=t.params,a=r.unitId||n,l=r.subUnitId||o;return this._handleInsertColCommand(r,a,l)}case Ft.id:{const r=t.params;return this._handleRemoveColCommand(r,n,o)}case Ht.id:{const r=t.params;return this._handleRemoveRowCommand(r,n,o)}case Qe.id:{const r=t.params;return this._handleMoveRangeCommand(r,n,o)}case yt.id:{const r=t.params;return this._handleInsertRangeMoveRightCommand(r,n,o)}case et.id:{const r=t.params;return this._handleInsertRangeMoveDownCommand(r,n,o)}case ze.id:{const r=t.params;return this._handleDeleteRangeMoveUpCommand(r,n,o)}case Ge.id:{const r=t.params;return this._handleDeleteRangeMoveLeftCommand(r,n,o)}}return{redos:[],undos:[]}}_onRefRangeChange(){const t=(n,o)=>{const r=this._univerInstanceService.getUniverSheetInstance(n);if(!r)return;const a=r==null?void 0:r.getSheetBySheetId(o);if(!a)return;this.disposableCollection.dispose();const l=a.getMergeData(),u=d=>this.refRangeHandle(d,n,o);l.forEach(d=>{this.disposableCollection.add(this._refRangeService.registerRefRange(d,u,n,o))})};this.disposeWithMe(this._commandService.onCommandExecuted(n=>{if(n.id===Ze.id){const o=n.params,r=o.subUnitId,a=o.unitId;if(!r||!a)return;t(a,r)}if(n.id===j.id){const o=n.params,r=o.subUnitId,a=o.unitId;if(!r||!a)return;t(o.unitId,o.subUnitId)}})),this._univerInstanceService.getCurrentTypeOfUnit$(i.UniverInstanceType.UNIVER_SHEET).pipe(O.first(n=>!!n)).subscribe(n=>{const o=n.getActiveSheet();o&&t(n.getUnitId(),o.getSheetId())})}_handleMoveRowsCommand(t,n,o){const r=be(this._univerInstanceService,n);if(!r)return this._handleNull();const a=Ee(r,o);if(!a)return this._handleNull();const l=[...a.getMergeData()],u={unitId:n,subUnitId:o,ranges:[]},d={unitId:n,subUnitId:o,ranges:[]},{fromRange:c}=t,{startRow:h,endRow:m}=c;if(l.forEach(S=>{if(h<=S.startRow&&m>=S.endRow){u.ranges.push(S);const I=Us({id:A.MoveRowsCommandId,params:t},S),v=st(I,S);v&&d.ranges.push(v)}}),u.ranges.length===0)return this._handleNull();const R=le(this._injector,u),C=ge(this._injector,d);return{preRedos:[{id:G.id,params:u}],redos:[{id:j.id,params:d}],preUndos:[{id:G.id,params:C}],undos:[{id:j.id,params:R}]}}_handleMoveColsCommand(t,n,o){const r=be(this._univerInstanceService,n);if(!r)return this._handleNull();const a=Ee(r,o);if(!a)return this._handleNull();const l=[...a.getMergeData()],u={unitId:n,subUnitId:o,ranges:[]},d={unitId:n,subUnitId:o,ranges:[]},{fromRange:c}=t,{startColumn:h,endColumn:m}=c;if(l.forEach(S=>{if(h<=S.startColumn&&m>=S.endColumn){u.ranges.push(S);const I=ks({id:A.MoveColsCommandId,params:t},S),v=st(I,S);v&&d.ranges.push(v)}}),u.ranges.length===0)return this._handleNull();const R=le(this._injector,u),C=ge(this._injector,d);return{preRedos:[{id:G.id,params:u}],redos:[{id:j.id,params:d}],preUndos:[{id:G.id,params:C}],undos:[{id:j.id,params:R}]}}_handleMoveRangeCommand(t,n,o){const r=be(this._univerInstanceService,n);if(!r)return this._handleNull();const a=Ee(r,o);if(!a)return this._handleNull();const l=a.getMergeData(),u=l.filter(C=>i.Rectangle.intersects(C,t.fromRange)),d=l.filter(C=>i.Rectangle.intersects(C,t.toRange)),c=u.map(C=>i.Rectangle.getRelativeRange(C,t.fromRange)).map(C=>i.Rectangle.getPositionRange(C,t.toRange)),h=Ds(c).filter(C=>!l.some(S=>i.Rectangle.equals(C,S))),m=[{id:G.id,params:{unitId:n,subUnitId:o,ranges:u}},{id:G.id,params:{unitId:n,subUnitId:o,ranges:d}},{id:j.id,params:{unitId:n,subUnitId:o,ranges:h}}],R=[{id:G.id,params:{unitId:n,subUnitId:o,ranges:h}},{id:j.id,params:{unitId:n,subUnitId:o,ranges:d}},{id:j.id,params:{unitId:n,subUnitId:o,ranges:u}}];return{redos:m,undos:R}}_handleInsertRowCommand(t,n,o){const r=be(this._univerInstanceService,n);if(!r)return this._handleNull();const a=Ee(r,o);if(!a)return this._handleNull();const{range:l}=t,{startRow:u,endRow:d}=l,c=i.Tools.deepClone(a.getMergeData()).reduce((M,p)=>(u>p.startRow&&u<=p.endRow&&M.push(p),M),[]);if(c.length===0)return this._handleNull();const h=i.Tools.deepClone(a.getMergeData()).reduce((M,p)=>{if(u>p.startRow&&u<=p.endRow){const w=d-u+1;p.endRow+=w,this._checkIsMergeCell(p)&&M.push(p)}return M},[]),m={unitId:n,subUnitId:o,ranges:c},R=le(this._injector,m),C={unitId:n,subUnitId:o,ranges:h},S=ge(this._injector,C),I=[{id:G.id,params:m},{id:j.id,params:C}],v=[{id:G.id,params:S},{id:j.id,params:R}];return{redos:I,undos:v}}_handleInsertColCommand(t,n,o){const{range:r}=t,a=be(this._univerInstanceService,n);if(!a)return this._handleNull();const l=Ee(a,o);if(!l)return this._handleNull();const{startColumn:u,endColumn:d}=r,c=i.Tools.deepClone(l.getMergeData()).reduce((M,p)=>(u>p.startColumn&&u<=p.endColumn&&M.push(p),M),[]);if(c.length===0)return this._handleNull();const h=i.Tools.deepClone(l.getMergeData()).reduce((M,p)=>{if(u>p.startColumn&&u<=p.endColumn){const w=d-u+1;p.endColumn+=w,this._checkIsMergeCell(p)&&M.push(p)}return M},[]),m={unitId:n,subUnitId:o,ranges:c},R=le(this._injector,m),C={unitId:n,subUnitId:o,ranges:h},S=ge(this._injector,C),I=[{id:G.id,params:m},{id:j.id,params:C}],v=[{id:G.id,params:S},{id:j.id,params:R}];return{redos:I,undos:v}}_handleRemoveColCommand(t,n,o){const r=be(this._univerInstanceService,n);if(!r)return this._handleNull();const a=Ee(r,o);if(!a)return this._handleNull();const{range:l}=t,{startColumn:u,endColumn:d}=l,c=i.Tools.deepClone(a.getMergeData()).reduce((w,y)=>(i.Rectangle.intersects(l,y)&&w.push(y),w),[]);if(c.length===0)return this._handleNull();const h=i.Tools.deepClone(a.getMergeData()).reduce((w,y)=>{if(i.Rectangle.intersects(l,y)){if(u<=y.startColumn&&d>=y.endColumn)return w;u>=y.startColumn&&d<=y.endColumn?y.endColumn-=d-u+1:u<y.startColumn?(y.startColumn=u,y.endColumn-=d-u+1):d>y.endColumn&&(y.endColumn=u-1),this._checkIsMergeCell(y)&&w.push(y)}return w},[]),m={unitId:n,subUnitId:o,ranges:c},R=le(this._injector,m),C={unitId:n,subUnitId:o,ranges:h},S=ge(this._injector,C),I=[{id:G.id,params:m}],v=[{id:j.id,params:C}],M=[{id:G.id,params:S}],p=[{id:j.id,params:R}];return{preUndos:M,undos:p,preRedos:I,redos:v}}_handleRemoveRowCommand(t,n,o){const{range:r}=t,a=be(this._univerInstanceService,n);if(!a)return this._handleNull();const l=Ee(a,o);if(!l)return this._handleNull();const{startRow:u,endRow:d}=r,c=i.Tools.deepClone(l.getMergeData()).reduce((w,y)=>(i.Rectangle.intersects(r,y)&&w.push(y),w),[]);if(c.length===0)return this._handleNull();const h=i.Tools.deepClone(l.getMergeData()).reduce((w,y)=>{if(i.Rectangle.intersects(r,y)){if(u<=y.startRow&&d>=y.endRow)return w;u>=y.startRow&&d<=y.endRow?y.endRow-=d-u+1:u<y.startRow?(y.startRow=u,y.endRow-=d-u+1):d>y.endRow&&(y.endRow=u-1),this._checkIsMergeCell(y)&&w.push(y)}return w},[]),m={unitId:n,subUnitId:o,ranges:c},R=le(this._injector,m),C={unitId:n,subUnitId:o,ranges:h},S=ge(this._injector,C),I=[{id:G.id,params:m}],v=[{id:j.id,params:C}],M=[{id:G.id,params:S}],p=[{id:j.id,params:R}];return{preUndos:M,undos:p,preRedos:I,redos:v}}_handleInsertRangeMoveRightCommand(t,n,o){const r=be(this._univerInstanceService,n);if(!r)return this._handleNull();const a=Ee(r,o);if(!a)return this._handleNull();const l=t.range,u=a.getMaxColumns()-1,d=a.getMergeData(),c=[],h=[];d.forEach(I=>{const{startRow:v,endRow:M,startColumn:p,endColumn:w}=l;if(i.Rectangle.intersects({startRow:v,startColumn:p,endRow:M,endColumn:u},I)&&(c.push(I),i.Rectangle.contains({startRow:v,startColumn:p,endRow:M,endColumn:u},I))){const U=w-p+1;h.push({startRow:I.startRow,startColumn:I.startColumn+U,endRow:I.endRow,endColumn:I.endColumn+U})}});const m={unitId:n,subUnitId:o,ranges:c},R=le(this._injector,m),C={unitId:n,subUnitId:o,ranges:h},S=ge(this._injector,C);return{preRedos:[{id:G.id,params:m}],redos:[{id:j.id,params:C}],preUndos:[{id:G.id,params:S}],undos:[{id:j.id,params:R}]}}_handleInsertRangeMoveDownCommand(t,n,o){const r=be(this._univerInstanceService,n);if(!r)return this._handleNull();const a=Ee(r,o);if(!a)return this._handleNull();const l=t.range,u=a.getMaxRows()-1,d=a.getMergeData(),c=[],h=[];d.forEach(w=>{const{startRow:y,startColumn:b,endColumn:U,endRow:k}=l;if(i.Rectangle.intersects({startRow:y,startColumn:b,endRow:u,endColumn:U},w)&&(c.push(w),i.Rectangle.contains({startRow:y,startColumn:b,endRow:u,endColumn:U},w))){const N=k-y+1;h.push({startRow:w.startRow+N,startColumn:w.startColumn,endRow:w.endRow+N,endColumn:w.endColumn})}});const m={unitId:n,subUnitId:o,ranges:c},R=le(this._injector,m),C={unitId:n,subUnitId:o,ranges:h},S=ge(this._injector,C),I=[{id:G.id,params:m}],v=[{id:j.id,params:C}],M=[{id:G.id,params:S}],p=[{id:j.id,params:R}];return{redos:v,undos:p,preRedos:I,preUndos:M}}_handleDeleteRangeMoveUpCommand(t,n,o){const r=be(this._univerInstanceService,n);if(!r)return this._handleNull();const a=Ee(r,o);if(!a)return this._handleNull();const l=t.range,u=a.getMaxRows()-1,d=a.getMergeData(),c=[],h=[];d.forEach(w=>{const{startRow:y,startColumn:b,endColumn:U,endRow:k}=l;if(i.Rectangle.intersects({startRow:y,startColumn:b,endRow:u,endColumn:U},w)&&(c.push(w),i.Rectangle.contains({startRow:y,startColumn:b,endRow:u,endColumn:U},w))){const N=k-y+1,V=i.Rectangle.moveVertical(w,-N);h.push(V)}});const m={unitId:n,subUnitId:o,ranges:c},R=le(this._injector,m),C={unitId:n,subUnitId:o,ranges:h},S=ge(this._injector,C),I=[{id:G.id,params:m}],v=[{id:j.id,params:C}],M=[{id:G.id,params:S}],p=[{id:j.id,params:R}];return{redos:v,undos:p,preRedos:I,preUndos:M}}_handleDeleteRangeMoveLeftCommand(t,n,o){const r=be(this._univerInstanceService,n);if(!r)return this._handleNull();const a=Ee(r,o);if(!a)return this._handleNull();const l=t.range,u=a.getMaxColumns()-1,d=a.getMergeData(),c=[],h=[];d.forEach(I=>{const{startRow:v,endRow:M,startColumn:p,endColumn:w}=l;if(i.Rectangle.intersects({startRow:v,startColumn:p,endRow:M,endColumn:u},I)&&(c.push(I),i.Rectangle.contains({startRow:v,startColumn:p,endRow:M,endColumn:u},I))){const U=w-p+1;h.push({startRow:I.startRow,startColumn:I.startColumn-U,endRow:I.endRow,endColumn:I.endColumn-U})}});const m={unitId:n,subUnitId:o,ranges:c},R=le(this._injector,m),C={unitId:n,subUnitId:o,ranges:h},S=ge(this._injector,C);return{preRedos:[{id:G.id,params:m}],redos:[{id:j.id,params:C}],undos:[{id:j.id,params:R}],preUndos:[{id:G.id,params:S}]}}_checkIsMergeCell(t){return!(t.startRow===t.endRow&&t.startColumn===t.endColumn)}_handleNull(){return{redos:[],undos:[]}}_commandExecutedListener(){this.disposeWithMe(this._commandService.onCommandExecuted(t=>{if(mu.includes(t.id)){if(!t.params)return;const n=this._univerInstanceService.getUniverSheetInstance(t.params.unitId);if(!n)return;const o=n.getSheetBySheetId(t.params.subUnitId);if(!o)return;const{sourceRange:r,targetRange:a}=t.params,l=r.startColumn===a.startColumn&&r.endColumn===a.endColumn,u=l?r.endRow-r.startRow+1:r.endColumn-r.startColumn+1,d=l?r.startRow:r.startColumn,c=l?a.startRow:a.startColumn,h=o.getConfig().mergeData,m=[];h.forEach(I=>{let{startRow:v,endRow:M,startColumn:p,endColumn:w,rangeType:y}=I;i.Rectangle.intersects(I,r)||(l?d<v&&c>M?(v-=u,M-=u):d>M&&c<=v&&(v+=u,M+=u):d<p&&c>w?(p-=u,w-=u):d>w&&c<=p&&(p+=u,w+=u)),I.startRow===I.endRow&&I.startColumn===I.endColumn||m.push({startRow:v,endRow:M,startColumn:p,endColumn:w,rangeType:y})}),o.setMergeData(m),this.disposableCollection.dispose();const{unitId:R,subUnitId:C}=t.params,S=I=>this.refRangeHandle(I,R,C);m.forEach(I=>{this.disposableCollection.add(this._refRangeService.registerRefRange(I,S,R,C))})}if(hu.includes(t.id)){const n=this._univerInstanceService.getUniverSheetInstance(t.params.unitId);if(!n)return;const o=n.getSheetBySheetId(t.params.subUnitId);if(!o)return;const r=o.getConfig().mergeData,a=t.params;if(!a)return;const{range:l}=a,u=t.id.includes("row"),d=t.id.includes("insert"),c=u?l.startRow:l.startColumn,h=u?l.endRow:l.endColumn,m=h-c+1,R=[];r.forEach(v=>{let{startRow:M,endRow:p,startColumn:w,endColumn:y,rangeType:b}=v;d?u?c<=M&&(M+=m,p+=m):c<=w&&(w+=m,y+=m):u?h<M&&(M-=m,p-=m):h<w&&(w-=m,y-=m),v.startRow===v.endRow&&v.startColumn===v.endColumn||R.push({startRow:M,endRow:p,startColumn:w,endColumn:y,rangeType:b})}),o.setMergeData(R),this.disposableCollection.dispose();const{unitId:C,subUnitId:S}=t.params,I=v=>this.refRangeHandle(v,C,S);R.forEach(v=>{this.disposableCollection.add(this._refRangeService.registerRefRange(v,I,C,S))})}}))}},g.MergeCellController=cu([Et(0,i.Inject(i.ICommandService)),Et(1,i.Inject(g.RefRangeService)),Et(2,i.Inject(i.IUniverInstanceService)),Et(3,i.Inject(i.Injector)),Et(4,i.Inject(g.SheetInterceptorService)),Et(5,i.Inject(g.SheetsSelectionsService))],g.MergeCellController);function be(s,e){return e?s.getUniverSheetInstance(e):s.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET)}function Ee(s,e){return e?s.getSheetBySheetId(e):s.getActiveSheet()}const Pr=(s,e,t)=>{const o=s.get(g.SheetsSelectionsService).getCurrentSelections(),{value:r,selections:a,unitId:l,subUnitId:u}=e;if(o&&o.length>0){const c=o[(o==null?void 0:o.length)-1].primary;if(c){const{actualColumn:h,actualRow:m}=c;let{startRow:R,startColumn:C,endRow:S,endColumn:I}=a[a.length-1];if(r===i.Dimension.COLUMNS){const w=t.find(y=>y.startColumn===h&&y.endColumn===h&&m===y.startRow);w&&(I=w.endColumn,R=w.startRow,S=w.endRow)}else if(r===i.Dimension.ROWS){const w=t.find(y=>y.startRow===m&&y.endRow===m&&h===y.startColumn);w&&(S=w.endRow,C=w.startColumn,I=w.endColumn)}const v={startRow:R,startColumn:C,endRow:S,endColumn:I,actualRow:m,actualColumn:h,isMerged:!0,isMergedMainCell:R===m&&C===h},M=o.map((w,y,b)=>({range:w.range,style:null,primary:y===b.length-1?v:null})),p={unitId:l,subUnitId:u,type:Q.ONLY_SET,selections:M};return{id:q.id,params:p}}return null}return null},Nr=(s,e)=>{const n=s.get(g.SheetsSelectionsService).getCurrentSelections(),{unitId:o,subUnitId:r}=e;if(n&&n.length>0&&n[(n==null?void 0:n.length)-1].primary){const u={unitId:o,subUnitId:r,type:Q.ONLY_SET,selections:[...n]};return{id:q.id,params:u}}return null};function gu(s,e){return e.some(t=>Ru(s,t))}function Ru(s,e){const{startRow:t,startColumn:n,endColumn:o,endRow:r}=e,a=s.getMatrixWithMergedCells(t,n,r,o);let l=!1;return a.forValue((u,d,c)=>{if(c&&(u!==t||d!==n)&&s.cellHasValue(c))return l=!0,!1}),l}function Or(s,e,t,n){const o=[],r=[],a=t.getSheetId();return n.forEach(l=>{const u=Dr(t,l),d={unitId:e,subUnitId:a,cellValue:u.getData()},c=ce(s,d);o.push({id:F.id,params:c}),r.push({id:F.id,params:d})}),{undos:o,redos:r}}function Dr(s,e){const{startRow:t,startColumn:n,endColumn:o,endRow:r}=e,a=s.getMatrixWithMergedCells(t,n,r,o,i.CellModeEnum.Raw),l=new i.ObjectMatrix;let u=null;return a.forValue((d,c,h)=>{var m,R,C,S;h&&d>=t&&c>=n&&(!u&&s.cellHasValue(h)&&(h.v!==""||((S=(C=(R=(m=h.p)==null?void 0:m.body)==null?void 0:R.dataStream)==null?void 0:C.length)!=null?S:0)>2)&&(u=h),l.setValue(d,c,null))}),l.setValue(t,n,u),l}const ot={type:i.CommandType.COMMAND,id:"sheet.command.add-worksheet-merge",handler:async(s,e)=>{const t=s.get(i.IUniverInstanceService),n=P(t,e);if(!n)return!1;const{worksheet:o}=n,{unitId:r,subUnitId:a,selections:l}=e,u=s.get(i.ICommandService),d=s.get(i.IUndoRedoService),c=Ds(l,e.value),h=gu(o,c);if(h&&!e.defaultMerge){const U=s.get(i.IConfirmService),k=s.get(i.LocaleService);if(!await U.confirm({id:"merge.confirm.add-worksheet-merge",title:{title:"merge.confirm.warning"},children:{title:"merge.confirm.title"},cancelText:k.t("merge.confirm.cancel"),confirmText:k.t("merge.confirm.confirm")}))return!1}const m=[],R=[],C={unitId:r,subUnitId:a,ranges:i.Tools.deepClone(c)},S={unitId:r,subUnitId:a,ranges:i.Tools.deepClone(c)},I=le(s,C),v=ge(s,S);if(I.ranges.length>0&&m.push({id:G.id,params:I}),m.push({id:j.id,params:S}),R.push({id:G.id,params:v}),I.ranges.length>0&&R.push({id:j.id,params:I}),h){const U=Or(s,r,o,c);m.unshift(...U.redos),R.push(...U.undos)}const M=Pr(s,e,c);M&&m.push(M);const p=Nr(s,e);p&&R.push(p);const y=s.get(g.SheetInterceptorService).onCommandExecute({id:ot.id,params:{unitId:r,subUnitId:a,ranges:c}});return m.push(...y.redos),R.push(...y.undos),i.sequenceExecute(m,u).result?(d.pushUndoRedo({unitID:r,undoMutations:R,redoMutations:m}),!0):!1}},Ar={type:i.CommandType.COMMAND,id:"sheet.command.add-worksheet-merge-all",handler:async s=>{var c;const t=(c=s.get(g.SheetsSelectionsService).getCurrentSelections())==null?void 0:c.map(h=>h.range),n=As("mergeAll",t);if(!(n!=null&&n.length))return!1;const o=s.get(i.IUniverInstanceService),r=P(o);if(!r)return!1;const{worksheet:a}=r,l=a.getUnitId(),u=a.getSheetId();return s.get(i.ICommandService).executeCommand(ot.id,{selections:n,unitId:l,subUnitId:u})}},Wr={type:i.CommandType.COMMAND,id:"sheet.command.add-worksheet-merge-vertical",handler:async s=>{var c;const t=(c=s.get(g.SheetsSelectionsService).getCurrentSelections())==null?void 0:c.map(h=>h.range),n=As("mergeVertical",t);if(!(n!=null&&n.length))return!1;const o=s.get(i.IUniverInstanceService),r=P(o);if(!r)return!1;const{worksheet:a}=r,l=a.getUnitId(),u=a.getSheetId();return s.get(i.ICommandService).executeCommand(ot.id,{value:i.Dimension.COLUMNS,selections:n,unitId:l,subUnitId:u})}},Vr={type:i.CommandType.COMMAND,id:"sheet.command.add-worksheet-merge-horizontal",handler:async s=>{var h;const t=(h=s.get(g.SheetsSelectionsService).getCurrentSelections())==null?void 0:h.map(m=>m.range),n=As("mergeHorizontal",t);if(!(n!=null&&n.length))return!1;const o=s.get(i.IUniverInstanceService),r=P(o);if(!r)return!1;const{workbook:a,worksheet:l}=r,u=a.getUnitId(),d=l.getSheetId();return s.get(i.ICommandService).executeCommand(ot.id,{value:i.Dimension.ROWS,selections:n,unitId:u,subUnitId:d})}};function Cu(s,e,t,n,o){const r=s.get(i.IUniverInstanceService),a=P(r,{unitId:e,subUnitId:t});if(!a)return;const{worksheet:l}=a;if(l.getMergeData().some(h=>n.some(m=>i.Rectangle.intersects(m,h))))throw new Error("The ranges to be merged overlap with the existing merged cells");s.get(i.ICommandService).executeCommand(ot.id,{unitId:e,subUnitId:t,selections:n,defaultMerge:o})}function As(s,e){return e?s==="mergeAll"?e.filter(t=>!(t.startRow===t.endRow&&t.startColumn===t.endColumn)):s==="mergeVertical"?e.filter(t=>t.startRow!==t.endRow):s==="mergeHorizontal"?e.filter(t=>t.startColumn!==t.endColumn):e:null}class Ne{constructor(){f(this,"_model",new Map);f(this,"_ruleChange",new O.Subject);f(this,"_ruleRefresh",new O.Subject);f(this,"_resetOrder",new O.Subject);f(this,"ruleChange$",this._ruleChange.asObservable());f(this,"ruleRefresh$",this._ruleRefresh.asObservable());f(this,"resetOrder$",this._resetOrder.asObservable());f(this,"_worksheetRuleInitStateChange",new O.BehaviorSubject(!1));f(this,"worksheetRuleInitStateChange$",this._worksheetRuleInitStateChange.asObservable())}changeRuleInitState(e){this._worksheetRuleInitStateChange.next(e)}getSheetRuleInitState(){return this._worksheetRuleInitStateChange.value}addRule(e,t){this._ensureSubUnitMap(e).set(t.subUnitId,t),this._ruleChange.next({unitId:e,rule:t,type:"add",subUnitId:t.subUnitId})}deleteRule(e,t){var o,r,a;const n=(r=(o=this._model)==null?void 0:o.get(e))==null?void 0:r.get(t);n&&((a=this._model.get(e))==null||a.delete(t),this._ruleChange.next({unitId:e,rule:n,type:"delete",subUnitId:t}))}setRule(e,t,n){var r,a;const o=this.getRule(e,t);o&&((a=(r=this._model)==null?void 0:r.get(e))==null||a.set(t,n),this._ruleChange.next({unitId:e,oldRule:o,rule:n,type:"set",subUnitId:t}))}getRule(e,t){var n,o;return(o=(n=this._model)==null?void 0:n.get(e))==null?void 0:o.get(t)}toObject(){const e={};return[...this._model.keys()].forEach(n=>{const o=this._model.get(n);o!=null&&o.size&&(e[n]=[],[...o.keys()].forEach(a=>{const l=o.get(a);l&&e[n].push(l)}))}),e}fromObject(e){const t=new Map;Object.keys(e).forEach(n=>{const o=e[n];if(o!=null&&o.length){const r=new Map;o.forEach(a=>{r.set(a.subUnitId,a)}),t.set(n,r)}}),this._model=t}deleteUnitModel(e){this._model.delete(e)}_ensureSubUnitMap(e){let t=this._model.get(e);return t||(t=new Map,this._model.set(e,t)),t}ruleRefresh(e){this._ruleRefresh.next(e)}resetOrder(){this._resetOrder.next(Math.random())}getTargetByPermissionId(e,t){const n=this._model.get(e);if(!n)return null;for(const[o,r]of n)if(r.permissionId===t)return[e,o]}}const qe={id:"sheet.mutation.add-worksheet-protection",type:i.CommandType.MUTATION,handler:(s,e)=>{const t=s.get(Ne),{unitId:n,rule:o}=e;return t.addRule(n,o),!0}},rt={id:"sheet.mutation.delete-worksheet-protection",type:i.CommandType.MUTATION,handler:(s,e)=>{const t=s.get(Ne),{unitId:n,subUnitId:o}=e;return t.deleteRule(n,o),!0}},$r={type:i.CommandType.COMMAND,id:"sheet.command.add-worksheet-protection",async handler(s,e){if(!e)return!1;const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),{rule:o,unitId:r}=e,a=o.subUnitId;if(await t.executeCommand(qe.id,{unitId:r,rule:o,subUnitId:o.subUnitId})){const u=[{id:qe.id,params:{unitId:r,rule:o,subUnitId:o.subUnitId}}],d=[{id:rt.id,params:{unitId:r,subUnitId:a}}];n.pushUndoRedo({unitID:r,redoMutations:u,undoMutations:d})}return!0}},Lr={type:i.CommandType.COMMAND,id:"sheet.command.set-worksheet-range-theme-style",handler:(s,e)=>{const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),{unitId:o}=e,r=ho(s,e);return t.syncExecuteCommand(dt.id,e)?(n.pushUndoRedo({unitID:o,undoMutations:[{id:ct.id,params:r}],redoMutations:[{id:dt.id,params:e}]}),!0):!1}},Br={type:i.CommandType.COMMAND,id:"sheet.command.append-row",handler:(s,e)=>{const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),{unitId:o,subUnitId:r,cellValue:a,insertRowNums:l,insertColumnNums:u,maxRows:d,maxColumns:c}=e,h={unitId:o,subUnitId:r,cellValue:a},m=ce(s,h),R=[{id:F.id,params:h}],C=[{id:F.id,params:m}];if(l){const I={unitId:o,subUnitId:r,range:{startRow:d,endRow:d,startColumn:0,endColumn:c-1}},v=sn(s,I);R.unshift({id:re.id,params:I}),C.push({id:ae.id,params:v})}if(u){const I={unitId:o,subUnitId:r,range:{startRow:0,endRow:d-1,startColumn:c,endColumn:c-1+u}},v=At(s,I);R.unshift({id:ie.id,params:I}),C.push({id:ne.id,params:v})}return i.sequenceExecute(R,t).result?(n.pushUndoRedo({unitID:o,undoMutations:C,redoMutations:R}),!0):!1}},vn={id:"sheet.command.clear-selection-content",type:i.CommandType.COMMAND,handler:(s,e)=>{var p;const t=s.get(i.IUniverInstanceService),n=s.get(i.ICommandService),o=s.get(g.SheetsSelectionsService),r=s.get(i.IUndoRedoService),a=s.get(g.SheetInterceptorService),l=t.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET);if(!l)return!1;const u=(e==null?void 0:e.unitId)||l.getUnitId(),d=l.getActiveSheet();if(!d)return!1;const c=(e==null?void 0:e.subUnitId)||d.getSheetId(),h=(e==null?void 0:e.ranges)||((p=o.getCurrentSelections())==null?void 0:p.map(w=>w.range));if(!(h!=null&&h.length))return!1;const m=Vt(h,s,u,c),R={subUnitId:c,unitId:u,cellValue:Do(m)},C=ce(s,R),S=a.onCommandExecute({id:vn.id}),I=[{id:F.id,params:R},...S.redos],v=[...S.undos,{id:F.id,params:C}];return i.sequenceExecute(I,n).result?(r.pushUndoRedo({unitID:u,undoMutations:v,redoMutations:I}),!0):!1}},zt="sheets.config",Ws={largeSheetCellCountThreshold:6e3,batchSize:3e3},Hr={};var Su=Object.getOwnPropertyDescriptor,fu=(s,e,t,n)=>{for(var o=n>1?void 0:n?Su(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},Fr=(s,e)=>(t,n)=>e(t,n,s);g.SheetLazyExecuteScheduleService=class extends i.Disposable{constructor(t,n){super();f(this,"_tasks",new Map);f(this,"_idleCallbackId",null);f(this,"_beforeUnloadHandler",null);this._commandService=t,this._univerInstanceService=n,this._setupBeforeUnloadListener(),this.disposeWithMe(()=>{this._cancelAllTasks(),this._removeBeforeUnloadListener()})}hasPendingTasks(){return this._tasks.size>0}getPendingMutationsCount(){let t=0;for(const n of this._tasks.values())t+=n.mutations.length-n.currentIndex;return t}scheduleMutations(t,n,o){if(o.length===0)return;const r=`${t}_${n}`;this._cancelTask(r),this._tasks.set(r,{unitId:t,subUnitId:n,mutations:o,currentIndex:0}),this._scheduleNextIdle()}cancelScheduledMutations(t,n){const o=`${t}_${n}`;this._cancelTask(o)}_cancelTask(t){this._tasks.delete(t),this._tasks.size===0&&this._idleCallbackId!==null&&(typeof cancelIdleCallback<"u"&&cancelIdleCallback(this._idleCallbackId),this._idleCallbackId=null)}_cancelAllTasks(){this._tasks.clear(),this._idleCallbackId!==null&&(typeof cancelIdleCallback<"u"&&cancelIdleCallback(this._idleCallbackId),this._idleCallbackId=null)}_scheduleNextIdle(){this._idleCallbackId===null&&(typeof requestIdleCallback<"u"?this._idleCallbackId=requestIdleCallback(t=>this._processIdleTasks(t),{timeout:1e3*60}):this._idleCallbackId=setTimeout(()=>{this._processIdleTasks({didTimeout:!1,timeRemaining:()=>16})},16))}_processIdleTasks(t){this._idleCallbackId=null;for(const[n,o]of this._tasks){if(!this._isSheetExist(o.unitId,o.subUnitId)){this._tasks.delete(n);continue}for(o.currentIndex;o.currentIndex<o.mutations.length;){if(t.timeRemaining()<=0&&!t.didTimeout){this._scheduleNextIdle();return}const r=o.mutations[o.currentIndex];this._commandService.syncExecuteCommand(r.id,r.params,{onlyLocal:!0}),o.currentIndex++}this._tasks.delete(n)}this._tasks.size>0&&this._scheduleNextIdle()}_isSheetExist(t,n){const o=this._univerInstanceService.getUnit(t,i.UniverInstanceType.UNIVER_SHEET);return o?o.getSheetBySheetId(n)!==null:!1}_setupBeforeUnloadListener(){typeof window>"u"||(this._beforeUnloadHandler=t=>{if(this.hasPendingTasks())return t.preventDefault(),t.returnValue="",""},window.addEventListener("beforeunload",this._beforeUnloadHandler))}_removeBeforeUnloadListener(){typeof window>"u"||!this._beforeUnloadHandler||(window.removeEventListener("beforeunload",this._beforeUnloadHandler),this._beforeUnloadHandler=null)}},g.SheetLazyExecuteScheduleService=fu([Fr(0,i.ICommandService),Fr(1,i.IUniverInstanceService)],g.SheetLazyExecuteScheduleService);const Vs={id:"sheet.mutation.copy-worksheet-end",type:i.CommandType.MUTATION,handler:()=>!0},$s=(s,e)=>({subUnitId:e.sheet.id,unitId:e.unitId,subUnitName:e.sheet.name}),it={id:"sheet.mutation.insert-sheet",type:i.CommandType.MUTATION,handler:(s,e)=>{const t=s.get(i.IUniverInstanceService),{sheet:n,index:o,unitId:r,styles:a}=e,l=t.getUniverSheetInstance(r);return l?(a&&l.addStyles(a),l.addWorksheet(n.id,o,i.cloneWorksheetData(n))):!1}};function Iu(s){let e=0;for(const t of Object.keys(s)){const n=s[Number(t)];n&&(e+=Object.keys(n).length)}return e}function vu(s,e,t,n){const o=[];let r={},a=0;for(const d in t){const c=Number(d),h=t[c];if(!h)continue;const m=Object.keys(h).length;a>0&&a+m>n&&(o.push(r),r={},a=0),r[c]=h,a+=m,a>=n&&(o.push(r),r={},a=0)}a>0&&o.push(r);const l=o.length>0?o[0]:{},u=o.slice(1).map(d=>({id:F.id,params:{unitId:s,subUnitId:e,cellValue:d,__splitChunk__:!0}}));return{firstChunkCellData:l,remainingMutations:u}}const jr="sheet.command.copy-sheet";function pu(s,e,t,n,o,r,a){var b,U;const u=s.get(i.IConfigService).getConfig(zt),d={...Ws,...u==null?void 0:u.largeSheetOperation},c=i.cloneWorksheetData(t.getConfig());c.name=wu(e,r,c.name);const h=i.generateRandomId();c.id=h;const m=e.getSheetIndex(t),{cellData:R}=c,S=Iu(R)>=d.largeSheetCellCountThreshold;let I,v=[];if(S){const{firstChunkCellData:k,remainingMutations:T}=vu(n,h,R,d.batchSize),E={...c,cellData:k};I={index:m+1,sheet:E,unitId:n},v=T}else I={index:m+1,sheet:c,unitId:n};const M=$s(s,I),p=a.onCommandExecute({id:jr,params:{unitId:n,subUnitId:o,targetSubUnitId:c.id}}),w=[...(b=p.preRedos)!=null?b:[],{id:it.id,params:I},...p.redos],y=[...(U=p.preUndos)!=null?U:[],{id:He.id,params:M},...p.undos];return{redos:w,undos:y,unitId:n,newSheetId:h,isSplit:S,scheduledMutations:v}}const Gr={type:i.CommandType.COMMAND,id:jr,handler:(s,e)=>{const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),o=s.get(i.IUniverInstanceService),r=s.get(g.SheetInterceptorService),a=s.get(i.LocaleService),l=s.get(g.SheetLazyExecuteScheduleService),u=P(o,e);if(!u)return!1;const{workbook:d,worksheet:c,unitId:h,subUnitId:m}=u,{redos:R,undos:C,newSheetId:S,isSplit:I,scheduledMutations:v}=pu(s,d,c,h,m,a,r);if(i.sequenceExecute(R,t).result){if(I){if(n.pushUndoRedo({unitID:h,undoMutations:C,redoMutations:[]}),v.length>0){for(const p of v)t.syncExecuteCommand(p.id,p.params,{syncOnly:!0});t.syncExecuteCommand(Vs.id,{unitId:h,subUnitId:S},{syncOnly:!0}),l.scheduleMutations(h,S,v)}}else n.pushUndoRedo({unitID:h,undoMutations:C,redoMutations:R});return!0}return!1}};function wu(s,e,t){let n=`${t} ${e.t("sheets.tabs.sheetCopy","")}`,o=2;for(;s.checkSheetName(n);)n=`${t} ${e.t("sheets.tabs.sheetCopy",`${o}`)}`,o++;return n}const zr={type:i.CommandType.COMMAND,id:"sheet.command.delete-range-protection",async handler(s,e){if(!e)return!1;const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),{unitId:o,subUnitId:r,rule:a}=e,l={unitId:o,subUnitId:r,ruleIds:[a.id]};return await t.executeCommand(Ue.id,l)&&n.pushUndoRedo({unitID:o,redoMutations:[{id:Ue.id,params:l}],undoMutations:[{id:Ce.id,params:{unitId:o,subUnitId:r,rules:[a]}}]}),!0}},qr={type:i.CommandType.COMMAND,id:"sheet.command.delete-worksheet-protection",handler(s,e){if(!e)return!1;const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),{rule:o,unitId:r,subUnitId:a}=e;t.executeCommand(rt.id,{unitId:r,subUnitId:a});const l=[{id:rt.id,params:{unitId:r,subUnitId:a}}],u=[{id:qe.id,params:{unitId:r,rule:o,subUnitId:a}}];return n.pushUndoRedo({unitID:r,redoMutations:l,undoMutations:u}),!0}},Yr={type:i.CommandType.COMMAND,id:"sheet.command.remove-worksheet-range-theme-style",handler:(s,e)=>{const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),{unitId:o}=e,r=mo(s,e);return t.syncExecuteCommand(ct.id,e)?(n.pushUndoRedo({unitID:o,undoMutations:[{id:dt.id,params:r}],redoMutations:[{id:ct.id,params:e}]}),!0):!1}},xr={id:"sheet.command.insert-defined-name",type:i.CommandType.COMMAND,handler:(s,e)=>{const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService);if(!e)return!1;const o={...e};return t.syncExecuteCommand(K.SetDefinedNameMutation.id,o)?(n.pushUndoRedo({unitID:e.unitId,undoMutations:[{id:K.RemoveDefinedNameMutation.id,params:o}],redoMutations:[{id:K.SetDefinedNameMutation.id,params:o}]}),!0):!1}},Kr={id:"sheet.command.insert-sheet",type:i.CommandType.COMMAND,handler:(s,e)=>{var I;const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),o=s.get(i.IUniverInstanceService),r=s.get(i.LocaleService),a=jn(o,{unitId:e==null?void 0:e.unitId});if(!a)return!1;const{unitId:l,workbook:u}=a;let d=u.getSheets().length;const c=e==null?void 0:e.sheet,h=c==null?void 0:c.id,m=i.mergeWorksheetSnapshotWithDefault(c||{});e?(d=(I=e.index)!=null?I:d,m.id=h||i.generateRandomId(),m.name=(c==null?void 0:c.name)||u.generateNewSheetName(`${r.t("sheets.tabs.sheet")}`)):(m.id=i.generateRandomId(),m.name=u.generateNewSheetName(`${r.t("sheets.tabs.sheet")}`));const R={index:d,sheet:m,unitId:l},C=$s(s,R);return t.syncExecuteCommand(it.id,R)?(n.pushUndoRedo({unitID:l,undoMutations:[{id:He.id,params:C}],redoMutations:[{id:it.id,params:R}]}),!0):!1}},Tt={id:"sheet.mutation.register-worksheet-range-theme-style",type:i.CommandType.MUTATION,handler:(s,e)=>{if(!P(s.get(i.IUniverInstanceService),e))return!1;const n=s.get(g.SheetRangeThemeModel),{unitId:o,rangeThemeStyleJson:r,themeName:a}=e,l=new $e(a,r);return n.registerRangeThemeStyle(o,l),!0}},pn={id:"sheet.mutation.unregister-worksheet-range-theme-style",type:i.CommandType.MUTATION,handler:(s,e)=>{if(!P(s.get(i.IUniverInstanceService),e))return!1;const n=s.get(g.SheetRangeThemeModel),{unitId:o,themeName:r}=e;return n.unregisterRangeThemeStyle(o,r),!0}},Jr={id:"sheet.command.register-worksheet-range-theme-style",type:i.CommandType.COMMAND,handler:(s,e)=>{if(!e)return!1;const{unitId:t,rangeThemeStyle:n}=e,o=s.get(i.IUniverInstanceService),r=s.get(i.ICommandService),a=s.get(i.IUndoRedoService);if(!P(o,e))return!1;const u={unitId:t,themeName:n.getName(),rangeThemeStyleJson:n.toJson()},d={unitId:t,themeName:n.getName()};return r.syncExecuteCommand(Tt.id,u)&&a.pushUndoRedo({unitID:t,undoMutations:[{id:pn.id,params:d}],redoMutations:[{id:Tt.id,params:u}]}),!0}},Ls={id:"sheet.command.remove-defined-name",type:i.CommandType.COMMAND,handler:(s,e)=>{var c,h;const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),o=s.get(g.SheetInterceptorService);if(!e)return!1;const r={...e},a=o.onCommandExecute({id:Ls.id,params:e}),l=[...(c=a.preRedos)!=null?c:[],{id:K.RemoveDefinedNameMutation.id,params:r},...a.redos],u=[...(h=a.preUndos)!=null?h:[],{id:K.SetDefinedNameMutation.id,params:r},...a.undos];return i.sequenceExecute(l,t)?(n.pushUndoRedo({unitID:e.unitId,undoMutations:u.filter(Boolean),redoMutations:l.filter(Boolean)}),!0):!1}},wn={id:"sheet.command.remove-sheet",type:i.CommandType.COMMAND,handler:(s,e)=>{var b,U;const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),o=s.get(i.IUniverInstanceService),r=s.get(g.SheetInterceptorService),a=s.get(i.IConfigService),l=P(o,e);if(!l)return!1;const{unitId:u,subUnitId:d,workbook:c,worksheet:h}=l;if(c.getSheets().length<=1)return!1;const m=a.getConfig(zt),R={...Ws,...m==null?void 0:m.largeSheetOperation},S=gr(h.getCellMatrix())>=R.largeSheetCellCountThreshold,I={subUnitId:d,unitId:u,subUnitName:h.getName()},v=S?null:dr(s,I),M=r.onCommandExecute({id:wn.id,params:{unitId:u,subUnitId:d}}),p=[...(b=M.preRedos)!=null?b:[],{id:He.id,params:I},...M.redos],w=S?[]:[...(U=M.preUndos)!=null?U:[],{id:it.id,params:v},...M.undos];return i.sequenceExecute(p,t).result?(S?n.clearUndoRedo(u):n.pushUndoRedo({unitID:u,undoMutations:w,redoMutations:p}),!0):!1}},Xr={type:i.CommandType.COMMAND,id:"sheet.command.remove-worksheet-merge",handler:(s,e)=>{var k;const t=s.get(g.SheetsSelectionsService),n=s.get(i.ICommandService),o=s.get(i.IUndoRedoService),r=s.get(i.IUniverInstanceService),a=(e==null?void 0:e.ranges)||((k=t.getCurrentSelections())==null?void 0:k.map(T=>T.range));if(!(a!=null&&a.length))return!1;const l=P(r);if(!l)return!1;const{subUnitId:u,unitId:d,worksheet:c}=l,h={unitId:d,subUnitId:u,ranges:a},R=c.getConfig().mergeData.filter(T=>a.some(E=>i.Rectangle.intersects(E,T)));if(!R.length)return!1;const C=le(s,h),S=t.getCurrentSelections(),I=i.Tools.deepClone(S),v=i.Tools.deepClone(S);if(S.length){const T=v[v.length-1],{startRow:E,startColumn:N}=T.range;T.primary={startRow:E,startColumn:N,endRow:E,endColumn:N,actualRow:E,actualColumn:N,isMerged:!1,isMergedMainCell:!1}}const M=Mu(c,R),p={unitId:d,subUnitId:u,cellValue:M.redoParams.getMatrix()},w={unitId:d,subUnitId:u,cellValue:M.undoParams.getMatrix()},y=[{id:G.id,params:C},{id:F.id,params:p},{id:q.id,params:{unitId:d,subUnitId:u,selections:v,type:Q.ONLY_SET}}],b=[{id:j.id,params:C},{id:F.id,params:w},{id:q.id,params:{unitId:d,subUnitId:u,selections:I,type:Q.ONLY_SET}}];return i.sequenceExecute(y,n)?(o.pushUndoRedo({unitID:d,undoMutations:b,redoMutations:y}),!0):!1}};function Mu(s,e){const t=new i.ObjectMatrix,n=new i.ObjectMatrix;return e.forEach(o=>{const{startRow:r,startColumn:a,endColumn:l,endRow:u}=o,d=s.getCellMatrix().getValue(r,a);if(d!=null&&d.s)for(let c=r;c<=u;c++)for(let h=a;h<=l;h++)(c!==r||h!==a)&&(t.setValue(c,h,{s:d.s}),n.setValue(c,h,null))}),{redoParams:t,undoParams:n}}class at{constructor(){f(this,"_borderInfo",{type:i.BorderType.ALL,color:"#000000",style:i.BorderStyleTypes.THIN,activeBorderType:!1});f(this,"_borderInfo$",new O.BehaviorSubject(this._borderInfo));f(this,"borderInfo$",this._borderInfo$.asObservable())}dispose(){this._borderInfo$.complete()}setType(e){this._borderInfo.type=e,this.setActiveBorderType(!0),this._refresh()}setColor(e){this._borderInfo.color=e,this._refresh()}setStyle(e){this._borderInfo.style=e,this._refresh()}setActiveBorderType(e){this._borderInfo.activeBorderType=e}getBorderInfo(){return this._borderInfo}_refresh(){this._borderInfo$.next(this._borderInfo)}}function Mn(s,e){const{startRow:t,startColumn:n,endRow:o,endColumn:r}=s;for(let a=t;a<=o;a++)for(let l=n;l<=r;l++)e(a,l)}const Bs=(s,e,t,n)=>{const{mr:o,worksheet:r}=s;e.startRow<0||e.startColumn<0||Mn(e,(a,l)=>{var c,h;const u=r.getMergedCell(a,l);let d=t;if(u&&(t.bc_tr||t.ml_tr||t.bl_tr||t.tl_mr||t.tl_bc||t.tl_br)){if(n){const m=i.Tools.deepClone((c=o.getValue(u.startRow,u.startColumn))==null?void 0:c.s);d=m!=null&&m.bd?Object.assign(m.bd,t):t}o.setValue(u.startRow,u.startColumn,{s:{bd:d}})}else{if(n){const m=i.Tools.deepClone((h=o.getValue(a,l))==null?void 0:h.s);d=m!=null&&m.bd?Object.assign(m.bd,t):t}o.setValue(a,l,{s:{bd:d}})}})},yu=s=>{const e={startRow:s.startRow-1,startColumn:s.startColumn,endRow:s.startRow-1,endColumn:s.endColumn},t={startRow:s.startRow,startColumn:s.startColumn-1,endRow:s.endRow,endColumn:s.startColumn-1},n={startRow:s.endRow+1,startColumn:s.startColumn,endRow:s.endRow+1,endColumn:s.endColumn},o={startRow:s.startRow,startColumn:s.endColumn+1,endRow:s.endRow,endColumn:s.endColumn+1},r={startRow:s.startRow,startColumn:s.startColumn,endRow:s.startRow,endColumn:s.endColumn},a={startRow:s.startRow,startColumn:s.startColumn,endRow:s.endRow,endColumn:s.startColumn},l={startRow:s.endRow,startColumn:s.startColumn,endRow:s.endRow,endColumn:s.endColumn},u={startRow:s.startRow,startColumn:s.endColumn,endRow:s.endRow,endColumn:s.endColumn};return{topRangeOut:e,leftRangeOut:t,bottomRangeOut:n,rightRangeOut:o,topRange:r,leftRange:a,bottomRange:l,rightRange:u}};function _u(s,e,t){const{style:n,color:o,type:r}=s.getBorderInfo(),a=r===i.BorderType.TOP||r===i.BorderType.ALL||r===i.BorderType.OUTSIDE,l=r===i.BorderType.LEFT||r===i.BorderType.ALL||r===i.BorderType.OUTSIDE,u=r===i.BorderType.BOTTOM||r===i.BorderType.ALL||r===i.BorderType.OUTSIDE,d=r===i.BorderType.RIGHT||r===i.BorderType.ALL||r===i.BorderType.OUTSIDE,c=r===i.BorderType.VERTICAL||r===i.BorderType.ALL||r===i.BorderType.INSIDE,h=r===i.BorderType.HORIZONTAL||r===i.BorderType.ALL||r===i.BorderType.INSIDE,m=r.indexOf("tlbr")>-1,R=r.indexOf("tlbc")>-1,C=r.indexOf("tlmr")>-1,S=r.indexOf("bltr")>-1,I=r.indexOf("mltr")>-1,v=r.indexOf("bctr")>-1,M=t[0],{topRangeOut:p,leftRangeOut:w,bottomRangeOut:y,rightRangeOut:b,topRange:U,leftRange:k,bottomRange:T,rightRange:E}=yu(M),N=new i.ObjectMatrix,{worksheet:V,unitId:W,subUnitId:$}=e;return{worksheet:V,unitId:W,subUnitId:$,style:n,color:o,type:r,top:a,left:l,right:d,bottom:u,vertical:c,horizontal:h,tl_br:m,tl_bc:R,tl_mr:C,bl_tr:S,ml_tr:I,bc_tr:v,topRangeOut:p,leftRangeOut:w,bottomRangeOut:y,rightRangeOut:b,topRange:U,leftRange:k,bottomRange:T,rightRange:E,range:M,mr:N,borderStyle:{s:n,cl:{rgb:o}}}}const bu=s=>{const{range:e,mr:t,borderStyle:n,vertical:o,horizontal:r,worksheet:a}=s;o&&Mn(e,(l,u)=>{var c,h,m;const d=a.getMergedCell(l,u);if(d){const R=(c=t.getValue(d.startRow,d.startColumn))==null?void 0:c.s;d.startColumn!==e.startColumn&&t.setValue(l,u,{s:{bd:R!=null&&R.bd?Object.assign(R.bd,{l:i.Tools.deepClone(n)}):{l:i.Tools.deepClone(n)}}})}else{if(u!==e.endColumn){const R=(h=t.getValue(l,u))==null?void 0:h.s;t.setValue(l,u,{s:{bd:R!=null&&R.bd?Object.assign(R.bd,{r:i.Tools.deepClone(n)}):{r:i.Tools.deepClone(n)}}})}if(u!==e.startColumn){const R=(m=t.getValue(l,u))==null?void 0:m.s;t.setValue(l,u,{s:{bd:R!=null&&R.bd?Object.assign(R.bd,{l:i.Tools.deepClone(n)}):{l:i.Tools.deepClone(n)}}})}}}),r&&Mn(e,(l,u)=>{var c,h,m;const d=a.getMergedCell(l,u);if(d){const R=(c=t.getValue(d.startRow,d.startColumn))==null?void 0:c.s;d.startRow!==e.startRow&&t.setValue(l,u,{s:{bd:R!=null&&R.bd?Object.assign(R.bd,{t:i.Tools.deepClone(n)}):{t:i.Tools.deepClone(n)}}})}else{if(l!==e.endRow){const R=(h=t.getValue(l,u))==null?void 0:h.s;t.setValue(l,u,{s:{bd:R!=null&&R.bd?Object.assign(R.bd,{b:i.Tools.deepClone(n)}):{b:i.Tools.deepClone(n)}}})}if(l!==e.startRow){const R=(m=t.getValue(l,u))==null?void 0:m.s;t.setValue(l,u,{s:{bd:R!=null&&R.bd?Object.assign(R.bd,{t:i.Tools.deepClone(n)}):{t:i.Tools.deepClone(n)}}})}}})};function Eu(s){const{borderStyle:e,tl_br:t,tl_bc:n,tl_mr:o,bl_tr:r,ml_tr:a,bc_tr:l}=s,u=(d,c,h)=>{Bs(s,d,c,h)};t&&u(s.range,{tl_br:i.Tools.deepClone(e)},!0),n&&u(s.range,{tl_bc:i.Tools.deepClone(e)},!0),o&&u(s.range,{tl_mr:i.Tools.deepClone(e)},!0),r&&u(s.range,{bl_tr:i.Tools.deepClone(e)},!0),a&&u(s.range,{ml_tr:i.Tools.deepClone(e)},!0),l&&u(s.range,{bc_tr:i.Tools.deepClone(e)},!0)}const Tu=s=>{const{top:e,left:t,right:n,bottom:o,borderStyle:r,bottomRange:a,topRange:l,leftRange:u,rightRange:d,bottomRangeOut:c,topRangeOut:h,leftRangeOut:m,rightRangeOut:R}=s,C=(S,I,v)=>{Bs(s,S,I,v)};e&&(C(h,{b:null}),C(l,{t:i.Tools.deepClone(r)},!0)),o&&(C(c,{t:null}),C(a,{b:i.Tools.deepClone(r)},!0)),t&&(C(m,{r:null}),C(u,{l:i.Tools.deepClone(r)},!0)),n&&(C(R,{l:null}),C(d,{r:i.Tools.deepClone(r)},!0))},Uu=s=>{const{range:e,worksheet:t,mr:n,top:o,bottom:r,left:a,right:l,vertical:u,horizontal:d,tl_br:c,tl_bc:h,tl_mr:m,bl_tr:R,ml_tr:C,bc_tr:S,topRange:I,bottomRange:v,leftRange:M,rightRange:p,topRangeOut:w,bottomRangeOut:y,leftRangeOut:b,rightRangeOut:U}=s,k=(T,E,N)=>{Bs(s,T,E,N)};!o&&!r&&!a&&!l&&!u&&!d&&!c&&!h&&!m&&!R&&!C&&!S&&(Mn(e,(T,E)=>{var V,W,$,L,Y,z,x,oe;const N=t.getMergedCell(T,E);if(N){if(N.endColumn!==e.endColumn){const H=(V=n.getValue(N.startRow,N.startColumn))==null?void 0:V.s;n.setValue(T,E,{s:{bd:H!=null&&H.bd?Object.assign(H.bd,{r:null}):{r:null}}})}if(N.startColumn!==e.startColumn){const H=(W=n.getValue(N.startRow,N.startColumn))==null?void 0:W.s;n.setValue(T,E,{s:{bd:H!=null&&H.bd?Object.assign(H.bd,{l:null}):{l:null}}})}if(N.endRow!==e.endRow){const H=($=n.getValue(N.startRow,N.startColumn))==null?void 0:$.s;n.setValue(T,E,{s:{bd:H!=null&&H.bd?Object.assign(H.bd,{b:null}):{b:null}}})}if(N.startRow!==e.startRow){const H=(L=n.getValue(N.startRow,N.startColumn))==null?void 0:L.s;n.setValue(T,E,{s:{bd:H!=null&&H.bd?Object.assign(H.bd,{t:null}):{t:null}}})}}else{if(E!==e.endColumn){const H=(Y=n.getValue(T,E))==null?void 0:Y.s;n.setValue(T,E,{s:{bd:H!=null&&H.bd?Object.assign(H.bd,{r:null}):{r:null}}})}if(E!==e.startColumn){const H=(z=n.getValue(T,E))==null?void 0:z.s;n.setValue(T,E,{s:{bd:H!=null&&H.bd?Object.assign(H.bd,{l:null}):{l:null}}})}if(T!==e.endRow){const H=(x=n.getValue(T,E))==null?void 0:x.s;n.setValue(T,E,{s:{bd:H!=null&&H.bd?Object.assign(H.bd,{b:null}):{b:null}}})}if(T!==e.startRow){const H=(oe=n.getValue(T,E))==null?void 0:oe.s;n.setValue(T,E,{s:{bd:H!=null&&H.bd?Object.assign(H.bd,{t:null}):{t:null}}})}}}),k(w,{b:null}),k(I,{t:null},!0),k(y,{t:null}),k(v,{b:null},!0),k(b,{r:null}),k(M,{l:null},!0),k(U,{l:null}),k(p,{r:null},!0),k(e,{tl_br:null},!0),k(e,{tl_bc:null},!0),k(e,{tl_mr:null},!0),k(e,{bl_tr:null},!0),k(e,{ml_tr:null},!0),k(e,{bc_tr:null},!0))},Ut={id:"sheet.command.set-border",type:i.CommandType.COMMAND,handler:(s,e)=>{var v;const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),o=s.get(i.IUniverInstanceService),r=s.get(g.SheetsSelectionsService),a=s.get(at),l=P(o,e);if(!l)return!1;const u=(e==null?void 0:e.ranges)||((v=r.getCurrentSelections())==null?void 0:v.map(M=>M.range));if(!(u!=null&&u.length))return!1;const{activeBorderType:d}=a.getBorderInfo();if(!d)return!1;const c=_u(a,l,u);bu(c),Tu(c),Eu(c),Uu(c);const{unitId:h,subUnitId:m,mr:R}=c,C={unitId:h,subUnitId:m,cellValue:R.getData()},S=ce(s,C);return t.syncExecuteCommand(F.id,C)?(n.pushUndoRedo({unitID:h,undoMutations:[{id:F.id,params:S}],redoMutations:[{id:F.id,params:C}]}),!0):!1}},Zr={id:"sheet.command.set-border-position",type:i.CommandType.COMMAND,handler:(s,e)=>{if(!e.value)return!1;const t=s.get(i.ICommandService);return s.get(at).setType(e.value),t.syncExecuteCommand(Ut.id)}},Qr={id:"sheet.command.set-border-style",type:i.CommandType.COMMAND,handler:(s,e)=>{const t=s.get(i.ICommandService);return s.get(at).setStyle(e.value),t.syncExecuteCommand(Ut.id)}},ei={id:"sheet.command.set-border-color",type:i.CommandType.COMMAND,handler:(s,e)=>{const t=s.get(i.ICommandService);return s.get(at).setColor(e.value),t.syncExecuteCommand(Ut.id)}},ti={id:"sheet.command.set-border-basic",type:i.CommandType.COMMAND,handler:(s,e)=>{const{unitId:t,subUnitId:n,value:o,ranges:r}=e,{type:a,color:l,style:u}=o,d=s.get(i.ICommandService),c=s.get(at);return c.setType(a),l&&c.setColor(l),c.setStyle(u),d.syncExecuteCommand(Ut.id,{unitId:t,subUnitId:n,ranges:r})}},ni={type:i.CommandType.COMMAND,id:"sheet.command.set-col-data",handler:(s,e)=>{const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),o=s.get(i.IUniverInstanceService),r=P(o,e);if(!r)return!1;const{columnData:a}=e,{unitId:l,subUnitId:u,worksheet:d}=r,c={subUnitId:u,unitId:l,columnData:a},h=So(c,d);return t.syncExecuteCommand(ht.id,c)?(n.pushUndoRedo({unitID:l,undoMutations:[{id:ht.id,params:h}],redoMutations:[{id:ht.id,params:c}]}),!0):!1}},kt={type:i.CommandType.COMMAND,id:"sheet.command.set-col-visible-on-cols",handler:(s,e)=>{var v,M;const{unitId:t,subUnitId:n,ranges:o}=e,r=s.get(g.SheetInterceptorService),a=s.get(i.ICommandService),l=s.get(i.IUniverInstanceService),u=P(l,{unitId:t,subUnitId:n});if(!u)return!1;const{worksheet:d}=u,c={unitId:t,subUnitId:n,ranges:o},h={unitId:t,subUnitId:n,reveal:!0,selections:o.map(p=>({range:p,primary:se(p,d),style:null}))},m=ka(s,c),R={unitId:t,subUnitId:n,selections:si(o).map(p=>({range:p,primary:se(p,d),style:null}))},C=i.sequenceExecute([{id:gt.id,params:c},{id:q.id,params:h}],a),S=r.onCommandExecute({id:kt.id,params:e}),I=i.sequenceExecute([...S.redos],a);if(C.result&&I.result){const p=r.afterCommandExecute({id:kt.id,params:e});return i.sequenceExecute(p.redos,a),s.get(i.IUndoRedoService).pushUndoRedo({unitID:t,undoMutations:[{id:mt.id,params:m},{id:q.id,params:R},...(v=S.undos)!=null?v:[],...p.undos],redoMutations:[...(M=S.preRedos)!=null?M:[],{id:gt.id,params:c},{id:q.id,params:h},...S.redos,...p.redos]}),!0}return!0}},Hs={type:i.CommandType.COMMAND,id:"sheet.command.set-selected-cols-visible",handler:s=>{var d;const e=s.get(g.SheetsSelectionsService),t=s.get(i.ICommandService),n=(d=e.getCurrentSelections())==null?void 0:d.map(c=>c.range).filter(c=>c.rangeType===i.RANGE_TYPE.COLUMN);if(!(n!=null&&n.length))return!1;const o=P(s.get(i.IUniverInstanceService));if(!o)return!1;const{worksheet:r,unitId:a,subUnitId:l}=o,u=n.map(c=>r.getHiddenCols(c.startColumn,c.endColumn)).flat();return t.executeCommand(kt.id,{unitId:a,subUnitId:l,ranges:u})}},yn={type:i.CommandType.COMMAND,id:"sheet.command.set-col-hidden",handler:(s,e)=>{var M,p,w,y;const t=s.get(g.SheetsSelectionsService),n=s.get(g.SheetInterceptorService),o=s.get(i.IUniverInstanceService),r=s.get(i.ICommandService);let a=(M=e==null?void 0:e.ranges)!=null&&M.length?e.ranges:(p=t.getCurrentSelections())==null?void 0:p.map(b=>b.range).filter(b=>b.rangeType===i.RANGE_TYPE.COLUMN);if(!(a!=null&&a.length))return!1;const l=P(o,e);if(!l)return!1;const{worksheet:u,unitId:d,subUnitId:c}=l;a=ku(l.worksheet,a);const h={unitId:d,subUnitId:c,ranges:a},m={unitId:d,subUnitId:c,selections:si(a).map(b=>({range:b,primary:se(b,u),style:null}))},R=Ua(s,h),C={unitId:d,subUnitId:c,reveal:!0,selections:a.map(b=>({range:b,primary:se(b,u),style:null}))},S=i.sequenceExecute([{id:mt.id,params:h},{id:q.id,params:m}],r),I=n.onCommandExecute({id:yn.id,params:h}),v=i.sequenceExecute([...I.redos],r);if(S.result&&v.result){const b=n.afterCommandExecute({id:yn.id,params:h});return i.sequenceExecute(b.redos,r),s.get(i.IUndoRedoService).pushUndoRedo({unitID:d,undoMutations:[{id:gt.id,params:R},{id:q.id,params:C},...(w=I.undos)!=null?w:[],...b.undos],redoMutations:[...(y=I.preRedos)!=null?y:[],{id:mt.id,params:h},{id:q.id,params:m},...I.redos,...b.redos]}),!0}return!1}};function ku(s,e){const t=s.getRowCount()-1,n=s.getHiddenCols(),o=[];return e.forEach(r=>{const a=n.filter(l=>l.startColumn>=r.startColumn&&l.endColumn<=r.endColumn);if(a.length){let l=r.startColumn;a.forEach(u=>{u.startColumn>l&&(o.push({startColumn:l,endColumn:u.startColumn-1,startRow:0,endRow:t}),l=u.endColumn+1)}),l<=r.endColumn&&o.push({startColumn:l,endColumn:r.endColumn,startRow:0,endRow:t})}else o.push(r)}),o}function si(s){return Pu(s).map(t=>{const n=t.startColumn===0?t.endColumn+1:t.startColumn-1;return{...t,startColumn:n,endColumn:n}})}function Pu(s){const e=[];let t;return s.sort((n,o)=>n.startColumn-o.startColumn).forEach(n=>{if(!t){t=n;return}t.endColumn===n.startColumn-1?t.endColumn=n.endColumn:(e.push(t),t=n)}),e.push(t),e}const Fs={id:"sheet.command.set-defined-name",type:i.CommandType.COMMAND,handler:(s,e)=>{var h,m;const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),o=s.get(g.SheetInterceptorService);if(!e)return!1;const r={...e},a=K.SetDefinedNameMutationFactory(s,e),l=o.onCommandExecute({id:Fs.id,params:e}),u=[...(h=l.preRedos)!=null?h:[],{id:K.RemoveDefinedNameMutation.id,params:a},{id:K.SetDefinedNameMutation.id,params:r},...l.redos],d=[...(m=l.preUndos)!=null?m:[],{id:K.RemoveDefinedNameMutation.id,params:r},{id:K.SetDefinedNameMutation.id,params:a},...l.undos];return i.sequenceExecute(u,t)?(n.pushUndoRedo({unitID:e.unitId,undoMutations:d.filter(Boolean),redoMutations:u.filter(Boolean)}),!0):!1}},js=(s,e)=>{const n=s.get(i.IUniverInstanceService).getUniverSheetInstance(e.unitId);if(n==null)throw new Error("universheet is null error!");const o=n.getSheetBySheetId(e.subUnitId);if(o==null)throw new Error("worksheet is null error!");const a=o.getConfig().freeze;return{unitId:e.unitId,subUnitId:e.subUnitId,...a}},Oe={id:"sheet.mutation.set-frozen",type:i.CommandType.MUTATION,handler:(s,e)=>{const n=s.get(i.IUniverInstanceService).getUniverSheetInstance(e.unitId);if(n==null)throw new Error("universheet is null error!");const o=n.getSheetBySheetId(e.subUnitId);if(!o)return!1;const r=o.getConfig(),{startRow:a,startColumn:l,ySplit:u,xSplit:d}=e;return r.freeze={startRow:a,startColumn:l,ySplit:u,xSplit:d},!0}},oi={type:i.CommandType.COMMAND,id:"sheet.command.set-frozen",handler:(s,e)=>{const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),o=s.get(i.IUniverInstanceService),r=P(o,{unitId:e.unitId,subUnitId:e.subUnitId});if(!r)return!1;const{unitId:a,subUnitId:l,worksheet:u}=r,{startColumn:d,startRow:c,xSplit:h,ySplit:m}=e;if(c>=u.getRowCount()||d>=u.getColumnCount()||h>=u.getColumnCount()||m>=u.getRowCount())return!1;const R={unitId:a,subUnitId:l,...e},C=js(s,R);return t.syncExecuteCommand(Oe.id,R)?(n.pushUndoRedo({unitID:a,undoMutations:[{id:Oe.id,params:C}],redoMutations:[{id:Oe.id,params:R}]}),!0):!1}},ri={type:i.CommandType.COMMAND,id:"sheet.command.cancel-frozen",handler:(s,e)=>{const t=s.get(i.ICommandService),n=s.get(i.IUniverInstanceService),o=s.get(i.IUndoRedoService),r=P(n,{unitId:e==null?void 0:e.unitId,subUnitId:e==null?void 0:e.subUnitId});if(!r)return!1;const{unitId:a,subUnitId:l}=r,u={unitId:a,subUnitId:l,startRow:-1,startColumn:-1,xSplit:0,ySplit:0},d=js(s,u);return t.syncExecuteCommand(Oe.id,u)&&o.pushUndoRedo({unitID:a,undoMutations:[{id:Oe.id,params:d}],redoMutations:[{id:Oe.id,params:u}]}),!0}},ii={type:i.CommandType.COMMAND,id:"sheet.command.set-gridlines-color",handler:(s,e)=>{const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),o=s.get(i.IUniverInstanceService),r=P(o,e);if(!r)return!1;const{worksheet:a}=r,l=a.getConfig().gridlinesColor;if(l===(e==null?void 0:e.color))return!1;const{unitId:u,subUnitId:d}=r,c={color:e==null?void 0:e.color,unitId:u,subUnitId:d},h={color:l,unitId:u,subUnitId:d};return t.syncExecuteCommand(Rt.id,c)?(n.pushUndoRedo({unitID:u,undoMutations:[{id:Rt.id,params:h}],redoMutations:[{id:Rt.id,params:c}]}),!0):!1}},ee={id:"sheet.mutation.set-range-protection",type:i.CommandType.MUTATION,handler:(s,e)=>{const{unitId:t,subUnitId:n,rule:o,ruleId:r}=e;return s.get(X).setRule(t,n,r,o),!0}},Nu=(s,e)=>{const{unitId:t,subUnitId:n,ruleId:o}=e,a=s.get(X).getRule(t,n,o);return a?{id:ee.id,params:{...e,rule:a}}:null},lt={id:"sheet.mutation.set-worksheet-protection",type:i.CommandType.MUTATION,handler:(s,e)=>{const{unitId:t,subUnitId:n,rule:o}=e;return s.get(Ne).setRule(t,n,o),!0}},ai={type:i.CommandType.COMMAND,id:"sheet.command.set-protection",async handler(s,e){if(!e)return!1;const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),o=s.get(X),{rule:r,oldRule:a}=e,{unitId:l,subUnitId:u}=r,d=[],c=[];return(a==null?void 0:a.unitType)===r.unitType?r.unitType===D.Worksheet?(d.push({id:lt.id,params:{unitId:l,subUnitId:u,rule:r}}),c.push({id:lt.id,params:{unitId:l,subUnitId:u,rule:a}})):(d.push({id:ee.id,params:{unitId:l,subUnitId:u,rule:r,ruleId:r.id}}),c.push({id:ee.id,params:{unitId:l,subUnitId:u,ruleId:a.id,rule:a}})):(a&&(a.unitType===D.Worksheet?(d.push({id:rt.id,params:{unitId:l,subUnitId:u}}),c.push({id:qe.id,params:{unitId:l,rule:a,subUnitId:a.subUnitId}})):a.unitType===D.SelectRange&&(d.push({id:Ue.id,params:{unitId:l,subUnitId:u,ruleIds:[a.id]}}),c.push({id:Ce.id,params:{unitId:l,subUnitId:u,rules:[a]}}))),r.unitType===D.Worksheet?(d.push({id:qe.id,params:{unitId:l,rule:r,subUnitId:r.subUnitId}}),c.unshift({id:rt.id,params:{unitId:l,subUnitId:u}})):r.unitType===D.SelectRange&&(r.id=o.createRuleId(l,u),d.push({id:Ce.id,params:{unitId:l,subUnitId:u,rules:[r]}}),c.unshift({id:Ue.id,params:{unitId:l,subUnitId:u,ruleIds:[r.id]}}))),i.sequenceExecute(d,t)&&n.pushUndoRedo({unitID:l,undoMutations:c,redoMutations:d}),!0}},li={type:i.CommandType.COMMAND,id:"sheet.command.set-row-data",handler:(s,e)=>{const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),o=s.get(i.IUniverInstanceService),r=P(o,e);if(!r)return!1;const{rowData:a}=e,{unitId:l,subUnitId:u,worksheet:d}=r,c={subUnitId:u,unitId:l,rowData:a},h=vo(c,d);return t.syncExecuteCommand(Ct.id,c)?(n.pushUndoRedo({unitID:l,undoMutations:[{id:Ct.id,params:h}],redoMutations:[{id:Ct.id,params:c}]}),!0):!1}},Pt={type:i.CommandType.COMMAND,id:"sheet.command.set-specific-rows-visible",handler:(s,e)=>{var v,M,p;const{unitId:t,subUnitId:n,ranges:o}=e,r=s.get(i.ICommandService),a=s.get(i.IUndoRedoService),l=s.get(g.SheetInterceptorService),u=P(s.get(i.IUniverInstanceService),{unitId:t,subUnitId:n});if(!u)return!1;const{worksheet:d}=u,c={unitId:t,subUnitId:n,ranges:o},h={unitId:t,subUnitId:n,reveal:!0,selections:o.map(w=>({range:w,primary:se(w,d),style:null}))},m=Ba(s,c),R={unitId:t,subUnitId:n,selections:ui(o).map(w=>({range:w,primary:se(w,d),style:null}))},C=i.sequenceExecute([{id:Je.id,params:c},{id:q.id,params:h}],r),S=l.onCommandExecute({id:Pt.id,params:e}),I=i.sequenceExecute([...S.redos],r);if(C.result&&I.result){const w=l.afterCommandExecute({id:Pt.id,params:e});return i.sequenceExecute(w.redos,r),a.pushUndoRedo({unitID:t,undoMutations:[...(v=S.preUndos)!=null?v:[],{id:Xe.id,params:m},{id:q.id,params:R},...(M=S.undos)!=null?M:[],...w.undos],redoMutations:[...(p=S.preRedos)!=null?p:[],{id:Je.id,params:c},{id:q.id,params:h},...S.redos,...w.redos]}),!0}return!0}},Gs={type:i.CommandType.COMMAND,id:"sheet.command.set-selected-rows-visible",handler:async s=>{var c;const e=s.get(g.SheetsSelectionsService),t=s.get(i.IUniverInstanceService),n=s.get(i.ICommandService),o=(c=e.getCurrentSelections())==null?void 0:c.map(h=>h.range).filter(h=>h.rangeType===i.RANGE_TYPE.ROW);if(!(o!=null&&o.length))return!1;const r=P(t);if(!r)return!1;const{worksheet:a,unitId:l,subUnitId:u}=r,d=o.map(h=>a.getHiddenRows(h.startRow,h.endRow)).flat();return n.executeCommand(Pt.id,{unitId:l,subUnitId:u,ranges:d})}},_n={type:i.CommandType.COMMAND,id:"sheet.command.set-rows-hidden",handler:(s,e)=>{var M,p,w,y,b,U;const t=s.get(g.SheetsSelectionsService),n=s.get(i.ICommandService),o=s.get(i.IUndoRedoService),r=s.get(i.IUniverInstanceService),a=s.get(g.SheetInterceptorService);let l=(M=e==null?void 0:e.ranges)!=null&&M.length?e.ranges:(p=t.getCurrentSelections())==null?void 0:p.map(k=>k.range).filter(k=>k.rangeType===i.RANGE_TYPE.ROW);if(!(l!=null&&l.length))return!1;const u=P(r,e);if(!u)return!1;l=Ou(u.worksheet,l);const{unitId:d,subUnitId:c,worksheet:h}=u,m={unitId:d,subUnitId:c,ranges:l},R={unitId:d,subUnitId:c,selections:ui(l).map(k=>({range:k,primary:se(k,h),style:null}))},C=Ha(s,m),S={unitId:d,subUnitId:c,reveal:!0,selections:l.map(k=>({range:k,primary:se(k,h),style:null}))},I=a.onCommandExecute({id:_n.id,params:m});if(i.sequenceExecute([...(w=I.preRedos)!=null?w:[],{id:Xe.id,params:m},{id:q.id,params:R},...I.redos],n).result){const k=a.afterCommandExecute({id:_n.id,params:m});return i.sequenceExecute(k.redos,n),o.pushUndoRedo({unitID:d,undoMutations:[...(y=I.preUndos)!=null?y:[],{id:Je.id,params:C},{id:q.id,params:S},...(b=I.undos)!=null?b:[],...k.undos],redoMutations:[...(U=I.preRedos)!=null?U:[],{id:Xe.id,params:m},{id:q.id,params:R},...I.redos,...k.redos]}),!0}return!0}};function Ou(s,e){const t=s.getMaxColumns()-1,n=s.getHiddenRows(),o=[];return e.forEach(r=>{const a=n.filter(l=>l.startRow>=r.startRow&&l.endRow<=r.endRow);if(a.length){let l=r.startRow;a.forEach(u=>{u.startRow>l&&(o.push({startRow:l,endRow:u.startRow-1,startColumn:0,endColumn:t}),l=u.endRow+1)}),l<=r.endRow&&o.push({startRow:l,endRow:r.endRow,startColumn:0,endColumn:t})}else o.push(r)}),o}function ui(s){return Du(s).map(t=>{const n=t.startRow===0?t.endRow+1:t.startRow-1;return{...t,startRow:n,endRow:n}})}function Du(s){const e=[];let t;return s.sort((n,o)=>n.startRow-o.startRow).forEach(n=>{if(!t){t=n;return}n.startRow===t.endRow+1?t.endRow=n.endRow:(e.push(t),t=n)}),e.push(t),e}const Au=["ff","fs","tr","tb"],te={type:i.CommandType.COMMAND,id:"sheet.command.set-style",handler:(s,e)=>{var T;const t=s.get(i.IUniverInstanceService),n=P(t,e);if(!n)return!1;const{unitId:o,subUnitId:r,worksheet:a}=n,{range:l,style:u}=e,d=s.get(i.ICommandService),c=s.get(i.IUndoRedoService),h=s.get(g.SheetsSelectionsService),m=l?[l]:(T=h.getCurrentSelections())==null?void 0:T.map(E=>E.range);if(!(m!=null&&m.length))return!1;const R=new i.ObjectMatrix,C=_l(a);if(i.Tools.isArray(u.value))for(let E=0;E<m.length;E++)C.forOperableEach(m[E],(N,V,W)=>{R.setValue(N,V,{s:{[u.type]:u.value[N-W.startRow][V-W.startColumn]}})});else for(let E=0;E<m.length;E++){const N={s:{[u.type]:u.value}};C.forOperableEach(m[E],(V,W)=>R.setValue(V,W,N))}const S={subUnitId:r,unitId:o,cellValue:R.getMatrix()},I=s.get(g.SheetSkeletonService).getSkeleton(o,r),v=ce(s,S),M=d.syncExecuteCommand(F.id,S),p=s.get(g.SheetInterceptorService);let w=[],y=[];if(Au.includes(e==null?void 0:e.style.type)){const{suitableRanges:E,remainingRanges:N}=jt(m,I),V=Ts(E,a),{undos:W,redos:$}=p.generateMutationsOfAutoHeight({unitId:o,subUnitId:r,ranges:E,autoHeightRanges:E,lazyAutoHeightRanges:N,cellHeights:V});w=W,y=$}const{undos:b,redos:U}=p.onCommandExecute({id:te.id,params:e}),k=i.sequenceExecute([...U,...y],d);return M&&k.result?(c.pushUndoRedo({unitID:S.unitId,undoMutations:[{id:F.id,params:v},...b,...w],redoMutations:[{id:F.id,params:S},...U,...y]}),!0):!1}},Wu={type:i.CommandType.COMMAND,id:"sheet.command.set-bold",handler:s=>{const e=s.get(g.SheetsSelectionsService).getCurrentLastSelection();if(!e)return!1;const t=P(s.get(i.IUniverInstanceService));if(!t)return!1;const{worksheet:n}=t,{actualRow:o,actualColumn:r}=e.primary,l={style:{type:"bl",value:n.getRange(o,r).getFontWeight()===i.FontWeight.BOLD?i.BooleanNumber.FALSE:i.BooleanNumber.TRUE}};return s.get(i.ICommandService).syncExecuteCommand(te.id,l)}},Vu={type:i.CommandType.COMMAND,id:"sheet.command.set-italic",handler:s=>{const e=s.get(g.SheetsSelectionsService).getCurrentLastSelection();if(!e)return!1;const t=P(s.get(i.IUniverInstanceService));if(!t)return!1;const{worksheet:n}=t;let o=!0;if(e.primary){const{startRow:a,startColumn:l}=e.primary;o=n.getRange(a,l).getFontStyle()===i.FontItalic.ITALIC}const r={style:{type:"it",value:o?i.BooleanNumber.FALSE:i.BooleanNumber.TRUE}};return s.get(i.ICommandService).syncExecuteCommand(te.id,r)}},$u={type:i.CommandType.COMMAND,id:"sheet.command.set-underline",handler:s=>{const e=s.get(g.SheetsSelectionsService).getCurrentLastSelection();if(!e)return!1;const t=P(s.get(i.IUniverInstanceService));if(!t)return!1;const{worksheet:n}=t;let o=!0;e.primary&&(o=!!n.getRange(e.primary.startRow,e.primary.startColumn).getUnderline().s);const r={style:{type:"ul",value:{s:o?i.BooleanNumber.FALSE:i.BooleanNumber.TRUE}}};return s.get(i.ICommandService).syncExecuteCommand(te.id,r)}},Lu={type:i.CommandType.COMMAND,id:"sheet.command.set-stroke",handler:s=>{const e=s.get(g.SheetsSelectionsService).getCurrentLastSelection();if(!e)return!1;const t=P(s.get(i.IUniverInstanceService));if(!t)return!1;const{worksheet:n}=t;let o=!0;e.primary&&(o=!!n.getRange(e.primary.actualRow,e.primary.actualColumn).getStrikeThrough().s);const r={style:{type:"st",value:{s:o?i.BooleanNumber.FALSE:i.BooleanNumber.TRUE}}};return s.get(i.ICommandService).syncExecuteCommand(te.id,r)}},Bu={type:i.CommandType.COMMAND,id:"sheet.command.set-overline",handler:s=>{const e=s.get(g.SheetsSelectionsService).getCurrentLastSelection();if(!e)return!1;const t=P(s.get(i.IUniverInstanceService));if(!t)return!1;const{worksheet:n}=t;let o=!0;e.primary&&(o=!!n.getRange(e.primary.startRow,e.primary.startColumn).getOverline().s);const r={style:{type:"ol",value:{s:o?i.BooleanNumber.FALSE:i.BooleanNumber.TRUE}}};return s.get(i.ICommandService).syncExecuteCommand(te.id,r)}},Hu={type:i.CommandType.COMMAND,id:"sheet.command.set-font-family",handler:(s,e)=>{if(!e)return!1;const t=s.get(i.ICommandService),n={style:{type:"ff",value:e.value}};return t.syncExecuteCommand(te.id,n)}},Fu={type:i.CommandType.COMMAND,id:"sheet.command.set-font-size",handler:(s,e)=>{if(!e)return!1;const t=s.get(i.ICommandService),n={style:{type:"fs",value:e.value}};return t.syncExecuteCommand(te.id,n)}},di={type:i.CommandType.COMMAND,id:"sheet.command.set-text-color",handler:(s,e)=>{if(!e)return!1;const t=s.get(i.ICommandService),n={style:{type:"cl",value:{rgb:e.value}}};return t.syncExecuteCommand(te.id,n)}},ci={type:i.CommandType.COMMAND,id:"sheet.command.reset-text-color",handler:s=>{const e=s.get(i.ICommandService),t={style:{type:"cl",value:{rgb:null}}};return e.syncExecuteCommand(te.id,t)}},hi={type:i.CommandType.COMMAND,id:"sheet.command.set-background-color",handler:(s,e)=>{if(!e||!e.value)return!1;const t=s.get(i.ICommandService),n={style:{type:"bg",value:{rgb:e.value}}};return t.syncExecuteCommand(te.id,n)}},mi={type:i.CommandType.COMMAND,id:"sheet.command.reset-background-color",handler:s=>{const e=s.get(i.ICommandService),t={style:{type:"bg",value:{rgb:null}}};return e.syncExecuteCommand(te.id,t)}},gi={type:i.CommandType.COMMAND,id:"sheet.command.set-vertical-text-align",handler:(s,e)=>{if(!e)return!1;const t=s.get(i.ICommandService),n={unitId:e.unitId,subUnitId:e.subUnitId,range:e.range,style:{type:"vt",value:e.value}};return t.syncExecuteCommand(te.id,n)}},Ri={type:i.CommandType.COMMAND,id:"sheet.command.set-horizontal-text-align",handler:(s,e)=>{if(!e)return!1;const t=s.get(i.ICommandService),n={unitId:e.unitId,subUnitId:e.subUnitId,range:e.range,style:{type:"ht",value:e.value}};return t.syncExecuteCommand(te.id,n)}},Ci={type:i.CommandType.COMMAND,id:"sheet.command.set-text-wrap",handler:(s,e)=>{if(!e)return!1;const t=s.get(i.ICommandService),n={unitId:e.unitId,subUnitId:e.subUnitId,range:e.range,style:{type:"tb",value:e.value}};return t.syncExecuteCommand(te.id,n)}},Si={type:i.CommandType.COMMAND,id:"sheet.command.set-text-rotation",handler:(s,e)=>{if(!e)return!1;const t=typeof e.value=="number"?{a:e.value}:{a:0,v:i.BooleanNumber.TRUE},n=s.get(i.ICommandService),o={unitId:e.unitId,subUnitId:e.subUnitId,range:e.range,style:{type:"tr",value:t}};return n.syncExecuteCommand(te.id,o)}},ju=(s,e)=>{const r=s.get(i.IUniverInstanceService).getUniverSheetInstance(e.unitId).getSheetBySheetId(e.subUnitId).getConfig().tabColor;return{...i.Tools.deepClone(e),color:r}},qt={id:"sheet.mutation.set-tab-color",type:i.CommandType.MUTATION,handler:(s,e)=>{const t=s.get(i.IUniverInstanceService).getUniverSheetInstance(e.unitId);if(!t)return!1;const n=t.getSheetBySheetId(e.subUnitId);return n?(n.getConfig().tabColor=e.color,!0):!1}},fi={type:i.CommandType.COMMAND,id:"sheet.command.set-tab-color",handler:(s,e)=>{const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),o=P(s.get(i.IUniverInstanceService));if(!o)return!1;const{unitId:r,subUnitId:a}=o,l={color:e.value,unitId:r,subUnitId:a},u=ju(s,l);return t.syncExecuteCommand(qt.id,l)?(n.pushUndoRedo({unitID:r,undoMutations:[{id:qt.id,params:u}],redoMutations:[{id:qt.id,params:l}]}),!0):!1}},zs={id:"sheet.mutation.set-workbook-name",type:i.CommandType.MUTATION,handler:(s,e)=>{const t=s.get(i.IUniverInstanceService).getUnit(e.unitId,i.UniverInstanceType.UNIVER_SHEET);return t?(t.setName(e.name),!0):!1}},qs={type:i.CommandType.COMMAND,id:"sheet.command.set-workbook-name",handler:(s,e)=>{var u;const t=s.get(i.ICommandService),n=s.get(g.SheetInterceptorService);if(!jn(s.get(i.IUniverInstanceService),e))return!1;const r=n.onCommandExecute({id:qs.id,params:e}),a={name:e.name,unitId:e.unitId},l=[...(u=r.preRedos)!=null?u:[],{id:zs.id,params:a},...r.redos];return i.sequenceExecute(l,t).result}},Gu=4,Ys={type:i.CommandType.COMMAND,id:"sheet.command.set-worksheet-activate",handler:(s,e,t)=>{const n=s.get(i.ICommandService),o=P(s.get(i.IUniverInstanceService),e);if(!o)return!1;const{unitId:r,subUnitId:a}=o;return new Promise(l=>{setTimeout(()=>{const u=n.syncExecuteCommand(Ze.id,{unitId:r,subUnitId:a},t);l(u)},Gu)})}},Yt={type:i.CommandType.COMMAND,id:"sheet.command.delta-column-width",handler:async(s,e)=>{const n=s.get(g.SheetsSelectionsService).getCurrentSelections();if(!(n!=null&&n.length))return!1;const o=s.get(i.ICommandService),r=s.get(i.IUndoRedoService),a=P(s.get(i.IUniverInstanceService));if(!a)return!1;const{worksheet:l,unitId:u,subUnitId:d}=a,{anchorCol:c,deltaX:h}=e,R=l.getColumnWidth(c)+h,C=n.length===1&&n[0].range.rangeType===i.RANGE_TYPE.ALL,S=n.filter(L=>L.range.rangeType===i.RANGE_TYPE.COLUMN),I=C?i.RANGE_TYPE.ALL:S.some(({range:L})=>{const{startColumn:Y,endColumn:z}=L;return Y<=c&&c<=z})?i.RANGE_TYPE.COLUMN:i.RANGE_TYPE.NORMAL;let v;if(I===i.RANGE_TYPE.ALL){const L=l.getRowCount(),Y=new Array(l.getColumnCount()).fill(void 0).map((z,x)=>({startRow:0,endRow:L-1,startColumn:x,endColumn:x}));v={subUnitId:d,unitId:u,colWidth:R,ranges:Y}}else I===i.RANGE_TYPE.COLUMN?v={subUnitId:d,unitId:u,ranges:S.map(L=>i.Rectangle.clone(L.range)),colWidth:R}:v={subUnitId:d,unitId:u,colWidth:R,ranges:[{startRow:0,endRow:l.getMaxRows()-1,startColumn:c,endColumn:c}]};const M=s.get(g.SheetSkeletonService).getSkeleton(u,d),{suitableRanges:p,remainingRanges:w}=jt(v.ranges,M);Ts(p,l);const y=s.get(g.SheetInterceptorService),{undos:b,redos:U}=y.onCommandExecute({id:Yt.id,params:v}),k=Gn(v,l),T=o.syncExecuteCommand(Le.id,v),{undos:E,redos:N}=y.generateMutationsOfAutoHeight({unitId:u,subUnitId:d,ranges:p,autoHeightRanges:p,lazyAutoHeightRanges:w}),{undos:V,redos:W}=s.get(g.SheetInterceptorService).afterCommandExecute({id:Yt.id,params:v}),$=i.sequenceExecute([...U,...W,...N],o);return T&&$.result&&r.pushUndoRedo({unitID:u,undoMutations:[{id:Le.id,params:k},...b,...V,...E],redoMutations:[{id:Le.id,params:v},...U,...W,...N]}),!0}},xt={type:i.CommandType.COMMAND,id:"sheet.command.set-worksheet-col-width",handler:(s,e)=>{var y,b,U,k;const t=s.get(g.SheetsSelectionsService),n=s.get(i.ICommandService),o=s.get(i.IUndoRedoService),r=s.get(g.SheetInterceptorService),a=(y=e==null?void 0:e.ranges)!=null&&y.length?e.ranges:(b=t.getCurrentSelections())==null?void 0:b.map(T=>T.range);if(!(a!=null&&a.length))return!1;const l=P(s.get(i.IUniverInstanceService),e);if(!l)return!1;const{subUnitId:u,unitId:d,worksheet:c}=l,h=s.get(g.SheetSkeletonService).getSkeleton(d,u),m={subUnitId:u,unitId:d,ranges:a,colWidth:e.value},{suitableRanges:R,remainingRanges:C}=jt(m.ranges,h);Ts(R,c);const S=Gn(m,c),I=n.syncExecuteCommand(Le.id,m),{undos:v,redos:M}=r.generateMutationsOfAutoHeight({unitId:d,subUnitId:u,ranges:R,autoHeightRanges:R,lazyAutoHeightRanges:C}),p=r.onCommandExecute({id:xt.id,params:m}),w=i.sequenceExecute([...p.redos,...M],n);if(I&&w.result){const T=r.afterCommandExecute({id:xt.id,params:m});return i.sequenceExecute(T.redos,n),o.pushUndoRedo({unitID:d,undoMutations:[...(U=p.preUndos)!=null?U:[],{id:Le.id,params:S},...p.undos,...T.undos,...v],redoMutations:[...(k=p.preRedos)!=null?k:[],{id:Le.id,params:m},...p.redos,...T.redos,...M]}),!0}return!1}};i.CommandType.COMMAND;const Ii={type:i.CommandType.COMMAND,id:"sheet.command.set-worksheet-column-count",handler:(s,e)=>{const{unitId:t,subUnitId:n,columnCount:o}=e,r=s.get(i.ICommandService),a=s.get(i.IUndoRedoService),l=s.get(i.IUniverInstanceService);if(!P(l,e))return!1;const d={unitId:t,subUnitId:n,columnCount:o},c=po(s,d);return r.syncExecuteCommand(St.id,d)?(a.pushUndoRedo({unitID:t,undoMutations:[{id:St.id,params:c}],redoMutations:[{id:St.id,params:d}]}),!0):!1}},vi={type:i.CommandType.COMMAND,id:"sheet.command.set-worksheet-default-style",handler:(s,e)=>{const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),{unitId:o}=e,r=wo(s,e);return t.syncExecuteCommand(ft.id,e)?(n.pushUndoRedo({unitID:o,undoMutations:[{id:ft.id,params:r}],redoMutations:[{id:ft.id,params:e}]}),!0):!1}},pi=(s,e)=>{const t=pe(s.get(i.IUniverInstanceService),e);if(!t)throw new Error("[SetWorksheetHideMutationFactory]: worksheet is null error!");const{worksheet:n}=t;return{hidden:n.isSheetHidden(),unitId:e.unitId,subUnitId:n.getSheetId()}},De={id:"sheet.mutation.set-worksheet-hidden",type:i.CommandType.MUTATION,handler:(s,e)=>{const t=s.get(i.IUniverInstanceService).getUniverSheetInstance(e.unitId);if(t==null)return!1;const n=t.getSheetBySheetId(e.subUnitId);return n?(n.getConfig().hidden=e.hidden,!0):!1}},wi={type:i.CommandType.COMMAND,id:"sheet.command.set-worksheet-hidden",handler:(s,e)=>{const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),o=s.get(i.ErrorService),r=s.get(i.LocaleService),a=P(s.get(i.IUniverInstanceService),e);if(!a)return!1;const{workbook:l,worksheet:u,unitId:d,subUnitId:c}=a;if(u.getConfig().hidden===i.BooleanNumber.TRUE)return!1;const m={unitId:d,subUnitId:c,hidden:i.BooleanNumber.TRUE},R=pi(s,m);return l.getSheets().filter(v=>v.getConfig().hidden===i.BooleanNumber.FALSE).length===1?(o.emit(r.t("sheets.info.hideSheet")),!1):t.syncExecuteCommand(De.id,m)?(n.pushUndoRedo({unitID:d,undoMutations:[{id:De.id,params:R}],redoMutations:[{id:De.id,params:m}]}),!0):!1}},zu=(s,e)=>{const t=pe(s.get(i.IUniverInstanceService),e);if(!t)throw new Error("[SetWorksheetNameMutationFactory]: worksheet is null error!");const{worksheet:n}=t;return{unitId:e.unitId,name:n.getName(),subUnitId:n.getSheetId()}},Kt={id:"sheet.mutation.set-worksheet-name",type:i.CommandType.MUTATION,handler:(s,e)=>{const t=s.get(i.IUniverInstanceService).getUniverSheetInstance(e.unitId);if(t==null)return!1;const n=t.getSheetBySheetId(e.subUnitId);return n?(n.getConfig().name=e.name,!0):!1}},bn={type:i.CommandType.COMMAND,id:"sheet.command.set-worksheet-name",handler:(s,e)=>{var C,S;const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),o=s.get(g.SheetInterceptorService),r=P(s.get(i.IUniverInstanceService),e);if(!r)return!1;const{unitId:a,subUnitId:l}=r,u={subUnitId:l,name:e.name,unitId:a},d=zu(s,u),c=o.onCommandExecute({id:bn.id,params:e}),h=[...(C=c.preRedos)!=null?C:[],{id:Kt.id,params:u},...c.redos],m=[...(S=c.preUndos)!=null?S:[],{id:Kt.id,params:d},...c.undos];return i.sequenceExecute(h,t).result?(n.pushUndoRedo({unitID:a,undoMutations:m,redoMutations:h}),!0):!1}},qu=(s,e)=>({...i.Tools.deepClone(e),toOrder:e.fromOrder,fromOrder:e.toOrder}),Jt={id:"sheet.mutation.set-worksheet-order",type:i.CommandType.MUTATION,handler:(s,e)=>{const t=s.get(i.IUniverInstanceService).getUniverSheetInstance(e.unitId);if(!t)return!1;const n=t.getConfig();return n.sheetOrder.splice(e.fromOrder,1),n.sheetOrder.splice(e.toOrder,0,e.subUnitId),t.ensureSheetOrderUnique(),!0}},xs={type:i.CommandType.COMMAND,id:"sheet.command.set-worksheet-order",handler:(s,e)=>{const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),o=P(s.get(i.IUniverInstanceService),e);if(!o)return!1;const{workbook:r,unitId:a,subUnitId:l}=o,d={fromOrder:r.getConfig().sheetOrder.indexOf(l),toOrder:e.order,unitId:a,subUnitId:l},c=qu(s,d);return t.syncExecuteCommand(Jt.id,d)?(n.pushUndoRedo({unitID:a,undoMutations:[{id:Jt.id,params:c}],redoMutations:[{id:Jt.id,params:d}]}),!0):!1}};class Nt{constructor(){f(this,"_model",new Map);f(this,"_pointChange",new O.Subject);f(this,"pointChange$",this._pointChange.asObservable())}addRule(e){this._ensureSubUnitMap(e.unitId).set(e.subUnitId,e),this._pointChange.next(e)}deleteRule(e,t){var o,r,a;const n=(o=this._model.get(e))==null?void 0:o.get(t);n&&((a=(r=this._model)==null?void 0:r.get(e))==null||a.delete(t),this._pointChange.next(n))}getRule(e,t){var n,o;return(o=(n=this._model)==null?void 0:n.get(e))==null?void 0:o.get(t)}toObject(){const e={};return[...this._model.keys()].forEach(n=>{const o=this._model.get(n);o!=null&&o.size&&(e[n]=[],[...o.keys()].forEach(a=>{const l=o.get(a);l&&e[n].push(l)}))}),e}fromObject(e){const t=new Map;Object.keys(e).forEach(n=>{const o=e[n];if(o!=null&&o.length){const r=new Map;o.forEach(a=>{r.set(a.subUnitId,a)}),t.set(n,r)}}),this._model=t}deleteUnitModel(e){this._model.delete(e)}_ensureSubUnitMap(e){let t=this._model.get(e);return t||(t=new Map,this._model.set(e,t)),t}getTargetByPermissionId(e,t){const n=this._model.get(e);if(!n)return null;for(const[o,r]of n)if(r.permissionId===t)return[e,o]}}class Ks{constructor(e,t,n){f(this,"type",D.SelectRange);f(this,"subType",_.Delete);f(this,"status",i.PermissionStatus.INIT);f(this,"value",!0);f(this,"id");f(this,"unitId");f(this,"subUnitId");f(this,"permissionId");this.unitId=e,this.subUnitId=t,this.permissionId=n,this.id=`${D.SelectRange}.${_.Delete}.${n}`}}class Js{constructor(e,t,n){f(this,"type",D.SelectRange);f(this,"subType",_.ManageCollaborator);f(this,"status",i.PermissionStatus.INIT);f(this,"value",!0);f(this,"id");f(this,"unitId");f(this,"subUnitId");f(this,"permissionId");this.unitId=e,this.subUnitId=t,this.permissionId=n,this.id=`${D.SelectRange}.${_.ManageCollaborator}.${n}`}}const ue=()=>[dn,Se,Js,Ks],Ye=[_.Edit,_.View,_.ManageCollaborator,_.Delete],Yu=(s="unitId",e="subUnitId",t="permissionId")=>ue().reduce((n,o)=>{const r=new o(s,e,t);return n[r.subType]=r.value,n},{}),Ot=()=>[he,ss,Jn,is,Xn,ns,hn,Qn,es,gn,cn,ts,rs,mn,qo,as,os,Zn,Xo,Jo,xo,Yo],Mi=[_.Edit,_.Print,_.Comment,_.View,_.Copy,_.Export,_.ManageCollaborator,_.CreateSheet,_.DeleteSheet,_.RenameSheet,_.HideSheet,_.Duplicate,_.Share,_.MoveSheet,_.CopySheet,_.RecoverHistory,_.ViewHistory,_.CreatePermissionObject,_.InsertRow,_.InsertColumn,_.DeleteRow,_.DeleteColumn],de=()=>[fe,Bt,Ss,ds],ve=()=>[ls,us,cs,hs,ms,gs,Cs,Rs,fs,Is,Lt,pt,wt,vs],En=[_.Copy,_.DeleteColumn,_.DeleteRow,_.EditExtraObject,_.Filter,_.InsertColumn,_.InsertRow,_.InsertHyperlink,_.PivotTable,_.SetCellStyle,_.SetCellValue,_.SetColumnStyle,_.SetRowStyle,_.Sort];var xu=Object.getOwnPropertyDescriptor,Ku=(s,e,t,n)=>{for(var o=n>1?void 0:n?xu(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},xe=(s,e)=>(t,n)=>e(t,n,s);const Ju="SHEET_WORKSHEET_PROTECTION_PLUGIN",Xu="SHEET_WORKSHEET_PROTECTION_POINT_PLUGIN";g.WorksheetPermissionService=class extends i.RxDisposable{constructor(e,t,n,o,r,a,l,u){super(),this._permissionService=e,this._univerInstanceService=t,this._injector=n,this._worksheetProtectionRuleModel=o,this._worksheetProtectionPointRuleModel=r,this._resourceManagerService=a,this._rangeProtectionRuleModel=l,this._logService=u,this._init(),this._initRuleChange(),this._initRuleSnapshot(),this._initPointSnapshot()}_init(){const e=t=>{const n=t.getUnitId(),o=r=>{const a=r.getSheetId();[...de(),...ve()].forEach(l=>{const u=new l(n,a);this._permissionService.addPermissionPoint(u)}),this._logService.debug("[WorksheetPermissionService]","Initialization completed",n,a)};t.getSheets().forEach(r=>{o(r)}),t.sheetCreated$.subscribe(r=>{o(r)}),t.sheetDisposed$.subscribe(r=>{const a=r.getSheetId();this._rangeProtectionRuleModel.getSubunitRuleList(n,a).forEach(u=>{[...ue()].forEach(d=>{const c=new d(n,a,u.permissionId);this._permissionService.deletePermissionPoint(c.id)})}),[...de(),...ve()].forEach(u=>{const d=new u(n,a);this._permissionService.deletePermissionPoint(d.id)})})};this._univerInstanceService.getAllUnitsForType(i.UniverInstanceType.UNIVER_SHEET).forEach(t=>{e(t)}),this._univerInstanceService.getTypeOfUnitAdded$(i.UniverInstanceType.UNIVER_SHEET).pipe(Dt.takeUntil(this.dispose$)).subscribe(e),this._univerInstanceService.getTypeOfUnitDisposed$(i.UniverInstanceType.UNIVER_SHEET).pipe(Dt.takeUntil(this.dispose$)).subscribe(t=>{t.getSheets().forEach(n=>{const o=t.getUnitId(),r=n.getSheetId();de().forEach(a=>{const l=new a(o,r);this._permissionService.deletePermissionPoint(l.id)})})})}_initRuleChange(){this.disposeWithMe(this._worksheetProtectionRuleModel.ruleChange$.subscribe(e=>{switch(e.type){case"add":break;case"delete":{de().forEach(t=>{const n=new t(e.unitId,e.subUnitId);this._permissionService.updatePermissionPoint(n.id,!0)});break}case"set":{de().forEach(t=>{const n=new t(e.unitId,e.subUnitId);this._permissionService.updatePermissionPoint(n.id,e.rule)});break}}}))}_initRuleSnapshot(){const e=()=>{const n=this._worksheetProtectionRuleModel.toObject();return JSON.stringify(n)},t=n=>{if(!n)return{};try{return JSON.parse(n)}catch{return{}}};this.disposeWithMe(this._resourceManagerService.registerPluginResource({toJson:e,parseJson:t,pluginName:Ju,businesses:[un.UNIVER_SHEET],onLoad:(n,o)=>{this._worksheetProtectionRuleModel.fromObject(o),Object.keys(o).forEach(r=>{de().forEach(a=>{const l=new a(n,r);l.value=!1,this._permissionService.addPermissionPoint(l)})}),this._worksheetProtectionRuleModel.changeRuleInitState(!0)},onUnLoad:n=>{const o=this._univerInstanceService.getUnit(n);o&&(o.getSheets().forEach(r=>{const a=r.getSheetId();[...de(),...ve()].forEach(l=>{const u=new l(n,a);this._permissionService.deletePermissionPoint(u.id)})}),Ot().forEach(r=>{const a=new r(n);this._permissionService.deletePermissionPoint(a.id)})),this._worksheetProtectionRuleModel.deleteUnitModel(n)}}))}_initPointSnapshot(){const e=()=>{const n=this._worksheetProtectionPointRuleModel.toObject();return JSON.stringify(n)},t=n=>{if(!n)return{};try{return JSON.parse(n)}catch{return{}}};this.disposeWithMe(this._resourceManagerService.registerPluginResource({toJson:e,parseJson:t,pluginName:Xu,businesses:[un.UNIVER_SHEET],onLoad:(n,o)=>{this._worksheetProtectionPointRuleModel.fromObject(o),Object.keys(o).forEach(r=>{ve().forEach(a=>{const l=new a(n,r);this._permissionService.addPermissionPoint(l)})})},onUnLoad:n=>{this._worksheetProtectionPointRuleModel.deleteUnitModel(n)}}))}},g.WorksheetPermissionService=Ku([xe(0,i.Inject(i.IPermissionService)),xe(1,i.Inject(i.IUniverInstanceService)),xe(2,i.Inject(i.Injector)),xe(3,i.Inject(Ne)),xe(4,i.Inject(Nt)),xe(5,i.Inject(i.IResourceManagerService)),xe(6,i.Inject(X)),xe(7,i.Inject(i.ILogService))],g.WorksheetPermissionService);const Tn={id:"sheet.mutation.set-worksheet-permission-points",type:i.CommandType.MUTATION,handler:(s,e)=>{const{rule:t}=e;return s.get(Nt).addRule(t),!0}},yi={type:i.CommandType.COMMAND,id:"sheet.command.set-worksheet-permission-points",async handler(s,e){if(!e)return!1;const t=s.get(i.ICommandService),{rule:n}=e;return t.executeCommand(Tn.id,{rule:n,unitId:n.unitId,subUnitId:n.subUnitId}),!0}},_i={type:i.CommandType.COMMAND,id:"sheet.command.set-worksheet-protection",async handler(s,e){if(!e)return!1;const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),{rule:o,permissionId:r,oldRule:a}=e,{unitId:l,subUnitId:u}=o,d={...o,permissionId:r};if(await t.executeCommand(lt.id,{unitId:l,subUnitId:u,newRule:d})){const h=[{id:lt.id,params:{unitId:l,subUnitId:u,newRule:d}}],m=[{id:lt.id,params:{unitId:l,subUnitId:u,rule:a}}];n.pushUndoRedo({unitID:l,redoMutations:h,undoMutations:m})}return!0}},Zu=(s,e)=>{const r=s.get(i.IUniverInstanceService).getUniverSheetInstance(e.unitId).getSheetBySheetId(e.subUnitId).getConfig().rightToLeft;return{...i.Tools.deepClone(e),rightToLeft:r}},Un={id:"sheet.mutation.set-worksheet-right-to-left",type:i.CommandType.MUTATION,handler:(s,e)=>{const t=s.get(i.IUniverInstanceService).getUniverSheetInstance(e.unitId);if(!t)return!1;const n=t.getSheetBySheetId(e.subUnitId);if(!n)return!1;const o=n.getConfig();return o.rightToLeft=e.rightToLeft,!0}},Qu={type:i.CommandType.COMMAND,id:"sheet.command.set-worksheet-right-to-left",handler:async(s,e)=>{var h;const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),o=P(s.get(i.IUniverInstanceService),e);if(!o)return!1;const{unitId:r,subUnitId:a}=o;let l=i.BooleanNumber.FALSE;e&&(l=(h=e.rightToLeft)!=null?h:i.BooleanNumber.FALSE);const u={rightToLeft:l,unitId:r,subUnitId:a},d=Zu(s,u);return t.syncExecuteCommand(Un.id,u)?(n.pushUndoRedo({unitID:r,undoMutations:[{id:Un.id,params:d}],redoMutations:[{id:Un.id,params:u}]}),!0):!1}},bi={type:i.CommandType.COMMAND,id:"sheet.command.set-worksheet-row-count",handler:(s,e)=>{const{unitId:t,subUnitId:n,rowCount:o}=e,r=s.get(i.ICommandService),a=s.get(i.IUndoRedoService),l=s.get(i.IUniverInstanceService);if(!P(l,e))return!1;const d={unitId:t,subUnitId:n,rowCount:o},c=Mo(s,d);return r.syncExecuteCommand(It.id,d)?(a.pushUndoRedo({unitID:t,undoMutations:[{id:It.id,params:c}],redoMutations:[{id:It.id,params:d}]}),!0):!1}},Xt={type:i.CommandType.COMMAND,id:"sheet.command.delta-row-height",handler:async(s,e)=>{var T,E;const n=s.get(g.SheetsSelectionsService).getCurrentSelections(),o=s.get(g.SheetInterceptorService);if(!(n!=null&&n.length))return!1;const r=P(s.get(i.IUniverInstanceService));if(!r)return!1;const{worksheet:a,subUnitId:l,unitId:u}=r,{anchorRow:d,deltaY:c}=e,m=a.getRowHeight(d)+c,R=n.length===1&&n[0].range.rangeType===i.RANGE_TYPE.ALL,C=n.filter(N=>N.range.rangeType===i.RANGE_TYPE.ROW),S=R?i.RANGE_TYPE.ALL:C.some(({range:N})=>{const{startRow:V,endRow:W}=N;return V<=d&&d<=W})?i.RANGE_TYPE.ROW:i.RANGE_TYPE.NORMAL;let I;if(S===i.RANGE_TYPE.ALL){const N=a.getColumnCount(),V=new Array(a.getRowCount()).fill(void 0).map((W,$)=>({startRow:$,endRow:$,startColumn:0,endColumn:N-1}));I={subUnitId:l,unitId:u,rowHeight:m,ranges:V}}else S===i.RANGE_TYPE.ROW?I={subUnitId:l,unitId:u,ranges:C.map(N=>i.Rectangle.clone(N.range)),rowHeight:m}:I={subUnitId:l,unitId:u,rowHeight:m,ranges:[{startRow:d,endRow:d,startColumn:0,endColumn:a.getMaxColumns()-1}]};const v=yo(I,a),M={unitId:u,subUnitId:l,ranges:I.ranges,autoHeightInfo:i.BooleanNumber.FALSE},p=zn(M,a),w=s.get(i.ICommandService),y=s.get(i.IUndoRedoService),b=o.onCommandExecute({id:Xt.id,params:I}),U=i.sequenceExecute([{id:Te.id,params:I},{id:Re.id,params:M}],w),k=i.sequenceExecute([...b.redos],w);if(U.result&&k.result){const N=o.afterCommandExecute({id:Xt.id,params:I});return i.sequenceExecute(N.redos,w),y.pushUndoRedo({unitID:u,undoMutations:[...(T=b.preUndos)!=null?T:[],{id:Te.id,params:v},{id:Re.id,params:p},...b.undos,...N.undos],redoMutations:[...(E=b.preRedos)!=null?E:[],{id:Te.id,params:I},{id:Re.id,params:M},...b.redos,...N.redos]}),!0}return!1}},Zt={type:i.CommandType.COMMAND,id:"sheet.command.set-row-height",handler:(s,e)=>{var p,w,y,b;const t=s.get(g.SheetsSelectionsService),n=s.get(i.ICommandService),o=s.get(i.IUndoRedoService),r=s.get(i.IUniverInstanceService),a=s.get(g.SheetInterceptorService),l=(p=e==null?void 0:e.ranges)!=null&&p.length?e.ranges:(w=t.getCurrentSelections())==null?void 0:w.map(U=>U.range);if(!(l!=null&&l.length))return!1;const u=P(r,e);if(!u)return!1;const{unitId:d,subUnitId:c,worksheet:h}=u,m={subUnitId:c,unitId:d,ranges:l,rowHeight:e.value},R=yo(m,h),C={unitId:d,subUnitId:c,ranges:m.ranges,autoHeightInfo:i.BooleanNumber.FALSE},S=zn(C,h),I=i.sequenceExecute([{id:Te.id,params:m},{id:Re.id,params:C}],n),v=a.onCommandExecute({id:Zt.id,params:m}),M=i.sequenceExecute([...v.redos],n);if(I.result&&M.result){const U=a.afterCommandExecute({id:Zt.id,params:m});return i.sequenceExecute(U.redos,n),o.pushUndoRedo({unitID:d,undoMutations:[...(y=v.preRedos)!=null?y:[],{id:Te.id,params:R},{id:Re.id,params:S},...v.undos,...U.undos],redoMutations:[...(b=v.preRedos)!=null?b:[],{id:Te.id,params:m},{id:Re.id,params:C},...v.redos,...U.redos]}),!0}return!1}},kn={type:i.CommandType.COMMAND,id:"sheet.command.set-row-is-auto-height",handler:(s,e)=>{var U,k;const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),o=s.get(g.SheetsSelectionsService),r=s.get(i.IUniverInstanceService),a=P(r,e);if(!a)return!1;const{unitId:l,subUnitId:u,worksheet:d}=a,c=(U=e==null?void 0:e.ranges)!=null&&U.length?e.ranges:(k=o.getCurrentSelections())==null?void 0:k.map(T=>T.range);if(!(c!=null&&c.length))return!1;const h={unitId:l,subUnitId:u,ranges:c,autoHeightInfo:i.BooleanNumber.TRUE},m=zn(h,d),R=t.syncExecuteCommand(Re.id,h),C=s.get(g.SheetSkeletonService).getSkeleton(l,u),{suitableRanges:S,remainingRanges:I}=jt(h.ranges,C),v=s.get(g.SheetInterceptorService),{undos:M,redos:p}=v.generateMutationsOfAutoHeight({unitId:l,subUnitId:u,ranges:S,autoHeightRanges:S,lazyAutoHeightRanges:I}),{undos:w,redos:y}=v.onCommandExecute({id:kn.id,params:h}),b=i.sequenceExecute([...y,...p],t);return R&&b.result?(n.pushUndoRedo({unitID:l,undoMutations:[{id:Re.id,params:m},...w,...M],redoMutations:[{id:Re.id,params:h},...y,...p]}),!0):!1}},Xs={type:i.CommandType.COMMAND,id:"sheet.command.set-worksheet-show",handler:(s,e)=>{const t=P(s.get(i.IUniverInstanceService),e);if(!t)return!1;const{unitId:n,subUnitId:o,worksheet:r}=t;if(r.getConfig().hidden===i.BooleanNumber.FALSE)return!1;const l=s.get(i.ICommandService),u=s.get(i.IUndoRedoService),d={unitId:n,subUnitId:o,hidden:i.BooleanNumber.FALSE},c=pi(s,d),h=l.syncExecuteCommand(De.id,d),m={unitId:n,subUnitId:o},R=l.syncExecuteCommand(Ze.id,m);return h&&R?(u.pushUndoRedo({unitID:n,undoMutations:[{id:De.id,params:c}],redoMutations:[{id:De.id,params:d}]}),!0):!1}},Ei={type:i.CommandType.COMMAND,id:"sheet.command.split-text-to-columns",handler:(s,e)=>{const t=P(s.get(i.IUniverInstanceService),e);if(!t)return!1;const{unitId:n,subUnitId:o,worksheet:r}=t,{range:a,delimiter:l,customDelimiter:u,treatMultipleDelimitersAsOne:d}=e,{lastRow:c,rs:h,maxLength:m}=Oo(r,a,l,u,d),R=r.getColumnCount(),{startColumn:C}=i.Range.transformRange(a,r);if(a.startColumn!==a.endColumn)return!1;const S=s.get(i.ICommandService),I=s.get(i.IUndoRedoService),v=[],M=[],p=C+m+1-R;if(p>0){const T={unitId:n,subUnitId:o,range:{startRow:0,endRow:r.getRowCount()-1,startColumn:R-1,endColumn:R-1+p}};v.push({id:ie.id,params:T});const E=At(s,T);M.push({id:ne.id,params:E})}const w={startRow:a.startRow,endRow:c,startColumn:C,endColumn:C+m},y=new i.ObjectMatrix;for(let T=w.startRow;T<=w.endRow;T++)for(let E=w.startColumn;E<=w.endColumn;E++){const N=h[T-w.startRow];E===0&&(N==null?void 0:N.length)===1?y.setValue(T,E,r.getCell(T,E)):y.setValue(T,E,{v:(N==null?void 0:N[E-w.startColumn])||null,p:null,f:null,si:null,custom:null})}const b={unitId:n,subUnitId:o,cellValue:y.clone()},U=ce(s,b);return v.push({id:F.id,params:b}),M.unshift({id:F.id,params:U}),i.sequenceExecute(v,S).result?(I.pushUndoRedo({unitID:n,undoMutations:M,redoMutations:v}),!0):!1}},Ti={id:"sheet.command.toggle-cell-checkbox",type:i.CommandType.COMMAND,handler:(s,e)=>{if(!e)return!1;const{unitId:t,subUnitId:n,row:o,col:r,paragraphIndex:a}=e,u=s.get(i.IUniverInstanceService).getUnit(t,i.UniverInstanceType.UNIVER_SHEET),d=u==null?void 0:u.getSheetBySheetId(n),c=s.get(i.IUndoRedoService),h=s.get(i.ICommandService);if(!d)return!1;const m=d.getCell(o,r);if(!(m!=null&&m.p))return!1;const R=i.Tools.deepClone(m.p),C=new i.DocumentDataModel(R),S=i.BuildTextUtils.paragraph.bullet.toggleChecklist({document:C,paragraphIndex:a});if(!S)return!1;i.TextX.apply(C.getBody(),S.serialize());const I={unitId:t,subUnitId:n,cellValue:{[o]:{[r]:{p:R,t:i.CellValueType.STRING}}}},v={id:F.id,params:I},M=ce(s,I),p={id:F.id,params:M},w=[v],y=[p];return c.pushUndoRedo({redoMutations:w,undoMutations:y,unitID:t}),h.syncExecuteCommand(v.id,v.params)}},Ui={type:i.CommandType.COMMAND,id:"sheet.command.toggle-gridlines",handler:(s,e)=>{const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),o=P(s.get(i.IUniverInstanceService),e);if(!o)return!1;const{worksheet:r}=o,a=r.getConfig().showGridlines;if(a===(e==null?void 0:e.showGridlines))return!1;const{unitId:l,subUnitId:u}=o,d={showGridlines:a===i.BooleanNumber.TRUE?i.BooleanNumber.FALSE:i.BooleanNumber.TRUE,unitId:l,subUnitId:u},c={showGridlines:a,unitId:l,subUnitId:u};return t.syncExecuteCommand(vt.id,d)?(n.pushUndoRedo({unitID:l,undoMutations:[{id:vt.id,params:c}],redoMutations:[{id:vt.id,params:d}]}),!0):!1}},ki={id:"sheet.command.unregister-worksheet-range-theme-style",type:i.CommandType.COMMAND,handler:(s,e)=>{var h;if(!e||!P(s.get(i.IUniverInstanceService),e))return!1;const n=s.get(i.ICommandService),o=s.get(i.IUndoRedoService),r=s.get(g.SheetRangeThemeModel),{unitId:a,themeName:l}=e,u={unitId:a,themeName:l},d={unitId:a,themeName:l,rangeThemeStyleJson:(h=r.getRangeThemeStyle(a,l))==null?void 0:h.toJson()};return n.syncExecuteCommand(Tt.id,e)?(o.pushUndoRedo({unitID:a,undoMutations:[{id:Tt.id,params:d}],redoMutations:[{id:pn.id,params:u}]}),!0):!1}},Pi={id:"sheet.mutation.add-range-theme",type:i.CommandType.MUTATION,handler:(s,e)=>{if(!e)return!1;const{styleJSON:t,unitId:n}=e,o=s.get(g.SheetRangeThemeModel),r=new $e(t.name);return r.fromJson(t),o.registerRangeThemeStyle(n,r),!0}},Ni={id:"sheet.mutation.empty",type:i.CommandType.MUTATION,handler:()=>!0},Oi={id:"sheet.operation.mark-dirty-row-auto-height",type:i.CommandType.OPERATION,handler:()=>!0},Di={id:"sheet.operation.cancel-mark-dirty-row-auto-height",type:i.CommandType.OPERATION,handler:()=>!0},ut=i.createIdentifier("INumfmtService"),ed=(s,e)=>{const t=s.get(ut),{values:n,unitId:o,subUnitId:r}=e,a=[],l=[];Object.keys(n).forEach(d=>{n[d].ranges.forEach(h=>{i.Range.foreach(h,(m,R)=>{const C=t.getValue(o,r,m,R);C?a.push({pattern:C.pattern,row:m,col:R}):l.push({startColumn:R,endColumn:R,startRow:m,endRow:m})})})});const u=[];if(a.length){const d=Nn(o,r,a);Object.keys(d.values).forEach(c=>{const h=d.values[c];h.ranges=xn(h.ranges)}),u.push({id:Pn.id,params:Nn(o,r,a)})}return l.length&&u.push({id:Zs.id,params:{unitId:o,subUnitId:r,ranges:l}}),u},Pn={id:"sheet.mutation.set.numfmt",type:i.CommandType.MUTATION,handler:(s,e)=>{if(!e)return!1;const{values:t,refMap:n}=e,o=s.get(ut),r=e.unitId,a=e.subUnitId,l=Object.keys(t).reduce((u,d)=>{const c=n[d],h=t[d].ranges;return c&&u.push({...c,ranges:h}),u},[]);return o.setValues(r,a,l),!0}},Zs={id:"sheet.mutation.remove.numfmt",type:i.CommandType.MUTATION,handler:(s,e)=>{if(!e)return!1;const{unitId:t,subUnitId:n,ranges:o}=e;return s.get(ut).deleteValues(t,n,o),!0}},td=(s,e)=>{const t=s.get(ut),{ranges:n,unitId:o,subUnitId:r}=e,a=[];if(n.forEach(u=>{i.Range.foreach(u,(d,c)=>{const h=t.getValue(o,r,d,c);h&&a.push({pattern:h.pattern,row:d,col:c})})}),!a.length)return[];const l=Nn(o,r,a);return Object.keys(l.values).forEach(u=>{const d=l.values[u];d.ranges=xn(d.ranges)}),[{id:Pn.id,params:l}]},Nn=(s,e,t)=>{const n=dl(t,"pattern"),o={},r={},a=cl();return Object.keys(n).forEach(l=>{const u=n[l],d=a();o[d]={pattern:l},u.forEach(c=>{r[d]||(r[d]={ranges:[]}),r[d].ranges.push(i.cellToRange(c.row,c.col))})}),{unitId:s,subUnitId:e,refMap:o,values:r}},Ai={id:"sheet.mutation.remove-range-theme",type:i.CommandType.MUTATION,handler:(s,e)=>{if(!e)return!1;const{styleName:t,unitId:n}=e;return s.get(g.SheetRangeThemeModel).unregisterRangeThemeStyle(n,t),!0}},Wi={id:"sheet.mutation.set-range-theme",type:i.CommandType.MUTATION,handler:(s,e)=>{if(!e)return!1;const{unitId:t,styleName:n,style:o}=e,a=s.get(g.SheetRangeThemeModel).getRangeThemeStyle(t,n);return a&&(o.headerRowStyle&&a.setHeaderRowStyle(o.headerRowStyle),o.firstRowStyle&&a.setFirstRowStyle(o.firstRowStyle),o.secondRowStyle&&a.setSecondRowStyle(o.secondRowStyle),o.lastRowStyle&&a.setLastRowStyle(o.lastRowStyle)),!0}},Vi={id:"sheet.operation.scroll-to-cell",type:i.CommandType.OPERATION,handler:()=>!0},$i="maxCellsPerSheet",nd=3e6;var sd=Object.getOwnPropertyDescriptor,od=(s,e,t,n)=>{for(var o=n>1?void 0:n?sd(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},Li=(s,e)=>(t,n)=>e(t,n,s);const rd="SHEET_DEFINED_NAME_PLUGIN",id="AllDefaultWorkbook";g.DefinedNameDataController=class extends i.Disposable{constructor(e,t){super(),this._definedNamesService=e,this._resourceManagerService=t,this._initialize()}_initialize(){this._initSnapshot()}_initSnapshot(){const e=n=>{const o=this._definedNamesService.getDefinedNameMap(n);return o?JSON.stringify(o):""},t=n=>{if(!n)return{};try{return JSON.parse(n)}catch{return{}}};this.disposeWithMe(this._resourceManagerService.registerPluginResource({pluginName:rd,businesses:[i.UniverInstanceType.UNIVER_SHEET],toJson:n=>e(n),parseJson:n=>t(n),onUnLoad:n=>{this._definedNamesService.removeUnitDefinedName(n)},onLoad:(n,o)=>{this._definedNamesService.registerDefinedNames(n,o)}}))}},g.DefinedNameDataController=od([Li(0,K.IDefinedNamesService),Li(1,i.IResourceManagerService)],g.DefinedNameDataController);var ad=Object.getOwnPropertyDescriptor,ld=(s,e,t,n)=>{for(var o=n>1?void 0:n?ad(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},Qs=(s,e)=>(t,n)=>e(t,n,s);const ud=[Oe.id],dd=[re.id,ie.id,ae.id,ne.id,we.id,Me.id];g.SheetsFreezeSyncController=class extends i.Disposable{constructor(t,n,o){var a,l;super();f(this,"_d",new i.DisposableCollection);f(this,"_enabled",!0);this._univerInstanceService=t,this._commandService=n,this._configService=o;const r=(l=(a=this._configService.getConfig(zt))==null?void 0:a.freezeSync)!=null?l:!0;this.setEnabled(r)}getEnabled(){return this._enabled}setEnabled(t){t?this._d.dispose():this._initOnlyLocalListener(),this._enabled=t}_initOnlyLocalListener(){this._d.add(this._commandService.beforeCommandExecuted((t,n)=>{ud.includes(t.id)&&(n||(n={}),n.onlyLocal=!0)})),this._d.add(this._commandService.onCommandExecuted((t,n)=>{if(dd.includes(t.id)&&(n!=null&&n.fromCollab)){const{id:o,params:r}=t;o===re.id?this._handleInsertRowMutation(r,n):o===ie.id?this._handleInsertColMutation(r,n):o===ae.id?this._handleRemoveRowMutation(r,n):o===ne.id?this._handleRemoveColMutation(r,n):o===we.id?this._handleMoveRowsMutation(r,n):o===Me.id&&this._handleMoveColsMutation(r,n)}}))}_handleInsertRowMutation(t,n){const{range:o,unitId:r,subUnitId:a}=t,l=this._getFreeze(r,a);if(l&&o.startRow<l.startRow){const u=o.endRow-o.startRow+1,d={...l,startRow:Math.max(1,l.startRow+u),ySplit:Math.max(1,l.ySplit+u)};this._sequenceExecute(r,a,d,n)}}_handleInsertColMutation(t,n){const{range:o,unitId:r,subUnitId:a}=t,l=this._getFreeze(r,a);if(l&&o.startColumn<l.startColumn){const u=o.endColumn-o.startColumn+1,d={...l,startColumn:Math.max(1,l.startColumn+u),xSplit:Math.max(1,l.xSplit+u)};this._sequenceExecute(r,a,d,n)}}_handleRemoveRowMutation(t,n){const{range:o,unitId:r,subUnitId:a}=t,l=this._getFreeze(r,a);if(l&&o.startRow<l.startRow){const u=Math.min(l.startRow,o.endRow+1)-o.startRow,d={...l,startRow:Math.max(1,l.startRow-u),ySplit:Math.max(1,l.ySplit-u)};this._sequenceExecute(r,a,d,n)}}_handleRemoveColMutation(t,n){const{range:o,unitId:r,subUnitId:a}=t,l=this._getFreeze(r,a);if(l&&o.startColumn<l.startColumn){const u=Math.min(l.startColumn,o.endColumn+1)-o.startColumn,d={...l,startColumn:Math.max(1,l.startColumn-u),xSplit:Math.max(1,l.xSplit-u)};this._sequenceExecute(r,a,d,n)}}_handleMoveRowsMutation(t,n){const{sourceRange:o,targetRange:r,unitId:a,subUnitId:l}=t,u=this._getFreeze(a,l);if(!u||u.startRow<=0||o.startRow>=u.startRow&&r.startRow>=u.startRow||o.endRow<u.startRow&&r.endRow<u.startRow)return;const d=o.endRow-o.startRow+1,c=Math.max(Math.min(u.startRow,o.endRow+1)-o.startRow,0),h={...u};r.startRow>=u.startRow?(h.startRow=Math.max(1,u.startRow-c),h.ySplit=Math.max(1,u.ySplit-c)):(h.startRow=u.startRow+d-c,h.ySplit=u.ySplit+d-c),this._sequenceExecute(a,l,h,n)}_handleMoveColsMutation(t,n){const{sourceRange:o,targetRange:r,unitId:a,subUnitId:l}=t,u=this._getFreeze(a,l);if(!u||u.startColumn<=0||o.startColumn>=u.startColumn&&r.startColumn>=u.startColumn||o.endColumn<u.startColumn&&r.endColumn<u.startColumn)return;const d=o.endColumn-o.startColumn+1,c=Math.max(Math.min(u.startColumn,o.endColumn+1)-o.startColumn,0),h={...u};r.startColumn>=u.startColumn?(h.startColumn=Math.max(1,u.startColumn-c),h.xSplit=Math.max(1,u.xSplit-c)):(h.startColumn=u.startColumn+d-c,h.xSplit=u.xSplit+d-c),this._sequenceExecute(a,l,h,n)}_getFreeze(t,n){const o=this._univerInstanceService.getUnit(t,i.UniverInstanceType.UNIVER_SHEET);if(!o)return null;const r=o.getSheetBySheetId(n);return r?r.getFreeze():null}_sequenceExecute(t,n,o,r){i.sequenceExecute([{id:Oe.id,params:{...o,unitId:t,subUnitId:n,resetScroll:!1}}],this._commandService,r)}},g.SheetsFreezeSyncController=ld([Qs(0,i.Inject(i.IUniverInstanceService)),Qs(1,i.ICommandService),Qs(2,i.IConfigService)],g.SheetsFreezeSyncController);var cd=Object.getOwnPropertyDescriptor,hd=(s,e,t,n)=>{for(var o=n>1?void 0:n?cd(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},Ae=(s,e)=>(t,n)=>e(t,n,s);g.SheetPermissionCheckController=class extends i.Disposable{constructor(t,n,o,r,a,l,u,d,c,h){super();f(this,"disposableCollection",new i.DisposableCollection);f(this,"_triggerPermissionUIEvent$",new O.Subject);f(this,"triggerPermissionUIEvent$",this._triggerPermissionUIEvent$.asObservable());this._commandService=t,this._univerInstanceService=n,this._permissionService=o,this._selectionManagerService=r,this._rangeProtectionRuleModel=a,this._worksheetProtectionRuleModel=l,this._localeService=u,this._lexerTreeBuilder=d,this._contextService=c,this._definedNamesService=h,this._initialize()}blockExecuteWithoutPermission(t){throw this._triggerPermissionUIEvent$.next(t),new i.CustomCommandExecutionError("have no permission")}_getPermissionCheck(t,n){let o=!0,r="";switch(t){case Mt.id:i.isICellData(n.value)&&n.value.f?(o=this._permissionCheckWithFormula(n),r=this._localeService.t("permission.dialog.formulaErr")):o=this._permissionCheckBySetRangeValue({workbookTypes:[he],rangeTypes:[Se],worksheetTypes:[Lt,fe]},n);break;case vn.id:o=this.permissionCheckWithRanges({workbookTypes:[he],rangeTypes:[Se],worksheetTypes:[Lt,fe]},n==null?void 0:n.ranges,n==null?void 0:n.unitId,n==null?void 0:n.subUnitId),r=this._localeService.t("permission.dialog.editErr");break;case Yt.id:case xt.id:o=this.permissionCheckWithoutRange({worksheetTypes:[pt]}),r=this._localeService.t("permission.dialog.setRowColStyleErr");break;case Xt.id:case Zt.id:case kn.id:o=this.permissionCheckWithoutRange({worksheetTypes:[wt]}),r=this._localeService.t("permission.dialog.setRowColStyleErr");break;case bt.id:case _t.id:o=this._permissionCheckByMoveCommand(n),r=this._localeService.t("permission.dialog.moveRowColErr");break;case Qe.id:o=this._permissionCheckByMoveRangeCommand(n),r=this._localeService.t("permission.dialog.moveRangeErr");break;case xs.id:o=this._permissionCheckByWorksheetCommand([he,mn]),r=this._localeService.t("permission.dialog.operatorSheetErr"),o===!1&&this._worksheetProtectionRuleModel.resetOrder();break;case bn.id:o=this._permissionCheckByWorksheetCommand([he,gn]),r=this._localeService.t("permission.dialog.operatorSheetErr"),o===!1&&this._worksheetProtectionRuleModel.resetOrder();break;case Xs.id:{const{unitId:a,subUnitId:l}=n;o=this._permissionCheckByWorksheetCommand([he,cn],a,l),r=this._localeService.t("permission.dialog.operatorSheetErr"),o===!1&&this._worksheetProtectionRuleModel.resetOrder()}break;case kt.id:o=this.permissionCheckWithRanges({workbookTypes:[he],rangeTypes:[Se],worksheetTypes:[fe,pt]},n.ranges,n.unitId,n.subUnitId),r=this._localeService.t("permission.dialog.setRowColStyleErr");break;case Pt.id:o=this.permissionCheckWithRanges({workbookTypes:[he],rangeTypes:[Se],worksheetTypes:[fe,wt]},n.ranges,n.unitId,n.subUnitId),r=this._localeService.t("permission.dialog.setRowColStyleErr");break;case Hs.id:o=this.permissionCheckWithRanges({workbookTypes:[he],rangeTypes:[Se],worksheetTypes:[fe,pt]}),r=this._localeService.t("permission.dialog.setRowColStyleErr");break;case Gs.id:o=this.permissionCheckWithRanges({workbookTypes:[he],rangeTypes:[Se],worksheetTypes:[fe,wt]}),r=this._localeService.t("permission.dialog.setRowColStyleErr");break;case yt.id:o=this._permissionCheckWithInsertRangeMove("right"),r=this._localeService.t("permission.dialog.insertOrDeleteMoveRangeErr");break;case et.id:o=this._permissionCheckWithInsertRangeMove("bottom"),r=this._localeService.t("permission.dialog.insertOrDeleteMoveRangeErr");break;case Ge.id:o=this._permissionCheckWithInsertRangeMove("left"),r=this._localeService.t("permission.dialog.insertOrDeleteMoveRangeErr");break;case ze.id:o=this._permissionCheckWithInsertRangeMove("top"),r=this._localeService.t("permission.dialog.insertOrDeleteMoveRangeErr");break}o||this.blockExecuteWithoutPermission(r)}_initialize(){this._commandExecutedListener()}_commandExecutedListener(){this.disposeWithMe(this._commandService.beforeCommandExecuted(t=>{this._getPermissionCheck(t.id,t==null?void 0:t.params)})),this.disposeWithMe(this._commandService.onCommandExecuted(t=>{var n;if(t.id===Kt.id){const o=t.params,{unitId:r=(n=this._univerInstanceService.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET))==null?void 0:n.getUnitId(),subUnitId:a}=o;if(!r||!a)return;const l=this._worksheetProtectionRuleModel.getRule(r,a),u=this._rangeProtectionRuleModel.getSubunitRuleList(r,a);l&&this._worksheetProtectionRuleModel.ruleRefresh(l.permissionId),u.length&&this._rangeProtectionRuleModel.ruleRefresh(a)}}))}_permissionCheckWithInsertRangeMove(t){var c;const n=P(this._univerInstanceService);if(!n)return!1;const{worksheet:o,unitId:r,subUnitId:a}=n,l=i.Tools.deepClone((c=this._selectionManagerService.getCurrentLastSelection())==null?void 0:c.range);return!(!l||(t==="top"||t==="bottom"?l.endRow=o.getRowCount()-1:(t==="left"||t==="right")&&(l.endColumn=o.getColumnCount()-1),this._rangeProtectionRuleModel.getSubunitRuleList(r,a).map(h=>h.ranges).flat().some(h=>i.Rectangle.getIntersects(l,h))))}_permissionCheckByWorksheetCommand(t,n,o){var c,h;const r=P(this._univerInstanceService,{unitId:n,subUnitId:o});if(!r)return!1;const{unitId:a,subUnitId:l}=r,u=this._worksheetProtectionRuleModel.getRule(a,l),d=this._rangeProtectionRuleModel.getSubunitRuleList(a,l).length>0;return u||d?(h=(c=this._permissionService.getPermissionPoint(new hn(a).id))==null?void 0:c.value)!=null?h:!1:this._permissionService.composePermission(t.map(m=>new m(a).id)).every(m=>m.value)}permissionCheckWithoutRange(t){var R,C,S,I;const n=P(this._univerInstanceService);if(!n)return!1;const{worksheet:o,unitId:r,subUnitId:a}=n,l=this._selectionManagerService.getCurrentLastSelection();if(!l)return!0;const u=(C=(R=l==null?void 0:l.primary)==null?void 0:R.actualRow)!=null?C:0,d=(I=(S=l==null?void 0:l.primary)==null?void 0:S.actualColumn)!=null?I:0,{workbookTypes:c,worksheetTypes:h,rangeTypes:m}=t;return!(c&&c.some(M=>{var y,b;const p=new M(r);return((b=(y=this._permissionService.getPermissionPoint(p.id))==null?void 0:y.value)!=null?b:!1)===!1})===!0||h&&h.some(M=>{var y,b;const p=new M(r,a);return((b=(y=this._permissionService.getPermissionPoint(p.id))==null?void 0:y.value)!=null?b:!1)===!1})===!0||m&&m.some(M=>{var U,k,T,E,N;const p=(k=(U=o.getCell(u,d))==null?void 0:U.selectionProtection)==null?void 0:k[0];if(!(p!=null&&p.ruleId))return!1;const w=(T=this._rangeProtectionRuleModel.getRule(r,a,p.ruleId))==null?void 0:T.permissionId;if(!w)return!1;const y=new M(r,a,w);return((N=(E=this._permissionService.getPermissionPoint(y.id))==null?void 0:E.value)!=null?N:!1)===!1})===!0)}permissionCheckWithRanges(t,n,o,r){var C;const a=P(this._univerInstanceService,{unitId:o,subUnitId:r});if(!a)return!1;const l=n!=null?n:(C=this._selectionManagerService.getCurrentSelections())==null?void 0:C.map(S=>S.range);if(!l)return!1;const{unitId:u,subUnitId:d}=a,{workbookTypes:c,worksheetTypes:h,rangeTypes:m}=t,R=[];return c&&R.push(...c.map(S=>new S(u).id)),h&&R.push(...h.map(S=>new S(u,d).id)),m&&this._rangeProtectionRuleModel.getSubunitRuleList(u,d).forEach(S=>{l.some(v=>S.ranges.some(M=>i.Rectangle.intersects(M,v)))&&R.push(...m.map(v=>new v(u,d,S.permissionId).id))}),R.length?this._permissionService.composePermission(R).every(S=>S.value):!0}_permissionCheckByMoveCommand(t){const n=P(this._univerInstanceService,t);if(!n)return!1;const{worksheet:o,unitId:r,subUnitId:a}=n,l=t.toRange;l.endRow===o.getRowCount()-1?l.endColumn=l.startColumn:l.endRow=l.startRow;const u=this._rangeProtectionRuleModel.getSubunitRuleList(r,a).reduce((d,c)=>[...d,...c.ranges],[]).filter(d=>i.Rectangle.intersects(d,l));return u.length>0?!1:(u.forEach(d=>{var c,h;for(let m=d.startRow;m<=d.endRow;m++)for(let R=d.startColumn;R<=d.endColumn;R++){const C=(h=(c=o.getCell(m,R))==null?void 0:c.selectionProtection)==null?void 0:h[0];if((C==null?void 0:C[_.Edit])===!1)return!1}}),!0)}_permissionCheckByMoveRangeCommand(t){const n=P(this._univerInstanceService);if(!n)return!1;const{worksheet:o,unitId:r,subUnitId:a}=n,l=t.toRange,u=this._rangeProtectionRuleModel.getSubunitRuleList(r,a).reduce((d,c)=>[...d,...c.ranges],[]).filter(d=>i.Rectangle.intersects(d,l));return u.length>0?!1:(u.forEach(d=>{var c,h;for(let m=d.startRow;m<=d.endRow;m++)for(let R=d.startColumn;R<=d.endColumn;R++){const C=(h=(c=o.getCell(m,R))==null?void 0:c.selectionProtection)==null?void 0:h[0];if((C==null?void 0:C[_.Edit])===!1)return!1}}),!0)}_permissionCheckBySetRangeValue(t,n){let o=[];n.range?o=[n.range]:o=[new i.ObjectMatrix(n.value).getDataRange()];const{unitId:r,subUnitId:a}=n;return this.permissionCheckWithRanges(t,o,r,a)}_permissionCheckWithFormula(t){var a,l,u,d,c;const n=t.value,o=t.range,r=n.f;if(r){const h=r.substring(1),m=this._univerInstanceService.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET),R=(a=t.unitId)!=null?a:m.getUnitId(),C=this._definedNamesService.getValueByName(R,h);if(C){let S=C.formulaOrRefString;S.startsWith(K.operatorToken.EQUALS)&&(S=S.slice(1));const I=S.split(",");for(let v=0;v<I.length;v++){const M=I[v],p=K.deserializeRangeWithSheet(M);if(p.sheetName){const w=m.getSheetBySheetName(p.sheetName);if(!w)return!0;const{startRow:y,endRow:b,startColumn:U,endColumn:k}=p.range;for(let T=y;T<=b;T++)for(let E=U;E<=k;E++){const N=(u=(l=w.getCell(T,E))==null?void 0:l.selectionProtection)==null?void 0:u[0];if((N==null?void 0:N[_.View])===!1)return!1}}}return!0}else{const S=this._lexerTreeBuilder.sequenceNodesBuilder(r);if(!S)return!0;for(let I=0;I<S.length;I++){const v=S[I];if(typeof v=="string"||v.nodeType!==K.sequenceNodeType.REFERENCE)continue;const{token:M}=v,p=K.deserializeRangeWithSheetWithCache(M),w=p.unitId?this._univerInstanceService.getUnit(p.unitId):this._univerInstanceService.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET);if(!w)return!0;let y=p.sheetName?w.getSheetBySheetName(p.sheetName):w.getActiveSheet();const b=w.getUnitId();if(p.sheetName){if(y=w.getSheetBySheetName(p.sheetName),!y)return!0;const N=y==null?void 0:y.getSheetId();if(!this._permissionService.getPermissionPoint(new Bt(b,N).id))return!1}if(!y)return!0;const{startRow:U,endRow:k,startColumn:T,endColumn:E}=p.range;for(let N=U;N<=k;N++)for(let V=T;V<=E;V++){const W=(c=(d=y.getCell(N,V))==null?void 0:d.selectionProtection)==null?void 0:c[0];if((W==null?void 0:W[_.View])===!1)return!1}}return!0}}if(o){const h=P(this._univerInstanceService,t);if(!h)return!1;const{unitId:m,subUnitId:R}=h,S=this._rangeProtectionRuleModel.getSubunitRuleList(m,R).filter(v=>v.ranges.some(M=>i.Rectangle.intersects(M,o))).map(v=>new Se(m,R,v.permissionId).id);if(!this._permissionService.composePermission(S).every(v=>v.value))return!1}return!0}},g.SheetPermissionCheckController=hd([Ae(0,i.ICommandService),Ae(1,i.IUniverInstanceService),Ae(2,i.IPermissionService),Ae(3,i.Inject(g.SheetsSelectionsService)),Ae(4,i.Inject(X)),Ae(5,i.Inject(Ne)),Ae(6,i.Inject(i.LocaleService)),Ae(7,i.Inject(K.LexerTreeBuilder)),Ae(8,i.IContextService),Ae(9,K.IDefinedNamesService)],g.SheetPermissionCheckController);var md=Object.getOwnPropertyDescriptor,gd=(s,e,t,n)=>{for(var o=n>1?void 0:n?md(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},Qt=(s,e)=>(t,n)=>e(t,n,s);g.WorkbookPermissionService=class extends i.Disposable{constructor(t,n,o,r,a){super();f(this,"_unitPermissionInitStateChange",new O.BehaviorSubject(!1));f(this,"unitPermissionInitStateChange$",this._unitPermissionInitStateChange.asObservable());this._permissionService=t,this._univerInstanceService=n,this._rangeProtectionRuleModel=o,this._worksheetProtectionRuleModel=r,this._worksheetProtectionPointModel=a,this._init()}_init(){const t=n=>{const o=n.getUnitId();Ot().forEach(r=>{const a=new r(o);this._permissionService.addPermissionPoint(a)})};this._univerInstanceService.getAllUnitsForType(i.UniverInstanceType.UNIVER_SHEET).forEach(n=>{t(n)}),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitAdded$(i.UniverInstanceType.UNIVER_SHEET).subscribe(n=>{t(n)})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitDisposed$(i.UniverInstanceType.UNIVER_SHEET).subscribe(n=>{const o=n.getUnitId();n.getSheets().forEach(r=>{const a=r.getSheetId();this._rangeProtectionRuleModel.getSubunitRuleList(o,a).forEach(u=>{[...ue()].forEach(d=>{const c=new d(o,a,u.permissionId);this._permissionService.deletePermissionPoint(c.id)})}),[...de(),...ve()].forEach(u=>{const d=new u(o,a);this._permissionService.deletePermissionPoint(d.id)})}),Ot().forEach(r=>{const a=new r(o);this._permissionService.deletePermissionPoint(a.id)}),this._rangeProtectionRuleModel.deleteUnitModel(o),this._worksheetProtectionPointModel.deleteUnitModel(o),this._worksheetProtectionRuleModel.deleteUnitModel(o)}))}changeUnitInitState(t){this._unitPermissionInitStateChange.next(t)}},g.WorkbookPermissionService=gd([Qt(0,i.Inject(i.IPermissionService)),Qt(1,i.Inject(i.IUniverInstanceService)),Qt(2,i.Inject(X)),Qt(3,i.Inject(Ne)),Qt(4,i.Inject(Nt))],g.WorkbookPermissionService);var Rd=Object.getOwnPropertyDescriptor,Cd=(s,e,t,n)=>{for(var o=n>1?void 0:n?Rd(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},We=(s,e)=>(t,n)=>e(t,n,s);g.SheetPermissionInitController=class extends i.Disposable{constructor(e,t,n,o,r,a,l,u,d,c){super(),this._univerInstanceService=e,this._permissionService=t,this._authzIoService=n,this._rangeProtectionRuleModel=o,this._worksheetProtectionRuleModel=r,this._userManagerService=a,this._worksheetProtectionPointRuleModel=l,this._workbookPermissionService=u,this._undoRedoService=d,this._commandService=c}initPermission(){this._initRangePermissionFromSnapshot(),this._initRangePermissionChange(),this._initWorksheetPermissionFromSnapshot(),this._initWorksheetPermissionChange(),this._initWorksheetPermissionPointsChange(),this._initWorkbookPermissionFromSnapshot(),this._initUserChange(),this._refreshPermissionByCollaCreate()}refreshRangeProtectPermission(){this._initRangePermissionFromSnapshot()}async _initRangePermissionFromSnapshot(){const e=async t=>{const n=[],o=t.getUnitId(),r=t.getSheets(),a=new Map;if(r.forEach(l=>{const u=l.getSheetId();this._rangeProtectionRuleModel.getSubunitRuleList(o,u).forEach(d=>{a.set(d.permissionId,d),n.push({objectID:d.permissionId,unitID:o,objectType:D.SelectRange,actions:Ye})})}),!n.length){this._rangeProtectionRuleModel.changeRuleInitState(!0);return}this._authzIoService.batchAllowed(n).then(l=>{l.forEach(u=>{const d=a.get(u.objectID);if(d){if(!this._rangeProtectionRuleModel.getRule(o,d.subUnitId,d.id))return;ue().forEach(h=>{const m=new h(o,d.subUnitId,u.objectID),R=m.subType,C=u.actions.find(S=>S.action===R);(C==null?void 0:C.allowed)!==void 0&&this._permissionService.updatePermissionPoint(m.id,C.allowed)})}}),this._rangeProtectionRuleModel.changeRuleInitState(!0)})};await Promise.all(this._univerInstanceService.getAllUnitsForType(i.UniverInstanceType.UNIVER_SHEET).map(t=>e(t))),this._rangeProtectionRuleModel.changeRuleInitState(!0)}_initRangePermissionChange(){this.disposeWithMe(this._rangeProtectionRuleModel.ruleChange$.subscribe(e=>{e.type!=="delete"?this._authzIoService.allowed({objectID:e.rule.permissionId,unitID:e.unitId,objectType:D.SelectRange,actions:Ye}).then(t=>{this._rangeProtectionRuleModel.getRule(e.unitId,e.subUnitId,e.rule.id)&&(ue().forEach(o=>{if(e.type==="set"){const{rule:d,oldRule:c}=e;if(d.permissionId===(c==null?void 0:c.permissionId))return}const r=e.rule,a=new o(r.unitId,r.subUnitId,r.permissionId),l=a.subType,u=t.find(d=>d.action===l);u&&this._permissionService.updatePermissionPoint(a.id,u.allowed)}),this._rangeProtectionRuleModel.ruleRefresh(e.rule.permissionId))}):this._rangeProtectionRuleModel.getSubunitRuleList(e.unitId,e.subUnitId).length===0&&(this._worksheetProtectionPointRuleModel.deleteRule(e.unitId,e.subUnitId),[...ve()].forEach(n=>{const o=new n(e.unitId,e.subUnitId);this._permissionService.updatePermissionPoint(o.id,o.value)}))}))}async initWorkbookPermissionChange(e){var n;const t=e||((n=this._univerInstanceService.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET))==null?void 0:n.getUnitId());if(t)return this._authzIoService.allowed({objectID:t,objectType:D.Workbook,unitID:t,actions:Mi}).then(o=>{Ot().forEach(r=>{const a=new r(t),l=a.subType,u=o.find(d=>d.action===l);u&&this._permissionService.updatePermissionPoint(a.id,u.allowed)})})}async _initWorkbookPermissionFromSnapshot(){await Promise.all(this._univerInstanceService.getAllUnitsForType(i.UniverInstanceType.UNIVER_SHEET).map(e=>this.initWorkbookPermissionChange(e.getUnitId()))),this._workbookPermissionService.changeUnitInitState(!0)}_initWorksheetPermissionChange(){this.disposeWithMe(this._worksheetProtectionRuleModel.ruleChange$.subscribe(e=>{e.type!=="delete"?this._authzIoService.allowed({objectID:e.rule.permissionId,unitID:e.unitId,objectType:D.Worksheet,actions:Ye}).then(t=>{const n=this._worksheetProtectionRuleModel.getRule(e.unitId,e.subUnitId);!n||n.permissionId!==e.rule.permissionId||(de().forEach(o=>{const r=new o(e.unitId,e.subUnitId),a=r.subType,l=t.find(u=>u.action===a);l&&this._permissionService.updatePermissionPoint(r.id,l.allowed)}),this._worksheetProtectionRuleModel.ruleRefresh(e.rule.permissionId))}):([...de(),...ve()].forEach(t=>{const n=new t(e.unitId,e.subUnitId);this._permissionService.updatePermissionPoint(n.id,!0)}),this._worksheetProtectionPointRuleModel.deleteRule(e.unitId,e.subUnitId))}))}_initWorksheetPermissionPointsChange(){this.disposeWithMe(this._worksheetProtectionPointRuleModel.pointChange$.subscribe(e=>{this._authzIoService.allowed({objectID:e.permissionId,unitID:e.unitId,objectType:D.Worksheet,actions:En}).then(t=>{const n=this._worksheetProtectionPointRuleModel.getRule(e.unitId,e.subUnitId);!n||n.permissionId!==e.permissionId||ve().forEach(o=>{const r=new o(e.unitId,e.subUnitId),a=r.subType,l=t.find(u=>u.action===a);l&&this._permissionService.updatePermissionPoint(r.id,l.allowed)})})}))}async _initWorksheetPermissionFromSnapshot(){const e=async t=>{const n=[],o=t.getUnitId(),r=t.getSheets(),a=new Map;if(r.forEach(l=>{const u=l.getSheetId(),d=this._worksheetProtectionRuleModel.getRule(o,u);d&&(a.set(d.permissionId,d),n.push({objectID:d.permissionId,unitID:o,objectType:D.Worksheet,actions:Ye}));const c=this._worksheetProtectionPointRuleModel.getRule(o,u);c&&(a.set(c.permissionId,c),n.push({objectID:c.permissionId,unitID:o,objectType:D.Worksheet,actions:En}))}),!n.length){this._worksheetProtectionRuleModel.changeRuleInitState(!0);return}this._authzIoService.batchAllowed(n).then(l=>{l.forEach(u=>{const d=a.get(u.objectID);if(d){const c=this._worksheetProtectionRuleModel.getRule(o,d.subUnitId)||this._worksheetProtectionPointRuleModel.getRule(o,d.subUnitId);if(!c||c.permissionId!==u.objectID)return;[...de(),...ve()].forEach(h=>{const m=new h(o,d.subUnitId),R=m.subType,C=u.actions.find(S=>S.action===R);(C==null?void 0:C.allowed)!==void 0&&this._permissionService.updatePermissionPoint(m.id,C.allowed)})}}),this._worksheetProtectionRuleModel.changeRuleInitState(!0)})};await Promise.all(this._univerInstanceService.getAllUnitsForType(i.UniverInstanceType.UNIVER_SHEET).map(t=>e(t))),this._worksheetProtectionRuleModel.changeRuleInitState(!0)}_initUserChange(){this.disposeWithMe(this._userManagerService.currentUser$.pipe(O.skip(1)).subscribe(()=>{const e=this._permissionService.getAllPermissionPoint();this._permissionService.clearPermissionMap(),this._worksheetProtectionRuleModel.changeRuleInitState(!1),this._univerInstanceService.getAllUnitsForType(i.UniverInstanceType.UNIVER_SHEET).forEach(n=>{const o=n.getUnitId();Ot().forEach(r=>{let a=new r(o);e.has(a.id)&&(a=e.get(a.id)),this._permissionService.addPermissionPoint(a)}),n.getSheets().forEach(r=>{const a=r.getSheetId();[...de(),...ve()].forEach(u=>{let d=new u(o,a);e.has(d.id)&&(d=e.get(d.id)),this._permissionService.addPermissionPoint(d)}),this._rangeProtectionRuleModel.getSubunitRuleList(o,a).forEach(u=>{ue().forEach(d=>{let c=new d(o,a,u.permissionId);e.has(c.id)&&(c=e.get(c.id)),this._permissionService.addPermissionPoint(c)})})}),this._initWorkbookPermissionFromSnapshot(),this._initWorksheetPermissionFromSnapshot(),this._initRangePermissionFromSnapshot()})}))}refreshPermission(e,t){const n=this._worksheetProtectionRuleModel.getTargetByPermissionId(e,t);let o=!1;if(n){const[l,u]=n;this._authzIoService.allowed({objectID:t,unitID:e,objectType:D.Worksheet,actions:Ye}).then(d=>{if(!this._worksheetProtectionRuleModel.getTargetByPermissionId(e,t))return;let h="";de().forEach(m=>{var I;const R=new m(e,u),C=R.subType,S=d.find(v=>v.action===C);S&&(((I=this._permissionService.getPermissionPoint(R.id))==null?void 0:I.value)!==S.allowed&&(o=!0),this._permissionService.updatePermissionPoint(R.id,S.allowed),h+=`${S.action}_${S.allowed}`)}),this._worksheetProtectionRuleModel.ruleRefresh(`${t}_${h}`),o&&this._undoRedoService.clearUndoRedo(e)})}const r=this._worksheetProtectionPointRuleModel.getTargetByPermissionId(e,t);if(r){const[l,u]=r;this._authzIoService.allowed({objectID:t,unitID:e,objectType:D.Worksheet,actions:En}).then(d=>{this._worksheetProtectionPointRuleModel.getTargetByPermissionId(e,t)&&(ve().forEach(h=>{var S;const m=new h(e,u),R=m.subType,C=d.find(I=>I.action===R);C&&(((S=this._permissionService.getPermissionPoint(m.id))==null?void 0:S.value)!==C.allowed&&(o=!0),this._permissionService.updatePermissionPoint(m.id,C.allowed))}),o&&this._undoRedoService.clearUndoRedo(e))})}const a=this._rangeProtectionRuleModel.getTargetByPermissionId(e,t);if(a){const[l,u]=a;this._authzIoService.allowed({objectID:t,unitID:e,objectType:D.SelectRange,actions:Ye}).then(d=>{if(!this._rangeProtectionRuleModel.getTargetByPermissionId(e,t))return;let h="";ue().forEach(m=>{var I;const R=new m(e,u,t),C=R.subType,S=d.find(v=>v.action===C);S&&(((I=this._permissionService.getPermissionPoint(R.id))==null?void 0:I.value)!==S.allowed&&(o=!0),this._permissionService.updatePermissionPoint(R.id,S.allowed),h+=`${S.action}_${S.allowed}`)}),this._rangeProtectionRuleModel.ruleRefresh(`${t}_${h}`),o&&this._undoRedoService.clearUndoRedo(e)})}}_refreshPermissionByCollaCreate(){this.disposeWithMe(this._commandService.onCommandExecuted((e,t)=>{if(t!=null&&t.fromCollab&&(e.id===Ce.id||e.id===qe.id||e.id===Tn.id)){const n=e.params;this._undoRedoService.clearUndoRedo(n.unitId)}}))}},g.SheetPermissionInitController=Cd([We(0,i.IUniverInstanceService),We(1,i.IPermissionService),We(2,i.IAuthzIoService),We(3,i.Inject(X)),We(4,i.Inject(Ne)),We(5,i.Inject(i.UserManagerService)),We(6,i.Inject(Nt)),We(7,i.Inject(g.WorkbookPermissionService)),We(8,i.Inject(i.IUndoRedoService)),We(9,i.Inject(i.ICommandService))],g.SheetPermissionInitController);var Sd=Object.getOwnPropertyDescriptor,fd=(s,e,t,n)=>{for(var o=n>1?void 0:n?Sd(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},eo=(s,e)=>(t,n)=>e(t,n,s);g.ZebraCrossingCacheController=class extends i.Disposable{constructor(t,n,o){super();f(this,"_zebraCacheUpdateSubject",new O.Subject);this._commandService=t,this._sheetRangeThemeModel=n,this._univerInstanceService=o,this._init()}_init(){this._initializeCommandListener(),this._initTriggerCacheUpdateListener()}updateZebraCrossingCache(t,n){this._zebraCacheUpdateSubject.next({unitId:t,subUnitId:n})}_initializeCommandListener(){this.disposeWithMe(this._commandService.onCommandExecuted(t=>{const{id:n}=t;let o,r;switch(n){case re.id:{const a=t.params;o=a.unitId,r=a.subUnitId}break;case Je.id:{const a=t.params;o=a.unitId,r=a.subUnitId}break;case Xe.id:{const a=t.params;o=a.unitId,r=a.subUnitId}break;case ae.id:{const a=t.params;o=a.unitId,r=a.subUnitId}break;case Te.id:{const a=t.params;o=a.unitId,r=a.subUnitId}break}o&&r&&(this._sheetRangeThemeModel.refreshSheetRowVisibleFuncSet(o,r),this._sheetRangeThemeModel.refreshZebraCrossingCacheBySheet(o,r))}))}_initTriggerCacheUpdateListener(){this.disposeWithMe(this._zebraCacheUpdateSubject.subscribe(({unitId:t,subUnitId:n})=>{this._sheetRangeThemeModel.refreshSheetRowVisibleFuncSet(t,n),this._sheetRangeThemeModel.refreshZebraCrossingCacheBySheet(t,n)}))}},g.ZebraCrossingCacheController=fd([eo(0,i.Inject(i.ICommandService)),eo(1,i.Inject(g.SheetRangeThemeModel)),eo(2,i.Inject(i.IUniverInstanceService))],g.ZebraCrossingCacheController);var Id=Object.getOwnPropertyDescriptor,vd=(s,e,t,n)=>{for(var o=n>1?void 0:n?Id(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},Bi=(s,e)=>(t,n)=>e(t,n,s);g.RangeProtectionRenderModel=class{constructor(e,t){f(this,"_cache",new i.LRUMap(1e4));this._selectionProtectionRuleModel=e,this._permissionService=t,this._init()}_init(){this._permissionService.permissionPointUpdate$.pipe(Dt.filter(e=>e.type===D.SelectRange),Dt.filter(e=>ue().some(t=>e instanceof t)),Dt.map(e=>e)).subscribe(e=>{const t=this._selectionProtectionRuleModel.getSubunitRuleList(e.unitId,e.subUnitId);for(const n of t)n.permissionId===e.permissionId&&n.ranges.forEach(o=>{i.Range.foreach(o,(r,a)=>{const l=this._createKey(e.unitId,e.subUnitId,r,a);this._cache.delete(l)})})}),this._selectionProtectionRuleModel.ruleChange$.subscribe(e=>{var t;e.rule.ranges.forEach(n=>{i.Range.foreach(n,(o,r)=>{const a=this._createKey(e.unitId,e.subUnitId,o,r);this._cache.delete(a)})}),e.type==="set"&&((t=e.oldRule)==null||t.ranges.forEach(n=>{i.Range.foreach(n,(o,r)=>{const a=this._createKey(e.unitId,e.subUnitId,o,r);this._cache.delete(a)})}))})}_createKey(e,t,n,o){return`${e}_${t}_${n}_${o}`}getCellInfo(e,t,n,o){const r=this._selectionProtectionRuleModel.getSubunitRuleList(e,t),a=[];if(!r||!r.length)return a;const l=this._createKey(e,t,n,o),u=this._cache.get(l);if(u)return u;const d=[];for(const c of r)if(c.ranges.some(h=>h.startRow<=n&&h.endRow>=n&&h.startColumn<=o&&h.endColumn>=o)){const h=ue().reduce((m,R)=>{var I;const C=new R(e,t,c.permissionId),S=this._permissionService.getPermissionPoint(C.id);return m[C.subType]=(I=S==null?void 0:S.value)!=null?I:C.value,m},{});d.push({...h,ruleId:c.id,ranges:c.ranges})}return this._cache.set(l,d),d}clear(){this._cache.clear()}},g.RangeProtectionRenderModel=vd([Bi(0,i.Inject(X)),Bi(1,i.Inject(i.IPermissionService))],g.RangeProtectionRenderModel);var pd=Object.getOwnPropertyDescriptor,wd=(s,e,t,n)=>{for(var o=n>1?void 0:n?pd(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},to=(s,e)=>(t,n)=>e(t,n,s);g.RangeProtectionCache=class extends i.Disposable{constructor(t,n,o){super();f(this,"_cellRuleCache",new Map);f(this,"_permissionIdCache",new Map);f(this,"_cellInfoCache",new Map);f(this,"_rowInfoCache",new Map);f(this,"_colInfoCache",new Map);this._ruleModel=t,this._permissionService=n,this._univerInstanceService=o,this._initUpdateCellRuleCache(),this._initUpdateCellInfoCache(),this._initUpdateRowColInfoCache(),this._initCache()}_initCache(){this._univerInstanceService.getAllUnitsForType(i.UniverInstanceType.UNIVER_SHEET).forEach(t=>{t.getSheets().forEach(n=>{const o=t.getUnitId(),r=n.getSheetId();this.reBuildCache(o,r)})})}_initUpdateCellInfoCache(){this._permissionService.permissionPointUpdate$.pipe(O.filter(t=>t.type===D.SelectRange),O.map(t=>t)).subscribe(t=>{const{subUnitId:n,unitId:o,permissionId:r}=t,a=this._permissionIdCache.get(r);if(!a)return;const l=this._ruleModel.getRule(o,n,a);if(!l)return;const u=this._ensureCellInfoMap(o,n);l.ranges.forEach(d=>{const{startRow:c,endRow:h,startColumn:m,endColumn:R}=d;for(let C=c;C<=h;C++)for(let S=m;S<=R;S++)u.delete(`${C}-${S}`)})}),this._ruleModel.ruleChange$.subscribe(t=>{var a;const{unitId:n,subUnitId:o}=t,r=this._ensureCellInfoMap(n,o);t.rule.ranges.forEach(l=>{i.Range.foreach(l,(u,d)=>{r.delete(`${u}-${d}`)})}),t.type==="set"&&((a=t.oldRule)==null||a.ranges.forEach(l=>{i.Range.foreach(l,(u,d)=>{this._cellInfoCache.delete(`${u}-${d}`)})}))})}_initUpdateCellRuleCache(){this._ruleModel.ruleChange$.subscribe(t=>{const{type:n}=t;n==="add"?this._addCellRuleCache(t):n==="delete"?this._deleteCellRuleCache(t):(this._deleteCellRuleCache({...t,rule:t.oldRule}),this._addCellRuleCache(t))})}_ensureRuleMap(t,n){let o=this._cellRuleCache.get(t);o||(o=new Map,this._cellRuleCache.set(t,o));let r=o.get(n);return r||(r=new Map,o.set(n,r)),r}_ensureCellInfoMap(t,n){let o=this._cellInfoCache.get(t);o||(o=new Map,this._cellInfoCache.set(t,o));let r=o.get(n);return r||(r=new Map,o.set(n,r)),r}_ensureRowColInfoMap(t,n,o){let r=o==="row"?this._rowInfoCache.get(t):this._colInfoCache.get(t);r||(r=new Map,o==="row"?this._rowInfoCache.set(t,r):this._colInfoCache.set(t,r));let a=r.get(n);return a||(a=new Map,r.set(n,a)),a}_addCellRuleCache(t){const{subUnitId:n,unitId:o,rule:r}=t,a=this._ensureRuleMap(o,n);r.ranges.forEach(l=>{const{startRow:u,endRow:d,startColumn:c,endColumn:h}=l;for(let m=u;m<=d;m++)for(let R=c;R<=h;R++)a.set(`${m}-${R}`,r.id)}),this._permissionIdCache.set(r.permissionId,r.id)}_deleteCellRuleCache(t){const{subUnitId:n,unitId:o,rule:r}=t,a=this._ensureRuleMap(o,n),l=this._ensureCellInfoMap(o,n);r.ranges.forEach(u=>{const{startRow:d,endRow:c,startColumn:h,endColumn:m}=u;for(let R=d;R<=c;R++)for(let C=h;C<=m;C++)a.delete(`${R}-${C}`),l.delete(`${R}-${C}`)}),this._permissionIdCache.delete(r.permissionId)}_getSelectionActions(t,n,o){var c,h,m,R,C,S,I,v,M,p,w,y;const r=(m=(h=this._permissionService.getPermissionPoint((c=new Se(t,n,o.permissionId))==null?void 0:c.id))==null?void 0:h.value)!=null?m:!1,a=(S=(C=this._permissionService.getPermissionPoint((R=new dn(t,n,o.permissionId))==null?void 0:R.id))==null?void 0:C.value)!=null?S:!1,l=(M=(v=this._permissionService.getPermissionPoint((I=new Js(t,n,o.permissionId))==null?void 0:I.id))==null?void 0:v.value)!=null?M:!1,u=(y=(w=this._permissionService.getPermissionPoint((p=new Ks(t,n,o.permissionId))==null?void 0:p.id))==null?void 0:w.value)!=null?y:!1;return{[_.Edit]:r,[_.View]:a,[_.ManageCollaborator]:l,[_.Delete]:u}}reBuildCache(t,n){const o=this._ensureRuleMap(t,n),r=this._ensureCellInfoMap(t,n);o.clear(),r.clear();const a=this._ensureRowColInfoMap(t,n,"row"),l=this._ensureRowColInfoMap(t,n,"col");a.clear(),l.clear(),this._ruleModel.getSubunitRuleList(t,n).forEach(u=>{const d=this._getSelectionActions(t,n,u),c={...d,ruleId:u.id,ranges:u.ranges};u.ranges.forEach(h=>{const{startRow:m,endRow:R,startColumn:C,endColumn:S}=h;for(let I=m;I<=R;I++){const v=a.get(`${I}`);v?v.set(u.id,d):a.set(`${I}`,new Map([[u.id,d]]));for(let M=C;M<=S;M++){o.set(`${I}-${M}`,u.id),r.set(`${I}-${M}`,c);const p=l.get(`${M}`);p?p.set(u.id,d):l.set(`${M}`,new Map([[u.id,d]]))}}}),this._permissionIdCache.set(u.permissionId,u.id)})}getRowPermissionInfo(t,n,o,r){var u;const a=(u=this._rowInfoCache.get(t))==null?void 0:u.get(n);if(!a)return!0;const l=a.get(`${o}`);return l?r.every(d=>{for(const c of l.values())if(c[d]===!1)return!1;return!0}):!0}getColPermissionInfo(t,n,o,r){var u;const a=(u=this._colInfoCache.get(t))==null?void 0:u.get(n);if(!a)return!0;const l=a.get(`${o}`);return l?r.every(d=>{for(const c of l.values())if(c[d]===!1)return!1;return!0}):!0}_initUpdateRowColInfoCache(){this._permissionService.permissionPointUpdate$.pipe(O.filter(t=>t.type===D.SelectRange),O.map(t=>t)).subscribe({next:t=>{const{subUnitId:n,unitId:o,permissionId:r}=t,a=this._permissionIdCache.get(r);if(!a)return;const l=this._ruleModel.getRule(o,n,a);if(!l)return;const u=this._ensureRowColInfoMap(o,n,"row"),d=this._ensureRowColInfoMap(o,n,"col"),c=this._getSelectionActions(o,n,l);l.ranges.forEach(h=>{const{startRow:m,endRow:R,startColumn:C,endColumn:S}=h;for(let I=m;I<=R;I++){const v=u.get(`${I}`);v?v.set(a,c):u.set(`${I}`,new Map([[a,c]]));for(let M=C;M<=S;M++){const p=d.get(`${M}`);p?p.set(a,c):d.set(`${M}`,new Map([[a,c]]))}}})}}),this._ruleModel.ruleChange$.subscribe(t=>{if(t.type==="delete"){const{unitId:n,subUnitId:o,rule:r}=t,a=this._ensureRowColInfoMap(n,o,"row"),l=this._ensureRowColInfoMap(n,o,"col");r.ranges.forEach(u=>{const{startRow:d,endRow:c,startColumn:h,endColumn:m}=u;for(let R=d;R<=c;R++){const C=a.get(`${R}`);C==null||C.delete(r.id);for(let S=h;S<=m;S++){const I=l.get(`${S}`);I==null||I.delete(r.id)}}})}})}getCellInfo(t,n,o,r){var c,h;const a=this._ensureCellInfoMap(t,n),l=a.get(`${o}-${r}`);if(l)return l;const u=(h=(c=this._cellRuleCache.get(t))==null?void 0:c.get(n))==null?void 0:h.get(`${o}-${r}`);if(!u)return;const d=this._ruleModel.getRule(t,n,u);if(d){const R={...this._getSelectionActions(t,n,d),ruleId:u,ranges:d.ranges};return a.set(`${o}-${r}`,R),R}}deleteUnit(t){this._cellRuleCache.delete(t),this._cellInfoCache.delete(t),this._rowInfoCache.delete(t),this._colInfoCache.delete(t);const n=this._univerInstanceService.getUnit(t);n==null||n.getSheets().forEach(o=>{const r=o.getSheetId();this._ruleModel.getSubunitRuleList(t,r).forEach(a=>{this._permissionIdCache.delete(a.permissionId)})})}},g.RangeProtectionCache=wd([to(0,i.Inject(X)),to(1,i.Inject(i.IPermissionService)),to(2,i.Inject(i.IUniverInstanceService))],g.RangeProtectionCache);var Md=Object.getOwnPropertyDescriptor,yd=(s,e,t,n)=>{for(var o=n>1?void 0:n?Md(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},Hi=(s,e)=>(t,n)=>e(t,n,s);let On=class extends i.Disposable{constructor(e,t){super();f(this,"_previousSheetIndex",-1);this._commandService=e,this._univerInstanceService=t,this.disposeWithMe(this._commandService.beforeCommandExecuted(n=>{if(n.id===He.id)return this._beforeAdjustActiveSheetOnRemoveSheet(n)})),this.disposeWithMe(this._commandService.onCommandExecuted((n,o)=>{if(n.id===He.id)return this._adjustActiveSheetOnRemoveSheet(n);if(n.id===De.id&&n.params.hidden)return this._adjustActiveSheetOnHideSheet(n);if(o!=null&&o.fromCollab)return!1;if(n.id===it.id)return this._adjustActiveSheetOnInsertSheet(n);if(n.id===De.id&&!n.params.hidden)return this._adjustActiveSheetOnShowSheet(n);if(n.id===q.id)return this._adjustActiveSheetOnSelection(n)}))}_adjustActiveSheetOnHideSheet(e){var u;const{unitId:t,subUnitId:n}=e.params,o=this._univerInstanceService.getUniverSheetInstance(t);if(!o||((u=o.getActiveSheet())==null?void 0:u.getSheetId())!==n)return;const a=o.getActiveSheetIndex(),l=Fi(o,a);this._switchToNextSheet(t,l)}_beforeAdjustActiveSheetOnRemoveSheet(e){const{unitId:t,subUnitId:n}=e.params,o=this._univerInstanceService.getUniverSheetInstance(t);if(!o)return;const r=o.getSheetBySheetId(n);r&&(this._previousSheetIndex=o.getSheetIndex(r))}_adjustActiveSheetOnRemoveSheet(e){if(this._previousSheetIndex===-1)return;const{unitId:t}=e.params,n=this._univerInstanceService.getUniverSheetInstance(t);if(!n)return;if(n.getActiveSheet().getSheetId()===e.params.subUnitId){const r=this._previousSheetIndex,a=r>=1?r-1:0,l=Fi(n,a);this._switchToNextSheet(t,l)}}_adjustActiveSheetOnInsertSheet(e){const{unitId:t,sheet:n}=e.params;this._switchToNextSheet(t,n.id)}_adjustActiveSheetOnShowSheet(e){const{unitId:t,subUnitId:n}=e.params;this._switchToNextSheet(t,n)}_adjustActiveSheetOnSelection(e){var o;const{unitId:t,subUnitId:n}=e.params;n!==((o=this._univerInstanceService.getUnit(t))==null?void 0:o.getActiveSheet().getSheetId())&&this._switchToNextSheet(t,n)}_switchToNextSheet(e,t){this._commandService.executeCommand(Ze.id,{unitId:e,subUnitId:t})}};On=yd([Hi(0,i.ICommandService),Hi(1,i.IUniverInstanceService)],On);function Fi(s,e){const t=s.getSheetSize();for(let n=e;n>-1;n--){const o=s.getSheetByIndex(n);if(!o.getConfig().hidden)return o.getSheetId()}for(let n=e;n<t;n++){const o=s.getSheetByIndex(n);if(!o.getConfig().hidden)return o.getSheetId()}throw new Error("[ActiveWorksheetController]: could not find the next unhidden sheet! Collaboration error perhaps.")}const ji="ONLY_REGISTER_FORMULA_RELATED_MUTATIONS_KEY";var _d=Object.getOwnPropertyDescriptor,bd=(s,e,t,n)=>{for(var o=n>1?void 0:n?_d(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},no=(s,e)=>(t,n)=>e(t,n,s);let Dn=class extends i.Disposable{constructor(s,e,t){var o;super(),this._commandService=s,this._configService=e,this._dataSyncPrimaryController=t,[F,ie,re,it,Fe,we,Me,ne,ae,He,G,Zs,j,zs,Kt,Pn,Wt,Ni,Xe,Je,Oi,Di,Vs].forEach(r=>{var a;this._commandService.registerCommand(r),(a=this._dataSyncPrimaryController)==null||a.registerSyncingMutations(r)}),((o=this._configService.getConfig(ji))!=null?o:!1)||[ot,Ar,Wr,Vr,Br,rn,vn,an,Gr,Ge,ze,Yt,Xt,ar,ir,lr,ur,_s,_e,et,yt,nr,tr,or,sr,ys,ye,Kr,bt,Qe,_t,bs,Ft,Es,Ht,wn,Sn,Xr,mi,ci,hi,ti,ei,Ut,Zr,Qr,yn,mt,gt,xt,ni,ht,oi,Oe,ri,Ri,Mt,Zt,_n,li,Ct,Hs,Gs,kt,Pt,te,fi,qt,di,Si,Ci,gi,qs,Ys,Ze,wi,De,bn,xs,Jt,qn,Te,kn,Re,Le,bi,It,Ii,St,Go,q,Vi,xr,Ls,Fs,Xs,Ui,vt,ii,Rt,yi,qe,lt,rt,Tn,$o,ai,zr,$r,qr,_i,Ce,Ue,ee,Ti,ft,vi,Ei,ct,dt,pn,Tt,ki,Jr,Lr,Yr,Pi,Wi,Ai].forEach(r=>this.disposeWithMe(this._commandService.registerCommand(r))),this._configService.setConfig($i,nd)}};Dn=bd([no(0,i.ICommandService),no(1,i.IConfigService),no(2,i.Optional(ea.DataSyncPrimaryController))],Dn);var Ed=Object.getOwnPropertyDescriptor,Td=(s,e,t,n)=>{for(var o=n>1?void 0:n?Ed(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},Gi=(s,e)=>(t,n)=>e(t,n,s);let An=class extends i.Disposable{constructor(s,e){super(),this._univerInstanceService=s,this._commandService=e,this._initialize()}_initialize(){this.disposeWithMe(this._commandService.onCommandExecuted(s=>{if(s.id!==K.SetFormulaCalculationResultMutation.id)return;const e=s.params,{unitData:t}=e,n=Object.keys(t),o=[];for(let a=0;a<n.length;a++){const l=n[a],u=t[l];if(u==null)continue;const d=Object.keys(u);for(let c=0;c<d.length;c++){const h=d[c],m=u[h];if(m==null)continue;const R=this._getMergedCellData(l,h,m),C={subUnitId:h,unitId:l,cellValue:R};o.push({id:F.id,params:C})}}return o.every(a=>this._commandService.executeCommand(a.id,a.params,{onlyLocal:!0,fromFormula:!0}))}))}_getMergedCellData(s,e,t){const n=this._univerInstanceService.getUniverSheetInstance(s),o=n==null?void 0:n.getStyles(),r=n==null?void 0:n.getSheetBySheetId(e),a=r==null?void 0:r.getCellMatrix(),l=new i.ObjectMatrix(t);return l.forValue((u,d,c)=>{const h=a==null?void 0:a.getValue(u,d),m=K.handleNumfmtInCell(h,c,o);l.setValue(u,d,m)}),l.getMatrix()}};An=Td([Gi(0,i.Inject(i.IUniverInstanceService)),Gi(1,i.ICommandService)],An);var Ud=Object.getOwnPropertyDescriptor,kd=(s,e,t,n)=>{for(var o=n>1?void 0:n?Ud(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},Pd=(s,e)=>(t,n)=>e(t,n,s);let Wn=class extends i.Disposable{constructor(s){super(),this._sheetInterceptorService=s,this._initialize()}_initialize(){this._initInterceptorCellContent()}_initInterceptorCellContent(){this.disposeWithMe(this._sheetInterceptorService.intercept(Ve.CELL_CONTENT,{priority:11,effect:i.InterceptorEffectEnum.Value|i.InterceptorEffectEnum.Style,handler:(s,e,t)=>{var o;if(!s)return t(s);const n=e.workbook.getStyles().getStyleByCell(s);return i.isDefaultFormat((o=n==null?void 0:n.n)==null?void 0:o.pattern)&&(s==null?void 0:s.t)===i.CellValueType.NUMBER&&s.v!==void 0&&s.v!==null&&i.isRealNum(s.v)&&((!s||s===e.rawData)&&(s={...e.rawData}),s.v=K.stripErrorMargin(Number(s.v))),t(s)}}))}};Wn=kd([Pd(0,i.Inject(g.SheetInterceptorService))],Wn);var Nd=Object.getOwnPropertyDescriptor,Od=(s,e,t,n)=>{for(var o=n>1?void 0:n?Nd(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},Vn=(s,e)=>(t,n)=>e(t,n,s);let $n=class extends i.Disposable{constructor(s,e,t,n){super(),this._permissionService=s,this._worksheetProtectionRuleModel=e,this._sheetInterceptorService=t,this._rangeProtectionCache=n,this._initViewModelByRangeInterceptor(),this._initViewModelBySheetInterceptor()}_initViewModelByRangeInterceptor(){this.disposeWithMe(this._sheetInterceptorService.intercept(Ve.CELL_CONTENT,{priority:999,effect:i.InterceptorEffectEnum.Value|i.InterceptorEffectEnum.Style,handler:(s,e,t)=>{const{unitId:n,subUnitId:o,row:r,col:a}=e,l=this._rangeProtectionCache.getCellInfo(n,o,r,a);if(l){const u=l[_.View]===!1,d=!s||s===e.rawData?{...e.rawData}:s;return d.selectionProtection=[l],u?(delete d.s,delete d.v,delete d.p,d):t(d)}return t(s)}}))}_initViewModelBySheetInterceptor(){this.disposeWithMe(this._sheetInterceptorService.intercept(Ve.CELL_CONTENT,{priority:999,effect:i.InterceptorEffectEnum.Value|i.InterceptorEffectEnum.Style,handler:(s,e,t)=>{var a,l,u,d,c;const{unitId:n,subUnitId:o}=e,r=this._worksheetProtectionRuleModel.getRule(n,o);if(r!=null&&r.permissionId){const h=[{[_.View]:(l=(a=this._permissionService.getPermissionPoint(new Bt(n,o).id))==null?void 0:a.value)!=null?l:!1,[_.Edit]:(d=(u=this._permissionService.getPermissionPoint(new fe(n,o).id))==null?void 0:u.value)!=null?d:!1}],m=!((c=h[0])!=null&&c[_.View]),R=!s||s===e.rawData?{...s}:s;return R.hasWorksheetRule=!0,R.selectionProtection=h,m?(delete R.s,delete R.v,delete R.p,R):t(R)}return t(s)}}))}};$n=Od([Vn(0,i.IPermissionService),Vn(1,i.Inject(Ne)),Vn(2,i.Inject(g.SheetInterceptorService)),Vn(3,i.Inject(g.RangeProtectionCache))],$n);const so=i.createIdentifier("univer.exclusive-range-service");class zi extends i.Disposable{constructor(){super(...arguments);f(this,"_exclusiveRanges",new Map);f(this,"_exclusiveRangesChange$",new O.Subject);f(this,"exclusiveRangesChange$",this._exclusiveRangesChange$.asObservable())}_ensureUnitMap(t){return this._exclusiveRanges.has(t)||this._exclusiveRanges.set(t,new Map),this._exclusiveRanges.get(t)}_ensureSubunitMap(t,n){const o=this._ensureUnitMap(t);return o.has(n)||o.set(n,new Map),o.get(n)}_ensureFeature(t,n,o){const r=this._ensureSubunitMap(t,n);return r.has(o)||r.set(o,[]),r.get(o)}addExclusiveRange(t,n,o,r){const a=this._ensureFeature(t,n,o);a.push(...r),this._exclusiveRangesChange$.next({unitId:t,subUnitId:n,ranges:a.map(l=>l.range)})}getExclusiveRanges(t,n,o){var r,a;return(a=(r=this._exclusiveRanges.get(t))==null?void 0:r.get(n))==null?void 0:a.get(o)}clearExclusiveRanges(t,n,o){const r=this.getExclusiveRanges(t,n,o);this._exclusiveRangesChange$.next({unitId:t,subUnitId:n,ranges:(r==null?void 0:r.map(a=>a.range))||[]}),this._ensureFeature(t,n,o),this._exclusiveRanges.get(t).get(n).set(o,[])}clearExclusiveRangesByGroupId(t,n,o,r){const a=this.getExclusiveRanges(t,n,o);this._exclusiveRangesChange$.next({unitId:t,subUnitId:n,ranges:(a==null?void 0:a.map(u=>u.range))||[]});const l=this.getExclusiveRanges(t,n,o);if(l){const u=l.filter(d=>d.groupId!==r);this._exclusiveRanges.get(t).get(n).set(o,u)}}getInterestGroupId(t){const n=[];return t.forEach(o=>{var d;const r=o.range,{unitId:a,sheetId:l}=r;if(!a||!l)return;const u=(d=this._exclusiveRanges.get(a))==null?void 0:d.get(l);if(u)for(const c of u.keys()){const h=u.get(c);if(h){for(const m of h)if(i.Rectangle.intersects(r,m.range)){n.push(c);break}}}}),n}}var Dd=Object.getOwnPropertyDescriptor,Ad=(s,e,t,n)=>{for(var o=n>1?void 0:n?Dd(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},oo=(s,e)=>(t,n)=>e(t,n,s);g.NumfmtService=class extends i.Disposable{constructor(e,t,n){super(),this._resourceManagerService=e,this._univerInstanceService=t,this._logService=n}getValue(e,t,n,o){const r=this._univerInstanceService.getUniverSheetInstance(e);if(!r)return;const a=r==null?void 0:r.getSheetBySheetId(t);if(!a)return;const l=r.getStyles(),u=a.getCellRaw(n,o);if(u!=null&&u.s){const d=l.get(u.s);if(d!=null&&d.n)return d.n}return null}deleteValues(e,t,n){const o=this._univerInstanceService.getUniverSheetInstance(e);if(!o)return;const r=o==null?void 0:o.getSheetBySheetId(t);if(!r)return;const a=o.getStyles();n.forEach(l=>{i.Range.foreach(l,(u,d)=>{const c=r.getCellRaw(u,d);if(!c)return;const h=c==null?void 0:c.s,R={...h&&a.get(h)||{}};delete R.n;const C=a.setValue(R);c.s=C})})}setValues(e,t,n){const o=this._univerInstanceService.getUniverSheetInstance(e);if(!o)return;const r=o==null?void 0:o.getSheetBySheetId(t);if(!r)return;const a=o.getStyles(),l=r.getCellMatrix();n.forEach(u=>{u.ranges.forEach(d=>{i.Range.foreach(d,(c,h)=>{const m=r.getCellRaw(c,h);if(m){const C={...a.getStyleByCell(m)||{},n:{pattern:u.pattern}},S=a.setValue(C);m.s=S}else{const R={n:{pattern:u.pattern}},C=a.setValue(R);C&&l.setValue(c,h,{s:C})}})})})}},g.NumfmtService=Ad([oo(0,i.IResourceManagerService),oo(1,i.IUniverInstanceService),oo(2,i.ILogService)],g.NumfmtService);var Wd=Object.getOwnPropertyDescriptor,Vd=(s,e,t,n)=>{for(var o=n>1?void 0:n?Wd(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},Ke=(s,e)=>(t,n)=>e(t,n,s);const qi=[ie.id,re.id,ne.id,ae.id],Yi=[we.id,Me.id];g.RangeProtectionRefRangeService=class extends i.Disposable{constructor(t,n,o,r,a,l,u,d){super();f(this,"disposableCollection",new i.DisposableCollection);this._selectionProtectionRuleModel=t,this._univerInstanceService=n,this._commandService=o,this._refRangeService=r,this._selectionProtectionRenderModel=a,this._rangeProtectionCache=l,this._sheetInterceptorService=u,this._rangeProtectionRuleModel=d,this._onRefRangeChange(),this._correctPermissionRange(),this._initReBuildCache(),this._initRemoveSheet()}_onRefRangeChange(){const t=(o,r)=>{const a=this._univerInstanceService.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET);if(!a||!(a==null?void 0:a.getSheetBySheetId(r)))return;this.disposableCollection.dispose();const u=c=>this.refRangeHandle(c,o,r);this._selectionProtectionRuleModel.getSubunitRuleList(o,r).reduce((c,h)=>[...c,...h.ranges],[]).forEach(c=>{this.disposableCollection.add(this._refRangeService.registerRefRange(c,u,o,r))})};this.disposeWithMe(this._commandService.onCommandExecuted(o=>{if(o.id===Ys.id){const r=o.params,a=r.subUnitId,l=r.unitId;if(!a||!l)return;t(l,a)}if(o.id===ee.id||o.id===Ce.id){const r=o.params,a=r.subUnitId,l=r.unitId;if(!a||!l)return;t(l,a)}}));const n=this._univerInstanceService.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET);if(n){const o=n.getActiveSheet();if(!o)return;t(n.getUnitId(),o.getSheetId())}}refRangeHandle(t,n,o){switch(t.id){case _t.id:return this._getRefRangeMutationsByMoveRows(t.params,n,o);case bt.id:return this._getRefRangeMutationsByMoveCols(t.params,n,o);case ye.id:return this._getRefRangeMutationsByInsertRows(t.params,n,o);case _e.id:return this._getRefRangeMutationsByInsertCols(t.params,n,o);case Ft.id:return this._getRefRangeMutationsByDeleteCols(t.params,n,o);case Ht.id:return this._getRefRangeMutationsByDeleteRows(t.params,n,o)}return{redos:[],undos:[]}}_getRefRangeMutationsByDeleteCols(t,n,o){const r=this._selectionProtectionRuleModel.getSubunitRuleList(n,o).filter(l=>l.ranges.some(u=>i.Rectangle.intersects(u,t.range))),a=t.range;if(r.length){const l=[],u=[];return r.forEach(d=>{const c=i.Tools.deepClone(d),h=c.ranges.reduce((m,R)=>{if(i.Rectangle.intersects(R,a)){const C=i.Tools.deepClone(R),{startColumn:S,endColumn:I}=a;if(S<=C.startColumn&&I>=C.endColumn)return m;S>=C.startColumn&&I<=C.endColumn?C.endColumn-=I-S+1:S<C.startColumn?(C.startColumn=S,C.endColumn-=I-S+1):I>C.endColumn&&(C.endColumn=S-1),this._checkIsRightRange(C)&&m.push(C)}return m},[]);c.ranges=h,c.ranges.length?(l.push({id:ee.id,params:{unitId:n,subUnitId:o,rule:c,ruleId:d.id}}),u.push({id:ee.id,params:{unitId:n,subUnitId:o,rule:d,ruleId:d.id}})):(l.push({id:Ue.id,params:{unitId:n,subUnitId:o,ruleIds:[d.id]}}),u.push({id:Ce.id,params:{unitId:n,subUnitId:o,name:"",rules:[d]}}))}),{redos:l,undos:u}}return{undos:[],redos:[]}}_getRefRangeMutationsByDeleteRows(t,n,o){const r=this._selectionProtectionRuleModel.getSubunitRuleList(n,o).filter(l=>l.ranges.some(u=>i.Rectangle.intersects(u,t.range))),a=t.range;if(r.length){const l=[],u=[];return r.forEach(d=>{const c=i.Tools.deepClone(d),h=c.ranges.reduce((m,R)=>{if(i.Rectangle.intersects(R,a)){const C=i.Tools.deepClone(R),{startRow:S,endRow:I}=a;if(S<=C.startRow&&I>=C.endRow)return m;S>=C.startRow&&I<=C.endRow?C.endRow-=I-S+1:S<C.startRow?(C.startRow=S,C.endRow-=I-S+1):I>C.endRow&&(C.endRow=S-1),this._checkIsRightRange(C)&&m.push(C)}return m},[]);c.ranges=h,l.push({id:ee.id,params:{unitId:n,subUnitId:o,rule:c,ruleId:d.id}}),u.push({id:ee.id,params:{unitId:n,subUnitId:o,rule:d,ruleId:d.id}})}),{redos:l,undos:u}}return{undos:[],redos:[]}}_getRefRangeMutationsByInsertCols(t,n,o){const r=t.range.startColumn,a=t.range.endColumn-t.range.startColumn+1,l=this._selectionProtectionRuleModel.getSubunitRuleList(n,o).filter(u=>u.ranges.some(d=>r>d.startColumn&&r<=d.endColumn));if(l.length){const u=[],d=[];return l.forEach(c=>{const h=i.Tools.deepClone(c);let m=!1;h.ranges.forEach(R=>{r>R.startColumn&&r<=R.endColumn&&(R.endColumn+=a,m=!0)}),m&&(u.push({id:ee.id,params:{unitId:n,subUnitId:o,rule:h,ruleId:c.id}}),d.push({id:ee.id,params:{unitId:n,subUnitId:o,rule:c,ruleId:c.id}}))}),{redos:u,undos:d}}return{undos:[],redos:[]}}_getRefRangeMutationsByInsertRows(t,n,o){const r=t.range.startRow,a=t.range.endRow-t.range.startRow+1,l=this._selectionProtectionRuleModel.getSubunitRuleList(n,o).filter(u=>u.ranges.some(d=>r>d.startRow&&r<=d.endRow));if(l.length){const u=[],d=[];return l.forEach(c=>{const h=i.Tools.deepClone(c);let m=!1;h.ranges.forEach(R=>{r>R.startRow&&r<=R.endRow&&(R.endRow+=a,m=!0)}),m&&(u.push({id:ee.id,params:{unitId:n,subUnitId:o,rule:h,ruleId:c.id}}),d.push({id:ee.id,params:{unitId:n,subUnitId:o,rule:c,ruleId:c.id}}))}),{redos:u,undos:d}}return{undos:[],redos:[]}}_getRefRangeMutationsByMoveRows(t,n,o){const r=t.toRange,a=r.startRow,l=r.endRow-r.startRow+1,u=this._selectionProtectionRuleModel.getSubunitRuleList(n,o).filter(d=>d.ranges.some(c=>a>c.startRow&&a<=c.endRow));if(u.length){const d=[],c=[];return u.forEach(h=>{const m=i.Tools.deepClone(h),C=t.fromRange.startRow;let S=!1;m.ranges.forEach(I=>{a>I.startRow&&a<=I.endRow&&(C<I.startRow&&(I.startRow=I.startRow-l,I.endRow=I.endRow-l),I.endRow+=l,S=!0)}),S&&(d.push({id:ee.id,params:{unitId:n,subUnitId:o,rule:m,ruleId:h.id}}),c.push({id:ee.id,params:{unitId:n,subUnitId:o,rule:h,ruleId:h.id}}))}),{redos:d,undos:c}}return{undos:[],redos:[]}}_getRefRangeMutationsByMoveCols(t,n,o){const r=t.toRange,a=r.startColumn,l=r.endColumn-r.startColumn+1,u=this._selectionProtectionRuleModel.getSubunitRuleList(n,o).filter(d=>d.ranges.some(c=>a>c.startColumn&&a<=c.endColumn));if(u.length){const d=[],c=[];return u.forEach(h=>{const m=i.Tools.deepClone(h),C=t.fromRange.startColumn;let S=!1;m.ranges.forEach(I=>{a>I.startColumn&&a<=I.endColumn&&(C<I.startColumn&&(I.startColumn=I.startColumn-l,I.endColumn=I.endColumn-l),I.endColumn+=l,S=!0)}),S&&(d.push({id:ee.id,params:{unitId:n,subUnitId:o,rule:m,ruleId:h.id}}),c.push({id:ee.id,params:{unitId:n,subUnitId:o,rule:h,ruleId:h.id}}))}),{redos:d,undos:c}}return{undos:[],redos:[]}}_correctPermissionRange(){this.disposeWithMe(this._commandService.onCommandExecuted(t=>{if(Yi.includes(t.id)){if(!t.params)return;const n=this._univerInstanceService.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET);if(!n)return;const o=n.getSheetBySheetId(t.params.subUnitId);if(!o)return;const{sourceRange:r,targetRange:a}=t.params,l=r.startColumn===a.startColumn&&r.endColumn===a.endColumn,u=l?r.endRow-r.startRow+1:r.endColumn-r.startColumn+1,d=l?r.startRow:r.startColumn,c=l?a.startRow:a.startColumn;this._selectionProtectionRuleModel.getSubunitRuleList(n.getUnitId(),o.getSheetId()).forEach(I=>{I.ranges.forEach(M=>{let{startRow:p,endRow:w,startColumn:y,endColumn:b}=M;i.Rectangle.intersects(M,r)||(l?d<p&&c>w?(p-=u,w-=u):d>w&&c<=p&&(p+=u,w+=u):d<y&&c>b?(y-=u,b-=u):d>b&&c<=y&&(y+=u,b+=u)),this._checkIsRightRange({startRow:p,endRow:w,startColumn:y,endColumn:b})&&(M.startColumn=y,M.endColumn=b,M.startRow=p,M.endRow=w)})}),this.disposableCollection.dispose();const{unitId:m,subUnitId:R}=t.params,C=I=>this.refRangeHandle(I,m,R);this._selectionProtectionRuleModel.getSubunitRuleList(m,R).reduce((I,v)=>[...I,...v.ranges],[]).forEach(I=>{this.disposableCollection.add(this._refRangeService.registerRefRange(I,C,m,R))}),this._selectionProtectionRenderModel.clear()}if(qi.includes(t.id)){const n=this._univerInstanceService.getUniverSheetInstance(t.params.unitId);if(!n)return;const o=n.getSheetBySheetId(t.params.subUnitId);if(!o)return;const r=t.params;if(!r)return;const{range:a}=r,l=t.id.includes("row"),u=t.id.includes("insert"),d=l?a.startRow:a.startColumn,c=l?a.endRow:a.endColumn,h=c-d+1;this._selectionProtectionRuleModel.getSubunitRuleList(n.getUnitId(),o.getSheetId()).forEach(v=>{v.ranges.forEach(p=>{let{startRow:w,endRow:y,startColumn:b,endColumn:U}=p;u?l?d<=w&&(w+=h,y+=h):d<=b&&(b+=h,U+=h):l?c<w&&(w-=h,y-=h):c<b&&(b-=h,U-=h),this._checkIsRightRange({startRow:w,endRow:y,startColumn:b,endColumn:U})&&(p.startColumn=b,p.endColumn=U,p.startRow=w,p.endRow=y)})}),this.disposableCollection.dispose();const{unitId:R,subUnitId:C}=t.params,S=v=>this.refRangeHandle(v,R,C);this._selectionProtectionRuleModel.getSubunitRuleList(R,C).reduce((v,M)=>[...v,...M.ranges],[]).forEach(v=>{this.disposableCollection.add(this._refRangeService.registerRefRange(v,S,R,C))}),this._selectionProtectionRenderModel.clear()}}))}_checkIsRightRange(t){return t.startRow<=t.endRow&&t.startColumn<=t.endColumn}_initReBuildCache(){this.disposeWithMe(this._commandService.onCommandExecuted(t=>{if(qi.includes(t.id)||Yi.includes(t.id)){const{unitId:n,subUnitId:o}=t.params;this._rangeProtectionCache.reBuildCache(n,o)}}))}_initRemoveSheet(){this._sheetInterceptorService.interceptCommand({getMutations:t=>{const n=[],o=[],r=[],a=[];if(t.id===wn.id){const l=t.params,u=[],d=[];this._rangeProtectionRuleModel.getSubunitRuleList(l.unitId,l.subUnitId).forEach(c=>{u.push(c.id),d.push(c)}),u.length&&d.length&&(r.push({id:Ue.id,params:{unitId:l.unitId,subUnitId:l.subUnitId,ruleIds:u}}),n.push({id:Ce.id,params:{unitId:l.unitId,subUnitId:l.subUnitId,name:"",rules:d}}))}return{redos:o,undos:n,preRedos:r,preUndos:a}}})}},g.RangeProtectionRefRangeService=Vd([Ke(0,i.Inject(X)),Ke(1,i.Inject(i.IUniverInstanceService)),Ke(2,i.ICommandService),Ke(3,i.Inject(g.RefRangeService)),Ke(4,i.Inject(g.RangeProtectionRenderModel)),Ke(5,i.Inject(g.RangeProtectionCache)),Ke(6,i.Inject(g.SheetInterceptorService)),Ke(7,i.Inject(X))],g.RangeProtectionRefRangeService);var $d=Object.getOwnPropertyDescriptor,Ld=(s,e,t,n)=>{for(var o=n>1?void 0:n?$d(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},en=(s,e)=>(t,n)=>e(t,n,s);const Bd="SHEET_RANGE_PROTECTION_PLUGIN";g.RangeProtectionService=class extends i.Disposable{constructor(e,t,n,o,r){super(),this._selectionProtectionRuleModel=e,this._permissionService=t,this._resourceManagerService=n,this._selectionProtectionCache=o,this._univerInstanceService=r,this._initSnapshot(),this._initRuleChange()}_initRuleChange(){this.disposeWithMe(this._selectionProtectionRuleModel.ruleChange$.subscribe(e=>{switch(e.type){case"add":{ue().forEach(t=>{const n=new t(e.unitId,e.subUnitId,e.rule.permissionId);this._permissionService.addPermissionPoint(n)});break}case"delete":{ue().forEach(t=>{const n=new t(e.unitId,e.subUnitId,e.rule.permissionId);this._permissionService.deletePermissionPoint(n.id)});break}case"set":{e.oldRule.permissionId!==e.rule.permissionId&&ue().forEach(t=>{const n=new t(e.unitId,e.subUnitId,e.oldRule.permissionId);this._permissionService.deletePermissionPoint(n.id);const o=new t(e.unitId,e.subUnitId,e.rule.permissionId);this._permissionService.addPermissionPoint(o)});break}}}))}_initSnapshot(){const e=n=>{const r=this._selectionProtectionRuleModel.toObject()[n];return r?JSON.stringify(r):""},t=n=>{if(!n)return{};try{return JSON.parse(n)}catch{return{}}};this.disposeWithMe(this._resourceManagerService.registerPluginResource({toJson:e,parseJson:t,pluginName:Bd,businesses:[un.UNIVER_SHEET],onLoad:(n,o)=>{const r=this._selectionProtectionRuleModel.toObject();r[n]=o,this._selectionProtectionRuleModel.fromObject(r);const a=[];Object.keys(o).forEach(l=>{const u=o[l];this._selectionProtectionRuleModel.getSubunitRuleList(n,l).forEach(d=>{a.push({objectID:d.permissionId,unitID:n,objectType:D.SelectRange,actions:Ye})}),u.forEach(d=>{ue().forEach(c=>{const h=new c(n,l,d.permissionId);h.value=!1,this._permissionService.addPermissionPoint(h)})}),this._selectionProtectionCache.reBuildCache(n,l)})},onUnLoad:n=>{this._selectionProtectionCache.deleteUnit(n)}}))}},g.RangeProtectionService=Ld([en(0,i.Inject(X)),en(1,i.Inject(i.IPermissionService)),en(2,i.Inject(i.IResourceManagerService)),en(3,i.Inject(g.RangeProtectionCache)),en(4,i.Inject(i.IUniverInstanceService))],g.RangeProtectionService);var Hd=Object.getOwnPropertyDescriptor,Fd=(s,e,t,n)=>{for(var o=n>1?void 0:n?Hd(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},jd=(s,e)=>(t,n)=>e(t,n,s);g.SheetRangeThemeService=class extends i.Disposable{constructor(e){super(),this._sheetRangeThemeModel=e}registerRangeTheme(e,t){this._sheetRangeThemeModel.registerRangeThemeStyle(e,t)}removeRangeThemeRule(e,t){this._sheetRangeThemeModel.removeRangeThemeRule(e,t)}getALLRegisterThemes(e){return this._sheetRangeThemeModel.getALLRegisteredTheme(e)}registerRangeThemeStyle(e,t){this._sheetRangeThemeModel.registerRangeThemeRule(e,t)}getAppliedRangeThemeStyle(e){return this._sheetRangeThemeModel.getRegisteredRangeThemeStyle(e)}getRegisteredRangeThemes(){return this._sheetRangeThemeModel.getRegisteredRangeThemes()}},g.SheetRangeThemeService=Fd([jd(0,i.Inject(g.SheetRangeThemeModel))],g.SheetRangeThemeService);var Gd=Object.defineProperty,zd=Object.getOwnPropertyDescriptor,qd=(s,e,t)=>e in s?Gd(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,Yd=(s,e,t,n)=>{for(var o=n>1?void 0:n?zd(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},xi=(s,e)=>(t,n)=>e(t,n,s),Ki=(s,e,t)=>qd(s,typeof e!="symbol"?e+"":e,t);const xd="SHEET_PLUGIN";g.UniverSheetsPlugin=class extends i.Plugin{constructor(e=Hr,t,n){super(),this._config=e,this._injector=t,this._configService=n;const{...o}=i.merge({},Hr,this._config);this._configService.setConfig(zt,o),this._initConfig(),this._initDependencies()}_initConfig(){var e,t,n;(e=this._config)!=null&&e.onlyRegisterFormulaRelatedMutations&&this._configService.setConfig(ji,!0),(t=this._config)!=null&&t.isRowStylePrecedeColumnStyle&&this._configService.setConfig(i.IS_ROW_STYLE_PRECEDE_COLUMN_STYLE,!0),(n=this._config)!=null&&n.autoHeightForMergedCells&&this._configService.setConfig(i.AUTO_HEIGHT_FOR_MERGED_CELLS,!0)}_initDependencies(){var t;const e=[[at],[g.SheetLazyExecuteScheduleService],[g.SheetsSelectionsService],[g.RefRangeService],[g.WorkbookPermissionService],[ut,{useClass:g.NumfmtService}],[g.SheetInterceptorService],[g.SheetRangeThemeService],[g.SheetSkeletonService],[Dn],[g.MergeCellController],[Wn],[g.DefinedNameDataController],[g.ZebraCrossingCacheController],[g.SheetsFreezeSyncController],[g.WorksheetPermissionService],[Ne],[Nt],[$n],[g.SheetPermissionInitController],[g.SheetPermissionCheckController],[g.SheetRangeThemeModel],[g.RangeProtectionRenderModel],[X],[g.RangeProtectionCache],[g.RangeProtectionRefRangeService],[g.RangeProtectionService],[so,{useClass:zi,deps:[g.SheetsSelectionsService]}]];(t=this._config)!=null&&t.notExecuteFormula||e.push([An]),i.registerDependencies(this._injector,i.mergeOverrideWithDependencies(e,this._config.override)),i.touchDependencies(this._injector,[[g.SheetInterceptorService],[g.RangeProtectionService],[so],[g.SheetPermissionInitController],[g.SheetsFreezeSyncController]])}onStarting(){var e;i.touchDependencies(this._injector,[[Dn],[g.MergeCellController],[g.WorkbookPermissionService],[g.WorksheetPermissionService],[$n],[g.SheetSkeletonService]]),(e=this._config)!=null&&e.onlyRegisterFormulaRelatedMutations||this._injector.add([On])}onRendered(){i.touchDependencies(this._injector,[[ut]])}onReady(){i.touchDependencies(this._injector,[[On],[An],[g.DefinedNameDataController],[g.ZebraCrossingCacheController],[g.SheetRangeThemeModel],[Wn],[g.RangeProtectionRenderModel],[g.RangeProtectionRefRangeService],[g.RefRangeService],[g.SheetPermissionCheckController]])}},Ki(g.UniverSheetsPlugin,"pluginName",xd),Ki(g.UniverSheetsPlugin,"type",i.UniverInstanceType.UNIVER_SHEET),g.UniverSheetsPlugin=Yd([i.DependentOn(K.UniverFormulaEnginePlugin),xi(1,i.Inject(i.Injector)),xi(2,i.IConfigService)],g.UniverSheetsPlugin);const Kd={WorkbookCommentPermission:Jn,WorkbookCopyPermission:Xn,WorkbookCreateProtectPermission:Zn,WorkbookCreateSheetPermission:Qn,WorkbookDeleteSheetPermission:es,WorkbookDuplicatePermission:ts,WorkbookEditablePermission:he,WorkbookExportPermission:ns,WorkbookHideSheetPermission:cn,WorkbookHistoryPermission:Ko,WorkbookManageCollaboratorPermission:hn,WorkbookMoveSheetPermission:mn,WorkbookPrintPermission:ss,WorkbookRecoverHistoryPermission:os,WorkbookRenameSheetPermission:gn,WorkbookSharePermission:rs,WorkbookViewHistoryPermission:as,WorkbookViewPermission:is,WorksheetCopyPermission:ls,WorksheetDeleteColumnPermission:us,WorksheetDeleteProtectionPermission:ds,WorksheetDeleteRowPermission:cs,WorksheetEditExtraObjectPermission:hs,WorksheetEditPermission:fe,WorksheetFilterPermission:ms,WorksheetInsertColumnPermission:gs,WorksheetInsertHyperlinkPermission:Rs,WorksheetInsertRowPermission:Cs,WorksheetManageCollaboratorPermission:Ss,WorksheetPivotTablePermission:fs,WorksheetSetCellStylePermission:Is,WorksheetSetCellValuePermission:Lt,WorksheetSetColumnStylePermission:pt,WorksheetSetRowStylePermission:wt,WorksheetSortPermission:vs,WorksheetViewPermission:Bt,RangeProtectionPermissionEditPoint:Se,RangeProtectionPermissionViewPoint:dn},Jd=(s,e,t,n)=>{const o=s.get(i.IPermissionService),r=s.get(X),a=o.getPermissionPoint(new he(e).id);if(!(a!=null&&a.value))return!1;const l=o.getPermissionPoint(new fe(e,t).id);if(!(l!=null&&l.value))return!1;const d=r.getSubunitRuleList(e,t).filter(c=>c.ranges.some(h=>n.some(m=>i.Rectangle.intersects(h,m))));return d.length?d.every(c=>{const h=c.permissionId,m=o.getPermissionPoint(new Se(e,t,h).id);return!!(m!=null&&m.value)}):!0},Ji=(s,e,t,n=1,o=!0,r=!0)=>{const a=i.Range.transformRange(s,e),{startRow:l,endRow:u}=a;let d=t.startRow-n,c=e.getMergedCell(d,t.startColumn),h=!c||c.startRow===d&&c.startColumn===t.startColumn;for(;!e.getRowVisible(d)||!h;)d--,c=e.getMergedCell(d,t.startColumn),h=!c||c.startRow===d&&c.startColumn===t.startColumn;if(d>=l)return{...t,startRow:d,endRow:d};if(r){const m={...t,startRow:u,endRow:u};return Zi(s,e,m,n,o,!1)}},Xi=(s,e,t,n=1,o=!0,r=!0)=>{const a=i.Range.transformRange(s,e),{startRow:l,endRow:u}=a;let d=t.endRow+n,c=e.getMergedCell(d,t.startColumn),h=!c||c.startRow===d&&c.startColumn===t.startColumn;for(;!e.getRowVisible(d)||!h;)d++,c=e.getMergedCell(d,t.startColumn),h=!c||c.startRow===d&&c.startColumn===t.startColumn;if(d<=u)return{...t,startRow:d,endRow:d};if(r){const m={...t,startRow:l,endRow:l};return Qi(s,e,m,n,o,!1)}},Zi=(s,e,t,n=1,o=!0,r=!0)=>{const a=i.Range.transformRange(s,e),{startColumn:l,endColumn:u}=a;let d=t.startColumn-n,c=e.getMergedCell(t.startRow,d),h=!c||c.startRow===t.startRow&&c.startColumn===d;for(;!e.getColVisible(d)||!h;)d--,c=e.getMergedCell(t.startRow,d),h=!c||c.startRow===t.startRow&&c.startColumn===d;if(d>=l)return{...t,startColumn:d,endColumn:d};if(r){const m={...t,startColumn:u,endColumn:u};return Ji(s,e,m,n,o,!1)}},Qi=(s,e,t,n=1,o=!0,r=!0)=>{const a=i.Range.transformRange(s,e),{startColumn:l,endColumn:u}=a;let d=t.endColumn+n,c=e.getMergedCell(t.startRow,d),h=!c||c.startRow===t.startRow&&c.startColumn===d;for(;!e.getColVisible(d)||!h;)d++,c=e.getMergedCell(t.startRow,d),h=!c||c.startRow===t.startRow&&c.startColumn===d;if(d<=u)return{...t,endColumn:d,startColumn:d};if(r){const m={...t,startColumn:l,endColumn:l};return Xi(s,e,m,n,o,!1)}};function Ln(s,e,t){let n=null;return t.getMatrixWithMergedCells(s,e,s,e).forValue((r,a,l)=>(n={actualRow:r,actualColumn:a,startRow:r,startColumn:a,isMerged:l.rowSpan!==void 0||l.colSpan!==void 0,isMergedMainCell:l.rowSpan!==void 0&&l.colSpan!==void 0,endRow:r+(l.rowSpan!==void 0?l.rowSpan-1:0),endColumn:a+(l.colSpan!==void 0?l.colSpan-1:0),rangeType:i.RANGE_TYPE.NORMAL},!1)),n||{actualColumn:e,actualRow:s,startRow:s,startColumn:e,endRow:s,endColumn:e,isMerged:!1,isMergedMainCell:!1,rangeType:i.RANGE_TYPE.NORMAL}}const Xd=(s,e,t,n,o=1)=>{switch(n){case i.Direction.UP:return Ji(s,e,t,o);case i.Direction.DOWN:return Xi(s,e,t,o);case i.Direction.LEFT:return Zi(s,e,t,o);case i.Direction.RIGHT:return Qi(s,e,t,o)}},Zd=(s,e,t)=>{let n,o=-1,r;for(let v=0;v<s.length;v++)if(s[v].primary){n=s[v],o=v,r=n.primary;break}if(o===-1)return null;const a=e===i.Direction.LEFT||e===i.Direction.UP,l=a?o-1>=0?o-1:s.length-1:o+1<s.length?o+1:0,u=s[l];if(!n||!r)return null;const d={...r},{startRow:c,startColumn:h,endRow:m,endColumn:R}=n.range,C=a?d.startRow===c&&d.startColumn===h:d.endRow===m&&d.endColumn===R,S=C&&a;if(!i.Rectangle.equals(n.range,d)){const v=C?u.range:Xd(n.range,t,d,e);if(!v)return null;const M=S?Ln(v.endRow,v.endColumn,t):Ln(v.startRow,v.startColumn,t);return{startRow:M.startRow,startColumn:M.startColumn,endRow:M.endRow,endColumn:M.endColumn}}const I=S?Ln(u.range.endRow,u.range.endColumn,t):Ln(u.range.startRow,u.range.startColumn,t);return{startRow:I.startRow,startColumn:I.startColumn,endRow:I.endRow,endColumn:I.endColumn}};g.AFTER_CELL_EDIT=tn,g.AddMergeRedoSelectionsOperationFactory=Pr,g.AddMergeUndoMutationFactory=ge,g.AddMergeUndoSelectionsOperationFactory=Nr,g.AddRangeProtectionCommand=$o,g.AddRangeProtectionMutation=Ce,g.AddRangeThemeMutation=Pi,g.AddWorksheetMergeAllCommand=Ar,g.AddWorksheetMergeCommand=ot,g.AddWorksheetMergeHorizontalCommand=Vr,g.AddWorksheetMergeMutation=j,g.AddWorksheetMergeVerticalCommand=Wr,g.AddWorksheetProtectionCommand=$r,g.AddWorksheetProtectionMutation=qe,g.AppendRowCommand=Br,g.BEFORE_CELL_EDIT=Hn,g.BorderStyleManagerService=at,g.COMMAND_LISTENER_SKELETON_CHANGE=ja,g.COMMAND_LISTENER_VALUE_CHANGE=Ga,g.CancelFrozenCommand=ri,g.CancelMarkDirtyRowAutoHeightMutation=Di,g.ClearSelectionAllCommand=rn,g.ClearSelectionContentCommand=vn,g.ClearSelectionFormatCommand=an,g.CopySheetCommand=Gr,g.CopyWorksheetEndMutation=Vs,g.DISABLE_NORMAL_SELECTIONS=vl,g.DeleteRangeMoveLeftCommand=Ge,g.DeleteRangeMoveUpCommand=ze,g.DeleteRangeProtectionCommand=zr,g.DeleteRangeProtectionMutation=Ue,g.DeleteWorksheetProtectionCommand=qr,g.DeleteWorksheetProtectionMutation=rt,g.DeleteWorksheetRangeThemeStyleCommand=Yr,g.DeleteWorksheetRangeThemeStyleMutation=ct,g.DeleteWorksheetRangeThemeStyleMutationFactory=mo,g.DeltaColumnWidthCommand=Yt,g.DeltaRowHeightCommand=Xt,g.EditStateEnum=Vo,g.EffectRefRangId=A,g.EmptyMutation=Ni,g.ExclusiveRangeService=zi,g.FactoryAddRangeProtectionMutation=Cl,g.FactoryDeleteRangeProtectionMutation=Rl,g.FactorySetRangeProtectionMutation=Nu,g.IExclusiveRangeService=so,g.INTERCEPTOR_POINT=Ve,g.INumfmtService=ut,g.IRefSelectionsService=Fo,g.InsertColAfterCommand=ar,g.InsertColBeforeCommand=ir,g.InsertColByRangeCommand=_s,g.InsertColCommand=_e,g.InsertColMutation=ie,g.InsertColMutationUndoFactory=At,g.InsertDefinedNameCommand=xr,g.InsertMultiColsLeftCommand=lr,g.InsertMultiColsRightCommand=ur,g.InsertMultiRowsAboveCommand=sr,g.InsertMultiRowsAfterCommand=or,g.InsertRangeMoveDownCommand=et,g.InsertRangeMoveRightCommand=yt,g.InsertRowAfterCommand=nr,g.InsertRowBeforeCommand=tr,g.InsertRowByRangeCommand=ys,g.InsertRowCommand=ye,g.InsertRowMutation=re,g.InsertRowMutationUndoFactory=sn,g.InsertSheetCommand=Kr,g.InsertSheetMutation=it,g.InsertSheetUndoMutationFactory=$s,g.InterceptCellContentPriority=io,g.MAX_CELL_PER_SHEET_KEY=$i,g.MERGE_CELL_INTERCEPTOR_CHECK=kr,g.MarkDirtyRowAutoHeightMutation=Oi,g.MoveColsCommand=bt,g.MoveColsMutation=Me,g.MoveColsMutationUndoFactory=Ro,g.MoveRangeCommand=Qe,g.MoveRangeMutation=Fe,g.MoveRowsCommand=_t,g.MoveRowsMutation=we,g.MoveRowsMutationUndoFactory=go,g.OperatorType=B,g.PermissionPointsDefinitions=Kd,g.REF_SELECTIONS_ENABLED=Bo,g.RangeMergeUtil=tl,g.RangeProtectionPermissionDeleteProtectionPoint=Ks,g.RangeProtectionPermissionEditPoint=Se,g.RangeProtectionPermissionManageCollaPoint=Js,g.RangeProtectionPermissionViewPoint=dn,g.RangeProtectionRuleModel=X,g.RangeThemeStyle=$e,g.RegisterWorksheetRangeThemeStyleCommand=Jr,g.RegisterWorksheetRangeThemeStyleMutation=Tt,g.RemoveColByRangeCommand=Es,g.RemoveColCommand=Ft,g.RemoveColMutation=ne,g.RemoveDefinedNameCommand=Ls,g.RemoveMergeUndoMutationFactory=le,g.RemoveNumfmtMutation=Zs,g.RemoveRangeThemeMutation=Ai,g.RemoveRowByRangeCommand=bs,g.RemoveRowCommand=Ht,g.RemoveRowMutation=ae,g.RemoveSheetCommand=wn,g.RemoveSheetMutation=He,g.RemoveSheetUndoMutationFactory=dr,g.RemoveWorksheetMergeCommand=Xr,g.RemoveWorksheetMergeMutation=G,g.ReorderRangeCommand=Sn,g.ReorderRangeMutation=Wt,g.ReorderRangeUndoMutationFactory=Co,g.ResetBackgroundColorCommand=mi,g.ResetTextColorCommand=ci,g.SCOPE_WORKBOOK_VALUE_DEFINED_NAME=id,g.SELECTIONS_ENABLED=pl,g.SELECTION_CONTROL_BORDER_BUFFER_COLOR=sl,g.SELECTION_CONTROL_BORDER_BUFFER_WIDTH=nl,g.SHEETS_PLUGIN_CONFIG_KEY=zt,g.ScrollToCellOperation=Vi,g.SelectRangeCommand=Go,g.SelectionMoveType=Q,g.SetBackgroundColorCommand=hi,g.SetBoldCommand=Wu,g.SetBorderBasicCommand=ti,g.SetBorderColorCommand=ei,g.SetBorderCommand=Ut,g.SetBorderPositionCommand=Zr,g.SetBorderStyleCommand=Qr,g.SetColDataCommand=ni,g.SetColDataMutation=ht,g.SetColDataMutationFactory=So,g.SetColHiddenCommand=yn,g.SetColHiddenMutation=mt,g.SetColVisibleMutation=gt,g.SetColWidthCommand=xt,g.SetDefinedNameCommand=Fs,g.SetFontFamilyCommand=Hu,g.SetFontSizeCommand=Fu,g.SetFrozenCommand=oi,g.SetFrozenMutation=Oe,g.SetFrozenMutationFactory=js,g.SetGridlinesColorCommand=ii,g.SetGridlinesColorMutation=Rt,g.SetHorizontalTextAlignCommand=Ri,g.SetItalicCommand=Vu,g.SetNumfmtMutation=Pn,g.SetOverlineCommand=Bu,g.SetProtectionCommand=ai,g.SetRangeProtectionMutation=ee,g.SetRangeThemeMutation=Wi,g.SetRangeValuesCommand=Mt,g.SetRangeValuesMutation=F,g.SetRangeValuesUndoMutationFactory=ce,g.SetRowDataCommand=li,g.SetRowDataMutation=Ct,g.SetRowDataMutationFactory=vo,g.SetRowHeightCommand=Zt,g.SetRowHiddenCommand=_n,g.SetRowHiddenMutation=Xe,g.SetRowVisibleMutation=Je,g.SetSelectedColsVisibleCommand=Hs,g.SetSelectedRowsVisibleCommand=Gs,g.SetSelectionsOperation=q,g.SetSpecificColsVisibleCommand=kt,g.SetSpecificRowsVisibleCommand=Pt,g.SetStrikeThroughCommand=Lu,g.SetStyleCommand=te,g.SetTabColorCommand=fi,g.SetTabColorMutation=qt,g.SetTextColorCommand=di,g.SetTextRotationCommand=Si,g.SetTextWrapCommand=Ci,g.SetUnderlineCommand=$u,g.SetVerticalTextAlignCommand=gi,g.SetWorkbookNameCommand=qs,g.SetWorkbookNameMutation=zs,g.SetWorksheetActivateCommand=Ys,g.SetWorksheetActiveOperation=Ze,g.SetWorksheetColWidthMutation=Le,g.SetWorksheetColWidthMutationFactory=Gn,g.SetWorksheetColumnCountCommand=Ii,g.SetWorksheetColumnCountMutation=St,g.SetWorksheetColumnCountUndoMutationFactory=po,g.SetWorksheetDefaultStyleCommand=vi,g.SetWorksheetDefaultStyleMutation=ft,g.SetWorksheetDefaultStyleMutationFactory=wo,g.SetWorksheetHideCommand=wi,g.SetWorksheetHideMutation=De,g.SetWorksheetNameCommand=bn,g.SetWorksheetNameMutation=Kt,g.SetWorksheetOrderCommand=xs,g.SetWorksheetOrderMutation=Jt,g.SetWorksheetPermissionPointsCommand=yi,g.SetWorksheetPermissionPointsMutation=Tn,g.SetWorksheetProtectionCommand=_i,g.SetWorksheetProtectionMutation=lt,g.SetWorksheetRangeThemeStyleCommand=Lr,g.SetWorksheetRangeThemeStyleMutation=dt,g.SetWorksheetRangeThemeStyleMutationFactory=ho,g.SetWorksheetRightToLeftCommand=Qu,g.SetWorksheetRightToLeftMutation=Un,g.SetWorksheetRowAutoHeightMutation=qn,g.SetWorksheetRowAutoHeightMutationFactory=Fa,g.SetWorksheetRowCountCommand=bi,g.SetWorksheetRowCountMutation=It,g.SetWorksheetRowCountUndoMutationFactory=Mo,g.SetWorksheetRowHeightMutation=Te,g.SetWorksheetRowIsAutoHeightCommand=kn,g.SetWorksheetRowIsAutoHeightMutation=Re,g.SetWorksheetShowCommand=Xs,g.SheetSkeletonChangeType=_o,g.SheetValueChangeType=bo,g.SplitDelimiterEnum=No,g.SplitTextToColumnsCommand=Ei,g.ToggleCellCheckboxCommand=Ti,g.ToggleGridlinesCommand=Ui,g.ToggleGridlinesMutation=vt,g.UnitAction=_,g.UnitObject=D,g.UnregisterWorksheetRangeThemeStyleCommand=ki,g.UnregisterWorksheetRangeThemeStyleMutation=pn,g.VALIDATE_CELL=nn,g.ViewStateEnum=Wo,g.WorkbookCommentPermission=Jn,g.WorkbookCopyPermission=Xn,g.WorkbookCopySheetPermission=qo,g.WorkbookCreateProtectPermission=Zn,g.WorkbookCreateSheetPermission=Qn,g.WorkbookDeleteColumnPermission=Yo,g.WorkbookDeleteRowPermission=xo,g.WorkbookDeleteSheetPermission=es,g.WorkbookDuplicatePermission=ts,g.WorkbookEditablePermission=he,g.WorkbookExportPermission=ns,g.WorkbookHideSheetPermission=cn,g.WorkbookHistoryPermission=Ko,g.WorkbookInsertColumnPermission=Jo,g.WorkbookInsertRowPermission=Xo,g.WorkbookManageCollaboratorPermission=hn,g.WorkbookMoveSheetPermission=mn,g.WorkbookPrintPermission=ss,g.WorkbookRecoverHistoryPermission=os,g.WorkbookRenameSheetPermission=gn,g.WorkbookSelectionModel=Lo,g.WorkbookSharePermission=rs,g.WorkbookViewHistoryPermission=as,g.WorkbookViewPermission=is,g.WorksheetCopyPermission=ls,g.WorksheetDeleteColumnPermission=us,g.WorksheetDeleteProtectionPermission=ds,g.WorksheetDeleteRowPermission=cs,g.WorksheetEditExtraObjectPermission=hs,g.WorksheetEditPermission=fe,g.WorksheetFilterPermission=ms,g.WorksheetInsertColumnPermission=gs,g.WorksheetInsertHyperlinkPermission=Rs,g.WorksheetInsertRowPermission=Cs,g.WorksheetManageCollaboratorPermission=Ss,g.WorksheetPivotTablePermission=fs,g.WorksheetProtectionPointModel=Nt,g.WorksheetProtectionRuleModel=Ne,g.WorksheetSelectProtectedCellsPermission=kl,g.WorksheetSelectUnProtectedCellsPermission=Pl,g.WorksheetSetCellStylePermission=Is,g.WorksheetSetCellValuePermission=Lt,g.WorksheetSetColumnStylePermission=pt,g.WorksheetSetRowStylePermission=wt,g.WorksheetSortPermission=vs,g.WorksheetViewPermission=Bt,g.addMergeCellsUtil=Cu,g.adjustRangeOnMutation=yr,g.alignToMergedCellsBorders=$t,g.baseProtectionActions=Ye,g.checkCellValueType=Bn,g.checkRangesEditablePermission=Jd,g.convertPrimaryWithCoordToPrimary=Po,g.convertSelectionDataToRange=ol,g.copyRangeStyles=Be,g.countCells=gr,g.createTopMatrixFromMatrix=Uo,g.createTopMatrixFromRanges=To,g.defaultLargeSheetOperationConfig=Ws,g.defaultWorkbookPermissionPoints=Mi,g.defaultWorksheetPermissionPoint=En,g.expandToContinuousRange=Qa,g.factoryRemoveNumfmtUndoMutation=td,g.factorySetNumfmtUndoMutation=ed,g.findAllRectangle=Yn,g.findFirstNonEmptyCell=ml,g.followSelectionOperation=ke,g.generateNullCell=Kn,g.generateNullCellValue=Do,g.getAddMergeMutationRangeByType=Ds,g.getAllRangePermissionPoint=ue,g.getAllWorkbookPermissionPoint=Ot,g.getAllWorksheetPermissionPoint=de,g.getAllWorksheetPermissionPointByPointPanel=ve,g.getCellAtRowCol=wl,g.getClearContentMutationParamForRange=Dr,g.getClearContentMutationParamsForRanges=Or,g.getDefaultRangePermission=Yu,g.getInsertRangeMutations=ps,g.getMoveRangeUndoRedoMutations=ln,g.getNextPrimaryCell=Zd,g.getPrimaryForRange=se,g.getRemoveRangeMutations=ws,g.getSelectionsService=jo,g.getSeparateEffectedRangesOnCommand=su,g.getSheetCommandTarget=P,g.getSheetCommandTargetWorkbook=jn,g.getSheetMutationTarget=pe,g.getSkeletonChangedEffectedRange=qa,g.getValueChangedEffectedRange=za,g.getVisibleRanges=Vt,g.handleBaseInsertRange=nt,g.handleBaseMoveRowsCols=Gt,g.handleBaseRemoveRange=tt,g.handleCommonDefaultRangeChangeWithEffectRefCommands=Os,g.handleCommonRangeChangeWithEffectRefCommandsSkipNoInterests=tu,g.handleDefaultRangeChangeWithEffectRefCommands=Ns,g.handleDefaultRangeChangeWithEffectRefCommandsSkipNoInterests=eu,g.handleDeleteRangeMoveLeft=wr,g.handleDeleteRangeMoveUp=Mr,g.handleDeleteRangeMutation=Ol,g.handleIRemoveCol=Ps,g.handleIRemoveRow=Sr,g.handleInsertCol=Ir,g.handleInsertRangeMoveDown=vr,g.handleInsertRangeMoveRight=pr,g.handleInsertRangeMutation=Nl,g.handleInsertRow=fr,g.handleMoveCols=ks,g.handleMoveRange=Cr,g.handleMoveRows=Us,g.isSingleCellSelection=yl,g.rangeMerge=xn,g.rangeToDiscreteRange=Ao,g.rotateRange=me,g.runRefRangeMutations=st,g.setEndForRange=Ml,g.splitRangeText=Oo,g.transformCellsToRange=Nn,Object.defineProperty(g,Symbol.toStringTag,{value:"Module"})}));
|
|
12
|
+
`)?s.body.dataStream.length-2:s.body.dataStream.length;if(t<r){const l={st:t,ed:r},u=on({},e,!0);u&&i.Tools.removeNull(u),i.Tools.isEmptyObject(u)||(l.ts=u),n.push(l)}s.body.textRuns=i.normalizeTextRuns(n)}function Io(s,e){return e.v===void 0||e.v===null?e.v:s===i.CellValueType.NUMBER?Number(e.v):s===i.CellValueType.BOOLEAN?Aa(e.v)?1:0:s===i.CellValueType.STRING||s===i.CellValueType.FORCE_STRING?`${e.v}`:e.v}function Aa(s){if(typeof s=="string"){if(s.toUpperCase()==="TRUE")return!0;if(s.toUpperCase()==="FALSE")return!1;if(i.isSafeNumeric(s)){if(Number(s)===0)return!1;if(Number(s)===1)return!0}}if(typeof s=="number"){if(s===0)return!1;if(s===1)return!0}return typeof s=="boolean"?s:null}function Wa(s){return s==null?null:(s.f===void 0&&(s.f=null),s.si===void 0&&(s.si=null),s.p===void 0&&(s.p=null),s.v===void 0&&(s.v=null),s.t===void 0&&(s.t=null),s.s===void 0&&(s.s=null),s.custom===void 0&&(s.custom=null),s)}const he=(s,e)=>{const{unitId:t,subUnitId:n,cellValue:o}=e,a=s.get(i.IUniverInstanceService).getUniverSheetInstance(t);if(a==null)throw new Error("workbook is null error!");const l=a.getSheetBySheetId(n);if(l==null)throw new Error("worksheet is null error!");const u=l.getCellMatrix(),d=a.getStyles(),c=new i.ObjectMatrix;return new i.ObjectMatrix(o).forValue((m,R,C)=>{const S=i.Tools.deepClone(u==null?void 0:u.getValue(m,R))||{},I=d.getStyleByCell(S),v=d.getStyleByCell(C);S.s=Na(I,v),c.setValue(m,R,Wa(S))}),{...e,options:{},cellValue:c.getMatrix()}},F={id:"sheet.mutation.set-range-values",type:i.CommandType.MUTATION,handler:(s,e)=>{const{cellValue:t,subUnitId:n,unitId:o}=e,a=s.get(i.IUniverInstanceService).getUnit(o);if(!a)return!1;const l=a.getSheetBySheetId(n);if(!l)return!1;const u=l.getCellMatrix(),d=a.getStyles();return new i.ObjectMatrix(t).forValue((h,m,R)=>{if(!R)u.realDeleteValue(h,m);else{let C=u.getValue(h,m)||{};C=La(R,C,d),i.Tools.isEmptyObject(C)?u.realDeleteValue(h,m):u.setValue(h,m,C)}}),!0}},Va=new Set(["f","p","si","custom","ref","xf"]);function La(s,e,t){const n=ta(t,s,e);return Object.keys(s).forEach(o=>{const r=o;if(Va.has(r)){const a=s[r];$a(e,r,a)}else r==="v"?s.v!==void 0&&(e.v=Io(n,s)):r==="s"&&Pa(t,e,s)}),e.v!==void 0&&(e.t=n,e.v=Io(n,e)),e.v===null&&(delete e.t,delete e.v),e}function $a(s,e,t){t===void 0||(t===null?delete s[e]:s[e]=t)}const vo=(s,e)=>{const{unitId:t,subUnitId:n,rowData:o}=s,r={},a=e.getRowManager();for(const l in o){const u=o[l],d=a.getRow(Number(l));r[l]=Ea(d,u)}return{unitId:t,subUnitId:n,rowData:r}},Ct={id:"sheet.mutation.set-row-data",type:i.CommandType.MUTATION,handler:(s,e)=>{const{rowData:t}=e,n=s.get(i.IUniverInstanceService),o=P(n,e);if(!o)return!1;const{worksheet:r}=o,a=r.getRowManager();for(const l in t){const u=t[l];if(u==null){a.removeRow(Number(l));continue}const d=a.getRowOrCreate(Number(l));Object.assign(d,u)}return!0}},Ba=(s,e)=>{if(s.get(i.IUniverInstanceService).getUniverSheetInstance(e.unitId)==null)throw new Error("universheet is null error!");return{unitId:e.unitId,subUnitId:e.subUnitId,ranges:e.ranges}},Je={id:"sheet.mutation.set-row-visible",type:i.CommandType.MUTATION,handler:(s,e)=>{const n=s.get(i.IUniverInstanceService).getUniverSheetInstance(e.unitId);if(n==null)throw new Error("universheet is null error!");const o=n.getSheetBySheetId(e.subUnitId).getRowManager();for(let r=0;r<e.ranges.length;r++){const a=e.ranges[r];for(let l=a.startRow;l<a.endRow+1;l++){const u=o.getRowOrCreate(l);u!=null&&(u.hd=0)}}return!0}},Ha=(s,e)=>{if(s.get(i.IUniverInstanceService).getUniverSheetInstance(e.unitId)==null)throw new Error("universheet is null error!");return{unitId:e.unitId,subUnitId:e.subUnitId,ranges:e.ranges}},Xe={id:"sheet.mutation.set-row-hidden",type:i.CommandType.MUTATION,handler:(s,e)=>{const n=s.get(i.IUniverInstanceService).getUniverSheetInstance(e.unitId);if(n==null)throw new Error("universheet is null error!");const o=n.getSheetBySheetId(e.subUnitId).getRowManager();for(let r=0;r<e.ranges.length;r++){const a=e.ranges[r];for(let l=a.startRow;l<a.endRow+1;l++){const u=o.getRowOrCreate(l);u!=null&&(u.hd=1)}}return!0}},Gn=(s,e)=>{const{unitId:t,subUnitId:n,ranges:o}=s,r={},a=e.getColumnManager();for(let l=0;l<o.length;l++){const u=o[l];for(let d=u.startColumn;d<u.endColumn+1;d++)r[d]=a.getColumnWidth(d)}return{unitId:t,subUnitId:n,ranges:o,colWidth:r}},$e={id:"sheet.mutation.set-worksheet-col-width",type:i.CommandType.MUTATION,handler:(s,e)=>{const t=s.get(i.IUniverInstanceService),n=P(t,e);if(!n)return!1;const{worksheet:o}=n,r=o.getColumnManager(),a=e.ranges;for(let l=0;l<a.length;l++){const u=a[l];for(let d=u.startColumn;d<u.endColumn+1;d++)o.getColVisible(d)&&(typeof e.colWidth=="number"?r.setColumnWidth(d,e.colWidth):i.Tools.isDefine(e.colWidth[d])&&r.setColumnWidth(d,e.colWidth[d]))}return!0}},po=(s,e)=>{const t=ne(s.get(i.IUniverInstanceService),e);if(!t)throw new Error("[SetWorksheetColumnCountUndoMutationFactory]: worksheet is null error!");return{unitId:e.unitId,subUnitId:e.subUnitId,columnCount:t.worksheet.getColumnCount()}},St={id:"sheet.mutation.set-worksheet-column-count",type:i.CommandType.MUTATION,handler:(s,e)=>{const t=s.get(i.IUniverInstanceService),n=ne(t,e);return n?(n.worksheet.setColumnCount(e.columnCount),!0):!1}},ft={id:"sheet.mutation.set-worksheet-default-style",type:i.CommandType.MUTATION,handler:(s,e)=>{const t=P(s.get(i.IUniverInstanceService),e);if(!t)return!1;const{worksheet:n}=t,{defaultStyle:o}=e;return n.setDefaultCellStyle(o),!0}},wo=(s,e)=>{const t=ne(s.get(i.IUniverInstanceService),e);if(!t)throw new Error("[SetWorksheetDefaultStyleMutationFactory]: worksheet is null error!");const{worksheet:n}=t;return{unitId:e.unitId,subUnitId:n.getSheetId(),defaultStyle:n.getDefaultCellStyle()}},Mo=(s,e)=>{const t=ne(s.get(i.IUniverInstanceService),e);if(!t)throw new Error("[SetWorksheetRowCountUndoMutationFactory]: worksheet is null error!");return{unitId:e.unitId,subUnitId:e.subUnitId,rowCount:t.worksheet.getRowCount()}},It={id:"sheet.mutation.set-worksheet-row-count",type:i.CommandType.MUTATION,handler:(s,e)=>{const t=s.get(i.IUniverInstanceService),n=ne(t,e);return n?(n.worksheet.setRowCount(e.rowCount),!0):!1}},yo=(s,e)=>{var l,u;const{unitId:t,subUnitId:n,ranges:o}=s,r={},a=e.getRowManager();for(const{startRow:d,endRow:c}of o)for(let h=d;h<c+1;h++)r[h]=(u=(l=a.getRow(h))==null?void 0:l.h)!=null?u:e.getConfig().defaultRowHeight;return{unitId:t,subUnitId:n,ranges:o,rowHeight:r}},zn=(s,e)=>{var l;const{unitId:t,subUnitId:n,ranges:o}=s,r={},a=e.getRowManager();for(const{startRow:u,endRow:d}of o)for(let c=u;c<=d;c++)r[c]=(l=a.getRow(c))==null?void 0:l.ia;return{unitId:t,subUnitId:n,ranges:o,autoHeightInfo:r}},Fa=(s,e)=>{var l,u;const{unitId:t,subUnitId:n,rowsAutoHeightInfo:o}=s,r=[],a=e.getRowManager();for(const d of o){const{row:c}=d;r.push({row:c,autoHeight:(u=(l=a.getRow(c))==null?void 0:l.ah)!=null?u:e.getConfig().defaultRowHeight})}return{unitId:t,subUnitId:n,rowsAutoHeightInfo:r}},Te={id:"sheet.mutation.set-worksheet-row-height",type:i.CommandType.MUTATION,handler:(s,e)=>{const{ranges:t,rowHeight:n}=e,o=s.get(i.IUniverInstanceService),r=P(o,e);if(!r)return!1;const{worksheet:a}=r,l=a.getRowManager();for(const{startRow:u,endRow:d}of t)for(let c=u;c<=d;c++)typeof n=="number"?l.setRowHeight(c,n):i.Tools.isDefine(n[c])&&l.setRowHeight(c,n[c]);return!0}},Ce={id:"sheet.mutation.set-worksheet-row-is-auto-height",type:i.CommandType.MUTATION,handler:(s,e)=>{var l;const{ranges:t,autoHeightInfo:n}=e,o=s.get(i.IUniverInstanceService),r=P(o,e);if(!r)return!1;const a=r.worksheet.getRowManager();for(const{startRow:u,endRow:d}of t)for(let c=u;c<=d;c++){const h=a.getRowOrCreate(c);typeof n=="number"?h.ia=n:h.ia=(l=n[c])!=null?l:void 0}return!0}},qn={id:"sheet.mutation.set-worksheet-row-auto-height",type:i.CommandType.MUTATION,handler:(s,e)=>{const{rowsAutoHeightInfo:t}=e,n=s.get(i.IUniverInstanceService),o=P(n,e);if(!o)return!1;const r=o.worksheet.getRowManager();for(const{row:a,autoHeight:l}of t){const u=r.getRowOrCreate(a);u.ah=l}return!0}},vt={id:"sheet.mutation.toggle-gridlines",type:i.CommandType.MUTATION,handler:(s,e)=>{const t=P(s.get(i.IUniverInstanceService),e);if(!t)return!1;const{worksheet:n}=t,o=n.getConfig();return o.showGridlines=e.showGridlines,!0}},Ze={id:"sheet.operation.set-worksheet-active",type:i.CommandType.OPERATION,handler:(s,e)=>{const t=s.get(i.IUniverInstanceService).getUniverSheetInstance(e.unitId);if(!t)return!1;const n=t.getWorksheets();for(const[,o]of n)if(o.getSheetId()===e.subUnitId)return t.setActiveSheet(o),!0;return!1}};var _o=(s=>(s.SET_WORKSHEET_ROW_HEIGHT="sheet.mutation.set-worksheet-row-height",s.SET_WORKSHEET_ROW_IS_AUTO_HEIGHT="sheet.mutation.set-worksheet-row-is-auto-height",s.SET_WORKSHEET_ROW_AUTO_HEIGHT="sheet.mutation.set-worksheet-row-auto-height",s.SET_WORKSHEET_COL_WIDTH="sheet.mutation.set-worksheet-col-width",s.SET_WORKSHEET_ACTIVE="sheet.operation.set-worksheet-active",s.MOVE_ROWS="sheet.mutation.move-rows",s.MOVE_COLUMNS="sheet.mutation.move-columns",s.SET_COL_HIDDEN="sheet.mutation.set-col-hidden",s.SET_COL_VISIBLE="sheet.mutation.set-col-visible",s.SET_ROW_HIDDEN="sheet.mutation.set-row-hidden",s.SET_ROW_VISIBLE="sheet.mutation.set-row-visible",s.INSERT_COL="sheet.mutation.insert-col",s.INSERT_ROW="sheet.mutation.insert-row",s.REMOVE_COL="sheet.mutation.remove-col",s.REMOVE_ROW="sheet.mutation.remove-rows",s.TOGGLE_GRIDLINES="sheet.mutation.toggle-gridlines",s.SET_GRIDLINES_COLOR="sheet.mutation.set-gridlines-color",s))(_o||{}),bo=(s=>(s.SET_RANGE_VALUES="sheet.mutation.set-range-values",s.MOVE_RANGE="sheet.mutation.move-range",s.REMOVE_WORKSHEET_MERGE="sheet.mutation.remove-worksheet-merge",s.ADD_WORKSHEET_MERGE="sheet.mutation.add-worksheet-merge",s.REORDER_RANGE="sheet.mutation.reorder-range",s.SET_WORKSHEET_DEFAULT_STYLE="sheet.mutation.set-worksheet-default-style",s.SET_ROW_DATA="sheet.mutation.set-row-data",s.SET_COL_DATA="sheet.mutation.set-col-data",s.SET_WORKSHEET_RANGE_THEME_STYLE="sheet.mutation.set-worksheet-range-theme-style",s.DELETE_WORKSHEET_RANGE_THEME_STYLE="sheet.mutation.delete-worksheet-range-theme-style",s))(bo||{});const ja=[Te.id,Ce.id,qn.id,$e.id,Ze.id,we.id,Me.id,mt.id,gt.id,Xe.id,Je.id,ae.id,ie.id,se.id,le.id,vt.id,Rt.id,It.id,St.id],Ga=[F.id,Fe.id,G.id,j.id,Wt.id,ft.id,Ct.id,ht.id,dt.id,ct.id];function za(s){switch(s.id){case"sheet.mutation.set-range-values":{const e=s.params,t=new i.ObjectMatrix(e.cellValue).getDataRange();return t.endRow===-1?[]:e.cellValue?[{unitId:e.unitId,subUnitId:e.subUnitId,range:t}]:[]}case"sheet.mutation.move-range":{const e=s.params;return[{unitId:e.unitId,subUnitId:e.from.subUnitId,range:new i.ObjectMatrix(e.from.value).getRange()},{unitId:e.unitId,subUnitId:e.to.subUnitId,range:new i.ObjectMatrix(e.to.value).getRange()}]}case"sheet.mutation.remove-worksheet-merge":{const e=s.params;return e.ranges.map(t=>({unitId:e.unitId,subUnitId:e.subUnitId,range:t}))}case"sheet.mutation.add-worksheet-merge":{const e=s.params;return e.ranges.map(t=>({unitId:e.unitId,subUnitId:e.subUnitId,range:t}))}case"sheet.mutation.reorder-range":{const e=s.params;return[{unitId:e.unitId,subUnitId:e.subUnitId,range:e.range}]}case"sheet.mutation.set-worksheet-default-style":{const e=s.params;return[{unitId:e.unitId,subUnitId:e.subUnitId,range:{startRow:0,endRow:Number.MAX_SAFE_INTEGER,startColumn:0,endColumn:Number.MAX_SAFE_INTEGER}}]}case"sheet.mutation.set-row-data":{const e=s.params,t=Object.keys(e.rowData).map(Number);return t.length===0?[]:[{unitId:e.unitId,subUnitId:e.subUnitId,range:{startRow:Math.min(...t),endRow:Math.max(...t),startColumn:0,endColumn:Number.MAX_SAFE_INTEGER}}]}case"sheet.mutation.set-col-data":{const e=s.params,t=Object.keys(e.columnData).map(Number);return t.length===0?[]:[{unitId:e.unitId,subUnitId:e.subUnitId,range:{startRow:0,endRow:Number.MAX_SAFE_INTEGER,startColumn:Math.min(...t),endColumn:Math.max(...t)}}]}case"sheet.mutation.set-worksheet-range-theme-style":case"sheet.mutation.delete-worksheet-range-theme-style":{const e=s.params;return[{unitId:e.unitId,subUnitId:e.subUnitId,range:e.range}]}default:return[]}}function qa(s,e){switch(s.id){case"sheet.mutation.set-worksheet-row-height":case"sheet.mutation.set-worksheet-row-is-auto-height":{const t=s.params;return t.ranges.map(n=>({unitId:t.unitId,subUnitId:t.subUnitId,range:{...n,rangeType:i.RANGE_TYPE.ROW}}))}case"sheet.mutation.set-worksheet-row-auto-height":{const t=s.params;return t.rowsAutoHeightInfo.map(n=>({unitId:t.unitId,subUnitId:t.subUnitId,range:{startRow:n.row,endRow:n.row,startColumn:0,endColumn:e-1,rangeType:i.RANGE_TYPE.ROW}}))}case"sheet.mutation.set-worksheet-col-width":{const t=s.params;return t.ranges.map(n=>({unitId:t.unitId,subUnitId:t.subUnitId,range:{...n,rangeType:i.RANGE_TYPE.COLUMN}}))}case"sheet.mutation.move-rows":case"sheet.mutation.move-columns":{const t=s.params;return[{unitId:t.unitId,subUnitId:t.subUnitId,range:t.targetRange},{unitId:t.unitId,subUnitId:t.subUnitId,range:t.sourceRange}]}case"sheet.mutation.set-col-hidden":case"sheet.mutation.set-col-visible":{const t=s.params;return t.ranges.map(n=>({unitId:t.unitId,subUnitId:t.subUnitId,range:{...n,rangeType:i.RANGE_TYPE.COLUMN}}))}case"sheet.mutation.set-row-hidden":case"sheet.mutation.set-row-visible":{const t=s.params;return t.ranges.map(n=>({unitId:t.unitId,subUnitId:t.subUnitId,range:{...n,rangeType:i.RANGE_TYPE.ROW}}))}case"sheet.mutation.insert-col":{const t=s.params;return[{unitId:t.unitId,subUnitId:t.subUnitId,range:{...t.range,rangeType:i.RANGE_TYPE.COLUMN}}]}case"sheet.mutation.insert-row":{const t=s.params;return[{unitId:t.unitId,subUnitId:t.subUnitId,range:{...t.range,rangeType:i.RANGE_TYPE.ROW}}]}case"sheet.mutation.remove-col":{const t=s.params;return[{unitId:t.unitId,subUnitId:t.subUnitId,range:{...t.range,rangeType:i.RANGE_TYPE.COLUMN}}]}case"sheet.mutation.remove-rows":{const t=s.params;return[{unitId:t.unitId,subUnitId:t.subUnitId,range:{...t.range,rangeType:i.RANGE_TYPE.ROW}}]}case"sheet.mutation.toggle-gridlines":case"sheet.mutation.set-gridlines-color":return[];default:return[]}}function Eo(s){return s==null?!1:s.v!==void 0&&s.v!==null&&s.v!==""||s.p!==void 0}function je(s,e){return s&&s.spanAnchor?Eo(e.getValue(s.spanAnchor.startRow,s.spanAnchor.startColumn)):Eo(s)}function Ya(s,e,t,n,o){const r=s.getCellMatrix(),a=s.getSpanModel().getMergedCellRange(e,t,n,o),l=new i.ObjectMatrix;return r.forValue((u,d)=>{const c=r.getValue(u,d);c&&l.setValue(u,d,c)}),a.forEach(u=>{const{startColumn:d,startRow:c,endColumn:h,endRow:m}=u;i.createRowColIter(c,m,d,h).forEach((R,C)=>{R===c&&C===d&&l.setValue(R,C,{...r.getValue(R,C),spanAnchor:{startRow:c,endRow:m,startColumn:d,endColumn:h}}),(R!==c||C!==d)&&(l.realDeleteValue(R,C),l.setValue(R,C,{spanAnchor:{startRow:c,endRow:m,startColumn:d,endColumn:h}}))})}),l}function xa(s,e,t,n){const{startRow:o,startColumn:r,endRow:a}=s;let l=null,u=!1;for(let d=o;d<=a;d++){const c=e.getValue(d,r-t);if(u=u||je(c,e),!n&&u)break;c&&c.spanAnchor&&(l?l={startRow:Math.min(c.spanAnchor.startRow,l.startRow),startColumn:Math.min(c.spanAnchor.startColumn,l.startColumn),endRow:Math.max(c.spanAnchor.endRow,l.endRow),endColumn:Math.max(c.spanAnchor.endColumn,l.endColumn)}:l={startRow:c.spanAnchor.startRow,startColumn:c.spanAnchor.startColumn,endRow:c.spanAnchor.endRow,endColumn:c.spanAnchor.endColumn})}return u?(s.startColumn=s.startColumn-t,{spanAnchor:l,hasValue:!0,range:s}):l?{spanAnchor:i.Rectangle.simpleRangesIntersect(s,l)?l:null,hasValue:!1,range:s}:{spanAnchor:null,hasValue:!1,range:s}}function Ka(s,e,t,n){const{startRow:o,endColumn:r,endRow:a}=s;let l=null,u=!1;for(let d=o;d<=a;d++){const c=e.getValue(d,r+t);if(u=u||je(c,e),!n&&u)break;c&&c.spanAnchor&&(l?l={startRow:Math.min(c.spanAnchor.startRow,l.startRow),startColumn:Math.min(c.spanAnchor.startColumn,l.startColumn),endRow:Math.max(c.spanAnchor.endRow,l.endRow),endColumn:Math.max(c.spanAnchor.endColumn,l.endColumn)}:l={startRow:c.spanAnchor.startRow,startColumn:c.spanAnchor.startColumn,endRow:c.spanAnchor.endRow,endColumn:c.spanAnchor.endColumn})}return u?(s.endColumn=s.endColumn+t,{spanAnchor:l,hasValue:!0,range:s}):l?{spanAnchor:i.Rectangle.simpleRangesIntersect(s,l)?l:null,hasValue:!1,range:s}:{spanAnchor:null,hasValue:!1,range:s}}function Ja(s,e,t,n){const{startRow:o,startColumn:r,endColumn:a}=s;let l=null,u=!1;for(let d=r;d<=a;d++){const c=e.getValue(o-t,d);if(u=u||je(c,e),!n&&u)break;c&&c.spanAnchor&&(l?l={startRow:Math.min(c.spanAnchor.startRow,l.startRow),startColumn:Math.min(c.spanAnchor.startColumn,l.startColumn),endRow:Math.max(c.spanAnchor.endRow,l.endRow),endColumn:Math.max(c.spanAnchor.endColumn,l.endColumn)}:l={startRow:c.spanAnchor.startRow,startColumn:c.spanAnchor.startColumn,endRow:c.spanAnchor.endRow,endColumn:c.spanAnchor.endColumn})}return u?(s.startRow=s.startRow-t,{spanAnchor:l,hasValue:!0,range:s}):l?{spanAnchor:i.Rectangle.simpleRangesIntersect(s,l)?l:null,hasValue:!1,range:s}:{spanAnchor:null,hasValue:!1,range:s}}function Xa(s,e,t,n){const{startColumn:o,endColumn:r,endRow:a}=s;let l=null,u=!1;for(let d=o;d<=r;d++){const c=e.getValue(a+t,d);if(u=u||je(c,e),!n&&u)break;c&&c.spanAnchor&&(l?l={startRow:Math.min(c.spanAnchor.startRow,l.startRow),startColumn:Math.min(c.spanAnchor.startColumn,l.startColumn),endRow:Math.max(c.spanAnchor.endRow,l.endRow),endColumn:Math.max(c.spanAnchor.endColumn,l.endColumn)}:l={startRow:c.spanAnchor.startRow,startColumn:c.spanAnchor.startColumn,endRow:c.spanAnchor.endRow,endColumn:c.spanAnchor.endColumn})}return u?(s.endRow=s.endRow+t,{spanAnchor:l,hasValue:!0,range:s}):l?{spanAnchor:i.Rectangle.simpleRangesIntersect(s,l)?l:null,hasValue:!1,range:s}:{spanAnchor:null,hasValue:!1,range:s}}function Za({range:s,allMatrixWithSpan:e,directions:t,isWorksheetHasSpan:n,maxRow:o,maxColumn:r}){const{left:a,right:l,up:u,down:d}=t,{startRow:c,startColumn:h,endRow:m,endColumn:R}=s;let C=!1;if(a&&u&&c>0&&h>0){const S=e.getValue(c-1,h-1);je(S,e)&&(n&&S.spanAnchor?(s.startRow=S.spanAnchor.startRow,s.startColumn=S.spanAnchor.startColumn):(s.startRow=c-1,s.startColumn=h-1),C=!0)}if(l&&u&&c>0&&R<r-1){const S=e.getValue(c-1,R+1);je(S,e)&&(n&&S.spanAnchor?(s.startRow=S.spanAnchor.startRow,s.endColumn=S.spanAnchor.endColumn):(s.startRow=c-1,s.endColumn=R+1),C=!0)}if(a&&d&&m<o-1&&h>0){const S=e.getValue(m+1,h-1);je(S,e)&&(n&&S.spanAnchor?(s.endRow=S.spanAnchor.endRow,s.startColumn=S.spanAnchor.startColumn):(s.endRow=m+1,s.startColumn=h-1),C=!0)}if(l&&d&&m<o-1&&R<r-1){const S=e.getValue(m+1,R+1);je(S,e)&&(n&&S.spanAnchor?(s.endRow=S.spanAnchor.endRow,s.endColumn=S.spanAnchor.endColumn):(s.endRow=m+1,s.endColumn=R+1),C=!0)}return{hasValue:C,range:s}}function Qa(s,e,t){const n=t.getMaxRows(),o=t.getMaxColumns(),r=Ya(t,0,0,n-1,o-1),a=t.getSnapshot().mergeData.length>0,{left:l,right:u,up:d,down:c}=e;let h=!0,m={...s};const R=[];for(;h;){h=!1;const C=Za({range:m,allMatrixWithSpan:r,directions:e,isWorksheetHasSpan:a,maxRow:n,maxColumn:o});if(C.hasValue){m=C.range,h=!0;continue}if(d&&m.startRow!==0){const{hasValue:S,range:I,spanAnchor:v}=Ja(m,r,1,a);if(v&&R.push(v),S){m=I,h=!0;continue}}if(c&&m.endRow!==n-1){const{hasValue:S,range:I,spanAnchor:v}=Xa(m,r,1,a);if(v&&R.push(v),S){m=I,h=!0;continue}}if(l&&m.startColumn!==0){const{hasValue:S,range:I,spanAnchor:v}=xa(m,r,1,a);if(v&&R.push(v),S){m=I,h=!0;continue}}if(u&&m.endColumn!==o-1){const{hasValue:S,range:I,spanAnchor:v}=Ka(m,r,1,a);if(v&&R.push(v),S){m=I,h=!0;continue}}}return R.length>0&&(m=i.Rectangle.union(m,...R)),m}const To=s=>{const e=new i.ObjectMatrix;return s.forEach(t=>{i.Range.foreach(t,(n,o)=>{e.setValue(n,o,1)})}),e.forValue((t,n)=>{const o=e.getValue(t-1,n);o&&e.setValue(t,n,o+1)}),e},Uo=s=>{const e=s;return e.forValue((t,n)=>{const o=s.getValue(t-1,n);o&&e.setValue(t,n,o+1)}),e},ko=s=>{const e={area:0},t=(n,o)=>e.area<n?(e.area=n,e.range=o,!0):!1;return s.forValue((n,o,r)=>{let a=1,l=r;t(a*l,{startRow:n-l+1,endRow:n,startColumn:o,endColumn:o});const u={startRow:n-l+1,endRow:n,startColumn:0,endColumn:o};for(let d=o-1;d>=0&&s.getValue(n,d);d--){l=Math.min(s.getValue(n,d)||0,l),a++;const c=l*a;u.startColumn=d,u.startRow=n-l+1,t(c,u)}}),e},el=(s,e)=>{i.Range.foreach(e,(t,n)=>{s.realDeleteValue(t,n)});for(let t=e.startColumn;t<=e.endColumn;t++){const n=e.endRow+1;if(s.getValue(n,t)>0){s.setValue(n,t,1);let r=n+1;for(;s.getValue(r,t)>0;)s.setValue(r,t,s.getValue(r-1,t)+1),r++}}return s},Yn=s=>{const e=[];let t=ko(s);for(;t.area>0;)t.range&&(e.push(t.range),el(s,t.range)),t=ko(s);return e},xn=s=>{const e=To(s);return Yn(e)};class tl{constructor(){f(this,"_matrix",new i.ObjectMatrix)}add(...e){return e.forEach(t=>{i.Range.foreach(t,(n,o)=>{this._matrix.setValue(n,o,1)})}),this}subtract(...e){return e.forEach(t=>{i.Range.foreach(t,(n,o)=>{this._matrix.realDeleteValue(n,o)})}),this}merge(){const e=Uo(this._matrix);return Yn(e)}}const nl=1.5,sl="rgba(255, 255, 255, 0.01)";function ol(s){const{rangeWithCoord:e,primaryWithCoord:t,style:n}=s,o={range:{startRow:e.startRow,startColumn:e.startColumn,endRow:e.endRow,endColumn:e.endColumn,rangeType:e.rangeType,unitId:e.unitId,sheetId:e.sheetId},primary:null,style:n};return t!=null&&(o.primary=Po(t)),o}function Po(s){const{actualRow:e,actualColumn:t,isMerged:n,isMergedMainCell:o}=s,{startRow:r,startColumn:a,endRow:l,endColumn:u}=s.mergeInfo;return{actualRow:e,actualColumn:t,isMerged:n,isMergedMainCell:o,startRow:r,startColumn:a,endRow:l,endColumn:u}}var No=(s=>(s[s.Tab=1]="Tab",s[s.Comma=2]="Comma",s[s.Semicolon=4]="Semicolon",s[s.Space=8]="Space",s[s.Custom=16]="Custom",s))(No||{});class rl{constructor(){f(this,"_tabCount",0);f(this,"_commaCount",0);f(this,"_semicolonCount",0);f(this,"_spaceCount",0)}add(e){switch(e){case" ":this._tabCount++;break;case",":this._commaCount++;break;case";":this._semicolonCount++;break;case" ":this._spaceCount++;break}}update(e){e&&typeof e=="string"&&(e.includes(" ")&&this._tabCount++,e.includes(",")&&this._commaCount++,e.includes(";")&&this._semicolonCount++,e.trim().includes(" ")&&this._spaceCount++)}getDelimiter(){const e=Math.max(this._tabCount,this._commaCount,this._semicolonCount,this._spaceCount);return e===0||e===this._tabCount?1:e===this._commaCount?2:e===this._semicolonCount?4:e===this._spaceCount?8:1}}function il(s,e,t){const n=[];t!==void 0&&(s&16)>0&&n.push(t),(s&1)>0&&n.push(" "),(s&2)>0&&n.push(","),(s&4)>0&&n.push(";"),(s&8)>0&&n.push(" ");let o="";for(const a of n)o+=al(a);let r="[".concat(o,"]");return e&&(r+="+"),new RegExp(r)}function al(s){return s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const ll=s=>{var t;return((t=s.body)==null?void 0:t.dataStream.replace(/\r\n$/,""))||""};function ul(s){if(s!=null){if(s.p)return ll(s.p);if(s.v&&typeof s.v=="string")return s.v;if(s.t&&(s.t===i.CellValueType.FORCE_STRING||s.t===i.CellValueType.STRING))return String(s.v)}}function Oo(s,e,t,n,o=!1){const r=i.Range.transformRange(e,s),{startColumn:a,startRow:l,endColumn:u,endRow:d}=r;if(a!==u)throw new Error("The range must be in the same column.");if(t&&(t&16)>0&&(n===void 0||n.length!==1))throw new Error("The custom delimiter must a character.");const c=t===void 0,h=c?new rl:null,m=[];for(let p=l;p<=d;p++){const w=s.getCell(p,a),y=ul(w);m.push(y),h&&h.update(y)}const R=c?h.getDelimiter():t,C=il(R,o,n);let S=-1,I=0,v=0;const M=[];for(const p of m){if(p!==void 0){const w=String(p).split(C);S<0?S=w.length:S=Math.max(S,w.length),M.push(w),I=v}else M.push(void 0);v++}return{rs:M,maxLength:S===-1?0:S,lastRow:I}}const dl=(s,e,t="")=>s.reduce((n,o)=>{const r=o&&o[e];return typeof r!="string"?(console.warn(o,`${e} is not string`),n):(r?(n[r]||(n[r]=[]),n[r].push(o)):n[t].push(o),n)},{}),cl=(s=0)=>{let e=s;return function(){return e++}};function hl(s){return s==null?!1:s.v!==void 0&&s.v!==null&&s.v!==""||s.p!==void 0}function ml(s,e){for(let t=s.startRow;t<=s.endRow;t++)for(let n=s.startColumn;n<=s.endColumn;n++){const o=e.getCell(t,n);if(hl(o))return{startRow:t,startColumn:n,endRow:t,endColumn:n}}return null}function Kn(s){const e=new i.ObjectMatrix;return s.forEach(t=>{const{startRow:n,startColumn:o,endRow:r,endColumn:a}=t;for(let l=n;l<=r;l++)for(let u=o;u<=a;u++)e.setValue(l,u,null)}),e.clone()}function Do(s){const e=new i.ObjectMatrix;return s.forEach(t=>{const{startRow:n,startColumn:o,endRow:r,endColumn:a}=t;for(let l=n;l<=r;l++)for(let u=o;u<=a;u++)e.setValue(l,u,{v:null,p:null,f:null,si:null,custom:null})}),e.clone()}function gl(s){const e=new i.ObjectMatrix;return s.forEach(t=>{const{startRow:n,startColumn:o,endRow:r,endColumn:a}=t;for(let l=n;l<=r;l++)for(let u=o;u<=a;u++)e.setValue(l,u,{s:null})}),e.clone()}function Ao(s,e,t,n){const o=e.get(i.IUniverInstanceService),r=t?o.getUnit(t,i.UniverInstanceType.UNIVER_SHEET):o.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET),a=n?r==null?void 0:r.getSheetBySheetId(n):r==null?void 0:r.getActiveSheet();if(!a)return null;const{startRow:l,endRow:u,startColumn:d,endColumn:c}=s,h=[],m=[];for(let R=l;R<=u;R++)a.getRowFiltered(R)||h.push(R);for(let R=d;R<=c;R++)m.push(R);return{rows:h,cols:m}}function Vt(s,e,t,n){const o=[],r=[];for(const m of s){const R=Ao(m,e,t,n);R&&(o.push(...R.rows),r.push(...R.cols))}const a=Array.from(new Set(o)).sort((m,R)=>m-R),l=Array.from(new Set(r)).sort((m,R)=>m-R),u=[];function d(m){const R=[];let C=m[0];for(let S=1;S<m.length;S++)m[S]!==m[S-1]+1&&(R.push([C,m[S-1]]),C=m[S]);return R.push([C,m[m.length-1]]),R}const c=d(a),h=d(l);for(const[m,R]of c)for(const[C,S]of h)u.push({startRow:m,endRow:R,startColumn:C,endColumn:S});return u}var Wo=(s=>(s.OthersCanView="othersCanView",s.NoOneElseCanView="noOneElseCanView",s))(Wo||{}),Vo=(s=>(s.DesignedUserCanEdit="designedUserCanEdit",s.OnlyMe="onlyMe",s))(Vo||{});class X{constructor(){f(this,"_model",new Map);f(this,"_ruleChange$",new O.Subject);f(this,"ruleChange$",this._ruleChange$.asObservable());f(this,"_ruleRefresh$",new O.Subject);f(this,"ruleRefresh$",this._ruleRefresh$.asObservable());f(this,"_rangeRuleInitStateChange",new O.BehaviorSubject(!1));f(this,"rangeRuleInitStateChange$",this._rangeRuleInitStateChange.asObservable())}dispose(){this._ruleChange$.complete(),this._ruleRefresh$.complete()}ruleRefresh(e){this._ruleRefresh$.next(e)}getRangeRuleInitState(){return this._rangeRuleInitStateChange.value}changeRuleInitState(e){this._rangeRuleInitStateChange.next(e)}addRule(e,t,n){this._ensureRuleMap(e,t).set(n.id,n),this._ruleChange$.next({unitId:e,subUnitId:t,rule:n,type:"add"})}deleteRule(e,t,n){var r,a,l,u;const o=(a=(r=this._model.get(e))==null?void 0:r.get(t))==null?void 0:a.get(n);o&&((u=(l=this._model.get(e))==null?void 0:l.get(t))==null||u.delete(n),this._ruleChange$.next({unitId:e,subUnitId:t,rule:o,type:"delete"}))}setRule(e,t,n,o){var a,l;const r=this.getRule(e,t,n);r&&((l=(a=this._model.get(e))==null?void 0:a.get(t))==null||l.set(n,o),this._ruleChange$.next({unitId:e,subUnitId:t,oldRule:r,rule:o,type:"set"}))}getRule(e,t,n){var o,r;return(r=(o=this._model.get(e))==null?void 0:o.get(t))==null?void 0:r.get(n)}getSubunitRuleList(e,t){var o;return[...(((o=this._model.get(e))==null?void 0:o.get(t))||new Map).values()]}getSubunitRuleListLength(e,t){var o;const n=(o=this._model.get(e))==null?void 0:o.get(t);return n?n.size:0}_ensureRuleMap(e,t){let n=this._model.get(e);n||(n=new Map,this._model.set(e,n));let o=n.get(t);return o||(o=new Map,n.set(t,o)),o}toObject(){const e={};return[...this._model.keys()].forEach(n=>{const o=this._model.get(n),r=[...o.keys()];e[n]={},r.forEach(a=>{const l=o.get(a);e[n][a]=[...l.values()]})}),e}fromObject(e){const t=new Map;Object.keys(e).forEach(n=>{const o=e[n],r=new Map;Object.keys(o).forEach(a=>{const l=o[a].reduce((u,d)=>(u.set(d.id,d),u),new Map);r.set(a,l)}),t.set(n,r)}),this._model=t}deleteUnitModel(e){this._model.delete(e)}createRuleId(e,t){let n=i.generateRandomId(4);const o=this._ensureRuleMap(e,t);for(;o.has(n);)n=i.generateRandomId(4);return n}getTargetByPermissionId(e,t){const n=this._model.get(e);if(!n)return null;for(const[o,r]of n)for(const a of r.values())if(a.permissionId===t)return[e,o];return null}}const Rl=(s,e)=>{const t=s.get(X),n=e.ruleIds.map(r=>t.getRule(e.unitId,e.subUnitId,r)).filter(r=>!!r);return{id:Se.id,params:{subUnitId:e.subUnitId,unitId:e.unitId,rules:n}}},Ue={id:"sheet.mutation.delete-range-protection",type:i.CommandType.MUTATION,handler:(s,e)=>{const{unitId:t,subUnitId:n,ruleIds:o}=e,r=s.get(X);return o.forEach(a=>{r.deleteRule(t,n,a)}),!0}},Cl=s=>{const e={...s,ruleIds:s.rules.map(t=>t.id)};return{id:Ue.id,params:e}},Se={id:"sheet.mutation.add-range-protection",type:i.CommandType.MUTATION,handler:(s,e)=>{const{unitId:t,subUnitId:n,rules:o}=e,r=s.get(X);return o.forEach(a=>{r.addRule(t,n,a)}),!0}},Lo={type:i.CommandType.COMMAND,id:"sheet.command.add-range-protection",async handler(s,e){if(!e)return!1;const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),o=s.get(X),{rule:r,permissionId:a}=e,{unitId:l,subUnitId:u,ranges:d,description:c,viewState:h,editState:m}=r,R=[{ranges:d,permissionId:a,id:o.createRuleId(l,u),description:c,unitType:r.unitType,unitId:l,subUnitId:u,viewState:h,editState:m}];if(await t.executeCommand(Se.id,{unitId:l,subUnitId:u,rules:R})){const S=[{id:Se.id,params:{unitId:l,subUnitId:u,rules:R}}],I=[{id:Ue.id,params:{unitId:l,subUnitId:u,ruleIds:R.map(v=>v.id)}}];n.pushUndoRedo({unitID:l,redoMutations:S,undoMutations:I})}return!0}};var Q=(s=>(s[s.MOVE_START=0]="MOVE_START",s[s.MOVING=1]="MOVING",s[s.MOVE_END=2]="MOVE_END",s[s.ONLY_SET=3]="ONLY_SET",s))(Q||{});class $o extends i.Disposable{constructor(t){super();f(this,"_worksheetSelections",new Map);f(this,"_worksheetLastSelectionPrimaryCell",new Map);f(this,"_selectionMoveStart$",new O.Subject);f(this,"selectionMoveStart$",this._selectionMoveStart$.asObservable());f(this,"_selectionMoving$",new O.Subject);f(this,"selectionMoving$",this._selectionMoving$.asObservable());f(this,"_selectionMoveEnd$",new O.BehaviorSubject([]));f(this,"selectionMoveEnd$",this._selectionMoveEnd$.asObservable());f(this,"_selectionSet$",new O.BehaviorSubject([]));f(this,"selectionSet$",this._selectionSet$.asObservable());f(this,"selectionChanged$");f(this,"_beforeSelectionMoveEnd$",new O.BehaviorSubject([]));f(this,"beforeSelectionMoveEnd$",this._beforeSelectionMoveEnd$.asObservable());this._workbook=t,this.selectionChanged$=O.merge(this._selectionMoveEnd$,this._selectionSet$)}dispose(){super.dispose(),this._beforeSelectionMoveEnd$.complete(),this._selectionMoveEnd$.complete(),this._selectionMoving$.complete(),this._selectionMoveStart$.complete(),this._selectionSet$.complete(),this._workbook=null,this.clear()}addSelections(t,n){const o=this.getSelectionsOfWorksheet(t);o.push(...n),this._selectionSet$.next(o)}setSelections(t,n=[],o){switch(this.setSelectionsOfWorksheet(t,n),o){case Q.MOVE_START:this._selectionMoveStart$.next(n);break;case Q.MOVING:this._selectionMoving$.next(n);break;case Q.MOVE_END:this._beforeSelectionMoveEnd$.next(n),this._selectionMoveEnd$.next(n);break;case Q.ONLY_SET:{this._selectionSet$.next(n);break}default:this._selectionSet$.next(n);break}}getCurrentSelections(){return this._getCurrentSelections()}getSelectionOfWorksheet(t){return this.getSelectionsOfWorksheet(t)}getSelectionsOfWorksheet(t){return this._worksheetSelections.has(t)||this._worksheetSelections.set(t,[]),this._worksheetSelections.get(t)}getLastSelectionPrimaryCellOfWorksheet(t){var n;return(n=this._worksheetLastSelectionPrimaryCell.get(t))!=null?n:null}setSelectionsOfWorksheet(t,n){this._worksheetSelections.set(t,[...n]),n.length>0&&n[n.length-1].primary&&this._worksheetLastSelectionPrimaryCell.set(t,n[n.length-1].primary)}deleteSheetSelection(t){this._worksheetSelections.set(t,[]),this._worksheetLastSelectionPrimaryCell.delete(t)}clear(){this._worksheetSelections.clear(),this._worksheetLastSelectionPrimaryCell.clear(),this._selectionSet$.next([])}_getCurrentSelections(){return this.getSelectionsOfWorksheet(this._workbook.getActiveSheet().getSheetId())}getCurrentLastSelection(){const t=this._getCurrentSelections();return t[t.length-1]}}var Sl=Object.getOwnPropertyDescriptor,fl=(s,e,t,n)=>{for(var o=n>1?void 0:n?Sl(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},Il=(s,e)=>(t,n)=>e(t,n,s);g.SheetsSelectionsService=class extends i.RxDisposable{constructor(t){super();f(this,"_cellStylesCache",new Map);f(this,"selectionMoveStart$");f(this,"selectionMoving$");f(this,"selectionMoveEnd$");f(this,"selectionSet$");f(this,"selectionChanged$");f(this,"_workbookSelections",new Map);this._instanceSrv=t,this._init()}get _currentSelectionPos(){const t=this._instanceSrv.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET);if(!t)return null;const n=t.getActiveSheet();return{unitId:t.getUnitId(),sheetId:n.getSheetId()}}get currentSelectionParam(){return this._currentSelectionPos}_init(){const t=this._instanceSrv.getCurrentTypeOfUnit$(i.UniverInstanceType.UNIVER_SHEET).pipe(O.shareReplay(1),O.takeUntil(this.dispose$));this.selectionMoveStart$=t.pipe().pipe(O.switchMap(n=>n?this._ensureWorkbookSelection(n.getUnitId()).selectionMoveStart$:O.of())).pipe(O.takeUntil(this.dispose$)),this.selectionMoving$=t.pipe(O.switchMap(n=>n?this._ensureWorkbookSelection(n.getUnitId()).selectionMoving$:O.of())).pipe(O.takeUntil(this.dispose$)),this.selectionMoveEnd$=t.pipe(O.switchMap(n=>n?this._ensureWorkbookSelection(n.getUnitId()).selectionMoveEnd$:O.of([]))).pipe(O.takeUntil(this.dispose$)),this.selectionSet$=t.pipe(O.switchMap(n=>n?this._ensureWorkbookSelection(n.getUnitId()).selectionSet$:O.of([]))).pipe(O.takeUntil(this.dispose$)),this.selectionChanged$=t.pipe(O.switchMap(n=>n?this._ensureWorkbookSelection(n.getUnitId()).selectionChanged$:O.of([]))).pipe(O.distinctUntilChanged((n,o)=>n.length!==o.length?!1:n.length===0&&o.length===0?!0:n.every((r,a)=>JSON.stringify(r)===JSON.stringify(o[a]))),O.skip(1)).pipe(O.takeUntil(this.dispose$)),this.disposeWithMe(this._instanceSrv.getTypeOfUnitDisposed$(i.UniverInstanceType.UNIVER_SHEET).pipe(O.takeUntil(this.dispose$)).subscribe(n=>{this._removeWorkbookSelection(n.getUnitId())})),this.disposeWithMe(this.selectionChanged$.pipe(O.takeUntil(this.dispose$)).subscribe(()=>{this._cellStylesCache.clear()}))}dispose(){super.dispose(),this._cellStylesCache.clear(),this._workbookSelections.forEach(t=>t.dispose()),this._workbookSelections.clear(),this.selectionMoveStart$=O.of(null),this.selectionMoving$=O.of(null),this.selectionMoveEnd$=O.of([]),this.selectionSet$=O.of(null),this.selectionChanged$=O.of(null)}clear(){this._workbookSelections.forEach(t=>t.clear())}getCurrentSelections(){return this._getCurrentSelections()}getCurrentLastSelection(){const t=this._getCurrentSelections();return t==null?void 0:t[t.length-1]}getCurrentLastSelectionPrimaryCell(){const t=this._currentSelectionPos;if(!t)return null;const{unitId:n,sheetId:o}=t;return this._ensureWorkbookSelection(n).getLastSelectionPrimaryCellOfWorksheet(o)}addSelections(t,n,o){if(typeof t=="string"){this._ensureWorkbookSelection(t).addSelections(n,o);return}const r=this._currentSelectionPos;if(!r)throw new Error("[SheetsSelectionsService]: cannot find current selection position!");const{unitId:a,sheetId:l}=r;this._ensureWorkbookSelection(a).addSelections(l,t)}setSelections(t,n,o,r){if(typeof t=="string"&&typeof n=="string"){const d=t;this._ensureWorkbookSelection(d).setSelections(n,o||[],r!=null?r:Q.ONLY_SET);return}const a=this._currentSelectionPos;if(!a)throw new Error("[SheetsSelectionsService]: cannot find current selection position!");const{unitId:l,sheetId:u}=a;if(typeof t=="object"){const d=t!=null?t:o,c=n!=null?n:Q.ONLY_SET;this._ensureWorkbookSelection(l).setSelections(u,d,c)}}clearCurrentSelections(){this._getCurrentSelections().splice(0)}isOverlapping(){const t=this.getCurrentSelections();return t==null?!1:t.some(({range:n},o)=>t.some(({range:r},a)=>o===a?!1:n.startRow<=r.endRow&&n.endRow>=r.startRow&&n.startColumn<=r.endColumn&&n.endColumn>=r.startColumn))}_getCurrentSelections(){const t=this._currentSelectionPos;if(!t)return[];const{unitId:n,sheetId:o}=t;return this._ensureWorkbookSelection(n).getSelectionsOfWorksheet(o)}getWorkbookSelections(t){return this._ensureWorkbookSelection(t)}_ensureWorkbookSelection(t){let n=this._workbookSelections.get(t);if(!n){const o=this._instanceSrv.getUnit(t);if(!o)throw new Error(`[SheetsSelectionsService]: cannot resolve unit with id "${t}"!`);n=new $o(o),this._workbookSelections.set(t,n)}return n}_removeWorkbookSelection(t){this._workbookSelections.delete(t)}getCellStylesProperty(t){var a;const n=(a=this._instanceSrv.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET))==null?void 0:a.getActiveSheet(),o=this.getCurrentSelections();if(!n||o.length===0)return{isAllValuesSame:!1,value:null};let r=null;for(let l=0;l<o.length;l++){const u=o[l],{startRow:d,endRow:c,startColumn:h,endColumn:m}=u.range;for(let R=d;R<=c;R++)for(let C=h;C<=m;C++){const S=`${R}_${C}`;let I;this._cellStylesCache.has(S)?I=this._cellStylesCache.get(S):(I=n.getComposedCellStyle(R,C),this._cellStylesCache.set(S,I));const v=I[t];if(r!=null&&!i.Tools.diffValue(r,v))return{isAllValuesSame:!1,value:null};r=v}}return{isAllValuesSame:!0,value:r}}},g.SheetsSelectionsService=fl([Il(0,i.IUniverInstanceService)],g.SheetsSelectionsService);const vl="DISABLE_NORMAL_SELECTIONS",pl="SELECTIONS_ENABLED",Bo="REF_SELECTIONS_ENABLED",rn={id:"sheet.command.clear-selection-all",type:i.CommandType.COMMAND,handler:(s,e)=>{var p;const t=s.get(i.IUniverInstanceService),n=s.get(i.ICommandService),o=s.get(g.SheetsSelectionsService),r=s.get(i.IUndoRedoService),a=s.get(g.SheetInterceptorService),l=t.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET);if(!l)return!1;const u=(e==null?void 0:e.unitId)||l.getUnitId(),d=l.getActiveSheet();if(!d)return!1;const c=(e==null?void 0:e.subUnitId)||d.getSheetId(),h=(e==null?void 0:e.ranges)||((p=o.getCurrentSelections())==null?void 0:p.map(w=>w.range));if(!(h!=null&&h.length))return!1;const m=Vt(h,s,u,c),R=[],C=[],S={subUnitId:c,unitId:u,cellValue:Kn(m)},I=he(s,S);R.push({id:F.id,params:S}),C.push({id:F.id,params:I});const v=a.onCommandExecute({id:rn.id});return R.push(...v.redos),C.unshift(...v.undos),i.sequenceExecute(R,n)?(r.pushUndoRedo({unitID:u,undoMutations:C,redoMutations:R}),!0):!1}},an={id:"sheet.command.clear-selection-format",type:i.CommandType.COMMAND,handler:(s,e)=>{var p;const t=s.get(i.IUniverInstanceService),n=s.get(i.ICommandService),o=s.get(g.SheetsSelectionsService),r=s.get(i.IUndoRedoService),a=s.get(g.SheetInterceptorService),l=t.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET);if(!l)return!1;const u=(e==null?void 0:e.unitId)||l.getUnitId(),d=l.getActiveSheet();if(!d)return!1;const c=(e==null?void 0:e.subUnitId)||d.getSheetId(),h=(e==null?void 0:e.ranges)||((p=o.getCurrentSelections())==null?void 0:p.map(w=>w.range));if(!(h!=null&&h.length))return!1;const m=Vt(h,s,u,c),R=[],C=[],S={subUnitId:c,unitId:u,cellValue:gl(m)},I=he(s,S);R.push({id:F.id,params:S}),C.push({id:F.id,params:I});const v=a.onCommandExecute({id:an.id});return R.push(...v.redos),C.unshift(...v.undos),i.sequenceExecute(R,n)?(r.pushUndoRedo({unitID:u,undoMutations:C,redoMutations:R}),!0):!1}};function Lt(s,e,t=!0){const n=e.getMatrixWithMergedCells(...i.selectionToArray(s)),o=[];if(n.forValue((a,l,u)=>{if(u.colSpan!==void 0&&u.rowSpan!==void 0){const d={startRow:a,startColumn:l,endRow:a+u.rowSpan-1,endColumn:l+u.colSpan-1};i.Rectangle.contains(s,d)||o.push(d)}}),o.length===0)return s;const r=i.Rectangle.union(s,...o);return t?Lt(r,e,t):r}function wl(s,e,t){let n=null;return t.getMatrixWithMergedCells(s,e,s,e).forValue((r,a,l)=>(n={actualRow:r,actualColumn:a,startRow:r,startColumn:a,isMerged:l.rowSpan!==void 0||l.colSpan!==void 0,isMergedMainCell:l.rowSpan!==void 0&&l.colSpan!==void 0,endRow:r+(l.rowSpan!==void 0?l.rowSpan-1:0),endColumn:a+(l.colSpan!==void 0?l.colSpan-1:0),rangeType:i.RANGE_TYPE.NORMAL},!1)),n||{actualColumn:e,actualRow:s,startRow:s,startColumn:e,endRow:s,endColumn:e,isMerged:!1,isMergedMainCell:!1,rangeType:i.RANGE_TYPE.NORMAL}}function Ml(s,e,t){const{startRow:n,startColumn:o,endRow:r,endColumn:a}=s;return Number.isNaN(n)&&(s.startRow=0),Number.isNaN(r)&&(s.endRow=e-1),Number.isNaN(o)&&(s.startColumn=0),Number.isNaN(a)&&(s.endColumn=t-1),s}function oe(s,e){const t=Number.isNaN(s.startRow)?0:s.startRow,n=Number.isNaN(s.startColumn)?0:s.startColumn,o=e.getMergedCell(t,n);return o?{...o,actualRow:t,actualColumn:n,rangeType:i.RANGE_TYPE.NORMAL,isMerged:!0,isMergedMainCell:!0}:{startRow:t,startColumn:n,endRow:s.startRow,endColumn:s.startColumn,actualRow:t,actualColumn:n,rangeType:i.RANGE_TYPE.NORMAL,isMerged:!1,isMergedMainCell:!1}}const ke=(s,e,t)=>({id:q.id,params:{unitId:e.getUnitId(),subUnitId:t.getSheetId(),reveal:!0,selections:[{range:s,primary:oe(s,t)}]}});function yl(s){if(!s)return!1;const{range:e,primary:t}=s;return i.Rectangle.equals(e,t)}function _l(s){function e(t,n){function o(r){for(let a=r.startRow;a<=r.endRow;a++)if(!s.getRowFiltered(a))for(let l=r.startColumn;l<=r.endColumn;l++)n(a,l,r)}o(t)}return{forOperableEach:e}}const Ho=s=>s.id!==ao;function Be(s,e,t,n,o,r,a){const l={};for(let u=e;u<=t;u++)for(let d=n;d<=o;d++){const c=r?s.getCellWithFilteredInterceptors(a,d,lo,Ho):s.getCellWithFilteredInterceptors(u,a,lo,Ho);!c||!c.s||(l[u]||(l[u]={}),l[u][d]={s:c.s})}for(const u in l){for(const d in l[u]){const c=l[u][d];c.s&&typeof c.s=="object"&&i.Tools.isEmptyObject(c.s)&&delete c.s,i.Tools.isEmptyObject(c)&&delete l[u][d]}i.Tools.isEmptyObject(l[u])&&delete l[u]}return l}var bl=Object.getOwnPropertyDescriptor,El=(s,e,t,n)=>{for(var o=n>1?void 0:n?bl(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},Tl=(s,e)=>(t,n)=>e(t,n,s);const Fo=i.createIdentifier("sheets-formula.ref-selections.service");g.RefSelectionsService=class extends g.SheetsSelectionsService{constructor(e){super(e)}_init(){const e=this._getAliveWorkbooks$().pipe(O.takeUntil(this.dispose$));this.selectionMoveStart$=e.pipe(O.switchMap(t=>O.merge(...t.map(n=>n.selectionMoveStart$)))),this.selectionMoving$=e.pipe(O.switchMap(t=>O.merge(...t.map(n=>n.selectionMoving$)))),this.selectionMoveEnd$=e.pipe(O.switchMap(t=>O.merge(...t.map(n=>n.selectionMoveEnd$)))),this.selectionSet$=e.pipe(O.switchMap(t=>O.merge(...t.map(n=>n.selectionSet$))))}dispose(){super.dispose(),this.selectionMoveStart$=O.of(null),this.selectionMoving$=O.of(null),this.selectionMoveEnd$=O.of(null),this.selectionSet$=O.of(null),delete this._instanceSrv,this._workbookSelections.clear()}_getAliveWorkbooks$(){const e=this._instanceSrv.getAllUnitsForType(i.UniverInstanceType.UNIVER_SHEET);e.forEach(n=>this._ensureWorkbookSelection(n.getUnitId()));const t=new O.BehaviorSubject(e);return this.disposeWithMe(this._instanceSrv.getTypeOfUnitAdded$(i.UniverInstanceType.UNIVER_SHEET).subscribe(n=>{this._ensureWorkbookSelection(n.getUnitId()),t.next([...t.getValue(),n])})),this.disposeWithMe(this._instanceSrv.getTypeOfUnitDisposed$(i.UniverInstanceType.UNIVER_SHEET).subscribe(n=>{this._removeWorkbookSelection(n.getUnitId()),t.next(t.getValue().filter(o=>o!==n))})),t.pipe(O.map(n=>n.map(o=>this._ensureWorkbookSelection(o.getUnitId()))))}},g.RefSelectionsService=El([Tl(0,i.IUniverInstanceService)],g.RefSelectionsService);function jo(s,e){const n=s.get(i.IContextService).getContextValue(Bo);return s.get(n&&!e?Fo:g.SheetsSelectionsService)}const q={id:"sheet.operation.set-selections",type:i.CommandType.OPERATION,handler:(s,e)=>{if(!e)return!1;const{selections:t,type:n,unitId:o,subUnitId:r}=e;return jo(s).setSelections(o,r,[...t],n),!0}},Go={id:"sheet.command.select-range",type:i.CommandType.COMMAND,handler:(s,e)=>{if(!e)return!1;const{unitId:t,subUnit:n,range:o}=e,r=s.get(i.ICommandService),a=P(s.get(i.IUniverInstanceService),e);if(!a)return!1;const l=[{range:o,primary:oe(o,a.worksheet),style:null}];return r.syncExecuteCommand(q.id,{unitId:t,subUnitId:n,selections:l})}},zo="sheet.command.move-range",Qe={type:i.CommandType.COMMAND,id:zo,handler:async(s,e)=>{var M,p;const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),o=s.get(i.IUniverInstanceService),r=s.get(i.ErrorService),a=s.get(i.LocaleService),l=s.get(g.SheetInterceptorService),u=P(o);if(!u||!await l.beforeCommandExecute({id:Qe.id,params:e}))return!1;const{worksheet:c,subUnitId:h,unitId:m}=u,R=ln(s,{unitId:m,subUnitId:h,range:e.fromRange},{subUnitId:h,range:e.toRange});if(R===null)return r.emit(a.t("sheets.info.acrossMergedCell")),!1;const C=l.onCommandExecute({id:Qe.id,params:e}),S=[...(M=C.preRedos)!=null?M:[],...R.redos,...C.redos,{id:q.id,params:{unitId:m,subUnitId:h,selections:[{range:e.toRange,primary:Ul(e.fromRange,e.toRange,c)}],type:Q.MOVE_END}}],I=[...(p=C.preUndos)!=null?p:[],...R.undos,...C.undos,{id:q.id,params:{unitId:m,subUnitId:h,selections:[{range:e.fromRange,primary:oe(e.fromRange,c)}],type:Q.MOVE_END}}];if(i.sequenceExecute(S,t).result){const{undos:w,redos:y}=l.generateMutationsOfAutoHeight({unitId:m,subUnitId:h,ranges:[e.fromRange,e.toRange]}),b=l.afterCommandExecute({id:Qe.id,params:e});return i.sequenceExecute([...b.redos,...y],t),n.pushUndoRedo({unitID:m,undoMutations:[...I,...b.undos,...w],redoMutations:[...S,...b.redos,...y]}),!0}return!1}};function ln(s,e,t,n=!1){const o=[],r=[],{range:a,subUnitId:l,unitId:u}=e,{range:d,subUnitId:c}=t,m=s.get(i.IUniverInstanceService).getUniverSheetInstance(u),R=m==null?void 0:m.getSheetBySheetId(c),C=m==null?void 0:m.getSheetBySheetId(l),S=R==null?void 0:R.getCellMatrix(),I=C==null?void 0:C.getCellMatrix();if(R&&C&&S&&I){const v=Lt(d,R,!1);if(!i.Rectangle.equals(d,v)&&!n)return null;const M=new i.ObjectMatrix,p=new i.ObjectMatrix,w=new i.ObjectMatrix;i.Range.foreach(a,(T,E)=>{const N=I.getValue(T,E);if(M.setValue(T,E,i.Tools.deepClone(N)),N){const V=m==null?void 0:m.getStyles().get(N.s);w.setValue(T,E,i.Tools.deepClone(V))}p.setValue(T,E,null)});const y=new i.ObjectMatrix,b=new i.ObjectMatrix;i.Range.foreach(d,(T,E)=>{y.setValue(T,E,i.Tools.deepClone(S.getValue(T,E)))}),i.Range.foreach(a,(T,E)=>{const N=i.cellToRange(T,E),V=i.Rectangle.getRelativeRange(N,a),W=i.Rectangle.getPositionRange(V,d),L=i.Tools.deepClone(w.getValue(T,E)),$=i.Tools.deepClone(M.getValue(T,E));$&&L&&($.s=L),b.setValue(W.startRow,W.startColumn,$)});const U={fromRange:e.range,toRange:t.range,from:{value:p.getMatrix(),subUnitId:l},to:{value:b.getMatrix(),subUnitId:c},unitId:u},k={fromRange:t.range,toRange:e.range,from:{value:M.getMatrix(),subUnitId:l},to:{value:y.getMatrix(),subUnitId:c},unitId:u};o.push({id:Fe.id,params:U}),r.push({id:Fe.id,params:k})}return{redos:o,undos:r}}function Ul(s,e,t){const n=s.startRow,o=s.startColumn,r=t.getMergedCell(n,o),a=oe(e,t);if(r){const l=r.endRow-r.startRow+1,u=r.endColumn-r.startColumn+1;a.endRow=a.startRow+l-1,a.endColumn=a.startColumn+u-1,a.actualRow=a.startRow,a.actualColumn=a.startColumn,a.isMerged=!1,a.isMergedMainCell=!0}return a}var un=(s=>(s[s.UNIVER_UNKNOWN=0]="UNIVER_UNKNOWN",s[s.UNIVER_DOC=1]="UNIVER_DOC",s[s.UNIVER_SHEET=2]="UNIVER_SHEET",s[s.UNIVER_SLIDE=3]="UNIVER_SLIDE",s[s.UNIVER_PROJECT=4]="UNIVER_PROJECT",s[s.UNRECOGNIZED=-1]="UNRECOGNIZED",s))(un||{}),_=(s=>(s[s.View=0]="View",s[s.Edit=1]="Edit",s[s.ManageCollaborator=2]="ManageCollaborator",s[s.Print=3]="Print",s[s.Duplicate=4]="Duplicate",s[s.Comment=5]="Comment",s[s.Copy=6]="Copy",s[s.Share=7]="Share",s[s.Export=8]="Export",s[s.MoveWorksheet=9]="MoveWorksheet",s[s.DeleteWorksheet=10]="DeleteWorksheet",s[s.HideWorksheet=11]="HideWorksheet",s[s.RenameWorksheet=12]="RenameWorksheet",s[s.CreateWorksheet=13]="CreateWorksheet",s[s.SetWorksheetStyle=14]="SetWorksheetStyle",s[s.EditWorksheetCell=15]="EditWorksheetCell",s[s.InsertHyperlink=16]="InsertHyperlink",s[s.Sort=17]="Sort",s[s.Filter=18]="Filter",s[s.PivotTable=19]="PivotTable",s[s.FloatImg=20]="FloatImg",s[s.History=21]="History",s[s.RwHgtClWdt=22]="RwHgtClWdt",s[s.ViemRwHgtClWdt=23]="ViemRwHgtClWdt",s[s.ViewFilter=24]="ViewFilter",s[s.MoveSheet=25]="MoveSheet",s[s.DeleteSheet=26]="DeleteSheet",s[s.HideSheet=27]="HideSheet",s[s.CopySheet=28]="CopySheet",s[s.RenameSheet=29]="RenameSheet",s[s.CreateSheet=30]="CreateSheet",s[s.SelectProtectedCells=31]="SelectProtectedCells",s[s.SelectUnProtectedCells=32]="SelectUnProtectedCells",s[s.SetCellStyle=33]="SetCellStyle",s[s.SetCellValue=34]="SetCellValue",s[s.SetRowStyle=35]="SetRowStyle",s[s.SetColumnStyle=36]="SetColumnStyle",s[s.InsertRow=37]="InsertRow",s[s.InsertColumn=38]="InsertColumn",s[s.DeleteRow=39]="DeleteRow",s[s.DeleteColumn=40]="DeleteColumn",s[s.EditExtraObject=41]="EditExtraObject",s[s.Delete=42]="Delete",s[s.RecoverHistory=43]="RecoverHistory",s[s.ViewHistory=44]="ViewHistory",s[s.CreatePermissionObject=45]="CreatePermissionObject",s[s.UNRECOGNIZED=-1]="UNRECOGNIZED",s))(_||{}),D=(s=>(s[s.Unkonwn=0]="Unkonwn",s[s.Workbook=1]="Workbook",s[s.Worksheet=2]="Worksheet",s[s.SelectRange=3]="SelectRange",s[s.Document=4]="Document",s[s.Slide=5]="Slide",s[s.UNRECOGNIZED=-1]="UNRECOGNIZED",s))(D||{});class fe{constructor(e,t,n){f(this,"type",D.SelectRange);f(this,"subType",_.Edit);f(this,"status",i.PermissionStatus.INIT);f(this,"value",!0);f(this,"id");f(this,"unitId");f(this,"subUnitId");f(this,"permissionId");this.unitId=e,this.subUnitId=t,this.permissionId=n,this.id=`${D.SelectRange}.${_.Edit}.${n}`}}class dn{constructor(e,t,n){f(this,"type",D.SelectRange);f(this,"subType",_.View);f(this,"status",i.PermissionStatus.INIT);f(this,"value",!1);f(this,"id");f(this,"unitId");f(this,"subUnitId");f(this,"permissionId");this.unitId=e,this.subUnitId=t,this.permissionId=n,this.id=`${D.SelectRange}.${_.View}.${n}`}}class Jn{constructor(e){f(this,"id");f(this,"value",!0);f(this,"type",D.Workbook);f(this,"status",i.PermissionStatus.INIT);f(this,"subType",_.Comment);this.unitId=e,this.unitId=e,this.id=`${this.type}.${_.Comment}_${e}`}}class Xn{constructor(e){f(this,"id");f(this,"value",!0);f(this,"type",D.Workbook);f(this,"status",i.PermissionStatus.INIT);f(this,"subType",_.Copy);this.unitId=e,this.unitId=e,this.id=`${this.type}.${_.Copy}_${e}`}}class qo{constructor(e){f(this,"id");f(this,"value",!0);f(this,"type",D.Workbook);f(this,"subType",_.CopySheet);f(this,"status",i.PermissionStatus.INIT);this.unitId=e,this.unitId=e,this.id=`${this.type}.${_.CopySheet}_${e}`}}class Zn{constructor(e){f(this,"id");f(this,"value",!0);f(this,"type",D.Workbook);f(this,"status",i.PermissionStatus.INIT);f(this,"subType",_.CreatePermissionObject);this.unitId=e,this.unitId=e,this.id=`${this.type}.${_.CreatePermissionObject}_${e}`}}class Qn{constructor(e){f(this,"id");f(this,"value",!0);f(this,"type",D.Workbook);f(this,"status",i.PermissionStatus.INIT);f(this,"subType",_.CreateSheet);this.unitId=e,this.unitId=e,this.id=`${this.type}.${_.CreateSheet}_${e}`}}class Yo{constructor(e){f(this,"value",!0);f(this,"type",D.Workbook);f(this,"status",i.PermissionStatus.INIT);f(this,"id");f(this,"subType",_.DeleteColumn);this.unitId=e,this.id=`${this.type}.${_.DeleteColumn}_${e}`}}class xo{constructor(e){f(this,"value",!0);f(this,"type",D.Workbook);f(this,"status",i.PermissionStatus.INIT);f(this,"id");f(this,"subType",_.DeleteRow);this.unitId=e,this.id=`${this.type}.${_.DeleteRow}_${e}`}}class es{constructor(e){f(this,"id");f(this,"value",!0);f(this,"type",D.Workbook);f(this,"status",i.PermissionStatus.INIT);f(this,"subType",_.DeleteSheet);this.unitId=e,this.unitId=e,this.id=`${this.type}.${_.DeleteSheet}_${e}`}}class ts{constructor(e){f(this,"id");f(this,"value",!0);f(this,"type",D.Workbook);f(this,"status",i.PermissionStatus.INIT);f(this,"subType",_.Duplicate);this.unitId=e,this.unitId=e,this.id=`${this.type}.${_.Duplicate}_${e}`}}class me{constructor(e){f(this,"id");f(this,"value",!0);f(this,"type",D.Workbook);f(this,"status",i.PermissionStatus.INIT);f(this,"subType",_.Edit);this.unitId=e,this.unitId=e,this.id=`${this.type}.${_.Edit}_${e}`}}class ns{constructor(e){f(this,"id");f(this,"value",!0);f(this,"type",D.Workbook);f(this,"status",i.PermissionStatus.INIT);f(this,"subType",_.Export);this.unitId=e,this.unitId=e,this.id=`${this.type}.${_.Export}_${e}`}}class cn{constructor(e){f(this,"id");f(this,"value",!0);f(this,"type",D.Workbook);f(this,"status",i.PermissionStatus.INIT);f(this,"subType",_.HideSheet);this.unitId=e,this.unitId=e,this.id=`${this.type}.${_.HideSheet}_${e}`}}class Ko{constructor(e){f(this,"id");f(this,"value",!0);f(this,"type",D.Workbook);f(this,"status",i.PermissionStatus.INIT);f(this,"subType",_.History);this.unitId=e,this.unitId=e,this.id=`${this.type}.${_.History}_${e}`}}class Jo{constructor(e){f(this,"value",!0);f(this,"type",D.Workbook);f(this,"status",i.PermissionStatus.INIT);f(this,"id");f(this,"subType",_.InsertColumn);this.unitId=e,this.id=`${this.type}.${_.InsertColumn}_${e}`}}class Xo{constructor(e){f(this,"value",!0);f(this,"type",D.Workbook);f(this,"status",i.PermissionStatus.INIT);f(this,"id");f(this,"subType",_.InsertRow);this.unitId=e,this.id=`${this.type}.${_.InsertRow}_${e}`}}class hn{constructor(e){f(this,"id");f(this,"value",!0);f(this,"type",D.Workbook);f(this,"status",i.PermissionStatus.INIT);f(this,"subType",_.ManageCollaborator);this.unitId=e,this.unitId=e,this.id=`${this.type}.${_.ManageCollaborator}_${e}`}}class mn{constructor(e){f(this,"id");f(this,"value",!0);f(this,"type",D.Workbook);f(this,"status",i.PermissionStatus.INIT);f(this,"subType",_.MoveSheet);this.unitId=e,this.unitId=e,this.id=`${this.type}.${_.MoveSheet}_${e}`}}class ss{constructor(e){f(this,"id");f(this,"value",!0);f(this,"type",D.Workbook);f(this,"status",i.PermissionStatus.INIT);f(this,"subType",_.Print);this.unitId=e,this.unitId=e,this.id=`${this.type}.${_.Print}_${e}`}}class os{constructor(e){f(this,"id");f(this,"value",!0);f(this,"type",D.Workbook);f(this,"status",i.PermissionStatus.INIT);f(this,"subType",_.RecoverHistory);this.unitId=e,this.unitId=e,this.id=`${this.type}.${_.RecoverHistory}_${e}`}}class gn{constructor(e){f(this,"id");f(this,"value",!0);f(this,"type",D.Workbook);f(this,"status",i.PermissionStatus.INIT);f(this,"subType",_.RenameSheet);this.unitId=e,this.unitId=e,this.id=`${this.type}.${_.RenameSheet}_${e}`}}class rs{constructor(e){f(this,"id");f(this,"value",!0);f(this,"type",D.Workbook);f(this,"status",i.PermissionStatus.INIT);f(this,"subType",_.Share);this.unitId=e,this.unitId=e,this.id=`${this.type}.${_.Share}_${e}`}}class is{constructor(e){f(this,"id");f(this,"value",!0);f(this,"type",D.Workbook);f(this,"status",i.PermissionStatus.INIT);f(this,"subType",_.View);this.unitId=e,this.unitId=e,this.id=`${this.type}.${_.View}_${e}`}}class as{constructor(e){f(this,"id");f(this,"value",!0);f(this,"type",D.Workbook);f(this,"status",i.PermissionStatus.INIT);f(this,"subType",_.ViewHistory);this.unitId=e,this.unitId=e,this.id=`${this.type}.${_.ViewHistory}_${e}`}}class ls{constructor(e,t){f(this,"value",!0);f(this,"type",D.Worksheet);f(this,"status",i.PermissionStatus.INIT);f(this,"id");f(this,"subType",_.Copy);this.unitId=e,this.subUnitId=t,this.id=`${this.type}.${_.Copy}_${e}_${t}`}}class us{constructor(e,t){f(this,"value",!0);f(this,"type",D.Worksheet);f(this,"status",i.PermissionStatus.INIT);f(this,"id");f(this,"subType",_.DeleteColumn);this.unitId=e,this.subUnitId=t,this.id=`${this.type}.${_.DeleteColumn}_${e}_${t}`}}class ds{constructor(e,t){f(this,"value",!0);f(this,"type",D.Worksheet);f(this,"status",i.PermissionStatus.INIT);f(this,"id");f(this,"subType",_.Delete);this.unitId=e,this.subUnitId=t,this.id=`${this.type}.${_.Delete}_${e}_${t}`}}class cs{constructor(e,t){f(this,"value",!0);f(this,"type",D.Worksheet);f(this,"status",i.PermissionStatus.INIT);f(this,"id");f(this,"subType",_.DeleteRow);this.unitId=e,this.subUnitId=t,this.id=`${this.type}.${_.DeleteRow}_${e}_${t}`}}class Ie{constructor(e,t){f(this,"value",!0);f(this,"type",D.Worksheet);f(this,"status",i.PermissionStatus.INIT);f(this,"id");f(this,"subType",_.Edit);this.unitId=e,this.subUnitId=t,this.id=`${this.type}.${_.Edit}_${e}_${t}`}}class hs{constructor(e,t){f(this,"value",!0);f(this,"type",D.Worksheet);f(this,"status",i.PermissionStatus.INIT);f(this,"id");f(this,"subType",_.EditExtraObject);this.unitId=e,this.subUnitId=t,this.id=`${this.type}.${_.EditExtraObject}_${e}_${t}`}}class ms{constructor(e,t){f(this,"value",!0);f(this,"type",D.Worksheet);f(this,"status",i.PermissionStatus.INIT);f(this,"id");f(this,"subType",_.Filter);this.unitId=e,this.subUnitId=t,this.id=`${this.type}.${_.Filter}_${e}_${t}`}}class gs{constructor(e,t){f(this,"value",!0);f(this,"type",D.Worksheet);f(this,"status",i.PermissionStatus.INIT);f(this,"id");f(this,"subType",_.InsertColumn);this.unitId=e,this.subUnitId=t,this.id=`${this.type}.${_.InsertColumn}_${e}_${t}`}}class Rs{constructor(e,t){f(this,"value",!0);f(this,"type",D.Worksheet);f(this,"status",i.PermissionStatus.INIT);f(this,"id");f(this,"subType",_.InsertHyperlink);this.unitId=e,this.subUnitId=t,this.id=`${this.type}.${_.InsertHyperlink}_${e}_${t}`}}class Cs{constructor(e,t){f(this,"value",!0);f(this,"type",D.Worksheet);f(this,"status",i.PermissionStatus.INIT);f(this,"id");f(this,"subType",_.InsertRow);this.unitId=e,this.subUnitId=t,this.id=`${this.type}.${_.InsertRow}_${e}_${t}`}}class Ss{constructor(e,t){f(this,"value",!0);f(this,"type",D.Worksheet);f(this,"status",i.PermissionStatus.INIT);f(this,"id");f(this,"subType",_.ManageCollaborator);this.unitId=e,this.subUnitId=t,this.id=`${this.type}.${_.ManageCollaborator}_${e}_${t}`}}class fs{constructor(e,t){f(this,"value",!0);f(this,"type",D.Worksheet);f(this,"status",i.PermissionStatus.INIT);f(this,"id");f(this,"subType",_.PivotTable);this.unitId=e,this.subUnitId=t,this.id=`${this.type}.${_.PivotTable}_${e}_${t}`}}class kl{constructor(e,t){f(this,"value",!0);f(this,"type",D.Worksheet);f(this,"status",i.PermissionStatus.INIT);f(this,"id");f(this,"subType",_.SelectProtectedCells);this.unitId=e,this.subUnitId=t,this.id=`${this.type}.${_.SelectProtectedCells}_${e}_${t}`}}class Pl{constructor(e,t){f(this,"value",!0);f(this,"type",D.Worksheet);f(this,"status",i.PermissionStatus.INIT);f(this,"id");f(this,"subType",_.SelectUnProtectedCells);this.unitId=e,this.subUnitId=t,this.id=`${this.type}.${_.SelectUnProtectedCells}_${e}_${t}`}}class Is{constructor(e,t){f(this,"value",!0);f(this,"type",D.Worksheet);f(this,"status",i.PermissionStatus.INIT);f(this,"id");f(this,"subType",_.SetCellStyle);this.unitId=e,this.subUnitId=t,this.id=`${this.type}.${_.SetCellStyle}_${e}_${t}`}}class $t{constructor(e,t){f(this,"value",!0);f(this,"type",D.Worksheet);f(this,"status",i.PermissionStatus.INIT);f(this,"id");f(this,"subType",_.SetCellValue);this.unitId=e,this.subUnitId=t,this.id=`${this.type}.${_.SetCellValue}_${e}_${t}`}}class pt{constructor(e,t){f(this,"value",!0);f(this,"type",D.Worksheet);f(this,"status",i.PermissionStatus.INIT);f(this,"id");f(this,"subType",_.SetColumnStyle);this.unitId=e,this.subUnitId=t,this.id=`${this.type}.${_.SetColumnStyle}_${e}_${t}`}}class wt{constructor(e,t){f(this,"value",!0);f(this,"type",D.Worksheet);f(this,"status",i.PermissionStatus.INIT);f(this,"id");f(this,"subType",_.SetRowStyle);this.unitId=e,this.subUnitId=t,this.id=`${this.type}.${_.SetRowStyle}_${e}_${t}`}}class vs{constructor(e,t){f(this,"value",!0);f(this,"type",D.Worksheet);f(this,"status",i.PermissionStatus.INIT);f(this,"id");f(this,"subType",_.Sort);this.unitId=e,this.subUnitId=t,this.id=`${this.type}.${_.Sort}_${e}_${t}`}}class Bt{constructor(e,t){f(this,"value",!0);f(this,"type",D.Worksheet);f(this,"status",i.PermissionStatus.INIT);f(this,"id");f(this,"subType",_.View);this.unitId=e,this.subUnitId=t,this.id=`${this.type}.${_.View}_${e}_${t}`}}const Mt={id:"sheet.command.set-range-values",type:i.CommandType.COMMAND,handler:(s,e)=>{var V;const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),o=s.get(i.IUniverInstanceService),r=s.get(g.SheetsSelectionsService),a=s.get(g.SheetInterceptorService),l=s.get(i.IPermissionService),u=P(o,e);if(!u)return!1;const{subUnitId:d,unitId:c,workbook:h,worksheet:m}=u,{value:R,range:C,redoUndoId:S}=e,I=C?[C]:(V=r.getCurrentSelections())==null?void 0:V.map(W=>W.range);if(!I||!I.length||!l.getPermissionPoint(new Ie(c,d).id))return!1;const v=new i.ObjectMatrix;let M;if(i.Tools.isArray(R))for(let W=0;W<I.length;W++){const{startRow:L,startColumn:$,endRow:Y,endColumn:z}=I[W];for(let x=0;x<=Y-L;x++)for(let re=0;re<=z-$;re++)v.setValue(x+L,re+$,R[x][re])}else if(i.isICellData(R))for(let W=0;W<I.length;W++){const{startRow:L,startColumn:$,endRow:Y,endColumn:z}=I[W];for(let x=L;x<=Y;x++)for(let re=$;re<=z;re++)v.setValue(x,re,R)}else M=R;const p={subUnitId:d,unitId:c,cellValue:M!=null?M:v.getMatrix()},w=he(s,p),y=i.mapObjectMatrix(p.cellValue,(W,L)=>m.getCellHeight(W,L)||void 0);if(!t.syncExecuteCommand(F.id,p))return!1;const{undos:U,redos:k}=a.onCommandExecute({id:Mt.id,params:p}),{undos:T,redos:E}=a.generateMutationsOfAutoHeight({unitId:c,subUnitId:d,ranges:I,cellHeights:new i.ObjectMatrix(y)});if(i.sequenceExecute([...k,...E],t).result){const W=ke(C!=null?C:v.getRange(),h,m);return n.pushUndoRedo({unitID:c,undoMutations:[{id:F.id,params:w},...U,...T,W],redoMutations:[{id:F.id,params:p},...k,...E,i.Tools.deepClone(W)],id:S}),!0}return!1}};function ps(s,e){const t=[],n=[],{unitId:o,subUnitId:r,range:a,shiftDimension:l,cellValue:u={}}=e,d=s.get(i.IUniverInstanceService),c=s.get(g.SheetInterceptorService),h=d.getUniverSheetInstance(o),m=h==null?void 0:h.getSheetBySheetId(r);if(m){const R=m.getCellMatrix(),C=R.getDataRange();if(a.startColumn<=C.endColumn||a.startRow<=C.endRow){let p,w;if(l===i.Dimension.COLUMNS){const b=Math.min(a.endRow,C.endRow);let U=0;for(let T=a.startRow;T<=b;T++){const E=R.getRow(T),N=E?i.getArrayLength(E)-1:0;U=Math.max(U,N)}p={startRow:a.startRow,startColumn:a.startColumn,endRow:b,endColumn:U};const k=a.endColumn-a.startColumn+1;w={startRow:a.startRow,startColumn:p.startColumn+k,endRow:b,endColumn:p.endColumn+k}}else{const b=Math.min(a.endColumn,C.endColumn),U=C.endRow;p={startRow:a.startRow,startColumn:a.startColumn,endRow:U,endColumn:b};const k=a.endRow-a.startRow+1;w={startRow:p.startRow+k,startColumn:a.startColumn,endRow:p.endRow+k,endColumn:b}}const y=ln(s,{unitId:o,subUnitId:r,range:p},{subUnitId:r,range:w},!0);y&&(t.push(...y.redos),n.push(...y.undos))}if(Object.entries(u).length===0)for(let p=a.startRow;p<=a.endRow;p++){u[p]||(u[p]={});for(let w=a.startColumn;w<=a.endColumn;w++)u[p][w]=null}const S={subUnitId:r,unitId:o,cellValue:u},I=he(s,S),{undos:v,redos:M}=c.onCommandExecute({id:Mt.id,params:{...S,range:a}});t.push({id:F.id,params:S},...M),n.push({id:F.id,params:I},...v)}return{redo:t,undo:n}}function ws(s,e){const t=[],n=[],{unitId:o,subUnitId:r,range:a,shiftDimension:l}=e,u=s.get(i.IUniverInstanceService),d=s.get(g.SheetInterceptorService),c=u.getUniverSheetInstance(o),h=c==null?void 0:c.getSheetBySheetId(r);if(h){const m=h.getCellMatrix(),R=m.getDataRange(),C={subUnitId:r,unitId:o,cellValue:Kn([a])},S=he(s,C),I=d.onCommandExecute({id:Mt.id,params:C});if(t.push({id:F.id,params:C},...I.redos),n.push(...I.undos,{id:F.id,params:S}),a.startColumn<=R.endColumn||a.startRow<=R.endRow){let v=null,M=null;if(l===i.Dimension.COLUMNS&&a.endColumn<R.endColumn){const p=Math.min(a.endRow,R.endRow);let w=0;for(let b=a.startRow;b<=p;b++){const U=m.getRow(b),k=U?i.getArrayLength(U)-1:0;w=Math.max(w,k)}v={startRow:a.startRow,startColumn:a.endColumn+1,endRow:p,endColumn:w};const y=a.endColumn-a.startColumn+1;M={startRow:a.startRow,startColumn:v.startColumn-y,endRow:p,endColumn:v.endColumn-y}}if(l===i.Dimension.ROWS&&a.endRow<R.endRow){const p=Math.min(a.endColumn,R.endColumn),w=R.endRow;v={startRow:a.endRow+1,startColumn:a.startColumn,endRow:w,endColumn:p};const y=a.endRow-a.startRow+1;M={startRow:v.startRow-y,startColumn:a.startColumn,endRow:v.endRow-y,endColumn:p}}if(v&&M){const p=ln(s,{unitId:o,subUnitId:r,range:v},{subUnitId:r,range:M},!0);p&&(t.push(...p.redos),n.push(...p.undos))}}}return{redo:t,undo:n}}function Nl(s,e,t,n,o,r){const{startRow:a,endRow:l,startColumn:u,endColumn:d}=e;if(o===i.Dimension.ROWS){const c=l-a+1;for(let h=t;h>=a;h--)for(let m=u;m<=d;m++){const R=s.getValue(h,m);R==null?s.realDeleteValue(h+c,m):s.setValue(h+c,m,R)}for(let h=l;h>=a;h--)for(let m=u;m<=d;m++)r&&r[h]&&r[h][m]?s.setValue(h,m,r[h][m]):s.realDeleteValue(h,m)}else if(o===i.Dimension.COLUMNS){const c=d-u+1;for(let h=a;h<=l;h++)for(let m=n;m>=u;m--){const R=s.getValue(h,m);R==null?s.realDeleteValue(h,m+c):s.setValue(h,m+c,R)}for(let h=a;h<=l;h++)for(let m=d;m>=u;m--)r&&r[h]&&r[h][m]?s.setValue(h,m,r[h][m]):s.realDeleteValue(h,m)}}function Ol(s,e,t,n,o){const{startRow:r,endRow:a,startColumn:l,endColumn:u}=e,d=a-r+1,c=u-l+1;if(o===i.Dimension.ROWS)for(let h=r;h<=t;h++)for(let m=l;m<=u;m++){const R=s.getValue(h+d,m);R==null?s.realDeleteValue(h,m):s.setValue(h,m,R)}else if(o===i.Dimension.COLUMNS)for(let h=r;h<=a;h++)for(let m=l;m<=n;m++){const R=s.getValue(h,m+c);R==null?s.realDeleteValue(h,m):s.setValue(h,m,R)}}const Zo="sheet.command.delete-range-move-left",Ge={type:i.CommandType.COMMAND,id:Zo,handler:async(s,e)=>{var w,y,b;const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),o=s.get(i.IUniverInstanceService),r=s.get(g.SheetsSelectionsService),a=s.get(g.SheetInterceptorService),l=P(o);if(!l)return!1;const{worksheet:u,workbook:d,subUnitId:c,unitId:h}=l;let m=e==null?void 0:e.range;if(m||(m=(w=r.getCurrentLastSelection())==null?void 0:w.range),!m)return!1;const R={range:m,subUnitId:c,unitId:h,shiftDimension:i.Dimension.COLUMNS},C=a.onCommandExecute({id:Ge.id,params:{range:m}}),{redo:S,undo:I}=ws(s,R),v=[...(y=C.preRedos)!=null?y:[],...S],M=[...C.undos,...I];if(v.push(...C.redos),v.push(ke(m,d,u)),M.push(...(b=C.preUndos)!=null?b:[]),i.sequenceExecute(v,t).result){const U=a.afterCommandExecute({id:Ge.id,params:{range:m}});return i.sequenceExecute(U.redos,t),M.push(...U.undos),v.push(...U.redos),n.pushUndoRedo({unitID:h,undoMutations:M.reverse(),redoMutations:v}),!0}return!1}},Qo="sheet.command.delete-range-move-up",ze={type:i.CommandType.COMMAND,id:Qo,handler:async(s,e)=>{var w,y,b;const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),o=s.get(i.IUniverInstanceService),r=s.get(g.SheetsSelectionsService),a=s.get(g.SheetInterceptorService),l=P(o);if(!l)return!1;const{unitId:u,subUnitId:d,workbook:c,worksheet:h}=l;let m=e==null?void 0:e.range;if(m||(m=(w=r.getCurrentLastSelection())==null?void 0:w.range),!m)return!1;const R={range:m,subUnitId:d,unitId:u,shiftDimension:i.Dimension.ROWS},C=a.onCommandExecute({id:ze.id,params:{range:m}}),{redo:S,undo:I}=ws(s,R),v=[...(y=C.preRedos)!=null?y:[],...S],M=[...C.undos,...I];if(v.push(...C.redos),v.push(ke(m,c,h)),M.push(...(b=C.preUndos)!=null?b:[]),i.sequenceExecute(v,t).result){const U=a.afterCommandExecute({id:ze.id,params:{range:m}});return i.sequenceExecute(U.redos,t),M.push(...U.undos),v.push(...U.redos),n.pushUndoRedo({unitID:u,undoMutations:M.reverse(),redoMutations:v}),!0}return!1}},Dl="sheet.command.insert-range-move-down",et={type:i.CommandType.COMMAND,id:"sheet.command.insert-range-move-down",handler:async(s,e)=>{var V,W,L;const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),o=s.get(i.IUniverInstanceService),r=s.get(g.SheetsSelectionsService),a=s.get(g.SheetInterceptorService),l=s.get(i.ErrorService),u=s.get(i.LocaleService);if(r.isOverlapping())return l.emit(u.t("sheets.info.overlappingSelections")),!1;const d=P(o);if(!d)return!1;const{unitId:c,subUnitId:h,worksheet:m,workbook:R}=d;let C=e==null?void 0:e.range;if(C||(C=(V=r.getCurrentLastSelection())==null?void 0:V.range),!C)return!1;const S=[],I=[],v=m.getCellMatrix(),M=v.getDataRange(),w=v.getSlice(M.startRow,M.endRow,C.startColumn,C.endColumn).getDataRange().endRow,y=Math.max(w+(C.endRow-C.startRow+1)-M.endRow,0);if(y>0){const $=C.startRow-1,Y=m.getRowHeight($),z={unitId:c,subUnitId:h,range:{startRow:M.endRow+1,endRow:M.endRow+y,startColumn:M.startColumn,endColumn:M.endColumn},rowInfo:new Array(y).fill(void 0).map(()=>({h:Y,hd:i.BooleanNumber.FALSE}))};S.push({id:ie.id,params:z});const x=sn(s,z);I.push({id:le.id,params:x})}const b={};i.Range.foreach(C,($,Y)=>{const z=m.getCell($,Y);z&&(b[$]||(b[$]={}),b[$][Y]={s:z.s})});const U={range:C,subUnitId:h,unitId:c,shiftDimension:i.Dimension.ROWS,cellValue:b},{redo:k,undo:T}=ps(s,U);S.push(...k),I.push(...T);const E=a.onCommandExecute({id:et.id,params:{range:C}});if(S.push(...E.redos),S.push(ke(C,R,m)),I.push(...(W=E.preUndos)!=null?W:[]),S.unshift(...(L=E.preRedos)!=null?L:[]),I.unshift(...E.undos),i.sequenceExecute(S,t)){const $=a.afterCommandExecute({id:et.id,params:{range:C}});return i.sequenceExecute($.redos,t),I.push(...$.undos),S.push(...$.redos),n.pushUndoRedo({unitID:c,undoMutations:I.reverse(),redoMutations:S}),!0}return!1}},Ms="sheet.command.insert-range-move-right",yt={type:i.CommandType.COMMAND,id:Ms,handler:async(s,e)=>{var V,W,L;const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),o=s.get(i.IUniverInstanceService),r=s.get(g.SheetsSelectionsService),a=s.get(g.SheetInterceptorService),l=s.get(i.ErrorService),u=s.get(i.LocaleService);if(r.isOverlapping())return l.emit(u.t("sheets.info.overlappingSelections")),!1;const d=P(o);if(!d)return!1;const{workbook:c,worksheet:h,unitId:m,subUnitId:R}=d;let C=e==null?void 0:e.range;if(C||(C=(V=r.getCurrentLastSelection())==null?void 0:V.range),!C)return!1;const S=[],I=[],v=h.getCellMatrix(),M=v.getDataRange(),w=v.getSlice(C.startRow,C.endRow,M.startColumn,M.endColumn).getDataRange().endColumn,y=Math.max(w+(C.endColumn-C.startColumn+1)-M.endColumn,0);if(y>0){const $=C.startColumn-1,Y=h.getColumnWidth($),z={unitId:m,subUnitId:R,range:{startRow:M.startRow+1,endRow:M.endRow,startColumn:M.endColumn+1,endColumn:M.endColumn+y},colInfo:new Array(y).fill(void 0).map(()=>({w:Y,hd:i.BooleanNumber.FALSE}))};S.push({id:ae.id,params:z});const x=At(s,z);I.push({id:se.id,params:x})}const b={};i.Range.foreach(C,($,Y)=>{const z=h.getCell($,Y);!z||!z.s||(b[$]||(b[$]={}),b[$][Y]={s:z.s})});const U={range:C,subUnitId:R,unitId:m,shiftDimension:i.Dimension.COLUMNS,cellValue:b},{redo:k,undo:T}=ps(s,U);S.push(...k),I.push(...T);const E=a.onCommandExecute({id:yt.id,params:{range:C}});if(S.push(...E.redos),S.push(ke(C,c,h)),I.push(...(W=E.preUndos)!=null?W:[]),S.unshift(...(L=E.preRedos)!=null?L:[]),I.unshift(...E.undos),i.sequenceExecute(S,t).result){const $=a.afterCommandExecute({id:yt.id,params:{range:C}});return i.sequenceExecute($.redos,t),I.push(...$.undos),S.push(...$.redos),n.pushUndoRedo({unitID:m,undoMutations:I.reverse(),redoMutations:S}),!0}return!1}},er="sheet.command.insert-row",ye={type:i.CommandType.COMMAND,id:er,handler:async(s,e)=>{const t=s.get(i.ICommandService),n=s.get(g.SheetInterceptorService),{range:o,direction:r,unitId:a,subUnitId:l,cellValue:u}=e;return await n.beforeCommandExecute({id:ye.id,params:e})?t.syncExecuteCommand(ys.id,{range:o,direction:r,unitId:a,subUnitId:l,cellValue:u}):!1}},ys={type:i.CommandType.COMMAND,id:"sheet.command.insert-row-by-range",handler:(s,e)=>{var k,T,E,N;const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),o=s.get(i.IUniverInstanceService),r=s.get(g.SheetInterceptorService),a=P(o,e);if(!a)return!1;const{workbook:l,worksheet:u}=a,{range:d,direction:c,unitId:h,subUnitId:m,cellValue:R}=e,{startRow:C,endRow:S}=d;d.rangeType=i.RANGE_TYPE.ROW;const I=c===i.Direction.UP?C:C-1,v=u.getRowHeight(I),M={unitId:h,subUnitId:m,range:d,rowInfo:new Array(S-C+1).fill(void 0).map(()=>({h:v,hd:i.BooleanNumber.FALSE}))},p=sn(s,M),w=[{id:ie.id,params:M}],y=[{id:le.id,params:p}];R&&Object.keys(R).length>0&&w.push({id:F.id,params:{unitId:h,subUnitId:m,cellValue:R}});const b=r.onCommandExecute({id:ye.id,params:e});if(w.unshift(...(k=b.preRedos)!=null?k:[]),w.push(...(T=b.redos)!=null?T:[]),w.push(ke(d,l,u)),y.unshift(...(E=b.preUndos)!=null?E:[]),y.push(...(N=b.undos)!=null?N:[]),i.sequenceExecute(w,t).result){const V=r.afterCommandExecute({id:ye.id,params:e});return i.sequenceExecute(V.redos,t),w.push(...V.redos),y.push(...V.undos),n.pushUndoRedo({unitID:e.unitId,undoMutations:y,redoMutations:w}),!0}return!1}},tr={type:i.CommandType.COMMAND,id:"sheet.command.insert-row-before",handler:async(s,e)=>{var I;const n=(I=s.get(g.SheetsSelectionsService).getCurrentSelections())==null?void 0:I.map(v=>v.range);let o;if((n==null?void 0:n.length)===1)o=n[0];else return!1;const r=s.get(i.IUniverInstanceService),a=P(r);if(!a)return!1;const{worksheet:l,subUnitId:u,unitId:d}=a,c=e.value||0,h=o.startRow,m=o.startRow+c-1,R=0,C=l.getColumnCount()-1,S={unitId:d,subUnitId:u,direction:i.Direction.UP,range:{startRow:h,endRow:m,startColumn:R,endColumn:C},cellValue:Be(l,h,m,R,C,!0,h-1)};return s.get(i.ICommandService).executeCommand(ye.id,S)}},nr={type:i.CommandType.COMMAND,id:"sheet.command.insert-row-after",handler:async s=>{var S;const t=(S=s.get(g.SheetsSelectionsService).getCurrentSelections())==null?void 0:S.map(I=>I.range);let n;if((t==null?void 0:t.length)===1)n=t[0];else return!1;const o=s.get(i.IUniverInstanceService),r=P(o);if(!r)return!1;const{worksheet:a,unitId:l,subUnitId:u}=r,d=n.endRow-n.startRow+1,c=n.endRow+1,h=n.endRow+d,m=0,R=a.getColumnCount()-1,C={unitId:l,subUnitId:u,direction:i.Direction.DOWN,range:{startRow:c,endRow:h,startColumn:m,endColumn:R,rangeType:i.RANGE_TYPE.ROW},cellValue:Be(a,c,h,m,R,!0,n.endRow)};return s.get(i.ICommandService).executeCommand(ye.id,C)}},sr={type:i.CommandType.COMMAND,id:"sheet.command.insert-multi-rows-above",handler:async(s,e)=>{var v;const n=(v=s.get(g.SheetsSelectionsService).getCurrentSelections())==null?void 0:v.map(M=>M.range);let o;if((n==null?void 0:n.length)===1)o=n[0];else return!1;const r=s.get(i.IUniverInstanceService),a=P(r);if(!a)return!1;const{worksheet:l,unitId:u,subUnitId:d}=a,c=e.value||0,h=o.startRow,m=o.startRow+c-1,R=0,C=l.getColumnCount()-1,S=Be(l,h,m,R,C,!0,h-1),I={unitId:u,subUnitId:d,direction:i.Direction.UP,range:{startRow:h,endRow:m,startColumn:R,endColumn:C,rangeType:i.RANGE_TYPE.ROW},cellValue:S};return s.get(i.ICommandService).executeCommand(ye.id,I)}},or={type:i.CommandType.COMMAND,id:"sheet.command.insert-multi-rows-after",handler:async(s,e)=>{var I;const n=(I=s.get(g.SheetsSelectionsService).getCurrentSelections())==null?void 0:I.map(v=>v.range);let o;if((n==null?void 0:n.length)===1)o=n[0];else return!1;const r=s.get(i.IUniverInstanceService),a=P(r);if(!a)return!1;const{worksheet:l,unitId:u,subUnitId:d}=a,c=e.value||0,h=o.endRow+1,m=o.endRow+c,R=0,C=l.getColumnCount()-1,S={unitId:u,subUnitId:d,direction:i.Direction.DOWN,range:{startRow:h,endRow:m,startColumn:R,endColumn:C,rangeType:i.RANGE_TYPE.ROW},cellValue:Be(l,h,m,R,C,!0,o.endRow)};return s.get(i.ICommandService).executeCommand(ye.id,S)}},rr="sheet.command.insert-col",_e={type:i.CommandType.COMMAND,id:rr,handler:async(s,e)=>{const t=s.get(i.ICommandService),n=s.get(g.SheetInterceptorService),{range:o,direction:r,subUnitId:a,unitId:l,cellValue:u}=e;return await n.beforeCommandExecute({id:_e.id,params:e})?t.syncExecuteCommand(_s.id,{range:o,direction:r,unitId:l,subUnitId:a,cellValue:u}):!1}},_s={type:i.CommandType.COMMAND,id:"sheet.command.insert-col-by-range",handler:(s,e)=>{var U,k,T,E;const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),o=s.get(i.IUniverInstanceService),r=s.get(g.SheetInterceptorService),{range:a,direction:l,subUnitId:u,unitId:d,cellValue:c}=e,{startColumn:h,endColumn:m}=e.range;a.rangeType=i.RANGE_TYPE.COLUMN;const R=o.getUniverSheetInstance(e.unitId),C=R.getSheetBySheetId(e.subUnitId),S=l===i.Direction.LEFT?h:h-1,I=C.getColumnWidth(S),v={unitId:d,subUnitId:u,range:a,colInfo:new Array(m-h+1).fill(void 0).map(()=>({w:I,hd:i.BooleanNumber.FALSE}))},M=At(s,v),p=[{id:ae.id,params:v}],w=[{id:se.id,params:M}];c&&p.push({id:F.id,params:{unitId:d,subUnitId:u,cellValue:c}});const y=r.onCommandExecute({id:_e.id,params:e});if(p.unshift(...(U=y.preRedos)!=null?U:[]),p.push(...(k=y.redos)!=null?k:[]),p.push(ke(a,R,C)),w.unshift(...(T=y.preUndos)!=null?T:[]),w.push(...(E=y.undos)!=null?E:[]),i.sequenceExecute(p,t).result){const N=r.afterCommandExecute({id:_e.id,params:e});return i.sequenceExecute(N.redos,t),p.push(...N.redos),w.push(...N.undos),n.pushUndoRedo({unitID:e.unitId,undoMutations:w.filter(Boolean),redoMutations:p.filter(Boolean)}),!0}return!1}},ir={type:i.CommandType.COMMAND,id:"sheet.command.insert-col-before",handler:async(s,e)=>{const n=s.get(g.SheetsSelectionsService).getCurrentSelections();let o;if((n==null?void 0:n.length)===1)o=n[0].range;else return!1;const r=s.get(i.IUniverInstanceService),a=P(r);if(!a)return!1;const{worksheet:l,unitId:u,subUnitId:d}=a,c=e.value||0,h=o.startColumn,m=o.startColumn+c-1,R=0,C=l.getRowCount()-1,S={unitId:u,subUnitId:d,direction:i.Direction.LEFT,range:{startColumn:h,endColumn:m,startRow:R,endRow:C,rangeType:i.RANGE_TYPE.COLUMN},cellValue:Be(l,R,C,h,m,!1,h-1)};return s.get(i.ICommandService).executeCommand(_e.id,S)}},ar={type:i.CommandType.COMMAND,id:"sheet.command.insert-col-after",handler:async s=>{const t=s.get(g.SheetsSelectionsService).getCurrentSelections();let n;if((t==null?void 0:t.length)===1)n=t[0].range;else return!1;const o=s.get(i.IUniverInstanceService),r=P(o);if(!r)return!1;const{worksheet:a,unitId:l,subUnitId:u}=r,d=n.endColumn-n.startColumn+1,c=n.endColumn+1,h=n.endColumn+d,m=0,R=a.getRowCount()-1,C={unitId:l,subUnitId:u,direction:i.Direction.RIGHT,range:{startColumn:c,endColumn:h,startRow:m,endRow:R},cellValue:Be(a,m,R,c,h,!1,n.endColumn)};return s.get(i.ICommandService).executeCommand(_e.id,C)}},lr={type:i.CommandType.COMMAND,id:"sheet.command.insert-multi-cols-before",handler:async(s,e)=>{const n=s.get(g.SheetsSelectionsService).getCurrentSelections();let o;if((n==null?void 0:n.length)===1)o=n[0].range;else return!1;const r=s.get(i.IUniverInstanceService),a=P(r);if(!a)return!1;const{worksheet:l,unitId:u,subUnitId:d}=a,c=e.value||0,h=o.startColumn,m=o.startColumn+c-1,R=0,C=l.getRowCount()-1,S={unitId:u,subUnitId:d,direction:i.Direction.LEFT,range:{startColumn:h,endColumn:m,startRow:R,endRow:C,rangeType:i.RANGE_TYPE.COLUMN},cellValue:Be(l,R,C,h,m,!1,h-1)};return s.get(i.ICommandService).executeCommand(_e.id,S)}},ur={type:i.CommandType.COMMAND,id:"sheet.command.insert-multi-cols-right",handler:async(s,e)=>{const n=s.get(g.SheetsSelectionsService).getCurrentSelections();let o;if((n==null?void 0:n.length)===1)o=n[0].range;else return!1;const r=s.get(i.IUniverInstanceService),a=P(r);if(!a)return!1;const{worksheet:l,unitId:u,subUnitId:d}=a,c=e.value||0,h=o.endColumn+1,m=o.endColumn+c,R=0,C=l.getRowCount()-1,S={unitId:u,subUnitId:d,direction:i.Direction.RIGHT,range:{startColumn:h,endColumn:m,startRow:R,endRow:C},cellValue:Be(l,R,C,h,m,!1,o.endColumn)};return s.get(i.ICommandService).executeCommand(_e.id,S)}},Rn="sheet.command.remove-row",bs={type:i.CommandType.COMMAND,id:"sheet.command.remove-row-by-range",handler:(s,e)=>{var I,v,M;if(!e)return!1;const t=s.get(i.IUniverInstanceService),n=P(t,e);if(!n)return!1;const{workbook:o,worksheet:r}=n,a=s.get(g.SheetInterceptorService),{range:l,unitId:u,subUnitId:d}=e,c=Vt([l],s,u,d).reverse(),h=[],m=[];c.forEach(p=>{const w=[],y=[],b={unitId:u,subUnitId:d,range:p},U=_a(b,r),k=r.getCellMatrix().getSlice(p.startRow,p.endRow,0,r.getColumnCount()-1),T={unitId:u,subUnitId:d,cellValue:k.getMatrix()};y.push({id:le.id,params:b}),w.push({id:ie.id,params:U}),w.push({id:F.id,params:T}),m.push(...y),h.unshift(...w)});const R=a.onCommandExecute({id:Rn,params:{range:l}}),C=s.get(i.ICommandService);if(i.sequenceExecute([...(I=R.preRedos)!=null?I:[],...m,...R.redos,ke(l,o,r)],C).result){const p=a.afterCommandExecute({id:Rn,params:{range:l}});return i.sequenceExecute(p.redos,C),s.get(i.IUndoRedoService).pushUndoRedo({unitID:u,undoMutations:[...(v=R.preUndos)!=null?v:[],...h,...R.undos,...p.undos],redoMutations:[...(M=R.preRedos)!=null?M:[],...m,...R.redos,...p.redos]}),!0}return!1}},Ht={type:i.CommandType.COMMAND,id:Rn,handler:async(s,e)=>{var m;const t=s.get(g.SheetsSelectionsService),n=s.get(g.SheetInterceptorService),o=s.get(i.ICommandService);let r=e==null?void 0:e.range;if(r||(r=(m=t.getCurrentLastSelection())==null?void 0:m.range),!r)return!1;const a=s.get(i.IUniverInstanceService),l=P(a);if(!l)return!1;const{worksheet:u,subUnitId:d,unitId:c}=l;return r={...r,startColumn:0,endColumn:Math.max(u.getMaxColumns()-1,0)},await n.beforeCommandExecute({id:Ht.id,params:{range:r}})?o.syncExecuteCommand(bs.id,{range:r,unitId:c,subUnitId:d}):!1}},Cn="sheet.command.remove-col",Es={type:i.CommandType.COMMAND,id:"sheet.command.remove-col-by-range",handler:(s,e)=>{var v,M,p;if(!e)return!1;const t=s.get(i.IUniverInstanceService),n=P(t,e);if(!n)return!1;const{workbook:o,worksheet:r}=n,a=s.get(g.SheetInterceptorService),{range:l,unitId:u,subUnitId:d}=e,c={unitId:u,subUnitId:d,range:l},h=ba(s,c),m=r.getCellMatrix().getSlice(0,r.getRowCount()-1,l.startColumn,l.endColumn),R={unitId:u,subUnitId:d,cellValue:m.getMatrix()},C=a.onCommandExecute({id:Cn,params:{range:l}}),S=s.get(i.ICommandService);if(i.sequenceExecute([...(v=C.preRedos)!=null?v:[],{id:se.id,params:c},...C.redos,ke(l,o,r)],S).result){const w=a.afterCommandExecute({id:Cn,params:{range:l}});return i.sequenceExecute(w.redos,S),s.get(i.IUndoRedoService).pushUndoRedo({unitID:u,undoMutations:[...(M=C.preUndos)!=null?M:[],{id:ae.id,params:h},{id:F.id,params:R},...C.undos,...w.undos],redoMutations:[...(p=C.preRedos)!=null?p:[],{id:se.id,params:c},...C.redos,...w.redos]}),!0}return!1}},Ft={type:i.CommandType.COMMAND,id:Cn,handler:async(s,e)=>{var m;const t=s.get(g.SheetsSelectionsService),n=s.get(g.SheetInterceptorService),o=s.get(i.ICommandService);let r=e==null?void 0:e.range;if(r||(r=(m=t.getCurrentLastSelection())==null?void 0:m.range),!r)return!1;const a=s.get(i.IUniverInstanceService),l=P(a);if(!l)return!1;const{worksheet:u,subUnitId:d,unitId:c}=l;return r={...r,startRow:0,endRow:Math.max(u.getMaxRows()-1,0)},await n.beforeCommandExecute({id:Ft.id,params:{range:r}})?o.syncExecuteCommand(Es.id,{range:r,unitId:c,subUnitId:d}):!1}},dr=(s,e)=>{const t=s.get(i.IUniverInstanceService),{subUnitId:n,unitId:o}=e,r=ne(t,e);if(!r)throw new Error("[RemoveSheetUndoMutationFactory]: Worksheet is null error!");const{workbook:a,worksheet:l}=r,u=l.getConfig();return{index:a.getConfig().sheetOrder.findIndex(h=>h===n),sheet:u,unitId:o}},He={id:"sheet.mutation.remove-sheet",type:i.CommandType.MUTATION,handler:(s,e)=>{const t=s.get(i.IUniverInstanceService),{subUnitId:n,unitId:o}=e,r=t.getUniverSheetInstance(o);return r?r.removeSheet(n):!1}};function Al(s,e){return e.getMergeData().some(t=>t.startRow<s&&s<=t.endRow)}function Wl(s,e){return e.getMergeData().some(t=>t.startColumn<s&&s<=t.endColumn)}const cr="sheet.command.move-rows",_t={id:cr,type:i.CommandType.COMMAND,handler:(s,e)=>{var V,W;const t=s.get(g.SheetsSelectionsService),{fromRange:{startRow:n},toRange:{startRow:o},range:r}=e,a=r?[mr(r)]:t.getCurrentSelections(),l=a==null?void 0:a.filter(L=>L.range.rangeType===i.RANGE_TYPE.ROW&&L.range.startRow<=n&&n<=L.range.endRow);if((l==null?void 0:l.length)!==1)return!1;const u=s.get(g.SheetInterceptorService),d=s.get(i.IUniverInstanceService),c=P(d,e);if(!c)return!1;const{workbook:h,worksheet:m}=c,R=h.getUnitId(),C=m.getSheetId(),S=s.get(i.ErrorService),I=s.get(i.LocaleService),v=l[0].range,M=l[0].primary,p=Lt(v,m,!1);if(!i.Rectangle.equals(v,p))return S.emit(I.t("sheets.info.partOfCell")),!1;if(Al(o,m))return S.emit(I.t("sheets.info.acrossMergedCell")),!1;const w={...v,startRow:o,endRow:o+v.endRow-v.startRow},y={unitId:R,subUnitId:C,sourceRange:v,targetRange:w},b=go(s,y),U=s.get(i.ICommandService),k=u.onCommandExecute({id:_t.id,params:e}),T=[...(V=k.preRedos)!=null?V:[],{id:we.id,params:y}],E=[...(W=k.preUndos)!=null?W:[],{id:we.id,params:b}];if(M){const $=o-n<0,Y=v.endRow-v.startRow+1,z=$?w:{...w,startRow:w.startRow-Y,endRow:w.endRow-Y},x={unitId:R,subUnitId:C,type:Q.MOVE_END,selections:[{range:z,primary:oe(z,m),style:null}]},re={unitId:R,subUnitId:C,type:Q.MOVE_END,selections:[{range:v,primary:M,style:null}]};T.push({id:q.id,params:x}),E.push({id:q.id,params:re})}if(T.push(...k.redos),E.push(...k.undos),i.sequenceExecute(T,U).result){const L=u.afterCommandExecute({id:_t.id,params:e});return i.sequenceExecute(L.redos,U),T.push(...L.redos),E.push(...L.undos),s.get(i.IUndoRedoService).pushUndoRedo({unitID:R,undoMutations:E,redoMutations:T}),!0}return!1}},hr="sheet.command.move-cols",bt={id:hr,type:i.CommandType.COMMAND,handler:(s,e)=>{var V,W;const t=s.get(g.SheetsSelectionsService),{fromRange:{startColumn:n},toRange:{startColumn:o},range:r}=e,a=r?[mr(r)]:t.getCurrentSelections(),l=a==null?void 0:a.filter(L=>L.range.rangeType===i.RANGE_TYPE.COLUMN&&L.range.startColumn<=n&&n<=L.range.endColumn);if((l==null?void 0:l.length)!==1)return!1;const u=s.get(g.SheetInterceptorService),d=s.get(i.IUniverInstanceService),c=P(d,e);if(!c)return!1;const{workbook:h,worksheet:m}=c,R=h.getUnitId(),C=m.getSheetId(),S=s.get(i.ErrorService),I=s.get(i.LocaleService),v=l[0].range,M=l[0].primary,p=Lt(v,m,!1);if(!i.Rectangle.equals(v,p))return S.emit(I.t("sheets.info.partOfCell")),!1;if(Wl(o,m))return S.emit(I.t("sheets.info.acrossMergedCell")),!1;const w={...v,startColumn:o,endColumn:o+v.endColumn-v.startColumn},y={unitId:R,subUnitId:C,sourceRange:v,targetRange:w},b=Ro(s,y),U=s.get(i.ICommandService),k=u.onCommandExecute({id:bt.id,params:e}),T=[...(V=k.preRedos)!=null?V:[],{id:Me.id,params:y}],E=[...(W=k.preUndos)!=null?W:[],{id:Me.id,params:b}];if(M){const L=v.endColumn-v.startColumn+1,z=o-n<0?w:{...w,startColumn:w.startColumn-L,endColumn:w.endColumn-L},x={unitId:R,subUnitId:C,type:Q.MOVE_END,selections:[{range:z,primary:oe(z,m),style:null}]},re={unitId:R,subUnitId:C,type:Q.MOVE_END,selections:[{range:v,primary:M,style:null}]};T.push({id:q.id,params:x}),E.push({id:q.id,params:re})}if(T.push(...k.redos),E.push(...k.undos),i.sequenceExecute(T,U).result){const L=u.afterCommandExecute({id:bt.id,params:e});return i.sequenceExecute(L.redos,U),T.push(...L.redos),E.push(...L.undos),s.get(i.IUndoRedoService).pushUndoRedo({unitID:R,undoMutations:E,redoMutations:T}),!0}return!1}};function mr(s){return{range:s,primary:null,style:null}}var Vl=Object.getOwnPropertyDescriptor,Ll=(s,e,t,n)=>{for(var o=n>1?void 0:n?Vl(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},$l=(s,e)=>(t,n)=>e(t,n,s);g.SheetSkeletonService=class extends i.Disposable{constructor(t){super();f(this,"_sheetSkeletonStore",new Map);this._injector=t,this.disposeWithMe(()=>{this._sheetSkeletonStore=new Map})}getSkeleton(t,n){if(this._sheetSkeletonStore.has(t))return this._sheetSkeletonStore.get(t).get(n)}setSkeleton(t,n,o){this._sheetSkeletonStore.has(t)||this._sheetSkeletonStore.set(t,new Map),this._sheetSkeletonStore.get(t).set(n,o)}deleteSkeleton(t,n){this._sheetSkeletonStore.has(t)&&this._sheetSkeletonStore.get(t).delete(n)}},g.SheetSkeletonService=Ll([$l(0,i.Inject(i.Injector))],g.SheetSkeletonService);function Ts(s,e){const t=new i.ObjectMatrix;return s.map(n=>i.Range.transformRange(n,e)).forEach(n=>{i.Range.foreach(n,(o,r)=>{const a=e.getCellHeight(o,r);a&&t.setValue(o,r,a)})}),t}const Bl=1e4;function jt(s,e){if(!e)return{suitableRanges:s,remainingRanges:[]};const t=e.worksheet.getColumnCount(),n=Math.ceil(Bl/t),o=[],r=[],a=e.getOffsetRelativeToRowCol(0,e.scrollY).row,l=s.map(d=>{let c;return a>=d.startRow&&a<=d.endRow?c=0:a<d.startRow?c=d.startRow-a:c=a-d.endRow,{range:d,distance:c,rowCount:d.endRow-d.startRow+1}});l.sort((d,c)=>d.distance!==c.distance?d.distance-c.distance:d.rowCount-c.rowCount);let u=0;for(const d of l)if(u+d.rowCount<=n)o.push(d.range),u+=d.rowCount;else{const c=n-u;if(c>0){const h={...d.range,endRow:d.range.startRow+c-1},m={...d.range,startRow:d.range.startRow+c};o.push(h),r.push(m),u=n}else r.push(d.range)}return{suitableRanges:o,remainingRanges:r}}function gr(s){let e=0;return s.forEach(()=>{e++}),e}const Rr="sheet.command.reorder-range",Sn={id:Rr,type:i.CommandType.COMMAND,handler:(s,e)=>{var p,w;const{subUnitId:t,unitId:n,range:o,order:r}=e,a=s.get(i.ICommandService),l={id:Wt.id,params:{unitId:n,subUnitId:t,order:r,range:o}},u={id:Wt.id,params:Co(l.params)},d=s.get(g.SheetInterceptorService),c=d.onCommandExecute({id:Sn.id,params:e}),h=[...(p=c.preRedos)!=null?p:[],l,...c.redos],m=[...(w=c.preUndos)!=null?w:[],u,...c.undos],R=i.sequenceExecute(h,a),{suitableRanges:C,remainingRanges:S}=jt([o],s.get(g.SheetSkeletonService).getSkeleton(n,t)),{undos:I,redos:v}=d.generateMutationsOfAutoHeight({unitId:n,subUnitId:t,ranges:[o],autoHeightRanges:C,lazyAutoHeightRanges:S}),M=d.afterCommandExecute({id:Sn.id,params:e});return R.result?(i.sequenceExecute([...M.redos,...v],a),s.get(i.IUndoRedoService).pushUndoRedo({unitID:n,undoMutations:[...m,...M.undos,...I],redoMutations:[...h,...M.redos,...v]}),!0):!1}},A={MoveRangeCommandId:zo,InsertRowCommandId:er,InsertColCommandId:rr,RemoveColCommandId:Cn,RemoveRowCommandId:Rn,DeleteRangeMoveLeftCommandId:Zo,DeleteRangeMoveUpCommandId:Qo,InsertRangeMoveDownCommandId:Dl,InsertRangeMoveRightCommandId:Ms,MoveColsCommandId:hr,MoveRowsCommandId:cr,ReorderRangeCommandId:Rr};var B=(s=>(s[s.Set=0]="Set",s[s.Delete=1]="Delete",s[s.HorizontalMove=2]="HorizontalMove",s[s.VerticalMove=3]="VerticalMove",s[s.Unknown=4]="Unknown",s))(B||{});const fn=Number.MAX_SAFE_INTEGER,Pe=s=>{const e={...s},t=Number.isNaN(e.startRow)&&Number.isNaN(e.endRow)&&!Number.isNaN(e.startColumn)&&!Number.isNaN(e.endColumn),n=Number.isNaN(e.startColumn)&&Number.isNaN(e.endColumn)&&!Number.isNaN(e.startRow)&&!Number.isNaN(e.endRow);return(e.rangeType===i.RANGE_TYPE.COLUMN||t)&&(e.startRow=0,e.endRow=fn),(e.rangeType===i.RANGE_TYPE.ROW||n)&&(e.startColumn=0,e.endColumn=fn),e.rangeType===i.RANGE_TYPE.ALL&&(e.startColumn=0,e.endColumn=fn,e.startRow=0,e.endRow=fn),e},ge=s=>{let e=s.rangeType;return s.rangeType===i.RANGE_TYPE.COLUMN?e=i.RANGE_TYPE.ROW:s.rangeType===i.RANGE_TYPE.ROW&&(e=i.RANGE_TYPE.COLUMN),{startRow:s.startColumn,endRow:s.endColumn,startColumn:s.startRow,endColumn:s.endRow,rangeType:e}},Gt=(s,e,t)=>{const n={...t},o={...e},r=(S,I)=>{const v=Math.max(S.start,I.start),M=Math.min(S.end,I.end);return M<v?null:{start:v,end:M}},a=S=>S.end-S.start+1,l=(S,I)=>({start:S.start-I.start,end:S.start-I.start+S.end-S.start}),u=(S,I)=>({start:I.start+S.start,end:I.start+S.start+S.end-S.start}),d=e.start>s.start;if(d){const S=Math.min(s.end,e.start)-s.start+1;o.start-=S,o.end-=S}const c=a(s),h=c,m=r(s,n),R=m&&a(m)>=a(n);if(s.end<n.start)n.start-=c,n.end-=c;else if(m){const S=a(m);if(R){const I=l(n,s),v=u(I,o);n.start=v.start,n.end=v.end}else m.start>s.start?d?(n.end-=S+c,n.start-=c):n.end-=S:d?n.end-=S:n.start>s.start&&n.end>s.end?(n.start-=c,n.end-=c+S):n.end-=S}const C=r(o,n);return R||(o.start<=n.start?(n.start+=h,n.end+=h):C&&(d?o.end<=n.start||o.start<=n.start&&o.end>=n.start?(n.start+=h,n.end+=h):o.start>=n.start&&o.start<=n.end&&(n.end+=h):n.start<o.start&&n.end>o.start?n.end+=h:(n.start>=o.end||n.start>=o.start&&n.start<=o.end)&&(n.end+=h,n.start+=h))),{step:n.start-t.start,length:a(n)-a(t)}},Us=(s,e)=>{const{fromRange:t,toRange:n}=s.params||{};if(!n||!t)return[];const o=Pe(t),r=Pe(n),a=Pe(e),l=Gt({start:o.startRow,end:o.endRow},{start:r.startRow,end:r.endRow},{start:a.startRow,end:a.endRow});return l===null?[{type:B.Delete}]:[{type:B.VerticalMove,step:l.step||0,length:l.length||0}]},Hl=(s,e)=>{const{fromRange:t,toRange:n}=s.params||{};if(!t||!n)return[e];const o=t.startRow,r=t.endRow-t.startRow+1,a=n.startRow,l=new i.ObjectMatrix;return i.Range.foreach(e,(d,c)=>{l.setValue(d,c,1)}),l.moveRows(o,r,a),i.queryObjectMatrix(l,d=>d===1)},Fl=(s,e)=>{const{range:t,order:n}=s.params||{};if(!t||!n)return[e];const o=new i.ObjectMatrix;i.Range.foreach(e,(l,u)=>{o.setValue(l,u,1)});const r=new i.ObjectMatrix;return i.Range.foreach(t,(l,u)=>{var d;if(Object.prototype.hasOwnProperty.call(n,l)){const c=n[l],h=(d=o.getValue(c,u))!=null?d:0;r.setValue(l,u,h)}}),r.forValue((l,u,d)=>{o.setValue(l,u,d)}),i.queryObjectMatrix(o,l=>l===1)},ks=(s,e)=>{const{fromRange:t,toRange:n}=s.params||{};if(!n||!t)return[];const o=Pe(t),r=Pe(n),a=Pe(e),l=Gt({start:o.startColumn,end:o.endColumn},{start:r.startColumn,end:r.endColumn},{start:a.startColumn,end:a.endColumn});return l===null?[{type:B.Delete}]:[{type:B.HorizontalMove,step:l.step||0,length:l.length||0}]},jl=(s,e)=>{const{fromRange:t,toRange:n}=s.params||{};if(!t||!n)return[e];const o=t.startColumn,r=t.endColumn-t.startColumn+1,a=n.startColumn,l=new i.ObjectMatrix;return i.Range.foreach(e,(u,d)=>{l.setValue(u,d,1)}),l.moveColumns(o,r,a),i.queryObjectMatrix(l,u=>u===1)},Cr=(s,e)=>{var r,a;const t=(r=s.params)==null?void 0:r.toRange,n=(a=s.params)==null?void 0:a.fromRange;if(!t||!n)return[];const o=[];if(i.Rectangle.contains(t,e)&&o.push({type:B.Delete}),i.Rectangle.contains(n,e)){o.push({type:B.Delete});const l=i.Rectangle.getRelativeRange(e,n),u=i.Rectangle.getPositionRange(l,t);return[{type:B.Set,range:u}]}return o},Gl=(s,e)=>{var h,m;const t=(h=s.params)==null?void 0:h.toRange,n=(m=s.params)==null?void 0:m.fromRange;if(!t||!n)return[e];if(!i.Rectangle.intersects(n,e)&&!i.Rectangle.intersects(t,e))return[e];if(i.Rectangle.contains(n,e)){const R=i.Rectangle.getRelativeRange(e,n);return[i.Rectangle.getPositionRange(R,t)]}const o=new i.ObjectMatrix;i.Range.foreach(e,(R,C)=>{o.setValue(R,C,1)});const r=new i.ObjectMatrix,a=i.Rectangle.getIntersects(n,e);a&&i.Range.foreach(a,(R,C)=>{o.getValue(R,C)&&(o.setValue(R,C,void 0),r.setValue(R,C,1))});const l=t.startColumn-n.startColumn,u=t.startRow-n.startRow,d={startColumn:t.startColumn-l,endColumn:t.endColumn-l,startRow:t.startRow-u,endRow:t.endRow-u};return d&&i.Range.foreach(d,(R,C)=>{var v;const S=R+u,I=C+l;o.setValue(S,I,(v=r.getValue(R,C))!=null?v:0)}),i.queryObjectMatrix(o,R=>R===1)},tt=(s,e)=>{const t=Pe(s),n=Pe(e),o=a=>a.endColumn-a.startColumn+1,r=a=>a.endRow-a.startRow+1;if(t.startRow<=n.startRow&&t.endRow>=n.endRow){if(n.startColumn<t.startColumn&&n.endColumn>=t.startColumn&&n.endColumn<=t.endColumn||n.startColumn<t.startColumn&&n.endColumn>=t.endColumn){const a=i.Rectangle.getIntersects(n,t);if(a)return{step:0,length:-o(a)}}if(n.startColumn>=t.startColumn&&n.endColumn<=t.endColumn&&r(t)>=r(n))return null;if(n.startColumn>=t.startColumn&&n.startColumn<=t.endColumn&&n.endColumn>t.endColumn){const a=i.Rectangle.getIntersects(n,t);if(a){const l=-o(a);return{step:-(o(t)-o(a)),length:l}}}if(n.startColumn>t.endColumn)return{step:-o(t),length:0}}return{step:0,length:0}},Ps=(s,e)=>{var r;const t=(r=s.params)==null?void 0:r.range;if(!t)return[];const n=[],o=tt(t,e);if(!o)n.push({type:B.Delete});else{const{step:a,length:l}=o;n.push({type:B.HorizontalMove,step:a,length:l})}return n},Sr=(s,e,t)=>{var a;const n=(a=s.params)==null?void 0:a.range;if(!n)return[];const o=[];if(t&&t.length>0){let l=n.startRow;for(let u=n.startRow;u<=n.endRow;u++){if(t.includes(u)){if(u===l){l=u+1;continue}r({...n,startRow:l,endRow:u-1}),l=u+1;continue}u===n.endRow&&r({...n,startRow:l,endRow:n.endRow})}}else r(n);function r(l){const u=tt(ge(l),ge(e));if(!u)o.push({type:B.Delete});else{const{step:d,length:c}=u;o.push({type:B.VerticalMove,step:d,length:c})}}return o},zl=(s,e)=>{const{range:t,order:n}=s.params||{};if(!t||!n)return[];if(i.Rectangle.contains(t,e)&&e.endRow===e.startRow){const o=[],r=e.startRow;for(const a in n)if(n[a]===r){const l=Number(a);return o.push({type:B.VerticalMove,step:l-r,length:0}),o}return[]}return[]},nt=(s,e)=>{const t=Pe(s),n=Pe(e),o=r=>r.endColumn-r.startColumn+1;return t.startRow<=n.startRow&&t.endRow>=n.endRow?n.startColumn<t.startColumn&&n.endColumn>=t.startColumn&&n.endColumn<=t.endColumn||n.startColumn<t.startColumn&&n.endColumn>=t.endColumn?{step:0,length:o(t)}:n.startColumn>=t.startColumn&&n.endColumn<=t.endColumn||n.startColumn>=t.startColumn&&n.startColumn<=t.endColumn&&n.endColumn>t.endColumn||n.startColumn>=t.endColumn?{step:o(t),length:0}:{step:0,length:0}:{step:0,length:0}};function ql(s,e,t){const n=[];if(i.Rectangle.contains(e,t)&&n.push({type:B.Delete}),i.Rectangle.contains(s,t)){n.push({type:B.Delete});const o=i.Rectangle.getRelativeRange(t,s),r=i.Rectangle.getPositionRange(o,e);return[{type:B.Set,range:r}]}return n}const fr=(s,e)=>{var l;const t=(l=s.params)==null?void 0:l.range;if(!t)return[];const n=[],o=nt(ge(t),ge(e)),{step:r,length:a}=o;return n.push({type:B.VerticalMove,step:r,length:a}),n},Ir=(s,e)=>{var l;const t=(l=s.params)==null?void 0:l.range;if(!t)return[];const n=[],o=nt(t,e),{step:r,length:a}=o;return n.push({type:B.HorizontalMove,step:r,length:a}),n},vr=(s,e)=>{var l;const t=(l=s.params)==null?void 0:l.range;if(!t)return[];const n=[],o=nt(ge(t),ge(e)),{step:r,length:a}=o;return n.push({type:B.VerticalMove,step:r,length:a}),n},Yl=(s,e)=>{var u;const t=(u=s.params)==null?void 0:u.range;if(!t)return[e];const n=t.endRow-t.startRow+1,o={...t,startRow:t.startRow,endRow:Number.POSITIVE_INFINITY},r=i.Rectangle.subtract(e,o),a=i.Rectangle.getIntersects(o,e);if(!a)return[e];const l=new i.ObjectMatrix;return r.forEach(d=>{i.Range.foreach(d,(c,h)=>{l.setValue(c,h,1)})}),a&&i.Range.foreach(a,(d,c)=>{l.setValue(d+n,c,1)}),i.queryObjectMatrix(l,d=>d===1)},pr=(s,e)=>{var l;const t=(l=s.params)==null?void 0:l.range;if(!t)return[];const n=[],o=nt(t,e),{step:r,length:a}=o;return n.push({type:B.HorizontalMove,step:r,length:a}),n},xl=(s,e)=>{var u;const t=(u=s.params)==null?void 0:u.range;if(!t)return[e];const n=t.endColumn-t.startColumn+1,o={...t,startColumn:t.startColumn,endColumn:Number.POSITIVE_INFINITY},r=i.Rectangle.subtract(e,o),a=i.Rectangle.getIntersects(o,e);if(!a)return[e];const l=new i.ObjectMatrix;return r.forEach(d=>{i.Range.foreach(d,(c,h)=>{l.setValue(c,h,1)})}),a&&i.Range.foreach(a,(d,c)=>{l.setValue(d,c+n,1)}),i.queryObjectMatrix(l,d=>d===1)},wr=(s,e)=>{var r;const t=(r=s.params)==null?void 0:r.range;if(!t)return[];const n=[],o=tt(t,e);if(!o)n.push({type:B.Delete});else{const{step:a,length:l}=o;n.push({type:B.HorizontalMove,step:a,length:l})}return n},Kl=(s,e)=>{var d;const t=(d=s.params)==null?void 0:d.range;if(!t)return[e];const n={startRow:t.startRow,endRow:t.endRow,startColumn:t.startColumn,endColumn:Number.POSITIVE_INFINITY},o=t.endColumn-t.startColumn+1,r=i.Rectangle.getIntersects(t,e),a=i.Rectangle.subtract(e,n),l=i.Rectangle.getIntersects(n,e);if(!r&&!l)return[e];const u=new i.ObjectMatrix;return l&&i.Range.foreach(l,(c,h)=>{u.setValue(c,h-o,1)}),r&&i.Range.foreach(r,(c,h)=>{u.setValue(c,h-o,0)}),a.forEach(c=>{i.Range.foreach(c,(h,m)=>{u.setValue(h,m,1)})}),i.queryObjectMatrix(u,c=>c===1)},Mr=(s,e)=>{var r;const t=(r=s.params)==null?void 0:r.range;if(!t)return[];const n=[],o=tt(ge(t),ge(e));if(!o)n.push({type:B.Delete});else{const{step:a,length:l}=o;n.push({type:B.VerticalMove,step:a,length:l})}return n},Jl=(s,e)=>{var d;const t=(d=s.params)==null?void 0:d.range;if(!t)return[e];const n={...t,startRow:t.startRow,endRow:Number.POSITIVE_INFINITY},o=t.endRow-t.startRow+1,r=i.Rectangle.getIntersects(t,e),a=i.Rectangle.subtract(e,n),l=i.Rectangle.getIntersects(n,e);if(!r&&!l)return[e];const u=new i.ObjectMatrix;return l&&i.Range.foreach(l,(c,h)=>{u.setValue(c-o,h,1)}),r&&i.Range.foreach(r,(c,h)=>{u.setValue(c-o,h,0)}),a.forEach(c=>{i.Range.foreach(c,(h,m)=>{u.setValue(h,m,1)})}),i.queryObjectMatrix(u,c=>c===1)},Xl=(s,e)=>{var o;const t=(o=s.ranges)!=null?o:[s.range],n=new i.ObjectMatrix;return i.Range.foreach(e,(r,a)=>{n.setValue(r,a,1)}),t.forEach(r=>{const a=r.startRow,u=r.endRow-a+1;n.removeRows(a,u)}),i.queryObjectMatrix(n,r=>r===1)},Zl=(s,e)=>{const t=s.params,n=t.range.startRow,o=t.range.endRow-t.range.startRow+1;if(t.direction===i.Direction.UP){if(n<e.startRow)return[{...e,startRow:e.startRow+o,endRow:e.endRow+o}];if(n<=e.endRow)return[{...e,endRow:e.endRow+o}]}else{if(n<=e.startRow)return[{...e,startRow:e.startRow+o,endRow:e.endRow+o}];if(n<=e.endRow+1)return[{...e,endRow:e.endRow+o}]}return[e]},Ql=(s,e)=>{const t=s.params,n=t.range.startColumn,o=t.range.endColumn-t.range.startColumn+1;if(t.direction===i.Direction.LEFT){if(n<e.startColumn)return[{...e,startColumn:e.startColumn+o,endColumn:e.endColumn+o}];if(n<=e.endColumn)return[{...e,endColumn:e.endColumn+o}]}else{if(n<=e.startColumn)return[{...e,startColumn:e.startColumn+o,endColumn:e.endColumn+o}];if(n<=e.endColumn+1)return[{...e,endColumn:e.endColumn+o}]}return[e]},st=(s,e)=>{let t={...e};return s.forEach(n=>{switch(n.type){case B.Delete:{t=null;break}case B.HorizontalMove:{if(!t)return;t.startColumn+=n.step,t.endColumn+=n.step+(n.length||0);break}case B.VerticalMove:{if(!t)return;t.startRow+=n.step,t.endRow+=n.step+(n.length||0);break}case B.Set:{t=n.range;break}}}),t&&(t.endColumn<t.startColumn||t.endRow<t.startRow)?null:t},Ns=(s,e)=>{let t=[];switch(e.id){case A.DeleteRangeMoveLeftCommandId:{t=wr(e,s);break}case A.DeleteRangeMoveUpCommandId:{t=Mr(e,s);break}case A.InsertColCommandId:{t=Ir(e,s);break}case A.InsertRangeMoveDownCommandId:{t=vr(e,s);break}case A.InsertRangeMoveRightCommandId:{t=pr(e,s);break}case A.InsertRowCommandId:{t=fr(e,s);break}case A.MoveColsCommandId:{t=ks(e,s);break}case A.MoveRangeCommandId:{t=Cr(e,s);break}case A.MoveRowsCommandId:{t=Us(e,s);break}case A.RemoveColCommandId:{t=Ps(e,s);break}case A.RemoveRowCommandId:{t=Sr(e,s);break}case A.ReorderRangeCommandId:{t=zl(e,s);break}}return st(t,s)},eu=(s,e,t)=>[Ge.id,ze.id].includes(e.id)||_r(e,t).some(r=>i.Rectangle.intersects(r,s))?Ns(s,e):s,Os=(s,e)=>{let t=[];switch(e.id){case A.DeleteRangeMoveLeftCommandId:return Kl(e,s);case A.DeleteRangeMoveUpCommandId:return Jl(e,s);case A.InsertRangeMoveDownCommandId:return Yl(e,s);case A.InsertRangeMoveRightCommandId:return xl(e,s);case A.InsertColCommandId:return Ql(e,s);case A.InsertRowCommandId:return Zl(e,s);case A.MoveColsCommandId:return jl(e,s);case A.MoveRangeCommandId:return Gl(e,s);case A.MoveRowsCommandId:return Hl(e,s);case A.ReorderRangeCommandId:return Fl(e,s);case A.RemoveColCommandId:{t=Ps(e,s);break}case A.RemoveRowCommandId:return Xl(e.params,s)}const n=st(t,s);return n?[n]:[]},tu=(s,e,t)=>[Ge.id,ze.id,et.id,Ms].includes(e.id)||_r(e,t).some(r=>i.Rectangle.intersects(r,s))?Os(s,e):s;function yr(s,e){const{id:t,params:n}=e;let o={length:0,step:0,type:B.Unknown};switch(t){case He.id:o.type=B.Delete;break;case we.id:o=Gt({start:n.sourceRange.startRow,end:n.sourceRange.endRow},{start:n.targetRange.startRow,end:n.targetRange.endRow},{start:s.startRow,end:s.endRow}),o.type=B.VerticalMove;break;case Me.id:o=Gt({start:n.sourceRange.startColumn,end:n.sourceRange.endColumn},{start:n.targetRange.startColumn,end:n.targetRange.endColumn},{start:s.startColumn,end:s.endColumn}),o.type=B.HorizontalMove;break;case se.id:o=tt(n.range,s),o?o.type=B.HorizontalMove:o={step:0,length:0,type:B.Delete};break;case le.id:o=tt(ge(n.range),ge(s)),o?o.type=B.VerticalMove:o={step:0,length:0,type:B.Delete};break;case ie.id:o=nt(ge(n.range),ge(s)),o.type=B.VerticalMove;break;case ae.id:o=nt(n.range,s),o.type=B.HorizontalMove;break;case Fe.id:{const r=n.fromRange||new i.ObjectMatrix(n.from).getRange(),a=n.toRange||new i.ObjectMatrix(n.to).getRange();o=ql(r,a,s)}break}return o?Array.isArray(o)?st(o,s):st([o],s):s}function _r(s,e){var n,o,r,a,l,u;const{selectionManagerService:t}=e;switch(s.id){case A.MoveColsCommandId:{const d=s.params;return[d.fromRange,{...d.toRange,startColumn:d.toRange.startColumn-.5,endColumn:d.toRange.endColumn-.5}]}case A.MoveRowsCommandId:{const d=s.params;return[d.fromRange,{...d.toRange,startRow:d.toRange.startRow-.5,endRow:d.toRange.startRow-.5}]}case A.MoveRangeCommandId:{const d=s;return[d.params.fromRange,d.params.toRange]}case A.InsertRowCommandId:{const c=s.params.range;return[{...c,startRow:c.startRow-.5,endRow:c.endRow-.5}]}case A.InsertColCommandId:{const c=s.params.range;return[{...c,startColumn:c.startColumn-.5,endColumn:c.endColumn-.5}]}case A.RemoveRowCommandId:return[s.params.range];case A.RemoveColCommandId:return[s.params.range];case A.DeleteRangeMoveUpCommandId:case A.InsertRangeMoveDownCommandId:{const c=((n=s.params)==null?void 0:n.range)||((r=(o=t.getCurrentSelections())==null?void 0:o.map(h=>h.range))==null?void 0:r[0]);return c?[c]:[]}case A.DeleteRangeMoveLeftCommandId:case A.InsertRangeMoveRightCommandId:{const c=((a=s.params)==null?void 0:a.range)||((u=(l=t.getCurrentSelections())==null?void 0:l.map(h=>h.range))==null?void 0:u[0]);return c?[c]:[]}case A.ReorderRangeCommandId:{const d=s,{range:c,order:h}=d.params,m=[];for(let R=c.startRow;R<=c.endRow;R++)R in h&&m.push({startRow:R,endRow:R,startColumn:c.startColumn,endColumn:c.endColumn});return m}}}function nu(s){switch(s.id){case Me.id:{const e=s.params;return[e.sourceRange,{...e.targetRange,startColumn:e.targetRange.startColumn-.5,endColumn:e.targetRange.startColumn-.5}]}case we.id:{const e=s.params;return[e.sourceRange,{...e.targetRange,startRow:e.targetRange.startRow-.5,endRow:e.targetRange.startRow-.5}]}case Fe.id:{const e=s.params;return[new i.ObjectMatrix(e.from.value).getRange(),new i.ObjectMatrix(e.to.value).getRange()]}case ae.id:{const t=s.params.range;return[{...t,startColumn:t.startColumn-.5,endColumn:t.startColumn-.5}]}case ie.id:{const t=s.params.range;return[{...t,startRow:t.startRow-.5,endRow:t.startRow-.5}]}case se.id:return[s.params.range];case le.id:return[s.params.range]}}function su(s,e){var o,r,a,l,u,d;const t=s.get(i.IUniverInstanceService),n=s.get(g.SheetsSelectionsService);switch(e.id){case A.MoveColsCommandId:{const c=e.params,h=P(t,{unitId:c.unitId,subUnitId:c.subUnitId});return{unitId:h.unitId,subUnitId:h.subUnitId,ranges:[c.fromRange,{...c.toRange,startColumn:c.fromRange.startColumn<c.toRange.startColumn?c.fromRange.endColumn+1:c.toRange.startColumn,endColumn:c.fromRange.startColumn<c.toRange.startColumn?c.toRange.endColumn-1:c.fromRange.startColumn-1}]}}case A.MoveRowsCommandId:{const c=e.params,h=P(t,{unitId:c.unitId,subUnitId:c.subUnitId});return{unitId:h.unitId,subUnitId:h.subUnitId,ranges:[c.fromRange,{...c.toRange,startRow:c.fromRange.startRow<c.toRange.startRow?c.fromRange.endRow+1:c.toRange.startRow,endRow:c.fromRange.startRow<c.toRange.startRow?c.toRange.endRow-1:c.fromRange.startRow-1}]}}case A.MoveRangeCommandId:{const c=e.params,h=P(t);return{unitId:h.unitId,subUnitId:h.subUnitId,ranges:[c.fromRange,c.toRange]}}case A.InsertRowCommandId:{const c=e.params,h=c.range;return{unitId:c.unitId,subUnitId:c.subUnitId,ranges:[...h.startRow>0?[{...h,startRow:h.startRow-1,endRow:h.endRow-1}]:[],{...h,startRow:h.startRow,endRow:Number.MAX_SAFE_INTEGER}]}}case A.InsertColCommandId:{const c=e.params,h=c.range;return{unitId:c.unitId,subUnitId:c.subUnitId,ranges:[...h.startColumn>0?[{...h,startColumn:h.startColumn-1,endColumn:h.endColumn-1}]:[],{...h,startColumn:h.startColumn,endColumn:Number.MAX_SAFE_INTEGER}]}}case A.RemoveRowCommandId:{const h=e.params.range,m=P(t);return{unitId:m.unitId,subUnitId:m.subUnitId,ranges:[h,{...h,startRow:h.endRow+1,endRow:Number.MAX_SAFE_INTEGER}]}}case A.RemoveColCommandId:{const h=e.params.range,m=P(t);return{unitId:m.unitId,subUnitId:m.subUnitId,ranges:[h,{...h,startColumn:h.endColumn+1,endColumn:Number.MAX_SAFE_INTEGER}]}}case A.DeleteRangeMoveUpCommandId:case A.InsertRangeMoveDownCommandId:{const c=e,h=P(t),m=((o=c.params)==null?void 0:o.range)||((a=(r=n.getCurrentSelections())==null?void 0:r.map(R=>R.range))==null?void 0:a[0]);return m?{unitId:h.unitId,subUnitId:h.subUnitId,ranges:[m,{...m,startRow:m.endRow+1,endRow:Number.MAX_SAFE_INTEGER}]}:{unitId:h.unitId,subUnitId:h.subUnitId,ranges:[]}}case A.DeleteRangeMoveLeftCommandId:case A.InsertRangeMoveRightCommandId:{const h=((l=e.params)==null?void 0:l.range)||((d=(u=n.getCurrentSelections())==null?void 0:u.map(R=>R.range))==null?void 0:d[0]),m=P(t);return h?{unitId:m.unitId,subUnitId:m.subUnitId,ranges:[h,{...h,startColumn:h.endColumn+1,endColumn:Number.MAX_SAFE_INTEGER}]}:{unitId:m.unitId,subUnitId:m.subUnitId,ranges:[]}}case A.ReorderRangeCommandId:{const c=e,{range:h,order:m}=c.params,R=[];for(let S=h.startRow;S<=h.endRow;S++)S in m&&R.push({startRow:S,endRow:S,startColumn:h.startColumn,endColumn:h.endColumn});const C=P(t);return{unitId:C.unitId,subUnitId:C.subUnitId,ranges:R}}}}var ou=Object.getOwnPropertyDescriptor,ru=(s,e,t,n)=>{for(var o=n>1?void 0:n?ou(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},In=(s,e)=>(t,n)=>e(t,n,s);const iu=i.createInterceptorKey("MERGE_REDO"),au=i.createInterceptorKey("MERGE_UNDO"),ve=Math.floor(Number.MAX_SAFE_INTEGER/10);class lu extends i.Disposable{constructor(e,t,n,o,r=!1){super(),this._unitId=e,this._subUnitId=t,this._range=n,this._callback=o,this._skipIntersects=r}onMutation(e){var o,r;if(((o=e.params)==null?void 0:o.unitId)!==this._unitId)return;if(e.id===Fe.id){const a=e.params;if(a.from.subUnitId!==this._subUnitId||a.to.subUnitId!==this._subUnitId)return}else if(((r=e.params)==null?void 0:r.subUnitId)!==this._subUnitId)return;if(!this._range)return;if(this._skipIntersects){if(e.id===He.id)return;const a=nu(e);if(a!=null&&a.some(l=>i.Rectangle.intersects(l,this._range)))return}const t=yr(this._range,e);if(t&&i.Rectangle.equals(t,this._range))return!1;const n=this._range;this._range=t,this._callback(n,t)}}g.RefRangeService=class extends i.Disposable{constructor(t,n,o,r){super();f(this,"interceptor",new i.InterceptorManager({MERGE_REDO:iu,MERGE_UNDO:au}));f(this,"_watchRanges",new Set);f(this,"_refRangeManagerMap",new Map);f(this,"_serializer",uu());f(this,"_onRefRangeChange",()=>{this._sheetInterceptorService.interceptCommand({getMutations:t=>{const n=this._univerInstanceService.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET).getActiveSheet(),o=br(this._univerInstanceService),r=Er(this._univerInstanceService);if(!n||!o||!r)return{redos:[],undos:[],preRedos:[],preUndos:[]};const u=((()=>{switch(t.id){case A.MoveColsCommandId:{const R=t.params,C=Math.min(R.fromRange.startColumn,R.toRange.startColumn);return this._checkRange([{...R.fromRange,startColumn:C,endColumn:ve}],o,r)}case A.MoveRowsCommandId:{const R=t.params,C=Math.min(R.fromRange.startRow,R.toRange.startRow);return this._checkRange([{...R.fromRange,startRow:C,endRow:ve}],o,r)}case A.MoveRangeCommandId:{const R=t;return this._checkRange([R.params.fromRange,R.params.toRange],o,r)}case A.InsertRowCommandId:{const C=t.params.range.startRow,S={startRow:Math.max(0,C-1),endRow:ve,startColumn:0,endColumn:ve,rangeType:i.RANGE_TYPE.ROW};return this._checkRange([S],o,r)}case A.InsertColCommandId:{const C=t.params.range.startColumn,S={startRow:0,endRow:ve,startColumn:Math.max(0,C-1),endColumn:ve,rangeType:i.RANGE_TYPE.COLUMN};return this._checkRange([S],o,r)}case A.RemoveRowCommandId:{const S={startRow:t.params.range.startRow,endRow:ve,startColumn:0,endColumn:ve,rangeType:i.RANGE_TYPE.ROW};return this._checkRange([S],o,r)}case A.RemoveColCommandId:{const C=t.params.range.startColumn,S={startRow:0,endRow:ve,startColumn:C,endColumn:ve,rangeType:i.RANGE_TYPE.COLUMN};return this._checkRange([S],o,r)}case A.DeleteRangeMoveUpCommandId:case A.InsertRangeMoveDownCommandId:{const C=t.params.range||Tr(this._selectionManagerService)[0],S={startRow:C.startRow,startColumn:C.startColumn,endColumn:C.endColumn,endRow:ve};return this._checkRange([S],o,r)}case A.DeleteRangeMoveLeftCommandId:case A.InsertRangeMoveRightCommandId:{const C=t.params.range||Tr(this._selectionManagerService)[0],S={startRow:C.startRow,startColumn:C.startColumn,endColumn:ve,endRow:C.endRow};return this._checkRange([S],o,r)}case A.ReorderRangeCommandId:{const R=t,{range:C,order:S}=R.params,I=[];for(let v=C.startRow;v<=C.endRow;v++)v in S&&I.push({startRow:v,endRow:v,startColumn:C.startColumn,endColumn:C.endColumn});return this._checkRange(I,o,r)}}})()||[]).reduce((R,C)=>{const S=C(t);return R.push(S),R},[]).reduce((R,C)=>{var S,I;return R.redos.push(...C.redos),R.undos.push(...C.undos),R.preRedos.push(...(S=C.preRedos)!=null?S:[]),R.preUndos.push(...(I=C.preUndos)!=null?I:[]),R},{redos:[],undos:[],preUndos:[],preRedos:[]}),d=this.interceptor.fetchThroughInterceptors(this.interceptor.getInterceptPoints().MERGE_REDO)(u.preRedos,null)||[],c=this.interceptor.fetchThroughInterceptors(this.interceptor.getInterceptPoints().MERGE_REDO)(u.redos,null)||[],h=this.interceptor.fetchThroughInterceptors(this.interceptor.getInterceptPoints().MERGE_UNDO)(u.preUndos,null)||[],m=this.interceptor.fetchThroughInterceptors(this.interceptor.getInterceptPoints().MERGE_UNDO)(u.undos,null)||[];return{redos:c,undos:m,preRedos:d,preUndos:h}}})});f(this,"_checkRange",(t,n,o)=>{const r=Ur(n,o),a=this._refRangeManagerMap.get(r);if(a){const l=new Set;return[...a.keys()].forEach(d=>{const c=a.get(d),h=this._serializer.deserialize(d),m={...h,startRow:+h.startRow,endRow:+h.endRow,startColumn:+h.startColumn,endColumn:+h.endColumn,rangeType:h.rangeType&&+h.rangeType};t.some(R=>i.Rectangle.intersects(R,m))&&c&&c.forEach(R=>{l.add(R)})}),[...l]}return[]});f(this,"registerRefRange",(t,n,o,r)=>{const a=o||br(this._univerInstanceService),l=r||Er(this._univerInstanceService);if(!a||!l)return i.toDisposable(()=>{});const u=Ur(a,l),d=this._serializer.serialize(t);let c=this._refRangeManagerMap.get(u);c||(c=new Map,this._refRangeManagerMap.set(u,c));const h=c.get(d);return h?h.add(n):c.set(d,new Set([n])),i.toDisposable(()=>{const m=c.get(d);m&&(m.delete(n),m.size||(c.delete(d),c.size||this._refRangeManagerMap.delete(u)))})});this._commandService=t,this._sheetInterceptorService=n,this._univerInstanceService=o,this._selectionManagerService=r,this._onRefRangeChange(),this.interceptor.intercept(this.interceptor.getInterceptPoints().MERGE_REDO,{priority:-1,handler:a=>a}),this.interceptor.intercept(this.interceptor.getInterceptPoints().MERGE_UNDO,{priority:-1,handler:a=>a})}watchRange(t,n,o,r,a){let l;this._watchRanges.size===0&&(l=this._commandService.onCommandExecuted(h=>{if(h.type!==i.CommandType.MUTATION)return!1;for(const m of this._watchRanges)m.onMutation(h)}));const u=new lu(t,n,o,r,a);this._watchRanges.add(u);const d=i.toDisposable(()=>{this._watchRanges.delete(u),this._watchRanges.size===0&&(l==null||l.dispose(),l=null)}),c=this.disposeWithMe(d);return i.toDisposable(()=>{c.dispose(),d.dispose()})}},g.RefRangeService=ru([In(0,i.ICommandService),In(1,i.Inject(g.SheetInterceptorService)),In(2,i.Inject(i.IUniverInstanceService)),In(3,i.Inject(g.SheetsSelectionsService))],g.RefRangeService);function br(s){return s.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET).getUnitId()}function Er(s){var e;return(e=s.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:e.getSheetId()}function Tr(s){var e;return((e=s.getCurrentSelections())==null?void 0:e.map(t=>t.range))||[]}function Ur(s,e){return`${s}_${e}`}function uu(){const s=["startRow","startColumn","endRow","endColumn","rangeType"];return{deserialize:t=>{const n=s.reduce((r,a,l)=>(r[String(l)]=a,r),{});return t.split("_").reduce((r,a,l)=>{const u=String(l);return a&&n[u]&&(r[n[u]]=a),r},{})},serialize:t=>s.reduce((n,o,r)=>{const a=t[o];return a!==void 0?`${n}${r>0?"_":""}${a}`:`${n}`},"")}}var du=Object.getOwnPropertyDescriptor,cu=(s,e,t,n)=>{for(var o=n>1?void 0:n?du(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},Et=(s,e)=>(t,n)=>e(t,n,s);const hu=[ae.id,ie.id,se.id,le.id],mu=[we.id,Me.id];function Ds(s,e){let t=s;if(e!==void 0){const n=[];for(let o=0;o<t.length;o++){const{startRow:r,endRow:a,startColumn:l,endColumn:u}=t[o];if(e===i.Dimension.ROWS)for(let d=r;d<=a;d++){const c={startRow:d,endRow:d,startColumn:l,endColumn:u};n.push(c)}else if(e===i.Dimension.COLUMNS)for(let d=l;d<=u;d++){const c={startRow:r,endRow:a,startColumn:d,endColumn:d};n.push(c)}}t=n}return t}const kr=i.createInterceptorKey("mergeCellPermissionCheck");g.MergeCellController=class extends i.Disposable{constructor(t,n,o,r,a,l){super();f(this,"disposableCollection",new i.DisposableCollection);f(this,"interceptor",new i.InterceptorManager({MERGE_CELL_INTERCEPTOR_CHECK:kr}));this._commandService=t,this._refRangeService=n,this._univerInstanceService=o,this._injector=r,this._sheetInterceptorService=a,this._selectionManagerService=l,this._onRefRangeChange(),this._initCommandInterceptor(),this._commandExecutedListener()}_initCommandInterceptor(){const t=this;this._sheetInterceptorService.interceptCommand({getMutations(n){var o;switch(n.id){case rn.id:case an.id:{const r=t._univerInstanceService.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET),a=r.getUnitId(),l=r==null?void 0:r.getActiveSheet();if(!l)return{redos:[],undos:[]};const u=l.getSheetId(),d=l.getConfig().mergeData,c=(o=t._selectionManagerService.getCurrentSelections())==null?void 0:o.map(h=>h.range);if(c&&c.length>0&&c.some(m=>d.some(R=>i.Rectangle.intersects(R,m)))){const m={unitId:a,subUnitId:u,ranges:c},R=ue(t._injector,m),C=[{id:G.id,params:m}],S=[{id:j.id,params:R}];return{redos:C,undos:S}}}}return{redos:[],undos:[]}}}),this._sheetInterceptorService.interceptRanges({getMutations:({unitId:n,subUnitId:o,ranges:r})=>{const a=[],l=[],u={redos:a,undos:l};if(!r||!r.length)return u;const d=P(this._univerInstanceService,{unitId:n,subUnitId:o});if(!d)return u;const{worksheet:c}=d,m=c.getMergeData().filter(R=>r.some(C=>i.Rectangle.intersects(R,C)));return m.length?(a.push({id:G.id,params:{unitId:n,subUnitId:o,ranges:m}}),l.push({id:j.id,params:{unitId:n,subUnitId:o,ranges:m}}),{undos:l,redos:a}):u}})}refRangeHandle(t,n,o){switch(t.id){case A.MoveColsCommandId:{const r=t.params;return this._handleMoveColsCommand(r,n,o)}case A.MoveRowsCommandId:{const r=t.params;return this._handleMoveRowsCommand(r,n,o)}case ye.id:{const r=t.params,a=r.unitId||n,l=r.subUnitId||o;return this._handleInsertRowCommand(r,a,l)}case _e.id:{const r=t.params,a=r.unitId||n,l=r.subUnitId||o;return this._handleInsertColCommand(r,a,l)}case Ft.id:{const r=t.params;return this._handleRemoveColCommand(r,n,o)}case Ht.id:{const r=t.params;return this._handleRemoveRowCommand(r,n,o)}case Qe.id:{const r=t.params;return this._handleMoveRangeCommand(r,n,o)}case yt.id:{const r=t.params;return this._handleInsertRangeMoveRightCommand(r,n,o)}case et.id:{const r=t.params;return this._handleInsertRangeMoveDownCommand(r,n,o)}case ze.id:{const r=t.params;return this._handleDeleteRangeMoveUpCommand(r,n,o)}case Ge.id:{const r=t.params;return this._handleDeleteRangeMoveLeftCommand(r,n,o)}}return{redos:[],undos:[]}}_onRefRangeChange(){const t=(n,o)=>{const r=this._univerInstanceService.getUniverSheetInstance(n);if(!r)return;const a=r==null?void 0:r.getSheetBySheetId(o);if(!a)return;this.disposableCollection.dispose();const l=a.getMergeData(),u=d=>this.refRangeHandle(d,n,o);l.forEach(d=>{this.disposableCollection.add(this._refRangeService.registerRefRange(d,u,n,o))})};this.disposeWithMe(this._commandService.onCommandExecuted(n=>{if(n.id===Ze.id){const o=n.params,r=o.subUnitId,a=o.unitId;if(!r||!a)return;t(a,r)}if(n.id===j.id){const o=n.params,r=o.subUnitId,a=o.unitId;if(!r||!a)return;t(o.unitId,o.subUnitId)}})),this._univerInstanceService.getCurrentTypeOfUnit$(i.UniverInstanceType.UNIVER_SHEET).pipe(O.first(n=>!!n)).subscribe(n=>{const o=n.getActiveSheet();o&&t(n.getUnitId(),o.getSheetId())})}_handleMoveRowsCommand(t,n,o){const r=be(this._univerInstanceService,n);if(!r)return this._handleNull();const a=Ee(r,o);if(!a)return this._handleNull();const l=[...a.getMergeData()],u={unitId:n,subUnitId:o,ranges:[]},d={unitId:n,subUnitId:o,ranges:[]},{fromRange:c}=t,{startRow:h,endRow:m}=c;if(l.forEach(S=>{if(h<=S.startRow&&m>=S.endRow){u.ranges.push(S);const I=Us({id:A.MoveRowsCommandId,params:t},S),v=st(I,S);v&&d.ranges.push(v)}}),u.ranges.length===0)return this._handleNull();const R=ue(this._injector,u),C=Re(this._injector,d);return{preRedos:[{id:G.id,params:u}],redos:[{id:j.id,params:d}],preUndos:[{id:G.id,params:C}],undos:[{id:j.id,params:R}]}}_handleMoveColsCommand(t,n,o){const r=be(this._univerInstanceService,n);if(!r)return this._handleNull();const a=Ee(r,o);if(!a)return this._handleNull();const l=[...a.getMergeData()],u={unitId:n,subUnitId:o,ranges:[]},d={unitId:n,subUnitId:o,ranges:[]},{fromRange:c}=t,{startColumn:h,endColumn:m}=c;if(l.forEach(S=>{if(h<=S.startColumn&&m>=S.endColumn){u.ranges.push(S);const I=ks({id:A.MoveColsCommandId,params:t},S),v=st(I,S);v&&d.ranges.push(v)}}),u.ranges.length===0)return this._handleNull();const R=ue(this._injector,u),C=Re(this._injector,d);return{preRedos:[{id:G.id,params:u}],redos:[{id:j.id,params:d}],preUndos:[{id:G.id,params:C}],undos:[{id:j.id,params:R}]}}_handleMoveRangeCommand(t,n,o){const r=be(this._univerInstanceService,n);if(!r)return this._handleNull();const a=Ee(r,o);if(!a)return this._handleNull();const l=a.getMergeData(),u=l.filter(C=>i.Rectangle.intersects(C,t.fromRange)),d=l.filter(C=>i.Rectangle.intersects(C,t.toRange)),c=u.map(C=>i.Rectangle.getRelativeRange(C,t.fromRange)).map(C=>i.Rectangle.getPositionRange(C,t.toRange)),h=Ds(c).filter(C=>!l.some(S=>i.Rectangle.equals(C,S))),m=[{id:G.id,params:{unitId:n,subUnitId:o,ranges:u}},{id:G.id,params:{unitId:n,subUnitId:o,ranges:d}},{id:j.id,params:{unitId:n,subUnitId:o,ranges:h}}],R=[{id:G.id,params:{unitId:n,subUnitId:o,ranges:h}},{id:j.id,params:{unitId:n,subUnitId:o,ranges:d}},{id:j.id,params:{unitId:n,subUnitId:o,ranges:u}}];return{redos:m,undos:R}}_handleInsertRowCommand(t,n,o){const r=be(this._univerInstanceService,n);if(!r)return this._handleNull();const a=Ee(r,o);if(!a)return this._handleNull();const{range:l}=t,{startRow:u,endRow:d}=l,c=i.Tools.deepClone(a.getMergeData()).reduce((M,p)=>(u>p.startRow&&u<=p.endRow&&M.push(p),M),[]);if(c.length===0)return this._handleNull();const h=i.Tools.deepClone(a.getMergeData()).reduce((M,p)=>{if(u>p.startRow&&u<=p.endRow){const w=d-u+1;p.endRow+=w,this._checkIsMergeCell(p)&&M.push(p)}return M},[]),m={unitId:n,subUnitId:o,ranges:c},R=ue(this._injector,m),C={unitId:n,subUnitId:o,ranges:h},S=Re(this._injector,C),I=[{id:G.id,params:m},{id:j.id,params:C}],v=[{id:G.id,params:S},{id:j.id,params:R}];return{redos:I,undos:v}}_handleInsertColCommand(t,n,o){const{range:r}=t,a=be(this._univerInstanceService,n);if(!a)return this._handleNull();const l=Ee(a,o);if(!l)return this._handleNull();const{startColumn:u,endColumn:d}=r,c=i.Tools.deepClone(l.getMergeData()).reduce((M,p)=>(u>p.startColumn&&u<=p.endColumn&&M.push(p),M),[]);if(c.length===0)return this._handleNull();const h=i.Tools.deepClone(l.getMergeData()).reduce((M,p)=>{if(u>p.startColumn&&u<=p.endColumn){const w=d-u+1;p.endColumn+=w,this._checkIsMergeCell(p)&&M.push(p)}return M},[]),m={unitId:n,subUnitId:o,ranges:c},R=ue(this._injector,m),C={unitId:n,subUnitId:o,ranges:h},S=Re(this._injector,C),I=[{id:G.id,params:m},{id:j.id,params:C}],v=[{id:G.id,params:S},{id:j.id,params:R}];return{redos:I,undos:v}}_handleRemoveColCommand(t,n,o){const r=be(this._univerInstanceService,n);if(!r)return this._handleNull();const a=Ee(r,o);if(!a)return this._handleNull();const{range:l}=t,{startColumn:u,endColumn:d}=l,c=i.Tools.deepClone(a.getMergeData()).reduce((w,y)=>(i.Rectangle.intersects(l,y)&&w.push(y),w),[]);if(c.length===0)return this._handleNull();const h=i.Tools.deepClone(a.getMergeData()).reduce((w,y)=>{if(i.Rectangle.intersects(l,y)){if(u<=y.startColumn&&d>=y.endColumn)return w;u>=y.startColumn&&d<=y.endColumn?y.endColumn-=d-u+1:u<y.startColumn?(y.startColumn=u,y.endColumn-=d-u+1):d>y.endColumn&&(y.endColumn=u-1),this._checkIsMergeCell(y)&&w.push(y)}return w},[]),m={unitId:n,subUnitId:o,ranges:c},R=ue(this._injector,m),C={unitId:n,subUnitId:o,ranges:h},S=Re(this._injector,C),I=[{id:G.id,params:m}],v=[{id:j.id,params:C}],M=[{id:G.id,params:S}],p=[{id:j.id,params:R}];return{preUndos:M,undos:p,preRedos:I,redos:v}}_handleRemoveRowCommand(t,n,o){const{range:r}=t,a=be(this._univerInstanceService,n);if(!a)return this._handleNull();const l=Ee(a,o);if(!l)return this._handleNull();const{startRow:u,endRow:d}=r,c=i.Tools.deepClone(l.getMergeData()).reduce((w,y)=>(i.Rectangle.intersects(r,y)&&w.push(y),w),[]);if(c.length===0)return this._handleNull();const h=i.Tools.deepClone(l.getMergeData()).reduce((w,y)=>{if(i.Rectangle.intersects(r,y)){if(u<=y.startRow&&d>=y.endRow)return w;u>=y.startRow&&d<=y.endRow?y.endRow-=d-u+1:u<y.startRow?(y.startRow=u,y.endRow-=d-u+1):d>y.endRow&&(y.endRow=u-1),this._checkIsMergeCell(y)&&w.push(y)}return w},[]),m={unitId:n,subUnitId:o,ranges:c},R=ue(this._injector,m),C={unitId:n,subUnitId:o,ranges:h},S=Re(this._injector,C),I=[{id:G.id,params:m}],v=[{id:j.id,params:C}],M=[{id:G.id,params:S}],p=[{id:j.id,params:R}];return{preUndos:M,undos:p,preRedos:I,redos:v}}_handleInsertRangeMoveRightCommand(t,n,o){const r=be(this._univerInstanceService,n);if(!r)return this._handleNull();const a=Ee(r,o);if(!a)return this._handleNull();const l=t.range,u=a.getMaxColumns()-1,d=a.getMergeData(),c=[],h=[];d.forEach(I=>{const{startRow:v,endRow:M,startColumn:p,endColumn:w}=l;if(i.Rectangle.intersects({startRow:v,startColumn:p,endRow:M,endColumn:u},I)&&(c.push(I),i.Rectangle.contains({startRow:v,startColumn:p,endRow:M,endColumn:u},I))){const U=w-p+1;h.push({startRow:I.startRow,startColumn:I.startColumn+U,endRow:I.endRow,endColumn:I.endColumn+U})}});const m={unitId:n,subUnitId:o,ranges:c},R=ue(this._injector,m),C={unitId:n,subUnitId:o,ranges:h},S=Re(this._injector,C);return{preRedos:[{id:G.id,params:m}],redos:[{id:j.id,params:C}],preUndos:[{id:G.id,params:S}],undos:[{id:j.id,params:R}]}}_handleInsertRangeMoveDownCommand(t,n,o){const r=be(this._univerInstanceService,n);if(!r)return this._handleNull();const a=Ee(r,o);if(!a)return this._handleNull();const l=t.range,u=a.getMaxRows()-1,d=a.getMergeData(),c=[],h=[];d.forEach(w=>{const{startRow:y,startColumn:b,endColumn:U,endRow:k}=l;if(i.Rectangle.intersects({startRow:y,startColumn:b,endRow:u,endColumn:U},w)&&(c.push(w),i.Rectangle.contains({startRow:y,startColumn:b,endRow:u,endColumn:U},w))){const N=k-y+1;h.push({startRow:w.startRow+N,startColumn:w.startColumn,endRow:w.endRow+N,endColumn:w.endColumn})}});const m={unitId:n,subUnitId:o,ranges:c},R=ue(this._injector,m),C={unitId:n,subUnitId:o,ranges:h},S=Re(this._injector,C),I=[{id:G.id,params:m}],v=[{id:j.id,params:C}],M=[{id:G.id,params:S}],p=[{id:j.id,params:R}];return{redos:v,undos:p,preRedos:I,preUndos:M}}_handleDeleteRangeMoveUpCommand(t,n,o){const r=be(this._univerInstanceService,n);if(!r)return this._handleNull();const a=Ee(r,o);if(!a)return this._handleNull();const l=t.range,u=a.getMaxRows()-1,d=a.getMergeData(),c=[],h=[];d.forEach(w=>{const{startRow:y,startColumn:b,endColumn:U,endRow:k}=l;if(i.Rectangle.intersects({startRow:y,startColumn:b,endRow:u,endColumn:U},w)&&(c.push(w),i.Rectangle.contains({startRow:y,startColumn:b,endRow:u,endColumn:U},w))){const N=k-y+1,V=i.Rectangle.moveVertical(w,-N);h.push(V)}});const m={unitId:n,subUnitId:o,ranges:c},R=ue(this._injector,m),C={unitId:n,subUnitId:o,ranges:h},S=Re(this._injector,C),I=[{id:G.id,params:m}],v=[{id:j.id,params:C}],M=[{id:G.id,params:S}],p=[{id:j.id,params:R}];return{redos:v,undos:p,preRedos:I,preUndos:M}}_handleDeleteRangeMoveLeftCommand(t,n,o){const r=be(this._univerInstanceService,n);if(!r)return this._handleNull();const a=Ee(r,o);if(!a)return this._handleNull();const l=t.range,u=a.getMaxColumns()-1,d=a.getMergeData(),c=[],h=[];d.forEach(I=>{const{startRow:v,endRow:M,startColumn:p,endColumn:w}=l;if(i.Rectangle.intersects({startRow:v,startColumn:p,endRow:M,endColumn:u},I)&&(c.push(I),i.Rectangle.contains({startRow:v,startColumn:p,endRow:M,endColumn:u},I))){const U=w-p+1;h.push({startRow:I.startRow,startColumn:I.startColumn-U,endRow:I.endRow,endColumn:I.endColumn-U})}});const m={unitId:n,subUnitId:o,ranges:c},R=ue(this._injector,m),C={unitId:n,subUnitId:o,ranges:h},S=Re(this._injector,C);return{preRedos:[{id:G.id,params:m}],redos:[{id:j.id,params:C}],undos:[{id:j.id,params:R}],preUndos:[{id:G.id,params:S}]}}_checkIsMergeCell(t){return!(t.startRow===t.endRow&&t.startColumn===t.endColumn)}_handleNull(){return{redos:[],undos:[]}}_commandExecutedListener(){this.disposeWithMe(this._commandService.onCommandExecuted(t=>{if(mu.includes(t.id)){if(!t.params)return;const n=this._univerInstanceService.getUniverSheetInstance(t.params.unitId);if(!n)return;const o=n.getSheetBySheetId(t.params.subUnitId);if(!o)return;const{sourceRange:r,targetRange:a}=t.params,l=r.startColumn===a.startColumn&&r.endColumn===a.endColumn,u=l?r.endRow-r.startRow+1:r.endColumn-r.startColumn+1,d=l?r.startRow:r.startColumn,c=l?a.startRow:a.startColumn,h=o.getConfig().mergeData,m=[];h.forEach(I=>{let{startRow:v,endRow:M,startColumn:p,endColumn:w,rangeType:y}=I;i.Rectangle.intersects(I,r)||(l?d<v&&c>M?(v-=u,M-=u):d>M&&c<=v&&(v+=u,M+=u):d<p&&c>w?(p-=u,w-=u):d>w&&c<=p&&(p+=u,w+=u)),I.startRow===I.endRow&&I.startColumn===I.endColumn||m.push({startRow:v,endRow:M,startColumn:p,endColumn:w,rangeType:y})}),o.setMergeData(m),this.disposableCollection.dispose();const{unitId:R,subUnitId:C}=t.params,S=I=>this.refRangeHandle(I,R,C);m.forEach(I=>{this.disposableCollection.add(this._refRangeService.registerRefRange(I,S,R,C))})}if(hu.includes(t.id)){const n=this._univerInstanceService.getUniverSheetInstance(t.params.unitId);if(!n)return;const o=n.getSheetBySheetId(t.params.subUnitId);if(!o)return;const r=o.getConfig().mergeData,a=t.params;if(!a)return;const{range:l}=a,u=t.id.includes("row"),d=t.id.includes("insert"),c=u?l.startRow:l.startColumn,h=u?l.endRow:l.endColumn,m=h-c+1,R=[];r.forEach(v=>{let{startRow:M,endRow:p,startColumn:w,endColumn:y,rangeType:b}=v;d?u?c<=M&&(M+=m,p+=m):c<=w&&(w+=m,y+=m):u?h<M&&(M-=m,p-=m):h<w&&(w-=m,y-=m),v.startRow===v.endRow&&v.startColumn===v.endColumn||R.push({startRow:M,endRow:p,startColumn:w,endColumn:y,rangeType:b})}),o.setMergeData(R),this.disposableCollection.dispose();const{unitId:C,subUnitId:S}=t.params,I=v=>this.refRangeHandle(v,C,S);R.forEach(v=>{this.disposableCollection.add(this._refRangeService.registerRefRange(v,I,C,S))})}}))}},g.MergeCellController=cu([Et(0,i.Inject(i.ICommandService)),Et(1,i.Inject(g.RefRangeService)),Et(2,i.Inject(i.IUniverInstanceService)),Et(3,i.Inject(i.Injector)),Et(4,i.Inject(g.SheetInterceptorService)),Et(5,i.Inject(g.SheetsSelectionsService))],g.MergeCellController);function be(s,e){return e?s.getUniverSheetInstance(e):s.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET)}function Ee(s,e){return e?s.getSheetBySheetId(e):s.getActiveSheet()}const Pr=(s,e,t)=>{const o=s.get(g.SheetsSelectionsService).getCurrentSelections(),{value:r,selections:a,unitId:l,subUnitId:u}=e;if(o&&o.length>0){const c=o[(o==null?void 0:o.length)-1].primary;if(c){const{actualColumn:h,actualRow:m}=c;let{startRow:R,startColumn:C,endRow:S,endColumn:I}=a[a.length-1];if(r===i.Dimension.COLUMNS){const w=t.find(y=>y.startColumn===h&&y.endColumn===h&&m===y.startRow);w&&(I=w.endColumn,R=w.startRow,S=w.endRow)}else if(r===i.Dimension.ROWS){const w=t.find(y=>y.startRow===m&&y.endRow===m&&h===y.startColumn);w&&(S=w.endRow,C=w.startColumn,I=w.endColumn)}const v={startRow:R,startColumn:C,endRow:S,endColumn:I,actualRow:m,actualColumn:h,isMerged:!0,isMergedMainCell:R===m&&C===h},M=o.map((w,y,b)=>({range:w.range,style:null,primary:y===b.length-1?v:null})),p={unitId:l,subUnitId:u,type:Q.ONLY_SET,selections:M};return{id:q.id,params:p}}return null}return null},Nr=(s,e)=>{const n=s.get(g.SheetsSelectionsService).getCurrentSelections(),{unitId:o,subUnitId:r}=e;if(n&&n.length>0&&n[(n==null?void 0:n.length)-1].primary){const u={unitId:o,subUnitId:r,type:Q.ONLY_SET,selections:[...n]};return{id:q.id,params:u}}return null};function gu(s,e){return e.some(t=>Ru(s,t))}function Ru(s,e){const{startRow:t,startColumn:n,endColumn:o,endRow:r}=e,a=s.getMatrixWithMergedCells(t,n,r,o);let l=!1;return a.forValue((u,d,c)=>{if(c&&(u!==t||d!==n)&&s.cellHasValue(c))return l=!0,!1}),l}function Or(s,e,t,n){const o=[],r=[],a=t.getSheetId();return n.forEach(l=>{const u=Dr(t,l),d={unitId:e,subUnitId:a,cellValue:u.getData()},c=he(s,d);o.push({id:F.id,params:c}),r.push({id:F.id,params:d})}),{undos:o,redos:r}}function Dr(s,e){const{startRow:t,startColumn:n,endColumn:o,endRow:r}=e,a=s.getMatrixWithMergedCells(t,n,r,o,i.CellModeEnum.Raw),l=new i.ObjectMatrix;let u=null;return a.forValue((d,c,h)=>{var m,R,C,S;h&&d>=t&&c>=n&&(!u&&s.cellHasValue(h)&&(h.v!==""||((S=(C=(R=(m=h.p)==null?void 0:m.body)==null?void 0:R.dataStream)==null?void 0:C.length)!=null?S:0)>2)&&(u=h),l.setValue(d,c,null))}),l.setValue(t,n,u),l}const ot={type:i.CommandType.COMMAND,id:"sheet.command.add-worksheet-merge",handler:async(s,e)=>{const t=s.get(i.IUniverInstanceService),n=P(t,e);if(!n)return!1;const{worksheet:o}=n,{unitId:r,subUnitId:a,selections:l}=e,u=s.get(i.ICommandService),d=s.get(i.IUndoRedoService),c=Ds(l,e.value),h=gu(o,c);if(h&&!e.defaultMerge){const U=s.get(i.IConfirmService),k=s.get(i.LocaleService);if(!await U.confirm({id:"merge.confirm.add-worksheet-merge",title:{title:"merge.confirm.warning"},children:{title:"merge.confirm.title"},cancelText:k.t("merge.confirm.cancel"),confirmText:k.t("merge.confirm.confirm")}))return!1}const m=[],R=[],C={unitId:r,subUnitId:a,ranges:i.Tools.deepClone(c)},S={unitId:r,subUnitId:a,ranges:i.Tools.deepClone(c)},I=ue(s,C),v=Re(s,S);if(I.ranges.length>0&&m.push({id:G.id,params:I}),m.push({id:j.id,params:S}),R.push({id:G.id,params:v}),I.ranges.length>0&&R.push({id:j.id,params:I}),h){const U=Or(s,r,o,c);m.unshift(...U.redos),R.push(...U.undos)}const M=Pr(s,e,c);M&&m.push(M);const p=Nr(s,e);p&&R.push(p);const y=s.get(g.SheetInterceptorService).onCommandExecute({id:ot.id,params:{unitId:r,subUnitId:a,ranges:c}});return m.push(...y.redos),R.push(...y.undos),i.sequenceExecute(m,u).result?(d.pushUndoRedo({unitID:r,undoMutations:R,redoMutations:m}),!0):!1}},Ar={type:i.CommandType.COMMAND,id:"sheet.command.add-worksheet-merge-all",handler:async s=>{var c;const t=(c=s.get(g.SheetsSelectionsService).getCurrentSelections())==null?void 0:c.map(h=>h.range),n=As("mergeAll",t);if(!(n!=null&&n.length))return!1;const o=s.get(i.IUniverInstanceService),r=P(o);if(!r)return!1;const{worksheet:a}=r,l=a.getUnitId(),u=a.getSheetId();return s.get(i.ICommandService).executeCommand(ot.id,{selections:n,unitId:l,subUnitId:u})}},Wr={type:i.CommandType.COMMAND,id:"sheet.command.add-worksheet-merge-vertical",handler:async s=>{var c;const t=(c=s.get(g.SheetsSelectionsService).getCurrentSelections())==null?void 0:c.map(h=>h.range),n=As("mergeVertical",t);if(!(n!=null&&n.length))return!1;const o=s.get(i.IUniverInstanceService),r=P(o);if(!r)return!1;const{worksheet:a}=r,l=a.getUnitId(),u=a.getSheetId();return s.get(i.ICommandService).executeCommand(ot.id,{value:i.Dimension.COLUMNS,selections:n,unitId:l,subUnitId:u})}},Vr={type:i.CommandType.COMMAND,id:"sheet.command.add-worksheet-merge-horizontal",handler:async s=>{var h;const t=(h=s.get(g.SheetsSelectionsService).getCurrentSelections())==null?void 0:h.map(m=>m.range),n=As("mergeHorizontal",t);if(!(n!=null&&n.length))return!1;const o=s.get(i.IUniverInstanceService),r=P(o);if(!r)return!1;const{workbook:a,worksheet:l}=r,u=a.getUnitId(),d=l.getSheetId();return s.get(i.ICommandService).executeCommand(ot.id,{value:i.Dimension.ROWS,selections:n,unitId:u,subUnitId:d})}};function Cu(s,e,t,n,o){const r=s.get(i.IUniverInstanceService),a=P(r,{unitId:e,subUnitId:t});if(!a)return;const{worksheet:l}=a;if(l.getMergeData().some(h=>n.some(m=>i.Rectangle.intersects(m,h))))throw new Error("The ranges to be merged overlap with the existing merged cells");s.get(i.ICommandService).executeCommand(ot.id,{unitId:e,subUnitId:t,selections:n,defaultMerge:o})}function As(s,e){return e?s==="mergeAll"?e.filter(t=>!(t.startRow===t.endRow&&t.startColumn===t.endColumn)):s==="mergeVertical"?e.filter(t=>t.startRow!==t.endRow):s==="mergeHorizontal"?e.filter(t=>t.startColumn!==t.endColumn):e:null}class Ne{constructor(){f(this,"_model",new Map);f(this,"_ruleChange",new O.Subject);f(this,"_ruleRefresh",new O.Subject);f(this,"_resetOrder",new O.Subject);f(this,"ruleChange$",this._ruleChange.asObservable());f(this,"ruleRefresh$",this._ruleRefresh.asObservable());f(this,"resetOrder$",this._resetOrder.asObservable());f(this,"_worksheetRuleInitStateChange",new O.BehaviorSubject(!1));f(this,"worksheetRuleInitStateChange$",this._worksheetRuleInitStateChange.asObservable())}changeRuleInitState(e){this._worksheetRuleInitStateChange.next(e)}getSheetRuleInitState(){return this._worksheetRuleInitStateChange.value}addRule(e,t){this._ensureSubUnitMap(e).set(t.subUnitId,t),this._ruleChange.next({unitId:e,rule:t,type:"add",subUnitId:t.subUnitId})}deleteRule(e,t){var o,r,a;const n=(r=(o=this._model)==null?void 0:o.get(e))==null?void 0:r.get(t);n&&((a=this._model.get(e))==null||a.delete(t),this._ruleChange.next({unitId:e,rule:n,type:"delete",subUnitId:t}))}setRule(e,t,n){var r,a;const o=this.getRule(e,t);o&&((a=(r=this._model)==null?void 0:r.get(e))==null||a.set(t,n),this._ruleChange.next({unitId:e,oldRule:o,rule:n,type:"set",subUnitId:t}))}getRule(e,t){var n,o;return(o=(n=this._model)==null?void 0:n.get(e))==null?void 0:o.get(t)}toObject(){const e={};return[...this._model.keys()].forEach(n=>{const o=this._model.get(n);o!=null&&o.size&&(e[n]=[],[...o.keys()].forEach(a=>{const l=o.get(a);l&&e[n].push(l)}))}),e}fromObject(e){const t=new Map;Object.keys(e).forEach(n=>{const o=e[n];if(o!=null&&o.length){const r=new Map;o.forEach(a=>{r.set(a.subUnitId,a)}),t.set(n,r)}}),this._model=t}deleteUnitModel(e){this._model.delete(e)}_ensureSubUnitMap(e){let t=this._model.get(e);return t||(t=new Map,this._model.set(e,t)),t}ruleRefresh(e){this._ruleRefresh.next(e)}resetOrder(){this._resetOrder.next(Math.random())}getTargetByPermissionId(e,t){const n=this._model.get(e);if(!n)return null;for(const[o,r]of n)if(r.permissionId===t)return[e,o]}}const qe={id:"sheet.mutation.add-worksheet-protection",type:i.CommandType.MUTATION,handler:(s,e)=>{const t=s.get(Ne),{unitId:n,rule:o}=e;return t.addRule(n,o),!0}},rt={id:"sheet.mutation.delete-worksheet-protection",type:i.CommandType.MUTATION,handler:(s,e)=>{const t=s.get(Ne),{unitId:n,subUnitId:o}=e;return t.deleteRule(n,o),!0}},Lr={type:i.CommandType.COMMAND,id:"sheet.command.add-worksheet-protection",async handler(s,e){if(!e)return!1;const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),{rule:o,unitId:r}=e,a=o.subUnitId;if(await t.executeCommand(qe.id,{unitId:r,rule:o,subUnitId:o.subUnitId})){const u=[{id:qe.id,params:{unitId:r,rule:o,subUnitId:o.subUnitId}}],d=[{id:rt.id,params:{unitId:r,subUnitId:a}}];n.pushUndoRedo({unitID:r,redoMutations:u,undoMutations:d})}return!0}},$r={type:i.CommandType.COMMAND,id:"sheet.command.set-worksheet-range-theme-style",handler:(s,e)=>{const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),{unitId:o}=e,r=ho(s,e);return t.syncExecuteCommand(dt.id,e)?(n.pushUndoRedo({unitID:o,undoMutations:[{id:ct.id,params:r}],redoMutations:[{id:dt.id,params:e}]}),!0):!1}},Br={type:i.CommandType.COMMAND,id:"sheet.command.append-row",handler:(s,e)=>{const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),{unitId:o,subUnitId:r,cellValue:a,insertRowNums:l,insertColumnNums:u,maxRows:d,maxColumns:c}=e,h={unitId:o,subUnitId:r,cellValue:a},m=he(s,h),R=[{id:F.id,params:h}],C=[{id:F.id,params:m}];if(l){const I={unitId:o,subUnitId:r,range:{startRow:d,endRow:d,startColumn:0,endColumn:c-1}},v=sn(s,I);R.unshift({id:ie.id,params:I}),C.push({id:le.id,params:v})}if(u){const I={unitId:o,subUnitId:r,range:{startRow:0,endRow:d-1,startColumn:c,endColumn:c-1+u}},v=At(s,I);R.unshift({id:ae.id,params:I}),C.push({id:se.id,params:v})}return i.sequenceExecute(R,t).result?(n.pushUndoRedo({unitID:o,undoMutations:C,redoMutations:R}),!0):!1}},vn={id:"sheet.command.clear-selection-content",type:i.CommandType.COMMAND,handler:(s,e)=>{var p;const t=s.get(i.IUniverInstanceService),n=s.get(i.ICommandService),o=s.get(g.SheetsSelectionsService),r=s.get(i.IUndoRedoService),a=s.get(g.SheetInterceptorService),l=t.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET);if(!l)return!1;const u=(e==null?void 0:e.unitId)||l.getUnitId(),d=l.getActiveSheet();if(!d)return!1;const c=(e==null?void 0:e.subUnitId)||d.getSheetId(),h=(e==null?void 0:e.ranges)||((p=o.getCurrentSelections())==null?void 0:p.map(w=>w.range));if(!(h!=null&&h.length))return!1;const m=Vt(h,s,u,c),R={subUnitId:c,unitId:u,cellValue:Do(m)},C=he(s,R),S=a.onCommandExecute({id:vn.id}),I=[{id:F.id,params:R},...S.redos],v=[...S.undos,{id:F.id,params:C}];return i.sequenceExecute(I,n).result?(r.pushUndoRedo({unitID:u,undoMutations:v,redoMutations:I}),!0):!1}},zt="sheets.config",Ws={largeSheetCellCountThreshold:6e3,batchSize:3e3},Hr={};var Su=Object.getOwnPropertyDescriptor,fu=(s,e,t,n)=>{for(var o=n>1?void 0:n?Su(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},Fr=(s,e)=>(t,n)=>e(t,n,s);g.SheetLazyExecuteScheduleService=class extends i.Disposable{constructor(t,n){super();f(this,"_tasks",new Map);f(this,"_idleCallbackId",null);f(this,"_beforeUnloadHandler",null);this._commandService=t,this._univerInstanceService=n,this._setupBeforeUnloadListener(),this.disposeWithMe(()=>{this._cancelAllTasks(),this._removeBeforeUnloadListener()})}hasPendingTasks(){return this._tasks.size>0}getPendingMutationsCount(){let t=0;for(const n of this._tasks.values())t+=n.mutations.length-n.currentIndex;return t}scheduleMutations(t,n,o){if(o.length===0)return;const r=`${t}_${n}`;this._cancelTask(r),this._tasks.set(r,{unitId:t,subUnitId:n,mutations:o,currentIndex:0}),this._scheduleNextIdle()}cancelScheduledMutations(t,n){const o=`${t}_${n}`;this._cancelTask(o)}_cancelTask(t){this._tasks.delete(t),this._tasks.size===0&&this._idleCallbackId!==null&&(typeof cancelIdleCallback<"u"&&cancelIdleCallback(this._idleCallbackId),this._idleCallbackId=null)}_cancelAllTasks(){this._tasks.clear(),this._idleCallbackId!==null&&(typeof cancelIdleCallback<"u"&&cancelIdleCallback(this._idleCallbackId),this._idleCallbackId=null)}_scheduleNextIdle(){this._idleCallbackId===null&&(typeof requestIdleCallback<"u"?this._idleCallbackId=requestIdleCallback(t=>this._processIdleTasks(t),{timeout:1e3*60}):this._idleCallbackId=setTimeout(()=>{this._processIdleTasks({didTimeout:!1,timeRemaining:()=>16})},16))}_processIdleTasks(t){this._idleCallbackId=null;for(const[n,o]of this._tasks){if(!this._isSheetExist(o.unitId,o.subUnitId)){this._tasks.delete(n);continue}for(o.currentIndex;o.currentIndex<o.mutations.length;){if(t.timeRemaining()<=0&&!t.didTimeout){this._scheduleNextIdle();return}const r=o.mutations[o.currentIndex];this._commandService.syncExecuteCommand(r.id,r.params,{onlyLocal:!0}),o.currentIndex++}this._tasks.delete(n)}this._tasks.size>0&&this._scheduleNextIdle()}_isSheetExist(t,n){const o=this._univerInstanceService.getUnit(t,i.UniverInstanceType.UNIVER_SHEET);return o?o.getSheetBySheetId(n)!==null:!1}_setupBeforeUnloadListener(){typeof window>"u"||(this._beforeUnloadHandler=t=>{if(this.hasPendingTasks())return t.preventDefault(),t.returnValue="",""},window.addEventListener("beforeunload",this._beforeUnloadHandler))}_removeBeforeUnloadListener(){typeof window>"u"||!this._beforeUnloadHandler||(window.removeEventListener("beforeunload",this._beforeUnloadHandler),this._beforeUnloadHandler=null)}},g.SheetLazyExecuteScheduleService=fu([Fr(0,i.ICommandService),Fr(1,i.IUniverInstanceService)],g.SheetLazyExecuteScheduleService);const Vs={id:"sheet.mutation.copy-worksheet-end",type:i.CommandType.MUTATION,handler:()=>!0},Ls=(s,e)=>({subUnitId:e.sheet.id,unitId:e.unitId,subUnitName:e.sheet.name}),it={id:"sheet.mutation.insert-sheet",type:i.CommandType.MUTATION,handler:(s,e)=>{const t=s.get(i.IUniverInstanceService),{sheet:n,index:o,unitId:r,styles:a}=e,l=t.getUniverSheetInstance(r);return l?(a&&l.addStyles(a),l.addWorksheet(n.id,o,i.cloneWorksheetData(n))):!1}};function Iu(s){let e=0;for(const t of Object.keys(s)){const n=s[Number(t)];n&&(e+=Object.keys(n).length)}return e}function vu(s,e,t,n){const o=[];let r={},a=0;for(const d in t){const c=Number(d),h=t[c];if(!h)continue;const m=Object.keys(h).length;a>0&&a+m>n&&(o.push(r),r={},a=0),r[c]=h,a+=m,a>=n&&(o.push(r),r={},a=0)}a>0&&o.push(r);const l=o.length>0?o[0]:{},u=o.slice(1).map(d=>({id:F.id,params:{unitId:s,subUnitId:e,cellValue:d,__splitChunk__:!0}}));return{firstChunkCellData:l,remainingMutations:u}}const jr="sheet.command.copy-sheet";function pu(s,e,t,n,o,r,a){var b,U;const u=s.get(i.IConfigService).getConfig(zt),d={...Ws,...u==null?void 0:u.largeSheetOperation},c=i.cloneWorksheetData(t.getConfig());c.name=wu(e,r,c.name);const h=i.generateRandomId();c.id=h;const m=e.getSheetIndex(t),{cellData:R}=c,S=Iu(R)>=d.largeSheetCellCountThreshold;let I,v=[];if(S){const{firstChunkCellData:k,remainingMutations:T}=vu(n,h,R,d.batchSize),E={...c,cellData:k};I={index:m+1,sheet:E,unitId:n},v=T}else I={index:m+1,sheet:c,unitId:n};const M=Ls(s,I),p=a.onCommandExecute({id:jr,params:{unitId:n,subUnitId:o,targetSubUnitId:c.id}}),w=[...(b=p.preRedos)!=null?b:[],{id:it.id,params:I},...p.redos],y=[...(U=p.preUndos)!=null?U:[],{id:He.id,params:M},...p.undos];return{redos:w,undos:y,unitId:n,newSheetId:h,isSplit:S,scheduledMutations:v}}const Gr={type:i.CommandType.COMMAND,id:jr,handler:(s,e)=>{const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),o=s.get(i.IUniverInstanceService),r=s.get(g.SheetInterceptorService),a=s.get(i.LocaleService),l=s.get(g.SheetLazyExecuteScheduleService),u=P(o,e);if(!u)return!1;const{workbook:d,worksheet:c,unitId:h,subUnitId:m}=u,{redos:R,undos:C,newSheetId:S,isSplit:I,scheduledMutations:v}=pu(s,d,c,h,m,a,r);if(i.sequenceExecute(R,t).result){if(I){if(n.pushUndoRedo({unitID:h,undoMutations:C,redoMutations:[]}),v.length>0){for(const p of v)t.syncExecuteCommand(p.id,p.params,{syncOnly:!0});t.syncExecuteCommand(Vs.id,{unitId:h,subUnitId:S},{syncOnly:!0}),l.scheduleMutations(h,S,v)}}else n.pushUndoRedo({unitID:h,undoMutations:C,redoMutations:R});return!0}return!1}};function wu(s,e,t){let n=`${t} ${e.t("sheets.tabs.sheetCopy","")}`,o=2;for(;s.checkSheetName(n);)n=`${t} ${e.t("sheets.tabs.sheetCopy",`${o}`)}`,o++;return n}const zr={type:i.CommandType.COMMAND,id:"sheet.command.delete-range-protection",async handler(s,e){if(!e)return!1;const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),{unitId:o,subUnitId:r,rule:a}=e,l={unitId:o,subUnitId:r,ruleIds:[a.id]};return await t.executeCommand(Ue.id,l)&&n.pushUndoRedo({unitID:o,redoMutations:[{id:Ue.id,params:l}],undoMutations:[{id:Se.id,params:{unitId:o,subUnitId:r,rules:[a]}}]}),!0}},qr={type:i.CommandType.COMMAND,id:"sheet.command.delete-worksheet-protection",handler(s,e){if(!e)return!1;const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),{rule:o,unitId:r,subUnitId:a}=e;t.executeCommand(rt.id,{unitId:r,subUnitId:a});const l=[{id:rt.id,params:{unitId:r,subUnitId:a}}],u=[{id:qe.id,params:{unitId:r,rule:o,subUnitId:a}}];return n.pushUndoRedo({unitID:r,redoMutations:l,undoMutations:u}),!0}},Yr={type:i.CommandType.COMMAND,id:"sheet.command.remove-worksheet-range-theme-style",handler:(s,e)=>{const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),{unitId:o}=e,r=mo(s,e);return t.syncExecuteCommand(ct.id,e)?(n.pushUndoRedo({unitID:o,undoMutations:[{id:dt.id,params:r}],redoMutations:[{id:ct.id,params:e}]}),!0):!1}},xr={id:"sheet.command.insert-defined-name",type:i.CommandType.COMMAND,handler:(s,e)=>{const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService);if(!e)return!1;const o={...e};return t.syncExecuteCommand(K.SetDefinedNameMutation.id,o)?(n.pushUndoRedo({unitID:e.unitId,undoMutations:[{id:K.RemoveDefinedNameMutation.id,params:o}],redoMutations:[{id:K.SetDefinedNameMutation.id,params:o}]}),!0):!1}},Kr={id:"sheet.command.insert-sheet",type:i.CommandType.COMMAND,handler:(s,e)=>{var I;const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),o=s.get(i.IUniverInstanceService),r=s.get(i.LocaleService),a=Hn(o,{unitId:e==null?void 0:e.unitId});if(!a)return!1;const{unitId:l,workbook:u}=a;let d=u.getSheets().length;const c=e==null?void 0:e.sheet,h=c==null?void 0:c.id,m=i.mergeWorksheetSnapshotWithDefault(c||{});e?(d=(I=e.index)!=null?I:d,m.id=h||i.generateRandomId(),m.name=(c==null?void 0:c.name)||u.generateNewSheetName(`${r.t("sheets.tabs.sheet")}`)):(m.id=i.generateRandomId(),m.name=u.generateNewSheetName(`${r.t("sheets.tabs.sheet")}`));const R={index:d,sheet:m,unitId:l},C=Ls(s,R);return t.syncExecuteCommand(it.id,R)?(n.pushUndoRedo({unitID:l,undoMutations:[{id:He.id,params:C}],redoMutations:[{id:it.id,params:R}]}),!0):!1}},Tt={id:"sheet.mutation.register-worksheet-range-theme-style",type:i.CommandType.MUTATION,handler:(s,e)=>{if(!P(s.get(i.IUniverInstanceService),e))return!1;const n=s.get(g.SheetRangeThemeModel),{unitId:o,rangeThemeStyleJson:r,themeName:a}=e,l=new Le(a,r);return n.registerRangeThemeStyle(o,l),!0}},pn={id:"sheet.mutation.unregister-worksheet-range-theme-style",type:i.CommandType.MUTATION,handler:(s,e)=>{if(!P(s.get(i.IUniverInstanceService),e))return!1;const n=s.get(g.SheetRangeThemeModel),{unitId:o,themeName:r}=e;return n.unregisterRangeThemeStyle(o,r),!0}},Jr={id:"sheet.command.register-worksheet-range-theme-style",type:i.CommandType.COMMAND,handler:(s,e)=>{if(!e)return!1;const{unitId:t,rangeThemeStyle:n}=e,o=s.get(i.IUniverInstanceService),r=s.get(i.ICommandService),a=s.get(i.IUndoRedoService);if(!P(o,e))return!1;const u={unitId:t,themeName:n.getName(),rangeThemeStyleJson:n.toJson()},d={unitId:t,themeName:n.getName()};return r.syncExecuteCommand(Tt.id,u)&&a.pushUndoRedo({unitID:t,undoMutations:[{id:pn.id,params:d}],redoMutations:[{id:Tt.id,params:u}]}),!0}},$s={id:"sheet.command.remove-defined-name",type:i.CommandType.COMMAND,handler:(s,e)=>{var c,h;const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),o=s.get(g.SheetInterceptorService);if(!e)return!1;const r={...e},a=o.onCommandExecute({id:$s.id,params:e}),l=[...(c=a.preRedos)!=null?c:[],{id:K.RemoveDefinedNameMutation.id,params:r},...a.redos],u=[...(h=a.preUndos)!=null?h:[],{id:K.SetDefinedNameMutation.id,params:r},...a.undos];return i.sequenceExecute(l,t)?(n.pushUndoRedo({unitID:e.unitId,undoMutations:u.filter(Boolean),redoMutations:l.filter(Boolean)}),!0):!1}},wn={id:"sheet.command.remove-sheet",type:i.CommandType.COMMAND,handler:(s,e)=>{var b,U;const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),o=s.get(i.IUniverInstanceService),r=s.get(g.SheetInterceptorService),a=s.get(i.IConfigService),l=P(o,e);if(!l)return!1;const{unitId:u,subUnitId:d,workbook:c,worksheet:h}=l;if(c.getSheets().length<=1)return!1;const m=a.getConfig(zt),R={...Ws,...m==null?void 0:m.largeSheetOperation},S=gr(h.getCellMatrix())>=R.largeSheetCellCountThreshold,I={subUnitId:d,unitId:u,subUnitName:h.getName()},v=S?null:dr(s,I),M=r.onCommandExecute({id:wn.id,params:{unitId:u,subUnitId:d}}),p=[...(b=M.preRedos)!=null?b:[],{id:He.id,params:I},...M.redos],w=S?[]:[...(U=M.preUndos)!=null?U:[],{id:it.id,params:v},...M.undos];return i.sequenceExecute(p,t).result?(S?n.clearUndoRedo(u):n.pushUndoRedo({unitID:u,undoMutations:w,redoMutations:p}),!0):!1}},Xr={type:i.CommandType.COMMAND,id:"sheet.command.remove-worksheet-merge",handler:(s,e)=>{var k;const t=s.get(g.SheetsSelectionsService),n=s.get(i.ICommandService),o=s.get(i.IUndoRedoService),r=s.get(i.IUniverInstanceService),a=(e==null?void 0:e.ranges)||((k=t.getCurrentSelections())==null?void 0:k.map(T=>T.range));if(!(a!=null&&a.length))return!1;const l=P(r);if(!l)return!1;const{subUnitId:u,unitId:d,worksheet:c}=l,h={unitId:d,subUnitId:u,ranges:a},R=c.getConfig().mergeData.filter(T=>a.some(E=>i.Rectangle.intersects(E,T)));if(!R.length)return!1;const C=ue(s,h),S=t.getCurrentSelections(),I=i.Tools.deepClone(S),v=i.Tools.deepClone(S);if(S.length){const T=v[v.length-1],{startRow:E,startColumn:N}=T.range;T.primary={startRow:E,startColumn:N,endRow:E,endColumn:N,actualRow:E,actualColumn:N,isMerged:!1,isMergedMainCell:!1}}const M=Mu(c,R),p={unitId:d,subUnitId:u,cellValue:M.redoParams.getMatrix()},w={unitId:d,subUnitId:u,cellValue:M.undoParams.getMatrix()},y=[{id:G.id,params:C},{id:F.id,params:p},{id:q.id,params:{unitId:d,subUnitId:u,selections:v,type:Q.ONLY_SET}}],b=[{id:j.id,params:C},{id:F.id,params:w},{id:q.id,params:{unitId:d,subUnitId:u,selections:I,type:Q.ONLY_SET}}];return i.sequenceExecute(y,n)?(o.pushUndoRedo({unitID:d,undoMutations:b,redoMutations:y}),!0):!1}};function Mu(s,e){const t=new i.ObjectMatrix,n=new i.ObjectMatrix;return e.forEach(o=>{const{startRow:r,startColumn:a,endColumn:l,endRow:u}=o,d=s.getCellMatrix().getValue(r,a);if(d!=null&&d.s)for(let c=r;c<=u;c++)for(let h=a;h<=l;h++)(c!==r||h!==a)&&(t.setValue(c,h,{s:d.s}),n.setValue(c,h,null))}),{redoParams:t,undoParams:n}}class at{constructor(){f(this,"_borderInfo",{type:i.BorderType.ALL,color:"#000000",style:i.BorderStyleTypes.THIN,activeBorderType:!1});f(this,"_borderInfo$",new O.BehaviorSubject(this._borderInfo));f(this,"borderInfo$",this._borderInfo$.asObservable())}dispose(){this._borderInfo$.complete()}setType(e){this._borderInfo.type=e,this.setActiveBorderType(!0),this._refresh()}setColor(e){this._borderInfo.color=e,this._refresh()}setStyle(e){this._borderInfo.style=e,this._refresh()}setActiveBorderType(e){this._borderInfo.activeBorderType=e}getBorderInfo(){return this._borderInfo}_refresh(){this._borderInfo$.next(this._borderInfo)}}function Mn(s,e){const{startRow:t,startColumn:n,endRow:o,endColumn:r}=s;for(let a=t;a<=o;a++)for(let l=n;l<=r;l++)e(a,l)}const Bs=(s,e,t,n)=>{const{mr:o,worksheet:r}=s;e.startRow<0||e.startColumn<0||Mn(e,(a,l)=>{var c,h;const u=r.getMergedCell(a,l);let d=t;if(u&&(t.bc_tr||t.ml_tr||t.bl_tr||t.tl_mr||t.tl_bc||t.tl_br)){if(n){const m=i.Tools.deepClone((c=o.getValue(u.startRow,u.startColumn))==null?void 0:c.s);d=m!=null&&m.bd?Object.assign(m.bd,t):t}o.setValue(u.startRow,u.startColumn,{s:{bd:d}})}else{if(n){const m=i.Tools.deepClone((h=o.getValue(a,l))==null?void 0:h.s);d=m!=null&&m.bd?Object.assign(m.bd,t):t}o.setValue(a,l,{s:{bd:d}})}})},yu=s=>{const e={startRow:s.startRow-1,startColumn:s.startColumn,endRow:s.startRow-1,endColumn:s.endColumn},t={startRow:s.startRow,startColumn:s.startColumn-1,endRow:s.endRow,endColumn:s.startColumn-1},n={startRow:s.endRow+1,startColumn:s.startColumn,endRow:s.endRow+1,endColumn:s.endColumn},o={startRow:s.startRow,startColumn:s.endColumn+1,endRow:s.endRow,endColumn:s.endColumn+1},r={startRow:s.startRow,startColumn:s.startColumn,endRow:s.startRow,endColumn:s.endColumn},a={startRow:s.startRow,startColumn:s.startColumn,endRow:s.endRow,endColumn:s.startColumn},l={startRow:s.endRow,startColumn:s.startColumn,endRow:s.endRow,endColumn:s.endColumn},u={startRow:s.startRow,startColumn:s.endColumn,endRow:s.endRow,endColumn:s.endColumn};return{topRangeOut:e,leftRangeOut:t,bottomRangeOut:n,rightRangeOut:o,topRange:r,leftRange:a,bottomRange:l,rightRange:u}};function _u(s,e,t){const{style:n,color:o,type:r}=s.getBorderInfo(),a=r===i.BorderType.TOP||r===i.BorderType.ALL||r===i.BorderType.OUTSIDE,l=r===i.BorderType.LEFT||r===i.BorderType.ALL||r===i.BorderType.OUTSIDE,u=r===i.BorderType.BOTTOM||r===i.BorderType.ALL||r===i.BorderType.OUTSIDE,d=r===i.BorderType.RIGHT||r===i.BorderType.ALL||r===i.BorderType.OUTSIDE,c=r===i.BorderType.VERTICAL||r===i.BorderType.ALL||r===i.BorderType.INSIDE,h=r===i.BorderType.HORIZONTAL||r===i.BorderType.ALL||r===i.BorderType.INSIDE,m=r.indexOf("tlbr")>-1,R=r.indexOf("tlbc")>-1,C=r.indexOf("tlmr")>-1,S=r.indexOf("bltr")>-1,I=r.indexOf("mltr")>-1,v=r.indexOf("bctr")>-1,M=t[0],{topRangeOut:p,leftRangeOut:w,bottomRangeOut:y,rightRangeOut:b,topRange:U,leftRange:k,bottomRange:T,rightRange:E}=yu(M),N=new i.ObjectMatrix,{worksheet:V,unitId:W,subUnitId:L}=e;return{worksheet:V,unitId:W,subUnitId:L,style:n,color:o,type:r,top:a,left:l,right:d,bottom:u,vertical:c,horizontal:h,tl_br:m,tl_bc:R,tl_mr:C,bl_tr:S,ml_tr:I,bc_tr:v,topRangeOut:p,leftRangeOut:w,bottomRangeOut:y,rightRangeOut:b,topRange:U,leftRange:k,bottomRange:T,rightRange:E,range:M,mr:N,borderStyle:{s:n,cl:{rgb:o}}}}const bu=s=>{const{range:e,mr:t,borderStyle:n,vertical:o,horizontal:r,worksheet:a}=s;o&&Mn(e,(l,u)=>{var c,h,m;const d=a.getMergedCell(l,u);if(d){const R=(c=t.getValue(d.startRow,d.startColumn))==null?void 0:c.s;d.startColumn!==e.startColumn&&t.setValue(l,u,{s:{bd:R!=null&&R.bd?Object.assign(R.bd,{l:i.Tools.deepClone(n)}):{l:i.Tools.deepClone(n)}}})}else{if(u!==e.endColumn){const R=(h=t.getValue(l,u))==null?void 0:h.s;t.setValue(l,u,{s:{bd:R!=null&&R.bd?Object.assign(R.bd,{r:i.Tools.deepClone(n)}):{r:i.Tools.deepClone(n)}}})}if(u!==e.startColumn){const R=(m=t.getValue(l,u))==null?void 0:m.s;t.setValue(l,u,{s:{bd:R!=null&&R.bd?Object.assign(R.bd,{l:i.Tools.deepClone(n)}):{l:i.Tools.deepClone(n)}}})}}}),r&&Mn(e,(l,u)=>{var c,h,m;const d=a.getMergedCell(l,u);if(d){const R=(c=t.getValue(d.startRow,d.startColumn))==null?void 0:c.s;d.startRow!==e.startRow&&t.setValue(l,u,{s:{bd:R!=null&&R.bd?Object.assign(R.bd,{t:i.Tools.deepClone(n)}):{t:i.Tools.deepClone(n)}}})}else{if(l!==e.endRow){const R=(h=t.getValue(l,u))==null?void 0:h.s;t.setValue(l,u,{s:{bd:R!=null&&R.bd?Object.assign(R.bd,{b:i.Tools.deepClone(n)}):{b:i.Tools.deepClone(n)}}})}if(l!==e.startRow){const R=(m=t.getValue(l,u))==null?void 0:m.s;t.setValue(l,u,{s:{bd:R!=null&&R.bd?Object.assign(R.bd,{t:i.Tools.deepClone(n)}):{t:i.Tools.deepClone(n)}}})}}})};function Eu(s){const{borderStyle:e,tl_br:t,tl_bc:n,tl_mr:o,bl_tr:r,ml_tr:a,bc_tr:l}=s,u=(d,c,h)=>{Bs(s,d,c,h)};t&&u(s.range,{tl_br:i.Tools.deepClone(e)},!0),n&&u(s.range,{tl_bc:i.Tools.deepClone(e)},!0),o&&u(s.range,{tl_mr:i.Tools.deepClone(e)},!0),r&&u(s.range,{bl_tr:i.Tools.deepClone(e)},!0),a&&u(s.range,{ml_tr:i.Tools.deepClone(e)},!0),l&&u(s.range,{bc_tr:i.Tools.deepClone(e)},!0)}const Tu=s=>{const{top:e,left:t,right:n,bottom:o,borderStyle:r,bottomRange:a,topRange:l,leftRange:u,rightRange:d,bottomRangeOut:c,topRangeOut:h,leftRangeOut:m,rightRangeOut:R}=s,C=(S,I,v)=>{Bs(s,S,I,v)};e&&(C(h,{b:null}),C(l,{t:i.Tools.deepClone(r)},!0)),o&&(C(c,{t:null}),C(a,{b:i.Tools.deepClone(r)},!0)),t&&(C(m,{r:null}),C(u,{l:i.Tools.deepClone(r)},!0)),n&&(C(R,{l:null}),C(d,{r:i.Tools.deepClone(r)},!0))},Uu=s=>{const{range:e,worksheet:t,mr:n,top:o,bottom:r,left:a,right:l,vertical:u,horizontal:d,tl_br:c,tl_bc:h,tl_mr:m,bl_tr:R,ml_tr:C,bc_tr:S,topRange:I,bottomRange:v,leftRange:M,rightRange:p,topRangeOut:w,bottomRangeOut:y,leftRangeOut:b,rightRangeOut:U}=s,k=(T,E,N)=>{Bs(s,T,E,N)};!o&&!r&&!a&&!l&&!u&&!d&&!c&&!h&&!m&&!R&&!C&&!S&&(Mn(e,(T,E)=>{var V,W,L,$,Y,z,x,re;const N=t.getMergedCell(T,E);if(N){if(N.endColumn!==e.endColumn){const H=(V=n.getValue(N.startRow,N.startColumn))==null?void 0:V.s;n.setValue(T,E,{s:{bd:H!=null&&H.bd?Object.assign(H.bd,{r:null}):{r:null}}})}if(N.startColumn!==e.startColumn){const H=(W=n.getValue(N.startRow,N.startColumn))==null?void 0:W.s;n.setValue(T,E,{s:{bd:H!=null&&H.bd?Object.assign(H.bd,{l:null}):{l:null}}})}if(N.endRow!==e.endRow){const H=(L=n.getValue(N.startRow,N.startColumn))==null?void 0:L.s;n.setValue(T,E,{s:{bd:H!=null&&H.bd?Object.assign(H.bd,{b:null}):{b:null}}})}if(N.startRow!==e.startRow){const H=($=n.getValue(N.startRow,N.startColumn))==null?void 0:$.s;n.setValue(T,E,{s:{bd:H!=null&&H.bd?Object.assign(H.bd,{t:null}):{t:null}}})}}else{if(E!==e.endColumn){const H=(Y=n.getValue(T,E))==null?void 0:Y.s;n.setValue(T,E,{s:{bd:H!=null&&H.bd?Object.assign(H.bd,{r:null}):{r:null}}})}if(E!==e.startColumn){const H=(z=n.getValue(T,E))==null?void 0:z.s;n.setValue(T,E,{s:{bd:H!=null&&H.bd?Object.assign(H.bd,{l:null}):{l:null}}})}if(T!==e.endRow){const H=(x=n.getValue(T,E))==null?void 0:x.s;n.setValue(T,E,{s:{bd:H!=null&&H.bd?Object.assign(H.bd,{b:null}):{b:null}}})}if(T!==e.startRow){const H=(re=n.getValue(T,E))==null?void 0:re.s;n.setValue(T,E,{s:{bd:H!=null&&H.bd?Object.assign(H.bd,{t:null}):{t:null}}})}}}),k(w,{b:null}),k(I,{t:null},!0),k(y,{t:null}),k(v,{b:null},!0),k(b,{r:null}),k(M,{l:null},!0),k(U,{l:null}),k(p,{r:null},!0),k(e,{tl_br:null},!0),k(e,{tl_bc:null},!0),k(e,{tl_mr:null},!0),k(e,{bl_tr:null},!0),k(e,{ml_tr:null},!0),k(e,{bc_tr:null},!0))},Ut={id:"sheet.command.set-border",type:i.CommandType.COMMAND,handler:(s,e)=>{var v;const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),o=s.get(i.IUniverInstanceService),r=s.get(g.SheetsSelectionsService),a=s.get(at),l=P(o,e);if(!l)return!1;const u=(e==null?void 0:e.ranges)||((v=r.getCurrentSelections())==null?void 0:v.map(M=>M.range));if(!(u!=null&&u.length))return!1;const{activeBorderType:d}=a.getBorderInfo();if(!d)return!1;const c=_u(a,l,u);bu(c),Tu(c),Eu(c),Uu(c);const{unitId:h,subUnitId:m,mr:R}=c,C={unitId:h,subUnitId:m,cellValue:R.getData()},S=he(s,C);return t.syncExecuteCommand(F.id,C)?(n.pushUndoRedo({unitID:h,undoMutations:[{id:F.id,params:S}],redoMutations:[{id:F.id,params:C}]}),!0):!1}},Zr={id:"sheet.command.set-border-position",type:i.CommandType.COMMAND,handler:(s,e)=>{if(!e.value)return!1;const t=s.get(i.ICommandService);return s.get(at).setType(e.value),t.syncExecuteCommand(Ut.id)}},Qr={id:"sheet.command.set-border-style",type:i.CommandType.COMMAND,handler:(s,e)=>{const t=s.get(i.ICommandService);return s.get(at).setStyle(e.value),t.syncExecuteCommand(Ut.id)}},ei={id:"sheet.command.set-border-color",type:i.CommandType.COMMAND,handler:(s,e)=>{const t=s.get(i.ICommandService);return s.get(at).setColor(e.value),t.syncExecuteCommand(Ut.id)}},ti={id:"sheet.command.set-border-basic",type:i.CommandType.COMMAND,handler:(s,e)=>{const{unitId:t,subUnitId:n,value:o,ranges:r}=e,{type:a,color:l,style:u}=o,d=s.get(i.ICommandService),c=s.get(at);return c.setType(a),l&&c.setColor(l),c.setStyle(u),d.syncExecuteCommand(Ut.id,{unitId:t,subUnitId:n,ranges:r})}},ni={type:i.CommandType.COMMAND,id:"sheet.command.set-col-data",handler:(s,e)=>{const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),o=s.get(i.IUniverInstanceService),r=P(o,e);if(!r)return!1;const{columnData:a}=e,{unitId:l,subUnitId:u,worksheet:d}=r,c={subUnitId:u,unitId:l,columnData:a},h=So(c,d);return t.syncExecuteCommand(ht.id,c)?(n.pushUndoRedo({unitID:l,undoMutations:[{id:ht.id,params:h}],redoMutations:[{id:ht.id,params:c}]}),!0):!1}},kt={type:i.CommandType.COMMAND,id:"sheet.command.set-col-visible-on-cols",handler:(s,e)=>{var v,M;const{unitId:t,subUnitId:n,ranges:o}=e,r=s.get(g.SheetInterceptorService),a=s.get(i.ICommandService),l=s.get(i.IUniverInstanceService),u=P(l,{unitId:t,subUnitId:n});if(!u)return!1;const{worksheet:d}=u,c={unitId:t,subUnitId:n,ranges:o},h={unitId:t,subUnitId:n,reveal:!0,selections:o.map(p=>({range:p,primary:oe(p,d),style:null}))},m=ka(s,c),R={unitId:t,subUnitId:n,selections:si(o).map(p=>({range:p,primary:oe(p,d),style:null}))},C=i.sequenceExecute([{id:gt.id,params:c},{id:q.id,params:h}],a),S=r.onCommandExecute({id:kt.id,params:e}),I=i.sequenceExecute([...S.redos],a);if(C.result&&I.result){const p=r.afterCommandExecute({id:kt.id,params:e});return i.sequenceExecute(p.redos,a),s.get(i.IUndoRedoService).pushUndoRedo({unitID:t,undoMutations:[{id:mt.id,params:m},{id:q.id,params:R},...(v=S.undos)!=null?v:[],...p.undos],redoMutations:[...(M=S.preRedos)!=null?M:[],{id:gt.id,params:c},{id:q.id,params:h},...S.redos,...p.redos]}),!0}return!0}},Hs={type:i.CommandType.COMMAND,id:"sheet.command.set-selected-cols-visible",handler:s=>{var d;const e=s.get(g.SheetsSelectionsService),t=s.get(i.ICommandService),n=(d=e.getCurrentSelections())==null?void 0:d.map(c=>c.range).filter(c=>c.rangeType===i.RANGE_TYPE.COLUMN);if(!(n!=null&&n.length))return!1;const o=P(s.get(i.IUniverInstanceService));if(!o)return!1;const{worksheet:r,unitId:a,subUnitId:l}=o,u=n.map(c=>r.getHiddenCols(c.startColumn,c.endColumn)).flat();return t.executeCommand(kt.id,{unitId:a,subUnitId:l,ranges:u})}},yn={type:i.CommandType.COMMAND,id:"sheet.command.set-col-hidden",handler:(s,e)=>{var M,p,w,y;const t=s.get(g.SheetsSelectionsService),n=s.get(g.SheetInterceptorService),o=s.get(i.IUniverInstanceService),r=s.get(i.ICommandService);let a=(M=e==null?void 0:e.ranges)!=null&&M.length?e.ranges:(p=t.getCurrentSelections())==null?void 0:p.map(b=>b.range).filter(b=>b.rangeType===i.RANGE_TYPE.COLUMN);if(!(a!=null&&a.length))return!1;const l=P(o,e);if(!l)return!1;const{worksheet:u,unitId:d,subUnitId:c}=l;a=ku(l.worksheet,a);const h={unitId:d,subUnitId:c,ranges:a},m={unitId:d,subUnitId:c,selections:si(a).map(b=>({range:b,primary:oe(b,u),style:null}))},R=Ua(s,h),C={unitId:d,subUnitId:c,reveal:!0,selections:a.map(b=>({range:b,primary:oe(b,u),style:null}))},S=i.sequenceExecute([{id:mt.id,params:h},{id:q.id,params:m}],r),I=n.onCommandExecute({id:yn.id,params:h}),v=i.sequenceExecute([...I.redos],r);if(S.result&&v.result){const b=n.afterCommandExecute({id:yn.id,params:h});return i.sequenceExecute(b.redos,r),s.get(i.IUndoRedoService).pushUndoRedo({unitID:d,undoMutations:[{id:gt.id,params:R},{id:q.id,params:C},...(w=I.undos)!=null?w:[],...b.undos],redoMutations:[...(y=I.preRedos)!=null?y:[],{id:mt.id,params:h},{id:q.id,params:m},...I.redos,...b.redos]}),!0}return!1}};function ku(s,e){const t=s.getRowCount()-1,n=s.getHiddenCols(),o=[];return e.forEach(r=>{const a=n.filter(l=>l.startColumn>=r.startColumn&&l.endColumn<=r.endColumn);if(a.length){let l=r.startColumn;a.forEach(u=>{u.startColumn>l&&(o.push({startColumn:l,endColumn:u.startColumn-1,startRow:0,endRow:t}),l=u.endColumn+1)}),l<=r.endColumn&&o.push({startColumn:l,endColumn:r.endColumn,startRow:0,endRow:t})}else o.push(r)}),o}function si(s){return Pu(s).map(t=>{const n=t.startColumn===0?t.endColumn+1:t.startColumn-1;return{...t,startColumn:n,endColumn:n}})}function Pu(s){const e=[];let t;return s.sort((n,o)=>n.startColumn-o.startColumn).forEach(n=>{if(!t){t=n;return}t.endColumn===n.startColumn-1?t.endColumn=n.endColumn:(e.push(t),t=n)}),e.push(t),e}const Fs={id:"sheet.command.set-defined-name",type:i.CommandType.COMMAND,handler:(s,e)=>{var h,m;const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),o=s.get(g.SheetInterceptorService);if(!e)return!1;const r={...e},a=K.SetDefinedNameMutationFactory(s,e),l=o.onCommandExecute({id:Fs.id,params:e}),u=[...(h=l.preRedos)!=null?h:[],{id:K.RemoveDefinedNameMutation.id,params:a},{id:K.SetDefinedNameMutation.id,params:r},...l.redos],d=[...(m=l.preUndos)!=null?m:[],{id:K.RemoveDefinedNameMutation.id,params:r},{id:K.SetDefinedNameMutation.id,params:a},...l.undos];return i.sequenceExecute(u,t)?(n.pushUndoRedo({unitID:e.unitId,undoMutations:d.filter(Boolean),redoMutations:u.filter(Boolean)}),!0):!1}},js=(s,e)=>{const n=s.get(i.IUniverInstanceService).getUniverSheetInstance(e.unitId);if(n==null)throw new Error("universheet is null error!");const o=n.getSheetBySheetId(e.subUnitId);if(o==null)throw new Error("worksheet is null error!");const a=o.getConfig().freeze;return{unitId:e.unitId,subUnitId:e.subUnitId,...a}},Oe={id:"sheet.mutation.set-frozen",type:i.CommandType.MUTATION,handler:(s,e)=>{const n=s.get(i.IUniverInstanceService).getUniverSheetInstance(e.unitId);if(n==null)throw new Error("universheet is null error!");const o=n.getSheetBySheetId(e.subUnitId);if(!o)return!1;const r=o.getConfig(),{startRow:a,startColumn:l,ySplit:u,xSplit:d}=e;return r.freeze={startRow:a,startColumn:l,ySplit:u,xSplit:d},!0}},oi={type:i.CommandType.COMMAND,id:"sheet.command.set-frozen",handler:(s,e)=>{const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),o=s.get(i.IUniverInstanceService),r=P(o,{unitId:e.unitId,subUnitId:e.subUnitId});if(!r)return!1;const{unitId:a,subUnitId:l,worksheet:u}=r,{startColumn:d,startRow:c,xSplit:h,ySplit:m}=e;if(c>=u.getRowCount()||d>=u.getColumnCount()||h>=u.getColumnCount()||m>=u.getRowCount())return!1;const R={unitId:a,subUnitId:l,...e},C=js(s,R);return t.syncExecuteCommand(Oe.id,R)?(n.pushUndoRedo({unitID:a,undoMutations:[{id:Oe.id,params:C}],redoMutations:[{id:Oe.id,params:R}]}),!0):!1}},ri={type:i.CommandType.COMMAND,id:"sheet.command.cancel-frozen",handler:(s,e)=>{const t=s.get(i.ICommandService),n=s.get(i.IUniverInstanceService),o=s.get(i.IUndoRedoService),r=P(n,{unitId:e==null?void 0:e.unitId,subUnitId:e==null?void 0:e.subUnitId});if(!r)return!1;const{unitId:a,subUnitId:l}=r,u={unitId:a,subUnitId:l,startRow:-1,startColumn:-1,xSplit:0,ySplit:0},d=js(s,u);return t.syncExecuteCommand(Oe.id,u)&&o.pushUndoRedo({unitID:a,undoMutations:[{id:Oe.id,params:d}],redoMutations:[{id:Oe.id,params:u}]}),!0}},ii={type:i.CommandType.COMMAND,id:"sheet.command.set-gridlines-color",handler:(s,e)=>{const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),o=s.get(i.IUniverInstanceService),r=P(o,e);if(!r)return!1;const{worksheet:a}=r,l=a.getConfig().gridlinesColor;if(l===(e==null?void 0:e.color))return!1;const{unitId:u,subUnitId:d}=r,c={color:e==null?void 0:e.color,unitId:u,subUnitId:d},h={color:l,unitId:u,subUnitId:d};return t.syncExecuteCommand(Rt.id,c)?(n.pushUndoRedo({unitID:u,undoMutations:[{id:Rt.id,params:h}],redoMutations:[{id:Rt.id,params:c}]}),!0):!1}},ee={id:"sheet.mutation.set-range-protection",type:i.CommandType.MUTATION,handler:(s,e)=>{const{unitId:t,subUnitId:n,rule:o,ruleId:r}=e;return s.get(X).setRule(t,n,r,o),!0}},Nu=(s,e)=>{const{unitId:t,subUnitId:n,ruleId:o}=e,a=s.get(X).getRule(t,n,o);return a?{id:ee.id,params:{...e,rule:a}}:null},lt={id:"sheet.mutation.set-worksheet-protection",type:i.CommandType.MUTATION,handler:(s,e)=>{const{unitId:t,subUnitId:n,rule:o}=e;return s.get(Ne).setRule(t,n,o),!0}},ai={type:i.CommandType.COMMAND,id:"sheet.command.set-protection",async handler(s,e){if(!e)return!1;const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),o=s.get(X),{rule:r,oldRule:a}=e,{unitId:l,subUnitId:u}=r,d=[],c=[];return(a==null?void 0:a.unitType)===r.unitType?r.unitType===D.Worksheet?(d.push({id:lt.id,params:{unitId:l,subUnitId:u,rule:r}}),c.push({id:lt.id,params:{unitId:l,subUnitId:u,rule:a}})):(d.push({id:ee.id,params:{unitId:l,subUnitId:u,rule:r,ruleId:r.id}}),c.push({id:ee.id,params:{unitId:l,subUnitId:u,ruleId:a.id,rule:a}})):(a&&(a.unitType===D.Worksheet?(d.push({id:rt.id,params:{unitId:l,subUnitId:u}}),c.push({id:qe.id,params:{unitId:l,rule:a,subUnitId:a.subUnitId}})):a.unitType===D.SelectRange&&(d.push({id:Ue.id,params:{unitId:l,subUnitId:u,ruleIds:[a.id]}}),c.push({id:Se.id,params:{unitId:l,subUnitId:u,rules:[a]}}))),r.unitType===D.Worksheet?(d.push({id:qe.id,params:{unitId:l,rule:r,subUnitId:r.subUnitId}}),c.unshift({id:rt.id,params:{unitId:l,subUnitId:u}})):r.unitType===D.SelectRange&&(r.id=o.createRuleId(l,u),d.push({id:Se.id,params:{unitId:l,subUnitId:u,rules:[r]}}),c.unshift({id:Ue.id,params:{unitId:l,subUnitId:u,ruleIds:[r.id]}}))),i.sequenceExecute(d,t)&&n.pushUndoRedo({unitID:l,undoMutations:c,redoMutations:d}),!0}},li={type:i.CommandType.COMMAND,id:"sheet.command.set-row-data",handler:(s,e)=>{const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),o=s.get(i.IUniverInstanceService),r=P(o,e);if(!r)return!1;const{rowData:a}=e,{unitId:l,subUnitId:u,worksheet:d}=r,c={subUnitId:u,unitId:l,rowData:a},h=vo(c,d);return t.syncExecuteCommand(Ct.id,c)?(n.pushUndoRedo({unitID:l,undoMutations:[{id:Ct.id,params:h}],redoMutations:[{id:Ct.id,params:c}]}),!0):!1}},Pt={type:i.CommandType.COMMAND,id:"sheet.command.set-specific-rows-visible",handler:(s,e)=>{var v,M,p;const{unitId:t,subUnitId:n,ranges:o}=e,r=s.get(i.ICommandService),a=s.get(i.IUndoRedoService),l=s.get(g.SheetInterceptorService),u=P(s.get(i.IUniverInstanceService),{unitId:t,subUnitId:n});if(!u)return!1;const{worksheet:d}=u,c={unitId:t,subUnitId:n,ranges:o},h={unitId:t,subUnitId:n,reveal:!0,selections:o.map(w=>({range:w,primary:oe(w,d),style:null}))},m=Ba(s,c),R={unitId:t,subUnitId:n,selections:ui(o).map(w=>({range:w,primary:oe(w,d),style:null}))},C=i.sequenceExecute([{id:Je.id,params:c},{id:q.id,params:h}],r),S=l.onCommandExecute({id:Pt.id,params:e}),I=i.sequenceExecute([...S.redos],r);if(C.result&&I.result){const w=l.afterCommandExecute({id:Pt.id,params:e});return i.sequenceExecute(w.redos,r),a.pushUndoRedo({unitID:t,undoMutations:[...(v=S.preUndos)!=null?v:[],{id:Xe.id,params:m},{id:q.id,params:R},...(M=S.undos)!=null?M:[],...w.undos],redoMutations:[...(p=S.preRedos)!=null?p:[],{id:Je.id,params:c},{id:q.id,params:h},...S.redos,...w.redos]}),!0}return!0}},Gs={type:i.CommandType.COMMAND,id:"sheet.command.set-selected-rows-visible",handler:async s=>{var c;const e=s.get(g.SheetsSelectionsService),t=s.get(i.IUniverInstanceService),n=s.get(i.ICommandService),o=(c=e.getCurrentSelections())==null?void 0:c.map(h=>h.range).filter(h=>h.rangeType===i.RANGE_TYPE.ROW);if(!(o!=null&&o.length))return!1;const r=P(t);if(!r)return!1;const{worksheet:a,unitId:l,subUnitId:u}=r,d=o.map(h=>a.getHiddenRows(h.startRow,h.endRow)).flat();return n.executeCommand(Pt.id,{unitId:l,subUnitId:u,ranges:d})}},_n={type:i.CommandType.COMMAND,id:"sheet.command.set-rows-hidden",handler:(s,e)=>{var M,p,w,y,b,U;const t=s.get(g.SheetsSelectionsService),n=s.get(i.ICommandService),o=s.get(i.IUndoRedoService),r=s.get(i.IUniverInstanceService),a=s.get(g.SheetInterceptorService);let l=(M=e==null?void 0:e.ranges)!=null&&M.length?e.ranges:(p=t.getCurrentSelections())==null?void 0:p.map(k=>k.range).filter(k=>k.rangeType===i.RANGE_TYPE.ROW);if(!(l!=null&&l.length))return!1;const u=P(r,e);if(!u)return!1;l=Ou(u.worksheet,l);const{unitId:d,subUnitId:c,worksheet:h}=u,m={unitId:d,subUnitId:c,ranges:l},R={unitId:d,subUnitId:c,selections:ui(l).map(k=>({range:k,primary:oe(k,h),style:null}))},C=Ha(s,m),S={unitId:d,subUnitId:c,reveal:!0,selections:l.map(k=>({range:k,primary:oe(k,h),style:null}))},I=a.onCommandExecute({id:_n.id,params:m});if(i.sequenceExecute([...(w=I.preRedos)!=null?w:[],{id:Xe.id,params:m},{id:q.id,params:R},...I.redos],n).result){const k=a.afterCommandExecute({id:_n.id,params:m});return i.sequenceExecute(k.redos,n),o.pushUndoRedo({unitID:d,undoMutations:[...(y=I.preUndos)!=null?y:[],{id:Je.id,params:C},{id:q.id,params:S},...(b=I.undos)!=null?b:[],...k.undos],redoMutations:[...(U=I.preRedos)!=null?U:[],{id:Xe.id,params:m},{id:q.id,params:R},...I.redos,...k.redos]}),!0}return!0}};function Ou(s,e){const t=s.getMaxColumns()-1,n=s.getHiddenRows(),o=[];return e.forEach(r=>{const a=n.filter(l=>l.startRow>=r.startRow&&l.endRow<=r.endRow);if(a.length){let l=r.startRow;a.forEach(u=>{u.startRow>l&&(o.push({startRow:l,endRow:u.startRow-1,startColumn:0,endColumn:t}),l=u.endRow+1)}),l<=r.endRow&&o.push({startRow:l,endRow:r.endRow,startColumn:0,endColumn:t})}else o.push(r)}),o}function ui(s){return Du(s).map(t=>{const n=t.startRow===0?t.endRow+1:t.startRow-1;return{...t,startRow:n,endRow:n}})}function Du(s){const e=[];let t;return s.sort((n,o)=>n.startRow-o.startRow).forEach(n=>{if(!t){t=n;return}n.startRow===t.endRow+1?t.endRow=n.endRow:(e.push(t),t=n)}),e.push(t),e}const Au=["ff","fs","tr","tb"],te={type:i.CommandType.COMMAND,id:"sheet.command.set-style",handler:(s,e)=>{var T;const t=s.get(i.IUniverInstanceService),n=P(t,e);if(!n)return!1;const{unitId:o,subUnitId:r,worksheet:a}=n,{range:l,style:u}=e,d=s.get(i.ICommandService),c=s.get(i.IUndoRedoService),h=s.get(g.SheetsSelectionsService),m=l?[l]:(T=h.getCurrentSelections())==null?void 0:T.map(E=>E.range);if(!(m!=null&&m.length))return!1;const R=new i.ObjectMatrix,C=_l(a);if(i.Tools.isArray(u.value))for(let E=0;E<m.length;E++)C.forOperableEach(m[E],(N,V,W)=>{R.setValue(N,V,{s:{[u.type]:u.value[N-W.startRow][V-W.startColumn]}})});else for(let E=0;E<m.length;E++){const N={s:{[u.type]:u.value}};C.forOperableEach(m[E],(V,W)=>R.setValue(V,W,N))}const S={subUnitId:r,unitId:o,cellValue:R.getMatrix()},I=s.get(g.SheetSkeletonService).getSkeleton(o,r),v=he(s,S),M=d.syncExecuteCommand(F.id,S),p=s.get(g.SheetInterceptorService);let w=[],y=[];if(Au.includes(e==null?void 0:e.style.type)){const{suitableRanges:E,remainingRanges:N}=jt(m,I),V=Ts(E,a),{undos:W,redos:L}=p.generateMutationsOfAutoHeight({unitId:o,subUnitId:r,ranges:E,autoHeightRanges:E,lazyAutoHeightRanges:N,cellHeights:V});w=W,y=L}const{undos:b,redos:U}=p.onCommandExecute({id:te.id,params:e}),k=i.sequenceExecute([...U,...y],d);return M&&k.result?(c.pushUndoRedo({unitID:S.unitId,undoMutations:[{id:F.id,params:v},...b,...w],redoMutations:[{id:F.id,params:S},...U,...y]}),!0):!1}},Wu={type:i.CommandType.COMMAND,id:"sheet.command.set-bold",handler:s=>{const e=s.get(g.SheetsSelectionsService).getCurrentLastSelection();if(!e)return!1;const t=P(s.get(i.IUniverInstanceService));if(!t)return!1;const{worksheet:n}=t,{actualRow:o,actualColumn:r}=e.primary,l={style:{type:"bl",value:n.getRange(o,r).getFontWeight()===i.FontWeight.BOLD?i.BooleanNumber.FALSE:i.BooleanNumber.TRUE}};return s.get(i.ICommandService).syncExecuteCommand(te.id,l)}},Vu={type:i.CommandType.COMMAND,id:"sheet.command.set-italic",handler:s=>{const e=s.get(g.SheetsSelectionsService).getCurrentLastSelection();if(!e)return!1;const t=P(s.get(i.IUniverInstanceService));if(!t)return!1;const{worksheet:n}=t;let o=!0;if(e.primary){const{startRow:a,startColumn:l}=e.primary;o=n.getRange(a,l).getFontStyle()===i.FontItalic.ITALIC}const r={style:{type:"it",value:o?i.BooleanNumber.FALSE:i.BooleanNumber.TRUE}};return s.get(i.ICommandService).syncExecuteCommand(te.id,r)}},Lu={type:i.CommandType.COMMAND,id:"sheet.command.set-underline",handler:s=>{const e=s.get(g.SheetsSelectionsService).getCurrentLastSelection();if(!e)return!1;const t=P(s.get(i.IUniverInstanceService));if(!t)return!1;const{worksheet:n}=t;let o=!0;e.primary&&(o=!!n.getRange(e.primary.startRow,e.primary.startColumn).getUnderline().s);const r={style:{type:"ul",value:{s:o?i.BooleanNumber.FALSE:i.BooleanNumber.TRUE}}};return s.get(i.ICommandService).syncExecuteCommand(te.id,r)}},$u={type:i.CommandType.COMMAND,id:"sheet.command.set-stroke",handler:s=>{const e=s.get(g.SheetsSelectionsService).getCurrentLastSelection();if(!e)return!1;const t=P(s.get(i.IUniverInstanceService));if(!t)return!1;const{worksheet:n}=t;let o=!0;e.primary&&(o=!!n.getRange(e.primary.actualRow,e.primary.actualColumn).getStrikeThrough().s);const r={style:{type:"st",value:{s:o?i.BooleanNumber.FALSE:i.BooleanNumber.TRUE}}};return s.get(i.ICommandService).syncExecuteCommand(te.id,r)}},Bu={type:i.CommandType.COMMAND,id:"sheet.command.set-overline",handler:s=>{const e=s.get(g.SheetsSelectionsService).getCurrentLastSelection();if(!e)return!1;const t=P(s.get(i.IUniverInstanceService));if(!t)return!1;const{worksheet:n}=t;let o=!0;e.primary&&(o=!!n.getRange(e.primary.startRow,e.primary.startColumn).getOverline().s);const r={style:{type:"ol",value:{s:o?i.BooleanNumber.FALSE:i.BooleanNumber.TRUE}}};return s.get(i.ICommandService).syncExecuteCommand(te.id,r)}},Hu={type:i.CommandType.COMMAND,id:"sheet.command.set-font-family",handler:(s,e)=>{if(!e)return!1;const t=s.get(i.ICommandService),n={style:{type:"ff",value:e.value}};return t.syncExecuteCommand(te.id,n)}},Fu={type:i.CommandType.COMMAND,id:"sheet.command.set-font-size",handler:(s,e)=>{if(!e)return!1;const t=s.get(i.ICommandService),n={style:{type:"fs",value:e.value}};return t.syncExecuteCommand(te.id,n)}},di={type:i.CommandType.COMMAND,id:"sheet.command.set-text-color",handler:(s,e)=>{if(!e)return!1;const t=s.get(i.ICommandService),n={style:{type:"cl",value:{rgb:e.value}}};return t.syncExecuteCommand(te.id,n)}},ci={type:i.CommandType.COMMAND,id:"sheet.command.reset-text-color",handler:s=>{const e=s.get(i.ICommandService),t={style:{type:"cl",value:{rgb:null}}};return e.syncExecuteCommand(te.id,t)}},hi={type:i.CommandType.COMMAND,id:"sheet.command.set-background-color",handler:(s,e)=>{if(!e||!e.value)return!1;const t=s.get(i.ICommandService),n={style:{type:"bg",value:{rgb:e.value}}};return t.syncExecuteCommand(te.id,n)}},mi={type:i.CommandType.COMMAND,id:"sheet.command.reset-background-color",handler:s=>{const e=s.get(i.ICommandService),t={style:{type:"bg",value:{rgb:null}}};return e.syncExecuteCommand(te.id,t)}},gi={type:i.CommandType.COMMAND,id:"sheet.command.set-vertical-text-align",handler:(s,e)=>{if(!e)return!1;const t=s.get(i.ICommandService),n={unitId:e.unitId,subUnitId:e.subUnitId,range:e.range,style:{type:"vt",value:e.value}};return t.syncExecuteCommand(te.id,n)}},Ri={type:i.CommandType.COMMAND,id:"sheet.command.set-horizontal-text-align",handler:(s,e)=>{if(!e)return!1;const t=s.get(i.ICommandService),n={unitId:e.unitId,subUnitId:e.subUnitId,range:e.range,style:{type:"ht",value:e.value}};return t.syncExecuteCommand(te.id,n)}},Ci={type:i.CommandType.COMMAND,id:"sheet.command.set-text-wrap",handler:(s,e)=>{if(!e)return!1;const t=s.get(i.ICommandService),n={unitId:e.unitId,subUnitId:e.subUnitId,range:e.range,style:{type:"tb",value:e.value}};return t.syncExecuteCommand(te.id,n)}},Si={type:i.CommandType.COMMAND,id:"sheet.command.set-text-rotation",handler:(s,e)=>{if(!e)return!1;const t=typeof e.value=="number"?{a:e.value}:{a:0,v:i.BooleanNumber.TRUE},n=s.get(i.ICommandService),o={unitId:e.unitId,subUnitId:e.subUnitId,range:e.range,style:{type:"tr",value:t}};return n.syncExecuteCommand(te.id,o)}},ju=(s,e)=>{const r=s.get(i.IUniverInstanceService).getUniverSheetInstance(e.unitId).getSheetBySheetId(e.subUnitId).getConfig().tabColor;return{...i.Tools.deepClone(e),color:r}},qt={id:"sheet.mutation.set-tab-color",type:i.CommandType.MUTATION,handler:(s,e)=>{const t=s.get(i.IUniverInstanceService).getUniverSheetInstance(e.unitId);if(!t)return!1;const n=t.getSheetBySheetId(e.subUnitId);return n?(n.getConfig().tabColor=e.color,!0):!1}},fi={type:i.CommandType.COMMAND,id:"sheet.command.set-tab-color",handler:(s,e)=>{const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),o=P(s.get(i.IUniverInstanceService));if(!o)return!1;const{unitId:r,subUnitId:a}=o,l={color:e.value,unitId:r,subUnitId:a},u=ju(s,l);return t.syncExecuteCommand(qt.id,l)?(n.pushUndoRedo({unitID:r,undoMutations:[{id:qt.id,params:u}],redoMutations:[{id:qt.id,params:l}]}),!0):!1}},zs={id:"sheet.mutation.set-workbook-name",type:i.CommandType.MUTATION,handler:(s,e)=>{const t=s.get(i.IUniverInstanceService).getUnit(e.unitId,i.UniverInstanceType.UNIVER_SHEET);return t?(t.setName(e.name),!0):!1}},qs={type:i.CommandType.COMMAND,id:"sheet.command.set-workbook-name",handler:(s,e)=>{var u;const t=s.get(i.ICommandService),n=s.get(g.SheetInterceptorService);if(!Hn(s.get(i.IUniverInstanceService),e))return!1;const r=n.onCommandExecute({id:qs.id,params:e}),a={name:e.name,unitId:e.unitId},l=[...(u=r.preRedos)!=null?u:[],{id:zs.id,params:a},...r.redos];return i.sequenceExecute(l,t).result}},Gu=4,Ys={type:i.CommandType.COMMAND,id:"sheet.command.set-worksheet-activate",handler:(s,e,t)=>{const n=s.get(i.ICommandService),o=P(s.get(i.IUniverInstanceService),e);if(!o)return!1;const{unitId:r,subUnitId:a}=o;return new Promise(l=>{setTimeout(()=>{const u=n.syncExecuteCommand(Ze.id,{unitId:r,subUnitId:a},t);l(u)},Gu)})}},Yt={type:i.CommandType.COMMAND,id:"sheet.command.delta-column-width",handler:async(s,e)=>{const n=s.get(g.SheetsSelectionsService).getCurrentSelections();if(!(n!=null&&n.length))return!1;const o=s.get(i.ICommandService),r=s.get(i.IUndoRedoService),a=P(s.get(i.IUniverInstanceService));if(!a)return!1;const{worksheet:l,unitId:u,subUnitId:d}=a,{anchorCol:c,deltaX:h}=e,R=l.getColumnWidth(c)+h,C=n.length===1&&n[0].range.rangeType===i.RANGE_TYPE.ALL,S=n.filter($=>$.range.rangeType===i.RANGE_TYPE.COLUMN),I=C?i.RANGE_TYPE.ALL:S.some(({range:$})=>{const{startColumn:Y,endColumn:z}=$;return Y<=c&&c<=z})?i.RANGE_TYPE.COLUMN:i.RANGE_TYPE.NORMAL;let v;if(I===i.RANGE_TYPE.ALL){const $=l.getRowCount(),Y=new Array(l.getColumnCount()).fill(void 0).map((z,x)=>({startRow:0,endRow:$-1,startColumn:x,endColumn:x}));v={subUnitId:d,unitId:u,colWidth:R,ranges:Y}}else I===i.RANGE_TYPE.COLUMN?v={subUnitId:d,unitId:u,ranges:S.map($=>i.Rectangle.clone($.range)),colWidth:R}:v={subUnitId:d,unitId:u,colWidth:R,ranges:[{startRow:0,endRow:l.getMaxRows()-1,startColumn:c,endColumn:c}]};const M=s.get(g.SheetSkeletonService).getSkeleton(u,d),{suitableRanges:p,remainingRanges:w}=jt(v.ranges,M);Ts(p,l);const y=s.get(g.SheetInterceptorService),{undos:b,redos:U}=y.onCommandExecute({id:Yt.id,params:v}),k=Gn(v,l),T=o.syncExecuteCommand($e.id,v),{undos:E,redos:N}=y.generateMutationsOfAutoHeight({unitId:u,subUnitId:d,ranges:p,autoHeightRanges:p,lazyAutoHeightRanges:w}),{undos:V,redos:W}=s.get(g.SheetInterceptorService).afterCommandExecute({id:Yt.id,params:v}),L=i.sequenceExecute([...U,...W,...N],o);return T&&L.result&&r.pushUndoRedo({unitID:u,undoMutations:[{id:$e.id,params:k},...b,...V,...E],redoMutations:[{id:$e.id,params:v},...U,...W,...N]}),!0}},xt={type:i.CommandType.COMMAND,id:"sheet.command.set-worksheet-col-width",handler:(s,e)=>{var y,b,U,k;const t=s.get(g.SheetsSelectionsService),n=s.get(i.ICommandService),o=s.get(i.IUndoRedoService),r=s.get(g.SheetInterceptorService),a=(y=e==null?void 0:e.ranges)!=null&&y.length?e.ranges:(b=t.getCurrentSelections())==null?void 0:b.map(T=>T.range);if(!(a!=null&&a.length))return!1;const l=P(s.get(i.IUniverInstanceService),e);if(!l)return!1;const{subUnitId:u,unitId:d,worksheet:c}=l,h=s.get(g.SheetSkeletonService).getSkeleton(d,u),m={subUnitId:u,unitId:d,ranges:a,colWidth:e.value},{suitableRanges:R,remainingRanges:C}=jt(m.ranges,h);Ts(R,c);const S=Gn(m,c),I=n.syncExecuteCommand($e.id,m),{undos:v,redos:M}=r.generateMutationsOfAutoHeight({unitId:d,subUnitId:u,ranges:R,autoHeightRanges:R,lazyAutoHeightRanges:C}),p=r.onCommandExecute({id:xt.id,params:m}),w=i.sequenceExecute([...p.redos,...M],n);if(I&&w.result){const T=r.afterCommandExecute({id:xt.id,params:m});return i.sequenceExecute(T.redos,n),o.pushUndoRedo({unitID:d,undoMutations:[...(U=p.preUndos)!=null?U:[],{id:$e.id,params:S},...p.undos,...T.undos,...v],redoMutations:[...(k=p.preRedos)!=null?k:[],{id:$e.id,params:m},...p.redos,...T.redos,...M]}),!0}return!1}};i.CommandType.COMMAND;const Ii={type:i.CommandType.COMMAND,id:"sheet.command.set-worksheet-column-count",handler:(s,e)=>{const{unitId:t,subUnitId:n,columnCount:o}=e,r=s.get(i.ICommandService),a=s.get(i.IUndoRedoService),l=s.get(i.IUniverInstanceService);if(!P(l,e))return!1;const d={unitId:t,subUnitId:n,columnCount:o},c=po(s,d);return r.syncExecuteCommand(St.id,d)?(a.pushUndoRedo({unitID:t,undoMutations:[{id:St.id,params:c}],redoMutations:[{id:St.id,params:d}]}),!0):!1}},vi={type:i.CommandType.COMMAND,id:"sheet.command.set-worksheet-default-style",handler:(s,e)=>{const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),{unitId:o}=e,r=wo(s,e);return t.syncExecuteCommand(ft.id,e)?(n.pushUndoRedo({unitID:o,undoMutations:[{id:ft.id,params:r}],redoMutations:[{id:ft.id,params:e}]}),!0):!1}},pi=(s,e)=>{const t=ne(s.get(i.IUniverInstanceService),e);if(!t)throw new Error("[SetWorksheetHideMutationFactory]: worksheet is null error!");const{worksheet:n}=t;return{hidden:n.isSheetHidden(),unitId:e.unitId,subUnitId:n.getSheetId()}},De={id:"sheet.mutation.set-worksheet-hidden",type:i.CommandType.MUTATION,handler:(s,e)=>{const t=s.get(i.IUniverInstanceService).getUniverSheetInstance(e.unitId);if(t==null)return!1;const n=t.getSheetBySheetId(e.subUnitId);return n?(n.getConfig().hidden=e.hidden,!0):!1}},wi={type:i.CommandType.COMMAND,id:"sheet.command.set-worksheet-hidden",handler:(s,e)=>{const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),o=s.get(i.ErrorService),r=s.get(i.LocaleService),a=P(s.get(i.IUniverInstanceService),e);if(!a)return!1;const{workbook:l,worksheet:u,unitId:d,subUnitId:c}=a;if(u.getConfig().hidden===i.BooleanNumber.TRUE)return!1;const m={unitId:d,subUnitId:c,hidden:i.BooleanNumber.TRUE},R=pi(s,m);return l.getSheets().filter(v=>v.getConfig().hidden===i.BooleanNumber.FALSE).length===1?(o.emit(r.t("sheets.info.hideSheet")),!1):t.syncExecuteCommand(De.id,m)?(n.pushUndoRedo({unitID:d,undoMutations:[{id:De.id,params:R}],redoMutations:[{id:De.id,params:m}]}),!0):!1}},zu=(s,e)=>{const t=ne(s.get(i.IUniverInstanceService),e);if(!t)throw new Error("[SetWorksheetNameMutationFactory]: worksheet is null error!");const{worksheet:n}=t;return{unitId:e.unitId,name:n.getName(),subUnitId:n.getSheetId()}},Kt={id:"sheet.mutation.set-worksheet-name",type:i.CommandType.MUTATION,handler:(s,e)=>{const t=s.get(i.IUniverInstanceService).getUniverSheetInstance(e.unitId);if(t==null)return!1;const n=t.getSheetBySheetId(e.subUnitId);return n?(n.getConfig().name=e.name,!0):!1}},bn={type:i.CommandType.COMMAND,id:"sheet.command.set-worksheet-name",handler:(s,e)=>{var C,S;const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),o=s.get(g.SheetInterceptorService),r=P(s.get(i.IUniverInstanceService),e);if(!r)return!1;const{unitId:a,subUnitId:l}=r,u={subUnitId:l,name:e.name,unitId:a},d=zu(s,u),c=o.onCommandExecute({id:bn.id,params:e}),h=[...(C=c.preRedos)!=null?C:[],{id:Kt.id,params:u},...c.redos],m=[...(S=c.preUndos)!=null?S:[],{id:Kt.id,params:d},...c.undos];return i.sequenceExecute(h,t).result?(n.pushUndoRedo({unitID:a,undoMutations:m,redoMutations:h}),!0):!1}},qu=(s,e)=>({...i.Tools.deepClone(e),toOrder:e.fromOrder,fromOrder:e.toOrder}),Jt={id:"sheet.mutation.set-worksheet-order",type:i.CommandType.MUTATION,handler:(s,e)=>{const t=s.get(i.IUniverInstanceService).getUniverSheetInstance(e.unitId);if(!t)return!1;const n=t.getConfig();return n.sheetOrder.splice(e.fromOrder,1),n.sheetOrder.splice(e.toOrder,0,e.subUnitId),t.ensureSheetOrderUnique(),!0}},xs={type:i.CommandType.COMMAND,id:"sheet.command.set-worksheet-order",handler:(s,e)=>{const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),o=P(s.get(i.IUniverInstanceService),e);if(!o)return!1;const{workbook:r,unitId:a,subUnitId:l}=o,d={fromOrder:r.getConfig().sheetOrder.indexOf(l),toOrder:e.order,unitId:a,subUnitId:l},c=qu(s,d);return t.syncExecuteCommand(Jt.id,d)?(n.pushUndoRedo({unitID:a,undoMutations:[{id:Jt.id,params:c}],redoMutations:[{id:Jt.id,params:d}]}),!0):!1}};class Nt{constructor(){f(this,"_model",new Map);f(this,"_pointChange",new O.Subject);f(this,"pointChange$",this._pointChange.asObservable())}addRule(e){this._ensureSubUnitMap(e.unitId).set(e.subUnitId,e),this._pointChange.next(e)}deleteRule(e,t){var o,r,a;const n=(o=this._model.get(e))==null?void 0:o.get(t);n&&((a=(r=this._model)==null?void 0:r.get(e))==null||a.delete(t),this._pointChange.next(n))}getRule(e,t){var n,o;return(o=(n=this._model)==null?void 0:n.get(e))==null?void 0:o.get(t)}toObject(){const e={};return[...this._model.keys()].forEach(n=>{const o=this._model.get(n);o!=null&&o.size&&(e[n]=[],[...o.keys()].forEach(a=>{const l=o.get(a);l&&e[n].push(l)}))}),e}fromObject(e){const t=new Map;Object.keys(e).forEach(n=>{const o=e[n];if(o!=null&&o.length){const r=new Map;o.forEach(a=>{r.set(a.subUnitId,a)}),t.set(n,r)}}),this._model=t}deleteUnitModel(e){this._model.delete(e)}_ensureSubUnitMap(e){let t=this._model.get(e);return t||(t=new Map,this._model.set(e,t)),t}getTargetByPermissionId(e,t){const n=this._model.get(e);if(!n)return null;for(const[o,r]of n)if(r.permissionId===t)return[e,o]}}class Ks{constructor(e,t,n){f(this,"type",D.SelectRange);f(this,"subType",_.Delete);f(this,"status",i.PermissionStatus.INIT);f(this,"value",!0);f(this,"id");f(this,"unitId");f(this,"subUnitId");f(this,"permissionId");this.unitId=e,this.subUnitId=t,this.permissionId=n,this.id=`${D.SelectRange}.${_.Delete}.${n}`}}class Js{constructor(e,t,n){f(this,"type",D.SelectRange);f(this,"subType",_.ManageCollaborator);f(this,"status",i.PermissionStatus.INIT);f(this,"value",!0);f(this,"id");f(this,"unitId");f(this,"subUnitId");f(this,"permissionId");this.unitId=e,this.subUnitId=t,this.permissionId=n,this.id=`${D.SelectRange}.${_.ManageCollaborator}.${n}`}}const de=()=>[dn,fe,Js,Ks],Ye=[_.Edit,_.View,_.ManageCollaborator,_.Delete],Yu=(s="unitId",e="subUnitId",t="permissionId")=>de().reduce((n,o)=>{const r=new o(s,e,t);return n[r.subType]=r.value,n},{}),Ot=()=>[me,ss,Jn,is,Xn,ns,hn,Qn,es,gn,cn,ts,rs,mn,qo,as,os,Zn,Xo,Jo,xo,Yo],Mi=[_.Edit,_.Print,_.Comment,_.View,_.Copy,_.Export,_.ManageCollaborator,_.CreateSheet,_.DeleteSheet,_.RenameSheet,_.HideSheet,_.Duplicate,_.Share,_.MoveSheet,_.CopySheet,_.RecoverHistory,_.ViewHistory,_.CreatePermissionObject,_.InsertRow,_.InsertColumn,_.DeleteRow,_.DeleteColumn],ce=()=>[Ie,Bt,Ss,ds],pe=()=>[ls,us,cs,hs,ms,gs,Cs,Rs,fs,Is,$t,pt,wt,vs],En=[_.Copy,_.DeleteColumn,_.DeleteRow,_.EditExtraObject,_.Filter,_.InsertColumn,_.InsertRow,_.InsertHyperlink,_.PivotTable,_.SetCellStyle,_.SetCellValue,_.SetColumnStyle,_.SetRowStyle,_.Sort];var xu=Object.getOwnPropertyDescriptor,Ku=(s,e,t,n)=>{for(var o=n>1?void 0:n?xu(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},xe=(s,e)=>(t,n)=>e(t,n,s);const Ju="SHEET_WORKSHEET_PROTECTION_PLUGIN",Xu="SHEET_WORKSHEET_PROTECTION_POINT_PLUGIN";g.WorksheetPermissionService=class extends i.RxDisposable{constructor(e,t,n,o,r,a,l,u){super(),this._permissionService=e,this._univerInstanceService=t,this._injector=n,this._worksheetProtectionRuleModel=o,this._worksheetProtectionPointRuleModel=r,this._resourceManagerService=a,this._rangeProtectionRuleModel=l,this._logService=u,this._init(),this._initRuleChange(),this._initRuleSnapshot(),this._initPointSnapshot()}_init(){const e=t=>{const n=t.getUnitId(),o=r=>{const a=r.getSheetId();[...ce(),...pe()].forEach(l=>{const u=new l(n,a);this._permissionService.addPermissionPoint(u)}),this._logService.debug("[WorksheetPermissionService]","Initialization completed",n,a)};t.getSheets().forEach(r=>{o(r)}),t.sheetCreated$.subscribe(r=>{o(r)}),t.sheetDisposed$.subscribe(r=>{const a=r.getSheetId();this._rangeProtectionRuleModel.getSubunitRuleList(n,a).forEach(u=>{[...de()].forEach(d=>{const c=new d(n,a,u.permissionId);this._permissionService.deletePermissionPoint(c.id)})}),[...ce(),...pe()].forEach(u=>{const d=new u(n,a);this._permissionService.deletePermissionPoint(d.id)})})};this._univerInstanceService.getAllUnitsForType(i.UniverInstanceType.UNIVER_SHEET).forEach(t=>{e(t)}),this._univerInstanceService.getTypeOfUnitAdded$(i.UniverInstanceType.UNIVER_SHEET).pipe(Dt.takeUntil(this.dispose$)).subscribe(e),this._univerInstanceService.getTypeOfUnitDisposed$(i.UniverInstanceType.UNIVER_SHEET).pipe(Dt.takeUntil(this.dispose$)).subscribe(t=>{t.getSheets().forEach(n=>{const o=t.getUnitId(),r=n.getSheetId();ce().forEach(a=>{const l=new a(o,r);this._permissionService.deletePermissionPoint(l.id)})})})}_initRuleChange(){this.disposeWithMe(this._worksheetProtectionRuleModel.ruleChange$.subscribe(e=>{switch(e.type){case"add":break;case"delete":{ce().forEach(t=>{const n=new t(e.unitId,e.subUnitId);this._permissionService.updatePermissionPoint(n.id,!0)});break}case"set":{ce().forEach(t=>{const n=new t(e.unitId,e.subUnitId);this._permissionService.updatePermissionPoint(n.id,e.rule)});break}}}))}_initRuleSnapshot(){const e=()=>{const n=this._worksheetProtectionRuleModel.toObject();return JSON.stringify(n)},t=n=>{if(!n)return{};try{return JSON.parse(n)}catch{return{}}};this.disposeWithMe(this._resourceManagerService.registerPluginResource({toJson:e,parseJson:t,pluginName:Ju,businesses:[un.UNIVER_SHEET],onLoad:(n,o)=>{this._worksheetProtectionRuleModel.fromObject(o),Object.keys(o).forEach(r=>{ce().forEach(a=>{const l=new a(n,r);l.value=!1,this._permissionService.addPermissionPoint(l)})}),this._worksheetProtectionRuleModel.changeRuleInitState(!0)},onUnLoad:n=>{const o=this._univerInstanceService.getUnit(n);o&&(o.getSheets().forEach(r=>{const a=r.getSheetId();[...ce(),...pe()].forEach(l=>{const u=new l(n,a);this._permissionService.deletePermissionPoint(u.id)})}),Ot().forEach(r=>{const a=new r(n);this._permissionService.deletePermissionPoint(a.id)})),this._worksheetProtectionRuleModel.deleteUnitModel(n)}}))}_initPointSnapshot(){const e=()=>{const n=this._worksheetProtectionPointRuleModel.toObject();return JSON.stringify(n)},t=n=>{if(!n)return{};try{return JSON.parse(n)}catch{return{}}};this.disposeWithMe(this._resourceManagerService.registerPluginResource({toJson:e,parseJson:t,pluginName:Xu,businesses:[un.UNIVER_SHEET],onLoad:(n,o)=>{this._worksheetProtectionPointRuleModel.fromObject(o),Object.keys(o).forEach(r=>{pe().forEach(a=>{const l=new a(n,r);this._permissionService.addPermissionPoint(l)})})},onUnLoad:n=>{this._worksheetProtectionPointRuleModel.deleteUnitModel(n)}}))}},g.WorksheetPermissionService=Ku([xe(0,i.Inject(i.IPermissionService)),xe(1,i.Inject(i.IUniverInstanceService)),xe(2,i.Inject(i.Injector)),xe(3,i.Inject(Ne)),xe(4,i.Inject(Nt)),xe(5,i.Inject(i.IResourceManagerService)),xe(6,i.Inject(X)),xe(7,i.Inject(i.ILogService))],g.WorksheetPermissionService);const Tn={id:"sheet.mutation.set-worksheet-permission-points",type:i.CommandType.MUTATION,handler:(s,e)=>{const{rule:t}=e;return s.get(Nt).addRule(t),!0}},yi={type:i.CommandType.COMMAND,id:"sheet.command.set-worksheet-permission-points",async handler(s,e){if(!e)return!1;const t=s.get(i.ICommandService),{rule:n}=e;return t.executeCommand(Tn.id,{rule:n,unitId:n.unitId,subUnitId:n.subUnitId}),!0}},_i={type:i.CommandType.COMMAND,id:"sheet.command.set-worksheet-protection",async handler(s,e){if(!e)return!1;const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),{rule:o,permissionId:r,oldRule:a}=e,{unitId:l,subUnitId:u}=o,d={...o,permissionId:r};if(await t.executeCommand(lt.id,{unitId:l,subUnitId:u,newRule:d})){const h=[{id:lt.id,params:{unitId:l,subUnitId:u,newRule:d}}],m=[{id:lt.id,params:{unitId:l,subUnitId:u,rule:a}}];n.pushUndoRedo({unitID:l,redoMutations:h,undoMutations:m})}return!0}},Zu=(s,e)=>{const r=s.get(i.IUniverInstanceService).getUniverSheetInstance(e.unitId).getSheetBySheetId(e.subUnitId).getConfig().rightToLeft;return{...i.Tools.deepClone(e),rightToLeft:r}},Un={id:"sheet.mutation.set-worksheet-right-to-left",type:i.CommandType.MUTATION,handler:(s,e)=>{const t=s.get(i.IUniverInstanceService).getUniverSheetInstance(e.unitId);if(!t)return!1;const n=t.getSheetBySheetId(e.subUnitId);if(!n)return!1;const o=n.getConfig();return o.rightToLeft=e.rightToLeft,!0}},Qu={type:i.CommandType.COMMAND,id:"sheet.command.set-worksheet-right-to-left",handler:async(s,e)=>{var h;const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),o=P(s.get(i.IUniverInstanceService),e);if(!o)return!1;const{unitId:r,subUnitId:a}=o;let l=i.BooleanNumber.FALSE;e&&(l=(h=e.rightToLeft)!=null?h:i.BooleanNumber.FALSE);const u={rightToLeft:l,unitId:r,subUnitId:a},d=Zu(s,u);return t.syncExecuteCommand(Un.id,u)?(n.pushUndoRedo({unitID:r,undoMutations:[{id:Un.id,params:d}],redoMutations:[{id:Un.id,params:u}]}),!0):!1}},bi={type:i.CommandType.COMMAND,id:"sheet.command.set-worksheet-row-count",handler:(s,e)=>{const{unitId:t,subUnitId:n,rowCount:o}=e,r=s.get(i.ICommandService),a=s.get(i.IUndoRedoService),l=s.get(i.IUniverInstanceService);if(!P(l,e))return!1;const d={unitId:t,subUnitId:n,rowCount:o},c=Mo(s,d);return r.syncExecuteCommand(It.id,d)?(a.pushUndoRedo({unitID:t,undoMutations:[{id:It.id,params:c}],redoMutations:[{id:It.id,params:d}]}),!0):!1}},Xt={type:i.CommandType.COMMAND,id:"sheet.command.delta-row-height",handler:async(s,e)=>{var T,E;const n=s.get(g.SheetsSelectionsService).getCurrentSelections(),o=s.get(g.SheetInterceptorService);if(!(n!=null&&n.length))return!1;const r=P(s.get(i.IUniverInstanceService));if(!r)return!1;const{worksheet:a,subUnitId:l,unitId:u}=r,{anchorRow:d,deltaY:c}=e,m=a.getRowHeight(d)+c,R=n.length===1&&n[0].range.rangeType===i.RANGE_TYPE.ALL,C=n.filter(N=>N.range.rangeType===i.RANGE_TYPE.ROW),S=R?i.RANGE_TYPE.ALL:C.some(({range:N})=>{const{startRow:V,endRow:W}=N;return V<=d&&d<=W})?i.RANGE_TYPE.ROW:i.RANGE_TYPE.NORMAL;let I;if(S===i.RANGE_TYPE.ALL){const N=a.getColumnCount(),V=new Array(a.getRowCount()).fill(void 0).map((W,L)=>({startRow:L,endRow:L,startColumn:0,endColumn:N-1}));I={subUnitId:l,unitId:u,rowHeight:m,ranges:V}}else S===i.RANGE_TYPE.ROW?I={subUnitId:l,unitId:u,ranges:C.map(N=>i.Rectangle.clone(N.range)),rowHeight:m}:I={subUnitId:l,unitId:u,rowHeight:m,ranges:[{startRow:d,endRow:d,startColumn:0,endColumn:a.getMaxColumns()-1}]};const v=yo(I,a),M={unitId:u,subUnitId:l,ranges:I.ranges,autoHeightInfo:i.BooleanNumber.FALSE},p=zn(M,a),w=s.get(i.ICommandService),y=s.get(i.IUndoRedoService),b=o.onCommandExecute({id:Xt.id,params:I}),U=i.sequenceExecute([{id:Te.id,params:I},{id:Ce.id,params:M}],w),k=i.sequenceExecute([...b.redos],w);if(U.result&&k.result){const N=o.afterCommandExecute({id:Xt.id,params:I});return i.sequenceExecute(N.redos,w),y.pushUndoRedo({unitID:u,undoMutations:[...(T=b.preUndos)!=null?T:[],{id:Te.id,params:v},{id:Ce.id,params:p},...b.undos,...N.undos],redoMutations:[...(E=b.preRedos)!=null?E:[],{id:Te.id,params:I},{id:Ce.id,params:M},...b.redos,...N.redos]}),!0}return!1}},Zt={type:i.CommandType.COMMAND,id:"sheet.command.set-row-height",handler:(s,e)=>{var p,w,y,b;const t=s.get(g.SheetsSelectionsService),n=s.get(i.ICommandService),o=s.get(i.IUndoRedoService),r=s.get(i.IUniverInstanceService),a=s.get(g.SheetInterceptorService),l=(p=e==null?void 0:e.ranges)!=null&&p.length?e.ranges:(w=t.getCurrentSelections())==null?void 0:w.map(U=>U.range);if(!(l!=null&&l.length))return!1;const u=P(r,e);if(!u)return!1;const{unitId:d,subUnitId:c,worksheet:h}=u,m={subUnitId:c,unitId:d,ranges:l,rowHeight:e.value},R=yo(m,h),C={unitId:d,subUnitId:c,ranges:m.ranges,autoHeightInfo:i.BooleanNumber.FALSE},S=zn(C,h),I=i.sequenceExecute([{id:Te.id,params:m},{id:Ce.id,params:C}],n),v=a.onCommandExecute({id:Zt.id,params:m}),M=i.sequenceExecute([...v.redos],n);if(I.result&&M.result){const U=a.afterCommandExecute({id:Zt.id,params:m});return i.sequenceExecute(U.redos,n),o.pushUndoRedo({unitID:d,undoMutations:[...(y=v.preRedos)!=null?y:[],{id:Te.id,params:R},{id:Ce.id,params:S},...v.undos,...U.undos],redoMutations:[...(b=v.preRedos)!=null?b:[],{id:Te.id,params:m},{id:Ce.id,params:C},...v.redos,...U.redos]}),!0}return!1}},kn={type:i.CommandType.COMMAND,id:"sheet.command.set-row-is-auto-height",handler:(s,e)=>{var U,k;const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),o=s.get(g.SheetsSelectionsService),r=s.get(i.IUniverInstanceService),a=P(r,e);if(!a)return!1;const{unitId:l,subUnitId:u,worksheet:d}=a,c=(U=e==null?void 0:e.ranges)!=null&&U.length?e.ranges:(k=o.getCurrentSelections())==null?void 0:k.map(T=>T.range);if(!(c!=null&&c.length))return!1;const h={unitId:l,subUnitId:u,ranges:c,autoHeightInfo:i.BooleanNumber.TRUE},m=zn(h,d),R=t.syncExecuteCommand(Ce.id,h),C=s.get(g.SheetSkeletonService).getSkeleton(l,u),{suitableRanges:S,remainingRanges:I}=jt(h.ranges,C),v=s.get(g.SheetInterceptorService),{undos:M,redos:p}=v.generateMutationsOfAutoHeight({unitId:l,subUnitId:u,ranges:S,autoHeightRanges:S,lazyAutoHeightRanges:I}),{undos:w,redos:y}=v.onCommandExecute({id:kn.id,params:h}),b=i.sequenceExecute([...y,...p],t);return R&&b.result?(n.pushUndoRedo({unitID:l,undoMutations:[{id:Ce.id,params:m},...w,...M],redoMutations:[{id:Ce.id,params:h},...y,...p]}),!0):!1}},Xs={type:i.CommandType.COMMAND,id:"sheet.command.set-worksheet-show",handler:(s,e)=>{const t=P(s.get(i.IUniverInstanceService),e);if(!t)return!1;const{unitId:n,subUnitId:o,worksheet:r}=t;if(r.getConfig().hidden===i.BooleanNumber.FALSE)return!1;const l=s.get(i.ICommandService),u=s.get(i.IUndoRedoService),d={unitId:n,subUnitId:o,hidden:i.BooleanNumber.FALSE},c=pi(s,d),h=l.syncExecuteCommand(De.id,d),m={unitId:n,subUnitId:o},R=l.syncExecuteCommand(Ze.id,m);return h&&R?(u.pushUndoRedo({unitID:n,undoMutations:[{id:De.id,params:c}],redoMutations:[{id:De.id,params:d}]}),!0):!1}},Ei={type:i.CommandType.COMMAND,id:"sheet.command.split-text-to-columns",handler:(s,e)=>{const t=P(s.get(i.IUniverInstanceService),e);if(!t)return!1;const{unitId:n,subUnitId:o,worksheet:r}=t,{range:a,delimiter:l,customDelimiter:u,treatMultipleDelimitersAsOne:d}=e,{lastRow:c,rs:h,maxLength:m}=Oo(r,a,l,u,d),R=r.getColumnCount(),{startColumn:C}=i.Range.transformRange(a,r);if(a.startColumn!==a.endColumn)return!1;const S=s.get(i.ICommandService),I=s.get(i.IUndoRedoService),v=[],M=[],p=C+m+1-R;if(p>0){const T={unitId:n,subUnitId:o,range:{startRow:0,endRow:r.getRowCount()-1,startColumn:R-1,endColumn:R-1+p}};v.push({id:ae.id,params:T});const E=At(s,T);M.push({id:se.id,params:E})}const w={startRow:a.startRow,endRow:c,startColumn:C,endColumn:C+m},y=new i.ObjectMatrix;for(let T=w.startRow;T<=w.endRow;T++)for(let E=w.startColumn;E<=w.endColumn;E++){const N=h[T-w.startRow];E===0&&(N==null?void 0:N.length)===1?y.setValue(T,E,r.getCell(T,E)):y.setValue(T,E,{v:(N==null?void 0:N[E-w.startColumn])||null,p:null,f:null,si:null,custom:null})}const b={unitId:n,subUnitId:o,cellValue:y.clone()},U=he(s,b);return v.push({id:F.id,params:b}),M.unshift({id:F.id,params:U}),i.sequenceExecute(v,S).result?(I.pushUndoRedo({unitID:n,undoMutations:M,redoMutations:v}),!0):!1}},Ti={id:"sheet.command.toggle-cell-checkbox",type:i.CommandType.COMMAND,handler:(s,e)=>{if(!e)return!1;const{unitId:t,subUnitId:n,row:o,col:r,paragraphIndex:a}=e,u=s.get(i.IUniverInstanceService).getUnit(t,i.UniverInstanceType.UNIVER_SHEET),d=u==null?void 0:u.getSheetBySheetId(n),c=s.get(i.IUndoRedoService),h=s.get(i.ICommandService);if(!d)return!1;const m=d.getCell(o,r);if(!(m!=null&&m.p))return!1;const R=i.Tools.deepClone(m.p),C=new i.DocumentDataModel(R),S=i.BuildTextUtils.paragraph.bullet.toggleChecklist({document:C,paragraphIndex:a});if(!S)return!1;i.TextX.apply(C.getBody(),S.serialize());const I={unitId:t,subUnitId:n,cellValue:{[o]:{[r]:{p:R,t:i.CellValueType.STRING}}}},v={id:F.id,params:I},M=he(s,I),p={id:F.id,params:M},w=[v],y=[p];return c.pushUndoRedo({redoMutations:w,undoMutations:y,unitID:t}),h.syncExecuteCommand(v.id,v.params)}},Ui={type:i.CommandType.COMMAND,id:"sheet.command.toggle-gridlines",handler:(s,e)=>{const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),o=P(s.get(i.IUniverInstanceService),e);if(!o)return!1;const{worksheet:r}=o,a=r.getConfig().showGridlines;if(a===(e==null?void 0:e.showGridlines))return!1;const{unitId:l,subUnitId:u}=o,d={showGridlines:a===i.BooleanNumber.TRUE?i.BooleanNumber.FALSE:i.BooleanNumber.TRUE,unitId:l,subUnitId:u},c={showGridlines:a,unitId:l,subUnitId:u};return t.syncExecuteCommand(vt.id,d)?(n.pushUndoRedo({unitID:l,undoMutations:[{id:vt.id,params:c}],redoMutations:[{id:vt.id,params:d}]}),!0):!1}},ki={id:"sheet.command.unregister-worksheet-range-theme-style",type:i.CommandType.COMMAND,handler:(s,e)=>{var h;if(!e||!P(s.get(i.IUniverInstanceService),e))return!1;const n=s.get(i.ICommandService),o=s.get(i.IUndoRedoService),r=s.get(g.SheetRangeThemeModel),{unitId:a,themeName:l}=e,u={unitId:a,themeName:l},d={unitId:a,themeName:l,rangeThemeStyleJson:(h=r.getRangeThemeStyle(a,l))==null?void 0:h.toJson()};return n.syncExecuteCommand(Tt.id,e)?(o.pushUndoRedo({unitID:a,undoMutations:[{id:Tt.id,params:d}],redoMutations:[{id:pn.id,params:u}]}),!0):!1}},Pi={id:"sheet.mutation.add-range-theme",type:i.CommandType.MUTATION,handler:(s,e)=>{if(!e)return!1;const{styleJSON:t,unitId:n}=e,o=s.get(g.SheetRangeThemeModel),r=new Le(t.name);return r.fromJson(t),o.registerRangeThemeStyle(n,r),!0}},Ni={id:"sheet.mutation.empty",type:i.CommandType.MUTATION,handler:()=>!0},Oi={id:"sheet.operation.mark-dirty-row-auto-height",type:i.CommandType.OPERATION,handler:()=>!0},Di={id:"sheet.operation.cancel-mark-dirty-row-auto-height",type:i.CommandType.OPERATION,handler:()=>!0},ut=i.createIdentifier("INumfmtService"),ed=(s,e)=>{const t=s.get(ut),{values:n,unitId:o,subUnitId:r}=e,a=[],l=[];Object.keys(n).forEach(d=>{n[d].ranges.forEach(h=>{i.Range.foreach(h,(m,R)=>{const C=t.getValue(o,r,m,R);C?a.push({pattern:C.pattern,row:m,col:R}):l.push({startColumn:R,endColumn:R,startRow:m,endRow:m})})})});const u=[];if(a.length){const d=Nn(o,r,a);Object.keys(d.values).forEach(c=>{const h=d.values[c];h.ranges=xn(h.ranges)}),u.push({id:Pn.id,params:Nn(o,r,a)})}return l.length&&u.push({id:Zs.id,params:{unitId:o,subUnitId:r,ranges:l}}),u},Pn={id:"sheet.mutation.set.numfmt",type:i.CommandType.MUTATION,handler:(s,e)=>{if(!e)return!1;const{values:t,refMap:n}=e,o=s.get(ut),r=e.unitId,a=e.subUnitId,l=Object.keys(t).reduce((u,d)=>{const c=n[d],h=t[d].ranges;return c&&u.push({...c,ranges:h}),u},[]);return o.setValues(r,a,l),!0}},Zs={id:"sheet.mutation.remove.numfmt",type:i.CommandType.MUTATION,handler:(s,e)=>{if(!e)return!1;const{unitId:t,subUnitId:n,ranges:o}=e;return s.get(ut).deleteValues(t,n,o),!0}},td=(s,e)=>{const t=s.get(ut),{ranges:n,unitId:o,subUnitId:r}=e,a=[];if(n.forEach(u=>{i.Range.foreach(u,(d,c)=>{const h=t.getValue(o,r,d,c);h&&a.push({pattern:h.pattern,row:d,col:c})})}),!a.length)return[];const l=Nn(o,r,a);return Object.keys(l.values).forEach(u=>{const d=l.values[u];d.ranges=xn(d.ranges)}),[{id:Pn.id,params:l}]},Nn=(s,e,t)=>{const n=dl(t,"pattern"),o={},r={},a=cl();return Object.keys(n).forEach(l=>{const u=n[l],d=a();o[d]={pattern:l},u.forEach(c=>{r[d]||(r[d]={ranges:[]}),r[d].ranges.push(i.cellToRange(c.row,c.col))})}),{unitId:s,subUnitId:e,refMap:o,values:r}},Ai={id:"sheet.mutation.remove-range-theme",type:i.CommandType.MUTATION,handler:(s,e)=>{if(!e)return!1;const{styleName:t,unitId:n}=e;return s.get(g.SheetRangeThemeModel).unregisterRangeThemeStyle(n,t),!0}},Wi={id:"sheet.mutation.set-range-theme",type:i.CommandType.MUTATION,handler:(s,e)=>{if(!e)return!1;const{unitId:t,styleName:n,style:o}=e,a=s.get(g.SheetRangeThemeModel).getRangeThemeStyle(t,n);return a&&(o.headerRowStyle&&a.setHeaderRowStyle(o.headerRowStyle),o.firstRowStyle&&a.setFirstRowStyle(o.firstRowStyle),o.secondRowStyle&&a.setSecondRowStyle(o.secondRowStyle),o.lastRowStyle&&a.setLastRowStyle(o.lastRowStyle)),!0}},Vi={id:"sheet.operation.scroll-to-cell",type:i.CommandType.OPERATION,handler:()=>!0},Li="maxCellsPerSheet",nd=3e6;var sd=Object.getOwnPropertyDescriptor,od=(s,e,t,n)=>{for(var o=n>1?void 0:n?sd(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},$i=(s,e)=>(t,n)=>e(t,n,s);const rd="SHEET_DEFINED_NAME_PLUGIN",id="AllDefaultWorkbook";g.DefinedNameDataController=class extends i.Disposable{constructor(e,t){super(),this._definedNamesService=e,this._resourceManagerService=t,this._initialize()}_initialize(){this._initSnapshot()}_initSnapshot(){const e=n=>{const o=this._definedNamesService.getDefinedNameMap(n);return o?JSON.stringify(o):""},t=n=>{if(!n)return{};try{return JSON.parse(n)}catch{return{}}};this.disposeWithMe(this._resourceManagerService.registerPluginResource({pluginName:rd,businesses:[i.UniverInstanceType.UNIVER_SHEET],toJson:n=>e(n),parseJson:n=>t(n),onUnLoad:n=>{this._definedNamesService.removeUnitDefinedName(n)},onLoad:(n,o)=>{this._definedNamesService.registerDefinedNames(n,o)}}))}},g.DefinedNameDataController=od([$i(0,K.IDefinedNamesService),$i(1,i.IResourceManagerService)],g.DefinedNameDataController);var ad=Object.getOwnPropertyDescriptor,ld=(s,e,t,n)=>{for(var o=n>1?void 0:n?ad(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},Qs=(s,e)=>(t,n)=>e(t,n,s);const ud=[Oe.id],dd=[ie.id,ae.id,le.id,se.id,we.id,Me.id];g.SheetsFreezeSyncController=class extends i.Disposable{constructor(t,n,o){var a,l;super();f(this,"_d",new i.DisposableCollection);f(this,"_enabled",!0);this._univerInstanceService=t,this._commandService=n,this._configService=o;const r=(l=(a=this._configService.getConfig(zt))==null?void 0:a.freezeSync)!=null?l:!0;this.setEnabled(r)}getEnabled(){return this._enabled}setEnabled(t){t?this._d.dispose():this._initOnlyLocalListener(),this._enabled=t}_initOnlyLocalListener(){this._d.add(this._commandService.beforeCommandExecuted((t,n)=>{ud.includes(t.id)&&(n||(n={}),n.onlyLocal=!0)})),this._d.add(this._commandService.onCommandExecuted((t,n)=>{if(dd.includes(t.id)&&(n!=null&&n.fromCollab)){const{id:o,params:r}=t;o===ie.id?this._handleInsertRowMutation(r,n):o===ae.id?this._handleInsertColMutation(r,n):o===le.id?this._handleRemoveRowMutation(r,n):o===se.id?this._handleRemoveColMutation(r,n):o===we.id?this._handleMoveRowsMutation(r,n):o===Me.id&&this._handleMoveColsMutation(r,n)}}))}_handleInsertRowMutation(t,n){const{range:o,unitId:r,subUnitId:a}=t,l=this._getFreeze(r,a);if(l&&o.startRow<l.startRow){const u=o.endRow-o.startRow+1,d={...l,startRow:Math.max(1,l.startRow+u),ySplit:Math.max(1,l.ySplit+u)};this._sequenceExecute(r,a,d,n)}}_handleInsertColMutation(t,n){const{range:o,unitId:r,subUnitId:a}=t,l=this._getFreeze(r,a);if(l&&o.startColumn<l.startColumn){const u=o.endColumn-o.startColumn+1,d={...l,startColumn:Math.max(1,l.startColumn+u),xSplit:Math.max(1,l.xSplit+u)};this._sequenceExecute(r,a,d,n)}}_handleRemoveRowMutation(t,n){const{range:o,unitId:r,subUnitId:a}=t,l=this._getFreeze(r,a);if(l&&o.startRow<l.startRow){const u=Math.min(l.startRow,o.endRow+1)-o.startRow,d={...l,startRow:Math.max(1,l.startRow-u),ySplit:Math.max(1,l.ySplit-u)};this._sequenceExecute(r,a,d,n)}}_handleRemoveColMutation(t,n){const{range:o,unitId:r,subUnitId:a}=t,l=this._getFreeze(r,a);if(l&&o.startColumn<l.startColumn){const u=Math.min(l.startColumn,o.endColumn+1)-o.startColumn,d={...l,startColumn:Math.max(1,l.startColumn-u),xSplit:Math.max(1,l.xSplit-u)};this._sequenceExecute(r,a,d,n)}}_handleMoveRowsMutation(t,n){const{sourceRange:o,targetRange:r,unitId:a,subUnitId:l}=t,u=this._getFreeze(a,l);if(!u||u.startRow<=0||o.startRow>=u.startRow&&r.startRow>=u.startRow||o.endRow<u.startRow&&r.endRow<u.startRow)return;const d=o.endRow-o.startRow+1,c=Math.max(Math.min(u.startRow,o.endRow+1)-o.startRow,0),h={...u};r.startRow>=u.startRow?(h.startRow=Math.max(1,u.startRow-c),h.ySplit=Math.max(1,u.ySplit-c)):(h.startRow=u.startRow+d-c,h.ySplit=u.ySplit+d-c),this._sequenceExecute(a,l,h,n)}_handleMoveColsMutation(t,n){const{sourceRange:o,targetRange:r,unitId:a,subUnitId:l}=t,u=this._getFreeze(a,l);if(!u||u.startColumn<=0||o.startColumn>=u.startColumn&&r.startColumn>=u.startColumn||o.endColumn<u.startColumn&&r.endColumn<u.startColumn)return;const d=o.endColumn-o.startColumn+1,c=Math.max(Math.min(u.startColumn,o.endColumn+1)-o.startColumn,0),h={...u};r.startColumn>=u.startColumn?(h.startColumn=Math.max(1,u.startColumn-c),h.xSplit=Math.max(1,u.xSplit-c)):(h.startColumn=u.startColumn+d-c,h.xSplit=u.xSplit+d-c),this._sequenceExecute(a,l,h,n)}_getFreeze(t,n){const o=this._univerInstanceService.getUnit(t,i.UniverInstanceType.UNIVER_SHEET);if(!o)return null;const r=o.getSheetBySheetId(n);return r?r.getFreeze():null}_sequenceExecute(t,n,o,r){i.sequenceExecute([{id:Oe.id,params:{...o,unitId:t,subUnitId:n,resetScroll:!1}}],this._commandService,r)}},g.SheetsFreezeSyncController=ld([Qs(0,i.Inject(i.IUniverInstanceService)),Qs(1,i.ICommandService),Qs(2,i.IConfigService)],g.SheetsFreezeSyncController);var cd=Object.getOwnPropertyDescriptor,hd=(s,e,t,n)=>{for(var o=n>1?void 0:n?cd(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},Ae=(s,e)=>(t,n)=>e(t,n,s);g.SheetPermissionCheckController=class extends i.Disposable{constructor(t,n,o,r,a,l,u,d,c,h){super();f(this,"disposableCollection",new i.DisposableCollection);f(this,"_triggerPermissionUIEvent$",new O.Subject);f(this,"triggerPermissionUIEvent$",this._triggerPermissionUIEvent$.asObservable());this._commandService=t,this._univerInstanceService=n,this._permissionService=o,this._selectionManagerService=r,this._rangeProtectionRuleModel=a,this._worksheetProtectionRuleModel=l,this._localeService=u,this._lexerTreeBuilder=d,this._contextService=c,this._definedNamesService=h,this._initialize()}blockExecuteWithoutPermission(t){throw this._triggerPermissionUIEvent$.next(t),new i.CustomCommandExecutionError("have no permission")}_getPermissionCheck(t,n){let o=!0,r="";switch(t){case Mt.id:i.isICellData(n.value)&&n.value.f?(o=this._permissionCheckWithFormula(n),r=this._localeService.t("permission.dialog.formulaErr")):o=this._permissionCheckBySetRangeValue({workbookTypes:[me],rangeTypes:[fe],worksheetTypes:[$t,Ie]},n);break;case vn.id:o=this.permissionCheckWithRanges({workbookTypes:[me],rangeTypes:[fe],worksheetTypes:[$t,Ie]},n==null?void 0:n.ranges,n==null?void 0:n.unitId,n==null?void 0:n.subUnitId),r=this._localeService.t("permission.dialog.editErr");break;case Yt.id:case xt.id:o=this.permissionCheckWithoutRange({worksheetTypes:[pt]}),r=this._localeService.t("permission.dialog.setRowColStyleErr");break;case Xt.id:case Zt.id:case kn.id:o=this.permissionCheckWithoutRange({worksheetTypes:[wt]}),r=this._localeService.t("permission.dialog.setRowColStyleErr");break;case bt.id:case _t.id:o=this._permissionCheckByMoveCommand(n),r=this._localeService.t("permission.dialog.moveRowColErr");break;case Qe.id:o=this._permissionCheckByMoveRangeCommand(n),r=this._localeService.t("permission.dialog.moveRangeErr");break;case xs.id:o=this._permissionCheckByWorksheetCommand([me,mn]),r=this._localeService.t("permission.dialog.operatorSheetErr"),o===!1&&this._worksheetProtectionRuleModel.resetOrder();break;case bn.id:o=this._permissionCheckByWorksheetCommand([me,gn]),r=this._localeService.t("permission.dialog.operatorSheetErr"),o===!1&&this._worksheetProtectionRuleModel.resetOrder();break;case Xs.id:{const{unitId:a,subUnitId:l}=n;o=this._permissionCheckByWorksheetCommand([me,cn],a,l),r=this._localeService.t("permission.dialog.operatorSheetErr"),o===!1&&this._worksheetProtectionRuleModel.resetOrder()}break;case kt.id:o=this.permissionCheckWithRanges({workbookTypes:[me],rangeTypes:[fe],worksheetTypes:[Ie,pt]},n.ranges,n.unitId,n.subUnitId),r=this._localeService.t("permission.dialog.setRowColStyleErr");break;case Pt.id:o=this.permissionCheckWithRanges({workbookTypes:[me],rangeTypes:[fe],worksheetTypes:[Ie,wt]},n.ranges,n.unitId,n.subUnitId),r=this._localeService.t("permission.dialog.setRowColStyleErr");break;case Hs.id:o=this.permissionCheckWithRanges({workbookTypes:[me],rangeTypes:[fe],worksheetTypes:[Ie,pt]}),r=this._localeService.t("permission.dialog.setRowColStyleErr");break;case Gs.id:o=this.permissionCheckWithRanges({workbookTypes:[me],rangeTypes:[fe],worksheetTypes:[Ie,wt]}),r=this._localeService.t("permission.dialog.setRowColStyleErr");break;case yt.id:o=this._permissionCheckWithInsertRangeMove("right"),r=this._localeService.t("permission.dialog.insertOrDeleteMoveRangeErr");break;case et.id:o=this._permissionCheckWithInsertRangeMove("bottom"),r=this._localeService.t("permission.dialog.insertOrDeleteMoveRangeErr");break;case Ge.id:o=this._permissionCheckWithInsertRangeMove("left"),r=this._localeService.t("permission.dialog.insertOrDeleteMoveRangeErr");break;case ze.id:o=this._permissionCheckWithInsertRangeMove("top"),r=this._localeService.t("permission.dialog.insertOrDeleteMoveRangeErr");break}o||this.blockExecuteWithoutPermission(r)}_initialize(){this._commandExecutedListener()}_commandExecutedListener(){this.disposeWithMe(this._commandService.beforeCommandExecuted(t=>{this._getPermissionCheck(t.id,t==null?void 0:t.params)})),this.disposeWithMe(this._commandService.onCommandExecuted(t=>{var n;if(t.id===Kt.id){const o=t.params,{unitId:r=(n=this._univerInstanceService.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET))==null?void 0:n.getUnitId(),subUnitId:a}=o;if(!r||!a)return;const l=this._worksheetProtectionRuleModel.getRule(r,a),u=this._rangeProtectionRuleModel.getSubunitRuleList(r,a);l&&this._worksheetProtectionRuleModel.ruleRefresh(l.permissionId),u.length&&this._rangeProtectionRuleModel.ruleRefresh(a)}}))}_permissionCheckWithInsertRangeMove(t){var c;const n=P(this._univerInstanceService);if(!n)return!1;const{worksheet:o,unitId:r,subUnitId:a}=n,l=i.Tools.deepClone((c=this._selectionManagerService.getCurrentLastSelection())==null?void 0:c.range);return!(!l||(t==="top"||t==="bottom"?l.endRow=o.getRowCount()-1:(t==="left"||t==="right")&&(l.endColumn=o.getColumnCount()-1),this._rangeProtectionRuleModel.getSubunitRuleList(r,a).map(h=>h.ranges).flat().some(h=>i.Rectangle.getIntersects(l,h))))}_permissionCheckByWorksheetCommand(t,n,o){var c,h;const r=P(this._univerInstanceService,{unitId:n,subUnitId:o});if(!r)return!1;const{unitId:a,subUnitId:l}=r,u=this._worksheetProtectionRuleModel.getRule(a,l),d=this._rangeProtectionRuleModel.getSubunitRuleList(a,l).length>0;return u||d?(h=(c=this._permissionService.getPermissionPoint(new hn(a).id))==null?void 0:c.value)!=null?h:!1:this._permissionService.composePermission(t.map(m=>new m(a).id)).every(m=>m.value)}permissionCheckWithoutRange(t){var R,C,S,I;const n=P(this._univerInstanceService);if(!n)return!1;const{worksheet:o,unitId:r,subUnitId:a}=n,l=this._selectionManagerService.getCurrentLastSelection();if(!l)return!0;const u=(C=(R=l==null?void 0:l.primary)==null?void 0:R.actualRow)!=null?C:0,d=(I=(S=l==null?void 0:l.primary)==null?void 0:S.actualColumn)!=null?I:0,{workbookTypes:c,worksheetTypes:h,rangeTypes:m}=t;return!(c&&c.some(M=>{var y,b;const p=new M(r);return((b=(y=this._permissionService.getPermissionPoint(p.id))==null?void 0:y.value)!=null?b:!1)===!1})===!0||h&&h.some(M=>{var y,b;const p=new M(r,a);return((b=(y=this._permissionService.getPermissionPoint(p.id))==null?void 0:y.value)!=null?b:!1)===!1})===!0||m&&m.some(M=>{var U,k,T,E,N;const p=(k=(U=o.getCell(u,d))==null?void 0:U.selectionProtection)==null?void 0:k[0];if(!(p!=null&&p.ruleId))return!1;const w=(T=this._rangeProtectionRuleModel.getRule(r,a,p.ruleId))==null?void 0:T.permissionId;if(!w)return!1;const y=new M(r,a,w);return((N=(E=this._permissionService.getPermissionPoint(y.id))==null?void 0:E.value)!=null?N:!1)===!1})===!0)}permissionCheckWithRanges(t,n,o,r){var C;const a=P(this._univerInstanceService,{unitId:o,subUnitId:r});if(!a)return!1;const l=n!=null?n:(C=this._selectionManagerService.getCurrentSelections())==null?void 0:C.map(S=>S.range);if(!l)return!1;const{unitId:u,subUnitId:d}=a,{workbookTypes:c,worksheetTypes:h,rangeTypes:m}=t,R=[];return c&&R.push(...c.map(S=>new S(u).id)),h&&R.push(...h.map(S=>new S(u,d).id)),m&&this._rangeProtectionRuleModel.getSubunitRuleList(u,d).forEach(S=>{l.some(v=>S.ranges.some(M=>i.Rectangle.intersects(M,v)))&&R.push(...m.map(v=>new v(u,d,S.permissionId).id))}),R.length?this._permissionService.composePermission(R).every(S=>S.value):!0}_permissionCheckByMoveCommand(t){const n=P(this._univerInstanceService,t);if(!n)return!1;const{worksheet:o,unitId:r,subUnitId:a}=n,l=t.toRange;l.endRow===o.getRowCount()-1?l.endColumn=l.startColumn:l.endRow=l.startRow;const u=this._rangeProtectionRuleModel.getSubunitRuleList(r,a).reduce((d,c)=>[...d,...c.ranges],[]).filter(d=>i.Rectangle.intersects(d,l));return u.length>0?!1:(u.forEach(d=>{var c,h;for(let m=d.startRow;m<=d.endRow;m++)for(let R=d.startColumn;R<=d.endColumn;R++){const C=(h=(c=o.getCell(m,R))==null?void 0:c.selectionProtection)==null?void 0:h[0];if((C==null?void 0:C[_.Edit])===!1)return!1}}),!0)}_permissionCheckByMoveRangeCommand(t){const n=P(this._univerInstanceService);if(!n)return!1;const{worksheet:o,unitId:r,subUnitId:a}=n,l=t.toRange,u=this._rangeProtectionRuleModel.getSubunitRuleList(r,a).reduce((d,c)=>[...d,...c.ranges],[]).filter(d=>i.Rectangle.intersects(d,l));return u.length>0?!1:(u.forEach(d=>{var c,h;for(let m=d.startRow;m<=d.endRow;m++)for(let R=d.startColumn;R<=d.endColumn;R++){const C=(h=(c=o.getCell(m,R))==null?void 0:c.selectionProtection)==null?void 0:h[0];if((C==null?void 0:C[_.Edit])===!1)return!1}}),!0)}_permissionCheckBySetRangeValue(t,n){let o=[];n.range?o=[n.range]:o=[new i.ObjectMatrix(n.value).getDataRange()];const{unitId:r,subUnitId:a}=n;return this.permissionCheckWithRanges(t,o,r,a)}_permissionCheckWithFormula(t){var a,l,u,d,c;const n=t.value,o=t.range,r=n.f;if(r){const h=r.substring(1),m=this._univerInstanceService.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET),R=(a=t.unitId)!=null?a:m.getUnitId(),C=this._definedNamesService.getValueByName(R,h);if(C){let S=C.formulaOrRefString;S.startsWith(K.operatorToken.EQUALS)&&(S=S.slice(1));const I=S.split(",");for(let v=0;v<I.length;v++){const M=I[v],p=K.deserializeRangeWithSheet(M);if(p.sheetName){const w=m.getSheetBySheetName(p.sheetName);if(!w)return!0;const{startRow:y,endRow:b,startColumn:U,endColumn:k}=p.range;for(let T=y;T<=b;T++)for(let E=U;E<=k;E++){const N=(u=(l=w.getCell(T,E))==null?void 0:l.selectionProtection)==null?void 0:u[0];if((N==null?void 0:N[_.View])===!1)return!1}}}return!0}else{const S=this._lexerTreeBuilder.sequenceNodesBuilder(r);if(!S)return!0;for(let I=0;I<S.length;I++){const v=S[I];if(typeof v=="string"||v.nodeType!==K.sequenceNodeType.REFERENCE)continue;const{token:M}=v,p=K.deserializeRangeWithSheetWithCache(M),w=p.unitId?this._univerInstanceService.getUnit(p.unitId):this._univerInstanceService.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET);if(!w)return!0;let y=p.sheetName?w.getSheetBySheetName(p.sheetName):w.getActiveSheet();const b=w.getUnitId();if(p.sheetName){if(y=w.getSheetBySheetName(p.sheetName),!y)return!0;const N=y==null?void 0:y.getSheetId();if(!this._permissionService.getPermissionPoint(new Bt(b,N).id))return!1}if(!y)return!0;const{startRow:U,endRow:k,startColumn:T,endColumn:E}=p.range;for(let N=U;N<=k;N++)for(let V=T;V<=E;V++){const W=(c=(d=y.getCell(N,V))==null?void 0:d.selectionProtection)==null?void 0:c[0];if((W==null?void 0:W[_.View])===!1)return!1}}return!0}}if(o){const h=P(this._univerInstanceService,t);if(!h)return!1;const{unitId:m,subUnitId:R}=h,S=this._rangeProtectionRuleModel.getSubunitRuleList(m,R).filter(v=>v.ranges.some(M=>i.Rectangle.intersects(M,o))).map(v=>new fe(m,R,v.permissionId).id);if(!this._permissionService.composePermission(S).every(v=>v.value))return!1}return!0}},g.SheetPermissionCheckController=hd([Ae(0,i.ICommandService),Ae(1,i.IUniverInstanceService),Ae(2,i.IPermissionService),Ae(3,i.Inject(g.SheetsSelectionsService)),Ae(4,i.Inject(X)),Ae(5,i.Inject(Ne)),Ae(6,i.Inject(i.LocaleService)),Ae(7,i.Inject(K.LexerTreeBuilder)),Ae(8,i.IContextService),Ae(9,K.IDefinedNamesService)],g.SheetPermissionCheckController);var md=Object.getOwnPropertyDescriptor,gd=(s,e,t,n)=>{for(var o=n>1?void 0:n?md(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},Qt=(s,e)=>(t,n)=>e(t,n,s);g.WorkbookPermissionService=class extends i.Disposable{constructor(t,n,o,r,a){super();f(this,"_unitPermissionInitStateChange",new O.BehaviorSubject(!1));f(this,"unitPermissionInitStateChange$",this._unitPermissionInitStateChange.asObservable());this._permissionService=t,this._univerInstanceService=n,this._rangeProtectionRuleModel=o,this._worksheetProtectionRuleModel=r,this._worksheetProtectionPointModel=a,this._init()}_init(){const t=n=>{const o=n.getUnitId();Ot().forEach(r=>{const a=new r(o);this._permissionService.addPermissionPoint(a)})};this._univerInstanceService.getAllUnitsForType(i.UniverInstanceType.UNIVER_SHEET).forEach(n=>{t(n)}),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitAdded$(i.UniverInstanceType.UNIVER_SHEET).subscribe(n=>{t(n)})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitDisposed$(i.UniverInstanceType.UNIVER_SHEET).subscribe(n=>{const o=n.getUnitId();n.getSheets().forEach(r=>{const a=r.getSheetId();this._rangeProtectionRuleModel.getSubunitRuleList(o,a).forEach(u=>{[...de()].forEach(d=>{const c=new d(o,a,u.permissionId);this._permissionService.deletePermissionPoint(c.id)})}),[...ce(),...pe()].forEach(u=>{const d=new u(o,a);this._permissionService.deletePermissionPoint(d.id)})}),Ot().forEach(r=>{const a=new r(o);this._permissionService.deletePermissionPoint(a.id)}),this._rangeProtectionRuleModel.deleteUnitModel(o),this._worksheetProtectionPointModel.deleteUnitModel(o),this._worksheetProtectionRuleModel.deleteUnitModel(o)}))}changeUnitInitState(t){this._unitPermissionInitStateChange.next(t)}},g.WorkbookPermissionService=gd([Qt(0,i.Inject(i.IPermissionService)),Qt(1,i.Inject(i.IUniverInstanceService)),Qt(2,i.Inject(X)),Qt(3,i.Inject(Ne)),Qt(4,i.Inject(Nt))],g.WorkbookPermissionService);var Rd=Object.getOwnPropertyDescriptor,Cd=(s,e,t,n)=>{for(var o=n>1?void 0:n?Rd(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},We=(s,e)=>(t,n)=>e(t,n,s);g.SheetPermissionInitController=class extends i.Disposable{constructor(e,t,n,o,r,a,l,u,d,c){super(),this._univerInstanceService=e,this._permissionService=t,this._authzIoService=n,this._rangeProtectionRuleModel=o,this._worksheetProtectionRuleModel=r,this._userManagerService=a,this._worksheetProtectionPointRuleModel=l,this._workbookPermissionService=u,this._undoRedoService=d,this._commandService=c}initPermission(){this._initRangePermissionFromSnapshot(),this._initRangePermissionChange(),this._initWorksheetPermissionFromSnapshot(),this._initWorksheetPermissionChange(),this._initWorksheetPermissionPointsChange(),this._initWorkbookPermissionFromSnapshot(),this._initUserChange(),this._refreshPermissionByCollaCreate()}refreshRangeProtectPermission(){this._initRangePermissionFromSnapshot()}async _initRangePermissionFromSnapshot(){const e=async t=>{const n=[],o=t.getUnitId(),r=t.getSheets(),a=new Map;if(r.forEach(l=>{const u=l.getSheetId();this._rangeProtectionRuleModel.getSubunitRuleList(o,u).forEach(d=>{a.set(d.permissionId,d),n.push({objectID:d.permissionId,unitID:o,objectType:D.SelectRange,actions:Ye})})}),!n.length){this._rangeProtectionRuleModel.changeRuleInitState(!0);return}this._authzIoService.batchAllowed(n).then(l=>{l.forEach(u=>{const d=a.get(u.objectID);if(d){if(!this._rangeProtectionRuleModel.getRule(o,d.subUnitId,d.id))return;de().forEach(h=>{const m=new h(o,d.subUnitId,u.objectID),R=m.subType,C=u.actions.find(S=>S.action===R);(C==null?void 0:C.allowed)!==void 0&&this._permissionService.updatePermissionPoint(m.id,C.allowed)})}}),this._rangeProtectionRuleModel.changeRuleInitState(!0)})};await Promise.all(this._univerInstanceService.getAllUnitsForType(i.UniverInstanceType.UNIVER_SHEET).map(t=>e(t))),this._rangeProtectionRuleModel.changeRuleInitState(!0)}_initRangePermissionChange(){this.disposeWithMe(this._rangeProtectionRuleModel.ruleChange$.subscribe(e=>{e.type!=="delete"?this._authzIoService.allowed({objectID:e.rule.permissionId,unitID:e.unitId,objectType:D.SelectRange,actions:Ye}).then(t=>{this._rangeProtectionRuleModel.getRule(e.unitId,e.subUnitId,e.rule.id)&&(de().forEach(o=>{if(e.type==="set"){const{rule:d,oldRule:c}=e;if(d.permissionId===(c==null?void 0:c.permissionId))return}const r=e.rule,a=new o(r.unitId,r.subUnitId,r.permissionId),l=a.subType,u=t.find(d=>d.action===l);u&&this._permissionService.updatePermissionPoint(a.id,u.allowed)}),this._rangeProtectionRuleModel.ruleRefresh(e.rule.permissionId))}):this._rangeProtectionRuleModel.getSubunitRuleList(e.unitId,e.subUnitId).length===0&&(this._worksheetProtectionPointRuleModel.deleteRule(e.unitId,e.subUnitId),[...pe()].forEach(n=>{const o=new n(e.unitId,e.subUnitId);this._permissionService.updatePermissionPoint(o.id,o.value)}))}))}async initWorkbookPermissionChange(e){var n;const t=e||((n=this._univerInstanceService.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET))==null?void 0:n.getUnitId());if(t)return this._authzIoService.allowed({objectID:t,objectType:D.Workbook,unitID:t,actions:Mi}).then(o=>{Ot().forEach(r=>{const a=new r(t),l=a.subType,u=o.find(d=>d.action===l);u&&this._permissionService.updatePermissionPoint(a.id,u.allowed)})})}async _initWorkbookPermissionFromSnapshot(){await Promise.all(this._univerInstanceService.getAllUnitsForType(i.UniverInstanceType.UNIVER_SHEET).map(e=>this.initWorkbookPermissionChange(e.getUnitId()))),this._workbookPermissionService.changeUnitInitState(!0)}_initWorksheetPermissionChange(){this.disposeWithMe(this._worksheetProtectionRuleModel.ruleChange$.subscribe(e=>{e.type!=="delete"?this._authzIoService.allowed({objectID:e.rule.permissionId,unitID:e.unitId,objectType:D.Worksheet,actions:Ye}).then(t=>{const n=this._worksheetProtectionRuleModel.getRule(e.unitId,e.subUnitId);!n||n.permissionId!==e.rule.permissionId||(ce().forEach(o=>{const r=new o(e.unitId,e.subUnitId),a=r.subType,l=t.find(u=>u.action===a);l&&this._permissionService.updatePermissionPoint(r.id,l.allowed)}),this._worksheetProtectionRuleModel.ruleRefresh(e.rule.permissionId))}):([...ce(),...pe()].forEach(t=>{const n=new t(e.unitId,e.subUnitId);this._permissionService.updatePermissionPoint(n.id,!0)}),this._worksheetProtectionPointRuleModel.deleteRule(e.unitId,e.subUnitId))}))}_initWorksheetPermissionPointsChange(){this.disposeWithMe(this._worksheetProtectionPointRuleModel.pointChange$.subscribe(e=>{this._authzIoService.allowed({objectID:e.permissionId,unitID:e.unitId,objectType:D.Worksheet,actions:En}).then(t=>{const n=this._worksheetProtectionPointRuleModel.getRule(e.unitId,e.subUnitId);!n||n.permissionId!==e.permissionId||pe().forEach(o=>{const r=new o(e.unitId,e.subUnitId),a=r.subType,l=t.find(u=>u.action===a);l&&this._permissionService.updatePermissionPoint(r.id,l.allowed)})})}))}async _initWorksheetPermissionFromSnapshot(){const e=async t=>{const n=[],o=t.getUnitId(),r=t.getSheets(),a=new Map;if(r.forEach(l=>{const u=l.getSheetId(),d=this._worksheetProtectionRuleModel.getRule(o,u);d&&(a.set(d.permissionId,d),n.push({objectID:d.permissionId,unitID:o,objectType:D.Worksheet,actions:Ye}));const c=this._worksheetProtectionPointRuleModel.getRule(o,u);c&&(a.set(c.permissionId,c),n.push({objectID:c.permissionId,unitID:o,objectType:D.Worksheet,actions:En}))}),!n.length){this._worksheetProtectionRuleModel.changeRuleInitState(!0);return}this._authzIoService.batchAllowed(n).then(l=>{l.forEach(u=>{const d=a.get(u.objectID);if(d){const c=this._worksheetProtectionRuleModel.getRule(o,d.subUnitId)||this._worksheetProtectionPointRuleModel.getRule(o,d.subUnitId);if(!c||c.permissionId!==u.objectID)return;[...ce(),...pe()].forEach(h=>{const m=new h(o,d.subUnitId),R=m.subType,C=u.actions.find(S=>S.action===R);(C==null?void 0:C.allowed)!==void 0&&this._permissionService.updatePermissionPoint(m.id,C.allowed)})}}),this._worksheetProtectionRuleModel.changeRuleInitState(!0)})};await Promise.all(this._univerInstanceService.getAllUnitsForType(i.UniverInstanceType.UNIVER_SHEET).map(t=>e(t))),this._worksheetProtectionRuleModel.changeRuleInitState(!0)}_initUserChange(){this.disposeWithMe(this._userManagerService.currentUser$.pipe(O.skip(1)).subscribe(()=>{const e=this._permissionService.getAllPermissionPoint();this._permissionService.clearPermissionMap(),this._worksheetProtectionRuleModel.changeRuleInitState(!1),this._univerInstanceService.getAllUnitsForType(i.UniverInstanceType.UNIVER_SHEET).forEach(n=>{const o=n.getUnitId();Ot().forEach(r=>{let a=new r(o);e.has(a.id)&&(a=e.get(a.id)),this._permissionService.addPermissionPoint(a)}),n.getSheets().forEach(r=>{const a=r.getSheetId();[...ce(),...pe()].forEach(u=>{let d=new u(o,a);e.has(d.id)&&(d=e.get(d.id)),this._permissionService.addPermissionPoint(d)}),this._rangeProtectionRuleModel.getSubunitRuleList(o,a).forEach(u=>{de().forEach(d=>{let c=new d(o,a,u.permissionId);e.has(c.id)&&(c=e.get(c.id)),this._permissionService.addPermissionPoint(c)})})}),this._initWorkbookPermissionFromSnapshot(),this._initWorksheetPermissionFromSnapshot(),this._initRangePermissionFromSnapshot()})}))}refreshPermission(e,t){const n=this._worksheetProtectionRuleModel.getTargetByPermissionId(e,t);let o=!1;if(n){const[l,u]=n;this._authzIoService.allowed({objectID:t,unitID:e,objectType:D.Worksheet,actions:Ye}).then(d=>{if(!this._worksheetProtectionRuleModel.getTargetByPermissionId(e,t))return;let h="";ce().forEach(m=>{var I;const R=new m(e,u),C=R.subType,S=d.find(v=>v.action===C);S&&(((I=this._permissionService.getPermissionPoint(R.id))==null?void 0:I.value)!==S.allowed&&(o=!0),this._permissionService.updatePermissionPoint(R.id,S.allowed),h+=`${S.action}_${S.allowed}`)}),this._worksheetProtectionRuleModel.ruleRefresh(`${t}_${h}`),o&&this._undoRedoService.clearUndoRedo(e)})}const r=this._worksheetProtectionPointRuleModel.getTargetByPermissionId(e,t);if(r){const[l,u]=r;this._authzIoService.allowed({objectID:t,unitID:e,objectType:D.Worksheet,actions:En}).then(d=>{this._worksheetProtectionPointRuleModel.getTargetByPermissionId(e,t)&&(pe().forEach(h=>{var S;const m=new h(e,u),R=m.subType,C=d.find(I=>I.action===R);C&&(((S=this._permissionService.getPermissionPoint(m.id))==null?void 0:S.value)!==C.allowed&&(o=!0),this._permissionService.updatePermissionPoint(m.id,C.allowed))}),o&&this._undoRedoService.clearUndoRedo(e))})}const a=this._rangeProtectionRuleModel.getTargetByPermissionId(e,t);if(a){const[l,u]=a;this._authzIoService.allowed({objectID:t,unitID:e,objectType:D.SelectRange,actions:Ye}).then(d=>{if(!this._rangeProtectionRuleModel.getTargetByPermissionId(e,t))return;let h="";de().forEach(m=>{var I;const R=new m(e,u,t),C=R.subType,S=d.find(v=>v.action===C);S&&(((I=this._permissionService.getPermissionPoint(R.id))==null?void 0:I.value)!==S.allowed&&(o=!0),this._permissionService.updatePermissionPoint(R.id,S.allowed),h+=`${S.action}_${S.allowed}`)}),this._rangeProtectionRuleModel.ruleRefresh(`${t}_${h}`),o&&this._undoRedoService.clearUndoRedo(e)})}}_refreshPermissionByCollaCreate(){this.disposeWithMe(this._commandService.onCommandExecuted((e,t)=>{if(t!=null&&t.fromCollab&&(e.id===Se.id||e.id===qe.id||e.id===Tn.id)){const n=e.params;this._undoRedoService.clearUndoRedo(n.unitId)}}))}},g.SheetPermissionInitController=Cd([We(0,i.IUniverInstanceService),We(1,i.IPermissionService),We(2,i.IAuthzIoService),We(3,i.Inject(X)),We(4,i.Inject(Ne)),We(5,i.Inject(i.UserManagerService)),We(6,i.Inject(Nt)),We(7,i.Inject(g.WorkbookPermissionService)),We(8,i.Inject(i.IUndoRedoService)),We(9,i.Inject(i.ICommandService))],g.SheetPermissionInitController);var Sd=Object.getOwnPropertyDescriptor,fd=(s,e,t,n)=>{for(var o=n>1?void 0:n?Sd(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},eo=(s,e)=>(t,n)=>e(t,n,s);g.ZebraCrossingCacheController=class extends i.Disposable{constructor(t,n,o){super();f(this,"_zebraCacheUpdateSubject",new O.Subject);this._commandService=t,this._sheetRangeThemeModel=n,this._univerInstanceService=o,this._init()}_init(){this._initializeCommandListener(),this._initTriggerCacheUpdateListener()}updateZebraCrossingCache(t,n){this._zebraCacheUpdateSubject.next({unitId:t,subUnitId:n})}_initializeCommandListener(){this.disposeWithMe(this._commandService.onCommandExecuted(t=>{const{id:n}=t;let o,r;switch(n){case ie.id:{const a=t.params;o=a.unitId,r=a.subUnitId}break;case Je.id:{const a=t.params;o=a.unitId,r=a.subUnitId}break;case Xe.id:{const a=t.params;o=a.unitId,r=a.subUnitId}break;case le.id:{const a=t.params;o=a.unitId,r=a.subUnitId}break;case Te.id:{const a=t.params;o=a.unitId,r=a.subUnitId}break}o&&r&&(this._sheetRangeThemeModel.refreshSheetRowVisibleFuncSet(o,r),this._sheetRangeThemeModel.refreshZebraCrossingCacheBySheet(o,r))}))}_initTriggerCacheUpdateListener(){this.disposeWithMe(this._zebraCacheUpdateSubject.subscribe(({unitId:t,subUnitId:n})=>{this._sheetRangeThemeModel.refreshSheetRowVisibleFuncSet(t,n),this._sheetRangeThemeModel.refreshZebraCrossingCacheBySheet(t,n)}))}},g.ZebraCrossingCacheController=fd([eo(0,i.Inject(i.ICommandService)),eo(1,i.Inject(g.SheetRangeThemeModel)),eo(2,i.Inject(i.IUniverInstanceService))],g.ZebraCrossingCacheController);var Id=Object.getOwnPropertyDescriptor,vd=(s,e,t,n)=>{for(var o=n>1?void 0:n?Id(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},Bi=(s,e)=>(t,n)=>e(t,n,s);g.RangeProtectionRenderModel=class{constructor(e,t){f(this,"_cache",new i.LRUMap(1e4));this._selectionProtectionRuleModel=e,this._permissionService=t,this._init()}_init(){this._permissionService.permissionPointUpdate$.pipe(Dt.filter(e=>e.type===D.SelectRange),Dt.filter(e=>de().some(t=>e instanceof t)),Dt.map(e=>e)).subscribe(e=>{const t=this._selectionProtectionRuleModel.getSubunitRuleList(e.unitId,e.subUnitId);for(const n of t)n.permissionId===e.permissionId&&n.ranges.forEach(o=>{i.Range.foreach(o,(r,a)=>{const l=this._createKey(e.unitId,e.subUnitId,r,a);this._cache.delete(l)})})}),this._selectionProtectionRuleModel.ruleChange$.subscribe(e=>{var t;e.rule.ranges.forEach(n=>{i.Range.foreach(n,(o,r)=>{const a=this._createKey(e.unitId,e.subUnitId,o,r);this._cache.delete(a)})}),e.type==="set"&&((t=e.oldRule)==null||t.ranges.forEach(n=>{i.Range.foreach(n,(o,r)=>{const a=this._createKey(e.unitId,e.subUnitId,o,r);this._cache.delete(a)})}))})}_createKey(e,t,n,o){return`${e}_${t}_${n}_${o}`}getCellInfo(e,t,n,o){const r=this._selectionProtectionRuleModel.getSubunitRuleList(e,t),a=[];if(!r||!r.length)return a;const l=this._createKey(e,t,n,o),u=this._cache.get(l);if(u)return u;const d=[];for(const c of r)if(c.ranges.some(h=>h.startRow<=n&&h.endRow>=n&&h.startColumn<=o&&h.endColumn>=o)){const h=de().reduce((m,R)=>{var I;const C=new R(e,t,c.permissionId),S=this._permissionService.getPermissionPoint(C.id);return m[C.subType]=(I=S==null?void 0:S.value)!=null?I:C.value,m},{});d.push({...h,ruleId:c.id,ranges:c.ranges})}return this._cache.set(l,d),d}clear(){this._cache.clear()}},g.RangeProtectionRenderModel=vd([Bi(0,i.Inject(X)),Bi(1,i.Inject(i.IPermissionService))],g.RangeProtectionRenderModel);var pd=Object.getOwnPropertyDescriptor,wd=(s,e,t,n)=>{for(var o=n>1?void 0:n?pd(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},to=(s,e)=>(t,n)=>e(t,n,s);g.RangeProtectionCache=class extends i.Disposable{constructor(t,n,o){super();f(this,"_cellRuleCache",new Map);f(this,"_permissionIdCache",new Map);f(this,"_cellInfoCache",new Map);f(this,"_rowInfoCache",new Map);f(this,"_colInfoCache",new Map);this._ruleModel=t,this._permissionService=n,this._univerInstanceService=o,this._initUpdateCellRuleCache(),this._initUpdateCellInfoCache(),this._initUpdateRowColInfoCache(),this._initCache()}_initCache(){this._univerInstanceService.getAllUnitsForType(i.UniverInstanceType.UNIVER_SHEET).forEach(t=>{t.getSheets().forEach(n=>{const o=t.getUnitId(),r=n.getSheetId();this.reBuildCache(o,r)})})}_initUpdateCellInfoCache(){this._permissionService.permissionPointUpdate$.pipe(O.filter(t=>t.type===D.SelectRange),O.map(t=>t)).subscribe(t=>{const{subUnitId:n,unitId:o,permissionId:r}=t,a=this._permissionIdCache.get(r);if(!a)return;const l=this._ruleModel.getRule(o,n,a);if(!l)return;const u=this._ensureCellInfoMap(o,n);l.ranges.forEach(d=>{const{startRow:c,endRow:h,startColumn:m,endColumn:R}=d;for(let C=c;C<=h;C++)for(let S=m;S<=R;S++)u.delete(`${C}-${S}`)})}),this._ruleModel.ruleChange$.subscribe(t=>{var a;const{unitId:n,subUnitId:o}=t,r=this._ensureCellInfoMap(n,o);t.rule.ranges.forEach(l=>{i.Range.foreach(l,(u,d)=>{r.delete(`${u}-${d}`)})}),t.type==="set"&&((a=t.oldRule)==null||a.ranges.forEach(l=>{i.Range.foreach(l,(u,d)=>{this._cellInfoCache.delete(`${u}-${d}`)})}))})}_initUpdateCellRuleCache(){this._ruleModel.ruleChange$.subscribe(t=>{const{type:n}=t;n==="add"?this._addCellRuleCache(t):n==="delete"?this._deleteCellRuleCache(t):(this._deleteCellRuleCache({...t,rule:t.oldRule}),this._addCellRuleCache(t))})}_ensureRuleMap(t,n){let o=this._cellRuleCache.get(t);o||(o=new Map,this._cellRuleCache.set(t,o));let r=o.get(n);return r||(r=new Map,o.set(n,r)),r}_ensureCellInfoMap(t,n){let o=this._cellInfoCache.get(t);o||(o=new Map,this._cellInfoCache.set(t,o));let r=o.get(n);return r||(r=new Map,o.set(n,r)),r}_ensureRowColInfoMap(t,n,o){let r=o==="row"?this._rowInfoCache.get(t):this._colInfoCache.get(t);r||(r=new Map,o==="row"?this._rowInfoCache.set(t,r):this._colInfoCache.set(t,r));let a=r.get(n);return a||(a=new Map,r.set(n,a)),a}_addCellRuleCache(t){const{subUnitId:n,unitId:o,rule:r}=t,a=this._ensureRuleMap(o,n);r.ranges.forEach(l=>{const{startRow:u,endRow:d,startColumn:c,endColumn:h}=l;for(let m=u;m<=d;m++)for(let R=c;R<=h;R++)a.set(`${m}-${R}`,r.id)}),this._permissionIdCache.set(r.permissionId,r.id)}_deleteCellRuleCache(t){const{subUnitId:n,unitId:o,rule:r}=t,a=this._ensureRuleMap(o,n),l=this._ensureCellInfoMap(o,n);r.ranges.forEach(u=>{const{startRow:d,endRow:c,startColumn:h,endColumn:m}=u;for(let R=d;R<=c;R++)for(let C=h;C<=m;C++)a.delete(`${R}-${C}`),l.delete(`${R}-${C}`)}),this._permissionIdCache.delete(r.permissionId)}_getSelectionActions(t,n,o){var c,h,m,R,C,S,I,v,M,p,w,y;const r=(m=(h=this._permissionService.getPermissionPoint((c=new fe(t,n,o.permissionId))==null?void 0:c.id))==null?void 0:h.value)!=null?m:!1,a=(S=(C=this._permissionService.getPermissionPoint((R=new dn(t,n,o.permissionId))==null?void 0:R.id))==null?void 0:C.value)!=null?S:!1,l=(M=(v=this._permissionService.getPermissionPoint((I=new Js(t,n,o.permissionId))==null?void 0:I.id))==null?void 0:v.value)!=null?M:!1,u=(y=(w=this._permissionService.getPermissionPoint((p=new Ks(t,n,o.permissionId))==null?void 0:p.id))==null?void 0:w.value)!=null?y:!1;return{[_.Edit]:r,[_.View]:a,[_.ManageCollaborator]:l,[_.Delete]:u}}reBuildCache(t,n){const o=this._ensureRuleMap(t,n),r=this._ensureCellInfoMap(t,n);o.clear(),r.clear();const a=this._ensureRowColInfoMap(t,n,"row"),l=this._ensureRowColInfoMap(t,n,"col");a.clear(),l.clear(),this._ruleModel.getSubunitRuleList(t,n).forEach(u=>{const d=this._getSelectionActions(t,n,u),c={...d,ruleId:u.id,ranges:u.ranges};u.ranges.forEach(h=>{const{startRow:m,endRow:R,startColumn:C,endColumn:S}=h;for(let I=m;I<=R;I++){const v=a.get(`${I}`);v?v.set(u.id,d):a.set(`${I}`,new Map([[u.id,d]]));for(let M=C;M<=S;M++){o.set(`${I}-${M}`,u.id),r.set(`${I}-${M}`,c);const p=l.get(`${M}`);p?p.set(u.id,d):l.set(`${M}`,new Map([[u.id,d]]))}}}),this._permissionIdCache.set(u.permissionId,u.id)})}getRowPermissionInfo(t,n,o,r){var u;const a=(u=this._rowInfoCache.get(t))==null?void 0:u.get(n);if(!a)return!0;const l=a.get(`${o}`);return l?r.every(d=>{for(const c of l.values())if(c[d]===!1)return!1;return!0}):!0}getColPermissionInfo(t,n,o,r){var u;const a=(u=this._colInfoCache.get(t))==null?void 0:u.get(n);if(!a)return!0;const l=a.get(`${o}`);return l?r.every(d=>{for(const c of l.values())if(c[d]===!1)return!1;return!0}):!0}_initUpdateRowColInfoCache(){this._permissionService.permissionPointUpdate$.pipe(O.filter(t=>t.type===D.SelectRange),O.map(t=>t)).subscribe({next:t=>{const{subUnitId:n,unitId:o,permissionId:r}=t,a=this._permissionIdCache.get(r);if(!a)return;const l=this._ruleModel.getRule(o,n,a);if(!l)return;const u=this._ensureRowColInfoMap(o,n,"row"),d=this._ensureRowColInfoMap(o,n,"col"),c=this._getSelectionActions(o,n,l);l.ranges.forEach(h=>{const{startRow:m,endRow:R,startColumn:C,endColumn:S}=h;for(let I=m;I<=R;I++){const v=u.get(`${I}`);v?v.set(a,c):u.set(`${I}`,new Map([[a,c]]));for(let M=C;M<=S;M++){const p=d.get(`${M}`);p?p.set(a,c):d.set(`${M}`,new Map([[a,c]]))}}})}}),this._ruleModel.ruleChange$.subscribe(t=>{if(t.type==="delete"){const{unitId:n,subUnitId:o,rule:r}=t,a=this._ensureRowColInfoMap(n,o,"row"),l=this._ensureRowColInfoMap(n,o,"col");r.ranges.forEach(u=>{const{startRow:d,endRow:c,startColumn:h,endColumn:m}=u;for(let R=d;R<=c;R++){const C=a.get(`${R}`);C==null||C.delete(r.id);for(let S=h;S<=m;S++){const I=l.get(`${S}`);I==null||I.delete(r.id)}}})}})}getCellInfo(t,n,o,r){var c,h;const a=this._ensureCellInfoMap(t,n),l=a.get(`${o}-${r}`);if(l)return l;const u=(h=(c=this._cellRuleCache.get(t))==null?void 0:c.get(n))==null?void 0:h.get(`${o}-${r}`);if(!u)return;const d=this._ruleModel.getRule(t,n,u);if(d){const R={...this._getSelectionActions(t,n,d),ruleId:u,ranges:d.ranges};return a.set(`${o}-${r}`,R),R}}deleteUnit(t){this._cellRuleCache.delete(t),this._cellInfoCache.delete(t),this._rowInfoCache.delete(t),this._colInfoCache.delete(t);const n=this._univerInstanceService.getUnit(t);n==null||n.getSheets().forEach(o=>{const r=o.getSheetId();this._ruleModel.getSubunitRuleList(t,r).forEach(a=>{this._permissionIdCache.delete(a.permissionId)})})}},g.RangeProtectionCache=wd([to(0,i.Inject(X)),to(1,i.Inject(i.IPermissionService)),to(2,i.Inject(i.IUniverInstanceService))],g.RangeProtectionCache);var Md=Object.getOwnPropertyDescriptor,yd=(s,e,t,n)=>{for(var o=n>1?void 0:n?Md(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},Hi=(s,e)=>(t,n)=>e(t,n,s);let On=class extends i.Disposable{constructor(e,t){super();f(this,"_previousSheetIndex",-1);this._commandService=e,this._univerInstanceService=t,this.disposeWithMe(this._commandService.beforeCommandExecuted(n=>{if(n.id===He.id)return this._beforeAdjustActiveSheetOnRemoveSheet(n)})),this.disposeWithMe(this._commandService.onCommandExecuted((n,o)=>{if(n.id===He.id)return this._adjustActiveSheetOnRemoveSheet(n);if(n.id===De.id&&n.params.hidden)return this._adjustActiveSheetOnHideSheet(n);if(o!=null&&o.fromCollab)return!1;if(n.id===it.id)return this._adjustActiveSheetOnInsertSheet(n);if(n.id===De.id&&!n.params.hidden)return this._adjustActiveSheetOnShowSheet(n);if(n.id===q.id)return this._adjustActiveSheetOnSelection(n)}))}_adjustActiveSheetOnHideSheet(e){var u;const{unitId:t,subUnitId:n}=e.params,o=this._univerInstanceService.getUniverSheetInstance(t);if(!o||((u=o.getActiveSheet())==null?void 0:u.getSheetId())!==n)return;const a=o.getActiveSheetIndex(),l=Fi(o,a);this._switchToNextSheet(t,l)}_beforeAdjustActiveSheetOnRemoveSheet(e){const{unitId:t,subUnitId:n}=e.params,o=this._univerInstanceService.getUniverSheetInstance(t);if(!o)return;const r=o.getSheetBySheetId(n);r&&(this._previousSheetIndex=o.getSheetIndex(r))}_adjustActiveSheetOnRemoveSheet(e){if(this._previousSheetIndex===-1)return;const{unitId:t}=e.params,n=this._univerInstanceService.getUniverSheetInstance(t);if(!n)return;if(n.getActiveSheet().getSheetId()===e.params.subUnitId){const r=this._previousSheetIndex,a=r>=1?r-1:0,l=Fi(n,a);this._switchToNextSheet(t,l)}}_adjustActiveSheetOnInsertSheet(e){const{unitId:t,sheet:n}=e.params;this._switchToNextSheet(t,n.id)}_adjustActiveSheetOnShowSheet(e){const{unitId:t,subUnitId:n}=e.params;this._switchToNextSheet(t,n)}_adjustActiveSheetOnSelection(e){var o;const{unitId:t,subUnitId:n}=e.params;n!==((o=this._univerInstanceService.getUnit(t))==null?void 0:o.getActiveSheet().getSheetId())&&this._switchToNextSheet(t,n)}_switchToNextSheet(e,t){this._commandService.executeCommand(Ze.id,{unitId:e,subUnitId:t})}};On=yd([Hi(0,i.ICommandService),Hi(1,i.IUniverInstanceService)],On);function Fi(s,e){const t=s.getSheetSize();for(let n=e;n>-1;n--){const o=s.getSheetByIndex(n);if(!o.getConfig().hidden)return o.getSheetId()}for(let n=e;n<t;n++){const o=s.getSheetByIndex(n);if(!o.getConfig().hidden)return o.getSheetId()}throw new Error("[ActiveWorksheetController]: could not find the next unhidden sheet! Collaboration error perhaps.")}const ji="ONLY_REGISTER_FORMULA_RELATED_MUTATIONS_KEY";var _d=Object.getOwnPropertyDescriptor,bd=(s,e,t,n)=>{for(var o=n>1?void 0:n?_d(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},no=(s,e)=>(t,n)=>e(t,n,s);let Dn=class extends i.Disposable{constructor(s,e,t){var o;super(),this._commandService=s,this._configService=e,this._dataSyncPrimaryController=t,[F,ae,ie,it,Fe,we,Me,se,le,He,G,Zs,j,zs,Kt,Pn,Wt,Ni,Xe,Je,Oi,Di,Vs].forEach(r=>{var a;this._commandService.registerCommand(r),(a=this._dataSyncPrimaryController)==null||a.registerSyncingMutations(r)}),(o=this._configService.getConfig(ji))!=null&&o||[ot,Ar,Wr,Vr,Br,rn,vn,an,Gr,Ge,ze,Yt,Xt,ar,ir,lr,ur,_s,_e,et,yt,nr,tr,or,sr,ys,ye,Kr,bt,Qe,_t,bs,Ft,Es,Ht,wn,Sn,Xr,mi,ci,hi,ti,ei,Ut,Zr,Qr,yn,mt,gt,xt,ni,ht,oi,Oe,ri,Ri,Mt,Zt,_n,li,Ct,Hs,Gs,kt,Pt,te,fi,qt,di,Si,Ci,gi,qs,Ys,Ze,wi,De,bn,xs,Jt,qn,Te,kn,Ce,$e,bi,It,Ii,St,Go,q,Vi,xr,$s,Fs,Xs,Ui,vt,ii,Rt,yi,qe,lt,rt,Tn,Lo,ai,zr,Lr,qr,_i,Se,Ue,ee,Ti,ft,vi,Ei,ct,dt,pn,Tt,ki,Jr,$r,Yr,Pi,Wi,Ai].forEach(r=>this.disposeWithMe(this._commandService.registerCommand(r))),this._configService.setConfig(Li,nd)}};Dn=bd([no(0,i.ICommandService),no(1,i.IConfigService),no(2,i.Optional(ea.DataSyncPrimaryController))],Dn);var Ed=Object.getOwnPropertyDescriptor,Td=(s,e,t,n)=>{for(var o=n>1?void 0:n?Ed(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},Gi=(s,e)=>(t,n)=>e(t,n,s);let An=class extends i.Disposable{constructor(s,e){super(),this._univerInstanceService=s,this._commandService=e,this._initialize()}_initialize(){this.disposeWithMe(this._commandService.onCommandExecuted(s=>{if(s.id!==K.SetFormulaCalculationResultMutation.id)return;const e=s.params,{unitData:t}=e,n=Object.keys(t),o=[];for(let a=0;a<n.length;a++){const l=n[a],u=t[l];if(u==null)continue;const d=Object.keys(u);for(let c=0;c<d.length;c++){const h=d[c],m=u[h];if(m==null)continue;const R=this._getMergedCellData(l,h,m),C={subUnitId:h,unitId:l,cellValue:R};o.push({id:F.id,params:C})}}return o.every(a=>this._commandService.executeCommand(a.id,a.params,{onlyLocal:!0,fromFormula:!0}))}))}_getMergedCellData(s,e,t){const n=this._univerInstanceService.getUniverSheetInstance(s),o=n==null?void 0:n.getStyles(),r=n==null?void 0:n.getSheetBySheetId(e),a=r==null?void 0:r.getCellMatrix(),l=new i.ObjectMatrix(t);return l.forValue((u,d,c)=>{const h=a==null?void 0:a.getValue(u,d),m=K.handleNumfmtInCell(h,c,o);l.setValue(u,d,m)}),l.getMatrix()}};An=Td([Gi(0,i.Inject(i.IUniverInstanceService)),Gi(1,i.ICommandService)],An);var Ud=Object.getOwnPropertyDescriptor,kd=(s,e,t,n)=>{for(var o=n>1?void 0:n?Ud(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},Pd=(s,e)=>(t,n)=>e(t,n,s);let Wn=class extends i.Disposable{constructor(s){super(),this._sheetInterceptorService=s,this._initialize()}_initialize(){this._initInterceptorCellContent()}_initInterceptorCellContent(){this.disposeWithMe(this._sheetInterceptorService.intercept(Ve.CELL_CONTENT,{priority:11,effect:i.InterceptorEffectEnum.Value|i.InterceptorEffectEnum.Style,handler:(s,e,t)=>{var o;if(!s)return t(s);const n=e.workbook.getStyles().getStyleByCell(s);return i.isDefaultFormat((o=n==null?void 0:n.n)==null?void 0:o.pattern)&&(s==null?void 0:s.t)===i.CellValueType.NUMBER&&s.v!==void 0&&s.v!==null&&i.isRealNum(s.v)&&((!s||s===e.rawData)&&(s={...e.rawData}),s.v=K.stripErrorMargin(Number(s.v))),t(s)}}))}};Wn=kd([Pd(0,i.Inject(g.SheetInterceptorService))],Wn);var Nd=Object.getOwnPropertyDescriptor,Od=(s,e,t,n)=>{for(var o=n>1?void 0:n?Nd(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},Vn=(s,e)=>(t,n)=>e(t,n,s);let Ln=class extends i.Disposable{constructor(s,e,t,n){super(),this._permissionService=s,this._worksheetProtectionRuleModel=e,this._sheetInterceptorService=t,this._rangeProtectionCache=n,this._initViewModelByRangeInterceptor(),this._initViewModelBySheetInterceptor()}_initViewModelByRangeInterceptor(){this.disposeWithMe(this._sheetInterceptorService.intercept(Ve.CELL_CONTENT,{priority:999,effect:i.InterceptorEffectEnum.Value|i.InterceptorEffectEnum.Style,handler:(s,e,t)=>{const{unitId:n,subUnitId:o,row:r,col:a}=e,l=this._rangeProtectionCache.getCellInfo(n,o,r,a);if(l){const u=l[_.View]===!1,d=!s||s===e.rawData?{...e.rawData}:s;return d.selectionProtection=[l],u?(delete d.s,delete d.v,delete d.p,d):t(d)}return t(s)}}))}_initViewModelBySheetInterceptor(){this.disposeWithMe(this._sheetInterceptorService.intercept(Ve.CELL_CONTENT,{priority:999,effect:i.InterceptorEffectEnum.Value|i.InterceptorEffectEnum.Style,handler:(s,e,t)=>{var a,l,u,d,c;const{unitId:n,subUnitId:o}=e,r=this._worksheetProtectionRuleModel.getRule(n,o);if(r!=null&&r.permissionId){const h=[{[_.View]:(l=(a=this._permissionService.getPermissionPoint(new Bt(n,o).id))==null?void 0:a.value)!=null?l:!1,[_.Edit]:(d=(u=this._permissionService.getPermissionPoint(new Ie(n,o).id))==null?void 0:u.value)!=null?d:!1}],m=!((c=h[0])!=null&&c[_.View]),R=!s||s===e.rawData?{...s}:s;return R.hasWorksheetRule=!0,R.selectionProtection=h,m?(delete R.s,delete R.v,delete R.p,R):t(R)}return t(s)}}))}};Ln=Od([Vn(0,i.IPermissionService),Vn(1,i.Inject(Ne)),Vn(2,i.Inject(g.SheetInterceptorService)),Vn(3,i.Inject(g.RangeProtectionCache))],Ln);const so=i.createIdentifier("univer.exclusive-range-service");class zi extends i.Disposable{constructor(){super(...arguments);f(this,"_exclusiveRanges",new Map);f(this,"_exclusiveRangesChange$",new O.Subject);f(this,"exclusiveRangesChange$",this._exclusiveRangesChange$.asObservable())}_ensureUnitMap(t){return this._exclusiveRanges.has(t)||this._exclusiveRanges.set(t,new Map),this._exclusiveRanges.get(t)}_ensureSubunitMap(t,n){const o=this._ensureUnitMap(t);return o.has(n)||o.set(n,new Map),o.get(n)}_ensureFeature(t,n,o){const r=this._ensureSubunitMap(t,n);return r.has(o)||r.set(o,[]),r.get(o)}addExclusiveRange(t,n,o,r){const a=this._ensureFeature(t,n,o);a.push(...r),this._exclusiveRangesChange$.next({unitId:t,subUnitId:n,ranges:a.map(l=>l.range)})}getExclusiveRanges(t,n,o){var r,a;return(a=(r=this._exclusiveRanges.get(t))==null?void 0:r.get(n))==null?void 0:a.get(o)}clearExclusiveRanges(t,n,o){const r=this.getExclusiveRanges(t,n,o);this._exclusiveRangesChange$.next({unitId:t,subUnitId:n,ranges:(r==null?void 0:r.map(a=>a.range))||[]}),this._ensureFeature(t,n,o),this._exclusiveRanges.get(t).get(n).set(o,[])}clearExclusiveRangesByGroupId(t,n,o,r){const a=this.getExclusiveRanges(t,n,o);this._exclusiveRangesChange$.next({unitId:t,subUnitId:n,ranges:(a==null?void 0:a.map(u=>u.range))||[]});const l=this.getExclusiveRanges(t,n,o);if(l){const u=l.filter(d=>d.groupId!==r);this._exclusiveRanges.get(t).get(n).set(o,u)}}getInterestGroupId(t){const n=[];return t.forEach(o=>{var d;const r=o.range,{unitId:a,sheetId:l}=r;if(!a||!l)return;const u=(d=this._exclusiveRanges.get(a))==null?void 0:d.get(l);if(u)for(const c of u.keys()){const h=u.get(c);if(h){for(const m of h)if(i.Rectangle.intersects(r,m.range)){n.push(c);break}}}}),n}}var Dd=Object.getOwnPropertyDescriptor,Ad=(s,e,t,n)=>{for(var o=n>1?void 0:n?Dd(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},oo=(s,e)=>(t,n)=>e(t,n,s);g.NumfmtService=class extends i.Disposable{constructor(e,t,n){super(),this._resourceManagerService=e,this._univerInstanceService=t,this._logService=n}getValue(e,t,n,o){const r=this._univerInstanceService.getUniverSheetInstance(e);if(!r)return;const a=r==null?void 0:r.getSheetBySheetId(t);if(!a)return;const l=r.getStyles(),u=a.getCellRaw(n,o);if(u!=null&&u.s){const d=l.get(u.s);if(d!=null&&d.n)return d.n}return null}deleteValues(e,t,n){const o=this._univerInstanceService.getUniverSheetInstance(e);if(!o)return;const r=o==null?void 0:o.getSheetBySheetId(t);if(!r)return;const a=o.getStyles();n.forEach(l=>{i.Range.foreach(l,(u,d)=>{const c=r.getCellRaw(u,d);if(!c)return;const h=c==null?void 0:c.s,R={...h&&a.get(h)||{}};delete R.n;const C=a.setValue(R);c.s=C})})}setValues(e,t,n){const o=this._univerInstanceService.getUniverSheetInstance(e);if(!o)return;const r=o==null?void 0:o.getSheetBySheetId(t);if(!r)return;const a=o.getStyles(),l=r.getCellMatrix();n.forEach(u=>{u.ranges.forEach(d=>{i.Range.foreach(d,(c,h)=>{const m=r.getCellRaw(c,h);if(m){const C={...a.getStyleByCell(m)||{},n:{pattern:u.pattern}},S=a.setValue(C);m.s=S}else{const R={n:{pattern:u.pattern}},C=a.setValue(R);C&&l.setValue(c,h,{s:C})}})})})}},g.NumfmtService=Ad([oo(0,i.IResourceManagerService),oo(1,i.IUniverInstanceService),oo(2,i.ILogService)],g.NumfmtService);var Wd=Object.getOwnPropertyDescriptor,Vd=(s,e,t,n)=>{for(var o=n>1?void 0:n?Wd(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},Ke=(s,e)=>(t,n)=>e(t,n,s);const qi=[ae.id,ie.id,se.id,le.id],Yi=[we.id,Me.id];g.RangeProtectionRefRangeService=class extends i.Disposable{constructor(t,n,o,r,a,l,u,d){super();f(this,"disposableCollection",new i.DisposableCollection);this._selectionProtectionRuleModel=t,this._univerInstanceService=n,this._commandService=o,this._refRangeService=r,this._selectionProtectionRenderModel=a,this._rangeProtectionCache=l,this._sheetInterceptorService=u,this._rangeProtectionRuleModel=d,this._onRefRangeChange(),this._correctPermissionRange(),this._initReBuildCache(),this._initRemoveSheet()}_onRefRangeChange(){const t=(o,r)=>{const a=this._univerInstanceService.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET);if(!a||!(a==null?void 0:a.getSheetBySheetId(r)))return;this.disposableCollection.dispose();const u=c=>this.refRangeHandle(c,o,r);this._selectionProtectionRuleModel.getSubunitRuleList(o,r).reduce((c,h)=>[...c,...h.ranges],[]).forEach(c=>{this.disposableCollection.add(this._refRangeService.registerRefRange(c,u,o,r))})};this.disposeWithMe(this._commandService.onCommandExecuted(o=>{if(o.id===Ys.id){const r=o.params,a=r.subUnitId,l=r.unitId;if(!a||!l)return;t(l,a)}if(o.id===ee.id||o.id===Se.id){const r=o.params,a=r.subUnitId,l=r.unitId;if(!a||!l)return;t(l,a)}}));const n=this._univerInstanceService.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET);if(n){const o=n.getActiveSheet();if(!o)return;t(n.getUnitId(),o.getSheetId())}}refRangeHandle(t,n,o){switch(t.id){case _t.id:return this._getRefRangeMutationsByMoveRows(t.params,n,o);case bt.id:return this._getRefRangeMutationsByMoveCols(t.params,n,o);case ye.id:return this._getRefRangeMutationsByInsertRows(t.params,n,o);case _e.id:return this._getRefRangeMutationsByInsertCols(t.params,n,o);case Ft.id:return this._getRefRangeMutationsByDeleteCols(t.params,n,o);case Ht.id:return this._getRefRangeMutationsByDeleteRows(t.params,n,o)}return{redos:[],undos:[]}}_getRefRangeMutationsByDeleteCols(t,n,o){const r=this._selectionProtectionRuleModel.getSubunitRuleList(n,o).filter(l=>l.ranges.some(u=>i.Rectangle.intersects(u,t.range))),a=t.range;if(r.length){const l=[],u=[];return r.forEach(d=>{const c=i.Tools.deepClone(d),h=c.ranges.reduce((m,R)=>{if(i.Rectangle.intersects(R,a)){const C=i.Tools.deepClone(R),{startColumn:S,endColumn:I}=a;if(S<=C.startColumn&&I>=C.endColumn)return m;S>=C.startColumn&&I<=C.endColumn?C.endColumn-=I-S+1:S<C.startColumn?(C.startColumn=S,C.endColumn-=I-S+1):I>C.endColumn&&(C.endColumn=S-1),this._checkIsRightRange(C)&&m.push(C)}return m},[]);c.ranges=h,c.ranges.length?(l.push({id:ee.id,params:{unitId:n,subUnitId:o,rule:c,ruleId:d.id}}),u.push({id:ee.id,params:{unitId:n,subUnitId:o,rule:d,ruleId:d.id}})):(l.push({id:Ue.id,params:{unitId:n,subUnitId:o,ruleIds:[d.id]}}),u.push({id:Se.id,params:{unitId:n,subUnitId:o,name:"",rules:[d]}}))}),{redos:l,undos:u}}return{undos:[],redos:[]}}_getRefRangeMutationsByDeleteRows(t,n,o){const r=this._selectionProtectionRuleModel.getSubunitRuleList(n,o).filter(l=>l.ranges.some(u=>i.Rectangle.intersects(u,t.range))),a=t.range;if(r.length){const l=[],u=[];return r.forEach(d=>{const c=i.Tools.deepClone(d),h=c.ranges.reduce((m,R)=>{if(i.Rectangle.intersects(R,a)){const C=i.Tools.deepClone(R),{startRow:S,endRow:I}=a;if(S<=C.startRow&&I>=C.endRow)return m;S>=C.startRow&&I<=C.endRow?C.endRow-=I-S+1:S<C.startRow?(C.startRow=S,C.endRow-=I-S+1):I>C.endRow&&(C.endRow=S-1),this._checkIsRightRange(C)&&m.push(C)}return m},[]);c.ranges=h,l.push({id:ee.id,params:{unitId:n,subUnitId:o,rule:c,ruleId:d.id}}),u.push({id:ee.id,params:{unitId:n,subUnitId:o,rule:d,ruleId:d.id}})}),{redos:l,undos:u}}return{undos:[],redos:[]}}_getRefRangeMutationsByInsertCols(t,n,o){const r=t.range.startColumn,a=t.range.endColumn-t.range.startColumn+1,l=this._selectionProtectionRuleModel.getSubunitRuleList(n,o).filter(u=>u.ranges.some(d=>r>d.startColumn&&r<=d.endColumn));if(l.length){const u=[],d=[];return l.forEach(c=>{const h=i.Tools.deepClone(c);let m=!1;h.ranges.forEach(R=>{r>R.startColumn&&r<=R.endColumn&&(R.endColumn+=a,m=!0)}),m&&(u.push({id:ee.id,params:{unitId:n,subUnitId:o,rule:h,ruleId:c.id}}),d.push({id:ee.id,params:{unitId:n,subUnitId:o,rule:c,ruleId:c.id}}))}),{redos:u,undos:d}}return{undos:[],redos:[]}}_getRefRangeMutationsByInsertRows(t,n,o){const r=t.range.startRow,a=t.range.endRow-t.range.startRow+1,l=this._selectionProtectionRuleModel.getSubunitRuleList(n,o).filter(u=>u.ranges.some(d=>r>d.startRow&&r<=d.endRow));if(l.length){const u=[],d=[];return l.forEach(c=>{const h=i.Tools.deepClone(c);let m=!1;h.ranges.forEach(R=>{r>R.startRow&&r<=R.endRow&&(R.endRow+=a,m=!0)}),m&&(u.push({id:ee.id,params:{unitId:n,subUnitId:o,rule:h,ruleId:c.id}}),d.push({id:ee.id,params:{unitId:n,subUnitId:o,rule:c,ruleId:c.id}}))}),{redos:u,undos:d}}return{undos:[],redos:[]}}_getRefRangeMutationsByMoveRows(t,n,o){const r=t.toRange,a=r.startRow,l=r.endRow-r.startRow+1,u=this._selectionProtectionRuleModel.getSubunitRuleList(n,o).filter(d=>d.ranges.some(c=>a>c.startRow&&a<=c.endRow));if(u.length){const d=[],c=[];return u.forEach(h=>{const m=i.Tools.deepClone(h),C=t.fromRange.startRow;let S=!1;m.ranges.forEach(I=>{a>I.startRow&&a<=I.endRow&&(C<I.startRow&&(I.startRow=I.startRow-l,I.endRow=I.endRow-l),I.endRow+=l,S=!0)}),S&&(d.push({id:ee.id,params:{unitId:n,subUnitId:o,rule:m,ruleId:h.id}}),c.push({id:ee.id,params:{unitId:n,subUnitId:o,rule:h,ruleId:h.id}}))}),{redos:d,undos:c}}return{undos:[],redos:[]}}_getRefRangeMutationsByMoveCols(t,n,o){const r=t.toRange,a=r.startColumn,l=r.endColumn-r.startColumn+1,u=this._selectionProtectionRuleModel.getSubunitRuleList(n,o).filter(d=>d.ranges.some(c=>a>c.startColumn&&a<=c.endColumn));if(u.length){const d=[],c=[];return u.forEach(h=>{const m=i.Tools.deepClone(h),C=t.fromRange.startColumn;let S=!1;m.ranges.forEach(I=>{a>I.startColumn&&a<=I.endColumn&&(C<I.startColumn&&(I.startColumn=I.startColumn-l,I.endColumn=I.endColumn-l),I.endColumn+=l,S=!0)}),S&&(d.push({id:ee.id,params:{unitId:n,subUnitId:o,rule:m,ruleId:h.id}}),c.push({id:ee.id,params:{unitId:n,subUnitId:o,rule:h,ruleId:h.id}}))}),{redos:d,undos:c}}return{undos:[],redos:[]}}_correctPermissionRange(){this.disposeWithMe(this._commandService.onCommandExecuted(t=>{if(Yi.includes(t.id)){if(!t.params)return;const n=this._univerInstanceService.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET);if(!n)return;const o=n.getSheetBySheetId(t.params.subUnitId);if(!o)return;const{sourceRange:r,targetRange:a}=t.params,l=r.startColumn===a.startColumn&&r.endColumn===a.endColumn,u=l?r.endRow-r.startRow+1:r.endColumn-r.startColumn+1,d=l?r.startRow:r.startColumn,c=l?a.startRow:a.startColumn;this._selectionProtectionRuleModel.getSubunitRuleList(n.getUnitId(),o.getSheetId()).forEach(I=>{I.ranges.forEach(M=>{let{startRow:p,endRow:w,startColumn:y,endColumn:b}=M;i.Rectangle.intersects(M,r)||(l?d<p&&c>w?(p-=u,w-=u):d>w&&c<=p&&(p+=u,w+=u):d<y&&c>b?(y-=u,b-=u):d>b&&c<=y&&(y+=u,b+=u)),this._checkIsRightRange({startRow:p,endRow:w,startColumn:y,endColumn:b})&&(M.startColumn=y,M.endColumn=b,M.startRow=p,M.endRow=w)})}),this.disposableCollection.dispose();const{unitId:m,subUnitId:R}=t.params,C=I=>this.refRangeHandle(I,m,R);this._selectionProtectionRuleModel.getSubunitRuleList(m,R).reduce((I,v)=>[...I,...v.ranges],[]).forEach(I=>{this.disposableCollection.add(this._refRangeService.registerRefRange(I,C,m,R))}),this._selectionProtectionRenderModel.clear()}if(qi.includes(t.id)){const n=this._univerInstanceService.getUniverSheetInstance(t.params.unitId);if(!n)return;const o=n.getSheetBySheetId(t.params.subUnitId);if(!o)return;const r=t.params;if(!r)return;const{range:a}=r,l=t.id.includes("row"),u=t.id.includes("insert"),d=l?a.startRow:a.startColumn,c=l?a.endRow:a.endColumn,h=c-d+1;this._selectionProtectionRuleModel.getSubunitRuleList(n.getUnitId(),o.getSheetId()).forEach(v=>{v.ranges.forEach(p=>{let{startRow:w,endRow:y,startColumn:b,endColumn:U}=p;u?l?d<=w&&(w+=h,y+=h):d<=b&&(b+=h,U+=h):l?c<w&&(w-=h,y-=h):c<b&&(b-=h,U-=h),this._checkIsRightRange({startRow:w,endRow:y,startColumn:b,endColumn:U})&&(p.startColumn=b,p.endColumn=U,p.startRow=w,p.endRow=y)})}),this.disposableCollection.dispose();const{unitId:R,subUnitId:C}=t.params,S=v=>this.refRangeHandle(v,R,C);this._selectionProtectionRuleModel.getSubunitRuleList(R,C).reduce((v,M)=>[...v,...M.ranges],[]).forEach(v=>{this.disposableCollection.add(this._refRangeService.registerRefRange(v,S,R,C))}),this._selectionProtectionRenderModel.clear()}}))}_checkIsRightRange(t){return t.startRow<=t.endRow&&t.startColumn<=t.endColumn}_initReBuildCache(){this.disposeWithMe(this._commandService.onCommandExecuted(t=>{if(qi.includes(t.id)||Yi.includes(t.id)){const{unitId:n,subUnitId:o}=t.params;this._rangeProtectionCache.reBuildCache(n,o)}}))}_initRemoveSheet(){this._sheetInterceptorService.interceptCommand({getMutations:t=>{const n=[],o=[],r=[],a=[];if(t.id===wn.id){const l=t.params,u=[],d=[];this._rangeProtectionRuleModel.getSubunitRuleList(l.unitId,l.subUnitId).forEach(c=>{u.push(c.id),d.push(c)}),u.length&&d.length&&(r.push({id:Ue.id,params:{unitId:l.unitId,subUnitId:l.subUnitId,ruleIds:u}}),n.push({id:Se.id,params:{unitId:l.unitId,subUnitId:l.subUnitId,name:"",rules:d}}))}return{redos:o,undos:n,preRedos:r,preUndos:a}}})}},g.RangeProtectionRefRangeService=Vd([Ke(0,i.Inject(X)),Ke(1,i.Inject(i.IUniverInstanceService)),Ke(2,i.ICommandService),Ke(3,i.Inject(g.RefRangeService)),Ke(4,i.Inject(g.RangeProtectionRenderModel)),Ke(5,i.Inject(g.RangeProtectionCache)),Ke(6,i.Inject(g.SheetInterceptorService)),Ke(7,i.Inject(X))],g.RangeProtectionRefRangeService);var Ld=Object.getOwnPropertyDescriptor,$d=(s,e,t,n)=>{for(var o=n>1?void 0:n?Ld(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},en=(s,e)=>(t,n)=>e(t,n,s);const Bd="SHEET_RANGE_PROTECTION_PLUGIN";g.RangeProtectionService=class extends i.Disposable{constructor(e,t,n,o,r){super(),this._selectionProtectionRuleModel=e,this._permissionService=t,this._resourceManagerService=n,this._selectionProtectionCache=o,this._univerInstanceService=r,this._initSnapshot(),this._initRuleChange()}_initRuleChange(){this.disposeWithMe(this._selectionProtectionRuleModel.ruleChange$.subscribe(e=>{switch(e.type){case"add":{de().forEach(t=>{const n=new t(e.unitId,e.subUnitId,e.rule.permissionId);this._permissionService.addPermissionPoint(n)});break}case"delete":{de().forEach(t=>{const n=new t(e.unitId,e.subUnitId,e.rule.permissionId);this._permissionService.deletePermissionPoint(n.id)});break}case"set":{e.oldRule.permissionId!==e.rule.permissionId&&de().forEach(t=>{const n=new t(e.unitId,e.subUnitId,e.oldRule.permissionId);this._permissionService.deletePermissionPoint(n.id);const o=new t(e.unitId,e.subUnitId,e.rule.permissionId);this._permissionService.addPermissionPoint(o)});break}}}))}_initSnapshot(){const e=n=>{const r=this._selectionProtectionRuleModel.toObject()[n];return r?JSON.stringify(r):""},t=n=>{if(!n)return{};try{return JSON.parse(n)}catch{return{}}};this.disposeWithMe(this._resourceManagerService.registerPluginResource({toJson:e,parseJson:t,pluginName:Bd,businesses:[un.UNIVER_SHEET],onLoad:(n,o)=>{const r=this._selectionProtectionRuleModel.toObject();r[n]=o,this._selectionProtectionRuleModel.fromObject(r);const a=[];Object.keys(o).forEach(l=>{const u=o[l];this._selectionProtectionRuleModel.getSubunitRuleList(n,l).forEach(d=>{a.push({objectID:d.permissionId,unitID:n,objectType:D.SelectRange,actions:Ye})}),u.forEach(d=>{de().forEach(c=>{const h=new c(n,l,d.permissionId);h.value=!1,this._permissionService.addPermissionPoint(h)})}),this._selectionProtectionCache.reBuildCache(n,l)})},onUnLoad:n=>{this._selectionProtectionCache.deleteUnit(n)}}))}},g.RangeProtectionService=$d([en(0,i.Inject(X)),en(1,i.Inject(i.IPermissionService)),en(2,i.Inject(i.IResourceManagerService)),en(3,i.Inject(g.RangeProtectionCache)),en(4,i.Inject(i.IUniverInstanceService))],g.RangeProtectionService);var Hd=Object.getOwnPropertyDescriptor,Fd=(s,e,t,n)=>{for(var o=n>1?void 0:n?Hd(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},jd=(s,e)=>(t,n)=>e(t,n,s);g.SheetRangeThemeService=class extends i.Disposable{constructor(e){super(),this._sheetRangeThemeModel=e}registerRangeTheme(e,t){this._sheetRangeThemeModel.registerRangeThemeStyle(e,t)}removeRangeThemeRule(e,t){this._sheetRangeThemeModel.removeRangeThemeRule(e,t)}getALLRegisterThemes(e){return this._sheetRangeThemeModel.getALLRegisteredTheme(e)}registerRangeThemeStyle(e,t){this._sheetRangeThemeModel.registerRangeThemeRule(e,t)}getAppliedRangeThemeStyle(e){return this._sheetRangeThemeModel.getRegisteredRangeThemeStyle(e)}getRegisteredRangeThemes(){return this._sheetRangeThemeModel.getRegisteredRangeThemes()}},g.SheetRangeThemeService=Fd([jd(0,i.Inject(g.SheetRangeThemeModel))],g.SheetRangeThemeService);var Gd=Object.defineProperty,zd=Object.getOwnPropertyDescriptor,qd=(s,e,t)=>e in s?Gd(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,Yd=(s,e,t,n)=>{for(var o=n>1?void 0:n?zd(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},xi=(s,e)=>(t,n)=>e(t,n,s),Ki=(s,e,t)=>qd(s,typeof e!="symbol"?e+"":e,t);const xd="SHEET_PLUGIN";g.UniverSheetsPlugin=class extends i.Plugin{constructor(e=Hr,t,n){super(),this._config=e,this._injector=t,this._configService=n;const{...o}=i.merge({},Hr,this._config);this._configService.setConfig(zt,o),this._initConfig(),this._initDependencies()}_initConfig(){var e,t,n;(e=this._config)!=null&&e.onlyRegisterFormulaRelatedMutations&&this._configService.setConfig(ji,!0),(t=this._config)!=null&&t.isRowStylePrecedeColumnStyle&&this._configService.setConfig(i.IS_ROW_STYLE_PRECEDE_COLUMN_STYLE,!0),(n=this._config)!=null&&n.autoHeightForMergedCells&&this._configService.setConfig(i.AUTO_HEIGHT_FOR_MERGED_CELLS,!0)}_initDependencies(){var t;const e=[[at],[g.SheetLazyExecuteScheduleService],[g.SheetsSelectionsService],[g.RefRangeService],[g.WorkbookPermissionService],[ut,{useClass:g.NumfmtService}],[g.SheetInterceptorService],[g.SheetRangeThemeService],[g.SheetSkeletonService],[Dn],[g.MergeCellController],[Wn],[g.DefinedNameDataController],[g.ZebraCrossingCacheController],[g.SheetsFreezeSyncController],[g.WorksheetPermissionService],[Ne],[Nt],[Ln],[g.SheetPermissionInitController],[g.SheetPermissionCheckController],[g.SheetRangeThemeModel],[g.RangeProtectionRenderModel],[X],[g.RangeProtectionCache],[g.RangeProtectionRefRangeService],[g.RangeProtectionService],[so,{useClass:zi,deps:[g.SheetsSelectionsService]}]];(t=this._config)!=null&&t.notExecuteFormula||e.push([An]),i.registerDependencies(this._injector,i.mergeOverrideWithDependencies(e,this._config.override)),i.touchDependencies(this._injector,[[g.SheetInterceptorService],[g.RangeProtectionService],[so],[g.SheetPermissionInitController],[g.SheetsFreezeSyncController]])}onStarting(){var e;i.touchDependencies(this._injector,[[Dn],[g.MergeCellController],[g.WorkbookPermissionService],[g.WorksheetPermissionService],[Ln],[g.SheetSkeletonService]]),(e=this._config)!=null&&e.onlyRegisterFormulaRelatedMutations||this._injector.add([On])}onRendered(){i.touchDependencies(this._injector,[[ut]])}onReady(){i.touchDependencies(this._injector,[[On],[An],[g.DefinedNameDataController],[g.ZebraCrossingCacheController],[g.SheetRangeThemeModel],[Wn],[g.RangeProtectionRenderModel],[g.RangeProtectionRefRangeService],[g.RefRangeService],[g.SheetPermissionCheckController]])}},Ki(g.UniverSheetsPlugin,"pluginName",xd),Ki(g.UniverSheetsPlugin,"type",i.UniverInstanceType.UNIVER_SHEET),g.UniverSheetsPlugin=Yd([i.DependentOn(K.UniverFormulaEnginePlugin),xi(1,i.Inject(i.Injector)),xi(2,i.IConfigService)],g.UniverSheetsPlugin);const Kd={WorkbookCommentPermission:Jn,WorkbookCopyPermission:Xn,WorkbookCreateProtectPermission:Zn,WorkbookCreateSheetPermission:Qn,WorkbookDeleteSheetPermission:es,WorkbookDuplicatePermission:ts,WorkbookEditablePermission:me,WorkbookExportPermission:ns,WorkbookHideSheetPermission:cn,WorkbookHistoryPermission:Ko,WorkbookManageCollaboratorPermission:hn,WorkbookMoveSheetPermission:mn,WorkbookPrintPermission:ss,WorkbookRecoverHistoryPermission:os,WorkbookRenameSheetPermission:gn,WorkbookSharePermission:rs,WorkbookViewHistoryPermission:as,WorkbookViewPermission:is,WorksheetCopyPermission:ls,WorksheetDeleteColumnPermission:us,WorksheetDeleteProtectionPermission:ds,WorksheetDeleteRowPermission:cs,WorksheetEditExtraObjectPermission:hs,WorksheetEditPermission:Ie,WorksheetFilterPermission:ms,WorksheetInsertColumnPermission:gs,WorksheetInsertHyperlinkPermission:Rs,WorksheetInsertRowPermission:Cs,WorksheetManageCollaboratorPermission:Ss,WorksheetPivotTablePermission:fs,WorksheetSetCellStylePermission:Is,WorksheetSetCellValuePermission:$t,WorksheetSetColumnStylePermission:pt,WorksheetSetRowStylePermission:wt,WorksheetSortPermission:vs,WorksheetViewPermission:Bt,RangeProtectionPermissionEditPoint:fe,RangeProtectionPermissionViewPoint:dn},Jd=(s,e,t,n)=>{const o=s.get(i.IPermissionService),r=s.get(X),a=o.getPermissionPoint(new me(e).id);if(!(a!=null&&a.value))return!1;const l=o.getPermissionPoint(new Ie(e,t).id);if(!(l!=null&&l.value))return!1;const d=r.getSubunitRuleList(e,t).filter(c=>c.ranges.some(h=>n.some(m=>i.Rectangle.intersects(h,m))));return d.length?d.every(c=>{const h=c.permissionId,m=o.getPermissionPoint(new fe(e,t,h).id);return!!(m!=null&&m.value)}):!0},Ji=(s,e,t,n=1,o=!0,r=!0)=>{const a=i.Range.transformRange(s,e),{startRow:l,endRow:u}=a;let d=t.startRow-n,c=e.getMergedCell(d,t.startColumn),h=!c||c.startRow===d&&c.startColumn===t.startColumn;for(;!e.getRowVisible(d)||!h;)d--,c=e.getMergedCell(d,t.startColumn),h=!c||c.startRow===d&&c.startColumn===t.startColumn;if(d>=l)return{...t,startRow:d,endRow:d};if(r){const m={...t,startRow:u,endRow:u};return Zi(s,e,m,n,o,!1)}},Xi=(s,e,t,n=1,o=!0,r=!0)=>{const a=i.Range.transformRange(s,e),{startRow:l,endRow:u}=a;let d=t.endRow+n,c=e.getMergedCell(d,t.startColumn),h=!c||c.startRow===d&&c.startColumn===t.startColumn;for(;!e.getRowVisible(d)||!h;)d++,c=e.getMergedCell(d,t.startColumn),h=!c||c.startRow===d&&c.startColumn===t.startColumn;if(d<=u)return{...t,startRow:d,endRow:d};if(r){const m={...t,startRow:l,endRow:l};return Qi(s,e,m,n,o,!1)}},Zi=(s,e,t,n=1,o=!0,r=!0)=>{const a=i.Range.transformRange(s,e),{startColumn:l,endColumn:u}=a;let d=t.startColumn-n,c=e.getMergedCell(t.startRow,d),h=!c||c.startRow===t.startRow&&c.startColumn===d;for(;!e.getColVisible(d)||!h;)d--,c=e.getMergedCell(t.startRow,d),h=!c||c.startRow===t.startRow&&c.startColumn===d;if(d>=l)return{...t,startColumn:d,endColumn:d};if(r){const m={...t,startColumn:u,endColumn:u};return Ji(s,e,m,n,o,!1)}},Qi=(s,e,t,n=1,o=!0,r=!0)=>{const a=i.Range.transformRange(s,e),{startColumn:l,endColumn:u}=a;let d=t.endColumn+n,c=e.getMergedCell(t.startRow,d),h=!c||c.startRow===t.startRow&&c.startColumn===d;for(;!e.getColVisible(d)||!h;)d++,c=e.getMergedCell(t.startRow,d),h=!c||c.startRow===t.startRow&&c.startColumn===d;if(d<=u)return{...t,endColumn:d,startColumn:d};if(r){const m={...t,startColumn:l,endColumn:l};return Xi(s,e,m,n,o,!1)}};function $n(s,e,t){let n=null;return t.getMatrixWithMergedCells(s,e,s,e).forValue((r,a,l)=>(n={actualRow:r,actualColumn:a,startRow:r,startColumn:a,isMerged:l.rowSpan!==void 0||l.colSpan!==void 0,isMergedMainCell:l.rowSpan!==void 0&&l.colSpan!==void 0,endRow:r+(l.rowSpan!==void 0?l.rowSpan-1:0),endColumn:a+(l.colSpan!==void 0?l.colSpan-1:0),rangeType:i.RANGE_TYPE.NORMAL},!1)),n||{actualColumn:e,actualRow:s,startRow:s,startColumn:e,endRow:s,endColumn:e,isMerged:!1,isMergedMainCell:!1,rangeType:i.RANGE_TYPE.NORMAL}}const Xd=(s,e,t,n,o=1)=>{switch(n){case i.Direction.UP:return Ji(s,e,t,o);case i.Direction.DOWN:return Xi(s,e,t,o);case i.Direction.LEFT:return Zi(s,e,t,o);case i.Direction.RIGHT:return Qi(s,e,t,o)}},Zd=(s,e,t)=>{let n,o=-1,r;for(let v=0;v<s.length;v++)if(s[v].primary){n=s[v],o=v,r=n.primary;break}if(o===-1)return null;const a=e===i.Direction.LEFT||e===i.Direction.UP,l=a?o-1>=0?o-1:s.length-1:o+1<s.length?o+1:0,u=s[l];if(!n||!r)return null;const d={...r},{startRow:c,startColumn:h,endRow:m,endColumn:R}=n.range,C=a?d.startRow===c&&d.startColumn===h:d.endRow===m&&d.endColumn===R,S=C&&a;if(!i.Rectangle.equals(n.range,d)){const v=C?u.range:Xd(n.range,t,d,e);if(!v)return null;const M=S?$n(v.endRow,v.endColumn,t):$n(v.startRow,v.startColumn,t);return{startRow:M.startRow,startColumn:M.startColumn,endRow:M.endRow,endColumn:M.endColumn}}const I=S?$n(u.range.endRow,u.range.endColumn,t):$n(u.range.startRow,u.range.startColumn,t);return{startRow:I.startRow,startColumn:I.startColumn,endRow:I.endRow,endColumn:I.endColumn}};g.AFTER_CELL_EDIT=tn,g.AddMergeRedoSelectionsOperationFactory=Pr,g.AddMergeUndoMutationFactory=Re,g.AddMergeUndoSelectionsOperationFactory=Nr,g.AddRangeProtectionCommand=Lo,g.AddRangeProtectionMutation=Se,g.AddRangeThemeMutation=Pi,g.AddWorksheetMergeAllCommand=Ar,g.AddWorksheetMergeCommand=ot,g.AddWorksheetMergeHorizontalCommand=Vr,g.AddWorksheetMergeMutation=j,g.AddWorksheetMergeVerticalCommand=Wr,g.AddWorksheetProtectionCommand=Lr,g.AddWorksheetProtectionMutation=qe,g.AppendRowCommand=Br,g.BEFORE_CELL_EDIT=Fn,g.BorderStyleManagerService=at,g.COMMAND_LISTENER_SKELETON_CHANGE=ja,g.COMMAND_LISTENER_VALUE_CHANGE=Ga,g.CancelFrozenCommand=ri,g.CancelMarkDirtyRowAutoHeightMutation=Di,g.ClearSelectionAllCommand=rn,g.ClearSelectionContentCommand=vn,g.ClearSelectionFormatCommand=an,g.CopySheetCommand=Gr,g.CopyWorksheetEndMutation=Vs,g.DISABLE_NORMAL_SELECTIONS=vl,g.DeleteRangeMoveLeftCommand=Ge,g.DeleteRangeMoveUpCommand=ze,g.DeleteRangeProtectionCommand=zr,g.DeleteRangeProtectionMutation=Ue,g.DeleteWorksheetProtectionCommand=qr,g.DeleteWorksheetProtectionMutation=rt,g.DeleteWorksheetRangeThemeStyleCommand=Yr,g.DeleteWorksheetRangeThemeStyleMutation=ct,g.DeleteWorksheetRangeThemeStyleMutationFactory=mo,g.DeltaColumnWidthCommand=Yt,g.DeltaRowHeightCommand=Xt,g.EditStateEnum=Vo,g.EffectRefRangId=A,g.EmptyMutation=Ni,g.ExclusiveRangeService=zi,g.FactoryAddRangeProtectionMutation=Cl,g.FactoryDeleteRangeProtectionMutation=Rl,g.FactorySetRangeProtectionMutation=Nu,g.IExclusiveRangeService=so,g.INTERCEPTOR_POINT=Ve,g.INumfmtService=ut,g.IRefSelectionsService=Fo,g.InsertColAfterCommand=ar,g.InsertColBeforeCommand=ir,g.InsertColByRangeCommand=_s,g.InsertColCommand=_e,g.InsertColMutation=ae,g.InsertColMutationUndoFactory=At,g.InsertDefinedNameCommand=xr,g.InsertMultiColsLeftCommand=lr,g.InsertMultiColsRightCommand=ur,g.InsertMultiRowsAboveCommand=sr,g.InsertMultiRowsAfterCommand=or,g.InsertRangeMoveDownCommand=et,g.InsertRangeMoveRightCommand=yt,g.InsertRowAfterCommand=nr,g.InsertRowBeforeCommand=tr,g.InsertRowByRangeCommand=ys,g.InsertRowCommand=ye,g.InsertRowMutation=ie,g.InsertRowMutationUndoFactory=sn,g.InsertSheetCommand=Kr,g.InsertSheetMutation=it,g.InsertSheetUndoMutationFactory=Ls,g.InterceptCellContentPriority=io,g.MAX_CELL_PER_SHEET_KEY=Li,g.MERGE_CELL_INTERCEPTOR_CHECK=kr,g.MarkDirtyRowAutoHeightMutation=Oi,g.MoveColsCommand=bt,g.MoveColsMutation=Me,g.MoveColsMutationUndoFactory=Ro,g.MoveRangeCommand=Qe,g.MoveRangeMutation=Fe,g.MoveRowsCommand=_t,g.MoveRowsMutation=we,g.MoveRowsMutationUndoFactory=go,g.OperatorType=B,g.PermissionPointsDefinitions=Kd,g.REF_SELECTIONS_ENABLED=Bo,g.RangeMergeUtil=tl,g.RangeProtectionPermissionDeleteProtectionPoint=Ks,g.RangeProtectionPermissionEditPoint=fe,g.RangeProtectionPermissionManageCollaPoint=Js,g.RangeProtectionPermissionViewPoint=dn,g.RangeProtectionRuleModel=X,g.RangeThemeStyle=Le,g.RegisterWorksheetRangeThemeStyleCommand=Jr,g.RegisterWorksheetRangeThemeStyleMutation=Tt,g.RemoveColByRangeCommand=Es,g.RemoveColCommand=Ft,g.RemoveColMutation=se,g.RemoveDefinedNameCommand=$s,g.RemoveMergeUndoMutationFactory=ue,g.RemoveNumfmtMutation=Zs,g.RemoveRangeThemeMutation=Ai,g.RemoveRowByRangeCommand=bs,g.RemoveRowCommand=Ht,g.RemoveRowMutation=le,g.RemoveSheetCommand=wn,g.RemoveSheetMutation=He,g.RemoveSheetUndoMutationFactory=dr,g.RemoveWorksheetMergeCommand=Xr,g.RemoveWorksheetMergeMutation=G,g.ReorderRangeCommand=Sn,g.ReorderRangeMutation=Wt,g.ReorderRangeUndoMutationFactory=Co,g.ResetBackgroundColorCommand=mi,g.ResetTextColorCommand=ci,g.SCOPE_WORKBOOK_VALUE_DEFINED_NAME=id,g.SELECTIONS_ENABLED=pl,g.SELECTION_CONTROL_BORDER_BUFFER_COLOR=sl,g.SELECTION_CONTROL_BORDER_BUFFER_WIDTH=nl,g.SHEETS_PLUGIN_CONFIG_KEY=zt,g.ScrollToCellOperation=Vi,g.SelectRangeCommand=Go,g.SelectionMoveType=Q,g.SetBackgroundColorCommand=hi,g.SetBoldCommand=Wu,g.SetBorderBasicCommand=ti,g.SetBorderColorCommand=ei,g.SetBorderCommand=Ut,g.SetBorderPositionCommand=Zr,g.SetBorderStyleCommand=Qr,g.SetColDataCommand=ni,g.SetColDataMutation=ht,g.SetColDataMutationFactory=So,g.SetColHiddenCommand=yn,g.SetColHiddenMutation=mt,g.SetColVisibleMutation=gt,g.SetColWidthCommand=xt,g.SetDefinedNameCommand=Fs,g.SetFontFamilyCommand=Hu,g.SetFontSizeCommand=Fu,g.SetFrozenCommand=oi,g.SetFrozenMutation=Oe,g.SetFrozenMutationFactory=js,g.SetGridlinesColorCommand=ii,g.SetGridlinesColorMutation=Rt,g.SetHorizontalTextAlignCommand=Ri,g.SetItalicCommand=Vu,g.SetNumfmtMutation=Pn,g.SetOverlineCommand=Bu,g.SetProtectionCommand=ai,g.SetRangeProtectionMutation=ee,g.SetRangeThemeMutation=Wi,g.SetRangeValuesCommand=Mt,g.SetRangeValuesMutation=F,g.SetRangeValuesUndoMutationFactory=he,g.SetRowDataCommand=li,g.SetRowDataMutation=Ct,g.SetRowDataMutationFactory=vo,g.SetRowHeightCommand=Zt,g.SetRowHiddenCommand=_n,g.SetRowHiddenMutation=Xe,g.SetRowVisibleMutation=Je,g.SetSelectedColsVisibleCommand=Hs,g.SetSelectedRowsVisibleCommand=Gs,g.SetSelectionsOperation=q,g.SetSpecificColsVisibleCommand=kt,g.SetSpecificRowsVisibleCommand=Pt,g.SetStrikeThroughCommand=$u,g.SetStyleCommand=te,g.SetTabColorCommand=fi,g.SetTabColorMutation=qt,g.SetTextColorCommand=di,g.SetTextRotationCommand=Si,g.SetTextWrapCommand=Ci,g.SetUnderlineCommand=Lu,g.SetVerticalTextAlignCommand=gi,g.SetWorkbookNameCommand=qs,g.SetWorkbookNameMutation=zs,g.SetWorksheetActivateCommand=Ys,g.SetWorksheetActiveOperation=Ze,g.SetWorksheetColWidthMutation=$e,g.SetWorksheetColWidthMutationFactory=Gn,g.SetWorksheetColumnCountCommand=Ii,g.SetWorksheetColumnCountMutation=St,g.SetWorksheetColumnCountUndoMutationFactory=po,g.SetWorksheetDefaultStyleCommand=vi,g.SetWorksheetDefaultStyleMutation=ft,g.SetWorksheetDefaultStyleMutationFactory=wo,g.SetWorksheetHideCommand=wi,g.SetWorksheetHideMutation=De,g.SetWorksheetNameCommand=bn,g.SetWorksheetNameMutation=Kt,g.SetWorksheetOrderCommand=xs,g.SetWorksheetOrderMutation=Jt,g.SetWorksheetPermissionPointsCommand=yi,g.SetWorksheetPermissionPointsMutation=Tn,g.SetWorksheetProtectionCommand=_i,g.SetWorksheetProtectionMutation=lt,g.SetWorksheetRangeThemeStyleCommand=$r,g.SetWorksheetRangeThemeStyleMutation=dt,g.SetWorksheetRangeThemeStyleMutationFactory=ho,g.SetWorksheetRightToLeftCommand=Qu,g.SetWorksheetRightToLeftMutation=Un,g.SetWorksheetRowAutoHeightMutation=qn,g.SetWorksheetRowAutoHeightMutationFactory=Fa,g.SetWorksheetRowCountCommand=bi,g.SetWorksheetRowCountMutation=It,g.SetWorksheetRowCountUndoMutationFactory=Mo,g.SetWorksheetRowHeightMutation=Te,g.SetWorksheetRowIsAutoHeightCommand=kn,g.SetWorksheetRowIsAutoHeightMutation=Ce,g.SetWorksheetShowCommand=Xs,g.SheetSkeletonChangeType=_o,g.SheetValueChangeType=bo,g.SplitDelimiterEnum=No,g.SplitTextToColumnsCommand=Ei,g.ToggleCellCheckboxCommand=Ti,g.ToggleGridlinesCommand=Ui,g.ToggleGridlinesMutation=vt,g.UnitAction=_,g.UnitObject=D,g.UnregisterWorksheetRangeThemeStyleCommand=ki,g.UnregisterWorksheetRangeThemeStyleMutation=pn,g.VALIDATE_CELL=nn,g.ViewStateEnum=Wo,g.WorkbookCommentPermission=Jn,g.WorkbookCopyPermission=Xn,g.WorkbookCopySheetPermission=qo,g.WorkbookCreateProtectPermission=Zn,g.WorkbookCreateSheetPermission=Qn,g.WorkbookDeleteColumnPermission=Yo,g.WorkbookDeleteRowPermission=xo,g.WorkbookDeleteSheetPermission=es,g.WorkbookDuplicatePermission=ts,g.WorkbookEditablePermission=me,g.WorkbookExportPermission=ns,g.WorkbookHideSheetPermission=cn,g.WorkbookHistoryPermission=Ko,g.WorkbookInsertColumnPermission=Jo,g.WorkbookInsertRowPermission=Xo,g.WorkbookManageCollaboratorPermission=hn,g.WorkbookMoveSheetPermission=mn,g.WorkbookPrintPermission=ss,g.WorkbookRecoverHistoryPermission=os,g.WorkbookRenameSheetPermission=gn,g.WorkbookSelectionModel=$o,g.WorkbookSharePermission=rs,g.WorkbookViewHistoryPermission=as,g.WorkbookViewPermission=is,g.WorksheetCopyPermission=ls,g.WorksheetDeleteColumnPermission=us,g.WorksheetDeleteProtectionPermission=ds,g.WorksheetDeleteRowPermission=cs,g.WorksheetEditExtraObjectPermission=hs,g.WorksheetEditPermission=Ie,g.WorksheetFilterPermission=ms,g.WorksheetInsertColumnPermission=gs,g.WorksheetInsertHyperlinkPermission=Rs,g.WorksheetInsertRowPermission=Cs,g.WorksheetManageCollaboratorPermission=Ss,g.WorksheetPivotTablePermission=fs,g.WorksheetProtectionPointModel=Nt,g.WorksheetProtectionRuleModel=Ne,g.WorksheetSelectProtectedCellsPermission=kl,g.WorksheetSelectUnProtectedCellsPermission=Pl,g.WorksheetSetCellStylePermission=Is,g.WorksheetSetCellValuePermission=$t,g.WorksheetSetColumnStylePermission=pt,g.WorksheetSetRowStylePermission=wt,g.WorksheetSortPermission=vs,g.WorksheetViewPermission=Bt,g.addMergeCellsUtil=Cu,g.adjustRangeOnMutation=yr,g.alignToMergedCellsBorders=Lt,g.baseProtectionActions=Ye,g.checkCellValueType=Bn,g.checkRangesEditablePermission=Jd,g.convertPrimaryWithCoordToPrimary=Po,g.convertSelectionDataToRange=ol,g.copyRangeStyles=Be,g.countCells=gr,g.createTopMatrixFromMatrix=Uo,g.createTopMatrixFromRanges=To,g.defaultLargeSheetOperationConfig=Ws,g.defaultWorkbookPermissionPoints=Mi,g.defaultWorksheetPermissionPoint=En,g.expandToContinuousRange=Qa,g.factoryRemoveNumfmtUndoMutation=td,g.factorySetNumfmtUndoMutation=ed,g.findAllRectangle=Yn,g.findFirstNonEmptyCell=ml,g.followSelectionOperation=ke,g.generateNullCell=Kn,g.generateNullCellValue=Do,g.getAddMergeMutationRangeByType=Ds,g.getAllRangePermissionPoint=de,g.getAllWorkbookPermissionPoint=Ot,g.getAllWorksheetPermissionPoint=ce,g.getAllWorksheetPermissionPointByPointPanel=pe,g.getCellAtRowCol=wl,g.getClearContentMutationParamForRange=Dr,g.getClearContentMutationParamsForRanges=Or,g.getDefaultRangePermission=Yu,g.getInsertRangeMutations=ps,g.getMoveRangeUndoRedoMutations=ln,g.getNextPrimaryCell=Zd,g.getPrimaryForRange=oe,g.getRemoveRangeMutations=ws,g.getSelectionsService=jo,g.getSeparateEffectedRangesOnCommand=su,g.getSheetCommandTarget=P,g.getSheetCommandTargetWorkbook=Hn,g.getSheetMutationTarget=ne,g.getSkeletonChangedEffectedRange=qa,g.getValueChangedEffectedRange=za,g.getVisibleRanges=Vt,g.handleBaseInsertRange=nt,g.handleBaseMoveRowsCols=Gt,g.handleBaseRemoveRange=tt,g.handleCommonDefaultRangeChangeWithEffectRefCommands=Os,g.handleCommonRangeChangeWithEffectRefCommandsSkipNoInterests=tu,g.handleDefaultRangeChangeWithEffectRefCommands=Ns,g.handleDefaultRangeChangeWithEffectRefCommandsSkipNoInterests=eu,g.handleDeleteRangeMoveLeft=wr,g.handleDeleteRangeMoveUp=Mr,g.handleDeleteRangeMutation=Ol,g.handleIRemoveCol=Ps,g.handleIRemoveRow=Sr,g.handleInsertCol=Ir,g.handleInsertRangeMoveDown=vr,g.handleInsertRangeMoveRight=pr,g.handleInsertRangeMutation=Nl,g.handleInsertRow=fr,g.handleMoveCols=ks,g.handleMoveRange=Cr,g.handleMoveRows=Us,g.isSingleCellSelection=yl,g.rangeMerge=xn,g.rangeToDiscreteRange=Ao,g.rotateRange=ge,g.runRefRangeMutations=st,g.setEndForRange=Ml,g.splitRangeText=Oo,g.transformCellsToRange=Nn,Object.defineProperty(g,Symbol.toStringTag,{value:"Module"})}));
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
// @univerjs/sheets/facade
|
|
16
|
-
(function(c,h){typeof exports=="object"&&typeof module<"u"?h(exports,require("@univerjs/core"),require("@univerjs/core/facade"),require("@univerjs/sheets"),require("@univerjs/engine-formula"),require("rxjs"),require("rxjs/operators")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/core/facade","@univerjs/sheets","@univerjs/engine-formula","rxjs","rxjs/operators"],h):(c=typeof globalThis<"u"?globalThis:c||self,h(c.UniverSheetsFacade={},c.UniverCore,c.UniverCoreFacade,c.UniverSheets,c.UniverEngineFormula,c.rxjs,c.rxjs.operators))})(this,(function(c,h,b,s,P,j,C){"use strict";var De=Object.defineProperty;var je=(c,h,b)=>h in c?De(c,h,{enumerable:!0,configurable:!0,writable:!0,value:b}):c[h]=b;var w=(c,h,b)=>je(c,typeof h!="symbol"?h+"":h,b);var D;var te=Object.getOwnPropertyDescriptor,ne=(r,n,e,t)=>{for(var i=t>1?void 0:t?te(n,e):n,o=r.length-1,a;o>=0;o--)(a=r[o])&&(i=a(i)||i);return i},p=(r,n)=>(e,t)=>n(e,t,r);function ie(r,n,e){const t=e.getDefinedNameMap(r);if(t==null)return n.t("definedName.defaultName")+1;const o=Array.from(Object.values(t)).length+1,a=n.t("definedName.defaultName")+o;if(e.getValueByName(r,a)==null)return a;let d=o+1;for(;;){const u=n.t("definedName.defaultName")+d;if(e.getValueByName(r,u)==null)return u;d++}}class V{constructor(){w(this,"_definedNameParam");this._definedNameParam={id:h.generateRandomId(10),unitId:"",name:"",formulaOrRefString:"",localSheetId:s.SCOPE_WORKBOOK_VALUE_DEFINED_NAME}}setName(n){return this._definedNameParam.name=n,this}setFormula(n){return this._definedNameParam.formulaOrRefString=`=${n}`,this}setRef(n){return this._definedNameParam.formulaOrRefString=n,this}setRefByRange(n,e,t,i){return this._definedNameParam.formulaOrRefString=P.serializeRange({startRow:n,endRow:n+(t!=null?t:1)-1,startColumn:e,endColumn:e+(i!=null?i:1)-1}),this}setComment(n){return this._definedNameParam.comment=n,this}setScopeToWorksheet(n){return this._definedNameParam.localSheetId=n.getSheetId(),this}setScopeToWorkbook(){return this._definedNameParam.localSheetId=s.SCOPE_WORKBOOK_VALUE_DEFINED_NAME,this}setHidden(n){return this._definedNameParam.hidden=n,this}build(){return this._definedNameParam}load(n){return this._definedNameParam=n,this}}let A=class extends b.FBase{constructor(r,n,e,t,i,o,a,d,u,l){super(),this._definedNameParam=r,this._injector=n,this._commandService=e,this._permissionService=t,this._worksheetProtectionRuleModel=i,this._rangeProtectionRuleModel=o,this._worksheetProtectionPointRuleModel=a,this._authzIoService=d,this._localeService=u,this._definedNamesService=l}_apply(){this._definedNameParam.name===""&&(this._definedNameParam.name=ie(this._definedNameParam.unitId,this._localeService,this._definedNamesService)),this._commandService.syncExecuteCommand(s.SetDefinedNameCommand.id,this._definedNameParam)}getName(){return this._definedNameParam.name}setName(r){this._definedNameParam.name=r,this._apply()}setFormula(r){this._definedNameParam.formulaOrRefString=`=${r}`,this._apply()}setRef(r){this._definedNameParam.formulaOrRefString=r,this._apply()}getFormulaOrRefString(){return this._definedNameParam.formulaOrRefString}setRefByRange(r,n,e,t){this._definedNameParam.formulaOrRefString=P.serializeRange({startRow:r,endRow:r+(e!=null?e:1)-1,startColumn:n,endColumn:n+(t!=null?t:1)-1}),this._apply()}getComment(){return this._definedNameParam.comment}setComment(r){this._definedNameParam.comment=r,this._apply()}setScopeToWorksheet(r){this._definedNameParam.localSheetId=r.getSheetId(),this._apply()}setScopeToWorkbook(){this._definedNameParam.localSheetId=s.SCOPE_WORKBOOK_VALUE_DEFINED_NAME,this._apply()}setHidden(r){this._definedNameParam.hidden=r,this._apply()}delete(){this._commandService.syncExecuteCommand(s.RemoveDefinedNameCommand.id,this._definedNameParam)}getLocalSheetId(){return this._definedNameParam.localSheetId}isWorkbookScope(){return this._definedNameParam.localSheetId===s.SCOPE_WORKBOOK_VALUE_DEFINED_NAME}toBuilder(){const r=this._injector.createInstance(V);return r.load(this._definedNameParam),r}};A=ne([p(1,h.Inject(h.Injector)),p(2,h.ICommandService),p(3,h.IPermissionService),p(4,h.Inject(s.WorksheetProtectionRuleModel)),p(5,h.Inject(s.RangeProtectionRuleModel)),p(6,h.Inject(s.WorksheetProtectionPointModel)),p(7,h.Inject(h.IAuthzIoService)),p(8,h.Inject(h.LocaleService)),p(9,P.IDefinedNamesService)],A);var M=(r=>(r[r.Reader=0]="Reader",r[r.Editor=1]="Editor",r[r.Owner=2]="Owner",r))(M||{}),g=(r=>(r.Edit="WorkbookEdit",r.View="WorkbookView",r.Print="WorkbookPrint",r.Export="WorkbookExport",r.Share="WorkbookShare",r.CopyContent="WorkbookCopy",r.DuplicateFile="WorkbookDuplicate",r.Comment="WorkbookComment",r.ManageCollaborator="WorkbookManageCollaborator",r.CreateSheet="WorkbookCreateSheet",r.DeleteSheet="WorkbookDeleteSheet",r.RenameSheet="WorkbookRenameSheet",r.MoveSheet="WorkbookMoveSheet",r.HideSheet="WorkbookHideSheet",r.ViewHistory="WorkbookViewHistory",r.ManageHistory="WorkbookHistory",r.RecoverHistory="WorkbookRecoverHistory",r.CreateProtection="WorkbookCreateProtect",r.InsertRow="WorkbookInsertRow",r.InsertColumn="WorkbookInsertColumn",r.DeleteRow="WorkbookDeleteRow",r.DeleteColumn="WorkbookDeleteColumn",r.CopySheet="WorkbookCopySheet",r))(g||{}),S=(r=>(r.Edit="WorksheetEdit",r.View="WorksheetView",r.Copy="WorksheetCopy",r.SetCellValue="WorksheetSetCellValue",r.SetCellStyle="WorksheetSetCellStyle",r.SetRowStyle="WorksheetSetRowStyle",r.SetColumnStyle="WorksheetSetColumnStyle",r.InsertRow="WorksheetInsertRow",r.InsertColumn="WorksheetInsertColumn",r.DeleteRow="WorksheetDeleteRow",r.DeleteColumn="WorksheetDeleteColumn",r.Sort="WorksheetSort",r.Filter="WorksheetFilter",r.PivotTable="WorksheetPivotTable",r.InsertHyperlink="WorksheetInsertHyperlink",r.EditExtraObject="WorksheetEditExtraObject",r.ManageCollaborator="WorksheetManageCollaborator",r.DeleteProtection="WorksheetDeleteProtection",r.SelectProtectedCells="WorksheetSelectProtectedCells",r.SelectUnProtectedCells="WorksheetSelectUnProtectedCells",r))(S||{}),I=(r=>(r.Edit="RangeEdit",r.View="RangeView",r.ManageCollaborator="RangeManageCollaborator",r.Delete="RangeDeleteProtection",r))(I||{}),re=Object.getOwnPropertyDescriptor,oe=(r,n,e,t)=>{for(var i=t>1?void 0:t?re(n,e):n,o=r.length-1,a;o>=0;o--)(a=r[o])&&(i=a(i)||i);return i},U=(r,n)=>(e,t)=>n(e,t,r);c.FPermission=class extends b.FBase{constructor(e,t,i,o,a,d,u,l){super();w(this,"permissionPointsDefinition",s.PermissionPointsDefinitions);w(this,"rangeRuleChangedAfterAuth$");w(this,"sheetRuleChangedAfterAuth$");w(this,"unitPermissionInitStateChange$");this._injector=e,this._commandService=t,this._permissionService=i,this._worksheetProtectionRuleModel=o,this._rangeProtectionRuleModel=a,this._worksheetProtectionPointRuleModel=d,this._workbookPermissionService=u,this._authzIoService=l,this.rangeRuleChangedAfterAuth$=this._rangeProtectionRuleModel.ruleRefresh$,this.sheetRuleChangedAfterAuth$=this._worksheetProtectionRuleModel.ruleRefresh$,this.unitPermissionInitStateChange$=this._workbookPermissionService.unitPermissionInitStateChange$}setWorkbookPermissionPoint(e,t,i){const o=new t(e);this._permissionService.getPermissionPoint(o.id)||this._permissionService.addPermissionPoint(o),this._permissionService.updatePermissionPoint(o.id,i)}checkWorkbookPermissionPoint(e,t){const i=new t(e),o=this._permissionService.getPermissionPoint(i.id);if(o)return o.value}setWorkbookEditPermission(e,t){this.setWorkbookPermissionPoint(e,s.WorkbookEditablePermission,t)}async addWorksheetBasePermission(e,t,i){let o=[];i!=null&&i.allowedUsers&&(o=i.allowedUsers.map(u=>({id:u,role:M.Editor,subject:void 0})));const a=await this._authzIoService.create({objectType:s.UnitObject.Worksheet,worksheetObject:{collaborators:o,unitID:e,strategies:[],name:(i==null?void 0:i.name)||"",scope:void 0}});if(this._commandService.syncExecuteCommand(s.AddWorksheetProtectionMutation.id,{unitId:e,subUnitId:t,rule:{permissionId:a,unitType:s.UnitObject.Worksheet,unitId:e,subUnitId:t}}))return a}removeWorksheetPermission(e,t){this._commandService.syncExecuteCommand(s.DeleteWorksheetProtectionMutation.id,{unitId:e,subUnitId:t}),[...s.getAllWorksheetPermissionPoint(),...s.getAllWorksheetPermissionPointByPointPanel()].forEach(i=>{const o=new i(e,t);this._permissionService.updatePermissionPoint(o.id,!0)}),this._worksheetProtectionPointRuleModel.deleteRule(e,t)}async setWorksheetPermissionPoint(e,t,i,o){const a=this._worksheetProtectionRuleModel.getRule(e,t);let d;if(i===s.WorksheetEditPermission||i===s.WorksheetViewPermission)a?d=a.permissionId:d=await this.addWorksheetBasePermission(e,t);else{const _=this._worksheetProtectionPointRuleModel.getRule(e,t);_?d=_.permissionId:(d=await this._authzIoService.create({objectType:s.UnitObject.Worksheet,worksheetObject:{collaborators:[],unitID:e,strategies:[],name:"",scope:void 0}}),this._commandService.syncExecuteCommand(s.SetWorksheetPermissionPointsMutation.id,{unitId:e,subUnitId:t,rule:{unitId:e,subUnitId:t,permissionId:d}}))}const l=new i(e,t);return this._permissionService.getPermissionPoint(l.id)||this._permissionService.addPermissionPoint(l),this._permissionService.updatePermissionPoint(l.id,o),d}checkWorksheetPermissionPoint(e,t,i){const o=new i(e,t),a=this._permissionService.getPermissionPoint(o.id);if(a)return a.value}async addRangeBaseProtection(e,t,i,o){var R,f;const a=await this._authzIoService.create({objectType:s.UnitObject.SelectRange,selectRangeObject:{collaborators:(f=(R=o==null?void 0:o.allowedUsers)==null?void 0:R.map(T=>({id:T,role:M.Editor,subject:void 0})))!=null?f:[],unitID:e,name:(o==null?void 0:o.name)||"",scope:void 0}}),d=`ruleId_${h.generateRandomId(6)}`;if(this._rangeProtectionRuleModel.getSubunitRuleList(e,t).some(T=>T.ranges.some(Ue=>i.some(We=>h.Rectangle.intersects(We.getRange(),Ue)))))throw new Error("range protection cannot intersect");const m=this._determineRangeViewState(o),_=this._determineRangeEditState(o),k={unitId:e,subUnitId:t,rules:[{permissionId:a,unitType:s.UnitObject.SelectRange,unitId:e,subUnitId:t,ranges:i.map(T=>T.getRange()),id:d,description:o==null?void 0:o.name,viewState:m,editState:_}]};if(this._commandService.syncExecuteCommand(s.AddRangeProtectionMutation.id,k))return{permissionId:a,ruleId:d}}_determineRangeViewState(e){return(e==null?void 0:e.allowViewByOthers)===!1?s.ViewStateEnum.NoOneElseCanView:s.ViewStateEnum.OthersCanView}_determineRangeEditState(e){var t;return(e==null?void 0:e.allowEdit)===!0&&((t=e==null?void 0:e.allowedUsers)!=null&&t.length)?s.EditStateEnum.DesignedUserCanEdit:s.EditStateEnum.OnlyMe}removeRangeProtection(e,t,i){this._commandService.syncExecuteCommand(s.DeleteRangeProtectionMutation.id,{unitId:e,subUnitId:t,ruleIds:i})&&this._rangeProtectionRuleModel.getSubunitRuleList(e,t).length===0&&(this._worksheetProtectionPointRuleModel.deleteRule(e,t),[...s.getAllWorksheetPermissionPointByPointPanel()].forEach(d=>{const u=new d(e,t);this._permissionService.updatePermissionPoint(u.id,u.value)}))}setRangeProtectionPermissionPoint(e,t,i,o,a){const d=new o(e,t,i);this._permissionService.getPermissionPoint(d.id)||this._permissionService.addPermissionPoint(d),this._permissionService.updatePermissionPoint(d.id,a)}setRangeProtectionRanges(e,t,i,o){const a=this._rangeProtectionRuleModel.getRule(e,t,i);if(a){if(this._rangeProtectionRuleModel.getSubunitRuleList(e,t).filter(l=>l.id!==i).some(l=>l.ranges.some(m=>o.some(_=>h.Rectangle.intersects(_.getRange(),m)))))throw new Error("range protection cannot intersect");this._commandService.syncExecuteCommand(s.SetRangeProtectionMutation.id,{unitId:e,subUnitId:t,ruleId:i,rule:{...a,ranges:o.map(l=>l.getRange())}})}}getPermissionInfoWithCell(e,t,i,o){const a=h.cellToRange(i,o),d=this._rangeProtectionRuleModel.getSubunitRuleList(e,t).find(u=>u.ranges.some(m=>h.Rectangle.intersects(a,m)));if(d)return{permissionId:d.permissionId,ruleId:d.id}}},c.FPermission=oe([U(0,h.Inject(h.Injector)),U(1,h.ICommandService),U(2,h.IPermissionService),U(3,h.Inject(s.WorksheetProtectionRuleModel)),U(4,h.Inject(s.RangeProtectionRuleModel)),U(5,h.Inject(s.WorksheetProtectionPointModel)),U(6,h.Inject(s.WorkbookPermissionService)),U(7,h.Inject(h.IAuthzIoService))],c.FPermission);var se=Object.getOwnPropertyDescriptor,ae=(r,n,e,t)=>{for(var i=t>1?void 0:t?se(n,e):n,o=r.length-1,a;o>=0;o--)(a=r[o])&&(i=a(i)||i);return i},he=(r,n)=>(e,t)=>n(e,t,r);c.FSelection=class{constructor(n,e,t,i){this._workbook=n,this._worksheet=e,this._selections=t,this._injector=i}getActiveRange(){const n=this._selections.find(e=>!!e.primary);return n?this._injector.createInstance(c.FRange,this._workbook,this._worksheet,n.range):null}getActiveRangeList(){return this._selections.map(n=>this._injector.createInstance(c.FRange,this._workbook,this._worksheet,n.range))}getCurrentCell(){const n=this._selections.find(e=>!!e.primary);return n?n.primary:null}getActiveSheet(){const n=this._injector.createInstance(c.FWorkbook,this._workbook);return this._injector.createInstance(c.FWorksheet,n,this._workbook,this._worksheet)}updatePrimaryCell(n){const e=this._injector.get(h.ICommandService);let t=[],i=!1;for(const{range:a,style:d}of this._selections)h.Rectangle.contains(a,n.getRange())?(t.push({range:a,primary:s.getPrimaryForRange(n.getRange(),this._worksheet),style:d}),i=!0):t.push({range:a,primary:null,style:d});i||(t=[{range:n.getRange(),primary:s.getPrimaryForRange(n.getRange(),this._worksheet)}]);const o={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),selections:t};return e.syncExecuteCommand(s.SetSelectionsOperation.id,o),new c.FSelection(this._workbook,this._worksheet,t,this._injector)}getNextDataRange(n){if(!this._selections.find(i=>!!i.primary))return null;const t=s.getNextPrimaryCell(this._selections.concat(),n,this._worksheet);return t?this._injector.createInstance(c.FRange,this._workbook,this._worksheet,t):null}},c.FSelection=ae([he(3,h.Inject(h.Injector))],c.FSelection);var H=(r=>(r[r.Reader=0]="Reader",r[r.Editor=1]="Editor",r[r.Owner=2]="Owner",r[r.UNRECOGNIZED=-1]="UNRECOGNIZED",r))(H||{}),de=Object.getOwnPropertyDescriptor,ue=(r,n,e,t)=>{for(var i=t>1?void 0:t?de(n,e):n,o=r.length-1,a;o>=0;o--)(a=r[o])&&(i=a(i)||i);return i},$=(r,n)=>(e,t)=>n(e,t,r);let E=class{constructor(r,n,e,t,i,o,a,d,u){this._unitId=r,this._subUnitId=n,this._ruleId=e,this._permissionId=t,this._ranges=i,this._options=o,this._injector=a,this._commandService=d,this._rangeProtectionRuleModel=u}get id(){return this._ruleId}get ranges(){return this._ranges}get options(){return{...this._options}}async updateRanges(r){if(!r||r.length===0)throw new Error("Ranges cannot be empty");const n=this._rangeProtectionRuleModel.getRule(this._unitId,this._subUnitId,this._ruleId);if(!n)throw new Error(`Rule ${this._ruleId} not found`);if(this._rangeProtectionRuleModel.getSubunitRuleList(this._unitId,this._subUnitId).filter(i=>i.id!==this._ruleId).some(i=>i.ranges.some(o=>r.some(a=>{const d=a.getRange();return this._rangesIntersect(d,o)}))))throw new Error("Range protection cannot intersect with other protection rules");await this._commandService.executeCommand(s.SetRangeProtectionMutation.id,{unitId:this._unitId,subUnitId:this._subUnitId,ruleId:this._ruleId,rule:{...n,ranges:r.map(i=>i.getRange())}}),this._ranges.length=0,this._ranges.push(...r)}async remove(){await this._commandService.executeCommand(s.DeleteRangeProtectionMutation.id,{unitId:this._unitId,subUnitId:this._subUnitId,ruleIds:[this._ruleId]})}_rangesIntersect(r,n){return!(r.endRow<n.startRow||r.startRow>n.endRow||r.endColumn<n.startColumn||r.startColumn>n.endColumn)}};E=ue([$(6,h.Inject(h.Injector)),$(7,h.Inject(h.ICommandService)),$(8,h.Inject(s.RangeProtectionRuleModel))],E);const x={[g.Edit]:s.WorkbookEditablePermission,[g.View]:s.WorkbookViewPermission,[g.Print]:s.WorkbookPrintPermission,[g.Export]:s.WorkbookExportPermission,[g.Share]:s.WorkbookSharePermission,[g.CopyContent]:s.WorkbookCopyPermission,[g.DuplicateFile]:s.WorkbookDuplicatePermission,[g.Comment]:s.WorkbookCommentPermission,[g.ManageCollaborator]:s.WorkbookManageCollaboratorPermission,[g.CreateSheet]:s.WorkbookCreateSheetPermission,[g.DeleteSheet]:s.WorkbookDeleteSheetPermission,[g.RenameSheet]:s.WorkbookRenameSheetPermission,[g.MoveSheet]:s.WorkbookMoveSheetPermission,[g.HideSheet]:s.WorkbookHideSheetPermission,[g.ViewHistory]:s.WorkbookViewHistoryPermission,[g.ManageHistory]:s.WorkbookHistoryPermission,[g.RecoverHistory]:s.WorkbookRecoverHistoryPermission,[g.CreateProtection]:s.WorkbookCreateProtectPermission,[g.InsertRow]:s.WorkbookInsertRowPermission,[g.InsertColumn]:s.WorkbookInsertColumnPermission,[g.DeleteRow]:s.WorkbookDeleteRowPermission,[g.DeleteColumn]:s.WorkbookDeleteColumnPermission,[g.CopySheet]:s.WorkbookCopySheetPermission},F={[S.Edit]:s.WorksheetEditPermission,[S.View]:s.WorksheetViewPermission,[S.Copy]:s.WorksheetCopyPermission,[S.SetCellValue]:s.WorksheetSetCellValuePermission,[S.SetCellStyle]:s.WorksheetSetCellStylePermission,[S.SetRowStyle]:s.WorksheetSetRowStylePermission,[S.SetColumnStyle]:s.WorksheetSetColumnStylePermission,[S.InsertRow]:s.WorksheetInsertRowPermission,[S.InsertColumn]:s.WorksheetInsertColumnPermission,[S.DeleteRow]:s.WorksheetDeleteRowPermission,[S.DeleteColumn]:s.WorksheetDeleteColumnPermission,[S.Sort]:s.WorksheetSortPermission,[S.Filter]:s.WorksheetFilterPermission,[S.PivotTable]:s.WorksheetPivotTablePermission,[S.InsertHyperlink]:s.WorksheetInsertHyperlinkPermission,[S.EditExtraObject]:s.WorksheetEditExtraObjectPermission,[S.ManageCollaborator]:s.WorksheetManageCollaboratorPermission,[S.DeleteProtection]:s.WorksheetDeleteProtectionPermission,[S.SelectProtectedCells]:s.WorksheetSelectProtectedCellsPermission,[S.SelectUnProtectedCells]:s.WorksheetSelectUnProtectedCellsPermission},N={[I.Edit]:s.RangeProtectionPermissionEditPoint,[I.View]:s.RangeProtectionPermissionViewPoint,[I.ManageCollaborator]:s.RangeProtectionPermissionManageCollaPoint,[I.Delete]:s.RangeProtectionPermissionDeleteProtectionPoint};var le=Object.getOwnPropertyDescriptor,ce=(r,n,e,t)=>{for(var i=t>1?void 0:t?le(n,e):n,o=r.length-1,a;o>=0;o--)(a=r[o])&&(i=a(i)||i);return i},W=(r,n)=>(e,t)=>n(e,t,r);let z=class{constructor(r,n,e,t,i,o,a,d){w(this,"_permissionSubject");w(this,"_rangeRulesSubject");w(this,"permission$");w(this,"pointChange$");w(this,"rangeProtectionChange$");w(this,"rangeProtectionRules$");w(this,"_unitId");w(this,"_subUnitId");w(this,"_subscriptions",[]);w(this,"_fPermission");this._worksheet=r,this._injector=n,this._permissionService=e,this._authzIoService=t,this._commandService=i,this._rangeProtectionRuleModel=o,this._worksheetProtectionPointModel=a,this._worksheetProtectionRuleModel=d,this._unitId=this._worksheet.getWorkbook().getUnitId(),this._subUnitId=this._worksheet.getSheetId(),this._fPermission=this._injector.createInstance(c.FPermission),this._permissionSubject=new j.BehaviorSubject(this._buildSnapshot()),this._rangeRulesSubject=new j.BehaviorSubject(this._buildRangeProtectionRules()),this.permission$=this._createPermissionStream(),this.pointChange$=this._createPointChangeStream(),this.rangeProtectionChange$=this._createRangeProtectionChangeStream(),this.rangeProtectionRules$=this._createRangeProtectionRulesStream()}_createPermissionStream(){const r=this._permissionService.permissionPointUpdate$.pipe(C.filter(n=>n.id.includes(this._unitId)&&n.id.includes(this._subUnitId))).subscribe(()=>{this._permissionSubject.next(this._buildSnapshot())});return this._subscriptions.push(r),this._permissionSubject.asObservable().pipe(C.distinctUntilChanged((n,e)=>JSON.stringify(n)===JSON.stringify(e)),C.shareReplay({bufferSize:1,refCount:!0}))}_createPointChangeStream(){return this._permissionService.permissionPointUpdate$.pipe(C.filter(r=>r.id.includes(this._unitId)&&r.id.includes(this._subUnitId)),C.map(r=>{var e,t;const n=this._extractWorksheetPointType(r.id);return n?{point:n,value:(e=r.value)!=null?e:!1,oldValue:!((t=r.value)!=null&&t)}:null}),C.filter(r=>r!==null),C.shareReplay({bufferSize:1,refCount:!0}))}_createRangeProtectionChangeStream(){return this._rangeProtectionRuleModel.ruleChange$.pipe(C.filter(r=>r.unitId===this._unitId&&r.subUnitId===this._subUnitId),C.map(r=>{const n=this._buildRangeProtectionRules();return{type:r.type==="delete"?"delete":r.type==="set"?"update":"add",rules:n}}),C.shareReplay({bufferSize:1,refCount:!0}))}_createRangeProtectionRulesStream(){const r=this._rangeProtectionRuleModel.ruleChange$.pipe(C.filter(n=>n.unitId===this._unitId&&n.subUnitId===this._subUnitId)).subscribe(()=>{this._rangeRulesSubject.next(this._buildRangeProtectionRules())});return this._subscriptions.push(r),this._rangeRulesSubject.asObservable().pipe(C.distinctUntilChanged((n,e)=>n.length!==e.length?!1:n.every((t,i)=>t.id===e[i].id)),C.shareReplay({bufferSize:1,refCount:!0}))}_extractWorksheetPointType(r){for(const[n,e]of Object.entries(F))if(new e(this._unitId,this._subUnitId).id===r)return n;return null}_getRuleEditPermission(r){var i;const n=N[I.Edit];if(!n)return!1;const e=new n(this._unitId,this._subUnitId,r.permissionId),t=this._permissionService.getPermissionPoint(e.id);return(i=t==null?void 0:t.value)!=null?i:!1}_buildSnapshot(){const r={};for(const n in S){const e=S[n];r[e]=this.getPoint(e)}return r}_buildRangeProtectionRules(){return this._rangeProtectionRuleModel.getSubunitRuleList(this._unitId,this._subUnitId).map(n=>{const e=n.ranges.map(t=>this._worksheet.getRange(t.startRow,t.startColumn,t.endRow-t.startRow+1,t.endColumn-t.startColumn+1));return this._injector.createInstance(E,this._unitId,this._subUnitId,n.id,n.permissionId,e,{name:n.description||"",allowEdit:this._getRuleEditPermission(n)})})}_buildProtectionRule(r){const n=r.ranges.map(t=>this._worksheet.getRange(t)),e={name:r.description||"",allowViewByOthers:r.viewState!==s.ViewStateEnum.NoOneElseCanView};return r.editState===s.EditStateEnum.DesignedUserCanEdit?e.allowEdit=!0:e.allowEdit=!1,this._injector.createInstance(E,this._unitId,this._subUnitId,r.id,r.permissionId,n,e)}debugCellPermission(r,n){const e=this._fPermission.getPermissionInfoWithCell(this._unitId,this._subUnitId,r,n);if(!e)return;const{ruleId:t}=e,i=this._rangeProtectionRuleModel.getRule(this._unitId,this._subUnitId,t);if(i)return this._buildProtectionRule(i)}async protect(r){if(this.isProtected())throw new Error("Worksheet is already protected. Call unprotect() first.");const n=await this._fPermission.addWorksheetBasePermission(this._unitId,this._subUnitId,r);if(!n)throw new Error("Failed to create worksheet protection");return n}async unprotect(){if(!this.isProtected())return;this._fPermission.removeWorksheetPermission(this._unitId,this._subUnitId);const r=this._buildSnapshot();this._permissionSubject.next(r)}isProtected(){return!!this._worksheetProtectionRuleModel.getRule(this._unitId,this._subUnitId)}async setMode(r){const n=this._getModePermissions(r);await this._batchSetPermissionPoints(n)}_getModePermissions(r){const n={};switch(Object.values(S).forEach(e=>{n[e]=!1}),r){case"editable":Object.values(S).forEach(e=>{n[e]=!0});break;case"readOnly":n[S.View]=!0;break;case"filterOnly":n[S.View]=!0,n[S.Sort]=!0,n[S.Filter]=!0;break}return n}async _batchSetPermissionPoints(r){const n=[];for(const[e,t]of Object.entries(r)){const i=e,o=F[i];if(!o)throw new Error(`Unknown worksheet permission point: ${i}`);const a=this.getPoint(i);a!==t&&(await this._fPermission.setWorksheetPermissionPoint(this._unitId,this._subUnitId,o,t),n.push({point:i,value:t,oldValue:a}))}if(n.length>0){const e=this._buildSnapshot();this._permissionSubject.next(e)}}async setReadOnly(){await this.setMode("readOnly")}async setEditable(){await this.setMode("editable")}canEdit(){return this.getPoint(S.Edit)}canEditCell(r,n){if(!this.canEdit())return!1;const e=this._rangeProtectionRuleModel.getSubunitRuleList(this._unitId,this._subUnitId);for(const t of e)for(const i of t.ranges)if(r>=i.startRow&&r<=i.endRow&&n>=i.startColumn&&n<=i.endColumn)return this._getRuleEditPermission(t);return!0}canViewCell(r,n){return this.getPoint(S.View)}async setPoint(r,n){const e=F[r];if(!e)throw new Error(`Unknown worksheet permission point: ${r}`);if(this.getPoint(r)===n)return;await this._fPermission.setWorksheetPermissionPoint(this._unitId,this._subUnitId,e,n);const i=this._buildSnapshot();this._permissionSubject.next(i)}getPoint(r){var i;const n=F[r];if(!n)throw new Error(`Unknown worksheet permission point: ${r}`);const e=new n(this._unitId,this._subUnitId),t=this._permissionService.getPermissionPoint(e.id);return(i=t==null?void 0:t.value)!=null?i:!0}getSnapshot(){return this._buildSnapshot()}async applyConfig(r){if(r.mode&&await this.setMode(r.mode),r.points)for(const[n,e]of Object.entries(r.points))typeof e=="boolean"&&await this.setPoint(n,e);if(r.rangeProtections&&r.rangeProtections.length>0){const n=r.rangeProtections.map(e=>({ranges:e.rangeRefs.map(t=>this._worksheet.getRange(t)),options:e.options}));await this.protectRanges(n)}}async protectRanges(r){if(!r||r.length===0)throw new Error("Configs cannot be empty");const n=await Promise.all(r.map(o=>{var a,d,u,l;return this._authzIoService.create({objectType:s.UnitObject.SelectRange,selectRangeObject:{collaborators:(u=(d=(a=o.options)==null?void 0:a.allowedUsers)==null?void 0:d.map(m=>({id:m,role:H.Editor,subject:void 0})))!=null?u:[],unitID:this._unitId,name:((l=o.options)==null?void 0:l.name)||"",scope:void 0}})})),e=r.map((o,a)=>{var l;const d=this._determineViewState(o.options),u=this._determineEditState(o.options);return{permissionId:n[a],unitType:s.UnitObject.SelectRange,unitId:this._unitId,subUnitId:this._subUnitId,ranges:o.ranges.map(m=>m.getRange()),id:this._rangeProtectionRuleModel.createRuleId(this._unitId,this._subUnitId),description:((l=o.options)==null?void 0:l.name)||"",viewState:d,editState:u}});if(!await this._commandService.executeCommand(s.AddRangeProtectionMutation.id,{unitId:this._unitId,subUnitId:this._subUnitId,rules:e}))throw new Error("Failed to create range protection rules");return await Promise.all(r.map((o,a)=>this._setPermissionPoints(n[a],o.options))),e.map((o,a)=>this._injector.createInstance(E,this._unitId,this._subUnitId,o.id,o.permissionId,r[a].ranges,r[a].options||{}))}_determineViewState(r){return(r==null?void 0:r.allowViewByOthers)===!1?s.ViewStateEnum.NoOneElseCanView:s.ViewStateEnum.OthersCanView}_determineEditState(r){var n;return(r==null?void 0:r.allowEdit)===!0&&((n=r==null?void 0:r.allowedUsers)!=null&&n.length)?s.EditStateEnum.DesignedUserCanEdit:s.EditStateEnum.OnlyMe}async _setPermissionPoints(r,n){if(!n)return;const e=(t,i)=>t===void 0?i:typeof t=="boolean"?t:!0;await this._setPermissionPoint(r,I.Edit,e(n.allowEdit,!1)),await this._setPermissionPoint(r,I.View,e(n.allowViewByOthers,!0))}async _setPermissionPoint(r,n,e){const t=N[n];t&&this._fPermission.setRangeProtectionPermissionPoint(this._unitId,this._subUnitId,r,t,e)}async unprotectRules(r){!r||r.length===0||this._fPermission.removeRangeProtection(this._unitId,this._subUnitId,r)}async listRangeProtectionRules(){return this._buildRangeProtectionRules()}subscribe(r){const n=this.permission$.subscribe(r);return()=>n.unsubscribe()}dispose(){this._subscriptions.forEach(r=>r.unsubscribe()),this._permissionSubject.complete(),this._rangeRulesSubject.complete()}};z=ce([W(1,h.Inject(h.Injector)),W(2,h.IPermissionService),W(3,h.IAuthzIoService),W(4,h.ICommandService),W(5,h.Inject(s.RangeProtectionRuleModel)),W(6,h.Inject(s.WorksheetProtectionPointModel)),W(7,h.Inject(s.WorksheetProtectionRuleModel))],z);function me(r){switch(r){case"left":return h.HorizontalAlign.LEFT;case"center":return h.HorizontalAlign.CENTER;case"normal":return h.HorizontalAlign.RIGHT;default:throw new Error(`Invalid horizontal alignment: ${r}`)}}function Z(r){switch(r){case h.HorizontalAlign.LEFT:return"left";case h.HorizontalAlign.CENTER:return"center";case h.HorizontalAlign.RIGHT:return"normal";default:return"general"}}function ge(r){switch(r){case"top":return h.VerticalAlign.TOP;case"middle":return h.VerticalAlign.MIDDLE;case"bottom":return h.VerticalAlign.BOTTOM;default:throw new Error(`Invalid vertical alignment: ${r}`)}}function Q(r){switch(r){case h.VerticalAlign.TOP:return"top";case h.VerticalAlign.MIDDLE:return"middle";case h.VerticalAlign.BOTTOM:return"bottom";default:return"general"}}function L(r,n){return{startRow:r.startRow,endRow:r.endRow,startColumn:0,endColumn:n.getColumnCount()-1,rangeType:h.RANGE_TYPE.ROW}}function G(r,n){return{startRow:0,endRow:n.getRowCount()-1,startColumn:r.startColumn,endColumn:r.endColumn,rangeType:h.RANGE_TYPE.COLUMN}}var _e=Object.getOwnPropertyDescriptor,Se=(r,n,e,t)=>{for(var i=t>1?void 0:t?_e(n,e):n,o=r.length-1,a;o>=0;o--)(a=r[o])&&(i=a(i)||i);return i},B=(r,n)=>(e,t)=>n(e,t,r);c.FWorksheet=class extends b.FBaseInitialable{constructor(e,t,i,o,a,d,u){super(o);w(this,"setActiveSelection",this.setActiveRange);this._fWorkbook=e,this._workbook=t,this._worksheet=i,this._injector=o,this._selectionManagerService=a,this._logService=d,this._commandService=u}dispose(){super.dispose(),delete this._fWorkbook,delete this._workbook,delete this._worksheet}getSheet(){return this._worksheet}getInject(){return this._injector}getWorkbook(){return this._workbook}getSheetId(){return this._worksheet.getSheetId()}getSheetName(){return this._worksheet.getName()}getSelection(){const e=this._selectionManagerService.getCurrentSelections();return e?this._injector.createInstance(c.FSelection,this._workbook,this._worksheet,e):null}getDefaultStyle(){return this._worksheet.getDefaultCellStyle()}getRowDefaultStyle(e,t=!1){return t?this._worksheet.getRowStyle(e,t):this._worksheet.getRowStyle(e)}getColumnDefaultStyle(e,t=!1){return t?this._worksheet.getColumnStyle(e,t):this._worksheet.getColumnStyle(e)}setDefaultStyle(e){const t=this._workbook.getUnitId(),i=this._worksheet.getSheetId();return this._commandService.syncExecuteCommand(s.SetWorksheetDefaultStyleMutation.id,{unitId:t,subUnitId:i,defaultStyle:e}),this._worksheet.setDefaultCellStyle(e),this}setColumnDefaultStyle(e,t){const i=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),a={unitId:i,subUnitId:o,columnData:{[e]:{s:t}}};return this._commandService.syncExecuteCommand(s.SetColDataCommand.id,a),this}setRowDefaultStyle(e,t){const i=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),a={unitId:i,subUnitId:o,rowData:{[e]:{s:t}}};return this._commandService.syncExecuteCommand(s.SetRowDataCommand.id,a),this}getRange(e,t,i,o){let a,d;if(typeof e=="object")a=e,d=this._worksheet;else if(typeof e=="string"){const{range:u,sheetName:l}=P.deserializeRangeWithSheet(e),m=l?this._workbook.getSheetBySheetName(l):this._worksheet;if(!m)throw new Error("Range not found");d=m,a={...u,unitId:this._workbook.getUnitId(),sheetId:d.getSheetId(),rangeType:h.RANGE_TYPE.NORMAL,startRow:u.rangeType===h.RANGE_TYPE.COLUMN?0:u.startRow,endRow:u.rangeType===h.RANGE_TYPE.COLUMN?d.getMaxRows()-1:u.endRow,startColumn:u.rangeType===h.RANGE_TYPE.ROW?0:u.startColumn,endColumn:u.rangeType===h.RANGE_TYPE.ROW?d.getMaxColumns()-1:u.endColumn}}else if(typeof e=="number"&&t!==void 0)d=this._worksheet,a={startRow:e,endRow:e+(i!=null?i:1)-1,startColumn:t,endColumn:t+(o!=null?o:1)-1,unitId:this._workbook.getUnitId(),sheetId:this._worksheet.getSheetId()};else throw new Error("Invalid range specification");return this._injector.createInstance(c.FRange,this._workbook,d,a)}getMaxColumns(){return this._worksheet.getMaxColumns()}getMaxRows(){return this._worksheet.getMaxRows()}insertRowAfter(e){return this.insertRowsAfter(e,1)}insertRowBefore(e){return this.insertRowsBefore(e,1)}insertRows(e,t=1){return this.insertRowsBefore(e,t)}insertRowsAfter(e,t){const i=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),a=h.Direction.DOWN,d=e+1,u=e+t,l=0,m=this._worksheet.getColumnCount()-1,_=s.copyRangeStyles(this._worksheet,d,u,l,m,!0,e);return this._commandService.syncExecuteCommand(s.InsertRowByRangeCommand.id,{unitId:i,subUnitId:o,direction:a,range:{startRow:d,endRow:u,startColumn:l,endColumn:m},cellValue:_}),this}insertRowsBefore(e,t){const i=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),a=h.Direction.UP,d=e,u=e+t-1,l=0,m=this._worksheet.getColumnCount()-1,_=s.copyRangeStyles(this._worksheet,d,u,l,m,!0,e-1);return this._commandService.syncExecuteCommand(s.InsertRowByRangeCommand.id,{unitId:i,subUnitId:o,direction:a,range:{startRow:d,endRow:u,startColumn:l,endColumn:m},cellValue:_}),this}deleteRow(e){return this.deleteRows(e,1)}deleteRows(e,t){const i={startRow:e,endRow:e+t-1,startColumn:0,endColumn:this._worksheet.getColumnCount()-1};return this._commandService.syncExecuteCommand(s.RemoveRowByRangeCommand.id,{range:i,unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId()}),this}moveRows(e,t){const i=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),a=L(e.getRange(),this._worksheet),d=a,u={startRow:t,endRow:t,startColumn:a.startColumn,endColumn:a.endColumn};return this._commandService.syncExecuteCommand(s.MoveRowsCommand.id,{unitId:i,subUnitId:o,range:a,fromRange:d,toRange:u}),this}hideRow(e){const t=this._workbook.getUnitId(),i=this._worksheet.getSheetId(),o=L(e.getRange(),this._worksheet);return this._commandService.syncExecuteCommand(s.SetRowHiddenCommand.id,{unitId:t,subUnitId:i,ranges:[o]}),this}hideRows(e,t=1){const i=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),a={startRow:e,endRow:e+t-1,startColumn:0,endColumn:this._worksheet.getColumnCount()-1,rangeType:h.RANGE_TYPE.ROW};return this._commandService.syncExecuteCommand(s.SetRowHiddenCommand.id,{unitId:i,subUnitId:o,ranges:[a]}),this}unhideRow(e){const t=this._workbook.getUnitId(),i=this._worksheet.getSheetId(),o=L(e.getRange(),this._worksheet);return this._commandService.syncExecuteCommand(s.SetSpecificRowsVisibleCommand.id,{unitId:t,subUnitId:i,ranges:[o]}),this}showRows(e,t=1){const i=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),a={startRow:e,endRow:e+t-1,startColumn:0,endColumn:this._worksheet.getColumnCount()-1,rangeType:h.RANGE_TYPE.ROW};return this._commandService.syncExecuteCommand(s.SetSpecificRowsVisibleCommand.id,{unitId:i,subUnitId:o,ranges:[a]}),this}setRowHeight(e,t){return this.setRowHeights(e,1,t)}autoFitRow(e,t=h.BooleanNumber.TRUE){const i=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),a=[{startRow:e,endRow:e,startColumn:0,endColumn:this._worksheet.getColumnCount()-1}];return this._commandService.syncExecuteCommand(s.SetTextWrapCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:a[0],value:h.WrapStrategy.WRAP}),this._commandService.syncExecuteCommand(s.SetWorksheetRowIsAutoHeightMutation.id,{unitId:i,subUnitId:o,ranges:a,autoHeightInfo:t}),this}setRowHeights(e,t,i){var m;const o=this._workbook.getUnitId(),a=this._worksheet.getSheetId(),d=this._worksheet.getRowManager(),u=[],l=[];for(let _=e;_<e+t;_++){const k=((m=d.getRow(_))==null?void 0:m.ah)||this._worksheet.getConfig().defaultRowHeight,v={startRow:_,endRow:_,startColumn:0,endColumn:this._worksheet.getColumnCount()-1};i<=k?u.push(v):l.push(v)}return l.length>0&&this._commandService.syncExecuteCommand(s.SetRowHeightCommand.id,{unitId:o,subUnitId:a,ranges:l,value:i}),u.length>0&&this._commandService.syncExecuteCommand(s.SetWorksheetRowIsAutoHeightCommand.id,{unitId:o,subUnitId:a,ranges:u}),this}getRowHeight(e){return this._worksheet.getRowHeight(e)}setRowAutoHeight(e,t){const i=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),a=[{startRow:e,endRow:e+t-1,startColumn:0,endColumn:this._worksheet.getColumnCount()-1}];return this._commandService.syncExecuteCommand(s.SetWorksheetRowIsAutoHeightCommand.id,{unitId:i,subUnitId:o,ranges:a}),this}setRangesAutoHeight(e){const t=this._workbook.getUnitId(),i=this._worksheet.getSheetId();return this._commandService.syncExecuteCommand(s.SetWorksheetRowIsAutoHeightCommand.id,{unitId:t,subUnitId:i,ranges:e}),this}setRowHeightsForced(e,t,i){const o=this._workbook.getUnitId(),a=this._worksheet.getSheetId(),d=[{startRow:e,endRow:e+t-1,startColumn:0,endColumn:this._worksheet.getColumnCount()-1}];return this._commandService.syncExecuteCommand(s.SetRowHeightCommand.id,{unitId:o,subUnitId:a,ranges:d,value:i}),this}setRowCustom(e){const t=this._workbook.getUnitId(),i=this._worksheet.getSheetId(),o={};for(const[d,u]of Object.entries(e))o[Number(d)]={custom:u};const a={unitId:t,subUnitId:i,rowData:o};return this._commandService.syncExecuteCommand(s.SetRowDataCommand.id,a),this}insertColumnAfter(e){return this.insertColumnsAfter(e,1)}insertColumnBefore(e){return this.insertColumnsBefore(e,1)}insertColumns(e,t=1){return this.insertColumnsBefore(e,t)}insertColumnsAfter(e,t){const i=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),a=h.Direction.RIGHT,d=0,u=this._worksheet.getRowCount()-1,l=e+1,m=e+t,_=s.copyRangeStyles(this._worksheet,d,u,l,m,!1,e);return this._commandService.syncExecuteCommand(s.InsertColByRangeCommand.id,{unitId:i,subUnitId:o,direction:a,range:{startRow:d,endRow:u,startColumn:l,endColumn:m},cellValue:_}),this}insertColumnsBefore(e,t){const i=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),a=h.Direction.LEFT,d=0,u=this._worksheet.getRowCount()-1,l=e,m=e+t-1,_=s.copyRangeStyles(this._worksheet,d,u,l,m,!1,e-1);return this._commandService.syncExecuteCommand(s.InsertColByRangeCommand.id,{unitId:i,subUnitId:o,direction:a,range:{startRow:d,endRow:u,startColumn:l,endColumn:m},cellValue:_}),this}deleteColumn(e){return this.deleteColumns(e,1)}deleteColumns(e,t){const i={startRow:0,endRow:this._worksheet.getRowCount()-1,startColumn:e,endColumn:e+t-1};return this._commandService.syncExecuteCommand(s.RemoveColByRangeCommand.id,{range:i,unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId()}),this}moveColumns(e,t){const i=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),a=G(e.getRange(),this._worksheet),d=a,u={startRow:0,endRow:this._worksheet.getRowCount()-1,startColumn:t,endColumn:t};return this._commandService.syncExecuteCommand(s.MoveColsCommand.id,{unitId:i,subUnitId:o,range:a,fromRange:d,toRange:u}),this}hideColumn(e){const t=this._workbook.getUnitId(),i=this._worksheet.getSheetId(),o=G(e.getRange(),this._worksheet);return this._commandService.syncExecuteCommand(s.SetColHiddenCommand.id,{unitId:t,subUnitId:i,ranges:[o]}),this}hideColumns(e,t=1){const i=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),a={startRow:0,endRow:this._worksheet.getRowCount()-1,startColumn:e,endColumn:e+t-1,rangeType:h.RANGE_TYPE.COLUMN};return this._commandService.syncExecuteCommand(s.SetColHiddenCommand.id,{unitId:i,subUnitId:o,ranges:[a]}),this}unhideColumn(e){const t=this._workbook.getUnitId(),i=this._worksheet.getSheetId(),o=G(e.getRange(),this._worksheet);return this._commandService.syncExecuteCommand(s.SetSpecificColsVisibleCommand.id,{unitId:t,subUnitId:i,ranges:[o]}),this}showColumns(e,t=1){const i=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),a={startRow:0,endRow:this._worksheet.getRowCount()-1,startColumn:e,endColumn:e+t-1,rangeType:h.RANGE_TYPE.COLUMN};return this._commandService.syncExecuteCommand(s.SetSpecificColsVisibleCommand.id,{unitId:i,subUnitId:o,ranges:[a]}),this}setColumnWidth(e,t){return this.setColumnWidths(e,1,t)}setColumnWidths(e,t,i){const o=this._workbook.getUnitId(),a=this._worksheet.getSheetId(),d=[{startColumn:e,endColumn:e+t-1,startRow:0,endRow:this._worksheet.getRowCount()-1}];return this._commandService.syncExecuteCommand(s.SetColWidthCommand.id,{unitId:o,subUnitId:a,ranges:d,value:i}),this}getColumnWidth(e){return this._worksheet.getColumnWidth(e)}setColumnCustom(e){const t=this._workbook.getUnitId(),i=this._worksheet.getSheetId(),o={};for(const[d,u]of Object.entries(e))o[Number(d)]={custom:u};const a={unitId:t,subUnitId:i,columnData:o};return this._commandService.syncExecuteCommand(s.SetColDataCommand.id,a),this}getMergeData(){return this._worksheet.getMergeData().map(e=>this._injector.createInstance(c.FRange,this._workbook,this._worksheet,e))}getMergedRanges(){return this._worksheet.getSnapshot().mergeData.map(t=>this._injector.createInstance(c.FRange,this._workbook,this._worksheet,t))}getCellMergeData(e,t){const o=this._worksheet.getMergedCell(e,t);if(o)return this._injector.createInstance(c.FRange,this._workbook,this._worksheet,o)}getActiveRange(){return this._fWorkbook.getActiveRange()}setActiveRange(e){const{unitId:t,sheetId:i}=e.getRange();if(t!==this._workbook.getUnitId()||i!==this._worksheet.getSheetId())throw new Error("Specified range must be part of the sheet.");return this._fWorkbook.setActiveRange(e),this}getActiveCell(){return this._fWorkbook.getActiveCell()}setFreeze(e){return this._logService.warn("setFreeze is deprecated, use setFrozenRows and setFrozenColumns instead"),this._commandService.syncExecuteCommand(s.SetFrozenCommand.id,{...e,unitId:this._workbook.getUnitId(),subUnitId:this.getSheetId()}),this}cancelFreeze(){return this._commandService.syncExecuteCommand(s.CancelFrozenCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this.getSheetId()}),this}getFreeze(){return this._worksheet.getFreeze()}setFrozenColumns(...e){const t=this.getFreeze();if(arguments.length===1){const i=e[0];this.setFreeze({...t,startColumn:i>0?i:-1,xSplit:i})}else if(arguments.length===2){let[i=0,o=0]=e;i>o&&([i,o]=[o,i]),this._commandService.syncExecuteCommand(s.SetFrozenCommand.id,{startColumn:o+1,xSplit:o-i+1,startRow:t.startRow,ySplit:t.ySplit,unitId:this._workbook.getUnitId(),subUnitId:this.getSheetId()})}return this}setFrozenRows(...e){const t=this.getFreeze();if(arguments.length===1){const i=e[0];this.setFreeze({...t,startRow:i>0?i:-1,ySplit:i})}else if(arguments.length===2){let[i=0,o=0]=e;i>o&&([i,o]=[o,i]),this._commandService.syncExecuteCommand(s.SetFrozenCommand.id,{startRow:o+1,ySplit:o-i+1,startColumn:t.startColumn,xSplit:t.xSplit,unitId:this._workbook.getUnitId(),subUnitId:this.getSheetId()})}return this}getFrozenColumns(){const e=this.getFreeze();return e.startColumn===-1?0:e.startColumn}getFrozenRows(){const e=this.getFreeze();return e.startRow===-1?0:e.startRow}getFrozenRowRange(){const e=this._worksheet.getFreeze();return{startRow:e.startRow-e.ySplit,endRow:e.startRow-1}}getFrozenColumnRange(){const e=this._worksheet.getFreeze();return{startColumn:e.startColumn-e.xSplit,endColumn:e.startColumn-1}}hasHiddenGridLines(){return this._worksheet.getConfig().showGridlines===h.BooleanNumber.FALSE}setHiddenGridlines(e){return this._commandService.syncExecuteCommand(s.ToggleGridlinesCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),showGridlines:e?h.BooleanNumber.FALSE:h.BooleanNumber.TRUE}),this}setGridLinesColor(e){return this._commandService.syncExecuteCommand(s.SetGridlinesColorCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),color:e}),this}getGridLinesColor(){return this._worksheet.getGridlinesColor()}setTabColor(e){return this._commandService.syncExecuteCommand(s.SetTabColorCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),value:e}),this}getTabColor(){return this._worksheet.getTabColor()}onCellDataChange(e){return this._injector.get(h.ICommandService).onCommandExecuted(i=>{if(i.id===s.SetRangeValuesMutation.id){const o=i.params;o.unitId===this._workbook.getUnitId()&&o.subUnitId===this._worksheet.getSheetId()&&o.cellValue&&e(new h.ObjectMatrix(o.cellValue))}})}onBeforeCellDataChange(e){return this._injector.get(h.ICommandService).beforeCommandExecuted(i=>{if(i.id===s.SetRangeValuesMutation.id){const o=i.params;o.unitId===this._workbook.getUnitId()&&o.subUnitId===this._worksheet.getSheetId()&&o.cellValue&&e(new h.ObjectMatrix(o.cellValue))}})}hideSheet(){const e=this._injector.get(h.ICommandService);if(this._workbook.getSheets().filter(a=>a.isSheetHidden()!==h.BooleanNumber.TRUE).length<=1)throw new Error("Cannot hide the only visible sheet");return e.syncExecuteCommand(s.SetWorksheetHideCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId()}),this}showSheet(){return this._injector.get(h.ICommandService).syncExecuteCommand(s.SetWorksheetShowCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId()}),this}isSheetHidden(){return this._worksheet.isSheetHidden()===h.BooleanNumber.TRUE}setName(e){return this._commandService.syncExecuteCommand(s.SetWorksheetNameCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),name:e}),this}activate(){return this._fWorkbook.setActiveSheet(this),this}getIndex(){return this._workbook.getSheetIndex(this._worksheet)}clear(e){if(e&&e.contentsOnly&&!e.formatOnly)return this.clearContents();if(e&&e.formatOnly&&!e.contentsOnly)return this.clearFormats();const t=this._workbook.getUnitId(),i=this._worksheet.getSheetId(),o=this._injector.get(h.ICommandService),a={startRow:0,endRow:this._worksheet.getRowCount()-1,startColumn:0,endColumn:this._worksheet.getColumnCount()-1};return o.syncExecuteCommand(s.ClearSelectionAllCommand.id,{unitId:t,subUnitId:i,ranges:[a],options:e}),this}clearContents(){const e=this._workbook.getUnitId(),t=this._worksheet.getSheetId(),i=this._injector.get(h.ICommandService),o={startRow:0,endRow:this._worksheet.getRowCount()-1,startColumn:0,endColumn:this._worksheet.getColumnCount()-1};return i.syncExecuteCommand(s.ClearSelectionContentCommand.id,{unitId:e,subUnitId:t,ranges:[o]}),this}clearFormats(){const e=this._workbook.getUnitId(),t=this._worksheet.getSheetId(),i=this._injector.get(h.ICommandService),o={startRow:0,endRow:this._worksheet.getRowCount()-1,startColumn:0,endColumn:this._worksheet.getColumnCount()-1};return i.syncExecuteCommand(s.ClearSelectionFormatCommand.id,{unitId:e,subUnitId:t,ranges:[o]}),this}getDataRange(){const{startRow:e,endRow:t,startColumn:i,endColumn:o}=this._worksheet.getDataRealRange();return this.getRange(e,i,t-e+1,o-i+1)}getLastColumns(){return this._worksheet.getLastColumnWithContent()}getLastColumn(){return this._worksheet.getLastColumnWithContent()}getLastRows(){return this._worksheet.getLastRowWithContent()}getLastRow(){return this._worksheet.getLastRowWithContent()}equalTo(e){return e instanceof c.FWorksheet?this._worksheet.getSheetId()===e.getSheetId()&&this._workbook.getUnitId()===e.getWorkbook().getUnitId():!1}insertDefinedName(e,t){const o=this._injector.createInstance(V).setName(e).setRef(t).build();o.localSheetId=this.getSheetId(),this._fWorkbook.insertDefinedNameBuilder(o)}getDefinedNames(){return this._fWorkbook.getDefinedNames().filter(t=>t.getLocalSheetId()===this.getSheetId())}setCustomMetadata(e){return this._worksheet.setCustomMetadata(e),this}getCustomMetadata(){return this._worksheet.getCustomMetadata()}setRowCustomMetadata(e,t){return this._worksheet.getRowManager().setCustomMetadata(e,t),this}setColumnCustomMetadata(e,t){return this._worksheet.getColumnManager().setCustomMetadata(e,t),this}getRowCustomMetadata(e){return this._worksheet.getRowManager().getCustomMetadata(e)}getColumnCustomMetadata(e){return this._worksheet.getColumnManager().getCustomMetadata(e)}appendRow(e){const t=this._worksheet.getCellMatrix().hasValue(),i=this._worksheet.getLastRowWithContent(),o=this._worksheet.getRowCount(),a=this._worksheet.getColumnCount(),d=t?i+1:i,u=new h.ObjectMatrix;for(let l=0;l<e.length;l++)u.setValue(d,l,h.covertCellValue(e[l]));return this._commandService.syncExecuteCommand(s.AppendRowCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),cellValue:u.getMatrix(),insertRowNums:d>o-1?1:0,insertColumnNums:e.length>a?e.length-a:0,maxRows:o,maxColumns:a}),this}setRowCount(e){return this._commandService.syncExecuteCommand(s.SetWorksheetRowCountCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),rowCount:e}),this}setColumnCount(e){return this._commandService.syncExecuteCommand(s.SetWorksheetColumnCountCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),columnCount:e}),this}getWorksheetPermission(){return this._injector.createInstance(z,this)}},c.FWorksheet=Se([B(3,h.Inject(h.Injector)),B(4,h.Inject(s.SheetsSelectionsService)),B(5,h.Inject(h.ILogService)),B(6,h.ICommandService)],c.FWorksheet);var we=Object.getOwnPropertyDescriptor,Ce=(r,n,e,t)=>{for(var i=t>1?void 0:t?we(n,e):n,o=r.length-1,a;o>=0;o--)(a=r[o])&&(i=a(i)||i);return i},O=(r,n)=>(e,t)=>n(e,t,r);let K=class{constructor(r,n,e,t,i,o,a,d,u){w(this,"_permissionSubject");w(this,"_subscriptions",[]);w(this,"_fPermission");w(this,"permission$");w(this,"protectionChange$");this._unitId=r,this._subUnitId=n,this._range=e,this._worksheet=t,this._injector=i,this._permissionService=o,this._authzIoService=a,this._commandService=d,this._rangeProtectionRuleModel=u,this._fPermission=this._injector.createInstance(c.FPermission),this._permissionSubject=new j.BehaviorSubject(this._buildSnapshot()),this.permission$=this._createPermissionStream(),this.protectionChange$=this._createProtectionChangeStream()}_createPermissionStream(){const r=this._permissionService.permissionPointUpdate$.pipe(C.filter(n=>{const e=n.id;return e.includes(this._unitId)&&e.includes(this._subUnitId)})).subscribe(()=>{this._permissionSubject.next(this._buildSnapshot())});return this._subscriptions.push(r),this._permissionSubject.asObservable().pipe(C.distinctUntilChanged((n,e)=>JSON.stringify(n)===JSON.stringify(e)),C.shareReplay({bufferSize:1,refCount:!0}))}_createProtectionChangeStream(){return this._rangeProtectionRuleModel.ruleChange$.pipe(C.filter(r=>r.unitId!==this._unitId||r.subUnitId!==this._subUnitId?!1:r.type==="delete"?this._rangeMatches(r.rule):r.type==="add"?this._rangeMatches(r.rule):!1),C.map(r=>(this._permissionSubject.next(this._buildSnapshot()),r.type==="delete"?{type:"unprotected",ruleId:r.rule.id}:{type:"protected",rule:this._createFacadeRule(r.rule)})),C.shareReplay({bufferSize:1,refCount:!0}))}_rangeMatches(r){const n=this._range.getRange();return r.ranges.some(e=>n.startRow===e.startRow&&n.startColumn===e.startColumn&&n.endRow===e.endRow&&n.endColumn===e.endColumn)}_createFacadeRule(r){const n=r.ranges.map(t=>this._worksheet.getRange(t.startRow,t.startColumn,t.endRow-t.startRow+1,t.endColumn-t.startColumn+1)),e={name:r.description||"",allowViewByOthers:r.viewState!==s.ViewStateEnum.NoOneElseCanView,allowEdit:r.editState===s.EditStateEnum.DesignedUserCanEdit};return this._injector.createInstance(E,this._unitId,this._subUnitId,r.id,r.permissionId,n,e)}getPoint(r){const n=N[r];if(!n)return console.warn(`Unknown permission point: ${r}`),!1;const e=this._getProtectionRule();if(e){const t=new n(this._unitId,this._subUnitId,e.permissionId),i=this._permissionService.getPermissionPoint(t.id);if(i)return i.value}return!0}getSnapshot(){return this._buildSnapshot()}isProtected(){return this._getProtectionRule()!==null}canEdit(){return this.getPoint(I.Edit)}canView(){return this.getPoint(I.View)}canManageCollaborator(){return this.getPoint(I.ManageCollaborator)}canDelete(){return this.getPoint(I.Delete)}async setPoint(r,n){const e=N[r];if(!e)throw new Error(`Unknown permission point: ${r}`);const t=this._getProtectionRule();if(!t)throw new Error("Cannot set permission point: No protection rule exists for this range. Call protect() first.");if(this.getPoint(r)===n)return;const o=t.permissionId;this._fPermission.setRangeProtectionPermissionPoint(this._unitId,this._subUnitId,o,e,n),this._permissionSubject.next(this._buildSnapshot())}async protect(r){if(this.isProtected())throw new Error("Range is already protected");const n=await this._fPermission.addRangeBaseProtection(this._unitId,this._subUnitId,[this._range],r);if(!n)throw new Error("Failed to create range protection");const{permissionId:e,ruleId:t}=n;return await this._setPermissionPoints(e,r),this._injector.createInstance(E,this._unitId,this._subUnitId,t,e,[this._range],r||{})}_determineViewState(r){return(r==null?void 0:r.allowViewByOthers)===!1?s.ViewStateEnum.NoOneElseCanView:s.ViewStateEnum.OthersCanView}_determineEditState(r){var n;return(r==null?void 0:r.allowEdit)===!0&&((n=r==null?void 0:r.allowedUsers)!=null&&n.length)?s.EditStateEnum.DesignedUserCanEdit:s.EditStateEnum.OnlyMe}async _setPermissionPoints(r,n){if(!n)return;const e=(t,i)=>t===void 0?i:typeof t=="boolean"?t:!0;await this._setPermissionPoint(r,I.Edit,e(n.allowEdit,!1)),await this._setPermissionPoint(r,I.View,e(n.allowViewByOthers,!0))}async _setPermissionPoint(r,n,e){const t=N[n];t&&this._fPermission.setRangeProtectionPermissionPoint(this._unitId,this._subUnitId,r,t,e)}async unprotect(){const r=this._getProtectionRule();if(!r)return;const n=r.id;this._fPermission.removeRangeProtection(this._unitId,this._subUnitId,[n])}async listRules(){return await this._buildProtectionRulesAsync()}subscribe(r){const n=this.permission$.subscribe(r);return()=>n.unsubscribe()}_getProtectionRule(){const r=this._rangeProtectionRuleModel.getSubunitRuleList(this._unitId,this._subUnitId),n=this._range.getRange();for(const e of r)for(const t of e.ranges)if(n.startRow===t.startRow&&n.startColumn===t.startColumn&&n.endRow===t.endRow&&n.endColumn===t.endColumn)return e;return null}_buildProtectionRules(){return this._rangeProtectionRuleModel.getSubunitRuleList(this._unitId,this._subUnitId).map(n=>{const e=n.ranges.map(i=>this._worksheet.getRange(i.startRow,i.startColumn,i.endRow-i.startRow+1,i.endColumn-i.startColumn+1)),t={name:n.description||"",allowViewByOthers:n.viewState!==s.ViewStateEnum.NoOneElseCanView};return n.editState===s.EditStateEnum.DesignedUserCanEdit?t.allowEdit=!0:t.allowEdit=!1,this._injector.createInstance(E,this._unitId,this._subUnitId,n.id,n.permissionId,e,t)})}async _buildProtectionRulesAsync(){const r=this._rangeProtectionRuleModel.getSubunitRuleList(this._unitId,this._subUnitId);return(await Promise.all(r.map(async e=>{const t=e.ranges.map(o=>this._worksheet.getRange(o.startRow,o.startColumn,o.endRow-o.startRow+1,o.endColumn-o.startColumn+1)),i={name:e.description||"",allowViewByOthers:e.viewState!==s.ViewStateEnum.NoOneElseCanView};if(e.editState===s.EditStateEnum.DesignedUserCanEdit)try{const a=(await this._authzIoService.listCollaborators({objectID:e.permissionId,unitID:this._unitId})).filter(d=>d.role===H.Editor).map(d=>{var u;return((u=d.subject)==null?void 0:u.userID)||d.id});i.allowEdit=a.length>0}catch(o){console.warn(`Failed to fetch collaborators for rule ${e.id}:`,o),i.allowEdit=!1}else i.allowEdit=!1;return{rule:e,ranges:t,options:i}}))).map(({rule:e,ranges:t,options:i})=>this._injector.createInstance(E,this._unitId,this._subUnitId,e.id,e.permissionId,t,i))}_buildSnapshot(){const r={};return Object.values(I).forEach(n=>{r[n]=this.getPoint(n)}),r}dispose(){this._subscriptions.forEach(r=>r.unsubscribe()),this._permissionSubject.complete()}};K=Ce([O(4,h.Inject(h.Injector)),O(5,h.Inject(h.IPermissionService)),O(6,h.Inject(h.IAuthzIoService)),O(7,h.Inject(h.ICommandService)),O(8,h.Inject(s.RangeProtectionRuleModel))],K);var ke=Object.getOwnPropertyDescriptor,Ie=(r,n,e,t)=>{for(var i=t>1?void 0:t?ke(n,e):n,o=r.length-1,a;o>=0;o--)(a=r[o])&&(i=a(i)||i);return i},Y=(r,n)=>(e,t)=>n(e,t,r);c.FRange=(D=class extends b.FBaseInitialable{constructor(n,e,t,i,o,a){super(i),this._workbook=n,this._worksheet=e,this._range=t,this._injector=i,this._commandService=o,this._formulaDataModel=a;const d=this._worksheet.getRowCount(),u=this._worksheet.getColumnCount();if(this._range.startRow<0||this._range.startColumn<0||this._range.endRow>=d||this._range.endColumn>=u)throw new Error(`Range is out of bounds. Max rows: ${d}, Max columns: ${u}, Given range: ${JSON.stringify(this._range)}`);this._runInitializers(this._injector,this._workbook,this._worksheet,this._range,this._commandService,this._formulaDataModel)}getUnitId(){return this._workbook.getUnitId()}getSheetName(){return this._worksheet.getName()}getSheetId(){return this._worksheet.getSheetId()}getRange(){return this._range}getRow(){return this._range.startRow}getLastRow(){return this._range.endRow}getColumn(){return this._range.startColumn}getLastColumn(){return this._range.endColumn}getWidth(){return this._range.endColumn-this._range.startColumn+1}getHeight(){return this._range.endRow-this._range.startRow+1}isMerged(){const{startColumn:n,startRow:e,endColumn:t,endRow:i}=this._range;return this._worksheet.getMergedCellRange(e,n,i,t).some(a=>h.Rectangle.equals(a,this._range))}getCellStyleData(n="row"){return n!=="cell"?this._worksheet.getComposedCellStyle(this._range.startRow,this._range.startColumn,n==="row"):this._worksheet.getCellStyle(this._range.startRow,this._range.startColumn)}getFontFamily(n="row"){var e,t;return(t=(e=this.getCellStyleData(n))==null?void 0:e.ff)!=null?t:null}getFontSize(n="row"){var e,t;return(t=(e=this.getCellStyleData(n))==null?void 0:e.fs)!=null?t:null}getCellStyle(n="row"){const e=this.getCellStyleData(n);return e?h.TextStyleValue.create(e):null}getCellStyles(n="row"){return this.getCellDatas().map((t,i)=>t.map((o,a)=>{if(!o)return null;const d=n!=="cell"?this._worksheet.getComposedCellStyle(i+this._range.startRow,a+this._range.startColumn,n==="row"):this._worksheet.getCellStyle(i+this._range.startRow,a+this._range.startColumn);return d?h.TextStyleValue.create(d):null}))}getValue(n){var e,t;return n?this.getValueAndRichTextValue():(t=(e=this._worksheet.getCell(this._range.startRow,this._range.startColumn))==null?void 0:e.v)!=null?t:null}getRawValue(){var e,t;const n=this._worksheet.getCellMatrix().getValue(this._range.startRow,this._range.startColumn);return n!=null&&n.p&&((e=n.p.body)!=null&&e.dataStream)?n.p.body.dataStream:(t=n==null?void 0:n.v)!=null?t:null}getDisplayValue(){var e,t,i;const n=this._worksheet.getCell(this._range.startRow,this._range.startColumn);return n!=null&&n.p&&((e=n.p.body)!=null&&e.dataStream)?n.p.body.dataStream:(i=(t=n==null?void 0:n.v)==null?void 0:t.toString())!=null?i:""}getValues(n){var d,u;if(n)return this.getValueAndRichTextValues();const{startRow:e,endRow:t,startColumn:i,endColumn:o}=this._range,a=[];for(let l=e;l<=t;l++){const m=[];for(let _=i;_<=o;_++)m.push((u=(d=this._worksheet.getCell(l,_))==null?void 0:d.v)!=null?u:null);a.push(m)}return a}getRawValues(){var d,u;const n=this._worksheet.getCellMatrix(),{startRow:e,endRow:t,startColumn:i,endColumn:o}=this._range,a=[];for(let l=e;l<=t;l++){const m=[];for(let _=i;_<=o;_++){const k=n.getValue(l,_);k!=null&&k.p&&((d=k.p.body)!=null&&d.dataStream)?m.push(k.p.body.dataStream):m.push((u=k==null?void 0:k.v)!=null?u:null)}a.push(m)}return a}getDisplayValues(){var a,d,u;const{startRow:n,endRow:e,startColumn:t,endColumn:i}=this._range,o=[];for(let l=n;l<=e;l++){const m=[];for(let _=t;_<=i;_++){const k=this._worksheet.getCell(l,_);k!=null&&k.p&&((a=k.p.body)!=null&&a.dataStream)?m.push(k.p.body.dataStream):m.push((u=(d=k==null?void 0:k.v)==null?void 0:d.toString())!=null?u:"")}o.push(m)}return o}getCellData(){var n;return(n=this._worksheet.getCell(this._range.startRow,this._range.startColumn))!=null?n:null}getCellDatas(){return this.getCellDataGrid()}getCellDataGrid(){const{startRow:n,endRow:e,startColumn:t,endColumn:i}=this._range,o=[];for(let a=n;a<=e;a++){const d=[];for(let u=t;u<=i;u++)d.push(this._worksheet.getCellRaw(a,u));o.push(d)}return o}getRichTextValue(){const n=this.getCellData();return n!=null&&n.p?new h.RichTextValue(n.p):null}getRichTextValues(){return this.getCellDataGrid().map(e=>e.map(t=>t!=null&&t.p?new h.RichTextValue(t.p):null))}getValueAndRichTextValue(){const n=this.getCellData();return n!=null&&n.p?new h.RichTextValue(n.p):n==null?void 0:n.v}getValueAndRichTextValues(){return this.getCellDatas().map(e=>e.map(t=>t!=null&&t.p?new h.RichTextValue(t.p):t==null?void 0:t.v))}getFormula(){var n;return(n=this._formulaDataModel.getFormulaStringByCell(this._range.startRow,this._range.startColumn,this._worksheet.getSheetId(),this._workbook.getUnitId()))!=null?n:""}getFormulas(){const n=[],{startRow:e,endRow:t,startColumn:i,endColumn:o}=this._range,a=this._worksheet.getSheetId(),d=this._workbook.getUnitId();for(let u=e;u<=t;u++){const l=[];for(let m=i;m<=o;m++){const _=this._formulaDataModel.getFormulaStringByCell(u,m,a,d);l.push(_||"")}n.push(l)}return n}getWrap(){return this._worksheet.getRange(this._range).getWrap()===h.BooleanNumber.TRUE}getWraps(){const n=this.getCellDatas(),e=this._workbook.getStyles();return n.map(t=>t.map(i=>{var o;return((o=e.getStyleByCell(i))==null?void 0:o.tb)===h.WrapStrategy.WRAP}))}getWrapStrategy(){return this._worksheet.getRange(this._range).getWrapStrategy()}getHorizontalAlignment(){const n=this._worksheet.getRange(this._range).getHorizontalAlignment();return Z(n)}getHorizontalAlignments(){return this._worksheet.getRange(this._range).getHorizontalAlignments().map(e=>e.map(t=>Z(t)))}getVerticalAlignment(){return Q(this._worksheet.getRange(this._range).getVerticalAlignment())}getVerticalAlignments(){return this._worksheet.getRange(this._range).getVerticalAlignments().map(e=>e.map(t=>Q(t)))}setCustomMetaData(n){return this.setValue({custom:n})}setCustomMetaDatas(n){return this.setValues(n.map(e=>e.map(t=>({custom:t}))))}getCustomMetaData(){var e;const n=this.getCellData();return(e=n==null?void 0:n.custom)!=null?e:null}getCustomMetaDatas(){return this.getCellDataGrid().map(e=>e.map(t=>{var i;return(i=t==null?void 0:t.custom)!=null?i:null}))}setBorder(n,e,t){return this._commandService.syncExecuteCommand(s.SetBorderBasicCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),ranges:[this._range],value:{type:n,style:e,color:t}}),this}getBackground(){var e,t;const n=this.getCellStyle();return(t=(e=n==null?void 0:n.background)==null?void 0:e.rgb)!=null?t:h.DEFAULT_STYLES.bg.rgb}getBackgrounds(){return this.getCellStyles().map(e=>e.map(t=>{var i,o;return(o=(i=t==null?void 0:t.background)==null?void 0:i.rgb)!=null?o:h.DEFAULT_STYLES.bg.rgb}))}setBackgroundColor(n){return this._commandService.syncExecuteCommand(s.SetStyleCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,style:{type:"bg",value:{rgb:n}}}),this}setBackground(n){return this.setBackgroundColor(n),this}setTextRotation(n){return this._commandService.syncExecuteCommand(s.SetTextRotationCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,value:n}),this}setValue(n){const e=h.covertCellValue(n);if(!e)throw new Error("Invalid value");return this._commandService.syncExecuteCommand(s.SetRangeValuesCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,value:e}),this}setValueForCell(n){const e=h.covertCellValue(n);if(!e)throw new Error("Invalid value");return this._commandService.syncExecuteCommand(s.SetRangeValuesCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:{startColumn:this._range.startColumn,startRow:this._range.startRow,endColumn:this._range.startColumn,endRow:this._range.startRow},value:e}),this}setRichTextValueForCell(n){const e=n instanceof h.RichTextValue?n.getData():n,t={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:{startColumn:this._range.startColumn,startRow:this._range.startRow,endColumn:this._range.startColumn,endRow:this._range.startRow},value:{p:e}};return this._commandService.syncExecuteCommand(s.SetRangeValuesCommand.id,t),this}setRichTextValues(n){const e=n.map(o=>o.map(a=>a&&{p:a instanceof h.RichTextValue?a.getData():a})),t=h.covertCellValues(e,this._range),i={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,value:t};return this._commandService.syncExecuteCommand(s.SetRangeValuesCommand.id,i),this}setWrap(n){return this._commandService.syncExecuteCommand(s.SetTextWrapCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,value:n?h.WrapStrategy.WRAP:h.WrapStrategy.UNSPECIFIED}),this}setWrapStrategy(n){return this._commandService.syncExecuteCommand(s.SetTextWrapCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,value:n}),this}setVerticalAlignment(n){return this._commandService.syncExecuteCommand(s.SetVerticalTextAlignCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,value:ge(n)}),this}setHorizontalAlignment(n){return this._commandService.syncExecuteCommand(s.SetHorizontalTextAlignCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,value:me(n)}),this}setValues(n){const e=h.covertCellValues(n,this._range);return this._commandService.syncExecuteCommand(s.SetRangeValuesCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,value:e}),this}setFontWeight(n){let e;if(n==="bold")e=h.BooleanNumber.TRUE;else if(n==="normal")e=h.BooleanNumber.FALSE;else if(n===null)e=null;else throw new Error("Invalid fontWeight");const t={type:"bl",value:e},i={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,style:t};return this._commandService.syncExecuteCommand(s.SetStyleCommand.id,i),this}setFontStyle(n){let e;if(n==="italic")e=h.BooleanNumber.TRUE;else if(n==="normal")e=h.BooleanNumber.FALSE;else if(n===null)e=null;else throw new Error("Invalid fontStyle");const t={type:"it",value:e},i={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,style:t};return this._commandService.syncExecuteCommand(s.SetStyleCommand.id,i),this}setFontLine(n){if(n==="underline")this._setFontUnderline({s:h.BooleanNumber.TRUE});else if(n==="line-through")this._setFontStrikethrough({s:h.BooleanNumber.TRUE});else if(n==="none")this._setFontUnderline({s:h.BooleanNumber.FALSE}),this._setFontStrikethrough({s:h.BooleanNumber.FALSE});else if(n===null)this._setFontUnderline(null),this._setFontStrikethrough(null);else throw new Error("Invalid fontLine");return this}_setFontUnderline(n){const e={type:"ul",value:n},t={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,style:e};this._commandService.syncExecuteCommand(s.SetStyleCommand.id,t)}_setFontStrikethrough(n){const e={type:"st",value:n},t={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,style:e};this._commandService.syncExecuteCommand(s.SetStyleCommand.id,t)}setFontFamily(n){const e={type:"ff",value:n},t={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,style:e};return this._commandService.syncExecuteCommand(s.SetStyleCommand.id,t),this}setFontSize(n){const e={type:"fs",value:n},t={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,style:e};return this._commandService.syncExecuteCommand(s.SetStyleCommand.id,t),this}setFontColor(n){const t={type:"cl",value:n===null?null:{rgb:n}},i={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,style:t};return this._commandService.syncExecuteCommand(s.SetStyleCommand.id,i),this}merge(n=!0){const e=this._workbook.getUnitId(),t=this._worksheet.getSheetId();return s.addMergeCellsUtil(this._injector,e,t,[this._range],n),this}mergeAcross(n=!0){const e=s.getAddMergeMutationRangeByType([this._range],h.Dimension.ROWS),t=this._workbook.getUnitId(),i=this._worksheet.getSheetId();return s.addMergeCellsUtil(this._injector,t,i,e,n),this}mergeVertically(n=!0){const e=s.getAddMergeMutationRangeByType([this._range],h.Dimension.COLUMNS),t=this._workbook.getUnitId(),i=this._worksheet.getSheetId();return s.addMergeCellsUtil(this._injector,t,i,e,n),this}isPartOfMerge(){const{startRow:n,startColumn:e,endRow:t,endColumn:i}=this._range;return this._worksheet.getMergedCellRange(n,e,t,i).length>0}breakApart(){return this._commandService.syncExecuteCommand(s.RemoveWorksheetMergeCommand.id,{ranges:[this._range]}),this}forEach(n){const{startColumn:e,startRow:t,endColumn:i,endRow:o}=this._range;this._worksheet.getMatrixWithMergedCells(t,e,o,i).forValue((a,d,u)=>{n(a,d,u)})}getA1Notation(n,e,t){const i={...this._range,startAbsoluteRefType:e,endAbsoluteRefType:t};return n?P.serializeRangeWithSheet(this._worksheet.getName(),i):P.serializeRange(i)}activate(){return this._injector.createInstance(c.FWorkbook,this._workbook).setActiveRange(this),this}activateAsCurrentCell(){const n=this._worksheet.getMergedCell(this._range.startRow,this._range.startColumn);if(n&&h.Rectangle.equals(n,this._range)||!n&&this._range.startRow===this._range.endRow&&this._range.startColumn===this._range.endColumn){const i=this._injector.createInstance(c.FWorkbook,this._workbook).getActiveRange();if(!i||i.getUnitId()!==this.getUnitId()||i.getSheetId()!==this.getSheetId())return this.activate();if(h.Rectangle.contains(i.getRange(),this._range)){const o={unitId:this.getUnitId(),subUnitId:this.getSheetId(),selections:[{range:i.getRange(),primary:s.getPrimaryForRange(this.getRange(),this._worksheet),style:null}]};return this._commandService.syncExecuteCommand(s.SetSelectionsOperation.id,o),this}return this.activate()}else throw new Error("The range is not a single cell")}splitTextToColumns(n,e,t){this._commandService.syncExecuteCommand(s.SplitTextToColumnsCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,delimiter:e,customDelimiter:t,treatMultipleDelimitersAsOne:n})}useThemeStyle(n){if(n==null){const e=this.getUsedThemeStyle();e&&this.removeThemeStyle(e)}else this._commandService.syncExecuteCommand(s.SetWorksheetRangeThemeStyleCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,themeName:n})}removeThemeStyle(n){this._commandService.syncExecuteCommand(s.DeleteWorksheetRangeThemeStyleCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,themeName:n})}getUsedThemeStyle(){return this._injector.get(s.SheetRangeThemeService).getAppliedRangeThemeStyle({unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range})}clear(n){return n&&n.contentsOnly&&!n.formatOnly?this.clearContent():n&&n.formatOnly&&!n.contentsOnly?this.clearFormat():(this._commandService.syncExecuteCommand(s.ClearSelectionAllCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),ranges:[this._range],options:n}),this)}clearContent(){return this._commandService.syncExecuteCommand(s.ClearSelectionContentCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),ranges:[this._range]}),this}clearFormat(){return this._commandService.syncExecuteCommand(s.ClearSelectionFormatCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),ranges:[this._range]}),this}insertCells(n){n===h.Dimension.ROWS?this._commandService.executeCommand(s.InsertRangeMoveDownCommand.id,{range:this._range}):this._commandService.executeCommand(s.InsertRangeMoveRightCommand.id,{range:this._range})}deleteCells(n){n===h.Dimension.ROWS?this._commandService.executeCommand(s.DeleteRangeMoveUpCommand.id,{range:this._range}):this._commandService.executeCommand(s.DeleteRangeMoveLeftCommand.id,{range:this._range})}getDataRegion(n){const{startRow:e,startColumn:t,endRow:i,endColumn:o}=this._range,a=this._worksheet.getMaxRows(),d=this._worksheet.getMaxColumns(),u=this._worksheet.getCellMatrix();let l=e,m=t,_=i,k=o;if(n!==h.Dimension.COLUMNS){let v=!1,R=!1;for(let f=t;f<=o&&(e>0&&!h.isNullCell(u.getValue(e-1,f))&&(v=!0),i<a-1&&!h.isNullCell(u.getValue(i+1,f))&&(R=!0),!(v&&R));f++);v&&(l=e-1),R&&(_=i+1)}if(n!==h.Dimension.ROWS){let v=!1,R=!1;for(let f=e;f<=i&&(t>0&&!h.isNullCell(u.getValue(f,t-1))&&(v=!0),o<d-1&&!h.isNullCell(u.getValue(f,o+1))&&(R=!0),!(v&&R));f++);v&&(m=t-1),R&&(k=o+1)}return this._injector.createInstance(c.FRange,this._workbook,this._worksheet,{startRow:l,startColumn:m,endRow:_,endColumn:k})}isBlank(){const n=this._worksheet.getCellMatrix(),{startRow:e,startColumn:t,endRow:i,endColumn:o}=this._range;let a=!0;for(let d=e;d<=i;d++){for(let u=t;u<=o;u++)if(!h.isNullCell(n.getValue(d,u))){a=!1;break}if(!a)break}return a}offset(n,e,t,i){const{startRow:o,startColumn:a,endRow:d,endColumn:u}=this._range,l=o+n,m=a+e,_=t?l+t-1:d+n,k=i?m+i-1:u+e;if(l<0||m<0||_<0||k<0)throw new Error("The row or column index is out of range");return this._injector.createInstance(c.FRange,this._workbook,this._worksheet,{startRow:l,startColumn:m,endRow:_,endColumn:k})}setFormula(n){return this.setValue({f:n})}setFormulas(n){return this.setValues(n.map(e=>e.map(t=>({f:t}))))}getRangePermission(){const n=this._injector.createInstance(c.FWorksheet,this._injector.createInstance(c.FWorkbook,this._workbook),this._workbook,this._worksheet);return this._injector.createInstance(K,this._workbook.getUnitId(),this._worksheet.getSheetId(),this,n)}},D._enableManualInit(),D),c.FRange=Ie([Y(3,h.Inject(h.Injector)),Y(4,h.ICommandService),Y(5,h.Inject(P.FormulaDataModel))],c.FRange);var be=Object.getOwnPropertyDescriptor,fe=(r,n,e,t)=>{for(var i=t>1?void 0:t?be(n,e):n,o=r.length-1,a;o>=0;o--)(a=r[o])&&(i=a(i)||i);return i},q=(r,n)=>(e,t)=>n(e,t,r);let J=class{constructor(r,n,e,t){w(this,"_permissionSubject");w(this,"_collaboratorChangeSubject",new j.Subject);w(this,"permission$");w(this,"pointChange$");w(this,"collaboratorChange$");w(this,"_subscriptions",[]);w(this,"_fPermission");this._unitId=r,this._injector=n,this._permissionService=e,this._authzIoService=t,this._fPermission=this._injector.createInstance(c.FPermission),this._permissionSubject=new j.BehaviorSubject(this._buildSnapshot()),this.permission$=this._createPermissionStream(),this.pointChange$=this._createPointChangeStream(),this.collaboratorChange$=this._collaboratorChangeSubject.asObservable().pipe(C.shareReplay({bufferSize:1,refCount:!0}))}_createPermissionStream(){const r=this._permissionService.permissionPointUpdate$.pipe(C.filter(n=>n.id.includes(this._unitId))).subscribe(()=>{this._permissionSubject.next(this._buildSnapshot())});return this._subscriptions.push(r),this._permissionSubject.asObservable().pipe(C.distinctUntilChanged((n,e)=>JSON.stringify(n)===JSON.stringify(e)),C.shareReplay({bufferSize:1,refCount:!0}))}_createPointChangeStream(){const r=new Map;for(const n in g){const e=g[n];r.set(e,this.getPoint(e))}return this._permissionService.permissionPointUpdate$.pipe(C.filter(n=>n.id.includes(this._unitId)),C.map(n=>{const e=this._extractWorkbookPointType(n.id);if(!e)return null;const t=!!n.value,i=r.get(e);return r.set(e,t),i===t?null:{point:e,value:t,oldValue:i}}),C.filter(n=>n!==null),C.shareReplay({bufferSize:1,refCount:!0}))}_extractWorkbookPointType(r){for(const n in g){const e=g[n],t=x[e];if(!t)continue;if(new t(this._unitId).id===r)return e}return null}_buildSnapshot(){const r={};for(const n in g){const e=g[n];r[e]=this.getPoint(e)}return r}async setMode(r){const n=this._getModePermissions(r);await this._batchSetPermissionPoints(n)}_getModePermissions(r){const n={};switch(Object.values(g).forEach(e=>{n[e]=!1}),r){case"owner":Object.values(g).forEach(e=>{n[e]=!0});break;case"editor":n[g.Edit]=!0,n[g.View]=!0,n[g.Print]=!0,n[g.Export]=!0,n[g.CopyContent]=!0,n[g.Comment]=!0,n[g.CreateSheet]=!0,n[g.DeleteSheet]=!0,n[g.RenameSheet]=!0,n[g.MoveSheet]=!0,n[g.HideSheet]=!0,n[g.InsertRow]=!0,n[g.InsertColumn]=!0,n[g.DeleteRow]=!0,n[g.DeleteColumn]=!0,n[g.CopySheet]=!0,n[g.CreateProtection]=!0;break;case"viewer":n[g.View]=!0,n[g.Print]=!0;break;case"commenter":n[g.View]=!0,n[g.Comment]=!0,n[g.Print]=!0;break}return n}async _batchSetPermissionPoints(r){const n=[];for(const[e,t]of Object.entries(r)){const i=e,o=x[i];if(!o)throw new Error(`Unknown workbook permission point: ${i}`);const a=this.getPoint(i);a!==t&&(this._fPermission.setWorkbookPermissionPoint(this._unitId,o,t),n.push({point:i,value:t,oldValue:a}))}if(n.length>0){const e=this._buildSnapshot();this._permissionSubject.next(e)}}async setReadOnly(){await this.setMode("viewer")}async setEditable(){await this.setMode("editor")}canEdit(){return this.getPoint(g.Edit)}async setPoint(r,n){const e=x[r];if(!e)throw new Error(`Unknown workbook permission point: ${r}`);if(this.getPoint(r)===n)return;this._fPermission.setWorkbookPermissionPoint(this._unitId,e,n);const i=this._buildSnapshot();this._permissionSubject.next(i)}getPoint(r){var i;const n=x[r];if(!n)throw new Error(`Unknown workbook permission point: ${r}`);const e=new n(this._unitId),t=this._permissionService.getPermissionPoint(e.id);return(i=t==null?void 0:t.value)!=null?i:!0}getSnapshot(){return this._buildSnapshot()}async setCollaborators(r){const n=r.map(e=>({id:e.user.userID,subject:e.user,role:e.role}));await this._authzIoService.putCollaborators({objectID:this._unitId,unitID:this._unitId,collaborators:n}),r.forEach(e=>{this._collaboratorChangeSubject.next({type:"add",collaborator:{user:{id:e.user.userID},role:e.role}})})}async addCollaborator(r,n){await this._authzIoService.createCollaborator({objectID:this._unitId,unitID:this._unitId,collaborators:[{id:r.userID,subject:r,role:n}]}),this._collaboratorChangeSubject.next({type:"add",collaborator:{user:{id:r.userID},role:n}})}async updateCollaborator(r,n){await this._authzIoService.updateCollaborator({objectID:this._unitId,unitID:this._unitId,collaborator:{id:r.userID,subject:r,role:n}}),this._collaboratorChangeSubject.next({type:"update",collaborator:{user:{id:r.userID},role:n}})}async removeCollaborator(r){await this._authzIoService.deleteCollaborator({objectID:this._unitId,unitID:this._unitId,collaboratorID:r}),this._collaboratorChangeSubject.next({type:"delete",collaborator:{user:{id:r},role:M.Reader}})}async removeCollaborators(r){for(const n of r)await this.removeCollaborator(n)}async listCollaborators(){return(await this._authzIoService.listCollaborators({objectID:this._unitId,unitID:this._unitId})).map(n=>{var e,t;return{user:{id:((e=n.subject)==null?void 0:e.userID)||n.id,displayName:((t=n.subject)==null?void 0:t.name)||""},role:n.role}})}subscribe(r){const n=this.permission$.subscribe(r);return()=>n.unsubscribe()}dispose(){this._subscriptions.forEach(r=>r.unsubscribe()),this._permissionSubject.complete(),this._collaboratorChangeSubject.complete()}};J=fe([q(1,h.Inject(h.Injector)),q(2,h.IPermissionService),q(3,h.IAuthzIoService)],J);var ve=Object.getOwnPropertyDescriptor,Re=(r,n,e,t)=>{for(var i=t>1?void 0:t?ve(n,e):n,o=r.length-1,a;o>=0;o--)(a=r[o])&&(i=a(i)||i);return i},y=(r,n)=>(e,t)=>n(e,t,r);c.FWorkbook=class extends b.FBaseInitialable{constructor(e,t,i,o,a,d,u,l,m,_){super(t);w(this,"id");this._workbook=e,this._injector=t,this._resourceLoaderService=i,this._selectionManagerService=o,this._univerInstanceService=a,this._commandService=d,this._permissionService=u,this._logService=l,this._localeService=m,this._definedNamesService=_,this.id=this._workbook.getUnitId()}getWorkbook(){return this._workbook}dispose(){super.dispose(),this._workbook=null}getId(){return this.id}getName(){return this._workbook.name}setName(e){return this._commandService.syncExecuteCommand(s.SetWorkbookNameCommand.id,{unitId:this._workbook.getUnitId(),name:e}),this}save(){return this._resourceLoaderService.saveUnit(this._workbook.getUnitId())}getSnapshot(){return this._logService.warn("use 'save' instead of 'getSnapshot'"),this.save()}getActiveSheet(){const e=this._workbook.getActiveSheet();return this._injector.createInstance(c.FWorksheet,this,this._workbook,e)}getSheets(){return this._workbook.getSheets().map(e=>this._injector.createInstance(c.FWorksheet,this,this._workbook,e))}create(e,t,i,o){var l,m,_;const a=h.mergeWorksheetSnapshotWithDefault(h.Tools.deepClone((l=o==null?void 0:o.sheet)!=null?l:{}));a.name=this._workbook.uniqueSheetName(e),a.rowCount=t,a.columnCount=i,a.id=(m=o==null?void 0:o.sheet)==null?void 0:m.id;const d=(_=o==null?void 0:o.index)!=null?_:this._workbook.getSheets().length;this._commandService.syncExecuteCommand(s.InsertSheetCommand.id,{unitId:this.id,index:d,sheet:a}),this._commandService.syncExecuteCommand(s.SetWorksheetActiveOperation.id,{unitId:this.id,subUnitId:this._workbook.getSheets()[d].getSheetId()});const u=this._workbook.getActiveSheet();if(!u)throw new Error("No active sheet found");return this._injector.createInstance(c.FWorksheet,this,this._workbook,u)}getSheetBySheetId(e){const t=this._workbook.getSheetBySheetId(e);return t?this._injector.createInstance(c.FWorksheet,this,this._workbook,t):null}getSheetByName(e){const t=this._workbook.getSheetBySheetName(e);return t?this._injector.createInstance(c.FWorksheet,this,this._workbook,t):null}setActiveSheet(e){return this._commandService.syncExecuteCommand(s.SetWorksheetActiveOperation.id,{unitId:this.id,subUnitId:typeof e=="string"?e:e.getSheetId()}),typeof e=="string"?this.getSheetBySheetId(e):e}insertSheet(e,t){var d,u,l;const i=h.mergeWorksheetSnapshotWithDefault(h.Tools.deepClone((d=t==null?void 0:t.sheet)!=null?d:{}));i.name=this._workbook.uniqueSheetName(e),i.id=(u=t==null?void 0:t.sheet)==null?void 0:u.id;const o=(l=t==null?void 0:t.index)!=null?l:this._workbook.getSheets().length;this._commandService.syncExecuteCommand(s.InsertSheetCommand.id,{unitId:this.id,index:o,sheet:i}),this._commandService.syncExecuteCommand(s.SetWorksheetActiveOperation.id,{unitId:this.id,subUnitId:this._workbook.getSheets()[o].getSheetId()});const a=this._workbook.getActiveSheet();if(!a)throw new Error("No active sheet found");return this._injector.createInstance(c.FWorksheet,this,this._workbook,a)}deleteSheet(e){const t=this.id,i=typeof e=="string"?e:e.getSheetId();return this._commandService.syncExecuteCommand(s.RemoveSheetCommand.id,{unitId:t,subUnitId:i})}undo(){return this._univerInstanceService.focusUnit(this.id),this._commandService.syncExecuteCommand(h.UndoCommand.id),this}redo(){return this._univerInstanceService.focusUnit(this.id),this._commandService.syncExecuteCommand(h.RedoCommand.id),this}onBeforeCommandExecute(e){return this._commandService.beforeCommandExecuted(t=>{var i;((i=t.params)==null?void 0:i.unitId)===this.id&&e(t)})}onCommandExecuted(e){return this._commandService.onCommandExecuted(t=>{var i;((i=t.params)==null?void 0:i.unitId)===this.id&&e(t)})}onSelectionChange(e){return h.toDisposable(this._selectionManagerService.selectionMoveEnd$.subscribe(t=>{this._univerInstanceService.getCurrentUnitForType(h.UniverInstanceType.UNIVER_SHEET).getUnitId()===this.id&&(t!=null&&t.length?e(t.map(i=>i.range)):e([]))}))}setEditable(e){const t=new s.WorkbookEditablePermission(this._workbook.getUnitId());return this._permissionService.getPermissionPoint(t.id)||this._permissionService.addPermissionPoint(t),this._permissionService.updatePermissionPoint(t.id,e),this}setActiveRange(e){const t=this.getActiveSheet(),i=e.getRange().sheetId||t.getSheetId(),o=i?this._workbook.getSheetBySheetId(i):this._workbook.getActiveSheet(!0);if(!o)throw new Error("No active sheet found");o.getSheetId()!==t.getSheetId()&&this.setActiveSheet(this._injector.createInstance(c.FWorksheet,this,this._workbook,o));const a={unitId:this.getId(),subUnitId:i,selections:[e].map(d=>({range:d.getRange(),primary:s.getPrimaryForRange(d.getRange(),o),style:null}))};return this._commandService.syncExecuteCommand(s.SetSelectionsOperation.id,a),this}getActiveRange(){const e=this._workbook.getActiveSheet(),i=this._selectionManagerService.getCurrentSelections().find(o=>!!o.primary);return i?this._injector.createInstance(c.FRange,this._workbook,e,i.range):null}getActiveCell(){const e=this._workbook.getActiveSheet(),i=this._selectionManagerService.getCurrentSelections().find(a=>!!a.primary);if(!i)return null;const o={...i.primary,rangeType:h.RANGE_TYPE.NORMAL};return this._injector.createInstance(c.FRange,this._workbook,e,o)}deleteActiveSheet(){const e=this.getActiveSheet();return this.deleteSheet(e)}duplicateSheet(e){return this._commandService.syncExecuteCommand(s.CopySheetCommand.id,{unitId:e.getWorkbook().getUnitId(),subUnitId:e.getSheetId()}),this._injector.createInstance(c.FWorksheet,this,this._workbook,this._workbook.getActiveSheet())}duplicateActiveSheet(){const e=this.getActiveSheet();return this.duplicateSheet(e)}getNumSheets(){return this._workbook.getSheets().length}getLocale(){return this._localeService.getCurrentLocale()}setLocale(e){this._localeService.setLocale(e)}setSpreadsheetLocale(e){return this._localeService.setLocale(e),this}getUrl(){return location.href}moveSheet(e,t){let i=t;return i<0?i=0:i>this._workbook.getSheets().length-1&&(i=this._workbook.getSheets().length-1),this._commandService.syncExecuteCommand(s.SetWorksheetOrderCommand.id,{unitId:e.getWorkbook().getUnitId(),order:i,subUnitId:e.getSheetId()}),this}moveActiveSheet(e){const t=this.getActiveSheet();return this.moveSheet(t,e)}getPermission(){return this._injector.createInstance(c.FPermission)}getWorkbookPermission(){return this._injector.createInstance(J,this._workbook.getUnitId())}getDefinedName(e){const t=this._definedNamesService.getValueByName(this.id,e);return t?this._injector.createInstance(A,{...t,unitId:this.id}):null}getDefinedNames(){const e=this._definedNamesService.getDefinedNameMap(this.id);return e?Object.values(e).map(t=>this._injector.createInstance(A,{...t,unitId:this.id})):[]}insertDefinedName(e,t){const o=this._injector.createInstance(V).setName(e).setRef(t).build();return o.localSheetId=s.SCOPE_WORKBOOK_VALUE_DEFINED_NAME,this.insertDefinedNameBuilder(o),this}deleteDefinedName(e){const t=this.getDefinedName(e);return t?(t.delete(),!0):!1}insertDefinedNameBuilder(e){e.unitId=this.getId(),this._commandService.syncExecuteCommand(s.SetDefinedNameCommand.id,e)}updateDefinedNameBuilder(e){this._commandService.syncExecuteCommand(s.SetDefinedNameCommand.id,e)}getRegisteredRangeThemes(){return this._injector.get(s.SheetRangeThemeService).getRegisteredRangeThemes()}registerRangeTheme(e){this._commandService.syncExecuteCommand(s.RegisterWorksheetRangeThemeStyleCommand.id,{unitId:this.getId(),rangeThemeStyle:e})}unregisterRangeTheme(e){this._commandService.syncExecuteCommand(s.UnregisterWorksheetRangeThemeStyleCommand.id,{unitId:this.getId(),themeName:e})}createRangeThemeStyle(e,t){return new s.RangeThemeStyle(e,t)}setCustomMetadata(e){return this._workbook.setCustomMetadata(e),this}getCustomMetadata(){return this._workbook.getCustomMetadata()}addStyles(e){this._workbook.addStyles(e)}removeStyles(e){this._workbook.removeStyles(e)}},c.FWorkbook=Re([y(1,h.Inject(h.Injector)),y(2,h.Inject(h.IResourceLoaderService)),y(3,h.Inject(s.SheetsSelectionsService)),y(4,h.IUniverInstanceService),y(5,h.ICommandService),y(6,h.IPermissionService),y(7,h.ILogService),y(8,h.Inject(h.LocaleService)),y(9,P.IDefinedNamesService)],c.FWorkbook);class pe extends b.FUniver{getCommandSheetTarget(n){var o;const e=n.params;if(!e)return this.getActiveSheet();const t=e.unitId?this.getUniverSheet(e.unitId):(o=this.getActiveWorkbook)==null?void 0:o.call(this);if(!t)return;const i=t.getSheetBySheetId(e.subUnitId||e.sheetId)||t.getActiveSheet();if(i)return{workbook:t,worksheet:i}}getSheetTarget(n,e){const t=this.getUniverSheet(n);if(!t)return;const i=t.getSheetBySheetId(e);if(i)return{workbook:t,worksheet:i}}_initWorkbookEvent(n){const e=n.get(h.IUniverInstanceService);this.registerEventHandler(this.Event.WorkbookDisposed,()=>e.unitDisposed$.subscribe(t=>{t.type===h.UniverInstanceType.UNIVER_SHEET&&this.fireEvent(this.Event.WorkbookDisposed,{unitId:t.getUnitId(),unitType:t.type,snapshot:t.getSnapshot()})})),this.registerEventHandler(this.Event.WorkbookCreated,()=>e.unitAdded$.subscribe(t=>{if(t.type===h.UniverInstanceType.UNIVER_SHEET){const i=t,o=n.createInstance(c.FWorkbook,i);this.fireEvent(this.Event.WorkbookCreated,{unitId:t.getUnitId(),type:t.type,workbook:o,unit:o})}}))}_initialize(n){const e=n.get(h.ICommandService);this.registerEventHandler(this.Event.BeforeSheetCreate,()=>e.beforeCommandExecuted(t=>{var i;if(t.id===s.InsertSheetCommand.id){const o=t.params,{unitId:a,index:d,sheet:u}=o||{},l=a?this.getUniverSheet(a):(i=this.getActiveWorkbook)==null?void 0:i.call(this);if(!l)return;const m={workbook:l,index:d,sheet:u};if(this.fireEvent(this.Event.BeforeSheetCreate,m),m.cancel)throw new h.CanceledError}})),this.registerEventHandler(this.Event.BeforeActiveSheetChange,()=>e.beforeCommandExecuted(t=>{var i;if(t.id===s.SetWorksheetActiveOperation.id){const{subUnitId:o,unitId:a}=t.params,d=a?this.getUniverSheet(a):(i=this.getActiveWorkbook)==null?void 0:i.call(this);if(!d||!o)return;const u=d.getSheetBySheetId(o),l=d.getActiveSheet();if(!u||!l)return;const m={workbook:d,activeSheet:u,oldActiveSheet:l};if(this.fireEvent(this.Event.BeforeActiveSheetChange,m),m.cancel)throw new h.CanceledError}})),this.registerEventHandler(this.Event.BeforeSheetDelete,()=>e.beforeCommandExecuted(t=>{if(t.id===s.RemoveSheetCommand.id){const i=this.getCommandSheetTarget(t);if(!i)return;const{workbook:o,worksheet:a}=i,d={workbook:o,worksheet:a};if(this.fireEvent(this.Event.BeforeSheetDelete,d),d.cancel)throw new h.CanceledError}})),this.registerEventHandler(this.Event.BeforeSheetMove,()=>e.beforeCommandExecuted(t=>{if(t.id===s.SetWorksheetOrderMutation.id){const{fromOrder:i,toOrder:o}=t.params,a=this.getCommandSheetTarget(t);if(!a)return;const d={workbook:a.workbook,worksheet:a.worksheet,newIndex:o,oldIndex:i};if(this.fireEvent(this.Event.BeforeSheetMove,d),d.cancel)throw new h.CanceledError}})),this.registerEventHandler(this.Event.BeforeSheetNameChange,()=>e.beforeCommandExecuted(t=>{if(t.id===s.SetWorksheetNameCommand.id){const{name:i}=t.params,o=this.getCommandSheetTarget(t);if(!o)return;const a={workbook:o.workbook,worksheet:o.worksheet,newName:i,oldName:o.worksheet.getSheetName()};if(this.fireEvent(this.Event.BeforeSheetNameChange,a),a.cancel)throw new h.CanceledError}})),this.registerEventHandler(this.Event.BeforeSheetTabColorChange,()=>e.beforeCommandExecuted(t=>{if(t.id===s.SetTabColorMutation.id){const{color:i}=t.params,o=this.getCommandSheetTarget(t);if(!o)return;const a={workbook:o.workbook,worksheet:o.worksheet,newColor:i,oldColor:o.worksheet.getTabColor()};if(this.fireEvent(this.Event.BeforeSheetTabColorChange,a),a.cancel)throw new h.CanceledError}})),this.registerEventHandler(this.Event.BeforeSheetHideChange,()=>e.beforeCommandExecuted(t=>{if(t.id===s.SetWorksheetHideMutation.id){const{hidden:i}=t.params,o=this.getCommandSheetTarget(t);if(!o)return;const a={workbook:o.workbook,worksheet:o.worksheet,hidden:!!i};if(this.fireEvent(this.Event.BeforeSheetHideChange,a),a.cancel)throw new h.CanceledError}})),this.registerEventHandler(this.Event.BeforeGridlineColorChange,()=>e.beforeCommandExecuted(t=>{var i;if(t.id===s.SetGridlinesColorCommand.id){const o=this.getCommandSheetTarget(t);if(!o)return;const a={...o,color:(i=t.params)==null?void 0:i.color};if(this.fireEvent(this.Event.BeforeGridlineColorChange,a),a.cancel)throw new h.CanceledError}})),this.registerEventHandler(this.Event.BeforeGridlineEnableChange,()=>e.beforeCommandExecuted(t=>{var i;if(t.id===s.ToggleGridlinesCommand.id){const o=this.getCommandSheetTarget(t);if(!o)return;const a={...o,enabled:!!((i=t.params)!=null&&i.showGridlines)};if(this.fireEvent(this.Event.BeforeGridlineEnableChange,a),a.cancel)throw new h.CanceledError}})),this.registerEventHandler(this.Event.SheetValueChanged,()=>e.onCommandExecuted(t=>{if(s.COMMAND_LISTENER_VALUE_CHANGE.indexOf(t.id)>-1){if(!this.getActiveSheet())return;const o=s.getValueChangedEffectedRange(t).map(a=>{var d,u;return(u=(d=this.getWorkbook(a.unitId))==null?void 0:d.getSheetBySheetId(a.subUnitId))==null?void 0:u.getRange(a.range)}).filter(Boolean);if(!o.length)return;this.fireEvent(this.Event.SheetValueChanged,{payload:t,effectedRanges:o})}})),this.registerEventHandler(this.Event.SheetCreated,()=>e.onCommandExecuted(t=>{var i;if(t.id===s.InsertSheetCommand.id){const o=t.params,{unitId:a}=o||{},d=a?this.getUniverSheet(a):(i=this.getActiveWorkbook)==null?void 0:i.call(this);if(!d)return;const u=d.getActiveSheet();if(!u)return;const l={workbook:d,worksheet:u};this.fireEvent(this.Event.SheetCreated,l)}})),this.registerEventHandler(this.Event.ActiveSheetChanged,()=>e.onCommandExecuted(t=>{if(t.id===s.SetWorksheetActiveOperation.id){const i=this.getActiveSheet();if(!i)return;const{workbook:o,worksheet:a}=i;this._fireActiveSheetChanged(o,a)}})),this.registerEventHandler(this.Event.SheetDeleted,()=>e.onCommandExecuted(t=>{var i;if(t.id===s.RemoveSheetCommand.id){const{subUnitId:o,unitId:a}=t.params,d=a?this.getUniverSheet(a):(i=this.getActiveWorkbook)==null?void 0:i.call(this);if(!d||!o)return;this._fireSheetDeleted(d,o)}})),this.registerEventHandler(this.Event.SheetMoved,()=>e.onCommandExecuted(t=>{if(t.id===s.SetWorksheetOrderMutation.id){const{toOrder:i}=t.params,o=this.getCommandSheetTarget(t);if(!o)return;this._fireSheetMoved(o.workbook,o.worksheet,i)}})),this.registerEventHandler(this.Event.SheetNameChanged,()=>e.onCommandExecuted(t=>{if(t.id===s.SetWorksheetNameCommand.id){const{name:i}=t.params,o=this.getCommandSheetTarget(t);if(!o)return;this._fireSheetNameChanged(o.workbook,o.worksheet,i)}})),this.registerEventHandler(this.Event.SheetTabColorChanged,()=>e.onCommandExecuted(t=>{if(t.id===s.SetTabColorMutation.id){const{color:i}=t.params,o=this.getCommandSheetTarget(t);if(!o)return;this._fireSheetTabColorChanged(o.workbook,o.worksheet,i)}})),this.registerEventHandler(this.Event.SheetHideChanged,()=>e.onCommandExecuted(t=>{if(t.id===s.SetWorksheetHideMutation.id){const{hidden:i}=t.params,o=this.getCommandSheetTarget(t);if(!o)return;this._fireSheetHideChanged(o.workbook,o.worksheet,!!i)}})),this.registerEventHandler(this.Event.GridlineChanged,()=>e.onCommandExecuted(t=>{if(t.id===s.SetGridlinesColorCommand.id||t.id===s.ToggleGridlinesCommand.id){const i=this.getCommandSheetTarget(t);if(!i)return;this.fireEvent(this.Event.GridlineChanged,{...i,enabled:!i.worksheet.hasHiddenGridLines(),color:i.worksheet.getGridLinesColor()})}})),this._initWorkbookEvent(n)}createUniverSheet(n,e){const i=this._injector.get(h.IUniverInstanceService).createUnit(h.UniverInstanceType.UNIVER_SHEET,n,e);return this._injector.createInstance(c.FWorkbook,i)}createWorkbook(n,e){return this.createUniverSheet(n,e)}getActiveWorkbook(){const n=this._univerInstanceService.getCurrentUnitForType(h.UniverInstanceType.UNIVER_SHEET);return n?this._injector.createInstance(c.FWorkbook,n):null}getActiveUniverSheet(){return this.getActiveWorkbook()}getUniverSheet(n){const e=this._univerInstanceService.getUnit(n,h.UniverInstanceType.UNIVER_SHEET);return e?this._injector.createInstance(c.FWorkbook,e):null}getWorkbook(n){return this.getUniverSheet(n)}getPermission(){return this._injector.createInstance(c.FPermission)}onUniverSheetCreated(n){const e=this._univerInstanceService.getTypeOfUnitAdded$(h.UniverInstanceType.UNIVER_SHEET).subscribe(t=>{const i=this._injector.createInstance(c.FWorkbook,t);n(i)});return h.toDisposable(e)}newDefinedName(){return this._injector.createInstance(V)}getActiveSheet(){const n=this.getActiveWorkbook();if(!n)return null;const e=n.getActiveSheet();return e?{workbook:n,worksheet:e}:null}setFreezeSync(n){this._injector.get(s.SheetsFreezeSyncController).setEnabled(n)}_fireActiveSheetChanged(n,e){this.fireEvent(this.Event.ActiveSheetChanged,{workbook:n,activeSheet:e})}_fireSheetDeleted(n,e){this.fireEvent(this.Event.SheetDeleted,{workbook:n,sheetId:e})}_fireSheetMoved(n,e,t){this.fireEvent(this.Event.SheetMoved,{workbook:n,worksheet:e,newIndex:t})}_fireSheetNameChanged(n,e,t){this.fireEvent(this.Event.SheetNameChanged,{workbook:n,worksheet:e,newName:t})}_fireSheetTabColorChanged(n,e,t){this.fireEvent(this.Event.SheetTabColorChanged,{workbook:n,worksheet:e,newColor:t})}_fireSheetHideChanged(n,e,t){this.fireEvent(this.Event.SheetHideChanged,{workbook:n,worksheet:e,hidden:t})}}b.FUniver.extend(pe);class X{get SheetValueChangeType(){return s.SheetValueChangeType}get SheetSkeletonChangeType(){return s.SheetSkeletonChangeType}get SplitDelimiterType(){return s.SplitDelimiterEnum}get UnitRole(){return M}get WorkbookPermissionPoint(){return g}get WorksheetPermissionPoint(){return S}get RangePermissionPoint(){return I}}b.FEnum.extend(X);class ee{get SheetCreated(){return"SheetCreated"}get BeforeSheetCreate(){return"BeforeSheetCreate"}get WorkbookCreated(){return"WorkbookCreated"}get WorkbookDisposed(){return"WorkbookDisposed"}get GridlineChanged(){return"GridlineChanged"}get BeforeGridlineEnableChange(){return"BeforeGridlineEnableChange"}get BeforeGridlineColorChange(){return"BeforeGridlineColorChange"}get BeforeActiveSheetChange(){return"BeforeActiveSheetChange"}get ActiveSheetChanged(){return"ActiveSheetChanged"}get SheetDeleted(){return"SheetDeleted"}get BeforeSheetDelete(){return"BeforeSheetDelete"}get SheetMoved(){return"SheetMoved"}get BeforeSheetMove(){return"BeforeSheetMove"}get SheetNameChanged(){return"SheetNameChanged"}get BeforeSheetNameChange(){return"BeforeSheetNameChange"}get SheetTabColorChanged(){return"SheetTabColorChanged"}get BeforeSheetTabColorChange(){return"BeforeSheetTabColorChange"}get SheetHideChanged(){return"SheetHideChanged"}get BeforeSheetHideChange(){return"BeforeSheetHideChange"}get SheetValueChanged(){return"SheetValueChanged"}}b.FEventName.extend(ee);var Ee=Object.getOwnPropertyDescriptor,ye=(r,n,e,t)=>{for(var i=t>1?void 0:t?Ee(n,e):n,o=r.length-1,a;o>=0;o--)(a=r[o])&&(i=a(i)||i);return i},Pe=(r,n)=>(e,t)=>n(e,t,r);c.FSheetHooks=class extends b.FBase{constructor(n){super(),this._injector=n}},c.FSheetHooks=ye([Pe(0,h.Inject(h.Injector))],c.FSheetHooks),c.FSheetEventName=ee,c.FSheetsEnum=X,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})}));
|
|
16
|
+
(function(c,h){typeof exports=="object"&&typeof module<"u"?h(exports,require("@univerjs/core"),require("@univerjs/core/facade"),require("@univerjs/sheets"),require("@univerjs/engine-formula"),require("rxjs"),require("rxjs/operators")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/core/facade","@univerjs/sheets","@univerjs/engine-formula","rxjs","rxjs/operators"],h):(c=typeof globalThis<"u"?globalThis:c||self,h(c.UniverSheetsFacade={},c.UniverCore,c.UniverCoreFacade,c.UniverSheets,c.UniverEngineFormula,c.rxjs,c.rxjs.operators))})(this,(function(c,h,f,s,U,N,k){"use strict";var We=Object.defineProperty;var Me=(c,h,f)=>h in c?We(c,h,{enumerable:!0,configurable:!0,writable:!0,value:f}):c[h]=f;var C=(c,h,f)=>Me(c,typeof h!="symbol"?h+"":h,f);var M;var re=Object.getOwnPropertyDescriptor,oe=(r,n,e,t)=>{for(var i=t>1?void 0:t?re(n,e):n,o=r.length-1,a;o>=0;o--)(a=r[o])&&(i=a(i)||i);return i},E=(r,n)=>(e,t)=>n(e,t,r);function se(r,n,e){const t=e.getDefinedNameMap(r);if(t==null)return n.t("definedName.defaultName")+1;const o=Array.from(Object.values(t)).length+1,a=n.t("definedName.defaultName")+o;if(e.getValueByName(r,a)==null)return a;let d=o+1;for(;;){const u=n.t("definedName.defaultName")+d;if(e.getValueByName(r,u)==null)return u;d++}}class x{constructor(){C(this,"_definedNameParam");this._definedNameParam={id:h.generateRandomId(10),unitId:"",name:"",formulaOrRefString:"",localSheetId:s.SCOPE_WORKBOOK_VALUE_DEFINED_NAME}}setName(n){return this._definedNameParam.name=n,this}setFormula(n){return this._definedNameParam.formulaOrRefString=`=${n}`,this}setRef(n){return this._definedNameParam.formulaOrRefString=n,this}setRefByRange(n,e,t,i){return this._definedNameParam.formulaOrRefString=U.serializeRange({startRow:n,endRow:n+(t!=null?t:1)-1,startColumn:e,endColumn:e+(i!=null?i:1)-1}),this}setComment(n){return this._definedNameParam.comment=n,this}setScopeToWorksheet(n){return this._definedNameParam.localSheetId=n.getSheetId(),this}setScopeToWorkbook(){return this._definedNameParam.localSheetId=s.SCOPE_WORKBOOK_VALUE_DEFINED_NAME,this}setHidden(n){return this._definedNameParam.hidden=n,this}build(){return this._definedNameParam}load(n){return this._definedNameParam=n,this}}let A=class extends f.FBase{constructor(r,n,e,t,i,o,a,d,u,l){super(),this._definedNameParam=r,this._injector=n,this._commandService=e,this._permissionService=t,this._worksheetProtectionRuleModel=i,this._rangeProtectionRuleModel=o,this._worksheetProtectionPointRuleModel=a,this._authzIoService=d,this._localeService=u,this._definedNamesService=l}_apply(){this._definedNameParam.name===""&&(this._definedNameParam.name=se(this._definedNameParam.unitId,this._localeService,this._definedNamesService)),this._commandService.syncExecuteCommand(s.SetDefinedNameCommand.id,this._definedNameParam)}getName(){return this._definedNameParam.name}setName(r){this._definedNameParam.name=r,this._apply()}setFormula(r){this._definedNameParam.formulaOrRefString=`=${r}`,this._apply()}setRef(r){this._definedNameParam.formulaOrRefString=r,this._apply()}getFormulaOrRefString(){return this._definedNameParam.formulaOrRefString}setRefByRange(r,n,e,t){this._definedNameParam.formulaOrRefString=U.serializeRange({startRow:r,endRow:r+(e!=null?e:1)-1,startColumn:n,endColumn:n+(t!=null?t:1)-1}),this._apply()}getComment(){return this._definedNameParam.comment}setComment(r){this._definedNameParam.comment=r,this._apply()}setScopeToWorksheet(r){this._definedNameParam.localSheetId=r.getSheetId(),this._apply()}setScopeToWorkbook(){this._definedNameParam.localSheetId=s.SCOPE_WORKBOOK_VALUE_DEFINED_NAME,this._apply()}setHidden(r){this._definedNameParam.hidden=r,this._apply()}delete(){this._commandService.syncExecuteCommand(s.RemoveDefinedNameCommand.id,this._definedNameParam)}getLocalSheetId(){return this._definedNameParam.localSheetId}isWorkbookScope(){return this._definedNameParam.localSheetId===s.SCOPE_WORKBOOK_VALUE_DEFINED_NAME}toBuilder(){const r=this._injector.createInstance(x);return r.load(this._definedNameParam),r}};A=oe([E(1,h.Inject(h.Injector)),E(2,h.ICommandService),E(3,h.IPermissionService),E(4,h.Inject(s.WorksheetProtectionRuleModel)),E(5,h.Inject(s.RangeProtectionRuleModel)),E(6,h.Inject(s.WorksheetProtectionPointModel)),E(7,h.Inject(h.IAuthzIoService)),E(8,h.Inject(h.LocaleService)),E(9,U.IDefinedNamesService)],A);var D=(r=>(r[r.Reader=0]="Reader",r[r.Editor=1]="Editor",r[r.Owner=2]="Owner",r))(D||{}),_=(r=>(r.Edit="WorkbookEdit",r.View="WorkbookView",r.Print="WorkbookPrint",r.Export="WorkbookExport",r.Share="WorkbookShare",r.CopyContent="WorkbookCopy",r.DuplicateFile="WorkbookDuplicate",r.Comment="WorkbookComment",r.ManageCollaborator="WorkbookManageCollaborator",r.CreateSheet="WorkbookCreateSheet",r.DeleteSheet="WorkbookDeleteSheet",r.RenameSheet="WorkbookRenameSheet",r.MoveSheet="WorkbookMoveSheet",r.HideSheet="WorkbookHideSheet",r.ViewHistory="WorkbookViewHistory",r.ManageHistory="WorkbookHistory",r.RecoverHistory="WorkbookRecoverHistory",r.CreateProtection="WorkbookCreateProtect",r.InsertRow="WorkbookInsertRow",r.InsertColumn="WorkbookInsertColumn",r.DeleteRow="WorkbookDeleteRow",r.DeleteColumn="WorkbookDeleteColumn",r.CopySheet="WorkbookCopySheet",r))(_||{}),w=(r=>(r.Edit="WorksheetEdit",r.View="WorksheetView",r.Copy="WorksheetCopy",r.SetCellValue="WorksheetSetCellValue",r.SetCellStyle="WorksheetSetCellStyle",r.SetRowStyle="WorksheetSetRowStyle",r.SetColumnStyle="WorksheetSetColumnStyle",r.InsertRow="WorksheetInsertRow",r.InsertColumn="WorksheetInsertColumn",r.DeleteRow="WorksheetDeleteRow",r.DeleteColumn="WorksheetDeleteColumn",r.Sort="WorksheetSort",r.Filter="WorksheetFilter",r.PivotTable="WorksheetPivotTable",r.InsertHyperlink="WorksheetInsertHyperlink",r.EditExtraObject="WorksheetEditExtraObject",r.ManageCollaborator="WorksheetManageCollaborator",r.DeleteProtection="WorksheetDeleteProtection",r.SelectProtectedCells="WorksheetSelectProtectedCells",r.SelectUnProtectedCells="WorksheetSelectUnProtectedCells",r))(w||{}),b=(r=>(r.Edit="RangeEdit",r.View="RangeView",r.ManageCollaborator="RangeManageCollaborator",r.Delete="RangeDeleteProtection",r))(b||{}),ae=Object.getOwnPropertyDescriptor,he=(r,n,e,t)=>{for(var i=t>1?void 0:t?ae(n,e):n,o=r.length-1,a;o>=0;o--)(a=r[o])&&(i=a(i)||i);return i},j=(r,n)=>(e,t)=>n(e,t,r);c.FPermission=class extends f.FBase{constructor(e,t,i,o,a,d,u,l){super();C(this,"permissionPointsDefinition",s.PermissionPointsDefinitions);C(this,"rangeRuleChangedAfterAuth$");C(this,"sheetRuleChangedAfterAuth$");C(this,"unitPermissionInitStateChange$");this._injector=e,this._commandService=t,this._permissionService=i,this._worksheetProtectionRuleModel=o,this._rangeProtectionRuleModel=a,this._worksheetProtectionPointRuleModel=d,this._workbookPermissionService=u,this._authzIoService=l,this.rangeRuleChangedAfterAuth$=this._rangeProtectionRuleModel.ruleRefresh$,this.sheetRuleChangedAfterAuth$=this._worksheetProtectionRuleModel.ruleRefresh$,this.unitPermissionInitStateChange$=this._workbookPermissionService.unitPermissionInitStateChange$}setWorkbookPermissionPoint(e,t,i){const o=new t(e);this._permissionService.getPermissionPoint(o.id)||this._permissionService.addPermissionPoint(o),this._permissionService.updatePermissionPoint(o.id,i)}checkWorkbookPermissionPoint(e,t){const i=new t(e),o=this._permissionService.getPermissionPoint(i.id);if(o)return o.value}setWorkbookEditPermission(e,t){this.setWorkbookPermissionPoint(e,s.WorkbookEditablePermission,t)}async addWorksheetBasePermission(e,t,i){let o=[];if(i!=null&&i.allowedUsers){const u=await this._authzIoService.listCollaborators({objectID:e,unitID:e}),l=new Set(i.allowedUsers);o=u.filter(m=>{var S;return l.has(((S=m.subject)==null?void 0:S.userID)||m.id)}).map(m=>({id:m.id,role:D.Editor,subject:m.subject}));const g=new Set(o.map(m=>{var S;return((S=m.subject)==null?void 0:S.userID)||m.id}));i.allowedUsers.forEach(m=>{g.has(m)||console.error(`User ${m} not found in collaborators list`)})}const a=await this._authzIoService.create({objectType:s.UnitObject.Worksheet,worksheetObject:{collaborators:o,unitID:e,strategies:[],name:(i==null?void 0:i.name)||"",scope:void 0}});if(this._commandService.syncExecuteCommand(s.AddWorksheetProtectionMutation.id,{unitId:e,subUnitId:t,rule:{permissionId:a,unitType:s.UnitObject.Worksheet,unitId:e,subUnitId:t}}))return a}removeWorksheetPermission(e,t){this._commandService.syncExecuteCommand(s.DeleteWorksheetProtectionMutation.id,{unitId:e,subUnitId:t}),[...s.getAllWorksheetPermissionPoint(),...s.getAllWorksheetPermissionPointByPointPanel()].forEach(i=>{const o=new i(e,t);this._permissionService.updatePermissionPoint(o.id,!0)}),this._worksheetProtectionPointRuleModel.deleteRule(e,t)}async setWorksheetPermissionPoint(e,t,i,o){const a=this._worksheetProtectionRuleModel.getRule(e,t);let d;if(i===s.WorksheetEditPermission||i===s.WorksheetViewPermission)a?d=a.permissionId:d=await this.addWorksheetBasePermission(e,t);else{const m=this._worksheetProtectionPointRuleModel.getRule(e,t);m?d=m.permissionId:(d=await this._authzIoService.create({objectType:s.UnitObject.Worksheet,worksheetObject:{collaborators:[],unitID:e,strategies:[],name:"",scope:void 0}}),this._commandService.syncExecuteCommand(s.SetWorksheetPermissionPointsMutation.id,{unitId:e,subUnitId:t,rule:{unitId:e,subUnitId:t,permissionId:d}}))}const l=new i(e,t);if(this._permissionService.getPermissionPoint(l.id)||this._permissionService.addPermissionPoint(l),d){const m=l.subType;await this._authzIoService.update({objectType:s.UnitObject.Worksheet,objectID:d,strategies:[{action:m,role:o?D.Owner:D.Reader}],unitID:e,share:void 0,name:"",scope:void 0,collaborators:void 0})}return this._permissionService.updatePermissionPoint(l.id,o),d}checkWorksheetPermissionPoint(e,t,i){const o=new i(e,t),a=this._permissionService.getPermissionPoint(o.id);if(a)return a.value}async addRangeBaseProtection(e,t,i,o){let a=[];if(o!=null&&o.allowedUsers){const v=await this._authzIoService.listCollaborators({objectID:e,unitID:e}),Q=new Set(o.allowedUsers);a=v.filter(p=>{var V;return Q.has(((V=p.subject)==null?void 0:V.userID)||p.id)}).map(p=>({id:p.id,role:D.Editor,subject:p.subject}));const X=new Set(a.map(p=>{var V;return((V=p.subject)==null?void 0:V.userID)||p.id}));o.allowedUsers.forEach(p=>{X.has(p)||console.error(`User ${p} not found in collaborators list`)})}const d=await this._authzIoService.create({objectType:s.UnitObject.SelectRange,selectRangeObject:{collaborators:a,unitID:e,name:(o==null?void 0:o.name)||"",scope:void 0}}),u=`ruleId_${h.generateRandomId(6)}`;if(this._rangeProtectionRuleModel.getSubunitRuleList(e,t).some(v=>v.ranges.some(Q=>i.some(X=>h.Rectangle.intersects(X.getRange(),Q)))))throw new Error("range protection cannot intersect");const m=this._determineRangeViewState(o),S=this._determineRangeEditState(o),I={unitId:e,subUnitId:t,rules:[{permissionId:d,unitType:s.UnitObject.SelectRange,unitId:e,subUnitId:t,ranges:i.map(v=>v.getRange()),id:u,description:o==null?void 0:o.name,viewState:m,editState:S}]};if(this._commandService.syncExecuteCommand(s.AddRangeProtectionMutation.id,I))return{permissionId:d,ruleId:u}}_determineRangeViewState(e){return(e==null?void 0:e.allowViewByOthers)===!1?s.ViewStateEnum.NoOneElseCanView:s.ViewStateEnum.OthersCanView}_determineRangeEditState(e){var t;return(e==null?void 0:e.allowEdit)===!0&&((t=e==null?void 0:e.allowedUsers)!=null&&t.length)?s.EditStateEnum.DesignedUserCanEdit:s.EditStateEnum.OnlyMe}removeRangeProtection(e,t,i){this._commandService.syncExecuteCommand(s.DeleteRangeProtectionMutation.id,{unitId:e,subUnitId:t,ruleIds:i})&&this._rangeProtectionRuleModel.getSubunitRuleList(e,t).length===0&&(this._worksheetProtectionPointRuleModel.deleteRule(e,t),[...s.getAllWorksheetPermissionPointByPointPanel()].forEach(d=>{const u=new d(e,t);this._permissionService.updatePermissionPoint(u.id,u.value)}))}setRangeProtectionPermissionPoint(e,t,i,o,a){const d=new o(e,t,i);this._permissionService.getPermissionPoint(d.id)||this._permissionService.addPermissionPoint(d),this._permissionService.updatePermissionPoint(d.id,a)}setRangeProtectionRanges(e,t,i,o){const a=this._rangeProtectionRuleModel.getRule(e,t,i);if(a){if(this._rangeProtectionRuleModel.getSubunitRuleList(e,t).filter(l=>l.id!==i).some(l=>l.ranges.some(g=>o.some(m=>h.Rectangle.intersects(m.getRange(),g)))))throw new Error("range protection cannot intersect");this._commandService.syncExecuteCommand(s.SetRangeProtectionMutation.id,{unitId:e,subUnitId:t,ruleId:i,rule:{...a,ranges:o.map(l=>l.getRange())}})}}getPermissionInfoWithCell(e,t,i,o){const a=h.cellToRange(i,o),d=this._rangeProtectionRuleModel.getSubunitRuleList(e,t).find(u=>u.ranges.some(g=>h.Rectangle.intersects(a,g)));if(d)return{permissionId:d.permissionId,ruleId:d.id}}},c.FPermission=he([j(0,h.Inject(h.Injector)),j(1,h.ICommandService),j(2,h.IPermissionService),j(3,h.Inject(s.WorksheetProtectionRuleModel)),j(4,h.Inject(s.RangeProtectionRuleModel)),j(5,h.Inject(s.WorksheetProtectionPointModel)),j(6,h.Inject(s.WorkbookPermissionService)),j(7,h.Inject(h.IAuthzIoService))],c.FPermission);var de=Object.getOwnPropertyDescriptor,ue=(r,n,e,t)=>{for(var i=t>1?void 0:t?de(n,e):n,o=r.length-1,a;o>=0;o--)(a=r[o])&&(i=a(i)||i);return i},le=(r,n)=>(e,t)=>n(e,t,r);c.FSelection=class{constructor(n,e,t,i){this._workbook=n,this._worksheet=e,this._selections=t,this._injector=i}getActiveRange(){const n=this._selections.find(e=>!!e.primary);return n?this._injector.createInstance(c.FRange,this._workbook,this._worksheet,n.range):null}getActiveRangeList(){return this._selections.map(n=>this._injector.createInstance(c.FRange,this._workbook,this._worksheet,n.range))}getCurrentCell(){const n=this._selections.find(e=>!!e.primary);return n?n.primary:null}getActiveSheet(){const n=this._injector.createInstance(c.FWorkbook,this._workbook);return this._injector.createInstance(c.FWorksheet,n,this._workbook,this._worksheet)}updatePrimaryCell(n){const e=this._injector.get(h.ICommandService);let t=[],i=!1;for(const{range:a,style:d}of this._selections)h.Rectangle.contains(a,n.getRange())?(t.push({range:a,primary:s.getPrimaryForRange(n.getRange(),this._worksheet),style:d}),i=!0):t.push({range:a,primary:null,style:d});i||(t=[{range:n.getRange(),primary:s.getPrimaryForRange(n.getRange(),this._worksheet)}]);const o={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),selections:t};return e.syncExecuteCommand(s.SetSelectionsOperation.id,o),new c.FSelection(this._workbook,this._worksheet,t,this._injector)}getNextDataRange(n){if(!this._selections.find(i=>!!i.primary))return null;const t=s.getNextPrimaryCell(this._selections.concat(),n,this._worksheet);return t?this._injector.createInstance(c.FRange,this._workbook,this._worksheet,t):null}},c.FSelection=ue([le(3,h.Inject(h.Injector))],c.FSelection);var $=(r=>(r[r.Reader=0]="Reader",r[r.Editor=1]="Editor",r[r.Owner=2]="Owner",r[r.UNRECOGNIZED=-1]="UNRECOGNIZED",r))($||{}),ce=Object.getOwnPropertyDescriptor,me=(r,n,e,t)=>{for(var i=t>1?void 0:t?ce(n,e):n,o=r.length-1,a;o>=0;o--)(a=r[o])&&(i=a(i)||i);return i},z=(r,n)=>(e,t)=>n(e,t,r);let y=class{constructor(r,n,e,t,i,o,a,d,u){this._unitId=r,this._subUnitId=n,this._ruleId=e,this._permissionId=t,this._ranges=i,this._options=o,this._injector=a,this._commandService=d,this._rangeProtectionRuleModel=u}get id(){return this._ruleId}get ranges(){return this._ranges}get options(){return{...this._options}}async updateRanges(r){if(!r||r.length===0)throw new Error("Ranges cannot be empty");const n=this._rangeProtectionRuleModel.getRule(this._unitId,this._subUnitId,this._ruleId);if(!n)throw new Error(`Rule ${this._ruleId} not found`);if(this._rangeProtectionRuleModel.getSubunitRuleList(this._unitId,this._subUnitId).filter(i=>i.id!==this._ruleId).some(i=>i.ranges.some(o=>r.some(a=>{const d=a.getRange();return this._rangesIntersect(d,o)}))))throw new Error("Range protection cannot intersect with other protection rules");await this._commandService.executeCommand(s.SetRangeProtectionMutation.id,{unitId:this._unitId,subUnitId:this._subUnitId,ruleId:this._ruleId,rule:{...n,ranges:r.map(i=>i.getRange())}}),this._ranges.length=0,this._ranges.push(...r)}async remove(){await this._commandService.executeCommand(s.DeleteRangeProtectionMutation.id,{unitId:this._unitId,subUnitId:this._subUnitId,ruleIds:[this._ruleId]})}_rangesIntersect(r,n){return!(r.endRow<n.startRow||r.startRow>n.endRow||r.endColumn<n.startColumn||r.startColumn>n.endColumn)}};y=me([z(6,h.Inject(h.Injector)),z(7,h.Inject(h.ICommandService)),z(8,h.Inject(s.RangeProtectionRuleModel))],y);const F={[_.Edit]:s.WorkbookEditablePermission,[_.View]:s.WorkbookViewPermission,[_.Print]:s.WorkbookPrintPermission,[_.Export]:s.WorkbookExportPermission,[_.Share]:s.WorkbookSharePermission,[_.CopyContent]:s.WorkbookCopyPermission,[_.DuplicateFile]:s.WorkbookDuplicatePermission,[_.Comment]:s.WorkbookCommentPermission,[_.ManageCollaborator]:s.WorkbookManageCollaboratorPermission,[_.CreateSheet]:s.WorkbookCreateSheetPermission,[_.DeleteSheet]:s.WorkbookDeleteSheetPermission,[_.RenameSheet]:s.WorkbookRenameSheetPermission,[_.MoveSheet]:s.WorkbookMoveSheetPermission,[_.HideSheet]:s.WorkbookHideSheetPermission,[_.ViewHistory]:s.WorkbookViewHistoryPermission,[_.ManageHistory]:s.WorkbookHistoryPermission,[_.RecoverHistory]:s.WorkbookRecoverHistoryPermission,[_.CreateProtection]:s.WorkbookCreateProtectPermission,[_.InsertRow]:s.WorkbookInsertRowPermission,[_.InsertColumn]:s.WorkbookInsertColumnPermission,[_.DeleteRow]:s.WorkbookDeleteRowPermission,[_.DeleteColumn]:s.WorkbookDeleteColumnPermission,[_.CopySheet]:s.WorkbookCopySheetPermission},B={[w.Edit]:s.WorksheetEditPermission,[w.View]:s.WorksheetViewPermission,[w.Copy]:s.WorksheetCopyPermission,[w.SetCellValue]:s.WorksheetSetCellValuePermission,[w.SetCellStyle]:s.WorksheetSetCellStylePermission,[w.SetRowStyle]:s.WorksheetSetRowStylePermission,[w.SetColumnStyle]:s.WorksheetSetColumnStylePermission,[w.InsertRow]:s.WorksheetInsertRowPermission,[w.InsertColumn]:s.WorksheetInsertColumnPermission,[w.DeleteRow]:s.WorksheetDeleteRowPermission,[w.DeleteColumn]:s.WorksheetDeleteColumnPermission,[w.Sort]:s.WorksheetSortPermission,[w.Filter]:s.WorksheetFilterPermission,[w.PivotTable]:s.WorksheetPivotTablePermission,[w.InsertHyperlink]:s.WorksheetInsertHyperlinkPermission,[w.EditExtraObject]:s.WorksheetEditExtraObjectPermission,[w.ManageCollaborator]:s.WorksheetManageCollaboratorPermission,[w.DeleteProtection]:s.WorksheetDeleteProtectionPermission,[w.SelectProtectedCells]:s.WorksheetSelectProtectedCellsPermission,[w.SelectUnProtectedCells]:s.WorksheetSelectUnProtectedCellsPermission},O={[b.Edit]:s.RangeProtectionPermissionEditPoint,[b.View]:s.RangeProtectionPermissionViewPoint,[b.ManageCollaborator]:s.RangeProtectionPermissionManageCollaPoint,[b.Delete]:s.RangeProtectionPermissionDeleteProtectionPoint};var ge=Object.getOwnPropertyDescriptor,_e=(r,n,e,t)=>{for(var i=t>1?void 0:t?ge(n,e):n,o=r.length-1,a;o>=0;o--)(a=r[o])&&(i=a(i)||i);return i},W=(r,n)=>(e,t)=>n(e,t,r);let L=class{constructor(r,n,e,t,i,o,a,d){C(this,"_permissionSubject");C(this,"_rangeRulesSubject");C(this,"permission$");C(this,"pointChange$");C(this,"rangeProtectionChange$");C(this,"rangeProtectionRules$");C(this,"_unitId");C(this,"_subUnitId");C(this,"_subscriptions",[]);C(this,"_fPermission");this._worksheet=r,this._injector=n,this._permissionService=e,this._authzIoService=t,this._commandService=i,this._rangeProtectionRuleModel=o,this._worksheetProtectionPointModel=a,this._worksheetProtectionRuleModel=d,this._unitId=this._worksheet.getWorkbook().getUnitId(),this._subUnitId=this._worksheet.getSheetId(),this._fPermission=this._injector.createInstance(c.FPermission),this._permissionSubject=new N.BehaviorSubject(this._buildSnapshot()),this._rangeRulesSubject=new N.BehaviorSubject(this._buildRangeProtectionRules()),this.permission$=this._createPermissionStream(),this.pointChange$=this._createPointChangeStream(),this.rangeProtectionChange$=this._createRangeProtectionChangeStream(),this.rangeProtectionRules$=this._createRangeProtectionRulesStream()}_createPermissionStream(){const r=this._permissionService.permissionPointUpdate$.pipe(k.filter(n=>n.id.includes(this._unitId)&&n.id.includes(this._subUnitId))).subscribe(()=>{this._permissionSubject.next(this._buildSnapshot())});return this._subscriptions.push(r),this._permissionSubject.asObservable().pipe(k.distinctUntilChanged((n,e)=>JSON.stringify(n)===JSON.stringify(e)),k.shareReplay({bufferSize:1,refCount:!0}))}_createPointChangeStream(){return this._permissionService.permissionPointUpdate$.pipe(k.filter(r=>r.id.includes(this._unitId)&&r.id.includes(this._subUnitId)),k.map(r=>{var e,t;const n=this._extractWorksheetPointType(r.id);return n?{point:n,value:(e=r.value)!=null?e:!1,oldValue:!((t=r.value)!=null&&t)}:null}),k.filter(r=>r!==null),k.shareReplay({bufferSize:1,refCount:!0}))}_createRangeProtectionChangeStream(){return this._rangeProtectionRuleModel.ruleChange$.pipe(k.filter(r=>r.unitId===this._unitId&&r.subUnitId===this._subUnitId),k.map(r=>{const n=this._buildRangeProtectionRules();return{type:r.type==="delete"?"delete":r.type==="set"?"update":"add",rules:n}}),k.shareReplay({bufferSize:1,refCount:!0}))}_createRangeProtectionRulesStream(){const r=this._rangeProtectionRuleModel.ruleChange$.pipe(k.filter(n=>n.unitId===this._unitId&&n.subUnitId===this._subUnitId)).subscribe(()=>{this._rangeRulesSubject.next(this._buildRangeProtectionRules())});return this._subscriptions.push(r),this._rangeRulesSubject.asObservable().pipe(k.distinctUntilChanged((n,e)=>n.length!==e.length?!1:n.every((t,i)=>t.id===e[i].id)),k.shareReplay({bufferSize:1,refCount:!0}))}_extractWorksheetPointType(r){for(const[n,e]of Object.entries(B))if(new e(this._unitId,this._subUnitId).id===r)return n;return null}_getRuleEditPermission(r){var i;const n=O[b.Edit];if(!n)return!1;const e=new n(this._unitId,this._subUnitId,r.permissionId),t=this._permissionService.getPermissionPoint(e.id);return(i=t==null?void 0:t.value)!=null?i:!1}_buildSnapshot(){const r={};for(const n in w){const e=w[n];r[e]=this.getPoint(e)}return r}_buildRangeProtectionRules(){return this._rangeProtectionRuleModel.getSubunitRuleList(this._unitId,this._subUnitId).map(n=>{const e=n.ranges.map(t=>this._worksheet.getRange(t.startRow,t.startColumn,t.endRow-t.startRow+1,t.endColumn-t.startColumn+1));return this._injector.createInstance(y,this._unitId,this._subUnitId,n.id,n.permissionId,e,{name:n.description||"",allowEdit:this._getRuleEditPermission(n)})})}_buildProtectionRule(r){const n=r.ranges.map(t=>this._worksheet.getRange(t)),e={name:r.description||"",allowViewByOthers:r.viewState!==s.ViewStateEnum.NoOneElseCanView};return r.editState===s.EditStateEnum.DesignedUserCanEdit?e.allowEdit=!0:e.allowEdit=!1,this._injector.createInstance(y,this._unitId,this._subUnitId,r.id,r.permissionId,n,e)}debugCellPermission(r,n){const e=this._fPermission.getPermissionInfoWithCell(this._unitId,this._subUnitId,r,n);if(!e)return;const{ruleId:t}=e,i=this._rangeProtectionRuleModel.getRule(this._unitId,this._subUnitId,t);if(i)return this._buildProtectionRule(i)}async protect(r){if(this.isProtected())throw new Error("Worksheet is already protected. Call unprotect() first.");const n=await this._fPermission.addWorksheetBasePermission(this._unitId,this._subUnitId,r);if(!n)throw new Error("Failed to create worksheet protection");return n}async unprotect(){if(!this.isProtected())return;this._fPermission.removeWorksheetPermission(this._unitId,this._subUnitId);const r=this._buildSnapshot();this._permissionSubject.next(r)}isProtected(){return!!this._worksheetProtectionRuleModel.getRule(this._unitId,this._subUnitId)}async setMode(r){const n=this._getModePermissions(r);await this._batchSetPermissionPoints(n)}_getModePermissions(r){const n={};switch(Object.values(w).forEach(e=>{n[e]=!1}),r){case"editable":Object.values(w).forEach(e=>{n[e]=!0});break;case"readOnly":n[w.View]=!0;break;case"filterOnly":n[w.View]=!0,n[w.Sort]=!0,n[w.Filter]=!0;break}return n}async _batchSetPermissionPoints(r){const n=[];for(const[e,t]of Object.entries(r)){const i=e,o=B[i];if(!o)throw new Error(`Unknown worksheet permission point: ${i}`);const a=this.getPoint(i);a!==t&&(await this._fPermission.setWorksheetPermissionPoint(this._unitId,this._subUnitId,o,t),n.push({point:i,value:t,oldValue:a}))}if(n.length>0){const e=this._buildSnapshot();this._permissionSubject.next(e)}}async setReadOnly(){await this.setMode("readOnly")}async setEditable(){await this.setMode("editable")}canEdit(){return this.getPoint(w.Edit)}canEditCell(r,n){if(!this.canEdit())return!1;const e=this._rangeProtectionRuleModel.getSubunitRuleList(this._unitId,this._subUnitId);for(const t of e)for(const i of t.ranges)if(r>=i.startRow&&r<=i.endRow&&n>=i.startColumn&&n<=i.endColumn)return this._getRuleEditPermission(t);return!0}canViewCell(r,n){return this.getPoint(w.View)}async setPoint(r,n){const e=B[r];if(!e)throw new Error(`Unknown worksheet permission point: ${r}`);if(this.getPoint(r)===n)return;await this._fPermission.setWorksheetPermissionPoint(this._unitId,this._subUnitId,e,n);const i=this._buildSnapshot();this._permissionSubject.next(i)}getPoint(r){var i;const n=B[r];if(!n)throw new Error(`Unknown worksheet permission point: ${r}`);const e=new n(this._unitId,this._subUnitId),t=this._permissionService.getPermissionPoint(e.id);return(i=t==null?void 0:t.value)!=null?i:!0}getSnapshot(){return this._buildSnapshot()}async applyConfig(r){if(r.mode&&await this.setMode(r.mode),r.points)for(const[n,e]of Object.entries(r.points))typeof e=="boolean"&&await this.setPoint(n,e);if(r.rangeProtections&&r.rangeProtections.length>0){const n=r.rangeProtections.map(e=>({ranges:e.rangeRefs.map(t=>this._worksheet.getRange(t)),options:e.options}));await this.protectRanges(n)}}async protectRanges(r){if(!r||r.length===0)throw new Error("Configs cannot be empty");let n=[];r.some(d=>{var u,l;return(l=(u=d.options)==null?void 0:u.allowedUsers)==null?void 0:l.length})&&(n=await this._authzIoService.listCollaborators({objectID:this._unitId,unitID:this._unitId}));const t=await Promise.all(r.map(d=>{var l,g;let u=[];if((l=d.options)!=null&&l.allowedUsers){const m=new Set(d.options.allowedUsers);u=n.filter(I=>{var R;return m.has(((R=I.subject)==null?void 0:R.userID)||I.id)}).map(I=>({id:I.id,role:$.Editor,subject:I.subject}));const S=new Set(u.map(I=>{var R;return((R=I.subject)==null?void 0:R.userID)||I.id}));d.options.allowedUsers.forEach(I=>{S.has(I)||console.error(`User ${I} not found in collaborators list`)})}return this._authzIoService.create({objectType:s.UnitObject.SelectRange,selectRangeObject:{collaborators:u,unitID:this._unitId,name:((g=d.options)==null?void 0:g.name)||"",scope:void 0}})})),i=r.map((d,u)=>{var m;const l=this._determineViewState(d.options),g=this._determineEditState(d.options);return{permissionId:t[u],unitType:s.UnitObject.SelectRange,unitId:this._unitId,subUnitId:this._subUnitId,ranges:d.ranges.map(S=>S.getRange()),id:this._rangeProtectionRuleModel.createRuleId(this._unitId,this._subUnitId),description:((m=d.options)==null?void 0:m.name)||"",viewState:l,editState:g}});if(!await this._commandService.executeCommand(s.AddRangeProtectionMutation.id,{unitId:this._unitId,subUnitId:this._subUnitId,rules:i}))throw new Error("Failed to create range protection rules");return await Promise.all(r.map((d,u)=>this._setPermissionPoints(t[u],d.options))),i.map((d,u)=>this._injector.createInstance(y,this._unitId,this._subUnitId,d.id,d.permissionId,r[u].ranges,r[u].options||{}))}_determineViewState(r){return(r==null?void 0:r.allowViewByOthers)===!1?s.ViewStateEnum.NoOneElseCanView:s.ViewStateEnum.OthersCanView}_determineEditState(r){var n;return(r==null?void 0:r.allowEdit)===!0&&((n=r==null?void 0:r.allowedUsers)!=null&&n.length)?s.EditStateEnum.DesignedUserCanEdit:s.EditStateEnum.OnlyMe}async _setPermissionPoints(r,n){if(!n)return;const e=(t,i)=>t===void 0?i:typeof t=="boolean"?t:!0;await this._setPermissionPoint(r,b.Edit,e(n.allowEdit,!1)),await this._setPermissionPoint(r,b.View,e(n.allowViewByOthers,!0))}async _setPermissionPoint(r,n,e){const t=O[n];t&&this._fPermission.setRangeProtectionPermissionPoint(this._unitId,this._subUnitId,r,t,e)}async unprotectRules(r){!r||r.length===0||this._fPermission.removeRangeProtection(this._unitId,this._subUnitId,r)}async listRangeProtectionRules(){return this._buildRangeProtectionRules()}subscribe(r){const n=this.permission$.subscribe(r);return()=>n.unsubscribe()}dispose(){this._subscriptions.forEach(r=>r.unsubscribe()),this._permissionSubject.complete(),this._rangeRulesSubject.complete()}};L=_e([W(1,h.Inject(h.Injector)),W(2,h.IPermissionService),W(3,h.IAuthzIoService),W(4,h.ICommandService),W(5,h.Inject(s.RangeProtectionRuleModel)),W(6,h.Inject(s.WorksheetProtectionPointModel)),W(7,h.Inject(s.WorksheetProtectionRuleModel))],L);function Se(r){switch(r){case"left":return h.HorizontalAlign.LEFT;case"center":return h.HorizontalAlign.CENTER;case"normal":return h.HorizontalAlign.RIGHT;default:throw new Error(`Invalid horizontal alignment: ${r}`)}}function ee(r){switch(r){case h.HorizontalAlign.LEFT:return"left";case h.HorizontalAlign.CENTER:return"center";case h.HorizontalAlign.RIGHT:return"normal";default:return"general"}}function we(r){switch(r){case"top":return h.VerticalAlign.TOP;case"middle":return h.VerticalAlign.MIDDLE;case"bottom":return h.VerticalAlign.BOTTOM;default:throw new Error(`Invalid vertical alignment: ${r}`)}}function te(r){switch(r){case h.VerticalAlign.TOP:return"top";case h.VerticalAlign.MIDDLE:return"middle";case h.VerticalAlign.BOTTOM:return"bottom";default:return"general"}}function G(r,n){return{startRow:r.startRow,endRow:r.endRow,startColumn:0,endColumn:n.getColumnCount()-1,rangeType:h.RANGE_TYPE.ROW}}function K(r,n){return{startRow:0,endRow:n.getRowCount()-1,startColumn:r.startColumn,endColumn:r.endColumn,rangeType:h.RANGE_TYPE.COLUMN}}var Ce=Object.getOwnPropertyDescriptor,ke=(r,n,e,t)=>{for(var i=t>1?void 0:t?Ce(n,e):n,o=r.length-1,a;o>=0;o--)(a=r[o])&&(i=a(i)||i);return i},H=(r,n)=>(e,t)=>n(e,t,r);c.FWorksheet=class extends f.FBaseInitialable{constructor(e,t,i,o,a,d,u){super(o);C(this,"setActiveSelection",this.setActiveRange);this._fWorkbook=e,this._workbook=t,this._worksheet=i,this._injector=o,this._selectionManagerService=a,this._logService=d,this._commandService=u}dispose(){super.dispose(),delete this._fWorkbook,delete this._workbook,delete this._worksheet}getSheet(){return this._worksheet}getInject(){return this._injector}getWorkbook(){return this._workbook}getSheetId(){return this._worksheet.getSheetId()}getSheetName(){return this._worksheet.getName()}getSelection(){const e=this._selectionManagerService.getCurrentSelections();return e?this._injector.createInstance(c.FSelection,this._workbook,this._worksheet,e):null}getDefaultStyle(){return this._worksheet.getDefaultCellStyle()}getRowDefaultStyle(e,t=!1){return t?this._worksheet.getRowStyle(e,t):this._worksheet.getRowStyle(e)}getColumnDefaultStyle(e,t=!1){return t?this._worksheet.getColumnStyle(e,t):this._worksheet.getColumnStyle(e)}setDefaultStyle(e){const t=this._workbook.getUnitId(),i=this._worksheet.getSheetId();return this._commandService.syncExecuteCommand(s.SetWorksheetDefaultStyleMutation.id,{unitId:t,subUnitId:i,defaultStyle:e}),this._worksheet.setDefaultCellStyle(e),this}setColumnDefaultStyle(e,t){const i=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),a={unitId:i,subUnitId:o,columnData:{[e]:{s:t}}};return this._commandService.syncExecuteCommand(s.SetColDataCommand.id,a),this}setRowDefaultStyle(e,t){const i=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),a={unitId:i,subUnitId:o,rowData:{[e]:{s:t}}};return this._commandService.syncExecuteCommand(s.SetRowDataCommand.id,a),this}getRange(e,t,i,o){let a,d;if(typeof e=="object")a=e,d=this._worksheet;else if(typeof e=="string"){const{range:u,sheetName:l}=U.deserializeRangeWithSheet(e),g=l?this._workbook.getSheetBySheetName(l):this._worksheet;if(!g)throw new Error("Range not found");d=g,a={...u,unitId:this._workbook.getUnitId(),sheetId:d.getSheetId(),rangeType:h.RANGE_TYPE.NORMAL,startRow:u.rangeType===h.RANGE_TYPE.COLUMN?0:u.startRow,endRow:u.rangeType===h.RANGE_TYPE.COLUMN?d.getMaxRows()-1:u.endRow,startColumn:u.rangeType===h.RANGE_TYPE.ROW?0:u.startColumn,endColumn:u.rangeType===h.RANGE_TYPE.ROW?d.getMaxColumns()-1:u.endColumn}}else if(typeof e=="number"&&t!==void 0)d=this._worksheet,a={startRow:e,endRow:e+(i!=null?i:1)-1,startColumn:t,endColumn:t+(o!=null?o:1)-1,unitId:this._workbook.getUnitId(),sheetId:this._worksheet.getSheetId()};else throw new Error("Invalid range specification");return this._injector.createInstance(c.FRange,this._workbook,d,a)}getMaxColumns(){return this._worksheet.getMaxColumns()}getMaxRows(){return this._worksheet.getMaxRows()}insertRowAfter(e){return this.insertRowsAfter(e,1)}insertRowBefore(e){return this.insertRowsBefore(e,1)}insertRows(e,t=1){return this.insertRowsBefore(e,t)}insertRowsAfter(e,t){const i=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),a=h.Direction.DOWN,d=e+1,u=e+t,l=0,g=this._worksheet.getColumnCount()-1,m=s.copyRangeStyles(this._worksheet,d,u,l,g,!0,e);return this._commandService.syncExecuteCommand(s.InsertRowByRangeCommand.id,{unitId:i,subUnitId:o,direction:a,range:{startRow:d,endRow:u,startColumn:l,endColumn:g},cellValue:m}),this}insertRowsBefore(e,t){const i=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),a=h.Direction.UP,d=e,u=e+t-1,l=0,g=this._worksheet.getColumnCount()-1,m=s.copyRangeStyles(this._worksheet,d,u,l,g,!0,e-1);return this._commandService.syncExecuteCommand(s.InsertRowByRangeCommand.id,{unitId:i,subUnitId:o,direction:a,range:{startRow:d,endRow:u,startColumn:l,endColumn:g},cellValue:m}),this}deleteRow(e){return this.deleteRows(e,1)}deleteRows(e,t){const i={startRow:e,endRow:e+t-1,startColumn:0,endColumn:this._worksheet.getColumnCount()-1};return this._commandService.syncExecuteCommand(s.RemoveRowByRangeCommand.id,{range:i,unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId()}),this}moveRows(e,t){const i=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),a=G(e.getRange(),this._worksheet),d=a,u={startRow:t,endRow:t,startColumn:a.startColumn,endColumn:a.endColumn};return this._commandService.syncExecuteCommand(s.MoveRowsCommand.id,{unitId:i,subUnitId:o,range:a,fromRange:d,toRange:u}),this}hideRow(e){const t=this._workbook.getUnitId(),i=this._worksheet.getSheetId(),o=G(e.getRange(),this._worksheet);return this._commandService.syncExecuteCommand(s.SetRowHiddenCommand.id,{unitId:t,subUnitId:i,ranges:[o]}),this}hideRows(e,t=1){const i=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),a={startRow:e,endRow:e+t-1,startColumn:0,endColumn:this._worksheet.getColumnCount()-1,rangeType:h.RANGE_TYPE.ROW};return this._commandService.syncExecuteCommand(s.SetRowHiddenCommand.id,{unitId:i,subUnitId:o,ranges:[a]}),this}unhideRow(e){const t=this._workbook.getUnitId(),i=this._worksheet.getSheetId(),o=G(e.getRange(),this._worksheet);return this._commandService.syncExecuteCommand(s.SetSpecificRowsVisibleCommand.id,{unitId:t,subUnitId:i,ranges:[o]}),this}showRows(e,t=1){const i=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),a={startRow:e,endRow:e+t-1,startColumn:0,endColumn:this._worksheet.getColumnCount()-1,rangeType:h.RANGE_TYPE.ROW};return this._commandService.syncExecuteCommand(s.SetSpecificRowsVisibleCommand.id,{unitId:i,subUnitId:o,ranges:[a]}),this}setRowHeight(e,t){return this.setRowHeights(e,1,t)}autoFitRow(e,t=h.BooleanNumber.TRUE){const i=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),a=[{startRow:e,endRow:e,startColumn:0,endColumn:this._worksheet.getColumnCount()-1}];return this._commandService.syncExecuteCommand(s.SetTextWrapCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:a[0],value:h.WrapStrategy.WRAP}),this._commandService.syncExecuteCommand(s.SetWorksheetRowIsAutoHeightMutation.id,{unitId:i,subUnitId:o,ranges:a,autoHeightInfo:t}),this}setRowHeights(e,t,i){var g;const o=this._workbook.getUnitId(),a=this._worksheet.getSheetId(),d=this._worksheet.getRowManager(),u=[],l=[];for(let m=e;m<e+t;m++){const S=((g=d.getRow(m))==null?void 0:g.ah)||this._worksheet.getConfig().defaultRowHeight,I={startRow:m,endRow:m,startColumn:0,endColumn:this._worksheet.getColumnCount()-1};i<=S?u.push(I):l.push(I)}return l.length>0&&this._commandService.syncExecuteCommand(s.SetRowHeightCommand.id,{unitId:o,subUnitId:a,ranges:l,value:i}),u.length>0&&this._commandService.syncExecuteCommand(s.SetWorksheetRowIsAutoHeightCommand.id,{unitId:o,subUnitId:a,ranges:u}),this}getRowHeight(e){return this._worksheet.getRowHeight(e)}setRowAutoHeight(e,t){const i=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),a=[{startRow:e,endRow:e+t-1,startColumn:0,endColumn:this._worksheet.getColumnCount()-1}];return this._commandService.syncExecuteCommand(s.SetWorksheetRowIsAutoHeightCommand.id,{unitId:i,subUnitId:o,ranges:a}),this}setRangesAutoHeight(e){const t=this._workbook.getUnitId(),i=this._worksheet.getSheetId();return this._commandService.syncExecuteCommand(s.SetWorksheetRowIsAutoHeightCommand.id,{unitId:t,subUnitId:i,ranges:e}),this}setRowHeightsForced(e,t,i){const o=this._workbook.getUnitId(),a=this._worksheet.getSheetId(),d=[{startRow:e,endRow:e+t-1,startColumn:0,endColumn:this._worksheet.getColumnCount()-1}];return this._commandService.syncExecuteCommand(s.SetRowHeightCommand.id,{unitId:o,subUnitId:a,ranges:d,value:i}),this}setRowCustom(e){const t=this._workbook.getUnitId(),i=this._worksheet.getSheetId(),o={};for(const[d,u]of Object.entries(e))o[Number(d)]={custom:u};const a={unitId:t,subUnitId:i,rowData:o};return this._commandService.syncExecuteCommand(s.SetRowDataCommand.id,a),this}insertColumnAfter(e){return this.insertColumnsAfter(e,1)}insertColumnBefore(e){return this.insertColumnsBefore(e,1)}insertColumns(e,t=1){return this.insertColumnsBefore(e,t)}insertColumnsAfter(e,t){const i=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),a=h.Direction.RIGHT,d=0,u=this._worksheet.getRowCount()-1,l=e+1,g=e+t,m=s.copyRangeStyles(this._worksheet,d,u,l,g,!1,e);return this._commandService.syncExecuteCommand(s.InsertColByRangeCommand.id,{unitId:i,subUnitId:o,direction:a,range:{startRow:d,endRow:u,startColumn:l,endColumn:g},cellValue:m}),this}insertColumnsBefore(e,t){const i=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),a=h.Direction.LEFT,d=0,u=this._worksheet.getRowCount()-1,l=e,g=e+t-1,m=s.copyRangeStyles(this._worksheet,d,u,l,g,!1,e-1);return this._commandService.syncExecuteCommand(s.InsertColByRangeCommand.id,{unitId:i,subUnitId:o,direction:a,range:{startRow:d,endRow:u,startColumn:l,endColumn:g},cellValue:m}),this}deleteColumn(e){return this.deleteColumns(e,1)}deleteColumns(e,t){const i={startRow:0,endRow:this._worksheet.getRowCount()-1,startColumn:e,endColumn:e+t-1};return this._commandService.syncExecuteCommand(s.RemoveColByRangeCommand.id,{range:i,unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId()}),this}moveColumns(e,t){const i=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),a=K(e.getRange(),this._worksheet),d=a,u={startRow:0,endRow:this._worksheet.getRowCount()-1,startColumn:t,endColumn:t};return this._commandService.syncExecuteCommand(s.MoveColsCommand.id,{unitId:i,subUnitId:o,range:a,fromRange:d,toRange:u}),this}hideColumn(e){const t=this._workbook.getUnitId(),i=this._worksheet.getSheetId(),o=K(e.getRange(),this._worksheet);return this._commandService.syncExecuteCommand(s.SetColHiddenCommand.id,{unitId:t,subUnitId:i,ranges:[o]}),this}hideColumns(e,t=1){const i=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),a={startRow:0,endRow:this._worksheet.getRowCount()-1,startColumn:e,endColumn:e+t-1,rangeType:h.RANGE_TYPE.COLUMN};return this._commandService.syncExecuteCommand(s.SetColHiddenCommand.id,{unitId:i,subUnitId:o,ranges:[a]}),this}unhideColumn(e){const t=this._workbook.getUnitId(),i=this._worksheet.getSheetId(),o=K(e.getRange(),this._worksheet);return this._commandService.syncExecuteCommand(s.SetSpecificColsVisibleCommand.id,{unitId:t,subUnitId:i,ranges:[o]}),this}showColumns(e,t=1){const i=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),a={startRow:0,endRow:this._worksheet.getRowCount()-1,startColumn:e,endColumn:e+t-1,rangeType:h.RANGE_TYPE.COLUMN};return this._commandService.syncExecuteCommand(s.SetSpecificColsVisibleCommand.id,{unitId:i,subUnitId:o,ranges:[a]}),this}setColumnWidth(e,t){return this.setColumnWidths(e,1,t)}setColumnWidths(e,t,i){const o=this._workbook.getUnitId(),a=this._worksheet.getSheetId(),d=[{startColumn:e,endColumn:e+t-1,startRow:0,endRow:this._worksheet.getRowCount()-1}];return this._commandService.syncExecuteCommand(s.SetColWidthCommand.id,{unitId:o,subUnitId:a,ranges:d,value:i}),this}getColumnWidth(e){return this._worksheet.getColumnWidth(e)}setColumnCustom(e){const t=this._workbook.getUnitId(),i=this._worksheet.getSheetId(),o={};for(const[d,u]of Object.entries(e))o[Number(d)]={custom:u};const a={unitId:t,subUnitId:i,columnData:o};return this._commandService.syncExecuteCommand(s.SetColDataCommand.id,a),this}getMergeData(){return this._worksheet.getMergeData().map(e=>this._injector.createInstance(c.FRange,this._workbook,this._worksheet,e))}getMergedRanges(){return this._worksheet.getSnapshot().mergeData.map(t=>this._injector.createInstance(c.FRange,this._workbook,this._worksheet,t))}getCellMergeData(e,t){const o=this._worksheet.getMergedCell(e,t);if(o)return this._injector.createInstance(c.FRange,this._workbook,this._worksheet,o)}getActiveRange(){return this._fWorkbook.getActiveRange()}setActiveRange(e){const{unitId:t,sheetId:i}=e.getRange();if(t!==this._workbook.getUnitId()||i!==this._worksheet.getSheetId())throw new Error("Specified range must be part of the sheet.");return this._fWorkbook.setActiveRange(e),this}getActiveCell(){return this._fWorkbook.getActiveCell()}setFreeze(e){return this._logService.warn("setFreeze is deprecated, use setFrozenRows and setFrozenColumns instead"),this._commandService.syncExecuteCommand(s.SetFrozenCommand.id,{...e,unitId:this._workbook.getUnitId(),subUnitId:this.getSheetId()}),this}cancelFreeze(){return this._commandService.syncExecuteCommand(s.CancelFrozenCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this.getSheetId()}),this}getFreeze(){return this._worksheet.getFreeze()}setFrozenColumns(...e){const t=this.getFreeze();if(arguments.length===1){const i=e[0];this.setFreeze({...t,startColumn:i>0?i:-1,xSplit:i})}else if(arguments.length===2){let[i=0,o=0]=e;i>o&&([i,o]=[o,i]),this._commandService.syncExecuteCommand(s.SetFrozenCommand.id,{startColumn:o+1,xSplit:o-i+1,startRow:t.startRow,ySplit:t.ySplit,unitId:this._workbook.getUnitId(),subUnitId:this.getSheetId()})}return this}setFrozenRows(...e){const t=this.getFreeze();if(arguments.length===1){const i=e[0];this.setFreeze({...t,startRow:i>0?i:-1,ySplit:i})}else if(arguments.length===2){let[i=0,o=0]=e;i>o&&([i,o]=[o,i]),this._commandService.syncExecuteCommand(s.SetFrozenCommand.id,{startRow:o+1,ySplit:o-i+1,startColumn:t.startColumn,xSplit:t.xSplit,unitId:this._workbook.getUnitId(),subUnitId:this.getSheetId()})}return this}getFrozenColumns(){const e=this.getFreeze();return e.startColumn===-1?0:e.startColumn}getFrozenRows(){const e=this.getFreeze();return e.startRow===-1?0:e.startRow}getFrozenRowRange(){const e=this._worksheet.getFreeze();return{startRow:e.startRow-e.ySplit,endRow:e.startRow-1}}getFrozenColumnRange(){const e=this._worksheet.getFreeze();return{startColumn:e.startColumn-e.xSplit,endColumn:e.startColumn-1}}hasHiddenGridLines(){return this._worksheet.getConfig().showGridlines===h.BooleanNumber.FALSE}setHiddenGridlines(e){return this._commandService.syncExecuteCommand(s.ToggleGridlinesCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),showGridlines:e?h.BooleanNumber.FALSE:h.BooleanNumber.TRUE}),this}setGridLinesColor(e){return this._commandService.syncExecuteCommand(s.SetGridlinesColorCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),color:e}),this}getGridLinesColor(){return this._worksheet.getGridlinesColor()}setTabColor(e){return this._commandService.syncExecuteCommand(s.SetTabColorCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),value:e}),this}getTabColor(){return this._worksheet.getTabColor()}onCellDataChange(e){return this._injector.get(h.ICommandService).onCommandExecuted(i=>{if(i.id===s.SetRangeValuesMutation.id){const o=i.params;o.unitId===this._workbook.getUnitId()&&o.subUnitId===this._worksheet.getSheetId()&&o.cellValue&&e(new h.ObjectMatrix(o.cellValue))}})}onBeforeCellDataChange(e){return this._injector.get(h.ICommandService).beforeCommandExecuted(i=>{if(i.id===s.SetRangeValuesMutation.id){const o=i.params;o.unitId===this._workbook.getUnitId()&&o.subUnitId===this._worksheet.getSheetId()&&o.cellValue&&e(new h.ObjectMatrix(o.cellValue))}})}hideSheet(){const e=this._injector.get(h.ICommandService);if(this._workbook.getSheets().filter(a=>a.isSheetHidden()!==h.BooleanNumber.TRUE).length<=1)throw new Error("Cannot hide the only visible sheet");return e.syncExecuteCommand(s.SetWorksheetHideCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId()}),this}showSheet(){return this._injector.get(h.ICommandService).syncExecuteCommand(s.SetWorksheetShowCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId()}),this}isSheetHidden(){return this._worksheet.isSheetHidden()===h.BooleanNumber.TRUE}setName(e){return this._commandService.syncExecuteCommand(s.SetWorksheetNameCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),name:e}),this}activate(){return this._fWorkbook.setActiveSheet(this),this}getIndex(){return this._workbook.getSheetIndex(this._worksheet)}clear(e){if(e&&e.contentsOnly&&!e.formatOnly)return this.clearContents();if(e&&e.formatOnly&&!e.contentsOnly)return this.clearFormats();const t=this._workbook.getUnitId(),i=this._worksheet.getSheetId(),o=this._injector.get(h.ICommandService),a={startRow:0,endRow:this._worksheet.getRowCount()-1,startColumn:0,endColumn:this._worksheet.getColumnCount()-1};return o.syncExecuteCommand(s.ClearSelectionAllCommand.id,{unitId:t,subUnitId:i,ranges:[a],options:e}),this}clearContents(){const e=this._workbook.getUnitId(),t=this._worksheet.getSheetId(),i=this._injector.get(h.ICommandService),o={startRow:0,endRow:this._worksheet.getRowCount()-1,startColumn:0,endColumn:this._worksheet.getColumnCount()-1};return i.syncExecuteCommand(s.ClearSelectionContentCommand.id,{unitId:e,subUnitId:t,ranges:[o]}),this}clearFormats(){const e=this._workbook.getUnitId(),t=this._worksheet.getSheetId(),i=this._injector.get(h.ICommandService),o={startRow:0,endRow:this._worksheet.getRowCount()-1,startColumn:0,endColumn:this._worksheet.getColumnCount()-1};return i.syncExecuteCommand(s.ClearSelectionFormatCommand.id,{unitId:e,subUnitId:t,ranges:[o]}),this}getDataRange(){const{startRow:e,endRow:t,startColumn:i,endColumn:o}=this._worksheet.getDataRealRange();return this.getRange(e,i,t-e+1,o-i+1)}getLastColumns(){return this._worksheet.getLastColumnWithContent()}getLastColumn(){return this._worksheet.getLastColumnWithContent()}getLastRows(){return this._worksheet.getLastRowWithContent()}getLastRow(){return this._worksheet.getLastRowWithContent()}equalTo(e){return e instanceof c.FWorksheet?this._worksheet.getSheetId()===e.getSheetId()&&this._workbook.getUnitId()===e.getWorkbook().getUnitId():!1}insertDefinedName(e,t){const o=this._injector.createInstance(x).setName(e).setRef(t).build();o.localSheetId=this.getSheetId(),this._fWorkbook.insertDefinedNameBuilder(o)}getDefinedNames(){return this._fWorkbook.getDefinedNames().filter(t=>t.getLocalSheetId()===this.getSheetId())}setCustomMetadata(e){return this._worksheet.setCustomMetadata(e),this}getCustomMetadata(){return this._worksheet.getCustomMetadata()}setRowCustomMetadata(e,t){return this._worksheet.getRowManager().setCustomMetadata(e,t),this}setColumnCustomMetadata(e,t){return this._worksheet.getColumnManager().setCustomMetadata(e,t),this}getRowCustomMetadata(e){return this._worksheet.getRowManager().getCustomMetadata(e)}getColumnCustomMetadata(e){return this._worksheet.getColumnManager().getCustomMetadata(e)}appendRow(e){const t=this._worksheet.getCellMatrix().hasValue(),i=this._worksheet.getLastRowWithContent(),o=this._worksheet.getRowCount(),a=this._worksheet.getColumnCount(),d=t?i+1:i,u=new h.ObjectMatrix;for(let l=0;l<e.length;l++)u.setValue(d,l,h.covertCellValue(e[l]));return this._commandService.syncExecuteCommand(s.AppendRowCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),cellValue:u.getMatrix(),insertRowNums:d>o-1?1:0,insertColumnNums:e.length>a?e.length-a:0,maxRows:o,maxColumns:a}),this}setRowCount(e){return this._commandService.syncExecuteCommand(s.SetWorksheetRowCountCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),rowCount:e}),this}setColumnCount(e){return this._commandService.syncExecuteCommand(s.SetWorksheetColumnCountCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),columnCount:e}),this}getWorksheetPermission(){return this._injector.createInstance(L,this)}},c.FWorksheet=ke([H(3,h.Inject(h.Injector)),H(4,h.Inject(s.SheetsSelectionsService)),H(5,h.Inject(h.ILogService)),H(6,h.ICommandService)],c.FWorksheet);var Ie=Object.getOwnPropertyDescriptor,be=(r,n,e,t)=>{for(var i=t>1?void 0:t?Ie(n,e):n,o=r.length-1,a;o>=0;o--)(a=r[o])&&(i=a(i)||i);return i},T=(r,n)=>(e,t)=>n(e,t,r);let Y=class{constructor(r,n,e,t,i,o,a,d,u){C(this,"_permissionSubject");C(this,"_subscriptions",[]);C(this,"_fPermission");C(this,"permission$");C(this,"protectionChange$");this._unitId=r,this._subUnitId=n,this._range=e,this._worksheet=t,this._injector=i,this._permissionService=o,this._authzIoService=a,this._commandService=d,this._rangeProtectionRuleModel=u,this._fPermission=this._injector.createInstance(c.FPermission),this._permissionSubject=new N.BehaviorSubject(this._buildSnapshot()),this.permission$=this._createPermissionStream(),this.protectionChange$=this._createProtectionChangeStream()}_createPermissionStream(){const r=this._permissionService.permissionPointUpdate$.pipe(k.filter(n=>{const e=n.id;return e.includes(this._unitId)&&e.includes(this._subUnitId)})).subscribe(()=>{this._permissionSubject.next(this._buildSnapshot())});return this._subscriptions.push(r),this._permissionSubject.asObservable().pipe(k.distinctUntilChanged((n,e)=>JSON.stringify(n)===JSON.stringify(e)),k.shareReplay({bufferSize:1,refCount:!0}))}_createProtectionChangeStream(){return this._rangeProtectionRuleModel.ruleChange$.pipe(k.filter(r=>r.unitId!==this._unitId||r.subUnitId!==this._subUnitId?!1:r.type==="delete"?this._rangeMatches(r.rule):r.type==="add"?this._rangeMatches(r.rule):!1),k.map(r=>(this._permissionSubject.next(this._buildSnapshot()),r.type==="delete"?{type:"unprotected",ruleId:r.rule.id}:{type:"protected",rule:this._createFacadeRule(r.rule)})),k.shareReplay({bufferSize:1,refCount:!0}))}_rangeMatches(r){const n=this._range.getRange();return r.ranges.some(e=>n.startRow===e.startRow&&n.startColumn===e.startColumn&&n.endRow===e.endRow&&n.endColumn===e.endColumn)}_createFacadeRule(r){const n=r.ranges.map(t=>this._worksheet.getRange(t.startRow,t.startColumn,t.endRow-t.startRow+1,t.endColumn-t.startColumn+1)),e={name:r.description||"",allowViewByOthers:r.viewState!==s.ViewStateEnum.NoOneElseCanView,allowEdit:r.editState===s.EditStateEnum.DesignedUserCanEdit};return this._injector.createInstance(y,this._unitId,this._subUnitId,r.id,r.permissionId,n,e)}getPoint(r){const n=O[r];if(!n)return console.warn(`Unknown permission point: ${r}`),!1;const e=this._getProtectionRule();if(e){const t=new n(this._unitId,this._subUnitId,e.permissionId),i=this._permissionService.getPermissionPoint(t.id);if(i)return i.value}return!0}getSnapshot(){return this._buildSnapshot()}isProtected(){return this._getProtectionRule()!==null}canEdit(){return this.getPoint(b.Edit)}canView(){return this.getPoint(b.View)}canManageCollaborator(){return this.getPoint(b.ManageCollaborator)}canDelete(){return this.getPoint(b.Delete)}async setPoint(r,n){const e=O[r];if(!e)throw new Error(`Unknown permission point: ${r}`);const t=this._getProtectionRule();if(!t)throw new Error("Cannot set permission point: No protection rule exists for this range. Call protect() first.");if(this.getPoint(r)===n)return;const o=t.permissionId;this._fPermission.setRangeProtectionPermissionPoint(this._unitId,this._subUnitId,o,e,n),this._permissionSubject.next(this._buildSnapshot())}async protect(r){if(this.isProtected())throw new Error("Range is already protected");const n=await this._fPermission.addRangeBaseProtection(this._unitId,this._subUnitId,[this._range],r);if(!n)throw new Error("Failed to create range protection");const{permissionId:e,ruleId:t}=n;return await this._setPermissionPoints(e,r),this._injector.createInstance(y,this._unitId,this._subUnitId,t,e,[this._range],r||{})}_determineViewState(r){return(r==null?void 0:r.allowViewByOthers)===!1?s.ViewStateEnum.NoOneElseCanView:s.ViewStateEnum.OthersCanView}_determineEditState(r){var n;return(r==null?void 0:r.allowEdit)===!0&&((n=r==null?void 0:r.allowedUsers)!=null&&n.length)?s.EditStateEnum.DesignedUserCanEdit:s.EditStateEnum.OnlyMe}async _setPermissionPoints(r,n){if(!n)return;const e=(t,i)=>t===void 0?i:typeof t=="boolean"?t:!0;await this._setPermissionPoint(r,b.Edit,e(n.allowEdit,!1)),await this._setPermissionPoint(r,b.View,e(n.allowViewByOthers,!0))}async _setPermissionPoint(r,n,e){const t=O[n];t&&this._fPermission.setRangeProtectionPermissionPoint(this._unitId,this._subUnitId,r,t,e)}async unprotect(){const r=this._getProtectionRule();if(!r)return;const n=r.id;this._fPermission.removeRangeProtection(this._unitId,this._subUnitId,[n])}async listRules(){return await this._buildProtectionRulesAsync()}subscribe(r){const n=this.permission$.subscribe(r);return()=>n.unsubscribe()}_getProtectionRule(){const r=this._rangeProtectionRuleModel.getSubunitRuleList(this._unitId,this._subUnitId),n=this._range.getRange();for(const e of r)for(const t of e.ranges)if(n.startRow===t.startRow&&n.startColumn===t.startColumn&&n.endRow===t.endRow&&n.endColumn===t.endColumn)return e;return null}_buildProtectionRules(){return this._rangeProtectionRuleModel.getSubunitRuleList(this._unitId,this._subUnitId).map(n=>{const e=n.ranges.map(i=>this._worksheet.getRange(i.startRow,i.startColumn,i.endRow-i.startRow+1,i.endColumn-i.startColumn+1)),t={name:n.description||"",allowViewByOthers:n.viewState!==s.ViewStateEnum.NoOneElseCanView};return n.editState===s.EditStateEnum.DesignedUserCanEdit?t.allowEdit=!0:t.allowEdit=!1,this._injector.createInstance(y,this._unitId,this._subUnitId,n.id,n.permissionId,e,t)})}async _buildProtectionRulesAsync(){const r=this._rangeProtectionRuleModel.getSubunitRuleList(this._unitId,this._subUnitId);return(await Promise.all(r.map(async e=>{const t=e.ranges.map(o=>this._worksheet.getRange(o.startRow,o.startColumn,o.endRow-o.startRow+1,o.endColumn-o.startColumn+1)),i={name:e.description||"",allowViewByOthers:e.viewState!==s.ViewStateEnum.NoOneElseCanView};if(e.editState===s.EditStateEnum.DesignedUserCanEdit)try{const a=(await this._authzIoService.listCollaborators({objectID:e.permissionId,unitID:this._unitId})).filter(d=>d.role===$.Editor).map(d=>{var u;return((u=d.subject)==null?void 0:u.userID)||d.id});i.allowEdit=a.length>0}catch(o){console.warn(`Failed to fetch collaborators for rule ${e.id}:`,o),i.allowEdit=!1}else i.allowEdit=!1;return{rule:e,ranges:t,options:i}}))).map(({rule:e,ranges:t,options:i})=>this._injector.createInstance(y,this._unitId,this._subUnitId,e.id,e.permissionId,t,i))}_buildSnapshot(){const r={};return Object.values(b).forEach(n=>{r[n]=this.getPoint(n)}),r}dispose(){this._subscriptions.forEach(r=>r.unsubscribe()),this._permissionSubject.complete()}};Y=be([T(4,h.Inject(h.Injector)),T(5,h.Inject(h.IPermissionService)),T(6,h.Inject(h.IAuthzIoService)),T(7,h.Inject(h.ICommandService)),T(8,h.Inject(s.RangeProtectionRuleModel))],Y);var fe=Object.getOwnPropertyDescriptor,ve=(r,n,e,t)=>{for(var i=t>1?void 0:t?fe(n,e):n,o=r.length-1,a;o>=0;o--)(a=r[o])&&(i=a(i)||i);return i},q=(r,n)=>(e,t)=>n(e,t,r);c.FRange=(M=class extends f.FBaseInitialable{constructor(n,e,t,i,o,a){super(i),this._workbook=n,this._worksheet=e,this._range=t,this._injector=i,this._commandService=o,this._formulaDataModel=a;const d=this._worksheet.getRowCount(),u=this._worksheet.getColumnCount();if(this._range.startRow<0||this._range.startColumn<0||this._range.endRow>=d||this._range.endColumn>=u)throw new Error(`Range is out of bounds. Max rows: ${d}, Max columns: ${u}, Given range: ${JSON.stringify(this._range)}`);this._runInitializers(this._injector,this._workbook,this._worksheet,this._range,this._commandService,this._formulaDataModel)}getUnitId(){return this._workbook.getUnitId()}getSheetName(){return this._worksheet.getName()}getSheetId(){return this._worksheet.getSheetId()}getRange(){return this._range}getRow(){return this._range.startRow}getLastRow(){return this._range.endRow}getColumn(){return this._range.startColumn}getLastColumn(){return this._range.endColumn}getWidth(){return this._range.endColumn-this._range.startColumn+1}getHeight(){return this._range.endRow-this._range.startRow+1}isMerged(){const{startColumn:n,startRow:e,endColumn:t,endRow:i}=this._range;return this._worksheet.getMergedCellRange(e,n,i,t).some(a=>h.Rectangle.equals(a,this._range))}getCellStyleData(n="row"){return n!=="cell"?this._worksheet.getComposedCellStyle(this._range.startRow,this._range.startColumn,n==="row"):this._worksheet.getCellStyle(this._range.startRow,this._range.startColumn)}getFontFamily(n="row"){var e,t;return(t=(e=this.getCellStyleData(n))==null?void 0:e.ff)!=null?t:null}getFontSize(n="row"){var e,t;return(t=(e=this.getCellStyleData(n))==null?void 0:e.fs)!=null?t:null}getCellStyle(n="row"){const e=this.getCellStyleData(n);return e?h.TextStyleValue.create(e):null}getCellStyles(n="row"){return this.getCellDatas().map((t,i)=>t.map((o,a)=>{if(!o)return null;const d=n!=="cell"?this._worksheet.getComposedCellStyle(i+this._range.startRow,a+this._range.startColumn,n==="row"):this._worksheet.getCellStyle(i+this._range.startRow,a+this._range.startColumn);return d?h.TextStyleValue.create(d):null}))}getValue(n){var e,t;return n?this.getValueAndRichTextValue():(t=(e=this._worksheet.getCell(this._range.startRow,this._range.startColumn))==null?void 0:e.v)!=null?t:null}getRawValue(){var e,t;const n=this._worksheet.getCellMatrix().getValue(this._range.startRow,this._range.startColumn);return n!=null&&n.p&&((e=n.p.body)!=null&&e.dataStream)?n.p.body.dataStream:(t=n==null?void 0:n.v)!=null?t:null}getDisplayValue(){var e,t,i;const n=this._worksheet.getCell(this._range.startRow,this._range.startColumn);return n!=null&&n.p&&((e=n.p.body)!=null&&e.dataStream)?n.p.body.dataStream:(i=(t=n==null?void 0:n.v)==null?void 0:t.toString())!=null?i:""}getValues(n){var d,u;if(n)return this.getValueAndRichTextValues();const{startRow:e,endRow:t,startColumn:i,endColumn:o}=this._range,a=[];for(let l=e;l<=t;l++){const g=[];for(let m=i;m<=o;m++)g.push((u=(d=this._worksheet.getCell(l,m))==null?void 0:d.v)!=null?u:null);a.push(g)}return a}getRawValues(){var d,u;const n=this._worksheet.getCellMatrix(),{startRow:e,endRow:t,startColumn:i,endColumn:o}=this._range,a=[];for(let l=e;l<=t;l++){const g=[];for(let m=i;m<=o;m++){const S=n.getValue(l,m);S!=null&&S.p&&((d=S.p.body)!=null&&d.dataStream)?g.push(S.p.body.dataStream):g.push((u=S==null?void 0:S.v)!=null?u:null)}a.push(g)}return a}getDisplayValues(){var a,d,u;const{startRow:n,endRow:e,startColumn:t,endColumn:i}=this._range,o=[];for(let l=n;l<=e;l++){const g=[];for(let m=t;m<=i;m++){const S=this._worksheet.getCell(l,m);S!=null&&S.p&&((a=S.p.body)!=null&&a.dataStream)?g.push(S.p.body.dataStream):g.push((u=(d=S==null?void 0:S.v)==null?void 0:d.toString())!=null?u:"")}o.push(g)}return o}getCellData(){var n;return(n=this._worksheet.getCell(this._range.startRow,this._range.startColumn))!=null?n:null}getCellDatas(){return this.getCellDataGrid()}getCellDataGrid(){const{startRow:n,endRow:e,startColumn:t,endColumn:i}=this._range,o=[];for(let a=n;a<=e;a++){const d=[];for(let u=t;u<=i;u++)d.push(this._worksheet.getCellRaw(a,u));o.push(d)}return o}getRichTextValue(){const n=this.getCellData();return n!=null&&n.p?new h.RichTextValue(n.p):null}getRichTextValues(){return this.getCellDataGrid().map(e=>e.map(t=>t!=null&&t.p?new h.RichTextValue(t.p):null))}getValueAndRichTextValue(){const n=this.getCellData();return n!=null&&n.p?new h.RichTextValue(n.p):n==null?void 0:n.v}getValueAndRichTextValues(){return this.getCellDatas().map(e=>e.map(t=>t!=null&&t.p?new h.RichTextValue(t.p):t==null?void 0:t.v))}getFormula(){var n;return(n=this._formulaDataModel.getFormulaStringByCell(this._range.startRow,this._range.startColumn,this._worksheet.getSheetId(),this._workbook.getUnitId()))!=null?n:""}getFormulas(){const n=[],{startRow:e,endRow:t,startColumn:i,endColumn:o}=this._range,a=this._worksheet.getSheetId(),d=this._workbook.getUnitId();for(let u=e;u<=t;u++){const l=[];for(let g=i;g<=o;g++){const m=this._formulaDataModel.getFormulaStringByCell(u,g,a,d);l.push(m||"")}n.push(l)}return n}getWrap(){return this._worksheet.getRange(this._range).getWrap()===h.BooleanNumber.TRUE}getWraps(){const n=this.getCellDatas(),e=this._workbook.getStyles();return n.map(t=>t.map(i=>{var o;return((o=e.getStyleByCell(i))==null?void 0:o.tb)===h.WrapStrategy.WRAP}))}getWrapStrategy(){return this._worksheet.getRange(this._range).getWrapStrategy()}getHorizontalAlignment(){const n=this._worksheet.getRange(this._range).getHorizontalAlignment();return ee(n)}getHorizontalAlignments(){return this._worksheet.getRange(this._range).getHorizontalAlignments().map(e=>e.map(t=>ee(t)))}getVerticalAlignment(){return te(this._worksheet.getRange(this._range).getVerticalAlignment())}getVerticalAlignments(){return this._worksheet.getRange(this._range).getVerticalAlignments().map(e=>e.map(t=>te(t)))}setCustomMetaData(n){return this.setValue({custom:n})}setCustomMetaDatas(n){return this.setValues(n.map(e=>e.map(t=>({custom:t}))))}getCustomMetaData(){var e;const n=this.getCellData();return(e=n==null?void 0:n.custom)!=null?e:null}getCustomMetaDatas(){return this.getCellDataGrid().map(e=>e.map(t=>{var i;return(i=t==null?void 0:t.custom)!=null?i:null}))}setBorder(n,e,t){return this._commandService.syncExecuteCommand(s.SetBorderBasicCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),ranges:[this._range],value:{type:n,style:e,color:t}}),this}getBackground(){var e,t;const n=this.getCellStyle();return(t=(e=n==null?void 0:n.background)==null?void 0:e.rgb)!=null?t:h.DEFAULT_STYLES.bg.rgb}getBackgrounds(){return this.getCellStyles().map(e=>e.map(t=>{var i,o;return(o=(i=t==null?void 0:t.background)==null?void 0:i.rgb)!=null?o:h.DEFAULT_STYLES.bg.rgb}))}setBackgroundColor(n){return this._commandService.syncExecuteCommand(s.SetStyleCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,style:{type:"bg",value:{rgb:n}}}),this}setBackground(n){return this.setBackgroundColor(n),this}setTextRotation(n){return this._commandService.syncExecuteCommand(s.SetTextRotationCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,value:n}),this}setValue(n){const e=h.covertCellValue(n);if(!e)throw new Error("Invalid value");return this._commandService.syncExecuteCommand(s.SetRangeValuesCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,value:e}),this}setValueForCell(n){const e=h.covertCellValue(n);if(!e)throw new Error("Invalid value");return this._commandService.syncExecuteCommand(s.SetRangeValuesCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:{startColumn:this._range.startColumn,startRow:this._range.startRow,endColumn:this._range.startColumn,endRow:this._range.startRow},value:e}),this}setRichTextValueForCell(n){const e=n instanceof h.RichTextValue?n.getData():n,t={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:{startColumn:this._range.startColumn,startRow:this._range.startRow,endColumn:this._range.startColumn,endRow:this._range.startRow},value:{p:e}};return this._commandService.syncExecuteCommand(s.SetRangeValuesCommand.id,t),this}setRichTextValues(n){const e=n.map(o=>o.map(a=>a&&{p:a instanceof h.RichTextValue?a.getData():a})),t=h.covertCellValues(e,this._range),i={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,value:t};return this._commandService.syncExecuteCommand(s.SetRangeValuesCommand.id,i),this}setWrap(n){return this._commandService.syncExecuteCommand(s.SetTextWrapCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,value:n?h.WrapStrategy.WRAP:h.WrapStrategy.UNSPECIFIED}),this}setWrapStrategy(n){return this._commandService.syncExecuteCommand(s.SetTextWrapCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,value:n}),this}setVerticalAlignment(n){return this._commandService.syncExecuteCommand(s.SetVerticalTextAlignCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,value:we(n)}),this}setHorizontalAlignment(n){return this._commandService.syncExecuteCommand(s.SetHorizontalTextAlignCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,value:Se(n)}),this}setValues(n){const e=h.covertCellValues(n,this._range);return this._commandService.syncExecuteCommand(s.SetRangeValuesCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,value:e}),this}setFontWeight(n){let e;if(n==="bold")e=h.BooleanNumber.TRUE;else if(n==="normal")e=h.BooleanNumber.FALSE;else if(n===null)e=null;else throw new Error("Invalid fontWeight");const t={type:"bl",value:e},i={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,style:t};return this._commandService.syncExecuteCommand(s.SetStyleCommand.id,i),this}setFontStyle(n){let e;if(n==="italic")e=h.BooleanNumber.TRUE;else if(n==="normal")e=h.BooleanNumber.FALSE;else if(n===null)e=null;else throw new Error("Invalid fontStyle");const t={type:"it",value:e},i={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,style:t};return this._commandService.syncExecuteCommand(s.SetStyleCommand.id,i),this}setFontLine(n){if(n==="underline")this._setFontUnderline({s:h.BooleanNumber.TRUE});else if(n==="line-through")this._setFontStrikethrough({s:h.BooleanNumber.TRUE});else if(n==="none")this._setFontUnderline({s:h.BooleanNumber.FALSE}),this._setFontStrikethrough({s:h.BooleanNumber.FALSE});else if(n===null)this._setFontUnderline(null),this._setFontStrikethrough(null);else throw new Error("Invalid fontLine");return this}_setFontUnderline(n){const e={type:"ul",value:n},t={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,style:e};this._commandService.syncExecuteCommand(s.SetStyleCommand.id,t)}_setFontStrikethrough(n){const e={type:"st",value:n},t={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,style:e};this._commandService.syncExecuteCommand(s.SetStyleCommand.id,t)}setFontFamily(n){const e={type:"ff",value:n},t={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,style:e};return this._commandService.syncExecuteCommand(s.SetStyleCommand.id,t),this}setFontSize(n){const e={type:"fs",value:n},t={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,style:e};return this._commandService.syncExecuteCommand(s.SetStyleCommand.id,t),this}setFontColor(n){const t={type:"cl",value:n===null?null:{rgb:n}},i={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,style:t};return this._commandService.syncExecuteCommand(s.SetStyleCommand.id,i),this}merge(n=!0){const e=this._workbook.getUnitId(),t=this._worksheet.getSheetId();return s.addMergeCellsUtil(this._injector,e,t,[this._range],n),this}mergeAcross(n=!0){const e=s.getAddMergeMutationRangeByType([this._range],h.Dimension.ROWS),t=this._workbook.getUnitId(),i=this._worksheet.getSheetId();return s.addMergeCellsUtil(this._injector,t,i,e,n),this}mergeVertically(n=!0){const e=s.getAddMergeMutationRangeByType([this._range],h.Dimension.COLUMNS),t=this._workbook.getUnitId(),i=this._worksheet.getSheetId();return s.addMergeCellsUtil(this._injector,t,i,e,n),this}isPartOfMerge(){const{startRow:n,startColumn:e,endRow:t,endColumn:i}=this._range;return this._worksheet.getMergedCellRange(n,e,t,i).length>0}breakApart(){return this._commandService.syncExecuteCommand(s.RemoveWorksheetMergeCommand.id,{ranges:[this._range]}),this}forEach(n){const{startColumn:e,startRow:t,endColumn:i,endRow:o}=this._range;this._worksheet.getMatrixWithMergedCells(t,e,o,i).forValue((a,d,u)=>{n(a,d,u)})}getA1Notation(n,e,t){const i={...this._range,startAbsoluteRefType:e,endAbsoluteRefType:t};return n?U.serializeRangeWithSheet(this._worksheet.getName(),i):U.serializeRange(i)}activate(){return this._injector.createInstance(c.FWorkbook,this._workbook).setActiveRange(this),this}activateAsCurrentCell(){const n=this._worksheet.getMergedCell(this._range.startRow,this._range.startColumn);if(n&&h.Rectangle.equals(n,this._range)||!n&&this._range.startRow===this._range.endRow&&this._range.startColumn===this._range.endColumn){const i=this._injector.createInstance(c.FWorkbook,this._workbook).getActiveRange();if(!i||i.getUnitId()!==this.getUnitId()||i.getSheetId()!==this.getSheetId())return this.activate();if(h.Rectangle.contains(i.getRange(),this._range)){const o={unitId:this.getUnitId(),subUnitId:this.getSheetId(),selections:[{range:i.getRange(),primary:s.getPrimaryForRange(this.getRange(),this._worksheet),style:null}]};return this._commandService.syncExecuteCommand(s.SetSelectionsOperation.id,o),this}return this.activate()}else throw new Error("The range is not a single cell")}splitTextToColumns(n,e,t){this._commandService.syncExecuteCommand(s.SplitTextToColumnsCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,delimiter:e,customDelimiter:t,treatMultipleDelimitersAsOne:n})}useThemeStyle(n){if(n==null){const e=this.getUsedThemeStyle();e&&this.removeThemeStyle(e)}else this._commandService.syncExecuteCommand(s.SetWorksheetRangeThemeStyleCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,themeName:n})}removeThemeStyle(n){this._commandService.syncExecuteCommand(s.DeleteWorksheetRangeThemeStyleCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,themeName:n})}getUsedThemeStyle(){return this._injector.get(s.SheetRangeThemeService).getAppliedRangeThemeStyle({unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range})}clear(n){return n&&n.contentsOnly&&!n.formatOnly?this.clearContent():n&&n.formatOnly&&!n.contentsOnly?this.clearFormat():(this._commandService.syncExecuteCommand(s.ClearSelectionAllCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),ranges:[this._range],options:n}),this)}clearContent(){return this._commandService.syncExecuteCommand(s.ClearSelectionContentCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),ranges:[this._range]}),this}clearFormat(){return this._commandService.syncExecuteCommand(s.ClearSelectionFormatCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),ranges:[this._range]}),this}insertCells(n){n===h.Dimension.ROWS?this._commandService.executeCommand(s.InsertRangeMoveDownCommand.id,{range:this._range}):this._commandService.executeCommand(s.InsertRangeMoveRightCommand.id,{range:this._range})}deleteCells(n){n===h.Dimension.ROWS?this._commandService.executeCommand(s.DeleteRangeMoveUpCommand.id,{range:this._range}):this._commandService.executeCommand(s.DeleteRangeMoveLeftCommand.id,{range:this._range})}getDataRegion(n){const{startRow:e,startColumn:t,endRow:i,endColumn:o}=this._range,a=this._worksheet.getMaxRows(),d=this._worksheet.getMaxColumns(),u=this._worksheet.getCellMatrix();let l=e,g=t,m=i,S=o;if(n!==h.Dimension.COLUMNS){let I=!1,R=!1;for(let v=t;v<=o&&(e>0&&!h.isNullCell(u.getValue(e-1,v))&&(I=!0),i<a-1&&!h.isNullCell(u.getValue(i+1,v))&&(R=!0),!(I&&R));v++);I&&(l=e-1),R&&(m=i+1)}if(n!==h.Dimension.ROWS){let I=!1,R=!1;for(let v=e;v<=i&&(t>0&&!h.isNullCell(u.getValue(v,t-1))&&(I=!0),o<d-1&&!h.isNullCell(u.getValue(v,o+1))&&(R=!0),!(I&&R));v++);I&&(g=t-1),R&&(S=o+1)}return this._injector.createInstance(c.FRange,this._workbook,this._worksheet,{startRow:l,startColumn:g,endRow:m,endColumn:S})}isBlank(){const n=this._worksheet.getCellMatrix(),{startRow:e,startColumn:t,endRow:i,endColumn:o}=this._range;let a=!0;for(let d=e;d<=i;d++){for(let u=t;u<=o;u++)if(!h.isNullCell(n.getValue(d,u))){a=!1;break}if(!a)break}return a}offset(n,e,t,i){const{startRow:o,startColumn:a,endRow:d,endColumn:u}=this._range,l=o+n,g=a+e,m=t?l+t-1:d+n,S=i?g+i-1:u+e;if(l<0||g<0||m<0||S<0)throw new Error("The row or column index is out of range");return this._injector.createInstance(c.FRange,this._workbook,this._worksheet,{startRow:l,startColumn:g,endRow:m,endColumn:S})}setFormula(n){return this.setValue({f:n})}setFormulas(n){return this.setValues(n.map(e=>e.map(t=>({f:t}))))}getRangePermission(){const n=this._injector.createInstance(c.FWorksheet,this._injector.createInstance(c.FWorkbook,this._workbook),this._workbook,this._worksheet);return this._injector.createInstance(Y,this._workbook.getUnitId(),this._worksheet.getSheetId(),this,n)}},M._enableManualInit(),M),c.FRange=ve([q(3,h.Inject(h.Injector)),q(4,h.ICommandService),q(5,h.Inject(U.FormulaDataModel))],c.FRange);var Re=Object.getOwnPropertyDescriptor,pe=(r,n,e,t)=>{for(var i=t>1?void 0:t?Re(n,e):n,o=r.length-1,a;o>=0;o--)(a=r[o])&&(i=a(i)||i);return i},J=(r,n)=>(e,t)=>n(e,t,r);let Z=class{constructor(r,n,e,t){C(this,"_permissionSubject");C(this,"_collaboratorChangeSubject",new N.Subject);C(this,"permission$");C(this,"pointChange$");C(this,"collaboratorChange$");C(this,"_subscriptions",[]);C(this,"_fPermission");this._unitId=r,this._injector=n,this._permissionService=e,this._authzIoService=t,this._fPermission=this._injector.createInstance(c.FPermission),this._permissionSubject=new N.BehaviorSubject(this._buildSnapshot()),this.permission$=this._createPermissionStream(),this.pointChange$=this._createPointChangeStream(),this.collaboratorChange$=this._collaboratorChangeSubject.asObservable().pipe(k.shareReplay({bufferSize:1,refCount:!0}))}_createPermissionStream(){const r=this._permissionService.permissionPointUpdate$.pipe(k.filter(n=>n.id.includes(this._unitId))).subscribe(()=>{this._permissionSubject.next(this._buildSnapshot())});return this._subscriptions.push(r),this._permissionSubject.asObservable().pipe(k.distinctUntilChanged((n,e)=>JSON.stringify(n)===JSON.stringify(e)),k.shareReplay({bufferSize:1,refCount:!0}))}_createPointChangeStream(){const r=new Map;for(const n in _){const e=_[n];r.set(e,this.getPoint(e))}return this._permissionService.permissionPointUpdate$.pipe(k.filter(n=>n.id.includes(this._unitId)),k.map(n=>{const e=this._extractWorkbookPointType(n.id);if(!e)return null;const t=!!n.value,i=r.get(e);return r.set(e,t),i===t?null:{point:e,value:t,oldValue:i}}),k.filter(n=>n!==null),k.shareReplay({bufferSize:1,refCount:!0}))}_extractWorkbookPointType(r){for(const n in _){const e=_[n],t=F[e];if(!t)continue;if(new t(this._unitId).id===r)return e}return null}_buildSnapshot(){const r={};for(const n in _){const e=_[n];r[e]=this.getPoint(e)}return r}async setMode(r){const n=this._getModePermissions(r);await this._batchSetPermissionPoints(n)}_getModePermissions(r){const n={};switch(Object.values(_).forEach(e=>{n[e]=!1}),r){case"owner":Object.values(_).forEach(e=>{n[e]=!0});break;case"editor":n[_.Edit]=!0,n[_.View]=!0,n[_.Print]=!0,n[_.Export]=!0,n[_.CopyContent]=!0,n[_.Comment]=!0,n[_.CreateSheet]=!0,n[_.DeleteSheet]=!0,n[_.RenameSheet]=!0,n[_.MoveSheet]=!0,n[_.HideSheet]=!0,n[_.InsertRow]=!0,n[_.InsertColumn]=!0,n[_.DeleteRow]=!0,n[_.DeleteColumn]=!0,n[_.CopySheet]=!0,n[_.CreateProtection]=!0;break;case"viewer":n[_.View]=!0,n[_.Print]=!0;break;case"commenter":n[_.View]=!0,n[_.Comment]=!0,n[_.Print]=!0;break}return n}async _batchSetPermissionPoints(r){const n=[];for(const[e,t]of Object.entries(r)){const i=e,o=F[i];if(!o)throw new Error(`Unknown workbook permission point: ${i}`);const a=this.getPoint(i);a!==t&&(this._fPermission.setWorkbookPermissionPoint(this._unitId,o,t),n.push({point:i,value:t,oldValue:a}))}if(n.length>0){const e=this._buildSnapshot();this._permissionSubject.next(e)}}async setReadOnly(){await this.setMode("viewer")}async setEditable(){await this.setMode("editor")}canEdit(){return this.getPoint(_.Edit)}async setPoint(r,n){const e=F[r];if(!e)throw new Error(`Unknown workbook permission point: ${r}`);if(this.getPoint(r)===n)return;this._fPermission.setWorkbookPermissionPoint(this._unitId,e,n);const i=this._buildSnapshot();this._permissionSubject.next(i)}getPoint(r){var i;const n=F[r];if(!n)throw new Error(`Unknown workbook permission point: ${r}`);const e=new n(this._unitId),t=this._permissionService.getPermissionPoint(e.id);return(i=t==null?void 0:t.value)!=null?i:!0}getSnapshot(){return this._buildSnapshot()}async setCollaborators(r){const n=r.map(e=>({id:e.user.userID,subject:e.user,role:e.role}));await this._authzIoService.putCollaborators({objectID:this._unitId,unitID:this._unitId,collaborators:n}),r.forEach(e=>{this._collaboratorChangeSubject.next({type:"add",collaborator:{user:{id:e.user.userID},role:e.role}})})}async addCollaborator(r,n){await this._authzIoService.createCollaborator({objectID:this._unitId,unitID:this._unitId,collaborators:[{id:r.userID,subject:r,role:n}]}),this._collaboratorChangeSubject.next({type:"add",collaborator:{user:{id:r.userID},role:n}})}async updateCollaborator(r,n){await this._authzIoService.updateCollaborator({objectID:this._unitId,unitID:this._unitId,collaborator:{id:r.userID,subject:r,role:n}}),this._collaboratorChangeSubject.next({type:"update",collaborator:{user:{id:r.userID},role:n}})}async removeCollaborator(r){await this._authzIoService.deleteCollaborator({objectID:this._unitId,unitID:this._unitId,collaboratorID:r}),this._collaboratorChangeSubject.next({type:"delete",collaborator:{user:{id:r},role:D.Reader}})}async removeCollaborators(r){for(const n of r)await this.removeCollaborator(n)}async listCollaborators(){return(await this._authzIoService.listCollaborators({objectID:this._unitId,unitID:this._unitId})).map(n=>{var e,t;return{user:{id:((e=n.subject)==null?void 0:e.userID)||n.id,displayName:((t=n.subject)==null?void 0:t.name)||""},role:n.role}})}subscribe(r){const n=this.permission$.subscribe(r);return()=>n.unsubscribe()}dispose(){this._subscriptions.forEach(r=>r.unsubscribe()),this._permissionSubject.complete(),this._collaboratorChangeSubject.complete()}};Z=pe([J(1,h.Inject(h.Injector)),J(2,h.IPermissionService),J(3,h.IAuthzIoService)],Z);var Ee=Object.getOwnPropertyDescriptor,ye=(r,n,e,t)=>{for(var i=t>1?void 0:t?Ee(n,e):n,o=r.length-1,a;o>=0;o--)(a=r[o])&&(i=a(i)||i);return i},P=(r,n)=>(e,t)=>n(e,t,r);c.FWorkbook=class extends f.FBaseInitialable{constructor(e,t,i,o,a,d,u,l,g,m){super(t);C(this,"id");this._workbook=e,this._injector=t,this._resourceLoaderService=i,this._selectionManagerService=o,this._univerInstanceService=a,this._commandService=d,this._permissionService=u,this._logService=l,this._localeService=g,this._definedNamesService=m,this.id=this._workbook.getUnitId()}getWorkbook(){return this._workbook}dispose(){super.dispose(),this._workbook=null}getId(){return this.id}getName(){return this._workbook.name}setName(e){return this._commandService.syncExecuteCommand(s.SetWorkbookNameCommand.id,{unitId:this._workbook.getUnitId(),name:e}),this}save(){return this._resourceLoaderService.saveUnit(this._workbook.getUnitId())}getSnapshot(){return this._logService.warn("use 'save' instead of 'getSnapshot'"),this.save()}getActiveSheet(){const e=this._workbook.getActiveSheet();return this._injector.createInstance(c.FWorksheet,this,this._workbook,e)}getSheets(){return this._workbook.getSheets().map(e=>this._injector.createInstance(c.FWorksheet,this,this._workbook,e))}create(e,t,i,o){var l,g,m;const a=h.mergeWorksheetSnapshotWithDefault(h.Tools.deepClone((l=o==null?void 0:o.sheet)!=null?l:{}));a.name=this._workbook.uniqueSheetName(e),a.rowCount=t,a.columnCount=i,a.id=(g=o==null?void 0:o.sheet)==null?void 0:g.id;const d=(m=o==null?void 0:o.index)!=null?m:this._workbook.getSheets().length;this._commandService.syncExecuteCommand(s.InsertSheetCommand.id,{unitId:this.id,index:d,sheet:a}),this._commandService.syncExecuteCommand(s.SetWorksheetActiveOperation.id,{unitId:this.id,subUnitId:this._workbook.getSheets()[d].getSheetId()});const u=this._workbook.getActiveSheet();if(!u)throw new Error("No active sheet found");return this._injector.createInstance(c.FWorksheet,this,this._workbook,u)}getSheetBySheetId(e){const t=this._workbook.getSheetBySheetId(e);return t?this._injector.createInstance(c.FWorksheet,this,this._workbook,t):null}getSheetByName(e){const t=this._workbook.getSheetBySheetName(e);return t?this._injector.createInstance(c.FWorksheet,this,this._workbook,t):null}setActiveSheet(e){return this._commandService.syncExecuteCommand(s.SetWorksheetActiveOperation.id,{unitId:this.id,subUnitId:typeof e=="string"?e:e.getSheetId()}),typeof e=="string"?this.getSheetBySheetId(e):e}insertSheet(e,t){var d,u,l;const i=h.mergeWorksheetSnapshotWithDefault(h.Tools.deepClone((d=t==null?void 0:t.sheet)!=null?d:{}));i.name=this._workbook.uniqueSheetName(e),i.id=(u=t==null?void 0:t.sheet)==null?void 0:u.id;const o=(l=t==null?void 0:t.index)!=null?l:this._workbook.getSheets().length;this._commandService.syncExecuteCommand(s.InsertSheetCommand.id,{unitId:this.id,index:o,sheet:i}),this._commandService.syncExecuteCommand(s.SetWorksheetActiveOperation.id,{unitId:this.id,subUnitId:this._workbook.getSheets()[o].getSheetId()});const a=this._workbook.getActiveSheet();if(!a)throw new Error("No active sheet found");return this._injector.createInstance(c.FWorksheet,this,this._workbook,a)}deleteSheet(e){const t=this.id,i=typeof e=="string"?e:e.getSheetId();return this._commandService.syncExecuteCommand(s.RemoveSheetCommand.id,{unitId:t,subUnitId:i})}undo(){return this._univerInstanceService.focusUnit(this.id),this._commandService.syncExecuteCommand(h.UndoCommand.id),this}redo(){return this._univerInstanceService.focusUnit(this.id),this._commandService.syncExecuteCommand(h.RedoCommand.id),this}onBeforeCommandExecute(e){return this._commandService.beforeCommandExecuted(t=>{var i;((i=t.params)==null?void 0:i.unitId)===this.id&&e(t)})}onCommandExecuted(e){return this._commandService.onCommandExecuted(t=>{var i;((i=t.params)==null?void 0:i.unitId)===this.id&&e(t)})}onSelectionChange(e){return h.toDisposable(this._selectionManagerService.selectionMoveEnd$.subscribe(t=>{this._univerInstanceService.getCurrentUnitForType(h.UniverInstanceType.UNIVER_SHEET).getUnitId()===this.id&&(t!=null&&t.length?e(t.map(i=>i.range)):e([]))}))}setEditable(e){const t=new s.WorkbookEditablePermission(this._workbook.getUnitId());return this._permissionService.getPermissionPoint(t.id)||this._permissionService.addPermissionPoint(t),this._permissionService.updatePermissionPoint(t.id,e),this}setActiveRange(e){const t=this.getActiveSheet(),i=e.getRange().sheetId||t.getSheetId(),o=i?this._workbook.getSheetBySheetId(i):this._workbook.getActiveSheet(!0);if(!o)throw new Error("No active sheet found");o.getSheetId()!==t.getSheetId()&&this.setActiveSheet(this._injector.createInstance(c.FWorksheet,this,this._workbook,o));const a={unitId:this.getId(),subUnitId:i,selections:[e].map(d=>({range:d.getRange(),primary:s.getPrimaryForRange(d.getRange(),o),style:null}))};return this._commandService.syncExecuteCommand(s.SetSelectionsOperation.id,a),this}getActiveRange(){const e=this._workbook.getActiveSheet(),i=this._selectionManagerService.getCurrentSelections().find(o=>!!o.primary);return i?this._injector.createInstance(c.FRange,this._workbook,e,i.range):null}getActiveCell(){const e=this._workbook.getActiveSheet(),i=this._selectionManagerService.getCurrentSelections().find(a=>!!a.primary);if(!i)return null;const o={...i.primary,rangeType:h.RANGE_TYPE.NORMAL};return this._injector.createInstance(c.FRange,this._workbook,e,o)}deleteActiveSheet(){const e=this.getActiveSheet();return this.deleteSheet(e)}duplicateSheet(e){return this._commandService.syncExecuteCommand(s.CopySheetCommand.id,{unitId:e.getWorkbook().getUnitId(),subUnitId:e.getSheetId()}),this._injector.createInstance(c.FWorksheet,this,this._workbook,this._workbook.getActiveSheet())}duplicateActiveSheet(){const e=this.getActiveSheet();return this.duplicateSheet(e)}getNumSheets(){return this._workbook.getSheets().length}getLocale(){return this._localeService.getCurrentLocale()}setLocale(e){this._localeService.setLocale(e)}setSpreadsheetLocale(e){return this._localeService.setLocale(e),this}getUrl(){return location.href}moveSheet(e,t){let i=t;return i<0?i=0:i>this._workbook.getSheets().length-1&&(i=this._workbook.getSheets().length-1),this._commandService.syncExecuteCommand(s.SetWorksheetOrderCommand.id,{unitId:e.getWorkbook().getUnitId(),order:i,subUnitId:e.getSheetId()}),this}moveActiveSheet(e){const t=this.getActiveSheet();return this.moveSheet(t,e)}getPermission(){return this._injector.createInstance(c.FPermission)}getWorkbookPermission(){return this._injector.createInstance(Z,this._workbook.getUnitId())}getDefinedName(e){const t=this._definedNamesService.getValueByName(this.id,e);return t?this._injector.createInstance(A,{...t,unitId:this.id}):null}getDefinedNames(){const e=this._definedNamesService.getDefinedNameMap(this.id);return e?Object.values(e).map(t=>this._injector.createInstance(A,{...t,unitId:this.id})):[]}insertDefinedName(e,t){const o=this._injector.createInstance(x).setName(e).setRef(t).build();return o.localSheetId=s.SCOPE_WORKBOOK_VALUE_DEFINED_NAME,this.insertDefinedNameBuilder(o),this}deleteDefinedName(e){const t=this.getDefinedName(e);return t?(t.delete(),!0):!1}insertDefinedNameBuilder(e){e.unitId=this.getId(),this._commandService.syncExecuteCommand(s.SetDefinedNameCommand.id,e)}updateDefinedNameBuilder(e){this._commandService.syncExecuteCommand(s.SetDefinedNameCommand.id,e)}getRegisteredRangeThemes(){return this._injector.get(s.SheetRangeThemeService).getRegisteredRangeThemes()}registerRangeTheme(e){this._commandService.syncExecuteCommand(s.RegisterWorksheetRangeThemeStyleCommand.id,{unitId:this.getId(),rangeThemeStyle:e})}unregisterRangeTheme(e){this._commandService.syncExecuteCommand(s.UnregisterWorksheetRangeThemeStyleCommand.id,{unitId:this.getId(),themeName:e})}createRangeThemeStyle(e,t){return new s.RangeThemeStyle(e,t)}setCustomMetadata(e){return this._workbook.setCustomMetadata(e),this}getCustomMetadata(){return this._workbook.getCustomMetadata()}addStyles(e){this._workbook.addStyles(e)}removeStyles(e){this._workbook.removeStyles(e)}},c.FWorkbook=ye([P(1,h.Inject(h.Injector)),P(2,h.Inject(h.IResourceLoaderService)),P(3,h.Inject(s.SheetsSelectionsService)),P(4,h.IUniverInstanceService),P(5,h.ICommandService),P(6,h.IPermissionService),P(7,h.ILogService),P(8,h.Inject(h.LocaleService)),P(9,U.IDefinedNamesService)],c.FWorkbook);class Pe extends f.FUniver{getCommandSheetTarget(n){var o;const e=n.params;if(!e)return this.getActiveSheet();const t=e.unitId?this.getUniverSheet(e.unitId):(o=this.getActiveWorkbook)==null?void 0:o.call(this);if(!t)return;const i=t.getSheetBySheetId(e.subUnitId||e.sheetId)||t.getActiveSheet();if(i)return{workbook:t,worksheet:i}}getSheetTarget(n,e){const t=this.getUniverSheet(n);if(!t)return;const i=t.getSheetBySheetId(e);if(i)return{workbook:t,worksheet:i}}_initWorkbookEvent(n){const e=n.get(h.IUniverInstanceService);this.registerEventHandler(this.Event.WorkbookDisposed,()=>e.unitDisposed$.subscribe(t=>{t.type===h.UniverInstanceType.UNIVER_SHEET&&this.fireEvent(this.Event.WorkbookDisposed,{unitId:t.getUnitId(),unitType:t.type,snapshot:t.getSnapshot()})})),this.registerEventHandler(this.Event.WorkbookCreated,()=>e.unitAdded$.subscribe(t=>{if(t.type===h.UniverInstanceType.UNIVER_SHEET){const i=t,o=n.createInstance(c.FWorkbook,i);this.fireEvent(this.Event.WorkbookCreated,{unitId:t.getUnitId(),type:t.type,workbook:o,unit:o})}}))}_initialize(n){const e=n.get(h.ICommandService);this.registerEventHandler(this.Event.BeforeSheetCreate,()=>e.beforeCommandExecuted(t=>{var i;if(t.id===s.InsertSheetCommand.id){const o=t.params,{unitId:a,index:d,sheet:u}=o||{},l=a?this.getUniverSheet(a):(i=this.getActiveWorkbook)==null?void 0:i.call(this);if(!l)return;const g={workbook:l,index:d,sheet:u};if(this.fireEvent(this.Event.BeforeSheetCreate,g),g.cancel)throw new h.CanceledError}})),this.registerEventHandler(this.Event.BeforeActiveSheetChange,()=>e.beforeCommandExecuted(t=>{var i;if(t.id===s.SetWorksheetActiveOperation.id){const{subUnitId:o,unitId:a}=t.params,d=a?this.getUniverSheet(a):(i=this.getActiveWorkbook)==null?void 0:i.call(this);if(!d||!o)return;const u=d.getSheetBySheetId(o),l=d.getActiveSheet();if(!u||!l)return;const g={workbook:d,activeSheet:u,oldActiveSheet:l};if(this.fireEvent(this.Event.BeforeActiveSheetChange,g),g.cancel)throw new h.CanceledError}})),this.registerEventHandler(this.Event.BeforeSheetDelete,()=>e.beforeCommandExecuted(t=>{if(t.id===s.RemoveSheetCommand.id){const i=this.getCommandSheetTarget(t);if(!i)return;const{workbook:o,worksheet:a}=i,d={workbook:o,worksheet:a};if(this.fireEvent(this.Event.BeforeSheetDelete,d),d.cancel)throw new h.CanceledError}})),this.registerEventHandler(this.Event.BeforeSheetMove,()=>e.beforeCommandExecuted(t=>{if(t.id===s.SetWorksheetOrderMutation.id){const{fromOrder:i,toOrder:o}=t.params,a=this.getCommandSheetTarget(t);if(!a)return;const d={workbook:a.workbook,worksheet:a.worksheet,newIndex:o,oldIndex:i};if(this.fireEvent(this.Event.BeforeSheetMove,d),d.cancel)throw new h.CanceledError}})),this.registerEventHandler(this.Event.BeforeSheetNameChange,()=>e.beforeCommandExecuted(t=>{if(t.id===s.SetWorksheetNameCommand.id){const{name:i}=t.params,o=this.getCommandSheetTarget(t);if(!o)return;const a={workbook:o.workbook,worksheet:o.worksheet,newName:i,oldName:o.worksheet.getSheetName()};if(this.fireEvent(this.Event.BeforeSheetNameChange,a),a.cancel)throw new h.CanceledError}})),this.registerEventHandler(this.Event.BeforeSheetTabColorChange,()=>e.beforeCommandExecuted(t=>{if(t.id===s.SetTabColorMutation.id){const{color:i}=t.params,o=this.getCommandSheetTarget(t);if(!o)return;const a={workbook:o.workbook,worksheet:o.worksheet,newColor:i,oldColor:o.worksheet.getTabColor()};if(this.fireEvent(this.Event.BeforeSheetTabColorChange,a),a.cancel)throw new h.CanceledError}})),this.registerEventHandler(this.Event.BeforeSheetHideChange,()=>e.beforeCommandExecuted(t=>{if(t.id===s.SetWorksheetHideMutation.id){const{hidden:i}=t.params,o=this.getCommandSheetTarget(t);if(!o)return;const a={workbook:o.workbook,worksheet:o.worksheet,hidden:!!i};if(this.fireEvent(this.Event.BeforeSheetHideChange,a),a.cancel)throw new h.CanceledError}})),this.registerEventHandler(this.Event.BeforeGridlineColorChange,()=>e.beforeCommandExecuted(t=>{var i;if(t.id===s.SetGridlinesColorCommand.id){const o=this.getCommandSheetTarget(t);if(!o)return;const a={...o,color:(i=t.params)==null?void 0:i.color};if(this.fireEvent(this.Event.BeforeGridlineColorChange,a),a.cancel)throw new h.CanceledError}})),this.registerEventHandler(this.Event.BeforeGridlineEnableChange,()=>e.beforeCommandExecuted(t=>{var i;if(t.id===s.ToggleGridlinesCommand.id){const o=this.getCommandSheetTarget(t);if(!o)return;const a={...o,enabled:!!((i=t.params)!=null&&i.showGridlines)};if(this.fireEvent(this.Event.BeforeGridlineEnableChange,a),a.cancel)throw new h.CanceledError}})),this.registerEventHandler(this.Event.SheetValueChanged,()=>e.onCommandExecuted(t=>{if(s.COMMAND_LISTENER_VALUE_CHANGE.indexOf(t.id)>-1){if(!this.getActiveSheet())return;const o=s.getValueChangedEffectedRange(t).map(a=>{var d,u;return(u=(d=this.getWorkbook(a.unitId))==null?void 0:d.getSheetBySheetId(a.subUnitId))==null?void 0:u.getRange(a.range)}).filter(Boolean);if(!o.length)return;this.fireEvent(this.Event.SheetValueChanged,{payload:t,effectedRanges:o})}})),this.registerEventHandler(this.Event.SheetCreated,()=>e.onCommandExecuted(t=>{var i;if(t.id===s.InsertSheetCommand.id){const o=t.params,{unitId:a}=o||{},d=a?this.getUniverSheet(a):(i=this.getActiveWorkbook)==null?void 0:i.call(this);if(!d)return;const u=d.getActiveSheet();if(!u)return;const l={workbook:d,worksheet:u};this.fireEvent(this.Event.SheetCreated,l)}})),this.registerEventHandler(this.Event.ActiveSheetChanged,()=>e.onCommandExecuted(t=>{if(t.id===s.SetWorksheetActiveOperation.id){const i=this.getActiveSheet();if(!i)return;const{workbook:o,worksheet:a}=i;this._fireActiveSheetChanged(o,a)}})),this.registerEventHandler(this.Event.SheetDeleted,()=>e.onCommandExecuted(t=>{var i;if(t.id===s.RemoveSheetCommand.id){const{subUnitId:o,unitId:a}=t.params,d=a?this.getUniverSheet(a):(i=this.getActiveWorkbook)==null?void 0:i.call(this);if(!d||!o)return;this._fireSheetDeleted(d,o)}})),this.registerEventHandler(this.Event.SheetMoved,()=>e.onCommandExecuted(t=>{if(t.id===s.SetWorksheetOrderMutation.id){const{toOrder:i}=t.params,o=this.getCommandSheetTarget(t);if(!o)return;this._fireSheetMoved(o.workbook,o.worksheet,i)}})),this.registerEventHandler(this.Event.SheetNameChanged,()=>e.onCommandExecuted(t=>{if(t.id===s.SetWorksheetNameCommand.id){const{name:i}=t.params,o=this.getCommandSheetTarget(t);if(!o)return;this._fireSheetNameChanged(o.workbook,o.worksheet,i)}})),this.registerEventHandler(this.Event.SheetTabColorChanged,()=>e.onCommandExecuted(t=>{if(t.id===s.SetTabColorMutation.id){const{color:i}=t.params,o=this.getCommandSheetTarget(t);if(!o)return;this._fireSheetTabColorChanged(o.workbook,o.worksheet,i)}})),this.registerEventHandler(this.Event.SheetHideChanged,()=>e.onCommandExecuted(t=>{if(t.id===s.SetWorksheetHideMutation.id){const{hidden:i}=t.params,o=this.getCommandSheetTarget(t);if(!o)return;this._fireSheetHideChanged(o.workbook,o.worksheet,!!i)}})),this.registerEventHandler(this.Event.GridlineChanged,()=>e.onCommandExecuted(t=>{if(t.id===s.SetGridlinesColorCommand.id||t.id===s.ToggleGridlinesCommand.id){const i=this.getCommandSheetTarget(t);if(!i)return;this.fireEvent(this.Event.GridlineChanged,{...i,enabled:!i.worksheet.hasHiddenGridLines(),color:i.worksheet.getGridLinesColor()})}})),this._initWorkbookEvent(n)}createUniverSheet(n,e){const i=this._injector.get(h.IUniverInstanceService).createUnit(h.UniverInstanceType.UNIVER_SHEET,n,e);return this._injector.createInstance(c.FWorkbook,i)}createWorkbook(n,e){return this.createUniverSheet(n,e)}getActiveWorkbook(){const n=this._univerInstanceService.getCurrentUnitForType(h.UniverInstanceType.UNIVER_SHEET);return n?this._injector.createInstance(c.FWorkbook,n):null}getActiveUniverSheet(){return this.getActiveWorkbook()}getUniverSheet(n){const e=this._univerInstanceService.getUnit(n,h.UniverInstanceType.UNIVER_SHEET);return e?this._injector.createInstance(c.FWorkbook,e):null}getWorkbook(n){return this.getUniverSheet(n)}getPermission(){return this._injector.createInstance(c.FPermission)}onUniverSheetCreated(n){const e=this._univerInstanceService.getTypeOfUnitAdded$(h.UniverInstanceType.UNIVER_SHEET).subscribe(t=>{const i=this._injector.createInstance(c.FWorkbook,t);n(i)});return h.toDisposable(e)}newDefinedName(){return this._injector.createInstance(x)}getActiveSheet(){const n=this.getActiveWorkbook();if(!n)return null;const e=n.getActiveSheet();return e?{workbook:n,worksheet:e}:null}setFreezeSync(n){this._injector.get(s.SheetsFreezeSyncController).setEnabled(n)}_fireActiveSheetChanged(n,e){this.fireEvent(this.Event.ActiveSheetChanged,{workbook:n,activeSheet:e})}_fireSheetDeleted(n,e){this.fireEvent(this.Event.SheetDeleted,{workbook:n,sheetId:e})}_fireSheetMoved(n,e,t){this.fireEvent(this.Event.SheetMoved,{workbook:n,worksheet:e,newIndex:t})}_fireSheetNameChanged(n,e,t){this.fireEvent(this.Event.SheetNameChanged,{workbook:n,worksheet:e,newName:t})}_fireSheetTabColorChanged(n,e,t){this.fireEvent(this.Event.SheetTabColorChanged,{workbook:n,worksheet:e,newColor:t})}_fireSheetHideChanged(n,e,t){this.fireEvent(this.Event.SheetHideChanged,{workbook:n,worksheet:e,hidden:t})}}f.FUniver.extend(Pe);class ne{get SheetValueChangeType(){return s.SheetValueChangeType}get SheetSkeletonChangeType(){return s.SheetSkeletonChangeType}get SplitDelimiterType(){return s.SplitDelimiterEnum}get UnitRole(){return D}get WorkbookPermissionPoint(){return _}get WorksheetPermissionPoint(){return w}get RangePermissionPoint(){return b}}f.FEnum.extend(ne);class ie{get SheetCreated(){return"SheetCreated"}get BeforeSheetCreate(){return"BeforeSheetCreate"}get WorkbookCreated(){return"WorkbookCreated"}get WorkbookDisposed(){return"WorkbookDisposed"}get GridlineChanged(){return"GridlineChanged"}get BeforeGridlineEnableChange(){return"BeforeGridlineEnableChange"}get BeforeGridlineColorChange(){return"BeforeGridlineColorChange"}get BeforeActiveSheetChange(){return"BeforeActiveSheetChange"}get ActiveSheetChanged(){return"ActiveSheetChanged"}get SheetDeleted(){return"SheetDeleted"}get BeforeSheetDelete(){return"BeforeSheetDelete"}get SheetMoved(){return"SheetMoved"}get BeforeSheetMove(){return"BeforeSheetMove"}get SheetNameChanged(){return"SheetNameChanged"}get BeforeSheetNameChange(){return"BeforeSheetNameChange"}get SheetTabColorChanged(){return"SheetTabColorChanged"}get BeforeSheetTabColorChange(){return"BeforeSheetTabColorChange"}get SheetHideChanged(){return"SheetHideChanged"}get BeforeSheetHideChange(){return"BeforeSheetHideChange"}get SheetValueChanged(){return"SheetValueChanged"}}f.FEventName.extend(ie);var Ue=Object.getOwnPropertyDescriptor,je=(r,n,e,t)=>{for(var i=t>1?void 0:t?Ue(n,e):n,o=r.length-1,a;o>=0;o--)(a=r[o])&&(i=a(i)||i);return i},De=(r,n)=>(e,t)=>n(e,t,r);c.FSheetHooks=class extends f.FBase{constructor(n){super(),this._injector=n}},c.FSheetHooks=je([De(0,h.Inject(h.Injector))],c.FSheetHooks),c.FSheetEventName=ie,c.FSheetsEnum=ne,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})}));
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
// @univerjs/sheets-numfmt/index
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
|
|
46
46
|
|
|
47
47
|
// @univerjs/sheets-formula/index
|
|
48
|
-
(function(P,c){typeof exports=="object"&&typeof module<"u"?c(exports,require("@univerjs/core"),require("@univerjs/sheets"),require("@univerjs/engine-formula"),require("rxjs"),require("@univerjs/rpc")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets","@univerjs/engine-formula","rxjs","@univerjs/rpc"],c):(P=typeof globalThis<"u"?globalThis:P||self,c(P.UniverSheetsFormula={},P.UniverCore,P.UniverSheets,P.UniverEngineFormula,P.rxjs,P.UniverRpc))})(this,(function(P,c,s,t,bt,it){"use strict";var _a=Object.defineProperty;var Da=(P,c,s)=>c in P?_a(P,c,{enumerable:!0,configurable:!0,writable:!0,value:s}):P[c]=s;var F=(P,c,s)=>Da(P,typeof c!="symbol"?c+"":c,s);const yt={id:"formula.command.insert-function",type:c.CommandType.COMMAND,handler:async(r,e)=>{const{list:a,listOfRangeHasNumber:n}=e,i=r.get(c.ICommandService),o=new c.ObjectMatrix;a.forEach(f=>{const{range:m,primary:l,formula:p}=f,{row:L,column:N}=l,T=c.generateRandomId(6);o.setValue(L,N,{f:p,si:T});const{startRow:S,startColumn:R,endRow:C,endColumn:d}=m;for(let A=S;A<=C;A++)for(let E=R;E<=d;E++)(A!==L||E!==N)&&o.setValue(A,E,{si:T})}),n&&n.length>0&&n.forEach(f=>{const{primary:m,formula:l}=f;o.setValue(m.row,m.column,{f:l})});const u={value:o.getData()};return i.executeCommand(s.SetRangeValuesCommand.id,u)}},xt={id:"sheets-formula.command.quick-sum",type:c.CommandType.COMMAND,handler:async r=>{const a=r.get(s.SheetsSelectionsService).getCurrentLastSelection();if(!a)return!1;const n=r.get(c.IUniverInstanceService),i=s.getSheetCommandTarget(n);if(!i)return!1;const o=a.range,{worksheet:u}=i;let f=s.findFirstNonEmptyCell(o,u);if(!f)return!1;f=s.alignToMergedCellsBorders(f,u);const m=s.expandToContinuousRange({startRow:f.startRow,startColumn:f.startColumn,endRow:o.endRow,endColumn:o.endColumn},{left:!0,right:!0,up:!0,down:!0},u),l=new c.ObjectMatrix,p=s.alignToMergedCellsBorders({startRow:m.endRow,endRow:m.endRow,startColumn:m.startColumn,endColumn:m.endColumn},u);if(!c.Rectangle.equals(p,m))for(const T of u.iterateByColumn(p))(!T.value||!u.cellHasValue(T.value))&&l.setValue(T.row,T.col,{f:`=SUM(${t.serializeRange({startColumn:T.col,endColumn:T.col,startRow:m.startRow,endRow:T.row-1})})`});const L=s.alignToMergedCellsBorders({startRow:m.startRow,startColumn:m.endColumn,endRow:m.endRow,endColumn:m.endColumn},u);if(!c.Rectangle.equals(L,m))for(const T of u.iterateByRow(L))(!T.value||!u.cellHasValue(T.value))&&l.setValue(T.row,T.col,{f:`=SUM(${t.serializeRange({startColumn:m.startColumn,endColumn:T.col-1,startRow:T.row,endRow:T.row})})`});const N=r.get(c.ICommandService);return(await c.sequenceExecuteAsync([{id:s.SetRangeValuesCommand.id,params:{range:m,value:l.getMatrix()}},{id:s.SetSelectionsOperation.id,params:{unitId:i.unitId,subUnitId:i.subUnitId,selections:[{range:m,primary:c.Rectangle.contains(m,a.primary)?a.primary:{...f,actualRow:f.startRow,actualColumn:f.startColumn},style:null}]}}],N)).result}},$="sheets-formula.base.config";var Y=(r=>(r[r.FORCED=0]="FORCED",r[r.WHEN_EMPTY=1]="WHEN_EMPTY",r[r.NO_CALCULATION=2]="NO_CALCULATION",r))(Y||{});const Ut={},Xt="sheets-formula.remote.config",qt={};var Wt=Object.getOwnPropertyDescriptor,gt=(r,e,a,n)=>{for(var i=n>1?void 0:n?Wt(e,a):e,o=r.length-1,u;o>=0;o--)(u=r[o])&&(i=u(i)||i);return i},Et=(r,e)=>(a,n)=>e(a,n,r);P.ImageFormulaCellInterceptorController=class extends c.Disposable{constructor(a,n,i){super();F(this,"_errorValueCell",{v:t.ErrorType.VALUE,t:c.CellValueType.STRING});F(this,"_refreshRender");this._commandService=a,this._sheetInterceptorService=n,this._formulaDataModel=i,this._initialize()}_initialize(){this._commandExecutedListener(),this._initInterceptorCellContent()}_commandExecutedListener(){this.disposeWithMe(this._commandService.onCommandExecuted(async a=>{if(a.id===t.SetImageFormulaDataMutation.id){const n=a.params;if(!n)return;const{imageFormulaData:i}=n;if(!i||i.length===0)return;const o=await Promise.all(i.map(f=>this._getImageNatureSize(f))),u={};o.forEach(f=>{const{unitId:m,sheetId:l,row:p,column:L,...N}=f;u[m]||(u[m]={}),u[m][l]||(u[m][l]=new c.ObjectMatrix),u[m][l].setValue(p,L,N)}),this._formulaDataModel.mergeUnitImageFormulaData(u),this._refreshRender()}}))}_initInterceptorCellContent(){this.disposeWithMe(this._sheetInterceptorService.intercept(s.INTERCEPTOR_POINT.CELL_CONTENT,{priority:s.InterceptCellContentPriority.CELL_IMAGE,effect:c.InterceptorEffectEnum.Value|c.InterceptorEffectEnum.Style,handler:(a,n,i)=>{var D,U;const{unitId:o,subUnitId:u,row:f,col:m}=n,l=this._formulaDataModel.getUnitImageFormulaData(),p=(U=(D=l==null?void 0:l[o])==null?void 0:D[u])==null?void 0:U.getValue(f,m);if(!p)return i(a);const{source:L,height:N,width:T,isErrorImage:S,imageNaturalWidth:R,imageNaturalHeight:C}=p;if(S)return i(this._errorValueCell);const d=T||R,A=N||C,E=c.createDocumentModelWithStyle("",{}),I={unitId:o,subUnitId:u,drawingId:c.generateRandomId(),drawingType:c.DrawingTypeEnum.DRAWING_IMAGE,imageSourceType:c.ImageSourceType.URL,source:L,transform:{left:0,top:0,width:d,height:A},docTransform:{size:{width:d,height:A},positionH:{relativeFrom:c.ObjectRelativeFromH.PAGE,posOffset:0},positionV:{relativeFrom:c.ObjectRelativeFromV.PARAGRAPH,posOffset:0},angle:0},behindDoc:c.BooleanNumber.FALSE,title:"",description:"",layoutType:c.PositionedObjectLayoutType.INLINE,wrapText:c.WrapTextType.BOTH_SIDES,distB:0,distL:0,distR:0,distT:0},O=c.BuildTextUtils.drawing.add({documentDataModel:E,drawings:[I],selection:{collapsed:!0,startOffset:0,endOffset:0}});return O?(E.apply(O),i({...a,p:E.getSnapshot()})):i(this._errorValueCell)}}))}async _getImageNatureSize(a){const n=await this._getImageSize(a.source);return n.image?{...a,isErrorImage:!1,imageNaturalHeight:n.height,imageNaturalWidth:n.width}:{...a,isErrorImage:!0}}async _getImageSize(a){return new Promise(n=>{const i=new Image;i.src=a,i.onload=()=>{n({width:i.width,height:i.height,image:i})},i.onerror=()=>{n({width:0,height:0,image:null})}})}registerRefreshRenderFunction(a){this._refreshRender=a}},P.ImageFormulaCellInterceptorController=gt([Et(0,c.ICommandService),Et(1,c.Inject(s.SheetInterceptorService)),Et(2,c.Inject(t.FormulaDataModel))],P.ImageFormulaCellInterceptorController);var Kt=Object.getOwnPropertyDescriptor,kt=(r,e,a,n)=>{for(var i=n>1?void 0:n?Kt(e,a):e,o=r.length-1,u;o>=0;o--)(u=r[o])&&(i=u(i)||i);return i},W=(r,e)=>(a,n)=>e(a,n,r);const ht={done:0,count:0},It={onlyLocal:!0};P.TriggerCalculationController=class extends c.Disposable{constructor(a,n,i,o,u,f,m){super();F(this,"_waitingCommandQueue",[]);F(this,"_executingDirtyData",{forceCalculation:!1,dirtyRanges:[],dirtyNameMap:{},dirtyDefinedNameMap:{},dirtyUnitFeatureMap:{},dirtyUnitOtherFormulaMap:{},clearDependencyTreeCache:{}});F(this,"_setTimeoutKey",-1);F(this,"_startExecutionTime",0);F(this,"_totalCalculationTaskCount",0);F(this,"_doneCalculationTaskCount",0);F(this,"_executionInProgressParams",null);F(this,"_restartCalculation",!1);F(this,"_progress$",new bt.BehaviorSubject(ht));F(this,"progress$",this._progress$.asObservable());this._commandService=a,this._activeDirtyManagerService=n,this._logService=i,this._configService=o,this._formulaDataModel=u,this._localeService=f,this._registerOtherFormulaService=m,this._commandExecutedListener(),this._initialExecuteFormulaProcessListener(),this._initialExecuteFormula()}_emitProgress(a){this._progress$.next({done:this._doneCalculationTaskCount,count:this._totalCalculationTaskCount,label:a})}_startProgress(){this._doneCalculationTaskCount=0,this._totalCalculationTaskCount=1;const a=this._localeService.t("formula.progress.analyzing");this._emitProgress(a)}_calculateProgress(a){if(this._executionInProgressParams){const{totalFormulasToCalculate:n,completedFormulasCount:i,totalArrayFormulasToCalculate:o,completedArrayFormulasCount:u}=this._executionInProgressParams;if(this._doneCalculationTaskCount=i+u,this._totalCalculationTaskCount=n+o,this._totalCalculationTaskCount===0)return;this._emitProgress(a)}}_completeProgress(){this._doneCalculationTaskCount=this._totalCalculationTaskCount=1;const a=this._localeService.t("formula.progress.done");this._emitProgress(a)}clearProgress(){this._doneCalculationTaskCount=0,this._totalCalculationTaskCount=0,this._emitProgress()}dispose(){super.dispose(),this._progress$.next(ht),this._progress$.complete(),clearTimeout(this._setTimeoutKey)}_getCalculationMode(){var n;const a=this._configService.getConfig($);return(n=a==null?void 0:a.initialFormulaComputing)!=null?n:Y.WHEN_EMPTY}_commandExecutedListener(){this.disposeWithMe(this._commandService.beforeCommandExecuted(a=>{if(a.id===t.SetFormulaCalculationStartMutation.id||a.id===t.SetFormulaStringBatchCalculationMutation.id){const n=a.params;if(a.id===t.SetFormulaCalculationStartMutation.id){const i=this._configService.getConfig(t.ENGINE_FORMULA_RETURN_DEPENDENCY_TREE)||!1;n.isCalculateTreeModel=i}n.maxIteration=this._configService.getConfig(t.ENGINE_FORMULA_CYCLE_REFERENCE_COUNT),n.rowData=this._formulaDataModel.getHiddenRowsFiltered()}})),this.disposeWithMe(this._commandService.onCommandExecuted((a,n)=>{if(this._activeDirtyManagerService.get(a.id)){if(a.id===s.SetRangeValuesMutation.id){const i=a.params;if(n&&n.onlyLocal===!0||i.trigger===s.SetStyleCommand.id||i.trigger===s.SetBorderCommand.id||i.trigger===s.ClearSelectionFormatCommand.id)return}this._waitingCommandQueue.push(a),clearTimeout(this._setTimeoutKey),this._setTimeoutKey=setTimeout(()=>{const i=this._generateDirty(this._waitingCommandQueue);this._executingDirtyData=this._mergeDirty(this._executingDirtyData,i),this._executionInProgressParams==null?this._commandService.executeCommand(t.SetFormulaCalculationStartMutation.id,{...this._executingDirtyData},It):(this._restartCalculation=!0,this._commandService.executeCommand(t.SetFormulaCalculationStopMutation.id,{})),this._waitingCommandQueue=[]},100)}}))}_generateDirty(a){const n=[],i={},o={},u={},f={},m={};let l=!1;for(const p of a){const L=this._activeDirtyManagerService.get(p.id);if(L==null)continue;const N=L.getDirtyData(p),{dirtyRanges:T,dirtyNameMap:S,dirtyDefinedNameMap:R,dirtyUnitFeatureMap:C,dirtyUnitOtherFormulaMap:d,clearDependencyTreeCache:A,forceCalculation:E=!1}=N;T!=null&&this._mergeDirtyRanges(n,T),S!=null&&this._mergeDirtyNameMap(i,S),R!=null&&this._mergeDirtyNameMap(o,R),C!=null&&this._mergeDirtyUnitFeatureOrOtherFormulaMap(u,C),d!=null&&this._mergeDirtyUnitFeatureOrOtherFormulaMap(f,d),A!=null&&this._mergeDirtyNameMap(m,A),l=l||E}return{dirtyRanges:n,dirtyNameMap:i,dirtyDefinedNameMap:o,dirtyUnitFeatureMap:u,dirtyUnitOtherFormulaMap:f,forceCalculation:l,clearDependencyTreeCache:m}}_mergeDirty(a,n){const i=[...a.dirtyRanges,...n.dirtyRanges],o={...a.dirtyNameMap},u={...a.dirtyDefinedNameMap},f={...a.dirtyUnitFeatureMap},m={...a.dirtyUnitOtherFormulaMap},l={...a.clearDependencyTreeCache};this._mergeDirtyNameMap(o,n.dirtyNameMap),this._mergeDirtyNameMap(u,n.dirtyDefinedNameMap),this._mergeDirtyUnitFeatureOrOtherFormulaMap(f,n.dirtyUnitFeatureMap),this._mergeDirtyUnitFeatureOrOtherFormulaMap(m,n.dirtyUnitOtherFormulaMap),this._mergeDirtyNameMap(l,n.clearDependencyTreeCache);const p=a.forceCalculation||n.forceCalculation;return{dirtyRanges:i,dirtyNameMap:o,dirtyDefinedNameMap:u,dirtyUnitFeatureMap:f,dirtyUnitOtherFormulaMap:m,forceCalculation:p,clearDependencyTreeCache:l}}_mergeDirtyRanges(a,n){for(const i of n){let o=!1;for(const u of a)if(i.unitId===u.unitId&&i.sheetId===u.sheetId){const{startRow:f,startColumn:m,endRow:l,endColumn:p}=i.range,{startRow:L,startColumn:N,endRow:T,endColumn:S}=u.range;if(f===L&&m===N&&l===T&&p===S){o=!0;break}}o||a.push(i)}}_mergeDirtyNameMap(a,n){Object.keys(n).forEach(i=>{a[i]==null&&(a[i]={}),Object.keys(n[i]).forEach(o=>{var u;(u=n[i])!=null&&u[o]&&(a[i][o]=n[i][o])})})}_mergeDirtyUnitFeatureOrOtherFormulaMap(a,n){Object.keys(n).forEach(i=>{a[i]==null&&(a[i]={}),Object.keys(n[i]).forEach(o=>{a[i][o]==null&&(a[i][o]={}),Object.keys(n[i][o]).forEach(u=>{a[i][o][u]=n[i][o][u]||!1})})})}_initialExecuteFormulaProcessListener(){let a=null,n=0;this.disposeWithMe(this._commandService.onCommandExecuted(i=>{if(i.id===t.SetFormulaCalculationStopMutation.id&&this.clearProgress(),i.id!==t.SetFormulaCalculationNotificationMutation.id)return;const o=i.params;if(o.stageInfo!=null){const{stage:u}=o.stageInfo;if(u===t.FormulaExecuteStageType.START)n===0&&(this._startExecutionTime=performance.now()),n++,a!==null&&(clearTimeout(a),a=null),a=setTimeout(()=>{a=null,this._startProgress()},1e3);else if(u===t.FormulaExecuteStageType.CURRENTLY_CALCULATING){if(this._executionInProgressParams=o.stageInfo,a===null){const f=this._localeService.t("formula.progress.calculating");this._calculateProgress(f)}}else if(u===t.FormulaExecuteStageType.START_DEPENDENCY_ARRAY_FORMULA){if(this._executionInProgressParams=o.stageInfo,a===null){const f=this._localeService.t("formula.progress.array-analysis");this._calculateProgress(f)}}else if(u===t.FormulaExecuteStageType.CURRENTLY_CALCULATING_ARRAY_FORMULA&&(this._executionInProgressParams=o.stageInfo,a===null)){const f=this._localeService.t("formula.progress.array-calculation");this._calculateProgress(f)}}else{const u=o.functionsExecutedState;let f="";switch(n--,u){case t.FormulaExecutedStateType.NOT_EXECUTED:f="No tasks are being executed anymore",this._resetExecutingDirtyData();break;case t.FormulaExecutedStateType.STOP_EXECUTION:f="The execution of the formula has been stopped",n=0;break;case t.FormulaExecutedStateType.SUCCESS:f="Formula calculation succeeded",(n===0||n===-1)&&(f+=`. Total time consumed: ${performance.now()-this._startExecutionTime} ms`),this._resetExecutingDirtyData();break;case t.FormulaExecutedStateType.INITIAL:f="Waiting for calculation",this._resetExecutingDirtyData();break}(n===0||n===-1)&&(a?(clearTimeout(a),a=null,this.clearProgress()):this._completeProgress(),n=0,this._doneCalculationTaskCount=0,this._totalCalculationTaskCount=0),u===t.FormulaExecutedStateType.STOP_EXECUTION&&this._restartCalculation?(this._restartCalculation=!1,this._commandService.executeCommand(t.SetFormulaCalculationStartMutation.id,{...this._executingDirtyData},It)):this._executionInProgressParams=null,this._logService.debug("[TriggerCalculationController]",f)}}))}_resetExecutingDirtyData(){this._executingDirtyData={dirtyRanges:[],dirtyNameMap:{},dirtyDefinedNameMap:{},dirtyUnitFeatureMap:{},dirtyUnitOtherFormulaMap:{},forceCalculation:!1,clearDependencyTreeCache:{}}}_initialExecuteFormula(){const a=this._getCalculationMode(),n=this._getDirtyDataByCalculationMode(a);this._commandService.executeCommand(t.SetTriggerFormulaCalculationStartMutation.id,n,It),this._registerOtherFormulaService.calculateStarted$.next(!0)}_getDirtyDataByCalculationMode(a){const n=a===Y.FORCED,i=a===Y.WHEN_EMPTY?this._formulaDataModel.getFormulaDirtyRanges():[];return{forceCalculation:n,dirtyRanges:i,dirtyNameMap:{},dirtyDefinedNameMap:{},dirtyUnitFeatureMap:{},dirtyUnitOtherFormulaMap:{},clearDependencyTreeCache:{}}}},P.TriggerCalculationController=kt([W(0,c.ICommandService),W(1,t.IActiveDirtyManagerService),W(2,c.ILogService),W(3,c.IConfigService),W(4,c.Inject(t.FormulaDataModel)),W(5,c.Inject(c.LocaleService)),W(6,c.Inject(t.RegisterOtherFormulaService))],P.TriggerCalculationController);function Qt(r,e,a){var n;return r==null||r[e]==null||((n=r[e])==null?void 0:n[a])==null}function At(r,e,a){var n;if(a){if(r&&r[e]&&((n=r[e])!=null&&n[a]))return delete r[e][a],{[e]:{[a]:null}}}else if(r&&r[e])return delete r[e],{[e]:null}}var b=(r=>(r[r.MoveRange=0]="MoveRange",r[r.MoveRows=1]="MoveRows",r[r.MoveCols=2]="MoveCols",r[r.InsertRow=3]="InsertRow",r[r.InsertColumn=4]="InsertColumn",r[r.RemoveRow=5]="RemoveRow",r[r.RemoveColumn=6]="RemoveColumn",r[r.DeleteMoveLeft=7]="DeleteMoveLeft",r[r.DeleteMoveUp=8]="DeleteMoveUp",r[r.InsertMoveDown=9]="InsertMoveDown",r[r.InsertMoveRight=10]="InsertMoveRight",r[r.SetName=11]="SetName",r[r.RemoveSheet=12]="RemoveSheet",r[r.SetDefinedName=13]="SetDefinedName",r[r.RemoveDefinedName=14]="RemoveDefinedName",r))(b||{});const jt=[11,12,13,14];function $t(r,e,a){const{type:n}=a;return jt.includes(n)?zt(r,e):Zt(r,e,a)}function zt(r,e){const a=[],n=[];return Object.keys(e).forEach(i=>{const o=e[i],u=r[i];if(o==null||u==null)return!0;Object.keys(o).forEach(f=>{const m=new c.ObjectMatrix(o[f]||{}),l=new c.ObjectMatrix(u[f]||{}),p=new c.ObjectMatrix,L=new c.ObjectMatrix;if(m.forValue((C,d,A)=>{if(A==null)return!0;const E=tt(A);E!==null&&(p.setValue(C,d,E),L.setValue(C,d,l.getValue(C,d)))}),p.getSizeOf()===0)return;const N={subUnitId:f,unitId:i,cellValue:p.getMatrix()},T={id:s.SetRangeValuesMutation.id,params:N};n.push(T);const S={subUnitId:f,unitId:i,cellValue:L.getMatrix()},R={id:s.SetRangeValuesMutation.id,params:S};a.push(R)})}),{undos:a,redos:n}}function Zt(r,e,a){const{redoFormulaData:n,undoFormulaData:i}=Jt(r,e,a),o=[],u=[];return Object.keys(n).forEach(f=>{Object.keys(n[f]).forEach(m=>{if(Object.keys(n[f][m]).length!==0){const l={subUnitId:m,unitId:f,cellValue:n[f][m]},p={id:s.SetRangeValuesMutation.id,params:l};o.push(p)}})}),Object.keys(i).forEach(f=>{Object.keys(i[f]).forEach(m=>{if(Object.keys(i[f][m]).length!==0){const l={subUnitId:m,unitId:f,cellValue:i[f][m]},p={id:s.SetRangeValuesMutation.id,params:l};u.push(p)}})}),{undos:u,redos:o}}function Jt(r,e,a){const n={},i={},{unitId:o,sheetId:u}=a;return new Set([...Object.keys(r),...Object.keys(e)]).forEach(m=>{if(Qt(r,m,u))return;new Set([...Object.keys(r[m]||{}),...Object.keys(e[m]||{})]).forEach(p=>{var A,E;const L=(A=r[m])==null?void 0:A[p],N=(E=e[m])==null?void 0:E[p],T=new c.ObjectMatrix(L||{}),S=new c.ObjectMatrix(N||{});let R=[];m!==o||p!==u?R=ee(S):R=te(T,S,a);const C=Le(R,T,S),d=Te(R,T);n[m]||(n[m]={}),i[m]||(i[m]={}),n[m][p]={...n[m][p],...C},i[m][p]={...i[m][p],...d}})}),{redoFormulaData:n,undoFormulaData:i}}function te(r,e,a){const{type:n,from:i,to:o,range:u}=a,f=[];return r.forValue((m,l,p)=>{if(p==null||!Ft(p))return!0;const L=c.cellToRange(m,l);let N=null,T=!1;if([0,1,2].includes(n))N=ae(n,i,o,L);else if(u!=null){const S=ne(L,a);N=S.newCell,T=S.isReverse}if(c.Tools.diffValue(L,N)&&!e.getValue(m,l))return!0;T?f.unshift({oldCell:L,newCell:N}):f.push({oldCell:L,newCell:N})}),f}function ee(r){const e=[];return r.forValue((a,n,i)=>{if(i==null||!Ft(i))return!0;const o=c.cellToRange(a,n);e.push({oldCell:o,newCell:o})}),e}function ae(r,e,a,n){if(e==null||a==null)return null;switch(r){case 0:return ie(e,a,n);case 1:return re(e,a,n);case 2:return oe(e,a,n);default:return null}}function ne(r,e){const{type:a,rangeFilteredRows:n}=e,i=e.range;let o=null,u=!1;switch(a){case 3:o=ue(i,r),u=!0;break;case 4:o=ce(i,r),u=!0;break;case 5:o=fe(i,r,n);break;case 6:o=me(i,r);break;case 7:o=se(i,r);break;case 8:o=le(i,r);break;case 9:o=pe(i,r),u=!0;break;case 10:o=de(i,r),u=!0;break}return{newCell:o,isReverse:u}}function ie(r,e,a){const n=s.handleMoveRange({id:s.EffectRefRangId.MoveRangeCommandId,params:{toRange:e,fromRange:r}},a);return s.runRefRangeMutations(n,a)}function re(r,e,a){const n=s.handleMoveRows({id:s.EffectRefRangId.MoveRowsCommandId,params:{toRange:e,fromRange:r}},a);return s.runRefRangeMutations(n,a)}function oe(r,e,a){const n=s.handleMoveCols({id:s.EffectRefRangId.MoveColsCommandId,params:{toRange:e,fromRange:r}},a);return s.runRefRangeMutations(n,a)}function ue(r,e){const a=s.handleInsertRow({id:s.EffectRefRangId.InsertRowCommandId,params:{range:r,unitId:"",subUnitId:"",direction:c.Direction.DOWN}},e);return s.runRefRangeMutations(a,e)}function ce(r,e){const a=s.handleInsertCol({id:s.EffectRefRangId.InsertColCommandId,params:{range:r,unitId:"",subUnitId:"",direction:c.Direction.RIGHT}},e);return s.runRefRangeMutations(a,e)}function fe(r,e,a){const n=s.handleIRemoveRow({id:s.EffectRefRangId.RemoveRowCommandId,params:{range:r}},e,a);return s.runRefRangeMutations(n,e)}function me(r,e){const a=s.handleIRemoveCol({id:s.EffectRefRangId.RemoveColCommandId,params:{range:r}},e);return s.runRefRangeMutations(a,e)}function se(r,e){const a=s.handleDeleteRangeMoveLeft({id:s.EffectRefRangId.DeleteRangeMoveLeftCommandId,params:{range:r}},e);return s.runRefRangeMutations(a,e)}function le(r,e){const a=s.handleDeleteRangeMoveUp({id:s.EffectRefRangId.DeleteRangeMoveUpCommandId,params:{range:r}},e);return s.runRefRangeMutations(a,e)}function pe(r,e){const a=s.handleInsertRangeMoveDown({id:s.EffectRefRangId.InsertRangeMoveDownCommandId,params:{range:r}},e);return s.runRefRangeMutations(a,e)}function de(r,e){const a=s.handleInsertRangeMoveRight({id:s.EffectRefRangId.InsertRangeMoveRightCommandId,params:{range:r}},e);return s.runRefRangeMutations(a,e)}function Le(r,e,a){var i,o,u;const n=new c.ObjectMatrix({});for(let f=0;f<r.length;f++){const{oldCell:m,newCell:l}=r[f];if((i=n.getValue(m.startRow,m.startColumn))!=null&&i.f||(o=n.getValue(m.startRow,m.startColumn))!=null&&o.si||n.setValue(m.startRow,m.startColumn,{f:null,si:null}),l){const p=(u=a.getValue(m.startRow,m.startColumn))!=null?u:e.getValue(m.startRow,m.startColumn),L=tt(p);n.setValue(l.startRow,l.startColumn,L)}}return n.getMatrix()}function Te(r,e){const a=new c.ObjectMatrix({});for(let n=r.length-1;n>=0;n--){const{oldCell:i,newCell:o}=r[n],u=e.getValue(i.startRow,i.startColumn),f=tt(u);if(a.setValue(i.startRow,i.startColumn,f),o){const m=e.getValue(o.startRow,o.startColumn),l=tt(m);a.setValue(o.startRow,o.startColumn,l!=null?l:{f:null,si:null})}}return a.getMatrix()}function tt(r){if(r==null)return null;const{f:e,si:a,x:n=0,y:i=0}=r,o=c.isFormulaString(e),u=c.isFormulaId(a);if(!o&&!u)return{f:null,si:null};const f={};return u&&(f.si=a),o&&n===0&&i===0&&(f.f=e),f.f===void 0&&(f.f=null),f.si===void 0&&(f.si=null),f}function Ne(r){const e=new c.ObjectMatrix({});return new c.ObjectMatrix(r).forValue((n,i,o)=>{const u=tt(o);u!==void 0&&e.setValue(n,i,u)}),e.getMatrix()}function Ft(r){const e=(r==null?void 0:r.f)||"",a=(r==null?void 0:r.si)||"",n=c.isFormulaString(e),i=c.isFormulaId(a);return!!(n||i)}function Bt(r,e,a,n,i,o){if((i==null||i.length===0)&&(o==null||o.length===0)){if(r===a&&e===n)return!0}else if((r===i||i==null||i.length===0)&&e===o)return!0;return!1}function vt(r,e,a=0,n=0){const i=[];for(let o=0,u=r.length;o<u;o++){const f=r[o];if(typeof f=="string"||f.nodeType!==t.sequenceNodeType.REFERENCE||e.includes(o)){i.push(f);continue}const{token:m}=f,l=t.deserializeRangeWithSheetWithCache(m),{range:p,sheetName:L,unitId:N}=l,T=c.Rectangle.moveOffset(p,a,n);i.push({...f,token:t.serializeRangeToRefString({range:T,unitId:N,sheetName:L})})}return i}function Vt(r,e,a,n){const{type:i,unitId:o,sheetId:u,range:f,from:m,to:l,rangeFilteredRows:p}=e,{range:L,sheetId:N,unitId:T,sheetName:S,refOffsetX:R,refOffsetY:C}=r;if(!Bt(o,u,a,n,T,N))return;const d=c.Rectangle.moveOffset(L,R,C);let A=null;if(i===b.MoveRange){if(m==null||l==null)return;const E=Ct(d,m),I=c.getIntersectRange(d,m);if(I==null||E!==4)return;const O=s.handleMoveRange({id:s.EffectRefRangId.MoveRangeCommandId,params:{toRange:l,fromRange:m}},I),D=s.runRefRangeMutations(O,I);if(D==null)return t.ErrorType.REF;A=St(E,D,m,l,d,I)}else if(i===b.MoveRows){if(m==null||l==null)return;const E=Ct(d,m);let I=c.getIntersectRange(d,m);if(I==null&&(m.endRow<d.startRow&&l.endRow<=d.startRow||m.startRow>d.endRow&&l.startRow>d.endRow))return;I==null&&(I={startRow:d.startRow,endRow:d.endRow,startColumn:d.startColumn,endColumn:d.endColumn,rangeType:c.RANGE_TYPE.NORMAL});const O=s.handleMoveRows({id:s.EffectRefRangId.MoveRowsCommandId,params:{toRange:l,fromRange:m}},I),D=s.runRefRangeMutations(O,I);if(D==null)return t.ErrorType.REF;A=St(E,D,m,l,d,I)}else if(i===b.MoveCols){if(m==null||l==null)return;const E=Ct(d,m);let I=c.getIntersectRange(d,m);if(I==null&&(m.endColumn<d.startColumn&&l.endColumn<=d.startColumn||m.startColumn>d.endColumn&&l.startColumn>d.endColumn))return;I==null&&(I={startRow:d.startRow,endRow:d.endRow,startColumn:d.startColumn,endColumn:d.endColumn,rangeType:c.RANGE_TYPE.NORMAL});const O=s.handleMoveCols({id:s.EffectRefRangId.MoveColsCommandId,params:{toRange:l,fromRange:m}},I),D=s.runRefRangeMutations(O,I);if(D==null)return t.ErrorType.REF;A=St(E,D,m,l,d,I)}if(f!=null){if(i===b.InsertRow){const E=s.handleInsertRow({id:s.EffectRefRangId.InsertRowCommandId,params:{range:f,unitId:"",subUnitId:"",direction:c.Direction.DOWN}},d),I=s.runRefRangeMutations(E,d);if(I==null)return;A={...d,...I}}else if(i===b.InsertColumn){const E=s.handleInsertCol({id:s.EffectRefRangId.InsertColCommandId,params:{range:f,unitId:"",subUnitId:"",direction:c.Direction.RIGHT}},d),I=s.runRefRangeMutations(E,d);if(I==null)return;A={...d,...I}}else if(i===b.RemoveRow){const E=s.handleIRemoveRow({id:s.EffectRefRangId.RemoveRowCommandId,params:{range:f}},d,p),I=s.runRefRangeMutations(E,d);if(I==null)return t.ErrorType.REF;A={...d,...I}}else if(i===b.RemoveColumn){const E=s.handleIRemoveCol({id:s.EffectRefRangId.RemoveColCommandId,params:{range:f}},d),I=s.runRefRangeMutations(E,d);if(I==null)return t.ErrorType.REF;A={...d,...I}}else if(i===b.DeleteMoveLeft){const E=s.handleDeleteRangeMoveLeft({id:s.EffectRefRangId.DeleteRangeMoveLeftCommandId,params:{range:f}},d),I=s.runRefRangeMutations(E,d);if(I==null)return t.ErrorType.REF;A={...d,...I}}else if(i===b.DeleteMoveUp){const E=s.handleDeleteRangeMoveUp({id:s.EffectRefRangId.DeleteRangeMoveUpCommandId,params:{range:f}},d),I=s.runRefRangeMutations(E,d);if(I==null)return t.ErrorType.REF;A={...d,...I}}else if(i===b.InsertMoveDown){const E=s.handleInsertRangeMoveDown({id:s.EffectRefRangId.InsertRangeMoveDownCommandId,params:{range:f}},d),I=s.runRefRangeMutations(E,d);if(I==null)return;A={...d,...I}}else if(i===b.InsertMoveRight){const E=s.handleInsertRangeMoveRight({id:s.EffectRefRangId.InsertRangeMoveRightCommandId,params:{range:f}},d),I=s.runRefRangeMutations(E,d);if(I==null)return;A={...d,...I}}}if(A!=null)return t.serializeRangeToRefString({range:A,sheetName:S,unitId:T})}function St(r,e,a,n,i,o){const{startRow:u,endRow:f,startColumn:m,endColumn:l,rangeType:p}=et(e),{startRow:L,startColumn:N,endRow:T,endColumn:S,rangeType:R=c.RANGE_TYPE.NORMAL}=et(a),{startRow:C,startColumn:d,endRow:A,endColumn:E}=et(n),{startRow:I,endRow:O,startColumn:D,endColumn:U}=et(o),{startRow:_,endRow:x,startColumn:y,endColumn:q,rangeType:h=c.RANGE_TYPE.NORMAL}=et(i),M={...i};function B(){return p===c.RANGE_TYPE.COLUMN&&h===c.RANGE_TYPE.COLUMN?!0:m>=y&&l<=q}function K(){return p===c.RANGE_TYPE.ROW&&h===c.RANGE_TYPE.ROW?!0:u>=_&&f<=x}if(r===0)if(B())if(u<_)M.startRow=u;else if(u>=x)M.endRow-=T+1-_;else return;else return;else if(r===1)if(B())if(f>x)M.endRow=f;else if(f<=_)M.startRow+=x-L+1;else return;else return;else if(r===2)if(K())if(m<y)M.startColumn=m;else if(m>=q)M.endColumn-=S+1-y;else return;else return;else if(r===3)if(K())if(l>q)M.endColumn=l;else if(l<=y)M.startColumn+=q-N+1;else return;else return;else r===4?(M.startRow=u,M.startColumn=m,M.endRow=f,M.endColumn=l):N<=y&&S>=q||R===c.RANGE_TYPE.ROW&&h===c.RANGE_TYPE.ROW?a.endRow<_?(C>=_&&(M.startRow-=T-L+1),C>=x&&(M.endRow-=T-L+1)):a.startRow>x?(A<=x&&(M.endRow+=T-L+1),A<=_&&(M.startRow+=T-L+1)):a.startRow>=_&&a.endRow<=x&&(C<=_?M.startRow+=T-L+1:C>=x&&(M.endRow-=T-L+1)):L<=_&&T>=x||R===c.RANGE_TYPE.COLUMN&&h===c.RANGE_TYPE.COLUMN?a.endColumn<y?(d>=y&&(M.startColumn-=S-N+1),d>=q&&(M.endColumn-=S-N+1)):a.startColumn>q?(E<=q&&(M.endColumn+=S-N+1),E<=y&&(M.startColumn+=S-N+1)):a.startColumn>=y&&a.endColumn<=q&&(d<=y?M.startColumn+=S-N+1:d>=q&&(M.endColumn-=S-N+1)):((d<=U+1&&E>=q||d<=y&&E>=D-1)&&C<=_&&A>=x||(C<=O+1&&A>=x||C<=_&&A>=I-1)&&d<=y&&E>=q,M.startRow=u,M.startColumn=m,M.endRow=f,M.endColumn=l);return M}function Ct(r,e){const a=z(r.startRow),n=Z(r.endRow),i=z(r.startColumn),o=Z(r.endColumn),u=z(e.startRow),f=Z(e.endRow),m=z(e.startColumn),l=Z(e.endColumn);function p(){return r.rangeType===c.RANGE_TYPE.COLUMN&&e.rangeType===c.RANGE_TYPE.COLUMN?!0:a>=u&&n<=f}function L(){return r.rangeType===c.RANGE_TYPE.ROW&&e.rangeType===c.RANGE_TYPE.ROW?!0:i>=m&&o<=l}function N(){return r.rangeType===c.RANGE_TYPE.ALL&&e.rangeType===c.RANGE_TYPE.ALL}return p()&&L()||N()?4:L()&&a>=u&&a<=f&&n>f?0:L()&&n>=u&&n<=f&&a<u?1:p()&&i>=m&&i<=l&&o>l?2:p()&&o>=m&&o<=l&&i<m?3:null}function z(r){return isNaN(r)?-1/0:r}function Z(r){return isNaN(r)?1/0:r}function et(r){const{startRow:e,endRow:a,startColumn:n,endColumn:i}=r;return{...r,startRow:z(e),endRow:Z(a),startColumn:z(n),endColumn:Z(i)}}function Gt(r,e){const{id:a}=e;let n=null;switch(a){case s.MoveRangeCommand.id:n=Pe(e,r);break;case s.MoveRowsCommand.id:n=Ee(e,r);break;case s.MoveColsCommand.id:n=Ie(e,r);break;case s.InsertRowCommand.id:n=Ae(e);break;case s.InsertColCommand.id:n=Se(e);break;case s.InsertRangeMoveRightCommand.id:n=Ce(e,r);break;case s.InsertRangeMoveDownCommand.id:n=Re(e,r);break;case s.RemoveRowCommand.id:n=Oe(e,r);break;case s.RemoveColCommand.id:n=Me(e,r);break;case s.DeleteRangeMoveUpCommand.id:n=_e(e,r);break;case s.DeleteRangeMoveLeftCommand.id:n=De(e,r);break;case s.SetWorksheetNameCommand.id:n=be(e,r);break;case s.RemoveSheetCommand.id:n=ye(e,r);break;case s.SetDefinedNameCommand.id:n=xe(e,r);break;case s.RemoveDefinedNameCommand.id:n=Ue(e,r);break}return n}function v(r){var n;const e=r.getUnitId(),a=((n=r.getActiveSheet())==null?void 0:n.getSheetId())||"";return{unitId:e,sheetId:a}}function Pe(r,e){const{params:a}=r;if(!a)return null;const{fromRange:n,toRange:i}=a;if(!n||!i)return null;const{unitId:o,sheetId:u}=v(e);return{type:b.MoveRange,from:n,to:i,unitId:o,sheetId:u}}function Ee(r,e){const{params:a}=r;if(!a)return null;const{fromRange:{startRow:n,endRow:i},toRange:{startRow:o,endRow:u}}=a,f=e.getUnitId(),m=e.getActiveSheet();if(!m)return null;const l=m.getSheetId(),p={startRow:n,startColumn:0,endRow:i,endColumn:m.getColumnCount()-1,rangeType:c.RANGE_TYPE.ROW},L={startRow:o,startColumn:0,endRow:u,endColumn:m.getColumnCount()-1,rangeType:c.RANGE_TYPE.ROW};return{type:b.MoveRows,from:p,to:L,unitId:f,sheetId:l}}function Ie(r,e){const{params:a}=r;if(!a)return null;const{fromRange:{startColumn:n,endColumn:i},toRange:{startColumn:o,endColumn:u}}=a,f=e.getUnitId(),m=e.getActiveSheet();if(!m)return null;const l=m.getSheetId(),p={startRow:0,startColumn:n,endRow:m.getRowCount()-1,endColumn:i,rangeType:c.RANGE_TYPE.COLUMN},L={startRow:0,startColumn:o,endRow:m.getRowCount()-1,endColumn:u,rangeType:c.RANGE_TYPE.COLUMN};return{type:b.MoveCols,from:p,to:L,unitId:f,sheetId:l}}function Ae(r){const{params:e}=r;if(!e)return null;const{range:a,unitId:n,subUnitId:i}=e;return{type:b.InsertRow,range:a,unitId:n,sheetId:i}}function Se(r){const{params:e}=r;if(!e)return null;const{range:a,unitId:n,subUnitId:i}=e;return{type:b.InsertColumn,range:a,unitId:n,sheetId:i}}function Ce(r,e){const{params:a}=r;if(!a)return null;const{range:n}=a,{unitId:i,sheetId:o}=v(e);return{type:b.InsertMoveRight,range:n,unitId:i,sheetId:o}}function Re(r,e){const{params:a}=r;if(!a)return null;const{range:n}=a,{unitId:i,sheetId:o}=v(e);return{type:b.InsertMoveDown,range:n,unitId:i,sheetId:o}}function Oe(r,e){var u,f;const{params:a}=r;if(!a)return null;const{range:n}=a,{unitId:i,sheetId:o}=v(e);return{type:b.RemoveRow,range:n,unitId:i,sheetId:o,rangeFilteredRows:(f=(u=e.getSheetBySheetId(o))==null?void 0:u.getRangeFilterRows(n))!=null?f:[]}}function Me(r,e){const{params:a}=r;if(!a)return null;const{range:n}=a,{unitId:i,sheetId:o}=v(e);return{type:b.RemoveColumn,range:n,unitId:i,sheetId:o}}function _e(r,e){const{params:a}=r;if(!a)return null;const{range:n}=a,{unitId:i,sheetId:o}=v(e);return{type:b.DeleteMoveUp,range:n,unitId:i,sheetId:o}}function De(r,e){const{params:a}=r;if(!a)return null;const{range:n}=a,{unitId:i,sheetId:o}=v(e);return{type:b.DeleteMoveLeft,range:n,unitId:i,sheetId:o}}function be(r,e){const{params:a}=r;if(!a)return null;const{unitId:n,subUnitId:i,name:o}=a,{unitId:u,sheetId:f}=v(e);return{type:b.SetName,unitId:n||u,sheetId:i||f,sheetName:o}}function ye(r,e){const{params:a}=r;if(!a)return null;const{unitId:n,subUnitId:i}=a,{unitId:o,sheetId:u}=v(e);return{type:b.RemoveSheet,unitId:n||o,sheetId:i||u}}function xe(r,e){const{params:a}=r;if(!a)return null;const{unitId:n,name:i,id:o}=a,{sheetId:u}=v(e);return{type:b.SetDefinedName,unitId:n,sheetId:u,definedName:i,definedNameId:o}}function Ue(r,e){const{params:a}=r;if(!a)return null;const{unitId:n,name:i,id:o}=a,{sheetId:u}=v(e);return{type:b.RemoveDefinedName,unitId:n,sheetId:u,definedName:i,definedNameId:o}}var qe=Object.getOwnPropertyDescriptor,he=(r,e,a,n)=>{for(var i=n>1?void 0:n?qe(e,a):e,o=r.length-1,u;o>=0;o--)(u=r[o])&&(i=u(i)||i);return i},rt=(r,e)=>(a,n)=>e(a,n,r);P.UpdateDefinedNameController=class extends c.Disposable{constructor(e,a,n,i){super(),this._definedNamesService=e,this._univerInstanceService=a,this._sheetInterceptorService=n,this._lexerTreeBuilder=i,this._initialize()}_initialize(){this._commandExecutedListener()}_commandExecutedListener(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:e=>{if(e.id===s.SetDefinedNameCommand.id||e.id===s.RemoveDefinedNameCommand.id)return{redos:[],undos:[]};const a=this._univerInstanceService.getCurrentUnitForType(c.UniverInstanceType.UNIVER_SHEET);if(a==null)return{redos:[],undos:[]};const n=Gt(a,e);return n?this._getUpdateDefinedNameMutations(a,n):{redos:[],undos:[]}}}))}_getUpdateDefinedNameMutations(e,a){const{type:n,unitId:i,sheetId:o}=a,u=this._definedNamesService.getDefinedNameMap(i);if(!u)return{redos:[],undos:[]};const f=[],m=[];return Object.values(u).forEach(l=>{var d;const{formulaOrRefString:p}=l,L=this._lexerTreeBuilder.sequenceNodesBuilder(p);if(L==null)return!0;let N=!1;const T=[];for(let A=0,E=L.length;A<E;A++){const I=L[A];if(typeof I=="string"||I.nodeType!==t.sequenceNodeType.REFERENCE)continue;const{token:O}=I,D=t.deserializeRangeWithSheetWithCache(O),{range:U,sheetName:_,unitId:x}=D,y=((d=e.getSheetBySheetName(_))==null?void 0:d.getSheetId())||"",q={range:U,sheetId:y,unitId:x,sheetName:_,refOffsetX:0,refOffsetY:0};let h=null;if(n===b.RemoveSheet)h=this._removeSheet(l,i,o);else if(n===b.SetName){const{sheetId:M,sheetName:B}=a;if(B==null||y==null||y.length===0||M!==y)continue;h=t.serializeRangeToRefString({range:U,sheetName:B,unitId:x})}else h=Vt(q,a,i,o);h!=null&&(L[A]={...I,token:h},N=!0,T.push(A))}if(!N)return!0;const S=t.generateStringWithSequence(vt(L,T)),R={id:t.SetDefinedNameMutation.id,params:{unitId:i,...l,formulaOrRefString:S}};f.push(R);const C={id:t.SetDefinedNameMutation.id,params:{unitId:i,...l}};m.push(C)}),{redos:f,undos:m}}_removeSheet(e,a,n){var u;const{formulaOrRefString:i}=e;return((u=this._definedNamesService.getWorksheetByRef(a,i))==null?void 0:u.getSheetId())===n?t.ErrorType.REF:null}},P.UpdateDefinedNameController=he([rt(0,t.IDefinedNamesService),rt(1,c.IUniverInstanceService),rt(2,c.Inject(s.SheetInterceptorService)),rt(3,c.Inject(t.LexerTreeBuilder))],P.UpdateDefinedNameController);var Fe=Object.getOwnPropertyDescriptor,Be=(r,e,a,n)=>{for(var i=n>1?void 0:n?Fe(e,a):e,o=r.length-1,u;o>=0;o--)(u=r[o])&&(i=u(i)||i);return i},X=(r,e)=>(a,n)=>e(a,n,r);P.UpdateFormulaController=class extends c.Disposable{constructor(e,a,n,i,o,u,f,m){super(),this._univerInstanceService=e,this._commandService=a,this._lexerTreeBuilder=n,this._formulaDataModel=i,this._sheetInterceptorService=o,this._definedNamesService=u,this._configService=f,this._injector=m,this._commandExecutedListener()}_commandExecutedListener(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:e=>this._getUpdateFormula(e)})),this.disposeWithMe(this._commandService.onCommandExecuted(e=>{if(e.params)if(e.id===s.RemoveSheetMutation.id){const{subUnitId:a,unitId:n}=e.params;this._handleWorkbookDisposed(n,a)}else e.id===s.InsertSheetMutation.id&&this._handleInsertSheetMutation(e.params)})),this.disposeWithMe(this._commandService.beforeCommandExecuted((e,a)=>{if(e.id===s.SetRangeValuesMutation.id){const n=e.params;if(a&&a.onlyLocal===!0||a&&a.syncOnly===!0||n.trigger===s.SetStyleCommand.id||n.trigger===s.SetBorderCommand.id||n.trigger===s.ClearSelectionFormatCommand.id)return;this._handleSetRangeValuesMutation(n)}})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitAdded$(c.UniverInstanceType.UNIVER_SHEET).subscribe(e=>this._handleWorkbookAdded(e))),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitDisposed$(c.UniverInstanceType.UNIVER_SHEET).pipe(bt.map(e=>e.getUnitId())).subscribe(e=>this._handleWorkbookDisposed(e)))}_handleSetRangeValuesMutation(e){const{subUnitId:a,unitId:n,cellValue:i}=e;if(i==null)return;const o=this._formulaDataModel.updateFormulaData(n,a,i);if(Object.keys(o).length===0)return;const u={[n]:{[a]:o}};this._commandService.executeCommand(s.SetRangeValuesMutation.id,{unitId:n,subUnitId:a,cellValue:Ne(o)},{onlyLocal:!0,fromFormula:!0}),this._formulaDataModel.updateArrayFormulaCellData(n,a,i),this._formulaDataModel.updateArrayFormulaRange(n,a,i),this._formulaDataModel.updateImageFormulaData(n,a,i),this._commandService.executeCommand(t.SetFormulaDataMutation.id,{formulaData:u},{onlyLocal:!0}),this._commandService.executeCommand(t.SetArrayFormulaDataMutation.id,{arrayFormulaRange:this._formulaDataModel.getArrayFormulaRange(),arrayFormulaCellData:this._formulaDataModel.getArrayFormulaCellData()},{onlyLocal:!0,remove:!0})}_handleWorkbookDisposed(e,a){const n=this._formulaDataModel.getFormulaData(),i=At(n,e,a),o=this._formulaDataModel.getArrayFormulaRange(),u=At(o,e,a),f=this._formulaDataModel.getArrayFormulaCellData(),m=At(f,e,a);i&&this._commandService.executeCommand(t.SetFormulaDataMutation.id,{formulaData:i},{onlyLocal:!0}),u&&m&&this._commandService.executeCommand(t.SetArrayFormulaDataMutation.id,{arrayFormulaRange:o,arrayFormulaCellData:f},{onlyLocal:!0})}_handleInsertSheetMutation(e){const{sheet:a,unitId:n}=e,i=this._formulaDataModel.getFormulaData(),{id:o,cellData:u}=a,f=new c.ObjectMatrix(u),m=t.initSheetFormulaData(i,n,o,f);this._commandService.executeCommand(t.SetFormulaDataMutation.id,{formulaData:m},{onlyLocal:!0})}_handleWorkbookAdded(e){var l;const a={},n=e.getUnitId(),i={[n]:{}};e.getSheets().forEach(p=>{var S;const L=p.getCellMatrix(),N=p.getSheetId(),T=t.initSheetFormulaData(a,n,N,L);i[n][N]=(S=T[n])==null?void 0:S[N]}),this._commandService.executeCommand(t.SetFormulaDataMutation.id,{formulaData:i},{onlyLocal:!0});const u=this._configService.getConfig($),f=(l=u==null?void 0:u.initialFormulaComputing)!=null?l:Y.WHEN_EMPTY,m=this._getDirtyDataByCalculationMode(f);this._commandService.executeCommand(t.SetTriggerFormulaCalculationStartMutation.id,m,{onlyLocal:!0})}_getDirtyDataByCalculationMode(e){const a=e===Y.FORCED,n=e===Y.WHEN_EMPTY?this._formulaDataModel.getFormulaDirtyRanges():[];return{forceCalculation:a,dirtyRanges:n,dirtyNameMap:{},dirtyDefinedNameMap:{},dirtyUnitFeatureMap:{},dirtyUnitOtherFormulaMap:{},clearDependencyTreeCache:{}}}_getUpdateFormula(e){const a=this._univerInstanceService.getCurrentUnitForType(c.UniverInstanceType.UNIVER_SHEET);if(!a)return{undos:[],redos:[]};const n=Gt(a,e);if(n){const{unitSheetNameMap:i}=this._formulaDataModel.getCalculateData(),o=this._formulaDataModel.getFormulaData(),{newFormulaData:u}=this._getFormulaReferenceMoveInfo(o,i,n),{undos:f,redos:m}=$t(o,u,n);return{undos:f,redos:m}}return{undos:[],redos:[]}}_getFormulaReferenceMoveInfo(e,a,n){if(!c.Tools.isDefine(e))return{newFormulaData:{},oldFormulaData:{}};const i=Object.keys(e);if(i.length===0)return{newFormulaData:{},oldFormulaData:{}};const o={},u={};for(const f of i){const m=e[f];if(m==null)continue;const l=Object.keys(m);c.Tools.isDefine(o[f])||(o[f]={}),c.Tools.isDefine(u[f])||(u[f]={});for(const p of l){const L=new c.ObjectMatrix(m[p]||{}),N=new c.ObjectMatrix,T=[];L.forValue((S,R,C)=>{var q;if(!C)return!0;const{f:d,x:A,y:E,si:I}=C,O=this._lexerTreeBuilder.sequenceNodesBuilder(d);if(O==null)return!0;let D=!1;const U=[],{type:_,from:x}=n;for(let h=0,M=O.length;h<M;h++){const B=O[h];if(typeof B=="string")continue;const{token:K,nodeType:k}=B;if((_===b.SetDefinedName||_===b.RemoveDefinedName)&&(k===t.sequenceNodeType.DEFINED_NAME||k===t.sequenceNodeType.FUNCTION)){const{definedNameId:Pt,definedName:J}=n;if(Pt===void 0||J===void 0)continue;const j=this._definedNamesService.getValueById(f,Pt);if(j==null||j.name!==K)continue;O[h]={...B,token:_===b.SetDefinedName?J:t.ErrorType.REF},D=!0,U.push(h);continue}else if(k!==t.sequenceNodeType.REFERENCE)continue;const Q=t.deserializeRangeWithSheetWithCache(K),{range:V,sheetName:H,unitId:w}=Q,Nt=w==null||w.length===0?f:w,G=((q=a==null?void 0:a[Nt])==null?void 0:q[H])||"";if(!Bt(n.unitId,n.sheetId,f,p,w,G))continue;const Dt={range:V,sheetId:G,unitId:w,sheetName:H,refOffsetX:A||0,refOffsetY:E||0};let nt=null;if(_===b.SetName){const{unitId:Pt,sheetId:J,sheetName:j}=n;if(j==null||G==null||G.length===0||J!==G)continue;nt=t.serializeRangeToRefString({range:V,sheetName:j,unitId:w})}else if(_===b.RemoveSheet){const{unitId:Pt,sheetId:J,sheetName:j}=n;if(G==null||G.length===0||J!==G)continue;nt=t.ErrorType.REF}else _!==b.SetDefinedName&&(nt=Vt(Dt,n,f,p));nt!=null&&(O[h]={...B,token:nt},D=!0,U.push(h),I&&(A!=null?A:0)===0&&(E!=null?E:0)===0&&T.push(I))}if(!D)if(I&&[b.MoveRows,b.MoveCols,b.MoveRange].includes(_)){if(x&&x.startRow<=S&&S<=x.endRow&&x.startColumn<=R&&R<=x.endColumn)(A!=null?A:0)===0&&(E!=null?E:0)===0&&T.push(I);else if(!T.includes(I))return!0}else return!0;const y=vt(O,U,A,E);N.setValue(S,R,{f:`=${t.generateStringWithSequence(y)}`})}),u[f]&&(u[f][p]=N.getData())}}return{newFormulaData:u}}},P.UpdateFormulaController=Be([X(0,c.IUniverInstanceService),X(1,c.ICommandService),X(2,c.Inject(t.LexerTreeBuilder)),X(3,c.Inject(t.FormulaDataModel)),X(4,c.Inject(s.SheetInterceptorService)),X(5,t.IDefinedNamesService),X(6,c.IConfigService),X(7,c.Inject(c.Injector))],P.UpdateFormulaController);const ve="SHEETS_FORMULA_PLUGIN";var Ve=Object.getOwnPropertyDescriptor,Ge=(r,e,a,n)=>{for(var i=n>1?void 0:n?Ve(e,a):e,o=r.length-1,u;o>=0;o--)(u=r[o])&&(i=u(i)||i);return i},Rt=(r,e)=>(a,n)=>e(a,n,r);let ot=class extends c.Disposable{constructor(r,e,a){super(),this._activeDirtyManagerService=r,this._univerInstanceService=e,this._formulaDataModel=a,this._initialize()}_initialize(){this._initialConversion()}_initialConversion(){this._activeDirtyManagerService.register(s.SetRangeValuesMutation.id,{commandId:s.SetRangeValuesMutation.id,getDirtyData:r=>{const e=r.params;return e.trigger===s.SetStyleCommand.id?{}:{dirtyRanges:this._getSetRangeValuesMutationDirtyRange(e)}}}),this._initialMove(),this._initialRowAndColumn(),this._initialHideRow(),this._initialSheet(),this._initialDefinedName()}_initialMove(){this._activeDirtyManagerService.register(s.MoveRangeMutation.id,{commandId:s.MoveRangeMutation.id,getDirtyData:r=>{const e=r.params;return{dirtyRanges:this._getMoveRangeMutationDirtyRange(e),clearDependencyTreeCache:{[e.unitId]:{[e.to.subUnitId]:"1",[e.from.subUnitId]:"1"}}}}}),this._activeDirtyManagerService.register(s.MoveRowsMutation.id,{commandId:s.MoveRowsMutation.id,getDirtyData:r=>{const e=r.params;return{dirtyRanges:this._getMoveRowsMutationDirtyRange(e),clearDependencyTreeCache:{[e.unitId]:{[e.subUnitId]:"1"}}}}}),this._activeDirtyManagerService.register(s.MoveColsMutation.id,{commandId:s.MoveColsMutation.id,getDirtyData:r=>{const e=r.params;return{dirtyRanges:this._getMoveRowsMutationDirtyRange(e),clearDependencyTreeCache:{[e.unitId]:{[e.subUnitId]:"1"}}}}}),this._activeDirtyManagerService.register(s.ReorderRangeMutation.id,{commandId:s.ReorderRangeMutation.id,getDirtyData:r=>{const e=r.params;return{dirtyRanges:this._getReorderRangeMutationDirtyRange(e),clearDependencyTreeCache:{[e.unitId]:{[e.subUnitId]:"1"}}}}})}_initialRowAndColumn(){this._activeDirtyManagerService.register(s.RemoveRowMutation.id,{commandId:s.RemoveRowMutation.id,getDirtyData:r=>{const e=r.params;return{dirtyRanges:this._getRemoveRowOrColumnMutation(e,!0),clearDependencyTreeCache:{[e.unitId]:{[e.subUnitId]:"1"}}}}}),this._activeDirtyManagerService.register(s.RemoveColMutation.id,{commandId:s.RemoveColMutation.id,getDirtyData:r=>{const e=r.params;return{dirtyRanges:this._getRemoveRowOrColumnMutation(e,!1),clearDependencyTreeCache:{[e.unitId]:{[e.subUnitId]:"1"}}}}}),this._activeDirtyManagerService.register(s.InsertColMutation.id,{commandId:s.InsertColMutation.id,getDirtyData:r=>{const e=r.params;return{clearDependencyTreeCache:{[e.unitId]:{[e.subUnitId]:"1"}}}}}),this._activeDirtyManagerService.register(s.InsertRowMutation.id,{commandId:s.InsertRowMutation.id,getDirtyData:r=>{const e=r.params;return{clearDependencyTreeCache:{[e.unitId]:{[e.subUnitId]:"1"}}}}})}_initialHideRow(){this._activeDirtyManagerService.register(s.SetRowHiddenMutation.id,{commandId:s.SetRowHiddenMutation.id,getDirtyData:r=>{const e=r.params;return{dirtyRanges:this._getHideRowMutation(e),clearDependencyTreeCache:{[e.unitId]:{[e.subUnitId]:"1"}}}}}),this._activeDirtyManagerService.register(s.SetRowVisibleMutation.id,{commandId:s.SetRowVisibleMutation.id,getDirtyData:r=>{const e=r.params;return{dirtyRanges:this._getHideRowMutation(e),clearDependencyTreeCache:{[e.unitId]:{[e.subUnitId]:"1"}}}}})}_initialSheet(){this._activeDirtyManagerService.register(t.SetTriggerFormulaCalculationStartMutation.id,{commandId:t.SetTriggerFormulaCalculationStartMutation.id,getDirtyData:r=>({...r.params})}),this._activeDirtyManagerService.register(s.RemoveSheetMutation.id,{commandId:s.RemoveSheetMutation.id,getDirtyData:r=>{const e=r.params;return{dirtyNameMap:this._getRemoveSheetMutation(e),clearDependencyTreeCache:{[e.unitId]:{[e.subUnitId]:"1"}}}}}),this._activeDirtyManagerService.register(s.InsertSheetMutation.id,{commandId:s.InsertSheetMutation.id,getDirtyData:r=>{const e=r.params;return{dirtyNameMap:this._getInsertSheetMutation(e)}}})}_initialDefinedName(){this._activeDirtyManagerService.register(t.SetDefinedNameMutation.id,{commandId:t.SetDefinedNameMutation.id,getDirtyData:r=>{const e=r.params;return{dirtyDefinedNameMap:this._getDefinedNameMutation(e)}}}),this._activeDirtyManagerService.register(t.RemoveDefinedNameMutation.id,{commandId:t.RemoveDefinedNameMutation.id,getDirtyData:r=>{const e=r.params;return{dirtyDefinedNameMap:this._getDefinedNameMutation(e)}}})}_getDefinedNameMutation(r){const{unitId:e,name:a,formulaOrRefString:n}=r,i={};return r==null?{}:(i[e]={},i[e][a]=n,i)}_getSetRangeValuesMutationDirtyRange(r){const{subUnitId:e,unitId:a,cellValue:n}=r,i=[];return n==null||(i.push(...this._getDirtyRangesByCellValue(a,e,n)),i.push(...this._getDirtyRangesForArrayFormula(a,e,n))),i}_getMoveRangeMutationDirtyRange(r){const{unitId:e,from:a,to:n}=r,i=[];return i.push(...this._getDirtyRangesByCellValue(e,a.subUnitId,a.value)),i.push(...this._getDirtyRangesByCellValue(e,n.subUnitId,n.value)),i.push(...this._getDirtyRangesForArrayFormula(e,n.subUnitId,n.value)),i}_getMoveRowsMutationDirtyRange(r){const{subUnitId:e,unitId:a,sourceRange:n,targetRange:i}=r,o=[],u=this._rangeToMatrix(n).getData(),f=this._rangeToMatrix(i).getData();return o.push(...this._getDirtyRangesByCellValue(a,e,u)),o.push(...this._getDirtyRangesByCellValue(a,e,f)),o.push(...this._getDirtyRangesForArrayFormula(a,e,f)),o}_getReorderRangeMutationDirtyRange(r){const{unitId:e,subUnitId:a,range:n}=r,i=this._rangeToMatrix(n).getData(),o=[];return o.push(...this._getDirtyRangesByCellValue(e,a,i)),o.push(...this._getDirtyRangesForArrayFormula(e,a,i)),o}_getRemoveRowOrColumnMutation(r,e=!0){const{subUnitId:a,unitId:n,range:i}=r,o=[],u=this._univerInstanceService.getUniverSheetInstance(n),f=u==null?void 0:u.getSheetBySheetId(a),m=(f==null?void 0:f.getRowCount())||0,l=(f==null?void 0:f.getColumnCount())||0;let p=null;const{startRow:L,endRow:N,startColumn:T,endColumn:S}=i;e===!0?p=this._rangeToMatrix({startRow:L,startColumn:0,endRow:N,endColumn:l-1}):p=this._rangeToMatrix({startRow:0,startColumn:T,endRow:m,endColumn:S});const R=p.getData();return o.push(...this._getDirtyRangesByCellValue(n,a,R)),o.push(...this._getDirtyRangesForArrayFormula(n,a,R)),o}_getHideRowMutation(r){const{subUnitId:e,unitId:a,ranges:n}=r,i=[];return n.forEach(o=>{const u=this._rangeToMatrix(o).getMatrix();i.push(...this._getDirtyRangesByCellValue(a,e,u))}),i}_getRemoveSheetMutation(r){const e={},{subUnitId:a,unitId:n,subUnitName:i}=r;return e[n]==null&&(e[n]={}),e[n][a]=i,e}_getInsertSheetMutation(r){const e={},{sheet:a,unitId:n}=r;return e[n]==null&&(e[n]={}),e[n][a.id]=a.name,e}_rangeToMatrix(r){const e=new c.ObjectMatrix,{startRow:a,startColumn:n,endRow:i,endColumn:o}=r;for(let u=a;u<=i;u++)for(let f=n;f<=o;f++)e.setValue(u,f,{});return e}_getDirtyRangesByCellValue(r,e,a){const n=[];return a==null||new c.ObjectMatrix(a).getDiscreteRanges().forEach(u=>{n.push({unitId:r,sheetId:e,range:u})}),n}_getDirtyRangesForArrayFormula(r,e,a){var u,f;const n=[];if(a==null)return n;const i=new c.ObjectMatrix(a),o=this._formulaDataModel.getArrayFormulaRange();if((u=o==null?void 0:o[r])!=null&&u[e]){const m=new c.ObjectMatrix((f=o==null?void 0:o[r])==null?void 0:f[e]);i.forValue((l,p)=>{m.forValue((L,N,T)=>{if(T==null)return!0;const{startRow:S,startColumn:R,endRow:C,endColumn:d}=T;l>=S&&l<=C&&p>=R&&p<=d&&n.push({unitId:r,sheetId:e,range:{startRow:S,startColumn:R,endRow:S,endColumn:R}})})})}return n}};ot=Ge([Rt(0,t.IActiveDirtyManagerService),Rt(1,c.IUniverInstanceService),Rt(2,c.Inject(t.FormulaDataModel))],ot);var He=Object.getOwnPropertyDescriptor,we=(r,e,a,n)=>{for(var i=n>1?void 0:n?He(e,a):e,o=r.length-1,u;o>=0;o--)(u=r[o])&&(i=u(i)||i);return i},g=(r,e)=>(a,n)=>e(a,n,r);let ut=class extends c.Disposable{constructor(r,e,a,n,i,o,u){super(),this._commandService=r,this._configService=e,this._sheetInterceptorService=a,this._formulaDataModel=n,this._lexerTreeBuilder=i,this._functionService=o,this._definedNamesService=u,this._initialize()}_initialize(){this._commandExecutedListener(),this._initInterceptorCellContent()}_commandExecutedListener(){this.disposeWithMe(this._commandService.onCommandExecuted(r=>{var a;const e=(a=this._configService.getConfig($))==null?void 0:a.writeArrayFormulaToSnapshot;if(r.id===t.SetArrayFormulaDataMutation.id){const n=r.params;if(n==null)return;const{arrayFormulaRange:i,arrayFormulaCellData:o,arrayFormulaEmbedded:u}=n;this._formulaDataModel.setArrayFormulaRange(i),this._formulaDataModel.setArrayFormulaCellData(o),e&&this._writeArrayFormulaToSnapshot(i,o,u)}else r.id===t.SetFormulaCalculationResultMutation.id&&e&&(this._addPrefixToFunctionSnapshot(),this._addPrefixToDefinedNamesFunctionSnapshot())}))}_addPrefixToDefinedNamesFunctionSnapshot(){const r=this._definedNamesService.getAllDefinedNames();Object.entries(r).forEach(([e,a])=>{a&&Array.from(Object.entries(a)).forEach(([n,i])=>{const{formulaOrRefString:o}=i;if(o.substring(0,1)==="="){const u=this._lexerTreeBuilder.getNewFormulaWithPrefix(o,this._functionService.hasExecutor.bind(this._functionService));u&&this._commandService.executeCommand(t.SetDefinedNameMutation.id,{...i,unitId:e,formulaOrRefStringWithPrefix:u},{onlyLocal:!0,fromFormula:!0})}})})}_addPrefixToFunctionSnapshot(){const r=this._formulaDataModel.getFormulaData(),e=new Map;Object.entries(r).forEach(([a,n])=>{n&&Array.from(Object.entries(n)).forEach(([i,o])=>{if(!o)return;const u=new c.ObjectMatrix;new c.ObjectMatrix(o).forValue((m,l,p)=>{const L=p==null?void 0:p.f;if((p==null?void 0:p.x)!=null||!L||L.length===0)return;if(e.has(L)){const T=e.get(L);u.setValue(m,l,{xf:T});return}const N=this._lexerTreeBuilder.getNewFormulaWithPrefix(L,this._functionService.hasExecutor.bind(this._functionService));N&&(u.setValue(m,l,{xf:N}),e.set(L,N))}),this._commandService.executeCommand(s.SetRangeValuesMutation.id,{unitId:a,subUnitId:i,cellValue:u.getMatrix()},{onlyLocal:!0,fromFormula:!0})})}),e.clear()}_writeArrayFormulaToSnapshot(r,e,a){r&&Object.entries(r).forEach(([n,i])=>{i&&Array.from(Object.entries(i)).forEach(([o,u])=>{const f=new c.ObjectMatrix;new c.ObjectMatrix(u).forValue((l,p,L)=>{f.setValue(l,p,{ref:t.serializeRange(L)})}),this._commandService.executeCommand(s.SetRangeValuesMutation.id,{unitId:n,subUnitId:o,cellValue:f.getMatrix()},{onlyLocal:!0,fromFormula:!0})})}),a&&Object.entries(a).forEach(([n,i])=>{i&&Array.from(Object.entries(i)).forEach(([o,u])=>{const f=new c.ObjectMatrix;new c.ObjectMatrix(u).forValue((l,p)=>{var N,T,S;(S=(T=(N=r==null?void 0:r[n])==null?void 0:N[o])==null?void 0:T[l])!=null&&S[p]||f.setValue(l,p,{ref:t.serializeRange({startRow:l,endRow:l,startColumn:p,endColumn:p})})}),this._commandService.executeCommand(s.SetRangeValuesMutation.id,{unitId:n,subUnitId:o,cellValue:f.getMatrix()},{onlyLocal:!0,fromFormula:!0})})}),e&&Object.entries(e).forEach(([n,i])=>{i&&Array.from(Object.entries(i)).forEach(([o,u])=>{this._commandService.executeCommand(s.SetRangeValuesMutation.id,{unitId:n,subUnitId:o,cellValue:u},{onlyLocal:!0,fromFormula:!0})})})}_initInterceptorCellContent(){this.disposeWithMe(this._sheetInterceptorService.intercept(s.INTERCEPTOR_POINT.CELL_CONTENT,{priority:100,effect:c.InterceptorEffectEnum.Value,handler:(r,e,a)=>{var p,L,N;let n=r;const{unitId:i,subUnitId:o,row:u,col:f}=e,m=this._formulaDataModel.getArrayFormulaCellData(),l=(N=(L=(p=m==null?void 0:m[i])==null?void 0:p[o])==null?void 0:L[u])==null?void 0:N[f];return l==null?a(n):((!n||n===e.rawData)&&(n={...e.rawData}),l.v==null&&l.t==null?(n.v=0,n.t=c.CellValueType.NUMBER,a(n)):(n==null?void 0:n.t)===c.CellValueType.NUMBER&&n.v!==void 0&&n.v!==null&&c.isRealNum(n.v)?(n.v=t.stripErrorMargin(Number(n.v)),a(n)):(n.v=l.v,n.t=l.t,a(n)))}}))}};ut=we([g(0,c.ICommandService),g(1,c.IConfigService),g(2,c.Inject(s.SheetInterceptorService)),g(3,c.Inject(t.FormulaDataModel)),g(4,c.Inject(t.LexerTreeBuilder)),g(5,t.IFunctionService),g(6,t.IDefinedNamesService)],ut);const Ye=[{functionName:t.FUNCTION_NAMES_ARRAY.ARRAY_CONSTRAIN,functionType:t.FunctionType.Array,description:"formula.functionList.ARRAY_CONSTRAIN.description",abstract:"formula.functionList.ARRAY_CONSTRAIN.abstract",functionParameter:[{name:"formula.functionList.ARRAY_CONSTRAIN.functionParameter.inputRange.name",detail:"formula.functionList.ARRAY_CONSTRAIN.functionParameter.inputRange.detail",example:"A1:C3",require:1,repeat:0},{name:"formula.functionList.ARRAY_CONSTRAIN.functionParameter.numRows.name",detail:"formula.functionList.ARRAY_CONSTRAIN.functionParameter.numRows.detail",example:"2",require:1,repeat:0},{name:"formula.functionList.ARRAY_CONSTRAIN.functionParameter.numCols.name",detail:"formula.functionList.ARRAY_CONSTRAIN.functionParameter.numCols.detail",example:"2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ARRAY.FLATTEN,functionType:t.FunctionType.Array,description:"formula.functionList.FLATTEN.description",abstract:"formula.functionList.FLATTEN.abstract",functionParameter:[{name:"formula.functionList.FLATTEN.functionParameter.range1.name",detail:"formula.functionList.FLATTEN.functionParameter.range1.detail",example:"A1:C3",require:1,repeat:0},{name:"formula.functionList.FLATTEN.functionParameter.range2.name",detail:"formula.functionList.FLATTEN.functionParameter.range2.detail",example:"D1:F3",require:0,repeat:1}]}],Xe=[{functionName:t.FUNCTION_NAMES_COMPATIBILITY.BETADIST,functionType:t.FunctionType.Compatibility,description:"formula.functionList.BETADIST.description",abstract:"formula.functionList.BETADIST.abstract",functionParameter:[{name:"formula.functionList.BETADIST.functionParameter.x.name",detail:"formula.functionList.BETADIST.functionParameter.x.detail",example:"2",require:1,repeat:0},{name:"formula.functionList.BETADIST.functionParameter.alpha.name",detail:"formula.functionList.BETADIST.functionParameter.alpha.detail",example:"8",require:1,repeat:0},{name:"formula.functionList.BETADIST.functionParameter.beta.name",detail:"formula.functionList.BETADIST.functionParameter.beta.detail",example:"10",require:1,repeat:0},{name:"formula.functionList.BETADIST.functionParameter.A.name",detail:"formula.functionList.BETADIST.functionParameter.A.detail",example:"1",require:0,repeat:0},{name:"formula.functionList.BETADIST.functionParameter.B.name",detail:"formula.functionList.BETADIST.functionParameter.B.detail",example:"3",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_COMPATIBILITY.BETAINV,functionType:t.FunctionType.Compatibility,description:"formula.functionList.BETAINV.description",abstract:"formula.functionList.BETAINV.abstract",functionParameter:[{name:"formula.functionList.BETAINV.functionParameter.probability.name",detail:"formula.functionList.BETAINV.functionParameter.probability.detail",example:"0.685470581",require:1,repeat:0},{name:"formula.functionList.BETAINV.functionParameter.alpha.name",detail:"formula.functionList.BETAINV.functionParameter.alpha.detail",example:"8",require:1,repeat:0},{name:"formula.functionList.BETAINV.functionParameter.beta.name",detail:"formula.functionList.BETAINV.functionParameter.beta.detail",example:"10",require:1,repeat:0},{name:"formula.functionList.BETAINV.functionParameter.A.name",detail:"formula.functionList.BETAINV.functionParameter.A.detail",example:"1",require:0,repeat:0},{name:"formula.functionList.BETAINV.functionParameter.B.name",detail:"formula.functionList.BETAINV.functionParameter.B.detail",example:"3",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_COMPATIBILITY.BINOMDIST,functionType:t.FunctionType.Compatibility,description:"formula.functionList.BINOMDIST.description",abstract:"formula.functionList.BINOMDIST.abstract",functionParameter:[{name:"formula.functionList.BINOMDIST.functionParameter.numberS.name",detail:"formula.functionList.BINOMDIST.functionParameter.numberS.detail",example:"6",require:1,repeat:0},{name:"formula.functionList.BINOMDIST.functionParameter.trials.name",detail:"formula.functionList.BINOMDIST.functionParameter.trials.detail",example:"10",require:1,repeat:0},{name:"formula.functionList.BINOMDIST.functionParameter.probabilityS.name",detail:"formula.functionList.BINOMDIST.functionParameter.probabilityS.detail",example:"0.5",require:1,repeat:0},{name:"formula.functionList.BINOMDIST.functionParameter.cumulative.name",detail:"formula.functionList.BINOMDIST.functionParameter.cumulative.detail",example:"false",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_COMPATIBILITY.CHIDIST,functionType:t.FunctionType.Compatibility,description:"formula.functionList.CHIDIST.description",abstract:"formula.functionList.CHIDIST.abstract",functionParameter:[{name:"formula.functionList.CHIDIST.functionParameter.x.name",detail:"formula.functionList.CHIDIST.functionParameter.x.detail",example:"0.5",require:1,repeat:0},{name:"formula.functionList.CHIDIST.functionParameter.degFreedom.name",detail:"formula.functionList.CHIDIST.functionParameter.degFreedom.detail",example:"1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_COMPATIBILITY.CHIINV,functionType:t.FunctionType.Compatibility,description:"formula.functionList.CHIINV.description",abstract:"formula.functionList.CHIINV.abstract",functionParameter:[{name:"formula.functionList.CHIINV.functionParameter.probability.name",detail:"formula.functionList.CHIINV.functionParameter.probability.detail",example:"0.93",require:1,repeat:0},{name:"formula.functionList.CHIINV.functionParameter.degFreedom.name",detail:"formula.functionList.CHIINV.functionParameter.degFreedom.detail",example:"1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_COMPATIBILITY.CHITEST,functionType:t.FunctionType.Compatibility,description:"formula.functionList.CHITEST.description",abstract:"formula.functionList.CHITEST.abstract",functionParameter:[{name:"formula.functionList.CHITEST.functionParameter.actualRange.name",detail:"formula.functionList.CHITEST.functionParameter.actualRange.detail",example:"A1:A4",require:1,repeat:0},{name:"formula.functionList.CHITEST.functionParameter.expectedRange.name",detail:"formula.functionList.CHITEST.functionParameter.expectedRange.detail",example:"B1:B4",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_COMPATIBILITY.CONFIDENCE,functionType:t.FunctionType.Compatibility,description:"formula.functionList.CONFIDENCE.description",abstract:"formula.functionList.CONFIDENCE.abstract",functionParameter:[{name:"formula.functionList.CONFIDENCE.functionParameter.alpha.name",detail:"formula.functionList.CONFIDENCE.functionParameter.alpha.detail",example:"0.05",require:1,repeat:0},{name:"formula.functionList.CONFIDENCE.functionParameter.standardDev.name",detail:"formula.functionList.CONFIDENCE.functionParameter.standardDev.detail",example:"2.5",require:1,repeat:0},{name:"formula.functionList.CONFIDENCE.functionParameter.size.name",detail:"formula.functionList.CONFIDENCE.functionParameter.size.detail",example:"50",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_COMPATIBILITY.COVAR,functionType:t.FunctionType.Compatibility,description:"formula.functionList.COVAR.description",abstract:"formula.functionList.COVAR.abstract",functionParameter:[{name:"formula.functionList.COVAR.functionParameter.array1.name",detail:"formula.functionList.COVAR.functionParameter.array1.detail",example:"A1:A4",require:1,repeat:0},{name:"formula.functionList.COVAR.functionParameter.array2.name",detail:"formula.functionList.COVAR.functionParameter.array2.detail",example:"B1:B4",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_COMPATIBILITY.CRITBINOM,functionType:t.FunctionType.Compatibility,description:"formula.functionList.CRITBINOM.description",abstract:"formula.functionList.CRITBINOM.abstract",functionParameter:[{name:"formula.functionList.CRITBINOM.functionParameter.trials.name",detail:"formula.functionList.CRITBINOM.functionParameter.trials.detail",example:"6",require:1,repeat:0},{name:"formula.functionList.CRITBINOM.functionParameter.probabilityS.name",detail:"formula.functionList.CRITBINOM.functionParameter.probabilityS.detail",example:"0.5",require:1,repeat:0},{name:"formula.functionList.CRITBINOM.functionParameter.alpha.name",detail:"formula.functionList.CRITBINOM.functionParameter.alpha.detail",example:"0.75",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_COMPATIBILITY.EXPONDIST,functionType:t.FunctionType.Compatibility,description:"formula.functionList.EXPONDIST.description",abstract:"formula.functionList.EXPONDIST.abstract",functionParameter:[{name:"formula.functionList.EXPONDIST.functionParameter.x.name",detail:"formula.functionList.EXPONDIST.functionParameter.x.detail",example:"0.2",require:1,repeat:0},{name:"formula.functionList.EXPONDIST.functionParameter.lambda.name",detail:"formula.functionList.EXPONDIST.functionParameter.lambda.detail",example:"10",require:1,repeat:0},{name:"formula.functionList.EXPONDIST.functionParameter.cumulative.name",detail:"formula.functionList.EXPONDIST.functionParameter.cumulative.detail",example:"true",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_COMPATIBILITY.FDIST,functionType:t.FunctionType.Compatibility,description:"formula.functionList.FDIST.description",abstract:"formula.functionList.FDIST.abstract",functionParameter:[{name:"formula.functionList.FDIST.functionParameter.x.name",detail:"formula.functionList.FDIST.functionParameter.x.detail",example:"15.2069",require:1,repeat:0},{name:"formula.functionList.FDIST.functionParameter.degFreedom1.name",detail:"formula.functionList.FDIST.functionParameter.degFreedom1.detail",example:"6",require:1,repeat:0},{name:"formula.functionList.FDIST.functionParameter.degFreedom2.name",detail:"formula.functionList.FDIST.functionParameter.degFreedom2.detail",example:"4",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_COMPATIBILITY.FINV,functionType:t.FunctionType.Compatibility,description:"formula.functionList.FINV.description",abstract:"formula.functionList.FINV.abstract",functionParameter:[{name:"formula.functionList.FINV.functionParameter.probability.name",detail:"formula.functionList.FINV.functionParameter.probability.detail",example:"0.01",require:1,repeat:0},{name:"formula.functionList.FINV.functionParameter.degFreedom1.name",detail:"formula.functionList.FINV.functionParameter.degFreedom1.detail",example:"6",require:1,repeat:0},{name:"formula.functionList.FINV.functionParameter.degFreedom2.name",detail:"formula.functionList.FINV.functionParameter.degFreedom2.detail",example:"4",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_COMPATIBILITY.FTEST,functionType:t.FunctionType.Compatibility,description:"formula.functionList.FTEST.description",abstract:"formula.functionList.FTEST.abstract",functionParameter:[{name:"formula.functionList.FTEST.functionParameter.array1.name",detail:"formula.functionList.FTEST.functionParameter.array1.detail",example:"A1:A4",require:1,repeat:0},{name:"formula.functionList.FTEST.functionParameter.array2.name",detail:"formula.functionList.FTEST.functionParameter.array2.detail",example:"B1:B4",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_COMPATIBILITY.GAMMADIST,functionType:t.FunctionType.Compatibility,description:"formula.functionList.GAMMADIST.description",abstract:"formula.functionList.GAMMADIST.abstract",functionParameter:[{name:"formula.functionList.GAMMADIST.functionParameter.x.name",detail:"formula.functionList.GAMMADIST.functionParameter.x.detail",example:"10",require:1,repeat:0},{name:"formula.functionList.GAMMADIST.functionParameter.alpha.name",detail:"formula.functionList.GAMMADIST.functionParameter.alpha.detail",example:"8",require:1,repeat:0},{name:"formula.functionList.GAMMADIST.functionParameter.beta.name",detail:"formula.functionList.GAMMADIST.functionParameter.beta.detail",example:"2",require:1,repeat:0},{name:"formula.functionList.GAMMADIST.functionParameter.cumulative.name",detail:"formula.functionList.GAMMADIST.functionParameter.cumulative.detail",example:"true",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_COMPATIBILITY.GAMMAINV,functionType:t.FunctionType.Compatibility,description:"formula.functionList.GAMMAINV.description",abstract:"formula.functionList.GAMMAINV.abstract",functionParameter:[{name:"formula.functionList.GAMMAINV.functionParameter.probability.name",detail:"formula.functionList.GAMMAINV.functionParameter.probability.detail",example:"0.068094",require:1,repeat:0},{name:"formula.functionList.GAMMAINV.functionParameter.alpha.name",detail:"formula.functionList.GAMMAINV.functionParameter.alpha.detail",example:"9",require:1,repeat:0},{name:"formula.functionList.GAMMAINV.functionParameter.beta.name",detail:"formula.functionList.GAMMAINV.functionParameter.beta.detail",example:"2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_COMPATIBILITY.HYPGEOMDIST,functionType:t.FunctionType.Compatibility,description:"formula.functionList.HYPGEOMDIST.description",abstract:"formula.functionList.HYPGEOMDIST.abstract",functionParameter:[{name:"formula.functionList.HYPGEOMDIST.functionParameter.sampleS.name",detail:"formula.functionList.HYPGEOMDIST.functionParameter.sampleS.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.HYPGEOMDIST.functionParameter.numberSample.name",detail:"formula.functionList.HYPGEOMDIST.functionParameter.numberSample.detail",example:"4",require:1,repeat:0},{name:"formula.functionList.HYPGEOMDIST.functionParameter.populationS.name",detail:"formula.functionList.HYPGEOMDIST.functionParameter.populationS.detail",example:"8",require:1,repeat:0},{name:"formula.functionList.HYPGEOMDIST.functionParameter.numberPop.name",detail:"formula.functionList.HYPGEOMDIST.functionParameter.numberPop.detail",example:"20",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_COMPATIBILITY.LOGINV,functionType:t.FunctionType.Compatibility,description:"formula.functionList.LOGINV.description",abstract:"formula.functionList.LOGINV.abstract",functionParameter:[{name:"formula.functionList.LOGINV.functionParameter.probability.name",detail:"formula.functionList.LOGINV.functionParameter.probability.detail",example:"0.908789",require:1,repeat:0},{name:"formula.functionList.LOGINV.functionParameter.mean.name",detail:"formula.functionList.LOGINV.functionParameter.mean.detail",example:"40",require:1,repeat:0},{name:"formula.functionList.LOGINV.functionParameter.standardDev.name",detail:"formula.functionList.LOGINV.functionParameter.standardDev.detail",example:"1.5",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_COMPATIBILITY.LOGNORMDIST,functionType:t.FunctionType.Compatibility,description:"formula.functionList.LOGNORMDIST.description",abstract:"formula.functionList.LOGNORMDIST.abstract",functionParameter:[{name:"formula.functionList.LOGNORMDIST.functionParameter.x.name",detail:"formula.functionList.LOGNORMDIST.functionParameter.x.detail",example:"42",require:1,repeat:0},{name:"formula.functionList.LOGNORMDIST.functionParameter.mean.name",detail:"formula.functionList.LOGNORMDIST.functionParameter.mean.detail",example:"40",require:1,repeat:0},{name:"formula.functionList.LOGNORMDIST.functionParameter.standardDev.name",detail:"formula.functionList.LOGNORMDIST.functionParameter.standardDev.detail",example:"1.5",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_COMPATIBILITY.MODE,functionType:t.FunctionType.Compatibility,description:"formula.functionList.MODE.description",abstract:"formula.functionList.MODE.abstract",functionParameter:[{name:"formula.functionList.MODE.functionParameter.number1.name",detail:"formula.functionList.MODE.functionParameter.number1.detail",example:"A1:A4",require:1,repeat:0},{name:"formula.functionList.MODE.functionParameter.number2.name",detail:"formula.functionList.MODE.functionParameter.number2.detail",example:"2",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_COMPATIBILITY.NEGBINOMDIST,functionType:t.FunctionType.Compatibility,description:"formula.functionList.NEGBINOMDIST.description",abstract:"formula.functionList.NEGBINOMDIST.abstract",functionParameter:[{name:"formula.functionList.NEGBINOMDIST.functionParameter.numberF.name",detail:"formula.functionList.NEGBINOMDIST.functionParameter.numberF.detail",example:"10",require:1,repeat:0},{name:"formula.functionList.NEGBINOMDIST.functionParameter.numberS.name",detail:"formula.functionList.NEGBINOMDIST.functionParameter.numberS.detail",example:"5",require:1,repeat:0},{name:"formula.functionList.NEGBINOMDIST.functionParameter.probabilityS.name",detail:"formula.functionList.NEGBINOMDIST.functionParameter.probabilityS.detail",example:"0.25",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_COMPATIBILITY.NORMDIST,functionType:t.FunctionType.Compatibility,description:"formula.functionList.NORMDIST.description",abstract:"formula.functionList.NORMDIST.abstract",functionParameter:[{name:"formula.functionList.NORMDIST.functionParameter.x.name",detail:"formula.functionList.NORMDIST.functionParameter.x.detail",example:"42",require:1,repeat:0},{name:"formula.functionList.NORMDIST.functionParameter.mean.name",detail:"formula.functionList.NORMDIST.functionParameter.mean.detail",example:"40",require:1,repeat:0},{name:"formula.functionList.NORMDIST.functionParameter.standardDev.name",detail:"formula.functionList.NORMDIST.functionParameter.standardDev.detail",example:"1.5",require:1,repeat:0},{name:"formula.functionList.NORMDIST.functionParameter.cumulative.name",detail:"formula.functionList.NORMDIST.functionParameter.cumulative.detail",example:"true",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_COMPATIBILITY.NORMINV,functionType:t.FunctionType.Compatibility,description:"formula.functionList.NORMINV.description",abstract:"formula.functionList.NORMINV.abstract",functionParameter:[{name:"formula.functionList.NORMINV.functionParameter.probability.name",detail:"formula.functionList.NORMINV.functionParameter.probability.detail",example:"0.908789",require:1,repeat:0},{name:"formula.functionList.NORMINV.functionParameter.mean.name",detail:"formula.functionList.NORMINV.functionParameter.mean.detail",example:"40",require:1,repeat:0},{name:"formula.functionList.NORMINV.functionParameter.standardDev.name",detail:"formula.functionList.NORMINV.functionParameter.standardDev.detail",example:"1.5",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_COMPATIBILITY.NORMSDIST,functionType:t.FunctionType.Compatibility,description:"formula.functionList.NORMSDIST.description",abstract:"formula.functionList.NORMSDIST.abstract",functionParameter:[{name:"formula.functionList.NORMSDIST.functionParameter.z.name",detail:"formula.functionList.NORMSDIST.functionParameter.z.detail",example:"1.333333",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_COMPATIBILITY.NORMSINV,functionType:t.FunctionType.Compatibility,description:"formula.functionList.NORMSINV.description",abstract:"formula.functionList.NORMSINV.abstract",functionParameter:[{name:"formula.functionList.NORMSINV.functionParameter.probability.name",detail:"formula.functionList.NORMSINV.functionParameter.probability.detail",example:"0.908789",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_COMPATIBILITY.PERCENTILE,functionType:t.FunctionType.Compatibility,description:"formula.functionList.PERCENTILE.description",abstract:"formula.functionList.PERCENTILE.abstract",functionParameter:[{name:"formula.functionList.PERCENTILE.functionParameter.array.name",detail:"formula.functionList.PERCENTILE.functionParameter.array.detail",example:"A1:A4",require:1,repeat:0},{name:"formula.functionList.PERCENTILE.functionParameter.k.name",detail:"formula.functionList.PERCENTILE.functionParameter.k.detail",example:"0.3",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_COMPATIBILITY.PERCENTRANK,functionType:t.FunctionType.Compatibility,description:"formula.functionList.PERCENTRANK.description",abstract:"formula.functionList.PERCENTRANK.abstract",functionParameter:[{name:"formula.functionList.PERCENTRANK.functionParameter.array.name",detail:"formula.functionList.PERCENTRANK.functionParameter.array.detail",example:"A1:A4",require:1,repeat:0},{name:"formula.functionList.PERCENTRANK.functionParameter.x.name",detail:"formula.functionList.PERCENTRANK.functionParameter.x.detail",example:"1.5",require:1,repeat:0},{name:"formula.functionList.PERCENTRANK.functionParameter.significance.name",detail:"formula.functionList.PERCENTRANK.functionParameter.significance.detail",example:"3",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_COMPATIBILITY.POISSON,functionType:t.FunctionType.Compatibility,description:"formula.functionList.POISSON.description",abstract:"formula.functionList.POISSON.abstract",functionParameter:[{name:"formula.functionList.POISSON.functionParameter.x.name",detail:"formula.functionList.POISSON.functionParameter.x.detail",example:"2",require:1,repeat:0},{name:"formula.functionList.POISSON.functionParameter.mean.name",detail:"formula.functionList.POISSON.functionParameter.mean.detail",example:"5",require:1,repeat:0},{name:"formula.functionList.POISSON.functionParameter.cumulative.name",detail:"formula.functionList.POISSON.functionParameter.cumulative.detail",example:"true",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_COMPATIBILITY.QUARTILE,functionType:t.FunctionType.Compatibility,description:"formula.functionList.QUARTILE.description",abstract:"formula.functionList.QUARTILE.abstract",functionParameter:[{name:"formula.functionList.QUARTILE.functionParameter.array.name",detail:"formula.functionList.QUARTILE.functionParameter.array.detail",example:"A1:A4",require:1,repeat:0},{name:"formula.functionList.QUARTILE.functionParameter.quart.name",detail:"formula.functionList.QUARTILE.functionParameter.quart.detail",example:"1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_COMPATIBILITY.RANK,functionType:t.FunctionType.Compatibility,description:"formula.functionList.RANK.description",abstract:"formula.functionList.RANK.abstract",functionParameter:[{name:"formula.functionList.RANK.functionParameter.number.name",detail:"formula.functionList.RANK.functionParameter.number.detail",example:"A3",require:1,repeat:0},{name:"formula.functionList.RANK.functionParameter.ref.name",detail:"formula.functionList.RANK.functionParameter.ref.detail",example:"A2:A6",require:1,repeat:0},{name:"formula.functionList.RANK.functionParameter.order.name",detail:"formula.functionList.RANK.functionParameter.order.detail",example:"1",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_COMPATIBILITY.STDEV,functionType:t.FunctionType.Compatibility,description:"formula.functionList.STDEV.description",abstract:"formula.functionList.STDEV.abstract",functionParameter:[{name:"formula.functionList.STDEV.functionParameter.number1.name",detail:"formula.functionList.STDEV.functionParameter.number1.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.STDEV.functionParameter.number2.name",detail:"formula.functionList.STDEV.functionParameter.number2.detail",example:"2",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_COMPATIBILITY.STDEVP,functionType:t.FunctionType.Compatibility,description:"formula.functionList.STDEVP.description",abstract:"formula.functionList.STDEVP.abstract",functionParameter:[{name:"formula.functionList.STDEVP.functionParameter.number1.name",detail:"formula.functionList.STDEVP.functionParameter.number1.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.STDEVP.functionParameter.number2.name",detail:"formula.functionList.STDEVP.functionParameter.number2.detail",example:"2",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_COMPATIBILITY.TDIST,functionType:t.FunctionType.Compatibility,description:"formula.functionList.TDIST.description",abstract:"formula.functionList.TDIST.abstract",functionParameter:[{name:"formula.functionList.TDIST.functionParameter.x.name",detail:"formula.functionList.TDIST.functionParameter.x.detail",example:"8",require:1,repeat:0},{name:"formula.functionList.TDIST.functionParameter.degFreedom.name",detail:"formula.functionList.TDIST.functionParameter.degFreedom.detail",example:"3",require:1,repeat:0},{name:"formula.functionList.TDIST.functionParameter.tails.name",detail:"formula.functionList.TDIST.functionParameter.tails.detail",example:"1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_COMPATIBILITY.TINV,functionType:t.FunctionType.Compatibility,description:"formula.functionList.TINV.description",abstract:"formula.functionList.TINV.abstract",functionParameter:[{name:"formula.functionList.TINV.functionParameter.probability.name",detail:"formula.functionList.TINV.functionParameter.probability.detail",example:"0.75",require:1,repeat:0},{name:"formula.functionList.TINV.functionParameter.degFreedom.name",detail:"formula.functionList.TINV.functionParameter.degFreedom.detail",example:"2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_COMPATIBILITY.TTEST,functionType:t.FunctionType.Compatibility,description:"formula.functionList.TTEST.description",abstract:"formula.functionList.TTEST.abstract",functionParameter:[{name:"formula.functionList.TTEST.functionParameter.array1.name",detail:"formula.functionList.TTEST.functionParameter.array1.detail",example:"A1:A4",require:1,repeat:0},{name:"formula.functionList.TTEST.functionParameter.array2.name",detail:"formula.functionList.TTEST.functionParameter.array2.detail",example:"B1:B4",require:1,repeat:0},{name:"formula.functionList.TTEST.functionParameter.tails.name",detail:"formula.functionList.TTEST.functionParameter.tails.detail",example:"2",require:1,repeat:0},{name:"formula.functionList.TTEST.functionParameter.type.name",detail:"formula.functionList.TTEST.functionParameter.type.detail",example:"1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_COMPATIBILITY.VAR,functionType:t.FunctionType.Compatibility,description:"formula.functionList.VAR.description",abstract:"formula.functionList.VAR.abstract",functionParameter:[{name:"formula.functionList.VAR.functionParameter.number1.name",detail:"formula.functionList.VAR.functionParameter.number1.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.VAR.functionParameter.number2.name",detail:"formula.functionList.VAR.functionParameter.number2.detail",example:"2",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_COMPATIBILITY.VARP,functionType:t.FunctionType.Compatibility,description:"formula.functionList.VARP.description",abstract:"formula.functionList.VARP.abstract",functionParameter:[{name:"formula.functionList.VARP.functionParameter.number1.name",detail:"formula.functionList.VARP.functionParameter.number1.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.VARP.functionParameter.number2.name",detail:"formula.functionList.VARP.functionParameter.number2.detail",example:"2",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_COMPATIBILITY.WEIBULL,functionType:t.FunctionType.Compatibility,description:"formula.functionList.WEIBULL.description",abstract:"formula.functionList.WEIBULL.abstract",functionParameter:[{name:"formula.functionList.WEIBULL.functionParameter.x.name",detail:"formula.functionList.WEIBULL.functionParameter.x.detail",example:"105",require:1,repeat:0},{name:"formula.functionList.WEIBULL.functionParameter.alpha.name",detail:"formula.functionList.WEIBULL.functionParameter.alpha.detail",example:"20",require:1,repeat:0},{name:"formula.functionList.WEIBULL.functionParameter.beta.name",detail:"formula.functionList.WEIBULL.functionParameter.beta.detail",example:"100",require:1,repeat:0},{name:"formula.functionList.WEIBULL.functionParameter.cumulative.name",detail:"formula.functionList.WEIBULL.functionParameter.cumulative.detail",example:"true",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_COMPATIBILITY.ZTEST,functionType:t.FunctionType.Compatibility,description:"formula.functionList.ZTEST.description",abstract:"formula.functionList.ZTEST.abstract",functionParameter:[{name:"formula.functionList.ZTEST.functionParameter.array.name",detail:"formula.functionList.ZTEST.functionParameter.array.detail",example:"A2:A11",require:1,repeat:0},{name:"formula.functionList.ZTEST.functionParameter.x.name",detail:"formula.functionList.ZTEST.functionParameter.x.detail",example:"4",require:1,repeat:0},{name:"formula.functionList.ZTEST.functionParameter.sigma.name",detail:"formula.functionList.ZTEST.functionParameter.sigma.detail",example:"10",require:0,repeat:0}]}],We=[{functionName:t.FUNCTION_NAMES_CUBE.CUBEKPIMEMBER,functionType:t.FunctionType.Cube,description:"formula.functionList.CUBEKPIMEMBER.description",abstract:"formula.functionList.CUBEKPIMEMBER.abstract",functionParameter:[{name:"formula.functionList.CUBEKPIMEMBER.functionParameter.number1.name",detail:"formula.functionList.CUBEKPIMEMBER.functionParameter.number1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.CUBEKPIMEMBER.functionParameter.number2.name",detail:"formula.functionList.CUBEKPIMEMBER.functionParameter.number2.detail",example:"A1:A20",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_CUBE.CUBEMEMBER,functionType:t.FunctionType.Cube,description:"formula.functionList.CUBEMEMBER.description",abstract:"formula.functionList.CUBEMEMBER.abstract",functionParameter:[{name:"formula.functionList.CUBEMEMBER.functionParameter.number1.name",detail:"formula.functionList.CUBEMEMBER.functionParameter.number1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.CUBEMEMBER.functionParameter.number2.name",detail:"formula.functionList.CUBEMEMBER.functionParameter.number2.detail",example:"A1:A20",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_CUBE.CUBEMEMBERPROPERTY,functionType:t.FunctionType.Cube,description:"formula.functionList.CUBEMEMBERPROPERTY.description",abstract:"formula.functionList.CUBEMEMBERPROPERTY.abstract",functionParameter:[{name:"formula.functionList.CUBEMEMBERPROPERTY.functionParameter.number1.name",detail:"formula.functionList.CUBEMEMBERPROPERTY.functionParameter.number1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.CUBEMEMBERPROPERTY.functionParameter.number2.name",detail:"formula.functionList.CUBEMEMBERPROPERTY.functionParameter.number2.detail",example:"A1:A20",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_CUBE.CUBERANKEDMEMBER,functionType:t.FunctionType.Cube,description:"formula.functionList.CUBERANKEDMEMBER.description",abstract:"formula.functionList.CUBERANKEDMEMBER.abstract",functionParameter:[{name:"formula.functionList.CUBERANKEDMEMBER.functionParameter.number1.name",detail:"formula.functionList.CUBERANKEDMEMBER.functionParameter.number1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.CUBERANKEDMEMBER.functionParameter.number2.name",detail:"formula.functionList.CUBERANKEDMEMBER.functionParameter.number2.detail",example:"A1:A20",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_CUBE.CUBESET,functionType:t.FunctionType.Cube,description:"formula.functionList.CUBESET.description",abstract:"formula.functionList.CUBESET.abstract",functionParameter:[{name:"formula.functionList.CUBESET.functionParameter.number1.name",detail:"formula.functionList.CUBESET.functionParameter.number1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.CUBESET.functionParameter.number2.name",detail:"formula.functionList.CUBESET.functionParameter.number2.detail",example:"A1:A20",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_CUBE.CUBESETCOUNT,functionType:t.FunctionType.Cube,description:"formula.functionList.CUBESETCOUNT.description",abstract:"formula.functionList.CUBESETCOUNT.abstract",functionParameter:[{name:"formula.functionList.CUBESETCOUNT.functionParameter.number1.name",detail:"formula.functionList.CUBESETCOUNT.functionParameter.number1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.CUBESETCOUNT.functionParameter.number2.name",detail:"formula.functionList.CUBESETCOUNT.functionParameter.number2.detail",example:"A1:A20",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_CUBE.CUBEVALUE,functionType:t.FunctionType.Cube,description:"formula.functionList.CUBEVALUE.description",abstract:"formula.functionList.CUBEVALUE.abstract",functionParameter:[{name:"formula.functionList.CUBEVALUE.functionParameter.number1.name",detail:"formula.functionList.CUBEVALUE.functionParameter.number1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.CUBEVALUE.functionParameter.number2.name",detail:"formula.functionList.CUBEVALUE.functionParameter.number2.detail",example:"A1:A20",require:1,repeat:0}]}],ge=[{functionName:t.FUNCTION_NAMES_DATABASE.DAVERAGE,functionType:t.FunctionType.Database,description:"formula.functionList.DAVERAGE.description",abstract:"formula.functionList.DAVERAGE.abstract",functionParameter:[{name:"formula.functionList.DAVERAGE.functionParameter.database.name",detail:"formula.functionList.DAVERAGE.functionParameter.database.detail",example:"A4:E10",require:1,repeat:0},{name:"formula.functionList.DAVERAGE.functionParameter.field.name",detail:"formula.functionList.DAVERAGE.functionParameter.field.detail",example:"D4",require:1,repeat:0},{name:"formula.functionList.DAVERAGE.functionParameter.criteria.name",detail:"formula.functionList.DAVERAGE.functionParameter.criteria.detail",example:"A1:B2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATABASE.DCOUNT,functionType:t.FunctionType.Database,description:"formula.functionList.DCOUNT.description",abstract:"formula.functionList.DCOUNT.abstract",functionParameter:[{name:"formula.functionList.DCOUNT.functionParameter.database.name",detail:"formula.functionList.DCOUNT.functionParameter.database.detail",example:"A4:E10",require:1,repeat:0},{name:"formula.functionList.DCOUNT.functionParameter.field.name",detail:"formula.functionList.DCOUNT.functionParameter.field.detail",example:"D4",require:1,repeat:0},{name:"formula.functionList.DCOUNT.functionParameter.criteria.name",detail:"formula.functionList.DCOUNT.functionParameter.criteria.detail",example:"A1:B2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATABASE.DCOUNTA,functionType:t.FunctionType.Database,description:"formula.functionList.DCOUNTA.description",abstract:"formula.functionList.DCOUNTA.abstract",functionParameter:[{name:"formula.functionList.DCOUNTA.functionParameter.database.name",detail:"formula.functionList.DCOUNTA.functionParameter.database.detail",example:"A4:E10",require:1,repeat:0},{name:"formula.functionList.DCOUNTA.functionParameter.field.name",detail:"formula.functionList.DCOUNTA.functionParameter.field.detail",example:"D4",require:1,repeat:0},{name:"formula.functionList.DCOUNTA.functionParameter.criteria.name",detail:"formula.functionList.DCOUNTA.functionParameter.criteria.detail",example:"A1:B2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATABASE.DGET,functionType:t.FunctionType.Database,description:"formula.functionList.DGET.description",abstract:"formula.functionList.DGET.abstract",functionParameter:[{name:"formula.functionList.DGET.functionParameter.database.name",detail:"formula.functionList.DGET.functionParameter.database.detail",example:"A4:E10",require:1,repeat:0},{name:"formula.functionList.DGET.functionParameter.field.name",detail:"formula.functionList.DGET.functionParameter.field.detail",example:"D4",require:1,repeat:0},{name:"formula.functionList.DGET.functionParameter.criteria.name",detail:"formula.functionList.DGET.functionParameter.criteria.detail",example:"A1:B2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATABASE.DMAX,functionType:t.FunctionType.Database,description:"formula.functionList.DMAX.description",abstract:"formula.functionList.DMAX.abstract",functionParameter:[{name:"formula.functionList.DMAX.functionParameter.database.name",detail:"formula.functionList.DMAX.functionParameter.database.detail",example:"A4:E10",require:1,repeat:0},{name:"formula.functionList.DMAX.functionParameter.field.name",detail:"formula.functionList.DMAX.functionParameter.field.detail",example:"D4",require:1,repeat:0},{name:"formula.functionList.DMAX.functionParameter.criteria.name",detail:"formula.functionList.DMAX.functionParameter.criteria.detail",example:"A1:B2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATABASE.DMIN,functionType:t.FunctionType.Database,description:"formula.functionList.DMIN.description",abstract:"formula.functionList.DMIN.abstract",functionParameter:[{name:"formula.functionList.DMIN.functionParameter.database.name",detail:"formula.functionList.DMIN.functionParameter.database.detail",example:"A4:E10",require:1,repeat:0},{name:"formula.functionList.DMIN.functionParameter.field.name",detail:"formula.functionList.DMIN.functionParameter.field.detail",example:"D4",require:1,repeat:0},{name:"formula.functionList.DMIN.functionParameter.criteria.name",detail:"formula.functionList.DMIN.functionParameter.criteria.detail",example:"A1:B2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATABASE.DPRODUCT,functionType:t.FunctionType.Database,description:"formula.functionList.DPRODUCT.description",abstract:"formula.functionList.DPRODUCT.abstract",functionParameter:[{name:"formula.functionList.DPRODUCT.functionParameter.database.name",detail:"formula.functionList.DPRODUCT.functionParameter.database.detail",example:"A4:E10",require:1,repeat:0},{name:"formula.functionList.DPRODUCT.functionParameter.field.name",detail:"formula.functionList.DPRODUCT.functionParameter.field.detail",example:"D4",require:1,repeat:0},{name:"formula.functionList.DPRODUCT.functionParameter.criteria.name",detail:"formula.functionList.DPRODUCT.functionParameter.criteria.detail",example:"A1:B2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATABASE.DSTDEV,functionType:t.FunctionType.Database,description:"formula.functionList.DSTDEV.description",abstract:"formula.functionList.DSTDEV.abstract",functionParameter:[{name:"formula.functionList.DSTDEV.functionParameter.database.name",detail:"formula.functionList.DSTDEV.functionParameter.database.detail",example:"A4:E10",require:1,repeat:0},{name:"formula.functionList.DSTDEV.functionParameter.field.name",detail:"formula.functionList.DSTDEV.functionParameter.field.detail",example:"D4",require:1,repeat:0},{name:"formula.functionList.DSTDEV.functionParameter.criteria.name",detail:"formula.functionList.DSTDEV.functionParameter.criteria.detail",example:"A1:B2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATABASE.DSTDEVP,functionType:t.FunctionType.Database,description:"formula.functionList.DSTDEVP.description",abstract:"formula.functionList.DSTDEVP.abstract",functionParameter:[{name:"formula.functionList.DSTDEVP.functionParameter.database.name",detail:"formula.functionList.DSTDEVP.functionParameter.database.detail",example:"A4:E10",require:1,repeat:0},{name:"formula.functionList.DSTDEVP.functionParameter.field.name",detail:"formula.functionList.DSTDEVP.functionParameter.field.detail",example:"D4",require:1,repeat:0},{name:"formula.functionList.DSTDEVP.functionParameter.criteria.name",detail:"formula.functionList.DSTDEVP.functionParameter.criteria.detail",example:"A1:B2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATABASE.DSUM,functionType:t.FunctionType.Database,description:"formula.functionList.DSUM.description",abstract:"formula.functionList.DSUM.abstract",functionParameter:[{name:"formula.functionList.DSUM.functionParameter.database.name",detail:"formula.functionList.DSUM.functionParameter.database.detail",example:"A4:E10",require:1,repeat:0},{name:"formula.functionList.DSUM.functionParameter.field.name",detail:"formula.functionList.DSUM.functionParameter.field.detail",example:"D4",require:1,repeat:0},{name:"formula.functionList.DSUM.functionParameter.criteria.name",detail:"formula.functionList.DSUM.functionParameter.criteria.detail",example:"A1:B2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATABASE.DVAR,functionType:t.FunctionType.Database,description:"formula.functionList.DVAR.description",abstract:"formula.functionList.DVAR.abstract",functionParameter:[{name:"formula.functionList.DVAR.functionParameter.database.name",detail:"formula.functionList.DVAR.functionParameter.database.detail",example:"A4:E10",require:1,repeat:0},{name:"formula.functionList.DVAR.functionParameter.field.name",detail:"formula.functionList.DVAR.functionParameter.field.detail",example:"D4",require:1,repeat:0},{name:"formula.functionList.DVAR.functionParameter.criteria.name",detail:"formula.functionList.DVAR.functionParameter.criteria.detail",example:"A1:B2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATABASE.DVARP,functionType:t.FunctionType.Database,description:"formula.functionList.DVARP.description",abstract:"formula.functionList.DVARP.abstract",functionParameter:[{name:"formula.functionList.DVARP.functionParameter.database.name",detail:"formula.functionList.DVARP.functionParameter.database.detail",example:"A4:E10",require:1,repeat:0},{name:"formula.functionList.DVARP.functionParameter.field.name",detail:"formula.functionList.DVARP.functionParameter.field.detail",example:"D4",require:1,repeat:0},{name:"formula.functionList.DVARP.functionParameter.criteria.name",detail:"formula.functionList.DVARP.functionParameter.criteria.detail",example:"A1:B2",require:1,repeat:0}]}],Ke=[{functionName:t.FUNCTION_NAMES_DATE.DATE,functionType:t.FunctionType.Date,description:"formula.functionList.DATE.description",abstract:"formula.functionList.DATE.abstract",functionParameter:[{name:"formula.functionList.DATE.functionParameter.year.name",detail:"formula.functionList.DATE.functionParameter.year.detail",example:"2024",require:1,repeat:0},{name:"formula.functionList.DATE.functionParameter.month.name",detail:"formula.functionList.DATE.functionParameter.month.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.DATE.functionParameter.day.name",detail:"formula.functionList.DATE.functionParameter.day.detail",example:"1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATE.DATEDIF,functionType:t.FunctionType.Date,description:"formula.functionList.DATEDIF.description",abstract:"formula.functionList.DATEDIF.abstract",functionParameter:[{name:"formula.functionList.DATEDIF.functionParameter.startDate.name",detail:"formula.functionList.DATEDIF.functionParameter.startDate.detail",example:'"2001-6-1"',require:1,repeat:0},{name:"formula.functionList.DATEDIF.functionParameter.endDate.name",detail:"formula.functionList.DATEDIF.functionParameter.endDate.detail",example:'"2002-8-15"',require:1,repeat:0},{name:"formula.functionList.DATEDIF.functionParameter.method.name",detail:"formula.functionList.DATEDIF.functionParameter.method.detail",example:'"D"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATE.DATEVALUE,functionType:t.FunctionType.Date,description:"formula.functionList.DATEVALUE.description",abstract:"formula.functionList.DATEVALUE.abstract",functionParameter:[{name:"formula.functionList.DATEVALUE.functionParameter.dateText.name",detail:"formula.functionList.DATEVALUE.functionParameter.dateText.detail",example:'"2024-8-8"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATE.DAY,functionType:t.FunctionType.Date,description:"formula.functionList.DAY.description",abstract:"formula.functionList.DAY.abstract",functionParameter:[{name:"formula.functionList.DAY.functionParameter.serialNumber.name",detail:"formula.functionList.DAY.functionParameter.serialNumber.detail",example:'"1969-7-20"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATE.DAYS,functionType:t.FunctionType.Date,description:"formula.functionList.DAYS.description",abstract:"formula.functionList.DAYS.abstract",functionParameter:[{name:"formula.functionList.DAYS.functionParameter.endDate.name",detail:"formula.functionList.DAYS.functionParameter.endDate.detail",example:'"2021-12-31"',require:1,repeat:0},{name:"formula.functionList.DAYS.functionParameter.startDate.name",detail:"formula.functionList.DAYS.functionParameter.startDate.detail",example:'"2021-1-1"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATE.DAYS360,functionType:t.FunctionType.Date,description:"formula.functionList.DAYS360.description",abstract:"formula.functionList.DAYS360.abstract",functionParameter:[{name:"formula.functionList.DAYS360.functionParameter.startDate.name",detail:"formula.functionList.DAYS360.functionParameter.startDate.detail",example:'"2021-1-29"',require:1,repeat:0},{name:"formula.functionList.DAYS360.functionParameter.endDate.name",detail:"formula.functionList.DAYS360.functionParameter.endDate.detail",example:'"2021-3-31"',require:1,repeat:0},{name:"formula.functionList.DAYS360.functionParameter.method.name",detail:"formula.functionList.DAYS360.functionParameter.method.detail",example:"1",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATE.EDATE,functionType:t.FunctionType.Date,description:"formula.functionList.EDATE.description",abstract:"formula.functionList.EDATE.abstract",functionParameter:[{name:"formula.functionList.EDATE.functionParameter.startDate.name",detail:"formula.functionList.EDATE.functionParameter.startDate.detail",example:"A1",require:1,repeat:0},{name:"formula.functionList.EDATE.functionParameter.months.name",detail:"formula.functionList.EDATE.functionParameter.months.detail",example:"1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATE.EOMONTH,functionType:t.FunctionType.Date,description:"formula.functionList.EOMONTH.description",abstract:"formula.functionList.EOMONTH.abstract",functionParameter:[{name:"formula.functionList.EOMONTH.functionParameter.startDate.name",detail:"formula.functionList.EOMONTH.functionParameter.startDate.detail",example:'"2011-1-1"',require:1,repeat:0},{name:"formula.functionList.EOMONTH.functionParameter.months.name",detail:"formula.functionList.EOMONTH.functionParameter.months.detail",example:"1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATE.EPOCHTODATE,functionType:t.FunctionType.Date,description:"formula.functionList.EPOCHTODATE.description",abstract:"formula.functionList.EPOCHTODATE.abstract",functionParameter:[{name:"formula.functionList.EPOCHTODATE.functionParameter.timestamp.name",detail:"formula.functionList.EPOCHTODATE.functionParameter.timestamp.detail",example:"1655906710",require:1,repeat:0},{name:"formula.functionList.EPOCHTODATE.functionParameter.unit.name",detail:"formula.functionList.EPOCHTODATE.functionParameter.unit.detail",example:"1",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATE.HOUR,functionType:t.FunctionType.Date,description:"formula.functionList.HOUR.description",abstract:"formula.functionList.HOUR.abstract",functionParameter:[{name:"formula.functionList.HOUR.functionParameter.serialNumber.name",detail:"formula.functionList.HOUR.functionParameter.serialNumber.detail",example:'"2011-7-18 7:45"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATE.ISOWEEKNUM,functionType:t.FunctionType.Date,description:"formula.functionList.ISOWEEKNUM.description",abstract:"formula.functionList.ISOWEEKNUM.abstract",functionParameter:[{name:"formula.functionList.ISOWEEKNUM.functionParameter.date.name",detail:"formula.functionList.ISOWEEKNUM.functionParameter.date.detail",example:'"2012-3-9"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATE.MINUTE,functionType:t.FunctionType.Date,description:"formula.functionList.MINUTE.description",abstract:"formula.functionList.MINUTE.abstract",functionParameter:[{name:"formula.functionList.MINUTE.functionParameter.serialNumber.name",detail:"formula.functionList.MINUTE.functionParameter.serialNumber.detail",example:'"12:45"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATE.MONTH,functionType:t.FunctionType.Date,description:"formula.functionList.MONTH.description",abstract:"formula.functionList.MONTH.abstract",functionParameter:[{name:"formula.functionList.MONTH.functionParameter.serialNumber.name",detail:"formula.functionList.MONTH.functionParameter.serialNumber.detail",example:'"1969-7-20"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATE.NETWORKDAYS,functionType:t.FunctionType.Date,description:"formula.functionList.NETWORKDAYS.description",abstract:"formula.functionList.NETWORKDAYS.abstract",functionParameter:[{name:"formula.functionList.NETWORKDAYS.functionParameter.startDate.name",detail:"formula.functionList.NETWORKDAYS.functionParameter.startDate.detail",example:'"2012-10-1"',require:1,repeat:0},{name:"formula.functionList.NETWORKDAYS.functionParameter.endDate.name",detail:"formula.functionList.NETWORKDAYS.functionParameter.endDate.detail",example:'"2013-3-1"',require:1,repeat:0},{name:"formula.functionList.NETWORKDAYS.functionParameter.holidays.name",detail:"formula.functionList.NETWORKDAYS.functionParameter.holidays.detail",example:'"2012-11-22"',require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATE.NETWORKDAYS_INTL,functionType:t.FunctionType.Date,description:"formula.functionList.NETWORKDAYS_INTL.description",abstract:"formula.functionList.NETWORKDAYS_INTL.abstract",functionParameter:[{name:"formula.functionList.NETWORKDAYS_INTL.functionParameter.startDate.name",detail:"formula.functionList.NETWORKDAYS_INTL.functionParameter.startDate.detail",example:'"2012-10-1"',require:1,repeat:0},{name:"formula.functionList.NETWORKDAYS_INTL.functionParameter.endDate.name",detail:"formula.functionList.NETWORKDAYS_INTL.functionParameter.endDate.detail",example:'"2013-3-1"',require:1,repeat:0},{name:"formula.functionList.NETWORKDAYS_INTL.functionParameter.weekend.name",detail:"formula.functionList.NETWORKDAYS_INTL.functionParameter.weekend.detail",example:"6",require:0,repeat:0},{name:"formula.functionList.NETWORKDAYS_INTL.functionParameter.holidays.name",detail:"formula.functionList.NETWORKDAYS_INTL.functionParameter.holidays.detail",example:'"2012-11-22"',require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATE.NOW,functionType:t.FunctionType.Date,description:"formula.functionList.NOW.description",abstract:"formula.functionList.NOW.abstract",functionParameter:[]},{functionName:t.FUNCTION_NAMES_DATE.SECOND,functionType:t.FunctionType.Date,description:"formula.functionList.SECOND.description",abstract:"formula.functionList.SECOND.abstract",functionParameter:[{name:"formula.functionList.SECOND.functionParameter.serialNumber.name",detail:"formula.functionList.SECOND.functionParameter.serialNumber.detail",example:'"4:48:18"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATE.TIME,functionType:t.FunctionType.Date,description:"formula.functionList.TIME.description",abstract:"formula.functionList.TIME.abstract",functionParameter:[{name:"formula.functionList.TIME.functionParameter.hour.name",detail:"formula.functionList.TIME.functionParameter.hour.detail",example:"15",require:1,repeat:0},{name:"formula.functionList.TIME.functionParameter.minute.name",detail:"formula.functionList.TIME.functionParameter.minute.detail",example:"20",require:1,repeat:0},{name:"formula.functionList.TIME.functionParameter.second.name",detail:"formula.functionList.TIME.functionParameter.second.detail",example:"59",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATE.TIMEVALUE,functionType:t.FunctionType.Date,description:"formula.functionList.TIMEVALUE.description",abstract:"formula.functionList.TIMEVALUE.abstract",functionParameter:[{name:"formula.functionList.TIMEVALUE.functionParameter.timeText.name",detail:"formula.functionList.TIMEVALUE.functionParameter.timeText.detail",example:'"15:20:59"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATE.TO_DATE,functionType:t.FunctionType.Date,description:"formula.functionList.TO_DATE.description",abstract:"formula.functionList.TO_DATE.abstract",functionParameter:[{name:"formula.functionList.TO_DATE.functionParameter.value.name",detail:"formula.functionList.TO_DATE.functionParameter.value.detail",example:"40826.4375",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATE.TODAY,functionType:t.FunctionType.Date,description:"formula.functionList.TODAY.description",abstract:"formula.functionList.TODAY.abstract",functionParameter:[]},{functionName:t.FUNCTION_NAMES_DATE.WEEKDAY,functionType:t.FunctionType.Date,description:"formula.functionList.WEEKDAY.description",abstract:"formula.functionList.WEEKDAY.abstract",functionParameter:[{name:"formula.functionList.WEEKDAY.functionParameter.serialNumber.name",detail:"formula.functionList.WEEKDAY.functionParameter.serialNumber.detail",example:'"2008-2-14"',require:1,repeat:0},{name:"formula.functionList.WEEKDAY.functionParameter.returnType.name",detail:"formula.functionList.WEEKDAY.functionParameter.returnType.detail",example:"2",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATE.WEEKNUM,functionType:t.FunctionType.Date,description:"formula.functionList.WEEKNUM.description",abstract:"formula.functionList.WEEKNUM.abstract",functionParameter:[{name:"formula.functionList.WEEKNUM.functionParameter.serialNumber.name",detail:"formula.functionList.WEEKNUM.functionParameter.serialNumber.detail",example:'"2012-3-9"',require:1,repeat:0},{name:"formula.functionList.WEEKNUM.functionParameter.returnType.name",detail:"formula.functionList.WEEKNUM.functionParameter.returnType.detail",example:"2",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATE.WORKDAY,functionType:t.FunctionType.Date,description:"formula.functionList.WORKDAY.description",abstract:"formula.functionList.WORKDAY.abstract",functionParameter:[{name:"formula.functionList.WORKDAY.functionParameter.startDate.name",detail:"formula.functionList.WORKDAY.functionParameter.startDate.detail",example:'"2008-10-1"',require:1,repeat:0},{name:"formula.functionList.WORKDAY.functionParameter.days.name",detail:"formula.functionList.WORKDAY.functionParameter.days.detail",example:"151",require:1,repeat:0},{name:"formula.functionList.WORKDAY.functionParameter.holidays.name",detail:"formula.functionList.WORKDAY.functionParameter.holidays.detail",example:'"2008-11-26"',require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATE.WORKDAY_INTL,functionType:t.FunctionType.Date,description:"formula.functionList.WORKDAY_INTL.description",abstract:"formula.functionList.WORKDAY_INTL.abstract",functionParameter:[{name:"formula.functionList.WORKDAY_INTL.functionParameter.startDate.name",detail:"formula.functionList.WORKDAY_INTL.functionParameter.startDate.detail",example:'"2008-10-1"',require:1,repeat:0},{name:"formula.functionList.WORKDAY_INTL.functionParameter.days.name",detail:"formula.functionList.WORKDAY_INTL.functionParameter.days.detail",example:"151",require:1,repeat:0},{name:"formula.functionList.WORKDAY_INTL.functionParameter.weekend.name",detail:"formula.functionList.WORKDAY_INTL.functionParameter.weekend.detail",example:"6",require:0,repeat:0},{name:"formula.functionList.WORKDAY_INTL.functionParameter.holidays.name",detail:"formula.functionList.WORKDAY_INTL.functionParameter.holidays.detail",example:'"2008-11-26"',require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATE.YEAR,functionType:t.FunctionType.Date,description:"formula.functionList.YEAR.description",abstract:"formula.functionList.YEAR.abstract",functionParameter:[{name:"formula.functionList.YEAR.functionParameter.serialNumber.name",detail:"formula.functionList.YEAR.functionParameter.serialNumber.detail",example:'"1969-7-20"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATE.YEARFRAC,functionType:t.FunctionType.Date,description:"formula.functionList.YEARFRAC.description",abstract:"formula.functionList.YEARFRAC.abstract",functionParameter:[{name:"formula.functionList.YEARFRAC.functionParameter.startDate.name",detail:"formula.functionList.YEARFRAC.functionParameter.startDate.detail",example:'"2012-1-1"',require:1,repeat:0},{name:"formula.functionList.YEARFRAC.functionParameter.endDate.name",detail:"formula.functionList.YEARFRAC.functionParameter.endDate.detail",example:'"2012-7-30"',require:1,repeat:0},{name:"formula.functionList.YEARFRAC.functionParameter.basis.name",detail:"formula.functionList.YEARFRAC.functionParameter.basis.detail",example:"1",require:0,repeat:0}]}],ke=[{functionName:t.FUNCTION_NAMES_ENGINEERING.BESSELI,functionType:t.FunctionType.Engineering,description:"formula.functionList.BESSELI.description",abstract:"formula.functionList.BESSELI.abstract",functionParameter:[{name:"formula.functionList.BESSELI.functionParameter.x.name",detail:"formula.functionList.BESSELI.functionParameter.x.detail",example:"1.5",require:1,repeat:0},{name:"formula.functionList.BESSELI.functionParameter.n.name",detail:"formula.functionList.BESSELI.functionParameter.n.detail",example:"1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.BESSELJ,functionType:t.FunctionType.Engineering,description:"formula.functionList.BESSELJ.description",abstract:"formula.functionList.BESSELJ.abstract",functionParameter:[{name:"formula.functionList.BESSELJ.functionParameter.x.name",detail:"formula.functionList.BESSELJ.functionParameter.x.detail",example:"1.5",require:1,repeat:0},{name:"formula.functionList.BESSELJ.functionParameter.n.name",detail:"formula.functionList.BESSELJ.functionParameter.n.detail",example:"1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.BESSELK,functionType:t.FunctionType.Engineering,description:"formula.functionList.BESSELK.description",abstract:"formula.functionList.BESSELK.abstract",functionParameter:[{name:"formula.functionList.BESSELK.functionParameter.x.name",detail:"formula.functionList.BESSELK.functionParameter.x.detail",example:"1.5",require:1,repeat:0},{name:"formula.functionList.BESSELK.functionParameter.n.name",detail:"formula.functionList.BESSELK.functionParameter.n.detail",example:"1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.BESSELY,functionType:t.FunctionType.Engineering,description:"formula.functionList.BESSELY.description",abstract:"formula.functionList.BESSELY.abstract",functionParameter:[{name:"formula.functionList.BESSELY.functionParameter.x.name",detail:"formula.functionList.BESSELY.functionParameter.x.detail",example:"1.5",require:1,repeat:0},{name:"formula.functionList.BESSELY.functionParameter.n.name",detail:"formula.functionList.BESSELY.functionParameter.n.detail",example:"1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.BIN2DEC,functionType:t.FunctionType.Engineering,description:"formula.functionList.BIN2DEC.description",abstract:"formula.functionList.BIN2DEC.abstract",functionParameter:[{name:"formula.functionList.BIN2DEC.functionParameter.number.name",detail:"formula.functionList.BIN2DEC.functionParameter.number.detail",example:"1100100",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.BIN2HEX,functionType:t.FunctionType.Engineering,description:"formula.functionList.BIN2HEX.description",abstract:"formula.functionList.BIN2HEX.abstract",functionParameter:[{name:"formula.functionList.BIN2HEX.functionParameter.number.name",detail:"formula.functionList.BIN2HEX.functionParameter.number.detail",example:"11111011",require:1,repeat:0},{name:"formula.functionList.BIN2HEX.functionParameter.places.name",detail:"formula.functionList.BIN2HEX.functionParameter.places.detail",example:"4",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.BIN2OCT,functionType:t.FunctionType.Engineering,description:"formula.functionList.BIN2OCT.description",abstract:"formula.functionList.BIN2OCT.abstract",functionParameter:[{name:"formula.functionList.BIN2OCT.functionParameter.number.name",detail:"formula.functionList.BIN2OCT.functionParameter.number.detail",example:"1001",require:1,repeat:0},{name:"formula.functionList.BIN2OCT.functionParameter.places.name",detail:"formula.functionList.BIN2OCT.functionParameter.places.detail",example:"3",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.BITAND,functionType:t.FunctionType.Engineering,description:"formula.functionList.BITAND.description",abstract:"formula.functionList.BITAND.abstract",functionParameter:[{name:"formula.functionList.BITAND.functionParameter.number1.name",detail:"formula.functionList.BITAND.functionParameter.number1.detail",example:"13",require:1,repeat:0},{name:"formula.functionList.BITAND.functionParameter.number2.name",detail:"formula.functionList.BITAND.functionParameter.number2.detail",example:"25",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.BITLSHIFT,functionType:t.FunctionType.Engineering,description:"formula.functionList.BITLSHIFT.description",abstract:"formula.functionList.BITLSHIFT.abstract",functionParameter:[{name:"formula.functionList.BITLSHIFT.functionParameter.number.name",detail:"formula.functionList.BITLSHIFT.functionParameter.number.detail",example:"4",require:1,repeat:0},{name:"formula.functionList.BITLSHIFT.functionParameter.shiftAmount.name",detail:"formula.functionList.BITLSHIFT.functionParameter.shiftAmount.detail",example:"2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.BITOR,functionType:t.FunctionType.Engineering,description:"formula.functionList.BITOR.description",abstract:"formula.functionList.BITOR.abstract",functionParameter:[{name:"formula.functionList.BITOR.functionParameter.number1.name",detail:"formula.functionList.BITOR.functionParameter.number1.detail",example:"23",require:1,repeat:0},{name:"formula.functionList.BITOR.functionParameter.number2.name",detail:"formula.functionList.BITOR.functionParameter.number2.detail",example:"10",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.BITRSHIFT,functionType:t.FunctionType.Engineering,description:"formula.functionList.BITRSHIFT.description",abstract:"formula.functionList.BITRSHIFT.abstract",functionParameter:[{name:"formula.functionList.BITRSHIFT.functionParameter.number.name",detail:"formula.functionList.BITRSHIFT.functionParameter.number.detail",example:"13",require:1,repeat:0},{name:"formula.functionList.BITRSHIFT.functionParameter.shiftAmount.name",detail:"formula.functionList.BITRSHIFT.functionParameter.shiftAmount.detail",example:"2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.BITXOR,functionType:t.FunctionType.Engineering,description:"formula.functionList.BITXOR.description",abstract:"formula.functionList.BITXOR.abstract",functionParameter:[{name:"formula.functionList.BITXOR.functionParameter.number1.name",detail:"formula.functionList.BITXOR.functionParameter.number1.detail",example:"5",require:1,repeat:0},{name:"formula.functionList.BITXOR.functionParameter.number2.name",detail:"formula.functionList.BITXOR.functionParameter.number2.detail",example:"3",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.COMPLEX,functionType:t.FunctionType.Engineering,description:"formula.functionList.COMPLEX.description",abstract:"formula.functionList.COMPLEX.abstract",functionParameter:[{name:"formula.functionList.COMPLEX.functionParameter.realNum.name",detail:"formula.functionList.COMPLEX.functionParameter.realNum.detail",example:"3",require:1,repeat:0},{name:"formula.functionList.COMPLEX.functionParameter.iNum.name",detail:"formula.functionList.COMPLEX.functionParameter.iNum.detail",example:"4",require:1,repeat:0},{name:"formula.functionList.COMPLEX.functionParameter.suffix.name",detail:"formula.functionList.COMPLEX.functionParameter.suffix.detail",example:'"i"',require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.CONVERT,functionType:t.FunctionType.Engineering,description:"formula.functionList.CONVERT.description",abstract:"formula.functionList.CONVERT.abstract",functionParameter:[{name:"formula.functionList.CONVERT.functionParameter.number.name",detail:"formula.functionList.CONVERT.functionParameter.number.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.CONVERT.functionParameter.fromUnit.name",detail:"formula.functionList.CONVERT.functionParameter.fromUnit.detail",example:'"lbm"',require:1,repeat:0},{name:"formula.functionList.CONVERT.functionParameter.toUnit.name",detail:"formula.functionList.CONVERT.functionParameter.toUnit.detail",example:'"kg"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.DEC2BIN,functionType:t.FunctionType.Engineering,description:"formula.functionList.DEC2BIN.description",abstract:"formula.functionList.DEC2BIN.abstract",functionParameter:[{name:"formula.functionList.DEC2BIN.functionParameter.number.name",detail:"formula.functionList.DEC2BIN.functionParameter.number.detail",example:"9",require:1,repeat:0},{name:"formula.functionList.DEC2BIN.functionParameter.places.name",detail:"formula.functionList.DEC2BIN.functionParameter.places.detail",example:"4",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.DEC2HEX,functionType:t.FunctionType.Engineering,description:"formula.functionList.DEC2HEX.description",abstract:"formula.functionList.DEC2HEX.abstract",functionParameter:[{name:"formula.functionList.DEC2HEX.functionParameter.number.name",detail:"formula.functionList.DEC2HEX.functionParameter.number.detail",example:"100",require:1,repeat:0},{name:"formula.functionList.DEC2HEX.functionParameter.places.name",detail:"formula.functionList.DEC2HEX.functionParameter.places.detail",example:"4",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.DEC2OCT,functionType:t.FunctionType.Engineering,description:"formula.functionList.DEC2OCT.description",abstract:"formula.functionList.DEC2OCT.abstract",functionParameter:[{name:"formula.functionList.DEC2OCT.functionParameter.number.name",detail:"formula.functionList.DEC2OCT.functionParameter.number.detail",example:"58",require:1,repeat:0},{name:"formula.functionList.DEC2OCT.functionParameter.places.name",detail:"formula.functionList.DEC2OCT.functionParameter.places.detail",example:"3",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.DELTA,functionType:t.FunctionType.Engineering,description:"formula.functionList.DELTA.description",abstract:"formula.functionList.DELTA.abstract",functionParameter:[{name:"formula.functionList.DELTA.functionParameter.number1.name",detail:"formula.functionList.DELTA.functionParameter.number1.detail",example:"5",require:1,repeat:0},{name:"formula.functionList.DELTA.functionParameter.number2.name",detail:"formula.functionList.DELTA.functionParameter.number2.detail",example:"4",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.ERF,functionType:t.FunctionType.Engineering,description:"formula.functionList.ERF.description",abstract:"formula.functionList.ERF.abstract",functionParameter:[{name:"formula.functionList.ERF.functionParameter.lowerLimit.name",detail:"formula.functionList.ERF.functionParameter.lowerLimit.detail",example:"0.745",require:1,repeat:0},{name:"formula.functionList.ERF.functionParameter.upperLimit.name",detail:"formula.functionList.ERF.functionParameter.upperLimit.detail",example:"2",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.ERF_PRECISE,functionType:t.FunctionType.Engineering,description:"formula.functionList.ERF_PRECISE.description",abstract:"formula.functionList.ERF_PRECISE.abstract",functionParameter:[{name:"formula.functionList.ERF_PRECISE.functionParameter.x.name",detail:"formula.functionList.ERF_PRECISE.functionParameter.x.detail",example:"1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.ERFC,functionType:t.FunctionType.Engineering,description:"formula.functionList.ERFC.description",abstract:"formula.functionList.ERFC.abstract",functionParameter:[{name:"formula.functionList.ERFC.functionParameter.x.name",detail:"formula.functionList.ERFC.functionParameter.x.detail",example:"1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.ERFC_PRECISE,functionType:t.FunctionType.Engineering,description:"formula.functionList.ERFC_PRECISE.description",abstract:"formula.functionList.ERFC_PRECISE.abstract",functionParameter:[{name:"formula.functionList.ERFC_PRECISE.functionParameter.x.name",detail:"formula.functionList.ERFC_PRECISE.functionParameter.x.detail",example:"1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.GESTEP,functionType:t.FunctionType.Engineering,description:"formula.functionList.GESTEP.description",abstract:"formula.functionList.GESTEP.abstract",functionParameter:[{name:"formula.functionList.GESTEP.functionParameter.number.name",detail:"formula.functionList.GESTEP.functionParameter.number.detail",example:"5",require:1,repeat:0},{name:"formula.functionList.GESTEP.functionParameter.step.name",detail:"formula.functionList.GESTEP.functionParameter.step.detail",example:"4",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.HEX2BIN,functionType:t.FunctionType.Engineering,description:"formula.functionList.HEX2BIN.description",abstract:"formula.functionList.HEX2BIN.abstract",functionParameter:[{name:"formula.functionList.HEX2BIN.functionParameter.number.name",detail:"formula.functionList.HEX2BIN.functionParameter.number.detail",example:'"F"',require:1,repeat:0},{name:"formula.functionList.HEX2BIN.functionParameter.places.name",detail:"formula.functionList.HEX2BIN.functionParameter.places.detail",example:"8",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.HEX2DEC,functionType:t.FunctionType.Engineering,description:"formula.functionList.HEX2DEC.description",abstract:"formula.functionList.HEX2DEC.abstract",functionParameter:[{name:"formula.functionList.HEX2DEC.functionParameter.number.name",detail:"formula.functionList.HEX2DEC.functionParameter.number.detail",example:'"A5"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.HEX2OCT,functionType:t.FunctionType.Engineering,description:"formula.functionList.HEX2OCT.description",abstract:"formula.functionList.HEX2OCT.abstract",functionParameter:[{name:"formula.functionList.HEX2OCT.functionParameter.number.name",detail:"formula.functionList.HEX2OCT.functionParameter.number.detail",example:'"F"',require:1,repeat:0},{name:"formula.functionList.HEX2OCT.functionParameter.places.name",detail:"formula.functionList.HEX2OCT.functionParameter.places.detail",example:"3",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.IMABS,functionType:t.FunctionType.Engineering,description:"formula.functionList.IMABS.description",abstract:"formula.functionList.IMABS.abstract",functionParameter:[{name:"formula.functionList.IMABS.functionParameter.inumber.name",detail:"formula.functionList.IMABS.functionParameter.inumber.detail",example:'"5+12i"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.IMAGINARY,functionType:t.FunctionType.Engineering,description:"formula.functionList.IMAGINARY.description",abstract:"formula.functionList.IMAGINARY.abstract",functionParameter:[{name:"formula.functionList.IMAGINARY.functionParameter.inumber.name",detail:"formula.functionList.IMAGINARY.functionParameter.inumber.detail",example:'"3+4i"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.IMARGUMENT,functionType:t.FunctionType.Engineering,description:"formula.functionList.IMARGUMENT.description",abstract:"formula.functionList.IMARGUMENT.abstract",functionParameter:[{name:"formula.functionList.IMARGUMENT.functionParameter.inumber.name",detail:"formula.functionList.IMARGUMENT.functionParameter.inumber.detail",example:'"3+4i"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.IMCONJUGATE,functionType:t.FunctionType.Engineering,description:"formula.functionList.IMCONJUGATE.description",abstract:"formula.functionList.IMCONJUGATE.abstract",functionParameter:[{name:"formula.functionList.IMCONJUGATE.functionParameter.inumber.name",detail:"formula.functionList.IMCONJUGATE.functionParameter.inumber.detail",example:'"3+4i"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.IMCOS,functionType:t.FunctionType.Engineering,description:"formula.functionList.IMCOS.description",abstract:"formula.functionList.IMCOS.abstract",functionParameter:[{name:"formula.functionList.IMCOS.functionParameter.inumber.name",detail:"formula.functionList.IMCOS.functionParameter.inumber.detail",example:'"1+i"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.IMCOSH,functionType:t.FunctionType.Engineering,description:"formula.functionList.IMCOSH.description",abstract:"formula.functionList.IMCOSH.abstract",functionParameter:[{name:"formula.functionList.IMCOSH.functionParameter.inumber.name",detail:"formula.functionList.IMCOSH.functionParameter.inumber.detail",example:'"4+3i"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.IMCOT,functionType:t.FunctionType.Engineering,description:"formula.functionList.IMCOT.description",abstract:"formula.functionList.IMCOT.abstract",functionParameter:[{name:"formula.functionList.IMCOT.functionParameter.inumber.name",detail:"formula.functionList.IMCOT.functionParameter.inumber.detail",example:'"4+3i"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.IMCOTH,functionType:t.FunctionType.Engineering,description:"formula.functionList.IMCOTH.description",abstract:"formula.functionList.IMCOTH.abstract",functionParameter:[{name:"formula.functionList.IMCOTH.functionParameter.inumber.name",detail:"formula.functionList.IMCOTH.functionParameter.inumber.detail",example:'"4+3i"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.IMCSC,functionType:t.FunctionType.Engineering,description:"formula.functionList.IMCSC.description",abstract:"formula.functionList.IMCSC.abstract",functionParameter:[{name:"formula.functionList.IMCSC.functionParameter.inumber.name",detail:"formula.functionList.IMCSC.functionParameter.inumber.detail",example:'"4+3i"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.IMCSCH,functionType:t.FunctionType.Engineering,description:"formula.functionList.IMCSCH.description",abstract:"formula.functionList.IMCSCH.abstract",functionParameter:[{name:"formula.functionList.IMCSCH.functionParameter.inumber.name",detail:"formula.functionList.IMCSCH.functionParameter.inumber.detail",example:'"4+3i"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.IMDIV,functionType:t.FunctionType.Engineering,description:"formula.functionList.IMDIV.description",abstract:"formula.functionList.IMDIV.abstract",functionParameter:[{name:"formula.functionList.IMDIV.functionParameter.inumber1.name",detail:"formula.functionList.IMDIV.functionParameter.inumber1.detail",example:'"-238+240i"',require:1,repeat:0},{name:"formula.functionList.IMDIV.functionParameter.inumber2.name",detail:"formula.functionList.IMDIV.functionParameter.inumber2.detail",example:'"10+24i"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.IMEXP,functionType:t.FunctionType.Engineering,description:"formula.functionList.IMEXP.description",abstract:"formula.functionList.IMEXP.abstract",functionParameter:[{name:"formula.functionList.IMEXP.functionParameter.inumber.name",detail:"formula.functionList.IMEXP.functionParameter.inumber.detail",example:'"1+i"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.IMLN,functionType:t.FunctionType.Engineering,description:"formula.functionList.IMLN.description",abstract:"formula.functionList.IMLN.abstract",functionParameter:[{name:"formula.functionList.IMLN.functionParameter.inumber.name",detail:"formula.functionList.IMLN.functionParameter.inumber.detail",example:'"3+4i"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.IMLOG,functionType:t.FunctionType.Engineering,description:"formula.functionList.IMLOG.description",abstract:"formula.functionList.IMLOG.abstract",functionParameter:[{name:"formula.functionList.IMLOG.functionParameter.inumber.name",detail:"formula.functionList.IMLOG.functionParameter.inumber.detail",example:'"3+4i"',require:1,repeat:0},{name:"formula.functionList.IMLOG.functionParameter.base.name",detail:"formula.functionList.IMLOG.functionParameter.base.detail",example:"10",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.IMLOG10,functionType:t.FunctionType.Engineering,description:"formula.functionList.IMLOG10.description",abstract:"formula.functionList.IMLOG10.abstract",functionParameter:[{name:"formula.functionList.IMLOG10.functionParameter.inumber.name",detail:"formula.functionList.IMLOG10.functionParameter.inumber.detail",example:'"3+4i"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.IMLOG2,functionType:t.FunctionType.Engineering,description:"formula.functionList.IMLOG2.description",abstract:"formula.functionList.IMLOG2.abstract",functionParameter:[{name:"formula.functionList.IMLOG2.functionParameter.inumber.name",detail:"formula.functionList.IMLOG2.functionParameter.inumber.detail",example:'"3+4i"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.IMPOWER,functionType:t.FunctionType.Engineering,description:"formula.functionList.IMPOWER.description",abstract:"formula.functionList.IMPOWER.abstract",functionParameter:[{name:"formula.functionList.IMPOWER.functionParameter.inumber.name",detail:"formula.functionList.IMPOWER.functionParameter.inumber.detail",example:'"2+3i"',require:1,repeat:0},{name:"formula.functionList.IMPOWER.functionParameter.number.name",detail:"formula.functionList.IMPOWER.functionParameter.number.detail",example:"3",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.IMPRODUCT,functionType:t.FunctionType.Engineering,description:"formula.functionList.IMPRODUCT.description",abstract:"formula.functionList.IMPRODUCT.abstract",functionParameter:[{name:"formula.functionList.IMPRODUCT.functionParameter.inumber1.name",detail:"formula.functionList.IMPRODUCT.functionParameter.inumber1.detail",example:'"3+4i"',require:1,repeat:0},{name:"formula.functionList.IMPRODUCT.functionParameter.inumber2.name",detail:"formula.functionList.IMPRODUCT.functionParameter.inumber2.detail",example:'"5-3i"',require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.IMREAL,functionType:t.FunctionType.Engineering,description:"formula.functionList.IMREAL.description",abstract:"formula.functionList.IMREAL.abstract",functionParameter:[{name:"formula.functionList.IMREAL.functionParameter.inumber.name",detail:"formula.functionList.IMREAL.functionParameter.inumber.detail",example:'"6-9i"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.IMSEC,functionType:t.FunctionType.Engineering,description:"formula.functionList.IMSEC.description",abstract:"formula.functionList.IMSEC.abstract",functionParameter:[{name:"formula.functionList.IMSEC.functionParameter.inumber.name",detail:"formula.functionList.IMSEC.functionParameter.inumber.detail",example:'"4+3i"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.IMSECH,functionType:t.FunctionType.Engineering,description:"formula.functionList.IMSECH.description",abstract:"formula.functionList.IMSECH.abstract",functionParameter:[{name:"formula.functionList.IMSECH.functionParameter.inumber.name",detail:"formula.functionList.IMSECH.functionParameter.inumber.detail",example:'"4+3i"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.IMSIN,functionType:t.FunctionType.Engineering,description:"formula.functionList.IMSIN.description",abstract:"formula.functionList.IMSIN.abstract",functionParameter:[{name:"formula.functionList.IMSIN.functionParameter.inumber.name",detail:"formula.functionList.IMSIN.functionParameter.inumber.detail",example:'"4+3i"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.IMSINH,functionType:t.FunctionType.Engineering,description:"formula.functionList.IMSINH.description",abstract:"formula.functionList.IMSINH.abstract",functionParameter:[{name:"formula.functionList.IMSINH.functionParameter.inumber.name",detail:"formula.functionList.IMSINH.functionParameter.inumber.detail",example:'"4+3i"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.IMSQRT,functionType:t.FunctionType.Engineering,description:"formula.functionList.IMSQRT.description",abstract:"formula.functionList.IMSQRT.abstract",functionParameter:[{name:"formula.functionList.IMSQRT.functionParameter.inumber.name",detail:"formula.functionList.IMSQRT.functionParameter.inumber.detail",example:'"1+i"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.IMSUB,functionType:t.FunctionType.Engineering,description:"formula.functionList.IMSUB.description",abstract:"formula.functionList.IMSUB.abstract",functionParameter:[{name:"formula.functionList.IMSUB.functionParameter.inumber1.name",detail:"formula.functionList.IMSUB.functionParameter.inumber1.detail",example:'"13+4i"',require:1,repeat:0},{name:"formula.functionList.IMSUB.functionParameter.inumber2.name",detail:"formula.functionList.IMSUB.functionParameter.inumber2.detail",example:'"5+3i"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.IMSUM,functionType:t.FunctionType.Engineering,description:"formula.functionList.IMSUM.description",abstract:"formula.functionList.IMSUM.abstract",functionParameter:[{name:"formula.functionList.IMSUM.functionParameter.inumber1.name",detail:"formula.functionList.IMSUM.functionParameter.inumber1.detail",example:'"3+4i"',require:1,repeat:0},{name:"formula.functionList.IMSUM.functionParameter.inumber2.name",detail:"formula.functionList.IMSUM.functionParameter.inumber2.detail",example:'"5-3i"',require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.IMTAN,functionType:t.FunctionType.Engineering,description:"formula.functionList.IMTAN.description",abstract:"formula.functionList.IMTAN.abstract",functionParameter:[{name:"formula.functionList.IMTAN.functionParameter.inumber.name",detail:"formula.functionList.IMTAN.functionParameter.inumber.detail",example:'"4+3i"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.IMTANH,functionType:t.FunctionType.Engineering,description:"formula.functionList.IMTANH.description",abstract:"formula.functionList.IMTANH.abstract",functionParameter:[{name:"formula.functionList.IMTANH.functionParameter.inumber.name",detail:"formula.functionList.IMTANH.functionParameter.inumber.detail",example:'"4+3i"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.OCT2BIN,functionType:t.FunctionType.Engineering,description:"formula.functionList.OCT2BIN.description",abstract:"formula.functionList.OCT2BIN.abstract",functionParameter:[{name:"formula.functionList.OCT2BIN.functionParameter.number.name",detail:"formula.functionList.OCT2BIN.functionParameter.number.detail",example:"3",require:1,repeat:0},{name:"formula.functionList.OCT2BIN.functionParameter.places.name",detail:"formula.functionList.OCT2BIN.functionParameter.places.detail",example:"3",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.OCT2DEC,functionType:t.FunctionType.Engineering,description:"formula.functionList.OCT2DEC.description",abstract:"formula.functionList.OCT2DEC.abstract",functionParameter:[{name:"formula.functionList.OCT2DEC.functionParameter.number.name",detail:"formula.functionList.OCT2DEC.functionParameter.number.detail",example:"54",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.OCT2HEX,functionType:t.FunctionType.Engineering,description:"formula.functionList.OCT2HEX.description",abstract:"formula.functionList.OCT2HEX.abstract",functionParameter:[{name:"formula.functionList.OCT2HEX.functionParameter.number.name",detail:"formula.functionList.OCT2HEX.functionParameter.number.detail",example:"100",require:1,repeat:0},{name:"formula.functionList.OCT2HEX.functionParameter.places.name",detail:"formula.functionList.OCT2HEX.functionParameter.places.detail",example:"4",require:0,repeat:0}]}],Qe=[{functionName:t.FUNCTION_NAMES_FINANCIAL.ACCRINT,functionType:t.FunctionType.Financial,description:"formula.functionList.ACCRINT.description",abstract:"formula.functionList.ACCRINT.abstract",functionParameter:[{name:"formula.functionList.ACCRINT.functionParameter.issue.name",detail:"formula.functionList.ACCRINT.functionParameter.issue.detail",example:'"2008-3-1"',require:1,repeat:0},{name:"formula.functionList.ACCRINT.functionParameter.firstInterest.name",detail:"formula.functionList.ACCRINT.functionParameter.firstInterest.detail",example:'"2008-8-31"',require:1,repeat:0},{name:"formula.functionList.ACCRINT.functionParameter.settlement.name",detail:"formula.functionList.ACCRINT.functionParameter.settlement.detail",example:'"2008-5-1"',require:1,repeat:0},{name:"formula.functionList.ACCRINT.functionParameter.rate.name",detail:"formula.functionList.ACCRINT.functionParameter.rate.detail",example:"10%",require:1,repeat:0},{name:"formula.functionList.ACCRINT.functionParameter.par.name",detail:"formula.functionList.ACCRINT.functionParameter.par.detail",example:"1000",require:1,repeat:0},{name:"formula.functionList.ACCRINT.functionParameter.frequency.name",detail:"formula.functionList.ACCRINT.functionParameter.frequency.detail",example:"2",require:1,repeat:0},{name:"formula.functionList.ACCRINT.functionParameter.basis.name",detail:"formula.functionList.ACCRINT.functionParameter.basis.detail",example:"0",require:0,repeat:0},{name:"formula.functionList.ACCRINT.functionParameter.calcMethod.name",detail:"formula.functionList.ACCRINT.functionParameter.calcMethod.detail",example:"true",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.ACCRINTM,functionType:t.FunctionType.Financial,description:"formula.functionList.ACCRINTM.description",abstract:"formula.functionList.ACCRINTM.abstract",functionParameter:[{name:"formula.functionList.ACCRINTM.functionParameter.issue.name",detail:"formula.functionList.ACCRINTM.functionParameter.issue.detail",example:'"2008-4-1"',require:1,repeat:0},{name:"formula.functionList.ACCRINTM.functionParameter.settlement.name",detail:"formula.functionList.ACCRINTM.functionParameter.settlement.detail",example:'"2008-6-15"',require:1,repeat:0},{name:"formula.functionList.ACCRINTM.functionParameter.rate.name",detail:"formula.functionList.ACCRINTM.functionParameter.rate.detail",example:"10%",require:1,repeat:0},{name:"formula.functionList.ACCRINTM.functionParameter.par.name",detail:"formula.functionList.ACCRINTM.functionParameter.par.detail",example:"1000",require:1,repeat:0},{name:"formula.functionList.ACCRINTM.functionParameter.basis.name",detail:"formula.functionList.ACCRINTM.functionParameter.basis.detail",example:"3",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.AMORDEGRC,functionType:t.FunctionType.Financial,description:"formula.functionList.AMORDEGRC.description",abstract:"formula.functionList.AMORDEGRC.abstract",functionParameter:[{name:"formula.functionList.AMORDEGRC.functionParameter.number1.name",detail:"formula.functionList.AMORDEGRC.functionParameter.number1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.AMORDEGRC.functionParameter.number2.name",detail:"formula.functionList.AMORDEGRC.functionParameter.number2.detail",example:"A1:A20",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.AMORLINC,functionType:t.FunctionType.Financial,description:"formula.functionList.AMORLINC.description",abstract:"formula.functionList.AMORLINC.abstract",functionParameter:[{name:"formula.functionList.AMORLINC.functionParameter.cost.name",detail:"formula.functionList.AMORLINC.functionParameter.cost.detail",example:"2400",require:1,repeat:0},{name:"formula.functionList.AMORLINC.functionParameter.datePurchased.name",detail:"formula.functionList.AMORLINC.functionParameter.datePurchased.detail",example:'"2008-8-19"',require:1,repeat:0},{name:"formula.functionList.AMORLINC.functionParameter.firstPeriod.name",detail:"formula.functionList.AMORLINC.functionParameter.firstPeriod.detail",example:'"2008-12-31"',require:1,repeat:0},{name:"formula.functionList.AMORLINC.functionParameter.salvage.name",detail:"formula.functionList.AMORLINC.functionParameter.salvage.detail",example:"300",require:1,repeat:0},{name:"formula.functionList.AMORLINC.functionParameter.period.name",detail:"formula.functionList.AMORLINC.functionParameter.period.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.AMORLINC.functionParameter.rate.name",detail:"formula.functionList.AMORLINC.functionParameter.rate.detail",example:"15%",require:1,repeat:0},{name:"formula.functionList.AMORLINC.functionParameter.basis.name",detail:"formula.functionList.AMORLINC.functionParameter.basis.detail",example:"0",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.COUPDAYBS,functionType:t.FunctionType.Financial,description:"formula.functionList.COUPDAYBS.description",abstract:"formula.functionList.COUPDAYBS.abstract",functionParameter:[{name:"formula.functionList.COUPDAYBS.functionParameter.settlement.name",detail:"formula.functionList.COUPDAYBS.functionParameter.settlement.detail",example:'"2011-1-25"',require:1,repeat:0},{name:"formula.functionList.COUPDAYBS.functionParameter.maturity.name",detail:"formula.functionList.COUPDAYBS.functionParameter.maturity.detail",example:'"2011-11-15"',require:1,repeat:0},{name:"formula.functionList.COUPDAYBS.functionParameter.frequency.name",detail:"formula.functionList.COUPDAYBS.functionParameter.frequency.detail",example:"2",require:1,repeat:0},{name:"formula.functionList.COUPDAYBS.functionParameter.basis.name",detail:"formula.functionList.COUPDAYBS.functionParameter.basis.detail",example:"1",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.COUPDAYS,functionType:t.FunctionType.Financial,description:"formula.functionList.COUPDAYS.description",abstract:"formula.functionList.COUPDAYS.abstract",functionParameter:[{name:"formula.functionList.COUPDAYS.functionParameter.settlement.name",detail:"formula.functionList.COUPDAYS.functionParameter.settlement.detail",example:'"2011-1-25"',require:1,repeat:0},{name:"formula.functionList.COUPDAYS.functionParameter.maturity.name",detail:"formula.functionList.COUPDAYS.functionParameter.maturity.detail",example:'"2011-11-15"',require:1,repeat:0},{name:"formula.functionList.COUPDAYS.functionParameter.frequency.name",detail:"formula.functionList.COUPDAYS.functionParameter.frequency.detail",example:"2",require:1,repeat:0},{name:"formula.functionList.COUPDAYS.functionParameter.basis.name",detail:"formula.functionList.COUPDAYS.functionParameter.basis.detail",example:"1",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.COUPDAYSNC,functionType:t.FunctionType.Financial,description:"formula.functionList.COUPDAYSNC.description",abstract:"formula.functionList.COUPDAYSNC.abstract",functionParameter:[{name:"formula.functionList.COUPDAYSNC.functionParameter.settlement.name",detail:"formula.functionList.COUPDAYSNC.functionParameter.settlement.detail",example:'"2011-1-25"',require:1,repeat:0},{name:"formula.functionList.COUPDAYSNC.functionParameter.maturity.name",detail:"formula.functionList.COUPDAYSNC.functionParameter.maturity.detail",example:'"2011-11-15"',require:1,repeat:0},{name:"formula.functionList.COUPDAYSNC.functionParameter.frequency.name",detail:"formula.functionList.COUPDAYSNC.functionParameter.frequency.detail",example:"2",require:1,repeat:0},{name:"formula.functionList.COUPDAYSNC.functionParameter.basis.name",detail:"formula.functionList.COUPDAYSNC.functionParameter.basis.detail",example:"1",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.COUPNCD,functionType:t.FunctionType.Financial,description:"formula.functionList.COUPNCD.description",abstract:"formula.functionList.COUPNCD.abstract",functionParameter:[{name:"formula.functionList.COUPNCD.functionParameter.settlement.name",detail:"formula.functionList.COUPNCD.functionParameter.settlement.detail",example:'"2011-1-25"',require:1,repeat:0},{name:"formula.functionList.COUPNCD.functionParameter.maturity.name",detail:"formula.functionList.COUPNCD.functionParameter.maturity.detail",example:'"2011-11-15"',require:1,repeat:0},{name:"formula.functionList.COUPNCD.functionParameter.frequency.name",detail:"formula.functionList.COUPNCD.functionParameter.frequency.detail",example:"2",require:1,repeat:0},{name:"formula.functionList.COUPNCD.functionParameter.basis.name",detail:"formula.functionList.COUPNCD.functionParameter.basis.detail",example:"1",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.COUPNUM,functionType:t.FunctionType.Financial,description:"formula.functionList.COUPNUM.description",abstract:"formula.functionList.COUPNUM.abstract",functionParameter:[{name:"formula.functionList.COUPNUM.functionParameter.settlement.name",detail:"formula.functionList.COUPNUM.functionParameter.settlement.detail",example:'"2011-1-25"',require:1,repeat:0},{name:"formula.functionList.COUPNUM.functionParameter.maturity.name",detail:"formula.functionList.COUPNUM.functionParameter.maturity.detail",example:'"2011-11-15"',require:1,repeat:0},{name:"formula.functionList.COUPNUM.functionParameter.frequency.name",detail:"formula.functionList.COUPNUM.functionParameter.frequency.detail",example:"2",require:1,repeat:0},{name:"formula.functionList.COUPNUM.functionParameter.basis.name",detail:"formula.functionList.COUPNUM.functionParameter.basis.detail",example:"1",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.COUPPCD,functionType:t.FunctionType.Financial,description:"formula.functionList.COUPPCD.description",abstract:"formula.functionList.COUPPCD.abstract",functionParameter:[{name:"formula.functionList.COUPPCD.functionParameter.settlement.name",detail:"formula.functionList.COUPPCD.functionParameter.settlement.detail",example:'"2011-1-25"',require:1,repeat:0},{name:"formula.functionList.COUPPCD.functionParameter.maturity.name",detail:"formula.functionList.COUPPCD.functionParameter.maturity.detail",example:'"2011-11-15"',require:1,repeat:0},{name:"formula.functionList.COUPPCD.functionParameter.frequency.name",detail:"formula.functionList.COUPPCD.functionParameter.frequency.detail",example:"2",require:1,repeat:0},{name:"formula.functionList.COUPPCD.functionParameter.basis.name",detail:"formula.functionList.COUPPCD.functionParameter.basis.detail",example:"1",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.CUMIPMT,functionType:t.FunctionType.Financial,description:"formula.functionList.CUMIPMT.description",abstract:"formula.functionList.CUMIPMT.abstract",functionParameter:[{name:"formula.functionList.CUMIPMT.functionParameter.rate.name",detail:"formula.functionList.CUMIPMT.functionParameter.rate.detail",example:"9%/12",require:1,repeat:0},{name:"formula.functionList.CUMIPMT.functionParameter.nper.name",detail:"formula.functionList.CUMIPMT.functionParameter.nper.detail",example:"30*12",require:1,repeat:0},{name:"formula.functionList.CUMIPMT.functionParameter.pv.name",detail:"formula.functionList.CUMIPMT.functionParameter.pv.detail",example:"125000",require:1,repeat:0},{name:"formula.functionList.CUMIPMT.functionParameter.startPeriod.name",detail:"formula.functionList.CUMIPMT.functionParameter.startPeriod.detail",example:"13",require:1,repeat:0},{name:"formula.functionList.CUMIPMT.functionParameter.endPeriod.name",detail:"formula.functionList.CUMIPMT.functionParameter.endPeriod.detail",example:"24",require:1,repeat:0},{name:"formula.functionList.CUMIPMT.functionParameter.type.name",detail:"formula.functionList.CUMIPMT.functionParameter.type.detail",example:"0",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.CUMPRINC,functionType:t.FunctionType.Financial,description:"formula.functionList.CUMPRINC.description",abstract:"formula.functionList.CUMPRINC.abstract",functionParameter:[{name:"formula.functionList.CUMPRINC.functionParameter.rate.name",detail:"formula.functionList.CUMPRINC.functionParameter.rate.detail",example:"9%/12",require:1,repeat:0},{name:"formula.functionList.CUMPRINC.functionParameter.nper.name",detail:"formula.functionList.CUMPRINC.functionParameter.nper.detail",example:"30*12",require:1,repeat:0},{name:"formula.functionList.CUMPRINC.functionParameter.pv.name",detail:"formula.functionList.CUMPRINC.functionParameter.pv.detail",example:"125000",require:1,repeat:0},{name:"formula.functionList.CUMPRINC.functionParameter.startPeriod.name",detail:"formula.functionList.CUMPRINC.functionParameter.startPeriod.detail",example:"13",require:1,repeat:0},{name:"formula.functionList.CUMPRINC.functionParameter.endPeriod.name",detail:"formula.functionList.CUMPRINC.functionParameter.endPeriod.detail",example:"24",require:1,repeat:0},{name:"formula.functionList.CUMPRINC.functionParameter.type.name",detail:"formula.functionList.CUMPRINC.functionParameter.type.detail",example:"0",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.DB,functionType:t.FunctionType.Financial,description:"formula.functionList.DB.description",abstract:"formula.functionList.DB.abstract",functionParameter:[{name:"formula.functionList.DB.functionParameter.cost.name",detail:"formula.functionList.DB.functionParameter.cost.detail",example:"10000000",require:1,repeat:0},{name:"formula.functionList.DB.functionParameter.salvage.name",detail:"formula.functionList.DB.functionParameter.salvage.detail",example:"1000000",require:1,repeat:0},{name:"formula.functionList.DB.functionParameter.life.name",detail:"formula.functionList.DB.functionParameter.life.detail",example:"6",require:1,repeat:0},{name:"formula.functionList.DB.functionParameter.period.name",detail:"formula.functionList.DB.functionParameter.period.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.DB.functionParameter.month.name",detail:"formula.functionList.DB.functionParameter.month.detail",example:"7",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.DDB,functionType:t.FunctionType.Financial,description:"formula.functionList.DDB.description",abstract:"formula.functionList.DDB.abstract",functionParameter:[{name:"formula.functionList.DDB.functionParameter.cost.name",detail:"formula.functionList.DDB.functionParameter.cost.detail",example:"24000",require:1,repeat:0},{name:"formula.functionList.DDB.functionParameter.salvage.name",detail:"formula.functionList.DDB.functionParameter.salvage.detail",example:"3000",require:1,repeat:0},{name:"formula.functionList.DDB.functionParameter.life.name",detail:"formula.functionList.DDB.functionParameter.life.detail",example:"10",require:1,repeat:0},{name:"formula.functionList.DDB.functionParameter.period.name",detail:"formula.functionList.DDB.functionParameter.period.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.DDB.functionParameter.factor.name",detail:"formula.functionList.DDB.functionParameter.factor.detail",example:"2",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.DISC,functionType:t.FunctionType.Financial,description:"formula.functionList.DISC.description",abstract:"formula.functionList.DISC.abstract",functionParameter:[{name:"formula.functionList.DISC.functionParameter.settlement.name",detail:"formula.functionList.DISC.functionParameter.settlement.detail",example:'"2018-7-1"',require:1,repeat:0},{name:"formula.functionList.DISC.functionParameter.maturity.name",detail:"formula.functionList.DISC.functionParameter.maturity.detail",example:'"2048-1-1"',require:1,repeat:0},{name:"formula.functionList.DISC.functionParameter.pr.name",detail:"formula.functionList.DISC.functionParameter.pr.detail",example:"97.975",require:1,repeat:0},{name:"formula.functionList.DISC.functionParameter.redemption.name",detail:"formula.functionList.DISC.functionParameter.redemption.detail",example:"100",require:1,repeat:0},{name:"formula.functionList.DISC.functionParameter.basis.name",detail:"formula.functionList.DISC.functionParameter.basis.detail",example:"1",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.DOLLARDE,functionType:t.FunctionType.Financial,description:"formula.functionList.DOLLARDE.description",abstract:"formula.functionList.DOLLARDE.abstract",functionParameter:[{name:"formula.functionList.DOLLARDE.functionParameter.fractionalDollar.name",detail:"formula.functionList.DOLLARDE.functionParameter.fractionalDollar.detail",example:"1.02",require:1,repeat:0},{name:"formula.functionList.DOLLARDE.functionParameter.fraction.name",detail:"formula.functionList.DOLLARDE.functionParameter.fraction.detail",example:"16",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.DOLLARFR,functionType:t.FunctionType.Financial,description:"formula.functionList.DOLLARFR.description",abstract:"formula.functionList.DOLLARFR.abstract",functionParameter:[{name:"formula.functionList.DOLLARFR.functionParameter.decimalDollar.name",detail:"formula.functionList.DOLLARFR.functionParameter.decimalDollar.detail",example:"1.125",require:1,repeat:0},{name:"formula.functionList.DOLLARFR.functionParameter.fraction.name",detail:"formula.functionList.DOLLARFR.functionParameter.fraction.detail",example:"16",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.DURATION,functionType:t.FunctionType.Financial,description:"formula.functionList.DURATION.description",abstract:"formula.functionList.DURATION.abstract",functionParameter:[{name:"formula.functionList.DURATION.functionParameter.settlement.name",detail:"formula.functionList.DURATION.functionParameter.settlement.detail",example:'"2018-7-1"',require:1,repeat:0},{name:"formula.functionList.DURATION.functionParameter.maturity.name",detail:"formula.functionList.DURATION.functionParameter.maturity.detail",example:'"2048-1-1"',require:1,repeat:0},{name:"formula.functionList.DURATION.functionParameter.coupon.name",detail:"formula.functionList.DURATION.functionParameter.coupon.detail",example:"8%",require:1,repeat:0},{name:"formula.functionList.DURATION.functionParameter.yld.name",detail:"formula.functionList.DURATION.functionParameter.yld.detail",example:"9%",require:1,repeat:0},{name:"formula.functionList.DURATION.functionParameter.frequency.name",detail:"formula.functionList.DURATION.functionParameter.frequency.detail",example:"2",require:1,repeat:0},{name:"formula.functionList.DURATION.functionParameter.basis.name",detail:"formula.functionList.DURATION.functionParameter.basis.detail",example:"1",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.EFFECT,functionType:t.FunctionType.Financial,description:"formula.functionList.EFFECT.description",abstract:"formula.functionList.EFFECT.abstract",functionParameter:[{name:"formula.functionList.EFFECT.functionParameter.nominalRate.name",detail:"formula.functionList.EFFECT.functionParameter.nominalRate.detail",example:"5.25%",require:1,repeat:0},{name:"formula.functionList.EFFECT.functionParameter.npery.name",detail:"formula.functionList.EFFECT.functionParameter.npery.detail",example:"4",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.FV,functionType:t.FunctionType.Financial,description:"formula.functionList.FV.description",abstract:"formula.functionList.FV.abstract",functionParameter:[{name:"formula.functionList.FV.functionParameter.rate.name",detail:"formula.functionList.FV.functionParameter.rate.detail",example:"6%/12",require:1,repeat:0},{name:"formula.functionList.FV.functionParameter.nper.name",detail:"formula.functionList.FV.functionParameter.nper.detail",example:"10",require:1,repeat:0},{name:"formula.functionList.FV.functionParameter.pmt.name",detail:"formula.functionList.FV.functionParameter.pmt.detail",example:"-200",require:1,repeat:0},{name:"formula.functionList.FV.functionParameter.pv.name",detail:"formula.functionList.FV.functionParameter.pv.detail",example:"-500",require:0,repeat:0},{name:"formula.functionList.FV.functionParameter.type.name",detail:"formula.functionList.FV.functionParameter.type.detail",example:"1",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.FVSCHEDULE,functionType:t.FunctionType.Financial,description:"formula.functionList.FVSCHEDULE.description",abstract:"formula.functionList.FVSCHEDULE.abstract",functionParameter:[{name:"formula.functionList.FVSCHEDULE.functionParameter.principal.name",detail:"formula.functionList.FVSCHEDULE.functionParameter.principal.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.FVSCHEDULE.functionParameter.schedule.name",detail:"formula.functionList.FVSCHEDULE.functionParameter.schedule.detail",example:"A1:A4",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.INTRATE,functionType:t.FunctionType.Financial,description:"formula.functionList.INTRATE.description",abstract:"formula.functionList.INTRATE.abstract",functionParameter:[{name:"formula.functionList.INTRATE.functionParameter.settlement.name",detail:"formula.functionList.INTRATE.functionParameter.settlement.detail",example:'"2008-2-15"',require:1,repeat:0},{name:"formula.functionList.INTRATE.functionParameter.maturity.name",detail:"formula.functionList.INTRATE.functionParameter.maturity.detail",example:'"2008-5-15"',require:1,repeat:0},{name:"formula.functionList.INTRATE.functionParameter.investment.name",detail:"formula.functionList.INTRATE.functionParameter.investment.detail",example:"10000000",require:1,repeat:0},{name:"formula.functionList.INTRATE.functionParameter.redemption.name",detail:"formula.functionList.INTRATE.functionParameter.redemption.detail",example:"10144200",require:1,repeat:0},{name:"formula.functionList.INTRATE.functionParameter.basis.name",detail:"formula.functionList.INTRATE.functionParameter.basis.detail",example:"2",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.IPMT,functionType:t.FunctionType.Financial,description:"formula.functionList.IPMT.description",abstract:"formula.functionList.IPMT.abstract",functionParameter:[{name:"formula.functionList.IPMT.functionParameter.rate.name",detail:"formula.functionList.IPMT.functionParameter.rate.detail",example:"10%/12",require:1,repeat:0},{name:"formula.functionList.IPMT.functionParameter.per.name",detail:"formula.functionList.IPMT.functionParameter.per.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.IPMT.functionParameter.nper.name",detail:"formula.functionList.IPMT.functionParameter.nper.detail",example:"3*12",require:1,repeat:0},{name:"formula.functionList.IPMT.functionParameter.pv.name",detail:"formula.functionList.IPMT.functionParameter.pv.detail",example:"80000",require:1,repeat:0},{name:"formula.functionList.IPMT.functionParameter.fv.name",detail:"formula.functionList.IPMT.functionParameter.fv.detail",example:"0",require:0,repeat:0},{name:"formula.functionList.IPMT.functionParameter.type.name",detail:"formula.functionList.IPMT.functionParameter.type.detail",example:"0",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.IRR,functionType:t.FunctionType.Financial,description:"formula.functionList.IRR.description",abstract:"formula.functionList.IRR.abstract",functionParameter:[{name:"formula.functionList.IRR.functionParameter.values.name",detail:"formula.functionList.IRR.functionParameter.values.detail",example:"A1:A4",require:1,repeat:0},{name:"formula.functionList.IRR.functionParameter.guess.name",detail:"formula.functionList.IRR.functionParameter.guess.detail",example:"0.1",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.ISPMT,functionType:t.FunctionType.Financial,description:"formula.functionList.ISPMT.description",abstract:"formula.functionList.ISPMT.abstract",functionParameter:[{name:"formula.functionList.ISPMT.functionParameter.rate.name",detail:"formula.functionList.ISPMT.functionParameter.rate.detail",example:"10%",require:1,repeat:0},{name:"formula.functionList.ISPMT.functionParameter.per.name",detail:"formula.functionList.ISPMT.functionParameter.per.detail",example:"2",require:1,repeat:0},{name:"formula.functionList.ISPMT.functionParameter.nper.name",detail:"formula.functionList.ISPMT.functionParameter.nper.detail",example:"5",require:1,repeat:0},{name:"formula.functionList.ISPMT.functionParameter.pv.name",detail:"formula.functionList.ISPMT.functionParameter.pv.detail",example:"1000",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.MDURATION,functionType:t.FunctionType.Financial,description:"formula.functionList.MDURATION.description",abstract:"formula.functionList.MDURATION.abstract",functionParameter:[{name:"formula.functionList.MDURATION.functionParameter.settlement.name",detail:"formula.functionList.MDURATION.functionParameter.settlement.detail",example:'"2018-7-1"',require:1,repeat:0},{name:"formula.functionList.MDURATION.functionParameter.maturity.name",detail:"formula.functionList.MDURATION.functionParameter.maturity.detail",example:'"2048-1-1"',require:1,repeat:0},{name:"formula.functionList.MDURATION.functionParameter.coupon.name",detail:"formula.functionList.MDURATION.functionParameter.coupon.detail",example:"8%",require:1,repeat:0},{name:"formula.functionList.MDURATION.functionParameter.yld.name",detail:"formula.functionList.MDURATION.functionParameter.yld.detail",example:"9%",require:1,repeat:0},{name:"formula.functionList.MDURATION.functionParameter.frequency.name",detail:"formula.functionList.MDURATION.functionParameter.frequency.detail",example:"2",require:1,repeat:0},{name:"formula.functionList.MDURATION.functionParameter.basis.name",detail:"formula.functionList.MDURATION.functionParameter.basis.detail",example:"1",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.MIRR,functionType:t.FunctionType.Financial,description:"formula.functionList.MIRR.description",abstract:"formula.functionList.MIRR.abstract",functionParameter:[{name:"formula.functionList.MIRR.functionParameter.values.name",detail:"formula.functionList.MIRR.functionParameter.values.detail",example:"A1:A4",require:1,repeat:0},{name:"formula.functionList.MIRR.functionParameter.financeRate.name",detail:"formula.functionList.MIRR.functionParameter.financeRate.detail",example:"10%",require:1,repeat:0},{name:"formula.functionList.MIRR.functionParameter.reinvestRate.name",detail:"formula.functionList.MIRR.functionParameter.reinvestRate.detail",example:"12%",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.NOMINAL,functionType:t.FunctionType.Financial,description:"formula.functionList.NOMINAL.description",abstract:"formula.functionList.NOMINAL.abstract",functionParameter:[{name:"formula.functionList.NOMINAL.functionParameter.effectRate.name",detail:"formula.functionList.NOMINAL.functionParameter.effectRate.detail",example:"5.3543%",require:1,repeat:0},{name:"formula.functionList.NOMINAL.functionParameter.npery.name",detail:"formula.functionList.NOMINAL.functionParameter.npery.detail",example:"4",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.NPER,functionType:t.FunctionType.Financial,description:"formula.functionList.NPER.description",abstract:"formula.functionList.NPER.abstract",functionParameter:[{name:"formula.functionList.NPER.functionParameter.rate.name",detail:"formula.functionList.NPER.functionParameter.rate.detail",example:"12%/12",require:1,repeat:0},{name:"formula.functionList.NPER.functionParameter.pmt.name",detail:"formula.functionList.NPER.functionParameter.pmt.detail",example:"-100",require:1,repeat:0},{name:"formula.functionList.NPER.functionParameter.pv.name",detail:"formula.functionList.NPER.functionParameter.pv.detail",example:"-1000",require:1,repeat:0},{name:"formula.functionList.NPER.functionParameter.fv.name",detail:"formula.functionList.NPER.functionParameter.fv.detail",example:"10000",require:0,repeat:0},{name:"formula.functionList.NPER.functionParameter.type.name",detail:"formula.functionList.NPER.functionParameter.type.detail",example:"1",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.NPV,functionType:t.FunctionType.Financial,description:"formula.functionList.NPV.description",abstract:"formula.functionList.NPV.abstract",functionParameter:[{name:"formula.functionList.NPV.functionParameter.rate.name",detail:"formula.functionList.NPV.functionParameter.rate.detail",example:"10%",require:1,repeat:0},{name:"formula.functionList.NPV.functionParameter.value1.name",detail:"formula.functionList.NPV.functionParameter.value1.detail",example:"A1:A4",require:1,repeat:0},{name:"formula.functionList.NPV.functionParameter.value2.name",detail:"formula.functionList.NPV.functionParameter.value2.detail",example:"-9000",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.ODDFPRICE,functionType:t.FunctionType.Financial,description:"formula.functionList.ODDFPRICE.description",abstract:"formula.functionList.ODDFPRICE.abstract",functionParameter:[{name:"formula.functionList.ODDFPRICE.functionParameter.settlement.name",detail:"formula.functionList.ODDFPRICE.functionParameter.settlement.detail",example:'"2008-11-11"',require:1,repeat:0},{name:"formula.functionList.ODDFPRICE.functionParameter.maturity.name",detail:"formula.functionList.ODDFPRICE.functionParameter.maturity.detail",example:'"2021-3-1"',require:1,repeat:0},{name:"formula.functionList.ODDFPRICE.functionParameter.issue.name",detail:"formula.functionList.ODDFPRICE.functionParameter.issue.detail",example:'"2008-10-15"',require:1,repeat:0},{name:"formula.functionList.ODDFPRICE.functionParameter.firstCoupon.name",detail:"formula.functionList.ODDFPRICE.functionParameter.firstCoupon.detail",example:'"2009-3-1"',require:1,repeat:0},{name:"formula.functionList.ODDFPRICE.functionParameter.rate.name",detail:"formula.functionList.ODDFPRICE.functionParameter.rate.detail",example:"7.85%",require:1,repeat:0},{name:"formula.functionList.ODDFPRICE.functionParameter.yld.name",detail:"formula.functionList.ODDFPRICE.functionParameter.yld.detail",example:"6.25%",require:1,repeat:0},{name:"formula.functionList.ODDFPRICE.functionParameter.redemption.name",detail:"formula.functionList.ODDFPRICE.functionParameter.redemption.detail",example:"100",require:1,repeat:0},{name:"formula.functionList.ODDFPRICE.functionParameter.frequency.name",detail:"formula.functionList.ODDFPRICE.functionParameter.frequency.detail",example:"2",require:1,repeat:0},{name:"formula.functionList.ODDFPRICE.functionParameter.basis.name",detail:"formula.functionList.ODDFPRICE.functionParameter.basis.detail",example:"1",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.ODDFYIELD,functionType:t.FunctionType.Financial,description:"formula.functionList.ODDFYIELD.description",abstract:"formula.functionList.ODDFYIELD.abstract",functionParameter:[{name:"formula.functionList.ODDFYIELD.functionParameter.settlement.name",detail:"formula.functionList.ODDFYIELD.functionParameter.settlement.detail",example:'"2008-11-11"',require:1,repeat:0},{name:"formula.functionList.ODDFYIELD.functionParameter.maturity.name",detail:"formula.functionList.ODDFYIELD.functionParameter.maturity.detail",example:'"2021-3-1"',require:1,repeat:0},{name:"formula.functionList.ODDFYIELD.functionParameter.issue.name",detail:"formula.functionList.ODDFYIELD.functionParameter.issue.detail",example:'"2008-10-15"',require:1,repeat:0},{name:"formula.functionList.ODDFYIELD.functionParameter.firstCoupon.name",detail:"formula.functionList.ODDFYIELD.functionParameter.firstCoupon.detail",example:'"2009-3-1"',require:1,repeat:0},{name:"formula.functionList.ODDFYIELD.functionParameter.rate.name",detail:"formula.functionList.ODDFYIELD.functionParameter.rate.detail",example:"5.75%",require:1,repeat:0},{name:"formula.functionList.ODDFYIELD.functionParameter.pr.name",detail:"formula.functionList.ODDFYIELD.functionParameter.pr.detail",example:"84.5",require:1,repeat:0},{name:"formula.functionList.ODDFYIELD.functionParameter.redemption.name",detail:"formula.functionList.ODDFYIELD.functionParameter.redemption.detail",example:"100",require:1,repeat:0},{name:"formula.functionList.ODDFYIELD.functionParameter.frequency.name",detail:"formula.functionList.ODDFYIELD.functionParameter.frequency.detail",example:"2",require:1,repeat:0},{name:"formula.functionList.ODDFYIELD.functionParameter.basis.name",detail:"formula.functionList.ODDFYIELD.functionParameter.basis.detail",example:"0",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.ODDLPRICE,functionType:t.FunctionType.Financial,description:"formula.functionList.ODDLPRICE.description",abstract:"formula.functionList.ODDLPRICE.abstract",functionParameter:[{name:"formula.functionList.ODDLPRICE.functionParameter.settlement.name",detail:"formula.functionList.ODDLPRICE.functionParameter.settlement.detail",example:'"2008-2-7"',require:1,repeat:0},{name:"formula.functionList.ODDLPRICE.functionParameter.maturity.name",detail:"formula.functionList.ODDLPRICE.functionParameter.maturity.detail",example:'"2008-6-15"',require:1,repeat:0},{name:"formula.functionList.ODDLPRICE.functionParameter.lastInterest.name",detail:"formula.functionList.ODDLPRICE.functionParameter.lastInterest.detail",example:'"2007-10-15"',require:1,repeat:0},{name:"formula.functionList.ODDLPRICE.functionParameter.rate.name",detail:"formula.functionList.ODDLPRICE.functionParameter.rate.detail",example:"3.75%",require:1,repeat:0},{name:"formula.functionList.ODDLPRICE.functionParameter.yld.name",detail:"formula.functionList.ODDLPRICE.functionParameter.yld.detail",example:"4.05%",require:1,repeat:0},{name:"formula.functionList.ODDLPRICE.functionParameter.redemption.name",detail:"formula.functionList.ODDLPRICE.functionParameter.redemption.detail",example:"100",require:1,repeat:0},{name:"formula.functionList.ODDLPRICE.functionParameter.frequency.name",detail:"formula.functionList.ODDLPRICE.functionParameter.frequency.detail",example:"2",require:1,repeat:0},{name:"formula.functionList.ODDLPRICE.functionParameter.basis.name",detail:"formula.functionList.ODDLPRICE.functionParameter.basis.detail",example:"0",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.ODDLYIELD,functionType:t.FunctionType.Financial,description:"formula.functionList.ODDLYIELD.description",abstract:"formula.functionList.ODDLYIELD.abstract",functionParameter:[{name:"formula.functionList.ODDLYIELD.functionParameter.settlement.name",detail:"formula.functionList.ODDLYIELD.functionParameter.settlement.detail",example:'"2008-4-20"',require:1,repeat:0},{name:"formula.functionList.ODDLYIELD.functionParameter.maturity.name",detail:"formula.functionList.ODDLYIELD.functionParameter.maturity.detail",example:'"2008-6-15"',require:1,repeat:0},{name:"formula.functionList.ODDLYIELD.functionParameter.lastInterest.name",detail:"formula.functionList.ODDLYIELD.functionParameter.lastInterest.detail",example:'"2007-12-24"',require:1,repeat:0},{name:"formula.functionList.ODDLYIELD.functionParameter.rate.name",detail:"formula.functionList.ODDLYIELD.functionParameter.rate.detail",example:"3.75%",require:1,repeat:0},{name:"formula.functionList.ODDLYIELD.functionParameter.pr.name",detail:"formula.functionList.ODDLYIELD.functionParameter.pr.detail",example:"99.875",require:1,repeat:0},{name:"formula.functionList.ODDLYIELD.functionParameter.redemption.name",detail:"formula.functionList.ODDLYIELD.functionParameter.redemption.detail",example:"100",require:1,repeat:0},{name:"formula.functionList.ODDLYIELD.functionParameter.frequency.name",detail:"formula.functionList.ODDLYIELD.functionParameter.frequency.detail",example:"2",require:1,repeat:0},{name:"formula.functionList.ODDLYIELD.functionParameter.basis.name",detail:"formula.functionList.ODDLYIELD.functionParameter.basis.detail",example:"0",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.PDURATION,functionType:t.FunctionType.Financial,description:"formula.functionList.PDURATION.description",abstract:"formula.functionList.PDURATION.abstract",functionParameter:[{name:"formula.functionList.PDURATION.functionParameter.rate.name",detail:"formula.functionList.PDURATION.functionParameter.rate.detail",example:"2.5%",require:1,repeat:0},{name:"formula.functionList.PDURATION.functionParameter.pv.name",detail:"formula.functionList.PDURATION.functionParameter.pv.detail",example:"2000",require:1,repeat:0},{name:"formula.functionList.PDURATION.functionParameter.fv.name",detail:"formula.functionList.PDURATION.functionParameter.fv.detail",example:"2200",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.PMT,functionType:t.FunctionType.Financial,description:"formula.functionList.PMT.description",abstract:"formula.functionList.PMT.abstract",functionParameter:[{name:"formula.functionList.PMT.functionParameter.rate.name",detail:"formula.functionList.PMT.functionParameter.rate.detail",example:"8%/12",require:1,repeat:0},{name:"formula.functionList.PMT.functionParameter.nper.name",detail:"formula.functionList.PMT.functionParameter.nper.detail",example:"10",require:1,repeat:0},{name:"formula.functionList.PMT.functionParameter.pv.name",detail:"formula.functionList.PMT.functionParameter.pv.detail",example:"10000",require:1,repeat:0},{name:"formula.functionList.PMT.functionParameter.fv.name",detail:"formula.functionList.PMT.functionParameter.fv.detail",example:"0",require:0,repeat:0},{name:"formula.functionList.PMT.functionParameter.type.name",detail:"formula.functionList.PMT.functionParameter.type.detail",example:"0",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.PPMT,functionType:t.FunctionType.Financial,description:"formula.functionList.PPMT.description",abstract:"formula.functionList.PPMT.abstract",functionParameter:[{name:"formula.functionList.PPMT.functionParameter.rate.name",detail:"formula.functionList.PPMT.functionParameter.rate.detail",example:"10%/12",require:1,repeat:0},{name:"formula.functionList.PPMT.functionParameter.per.name",detail:"formula.functionList.PPMT.functionParameter.per.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.PPMT.functionParameter.nper.name",detail:"formula.functionList.PPMT.functionParameter.nper.detail",example:"3*12",require:1,repeat:0},{name:"formula.functionList.PPMT.functionParameter.pv.name",detail:"formula.functionList.PPMT.functionParameter.pv.detail",example:"80000",require:1,repeat:0},{name:"formula.functionList.PPMT.functionParameter.fv.name",detail:"formula.functionList.PPMT.functionParameter.fv.detail",example:"0",require:0,repeat:0},{name:"formula.functionList.PPMT.functionParameter.type.name",detail:"formula.functionList.PPMT.functionParameter.type.detail",example:"0",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.PRICE,functionType:t.FunctionType.Financial,description:"formula.functionList.PRICE.description",abstract:"formula.functionList.PRICE.abstract",functionParameter:[{name:"formula.functionList.PRICE.functionParameter.settlement.name",detail:"formula.functionList.PRICE.functionParameter.settlement.detail",example:'"2008-11-11"',require:1,repeat:0},{name:"formula.functionList.PRICE.functionParameter.maturity.name",detail:"formula.functionList.PRICE.functionParameter.maturity.detail",example:'"2021-3-1"',require:1,repeat:0},{name:"formula.functionList.PRICE.functionParameter.rate.name",detail:"formula.functionList.PRICE.functionParameter.rate.detail",example:"7.85%",require:1,repeat:0},{name:"formula.functionList.PRICE.functionParameter.yld.name",detail:"formula.functionList.PRICE.functionParameter.yld.detail",example:"6.25%",require:1,repeat:0},{name:"formula.functionList.PRICE.functionParameter.redemption.name",detail:"formula.functionList.PRICE.functionParameter.redemption.detail",example:"100",require:1,repeat:0},{name:"formula.functionList.PRICE.functionParameter.frequency.name",detail:"formula.functionList.PRICE.functionParameter.frequency.detail",example:"2",require:1,repeat:0},{name:"formula.functionList.PRICE.functionParameter.basis.name",detail:"formula.functionList.PRICE.functionParameter.basis.detail",example:"1",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.PRICEDISC,functionType:t.FunctionType.Financial,description:"formula.functionList.PRICEDISC.description",abstract:"formula.functionList.PRICEDISC.abstract",functionParameter:[{name:"formula.functionList.PRICEDISC.functionParameter.settlement.name",detail:"formula.functionList.PRICEDISC.functionParameter.settlement.detail",example:'"2008-11-11"',require:1,repeat:0},{name:"formula.functionList.PRICEDISC.functionParameter.maturity.name",detail:"formula.functionList.PRICEDISC.functionParameter.maturity.detail",example:'"2021-3-1"',require:1,repeat:0},{name:"formula.functionList.PRICEDISC.functionParameter.discount.name",detail:"formula.functionList.PRICEDISC.functionParameter.discount.detail",example:"6.25%",require:1,repeat:0},{name:"formula.functionList.PRICEDISC.functionParameter.redemption.name",detail:"formula.functionList.PRICEDISC.functionParameter.redemption.detail",example:"100",require:1,repeat:0},{name:"formula.functionList.PRICEDISC.functionParameter.basis.name",detail:"formula.functionList.PRICEDISC.functionParameter.basis.detail",example:"1",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.PRICEMAT,functionType:t.FunctionType.Financial,description:"formula.functionList.PRICEMAT.description",abstract:"formula.functionList.PRICEMAT.abstract",functionParameter:[{name:"formula.functionList.PRICEMAT.functionParameter.settlement.name",detail:"formula.functionList.PRICEMAT.functionParameter.settlement.detail",example:'"2008-11-11"',require:1,repeat:0},{name:"formula.functionList.PRICEMAT.functionParameter.maturity.name",detail:"formula.functionList.PRICEMAT.functionParameter.maturity.detail",example:'"2021-3-1"',require:1,repeat:0},{name:"formula.functionList.PRICEMAT.functionParameter.issue.name",detail:"formula.functionList.PRICEMAT.functionParameter.issue.detail",example:'"2008-10-15"',require:1,repeat:0},{name:"formula.functionList.PRICEMAT.functionParameter.rate.name",detail:"formula.functionList.PRICEMAT.functionParameter.rate.detail",example:"7.85%",require:1,repeat:0},{name:"formula.functionList.PRICEMAT.functionParameter.yld.name",detail:"formula.functionList.PRICEMAT.functionParameter.yld.detail",example:"6.25%",require:1,repeat:0},{name:"formula.functionList.PRICEMAT.functionParameter.basis.name",detail:"formula.functionList.PRICEMAT.functionParameter.basis.detail",example:"1",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.PV,functionType:t.FunctionType.Financial,description:"formula.functionList.PV.description",abstract:"formula.functionList.PV.abstract",functionParameter:[{name:"formula.functionList.PV.functionParameter.rate.name",detail:"formula.functionList.PV.functionParameter.rate.detail",example:"2%",require:1,repeat:0},{name:"formula.functionList.PV.functionParameter.nper.name",detail:"formula.functionList.PV.functionParameter.nper.detail",example:"12",require:1,repeat:0},{name:"formula.functionList.PV.functionParameter.pmt.name",detail:"formula.functionList.PV.functionParameter.pmt.detail",example:"100",require:1,repeat:0},{name:"formula.functionList.PV.functionParameter.fv.name",detail:"formula.functionList.PV.functionParameter.fv.detail",example:"0",require:0,repeat:0},{name:"formula.functionList.PV.functionParameter.type.name",detail:"formula.functionList.PV.functionParameter.type.detail",example:"0",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.RATE,functionType:t.FunctionType.Financial,description:"formula.functionList.RATE.description",abstract:"formula.functionList.RATE.abstract",functionParameter:[{name:"formula.functionList.RATE.functionParameter.nper.name",detail:"formula.functionList.RATE.functionParameter.nper.detail",example:"4*12",require:1,repeat:0},{name:"formula.functionList.RATE.functionParameter.pmt.name",detail:"formula.functionList.RATE.functionParameter.pmt.detail",example:"-200",require:1,repeat:0},{name:"formula.functionList.RATE.functionParameter.pv.name",detail:"formula.functionList.RATE.functionParameter.pv.detail",example:"8000",require:1,repeat:0},{name:"formula.functionList.RATE.functionParameter.fv.name",detail:"formula.functionList.RATE.functionParameter.fv.detail",example:"0",require:0,repeat:0},{name:"formula.functionList.RATE.functionParameter.type.name",detail:"formula.functionList.RATE.functionParameter.type.detail",example:"0",require:0,repeat:0},{name:"formula.functionList.RATE.functionParameter.guess.name",detail:"formula.functionList.RATE.functionParameter.guess.detail",example:"0.1",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.RECEIVED,functionType:t.FunctionType.Financial,description:"formula.functionList.RECEIVED.description",abstract:"formula.functionList.RECEIVED.abstract",functionParameter:[{name:"formula.functionList.RECEIVED.functionParameter.settlement.name",detail:"formula.functionList.RECEIVED.functionParameter.settlement.detail",example:'"2008-2-15"',require:1,repeat:0},{name:"formula.functionList.RECEIVED.functionParameter.maturity.name",detail:"formula.functionList.RECEIVED.functionParameter.maturity.detail",example:'"2008-3-15"',require:1,repeat:0},{name:"formula.functionList.RECEIVED.functionParameter.investment.name",detail:"formula.functionList.RECEIVED.functionParameter.investment.detail",example:"10000000",require:1,repeat:0},{name:"formula.functionList.RECEIVED.functionParameter.discount.name",detail:"formula.functionList.RECEIVED.functionParameter.discount.detail",example:"5.75%",require:1,repeat:0},{name:"formula.functionList.RECEIVED.functionParameter.basis.name",detail:"formula.functionList.RECEIVED.functionParameter.basis.detail",example:"2",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.RRI,functionType:t.FunctionType.Financial,description:"formula.functionList.RRI.description",abstract:"formula.functionList.RRI.abstract",functionParameter:[{name:"formula.functionList.RRI.functionParameter.nper.name",detail:"formula.functionList.RRI.functionParameter.nper.detail",example:"96",require:1,repeat:0},{name:"formula.functionList.RRI.functionParameter.pv.name",detail:"formula.functionList.RRI.functionParameter.pv.detail",example:"10000",require:1,repeat:0},{name:"formula.functionList.RRI.functionParameter.fv.name",detail:"formula.functionList.RRI.functionParameter.fv.detail",example:"11000",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.SLN,functionType:t.FunctionType.Financial,description:"formula.functionList.SLN.description",abstract:"formula.functionList.SLN.abstract",functionParameter:[{name:"formula.functionList.SLN.functionParameter.cost.name",detail:"formula.functionList.SLN.functionParameter.cost.detail",example:"300000",require:1,repeat:0},{name:"formula.functionList.SLN.functionParameter.salvage.name",detail:"formula.functionList.SLN.functionParameter.salvage.detail",example:"75000",require:1,repeat:0},{name:"formula.functionList.SLN.functionParameter.life.name",detail:"formula.functionList.SLN.functionParameter.life.detail",example:"10",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.SYD,functionType:t.FunctionType.Financial,description:"formula.functionList.SYD.description",abstract:"formula.functionList.SYD.abstract",functionParameter:[{name:"formula.functionList.SYD.functionParameter.cost.name",detail:"formula.functionList.SYD.functionParameter.cost.detail",example:"300000",require:1,repeat:0},{name:"formula.functionList.SYD.functionParameter.salvage.name",detail:"formula.functionList.SYD.functionParameter.salvage.detail",example:"75000",require:1,repeat:0},{name:"formula.functionList.SYD.functionParameter.life.name",detail:"formula.functionList.SYD.functionParameter.life.detail",example:"10",require:1,repeat:0},{name:"formula.functionList.SYD.functionParameter.per.name",detail:"formula.functionList.SYD.functionParameter.per.detail",example:"10",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.TBILLEQ,functionType:t.FunctionType.Financial,description:"formula.functionList.TBILLEQ.description",abstract:"formula.functionList.TBILLEQ.abstract",functionParameter:[{name:"formula.functionList.TBILLEQ.functionParameter.settlement.name",detail:"formula.functionList.TBILLEQ.functionParameter.settlement.detail",example:'"2008-3-31"',require:1,repeat:0},{name:"formula.functionList.TBILLEQ.functionParameter.maturity.name",detail:"formula.functionList.TBILLEQ.functionParameter.maturity.detail",example:'"2008-6-1"',require:1,repeat:0},{name:"formula.functionList.TBILLEQ.functionParameter.discount.name",detail:"formula.functionList.TBILLEQ.functionParameter.discount.detail",example:"9.14%",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.TBILLPRICE,functionType:t.FunctionType.Financial,description:"formula.functionList.TBILLPRICE.description",abstract:"formula.functionList.TBILLPRICE.abstract",functionParameter:[{name:"formula.functionList.TBILLPRICE.functionParameter.settlement.name",detail:"formula.functionList.TBILLPRICE.functionParameter.settlement.detail",example:'"2008-3-31"',require:1,repeat:0},{name:"formula.functionList.TBILLPRICE.functionParameter.maturity.name",detail:"formula.functionList.TBILLPRICE.functionParameter.maturity.detail",example:'"2008-6-1"',require:1,repeat:0},{name:"formula.functionList.TBILLPRICE.functionParameter.discount.name",detail:"formula.functionList.TBILLPRICE.functionParameter.discount.detail",example:"9.14%",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.TBILLYIELD,functionType:t.FunctionType.Financial,description:"formula.functionList.TBILLYIELD.description",abstract:"formula.functionList.TBILLYIELD.abstract",functionParameter:[{name:"formula.functionList.TBILLYIELD.functionParameter.settlement.name",detail:"formula.functionList.TBILLYIELD.functionParameter.settlement.detail",example:'"2008-3-31"',require:1,repeat:0},{name:"formula.functionList.TBILLYIELD.functionParameter.maturity.name",detail:"formula.functionList.TBILLYIELD.functionParameter.maturity.detail",example:'"2008-6-1"',require:1,repeat:0},{name:"formula.functionList.TBILLYIELD.functionParameter.pr.name",detail:"formula.functionList.TBILLYIELD.functionParameter.pr.detail",example:"98.45",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.VDB,functionType:t.FunctionType.Financial,description:"formula.functionList.VDB.description",abstract:"formula.functionList.VDB.abstract",functionParameter:[{name:"formula.functionList.VDB.functionParameter.cost.name",detail:"formula.functionList.VDB.functionParameter.cost.detail",example:"2400",require:1,repeat:0},{name:"formula.functionList.VDB.functionParameter.salvage.name",detail:"formula.functionList.VDB.functionParameter.salvage.detail",example:"300",require:1,repeat:0},{name:"formula.functionList.VDB.functionParameter.life.name",detail:"formula.functionList.VDB.functionParameter.life.detail",example:"10",require:1,repeat:0},{name:"formula.functionList.VDB.functionParameter.startPeriod.name",detail:"formula.functionList.VDB.functionParameter.startPeriod.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.VDB.functionParameter.endPeriod.name",detail:"formula.functionList.VDB.functionParameter.endPeriod.detail",example:"2",require:1,repeat:0},{name:"formula.functionList.VDB.functionParameter.factor.name",detail:"formula.functionList.VDB.functionParameter.factor.detail",example:"2",require:0,repeat:0},{name:"formula.functionList.VDB.functionParameter.noSwitch.name",detail:"formula.functionList.VDB.functionParameter.noSwitch.detail",example:"false",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.XIRR,functionType:t.FunctionType.Financial,description:"formula.functionList.XIRR.description",abstract:"formula.functionList.XIRR.abstract",functionParameter:[{name:"formula.functionList.XIRR.functionParameter.values.name",detail:"formula.functionList.XIRR.functionParameter.values.detail",example:"A1:A4",require:1,repeat:0},{name:"formula.functionList.XIRR.functionParameter.dates.name",detail:"formula.functionList.XIRR.functionParameter.dates.detail",example:"B1:B4",require:1,repeat:0},{name:"formula.functionList.XIRR.functionParameter.guess.name",detail:"formula.functionList.XIRR.functionParameter.guess.detail",example:"0.1",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.XNPV,functionType:t.FunctionType.Financial,description:"formula.functionList.XNPV.description",abstract:"formula.functionList.XNPV.abstract",functionParameter:[{name:"formula.functionList.XNPV.functionParameter.rate.name",detail:"formula.functionList.XNPV.functionParameter.rate.detail",example:"10%",require:1,repeat:0},{name:"formula.functionList.XNPV.functionParameter.values.name",detail:"formula.functionList.XNPV.functionParameter.values.detail",example:"A1:A4",require:1,repeat:0},{name:"formula.functionList.XNPV.functionParameter.dates.name",detail:"formula.functionList.XNPV.functionParameter.dates.detail",example:"B1:B4",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.YIELD,functionType:t.FunctionType.Financial,description:"formula.functionList.YIELD.description",abstract:"formula.functionList.YIELD.abstract",functionParameter:[{name:"formula.functionList.YIELD.functionParameter.settlement.name",detail:"formula.functionList.YIELD.functionParameter.settlement.detail",example:'"2008-11-11"',require:1,repeat:0},{name:"formula.functionList.YIELD.functionParameter.maturity.name",detail:"formula.functionList.YIELD.functionParameter.maturity.detail",example:'"2021-3-1"',require:1,repeat:0},{name:"formula.functionList.YIELD.functionParameter.rate.name",detail:"formula.functionList.YIELD.functionParameter.rate.detail",example:"7.85%",require:1,repeat:0},{name:"formula.functionList.YIELD.functionParameter.pr.name",detail:"formula.functionList.YIELD.functionParameter.pr.detail",example:"98.45",require:1,repeat:0},{name:"formula.functionList.YIELD.functionParameter.redemption.name",detail:"formula.functionList.YIELD.functionParameter.redemption.detail",example:"100",require:1,repeat:0},{name:"formula.functionList.YIELD.functionParameter.frequency.name",detail:"formula.functionList.YIELD.functionParameter.frequency.detail",example:"2",require:1,repeat:0},{name:"formula.functionList.YIELD.functionParameter.basis.name",detail:"formula.functionList.YIELD.functionParameter.basis.detail",example:"1",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.YIELDDISC,functionType:t.FunctionType.Financial,description:"formula.functionList.YIELDDISC.description",abstract:"formula.functionList.YIELDDISC.abstract",functionParameter:[{name:"formula.functionList.YIELDDISC.functionParameter.settlement.name",detail:"formula.functionList.YIELDDISC.functionParameter.settlement.detail",example:'"2008-11-11"',require:1,repeat:0},{name:"formula.functionList.YIELDDISC.functionParameter.maturity.name",detail:"formula.functionList.YIELDDISC.functionParameter.maturity.detail",example:'"2021-3-1"',require:1,repeat:0},{name:"formula.functionList.YIELDDISC.functionParameter.pr.name",detail:"formula.functionList.YIELDDISC.functionParameter.pr.detail",example:"98.45",require:1,repeat:0},{name:"formula.functionList.YIELDDISC.functionParameter.redemption.name",detail:"formula.functionList.YIELDDISC.functionParameter.redemption.detail",example:"100",require:1,repeat:0},{name:"formula.functionList.YIELDDISC.functionParameter.basis.name",detail:"formula.functionList.YIELDDISC.functionParameter.basis.detail",example:"1",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.YIELDMAT,functionType:t.FunctionType.Financial,description:"formula.functionList.YIELDMAT.description",abstract:"formula.functionList.YIELDMAT.abstract",functionParameter:[{name:"formula.functionList.YIELDMAT.functionParameter.settlement.name",detail:"formula.functionList.YIELDMAT.functionParameter.settlement.detail",example:'"2008-11-11"',require:1,repeat:0},{name:"formula.functionList.YIELDMAT.functionParameter.maturity.name",detail:"formula.functionList.YIELDMAT.functionParameter.maturity.detail",example:'"2021-3-1"',require:1,repeat:0},{name:"formula.functionList.YIELDMAT.functionParameter.issue.name",detail:"formula.functionList.YIELDMAT.functionParameter.issue.detail",example:'"2008-10-15"',require:1,repeat:0},{name:"formula.functionList.YIELDMAT.functionParameter.rate.name",detail:"formula.functionList.YIELDMAT.functionParameter.rate.detail",example:"7.85%",require:1,repeat:0},{name:"formula.functionList.YIELDMAT.functionParameter.pr.name",detail:"formula.functionList.YIELDMAT.functionParameter.pr.detail",example:"98.45",require:1,repeat:0},{name:"formula.functionList.YIELDMAT.functionParameter.basis.name",detail:"formula.functionList.YIELDMAT.functionParameter.basis.detail",example:"1",require:0,repeat:0}]}],je=[{functionName:t.FUNCTION_NAMES_INFORMATION.CELL,functionType:t.FunctionType.Information,description:"formula.functionList.CELL.description",abstract:"formula.functionList.CELL.abstract",functionParameter:[{name:"formula.functionList.CELL.functionParameter.infoType.name",detail:"formula.functionList.CELL.functionParameter.infoType.detail",example:'"type"',require:1,repeat:0},{name:"formula.functionList.CELL.functionParameter.reference.name",detail:"formula.functionList.CELL.functionParameter.reference.detail",example:"A1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_INFORMATION.ERROR_TYPE,functionType:t.FunctionType.Information,description:"formula.functionList.ERROR_TYPE.description",abstract:"formula.functionList.ERROR_TYPE.abstract",functionParameter:[{name:"formula.functionList.ERROR_TYPE.functionParameter.errorVal.name",detail:"formula.functionList.ERROR_TYPE.functionParameter.errorVal.detail",example:'"#NULL!"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_INFORMATION.INFO,functionType:t.FunctionType.Information,description:"formula.functionList.INFO.description",abstract:"formula.functionList.INFO.abstract",functionParameter:[{name:"formula.functionList.INFO.functionParameter.number1.name",detail:"formula.functionList.INFO.functionParameter.number1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.INFO.functionParameter.number2.name",detail:"formula.functionList.INFO.functionParameter.number2.detail",example:"A1:A20",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_INFORMATION.ISBETWEEN,functionType:t.FunctionType.Information,description:"formula.functionList.ISBETWEEN.description",abstract:"formula.functionList.ISBETWEEN.abstract",functionParameter:[{name:"formula.functionList.ISBETWEEN.functionParameter.valueToCompare.name",detail:"formula.functionList.ISBETWEEN.functionParameter.valueToCompare.detail",example:"7.9",require:1,repeat:0},{name:"formula.functionList.ISBETWEEN.functionParameter.lowerValue.name",detail:"formula.functionList.ISBETWEEN.functionParameter.lowerValue.detail",example:"1.2",require:1,repeat:0},{name:"formula.functionList.ISBETWEEN.functionParameter.upperValue.name",detail:"formula.functionList.ISBETWEEN.functionParameter.upperValue.detail",example:"12.45",require:1,repeat:0},{name:"formula.functionList.ISBETWEEN.functionParameter.lowerValueIsInclusive.name",detail:"formula.functionList.ISBETWEEN.functionParameter.lowerValueIsInclusive.detail",example:"true",require:0,repeat:0},{name:"formula.functionList.ISBETWEEN.functionParameter.upperValueIsInclusive.name",detail:"formula.functionList.ISBETWEEN.functionParameter.upperValueIsInclusive.detail",example:"true",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_INFORMATION.ISBLANK,functionType:t.FunctionType.Information,description:"formula.functionList.ISBLANK.description",abstract:"formula.functionList.ISBLANK.abstract",functionParameter:[{name:"formula.functionList.ISBLANK.functionParameter.value.name",detail:"formula.functionList.ISBLANK.functionParameter.value.detail",example:"A1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_INFORMATION.ISDATE,functionType:t.FunctionType.Information,description:"formula.functionList.ISDATE.description",abstract:"formula.functionList.ISDATE.abstract",functionParameter:[{name:"formula.functionList.ISDATE.functionParameter.value.name",detail:"formula.functionList.ISDATE.functionParameter.value.detail",example:"A1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_INFORMATION.ISEMAIL,functionType:t.FunctionType.Information,description:"formula.functionList.ISEMAIL.description",abstract:"formula.functionList.ISEMAIL.abstract",functionParameter:[{name:"formula.functionList.ISEMAIL.functionParameter.value.name",detail:"formula.functionList.ISEMAIL.functionParameter.value.detail",example:'"developer@univer.ai"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_INFORMATION.ISERR,functionType:t.FunctionType.Information,description:"formula.functionList.ISERR.description",abstract:"formula.functionList.ISERR.abstract",functionParameter:[{name:"formula.functionList.ISERR.functionParameter.value.name",detail:"formula.functionList.ISERR.functionParameter.value.detail",example:"A1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_INFORMATION.ISERROR,functionType:t.FunctionType.Information,description:"formula.functionList.ISERROR.description",abstract:"formula.functionList.ISERROR.abstract",functionParameter:[{name:"formula.functionList.ISERROR.functionParameter.value.name",detail:"formula.functionList.ISERROR.functionParameter.value.detail",example:"A1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_INFORMATION.ISEVEN,functionType:t.FunctionType.Information,description:"formula.functionList.ISEVEN.description",abstract:"formula.functionList.ISEVEN.abstract",functionParameter:[{name:"formula.functionList.ISEVEN.functionParameter.value.name",detail:"formula.functionList.ISEVEN.functionParameter.value.detail",example:"A1:A20",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_INFORMATION.ISFORMULA,functionType:t.FunctionType.Information,description:"formula.functionList.ISFORMULA.description",abstract:"formula.functionList.ISFORMULA.abstract",functionParameter:[{name:"formula.functionList.ISFORMULA.functionParameter.reference.name",detail:"formula.functionList.ISFORMULA.functionParameter.reference.detail",example:"A1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_INFORMATION.ISLOGICAL,functionType:t.FunctionType.Information,description:"formula.functionList.ISLOGICAL.description",abstract:"formula.functionList.ISLOGICAL.abstract",functionParameter:[{name:"formula.functionList.ISLOGICAL.functionParameter.value.name",detail:"formula.functionList.ISLOGICAL.functionParameter.value.detail",example:"A1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_INFORMATION.ISNA,functionType:t.FunctionType.Information,description:"formula.functionList.ISNA.description",abstract:"formula.functionList.ISNA.abstract",functionParameter:[{name:"formula.functionList.ISNA.functionParameter.value.name",detail:"formula.functionList.ISNA.functionParameter.value.detail",example:"A1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_INFORMATION.ISNONTEXT,functionType:t.FunctionType.Information,description:"formula.functionList.ISNONTEXT.description",abstract:"formula.functionList.ISNONTEXT.abstract",functionParameter:[{name:"formula.functionList.ISNONTEXT.functionParameter.value.name",detail:"formula.functionList.ISNONTEXT.functionParameter.value.detail",example:"A1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_INFORMATION.ISNUMBER,functionType:t.FunctionType.Information,description:"formula.functionList.ISNUMBER.description",abstract:"formula.functionList.ISNUMBER.abstract",functionParameter:[{name:"formula.functionList.ISNUMBER.functionParameter.value.name",detail:"formula.functionList.ISNUMBER.functionParameter.value.detail",example:"A1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_INFORMATION.ISODD,functionType:t.FunctionType.Information,description:"formula.functionList.ISODD.description",abstract:"formula.functionList.ISODD.abstract",functionParameter:[{name:"formula.functionList.ISODD.functionParameter.value.name",detail:"formula.functionList.ISODD.functionParameter.value.detail",example:"A1:A20",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_INFORMATION.ISOMITTED,functionType:t.FunctionType.Information,description:"formula.functionList.ISOMITTED.description",abstract:"formula.functionList.ISOMITTED.abstract",functionParameter:[{name:"formula.functionList.ISOMITTED.functionParameter.number1.name",detail:"formula.functionList.ISOMITTED.functionParameter.number1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.ISOMITTED.functionParameter.number2.name",detail:"formula.functionList.ISOMITTED.functionParameter.number2.detail",example:"A1:A20",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_INFORMATION.ISREF,functionType:t.FunctionType.Information,description:"formula.functionList.ISREF.description",abstract:"formula.functionList.ISREF.abstract",functionParameter:[{name:"formula.functionList.ISREF.functionParameter.value.name",detail:"formula.functionList.ISREF.functionParameter.value.detail",example:"A1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_INFORMATION.ISTEXT,functionType:t.FunctionType.Information,description:"formula.functionList.ISTEXT.description",abstract:"formula.functionList.ISTEXT.abstract",functionParameter:[{name:"formula.functionList.ISTEXT.functionParameter.value.name",detail:"formula.functionList.ISTEXT.functionParameter.value.detail",example:"A1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_INFORMATION.ISURL,functionType:t.FunctionType.Information,description:"formula.functionList.ISURL.description",abstract:"formula.functionList.ISURL.abstract",functionParameter:[{name:"formula.functionList.ISURL.functionParameter.value.name",detail:"formula.functionList.ISURL.functionParameter.value.detail",example:'"univer.ai"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_INFORMATION.N,functionType:t.FunctionType.Information,description:"formula.functionList.N.description",abstract:"formula.functionList.N.abstract",functionParameter:[{name:"formula.functionList.N.functionParameter.value.name",detail:"formula.functionList.N.functionParameter.value.detail",example:"7",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_INFORMATION.NA,functionType:t.FunctionType.Information,description:"formula.functionList.NA.description",abstract:"formula.functionList.NA.abstract",functionParameter:[]},{functionName:t.FUNCTION_NAMES_INFORMATION.SHEET,functionType:t.FunctionType.Information,description:"formula.functionList.SHEET.description",abstract:"formula.functionList.SHEET.abstract",functionParameter:[{name:"formula.functionList.SHEET.functionParameter.value.name",detail:"formula.functionList.SHEET.functionParameter.value.detail",example:"A1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_INFORMATION.SHEETS,functionType:t.FunctionType.Information,description:"formula.functionList.SHEETS.description",abstract:"formula.functionList.SHEETS.abstract",functionParameter:[]},{functionName:t.FUNCTION_NAMES_INFORMATION.TYPE,functionType:t.FunctionType.Information,description:"formula.functionList.TYPE.description",abstract:"formula.functionList.TYPE.abstract",functionParameter:[{name:"formula.functionList.TYPE.functionParameter.value.name",detail:"formula.functionList.TYPE.functionParameter.value.detail",example:"A2",require:1,repeat:0}]}],$e=[{functionName:t.FUNCTION_NAMES_LOGICAL.AND,functionType:t.FunctionType.Logical,description:"formula.functionList.AND.description",abstract:"formula.functionList.AND.abstract",functionParameter:[{name:"formula.functionList.AND.functionParameter.logical1.name",detail:"formula.functionList.AND.functionParameter.logical1.detail",example:"A1=1",require:1,repeat:0},{name:"formula.functionList.AND.functionParameter.logical2.name",detail:"formula.functionList.AND.functionParameter.logical2.detail",example:"A2=2",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_LOGICAL.BYCOL,functionType:t.FunctionType.Logical,description:"formula.functionList.BYCOL.description",abstract:"formula.functionList.BYCOL.abstract",functionParameter:[{name:"formula.functionList.BYCOL.functionParameter.array.name",detail:"formula.functionList.BYCOL.functionParameter.array.detail",example:"A1:C2",require:1,repeat:0},{name:"formula.functionList.BYCOL.functionParameter.lambda.name",detail:"formula.functionList.BYCOL.functionParameter.lambda.detail",example:"LAMBDA(array, MAX(array))",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOGICAL.BYROW,functionType:t.FunctionType.Logical,description:"formula.functionList.BYROW.description",abstract:"formula.functionList.BYROW.abstract",functionParameter:[{name:"formula.functionList.BYROW.functionParameter.array.name",detail:"formula.functionList.BYROW.functionParameter.array.detail",example:"A1:C2",require:1,repeat:0},{name:"formula.functionList.BYROW.functionParameter.lambda.name",detail:"formula.functionList.BYROW.functionParameter.lambda.detail",example:"LAMBDA(array, MAX(array))",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOGICAL.FALSE,functionType:t.FunctionType.Logical,description:"formula.functionList.FALSE.description",abstract:"formula.functionList.FALSE.abstract",functionParameter:[]},{functionName:t.FUNCTION_NAMES_LOGICAL.IF,functionType:t.FunctionType.Logical,description:"formula.functionList.IF.description",abstract:"formula.functionList.IF.abstract",functionParameter:[{name:"formula.functionList.IF.functionParameter.logicalTest.name",detail:"formula.functionList.IF.functionParameter.logicalTest.detail",example:'A2 = "foo"',require:1,repeat:0},{name:"formula.functionList.IF.functionParameter.valueIfTrue.name",detail:"formula.functionList.IF.functionParameter.valueIfTrue.detail",example:'"A2 is foo"',require:1,repeat:0},{name:"formula.functionList.IF.functionParameter.valueIfFalse.name",detail:"formula.functionList.IF.functionParameter.valueIfFalse.detail",example:'"A2 is not foo"',require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOGICAL.IFERROR,functionType:t.FunctionType.Logical,description:"formula.functionList.IFERROR.description",abstract:"formula.functionList.IFERROR.abstract",functionParameter:[{name:"formula.functionList.IFERROR.functionParameter.value.name",detail:"formula.functionList.IFERROR.functionParameter.value.detail",example:"A2/B2",require:1,repeat:0},{name:"formula.functionList.IFERROR.functionParameter.valueIfError.name",detail:"formula.functionList.IFERROR.functionParameter.valueIfError.detail",example:'"Error in calculation"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOGICAL.IFNA,functionType:t.FunctionType.Logical,description:"formula.functionList.IFNA.description",abstract:"formula.functionList.IFNA.abstract",functionParameter:[{name:"formula.functionList.IFNA.functionParameter.value.name",detail:"formula.functionList.IFNA.functionParameter.value.detail",example:"VLOOKUP(C3,C6:D11,2,FALSE)",require:1,repeat:0},{name:"formula.functionList.IFNA.functionParameter.valueIfNa.name",detail:"formula.functionList.IFNA.functionParameter.valueIfNa.detail",example:'"Not Found"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOGICAL.IFS,functionType:t.FunctionType.Logical,description:"formula.functionList.IFS.description",abstract:"formula.functionList.IFS.abstract",functionParameter:[{name:"formula.functionList.IFS.functionParameter.logicalTest1.name",detail:"formula.functionList.IFS.functionParameter.logicalTest1.detail",example:'A2 = "foo"',require:1,repeat:0},{name:"formula.functionList.IFS.functionParameter.valueIfTrue1.name",detail:"formula.functionList.IFS.functionParameter.valueIfTrue1.detail",example:'"A2 is foo"',require:1,repeat:0},{name:"formula.functionList.IFS.functionParameter.logicalTest2.name",detail:"formula.functionList.IFS.functionParameter.logicalTest2.detail",example:"F2=1",require:0,repeat:1},{name:"formula.functionList.IFS.functionParameter.valueIfTrue2.name",detail:"formula.functionList.IFS.functionParameter.valueIfTrue2.detail",example:"D2",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_LOGICAL.LAMBDA,functionType:t.FunctionType.Logical,description:"formula.functionList.LAMBDA.description",abstract:"formula.functionList.LAMBDA.abstract",functionParameter:[{name:"formula.functionList.LAMBDA.functionParameter.parameter.name",detail:"formula.functionList.LAMBDA.functionParameter.parameter.detail",example:"[x, y, …,]",require:0,repeat:1},{name:"formula.functionList.LAMBDA.functionParameter.calculation.name",detail:"formula.functionList.LAMBDA.functionParameter.calculation.detail",example:"x+y",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOGICAL.LET,functionType:t.FunctionType.Logical,description:"formula.functionList.LET.description",abstract:"formula.functionList.LET.abstract",functionParameter:[{name:"formula.functionList.LET.functionParameter.name1.name",detail:"formula.functionList.LET.functionParameter.name1.detail",example:"x",require:1,repeat:0},{name:"formula.functionList.LET.functionParameter.nameValue1.name",detail:"formula.functionList.LET.functionParameter.nameValue1.detail",example:"5",require:1,repeat:0},{name:"formula.functionList.LET.functionParameter.calculationOrName2.name",detail:"formula.functionList.LET.functionParameter.calculationOrName2.detail",example:"y",require:1,repeat:0},{name:"formula.functionList.LET.functionParameter.nameValue2.name",detail:"formula.functionList.LET.functionParameter.nameValue2.detail",example:"6",require:0,repeat:1},{name:"formula.functionList.LET.functionParameter.calculationOrName3.name",detail:"formula.functionList.LET.functionParameter.calculationOrName3.detail",example:"SUM(x,y)",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_LOGICAL.MAKEARRAY,aliasFunctionName:"formula.functionList.MAKEARRAY.aliasFunctionName",functionType:t.FunctionType.Logical,description:"formula.functionList.MAKEARRAY.description",abstract:"formula.functionList.MAKEARRAY.abstract",functionParameter:[{name:"formula.functionList.MAKEARRAY.functionParameter.number1.name",detail:"formula.functionList.MAKEARRAY.functionParameter.number1.detail",example:"8",require:1,repeat:0},{name:"formula.functionList.MAKEARRAY.functionParameter.number2.name",detail:"formula.functionList.MAKEARRAY.functionParameter.number2.detail",example:"7",require:1,repeat:0},{name:"formula.functionList.MAKEARRAY.functionParameter.value3.name",detail:"formula.functionList.MAKEARRAY.functionParameter.value3.detail",example:"LAMBDA(r,c, r*c)",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOGICAL.MAP,functionType:t.FunctionType.Logical,description:"formula.functionList.MAP.description",abstract:"formula.functionList.MAP.abstract",functionParameter:[{name:"formula.functionList.MAP.functionParameter.array1.name",detail:"formula.functionList.MAP.functionParameter.array1.detail",example:"D2:D11",require:1,repeat:0},{name:"formula.functionList.MAP.functionParameter.array2.name",detail:"formula.functionList.MAP.functionParameter.array2.detail",example:"E2:E11",require:0,repeat:1},{name:"formula.functionList.MAP.functionParameter.lambda.name",detail:"formula.functionList.MAP.functionParameter.lambda.detail",example:'LAMBDA(s,c,AND(s="Large",c="Red"))',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOGICAL.NOT,functionType:t.FunctionType.Logical,description:"formula.functionList.NOT.description",abstract:"formula.functionList.NOT.abstract",functionParameter:[{name:"formula.functionList.NOT.functionParameter.logical.name",detail:"formula.functionList.NOT.functionParameter.logical.detail",example:"A2>100",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOGICAL.OR,functionType:t.FunctionType.Logical,description:"formula.functionList.OR.description",abstract:"formula.functionList.OR.abstract",functionParameter:[{name:"formula.functionList.OR.functionParameter.logical1.name",detail:"formula.functionList.OR.functionParameter.logical1.detail",example:"A1=1",require:1,repeat:0},{name:"formula.functionList.OR.functionParameter.logical2.name",detail:"formula.functionList.OR.functionParameter.logical2.detail",example:"A2=2",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_LOGICAL.REDUCE,functionType:t.FunctionType.Logical,description:"formula.functionList.REDUCE.description",abstract:"formula.functionList.REDUCE.abstract",functionParameter:[{name:"formula.functionList.REDUCE.functionParameter.initialValue.name",detail:"formula.functionList.REDUCE.functionParameter.initialValue.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.REDUCE.functionParameter.array.name",detail:"formula.functionList.REDUCE.functionParameter.array.detail",example:"A1:C2",require:1,repeat:0},{name:"formula.functionList.REDUCE.functionParameter.lambda.name",detail:"formula.functionList.REDUCE.functionParameter.lambda.detail",example:"LAMBDA(a,b,a+b^2)",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOGICAL.SCAN,functionType:t.FunctionType.Logical,description:"formula.functionList.SCAN.description",abstract:"formula.functionList.SCAN.abstract",functionParameter:[{name:"formula.functionList.SCAN.functionParameter.initialValue.name",detail:"formula.functionList.SCAN.functionParameter.initialValue.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.SCAN.functionParameter.array.name",detail:"formula.functionList.SCAN.functionParameter.array.detail",example:"A1:C2",require:1,repeat:0},{name:"formula.functionList.SCAN.functionParameter.lambda.name",detail:"formula.functionList.SCAN.functionParameter.lambda.detail",example:"LAMBDA(a,b,a+b^2)",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOGICAL.SWITCH,functionType:t.FunctionType.Logical,description:"formula.functionList.SWITCH.description",abstract:"formula.functionList.SWITCH.abstract",functionParameter:[{name:"formula.functionList.SWITCH.functionParameter.expression.name",detail:"formula.functionList.SWITCH.functionParameter.expression.detail",example:"WEEKDAY(A2)",require:1,repeat:0},{name:"formula.functionList.SWITCH.functionParameter.value1.name",detail:"formula.functionList.SWITCH.functionParameter.value1.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.SWITCH.functionParameter.result1.name",detail:"formula.functionList.SWITCH.functionParameter.result1.detail",example:'"Sunday"',require:1,repeat:0},{name:"formula.functionList.SWITCH.functionParameter.defaultOrValue2.name",detail:"formula.functionList.SWITCH.functionParameter.defaultOrValue2.detail",example:"2",require:0,repeat:1},{name:"formula.functionList.SWITCH.functionParameter.result2.name",detail:"formula.functionList.SWITCH.functionParameter.result2.detail",example:'"Monday"',require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_LOGICAL.TRUE,functionType:t.FunctionType.Logical,description:"formula.functionList.TRUE.description",abstract:"formula.functionList.TRUE.abstract",functionParameter:[]},{functionName:t.FUNCTION_NAMES_LOGICAL.XOR,functionType:t.FunctionType.Logical,description:"formula.functionList.XOR.description",abstract:"formula.functionList.XOR.abstract",functionParameter:[{name:"formula.functionList.XOR.functionParameter.logical1.name",detail:"formula.functionList.XOR.functionParameter.logical1.detail",example:"3>0",require:1,repeat:0},{name:"formula.functionList.XOR.functionParameter.logical2.name",detail:"formula.functionList.XOR.functionParameter.logical2.detail",example:"2<9",require:0,repeat:1}]}],ze=[{functionName:t.FUNCTION_NAMES_LOOKUP.ADDRESS,functionType:t.FunctionType.Lookup,description:"formula.functionList.ADDRESS.description",abstract:"formula.functionList.ADDRESS.abstract",functionParameter:[{name:"formula.functionList.ADDRESS.functionParameter.row_num.name",detail:"formula.functionList.ADDRESS.functionParameter.row_num.detail",example:"2",require:1,repeat:0},{name:"formula.functionList.ADDRESS.functionParameter.column_num.name",detail:"formula.functionList.ADDRESS.functionParameter.column_num.detail",example:"2",require:1,repeat:0},{name:"formula.functionList.ADDRESS.functionParameter.abs_num.name",detail:"formula.functionList.ADDRESS.functionParameter.abs_num.detail",example:"1",require:0,repeat:0},{name:"formula.functionList.ADDRESS.functionParameter.a1.name",detail:"formula.functionList.ADDRESS.functionParameter.a1.detail",example:"TRUE",require:0,repeat:0},{name:"formula.functionList.ADDRESS.functionParameter.sheet_text.name",detail:"formula.functionList.ADDRESS.functionParameter.sheet_text.detail",example:'"Sheet2"',require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOOKUP.AREAS,functionType:t.FunctionType.Lookup,description:"formula.functionList.AREAS.description",abstract:"formula.functionList.AREAS.abstract",functionParameter:[{name:"formula.functionList.AREAS.functionParameter.reference.name",detail:"formula.functionList.AREAS.functionParameter.reference.detail",example:"A1:A20",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOOKUP.CHOOSE,functionType:t.FunctionType.Lookup,description:"formula.functionList.CHOOSE.description",abstract:"formula.functionList.CHOOSE.abstract",functionParameter:[{name:"formula.functionList.CHOOSE.functionParameter.indexNum.name",detail:"formula.functionList.CHOOSE.functionParameter.indexNum.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.CHOOSE.functionParameter.value1.name",detail:"formula.functionList.CHOOSE.functionParameter.value1.detail",example:'"Hello"',require:1,repeat:0},{name:"formula.functionList.CHOOSE.functionParameter.value2.name",detail:"formula.functionList.CHOOSE.functionParameter.value2.detail",example:'"Univer"',require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_LOOKUP.CHOOSECOLS,functionType:t.FunctionType.Lookup,description:"formula.functionList.CHOOSECOLS.description",abstract:"formula.functionList.CHOOSECOLS.abstract",functionParameter:[{name:"formula.functionList.CHOOSECOLS.functionParameter.array.name",detail:"formula.functionList.CHOOSECOLS.functionParameter.array.detail",example:"A1:C2",require:1,repeat:0},{name:"formula.functionList.CHOOSECOLS.functionParameter.colNum1.name",detail:"formula.functionList.CHOOSECOLS.functionParameter.colNum1.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.CHOOSECOLS.functionParameter.colNum2.name",detail:"formula.functionList.CHOOSECOLS.functionParameter.colNum2.detail",example:"2",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_LOOKUP.CHOOSEROWS,functionType:t.FunctionType.Lookup,description:"formula.functionList.CHOOSEROWS.description",abstract:"formula.functionList.CHOOSEROWS.abstract",functionParameter:[{name:"formula.functionList.CHOOSEROWS.functionParameter.array.name",detail:"formula.functionList.CHOOSEROWS.functionParameter.array.detail",example:"A1:C2",require:1,repeat:0},{name:"formula.functionList.CHOOSEROWS.functionParameter.rowNum1.name",detail:"formula.functionList.CHOOSEROWS.functionParameter.rowNum1.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.CHOOSEROWS.functionParameter.rowNum2.name",detail:"formula.functionList.CHOOSEROWS.functionParameter.rowNum2.detail",example:"2",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_LOOKUP.COLUMN,functionType:t.FunctionType.Lookup,description:"formula.functionList.COLUMN.description",abstract:"formula.functionList.COLUMN.abstract",functionParameter:[{name:"formula.functionList.COLUMN.functionParameter.reference.name",detail:"formula.functionList.COLUMN.functionParameter.reference.detail",example:"A1:A20",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOOKUP.COLUMNS,functionType:t.FunctionType.Lookup,description:"formula.functionList.COLUMNS.description",abstract:"formula.functionList.COLUMNS.abstract",functionParameter:[{name:"formula.functionList.COLUMNS.functionParameter.array.name",detail:"formula.functionList.COLUMNS.functionParameter.array.detail",example:"A1:A20",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOOKUP.DROP,functionType:t.FunctionType.Lookup,description:"formula.functionList.DROP.description",abstract:"formula.functionList.DROP.abstract",functionParameter:[{name:"formula.functionList.DROP.functionParameter.array.name",detail:"formula.functionList.DROP.functionParameter.array.detail",example:"A2:C4",require:1,repeat:0},{name:"formula.functionList.DROP.functionParameter.rows.name",detail:"formula.functionList.DROP.functionParameter.rows.detail",example:"2",require:1,repeat:0},{name:"formula.functionList.DROP.functionParameter.columns.name",detail:"formula.functionList.DROP.functionParameter.columns.detail",example:"2",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOOKUP.EXPAND,functionType:t.FunctionType.Lookup,description:"formula.functionList.EXPAND.description",abstract:"formula.functionList.EXPAND.abstract",functionParameter:[{name:"formula.functionList.EXPAND.functionParameter.array.name",detail:"formula.functionList.EXPAND.functionParameter.array.detail",example:"A2",require:1,repeat:0},{name:"formula.functionList.EXPAND.functionParameter.rows.name",detail:"formula.functionList.EXPAND.functionParameter.rows.detail",example:"3",require:1,repeat:0},{name:"formula.functionList.EXPAND.functionParameter.columns.name",detail:"formula.functionList.EXPAND.functionParameter.columns.detail",example:"3",require:0,repeat:0},{name:"formula.functionList.EXPAND.functionParameter.padWith.name",detail:"formula.functionList.EXPAND.functionParameter.padWith.detail",example:'"-"',require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOOKUP.FILTER,functionType:t.FunctionType.Lookup,description:"formula.functionList.FILTER.description",abstract:"formula.functionList.FILTER.abstract",functionParameter:[{name:"formula.functionList.FILTER.functionParameter.array.name",detail:"formula.functionList.FILTER.functionParameter.array.detail",example:"A5:D20",require:1,repeat:0},{name:"formula.functionList.FILTER.functionParameter.include.name",detail:"formula.functionList.FILTER.functionParameter.include.detail",example:'(C5:C20="Apple")*(A5:A20="East")',require:1,repeat:0},{name:"formula.functionList.FILTER.functionParameter.ifEmpty.name",detail:"formula.functionList.FILTER.functionParameter.ifEmpty.detail",example:'""',require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOOKUP.FORMULATEXT,functionType:t.FunctionType.Lookup,description:"formula.functionList.FORMULATEXT.description",abstract:"formula.functionList.FORMULATEXT.abstract",functionParameter:[{name:"formula.functionList.FORMULATEXT.functionParameter.reference.name",detail:"formula.functionList.FORMULATEXT.functionParameter.reference.detail",example:"A1:A20",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOOKUP.GETPIVOTDATA,functionType:t.FunctionType.Lookup,description:"formula.functionList.GETPIVOTDATA.description",abstract:"formula.functionList.GETPIVOTDATA.abstract",functionParameter:[{name:"formula.functionList.GETPIVOTDATA.functionParameter.number1.name",detail:"formula.functionList.GETPIVOTDATA.functionParameter.number1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.GETPIVOTDATA.functionParameter.number2.name",detail:"formula.functionList.GETPIVOTDATA.functionParameter.number2.detail",example:"A1:A20",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOOKUP.HLOOKUP,functionType:t.FunctionType.Lookup,description:"formula.functionList.HLOOKUP.description",abstract:"formula.functionList.HLOOKUP.abstract",functionParameter:[{name:"formula.functionList.HLOOKUP.functionParameter.lookupValue.name",detail:"formula.functionList.HLOOKUP.functionParameter.lookupValue.detail",example:"A1",require:1,repeat:0},{name:"formula.functionList.HLOOKUP.functionParameter.tableArray.name",detail:"formula.functionList.HLOOKUP.functionParameter.tableArray.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.HLOOKUP.functionParameter.rowIndexNum.name",detail:"formula.functionList.HLOOKUP.functionParameter.rowIndexNum.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.HLOOKUP.functionParameter.rangeLookup.name",detail:"formula.functionList.HLOOKUP.functionParameter.rangeLookup.detail",example:"false",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOOKUP.HSTACK,functionType:t.FunctionType.Lookup,description:"formula.functionList.HSTACK.description",abstract:"formula.functionList.HSTACK.abstract",functionParameter:[{name:"formula.functionList.HSTACK.functionParameter.array1.name",detail:"formula.functionList.HSTACK.functionParameter.array1.detail",example:"A2:C3",require:1,repeat:0},{name:"formula.functionList.HSTACK.functionParameter.array2.name",detail:"formula.functionList.HSTACK.functionParameter.array2.detail",example:"E2:G3",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_LOOKUP.HYPERLINK,functionType:t.FunctionType.Lookup,description:"formula.functionList.HYPERLINK.description",abstract:"formula.functionList.HYPERLINK.abstract",functionParameter:[{name:"formula.functionList.HYPERLINK.functionParameter.url.name",detail:"formula.functionList.HYPERLINK.functionParameter.url.detail",example:'"https://univer.ai/"',require:1,repeat:0},{name:"formula.functionList.HYPERLINK.functionParameter.linkLabel.name",detail:"formula.functionList.HYPERLINK.functionParameter.linkLabel.detail",example:'"Univer"',require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOOKUP.IMAGE,functionType:t.FunctionType.Lookup,description:"formula.functionList.IMAGE.description",abstract:"formula.functionList.IMAGE.abstract",functionParameter:[{name:"formula.functionList.IMAGE.functionParameter.source.name",detail:"formula.functionList.IMAGE.functionParameter.source.detail",example:'"https://github.com/dream-num.png"',require:1,repeat:0},{name:"formula.functionList.IMAGE.functionParameter.altText.name",detail:"formula.functionList.IMAGE.functionParameter.altText.detail",example:'"Univer Logo"',require:0,repeat:0},{name:"formula.functionList.IMAGE.functionParameter.sizing.name",detail:"formula.functionList.IMAGE.functionParameter.sizing.detail",example:"3",require:0,repeat:0},{name:"formula.functionList.IMAGE.functionParameter.height.name",detail:"formula.functionList.IMAGE.functionParameter.height.detail",example:"100",require:0,repeat:0},{name:"formula.functionList.IMAGE.functionParameter.width.name",detail:"formula.functionList.IMAGE.functionParameter.width.detail",example:"100",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOOKUP.INDEX,functionType:t.FunctionType.Lookup,description:"formula.functionList.INDEX.description",abstract:"formula.functionList.INDEX.abstract",functionParameter:[{name:"formula.functionList.INDEX.functionParameter.reference.name",detail:"formula.functionList.INDEX.functionParameter.reference.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.INDEX.functionParameter.rowNum.name",detail:"formula.functionList.INDEX.functionParameter.rowNum.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.INDEX.functionParameter.columnNum.name",detail:"formula.functionList.INDEX.functionParameter.columnNum.detail",example:"1",require:0,repeat:0},{name:"formula.functionList.INDEX.functionParameter.areaNum.name",detail:"formula.functionList.INDEX.functionParameter.areaNum.detail",example:"2",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOOKUP.INDIRECT,functionType:t.FunctionType.Lookup,description:"formula.functionList.INDIRECT.description",abstract:"formula.functionList.INDIRECT.abstract",functionParameter:[{name:"formula.functionList.INDIRECT.functionParameter.refText.name",detail:"formula.functionList.INDIRECT.functionParameter.refText.detail",example:'"A1"',require:1,repeat:0},{name:"formula.functionList.INDIRECT.functionParameter.a1.name",detail:"formula.functionList.INDIRECT.functionParameter.a1.detail",example:"TRUE",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOOKUP.LOOKUP,functionType:t.FunctionType.Lookup,description:"formula.functionList.LOOKUP.description",abstract:"formula.functionList.LOOKUP.abstract",functionParameter:[{name:"formula.functionList.LOOKUP.functionParameter.lookupValue.name",detail:"formula.functionList.LOOKUP.functionParameter.lookupValue.detail",example:"A1",require:1,repeat:0},{name:"formula.functionList.LOOKUP.functionParameter.lookupVectorOrArray.name",detail:"formula.functionList.LOOKUP.functionParameter.lookupVectorOrArray.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.LOOKUP.functionParameter.resultVector.name",detail:"formula.functionList.LOOKUP.functionParameter.resultVector.detail",example:"A1:A20",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOOKUP.MATCH,functionType:t.FunctionType.Lookup,description:"formula.functionList.MATCH.description",abstract:"formula.functionList.MATCH.abstract",functionParameter:[{name:"formula.functionList.MATCH.functionParameter.lookupValue.name",detail:"formula.functionList.MATCH.functionParameter.lookupValue.detail",example:"10",require:1,repeat:0},{name:"formula.functionList.MATCH.functionParameter.lookupArray.name",detail:"formula.functionList.MATCH.functionParameter.lookupArray.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.MATCH.functionParameter.matchType.name",detail:"formula.functionList.MATCH.functionParameter.matchType.detail",example:"1",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOOKUP.OFFSET,functionType:t.FunctionType.Lookup,description:"formula.functionList.OFFSET.description",abstract:"formula.functionList.OFFSET.abstract",functionParameter:[{name:"formula.functionList.OFFSET.functionParameter.reference.name",detail:"formula.functionList.OFFSET.functionParameter.reference.detail",example:"A1",require:1,repeat:0},{name:"formula.functionList.OFFSET.functionParameter.rows.name",detail:"formula.functionList.OFFSET.functionParameter.rows.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.OFFSET.functionParameter.cols.name",detail:"formula.functionList.OFFSET.functionParameter.cols.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.OFFSET.functionParameter.height.name",detail:"formula.functionList.OFFSET.functionParameter.height.detail",example:"1",require:0,repeat:0},{name:"formula.functionList.OFFSET.functionParameter.width.name",detail:"formula.functionList.OFFSET.functionParameter.width.detail",example:"1",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOOKUP.ROW,functionType:t.FunctionType.Lookup,description:"formula.functionList.ROW.description",abstract:"formula.functionList.ROW.abstract",functionParameter:[{name:"formula.functionList.ROW.functionParameter.reference.name",detail:"formula.functionList.ROW.functionParameter.reference.detail",example:"A1",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOOKUP.ROWS,functionType:t.FunctionType.Lookup,description:"formula.functionList.ROWS.description",abstract:"formula.functionList.ROWS.abstract",functionParameter:[{name:"formula.functionList.ROWS.functionParameter.array.name",detail:"formula.functionList.ROWS.functionParameter.array.detail",example:"A1:A20",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOOKUP.RTD,functionType:t.FunctionType.Lookup,description:"formula.functionList.RTD.description",abstract:"formula.functionList.RTD.abstract",functionParameter:[{name:"formula.functionList.RTD.functionParameter.number1.name",detail:"formula.functionList.RTD.functionParameter.number1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.RTD.functionParameter.number2.name",detail:"formula.functionList.RTD.functionParameter.number2.detail",example:"A1:A20",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOOKUP.SORT,functionType:t.FunctionType.Lookup,description:"formula.functionList.SORT.description",abstract:"formula.functionList.SORT.abstract",functionParameter:[{name:"formula.functionList.SORT.functionParameter.array.name",detail:"formula.functionList.SORT.functionParameter.array.detail",example:"A2:A17",require:1,repeat:0},{name:"formula.functionList.SORT.functionParameter.sortIndex.name",detail:"formula.functionList.SORT.functionParameter.sortIndex.detail",example:"1",require:0,repeat:0},{name:"formula.functionList.SORT.functionParameter.sortOrder.name",detail:"formula.functionList.SORT.functionParameter.sortOrder.detail",example:"1",require:0,repeat:0},{name:"formula.functionList.SORT.functionParameter.byCol.name",detail:"formula.functionList.SORT.functionParameter.byCol.detail",example:"false",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOOKUP.SORTBY,functionType:t.FunctionType.Lookup,description:"formula.functionList.SORTBY.description",abstract:"formula.functionList.SORTBY.abstract",functionParameter:[{name:"formula.functionList.SORTBY.functionParameter.array.name",detail:"formula.functionList.SORTBY.functionParameter.array.detail",example:"D2:D9",require:1,repeat:0},{name:"formula.functionList.SORTBY.functionParameter.byArray1.name",detail:"formula.functionList.SORTBY.functionParameter.byArray1.detail",example:"E2:E9",require:1,repeat:0},{name:"formula.functionList.SORTBY.functionParameter.sortOrder1.name",detail:"formula.functionList.SORTBY.functionParameter.sortOrder1.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.SORTBY.functionParameter.byArray2.name",detail:"formula.functionList.SORTBY.functionParameter.byArray2.detail",example:"E2:E9",require:0,repeat:1},{name:"formula.functionList.SORTBY.functionParameter.sortOrder2.name",detail:"formula.functionList.SORTBY.functionParameter.sortOrder2.detail",example:"1",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_LOOKUP.TAKE,functionType:t.FunctionType.Lookup,description:"formula.functionList.TAKE.description",abstract:"formula.functionList.TAKE.abstract",functionParameter:[{name:"formula.functionList.TAKE.functionParameter.array.name",detail:"formula.functionList.TAKE.functionParameter.array.detail",example:"A2:C4",require:1,repeat:0},{name:"formula.functionList.TAKE.functionParameter.rows.name",detail:"formula.functionList.TAKE.functionParameter.rows.detail",example:"2",require:1,repeat:0},{name:"formula.functionList.TAKE.functionParameter.columns.name",detail:"formula.functionList.TAKE.functionParameter.columns.detail",example:"2",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOOKUP.TOCOL,functionType:t.FunctionType.Lookup,description:"formula.functionList.TOCOL.description",abstract:"formula.functionList.TOCOL.abstract",functionParameter:[{name:"formula.functionList.TOCOL.functionParameter.array.name",detail:"formula.functionList.TOCOL.functionParameter.array.detail",example:"A2:D4",require:1,repeat:0},{name:"formula.functionList.TOCOL.functionParameter.ignore.name",detail:"formula.functionList.TOCOL.functionParameter.ignore.detail",example:"1",require:0,repeat:0},{name:"formula.functionList.TOCOL.functionParameter.scanByColumn.name",detail:"formula.functionList.TOCOL.functionParameter.scanByColumn.detail",example:"TRUE",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOOKUP.TOROW,functionType:t.FunctionType.Lookup,description:"formula.functionList.TOROW.description",abstract:"formula.functionList.TOROW.abstract",functionParameter:[{name:"formula.functionList.TOROW.functionParameter.array.name",detail:"formula.functionList.TOROW.functionParameter.array.detail",example:"A2:D4",require:1,repeat:0},{name:"formula.functionList.TOROW.functionParameter.ignore.name",detail:"formula.functionList.TOROW.functionParameter.ignore.detail",example:"1",require:0,repeat:0},{name:"formula.functionList.TOROW.functionParameter.scanByColumn.name",detail:"formula.functionList.TOROW.functionParameter.scanByColumn.detail",example:"TRUE",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOOKUP.TRANSPOSE,functionType:t.FunctionType.Lookup,description:"formula.functionList.TRANSPOSE.description",abstract:"formula.functionList.TRANSPOSE.abstract",functionParameter:[{name:"formula.functionList.TRANSPOSE.functionParameter.array.name",detail:"formula.functionList.TRANSPOSE.functionParameter.array.detail",example:"A2:F9",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOOKUP.UNIQUE,functionType:t.FunctionType.Lookup,description:"formula.functionList.UNIQUE.description",abstract:"formula.functionList.UNIQUE.abstract",functionParameter:[{name:"formula.functionList.UNIQUE.functionParameter.array.name",detail:"formula.functionList.UNIQUE.functionParameter.array.detail",example:"A2:A12",require:1,repeat:0},{name:"formula.functionList.UNIQUE.functionParameter.byCol.name",detail:"formula.functionList.UNIQUE.functionParameter.byCol.detail",example:"false",require:0,repeat:0},{name:"formula.functionList.UNIQUE.functionParameter.exactlyOnce.name",detail:"formula.functionList.UNIQUE.functionParameter.exactlyOnce.detail",example:"false",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOOKUP.VLOOKUP,functionType:t.FunctionType.Lookup,description:"formula.functionList.VLOOKUP.description",abstract:"formula.functionList.VLOOKUP.abstract",functionParameter:[{name:"formula.functionList.VLOOKUP.functionParameter.lookupValue.name",detail:"formula.functionList.VLOOKUP.functionParameter.lookupValue.detail",example:"B2",require:1,repeat:0},{name:"formula.functionList.VLOOKUP.functionParameter.tableArray.name",detail:"formula.functionList.VLOOKUP.functionParameter.tableArray.detail",example:"C2:E7",require:1,repeat:0},{name:"formula.functionList.VLOOKUP.functionParameter.colIndexNum.name",detail:"formula.functionList.VLOOKUP.functionParameter.colIndexNum.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.VLOOKUP.functionParameter.rangeLookup.name",detail:"formula.functionList.VLOOKUP.functionParameter.rangeLookup.detail",example:"TRUE",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOOKUP.VSTACK,functionType:t.FunctionType.Lookup,description:"formula.functionList.VSTACK.description",abstract:"formula.functionList.VSTACK.abstract",functionParameter:[{name:"formula.functionList.VSTACK.functionParameter.array1.name",detail:"formula.functionList.VSTACK.functionParameter.array1.detail",example:"A2:C3",require:1,repeat:0},{name:"formula.functionList.VSTACK.functionParameter.array2.name",detail:"formula.functionList.VSTACK.functionParameter.array2.detail",example:"E2:G3",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_LOOKUP.WRAPCOLS,functionType:t.FunctionType.Lookup,description:"formula.functionList.WRAPCOLS.description",abstract:"formula.functionList.WRAPCOLS.abstract",functionParameter:[{name:"formula.functionList.WRAPCOLS.functionParameter.vector.name",detail:"formula.functionList.WRAPCOLS.functionParameter.vector.detail",example:"A2:G2",require:1,repeat:0},{name:"formula.functionList.WRAPCOLS.functionParameter.wrapCount.name",detail:"formula.functionList.WRAPCOLS.functionParameter.wrapCount.detail",example:"3",require:1,repeat:0},{name:"formula.functionList.WRAPCOLS.functionParameter.padWith.name",detail:"formula.functionList.WRAPCOLS.functionParameter.padWith.detail",example:'"x"',require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOOKUP.WRAPROWS,functionType:t.FunctionType.Lookup,description:"formula.functionList.WRAPROWS.description",abstract:"formula.functionList.WRAPROWS.abstract",functionParameter:[{name:"formula.functionList.WRAPROWS.functionParameter.vector.name",detail:"formula.functionList.WRAPROWS.functionParameter.vector.detail",example:"A2:G2",require:1,repeat:0},{name:"formula.functionList.WRAPROWS.functionParameter.wrapCount.name",detail:"formula.functionList.WRAPROWS.functionParameter.wrapCount.detail",example:"3",require:1,repeat:0},{name:"formula.functionList.WRAPROWS.functionParameter.padWith.name",detail:"formula.functionList.WRAPROWS.functionParameter.padWith.detail",example:'"x"',require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOOKUP.XLOOKUP,functionType:t.FunctionType.Lookup,description:"formula.functionList.XLOOKUP.description",abstract:"formula.functionList.XLOOKUP.abstract",functionParameter:[{name:"formula.functionList.XLOOKUP.functionParameter.lookupValue.name",detail:"formula.functionList.XLOOKUP.functionParameter.lookupValue.detail",example:"A1",require:1,repeat:0},{name:"formula.functionList.XLOOKUP.functionParameter.lookupArray.name",detail:"formula.functionList.XLOOKUP.functionParameter.lookupArray.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.XLOOKUP.functionParameter.returnArray.name",detail:"formula.functionList.XLOOKUP.functionParameter.returnArray.detail",example:"B1:B20",require:1,repeat:0},{name:"formula.functionList.XLOOKUP.functionParameter.ifNotFound.name",detail:"formula.functionList.XLOOKUP.functionParameter.ifNotFound.detail",example:"default",require:0,repeat:0},{name:"formula.functionList.XLOOKUP.functionParameter.matchMode.name",detail:"formula.functionList.XLOOKUP.functionParameter.matchMode.detail",example:"0",require:0,repeat:0},{name:"formula.functionList.XLOOKUP.functionParameter.searchMode.name",detail:"formula.functionList.XLOOKUP.functionParameter.searchMode.detail",example:"1",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOOKUP.XMATCH,functionType:t.FunctionType.Lookup,description:"formula.functionList.XMATCH.description",abstract:"formula.functionList.XMATCH.abstract",functionParameter:[{name:"formula.functionList.XMATCH.functionParameter.lookupValue.name",detail:"formula.functionList.XMATCH.functionParameter.lookupValue.detail",example:"B1",require:1,repeat:0},{name:"formula.functionList.XMATCH.functionParameter.lookupArray.name",detail:"formula.functionList.XMATCH.functionParameter.lookupArray.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.XMATCH.functionParameter.matchMode.name",detail:"formula.functionList.XMATCH.functionParameter.matchMode.detail",example:"0",require:0,repeat:0},{name:"formula.functionList.XMATCH.functionParameter.searchMode.name",detail:"formula.functionList.XMATCH.functionParameter.searchMode.detail",example:"1",require:0,repeat:0}]}],Ze=[{functionName:t.FUNCTION_NAMES_MATH.ABS,functionType:t.FunctionType.Math,description:"formula.functionList.ABS.description",abstract:"formula.functionList.ABS.abstract",functionParameter:[{name:"formula.functionList.ABS.functionParameter.number.name",detail:"formula.functionList.ABS.functionParameter.number.detail",example:"-2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.ACOS,functionType:t.FunctionType.Math,description:"formula.functionList.ACOS.description",abstract:"formula.functionList.ACOS.abstract",functionParameter:[{name:"formula.functionList.ACOS.functionParameter.number.name",detail:"formula.functionList.ACOS.functionParameter.number.detail",example:"0",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.ACOSH,functionType:t.FunctionType.Math,description:"formula.functionList.ACOSH.description",abstract:"formula.functionList.ACOSH.abstract",functionParameter:[{name:"formula.functionList.ACOSH.functionParameter.number.name",detail:"formula.functionList.ACOSH.functionParameter.number.detail",example:"2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.ACOT,functionType:t.FunctionType.Math,description:"formula.functionList.ACOT.description",abstract:"formula.functionList.ACOT.abstract",functionParameter:[{name:"formula.functionList.ACOT.functionParameter.number.name",detail:"formula.functionList.ACOT.functionParameter.number.detail",example:"0",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.ACOTH,functionType:t.FunctionType.Math,description:"formula.functionList.ACOTH.description",abstract:"formula.functionList.ACOTH.abstract",functionParameter:[{name:"formula.functionList.ACOTH.functionParameter.number.name",detail:"formula.functionList.ACOTH.functionParameter.number.detail",example:"6",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.AGGREGATE,functionType:t.FunctionType.Math,description:"formula.functionList.AGGREGATE.description",abstract:"formula.functionList.AGGREGATE.abstract",functionParameter:[{name:"formula.functionList.AGGREGATE.functionParameter.functionNum.name",detail:"formula.functionList.AGGREGATE.functionParameter.functionNum.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.AGGREGATE.functionParameter.options.name",detail:"formula.functionList.AGGREGATE.functionParameter.options.detail",example:"6",require:1,repeat:0},{name:"formula.functionList.AGGREGATE.functionParameter.ref1.name",detail:"formula.functionList.AGGREGATE.functionParameter.ref1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.AGGREGATE.functionParameter.ref2.name",detail:"formula.functionList.AGGREGATE.functionParameter.ref2.detail",example:"B1:B20",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_MATH.ARABIC,functionType:t.FunctionType.Math,description:"formula.functionList.ARABIC.description",abstract:"formula.functionList.ARABIC.abstract",functionParameter:[{name:"formula.functionList.ARABIC.functionParameter.text.name",detail:"formula.functionList.ARABIC.functionParameter.text.detail",example:'"LVII"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.ASIN,functionType:t.FunctionType.Math,description:"formula.functionList.ASIN.description",abstract:"formula.functionList.ASIN.abstract",functionParameter:[{name:"formula.functionList.ASIN.functionParameter.number.name",detail:"formula.functionList.ASIN.functionParameter.number.detail",example:"0",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.ASINH,functionType:t.FunctionType.Math,description:"formula.functionList.ASINH.description",abstract:"formula.functionList.ASINH.abstract",functionParameter:[{name:"formula.functionList.ASINH.functionParameter.number.name",detail:"formula.functionList.ASINH.functionParameter.number.detail",example:"10",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.ATAN,functionType:t.FunctionType.Math,description:"formula.functionList.ATAN.description",abstract:"formula.functionList.ATAN.abstract",functionParameter:[{name:"formula.functionList.ATAN.functionParameter.number.name",detail:"formula.functionList.ATAN.functionParameter.number.detail",example:"1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.ATAN2,functionType:t.FunctionType.Math,description:"formula.functionList.ATAN2.description",abstract:"formula.functionList.ATAN2.abstract",functionParameter:[{name:"formula.functionList.ATAN2.functionParameter.xNum.name",detail:"formula.functionList.ATAN2.functionParameter.xNum.detail",example:"4",require:1,repeat:0},{name:"formula.functionList.ATAN2.functionParameter.yNum.name",detail:"formula.functionList.ATAN2.functionParameter.yNum.detail",example:"3",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.ATANH,functionType:t.FunctionType.Math,description:"formula.functionList.ATANH.description",abstract:"formula.functionList.ATANH.abstract",functionParameter:[{name:"formula.functionList.ATANH.functionParameter.number.name",detail:"formula.functionList.ATANH.functionParameter.number.detail",example:"0.1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.BASE,functionType:t.FunctionType.Math,description:"formula.functionList.BASE.description",abstract:"formula.functionList.BASE.abstract",functionParameter:[{name:"formula.functionList.BASE.functionParameter.number.name",detail:"formula.functionList.BASE.functionParameter.number.detail",example:"15",require:1,repeat:0},{name:"formula.functionList.BASE.functionParameter.radix.name",detail:"formula.functionList.BASE.functionParameter.radix.detail",example:"2",require:1,repeat:0},{name:"formula.functionList.BASE.functionParameter.minLength.name",detail:"formula.functionList.BASE.functionParameter.minLength.detail",example:"10",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.CEILING,functionType:t.FunctionType.Math,description:"formula.functionList.CEILING.description",abstract:"formula.functionList.CEILING.abstract",functionParameter:[{name:"formula.functionList.CEILING.functionParameter.number.name",detail:"formula.functionList.CEILING.functionParameter.number.detail",example:"2.5",require:1,repeat:0},{name:"formula.functionList.CEILING.functionParameter.significance.name",detail:"formula.functionList.CEILING.functionParameter.significance.detail",example:"1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.CEILING_MATH,functionType:t.FunctionType.Math,description:"formula.functionList.CEILING_MATH.description",abstract:"formula.functionList.CEILING_MATH.abstract",functionParameter:[{name:"formula.functionList.CEILING_MATH.functionParameter.number.name",detail:"formula.functionList.CEILING_MATH.functionParameter.number.detail",example:"-5.5",require:1,repeat:0},{name:"formula.functionList.CEILING_MATH.functionParameter.significance.name",detail:"formula.functionList.CEILING_MATH.functionParameter.significance.detail",example:"2",require:0,repeat:0},{name:"formula.functionList.CEILING_MATH.functionParameter.mode.name",detail:"formula.functionList.CEILING_MATH.functionParameter.mode.detail",example:"-1",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.CEILING_PRECISE,functionType:t.FunctionType.Math,description:"formula.functionList.CEILING_PRECISE.description",abstract:"formula.functionList.CEILING_PRECISE.abstract",functionParameter:[{name:"formula.functionList.CEILING_PRECISE.functionParameter.number.name",detail:"formula.functionList.CEILING_PRECISE.functionParameter.number.detail",example:"4.3",require:1,repeat:0},{name:"formula.functionList.CEILING_PRECISE.functionParameter.significance.name",detail:"formula.functionList.CEILING_PRECISE.functionParameter.significance.detail",example:"2",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.COMBIN,functionType:t.FunctionType.Math,description:"formula.functionList.COMBIN.description",abstract:"formula.functionList.COMBIN.abstract",functionParameter:[{name:"formula.functionList.COMBIN.functionParameter.number.name",detail:"formula.functionList.COMBIN.functionParameter.number.detail",example:"8",require:1,repeat:0},{name:"formula.functionList.COMBIN.functionParameter.numberChosen.name",detail:"formula.functionList.COMBIN.functionParameter.numberChosen.detail",example:"2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.COMBINA,functionType:t.FunctionType.Math,description:"formula.functionList.COMBINA.description",abstract:"formula.functionList.COMBINA.abstract",functionParameter:[{name:"formula.functionList.COMBINA.functionParameter.number.name",detail:"formula.functionList.COMBINA.functionParameter.number.detail",example:"8",require:1,repeat:0},{name:"formula.functionList.COMBINA.functionParameter.numberChosen.name",detail:"formula.functionList.COMBINA.functionParameter.numberChosen.detail",example:"2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.COS,functionType:t.FunctionType.Math,description:"formula.functionList.COS.description",abstract:"formula.functionList.COS.abstract",functionParameter:[{name:"formula.functionList.COS.functionParameter.number.name",detail:"formula.functionList.COS.functionParameter.number.detail",example:"1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.COSH,functionType:t.FunctionType.Math,description:"formula.functionList.COSH.description",abstract:"formula.functionList.COSH.abstract",functionParameter:[{name:"formula.functionList.COSH.functionParameter.number.name",detail:"formula.functionList.COSH.functionParameter.number.detail",example:"4",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.COT,functionType:t.FunctionType.Math,description:"formula.functionList.COT.description",abstract:"formula.functionList.COT.abstract",functionParameter:[{name:"formula.functionList.COT.functionParameter.number.name",detail:"formula.functionList.COT.functionParameter.number.detail",example:"30",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.COTH,functionType:t.FunctionType.Math,description:"formula.functionList.COTH.description",abstract:"formula.functionList.COTH.abstract",functionParameter:[{name:"formula.functionList.COTH.functionParameter.number.name",detail:"formula.functionList.COTH.functionParameter.number.detail",example:"2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.CSC,functionType:t.FunctionType.Math,description:"formula.functionList.CSC.description",abstract:"formula.functionList.CSC.abstract",functionParameter:[{name:"formula.functionList.CSC.functionParameter.number.name",detail:"formula.functionList.CSC.functionParameter.number.detail",example:"15",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.CSCH,functionType:t.FunctionType.Math,description:"formula.functionList.CSCH.description",abstract:"formula.functionList.CSCH.abstract",functionParameter:[{name:"formula.functionList.CSCH.functionParameter.number.name",detail:"formula.functionList.CSCH.functionParameter.number.detail",example:"1.5",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.DECIMAL,functionType:t.FunctionType.Math,description:"formula.functionList.DECIMAL.description",abstract:"formula.functionList.DECIMAL.abstract",functionParameter:[{name:"formula.functionList.DECIMAL.functionParameter.text.name",detail:"formula.functionList.DECIMAL.functionParameter.text.detail",example:'"FF"',require:1,repeat:0},{name:"formula.functionList.DECIMAL.functionParameter.radix.name",detail:"formula.functionList.DECIMAL.functionParameter.radix.detail",example:"16",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.DEGREES,functionType:t.FunctionType.Math,description:"formula.functionList.DEGREES.description",abstract:"formula.functionList.DEGREES.abstract",functionParameter:[{name:"formula.functionList.DEGREES.functionParameter.angle.name",detail:"formula.functionList.DEGREES.functionParameter.angle.detail",example:"PI()",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.EVEN,functionType:t.FunctionType.Math,description:"formula.functionList.EVEN.description",abstract:"formula.functionList.EVEN.abstract",functionParameter:[{name:"formula.functionList.EVEN.functionParameter.number.name",detail:"formula.functionList.EVEN.functionParameter.number.detail",example:"1.5",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.EXP,functionType:t.FunctionType.Math,description:"formula.functionList.EXP.description",abstract:"formula.functionList.EXP.abstract",functionParameter:[{name:"formula.functionList.EXP.functionParameter.number.name",detail:"formula.functionList.EXP.functionParameter.number.detail",example:"2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.FACT,functionType:t.FunctionType.Math,description:"formula.functionList.FACT.description",abstract:"formula.functionList.FACT.abstract",functionParameter:[{name:"formula.functionList.FACT.functionParameter.number.name",detail:"formula.functionList.FACT.functionParameter.number.detail",example:"5",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.FACTDOUBLE,functionType:t.FunctionType.Math,description:"formula.functionList.FACTDOUBLE.description",abstract:"formula.functionList.FACTDOUBLE.abstract",functionParameter:[{name:"formula.functionList.FACTDOUBLE.functionParameter.number.name",detail:"formula.functionList.FACTDOUBLE.functionParameter.number.detail",example:"6",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.FLOOR,functionType:t.FunctionType.Math,description:"formula.functionList.FLOOR.description",abstract:"formula.functionList.FLOOR.abstract",functionParameter:[{name:"formula.functionList.FLOOR.functionParameter.number.name",detail:"formula.functionList.FLOOR.functionParameter.number.detail",example:"3.7",require:1,repeat:0},{name:"formula.functionList.FLOOR.functionParameter.significance.name",detail:"formula.functionList.FLOOR.functionParameter.significance.detail",example:"2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.FLOOR_MATH,functionType:t.FunctionType.Math,description:"formula.functionList.FLOOR_MATH.description",abstract:"formula.functionList.FLOOR_MATH.abstract",functionParameter:[{name:"formula.functionList.FLOOR_MATH.functionParameter.number.name",detail:"formula.functionList.FLOOR_MATH.functionParameter.number.detail",example:"-5.5",require:1,repeat:0},{name:"formula.functionList.FLOOR_MATH.functionParameter.significance.name",detail:"formula.functionList.FLOOR_MATH.functionParameter.significance.detail",example:"2",require:0,repeat:0},{name:"formula.functionList.FLOOR_MATH.functionParameter.mode.name",detail:"formula.functionList.FLOOR_MATH.functionParameter.mode.detail",example:"-1",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.FLOOR_PRECISE,functionType:t.FunctionType.Math,description:"formula.functionList.FLOOR_PRECISE.description",abstract:"formula.functionList.FLOOR_PRECISE.abstract",functionParameter:[{name:"formula.functionList.FLOOR_PRECISE.functionParameter.number.name",detail:"formula.functionList.FLOOR_PRECISE.functionParameter.number.detail",example:"-3.2",require:1,repeat:0},{name:"formula.functionList.FLOOR_PRECISE.functionParameter.significance.name",detail:"formula.functionList.FLOOR_PRECISE.functionParameter.significance.detail",example:"-1",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.GCD,functionType:t.FunctionType.Math,description:"formula.functionList.GCD.description",abstract:"formula.functionList.GCD.abstract",functionParameter:[{name:"formula.functionList.GCD.functionParameter.number1.name",detail:"formula.functionList.GCD.functionParameter.number1.detail",example:"5",require:1,repeat:0},{name:"formula.functionList.GCD.functionParameter.number2.name",detail:"formula.functionList.GCD.functionParameter.number2.detail",example:"2",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_MATH.INT,functionType:t.FunctionType.Math,description:"formula.functionList.INT.description",abstract:"formula.functionList.INT.abstract",functionParameter:[{name:"formula.functionList.INT.functionParameter.number.name",detail:"formula.functionList.INT.functionParameter.number.detail",example:"8.9",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.ISO_CEILING,functionType:t.FunctionType.Math,description:"formula.functionList.ISO_CEILING.description",abstract:"formula.functionList.ISO_CEILING.abstract",functionParameter:[{name:"formula.functionList.ISO_CEILING.functionParameter.number1.name",detail:"formula.functionList.ISO_CEILING.functionParameter.number1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.ISO_CEILING.functionParameter.number2.name",detail:"formula.functionList.ISO_CEILING.functionParameter.number2.detail",example:"A1:A20",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.LCM,functionType:t.FunctionType.Math,description:"formula.functionList.LCM.description",abstract:"formula.functionList.LCM.abstract",functionParameter:[{name:"formula.functionList.LCM.functionParameter.number1.name",detail:"formula.functionList.LCM.functionParameter.number1.detail",example:"5",require:1,repeat:0},{name:"formula.functionList.LCM.functionParameter.number2.name",detail:"formula.functionList.LCM.functionParameter.number2.detail",example:"2",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_MATH.LET,functionType:t.FunctionType.Math,description:"formula.functionList.LET.description",abstract:"formula.functionList.LET.abstract",functionParameter:[{name:"formula.functionList.LET.functionParameter.number1.name",detail:"formula.functionList.LET.functionParameter.number1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.LET.functionParameter.number2.name",detail:"formula.functionList.LET.functionParameter.number2.detail",example:"A1:A20",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.LN,functionType:t.FunctionType.Math,description:"formula.functionList.LN.description",abstract:"formula.functionList.LN.abstract",functionParameter:[{name:"formula.functionList.LN.functionParameter.number.name",detail:"formula.functionList.LN.functionParameter.number.detail",example:"EXP(3)",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.LOG,functionType:t.FunctionType.Math,description:"formula.functionList.LOG.description",abstract:"formula.functionList.LOG.abstract",functionParameter:[{name:"formula.functionList.LOG.functionParameter.number.name",detail:"formula.functionList.LOG.functionParameter.number.detail",example:"8",require:1,repeat:0},{name:"formula.functionList.LOG.functionParameter.base.name",detail:"formula.functionList.LOG.functionParameter.base.detail",example:"2",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.LOG10,functionType:t.FunctionType.Math,description:"formula.functionList.LOG10.description",abstract:"formula.functionList.LOG10.abstract",functionParameter:[{name:"formula.functionList.LOG10.functionParameter.number.name",detail:"formula.functionList.LOG10.functionParameter.number.detail",example:"100000",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.MDETERM,functionType:t.FunctionType.Math,description:"formula.functionList.MDETERM.description",abstract:"formula.functionList.MDETERM.abstract",functionParameter:[{name:"formula.functionList.MDETERM.functionParameter.array.name",detail:"formula.functionList.MDETERM.functionParameter.array.detail",example:"A1:C3",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.MINVERSE,functionType:t.FunctionType.Math,description:"formula.functionList.MINVERSE.description",abstract:"formula.functionList.MINVERSE.abstract",functionParameter:[{name:"formula.functionList.MINVERSE.functionParameter.array.name",detail:"formula.functionList.MINVERSE.functionParameter.array.detail",example:"A1:C3",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.MMULT,functionType:t.FunctionType.Math,description:"formula.functionList.MMULT.description",abstract:"formula.functionList.MMULT.abstract",functionParameter:[{name:"formula.functionList.MMULT.functionParameter.array1.name",detail:"formula.functionList.MMULT.functionParameter.array1.detail",example:"A2:B3",require:1,repeat:0},{name:"formula.functionList.MMULT.functionParameter.array2.name",detail:"formula.functionList.MMULT.functionParameter.array2.detail",example:"A5:B6",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.MOD,functionType:t.FunctionType.Math,description:"formula.functionList.MOD.description",abstract:"formula.functionList.MOD.abstract",functionParameter:[{name:"formula.functionList.MOD.functionParameter.number.name",detail:"formula.functionList.MOD.functionParameter.number.detail",example:"3",require:1,repeat:0},{name:"formula.functionList.MOD.functionParameter.divisor.name",detail:"formula.functionList.MOD.functionParameter.divisor.detail",example:"2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.MROUND,functionType:t.FunctionType.Math,description:"formula.functionList.MROUND.description",abstract:"formula.functionList.MROUND.abstract",functionParameter:[{name:"formula.functionList.MROUND.functionParameter.number.name",detail:"formula.functionList.MROUND.functionParameter.number.detail",example:"10",require:1,repeat:0},{name:"formula.functionList.MROUND.functionParameter.multiple.name",detail:"formula.functionList.MROUND.functionParameter.multiple.detail",example:"3",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.MULTINOMIAL,functionType:t.FunctionType.Math,description:"formula.functionList.MULTINOMIAL.description",abstract:"formula.functionList.MULTINOMIAL.abstract",functionParameter:[{name:"formula.functionList.MULTINOMIAL.functionParameter.number1.name",detail:"formula.functionList.MULTINOMIAL.functionParameter.number1.detail",example:"5",require:1,repeat:0},{name:"formula.functionList.MULTINOMIAL.functionParameter.number2.name",detail:"formula.functionList.MULTINOMIAL.functionParameter.number2.detail",example:"2",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_MATH.MUNIT,functionType:t.FunctionType.Math,description:"formula.functionList.MUNIT.description",abstract:"formula.functionList.MUNIT.abstract",functionParameter:[{name:"formula.functionList.MUNIT.functionParameter.dimension.name",detail:"formula.functionList.MUNIT.functionParameter.dimension.detail",example:"3",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.ODD,functionType:t.FunctionType.Math,description:"formula.functionList.ODD.description",abstract:"formula.functionList.ODD.abstract",functionParameter:[{name:"formula.functionList.ODD.functionParameter.number.name",detail:"formula.functionList.ODD.functionParameter.number.detail",example:"1.5",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.PI,functionType:t.FunctionType.Math,description:"formula.functionList.PI.description",abstract:"formula.functionList.PI.abstract",functionParameter:[]},{functionName:t.FUNCTION_NAMES_MATH.POWER,functionType:t.FunctionType.Math,description:"formula.functionList.POWER.description",abstract:"formula.functionList.POWER.abstract",functionParameter:[{name:"formula.functionList.POWER.functionParameter.number.name",detail:"formula.functionList.POWER.functionParameter.number.detail",example:"5",require:1,repeat:0},{name:"formula.functionList.POWER.functionParameter.power.name",detail:"formula.functionList.POWER.functionParameter.power.detail",example:"2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.PRODUCT,functionType:t.FunctionType.Math,description:"formula.functionList.PRODUCT.description",abstract:"formula.functionList.PRODUCT.abstract",functionParameter:[{name:"formula.functionList.PRODUCT.functionParameter.number1.name",detail:"formula.functionList.PRODUCT.functionParameter.number1.detail",example:"A1",require:1,repeat:0},{name:"formula.functionList.PRODUCT.functionParameter.number2.name",detail:"formula.functionList.PRODUCT.functionParameter.number2.detail",example:"A2",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_MATH.QUOTIENT,functionType:t.FunctionType.Math,description:"formula.functionList.QUOTIENT.description",abstract:"formula.functionList.QUOTIENT.abstract",functionParameter:[{name:"formula.functionList.QUOTIENT.functionParameter.numerator.name",detail:"formula.functionList.QUOTIENT.functionParameter.numerator.detail",example:"5",require:1,repeat:0},{name:"formula.functionList.QUOTIENT.functionParameter.denominator.name",detail:"formula.functionList.QUOTIENT.functionParameter.denominator.detail",example:"2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.RADIANS,functionType:t.FunctionType.Math,description:"formula.functionList.RADIANS.description",abstract:"formula.functionList.RADIANS.abstract",functionParameter:[{name:"formula.functionList.RADIANS.functionParameter.angle.name",detail:"formula.functionList.RADIANS.functionParameter.angle.detail",example:"270",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.RAND,functionType:t.FunctionType.Math,description:"formula.functionList.RAND.description",abstract:"formula.functionList.RAND.abstract",functionParameter:[]},{functionName:t.FUNCTION_NAMES_MATH.RANDARRAY,functionType:t.FunctionType.Math,description:"formula.functionList.RANDARRAY.description",abstract:"formula.functionList.RANDARRAY.abstract",functionParameter:[{name:"formula.functionList.RANDARRAY.functionParameter.rows.name",detail:"formula.functionList.RANDARRAY.functionParameter.rows.detail",example:"5",require:0,repeat:0},{name:"formula.functionList.RANDARRAY.functionParameter.columns.name",detail:"formula.functionList.RANDARRAY.functionParameter.columns.detail",example:"3",require:0,repeat:0},{name:"formula.functionList.RANDARRAY.functionParameter.min.name",detail:"formula.functionList.RANDARRAY.functionParameter.min.detail",example:"1",require:0,repeat:0},{name:"formula.functionList.RANDARRAY.functionParameter.max.name",detail:"formula.functionList.RANDARRAY.functionParameter.max.detail",example:"100",require:0,repeat:0},{name:"formula.functionList.RANDARRAY.functionParameter.wholeNumber.name",detail:"formula.functionList.RANDARRAY.functionParameter.wholeNumber.detail",example:"TRUE",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.RANDBETWEEN,functionType:t.FunctionType.Math,description:"formula.functionList.RANDBETWEEN.description",abstract:"formula.functionList.RANDBETWEEN.abstract",functionParameter:[{name:"formula.functionList.RANDBETWEEN.functionParameter.bottom.name",detail:"formula.functionList.RANDBETWEEN.functionParameter.bottom.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.RANDBETWEEN.functionParameter.top.name",detail:"formula.functionList.RANDBETWEEN.functionParameter.top.detail",example:"100",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.ROMAN,functionType:t.FunctionType.Math,description:"formula.functionList.ROMAN.description",abstract:"formula.functionList.ROMAN.abstract",functionParameter:[{name:"formula.functionList.ROMAN.functionParameter.number.name",detail:"formula.functionList.ROMAN.functionParameter.number.detail",example:"499",require:1,repeat:0},{name:"formula.functionList.ROMAN.functionParameter.form.name",detail:"formula.functionList.ROMAN.functionParameter.form.detail",example:"0",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.ROUND,functionType:t.FunctionType.Math,description:"formula.functionList.ROUND.description",abstract:"formula.functionList.ROUND.abstract",functionParameter:[{name:"formula.functionList.ROUND.functionParameter.number.name",detail:"formula.functionList.ROUND.functionParameter.number.detail",example:"2.15",require:1,repeat:0},{name:"formula.functionList.ROUND.functionParameter.numDigits.name",detail:"formula.functionList.ROUND.functionParameter.numDigits.detail",example:"1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.ROUNDBANK,functionType:t.FunctionType.Math,description:"formula.functionList.ROUNDBANK.description",abstract:"formula.functionList.ROUNDBANK.abstract",functionParameter:[{name:"formula.functionList.ROUNDBANK.functionParameter.number.name",detail:"formula.functionList.ROUNDBANK.functionParameter.number.detail",example:"2.345",require:1,repeat:0},{name:"formula.functionList.ROUNDBANK.functionParameter.numDigits.name",detail:"formula.functionList.ROUNDBANK.functionParameter.numDigits.detail",example:"2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.ROUNDDOWN,functionType:t.FunctionType.Math,description:"formula.functionList.ROUNDDOWN.description",abstract:"formula.functionList.ROUNDDOWN.abstract",functionParameter:[{name:"formula.functionList.ROUNDDOWN.functionParameter.number.name",detail:"formula.functionList.ROUNDDOWN.functionParameter.number.detail",example:"3.2",require:1,repeat:0},{name:"formula.functionList.ROUNDDOWN.functionParameter.numDigits.name",detail:"formula.functionList.ROUNDDOWN.functionParameter.numDigits.detail",example:"0",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.ROUNDUP,functionType:t.FunctionType.Math,description:"formula.functionList.ROUNDUP.description",abstract:"formula.functionList.ROUNDUP.abstract",functionParameter:[{name:"formula.functionList.ROUNDUP.functionParameter.number.name",detail:"formula.functionList.ROUNDUP.functionParameter.number.detail",example:"3.2",require:1,repeat:0},{name:"formula.functionList.ROUNDUP.functionParameter.numDigits.name",detail:"formula.functionList.ROUNDUP.functionParameter.numDigits.detail",example:"0",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.SEC,functionType:t.FunctionType.Math,description:"formula.functionList.SEC.description",abstract:"formula.functionList.SEC.abstract",functionParameter:[{name:"formula.functionList.SEC.functionParameter.number.name",detail:"formula.functionList.SEC.functionParameter.number.detail",example:"30",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.SECH,functionType:t.FunctionType.Math,description:"formula.functionList.SECH.description",abstract:"formula.functionList.SECH.abstract",functionParameter:[{name:"formula.functionList.SECH.functionParameter.number.name",detail:"formula.functionList.SECH.functionParameter.number.detail",example:"30",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.SERIESSUM,functionType:t.FunctionType.Math,description:"formula.functionList.SERIESSUM.description",abstract:"formula.functionList.SERIESSUM.abstract",functionParameter:[{name:"formula.functionList.SERIESSUM.functionParameter.x.name",detail:"formula.functionList.SERIESSUM.functionParameter.x.detail",example:"0.785398163",require:1,repeat:0},{name:"formula.functionList.SERIESSUM.functionParameter.n.name",detail:"formula.functionList.SERIESSUM.functionParameter.n.detail",example:"0",require:1,repeat:0},{name:"formula.functionList.SERIESSUM.functionParameter.m.name",detail:"formula.functionList.SERIESSUM.functionParameter.m.detail",example:"2",require:1,repeat:0},{name:"formula.functionList.SERIESSUM.functionParameter.coefficients.name",detail:"formula.functionList.SERIESSUM.functionParameter.coefficients.detail",example:"A1:A4",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.SEQUENCE,functionType:t.FunctionType.Math,description:"formula.functionList.SEQUENCE.description",abstract:"formula.functionList.SEQUENCE.abstract",functionParameter:[{name:"formula.functionList.SEQUENCE.functionParameter.rows.name",detail:"formula.functionList.SEQUENCE.functionParameter.rows.detail",example:"4",require:1,repeat:0},{name:"formula.functionList.SEQUENCE.functionParameter.columns.name",detail:"formula.functionList.SEQUENCE.functionParameter.columns.detail",example:"5",require:0,repeat:0},{name:"formula.functionList.SEQUENCE.functionParameter.start.name",detail:"formula.functionList.SEQUENCE.functionParameter.start.detail",example:"1",require:0,repeat:0},{name:"formula.functionList.SEQUENCE.functionParameter.step.name",detail:"formula.functionList.SEQUENCE.functionParameter.step.detail",example:"1",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.SIGN,functionType:t.FunctionType.Math,description:"formula.functionList.SIGN.description",abstract:"formula.functionList.SIGN.abstract",functionParameter:[{name:"formula.functionList.SIGN.functionParameter.number.name",detail:"formula.functionList.SIGN.functionParameter.number.detail",example:"10",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.SIN,functionType:t.FunctionType.Math,description:"formula.functionList.SIN.description",abstract:"formula.functionList.SIN.abstract",functionParameter:[{name:"formula.functionList.SIN.functionParameter.number.name",detail:"formula.functionList.SIN.functionParameter.number.detail",example:"30*PI()/180",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.SINH,functionType:t.FunctionType.Math,description:"formula.functionList.SINH.description",abstract:"formula.functionList.SINH.abstract",functionParameter:[{name:"formula.functionList.SINH.functionParameter.number.name",detail:"formula.functionList.SINH.functionParameter.number.detail",example:"0.0342*1.03",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.SQRT,functionType:t.FunctionType.Math,description:"formula.functionList.SQRT.description",abstract:"formula.functionList.SQRT.abstract",functionParameter:[{name:"formula.functionList.SQRT.functionParameter.number.name",detail:"formula.functionList.SQRT.functionParameter.number.detail",example:"16",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.SQRTPI,functionType:t.FunctionType.Math,description:"formula.functionList.SQRTPI.description",abstract:"formula.functionList.SQRTPI.abstract",functionParameter:[{name:"formula.functionList.SQRTPI.functionParameter.number.name",detail:"formula.functionList.SQRTPI.functionParameter.number.detail",example:"1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.SUBTOTAL,functionType:t.FunctionType.Math,description:"formula.functionList.SUBTOTAL.description",abstract:"formula.functionList.SUBTOTAL.abstract",functionParameter:[{name:"formula.functionList.SUBTOTAL.functionParameter.functionNum.name",detail:"formula.functionList.SUBTOTAL.functionParameter.functionNum.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.SUBTOTAL.functionParameter.ref1.name",detail:"formula.functionList.SUBTOTAL.functionParameter.ref1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.SUBTOTAL.functionParameter.ref2.name",detail:"formula.functionList.SUBTOTAL.functionParameter.ref2.detail",example:"B1:B20",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_MATH.SUM,aliasFunctionName:"formula.functionList.SUM.aliasFunctionName",functionType:t.FunctionType.Math,description:"formula.functionList.SUM.description",abstract:"formula.functionList.SUM.abstract",functionParameter:[{name:"formula.functionList.SUM.functionParameter.number1.name",detail:"formula.functionList.SUM.functionParameter.number1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.SUM.functionParameter.number2.name",detail:"formula.functionList.SUM.functionParameter.number2.detail",example:"B2:B10",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_MATH.SUMIF,aliasFunctionName:"formula.functionList.SUMIF.aliasFunctionName",functionType:t.FunctionType.Math,description:"formula.functionList.SUMIF.description",abstract:"formula.functionList.SUMIF.abstract",functionParameter:[{name:"formula.functionList.SUMIF.functionParameter.range.name",detail:"formula.functionList.SUMIF.functionParameter.range.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.SUMIF.functionParameter.criteria.name",detail:"formula.functionList.SUMIF.functionParameter.criteria.detail",example:'">5"',require:1,repeat:0},{name:"formula.functionList.SUMIF.functionParameter.sumRange.name",detail:"formula.functionList.SUMIF.functionParameter.sumRange.detail",example:"B1:B20",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.SUMIFS,functionType:t.FunctionType.Math,description:"formula.functionList.SUMIFS.description",abstract:"formula.functionList.SUMIFS.abstract",functionParameter:[{name:"formula.functionList.SUMIFS.functionParameter.sumRange.name",detail:"formula.functionList.SUMIFS.functionParameter.sumRange.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.SUMIFS.functionParameter.criteriaRange1.name",detail:"formula.functionList.SUMIFS.functionParameter.criteriaRange1.detail",example:"B1:B20",require:1,repeat:0},{name:"formula.functionList.SUMIFS.functionParameter.criteria1.name",detail:"formula.functionList.SUMIFS.functionParameter.criteria1.detail",example:'">10"',require:1,repeat:0},{name:"formula.functionList.SUMIFS.functionParameter.criteriaRange2.name",detail:"formula.functionList.SUMIFS.functionParameter.criteriaRange2.detail",example:"C1:C20",require:0,repeat:1},{name:"formula.functionList.SUMIFS.functionParameter.criteria2.name",detail:"formula.functionList.SUMIFS.functionParameter.criteria2.detail",example:'"<20"',require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_MATH.SUMPRODUCT,functionType:t.FunctionType.Math,description:"formula.functionList.SUMPRODUCT.description",abstract:"formula.functionList.SUMPRODUCT.abstract",functionParameter:[{name:"formula.functionList.SUMPRODUCT.functionParameter.array1.name",detail:"formula.functionList.SUMPRODUCT.functionParameter.array1.detail",example:"C2:C5",require:1,repeat:0},{name:"formula.functionList.SUMPRODUCT.functionParameter.array2.name",detail:"formula.functionList.SUMPRODUCT.functionParameter.array2.detail",example:"D2:D5",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_MATH.SUMSQ,functionType:t.FunctionType.Math,description:"formula.functionList.SUMSQ.description",abstract:"formula.functionList.SUMSQ.abstract",functionParameter:[{name:"formula.functionList.SUMSQ.functionParameter.number1.name",detail:"formula.functionList.SUMSQ.functionParameter.number1.detail",example:"3",require:1,repeat:0},{name:"formula.functionList.SUMSQ.functionParameter.number2.name",detail:"formula.functionList.SUMSQ.functionParameter.number2.detail",example:"4",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_MATH.SUMX2MY2,functionType:t.FunctionType.Math,description:"formula.functionList.SUMX2MY2.description",abstract:"formula.functionList.SUMX2MY2.abstract",functionParameter:[{name:"formula.functionList.SUMX2MY2.functionParameter.arrayX.name",detail:"formula.functionList.SUMX2MY2.functionParameter.arrayX.detail",example:"A2:A8",require:1,repeat:0},{name:"formula.functionList.SUMX2MY2.functionParameter.arrayY.name",detail:"formula.functionList.SUMX2MY2.functionParameter.arrayY.detail",example:"B2:B8",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.SUMX2PY2,functionType:t.FunctionType.Math,description:"formula.functionList.SUMX2PY2.description",abstract:"formula.functionList.SUMX2PY2.abstract",functionParameter:[{name:"formula.functionList.SUMX2PY2.functionParameter.arrayX.name",detail:"formula.functionList.SUMX2PY2.functionParameter.arrayX.detail",example:"A2:A8",require:1,repeat:0},{name:"formula.functionList.SUMX2PY2.functionParameter.arrayY.name",detail:"formula.functionList.SUMX2PY2.functionParameter.arrayY.detail",example:"B2:B8",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.SUMXMY2,functionType:t.FunctionType.Math,description:"formula.functionList.SUMXMY2.description",abstract:"formula.functionList.SUMXMY2.abstract",functionParameter:[{name:"formula.functionList.SUMXMY2.functionParameter.arrayX.name",detail:"formula.functionList.SUMXMY2.functionParameter.arrayX.detail",example:"A2:A8",require:1,repeat:0},{name:"formula.functionList.SUMXMY2.functionParameter.arrayY.name",detail:"formula.functionList.SUMXMY2.functionParameter.arrayY.detail",example:"B2:B8",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.TAN,functionType:t.FunctionType.Math,description:"formula.functionList.TAN.description",abstract:"formula.functionList.TAN.abstract",functionParameter:[{name:"formula.functionList.TAN.functionParameter.number.name",detail:"formula.functionList.TAN.functionParameter.number.detail",example:"1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.TANH,functionType:t.FunctionType.Math,description:"formula.functionList.TANH.description",abstract:"formula.functionList.TANH.abstract",functionParameter:[{name:"formula.functionList.TANH.functionParameter.number.name",detail:"formula.functionList.TANH.functionParameter.number.detail",example:"1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.TRUNC,functionType:t.FunctionType.Math,description:"formula.functionList.TRUNC.description",abstract:"formula.functionList.TRUNC.abstract",functionParameter:[{name:"formula.functionList.TRUNC.functionParameter.number.name",detail:"formula.functionList.TRUNC.functionParameter.number.detail",example:"0.45",require:1,repeat:0},{name:"formula.functionList.TRUNC.functionParameter.numDigits.name",detail:"formula.functionList.TRUNC.functionParameter.numDigits.detail",example:"1",require:0,repeat:0}]}],Je=[{functionName:t.FUNCTION_NAMES_STATISTICAL.AVEDEV,functionType:t.FunctionType.Statistical,description:"formula.functionList.AVEDEV.description",abstract:"formula.functionList.AVEDEV.abstract",functionParameter:[{name:"formula.functionList.AVEDEV.functionParameter.number1.name",detail:"formula.functionList.AVEDEV.functionParameter.number1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.AVEDEV.functionParameter.number2.name",detail:"formula.functionList.AVEDEV.functionParameter.number2.detail",example:"B1:B20",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.AVERAGE,aliasFunctionName:"formula.functionList.AVERAGE.aliasFunctionName",functionType:t.FunctionType.Statistical,description:"formula.functionList.AVERAGE.description",abstract:"formula.functionList.AVERAGE.abstract",functionParameter:[{name:"formula.functionList.AVERAGE.functionParameter.number1.name",detail:"formula.functionList.AVERAGE.functionParameter.number1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.AVERAGE.functionParameter.number2.name",detail:"formula.functionList.AVERAGE.functionParameter.number2.detail",example:"B1:B20",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.AVERAGE_WEIGHTED,aliasFunctionName:"formula.functionList.AVERAGE_WEIGHTED.aliasFunctionName",functionType:t.FunctionType.Statistical,description:"formula.functionList.AVERAGE_WEIGHTED.description",abstract:"formula.functionList.AVERAGE_WEIGHTED.abstract",functionParameter:[{name:"formula.functionList.AVERAGE_WEIGHTED.functionParameter.values.name",detail:"formula.functionList.AVERAGE_WEIGHTED.functionParameter.values.detail",example:"10",require:1,repeat:0},{name:"formula.functionList.AVERAGE_WEIGHTED.functionParameter.weights.name",detail:"formula.functionList.AVERAGE_WEIGHTED.functionParameter.weights.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.AVERAGE_WEIGHTED.functionParameter.additionalValues.name",detail:"formula.functionList.AVERAGE_WEIGHTED.functionParameter.additionalValues.detail",example:"20",require:0,repeat:1},{name:"formula.functionList.AVERAGE_WEIGHTED.functionParameter.additionalWeights.name",detail:"formula.functionList.AVERAGE_WEIGHTED.functionParameter.additionalWeights.detail",example:"3",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.AVERAGEA,functionType:t.FunctionType.Statistical,description:"formula.functionList.AVERAGEA.description",abstract:"formula.functionList.AVERAGEA.abstract",functionParameter:[{name:"formula.functionList.AVERAGEA.functionParameter.value1.name",detail:"formula.functionList.AVERAGEA.functionParameter.value1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.AVERAGEA.functionParameter.value2.name",detail:"formula.functionList.AVERAGEA.functionParameter.value2.detail",example:"B1:B20",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.AVERAGEIF,functionType:t.FunctionType.Statistical,description:"formula.functionList.AVERAGEIF.description",abstract:"formula.functionList.AVERAGEIF.abstract",functionParameter:[{name:"formula.functionList.AVERAGEIF.functionParameter.range.name",detail:"formula.functionList.AVERAGEIF.functionParameter.range.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.AVERAGEIF.functionParameter.criteria.name",detail:"formula.functionList.AVERAGEIF.functionParameter.criteria.detail",example:'">5"',require:1,repeat:0},{name:"formula.functionList.AVERAGEIF.functionParameter.averageRange.name",detail:"formula.functionList.AVERAGEIF.functionParameter.averageRange.detail",example:"B1:B20",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.AVERAGEIFS,functionType:t.FunctionType.Statistical,description:"formula.functionList.AVERAGEIFS.description",abstract:"formula.functionList.AVERAGEIFS.abstract",functionParameter:[{name:"formula.functionList.AVERAGEIFS.functionParameter.averageRange.name",detail:"formula.functionList.AVERAGEIFS.functionParameter.averageRange.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.AVERAGEIFS.functionParameter.criteriaRange1.name",detail:"formula.functionList.AVERAGEIFS.functionParameter.criteriaRange1.detail",example:"B1:B20",require:1,repeat:0},{name:"formula.functionList.AVERAGEIFS.functionParameter.criteria1.name",detail:"formula.functionList.AVERAGEIFS.functionParameter.criteria1.detail",example:'">10"',require:1,repeat:0},{name:"formula.functionList.AVERAGEIFS.functionParameter.criteriaRange2.name",detail:"formula.functionList.AVERAGEIFS.functionParameter.criteriaRange2.detail",example:"C1:C20",require:0,repeat:1},{name:"formula.functionList.AVERAGEIFS.functionParameter.criteria2.name",detail:"formula.functionList.AVERAGEIFS.functionParameter.criteria2.detail",example:'"<20"',require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.BETA_DIST,functionType:t.FunctionType.Statistical,description:"formula.functionList.BETA_DIST.description",abstract:"formula.functionList.BETA_DIST.abstract",functionParameter:[{name:"formula.functionList.BETA_DIST.functionParameter.x.name",detail:"formula.functionList.BETA_DIST.functionParameter.x.detail",example:"2",require:1,repeat:0},{name:"formula.functionList.BETA_DIST.functionParameter.alpha.name",detail:"formula.functionList.BETA_DIST.functionParameter.alpha.detail",example:"8",require:1,repeat:0},{name:"formula.functionList.BETA_DIST.functionParameter.beta.name",detail:"formula.functionList.BETA_DIST.functionParameter.beta.detail",example:"10",require:1,repeat:0},{name:"formula.functionList.BETA_DIST.functionParameter.cumulative.name",detail:"formula.functionList.BETA_DIST.functionParameter.cumulative.detail",example:"true",require:1,repeat:0},{name:"formula.functionList.BETA_DIST.functionParameter.A.name",detail:"formula.functionList.BETA_DIST.functionParameter.A.detail",example:"1",require:0,repeat:0},{name:"formula.functionList.BETA_DIST.functionParameter.B.name",detail:"formula.functionList.BETA_DIST.functionParameter.B.detail",example:"3",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.BETA_INV,functionType:t.FunctionType.Statistical,description:"formula.functionList.BETA_INV.description",abstract:"formula.functionList.BETA_INV.abstract",functionParameter:[{name:"formula.functionList.BETA_INV.functionParameter.probability.name",detail:"formula.functionList.BETA_INV.functionParameter.probability.detail",example:"0.685470581",require:1,repeat:0},{name:"formula.functionList.BETA_INV.functionParameter.alpha.name",detail:"formula.functionList.BETA_INV.functionParameter.alpha.detail",example:"8",require:1,repeat:0},{name:"formula.functionList.BETA_INV.functionParameter.beta.name",detail:"formula.functionList.BETA_INV.functionParameter.beta.detail",example:"10",require:1,repeat:0},{name:"formula.functionList.BETA_INV.functionParameter.A.name",detail:"formula.functionList.BETA_INV.functionParameter.A.detail",example:"1",require:0,repeat:0},{name:"formula.functionList.BETA_INV.functionParameter.B.name",detail:"formula.functionList.BETA_INV.functionParameter.B.detail",example:"3",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.BINOM_DIST,functionType:t.FunctionType.Statistical,description:"formula.functionList.BINOM_DIST.description",abstract:"formula.functionList.BINOM_DIST.abstract",functionParameter:[{name:"formula.functionList.BINOM_DIST.functionParameter.numberS.name",detail:"formula.functionList.BINOM_DIST.functionParameter.numberS.detail",example:"6",require:1,repeat:0},{name:"formula.functionList.BINOM_DIST.functionParameter.trials.name",detail:"formula.functionList.BINOM_DIST.functionParameter.trials.detail",example:"10",require:1,repeat:0},{name:"formula.functionList.BINOM_DIST.functionParameter.probabilityS.name",detail:"formula.functionList.BINOM_DIST.functionParameter.probabilityS.detail",example:"0.5",require:1,repeat:0},{name:"formula.functionList.BINOM_DIST.functionParameter.cumulative.name",detail:"formula.functionList.BINOM_DIST.functionParameter.cumulative.detail",example:"false",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.BINOM_DIST_RANGE,functionType:t.FunctionType.Statistical,description:"formula.functionList.BINOM_DIST_RANGE.description",abstract:"formula.functionList.BINOM_DIST_RANGE.abstract",functionParameter:[{name:"formula.functionList.BINOM_DIST_RANGE.functionParameter.trials.name",detail:"formula.functionList.BINOM_DIST_RANGE.functionParameter.trials.detail",example:"60",require:1,repeat:0},{name:"formula.functionList.BINOM_DIST_RANGE.functionParameter.probabilityS.name",detail:"formula.functionList.BINOM_DIST_RANGE.functionParameter.probabilityS.detail",example:"0.75",require:1,repeat:0},{name:"formula.functionList.BINOM_DIST_RANGE.functionParameter.numberS.name",detail:"formula.functionList.BINOM_DIST_RANGE.functionParameter.numberS.detail",example:"45",require:1,repeat:0},{name:"formula.functionList.BINOM_DIST_RANGE.functionParameter.numberS2.name",detail:"formula.functionList.BINOM_DIST_RANGE.functionParameter.numberS2.detail",example:"50",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.BINOM_INV,functionType:t.FunctionType.Statistical,description:"formula.functionList.BINOM_INV.description",abstract:"formula.functionList.BINOM_INV.abstract",functionParameter:[{name:"formula.functionList.BINOM_INV.functionParameter.trials.name",detail:"formula.functionList.BINOM_INV.functionParameter.trials.detail",example:"6",require:1,repeat:0},{name:"formula.functionList.BINOM_INV.functionParameter.probabilityS.name",detail:"formula.functionList.BINOM_INV.functionParameter.probabilityS.detail",example:"0.5",require:1,repeat:0},{name:"formula.functionList.BINOM_INV.functionParameter.alpha.name",detail:"formula.functionList.BINOM_INV.functionParameter.alpha.detail",example:"0.75",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.CHISQ_DIST,functionType:t.FunctionType.Statistical,description:"formula.functionList.CHISQ_DIST.description",abstract:"formula.functionList.CHISQ_DIST.abstract",functionParameter:[{name:"formula.functionList.CHISQ_DIST.functionParameter.x.name",detail:"formula.functionList.CHISQ_DIST.functionParameter.x.detail",example:"0.5",require:1,repeat:0},{name:"formula.functionList.CHISQ_DIST.functionParameter.degFreedom.name",detail:"formula.functionList.CHISQ_DIST.functionParameter.degFreedom.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.CHISQ_DIST.functionParameter.cumulative.name",detail:"formula.functionList.CHISQ_DIST.functionParameter.cumulative.detail",example:"true",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.CHISQ_DIST_RT,functionType:t.FunctionType.Statistical,description:"formula.functionList.CHISQ_DIST_RT.description",abstract:"formula.functionList.CHISQ_DIST_RT.abstract",functionParameter:[{name:"formula.functionList.CHISQ_DIST_RT.functionParameter.x.name",detail:"formula.functionList.CHISQ_DIST_RT.functionParameter.x.detail",example:"0.5",require:1,repeat:0},{name:"formula.functionList.CHISQ_DIST_RT.functionParameter.degFreedom.name",detail:"formula.functionList.CHISQ_DIST_RT.functionParameter.degFreedom.detail",example:"1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.CHISQ_INV,functionType:t.FunctionType.Statistical,description:"formula.functionList.CHISQ_INV.description",abstract:"formula.functionList.CHISQ_INV.abstract",functionParameter:[{name:"formula.functionList.CHISQ_INV.functionParameter.probability.name",detail:"formula.functionList.CHISQ_INV.functionParameter.probability.detail",example:"0.93",require:1,repeat:0},{name:"formula.functionList.CHISQ_INV.functionParameter.degFreedom.name",detail:"formula.functionList.CHISQ_INV.functionParameter.degFreedom.detail",example:"1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.CHISQ_INV_RT,functionType:t.FunctionType.Statistical,description:"formula.functionList.CHISQ_INV_RT.description",abstract:"formula.functionList.CHISQ_INV_RT.abstract",functionParameter:[{name:"formula.functionList.CHISQ_INV_RT.functionParameter.probability.name",detail:"formula.functionList.CHISQ_INV_RT.functionParameter.probability.detail",example:"0.93",require:1,repeat:0},{name:"formula.functionList.CHISQ_INV_RT.functionParameter.degFreedom.name",detail:"formula.functionList.CHISQ_INV_RT.functionParameter.degFreedom.detail",example:"1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.CHISQ_TEST,functionType:t.FunctionType.Statistical,description:"formula.functionList.CHISQ_TEST.description",abstract:"formula.functionList.CHISQ_TEST.abstract",functionParameter:[{name:"formula.functionList.CHISQ_TEST.functionParameter.actualRange.name",detail:"formula.functionList.CHISQ_TEST.functionParameter.actualRange.detail",example:"A1:A4",require:1,repeat:0},{name:"formula.functionList.CHISQ_TEST.functionParameter.expectedRange.name",detail:"formula.functionList.CHISQ_TEST.functionParameter.expectedRange.detail",example:"B1:B4",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.CONFIDENCE_NORM,functionType:t.FunctionType.Statistical,description:"formula.functionList.CONFIDENCE_NORM.description",abstract:"formula.functionList.CONFIDENCE_NORM.abstract",functionParameter:[{name:"formula.functionList.CONFIDENCE_NORM.functionParameter.alpha.name",detail:"formula.functionList.CONFIDENCE_NORM.functionParameter.alpha.detail",example:"0.05",require:1,repeat:0},{name:"formula.functionList.CONFIDENCE_NORM.functionParameter.standardDev.name",detail:"formula.functionList.CONFIDENCE_NORM.functionParameter.standardDev.detail",example:"2.5",require:1,repeat:0},{name:"formula.functionList.CONFIDENCE_NORM.functionParameter.size.name",detail:"formula.functionList.CONFIDENCE_NORM.functionParameter.size.detail",example:"50",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.CONFIDENCE_T,functionType:t.FunctionType.Statistical,description:"formula.functionList.CONFIDENCE_T.description",abstract:"formula.functionList.CONFIDENCE_T.abstract",functionParameter:[{name:"formula.functionList.CONFIDENCE_T.functionParameter.alpha.name",detail:"formula.functionList.CONFIDENCE_T.functionParameter.alpha.detail",example:"0.05",require:1,repeat:0},{name:"formula.functionList.CONFIDENCE_T.functionParameter.standardDev.name",detail:"formula.functionList.CONFIDENCE_T.functionParameter.standardDev.detail",example:"2.5",require:1,repeat:0},{name:"formula.functionList.CONFIDENCE_T.functionParameter.size.name",detail:"formula.functionList.CONFIDENCE_T.functionParameter.size.detail",example:"50",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.CORREL,functionType:t.FunctionType.Statistical,description:"formula.functionList.CORREL.description",abstract:"formula.functionList.CORREL.abstract",functionParameter:[{name:"formula.functionList.CORREL.functionParameter.array1.name",detail:"formula.functionList.CORREL.functionParameter.array1.detail",example:"A1:A4",require:1,repeat:0},{name:"formula.functionList.CORREL.functionParameter.array2.name",detail:"formula.functionList.CORREL.functionParameter.array2.detail",example:"B1:B4",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.COUNT,aliasFunctionName:"formula.functionList.COUNT.aliasFunctionName",functionType:t.FunctionType.Statistical,description:"formula.functionList.COUNT.description",abstract:"formula.functionList.COUNT.abstract",functionParameter:[{name:"formula.functionList.COUNT.functionParameter.value1.name",detail:"formula.functionList.COUNT.functionParameter.value1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.COUNT.functionParameter.value2.name",detail:"formula.functionList.COUNT.functionParameter.value2.detail",example:"B2:B10",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.COUNTA,aliasFunctionName:"formula.functionList.COUNTA.aliasFunctionName",functionType:t.FunctionType.Statistical,description:"formula.functionList.COUNTA.description",abstract:"formula.functionList.COUNTA.abstract",functionParameter:[{name:"formula.functionList.COUNTA.functionParameter.number1.name",detail:"formula.functionList.COUNTA.functionParameter.number1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.COUNTA.functionParameter.number2.name",detail:"formula.functionList.COUNTA.functionParameter.number2.detail",example:"B2:B10",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.COUNTBLANK,functionType:t.FunctionType.Statistical,description:"formula.functionList.COUNTBLANK.description",abstract:"formula.functionList.COUNTBLANK.abstract",functionParameter:[{name:"formula.functionList.COUNTBLANK.functionParameter.range.name",detail:"formula.functionList.COUNTBLANK.functionParameter.range.detail",example:"A1:A20",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.COUNTIF,functionType:t.FunctionType.Statistical,description:"formula.functionList.COUNTIF.description",abstract:"formula.functionList.COUNTIF.abstract",functionParameter:[{name:"formula.functionList.COUNTIF.functionParameter.range.name",detail:"formula.functionList.COUNTIF.functionParameter.range.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.COUNTIF.functionParameter.criteria.name",detail:"formula.functionList.COUNTIF.functionParameter.criteria.detail",example:'">5"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.COUNTIFS,functionType:t.FunctionType.Statistical,description:"formula.functionList.COUNTIFS.description",abstract:"formula.functionList.COUNTIFS.abstract",functionParameter:[{name:"formula.functionList.COUNTIFS.functionParameter.criteriaRange1.name",detail:"formula.functionList.COUNTIFS.functionParameter.criteriaRange1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.COUNTIFS.functionParameter.criteria1.name",detail:"formula.functionList.COUNTIFS.functionParameter.criteria1.detail",example:'">10"',require:1,repeat:0},{name:"formula.functionList.COUNTIFS.functionParameter.criteriaRange2.name",detail:"formula.functionList.COUNTIFS.functionParameter.criteriaRange2.detail",example:"B1:B20",require:0,repeat:1},{name:"formula.functionList.COUNTIFS.functionParameter.criteria2.name",detail:"formula.functionList.COUNTIFS.functionParameter.criteria2.detail",example:'"<20"',require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.COVARIANCE_P,functionType:t.FunctionType.Statistical,description:"formula.functionList.COVARIANCE_P.description",abstract:"formula.functionList.COVARIANCE_P.abstract",functionParameter:[{name:"formula.functionList.COVARIANCE_P.functionParameter.array1.name",detail:"formula.functionList.COVARIANCE_P.functionParameter.array1.detail",example:"A1:A4",require:1,repeat:0},{name:"formula.functionList.COVARIANCE_P.functionParameter.array2.name",detail:"formula.functionList.COVARIANCE_P.functionParameter.array2.detail",example:"B1:B4",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.COVARIANCE_S,functionType:t.FunctionType.Statistical,description:"formula.functionList.COVARIANCE_S.description",abstract:"formula.functionList.COVARIANCE_S.abstract",functionParameter:[{name:"formula.functionList.COVARIANCE_S.functionParameter.array1.name",detail:"formula.functionList.COVARIANCE_S.functionParameter.array1.detail",example:"A1:A4",require:1,repeat:0},{name:"formula.functionList.COVARIANCE_S.functionParameter.array2.name",detail:"formula.functionList.COVARIANCE_S.functionParameter.array2.detail",example:"B1:B4",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.DEVSQ,functionType:t.FunctionType.Statistical,description:"formula.functionList.DEVSQ.description",abstract:"formula.functionList.DEVSQ.abstract",functionParameter:[{name:"formula.functionList.DEVSQ.functionParameter.number1.name",detail:"formula.functionList.DEVSQ.functionParameter.number1.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.DEVSQ.functionParameter.number2.name",detail:"formula.functionList.DEVSQ.functionParameter.number2.detail",example:"2",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.EXPON_DIST,functionType:t.FunctionType.Statistical,description:"formula.functionList.EXPON_DIST.description",abstract:"formula.functionList.EXPON_DIST.abstract",functionParameter:[{name:"formula.functionList.EXPON_DIST.functionParameter.x.name",detail:"formula.functionList.EXPON_DIST.functionParameter.x.detail",example:"0.2",require:1,repeat:0},{name:"formula.functionList.EXPON_DIST.functionParameter.lambda.name",detail:"formula.functionList.EXPON_DIST.functionParameter.lambda.detail",example:"10",require:1,repeat:0},{name:"formula.functionList.EXPON_DIST.functionParameter.cumulative.name",detail:"formula.functionList.EXPON_DIST.functionParameter.cumulative.detail",example:"true",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.F_DIST,functionType:t.FunctionType.Statistical,description:"formula.functionList.F_DIST.description",abstract:"formula.functionList.F_DIST.abstract",functionParameter:[{name:"formula.functionList.F_DIST.functionParameter.x.name",detail:"formula.functionList.F_DIST.functionParameter.x.detail",example:"15.2069",require:1,repeat:0},{name:"formula.functionList.F_DIST.functionParameter.degFreedom1.name",detail:"formula.functionList.F_DIST.functionParameter.degFreedom1.detail",example:"6",require:1,repeat:0},{name:"formula.functionList.F_DIST.functionParameter.degFreedom2.name",detail:"formula.functionList.F_DIST.functionParameter.degFreedom2.detail",example:"4",require:1,repeat:0},{name:"formula.functionList.F_DIST.functionParameter.cumulative.name",detail:"formula.functionList.F_DIST.functionParameter.cumulative.detail",example:"true",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.F_DIST_RT,functionType:t.FunctionType.Statistical,description:"formula.functionList.F_DIST_RT.description",abstract:"formula.functionList.F_DIST_RT.abstract",functionParameter:[{name:"formula.functionList.F_DIST_RT.functionParameter.x.name",detail:"formula.functionList.F_DIST_RT.functionParameter.x.detail",example:"15.2069",require:1,repeat:0},{name:"formula.functionList.F_DIST_RT.functionParameter.degFreedom1.name",detail:"formula.functionList.F_DIST_RT.functionParameter.degFreedom1.detail",example:"6",require:1,repeat:0},{name:"formula.functionList.F_DIST_RT.functionParameter.degFreedom2.name",detail:"formula.functionList.F_DIST_RT.functionParameter.degFreedom2.detail",example:"4",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.F_INV,functionType:t.FunctionType.Statistical,description:"formula.functionList.F_INV.description",abstract:"formula.functionList.F_INV.abstract",functionParameter:[{name:"formula.functionList.F_INV.functionParameter.probability.name",detail:"formula.functionList.F_INV.functionParameter.probability.detail",example:"0.01",require:1,repeat:0},{name:"formula.functionList.F_INV.functionParameter.degFreedom1.name",detail:"formula.functionList.F_INV.functionParameter.degFreedom1.detail",example:"6",require:1,repeat:0},{name:"formula.functionList.F_INV.functionParameter.degFreedom2.name",detail:"formula.functionList.F_INV.functionParameter.degFreedom2.detail",example:"4",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.F_INV_RT,functionType:t.FunctionType.Statistical,description:"formula.functionList.F_INV_RT.description",abstract:"formula.functionList.F_INV_RT.abstract",functionParameter:[{name:"formula.functionList.F_INV_RT.functionParameter.probability.name",detail:"formula.functionList.F_INV_RT.functionParameter.probability.detail",example:"0.01",require:1,repeat:0},{name:"formula.functionList.F_INV_RT.functionParameter.degFreedom1.name",detail:"formula.functionList.F_INV_RT.functionParameter.degFreedom1.detail",example:"6",require:1,repeat:0},{name:"formula.functionList.F_INV_RT.functionParameter.degFreedom2.name",detail:"formula.functionList.F_INV_RT.functionParameter.degFreedom2.detail",example:"4",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.F_TEST,functionType:t.FunctionType.Statistical,description:"formula.functionList.F_TEST.description",abstract:"formula.functionList.F_TEST.abstract",functionParameter:[{name:"formula.functionList.F_TEST.functionParameter.array1.name",detail:"formula.functionList.F_TEST.functionParameter.array1.detail",example:"A1:A4",require:1,repeat:0},{name:"formula.functionList.F_TEST.functionParameter.array2.name",detail:"formula.functionList.F_TEST.functionParameter.array2.detail",example:"B1:B4",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.FISHER,functionType:t.FunctionType.Statistical,description:"formula.functionList.FISHER.description",abstract:"formula.functionList.FISHER.abstract",functionParameter:[{name:"formula.functionList.FISHER.functionParameter.x.name",detail:"formula.functionList.FISHER.functionParameter.x.detail",example:"0.75",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.FISHERINV,functionType:t.FunctionType.Statistical,description:"formula.functionList.FISHERINV.description",abstract:"formula.functionList.FISHERINV.abstract",functionParameter:[{name:"formula.functionList.FISHERINV.functionParameter.y.name",detail:"formula.functionList.FISHERINV.functionParameter.y.detail",example:"0.75",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.FORECAST,functionType:t.FunctionType.Statistical,description:"formula.functionList.FORECAST.description",abstract:"formula.functionList.FORECAST.abstract",functionParameter:[{name:"formula.functionList.FORECAST.functionParameter.x.name",detail:"formula.functionList.FORECAST.functionParameter.x.detail",example:"30",require:1,repeat:0},{name:"formula.functionList.FORECAST.functionParameter.knownYs.name",detail:"formula.functionList.FORECAST.functionParameter.knownYs.detail",example:"A1:A4",require:1,repeat:0},{name:"formula.functionList.FORECAST.functionParameter.knownXs.name",detail:"formula.functionList.FORECAST.functionParameter.knownXs.detail",example:"B1:B4",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.FORECAST_ETS,functionType:t.FunctionType.Statistical,description:"formula.functionList.FORECAST_ETS.description",abstract:"formula.functionList.FORECAST_ETS.abstract",functionParameter:[{name:"formula.functionList.FORECAST_ETS.functionParameter.number1.name",detail:"formula.functionList.FORECAST_ETS.functionParameter.number1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.FORECAST_ETS.functionParameter.number2.name",detail:"formula.functionList.FORECAST_ETS.functionParameter.number2.detail",example:"A1:A20",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.FORECAST_ETS_CONFINT,functionType:t.FunctionType.Statistical,description:"formula.functionList.FORECAST_ETS_CONFINT.description",abstract:"formula.functionList.FORECAST_ETS_CONFINT.abstract",functionParameter:[{name:"formula.functionList.FORECAST_ETS_CONFINT.functionParameter.number1.name",detail:"formula.functionList.FORECAST_ETS_CONFINT.functionParameter.number1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.FORECAST_ETS_CONFINT.functionParameter.number2.name",detail:"formula.functionList.FORECAST_ETS_CONFINT.functionParameter.number2.detail",example:"A1:A20",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.FORECAST_ETS_SEASONALITY,functionType:t.FunctionType.Statistical,description:"formula.functionList.FORECAST_ETS_SEASONALITY.description",abstract:"formula.functionList.FORECAST_ETS_SEASONALITY.abstract",functionParameter:[{name:"formula.functionList.FORECAST_ETS_SEASONALITY.functionParameter.number1.name",detail:"formula.functionList.FORECAST_ETS_SEASONALITY.functionParameter.number1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.FORECAST_ETS_SEASONALITY.functionParameter.number2.name",detail:"formula.functionList.FORECAST_ETS_SEASONALITY.functionParameter.number2.detail",example:"A1:A20",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.FORECAST_ETS_STAT,functionType:t.FunctionType.Statistical,description:"formula.functionList.FORECAST_ETS_STAT.description",abstract:"formula.functionList.FORECAST_ETS_STAT.abstract",functionParameter:[{name:"formula.functionList.FORECAST_ETS_STAT.functionParameter.number1.name",detail:"formula.functionList.FORECAST_ETS_STAT.functionParameter.number1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.FORECAST_ETS_STAT.functionParameter.number2.name",detail:"formula.functionList.FORECAST_ETS_STAT.functionParameter.number2.detail",example:"A1:A20",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.FORECAST_LINEAR,functionType:t.FunctionType.Statistical,description:"formula.functionList.FORECAST_LINEAR.description",abstract:"formula.functionList.FORECAST_LINEAR.abstract",functionParameter:[{name:"formula.functionList.FORECAST_LINEAR.functionParameter.x.name",detail:"formula.functionList.FORECAST_LINEAR.functionParameter.x.detail",example:"30",require:1,repeat:0},{name:"formula.functionList.FORECAST_LINEAR.functionParameter.knownYs.name",detail:"formula.functionList.FORECAST_LINEAR.functionParameter.knownYs.detail",example:"A1:A4",require:1,repeat:0},{name:"formula.functionList.FORECAST_LINEAR.functionParameter.knownXs.name",detail:"formula.functionList.FORECAST_LINEAR.functionParameter.knownXs.detail",example:"B1:B4",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.FREQUENCY,functionType:t.FunctionType.Statistical,description:"formula.functionList.FREQUENCY.description",abstract:"formula.functionList.FREQUENCY.abstract",functionParameter:[{name:"formula.functionList.FREQUENCY.functionParameter.dataArray.name",detail:"formula.functionList.FREQUENCY.functionParameter.dataArray.detail",example:"A2:A10",require:1,repeat:0},{name:"formula.functionList.FREQUENCY.functionParameter.binsArray.name",detail:"formula.functionList.FREQUENCY.functionParameter.binsArray.detail",example:"B2:B4",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.GAMMA,functionType:t.FunctionType.Statistical,description:"formula.functionList.GAMMA.description",abstract:"formula.functionList.GAMMA.abstract",functionParameter:[{name:"formula.functionList.GAMMA.functionParameter.number.name",detail:"formula.functionList.GAMMA.functionParameter.number.detail",example:"2.5",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.GAMMA_DIST,functionType:t.FunctionType.Statistical,description:"formula.functionList.GAMMA_DIST.description",abstract:"formula.functionList.GAMMA_DIST.abstract",functionParameter:[{name:"formula.functionList.GAMMA_DIST.functionParameter.x.name",detail:"formula.functionList.GAMMA_DIST.functionParameter.x.detail",example:"10",require:1,repeat:0},{name:"formula.functionList.GAMMA_DIST.functionParameter.alpha.name",detail:"formula.functionList.GAMMA_DIST.functionParameter.alpha.detail",example:"8",require:1,repeat:0},{name:"formula.functionList.GAMMA_DIST.functionParameter.beta.name",detail:"formula.functionList.GAMMA_DIST.functionParameter.beta.detail",example:"2",require:1,repeat:0},{name:"formula.functionList.GAMMA_DIST.functionParameter.cumulative.name",detail:"formula.functionList.GAMMA_DIST.functionParameter.cumulative.detail",example:"true",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.GAMMA_INV,functionType:t.FunctionType.Statistical,description:"formula.functionList.GAMMA_INV.description",abstract:"formula.functionList.GAMMA_INV.abstract",functionParameter:[{name:"formula.functionList.GAMMA_INV.functionParameter.probability.name",detail:"formula.functionList.GAMMA_INV.functionParameter.probability.detail",example:"0.068094",require:1,repeat:0},{name:"formula.functionList.GAMMA_INV.functionParameter.alpha.name",detail:"formula.functionList.GAMMA_INV.functionParameter.alpha.detail",example:"9",require:1,repeat:0},{name:"formula.functionList.GAMMA_INV.functionParameter.beta.name",detail:"formula.functionList.GAMMA_INV.functionParameter.beta.detail",example:"2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.GAMMALN,functionType:t.FunctionType.Statistical,description:"formula.functionList.GAMMALN.description",abstract:"formula.functionList.GAMMALN.abstract",functionParameter:[{name:"formula.functionList.GAMMALN.functionParameter.x.name",detail:"formula.functionList.GAMMALN.functionParameter.x.detail",example:"4",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.GAMMALN_PRECISE,functionType:t.FunctionType.Statistical,description:"formula.functionList.GAMMALN_PRECISE.description",abstract:"formula.functionList.GAMMALN_PRECISE.abstract",functionParameter:[{name:"formula.functionList.GAMMALN_PRECISE.functionParameter.x.name",detail:"formula.functionList.GAMMALN_PRECISE.functionParameter.x.detail",example:"4",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.GAUSS,functionType:t.FunctionType.Statistical,description:"formula.functionList.GAUSS.description",abstract:"formula.functionList.GAUSS.abstract",functionParameter:[{name:"formula.functionList.GAUSS.functionParameter.z.name",detail:"formula.functionList.GAUSS.functionParameter.z.detail",example:"2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.GEOMEAN,functionType:t.FunctionType.Statistical,description:"formula.functionList.GEOMEAN.description",abstract:"formula.functionList.GEOMEAN.abstract",functionParameter:[{name:"formula.functionList.GEOMEAN.functionParameter.number1.name",detail:"formula.functionList.GEOMEAN.functionParameter.number1.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.GEOMEAN.functionParameter.number2.name",detail:"formula.functionList.GEOMEAN.functionParameter.number2.detail",example:"2",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.GROWTH,functionType:t.FunctionType.Statistical,description:"formula.functionList.GROWTH.description",abstract:"formula.functionList.GROWTH.abstract",functionParameter:[{name:"formula.functionList.GROWTH.functionParameter.knownYs.name",detail:"formula.functionList.GROWTH.functionParameter.knownYs.detail",example:"B2:B7",require:1,repeat:0},{name:"formula.functionList.GROWTH.functionParameter.knownXs.name",detail:"formula.functionList.GROWTH.functionParameter.knownXs.detail",example:"A2:A7",require:0,repeat:0},{name:"formula.functionList.GROWTH.functionParameter.newXs.name",detail:"formula.functionList.GROWTH.functionParameter.newXs.detail",example:"A9:A10",require:0,repeat:0},{name:"formula.functionList.GROWTH.functionParameter.constb.name",detail:"formula.functionList.GROWTH.functionParameter.constb.detail",example:"true",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.HARMEAN,functionType:t.FunctionType.Statistical,description:"formula.functionList.HARMEAN.description",abstract:"formula.functionList.HARMEAN.abstract",functionParameter:[{name:"formula.functionList.HARMEAN.functionParameter.number1.name",detail:"formula.functionList.HARMEAN.functionParameter.number1.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.HARMEAN.functionParameter.number2.name",detail:"formula.functionList.HARMEAN.functionParameter.number2.detail",example:"2",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.HYPGEOM_DIST,functionType:t.FunctionType.Statistical,description:"formula.functionList.HYPGEOM_DIST.description",abstract:"formula.functionList.HYPGEOM_DIST.abstract",functionParameter:[{name:"formula.functionList.HYPGEOM_DIST.functionParameter.sampleS.name",detail:"formula.functionList.HYPGEOM_DIST.functionParameter.sampleS.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.HYPGEOM_DIST.functionParameter.numberSample.name",detail:"formula.functionList.HYPGEOM_DIST.functionParameter.numberSample.detail",example:"4",require:1,repeat:0},{name:"formula.functionList.HYPGEOM_DIST.functionParameter.populationS.name",detail:"formula.functionList.HYPGEOM_DIST.functionParameter.populationS.detail",example:"8",require:1,repeat:0},{name:"formula.functionList.HYPGEOM_DIST.functionParameter.numberPop.name",detail:"formula.functionList.HYPGEOM_DIST.functionParameter.numberPop.detail",example:"20",require:1,repeat:0},{name:"formula.functionList.HYPGEOM_DIST.functionParameter.cumulative.name",detail:"formula.functionList.HYPGEOM_DIST.functionParameter.cumulative.detail",example:"true",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.INTERCEPT,functionType:t.FunctionType.Statistical,description:"formula.functionList.INTERCEPT.description",abstract:"formula.functionList.INTERCEPT.abstract",functionParameter:[{name:"formula.functionList.INTERCEPT.functionParameter.knownYs.name",detail:"formula.functionList.INTERCEPT.functionParameter.knownYs.detail",example:"A1:A4",require:1,repeat:0},{name:"formula.functionList.INTERCEPT.functionParameter.knownXs.name",detail:"formula.functionList.INTERCEPT.functionParameter.knownXs.detail",example:"B1:B4",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.KURT,functionType:t.FunctionType.Statistical,description:"formula.functionList.KURT.description",abstract:"formula.functionList.KURT.abstract",functionParameter:[{name:"formula.functionList.KURT.functionParameter.number1.name",detail:"formula.functionList.KURT.functionParameter.number1.detail",example:"A1:A4",require:1,repeat:0},{name:"formula.functionList.KURT.functionParameter.number2.name",detail:"formula.functionList.KURT.functionParameter.number2.detail",example:"4",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.LARGE,functionType:t.FunctionType.Statistical,description:"formula.functionList.LARGE.description",abstract:"formula.functionList.LARGE.abstract",functionParameter:[{name:"formula.functionList.LARGE.functionParameter.array.name",detail:"formula.functionList.LARGE.functionParameter.array.detail",example:"A2:B6",require:1,repeat:0},{name:"formula.functionList.LARGE.functionParameter.k.name",detail:"formula.functionList.LARGE.functionParameter.k.detail",example:"3",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.LINEST,functionType:t.FunctionType.Statistical,description:"formula.functionList.LINEST.description",abstract:"formula.functionList.LINEST.abstract",functionParameter:[{name:"formula.functionList.LINEST.functionParameter.knownYs.name",detail:"formula.functionList.LINEST.functionParameter.knownYs.detail",example:"B2:B7",require:1,repeat:0},{name:"formula.functionList.LINEST.functionParameter.knownXs.name",detail:"formula.functionList.LINEST.functionParameter.knownXs.detail",example:"A2:A7",require:0,repeat:0},{name:"formula.functionList.LINEST.functionParameter.constb.name",detail:"formula.functionList.LINEST.functionParameter.constb.detail",example:"true",require:0,repeat:0},{name:"formula.functionList.LINEST.functionParameter.stats.name",detail:"formula.functionList.LINEST.functionParameter.stats.detail",example:"true",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.LOGEST,functionType:t.FunctionType.Statistical,description:"formula.functionList.LOGEST.description",abstract:"formula.functionList.LOGEST.abstract",functionParameter:[{name:"formula.functionList.LOGEST.functionParameter.knownYs.name",detail:"formula.functionList.LOGEST.functionParameter.knownYs.detail",example:"B2:B7",require:1,repeat:0},{name:"formula.functionList.LOGEST.functionParameter.knownXs.name",detail:"formula.functionList.LOGEST.functionParameter.knownXs.detail",example:"A2:A7",require:0,repeat:0},{name:"formula.functionList.LOGEST.functionParameter.constb.name",detail:"formula.functionList.LOGEST.functionParameter.constb.detail",example:"true",require:0,repeat:0},{name:"formula.functionList.LOGEST.functionParameter.stats.name",detail:"formula.functionList.LOGEST.functionParameter.stats.detail",example:"true",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.LOGNORM_DIST,functionType:t.FunctionType.Statistical,description:"formula.functionList.LOGNORM_DIST.description",abstract:"formula.functionList.LOGNORM_DIST.abstract",functionParameter:[{name:"formula.functionList.LOGNORM_DIST.functionParameter.x.name",detail:"formula.functionList.LOGNORM_DIST.functionParameter.x.detail",example:"42",require:1,repeat:0},{name:"formula.functionList.LOGNORM_DIST.functionParameter.mean.name",detail:"formula.functionList.LOGNORM_DIST.functionParameter.mean.detail",example:"40",require:1,repeat:0},{name:"formula.functionList.LOGNORM_DIST.functionParameter.standardDev.name",detail:"formula.functionList.LOGNORM_DIST.functionParameter.standardDev.detail",example:"1.5",require:1,repeat:0},{name:"formula.functionList.LOGNORM_DIST.functionParameter.cumulative.name",detail:"formula.functionList.LOGNORM_DIST.functionParameter.cumulative.detail",example:"true",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.LOGNORM_INV,functionType:t.FunctionType.Statistical,description:"formula.functionList.LOGNORM_INV.description",abstract:"formula.functionList.LOGNORM_INV.abstract",functionParameter:[{name:"formula.functionList.LOGNORM_INV.functionParameter.probability.name",detail:"formula.functionList.LOGNORM_INV.functionParameter.probability.detail",example:"0.908789",require:1,repeat:0},{name:"formula.functionList.LOGNORM_INV.functionParameter.mean.name",detail:"formula.functionList.LOGNORM_INV.functionParameter.mean.detail",example:"40",require:1,repeat:0},{name:"formula.functionList.LOGNORM_INV.functionParameter.standardDev.name",detail:"formula.functionList.LOGNORM_INV.functionParameter.standardDev.detail",example:"1.5",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.MARGINOFERROR,aliasFunctionName:"formula.functionList.MARGINOFERROR.aliasFunctionName",functionType:t.FunctionType.Statistical,description:"formula.functionList.MARGINOFERROR.description",abstract:"formula.functionList.MARGINOFERROR.abstract",functionParameter:[{name:"formula.functionList.MARGINOFERROR.functionParameter.range.name",detail:"formula.functionList.MARGINOFERROR.functionParameter.range.detail",example:"A1:A4",require:1,repeat:0},{name:"formula.functionList.MARGINOFERROR.functionParameter.confidence.name",detail:"formula.functionList.MARGINOFERROR.functionParameter.confidence.detail",example:"0.95",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.MAX,aliasFunctionName:"formula.functionList.MAX.aliasFunctionName",functionType:t.FunctionType.Statistical,description:"formula.functionList.MAX.description",abstract:"formula.functionList.MAX.abstract",functionParameter:[{name:"formula.functionList.MAX.functionParameter.number1.name",detail:"formula.functionList.MAX.functionParameter.number1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.MAX.functionParameter.number2.name",detail:"formula.functionList.MAX.functionParameter.number2.detail",example:"B2:B10",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.MAXA,functionType:t.FunctionType.Statistical,description:"formula.functionList.MAXA.description",abstract:"formula.functionList.MAXA.abstract",functionParameter:[{name:"formula.functionList.MAXA.functionParameter.value1.name",detail:"formula.functionList.MAXA.functionParameter.value1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.MAXA.functionParameter.value2.name",detail:"formula.functionList.MAXA.functionParameter.value2.detail",example:"B1:B20",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.MAXIFS,functionType:t.FunctionType.Statistical,description:"formula.functionList.MAXIFS.description",abstract:"formula.functionList.MAXIFS.abstract",functionParameter:[{name:"formula.functionList.MAXIFS.functionParameter.maxRange.name",detail:"formula.functionList.MAXIFS.functionParameter.maxRange.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.MAXIFS.functionParameter.criteriaRange1.name",detail:"formula.functionList.MAXIFS.functionParameter.criteriaRange1.detail",example:"B1:B20",require:1,repeat:0},{name:"formula.functionList.MAXIFS.functionParameter.criteria1.name",detail:"formula.functionList.MAXIFS.functionParameter.criteria1.detail",example:'">10"',require:1,repeat:0},{name:"formula.functionList.MAXIFS.functionParameter.criteriaRange2.name",detail:"formula.functionList.MAXIFS.functionParameter.criteriaRange2.detail",example:"C1:C20",require:0,repeat:1},{name:"formula.functionList.MAXIFS.functionParameter.criteria2.name",detail:"formula.functionList.MAXIFS.functionParameter.criteria2.detail",example:'"<20"',require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.MEDIAN,functionType:t.FunctionType.Statistical,description:"formula.functionList.MEDIAN.description",abstract:"formula.functionList.MEDIAN.abstract",functionParameter:[{name:"formula.functionList.MEDIAN.functionParameter.number1.name",detail:"formula.functionList.MEDIAN.functionParameter.number1.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.MEDIAN.functionParameter.number2.name",detail:"formula.functionList.MEDIAN.functionParameter.number2.detail",example:"2",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.MIN,aliasFunctionName:"formula.functionList.MIN.aliasFunctionName",functionType:t.FunctionType.Statistical,description:"formula.functionList.MIN.description",abstract:"formula.functionList.MIN.abstract",functionParameter:[{name:"formula.functionList.MIN.functionParameter.number1.name",detail:"formula.functionList.MIN.functionParameter.number1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.MIN.functionParameter.number2.name",detail:"formula.functionList.MIN.functionParameter.number2.detail",example:"B2:B10",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.MINA,functionType:t.FunctionType.Statistical,description:"formula.functionList.MINA.description",abstract:"formula.functionList.MINA.abstract",functionParameter:[{name:"formula.functionList.MINA.functionParameter.value1.name",detail:"formula.functionList.MINA.functionParameter.value1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.MINA.functionParameter.value2.name",detail:"formula.functionList.MINA.functionParameter.value2.detail",example:"B1:B20",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.MINIFS,functionType:t.FunctionType.Statistical,description:"formula.functionList.MINIFS.description",abstract:"formula.functionList.MINIFS.abstract",functionParameter:[{name:"formula.functionList.MINIFS.functionParameter.minRange.name",detail:"formula.functionList.MINIFS.functionParameter.minRange.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.MINIFS.functionParameter.criteriaRange1.name",detail:"formula.functionList.MINIFS.functionParameter.criteriaRange1.detail",example:"B1:B20",require:1,repeat:0},{name:"formula.functionList.MINIFS.functionParameter.criteria1.name",detail:"formula.functionList.MINIFS.functionParameter.criteria1.detail",example:'">10"',require:1,repeat:0},{name:"formula.functionList.MINIFS.functionParameter.criteriaRange2.name",detail:"formula.functionList.MINIFS.functionParameter.criteriaRange2.detail",example:"C1:C20",require:0,repeat:1},{name:"formula.functionList.MINIFS.functionParameter.criteria2.name",detail:"formula.functionList.MINIFS.functionParameter.criteria2.detail",example:'"<20"',require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.MODE_MULT,functionType:t.FunctionType.Statistical,description:"formula.functionList.MODE_MULT.description",abstract:"formula.functionList.MODE_MULT.abstract",functionParameter:[{name:"formula.functionList.MODE_MULT.functionParameter.number1.name",detail:"formula.functionList.MODE_MULT.functionParameter.number1.detail",example:"A1:A4",require:1,repeat:0},{name:"formula.functionList.MODE_MULT.functionParameter.number2.name",detail:"formula.functionList.MODE_MULT.functionParameter.number2.detail",example:"2",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.MODE_SNGL,functionType:t.FunctionType.Statistical,description:"formula.functionList.MODE_SNGL.description",abstract:"formula.functionList.MODE_SNGL.abstract",functionParameter:[{name:"formula.functionList.MODE_SNGL.functionParameter.number1.name",detail:"formula.functionList.MODE_SNGL.functionParameter.number1.detail",example:"A1:A4",require:1,repeat:0},{name:"formula.functionList.MODE_SNGL.functionParameter.number2.name",detail:"formula.functionList.MODE_SNGL.functionParameter.number2.detail",example:"2",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.NEGBINOM_DIST,functionType:t.FunctionType.Statistical,description:"formula.functionList.NEGBINOM_DIST.description",abstract:"formula.functionList.NEGBINOM_DIST.abstract",functionParameter:[{name:"formula.functionList.NEGBINOM_DIST.functionParameter.numberF.name",detail:"formula.functionList.NEGBINOM_DIST.functionParameter.numberF.detail",example:"10",require:1,repeat:0},{name:"formula.functionList.NEGBINOM_DIST.functionParameter.numberS.name",detail:"formula.functionList.NEGBINOM_DIST.functionParameter.numberS.detail",example:"5",require:1,repeat:0},{name:"formula.functionList.NEGBINOM_DIST.functionParameter.probabilityS.name",detail:"formula.functionList.NEGBINOM_DIST.functionParameter.probabilityS.detail",example:"0.25",require:1,repeat:0},{name:"formula.functionList.NEGBINOM_DIST.functionParameter.cumulative.name",detail:"formula.functionList.NEGBINOM_DIST.functionParameter.cumulative.detail",example:"true",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.NORM_DIST,functionType:t.FunctionType.Statistical,description:"formula.functionList.NORM_DIST.description",abstract:"formula.functionList.NORM_DIST.abstract",functionParameter:[{name:"formula.functionList.NORM_DIST.functionParameter.x.name",detail:"formula.functionList.NORM_DIST.functionParameter.x.detail",example:"42",require:1,repeat:0},{name:"formula.functionList.NORM_DIST.functionParameter.mean.name",detail:"formula.functionList.NORM_DIST.functionParameter.mean.detail",example:"40",require:1,repeat:0},{name:"formula.functionList.NORM_DIST.functionParameter.standardDev.name",detail:"formula.functionList.NORM_DIST.functionParameter.standardDev.detail",example:"1.5",require:1,repeat:0},{name:"formula.functionList.NORM_DIST.functionParameter.cumulative.name",detail:"formula.functionList.NORM_DIST.functionParameter.cumulative.detail",example:"true",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.NORM_INV,functionType:t.FunctionType.Statistical,description:"formula.functionList.NORM_INV.description",abstract:"formula.functionList.NORM_INV.abstract",functionParameter:[{name:"formula.functionList.NORM_INV.functionParameter.probability.name",detail:"formula.functionList.NORM_INV.functionParameter.probability.detail",example:"0.908789",require:1,repeat:0},{name:"formula.functionList.NORM_INV.functionParameter.mean.name",detail:"formula.functionList.NORM_INV.functionParameter.mean.detail",example:"40",require:1,repeat:0},{name:"formula.functionList.NORM_INV.functionParameter.standardDev.name",detail:"formula.functionList.NORM_INV.functionParameter.standardDev.detail",example:"1.5",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.NORM_S_DIST,functionType:t.FunctionType.Statistical,description:"formula.functionList.NORM_S_DIST.description",abstract:"formula.functionList.NORM_S_DIST.abstract",functionParameter:[{name:"formula.functionList.NORM_S_DIST.functionParameter.z.name",detail:"formula.functionList.NORM_S_DIST.functionParameter.z.detail",example:"1.333333",require:1,repeat:0},{name:"formula.functionList.NORM_S_DIST.functionParameter.cumulative.name",detail:"formula.functionList.NORM_S_DIST.functionParameter.cumulative.detail",example:"true",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.NORM_S_INV,functionType:t.FunctionType.Statistical,description:"formula.functionList.NORM_S_INV.description",abstract:"formula.functionList.NORM_S_INV.abstract",functionParameter:[{name:"formula.functionList.NORM_S_INV.functionParameter.probability.name",detail:"formula.functionList.NORM_S_INV.functionParameter.probability.detail",example:"0.908789",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.PEARSON,functionType:t.FunctionType.Statistical,description:"formula.functionList.PEARSON.description",abstract:"formula.functionList.PEARSON.abstract",functionParameter:[{name:"formula.functionList.PEARSON.functionParameter.array1.name",detail:"formula.functionList.PEARSON.functionParameter.array1.detail",example:"A1:A4",require:1,repeat:0},{name:"formula.functionList.PEARSON.functionParameter.array2.name",detail:"formula.functionList.PEARSON.functionParameter.array2.detail",example:"B1:B4",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.PERCENTILE_EXC,functionType:t.FunctionType.Statistical,description:"formula.functionList.PERCENTILE_EXC.description",abstract:"formula.functionList.PERCENTILE_EXC.abstract",functionParameter:[{name:"formula.functionList.PERCENTILE_EXC.functionParameter.array.name",detail:"formula.functionList.PERCENTILE_EXC.functionParameter.array.detail",example:"A1:A4",require:1,repeat:0},{name:"formula.functionList.PERCENTILE_EXC.functionParameter.k.name",detail:"formula.functionList.PERCENTILE_EXC.functionParameter.k.detail",example:"0.3",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.PERCENTILE_INC,functionType:t.FunctionType.Statistical,description:"formula.functionList.PERCENTILE_INC.description",abstract:"formula.functionList.PERCENTILE_INC.abstract",functionParameter:[{name:"formula.functionList.PERCENTILE_INC.functionParameter.array.name",detail:"formula.functionList.PERCENTILE_INC.functionParameter.array.detail",example:"A1:A4",require:1,repeat:0},{name:"formula.functionList.PERCENTILE_INC.functionParameter.k.name",detail:"formula.functionList.PERCENTILE_INC.functionParameter.k.detail",example:"0.3",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.PERCENTRANK_EXC,functionType:t.FunctionType.Statistical,description:"formula.functionList.PERCENTRANK_EXC.description",abstract:"formula.functionList.PERCENTRANK_EXC.abstract",functionParameter:[{name:"formula.functionList.PERCENTRANK_EXC.functionParameter.array.name",detail:"formula.functionList.PERCENTRANK_EXC.functionParameter.array.detail",example:"A1:A4",require:1,repeat:0},{name:"formula.functionList.PERCENTRANK_EXC.functionParameter.x.name",detail:"formula.functionList.PERCENTRANK_EXC.functionParameter.x.detail",example:"1.5",require:1,repeat:0},{name:"formula.functionList.PERCENTRANK_EXC.functionParameter.significance.name",detail:"formula.functionList.PERCENTRANK_EXC.functionParameter.significance.detail",example:"3",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.PERCENTRANK_INC,functionType:t.FunctionType.Statistical,description:"formula.functionList.PERCENTRANK_INC.description",abstract:"formula.functionList.PERCENTRANK_INC.abstract",functionParameter:[{name:"formula.functionList.PERCENTRANK_INC.functionParameter.array.name",detail:"formula.functionList.PERCENTRANK_INC.functionParameter.array.detail",example:"A1:A4",require:1,repeat:0},{name:"formula.functionList.PERCENTRANK_INC.functionParameter.x.name",detail:"formula.functionList.PERCENTRANK_INC.functionParameter.x.detail",example:"1.5",require:1,repeat:0},{name:"formula.functionList.PERCENTRANK_INC.functionParameter.significance.name",detail:"formula.functionList.PERCENTRANK_INC.functionParameter.significance.detail",example:"3",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.PERMUT,functionType:t.FunctionType.Statistical,description:"formula.functionList.PERMUT.description",abstract:"formula.functionList.PERMUT.abstract",functionParameter:[{name:"formula.functionList.PERMUT.functionParameter.number.name",detail:"formula.functionList.PERMUT.functionParameter.number.detail",example:"8",require:1,repeat:0},{name:"formula.functionList.PERMUT.functionParameter.numberChosen.name",detail:"formula.functionList.PERMUT.functionParameter.numberChosen.detail",example:"2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.PERMUTATIONA,functionType:t.FunctionType.Statistical,description:"formula.functionList.PERMUTATIONA.description",abstract:"formula.functionList.PERMUTATIONA.abstract",functionParameter:[{name:"formula.functionList.PERMUT.functionParameter.number.name",detail:"formula.functionList.PERMUT.functionParameter.number.detail",example:"8",require:1,repeat:0},{name:"formula.functionList.PERMUT.functionParameter.numberChosen.name",detail:"formula.functionList.PERMUT.functionParameter.numberChosen.detail",example:"2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.PHI,functionType:t.FunctionType.Statistical,description:"formula.functionList.PHI.description",abstract:"formula.functionList.PHI.abstract",functionParameter:[{name:"formula.functionList.PHI.functionParameter.x.name",detail:"formula.functionList.PHI.functionParameter.x.detail",example:"0.75",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.POISSON_DIST,functionType:t.FunctionType.Statistical,description:"formula.functionList.POISSON_DIST.description",abstract:"formula.functionList.POISSON_DIST.abstract",functionParameter:[{name:"formula.functionList.POISSON_DIST.functionParameter.x.name",detail:"formula.functionList.POISSON_DIST.functionParameter.x.detail",example:"2",require:1,repeat:0},{name:"formula.functionList.POISSON_DIST.functionParameter.mean.name",detail:"formula.functionList.POISSON_DIST.functionParameter.mean.detail",example:"5",require:1,repeat:0},{name:"formula.functionList.POISSON_DIST.functionParameter.cumulative.name",detail:"formula.functionList.POISSON_DIST.functionParameter.cumulative.detail",example:"true",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.PROB,functionType:t.FunctionType.Statistical,description:"formula.functionList.PROB.description",abstract:"formula.functionList.PROB.abstract",functionParameter:[{name:"formula.functionList.PROB.functionParameter.xRange.name",detail:"formula.functionList.PROB.functionParameter.xRange.detail",example:"A1:A4",require:1,repeat:0},{name:"formula.functionList.PROB.functionParameter.probRange.name",detail:"formula.functionList.PROB.functionParameter.probRange.detail",example:"B1:B4",require:1,repeat:0},{name:"formula.functionList.PROB.functionParameter.lowerLimit.name",detail:"formula.functionList.PROB.functionParameter.lowerLimit.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.PROB.functionParameter.upperLimit.name",detail:"formula.functionList.PROB.functionParameter.upperLimit.detail",example:"3",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.QUARTILE_EXC,functionType:t.FunctionType.Statistical,description:"formula.functionList.QUARTILE_EXC.description",abstract:"formula.functionList.QUARTILE_EXC.abstract",functionParameter:[{name:"formula.functionList.QUARTILE_EXC.functionParameter.array.name",detail:"formula.functionList.QUARTILE_EXC.functionParameter.array.detail",example:"A1:A4",require:1,repeat:0},{name:"formula.functionList.QUARTILE_EXC.functionParameter.quart.name",detail:"formula.functionList.QUARTILE_EXC.functionParameter.quart.detail",example:"1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.QUARTILE_INC,functionType:t.FunctionType.Statistical,description:"formula.functionList.QUARTILE_INC.description",abstract:"formula.functionList.QUARTILE_INC.abstract",functionParameter:[{name:"formula.functionList.QUARTILE_INC.functionParameter.array.name",detail:"formula.functionList.QUARTILE_INC.functionParameter.array.detail",example:"A1:A4",require:1,repeat:0},{name:"formula.functionList.QUARTILE_INC.functionParameter.quart.name",detail:"formula.functionList.QUARTILE_INC.functionParameter.quart.detail",example:"1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.RANK_AVG,functionType:t.FunctionType.Statistical,description:"formula.functionList.RANK_AVG.description",abstract:"formula.functionList.RANK_AVG.abstract",functionParameter:[{name:"formula.functionList.RANK_AVG.functionParameter.number.name",detail:"formula.functionList.RANK_AVG.functionParameter.number.detail",example:"A3",require:1,repeat:0},{name:"formula.functionList.RANK_AVG.functionParameter.ref.name",detail:"formula.functionList.RANK_AVG.functionParameter.ref.detail",example:"A2:A6",require:1,repeat:0},{name:"formula.functionList.RANK_AVG.functionParameter.order.name",detail:"formula.functionList.RANK_AVG.functionParameter.order.detail",example:"1",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.RANK_EQ,functionType:t.FunctionType.Statistical,description:"formula.functionList.RANK_EQ.description",abstract:"formula.functionList.RANK_EQ.abstract",functionParameter:[{name:"formula.functionList.RANK_EQ.functionParameter.number.name",detail:"formula.functionList.RANK_EQ.functionParameter.number.detail",example:"A3",require:1,repeat:0},{name:"formula.functionList.RANK_EQ.functionParameter.ref.name",detail:"formula.functionList.RANK_EQ.functionParameter.ref.detail",example:"A2:A6",require:1,repeat:0},{name:"formula.functionList.RANK_EQ.functionParameter.order.name",detail:"formula.functionList.RANK_EQ.functionParameter.order.detail",example:"1",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.RSQ,functionType:t.FunctionType.Statistical,description:"formula.functionList.RSQ.description",abstract:"formula.functionList.RSQ.abstract",functionParameter:[{name:"formula.functionList.RSQ.functionParameter.array1.name",detail:"formula.functionList.RSQ.functionParameter.array1.detail",example:"A1:A4",require:1,repeat:0},{name:"formula.functionList.RSQ.functionParameter.array2.name",detail:"formula.functionList.RSQ.functionParameter.array2.detail",example:"B1:B4",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.SKEW,functionType:t.FunctionType.Statistical,description:"formula.functionList.SKEW.description",abstract:"formula.functionList.SKEW.abstract",functionParameter:[{name:"formula.functionList.SKEW.functionParameter.number1.name",detail:"formula.functionList.SKEW.functionParameter.number1.detail",example:"A1:C3",require:1,repeat:0},{name:"formula.functionList.SKEW.functionParameter.number2.name",detail:"formula.functionList.SKEW.functionParameter.number2.detail",example:"4",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.SKEW_P,functionType:t.FunctionType.Statistical,description:"formula.functionList.SKEW_P.description",abstract:"formula.functionList.SKEW_P.abstract",functionParameter:[{name:"formula.functionList.SKEW_P.functionParameter.number1.name",detail:"formula.functionList.SKEW_P.functionParameter.number1.detail",example:"A1:C3",require:1,repeat:0},{name:"formula.functionList.SKEW_P.functionParameter.number2.name",detail:"formula.functionList.SKEW_P.functionParameter.number2.detail",example:"4",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.SLOPE,functionType:t.FunctionType.Statistical,description:"formula.functionList.SLOPE.description",abstract:"formula.functionList.SLOPE.abstract",functionParameter:[{name:"formula.functionList.SLOPE.functionParameter.knownYs.name",detail:"formula.functionList.SLOPE.functionParameter.knownYs.detail",example:"A1:A4",require:1,repeat:0},{name:"formula.functionList.SLOPE.functionParameter.knownXs.name",detail:"formula.functionList.SLOPE.functionParameter.knownXs.detail",example:"B1:B4",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.SMALL,functionType:t.FunctionType.Statistical,description:"formula.functionList.SMALL.description",abstract:"formula.functionList.SMALL.abstract",functionParameter:[{name:"formula.functionList.SMALL.functionParameter.array.name",detail:"formula.functionList.SMALL.functionParameter.array.detail",example:"A2:B6",require:1,repeat:0},{name:"formula.functionList.SMALL.functionParameter.k.name",detail:"formula.functionList.SMALL.functionParameter.k.detail",example:"3",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.STANDARDIZE,functionType:t.FunctionType.Statistical,description:"formula.functionList.STANDARDIZE.description",abstract:"formula.functionList.STANDARDIZE.abstract",functionParameter:[{name:"formula.functionList.STANDARDIZE.functionParameter.x.name",detail:"formula.functionList.STANDARDIZE.functionParameter.x.detail",example:"42",require:1,repeat:0},{name:"formula.functionList.STANDARDIZE.functionParameter.mean.name",detail:"formula.functionList.STANDARDIZE.functionParameter.mean.detail",example:"40",require:1,repeat:0},{name:"formula.functionList.STANDARDIZE.functionParameter.standardDev.name",detail:"formula.functionList.STANDARDIZE.functionParameter.standardDev.detail",example:"1.5",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.STDEV_P,functionType:t.FunctionType.Statistical,description:"formula.functionList.STDEV_P.description",abstract:"formula.functionList.STDEV_P.abstract",functionParameter:[{name:"formula.functionList.STDEV_P.functionParameter.number1.name",detail:"formula.functionList.STDEV_P.functionParameter.number1.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.STDEV_P.functionParameter.number2.name",detail:"formula.functionList.STDEV_P.functionParameter.number2.detail",example:"2",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.STDEV_S,functionType:t.FunctionType.Statistical,description:"formula.functionList.STDEV_S.description",abstract:"formula.functionList.STDEV_S.abstract",functionParameter:[{name:"formula.functionList.STDEV_S.functionParameter.number1.name",detail:"formula.functionList.STDEV_S.functionParameter.number1.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.STDEV_S.functionParameter.number2.name",detail:"formula.functionList.STDEV_S.functionParameter.number2.detail",example:"2",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.STDEVA,functionType:t.FunctionType.Statistical,description:"formula.functionList.STDEVA.description",abstract:"formula.functionList.STDEVA.abstract",functionParameter:[{name:"formula.functionList.STDEVA.functionParameter.value1.name",detail:"formula.functionList.STDEVA.functionParameter.value1.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.STDEVA.functionParameter.value2.name",detail:"formula.functionList.STDEVA.functionParameter.value2.detail",example:"2",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.STDEVPA,functionType:t.FunctionType.Statistical,description:"formula.functionList.STDEVPA.description",abstract:"formula.functionList.STDEVPA.abstract",functionParameter:[{name:"formula.functionList.STDEVPA.functionParameter.value1.name",detail:"formula.functionList.STDEVPA.functionParameter.value1.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.STDEVPA.functionParameter.value2.name",detail:"formula.functionList.STDEVPA.functionParameter.value2.detail",example:"2",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.STEYX,functionType:t.FunctionType.Statistical,description:"formula.functionList.STEYX.description",abstract:"formula.functionList.STEYX.abstract",functionParameter:[{name:"formula.functionList.STEYX.functionParameter.knownYs.name",detail:"formula.functionList.STEYX.functionParameter.knownYs.detail",example:"A1:A4",require:1,repeat:0},{name:"formula.functionList.STEYX.functionParameter.knownXs.name",detail:"formula.functionList.STEYX.functionParameter.knownXs.detail",example:"B1:B4",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.T_DIST,functionType:t.FunctionType.Statistical,description:"formula.functionList.T_DIST.description",abstract:"formula.functionList.T_DIST.abstract",functionParameter:[{name:"formula.functionList.T_DIST.functionParameter.x.name",detail:"formula.functionList.T_DIST.functionParameter.x.detail",example:"8",require:1,repeat:0},{name:"formula.functionList.T_DIST.functionParameter.degFreedom.name",detail:"formula.functionList.T_DIST.functionParameter.degFreedom.detail",example:"3",require:1,repeat:0},{name:"formula.functionList.T_DIST.functionParameter.cumulative.name",detail:"formula.functionList.T_DIST.functionParameter.cumulative.detail",example:"true",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.T_DIST_2T,functionType:t.FunctionType.Statistical,description:"formula.functionList.T_DIST_2T.description",abstract:"formula.functionList.T_DIST_2T.abstract",functionParameter:[{name:"formula.functionList.T_DIST_2T.functionParameter.x.name",detail:"formula.functionList.T_DIST_2T.functionParameter.x.detail",example:"8",require:1,repeat:0},{name:"formula.functionList.T_DIST_2T.functionParameter.degFreedom.name",detail:"formula.functionList.T_DIST_2T.functionParameter.degFreedom.detail",example:"3",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.T_DIST_RT,functionType:t.FunctionType.Statistical,description:"formula.functionList.T_DIST_RT.description",abstract:"formula.functionList.T_DIST_RT.abstract",functionParameter:[{name:"formula.functionList.T_DIST_RT.functionParameter.x.name",detail:"formula.functionList.T_DIST_RT.functionParameter.x.detail",example:"8",require:1,repeat:0},{name:"formula.functionList.T_DIST_RT.functionParameter.degFreedom.name",detail:"formula.functionList.T_DIST_RT.functionParameter.degFreedom.detail",example:"3",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.T_INV,functionType:t.FunctionType.Statistical,description:"formula.functionList.T_INV.description",abstract:"formula.functionList.T_INV.abstract",functionParameter:[{name:"formula.functionList.T_INV.functionParameter.probability.name",detail:"formula.functionList.T_INV.functionParameter.probability.detail",example:"0.75",require:1,repeat:0},{name:"formula.functionList.T_INV.functionParameter.degFreedom.name",detail:"formula.functionList.T_INV.functionParameter.degFreedom.detail",example:"2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.T_INV_2T,functionType:t.FunctionType.Statistical,description:"formula.functionList.T_INV_2T.description",abstract:"formula.functionList.T_INV_2T.abstract",functionParameter:[{name:"formula.functionList.T_INV_2T.functionParameter.probability.name",detail:"formula.functionList.T_INV_2T.functionParameter.probability.detail",example:"0.75",require:1,repeat:0},{name:"formula.functionList.T_INV_2T.functionParameter.degFreedom.name",detail:"formula.functionList.T_INV_2T.functionParameter.degFreedom.detail",example:"2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.T_TEST,functionType:t.FunctionType.Statistical,description:"formula.functionList.T_TEST.description",abstract:"formula.functionList.T_TEST.abstract",functionParameter:[{name:"formula.functionList.T_TEST.functionParameter.array1.name",detail:"formula.functionList.T_TEST.functionParameter.array1.detail",example:"A1:A4",require:1,repeat:0},{name:"formula.functionList.T_TEST.functionParameter.array2.name",detail:"formula.functionList.T_TEST.functionParameter.array2.detail",example:"B1:B4",require:1,repeat:0},{name:"formula.functionList.T_TEST.functionParameter.tails.name",detail:"formula.functionList.T_TEST.functionParameter.tails.detail",example:"2",require:1,repeat:0},{name:"formula.functionList.T_TEST.functionParameter.type.name",detail:"formula.functionList.T_TEST.functionParameter.type.detail",example:"1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.TREND,functionType:t.FunctionType.Statistical,description:"formula.functionList.TREND.description",abstract:"formula.functionList.TREND.abstract",functionParameter:[{name:"formula.functionList.TREND.functionParameter.knownYs.name",detail:"formula.functionList.TREND.functionParameter.knownYs.detail",example:"B2:B7",require:1,repeat:0},{name:"formula.functionList.TREND.functionParameter.knownXs.name",detail:"formula.functionList.TREND.functionParameter.knownXs.detail",example:"A2:A7",require:0,repeat:0},{name:"formula.functionList.TREND.functionParameter.newXs.name",detail:"formula.functionList.TREND.functionParameter.newXs.detail",example:"A9:A10",require:0,repeat:0},{name:"formula.functionList.TREND.functionParameter.constb.name",detail:"formula.functionList.TREND.functionParameter.constb.detail",example:"true",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.TRIMMEAN,functionType:t.FunctionType.Statistical,description:"formula.functionList.TRIMMEAN.description",abstract:"formula.functionList.TRIMMEAN.abstract",functionParameter:[{name:"formula.functionList.TRIMMEAN.functionParameter.array.name",detail:"formula.functionList.TRIMMEAN.functionParameter.array.detail",example:"A2:A12",require:1,repeat:0},{name:"formula.functionList.TRIMMEAN.functionParameter.percent.name",detail:"formula.functionList.TRIMMEAN.functionParameter.percent.detail",example:"0.2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.VAR_P,functionType:t.FunctionType.Statistical,description:"formula.functionList.VAR_P.description",abstract:"formula.functionList.VAR_P.abstract",functionParameter:[{name:"formula.functionList.VAR_P.functionParameter.number1.name",detail:"formula.functionList.VAR_P.functionParameter.number1.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.VAR_P.functionParameter.number2.name",detail:"formula.functionList.VAR_P.functionParameter.number2.detail",example:"2",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.VAR_S,functionType:t.FunctionType.Statistical,description:"formula.functionList.VAR_S.description",abstract:"formula.functionList.VAR_S.abstract",functionParameter:[{name:"formula.functionList.VAR_S.functionParameter.number1.name",detail:"formula.functionList.VAR_S.functionParameter.number1.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.VAR_S.functionParameter.number2.name",detail:"formula.functionList.VAR_S.functionParameter.number2.detail",example:"2",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.VARA,functionType:t.FunctionType.Statistical,description:"formula.functionList.VARA.description",abstract:"formula.functionList.VARA.abstract",functionParameter:[{name:"formula.functionList.VARA.functionParameter.value1.name",detail:"formula.functionList.VARA.functionParameter.value1.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.VARA.functionParameter.value2.name",detail:"formula.functionList.VARA.functionParameter.value2.detail",example:"2",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.VARPA,functionType:t.FunctionType.Statistical,description:"formula.functionList.VARPA.description",abstract:"formula.functionList.VARPA.abstract",functionParameter:[{name:"formula.functionList.VARPA.functionParameter.value1.name",detail:"formula.functionList.VARPA.functionParameter.value1.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.VARPA.functionParameter.value2.name",detail:"formula.functionList.VARPA.functionParameter.value2.detail",example:"2",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.WEIBULL_DIST,functionType:t.FunctionType.Statistical,description:"formula.functionList.WEIBULL_DIST.description",abstract:"formula.functionList.WEIBULL_DIST.abstract",functionParameter:[{name:"formula.functionList.WEIBULL_DIST.functionParameter.x.name",detail:"formula.functionList.WEIBULL_DIST.functionParameter.x.detail",example:"105",require:1,repeat:0},{name:"formula.functionList.WEIBULL_DIST.functionParameter.alpha.name",detail:"formula.functionList.WEIBULL_DIST.functionParameter.alpha.detail",example:"20",require:1,repeat:0},{name:"formula.functionList.WEIBULL_DIST.functionParameter.beta.name",detail:"formula.functionList.WEIBULL_DIST.functionParameter.beta.detail",example:"100",require:1,repeat:0},{name:"formula.functionList.WEIBULL_DIST.functionParameter.cumulative.name",detail:"formula.functionList.WEIBULL_DIST.functionParameter.cumulative.detail",example:"true",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.Z_TEST,functionType:t.FunctionType.Statistical,description:"formula.functionList.Z_TEST.description",abstract:"formula.functionList.Z_TEST.abstract",functionParameter:[{name:"formula.functionList.Z_TEST.functionParameter.array.name",detail:"formula.functionList.Z_TEST.functionParameter.array.detail",example:"A2:A11",require:1,repeat:0},{name:"formula.functionList.Z_TEST.functionParameter.x.name",detail:"formula.functionList.Z_TEST.functionParameter.x.detail",example:"4",require:1,repeat:0},{name:"formula.functionList.Z_TEST.functionParameter.sigma.name",detail:"formula.functionList.Z_TEST.functionParameter.sigma.detail",example:"10",require:0,repeat:0}]}],ta=[{functionName:t.FUNCTION_NAMES_TEXT.ASC,functionType:t.FunctionType.Text,description:"formula.functionList.ASC.description",abstract:"formula.functionList.ASC.abstract",functionParameter:[{name:"formula.functionList.ASC.functionParameter.text.name",detail:"formula.functionList.ASC.functionParameter.text.detail",example:'"Univer"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.ARRAYTOTEXT,functionType:t.FunctionType.Text,description:"formula.functionList.ARRAYTOTEXT.description",abstract:"formula.functionList.ARRAYTOTEXT.abstract",functionParameter:[{name:"formula.functionList.ARRAYTOTEXT.functionParameter.array.name",detail:"formula.functionList.ARRAYTOTEXT.functionParameter.array.detail",example:"A2:B4",require:1,repeat:0},{name:"formula.functionList.ARRAYTOTEXT.functionParameter.format.name",detail:"formula.functionList.ARRAYTOTEXT.functionParameter.format.detail",example:"0",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.BAHTTEXT,functionType:t.FunctionType.Text,description:"formula.functionList.BAHTTEXT.description",abstract:"formula.functionList.BAHTTEXT.abstract",functionParameter:[{name:"formula.functionList.BAHTTEXT.functionParameter.number.name",detail:"formula.functionList.BAHTTEXT.functionParameter.number.detail",example:"1234",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.CHAR,functionType:t.FunctionType.Text,description:"formula.functionList.CHAR.description",abstract:"formula.functionList.CHAR.abstract",functionParameter:[{name:"formula.functionList.CHAR.functionParameter.number.name",detail:"formula.functionList.CHAR.functionParameter.number.detail",example:"65",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.CLEAN,functionType:t.FunctionType.Text,description:"formula.functionList.CLEAN.description",abstract:"formula.functionList.CLEAN.abstract",functionParameter:[{name:"formula.functionList.CLEAN.functionParameter.text.name",detail:"formula.functionList.CLEAN.functionParameter.text.detail",example:'CHAR(1)&"Univer"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.CODE,functionType:t.FunctionType.Text,description:"formula.functionList.CODE.description",abstract:"formula.functionList.CODE.abstract",functionParameter:[{name:"formula.functionList.CODE.functionParameter.text.name",detail:"formula.functionList.CODE.functionParameter.text.detail",example:'"Univer"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.CONCAT,functionType:t.FunctionType.Text,description:"formula.functionList.CONCAT.description",abstract:"formula.functionList.CONCAT.abstract",functionParameter:[{name:"formula.functionList.CONCAT.functionParameter.text1.name",detail:"formula.functionList.CONCAT.functionParameter.text1.detail",example:'"Hello"',require:1,repeat:0},{name:"formula.functionList.CONCAT.functionParameter.text2.name",detail:"formula.functionList.CONCAT.functionParameter.text2.detail",example:'"Univer"',require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_TEXT.CONCATENATE,functionType:t.FunctionType.Text,description:"formula.functionList.CONCATENATE.description",abstract:"formula.functionList.CONCATENATE.abstract",functionParameter:[{name:"formula.functionList.CONCATENATE.functionParameter.text1.name",detail:"formula.functionList.CONCATENATE.functionParameter.text1.detail",example:"A1",require:1,repeat:0},{name:"formula.functionList.CONCATENATE.functionParameter.text2.name",detail:"formula.functionList.CONCATENATE.functionParameter.text2.detail",example:"A2",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_TEXT.DBCS,functionType:t.FunctionType.Text,description:"formula.functionList.DBCS.description",abstract:"formula.functionList.DBCS.abstract",functionParameter:[{name:"formula.functionList.DBCS.functionParameter.text.name",detail:"formula.functionList.DBCS.functionParameter.text.detail",example:'"Univer"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.DOLLAR,functionType:t.FunctionType.Text,description:"formula.functionList.DOLLAR.description",abstract:"formula.functionList.DOLLAR.abstract",functionParameter:[{name:"formula.functionList.DOLLAR.functionParameter.number.name",detail:"formula.functionList.DOLLAR.functionParameter.number.detail",example:"1234.567",require:1,repeat:0},{name:"formula.functionList.DOLLAR.functionParameter.decimals.name",detail:"formula.functionList.DOLLAR.functionParameter.decimals.detail",example:"2",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.EXACT,functionType:t.FunctionType.Text,description:"formula.functionList.EXACT.description",abstract:"formula.functionList.EXACT.abstract",functionParameter:[{name:"formula.functionList.EXACT.functionParameter.text1.name",detail:"formula.functionList.EXACT.functionParameter.text1.detail",example:'"Univer"',require:1,repeat:0},{name:"formula.functionList.EXACT.functionParameter.text2.name",detail:"formula.functionList.EXACT.functionParameter.text2.detail",example:'"univer"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.FIND,functionType:t.FunctionType.Text,description:"formula.functionList.FIND.description",abstract:"formula.functionList.FIND.abstract",functionParameter:[{name:"formula.functionList.FIND.functionParameter.findText.name",detail:"formula.functionList.FIND.functionParameter.findText.detail",example:'"Univer"',require:1,repeat:0},{name:"formula.functionList.FIND.functionParameter.withinText.name",detail:"formula.functionList.FIND.functionParameter.withinText.detail",example:'"Hello Univer"',require:1,repeat:0},{name:"formula.functionList.FIND.functionParameter.startNum.name",detail:"formula.functionList.FIND.functionParameter.startNum.detail",example:"1",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.FINDB,functionType:t.FunctionType.Text,description:"formula.functionList.FINDB.description",abstract:"formula.functionList.FINDB.abstract",functionParameter:[{name:"formula.functionList.FINDB.functionParameter.findText.name",detail:"formula.functionList.FINDB.functionParameter.findText.detail",example:'"Univer"',require:1,repeat:0},{name:"formula.functionList.FINDB.functionParameter.withinText.name",detail:"formula.functionList.FINDB.functionParameter.withinText.detail",example:'"Hello Univer"',require:1,repeat:0},{name:"formula.functionList.FINDB.functionParameter.startNum.name",detail:"formula.functionList.FINDB.functionParameter.startNum.detail",example:"1",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.FIXED,functionType:t.FunctionType.Text,description:"formula.functionList.FIXED.description",abstract:"formula.functionList.FIXED.abstract",functionParameter:[{name:"formula.functionList.FIXED.functionParameter.number.name",detail:"formula.functionList.FIXED.functionParameter.number.detail",example:"1234.567",require:1,repeat:0},{name:"formula.functionList.FIXED.functionParameter.decimals.name",detail:"formula.functionList.FIXED.functionParameter.decimals.detail",example:"2",require:0,repeat:0},{name:"formula.functionList.FIXED.functionParameter.noCommas.name",detail:"formula.functionList.FIXED.functionParameter.noCommas.detail",example:"0",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.LEFT,functionType:t.FunctionType.Text,description:"formula.functionList.LEFT.description",abstract:"formula.functionList.LEFT.abstract",functionParameter:[{name:"formula.functionList.LEFT.functionParameter.text.name",detail:"formula.functionList.LEFT.functionParameter.text.detail",example:'"Univer"',require:1,repeat:0},{name:"formula.functionList.LEFT.functionParameter.numChars.name",detail:"formula.functionList.LEFT.functionParameter.numChars.detail",example:"3",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.LEFTB,functionType:t.FunctionType.Text,description:"formula.functionList.LEFTB.description",abstract:"formula.functionList.LEFTB.abstract",functionParameter:[{name:"formula.functionList.LEFTB.functionParameter.text.name",detail:"formula.functionList.LEFTB.functionParameter.text.detail",example:'"Univer"',require:1,repeat:0},{name:"formula.functionList.LEFTB.functionParameter.numBytes.name",detail:"formula.functionList.LEFTB.functionParameter.numBytes.detail",example:"3",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.LEN,functionType:t.FunctionType.Text,description:"formula.functionList.LEN.description",abstract:"formula.functionList.LEN.abstract",functionParameter:[{name:"formula.functionList.LEN.functionParameter.text.name",detail:"formula.functionList.LEN.functionParameter.text.detail",example:'"Univer"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.LENB,functionType:t.FunctionType.Text,description:"formula.functionList.LENB.description",abstract:"formula.functionList.LENB.abstract",functionParameter:[{name:"formula.functionList.LENB.functionParameter.text.name",detail:"formula.functionList.LENB.functionParameter.text.detail",example:'"Univer"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.LOWER,functionType:t.FunctionType.Text,description:"formula.functionList.LOWER.description",abstract:"formula.functionList.LOWER.abstract",functionParameter:[{name:"formula.functionList.LOWER.functionParameter.text.name",detail:"formula.functionList.LOWER.functionParameter.text.detail",example:'"Univer"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.MID,functionType:t.FunctionType.Text,description:"formula.functionList.MID.description",abstract:"formula.functionList.MID.abstract",functionParameter:[{name:"formula.functionList.MID.functionParameter.text.name",detail:"formula.functionList.MID.functionParameter.text.detail",example:'"Univer"',require:1,repeat:0},{name:"formula.functionList.MID.functionParameter.startNum.name",detail:"formula.functionList.MID.functionParameter.startNum.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.MID.functionParameter.numChars.name",detail:"formula.functionList.MID.functionParameter.numChars.detail",example:"3",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.MIDB,functionType:t.FunctionType.Text,description:"formula.functionList.MIDB.description",abstract:"formula.functionList.MIDB.abstract",functionParameter:[{name:"formula.functionList.MIDB.functionParameter.text.name",detail:"formula.functionList.MIDB.functionParameter.text.detail",example:'"Univer"',require:1,repeat:0},{name:"formula.functionList.MIDB.functionParameter.startNum.name",detail:"formula.functionList.MIDB.functionParameter.startNum.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.MIDB.functionParameter.numBytes.name",detail:"formula.functionList.MIDB.functionParameter.numBytes.detail",example:"3",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.NUMBERSTRING,functionType:t.FunctionType.Text,description:"formula.functionList.NUMBERSTRING.description",abstract:"formula.functionList.NUMBERSTRING.abstract",functionParameter:[{name:"formula.functionList.NUMBERSTRING.functionParameter.number.name",detail:"formula.functionList.NUMBERSTRING.functionParameter.number.detail",example:"123",require:1,repeat:0},{name:"formula.functionList.NUMBERSTRING.functionParameter.type.name",detail:"formula.functionList.NUMBERSTRING.functionParameter.type.detail",example:"1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.NUMBERVALUE,functionType:t.FunctionType.Text,description:"formula.functionList.NUMBERVALUE.description",abstract:"formula.functionList.NUMBERVALUE.abstract",functionParameter:[{name:"formula.functionList.NUMBERVALUE.functionParameter.text.name",detail:"formula.functionList.NUMBERVALUE.functionParameter.text.detail",example:'"2.500,27"',require:1,repeat:0},{name:"formula.functionList.NUMBERVALUE.functionParameter.decimalSeparator.name",detail:"formula.functionList.NUMBERVALUE.functionParameter.decimalSeparator.detail",example:'","',require:0,repeat:0},{name:"formula.functionList.NUMBERVALUE.functionParameter.groupSeparator.name",detail:"formula.functionList.NUMBERVALUE.functionParameter.groupSeparator.detail",example:'"."',require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.PHONETIC,functionType:t.FunctionType.Text,description:"formula.functionList.PHONETIC.description",abstract:"formula.functionList.PHONETIC.abstract",functionParameter:[{name:"formula.functionList.PHONETIC.functionParameter.number1.name",detail:"formula.functionList.PHONETIC.functionParameter.number1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.PHONETIC.functionParameter.number2.name",detail:"formula.functionList.PHONETIC.functionParameter.number2.detail",example:"A1:A20",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.PROPER,functionType:t.FunctionType.Text,description:"formula.functionList.PROPER.description",abstract:"formula.functionList.PROPER.abstract",functionParameter:[{name:"formula.functionList.PROPER.functionParameter.text.name",detail:"formula.functionList.PROPER.functionParameter.text.detail",example:'"hello univer"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.REGEXEXTRACT,functionType:t.FunctionType.Text,description:"formula.functionList.REGEXEXTRACT.description",abstract:"formula.functionList.REGEXEXTRACT.abstract",functionParameter:[{name:"formula.functionList.REGEXEXTRACT.functionParameter.text.name",detail:"formula.functionList.REGEXEXTRACT.functionParameter.text.detail",example:'"abcdefg"',require:1,repeat:0},{name:"formula.functionList.REGEXEXTRACT.functionParameter.regularExpression.name",detail:"formula.functionList.REGEXEXTRACT.functionParameter.regularExpression.detail",example:'"c.*f"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.REGEXMATCH,functionType:t.FunctionType.Text,description:"formula.functionList.REGEXMATCH.description",abstract:"formula.functionList.REGEXMATCH.abstract",functionParameter:[{name:"formula.functionList.REGEXMATCH.functionParameter.text.name",detail:"formula.functionList.REGEXMATCH.functionParameter.text.detail",example:'"Spreadsheets"',require:1,repeat:0},{name:"formula.functionList.REGEXMATCH.functionParameter.regularExpression.name",detail:"formula.functionList.REGEXMATCH.functionParameter.regularExpression.detail",example:'"S.r"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.REGEXREPLACE,functionType:t.FunctionType.Text,description:"formula.functionList.REGEXREPLACE.description",abstract:"formula.functionList.REGEXREPLACE.abstract",functionParameter:[{name:"formula.functionList.REGEXREPLACE.functionParameter.text.name",detail:"formula.functionList.REGEXREPLACE.functionParameter.text.detail",example:'"abcedfg"',require:1,repeat:0},{name:"formula.functionList.REGEXREPLACE.functionParameter.regularExpression.name",detail:"formula.functionList.REGEXREPLACE.functionParameter.regularExpression.detail",example:'"a.*d"',require:1,repeat:0},{name:"formula.functionList.REGEXREPLACE.functionParameter.replacement.name",detail:"formula.functionList.REGEXREPLACE.functionParameter.replacement.detail",example:'"xyz"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.REPLACE,functionType:t.FunctionType.Text,description:"formula.functionList.REPLACE.description",abstract:"formula.functionList.REPLACE.abstract",functionParameter:[{name:"formula.functionList.REPLACE.functionParameter.oldText.name",detail:"formula.functionList.REPLACE.functionParameter.oldText.detail",example:'"Univer"',require:1,repeat:0},{name:"formula.functionList.REPLACE.functionParameter.startNum.name",detail:"formula.functionList.REPLACE.functionParameter.startNum.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.REPLACE.functionParameter.numChars.name",detail:"formula.functionList.REPLACE.functionParameter.numChars.detail",example:"0",require:1,repeat:0},{name:"formula.functionList.REPLACE.functionParameter.newText.name",detail:"formula.functionList.REPLACE.functionParameter.newText.detail",example:'"Hello "',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.REPLACEB,functionType:t.FunctionType.Text,description:"formula.functionList.REPLACEB.description",abstract:"formula.functionList.REPLACEB.abstract",functionParameter:[{name:"formula.functionList.REPLACEB.functionParameter.oldText.name",detail:"formula.functionList.REPLACEB.functionParameter.oldText.detail",example:'"Univer"',require:1,repeat:0},{name:"formula.functionList.REPLACEB.functionParameter.startNum.name",detail:"formula.functionList.REPLACEB.functionParameter.startNum.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.REPLACEB.functionParameter.numBytes.name",detail:"formula.functionList.REPLACEB.functionParameter.numBytes.detail",example:"0",require:1,repeat:0},{name:"formula.functionList.REPLACEB.functionParameter.newText.name",detail:"formula.functionList.REPLACEB.functionParameter.newText.detail",example:'"Hello "',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.REPT,functionType:t.FunctionType.Text,description:"formula.functionList.REPT.description",abstract:"formula.functionList.REPT.abstract",functionParameter:[{name:"formula.functionList.REPT.functionParameter.text.name",detail:"formula.functionList.REPT.functionParameter.text.detail",example:'"*-"',require:1,repeat:0},{name:"formula.functionList.REPT.functionParameter.numberTimes.name",detail:"formula.functionList.REPT.functionParameter.numberTimes.detail",example:"3",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.RIGHT,functionType:t.FunctionType.Text,description:"formula.functionList.RIGHT.description",abstract:"formula.functionList.RIGHT.abstract",functionParameter:[{name:"formula.functionList.RIGHT.functionParameter.text.name",detail:"formula.functionList.RIGHT.functionParameter.text.detail",example:'"Univer"',require:1,repeat:0},{name:"formula.functionList.RIGHT.functionParameter.numChars.name",detail:"formula.functionList.RIGHT.functionParameter.numChars.detail",example:"3",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.RIGHTB,functionType:t.FunctionType.Text,description:"formula.functionList.RIGHTB.description",abstract:"formula.functionList.RIGHTB.abstract",functionParameter:[{name:"formula.functionList.RIGHTB.functionParameter.text.name",detail:"formula.functionList.RIGHTB.functionParameter.text.detail",example:'"Univer"',require:1,repeat:0},{name:"formula.functionList.RIGHTB.functionParameter.numBytes.name",detail:"formula.functionList.RIGHTB.functionParameter.numBytes.detail",example:"3",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.SEARCH,functionType:t.FunctionType.Text,description:"formula.functionList.SEARCH.description",abstract:"formula.functionList.SEARCH.abstract",functionParameter:[{name:"formula.functionList.SEARCH.functionParameter.findText.name",detail:"formula.functionList.SEARCH.functionParameter.findText.detail",example:'"univer"',require:1,repeat:0},{name:"formula.functionList.SEARCH.functionParameter.withinText.name",detail:"formula.functionList.SEARCH.functionParameter.withinText.detail",example:'"Hello Univer"',require:1,repeat:0},{name:"formula.functionList.SEARCH.functionParameter.startNum.name",detail:"formula.functionList.SEARCH.functionParameter.startNum.detail",example:"1",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.SEARCHB,functionType:t.FunctionType.Text,description:"formula.functionList.SEARCHB.description",abstract:"formula.functionList.SEARCHB.abstract",functionParameter:[{name:"formula.functionList.SEARCHB.functionParameter.findText.name",detail:"formula.functionList.SEARCHB.functionParameter.findText.detail",example:'"univer"',require:1,repeat:0},{name:"formula.functionList.SEARCHB.functionParameter.withinText.name",detail:"formula.functionList.SEARCHB.functionParameter.withinText.detail",example:'"Hello Univer"',require:1,repeat:0},{name:"formula.functionList.SEARCHB.functionParameter.startNum.name",detail:"formula.functionList.SEARCHB.functionParameter.startNum.detail",example:"1",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.SUBSTITUTE,functionType:t.FunctionType.Text,description:"formula.functionList.SUBSTITUTE.description",abstract:"formula.functionList.SUBSTITUTE.abstract",functionParameter:[{name:"formula.functionList.SUBSTITUTE.functionParameter.text.name",detail:"formula.functionList.SUBSTITUTE.functionParameter.text.detail",example:'"Hello Univer"',require:1,repeat:0},{name:"formula.functionList.SUBSTITUTE.functionParameter.oldText.name",detail:"formula.functionList.SUBSTITUTE.functionParameter.oldText.detail",example:'"Hello"',require:1,repeat:0},{name:"formula.functionList.SUBSTITUTE.functionParameter.newText.name",detail:"formula.functionList.SUBSTITUTE.functionParameter.newText.detail",example:'"Hi"',require:1,repeat:0},{name:"formula.functionList.SUBSTITUTE.functionParameter.instanceNum.name",detail:"formula.functionList.SUBSTITUTE.functionParameter.instanceNum.detail",example:"1",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.T,functionType:t.FunctionType.Text,description:"formula.functionList.T.description",abstract:"formula.functionList.T.abstract",functionParameter:[{name:"formula.functionList.T.functionParameter.value.name",detail:"formula.functionList.T.functionParameter.value.detail",example:'"Univer"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.TEXT,functionType:t.FunctionType.Text,description:"formula.functionList.TEXT.description",abstract:"formula.functionList.TEXT.abstract",functionParameter:[{name:"formula.functionList.TEXT.functionParameter.value.name",detail:"formula.functionList.TEXT.functionParameter.value.detail",example:"1.23",require:1,repeat:0},{name:"formula.functionList.TEXT.functionParameter.formatText.name",detail:"formula.functionList.TEXT.functionParameter.formatText.detail",example:'"$0.00"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.TEXTAFTER,functionType:t.FunctionType.Text,description:"formula.functionList.TEXTAFTER.description",abstract:"formula.functionList.TEXTAFTER.abstract",functionParameter:[{name:"formula.functionList.TEXTAFTER.functionParameter.text.name",detail:"formula.functionList.TEXTAFTER.functionParameter.text.detail",example:'"Red riding hood’s, red hood"',require:1,repeat:0},{name:"formula.functionList.TEXTAFTER.functionParameter.delimiter.name",detail:"formula.functionList.TEXTAFTER.functionParameter.delimiter.detail",example:'"hood"',require:1,repeat:0},{name:"formula.functionList.TEXTAFTER.functionParameter.instanceNum.name",detail:"formula.functionList.TEXTAFTER.functionParameter.instanceNum.detail",example:"1",require:0,repeat:0},{name:"formula.functionList.TEXTAFTER.functionParameter.matchMode.name",detail:"formula.functionList.TEXTAFTER.functionParameter.matchMode.detail",example:"1",require:0,repeat:0},{name:"formula.functionList.TEXTAFTER.functionParameter.matchEnd.name",detail:"formula.functionList.TEXTAFTER.functionParameter.matchEnd.detail",example:"0",require:0,repeat:0},{name:"formula.functionList.TEXTAFTER.functionParameter.ifNotFound.name",detail:"formula.functionList.TEXTAFTER.functionParameter.ifNotFound.detail",example:'"not found"',require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.TEXTBEFORE,functionType:t.FunctionType.Text,description:"formula.functionList.TEXTBEFORE.description",abstract:"formula.functionList.TEXTBEFORE.abstract",functionParameter:[{name:"formula.functionList.TEXTBEFORE.functionParameter.text.name",detail:"formula.functionList.TEXTBEFORE.functionParameter.text.detail",example:'"Red riding hood’s, red hood"',require:1,repeat:0},{name:"formula.functionList.TEXTBEFORE.functionParameter.delimiter.name",detail:"formula.functionList.TEXTBEFORE.functionParameter.delimiter.detail",example:'"hood"',require:1,repeat:0},{name:"formula.functionList.TEXTBEFORE.functionParameter.instanceNum.name",detail:"formula.functionList.TEXTBEFORE.functionParameter.instanceNum.detail",example:"1",require:0,repeat:0},{name:"formula.functionList.TEXTBEFORE.functionParameter.matchMode.name",detail:"formula.functionList.TEXTBEFORE.functionParameter.matchMode.detail",example:"1",require:0,repeat:0},{name:"formula.functionList.TEXTBEFORE.functionParameter.matchEnd.name",detail:"formula.functionList.TEXTBEFORE.functionParameter.matchEnd.detail",example:"0",require:0,repeat:0},{name:"formula.functionList.TEXTBEFORE.functionParameter.ifNotFound.name",detail:"formula.functionList.TEXTBEFORE.functionParameter.ifNotFound.detail",example:'"not found"',require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.TEXTJOIN,functionType:t.FunctionType.Text,description:"formula.functionList.TEXTJOIN.description",abstract:"formula.functionList.TEXTJOIN.abstract",functionParameter:[{name:"formula.functionList.TEXTJOIN.functionParameter.delimiter.name",detail:"formula.functionList.TEXTJOIN.functionParameter.delimiter.detail",example:'", "',require:1,repeat:0},{name:"formula.functionList.TEXTJOIN.functionParameter.ignoreEmpty.name",detail:"formula.functionList.TEXTJOIN.functionParameter.ignoreEmpty.detail",example:"true",require:1,repeat:0},{name:"formula.functionList.TEXTJOIN.functionParameter.text1.name",detail:"formula.functionList.TEXTJOIN.functionParameter.text1.detail",example:'"Hi"',require:1,repeat:0},{name:"formula.functionList.TEXTJOIN.functionParameter.text2.name",detail:"formula.functionList.TEXTJOIN.functionParameter.text2.detail",example:'"Univer"',require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_TEXT.TEXTSPLIT,functionType:t.FunctionType.Text,description:"formula.functionList.TEXTSPLIT.description",abstract:"formula.functionList.TEXTSPLIT.abstract",functionParameter:[{name:"formula.functionList.TEXTSPLIT.functionParameter.text.name",detail:"formula.functionList.TEXTSPLIT.functionParameter.text.detail",example:"A1:C2",require:1,repeat:0},{name:"formula.functionList.TEXTSPLIT.functionParameter.colDelimiter.name",detail:"formula.functionList.TEXTSPLIT.functionParameter.colDelimiter.detail",example:'","',require:1,repeat:0},{name:"formula.functionList.TEXTSPLIT.functionParameter.rowDelimiter.name",detail:"formula.functionList.TEXTSPLIT.functionParameter.rowDelimiter.detail",example:'";"',require:0,repeat:0},{name:"formula.functionList.TEXTSPLIT.functionParameter.ignoreEmpty.name",detail:"formula.functionList.TEXTSPLIT.functionParameter.ignoreEmpty.detail",example:"",require:0,repeat:0},{name:"formula.functionList.TEXTSPLIT.functionParameter.matchMode.name",detail:"formula.functionList.TEXTSPLIT.functionParameter.matchMode.detail",example:"",require:0,repeat:0},{name:"formula.functionList.TEXTSPLIT.functionParameter.padWith.name",detail:"formula.functionList.TEXTSPLIT.functionParameter.padWith.detail",example:"",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.TRIM,functionType:t.FunctionType.Text,description:"formula.functionList.TRIM.description",abstract:"formula.functionList.TRIM.abstract",functionParameter:[{name:"formula.functionList.TRIM.functionParameter.text.name",detail:"formula.functionList.TRIM.functionParameter.text.detail",example:'" Hello Univer "',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.UNICHAR,functionType:t.FunctionType.Text,description:"formula.functionList.UNICHAR.description",abstract:"formula.functionList.UNICHAR.abstract",functionParameter:[{name:"formula.functionList.UNICHAR.functionParameter.number.name",detail:"formula.functionList.UNICHAR.functionParameter.number.detail",example:"65",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.UNICODE,functionType:t.FunctionType.Text,description:"formula.functionList.UNICODE.description",abstract:"formula.functionList.UNICODE.abstract",functionParameter:[{name:"formula.functionList.UNICODE.functionParameter.text.name",detail:"formula.functionList.UNICODE.functionParameter.text.detail",example:'"Univer"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.UPPER,functionType:t.FunctionType.Text,description:"formula.functionList.UPPER.description",abstract:"formula.functionList.UPPER.abstract",functionParameter:[{name:"formula.functionList.UPPER.functionParameter.text.name",detail:"formula.functionList.UPPER.functionParameter.text.detail",example:'"Univer"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.VALUE,functionType:t.FunctionType.Text,description:"formula.functionList.VALUE.description",abstract:"formula.functionList.VALUE.abstract",functionParameter:[{name:"formula.functionList.VALUE.functionParameter.text.name",detail:"formula.functionList.VALUE.functionParameter.text.detail",example:'"123"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.VALUETOTEXT,functionType:t.FunctionType.Text,description:"formula.functionList.VALUETOTEXT.description",abstract:"formula.functionList.VALUETOTEXT.abstract",functionParameter:[{name:"formula.functionList.VALUETOTEXT.functionParameter.value.name",detail:"formula.functionList.VALUETOTEXT.functionParameter.value.detail",example:'"Univer"',require:1,repeat:0},{name:"formula.functionList.VALUETOTEXT.functionParameter.format.name",detail:"formula.functionList.VALUETOTEXT.functionParameter.format.detail",example:"1",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.CALL,functionType:t.FunctionType.Text,description:"formula.functionList.CALL.description",abstract:"formula.functionList.CALL.abstract",functionParameter:[{name:"formula.functionList.CALL.functionParameter.number1.name",detail:"formula.functionList.CALL.functionParameter.number1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.CALL.functionParameter.number2.name",detail:"formula.functionList.CALL.functionParameter.number2.detail",example:"A1:A20",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.EUROCONVERT,functionType:t.FunctionType.Text,description:"formula.functionList.EUROCONVERT.description",abstract:"formula.functionList.EUROCONVERT.abstract",functionParameter:[{name:"formula.functionList.EUROCONVERT.functionParameter.number1.name",detail:"formula.functionList.EUROCONVERT.functionParameter.number1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.EUROCONVERT.functionParameter.number2.name",detail:"formula.functionList.EUROCONVERT.functionParameter.number2.detail",example:"A1:A20",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.REGISTER_ID,functionType:t.FunctionType.Text,description:"formula.functionList.REGISTER_ID.description",abstract:"formula.functionList.REGISTER_ID.abstract",functionParameter:[{name:"formula.functionList.REGISTER_ID.functionParameter.number1.name",detail:"formula.functionList.REGISTER_ID.functionParameter.number1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.REGISTER_ID.functionParameter.number2.name",detail:"formula.functionList.REGISTER_ID.functionParameter.number2.detail",example:"A1:A20",require:1,repeat:0}]}],ea=[],aa=[{functionName:t.FUNCTION_NAMES_WEB.ENCODEURL,functionType:t.FunctionType.Web,description:"formula.functionList.ENCODEURL.description",abstract:"formula.functionList.ENCODEURL.abstract",functionParameter:[{name:"formula.functionList.ENCODEURL.functionParameter.text.name",detail:"formula.functionList.ENCODEURL.functionParameter.text.detail",example:'"https://univer.ai/"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_WEB.FILTERXML,functionType:t.FunctionType.Web,description:"formula.functionList.FILTERXML.description",abstract:"formula.functionList.FILTERXML.abstract",functionParameter:[{name:"formula.functionList.FILTERXML.functionParameter.number1.name",detail:"formula.functionList.FILTERXML.functionParameter.number1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.FILTERXML.functionParameter.number2.name",detail:"formula.functionList.FILTERXML.functionParameter.number2.detail",example:"A1:A20",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_WEB.WEBSERVICE,functionType:t.FunctionType.Web,description:"formula.functionList.WEBSERVICE.description",abstract:"formula.functionList.WEBSERVICE.abstract",functionParameter:[{name:"formula.functionList.WEBSERVICE.functionParameter.number1.name",detail:"formula.functionList.WEBSERVICE.functionParameter.number1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.WEBSERVICE.functionParameter.number2.name",detail:"formula.functionList.WEBSERVICE.functionParameter.number2.detail",example:"A1:A20",require:1,repeat:0}]}],na=[...Qe,...Ke,...Ze,...Je,...ze,...ge,...ta,...$e,...je,...ke,...We,...Xe,...aa,...Ye,...ea];function ia(r,e){let a="";return r.aliasFunctionName?(a=e.t(r.aliasFunctionName),a===r.aliasFunctionName&&(a=r.functionName)):a=r.functionName,a}var ra=Object.getOwnPropertyDescriptor,oa=(r,e,a,n)=>{for(var i=n>1?void 0:n?ra(e,a):e,o=r.length-1,u;o>=0;o--)(u=r[o])&&(i=u(i)||i);return i},Ot=(r,e)=>(a,n)=>e(a,n,r);const at=c.createIdentifier("formula.description-service");P.DescriptionService=class{constructor(e,a,n){F(this,"_descriptions",[]);this._functionService=e,this._localeService=a,this._configService=n,this._initialize()}dispose(){this._localeService.localeChanged$.complete()}getDescriptions(){return this._functionService.getDescriptions()}hasFunction(e){return this._functionService.getDescriptions().get(e.toLocaleUpperCase())!==void 0}getFunctionInfo(e){return this._functionService.getDescriptions().get(e.toLocaleUpperCase())}getSearchListByName(e){const a=[],n=this._functionService.getDescriptions(),i=e.toLocaleUpperCase().trim();return n.forEach(o=>{const{functionName:u,abstract:f,functionType:m}=o;u.toLocaleUpperCase().indexOf(i)>-1&&m!==t.FunctionType.DefinedName&&a.push({name:u,desc:f})}),a}getSearchListByNameFirstLetter(e){const a=[],n=this._functionService.getDescriptions(),i=e.toLocaleUpperCase().trim();return n.forEach(o=>{const{functionName:u,abstract:f,functionType:m}=o;u.toLocaleUpperCase().indexOf(i)===0&&a.push({name:u,desc:f,functionType:m})}),a}getSearchListByType(e){const a=[];return this._functionService.getDescriptions().forEach(i=>{const{functionName:o,functionType:u,abstract:f}=i;(u===e||e===-1)&&u!==t.FunctionType.DefinedName&&a.push({name:o,desc:f})}),a}registerDescriptions(e){return this._descriptions=this._descriptions.concat(e),this._registerDescriptions(),c.toDisposable(()=>{const a=e.map(n=>n.functionName);this.unregisterDescriptions(a)})}unregisterDescriptions(e){this._descriptions=this._descriptions.filter(a=>!e.includes(a.functionName)),this._functionService.unregisterDescriptions(...e)}hasDescription(e){return this._descriptions.some(a=>a.functionName===e)}hasDefinedNameDescription(e){return this._descriptions.some(a=>a.functionName===e&&a.functionType===t.FunctionType.DefinedName)}isFormulaDefinedName(e){const a=this._descriptions.filter(i=>i.functionName===e&&i.functionType===t.FunctionType.DefinedName);if(a.length===0)return!1;const n=a[0].description;return!t.isReferenceStrings(n)}_initialize(){this._localeService.localeChanged$.subscribe(()=>{this._registerDescriptions()}),this._initDescription(),this._registerDescriptions()}_initDescription(){var i;const e=[...t.functionArray,...t.functionCompatibility,...t.functionCube,...t.functionDatabase,...t.functionDate,...t.functionEngineering,...t.functionFinancial,...t.functionInformation,...t.functionLogical,...t.functionLookup,...t.functionMath,...t.functionMeta,...t.functionStatistical,...t.functionText,...t.functionUniver,...t.functionWeb].map(o=>o[1]),a=na.filter(o=>e.includes(o.functionName)),n=this._configService.getConfig($);this._descriptions=a.concat((i=n==null?void 0:n.description)!=null?i:[])}_registerDescriptions(){const e=this._localeService,a=this._descriptions.map(n=>({functionName:ia(n,e),functionType:n.functionType,description:e.t(n.description),abstract:e.t(n.abstract),functionParameter:n.functionParameter.map(i=>({name:e.t(i.name),detail:e.t(i.detail),example:i.example,require:i.require,repeat:i.repeat}))}));this._functionService.registerDescriptions(...a)}},P.DescriptionService=oa([Ot(0,t.IFunctionService),Ot(1,c.Inject(c.LocaleService)),Ot(2,c.IConfigService)],P.DescriptionService);var ua=Object.getOwnPropertyDescriptor,ca=(r,e,a,n)=>{for(var i=n>1?void 0:n?ua(e,a):e,o=r.length-1,u;o>=0;o--)(u=r[o])&&(i=u(i)||i);return i},ct=(r,e)=>(a,n)=>e(a,n,r);let ft=class extends c.Disposable{constructor(e,a,n,i){super();F(this,"_preUnitId",null);this._descriptionService=e,this._definedNamesService=a,this._univerInstanceService=n,this._commandService=i,this._initialize()}_initialize(){this._descriptionListener(),this._changeUnitListener(),this._changeSheetListener()}_descriptionListener(){c.toDisposable(this._definedNamesService.update$.subscribe(()=>{this._registerDescriptions()}))}_changeUnitListener(){c.toDisposable(this._univerInstanceService.getCurrentTypeOfUnit$(c.UniverInstanceType.UNIVER_SHEET).subscribe(()=>{this._unRegisterDescriptions(),this._registerDescriptions()}))}_changeSheetListener(){this.disposeWithMe(this._commandService.onCommandExecuted((e,a)=>{if(!(a!=null&&a.fromCollab)){if(e.id===s.SetWorksheetActiveOperation.id)this._unregisterDescriptionsForNotInSheetId(),this._registerDescriptions();else if(e.id===t.SetDefinedNameMutation.id){const n=e.params;this._registerDescription(n)}else if(e.id===t.RemoveDefinedNameMutation.id){const n=e.params;this._unregisterDescription(n)}}}))}_registerDescription(e){const{unitId:a,sheetId:n}=this._getUnitIdAndSheetId();if(a==null||n==null)return;const{name:i,comment:o,formulaOrRefString:u,localSheetId:f}=e;!this._descriptionService.hasDescription(i)&&(f==null||f===s.SCOPE_WORKBOOK_VALUE_DEFINED_NAME||f===n)&&this._descriptionService.registerDescriptions([{functionName:i,description:u+(o||""),abstract:u,functionType:t.FunctionType.DefinedName,functionParameter:[]}])}_unregisterDescription(e){const{name:a}=e;this._descriptionService.unregisterDescriptions([a])}_unRegisterDescriptions(){if(this._preUnitId==null)return;const e=this._definedNamesService.getDefinedNameMap(this._preUnitId);if(e==null)return;const a=[];Array.from(Object.values(e)).forEach(n=>{const{name:i}=n;a.push(i)}),this._descriptionService.unregisterDescriptions(a),this._preUnitId=null}_getUnitIdAndSheetId(){const e=this._univerInstanceService.getCurrentUnitForType(c.UniverInstanceType.UNIVER_SHEET);if(e==null)return{};const a=e.getActiveSheet();return a==null?{}:{unitId:e.getUnitId(),sheetId:a.getSheetId()}}_registerDescriptions(){const{unitId:e,sheetId:a}=this._getUnitIdAndSheetId();if(e==null||a==null)return;const n=this._definedNamesService.getDefinedNameMap(e);if(!n)return;const i=[];this._preUnitId=e,Array.from(Object.values(n)).forEach(o=>{const{name:u,comment:f,formulaOrRefString:m,localSheetId:l}=o;!this._descriptionService.hasDescription(u)&&(l==null||l===s.SCOPE_WORKBOOK_VALUE_DEFINED_NAME||l===a)&&i.push({functionName:u,description:m+(f||""),abstract:m,functionType:t.FunctionType.DefinedName,functionParameter:[]})}),this._descriptionService.registerDescriptions(i)}_unregisterDescriptionsForNotInSheetId(){const{unitId:e,sheetId:a}=this._getUnitIdAndSheetId();if(e==null||a==null)return;const n=this._definedNamesService.getDefinedNameMap(e);if(!n)return;const i=[];Array.from(Object.values(n)).forEach(o=>{const{name:u,localSheetId:f}=o;f!==s.SCOPE_WORKBOOK_VALUE_DEFINED_NAME&&f!==a&&i.push(u)}),this._descriptionService.unregisterDescriptions(i)}};ft=ca([ct(0,at),ct(1,t.IDefinedNamesService),ct(2,c.IUniverInstanceService),ct(3,c.ICommandService)],ft);var fa=Object.getOwnPropertyDescriptor,ma=(r,e,a,n)=>{for(var i=n>1?void 0:n?fa(e,a):e,o=r.length-1,u;o>=0;o--)(u=r[o])&&(i=u(i)||i);return i},sa=(r,e)=>(a,n)=>e(a,n,r);let mt=class extends c.Disposable{constructor(r){super(),this._commandService=r,[yt,xt,t.OtherFormulaMarkDirty].forEach(e=>this._commandService.registerCommand(e))}};mt=ma([sa(0,c.ICommandService)],mt);var la=Object.getOwnPropertyDescriptor,pa=(r,e,a,n)=>{for(var i=n>1?void 0:n?la(e,a):e,o=r.length-1,u;o>=0;o--)(u=r[o])&&(i=u(i)||i);return i},st=(r,e)=>(a,n)=>e(a,n,r);let lt=class extends c.Disposable{constructor(e,a,n,i){super();F(this,"_preUnitId",null);this._descriptionService=e,this._univerInstanceService=a,this._commandService=n,this._superTableService=i,this._initialize()}_initialize(){this._descriptionListener(),this._changeUnitListener(),this._changeSheetListener()}_descriptionListener(){c.toDisposable(this._superTableService.update$.subscribe(()=>{this._registerDescriptions()}))}_changeUnitListener(){c.toDisposable(this._univerInstanceService.getCurrentTypeOfUnit$(c.UniverInstanceType.UNIVER_SHEET).subscribe(()=>{this._unRegisterDescriptions(),this._registerDescriptions()}))}_changeSheetListener(){this.disposeWithMe(this._commandService.onCommandExecuted((e,a)=>{if(!(a!=null&&a.fromCollab)){if(e.id===s.SetWorksheetActiveOperation.id)this._unregisterDescriptionsForNotInSheetId(),this._registerDescriptions();else if(e.id===t.SetSuperTableMutation.id){const n=e.params;this._registerDescription(n)}else if(e.id===t.RemoveSuperTableMutation.id){const n=e.params;this._unregisterDescription(n)}}}))}_registerDescription(e){var u,f;const{unitId:a,sheetId:n}=this._getUnitIdAndSheetId();if(a==null||n==null)return;const{tableName:i,reference:o}=e;if(!this._descriptionService.hasDescription(i)){const m=((f=(u=this._univerInstanceService.getUnit(a))==null?void 0:u.getSheetBySheetId(o.sheetId))==null?void 0:f.getName())||"",l=t.serializeRangeWithSheet(m,o.range);this._descriptionService.registerDescriptions([{functionName:i,description:l,abstract:l,functionType:t.FunctionType.Table,functionParameter:[]}])}}_unregisterDescription(e){const{tableName:a}=e;this._descriptionService.unregisterDescriptions([a])}_unRegisterDescriptions(){if(this._preUnitId==null)return;const e=this._superTableService.getTableMap(this._preUnitId);if(e==null)return;const a=[];e.forEach((n,i)=>{a.push(i)}),this._descriptionService.unregisterDescriptions(a),this._preUnitId=null}_getUnitIdAndSheetId(){const e=this._univerInstanceService.getCurrentUnitForType(c.UniverInstanceType.UNIVER_SHEET);if(e==null)return{};const a=e.getActiveSheet();return a==null?{}:{unitId:e.getUnitId(),sheetId:a.getSheetId()}}_registerDescriptions(){const{unitId:e,sheetId:a}=this._getUnitIdAndSheetId();if(e==null||a==null)return;const n=this._superTableService.getTableMap(e);if(!n)return;const i=[];this._preUnitId=e,n.forEach((o,u)=>{var l,p;const f=((p=(l=this._univerInstanceService.getUnit(e))==null?void 0:l.getSheetBySheetId(o.sheetId))==null?void 0:p.getName())||"",m=t.serializeRangeWithSheet(f,o.range);this._descriptionService.hasDescription(u)||i.push({functionName:u,description:m,abstract:m,functionType:t.FunctionType.Table,functionParameter:[]})}),this._descriptionService.registerDescriptions(i)}_unregisterDescriptionsForNotInSheetId(){const{unitId:e,sheetId:a}=this._getUnitIdAndSheetId();if(e==null||a==null)return;const n=this._superTableService.getTableMap(e);if(!n)return;const i=[];n.forEach((o,u)=>{i.push(u)}),this._descriptionService.unregisterDescriptions(i)}};lt=pa([st(0,at),st(1,c.IUniverInstanceService),st(2,c.ICommandService),st(3,t.ISuperTableService)],lt);var da=Object.getOwnPropertyDescriptor,La=(r,e,a,n)=>{for(var i=n>1?void 0:n?da(e,a):e,o=r.length-1,u;o>=0;o--)(u=r[o])&&(i=u(i)||i);return i},pt=(r,e)=>(a,n)=>e(a,n,r);function Ht(r,e,a,n){const i=r.sequenceNodesBuilder(e);if(i==null)return e;const o=[];for(let u=0,f=i.length;u<f;u++){const m=i[u];if(typeof m=="string"||m.nodeType!==t.sequenceNodeType.REFERENCE)continue;const{token:l}=m,p=t.deserializeRangeWithSheetWithCache(l),{sheetName:L,unitId:N}=p;let T=p.range;T.startAbsoluteRefType===c.AbsoluteRefType.ALL&&T.endAbsoluteRefType===c.AbsoluteRefType.ALL||(T=c.moveRangeByOffset(T,a,n),o.push({unitId:N,sheetName:L,range:T}))}return o.map(u=>`${u.unitId}!${u.sheetName}!${u.range.startRow}!${u.range.endRow}!${u.range.startColumn}!${u.range.endColumn}`).join("|")}P.FormulaRefRangeService=class extends c.Disposable{constructor(e,a,n,i){super(),this._refRangeService=e,this._lexerTreeBuilder=a,this._univerInstanceService=n,this._injector=i}transformFormulaByEffectCommand(e,a,n,i){const o=this._lexerTreeBuilder.sequenceNodesBuilder(n),u=this._univerInstanceService.getCurrentUnitForType(c.UniverInstanceType.UNIVER_SHEET),f=u.getActiveSheet(),m=u.getUnitId(),l=f.getSheetId(),p=o==null?void 0:o.map(L=>{if(typeof L=="object"&&L.nodeType===t.sequenceNodeType.REFERENCE){const N=t.deserializeRangeWithSheetWithCache(L.token),{range:T,unitId:S,sheetName:R}=N,C=this._univerInstanceService.getUnit(S||e),d=R?C==null?void 0:C.getSheetBySheetName(R):C==null?void 0:C.getSheetBySheetId(a);if(!d)throw new Error("Sheet not found");const A=C.getUnitId(),E=d.getSheetId();if(A!==m||E!==l)return L;const I=s.handleDefaultRangeChangeWithEffectRefCommands(T,i);let O="";if(I){const D=I.startColumn-T.startColumn,U=I.startRow-T.startRow,_=c.moveRangeByOffset(T,D,U);S&&R?O=t.serializeRangeWithSpreadsheet(S,R,_):R?O=t.serializeRangeWithSheet(R,_):O=t.serializeRange(_)}else O=t.ErrorType.REF;return{...L,token:O}}else return L});return p?`=${t.generateStringWithSequence(p)}`:""}registerFormula(e,a,n,i){const o=new Map,u=this._lexerTreeBuilder.sequenceNodesBuilder(n),f=new c.DisposableCollection,m=l=>{const p=this._univerInstanceService.getCurrentUnitForType(c.UniverInstanceType.UNIVER_SHEET),L=p.getActiveSheet(),N=p.getUnitId(),T=L.getSheetId(),S=u==null?void 0:u.map(C=>{if(typeof C=="object"&&C.nodeType===t.sequenceNodeType.REFERENCE){const d=o.get(C.token);if(d.unitId!==N||d.subUnitId!==T)return C;const A=s.handleDefaultRangeChangeWithEffectRefCommands(d.range,l);let E="";if(A){const I=A.startColumn-d.range.startColumn,O=A.startRow-d.range.startRow,D=c.moveRangeByOffset(d.range,I,O);d.unitId&&d.sheetName?E=t.serializeRangeWithSpreadsheet(d.unitId,d.sheetName,D):d.sheetName?E=t.serializeRangeWithSheet(d.sheetName,D):E=t.serializeRange(D)}else E=t.ErrorType.REF;return{...C,token:E}}else return C}),R=S&&t.generateStringWithSequence(S);return i(`=${R}`)};return u==null||u.forEach(l=>{if(typeof l=="object"&&l.nodeType===t.sequenceNodeType.REFERENCE){const p=t.deserializeRangeWithSheetWithCache(l.token),{range:L,unitId:N,sheetName:T}=p,S=this._univerInstanceService.getUnit(N||e),R=T?S==null?void 0:S.getSheetBySheetName(T):S==null?void 0:S.getSheetBySheetId(a);if(!R)return;const C=S.getUnitId(),d=R.getSheetId(),A={unitId:C,subUnitId:d,range:L,sheetName:T};o.set(l.token,A),f.add(this._refRangeService.registerRefRange(L,m,C,d))}}),f}_getFormulaDependcy(e,a,n,i){const o=c.isFormulaString(n)?this._lexerTreeBuilder.sequenceNodesBuilder(n):null,u=[];return o==null||o.forEach(f=>{if(typeof f=="object"&&f.nodeType===t.sequenceNodeType.REFERENCE){const m=t.deserializeRangeWithSheetWithCache(f.token),{range:l,unitId:p,sheetName:L}=m;if(l.startAbsoluteRefType===c.AbsoluteRefType.ALL&&l.endAbsoluteRefType===c.AbsoluteRefType.ALL)return;const N=this._univerInstanceService.getUnit(p||e),T=L?N==null?void 0:N.getSheetBySheetName(L):N==null?void 0:N.getSheetBySheetId(a);if(!T)return;const S=N.getUnitId(),R=T.getSheetId(),C=i[0].startRow,d=i[0].startColumn,A=l.startRow,E=l.startColumn,I=i.map(O=>({startRow:O.startRow-C+A,endRow:O.endRow-C+A,startColumn:O.startColumn-d+E,endColumn:O.endColumn-d+E}));u.push({unitId:S,subUnitId:R,ranges:I})}}),u}registerRangeFormula(e,a,n,i,o){const u=new c.DisposableCollection,f=i.map(l=>this._getFormulaDependcy(e,a,l,n)),m=l=>{const p=n[0].startRow,L=n[0].startColumn,N=[{unitId:e,subUnitId:a,ranges:n},...f.flat()],T=[],S=s.getSeparateEffectedRangesOnCommand(this._injector,l);for(const{unitId:R,subUnitId:C,ranges:d}of N)if(R===S.unitId&&C===S.subUnitId){const A=[],E=d[0].startRow,I=d[0].startColumn,O=E-p,D=I-L;for(const U of S.ranges){const _=d.map(x=>c.getIntersectRange(U,x)).filter(Boolean);_.length>0&&A.push(..._)}A.length>0&&T.push(A.map(U=>({startRow:U.startRow-O,endRow:U.endRow-O,startColumn:U.startColumn-D,endColumn:U.endColumn-D})))}if(T.length>0){const R=c.Rectangle.splitIntoGrid([...T.flat()]),C=c.Rectangle.subtractMulti(n,R);C.sort((O,D)=>O.startRow-D.startRow||O.startColumn-D.startColumn);const d=new Map;for(let O=0;O<R.length;O++){const D=R[O],U=D.startRow,_=D.startColumn,x=U-p,y=_-L,q=s.handleCommonDefaultRangeChangeWithEffectRefCommands(D,l).sort((V,H)=>V.startRow-H.startRow||V.startColumn-H.startColumn);if(!q.length)continue;const h=q[0].startRow,M=q[0].startColumn,B=h-p,K=M-L,k=[];for(let V=0;V<i.length;V++){const H=i[V],w=c.isFormulaString(H),Nt=w?this._lexerTreeBuilder.moveFormulaRefOffset(H,y,x):H,G=w?this.transformFormulaByEffectCommand(e,a,Nt,l):Nt,Dt=Ht(this._lexerTreeBuilder,G,-K,-B);k.push({newFormula:G,orginFormula:Dt})}const Q={formulas:k,ranges:q,key:k.map(V=>V.orginFormula).join("_")};d.has(Q.key)?d.get(Q.key).push(Q):d.set(Q.key,[Q])}const A=i.map(O=>Ht(this._lexerTreeBuilder,O,0,0)).join("_");if(C.length>0){const O=C[0].startRow,D=C[0].startColumn,U=[];for(let x=0;x<i.length;x++){const y=i[x];U.push({newFormula:c.isFormulaString(y)?this._lexerTreeBuilder.moveFormulaRefOffset(y,D-L,O-p):y,orginFormula:y})}const _={formulas:U,ranges:C,key:A};d.has(_.key)?d.get(_.key).push(_):d.set(_.key,[_])}const E=[],I=Array.from(d.keys());for(let O=I.length-1;O>=0;O--){const D=I[O],U=d.get(D).sort((y,q)=>y.ranges[0].startRow-q.ranges[0].startRow||y.ranges[0].startColumn-q.ranges[0].startColumn),_=[];for(let y=0;y<U[0].formulas.length;y++)_.push(U[0].formulas[y].newFormula);const x=c.Rectangle.mergeRanges(U.map(y=>y.ranges).flat());x.sort((y,q)=>y.startRow-q.startRow||y.startColumn-q.startColumn),E.push({formulas:_,ranges:x})}return o(E)}return{undos:[],redos:[]}};return n.forEach(l=>{const p=this._refRangeService.registerRefRange(l,m,e,a);u.add(p)}),[...f.flat()].forEach(({unitId:l,subUnitId:p,ranges:L})=>{L.forEach(N=>{const T=this._refRangeService.registerRefRange(N,m,l,p);u.add(T)})}),u}},P.FormulaRefRangeService=La([pt(0,c.Inject(s.RefRangeService)),pt(1,c.Inject(t.LexerTreeBuilder)),pt(2,c.IUniverInstanceService),pt(3,c.Inject(c.Injector))],P.FormulaRefRangeService);var Ta=Object.getOwnPropertyDescriptor,Na=(r,e,a,n)=>{for(var i=n>1?void 0:n?Ta(e,a):e,o=r.length-1,u;o>=0;o--)(u=r[o])&&(i=u(i)||i);return i},Pa=(r,e)=>(a,n)=>e(a,n,r);const Mt="sheets-formula.remote-register-function.service",_t=c.createIdentifier(Mt);P.RemoteRegisterFunctionService=class{constructor(e){this._functionService=e}async registerFunctions(e){const a=e.map(([n,i])=>Ea(n,i));this._functionService.registerExecutors(...a)}async registerAsyncFunctions(e){const a=e.map(([n,i])=>Ia(n,i));this._functionService.registerExecutors(...a)}async unregisterFunctions(e){this._functionService.unregisterExecutors(...e),this._functionService.unregisterDescriptions(...e),this._functionService.deleteFormulaAstCacheKey(...e)}},P.RemoteRegisterFunctionService=Na([Pa(0,t.IFunctionService)],P.RemoteRegisterFunctionService);function Ea(r,e){const a=new t.CustomFunction(e),n=new Function(`return ${r}`)();return a.calculateCustom=n,a}function Ia(r,e){const a=new t.AsyncCustomFunction(e),n=new Function(`return ${r}`)();return a.calculateCustom=n,a}var Aa=Object.getOwnPropertyDescriptor,Sa=(r,e,a,n)=>{for(var i=n>1?void 0:n?Aa(e,a):e,o=r.length-1,u;o>=0;o--)(u=r[o])&&(i=u(i)||i);return i},dt=(r,e)=>(a,n)=>e(a,n,r);const wt=c.createIdentifier("sheets-formula.register-function-service");P.RegisterFunctionService=class extends c.Disposable{constructor(e,a,n,i){super(),this._localeService=e,this._descriptionService=a,this._functionService=n,this._remoteRegisterFunctionService=i}registerFunction(e){return this._registerSingleFunction(e)}registerAsyncFunction(e){return this._registerSingleFunction({...e,async:!0})}registerFunctions(e){const{locales:a,description:n,calculate:i}=e;a&&this._localeService.load(a);const o=new c.DisposableCollection;if(n)o.add(this._descriptionService.registerDescriptions(n));else{const u=i.map(([f,m,l])=>({functionName:m,functionType:t.FunctionType.User,description:"",abstract:l||"",functionParameter:[]}));o.add(this._functionService.registerDescriptions(...u))}return o.add(this._registerLocalExecutors(i)),this._remoteRegisterFunctionService&&o.add(this._registerRemoteExecutors(i)),o}_registerSingleFunction(e){const{name:a,func:n,description:i,locales:o,async:u=!1}=e,f=new c.DisposableCollection;if(o&&this._localeService.load(o),typeof i=="string"){const l={functionName:a,functionType:t.FunctionType.User,description:i,abstract:i||"",functionParameter:[]};f.add(this._descriptionService.registerDescriptions([l]))}else f.add(this._descriptionService.registerDescriptions([i]));const m=u?new t.AsyncCustomFunction(a):new t.CustomFunction(a);return m.calculateCustom=n,this._functionService.registerExecutors(m),f.add(c.toDisposable(()=>this._functionService.unregisterExecutors(a))),f.add(c.toDisposable(()=>this._functionService.unregisterDescriptions(a))),f.add(c.toDisposable(()=>this._functionService.deleteFormulaAstCacheKey(a))),this._remoteRegisterFunctionService&&(this._remoteRegisterFunctionService.registerAsyncFunctions([[n.toString(),a]]),f.add(c.toDisposable(()=>this._remoteRegisterFunctionService.unregisterFunctions([a])))),f}_registerLocalExecutors(e){const a=e.map(([i,o])=>o),n=e.map(([i,o])=>{const u=new t.CustomFunction(o);return u.calculateCustom=i,u});return this._functionService.registerExecutors(...n),c.toDisposable(()=>this._functionService.unregisterExecutors(...a))}_registerRemoteExecutors(e){const a=[],n=e.map(([i,o])=>(a.push(o),[i.toString(),o]));return this._remoteRegisterFunctionService.registerFunctions(n),c.toDisposable(()=>this._remoteRegisterFunctionService.unregisterFunctions(a))}},P.RegisterFunctionService=Sa([dt(0,c.Inject(c.LocaleService)),dt(1,c.Inject(at)),dt(2,t.IFunctionService),dt(3,c.Optional(_t))],P.RegisterFunctionService);var Ca=Object.defineProperty,Ra=Object.getOwnPropertyDescriptor,Oa=(r,e,a)=>e in r?Ca(r,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):r[e]=a,Yt=(r,e,a,n)=>{for(var i=n>1?void 0:n?Ra(e,a):e,o=r.length-1,u;o>=0;o--)(u=r[o])&&(i=u(i)||i);return i},Lt=(r,e)=>(a,n)=>e(a,n,r),Tt=(r,e,a)=>Oa(r,typeof e!="symbol"?e+"":e,a);P.UniverRemoteSheetsFormulaPlugin=class extends c.Plugin{constructor(e=qt,a,n){super(),this._config=e,this._injector=a,this._configService=n;const{...i}=c.merge({},qt,this._config);this._configService.setConfig(Xt,i)}onStarting(){this._injector.add([P.RemoteRegisterFunctionService]),this._injector.get(it.IRPCChannelService).registerChannel(Mt,it.fromModule(this._injector.get(P.RemoteRegisterFunctionService)))}},Tt(P.UniverRemoteSheetsFormulaPlugin,"pluginName","SHEET_FORMULA_REMOTE_PLUGIN"),Tt(P.UniverRemoteSheetsFormulaPlugin,"type",c.UniverInstanceType.UNIVER_SHEET),P.UniverRemoteSheetsFormulaPlugin=Yt([c.DependentOn(t.UniverFormulaEnginePlugin),Lt(1,c.Inject(c.Injector)),Lt(2,c.IConfigService)],P.UniverRemoteSheetsFormulaPlugin),P.UniverSheetsFormulaPlugin=class extends c.Plugin{constructor(e=Ut,a,n){super(),this._config=e,this._injector=a,this._configService=n;const{...i}=c.merge({},Ut,this._config);this._configService.setConfig($,i,{merge:!0})}onStarting(){const e=this._injector,a=[[wt,{useClass:P.RegisterFunctionService}],[at,{useClass:P.DescriptionService}],[mt],[P.FormulaRefRangeService],[ut],[P.ImageFormulaCellInterceptorController],[P.TriggerCalculationController],[P.UpdateFormulaController],[ot],[ft],[P.UpdateDefinedNameController],[lt]];if(this._config.notExecuteFormula){const n=e.get(it.IRPCChannelService);a.push([_t,{useFactory:()=>it.toModule(n.requestChannel(Mt))}])}a.forEach(n=>e.add(n))}onReady(){c.touchDependencies(this._injector,[[mt],[ot],[ut],[P.ImageFormulaCellInterceptorController],[P.UpdateFormulaController],[P.UpdateDefinedNameController]]),c.isNodeEnv()&&c.touchDependencies(this._injector,[[P.TriggerCalculationController]])}onRendered(){c.touchDependencies(this._injector,[[ft],[lt]]),c.isNodeEnv()||c.touchDependencies(this._injector,[[P.TriggerCalculationController]])}},Tt(P.UniverSheetsFormulaPlugin,"pluginName",ve),Tt(P.UniverSheetsFormulaPlugin,"type",c.UniverInstanceType.UNIVER_SHEET),P.UniverSheetsFormulaPlugin=Yt([c.DependentOn(s.UniverSheetsPlugin),Lt(1,c.Inject(c.Injector)),Lt(2,c.IConfigService)],P.UniverSheetsFormulaPlugin);function Ma(r,e,a,n){const i=r.get(t.IFormulaCurrentConfigService),o=r.get(t.Lexer),u=r.get(t.AstTreeBuilder),f=r.get(t.Interpreter);i.load({formulaData:{},arrayFormulaCellData:{},arrayFormulaRange:{},forceCalculate:!1,dirtyRanges:[],dirtyNameMap:{},dirtyDefinedNameMap:{},dirtyUnitFeatureMap:{},excludedCell:{},allUnitData:{[a]:n},dirtyUnitOtherFormulaMap:{}});const m=o.treeBuilder(e),l=u.parse(m),p=f.execute(t.generateExecuteAstNodeData(l));return t.getObjectValue(p)}P.CalculationMode=Y,P.IDescriptionService=at,P.IRegisterFunctionService=wt,P.IRemoteRegisterFunctionService=_t,P.InsertFunctionCommand=yt,P.PLUGIN_CONFIG_KEY_BASE=$,P.QuickSumCommand=xt,P.calculateFormula=Ma,Object.defineProperty(P,Symbol.toStringTag,{value:"Module"})}));
|
|
48
|
+
(function(P,c){typeof exports=="object"&&typeof module<"u"?c(exports,require("@univerjs/core"),require("@univerjs/sheets"),require("@univerjs/engine-formula"),require("rxjs"),require("@univerjs/rpc")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets","@univerjs/engine-formula","rxjs","@univerjs/rpc"],c):(P=typeof globalThis<"u"?globalThis:P||self,c(P.UniverSheetsFormula={},P.UniverCore,P.UniverSheets,P.UniverEngineFormula,P.rxjs,P.UniverRpc))})(this,(function(P,c,s,t,bt,it){"use strict";var _a=Object.defineProperty;var Da=(P,c,s)=>c in P?_a(P,c,{enumerable:!0,configurable:!0,writable:!0,value:s}):P[c]=s;var F=(P,c,s)=>Da(P,typeof c!="symbol"?c+"":c,s);const yt={id:"formula.command.insert-function",type:c.CommandType.COMMAND,handler:async(r,e)=>{const{list:a,listOfRangeHasNumber:n}=e,i=r.get(c.ICommandService),o=new c.ObjectMatrix;a.forEach(f=>{const{range:m,primary:l,formula:p}=f,{row:L,column:N}=l,T=c.generateRandomId(6);o.setValue(L,N,{f:p,si:T});const{startRow:S,startColumn:R,endRow:C,endColumn:d}=m;for(let A=S;A<=C;A++)for(let E=R;E<=d;E++)(A!==L||E!==N)&&o.setValue(A,E,{si:T})}),n&&n.length>0&&n.forEach(f=>{const{primary:m,formula:l}=f;o.setValue(m.row,m.column,{f:l})});const u={value:o.getData()};return i.executeCommand(s.SetRangeValuesCommand.id,u)}},xt={id:"sheets-formula.command.quick-sum",type:c.CommandType.COMMAND,handler:async r=>{const a=r.get(s.SheetsSelectionsService).getCurrentLastSelection();if(!a)return!1;const n=r.get(c.IUniverInstanceService),i=s.getSheetCommandTarget(n);if(!i)return!1;const o=a.range,{worksheet:u}=i;let f=s.findFirstNonEmptyCell(o,u);if(!f)return!1;f=s.alignToMergedCellsBorders(f,u);const m=s.expandToContinuousRange({startRow:f.startRow,startColumn:f.startColumn,endRow:o.endRow,endColumn:o.endColumn},{left:!0,right:!0,up:!0,down:!0},u),l=new c.ObjectMatrix,p=s.alignToMergedCellsBorders({startRow:m.endRow,endRow:m.endRow,startColumn:m.startColumn,endColumn:m.endColumn},u);if(!c.Rectangle.equals(p,m))for(const T of u.iterateByColumn(p))(!T.value||!u.cellHasValue(T.value))&&l.setValue(T.row,T.col,{f:`=SUM(${t.serializeRange({startColumn:T.col,endColumn:T.col,startRow:m.startRow,endRow:T.row-1})})`});const L=s.alignToMergedCellsBorders({startRow:m.startRow,startColumn:m.endColumn,endRow:m.endRow,endColumn:m.endColumn},u);if(!c.Rectangle.equals(L,m))for(const T of u.iterateByRow(L))(!T.value||!u.cellHasValue(T.value))&&l.setValue(T.row,T.col,{f:`=SUM(${t.serializeRange({startColumn:m.startColumn,endColumn:T.col-1,startRow:T.row,endRow:T.row})})`});const N=r.get(c.ICommandService);return(await c.sequenceExecuteAsync([{id:s.SetRangeValuesCommand.id,params:{range:m,value:l.getMatrix()}},{id:s.SetSelectionsOperation.id,params:{unitId:i.unitId,subUnitId:i.subUnitId,selections:[{range:m,primary:c.Rectangle.contains(m,a.primary)?a.primary:{...f,actualRow:f.startRow,actualColumn:f.startColumn},style:null}]}}],N)).result}},$="sheets-formula.base.config";var Y=(r=>(r[r.FORCED=0]="FORCED",r[r.WHEN_EMPTY=1]="WHEN_EMPTY",r[r.NO_CALCULATION=2]="NO_CALCULATION",r))(Y||{});const Ut={},Xt="sheets-formula.remote.config",qt={};var Wt=Object.getOwnPropertyDescriptor,gt=(r,e,a,n)=>{for(var i=n>1?void 0:n?Wt(e,a):e,o=r.length-1,u;o>=0;o--)(u=r[o])&&(i=u(i)||i);return i},Et=(r,e)=>(a,n)=>e(a,n,r);P.ImageFormulaCellInterceptorController=class extends c.Disposable{constructor(a,n,i){super();F(this,"_errorValueCell",{v:t.ErrorType.VALUE,t:c.CellValueType.STRING});F(this,"_refreshRender");this._commandService=a,this._sheetInterceptorService=n,this._formulaDataModel=i,this._initialize()}_initialize(){this._commandExecutedListener(),this._initInterceptorCellContent()}_commandExecutedListener(){this.disposeWithMe(this._commandService.onCommandExecuted(async a=>{if(a.id===t.SetImageFormulaDataMutation.id){const n=a.params;if(!n)return;const{imageFormulaData:i}=n;if(!i||i.length===0)return;const o=await Promise.all(i.map(f=>this._getImageNatureSize(f))),u={};o.forEach(f=>{const{unitId:m,sheetId:l,row:p,column:L,...N}=f;u[m]||(u[m]={}),u[m][l]||(u[m][l]=new c.ObjectMatrix),u[m][l].setValue(p,L,N)}),this._formulaDataModel.mergeUnitImageFormulaData(u),this._refreshRender()}}))}_initInterceptorCellContent(){this.disposeWithMe(this._sheetInterceptorService.intercept(s.INTERCEPTOR_POINT.CELL_CONTENT,{priority:s.InterceptCellContentPriority.CELL_IMAGE,effect:c.InterceptorEffectEnum.Value|c.InterceptorEffectEnum.Style,handler:(a,n,i)=>{var D,U;const{unitId:o,subUnitId:u,row:f,col:m}=n,l=this._formulaDataModel.getUnitImageFormulaData(),p=(U=(D=l==null?void 0:l[o])==null?void 0:D[u])==null?void 0:U.getValue(f,m);if(!p)return i(a);const{source:L,height:N,width:T,isErrorImage:S,imageNaturalWidth:R,imageNaturalHeight:C}=p;if(S)return i(this._errorValueCell);const d=T||R,A=N||C,E=c.createDocumentModelWithStyle("",{}),I={unitId:o,subUnitId:u,drawingId:c.generateRandomId(),drawingType:c.DrawingTypeEnum.DRAWING_IMAGE,imageSourceType:c.ImageSourceType.URL,source:L,transform:{left:0,top:0,width:d,height:A},docTransform:{size:{width:d,height:A},positionH:{relativeFrom:c.ObjectRelativeFromH.PAGE,posOffset:0},positionV:{relativeFrom:c.ObjectRelativeFromV.PARAGRAPH,posOffset:0},angle:0},behindDoc:c.BooleanNumber.FALSE,title:"",description:"",layoutType:c.PositionedObjectLayoutType.INLINE,wrapText:c.WrapTextType.BOTH_SIDES,distB:0,distL:0,distR:0,distT:0},O=c.BuildTextUtils.drawing.add({documentDataModel:E,drawings:[I],selection:{collapsed:!0,startOffset:0,endOffset:0}});return O?(E.apply(O),i({...a,p:E.getSnapshot()})):i(this._errorValueCell)}}))}async _getImageNatureSize(a){const n=await this._getImageSize(a.source);return n.image?{...a,isErrorImage:!1,imageNaturalHeight:n.height,imageNaturalWidth:n.width}:{...a,isErrorImage:!0}}async _getImageSize(a){return new Promise(n=>{const i=new Image;i.src=a,i.onload=()=>{n({width:i.width,height:i.height,image:i})},i.onerror=()=>{n({width:0,height:0,image:null})}})}registerRefreshRenderFunction(a){this._refreshRender=a}},P.ImageFormulaCellInterceptorController=gt([Et(0,c.ICommandService),Et(1,c.Inject(s.SheetInterceptorService)),Et(2,c.Inject(t.FormulaDataModel))],P.ImageFormulaCellInterceptorController);var Kt=Object.getOwnPropertyDescriptor,kt=(r,e,a,n)=>{for(var i=n>1?void 0:n?Kt(e,a):e,o=r.length-1,u;o>=0;o--)(u=r[o])&&(i=u(i)||i);return i},W=(r,e)=>(a,n)=>e(a,n,r);const ht={done:0,count:0},It={onlyLocal:!0};P.TriggerCalculationController=class extends c.Disposable{constructor(a,n,i,o,u,f,m){super();F(this,"_waitingCommandQueue",[]);F(this,"_executingDirtyData",{forceCalculation:!1,dirtyRanges:[],dirtyNameMap:{},dirtyDefinedNameMap:{},dirtyUnitFeatureMap:{},dirtyUnitOtherFormulaMap:{},clearDependencyTreeCache:{}});F(this,"_setTimeoutKey",-1);F(this,"_startExecutionTime",0);F(this,"_totalCalculationTaskCount",0);F(this,"_doneCalculationTaskCount",0);F(this,"_executionInProgressParams",null);F(this,"_restartCalculation",!1);F(this,"_progress$",new bt.BehaviorSubject(ht));F(this,"progress$",this._progress$.asObservable());this._commandService=a,this._activeDirtyManagerService=n,this._logService=i,this._configService=o,this._formulaDataModel=u,this._localeService=f,this._registerOtherFormulaService=m,this._commandExecutedListener(),this._initialExecuteFormulaProcessListener(),this._initialExecuteFormula()}_emitProgress(a){this._progress$.next({done:this._doneCalculationTaskCount,count:this._totalCalculationTaskCount,label:a})}_startProgress(){this._doneCalculationTaskCount=0,this._totalCalculationTaskCount=1;const a=this._localeService.t("formula.progress.analyzing");this._emitProgress(a)}_calculateProgress(a){if(this._executionInProgressParams){const{totalFormulasToCalculate:n,completedFormulasCount:i,totalArrayFormulasToCalculate:o,completedArrayFormulasCount:u}=this._executionInProgressParams;if(this._doneCalculationTaskCount=i+u,this._totalCalculationTaskCount=n+o,this._totalCalculationTaskCount===0)return;this._emitProgress(a)}}_completeProgress(){this._doneCalculationTaskCount=this._totalCalculationTaskCount=1;const a=this._localeService.t("formula.progress.done");this._emitProgress(a)}clearProgress(){this._doneCalculationTaskCount=0,this._totalCalculationTaskCount=0,this._emitProgress()}dispose(){super.dispose(),this._progress$.next(ht),this._progress$.complete(),clearTimeout(this._setTimeoutKey)}_getCalculationMode(){var n;const a=this._configService.getConfig($);return(n=a==null?void 0:a.initialFormulaComputing)!=null?n:Y.WHEN_EMPTY}_commandExecutedListener(){this.disposeWithMe(this._commandService.beforeCommandExecuted(a=>{if(a.id===t.SetFormulaCalculationStartMutation.id||a.id===t.SetFormulaStringBatchCalculationMutation.id){const n=a.params;if(a.id===t.SetFormulaCalculationStartMutation.id){const i=this._configService.getConfig(t.ENGINE_FORMULA_RETURN_DEPENDENCY_TREE)||!1;n.isCalculateTreeModel=i}n.maxIteration=this._configService.getConfig(t.ENGINE_FORMULA_CYCLE_REFERENCE_COUNT),n.rowData=this._formulaDataModel.getHiddenRowsFiltered()}})),this.disposeWithMe(this._commandService.onCommandExecuted((a,n)=>{if(this._activeDirtyManagerService.get(a.id)){if(a.id===s.SetRangeValuesMutation.id){const i=a.params;if(n&&n.onlyLocal===!0||i.trigger===s.SetStyleCommand.id||i.trigger===s.SetBorderCommand.id||i.trigger===s.ClearSelectionFormatCommand.id)return}this._waitingCommandQueue.push(a),clearTimeout(this._setTimeoutKey),this._setTimeoutKey=setTimeout(()=>{const i=this._generateDirty(this._waitingCommandQueue);this._executingDirtyData=this._mergeDirty(this._executingDirtyData,i),this._executionInProgressParams==null?this._commandService.executeCommand(t.SetFormulaCalculationStartMutation.id,{...this._executingDirtyData},It):(this._restartCalculation=!0,this._commandService.executeCommand(t.SetFormulaCalculationStopMutation.id,{})),this._waitingCommandQueue=[]},100)}}))}_generateDirty(a){const n=[],i={},o={},u={},f={},m={};let l=!1;for(const p of a){const L=this._activeDirtyManagerService.get(p.id);if(L==null)continue;const N=L.getDirtyData(p),{dirtyRanges:T,dirtyNameMap:S,dirtyDefinedNameMap:R,dirtyUnitFeatureMap:C,dirtyUnitOtherFormulaMap:d,clearDependencyTreeCache:A,forceCalculation:E=!1}=N;T!=null&&this._mergeDirtyRanges(n,T),S!=null&&this._mergeDirtyNameMap(i,S),R!=null&&this._mergeDirtyNameMap(o,R),C!=null&&this._mergeDirtyUnitFeatureOrOtherFormulaMap(u,C),d!=null&&this._mergeDirtyUnitFeatureOrOtherFormulaMap(f,d),A!=null&&this._mergeDirtyNameMap(m,A),l=l||E}return{dirtyRanges:n,dirtyNameMap:i,dirtyDefinedNameMap:o,dirtyUnitFeatureMap:u,dirtyUnitOtherFormulaMap:f,forceCalculation:l,clearDependencyTreeCache:m}}_mergeDirty(a,n){const i=[...a.dirtyRanges,...n.dirtyRanges],o={...a.dirtyNameMap},u={...a.dirtyDefinedNameMap},f={...a.dirtyUnitFeatureMap},m={...a.dirtyUnitOtherFormulaMap},l={...a.clearDependencyTreeCache};this._mergeDirtyNameMap(o,n.dirtyNameMap),this._mergeDirtyNameMap(u,n.dirtyDefinedNameMap),this._mergeDirtyUnitFeatureOrOtherFormulaMap(f,n.dirtyUnitFeatureMap),this._mergeDirtyUnitFeatureOrOtherFormulaMap(m,n.dirtyUnitOtherFormulaMap),this._mergeDirtyNameMap(l,n.clearDependencyTreeCache);const p=a.forceCalculation||n.forceCalculation;return{dirtyRanges:i,dirtyNameMap:o,dirtyDefinedNameMap:u,dirtyUnitFeatureMap:f,dirtyUnitOtherFormulaMap:m,forceCalculation:p,clearDependencyTreeCache:l}}_mergeDirtyRanges(a,n){for(const i of n){let o=!1;for(const u of a)if(i.unitId===u.unitId&&i.sheetId===u.sheetId){const{startRow:f,startColumn:m,endRow:l,endColumn:p}=i.range,{startRow:L,startColumn:N,endRow:T,endColumn:S}=u.range;if(f===L&&m===N&&l===T&&p===S){o=!0;break}}o||a.push(i)}}_mergeDirtyNameMap(a,n){Object.keys(n).forEach(i=>{a[i]==null&&(a[i]={}),Object.keys(n[i]).forEach(o=>{var u;(u=n[i])!=null&&u[o]&&(a[i][o]=n[i][o])})})}_mergeDirtyUnitFeatureOrOtherFormulaMap(a,n){Object.keys(n).forEach(i=>{a[i]==null&&(a[i]={}),Object.keys(n[i]).forEach(o=>{a[i][o]==null&&(a[i][o]={}),Object.keys(n[i][o]).forEach(u=>{a[i][o][u]=n[i][o][u]||!1})})})}_initialExecuteFormulaProcessListener(){let a=null,n=0;this.disposeWithMe(this._commandService.onCommandExecuted(i=>{if(i.id===t.SetFormulaCalculationStopMutation.id&&this.clearProgress(),i.id!==t.SetFormulaCalculationNotificationMutation.id)return;const o=i.params;if(o.stageInfo!=null){const{stage:u}=o.stageInfo;if(u===t.FormulaExecuteStageType.START)n===0&&(this._startExecutionTime=performance.now()),n++,a!==null&&(clearTimeout(a),a=null),a=setTimeout(()=>{a=null,this._startProgress()},1e3);else if(u===t.FormulaExecuteStageType.CURRENTLY_CALCULATING){if(this._executionInProgressParams=o.stageInfo,a===null){const f=this._localeService.t("formula.progress.calculating");this._calculateProgress(f)}}else if(u===t.FormulaExecuteStageType.START_DEPENDENCY_ARRAY_FORMULA){if(this._executionInProgressParams=o.stageInfo,a===null){const f=this._localeService.t("formula.progress.array-analysis");this._calculateProgress(f)}}else if(u===t.FormulaExecuteStageType.CURRENTLY_CALCULATING_ARRAY_FORMULA&&(this._executionInProgressParams=o.stageInfo,a===null)){const f=this._localeService.t("formula.progress.array-calculation");this._calculateProgress(f)}}else{const u=o.functionsExecutedState;let f="";switch(n--,u){case t.FormulaExecutedStateType.NOT_EXECUTED:f="No tasks are being executed anymore",this._resetExecutingDirtyData();break;case t.FormulaExecutedStateType.STOP_EXECUTION:f="The execution of the formula has been stopped",n=0;break;case t.FormulaExecutedStateType.SUCCESS:f="Formula calculation succeeded",(n===0||n===-1)&&(f+=`. Total time consumed: ${performance.now()-this._startExecutionTime} ms`),this._resetExecutingDirtyData();break;case t.FormulaExecutedStateType.INITIAL:f="Waiting for calculation",this._resetExecutingDirtyData();break}(n===0||n===-1)&&(a?(clearTimeout(a),a=null,this.clearProgress()):this._completeProgress(),n=0,this._doneCalculationTaskCount=0,this._totalCalculationTaskCount=0),u===t.FormulaExecutedStateType.STOP_EXECUTION&&this._restartCalculation?(this._restartCalculation=!1,this._commandService.executeCommand(t.SetFormulaCalculationStartMutation.id,{...this._executingDirtyData},It)):this._executionInProgressParams=null,this._logService.debug("[TriggerCalculationController]",f)}}))}_resetExecutingDirtyData(){this._executingDirtyData={dirtyRanges:[],dirtyNameMap:{},dirtyDefinedNameMap:{},dirtyUnitFeatureMap:{},dirtyUnitOtherFormulaMap:{},forceCalculation:!1,clearDependencyTreeCache:{}}}_initialExecuteFormula(){const a=this._getCalculationMode(),n=this._getDirtyDataByCalculationMode(a);this._commandService.executeCommand(t.SetTriggerFormulaCalculationStartMutation.id,n,It),this._registerOtherFormulaService.calculateStarted$.next(!0)}_getDirtyDataByCalculationMode(a){const n=a===Y.FORCED,i=a===Y.WHEN_EMPTY?this._formulaDataModel.getFormulaDirtyRanges():[];return{forceCalculation:n,dirtyRanges:i,dirtyNameMap:{},dirtyDefinedNameMap:{},dirtyUnitFeatureMap:{},dirtyUnitOtherFormulaMap:{},clearDependencyTreeCache:{}}}},P.TriggerCalculationController=kt([W(0,c.ICommandService),W(1,t.IActiveDirtyManagerService),W(2,c.ILogService),W(3,c.IConfigService),W(4,c.Inject(t.FormulaDataModel)),W(5,c.Inject(c.LocaleService)),W(6,c.Inject(t.RegisterOtherFormulaService))],P.TriggerCalculationController);function Qt(r,e,a){var n;return r==null||r[e]==null||((n=r[e])==null?void 0:n[a])==null}function At(r,e,a){var n;if(a){if(r&&r[e]&&((n=r[e])!=null&&n[a]))return delete r[e][a],{[e]:{[a]:null}}}else if(r&&r[e])return delete r[e],{[e]:null}}var b=(r=>(r[r.MoveRange=0]="MoveRange",r[r.MoveRows=1]="MoveRows",r[r.MoveCols=2]="MoveCols",r[r.InsertRow=3]="InsertRow",r[r.InsertColumn=4]="InsertColumn",r[r.RemoveRow=5]="RemoveRow",r[r.RemoveColumn=6]="RemoveColumn",r[r.DeleteMoveLeft=7]="DeleteMoveLeft",r[r.DeleteMoveUp=8]="DeleteMoveUp",r[r.InsertMoveDown=9]="InsertMoveDown",r[r.InsertMoveRight=10]="InsertMoveRight",r[r.SetName=11]="SetName",r[r.RemoveSheet=12]="RemoveSheet",r[r.SetDefinedName=13]="SetDefinedName",r[r.RemoveDefinedName=14]="RemoveDefinedName",r))(b||{});const jt=[11,12,13,14];function $t(r,e,a){const{type:n}=a;return jt.includes(n)?zt(r,e):Zt(r,e,a)}function zt(r,e){const a=[],n=[];return Object.keys(e).forEach(i=>{const o=e[i],u=r[i];if(o==null||u==null)return!0;Object.keys(o).forEach(f=>{const m=new c.ObjectMatrix(o[f]||{}),l=new c.ObjectMatrix(u[f]||{}),p=new c.ObjectMatrix,L=new c.ObjectMatrix;if(m.forValue((C,d,A)=>{if(A==null)return!0;const E=tt(A);E!==null&&(p.setValue(C,d,E),L.setValue(C,d,l.getValue(C,d)))}),p.getSizeOf()===0)return;const N={subUnitId:f,unitId:i,cellValue:p.getMatrix()},T={id:s.SetRangeValuesMutation.id,params:N};n.push(T);const S={subUnitId:f,unitId:i,cellValue:L.getMatrix()},R={id:s.SetRangeValuesMutation.id,params:S};a.push(R)})}),{undos:a,redos:n}}function Zt(r,e,a){const{redoFormulaData:n,undoFormulaData:i}=Jt(r,e,a),o=[],u=[];return Object.keys(n).forEach(f=>{Object.keys(n[f]).forEach(m=>{if(Object.keys(n[f][m]).length!==0){const l={subUnitId:m,unitId:f,cellValue:n[f][m]},p={id:s.SetRangeValuesMutation.id,params:l};o.push(p)}})}),Object.keys(i).forEach(f=>{Object.keys(i[f]).forEach(m=>{if(Object.keys(i[f][m]).length!==0){const l={subUnitId:m,unitId:f,cellValue:i[f][m]},p={id:s.SetRangeValuesMutation.id,params:l};u.push(p)}})}),{undos:u,redos:o}}function Jt(r,e,a){const n={},i={},{unitId:o,sheetId:u}=a;return new Set([...Object.keys(r),...Object.keys(e)]).forEach(m=>{if(Qt(r,m,u))return;new Set([...Object.keys(r[m]||{}),...Object.keys(e[m]||{})]).forEach(p=>{var A,E;const L=(A=r[m])==null?void 0:A[p],N=(E=e[m])==null?void 0:E[p],T=new c.ObjectMatrix(L||{}),S=new c.ObjectMatrix(N||{});let R=[];m!==o||p!==u?R=ee(S):R=te(T,S,a);const C=Le(R,T,S),d=Te(R,T);n[m]||(n[m]={}),i[m]||(i[m]={}),n[m][p]={...n[m][p],...C},i[m][p]={...i[m][p],...d}})}),{redoFormulaData:n,undoFormulaData:i}}function te(r,e,a){const{type:n,from:i,to:o,range:u}=a,f=[];return r.forValue((m,l,p)=>{if(p==null||!Ft(p))return!0;const L=c.cellToRange(m,l);let N=null,T=!1;if([0,1,2].includes(n))N=ae(n,i,o,L);else if(u!=null){const S=ne(L,a);N=S.newCell,T=S.isReverse}if(c.Tools.diffValue(L,N)&&!e.getValue(m,l))return!0;T?f.unshift({oldCell:L,newCell:N}):f.push({oldCell:L,newCell:N})}),f}function ee(r){const e=[];return r.forValue((a,n,i)=>{if(i==null||!Ft(i))return!0;const o=c.cellToRange(a,n);e.push({oldCell:o,newCell:o})}),e}function ae(r,e,a,n){if(e==null||a==null)return null;switch(r){case 0:return ie(e,a,n);case 1:return re(e,a,n);case 2:return oe(e,a,n);default:return null}}function ne(r,e){const{type:a,rangeFilteredRows:n}=e,i=e.range;let o=null,u=!1;switch(a){case 3:o=ue(i,r),u=!0;break;case 4:o=ce(i,r),u=!0;break;case 5:o=fe(i,r,n);break;case 6:o=me(i,r);break;case 7:o=se(i,r);break;case 8:o=le(i,r);break;case 9:o=pe(i,r),u=!0;break;case 10:o=de(i,r),u=!0;break}return{newCell:o,isReverse:u}}function ie(r,e,a){const n=s.handleMoveRange({id:s.EffectRefRangId.MoveRangeCommandId,params:{toRange:e,fromRange:r}},a);return s.runRefRangeMutations(n,a)}function re(r,e,a){const n=s.handleMoveRows({id:s.EffectRefRangId.MoveRowsCommandId,params:{toRange:e,fromRange:r}},a);return s.runRefRangeMutations(n,a)}function oe(r,e,a){const n=s.handleMoveCols({id:s.EffectRefRangId.MoveColsCommandId,params:{toRange:e,fromRange:r}},a);return s.runRefRangeMutations(n,a)}function ue(r,e){const a=s.handleInsertRow({id:s.EffectRefRangId.InsertRowCommandId,params:{range:r,unitId:"",subUnitId:"",direction:c.Direction.DOWN}},e);return s.runRefRangeMutations(a,e)}function ce(r,e){const a=s.handleInsertCol({id:s.EffectRefRangId.InsertColCommandId,params:{range:r,unitId:"",subUnitId:"",direction:c.Direction.RIGHT}},e);return s.runRefRangeMutations(a,e)}function fe(r,e,a){const n=s.handleIRemoveRow({id:s.EffectRefRangId.RemoveRowCommandId,params:{range:r}},e,a);return s.runRefRangeMutations(n,e)}function me(r,e){const a=s.handleIRemoveCol({id:s.EffectRefRangId.RemoveColCommandId,params:{range:r}},e);return s.runRefRangeMutations(a,e)}function se(r,e){const a=s.handleDeleteRangeMoveLeft({id:s.EffectRefRangId.DeleteRangeMoveLeftCommandId,params:{range:r}},e);return s.runRefRangeMutations(a,e)}function le(r,e){const a=s.handleDeleteRangeMoveUp({id:s.EffectRefRangId.DeleteRangeMoveUpCommandId,params:{range:r}},e);return s.runRefRangeMutations(a,e)}function pe(r,e){const a=s.handleInsertRangeMoveDown({id:s.EffectRefRangId.InsertRangeMoveDownCommandId,params:{range:r}},e);return s.runRefRangeMutations(a,e)}function de(r,e){const a=s.handleInsertRangeMoveRight({id:s.EffectRefRangId.InsertRangeMoveRightCommandId,params:{range:r}},e);return s.runRefRangeMutations(a,e)}function Le(r,e,a){var i,o,u;const n=new c.ObjectMatrix({});for(let f=0;f<r.length;f++){const{oldCell:m,newCell:l}=r[f];if((i=n.getValue(m.startRow,m.startColumn))!=null&&i.f||(o=n.getValue(m.startRow,m.startColumn))!=null&&o.si||n.setValue(m.startRow,m.startColumn,{f:null,si:null}),l){const p=(u=a.getValue(m.startRow,m.startColumn))!=null?u:e.getValue(m.startRow,m.startColumn),L=tt(p);n.setValue(l.startRow,l.startColumn,L)}}return n.getMatrix()}function Te(r,e){const a=new c.ObjectMatrix({});for(let n=r.length-1;n>=0;n--){const{oldCell:i,newCell:o}=r[n],u=e.getValue(i.startRow,i.startColumn),f=tt(u);if(a.setValue(i.startRow,i.startColumn,f),o){const m=e.getValue(o.startRow,o.startColumn),l=tt(m);a.setValue(o.startRow,o.startColumn,l!=null?l:{f:null,si:null})}}return a.getMatrix()}function tt(r){if(r==null)return{f:null,si:null};const{f:e,si:a,x:n=0,y:i=0}=r,o=c.isFormulaString(e),u=c.isFormulaId(a);if(!o&&!u)return{f:null,si:null};const f={};return u&&(f.si=a),o&&n===0&&i===0&&(f.f=e),f.f===void 0&&(f.f=null),f.si===void 0&&(f.si=null),f}function Ne(r){const e=new c.ObjectMatrix({});return new c.ObjectMatrix(r).forValue((n,i,o)=>{const u=tt(o);u!==void 0&&e.setValue(n,i,u)}),e.getMatrix()}function Ft(r){const e=(r==null?void 0:r.f)||"",a=(r==null?void 0:r.si)||"",n=c.isFormulaString(e),i=c.isFormulaId(a);return!!(n||i)}function Bt(r,e,a,n,i,o){if((i==null||i.length===0)&&(o==null||o.length===0)){if(r===a&&e===n)return!0}else if((r===i||i==null||i.length===0)&&e===o)return!0;return!1}function vt(r,e,a=0,n=0){const i=[];for(let o=0,u=r.length;o<u;o++){const f=r[o];if(typeof f=="string"||f.nodeType!==t.sequenceNodeType.REFERENCE||e.includes(o)){i.push(f);continue}const{token:m}=f,l=t.deserializeRangeWithSheetWithCache(m),{range:p,sheetName:L,unitId:N}=l,T=c.Rectangle.moveOffset(p,a,n);i.push({...f,token:t.serializeRangeToRefString({range:T,unitId:N,sheetName:L})})}return i}function Vt(r,e,a,n){const{type:i,unitId:o,sheetId:u,range:f,from:m,to:l,rangeFilteredRows:p}=e,{range:L,sheetId:N,unitId:T,sheetName:S,refOffsetX:R,refOffsetY:C}=r;if(!Bt(o,u,a,n,T,N))return;const d=c.Rectangle.moveOffset(L,R,C);let A=null;if(i===b.MoveRange){if(m==null||l==null)return;const E=Ct(d,m),I=c.getIntersectRange(d,m);if(I==null||E!==4)return;const O=s.handleMoveRange({id:s.EffectRefRangId.MoveRangeCommandId,params:{toRange:l,fromRange:m}},I),D=s.runRefRangeMutations(O,I);if(D==null)return t.ErrorType.REF;A=St(E,D,m,l,d,I)}else if(i===b.MoveRows){if(m==null||l==null)return;const E=Ct(d,m);let I=c.getIntersectRange(d,m);if(I==null&&(m.endRow<d.startRow&&l.endRow<=d.startRow||m.startRow>d.endRow&&l.startRow>d.endRow))return;I==null&&(I={startRow:d.startRow,endRow:d.endRow,startColumn:d.startColumn,endColumn:d.endColumn,rangeType:c.RANGE_TYPE.NORMAL});const O=s.handleMoveRows({id:s.EffectRefRangId.MoveRowsCommandId,params:{toRange:l,fromRange:m}},I),D=s.runRefRangeMutations(O,I);if(D==null)return t.ErrorType.REF;A=St(E,D,m,l,d,I)}else if(i===b.MoveCols){if(m==null||l==null)return;const E=Ct(d,m);let I=c.getIntersectRange(d,m);if(I==null&&(m.endColumn<d.startColumn&&l.endColumn<=d.startColumn||m.startColumn>d.endColumn&&l.startColumn>d.endColumn))return;I==null&&(I={startRow:d.startRow,endRow:d.endRow,startColumn:d.startColumn,endColumn:d.endColumn,rangeType:c.RANGE_TYPE.NORMAL});const O=s.handleMoveCols({id:s.EffectRefRangId.MoveColsCommandId,params:{toRange:l,fromRange:m}},I),D=s.runRefRangeMutations(O,I);if(D==null)return t.ErrorType.REF;A=St(E,D,m,l,d,I)}if(f!=null){if(i===b.InsertRow){const E=s.handleInsertRow({id:s.EffectRefRangId.InsertRowCommandId,params:{range:f,unitId:"",subUnitId:"",direction:c.Direction.DOWN}},d),I=s.runRefRangeMutations(E,d);if(I==null)return;A={...d,...I}}else if(i===b.InsertColumn){const E=s.handleInsertCol({id:s.EffectRefRangId.InsertColCommandId,params:{range:f,unitId:"",subUnitId:"",direction:c.Direction.RIGHT}},d),I=s.runRefRangeMutations(E,d);if(I==null)return;A={...d,...I}}else if(i===b.RemoveRow){const E=s.handleIRemoveRow({id:s.EffectRefRangId.RemoveRowCommandId,params:{range:f}},d,p),I=s.runRefRangeMutations(E,d);if(I==null)return t.ErrorType.REF;A={...d,...I}}else if(i===b.RemoveColumn){const E=s.handleIRemoveCol({id:s.EffectRefRangId.RemoveColCommandId,params:{range:f}},d),I=s.runRefRangeMutations(E,d);if(I==null)return t.ErrorType.REF;A={...d,...I}}else if(i===b.DeleteMoveLeft){const E=s.handleDeleteRangeMoveLeft({id:s.EffectRefRangId.DeleteRangeMoveLeftCommandId,params:{range:f}},d),I=s.runRefRangeMutations(E,d);if(I==null)return t.ErrorType.REF;A={...d,...I}}else if(i===b.DeleteMoveUp){const E=s.handleDeleteRangeMoveUp({id:s.EffectRefRangId.DeleteRangeMoveUpCommandId,params:{range:f}},d),I=s.runRefRangeMutations(E,d);if(I==null)return t.ErrorType.REF;A={...d,...I}}else if(i===b.InsertMoveDown){const E=s.handleInsertRangeMoveDown({id:s.EffectRefRangId.InsertRangeMoveDownCommandId,params:{range:f}},d),I=s.runRefRangeMutations(E,d);if(I==null)return;A={...d,...I}}else if(i===b.InsertMoveRight){const E=s.handleInsertRangeMoveRight({id:s.EffectRefRangId.InsertRangeMoveRightCommandId,params:{range:f}},d),I=s.runRefRangeMutations(E,d);if(I==null)return;A={...d,...I}}}if(A!=null)return t.serializeRangeToRefString({range:A,sheetName:S,unitId:T})}function St(r,e,a,n,i,o){const{startRow:u,endRow:f,startColumn:m,endColumn:l,rangeType:p}=et(e),{startRow:L,startColumn:N,endRow:T,endColumn:S,rangeType:R=c.RANGE_TYPE.NORMAL}=et(a),{startRow:C,startColumn:d,endRow:A,endColumn:E}=et(n),{startRow:I,endRow:O,startColumn:D,endColumn:U}=et(o),{startRow:_,endRow:x,startColumn:y,endColumn:q,rangeType:h=c.RANGE_TYPE.NORMAL}=et(i),M={...i};function B(){return p===c.RANGE_TYPE.COLUMN&&h===c.RANGE_TYPE.COLUMN?!0:m>=y&&l<=q}function K(){return p===c.RANGE_TYPE.ROW&&h===c.RANGE_TYPE.ROW?!0:u>=_&&f<=x}if(r===0)if(B())if(u<_)M.startRow=u;else if(u>=x)M.endRow-=T+1-_;else return;else return;else if(r===1)if(B())if(f>x)M.endRow=f;else if(f<=_)M.startRow+=x-L+1;else return;else return;else if(r===2)if(K())if(m<y)M.startColumn=m;else if(m>=q)M.endColumn-=S+1-y;else return;else return;else if(r===3)if(K())if(l>q)M.endColumn=l;else if(l<=y)M.startColumn+=q-N+1;else return;else return;else r===4?(M.startRow=u,M.startColumn=m,M.endRow=f,M.endColumn=l):N<=y&&S>=q||R===c.RANGE_TYPE.ROW&&h===c.RANGE_TYPE.ROW?a.endRow<_?(C>=_&&(M.startRow-=T-L+1),C>=x&&(M.endRow-=T-L+1)):a.startRow>x?(A<=x&&(M.endRow+=T-L+1),A<=_&&(M.startRow+=T-L+1)):a.startRow>=_&&a.endRow<=x&&(C<=_?M.startRow+=T-L+1:C>=x&&(M.endRow-=T-L+1)):L<=_&&T>=x||R===c.RANGE_TYPE.COLUMN&&h===c.RANGE_TYPE.COLUMN?a.endColumn<y?(d>=y&&(M.startColumn-=S-N+1),d>=q&&(M.endColumn-=S-N+1)):a.startColumn>q?(E<=q&&(M.endColumn+=S-N+1),E<=y&&(M.startColumn+=S-N+1)):a.startColumn>=y&&a.endColumn<=q&&(d<=y?M.startColumn+=S-N+1:d>=q&&(M.endColumn-=S-N+1)):((d<=U+1&&E>=q||d<=y&&E>=D-1)&&C<=_&&A>=x||(C<=O+1&&A>=x||C<=_&&A>=I-1)&&d<=y&&E>=q,M.startRow=u,M.startColumn=m,M.endRow=f,M.endColumn=l);return M}function Ct(r,e){const a=z(r.startRow),n=Z(r.endRow),i=z(r.startColumn),o=Z(r.endColumn),u=z(e.startRow),f=Z(e.endRow),m=z(e.startColumn),l=Z(e.endColumn);function p(){return r.rangeType===c.RANGE_TYPE.COLUMN&&e.rangeType===c.RANGE_TYPE.COLUMN?!0:a>=u&&n<=f}function L(){return r.rangeType===c.RANGE_TYPE.ROW&&e.rangeType===c.RANGE_TYPE.ROW?!0:i>=m&&o<=l}function N(){return r.rangeType===c.RANGE_TYPE.ALL&&e.rangeType===c.RANGE_TYPE.ALL}return p()&&L()||N()?4:L()&&a>=u&&a<=f&&n>f?0:L()&&n>=u&&n<=f&&a<u?1:p()&&i>=m&&i<=l&&o>l?2:p()&&o>=m&&o<=l&&i<m?3:null}function z(r){return isNaN(r)?-1/0:r}function Z(r){return isNaN(r)?1/0:r}function et(r){const{startRow:e,endRow:a,startColumn:n,endColumn:i}=r;return{...r,startRow:z(e),endRow:Z(a),startColumn:z(n),endColumn:Z(i)}}function Gt(r,e){const{id:a}=e;let n=null;switch(a){case s.MoveRangeCommand.id:n=Pe(e,r);break;case s.MoveRowsCommand.id:n=Ee(e,r);break;case s.MoveColsCommand.id:n=Ie(e,r);break;case s.InsertRowCommand.id:n=Ae(e);break;case s.InsertColCommand.id:n=Se(e);break;case s.InsertRangeMoveRightCommand.id:n=Ce(e,r);break;case s.InsertRangeMoveDownCommand.id:n=Re(e,r);break;case s.RemoveRowCommand.id:n=Oe(e,r);break;case s.RemoveColCommand.id:n=Me(e,r);break;case s.DeleteRangeMoveUpCommand.id:n=_e(e,r);break;case s.DeleteRangeMoveLeftCommand.id:n=De(e,r);break;case s.SetWorksheetNameCommand.id:n=be(e,r);break;case s.RemoveSheetCommand.id:n=ye(e,r);break;case s.SetDefinedNameCommand.id:n=xe(e,r);break;case s.RemoveDefinedNameCommand.id:n=Ue(e,r);break}return n}function v(r){var n;const e=r.getUnitId(),a=((n=r.getActiveSheet())==null?void 0:n.getSheetId())||"";return{unitId:e,sheetId:a}}function Pe(r,e){const{params:a}=r;if(!a)return null;const{fromRange:n,toRange:i}=a;if(!n||!i)return null;const{unitId:o,sheetId:u}=v(e);return{type:b.MoveRange,from:n,to:i,unitId:o,sheetId:u}}function Ee(r,e){const{params:a}=r;if(!a)return null;const{fromRange:{startRow:n,endRow:i},toRange:{startRow:o,endRow:u}}=a,f=e.getUnitId(),m=e.getActiveSheet();if(!m)return null;const l=m.getSheetId(),p={startRow:n,startColumn:0,endRow:i,endColumn:m.getColumnCount()-1,rangeType:c.RANGE_TYPE.ROW},L={startRow:o,startColumn:0,endRow:u,endColumn:m.getColumnCount()-1,rangeType:c.RANGE_TYPE.ROW};return{type:b.MoveRows,from:p,to:L,unitId:f,sheetId:l}}function Ie(r,e){const{params:a}=r;if(!a)return null;const{fromRange:{startColumn:n,endColumn:i},toRange:{startColumn:o,endColumn:u}}=a,f=e.getUnitId(),m=e.getActiveSheet();if(!m)return null;const l=m.getSheetId(),p={startRow:0,startColumn:n,endRow:m.getRowCount()-1,endColumn:i,rangeType:c.RANGE_TYPE.COLUMN},L={startRow:0,startColumn:o,endRow:m.getRowCount()-1,endColumn:u,rangeType:c.RANGE_TYPE.COLUMN};return{type:b.MoveCols,from:p,to:L,unitId:f,sheetId:l}}function Ae(r){const{params:e}=r;if(!e)return null;const{range:a,unitId:n,subUnitId:i}=e;return{type:b.InsertRow,range:a,unitId:n,sheetId:i}}function Se(r){const{params:e}=r;if(!e)return null;const{range:a,unitId:n,subUnitId:i}=e;return{type:b.InsertColumn,range:a,unitId:n,sheetId:i}}function Ce(r,e){const{params:a}=r;if(!a)return null;const{range:n}=a,{unitId:i,sheetId:o}=v(e);return{type:b.InsertMoveRight,range:n,unitId:i,sheetId:o}}function Re(r,e){const{params:a}=r;if(!a)return null;const{range:n}=a,{unitId:i,sheetId:o}=v(e);return{type:b.InsertMoveDown,range:n,unitId:i,sheetId:o}}function Oe(r,e){var u,f;const{params:a}=r;if(!a)return null;const{range:n}=a,{unitId:i,sheetId:o}=v(e);return{type:b.RemoveRow,range:n,unitId:i,sheetId:o,rangeFilteredRows:(f=(u=e.getSheetBySheetId(o))==null?void 0:u.getRangeFilterRows(n))!=null?f:[]}}function Me(r,e){const{params:a}=r;if(!a)return null;const{range:n}=a,{unitId:i,sheetId:o}=v(e);return{type:b.RemoveColumn,range:n,unitId:i,sheetId:o}}function _e(r,e){const{params:a}=r;if(!a)return null;const{range:n}=a,{unitId:i,sheetId:o}=v(e);return{type:b.DeleteMoveUp,range:n,unitId:i,sheetId:o}}function De(r,e){const{params:a}=r;if(!a)return null;const{range:n}=a,{unitId:i,sheetId:o}=v(e);return{type:b.DeleteMoveLeft,range:n,unitId:i,sheetId:o}}function be(r,e){const{params:a}=r;if(!a)return null;const{unitId:n,subUnitId:i,name:o}=a,{unitId:u,sheetId:f}=v(e);return{type:b.SetName,unitId:n||u,sheetId:i||f,sheetName:o}}function ye(r,e){const{params:a}=r;if(!a)return null;const{unitId:n,subUnitId:i}=a,{unitId:o,sheetId:u}=v(e);return{type:b.RemoveSheet,unitId:n||o,sheetId:i||u}}function xe(r,e){const{params:a}=r;if(!a)return null;const{unitId:n,name:i,id:o}=a,{sheetId:u}=v(e);return{type:b.SetDefinedName,unitId:n,sheetId:u,definedName:i,definedNameId:o}}function Ue(r,e){const{params:a}=r;if(!a)return null;const{unitId:n,name:i,id:o}=a,{sheetId:u}=v(e);return{type:b.RemoveDefinedName,unitId:n,sheetId:u,definedName:i,definedNameId:o}}var qe=Object.getOwnPropertyDescriptor,he=(r,e,a,n)=>{for(var i=n>1?void 0:n?qe(e,a):e,o=r.length-1,u;o>=0;o--)(u=r[o])&&(i=u(i)||i);return i},rt=(r,e)=>(a,n)=>e(a,n,r);P.UpdateDefinedNameController=class extends c.Disposable{constructor(e,a,n,i){super(),this._definedNamesService=e,this._univerInstanceService=a,this._sheetInterceptorService=n,this._lexerTreeBuilder=i,this._initialize()}_initialize(){this._commandExecutedListener()}_commandExecutedListener(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:e=>{if(e.id===s.SetDefinedNameCommand.id||e.id===s.RemoveDefinedNameCommand.id)return{redos:[],undos:[]};const a=this._univerInstanceService.getCurrentUnitForType(c.UniverInstanceType.UNIVER_SHEET);if(a==null)return{redos:[],undos:[]};const n=Gt(a,e);return n?this._getUpdateDefinedNameMutations(a,n):{redos:[],undos:[]}}}))}_getUpdateDefinedNameMutations(e,a){const{type:n,unitId:i,sheetId:o}=a,u=this._definedNamesService.getDefinedNameMap(i);if(!u)return{redos:[],undos:[]};const f=[],m=[];return Object.values(u).forEach(l=>{var d;const{formulaOrRefString:p}=l,L=this._lexerTreeBuilder.sequenceNodesBuilder(p);if(L==null)return!0;let N=!1;const T=[];for(let A=0,E=L.length;A<E;A++){const I=L[A];if(typeof I=="string"||I.nodeType!==t.sequenceNodeType.REFERENCE)continue;const{token:O}=I,D=t.deserializeRangeWithSheetWithCache(O),{range:U,sheetName:_,unitId:x}=D,y=((d=e.getSheetBySheetName(_))==null?void 0:d.getSheetId())||"",q={range:U,sheetId:y,unitId:x,sheetName:_,refOffsetX:0,refOffsetY:0};let h=null;if(n===b.RemoveSheet)h=this._removeSheet(l,i,o);else if(n===b.SetName){const{sheetId:M,sheetName:B}=a;if(B==null||y==null||y.length===0||M!==y)continue;h=t.serializeRangeToRefString({range:U,sheetName:B,unitId:x})}else h=Vt(q,a,i,o);h!=null&&(L[A]={...I,token:h},N=!0,T.push(A))}if(!N)return!0;const S=t.generateStringWithSequence(vt(L,T)),R={id:t.SetDefinedNameMutation.id,params:{unitId:i,...l,formulaOrRefString:S}};f.push(R);const C={id:t.SetDefinedNameMutation.id,params:{unitId:i,...l}};m.push(C)}),{redos:f,undos:m}}_removeSheet(e,a,n){var u;const{formulaOrRefString:i}=e;return((u=this._definedNamesService.getWorksheetByRef(a,i))==null?void 0:u.getSheetId())===n?t.ErrorType.REF:null}},P.UpdateDefinedNameController=he([rt(0,t.IDefinedNamesService),rt(1,c.IUniverInstanceService),rt(2,c.Inject(s.SheetInterceptorService)),rt(3,c.Inject(t.LexerTreeBuilder))],P.UpdateDefinedNameController);var Fe=Object.getOwnPropertyDescriptor,Be=(r,e,a,n)=>{for(var i=n>1?void 0:n?Fe(e,a):e,o=r.length-1,u;o>=0;o--)(u=r[o])&&(i=u(i)||i);return i},X=(r,e)=>(a,n)=>e(a,n,r);P.UpdateFormulaController=class extends c.Disposable{constructor(e,a,n,i,o,u,f,m){super(),this._univerInstanceService=e,this._commandService=a,this._lexerTreeBuilder=n,this._formulaDataModel=i,this._sheetInterceptorService=o,this._definedNamesService=u,this._configService=f,this._injector=m,this._commandExecutedListener()}_commandExecutedListener(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:e=>this._getUpdateFormula(e)})),this.disposeWithMe(this._commandService.onCommandExecuted(e=>{if(e.params)if(e.id===s.RemoveSheetMutation.id){const{subUnitId:a,unitId:n}=e.params;this._handleWorkbookDisposed(n,a)}else e.id===s.InsertSheetMutation.id&&this._handleInsertSheetMutation(e.params)})),this.disposeWithMe(this._commandService.beforeCommandExecuted((e,a)=>{if(e.id===s.SetRangeValuesMutation.id){const n=e.params;if(a&&a.onlyLocal===!0||a&&a.syncOnly===!0||n.trigger===s.SetStyleCommand.id||n.trigger===s.SetBorderCommand.id||n.trigger===s.ClearSelectionFormatCommand.id)return;this._handleSetRangeValuesMutation(n)}})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitAdded$(c.UniverInstanceType.UNIVER_SHEET).subscribe(e=>this._handleWorkbookAdded(e))),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitDisposed$(c.UniverInstanceType.UNIVER_SHEET).pipe(bt.map(e=>e.getUnitId())).subscribe(e=>this._handleWorkbookDisposed(e)))}_handleSetRangeValuesMutation(e){const{subUnitId:a,unitId:n,cellValue:i}=e;if(i==null)return;const o=this._formulaDataModel.updateFormulaData(n,a,i);if(Object.keys(o).length===0)return;const u={[n]:{[a]:o}};this._commandService.executeCommand(s.SetRangeValuesMutation.id,{unitId:n,subUnitId:a,cellValue:Ne(o)},{onlyLocal:!0,fromFormula:!0}),this._formulaDataModel.updateArrayFormulaCellData(n,a,i),this._formulaDataModel.updateArrayFormulaRange(n,a,i),this._formulaDataModel.updateImageFormulaData(n,a,i),this._commandService.executeCommand(t.SetFormulaDataMutation.id,{formulaData:u},{onlyLocal:!0}),this._commandService.executeCommand(t.SetArrayFormulaDataMutation.id,{arrayFormulaRange:this._formulaDataModel.getArrayFormulaRange(),arrayFormulaCellData:this._formulaDataModel.getArrayFormulaCellData()},{onlyLocal:!0,remove:!0})}_handleWorkbookDisposed(e,a){const n=this._formulaDataModel.getFormulaData(),i=At(n,e,a),o=this._formulaDataModel.getArrayFormulaRange(),u=At(o,e,a),f=this._formulaDataModel.getArrayFormulaCellData(),m=At(f,e,a);i&&this._commandService.executeCommand(t.SetFormulaDataMutation.id,{formulaData:i},{onlyLocal:!0}),u&&m&&this._commandService.executeCommand(t.SetArrayFormulaDataMutation.id,{arrayFormulaRange:o,arrayFormulaCellData:f},{onlyLocal:!0})}_handleInsertSheetMutation(e){const{sheet:a,unitId:n}=e,i=this._formulaDataModel.getFormulaData(),{id:o,cellData:u}=a,f=new c.ObjectMatrix(u),m=t.initSheetFormulaData(i,n,o,f);this._commandService.executeCommand(t.SetFormulaDataMutation.id,{formulaData:m},{onlyLocal:!0})}_handleWorkbookAdded(e){var l;const a={},n=e.getUnitId(),i={[n]:{}};e.getSheets().forEach(p=>{var S;const L=p.getCellMatrix(),N=p.getSheetId(),T=t.initSheetFormulaData(a,n,N,L);i[n][N]=(S=T[n])==null?void 0:S[N]}),this._commandService.executeCommand(t.SetFormulaDataMutation.id,{formulaData:i},{onlyLocal:!0});const u=this._configService.getConfig($),f=(l=u==null?void 0:u.initialFormulaComputing)!=null?l:Y.WHEN_EMPTY,m=this._getDirtyDataByCalculationMode(f);this._commandService.executeCommand(t.SetTriggerFormulaCalculationStartMutation.id,m,{onlyLocal:!0})}_getDirtyDataByCalculationMode(e){const a=e===Y.FORCED,n=e===Y.WHEN_EMPTY?this._formulaDataModel.getFormulaDirtyRanges():[];return{forceCalculation:a,dirtyRanges:n,dirtyNameMap:{},dirtyDefinedNameMap:{},dirtyUnitFeatureMap:{},dirtyUnitOtherFormulaMap:{},clearDependencyTreeCache:{}}}_getUpdateFormula(e){const a=this._univerInstanceService.getCurrentUnitForType(c.UniverInstanceType.UNIVER_SHEET);if(!a)return{undos:[],redos:[]};const n=Gt(a,e);if(n){const{unitSheetNameMap:i}=this._formulaDataModel.getCalculateData(),o=this._formulaDataModel.getFormulaData(),{newFormulaData:u}=this._getFormulaReferenceMoveInfo(o,i,n),{undos:f,redos:m}=$t(o,u,n);return{undos:f,redos:m}}return{undos:[],redos:[]}}_getFormulaReferenceMoveInfo(e,a,n){if(!c.Tools.isDefine(e))return{newFormulaData:{},oldFormulaData:{}};const i=Object.keys(e);if(i.length===0)return{newFormulaData:{},oldFormulaData:{}};const o={},u={};for(const f of i){const m=e[f];if(m==null)continue;const l=Object.keys(m);c.Tools.isDefine(o[f])||(o[f]={}),c.Tools.isDefine(u[f])||(u[f]={});for(const p of l){const L=new c.ObjectMatrix(m[p]||{}),N=new c.ObjectMatrix,T=[];L.forValue((S,R,C)=>{var q;if(!C)return!0;const{f:d,x:A,y:E,si:I}=C,O=this._lexerTreeBuilder.sequenceNodesBuilder(d);if(O==null)return!0;let D=!1;const U=[],{type:_,from:x}=n;for(let h=0,M=O.length;h<M;h++){const B=O[h];if(typeof B=="string")continue;const{token:K,nodeType:k}=B;if((_===b.SetDefinedName||_===b.RemoveDefinedName)&&(k===t.sequenceNodeType.DEFINED_NAME||k===t.sequenceNodeType.FUNCTION)){const{definedNameId:Pt,definedName:J}=n;if(Pt===void 0||J===void 0)continue;const j=this._definedNamesService.getValueById(f,Pt);if(j==null||j.name!==K)continue;O[h]={...B,token:_===b.SetDefinedName?J:t.ErrorType.REF},D=!0,U.push(h);continue}else if(k!==t.sequenceNodeType.REFERENCE)continue;const Q=t.deserializeRangeWithSheetWithCache(K),{range:V,sheetName:H,unitId:w}=Q,Nt=w==null||w.length===0?f:w,G=((q=a==null?void 0:a[Nt])==null?void 0:q[H])||"";if(!Bt(n.unitId,n.sheetId,f,p,w,G))continue;const Dt={range:V,sheetId:G,unitId:w,sheetName:H,refOffsetX:A||0,refOffsetY:E||0};let nt=null;if(_===b.SetName){const{unitId:Pt,sheetId:J,sheetName:j}=n;if(j==null||G==null||G.length===0||J!==G)continue;nt=t.serializeRangeToRefString({range:V,sheetName:j,unitId:w})}else if(_===b.RemoveSheet){const{unitId:Pt,sheetId:J,sheetName:j}=n;if(G==null||G.length===0||J!==G)continue;nt=t.ErrorType.REF}else _!==b.SetDefinedName&&(nt=Vt(Dt,n,f,p));nt!=null&&(O[h]={...B,token:nt},D=!0,U.push(h),I&&(A!=null?A:0)===0&&(E!=null?E:0)===0&&T.push(I))}if(!D)if(I&&[b.MoveRows,b.MoveCols,b.MoveRange].includes(_)){if(x&&x.startRow<=S&&S<=x.endRow&&x.startColumn<=R&&R<=x.endColumn)(A!=null?A:0)===0&&(E!=null?E:0)===0&&T.push(I);else if(!T.includes(I))return!0}else return!0;const y=vt(O,U,A,E);N.setValue(S,R,{f:`=${t.generateStringWithSequence(y)}`})}),u[f]&&(u[f][p]=N.getData())}}return{newFormulaData:u}}},P.UpdateFormulaController=Be([X(0,c.IUniverInstanceService),X(1,c.ICommandService),X(2,c.Inject(t.LexerTreeBuilder)),X(3,c.Inject(t.FormulaDataModel)),X(4,c.Inject(s.SheetInterceptorService)),X(5,t.IDefinedNamesService),X(6,c.IConfigService),X(7,c.Inject(c.Injector))],P.UpdateFormulaController);const ve="SHEETS_FORMULA_PLUGIN";var Ve=Object.getOwnPropertyDescriptor,Ge=(r,e,a,n)=>{for(var i=n>1?void 0:n?Ve(e,a):e,o=r.length-1,u;o>=0;o--)(u=r[o])&&(i=u(i)||i);return i},Rt=(r,e)=>(a,n)=>e(a,n,r);let ot=class extends c.Disposable{constructor(r,e,a){super(),this._activeDirtyManagerService=r,this._univerInstanceService=e,this._formulaDataModel=a,this._initialize()}_initialize(){this._initialConversion()}_initialConversion(){this._activeDirtyManagerService.register(s.SetRangeValuesMutation.id,{commandId:s.SetRangeValuesMutation.id,getDirtyData:r=>{const e=r.params;return e.trigger===s.SetStyleCommand.id?{}:{dirtyRanges:this._getSetRangeValuesMutationDirtyRange(e)}}}),this._initialMove(),this._initialRowAndColumn(),this._initialHideRow(),this._initialSheet(),this._initialDefinedName()}_initialMove(){this._activeDirtyManagerService.register(s.MoveRangeMutation.id,{commandId:s.MoveRangeMutation.id,getDirtyData:r=>{const e=r.params;return{dirtyRanges:this._getMoveRangeMutationDirtyRange(e),clearDependencyTreeCache:{[e.unitId]:{[e.to.subUnitId]:"1",[e.from.subUnitId]:"1"}}}}}),this._activeDirtyManagerService.register(s.MoveRowsMutation.id,{commandId:s.MoveRowsMutation.id,getDirtyData:r=>{const e=r.params;return{dirtyRanges:this._getMoveRowsMutationDirtyRange(e),clearDependencyTreeCache:{[e.unitId]:{[e.subUnitId]:"1"}}}}}),this._activeDirtyManagerService.register(s.MoveColsMutation.id,{commandId:s.MoveColsMutation.id,getDirtyData:r=>{const e=r.params;return{dirtyRanges:this._getMoveRowsMutationDirtyRange(e),clearDependencyTreeCache:{[e.unitId]:{[e.subUnitId]:"1"}}}}}),this._activeDirtyManagerService.register(s.ReorderRangeMutation.id,{commandId:s.ReorderRangeMutation.id,getDirtyData:r=>{const e=r.params;return{dirtyRanges:this._getReorderRangeMutationDirtyRange(e),clearDependencyTreeCache:{[e.unitId]:{[e.subUnitId]:"1"}}}}})}_initialRowAndColumn(){this._activeDirtyManagerService.register(s.RemoveRowMutation.id,{commandId:s.RemoveRowMutation.id,getDirtyData:r=>{const e=r.params;return{dirtyRanges:this._getRemoveRowOrColumnMutation(e,!0),clearDependencyTreeCache:{[e.unitId]:{[e.subUnitId]:"1"}}}}}),this._activeDirtyManagerService.register(s.RemoveColMutation.id,{commandId:s.RemoveColMutation.id,getDirtyData:r=>{const e=r.params;return{dirtyRanges:this._getRemoveRowOrColumnMutation(e,!1),clearDependencyTreeCache:{[e.unitId]:{[e.subUnitId]:"1"}}}}}),this._activeDirtyManagerService.register(s.InsertColMutation.id,{commandId:s.InsertColMutation.id,getDirtyData:r=>{const e=r.params;return{clearDependencyTreeCache:{[e.unitId]:{[e.subUnitId]:"1"}}}}}),this._activeDirtyManagerService.register(s.InsertRowMutation.id,{commandId:s.InsertRowMutation.id,getDirtyData:r=>{const e=r.params;return{clearDependencyTreeCache:{[e.unitId]:{[e.subUnitId]:"1"}}}}})}_initialHideRow(){this._activeDirtyManagerService.register(s.SetRowHiddenMutation.id,{commandId:s.SetRowHiddenMutation.id,getDirtyData:r=>{const e=r.params;return{dirtyRanges:this._getHideRowMutation(e),clearDependencyTreeCache:{[e.unitId]:{[e.subUnitId]:"1"}}}}}),this._activeDirtyManagerService.register(s.SetRowVisibleMutation.id,{commandId:s.SetRowVisibleMutation.id,getDirtyData:r=>{const e=r.params;return{dirtyRanges:this._getHideRowMutation(e),clearDependencyTreeCache:{[e.unitId]:{[e.subUnitId]:"1"}}}}})}_initialSheet(){this._activeDirtyManagerService.register(t.SetTriggerFormulaCalculationStartMutation.id,{commandId:t.SetTriggerFormulaCalculationStartMutation.id,getDirtyData:r=>({...r.params})}),this._activeDirtyManagerService.register(s.RemoveSheetMutation.id,{commandId:s.RemoveSheetMutation.id,getDirtyData:r=>{const e=r.params;return{dirtyNameMap:this._getRemoveSheetMutation(e),clearDependencyTreeCache:{[e.unitId]:{[e.subUnitId]:"1"}}}}}),this._activeDirtyManagerService.register(s.InsertSheetMutation.id,{commandId:s.InsertSheetMutation.id,getDirtyData:r=>{const e=r.params;return{dirtyNameMap:this._getInsertSheetMutation(e)}}})}_initialDefinedName(){this._activeDirtyManagerService.register(t.SetDefinedNameMutation.id,{commandId:t.SetDefinedNameMutation.id,getDirtyData:r=>{const e=r.params;return{dirtyDefinedNameMap:this._getDefinedNameMutation(e)}}}),this._activeDirtyManagerService.register(t.RemoveDefinedNameMutation.id,{commandId:t.RemoveDefinedNameMutation.id,getDirtyData:r=>{const e=r.params;return{dirtyDefinedNameMap:this._getDefinedNameMutation(e)}}})}_getDefinedNameMutation(r){const{unitId:e,name:a,formulaOrRefString:n}=r,i={};return r==null?{}:(i[e]={},i[e][a]=n,i)}_getSetRangeValuesMutationDirtyRange(r){const{subUnitId:e,unitId:a,cellValue:n}=r,i=[];return n==null||(i.push(...this._getDirtyRangesByCellValue(a,e,n)),i.push(...this._getDirtyRangesForArrayFormula(a,e,n))),i}_getMoveRangeMutationDirtyRange(r){const{unitId:e,from:a,to:n}=r,i=[];return i.push(...this._getDirtyRangesByCellValue(e,a.subUnitId,a.value)),i.push(...this._getDirtyRangesByCellValue(e,n.subUnitId,n.value)),i.push(...this._getDirtyRangesForArrayFormula(e,n.subUnitId,n.value)),i}_getMoveRowsMutationDirtyRange(r){const{subUnitId:e,unitId:a,sourceRange:n,targetRange:i}=r,o=[],u=this._rangeToMatrix(n).getData(),f=this._rangeToMatrix(i).getData();return o.push(...this._getDirtyRangesByCellValue(a,e,u)),o.push(...this._getDirtyRangesByCellValue(a,e,f)),o.push(...this._getDirtyRangesForArrayFormula(a,e,f)),o}_getReorderRangeMutationDirtyRange(r){const{unitId:e,subUnitId:a,range:n}=r,i=this._rangeToMatrix(n).getData(),o=[];return o.push(...this._getDirtyRangesByCellValue(e,a,i)),o.push(...this._getDirtyRangesForArrayFormula(e,a,i)),o}_getRemoveRowOrColumnMutation(r,e=!0){const{subUnitId:a,unitId:n,range:i}=r,o=[],u=this._univerInstanceService.getUniverSheetInstance(n),f=u==null?void 0:u.getSheetBySheetId(a),m=(f==null?void 0:f.getRowCount())||0,l=(f==null?void 0:f.getColumnCount())||0;let p=null;const{startRow:L,endRow:N,startColumn:T,endColumn:S}=i;e===!0?p=this._rangeToMatrix({startRow:L,startColumn:0,endRow:N,endColumn:l-1}):p=this._rangeToMatrix({startRow:0,startColumn:T,endRow:m,endColumn:S});const R=p.getData();return o.push(...this._getDirtyRangesByCellValue(n,a,R)),o.push(...this._getDirtyRangesForArrayFormula(n,a,R)),o}_getHideRowMutation(r){const{subUnitId:e,unitId:a,ranges:n}=r,i=[];return n.forEach(o=>{const u=this._rangeToMatrix(o).getMatrix();i.push(...this._getDirtyRangesByCellValue(a,e,u))}),i}_getRemoveSheetMutation(r){const e={},{subUnitId:a,unitId:n,subUnitName:i}=r;return e[n]==null&&(e[n]={}),e[n][a]=i,e}_getInsertSheetMutation(r){const e={},{sheet:a,unitId:n}=r;return e[n]==null&&(e[n]={}),e[n][a.id]=a.name,e}_rangeToMatrix(r){const e=new c.ObjectMatrix,{startRow:a,startColumn:n,endRow:i,endColumn:o}=r;for(let u=a;u<=i;u++)for(let f=n;f<=o;f++)e.setValue(u,f,{});return e}_getDirtyRangesByCellValue(r,e,a){const n=[];return a==null||new c.ObjectMatrix(a).getDiscreteRanges().forEach(u=>{n.push({unitId:r,sheetId:e,range:u})}),n}_getDirtyRangesForArrayFormula(r,e,a){var u,f;const n=[];if(a==null)return n;const i=new c.ObjectMatrix(a),o=this._formulaDataModel.getArrayFormulaRange();if((u=o==null?void 0:o[r])!=null&&u[e]){const m=new c.ObjectMatrix((f=o==null?void 0:o[r])==null?void 0:f[e]);i.forValue((l,p)=>{m.forValue((L,N,T)=>{if(T==null)return!0;const{startRow:S,startColumn:R,endRow:C,endColumn:d}=T;l>=S&&l<=C&&p>=R&&p<=d&&n.push({unitId:r,sheetId:e,range:{startRow:S,startColumn:R,endRow:S,endColumn:R}})})})}return n}};ot=Ge([Rt(0,t.IActiveDirtyManagerService),Rt(1,c.IUniverInstanceService),Rt(2,c.Inject(t.FormulaDataModel))],ot);var He=Object.getOwnPropertyDescriptor,we=(r,e,a,n)=>{for(var i=n>1?void 0:n?He(e,a):e,o=r.length-1,u;o>=0;o--)(u=r[o])&&(i=u(i)||i);return i},g=(r,e)=>(a,n)=>e(a,n,r);let ut=class extends c.Disposable{constructor(r,e,a,n,i,o,u){super(),this._commandService=r,this._configService=e,this._sheetInterceptorService=a,this._formulaDataModel=n,this._lexerTreeBuilder=i,this._functionService=o,this._definedNamesService=u,this._initialize()}_initialize(){this._commandExecutedListener(),this._initInterceptorCellContent()}_commandExecutedListener(){this.disposeWithMe(this._commandService.onCommandExecuted(r=>{var a;const e=(a=this._configService.getConfig($))==null?void 0:a.writeArrayFormulaToSnapshot;if(r.id===t.SetArrayFormulaDataMutation.id){const n=r.params;if(n==null)return;const{arrayFormulaRange:i,arrayFormulaCellData:o,arrayFormulaEmbedded:u}=n;this._formulaDataModel.setArrayFormulaRange(i),this._formulaDataModel.setArrayFormulaCellData(o),e&&this._writeArrayFormulaToSnapshot(i,o,u)}else r.id===t.SetFormulaCalculationResultMutation.id&&e&&(this._addPrefixToFunctionSnapshot(),this._addPrefixToDefinedNamesFunctionSnapshot())}))}_addPrefixToDefinedNamesFunctionSnapshot(){const r=this._definedNamesService.getAllDefinedNames();Object.entries(r).forEach(([e,a])=>{a&&Array.from(Object.entries(a)).forEach(([n,i])=>{const{formulaOrRefString:o}=i;if(o.substring(0,1)==="="){const u=this._lexerTreeBuilder.getNewFormulaWithPrefix(o,this._functionService.hasExecutor.bind(this._functionService));u&&this._commandService.executeCommand(t.SetDefinedNameMutation.id,{...i,unitId:e,formulaOrRefStringWithPrefix:u},{onlyLocal:!0,fromFormula:!0})}})})}_addPrefixToFunctionSnapshot(){const r=this._formulaDataModel.getFormulaData(),e=new Map;Object.entries(r).forEach(([a,n])=>{n&&Array.from(Object.entries(n)).forEach(([i,o])=>{if(!o)return;const u=new c.ObjectMatrix;new c.ObjectMatrix(o).forValue((m,l,p)=>{const L=p==null?void 0:p.f;if((p==null?void 0:p.x)!=null||!L||L.length===0)return;if(e.has(L)){const T=e.get(L);u.setValue(m,l,{xf:T});return}const N=this._lexerTreeBuilder.getNewFormulaWithPrefix(L,this._functionService.hasExecutor.bind(this._functionService));N&&(u.setValue(m,l,{xf:N}),e.set(L,N))}),this._commandService.executeCommand(s.SetRangeValuesMutation.id,{unitId:a,subUnitId:i,cellValue:u.getMatrix()},{onlyLocal:!0,fromFormula:!0})})}),e.clear()}_writeArrayFormulaToSnapshot(r,e,a){r&&Object.entries(r).forEach(([n,i])=>{i&&Array.from(Object.entries(i)).forEach(([o,u])=>{const f=new c.ObjectMatrix;new c.ObjectMatrix(u).forValue((l,p,L)=>{f.setValue(l,p,{ref:t.serializeRange(L)})}),this._commandService.executeCommand(s.SetRangeValuesMutation.id,{unitId:n,subUnitId:o,cellValue:f.getMatrix()},{onlyLocal:!0,fromFormula:!0})})}),a&&Object.entries(a).forEach(([n,i])=>{i&&Array.from(Object.entries(i)).forEach(([o,u])=>{const f=new c.ObjectMatrix;new c.ObjectMatrix(u).forValue((l,p)=>{var N,T,S;(S=(T=(N=r==null?void 0:r[n])==null?void 0:N[o])==null?void 0:T[l])!=null&&S[p]||f.setValue(l,p,{ref:t.serializeRange({startRow:l,endRow:l,startColumn:p,endColumn:p})})}),this._commandService.executeCommand(s.SetRangeValuesMutation.id,{unitId:n,subUnitId:o,cellValue:f.getMatrix()},{onlyLocal:!0,fromFormula:!0})})}),e&&Object.entries(e).forEach(([n,i])=>{i&&Array.from(Object.entries(i)).forEach(([o,u])=>{this._commandService.executeCommand(s.SetRangeValuesMutation.id,{unitId:n,subUnitId:o,cellValue:u},{onlyLocal:!0,fromFormula:!0})})})}_initInterceptorCellContent(){this.disposeWithMe(this._sheetInterceptorService.intercept(s.INTERCEPTOR_POINT.CELL_CONTENT,{priority:100,effect:c.InterceptorEffectEnum.Value,handler:(r,e,a)=>{var p,L,N;let n=r;const{unitId:i,subUnitId:o,row:u,col:f}=e,m=this._formulaDataModel.getArrayFormulaCellData(),l=(N=(L=(p=m==null?void 0:m[i])==null?void 0:p[o])==null?void 0:L[u])==null?void 0:N[f];return l==null?a(n):((!n||n===e.rawData)&&(n={...e.rawData}),l.v==null&&l.t==null?(n.v=0,n.t=c.CellValueType.NUMBER,a(n)):(n==null?void 0:n.t)===c.CellValueType.NUMBER&&n.v!==void 0&&n.v!==null&&c.isRealNum(n.v)?(n.v=t.stripErrorMargin(Number(n.v)),a(n)):(n.v=l.v,n.t=l.t,a(n)))}}))}};ut=we([g(0,c.ICommandService),g(1,c.IConfigService),g(2,c.Inject(s.SheetInterceptorService)),g(3,c.Inject(t.FormulaDataModel)),g(4,c.Inject(t.LexerTreeBuilder)),g(5,t.IFunctionService),g(6,t.IDefinedNamesService)],ut);const Ye=[{functionName:t.FUNCTION_NAMES_ARRAY.ARRAY_CONSTRAIN,functionType:t.FunctionType.Array,description:"formula.functionList.ARRAY_CONSTRAIN.description",abstract:"formula.functionList.ARRAY_CONSTRAIN.abstract",functionParameter:[{name:"formula.functionList.ARRAY_CONSTRAIN.functionParameter.inputRange.name",detail:"formula.functionList.ARRAY_CONSTRAIN.functionParameter.inputRange.detail",example:"A1:C3",require:1,repeat:0},{name:"formula.functionList.ARRAY_CONSTRAIN.functionParameter.numRows.name",detail:"formula.functionList.ARRAY_CONSTRAIN.functionParameter.numRows.detail",example:"2",require:1,repeat:0},{name:"formula.functionList.ARRAY_CONSTRAIN.functionParameter.numCols.name",detail:"formula.functionList.ARRAY_CONSTRAIN.functionParameter.numCols.detail",example:"2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ARRAY.FLATTEN,functionType:t.FunctionType.Array,description:"formula.functionList.FLATTEN.description",abstract:"formula.functionList.FLATTEN.abstract",functionParameter:[{name:"formula.functionList.FLATTEN.functionParameter.range1.name",detail:"formula.functionList.FLATTEN.functionParameter.range1.detail",example:"A1:C3",require:1,repeat:0},{name:"formula.functionList.FLATTEN.functionParameter.range2.name",detail:"formula.functionList.FLATTEN.functionParameter.range2.detail",example:"D1:F3",require:0,repeat:1}]}],Xe=[{functionName:t.FUNCTION_NAMES_COMPATIBILITY.BETADIST,functionType:t.FunctionType.Compatibility,description:"formula.functionList.BETADIST.description",abstract:"formula.functionList.BETADIST.abstract",functionParameter:[{name:"formula.functionList.BETADIST.functionParameter.x.name",detail:"formula.functionList.BETADIST.functionParameter.x.detail",example:"2",require:1,repeat:0},{name:"formula.functionList.BETADIST.functionParameter.alpha.name",detail:"formula.functionList.BETADIST.functionParameter.alpha.detail",example:"8",require:1,repeat:0},{name:"formula.functionList.BETADIST.functionParameter.beta.name",detail:"formula.functionList.BETADIST.functionParameter.beta.detail",example:"10",require:1,repeat:0},{name:"formula.functionList.BETADIST.functionParameter.A.name",detail:"formula.functionList.BETADIST.functionParameter.A.detail",example:"1",require:0,repeat:0},{name:"formula.functionList.BETADIST.functionParameter.B.name",detail:"formula.functionList.BETADIST.functionParameter.B.detail",example:"3",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_COMPATIBILITY.BETAINV,functionType:t.FunctionType.Compatibility,description:"formula.functionList.BETAINV.description",abstract:"formula.functionList.BETAINV.abstract",functionParameter:[{name:"formula.functionList.BETAINV.functionParameter.probability.name",detail:"formula.functionList.BETAINV.functionParameter.probability.detail",example:"0.685470581",require:1,repeat:0},{name:"formula.functionList.BETAINV.functionParameter.alpha.name",detail:"formula.functionList.BETAINV.functionParameter.alpha.detail",example:"8",require:1,repeat:0},{name:"formula.functionList.BETAINV.functionParameter.beta.name",detail:"formula.functionList.BETAINV.functionParameter.beta.detail",example:"10",require:1,repeat:0},{name:"formula.functionList.BETAINV.functionParameter.A.name",detail:"formula.functionList.BETAINV.functionParameter.A.detail",example:"1",require:0,repeat:0},{name:"formula.functionList.BETAINV.functionParameter.B.name",detail:"formula.functionList.BETAINV.functionParameter.B.detail",example:"3",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_COMPATIBILITY.BINOMDIST,functionType:t.FunctionType.Compatibility,description:"formula.functionList.BINOMDIST.description",abstract:"formula.functionList.BINOMDIST.abstract",functionParameter:[{name:"formula.functionList.BINOMDIST.functionParameter.numberS.name",detail:"formula.functionList.BINOMDIST.functionParameter.numberS.detail",example:"6",require:1,repeat:0},{name:"formula.functionList.BINOMDIST.functionParameter.trials.name",detail:"formula.functionList.BINOMDIST.functionParameter.trials.detail",example:"10",require:1,repeat:0},{name:"formula.functionList.BINOMDIST.functionParameter.probabilityS.name",detail:"formula.functionList.BINOMDIST.functionParameter.probabilityS.detail",example:"0.5",require:1,repeat:0},{name:"formula.functionList.BINOMDIST.functionParameter.cumulative.name",detail:"formula.functionList.BINOMDIST.functionParameter.cumulative.detail",example:"false",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_COMPATIBILITY.CHIDIST,functionType:t.FunctionType.Compatibility,description:"formula.functionList.CHIDIST.description",abstract:"formula.functionList.CHIDIST.abstract",functionParameter:[{name:"formula.functionList.CHIDIST.functionParameter.x.name",detail:"formula.functionList.CHIDIST.functionParameter.x.detail",example:"0.5",require:1,repeat:0},{name:"formula.functionList.CHIDIST.functionParameter.degFreedom.name",detail:"formula.functionList.CHIDIST.functionParameter.degFreedom.detail",example:"1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_COMPATIBILITY.CHIINV,functionType:t.FunctionType.Compatibility,description:"formula.functionList.CHIINV.description",abstract:"formula.functionList.CHIINV.abstract",functionParameter:[{name:"formula.functionList.CHIINV.functionParameter.probability.name",detail:"formula.functionList.CHIINV.functionParameter.probability.detail",example:"0.93",require:1,repeat:0},{name:"formula.functionList.CHIINV.functionParameter.degFreedom.name",detail:"formula.functionList.CHIINV.functionParameter.degFreedom.detail",example:"1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_COMPATIBILITY.CHITEST,functionType:t.FunctionType.Compatibility,description:"formula.functionList.CHITEST.description",abstract:"formula.functionList.CHITEST.abstract",functionParameter:[{name:"formula.functionList.CHITEST.functionParameter.actualRange.name",detail:"formula.functionList.CHITEST.functionParameter.actualRange.detail",example:"A1:A4",require:1,repeat:0},{name:"formula.functionList.CHITEST.functionParameter.expectedRange.name",detail:"formula.functionList.CHITEST.functionParameter.expectedRange.detail",example:"B1:B4",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_COMPATIBILITY.CONFIDENCE,functionType:t.FunctionType.Compatibility,description:"formula.functionList.CONFIDENCE.description",abstract:"formula.functionList.CONFIDENCE.abstract",functionParameter:[{name:"formula.functionList.CONFIDENCE.functionParameter.alpha.name",detail:"formula.functionList.CONFIDENCE.functionParameter.alpha.detail",example:"0.05",require:1,repeat:0},{name:"formula.functionList.CONFIDENCE.functionParameter.standardDev.name",detail:"formula.functionList.CONFIDENCE.functionParameter.standardDev.detail",example:"2.5",require:1,repeat:0},{name:"formula.functionList.CONFIDENCE.functionParameter.size.name",detail:"formula.functionList.CONFIDENCE.functionParameter.size.detail",example:"50",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_COMPATIBILITY.COVAR,functionType:t.FunctionType.Compatibility,description:"formula.functionList.COVAR.description",abstract:"formula.functionList.COVAR.abstract",functionParameter:[{name:"formula.functionList.COVAR.functionParameter.array1.name",detail:"formula.functionList.COVAR.functionParameter.array1.detail",example:"A1:A4",require:1,repeat:0},{name:"formula.functionList.COVAR.functionParameter.array2.name",detail:"formula.functionList.COVAR.functionParameter.array2.detail",example:"B1:B4",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_COMPATIBILITY.CRITBINOM,functionType:t.FunctionType.Compatibility,description:"formula.functionList.CRITBINOM.description",abstract:"formula.functionList.CRITBINOM.abstract",functionParameter:[{name:"formula.functionList.CRITBINOM.functionParameter.trials.name",detail:"formula.functionList.CRITBINOM.functionParameter.trials.detail",example:"6",require:1,repeat:0},{name:"formula.functionList.CRITBINOM.functionParameter.probabilityS.name",detail:"formula.functionList.CRITBINOM.functionParameter.probabilityS.detail",example:"0.5",require:1,repeat:0},{name:"formula.functionList.CRITBINOM.functionParameter.alpha.name",detail:"formula.functionList.CRITBINOM.functionParameter.alpha.detail",example:"0.75",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_COMPATIBILITY.EXPONDIST,functionType:t.FunctionType.Compatibility,description:"formula.functionList.EXPONDIST.description",abstract:"formula.functionList.EXPONDIST.abstract",functionParameter:[{name:"formula.functionList.EXPONDIST.functionParameter.x.name",detail:"formula.functionList.EXPONDIST.functionParameter.x.detail",example:"0.2",require:1,repeat:0},{name:"formula.functionList.EXPONDIST.functionParameter.lambda.name",detail:"formula.functionList.EXPONDIST.functionParameter.lambda.detail",example:"10",require:1,repeat:0},{name:"formula.functionList.EXPONDIST.functionParameter.cumulative.name",detail:"formula.functionList.EXPONDIST.functionParameter.cumulative.detail",example:"true",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_COMPATIBILITY.FDIST,functionType:t.FunctionType.Compatibility,description:"formula.functionList.FDIST.description",abstract:"formula.functionList.FDIST.abstract",functionParameter:[{name:"formula.functionList.FDIST.functionParameter.x.name",detail:"formula.functionList.FDIST.functionParameter.x.detail",example:"15.2069",require:1,repeat:0},{name:"formula.functionList.FDIST.functionParameter.degFreedom1.name",detail:"formula.functionList.FDIST.functionParameter.degFreedom1.detail",example:"6",require:1,repeat:0},{name:"formula.functionList.FDIST.functionParameter.degFreedom2.name",detail:"formula.functionList.FDIST.functionParameter.degFreedom2.detail",example:"4",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_COMPATIBILITY.FINV,functionType:t.FunctionType.Compatibility,description:"formula.functionList.FINV.description",abstract:"formula.functionList.FINV.abstract",functionParameter:[{name:"formula.functionList.FINV.functionParameter.probability.name",detail:"formula.functionList.FINV.functionParameter.probability.detail",example:"0.01",require:1,repeat:0},{name:"formula.functionList.FINV.functionParameter.degFreedom1.name",detail:"formula.functionList.FINV.functionParameter.degFreedom1.detail",example:"6",require:1,repeat:0},{name:"formula.functionList.FINV.functionParameter.degFreedom2.name",detail:"formula.functionList.FINV.functionParameter.degFreedom2.detail",example:"4",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_COMPATIBILITY.FTEST,functionType:t.FunctionType.Compatibility,description:"formula.functionList.FTEST.description",abstract:"formula.functionList.FTEST.abstract",functionParameter:[{name:"formula.functionList.FTEST.functionParameter.array1.name",detail:"formula.functionList.FTEST.functionParameter.array1.detail",example:"A1:A4",require:1,repeat:0},{name:"formula.functionList.FTEST.functionParameter.array2.name",detail:"formula.functionList.FTEST.functionParameter.array2.detail",example:"B1:B4",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_COMPATIBILITY.GAMMADIST,functionType:t.FunctionType.Compatibility,description:"formula.functionList.GAMMADIST.description",abstract:"formula.functionList.GAMMADIST.abstract",functionParameter:[{name:"formula.functionList.GAMMADIST.functionParameter.x.name",detail:"formula.functionList.GAMMADIST.functionParameter.x.detail",example:"10",require:1,repeat:0},{name:"formula.functionList.GAMMADIST.functionParameter.alpha.name",detail:"formula.functionList.GAMMADIST.functionParameter.alpha.detail",example:"8",require:1,repeat:0},{name:"formula.functionList.GAMMADIST.functionParameter.beta.name",detail:"formula.functionList.GAMMADIST.functionParameter.beta.detail",example:"2",require:1,repeat:0},{name:"formula.functionList.GAMMADIST.functionParameter.cumulative.name",detail:"formula.functionList.GAMMADIST.functionParameter.cumulative.detail",example:"true",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_COMPATIBILITY.GAMMAINV,functionType:t.FunctionType.Compatibility,description:"formula.functionList.GAMMAINV.description",abstract:"formula.functionList.GAMMAINV.abstract",functionParameter:[{name:"formula.functionList.GAMMAINV.functionParameter.probability.name",detail:"formula.functionList.GAMMAINV.functionParameter.probability.detail",example:"0.068094",require:1,repeat:0},{name:"formula.functionList.GAMMAINV.functionParameter.alpha.name",detail:"formula.functionList.GAMMAINV.functionParameter.alpha.detail",example:"9",require:1,repeat:0},{name:"formula.functionList.GAMMAINV.functionParameter.beta.name",detail:"formula.functionList.GAMMAINV.functionParameter.beta.detail",example:"2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_COMPATIBILITY.HYPGEOMDIST,functionType:t.FunctionType.Compatibility,description:"formula.functionList.HYPGEOMDIST.description",abstract:"formula.functionList.HYPGEOMDIST.abstract",functionParameter:[{name:"formula.functionList.HYPGEOMDIST.functionParameter.sampleS.name",detail:"formula.functionList.HYPGEOMDIST.functionParameter.sampleS.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.HYPGEOMDIST.functionParameter.numberSample.name",detail:"formula.functionList.HYPGEOMDIST.functionParameter.numberSample.detail",example:"4",require:1,repeat:0},{name:"formula.functionList.HYPGEOMDIST.functionParameter.populationS.name",detail:"formula.functionList.HYPGEOMDIST.functionParameter.populationS.detail",example:"8",require:1,repeat:0},{name:"formula.functionList.HYPGEOMDIST.functionParameter.numberPop.name",detail:"formula.functionList.HYPGEOMDIST.functionParameter.numberPop.detail",example:"20",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_COMPATIBILITY.LOGINV,functionType:t.FunctionType.Compatibility,description:"formula.functionList.LOGINV.description",abstract:"formula.functionList.LOGINV.abstract",functionParameter:[{name:"formula.functionList.LOGINV.functionParameter.probability.name",detail:"formula.functionList.LOGINV.functionParameter.probability.detail",example:"0.908789",require:1,repeat:0},{name:"formula.functionList.LOGINV.functionParameter.mean.name",detail:"formula.functionList.LOGINV.functionParameter.mean.detail",example:"40",require:1,repeat:0},{name:"formula.functionList.LOGINV.functionParameter.standardDev.name",detail:"formula.functionList.LOGINV.functionParameter.standardDev.detail",example:"1.5",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_COMPATIBILITY.LOGNORMDIST,functionType:t.FunctionType.Compatibility,description:"formula.functionList.LOGNORMDIST.description",abstract:"formula.functionList.LOGNORMDIST.abstract",functionParameter:[{name:"formula.functionList.LOGNORMDIST.functionParameter.x.name",detail:"formula.functionList.LOGNORMDIST.functionParameter.x.detail",example:"42",require:1,repeat:0},{name:"formula.functionList.LOGNORMDIST.functionParameter.mean.name",detail:"formula.functionList.LOGNORMDIST.functionParameter.mean.detail",example:"40",require:1,repeat:0},{name:"formula.functionList.LOGNORMDIST.functionParameter.standardDev.name",detail:"formula.functionList.LOGNORMDIST.functionParameter.standardDev.detail",example:"1.5",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_COMPATIBILITY.MODE,functionType:t.FunctionType.Compatibility,description:"formula.functionList.MODE.description",abstract:"formula.functionList.MODE.abstract",functionParameter:[{name:"formula.functionList.MODE.functionParameter.number1.name",detail:"formula.functionList.MODE.functionParameter.number1.detail",example:"A1:A4",require:1,repeat:0},{name:"formula.functionList.MODE.functionParameter.number2.name",detail:"formula.functionList.MODE.functionParameter.number2.detail",example:"2",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_COMPATIBILITY.NEGBINOMDIST,functionType:t.FunctionType.Compatibility,description:"formula.functionList.NEGBINOMDIST.description",abstract:"formula.functionList.NEGBINOMDIST.abstract",functionParameter:[{name:"formula.functionList.NEGBINOMDIST.functionParameter.numberF.name",detail:"formula.functionList.NEGBINOMDIST.functionParameter.numberF.detail",example:"10",require:1,repeat:0},{name:"formula.functionList.NEGBINOMDIST.functionParameter.numberS.name",detail:"formula.functionList.NEGBINOMDIST.functionParameter.numberS.detail",example:"5",require:1,repeat:0},{name:"formula.functionList.NEGBINOMDIST.functionParameter.probabilityS.name",detail:"formula.functionList.NEGBINOMDIST.functionParameter.probabilityS.detail",example:"0.25",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_COMPATIBILITY.NORMDIST,functionType:t.FunctionType.Compatibility,description:"formula.functionList.NORMDIST.description",abstract:"formula.functionList.NORMDIST.abstract",functionParameter:[{name:"formula.functionList.NORMDIST.functionParameter.x.name",detail:"formula.functionList.NORMDIST.functionParameter.x.detail",example:"42",require:1,repeat:0},{name:"formula.functionList.NORMDIST.functionParameter.mean.name",detail:"formula.functionList.NORMDIST.functionParameter.mean.detail",example:"40",require:1,repeat:0},{name:"formula.functionList.NORMDIST.functionParameter.standardDev.name",detail:"formula.functionList.NORMDIST.functionParameter.standardDev.detail",example:"1.5",require:1,repeat:0},{name:"formula.functionList.NORMDIST.functionParameter.cumulative.name",detail:"formula.functionList.NORMDIST.functionParameter.cumulative.detail",example:"true",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_COMPATIBILITY.NORMINV,functionType:t.FunctionType.Compatibility,description:"formula.functionList.NORMINV.description",abstract:"formula.functionList.NORMINV.abstract",functionParameter:[{name:"formula.functionList.NORMINV.functionParameter.probability.name",detail:"formula.functionList.NORMINV.functionParameter.probability.detail",example:"0.908789",require:1,repeat:0},{name:"formula.functionList.NORMINV.functionParameter.mean.name",detail:"formula.functionList.NORMINV.functionParameter.mean.detail",example:"40",require:1,repeat:0},{name:"formula.functionList.NORMINV.functionParameter.standardDev.name",detail:"formula.functionList.NORMINV.functionParameter.standardDev.detail",example:"1.5",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_COMPATIBILITY.NORMSDIST,functionType:t.FunctionType.Compatibility,description:"formula.functionList.NORMSDIST.description",abstract:"formula.functionList.NORMSDIST.abstract",functionParameter:[{name:"formula.functionList.NORMSDIST.functionParameter.z.name",detail:"formula.functionList.NORMSDIST.functionParameter.z.detail",example:"1.333333",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_COMPATIBILITY.NORMSINV,functionType:t.FunctionType.Compatibility,description:"formula.functionList.NORMSINV.description",abstract:"formula.functionList.NORMSINV.abstract",functionParameter:[{name:"formula.functionList.NORMSINV.functionParameter.probability.name",detail:"formula.functionList.NORMSINV.functionParameter.probability.detail",example:"0.908789",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_COMPATIBILITY.PERCENTILE,functionType:t.FunctionType.Compatibility,description:"formula.functionList.PERCENTILE.description",abstract:"formula.functionList.PERCENTILE.abstract",functionParameter:[{name:"formula.functionList.PERCENTILE.functionParameter.array.name",detail:"formula.functionList.PERCENTILE.functionParameter.array.detail",example:"A1:A4",require:1,repeat:0},{name:"formula.functionList.PERCENTILE.functionParameter.k.name",detail:"formula.functionList.PERCENTILE.functionParameter.k.detail",example:"0.3",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_COMPATIBILITY.PERCENTRANK,functionType:t.FunctionType.Compatibility,description:"formula.functionList.PERCENTRANK.description",abstract:"formula.functionList.PERCENTRANK.abstract",functionParameter:[{name:"formula.functionList.PERCENTRANK.functionParameter.array.name",detail:"formula.functionList.PERCENTRANK.functionParameter.array.detail",example:"A1:A4",require:1,repeat:0},{name:"formula.functionList.PERCENTRANK.functionParameter.x.name",detail:"formula.functionList.PERCENTRANK.functionParameter.x.detail",example:"1.5",require:1,repeat:0},{name:"formula.functionList.PERCENTRANK.functionParameter.significance.name",detail:"formula.functionList.PERCENTRANK.functionParameter.significance.detail",example:"3",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_COMPATIBILITY.POISSON,functionType:t.FunctionType.Compatibility,description:"formula.functionList.POISSON.description",abstract:"formula.functionList.POISSON.abstract",functionParameter:[{name:"formula.functionList.POISSON.functionParameter.x.name",detail:"formula.functionList.POISSON.functionParameter.x.detail",example:"2",require:1,repeat:0},{name:"formula.functionList.POISSON.functionParameter.mean.name",detail:"formula.functionList.POISSON.functionParameter.mean.detail",example:"5",require:1,repeat:0},{name:"formula.functionList.POISSON.functionParameter.cumulative.name",detail:"formula.functionList.POISSON.functionParameter.cumulative.detail",example:"true",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_COMPATIBILITY.QUARTILE,functionType:t.FunctionType.Compatibility,description:"formula.functionList.QUARTILE.description",abstract:"formula.functionList.QUARTILE.abstract",functionParameter:[{name:"formula.functionList.QUARTILE.functionParameter.array.name",detail:"formula.functionList.QUARTILE.functionParameter.array.detail",example:"A1:A4",require:1,repeat:0},{name:"formula.functionList.QUARTILE.functionParameter.quart.name",detail:"formula.functionList.QUARTILE.functionParameter.quart.detail",example:"1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_COMPATIBILITY.RANK,functionType:t.FunctionType.Compatibility,description:"formula.functionList.RANK.description",abstract:"formula.functionList.RANK.abstract",functionParameter:[{name:"formula.functionList.RANK.functionParameter.number.name",detail:"formula.functionList.RANK.functionParameter.number.detail",example:"A3",require:1,repeat:0},{name:"formula.functionList.RANK.functionParameter.ref.name",detail:"formula.functionList.RANK.functionParameter.ref.detail",example:"A2:A6",require:1,repeat:0},{name:"formula.functionList.RANK.functionParameter.order.name",detail:"formula.functionList.RANK.functionParameter.order.detail",example:"1",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_COMPATIBILITY.STDEV,functionType:t.FunctionType.Compatibility,description:"formula.functionList.STDEV.description",abstract:"formula.functionList.STDEV.abstract",functionParameter:[{name:"formula.functionList.STDEV.functionParameter.number1.name",detail:"formula.functionList.STDEV.functionParameter.number1.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.STDEV.functionParameter.number2.name",detail:"formula.functionList.STDEV.functionParameter.number2.detail",example:"2",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_COMPATIBILITY.STDEVP,functionType:t.FunctionType.Compatibility,description:"formula.functionList.STDEVP.description",abstract:"formula.functionList.STDEVP.abstract",functionParameter:[{name:"formula.functionList.STDEVP.functionParameter.number1.name",detail:"formula.functionList.STDEVP.functionParameter.number1.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.STDEVP.functionParameter.number2.name",detail:"formula.functionList.STDEVP.functionParameter.number2.detail",example:"2",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_COMPATIBILITY.TDIST,functionType:t.FunctionType.Compatibility,description:"formula.functionList.TDIST.description",abstract:"formula.functionList.TDIST.abstract",functionParameter:[{name:"formula.functionList.TDIST.functionParameter.x.name",detail:"formula.functionList.TDIST.functionParameter.x.detail",example:"8",require:1,repeat:0},{name:"formula.functionList.TDIST.functionParameter.degFreedom.name",detail:"formula.functionList.TDIST.functionParameter.degFreedom.detail",example:"3",require:1,repeat:0},{name:"formula.functionList.TDIST.functionParameter.tails.name",detail:"formula.functionList.TDIST.functionParameter.tails.detail",example:"1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_COMPATIBILITY.TINV,functionType:t.FunctionType.Compatibility,description:"formula.functionList.TINV.description",abstract:"formula.functionList.TINV.abstract",functionParameter:[{name:"formula.functionList.TINV.functionParameter.probability.name",detail:"formula.functionList.TINV.functionParameter.probability.detail",example:"0.75",require:1,repeat:0},{name:"formula.functionList.TINV.functionParameter.degFreedom.name",detail:"formula.functionList.TINV.functionParameter.degFreedom.detail",example:"2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_COMPATIBILITY.TTEST,functionType:t.FunctionType.Compatibility,description:"formula.functionList.TTEST.description",abstract:"formula.functionList.TTEST.abstract",functionParameter:[{name:"formula.functionList.TTEST.functionParameter.array1.name",detail:"formula.functionList.TTEST.functionParameter.array1.detail",example:"A1:A4",require:1,repeat:0},{name:"formula.functionList.TTEST.functionParameter.array2.name",detail:"formula.functionList.TTEST.functionParameter.array2.detail",example:"B1:B4",require:1,repeat:0},{name:"formula.functionList.TTEST.functionParameter.tails.name",detail:"formula.functionList.TTEST.functionParameter.tails.detail",example:"2",require:1,repeat:0},{name:"formula.functionList.TTEST.functionParameter.type.name",detail:"formula.functionList.TTEST.functionParameter.type.detail",example:"1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_COMPATIBILITY.VAR,functionType:t.FunctionType.Compatibility,description:"formula.functionList.VAR.description",abstract:"formula.functionList.VAR.abstract",functionParameter:[{name:"formula.functionList.VAR.functionParameter.number1.name",detail:"formula.functionList.VAR.functionParameter.number1.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.VAR.functionParameter.number2.name",detail:"formula.functionList.VAR.functionParameter.number2.detail",example:"2",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_COMPATIBILITY.VARP,functionType:t.FunctionType.Compatibility,description:"formula.functionList.VARP.description",abstract:"formula.functionList.VARP.abstract",functionParameter:[{name:"formula.functionList.VARP.functionParameter.number1.name",detail:"formula.functionList.VARP.functionParameter.number1.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.VARP.functionParameter.number2.name",detail:"formula.functionList.VARP.functionParameter.number2.detail",example:"2",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_COMPATIBILITY.WEIBULL,functionType:t.FunctionType.Compatibility,description:"formula.functionList.WEIBULL.description",abstract:"formula.functionList.WEIBULL.abstract",functionParameter:[{name:"formula.functionList.WEIBULL.functionParameter.x.name",detail:"formula.functionList.WEIBULL.functionParameter.x.detail",example:"105",require:1,repeat:0},{name:"formula.functionList.WEIBULL.functionParameter.alpha.name",detail:"formula.functionList.WEIBULL.functionParameter.alpha.detail",example:"20",require:1,repeat:0},{name:"formula.functionList.WEIBULL.functionParameter.beta.name",detail:"formula.functionList.WEIBULL.functionParameter.beta.detail",example:"100",require:1,repeat:0},{name:"formula.functionList.WEIBULL.functionParameter.cumulative.name",detail:"formula.functionList.WEIBULL.functionParameter.cumulative.detail",example:"true",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_COMPATIBILITY.ZTEST,functionType:t.FunctionType.Compatibility,description:"formula.functionList.ZTEST.description",abstract:"formula.functionList.ZTEST.abstract",functionParameter:[{name:"formula.functionList.ZTEST.functionParameter.array.name",detail:"formula.functionList.ZTEST.functionParameter.array.detail",example:"A2:A11",require:1,repeat:0},{name:"formula.functionList.ZTEST.functionParameter.x.name",detail:"formula.functionList.ZTEST.functionParameter.x.detail",example:"4",require:1,repeat:0},{name:"formula.functionList.ZTEST.functionParameter.sigma.name",detail:"formula.functionList.ZTEST.functionParameter.sigma.detail",example:"10",require:0,repeat:0}]}],We=[{functionName:t.FUNCTION_NAMES_CUBE.CUBEKPIMEMBER,functionType:t.FunctionType.Cube,description:"formula.functionList.CUBEKPIMEMBER.description",abstract:"formula.functionList.CUBEKPIMEMBER.abstract",functionParameter:[{name:"formula.functionList.CUBEKPIMEMBER.functionParameter.number1.name",detail:"formula.functionList.CUBEKPIMEMBER.functionParameter.number1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.CUBEKPIMEMBER.functionParameter.number2.name",detail:"formula.functionList.CUBEKPIMEMBER.functionParameter.number2.detail",example:"A1:A20",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_CUBE.CUBEMEMBER,functionType:t.FunctionType.Cube,description:"formula.functionList.CUBEMEMBER.description",abstract:"formula.functionList.CUBEMEMBER.abstract",functionParameter:[{name:"formula.functionList.CUBEMEMBER.functionParameter.number1.name",detail:"formula.functionList.CUBEMEMBER.functionParameter.number1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.CUBEMEMBER.functionParameter.number2.name",detail:"formula.functionList.CUBEMEMBER.functionParameter.number2.detail",example:"A1:A20",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_CUBE.CUBEMEMBERPROPERTY,functionType:t.FunctionType.Cube,description:"formula.functionList.CUBEMEMBERPROPERTY.description",abstract:"formula.functionList.CUBEMEMBERPROPERTY.abstract",functionParameter:[{name:"formula.functionList.CUBEMEMBERPROPERTY.functionParameter.number1.name",detail:"formula.functionList.CUBEMEMBERPROPERTY.functionParameter.number1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.CUBEMEMBERPROPERTY.functionParameter.number2.name",detail:"formula.functionList.CUBEMEMBERPROPERTY.functionParameter.number2.detail",example:"A1:A20",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_CUBE.CUBERANKEDMEMBER,functionType:t.FunctionType.Cube,description:"formula.functionList.CUBERANKEDMEMBER.description",abstract:"formula.functionList.CUBERANKEDMEMBER.abstract",functionParameter:[{name:"formula.functionList.CUBERANKEDMEMBER.functionParameter.number1.name",detail:"formula.functionList.CUBERANKEDMEMBER.functionParameter.number1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.CUBERANKEDMEMBER.functionParameter.number2.name",detail:"formula.functionList.CUBERANKEDMEMBER.functionParameter.number2.detail",example:"A1:A20",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_CUBE.CUBESET,functionType:t.FunctionType.Cube,description:"formula.functionList.CUBESET.description",abstract:"formula.functionList.CUBESET.abstract",functionParameter:[{name:"formula.functionList.CUBESET.functionParameter.number1.name",detail:"formula.functionList.CUBESET.functionParameter.number1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.CUBESET.functionParameter.number2.name",detail:"formula.functionList.CUBESET.functionParameter.number2.detail",example:"A1:A20",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_CUBE.CUBESETCOUNT,functionType:t.FunctionType.Cube,description:"formula.functionList.CUBESETCOUNT.description",abstract:"formula.functionList.CUBESETCOUNT.abstract",functionParameter:[{name:"formula.functionList.CUBESETCOUNT.functionParameter.number1.name",detail:"formula.functionList.CUBESETCOUNT.functionParameter.number1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.CUBESETCOUNT.functionParameter.number2.name",detail:"formula.functionList.CUBESETCOUNT.functionParameter.number2.detail",example:"A1:A20",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_CUBE.CUBEVALUE,functionType:t.FunctionType.Cube,description:"formula.functionList.CUBEVALUE.description",abstract:"formula.functionList.CUBEVALUE.abstract",functionParameter:[{name:"formula.functionList.CUBEVALUE.functionParameter.number1.name",detail:"formula.functionList.CUBEVALUE.functionParameter.number1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.CUBEVALUE.functionParameter.number2.name",detail:"formula.functionList.CUBEVALUE.functionParameter.number2.detail",example:"A1:A20",require:1,repeat:0}]}],ge=[{functionName:t.FUNCTION_NAMES_DATABASE.DAVERAGE,functionType:t.FunctionType.Database,description:"formula.functionList.DAVERAGE.description",abstract:"formula.functionList.DAVERAGE.abstract",functionParameter:[{name:"formula.functionList.DAVERAGE.functionParameter.database.name",detail:"formula.functionList.DAVERAGE.functionParameter.database.detail",example:"A4:E10",require:1,repeat:0},{name:"formula.functionList.DAVERAGE.functionParameter.field.name",detail:"formula.functionList.DAVERAGE.functionParameter.field.detail",example:"D4",require:1,repeat:0},{name:"formula.functionList.DAVERAGE.functionParameter.criteria.name",detail:"formula.functionList.DAVERAGE.functionParameter.criteria.detail",example:"A1:B2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATABASE.DCOUNT,functionType:t.FunctionType.Database,description:"formula.functionList.DCOUNT.description",abstract:"formula.functionList.DCOUNT.abstract",functionParameter:[{name:"formula.functionList.DCOUNT.functionParameter.database.name",detail:"formula.functionList.DCOUNT.functionParameter.database.detail",example:"A4:E10",require:1,repeat:0},{name:"formula.functionList.DCOUNT.functionParameter.field.name",detail:"formula.functionList.DCOUNT.functionParameter.field.detail",example:"D4",require:1,repeat:0},{name:"formula.functionList.DCOUNT.functionParameter.criteria.name",detail:"formula.functionList.DCOUNT.functionParameter.criteria.detail",example:"A1:B2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATABASE.DCOUNTA,functionType:t.FunctionType.Database,description:"formula.functionList.DCOUNTA.description",abstract:"formula.functionList.DCOUNTA.abstract",functionParameter:[{name:"formula.functionList.DCOUNTA.functionParameter.database.name",detail:"formula.functionList.DCOUNTA.functionParameter.database.detail",example:"A4:E10",require:1,repeat:0},{name:"formula.functionList.DCOUNTA.functionParameter.field.name",detail:"formula.functionList.DCOUNTA.functionParameter.field.detail",example:"D4",require:1,repeat:0},{name:"formula.functionList.DCOUNTA.functionParameter.criteria.name",detail:"formula.functionList.DCOUNTA.functionParameter.criteria.detail",example:"A1:B2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATABASE.DGET,functionType:t.FunctionType.Database,description:"formula.functionList.DGET.description",abstract:"formula.functionList.DGET.abstract",functionParameter:[{name:"formula.functionList.DGET.functionParameter.database.name",detail:"formula.functionList.DGET.functionParameter.database.detail",example:"A4:E10",require:1,repeat:0},{name:"formula.functionList.DGET.functionParameter.field.name",detail:"formula.functionList.DGET.functionParameter.field.detail",example:"D4",require:1,repeat:0},{name:"formula.functionList.DGET.functionParameter.criteria.name",detail:"formula.functionList.DGET.functionParameter.criteria.detail",example:"A1:B2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATABASE.DMAX,functionType:t.FunctionType.Database,description:"formula.functionList.DMAX.description",abstract:"formula.functionList.DMAX.abstract",functionParameter:[{name:"formula.functionList.DMAX.functionParameter.database.name",detail:"formula.functionList.DMAX.functionParameter.database.detail",example:"A4:E10",require:1,repeat:0},{name:"formula.functionList.DMAX.functionParameter.field.name",detail:"formula.functionList.DMAX.functionParameter.field.detail",example:"D4",require:1,repeat:0},{name:"formula.functionList.DMAX.functionParameter.criteria.name",detail:"formula.functionList.DMAX.functionParameter.criteria.detail",example:"A1:B2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATABASE.DMIN,functionType:t.FunctionType.Database,description:"formula.functionList.DMIN.description",abstract:"formula.functionList.DMIN.abstract",functionParameter:[{name:"formula.functionList.DMIN.functionParameter.database.name",detail:"formula.functionList.DMIN.functionParameter.database.detail",example:"A4:E10",require:1,repeat:0},{name:"formula.functionList.DMIN.functionParameter.field.name",detail:"formula.functionList.DMIN.functionParameter.field.detail",example:"D4",require:1,repeat:0},{name:"formula.functionList.DMIN.functionParameter.criteria.name",detail:"formula.functionList.DMIN.functionParameter.criteria.detail",example:"A1:B2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATABASE.DPRODUCT,functionType:t.FunctionType.Database,description:"formula.functionList.DPRODUCT.description",abstract:"formula.functionList.DPRODUCT.abstract",functionParameter:[{name:"formula.functionList.DPRODUCT.functionParameter.database.name",detail:"formula.functionList.DPRODUCT.functionParameter.database.detail",example:"A4:E10",require:1,repeat:0},{name:"formula.functionList.DPRODUCT.functionParameter.field.name",detail:"formula.functionList.DPRODUCT.functionParameter.field.detail",example:"D4",require:1,repeat:0},{name:"formula.functionList.DPRODUCT.functionParameter.criteria.name",detail:"formula.functionList.DPRODUCT.functionParameter.criteria.detail",example:"A1:B2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATABASE.DSTDEV,functionType:t.FunctionType.Database,description:"formula.functionList.DSTDEV.description",abstract:"formula.functionList.DSTDEV.abstract",functionParameter:[{name:"formula.functionList.DSTDEV.functionParameter.database.name",detail:"formula.functionList.DSTDEV.functionParameter.database.detail",example:"A4:E10",require:1,repeat:0},{name:"formula.functionList.DSTDEV.functionParameter.field.name",detail:"formula.functionList.DSTDEV.functionParameter.field.detail",example:"D4",require:1,repeat:0},{name:"formula.functionList.DSTDEV.functionParameter.criteria.name",detail:"formula.functionList.DSTDEV.functionParameter.criteria.detail",example:"A1:B2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATABASE.DSTDEVP,functionType:t.FunctionType.Database,description:"formula.functionList.DSTDEVP.description",abstract:"formula.functionList.DSTDEVP.abstract",functionParameter:[{name:"formula.functionList.DSTDEVP.functionParameter.database.name",detail:"formula.functionList.DSTDEVP.functionParameter.database.detail",example:"A4:E10",require:1,repeat:0},{name:"formula.functionList.DSTDEVP.functionParameter.field.name",detail:"formula.functionList.DSTDEVP.functionParameter.field.detail",example:"D4",require:1,repeat:0},{name:"formula.functionList.DSTDEVP.functionParameter.criteria.name",detail:"formula.functionList.DSTDEVP.functionParameter.criteria.detail",example:"A1:B2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATABASE.DSUM,functionType:t.FunctionType.Database,description:"formula.functionList.DSUM.description",abstract:"formula.functionList.DSUM.abstract",functionParameter:[{name:"formula.functionList.DSUM.functionParameter.database.name",detail:"formula.functionList.DSUM.functionParameter.database.detail",example:"A4:E10",require:1,repeat:0},{name:"formula.functionList.DSUM.functionParameter.field.name",detail:"formula.functionList.DSUM.functionParameter.field.detail",example:"D4",require:1,repeat:0},{name:"formula.functionList.DSUM.functionParameter.criteria.name",detail:"formula.functionList.DSUM.functionParameter.criteria.detail",example:"A1:B2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATABASE.DVAR,functionType:t.FunctionType.Database,description:"formula.functionList.DVAR.description",abstract:"formula.functionList.DVAR.abstract",functionParameter:[{name:"formula.functionList.DVAR.functionParameter.database.name",detail:"formula.functionList.DVAR.functionParameter.database.detail",example:"A4:E10",require:1,repeat:0},{name:"formula.functionList.DVAR.functionParameter.field.name",detail:"formula.functionList.DVAR.functionParameter.field.detail",example:"D4",require:1,repeat:0},{name:"formula.functionList.DVAR.functionParameter.criteria.name",detail:"formula.functionList.DVAR.functionParameter.criteria.detail",example:"A1:B2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATABASE.DVARP,functionType:t.FunctionType.Database,description:"formula.functionList.DVARP.description",abstract:"formula.functionList.DVARP.abstract",functionParameter:[{name:"formula.functionList.DVARP.functionParameter.database.name",detail:"formula.functionList.DVARP.functionParameter.database.detail",example:"A4:E10",require:1,repeat:0},{name:"formula.functionList.DVARP.functionParameter.field.name",detail:"formula.functionList.DVARP.functionParameter.field.detail",example:"D4",require:1,repeat:0},{name:"formula.functionList.DVARP.functionParameter.criteria.name",detail:"formula.functionList.DVARP.functionParameter.criteria.detail",example:"A1:B2",require:1,repeat:0}]}],Ke=[{functionName:t.FUNCTION_NAMES_DATE.DATE,functionType:t.FunctionType.Date,description:"formula.functionList.DATE.description",abstract:"formula.functionList.DATE.abstract",functionParameter:[{name:"formula.functionList.DATE.functionParameter.year.name",detail:"formula.functionList.DATE.functionParameter.year.detail",example:"2024",require:1,repeat:0},{name:"formula.functionList.DATE.functionParameter.month.name",detail:"formula.functionList.DATE.functionParameter.month.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.DATE.functionParameter.day.name",detail:"formula.functionList.DATE.functionParameter.day.detail",example:"1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATE.DATEDIF,functionType:t.FunctionType.Date,description:"formula.functionList.DATEDIF.description",abstract:"formula.functionList.DATEDIF.abstract",functionParameter:[{name:"formula.functionList.DATEDIF.functionParameter.startDate.name",detail:"formula.functionList.DATEDIF.functionParameter.startDate.detail",example:'"2001-6-1"',require:1,repeat:0},{name:"formula.functionList.DATEDIF.functionParameter.endDate.name",detail:"formula.functionList.DATEDIF.functionParameter.endDate.detail",example:'"2002-8-15"',require:1,repeat:0},{name:"formula.functionList.DATEDIF.functionParameter.method.name",detail:"formula.functionList.DATEDIF.functionParameter.method.detail",example:'"D"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATE.DATEVALUE,functionType:t.FunctionType.Date,description:"formula.functionList.DATEVALUE.description",abstract:"formula.functionList.DATEVALUE.abstract",functionParameter:[{name:"formula.functionList.DATEVALUE.functionParameter.dateText.name",detail:"formula.functionList.DATEVALUE.functionParameter.dateText.detail",example:'"2024-8-8"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATE.DAY,functionType:t.FunctionType.Date,description:"formula.functionList.DAY.description",abstract:"formula.functionList.DAY.abstract",functionParameter:[{name:"formula.functionList.DAY.functionParameter.serialNumber.name",detail:"formula.functionList.DAY.functionParameter.serialNumber.detail",example:'"1969-7-20"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATE.DAYS,functionType:t.FunctionType.Date,description:"formula.functionList.DAYS.description",abstract:"formula.functionList.DAYS.abstract",functionParameter:[{name:"formula.functionList.DAYS.functionParameter.endDate.name",detail:"formula.functionList.DAYS.functionParameter.endDate.detail",example:'"2021-12-31"',require:1,repeat:0},{name:"formula.functionList.DAYS.functionParameter.startDate.name",detail:"formula.functionList.DAYS.functionParameter.startDate.detail",example:'"2021-1-1"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATE.DAYS360,functionType:t.FunctionType.Date,description:"formula.functionList.DAYS360.description",abstract:"formula.functionList.DAYS360.abstract",functionParameter:[{name:"formula.functionList.DAYS360.functionParameter.startDate.name",detail:"formula.functionList.DAYS360.functionParameter.startDate.detail",example:'"2021-1-29"',require:1,repeat:0},{name:"formula.functionList.DAYS360.functionParameter.endDate.name",detail:"formula.functionList.DAYS360.functionParameter.endDate.detail",example:'"2021-3-31"',require:1,repeat:0},{name:"formula.functionList.DAYS360.functionParameter.method.name",detail:"formula.functionList.DAYS360.functionParameter.method.detail",example:"1",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATE.EDATE,functionType:t.FunctionType.Date,description:"formula.functionList.EDATE.description",abstract:"formula.functionList.EDATE.abstract",functionParameter:[{name:"formula.functionList.EDATE.functionParameter.startDate.name",detail:"formula.functionList.EDATE.functionParameter.startDate.detail",example:"A1",require:1,repeat:0},{name:"formula.functionList.EDATE.functionParameter.months.name",detail:"formula.functionList.EDATE.functionParameter.months.detail",example:"1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATE.EOMONTH,functionType:t.FunctionType.Date,description:"formula.functionList.EOMONTH.description",abstract:"formula.functionList.EOMONTH.abstract",functionParameter:[{name:"formula.functionList.EOMONTH.functionParameter.startDate.name",detail:"formula.functionList.EOMONTH.functionParameter.startDate.detail",example:'"2011-1-1"',require:1,repeat:0},{name:"formula.functionList.EOMONTH.functionParameter.months.name",detail:"formula.functionList.EOMONTH.functionParameter.months.detail",example:"1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATE.EPOCHTODATE,functionType:t.FunctionType.Date,description:"formula.functionList.EPOCHTODATE.description",abstract:"formula.functionList.EPOCHTODATE.abstract",functionParameter:[{name:"formula.functionList.EPOCHTODATE.functionParameter.timestamp.name",detail:"formula.functionList.EPOCHTODATE.functionParameter.timestamp.detail",example:"1655906710",require:1,repeat:0},{name:"formula.functionList.EPOCHTODATE.functionParameter.unit.name",detail:"formula.functionList.EPOCHTODATE.functionParameter.unit.detail",example:"1",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATE.HOUR,functionType:t.FunctionType.Date,description:"formula.functionList.HOUR.description",abstract:"formula.functionList.HOUR.abstract",functionParameter:[{name:"formula.functionList.HOUR.functionParameter.serialNumber.name",detail:"formula.functionList.HOUR.functionParameter.serialNumber.detail",example:'"2011-7-18 7:45"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATE.ISOWEEKNUM,functionType:t.FunctionType.Date,description:"formula.functionList.ISOWEEKNUM.description",abstract:"formula.functionList.ISOWEEKNUM.abstract",functionParameter:[{name:"formula.functionList.ISOWEEKNUM.functionParameter.date.name",detail:"formula.functionList.ISOWEEKNUM.functionParameter.date.detail",example:'"2012-3-9"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATE.MINUTE,functionType:t.FunctionType.Date,description:"formula.functionList.MINUTE.description",abstract:"formula.functionList.MINUTE.abstract",functionParameter:[{name:"formula.functionList.MINUTE.functionParameter.serialNumber.name",detail:"formula.functionList.MINUTE.functionParameter.serialNumber.detail",example:'"12:45"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATE.MONTH,functionType:t.FunctionType.Date,description:"formula.functionList.MONTH.description",abstract:"formula.functionList.MONTH.abstract",functionParameter:[{name:"formula.functionList.MONTH.functionParameter.serialNumber.name",detail:"formula.functionList.MONTH.functionParameter.serialNumber.detail",example:'"1969-7-20"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATE.NETWORKDAYS,functionType:t.FunctionType.Date,description:"formula.functionList.NETWORKDAYS.description",abstract:"formula.functionList.NETWORKDAYS.abstract",functionParameter:[{name:"formula.functionList.NETWORKDAYS.functionParameter.startDate.name",detail:"formula.functionList.NETWORKDAYS.functionParameter.startDate.detail",example:'"2012-10-1"',require:1,repeat:0},{name:"formula.functionList.NETWORKDAYS.functionParameter.endDate.name",detail:"formula.functionList.NETWORKDAYS.functionParameter.endDate.detail",example:'"2013-3-1"',require:1,repeat:0},{name:"formula.functionList.NETWORKDAYS.functionParameter.holidays.name",detail:"formula.functionList.NETWORKDAYS.functionParameter.holidays.detail",example:'"2012-11-22"',require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATE.NETWORKDAYS_INTL,functionType:t.FunctionType.Date,description:"formula.functionList.NETWORKDAYS_INTL.description",abstract:"formula.functionList.NETWORKDAYS_INTL.abstract",functionParameter:[{name:"formula.functionList.NETWORKDAYS_INTL.functionParameter.startDate.name",detail:"formula.functionList.NETWORKDAYS_INTL.functionParameter.startDate.detail",example:'"2012-10-1"',require:1,repeat:0},{name:"formula.functionList.NETWORKDAYS_INTL.functionParameter.endDate.name",detail:"formula.functionList.NETWORKDAYS_INTL.functionParameter.endDate.detail",example:'"2013-3-1"',require:1,repeat:0},{name:"formula.functionList.NETWORKDAYS_INTL.functionParameter.weekend.name",detail:"formula.functionList.NETWORKDAYS_INTL.functionParameter.weekend.detail",example:"6",require:0,repeat:0},{name:"formula.functionList.NETWORKDAYS_INTL.functionParameter.holidays.name",detail:"formula.functionList.NETWORKDAYS_INTL.functionParameter.holidays.detail",example:'"2012-11-22"',require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATE.NOW,functionType:t.FunctionType.Date,description:"formula.functionList.NOW.description",abstract:"formula.functionList.NOW.abstract",functionParameter:[]},{functionName:t.FUNCTION_NAMES_DATE.SECOND,functionType:t.FunctionType.Date,description:"formula.functionList.SECOND.description",abstract:"formula.functionList.SECOND.abstract",functionParameter:[{name:"formula.functionList.SECOND.functionParameter.serialNumber.name",detail:"formula.functionList.SECOND.functionParameter.serialNumber.detail",example:'"4:48:18"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATE.TIME,functionType:t.FunctionType.Date,description:"formula.functionList.TIME.description",abstract:"formula.functionList.TIME.abstract",functionParameter:[{name:"formula.functionList.TIME.functionParameter.hour.name",detail:"formula.functionList.TIME.functionParameter.hour.detail",example:"15",require:1,repeat:0},{name:"formula.functionList.TIME.functionParameter.minute.name",detail:"formula.functionList.TIME.functionParameter.minute.detail",example:"20",require:1,repeat:0},{name:"formula.functionList.TIME.functionParameter.second.name",detail:"formula.functionList.TIME.functionParameter.second.detail",example:"59",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATE.TIMEVALUE,functionType:t.FunctionType.Date,description:"formula.functionList.TIMEVALUE.description",abstract:"formula.functionList.TIMEVALUE.abstract",functionParameter:[{name:"formula.functionList.TIMEVALUE.functionParameter.timeText.name",detail:"formula.functionList.TIMEVALUE.functionParameter.timeText.detail",example:'"15:20:59"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATE.TO_DATE,functionType:t.FunctionType.Date,description:"formula.functionList.TO_DATE.description",abstract:"formula.functionList.TO_DATE.abstract",functionParameter:[{name:"formula.functionList.TO_DATE.functionParameter.value.name",detail:"formula.functionList.TO_DATE.functionParameter.value.detail",example:"40826.4375",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATE.TODAY,functionType:t.FunctionType.Date,description:"formula.functionList.TODAY.description",abstract:"formula.functionList.TODAY.abstract",functionParameter:[]},{functionName:t.FUNCTION_NAMES_DATE.WEEKDAY,functionType:t.FunctionType.Date,description:"formula.functionList.WEEKDAY.description",abstract:"formula.functionList.WEEKDAY.abstract",functionParameter:[{name:"formula.functionList.WEEKDAY.functionParameter.serialNumber.name",detail:"formula.functionList.WEEKDAY.functionParameter.serialNumber.detail",example:'"2008-2-14"',require:1,repeat:0},{name:"formula.functionList.WEEKDAY.functionParameter.returnType.name",detail:"formula.functionList.WEEKDAY.functionParameter.returnType.detail",example:"2",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATE.WEEKNUM,functionType:t.FunctionType.Date,description:"formula.functionList.WEEKNUM.description",abstract:"formula.functionList.WEEKNUM.abstract",functionParameter:[{name:"formula.functionList.WEEKNUM.functionParameter.serialNumber.name",detail:"formula.functionList.WEEKNUM.functionParameter.serialNumber.detail",example:'"2012-3-9"',require:1,repeat:0},{name:"formula.functionList.WEEKNUM.functionParameter.returnType.name",detail:"formula.functionList.WEEKNUM.functionParameter.returnType.detail",example:"2",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATE.WORKDAY,functionType:t.FunctionType.Date,description:"formula.functionList.WORKDAY.description",abstract:"formula.functionList.WORKDAY.abstract",functionParameter:[{name:"formula.functionList.WORKDAY.functionParameter.startDate.name",detail:"formula.functionList.WORKDAY.functionParameter.startDate.detail",example:'"2008-10-1"',require:1,repeat:0},{name:"formula.functionList.WORKDAY.functionParameter.days.name",detail:"formula.functionList.WORKDAY.functionParameter.days.detail",example:"151",require:1,repeat:0},{name:"formula.functionList.WORKDAY.functionParameter.holidays.name",detail:"formula.functionList.WORKDAY.functionParameter.holidays.detail",example:'"2008-11-26"',require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATE.WORKDAY_INTL,functionType:t.FunctionType.Date,description:"formula.functionList.WORKDAY_INTL.description",abstract:"formula.functionList.WORKDAY_INTL.abstract",functionParameter:[{name:"formula.functionList.WORKDAY_INTL.functionParameter.startDate.name",detail:"formula.functionList.WORKDAY_INTL.functionParameter.startDate.detail",example:'"2008-10-1"',require:1,repeat:0},{name:"formula.functionList.WORKDAY_INTL.functionParameter.days.name",detail:"formula.functionList.WORKDAY_INTL.functionParameter.days.detail",example:"151",require:1,repeat:0},{name:"formula.functionList.WORKDAY_INTL.functionParameter.weekend.name",detail:"formula.functionList.WORKDAY_INTL.functionParameter.weekend.detail",example:"6",require:0,repeat:0},{name:"formula.functionList.WORKDAY_INTL.functionParameter.holidays.name",detail:"formula.functionList.WORKDAY_INTL.functionParameter.holidays.detail",example:'"2008-11-26"',require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATE.YEAR,functionType:t.FunctionType.Date,description:"formula.functionList.YEAR.description",abstract:"formula.functionList.YEAR.abstract",functionParameter:[{name:"formula.functionList.YEAR.functionParameter.serialNumber.name",detail:"formula.functionList.YEAR.functionParameter.serialNumber.detail",example:'"1969-7-20"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATE.YEARFRAC,functionType:t.FunctionType.Date,description:"formula.functionList.YEARFRAC.description",abstract:"formula.functionList.YEARFRAC.abstract",functionParameter:[{name:"formula.functionList.YEARFRAC.functionParameter.startDate.name",detail:"formula.functionList.YEARFRAC.functionParameter.startDate.detail",example:'"2012-1-1"',require:1,repeat:0},{name:"formula.functionList.YEARFRAC.functionParameter.endDate.name",detail:"formula.functionList.YEARFRAC.functionParameter.endDate.detail",example:'"2012-7-30"',require:1,repeat:0},{name:"formula.functionList.YEARFRAC.functionParameter.basis.name",detail:"formula.functionList.YEARFRAC.functionParameter.basis.detail",example:"1",require:0,repeat:0}]}],ke=[{functionName:t.FUNCTION_NAMES_ENGINEERING.BESSELI,functionType:t.FunctionType.Engineering,description:"formula.functionList.BESSELI.description",abstract:"formula.functionList.BESSELI.abstract",functionParameter:[{name:"formula.functionList.BESSELI.functionParameter.x.name",detail:"formula.functionList.BESSELI.functionParameter.x.detail",example:"1.5",require:1,repeat:0},{name:"formula.functionList.BESSELI.functionParameter.n.name",detail:"formula.functionList.BESSELI.functionParameter.n.detail",example:"1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.BESSELJ,functionType:t.FunctionType.Engineering,description:"formula.functionList.BESSELJ.description",abstract:"formula.functionList.BESSELJ.abstract",functionParameter:[{name:"formula.functionList.BESSELJ.functionParameter.x.name",detail:"formula.functionList.BESSELJ.functionParameter.x.detail",example:"1.5",require:1,repeat:0},{name:"formula.functionList.BESSELJ.functionParameter.n.name",detail:"formula.functionList.BESSELJ.functionParameter.n.detail",example:"1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.BESSELK,functionType:t.FunctionType.Engineering,description:"formula.functionList.BESSELK.description",abstract:"formula.functionList.BESSELK.abstract",functionParameter:[{name:"formula.functionList.BESSELK.functionParameter.x.name",detail:"formula.functionList.BESSELK.functionParameter.x.detail",example:"1.5",require:1,repeat:0},{name:"formula.functionList.BESSELK.functionParameter.n.name",detail:"formula.functionList.BESSELK.functionParameter.n.detail",example:"1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.BESSELY,functionType:t.FunctionType.Engineering,description:"formula.functionList.BESSELY.description",abstract:"formula.functionList.BESSELY.abstract",functionParameter:[{name:"formula.functionList.BESSELY.functionParameter.x.name",detail:"formula.functionList.BESSELY.functionParameter.x.detail",example:"1.5",require:1,repeat:0},{name:"formula.functionList.BESSELY.functionParameter.n.name",detail:"formula.functionList.BESSELY.functionParameter.n.detail",example:"1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.BIN2DEC,functionType:t.FunctionType.Engineering,description:"formula.functionList.BIN2DEC.description",abstract:"formula.functionList.BIN2DEC.abstract",functionParameter:[{name:"formula.functionList.BIN2DEC.functionParameter.number.name",detail:"formula.functionList.BIN2DEC.functionParameter.number.detail",example:"1100100",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.BIN2HEX,functionType:t.FunctionType.Engineering,description:"formula.functionList.BIN2HEX.description",abstract:"formula.functionList.BIN2HEX.abstract",functionParameter:[{name:"formula.functionList.BIN2HEX.functionParameter.number.name",detail:"formula.functionList.BIN2HEX.functionParameter.number.detail",example:"11111011",require:1,repeat:0},{name:"formula.functionList.BIN2HEX.functionParameter.places.name",detail:"formula.functionList.BIN2HEX.functionParameter.places.detail",example:"4",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.BIN2OCT,functionType:t.FunctionType.Engineering,description:"formula.functionList.BIN2OCT.description",abstract:"formula.functionList.BIN2OCT.abstract",functionParameter:[{name:"formula.functionList.BIN2OCT.functionParameter.number.name",detail:"formula.functionList.BIN2OCT.functionParameter.number.detail",example:"1001",require:1,repeat:0},{name:"formula.functionList.BIN2OCT.functionParameter.places.name",detail:"formula.functionList.BIN2OCT.functionParameter.places.detail",example:"3",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.BITAND,functionType:t.FunctionType.Engineering,description:"formula.functionList.BITAND.description",abstract:"formula.functionList.BITAND.abstract",functionParameter:[{name:"formula.functionList.BITAND.functionParameter.number1.name",detail:"formula.functionList.BITAND.functionParameter.number1.detail",example:"13",require:1,repeat:0},{name:"formula.functionList.BITAND.functionParameter.number2.name",detail:"formula.functionList.BITAND.functionParameter.number2.detail",example:"25",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.BITLSHIFT,functionType:t.FunctionType.Engineering,description:"formula.functionList.BITLSHIFT.description",abstract:"formula.functionList.BITLSHIFT.abstract",functionParameter:[{name:"formula.functionList.BITLSHIFT.functionParameter.number.name",detail:"formula.functionList.BITLSHIFT.functionParameter.number.detail",example:"4",require:1,repeat:0},{name:"formula.functionList.BITLSHIFT.functionParameter.shiftAmount.name",detail:"formula.functionList.BITLSHIFT.functionParameter.shiftAmount.detail",example:"2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.BITOR,functionType:t.FunctionType.Engineering,description:"formula.functionList.BITOR.description",abstract:"formula.functionList.BITOR.abstract",functionParameter:[{name:"formula.functionList.BITOR.functionParameter.number1.name",detail:"formula.functionList.BITOR.functionParameter.number1.detail",example:"23",require:1,repeat:0},{name:"formula.functionList.BITOR.functionParameter.number2.name",detail:"formula.functionList.BITOR.functionParameter.number2.detail",example:"10",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.BITRSHIFT,functionType:t.FunctionType.Engineering,description:"formula.functionList.BITRSHIFT.description",abstract:"formula.functionList.BITRSHIFT.abstract",functionParameter:[{name:"formula.functionList.BITRSHIFT.functionParameter.number.name",detail:"formula.functionList.BITRSHIFT.functionParameter.number.detail",example:"13",require:1,repeat:0},{name:"formula.functionList.BITRSHIFT.functionParameter.shiftAmount.name",detail:"formula.functionList.BITRSHIFT.functionParameter.shiftAmount.detail",example:"2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.BITXOR,functionType:t.FunctionType.Engineering,description:"formula.functionList.BITXOR.description",abstract:"formula.functionList.BITXOR.abstract",functionParameter:[{name:"formula.functionList.BITXOR.functionParameter.number1.name",detail:"formula.functionList.BITXOR.functionParameter.number1.detail",example:"5",require:1,repeat:0},{name:"formula.functionList.BITXOR.functionParameter.number2.name",detail:"formula.functionList.BITXOR.functionParameter.number2.detail",example:"3",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.COMPLEX,functionType:t.FunctionType.Engineering,description:"formula.functionList.COMPLEX.description",abstract:"formula.functionList.COMPLEX.abstract",functionParameter:[{name:"formula.functionList.COMPLEX.functionParameter.realNum.name",detail:"formula.functionList.COMPLEX.functionParameter.realNum.detail",example:"3",require:1,repeat:0},{name:"formula.functionList.COMPLEX.functionParameter.iNum.name",detail:"formula.functionList.COMPLEX.functionParameter.iNum.detail",example:"4",require:1,repeat:0},{name:"formula.functionList.COMPLEX.functionParameter.suffix.name",detail:"formula.functionList.COMPLEX.functionParameter.suffix.detail",example:'"i"',require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.CONVERT,functionType:t.FunctionType.Engineering,description:"formula.functionList.CONVERT.description",abstract:"formula.functionList.CONVERT.abstract",functionParameter:[{name:"formula.functionList.CONVERT.functionParameter.number.name",detail:"formula.functionList.CONVERT.functionParameter.number.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.CONVERT.functionParameter.fromUnit.name",detail:"formula.functionList.CONVERT.functionParameter.fromUnit.detail",example:'"lbm"',require:1,repeat:0},{name:"formula.functionList.CONVERT.functionParameter.toUnit.name",detail:"formula.functionList.CONVERT.functionParameter.toUnit.detail",example:'"kg"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.DEC2BIN,functionType:t.FunctionType.Engineering,description:"formula.functionList.DEC2BIN.description",abstract:"formula.functionList.DEC2BIN.abstract",functionParameter:[{name:"formula.functionList.DEC2BIN.functionParameter.number.name",detail:"formula.functionList.DEC2BIN.functionParameter.number.detail",example:"9",require:1,repeat:0},{name:"formula.functionList.DEC2BIN.functionParameter.places.name",detail:"formula.functionList.DEC2BIN.functionParameter.places.detail",example:"4",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.DEC2HEX,functionType:t.FunctionType.Engineering,description:"formula.functionList.DEC2HEX.description",abstract:"formula.functionList.DEC2HEX.abstract",functionParameter:[{name:"formula.functionList.DEC2HEX.functionParameter.number.name",detail:"formula.functionList.DEC2HEX.functionParameter.number.detail",example:"100",require:1,repeat:0},{name:"formula.functionList.DEC2HEX.functionParameter.places.name",detail:"formula.functionList.DEC2HEX.functionParameter.places.detail",example:"4",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.DEC2OCT,functionType:t.FunctionType.Engineering,description:"formula.functionList.DEC2OCT.description",abstract:"formula.functionList.DEC2OCT.abstract",functionParameter:[{name:"formula.functionList.DEC2OCT.functionParameter.number.name",detail:"formula.functionList.DEC2OCT.functionParameter.number.detail",example:"58",require:1,repeat:0},{name:"formula.functionList.DEC2OCT.functionParameter.places.name",detail:"formula.functionList.DEC2OCT.functionParameter.places.detail",example:"3",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.DELTA,functionType:t.FunctionType.Engineering,description:"formula.functionList.DELTA.description",abstract:"formula.functionList.DELTA.abstract",functionParameter:[{name:"formula.functionList.DELTA.functionParameter.number1.name",detail:"formula.functionList.DELTA.functionParameter.number1.detail",example:"5",require:1,repeat:0},{name:"formula.functionList.DELTA.functionParameter.number2.name",detail:"formula.functionList.DELTA.functionParameter.number2.detail",example:"4",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.ERF,functionType:t.FunctionType.Engineering,description:"formula.functionList.ERF.description",abstract:"formula.functionList.ERF.abstract",functionParameter:[{name:"formula.functionList.ERF.functionParameter.lowerLimit.name",detail:"formula.functionList.ERF.functionParameter.lowerLimit.detail",example:"0.745",require:1,repeat:0},{name:"formula.functionList.ERF.functionParameter.upperLimit.name",detail:"formula.functionList.ERF.functionParameter.upperLimit.detail",example:"2",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.ERF_PRECISE,functionType:t.FunctionType.Engineering,description:"formula.functionList.ERF_PRECISE.description",abstract:"formula.functionList.ERF_PRECISE.abstract",functionParameter:[{name:"formula.functionList.ERF_PRECISE.functionParameter.x.name",detail:"formula.functionList.ERF_PRECISE.functionParameter.x.detail",example:"1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.ERFC,functionType:t.FunctionType.Engineering,description:"formula.functionList.ERFC.description",abstract:"formula.functionList.ERFC.abstract",functionParameter:[{name:"formula.functionList.ERFC.functionParameter.x.name",detail:"formula.functionList.ERFC.functionParameter.x.detail",example:"1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.ERFC_PRECISE,functionType:t.FunctionType.Engineering,description:"formula.functionList.ERFC_PRECISE.description",abstract:"formula.functionList.ERFC_PRECISE.abstract",functionParameter:[{name:"formula.functionList.ERFC_PRECISE.functionParameter.x.name",detail:"formula.functionList.ERFC_PRECISE.functionParameter.x.detail",example:"1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.GESTEP,functionType:t.FunctionType.Engineering,description:"formula.functionList.GESTEP.description",abstract:"formula.functionList.GESTEP.abstract",functionParameter:[{name:"formula.functionList.GESTEP.functionParameter.number.name",detail:"formula.functionList.GESTEP.functionParameter.number.detail",example:"5",require:1,repeat:0},{name:"formula.functionList.GESTEP.functionParameter.step.name",detail:"formula.functionList.GESTEP.functionParameter.step.detail",example:"4",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.HEX2BIN,functionType:t.FunctionType.Engineering,description:"formula.functionList.HEX2BIN.description",abstract:"formula.functionList.HEX2BIN.abstract",functionParameter:[{name:"formula.functionList.HEX2BIN.functionParameter.number.name",detail:"formula.functionList.HEX2BIN.functionParameter.number.detail",example:'"F"',require:1,repeat:0},{name:"formula.functionList.HEX2BIN.functionParameter.places.name",detail:"formula.functionList.HEX2BIN.functionParameter.places.detail",example:"8",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.HEX2DEC,functionType:t.FunctionType.Engineering,description:"formula.functionList.HEX2DEC.description",abstract:"formula.functionList.HEX2DEC.abstract",functionParameter:[{name:"formula.functionList.HEX2DEC.functionParameter.number.name",detail:"formula.functionList.HEX2DEC.functionParameter.number.detail",example:'"A5"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.HEX2OCT,functionType:t.FunctionType.Engineering,description:"formula.functionList.HEX2OCT.description",abstract:"formula.functionList.HEX2OCT.abstract",functionParameter:[{name:"formula.functionList.HEX2OCT.functionParameter.number.name",detail:"formula.functionList.HEX2OCT.functionParameter.number.detail",example:'"F"',require:1,repeat:0},{name:"formula.functionList.HEX2OCT.functionParameter.places.name",detail:"formula.functionList.HEX2OCT.functionParameter.places.detail",example:"3",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.IMABS,functionType:t.FunctionType.Engineering,description:"formula.functionList.IMABS.description",abstract:"formula.functionList.IMABS.abstract",functionParameter:[{name:"formula.functionList.IMABS.functionParameter.inumber.name",detail:"formula.functionList.IMABS.functionParameter.inumber.detail",example:'"5+12i"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.IMAGINARY,functionType:t.FunctionType.Engineering,description:"formula.functionList.IMAGINARY.description",abstract:"formula.functionList.IMAGINARY.abstract",functionParameter:[{name:"formula.functionList.IMAGINARY.functionParameter.inumber.name",detail:"formula.functionList.IMAGINARY.functionParameter.inumber.detail",example:'"3+4i"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.IMARGUMENT,functionType:t.FunctionType.Engineering,description:"formula.functionList.IMARGUMENT.description",abstract:"formula.functionList.IMARGUMENT.abstract",functionParameter:[{name:"formula.functionList.IMARGUMENT.functionParameter.inumber.name",detail:"formula.functionList.IMARGUMENT.functionParameter.inumber.detail",example:'"3+4i"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.IMCONJUGATE,functionType:t.FunctionType.Engineering,description:"formula.functionList.IMCONJUGATE.description",abstract:"formula.functionList.IMCONJUGATE.abstract",functionParameter:[{name:"formula.functionList.IMCONJUGATE.functionParameter.inumber.name",detail:"formula.functionList.IMCONJUGATE.functionParameter.inumber.detail",example:'"3+4i"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.IMCOS,functionType:t.FunctionType.Engineering,description:"formula.functionList.IMCOS.description",abstract:"formula.functionList.IMCOS.abstract",functionParameter:[{name:"formula.functionList.IMCOS.functionParameter.inumber.name",detail:"formula.functionList.IMCOS.functionParameter.inumber.detail",example:'"1+i"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.IMCOSH,functionType:t.FunctionType.Engineering,description:"formula.functionList.IMCOSH.description",abstract:"formula.functionList.IMCOSH.abstract",functionParameter:[{name:"formula.functionList.IMCOSH.functionParameter.inumber.name",detail:"formula.functionList.IMCOSH.functionParameter.inumber.detail",example:'"4+3i"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.IMCOT,functionType:t.FunctionType.Engineering,description:"formula.functionList.IMCOT.description",abstract:"formula.functionList.IMCOT.abstract",functionParameter:[{name:"formula.functionList.IMCOT.functionParameter.inumber.name",detail:"formula.functionList.IMCOT.functionParameter.inumber.detail",example:'"4+3i"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.IMCOTH,functionType:t.FunctionType.Engineering,description:"formula.functionList.IMCOTH.description",abstract:"formula.functionList.IMCOTH.abstract",functionParameter:[{name:"formula.functionList.IMCOTH.functionParameter.inumber.name",detail:"formula.functionList.IMCOTH.functionParameter.inumber.detail",example:'"4+3i"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.IMCSC,functionType:t.FunctionType.Engineering,description:"formula.functionList.IMCSC.description",abstract:"formula.functionList.IMCSC.abstract",functionParameter:[{name:"formula.functionList.IMCSC.functionParameter.inumber.name",detail:"formula.functionList.IMCSC.functionParameter.inumber.detail",example:'"4+3i"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.IMCSCH,functionType:t.FunctionType.Engineering,description:"formula.functionList.IMCSCH.description",abstract:"formula.functionList.IMCSCH.abstract",functionParameter:[{name:"formula.functionList.IMCSCH.functionParameter.inumber.name",detail:"formula.functionList.IMCSCH.functionParameter.inumber.detail",example:'"4+3i"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.IMDIV,functionType:t.FunctionType.Engineering,description:"formula.functionList.IMDIV.description",abstract:"formula.functionList.IMDIV.abstract",functionParameter:[{name:"formula.functionList.IMDIV.functionParameter.inumber1.name",detail:"formula.functionList.IMDIV.functionParameter.inumber1.detail",example:'"-238+240i"',require:1,repeat:0},{name:"formula.functionList.IMDIV.functionParameter.inumber2.name",detail:"formula.functionList.IMDIV.functionParameter.inumber2.detail",example:'"10+24i"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.IMEXP,functionType:t.FunctionType.Engineering,description:"formula.functionList.IMEXP.description",abstract:"formula.functionList.IMEXP.abstract",functionParameter:[{name:"formula.functionList.IMEXP.functionParameter.inumber.name",detail:"formula.functionList.IMEXP.functionParameter.inumber.detail",example:'"1+i"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.IMLN,functionType:t.FunctionType.Engineering,description:"formula.functionList.IMLN.description",abstract:"formula.functionList.IMLN.abstract",functionParameter:[{name:"formula.functionList.IMLN.functionParameter.inumber.name",detail:"formula.functionList.IMLN.functionParameter.inumber.detail",example:'"3+4i"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.IMLOG,functionType:t.FunctionType.Engineering,description:"formula.functionList.IMLOG.description",abstract:"formula.functionList.IMLOG.abstract",functionParameter:[{name:"formula.functionList.IMLOG.functionParameter.inumber.name",detail:"formula.functionList.IMLOG.functionParameter.inumber.detail",example:'"3+4i"',require:1,repeat:0},{name:"formula.functionList.IMLOG.functionParameter.base.name",detail:"formula.functionList.IMLOG.functionParameter.base.detail",example:"10",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.IMLOG10,functionType:t.FunctionType.Engineering,description:"formula.functionList.IMLOG10.description",abstract:"formula.functionList.IMLOG10.abstract",functionParameter:[{name:"formula.functionList.IMLOG10.functionParameter.inumber.name",detail:"formula.functionList.IMLOG10.functionParameter.inumber.detail",example:'"3+4i"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.IMLOG2,functionType:t.FunctionType.Engineering,description:"formula.functionList.IMLOG2.description",abstract:"formula.functionList.IMLOG2.abstract",functionParameter:[{name:"formula.functionList.IMLOG2.functionParameter.inumber.name",detail:"formula.functionList.IMLOG2.functionParameter.inumber.detail",example:'"3+4i"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.IMPOWER,functionType:t.FunctionType.Engineering,description:"formula.functionList.IMPOWER.description",abstract:"formula.functionList.IMPOWER.abstract",functionParameter:[{name:"formula.functionList.IMPOWER.functionParameter.inumber.name",detail:"formula.functionList.IMPOWER.functionParameter.inumber.detail",example:'"2+3i"',require:1,repeat:0},{name:"formula.functionList.IMPOWER.functionParameter.number.name",detail:"formula.functionList.IMPOWER.functionParameter.number.detail",example:"3",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.IMPRODUCT,functionType:t.FunctionType.Engineering,description:"formula.functionList.IMPRODUCT.description",abstract:"formula.functionList.IMPRODUCT.abstract",functionParameter:[{name:"formula.functionList.IMPRODUCT.functionParameter.inumber1.name",detail:"formula.functionList.IMPRODUCT.functionParameter.inumber1.detail",example:'"3+4i"',require:1,repeat:0},{name:"formula.functionList.IMPRODUCT.functionParameter.inumber2.name",detail:"formula.functionList.IMPRODUCT.functionParameter.inumber2.detail",example:'"5-3i"',require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.IMREAL,functionType:t.FunctionType.Engineering,description:"formula.functionList.IMREAL.description",abstract:"formula.functionList.IMREAL.abstract",functionParameter:[{name:"formula.functionList.IMREAL.functionParameter.inumber.name",detail:"formula.functionList.IMREAL.functionParameter.inumber.detail",example:'"6-9i"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.IMSEC,functionType:t.FunctionType.Engineering,description:"formula.functionList.IMSEC.description",abstract:"formula.functionList.IMSEC.abstract",functionParameter:[{name:"formula.functionList.IMSEC.functionParameter.inumber.name",detail:"formula.functionList.IMSEC.functionParameter.inumber.detail",example:'"4+3i"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.IMSECH,functionType:t.FunctionType.Engineering,description:"formula.functionList.IMSECH.description",abstract:"formula.functionList.IMSECH.abstract",functionParameter:[{name:"formula.functionList.IMSECH.functionParameter.inumber.name",detail:"formula.functionList.IMSECH.functionParameter.inumber.detail",example:'"4+3i"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.IMSIN,functionType:t.FunctionType.Engineering,description:"formula.functionList.IMSIN.description",abstract:"formula.functionList.IMSIN.abstract",functionParameter:[{name:"formula.functionList.IMSIN.functionParameter.inumber.name",detail:"formula.functionList.IMSIN.functionParameter.inumber.detail",example:'"4+3i"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.IMSINH,functionType:t.FunctionType.Engineering,description:"formula.functionList.IMSINH.description",abstract:"formula.functionList.IMSINH.abstract",functionParameter:[{name:"formula.functionList.IMSINH.functionParameter.inumber.name",detail:"formula.functionList.IMSINH.functionParameter.inumber.detail",example:'"4+3i"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.IMSQRT,functionType:t.FunctionType.Engineering,description:"formula.functionList.IMSQRT.description",abstract:"formula.functionList.IMSQRT.abstract",functionParameter:[{name:"formula.functionList.IMSQRT.functionParameter.inumber.name",detail:"formula.functionList.IMSQRT.functionParameter.inumber.detail",example:'"1+i"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.IMSUB,functionType:t.FunctionType.Engineering,description:"formula.functionList.IMSUB.description",abstract:"formula.functionList.IMSUB.abstract",functionParameter:[{name:"formula.functionList.IMSUB.functionParameter.inumber1.name",detail:"formula.functionList.IMSUB.functionParameter.inumber1.detail",example:'"13+4i"',require:1,repeat:0},{name:"formula.functionList.IMSUB.functionParameter.inumber2.name",detail:"formula.functionList.IMSUB.functionParameter.inumber2.detail",example:'"5+3i"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.IMSUM,functionType:t.FunctionType.Engineering,description:"formula.functionList.IMSUM.description",abstract:"formula.functionList.IMSUM.abstract",functionParameter:[{name:"formula.functionList.IMSUM.functionParameter.inumber1.name",detail:"formula.functionList.IMSUM.functionParameter.inumber1.detail",example:'"3+4i"',require:1,repeat:0},{name:"formula.functionList.IMSUM.functionParameter.inumber2.name",detail:"formula.functionList.IMSUM.functionParameter.inumber2.detail",example:'"5-3i"',require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.IMTAN,functionType:t.FunctionType.Engineering,description:"formula.functionList.IMTAN.description",abstract:"formula.functionList.IMTAN.abstract",functionParameter:[{name:"formula.functionList.IMTAN.functionParameter.inumber.name",detail:"formula.functionList.IMTAN.functionParameter.inumber.detail",example:'"4+3i"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.IMTANH,functionType:t.FunctionType.Engineering,description:"formula.functionList.IMTANH.description",abstract:"formula.functionList.IMTANH.abstract",functionParameter:[{name:"formula.functionList.IMTANH.functionParameter.inumber.name",detail:"formula.functionList.IMTANH.functionParameter.inumber.detail",example:'"4+3i"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.OCT2BIN,functionType:t.FunctionType.Engineering,description:"formula.functionList.OCT2BIN.description",abstract:"formula.functionList.OCT2BIN.abstract",functionParameter:[{name:"formula.functionList.OCT2BIN.functionParameter.number.name",detail:"formula.functionList.OCT2BIN.functionParameter.number.detail",example:"3",require:1,repeat:0},{name:"formula.functionList.OCT2BIN.functionParameter.places.name",detail:"formula.functionList.OCT2BIN.functionParameter.places.detail",example:"3",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.OCT2DEC,functionType:t.FunctionType.Engineering,description:"formula.functionList.OCT2DEC.description",abstract:"formula.functionList.OCT2DEC.abstract",functionParameter:[{name:"formula.functionList.OCT2DEC.functionParameter.number.name",detail:"formula.functionList.OCT2DEC.functionParameter.number.detail",example:"54",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_ENGINEERING.OCT2HEX,functionType:t.FunctionType.Engineering,description:"formula.functionList.OCT2HEX.description",abstract:"formula.functionList.OCT2HEX.abstract",functionParameter:[{name:"formula.functionList.OCT2HEX.functionParameter.number.name",detail:"formula.functionList.OCT2HEX.functionParameter.number.detail",example:"100",require:1,repeat:0},{name:"formula.functionList.OCT2HEX.functionParameter.places.name",detail:"formula.functionList.OCT2HEX.functionParameter.places.detail",example:"4",require:0,repeat:0}]}],Qe=[{functionName:t.FUNCTION_NAMES_FINANCIAL.ACCRINT,functionType:t.FunctionType.Financial,description:"formula.functionList.ACCRINT.description",abstract:"formula.functionList.ACCRINT.abstract",functionParameter:[{name:"formula.functionList.ACCRINT.functionParameter.issue.name",detail:"formula.functionList.ACCRINT.functionParameter.issue.detail",example:'"2008-3-1"',require:1,repeat:0},{name:"formula.functionList.ACCRINT.functionParameter.firstInterest.name",detail:"formula.functionList.ACCRINT.functionParameter.firstInterest.detail",example:'"2008-8-31"',require:1,repeat:0},{name:"formula.functionList.ACCRINT.functionParameter.settlement.name",detail:"formula.functionList.ACCRINT.functionParameter.settlement.detail",example:'"2008-5-1"',require:1,repeat:0},{name:"formula.functionList.ACCRINT.functionParameter.rate.name",detail:"formula.functionList.ACCRINT.functionParameter.rate.detail",example:"10%",require:1,repeat:0},{name:"formula.functionList.ACCRINT.functionParameter.par.name",detail:"formula.functionList.ACCRINT.functionParameter.par.detail",example:"1000",require:1,repeat:0},{name:"formula.functionList.ACCRINT.functionParameter.frequency.name",detail:"formula.functionList.ACCRINT.functionParameter.frequency.detail",example:"2",require:1,repeat:0},{name:"formula.functionList.ACCRINT.functionParameter.basis.name",detail:"formula.functionList.ACCRINT.functionParameter.basis.detail",example:"0",require:0,repeat:0},{name:"formula.functionList.ACCRINT.functionParameter.calcMethod.name",detail:"formula.functionList.ACCRINT.functionParameter.calcMethod.detail",example:"true",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.ACCRINTM,functionType:t.FunctionType.Financial,description:"formula.functionList.ACCRINTM.description",abstract:"formula.functionList.ACCRINTM.abstract",functionParameter:[{name:"formula.functionList.ACCRINTM.functionParameter.issue.name",detail:"formula.functionList.ACCRINTM.functionParameter.issue.detail",example:'"2008-4-1"',require:1,repeat:0},{name:"formula.functionList.ACCRINTM.functionParameter.settlement.name",detail:"formula.functionList.ACCRINTM.functionParameter.settlement.detail",example:'"2008-6-15"',require:1,repeat:0},{name:"formula.functionList.ACCRINTM.functionParameter.rate.name",detail:"formula.functionList.ACCRINTM.functionParameter.rate.detail",example:"10%",require:1,repeat:0},{name:"formula.functionList.ACCRINTM.functionParameter.par.name",detail:"formula.functionList.ACCRINTM.functionParameter.par.detail",example:"1000",require:1,repeat:0},{name:"formula.functionList.ACCRINTM.functionParameter.basis.name",detail:"formula.functionList.ACCRINTM.functionParameter.basis.detail",example:"3",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.AMORDEGRC,functionType:t.FunctionType.Financial,description:"formula.functionList.AMORDEGRC.description",abstract:"formula.functionList.AMORDEGRC.abstract",functionParameter:[{name:"formula.functionList.AMORDEGRC.functionParameter.number1.name",detail:"formula.functionList.AMORDEGRC.functionParameter.number1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.AMORDEGRC.functionParameter.number2.name",detail:"formula.functionList.AMORDEGRC.functionParameter.number2.detail",example:"A1:A20",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.AMORLINC,functionType:t.FunctionType.Financial,description:"formula.functionList.AMORLINC.description",abstract:"formula.functionList.AMORLINC.abstract",functionParameter:[{name:"formula.functionList.AMORLINC.functionParameter.cost.name",detail:"formula.functionList.AMORLINC.functionParameter.cost.detail",example:"2400",require:1,repeat:0},{name:"formula.functionList.AMORLINC.functionParameter.datePurchased.name",detail:"formula.functionList.AMORLINC.functionParameter.datePurchased.detail",example:'"2008-8-19"',require:1,repeat:0},{name:"formula.functionList.AMORLINC.functionParameter.firstPeriod.name",detail:"formula.functionList.AMORLINC.functionParameter.firstPeriod.detail",example:'"2008-12-31"',require:1,repeat:0},{name:"formula.functionList.AMORLINC.functionParameter.salvage.name",detail:"formula.functionList.AMORLINC.functionParameter.salvage.detail",example:"300",require:1,repeat:0},{name:"formula.functionList.AMORLINC.functionParameter.period.name",detail:"formula.functionList.AMORLINC.functionParameter.period.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.AMORLINC.functionParameter.rate.name",detail:"formula.functionList.AMORLINC.functionParameter.rate.detail",example:"15%",require:1,repeat:0},{name:"formula.functionList.AMORLINC.functionParameter.basis.name",detail:"formula.functionList.AMORLINC.functionParameter.basis.detail",example:"0",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.COUPDAYBS,functionType:t.FunctionType.Financial,description:"formula.functionList.COUPDAYBS.description",abstract:"formula.functionList.COUPDAYBS.abstract",functionParameter:[{name:"formula.functionList.COUPDAYBS.functionParameter.settlement.name",detail:"formula.functionList.COUPDAYBS.functionParameter.settlement.detail",example:'"2011-1-25"',require:1,repeat:0},{name:"formula.functionList.COUPDAYBS.functionParameter.maturity.name",detail:"formula.functionList.COUPDAYBS.functionParameter.maturity.detail",example:'"2011-11-15"',require:1,repeat:0},{name:"formula.functionList.COUPDAYBS.functionParameter.frequency.name",detail:"formula.functionList.COUPDAYBS.functionParameter.frequency.detail",example:"2",require:1,repeat:0},{name:"formula.functionList.COUPDAYBS.functionParameter.basis.name",detail:"formula.functionList.COUPDAYBS.functionParameter.basis.detail",example:"1",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.COUPDAYS,functionType:t.FunctionType.Financial,description:"formula.functionList.COUPDAYS.description",abstract:"formula.functionList.COUPDAYS.abstract",functionParameter:[{name:"formula.functionList.COUPDAYS.functionParameter.settlement.name",detail:"formula.functionList.COUPDAYS.functionParameter.settlement.detail",example:'"2011-1-25"',require:1,repeat:0},{name:"formula.functionList.COUPDAYS.functionParameter.maturity.name",detail:"formula.functionList.COUPDAYS.functionParameter.maturity.detail",example:'"2011-11-15"',require:1,repeat:0},{name:"formula.functionList.COUPDAYS.functionParameter.frequency.name",detail:"formula.functionList.COUPDAYS.functionParameter.frequency.detail",example:"2",require:1,repeat:0},{name:"formula.functionList.COUPDAYS.functionParameter.basis.name",detail:"formula.functionList.COUPDAYS.functionParameter.basis.detail",example:"1",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.COUPDAYSNC,functionType:t.FunctionType.Financial,description:"formula.functionList.COUPDAYSNC.description",abstract:"formula.functionList.COUPDAYSNC.abstract",functionParameter:[{name:"formula.functionList.COUPDAYSNC.functionParameter.settlement.name",detail:"formula.functionList.COUPDAYSNC.functionParameter.settlement.detail",example:'"2011-1-25"',require:1,repeat:0},{name:"formula.functionList.COUPDAYSNC.functionParameter.maturity.name",detail:"formula.functionList.COUPDAYSNC.functionParameter.maturity.detail",example:'"2011-11-15"',require:1,repeat:0},{name:"formula.functionList.COUPDAYSNC.functionParameter.frequency.name",detail:"formula.functionList.COUPDAYSNC.functionParameter.frequency.detail",example:"2",require:1,repeat:0},{name:"formula.functionList.COUPDAYSNC.functionParameter.basis.name",detail:"formula.functionList.COUPDAYSNC.functionParameter.basis.detail",example:"1",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.COUPNCD,functionType:t.FunctionType.Financial,description:"formula.functionList.COUPNCD.description",abstract:"formula.functionList.COUPNCD.abstract",functionParameter:[{name:"formula.functionList.COUPNCD.functionParameter.settlement.name",detail:"formula.functionList.COUPNCD.functionParameter.settlement.detail",example:'"2011-1-25"',require:1,repeat:0},{name:"formula.functionList.COUPNCD.functionParameter.maturity.name",detail:"formula.functionList.COUPNCD.functionParameter.maturity.detail",example:'"2011-11-15"',require:1,repeat:0},{name:"formula.functionList.COUPNCD.functionParameter.frequency.name",detail:"formula.functionList.COUPNCD.functionParameter.frequency.detail",example:"2",require:1,repeat:0},{name:"formula.functionList.COUPNCD.functionParameter.basis.name",detail:"formula.functionList.COUPNCD.functionParameter.basis.detail",example:"1",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.COUPNUM,functionType:t.FunctionType.Financial,description:"formula.functionList.COUPNUM.description",abstract:"formula.functionList.COUPNUM.abstract",functionParameter:[{name:"formula.functionList.COUPNUM.functionParameter.settlement.name",detail:"formula.functionList.COUPNUM.functionParameter.settlement.detail",example:'"2011-1-25"',require:1,repeat:0},{name:"formula.functionList.COUPNUM.functionParameter.maturity.name",detail:"formula.functionList.COUPNUM.functionParameter.maturity.detail",example:'"2011-11-15"',require:1,repeat:0},{name:"formula.functionList.COUPNUM.functionParameter.frequency.name",detail:"formula.functionList.COUPNUM.functionParameter.frequency.detail",example:"2",require:1,repeat:0},{name:"formula.functionList.COUPNUM.functionParameter.basis.name",detail:"formula.functionList.COUPNUM.functionParameter.basis.detail",example:"1",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.COUPPCD,functionType:t.FunctionType.Financial,description:"formula.functionList.COUPPCD.description",abstract:"formula.functionList.COUPPCD.abstract",functionParameter:[{name:"formula.functionList.COUPPCD.functionParameter.settlement.name",detail:"formula.functionList.COUPPCD.functionParameter.settlement.detail",example:'"2011-1-25"',require:1,repeat:0},{name:"formula.functionList.COUPPCD.functionParameter.maturity.name",detail:"formula.functionList.COUPPCD.functionParameter.maturity.detail",example:'"2011-11-15"',require:1,repeat:0},{name:"formula.functionList.COUPPCD.functionParameter.frequency.name",detail:"formula.functionList.COUPPCD.functionParameter.frequency.detail",example:"2",require:1,repeat:0},{name:"formula.functionList.COUPPCD.functionParameter.basis.name",detail:"formula.functionList.COUPPCD.functionParameter.basis.detail",example:"1",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.CUMIPMT,functionType:t.FunctionType.Financial,description:"formula.functionList.CUMIPMT.description",abstract:"formula.functionList.CUMIPMT.abstract",functionParameter:[{name:"formula.functionList.CUMIPMT.functionParameter.rate.name",detail:"formula.functionList.CUMIPMT.functionParameter.rate.detail",example:"9%/12",require:1,repeat:0},{name:"formula.functionList.CUMIPMT.functionParameter.nper.name",detail:"formula.functionList.CUMIPMT.functionParameter.nper.detail",example:"30*12",require:1,repeat:0},{name:"formula.functionList.CUMIPMT.functionParameter.pv.name",detail:"formula.functionList.CUMIPMT.functionParameter.pv.detail",example:"125000",require:1,repeat:0},{name:"formula.functionList.CUMIPMT.functionParameter.startPeriod.name",detail:"formula.functionList.CUMIPMT.functionParameter.startPeriod.detail",example:"13",require:1,repeat:0},{name:"formula.functionList.CUMIPMT.functionParameter.endPeriod.name",detail:"formula.functionList.CUMIPMT.functionParameter.endPeriod.detail",example:"24",require:1,repeat:0},{name:"formula.functionList.CUMIPMT.functionParameter.type.name",detail:"formula.functionList.CUMIPMT.functionParameter.type.detail",example:"0",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.CUMPRINC,functionType:t.FunctionType.Financial,description:"formula.functionList.CUMPRINC.description",abstract:"formula.functionList.CUMPRINC.abstract",functionParameter:[{name:"formula.functionList.CUMPRINC.functionParameter.rate.name",detail:"formula.functionList.CUMPRINC.functionParameter.rate.detail",example:"9%/12",require:1,repeat:0},{name:"formula.functionList.CUMPRINC.functionParameter.nper.name",detail:"formula.functionList.CUMPRINC.functionParameter.nper.detail",example:"30*12",require:1,repeat:0},{name:"formula.functionList.CUMPRINC.functionParameter.pv.name",detail:"formula.functionList.CUMPRINC.functionParameter.pv.detail",example:"125000",require:1,repeat:0},{name:"formula.functionList.CUMPRINC.functionParameter.startPeriod.name",detail:"formula.functionList.CUMPRINC.functionParameter.startPeriod.detail",example:"13",require:1,repeat:0},{name:"formula.functionList.CUMPRINC.functionParameter.endPeriod.name",detail:"formula.functionList.CUMPRINC.functionParameter.endPeriod.detail",example:"24",require:1,repeat:0},{name:"formula.functionList.CUMPRINC.functionParameter.type.name",detail:"formula.functionList.CUMPRINC.functionParameter.type.detail",example:"0",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.DB,functionType:t.FunctionType.Financial,description:"formula.functionList.DB.description",abstract:"formula.functionList.DB.abstract",functionParameter:[{name:"formula.functionList.DB.functionParameter.cost.name",detail:"formula.functionList.DB.functionParameter.cost.detail",example:"10000000",require:1,repeat:0},{name:"formula.functionList.DB.functionParameter.salvage.name",detail:"formula.functionList.DB.functionParameter.salvage.detail",example:"1000000",require:1,repeat:0},{name:"formula.functionList.DB.functionParameter.life.name",detail:"formula.functionList.DB.functionParameter.life.detail",example:"6",require:1,repeat:0},{name:"formula.functionList.DB.functionParameter.period.name",detail:"formula.functionList.DB.functionParameter.period.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.DB.functionParameter.month.name",detail:"formula.functionList.DB.functionParameter.month.detail",example:"7",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.DDB,functionType:t.FunctionType.Financial,description:"formula.functionList.DDB.description",abstract:"formula.functionList.DDB.abstract",functionParameter:[{name:"formula.functionList.DDB.functionParameter.cost.name",detail:"formula.functionList.DDB.functionParameter.cost.detail",example:"24000",require:1,repeat:0},{name:"formula.functionList.DDB.functionParameter.salvage.name",detail:"formula.functionList.DDB.functionParameter.salvage.detail",example:"3000",require:1,repeat:0},{name:"formula.functionList.DDB.functionParameter.life.name",detail:"formula.functionList.DDB.functionParameter.life.detail",example:"10",require:1,repeat:0},{name:"formula.functionList.DDB.functionParameter.period.name",detail:"formula.functionList.DDB.functionParameter.period.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.DDB.functionParameter.factor.name",detail:"formula.functionList.DDB.functionParameter.factor.detail",example:"2",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.DISC,functionType:t.FunctionType.Financial,description:"formula.functionList.DISC.description",abstract:"formula.functionList.DISC.abstract",functionParameter:[{name:"formula.functionList.DISC.functionParameter.settlement.name",detail:"formula.functionList.DISC.functionParameter.settlement.detail",example:'"2018-7-1"',require:1,repeat:0},{name:"formula.functionList.DISC.functionParameter.maturity.name",detail:"formula.functionList.DISC.functionParameter.maturity.detail",example:'"2048-1-1"',require:1,repeat:0},{name:"formula.functionList.DISC.functionParameter.pr.name",detail:"formula.functionList.DISC.functionParameter.pr.detail",example:"97.975",require:1,repeat:0},{name:"formula.functionList.DISC.functionParameter.redemption.name",detail:"formula.functionList.DISC.functionParameter.redemption.detail",example:"100",require:1,repeat:0},{name:"formula.functionList.DISC.functionParameter.basis.name",detail:"formula.functionList.DISC.functionParameter.basis.detail",example:"1",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.DOLLARDE,functionType:t.FunctionType.Financial,description:"formula.functionList.DOLLARDE.description",abstract:"formula.functionList.DOLLARDE.abstract",functionParameter:[{name:"formula.functionList.DOLLARDE.functionParameter.fractionalDollar.name",detail:"formula.functionList.DOLLARDE.functionParameter.fractionalDollar.detail",example:"1.02",require:1,repeat:0},{name:"formula.functionList.DOLLARDE.functionParameter.fraction.name",detail:"formula.functionList.DOLLARDE.functionParameter.fraction.detail",example:"16",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.DOLLARFR,functionType:t.FunctionType.Financial,description:"formula.functionList.DOLLARFR.description",abstract:"formula.functionList.DOLLARFR.abstract",functionParameter:[{name:"formula.functionList.DOLLARFR.functionParameter.decimalDollar.name",detail:"formula.functionList.DOLLARFR.functionParameter.decimalDollar.detail",example:"1.125",require:1,repeat:0},{name:"formula.functionList.DOLLARFR.functionParameter.fraction.name",detail:"formula.functionList.DOLLARFR.functionParameter.fraction.detail",example:"16",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.DURATION,functionType:t.FunctionType.Financial,description:"formula.functionList.DURATION.description",abstract:"formula.functionList.DURATION.abstract",functionParameter:[{name:"formula.functionList.DURATION.functionParameter.settlement.name",detail:"formula.functionList.DURATION.functionParameter.settlement.detail",example:'"2018-7-1"',require:1,repeat:0},{name:"formula.functionList.DURATION.functionParameter.maturity.name",detail:"formula.functionList.DURATION.functionParameter.maturity.detail",example:'"2048-1-1"',require:1,repeat:0},{name:"formula.functionList.DURATION.functionParameter.coupon.name",detail:"formula.functionList.DURATION.functionParameter.coupon.detail",example:"8%",require:1,repeat:0},{name:"formula.functionList.DURATION.functionParameter.yld.name",detail:"formula.functionList.DURATION.functionParameter.yld.detail",example:"9%",require:1,repeat:0},{name:"formula.functionList.DURATION.functionParameter.frequency.name",detail:"formula.functionList.DURATION.functionParameter.frequency.detail",example:"2",require:1,repeat:0},{name:"formula.functionList.DURATION.functionParameter.basis.name",detail:"formula.functionList.DURATION.functionParameter.basis.detail",example:"1",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.EFFECT,functionType:t.FunctionType.Financial,description:"formula.functionList.EFFECT.description",abstract:"formula.functionList.EFFECT.abstract",functionParameter:[{name:"formula.functionList.EFFECT.functionParameter.nominalRate.name",detail:"formula.functionList.EFFECT.functionParameter.nominalRate.detail",example:"5.25%",require:1,repeat:0},{name:"formula.functionList.EFFECT.functionParameter.npery.name",detail:"formula.functionList.EFFECT.functionParameter.npery.detail",example:"4",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.FV,functionType:t.FunctionType.Financial,description:"formula.functionList.FV.description",abstract:"formula.functionList.FV.abstract",functionParameter:[{name:"formula.functionList.FV.functionParameter.rate.name",detail:"formula.functionList.FV.functionParameter.rate.detail",example:"6%/12",require:1,repeat:0},{name:"formula.functionList.FV.functionParameter.nper.name",detail:"formula.functionList.FV.functionParameter.nper.detail",example:"10",require:1,repeat:0},{name:"formula.functionList.FV.functionParameter.pmt.name",detail:"formula.functionList.FV.functionParameter.pmt.detail",example:"-200",require:1,repeat:0},{name:"formula.functionList.FV.functionParameter.pv.name",detail:"formula.functionList.FV.functionParameter.pv.detail",example:"-500",require:0,repeat:0},{name:"formula.functionList.FV.functionParameter.type.name",detail:"formula.functionList.FV.functionParameter.type.detail",example:"1",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.FVSCHEDULE,functionType:t.FunctionType.Financial,description:"formula.functionList.FVSCHEDULE.description",abstract:"formula.functionList.FVSCHEDULE.abstract",functionParameter:[{name:"formula.functionList.FVSCHEDULE.functionParameter.principal.name",detail:"formula.functionList.FVSCHEDULE.functionParameter.principal.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.FVSCHEDULE.functionParameter.schedule.name",detail:"formula.functionList.FVSCHEDULE.functionParameter.schedule.detail",example:"A1:A4",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.INTRATE,functionType:t.FunctionType.Financial,description:"formula.functionList.INTRATE.description",abstract:"formula.functionList.INTRATE.abstract",functionParameter:[{name:"formula.functionList.INTRATE.functionParameter.settlement.name",detail:"formula.functionList.INTRATE.functionParameter.settlement.detail",example:'"2008-2-15"',require:1,repeat:0},{name:"formula.functionList.INTRATE.functionParameter.maturity.name",detail:"formula.functionList.INTRATE.functionParameter.maturity.detail",example:'"2008-5-15"',require:1,repeat:0},{name:"formula.functionList.INTRATE.functionParameter.investment.name",detail:"formula.functionList.INTRATE.functionParameter.investment.detail",example:"10000000",require:1,repeat:0},{name:"formula.functionList.INTRATE.functionParameter.redemption.name",detail:"formula.functionList.INTRATE.functionParameter.redemption.detail",example:"10144200",require:1,repeat:0},{name:"formula.functionList.INTRATE.functionParameter.basis.name",detail:"formula.functionList.INTRATE.functionParameter.basis.detail",example:"2",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.IPMT,functionType:t.FunctionType.Financial,description:"formula.functionList.IPMT.description",abstract:"formula.functionList.IPMT.abstract",functionParameter:[{name:"formula.functionList.IPMT.functionParameter.rate.name",detail:"formula.functionList.IPMT.functionParameter.rate.detail",example:"10%/12",require:1,repeat:0},{name:"formula.functionList.IPMT.functionParameter.per.name",detail:"formula.functionList.IPMT.functionParameter.per.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.IPMT.functionParameter.nper.name",detail:"formula.functionList.IPMT.functionParameter.nper.detail",example:"3*12",require:1,repeat:0},{name:"formula.functionList.IPMT.functionParameter.pv.name",detail:"formula.functionList.IPMT.functionParameter.pv.detail",example:"80000",require:1,repeat:0},{name:"formula.functionList.IPMT.functionParameter.fv.name",detail:"formula.functionList.IPMT.functionParameter.fv.detail",example:"0",require:0,repeat:0},{name:"formula.functionList.IPMT.functionParameter.type.name",detail:"formula.functionList.IPMT.functionParameter.type.detail",example:"0",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.IRR,functionType:t.FunctionType.Financial,description:"formula.functionList.IRR.description",abstract:"formula.functionList.IRR.abstract",functionParameter:[{name:"formula.functionList.IRR.functionParameter.values.name",detail:"formula.functionList.IRR.functionParameter.values.detail",example:"A1:A4",require:1,repeat:0},{name:"formula.functionList.IRR.functionParameter.guess.name",detail:"formula.functionList.IRR.functionParameter.guess.detail",example:"0.1",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.ISPMT,functionType:t.FunctionType.Financial,description:"formula.functionList.ISPMT.description",abstract:"formula.functionList.ISPMT.abstract",functionParameter:[{name:"formula.functionList.ISPMT.functionParameter.rate.name",detail:"formula.functionList.ISPMT.functionParameter.rate.detail",example:"10%",require:1,repeat:0},{name:"formula.functionList.ISPMT.functionParameter.per.name",detail:"formula.functionList.ISPMT.functionParameter.per.detail",example:"2",require:1,repeat:0},{name:"formula.functionList.ISPMT.functionParameter.nper.name",detail:"formula.functionList.ISPMT.functionParameter.nper.detail",example:"5",require:1,repeat:0},{name:"formula.functionList.ISPMT.functionParameter.pv.name",detail:"formula.functionList.ISPMT.functionParameter.pv.detail",example:"1000",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.MDURATION,functionType:t.FunctionType.Financial,description:"formula.functionList.MDURATION.description",abstract:"formula.functionList.MDURATION.abstract",functionParameter:[{name:"formula.functionList.MDURATION.functionParameter.settlement.name",detail:"formula.functionList.MDURATION.functionParameter.settlement.detail",example:'"2018-7-1"',require:1,repeat:0},{name:"formula.functionList.MDURATION.functionParameter.maturity.name",detail:"formula.functionList.MDURATION.functionParameter.maturity.detail",example:'"2048-1-1"',require:1,repeat:0},{name:"formula.functionList.MDURATION.functionParameter.coupon.name",detail:"formula.functionList.MDURATION.functionParameter.coupon.detail",example:"8%",require:1,repeat:0},{name:"formula.functionList.MDURATION.functionParameter.yld.name",detail:"formula.functionList.MDURATION.functionParameter.yld.detail",example:"9%",require:1,repeat:0},{name:"formula.functionList.MDURATION.functionParameter.frequency.name",detail:"formula.functionList.MDURATION.functionParameter.frequency.detail",example:"2",require:1,repeat:0},{name:"formula.functionList.MDURATION.functionParameter.basis.name",detail:"formula.functionList.MDURATION.functionParameter.basis.detail",example:"1",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.MIRR,functionType:t.FunctionType.Financial,description:"formula.functionList.MIRR.description",abstract:"formula.functionList.MIRR.abstract",functionParameter:[{name:"formula.functionList.MIRR.functionParameter.values.name",detail:"formula.functionList.MIRR.functionParameter.values.detail",example:"A1:A4",require:1,repeat:0},{name:"formula.functionList.MIRR.functionParameter.financeRate.name",detail:"formula.functionList.MIRR.functionParameter.financeRate.detail",example:"10%",require:1,repeat:0},{name:"formula.functionList.MIRR.functionParameter.reinvestRate.name",detail:"formula.functionList.MIRR.functionParameter.reinvestRate.detail",example:"12%",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.NOMINAL,functionType:t.FunctionType.Financial,description:"formula.functionList.NOMINAL.description",abstract:"formula.functionList.NOMINAL.abstract",functionParameter:[{name:"formula.functionList.NOMINAL.functionParameter.effectRate.name",detail:"formula.functionList.NOMINAL.functionParameter.effectRate.detail",example:"5.3543%",require:1,repeat:0},{name:"formula.functionList.NOMINAL.functionParameter.npery.name",detail:"formula.functionList.NOMINAL.functionParameter.npery.detail",example:"4",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.NPER,functionType:t.FunctionType.Financial,description:"formula.functionList.NPER.description",abstract:"formula.functionList.NPER.abstract",functionParameter:[{name:"formula.functionList.NPER.functionParameter.rate.name",detail:"formula.functionList.NPER.functionParameter.rate.detail",example:"12%/12",require:1,repeat:0},{name:"formula.functionList.NPER.functionParameter.pmt.name",detail:"formula.functionList.NPER.functionParameter.pmt.detail",example:"-100",require:1,repeat:0},{name:"formula.functionList.NPER.functionParameter.pv.name",detail:"formula.functionList.NPER.functionParameter.pv.detail",example:"-1000",require:1,repeat:0},{name:"formula.functionList.NPER.functionParameter.fv.name",detail:"formula.functionList.NPER.functionParameter.fv.detail",example:"10000",require:0,repeat:0},{name:"formula.functionList.NPER.functionParameter.type.name",detail:"formula.functionList.NPER.functionParameter.type.detail",example:"1",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.NPV,functionType:t.FunctionType.Financial,description:"formula.functionList.NPV.description",abstract:"formula.functionList.NPV.abstract",functionParameter:[{name:"formula.functionList.NPV.functionParameter.rate.name",detail:"formula.functionList.NPV.functionParameter.rate.detail",example:"10%",require:1,repeat:0},{name:"formula.functionList.NPV.functionParameter.value1.name",detail:"formula.functionList.NPV.functionParameter.value1.detail",example:"A1:A4",require:1,repeat:0},{name:"formula.functionList.NPV.functionParameter.value2.name",detail:"formula.functionList.NPV.functionParameter.value2.detail",example:"-9000",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.ODDFPRICE,functionType:t.FunctionType.Financial,description:"formula.functionList.ODDFPRICE.description",abstract:"formula.functionList.ODDFPRICE.abstract",functionParameter:[{name:"formula.functionList.ODDFPRICE.functionParameter.settlement.name",detail:"formula.functionList.ODDFPRICE.functionParameter.settlement.detail",example:'"2008-11-11"',require:1,repeat:0},{name:"formula.functionList.ODDFPRICE.functionParameter.maturity.name",detail:"formula.functionList.ODDFPRICE.functionParameter.maturity.detail",example:'"2021-3-1"',require:1,repeat:0},{name:"formula.functionList.ODDFPRICE.functionParameter.issue.name",detail:"formula.functionList.ODDFPRICE.functionParameter.issue.detail",example:'"2008-10-15"',require:1,repeat:0},{name:"formula.functionList.ODDFPRICE.functionParameter.firstCoupon.name",detail:"formula.functionList.ODDFPRICE.functionParameter.firstCoupon.detail",example:'"2009-3-1"',require:1,repeat:0},{name:"formula.functionList.ODDFPRICE.functionParameter.rate.name",detail:"formula.functionList.ODDFPRICE.functionParameter.rate.detail",example:"7.85%",require:1,repeat:0},{name:"formula.functionList.ODDFPRICE.functionParameter.yld.name",detail:"formula.functionList.ODDFPRICE.functionParameter.yld.detail",example:"6.25%",require:1,repeat:0},{name:"formula.functionList.ODDFPRICE.functionParameter.redemption.name",detail:"formula.functionList.ODDFPRICE.functionParameter.redemption.detail",example:"100",require:1,repeat:0},{name:"formula.functionList.ODDFPRICE.functionParameter.frequency.name",detail:"formula.functionList.ODDFPRICE.functionParameter.frequency.detail",example:"2",require:1,repeat:0},{name:"formula.functionList.ODDFPRICE.functionParameter.basis.name",detail:"formula.functionList.ODDFPRICE.functionParameter.basis.detail",example:"1",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.ODDFYIELD,functionType:t.FunctionType.Financial,description:"formula.functionList.ODDFYIELD.description",abstract:"formula.functionList.ODDFYIELD.abstract",functionParameter:[{name:"formula.functionList.ODDFYIELD.functionParameter.settlement.name",detail:"formula.functionList.ODDFYIELD.functionParameter.settlement.detail",example:'"2008-11-11"',require:1,repeat:0},{name:"formula.functionList.ODDFYIELD.functionParameter.maturity.name",detail:"formula.functionList.ODDFYIELD.functionParameter.maturity.detail",example:'"2021-3-1"',require:1,repeat:0},{name:"formula.functionList.ODDFYIELD.functionParameter.issue.name",detail:"formula.functionList.ODDFYIELD.functionParameter.issue.detail",example:'"2008-10-15"',require:1,repeat:0},{name:"formula.functionList.ODDFYIELD.functionParameter.firstCoupon.name",detail:"formula.functionList.ODDFYIELD.functionParameter.firstCoupon.detail",example:'"2009-3-1"',require:1,repeat:0},{name:"formula.functionList.ODDFYIELD.functionParameter.rate.name",detail:"formula.functionList.ODDFYIELD.functionParameter.rate.detail",example:"5.75%",require:1,repeat:0},{name:"formula.functionList.ODDFYIELD.functionParameter.pr.name",detail:"formula.functionList.ODDFYIELD.functionParameter.pr.detail",example:"84.5",require:1,repeat:0},{name:"formula.functionList.ODDFYIELD.functionParameter.redemption.name",detail:"formula.functionList.ODDFYIELD.functionParameter.redemption.detail",example:"100",require:1,repeat:0},{name:"formula.functionList.ODDFYIELD.functionParameter.frequency.name",detail:"formula.functionList.ODDFYIELD.functionParameter.frequency.detail",example:"2",require:1,repeat:0},{name:"formula.functionList.ODDFYIELD.functionParameter.basis.name",detail:"formula.functionList.ODDFYIELD.functionParameter.basis.detail",example:"0",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.ODDLPRICE,functionType:t.FunctionType.Financial,description:"formula.functionList.ODDLPRICE.description",abstract:"formula.functionList.ODDLPRICE.abstract",functionParameter:[{name:"formula.functionList.ODDLPRICE.functionParameter.settlement.name",detail:"formula.functionList.ODDLPRICE.functionParameter.settlement.detail",example:'"2008-2-7"',require:1,repeat:0},{name:"formula.functionList.ODDLPRICE.functionParameter.maturity.name",detail:"formula.functionList.ODDLPRICE.functionParameter.maturity.detail",example:'"2008-6-15"',require:1,repeat:0},{name:"formula.functionList.ODDLPRICE.functionParameter.lastInterest.name",detail:"formula.functionList.ODDLPRICE.functionParameter.lastInterest.detail",example:'"2007-10-15"',require:1,repeat:0},{name:"formula.functionList.ODDLPRICE.functionParameter.rate.name",detail:"formula.functionList.ODDLPRICE.functionParameter.rate.detail",example:"3.75%",require:1,repeat:0},{name:"formula.functionList.ODDLPRICE.functionParameter.yld.name",detail:"formula.functionList.ODDLPRICE.functionParameter.yld.detail",example:"4.05%",require:1,repeat:0},{name:"formula.functionList.ODDLPRICE.functionParameter.redemption.name",detail:"formula.functionList.ODDLPRICE.functionParameter.redemption.detail",example:"100",require:1,repeat:0},{name:"formula.functionList.ODDLPRICE.functionParameter.frequency.name",detail:"formula.functionList.ODDLPRICE.functionParameter.frequency.detail",example:"2",require:1,repeat:0},{name:"formula.functionList.ODDLPRICE.functionParameter.basis.name",detail:"formula.functionList.ODDLPRICE.functionParameter.basis.detail",example:"0",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.ODDLYIELD,functionType:t.FunctionType.Financial,description:"formula.functionList.ODDLYIELD.description",abstract:"formula.functionList.ODDLYIELD.abstract",functionParameter:[{name:"formula.functionList.ODDLYIELD.functionParameter.settlement.name",detail:"formula.functionList.ODDLYIELD.functionParameter.settlement.detail",example:'"2008-4-20"',require:1,repeat:0},{name:"formula.functionList.ODDLYIELD.functionParameter.maturity.name",detail:"formula.functionList.ODDLYIELD.functionParameter.maturity.detail",example:'"2008-6-15"',require:1,repeat:0},{name:"formula.functionList.ODDLYIELD.functionParameter.lastInterest.name",detail:"formula.functionList.ODDLYIELD.functionParameter.lastInterest.detail",example:'"2007-12-24"',require:1,repeat:0},{name:"formula.functionList.ODDLYIELD.functionParameter.rate.name",detail:"formula.functionList.ODDLYIELD.functionParameter.rate.detail",example:"3.75%",require:1,repeat:0},{name:"formula.functionList.ODDLYIELD.functionParameter.pr.name",detail:"formula.functionList.ODDLYIELD.functionParameter.pr.detail",example:"99.875",require:1,repeat:0},{name:"formula.functionList.ODDLYIELD.functionParameter.redemption.name",detail:"formula.functionList.ODDLYIELD.functionParameter.redemption.detail",example:"100",require:1,repeat:0},{name:"formula.functionList.ODDLYIELD.functionParameter.frequency.name",detail:"formula.functionList.ODDLYIELD.functionParameter.frequency.detail",example:"2",require:1,repeat:0},{name:"formula.functionList.ODDLYIELD.functionParameter.basis.name",detail:"formula.functionList.ODDLYIELD.functionParameter.basis.detail",example:"0",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.PDURATION,functionType:t.FunctionType.Financial,description:"formula.functionList.PDURATION.description",abstract:"formula.functionList.PDURATION.abstract",functionParameter:[{name:"formula.functionList.PDURATION.functionParameter.rate.name",detail:"formula.functionList.PDURATION.functionParameter.rate.detail",example:"2.5%",require:1,repeat:0},{name:"formula.functionList.PDURATION.functionParameter.pv.name",detail:"formula.functionList.PDURATION.functionParameter.pv.detail",example:"2000",require:1,repeat:0},{name:"formula.functionList.PDURATION.functionParameter.fv.name",detail:"formula.functionList.PDURATION.functionParameter.fv.detail",example:"2200",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.PMT,functionType:t.FunctionType.Financial,description:"formula.functionList.PMT.description",abstract:"formula.functionList.PMT.abstract",functionParameter:[{name:"formula.functionList.PMT.functionParameter.rate.name",detail:"formula.functionList.PMT.functionParameter.rate.detail",example:"8%/12",require:1,repeat:0},{name:"formula.functionList.PMT.functionParameter.nper.name",detail:"formula.functionList.PMT.functionParameter.nper.detail",example:"10",require:1,repeat:0},{name:"formula.functionList.PMT.functionParameter.pv.name",detail:"formula.functionList.PMT.functionParameter.pv.detail",example:"10000",require:1,repeat:0},{name:"formula.functionList.PMT.functionParameter.fv.name",detail:"formula.functionList.PMT.functionParameter.fv.detail",example:"0",require:0,repeat:0},{name:"formula.functionList.PMT.functionParameter.type.name",detail:"formula.functionList.PMT.functionParameter.type.detail",example:"0",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.PPMT,functionType:t.FunctionType.Financial,description:"formula.functionList.PPMT.description",abstract:"formula.functionList.PPMT.abstract",functionParameter:[{name:"formula.functionList.PPMT.functionParameter.rate.name",detail:"formula.functionList.PPMT.functionParameter.rate.detail",example:"10%/12",require:1,repeat:0},{name:"formula.functionList.PPMT.functionParameter.per.name",detail:"formula.functionList.PPMT.functionParameter.per.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.PPMT.functionParameter.nper.name",detail:"formula.functionList.PPMT.functionParameter.nper.detail",example:"3*12",require:1,repeat:0},{name:"formula.functionList.PPMT.functionParameter.pv.name",detail:"formula.functionList.PPMT.functionParameter.pv.detail",example:"80000",require:1,repeat:0},{name:"formula.functionList.PPMT.functionParameter.fv.name",detail:"formula.functionList.PPMT.functionParameter.fv.detail",example:"0",require:0,repeat:0},{name:"formula.functionList.PPMT.functionParameter.type.name",detail:"formula.functionList.PPMT.functionParameter.type.detail",example:"0",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.PRICE,functionType:t.FunctionType.Financial,description:"formula.functionList.PRICE.description",abstract:"formula.functionList.PRICE.abstract",functionParameter:[{name:"formula.functionList.PRICE.functionParameter.settlement.name",detail:"formula.functionList.PRICE.functionParameter.settlement.detail",example:'"2008-11-11"',require:1,repeat:0},{name:"formula.functionList.PRICE.functionParameter.maturity.name",detail:"formula.functionList.PRICE.functionParameter.maturity.detail",example:'"2021-3-1"',require:1,repeat:0},{name:"formula.functionList.PRICE.functionParameter.rate.name",detail:"formula.functionList.PRICE.functionParameter.rate.detail",example:"7.85%",require:1,repeat:0},{name:"formula.functionList.PRICE.functionParameter.yld.name",detail:"formula.functionList.PRICE.functionParameter.yld.detail",example:"6.25%",require:1,repeat:0},{name:"formula.functionList.PRICE.functionParameter.redemption.name",detail:"formula.functionList.PRICE.functionParameter.redemption.detail",example:"100",require:1,repeat:0},{name:"formula.functionList.PRICE.functionParameter.frequency.name",detail:"formula.functionList.PRICE.functionParameter.frequency.detail",example:"2",require:1,repeat:0},{name:"formula.functionList.PRICE.functionParameter.basis.name",detail:"formula.functionList.PRICE.functionParameter.basis.detail",example:"1",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.PRICEDISC,functionType:t.FunctionType.Financial,description:"formula.functionList.PRICEDISC.description",abstract:"formula.functionList.PRICEDISC.abstract",functionParameter:[{name:"formula.functionList.PRICEDISC.functionParameter.settlement.name",detail:"formula.functionList.PRICEDISC.functionParameter.settlement.detail",example:'"2008-11-11"',require:1,repeat:0},{name:"formula.functionList.PRICEDISC.functionParameter.maturity.name",detail:"formula.functionList.PRICEDISC.functionParameter.maturity.detail",example:'"2021-3-1"',require:1,repeat:0},{name:"formula.functionList.PRICEDISC.functionParameter.discount.name",detail:"formula.functionList.PRICEDISC.functionParameter.discount.detail",example:"6.25%",require:1,repeat:0},{name:"formula.functionList.PRICEDISC.functionParameter.redemption.name",detail:"formula.functionList.PRICEDISC.functionParameter.redemption.detail",example:"100",require:1,repeat:0},{name:"formula.functionList.PRICEDISC.functionParameter.basis.name",detail:"formula.functionList.PRICEDISC.functionParameter.basis.detail",example:"1",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.PRICEMAT,functionType:t.FunctionType.Financial,description:"formula.functionList.PRICEMAT.description",abstract:"formula.functionList.PRICEMAT.abstract",functionParameter:[{name:"formula.functionList.PRICEMAT.functionParameter.settlement.name",detail:"formula.functionList.PRICEMAT.functionParameter.settlement.detail",example:'"2008-11-11"',require:1,repeat:0},{name:"formula.functionList.PRICEMAT.functionParameter.maturity.name",detail:"formula.functionList.PRICEMAT.functionParameter.maturity.detail",example:'"2021-3-1"',require:1,repeat:0},{name:"formula.functionList.PRICEMAT.functionParameter.issue.name",detail:"formula.functionList.PRICEMAT.functionParameter.issue.detail",example:'"2008-10-15"',require:1,repeat:0},{name:"formula.functionList.PRICEMAT.functionParameter.rate.name",detail:"formula.functionList.PRICEMAT.functionParameter.rate.detail",example:"7.85%",require:1,repeat:0},{name:"formula.functionList.PRICEMAT.functionParameter.yld.name",detail:"formula.functionList.PRICEMAT.functionParameter.yld.detail",example:"6.25%",require:1,repeat:0},{name:"formula.functionList.PRICEMAT.functionParameter.basis.name",detail:"formula.functionList.PRICEMAT.functionParameter.basis.detail",example:"1",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.PV,functionType:t.FunctionType.Financial,description:"formula.functionList.PV.description",abstract:"formula.functionList.PV.abstract",functionParameter:[{name:"formula.functionList.PV.functionParameter.rate.name",detail:"formula.functionList.PV.functionParameter.rate.detail",example:"2%",require:1,repeat:0},{name:"formula.functionList.PV.functionParameter.nper.name",detail:"formula.functionList.PV.functionParameter.nper.detail",example:"12",require:1,repeat:0},{name:"formula.functionList.PV.functionParameter.pmt.name",detail:"formula.functionList.PV.functionParameter.pmt.detail",example:"100",require:1,repeat:0},{name:"formula.functionList.PV.functionParameter.fv.name",detail:"formula.functionList.PV.functionParameter.fv.detail",example:"0",require:0,repeat:0},{name:"formula.functionList.PV.functionParameter.type.name",detail:"formula.functionList.PV.functionParameter.type.detail",example:"0",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.RATE,functionType:t.FunctionType.Financial,description:"formula.functionList.RATE.description",abstract:"formula.functionList.RATE.abstract",functionParameter:[{name:"formula.functionList.RATE.functionParameter.nper.name",detail:"formula.functionList.RATE.functionParameter.nper.detail",example:"4*12",require:1,repeat:0},{name:"formula.functionList.RATE.functionParameter.pmt.name",detail:"formula.functionList.RATE.functionParameter.pmt.detail",example:"-200",require:1,repeat:0},{name:"formula.functionList.RATE.functionParameter.pv.name",detail:"formula.functionList.RATE.functionParameter.pv.detail",example:"8000",require:1,repeat:0},{name:"formula.functionList.RATE.functionParameter.fv.name",detail:"formula.functionList.RATE.functionParameter.fv.detail",example:"0",require:0,repeat:0},{name:"formula.functionList.RATE.functionParameter.type.name",detail:"formula.functionList.RATE.functionParameter.type.detail",example:"0",require:0,repeat:0},{name:"formula.functionList.RATE.functionParameter.guess.name",detail:"formula.functionList.RATE.functionParameter.guess.detail",example:"0.1",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.RECEIVED,functionType:t.FunctionType.Financial,description:"formula.functionList.RECEIVED.description",abstract:"formula.functionList.RECEIVED.abstract",functionParameter:[{name:"formula.functionList.RECEIVED.functionParameter.settlement.name",detail:"formula.functionList.RECEIVED.functionParameter.settlement.detail",example:'"2008-2-15"',require:1,repeat:0},{name:"formula.functionList.RECEIVED.functionParameter.maturity.name",detail:"formula.functionList.RECEIVED.functionParameter.maturity.detail",example:'"2008-3-15"',require:1,repeat:0},{name:"formula.functionList.RECEIVED.functionParameter.investment.name",detail:"formula.functionList.RECEIVED.functionParameter.investment.detail",example:"10000000",require:1,repeat:0},{name:"formula.functionList.RECEIVED.functionParameter.discount.name",detail:"formula.functionList.RECEIVED.functionParameter.discount.detail",example:"5.75%",require:1,repeat:0},{name:"formula.functionList.RECEIVED.functionParameter.basis.name",detail:"formula.functionList.RECEIVED.functionParameter.basis.detail",example:"2",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.RRI,functionType:t.FunctionType.Financial,description:"formula.functionList.RRI.description",abstract:"formula.functionList.RRI.abstract",functionParameter:[{name:"formula.functionList.RRI.functionParameter.nper.name",detail:"formula.functionList.RRI.functionParameter.nper.detail",example:"96",require:1,repeat:0},{name:"formula.functionList.RRI.functionParameter.pv.name",detail:"formula.functionList.RRI.functionParameter.pv.detail",example:"10000",require:1,repeat:0},{name:"formula.functionList.RRI.functionParameter.fv.name",detail:"formula.functionList.RRI.functionParameter.fv.detail",example:"11000",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.SLN,functionType:t.FunctionType.Financial,description:"formula.functionList.SLN.description",abstract:"formula.functionList.SLN.abstract",functionParameter:[{name:"formula.functionList.SLN.functionParameter.cost.name",detail:"formula.functionList.SLN.functionParameter.cost.detail",example:"300000",require:1,repeat:0},{name:"formula.functionList.SLN.functionParameter.salvage.name",detail:"formula.functionList.SLN.functionParameter.salvage.detail",example:"75000",require:1,repeat:0},{name:"formula.functionList.SLN.functionParameter.life.name",detail:"formula.functionList.SLN.functionParameter.life.detail",example:"10",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.SYD,functionType:t.FunctionType.Financial,description:"formula.functionList.SYD.description",abstract:"formula.functionList.SYD.abstract",functionParameter:[{name:"formula.functionList.SYD.functionParameter.cost.name",detail:"formula.functionList.SYD.functionParameter.cost.detail",example:"300000",require:1,repeat:0},{name:"formula.functionList.SYD.functionParameter.salvage.name",detail:"formula.functionList.SYD.functionParameter.salvage.detail",example:"75000",require:1,repeat:0},{name:"formula.functionList.SYD.functionParameter.life.name",detail:"formula.functionList.SYD.functionParameter.life.detail",example:"10",require:1,repeat:0},{name:"formula.functionList.SYD.functionParameter.per.name",detail:"formula.functionList.SYD.functionParameter.per.detail",example:"10",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.TBILLEQ,functionType:t.FunctionType.Financial,description:"formula.functionList.TBILLEQ.description",abstract:"formula.functionList.TBILLEQ.abstract",functionParameter:[{name:"formula.functionList.TBILLEQ.functionParameter.settlement.name",detail:"formula.functionList.TBILLEQ.functionParameter.settlement.detail",example:'"2008-3-31"',require:1,repeat:0},{name:"formula.functionList.TBILLEQ.functionParameter.maturity.name",detail:"formula.functionList.TBILLEQ.functionParameter.maturity.detail",example:'"2008-6-1"',require:1,repeat:0},{name:"formula.functionList.TBILLEQ.functionParameter.discount.name",detail:"formula.functionList.TBILLEQ.functionParameter.discount.detail",example:"9.14%",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.TBILLPRICE,functionType:t.FunctionType.Financial,description:"formula.functionList.TBILLPRICE.description",abstract:"formula.functionList.TBILLPRICE.abstract",functionParameter:[{name:"formula.functionList.TBILLPRICE.functionParameter.settlement.name",detail:"formula.functionList.TBILLPRICE.functionParameter.settlement.detail",example:'"2008-3-31"',require:1,repeat:0},{name:"formula.functionList.TBILLPRICE.functionParameter.maturity.name",detail:"formula.functionList.TBILLPRICE.functionParameter.maturity.detail",example:'"2008-6-1"',require:1,repeat:0},{name:"formula.functionList.TBILLPRICE.functionParameter.discount.name",detail:"formula.functionList.TBILLPRICE.functionParameter.discount.detail",example:"9.14%",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.TBILLYIELD,functionType:t.FunctionType.Financial,description:"formula.functionList.TBILLYIELD.description",abstract:"formula.functionList.TBILLYIELD.abstract",functionParameter:[{name:"formula.functionList.TBILLYIELD.functionParameter.settlement.name",detail:"formula.functionList.TBILLYIELD.functionParameter.settlement.detail",example:'"2008-3-31"',require:1,repeat:0},{name:"formula.functionList.TBILLYIELD.functionParameter.maturity.name",detail:"formula.functionList.TBILLYIELD.functionParameter.maturity.detail",example:'"2008-6-1"',require:1,repeat:0},{name:"formula.functionList.TBILLYIELD.functionParameter.pr.name",detail:"formula.functionList.TBILLYIELD.functionParameter.pr.detail",example:"98.45",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.VDB,functionType:t.FunctionType.Financial,description:"formula.functionList.VDB.description",abstract:"formula.functionList.VDB.abstract",functionParameter:[{name:"formula.functionList.VDB.functionParameter.cost.name",detail:"formula.functionList.VDB.functionParameter.cost.detail",example:"2400",require:1,repeat:0},{name:"formula.functionList.VDB.functionParameter.salvage.name",detail:"formula.functionList.VDB.functionParameter.salvage.detail",example:"300",require:1,repeat:0},{name:"formula.functionList.VDB.functionParameter.life.name",detail:"formula.functionList.VDB.functionParameter.life.detail",example:"10",require:1,repeat:0},{name:"formula.functionList.VDB.functionParameter.startPeriod.name",detail:"formula.functionList.VDB.functionParameter.startPeriod.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.VDB.functionParameter.endPeriod.name",detail:"formula.functionList.VDB.functionParameter.endPeriod.detail",example:"2",require:1,repeat:0},{name:"formula.functionList.VDB.functionParameter.factor.name",detail:"formula.functionList.VDB.functionParameter.factor.detail",example:"2",require:0,repeat:0},{name:"formula.functionList.VDB.functionParameter.noSwitch.name",detail:"formula.functionList.VDB.functionParameter.noSwitch.detail",example:"false",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.XIRR,functionType:t.FunctionType.Financial,description:"formula.functionList.XIRR.description",abstract:"formula.functionList.XIRR.abstract",functionParameter:[{name:"formula.functionList.XIRR.functionParameter.values.name",detail:"formula.functionList.XIRR.functionParameter.values.detail",example:"A1:A4",require:1,repeat:0},{name:"formula.functionList.XIRR.functionParameter.dates.name",detail:"formula.functionList.XIRR.functionParameter.dates.detail",example:"B1:B4",require:1,repeat:0},{name:"formula.functionList.XIRR.functionParameter.guess.name",detail:"formula.functionList.XIRR.functionParameter.guess.detail",example:"0.1",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.XNPV,functionType:t.FunctionType.Financial,description:"formula.functionList.XNPV.description",abstract:"formula.functionList.XNPV.abstract",functionParameter:[{name:"formula.functionList.XNPV.functionParameter.rate.name",detail:"formula.functionList.XNPV.functionParameter.rate.detail",example:"10%",require:1,repeat:0},{name:"formula.functionList.XNPV.functionParameter.values.name",detail:"formula.functionList.XNPV.functionParameter.values.detail",example:"A1:A4",require:1,repeat:0},{name:"formula.functionList.XNPV.functionParameter.dates.name",detail:"formula.functionList.XNPV.functionParameter.dates.detail",example:"B1:B4",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.YIELD,functionType:t.FunctionType.Financial,description:"formula.functionList.YIELD.description",abstract:"formula.functionList.YIELD.abstract",functionParameter:[{name:"formula.functionList.YIELD.functionParameter.settlement.name",detail:"formula.functionList.YIELD.functionParameter.settlement.detail",example:'"2008-11-11"',require:1,repeat:0},{name:"formula.functionList.YIELD.functionParameter.maturity.name",detail:"formula.functionList.YIELD.functionParameter.maturity.detail",example:'"2021-3-1"',require:1,repeat:0},{name:"formula.functionList.YIELD.functionParameter.rate.name",detail:"formula.functionList.YIELD.functionParameter.rate.detail",example:"7.85%",require:1,repeat:0},{name:"formula.functionList.YIELD.functionParameter.pr.name",detail:"formula.functionList.YIELD.functionParameter.pr.detail",example:"98.45",require:1,repeat:0},{name:"formula.functionList.YIELD.functionParameter.redemption.name",detail:"formula.functionList.YIELD.functionParameter.redemption.detail",example:"100",require:1,repeat:0},{name:"formula.functionList.YIELD.functionParameter.frequency.name",detail:"formula.functionList.YIELD.functionParameter.frequency.detail",example:"2",require:1,repeat:0},{name:"formula.functionList.YIELD.functionParameter.basis.name",detail:"formula.functionList.YIELD.functionParameter.basis.detail",example:"1",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.YIELDDISC,functionType:t.FunctionType.Financial,description:"formula.functionList.YIELDDISC.description",abstract:"formula.functionList.YIELDDISC.abstract",functionParameter:[{name:"formula.functionList.YIELDDISC.functionParameter.settlement.name",detail:"formula.functionList.YIELDDISC.functionParameter.settlement.detail",example:'"2008-11-11"',require:1,repeat:0},{name:"formula.functionList.YIELDDISC.functionParameter.maturity.name",detail:"formula.functionList.YIELDDISC.functionParameter.maturity.detail",example:'"2021-3-1"',require:1,repeat:0},{name:"formula.functionList.YIELDDISC.functionParameter.pr.name",detail:"formula.functionList.YIELDDISC.functionParameter.pr.detail",example:"98.45",require:1,repeat:0},{name:"formula.functionList.YIELDDISC.functionParameter.redemption.name",detail:"formula.functionList.YIELDDISC.functionParameter.redemption.detail",example:"100",require:1,repeat:0},{name:"formula.functionList.YIELDDISC.functionParameter.basis.name",detail:"formula.functionList.YIELDDISC.functionParameter.basis.detail",example:"1",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_FINANCIAL.YIELDMAT,functionType:t.FunctionType.Financial,description:"formula.functionList.YIELDMAT.description",abstract:"formula.functionList.YIELDMAT.abstract",functionParameter:[{name:"formula.functionList.YIELDMAT.functionParameter.settlement.name",detail:"formula.functionList.YIELDMAT.functionParameter.settlement.detail",example:'"2008-11-11"',require:1,repeat:0},{name:"formula.functionList.YIELDMAT.functionParameter.maturity.name",detail:"formula.functionList.YIELDMAT.functionParameter.maturity.detail",example:'"2021-3-1"',require:1,repeat:0},{name:"formula.functionList.YIELDMAT.functionParameter.issue.name",detail:"formula.functionList.YIELDMAT.functionParameter.issue.detail",example:'"2008-10-15"',require:1,repeat:0},{name:"formula.functionList.YIELDMAT.functionParameter.rate.name",detail:"formula.functionList.YIELDMAT.functionParameter.rate.detail",example:"7.85%",require:1,repeat:0},{name:"formula.functionList.YIELDMAT.functionParameter.pr.name",detail:"formula.functionList.YIELDMAT.functionParameter.pr.detail",example:"98.45",require:1,repeat:0},{name:"formula.functionList.YIELDMAT.functionParameter.basis.name",detail:"formula.functionList.YIELDMAT.functionParameter.basis.detail",example:"1",require:0,repeat:0}]}],je=[{functionName:t.FUNCTION_NAMES_INFORMATION.CELL,functionType:t.FunctionType.Information,description:"formula.functionList.CELL.description",abstract:"formula.functionList.CELL.abstract",functionParameter:[{name:"formula.functionList.CELL.functionParameter.infoType.name",detail:"formula.functionList.CELL.functionParameter.infoType.detail",example:'"type"',require:1,repeat:0},{name:"formula.functionList.CELL.functionParameter.reference.name",detail:"formula.functionList.CELL.functionParameter.reference.detail",example:"A1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_INFORMATION.ERROR_TYPE,functionType:t.FunctionType.Information,description:"formula.functionList.ERROR_TYPE.description",abstract:"formula.functionList.ERROR_TYPE.abstract",functionParameter:[{name:"formula.functionList.ERROR_TYPE.functionParameter.errorVal.name",detail:"formula.functionList.ERROR_TYPE.functionParameter.errorVal.detail",example:'"#NULL!"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_INFORMATION.INFO,functionType:t.FunctionType.Information,description:"formula.functionList.INFO.description",abstract:"formula.functionList.INFO.abstract",functionParameter:[{name:"formula.functionList.INFO.functionParameter.number1.name",detail:"formula.functionList.INFO.functionParameter.number1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.INFO.functionParameter.number2.name",detail:"formula.functionList.INFO.functionParameter.number2.detail",example:"A1:A20",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_INFORMATION.ISBETWEEN,functionType:t.FunctionType.Information,description:"formula.functionList.ISBETWEEN.description",abstract:"formula.functionList.ISBETWEEN.abstract",functionParameter:[{name:"formula.functionList.ISBETWEEN.functionParameter.valueToCompare.name",detail:"formula.functionList.ISBETWEEN.functionParameter.valueToCompare.detail",example:"7.9",require:1,repeat:0},{name:"formula.functionList.ISBETWEEN.functionParameter.lowerValue.name",detail:"formula.functionList.ISBETWEEN.functionParameter.lowerValue.detail",example:"1.2",require:1,repeat:0},{name:"formula.functionList.ISBETWEEN.functionParameter.upperValue.name",detail:"formula.functionList.ISBETWEEN.functionParameter.upperValue.detail",example:"12.45",require:1,repeat:0},{name:"formula.functionList.ISBETWEEN.functionParameter.lowerValueIsInclusive.name",detail:"formula.functionList.ISBETWEEN.functionParameter.lowerValueIsInclusive.detail",example:"true",require:0,repeat:0},{name:"formula.functionList.ISBETWEEN.functionParameter.upperValueIsInclusive.name",detail:"formula.functionList.ISBETWEEN.functionParameter.upperValueIsInclusive.detail",example:"true",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_INFORMATION.ISBLANK,functionType:t.FunctionType.Information,description:"formula.functionList.ISBLANK.description",abstract:"formula.functionList.ISBLANK.abstract",functionParameter:[{name:"formula.functionList.ISBLANK.functionParameter.value.name",detail:"formula.functionList.ISBLANK.functionParameter.value.detail",example:"A1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_INFORMATION.ISDATE,functionType:t.FunctionType.Information,description:"formula.functionList.ISDATE.description",abstract:"formula.functionList.ISDATE.abstract",functionParameter:[{name:"formula.functionList.ISDATE.functionParameter.value.name",detail:"formula.functionList.ISDATE.functionParameter.value.detail",example:"A1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_INFORMATION.ISEMAIL,functionType:t.FunctionType.Information,description:"formula.functionList.ISEMAIL.description",abstract:"formula.functionList.ISEMAIL.abstract",functionParameter:[{name:"formula.functionList.ISEMAIL.functionParameter.value.name",detail:"formula.functionList.ISEMAIL.functionParameter.value.detail",example:'"developer@univer.ai"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_INFORMATION.ISERR,functionType:t.FunctionType.Information,description:"formula.functionList.ISERR.description",abstract:"formula.functionList.ISERR.abstract",functionParameter:[{name:"formula.functionList.ISERR.functionParameter.value.name",detail:"formula.functionList.ISERR.functionParameter.value.detail",example:"A1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_INFORMATION.ISERROR,functionType:t.FunctionType.Information,description:"formula.functionList.ISERROR.description",abstract:"formula.functionList.ISERROR.abstract",functionParameter:[{name:"formula.functionList.ISERROR.functionParameter.value.name",detail:"formula.functionList.ISERROR.functionParameter.value.detail",example:"A1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_INFORMATION.ISEVEN,functionType:t.FunctionType.Information,description:"formula.functionList.ISEVEN.description",abstract:"formula.functionList.ISEVEN.abstract",functionParameter:[{name:"formula.functionList.ISEVEN.functionParameter.value.name",detail:"formula.functionList.ISEVEN.functionParameter.value.detail",example:"A1:A20",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_INFORMATION.ISFORMULA,functionType:t.FunctionType.Information,description:"formula.functionList.ISFORMULA.description",abstract:"formula.functionList.ISFORMULA.abstract",functionParameter:[{name:"formula.functionList.ISFORMULA.functionParameter.reference.name",detail:"formula.functionList.ISFORMULA.functionParameter.reference.detail",example:"A1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_INFORMATION.ISLOGICAL,functionType:t.FunctionType.Information,description:"formula.functionList.ISLOGICAL.description",abstract:"formula.functionList.ISLOGICAL.abstract",functionParameter:[{name:"formula.functionList.ISLOGICAL.functionParameter.value.name",detail:"formula.functionList.ISLOGICAL.functionParameter.value.detail",example:"A1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_INFORMATION.ISNA,functionType:t.FunctionType.Information,description:"formula.functionList.ISNA.description",abstract:"formula.functionList.ISNA.abstract",functionParameter:[{name:"formula.functionList.ISNA.functionParameter.value.name",detail:"formula.functionList.ISNA.functionParameter.value.detail",example:"A1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_INFORMATION.ISNONTEXT,functionType:t.FunctionType.Information,description:"formula.functionList.ISNONTEXT.description",abstract:"formula.functionList.ISNONTEXT.abstract",functionParameter:[{name:"formula.functionList.ISNONTEXT.functionParameter.value.name",detail:"formula.functionList.ISNONTEXT.functionParameter.value.detail",example:"A1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_INFORMATION.ISNUMBER,functionType:t.FunctionType.Information,description:"formula.functionList.ISNUMBER.description",abstract:"formula.functionList.ISNUMBER.abstract",functionParameter:[{name:"formula.functionList.ISNUMBER.functionParameter.value.name",detail:"formula.functionList.ISNUMBER.functionParameter.value.detail",example:"A1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_INFORMATION.ISODD,functionType:t.FunctionType.Information,description:"formula.functionList.ISODD.description",abstract:"formula.functionList.ISODD.abstract",functionParameter:[{name:"formula.functionList.ISODD.functionParameter.value.name",detail:"formula.functionList.ISODD.functionParameter.value.detail",example:"A1:A20",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_INFORMATION.ISOMITTED,functionType:t.FunctionType.Information,description:"formula.functionList.ISOMITTED.description",abstract:"formula.functionList.ISOMITTED.abstract",functionParameter:[{name:"formula.functionList.ISOMITTED.functionParameter.number1.name",detail:"formula.functionList.ISOMITTED.functionParameter.number1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.ISOMITTED.functionParameter.number2.name",detail:"formula.functionList.ISOMITTED.functionParameter.number2.detail",example:"A1:A20",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_INFORMATION.ISREF,functionType:t.FunctionType.Information,description:"formula.functionList.ISREF.description",abstract:"formula.functionList.ISREF.abstract",functionParameter:[{name:"formula.functionList.ISREF.functionParameter.value.name",detail:"formula.functionList.ISREF.functionParameter.value.detail",example:"A1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_INFORMATION.ISTEXT,functionType:t.FunctionType.Information,description:"formula.functionList.ISTEXT.description",abstract:"formula.functionList.ISTEXT.abstract",functionParameter:[{name:"formula.functionList.ISTEXT.functionParameter.value.name",detail:"formula.functionList.ISTEXT.functionParameter.value.detail",example:"A1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_INFORMATION.ISURL,functionType:t.FunctionType.Information,description:"formula.functionList.ISURL.description",abstract:"formula.functionList.ISURL.abstract",functionParameter:[{name:"formula.functionList.ISURL.functionParameter.value.name",detail:"formula.functionList.ISURL.functionParameter.value.detail",example:'"univer.ai"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_INFORMATION.N,functionType:t.FunctionType.Information,description:"formula.functionList.N.description",abstract:"formula.functionList.N.abstract",functionParameter:[{name:"formula.functionList.N.functionParameter.value.name",detail:"formula.functionList.N.functionParameter.value.detail",example:"7",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_INFORMATION.NA,functionType:t.FunctionType.Information,description:"formula.functionList.NA.description",abstract:"formula.functionList.NA.abstract",functionParameter:[]},{functionName:t.FUNCTION_NAMES_INFORMATION.SHEET,functionType:t.FunctionType.Information,description:"formula.functionList.SHEET.description",abstract:"formula.functionList.SHEET.abstract",functionParameter:[{name:"formula.functionList.SHEET.functionParameter.value.name",detail:"formula.functionList.SHEET.functionParameter.value.detail",example:"A1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_INFORMATION.SHEETS,functionType:t.FunctionType.Information,description:"formula.functionList.SHEETS.description",abstract:"formula.functionList.SHEETS.abstract",functionParameter:[]},{functionName:t.FUNCTION_NAMES_INFORMATION.TYPE,functionType:t.FunctionType.Information,description:"formula.functionList.TYPE.description",abstract:"formula.functionList.TYPE.abstract",functionParameter:[{name:"formula.functionList.TYPE.functionParameter.value.name",detail:"formula.functionList.TYPE.functionParameter.value.detail",example:"A2",require:1,repeat:0}]}],$e=[{functionName:t.FUNCTION_NAMES_LOGICAL.AND,functionType:t.FunctionType.Logical,description:"formula.functionList.AND.description",abstract:"formula.functionList.AND.abstract",functionParameter:[{name:"formula.functionList.AND.functionParameter.logical1.name",detail:"formula.functionList.AND.functionParameter.logical1.detail",example:"A1=1",require:1,repeat:0},{name:"formula.functionList.AND.functionParameter.logical2.name",detail:"formula.functionList.AND.functionParameter.logical2.detail",example:"A2=2",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_LOGICAL.BYCOL,functionType:t.FunctionType.Logical,description:"formula.functionList.BYCOL.description",abstract:"formula.functionList.BYCOL.abstract",functionParameter:[{name:"formula.functionList.BYCOL.functionParameter.array.name",detail:"formula.functionList.BYCOL.functionParameter.array.detail",example:"A1:C2",require:1,repeat:0},{name:"formula.functionList.BYCOL.functionParameter.lambda.name",detail:"formula.functionList.BYCOL.functionParameter.lambda.detail",example:"LAMBDA(array, MAX(array))",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOGICAL.BYROW,functionType:t.FunctionType.Logical,description:"formula.functionList.BYROW.description",abstract:"formula.functionList.BYROW.abstract",functionParameter:[{name:"formula.functionList.BYROW.functionParameter.array.name",detail:"formula.functionList.BYROW.functionParameter.array.detail",example:"A1:C2",require:1,repeat:0},{name:"formula.functionList.BYROW.functionParameter.lambda.name",detail:"formula.functionList.BYROW.functionParameter.lambda.detail",example:"LAMBDA(array, MAX(array))",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOGICAL.FALSE,functionType:t.FunctionType.Logical,description:"formula.functionList.FALSE.description",abstract:"formula.functionList.FALSE.abstract",functionParameter:[]},{functionName:t.FUNCTION_NAMES_LOGICAL.IF,functionType:t.FunctionType.Logical,description:"formula.functionList.IF.description",abstract:"formula.functionList.IF.abstract",functionParameter:[{name:"formula.functionList.IF.functionParameter.logicalTest.name",detail:"formula.functionList.IF.functionParameter.logicalTest.detail",example:'A2 = "foo"',require:1,repeat:0},{name:"formula.functionList.IF.functionParameter.valueIfTrue.name",detail:"formula.functionList.IF.functionParameter.valueIfTrue.detail",example:'"A2 is foo"',require:1,repeat:0},{name:"formula.functionList.IF.functionParameter.valueIfFalse.name",detail:"formula.functionList.IF.functionParameter.valueIfFalse.detail",example:'"A2 is not foo"',require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOGICAL.IFERROR,functionType:t.FunctionType.Logical,description:"formula.functionList.IFERROR.description",abstract:"formula.functionList.IFERROR.abstract",functionParameter:[{name:"formula.functionList.IFERROR.functionParameter.value.name",detail:"formula.functionList.IFERROR.functionParameter.value.detail",example:"A2/B2",require:1,repeat:0},{name:"formula.functionList.IFERROR.functionParameter.valueIfError.name",detail:"formula.functionList.IFERROR.functionParameter.valueIfError.detail",example:'"Error in calculation"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOGICAL.IFNA,functionType:t.FunctionType.Logical,description:"formula.functionList.IFNA.description",abstract:"formula.functionList.IFNA.abstract",functionParameter:[{name:"formula.functionList.IFNA.functionParameter.value.name",detail:"formula.functionList.IFNA.functionParameter.value.detail",example:"VLOOKUP(C3,C6:D11,2,FALSE)",require:1,repeat:0},{name:"formula.functionList.IFNA.functionParameter.valueIfNa.name",detail:"formula.functionList.IFNA.functionParameter.valueIfNa.detail",example:'"Not Found"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOGICAL.IFS,functionType:t.FunctionType.Logical,description:"formula.functionList.IFS.description",abstract:"formula.functionList.IFS.abstract",functionParameter:[{name:"formula.functionList.IFS.functionParameter.logicalTest1.name",detail:"formula.functionList.IFS.functionParameter.logicalTest1.detail",example:'A2 = "foo"',require:1,repeat:0},{name:"formula.functionList.IFS.functionParameter.valueIfTrue1.name",detail:"formula.functionList.IFS.functionParameter.valueIfTrue1.detail",example:'"A2 is foo"',require:1,repeat:0},{name:"formula.functionList.IFS.functionParameter.logicalTest2.name",detail:"formula.functionList.IFS.functionParameter.logicalTest2.detail",example:"F2=1",require:0,repeat:1},{name:"formula.functionList.IFS.functionParameter.valueIfTrue2.name",detail:"formula.functionList.IFS.functionParameter.valueIfTrue2.detail",example:"D2",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_LOGICAL.LAMBDA,functionType:t.FunctionType.Logical,description:"formula.functionList.LAMBDA.description",abstract:"formula.functionList.LAMBDA.abstract",functionParameter:[{name:"formula.functionList.LAMBDA.functionParameter.parameter.name",detail:"formula.functionList.LAMBDA.functionParameter.parameter.detail",example:"[x, y, …,]",require:0,repeat:1},{name:"formula.functionList.LAMBDA.functionParameter.calculation.name",detail:"formula.functionList.LAMBDA.functionParameter.calculation.detail",example:"x+y",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOGICAL.LET,functionType:t.FunctionType.Logical,description:"formula.functionList.LET.description",abstract:"formula.functionList.LET.abstract",functionParameter:[{name:"formula.functionList.LET.functionParameter.name1.name",detail:"formula.functionList.LET.functionParameter.name1.detail",example:"x",require:1,repeat:0},{name:"formula.functionList.LET.functionParameter.nameValue1.name",detail:"formula.functionList.LET.functionParameter.nameValue1.detail",example:"5",require:1,repeat:0},{name:"formula.functionList.LET.functionParameter.calculationOrName2.name",detail:"formula.functionList.LET.functionParameter.calculationOrName2.detail",example:"y",require:1,repeat:0},{name:"formula.functionList.LET.functionParameter.nameValue2.name",detail:"formula.functionList.LET.functionParameter.nameValue2.detail",example:"6",require:0,repeat:1},{name:"formula.functionList.LET.functionParameter.calculationOrName3.name",detail:"formula.functionList.LET.functionParameter.calculationOrName3.detail",example:"SUM(x,y)",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_LOGICAL.MAKEARRAY,aliasFunctionName:"formula.functionList.MAKEARRAY.aliasFunctionName",functionType:t.FunctionType.Logical,description:"formula.functionList.MAKEARRAY.description",abstract:"formula.functionList.MAKEARRAY.abstract",functionParameter:[{name:"formula.functionList.MAKEARRAY.functionParameter.number1.name",detail:"formula.functionList.MAKEARRAY.functionParameter.number1.detail",example:"8",require:1,repeat:0},{name:"formula.functionList.MAKEARRAY.functionParameter.number2.name",detail:"formula.functionList.MAKEARRAY.functionParameter.number2.detail",example:"7",require:1,repeat:0},{name:"formula.functionList.MAKEARRAY.functionParameter.value3.name",detail:"formula.functionList.MAKEARRAY.functionParameter.value3.detail",example:"LAMBDA(r,c, r*c)",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOGICAL.MAP,functionType:t.FunctionType.Logical,description:"formula.functionList.MAP.description",abstract:"formula.functionList.MAP.abstract",functionParameter:[{name:"formula.functionList.MAP.functionParameter.array1.name",detail:"formula.functionList.MAP.functionParameter.array1.detail",example:"D2:D11",require:1,repeat:0},{name:"formula.functionList.MAP.functionParameter.array2.name",detail:"formula.functionList.MAP.functionParameter.array2.detail",example:"E2:E11",require:0,repeat:1},{name:"formula.functionList.MAP.functionParameter.lambda.name",detail:"formula.functionList.MAP.functionParameter.lambda.detail",example:'LAMBDA(s,c,AND(s="Large",c="Red"))',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOGICAL.NOT,functionType:t.FunctionType.Logical,description:"formula.functionList.NOT.description",abstract:"formula.functionList.NOT.abstract",functionParameter:[{name:"formula.functionList.NOT.functionParameter.logical.name",detail:"formula.functionList.NOT.functionParameter.logical.detail",example:"A2>100",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOGICAL.OR,functionType:t.FunctionType.Logical,description:"formula.functionList.OR.description",abstract:"formula.functionList.OR.abstract",functionParameter:[{name:"formula.functionList.OR.functionParameter.logical1.name",detail:"formula.functionList.OR.functionParameter.logical1.detail",example:"A1=1",require:1,repeat:0},{name:"formula.functionList.OR.functionParameter.logical2.name",detail:"formula.functionList.OR.functionParameter.logical2.detail",example:"A2=2",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_LOGICAL.REDUCE,functionType:t.FunctionType.Logical,description:"formula.functionList.REDUCE.description",abstract:"formula.functionList.REDUCE.abstract",functionParameter:[{name:"formula.functionList.REDUCE.functionParameter.initialValue.name",detail:"formula.functionList.REDUCE.functionParameter.initialValue.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.REDUCE.functionParameter.array.name",detail:"formula.functionList.REDUCE.functionParameter.array.detail",example:"A1:C2",require:1,repeat:0},{name:"formula.functionList.REDUCE.functionParameter.lambda.name",detail:"formula.functionList.REDUCE.functionParameter.lambda.detail",example:"LAMBDA(a,b,a+b^2)",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOGICAL.SCAN,functionType:t.FunctionType.Logical,description:"formula.functionList.SCAN.description",abstract:"formula.functionList.SCAN.abstract",functionParameter:[{name:"formula.functionList.SCAN.functionParameter.initialValue.name",detail:"formula.functionList.SCAN.functionParameter.initialValue.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.SCAN.functionParameter.array.name",detail:"formula.functionList.SCAN.functionParameter.array.detail",example:"A1:C2",require:1,repeat:0},{name:"formula.functionList.SCAN.functionParameter.lambda.name",detail:"formula.functionList.SCAN.functionParameter.lambda.detail",example:"LAMBDA(a,b,a+b^2)",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOGICAL.SWITCH,functionType:t.FunctionType.Logical,description:"formula.functionList.SWITCH.description",abstract:"formula.functionList.SWITCH.abstract",functionParameter:[{name:"formula.functionList.SWITCH.functionParameter.expression.name",detail:"formula.functionList.SWITCH.functionParameter.expression.detail",example:"WEEKDAY(A2)",require:1,repeat:0},{name:"formula.functionList.SWITCH.functionParameter.value1.name",detail:"formula.functionList.SWITCH.functionParameter.value1.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.SWITCH.functionParameter.result1.name",detail:"formula.functionList.SWITCH.functionParameter.result1.detail",example:'"Sunday"',require:1,repeat:0},{name:"formula.functionList.SWITCH.functionParameter.defaultOrValue2.name",detail:"formula.functionList.SWITCH.functionParameter.defaultOrValue2.detail",example:"2",require:0,repeat:1},{name:"formula.functionList.SWITCH.functionParameter.result2.name",detail:"formula.functionList.SWITCH.functionParameter.result2.detail",example:'"Monday"',require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_LOGICAL.TRUE,functionType:t.FunctionType.Logical,description:"formula.functionList.TRUE.description",abstract:"formula.functionList.TRUE.abstract",functionParameter:[]},{functionName:t.FUNCTION_NAMES_LOGICAL.XOR,functionType:t.FunctionType.Logical,description:"formula.functionList.XOR.description",abstract:"formula.functionList.XOR.abstract",functionParameter:[{name:"formula.functionList.XOR.functionParameter.logical1.name",detail:"formula.functionList.XOR.functionParameter.logical1.detail",example:"3>0",require:1,repeat:0},{name:"formula.functionList.XOR.functionParameter.logical2.name",detail:"formula.functionList.XOR.functionParameter.logical2.detail",example:"2<9",require:0,repeat:1}]}],ze=[{functionName:t.FUNCTION_NAMES_LOOKUP.ADDRESS,functionType:t.FunctionType.Lookup,description:"formula.functionList.ADDRESS.description",abstract:"formula.functionList.ADDRESS.abstract",functionParameter:[{name:"formula.functionList.ADDRESS.functionParameter.row_num.name",detail:"formula.functionList.ADDRESS.functionParameter.row_num.detail",example:"2",require:1,repeat:0},{name:"formula.functionList.ADDRESS.functionParameter.column_num.name",detail:"formula.functionList.ADDRESS.functionParameter.column_num.detail",example:"2",require:1,repeat:0},{name:"formula.functionList.ADDRESS.functionParameter.abs_num.name",detail:"formula.functionList.ADDRESS.functionParameter.abs_num.detail",example:"1",require:0,repeat:0},{name:"formula.functionList.ADDRESS.functionParameter.a1.name",detail:"formula.functionList.ADDRESS.functionParameter.a1.detail",example:"TRUE",require:0,repeat:0},{name:"formula.functionList.ADDRESS.functionParameter.sheet_text.name",detail:"formula.functionList.ADDRESS.functionParameter.sheet_text.detail",example:'"Sheet2"',require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOOKUP.AREAS,functionType:t.FunctionType.Lookup,description:"formula.functionList.AREAS.description",abstract:"formula.functionList.AREAS.abstract",functionParameter:[{name:"formula.functionList.AREAS.functionParameter.reference.name",detail:"formula.functionList.AREAS.functionParameter.reference.detail",example:"A1:A20",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOOKUP.CHOOSE,functionType:t.FunctionType.Lookup,description:"formula.functionList.CHOOSE.description",abstract:"formula.functionList.CHOOSE.abstract",functionParameter:[{name:"formula.functionList.CHOOSE.functionParameter.indexNum.name",detail:"formula.functionList.CHOOSE.functionParameter.indexNum.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.CHOOSE.functionParameter.value1.name",detail:"formula.functionList.CHOOSE.functionParameter.value1.detail",example:'"Hello"',require:1,repeat:0},{name:"formula.functionList.CHOOSE.functionParameter.value2.name",detail:"formula.functionList.CHOOSE.functionParameter.value2.detail",example:'"Univer"',require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_LOOKUP.CHOOSECOLS,functionType:t.FunctionType.Lookup,description:"formula.functionList.CHOOSECOLS.description",abstract:"formula.functionList.CHOOSECOLS.abstract",functionParameter:[{name:"formula.functionList.CHOOSECOLS.functionParameter.array.name",detail:"formula.functionList.CHOOSECOLS.functionParameter.array.detail",example:"A1:C2",require:1,repeat:0},{name:"formula.functionList.CHOOSECOLS.functionParameter.colNum1.name",detail:"formula.functionList.CHOOSECOLS.functionParameter.colNum1.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.CHOOSECOLS.functionParameter.colNum2.name",detail:"formula.functionList.CHOOSECOLS.functionParameter.colNum2.detail",example:"2",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_LOOKUP.CHOOSEROWS,functionType:t.FunctionType.Lookup,description:"formula.functionList.CHOOSEROWS.description",abstract:"formula.functionList.CHOOSEROWS.abstract",functionParameter:[{name:"formula.functionList.CHOOSEROWS.functionParameter.array.name",detail:"formula.functionList.CHOOSEROWS.functionParameter.array.detail",example:"A1:C2",require:1,repeat:0},{name:"formula.functionList.CHOOSEROWS.functionParameter.rowNum1.name",detail:"formula.functionList.CHOOSEROWS.functionParameter.rowNum1.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.CHOOSEROWS.functionParameter.rowNum2.name",detail:"formula.functionList.CHOOSEROWS.functionParameter.rowNum2.detail",example:"2",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_LOOKUP.COLUMN,functionType:t.FunctionType.Lookup,description:"formula.functionList.COLUMN.description",abstract:"formula.functionList.COLUMN.abstract",functionParameter:[{name:"formula.functionList.COLUMN.functionParameter.reference.name",detail:"formula.functionList.COLUMN.functionParameter.reference.detail",example:"A1:A20",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOOKUP.COLUMNS,functionType:t.FunctionType.Lookup,description:"formula.functionList.COLUMNS.description",abstract:"formula.functionList.COLUMNS.abstract",functionParameter:[{name:"formula.functionList.COLUMNS.functionParameter.array.name",detail:"formula.functionList.COLUMNS.functionParameter.array.detail",example:"A1:A20",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOOKUP.DROP,functionType:t.FunctionType.Lookup,description:"formula.functionList.DROP.description",abstract:"formula.functionList.DROP.abstract",functionParameter:[{name:"formula.functionList.DROP.functionParameter.array.name",detail:"formula.functionList.DROP.functionParameter.array.detail",example:"A2:C4",require:1,repeat:0},{name:"formula.functionList.DROP.functionParameter.rows.name",detail:"formula.functionList.DROP.functionParameter.rows.detail",example:"2",require:1,repeat:0},{name:"formula.functionList.DROP.functionParameter.columns.name",detail:"formula.functionList.DROP.functionParameter.columns.detail",example:"2",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOOKUP.EXPAND,functionType:t.FunctionType.Lookup,description:"formula.functionList.EXPAND.description",abstract:"formula.functionList.EXPAND.abstract",functionParameter:[{name:"formula.functionList.EXPAND.functionParameter.array.name",detail:"formula.functionList.EXPAND.functionParameter.array.detail",example:"A2",require:1,repeat:0},{name:"formula.functionList.EXPAND.functionParameter.rows.name",detail:"formula.functionList.EXPAND.functionParameter.rows.detail",example:"3",require:1,repeat:0},{name:"formula.functionList.EXPAND.functionParameter.columns.name",detail:"formula.functionList.EXPAND.functionParameter.columns.detail",example:"3",require:0,repeat:0},{name:"formula.functionList.EXPAND.functionParameter.padWith.name",detail:"formula.functionList.EXPAND.functionParameter.padWith.detail",example:'"-"',require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOOKUP.FILTER,functionType:t.FunctionType.Lookup,description:"formula.functionList.FILTER.description",abstract:"formula.functionList.FILTER.abstract",functionParameter:[{name:"formula.functionList.FILTER.functionParameter.array.name",detail:"formula.functionList.FILTER.functionParameter.array.detail",example:"A5:D20",require:1,repeat:0},{name:"formula.functionList.FILTER.functionParameter.include.name",detail:"formula.functionList.FILTER.functionParameter.include.detail",example:'(C5:C20="Apple")*(A5:A20="East")',require:1,repeat:0},{name:"formula.functionList.FILTER.functionParameter.ifEmpty.name",detail:"formula.functionList.FILTER.functionParameter.ifEmpty.detail",example:'""',require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOOKUP.FORMULATEXT,functionType:t.FunctionType.Lookup,description:"formula.functionList.FORMULATEXT.description",abstract:"formula.functionList.FORMULATEXT.abstract",functionParameter:[{name:"formula.functionList.FORMULATEXT.functionParameter.reference.name",detail:"formula.functionList.FORMULATEXT.functionParameter.reference.detail",example:"A1:A20",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOOKUP.GETPIVOTDATA,functionType:t.FunctionType.Lookup,description:"formula.functionList.GETPIVOTDATA.description",abstract:"formula.functionList.GETPIVOTDATA.abstract",functionParameter:[{name:"formula.functionList.GETPIVOTDATA.functionParameter.number1.name",detail:"formula.functionList.GETPIVOTDATA.functionParameter.number1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.GETPIVOTDATA.functionParameter.number2.name",detail:"formula.functionList.GETPIVOTDATA.functionParameter.number2.detail",example:"A1:A20",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOOKUP.HLOOKUP,functionType:t.FunctionType.Lookup,description:"formula.functionList.HLOOKUP.description",abstract:"formula.functionList.HLOOKUP.abstract",functionParameter:[{name:"formula.functionList.HLOOKUP.functionParameter.lookupValue.name",detail:"formula.functionList.HLOOKUP.functionParameter.lookupValue.detail",example:"A1",require:1,repeat:0},{name:"formula.functionList.HLOOKUP.functionParameter.tableArray.name",detail:"formula.functionList.HLOOKUP.functionParameter.tableArray.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.HLOOKUP.functionParameter.rowIndexNum.name",detail:"formula.functionList.HLOOKUP.functionParameter.rowIndexNum.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.HLOOKUP.functionParameter.rangeLookup.name",detail:"formula.functionList.HLOOKUP.functionParameter.rangeLookup.detail",example:"false",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOOKUP.HSTACK,functionType:t.FunctionType.Lookup,description:"formula.functionList.HSTACK.description",abstract:"formula.functionList.HSTACK.abstract",functionParameter:[{name:"formula.functionList.HSTACK.functionParameter.array1.name",detail:"formula.functionList.HSTACK.functionParameter.array1.detail",example:"A2:C3",require:1,repeat:0},{name:"formula.functionList.HSTACK.functionParameter.array2.name",detail:"formula.functionList.HSTACK.functionParameter.array2.detail",example:"E2:G3",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_LOOKUP.HYPERLINK,functionType:t.FunctionType.Lookup,description:"formula.functionList.HYPERLINK.description",abstract:"formula.functionList.HYPERLINK.abstract",functionParameter:[{name:"formula.functionList.HYPERLINK.functionParameter.url.name",detail:"formula.functionList.HYPERLINK.functionParameter.url.detail",example:'"https://univer.ai/"',require:1,repeat:0},{name:"formula.functionList.HYPERLINK.functionParameter.linkLabel.name",detail:"formula.functionList.HYPERLINK.functionParameter.linkLabel.detail",example:'"Univer"',require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOOKUP.IMAGE,functionType:t.FunctionType.Lookup,description:"formula.functionList.IMAGE.description",abstract:"formula.functionList.IMAGE.abstract",functionParameter:[{name:"formula.functionList.IMAGE.functionParameter.source.name",detail:"formula.functionList.IMAGE.functionParameter.source.detail",example:'"https://github.com/dream-num.png"',require:1,repeat:0},{name:"formula.functionList.IMAGE.functionParameter.altText.name",detail:"formula.functionList.IMAGE.functionParameter.altText.detail",example:'"Univer Logo"',require:0,repeat:0},{name:"formula.functionList.IMAGE.functionParameter.sizing.name",detail:"formula.functionList.IMAGE.functionParameter.sizing.detail",example:"3",require:0,repeat:0},{name:"formula.functionList.IMAGE.functionParameter.height.name",detail:"formula.functionList.IMAGE.functionParameter.height.detail",example:"100",require:0,repeat:0},{name:"formula.functionList.IMAGE.functionParameter.width.name",detail:"formula.functionList.IMAGE.functionParameter.width.detail",example:"100",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOOKUP.INDEX,functionType:t.FunctionType.Lookup,description:"formula.functionList.INDEX.description",abstract:"formula.functionList.INDEX.abstract",functionParameter:[{name:"formula.functionList.INDEX.functionParameter.reference.name",detail:"formula.functionList.INDEX.functionParameter.reference.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.INDEX.functionParameter.rowNum.name",detail:"formula.functionList.INDEX.functionParameter.rowNum.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.INDEX.functionParameter.columnNum.name",detail:"formula.functionList.INDEX.functionParameter.columnNum.detail",example:"1",require:0,repeat:0},{name:"formula.functionList.INDEX.functionParameter.areaNum.name",detail:"formula.functionList.INDEX.functionParameter.areaNum.detail",example:"2",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOOKUP.INDIRECT,functionType:t.FunctionType.Lookup,description:"formula.functionList.INDIRECT.description",abstract:"formula.functionList.INDIRECT.abstract",functionParameter:[{name:"formula.functionList.INDIRECT.functionParameter.refText.name",detail:"formula.functionList.INDIRECT.functionParameter.refText.detail",example:'"A1"',require:1,repeat:0},{name:"formula.functionList.INDIRECT.functionParameter.a1.name",detail:"formula.functionList.INDIRECT.functionParameter.a1.detail",example:"TRUE",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOOKUP.LOOKUP,functionType:t.FunctionType.Lookup,description:"formula.functionList.LOOKUP.description",abstract:"formula.functionList.LOOKUP.abstract",functionParameter:[{name:"formula.functionList.LOOKUP.functionParameter.lookupValue.name",detail:"formula.functionList.LOOKUP.functionParameter.lookupValue.detail",example:"A1",require:1,repeat:0},{name:"formula.functionList.LOOKUP.functionParameter.lookupVectorOrArray.name",detail:"formula.functionList.LOOKUP.functionParameter.lookupVectorOrArray.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.LOOKUP.functionParameter.resultVector.name",detail:"formula.functionList.LOOKUP.functionParameter.resultVector.detail",example:"A1:A20",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOOKUP.MATCH,functionType:t.FunctionType.Lookup,description:"formula.functionList.MATCH.description",abstract:"formula.functionList.MATCH.abstract",functionParameter:[{name:"formula.functionList.MATCH.functionParameter.lookupValue.name",detail:"formula.functionList.MATCH.functionParameter.lookupValue.detail",example:"10",require:1,repeat:0},{name:"formula.functionList.MATCH.functionParameter.lookupArray.name",detail:"formula.functionList.MATCH.functionParameter.lookupArray.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.MATCH.functionParameter.matchType.name",detail:"formula.functionList.MATCH.functionParameter.matchType.detail",example:"1",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOOKUP.OFFSET,functionType:t.FunctionType.Lookup,description:"formula.functionList.OFFSET.description",abstract:"formula.functionList.OFFSET.abstract",functionParameter:[{name:"formula.functionList.OFFSET.functionParameter.reference.name",detail:"formula.functionList.OFFSET.functionParameter.reference.detail",example:"A1",require:1,repeat:0},{name:"formula.functionList.OFFSET.functionParameter.rows.name",detail:"formula.functionList.OFFSET.functionParameter.rows.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.OFFSET.functionParameter.cols.name",detail:"formula.functionList.OFFSET.functionParameter.cols.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.OFFSET.functionParameter.height.name",detail:"formula.functionList.OFFSET.functionParameter.height.detail",example:"1",require:0,repeat:0},{name:"formula.functionList.OFFSET.functionParameter.width.name",detail:"formula.functionList.OFFSET.functionParameter.width.detail",example:"1",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOOKUP.ROW,functionType:t.FunctionType.Lookup,description:"formula.functionList.ROW.description",abstract:"formula.functionList.ROW.abstract",functionParameter:[{name:"formula.functionList.ROW.functionParameter.reference.name",detail:"formula.functionList.ROW.functionParameter.reference.detail",example:"A1",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOOKUP.ROWS,functionType:t.FunctionType.Lookup,description:"formula.functionList.ROWS.description",abstract:"formula.functionList.ROWS.abstract",functionParameter:[{name:"formula.functionList.ROWS.functionParameter.array.name",detail:"formula.functionList.ROWS.functionParameter.array.detail",example:"A1:A20",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOOKUP.RTD,functionType:t.FunctionType.Lookup,description:"formula.functionList.RTD.description",abstract:"formula.functionList.RTD.abstract",functionParameter:[{name:"formula.functionList.RTD.functionParameter.number1.name",detail:"formula.functionList.RTD.functionParameter.number1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.RTD.functionParameter.number2.name",detail:"formula.functionList.RTD.functionParameter.number2.detail",example:"A1:A20",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOOKUP.SORT,functionType:t.FunctionType.Lookup,description:"formula.functionList.SORT.description",abstract:"formula.functionList.SORT.abstract",functionParameter:[{name:"formula.functionList.SORT.functionParameter.array.name",detail:"formula.functionList.SORT.functionParameter.array.detail",example:"A2:A17",require:1,repeat:0},{name:"formula.functionList.SORT.functionParameter.sortIndex.name",detail:"formula.functionList.SORT.functionParameter.sortIndex.detail",example:"1",require:0,repeat:0},{name:"formula.functionList.SORT.functionParameter.sortOrder.name",detail:"formula.functionList.SORT.functionParameter.sortOrder.detail",example:"1",require:0,repeat:0},{name:"formula.functionList.SORT.functionParameter.byCol.name",detail:"formula.functionList.SORT.functionParameter.byCol.detail",example:"false",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOOKUP.SORTBY,functionType:t.FunctionType.Lookup,description:"formula.functionList.SORTBY.description",abstract:"formula.functionList.SORTBY.abstract",functionParameter:[{name:"formula.functionList.SORTBY.functionParameter.array.name",detail:"formula.functionList.SORTBY.functionParameter.array.detail",example:"D2:D9",require:1,repeat:0},{name:"formula.functionList.SORTBY.functionParameter.byArray1.name",detail:"formula.functionList.SORTBY.functionParameter.byArray1.detail",example:"E2:E9",require:1,repeat:0},{name:"formula.functionList.SORTBY.functionParameter.sortOrder1.name",detail:"formula.functionList.SORTBY.functionParameter.sortOrder1.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.SORTBY.functionParameter.byArray2.name",detail:"formula.functionList.SORTBY.functionParameter.byArray2.detail",example:"E2:E9",require:0,repeat:1},{name:"formula.functionList.SORTBY.functionParameter.sortOrder2.name",detail:"formula.functionList.SORTBY.functionParameter.sortOrder2.detail",example:"1",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_LOOKUP.TAKE,functionType:t.FunctionType.Lookup,description:"formula.functionList.TAKE.description",abstract:"formula.functionList.TAKE.abstract",functionParameter:[{name:"formula.functionList.TAKE.functionParameter.array.name",detail:"formula.functionList.TAKE.functionParameter.array.detail",example:"A2:C4",require:1,repeat:0},{name:"formula.functionList.TAKE.functionParameter.rows.name",detail:"formula.functionList.TAKE.functionParameter.rows.detail",example:"2",require:1,repeat:0},{name:"formula.functionList.TAKE.functionParameter.columns.name",detail:"formula.functionList.TAKE.functionParameter.columns.detail",example:"2",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOOKUP.TOCOL,functionType:t.FunctionType.Lookup,description:"formula.functionList.TOCOL.description",abstract:"formula.functionList.TOCOL.abstract",functionParameter:[{name:"formula.functionList.TOCOL.functionParameter.array.name",detail:"formula.functionList.TOCOL.functionParameter.array.detail",example:"A2:D4",require:1,repeat:0},{name:"formula.functionList.TOCOL.functionParameter.ignore.name",detail:"formula.functionList.TOCOL.functionParameter.ignore.detail",example:"1",require:0,repeat:0},{name:"formula.functionList.TOCOL.functionParameter.scanByColumn.name",detail:"formula.functionList.TOCOL.functionParameter.scanByColumn.detail",example:"TRUE",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOOKUP.TOROW,functionType:t.FunctionType.Lookup,description:"formula.functionList.TOROW.description",abstract:"formula.functionList.TOROW.abstract",functionParameter:[{name:"formula.functionList.TOROW.functionParameter.array.name",detail:"formula.functionList.TOROW.functionParameter.array.detail",example:"A2:D4",require:1,repeat:0},{name:"formula.functionList.TOROW.functionParameter.ignore.name",detail:"formula.functionList.TOROW.functionParameter.ignore.detail",example:"1",require:0,repeat:0},{name:"formula.functionList.TOROW.functionParameter.scanByColumn.name",detail:"formula.functionList.TOROW.functionParameter.scanByColumn.detail",example:"TRUE",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOOKUP.TRANSPOSE,functionType:t.FunctionType.Lookup,description:"formula.functionList.TRANSPOSE.description",abstract:"formula.functionList.TRANSPOSE.abstract",functionParameter:[{name:"formula.functionList.TRANSPOSE.functionParameter.array.name",detail:"formula.functionList.TRANSPOSE.functionParameter.array.detail",example:"A2:F9",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOOKUP.UNIQUE,functionType:t.FunctionType.Lookup,description:"formula.functionList.UNIQUE.description",abstract:"formula.functionList.UNIQUE.abstract",functionParameter:[{name:"formula.functionList.UNIQUE.functionParameter.array.name",detail:"formula.functionList.UNIQUE.functionParameter.array.detail",example:"A2:A12",require:1,repeat:0},{name:"formula.functionList.UNIQUE.functionParameter.byCol.name",detail:"formula.functionList.UNIQUE.functionParameter.byCol.detail",example:"false",require:0,repeat:0},{name:"formula.functionList.UNIQUE.functionParameter.exactlyOnce.name",detail:"formula.functionList.UNIQUE.functionParameter.exactlyOnce.detail",example:"false",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOOKUP.VLOOKUP,functionType:t.FunctionType.Lookup,description:"formula.functionList.VLOOKUP.description",abstract:"formula.functionList.VLOOKUP.abstract",functionParameter:[{name:"formula.functionList.VLOOKUP.functionParameter.lookupValue.name",detail:"formula.functionList.VLOOKUP.functionParameter.lookupValue.detail",example:"B2",require:1,repeat:0},{name:"formula.functionList.VLOOKUP.functionParameter.tableArray.name",detail:"formula.functionList.VLOOKUP.functionParameter.tableArray.detail",example:"C2:E7",require:1,repeat:0},{name:"formula.functionList.VLOOKUP.functionParameter.colIndexNum.name",detail:"formula.functionList.VLOOKUP.functionParameter.colIndexNum.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.VLOOKUP.functionParameter.rangeLookup.name",detail:"formula.functionList.VLOOKUP.functionParameter.rangeLookup.detail",example:"TRUE",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOOKUP.VSTACK,functionType:t.FunctionType.Lookup,description:"formula.functionList.VSTACK.description",abstract:"formula.functionList.VSTACK.abstract",functionParameter:[{name:"formula.functionList.VSTACK.functionParameter.array1.name",detail:"formula.functionList.VSTACK.functionParameter.array1.detail",example:"A2:C3",require:1,repeat:0},{name:"formula.functionList.VSTACK.functionParameter.array2.name",detail:"formula.functionList.VSTACK.functionParameter.array2.detail",example:"E2:G3",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_LOOKUP.WRAPCOLS,functionType:t.FunctionType.Lookup,description:"formula.functionList.WRAPCOLS.description",abstract:"formula.functionList.WRAPCOLS.abstract",functionParameter:[{name:"formula.functionList.WRAPCOLS.functionParameter.vector.name",detail:"formula.functionList.WRAPCOLS.functionParameter.vector.detail",example:"A2:G2",require:1,repeat:0},{name:"formula.functionList.WRAPCOLS.functionParameter.wrapCount.name",detail:"formula.functionList.WRAPCOLS.functionParameter.wrapCount.detail",example:"3",require:1,repeat:0},{name:"formula.functionList.WRAPCOLS.functionParameter.padWith.name",detail:"formula.functionList.WRAPCOLS.functionParameter.padWith.detail",example:'"x"',require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOOKUP.WRAPROWS,functionType:t.FunctionType.Lookup,description:"formula.functionList.WRAPROWS.description",abstract:"formula.functionList.WRAPROWS.abstract",functionParameter:[{name:"formula.functionList.WRAPROWS.functionParameter.vector.name",detail:"formula.functionList.WRAPROWS.functionParameter.vector.detail",example:"A2:G2",require:1,repeat:0},{name:"formula.functionList.WRAPROWS.functionParameter.wrapCount.name",detail:"formula.functionList.WRAPROWS.functionParameter.wrapCount.detail",example:"3",require:1,repeat:0},{name:"formula.functionList.WRAPROWS.functionParameter.padWith.name",detail:"formula.functionList.WRAPROWS.functionParameter.padWith.detail",example:'"x"',require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOOKUP.XLOOKUP,functionType:t.FunctionType.Lookup,description:"formula.functionList.XLOOKUP.description",abstract:"formula.functionList.XLOOKUP.abstract",functionParameter:[{name:"formula.functionList.XLOOKUP.functionParameter.lookupValue.name",detail:"formula.functionList.XLOOKUP.functionParameter.lookupValue.detail",example:"A1",require:1,repeat:0},{name:"formula.functionList.XLOOKUP.functionParameter.lookupArray.name",detail:"formula.functionList.XLOOKUP.functionParameter.lookupArray.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.XLOOKUP.functionParameter.returnArray.name",detail:"formula.functionList.XLOOKUP.functionParameter.returnArray.detail",example:"B1:B20",require:1,repeat:0},{name:"formula.functionList.XLOOKUP.functionParameter.ifNotFound.name",detail:"formula.functionList.XLOOKUP.functionParameter.ifNotFound.detail",example:"default",require:0,repeat:0},{name:"formula.functionList.XLOOKUP.functionParameter.matchMode.name",detail:"formula.functionList.XLOOKUP.functionParameter.matchMode.detail",example:"0",require:0,repeat:0},{name:"formula.functionList.XLOOKUP.functionParameter.searchMode.name",detail:"formula.functionList.XLOOKUP.functionParameter.searchMode.detail",example:"1",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_LOOKUP.XMATCH,functionType:t.FunctionType.Lookup,description:"formula.functionList.XMATCH.description",abstract:"formula.functionList.XMATCH.abstract",functionParameter:[{name:"formula.functionList.XMATCH.functionParameter.lookupValue.name",detail:"formula.functionList.XMATCH.functionParameter.lookupValue.detail",example:"B1",require:1,repeat:0},{name:"formula.functionList.XMATCH.functionParameter.lookupArray.name",detail:"formula.functionList.XMATCH.functionParameter.lookupArray.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.XMATCH.functionParameter.matchMode.name",detail:"formula.functionList.XMATCH.functionParameter.matchMode.detail",example:"0",require:0,repeat:0},{name:"formula.functionList.XMATCH.functionParameter.searchMode.name",detail:"formula.functionList.XMATCH.functionParameter.searchMode.detail",example:"1",require:0,repeat:0}]}],Ze=[{functionName:t.FUNCTION_NAMES_MATH.ABS,functionType:t.FunctionType.Math,description:"formula.functionList.ABS.description",abstract:"formula.functionList.ABS.abstract",functionParameter:[{name:"formula.functionList.ABS.functionParameter.number.name",detail:"formula.functionList.ABS.functionParameter.number.detail",example:"-2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.ACOS,functionType:t.FunctionType.Math,description:"formula.functionList.ACOS.description",abstract:"formula.functionList.ACOS.abstract",functionParameter:[{name:"formula.functionList.ACOS.functionParameter.number.name",detail:"formula.functionList.ACOS.functionParameter.number.detail",example:"0",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.ACOSH,functionType:t.FunctionType.Math,description:"formula.functionList.ACOSH.description",abstract:"formula.functionList.ACOSH.abstract",functionParameter:[{name:"formula.functionList.ACOSH.functionParameter.number.name",detail:"formula.functionList.ACOSH.functionParameter.number.detail",example:"2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.ACOT,functionType:t.FunctionType.Math,description:"formula.functionList.ACOT.description",abstract:"formula.functionList.ACOT.abstract",functionParameter:[{name:"formula.functionList.ACOT.functionParameter.number.name",detail:"formula.functionList.ACOT.functionParameter.number.detail",example:"0",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.ACOTH,functionType:t.FunctionType.Math,description:"formula.functionList.ACOTH.description",abstract:"formula.functionList.ACOTH.abstract",functionParameter:[{name:"formula.functionList.ACOTH.functionParameter.number.name",detail:"formula.functionList.ACOTH.functionParameter.number.detail",example:"6",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.AGGREGATE,functionType:t.FunctionType.Math,description:"formula.functionList.AGGREGATE.description",abstract:"formula.functionList.AGGREGATE.abstract",functionParameter:[{name:"formula.functionList.AGGREGATE.functionParameter.functionNum.name",detail:"formula.functionList.AGGREGATE.functionParameter.functionNum.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.AGGREGATE.functionParameter.options.name",detail:"formula.functionList.AGGREGATE.functionParameter.options.detail",example:"6",require:1,repeat:0},{name:"formula.functionList.AGGREGATE.functionParameter.ref1.name",detail:"formula.functionList.AGGREGATE.functionParameter.ref1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.AGGREGATE.functionParameter.ref2.name",detail:"formula.functionList.AGGREGATE.functionParameter.ref2.detail",example:"B1:B20",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_MATH.ARABIC,functionType:t.FunctionType.Math,description:"formula.functionList.ARABIC.description",abstract:"formula.functionList.ARABIC.abstract",functionParameter:[{name:"formula.functionList.ARABIC.functionParameter.text.name",detail:"formula.functionList.ARABIC.functionParameter.text.detail",example:'"LVII"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.ASIN,functionType:t.FunctionType.Math,description:"formula.functionList.ASIN.description",abstract:"formula.functionList.ASIN.abstract",functionParameter:[{name:"formula.functionList.ASIN.functionParameter.number.name",detail:"formula.functionList.ASIN.functionParameter.number.detail",example:"0",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.ASINH,functionType:t.FunctionType.Math,description:"formula.functionList.ASINH.description",abstract:"formula.functionList.ASINH.abstract",functionParameter:[{name:"formula.functionList.ASINH.functionParameter.number.name",detail:"formula.functionList.ASINH.functionParameter.number.detail",example:"10",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.ATAN,functionType:t.FunctionType.Math,description:"formula.functionList.ATAN.description",abstract:"formula.functionList.ATAN.abstract",functionParameter:[{name:"formula.functionList.ATAN.functionParameter.number.name",detail:"formula.functionList.ATAN.functionParameter.number.detail",example:"1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.ATAN2,functionType:t.FunctionType.Math,description:"formula.functionList.ATAN2.description",abstract:"formula.functionList.ATAN2.abstract",functionParameter:[{name:"formula.functionList.ATAN2.functionParameter.xNum.name",detail:"formula.functionList.ATAN2.functionParameter.xNum.detail",example:"4",require:1,repeat:0},{name:"formula.functionList.ATAN2.functionParameter.yNum.name",detail:"formula.functionList.ATAN2.functionParameter.yNum.detail",example:"3",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.ATANH,functionType:t.FunctionType.Math,description:"formula.functionList.ATANH.description",abstract:"formula.functionList.ATANH.abstract",functionParameter:[{name:"formula.functionList.ATANH.functionParameter.number.name",detail:"formula.functionList.ATANH.functionParameter.number.detail",example:"0.1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.BASE,functionType:t.FunctionType.Math,description:"formula.functionList.BASE.description",abstract:"formula.functionList.BASE.abstract",functionParameter:[{name:"formula.functionList.BASE.functionParameter.number.name",detail:"formula.functionList.BASE.functionParameter.number.detail",example:"15",require:1,repeat:0},{name:"formula.functionList.BASE.functionParameter.radix.name",detail:"formula.functionList.BASE.functionParameter.radix.detail",example:"2",require:1,repeat:0},{name:"formula.functionList.BASE.functionParameter.minLength.name",detail:"formula.functionList.BASE.functionParameter.minLength.detail",example:"10",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.CEILING,functionType:t.FunctionType.Math,description:"formula.functionList.CEILING.description",abstract:"formula.functionList.CEILING.abstract",functionParameter:[{name:"formula.functionList.CEILING.functionParameter.number.name",detail:"formula.functionList.CEILING.functionParameter.number.detail",example:"2.5",require:1,repeat:0},{name:"formula.functionList.CEILING.functionParameter.significance.name",detail:"formula.functionList.CEILING.functionParameter.significance.detail",example:"1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.CEILING_MATH,functionType:t.FunctionType.Math,description:"formula.functionList.CEILING_MATH.description",abstract:"formula.functionList.CEILING_MATH.abstract",functionParameter:[{name:"formula.functionList.CEILING_MATH.functionParameter.number.name",detail:"formula.functionList.CEILING_MATH.functionParameter.number.detail",example:"-5.5",require:1,repeat:0},{name:"formula.functionList.CEILING_MATH.functionParameter.significance.name",detail:"formula.functionList.CEILING_MATH.functionParameter.significance.detail",example:"2",require:0,repeat:0},{name:"formula.functionList.CEILING_MATH.functionParameter.mode.name",detail:"formula.functionList.CEILING_MATH.functionParameter.mode.detail",example:"-1",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.CEILING_PRECISE,functionType:t.FunctionType.Math,description:"formula.functionList.CEILING_PRECISE.description",abstract:"formula.functionList.CEILING_PRECISE.abstract",functionParameter:[{name:"formula.functionList.CEILING_PRECISE.functionParameter.number.name",detail:"formula.functionList.CEILING_PRECISE.functionParameter.number.detail",example:"4.3",require:1,repeat:0},{name:"formula.functionList.CEILING_PRECISE.functionParameter.significance.name",detail:"formula.functionList.CEILING_PRECISE.functionParameter.significance.detail",example:"2",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.COMBIN,functionType:t.FunctionType.Math,description:"formula.functionList.COMBIN.description",abstract:"formula.functionList.COMBIN.abstract",functionParameter:[{name:"formula.functionList.COMBIN.functionParameter.number.name",detail:"formula.functionList.COMBIN.functionParameter.number.detail",example:"8",require:1,repeat:0},{name:"formula.functionList.COMBIN.functionParameter.numberChosen.name",detail:"formula.functionList.COMBIN.functionParameter.numberChosen.detail",example:"2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.COMBINA,functionType:t.FunctionType.Math,description:"formula.functionList.COMBINA.description",abstract:"formula.functionList.COMBINA.abstract",functionParameter:[{name:"formula.functionList.COMBINA.functionParameter.number.name",detail:"formula.functionList.COMBINA.functionParameter.number.detail",example:"8",require:1,repeat:0},{name:"formula.functionList.COMBINA.functionParameter.numberChosen.name",detail:"formula.functionList.COMBINA.functionParameter.numberChosen.detail",example:"2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.COS,functionType:t.FunctionType.Math,description:"formula.functionList.COS.description",abstract:"formula.functionList.COS.abstract",functionParameter:[{name:"formula.functionList.COS.functionParameter.number.name",detail:"formula.functionList.COS.functionParameter.number.detail",example:"1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.COSH,functionType:t.FunctionType.Math,description:"formula.functionList.COSH.description",abstract:"formula.functionList.COSH.abstract",functionParameter:[{name:"formula.functionList.COSH.functionParameter.number.name",detail:"formula.functionList.COSH.functionParameter.number.detail",example:"4",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.COT,functionType:t.FunctionType.Math,description:"formula.functionList.COT.description",abstract:"formula.functionList.COT.abstract",functionParameter:[{name:"formula.functionList.COT.functionParameter.number.name",detail:"formula.functionList.COT.functionParameter.number.detail",example:"30",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.COTH,functionType:t.FunctionType.Math,description:"formula.functionList.COTH.description",abstract:"formula.functionList.COTH.abstract",functionParameter:[{name:"formula.functionList.COTH.functionParameter.number.name",detail:"formula.functionList.COTH.functionParameter.number.detail",example:"2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.CSC,functionType:t.FunctionType.Math,description:"formula.functionList.CSC.description",abstract:"formula.functionList.CSC.abstract",functionParameter:[{name:"formula.functionList.CSC.functionParameter.number.name",detail:"formula.functionList.CSC.functionParameter.number.detail",example:"15",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.CSCH,functionType:t.FunctionType.Math,description:"formula.functionList.CSCH.description",abstract:"formula.functionList.CSCH.abstract",functionParameter:[{name:"formula.functionList.CSCH.functionParameter.number.name",detail:"formula.functionList.CSCH.functionParameter.number.detail",example:"1.5",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.DECIMAL,functionType:t.FunctionType.Math,description:"formula.functionList.DECIMAL.description",abstract:"formula.functionList.DECIMAL.abstract",functionParameter:[{name:"formula.functionList.DECIMAL.functionParameter.text.name",detail:"formula.functionList.DECIMAL.functionParameter.text.detail",example:'"FF"',require:1,repeat:0},{name:"formula.functionList.DECIMAL.functionParameter.radix.name",detail:"formula.functionList.DECIMAL.functionParameter.radix.detail",example:"16",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.DEGREES,functionType:t.FunctionType.Math,description:"formula.functionList.DEGREES.description",abstract:"formula.functionList.DEGREES.abstract",functionParameter:[{name:"formula.functionList.DEGREES.functionParameter.angle.name",detail:"formula.functionList.DEGREES.functionParameter.angle.detail",example:"PI()",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.EVEN,functionType:t.FunctionType.Math,description:"formula.functionList.EVEN.description",abstract:"formula.functionList.EVEN.abstract",functionParameter:[{name:"formula.functionList.EVEN.functionParameter.number.name",detail:"formula.functionList.EVEN.functionParameter.number.detail",example:"1.5",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.EXP,functionType:t.FunctionType.Math,description:"formula.functionList.EXP.description",abstract:"formula.functionList.EXP.abstract",functionParameter:[{name:"formula.functionList.EXP.functionParameter.number.name",detail:"formula.functionList.EXP.functionParameter.number.detail",example:"2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.FACT,functionType:t.FunctionType.Math,description:"formula.functionList.FACT.description",abstract:"formula.functionList.FACT.abstract",functionParameter:[{name:"formula.functionList.FACT.functionParameter.number.name",detail:"formula.functionList.FACT.functionParameter.number.detail",example:"5",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.FACTDOUBLE,functionType:t.FunctionType.Math,description:"formula.functionList.FACTDOUBLE.description",abstract:"formula.functionList.FACTDOUBLE.abstract",functionParameter:[{name:"formula.functionList.FACTDOUBLE.functionParameter.number.name",detail:"formula.functionList.FACTDOUBLE.functionParameter.number.detail",example:"6",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.FLOOR,functionType:t.FunctionType.Math,description:"formula.functionList.FLOOR.description",abstract:"formula.functionList.FLOOR.abstract",functionParameter:[{name:"formula.functionList.FLOOR.functionParameter.number.name",detail:"formula.functionList.FLOOR.functionParameter.number.detail",example:"3.7",require:1,repeat:0},{name:"formula.functionList.FLOOR.functionParameter.significance.name",detail:"formula.functionList.FLOOR.functionParameter.significance.detail",example:"2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.FLOOR_MATH,functionType:t.FunctionType.Math,description:"formula.functionList.FLOOR_MATH.description",abstract:"formula.functionList.FLOOR_MATH.abstract",functionParameter:[{name:"formula.functionList.FLOOR_MATH.functionParameter.number.name",detail:"formula.functionList.FLOOR_MATH.functionParameter.number.detail",example:"-5.5",require:1,repeat:0},{name:"formula.functionList.FLOOR_MATH.functionParameter.significance.name",detail:"formula.functionList.FLOOR_MATH.functionParameter.significance.detail",example:"2",require:0,repeat:0},{name:"formula.functionList.FLOOR_MATH.functionParameter.mode.name",detail:"formula.functionList.FLOOR_MATH.functionParameter.mode.detail",example:"-1",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.FLOOR_PRECISE,functionType:t.FunctionType.Math,description:"formula.functionList.FLOOR_PRECISE.description",abstract:"formula.functionList.FLOOR_PRECISE.abstract",functionParameter:[{name:"formula.functionList.FLOOR_PRECISE.functionParameter.number.name",detail:"formula.functionList.FLOOR_PRECISE.functionParameter.number.detail",example:"-3.2",require:1,repeat:0},{name:"formula.functionList.FLOOR_PRECISE.functionParameter.significance.name",detail:"formula.functionList.FLOOR_PRECISE.functionParameter.significance.detail",example:"-1",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.GCD,functionType:t.FunctionType.Math,description:"formula.functionList.GCD.description",abstract:"formula.functionList.GCD.abstract",functionParameter:[{name:"formula.functionList.GCD.functionParameter.number1.name",detail:"formula.functionList.GCD.functionParameter.number1.detail",example:"5",require:1,repeat:0},{name:"formula.functionList.GCD.functionParameter.number2.name",detail:"formula.functionList.GCD.functionParameter.number2.detail",example:"2",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_MATH.INT,functionType:t.FunctionType.Math,description:"formula.functionList.INT.description",abstract:"formula.functionList.INT.abstract",functionParameter:[{name:"formula.functionList.INT.functionParameter.number.name",detail:"formula.functionList.INT.functionParameter.number.detail",example:"8.9",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.ISO_CEILING,functionType:t.FunctionType.Math,description:"formula.functionList.ISO_CEILING.description",abstract:"formula.functionList.ISO_CEILING.abstract",functionParameter:[{name:"formula.functionList.ISO_CEILING.functionParameter.number1.name",detail:"formula.functionList.ISO_CEILING.functionParameter.number1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.ISO_CEILING.functionParameter.number2.name",detail:"formula.functionList.ISO_CEILING.functionParameter.number2.detail",example:"A1:A20",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.LCM,functionType:t.FunctionType.Math,description:"formula.functionList.LCM.description",abstract:"formula.functionList.LCM.abstract",functionParameter:[{name:"formula.functionList.LCM.functionParameter.number1.name",detail:"formula.functionList.LCM.functionParameter.number1.detail",example:"5",require:1,repeat:0},{name:"formula.functionList.LCM.functionParameter.number2.name",detail:"formula.functionList.LCM.functionParameter.number2.detail",example:"2",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_MATH.LET,functionType:t.FunctionType.Math,description:"formula.functionList.LET.description",abstract:"formula.functionList.LET.abstract",functionParameter:[{name:"formula.functionList.LET.functionParameter.number1.name",detail:"formula.functionList.LET.functionParameter.number1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.LET.functionParameter.number2.name",detail:"formula.functionList.LET.functionParameter.number2.detail",example:"A1:A20",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.LN,functionType:t.FunctionType.Math,description:"formula.functionList.LN.description",abstract:"formula.functionList.LN.abstract",functionParameter:[{name:"formula.functionList.LN.functionParameter.number.name",detail:"formula.functionList.LN.functionParameter.number.detail",example:"EXP(3)",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.LOG,functionType:t.FunctionType.Math,description:"formula.functionList.LOG.description",abstract:"formula.functionList.LOG.abstract",functionParameter:[{name:"formula.functionList.LOG.functionParameter.number.name",detail:"formula.functionList.LOG.functionParameter.number.detail",example:"8",require:1,repeat:0},{name:"formula.functionList.LOG.functionParameter.base.name",detail:"formula.functionList.LOG.functionParameter.base.detail",example:"2",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.LOG10,functionType:t.FunctionType.Math,description:"formula.functionList.LOG10.description",abstract:"formula.functionList.LOG10.abstract",functionParameter:[{name:"formula.functionList.LOG10.functionParameter.number.name",detail:"formula.functionList.LOG10.functionParameter.number.detail",example:"100000",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.MDETERM,functionType:t.FunctionType.Math,description:"formula.functionList.MDETERM.description",abstract:"formula.functionList.MDETERM.abstract",functionParameter:[{name:"formula.functionList.MDETERM.functionParameter.array.name",detail:"formula.functionList.MDETERM.functionParameter.array.detail",example:"A1:C3",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.MINVERSE,functionType:t.FunctionType.Math,description:"formula.functionList.MINVERSE.description",abstract:"formula.functionList.MINVERSE.abstract",functionParameter:[{name:"formula.functionList.MINVERSE.functionParameter.array.name",detail:"formula.functionList.MINVERSE.functionParameter.array.detail",example:"A1:C3",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.MMULT,functionType:t.FunctionType.Math,description:"formula.functionList.MMULT.description",abstract:"formula.functionList.MMULT.abstract",functionParameter:[{name:"formula.functionList.MMULT.functionParameter.array1.name",detail:"formula.functionList.MMULT.functionParameter.array1.detail",example:"A2:B3",require:1,repeat:0},{name:"formula.functionList.MMULT.functionParameter.array2.name",detail:"formula.functionList.MMULT.functionParameter.array2.detail",example:"A5:B6",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.MOD,functionType:t.FunctionType.Math,description:"formula.functionList.MOD.description",abstract:"formula.functionList.MOD.abstract",functionParameter:[{name:"formula.functionList.MOD.functionParameter.number.name",detail:"formula.functionList.MOD.functionParameter.number.detail",example:"3",require:1,repeat:0},{name:"formula.functionList.MOD.functionParameter.divisor.name",detail:"formula.functionList.MOD.functionParameter.divisor.detail",example:"2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.MROUND,functionType:t.FunctionType.Math,description:"formula.functionList.MROUND.description",abstract:"formula.functionList.MROUND.abstract",functionParameter:[{name:"formula.functionList.MROUND.functionParameter.number.name",detail:"formula.functionList.MROUND.functionParameter.number.detail",example:"10",require:1,repeat:0},{name:"formula.functionList.MROUND.functionParameter.multiple.name",detail:"formula.functionList.MROUND.functionParameter.multiple.detail",example:"3",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.MULTINOMIAL,functionType:t.FunctionType.Math,description:"formula.functionList.MULTINOMIAL.description",abstract:"formula.functionList.MULTINOMIAL.abstract",functionParameter:[{name:"formula.functionList.MULTINOMIAL.functionParameter.number1.name",detail:"formula.functionList.MULTINOMIAL.functionParameter.number1.detail",example:"5",require:1,repeat:0},{name:"formula.functionList.MULTINOMIAL.functionParameter.number2.name",detail:"formula.functionList.MULTINOMIAL.functionParameter.number2.detail",example:"2",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_MATH.MUNIT,functionType:t.FunctionType.Math,description:"formula.functionList.MUNIT.description",abstract:"formula.functionList.MUNIT.abstract",functionParameter:[{name:"formula.functionList.MUNIT.functionParameter.dimension.name",detail:"formula.functionList.MUNIT.functionParameter.dimension.detail",example:"3",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.ODD,functionType:t.FunctionType.Math,description:"formula.functionList.ODD.description",abstract:"formula.functionList.ODD.abstract",functionParameter:[{name:"formula.functionList.ODD.functionParameter.number.name",detail:"formula.functionList.ODD.functionParameter.number.detail",example:"1.5",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.PI,functionType:t.FunctionType.Math,description:"formula.functionList.PI.description",abstract:"formula.functionList.PI.abstract",functionParameter:[]},{functionName:t.FUNCTION_NAMES_MATH.POWER,functionType:t.FunctionType.Math,description:"formula.functionList.POWER.description",abstract:"formula.functionList.POWER.abstract",functionParameter:[{name:"formula.functionList.POWER.functionParameter.number.name",detail:"formula.functionList.POWER.functionParameter.number.detail",example:"5",require:1,repeat:0},{name:"formula.functionList.POWER.functionParameter.power.name",detail:"formula.functionList.POWER.functionParameter.power.detail",example:"2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.PRODUCT,functionType:t.FunctionType.Math,description:"formula.functionList.PRODUCT.description",abstract:"formula.functionList.PRODUCT.abstract",functionParameter:[{name:"formula.functionList.PRODUCT.functionParameter.number1.name",detail:"formula.functionList.PRODUCT.functionParameter.number1.detail",example:"A1",require:1,repeat:0},{name:"formula.functionList.PRODUCT.functionParameter.number2.name",detail:"formula.functionList.PRODUCT.functionParameter.number2.detail",example:"A2",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_MATH.QUOTIENT,functionType:t.FunctionType.Math,description:"formula.functionList.QUOTIENT.description",abstract:"formula.functionList.QUOTIENT.abstract",functionParameter:[{name:"formula.functionList.QUOTIENT.functionParameter.numerator.name",detail:"formula.functionList.QUOTIENT.functionParameter.numerator.detail",example:"5",require:1,repeat:0},{name:"formula.functionList.QUOTIENT.functionParameter.denominator.name",detail:"formula.functionList.QUOTIENT.functionParameter.denominator.detail",example:"2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.RADIANS,functionType:t.FunctionType.Math,description:"formula.functionList.RADIANS.description",abstract:"formula.functionList.RADIANS.abstract",functionParameter:[{name:"formula.functionList.RADIANS.functionParameter.angle.name",detail:"formula.functionList.RADIANS.functionParameter.angle.detail",example:"270",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.RAND,functionType:t.FunctionType.Math,description:"formula.functionList.RAND.description",abstract:"formula.functionList.RAND.abstract",functionParameter:[]},{functionName:t.FUNCTION_NAMES_MATH.RANDARRAY,functionType:t.FunctionType.Math,description:"formula.functionList.RANDARRAY.description",abstract:"formula.functionList.RANDARRAY.abstract",functionParameter:[{name:"formula.functionList.RANDARRAY.functionParameter.rows.name",detail:"formula.functionList.RANDARRAY.functionParameter.rows.detail",example:"5",require:0,repeat:0},{name:"formula.functionList.RANDARRAY.functionParameter.columns.name",detail:"formula.functionList.RANDARRAY.functionParameter.columns.detail",example:"3",require:0,repeat:0},{name:"formula.functionList.RANDARRAY.functionParameter.min.name",detail:"formula.functionList.RANDARRAY.functionParameter.min.detail",example:"1",require:0,repeat:0},{name:"formula.functionList.RANDARRAY.functionParameter.max.name",detail:"formula.functionList.RANDARRAY.functionParameter.max.detail",example:"100",require:0,repeat:0},{name:"formula.functionList.RANDARRAY.functionParameter.wholeNumber.name",detail:"formula.functionList.RANDARRAY.functionParameter.wholeNumber.detail",example:"TRUE",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.RANDBETWEEN,functionType:t.FunctionType.Math,description:"formula.functionList.RANDBETWEEN.description",abstract:"formula.functionList.RANDBETWEEN.abstract",functionParameter:[{name:"formula.functionList.RANDBETWEEN.functionParameter.bottom.name",detail:"formula.functionList.RANDBETWEEN.functionParameter.bottom.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.RANDBETWEEN.functionParameter.top.name",detail:"formula.functionList.RANDBETWEEN.functionParameter.top.detail",example:"100",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.ROMAN,functionType:t.FunctionType.Math,description:"formula.functionList.ROMAN.description",abstract:"formula.functionList.ROMAN.abstract",functionParameter:[{name:"formula.functionList.ROMAN.functionParameter.number.name",detail:"formula.functionList.ROMAN.functionParameter.number.detail",example:"499",require:1,repeat:0},{name:"formula.functionList.ROMAN.functionParameter.form.name",detail:"formula.functionList.ROMAN.functionParameter.form.detail",example:"0",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.ROUND,functionType:t.FunctionType.Math,description:"formula.functionList.ROUND.description",abstract:"formula.functionList.ROUND.abstract",functionParameter:[{name:"formula.functionList.ROUND.functionParameter.number.name",detail:"formula.functionList.ROUND.functionParameter.number.detail",example:"2.15",require:1,repeat:0},{name:"formula.functionList.ROUND.functionParameter.numDigits.name",detail:"formula.functionList.ROUND.functionParameter.numDigits.detail",example:"1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.ROUNDBANK,functionType:t.FunctionType.Math,description:"formula.functionList.ROUNDBANK.description",abstract:"formula.functionList.ROUNDBANK.abstract",functionParameter:[{name:"formula.functionList.ROUNDBANK.functionParameter.number.name",detail:"formula.functionList.ROUNDBANK.functionParameter.number.detail",example:"2.345",require:1,repeat:0},{name:"formula.functionList.ROUNDBANK.functionParameter.numDigits.name",detail:"formula.functionList.ROUNDBANK.functionParameter.numDigits.detail",example:"2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.ROUNDDOWN,functionType:t.FunctionType.Math,description:"formula.functionList.ROUNDDOWN.description",abstract:"formula.functionList.ROUNDDOWN.abstract",functionParameter:[{name:"formula.functionList.ROUNDDOWN.functionParameter.number.name",detail:"formula.functionList.ROUNDDOWN.functionParameter.number.detail",example:"3.2",require:1,repeat:0},{name:"formula.functionList.ROUNDDOWN.functionParameter.numDigits.name",detail:"formula.functionList.ROUNDDOWN.functionParameter.numDigits.detail",example:"0",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.ROUNDUP,functionType:t.FunctionType.Math,description:"formula.functionList.ROUNDUP.description",abstract:"formula.functionList.ROUNDUP.abstract",functionParameter:[{name:"formula.functionList.ROUNDUP.functionParameter.number.name",detail:"formula.functionList.ROUNDUP.functionParameter.number.detail",example:"3.2",require:1,repeat:0},{name:"formula.functionList.ROUNDUP.functionParameter.numDigits.name",detail:"formula.functionList.ROUNDUP.functionParameter.numDigits.detail",example:"0",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.SEC,functionType:t.FunctionType.Math,description:"formula.functionList.SEC.description",abstract:"formula.functionList.SEC.abstract",functionParameter:[{name:"formula.functionList.SEC.functionParameter.number.name",detail:"formula.functionList.SEC.functionParameter.number.detail",example:"30",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.SECH,functionType:t.FunctionType.Math,description:"formula.functionList.SECH.description",abstract:"formula.functionList.SECH.abstract",functionParameter:[{name:"formula.functionList.SECH.functionParameter.number.name",detail:"formula.functionList.SECH.functionParameter.number.detail",example:"30",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.SERIESSUM,functionType:t.FunctionType.Math,description:"formula.functionList.SERIESSUM.description",abstract:"formula.functionList.SERIESSUM.abstract",functionParameter:[{name:"formula.functionList.SERIESSUM.functionParameter.x.name",detail:"formula.functionList.SERIESSUM.functionParameter.x.detail",example:"0.785398163",require:1,repeat:0},{name:"formula.functionList.SERIESSUM.functionParameter.n.name",detail:"formula.functionList.SERIESSUM.functionParameter.n.detail",example:"0",require:1,repeat:0},{name:"formula.functionList.SERIESSUM.functionParameter.m.name",detail:"formula.functionList.SERIESSUM.functionParameter.m.detail",example:"2",require:1,repeat:0},{name:"formula.functionList.SERIESSUM.functionParameter.coefficients.name",detail:"formula.functionList.SERIESSUM.functionParameter.coefficients.detail",example:"A1:A4",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.SEQUENCE,functionType:t.FunctionType.Math,description:"formula.functionList.SEQUENCE.description",abstract:"formula.functionList.SEQUENCE.abstract",functionParameter:[{name:"formula.functionList.SEQUENCE.functionParameter.rows.name",detail:"formula.functionList.SEQUENCE.functionParameter.rows.detail",example:"4",require:1,repeat:0},{name:"formula.functionList.SEQUENCE.functionParameter.columns.name",detail:"formula.functionList.SEQUENCE.functionParameter.columns.detail",example:"5",require:0,repeat:0},{name:"formula.functionList.SEQUENCE.functionParameter.start.name",detail:"formula.functionList.SEQUENCE.functionParameter.start.detail",example:"1",require:0,repeat:0},{name:"formula.functionList.SEQUENCE.functionParameter.step.name",detail:"formula.functionList.SEQUENCE.functionParameter.step.detail",example:"1",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.SIGN,functionType:t.FunctionType.Math,description:"formula.functionList.SIGN.description",abstract:"formula.functionList.SIGN.abstract",functionParameter:[{name:"formula.functionList.SIGN.functionParameter.number.name",detail:"formula.functionList.SIGN.functionParameter.number.detail",example:"10",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.SIN,functionType:t.FunctionType.Math,description:"formula.functionList.SIN.description",abstract:"formula.functionList.SIN.abstract",functionParameter:[{name:"formula.functionList.SIN.functionParameter.number.name",detail:"formula.functionList.SIN.functionParameter.number.detail",example:"30*PI()/180",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.SINH,functionType:t.FunctionType.Math,description:"formula.functionList.SINH.description",abstract:"formula.functionList.SINH.abstract",functionParameter:[{name:"formula.functionList.SINH.functionParameter.number.name",detail:"formula.functionList.SINH.functionParameter.number.detail",example:"0.0342*1.03",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.SQRT,functionType:t.FunctionType.Math,description:"formula.functionList.SQRT.description",abstract:"formula.functionList.SQRT.abstract",functionParameter:[{name:"formula.functionList.SQRT.functionParameter.number.name",detail:"formula.functionList.SQRT.functionParameter.number.detail",example:"16",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.SQRTPI,functionType:t.FunctionType.Math,description:"formula.functionList.SQRTPI.description",abstract:"formula.functionList.SQRTPI.abstract",functionParameter:[{name:"formula.functionList.SQRTPI.functionParameter.number.name",detail:"formula.functionList.SQRTPI.functionParameter.number.detail",example:"1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.SUBTOTAL,functionType:t.FunctionType.Math,description:"formula.functionList.SUBTOTAL.description",abstract:"formula.functionList.SUBTOTAL.abstract",functionParameter:[{name:"formula.functionList.SUBTOTAL.functionParameter.functionNum.name",detail:"formula.functionList.SUBTOTAL.functionParameter.functionNum.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.SUBTOTAL.functionParameter.ref1.name",detail:"formula.functionList.SUBTOTAL.functionParameter.ref1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.SUBTOTAL.functionParameter.ref2.name",detail:"formula.functionList.SUBTOTAL.functionParameter.ref2.detail",example:"B1:B20",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_MATH.SUM,aliasFunctionName:"formula.functionList.SUM.aliasFunctionName",functionType:t.FunctionType.Math,description:"formula.functionList.SUM.description",abstract:"formula.functionList.SUM.abstract",functionParameter:[{name:"formula.functionList.SUM.functionParameter.number1.name",detail:"formula.functionList.SUM.functionParameter.number1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.SUM.functionParameter.number2.name",detail:"formula.functionList.SUM.functionParameter.number2.detail",example:"B2:B10",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_MATH.SUMIF,aliasFunctionName:"formula.functionList.SUMIF.aliasFunctionName",functionType:t.FunctionType.Math,description:"formula.functionList.SUMIF.description",abstract:"formula.functionList.SUMIF.abstract",functionParameter:[{name:"formula.functionList.SUMIF.functionParameter.range.name",detail:"formula.functionList.SUMIF.functionParameter.range.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.SUMIF.functionParameter.criteria.name",detail:"formula.functionList.SUMIF.functionParameter.criteria.detail",example:'">5"',require:1,repeat:0},{name:"formula.functionList.SUMIF.functionParameter.sumRange.name",detail:"formula.functionList.SUMIF.functionParameter.sumRange.detail",example:"B1:B20",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.SUMIFS,functionType:t.FunctionType.Math,description:"formula.functionList.SUMIFS.description",abstract:"formula.functionList.SUMIFS.abstract",functionParameter:[{name:"formula.functionList.SUMIFS.functionParameter.sumRange.name",detail:"formula.functionList.SUMIFS.functionParameter.sumRange.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.SUMIFS.functionParameter.criteriaRange1.name",detail:"formula.functionList.SUMIFS.functionParameter.criteriaRange1.detail",example:"B1:B20",require:1,repeat:0},{name:"formula.functionList.SUMIFS.functionParameter.criteria1.name",detail:"formula.functionList.SUMIFS.functionParameter.criteria1.detail",example:'">10"',require:1,repeat:0},{name:"formula.functionList.SUMIFS.functionParameter.criteriaRange2.name",detail:"formula.functionList.SUMIFS.functionParameter.criteriaRange2.detail",example:"C1:C20",require:0,repeat:1},{name:"formula.functionList.SUMIFS.functionParameter.criteria2.name",detail:"formula.functionList.SUMIFS.functionParameter.criteria2.detail",example:'"<20"',require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_MATH.SUMPRODUCT,functionType:t.FunctionType.Math,description:"formula.functionList.SUMPRODUCT.description",abstract:"formula.functionList.SUMPRODUCT.abstract",functionParameter:[{name:"formula.functionList.SUMPRODUCT.functionParameter.array1.name",detail:"formula.functionList.SUMPRODUCT.functionParameter.array1.detail",example:"C2:C5",require:1,repeat:0},{name:"formula.functionList.SUMPRODUCT.functionParameter.array2.name",detail:"formula.functionList.SUMPRODUCT.functionParameter.array2.detail",example:"D2:D5",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_MATH.SUMSQ,functionType:t.FunctionType.Math,description:"formula.functionList.SUMSQ.description",abstract:"formula.functionList.SUMSQ.abstract",functionParameter:[{name:"formula.functionList.SUMSQ.functionParameter.number1.name",detail:"formula.functionList.SUMSQ.functionParameter.number1.detail",example:"3",require:1,repeat:0},{name:"formula.functionList.SUMSQ.functionParameter.number2.name",detail:"formula.functionList.SUMSQ.functionParameter.number2.detail",example:"4",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_MATH.SUMX2MY2,functionType:t.FunctionType.Math,description:"formula.functionList.SUMX2MY2.description",abstract:"formula.functionList.SUMX2MY2.abstract",functionParameter:[{name:"formula.functionList.SUMX2MY2.functionParameter.arrayX.name",detail:"formula.functionList.SUMX2MY2.functionParameter.arrayX.detail",example:"A2:A8",require:1,repeat:0},{name:"formula.functionList.SUMX2MY2.functionParameter.arrayY.name",detail:"formula.functionList.SUMX2MY2.functionParameter.arrayY.detail",example:"B2:B8",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.SUMX2PY2,functionType:t.FunctionType.Math,description:"formula.functionList.SUMX2PY2.description",abstract:"formula.functionList.SUMX2PY2.abstract",functionParameter:[{name:"formula.functionList.SUMX2PY2.functionParameter.arrayX.name",detail:"formula.functionList.SUMX2PY2.functionParameter.arrayX.detail",example:"A2:A8",require:1,repeat:0},{name:"formula.functionList.SUMX2PY2.functionParameter.arrayY.name",detail:"formula.functionList.SUMX2PY2.functionParameter.arrayY.detail",example:"B2:B8",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.SUMXMY2,functionType:t.FunctionType.Math,description:"formula.functionList.SUMXMY2.description",abstract:"formula.functionList.SUMXMY2.abstract",functionParameter:[{name:"formula.functionList.SUMXMY2.functionParameter.arrayX.name",detail:"formula.functionList.SUMXMY2.functionParameter.arrayX.detail",example:"A2:A8",require:1,repeat:0},{name:"formula.functionList.SUMXMY2.functionParameter.arrayY.name",detail:"formula.functionList.SUMXMY2.functionParameter.arrayY.detail",example:"B2:B8",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.TAN,functionType:t.FunctionType.Math,description:"formula.functionList.TAN.description",abstract:"formula.functionList.TAN.abstract",functionParameter:[{name:"formula.functionList.TAN.functionParameter.number.name",detail:"formula.functionList.TAN.functionParameter.number.detail",example:"1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.TANH,functionType:t.FunctionType.Math,description:"formula.functionList.TANH.description",abstract:"formula.functionList.TANH.abstract",functionParameter:[{name:"formula.functionList.TANH.functionParameter.number.name",detail:"formula.functionList.TANH.functionParameter.number.detail",example:"1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_MATH.TRUNC,functionType:t.FunctionType.Math,description:"formula.functionList.TRUNC.description",abstract:"formula.functionList.TRUNC.abstract",functionParameter:[{name:"formula.functionList.TRUNC.functionParameter.number.name",detail:"formula.functionList.TRUNC.functionParameter.number.detail",example:"0.45",require:1,repeat:0},{name:"formula.functionList.TRUNC.functionParameter.numDigits.name",detail:"formula.functionList.TRUNC.functionParameter.numDigits.detail",example:"1",require:0,repeat:0}]}],Je=[{functionName:t.FUNCTION_NAMES_STATISTICAL.AVEDEV,functionType:t.FunctionType.Statistical,description:"formula.functionList.AVEDEV.description",abstract:"formula.functionList.AVEDEV.abstract",functionParameter:[{name:"formula.functionList.AVEDEV.functionParameter.number1.name",detail:"formula.functionList.AVEDEV.functionParameter.number1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.AVEDEV.functionParameter.number2.name",detail:"formula.functionList.AVEDEV.functionParameter.number2.detail",example:"B1:B20",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.AVERAGE,aliasFunctionName:"formula.functionList.AVERAGE.aliasFunctionName",functionType:t.FunctionType.Statistical,description:"formula.functionList.AVERAGE.description",abstract:"formula.functionList.AVERAGE.abstract",functionParameter:[{name:"formula.functionList.AVERAGE.functionParameter.number1.name",detail:"formula.functionList.AVERAGE.functionParameter.number1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.AVERAGE.functionParameter.number2.name",detail:"formula.functionList.AVERAGE.functionParameter.number2.detail",example:"B1:B20",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.AVERAGE_WEIGHTED,aliasFunctionName:"formula.functionList.AVERAGE_WEIGHTED.aliasFunctionName",functionType:t.FunctionType.Statistical,description:"formula.functionList.AVERAGE_WEIGHTED.description",abstract:"formula.functionList.AVERAGE_WEIGHTED.abstract",functionParameter:[{name:"formula.functionList.AVERAGE_WEIGHTED.functionParameter.values.name",detail:"formula.functionList.AVERAGE_WEIGHTED.functionParameter.values.detail",example:"10",require:1,repeat:0},{name:"formula.functionList.AVERAGE_WEIGHTED.functionParameter.weights.name",detail:"formula.functionList.AVERAGE_WEIGHTED.functionParameter.weights.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.AVERAGE_WEIGHTED.functionParameter.additionalValues.name",detail:"formula.functionList.AVERAGE_WEIGHTED.functionParameter.additionalValues.detail",example:"20",require:0,repeat:1},{name:"formula.functionList.AVERAGE_WEIGHTED.functionParameter.additionalWeights.name",detail:"formula.functionList.AVERAGE_WEIGHTED.functionParameter.additionalWeights.detail",example:"3",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.AVERAGEA,functionType:t.FunctionType.Statistical,description:"formula.functionList.AVERAGEA.description",abstract:"formula.functionList.AVERAGEA.abstract",functionParameter:[{name:"formula.functionList.AVERAGEA.functionParameter.value1.name",detail:"formula.functionList.AVERAGEA.functionParameter.value1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.AVERAGEA.functionParameter.value2.name",detail:"formula.functionList.AVERAGEA.functionParameter.value2.detail",example:"B1:B20",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.AVERAGEIF,functionType:t.FunctionType.Statistical,description:"formula.functionList.AVERAGEIF.description",abstract:"formula.functionList.AVERAGEIF.abstract",functionParameter:[{name:"formula.functionList.AVERAGEIF.functionParameter.range.name",detail:"formula.functionList.AVERAGEIF.functionParameter.range.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.AVERAGEIF.functionParameter.criteria.name",detail:"formula.functionList.AVERAGEIF.functionParameter.criteria.detail",example:'">5"',require:1,repeat:0},{name:"formula.functionList.AVERAGEIF.functionParameter.averageRange.name",detail:"formula.functionList.AVERAGEIF.functionParameter.averageRange.detail",example:"B1:B20",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.AVERAGEIFS,functionType:t.FunctionType.Statistical,description:"formula.functionList.AVERAGEIFS.description",abstract:"formula.functionList.AVERAGEIFS.abstract",functionParameter:[{name:"formula.functionList.AVERAGEIFS.functionParameter.averageRange.name",detail:"formula.functionList.AVERAGEIFS.functionParameter.averageRange.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.AVERAGEIFS.functionParameter.criteriaRange1.name",detail:"formula.functionList.AVERAGEIFS.functionParameter.criteriaRange1.detail",example:"B1:B20",require:1,repeat:0},{name:"formula.functionList.AVERAGEIFS.functionParameter.criteria1.name",detail:"formula.functionList.AVERAGEIFS.functionParameter.criteria1.detail",example:'">10"',require:1,repeat:0},{name:"formula.functionList.AVERAGEIFS.functionParameter.criteriaRange2.name",detail:"formula.functionList.AVERAGEIFS.functionParameter.criteriaRange2.detail",example:"C1:C20",require:0,repeat:1},{name:"formula.functionList.AVERAGEIFS.functionParameter.criteria2.name",detail:"formula.functionList.AVERAGEIFS.functionParameter.criteria2.detail",example:'"<20"',require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.BETA_DIST,functionType:t.FunctionType.Statistical,description:"formula.functionList.BETA_DIST.description",abstract:"formula.functionList.BETA_DIST.abstract",functionParameter:[{name:"formula.functionList.BETA_DIST.functionParameter.x.name",detail:"formula.functionList.BETA_DIST.functionParameter.x.detail",example:"2",require:1,repeat:0},{name:"formula.functionList.BETA_DIST.functionParameter.alpha.name",detail:"formula.functionList.BETA_DIST.functionParameter.alpha.detail",example:"8",require:1,repeat:0},{name:"formula.functionList.BETA_DIST.functionParameter.beta.name",detail:"formula.functionList.BETA_DIST.functionParameter.beta.detail",example:"10",require:1,repeat:0},{name:"formula.functionList.BETA_DIST.functionParameter.cumulative.name",detail:"formula.functionList.BETA_DIST.functionParameter.cumulative.detail",example:"true",require:1,repeat:0},{name:"formula.functionList.BETA_DIST.functionParameter.A.name",detail:"formula.functionList.BETA_DIST.functionParameter.A.detail",example:"1",require:0,repeat:0},{name:"formula.functionList.BETA_DIST.functionParameter.B.name",detail:"formula.functionList.BETA_DIST.functionParameter.B.detail",example:"3",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.BETA_INV,functionType:t.FunctionType.Statistical,description:"formula.functionList.BETA_INV.description",abstract:"formula.functionList.BETA_INV.abstract",functionParameter:[{name:"formula.functionList.BETA_INV.functionParameter.probability.name",detail:"formula.functionList.BETA_INV.functionParameter.probability.detail",example:"0.685470581",require:1,repeat:0},{name:"formula.functionList.BETA_INV.functionParameter.alpha.name",detail:"formula.functionList.BETA_INV.functionParameter.alpha.detail",example:"8",require:1,repeat:0},{name:"formula.functionList.BETA_INV.functionParameter.beta.name",detail:"formula.functionList.BETA_INV.functionParameter.beta.detail",example:"10",require:1,repeat:0},{name:"formula.functionList.BETA_INV.functionParameter.A.name",detail:"formula.functionList.BETA_INV.functionParameter.A.detail",example:"1",require:0,repeat:0},{name:"formula.functionList.BETA_INV.functionParameter.B.name",detail:"formula.functionList.BETA_INV.functionParameter.B.detail",example:"3",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.BINOM_DIST,functionType:t.FunctionType.Statistical,description:"formula.functionList.BINOM_DIST.description",abstract:"formula.functionList.BINOM_DIST.abstract",functionParameter:[{name:"formula.functionList.BINOM_DIST.functionParameter.numberS.name",detail:"formula.functionList.BINOM_DIST.functionParameter.numberS.detail",example:"6",require:1,repeat:0},{name:"formula.functionList.BINOM_DIST.functionParameter.trials.name",detail:"formula.functionList.BINOM_DIST.functionParameter.trials.detail",example:"10",require:1,repeat:0},{name:"formula.functionList.BINOM_DIST.functionParameter.probabilityS.name",detail:"formula.functionList.BINOM_DIST.functionParameter.probabilityS.detail",example:"0.5",require:1,repeat:0},{name:"formula.functionList.BINOM_DIST.functionParameter.cumulative.name",detail:"formula.functionList.BINOM_DIST.functionParameter.cumulative.detail",example:"false",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.BINOM_DIST_RANGE,functionType:t.FunctionType.Statistical,description:"formula.functionList.BINOM_DIST_RANGE.description",abstract:"formula.functionList.BINOM_DIST_RANGE.abstract",functionParameter:[{name:"formula.functionList.BINOM_DIST_RANGE.functionParameter.trials.name",detail:"formula.functionList.BINOM_DIST_RANGE.functionParameter.trials.detail",example:"60",require:1,repeat:0},{name:"formula.functionList.BINOM_DIST_RANGE.functionParameter.probabilityS.name",detail:"formula.functionList.BINOM_DIST_RANGE.functionParameter.probabilityS.detail",example:"0.75",require:1,repeat:0},{name:"formula.functionList.BINOM_DIST_RANGE.functionParameter.numberS.name",detail:"formula.functionList.BINOM_DIST_RANGE.functionParameter.numberS.detail",example:"45",require:1,repeat:0},{name:"formula.functionList.BINOM_DIST_RANGE.functionParameter.numberS2.name",detail:"formula.functionList.BINOM_DIST_RANGE.functionParameter.numberS2.detail",example:"50",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.BINOM_INV,functionType:t.FunctionType.Statistical,description:"formula.functionList.BINOM_INV.description",abstract:"formula.functionList.BINOM_INV.abstract",functionParameter:[{name:"formula.functionList.BINOM_INV.functionParameter.trials.name",detail:"formula.functionList.BINOM_INV.functionParameter.trials.detail",example:"6",require:1,repeat:0},{name:"formula.functionList.BINOM_INV.functionParameter.probabilityS.name",detail:"formula.functionList.BINOM_INV.functionParameter.probabilityS.detail",example:"0.5",require:1,repeat:0},{name:"formula.functionList.BINOM_INV.functionParameter.alpha.name",detail:"formula.functionList.BINOM_INV.functionParameter.alpha.detail",example:"0.75",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.CHISQ_DIST,functionType:t.FunctionType.Statistical,description:"formula.functionList.CHISQ_DIST.description",abstract:"formula.functionList.CHISQ_DIST.abstract",functionParameter:[{name:"formula.functionList.CHISQ_DIST.functionParameter.x.name",detail:"formula.functionList.CHISQ_DIST.functionParameter.x.detail",example:"0.5",require:1,repeat:0},{name:"formula.functionList.CHISQ_DIST.functionParameter.degFreedom.name",detail:"formula.functionList.CHISQ_DIST.functionParameter.degFreedom.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.CHISQ_DIST.functionParameter.cumulative.name",detail:"formula.functionList.CHISQ_DIST.functionParameter.cumulative.detail",example:"true",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.CHISQ_DIST_RT,functionType:t.FunctionType.Statistical,description:"formula.functionList.CHISQ_DIST_RT.description",abstract:"formula.functionList.CHISQ_DIST_RT.abstract",functionParameter:[{name:"formula.functionList.CHISQ_DIST_RT.functionParameter.x.name",detail:"formula.functionList.CHISQ_DIST_RT.functionParameter.x.detail",example:"0.5",require:1,repeat:0},{name:"formula.functionList.CHISQ_DIST_RT.functionParameter.degFreedom.name",detail:"formula.functionList.CHISQ_DIST_RT.functionParameter.degFreedom.detail",example:"1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.CHISQ_INV,functionType:t.FunctionType.Statistical,description:"formula.functionList.CHISQ_INV.description",abstract:"formula.functionList.CHISQ_INV.abstract",functionParameter:[{name:"formula.functionList.CHISQ_INV.functionParameter.probability.name",detail:"formula.functionList.CHISQ_INV.functionParameter.probability.detail",example:"0.93",require:1,repeat:0},{name:"formula.functionList.CHISQ_INV.functionParameter.degFreedom.name",detail:"formula.functionList.CHISQ_INV.functionParameter.degFreedom.detail",example:"1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.CHISQ_INV_RT,functionType:t.FunctionType.Statistical,description:"formula.functionList.CHISQ_INV_RT.description",abstract:"formula.functionList.CHISQ_INV_RT.abstract",functionParameter:[{name:"formula.functionList.CHISQ_INV_RT.functionParameter.probability.name",detail:"formula.functionList.CHISQ_INV_RT.functionParameter.probability.detail",example:"0.93",require:1,repeat:0},{name:"formula.functionList.CHISQ_INV_RT.functionParameter.degFreedom.name",detail:"formula.functionList.CHISQ_INV_RT.functionParameter.degFreedom.detail",example:"1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.CHISQ_TEST,functionType:t.FunctionType.Statistical,description:"formula.functionList.CHISQ_TEST.description",abstract:"formula.functionList.CHISQ_TEST.abstract",functionParameter:[{name:"formula.functionList.CHISQ_TEST.functionParameter.actualRange.name",detail:"formula.functionList.CHISQ_TEST.functionParameter.actualRange.detail",example:"A1:A4",require:1,repeat:0},{name:"formula.functionList.CHISQ_TEST.functionParameter.expectedRange.name",detail:"formula.functionList.CHISQ_TEST.functionParameter.expectedRange.detail",example:"B1:B4",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.CONFIDENCE_NORM,functionType:t.FunctionType.Statistical,description:"formula.functionList.CONFIDENCE_NORM.description",abstract:"formula.functionList.CONFIDENCE_NORM.abstract",functionParameter:[{name:"formula.functionList.CONFIDENCE_NORM.functionParameter.alpha.name",detail:"formula.functionList.CONFIDENCE_NORM.functionParameter.alpha.detail",example:"0.05",require:1,repeat:0},{name:"formula.functionList.CONFIDENCE_NORM.functionParameter.standardDev.name",detail:"formula.functionList.CONFIDENCE_NORM.functionParameter.standardDev.detail",example:"2.5",require:1,repeat:0},{name:"formula.functionList.CONFIDENCE_NORM.functionParameter.size.name",detail:"formula.functionList.CONFIDENCE_NORM.functionParameter.size.detail",example:"50",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.CONFIDENCE_T,functionType:t.FunctionType.Statistical,description:"formula.functionList.CONFIDENCE_T.description",abstract:"formula.functionList.CONFIDENCE_T.abstract",functionParameter:[{name:"formula.functionList.CONFIDENCE_T.functionParameter.alpha.name",detail:"formula.functionList.CONFIDENCE_T.functionParameter.alpha.detail",example:"0.05",require:1,repeat:0},{name:"formula.functionList.CONFIDENCE_T.functionParameter.standardDev.name",detail:"formula.functionList.CONFIDENCE_T.functionParameter.standardDev.detail",example:"2.5",require:1,repeat:0},{name:"formula.functionList.CONFIDENCE_T.functionParameter.size.name",detail:"formula.functionList.CONFIDENCE_T.functionParameter.size.detail",example:"50",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.CORREL,functionType:t.FunctionType.Statistical,description:"formula.functionList.CORREL.description",abstract:"formula.functionList.CORREL.abstract",functionParameter:[{name:"formula.functionList.CORREL.functionParameter.array1.name",detail:"formula.functionList.CORREL.functionParameter.array1.detail",example:"A1:A4",require:1,repeat:0},{name:"formula.functionList.CORREL.functionParameter.array2.name",detail:"formula.functionList.CORREL.functionParameter.array2.detail",example:"B1:B4",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.COUNT,aliasFunctionName:"formula.functionList.COUNT.aliasFunctionName",functionType:t.FunctionType.Statistical,description:"formula.functionList.COUNT.description",abstract:"formula.functionList.COUNT.abstract",functionParameter:[{name:"formula.functionList.COUNT.functionParameter.value1.name",detail:"formula.functionList.COUNT.functionParameter.value1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.COUNT.functionParameter.value2.name",detail:"formula.functionList.COUNT.functionParameter.value2.detail",example:"B2:B10",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.COUNTA,aliasFunctionName:"formula.functionList.COUNTA.aliasFunctionName",functionType:t.FunctionType.Statistical,description:"formula.functionList.COUNTA.description",abstract:"formula.functionList.COUNTA.abstract",functionParameter:[{name:"formula.functionList.COUNTA.functionParameter.number1.name",detail:"formula.functionList.COUNTA.functionParameter.number1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.COUNTA.functionParameter.number2.name",detail:"formula.functionList.COUNTA.functionParameter.number2.detail",example:"B2:B10",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.COUNTBLANK,functionType:t.FunctionType.Statistical,description:"formula.functionList.COUNTBLANK.description",abstract:"formula.functionList.COUNTBLANK.abstract",functionParameter:[{name:"formula.functionList.COUNTBLANK.functionParameter.range.name",detail:"formula.functionList.COUNTBLANK.functionParameter.range.detail",example:"A1:A20",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.COUNTIF,functionType:t.FunctionType.Statistical,description:"formula.functionList.COUNTIF.description",abstract:"formula.functionList.COUNTIF.abstract",functionParameter:[{name:"formula.functionList.COUNTIF.functionParameter.range.name",detail:"formula.functionList.COUNTIF.functionParameter.range.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.COUNTIF.functionParameter.criteria.name",detail:"formula.functionList.COUNTIF.functionParameter.criteria.detail",example:'">5"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.COUNTIFS,functionType:t.FunctionType.Statistical,description:"formula.functionList.COUNTIFS.description",abstract:"formula.functionList.COUNTIFS.abstract",functionParameter:[{name:"formula.functionList.COUNTIFS.functionParameter.criteriaRange1.name",detail:"formula.functionList.COUNTIFS.functionParameter.criteriaRange1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.COUNTIFS.functionParameter.criteria1.name",detail:"formula.functionList.COUNTIFS.functionParameter.criteria1.detail",example:'">10"',require:1,repeat:0},{name:"formula.functionList.COUNTIFS.functionParameter.criteriaRange2.name",detail:"formula.functionList.COUNTIFS.functionParameter.criteriaRange2.detail",example:"B1:B20",require:0,repeat:1},{name:"formula.functionList.COUNTIFS.functionParameter.criteria2.name",detail:"formula.functionList.COUNTIFS.functionParameter.criteria2.detail",example:'"<20"',require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.COVARIANCE_P,functionType:t.FunctionType.Statistical,description:"formula.functionList.COVARIANCE_P.description",abstract:"formula.functionList.COVARIANCE_P.abstract",functionParameter:[{name:"formula.functionList.COVARIANCE_P.functionParameter.array1.name",detail:"formula.functionList.COVARIANCE_P.functionParameter.array1.detail",example:"A1:A4",require:1,repeat:0},{name:"formula.functionList.COVARIANCE_P.functionParameter.array2.name",detail:"formula.functionList.COVARIANCE_P.functionParameter.array2.detail",example:"B1:B4",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.COVARIANCE_S,functionType:t.FunctionType.Statistical,description:"formula.functionList.COVARIANCE_S.description",abstract:"formula.functionList.COVARIANCE_S.abstract",functionParameter:[{name:"formula.functionList.COVARIANCE_S.functionParameter.array1.name",detail:"formula.functionList.COVARIANCE_S.functionParameter.array1.detail",example:"A1:A4",require:1,repeat:0},{name:"formula.functionList.COVARIANCE_S.functionParameter.array2.name",detail:"formula.functionList.COVARIANCE_S.functionParameter.array2.detail",example:"B1:B4",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.DEVSQ,functionType:t.FunctionType.Statistical,description:"formula.functionList.DEVSQ.description",abstract:"formula.functionList.DEVSQ.abstract",functionParameter:[{name:"formula.functionList.DEVSQ.functionParameter.number1.name",detail:"formula.functionList.DEVSQ.functionParameter.number1.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.DEVSQ.functionParameter.number2.name",detail:"formula.functionList.DEVSQ.functionParameter.number2.detail",example:"2",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.EXPON_DIST,functionType:t.FunctionType.Statistical,description:"formula.functionList.EXPON_DIST.description",abstract:"formula.functionList.EXPON_DIST.abstract",functionParameter:[{name:"formula.functionList.EXPON_DIST.functionParameter.x.name",detail:"formula.functionList.EXPON_DIST.functionParameter.x.detail",example:"0.2",require:1,repeat:0},{name:"formula.functionList.EXPON_DIST.functionParameter.lambda.name",detail:"formula.functionList.EXPON_DIST.functionParameter.lambda.detail",example:"10",require:1,repeat:0},{name:"formula.functionList.EXPON_DIST.functionParameter.cumulative.name",detail:"formula.functionList.EXPON_DIST.functionParameter.cumulative.detail",example:"true",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.F_DIST,functionType:t.FunctionType.Statistical,description:"formula.functionList.F_DIST.description",abstract:"formula.functionList.F_DIST.abstract",functionParameter:[{name:"formula.functionList.F_DIST.functionParameter.x.name",detail:"formula.functionList.F_DIST.functionParameter.x.detail",example:"15.2069",require:1,repeat:0},{name:"formula.functionList.F_DIST.functionParameter.degFreedom1.name",detail:"formula.functionList.F_DIST.functionParameter.degFreedom1.detail",example:"6",require:1,repeat:0},{name:"formula.functionList.F_DIST.functionParameter.degFreedom2.name",detail:"formula.functionList.F_DIST.functionParameter.degFreedom2.detail",example:"4",require:1,repeat:0},{name:"formula.functionList.F_DIST.functionParameter.cumulative.name",detail:"formula.functionList.F_DIST.functionParameter.cumulative.detail",example:"true",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.F_DIST_RT,functionType:t.FunctionType.Statistical,description:"formula.functionList.F_DIST_RT.description",abstract:"formula.functionList.F_DIST_RT.abstract",functionParameter:[{name:"formula.functionList.F_DIST_RT.functionParameter.x.name",detail:"formula.functionList.F_DIST_RT.functionParameter.x.detail",example:"15.2069",require:1,repeat:0},{name:"formula.functionList.F_DIST_RT.functionParameter.degFreedom1.name",detail:"formula.functionList.F_DIST_RT.functionParameter.degFreedom1.detail",example:"6",require:1,repeat:0},{name:"formula.functionList.F_DIST_RT.functionParameter.degFreedom2.name",detail:"formula.functionList.F_DIST_RT.functionParameter.degFreedom2.detail",example:"4",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.F_INV,functionType:t.FunctionType.Statistical,description:"formula.functionList.F_INV.description",abstract:"formula.functionList.F_INV.abstract",functionParameter:[{name:"formula.functionList.F_INV.functionParameter.probability.name",detail:"formula.functionList.F_INV.functionParameter.probability.detail",example:"0.01",require:1,repeat:0},{name:"formula.functionList.F_INV.functionParameter.degFreedom1.name",detail:"formula.functionList.F_INV.functionParameter.degFreedom1.detail",example:"6",require:1,repeat:0},{name:"formula.functionList.F_INV.functionParameter.degFreedom2.name",detail:"formula.functionList.F_INV.functionParameter.degFreedom2.detail",example:"4",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.F_INV_RT,functionType:t.FunctionType.Statistical,description:"formula.functionList.F_INV_RT.description",abstract:"formula.functionList.F_INV_RT.abstract",functionParameter:[{name:"formula.functionList.F_INV_RT.functionParameter.probability.name",detail:"formula.functionList.F_INV_RT.functionParameter.probability.detail",example:"0.01",require:1,repeat:0},{name:"formula.functionList.F_INV_RT.functionParameter.degFreedom1.name",detail:"formula.functionList.F_INV_RT.functionParameter.degFreedom1.detail",example:"6",require:1,repeat:0},{name:"formula.functionList.F_INV_RT.functionParameter.degFreedom2.name",detail:"formula.functionList.F_INV_RT.functionParameter.degFreedom2.detail",example:"4",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.F_TEST,functionType:t.FunctionType.Statistical,description:"formula.functionList.F_TEST.description",abstract:"formula.functionList.F_TEST.abstract",functionParameter:[{name:"formula.functionList.F_TEST.functionParameter.array1.name",detail:"formula.functionList.F_TEST.functionParameter.array1.detail",example:"A1:A4",require:1,repeat:0},{name:"formula.functionList.F_TEST.functionParameter.array2.name",detail:"formula.functionList.F_TEST.functionParameter.array2.detail",example:"B1:B4",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.FISHER,functionType:t.FunctionType.Statistical,description:"formula.functionList.FISHER.description",abstract:"formula.functionList.FISHER.abstract",functionParameter:[{name:"formula.functionList.FISHER.functionParameter.x.name",detail:"formula.functionList.FISHER.functionParameter.x.detail",example:"0.75",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.FISHERINV,functionType:t.FunctionType.Statistical,description:"formula.functionList.FISHERINV.description",abstract:"formula.functionList.FISHERINV.abstract",functionParameter:[{name:"formula.functionList.FISHERINV.functionParameter.y.name",detail:"formula.functionList.FISHERINV.functionParameter.y.detail",example:"0.75",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.FORECAST,functionType:t.FunctionType.Statistical,description:"formula.functionList.FORECAST.description",abstract:"formula.functionList.FORECAST.abstract",functionParameter:[{name:"formula.functionList.FORECAST.functionParameter.x.name",detail:"formula.functionList.FORECAST.functionParameter.x.detail",example:"30",require:1,repeat:0},{name:"formula.functionList.FORECAST.functionParameter.knownYs.name",detail:"formula.functionList.FORECAST.functionParameter.knownYs.detail",example:"A1:A4",require:1,repeat:0},{name:"formula.functionList.FORECAST.functionParameter.knownXs.name",detail:"formula.functionList.FORECAST.functionParameter.knownXs.detail",example:"B1:B4",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.FORECAST_ETS,functionType:t.FunctionType.Statistical,description:"formula.functionList.FORECAST_ETS.description",abstract:"formula.functionList.FORECAST_ETS.abstract",functionParameter:[{name:"formula.functionList.FORECAST_ETS.functionParameter.number1.name",detail:"formula.functionList.FORECAST_ETS.functionParameter.number1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.FORECAST_ETS.functionParameter.number2.name",detail:"formula.functionList.FORECAST_ETS.functionParameter.number2.detail",example:"A1:A20",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.FORECAST_ETS_CONFINT,functionType:t.FunctionType.Statistical,description:"formula.functionList.FORECAST_ETS_CONFINT.description",abstract:"formula.functionList.FORECAST_ETS_CONFINT.abstract",functionParameter:[{name:"formula.functionList.FORECAST_ETS_CONFINT.functionParameter.number1.name",detail:"formula.functionList.FORECAST_ETS_CONFINT.functionParameter.number1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.FORECAST_ETS_CONFINT.functionParameter.number2.name",detail:"formula.functionList.FORECAST_ETS_CONFINT.functionParameter.number2.detail",example:"A1:A20",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.FORECAST_ETS_SEASONALITY,functionType:t.FunctionType.Statistical,description:"formula.functionList.FORECAST_ETS_SEASONALITY.description",abstract:"formula.functionList.FORECAST_ETS_SEASONALITY.abstract",functionParameter:[{name:"formula.functionList.FORECAST_ETS_SEASONALITY.functionParameter.number1.name",detail:"formula.functionList.FORECAST_ETS_SEASONALITY.functionParameter.number1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.FORECAST_ETS_SEASONALITY.functionParameter.number2.name",detail:"formula.functionList.FORECAST_ETS_SEASONALITY.functionParameter.number2.detail",example:"A1:A20",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.FORECAST_ETS_STAT,functionType:t.FunctionType.Statistical,description:"formula.functionList.FORECAST_ETS_STAT.description",abstract:"formula.functionList.FORECAST_ETS_STAT.abstract",functionParameter:[{name:"formula.functionList.FORECAST_ETS_STAT.functionParameter.number1.name",detail:"formula.functionList.FORECAST_ETS_STAT.functionParameter.number1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.FORECAST_ETS_STAT.functionParameter.number2.name",detail:"formula.functionList.FORECAST_ETS_STAT.functionParameter.number2.detail",example:"A1:A20",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.FORECAST_LINEAR,functionType:t.FunctionType.Statistical,description:"formula.functionList.FORECAST_LINEAR.description",abstract:"formula.functionList.FORECAST_LINEAR.abstract",functionParameter:[{name:"formula.functionList.FORECAST_LINEAR.functionParameter.x.name",detail:"formula.functionList.FORECAST_LINEAR.functionParameter.x.detail",example:"30",require:1,repeat:0},{name:"formula.functionList.FORECAST_LINEAR.functionParameter.knownYs.name",detail:"formula.functionList.FORECAST_LINEAR.functionParameter.knownYs.detail",example:"A1:A4",require:1,repeat:0},{name:"formula.functionList.FORECAST_LINEAR.functionParameter.knownXs.name",detail:"formula.functionList.FORECAST_LINEAR.functionParameter.knownXs.detail",example:"B1:B4",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.FREQUENCY,functionType:t.FunctionType.Statistical,description:"formula.functionList.FREQUENCY.description",abstract:"formula.functionList.FREQUENCY.abstract",functionParameter:[{name:"formula.functionList.FREQUENCY.functionParameter.dataArray.name",detail:"formula.functionList.FREQUENCY.functionParameter.dataArray.detail",example:"A2:A10",require:1,repeat:0},{name:"formula.functionList.FREQUENCY.functionParameter.binsArray.name",detail:"formula.functionList.FREQUENCY.functionParameter.binsArray.detail",example:"B2:B4",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.GAMMA,functionType:t.FunctionType.Statistical,description:"formula.functionList.GAMMA.description",abstract:"formula.functionList.GAMMA.abstract",functionParameter:[{name:"formula.functionList.GAMMA.functionParameter.number.name",detail:"formula.functionList.GAMMA.functionParameter.number.detail",example:"2.5",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.GAMMA_DIST,functionType:t.FunctionType.Statistical,description:"formula.functionList.GAMMA_DIST.description",abstract:"formula.functionList.GAMMA_DIST.abstract",functionParameter:[{name:"formula.functionList.GAMMA_DIST.functionParameter.x.name",detail:"formula.functionList.GAMMA_DIST.functionParameter.x.detail",example:"10",require:1,repeat:0},{name:"formula.functionList.GAMMA_DIST.functionParameter.alpha.name",detail:"formula.functionList.GAMMA_DIST.functionParameter.alpha.detail",example:"8",require:1,repeat:0},{name:"formula.functionList.GAMMA_DIST.functionParameter.beta.name",detail:"formula.functionList.GAMMA_DIST.functionParameter.beta.detail",example:"2",require:1,repeat:0},{name:"formula.functionList.GAMMA_DIST.functionParameter.cumulative.name",detail:"formula.functionList.GAMMA_DIST.functionParameter.cumulative.detail",example:"true",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.GAMMA_INV,functionType:t.FunctionType.Statistical,description:"formula.functionList.GAMMA_INV.description",abstract:"formula.functionList.GAMMA_INV.abstract",functionParameter:[{name:"formula.functionList.GAMMA_INV.functionParameter.probability.name",detail:"formula.functionList.GAMMA_INV.functionParameter.probability.detail",example:"0.068094",require:1,repeat:0},{name:"formula.functionList.GAMMA_INV.functionParameter.alpha.name",detail:"formula.functionList.GAMMA_INV.functionParameter.alpha.detail",example:"9",require:1,repeat:0},{name:"formula.functionList.GAMMA_INV.functionParameter.beta.name",detail:"formula.functionList.GAMMA_INV.functionParameter.beta.detail",example:"2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.GAMMALN,functionType:t.FunctionType.Statistical,description:"formula.functionList.GAMMALN.description",abstract:"formula.functionList.GAMMALN.abstract",functionParameter:[{name:"formula.functionList.GAMMALN.functionParameter.x.name",detail:"formula.functionList.GAMMALN.functionParameter.x.detail",example:"4",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.GAMMALN_PRECISE,functionType:t.FunctionType.Statistical,description:"formula.functionList.GAMMALN_PRECISE.description",abstract:"formula.functionList.GAMMALN_PRECISE.abstract",functionParameter:[{name:"formula.functionList.GAMMALN_PRECISE.functionParameter.x.name",detail:"formula.functionList.GAMMALN_PRECISE.functionParameter.x.detail",example:"4",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.GAUSS,functionType:t.FunctionType.Statistical,description:"formula.functionList.GAUSS.description",abstract:"formula.functionList.GAUSS.abstract",functionParameter:[{name:"formula.functionList.GAUSS.functionParameter.z.name",detail:"formula.functionList.GAUSS.functionParameter.z.detail",example:"2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.GEOMEAN,functionType:t.FunctionType.Statistical,description:"formula.functionList.GEOMEAN.description",abstract:"formula.functionList.GEOMEAN.abstract",functionParameter:[{name:"formula.functionList.GEOMEAN.functionParameter.number1.name",detail:"formula.functionList.GEOMEAN.functionParameter.number1.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.GEOMEAN.functionParameter.number2.name",detail:"formula.functionList.GEOMEAN.functionParameter.number2.detail",example:"2",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.GROWTH,functionType:t.FunctionType.Statistical,description:"formula.functionList.GROWTH.description",abstract:"formula.functionList.GROWTH.abstract",functionParameter:[{name:"formula.functionList.GROWTH.functionParameter.knownYs.name",detail:"formula.functionList.GROWTH.functionParameter.knownYs.detail",example:"B2:B7",require:1,repeat:0},{name:"formula.functionList.GROWTH.functionParameter.knownXs.name",detail:"formula.functionList.GROWTH.functionParameter.knownXs.detail",example:"A2:A7",require:0,repeat:0},{name:"formula.functionList.GROWTH.functionParameter.newXs.name",detail:"formula.functionList.GROWTH.functionParameter.newXs.detail",example:"A9:A10",require:0,repeat:0},{name:"formula.functionList.GROWTH.functionParameter.constb.name",detail:"formula.functionList.GROWTH.functionParameter.constb.detail",example:"true",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.HARMEAN,functionType:t.FunctionType.Statistical,description:"formula.functionList.HARMEAN.description",abstract:"formula.functionList.HARMEAN.abstract",functionParameter:[{name:"formula.functionList.HARMEAN.functionParameter.number1.name",detail:"formula.functionList.HARMEAN.functionParameter.number1.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.HARMEAN.functionParameter.number2.name",detail:"formula.functionList.HARMEAN.functionParameter.number2.detail",example:"2",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.HYPGEOM_DIST,functionType:t.FunctionType.Statistical,description:"formula.functionList.HYPGEOM_DIST.description",abstract:"formula.functionList.HYPGEOM_DIST.abstract",functionParameter:[{name:"formula.functionList.HYPGEOM_DIST.functionParameter.sampleS.name",detail:"formula.functionList.HYPGEOM_DIST.functionParameter.sampleS.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.HYPGEOM_DIST.functionParameter.numberSample.name",detail:"formula.functionList.HYPGEOM_DIST.functionParameter.numberSample.detail",example:"4",require:1,repeat:0},{name:"formula.functionList.HYPGEOM_DIST.functionParameter.populationS.name",detail:"formula.functionList.HYPGEOM_DIST.functionParameter.populationS.detail",example:"8",require:1,repeat:0},{name:"formula.functionList.HYPGEOM_DIST.functionParameter.numberPop.name",detail:"formula.functionList.HYPGEOM_DIST.functionParameter.numberPop.detail",example:"20",require:1,repeat:0},{name:"formula.functionList.HYPGEOM_DIST.functionParameter.cumulative.name",detail:"formula.functionList.HYPGEOM_DIST.functionParameter.cumulative.detail",example:"true",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.INTERCEPT,functionType:t.FunctionType.Statistical,description:"formula.functionList.INTERCEPT.description",abstract:"formula.functionList.INTERCEPT.abstract",functionParameter:[{name:"formula.functionList.INTERCEPT.functionParameter.knownYs.name",detail:"formula.functionList.INTERCEPT.functionParameter.knownYs.detail",example:"A1:A4",require:1,repeat:0},{name:"formula.functionList.INTERCEPT.functionParameter.knownXs.name",detail:"formula.functionList.INTERCEPT.functionParameter.knownXs.detail",example:"B1:B4",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.KURT,functionType:t.FunctionType.Statistical,description:"formula.functionList.KURT.description",abstract:"formula.functionList.KURT.abstract",functionParameter:[{name:"formula.functionList.KURT.functionParameter.number1.name",detail:"formula.functionList.KURT.functionParameter.number1.detail",example:"A1:A4",require:1,repeat:0},{name:"formula.functionList.KURT.functionParameter.number2.name",detail:"formula.functionList.KURT.functionParameter.number2.detail",example:"4",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.LARGE,functionType:t.FunctionType.Statistical,description:"formula.functionList.LARGE.description",abstract:"formula.functionList.LARGE.abstract",functionParameter:[{name:"formula.functionList.LARGE.functionParameter.array.name",detail:"formula.functionList.LARGE.functionParameter.array.detail",example:"A2:B6",require:1,repeat:0},{name:"formula.functionList.LARGE.functionParameter.k.name",detail:"formula.functionList.LARGE.functionParameter.k.detail",example:"3",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.LINEST,functionType:t.FunctionType.Statistical,description:"formula.functionList.LINEST.description",abstract:"formula.functionList.LINEST.abstract",functionParameter:[{name:"formula.functionList.LINEST.functionParameter.knownYs.name",detail:"formula.functionList.LINEST.functionParameter.knownYs.detail",example:"B2:B7",require:1,repeat:0},{name:"formula.functionList.LINEST.functionParameter.knownXs.name",detail:"formula.functionList.LINEST.functionParameter.knownXs.detail",example:"A2:A7",require:0,repeat:0},{name:"formula.functionList.LINEST.functionParameter.constb.name",detail:"formula.functionList.LINEST.functionParameter.constb.detail",example:"true",require:0,repeat:0},{name:"formula.functionList.LINEST.functionParameter.stats.name",detail:"formula.functionList.LINEST.functionParameter.stats.detail",example:"true",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.LOGEST,functionType:t.FunctionType.Statistical,description:"formula.functionList.LOGEST.description",abstract:"formula.functionList.LOGEST.abstract",functionParameter:[{name:"formula.functionList.LOGEST.functionParameter.knownYs.name",detail:"formula.functionList.LOGEST.functionParameter.knownYs.detail",example:"B2:B7",require:1,repeat:0},{name:"formula.functionList.LOGEST.functionParameter.knownXs.name",detail:"formula.functionList.LOGEST.functionParameter.knownXs.detail",example:"A2:A7",require:0,repeat:0},{name:"formula.functionList.LOGEST.functionParameter.constb.name",detail:"formula.functionList.LOGEST.functionParameter.constb.detail",example:"true",require:0,repeat:0},{name:"formula.functionList.LOGEST.functionParameter.stats.name",detail:"formula.functionList.LOGEST.functionParameter.stats.detail",example:"true",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.LOGNORM_DIST,functionType:t.FunctionType.Statistical,description:"formula.functionList.LOGNORM_DIST.description",abstract:"formula.functionList.LOGNORM_DIST.abstract",functionParameter:[{name:"formula.functionList.LOGNORM_DIST.functionParameter.x.name",detail:"formula.functionList.LOGNORM_DIST.functionParameter.x.detail",example:"42",require:1,repeat:0},{name:"formula.functionList.LOGNORM_DIST.functionParameter.mean.name",detail:"formula.functionList.LOGNORM_DIST.functionParameter.mean.detail",example:"40",require:1,repeat:0},{name:"formula.functionList.LOGNORM_DIST.functionParameter.standardDev.name",detail:"formula.functionList.LOGNORM_DIST.functionParameter.standardDev.detail",example:"1.5",require:1,repeat:0},{name:"formula.functionList.LOGNORM_DIST.functionParameter.cumulative.name",detail:"formula.functionList.LOGNORM_DIST.functionParameter.cumulative.detail",example:"true",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.LOGNORM_INV,functionType:t.FunctionType.Statistical,description:"formula.functionList.LOGNORM_INV.description",abstract:"formula.functionList.LOGNORM_INV.abstract",functionParameter:[{name:"formula.functionList.LOGNORM_INV.functionParameter.probability.name",detail:"formula.functionList.LOGNORM_INV.functionParameter.probability.detail",example:"0.908789",require:1,repeat:0},{name:"formula.functionList.LOGNORM_INV.functionParameter.mean.name",detail:"formula.functionList.LOGNORM_INV.functionParameter.mean.detail",example:"40",require:1,repeat:0},{name:"formula.functionList.LOGNORM_INV.functionParameter.standardDev.name",detail:"formula.functionList.LOGNORM_INV.functionParameter.standardDev.detail",example:"1.5",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.MARGINOFERROR,aliasFunctionName:"formula.functionList.MARGINOFERROR.aliasFunctionName",functionType:t.FunctionType.Statistical,description:"formula.functionList.MARGINOFERROR.description",abstract:"formula.functionList.MARGINOFERROR.abstract",functionParameter:[{name:"formula.functionList.MARGINOFERROR.functionParameter.range.name",detail:"formula.functionList.MARGINOFERROR.functionParameter.range.detail",example:"A1:A4",require:1,repeat:0},{name:"formula.functionList.MARGINOFERROR.functionParameter.confidence.name",detail:"formula.functionList.MARGINOFERROR.functionParameter.confidence.detail",example:"0.95",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.MAX,aliasFunctionName:"formula.functionList.MAX.aliasFunctionName",functionType:t.FunctionType.Statistical,description:"formula.functionList.MAX.description",abstract:"formula.functionList.MAX.abstract",functionParameter:[{name:"formula.functionList.MAX.functionParameter.number1.name",detail:"formula.functionList.MAX.functionParameter.number1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.MAX.functionParameter.number2.name",detail:"formula.functionList.MAX.functionParameter.number2.detail",example:"B2:B10",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.MAXA,functionType:t.FunctionType.Statistical,description:"formula.functionList.MAXA.description",abstract:"formula.functionList.MAXA.abstract",functionParameter:[{name:"formula.functionList.MAXA.functionParameter.value1.name",detail:"formula.functionList.MAXA.functionParameter.value1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.MAXA.functionParameter.value2.name",detail:"formula.functionList.MAXA.functionParameter.value2.detail",example:"B1:B20",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.MAXIFS,functionType:t.FunctionType.Statistical,description:"formula.functionList.MAXIFS.description",abstract:"formula.functionList.MAXIFS.abstract",functionParameter:[{name:"formula.functionList.MAXIFS.functionParameter.maxRange.name",detail:"formula.functionList.MAXIFS.functionParameter.maxRange.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.MAXIFS.functionParameter.criteriaRange1.name",detail:"formula.functionList.MAXIFS.functionParameter.criteriaRange1.detail",example:"B1:B20",require:1,repeat:0},{name:"formula.functionList.MAXIFS.functionParameter.criteria1.name",detail:"formula.functionList.MAXIFS.functionParameter.criteria1.detail",example:'">10"',require:1,repeat:0},{name:"formula.functionList.MAXIFS.functionParameter.criteriaRange2.name",detail:"formula.functionList.MAXIFS.functionParameter.criteriaRange2.detail",example:"C1:C20",require:0,repeat:1},{name:"formula.functionList.MAXIFS.functionParameter.criteria2.name",detail:"formula.functionList.MAXIFS.functionParameter.criteria2.detail",example:'"<20"',require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.MEDIAN,functionType:t.FunctionType.Statistical,description:"formula.functionList.MEDIAN.description",abstract:"formula.functionList.MEDIAN.abstract",functionParameter:[{name:"formula.functionList.MEDIAN.functionParameter.number1.name",detail:"formula.functionList.MEDIAN.functionParameter.number1.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.MEDIAN.functionParameter.number2.name",detail:"formula.functionList.MEDIAN.functionParameter.number2.detail",example:"2",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.MIN,aliasFunctionName:"formula.functionList.MIN.aliasFunctionName",functionType:t.FunctionType.Statistical,description:"formula.functionList.MIN.description",abstract:"formula.functionList.MIN.abstract",functionParameter:[{name:"formula.functionList.MIN.functionParameter.number1.name",detail:"formula.functionList.MIN.functionParameter.number1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.MIN.functionParameter.number2.name",detail:"formula.functionList.MIN.functionParameter.number2.detail",example:"B2:B10",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.MINA,functionType:t.FunctionType.Statistical,description:"formula.functionList.MINA.description",abstract:"formula.functionList.MINA.abstract",functionParameter:[{name:"formula.functionList.MINA.functionParameter.value1.name",detail:"formula.functionList.MINA.functionParameter.value1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.MINA.functionParameter.value2.name",detail:"formula.functionList.MINA.functionParameter.value2.detail",example:"B1:B20",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.MINIFS,functionType:t.FunctionType.Statistical,description:"formula.functionList.MINIFS.description",abstract:"formula.functionList.MINIFS.abstract",functionParameter:[{name:"formula.functionList.MINIFS.functionParameter.minRange.name",detail:"formula.functionList.MINIFS.functionParameter.minRange.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.MINIFS.functionParameter.criteriaRange1.name",detail:"formula.functionList.MINIFS.functionParameter.criteriaRange1.detail",example:"B1:B20",require:1,repeat:0},{name:"formula.functionList.MINIFS.functionParameter.criteria1.name",detail:"formula.functionList.MINIFS.functionParameter.criteria1.detail",example:'">10"',require:1,repeat:0},{name:"formula.functionList.MINIFS.functionParameter.criteriaRange2.name",detail:"formula.functionList.MINIFS.functionParameter.criteriaRange2.detail",example:"C1:C20",require:0,repeat:1},{name:"formula.functionList.MINIFS.functionParameter.criteria2.name",detail:"formula.functionList.MINIFS.functionParameter.criteria2.detail",example:'"<20"',require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.MODE_MULT,functionType:t.FunctionType.Statistical,description:"formula.functionList.MODE_MULT.description",abstract:"formula.functionList.MODE_MULT.abstract",functionParameter:[{name:"formula.functionList.MODE_MULT.functionParameter.number1.name",detail:"formula.functionList.MODE_MULT.functionParameter.number1.detail",example:"A1:A4",require:1,repeat:0},{name:"formula.functionList.MODE_MULT.functionParameter.number2.name",detail:"formula.functionList.MODE_MULT.functionParameter.number2.detail",example:"2",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.MODE_SNGL,functionType:t.FunctionType.Statistical,description:"formula.functionList.MODE_SNGL.description",abstract:"formula.functionList.MODE_SNGL.abstract",functionParameter:[{name:"formula.functionList.MODE_SNGL.functionParameter.number1.name",detail:"formula.functionList.MODE_SNGL.functionParameter.number1.detail",example:"A1:A4",require:1,repeat:0},{name:"formula.functionList.MODE_SNGL.functionParameter.number2.name",detail:"formula.functionList.MODE_SNGL.functionParameter.number2.detail",example:"2",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.NEGBINOM_DIST,functionType:t.FunctionType.Statistical,description:"formula.functionList.NEGBINOM_DIST.description",abstract:"formula.functionList.NEGBINOM_DIST.abstract",functionParameter:[{name:"formula.functionList.NEGBINOM_DIST.functionParameter.numberF.name",detail:"formula.functionList.NEGBINOM_DIST.functionParameter.numberF.detail",example:"10",require:1,repeat:0},{name:"formula.functionList.NEGBINOM_DIST.functionParameter.numberS.name",detail:"formula.functionList.NEGBINOM_DIST.functionParameter.numberS.detail",example:"5",require:1,repeat:0},{name:"formula.functionList.NEGBINOM_DIST.functionParameter.probabilityS.name",detail:"formula.functionList.NEGBINOM_DIST.functionParameter.probabilityS.detail",example:"0.25",require:1,repeat:0},{name:"formula.functionList.NEGBINOM_DIST.functionParameter.cumulative.name",detail:"formula.functionList.NEGBINOM_DIST.functionParameter.cumulative.detail",example:"true",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.NORM_DIST,functionType:t.FunctionType.Statistical,description:"formula.functionList.NORM_DIST.description",abstract:"formula.functionList.NORM_DIST.abstract",functionParameter:[{name:"formula.functionList.NORM_DIST.functionParameter.x.name",detail:"formula.functionList.NORM_DIST.functionParameter.x.detail",example:"42",require:1,repeat:0},{name:"formula.functionList.NORM_DIST.functionParameter.mean.name",detail:"formula.functionList.NORM_DIST.functionParameter.mean.detail",example:"40",require:1,repeat:0},{name:"formula.functionList.NORM_DIST.functionParameter.standardDev.name",detail:"formula.functionList.NORM_DIST.functionParameter.standardDev.detail",example:"1.5",require:1,repeat:0},{name:"formula.functionList.NORM_DIST.functionParameter.cumulative.name",detail:"formula.functionList.NORM_DIST.functionParameter.cumulative.detail",example:"true",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.NORM_INV,functionType:t.FunctionType.Statistical,description:"formula.functionList.NORM_INV.description",abstract:"formula.functionList.NORM_INV.abstract",functionParameter:[{name:"formula.functionList.NORM_INV.functionParameter.probability.name",detail:"formula.functionList.NORM_INV.functionParameter.probability.detail",example:"0.908789",require:1,repeat:0},{name:"formula.functionList.NORM_INV.functionParameter.mean.name",detail:"formula.functionList.NORM_INV.functionParameter.mean.detail",example:"40",require:1,repeat:0},{name:"formula.functionList.NORM_INV.functionParameter.standardDev.name",detail:"formula.functionList.NORM_INV.functionParameter.standardDev.detail",example:"1.5",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.NORM_S_DIST,functionType:t.FunctionType.Statistical,description:"formula.functionList.NORM_S_DIST.description",abstract:"formula.functionList.NORM_S_DIST.abstract",functionParameter:[{name:"formula.functionList.NORM_S_DIST.functionParameter.z.name",detail:"formula.functionList.NORM_S_DIST.functionParameter.z.detail",example:"1.333333",require:1,repeat:0},{name:"formula.functionList.NORM_S_DIST.functionParameter.cumulative.name",detail:"formula.functionList.NORM_S_DIST.functionParameter.cumulative.detail",example:"true",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.NORM_S_INV,functionType:t.FunctionType.Statistical,description:"formula.functionList.NORM_S_INV.description",abstract:"formula.functionList.NORM_S_INV.abstract",functionParameter:[{name:"formula.functionList.NORM_S_INV.functionParameter.probability.name",detail:"formula.functionList.NORM_S_INV.functionParameter.probability.detail",example:"0.908789",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.PEARSON,functionType:t.FunctionType.Statistical,description:"formula.functionList.PEARSON.description",abstract:"formula.functionList.PEARSON.abstract",functionParameter:[{name:"formula.functionList.PEARSON.functionParameter.array1.name",detail:"formula.functionList.PEARSON.functionParameter.array1.detail",example:"A1:A4",require:1,repeat:0},{name:"formula.functionList.PEARSON.functionParameter.array2.name",detail:"formula.functionList.PEARSON.functionParameter.array2.detail",example:"B1:B4",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.PERCENTILE_EXC,functionType:t.FunctionType.Statistical,description:"formula.functionList.PERCENTILE_EXC.description",abstract:"formula.functionList.PERCENTILE_EXC.abstract",functionParameter:[{name:"formula.functionList.PERCENTILE_EXC.functionParameter.array.name",detail:"formula.functionList.PERCENTILE_EXC.functionParameter.array.detail",example:"A1:A4",require:1,repeat:0},{name:"formula.functionList.PERCENTILE_EXC.functionParameter.k.name",detail:"formula.functionList.PERCENTILE_EXC.functionParameter.k.detail",example:"0.3",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.PERCENTILE_INC,functionType:t.FunctionType.Statistical,description:"formula.functionList.PERCENTILE_INC.description",abstract:"formula.functionList.PERCENTILE_INC.abstract",functionParameter:[{name:"formula.functionList.PERCENTILE_INC.functionParameter.array.name",detail:"formula.functionList.PERCENTILE_INC.functionParameter.array.detail",example:"A1:A4",require:1,repeat:0},{name:"formula.functionList.PERCENTILE_INC.functionParameter.k.name",detail:"formula.functionList.PERCENTILE_INC.functionParameter.k.detail",example:"0.3",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.PERCENTRANK_EXC,functionType:t.FunctionType.Statistical,description:"formula.functionList.PERCENTRANK_EXC.description",abstract:"formula.functionList.PERCENTRANK_EXC.abstract",functionParameter:[{name:"formula.functionList.PERCENTRANK_EXC.functionParameter.array.name",detail:"formula.functionList.PERCENTRANK_EXC.functionParameter.array.detail",example:"A1:A4",require:1,repeat:0},{name:"formula.functionList.PERCENTRANK_EXC.functionParameter.x.name",detail:"formula.functionList.PERCENTRANK_EXC.functionParameter.x.detail",example:"1.5",require:1,repeat:0},{name:"formula.functionList.PERCENTRANK_EXC.functionParameter.significance.name",detail:"formula.functionList.PERCENTRANK_EXC.functionParameter.significance.detail",example:"3",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.PERCENTRANK_INC,functionType:t.FunctionType.Statistical,description:"formula.functionList.PERCENTRANK_INC.description",abstract:"formula.functionList.PERCENTRANK_INC.abstract",functionParameter:[{name:"formula.functionList.PERCENTRANK_INC.functionParameter.array.name",detail:"formula.functionList.PERCENTRANK_INC.functionParameter.array.detail",example:"A1:A4",require:1,repeat:0},{name:"formula.functionList.PERCENTRANK_INC.functionParameter.x.name",detail:"formula.functionList.PERCENTRANK_INC.functionParameter.x.detail",example:"1.5",require:1,repeat:0},{name:"formula.functionList.PERCENTRANK_INC.functionParameter.significance.name",detail:"formula.functionList.PERCENTRANK_INC.functionParameter.significance.detail",example:"3",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.PERMUT,functionType:t.FunctionType.Statistical,description:"formula.functionList.PERMUT.description",abstract:"formula.functionList.PERMUT.abstract",functionParameter:[{name:"formula.functionList.PERMUT.functionParameter.number.name",detail:"formula.functionList.PERMUT.functionParameter.number.detail",example:"8",require:1,repeat:0},{name:"formula.functionList.PERMUT.functionParameter.numberChosen.name",detail:"formula.functionList.PERMUT.functionParameter.numberChosen.detail",example:"2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.PERMUTATIONA,functionType:t.FunctionType.Statistical,description:"formula.functionList.PERMUTATIONA.description",abstract:"formula.functionList.PERMUTATIONA.abstract",functionParameter:[{name:"formula.functionList.PERMUT.functionParameter.number.name",detail:"formula.functionList.PERMUT.functionParameter.number.detail",example:"8",require:1,repeat:0},{name:"formula.functionList.PERMUT.functionParameter.numberChosen.name",detail:"formula.functionList.PERMUT.functionParameter.numberChosen.detail",example:"2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.PHI,functionType:t.FunctionType.Statistical,description:"formula.functionList.PHI.description",abstract:"formula.functionList.PHI.abstract",functionParameter:[{name:"formula.functionList.PHI.functionParameter.x.name",detail:"formula.functionList.PHI.functionParameter.x.detail",example:"0.75",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.POISSON_DIST,functionType:t.FunctionType.Statistical,description:"formula.functionList.POISSON_DIST.description",abstract:"formula.functionList.POISSON_DIST.abstract",functionParameter:[{name:"formula.functionList.POISSON_DIST.functionParameter.x.name",detail:"formula.functionList.POISSON_DIST.functionParameter.x.detail",example:"2",require:1,repeat:0},{name:"formula.functionList.POISSON_DIST.functionParameter.mean.name",detail:"formula.functionList.POISSON_DIST.functionParameter.mean.detail",example:"5",require:1,repeat:0},{name:"formula.functionList.POISSON_DIST.functionParameter.cumulative.name",detail:"formula.functionList.POISSON_DIST.functionParameter.cumulative.detail",example:"true",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.PROB,functionType:t.FunctionType.Statistical,description:"formula.functionList.PROB.description",abstract:"formula.functionList.PROB.abstract",functionParameter:[{name:"formula.functionList.PROB.functionParameter.xRange.name",detail:"formula.functionList.PROB.functionParameter.xRange.detail",example:"A1:A4",require:1,repeat:0},{name:"formula.functionList.PROB.functionParameter.probRange.name",detail:"formula.functionList.PROB.functionParameter.probRange.detail",example:"B1:B4",require:1,repeat:0},{name:"formula.functionList.PROB.functionParameter.lowerLimit.name",detail:"formula.functionList.PROB.functionParameter.lowerLimit.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.PROB.functionParameter.upperLimit.name",detail:"formula.functionList.PROB.functionParameter.upperLimit.detail",example:"3",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.QUARTILE_EXC,functionType:t.FunctionType.Statistical,description:"formula.functionList.QUARTILE_EXC.description",abstract:"formula.functionList.QUARTILE_EXC.abstract",functionParameter:[{name:"formula.functionList.QUARTILE_EXC.functionParameter.array.name",detail:"formula.functionList.QUARTILE_EXC.functionParameter.array.detail",example:"A1:A4",require:1,repeat:0},{name:"formula.functionList.QUARTILE_EXC.functionParameter.quart.name",detail:"formula.functionList.QUARTILE_EXC.functionParameter.quart.detail",example:"1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.QUARTILE_INC,functionType:t.FunctionType.Statistical,description:"formula.functionList.QUARTILE_INC.description",abstract:"formula.functionList.QUARTILE_INC.abstract",functionParameter:[{name:"formula.functionList.QUARTILE_INC.functionParameter.array.name",detail:"formula.functionList.QUARTILE_INC.functionParameter.array.detail",example:"A1:A4",require:1,repeat:0},{name:"formula.functionList.QUARTILE_INC.functionParameter.quart.name",detail:"formula.functionList.QUARTILE_INC.functionParameter.quart.detail",example:"1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.RANK_AVG,functionType:t.FunctionType.Statistical,description:"formula.functionList.RANK_AVG.description",abstract:"formula.functionList.RANK_AVG.abstract",functionParameter:[{name:"formula.functionList.RANK_AVG.functionParameter.number.name",detail:"formula.functionList.RANK_AVG.functionParameter.number.detail",example:"A3",require:1,repeat:0},{name:"formula.functionList.RANK_AVG.functionParameter.ref.name",detail:"formula.functionList.RANK_AVG.functionParameter.ref.detail",example:"A2:A6",require:1,repeat:0},{name:"formula.functionList.RANK_AVG.functionParameter.order.name",detail:"formula.functionList.RANK_AVG.functionParameter.order.detail",example:"1",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.RANK_EQ,functionType:t.FunctionType.Statistical,description:"formula.functionList.RANK_EQ.description",abstract:"formula.functionList.RANK_EQ.abstract",functionParameter:[{name:"formula.functionList.RANK_EQ.functionParameter.number.name",detail:"formula.functionList.RANK_EQ.functionParameter.number.detail",example:"A3",require:1,repeat:0},{name:"formula.functionList.RANK_EQ.functionParameter.ref.name",detail:"formula.functionList.RANK_EQ.functionParameter.ref.detail",example:"A2:A6",require:1,repeat:0},{name:"formula.functionList.RANK_EQ.functionParameter.order.name",detail:"formula.functionList.RANK_EQ.functionParameter.order.detail",example:"1",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.RSQ,functionType:t.FunctionType.Statistical,description:"formula.functionList.RSQ.description",abstract:"formula.functionList.RSQ.abstract",functionParameter:[{name:"formula.functionList.RSQ.functionParameter.array1.name",detail:"formula.functionList.RSQ.functionParameter.array1.detail",example:"A1:A4",require:1,repeat:0},{name:"formula.functionList.RSQ.functionParameter.array2.name",detail:"formula.functionList.RSQ.functionParameter.array2.detail",example:"B1:B4",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.SKEW,functionType:t.FunctionType.Statistical,description:"formula.functionList.SKEW.description",abstract:"formula.functionList.SKEW.abstract",functionParameter:[{name:"formula.functionList.SKEW.functionParameter.number1.name",detail:"formula.functionList.SKEW.functionParameter.number1.detail",example:"A1:C3",require:1,repeat:0},{name:"formula.functionList.SKEW.functionParameter.number2.name",detail:"formula.functionList.SKEW.functionParameter.number2.detail",example:"4",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.SKEW_P,functionType:t.FunctionType.Statistical,description:"formula.functionList.SKEW_P.description",abstract:"formula.functionList.SKEW_P.abstract",functionParameter:[{name:"formula.functionList.SKEW_P.functionParameter.number1.name",detail:"formula.functionList.SKEW_P.functionParameter.number1.detail",example:"A1:C3",require:1,repeat:0},{name:"formula.functionList.SKEW_P.functionParameter.number2.name",detail:"formula.functionList.SKEW_P.functionParameter.number2.detail",example:"4",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.SLOPE,functionType:t.FunctionType.Statistical,description:"formula.functionList.SLOPE.description",abstract:"formula.functionList.SLOPE.abstract",functionParameter:[{name:"formula.functionList.SLOPE.functionParameter.knownYs.name",detail:"formula.functionList.SLOPE.functionParameter.knownYs.detail",example:"A1:A4",require:1,repeat:0},{name:"formula.functionList.SLOPE.functionParameter.knownXs.name",detail:"formula.functionList.SLOPE.functionParameter.knownXs.detail",example:"B1:B4",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.SMALL,functionType:t.FunctionType.Statistical,description:"formula.functionList.SMALL.description",abstract:"formula.functionList.SMALL.abstract",functionParameter:[{name:"formula.functionList.SMALL.functionParameter.array.name",detail:"formula.functionList.SMALL.functionParameter.array.detail",example:"A2:B6",require:1,repeat:0},{name:"formula.functionList.SMALL.functionParameter.k.name",detail:"formula.functionList.SMALL.functionParameter.k.detail",example:"3",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.STANDARDIZE,functionType:t.FunctionType.Statistical,description:"formula.functionList.STANDARDIZE.description",abstract:"formula.functionList.STANDARDIZE.abstract",functionParameter:[{name:"formula.functionList.STANDARDIZE.functionParameter.x.name",detail:"formula.functionList.STANDARDIZE.functionParameter.x.detail",example:"42",require:1,repeat:0},{name:"formula.functionList.STANDARDIZE.functionParameter.mean.name",detail:"formula.functionList.STANDARDIZE.functionParameter.mean.detail",example:"40",require:1,repeat:0},{name:"formula.functionList.STANDARDIZE.functionParameter.standardDev.name",detail:"formula.functionList.STANDARDIZE.functionParameter.standardDev.detail",example:"1.5",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.STDEV_P,functionType:t.FunctionType.Statistical,description:"formula.functionList.STDEV_P.description",abstract:"formula.functionList.STDEV_P.abstract",functionParameter:[{name:"formula.functionList.STDEV_P.functionParameter.number1.name",detail:"formula.functionList.STDEV_P.functionParameter.number1.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.STDEV_P.functionParameter.number2.name",detail:"formula.functionList.STDEV_P.functionParameter.number2.detail",example:"2",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.STDEV_S,functionType:t.FunctionType.Statistical,description:"formula.functionList.STDEV_S.description",abstract:"formula.functionList.STDEV_S.abstract",functionParameter:[{name:"formula.functionList.STDEV_S.functionParameter.number1.name",detail:"formula.functionList.STDEV_S.functionParameter.number1.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.STDEV_S.functionParameter.number2.name",detail:"formula.functionList.STDEV_S.functionParameter.number2.detail",example:"2",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.STDEVA,functionType:t.FunctionType.Statistical,description:"formula.functionList.STDEVA.description",abstract:"formula.functionList.STDEVA.abstract",functionParameter:[{name:"formula.functionList.STDEVA.functionParameter.value1.name",detail:"formula.functionList.STDEVA.functionParameter.value1.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.STDEVA.functionParameter.value2.name",detail:"formula.functionList.STDEVA.functionParameter.value2.detail",example:"2",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.STDEVPA,functionType:t.FunctionType.Statistical,description:"formula.functionList.STDEVPA.description",abstract:"formula.functionList.STDEVPA.abstract",functionParameter:[{name:"formula.functionList.STDEVPA.functionParameter.value1.name",detail:"formula.functionList.STDEVPA.functionParameter.value1.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.STDEVPA.functionParameter.value2.name",detail:"formula.functionList.STDEVPA.functionParameter.value2.detail",example:"2",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.STEYX,functionType:t.FunctionType.Statistical,description:"formula.functionList.STEYX.description",abstract:"formula.functionList.STEYX.abstract",functionParameter:[{name:"formula.functionList.STEYX.functionParameter.knownYs.name",detail:"formula.functionList.STEYX.functionParameter.knownYs.detail",example:"A1:A4",require:1,repeat:0},{name:"formula.functionList.STEYX.functionParameter.knownXs.name",detail:"formula.functionList.STEYX.functionParameter.knownXs.detail",example:"B1:B4",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.T_DIST,functionType:t.FunctionType.Statistical,description:"formula.functionList.T_DIST.description",abstract:"formula.functionList.T_DIST.abstract",functionParameter:[{name:"formula.functionList.T_DIST.functionParameter.x.name",detail:"formula.functionList.T_DIST.functionParameter.x.detail",example:"8",require:1,repeat:0},{name:"formula.functionList.T_DIST.functionParameter.degFreedom.name",detail:"formula.functionList.T_DIST.functionParameter.degFreedom.detail",example:"3",require:1,repeat:0},{name:"formula.functionList.T_DIST.functionParameter.cumulative.name",detail:"formula.functionList.T_DIST.functionParameter.cumulative.detail",example:"true",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.T_DIST_2T,functionType:t.FunctionType.Statistical,description:"formula.functionList.T_DIST_2T.description",abstract:"formula.functionList.T_DIST_2T.abstract",functionParameter:[{name:"formula.functionList.T_DIST_2T.functionParameter.x.name",detail:"formula.functionList.T_DIST_2T.functionParameter.x.detail",example:"8",require:1,repeat:0},{name:"formula.functionList.T_DIST_2T.functionParameter.degFreedom.name",detail:"formula.functionList.T_DIST_2T.functionParameter.degFreedom.detail",example:"3",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.T_DIST_RT,functionType:t.FunctionType.Statistical,description:"formula.functionList.T_DIST_RT.description",abstract:"formula.functionList.T_DIST_RT.abstract",functionParameter:[{name:"formula.functionList.T_DIST_RT.functionParameter.x.name",detail:"formula.functionList.T_DIST_RT.functionParameter.x.detail",example:"8",require:1,repeat:0},{name:"formula.functionList.T_DIST_RT.functionParameter.degFreedom.name",detail:"formula.functionList.T_DIST_RT.functionParameter.degFreedom.detail",example:"3",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.T_INV,functionType:t.FunctionType.Statistical,description:"formula.functionList.T_INV.description",abstract:"formula.functionList.T_INV.abstract",functionParameter:[{name:"formula.functionList.T_INV.functionParameter.probability.name",detail:"formula.functionList.T_INV.functionParameter.probability.detail",example:"0.75",require:1,repeat:0},{name:"formula.functionList.T_INV.functionParameter.degFreedom.name",detail:"formula.functionList.T_INV.functionParameter.degFreedom.detail",example:"2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.T_INV_2T,functionType:t.FunctionType.Statistical,description:"formula.functionList.T_INV_2T.description",abstract:"formula.functionList.T_INV_2T.abstract",functionParameter:[{name:"formula.functionList.T_INV_2T.functionParameter.probability.name",detail:"formula.functionList.T_INV_2T.functionParameter.probability.detail",example:"0.75",require:1,repeat:0},{name:"formula.functionList.T_INV_2T.functionParameter.degFreedom.name",detail:"formula.functionList.T_INV_2T.functionParameter.degFreedom.detail",example:"2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.T_TEST,functionType:t.FunctionType.Statistical,description:"formula.functionList.T_TEST.description",abstract:"formula.functionList.T_TEST.abstract",functionParameter:[{name:"formula.functionList.T_TEST.functionParameter.array1.name",detail:"formula.functionList.T_TEST.functionParameter.array1.detail",example:"A1:A4",require:1,repeat:0},{name:"formula.functionList.T_TEST.functionParameter.array2.name",detail:"formula.functionList.T_TEST.functionParameter.array2.detail",example:"B1:B4",require:1,repeat:0},{name:"formula.functionList.T_TEST.functionParameter.tails.name",detail:"formula.functionList.T_TEST.functionParameter.tails.detail",example:"2",require:1,repeat:0},{name:"formula.functionList.T_TEST.functionParameter.type.name",detail:"formula.functionList.T_TEST.functionParameter.type.detail",example:"1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.TREND,functionType:t.FunctionType.Statistical,description:"formula.functionList.TREND.description",abstract:"formula.functionList.TREND.abstract",functionParameter:[{name:"formula.functionList.TREND.functionParameter.knownYs.name",detail:"formula.functionList.TREND.functionParameter.knownYs.detail",example:"B2:B7",require:1,repeat:0},{name:"formula.functionList.TREND.functionParameter.knownXs.name",detail:"formula.functionList.TREND.functionParameter.knownXs.detail",example:"A2:A7",require:0,repeat:0},{name:"formula.functionList.TREND.functionParameter.newXs.name",detail:"formula.functionList.TREND.functionParameter.newXs.detail",example:"A9:A10",require:0,repeat:0},{name:"formula.functionList.TREND.functionParameter.constb.name",detail:"formula.functionList.TREND.functionParameter.constb.detail",example:"true",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.TRIMMEAN,functionType:t.FunctionType.Statistical,description:"formula.functionList.TRIMMEAN.description",abstract:"formula.functionList.TRIMMEAN.abstract",functionParameter:[{name:"formula.functionList.TRIMMEAN.functionParameter.array.name",detail:"formula.functionList.TRIMMEAN.functionParameter.array.detail",example:"A2:A12",require:1,repeat:0},{name:"formula.functionList.TRIMMEAN.functionParameter.percent.name",detail:"formula.functionList.TRIMMEAN.functionParameter.percent.detail",example:"0.2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.VAR_P,functionType:t.FunctionType.Statistical,description:"formula.functionList.VAR_P.description",abstract:"formula.functionList.VAR_P.abstract",functionParameter:[{name:"formula.functionList.VAR_P.functionParameter.number1.name",detail:"formula.functionList.VAR_P.functionParameter.number1.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.VAR_P.functionParameter.number2.name",detail:"formula.functionList.VAR_P.functionParameter.number2.detail",example:"2",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.VAR_S,functionType:t.FunctionType.Statistical,description:"formula.functionList.VAR_S.description",abstract:"formula.functionList.VAR_S.abstract",functionParameter:[{name:"formula.functionList.VAR_S.functionParameter.number1.name",detail:"formula.functionList.VAR_S.functionParameter.number1.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.VAR_S.functionParameter.number2.name",detail:"formula.functionList.VAR_S.functionParameter.number2.detail",example:"2",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.VARA,functionType:t.FunctionType.Statistical,description:"formula.functionList.VARA.description",abstract:"formula.functionList.VARA.abstract",functionParameter:[{name:"formula.functionList.VARA.functionParameter.value1.name",detail:"formula.functionList.VARA.functionParameter.value1.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.VARA.functionParameter.value2.name",detail:"formula.functionList.VARA.functionParameter.value2.detail",example:"2",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.VARPA,functionType:t.FunctionType.Statistical,description:"formula.functionList.VARPA.description",abstract:"formula.functionList.VARPA.abstract",functionParameter:[{name:"formula.functionList.VARPA.functionParameter.value1.name",detail:"formula.functionList.VARPA.functionParameter.value1.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.VARPA.functionParameter.value2.name",detail:"formula.functionList.VARPA.functionParameter.value2.detail",example:"2",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.WEIBULL_DIST,functionType:t.FunctionType.Statistical,description:"formula.functionList.WEIBULL_DIST.description",abstract:"formula.functionList.WEIBULL_DIST.abstract",functionParameter:[{name:"formula.functionList.WEIBULL_DIST.functionParameter.x.name",detail:"formula.functionList.WEIBULL_DIST.functionParameter.x.detail",example:"105",require:1,repeat:0},{name:"formula.functionList.WEIBULL_DIST.functionParameter.alpha.name",detail:"formula.functionList.WEIBULL_DIST.functionParameter.alpha.detail",example:"20",require:1,repeat:0},{name:"formula.functionList.WEIBULL_DIST.functionParameter.beta.name",detail:"formula.functionList.WEIBULL_DIST.functionParameter.beta.detail",example:"100",require:1,repeat:0},{name:"formula.functionList.WEIBULL_DIST.functionParameter.cumulative.name",detail:"formula.functionList.WEIBULL_DIST.functionParameter.cumulative.detail",example:"true",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_STATISTICAL.Z_TEST,functionType:t.FunctionType.Statistical,description:"formula.functionList.Z_TEST.description",abstract:"formula.functionList.Z_TEST.abstract",functionParameter:[{name:"formula.functionList.Z_TEST.functionParameter.array.name",detail:"formula.functionList.Z_TEST.functionParameter.array.detail",example:"A2:A11",require:1,repeat:0},{name:"formula.functionList.Z_TEST.functionParameter.x.name",detail:"formula.functionList.Z_TEST.functionParameter.x.detail",example:"4",require:1,repeat:0},{name:"formula.functionList.Z_TEST.functionParameter.sigma.name",detail:"formula.functionList.Z_TEST.functionParameter.sigma.detail",example:"10",require:0,repeat:0}]}],ta=[{functionName:t.FUNCTION_NAMES_TEXT.ASC,functionType:t.FunctionType.Text,description:"formula.functionList.ASC.description",abstract:"formula.functionList.ASC.abstract",functionParameter:[{name:"formula.functionList.ASC.functionParameter.text.name",detail:"formula.functionList.ASC.functionParameter.text.detail",example:'"Univer"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.ARRAYTOTEXT,functionType:t.FunctionType.Text,description:"formula.functionList.ARRAYTOTEXT.description",abstract:"formula.functionList.ARRAYTOTEXT.abstract",functionParameter:[{name:"formula.functionList.ARRAYTOTEXT.functionParameter.array.name",detail:"formula.functionList.ARRAYTOTEXT.functionParameter.array.detail",example:"A2:B4",require:1,repeat:0},{name:"formula.functionList.ARRAYTOTEXT.functionParameter.format.name",detail:"formula.functionList.ARRAYTOTEXT.functionParameter.format.detail",example:"0",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.BAHTTEXT,functionType:t.FunctionType.Text,description:"formula.functionList.BAHTTEXT.description",abstract:"formula.functionList.BAHTTEXT.abstract",functionParameter:[{name:"formula.functionList.BAHTTEXT.functionParameter.number.name",detail:"formula.functionList.BAHTTEXT.functionParameter.number.detail",example:"1234",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.CHAR,functionType:t.FunctionType.Text,description:"formula.functionList.CHAR.description",abstract:"formula.functionList.CHAR.abstract",functionParameter:[{name:"formula.functionList.CHAR.functionParameter.number.name",detail:"formula.functionList.CHAR.functionParameter.number.detail",example:"65",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.CLEAN,functionType:t.FunctionType.Text,description:"formula.functionList.CLEAN.description",abstract:"formula.functionList.CLEAN.abstract",functionParameter:[{name:"formula.functionList.CLEAN.functionParameter.text.name",detail:"formula.functionList.CLEAN.functionParameter.text.detail",example:'CHAR(1)&"Univer"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.CODE,functionType:t.FunctionType.Text,description:"formula.functionList.CODE.description",abstract:"formula.functionList.CODE.abstract",functionParameter:[{name:"formula.functionList.CODE.functionParameter.text.name",detail:"formula.functionList.CODE.functionParameter.text.detail",example:'"Univer"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.CONCAT,functionType:t.FunctionType.Text,description:"formula.functionList.CONCAT.description",abstract:"formula.functionList.CONCAT.abstract",functionParameter:[{name:"formula.functionList.CONCAT.functionParameter.text1.name",detail:"formula.functionList.CONCAT.functionParameter.text1.detail",example:'"Hello"',require:1,repeat:0},{name:"formula.functionList.CONCAT.functionParameter.text2.name",detail:"formula.functionList.CONCAT.functionParameter.text2.detail",example:'"Univer"',require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_TEXT.CONCATENATE,functionType:t.FunctionType.Text,description:"formula.functionList.CONCATENATE.description",abstract:"formula.functionList.CONCATENATE.abstract",functionParameter:[{name:"formula.functionList.CONCATENATE.functionParameter.text1.name",detail:"formula.functionList.CONCATENATE.functionParameter.text1.detail",example:"A1",require:1,repeat:0},{name:"formula.functionList.CONCATENATE.functionParameter.text2.name",detail:"formula.functionList.CONCATENATE.functionParameter.text2.detail",example:"A2",require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_TEXT.DBCS,functionType:t.FunctionType.Text,description:"formula.functionList.DBCS.description",abstract:"formula.functionList.DBCS.abstract",functionParameter:[{name:"formula.functionList.DBCS.functionParameter.text.name",detail:"formula.functionList.DBCS.functionParameter.text.detail",example:'"Univer"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.DOLLAR,functionType:t.FunctionType.Text,description:"formula.functionList.DOLLAR.description",abstract:"formula.functionList.DOLLAR.abstract",functionParameter:[{name:"formula.functionList.DOLLAR.functionParameter.number.name",detail:"formula.functionList.DOLLAR.functionParameter.number.detail",example:"1234.567",require:1,repeat:0},{name:"formula.functionList.DOLLAR.functionParameter.decimals.name",detail:"formula.functionList.DOLLAR.functionParameter.decimals.detail",example:"2",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.EXACT,functionType:t.FunctionType.Text,description:"formula.functionList.EXACT.description",abstract:"formula.functionList.EXACT.abstract",functionParameter:[{name:"formula.functionList.EXACT.functionParameter.text1.name",detail:"formula.functionList.EXACT.functionParameter.text1.detail",example:'"Univer"',require:1,repeat:0},{name:"formula.functionList.EXACT.functionParameter.text2.name",detail:"formula.functionList.EXACT.functionParameter.text2.detail",example:'"univer"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.FIND,functionType:t.FunctionType.Text,description:"formula.functionList.FIND.description",abstract:"formula.functionList.FIND.abstract",functionParameter:[{name:"formula.functionList.FIND.functionParameter.findText.name",detail:"formula.functionList.FIND.functionParameter.findText.detail",example:'"Univer"',require:1,repeat:0},{name:"formula.functionList.FIND.functionParameter.withinText.name",detail:"formula.functionList.FIND.functionParameter.withinText.detail",example:'"Hello Univer"',require:1,repeat:0},{name:"formula.functionList.FIND.functionParameter.startNum.name",detail:"formula.functionList.FIND.functionParameter.startNum.detail",example:"1",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.FINDB,functionType:t.FunctionType.Text,description:"formula.functionList.FINDB.description",abstract:"formula.functionList.FINDB.abstract",functionParameter:[{name:"formula.functionList.FINDB.functionParameter.findText.name",detail:"formula.functionList.FINDB.functionParameter.findText.detail",example:'"Univer"',require:1,repeat:0},{name:"formula.functionList.FINDB.functionParameter.withinText.name",detail:"formula.functionList.FINDB.functionParameter.withinText.detail",example:'"Hello Univer"',require:1,repeat:0},{name:"formula.functionList.FINDB.functionParameter.startNum.name",detail:"formula.functionList.FINDB.functionParameter.startNum.detail",example:"1",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.FIXED,functionType:t.FunctionType.Text,description:"formula.functionList.FIXED.description",abstract:"formula.functionList.FIXED.abstract",functionParameter:[{name:"formula.functionList.FIXED.functionParameter.number.name",detail:"formula.functionList.FIXED.functionParameter.number.detail",example:"1234.567",require:1,repeat:0},{name:"formula.functionList.FIXED.functionParameter.decimals.name",detail:"formula.functionList.FIXED.functionParameter.decimals.detail",example:"2",require:0,repeat:0},{name:"formula.functionList.FIXED.functionParameter.noCommas.name",detail:"formula.functionList.FIXED.functionParameter.noCommas.detail",example:"0",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.LEFT,functionType:t.FunctionType.Text,description:"formula.functionList.LEFT.description",abstract:"formula.functionList.LEFT.abstract",functionParameter:[{name:"formula.functionList.LEFT.functionParameter.text.name",detail:"formula.functionList.LEFT.functionParameter.text.detail",example:'"Univer"',require:1,repeat:0},{name:"formula.functionList.LEFT.functionParameter.numChars.name",detail:"formula.functionList.LEFT.functionParameter.numChars.detail",example:"3",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.LEFTB,functionType:t.FunctionType.Text,description:"formula.functionList.LEFTB.description",abstract:"formula.functionList.LEFTB.abstract",functionParameter:[{name:"formula.functionList.LEFTB.functionParameter.text.name",detail:"formula.functionList.LEFTB.functionParameter.text.detail",example:'"Univer"',require:1,repeat:0},{name:"formula.functionList.LEFTB.functionParameter.numBytes.name",detail:"formula.functionList.LEFTB.functionParameter.numBytes.detail",example:"3",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.LEN,functionType:t.FunctionType.Text,description:"formula.functionList.LEN.description",abstract:"formula.functionList.LEN.abstract",functionParameter:[{name:"formula.functionList.LEN.functionParameter.text.name",detail:"formula.functionList.LEN.functionParameter.text.detail",example:'"Univer"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.LENB,functionType:t.FunctionType.Text,description:"formula.functionList.LENB.description",abstract:"formula.functionList.LENB.abstract",functionParameter:[{name:"formula.functionList.LENB.functionParameter.text.name",detail:"formula.functionList.LENB.functionParameter.text.detail",example:'"Univer"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.LOWER,functionType:t.FunctionType.Text,description:"formula.functionList.LOWER.description",abstract:"formula.functionList.LOWER.abstract",functionParameter:[{name:"formula.functionList.LOWER.functionParameter.text.name",detail:"formula.functionList.LOWER.functionParameter.text.detail",example:'"Univer"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.MID,functionType:t.FunctionType.Text,description:"formula.functionList.MID.description",abstract:"formula.functionList.MID.abstract",functionParameter:[{name:"formula.functionList.MID.functionParameter.text.name",detail:"formula.functionList.MID.functionParameter.text.detail",example:'"Univer"',require:1,repeat:0},{name:"formula.functionList.MID.functionParameter.startNum.name",detail:"formula.functionList.MID.functionParameter.startNum.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.MID.functionParameter.numChars.name",detail:"formula.functionList.MID.functionParameter.numChars.detail",example:"3",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.MIDB,functionType:t.FunctionType.Text,description:"formula.functionList.MIDB.description",abstract:"formula.functionList.MIDB.abstract",functionParameter:[{name:"formula.functionList.MIDB.functionParameter.text.name",detail:"formula.functionList.MIDB.functionParameter.text.detail",example:'"Univer"',require:1,repeat:0},{name:"formula.functionList.MIDB.functionParameter.startNum.name",detail:"formula.functionList.MIDB.functionParameter.startNum.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.MIDB.functionParameter.numBytes.name",detail:"formula.functionList.MIDB.functionParameter.numBytes.detail",example:"3",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.NUMBERSTRING,functionType:t.FunctionType.Text,description:"formula.functionList.NUMBERSTRING.description",abstract:"formula.functionList.NUMBERSTRING.abstract",functionParameter:[{name:"formula.functionList.NUMBERSTRING.functionParameter.number.name",detail:"formula.functionList.NUMBERSTRING.functionParameter.number.detail",example:"123",require:1,repeat:0},{name:"formula.functionList.NUMBERSTRING.functionParameter.type.name",detail:"formula.functionList.NUMBERSTRING.functionParameter.type.detail",example:"1",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.NUMBERVALUE,functionType:t.FunctionType.Text,description:"formula.functionList.NUMBERVALUE.description",abstract:"formula.functionList.NUMBERVALUE.abstract",functionParameter:[{name:"formula.functionList.NUMBERVALUE.functionParameter.text.name",detail:"formula.functionList.NUMBERVALUE.functionParameter.text.detail",example:'"2.500,27"',require:1,repeat:0},{name:"formula.functionList.NUMBERVALUE.functionParameter.decimalSeparator.name",detail:"formula.functionList.NUMBERVALUE.functionParameter.decimalSeparator.detail",example:'","',require:0,repeat:0},{name:"formula.functionList.NUMBERVALUE.functionParameter.groupSeparator.name",detail:"formula.functionList.NUMBERVALUE.functionParameter.groupSeparator.detail",example:'"."',require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.PHONETIC,functionType:t.FunctionType.Text,description:"formula.functionList.PHONETIC.description",abstract:"formula.functionList.PHONETIC.abstract",functionParameter:[{name:"formula.functionList.PHONETIC.functionParameter.number1.name",detail:"formula.functionList.PHONETIC.functionParameter.number1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.PHONETIC.functionParameter.number2.name",detail:"formula.functionList.PHONETIC.functionParameter.number2.detail",example:"A1:A20",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.PROPER,functionType:t.FunctionType.Text,description:"formula.functionList.PROPER.description",abstract:"formula.functionList.PROPER.abstract",functionParameter:[{name:"formula.functionList.PROPER.functionParameter.text.name",detail:"formula.functionList.PROPER.functionParameter.text.detail",example:'"hello univer"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.REGEXEXTRACT,functionType:t.FunctionType.Text,description:"formula.functionList.REGEXEXTRACT.description",abstract:"formula.functionList.REGEXEXTRACT.abstract",functionParameter:[{name:"formula.functionList.REGEXEXTRACT.functionParameter.text.name",detail:"formula.functionList.REGEXEXTRACT.functionParameter.text.detail",example:'"abcdefg"',require:1,repeat:0},{name:"formula.functionList.REGEXEXTRACT.functionParameter.regularExpression.name",detail:"formula.functionList.REGEXEXTRACT.functionParameter.regularExpression.detail",example:'"c.*f"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.REGEXMATCH,functionType:t.FunctionType.Text,description:"formula.functionList.REGEXMATCH.description",abstract:"formula.functionList.REGEXMATCH.abstract",functionParameter:[{name:"formula.functionList.REGEXMATCH.functionParameter.text.name",detail:"formula.functionList.REGEXMATCH.functionParameter.text.detail",example:'"Spreadsheets"',require:1,repeat:0},{name:"formula.functionList.REGEXMATCH.functionParameter.regularExpression.name",detail:"formula.functionList.REGEXMATCH.functionParameter.regularExpression.detail",example:'"S.r"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.REGEXREPLACE,functionType:t.FunctionType.Text,description:"formula.functionList.REGEXREPLACE.description",abstract:"formula.functionList.REGEXREPLACE.abstract",functionParameter:[{name:"formula.functionList.REGEXREPLACE.functionParameter.text.name",detail:"formula.functionList.REGEXREPLACE.functionParameter.text.detail",example:'"abcedfg"',require:1,repeat:0},{name:"formula.functionList.REGEXREPLACE.functionParameter.regularExpression.name",detail:"formula.functionList.REGEXREPLACE.functionParameter.regularExpression.detail",example:'"a.*d"',require:1,repeat:0},{name:"formula.functionList.REGEXREPLACE.functionParameter.replacement.name",detail:"formula.functionList.REGEXREPLACE.functionParameter.replacement.detail",example:'"xyz"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.REPLACE,functionType:t.FunctionType.Text,description:"formula.functionList.REPLACE.description",abstract:"formula.functionList.REPLACE.abstract",functionParameter:[{name:"formula.functionList.REPLACE.functionParameter.oldText.name",detail:"formula.functionList.REPLACE.functionParameter.oldText.detail",example:'"Univer"',require:1,repeat:0},{name:"formula.functionList.REPLACE.functionParameter.startNum.name",detail:"formula.functionList.REPLACE.functionParameter.startNum.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.REPLACE.functionParameter.numChars.name",detail:"formula.functionList.REPLACE.functionParameter.numChars.detail",example:"0",require:1,repeat:0},{name:"formula.functionList.REPLACE.functionParameter.newText.name",detail:"formula.functionList.REPLACE.functionParameter.newText.detail",example:'"Hello "',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.REPLACEB,functionType:t.FunctionType.Text,description:"formula.functionList.REPLACEB.description",abstract:"formula.functionList.REPLACEB.abstract",functionParameter:[{name:"formula.functionList.REPLACEB.functionParameter.oldText.name",detail:"formula.functionList.REPLACEB.functionParameter.oldText.detail",example:'"Univer"',require:1,repeat:0},{name:"formula.functionList.REPLACEB.functionParameter.startNum.name",detail:"formula.functionList.REPLACEB.functionParameter.startNum.detail",example:"1",require:1,repeat:0},{name:"formula.functionList.REPLACEB.functionParameter.numBytes.name",detail:"formula.functionList.REPLACEB.functionParameter.numBytes.detail",example:"0",require:1,repeat:0},{name:"formula.functionList.REPLACEB.functionParameter.newText.name",detail:"formula.functionList.REPLACEB.functionParameter.newText.detail",example:'"Hello "',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.REPT,functionType:t.FunctionType.Text,description:"formula.functionList.REPT.description",abstract:"formula.functionList.REPT.abstract",functionParameter:[{name:"formula.functionList.REPT.functionParameter.text.name",detail:"formula.functionList.REPT.functionParameter.text.detail",example:'"*-"',require:1,repeat:0},{name:"formula.functionList.REPT.functionParameter.numberTimes.name",detail:"formula.functionList.REPT.functionParameter.numberTimes.detail",example:"3",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.RIGHT,functionType:t.FunctionType.Text,description:"formula.functionList.RIGHT.description",abstract:"formula.functionList.RIGHT.abstract",functionParameter:[{name:"formula.functionList.RIGHT.functionParameter.text.name",detail:"formula.functionList.RIGHT.functionParameter.text.detail",example:'"Univer"',require:1,repeat:0},{name:"formula.functionList.RIGHT.functionParameter.numChars.name",detail:"formula.functionList.RIGHT.functionParameter.numChars.detail",example:"3",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.RIGHTB,functionType:t.FunctionType.Text,description:"formula.functionList.RIGHTB.description",abstract:"formula.functionList.RIGHTB.abstract",functionParameter:[{name:"formula.functionList.RIGHTB.functionParameter.text.name",detail:"formula.functionList.RIGHTB.functionParameter.text.detail",example:'"Univer"',require:1,repeat:0},{name:"formula.functionList.RIGHTB.functionParameter.numBytes.name",detail:"formula.functionList.RIGHTB.functionParameter.numBytes.detail",example:"3",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.SEARCH,functionType:t.FunctionType.Text,description:"formula.functionList.SEARCH.description",abstract:"formula.functionList.SEARCH.abstract",functionParameter:[{name:"formula.functionList.SEARCH.functionParameter.findText.name",detail:"formula.functionList.SEARCH.functionParameter.findText.detail",example:'"univer"',require:1,repeat:0},{name:"formula.functionList.SEARCH.functionParameter.withinText.name",detail:"formula.functionList.SEARCH.functionParameter.withinText.detail",example:'"Hello Univer"',require:1,repeat:0},{name:"formula.functionList.SEARCH.functionParameter.startNum.name",detail:"formula.functionList.SEARCH.functionParameter.startNum.detail",example:"1",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.SEARCHB,functionType:t.FunctionType.Text,description:"formula.functionList.SEARCHB.description",abstract:"formula.functionList.SEARCHB.abstract",functionParameter:[{name:"formula.functionList.SEARCHB.functionParameter.findText.name",detail:"formula.functionList.SEARCHB.functionParameter.findText.detail",example:'"univer"',require:1,repeat:0},{name:"formula.functionList.SEARCHB.functionParameter.withinText.name",detail:"formula.functionList.SEARCHB.functionParameter.withinText.detail",example:'"Hello Univer"',require:1,repeat:0},{name:"formula.functionList.SEARCHB.functionParameter.startNum.name",detail:"formula.functionList.SEARCHB.functionParameter.startNum.detail",example:"1",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.SUBSTITUTE,functionType:t.FunctionType.Text,description:"formula.functionList.SUBSTITUTE.description",abstract:"formula.functionList.SUBSTITUTE.abstract",functionParameter:[{name:"formula.functionList.SUBSTITUTE.functionParameter.text.name",detail:"formula.functionList.SUBSTITUTE.functionParameter.text.detail",example:'"Hello Univer"',require:1,repeat:0},{name:"formula.functionList.SUBSTITUTE.functionParameter.oldText.name",detail:"formula.functionList.SUBSTITUTE.functionParameter.oldText.detail",example:'"Hello"',require:1,repeat:0},{name:"formula.functionList.SUBSTITUTE.functionParameter.newText.name",detail:"formula.functionList.SUBSTITUTE.functionParameter.newText.detail",example:'"Hi"',require:1,repeat:0},{name:"formula.functionList.SUBSTITUTE.functionParameter.instanceNum.name",detail:"formula.functionList.SUBSTITUTE.functionParameter.instanceNum.detail",example:"1",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.T,functionType:t.FunctionType.Text,description:"formula.functionList.T.description",abstract:"formula.functionList.T.abstract",functionParameter:[{name:"formula.functionList.T.functionParameter.value.name",detail:"formula.functionList.T.functionParameter.value.detail",example:'"Univer"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.TEXT,functionType:t.FunctionType.Text,description:"formula.functionList.TEXT.description",abstract:"formula.functionList.TEXT.abstract",functionParameter:[{name:"formula.functionList.TEXT.functionParameter.value.name",detail:"formula.functionList.TEXT.functionParameter.value.detail",example:"1.23",require:1,repeat:0},{name:"formula.functionList.TEXT.functionParameter.formatText.name",detail:"formula.functionList.TEXT.functionParameter.formatText.detail",example:'"$0.00"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.TEXTAFTER,functionType:t.FunctionType.Text,description:"formula.functionList.TEXTAFTER.description",abstract:"formula.functionList.TEXTAFTER.abstract",functionParameter:[{name:"formula.functionList.TEXTAFTER.functionParameter.text.name",detail:"formula.functionList.TEXTAFTER.functionParameter.text.detail",example:'"Red riding hood’s, red hood"',require:1,repeat:0},{name:"formula.functionList.TEXTAFTER.functionParameter.delimiter.name",detail:"formula.functionList.TEXTAFTER.functionParameter.delimiter.detail",example:'"hood"',require:1,repeat:0},{name:"formula.functionList.TEXTAFTER.functionParameter.instanceNum.name",detail:"formula.functionList.TEXTAFTER.functionParameter.instanceNum.detail",example:"1",require:0,repeat:0},{name:"formula.functionList.TEXTAFTER.functionParameter.matchMode.name",detail:"formula.functionList.TEXTAFTER.functionParameter.matchMode.detail",example:"1",require:0,repeat:0},{name:"formula.functionList.TEXTAFTER.functionParameter.matchEnd.name",detail:"formula.functionList.TEXTAFTER.functionParameter.matchEnd.detail",example:"0",require:0,repeat:0},{name:"formula.functionList.TEXTAFTER.functionParameter.ifNotFound.name",detail:"formula.functionList.TEXTAFTER.functionParameter.ifNotFound.detail",example:'"not found"',require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.TEXTBEFORE,functionType:t.FunctionType.Text,description:"formula.functionList.TEXTBEFORE.description",abstract:"formula.functionList.TEXTBEFORE.abstract",functionParameter:[{name:"formula.functionList.TEXTBEFORE.functionParameter.text.name",detail:"formula.functionList.TEXTBEFORE.functionParameter.text.detail",example:'"Red riding hood’s, red hood"',require:1,repeat:0},{name:"formula.functionList.TEXTBEFORE.functionParameter.delimiter.name",detail:"formula.functionList.TEXTBEFORE.functionParameter.delimiter.detail",example:'"hood"',require:1,repeat:0},{name:"formula.functionList.TEXTBEFORE.functionParameter.instanceNum.name",detail:"formula.functionList.TEXTBEFORE.functionParameter.instanceNum.detail",example:"1",require:0,repeat:0},{name:"formula.functionList.TEXTBEFORE.functionParameter.matchMode.name",detail:"formula.functionList.TEXTBEFORE.functionParameter.matchMode.detail",example:"1",require:0,repeat:0},{name:"formula.functionList.TEXTBEFORE.functionParameter.matchEnd.name",detail:"formula.functionList.TEXTBEFORE.functionParameter.matchEnd.detail",example:"0",require:0,repeat:0},{name:"formula.functionList.TEXTBEFORE.functionParameter.ifNotFound.name",detail:"formula.functionList.TEXTBEFORE.functionParameter.ifNotFound.detail",example:'"not found"',require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.TEXTJOIN,functionType:t.FunctionType.Text,description:"formula.functionList.TEXTJOIN.description",abstract:"formula.functionList.TEXTJOIN.abstract",functionParameter:[{name:"formula.functionList.TEXTJOIN.functionParameter.delimiter.name",detail:"formula.functionList.TEXTJOIN.functionParameter.delimiter.detail",example:'", "',require:1,repeat:0},{name:"formula.functionList.TEXTJOIN.functionParameter.ignoreEmpty.name",detail:"formula.functionList.TEXTJOIN.functionParameter.ignoreEmpty.detail",example:"true",require:1,repeat:0},{name:"formula.functionList.TEXTJOIN.functionParameter.text1.name",detail:"formula.functionList.TEXTJOIN.functionParameter.text1.detail",example:'"Hi"',require:1,repeat:0},{name:"formula.functionList.TEXTJOIN.functionParameter.text2.name",detail:"formula.functionList.TEXTJOIN.functionParameter.text2.detail",example:'"Univer"',require:0,repeat:1}]},{functionName:t.FUNCTION_NAMES_TEXT.TEXTSPLIT,functionType:t.FunctionType.Text,description:"formula.functionList.TEXTSPLIT.description",abstract:"formula.functionList.TEXTSPLIT.abstract",functionParameter:[{name:"formula.functionList.TEXTSPLIT.functionParameter.text.name",detail:"formula.functionList.TEXTSPLIT.functionParameter.text.detail",example:"A1:C2",require:1,repeat:0},{name:"formula.functionList.TEXTSPLIT.functionParameter.colDelimiter.name",detail:"formula.functionList.TEXTSPLIT.functionParameter.colDelimiter.detail",example:'","',require:1,repeat:0},{name:"formula.functionList.TEXTSPLIT.functionParameter.rowDelimiter.name",detail:"formula.functionList.TEXTSPLIT.functionParameter.rowDelimiter.detail",example:'";"',require:0,repeat:0},{name:"formula.functionList.TEXTSPLIT.functionParameter.ignoreEmpty.name",detail:"formula.functionList.TEXTSPLIT.functionParameter.ignoreEmpty.detail",example:"",require:0,repeat:0},{name:"formula.functionList.TEXTSPLIT.functionParameter.matchMode.name",detail:"formula.functionList.TEXTSPLIT.functionParameter.matchMode.detail",example:"",require:0,repeat:0},{name:"formula.functionList.TEXTSPLIT.functionParameter.padWith.name",detail:"formula.functionList.TEXTSPLIT.functionParameter.padWith.detail",example:"",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.TRIM,functionType:t.FunctionType.Text,description:"formula.functionList.TRIM.description",abstract:"formula.functionList.TRIM.abstract",functionParameter:[{name:"formula.functionList.TRIM.functionParameter.text.name",detail:"formula.functionList.TRIM.functionParameter.text.detail",example:'" Hello Univer "',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.UNICHAR,functionType:t.FunctionType.Text,description:"formula.functionList.UNICHAR.description",abstract:"formula.functionList.UNICHAR.abstract",functionParameter:[{name:"formula.functionList.UNICHAR.functionParameter.number.name",detail:"formula.functionList.UNICHAR.functionParameter.number.detail",example:"65",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.UNICODE,functionType:t.FunctionType.Text,description:"formula.functionList.UNICODE.description",abstract:"formula.functionList.UNICODE.abstract",functionParameter:[{name:"formula.functionList.UNICODE.functionParameter.text.name",detail:"formula.functionList.UNICODE.functionParameter.text.detail",example:'"Univer"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.UPPER,functionType:t.FunctionType.Text,description:"formula.functionList.UPPER.description",abstract:"formula.functionList.UPPER.abstract",functionParameter:[{name:"formula.functionList.UPPER.functionParameter.text.name",detail:"formula.functionList.UPPER.functionParameter.text.detail",example:'"Univer"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.VALUE,functionType:t.FunctionType.Text,description:"formula.functionList.VALUE.description",abstract:"formula.functionList.VALUE.abstract",functionParameter:[{name:"formula.functionList.VALUE.functionParameter.text.name",detail:"formula.functionList.VALUE.functionParameter.text.detail",example:'"123"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.VALUETOTEXT,functionType:t.FunctionType.Text,description:"formula.functionList.VALUETOTEXT.description",abstract:"formula.functionList.VALUETOTEXT.abstract",functionParameter:[{name:"formula.functionList.VALUETOTEXT.functionParameter.value.name",detail:"formula.functionList.VALUETOTEXT.functionParameter.value.detail",example:'"Univer"',require:1,repeat:0},{name:"formula.functionList.VALUETOTEXT.functionParameter.format.name",detail:"formula.functionList.VALUETOTEXT.functionParameter.format.detail",example:"1",require:0,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.CALL,functionType:t.FunctionType.Text,description:"formula.functionList.CALL.description",abstract:"formula.functionList.CALL.abstract",functionParameter:[{name:"formula.functionList.CALL.functionParameter.number1.name",detail:"formula.functionList.CALL.functionParameter.number1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.CALL.functionParameter.number2.name",detail:"formula.functionList.CALL.functionParameter.number2.detail",example:"A1:A20",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.EUROCONVERT,functionType:t.FunctionType.Text,description:"formula.functionList.EUROCONVERT.description",abstract:"formula.functionList.EUROCONVERT.abstract",functionParameter:[{name:"formula.functionList.EUROCONVERT.functionParameter.number1.name",detail:"formula.functionList.EUROCONVERT.functionParameter.number1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.EUROCONVERT.functionParameter.number2.name",detail:"formula.functionList.EUROCONVERT.functionParameter.number2.detail",example:"A1:A20",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_TEXT.REGISTER_ID,functionType:t.FunctionType.Text,description:"formula.functionList.REGISTER_ID.description",abstract:"formula.functionList.REGISTER_ID.abstract",functionParameter:[{name:"formula.functionList.REGISTER_ID.functionParameter.number1.name",detail:"formula.functionList.REGISTER_ID.functionParameter.number1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.REGISTER_ID.functionParameter.number2.name",detail:"formula.functionList.REGISTER_ID.functionParameter.number2.detail",example:"A1:A20",require:1,repeat:0}]}],ea=[],aa=[{functionName:t.FUNCTION_NAMES_WEB.ENCODEURL,functionType:t.FunctionType.Web,description:"formula.functionList.ENCODEURL.description",abstract:"formula.functionList.ENCODEURL.abstract",functionParameter:[{name:"formula.functionList.ENCODEURL.functionParameter.text.name",detail:"formula.functionList.ENCODEURL.functionParameter.text.detail",example:'"https://univer.ai/"',require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_WEB.FILTERXML,functionType:t.FunctionType.Web,description:"formula.functionList.FILTERXML.description",abstract:"formula.functionList.FILTERXML.abstract",functionParameter:[{name:"formula.functionList.FILTERXML.functionParameter.number1.name",detail:"formula.functionList.FILTERXML.functionParameter.number1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.FILTERXML.functionParameter.number2.name",detail:"formula.functionList.FILTERXML.functionParameter.number2.detail",example:"A1:A20",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_WEB.WEBSERVICE,functionType:t.FunctionType.Web,description:"formula.functionList.WEBSERVICE.description",abstract:"formula.functionList.WEBSERVICE.abstract",functionParameter:[{name:"formula.functionList.WEBSERVICE.functionParameter.number1.name",detail:"formula.functionList.WEBSERVICE.functionParameter.number1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.WEBSERVICE.functionParameter.number2.name",detail:"formula.functionList.WEBSERVICE.functionParameter.number2.detail",example:"A1:A20",require:1,repeat:0}]}],na=[...Qe,...Ke,...Ze,...Je,...ze,...ge,...ta,...$e,...je,...ke,...We,...Xe,...aa,...Ye,...ea];function ia(r,e){let a="";return r.aliasFunctionName?(a=e.t(r.aliasFunctionName),a===r.aliasFunctionName&&(a=r.functionName)):a=r.functionName,a}var ra=Object.getOwnPropertyDescriptor,oa=(r,e,a,n)=>{for(var i=n>1?void 0:n?ra(e,a):e,o=r.length-1,u;o>=0;o--)(u=r[o])&&(i=u(i)||i);return i},Ot=(r,e)=>(a,n)=>e(a,n,r);const at=c.createIdentifier("formula.description-service");P.DescriptionService=class{constructor(e,a,n){F(this,"_descriptions",[]);this._functionService=e,this._localeService=a,this._configService=n,this._initialize()}dispose(){this._localeService.localeChanged$.complete()}getDescriptions(){return this._functionService.getDescriptions()}hasFunction(e){return this._functionService.getDescriptions().get(e.toLocaleUpperCase())!==void 0}getFunctionInfo(e){return this._functionService.getDescriptions().get(e.toLocaleUpperCase())}getSearchListByName(e){const a=[],n=this._functionService.getDescriptions(),i=e.toLocaleUpperCase().trim();return n.forEach(o=>{const{functionName:u,abstract:f,functionType:m}=o;u.toLocaleUpperCase().indexOf(i)>-1&&m!==t.FunctionType.DefinedName&&a.push({name:u,desc:f})}),a}getSearchListByNameFirstLetter(e){const a=[],n=this._functionService.getDescriptions(),i=e.toLocaleUpperCase().trim();return n.forEach(o=>{const{functionName:u,abstract:f,functionType:m}=o;u.toLocaleUpperCase().indexOf(i)===0&&a.push({name:u,desc:f,functionType:m})}),a}getSearchListByType(e){const a=[];return this._functionService.getDescriptions().forEach(i=>{const{functionName:o,functionType:u,abstract:f}=i;(u===e||e===-1)&&u!==t.FunctionType.DefinedName&&a.push({name:o,desc:f})}),a}registerDescriptions(e){return this._descriptions=this._descriptions.concat(e),this._registerDescriptions(),c.toDisposable(()=>{const a=e.map(n=>n.functionName);this.unregisterDescriptions(a)})}unregisterDescriptions(e){this._descriptions=this._descriptions.filter(a=>!e.includes(a.functionName)),this._functionService.unregisterDescriptions(...e)}hasDescription(e){return this._descriptions.some(a=>a.functionName===e)}hasDefinedNameDescription(e){return this._descriptions.some(a=>a.functionName===e&&a.functionType===t.FunctionType.DefinedName)}isFormulaDefinedName(e){const a=this._descriptions.filter(i=>i.functionName===e&&i.functionType===t.FunctionType.DefinedName);if(a.length===0)return!1;const n=a[0].description;return!t.isReferenceStrings(n)}_initialize(){this._localeService.localeChanged$.subscribe(()=>{this._registerDescriptions()}),this._initDescription(),this._registerDescriptions()}_initDescription(){var i;const e=[...t.functionArray,...t.functionCompatibility,...t.functionCube,...t.functionDatabase,...t.functionDate,...t.functionEngineering,...t.functionFinancial,...t.functionInformation,...t.functionLogical,...t.functionLookup,...t.functionMath,...t.functionMeta,...t.functionStatistical,...t.functionText,...t.functionUniver,...t.functionWeb].map(o=>o[1]),a=na.filter(o=>e.includes(o.functionName)),n=this._configService.getConfig($);this._descriptions=a.concat((i=n==null?void 0:n.description)!=null?i:[])}_registerDescriptions(){const e=this._localeService,a=this._descriptions.map(n=>({functionName:ia(n,e),functionType:n.functionType,description:e.t(n.description),abstract:e.t(n.abstract),functionParameter:n.functionParameter.map(i=>({name:e.t(i.name),detail:e.t(i.detail),example:i.example,require:i.require,repeat:i.repeat}))}));this._functionService.registerDescriptions(...a)}},P.DescriptionService=oa([Ot(0,t.IFunctionService),Ot(1,c.Inject(c.LocaleService)),Ot(2,c.IConfigService)],P.DescriptionService);var ua=Object.getOwnPropertyDescriptor,ca=(r,e,a,n)=>{for(var i=n>1?void 0:n?ua(e,a):e,o=r.length-1,u;o>=0;o--)(u=r[o])&&(i=u(i)||i);return i},ct=(r,e)=>(a,n)=>e(a,n,r);let ft=class extends c.Disposable{constructor(e,a,n,i){super();F(this,"_preUnitId",null);this._descriptionService=e,this._definedNamesService=a,this._univerInstanceService=n,this._commandService=i,this._initialize()}_initialize(){this._descriptionListener(),this._changeUnitListener(),this._changeSheetListener()}_descriptionListener(){c.toDisposable(this._definedNamesService.update$.subscribe(()=>{this._registerDescriptions()}))}_changeUnitListener(){c.toDisposable(this._univerInstanceService.getCurrentTypeOfUnit$(c.UniverInstanceType.UNIVER_SHEET).subscribe(()=>{this._unRegisterDescriptions(),this._registerDescriptions()}))}_changeSheetListener(){this.disposeWithMe(this._commandService.onCommandExecuted((e,a)=>{if(!(a!=null&&a.fromCollab)){if(e.id===s.SetWorksheetActiveOperation.id)this._unregisterDescriptionsForNotInSheetId(),this._registerDescriptions();else if(e.id===t.SetDefinedNameMutation.id){const n=e.params;this._registerDescription(n)}else if(e.id===t.RemoveDefinedNameMutation.id){const n=e.params;this._unregisterDescription(n)}}}))}_registerDescription(e){const{unitId:a,sheetId:n}=this._getUnitIdAndSheetId();if(a==null||n==null)return;const{name:i,comment:o,formulaOrRefString:u,localSheetId:f}=e;!this._descriptionService.hasDescription(i)&&(f==null||f===s.SCOPE_WORKBOOK_VALUE_DEFINED_NAME||f===n)&&this._descriptionService.registerDescriptions([{functionName:i,description:u+(o||""),abstract:u,functionType:t.FunctionType.DefinedName,functionParameter:[]}])}_unregisterDescription(e){const{name:a}=e;this._descriptionService.unregisterDescriptions([a])}_unRegisterDescriptions(){if(this._preUnitId==null)return;const e=this._definedNamesService.getDefinedNameMap(this._preUnitId);if(e==null)return;const a=[];Array.from(Object.values(e)).forEach(n=>{const{name:i}=n;a.push(i)}),this._descriptionService.unregisterDescriptions(a),this._preUnitId=null}_getUnitIdAndSheetId(){const e=this._univerInstanceService.getCurrentUnitForType(c.UniverInstanceType.UNIVER_SHEET);if(e==null)return{};const a=e.getActiveSheet();return a==null?{}:{unitId:e.getUnitId(),sheetId:a.getSheetId()}}_registerDescriptions(){const{unitId:e,sheetId:a}=this._getUnitIdAndSheetId();if(e==null||a==null)return;const n=this._definedNamesService.getDefinedNameMap(e);if(!n)return;const i=[];this._preUnitId=e,Array.from(Object.values(n)).forEach(o=>{const{name:u,comment:f,formulaOrRefString:m,localSheetId:l}=o;!this._descriptionService.hasDescription(u)&&(l==null||l===s.SCOPE_WORKBOOK_VALUE_DEFINED_NAME||l===a)&&i.push({functionName:u,description:m+(f||""),abstract:m,functionType:t.FunctionType.DefinedName,functionParameter:[]})}),this._descriptionService.registerDescriptions(i)}_unregisterDescriptionsForNotInSheetId(){const{unitId:e,sheetId:a}=this._getUnitIdAndSheetId();if(e==null||a==null)return;const n=this._definedNamesService.getDefinedNameMap(e);if(!n)return;const i=[];Array.from(Object.values(n)).forEach(o=>{const{name:u,localSheetId:f}=o;f!==s.SCOPE_WORKBOOK_VALUE_DEFINED_NAME&&f!==a&&i.push(u)}),this._descriptionService.unregisterDescriptions(i)}};ft=ca([ct(0,at),ct(1,t.IDefinedNamesService),ct(2,c.IUniverInstanceService),ct(3,c.ICommandService)],ft);var fa=Object.getOwnPropertyDescriptor,ma=(r,e,a,n)=>{for(var i=n>1?void 0:n?fa(e,a):e,o=r.length-1,u;o>=0;o--)(u=r[o])&&(i=u(i)||i);return i},sa=(r,e)=>(a,n)=>e(a,n,r);let mt=class extends c.Disposable{constructor(r){super(),this._commandService=r,[yt,xt,t.OtherFormulaMarkDirty].forEach(e=>this._commandService.registerCommand(e))}};mt=ma([sa(0,c.ICommandService)],mt);var la=Object.getOwnPropertyDescriptor,pa=(r,e,a,n)=>{for(var i=n>1?void 0:n?la(e,a):e,o=r.length-1,u;o>=0;o--)(u=r[o])&&(i=u(i)||i);return i},st=(r,e)=>(a,n)=>e(a,n,r);let lt=class extends c.Disposable{constructor(e,a,n,i){super();F(this,"_preUnitId",null);this._descriptionService=e,this._univerInstanceService=a,this._commandService=n,this._superTableService=i,this._initialize()}_initialize(){this._descriptionListener(),this._changeUnitListener(),this._changeSheetListener()}_descriptionListener(){c.toDisposable(this._superTableService.update$.subscribe(()=>{this._registerDescriptions()}))}_changeUnitListener(){c.toDisposable(this._univerInstanceService.getCurrentTypeOfUnit$(c.UniverInstanceType.UNIVER_SHEET).subscribe(()=>{this._unRegisterDescriptions(),this._registerDescriptions()}))}_changeSheetListener(){this.disposeWithMe(this._commandService.onCommandExecuted((e,a)=>{if(!(a!=null&&a.fromCollab)){if(e.id===s.SetWorksheetActiveOperation.id)this._unregisterDescriptionsForNotInSheetId(),this._registerDescriptions();else if(e.id===t.SetSuperTableMutation.id){const n=e.params;this._registerDescription(n)}else if(e.id===t.RemoveSuperTableMutation.id){const n=e.params;this._unregisterDescription(n)}}}))}_registerDescription(e){var u,f;const{unitId:a,sheetId:n}=this._getUnitIdAndSheetId();if(a==null||n==null)return;const{tableName:i,reference:o}=e;if(!this._descriptionService.hasDescription(i)){const m=((f=(u=this._univerInstanceService.getUnit(a))==null?void 0:u.getSheetBySheetId(o.sheetId))==null?void 0:f.getName())||"",l=t.serializeRangeWithSheet(m,o.range);this._descriptionService.registerDescriptions([{functionName:i,description:l,abstract:l,functionType:t.FunctionType.Table,functionParameter:[]}])}}_unregisterDescription(e){const{tableName:a}=e;this._descriptionService.unregisterDescriptions([a])}_unRegisterDescriptions(){if(this._preUnitId==null)return;const e=this._superTableService.getTableMap(this._preUnitId);if(e==null)return;const a=[];e.forEach((n,i)=>{a.push(i)}),this._descriptionService.unregisterDescriptions(a),this._preUnitId=null}_getUnitIdAndSheetId(){const e=this._univerInstanceService.getCurrentUnitForType(c.UniverInstanceType.UNIVER_SHEET);if(e==null)return{};const a=e.getActiveSheet();return a==null?{}:{unitId:e.getUnitId(),sheetId:a.getSheetId()}}_registerDescriptions(){const{unitId:e,sheetId:a}=this._getUnitIdAndSheetId();if(e==null||a==null)return;const n=this._superTableService.getTableMap(e);if(!n)return;const i=[];this._preUnitId=e,n.forEach((o,u)=>{var l,p;const f=((p=(l=this._univerInstanceService.getUnit(e))==null?void 0:l.getSheetBySheetId(o.sheetId))==null?void 0:p.getName())||"",m=t.serializeRangeWithSheet(f,o.range);this._descriptionService.hasDescription(u)||i.push({functionName:u,description:m,abstract:m,functionType:t.FunctionType.Table,functionParameter:[]})}),this._descriptionService.registerDescriptions(i)}_unregisterDescriptionsForNotInSheetId(){const{unitId:e,sheetId:a}=this._getUnitIdAndSheetId();if(e==null||a==null)return;const n=this._superTableService.getTableMap(e);if(!n)return;const i=[];n.forEach((o,u)=>{i.push(u)}),this._descriptionService.unregisterDescriptions(i)}};lt=pa([st(0,at),st(1,c.IUniverInstanceService),st(2,c.ICommandService),st(3,t.ISuperTableService)],lt);var da=Object.getOwnPropertyDescriptor,La=(r,e,a,n)=>{for(var i=n>1?void 0:n?da(e,a):e,o=r.length-1,u;o>=0;o--)(u=r[o])&&(i=u(i)||i);return i},pt=(r,e)=>(a,n)=>e(a,n,r);function Ht(r,e,a,n){const i=r.sequenceNodesBuilder(e);if(i==null)return e;const o=[];for(let u=0,f=i.length;u<f;u++){const m=i[u];if(typeof m=="string"||m.nodeType!==t.sequenceNodeType.REFERENCE)continue;const{token:l}=m,p=t.deserializeRangeWithSheetWithCache(l),{sheetName:L,unitId:N}=p;let T=p.range;T.startAbsoluteRefType===c.AbsoluteRefType.ALL&&T.endAbsoluteRefType===c.AbsoluteRefType.ALL||(T=c.moveRangeByOffset(T,a,n),o.push({unitId:N,sheetName:L,range:T}))}return o.map(u=>`${u.unitId}!${u.sheetName}!${u.range.startRow}!${u.range.endRow}!${u.range.startColumn}!${u.range.endColumn}`).join("|")}P.FormulaRefRangeService=class extends c.Disposable{constructor(e,a,n,i){super(),this._refRangeService=e,this._lexerTreeBuilder=a,this._univerInstanceService=n,this._injector=i}transformFormulaByEffectCommand(e,a,n,i){const o=this._lexerTreeBuilder.sequenceNodesBuilder(n),u=this._univerInstanceService.getCurrentUnitForType(c.UniverInstanceType.UNIVER_SHEET),f=u.getActiveSheet(),m=u.getUnitId(),l=f.getSheetId(),p=o==null?void 0:o.map(L=>{if(typeof L=="object"&&L.nodeType===t.sequenceNodeType.REFERENCE){const N=t.deserializeRangeWithSheetWithCache(L.token),{range:T,unitId:S,sheetName:R}=N,C=this._univerInstanceService.getUnit(S||e),d=R?C==null?void 0:C.getSheetBySheetName(R):C==null?void 0:C.getSheetBySheetId(a);if(!d)throw new Error("Sheet not found");const A=C.getUnitId(),E=d.getSheetId();if(A!==m||E!==l)return L;const I=s.handleDefaultRangeChangeWithEffectRefCommands(T,i);let O="";if(I){const D=I.startColumn-T.startColumn,U=I.startRow-T.startRow,_=c.moveRangeByOffset(T,D,U);S&&R?O=t.serializeRangeWithSpreadsheet(S,R,_):R?O=t.serializeRangeWithSheet(R,_):O=t.serializeRange(_)}else O=t.ErrorType.REF;return{...L,token:O}}else return L});return p?`=${t.generateStringWithSequence(p)}`:""}registerFormula(e,a,n,i){const o=new Map,u=this._lexerTreeBuilder.sequenceNodesBuilder(n),f=new c.DisposableCollection,m=l=>{const p=this._univerInstanceService.getCurrentUnitForType(c.UniverInstanceType.UNIVER_SHEET),L=p.getActiveSheet(),N=p.getUnitId(),T=L.getSheetId(),S=u==null?void 0:u.map(C=>{if(typeof C=="object"&&C.nodeType===t.sequenceNodeType.REFERENCE){const d=o.get(C.token);if(d.unitId!==N||d.subUnitId!==T)return C;const A=s.handleDefaultRangeChangeWithEffectRefCommands(d.range,l);let E="";if(A){const I=A.startColumn-d.range.startColumn,O=A.startRow-d.range.startRow,D=c.moveRangeByOffset(d.range,I,O);d.unitId&&d.sheetName?E=t.serializeRangeWithSpreadsheet(d.unitId,d.sheetName,D):d.sheetName?E=t.serializeRangeWithSheet(d.sheetName,D):E=t.serializeRange(D)}else E=t.ErrorType.REF;return{...C,token:E}}else return C}),R=S&&t.generateStringWithSequence(S);return i(`=${R}`)};return u==null||u.forEach(l=>{if(typeof l=="object"&&l.nodeType===t.sequenceNodeType.REFERENCE){const p=t.deserializeRangeWithSheetWithCache(l.token),{range:L,unitId:N,sheetName:T}=p,S=this._univerInstanceService.getUnit(N||e),R=T?S==null?void 0:S.getSheetBySheetName(T):S==null?void 0:S.getSheetBySheetId(a);if(!R)return;const C=S.getUnitId(),d=R.getSheetId(),A={unitId:C,subUnitId:d,range:L,sheetName:T};o.set(l.token,A),f.add(this._refRangeService.registerRefRange(L,m,C,d))}}),f}_getFormulaDependcy(e,a,n,i){const o=c.isFormulaString(n)?this._lexerTreeBuilder.sequenceNodesBuilder(n):null,u=[];return o==null||o.forEach(f=>{if(typeof f=="object"&&f.nodeType===t.sequenceNodeType.REFERENCE){const m=t.deserializeRangeWithSheetWithCache(f.token),{range:l,unitId:p,sheetName:L}=m;if(l.startAbsoluteRefType===c.AbsoluteRefType.ALL&&l.endAbsoluteRefType===c.AbsoluteRefType.ALL)return;const N=this._univerInstanceService.getUnit(p||e),T=L?N==null?void 0:N.getSheetBySheetName(L):N==null?void 0:N.getSheetBySheetId(a);if(!T)return;const S=N.getUnitId(),R=T.getSheetId(),C=i[0].startRow,d=i[0].startColumn,A=l.startRow,E=l.startColumn,I=i.map(O=>({startRow:O.startRow-C+A,endRow:O.endRow-C+A,startColumn:O.startColumn-d+E,endColumn:O.endColumn-d+E}));u.push({unitId:S,subUnitId:R,ranges:I})}}),u}registerRangeFormula(e,a,n,i,o){const u=new c.DisposableCollection,f=i.map(l=>this._getFormulaDependcy(e,a,l,n)),m=l=>{const p=n[0].startRow,L=n[0].startColumn,N=[{unitId:e,subUnitId:a,ranges:n},...f.flat()],T=[],S=s.getSeparateEffectedRangesOnCommand(this._injector,l);for(const{unitId:R,subUnitId:C,ranges:d}of N)if(R===S.unitId&&C===S.subUnitId){const A=[],E=d[0].startRow,I=d[0].startColumn,O=E-p,D=I-L;for(const U of S.ranges){const _=d.map(x=>c.getIntersectRange(U,x)).filter(Boolean);_.length>0&&A.push(..._)}A.length>0&&T.push(A.map(U=>({startRow:U.startRow-O,endRow:U.endRow-O,startColumn:U.startColumn-D,endColumn:U.endColumn-D})))}if(T.length>0){const R=c.Rectangle.splitIntoGrid([...T.flat()]),C=c.Rectangle.subtractMulti(n,R);C.sort((O,D)=>O.startRow-D.startRow||O.startColumn-D.startColumn);const d=new Map;for(let O=0;O<R.length;O++){const D=R[O],U=D.startRow,_=D.startColumn,x=U-p,y=_-L,q=s.handleCommonDefaultRangeChangeWithEffectRefCommands(D,l).sort((V,H)=>V.startRow-H.startRow||V.startColumn-H.startColumn);if(!q.length)continue;const h=q[0].startRow,M=q[0].startColumn,B=h-p,K=M-L,k=[];for(let V=0;V<i.length;V++){const H=i[V],w=c.isFormulaString(H),Nt=w?this._lexerTreeBuilder.moveFormulaRefOffset(H,y,x):H,G=w?this.transformFormulaByEffectCommand(e,a,Nt,l):Nt,Dt=Ht(this._lexerTreeBuilder,G,-K,-B);k.push({newFormula:G,orginFormula:Dt})}const Q={formulas:k,ranges:q,key:k.map(V=>V.orginFormula).join("_")};d.has(Q.key)?d.get(Q.key).push(Q):d.set(Q.key,[Q])}const A=i.map(O=>Ht(this._lexerTreeBuilder,O,0,0)).join("_");if(C.length>0){const O=C[0].startRow,D=C[0].startColumn,U=[];for(let x=0;x<i.length;x++){const y=i[x];U.push({newFormula:c.isFormulaString(y)?this._lexerTreeBuilder.moveFormulaRefOffset(y,D-L,O-p):y,orginFormula:y})}const _={formulas:U,ranges:C,key:A};d.has(_.key)?d.get(_.key).push(_):d.set(_.key,[_])}const E=[],I=Array.from(d.keys());for(let O=I.length-1;O>=0;O--){const D=I[O],U=d.get(D).sort((y,q)=>y.ranges[0].startRow-q.ranges[0].startRow||y.ranges[0].startColumn-q.ranges[0].startColumn),_=[];for(let y=0;y<U[0].formulas.length;y++)_.push(U[0].formulas[y].newFormula);const x=c.Rectangle.mergeRanges(U.map(y=>y.ranges).flat());x.sort((y,q)=>y.startRow-q.startRow||y.startColumn-q.startColumn),E.push({formulas:_,ranges:x})}return o(E)}return{undos:[],redos:[]}};return n.forEach(l=>{const p=this._refRangeService.registerRefRange(l,m,e,a);u.add(p)}),[...f.flat()].forEach(({unitId:l,subUnitId:p,ranges:L})=>{L.forEach(N=>{const T=this._refRangeService.registerRefRange(N,m,l,p);u.add(T)})}),u}},P.FormulaRefRangeService=La([pt(0,c.Inject(s.RefRangeService)),pt(1,c.Inject(t.LexerTreeBuilder)),pt(2,c.IUniverInstanceService),pt(3,c.Inject(c.Injector))],P.FormulaRefRangeService);var Ta=Object.getOwnPropertyDescriptor,Na=(r,e,a,n)=>{for(var i=n>1?void 0:n?Ta(e,a):e,o=r.length-1,u;o>=0;o--)(u=r[o])&&(i=u(i)||i);return i},Pa=(r,e)=>(a,n)=>e(a,n,r);const Mt="sheets-formula.remote-register-function.service",_t=c.createIdentifier(Mt);P.RemoteRegisterFunctionService=class{constructor(e){this._functionService=e}async registerFunctions(e){const a=e.map(([n,i])=>Ea(n,i));this._functionService.registerExecutors(...a)}async registerAsyncFunctions(e){const a=e.map(([n,i])=>Ia(n,i));this._functionService.registerExecutors(...a)}async unregisterFunctions(e){this._functionService.unregisterExecutors(...e),this._functionService.unregisterDescriptions(...e),this._functionService.deleteFormulaAstCacheKey(...e)}},P.RemoteRegisterFunctionService=Na([Pa(0,t.IFunctionService)],P.RemoteRegisterFunctionService);function Ea(r,e){const a=new t.CustomFunction(e),n=new Function(`return ${r}`)();return a.calculateCustom=n,a}function Ia(r,e){const a=new t.AsyncCustomFunction(e),n=new Function(`return ${r}`)();return a.calculateCustom=n,a}var Aa=Object.getOwnPropertyDescriptor,Sa=(r,e,a,n)=>{for(var i=n>1?void 0:n?Aa(e,a):e,o=r.length-1,u;o>=0;o--)(u=r[o])&&(i=u(i)||i);return i},dt=(r,e)=>(a,n)=>e(a,n,r);const wt=c.createIdentifier("sheets-formula.register-function-service");P.RegisterFunctionService=class extends c.Disposable{constructor(e,a,n,i){super(),this._localeService=e,this._descriptionService=a,this._functionService=n,this._remoteRegisterFunctionService=i}registerFunction(e){return this._registerSingleFunction(e)}registerAsyncFunction(e){return this._registerSingleFunction({...e,async:!0})}registerFunctions(e){const{locales:a,description:n,calculate:i}=e;a&&this._localeService.load(a);const o=new c.DisposableCollection;if(n)o.add(this._descriptionService.registerDescriptions(n));else{const u=i.map(([f,m,l])=>({functionName:m,functionType:t.FunctionType.User,description:"",abstract:l||"",functionParameter:[]}));o.add(this._functionService.registerDescriptions(...u))}return o.add(this._registerLocalExecutors(i)),this._remoteRegisterFunctionService&&o.add(this._registerRemoteExecutors(i)),o}_registerSingleFunction(e){const{name:a,func:n,description:i,locales:o,async:u=!1}=e,f=new c.DisposableCollection;if(o&&this._localeService.load(o),typeof i=="string"){const l={functionName:a,functionType:t.FunctionType.User,description:i,abstract:i||"",functionParameter:[]};f.add(this._descriptionService.registerDescriptions([l]))}else f.add(this._descriptionService.registerDescriptions([i]));const m=u?new t.AsyncCustomFunction(a):new t.CustomFunction(a);return m.calculateCustom=n,this._functionService.registerExecutors(m),f.add(c.toDisposable(()=>this._functionService.unregisterExecutors(a))),f.add(c.toDisposable(()=>this._functionService.unregisterDescriptions(a))),f.add(c.toDisposable(()=>this._functionService.deleteFormulaAstCacheKey(a))),this._remoteRegisterFunctionService&&(this._remoteRegisterFunctionService.registerAsyncFunctions([[n.toString(),a]]),f.add(c.toDisposable(()=>this._remoteRegisterFunctionService.unregisterFunctions([a])))),f}_registerLocalExecutors(e){const a=e.map(([i,o])=>o),n=e.map(([i,o])=>{const u=new t.CustomFunction(o);return u.calculateCustom=i,u});return this._functionService.registerExecutors(...n),c.toDisposable(()=>this._functionService.unregisterExecutors(...a))}_registerRemoteExecutors(e){const a=[],n=e.map(([i,o])=>(a.push(o),[i.toString(),o]));return this._remoteRegisterFunctionService.registerFunctions(n),c.toDisposable(()=>this._remoteRegisterFunctionService.unregisterFunctions(a))}},P.RegisterFunctionService=Sa([dt(0,c.Inject(c.LocaleService)),dt(1,c.Inject(at)),dt(2,t.IFunctionService),dt(3,c.Optional(_t))],P.RegisterFunctionService);var Ca=Object.defineProperty,Ra=Object.getOwnPropertyDescriptor,Oa=(r,e,a)=>e in r?Ca(r,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):r[e]=a,Yt=(r,e,a,n)=>{for(var i=n>1?void 0:n?Ra(e,a):e,o=r.length-1,u;o>=0;o--)(u=r[o])&&(i=u(i)||i);return i},Lt=(r,e)=>(a,n)=>e(a,n,r),Tt=(r,e,a)=>Oa(r,typeof e!="symbol"?e+"":e,a);P.UniverRemoteSheetsFormulaPlugin=class extends c.Plugin{constructor(e=qt,a,n){super(),this._config=e,this._injector=a,this._configService=n;const{...i}=c.merge({},qt,this._config);this._configService.setConfig(Xt,i)}onStarting(){this._injector.add([P.RemoteRegisterFunctionService]),this._injector.get(it.IRPCChannelService).registerChannel(Mt,it.fromModule(this._injector.get(P.RemoteRegisterFunctionService)))}},Tt(P.UniverRemoteSheetsFormulaPlugin,"pluginName","SHEET_FORMULA_REMOTE_PLUGIN"),Tt(P.UniverRemoteSheetsFormulaPlugin,"type",c.UniverInstanceType.UNIVER_SHEET),P.UniverRemoteSheetsFormulaPlugin=Yt([c.DependentOn(t.UniverFormulaEnginePlugin),Lt(1,c.Inject(c.Injector)),Lt(2,c.IConfigService)],P.UniverRemoteSheetsFormulaPlugin),P.UniverSheetsFormulaPlugin=class extends c.Plugin{constructor(e=Ut,a,n){super(),this._config=e,this._injector=a,this._configService=n;const{...i}=c.merge({},Ut,this._config);this._configService.setConfig($,i,{merge:!0})}onStarting(){const e=this._injector,a=[[wt,{useClass:P.RegisterFunctionService}],[at,{useClass:P.DescriptionService}],[mt],[P.FormulaRefRangeService],[ut],[P.ImageFormulaCellInterceptorController],[P.TriggerCalculationController],[P.UpdateFormulaController],[ot],[ft],[P.UpdateDefinedNameController],[lt]];if(this._config.notExecuteFormula){const n=e.get(it.IRPCChannelService);a.push([_t,{useFactory:()=>it.toModule(n.requestChannel(Mt))}])}a.forEach(n=>e.add(n))}onReady(){c.touchDependencies(this._injector,[[mt],[ot],[ut],[P.ImageFormulaCellInterceptorController],[P.UpdateFormulaController],[P.UpdateDefinedNameController]]),c.isNodeEnv()&&c.touchDependencies(this._injector,[[P.TriggerCalculationController]])}onRendered(){c.touchDependencies(this._injector,[[ft],[lt]]),c.isNodeEnv()||c.touchDependencies(this._injector,[[P.TriggerCalculationController]])}},Tt(P.UniverSheetsFormulaPlugin,"pluginName",ve),Tt(P.UniverSheetsFormulaPlugin,"type",c.UniverInstanceType.UNIVER_SHEET),P.UniverSheetsFormulaPlugin=Yt([c.DependentOn(s.UniverSheetsPlugin),Lt(1,c.Inject(c.Injector)),Lt(2,c.IConfigService)],P.UniverSheetsFormulaPlugin);function Ma(r,e,a,n){const i=r.get(t.IFormulaCurrentConfigService),o=r.get(t.Lexer),u=r.get(t.AstTreeBuilder),f=r.get(t.Interpreter);i.load({formulaData:{},arrayFormulaCellData:{},arrayFormulaRange:{},forceCalculate:!1,dirtyRanges:[],dirtyNameMap:{},dirtyDefinedNameMap:{},dirtyUnitFeatureMap:{},excludedCell:{},allUnitData:{[a]:n},dirtyUnitOtherFormulaMap:{}});const m=o.treeBuilder(e),l=u.parse(m),p=f.execute(t.generateExecuteAstNodeData(l));return t.getObjectValue(p)}P.CalculationMode=Y,P.IDescriptionService=at,P.IRegisterFunctionService=wt,P.IRemoteRegisterFunctionService=_t,P.InsertFunctionCommand=yt,P.PLUGIN_CONFIG_KEY_BASE=$,P.QuickSumCommand=xt,P.calculateFormula=Ma,Object.defineProperty(P,Symbol.toStringTag,{value:"Module"})}));
|
|
49
49
|
|
|
50
50
|
|
|
51
51
|
// @univerjs/sheets-formula/facade
|