@univerjs/preset-sheets-node-core 0.12.0 → 0.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/umd/index.js +5 -5
  2. 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,J,kt,$i){"use strict";var Wd=Object.defineProperty;var Vd=(g,i,O)=>i in g?Wd(g,i,{enumerable:!0,configurable:!0,writable:!0,value:O}):g[i]=O;var f=(g,i,O)=>Vd(g,typeof i!="symbol"?i+"":i,O);function Li(s,e,t){var r,a,u;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 Bi(n)?i.isTextFormat((a=n==null?void 0:n.n)==null?void 0:a.pattern)?i.CellValueType.STRING:eo(e,t):i.isTextFormat((u=o==null?void 0:o.n)==null?void 0:u.pattern)?i.CellValueType.STRING:eo(e,t)}function eo(s,e){return s.v!==void 0?Vn(s.v,s.t):Vn(e.v,e.t)}function Bi(s){var e;return!!((e=s==null?void 0:s.n)!=null&&e.pattern)}function Vn(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,u=e.ranges;for(let l=0;l<u.length;l++)a.push(u[l]);return o.getSpanModel().rebuild(a),!0}},Hi=i.createInterceptorKey("CELL_CONTENT"),Fi=i.createInterceptorKey("ROW_FILTERED"),Ae={CELL_CONTENT:Hi,ROW_FILTERED:Fi};var to=(s=>(s[s.DATA_VALIDATION=9]="DATA_VALIDATION",s[s.NUMFMT=10]="NUMFMT",s[s.CELL_IMAGE=11]="CELL_IMAGE",s))(to||{});const no="sheet.interceptor.range-theme-id",so="sheet.interceptor.ignore-range-theme";var ji=Object.getOwnPropertyDescriptor,Gi=(s,e,t,n)=>{for(var o=n>1?void 0:n?ji(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},zi=(s,e)=>(t,n)=>e(t,n,s);const $n=i.createInterceptorKey("BEFORE_CELL_EDIT"),Zt=i.createInterceptorKey("AFTER_CELL_EDIT"),Qt=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:$n,AFTER_CELL_EDIT:Zt,VALIDATE_CELL:Qt}));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(Ae.CELL_CONTENT,{priority:-1,effect:i.InterceptorEffectEnum.Style|i.InterceptorEffectEnum.Value,handler:n=>n}),this.disposeWithMe(this.writeCellInterceptor.intercept(Zt,{priority:-1,handler:n=>n})),this.disposeWithMe(this.writeCellInterceptor.intercept($n,{priority:-1,handler:n=>n})),this.disposeWithMe(this.writeCellInterceptor.intercept(Qt,{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 u={subUnitId:n.getSheetId(),unitId:t.getUnitId(),workbook:t,worksheet:n,row:o,col:r,origin:i.Tools.deepClone(a)};return this.writeCellInterceptor.fetchThroughInterceptors(Zt)(a,u)}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(Qt)(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((u,l)=>{var d,c;return((d=l.priority)!=null?d:0)-((c=u.priority)!=null?c:0)});if(this._interceptorsDirty=!0,o===Ae.CELL_CONTENT){const u=i.InterceptorEffectEnum.Style|i.InterceptorEffectEnum.Value;this._interceptorsByName.set(`${o}-${u}`,a);const l=i.InterceptorEffectEnum.Style|i.InterceptorEffectEnum.Value;return this._interceptorsByName.set(`${o}-${i.InterceptorEffectEnum.Style}`,a.filter(d=>((d.effect||l)&i.InterceptorEffectEnum.Style)>0)),this._interceptorsByName.set(`${o}-${i.InterceptorEffectEnum.Value}`,a.filter(d=>((d.effect||l)&i.InterceptorEffectEnum.Value)>0)),this.disposeWithMe(i.toDisposable(()=>{i.remove(this._interceptorsByName.get(o),n),i.remove(this._interceptorsByName.get(`${o}-${u}`),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}`,u=o!=null?o:a;let l=this._composedInterceptorByKey.get(u);if(!l||this._interceptorsDirty){let d=this._interceptorsByName.get(a);d&&r&&(d=d.filter(r)),l=i.composeInterceptors(d||[]),this._composedInterceptorByKey.set(u,l)}return l}_interceptWorkbook(t){const n=new i.DisposableCollection,o=t.getUnitId(),r=this,a=u=>{const l=u.getSheetId();u.__interceptViewModel(d=>{const c=new i.DisposableCollection;r._worksheetDisposables.set(oo(o,u),c),c.add(d.registerCellContentInterceptor({getCell(m,h,R,C,S){const I=u.getCellRaw(m,h);return r.fetchThroughInterceptors(Ae.CELL_CONTENT,R,C,S)(I,{unitId:o,subUnitId:l,row:m,col:h,worksheet:u,workbook:t,rawData:I})}})),c.add(d.registerRowFilteredInterceptor({getRowFiltered(m){return!!r.fetchThroughInterceptors(Ae.ROW_FILTERED)(!1,{unitId:o,subUnitId:l,row:m,workbook:t,worksheet:u})}}))})};t.getSheets().forEach(u=>a(u)),n.add(t.sheetCreated$.subscribe(u=>a(u))),n.add(i.toDisposable(()=>t.getSheets().forEach(u=>this._disposeSheetInterceptor(o,u)))),n.add(t.sheetDisposed$.subscribe(u=>this._disposeSheetInterceptor(o,u))),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=oo(t,n),r=this._worksheetDisposables.get(o);r&&(r.dispose(),this._worksheetDisposables.delete(o))}},g.SheetInterceptorService=Gi([zi(0,i.IUniverInstanceService)],g.SheetInterceptorService);function oo(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 qi(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 x={wholeStyle:1,headerRowStyle:2,headerColumnStyle:4,firstRowStyle:8,secondRowStyle:16,lastRowStyle:32,firstColumnStyle:128,secondColumnStyle:256,lastColumnStyle:512};class We{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|x.lastRowStyle),o&&(a=a|x.lastColumnStyle),e>=0&&t>=0&&(a=a|x.wholeStyle),e%2===1&&(a=a|(r?x.secondRowStyle:x.firstRowStyle)),e%2===0&&(a=a|(r?x.firstRowStyle:x.secondRowStyle)),e===0&&(a=a|x.headerRowStyle),t===0&&(a=a|x.headerColumnStyle),t%2===1&&(a=a|x.firstColumnStyle),t%2===0&&(a=a|x.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&x.wholeStyle&&t.push(this.wholeStyle),this.firstColumnStyle&&e&x.firstColumnStyle&&t.push(this.firstColumnStyle),this.secondColumnStyle&&e&x.secondColumnStyle&&t.push(this.secondColumnStyle),this.firstRowStyle&&e&x.firstRowStyle&&t.push(this.firstRowStyle),this.secondRowStyle&&e&x.secondRowStyle&&t.push(this.secondRowStyle),this.headerColumnStyle&&e&x.headerColumnStyle&&t.push(this.headerColumnStyle),this.lastColumnStyle&&e&x.lastColumnStyle&&t.push(this.lastColumnStyle),this.headerRowStyle&&e&x.headerRowStyle&&t.push(this.headerRowStyle),this.lastRowStyle&&e&x.lastRowStyle&&t.push(this.lastRowStyle),qi(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 Yi=(s,e,t)=>new We(`light-${s}`,{headerRowStyle:{bg:{rgb:e}},firstColumnStyle:{bg:{rgb:"rgb(255, 255, 255)"}},secondColumnStyle:{bg:{rgb:t}},lastRowStyle:{bg:{rgb:e}}}),Ki=(s,e,t)=>new We(`middle-${s}`,{headerRowStyle:{bg:{rgb:e}},headerColumnStyle:{bg:{rgb:t}},secondRowStyle:{bg:{rgb:t}},lastRowStyle:{bg:{rgb:e}},lastColumnStyle:{bg:{rgb:t}}}),Ji=(s,e,t,n)=>new We(`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}}}),xi=[{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)"}],Xi=[{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)"}],Zi=[{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)"}],Qi=xi.map(({baseName:s,header:e,color:t})=>Yi(s,e,t)),ea=Xi.map(({baseName:s,rowHeader:e,colHeader:t})=>Ki(s,e,t)),ta=Zi.map(({baseName:s,rowHeader:e,firstRow:t,secondRow:n})=>Ji(s,e,t,n)),na=[...Qi,...ea,...ta],ro={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)"}}},sa=new We("default",ro),oa=new We("default-last-row",{...ro,lastRowStyle:{bd:{t:{s:i.BorderStyleTypes.THIN,cl:{rgb:"rgb(68,114,196)"}}},ht:i.HorizontalAlign.CENTER,bl:i.BooleanNumber.TRUE}});class ra{constructor(){f(this,"_toggleRanges",[])}refresh(e,t){const{startRow:n,endRow:o}=e,r=[];let a=0,u=!1,l=-1;for(let d=n;d<=o;d++){if(!t(d)){a++,a%2===1?u=!0:(u=!1,l!==-1&&(r.push([l,d-1]),l=-1));continue}a%2===1?u?l===-1&&(l=d):(u=!0,l=d):u&&(r.push([l,d-2]),u=!1,l=-1),d===o&&u&&r.push([l,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 ia=Object.getOwnPropertyDescriptor,aa=(s,e,t,n)=>{for(var o=n>1?void 0:n?ia(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},Ln=(s,e)=>(t,n)=>e(t,n,s);const ua="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(sa),this.registerDefaultRangeTheme(oa);for(const t of na)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 u=a.getRowCount(),l=a.getRowManager();for(let d=1;d<=u;d++)a.getRowVisible(d)?l.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 ra),a.get(o)}registerRangeThemeRule(t,n){const{unitId:o,subUnitId:r,range:a}=n,u=i.generateRandomId(),l=this._ensureRangeThemeStyleRuleMap(o),d=this._ensureRTreeCollection(o);l.set(u,{rangeInfo:n,themeName:t}),d.insert({unitId:o,sheetId:r,range:a,id:u}),this._getSheetRowVisibleHasInit(o,r)||this.refreshSheetRowVisibleFuncSet(o,r);const c=this._ensureZebraCrossingCache(o,r,u),m=this._getSheetRowVisibleFuncSet(o,r);c.refresh(a,h=>!m.has(h))}getRegisteredRangeThemeStyle(t){const{unitId:n,subUnitId:o,range:r}=t,a=this._ensureRTreeCollection(n),u=Array.from(a.bulkSearch([{unitId:n,sheetId:o,range:r}]));if(u[0]){const d=this._ensureRangeThemeStyleRuleMap(n).get(u[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,u)=>{const d=this._ensureRangeThemeStyleRuleMap(t).get(u);d?a.refresh(d.rangeInfo.range,c=>!this._getSheetRowVisibleFuncSet(t,n).has(c)):r.delete(u)})}removeRangeThemeRule(t,n){const{unitId:o,subUnitId:r,range:a}=n,u=this._ensureRTreeCollection(o),l=Array.from(u.bulkSearch([{unitId:o,sheetId:r,range:a}])),d=this._ensureRangeThemeStyleRuleMap(o);for(let c=0;c<l.length;c++){const m=d.get(l[c]);if(m&&m.themeName===t){d.delete(l[c]),u.remove({unitId:o,sheetId:r,range:a,id:l[c]});const h=this._zebraCrossingCacheMap.get(o);if(h){const R=h.get(r);R&&R.delete(l[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},u=this._ensureRTreeCollection(t),l=Array.from(u.bulkSearch([{unitId:t,sheetId:n,range:a}]));if(l[0]){const c=this._ensureRangeThemeStyleRuleMap(t).get(l[0]);if(c){const{rangeInfo:m,themeName:h}=c,R=o-m.range.startRow,C=r-m.range.startColumn,S=this.getRangeThemeStyle(t,h),v=this._ensureZebraCrossingCache(t,n,l[0]).getIsToggled(o);if(S)return S.getStyle(R,C,o===m.range.endRow,r===m.range.endColumn,v)}}}_registerIntercept(){this.disposeWithMe(this._sheetInterceptorService.intercept(Ae.CELL_CONTENT,{id:no,effect:i.InterceptorEffectEnum.Style,handler:(t,n,o)=>{const{row:r,col:a,unitId:u,subUnitId:l}=n,d=this.getCellStyle(u,l,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((u,l)=>{r[l]=u});const a={};return o.forEach((u,l)=>{a[l]=u.toJson()}),JSON.stringify({rangeThemeStyleRuleMap:r,rangeThemeStyleMapJson:a})}fromJSON(t,n){const{rangeThemeStyleRuleMap:o,rangeThemeStyleMapJson:r}=n;o&&Object.keys(o).forEach(a=>{const u=o[a],{themeName:l,rangeInfo:d}=u;l.startsWith("table")||(this.registerRangeThemeRule(l,d),this._ensureRTreeCollection(d.unitId).insert({unitId:a,sheetId:d.subUnitId,range:d.range,id:a}))}),r&&Object.keys(r).forEach(a=>{const u=r[a],l=new We(u.name);l.fromJson(u),this._ensureRangeThemeStyleMap(t).set(l.getName(),l)})}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:ua,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=aa([Ln(0,i.Inject(g.SheetInterceptorService)),Ln(1,i.Inject(i.IResourceManagerService)),Ln(2,i.Inject(i.IUniverInstanceService))],g.SheetRangeThemeModel);function Bn(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 ve(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 rt={id:"sheet.mutation.set-worksheet-range-theme-style",type:i.CommandType.MUTATION,handler:(s,e)=>{const{unitId:t,subUnitId:n,range:o,themeName:r}=e,a=s.get(i.IUniverInstanceService),u=P(a),l=s.get(g.SheetRangeThemeModel);return u?(l.registerRangeThemeRule(r,{range:o,unitId:t,subUnitId:n}),!0):!1}},io=(s,e)=>{const t=ve(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}},it={id:"sheet.mutation.remove-worksheet-range-theme-style",type:i.CommandType.MUTATION,handler:(s,e)=>{const{unitId:t,subUnitId:n,range:o,themeName:r}=e,a=s.get(i.IUniverInstanceService),u=P(a),l=s.get(g.SheetRangeThemeModel);return u?(l.removeRangeThemeRule(r,{range:o,unitId:t,subUnitId:n}),!0):!1}},ao=(s,e)=>{const t=ve(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}},en=(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,u=s.get(i.IUniverInstanceService).getUniverSheetInstance(t);if(u==null)throw new Error("universheet is null error!");const l=u.getSheetBySheetId(n);if(l==null)throw new Error("worksheet is null error!");const d=l.getRowManager().getRowData(),c={h:l.getConfig().defaultRowHeight,hd:0},m=o.startRow,h=o.endRow-o.startRow+1;for(let S=m;S<m+h;S++)r?i.insertMatrixArray(S,(C=r[S-o.startRow])!=null?C:c,d):i.insertMatrixArray(S,c,d);return l.setRowCount(l.getRowCount()+h),l.getCellMatrix().insertRows(o.startRow,h),!0}},Nt=(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:u}=e,d=r.getColumnData(),c=a.startColumn,m=a.endColumn-a.startColumn+1,h=o.getConfig().defaultColumnWidth;for(let S=c;S<c+m;S++){const I={w:h,hd:0};u?i.insertMatrixArray(S,(C=u[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,m),!0}},Le={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),u=r.getSheetBySheetId(e.to.subUnitId);if(!a||!u)return!1;const l=a.getCellMatrix(),d=u.getCellMatrix();return new i.ObjectMatrix(t.value).forValue((c,m,h)=>{h==null?l.realDeleteValue(c,m):l.setValue(c,m,h)}),new i.ObjectMatrix(n.value).forValue((c,m,h)=>{h==null?d.realDeleteValue(c,m):d.setValue(c,m,h)}),!0}};function uo(s,e){const{unitId:t,subUnitId:n,sourceRange:o,targetRange:r}=e,a=o.startRow>r.startRow,u=o.endRow-o.startRow+1;return a?{unitId:t,subUnitId:n,sourceRange:i.Rectangle.clone(r),targetRange:{...o,endRow:o.endRow+u,startRow:o.startRow+u}}:{unitId:t,subUnitId:n,targetRange:i.Rectangle.clone(o),sourceRange:{...r,endRow:r.endRow-u,startRow:r.startRow-u}}}const pe={id:"sheet.mutation.move-rows",type:i.CommandType.MUTATION,handler:(s,e)=>{const{unitId:t,subUnitId:n,sourceRange:o,targetRange:r}=e,u=s.get(i.IUniverInstanceService).getUniverSheetInstance(t);if(!u)throw new Error("[MoveRowMutation] univerSheet is null!");const l=u.getSheetBySheetId(n);if(!l)throw new Error("[MoveRowMutation] worksheet is null!");const d=o.startRow,c=o.endRow-o.startRow+1,m=r.startRow,h=l.getRowManager().getRowData();return i.moveMatrixArray(d,c,m,h),l.getCellMatrix().moveRows(d,c,m),!0}};function lo(s,e){const{unitId:t,subUnitId:n,sourceRange:o,targetRange:r}=e,a=o.startColumn>r.startColumn,u=o.endColumn-o.startColumn+1;return a?{unitId:t,subUnitId:n,sourceRange:i.Rectangle.clone(r),targetRange:{...o,endColumn:o.endColumn+u,startColumn:o.startColumn+u}}:{unitId:t,subUnitId:n,targetRange:i.Rectangle.clone(o),sourceRange:{...r,startColumn:r.startColumn-u,endColumn:r.endColumn-u}}}const we={id:"sheet.mutation.move-columns",type:i.CommandType.MUTATION,handler:(s,e)=>{const{unitId:t,subUnitId:n,sourceRange:o,targetRange:r}=e,u=s.get(i.IUniverInstanceService).getUniverSheetInstance(t);if(!u)throw new Error("[MoveColumnMutation] univerSheet is null!");const l=u.getSheetBySheetId(n);if(!l)throw new Error("[MoveColumnMutation] worksheet is null!");const d=o.startColumn,c=o.endColumn-o.startColumn+1,m=r.startColumn,h=l.getColumnManager().getColumnData();return i.moveMatrixArray(d,c,m,h),l.getCellMatrix().moveColumns(d,c,m),!0}},la=(s,e)=>{const o=e.getRowManager().getRowData(),r={},a=s.range,u=i.sliceMatrixArray(a.startRow,a.endRow,o),l=i.concatMatrixArray(r,u);return{unitId:s.unitId,subUnitId:s.subUnitId,range:s.range,rowInfo:l}},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,u=o.getRowManager().getRowData();for(let c=r.startRow;c<=r.endRow;c++)o.getRowFiltered(c);const l=r.endRow-r.startRow+1;return i.spliceArray(r.startRow,l,u),o.getCellMatrix().removeRows(r.startRow,l),o.setRowCount(o.getRowCount()-l),!0}},da=(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 u=o.getColumnManager().getColumnData(),l={},d=e.range,c=i.sliceMatrixArray(d.startColumn,d.endColumn,u),m=i.concatMatrixArray(l,c);return{unitId:e.unitId,subUnitId:e.subUnitId,range:e.range,colInfo:m}},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,u=o.getColumnManager().getColumnData(),l=r.endColumn-r.startColumn+1;return i.spliceArray(r.startColumn,l,u),o.setColumnCount(o.getColumnCount()-l),o.getCellMatrix().removeColumns(r.startColumn,l),!0}},ue=(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,u=e.ranges,l=[];for(let d=0;d<u.length;d++)for(let c=a.length-1;c>=0;c--){const m=a[c],h=u[d];i.Rectangle.intersects(m,h)&&l.push(a[c])}return{unitId:e.unitId,subUnitId:e.subUnitId,ranges:l}},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,u=e.ranges;for(let l=0;l<u.length;l++)for(let d=a.length-1;d>=0;d--){const c=a[d],m=u[l];i.Rectangle.intersects(c,m)&&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}},Ot={id:"sheet.mutation.reorder-range",type:i.CommandType.MUTATION,handler:(s,e)=>{const{subUnitId:t,unitId:n,range:o,order:r}=e,l=s.get(i.IUniverInstanceService).getUnit(n).getSheetBySheetId(t);if(!l)return!1;const d=new i.ObjectMatrix;i.Range.foreach(o,(m,h)=>{if(r.hasOwnProperty(m)){const R=r[m],C=i.Tools.deepClone(l.getCellRaw(R,h));d.setValue(m,h,C)}});const c=l.getCellMatrix();return d.forValue((m,h,R)=>{c.setValue(m,h,R)}),!0}};function ca(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 ma(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 mo=(s,e)=>{const{unitId:t,subUnitId:n,columnData:o}=s,r={},a=e.getColumnManager();for(const u in o){const l=o[u],d=a.getColumn(Number(u));r[u]=ma(d,l)}return{unitId:t,subUnitId:n,columnData:r}},at={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 u in t){const l=t[u];if(l==null){a.removeColumn(Number(u));continue}const d=a.getColumnOrCreate(Number(u));Object.assign(d,l)}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}},ut={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 u=a.startColumn;u<a.endColumn+1;u++){const l=o.getColumnOrCreate(u);l!=null&&(l.hd=i.BooleanNumber.TRUE)}}return!0}},ga=(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}},lt={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 u=a.startColumn;u<a.endColumn+1;u++){const l=o.getColumnOrCreate(u);l!=null&&(l.hd=i.BooleanNumber.FALSE)}}return!0}},dt={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 Ra(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=tn(n,t.s?t.s:null);o&&(i.Tools.removeNull(o),Object.entries(o).forEach(([u,l])=>{typeof l=="object"&&l!==null&&Object.keys(l).length===0&&delete o[u]})),i.Tools.isEmptyObject(o)?delete e.s:e.s=s.setValue(o);const r=t.v?`${t.v}\r
11
- `:"";!t.p&&e.p&&(r&&r!==((a=e.p.body)==null?void 0:a.dataStream)?delete e.p:fa(e.p,t.s?t.s:null))}function Ca(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]=Sa(t[n]||{},e[n]):n in t||(t[n]=null);return t}function Sa(s,e){if(!e||!Object.keys(e).length)return s;for(const t in e)t in s||(s[t]=null);return s}function tn(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 ho(s,e){return s.some(t=>t.startIndex===e)?ho(s,e+1):e}function fa(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 u of s.body.textRuns){const{st:l,ed:d,ts:c={}}=u;if(t<l){const h={st:t,ed:l},R=tn({},e,!0);R&&i.Tools.removeNull(R),i.Tools.isEmptyObject(R)||(h.ts=R),n.push(h)}const m=tn(c,e,!0);m&&i.Tools.removeNull(m),i.Tools.isEmptyObject(m)?delete u.ts:u.ts=m,n.push(u),t=ho(o,d)}const r=s.body.dataStream.endsWith(`\r
12
- `)?s.body.dataStream.length-2:s.body.dataStream.length;if(t<r){const u={st:t,ed:r},l=tn({},e,!0);l&&i.Tools.removeNull(l),i.Tools.isEmptyObject(l)||(u.ts=l),n.push(u)}s.body.textRuns=i.normalizeTextRuns(n)}function go(s,e){return e.v===void 0||e.v===null?e.v:s===i.CellValueType.NUMBER?Number(e.v):s===i.CellValueType.BOOLEAN?Ia(e.v)?1:0:s===i.CellValueType.STRING||s===i.CellValueType.FORCE_STRING?`${e.v}`:e.v}function Ia(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 va(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 u=a.getSheetBySheetId(n);if(u==null)throw new Error("worksheet is null error!");const l=u.getCellMatrix(),d=a.getStyles(),c=new i.ObjectMatrix;return new i.ObjectMatrix(o).forValue((h,R,C)=>{const S=i.Tools.deepClone(l==null?void 0:l.getValue(h,R))||{},I=d.getStyleByCell(S),v=d.getStyleByCell(C);S.s=Ca(I,v),c.setValue(h,R,va(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 u=a.getSheetBySheetId(n);if(!u)return!1;const l=u.getCellMatrix(),d=a.getStyles();return new i.ObjectMatrix(t).forValue((m,h,R)=>{if(!R)l.realDeleteValue(m,h);else{let C=l.getValue(m,h)||{};C=wa(R,C,d),i.Tools.isEmptyObject(C)?l.realDeleteValue(m,h):l.setValue(m,h,C)}}),!0}},pa=new Set(["f","p","si","custom","ref","xf"]);function wa(s,e,t){const n=Li(t,s,e);return Object.keys(s).forEach(o=>{const r=o;if(pa.has(r)){const a=s[r];Ma(e,r,a)}else r==="v"?s.v!==void 0&&(e.v=go(n,s)):r==="s"&&Ra(t,e,s)}),e.v!==void 0&&(e.t=n,e.v=go(n,e)),e.v===null&&(delete e.t,delete e.v),e}function Ma(s,e,t){t===void 0||(t===null?delete s[e]:s[e]=t)}const Ro=(s,e)=>{const{unitId:t,subUnitId:n,rowData:o}=s,r={},a=e.getRowManager();for(const u in o){const l=o[u],d=a.getRow(Number(u));r[u]=ca(d,l)}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 u in t){const l=t[u];if(l==null){a.removeRow(Number(u));continue}const d=a.getRowOrCreate(Number(u));Object.assign(d,l)}return!0}},ya=(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}},Ye={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 u=a.startRow;u<a.endRow+1;u++){const l=o.getRowOrCreate(u);l!=null&&(l.hd=0)}}return!0}},_a=(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}},Ke={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 u=a.startRow;u<a.endRow+1;u++){const l=o.getRowOrCreate(u);l!=null&&(l.hd=1)}}return!0}},Hn=(s,e)=>{const{unitId:t,subUnitId:n,ranges:o}=s,r={},a=e.getColumnManager();for(let u=0;u<o.length;u++){const l=o[u];for(let d=l.startColumn;d<l.endColumn+1;d++)r[d]=a.getColumnWidth(d)}return{unitId:t,subUnitId:n,ranges:o,colWidth:r}},Ve={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 u=0;u<a.length;u++){const l=a[u];for(let d=l.startColumn;d<l.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}},Co=(s,e)=>{const t=ve(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()}},mt={id:"sheet.mutation.set-worksheet-column-count",type:i.CommandType.MUTATION,handler:(s,e)=>{const t=s.get(i.IUniverInstanceService),n=ve(t,e);return n?(n.worksheet.setColumnCount(e.columnCount),!0):!1}},ht={id:"sheet.mutation.set-worksheet-default-style",type:i.CommandType.MUTATION,handler:(s,e)=>{const{defaultStyle:t}=e,n=s.get(i.IUniverInstanceService),o=P(n);if(!o)return!1;const{worksheet:r}=o;return r?(r.setDefaultCellStyle(t),!0):!1}},So=(s,e)=>{const t=ve(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()}},fo=(s,e)=>{const t=ve(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()}},gt={id:"sheet.mutation.set-worksheet-row-count",type:i.CommandType.MUTATION,handler:(s,e)=>{const t=s.get(i.IUniverInstanceService),n=ve(t,e);return n?(n.worksheet.setRowCount(e.rowCount),!0):!1}},Io=(s,e)=>{var u,l;const{unitId:t,subUnitId:n,ranges:o}=s,r={},a=e.getRowManager();for(const{startRow:d,endRow:c}of o)for(let m=d;m<c+1;m++)r[m]=(l=(u=a.getRow(m))==null?void 0:u.h)!=null?l:e.getConfig().defaultRowHeight;return{unitId:t,subUnitId:n,ranges:o,rowHeight:r}},Fn=(s,e)=>{var u;const{unitId:t,subUnitId:n,ranges:o}=s,r={},a=e.getRowManager();for(const{startRow:l,endRow:d}of o)for(let c=l;c<=d;c++)r[c]=(u=a.getRow(c))==null?void 0:u.ia;return{unitId:t,subUnitId:n,ranges:o,autoHeightInfo:r}},ba=(s,e)=>{var u,l;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:(l=(u=a.getRow(c))==null?void 0:u.ah)!=null?l:e.getConfig().defaultRowHeight})}return{unitId:t,subUnitId:n,rowsAutoHeightInfo:r}},Ee={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,u=a.getRowManager();for(const{startRow:l,endRow:d}of t)for(let c=l;c<=d;c++)typeof n=="number"?u.setRowHeight(c,n):i.Tools.isDefine(n[c])&&u.setRowHeight(c,n[c]);return!0}},Re={id:"sheet.mutation.set-worksheet-row-is-auto-height",type:i.CommandType.MUTATION,handler:(s,e)=>{var u;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:l,endRow:d}of t)for(let c=l;c<=d;c++){const m=a.getRowOrCreate(c);typeof n=="number"?m.ia=n:m.ia=(u=n[c])!=null?u:void 0}return!0}},jn={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:u}of t){const l=r.getRowOrCreate(a);l.ah=u}return!0}},Rt={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}},Ct={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 vo=(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))(vo||{}),po=(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))(po||{});const Ea=[Ee.id,Re.id,jn.id,Ve.id,Ct.id,pe.id,we.id,ut.id,lt.id,Ke.id,Ye.id,ie.id,re.id,ne.id,ae.id,Rt.id,dt.id,gt.id,mt.id],Ta=[F.id,Le.id,G.id,j.id,Ot.id,ht.id,ct.id,at.id,rt.id,it.id];function Ua(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 Pa(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 wo(s){return s==null?!1:s.v!==void 0&&s.v!==null&&s.v!==""||s.p!==void 0}function nn(s,e){return s&&s.spanAnchor?wo(e.getValue(s.spanAnchor.startRow,s.spanAnchor.startColumn)):wo(s)}function ka(s,e,t,n,o){const r=s.getCellMatrix(),a=s.getSpanModel().getMergedCellRange(e,t,n,o),u=new i.ObjectMatrix;return r.forValue((l,d)=>{const c=r.getValue(l,d);c&&u.setValue(l,d,c)}),a.forEach(l=>{const{startColumn:d,startRow:c,endColumn:m,endRow:h}=l;i.createRowColIter(c,h,d,m).forEach((R,C)=>{R===c&&C===d&&u.setValue(R,C,{...r.getValue(R,C),spanAnchor:{startRow:c,endRow:h,startColumn:d,endColumn:m}}),(R!==c||C!==d)&&(u.realDeleteValue(R,C),u.setValue(R,C,{spanAnchor:{startRow:c,endRow:h,startColumn:d,endColumn:m}}))})}),u}function Na(s,e,t,n){const{startRow:o,startColumn:r,endRow:a}=s;let u=null,l=!1;for(let d=o;d<=a;d++){const c=e.getValue(d,r-t);if(l=l||nn(c,e),!n&&l)break;c&&c.spanAnchor&&(u?u={startRow:Math.min(c.spanAnchor.startRow,u.startRow),startColumn:Math.min(c.spanAnchor.startColumn,u.startColumn),endRow:Math.max(c.spanAnchor.endRow,u.endRow),endColumn:Math.max(c.spanAnchor.endColumn,u.endColumn)}:u={startRow:c.spanAnchor.startRow,startColumn:c.spanAnchor.startColumn,endRow:c.spanAnchor.endRow,endColumn:c.spanAnchor.endColumn})}return l?(s.startColumn=s.startColumn-t,{spanAnchor:u,hasValue:!0,range:s}):{spanAnchor:null,hasValue:!1,range:s}}function Oa(s,e,t,n){const{startRow:o,endColumn:r,endRow:a}=s;let u=null,l=!1;for(let d=o;d<=a;d++){const c=e.getValue(d,r+t);if(l=l||nn(c,e),!n&&l)break;c&&c.spanAnchor&&(u?u={startRow:Math.min(c.spanAnchor.startRow,u.startRow),startColumn:Math.min(c.spanAnchor.startColumn,u.startColumn),endRow:Math.max(c.spanAnchor.endRow,u.endRow),endColumn:Math.max(c.spanAnchor.endColumn,u.endColumn)}:u={startRow:c.spanAnchor.startRow,startColumn:c.spanAnchor.startColumn,endRow:c.spanAnchor.endRow,endColumn:c.spanAnchor.endColumn})}return l?(s.endColumn=s.endColumn+t,{spanAnchor:u,hasValue:!0,range:s}):{spanAnchor:null,hasValue:!1,range:s}}function Da(s,e,t,n){const{startRow:o,startColumn:r,endColumn:a}=s;let u=null,l=!1;for(let d=r;d<=a;d++){const c=e.getValue(o-t,d);if(l=l||nn(c,e),!n&&l)break;c&&c.spanAnchor&&(u?u={startRow:Math.min(c.spanAnchor.startRow,u.startRow),startColumn:Math.min(c.spanAnchor.startColumn,u.startColumn),endRow:Math.max(c.spanAnchor.endRow,u.endRow),endColumn:Math.max(c.spanAnchor.endColumn,u.endColumn)}:u={startRow:c.spanAnchor.startRow,startColumn:c.spanAnchor.startColumn,endRow:c.spanAnchor.endRow,endColumn:c.spanAnchor.endColumn})}return l?(s.startRow=s.startRow-t,{spanAnchor:u,hasValue:!0,range:s}):{spanAnchor:null,hasValue:!1,range:s}}function Aa(s,e,t,n){const{startColumn:o,endColumn:r,endRow:a}=s;let u=null,l=!1;for(let d=o;d<=r;d++){const c=e.getValue(a+t,d);if(l=l||nn(c,e),!n&&l)break;c&&c.spanAnchor&&(u?u={startRow:Math.min(c.spanAnchor.startRow,u.startRow),startColumn:Math.min(c.spanAnchor.startColumn,u.startColumn),endRow:Math.max(c.spanAnchor.endRow,u.endRow),endColumn:Math.max(c.spanAnchor.endColumn,u.endColumn)}:u={startRow:c.spanAnchor.startRow,startColumn:c.spanAnchor.startColumn,endRow:c.spanAnchor.endRow,endColumn:c.spanAnchor.endColumn})}return l?(s.endRow=s.endRow+t,{spanAnchor:u,hasValue:!0,range:s}):{spanAnchor:null,hasValue:!1,range:s}}function Wa(s,e,t){const n=t.getMaxRows(),o=t.getMaxColumns(),r=ka(t,0,0,n-1,o-1),a=t.getSnapshot().mergeData.length>0,{left:u,right:l,up:d,down:c}=e;let m=!0,h={...s};const R=[];for(;m;){if(m=!1,d&&h.startRow!==0){const{hasValue:C,range:S,spanAnchor:I}=Da(h,r,1,a);if(I&&R.push(I),C){h=S,m=!0;continue}}if(c&&h.endRow!==n-1){const{hasValue:C,range:S,spanAnchor:I}=Aa(h,r,1,a);if(I&&R.push(I),C){h=S,m=!0;continue}}if(u&&h.startColumn!==0){const{hasValue:C,range:S,spanAnchor:I}=Na(h,r,1,a);if(I&&R.push(I),C){h=S,m=!0;continue}}if(l&&h.endColumn!==o-1){const{hasValue:C,range:S,spanAnchor:I}=Oa(h,r,1,a);if(I&&R.push(I),C){h=S,m=!0;continue}}}return R.length>0&&(h=i.Rectangle.union(h,...R)),h}const Mo=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},yo=s=>{const e=s;return e.forValue((t,n)=>{const o=s.getValue(t-1,n);o&&e.setValue(t,n,o+1)}),e},_o=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,u=r;t(a*u,{startRow:n-u+1,endRow:n,startColumn:o,endColumn:o});const l={startRow:n-u+1,endRow:n,startColumn:0,endColumn:o};for(let d=o-1;d>=0&&s.getValue(n,d);d--){u=Math.min(s.getValue(n,d)||0,u),a++;const c=u*a;l.startColumn=d,l.startRow=n-u+1,t(c,l)}}),e},Va=(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},Gn=s=>{const e=[];let t=_o(s);for(;t.area>0;)t.range&&(e.push(t.range),Va(s,t.range)),t=_o(s);return e},zn=s=>{const e=Mo(s);return Gn(e)};class $a{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=yo(this._matrix);return Gn(e)}}const La=1.5,Ba="rgba(255, 255, 255, 0.01)";function Ha(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=bo(t)),o}function bo(s){const{actualRow:e,actualColumn:t,isMerged:n,isMergedMainCell:o}=s,{startRow:r,startColumn:a,endRow:u,endColumn:l}=s.mergeInfo;return{actualRow:e,actualColumn:t,isMerged:n,isMergedMainCell:o,startRow:r,startColumn:a,endRow:u,endColumn:l}}var Eo=(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))(Eo||{});class Fa{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 ja(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+=Ga(a);let r="[".concat(o,"]");return e&&(r+="+"),new RegExp(r)}function Ga(s){return s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const za=s=>{var t;return((t=s.body)==null?void 0:t.dataStream.replace(/\r\n$/,""))||""};function qa(s){if(s!=null){if(s.p)return za(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 To(s,e,t,n,o=!1){const r=i.Range.transformRange(e,s),{startColumn:a,startRow:u,endColumn:l,endRow:d}=r;if(a!==l)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,m=c?new Fa:null,h=[];for(let p=u;p<=d;p++){const w=s.getCell(p,a),y=qa(w);h.push(y),m&&m.update(y)}const R=c?m.getDelimiter():t,C=ja(R,o,n);let S=-1,I=0,v=0;const M=[];for(const p of h){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 Ya=(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)},{}),Ka=(s=0)=>{let e=s;return function(){return e++}};function Ja(s){return s==null?!1:s.v!==void 0&&s.v!==null&&s.v!==""||s.p!==void 0}function xa(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(Ja(o))return{startRow:t,startColumn:n,endRow:t,endColumn:n}}return null}function qn(s){const e=new i.ObjectMatrix;return s.forEach(t=>{const{startRow:n,startColumn:o,endRow:r,endColumn:a}=t;for(let u=n;u<=r;u++)for(let l=o;l<=a;l++)e.setValue(u,l,null)}),e.clone()}function Uo(s){const e=new i.ObjectMatrix;return s.forEach(t=>{const{startRow:n,startColumn:o,endRow:r,endColumn:a}=t;for(let u=n;u<=r;u++)for(let l=o;l<=a;l++)e.setValue(u,l,{v:null,p:null,f:null,si:null,custom:null})}),e.clone()}function Xa(s){const e=new i.ObjectMatrix;return s.forEach(t=>{const{startRow:n,startColumn:o,endRow:r,endColumn:a}=t;for(let u=n;u<=r;u++)for(let l=o;l<=a;l++)e.setValue(u,l,{s:null})}),e.clone()}function Po(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:u,endRow:l,startColumn:d,endColumn:c}=s,m=[],h=[];for(let R=u;R<=l;R++)a.getRowFiltered(R)||m.push(R);for(let R=d;R<=c;R++)h.push(R);return{rows:m,cols:h}}function Dt(s,e,t,n){const o=[],r=[];for(const h of s){const R=Po(h,e,t,n);R&&(o.push(...R.rows),r.push(...R.cols))}const a=Array.from(new Set(o)).sort((h,R)=>h-R),u=Array.from(new Set(r)).sort((h,R)=>h-R),l=[];function d(h){const R=[];let C=h[0];for(let S=1;S<h.length;S++)h[S]!==h[S-1]+1&&(R.push([C,h[S-1]]),C=h[S]);return R.push([C,h[h.length-1]]),R}const c=d(a),m=d(u);for(const[h,R]of c)for(const[C,S]of m)l.push({startRow:h,endRow:R,startColumn:C,endColumn:S});return l}var ko=(s=>(s.OthersCanView="othersCanView",s.NoOneElseCanView="noOneElseCanView",s))(ko||{}),No=(s=>(s.DesignedUserCanEdit="designedUserCanEdit",s.OnlyMe="onlyMe",s))(No||{});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,u,l;const o=(a=(r=this._model.get(e))==null?void 0:r.get(t))==null?void 0:a.get(n);o&&((l=(u=this._model.get(e))==null?void 0:u.get(t))==null||l.delete(n),this._ruleChange$.next({unitId:e,subUnitId:t,rule:o,type:"delete"}))}setRule(e,t,n,o){var a,u;const r=this.getRule(e,t,n);r&&((u=(a=this._model.get(e))==null?void 0:a.get(t))==null||u.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 u=o.get(a);e[n][a]=[...u.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 u=o[a].reduce((l,d)=>(l.set(d.id,d),l),new Map);r.set(a,u)}),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 Za=(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}}},Te={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}},Qa=s=>{const e={...s,ruleIds:s.rules.map(t=>t.id)};return{id:Te.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}},Oo={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:u,subUnitId:l,ranges:d,description:c,viewState:m,editState:h}=r,R=[{ranges:d,permissionId:a,id:o.createRuleId(u,l),description:c,unitType:r.unitType,unitId:u,subUnitId:l,viewState:m,editState:h}];if(await t.executeCommand(Ce.id,{unitId:u,subUnitId:l,rules:R})){const S=[{id:Ce.id,params:{unitId:u,subUnitId:l,rules:R}}],I=[{id:Te.id,params:{unitId:u,subUnitId:l,ruleIds:R.map(v=>v.id)}}];n.pushUndoRedo({unitID:u,redoMutations:S,undoMutations:I})}return!0}};var te=(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))(te||{});class Do 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 te.MOVE_START:this._selectionMoveStart$.next(n);break;case te.MOVING:this._selectionMoving$.next(n);break;case te.MOVE_END:this._beforeSelectionMoveEnd$.next(n),this._selectionMoveEnd$.next(n);break;case te.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 eu=Object.getOwnPropertyDescriptor,tu=(s,e,t,n)=>{for(var o=n>1?void 0:n?eu(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},nu=(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:u}=r;this._ensureWorkbookSelection(a).addSelections(u,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:te.ONLY_SET);return}const a=this._currentSelectionPos;if(!a)throw new Error("[SheetsSelectionsService]: cannot find current selection position!");const{unitId:u,sheetId:l}=a;if(typeof t=="object"){const d=t!=null?t:o,c=n!=null?n:te.ONLY_SET;this._ensureWorkbookSelection(u).setSelections(l,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 Do(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 u=0;u<o.length;u++){const l=o[u],{startRow:d,endRow:c,startColumn:m,endColumn:h}=l.range;for(let R=d;R<=c;R++)for(let C=m;C<=h;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=tu([nu(0,i.IUniverInstanceService)],g.SheetsSelectionsService);const su="DISABLE_NORMAL_SELECTIONS",ou="SELECTIONS_ENABLED",Ao="REF_SELECTIONS_ENABLED",sn={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),u=t.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET);if(!u)return!1;const l=(e==null?void 0:e.unitId)||u.getUnitId(),d=u.getActiveSheet();if(!d)return!1;const c=(e==null?void 0:e.subUnitId)||d.getSheetId(),m=(e==null?void 0:e.ranges)||((p=o.getCurrentSelections())==null?void 0:p.map(w=>w.range));if(!(m!=null&&m.length))return!1;const h=Dt(m,s,l,c),R=[],C=[],S={subUnitId:c,unitId:l,cellValue:qn(h)},I=ce(s,S);R.push({id:F.id,params:S}),C.push({id:F.id,params:I});const v=a.onCommandExecute({id:sn.id});return R.push(...v.redos),C.unshift(...v.undos),i.sequenceExecute(R,n)?(r.pushUndoRedo({unitID:l,undoMutations:C,redoMutations:R}),!0):!1}},on={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),u=t.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET);if(!u)return!1;const l=(e==null?void 0:e.unitId)||u.getUnitId(),d=u.getActiveSheet();if(!d)return!1;const c=(e==null?void 0:e.subUnitId)||d.getSheetId(),m=(e==null?void 0:e.ranges)||((p=o.getCurrentSelections())==null?void 0:p.map(w=>w.range));if(!(m!=null&&m.length))return!1;const h=Dt(m,s,l,c),R=[],C=[],S={subUnitId:c,unitId:l,cellValue:Xa(h)},I=ce(s,S);R.push({id:F.id,params:S}),C.push({id:F.id,params:I});const v=a.onCommandExecute({id:on.id});return R.push(...v.redos),C.unshift(...v.undos),i.sequenceExecute(R,n)?(r.pushUndoRedo({unitID:l,undoMutations:C,redoMutations:R}),!0):!1}};function At(s,e,t=!0){const n=e.getMatrixWithMergedCells(...i.selectionToArray(s)),o=[];if(n.forValue((a,u,l)=>{if(l.colSpan!==void 0&&l.rowSpan!==void 0){const d={startRow:a,startColumn:u,endRow:a+l.rowSpan-1,endColumn:u+l.colSpan-1};i.Rectangle.contains(s,d)||o.push(d)}}),o.length===0)return s;const r=i.Rectangle.union(s,...o);return t?At(r,e,t):r}function ru(s,e,t){let n=null;return t.getMatrixWithMergedCells(s,e,s,e).forValue((r,a,u)=>(n={actualRow:r,actualColumn:a,startRow:r,startColumn:a,isMerged:u.rowSpan!==void 0||u.colSpan!==void 0,isMergedMainCell:u.rowSpan!==void 0&&u.colSpan!==void 0,endRow:r+(u.rowSpan!==void 0?u.rowSpan-1:0),endColumn:a+(u.colSpan!==void 0?u.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 iu(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 Ue=(s,e,t)=>({id:q.id,params:{unitId:e.getUnitId(),subUnitId:t.getSheetId(),reveal:!0,selections:[{range:s,primary:se(s,t)}]}});function au(s){if(!s)return!1;const{range:e,primary:t}=s;return i.Rectangle.equals(e,t)}function uu(s){function e(t,n){function o(r){for(let a=r.startRow;a<=r.endRow;a++)if(!s.getRowFiltered(a))for(let u=r.startColumn;u<=r.endColumn;u++)n(a,u,r)}o(t)}return{forOperableEach:e}}const Wo=s=>s.id!==no;function $e(s,e,t,n,o,r,a){const u={};for(let l=e;l<=t;l++)for(let d=n;d<=o;d++){const c=r?s.getCellWithFilteredInterceptors(a,d,so,Wo):s.getCellWithFilteredInterceptors(l,a,so,Wo);!c||!c.s||(u[l]||(u[l]={}),u[l][d]={s:c.s})}return u}var lu=Object.getOwnPropertyDescriptor,du=(s,e,t,n)=>{for(var o=n>1?void 0:n?lu(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},cu=(s,e)=>(t,n)=>e(t,n,s);const Vo=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=du([cu(0,i.IUniverInstanceService)],g.RefSelectionsService);function $o(s,e){const n=s.get(i.IContextService).getContextValue(Ao);return s.get(n&&!e?Vo: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 $o(s).setSelections(o,r,[...t],n),!0}},Lo={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 u=[{range:o,primary:se(o,a.worksheet),style:null}];return r.syncExecuteCommand(q.id,{unitId:t,subUnitId:n,selections:u})}},Bo="sheet.command.move-range",Je={type:i.CommandType.COMMAND,id:Bo,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),u=s.get(g.SheetInterceptorService),l=P(o);if(!l||!await u.beforeCommandExecute({id:Je.id,params:e}))return!1;const{worksheet:c,subUnitId:m,unitId:h}=l,R=rn(s,{unitId:h,subUnitId:m,range:e.fromRange},{subUnitId:m,range:e.toRange});if(R===null)return r.emit(a.t("sheets.info.acrossMergedCell")),!1;const C=u.onCommandExecute({id:Je.id,params:e}),S=[...(M=C.preRedos)!=null?M:[],...R.redos,...C.redos,{id:q.id,params:{unitId:h,subUnitId:m,selections:[{range:e.toRange,primary:mu(e.fromRange,e.toRange,c)}],type:te.MOVE_END}}],I=[...(p=C.preUndos)!=null?p:[],...R.undos,...C.undos,{id:q.id,params:{unitId:h,subUnitId:m,selections:[{range:e.fromRange,primary:se(e.fromRange,c)}],type:te.MOVE_END}}];if(i.sequenceExecute(S,t).result){const{undos:w,redos:y}=u.generateMutationsOfAutoHeight({unitId:h,subUnitId:m,ranges:[e.fromRange,e.toRange]}),b=u.afterCommandExecute({id:Je.id,params:e});return i.sequenceExecute([...b.redos,...y],t),n.pushUndoRedo({unitID:h,undoMutations:[...I,...b.undos,...w],redoMutations:[...S,...b.redos,...y]}),!0}return!1}};function rn(s,e,t,n=!1){const o=[],r=[],{range:a,subUnitId:u,unitId:l}=e,{range:d,subUnitId:c}=t,h=s.get(i.IUniverInstanceService).getUniverSheetInstance(l),R=h==null?void 0:h.getSheetBySheetId(c),C=h==null?void 0:h.getSheetBySheetId(u),S=R==null?void 0:R.getCellMatrix(),I=C==null?void 0:C.getCellMatrix();if(R&&C&&S&&I){const v=At(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,(k,E)=>{const N=I.getValue(k,E);if(M.setValue(k,E,i.Tools.deepClone(N)),N){const W=h==null?void 0:h.getStyles().get(N.s);w.setValue(k,E,i.Tools.deepClone(W))}p.setValue(k,E,null)});const y=new i.ObjectMatrix,b=new i.ObjectMatrix;i.Range.foreach(d,(k,E)=>{y.setValue(k,E,i.Tools.deepClone(S.getValue(k,E)))}),i.Range.foreach(a,(k,E)=>{const N=i.cellToRange(k,E),W=i.Rectangle.getRelativeRange(N,a),V=i.Rectangle.getPositionRange(W,d),$=i.Tools.deepClone(w.getValue(k,E)),L=i.Tools.deepClone(M.getValue(k,E));L&&$&&(L.s=$),b.setValue(V.startRow,V.startColumn,L)});const T={fromRange:e.range,toRange:t.range,from:{value:p.getMatrix(),subUnitId:u},to:{value:b.getMatrix(),subUnitId:c},unitId:l},U={fromRange:t.range,toRange:e.range,from:{value:M.getMatrix(),subUnitId:u},to:{value:y.getMatrix(),subUnitId:c},unitId:l};o.push({id:Le.id,params:T}),r.push({id:Le.id,params:U})}return{redos:o,undos:r}}function mu(s,e,t){const n=s.startRow,o=s.startColumn,r=t.getMergedCell(n,o),a=se(e,t);if(r){const u=r.endRow-r.startRow+1,l=r.endColumn-r.startColumn+1;a.endRow=a.startRow+u-1,a.endColumn=a.startColumn+l-1,a.actualRow=a.startRow,a.actualColumn=a.startColumn,a.isMerged=!1,a.isMergedMainCell=!0}return a}var an=(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))(an||{}),_=(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 un{constructor(e,t,n){f(this,"type",D.SelectRange);f(this,"subType",_.View);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}.${_.View}.${n}`}}class Yn{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 Kn{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 Ho{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 Jn{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 xn{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 Fo{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 jo{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 Xn{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 Zn{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 Qn{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 ln{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 Go{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 zo{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 qo{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 dn{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 cn{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 es{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 ts{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 mn{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 ns{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 ss{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 os{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 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",_.Copy);this.unitId=e,this.subUnitId=t,this.id=`${this.type}.${_.Copy}_${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",_.DeleteColumn);this.unitId=e,this.subUnitId=t,this.id=`${this.type}.${_.DeleteColumn}_${e}_${t}`}}class as{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 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",_.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 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",_.EditExtraObject);this.unitId=e,this.subUnitId=t,this.id=`${this.type}.${_.EditExtraObject}_${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",_.Filter);this.unitId=e,this.subUnitId=t,this.id=`${this.type}.${_.Filter}_${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",_.InsertColumn);this.unitId=e,this.subUnitId=t,this.id=`${this.type}.${_.InsertColumn}_${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",_.InsertHyperlink);this.unitId=e,this.subUnitId=t,this.id=`${this.type}.${_.InsertHyperlink}_${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",_.InsertRow);this.unitId=e,this.subUnitId=t,this.id=`${this.type}.${_.InsertRow}_${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",_.ManageCollaborator);this.unitId=e,this.subUnitId=t,this.id=`${this.type}.${_.ManageCollaborator}_${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",_.PivotTable);this.unitId=e,this.subUnitId=t,this.id=`${this.type}.${_.PivotTable}_${e}_${t}`}}class hu{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 gu{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 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",_.SetCellStyle);this.unitId=e,this.subUnitId=t,this.id=`${this.type}.${_.SetCellStyle}_${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",_.SetCellValue);this.unitId=e,this.subUnitId=t,this.id=`${this.type}.${_.SetCellValue}_${e}_${t}`}}class St{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 ft{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 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",_.Sort);this.unitId=e,this.subUnitId=t,this.id=`${this.type}.${_.Sort}_${e}_${t}`}}class Vt{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 It={id:"sheet.command.set-range-values",type:i.CommandType.COMMAND,handler:(s,e)=>{var 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),u=s.get(i.IPermissionService),l=P(o,e);if(!l)return!1;const{subUnitId:d,unitId:c,workbook:m,worksheet:h}=l,{value:R,range:C,redoUndoId:S}=e,I=C?[C]:(W=r.getCurrentSelections())==null?void 0:W.map(V=>V.range);if(!I||!I.length||!u.getPermissionPoint(new fe(c,d).id))return!1;const v=new i.ObjectMatrix;let M;if(i.Tools.isArray(R))for(let V=0;V<I.length;V++){const{startRow:$,startColumn:L,endRow:Y,endColumn:z}=I[V];for(let K=0;K<=Y-$;K++)for(let oe=0;oe<=z-L;oe++)v.setValue(K+$,oe+L,R[K][oe])}else if(i.isICellData(R))for(let V=0;V<I.length;V++){const{startRow:$,startColumn:L,endRow:Y,endColumn:z}=I[V];for(let K=$;K<=Y;K++)for(let oe=L;oe<=z;oe++)v.setValue(K,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,(V,$)=>h.getCellHeight(V,$)||void 0);if(!t.syncExecuteCommand(F.id,p))return!1;const{undos:T,redos:U}=a.onCommandExecute({id:It.id,params:p}),{undos:k,redos:E}=a.generateMutationsOfAutoHeight({unitId:c,subUnitId:d,ranges:I,cellHeights:new i.ObjectMatrix(y)});if(i.sequenceExecute([...U,...E],t).result){const V=Ue(C!=null?C:v.getRange(),m,h);return n.pushUndoRedo({unitID:c,undoMutations:[{id:F.id,params:w},...T,...k,V],redoMutations:[{id:F.id,params:p},...U,...E,i.Tools.deepClone(V)],id:S}),!0}return!1}};function fs(s,e){const t=[],n=[],{unitId:o,subUnitId:r,range:a,shiftDimension:u,cellValue:l={}}=e,d=s.get(i.IUniverInstanceService),c=s.get(g.SheetInterceptorService),m=d.getUniverSheetInstance(o),h=m==null?void 0:m.getSheetBySheetId(r);if(h){const R=h.getCellMatrix(),C=R.getDataRange();if(a.startColumn<=C.endColumn||a.startRow<=C.endRow){let p,w;if(u===i.Dimension.COLUMNS){const b=Math.min(a.endRow,C.endRow);let T=0;for(let k=a.startRow;k<=b;k++){const E=R.getRow(k),N=E?i.getArrayLength(E)-1:0;T=Math.max(T,N)}p={startRow:a.startRow,startColumn:a.startColumn,endRow:b,endColumn:T};const U=a.endColumn-a.startColumn+1;w={startRow:a.startRow,startColumn:p.startColumn+U,endRow:b,endColumn:p.endColumn+U}}else{const b=Math.min(a.endColumn,C.endColumn),T=C.endRow;p={startRow:a.startRow,startColumn:a.startColumn,endRow:T,endColumn:b};const U=a.endRow-a.startRow+1;w={startRow:p.startRow+U,startColumn:a.startColumn,endRow:p.endRow+U,endColumn:b}}const y=rn(s,{unitId:o,subUnitId:r,range:p},{subUnitId:r,range:w},!0);y&&(t.push(...y.redos),n.push(...y.undos))}if(Object.entries(l).length===0)for(let p=a.startRow;p<=a.endRow;p++){l[p]||(l[p]={});for(let w=a.startColumn;w<=a.endColumn;w++)l[p][w]=null}const S={subUnitId:r,unitId:o,cellValue:l},I=ce(s,S),{undos:v,redos:M}=c.onCommandExecute({id:It.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 Is(s,e){const t=[],n=[],{unitId:o,subUnitId:r,range:a,shiftDimension:u}=e,l=s.get(i.IUniverInstanceService),d=s.get(g.SheetInterceptorService),c=l.getUniverSheetInstance(o),m=c==null?void 0:c.getSheetBySheetId(r);if(m){const h=m.getCellMatrix(),R=h.getDataRange(),C={subUnitId:r,unitId:o,cellValue:qn([a])},S=ce(s,C),I=d.onCommandExecute({id:It.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(u===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 T=h.getRow(b),U=T?i.getArrayLength(T)-1:0;w=Math.max(w,U)}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(u===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=rn(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 Ru(s,e,t,n,o,r){const{startRow:a,endRow:u,startColumn:l,endColumn:d}=e;if(o===i.Dimension.ROWS){const c=u-a+1;for(let m=t;m>=a;m--)for(let h=l;h<=d;h++){const R=s.getValue(m,h);R==null?s.realDeleteValue(m+c,h):s.setValue(m+c,h,R)}for(let m=u;m>=a;m--)for(let h=l;h<=d;h++)r&&r[m]&&r[m][h]?s.setValue(m,h,r[m][h]):s.realDeleteValue(m,h)}else if(o===i.Dimension.COLUMNS){const c=d-l+1;for(let m=a;m<=u;m++)for(let h=n;h>=l;h--){const R=s.getValue(m,h);R==null?s.realDeleteValue(m,h+c):s.setValue(m,h+c,R)}for(let m=a;m<=u;m++)for(let h=d;h>=l;h--)r&&r[m]&&r[m][h]?s.setValue(m,h,r[m][h]):s.realDeleteValue(m,h)}}function Cu(s,e,t,n,o){const{startRow:r,endRow:a,startColumn:u,endColumn:l}=e,d=a-r+1,c=l-u+1;if(o===i.Dimension.ROWS)for(let m=r;m<=t;m++)for(let h=u;h<=l;h++){const R=s.getValue(m+d,h);R==null?s.realDeleteValue(m,h):s.setValue(m,h,R)}else if(o===i.Dimension.COLUMNS)for(let m=r;m<=a;m++)for(let h=u;h<=n;h++){const R=s.getValue(m,h+c);R==null?s.realDeleteValue(m,h):s.setValue(m,h,R)}}const Yo="sheet.command.delete-range-move-left",Be={type:i.CommandType.COMMAND,id:Yo,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),u=P(o);if(!u)return!1;const{worksheet:l,workbook:d,subUnitId:c,unitId:m}=u;let h=e==null?void 0:e.range;if(h||(h=(w=r.getCurrentLastSelection())==null?void 0:w.range),!h)return!1;const R={range:h,subUnitId:c,unitId:m,shiftDimension:i.Dimension.COLUMNS},C=a.onCommandExecute({id:Be.id,params:{range:h}}),{redo:S,undo:I}=Is(s,R),v=[...(y=C.preRedos)!=null?y:[],...S],M=[...C.undos,...I];if(v.push(...C.redos),v.push(Ue(h,d,l)),M.push(...(b=C.preUndos)!=null?b:[]),i.sequenceExecute(v,t).result){const T=a.afterCommandExecute({id:Be.id,params:{range:h}});return i.sequenceExecute(T.redos,t),M.push(...T.undos),v.push(...T.redos),n.pushUndoRedo({unitID:m,undoMutations:M.reverse(),redoMutations:v}),!0}return!1}},Ko="sheet.command.delete-range-move-up",He={type:i.CommandType.COMMAND,id:Ko,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),u=P(o);if(!u)return!1;const{unitId:l,subUnitId:d,workbook:c,worksheet:m}=u;let h=e==null?void 0:e.range;if(h||(h=(w=r.getCurrentLastSelection())==null?void 0:w.range),!h)return!1;const R={range:h,subUnitId:d,unitId:l,shiftDimension:i.Dimension.ROWS},C=a.onCommandExecute({id:He.id,params:{range:h}}),{redo:S,undo:I}=Is(s,R),v=[...(y=C.preRedos)!=null?y:[],...S],M=[...C.undos,...I];if(v.push(...C.redos),v.push(Ue(h,c,m)),M.push(...(b=C.preUndos)!=null?b:[]),i.sequenceExecute(v,t).result){const T=a.afterCommandExecute({id:He.id,params:{range:h}});return i.sequenceExecute(T.redos,t),M.push(...T.undos),v.push(...T.redos),n.pushUndoRedo({unitID:l,undoMutations:M.reverse(),redoMutations:v}),!0}return!1}},Su="sheet.command.insert-range-move-down",xe={type:i.CommandType.COMMAND,id:"sheet.command.insert-range-move-down",handler:async(s,e)=>{var W,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),u=s.get(i.ErrorService),l=s.get(i.LocaleService);if(r.isOverlapping())return u.emit(l.t("sheets.info.overlappingSelections")),!1;const d=P(o);if(!d)return!1;const{unitId:c,subUnitId:m,worksheet:h,workbook:R}=d;let C=e==null?void 0:e.range;if(C||(C=(W=r.getCurrentLastSelection())==null?void 0:W.range),!C)return!1;const S=[],I=[],v=h.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=h.getRowHeight(L),z={unitId:c,subUnitId:m,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 K=en(s,z);I.push({id:ae.id,params:K})}const b={};i.Range.foreach(C,(L,Y)=>{const z=h.getCell(L,Y);z&&(b[L]||(b[L]={}),b[L][Y]={s:z.s})});const T={range:C,subUnitId:m,unitId:c,shiftDimension:i.Dimension.ROWS,cellValue:b},{redo:U,undo:k}=fs(s,T);S.push(...U),I.push(...k);const E=a.onCommandExecute({id:xe.id,params:{range:C}});if(S.push(...E.redos),S.push(Ue(C,R,h)),I.push(...(V=E.preUndos)!=null?V:[]),S.unshift(...($=E.preRedos)!=null?$:[]),I.unshift(...E.undos),i.sequenceExecute(S,t)){const L=a.afterCommandExecute({id:xe.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}},vs="sheet.command.insert-range-move-right",vt={type:i.CommandType.COMMAND,id:vs,handler:async(s,e)=>{var W,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),u=s.get(i.ErrorService),l=s.get(i.LocaleService);if(r.isOverlapping())return u.emit(l.t("sheets.info.overlappingSelections")),!1;const d=P(o);if(!d)return!1;const{workbook:c,worksheet:m,unitId:h,subUnitId:R}=d;let C=e==null?void 0:e.range;if(C||(C=(W=r.getCurrentLastSelection())==null?void 0:W.range),!C)return!1;const S=[],I=[],v=m.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=m.getColumnWidth(L),z={unitId:h,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 K=Nt(s,z);I.push({id:ne.id,params:K})}const b={};i.Range.foreach(C,(L,Y)=>{const z=m.getCell(L,Y);!z||!z.s||(b[L]||(b[L]={}),b[L][Y]={s:z.s})});const T={range:C,subUnitId:R,unitId:h,shiftDimension:i.Dimension.COLUMNS,cellValue:b},{redo:U,undo:k}=fs(s,T);S.push(...U),I.push(...k);const E=a.onCommandExecute({id:vt.id,params:{range:C}});if(S.push(...E.redos),S.push(Ue(C,c,m)),I.push(...(V=E.preUndos)!=null?V:[]),S.unshift(...($=E.preRedos)!=null?$:[]),I.unshift(...E.undos),i.sequenceExecute(S,t).result){const L=a.afterCommandExecute({id:vt.id,params:{range:C}});return i.sequenceExecute(L.redos,t),I.push(...L.undos),S.push(...L.redos),n.pushUndoRedo({unitID:h,undoMutations:I.reverse(),redoMutations:S}),!0}return!1}},Jo="sheet.command.insert-row",Me={type:i.CommandType.COMMAND,id:Jo,handler:async(s,e)=>{const t=s.get(i.ICommandService),n=s.get(g.SheetInterceptorService),{range:o,direction:r,unitId:a,subUnitId:u,cellValue:l}=e;return await n.beforeCommandExecute({id:Me.id,params:e})?t.syncExecuteCommand(ps.id,{range:o,direction:r,unitId:a,subUnitId:u,cellValue:l}):!1}},ps={type:i.CommandType.COMMAND,id:"sheet.command.insert-row-by-range",handler:(s,e)=>{var U,k,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:u,worksheet:l}=a,{range:d,direction:c,unitId:m,subUnitId:h,cellValue:R}=e,{startRow:C,endRow:S}=d;d.rangeType=i.RANGE_TYPE.ROW;const I=c===i.Direction.UP?C:C-1,v=l.getRowHeight(I),M={unitId:m,subUnitId:h,range:d,rowInfo:new Array(S-C+1).fill(void 0).map(()=>({h:v,hd:i.BooleanNumber.FALSE}))},p=en(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:m,subUnitId:h,cellValue:R}});const b=r.onCommandExecute({id:Me.id,params:e});if(w.unshift(...(U=b.preRedos)!=null?U:[]),w.push(...(k=b.redos)!=null?k:[]),w.push(Ue(d,u,l)),y.unshift(...(E=b.preUndos)!=null?E:[]),y.push(...(N=b.undos)!=null?N:[]),i.sequenceExecute(w,t).result){const W=r.afterCommandExecute({id:Me.id,params:e});return i.sequenceExecute(W.redos,t),w.push(...W.redos),y.push(...W.undos),n.pushUndoRedo({unitID:e.unitId,undoMutations:y,redoMutations:w}),!0}return!1}},xo={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:u,subUnitId:l,unitId:d}=a,c=e.value||0,m=o.startRow,h=o.startRow+c-1,R=0,C=u.getColumnCount()-1,S={unitId:d,subUnitId:l,direction:i.Direction.UP,range:{startRow:m,endRow:h,startColumn:R,endColumn:C},cellValue:$e(u,m,h,R,C,!0,m-1)};return s.get(i.ICommandService).executeCommand(Me.id,S)}},Xo={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:u,subUnitId:l}=r,d=n.endRow-n.startRow+1,c=n.endRow+1,m=n.endRow+d,h=0,R=a.getColumnCount()-1,C={unitId:u,subUnitId:l,direction:i.Direction.DOWN,range:{startRow:c,endRow:m,startColumn:h,endColumn:R,rangeType:i.RANGE_TYPE.ROW},cellValue:$e(a,c,m,h,R,!0,n.endRow)};return s.get(i.ICommandService).executeCommand(Me.id,C)}},Zo={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:u,unitId:l,subUnitId:d}=a,c=e.value||0,m=o.startRow,h=o.startRow+c-1,R=0,C=u.getColumnCount()-1,S=$e(u,m,h,R,C,!0,m-1),I={unitId:l,subUnitId:d,direction:i.Direction.UP,range:{startRow:m,endRow:h,startColumn:R,endColumn:C,rangeType:i.RANGE_TYPE.ROW},cellValue:S};return s.get(i.ICommandService).executeCommand(Me.id,I)}},Qo={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:u,unitId:l,subUnitId:d}=a,c=e.value||0,m=o.endRow+1,h=o.endRow+c,R=0,C=u.getColumnCount()-1,S={unitId:l,subUnitId:d,direction:i.Direction.DOWN,range:{startRow:m,endRow:h,startColumn:R,endColumn:C,rangeType:i.RANGE_TYPE.ROW},cellValue:$e(u,m,h,R,C,!0,o.endRow)};return s.get(i.ICommandService).executeCommand(Me.id,S)}},er="sheet.command.insert-col",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,subUnitId:a,unitId:u,cellValue:l}=e;return await n.beforeCommandExecute({id:ye.id,params:e})?t.syncExecuteCommand(ws.id,{range:o,direction:r,unitId:u,subUnitId:a,cellValue:l}):!1}},ws={type:i.CommandType.COMMAND,id:"sheet.command.insert-col-by-range",handler:(s,e)=>{var T,U,k,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:u,subUnitId:l,unitId:d,cellValue:c}=e,{startColumn:m,endColumn:h}=e.range;a.rangeType=i.RANGE_TYPE.COLUMN;const R=o.getUniverSheetInstance(e.unitId),C=R.getSheetBySheetId(e.subUnitId),S=u===i.Direction.LEFT?m:m-1,I=C.getColumnWidth(S),v={unitId:d,subUnitId:l,range:a,colInfo:new Array(h-m+1).fill(void 0).map(()=>({w:I,hd:i.BooleanNumber.FALSE}))},M=Nt(s,v),p=[{id:ie.id,params:v}],w=[{id:ne.id,params:M}];c&&p.push({id:F.id,params:{unitId:d,subUnitId:l,cellValue:c}});const y=r.onCommandExecute({id:ye.id,params:e});if(p.unshift(...(T=y.preRedos)!=null?T:[]),p.push(...(U=y.redos)!=null?U:[]),p.push(Ue(a,R,C)),w.unshift(...(k=y.preUndos)!=null?k:[]),w.push(...(E=y.undos)!=null?E:[]),i.sequenceExecute(p,t).result){const N=r.afterCommandExecute({id:ye.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}},tr={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:u,unitId:l,subUnitId:d}=a,c=e.value||0,m=o.startColumn,h=o.startColumn+c-1,R=0,C=u.getRowCount()-1,S={unitId:l,subUnitId:d,direction:i.Direction.LEFT,range:{startColumn:m,endColumn:h,startRow:R,endRow:C,rangeType:i.RANGE_TYPE.COLUMN},cellValue:$e(u,R,C,m,h,!1,m-1)};return s.get(i.ICommandService).executeCommand(ye.id,S)}},nr={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:u,subUnitId:l}=r,d=n.endColumn-n.startColumn+1,c=n.endColumn+1,m=n.endColumn+d,h=0,R=a.getRowCount()-1,C={unitId:u,subUnitId:l,direction:i.Direction.RIGHT,range:{startColumn:c,endColumn:m,startRow:h,endRow:R},cellValue:$e(a,h,R,c,m,!1,n.endColumn)};return s.get(i.ICommandService).executeCommand(ye.id,C)}},sr={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:u,unitId:l,subUnitId:d}=a,c=e.value||0,m=o.startColumn,h=o.startColumn+c-1,R=0,C=u.getRowCount()-1,S={unitId:l,subUnitId:d,direction:i.Direction.LEFT,range:{startColumn:m,endColumn:h,startRow:R,endRow:C,rangeType:i.RANGE_TYPE.COLUMN},cellValue:$e(u,R,C,m,h,!1,m-1)};return s.get(i.ICommandService).executeCommand(ye.id,S)}},or={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:u,unitId:l,subUnitId:d}=a,c=e.value||0,m=o.endColumn+1,h=o.endColumn+c,R=0,C=u.getRowCount()-1,S={unitId:l,subUnitId:d,direction:i.Direction.RIGHT,range:{startColumn:m,endColumn:h,startRow:R,endRow:C},cellValue:$e(u,R,C,m,h,!1,o.endColumn)};return s.get(i.ICommandService).executeCommand(ye.id,S)}},hn="sheet.command.remove-row",Ms={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:u,unitId:l,subUnitId:d}=e,c=Dt([u],s,l,d).reverse(),m=[],h=[];c.forEach(p=>{const w=[],y=[],b={unitId:l,subUnitId:d,range:p},T=la(b,r),U=r.getCellMatrix().getSlice(p.startRow,p.endRow,0,r.getColumnCount()-1),k={unitId:l,subUnitId:d,cellValue:U.getMatrix()};y.push({id:ae.id,params:b}),w.push({id:re.id,params:T}),w.push({id:F.id,params:k}),h.push(...y),m.unshift(...w)});const R=a.onCommandExecute({id:hn,params:{range:u}}),C=s.get(i.ICommandService);if(i.sequenceExecute([...(I=R.preRedos)!=null?I:[],...h,...R.redos,Ue(u,o,r)],C).result){const p=a.afterCommandExecute({id:hn,params:{range:u}});return i.sequenceExecute(p.redos,C),s.get(i.IUndoRedoService).pushUndoRedo({unitID:l,undoMutations:[...(v=R.preUndos)!=null?v:[],...m,...R.undos,...p.undos],redoMutations:[...(M=R.preRedos)!=null?M:[],...h,...R.redos,...p.redos]}),!0}return!1}},$t={type:i.CommandType.COMMAND,id:hn,handler:async(s,e)=>{var h;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=(h=t.getCurrentLastSelection())==null?void 0:h.range),!r)return!1;const a=s.get(i.IUniverInstanceService),u=P(a);if(!u)return!1;const{worksheet:l,subUnitId:d,unitId:c}=u;return r={...r,startColumn:0,endColumn:Math.max(l.getMaxColumns()-1,0)},await n.beforeCommandExecute({id:$t.id,params:{range:r}})?o.syncExecuteCommand(Ms.id,{range:r,unitId:c,subUnitId:d}):!1}},gn="sheet.command.remove-col",ys={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:u,unitId:l,subUnitId:d}=e,c={unitId:l,subUnitId:d,range:u},m=da(s,c),h=r.getCellMatrix().getSlice(0,r.getRowCount()-1,u.startColumn,u.endColumn),R={unitId:l,subUnitId:d,cellValue:h.getMatrix()},C=a.onCommandExecute({id:gn,params:{range:u}}),S=s.get(i.ICommandService);if(i.sequenceExecute([...(v=C.preRedos)!=null?v:[],{id:ne.id,params:c},...C.redos,Ue(u,o,r)],S).result){const w=a.afterCommandExecute({id:gn,params:{range:u}});return i.sequenceExecute(w.redos,S),s.get(i.IUndoRedoService).pushUndoRedo({unitID:l,undoMutations:[...(M=C.preUndos)!=null?M:[],{id:ie.id,params:m},{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}},Lt={type:i.CommandType.COMMAND,id:gn,handler:async(s,e)=>{var h;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=(h=t.getCurrentLastSelection())==null?void 0:h.range),!r)return!1;const a=s.get(i.IUniverInstanceService),u=P(a);if(!u)return!1;const{worksheet:l,subUnitId:d,unitId:c}=u;return r={...r,startRow:0,endRow:Math.max(l.getMaxRows()-1,0)},await n.beforeCommandExecute({id:Lt.id,params:{range:r}})?o.syncExecuteCommand(ys.id,{range:r,unitId:c,subUnitId:d}):!1}},rr=(s,e)=>{const t=s.get(i.IUniverInstanceService),{subUnitId:n,unitId:o}=e,r=ve(t,e);if(!r)throw new Error("[RemoveSheetUndoMutationFactory]: Worksheet is null error!");const{workbook:a,worksheet:u}=r,l=u.getConfig();return{index:a.getConfig().sheetOrder.findIndex(m=>m===n),sheet:l,unitId:o}},Xe={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 fu(s,e){return e.getMergeData().some(t=>t.startRow<s&&s<=t.endRow)}function Iu(s,e){return e.getMergeData().some(t=>t.startColumn<s&&s<=t.endColumn)}const ir="sheet.command.move-rows",pt={id:ir,type:i.CommandType.COMMAND,handler:(s,e)=>{var W,V;const t=s.get(g.SheetsSelectionsService),{fromRange:{startRow:n},toRange:{startRow:o},range:r}=e,a=r?[ur(r)]:t.getCurrentSelections(),u=a==null?void 0:a.filter($=>$.range.rangeType===i.RANGE_TYPE.ROW&&$.range.startRow<=n&&n<=$.range.endRow);if((u==null?void 0:u.length)!==1)return!1;const l=s.get(g.SheetInterceptorService),d=s.get(i.IUniverInstanceService),c=P(d,e);if(!c)return!1;const{workbook:m,worksheet:h}=c,R=m.getUnitId(),C=h.getSheetId(),S=s.get(i.ErrorService),I=s.get(i.LocaleService),v=u[0].range,M=u[0].primary,p=At(v,h,!1);if(!i.Rectangle.equals(v,p))return S.emit(I.t("sheets.info.partOfCell")),!1;if(fu(o,h))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=uo(s,y),T=s.get(i.ICommandService),U=l.onCommandExecute({id:pt.id,params:e}),k=[...(W=U.preRedos)!=null?W:[],{id:pe.id,params:y}],E=[...(V=U.preUndos)!=null?V:[],{id:pe.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},K={unitId:R,subUnitId:C,type:te.MOVE_END,selections:[{range:z,primary:se(z,h),style:null}]},oe={unitId:R,subUnitId:C,type:te.MOVE_END,selections:[{range:v,primary:M,style:null}]};k.push({id:q.id,params:K}),E.push({id:q.id,params:oe})}if(k.push(...U.redos),E.push(...U.undos),i.sequenceExecute(k,T).result){const $=l.afterCommandExecute({id:pt.id,params:e});return i.sequenceExecute($.redos,T),k.push(...$.redos),E.push(...$.undos),s.get(i.IUndoRedoService).pushUndoRedo({unitID:R,undoMutations:E,redoMutations:k}),!0}return!1}},ar="sheet.command.move-cols",wt={id:ar,type:i.CommandType.COMMAND,handler:(s,e)=>{var W,V;const t=s.get(g.SheetsSelectionsService),{fromRange:{startColumn:n},toRange:{startColumn:o},range:r}=e,a=r?[ur(r)]:t.getCurrentSelections(),u=a==null?void 0:a.filter($=>$.range.rangeType===i.RANGE_TYPE.COLUMN&&$.range.startColumn<=n&&n<=$.range.endColumn);if((u==null?void 0:u.length)!==1)return!1;const l=s.get(g.SheetInterceptorService),d=s.get(i.IUniverInstanceService),c=P(d,e);if(!c)return!1;const{workbook:m,worksheet:h}=c,R=m.getUnitId(),C=h.getSheetId(),S=s.get(i.ErrorService),I=s.get(i.LocaleService),v=u[0].range,M=u[0].primary,p=At(v,h,!1);if(!i.Rectangle.equals(v,p))return S.emit(I.t("sheets.info.partOfCell")),!1;if(Iu(o,h))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=lo(s,y),T=s.get(i.ICommandService),U=l.onCommandExecute({id:wt.id,params:e}),k=[...(W=U.preRedos)!=null?W:[],{id:we.id,params:y}],E=[...(V=U.preUndos)!=null?V:[],{id:we.id,params:b}];if(M){const $=v.endColumn-v.startColumn+1,z=o-n<0?w:{...w,startColumn:w.startColumn-$,endColumn:w.endColumn-$},K={unitId:R,subUnitId:C,type:te.MOVE_END,selections:[{range:z,primary:se(z,h),style:null}]},oe={unitId:R,subUnitId:C,type:te.MOVE_END,selections:[{range:v,primary:M,style:null}]};k.push({id:q.id,params:K}),E.push({id:q.id,params:oe})}if(k.push(...U.redos),E.push(...U.undos),i.sequenceExecute(k,T).result){const $=l.afterCommandExecute({id:wt.id,params:e});return i.sequenceExecute($.redos,T),k.push(...$.redos),E.push(...$.undos),s.get(i.IUndoRedoService).pushUndoRedo({unitID:R,undoMutations:E,redoMutations:k}),!0}return!1}};function ur(s){return{range:s,primary:null,style:null}}var vu=Object.getOwnPropertyDescriptor,pu=(s,e,t,n)=>{for(var o=n>1?void 0:n?vu(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},wu=(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=pu([wu(0,i.Inject(i.Injector))],g.SheetSkeletonService);function _s(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 Mu=1e4;function Bt(s,e){if(!e)return{suitableRanges:s,remainingRanges:[]};const t=e.worksheet.getColumnCount(),n=Math.ceil(Mu/t),o=[],r=[],a=e.getOffsetRelativeToRowCol(0,e.scrollY).row,u=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}});u.sort((d,c)=>d.distance!==c.distance?d.distance-c.distance:d.rowCount-c.rowCount);let l=0;for(const d of u)if(l+d.rowCount<=n)o.push(d.range),l+=d.rowCount;else{const c=n-l;if(c>0){const m={...d.range,endRow:d.range.startRow+c-1},h={...d.range,startRow:d.range.startRow+c};o.push(m),r.push(h),l=n}else r.push(d.range)}return{suitableRanges:o,remainingRanges:r}}const lr="sheet.command.reorder-range",Rn={id:lr,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),u={id:Ot.id,params:{unitId:n,subUnitId:t,order:r,range:o}},l={id:Ot.id,params:co(u.params)},d=s.get(g.SheetInterceptorService),c=d.onCommandExecute({id:Rn.id,params:e}),m=[...(p=c.preRedos)!=null?p:[],u,...c.redos],h=[...(w=c.preUndos)!=null?w:[],l,...c.undos],R=i.sequenceExecute(m,a),{suitableRanges:C,remainingRanges:S}=Bt([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:Rn.id,params:e});return R.result?(i.sequenceExecute([...M.redos,...v],a),s.get(i.IUndoRedoService).pushUndoRedo({unitID:n,undoMutations:[...h,...M.undos,...I],redoMutations:[...m,...M.redos,...v]}),!0):!1}},A={MoveRangeCommandId:Bo,InsertRowCommandId:Jo,InsertColCommandId:er,RemoveColCommandId:gn,RemoveRowCommandId:hn,DeleteRangeMoveLeftCommandId:Yo,DeleteRangeMoveUpCommandId:Ko,InsertRangeMoveDownCommandId:Su,InsertRangeMoveRightCommandId:vs,MoveColsCommandId:ar,MoveRowsCommandId:ir,ReorderRangeCommandId:lr};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 Cn=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=Cn),(e.rangeType===i.RANGE_TYPE.ROW||n)&&(e.startColumn=0,e.endColumn=Cn),e.rangeType===i.RANGE_TYPE.ALL&&(e.startColumn=0,e.endColumn=Cn,e.startRow=0,e.endRow=Cn),e},he=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}},Ht=(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,u=(S,I)=>({start:S.start-I.start,end:S.start-I.start+S.end-S.start}),l=(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),m=c,h=r(s,n),R=h&&a(h)>=a(n);if(s.end<n.start)n.start-=c,n.end-=c;else if(h){const S=a(h);if(R){const I=u(n,s),v=l(I,o);n.start=v.start,n.end=v.end}else h.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+=m,n.end+=m):C&&(d?o.end<=n.start||o.start<=n.start&&o.end>=n.start?(n.start+=m,n.end+=m):o.start>=n.start&&o.start<=n.end&&(n.end+=m):n.start<o.start&&n.end>o.start?n.end+=m:(n.start>=o.end||n.start>=o.start&&n.start<=o.end)&&(n.end+=m,n.start+=m))),{step:n.start-t.start,length:a(n)-a(t)}},bs=(s,e)=>{const{fromRange:t,toRange:n}=s.params||{};if(!n||!t)return[];const o=Pe(t),r=Pe(n),a=Pe(e),u=Ht({start:o.startRow,end:o.endRow},{start:r.startRow,end:r.endRow},{start:a.startRow,end:a.endRow});return u===null?[{type:B.Delete}]:[{type:B.VerticalMove,step:u.step||0,length:u.length||0}]},yu=(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,u=new i.ObjectMatrix;return i.Range.foreach(e,(d,c)=>{u.setValue(d,c,1)}),u.moveRows(o,r,a),i.queryObjectMatrix(u,d=>d===1)},_u=(s,e)=>{const{range:t,order:n}=s.params||{};if(!t||!n)return[e];const o=new i.ObjectMatrix;i.Range.foreach(e,(u,l)=>{o.setValue(u,l,1)});const r=new i.ObjectMatrix;return i.Range.foreach(t,(u,l)=>{var d;if(Object.prototype.hasOwnProperty.call(n,u)){const c=n[u],m=(d=o.getValue(c,l))!=null?d:0;r.setValue(u,l,m)}}),r.forValue((u,l,d)=>{o.setValue(u,l,d)}),i.queryObjectMatrix(o,u=>u===1)},Es=(s,e)=>{const{fromRange:t,toRange:n}=s.params||{};if(!n||!t)return[];const o=Pe(t),r=Pe(n),a=Pe(e),u=Ht({start:o.startColumn,end:o.endColumn},{start:r.startColumn,end:r.endColumn},{start:a.startColumn,end:a.endColumn});return u===null?[{type:B.Delete}]:[{type:B.HorizontalMove,step:u.step||0,length:u.length||0}]},bu=(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,u=new i.ObjectMatrix;return i.Range.foreach(e,(l,d)=>{u.setValue(l,d,1)}),u.moveColumns(o,r,a),i.queryObjectMatrix(u,l=>l===1)},dr=(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 u=i.Rectangle.getRelativeRange(e,n),l=i.Rectangle.getPositionRange(u,t);return[{type:B.Set,range:l}]}return o},Eu=(s,e)=>{var m,h;const t=(m=s.params)==null?void 0:m.toRange,n=(h=s.params)==null?void 0:h.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 u=t.startColumn-n.startColumn,l=t.startRow-n.startRow,d={startColumn:t.startColumn-u,endColumn:t.endColumn-u,startRow:t.startRow-l,endRow:t.endRow-l};return d&&i.Range.foreach(d,(R,C)=>{var v;const S=R+l,I=C+u;o.setValue(S,I,(v=r.getValue(R,C))!=null?v:0)}),i.queryObjectMatrix(o,R=>R===1)},Ze=(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 u=-o(a);return{step:-(o(t)-o(a)),length:u}}}if(n.startColumn>t.endColumn)return{step:-o(t),length:0}}return{step:0,length:0}},Ts=(s,e)=>{var r;const t=(r=s.params)==null?void 0:r.range;if(!t)return[];const n=[],o=Ze(t,e);if(!o)n.push({type:B.Delete});else{const{step:a,length:u}=o;n.push({type:B.HorizontalMove,step:a,length:u})}return n},cr=(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 u=n.startRow;for(let l=n.startRow;l<=n.endRow;l++){if(t.includes(l)){if(l===u){u=l+1;continue}r({...n,startRow:u,endRow:l-1}),u=l+1;continue}l===n.endRow&&r({...n,startRow:u,endRow:n.endRow})}}else r(n);function r(u){const l=Ze(he(u),he(e));if(!l)o.push({type:B.Delete});else{const{step:d,length:c}=l;o.push({type:B.VerticalMove,step:d,length:c})}}return o},Tu=(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 u=Number(a);return o.push({type:B.VerticalMove,step:u-r,length:0}),o}return[]}return[]},Qe=(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 Uu(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 mr=(s,e)=>{var u;const t=(u=s.params)==null?void 0:u.range;if(!t)return[];const n=[],o=Qe(he(t),he(e)),{step:r,length:a}=o;return n.push({type:B.VerticalMove,step:r,length:a}),n},hr=(s,e)=>{var u;const t=(u=s.params)==null?void 0:u.range;if(!t)return[];const n=[],o=Qe(t,e),{step:r,length:a}=o;return n.push({type:B.HorizontalMove,step:r,length:a}),n},gr=(s,e)=>{var u;const t=(u=s.params)==null?void 0:u.range;if(!t)return[];const n=[],o=Qe(he(t),he(e)),{step:r,length:a}=o;return n.push({type:B.VerticalMove,step:r,length:a}),n},Pu=(s,e)=>{var l;const t=(l=s.params)==null?void 0:l.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 u=new i.ObjectMatrix;return r.forEach(d=>{i.Range.foreach(d,(c,m)=>{u.setValue(c,m,1)})}),a&&i.Range.foreach(a,(d,c)=>{u.setValue(d+n,c,1)}),i.queryObjectMatrix(u,d=>d===1)},Rr=(s,e)=>{var u;const t=(u=s.params)==null?void 0:u.range;if(!t)return[];const n=[],o=Qe(t,e),{step:r,length:a}=o;return n.push({type:B.HorizontalMove,step:r,length:a}),n},ku=(s,e)=>{var l;const t=(l=s.params)==null?void 0:l.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 u=new i.ObjectMatrix;return r.forEach(d=>{i.Range.foreach(d,(c,m)=>{u.setValue(c,m,1)})}),a&&i.Range.foreach(a,(d,c)=>{u.setValue(d,c+n,1)}),i.queryObjectMatrix(u,d=>d===1)},Cr=(s,e)=>{var r;const t=(r=s.params)==null?void 0:r.range;if(!t)return[];const n=[],o=Ze(t,e);if(!o)n.push({type:B.Delete});else{const{step:a,length:u}=o;n.push({type:B.HorizontalMove,step:a,length:u})}return n},Nu=(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),u=i.Rectangle.getIntersects(n,e);if(!r&&!u)return[e];const l=new i.ObjectMatrix;return u&&i.Range.foreach(u,(c,m)=>{l.setValue(c,m-o,1)}),r&&i.Range.foreach(r,(c,m)=>{l.setValue(c,m-o,0)}),a.forEach(c=>{i.Range.foreach(c,(m,h)=>{l.setValue(m,h,1)})}),i.queryObjectMatrix(l,c=>c===1)},Sr=(s,e)=>{var r;const t=(r=s.params)==null?void 0:r.range;if(!t)return[];const n=[],o=Ze(he(t),he(e));if(!o)n.push({type:B.Delete});else{const{step:a,length:u}=o;n.push({type:B.VerticalMove,step:a,length:u})}return n},Ou=(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),u=i.Rectangle.getIntersects(n,e);if(!r&&!u)return[e];const l=new i.ObjectMatrix;return u&&i.Range.foreach(u,(c,m)=>{l.setValue(c-o,m,1)}),r&&i.Range.foreach(r,(c,m)=>{l.setValue(c-o,m,0)}),a.forEach(c=>{i.Range.foreach(c,(m,h)=>{l.setValue(m,h,1)})}),i.queryObjectMatrix(l,c=>c===1)},Du=(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,l=r.endRow-a+1;n.removeRows(a,l)}),i.queryObjectMatrix(n,r=>r===1)},Au=(s,e)=>{const t=s.params,n=t.range.startRow,o=t.range.endRow-t.range.startRow+1;return e.startRow>=n?[{startRow:e.startRow+o,endRow:e.endRow+o,startColumn:e.startColumn,endColumn:e.endColumn}]:e.endRow<n?[e]:[{startRow:e.startRow,endRow:e.endRow+o,startColumn:e.startColumn,endColumn:e.endColumn}]},Wu=(s,e)=>{const t=s.params,n=t.range.startColumn,o=t.range.endColumn-t.range.startColumn+1;return e.startColumn>=n?[{startRow:e.startRow,endRow:e.endRow,startColumn:e.startColumn+o,endColumn:e.endColumn+o}]:e.endColumn<n?[e]:[{startRow:e.startRow,endRow:e.endRow,startColumn:e.startColumn,endColumn:e.endColumn+o}]},et=(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},Us=(s,e)=>{let t=[];switch(e.id){case A.DeleteRangeMoveLeftCommandId:{t=Cr(e,s);break}case A.DeleteRangeMoveUpCommandId:{t=Sr(e,s);break}case A.InsertColCommandId:{t=hr(e,s);break}case A.InsertRangeMoveDownCommandId:{t=gr(e,s);break}case A.InsertRangeMoveRightCommandId:{t=Rr(e,s);break}case A.InsertRowCommandId:{t=mr(e,s);break}case A.MoveColsCommandId:{t=Es(e,s);break}case A.MoveRangeCommandId:{t=dr(e,s);break}case A.MoveRowsCommandId:{t=bs(e,s);break}case A.RemoveColCommandId:{t=Ts(e,s);break}case A.RemoveRowCommandId:{t=cr(e,s);break}case A.ReorderRangeCommandId:{t=Tu(e,s);break}}return et(t,s)},Vu=(s,e,t)=>[Be.id,He.id].includes(e.id)||Ir(e,t).some(r=>i.Rectangle.intersects(r,s))?Us(s,e):s,Ps=(s,e)=>{let t=[];switch(e.id){case A.DeleteRangeMoveLeftCommandId:return Nu(e,s);case A.DeleteRangeMoveUpCommandId:return Ou(e,s);case A.InsertRangeMoveDownCommandId:return Pu(e,s);case A.InsertRangeMoveRightCommandId:return ku(e,s);case A.InsertColCommandId:return Wu(e,s);case A.InsertRowCommandId:return Au(e,s);case A.MoveColsCommandId:return bu(e,s);case A.MoveRangeCommandId:return Eu(e,s);case A.MoveRowsCommandId:return yu(e,s);case A.ReorderRangeCommandId:return _u(e,s);case A.RemoveColCommandId:{t=Ts(e,s);break}case A.RemoveRowCommandId:return Du(e.params,s)}const n=et(t,s);return n?[n]:[]},$u=(s,e,t)=>[Be.id,He.id,xe.id,vs].includes(e.id)||Ir(e,t).some(r=>i.Rectangle.intersects(r,s))?Ps(s,e):s;function fr(s,e){const{id:t,params:n}=e;let o={length:0,step:0,type:B.Unknown};switch(t){case Xe.id:o.type=B.Delete;break;case pe.id:o=Ht({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 we.id:o=Ht({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=Ze(n.range,s),o?o.type=B.HorizontalMove:o={step:0,length:0,type:B.Delete};break;case ae.id:o=Ze(he(n.range),he(s)),o?o.type=B.VerticalMove:o={step:0,length:0,type:B.Delete};break;case re.id:o=Qe(he(n.range),he(s)),o.type=B.VerticalMove;break;case ie.id:o=Qe(n.range,s),o.type=B.HorizontalMove;break;case Le.id:{const r=n.fromRange||new i.ObjectMatrix(n.from).getRange(),a=n.toRange||new i.ObjectMatrix(n.to).getRange();o=Uu(r,a,s)}break}return o?Array.isArray(o)?et(o,s):et([o],s):s}function Ir(s,e){var n,o,r,a,u,l;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(m=>m.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)||((l=(u=t.getCurrentSelections())==null?void 0:u.map(m=>m.range))==null?void 0:l[0]);return c?[c]:[]}case A.ReorderRangeCommandId:{const d=s,{range:c,order:m}=d.params,h=[];for(let R=c.startRow;R<=c.endRow;R++)R in m&&h.push({startRow:R,endRow:R,startColumn:c.startColumn,endColumn:c.endColumn});return h}}}function Lu(s){switch(s.id){case we.id:{const e=s.params;return[e.sourceRange,{...e.targetRange,startColumn:e.targetRange.startColumn-.5,endColumn:e.targetRange.startColumn-.5}]}case pe.id:{const e=s.params;return[e.sourceRange,{...e.targetRange,startRow:e.targetRange.startRow-.5,endRow:e.targetRange.startRow-.5}]}case Le.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 Bu(s,e){var o,r,a,u,l,d;const t=s.get(i.IUniverInstanceService),n=s.get(g.SheetsSelectionsService);switch(e.id){case A.MoveColsCommandId:{const c=e.params,m=P(t,{unitId:c.unitId,subUnitId:c.subUnitId});return{unitId:m.unitId,subUnitId:m.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,m=P(t,{unitId:c.unitId,subUnitId:c.subUnitId});return{unitId:m.unitId,subUnitId:m.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,m=P(t);return{unitId:m.unitId,subUnitId:m.subUnitId,ranges:[c.fromRange,c.toRange]}}case A.InsertRowCommandId:{const c=e.params,m=c.range;return{unitId:c.unitId,subUnitId:c.subUnitId,ranges:[...m.startRow>0?[{...m,startRow:m.startRow-1,endRow:m.endRow-1}]:[],{...m,startRow:m.startRow,endRow:Number.MAX_SAFE_INTEGER}]}}case A.InsertColCommandId:{const c=e.params,m=c.range;return{unitId:c.unitId,subUnitId:c.subUnitId,ranges:[...m.startColumn>0?[{...m,startColumn:m.startColumn-1,endColumn:m.endColumn-1}]:[],{...m,startColumn:m.startColumn,endColumn:Number.MAX_SAFE_INTEGER}]}}case A.RemoveRowCommandId:{const m=e.params.range,h=P(t);return{unitId:h.unitId,subUnitId:h.subUnitId,ranges:[m,{...m,startRow:m.endRow+1,endRow:Number.MAX_SAFE_INTEGER}]}}case A.RemoveColCommandId:{const m=e.params.range,h=P(t);return{unitId:h.unitId,subUnitId:h.subUnitId,ranges:[m,{...m,startColumn:m.endColumn+1,endColumn:Number.MAX_SAFE_INTEGER}]}}case A.DeleteRangeMoveUpCommandId:case A.InsertRangeMoveDownCommandId:{const c=e,m=P(t),h=((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 h?{unitId:m.unitId,subUnitId:m.subUnitId,ranges:[h,{...h,startRow:h.endRow+1,endRow:Number.MAX_SAFE_INTEGER}]}:{unitId:m.unitId,subUnitId:m.subUnitId,ranges:[]}}case A.DeleteRangeMoveLeftCommandId:case A.InsertRangeMoveRightCommandId:{const m=((u=e.params)==null?void 0:u.range)||((d=(l=n.getCurrentSelections())==null?void 0:l.map(R=>R.range))==null?void 0:d[0]),h=P(t);return m?{unitId:h.unitId,subUnitId:h.subUnitId,ranges:[m,{...m,startColumn:m.endColumn+1,endColumn:Number.MAX_SAFE_INTEGER}]}:{unitId:h.unitId,subUnitId:h.subUnitId,ranges:[]}}case A.ReorderRangeCommandId:{const c=e,{range:m,order:h}=c.params,R=[];for(let S=m.startRow;S<=m.endRow;S++)S in h&&R.push({startRow:S,endRow:S,startColumn:m.startColumn,endColumn:m.endColumn});const C=P(t);return{unitId:C.unitId,subUnitId:C.subUnitId,ranges:R}}}}var Hu=Object.getOwnPropertyDescriptor,Fu=(s,e,t,n)=>{for(var o=n>1?void 0:n?Hu(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},Sn=(s,e)=>(t,n)=>e(t,n,s);const ju=i.createInterceptorKey("MERGE_REDO"),Gu=i.createInterceptorKey("MERGE_UNDO"),vr=Math.floor(Number.MAX_SAFE_INTEGER/10);class zu 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===Le.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===Xe.id)return;const a=Lu(e);if(a!=null&&a.some(u=>i.Rectangle.intersects(u,this._range)))return}const t=fr(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:ju,MERGE_UNDO:Gu}));f(this,"_watchRanges",new Set);f(this,"_refRangeManagerMap",new Map);f(this,"_serializer",qu());f(this,"_onRefRangeChange",()=>{this._sheetInterceptorService.interceptCommand({getMutations:t=>{const n=this._univerInstanceService.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET).getActiveSheet(),o=pr(this._univerInstanceService),r=wr(this._univerInstanceService);if(!n||!o||!r)return{redos:[],undos:[],preRedos:[],preUndos:[]};const l=((()=>{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:n.getColumnCount()-1}],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:n.getRowCount()-1}],o,r)}case A.MoveRangeCommandId:{const R=t;return this._checkRange([R.params.fromRange,R.params.toRange],o,r)}case A.InsertRowCommandId:{const S={startRow:t.params.range.startRow,endRow:n.getRowCount()-1,startColumn:0,endColumn:n.getColumnCount()-1,rangeType:i.RANGE_TYPE.ROW};return this._checkRange([S],o,r)}case A.InsertColCommandId:{const C=t.params.range.startColumn,S={startRow:0,endRow:n.getRowCount()-1,startColumn:C,endColumn:n.getColumnCount()-1,rangeType:i.RANGE_TYPE.COLUMN};return this._checkRange([S],o,r)}case A.RemoveRowCommandId:{const S={startRow:t.params.range.startRow,endRow:n.getRowCount()-1,startColumn:0,endColumn:n.getColumnCount()-1,rangeType:i.RANGE_TYPE.ROW};return this._checkRange([S],o,r)}case A.RemoveColCommandId:{const C=t.params.range.startColumn,S={startRow:0,endRow:n.getRowCount()-1,startColumn:C,endColumn:n.getColumnCount()-1,rangeType:i.RANGE_TYPE.COLUMN};return this._checkRange([S],o,r)}case A.DeleteRangeMoveUpCommandId:case A.InsertRangeMoveDownCommandId:{const C=t.params.range||Mr(this._selectionManagerService)[0],S={startRow:C.startRow,startColumn:C.startColumn,endColumn:C.endColumn,endRow:vr};return this._checkRange([S],o,r)}case A.DeleteRangeMoveLeftCommandId:case A.InsertRangeMoveRightCommandId:{const C=t.params.range||Mr(this._selectionManagerService)[0],S={startRow:C.startRow,startColumn:C.startColumn,endColumn:vr,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)(l.preRedos,null)||[],c=this.interceptor.fetchThroughInterceptors(this.interceptor.getInterceptPoints().MERGE_REDO)(l.redos,null)||[],m=this.interceptor.fetchThroughInterceptors(this.interceptor.getInterceptPoints().MERGE_UNDO)(l.preUndos,null)||[],h=this.interceptor.fetchThroughInterceptors(this.interceptor.getInterceptPoints().MERGE_UNDO)(l.undos,null)||[];return{redos:c,undos:h,preRedos:d,preUndos:m}}})});f(this,"_checkRange",(t,n,o)=>{const r=yr(n,o),a=this._refRangeManagerMap.get(r);if(a){const u=new Set;return[...a.keys()].forEach(d=>{const c=a.get(d),m=this._serializer.deserialize(d),h={...m,startRow:+m.startRow,endRow:+m.endRow,startColumn:+m.startColumn,endColumn:+m.endColumn,rangeType:m.rangeType&&+m.rangeType};t.some(R=>i.Rectangle.intersects(R,h))&&c&&c.forEach(R=>{u.add(R)})}),[...u]}return[]});f(this,"registerRefRange",(t,n,o,r)=>{const a=o||pr(this._univerInstanceService),u=r||wr(this._univerInstanceService);if(!a||!u)return i.toDisposable(()=>{});const l=yr(a,u),d=this._serializer.serialize(t);let c=this._refRangeManagerMap.get(l);c||(c=new Map,this._refRangeManagerMap.set(l,c));const m=c.get(d);return m?m.add(n):c.set(d,new Set([n])),i.toDisposable(()=>{const h=c.get(d);h&&(h.delete(n),h.size||(c.delete(d),c.size||this._refRangeManagerMap.delete(l)))})});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 u;this._watchRanges.size===0&&(u=this._commandService.onCommandExecuted(m=>{if(m.type!==i.CommandType.MUTATION)return!1;for(const h of this._watchRanges)h.onMutation(m)}));const l=new zu(t,n,o,r,a);this._watchRanges.add(l);const d=i.toDisposable(()=>{this._watchRanges.delete(l),this._watchRanges.size===0&&(u==null||u.dispose(),u=null)}),c=this.disposeWithMe(d);return i.toDisposable(()=>{c.dispose(),d.dispose()})}},g.RefRangeService=Fu([Sn(0,i.ICommandService),Sn(1,i.Inject(g.SheetInterceptorService)),Sn(2,i.Inject(i.IUniverInstanceService)),Sn(3,i.Inject(g.SheetsSelectionsService))],g.RefRangeService);function pr(s){return s.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET).getUnitId()}function wr(s){var e;return(e=s.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:e.getSheetId()}function Mr(s){var e;return((e=s.getCurrentSelections())==null?void 0:e.map(t=>t.range))||[]}function yr(s,e){return`${s}_${e}`}function qu(){const s=["startRow","startColumn","endRow","endColumn","rangeType"];return{deserialize:t=>{const n=s.reduce((r,a,u)=>(r[String(u)]=a,r),{});return t.split("_").reduce((r,a,u)=>{const l=String(u);return a&&n[l]&&(r[n[l]]=a),r},{})},serialize:t=>s.reduce((n,o,r)=>{const a=t[o];return a!==void 0?`${n}${r>0?"_":""}${a}`:`${n}`},"")}}var Yu=Object.getOwnPropertyDescriptor,Ku=(s,e,t,n)=>{for(var o=n>1?void 0:n?Yu(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},Mt=(s,e)=>(t,n)=>e(t,n,s);const Ju=[ie.id,re.id,ne.id,ae.id],xu=[pe.id,we.id];function ks(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:u,endColumn:l}=t[o];if(e===i.Dimension.ROWS)for(let d=r;d<=a;d++){const c={startRow:d,endRow:d,startColumn:u,endColumn:l};n.push(c)}else if(e===i.Dimension.COLUMNS)for(let d=u;d<=l;d++){const c={startRow:r,endRow:a,startColumn:d,endColumn:d};n.push(c)}}t=n}return t}const _r=i.createInterceptorKey("mergeCellPermissionCheck");g.MergeCellController=class extends i.Disposable{constructor(t,n,o,r,a,u){super();f(this,"disposableCollection",new i.DisposableCollection);f(this,"interceptor",new i.InterceptorManager({MERGE_CELL_INTERCEPTOR_CHECK:_r}));this._commandService=t,this._refRangeService=n,this._univerInstanceService=o,this._injector=r,this._sheetInterceptorService=a,this._selectionManagerService=u,this._onRefRangeChange(),this._initCommandInterceptor(),this._commandExecutedListener()}_initCommandInterceptor(){const t=this;this._sheetInterceptorService.interceptCommand({getMutations(n){var o;switch(n.id){case sn.id:case on.id:{const r=t._univerInstanceService.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET),a=r.getUnitId(),u=r==null?void 0:r.getActiveSheet();if(!u)return{redos:[],undos:[]};const l=u.getSheetId(),d=u.getConfig().mergeData,c=(o=t._selectionManagerService.getCurrentSelections())==null?void 0:o.map(m=>m.range);if(c&&c.length>0&&c.some(h=>d.some(R=>i.Rectangle.intersects(R,h)))){const h={unitId:a,subUnitId:l,ranges:c},R=ue(t._injector,h),C=[{id:G.id,params:h}],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=[],u=[],l={redos:a,undos:u};if(!r||!r.length)return l;const d=P(this._univerInstanceService,{unitId:n,subUnitId:o});if(!d)return l;const{worksheet:c}=d,h=c.getMergeData().filter(R=>r.some(C=>i.Rectangle.intersects(R,C)));return h.length?(a.push({id:G.id,params:{unitId:n,subUnitId:o,ranges:h}}),u.push({id:j.id,params:{unitId:n,subUnitId:o,ranges:h}}),{undos:u,redos:a}):l}})}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 Me.id:{const r=t.params,a=r.unitId||n,u=r.subUnitId||o;return this._handleInsertRowCommand(r,a,u)}case ye.id:{const r=t.params,a=r.unitId||n,u=r.subUnitId||o;return this._handleInsertColCommand(r,a,u)}case Lt.id:{const r=t.params;return this._handleRemoveColCommand(r,n,o)}case $t.id:{const r=t.params;return this._handleRemoveRowCommand(r,n,o)}case Je.id:{const r=t.params;return this._handleMoveRangeCommand(r,n,o)}case vt.id:{const r=t.params;return this._handleInsertRangeMoveRightCommand(r,n,o)}case xe.id:{const r=t.params;return this._handleInsertRangeMoveDownCommand(r,n,o)}case He.id:{const r=t.params;return this._handleDeleteRangeMoveUpCommand(r,n,o)}case Be.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 u=a.getMergeData(),l=d=>this.refRangeHandle(d,n,o);u.forEach(d=>{this.disposableCollection.add(this._refRangeService.registerRefRange(d,l,n,o))})};this.disposeWithMe(this._commandService.onCommandExecuted(n=>{if(n.id===Ct.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=_e(this._univerInstanceService,n);if(!r)return this._handleNull();const a=be(r,o);if(!a)return this._handleNull();const u=[...a.getMergeData()],l={unitId:n,subUnitId:o,ranges:[]},d={unitId:n,subUnitId:o,ranges:[]},{fromRange:c}=t,{startRow:m,endRow:h}=c;if(u.forEach(S=>{if(m<=S.startRow&&h>=S.endRow){l.ranges.push(S);const I=bs({id:A.MoveRowsCommandId,params:t},S),v=et(I,S);v&&d.ranges.push(v)}}),l.ranges.length===0)return this._handleNull();const R=ue(this._injector,l),C=ge(this._injector,d);return{preRedos:[{id:G.id,params:l}],redos:[{id:j.id,params:d}],preUndos:[{id:G.id,params:C}],undos:[{id:j.id,params:R}]}}_handleMoveColsCommand(t,n,o){const r=_e(this._univerInstanceService,n);if(!r)return this._handleNull();const a=be(r,o);if(!a)return this._handleNull();const u=[...a.getMergeData()],l={unitId:n,subUnitId:o,ranges:[]},d={unitId:n,subUnitId:o,ranges:[]},{fromRange:c}=t,{startColumn:m,endColumn:h}=c;if(u.forEach(S=>{if(m<=S.startColumn&&h>=S.endColumn){l.ranges.push(S);const I=Es({id:A.MoveColsCommandId,params:t},S),v=et(I,S);v&&d.ranges.push(v)}}),l.ranges.length===0)return this._handleNull();const R=ue(this._injector,l),C=ge(this._injector,d);return{preRedos:[{id:G.id,params:l}],redos:[{id:j.id,params:d}],preUndos:[{id:G.id,params:C}],undos:[{id:j.id,params:R}]}}_handleMoveRangeCommand(t,n,o){const r=_e(this._univerInstanceService,n);if(!r)return this._handleNull();const a=be(r,o);if(!a)return this._handleNull();const u=a.getMergeData(),l=u.filter(C=>i.Rectangle.intersects(C,t.fromRange)),d=u.filter(C=>i.Rectangle.intersects(C,t.toRange)),c=l.map(C=>i.Rectangle.getRelativeRange(C,t.fromRange)).map(C=>i.Rectangle.getPositionRange(C,t.toRange)),m=ks(c).filter(C=>!u.some(S=>i.Rectangle.equals(C,S))),h=[{id:G.id,params:{unitId:n,subUnitId:o,ranges:l}},{id:G.id,params:{unitId:n,subUnitId:o,ranges:d}},{id:j.id,params:{unitId:n,subUnitId:o,ranges:m}}],R=[{id:G.id,params:{unitId:n,subUnitId:o,ranges:m}},{id:j.id,params:{unitId:n,subUnitId:o,ranges:d}},{id:j.id,params:{unitId:n,subUnitId:o,ranges:l}}];return{redos:h,undos:R}}_handleInsertRowCommand(t,n,o){const r=_e(this._univerInstanceService,n);if(!r)return this._handleNull();const a=be(r,o);if(!a)return this._handleNull();const{range:u}=t,{startRow:l,endRow:d}=u,c=i.Tools.deepClone(a.getMergeData()).reduce((M,p)=>(l>p.startRow&&l<=p.endRow&&M.push(p),M),[]);if(c.length===0)return this._handleNull();const m=i.Tools.deepClone(a.getMergeData()).reduce((M,p)=>{if(l>p.startRow&&l<=p.endRow){const w=d-l+1;p.endRow+=w,this._checkIsMergeCell(p)&&M.push(p)}return M},[]),h={unitId:n,subUnitId:o,ranges:c},R=ue(this._injector,h),C={unitId:n,subUnitId:o,ranges:m},S=ge(this._injector,C),I=[{id:G.id,params:h},{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=_e(this._univerInstanceService,n);if(!a)return this._handleNull();const u=be(a,o);if(!u)return this._handleNull();const{startColumn:l,endColumn:d}=r,c=i.Tools.deepClone(u.getMergeData()).reduce((M,p)=>(l>p.startColumn&&l<=p.endColumn&&M.push(p),M),[]);if(c.length===0)return this._handleNull();const m=i.Tools.deepClone(u.getMergeData()).reduce((M,p)=>{if(l>p.startColumn&&l<=p.endColumn){const w=d-l+1;p.endColumn+=w,this._checkIsMergeCell(p)&&M.push(p)}return M},[]),h={unitId:n,subUnitId:o,ranges:c},R=ue(this._injector,h),C={unitId:n,subUnitId:o,ranges:m},S=ge(this._injector,C),I=[{id:G.id,params:h},{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=_e(this._univerInstanceService,n);if(!r)return this._handleNull();const a=be(r,o);if(!a)return this._handleNull();const{range:u}=t,{startColumn:l,endColumn:d}=u,c=i.Tools.deepClone(a.getMergeData()).reduce((w,y)=>(i.Rectangle.intersects(u,y)&&w.push(y),w),[]);if(c.length===0)return this._handleNull();const m=i.Tools.deepClone(a.getMergeData()).reduce((w,y)=>{if(i.Rectangle.intersects(u,y)){if(l<=y.startColumn&&d>=y.endColumn)return w;l>=y.startColumn&&d<=y.endColumn?y.endColumn-=d-l+1:l<y.startColumn?(y.startColumn=l,y.endColumn-=d-l+1):d>y.endColumn&&(y.endColumn=l-1),this._checkIsMergeCell(y)&&w.push(y)}return w},[]),h={unitId:n,subUnitId:o,ranges:c},R=ue(this._injector,h),C={unitId:n,subUnitId:o,ranges:m},S=ge(this._injector,C),I=[{id:G.id,params:h}],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=_e(this._univerInstanceService,n);if(!a)return this._handleNull();const u=be(a,o);if(!u)return this._handleNull();const{startRow:l,endRow:d}=r,c=i.Tools.deepClone(u.getMergeData()).reduce((w,y)=>(i.Rectangle.intersects(r,y)&&w.push(y),w),[]);if(c.length===0)return this._handleNull();const m=i.Tools.deepClone(u.getMergeData()).reduce((w,y)=>{if(i.Rectangle.intersects(r,y)){if(l<=y.startRow&&d>=y.endRow)return w;l>=y.startRow&&d<=y.endRow?y.endRow-=d-l+1:l<y.startRow?(y.startRow=l,y.endRow-=d-l+1):d>y.endRow&&(y.endRow=l-1),this._checkIsMergeCell(y)&&w.push(y)}return w},[]),h={unitId:n,subUnitId:o,ranges:c},R=ue(this._injector,h),C={unitId:n,subUnitId:o,ranges:m},S=ge(this._injector,C),I=[{id:G.id,params:h}],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=_e(this._univerInstanceService,n);if(!r)return this._handleNull();const a=be(r,o);if(!a)return this._handleNull();const u=t.range,l=a.getMaxColumns()-1,d=a.getMergeData(),c=[],m=[];d.forEach(I=>{const{startRow:v,endRow:M,startColumn:p,endColumn:w}=u;if(i.Rectangle.intersects({startRow:v,startColumn:p,endRow:M,endColumn:l},I)&&(c.push(I),i.Rectangle.contains({startRow:v,startColumn:p,endRow:M,endColumn:l},I))){const T=w-p+1;m.push({startRow:I.startRow,startColumn:I.startColumn+T,endRow:I.endRow,endColumn:I.endColumn+T})}});const h={unitId:n,subUnitId:o,ranges:c},R=ue(this._injector,h),C={unitId:n,subUnitId:o,ranges:m},S=ge(this._injector,C);return{preRedos:[{id:G.id,params:h}],redos:[{id:j.id,params:C}],preUndos:[{id:G.id,params:S}],undos:[{id:j.id,params:R}]}}_handleInsertRangeMoveDownCommand(t,n,o){const r=_e(this._univerInstanceService,n);if(!r)return this._handleNull();const a=be(r,o);if(!a)return this._handleNull();const u=t.range,l=a.getMaxRows()-1,d=a.getMergeData(),c=[],m=[];d.forEach(w=>{const{startRow:y,startColumn:b,endColumn:T,endRow:U}=u;if(i.Rectangle.intersects({startRow:y,startColumn:b,endRow:l,endColumn:T},w)&&(c.push(w),i.Rectangle.contains({startRow:y,startColumn:b,endRow:l,endColumn:T},w))){const N=U-y+1;m.push({startRow:w.startRow+N,startColumn:w.startColumn,endRow:w.endRow+N,endColumn:w.endColumn})}});const h={unitId:n,subUnitId:o,ranges:c},R=ue(this._injector,h),C={unitId:n,subUnitId:o,ranges:m},S=ge(this._injector,C),I=[{id:G.id,params:h}],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=_e(this._univerInstanceService,n);if(!r)return this._handleNull();const a=be(r,o);if(!a)return this._handleNull();const u=t.range,l=a.getMaxRows()-1,d=a.getMergeData(),c=[],m=[];d.forEach(w=>{const{startRow:y,startColumn:b,endColumn:T,endRow:U}=u;if(i.Rectangle.intersects({startRow:y,startColumn:b,endRow:l,endColumn:T},w)&&(c.push(w),i.Rectangle.contains({startRow:y,startColumn:b,endRow:l,endColumn:T},w))){const N=U-y+1,W=i.Rectangle.moveVertical(w,-N);m.push(W)}});const h={unitId:n,subUnitId:o,ranges:c},R=ue(this._injector,h),C={unitId:n,subUnitId:o,ranges:m},S=ge(this._injector,C),I=[{id:G.id,params:h}],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=_e(this._univerInstanceService,n);if(!r)return this._handleNull();const a=be(r,o);if(!a)return this._handleNull();const u=t.range,l=a.getMaxColumns()-1,d=a.getMergeData(),c=[],m=[];d.forEach(I=>{const{startRow:v,endRow:M,startColumn:p,endColumn:w}=u;if(i.Rectangle.intersects({startRow:v,startColumn:p,endRow:M,endColumn:l},I)&&(c.push(I),i.Rectangle.contains({startRow:v,startColumn:p,endRow:M,endColumn:l},I))){const T=w-p+1;m.push({startRow:I.startRow,startColumn:I.startColumn-T,endRow:I.endRow,endColumn:I.endColumn-T})}});const h={unitId:n,subUnitId:o,ranges:c},R=ue(this._injector,h),C={unitId:n,subUnitId:o,ranges:m},S=ge(this._injector,C);return{preRedos:[{id:G.id,params:h}],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(xu.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,u=r.startColumn===a.startColumn&&r.endColumn===a.endColumn,l=u?r.endRow-r.startRow+1:r.endColumn-r.startColumn+1,d=u?r.startRow:r.startColumn,c=u?a.startRow:a.startColumn,m=o.getConfig().mergeData,h=[];m.forEach(I=>{let{startRow:v,endRow:M,startColumn:p,endColumn:w,rangeType:y}=I;i.Rectangle.intersects(I,r)||(u?d<v&&c>M?(v-=l,M-=l):d>M&&c<=v&&(v+=l,M+=l):d<p&&c>w?(p-=l,w-=l):d>w&&c<=p&&(p+=l,w+=l)),I.startRow===I.endRow&&I.startColumn===I.endColumn||h.push({startRow:v,endRow:M,startColumn:p,endColumn:w,rangeType:y})}),o.setMergeData(h),this.disposableCollection.dispose();const{unitId:R,subUnitId:C}=t.params,S=I=>this.refRangeHandle(I,R,C);h.forEach(I=>{this.disposableCollection.add(this._refRangeService.registerRefRange(I,S,R,C))})}if(Ju.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:u}=a,l=t.id.includes("row"),d=t.id.includes("insert"),c=l?u.startRow:u.startColumn,m=l?u.endRow:u.endColumn,h=m-c+1,R=[];r.forEach(v=>{let{startRow:M,endRow:p,startColumn:w,endColumn:y,rangeType:b}=v;d?l?c<=M&&(M+=h,p+=h):c<=w&&(w+=h,y+=h):l?m<M&&(M-=h,p-=h):m<w&&(w-=h,y-=h),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=Ku([Mt(0,i.Inject(i.ICommandService)),Mt(1,i.Inject(g.RefRangeService)),Mt(2,i.Inject(i.IUniverInstanceService)),Mt(3,i.Inject(i.Injector)),Mt(4,i.Inject(g.SheetInterceptorService)),Mt(5,i.Inject(g.SheetsSelectionsService))],g.MergeCellController);function _e(s,e){return e?s.getUniverSheetInstance(e):s.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET)}function be(s,e){return e?s.getSheetBySheetId(e):s.getActiveSheet()}function Xu(s,e){return e.some(t=>Zu(s,t))}function Zu(s,e){const{startRow:t,startColumn:n,endColumn:o,endRow:r}=e,a=s.getMatrixWithMergedCells(t,n,r,o);let u=!1;return a.forValue((l,d,c)=>{if(c&&(l!==t||d!==n)&&s.cellHasValue(c))return u=!0,!1}),u}function Qu(s,e,t,n){const o=[],r=[],a=t.getSheetId();return n.forEach(u=>{const l=el(t,u),d={unitId:e,subUnitId:a,cellValue:l.getData()},c=ce(s,d);o.push({id:F.id,params:c}),r.push({id:F.id,params:d})}),{undos:o,redos:r}}function el(s,e){const{startRow:t,startColumn:n,endColumn:o,endRow:r}=e,a=s.getMatrixWithMergedCells(t,n,r,o,i.CellModeEnum.Raw),u=new i.ObjectMatrix;return a.forValue((l,d,c)=>{c&&(l!==t||d!==n)&&u.setValue(l,d,null)}),u}const Ft={type:i.CommandType.COMMAND,id:"sheet.command.add-worksheet-merge",handler:(s,e)=>{const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),o=s.get(i.IUniverInstanceService),r=e.unitId,a=e.subUnitId,u=e.selections,l=ks(u,e.value),d=o.getUniverSheetInstance(r).getSheetBySheetId(a),c=[],m=[],h=Xu(d,l),R={unitId:r,subUnitId:a,ranges:l},C={unitId:r,subUnitId:a,ranges:l};c.push({id:G.id,params:R}),c.push({id:j.id,params:C});const S=ue(s,R),I=ge(s,C);if(m.push({id:G.id,params:I}),m.push({id:j.id,params:S}),h){const M=Qu(s,r,d,l);c.unshift(...M.redos),m.push(...M.undos)}return i.sequenceExecute(c,t).result?(n.pushUndoRedo({unitID:r,undoMutations:m,redoMutations:c}),!0):!1}},tl={type:i.CommandType.COMMAND,id:"sheet.command.add-worksheet-merge-all",handler:async s=>{var d;const e=s.get(i.ICommandService),n=(d=s.get(g.SheetsSelectionsService).getCurrentSelections())==null?void 0:d.map(c=>c.range);if(!(n!=null&&n.length))return!1;const r=s.get(i.IUniverInstanceService).getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET);if(!r)return!1;const a=r.getActiveSheet();if(!a)return!1;const u=r.getUnitId(),l=a.getSheetId();return e.executeCommand(Ft.id,{selections:n,unitId:u,subUnitId:l})}},nl={type:i.CommandType.COMMAND,id:"sheet.command.add-worksheet-merge-vertical",handler:async s=>{var d;const e=s.get(i.ICommandService),n=(d=s.get(g.SheetsSelectionsService).getCurrentSelections())==null?void 0:d.map(c=>c.range);if(!(n!=null&&n.length))return!1;const r=s.get(i.IUniverInstanceService).getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET);if(!r)return!1;const a=r.getActiveSheet();if(!a)return!1;const u=r.getUnitId(),l=a.getSheetId();return e.executeCommand(Ft.id,{value:i.Dimension.COLUMNS,selections:n,unitId:u,subUnitId:l})}},sl={type:i.CommandType.COMMAND,id:"sheet.command.add-worksheet-merge-horizontal",handler:async s=>{var d;const e=s.get(i.ICommandService),n=(d=s.get(g.SheetsSelectionsService).getCurrentSelections())==null?void 0:d.map(c=>c.range);if(!(n!=null&&n.length))return!1;const r=s.get(i.IUniverInstanceService).getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET);if(!r)return!1;const a=r.getActiveSheet();if(!a)return!1;const u=r.getUnitId(),l=a.getSheetId();return e.executeCommand(Ft.id,{value:i.Dimension.ROWS,selections:n,unitId:u,subUnitId:l})}};function ol(s,e,t,n,o){const r=s.get(i.IUniverInstanceService),a=P(r,{unitId:e,subUnitId:t});if(!a)return;const{worksheet:u}=a;if(u.getMergeData().some(m=>n.some(h=>i.Rectangle.intersects(h,m))))throw new Error("The ranges to be merged overlap with the existing merged cells");s.get(i.ICommandService).executeCommand(Ft.id,{unitId:e,subUnitId:t,selections:n,defaultMerge:o})}class ke{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 u=o.get(a);u&&e[n].push(u)}))}),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 Fe={id:"sheet.mutation.add-worksheet-protection",type:i.CommandType.MUTATION,handler:(s,e)=>{const t=s.get(ke),{unitId:n,rule:o}=e;return t.addRule(n,o),!0}},tt={id:"sheet.mutation.delete-worksheet-protection",type:i.CommandType.MUTATION,handler:(s,e)=>{const t=s.get(ke),{unitId:n,subUnitId:o}=e;return t.deleteRule(n,o),!0}},br={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(Fe.id,{unitId:r,rule:o,subUnitId:o.subUnitId})){const l=[{id:Fe.id,params:{unitId:r,rule:o,subUnitId:o.subUnitId}}],d=[{id:tt.id,params:{unitId:r,subUnitId:a}}];n.pushUndoRedo({unitID:r,redoMutations:l,undoMutations:d})}return!0}},Er={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=io(s,e);return t.syncExecuteCommand(rt.id,e)?(n.pushUndoRedo({unitID:o,undoMutations:[{id:it.id,params:r}],redoMutations:[{id:rt.id,params:e}]}),!0):!1}},Tr={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:u,insertColumnNums:l,maxRows:d,maxColumns:c}=e,m={unitId:o,subUnitId:r,cellValue:a},h=ce(s,m),R=[{id:F.id,params:m}],C=[{id:F.id,params:h}];if(u){const I={unitId:o,subUnitId:r,range:{startRow:d,endRow:d,startColumn:0,endColumn:c-1}},v=en(s,I);R.unshift({id:re.id,params:I}),C.push({id:ae.id,params:v})}if(l){const I={unitId:o,subUnitId:r,range:{startRow:0,endRow:d-1,startColumn:c,endColumn:c-1+l}},v=Nt(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}},fn={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),u=t.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET);if(!u)return!1;const l=(e==null?void 0:e.unitId)||u.getUnitId(),d=u.getActiveSheet();if(!d)return!1;const c=(e==null?void 0:e.subUnitId)||d.getSheetId(),m=(e==null?void 0:e.ranges)||((p=o.getCurrentSelections())==null?void 0:p.map(w=>w.range));if(!(m!=null&&m.length))return!1;const h=Dt(m,s,l,c),R={subUnitId:c,unitId:l,cellValue:Uo(h)},C=ce(s,R),S=a.onCommandExecute({id:fn.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:l,undoMutations:v,redoMutations:I}),!0):!1}},Ns=(s,e)=>({subUnitId:e.sheet.id,unitId:e.unitId,subUnitName:e.sheet.name}),yt={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,u=t.getUniverSheetInstance(r);return u?(a&&u.addStyles(a),u.addWorksheet(n.id,o,n)):!1}},Os={type:i.CommandType.COMMAND,id:"sheet.command.copy-sheet",handler:(s,e)=>{var w,y;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),u=P(o,e);if(!u)return!1;const{workbook:l,worksheet:d,unitId:c,subUnitId:m}=u,h=i.Tools.deepClone(d.getConfig());h.name=rl(l,a,h.name),h.id=i.generateRandomId();const C={index:l.getSheetIndex(d)+1,sheet:h,unitId:c},S=Ns(s,C),I=r.onCommandExecute({id:Os.id,params:{unitId:c,subUnitId:m,targetSubUnitId:h.id}}),v=[...(w=I.preRedos)!=null?w:[],{id:yt.id,params:C},...I.redos],M=[...(y=I.preUndos)!=null?y:[],{id:Xe.id,params:S},...I.undos];return i.sequenceExecute(v,t).result?(n.pushUndoRedo({unitID:c,undoMutations:M,redoMutations:v}),!0):!1}};function rl(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 Ur={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,u={unitId:o,subUnitId:r,ruleIds:[a.id]};return await t.executeCommand(Te.id,u)&&n.pushUndoRedo({unitID:o,redoMutations:[{id:Te.id,params:u}],undoMutations:[{id:Ce.id,params:{unitId:o,subUnitId:r,rules:[a]}}]}),!0}},Pr={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(tt.id,{unitId:r,subUnitId:a});const u=[{id:tt.id,params:{unitId:r,subUnitId:a}}],l=[{id:Fe.id,params:{unitId:r,rule:o,subUnitId:a}}];return n.pushUndoRedo({unitID:r,redoMutations:u,undoMutations:l}),!0}},kr={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=ao(s,e);return t.syncExecuteCommand(it.id,e)?(n.pushUndoRedo({unitID:o,undoMutations:[{id:rt.id,params:r}],redoMutations:[{id:it.id,params:e}]}),!0):!1}},Nr={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(J.SetDefinedNameMutation.id,o)?(n.pushUndoRedo({unitID:e.unitId,undoMutations:[{id:J.RemoveDefinedNameMutation.id,params:o}],redoMutations:[{id:J.SetDefinedNameMutation.id,params:o}]}),!0):!1}},Or={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=Bn(o,{unitId:e==null?void 0:e.unitId});if(!a)return!1;const{unitId:u,workbook:l}=a;let d=l.getSheets().length;const c=e==null?void 0:e.sheet,m=c==null?void 0:c.id,h=i.mergeWorksheetSnapshotWithDefault(c||{});e?(d=(I=e.index)!=null?I:d,h.id=m||i.generateRandomId(),h.name=(c==null?void 0:c.name)||l.generateNewSheetName(`${r.t("sheets.tabs.sheet")}`)):(h.id=i.generateRandomId(),h.name=l.generateNewSheetName(`${r.t("sheets.tabs.sheet")}`));const R={index:d,sheet:h,unitId:u},C=Ns(s,R);return t.syncExecuteCommand(yt.id,R)?(n.pushUndoRedo({unitID:u,undoMutations:[{id:Xe.id,params:C}],redoMutations:[{id:yt.id,params:R}]}),!0):!1}},_t={id:"sheet.mutation.register-worksheet-range-theme-style",type:i.CommandType.MUTATION,handler:(s,e)=>{const{unitId:t,rangeThemeStyleJson:n,themeName:o}=e,r=s.get(i.IUniverInstanceService),a=P(r),u=s.get(g.SheetRangeThemeModel);if(!a)return!1;const l=new We(o,n);return u.registerRangeThemeStyle(t,l),!0}},In={id:"sheet.mutation.unregister-worksheet-range-theme-style",type:i.CommandType.MUTATION,handler:(s,e)=>{const{unitId:t,themeName:n}=e,o=s.get(i.IUniverInstanceService),r=P(o),a=s.get(g.SheetRangeThemeModel);return r?(a.unregisterRangeThemeStyle(t,n),!0):!1}},Dr={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))return!1;const l={unitId:t,themeName:n.getName(),rangeThemeStyleJson:n.toJson()},d={unitId:t,themeName:n.getName()};return r.syncExecuteCommand(_t.id,l)&&a.pushUndoRedo({unitID:t,undoMutations:[{id:In.id,params:d}],redoMutations:[{id:_t.id,params:l}]}),!0}},Ds={id:"sheet.command.remove-defined-name",type:i.CommandType.COMMAND,handler:(s,e)=>{var c,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=o.onCommandExecute({id:Ds.id,params:e}),u=[...(c=a.preRedos)!=null?c:[],{id:J.RemoveDefinedNameMutation.id,params:r},...a.redos],l=[...(m=a.preUndos)!=null?m:[],{id:J.SetDefinedNameMutation.id,params:r},...a.undos];return i.sequenceExecute(u,t)?(n.pushUndoRedo({unitID:e.unitId,undoMutations:l.filter(Boolean),redoMutations:u.filter(Boolean)}),!0):!1}},vn={id:"sheet.command.remove-sheet",type:i.CommandType.COMMAND,handler:(s,e)=>{var v,M;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{unitId:u,subUnitId:l,workbook:d,worksheet:c}=a;if(d.getSheets().length<=1)return!1;const m={subUnitId:l,unitId:u,subUnitName:c.getName()},h=rr(s,m),R=r.onCommandExecute({id:vn.id,params:{unitId:u,subUnitId:l}}),C=[...(v=R.preRedos)!=null?v:[],{id:Xe.id,params:m},...R.redos],S=[...(M=R.preUndos)!=null?M:[],{id:yt.id,params:h},...R.undos];return i.sequenceExecute(C,t).result?(n.pushUndoRedo({unitID:u,undoMutations:S,redoMutations:C}),!0):!1}},Ar={type:i.CommandType.COMMAND,id:"sheet.command.remove-worksheet-merge",handler:(s,e)=>{var N;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)||((N=t.getCurrentSelections())==null?void 0:N.map(W=>W.range));if(!(a!=null&&a.length))return!1;const u=P(r);if(!u)return!1;const{subUnitId:l,unitId:d,worksheet:c}=u,m={unitId:d,subUnitId:l,ranges:a},R=c.getConfig().mergeData.filter(W=>a.some(V=>i.Rectangle.intersects(V,W)));if(!R.length)return!1;const C=ue(s,m),S=t.getCurrentSelections();if(!(S!=null&&S.length))return!1;const I=i.Tools.deepClone(S),v=i.Tools.deepClone(S),M=v[v.length-1],{startRow:p,startColumn:w}=M.range;M.primary={startRow:p,startColumn:w,endRow:p,endColumn:w,actualRow:p,actualColumn:w,isMerged:!1,isMergedMainCell:!1};const y=il(c,R),b={unitId:d,subUnitId:l,cellValue:y.redoParams.getMatrix()},T={unitId:d,subUnitId:l,cellValue:y.undoParams.getMatrix()},U=[{id:G.id,params:C},{id:F.id,params:b},{id:q.id,params:{selections:v}}],k=[{id:j.id,params:C},{id:F.id,params:T},{id:q.id,params:{selections:I}}];return i.sequenceExecute(U,n)?(o.pushUndoRedo({unitID:d,undoMutations:k,redoMutations:U}),!0):!1}};function il(s,e){const t=new i.ObjectMatrix,n=new i.ObjectMatrix;return e.forEach(o=>{const{startRow:r,startColumn:a,endColumn:u,endRow:l}=o,d=s.getCellMatrix().getValue(r,a);if(d!=null&&d.s)for(let c=r;c<=l;c++)for(let m=a;m<=u;m++)(c!==r||m!==a)&&(t.setValue(c,m,{s:d.s}),n.setValue(c,m,null))}),{redoParams:t,undoParams:n}}class nt{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 pn(s,e){const{startRow:t,startColumn:n,endRow:o,endColumn:r}=s;for(let a=t;a<=o;a++)for(let u=n;u<=r;u++)e(a,u)}const As=(s,e,t,n)=>{const{mr:o,worksheet:r}=s;e.startRow<0||e.startColumn<0||pn(e,(a,u)=>{var c,m;const l=r.getMergedCell(a,u);let d=t;if(l&&(t.bc_tr||t.ml_tr||t.bl_tr||t.tl_mr||t.tl_bc||t.tl_br)){if(n){const h=i.Tools.deepClone((c=o.getValue(l.startRow,l.startColumn))==null?void 0:c.s);d=h!=null&&h.bd?Object.assign(h.bd,t):t}o.setValue(l.startRow,l.startColumn,{s:{bd:d}})}else{if(n){const h=i.Tools.deepClone((m=o.getValue(a,u))==null?void 0:m.s);d=h!=null&&h.bd?Object.assign(h.bd,t):t}o.setValue(a,u,{s:{bd:d}})}})},al=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},u={startRow:s.endRow,startColumn:s.startColumn,endRow:s.endRow,endColumn:s.endColumn},l={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:u,rightRange:l}};function ul(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,u=r===i.BorderType.LEFT||r===i.BorderType.ALL||r===i.BorderType.OUTSIDE,l=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,m=r===i.BorderType.HORIZONTAL||r===i.BorderType.ALL||r===i.BorderType.INSIDE,h=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:T,leftRange:U,bottomRange:k,rightRange:E}=al(M),N=new i.ObjectMatrix,{worksheet:W,unitId:V,subUnitId:$}=e;return{worksheet:W,unitId:V,subUnitId:$,style:n,color:o,type:r,top:a,left:u,right:d,bottom:l,vertical:c,horizontal:m,tl_br:h,tl_bc:R,tl_mr:C,bl_tr:S,ml_tr:I,bc_tr:v,topRangeOut:p,leftRangeOut:w,bottomRangeOut:y,rightRangeOut:b,topRange:T,leftRange:U,bottomRange:k,rightRange:E,range:M,mr:N,borderStyle:{s:n,cl:{rgb:o}}}}const ll=s=>{const{range:e,mr:t,borderStyle:n,vertical:o,horizontal:r,worksheet:a}=s;o&&pn(e,(u,l)=>{var c,m,h;const d=a.getMergedCell(u,l);if(d){const R=(c=t.getValue(d.startRow,d.startColumn))==null?void 0:c.s;d.startColumn!==e.startColumn&&t.setValue(u,l,{s:{bd:R!=null&&R.bd?Object.assign(R.bd,{l:i.Tools.deepClone(n)}):{l:i.Tools.deepClone(n)}}})}else{if(l!==e.endColumn){const R=(m=t.getValue(u,l))==null?void 0:m.s;t.setValue(u,l,{s:{bd:R!=null&&R.bd?Object.assign(R.bd,{r:i.Tools.deepClone(n)}):{r:i.Tools.deepClone(n)}}})}if(l!==e.startColumn){const R=(h=t.getValue(u,l))==null?void 0:h.s;t.setValue(u,l,{s:{bd:R!=null&&R.bd?Object.assign(R.bd,{l:i.Tools.deepClone(n)}):{l:i.Tools.deepClone(n)}}})}}}),r&&pn(e,(u,l)=>{var c,m,h;const d=a.getMergedCell(u,l);if(d){const R=(c=t.getValue(d.startRow,d.startColumn))==null?void 0:c.s;d.startRow!==e.startRow&&t.setValue(u,l,{s:{bd:R!=null&&R.bd?Object.assign(R.bd,{t:i.Tools.deepClone(n)}):{t:i.Tools.deepClone(n)}}})}else{if(u!==e.endRow){const R=(m=t.getValue(u,l))==null?void 0:m.s;t.setValue(u,l,{s:{bd:R!=null&&R.bd?Object.assign(R.bd,{b:i.Tools.deepClone(n)}):{b:i.Tools.deepClone(n)}}})}if(u!==e.startRow){const R=(h=t.getValue(u,l))==null?void 0:h.s;t.setValue(u,l,{s:{bd:R!=null&&R.bd?Object.assign(R.bd,{t:i.Tools.deepClone(n)}):{t:i.Tools.deepClone(n)}}})}}})};function dl(s){const{borderStyle:e,tl_br:t,tl_bc:n,tl_mr:o,bl_tr:r,ml_tr:a,bc_tr:u}=s,l=(d,c,m)=>{As(s,d,c,m)};t&&l(s.range,{tl_br:i.Tools.deepClone(e)},!0),n&&l(s.range,{tl_bc:i.Tools.deepClone(e)},!0),o&&l(s.range,{tl_mr:i.Tools.deepClone(e)},!0),r&&l(s.range,{bl_tr:i.Tools.deepClone(e)},!0),a&&l(s.range,{ml_tr:i.Tools.deepClone(e)},!0),u&&l(s.range,{bc_tr:i.Tools.deepClone(e)},!0)}const cl=s=>{const{top:e,left:t,right:n,bottom:o,borderStyle:r,bottomRange:a,topRange:u,leftRange:l,rightRange:d,bottomRangeOut:c,topRangeOut:m,leftRangeOut:h,rightRangeOut:R}=s,C=(S,I,v)=>{As(s,S,I,v)};e&&(C(m,{b:null}),C(u,{t:i.Tools.deepClone(r)},!0)),o&&(C(c,{t:null}),C(a,{b:i.Tools.deepClone(r)},!0)),t&&(C(h,{r:null}),C(l,{l:i.Tools.deepClone(r)},!0)),n&&(C(R,{l:null}),C(d,{r:i.Tools.deepClone(r)},!0))},ml=s=>{const{range:e,worksheet:t,mr:n,top:o,bottom:r,left:a,right:u,vertical:l,horizontal:d,tl_br:c,tl_bc:m,tl_mr:h,bl_tr:R,ml_tr:C,bc_tr:S,topRange:I,bottomRange:v,leftRange:M,rightRange:p,topRangeOut:w,bottomRangeOut:y,leftRangeOut:b,rightRangeOut:T}=s,U=(k,E,N)=>{As(s,k,E,N)};!o&&!r&&!a&&!u&&!l&&!d&&!c&&!m&&!h&&!R&&!C&&!S&&(pn(e,(k,E)=>{var W,V,$,L,Y,z,K,oe;const N=t.getMergedCell(k,E);if(N){if(N.endColumn!==e.endColumn){const H=(W=n.getValue(N.startRow,N.startColumn))==null?void 0:W.s;n.setValue(k,E,{s:{bd:H!=null&&H.bd?Object.assign(H.bd,{r:null}):{r:null}}})}if(N.startColumn!==e.startColumn){const H=(V=n.getValue(N.startRow,N.startColumn))==null?void 0:V.s;n.setValue(k,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(k,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(k,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(k,E))==null?void 0:Y.s;n.setValue(k,E,{s:{bd:H!=null&&H.bd?Object.assign(H.bd,{r:null}):{r:null}}})}if(E!==e.startColumn){const H=(z=n.getValue(k,E))==null?void 0:z.s;n.setValue(k,E,{s:{bd:H!=null&&H.bd?Object.assign(H.bd,{l:null}):{l:null}}})}if(k!==e.endRow){const H=(K=n.getValue(k,E))==null?void 0:K.s;n.setValue(k,E,{s:{bd:H!=null&&H.bd?Object.assign(H.bd,{b:null}):{b:null}}})}if(k!==e.startRow){const H=(oe=n.getValue(k,E))==null?void 0:oe.s;n.setValue(k,E,{s:{bd:H!=null&&H.bd?Object.assign(H.bd,{t:null}):{t:null}}})}}}),U(w,{b:null}),U(I,{t:null},!0),U(y,{t:null}),U(v,{b:null},!0),U(b,{r:null}),U(M,{l:null},!0),U(T,{l:null}),U(p,{r:null},!0),U(e,{tl_br:null},!0),U(e,{tl_bc:null},!0),U(e,{tl_mr:null},!0),U(e,{bl_tr:null},!0),U(e,{ml_tr:null},!0),U(e,{bc_tr:null},!0))},bt={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(nt),u=P(o,e);if(!u)return!1;const l=(e==null?void 0:e.ranges)||((v=r.getCurrentSelections())==null?void 0:v.map(M=>M.range));if(!(l!=null&&l.length))return!1;const{activeBorderType:d}=a.getBorderInfo();if(!d)return!1;const c=ul(a,u,l);ll(c),cl(c),dl(c),ml(c);const{unitId:m,subUnitId:h,mr:R}=c,C={unitId:m,subUnitId:h,cellValue:R.getData()},S=ce(s,C);return t.syncExecuteCommand(F.id,C)?(n.pushUndoRedo({unitID:m,undoMutations:[{id:F.id,params:S}],redoMutations:[{id:F.id,params:C}]}),!0):!1}},Wr={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(nt).setType(e.value),t.syncExecuteCommand(bt.id)}},Vr={id:"sheet.command.set-border-style",type:i.CommandType.COMMAND,handler:(s,e)=>{const t=s.get(i.ICommandService);return s.get(nt).setStyle(e.value),t.syncExecuteCommand(bt.id)}},$r={id:"sheet.command.set-border-color",type:i.CommandType.COMMAND,handler:(s,e)=>{const t=s.get(i.ICommandService);return s.get(nt).setColor(e.value),t.syncExecuteCommand(bt.id)}},Lr={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:u,style:l}=o,d=s.get(i.ICommandService),c=s.get(nt);return c.setType(a),u&&c.setColor(u),c.setStyle(l),d.syncExecuteCommand(bt.id,{unitId:t,subUnitId:n,ranges:r})}},Br={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:u,subUnitId:l,worksheet:d}=r,c={subUnitId:l,unitId:u,columnData:a},m=mo(c,d);return t.syncExecuteCommand(at.id,c)?(n.pushUndoRedo({unitID:u,undoMutations:[{id:at.id,params:m}],redoMutations:[{id:at.id,params:c}]}),!0):!1}},Et={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),u=s.get(i.IUniverInstanceService),l=P(u,{unitId:t,subUnitId:n});if(!l)return!1;const{worksheet:d}=l,c={unitId:t,subUnitId:n,ranges:o},m={unitId:t,subUnitId:n,reveal:!0,selections:o.map(p=>({range:p,primary:se(p,d),style:null}))},h=ga(s,c),R={unitId:t,subUnitId:n,selections:Hr(o).map(p=>({range:p,primary:se(p,d),style:null}))},C=i.sequenceExecute([{id:lt.id,params:c},{id:q.id,params:m}],a),S=r.onCommandExecute({id:Et.id,params:e}),I=i.sequenceExecute([...S.redos],a);if(C.result&&I.result){const p=r.afterCommandExecute({id:Et.id,params:e});return i.sequenceExecute(p.redos,a),s.get(i.IUndoRedoService).pushUndoRedo({unitID:t,undoMutations:[{id:ut.id,params:h},{id:q.id,params:R},...(v=S.undos)!=null?v:[],...p.undos],redoMutations:[...(M=S.preRedos)!=null?M:[],{id:lt.id,params:c},{id:q.id,params:m},...S.redos,...p.redos]}),!0}return!0}},Ws={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:u}=o,l=n.map(c=>r.getHiddenCols(c.startColumn,c.endColumn)).flat();return t.executeCommand(Et.id,{unitId:a,subUnitId:u,ranges:l})}},wn={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 u=P(o,e);if(!u)return!1;const{worksheet:l,unitId:d,subUnitId:c}=u;a=hl(u.worksheet,a);const m={unitId:d,subUnitId:c,ranges:a},h={unitId:d,subUnitId:c,selections:Hr(a).map(b=>({range:b,primary:se(b,l),style:null}))},R=ha(s,m),C={unitId:d,subUnitId:c,reveal:!0,selections:a.map(b=>({range:b,primary:se(b,l),style:null}))},S=i.sequenceExecute([{id:ut.id,params:m},{id:q.id,params:h}],r),I=n.onCommandExecute({id:wn.id,params:m}),v=i.sequenceExecute([...I.redos],r);if(S.result&&v.result){const b=n.afterCommandExecute({id:wn.id,params:m});return i.sequenceExecute(b.redos,r),s.get(i.IUndoRedoService).pushUndoRedo({unitID:d,undoMutations:[{id:lt.id,params:R},{id:q.id,params:C},...(w=I.undos)!=null?w:[],...b.undos],redoMutations:[...(y=I.preRedos)!=null?y:[],{id:ut.id,params:m},{id:q.id,params:h},...I.redos,...b.redos]}),!0}return!1}};function hl(s,e){const t=s.getRowCount()-1,n=s.getHiddenCols(),o=[];return e.forEach(r=>{const a=n.filter(u=>u.startColumn>=r.startColumn&&u.endColumn<=r.endColumn);if(a.length){let u=r.startColumn;a.forEach(l=>{l.startColumn>u&&(o.push({startColumn:u,endColumn:l.startColumn-1,startRow:0,endRow:t}),u=l.endColumn+1)}),u<=r.endColumn&&o.push({startColumn:u,endColumn:r.endColumn,startRow:0,endRow:t})}else o.push(r)}),o}function Hr(s){return gl(s).map(t=>{const n=t.startColumn===0?t.endColumn+1:t.startColumn-1;return{...t,startColumn:n,endColumn:n}})}function gl(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 Vs={id:"sheet.command.set-defined-name",type:i.CommandType.COMMAND,handler:(s,e)=>{var m,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=J.SetDefinedNameMutationFactory(s,e),u=o.onCommandExecute({id:Vs.id,params:e}),l=[...(m=u.preRedos)!=null?m:[],{id:J.RemoveDefinedNameMutation.id,params:a},{id:J.SetDefinedNameMutation.id,params:r},...u.redos],d=[...(h=u.preUndos)!=null?h:[],{id:J.RemoveDefinedNameMutation.id,params:r},{id:J.SetDefinedNameMutation.id,params:a},...u.undos];return i.sequenceExecute(l,t)?(n.pushUndoRedo({unitID:e.unitId,undoMutations:d.filter(Boolean),redoMutations:l.filter(Boolean)}),!0):!1}},$s=(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}},Ne={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:u,ySplit:l,xSplit:d}=e;return r.freeze={startRow:a,startColumn:u,ySplit:l,xSplit:d},!0}},Fr={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:u,worksheet:l}=r,{startColumn:d,startRow:c,xSplit:m,ySplit:h}=e;if(c>=l.getRowCount()||d>=l.getColumnCount()||m>=l.getColumnCount()||h>=l.getRowCount())return!1;const R={unitId:a,subUnitId:u,...e},C=$s(s,R);return t.syncExecuteCommand(Ne.id,R)?(n.pushUndoRedo({unitID:a,undoMutations:[{id:Ne.id,params:C}],redoMutations:[{id:Ne.id,params:R}]}),!0):!1}},jr={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:u}=r,l={unitId:a,subUnitId:u,startRow:-1,startColumn:-1,xSplit:0,ySplit:0},d=$s(s,l);return t.syncExecuteCommand(Ne.id,l)&&o.pushUndoRedo({unitID:a,undoMutations:[{id:Ne.id,params:d}],redoMutations:[{id:Ne.id,params:l}]}),!0}},Gr={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);if(!r)return!1;const{worksheet:a}=r,u=a.getConfig().gridlinesColor;if(u===(e==null?void 0:e.color))return!1;const{unitId:l,subUnitId:d}=r,c={color:e==null?void 0:e.color,unitId:l,subUnitId:d},m={color:u,unitId:l,subUnitId:d};return t.syncExecuteCommand(dt.id,c)?(n.pushUndoRedo({unitID:l,undoMutations:[{id:dt.id,params:m}],redoMutations:[{id:dt.id,params:c}]}),!0):!1}},Q={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}},Rl=(s,e)=>{const{unitId:t,subUnitId:n,ruleId:o}=e,a=s.get(X).getRule(t,n,o);return a?{id:Q.id,params:{...e,rule:a}}:null},st={id:"sheet.mutation.set-worksheet-protection",type:i.CommandType.MUTATION,handler:(s,e)=>{const{unitId:t,subUnitId:n,rule:o}=e;return s.get(ke).setRule(t,n,o),!0}},zr={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:u,subUnitId:l}=r,d=[],c=[];return(a==null?void 0:a.unitType)===r.unitType?r.unitType===D.Worksheet?(d.push({id:st.id,params:{unitId:u,subUnitId:l,rule:r}}),c.push({id:st.id,params:{unitId:u,subUnitId:l,rule:a}})):(d.push({id:Q.id,params:{unitId:u,subUnitId:l,rule:r,ruleId:r.id}}),c.push({id:Q.id,params:{unitId:u,subUnitId:l,ruleId:a.id,rule:a}})):(a&&(a.unitType===D.Worksheet?(d.push({id:tt.id,params:{unitId:u,subUnitId:l}}),c.push({id:Fe.id,params:{unitId:u,rule:a,subUnitId:a.subUnitId}})):a.unitType===D.SelectRange&&(d.push({id:Te.id,params:{unitId:u,subUnitId:l,ruleIds:[a.id]}}),c.push({id:Ce.id,params:{unitId:u,subUnitId:l,rules:[a]}}))),r.unitType===D.Worksheet?(d.push({id:Fe.id,params:{unitId:u,rule:r,subUnitId:r.subUnitId}}),c.unshift({id:tt.id,params:{unitId:u,subUnitId:l}})):r.unitType===D.SelectRange&&(r.id=o.createRuleId(u,l),d.push({id:Ce.id,params:{unitId:u,subUnitId:l,rules:[r]}}),c.unshift({id:Te.id,params:{unitId:u,subUnitId:l,ruleIds:[r.id]}}))),i.sequenceExecute(d,t)&&n.pushUndoRedo({unitID:u,undoMutations:c,redoMutations:d}),!0}},qr={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:u,subUnitId:l,worksheet:d}=r,c={subUnitId:l,unitId:u,rowData:a},m=Ro(c,d);return t.syncExecuteCommand(ct.id,c)?(n.pushUndoRedo({unitID:u,undoMutations:[{id:ct.id,params:m}],redoMutations:[{id:ct.id,params:c}]}),!0):!1}},Tt={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),u=s.get(g.SheetInterceptorService),l=P(s.get(i.IUniverInstanceService),{unitId:t,subUnitId:n});if(!l)return!1;const{worksheet:d}=l,c={unitId:t,subUnitId:n,ranges:o},m={unitId:t,subUnitId:n,reveal:!0,selections:o.map(w=>({range:w,primary:se(w,d),style:null}))},h=ya(s,c),R={unitId:t,subUnitId:n,selections:Yr(o).map(w=>({range:w,primary:se(w,d),style:null}))},C=i.sequenceExecute([{id:Ye.id,params:c},{id:q.id,params:m}],r),S=u.onCommandExecute({id:Tt.id,params:e}),I=i.sequenceExecute([...S.redos],r);if(C.result&&I.result){const w=u.afterCommandExecute({id:Tt.id,params:e});return i.sequenceExecute(w.redos,r),a.pushUndoRedo({unitID:t,undoMutations:[...(v=S.preUndos)!=null?v:[],{id:Ke.id,params:h},{id:q.id,params:R},...(M=S.undos)!=null?M:[],...w.undos],redoMutations:[...(p=S.preRedos)!=null?p:[],{id:Ye.id,params:c},{id:q.id,params:m},...S.redos,...w.redos]}),!0}return!0}},Ls={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(m=>m.range).filter(m=>m.rangeType===i.RANGE_TYPE.ROW);if(!(o!=null&&o.length))return!1;const r=P(t);if(!r)return!1;const{worksheet:a,unitId:u,subUnitId:l}=r,d=o.map(m=>a.getHiddenRows(m.startRow,m.endRow)).flat();return n.executeCommand(Tt.id,{unitId:u,subUnitId:l,ranges:d})}},Mn={type:i.CommandType.COMMAND,id:"sheet.command.set-rows-hidden",handler:(s,e)=>{var M,p,w,y,b,T;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 u=(M=e==null?void 0:e.ranges)!=null&&M.length?e.ranges:(p=t.getCurrentSelections())==null?void 0:p.map(U=>U.range).filter(U=>U.rangeType===i.RANGE_TYPE.ROW);if(!(u!=null&&u.length))return!1;const l=P(r,e);if(!l)return!1;u=Cl(l.worksheet,u);const{unitId:d,subUnitId:c,worksheet:m}=l,h={unitId:d,subUnitId:c,ranges:u},R={unitId:d,subUnitId:c,selections:Yr(u).map(U=>({range:U,primary:se(U,m),style:null}))},C=_a(s,h),S={unitId:d,subUnitId:c,reveal:!0,selections:u.map(U=>({range:U,primary:se(U,m),style:null}))},I=a.onCommandExecute({id:Mn.id,params:h});if(i.sequenceExecute([...(w=I.preRedos)!=null?w:[],{id:Ke.id,params:h},{id:q.id,params:R},...I.redos],n).result){const U=a.afterCommandExecute({id:Mn.id,params:h});return i.sequenceExecute(U.redos,n),o.pushUndoRedo({unitID:d,undoMutations:[...(y=I.preUndos)!=null?y:[],{id:Ye.id,params:C},{id:q.id,params:S},...(b=I.undos)!=null?b:[],...U.undos],redoMutations:[...(T=I.preRedos)!=null?T:[],{id:Ke.id,params:h},{id:q.id,params:R},...I.redos,...U.redos]}),!0}return!0}};function Cl(s,e){const t=s.getMaxColumns()-1,n=s.getHiddenRows(),o=[];return e.forEach(r=>{const a=n.filter(u=>u.startRow>=r.startRow&&u.endRow<=r.endRow);if(a.length){let u=r.startRow;a.forEach(l=>{l.startRow>u&&(o.push({startRow:u,endRow:l.startRow-1,startColumn:0,endColumn:t}),u=l.endRow+1)}),u<=r.endRow&&o.push({startRow:u,endRow:r.endRow,startColumn:0,endColumn:t})}else o.push(r)}),o}function Yr(s){return Sl(s).map(t=>{const n=t.startRow===0?t.endRow+1:t.startRow-1;return{...t,startRow:n,endRow:n}})}function Sl(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 fl=["ff","fs","tr","tb"],ee={type:i.CommandType.COMMAND,id:"sheet.command.set-style",handler:(s,e)=>{var k;const t=s.get(i.IUniverInstanceService),n=P(t,e);if(!n)return!1;const{unitId:o,subUnitId:r,worksheet:a}=n,{range:u,style:l}=e,d=s.get(i.ICommandService),c=s.get(i.IUndoRedoService),m=s.get(g.SheetsSelectionsService),h=u?[u]:(k=m.getCurrentSelections())==null?void 0:k.map(E=>E.range);if(!(h!=null&&h.length))return!1;const R=new i.ObjectMatrix,C=uu(a);if(i.Tools.isArray(l.value))for(let E=0;E<h.length;E++)C.forOperableEach(h[E],(N,W,V)=>{R.setValue(N,W,{s:{[l.type]:l.value[N-V.startRow][W-V.startColumn]}})});else for(let E=0;E<h.length;E++){const N={s:{[l.type]:l.value}};C.forOperableEach(h[E],(W,V)=>R.setValue(W,V,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(fl.includes(e==null?void 0:e.style.type)){const{suitableRanges:E,remainingRanges:N}=Bt(h,I),W=_s(E,a),{undos:V,redos:$}=p.generateMutationsOfAutoHeight({unitId:o,subUnitId:r,ranges:E,autoHeightRanges:E,lazyAutoHeightRanges:N,cellHeights:W});w=V,y=$}const{undos:b,redos:T}=p.onCommandExecute({id:ee.id,params:e}),U=i.sequenceExecute([...T,...y],d);return M&&U.result?(c.pushUndoRedo({unitID:S.unitId,undoMutations:[{id:F.id,params:v},...b,...w],redoMutations:[{id:F.id,params:S},...T,...y]}),!0):!1}},Il={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,u={style:{type:"bl",value:n.getRange(o,r).getFontWeight()===i.FontWeight.BOLD?i.BooleanNumber.FALSE:i.BooleanNumber.TRUE}};return s.get(i.ICommandService).syncExecuteCommand(ee.id,u)}},vl={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:u}=e.primary;o=n.getRange(a,u).getFontStyle()===i.FontItalic.ITALIC}const r={style:{type:"it",value:o?i.BooleanNumber.FALSE:i.BooleanNumber.TRUE}};return s.get(i.ICommandService).syncExecuteCommand(ee.id,r)}},pl={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(ee.id,r)}},wl={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(ee.id,r)}},Ml={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(ee.id,r)}},yl={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(ee.id,n)}},_l={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(ee.id,n)}},Kr={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(ee.id,n)}},Jr={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(ee.id,t)}},xr={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(ee.id,n)}},Xr={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(ee.id,t)}},Zr={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(ee.id,n)}},Qr={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(ee.id,n)}},ei={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(ee.id,n)}},ti={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(ee.id,o)}},bl=(s,e)=>{const r=s.get(i.IUniverInstanceService).getUniverSheetInstance(e.unitId).getSheetBySheetId(e.subUnitId).getConfig().tabColor;return{...i.Tools.deepClone(e),color:r}},jt={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}},ni={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,u={color:e.value,unitId:r,subUnitId:a},l=bl(s,u);return t.syncExecuteCommand(jt.id,u)?(n.pushUndoRedo({unitID:r,undoMutations:[{id:jt.id,params:l}],redoMutations:[{id:jt.id,params:u}]}),!0):!1}},Bs={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}},Hs={type:i.CommandType.COMMAND,id:"sheet.command.set-workbook-name",handler:(s,e)=>{var l;const t=s.get(i.ICommandService),n=s.get(g.SheetInterceptorService);if(!Bn(s.get(i.IUniverInstanceService),e))return!1;const r=n.onCommandExecute({id:Hs.id,params:e}),a={name:e.name,unitId:e.unitId},u=[...(l=r.preRedos)!=null?l:[],{id:Bs.id,params:a},...r.redos];return i.sequenceExecute(u,t).result}},El=4,Fs={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(u=>{setTimeout(()=>{const l=n.syncExecuteCommand(Ct.id,{unitId:r,subUnitId:a},t);u(l)},El)})}},Gt={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:u,unitId:l,subUnitId:d}=a,{anchorCol:c,deltaX:m}=e,R=u.getColumnWidth(c)+m,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=u.getRowCount(),Y=new Array(u.getColumnCount()).fill(void 0).map((z,K)=>({startRow:0,endRow:L-1,startColumn:K,endColumn:K}));v={subUnitId:d,unitId:l,colWidth:R,ranges:Y}}else I===i.RANGE_TYPE.COLUMN?v={subUnitId:d,unitId:l,ranges:S.map(L=>i.Rectangle.clone(L.range)),colWidth:R}:v={subUnitId:d,unitId:l,colWidth:R,ranges:[{startRow:0,endRow:u.getMaxRows()-1,startColumn:c,endColumn:c}]};const M=s.get(g.SheetSkeletonService).getSkeleton(l,d),{suitableRanges:p,remainingRanges:w}=Bt(v.ranges,M);_s(p,u);const y=s.get(g.SheetInterceptorService),{undos:b,redos:T}=y.onCommandExecute({id:Gt.id,params:v}),U=Hn(v,u),k=o.syncExecuteCommand(Ve.id,v),{undos:E,redos:N}=y.generateMutationsOfAutoHeight({unitId:l,subUnitId:d,ranges:p,autoHeightRanges:p,lazyAutoHeightRanges:w}),{undos:W,redos:V}=s.get(g.SheetInterceptorService).afterCommandExecute({id:Gt.id,params:v}),$=i.sequenceExecute([...T,...V,...N],o);return k&&$.result&&r.pushUndoRedo({unitID:l,undoMutations:[{id:Ve.id,params:U},...b,...W,...E],redoMutations:[{id:Ve.id,params:v},...T,...V,...N]}),!0}},zt={type:i.CommandType.COMMAND,id:"sheet.command.set-worksheet-col-width",handler:(s,e)=>{var y,b,T,U;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(k=>k.range);if(!(a!=null&&a.length))return!1;const u=P(s.get(i.IUniverInstanceService),e);if(!u)return!1;const{subUnitId:l,unitId:d,worksheet:c}=u,m=s.get(g.SheetSkeletonService).getSkeleton(d,l),h={subUnitId:l,unitId:d,ranges:a,colWidth:e.value},{suitableRanges:R,remainingRanges:C}=Bt(h.ranges,m);_s(R,c);const S=Hn(h,c),I=n.syncExecuteCommand(Ve.id,h),{undos:v,redos:M}=r.generateMutationsOfAutoHeight({unitId:d,subUnitId:l,ranges:R,autoHeightRanges:R,lazyAutoHeightRanges:C}),p=r.onCommandExecute({id:zt.id,params:h}),w=i.sequenceExecute([...p.redos,...M],n);if(I&&w.result){const k=r.afterCommandExecute({id:zt.id,params:h});return i.sequenceExecute(k.redos,n),o.pushUndoRedo({unitID:d,undoMutations:[...(T=p.preUndos)!=null?T:[],{id:Ve.id,params:S},...p.undos,...k.undos,...v],redoMutations:[...(U=p.preRedos)!=null?U:[],{id:Ve.id,params:h},...p.redos,...k.redos,...M]}),!0}return!1}};i.CommandType.COMMAND;const si={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),u=s.get(i.IUniverInstanceService);if(!P(u,e))return!1;const d={unitId:t,subUnitId:n,columnCount:o},c=Co(s,d);return r.syncExecuteCommand(mt.id,d)?(a.pushUndoRedo({unitID:t,undoMutations:[{id:mt.id,params:c}],redoMutations:[{id:mt.id,params:d}]}),!0):!1}},oi={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=So(s,e);return t.syncExecuteCommand(ht.id,e)?(n.pushUndoRedo({unitID:o,undoMutations:[{id:ht.id,params:r}],redoMutations:[{id:ht.id,params:e}]}),!0):!1}},ri=(s,e)=>{const t=ve(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()}},je={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}},ii={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:u,worksheet:l,unitId:d,subUnitId:c}=a;if(l.getConfig().hidden===i.BooleanNumber.TRUE)return!1;const h={unitId:d,subUnitId:c,hidden:i.BooleanNumber.TRUE},R=ri(s,h);return u.getSheets().filter(v=>v.getConfig().hidden===i.BooleanNumber.FALSE).length===1?(o.emit(r.t("sheets.info.hideSheet")),!1):t.syncExecuteCommand(je.id,h)?(n.pushUndoRedo({unitID:d,undoMutations:[{id:je.id,params:R}],redoMutations:[{id:je.id,params:h}]}),!0):!1}},Tl=(s,e)=>{const t=ve(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()}},qt={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}},yn={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:u}=r,l={subUnitId:u,name:e.name,unitId:a},d=Tl(s,l),c=o.onCommandExecute({id:yn.id,params:e}),m=[...(C=c.preRedos)!=null?C:[],{id:qt.id,params:l},...c.redos],h=[...(S=c.preUndos)!=null?S:[],{id:qt.id,params:d},...c.undos];return i.sequenceExecute(m,t).result?(n.pushUndoRedo({unitID:a,undoMutations:h,redoMutations:m}),!0):!1}},Ul=(s,e)=>({...i.Tools.deepClone(e),toOrder:e.fromOrder,fromOrder:e.toOrder}),Yt={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),!0}},js={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:u}=o,d={fromOrder:r.getConfig().sheetOrder.indexOf(u),toOrder:e.order,unitId:a,subUnitId:u},c=Ul(s,d);return t.syncExecuteCommand(Yt.id,d)?(n.pushUndoRedo({unitID:a,undoMutations:[{id:Yt.id,params:c}],redoMutations:[{id:Yt.id,params:d}]}),!0):!1}};class Ut{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 u=o.get(a);u&&e[n].push(u)}))}),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 Gs{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 zs{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 le=()=>[un,Se,zs,Gs],Ge=[_.Edit,_.View,_.ManageCollaborator,_.Delete],Pl=(s="unitId",e="subUnitId",t="permissionId")=>le().reduce((n,o)=>{const r=new o(s,e,t);return n[r.subType]=r.value,n},{}),Pt=()=>[me,es,Yn,ss,Kn,Qn,dn,xn,Xn,mn,ln,Zn,ns,cn,Ho,os,ts,Jn,qo,zo,jo,Fo],ai=[_.Edit,_.Print,_.Comment,_.View,_.Copy,_.Export,_.ManageCollaborator,_.CreateSheet,_.DeleteSheet,_.RenameSheet,_.HideSheet,_.Duplicate,_.Share,_.MoveSheet,_.CopySheet,_.RecoverHistory,_.ViewHistory,_.CreatePermissionObject,_.InsertRow,_.InsertColumn,_.DeleteRow,_.DeleteColumn],de=()=>[fe,Vt,gs,as],Ie=()=>[rs,is,us,ls,ds,cs,hs,ms,Rs,Cs,Wt,St,ft,Ss],_n=[_.Copy,_.DeleteColumn,_.DeleteRow,_.EditExtraObject,_.Filter,_.InsertColumn,_.InsertRow,_.InsertHyperlink,_.PivotTable,_.SetCellStyle,_.SetCellValue,_.SetColumnStyle,_.SetRowStyle,_.Sort];var kl=Object.getOwnPropertyDescriptor,Nl=(s,e,t,n)=>{for(var o=n>1?void 0:n?kl(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},ze=(s,e)=>(t,n)=>e(t,n,s);const Ol="SHEET_WORKSHEET_PROTECTION_PLUGIN",Dl="SHEET_WORKSHEET_PROTECTION_POINT_PLUGIN";g.WorksheetPermissionService=class extends i.RxDisposable{constructor(e,t,n,o,r,a,u,l){super(),this._permissionService=e,this._univerInstanceService=t,this._injector=n,this._worksheetProtectionRuleModel=o,this._worksheetProtectionPointRuleModel=r,this._resourceManagerService=a,this._rangeProtectionRuleModel=u,this._logService=l,this._init(),this._initRuleChange(),this._initRuleSnapshot(),this._initPointSnapshot()}_init(){const e=t=>{const n=t.getUnitId(),o=r=>{const a=r.getSheetId();[...de(),...Ie()].forEach(u=>{const l=new u(n,a);this._permissionService.addPermissionPoint(l)}),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(l=>{[...le()].forEach(d=>{const c=new d(n,a,l.permissionId);this._permissionService.deletePermissionPoint(c.id)})}),[...de(),...Ie()].forEach(l=>{const d=new l(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(kt.takeUntil(this.dispose$)).subscribe(e),this._univerInstanceService.getTypeOfUnitDisposed$(i.UniverInstanceType.UNIVER_SHEET).pipe(kt.takeUntil(this.dispose$)).subscribe(t=>{t.getSheets().forEach(n=>{const o=t.getUnitId(),r=n.getSheetId();de().forEach(a=>{const u=new a(o,r);this._permissionService.deletePermissionPoint(u.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:Ol,businesses:[an.UNIVER_SHEET],onLoad:(n,o)=>{this._worksheetProtectionRuleModel.fromObject(o),Object.keys(o).forEach(r=>{de().forEach(a=>{const u=new a(n,r);u.value=!1,this._permissionService.addPermissionPoint(u)})}),this._worksheetProtectionRuleModel.changeRuleInitState(!0)},onUnLoad:n=>{const o=this._univerInstanceService.getUnit(n);o&&(o.getSheets().forEach(r=>{const a=r.getSheetId();[...de(),...Ie()].forEach(u=>{const l=new u(n,a);this._permissionService.deletePermissionPoint(l.id)})}),Pt().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:Dl,businesses:[an.UNIVER_SHEET],onLoad:(n,o)=>{this._worksheetProtectionPointRuleModel.fromObject(o),Object.keys(o).forEach(r=>{Ie().forEach(a=>{const u=new a(n,r);this._permissionService.addPermissionPoint(u)})})},onUnLoad:n=>{this._worksheetProtectionPointRuleModel.deleteUnitModel(n)}}))}},g.WorksheetPermissionService=Nl([ze(0,i.Inject(i.IPermissionService)),ze(1,i.Inject(i.IUniverInstanceService)),ze(2,i.Inject(i.Injector)),ze(3,i.Inject(ke)),ze(4,i.Inject(Ut)),ze(5,i.Inject(i.IResourceManagerService)),ze(6,i.Inject(X)),ze(7,i.Inject(i.ILogService))],g.WorksheetPermissionService);const bn={id:"sheet.mutation.set-worksheet-permission-points",type:i.CommandType.MUTATION,handler:(s,e)=>{const{rule:t}=e;return s.get(Ut).addRule(t),!0}},ui={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(bn.id,{rule:n,unitId:n.unitId,subUnitId:n.subUnitId}),!0}},li={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:u,subUnitId:l}=o,d={...o,permissionId:r};if(await t.executeCommand(st.id,{unitId:u,subUnitId:l,newRule:d})){const m=[{id:st.id,params:{unitId:u,subUnitId:l,newRule:d}}],h=[{id:st.id,params:{unitId:u,subUnitId:l,rule:a}}];n.pushUndoRedo({unitID:u,redoMutations:m,undoMutations:h})}return!0}},Al=(s,e)=>{const r=s.get(i.IUniverInstanceService).getUniverSheetInstance(e.unitId).getSheetBySheetId(e.subUnitId).getConfig().rightToLeft;return{...i.Tools.deepClone(e),rightToLeft:r}},En={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}},Wl={type:i.CommandType.COMMAND,id:"sheet.command.set-worksheet-right-to-left",handler:async(s,e)=>{var m;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 u=i.BooleanNumber.FALSE;e&&(u=(m=e.rightToLeft)!=null?m:i.BooleanNumber.FALSE);const l={rightToLeft:u,unitId:r,subUnitId:a},d=Al(s,l);return t.syncExecuteCommand(En.id,l)?(n.pushUndoRedo({unitID:r,undoMutations:[{id:En.id,params:d}],redoMutations:[{id:En.id,params:l}]}),!0):!1}},di={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),u=s.get(i.IUniverInstanceService);if(!P(u,e))return!1;const d={unitId:t,subUnitId:n,rowCount:o},c=fo(s,d);return r.syncExecuteCommand(gt.id,d)?(a.pushUndoRedo({unitID:t,undoMutations:[{id:gt.id,params:c}],redoMutations:[{id:gt.id,params:d}]}),!0):!1}},Kt={type:i.CommandType.COMMAND,id:"sheet.command.delta-row-height",handler:async(s,e)=>{var k,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:u,unitId:l}=r,{anchorRow:d,deltaY:c}=e,h=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:W,endRow:V}=N;return W<=d&&d<=V})?i.RANGE_TYPE.ROW:i.RANGE_TYPE.NORMAL;let I;if(S===i.RANGE_TYPE.ALL){const N=a.getColumnCount(),W=new Array(a.getRowCount()).fill(void 0).map((V,$)=>({startRow:$,endRow:$,startColumn:0,endColumn:N-1}));I={subUnitId:u,unitId:l,rowHeight:h,ranges:W}}else S===i.RANGE_TYPE.ROW?I={subUnitId:u,unitId:l,ranges:C.map(N=>i.Rectangle.clone(N.range)),rowHeight:h}:I={subUnitId:u,unitId:l,rowHeight:h,ranges:[{startRow:d,endRow:d,startColumn:0,endColumn:a.getMaxColumns()-1}]};const v=Io(I,a),M={unitId:l,subUnitId:u,ranges:I.ranges,autoHeightInfo:i.BooleanNumber.FALSE},p=Fn(M,a),w=s.get(i.ICommandService),y=s.get(i.IUndoRedoService),b=o.onCommandExecute({id:Kt.id,params:I}),T=i.sequenceExecute([{id:Ee.id,params:I},{id:Re.id,params:M}],w),U=i.sequenceExecute([...b.redos],w);if(T.result&&U.result){const N=o.afterCommandExecute({id:Kt.id,params:I});return i.sequenceExecute(N.redos,w),y.pushUndoRedo({unitID:l,undoMutations:[...(k=b.preUndos)!=null?k:[],{id:Ee.id,params:v},{id:Re.id,params:p},...b.undos,...N.undos],redoMutations:[...(E=b.preRedos)!=null?E:[],{id:Ee.id,params:I},{id:Re.id,params:M},...b.redos,...N.redos]}),!0}return!1}},Jt={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),u=(p=e==null?void 0:e.ranges)!=null&&p.length?e.ranges:(w=t.getCurrentSelections())==null?void 0:w.map(T=>T.range);if(!(u!=null&&u.length))return!1;const l=P(r,e);if(!l)return!1;const{unitId:d,subUnitId:c,worksheet:m}=l,h={subUnitId:c,unitId:d,ranges:u,rowHeight:e.value},R=Io(h,m),C={unitId:d,subUnitId:c,ranges:h.ranges,autoHeightInfo:i.BooleanNumber.FALSE},S=Fn(C,m),I=i.sequenceExecute([{id:Ee.id,params:h},{id:Re.id,params:C}],n),v=a.onCommandExecute({id:Jt.id,params:h}),M=i.sequenceExecute([...v.redos],n);if(I.result&&M.result){const T=a.afterCommandExecute({id:Jt.id,params:h});return i.sequenceExecute(T.redos,n),o.pushUndoRedo({unitID:d,undoMutations:[...(y=v.preRedos)!=null?y:[],{id:Ee.id,params:R},{id:Re.id,params:S},...v.undos,...T.undos],redoMutations:[...(b=v.preRedos)!=null?b:[],{id:Ee.id,params:h},{id:Re.id,params:C},...v.redos,...T.redos]}),!0}return!1}},Tn={type:i.CommandType.COMMAND,id:"sheet.command.set-row-is-auto-height",handler:(s,e)=>{var T,U;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:u,subUnitId:l,worksheet:d}=a,c=(T=e==null?void 0:e.ranges)!=null&&T.length?e.ranges:(U=o.getCurrentSelections())==null?void 0:U.map(k=>k.range);if(!(c!=null&&c.length))return!1;const m={unitId:u,subUnitId:l,ranges:c,autoHeightInfo:i.BooleanNumber.TRUE},h=Fn(m,d),R=t.syncExecuteCommand(Re.id,m),C=s.get(g.SheetSkeletonService).getSkeleton(u,l),{suitableRanges:S,remainingRanges:I}=Bt(m.ranges,C),v=s.get(g.SheetInterceptorService),{undos:M,redos:p}=v.generateMutationsOfAutoHeight({unitId:u,subUnitId:l,ranges:S,autoHeightRanges:S,lazyAutoHeightRanges:I}),{undos:w,redos:y}=v.onCommandExecute({id:Tn.id,params:m}),b=i.sequenceExecute([...y,...p],t);return R&&b.result?(n.pushUndoRedo({unitID:u,undoMutations:[{id:Re.id,params:h},...w,...M],redoMutations:[{id:Re.id,params:m},...y,...p]}),!0):!1}},qs={type:i.CommandType.COMMAND,id:"sheet.command.set-worksheet-show",handler:(s,e)=>{const{unitId:t,subUnitId:n}=e,o=s.get(i.ICommandService),r=s.get(i.IUndoRedoService),a=s.get(i.IUniverInstanceService);if(!P(s.get(i.IUniverInstanceService)))return!1;const l=a.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET);if(!l)return!1;const d=l.getSheetBySheetId(n);if(!d||d.getConfig().hidden===i.BooleanNumber.FALSE)return!1;const m={unitId:t,subUnitId:n,hidden:i.BooleanNumber.FALSE},h=ri(s,m),R=o.syncExecuteCommand(je.id,m),C={unitId:t,subUnitId:n},S=o.syncExecuteCommand(Ct.id,C);return R&&S?(r.pushUndoRedo({unitID:t,undoMutations:[{id:je.id,params:h}],redoMutations:[{id:je.id,params:m}]}),!0):!1}},ci={type:i.CommandType.COMMAND,id:"sheet.command.split-text-to-columns",handler:(s,e)=>{const{unitId:t,subUnitId:n,range:o,delimiter:r,customDelimiter:a,treatMultipleDelimitersAsOne:u}=e,l=s.get(i.ICommandService),d=s.get(i.IUniverInstanceService),c=s.get(i.IUndoRedoService);if(!P(s.get(i.IUniverInstanceService)))return!1;const h=d.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET);if(!h)return!1;const R=h.getSheetBySheetId(n);if(!R)return!1;const{lastRow:C,rs:S,maxLength:I}=To(R,o,r,a,u),v=R.getColumnCount(),{startColumn:M}=i.Range.transformRange(o,R);if(o.startColumn!==o.endColumn)return!1;const p=[],w=[],y=M+I+1-v;if(y>0){const N={unitId:t,subUnitId:n,range:{startRow:0,endRow:R.getRowCount()-1,startColumn:v-1,endColumn:v-1+y}};p.push({id:ie.id,params:N});const W=Nt(s,N);w.push({id:ne.id,params:W})}const b={startRow:o.startRow,endRow:C,startColumn:M,endColumn:M+I},T=new i.ObjectMatrix;for(let N=b.startRow;N<=b.endRow;N++)for(let W=b.startColumn;W<=b.endColumn;W++){const V=S[N-b.startRow];W===0&&(V==null?void 0:V.length)===1?T.setValue(N,W,R.getCell(N,W)):T.setValue(N,W,{v:(V==null?void 0:V[W-b.startColumn])||null,p:null,f:null,si:null,custom:null})}const U={unitId:t,subUnitId:n,cellValue:T.clone()},k=ce(s,U);return p.push({id:F.id,params:U}),w.unshift({id:F.id,params:k}),i.sequenceExecute(p,l).result?(c.pushUndoRedo({unitID:t,undoMutations:w,redoMutations:p}),!0):!1}},mi={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,l=s.get(i.IUniverInstanceService).getUnit(t,i.UniverInstanceType.UNIVER_SHEET),d=l==null?void 0:l.getSheetBySheetId(n),c=s.get(i.IUndoRedoService),m=s.get(i.ICommandService);if(!d)return!1;const h=d.getCell(o,r);if(!(h!=null&&h.p))return!1;const R=i.Tools.deepClone(h.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}),m.syncExecuteCommand(v.id,v.params)}},hi={type:i.CommandType.COMMAND,id:"sheet.command.toggle-gridlines",handler:(s,e)=>{const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),o=s.get(i.IUniverInstanceService),r=P(o);if(!r)return!1;const{worksheet:a}=r,u=a.getConfig().showGridlines;if(u===(e==null?void 0:e.showGridlines))return!1;const{unitId:l,subUnitId:d}=r,c={showGridlines:u===i.BooleanNumber.TRUE?i.BooleanNumber.FALSE:i.BooleanNumber.TRUE,unitId:l,subUnitId:d},m={showGridlines:u,unitId:l,subUnitId:d};return t.syncExecuteCommand(Rt.id,c)?(n.pushUndoRedo({unitID:l,undoMutations:[{id:Rt.id,params:m}],redoMutations:[{id:Rt.id,params:c}]}),!0):!1}},gi={id:"sheet.command.unregister-worksheet-range-theme-style",type:i.CommandType.COMMAND,handler:(s,e)=>{var h;if(!e)return!1;const{unitId:t,themeName:n}=e,o=s.get(i.IUniverInstanceService),r=s.get(i.ICommandService),a=s.get(i.IUndoRedoService),u=s.get(g.SheetRangeThemeModel);if(!P(o))return!1;const d={unitId:t,themeName:n},c={unitId:t,themeName:n,rangeThemeStyleJson:(h=u.getRangeThemeStyle(t,n))==null?void 0:h.toJson()};return r.syncExecuteCommand(_t.id,e)&&a.pushUndoRedo({unitID:t,undoMutations:[{id:_t.id,params:c}],redoMutations:[{id:In.id,params:d}]}),!0}},Ri={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 We(t.name);return r.fromJson(t),o.registerRangeThemeStyle(n,r),!0}},Ci={id:"sheet.mutation.empty",type:i.CommandType.MUTATION,handler:()=>!0},Si={id:"sheet.operation.mark-dirty-row-auto-height",type:i.CommandType.OPERATION,handler:()=>!0},fi={id:"sheet.operation.cancel-mark-dirty-row-auto-height",type:i.CommandType.OPERATION,handler:()=>!0},ot=i.createIdentifier("INumfmtService"),Vl=(s,e)=>{const t=s.get(ot),{values:n,unitId:o,subUnitId:r}=e,a=[],u=[];Object.keys(n).forEach(d=>{n[d].ranges.forEach(m=>{i.Range.foreach(m,(h,R)=>{const C=t.getValue(o,r,h,R);C?a.push({pattern:C.pattern,row:h,col:R}):u.push({startColumn:R,endColumn:R,startRow:h,endRow:h})})})});const l=[];if(a.length){const d=Pn(o,r,a);Object.keys(d.values).forEach(c=>{const m=d.values[c];m.ranges=zn(m.ranges)}),l.push({id:Un.id,params:Pn(o,r,a)})}return u.length&&l.push({id:Ys.id,params:{unitId:o,subUnitId:r,ranges:u}}),l},Un={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(ot),r=e.unitId,a=e.subUnitId,u=Object.keys(t).reduce((l,d)=>{const c=n[d],m=t[d].ranges;return c&&l.push({...c,ranges:m}),l},[]);return o.setValues(r,a,u),!0}},Ys={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(ot).deleteValues(t,n,o),!0}},$l=(s,e)=>{const t=s.get(ot),{ranges:n,unitId:o,subUnitId:r}=e,a=[];if(n.forEach(l=>{i.Range.foreach(l,(d,c)=>{const m=t.getValue(o,r,d,c);m&&a.push({pattern:m.pattern,row:d,col:c})})}),!a.length)return[];const u=Pn(o,r,a);return Object.keys(u.values).forEach(l=>{const d=u.values[l];d.ranges=zn(d.ranges)}),[{id:Un.id,params:u}]},Pn=(s,e,t)=>{const n=Ya(t,"pattern"),o={},r={},a=Ka();return Object.keys(n).forEach(u=>{const l=n[u],d=a();o[d]={pattern:u},l.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}},Ii={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}},vi={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}},pi={id:"sheet.operation.scroll-to-cell",type:i.CommandType.OPERATION,handler:()=>!0},Ll=(s,e,t)=>{const o=s.get(g.SheetsSelectionsService).getCurrentSelections(),{value:r,selections:a,unitId:u,subUnitId:l}=e;if(o){const c=o[(o==null?void 0:o.length)-1].primary;if(c){const{actualColumn:m,actualRow:h}=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===m&&y.endColumn===m&&h===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===h&&y.endRow===h&&m===y.startColumn);w&&(S=w.endRow,C=w.startColumn,I=w.endColumn)}const v={startRow:R,startColumn:C,endRow:S,endColumn:I,actualRow:h,actualColumn:m,isMerged:!0,isMergedMainCell:R===h&&C===m},M=o.map((w,y,b)=>({range:w.range,style:null,primary:y===b.length-1?v:null})),p={unitId:u,subUnitId:l,type:te.ONLY_SET,selections:M};return{id:q.id,params:p}}return null}return null},Bl=(s,e)=>{const n=s.get(g.SheetsSelectionsService).getCurrentSelections(),{unitId:o,subUnitId:r}=e;if(n&&n[(n==null?void 0:n.length)-1].primary){const l={unitId:o,subUnitId:r,type:te.ONLY_SET,selections:[...n]};return{id:q.id,params:l}}return null},wi="maxCellsPerSheet",Hl=3e6;var Fl=Object.getOwnPropertyDescriptor,jl=(s,e,t,n)=>{for(var o=n>1?void 0:n?Fl(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},Mi=(s,e)=>(t,n)=>e(t,n,s);const Gl="SHEET_DEFINED_NAME_PLUGIN",zl="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:Gl,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=jl([Mi(0,J.IDefinedNamesService),Mi(1,i.IResourceManagerService)],g.DefinedNameDataController);const yi="sheets.config",_i={};var ql=Object.getOwnPropertyDescriptor,Yl=(s,e,t,n)=>{for(var o=n>1?void 0:n?ql(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},Ks=(s,e)=>(t,n)=>e(t,n,s);const Kl=[Ne.id],Jl=[re.id,ie.id,ae.id,ne.id,pe.id,we.id];g.SheetsFreezeSyncController=class extends i.Disposable{constructor(t,n,o){var a,u;super();f(this,"_d",new i.DisposableCollection);f(this,"_enabled",!0);this._univerInstanceService=t,this._commandService=n,this._configService=o;const r=(u=(a=this._configService.getConfig(yi))==null?void 0:a.freezeSync)!=null?u:!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)=>{Kl.includes(t.id)&&(n||(n={}),n.onlyLocal=!0)})),this._d.add(this._commandService.onCommandExecuted((t,n)=>{if(Jl.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===pe.id?this._handleMoveRowsMutation(r,n):o===we.id&&this._handleMoveColsMutation(r,n)}}))}_handleInsertRowMutation(t,n){const{range:o,unitId:r,subUnitId:a}=t,u=this._getFreeze(r,a);if(u&&o.startRow<u.startRow){const l=o.endRow-o.startRow+1,d={...u,startRow:Math.max(1,u.startRow+l),ySplit:Math.max(1,u.ySplit+l)};this._sequenceExecute(r,a,d,n)}}_handleInsertColMutation(t,n){const{range:o,unitId:r,subUnitId:a}=t,u=this._getFreeze(r,a);if(u&&o.startColumn<u.startColumn){const l=o.endColumn-o.startColumn+1,d={...u,startColumn:Math.max(1,u.startColumn+l),xSplit:Math.max(1,u.xSplit+l)};this._sequenceExecute(r,a,d,n)}}_handleRemoveRowMutation(t,n){const{range:o,unitId:r,subUnitId:a}=t,u=this._getFreeze(r,a);if(u&&o.startRow<u.startRow){const l=Math.min(u.startRow,o.endRow+1)-o.startRow,d={...u,startRow:Math.max(1,u.startRow-l),ySplit:Math.max(1,u.ySplit-l)};this._sequenceExecute(r,a,d,n)}}_handleRemoveColMutation(t,n){const{range:o,unitId:r,subUnitId:a}=t,u=this._getFreeze(r,a);if(u&&o.startColumn<u.startColumn){const l=Math.min(u.startColumn,o.endColumn+1)-o.startColumn,d={...u,startColumn:Math.max(1,u.startColumn-l),xSplit:Math.max(1,u.xSplit-l)};this._sequenceExecute(r,a,d,n)}}_handleMoveRowsMutation(t,n){const{sourceRange:o,targetRange:r,unitId:a,subUnitId:u}=t,l=this._getFreeze(a,u);if(!l||l.startRow<=0||o.startRow>=l.startRow&&r.startRow>=l.startRow||o.endRow<l.startRow&&r.endRow<l.startRow)return;const d=o.endRow-o.startRow+1,c=Math.max(Math.min(l.startRow,o.endRow+1)-o.startRow,0),m={...l};r.startRow>=l.startRow?(m.startRow=Math.max(1,l.startRow-c),m.ySplit=Math.max(1,l.ySplit-c)):(m.startRow=l.startRow+d-c,m.ySplit=l.ySplit+d-c),this._sequenceExecute(a,u,m,n)}_handleMoveColsMutation(t,n){const{sourceRange:o,targetRange:r,unitId:a,subUnitId:u}=t,l=this._getFreeze(a,u);if(!l||l.startColumn<=0||o.startColumn>=l.startColumn&&r.startColumn>=l.startColumn||o.endColumn<l.startColumn&&r.endColumn<l.startColumn)return;const d=o.endColumn-o.startColumn+1,c=Math.max(Math.min(l.startColumn,o.endColumn+1)-o.startColumn,0),m={...l};r.startColumn>=l.startColumn?(m.startColumn=Math.max(1,l.startColumn-c),m.xSplit=Math.max(1,l.xSplit-c)):(m.startColumn=l.startColumn+d-c,m.xSplit=l.xSplit+d-c),this._sequenceExecute(a,u,m,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:Ne.id,params:{...o,unitId:t,subUnitId:n,resetScroll:!1}}],this._commandService,r)}},g.SheetsFreezeSyncController=Yl([Ks(0,i.Inject(i.IUniverInstanceService)),Ks(1,i.ICommandService),Ks(2,i.IConfigService)],g.SheetsFreezeSyncController);var xl=Object.getOwnPropertyDescriptor,Xl=(s,e,t,n)=>{for(var o=n>1?void 0:n?xl(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},Oe=(s,e)=>(t,n)=>e(t,n,s);g.SheetPermissionCheckController=class extends i.Disposable{constructor(t,n,o,r,a,u,l,d,c,m){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=u,this._localeService=l,this._lexerTreeBuilder=d,this._contextService=c,this._definedNamesService=m,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 It.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:[Se],worksheetTypes:[Wt,fe]},n);break;case fn.id:o=this.permissionCheckWithRanges({workbookTypes:[me],rangeTypes:[Se],worksheetTypes:[Wt,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 Gt.id:case zt.id:o=this.permissionCheckWithoutRange({worksheetTypes:[St]}),r=this._localeService.t("permission.dialog.setRowColStyleErr");break;case Kt.id:case Jt.id:case Tn.id:o=this.permissionCheckWithoutRange({worksheetTypes:[ft]}),r=this._localeService.t("permission.dialog.setRowColStyleErr");break;case wt.id:case pt.id:o=this._permissionCheckByMoveCommand(n),r=this._localeService.t("permission.dialog.moveRowColErr");break;case Je.id:o=this._permissionCheckByMoveRangeCommand(n),r=this._localeService.t("permission.dialog.moveRangeErr");break;case js.id:o=this._permissionCheckByWorksheetCommand([me,cn]),r=this._localeService.t("permission.dialog.operatorSheetErr"),o===!1&&this._worksheetProtectionRuleModel.resetOrder();break;case yn.id:o=this._permissionCheckByWorksheetCommand([me,mn]),r=this._localeService.t("permission.dialog.operatorSheetErr"),o===!1&&this._worksheetProtectionRuleModel.resetOrder();break;case qs.id:{const{unitId:a,subUnitId:u}=n;o=this._permissionCheckByWorksheetCommand([me,ln],a,u),r=this._localeService.t("permission.dialog.operatorSheetErr"),o===!1&&this._worksheetProtectionRuleModel.resetOrder()}break;case Et.id:o=this.permissionCheckWithRanges({workbookTypes:[me],rangeTypes:[Se],worksheetTypes:[fe,St]},n.ranges,n.unitId,n.subUnitId),r=this._localeService.t("permission.dialog.setRowColStyleErr");break;case Tt.id:o=this.permissionCheckWithRanges({workbookTypes:[me],rangeTypes:[Se],worksheetTypes:[fe,ft]},n.ranges,n.unitId,n.subUnitId),r=this._localeService.t("permission.dialog.setRowColStyleErr");break;case Ws.id:o=this.permissionCheckWithRanges({workbookTypes:[me],rangeTypes:[Se],worksheetTypes:[fe,St]}),r=this._localeService.t("permission.dialog.setRowColStyleErr");break;case Ls.id:o=this.permissionCheckWithRanges({workbookTypes:[me],rangeTypes:[Se],worksheetTypes:[fe,ft]}),r=this._localeService.t("permission.dialog.setRowColStyleErr");break;case vt.id:o=this._permissionCheckWithInsertRangeMove("right"),r=this._localeService.t("permission.dialog.insertOrDeleteMoveRangeErr");break;case xe.id:o=this._permissionCheckWithInsertRangeMove("bottom"),r=this._localeService.t("permission.dialog.insertOrDeleteMoveRangeErr");break;case Be.id:o=this._permissionCheckWithInsertRangeMove("left"),r=this._localeService.t("permission.dialog.insertOrDeleteMoveRangeErr");break;case He.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===qt.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 u=this._worksheetProtectionRuleModel.getRule(r,a),l=this._rangeProtectionRuleModel.getSubunitRuleList(r,a);u&&this._worksheetProtectionRuleModel.ruleRefresh(u.permissionId),l.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,u=i.Tools.deepClone((c=this._selectionManagerService.getCurrentLastSelection())==null?void 0:c.range);return!(!u||(t==="top"||t==="bottom"?u.endRow=o.getRowCount()-1:(t==="left"||t==="right")&&(u.endColumn=o.getColumnCount()-1),this._rangeProtectionRuleModel.getSubunitRuleList(r,a).map(m=>m.ranges).flat().some(m=>i.Rectangle.getIntersects(u,m))))}_permissionCheckByWorksheetCommand(t,n,o){var c,m;const r=P(this._univerInstanceService,{unitId:n,subUnitId:o});if(!r)return!1;const{unitId:a,subUnitId:u}=r,l=this._worksheetProtectionRuleModel.getRule(a,u),d=this._rangeProtectionRuleModel.getSubunitRuleList(a,u).length>0;return l||d?(m=(c=this._permissionService.getPermissionPoint(new dn(a).id))==null?void 0:c.value)!=null?m:!1:this._permissionService.composePermission(t.map(h=>new h(a).id)).every(h=>h.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,u=this._selectionManagerService.getCurrentLastSelection();if(!u)return!0;const l=(C=(R=u==null?void 0:u.primary)==null?void 0:R.actualRow)!=null?C:0,d=(I=(S=u==null?void 0:u.primary)==null?void 0:S.actualColumn)!=null?I:0,{workbookTypes:c,worksheetTypes:m,rangeTypes:h}=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||m&&m.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||h&&h.some(M=>{var T,U,k,E,N;const p=(U=(T=o.getCell(l,d))==null?void 0:T.selectionProtection)==null?void 0:U[0];if(!(p!=null&&p.ruleId))return!1;const w=(k=this._rangeProtectionRuleModel.getRule(r,a,p.ruleId))==null?void 0:k.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);if(!a)return!1;const{workbook:u,worksheet:l}=a;o||(o=u.getUnitId()),r||(r=l.getSheetId());const d=n!=null?n:(C=this._selectionManagerService.getCurrentSelections())==null?void 0:C.map(S=>S.range);if(!d)return!1;const{workbookTypes:c,worksheetTypes:m,rangeTypes:h}=t,R=[];return c&&R.push(...c.map(S=>new S(o).id)),m&&R.push(...m.map(S=>new S(o,r).id)),h&&this._rangeProtectionRuleModel.getSubunitRuleList(o,r).forEach(S=>{d.some(v=>S.ranges.some(M=>i.Rectangle.intersects(M,v)))&&R.push(...h.map(v=>new v(o,r,S.permissionId).id))}),R.length?this._permissionService.composePermission(R).every(S=>S.value):!0}_permissionCheckByMoveCommand(t){const n=P(this._univerInstanceService);if(!n)return!1;const{worksheet:o,unitId:r,subUnitId:a}=n,u=t.toRange;u.endRow===o.getRowCount()-1?u.endColumn=u.startColumn:u.endRow=u.startRow;const l=this._rangeProtectionRuleModel.getSubunitRuleList(r,a).reduce((d,c)=>[...d,...c.ranges],[]).filter(d=>i.Rectangle.intersects(d,u));return l.length>0?!1:(l.forEach(d=>{var c,m;for(let h=d.startRow;h<=d.endRow;h++)for(let R=d.startColumn;R<=d.endColumn;R++){const C=(m=(c=o.getCell(h,R))==null?void 0:c.selectionProtection)==null?void 0:m[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,u=t.toRange,l=this._rangeProtectionRuleModel.getSubunitRuleList(r,a).reduce((d,c)=>[...d,...c.ranges],[]).filter(d=>i.Rectangle.intersects(d,u));return l.length>0?!1:(l.forEach(d=>{var c,m;for(let h=d.startRow;h<=d.endRow;h++)for(let R=d.startColumn;R<=d.endColumn;R++){const C=(m=(c=o.getCell(h,R))==null?void 0:c.selectionProtection)==null?void 0:m[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,u,l,d,c;const n=t.value,o=t.range,r=n.f;if(r){const m=r.substring(1),h=this._univerInstanceService.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET),R=(a=t.unitId)!=null?a:h.getUnitId(),C=this._definedNamesService.getValueByName(R,m);if(C){let S=C.formulaOrRefString;S.startsWith(J.operatorToken.EQUALS)&&(S=S.slice(1));const I=S.split(",");for(let v=0;v<I.length;v++){const M=I[v],p=J.deserializeRangeWithSheet(M);if(p.sheetName){const w=h.getSheetBySheetName(p.sheetName);if(!w)return!0;const{startRow:y,endRow:b,startColumn:T,endColumn:U}=p.range;for(let k=y;k<=b;k++)for(let E=T;E<=U;E++){const N=(l=(u=w.getCell(k,E))==null?void 0:u.selectionProtection)==null?void 0:l[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!==J.sequenceNodeType.REFERENCE)continue;const{token:M}=v,p=J.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 Vt(b,N).id))return!1}if(!y)return!0;const{startRow:T,endRow:U,startColumn:k,endColumn:E}=p.range;for(let N=T;N<=U;N++)for(let W=k;W<=E;W++){const V=(c=(d=y.getCell(N,W))==null?void 0:d.selectionProtection)==null?void 0:c[0];if((V==null?void 0:V[_.View])===!1)return!1}}return!0}}if(o){const m=P(this._univerInstanceService);if(!m)return!1;const h=t.unitId||m.unitId,R=t.subUnitId||m.subUnitId,S=this._rangeProtectionRuleModel.getSubunitRuleList(h,R).filter(v=>v.ranges.some(M=>i.Rectangle.intersects(M,o))).map(v=>new Se(h,R,v.permissionId).id);if(!this._permissionService.composePermission(S).every(v=>v.value))return!1}return!0}},g.SheetPermissionCheckController=Xl([Oe(0,i.ICommandService),Oe(1,i.IUniverInstanceService),Oe(2,i.IPermissionService),Oe(3,i.Inject(g.SheetsSelectionsService)),Oe(4,i.Inject(X)),Oe(5,i.Inject(ke)),Oe(6,i.Inject(i.LocaleService)),Oe(7,i.Inject(J.LexerTreeBuilder)),Oe(8,i.IContextService),Oe(9,J.IDefinedNamesService)],g.SheetPermissionCheckController);var Zl=Object.getOwnPropertyDescriptor,Ql=(s,e,t,n)=>{for(var o=n>1?void 0:n?Zl(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},xt=(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();Pt().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(l=>{[...le()].forEach(d=>{const c=new d(o,a,l.permissionId);this._permissionService.deletePermissionPoint(c.id)})}),[...de(),...Ie()].forEach(l=>{const d=new l(o,a);this._permissionService.deletePermissionPoint(d.id)})}),Pt().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=Ql([xt(0,i.Inject(i.IPermissionService)),xt(1,i.Inject(i.IUniverInstanceService)),xt(2,i.Inject(X)),xt(3,i.Inject(ke)),xt(4,i.Inject(Ut))],g.WorkbookPermissionService);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},De=(s,e)=>(t,n)=>e(t,n,s);g.SheetPermissionInitController=class extends i.Disposable{constructor(e,t,n,o,r,a,u,l,d,c){super(),this._univerInstanceService=e,this._permissionService=t,this._authzIoService=n,this._rangeProtectionRuleModel=o,this._worksheetProtectionRuleModel=r,this._userManagerService=a,this._worksheetProtectionPointRuleModel=u,this._workbookPermissionService=l,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(u=>{const l=u.getSheetId();this._rangeProtectionRuleModel.getSubunitRuleList(o,l).forEach(d=>{a.set(d.permissionId,d),n.push({objectID:d.permissionId,unitID:o,objectType:D.SelectRange,actions:Ge})})}),!n.length){this._rangeProtectionRuleModel.changeRuleInitState(!0);return}this._authzIoService.batchAllowed(n).then(u=>{u.forEach(l=>{const d=a.get(l.objectID);if(d){if(!this._rangeProtectionRuleModel.getRule(o,d.subUnitId,d.id))return;le().forEach(m=>{const h=new m(o,d.subUnitId,l.objectID),R=h.subType,C=l.actions.find(S=>S.action===R);(C==null?void 0:C.allowed)!==void 0&&this._permissionService.updatePermissionPoint(h.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:Ge}).then(t=>{this._rangeProtectionRuleModel.getRule(e.unitId,e.subUnitId,e.rule.id)&&(le().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),u=a.subType,l=t.find(d=>d.action===u);l&&this._permissionService.updatePermissionPoint(a.id,l.allowed)}),this._rangeProtectionRuleModel.ruleRefresh(e.rule.permissionId))}):this._rangeProtectionRuleModel.getSubunitRuleList(e.unitId,e.subUnitId).length===0&&(this._worksheetProtectionPointRuleModel.deleteRule(e.unitId,e.subUnitId),[...Ie()].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:ai}).then(o=>{Pt().forEach(r=>{const a=new r(t),u=a.subType,l=o.find(d=>d.action===u);l&&this._permissionService.updatePermissionPoint(a.id,l.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:Ge}).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,u=t.find(l=>l.action===a);u&&this._permissionService.updatePermissionPoint(r.id,u.allowed)}),this._worksheetProtectionRuleModel.ruleRefresh(e.rule.permissionId))}):([...de(),...Ie()].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:_n}).then(t=>{const n=this._worksheetProtectionPointRuleModel.getRule(e.unitId,e.subUnitId);!n||n.permissionId!==e.permissionId||Ie().forEach(o=>{const r=new o(e.unitId,e.subUnitId),a=r.subType,u=t.find(l=>l.action===a);u&&this._permissionService.updatePermissionPoint(r.id,u.allowed)})})}))}async _initWorksheetPermissionFromSnapshot(){const e=async t=>{const n=[],o=t.getUnitId(),r=t.getSheets(),a=new Map;if(r.forEach(u=>{const l=u.getSheetId(),d=this._worksheetProtectionRuleModel.getRule(o,l);d&&(a.set(d.permissionId,d),n.push({objectID:d.permissionId,unitID:o,objectType:D.Worksheet,actions:Ge}));const c=this._worksheetProtectionPointRuleModel.getRule(o,l);c&&(a.set(c.permissionId,c),n.push({objectID:c.permissionId,unitID:o,objectType:D.Worksheet,actions:_n}))}),!n.length){this._worksheetProtectionRuleModel.changeRuleInitState(!0);return}this._authzIoService.batchAllowed(n).then(u=>{u.forEach(l=>{const d=a.get(l.objectID);if(d){const c=this._worksheetProtectionRuleModel.getRule(o,d.subUnitId)||this._worksheetProtectionPointRuleModel.getRule(o,d.subUnitId);if(!c||c.permissionId!==l.objectID)return;[...de(),...Ie()].forEach(m=>{const h=new m(o,d.subUnitId),R=h.subType,C=l.actions.find(S=>S.action===R);(C==null?void 0:C.allowed)!==void 0&&this._permissionService.updatePermissionPoint(h.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();Pt().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(),...Ie()].forEach(l=>{let d=new l(o,a);e.has(d.id)&&(d=e.get(d.id)),this._permissionService.addPermissionPoint(d)}),this._rangeProtectionRuleModel.getSubunitRuleList(o,a).forEach(l=>{le().forEach(d=>{let c=new d(o,a,l.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[u,l]=n;this._authzIoService.allowed({objectID:t,unitID:e,objectType:D.Worksheet,actions:Ge}).then(d=>{if(!this._worksheetProtectionRuleModel.getTargetByPermissionId(e,t))return;let m="";de().forEach(h=>{var I;const R=new h(e,l),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),m+=`${S.action}_${S.allowed}`)}),this._worksheetProtectionRuleModel.ruleRefresh(`${t}_${m}`),o&&this._undoRedoService.clearUndoRedo(e)})}const r=this._worksheetProtectionPointRuleModel.getTargetByPermissionId(e,t);if(r){const[u,l]=r;this._authzIoService.allowed({objectID:t,unitID:e,objectType:D.Worksheet,actions:_n}).then(d=>{this._worksheetProtectionPointRuleModel.getTargetByPermissionId(e,t)&&(Ie().forEach(m=>{var S;const h=new m(e,l),R=h.subType,C=d.find(I=>I.action===R);C&&(((S=this._permissionService.getPermissionPoint(h.id))==null?void 0:S.value)!==C.allowed&&(o=!0),this._permissionService.updatePermissionPoint(h.id,C.allowed))}),o&&this._undoRedoService.clearUndoRedo(e))})}const a=this._rangeProtectionRuleModel.getTargetByPermissionId(e,t);if(a){const[u,l]=a;this._authzIoService.allowed({objectID:t,unitID:e,objectType:D.SelectRange,actions:Ge}).then(d=>{if(!this._rangeProtectionRuleModel.getTargetByPermissionId(e,t))return;let m="";le().forEach(h=>{var I;const R=new h(e,l,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),m+=`${S.action}_${S.allowed}`)}),this._rangeProtectionRuleModel.ruleRefresh(`${t}_${m}`),o&&this._undoRedoService.clearUndoRedo(e)})}}_refreshPermissionByCollaCreate(){this.disposeWithMe(this._commandService.onCommandExecuted((e,t)=>{if(t!=null&&t.fromCollab&&(e.id===Ce.id||e.id===Fe.id||e.id===bn.id)){const n=e.params;this._undoRedoService.clearUndoRedo(n.unitId)}}))}},g.SheetPermissionInitController=td([De(0,i.IUniverInstanceService),De(1,i.IPermissionService),De(2,i.IAuthzIoService),De(3,i.Inject(X)),De(4,i.Inject(ke)),De(5,i.Inject(i.UserManagerService)),De(6,i.Inject(Ut)),De(7,i.Inject(g.WorkbookPermissionService)),De(8,i.Inject(i.IUndoRedoService)),De(9,i.Inject(i.ICommandService))],g.SheetPermissionInitController);var nd=Object.getOwnPropertyDescriptor,sd=(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},Js=(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 Ye.id:{const a=t.params;o=a.unitId,r=a.subUnitId}break;case Ke.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 Ee.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=sd([Js(0,i.Inject(i.ICommandService)),Js(1,i.Inject(g.SheetRangeThemeModel)),Js(2,i.Inject(i.IUniverInstanceService))],g.ZebraCrossingCacheController);var od=Object.getOwnPropertyDescriptor,rd=(s,e,t,n)=>{for(var o=n>1?void 0:n?od(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(kt.filter(e=>e.type===D.SelectRange),kt.filter(e=>le().some(t=>e instanceof t)),kt.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 u=this._createKey(e.unitId,e.subUnitId,r,a);this._cache.delete(u)})})}),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 u=this._createKey(e,t,n,o),l=this._cache.get(u);if(l)return l;const d=[];for(const c of r)if(c.ranges.some(m=>m.startRow<=n&&m.endRow>=n&&m.startColumn<=o&&m.endColumn>=o)){const m=le().reduce((h,R)=>{var I;const C=new R(e,t,c.permissionId),S=this._permissionService.getPermissionPoint(C.id);return h[C.subType]=(I=S==null?void 0:S.value)!=null?I:C.value,h},{});d.push({...m,ruleId:c.id,ranges:c.ranges})}return this._cache.set(u,d),d}clear(){this._cache.clear()}},g.RangeProtectionRenderModel=rd([bi(0,i.Inject(X)),bi(1,i.Inject(i.IPermissionService))],g.RangeProtectionRenderModel);var id=Object.getOwnPropertyDescriptor,ad=(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},xs=(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 u=this._ruleModel.getRule(o,n,a);if(!u)return;const l=this._ensureCellInfoMap(o,n);u.ranges.forEach(d=>{const{startRow:c,endRow:m,startColumn:h,endColumn:R}=d;for(let C=c;C<=m;C++)for(let S=h;S<=R;S++)l.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(u=>{i.Range.foreach(u,(l,d)=>{r.delete(`${l}-${d}`)})}),t.type==="set"&&((a=t.oldRule)==null||a.ranges.forEach(u=>{i.Range.foreach(u,(l,d)=>{this._cellInfoCache.delete(`${l}-${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(u=>{const{startRow:l,endRow:d,startColumn:c,endColumn:m}=u;for(let h=l;h<=d;h++)for(let R=c;R<=m;R++)a.set(`${h}-${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),u=this._ensureCellInfoMap(o,n);r.ranges.forEach(l=>{const{startRow:d,endRow:c,startColumn:m,endColumn:h}=l;for(let R=d;R<=c;R++)for(let C=m;C<=h;C++)a.delete(`${R}-${C}`),u.delete(`${R}-${C}`)}),this._permissionIdCache.delete(r.permissionId)}_getSelectionActions(t,n,o){var c,m,h,R,C,S,I,v,M,p,w,y;const r=(h=(m=this._permissionService.getPermissionPoint((c=new Se(t,n,o.permissionId))==null?void 0:c.id))==null?void 0:m.value)!=null?h:!0,a=(S=(C=this._permissionService.getPermissionPoint((R=new un(t,n,o.permissionId))==null?void 0:R.id))==null?void 0:C.value)!=null?S:!0,u=(M=(v=this._permissionService.getPermissionPoint((I=new zs(t,n,o.permissionId))==null?void 0:I.id))==null?void 0:v.value)!=null?M:!1,l=(y=(w=this._permissionService.getPermissionPoint((p=new Gs(t,n,o.permissionId))==null?void 0:p.id))==null?void 0:w.value)!=null?y:!1;return{[_.Edit]:r,[_.View]:a,[_.ManageCollaborator]:u,[_.Delete]:l}}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"),u=this._ensureRowColInfoMap(t,n,"col");a.clear(),u.clear(),this._ruleModel.getSubunitRuleList(t,n).forEach(l=>{const d=this._getSelectionActions(t,n,l),c={...d,ruleId:l.id,ranges:l.ranges};l.ranges.forEach(m=>{const{startRow:h,endRow:R,startColumn:C,endColumn:S}=m;for(let I=h;I<=R;I++){const v=a.get(`${I}`);v?v.set(l.id,d):a.set(`${I}`,new Map([[l.id,d]]));for(let M=C;M<=S;M++){o.set(`${I}-${M}`,l.id),r.set(`${I}-${M}`,c);const p=u.get(`${M}`);p?p.set(l.id,d):u.set(`${M}`,new Map([[l.id,d]]))}}}),this._permissionIdCache.set(l.permissionId,l.id)})}getRowPermissionInfo(t,n,o,r){var l;const a=(l=this._rowInfoCache.get(t))==null?void 0:l.get(n);if(!a)return!0;const u=a.get(`${o}`);return u?r.every(d=>{for(const c of u.values())if(c[d]===!1)return!1;return!0}):!0}getColPermissionInfo(t,n,o,r){var l;const a=(l=this._colInfoCache.get(t))==null?void 0:l.get(n);if(!a)return!0;const u=a.get(`${o}`);return u?r.every(d=>{for(const c of u.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 u=this._ruleModel.getRule(o,n,a);if(!u)return;const l=this._ensureRowColInfoMap(o,n,"row"),d=this._ensureRowColInfoMap(o,n,"col"),c=this._getSelectionActions(o,n,u);u.ranges.forEach(m=>{const{startRow:h,endRow:R,startColumn:C,endColumn:S}=m;for(let I=h;I<=R;I++){const v=l.get(`${I}`);v?v.set(a,c):l.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"),u=this._ensureRowColInfoMap(n,o,"col");r.ranges.forEach(l=>{const{startRow:d,endRow:c,startColumn:m,endColumn:h}=l;for(let R=d;R<=c;R++){const C=a.get(`${R}`);C==null||C.delete(r.id);for(let S=m;S<=h;S++){const I=u.get(`${S}`);I==null||I.delete(r.id)}}})}})}getCellInfo(t,n,o,r){var c,m;const a=this._ensureCellInfoMap(t,n),u=a.get(`${o}-${r}`);if(u)return u;const l=(m=(c=this._cellRuleCache.get(t))==null?void 0:c.get(n))==null?void 0:m.get(`${o}-${r}`);if(!l)return;const d=this._ruleModel.getRule(t,n,l);if(d){const R={...this._getSelectionActions(t,n,d),ruleId:l,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=ad([xs(0,i.Inject(X)),xs(1,i.Inject(i.IPermissionService)),xs(2,i.Inject(i.IUniverInstanceService))],g.RangeProtectionCache);const Ei="ONLY_REGISTER_FORMULA_RELATED_MUTATIONS_KEY";var ud=Object.getOwnPropertyDescriptor,ld=(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},Xs=(s,e)=>(t,n)=>e(t,n,s);let kn=class extends i.Disposable{constructor(s,e,t){var o;super(),this._commandService=s,this._configService=e,this._dataSyncPrimaryController=t,[F,ie,re,yt,Le,pe,we,ne,ae,Xe,G,Ys,j,Bs,qt,Un,Ot,Ci,Ke,Ye,Si,fi].forEach(r=>{var a;this._commandService.registerCommand(r),(a=this._dataSyncPrimaryController)==null||a.registerSyncingMutations(r)}),((o=this._configService.getConfig(Ei))!=null?o:!1)||[Tr,sn,fn,on,Os,Be,He,Gt,Kt,nr,tr,sr,or,ws,ye,xe,vt,Xo,xo,Qo,Zo,ps,Me,Or,wt,Je,pt,Ms,Lt,ys,$t,vn,Rn,Ar,Xr,Jr,xr,Lr,$r,bt,Wr,Vr,wn,ut,lt,zt,Br,at,Fr,Ne,jr,Qr,It,Jt,Mn,qr,ct,Ws,Ls,Et,Tt,ee,ni,jt,Kr,ti,ei,Zr,Hs,Fs,Ct,ii,je,yn,js,Yt,jn,Ee,Tn,Re,Ve,di,gt,si,mt,Lo,q,pi,Nr,Ds,Vs,qs,hi,Rt,Gr,dt,ui,Fe,st,tt,bn,Oo,zr,Ur,br,Pr,li,Ce,Te,Q,mi,ht,oi,ci,it,rt,In,_t,gi,Dr,Er,kr,Ri,vi,Ii].forEach(r=>this.disposeWithMe(this._commandService.registerCommand(r))),this._configService.setConfig(wi,Hl)}};kn=ld([Xs(0,i.ICommandService),Xs(1,i.IConfigService),Xs(2,i.Optional($i.DataSyncPrimaryController))],kn);var dd=Object.getOwnPropertyDescriptor,cd=(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},Ti=(s,e)=>(t,n)=>e(t,n,s);let Nn=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!==J.SetFormulaCalculationResultMutation.id)return;const e=s.params,{unitData:t}=e,n=Object.keys(t),o=[];for(let a=0;a<n.length;a++){const u=n[a],l=t[u];if(l==null)continue;const d=Object.keys(l);for(let c=0;c<d.length;c++){const m=d[c],h=l[m];if(h==null)continue;const R=this._getMergedCellData(u,m,h),C={subUnitId:m,unitId:u,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(),u=new i.ObjectMatrix(t);return u.forValue((l,d,c)=>{const m=a==null?void 0:a.getValue(l,d),h=J.handleNumfmtInCell(m,c,o);u.setValue(l,d,h)}),u.getMatrix()}};Nn=cd([Ti(0,i.Inject(i.IUniverInstanceService)),Ti(1,i.ICommandService)],Nn);var md=Object.getOwnPropertyDescriptor,hd=(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},gd=(s,e)=>(t,n)=>e(t,n,s);let On=class extends i.Disposable{constructor(s){super(),this._sheetInterceptorService=s,this._initialize()}_initialize(){this._initInterceptorCellContent()}_initInterceptorCellContent(){this.disposeWithMe(this._sheetInterceptorService.intercept(Ae.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=J.stripErrorMargin(Number(s.v))),t(s)}}))}};On=hd([gd(0,i.Inject(g.SheetInterceptorService))],On);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},Dn=(s,e)=>(t,n)=>e(t,n,s);let An=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(Ae.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,u=this._rangeProtectionCache.getCellInfo(n,o,r,a);if(u){const l=u[_.View]===!1,d=!s||s===e.rawData?{...e.rawData}:s;return d.selectionProtection=[u],l?(delete d.s,delete d.v,delete d.p,d):t(d)}return t(s)}}))}_initViewModelBySheetInterceptor(){this.disposeWithMe(this._sheetInterceptorService.intercept(Ae.CELL_CONTENT,{priority:999,effect:i.InterceptorEffectEnum.Value|i.InterceptorEffectEnum.Style,handler:(s,e,t)=>{var a,u,l,d,c;const{unitId:n,subUnitId:o}=e,r=this._worksheetProtectionRuleModel.getRule(n,o);if(r!=null&&r.permissionId){const m=[{[_.View]:(u=(a=this._permissionService.getPermissionPoint(new Vt(n,o).id))==null?void 0:a.value)!=null?u:!1,[_.Edit]:(d=(l=this._permissionService.getPermissionPoint(new fe(n,o).id))==null?void 0:l.value)!=null?d:!1}],h=!((c=m[0])!=null&&c[_.View]),R=!s||s===e.rawData?{...s}:s;return R.hasWorksheetRule=!0,R.selectionProtection=m,h?(delete R.s,delete R.v,delete R.p,R):t(R)}return t(s)}}))}};An=Cd([Dn(0,i.IPermissionService),Dn(1,i.Inject(ke)),Dn(2,i.Inject(g.SheetInterceptorService)),Dn(3,i.Inject(g.RangeProtectionCache))],An);const Zs=i.createIdentifier("univer.exclusive-range-service");class Ui 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(u=>u.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(l=>l.range))||[]});const u=this.getExclusiveRanges(t,n,o);if(u){const l=u.filter(d=>d.groupId!==r);this._exclusiveRanges.get(t).get(n).set(o,l)}}getInterestGroupId(t){const n=[];return t.forEach(o=>{var d;const r=o.range,{unitId:a,sheetId:u}=r;if(!a||!u)return;const l=(d=this._exclusiveRanges.get(a))==null?void 0:d.get(u);if(l)for(const c of l.keys()){const m=l.get(c);if(m){for(const h of m)if(i.Rectangle.intersects(r,h.range)){n.push(c);break}}}}),n}}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},Qs=(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 u=r.getStyles(),l=a.getCellRaw(n,o);if(l!=null&&l.s){const d=u.get(l.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(u=>{i.Range.foreach(u,(l,d)=>{const c=r.getCellRaw(l,d);if(!c)return;const m=c==null?void 0:c.s,R={...m&&a.get(m)||{}};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(),u=r.getCellMatrix();n.forEach(l=>{l.ranges.forEach(d=>{i.Range.foreach(d,(c,m)=>{const h=r.getCellRaw(c,m);if(h){const C={...a.getStyleByCell(h)||{},n:{pattern:l.pattern}},S=a.setValue(C);h.s=S}else{const R={n:{pattern:l.pattern}},C=a.setValue(R);C&&u.setValue(c,m,{s:C})}})})})}},g.NumfmtService=fd([Qs(0,i.IResourceManagerService),Qs(1,i.IUniverInstanceService),Qs(2,i.ILogService)],g.NumfmtService);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},qe=(s,e)=>(t,n)=>e(t,n,s);const Pi=[ie.id,re.id,ne.id,ae.id],ki=[pe.id,we.id];g.RangeProtectionRefRangeService=class extends i.Disposable{constructor(t,n,o,r,a,u,l,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=u,this._sheetInterceptorService=l,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 l=c=>this.refRangeHandle(c,o,r);this._selectionProtectionRuleModel.getSubunitRuleList(o,r).reduce((c,m)=>[...c,...m.ranges],[]).forEach(c=>{this.disposableCollection.add(this._refRangeService.registerRefRange(c,l,o,r))})};this.disposeWithMe(this._commandService.onCommandExecuted(o=>{if(o.id===Fs.id){const r=o.params,a=r.subUnitId,u=r.unitId;if(!a||!u)return;t(u,a)}if(o.id===Q.id||o.id===Ce.id){const r=o.params,a=r.subUnitId,u=r.unitId;if(!a||!u)return;t(u,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 pt.id:return this._getRefRangeMutationsByMoveRows(t.params,n,o);case wt.id:return this._getRefRangeMutationsByMoveCols(t.params,n,o);case Me.id:return this._getRefRangeMutationsByInsertRows(t.params,n,o);case ye.id:return this._getRefRangeMutationsByInsertCols(t.params,n,o);case Lt.id:return this._getRefRangeMutationsByDeleteCols(t.params,n,o);case $t.id:return this._getRefRangeMutationsByDeleteRows(t.params,n,o)}return{redos:[],undos:[]}}_getRefRangeMutationsByDeleteCols(t,n,o){const r=this._selectionProtectionRuleModel.getSubunitRuleList(n,o).filter(u=>u.ranges.some(l=>i.Rectangle.intersects(l,t.range))),a=t.range;if(r.length){const u=[],l=[];return r.forEach(d=>{const c=i.Tools.deepClone(d),m=c.ranges.reduce((h,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 h;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)&&h.push(C)}return h},[]);c.ranges=m,c.ranges.length?(u.push({id:Q.id,params:{unitId:n,subUnitId:o,rule:c,ruleId:d.id}}),l.push({id:Q.id,params:{unitId:n,subUnitId:o,rule:d,ruleId:d.id}})):(u.push({id:Te.id,params:{unitId:n,subUnitId:o,ruleIds:[d.id]}}),l.push({id:Ce.id,params:{unitId:n,subUnitId:o,name:"",rules:[d]}}))}),{redos:u,undos:l}}return{undos:[],redos:[]}}_getRefRangeMutationsByDeleteRows(t,n,o){const r=this._selectionProtectionRuleModel.getSubunitRuleList(n,o).filter(u=>u.ranges.some(l=>i.Rectangle.intersects(l,t.range))),a=t.range;if(r.length){const u=[],l=[];return r.forEach(d=>{const c=i.Tools.deepClone(d),m=c.ranges.reduce((h,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 h;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)&&h.push(C)}return h},[]);c.ranges=m,u.push({id:Q.id,params:{unitId:n,subUnitId:o,rule:c,ruleId:d.id}}),l.push({id:Q.id,params:{unitId:n,subUnitId:o,rule:d,ruleId:d.id}})}),{redos:u,undos:l}}return{undos:[],redos:[]}}_getRefRangeMutationsByInsertCols(t,n,o){const r=t.range.startColumn,a=t.range.endColumn-t.range.startColumn+1,u=this._selectionProtectionRuleModel.getSubunitRuleList(n,o).filter(l=>l.ranges.some(d=>r>d.startColumn&&r<=d.endColumn));if(u.length){const l=[],d=[];return u.forEach(c=>{const m=i.Tools.deepClone(c);let h=!1;m.ranges.forEach(R=>{r>R.startColumn&&r<=R.endColumn&&(R.endColumn+=a,h=!0)}),h&&(l.push({id:Q.id,params:{unitId:n,subUnitId:o,rule:m,ruleId:c.id}}),d.push({id:Q.id,params:{unitId:n,subUnitId:o,rule:c,ruleId:c.id}}))}),{redos:l,undos:d}}return{undos:[],redos:[]}}_getRefRangeMutationsByInsertRows(t,n,o){const r=t.range.startRow,a=t.range.endRow-t.range.startRow+1,u=this._selectionProtectionRuleModel.getSubunitRuleList(n,o).filter(l=>l.ranges.some(d=>r>d.startRow&&r<=d.endRow));if(u.length){const l=[],d=[];return u.forEach(c=>{const m=i.Tools.deepClone(c);let h=!1;m.ranges.forEach(R=>{r>R.startRow&&r<=R.endRow&&(R.endRow+=a,h=!0)}),h&&(l.push({id:Q.id,params:{unitId:n,subUnitId:o,rule:m,ruleId:c.id}}),d.push({id:Q.id,params:{unitId:n,subUnitId:o,rule:c,ruleId:c.id}}))}),{redos:l,undos:d}}return{undos:[],redos:[]}}_getRefRangeMutationsByMoveRows(t,n,o){const r=t.toRange,a=r.startRow,u=r.endRow-r.startRow+1,l=this._selectionProtectionRuleModel.getSubunitRuleList(n,o).filter(d=>d.ranges.some(c=>a>c.startRow&&a<=c.endRow));if(l.length){const d=[],c=[];return l.forEach(m=>{const h=i.Tools.deepClone(m),C=t.fromRange.startRow;let S=!1;h.ranges.forEach(I=>{a>I.startRow&&a<=I.endRow&&(C<I.startRow&&(I.startRow=I.startRow-u,I.endRow=I.endRow-u),I.endRow+=u,S=!0)}),S&&(d.push({id:Q.id,params:{unitId:n,subUnitId:o,rule:h,ruleId:m.id}}),c.push({id:Q.id,params:{unitId:n,subUnitId:o,rule:m,ruleId:m.id}}))}),{redos:d,undos:c}}return{undos:[],redos:[]}}_getRefRangeMutationsByMoveCols(t,n,o){const r=t.toRange,a=r.startColumn,u=r.endColumn-r.startColumn+1,l=this._selectionProtectionRuleModel.getSubunitRuleList(n,o).filter(d=>d.ranges.some(c=>a>c.startColumn&&a<=c.endColumn));if(l.length){const d=[],c=[];return l.forEach(m=>{const h=i.Tools.deepClone(m),C=t.fromRange.startColumn;let S=!1;h.ranges.forEach(I=>{a>I.startColumn&&a<=I.endColumn&&(C<I.startColumn&&(I.startColumn=I.startColumn-u,I.endColumn=I.endColumn-u),I.endColumn+=u,S=!0)}),S&&(d.push({id:Q.id,params:{unitId:n,subUnitId:o,rule:h,ruleId:m.id}}),c.push({id:Q.id,params:{unitId:n,subUnitId:o,rule:m,ruleId:m.id}}))}),{redos:d,undos:c}}return{undos:[],redos:[]}}_correctPermissionRange(){this.disposeWithMe(this._commandService.onCommandExecuted(t=>{if(ki.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,u=r.startColumn===a.startColumn&&r.endColumn===a.endColumn,l=u?r.endRow-r.startRow+1:r.endColumn-r.startColumn+1,d=u?r.startRow:r.startColumn,c=u?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)||(u?d<p&&c>w?(p-=l,w-=l):d>w&&c<=p&&(p+=l,w+=l):d<y&&c>b?(y-=l,b-=l):d>b&&c<=y&&(y+=l,b+=l)),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:h,subUnitId:R}=t.params,C=I=>this.refRangeHandle(I,h,R);this._selectionProtectionRuleModel.getSubunitRuleList(h,R).reduce((I,v)=>[...I,...v.ranges],[]).forEach(I=>{this.disposableCollection.add(this._refRangeService.registerRefRange(I,C,h,R))}),this._selectionProtectionRenderModel.clear()}if(Pi.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,u=t.id.includes("row"),l=t.id.includes("insert"),d=u?a.startRow:a.startColumn,c=u?a.endRow:a.endColumn,m=c-d+1;this._selectionProtectionRuleModel.getSubunitRuleList(n.getUnitId(),o.getSheetId()).forEach(v=>{v.ranges.forEach(p=>{let{startRow:w,endRow:y,startColumn:b,endColumn:T}=p;l?u?d<=w&&(w+=m,y+=m):d<=b&&(b+=m,T+=m):u?c<w&&(w-=m,y-=m):c<b&&(b-=m,T-=m),this._checkIsRightRange({startRow:w,endRow:y,startColumn:b,endColumn:T})&&(p.startColumn=b,p.endColumn=T,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(Pi.includes(t.id)||ki.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===vn.id){const u=t.params,l=[],d=[];this._rangeProtectionRuleModel.getSubunitRuleList(u.unitId,u.subUnitId).forEach(c=>{l.push(c.id),d.push(c)}),l.length&&d.length&&(r.push({id:Te.id,params:{unitId:u.unitId,subUnitId:u.subUnitId,ruleIds:l}}),n.push({id:Ce.id,params:{unitId:u.unitId,subUnitId:u.subUnitId,name:"",rules:d}}))}return{redos:o,undos:n,preRedos:r,preUndos:a}}})}},g.RangeProtectionRefRangeService=vd([qe(0,i.Inject(X)),qe(1,i.Inject(i.IUniverInstanceService)),qe(2,i.ICommandService),qe(3,i.Inject(g.RefRangeService)),qe(4,i.Inject(g.RangeProtectionRenderModel)),qe(5,i.Inject(g.RangeProtectionCache)),qe(6,i.Inject(g.SheetInterceptorService)),qe(7,i.Inject(X))],g.RangeProtectionRefRangeService);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},Xt=(s,e)=>(t,n)=>e(t,n,s);const Md="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":{le().forEach(t=>{const n=new t(e.unitId,e.subUnitId,e.rule.permissionId);this._permissionService.addPermissionPoint(n)});break}case"delete":{le().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&&le().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:Md,businesses:[an.UNIVER_SHEET],onLoad:(n,o)=>{const r=this._selectionProtectionRuleModel.toObject();r[n]=o,this._selectionProtectionRuleModel.fromObject(r);const a=[];Object.keys(o).forEach(u=>{const l=o[u];this._selectionProtectionRuleModel.getSubunitRuleList(n,u).forEach(d=>{a.push({objectID:d.permissionId,unitID:n,objectType:D.SelectRange,actions:Ge})}),l.forEach(d=>{le().forEach(c=>{const m=new c(n,u,d.permissionId);m.value=!1,this._permissionService.addPermissionPoint(m)})}),this._selectionProtectionCache.reBuildCache(n,u)})},onUnLoad:n=>{this._selectionProtectionCache.deleteUnit(n)}}))}},g.RangeProtectionService=wd([Xt(0,i.Inject(X)),Xt(1,i.Inject(i.IPermissionService)),Xt(2,i.Inject(i.IResourceManagerService)),Xt(3,i.Inject(g.RangeProtectionCache)),Xt(4,i.Inject(i.IUniverInstanceService))],g.RangeProtectionService);var yd=Object.getOwnPropertyDescriptor,_d=(s,e,t,n)=>{for(var o=n>1?void 0:n?yd(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},bd=(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=_d([bd(0,i.Inject(g.SheetRangeThemeModel))],g.SheetRangeThemeService);var Ed=Object.defineProperty,Td=Object.getOwnPropertyDescriptor,Ud=(s,e,t)=>e in s?Ed(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,Pd=(s,e,t,n)=>{for(var o=n>1?void 0:n?Td(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},Ni=(s,e)=>(t,n)=>e(t,n,s),Oi=(s,e,t)=>Ud(s,typeof e!="symbol"?e+"":e,t);const kd="SHEET_PLUGIN";g.UniverSheetsPlugin=class extends i.Plugin{constructor(e=_i,t,n){super(),this._config=e,this._injector=t,this._configService=n;const{...o}=i.merge({},_i,this._config);this._configService.setConfig(yi,o),this._initConfig(),this._initDependencies()}_initConfig(){var e,t,n;(e=this._config)!=null&&e.onlyRegisterFormulaRelatedMutations&&this._configService.setConfig(Ei,!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=[[nt],[g.SheetsSelectionsService],[g.RefRangeService],[g.WorkbookPermissionService],[ot,{useClass:g.NumfmtService}],[g.SheetInterceptorService],[g.SheetRangeThemeService],[g.SheetSkeletonService],[kn],[g.MergeCellController],[On],[g.DefinedNameDataController],[g.ZebraCrossingCacheController],[g.SheetsFreezeSyncController],[g.WorksheetPermissionService],[ke],[Ut],[An],[g.SheetPermissionInitController],[g.SheetPermissionCheckController],[g.SheetRangeThemeModel],[g.RangeProtectionRenderModel],[X],[g.RangeProtectionCache],[g.RangeProtectionRefRangeService],[g.RangeProtectionService],[Zs,{useClass:Ui,deps:[g.SheetsSelectionsService]}]];(t=this._config)!=null&&t.notExecuteFormula||e.push([Nn]),i.registerDependencies(this._injector,i.mergeOverrideWithDependencies(e,this._config.override)),i.touchDependencies(this._injector,[[g.SheetInterceptorService],[g.RangeProtectionService],[Zs],[g.SheetPermissionInitController],[g.SheetsFreezeSyncController]])}onStarting(){i.touchDependencies(this._injector,[[kn],[g.MergeCellController],[g.WorkbookPermissionService],[g.WorksheetPermissionService],[An],[g.SheetSkeletonService]])}onRendered(){i.touchDependencies(this._injector,[[ot]])}onReady(){i.touchDependencies(this._injector,[[Nn],[g.DefinedNameDataController],[g.ZebraCrossingCacheController],[g.SheetRangeThemeModel],[On],[g.RangeProtectionRenderModel],[g.RangeProtectionRefRangeService],[g.RefRangeService],[g.SheetPermissionCheckController]])}},Oi(g.UniverSheetsPlugin,"pluginName",kd),Oi(g.UniverSheetsPlugin,"type",i.UniverInstanceType.UNIVER_SHEET),g.UniverSheetsPlugin=Pd([i.DependentOn(J.UniverFormulaEnginePlugin),Ni(1,i.Inject(i.Injector)),Ni(2,i.IConfigService)],g.UniverSheetsPlugin);const Nd={WorkbookCommentPermission:Yn,WorkbookCopyPermission:Kn,WorkbookCreateProtectPermission:Jn,WorkbookCreateSheetPermission:xn,WorkbookDeleteSheetPermission:Xn,WorkbookDuplicatePermission:Zn,WorkbookEditablePermission:me,WorkbookExportPermission:Qn,WorkbookHideSheetPermission:ln,WorkbookHistoryPermission:Go,WorkbookManageCollaboratorPermission:dn,WorkbookMoveSheetPermission:cn,WorkbookPrintPermission:es,WorkbookRecoverHistoryPermission:ts,WorkbookRenameSheetPermission:mn,WorkbookSharePermission:ns,WorkbookViewHistoryPermission:os,WorkbookViewPermission:ss,WorksheetCopyPermission:rs,WorksheetDeleteColumnPermission:is,WorksheetDeleteProtectionPermission:as,WorksheetDeleteRowPermission:us,WorksheetEditExtraObjectPermission:ls,WorksheetEditPermission:fe,WorksheetFilterPermission:ds,WorksheetInsertColumnPermission:cs,WorksheetInsertHyperlinkPermission:ms,WorksheetInsertRowPermission:hs,WorksheetManageCollaboratorPermission:gs,WorksheetPivotTablePermission:Rs,WorksheetSetCellStylePermission:Cs,WorksheetSetCellValuePermission:Wt,WorksheetSetColumnStylePermission:St,WorksheetSetRowStylePermission:ft,WorksheetSortPermission:Ss,WorksheetViewPermission:Vt,RangeProtectionPermissionEditPoint:Se,RangeProtectionPermissionViewPoint:un},Od=(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 u=o.getPermissionPoint(new fe(e,t).id);if(!(u!=null&&u.value))return!1;const d=r.getSubunitRuleList(e,t).filter(c=>c.ranges.some(m=>n.some(h=>i.Rectangle.intersects(m,h))));return d.length?d.every(c=>{const m=c.permissionId,h=o.getPermissionPoint(new Se(e,t,m).id);return!!(h!=null&&h.value)}):!0},Di=(s,e,t,n=1,o=!0,r=!0)=>{const a=i.Range.transformRange(s,e),{startRow:u,endRow:l}=a;let d=t.startRow-n,c=e.getMergedCell(d,t.startColumn),m=!c||c.startRow===d&&c.startColumn===t.startColumn;for(;!e.getRowVisible(d)||!m;)d--,c=e.getMergedCell(d,t.startColumn),m=!c||c.startRow===d&&c.startColumn===t.startColumn;if(d>=u)return{...t,startRow:d,endRow:d};if(r){const h={...t,startRow:l,endRow:l};return Wi(s,e,h,n,o,!1)}},Ai=(s,e,t,n=1,o=!0,r=!0)=>{const a=i.Range.transformRange(s,e),{startRow:u,endRow:l}=a;let d=t.endRow+n,c=e.getMergedCell(d,t.startColumn),m=!c||c.startRow===d&&c.startColumn===t.startColumn;for(;!e.getRowVisible(d)||!m;)d++,c=e.getMergedCell(d,t.startColumn),m=!c||c.startRow===d&&c.startColumn===t.startColumn;if(d<=l)return{...t,startRow:d,endRow:d};if(r){const h={...t,startRow:u,endRow:u};return Vi(s,e,h,n,o,!1)}},Wi=(s,e,t,n=1,o=!0,r=!0)=>{const a=i.Range.transformRange(s,e),{startColumn:u,endColumn:l}=a;let d=t.startColumn-n,c=e.getMergedCell(t.startRow,d),m=!c||c.startRow===t.startRow&&c.startColumn===d;for(;!e.getColVisible(d)||!m;)d--,c=e.getMergedCell(t.startRow,d),m=!c||c.startRow===t.startRow&&c.startColumn===d;if(d>=u)return{...t,startColumn:d,endColumn:d};if(r){const h={...t,startColumn:l,endColumn:l};return Di(s,e,h,n,o,!1)}},Vi=(s,e,t,n=1,o=!0,r=!0)=>{const a=i.Range.transformRange(s,e),{startColumn:u,endColumn:l}=a;let d=t.endColumn+n,c=e.getMergedCell(t.startRow,d),m=!c||c.startRow===t.startRow&&c.startColumn===d;for(;!e.getColVisible(d)||!m;)d++,c=e.getMergedCell(t.startRow,d),m=!c||c.startRow===t.startRow&&c.startColumn===d;if(d<=l)return{...t,endColumn:d,startColumn:d};if(r){const h={...t,startColumn:u,endColumn:u};return Ai(s,e,h,n,o,!1)}};function Wn(s,e,t){let n=null;return t.getMatrixWithMergedCells(s,e,s,e).forValue((r,a,u)=>(n={actualRow:r,actualColumn:a,startRow:r,startColumn:a,isMerged:u.rowSpan!==void 0||u.colSpan!==void 0,isMergedMainCell:u.rowSpan!==void 0&&u.colSpan!==void 0,endRow:r+(u.rowSpan!==void 0?u.rowSpan-1:0),endColumn:a+(u.colSpan!==void 0?u.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 Dd=(s,e,t,n,o=1)=>{switch(n){case i.Direction.UP:return Di(s,e,t,o);case i.Direction.DOWN:return Ai(s,e,t,o);case i.Direction.LEFT:return Wi(s,e,t,o);case i.Direction.RIGHT:return Vi(s,e,t,o)}},Ad=(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,u=a?o-1>=0?o-1:s.length-1:o+1<s.length?o+1:0,l=s[u];if(!n||!r)return null;const d={...r},{startRow:c,startColumn:m,endRow:h,endColumn:R}=n.range,C=a?d.startRow===c&&d.startColumn===m:d.endRow===h&&d.endColumn===R,S=C&&a;if(!i.Rectangle.equals(n.range,d)){const v=C?l.range:Dd(n.range,t,d,e);if(!v)return null;const M=S?Wn(v.endRow,v.endColumn,t):Wn(v.startRow,v.startColumn,t);return{startRow:M.startRow,startColumn:M.startColumn,endRow:M.endRow,endColumn:M.endColumn}}const I=S?Wn(l.range.endRow,l.range.endColumn,t):Wn(l.range.startRow,l.range.startColumn,t);return{startRow:I.startRow,startColumn:I.startColumn,endRow:I.endRow,endColumn:I.endColumn}};g.AFTER_CELL_EDIT=Zt,g.AddMergeRedoSelectionsOperationFactory=Ll,g.AddMergeUndoMutationFactory=ge,g.AddMergeUndoSelectionsOperationFactory=Bl,g.AddRangeProtectionCommand=Oo,g.AddRangeProtectionMutation=Ce,g.AddRangeThemeMutation=Ri,g.AddWorksheetMergeAllCommand=tl,g.AddWorksheetMergeCommand=Ft,g.AddWorksheetMergeHorizontalCommand=sl,g.AddWorksheetMergeMutation=j,g.AddWorksheetMergeVerticalCommand=nl,g.AddWorksheetProtectionCommand=br,g.AddWorksheetProtectionMutation=Fe,g.AppendRowCommand=Tr,g.BEFORE_CELL_EDIT=$n,g.BorderStyleManagerService=nt,g.COMMAND_LISTENER_SKELETON_CHANGE=Ea,g.COMMAND_LISTENER_VALUE_CHANGE=Ta,g.CancelFrozenCommand=jr,g.CancelMarkDirtyRowAutoHeightMutation=fi,g.ClearSelectionAllCommand=sn,g.ClearSelectionContentCommand=fn,g.ClearSelectionFormatCommand=on,g.CopySheetCommand=Os,g.DISABLE_NORMAL_SELECTIONS=su,g.DeleteRangeMoveLeftCommand=Be,g.DeleteRangeMoveUpCommand=He,g.DeleteRangeProtectionCommand=Ur,g.DeleteRangeProtectionMutation=Te,g.DeleteWorksheetProtectionCommand=Pr,g.DeleteWorksheetProtectionMutation=tt,g.DeleteWorksheetRangeThemeStyleCommand=kr,g.DeleteWorksheetRangeThemeStyleMutation=it,g.DeleteWorksheetRangeThemeStyleMutationFactory=ao,g.DeltaColumnWidthCommand=Gt,g.DeltaRowHeightCommand=Kt,g.EditStateEnum=No,g.EffectRefRangId=A,g.EmptyMutation=Ci,g.ExclusiveRangeService=Ui,g.FactoryAddRangeProtectionMutation=Qa,g.FactoryDeleteRangeProtectionMutation=Za,g.FactorySetRangeProtectionMutation=Rl,g.IExclusiveRangeService=Zs,g.INTERCEPTOR_POINT=Ae,g.INumfmtService=ot,g.IRefSelectionsService=Vo,g.InsertColAfterCommand=nr,g.InsertColBeforeCommand=tr,g.InsertColByRangeCommand=ws,g.InsertColCommand=ye,g.InsertColMutation=ie,g.InsertColMutationUndoFactory=Nt,g.InsertDefinedNameCommand=Nr,g.InsertMultiColsLeftCommand=sr,g.InsertMultiColsRightCommand=or,g.InsertMultiRowsAboveCommand=Zo,g.InsertMultiRowsAfterCommand=Qo,g.InsertRangeMoveDownCommand=xe,g.InsertRangeMoveRightCommand=vt,g.InsertRowAfterCommand=Xo,g.InsertRowBeforeCommand=xo,g.InsertRowByRangeCommand=ps,g.InsertRowCommand=Me,g.InsertRowMutation=re,g.InsertRowMutationUndoFactory=en,g.InsertSheetCommand=Or,g.InsertSheetMutation=yt,g.InsertSheetUndoMutationFactory=Ns,g.InterceptCellContentPriority=to,g.MAX_CELL_PER_SHEET_KEY=wi,g.MERGE_CELL_INTERCEPTOR_CHECK=_r,g.MarkDirtyRowAutoHeightMutation=Si,g.MoveColsCommand=wt,g.MoveColsMutation=we,g.MoveColsMutationUndoFactory=lo,g.MoveRangeCommand=Je,g.MoveRangeMutation=Le,g.MoveRowsCommand=pt,g.MoveRowsMutation=pe,g.MoveRowsMutationUndoFactory=uo,g.OperatorType=B,g.PermissionPointsDefinitions=Nd,g.REF_SELECTIONS_ENABLED=Ao,g.RangeMergeUtil=$a,g.RangeProtectionPermissionDeleteProtectionPoint=Gs,g.RangeProtectionPermissionEditPoint=Se,g.RangeProtectionPermissionManageCollaPoint=zs,g.RangeProtectionPermissionViewPoint=un,g.RangeProtectionRuleModel=X,g.RangeThemeStyle=We,g.RegisterWorksheetRangeThemeStyleCommand=Dr,g.RegisterWorksheetRangeThemeStyleMutation=_t,g.RemoveColByRangeCommand=ys,g.RemoveColCommand=Lt,g.RemoveColMutation=ne,g.RemoveDefinedNameCommand=Ds,g.RemoveMergeUndoMutationFactory=ue,g.RemoveNumfmtMutation=Ys,g.RemoveRangeThemeMutation=Ii,g.RemoveRowByRangeCommand=Ms,g.RemoveRowCommand=$t,g.RemoveRowMutation=ae,g.RemoveSheetCommand=vn,g.RemoveSheetMutation=Xe,g.RemoveSheetUndoMutationFactory=rr,g.RemoveWorksheetMergeCommand=Ar,g.RemoveWorksheetMergeMutation=G,g.ReorderRangeCommand=Rn,g.ReorderRangeMutation=Ot,g.ReorderRangeUndoMutationFactory=co,g.ResetBackgroundColorCommand=Xr,g.ResetTextColorCommand=Jr,g.SCOPE_WORKBOOK_VALUE_DEFINED_NAME=zl,g.SELECTIONS_ENABLED=ou,g.SELECTION_CONTROL_BORDER_BUFFER_COLOR=Ba,g.SELECTION_CONTROL_BORDER_BUFFER_WIDTH=La,g.ScrollToCellOperation=pi,g.SelectRangeCommand=Lo,g.SelectionMoveType=te,g.SetBackgroundColorCommand=xr,g.SetBoldCommand=Il,g.SetBorderBasicCommand=Lr,g.SetBorderColorCommand=$r,g.SetBorderCommand=bt,g.SetBorderPositionCommand=Wr,g.SetBorderStyleCommand=Vr,g.SetColDataCommand=Br,g.SetColDataMutation=at,g.SetColDataMutationFactory=mo,g.SetColHiddenCommand=wn,g.SetColHiddenMutation=ut,g.SetColVisibleMutation=lt,g.SetColWidthCommand=zt,g.SetDefinedNameCommand=Vs,g.SetFontFamilyCommand=yl,g.SetFontSizeCommand=_l,g.SetFrozenCommand=Fr,g.SetFrozenMutation=Ne,g.SetFrozenMutationFactory=$s,g.SetGridlinesColorCommand=Gr,g.SetGridlinesColorMutation=dt,g.SetHorizontalTextAlignCommand=Qr,g.SetItalicCommand=vl,g.SetNumfmtMutation=Un,g.SetOverlineCommand=Ml,g.SetProtectionCommand=zr,g.SetRangeProtectionMutation=Q,g.SetRangeThemeMutation=vi,g.SetRangeValuesCommand=It,g.SetRangeValuesMutation=F,g.SetRangeValuesUndoMutationFactory=ce,g.SetRowDataCommand=qr,g.SetRowDataMutation=ct,g.SetRowDataMutationFactory=Ro,g.SetRowHeightCommand=Jt,g.SetRowHiddenCommand=Mn,g.SetRowHiddenMutation=Ke,g.SetRowVisibleMutation=Ye,g.SetSelectedColsVisibleCommand=Ws,g.SetSelectedRowsVisibleCommand=Ls,g.SetSelectionsOperation=q,g.SetSpecificColsVisibleCommand=Et,g.SetSpecificRowsVisibleCommand=Tt,g.SetStrikeThroughCommand=wl,g.SetStyleCommand=ee,g.SetTabColorCommand=ni,g.SetTabColorMutation=jt,g.SetTextColorCommand=Kr,g.SetTextRotationCommand=ti,g.SetTextWrapCommand=ei,g.SetUnderlineCommand=pl,g.SetVerticalTextAlignCommand=Zr,g.SetWorkbookNameCommand=Hs,g.SetWorkbookNameMutation=Bs,g.SetWorksheetActivateCommand=Fs,g.SetWorksheetActiveOperation=Ct,g.SetWorksheetColWidthMutation=Ve,g.SetWorksheetColWidthMutationFactory=Hn,g.SetWorksheetColumnCountCommand=si,g.SetWorksheetColumnCountMutation=mt,g.SetWorksheetColumnCountUndoMutationFactory=Co,g.SetWorksheetDefaultStyleCommand=oi,g.SetWorksheetDefaultStyleMutation=ht,g.SetWorksheetDefaultStyleMutationFactory=So,g.SetWorksheetHideCommand=ii,g.SetWorksheetHideMutation=je,g.SetWorksheetNameCommand=yn,g.SetWorksheetNameMutation=qt,g.SetWorksheetOrderCommand=js,g.SetWorksheetOrderMutation=Yt,g.SetWorksheetPermissionPointsCommand=ui,g.SetWorksheetPermissionPointsMutation=bn,g.SetWorksheetProtectionCommand=li,g.SetWorksheetProtectionMutation=st,g.SetWorksheetRangeThemeStyleCommand=Er,g.SetWorksheetRangeThemeStyleMutation=rt,g.SetWorksheetRangeThemeStyleMutationFactory=io,g.SetWorksheetRightToLeftCommand=Wl,g.SetWorksheetRightToLeftMutation=En,g.SetWorksheetRowAutoHeightMutation=jn,g.SetWorksheetRowAutoHeightMutationFactory=ba,g.SetWorksheetRowCountCommand=di,g.SetWorksheetRowCountMutation=gt,g.SetWorksheetRowCountUndoMutationFactory=fo,g.SetWorksheetRowHeightMutation=Ee,g.SetWorksheetRowIsAutoHeightCommand=Tn,g.SetWorksheetRowIsAutoHeightMutation=Re,g.SetWorksheetShowCommand=qs,g.SheetSkeletonChangeType=vo,g.SheetValueChangeType=po,g.SplitDelimiterEnum=Eo,g.SplitTextToColumnsCommand=ci,g.ToggleCellCheckboxCommand=mi,g.ToggleGridlinesCommand=hi,g.ToggleGridlinesMutation=Rt,g.UnitAction=_,g.UnitObject=D,g.UnregisterWorksheetRangeThemeStyleCommand=gi,g.UnregisterWorksheetRangeThemeStyleMutation=In,g.VALIDATE_CELL=Qt,g.ViewStateEnum=ko,g.WorkbookCommentPermission=Yn,g.WorkbookCopyPermission=Kn,g.WorkbookCopySheetPermission=Ho,g.WorkbookCreateProtectPermission=Jn,g.WorkbookCreateSheetPermission=xn,g.WorkbookDeleteColumnPermission=Fo,g.WorkbookDeleteRowPermission=jo,g.WorkbookDeleteSheetPermission=Xn,g.WorkbookDuplicatePermission=Zn,g.WorkbookEditablePermission=me,g.WorkbookExportPermission=Qn,g.WorkbookHideSheetPermission=ln,g.WorkbookHistoryPermission=Go,g.WorkbookInsertColumnPermission=zo,g.WorkbookInsertRowPermission=qo,g.WorkbookManageCollaboratorPermission=dn,g.WorkbookMoveSheetPermission=cn,g.WorkbookPrintPermission=es,g.WorkbookRecoverHistoryPermission=ts,g.WorkbookRenameSheetPermission=mn,g.WorkbookSelectionModel=Do,g.WorkbookSharePermission=ns,g.WorkbookViewHistoryPermission=os,g.WorkbookViewPermission=ss,g.WorksheetCopyPermission=rs,g.WorksheetDeleteColumnPermission=is,g.WorksheetDeleteProtectionPermission=as,g.WorksheetDeleteRowPermission=us,g.WorksheetEditExtraObjectPermission=ls,g.WorksheetEditPermission=fe,g.WorksheetFilterPermission=ds,g.WorksheetInsertColumnPermission=cs,g.WorksheetInsertHyperlinkPermission=ms,g.WorksheetInsertRowPermission=hs,g.WorksheetManageCollaboratorPermission=gs,g.WorksheetPivotTablePermission=Rs,g.WorksheetProtectionPointModel=Ut,g.WorksheetProtectionRuleModel=ke,g.WorksheetSelectProtectedCellsPermission=hu,g.WorksheetSelectUnProtectedCellsPermission=gu,g.WorksheetSetCellStylePermission=Cs,g.WorksheetSetCellValuePermission=Wt,g.WorksheetSetColumnStylePermission=St,g.WorksheetSetRowStylePermission=ft,g.WorksheetSortPermission=Ss,g.WorksheetViewPermission=Vt,g.addMergeCellsUtil=ol,g.adjustRangeOnMutation=fr,g.alignToMergedCellsBorders=At,g.baseProtectionActions=Ge,g.checkCellValueType=Vn,g.checkRangesEditablePermission=Od,g.convertPrimaryWithCoordToPrimary=bo,g.convertSelectionDataToRange=Ha,g.copyRangeStyles=$e,g.createTopMatrixFromMatrix=yo,g.createTopMatrixFromRanges=Mo,g.defaultWorkbookPermissionPoints=ai,g.defaultWorksheetPermissionPoint=_n,g.expandToContinuousRange=Wa,g.factoryRemoveNumfmtUndoMutation=$l,g.factorySetNumfmtUndoMutation=Vl,g.findAllRectangle=Gn,g.findFirstNonEmptyCell=xa,g.followSelectionOperation=Ue,g.generateNullCell=qn,g.generateNullCellValue=Uo,g.getAddMergeMutationRangeByType=ks,g.getAllRangePermissionPoint=le,g.getAllWorkbookPermissionPoint=Pt,g.getAllWorksheetPermissionPoint=de,g.getAllWorksheetPermissionPointByPointPanel=Ie,g.getCellAtRowCol=ru,g.getDefaultRangePermission=Pl,g.getInsertRangeMutations=fs,g.getMoveRangeUndoRedoMutations=rn,g.getNextPrimaryCell=Ad,g.getPrimaryForRange=se,g.getRemoveRangeMutations=Is,g.getSelectionsService=$o,g.getSeparateEffectedRangesOnCommand=Bu,g.getSheetCommandTarget=P,g.getSheetCommandTargetWorkbook=Bn,g.getSheetMutationTarget=ve,g.getSkeletonChangedEffectedRange=Pa,g.getValueChangedEffectedRange=Ua,g.getVisibleRanges=Dt,g.handleBaseInsertRange=Qe,g.handleBaseMoveRowsCols=Ht,g.handleBaseRemoveRange=Ze,g.handleCommonDefaultRangeChangeWithEffectRefCommands=Ps,g.handleCommonRangeChangeWithEffectRefCommandsSkipNoInterests=$u,g.handleDefaultRangeChangeWithEffectRefCommands=Us,g.handleDefaultRangeChangeWithEffectRefCommandsSkipNoInterests=Vu,g.handleDeleteRangeMoveLeft=Cr,g.handleDeleteRangeMoveUp=Sr,g.handleDeleteRangeMutation=Cu,g.handleIRemoveCol=Ts,g.handleIRemoveRow=cr,g.handleInsertCol=hr,g.handleInsertRangeMoveDown=gr,g.handleInsertRangeMoveRight=Rr,g.handleInsertRangeMutation=Ru,g.handleInsertRow=mr,g.handleMoveCols=Es,g.handleMoveRange=dr,g.handleMoveRows=bs,g.isSingleCellSelection=au,g.rangeMerge=zn,g.rangeToDiscreteRange=Po,g.rotateRange=he,g.runRefRangeMutations=et,g.setEndForRange=iu,g.splitRangeText=To,g.transformCellsToRange=Pn,Object.defineProperty(g,Symbol.toStringTag,{value:"Module"})}));
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,J,kt,Bi){"use strict";var $d=Object.defineProperty;var Ld=(g,i,O)=>i in g?$d(g,i,{enumerable:!0,configurable:!0,writable:!0,value:O}):g[i]=O;var f=(g,i,O)=>Ld(g,typeof i!="symbol"?i+"":i,O);function Hi(s,e,t){var r,a,u;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 Fi(n)?i.isTextFormat((a=n==null?void 0:n.n)==null?void 0:a.pattern)?i.CellValueType.STRING:no(e,t):i.isTextFormat((u=o==null?void 0:o.n)==null?void 0:u.pattern)?i.CellValueType.STRING:no(e,t)}function no(s,e){return s.v!==void 0?Vn(s.v,s.t):Vn(e.v,e.t)}function Fi(s){var e;return!!((e=s==null?void 0:s.n)!=null&&e.pattern)}function Vn(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,u=e.ranges;for(let l=0;l<u.length;l++)a.push(u[l]);return o.getSpanModel().rebuild(a),!0}},ji=i.createInterceptorKey("CELL_CONTENT"),Gi=i.createInterceptorKey("ROW_FILTERED"),Ae={CELL_CONTENT:ji,ROW_FILTERED:Gi};var so=(s=>(s[s.DATA_VALIDATION=9]="DATA_VALIDATION",s[s.NUMFMT=10]="NUMFMT",s[s.CELL_IMAGE=11]="CELL_IMAGE",s))(so||{});const oo="sheet.interceptor.range-theme-id",ro="sheet.interceptor.ignore-range-theme";var zi=Object.getOwnPropertyDescriptor,qi=(s,e,t,n)=>{for(var o=n>1?void 0:n?zi(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},Yi=(s,e)=>(t,n)=>e(t,n,s);const $n=i.createInterceptorKey("BEFORE_CELL_EDIT"),Zt=i.createInterceptorKey("AFTER_CELL_EDIT"),Qt=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:$n,AFTER_CELL_EDIT:Zt,VALIDATE_CELL:Qt}));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(Ae.CELL_CONTENT,{priority:-1,effect:i.InterceptorEffectEnum.Style|i.InterceptorEffectEnum.Value,handler:n=>n}),this.disposeWithMe(this.writeCellInterceptor.intercept(Zt,{priority:-1,handler:n=>n})),this.disposeWithMe(this.writeCellInterceptor.intercept($n,{priority:-1,handler:n=>n})),this.disposeWithMe(this.writeCellInterceptor.intercept(Qt,{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 u={subUnitId:n.getSheetId(),unitId:t.getUnitId(),workbook:t,worksheet:n,row:o,col:r,origin:i.Tools.deepClone(a)};return this.writeCellInterceptor.fetchThroughInterceptors(Zt)(a,u)}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(Qt)(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((u,l)=>{var d,c;return((d=l.priority)!=null?d:0)-((c=u.priority)!=null?c:0)});if(this._interceptorsDirty=!0,o===Ae.CELL_CONTENT){const u=i.InterceptorEffectEnum.Style|i.InterceptorEffectEnum.Value;this._interceptorsByName.set(`${o}-${u}`,a);const l=i.InterceptorEffectEnum.Style|i.InterceptorEffectEnum.Value;return this._interceptorsByName.set(`${o}-${i.InterceptorEffectEnum.Style}`,a.filter(d=>((d.effect||l)&i.InterceptorEffectEnum.Style)>0)),this._interceptorsByName.set(`${o}-${i.InterceptorEffectEnum.Value}`,a.filter(d=>((d.effect||l)&i.InterceptorEffectEnum.Value)>0)),this.disposeWithMe(i.toDisposable(()=>{i.remove(this._interceptorsByName.get(o),n),i.remove(this._interceptorsByName.get(`${o}-${u}`),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}`,u=o!=null?o:a;let l=this._composedInterceptorByKey.get(u);if(!l||this._interceptorsDirty){let d=this._interceptorsByName.get(a);d&&r&&(d=d.filter(r)),l=i.composeInterceptors(d||[]),this._composedInterceptorByKey.set(u,l)}return l}_interceptWorkbook(t){const n=new i.DisposableCollection,o=t.getUnitId(),r=this,a=u=>{const l=u.getSheetId();u.__interceptViewModel(d=>{const c=new i.DisposableCollection;r._worksheetDisposables.set(io(o,u),c),c.add(d.registerCellContentInterceptor({getCell(m,h,R,C,S){const I=u.getCellRaw(m,h);return r.fetchThroughInterceptors(Ae.CELL_CONTENT,R,C,S)(I,{unitId:o,subUnitId:l,row:m,col:h,worksheet:u,workbook:t,rawData:I})}})),c.add(d.registerRowFilteredInterceptor({getRowFiltered(m){return!!r.fetchThroughInterceptors(Ae.ROW_FILTERED)(!1,{unitId:o,subUnitId:l,row:m,workbook:t,worksheet:u})}}))})};t.getSheets().forEach(u=>a(u)),n.add(t.sheetCreated$.subscribe(u=>a(u))),n.add(i.toDisposable(()=>t.getSheets().forEach(u=>this._disposeSheetInterceptor(o,u)))),n.add(t.sheetDisposed$.subscribe(u=>this._disposeSheetInterceptor(o,u))),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=io(t,n),r=this._worksheetDisposables.get(o);r&&(r.dispose(),this._worksheetDisposables.delete(o))}},g.SheetInterceptorService=qi([Yi(0,i.IUniverInstanceService)],g.SheetInterceptorService);function io(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 Ki(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 x={wholeStyle:1,headerRowStyle:2,headerColumnStyle:4,firstRowStyle:8,secondRowStyle:16,lastRowStyle:32,firstColumnStyle:128,secondColumnStyle:256,lastColumnStyle:512};class We{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|x.lastRowStyle),o&&(a=a|x.lastColumnStyle),e>=0&&t>=0&&(a=a|x.wholeStyle),e%2===1&&(a=a|(r?x.secondRowStyle:x.firstRowStyle)),e%2===0&&(a=a|(r?x.firstRowStyle:x.secondRowStyle)),e===0&&(a=a|x.headerRowStyle),t===0&&(a=a|x.headerColumnStyle),t%2===1&&(a=a|x.firstColumnStyle),t%2===0&&(a=a|x.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&x.wholeStyle&&t.push(this.wholeStyle),this.firstColumnStyle&&e&x.firstColumnStyle&&t.push(this.firstColumnStyle),this.secondColumnStyle&&e&x.secondColumnStyle&&t.push(this.secondColumnStyle),this.firstRowStyle&&e&x.firstRowStyle&&t.push(this.firstRowStyle),this.secondRowStyle&&e&x.secondRowStyle&&t.push(this.secondRowStyle),this.headerColumnStyle&&e&x.headerColumnStyle&&t.push(this.headerColumnStyle),this.lastColumnStyle&&e&x.lastColumnStyle&&t.push(this.lastColumnStyle),this.headerRowStyle&&e&x.headerRowStyle&&t.push(this.headerRowStyle),this.lastRowStyle&&e&x.lastRowStyle&&t.push(this.lastRowStyle),Ki(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 Ji=(s,e,t)=>new We(`light-${s}`,{headerRowStyle:{bg:{rgb:e}},firstColumnStyle:{bg:{rgb:"rgb(255, 255, 255)"}},secondColumnStyle:{bg:{rgb:t}},lastRowStyle:{bg:{rgb:e}}}),xi=(s,e,t)=>new We(`middle-${s}`,{headerRowStyle:{bg:{rgb:e}},headerColumnStyle:{bg:{rgb:t}},secondRowStyle:{bg:{rgb:t}},lastRowStyle:{bg:{rgb:e}},lastColumnStyle:{bg:{rgb:t}}}),Xi=(s,e,t,n)=>new We(`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}}}),Zi=[{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)"}],Qi=[{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)"}],ea=[{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)"}],ta=Zi.map(({baseName:s,header:e,color:t})=>Ji(s,e,t)),na=Qi.map(({baseName:s,rowHeader:e,colHeader:t})=>xi(s,e,t)),sa=ea.map(({baseName:s,rowHeader:e,firstRow:t,secondRow:n})=>Xi(s,e,t,n)),oa=[...ta,...na,...sa],ao={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)"}}},ra=new We("default",ao),ia=new We("default-last-row",{...ao,lastRowStyle:{bd:{t:{s:i.BorderStyleTypes.THIN,cl:{rgb:"rgb(68,114,196)"}}},ht:i.HorizontalAlign.CENTER,bl:i.BooleanNumber.TRUE}});class aa{constructor(){f(this,"_toggleRanges",[])}refresh(e,t){const{startRow:n,endRow:o}=e,r=[];let a=0,u=!1,l=-1;for(let d=n;d<=o;d++){if(!t(d)){a++,a%2===1?u=!0:(u=!1,l!==-1&&(r.push([l,d-1]),l=-1));continue}a%2===1?u?l===-1&&(l=d):(u=!0,l=d):u&&(r.push([l,d-2]),u=!1,l=-1),d===o&&u&&r.push([l,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 ua=Object.getOwnPropertyDescriptor,la=(s,e,t,n)=>{for(var o=n>1?void 0:n?ua(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},Ln=(s,e)=>(t,n)=>e(t,n,s);const da="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(ra),this.registerDefaultRangeTheme(ia);for(const t of oa)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 u=a.getRowCount(),l=a.getRowManager();for(let d=1;d<=u;d++)a.getRowVisible(d)?l.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 aa),a.get(o)}registerRangeThemeRule(t,n){const{unitId:o,subUnitId:r,range:a}=n,u=i.generateRandomId(),l=this._ensureRangeThemeStyleRuleMap(o),d=this._ensureRTreeCollection(o);l.set(u,{rangeInfo:n,themeName:t}),d.insert({unitId:o,sheetId:r,range:a,id:u}),this._getSheetRowVisibleHasInit(o,r)||this.refreshSheetRowVisibleFuncSet(o,r);const c=this._ensureZebraCrossingCache(o,r,u),m=this._getSheetRowVisibleFuncSet(o,r);c.refresh(a,h=>!m.has(h))}getRegisteredRangeThemeStyle(t){const{unitId:n,subUnitId:o,range:r}=t,a=this._ensureRTreeCollection(n),u=Array.from(a.bulkSearch([{unitId:n,sheetId:o,range:r}]));if(u[0]){const d=this._ensureRangeThemeStyleRuleMap(n).get(u[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,u)=>{const d=this._ensureRangeThemeStyleRuleMap(t).get(u);d?a.refresh(d.rangeInfo.range,c=>!this._getSheetRowVisibleFuncSet(t,n).has(c)):r.delete(u)})}removeRangeThemeRule(t,n){const{unitId:o,subUnitId:r,range:a}=n,u=this._ensureRTreeCollection(o),l=Array.from(u.bulkSearch([{unitId:o,sheetId:r,range:a}])),d=this._ensureRangeThemeStyleRuleMap(o);for(let c=0;c<l.length;c++){const m=d.get(l[c]);if(m&&m.themeName===t){d.delete(l[c]),u.remove({unitId:o,sheetId:r,range:a,id:l[c]});const h=this._zebraCrossingCacheMap.get(o);if(h){const R=h.get(r);R&&R.delete(l[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},u=this._ensureRTreeCollection(t),l=Array.from(u.bulkSearch([{unitId:t,sheetId:n,range:a}]));if(l[0]){const c=this._ensureRangeThemeStyleRuleMap(t).get(l[0]);if(c){const{rangeInfo:m,themeName:h}=c,R=o-m.range.startRow,C=r-m.range.startColumn,S=this.getRangeThemeStyle(t,h),v=this._ensureZebraCrossingCache(t,n,l[0]).getIsToggled(o);if(S)return S.getStyle(R,C,o===m.range.endRow,r===m.range.endColumn,v)}}}_registerIntercept(){this.disposeWithMe(this._sheetInterceptorService.intercept(Ae.CELL_CONTENT,{id:oo,effect:i.InterceptorEffectEnum.Style,handler:(t,n,o)=>{const{row:r,col:a,unitId:u,subUnitId:l}=n,d=this.getCellStyle(u,l,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((u,l)=>{r[l]=u});const a={};return o.forEach((u,l)=>{a[l]=u.toJson()}),JSON.stringify({rangeThemeStyleRuleMap:r,rangeThemeStyleMapJson:a})}fromJSON(t,n){const{rangeThemeStyleRuleMap:o,rangeThemeStyleMapJson:r}=n;o&&Object.keys(o).forEach(a=>{const u=o[a],{themeName:l,rangeInfo:d}=u;l.startsWith("table")||(this.registerRangeThemeRule(l,d),this._ensureRTreeCollection(d.unitId).insert({unitId:a,sheetId:d.subUnitId,range:d.range,id:a}))}),r&&Object.keys(r).forEach(a=>{const u=r[a],l=new We(u.name);l.fromJson(u),this._ensureRangeThemeStyleMap(t).set(l.getName(),l)})}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:da,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=la([Ln(0,i.Inject(g.SheetInterceptorService)),Ln(1,i.Inject(i.IResourceManagerService)),Ln(2,i.Inject(i.IUniverInstanceService))],g.SheetRangeThemeModel);function Bn(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 ve(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 rt={id:"sheet.mutation.set-worksheet-range-theme-style",type:i.CommandType.MUTATION,handler:(s,e)=>{const{unitId:t,subUnitId:n,range:o,themeName:r}=e,a=s.get(i.IUniverInstanceService),u=P(a),l=s.get(g.SheetRangeThemeModel);return u?(l.registerRangeThemeRule(r,{range:o,unitId:t,subUnitId:n}),!0):!1}},uo=(s,e)=>{const t=ve(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}},it={id:"sheet.mutation.remove-worksheet-range-theme-style",type:i.CommandType.MUTATION,handler:(s,e)=>{const{unitId:t,subUnitId:n,range:o,themeName:r}=e,a=s.get(i.IUniverInstanceService),u=P(a),l=s.get(g.SheetRangeThemeModel);return u?(l.removeRangeThemeRule(r,{range:o,unitId:t,subUnitId:n}),!0):!1}},lo=(s,e)=>{const t=ve(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}},en=(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,u=s.get(i.IUniverInstanceService).getUniverSheetInstance(t);if(u==null)throw new Error("universheet is null error!");const l=u.getSheetBySheetId(n);if(l==null)throw new Error("worksheet is null error!");const d=l.getRowManager().getRowData(),c={h:l.getConfig().defaultRowHeight,hd:0},m=o.startRow,h=o.endRow-o.startRow+1;for(let S=m;S<m+h;S++)r?i.insertMatrixArray(S,(C=r[S-o.startRow])!=null?C:c,d):i.insertMatrixArray(S,c,d);return l.setRowCount(l.getRowCount()+h),l.getCellMatrix().insertRows(o.startRow,h),!0}},Nt=(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:u}=e,d=r.getColumnData(),c=a.startColumn,m=a.endColumn-a.startColumn+1,h=o.getConfig().defaultColumnWidth;for(let S=c;S<c+m;S++){const I={w:h,hd:0};u?i.insertMatrixArray(S,(C=u[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,m),!0}},Le={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),u=r.getSheetBySheetId(e.to.subUnitId);if(!a||!u)return!1;const l=a.getCellMatrix(),d=u.getCellMatrix();return new i.ObjectMatrix(t.value).forValue((c,m,h)=>{h==null?l.realDeleteValue(c,m):l.setValue(c,m,h)}),new i.ObjectMatrix(n.value).forValue((c,m,h)=>{h==null?d.realDeleteValue(c,m):d.setValue(c,m,h)}),!0}};function co(s,e){const{unitId:t,subUnitId:n,sourceRange:o,targetRange:r}=e,a=o.startRow>r.startRow,u=o.endRow-o.startRow+1;return a?{unitId:t,subUnitId:n,sourceRange:i.Rectangle.clone(r),targetRange:{...o,endRow:o.endRow+u,startRow:o.startRow+u}}:{unitId:t,subUnitId:n,targetRange:i.Rectangle.clone(o),sourceRange:{...r,endRow:r.endRow-u,startRow:r.startRow-u}}}const pe={id:"sheet.mutation.move-rows",type:i.CommandType.MUTATION,handler:(s,e)=>{const{unitId:t,subUnitId:n,sourceRange:o,targetRange:r}=e,u=s.get(i.IUniverInstanceService).getUniverSheetInstance(t);if(!u)throw new Error("[MoveRowMutation] univerSheet is null!");const l=u.getSheetBySheetId(n);if(!l)throw new Error("[MoveRowMutation] worksheet is null!");const d=o.startRow,c=o.endRow-o.startRow+1,m=r.startRow,h=l.getRowManager().getRowData();return i.moveMatrixArray(d,c,m,h),l.getCellMatrix().moveRows(d,c,m),!0}};function mo(s,e){const{unitId:t,subUnitId:n,sourceRange:o,targetRange:r}=e,a=o.startColumn>r.startColumn,u=o.endColumn-o.startColumn+1;return a?{unitId:t,subUnitId:n,sourceRange:i.Rectangle.clone(r),targetRange:{...o,endColumn:o.endColumn+u,startColumn:o.startColumn+u}}:{unitId:t,subUnitId:n,targetRange:i.Rectangle.clone(o),sourceRange:{...r,startColumn:r.startColumn-u,endColumn:r.endColumn-u}}}const we={id:"sheet.mutation.move-columns",type:i.CommandType.MUTATION,handler:(s,e)=>{const{unitId:t,subUnitId:n,sourceRange:o,targetRange:r}=e,u=s.get(i.IUniverInstanceService).getUniverSheetInstance(t);if(!u)throw new Error("[MoveColumnMutation] univerSheet is null!");const l=u.getSheetBySheetId(n);if(!l)throw new Error("[MoveColumnMutation] worksheet is null!");const d=o.startColumn,c=o.endColumn-o.startColumn+1,m=r.startColumn,h=l.getColumnManager().getColumnData();return i.moveMatrixArray(d,c,m,h),l.getCellMatrix().moveColumns(d,c,m),!0}},ca=(s,e)=>{const o=e.getRowManager().getRowData(),r={},a=s.range,u=i.sliceMatrixArray(a.startRow,a.endRow,o),l=i.concatMatrixArray(r,u);return{unitId:s.unitId,subUnitId:s.subUnitId,range:s.range,rowInfo:l}},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,u=o.getRowManager().getRowData();for(let c=r.startRow;c<=r.endRow;c++)o.getRowFiltered(c);const l=r.endRow-r.startRow+1;return i.spliceArray(r.startRow,l,u),o.getCellMatrix().removeRows(r.startRow,l),o.setRowCount(o.getRowCount()-l),!0}},ma=(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 u=o.getColumnManager().getColumnData(),l={},d=e.range,c=i.sliceMatrixArray(d.startColumn,d.endColumn,u),m=i.concatMatrixArray(l,c);return{unitId:e.unitId,subUnitId:e.subUnitId,range:e.range,colInfo:m}},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,u=o.getColumnManager().getColumnData(),l=r.endColumn-r.startColumn+1;return i.spliceArray(r.startColumn,l,u),o.setColumnCount(o.getColumnCount()-l),o.getCellMatrix().removeColumns(r.startColumn,l),!0}},ue=(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,u=e.ranges,l=[];for(let d=0;d<u.length;d++)for(let c=a.length-1;c>=0;c--){const m=a[c],h=u[d];i.Rectangle.intersects(m,h)&&l.push(a[c])}return{unitId:e.unitId,subUnitId:e.subUnitId,ranges:l}},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,u=e.ranges;for(let l=0;l<u.length;l++)for(let d=a.length-1;d>=0;d--){const c=a[d],m=u[l];i.Rectangle.intersects(c,m)&&a.splice(d,1)}return o.getSpanModel().rebuild(a),!0}},ho=s=>{const{order:e}=s,t={};return Object.keys(e).forEach(n=>{t[e[Number(n)]]=Number(n)}),{...s,order:t}},Ot={id:"sheet.mutation.reorder-range",type:i.CommandType.MUTATION,handler:(s,e)=>{const{subUnitId:t,unitId:n,range:o,order:r}=e,l=s.get(i.IUniverInstanceService).getUnit(n).getSheetBySheetId(t);if(!l)return!1;const d=new i.ObjectMatrix;i.Range.foreach(o,(m,h)=>{if(r.hasOwnProperty(m)){const R=r[m],C=i.Tools.deepClone(l.getCellRaw(R,h));d.setValue(m,h,C)}});const c=l.getCellMatrix();return d.forValue((m,h,R)=>{c.setValue(m,h,R)}),!0}};function ha(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 ga(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 go=(s,e)=>{const{unitId:t,subUnitId:n,columnData:o}=s,r={},a=e.getColumnManager();for(const u in o){const l=o[u],d=a.getColumn(Number(u));r[u]=ga(d,l)}return{unitId:t,subUnitId:n,columnData:r}},at={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 u in t){const l=t[u];if(l==null){a.removeColumn(Number(u));continue}const d=a.getColumnOrCreate(Number(u));Object.assign(d,l)}return!0}},Ra=(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}},ut={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 u=a.startColumn;u<a.endColumn+1;u++){const l=o.getColumnOrCreate(u);l!=null&&(l.hd=i.BooleanNumber.TRUE)}}return!0}},Ca=(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}},lt={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 u=a.startColumn;u<a.endColumn+1;u++){const l=o.getColumnOrCreate(u);l!=null&&(l.hd=i.BooleanNumber.FALSE)}}return!0}},dt={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 Sa(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=tn(n,t.s?t.s:null);o&&(i.Tools.removeNull(o),Object.entries(o).forEach(([u,l])=>{typeof l=="object"&&l!==null&&Object.keys(l).length===0&&delete o[u]})),i.Tools.isEmptyObject(o)?delete e.s:e.s=s.setValue(o);const r=t.v?`${t.v}\r
11
+ `:"";!t.p&&e.p&&(r&&r!==((a=e.p.body)==null?void 0:a.dataStream)?delete e.p:va(e.p,t.s?t.s:null))}function fa(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]=Ia(t[n]||{},e[n]):n in t||(t[n]=null);return t}function Ia(s,e){if(!e||!Object.keys(e).length)return s;for(const t in e)t in s||(s[t]=null);return s}function tn(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 Ro(s,e){return s.some(t=>t.startIndex===e)?Ro(s,e+1):e}function va(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 u of s.body.textRuns){const{st:l,ed:d,ts:c={}}=u;if(t<l){const h={st:t,ed:l},R=tn({},e,!0);R&&i.Tools.removeNull(R),i.Tools.isEmptyObject(R)||(h.ts=R),n.push(h)}const m=tn(c,e,!0);m&&i.Tools.removeNull(m),i.Tools.isEmptyObject(m)?delete u.ts:u.ts=m,n.push(u),t=Ro(o,d)}const r=s.body.dataStream.endsWith(`\r
12
+ `)?s.body.dataStream.length-2:s.body.dataStream.length;if(t<r){const u={st:t,ed:r},l=tn({},e,!0);l&&i.Tools.removeNull(l),i.Tools.isEmptyObject(l)||(u.ts=l),n.push(u)}s.body.textRuns=i.normalizeTextRuns(n)}function Co(s,e){return e.v===void 0||e.v===null?e.v:s===i.CellValueType.NUMBER?Number(e.v):s===i.CellValueType.BOOLEAN?pa(e.v)?1:0:s===i.CellValueType.STRING||s===i.CellValueType.FORCE_STRING?`${e.v}`:e.v}function pa(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 u=a.getSheetBySheetId(n);if(u==null)throw new Error("worksheet is null error!");const l=u.getCellMatrix(),d=a.getStyles(),c=new i.ObjectMatrix;return new i.ObjectMatrix(o).forValue((h,R,C)=>{const S=i.Tools.deepClone(l==null?void 0:l.getValue(h,R))||{},I=d.getStyleByCell(S),v=d.getStyleByCell(C);S.s=fa(I,v),c.setValue(h,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 u=a.getSheetBySheetId(n);if(!u)return!1;const l=u.getCellMatrix(),d=a.getStyles();return new i.ObjectMatrix(t).forValue((m,h,R)=>{if(!R)l.realDeleteValue(m,h);else{let C=l.getValue(m,h)||{};C=ya(R,C,d),i.Tools.isEmptyObject(C)?l.realDeleteValue(m,h):l.setValue(m,h,C)}}),!0}},Ma=new Set(["f","p","si","custom","ref","xf"]);function ya(s,e,t){const n=Hi(t,s,e);return Object.keys(s).forEach(o=>{const r=o;if(Ma.has(r)){const a=s[r];_a(e,r,a)}else r==="v"?s.v!==void 0&&(e.v=Co(n,s)):r==="s"&&Sa(t,e,s)}),e.v!==void 0&&(e.t=n,e.v=Co(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 So=(s,e)=>{const{unitId:t,subUnitId:n,rowData:o}=s,r={},a=e.getRowManager();for(const u in o){const l=o[u],d=a.getRow(Number(u));r[u]=ha(d,l)}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 u in t){const l=t[u];if(l==null){a.removeRow(Number(u));continue}const d=a.getRowOrCreate(Number(u));Object.assign(d,l)}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}},Ye={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 u=a.startRow;u<a.endRow+1;u++){const l=o.getRowOrCreate(u);l!=null&&(l.hd=0)}}return!0}},Ea=(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}},Ke={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 u=a.startRow;u<a.endRow+1;u++){const l=o.getRowOrCreate(u);l!=null&&(l.hd=1)}}return!0}};function Hn(s){const e={},t={},n=Object.keys(s).map(Number).sort((o,r)=>o-r);if(n.length===0)return e;for(const o of n){const r=s[o];if(!i.Tools.isDefine(r))continue;const a=String(r);t[a]||(t[a]=[]),t[a].push(o)}for(const[o,r]of Object.entries(t)){const a=[];if(r.length===0)continue;let u=r[0],l=u;for(let d=1;d<r.length;d++){const c=r[d];c!==l+1&&(u===l?a.push(u):a.push([u,l]),u=c),l=c}u===l?a.push(u):a.push([u,l]),a.length===1&&typeof a[0]=="number"?e[o]=a[0]:e[o]=a}return e}function Fn(s){const e={};for(const[t,n]of Object.entries(s)){const o=Number(t);if(typeof n=="number"){e[n]=o;continue}for(const r of n)if(Array.isArray(r)){const[a,u]=r;for(let l=a;l<=u;l++)e[l]=o}else e[r]=o}return e}const jn=(s,e)=>{const{unitId:t,subUnitId:n,ranges:o}=s,r={},a=e.getColumnManager();for(let u=0;u<o.length;u++){const l=o[u];for(let d=l.startColumn;d<l.endColumn+1;d++)r[d]=a.getColumnWidth(d)}return{unitId:t,subUnitId:n,ranges:o,colWidth:{compress:!0,data:Hn(r)}}},Ve={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 u=0;u<a.length;u++){const l=a[u];for(let d=l.startColumn;d<l.endColumn+1;d++)if(o.getColVisible(d))if(typeof e.colWidth=="number")r.setColumnWidth(d,e.colWidth);else if(e.colWidth&&typeof e.colWidth=="object"&&"compress"in e.colWidth){const{data:m}=e.colWidth,h=Fn(m);i.Tools.isDefine(h[d])&&r.setColumnWidth(d,h[d])}else i.Tools.isDefine(e.colWidth[d])&&r.setColumnWidth(d,e.colWidth[d])}return!0}},fo=(s,e)=>{const t=ve(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()}},mt={id:"sheet.mutation.set-worksheet-column-count",type:i.CommandType.MUTATION,handler:(s,e)=>{const t=s.get(i.IUniverInstanceService),n=ve(t,e);return n?(n.worksheet.setColumnCount(e.columnCount),!0):!1}},ht={id:"sheet.mutation.set-worksheet-default-style",type:i.CommandType.MUTATION,handler:(s,e)=>{const{defaultStyle:t}=e,n=s.get(i.IUniverInstanceService),o=P(n);if(!o)return!1;const{worksheet:r}=o;return r?(r.setDefaultCellStyle(t),!0):!1}},Io=(s,e)=>{const t=ve(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()}},vo=(s,e)=>{const t=ve(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()}},gt={id:"sheet.mutation.set-worksheet-row-count",type:i.CommandType.MUTATION,handler:(s,e)=>{const t=s.get(i.IUniverInstanceService),n=ve(t,e);return n?(n.worksheet.setRowCount(e.rowCount),!0):!1}},po=(s,e)=>{var u,l;const{unitId:t,subUnitId:n,ranges:o}=s,r={},a=e.getRowManager();for(const{startRow:d,endRow:c}of o)for(let m=d;m<c+1;m++)r[m]=(l=(u=a.getRow(m))==null?void 0:u.h)!=null?l:e.getConfig().defaultRowHeight;return{unitId:t,subUnitId:n,ranges:o,rowHeight:{compress:!0,data:Hn(r)}}},Gn=(s,e)=>{var u;const{unitId:t,subUnitId:n,ranges:o}=s,r={},a=e.getRowManager();for(const{startRow:l,endRow:d}of o)for(let c=l;c<=d;c++)r[c]=(u=a.getRow(c))==null?void 0:u.ia;return{unitId:t,subUnitId:n,ranges:o,autoHeightInfo:r}},Ta=(s,e)=>{var u,l;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:(l=(u=a.getRow(c))==null?void 0:u.ah)!=null?l:e.getConfig().defaultRowHeight})}return{unitId:t,subUnitId:n,rowsAutoHeightInfo:r}},Ee={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,u=a.getRowManager();for(const{startRow:l,endRow:d}of t)for(let c=l;c<=d;c++)if(typeof n=="number")u.setRowHeight(c,n);else if(n&&typeof n=="object"&&"compress"in n){const{data:m}=n,h=Fn(m);i.Tools.isDefine(h[c])&&u.setRowHeight(c,h[c])}else i.Tools.isDefine(n[c])&&u.setRowHeight(c,n[c]);return!0}},Re={id:"sheet.mutation.set-worksheet-row-is-auto-height",type:i.CommandType.MUTATION,handler:(s,e)=>{var u;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:l,endRow:d}of t)for(let c=l;c<=d;c++){const m=a.getRowOrCreate(c);typeof n=="number"?m.ia=n:m.ia=(u=n[c])!=null?u:void 0}return!0}},zn={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:u}of t){const l=r.getRowOrCreate(a);l.ah=u}return!0}},Rt={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}},Ct={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 wo=(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))(wo||{}),Mo=(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))(Mo||{});const Ua=[Ee.id,Re.id,zn.id,Ve.id,Ct.id,pe.id,we.id,ut.id,lt.id,Ke.id,Ye.id,ie.id,re.id,ne.id,ae.id,Rt.id,dt.id,gt.id,mt.id],Pa=[F.id,Le.id,G.id,j.id,Ot.id,ht.id,ct.id,at.id,rt.id,it.id];function ka(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 Na(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 yo(s){return s==null?!1:s.v!==void 0&&s.v!==null&&s.v!==""||s.p!==void 0}function nn(s,e){return s&&s.spanAnchor?yo(e.getValue(s.spanAnchor.startRow,s.spanAnchor.startColumn)):yo(s)}function Oa(s,e,t,n,o){const r=s.getCellMatrix(),a=s.getSpanModel().getMergedCellRange(e,t,n,o),u=new i.ObjectMatrix;return r.forValue((l,d)=>{const c=r.getValue(l,d);c&&u.setValue(l,d,c)}),a.forEach(l=>{const{startColumn:d,startRow:c,endColumn:m,endRow:h}=l;i.createRowColIter(c,h,d,m).forEach((R,C)=>{R===c&&C===d&&u.setValue(R,C,{...r.getValue(R,C),spanAnchor:{startRow:c,endRow:h,startColumn:d,endColumn:m}}),(R!==c||C!==d)&&(u.realDeleteValue(R,C),u.setValue(R,C,{spanAnchor:{startRow:c,endRow:h,startColumn:d,endColumn:m}}))})}),u}function Da(s,e,t,n){const{startRow:o,startColumn:r,endRow:a}=s;let u=null,l=!1;for(let d=o;d<=a;d++){const c=e.getValue(d,r-t);if(l=l||nn(c,e),!n&&l)break;c&&c.spanAnchor&&(u?u={startRow:Math.min(c.spanAnchor.startRow,u.startRow),startColumn:Math.min(c.spanAnchor.startColumn,u.startColumn),endRow:Math.max(c.spanAnchor.endRow,u.endRow),endColumn:Math.max(c.spanAnchor.endColumn,u.endColumn)}:u={startRow:c.spanAnchor.startRow,startColumn:c.spanAnchor.startColumn,endRow:c.spanAnchor.endRow,endColumn:c.spanAnchor.endColumn})}return l?(s.startColumn=s.startColumn-t,{spanAnchor:u,hasValue:!0,range:s}):{spanAnchor:null,hasValue:!1,range:s}}function Aa(s,e,t,n){const{startRow:o,endColumn:r,endRow:a}=s;let u=null,l=!1;for(let d=o;d<=a;d++){const c=e.getValue(d,r+t);if(l=l||nn(c,e),!n&&l)break;c&&c.spanAnchor&&(u?u={startRow:Math.min(c.spanAnchor.startRow,u.startRow),startColumn:Math.min(c.spanAnchor.startColumn,u.startColumn),endRow:Math.max(c.spanAnchor.endRow,u.endRow),endColumn:Math.max(c.spanAnchor.endColumn,u.endColumn)}:u={startRow:c.spanAnchor.startRow,startColumn:c.spanAnchor.startColumn,endRow:c.spanAnchor.endRow,endColumn:c.spanAnchor.endColumn})}return l?(s.endColumn=s.endColumn+t,{spanAnchor:u,hasValue:!0,range:s}):{spanAnchor:null,hasValue:!1,range:s}}function Wa(s,e,t,n){const{startRow:o,startColumn:r,endColumn:a}=s;let u=null,l=!1;for(let d=r;d<=a;d++){const c=e.getValue(o-t,d);if(l=l||nn(c,e),!n&&l)break;c&&c.spanAnchor&&(u?u={startRow:Math.min(c.spanAnchor.startRow,u.startRow),startColumn:Math.min(c.spanAnchor.startColumn,u.startColumn),endRow:Math.max(c.spanAnchor.endRow,u.endRow),endColumn:Math.max(c.spanAnchor.endColumn,u.endColumn)}:u={startRow:c.spanAnchor.startRow,startColumn:c.spanAnchor.startColumn,endRow:c.spanAnchor.endRow,endColumn:c.spanAnchor.endColumn})}return l?(s.startRow=s.startRow-t,{spanAnchor:u,hasValue:!0,range:s}):{spanAnchor:null,hasValue:!1,range:s}}function Va(s,e,t,n){const{startColumn:o,endColumn:r,endRow:a}=s;let u=null,l=!1;for(let d=o;d<=r;d++){const c=e.getValue(a+t,d);if(l=l||nn(c,e),!n&&l)break;c&&c.spanAnchor&&(u?u={startRow:Math.min(c.spanAnchor.startRow,u.startRow),startColumn:Math.min(c.spanAnchor.startColumn,u.startColumn),endRow:Math.max(c.spanAnchor.endRow,u.endRow),endColumn:Math.max(c.spanAnchor.endColumn,u.endColumn)}:u={startRow:c.spanAnchor.startRow,startColumn:c.spanAnchor.startColumn,endRow:c.spanAnchor.endRow,endColumn:c.spanAnchor.endColumn})}return l?(s.endRow=s.endRow+t,{spanAnchor:u,hasValue:!0,range:s}):{spanAnchor:null,hasValue:!1,range:s}}function $a(s,e,t){const n=t.getMaxRows(),o=t.getMaxColumns(),r=Oa(t,0,0,n-1,o-1),a=t.getSnapshot().mergeData.length>0,{left:u,right:l,up:d,down:c}=e;let m=!0,h={...s};const R=[];for(;m;){if(m=!1,d&&h.startRow!==0){const{hasValue:C,range:S,spanAnchor:I}=Wa(h,r,1,a);if(I&&R.push(I),C){h=S,m=!0;continue}}if(c&&h.endRow!==n-1){const{hasValue:C,range:S,spanAnchor:I}=Va(h,r,1,a);if(I&&R.push(I),C){h=S,m=!0;continue}}if(u&&h.startColumn!==0){const{hasValue:C,range:S,spanAnchor:I}=Da(h,r,1,a);if(I&&R.push(I),C){h=S,m=!0;continue}}if(l&&h.endColumn!==o-1){const{hasValue:C,range:S,spanAnchor:I}=Aa(h,r,1,a);if(I&&R.push(I),C){h=S,m=!0;continue}}}return R.length>0&&(h=i.Rectangle.union(h,...R)),h}const _o=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},bo=s=>{const e=s;return e.forValue((t,n)=>{const o=s.getValue(t-1,n);o&&e.setValue(t,n,o+1)}),e},Eo=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,u=r;t(a*u,{startRow:n-u+1,endRow:n,startColumn:o,endColumn:o});const l={startRow:n-u+1,endRow:n,startColumn:0,endColumn:o};for(let d=o-1;d>=0&&s.getValue(n,d);d--){u=Math.min(s.getValue(n,d)||0,u),a++;const c=u*a;l.startColumn=d,l.startRow=n-u+1,t(c,l)}}),e},La=(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},qn=s=>{const e=[];let t=Eo(s);for(;t.area>0;)t.range&&(e.push(t.range),La(s,t.range)),t=Eo(s);return e},Yn=s=>{const e=_o(s);return qn(e)};class Ba{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=bo(this._matrix);return qn(e)}}const Ha=1.5,Fa="rgba(255, 255, 255, 0.01)";function ja(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=To(t)),o}function To(s){const{actualRow:e,actualColumn:t,isMerged:n,isMergedMainCell:o}=s,{startRow:r,startColumn:a,endRow:u,endColumn:l}=s.mergeInfo;return{actualRow:e,actualColumn:t,isMerged:n,isMergedMainCell:o,startRow:r,startColumn:a,endRow:u,endColumn:l}}var Uo=(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))(Uo||{});class Ga{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 za(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+=qa(a);let r="[".concat(o,"]");return e&&(r+="+"),new RegExp(r)}function qa(s){return s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const Ya=s=>{var t;return((t=s.body)==null?void 0:t.dataStream.replace(/\r\n$/,""))||""};function Ka(s){if(s!=null){if(s.p)return Ya(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 Po(s,e,t,n,o=!1){const r=i.Range.transformRange(e,s),{startColumn:a,startRow:u,endColumn:l,endRow:d}=r;if(a!==l)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,m=c?new Ga:null,h=[];for(let p=u;p<=d;p++){const w=s.getCell(p,a),y=Ka(w);h.push(y),m&&m.update(y)}const R=c?m.getDelimiter():t,C=za(R,o,n);let S=-1,I=0,v=0;const M=[];for(const p of h){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 Ja=(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)},{}),xa=(s=0)=>{let e=s;return function(){return e++}};function Xa(s){return s==null?!1:s.v!==void 0&&s.v!==null&&s.v!==""||s.p!==void 0}function Za(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(Xa(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 u=n;u<=r;u++)for(let l=o;l<=a;l++)e.setValue(u,l,null)}),e.clone()}function ko(s){const e=new i.ObjectMatrix;return s.forEach(t=>{const{startRow:n,startColumn:o,endRow:r,endColumn:a}=t;for(let u=n;u<=r;u++)for(let l=o;l<=a;l++)e.setValue(u,l,{v:null,p:null,f:null,si:null,custom:null})}),e.clone()}function Qa(s){const e=new i.ObjectMatrix;return s.forEach(t=>{const{startRow:n,startColumn:o,endRow:r,endColumn:a}=t;for(let u=n;u<=r;u++)for(let l=o;l<=a;l++)e.setValue(u,l,{s:null})}),e.clone()}function No(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:u,endRow:l,startColumn:d,endColumn:c}=s,m=[],h=[];for(let R=u;R<=l;R++)a.getRowFiltered(R)||m.push(R);for(let R=d;R<=c;R++)h.push(R);return{rows:m,cols:h}}function Dt(s,e,t,n){const o=[],r=[];for(const h of s){const R=No(h,e,t,n);R&&(o.push(...R.rows),r.push(...R.cols))}const a=Array.from(new Set(o)).sort((h,R)=>h-R),u=Array.from(new Set(r)).sort((h,R)=>h-R),l=[];function d(h){const R=[];let C=h[0];for(let S=1;S<h.length;S++)h[S]!==h[S-1]+1&&(R.push([C,h[S-1]]),C=h[S]);return R.push([C,h[h.length-1]]),R}const c=d(a),m=d(u);for(const[h,R]of c)for(const[C,S]of m)l.push({startRow:h,endRow:R,startColumn:C,endColumn:S});return l}var Oo=(s=>(s.OthersCanView="othersCanView",s.NoOneElseCanView="noOneElseCanView",s))(Oo||{}),Do=(s=>(s.DesignedUserCanEdit="designedUserCanEdit",s.OnlyMe="onlyMe",s))(Do||{});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,u,l;const o=(a=(r=this._model.get(e))==null?void 0:r.get(t))==null?void 0:a.get(n);o&&((l=(u=this._model.get(e))==null?void 0:u.get(t))==null||l.delete(n),this._ruleChange$.next({unitId:e,subUnitId:t,rule:o,type:"delete"}))}setRule(e,t,n,o){var a,u;const r=this.getRule(e,t,n);r&&((u=(a=this._model.get(e))==null?void 0:a.get(t))==null||u.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 u=o.get(a);e[n][a]=[...u.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 u=o[a].reduce((l,d)=>(l.set(d.id,d),l),new Map);r.set(a,u)}),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 eu=(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}}},Te={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}},tu=s=>{const e={...s,ruleIds:s.rules.map(t=>t.id)};return{id:Te.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}},Ao={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:u,subUnitId:l,ranges:d,description:c,viewState:m,editState:h}=r,R=[{ranges:d,permissionId:a,id:o.createRuleId(u,l),description:c,unitType:r.unitType,unitId:u,subUnitId:l,viewState:m,editState:h}];if(await t.executeCommand(Ce.id,{unitId:u,subUnitId:l,rules:R})){const S=[{id:Ce.id,params:{unitId:u,subUnitId:l,rules:R}}],I=[{id:Te.id,params:{unitId:u,subUnitId:l,ruleIds:R.map(v=>v.id)}}];n.pushUndoRedo({unitID:u,redoMutations:S,undoMutations:I})}return!0}};var te=(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))(te||{});class Wo 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 te.MOVE_START:this._selectionMoveStart$.next(n);break;case te.MOVING:this._selectionMoving$.next(n);break;case te.MOVE_END:this._beforeSelectionMoveEnd$.next(n),this._selectionMoveEnd$.next(n);break;case te.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 nu=Object.getOwnPropertyDescriptor,su=(s,e,t,n)=>{for(var o=n>1?void 0:n?nu(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},ou=(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:u}=r;this._ensureWorkbookSelection(a).addSelections(u,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:te.ONLY_SET);return}const a=this._currentSelectionPos;if(!a)throw new Error("[SheetsSelectionsService]: cannot find current selection position!");const{unitId:u,sheetId:l}=a;if(typeof t=="object"){const d=t!=null?t:o,c=n!=null?n:te.ONLY_SET;this._ensureWorkbookSelection(u).setSelections(l,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 Wo(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 u=0;u<o.length;u++){const l=o[u],{startRow:d,endRow:c,startColumn:m,endColumn:h}=l.range;for(let R=d;R<=c;R++)for(let C=m;C<=h;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=su([ou(0,i.IUniverInstanceService)],g.SheetsSelectionsService);const ru="DISABLE_NORMAL_SELECTIONS",iu="SELECTIONS_ENABLED",Vo="REF_SELECTIONS_ENABLED",sn={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),u=t.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET);if(!u)return!1;const l=(e==null?void 0:e.unitId)||u.getUnitId(),d=u.getActiveSheet();if(!d)return!1;const c=(e==null?void 0:e.subUnitId)||d.getSheetId(),m=(e==null?void 0:e.ranges)||((p=o.getCurrentSelections())==null?void 0:p.map(w=>w.range));if(!(m!=null&&m.length))return!1;const h=Dt(m,s,l,c),R=[],C=[],S={subUnitId:c,unitId:l,cellValue:Kn(h)},I=ce(s,S);R.push({id:F.id,params:S}),C.push({id:F.id,params:I});const v=a.onCommandExecute({id:sn.id});return R.push(...v.redos),C.unshift(...v.undos),i.sequenceExecute(R,n)?(r.pushUndoRedo({unitID:l,undoMutations:C,redoMutations:R}),!0):!1}},on={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),u=t.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET);if(!u)return!1;const l=(e==null?void 0:e.unitId)||u.getUnitId(),d=u.getActiveSheet();if(!d)return!1;const c=(e==null?void 0:e.subUnitId)||d.getSheetId(),m=(e==null?void 0:e.ranges)||((p=o.getCurrentSelections())==null?void 0:p.map(w=>w.range));if(!(m!=null&&m.length))return!1;const h=Dt(m,s,l,c),R=[],C=[],S={subUnitId:c,unitId:l,cellValue:Qa(h)},I=ce(s,S);R.push({id:F.id,params:S}),C.push({id:F.id,params:I});const v=a.onCommandExecute({id:on.id});return R.push(...v.redos),C.unshift(...v.undos),i.sequenceExecute(R,n)?(r.pushUndoRedo({unitID:l,undoMutations:C,redoMutations:R}),!0):!1}};function At(s,e,t=!0){const n=e.getMatrixWithMergedCells(...i.selectionToArray(s)),o=[];if(n.forValue((a,u,l)=>{if(l.colSpan!==void 0&&l.rowSpan!==void 0){const d={startRow:a,startColumn:u,endRow:a+l.rowSpan-1,endColumn:u+l.colSpan-1};i.Rectangle.contains(s,d)||o.push(d)}}),o.length===0)return s;const r=i.Rectangle.union(s,...o);return t?At(r,e,t):r}function au(s,e,t){let n=null;return t.getMatrixWithMergedCells(s,e,s,e).forValue((r,a,u)=>(n={actualRow:r,actualColumn:a,startRow:r,startColumn:a,isMerged:u.rowSpan!==void 0||u.colSpan!==void 0,isMergedMainCell:u.rowSpan!==void 0&&u.colSpan!==void 0,endRow:r+(u.rowSpan!==void 0?u.rowSpan-1:0),endColumn:a+(u.colSpan!==void 0?u.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 uu(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 Ue=(s,e,t)=>({id:q.id,params:{unitId:e.getUnitId(),subUnitId:t.getSheetId(),reveal:!0,selections:[{range:s,primary:se(s,t)}]}});function lu(s){if(!s)return!1;const{range:e,primary:t}=s;return i.Rectangle.equals(e,t)}function du(s){function e(t,n){function o(r){for(let a=r.startRow;a<=r.endRow;a++)if(!s.getRowFiltered(a))for(let u=r.startColumn;u<=r.endColumn;u++)n(a,u,r)}o(t)}return{forOperableEach:e}}const $o=s=>s.id!==oo;function $e(s,e,t,n,o,r,a){const u={};for(let l=e;l<=t;l++)for(let d=n;d<=o;d++){const c=r?s.getCellWithFilteredInterceptors(a,d,ro,$o):s.getCellWithFilteredInterceptors(l,a,ro,$o);!c||!c.s||(u[l]||(u[l]={}),u[l][d]={s:c.s})}return u}var cu=Object.getOwnPropertyDescriptor,mu=(s,e,t,n)=>{for(var o=n>1?void 0:n?cu(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},hu=(s,e)=>(t,n)=>e(t,n,s);const Lo=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=mu([hu(0,i.IUniverInstanceService)],g.RefSelectionsService);function Bo(s,e){const n=s.get(i.IContextService).getContextValue(Vo);return s.get(n&&!e?Lo: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 Bo(s).setSelections(o,r,[...t],n),!0}},Ho={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 u=[{range:o,primary:se(o,a.worksheet),style:null}];return r.syncExecuteCommand(q.id,{unitId:t,subUnitId:n,selections:u})}},Fo="sheet.command.move-range",Je={type:i.CommandType.COMMAND,id:Fo,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),u=s.get(g.SheetInterceptorService),l=P(o);if(!l||!await u.beforeCommandExecute({id:Je.id,params:e}))return!1;const{worksheet:c,subUnitId:m,unitId:h}=l,R=rn(s,{unitId:h,subUnitId:m,range:e.fromRange},{subUnitId:m,range:e.toRange});if(R===null)return r.emit(a.t("sheets.info.acrossMergedCell")),!1;const C=u.onCommandExecute({id:Je.id,params:e}),S=[...(M=C.preRedos)!=null?M:[],...R.redos,...C.redos,{id:q.id,params:{unitId:h,subUnitId:m,selections:[{range:e.toRange,primary:gu(e.fromRange,e.toRange,c)}],type:te.MOVE_END}}],I=[...(p=C.preUndos)!=null?p:[],...R.undos,...C.undos,{id:q.id,params:{unitId:h,subUnitId:m,selections:[{range:e.fromRange,primary:se(e.fromRange,c)}],type:te.MOVE_END}}];if(i.sequenceExecute(S,t).result){const{undos:w,redos:y}=u.generateMutationsOfAutoHeight({unitId:h,subUnitId:m,ranges:[e.fromRange,e.toRange]}),b=u.afterCommandExecute({id:Je.id,params:e});return i.sequenceExecute([...b.redos,...y],t),n.pushUndoRedo({unitID:h,undoMutations:[...I,...b.undos,...w],redoMutations:[...S,...b.redos,...y]}),!0}return!1}};function rn(s,e,t,n=!1){const o=[],r=[],{range:a,subUnitId:u,unitId:l}=e,{range:d,subUnitId:c}=t,h=s.get(i.IUniverInstanceService).getUniverSheetInstance(l),R=h==null?void 0:h.getSheetBySheetId(c),C=h==null?void 0:h.getSheetBySheetId(u),S=R==null?void 0:R.getCellMatrix(),I=C==null?void 0:C.getCellMatrix();if(R&&C&&S&&I){const v=At(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,(k,E)=>{const N=I.getValue(k,E);if(M.setValue(k,E,i.Tools.deepClone(N)),N){const W=h==null?void 0:h.getStyles().get(N.s);w.setValue(k,E,i.Tools.deepClone(W))}p.setValue(k,E,null)});const y=new i.ObjectMatrix,b=new i.ObjectMatrix;i.Range.foreach(d,(k,E)=>{y.setValue(k,E,i.Tools.deepClone(S.getValue(k,E)))}),i.Range.foreach(a,(k,E)=>{const N=i.cellToRange(k,E),W=i.Rectangle.getRelativeRange(N,a),V=i.Rectangle.getPositionRange(W,d),$=i.Tools.deepClone(w.getValue(k,E)),L=i.Tools.deepClone(M.getValue(k,E));L&&$&&(L.s=$),b.setValue(V.startRow,V.startColumn,L)});const T={fromRange:e.range,toRange:t.range,from:{value:p.getMatrix(),subUnitId:u},to:{value:b.getMatrix(),subUnitId:c},unitId:l},U={fromRange:t.range,toRange:e.range,from:{value:M.getMatrix(),subUnitId:u},to:{value:y.getMatrix(),subUnitId:c},unitId:l};o.push({id:Le.id,params:T}),r.push({id:Le.id,params:U})}return{redos:o,undos:r}}function gu(s,e,t){const n=s.startRow,o=s.startColumn,r=t.getMergedCell(n,o),a=se(e,t);if(r){const u=r.endRow-r.startRow+1,l=r.endColumn-r.startColumn+1;a.endRow=a.startRow+u-1,a.endColumn=a.startColumn+l-1,a.actualRow=a.startRow,a.actualColumn=a.startColumn,a.isMerged=!1,a.isMergedMainCell=!0}return a}var an=(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))(an||{}),_=(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 un{constructor(e,t,n){f(this,"type",D.SelectRange);f(this,"subType",_.View);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}.${_.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 jo{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 Xn{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 Zn{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 Go{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 zo{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 Qn{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 es{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 ts{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 ln{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 qo{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 Yo{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 Ko{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 dn{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 cn{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 ns{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 ss{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 mn{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 os{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 rs{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 is{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 as{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 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",_.Delete);this.unitId=e,this.subUnitId=t,this.id=`${this.type}.${_.Delete}_${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",_.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 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",_.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 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",_.InsertColumn);this.unitId=e,this.subUnitId=t,this.id=`${this.type}.${_.InsertColumn}_${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",_.InsertHyperlink);this.unitId=e,this.subUnitId=t,this.id=`${this.type}.${_.InsertHyperlink}_${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",_.InsertRow);this.unitId=e,this.subUnitId=t,this.id=`${this.type}.${_.InsertRow}_${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",_.ManageCollaborator);this.unitId=e,this.subUnitId=t,this.id=`${this.type}.${_.ManageCollaborator}_${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",_.PivotTable);this.unitId=e,this.subUnitId=t,this.id=`${this.type}.${_.PivotTable}_${e}_${t}`}}class Ru{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 Cu{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 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",_.SetCellStyle);this.unitId=e,this.subUnitId=t,this.id=`${this.type}.${_.SetCellStyle}_${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",_.SetCellValue);this.unitId=e,this.subUnitId=t,this.id=`${this.type}.${_.SetCellValue}_${e}_${t}`}}class St{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 ft{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 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",_.Sort);this.unitId=e,this.subUnitId=t,this.id=`${this.type}.${_.Sort}_${e}_${t}`}}class Vt{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 It={id:"sheet.command.set-range-values",type:i.CommandType.COMMAND,handler:(s,e)=>{var 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),u=s.get(i.IPermissionService),l=P(o,e);if(!l)return!1;const{subUnitId:d,unitId:c,workbook:m,worksheet:h}=l,{value:R,range:C,redoUndoId:S}=e,I=C?[C]:(W=r.getCurrentSelections())==null?void 0:W.map(V=>V.range);if(!I||!I.length||!u.getPermissionPoint(new fe(c,d).id))return!1;const v=new i.ObjectMatrix;let M;if(i.Tools.isArray(R))for(let V=0;V<I.length;V++){const{startRow:$,startColumn:L,endRow:Y,endColumn:z}=I[V];for(let K=0;K<=Y-$;K++)for(let oe=0;oe<=z-L;oe++)v.setValue(K+$,oe+L,R[K][oe])}else if(i.isICellData(R))for(let V=0;V<I.length;V++){const{startRow:$,startColumn:L,endRow:Y,endColumn:z}=I[V];for(let K=$;K<=Y;K++)for(let oe=L;oe<=z;oe++)v.setValue(K,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,(V,$)=>h.getCellHeight(V,$)||void 0);if(!t.syncExecuteCommand(F.id,p))return!1;const{undos:T,redos:U}=a.onCommandExecute({id:It.id,params:p}),{undos:k,redos:E}=a.generateMutationsOfAutoHeight({unitId:c,subUnitId:d,ranges:I,cellHeights:new i.ObjectMatrix(y)});if(i.sequenceExecute([...U,...E],t).result){const V=Ue(C!=null?C:v.getRange(),m,h);return n.pushUndoRedo({unitID:c,undoMutations:[{id:F.id,params:w},...T,...k,V],redoMutations:[{id:F.id,params:p},...U,...E,i.Tools.deepClone(V)],id:S}),!0}return!1}};function vs(s,e){const t=[],n=[],{unitId:o,subUnitId:r,range:a,shiftDimension:u,cellValue:l={}}=e,d=s.get(i.IUniverInstanceService),c=s.get(g.SheetInterceptorService),m=d.getUniverSheetInstance(o),h=m==null?void 0:m.getSheetBySheetId(r);if(h){const R=h.getCellMatrix(),C=R.getDataRange();if(a.startColumn<=C.endColumn||a.startRow<=C.endRow){let p,w;if(u===i.Dimension.COLUMNS){const b=Math.min(a.endRow,C.endRow);let T=0;for(let k=a.startRow;k<=b;k++){const E=R.getRow(k),N=E?i.getArrayLength(E)-1:0;T=Math.max(T,N)}p={startRow:a.startRow,startColumn:a.startColumn,endRow:b,endColumn:T};const U=a.endColumn-a.startColumn+1;w={startRow:a.startRow,startColumn:p.startColumn+U,endRow:b,endColumn:p.endColumn+U}}else{const b=Math.min(a.endColumn,C.endColumn),T=C.endRow;p={startRow:a.startRow,startColumn:a.startColumn,endRow:T,endColumn:b};const U=a.endRow-a.startRow+1;w={startRow:p.startRow+U,startColumn:a.startColumn,endRow:p.endRow+U,endColumn:b}}const y=rn(s,{unitId:o,subUnitId:r,range:p},{subUnitId:r,range:w},!0);y&&(t.push(...y.redos),n.push(...y.undos))}if(Object.entries(l).length===0)for(let p=a.startRow;p<=a.endRow;p++){l[p]||(l[p]={});for(let w=a.startColumn;w<=a.endColumn;w++)l[p][w]=null}const S={subUnitId:r,unitId:o,cellValue:l},I=ce(s,S),{undos:v,redos:M}=c.onCommandExecute({id:It.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 ps(s,e){const t=[],n=[],{unitId:o,subUnitId:r,range:a,shiftDimension:u}=e,l=s.get(i.IUniverInstanceService),d=s.get(g.SheetInterceptorService),c=l.getUniverSheetInstance(o),m=c==null?void 0:c.getSheetBySheetId(r);if(m){const h=m.getCellMatrix(),R=h.getDataRange(),C={subUnitId:r,unitId:o,cellValue:Kn([a])},S=ce(s,C),I=d.onCommandExecute({id:It.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(u===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 T=h.getRow(b),U=T?i.getArrayLength(T)-1:0;w=Math.max(w,U)}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(u===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=rn(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 Su(s,e,t,n,o,r){const{startRow:a,endRow:u,startColumn:l,endColumn:d}=e;if(o===i.Dimension.ROWS){const c=u-a+1;for(let m=t;m>=a;m--)for(let h=l;h<=d;h++){const R=s.getValue(m,h);R==null?s.realDeleteValue(m+c,h):s.setValue(m+c,h,R)}for(let m=u;m>=a;m--)for(let h=l;h<=d;h++)r&&r[m]&&r[m][h]?s.setValue(m,h,r[m][h]):s.realDeleteValue(m,h)}else if(o===i.Dimension.COLUMNS){const c=d-l+1;for(let m=a;m<=u;m++)for(let h=n;h>=l;h--){const R=s.getValue(m,h);R==null?s.realDeleteValue(m,h+c):s.setValue(m,h+c,R)}for(let m=a;m<=u;m++)for(let h=d;h>=l;h--)r&&r[m]&&r[m][h]?s.setValue(m,h,r[m][h]):s.realDeleteValue(m,h)}}function fu(s,e,t,n,o){const{startRow:r,endRow:a,startColumn:u,endColumn:l}=e,d=a-r+1,c=l-u+1;if(o===i.Dimension.ROWS)for(let m=r;m<=t;m++)for(let h=u;h<=l;h++){const R=s.getValue(m+d,h);R==null?s.realDeleteValue(m,h):s.setValue(m,h,R)}else if(o===i.Dimension.COLUMNS)for(let m=r;m<=a;m++)for(let h=u;h<=n;h++){const R=s.getValue(m,h+c);R==null?s.realDeleteValue(m,h):s.setValue(m,h,R)}}const Jo="sheet.command.delete-range-move-left",Be={type:i.CommandType.COMMAND,id:Jo,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),u=P(o);if(!u)return!1;const{worksheet:l,workbook:d,subUnitId:c,unitId:m}=u;let h=e==null?void 0:e.range;if(h||(h=(w=r.getCurrentLastSelection())==null?void 0:w.range),!h)return!1;const R={range:h,subUnitId:c,unitId:m,shiftDimension:i.Dimension.COLUMNS},C=a.onCommandExecute({id:Be.id,params:{range:h}}),{redo:S,undo:I}=ps(s,R),v=[...(y=C.preRedos)!=null?y:[],...S],M=[...C.undos,...I];if(v.push(...C.redos),v.push(Ue(h,d,l)),M.push(...(b=C.preUndos)!=null?b:[]),i.sequenceExecute(v,t).result){const T=a.afterCommandExecute({id:Be.id,params:{range:h}});return i.sequenceExecute(T.redos,t),M.push(...T.undos),v.push(...T.redos),n.pushUndoRedo({unitID:m,undoMutations:M.reverse(),redoMutations:v}),!0}return!1}},xo="sheet.command.delete-range-move-up",He={type:i.CommandType.COMMAND,id:xo,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),u=P(o);if(!u)return!1;const{unitId:l,subUnitId:d,workbook:c,worksheet:m}=u;let h=e==null?void 0:e.range;if(h||(h=(w=r.getCurrentLastSelection())==null?void 0:w.range),!h)return!1;const R={range:h,subUnitId:d,unitId:l,shiftDimension:i.Dimension.ROWS},C=a.onCommandExecute({id:He.id,params:{range:h}}),{redo:S,undo:I}=ps(s,R),v=[...(y=C.preRedos)!=null?y:[],...S],M=[...C.undos,...I];if(v.push(...C.redos),v.push(Ue(h,c,m)),M.push(...(b=C.preUndos)!=null?b:[]),i.sequenceExecute(v,t).result){const T=a.afterCommandExecute({id:He.id,params:{range:h}});return i.sequenceExecute(T.redos,t),M.push(...T.undos),v.push(...T.redos),n.pushUndoRedo({unitID:l,undoMutations:M.reverse(),redoMutations:v}),!0}return!1}},Iu="sheet.command.insert-range-move-down",xe={type:i.CommandType.COMMAND,id:"sheet.command.insert-range-move-down",handler:async(s,e)=>{var W,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),u=s.get(i.ErrorService),l=s.get(i.LocaleService);if(r.isOverlapping())return u.emit(l.t("sheets.info.overlappingSelections")),!1;const d=P(o);if(!d)return!1;const{unitId:c,subUnitId:m,worksheet:h,workbook:R}=d;let C=e==null?void 0:e.range;if(C||(C=(W=r.getCurrentLastSelection())==null?void 0:W.range),!C)return!1;const S=[],I=[],v=h.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=h.getRowHeight(L),z={unitId:c,subUnitId:m,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 K=en(s,z);I.push({id:ae.id,params:K})}const b={};i.Range.foreach(C,(L,Y)=>{const z=h.getCell(L,Y);z&&(b[L]||(b[L]={}),b[L][Y]={s:z.s})});const T={range:C,subUnitId:m,unitId:c,shiftDimension:i.Dimension.ROWS,cellValue:b},{redo:U,undo:k}=vs(s,T);S.push(...U),I.push(...k);const E=a.onCommandExecute({id:xe.id,params:{range:C}});if(S.push(...E.redos),S.push(Ue(C,R,h)),I.push(...(V=E.preUndos)!=null?V:[]),S.unshift(...($=E.preRedos)!=null?$:[]),I.unshift(...E.undos),i.sequenceExecute(S,t)){const L=a.afterCommandExecute({id:xe.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}},ws="sheet.command.insert-range-move-right",vt={type:i.CommandType.COMMAND,id:ws,handler:async(s,e)=>{var W,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),u=s.get(i.ErrorService),l=s.get(i.LocaleService);if(r.isOverlapping())return u.emit(l.t("sheets.info.overlappingSelections")),!1;const d=P(o);if(!d)return!1;const{workbook:c,worksheet:m,unitId:h,subUnitId:R}=d;let C=e==null?void 0:e.range;if(C||(C=(W=r.getCurrentLastSelection())==null?void 0:W.range),!C)return!1;const S=[],I=[],v=m.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=m.getColumnWidth(L),z={unitId:h,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 K=Nt(s,z);I.push({id:ne.id,params:K})}const b={};i.Range.foreach(C,(L,Y)=>{const z=m.getCell(L,Y);!z||!z.s||(b[L]||(b[L]={}),b[L][Y]={s:z.s})});const T={range:C,subUnitId:R,unitId:h,shiftDimension:i.Dimension.COLUMNS,cellValue:b},{redo:U,undo:k}=vs(s,T);S.push(...U),I.push(...k);const E=a.onCommandExecute({id:vt.id,params:{range:C}});if(S.push(...E.redos),S.push(Ue(C,c,m)),I.push(...(V=E.preUndos)!=null?V:[]),S.unshift(...($=E.preRedos)!=null?$:[]),I.unshift(...E.undos),i.sequenceExecute(S,t).result){const L=a.afterCommandExecute({id:vt.id,params:{range:C}});return i.sequenceExecute(L.redos,t),I.push(...L.undos),S.push(...L.redos),n.pushUndoRedo({unitID:h,undoMutations:I.reverse(),redoMutations:S}),!0}return!1}},Xo="sheet.command.insert-row",Me={type:i.CommandType.COMMAND,id:Xo,handler:async(s,e)=>{const t=s.get(i.ICommandService),n=s.get(g.SheetInterceptorService),{range:o,direction:r,unitId:a,subUnitId:u,cellValue:l}=e;return await n.beforeCommandExecute({id:Me.id,params:e})?t.syncExecuteCommand(Ms.id,{range:o,direction:r,unitId:a,subUnitId:u,cellValue:l}):!1}},Ms={type:i.CommandType.COMMAND,id:"sheet.command.insert-row-by-range",handler:(s,e)=>{var U,k,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:u,worksheet:l}=a,{range:d,direction:c,unitId:m,subUnitId:h,cellValue:R}=e,{startRow:C,endRow:S}=d;d.rangeType=i.RANGE_TYPE.ROW;const I=c===i.Direction.UP?C:C-1,v=l.getRowHeight(I),M={unitId:m,subUnitId:h,range:d,rowInfo:new Array(S-C+1).fill(void 0).map(()=>({h:v,hd:i.BooleanNumber.FALSE}))},p=en(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:m,subUnitId:h,cellValue:R}});const b=r.onCommandExecute({id:Me.id,params:e});if(w.unshift(...(U=b.preRedos)!=null?U:[]),w.push(...(k=b.redos)!=null?k:[]),w.push(Ue(d,u,l)),y.unshift(...(E=b.preUndos)!=null?E:[]),y.push(...(N=b.undos)!=null?N:[]),i.sequenceExecute(w,t).result){const W=r.afterCommandExecute({id:Me.id,params:e});return i.sequenceExecute(W.redos,t),w.push(...W.redos),y.push(...W.undos),n.pushUndoRedo({unitID:e.unitId,undoMutations:y,redoMutations:w}),!0}return!1}},Zo={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:u,subUnitId:l,unitId:d}=a,c=e.value||0,m=o.startRow,h=o.startRow+c-1,R=0,C=u.getColumnCount()-1,S={unitId:d,subUnitId:l,direction:i.Direction.UP,range:{startRow:m,endRow:h,startColumn:R,endColumn:C},cellValue:$e(u,m,h,R,C,!0,m-1)};return s.get(i.ICommandService).executeCommand(Me.id,S)}},Qo={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:u,subUnitId:l}=r,d=n.endRow-n.startRow+1,c=n.endRow+1,m=n.endRow+d,h=0,R=a.getColumnCount()-1,C={unitId:u,subUnitId:l,direction:i.Direction.DOWN,range:{startRow:c,endRow:m,startColumn:h,endColumn:R,rangeType:i.RANGE_TYPE.ROW},cellValue:$e(a,c,m,h,R,!0,n.endRow)};return s.get(i.ICommandService).executeCommand(Me.id,C)}},er={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:u,unitId:l,subUnitId:d}=a,c=e.value||0,m=o.startRow,h=o.startRow+c-1,R=0,C=u.getColumnCount()-1,S=$e(u,m,h,R,C,!0,m-1),I={unitId:l,subUnitId:d,direction:i.Direction.UP,range:{startRow:m,endRow:h,startColumn:R,endColumn:C,rangeType:i.RANGE_TYPE.ROW},cellValue:S};return s.get(i.ICommandService).executeCommand(Me.id,I)}},tr={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:u,unitId:l,subUnitId:d}=a,c=e.value||0,m=o.endRow+1,h=o.endRow+c,R=0,C=u.getColumnCount()-1,S={unitId:l,subUnitId:d,direction:i.Direction.DOWN,range:{startRow:m,endRow:h,startColumn:R,endColumn:C,rangeType:i.RANGE_TYPE.ROW},cellValue:$e(u,m,h,R,C,!0,o.endRow)};return s.get(i.ICommandService).executeCommand(Me.id,S)}},nr="sheet.command.insert-col",ye={type:i.CommandType.COMMAND,id:nr,handler:async(s,e)=>{const t=s.get(i.ICommandService),n=s.get(g.SheetInterceptorService),{range:o,direction:r,subUnitId:a,unitId:u,cellValue:l}=e;return await n.beforeCommandExecute({id:ye.id,params:e})?t.syncExecuteCommand(ys.id,{range:o,direction:r,unitId:u,subUnitId:a,cellValue:l}):!1}},ys={type:i.CommandType.COMMAND,id:"sheet.command.insert-col-by-range",handler:(s,e)=>{var T,U,k,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:u,subUnitId:l,unitId:d,cellValue:c}=e,{startColumn:m,endColumn:h}=e.range;a.rangeType=i.RANGE_TYPE.COLUMN;const R=o.getUniverSheetInstance(e.unitId),C=R.getSheetBySheetId(e.subUnitId),S=u===i.Direction.LEFT?m:m-1,I=C.getColumnWidth(S),v={unitId:d,subUnitId:l,range:a,colInfo:new Array(h-m+1).fill(void 0).map(()=>({w:I,hd:i.BooleanNumber.FALSE}))},M=Nt(s,v),p=[{id:ie.id,params:v}],w=[{id:ne.id,params:M}];c&&p.push({id:F.id,params:{unitId:d,subUnitId:l,cellValue:c}});const y=r.onCommandExecute({id:ye.id,params:e});if(p.unshift(...(T=y.preRedos)!=null?T:[]),p.push(...(U=y.redos)!=null?U:[]),p.push(Ue(a,R,C)),w.unshift(...(k=y.preUndos)!=null?k:[]),w.push(...(E=y.undos)!=null?E:[]),i.sequenceExecute(p,t).result){const N=r.afterCommandExecute({id:ye.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}},sr={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:u,unitId:l,subUnitId:d}=a,c=e.value||0,m=o.startColumn,h=o.startColumn+c-1,R=0,C=u.getRowCount()-1,S={unitId:l,subUnitId:d,direction:i.Direction.LEFT,range:{startColumn:m,endColumn:h,startRow:R,endRow:C,rangeType:i.RANGE_TYPE.COLUMN},cellValue:$e(u,R,C,m,h,!1,m-1)};return s.get(i.ICommandService).executeCommand(ye.id,S)}},or={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:u,subUnitId:l}=r,d=n.endColumn-n.startColumn+1,c=n.endColumn+1,m=n.endColumn+d,h=0,R=a.getRowCount()-1,C={unitId:u,subUnitId:l,direction:i.Direction.RIGHT,range:{startColumn:c,endColumn:m,startRow:h,endRow:R},cellValue:$e(a,h,R,c,m,!1,n.endColumn)};return s.get(i.ICommandService).executeCommand(ye.id,C)}},rr={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:u,unitId:l,subUnitId:d}=a,c=e.value||0,m=o.startColumn,h=o.startColumn+c-1,R=0,C=u.getRowCount()-1,S={unitId:l,subUnitId:d,direction:i.Direction.LEFT,range:{startColumn:m,endColumn:h,startRow:R,endRow:C,rangeType:i.RANGE_TYPE.COLUMN},cellValue:$e(u,R,C,m,h,!1,m-1)};return s.get(i.ICommandService).executeCommand(ye.id,S)}},ir={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:u,unitId:l,subUnitId:d}=a,c=e.value||0,m=o.endColumn+1,h=o.endColumn+c,R=0,C=u.getRowCount()-1,S={unitId:l,subUnitId:d,direction:i.Direction.RIGHT,range:{startColumn:m,endColumn:h,startRow:R,endRow:C},cellValue:$e(u,R,C,m,h,!1,o.endColumn)};return s.get(i.ICommandService).executeCommand(ye.id,S)}},hn="sheet.command.remove-row",_s={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:u,unitId:l,subUnitId:d}=e,c=Dt([u],s,l,d).reverse(),m=[],h=[];c.forEach(p=>{const w=[],y=[],b={unitId:l,subUnitId:d,range:p},T=ca(b,r),U=r.getCellMatrix().getSlice(p.startRow,p.endRow,0,r.getColumnCount()-1),k={unitId:l,subUnitId:d,cellValue:U.getMatrix()};y.push({id:ae.id,params:b}),w.push({id:re.id,params:T}),w.push({id:F.id,params:k}),h.push(...y),m.unshift(...w)});const R=a.onCommandExecute({id:hn,params:{range:u}}),C=s.get(i.ICommandService);if(i.sequenceExecute([...(I=R.preRedos)!=null?I:[],...h,...R.redos,Ue(u,o,r)],C).result){const p=a.afterCommandExecute({id:hn,params:{range:u}});return i.sequenceExecute(p.redos,C),s.get(i.IUndoRedoService).pushUndoRedo({unitID:l,undoMutations:[...(v=R.preUndos)!=null?v:[],...m,...R.undos,...p.undos],redoMutations:[...(M=R.preRedos)!=null?M:[],...h,...R.redos,...p.redos]}),!0}return!1}},$t={type:i.CommandType.COMMAND,id:hn,handler:async(s,e)=>{var h;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=(h=t.getCurrentLastSelection())==null?void 0:h.range),!r)return!1;const a=s.get(i.IUniverInstanceService),u=P(a);if(!u)return!1;const{worksheet:l,subUnitId:d,unitId:c}=u;return r={...r,startColumn:0,endColumn:Math.max(l.getMaxColumns()-1,0)},await n.beforeCommandExecute({id:$t.id,params:{range:r}})?o.syncExecuteCommand(_s.id,{range:r,unitId:c,subUnitId:d}):!1}},gn="sheet.command.remove-col",bs={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:u,unitId:l,subUnitId:d}=e,c={unitId:l,subUnitId:d,range:u},m=ma(s,c),h=r.getCellMatrix().getSlice(0,r.getRowCount()-1,u.startColumn,u.endColumn),R={unitId:l,subUnitId:d,cellValue:h.getMatrix()},C=a.onCommandExecute({id:gn,params:{range:u}}),S=s.get(i.ICommandService);if(i.sequenceExecute([...(v=C.preRedos)!=null?v:[],{id:ne.id,params:c},...C.redos,Ue(u,o,r)],S).result){const w=a.afterCommandExecute({id:gn,params:{range:u}});return i.sequenceExecute(w.redos,S),s.get(i.IUndoRedoService).pushUndoRedo({unitID:l,undoMutations:[...(M=C.preUndos)!=null?M:[],{id:ie.id,params:m},{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}},Lt={type:i.CommandType.COMMAND,id:gn,handler:async(s,e)=>{var h;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=(h=t.getCurrentLastSelection())==null?void 0:h.range),!r)return!1;const a=s.get(i.IUniverInstanceService),u=P(a);if(!u)return!1;const{worksheet:l,subUnitId:d,unitId:c}=u;return r={...r,startRow:0,endRow:Math.max(l.getMaxRows()-1,0)},await n.beforeCommandExecute({id:Lt.id,params:{range:r}})?o.syncExecuteCommand(bs.id,{range:r,unitId:c,subUnitId:d}):!1}},ar=(s,e)=>{const t=s.get(i.IUniverInstanceService),{subUnitId:n,unitId:o}=e,r=ve(t,e);if(!r)throw new Error("[RemoveSheetUndoMutationFactory]: Worksheet is null error!");const{workbook:a,worksheet:u}=r,l=u.getConfig();return{index:a.getConfig().sheetOrder.findIndex(m=>m===n),sheet:l,unitId:o}},Xe={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 vu(s,e){return e.getMergeData().some(t=>t.startRow<s&&s<=t.endRow)}function pu(s,e){return e.getMergeData().some(t=>t.startColumn<s&&s<=t.endColumn)}const ur="sheet.command.move-rows",pt={id:ur,type:i.CommandType.COMMAND,handler:(s,e)=>{var W,V;const t=s.get(g.SheetsSelectionsService),{fromRange:{startRow:n},toRange:{startRow:o},range:r}=e,a=r?[dr(r)]:t.getCurrentSelections(),u=a==null?void 0:a.filter($=>$.range.rangeType===i.RANGE_TYPE.ROW&&$.range.startRow<=n&&n<=$.range.endRow);if((u==null?void 0:u.length)!==1)return!1;const l=s.get(g.SheetInterceptorService),d=s.get(i.IUniverInstanceService),c=P(d,e);if(!c)return!1;const{workbook:m,worksheet:h}=c,R=m.getUnitId(),C=h.getSheetId(),S=s.get(i.ErrorService),I=s.get(i.LocaleService),v=u[0].range,M=u[0].primary,p=At(v,h,!1);if(!i.Rectangle.equals(v,p))return S.emit(I.t("sheets.info.partOfCell")),!1;if(vu(o,h))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=co(s,y),T=s.get(i.ICommandService),U=l.onCommandExecute({id:pt.id,params:e}),k=[...(W=U.preRedos)!=null?W:[],{id:pe.id,params:y}],E=[...(V=U.preUndos)!=null?V:[],{id:pe.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},K={unitId:R,subUnitId:C,type:te.MOVE_END,selections:[{range:z,primary:se(z,h),style:null}]},oe={unitId:R,subUnitId:C,type:te.MOVE_END,selections:[{range:v,primary:M,style:null}]};k.push({id:q.id,params:K}),E.push({id:q.id,params:oe})}if(k.push(...U.redos),E.push(...U.undos),i.sequenceExecute(k,T).result){const $=l.afterCommandExecute({id:pt.id,params:e});return i.sequenceExecute($.redos,T),k.push(...$.redos),E.push(...$.undos),s.get(i.IUndoRedoService).pushUndoRedo({unitID:R,undoMutations:E,redoMutations:k}),!0}return!1}},lr="sheet.command.move-cols",wt={id:lr,type:i.CommandType.COMMAND,handler:(s,e)=>{var W,V;const t=s.get(g.SheetsSelectionsService),{fromRange:{startColumn:n},toRange:{startColumn:o},range:r}=e,a=r?[dr(r)]:t.getCurrentSelections(),u=a==null?void 0:a.filter($=>$.range.rangeType===i.RANGE_TYPE.COLUMN&&$.range.startColumn<=n&&n<=$.range.endColumn);if((u==null?void 0:u.length)!==1)return!1;const l=s.get(g.SheetInterceptorService),d=s.get(i.IUniverInstanceService),c=P(d,e);if(!c)return!1;const{workbook:m,worksheet:h}=c,R=m.getUnitId(),C=h.getSheetId(),S=s.get(i.ErrorService),I=s.get(i.LocaleService),v=u[0].range,M=u[0].primary,p=At(v,h,!1);if(!i.Rectangle.equals(v,p))return S.emit(I.t("sheets.info.partOfCell")),!1;if(pu(o,h))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=mo(s,y),T=s.get(i.ICommandService),U=l.onCommandExecute({id:wt.id,params:e}),k=[...(W=U.preRedos)!=null?W:[],{id:we.id,params:y}],E=[...(V=U.preUndos)!=null?V:[],{id:we.id,params:b}];if(M){const $=v.endColumn-v.startColumn+1,z=o-n<0?w:{...w,startColumn:w.startColumn-$,endColumn:w.endColumn-$},K={unitId:R,subUnitId:C,type:te.MOVE_END,selections:[{range:z,primary:se(z,h),style:null}]},oe={unitId:R,subUnitId:C,type:te.MOVE_END,selections:[{range:v,primary:M,style:null}]};k.push({id:q.id,params:K}),E.push({id:q.id,params:oe})}if(k.push(...U.redos),E.push(...U.undos),i.sequenceExecute(k,T).result){const $=l.afterCommandExecute({id:wt.id,params:e});return i.sequenceExecute($.redos,T),k.push(...$.redos),E.push(...$.undos),s.get(i.IUndoRedoService).pushUndoRedo({unitID:R,undoMutations:E,redoMutations:k}),!0}return!1}};function dr(s){return{range:s,primary:null,style:null}}var wu=Object.getOwnPropertyDescriptor,Mu=(s,e,t,n)=>{for(var o=n>1?void 0:n?wu(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},yu=(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=Mu([yu(0,i.Inject(i.Injector))],g.SheetSkeletonService);function Es(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 _u=1e4;function Bt(s,e){if(!e)return{suitableRanges:s,remainingRanges:[]};const t=e.worksheet.getColumnCount(),n=Math.ceil(_u/t),o=[],r=[],a=e.getOffsetRelativeToRowCol(0,e.scrollY).row,u=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}});u.sort((d,c)=>d.distance!==c.distance?d.distance-c.distance:d.rowCount-c.rowCount);let l=0;for(const d of u)if(l+d.rowCount<=n)o.push(d.range),l+=d.rowCount;else{const c=n-l;if(c>0){const m={...d.range,endRow:d.range.startRow+c-1},h={...d.range,startRow:d.range.startRow+c};o.push(m),r.push(h),l=n}else r.push(d.range)}return{suitableRanges:o,remainingRanges:r}}const cr="sheet.command.reorder-range",Rn={id:cr,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),u={id:Ot.id,params:{unitId:n,subUnitId:t,order:r,range:o}},l={id:Ot.id,params:ho(u.params)},d=s.get(g.SheetInterceptorService),c=d.onCommandExecute({id:Rn.id,params:e}),m=[...(p=c.preRedos)!=null?p:[],u,...c.redos],h=[...(w=c.preUndos)!=null?w:[],l,...c.undos],R=i.sequenceExecute(m,a),{suitableRanges:C,remainingRanges:S}=Bt([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:Rn.id,params:e});return R.result?(i.sequenceExecute([...M.redos,...v],a),s.get(i.IUndoRedoService).pushUndoRedo({unitID:n,undoMutations:[...h,...M.undos,...I],redoMutations:[...m,...M.redos,...v]}),!0):!1}},A={MoveRangeCommandId:Fo,InsertRowCommandId:Xo,InsertColCommandId:nr,RemoveColCommandId:gn,RemoveRowCommandId:hn,DeleteRangeMoveLeftCommandId:Jo,DeleteRangeMoveUpCommandId:xo,InsertRangeMoveDownCommandId:Iu,InsertRangeMoveRightCommandId:ws,MoveColsCommandId:lr,MoveRowsCommandId:ur,ReorderRangeCommandId:cr};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 Cn=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=Cn),(e.rangeType===i.RANGE_TYPE.ROW||n)&&(e.startColumn=0,e.endColumn=Cn),e.rangeType===i.RANGE_TYPE.ALL&&(e.startColumn=0,e.endColumn=Cn,e.startRow=0,e.endRow=Cn),e},he=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}},Ht=(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,u=(S,I)=>({start:S.start-I.start,end:S.start-I.start+S.end-S.start}),l=(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),m=c,h=r(s,n),R=h&&a(h)>=a(n);if(s.end<n.start)n.start-=c,n.end-=c;else if(h){const S=a(h);if(R){const I=u(n,s),v=l(I,o);n.start=v.start,n.end=v.end}else h.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+=m,n.end+=m):C&&(d?o.end<=n.start||o.start<=n.start&&o.end>=n.start?(n.start+=m,n.end+=m):o.start>=n.start&&o.start<=n.end&&(n.end+=m):n.start<o.start&&n.end>o.start?n.end+=m:(n.start>=o.end||n.start>=o.start&&n.start<=o.end)&&(n.end+=m,n.start+=m))),{step:n.start-t.start,length:a(n)-a(t)}},Ts=(s,e)=>{const{fromRange:t,toRange:n}=s.params||{};if(!n||!t)return[];const o=Pe(t),r=Pe(n),a=Pe(e),u=Ht({start:o.startRow,end:o.endRow},{start:r.startRow,end:r.endRow},{start:a.startRow,end:a.endRow});return u===null?[{type:B.Delete}]:[{type:B.VerticalMove,step:u.step||0,length:u.length||0}]},bu=(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,u=new i.ObjectMatrix;return i.Range.foreach(e,(d,c)=>{u.setValue(d,c,1)}),u.moveRows(o,r,a),i.queryObjectMatrix(u,d=>d===1)},Eu=(s,e)=>{const{range:t,order:n}=s.params||{};if(!t||!n)return[e];const o=new i.ObjectMatrix;i.Range.foreach(e,(u,l)=>{o.setValue(u,l,1)});const r=new i.ObjectMatrix;return i.Range.foreach(t,(u,l)=>{var d;if(Object.prototype.hasOwnProperty.call(n,u)){const c=n[u],m=(d=o.getValue(c,l))!=null?d:0;r.setValue(u,l,m)}}),r.forValue((u,l,d)=>{o.setValue(u,l,d)}),i.queryObjectMatrix(o,u=>u===1)},Us=(s,e)=>{const{fromRange:t,toRange:n}=s.params||{};if(!n||!t)return[];const o=Pe(t),r=Pe(n),a=Pe(e),u=Ht({start:o.startColumn,end:o.endColumn},{start:r.startColumn,end:r.endColumn},{start:a.startColumn,end:a.endColumn});return u===null?[{type:B.Delete}]:[{type:B.HorizontalMove,step:u.step||0,length:u.length||0}]},Tu=(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,u=new i.ObjectMatrix;return i.Range.foreach(e,(l,d)=>{u.setValue(l,d,1)}),u.moveColumns(o,r,a),i.queryObjectMatrix(u,l=>l===1)},mr=(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 u=i.Rectangle.getRelativeRange(e,n),l=i.Rectangle.getPositionRange(u,t);return[{type:B.Set,range:l}]}return o},Uu=(s,e)=>{var m,h;const t=(m=s.params)==null?void 0:m.toRange,n=(h=s.params)==null?void 0:h.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 u=t.startColumn-n.startColumn,l=t.startRow-n.startRow,d={startColumn:t.startColumn-u,endColumn:t.endColumn-u,startRow:t.startRow-l,endRow:t.endRow-l};return d&&i.Range.foreach(d,(R,C)=>{var v;const S=R+l,I=C+u;o.setValue(S,I,(v=r.getValue(R,C))!=null?v:0)}),i.queryObjectMatrix(o,R=>R===1)},Ze=(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 u=-o(a);return{step:-(o(t)-o(a)),length:u}}}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=Ze(t,e);if(!o)n.push({type:B.Delete});else{const{step:a,length:u}=o;n.push({type:B.HorizontalMove,step:a,length:u})}return n},hr=(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 u=n.startRow;for(let l=n.startRow;l<=n.endRow;l++){if(t.includes(l)){if(l===u){u=l+1;continue}r({...n,startRow:u,endRow:l-1}),u=l+1;continue}l===n.endRow&&r({...n,startRow:u,endRow:n.endRow})}}else r(n);function r(u){const l=Ze(he(u),he(e));if(!l)o.push({type:B.Delete});else{const{step:d,length:c}=l;o.push({type:B.VerticalMove,step:d,length:c})}}return o},Pu=(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 u=Number(a);return o.push({type:B.VerticalMove,step:u-r,length:0}),o}return[]}return[]},Qe=(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 ku(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 gr=(s,e)=>{var u;const t=(u=s.params)==null?void 0:u.range;if(!t)return[];const n=[],o=Qe(he(t),he(e)),{step:r,length:a}=o;return n.push({type:B.VerticalMove,step:r,length:a}),n},Rr=(s,e)=>{var u;const t=(u=s.params)==null?void 0:u.range;if(!t)return[];const n=[],o=Qe(t,e),{step:r,length:a}=o;return n.push({type:B.HorizontalMove,step:r,length:a}),n},Cr=(s,e)=>{var u;const t=(u=s.params)==null?void 0:u.range;if(!t)return[];const n=[],o=Qe(he(t),he(e)),{step:r,length:a}=o;return n.push({type:B.VerticalMove,step:r,length:a}),n},Nu=(s,e)=>{var l;const t=(l=s.params)==null?void 0:l.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 u=new i.ObjectMatrix;return r.forEach(d=>{i.Range.foreach(d,(c,m)=>{u.setValue(c,m,1)})}),a&&i.Range.foreach(a,(d,c)=>{u.setValue(d+n,c,1)}),i.queryObjectMatrix(u,d=>d===1)},Sr=(s,e)=>{var u;const t=(u=s.params)==null?void 0:u.range;if(!t)return[];const n=[],o=Qe(t,e),{step:r,length:a}=o;return n.push({type:B.HorizontalMove,step:r,length:a}),n},Ou=(s,e)=>{var l;const t=(l=s.params)==null?void 0:l.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 u=new i.ObjectMatrix;return r.forEach(d=>{i.Range.foreach(d,(c,m)=>{u.setValue(c,m,1)})}),a&&i.Range.foreach(a,(d,c)=>{u.setValue(d,c+n,1)}),i.queryObjectMatrix(u,d=>d===1)},fr=(s,e)=>{var r;const t=(r=s.params)==null?void 0:r.range;if(!t)return[];const n=[],o=Ze(t,e);if(!o)n.push({type:B.Delete});else{const{step:a,length:u}=o;n.push({type:B.HorizontalMove,step:a,length:u})}return n},Du=(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),u=i.Rectangle.getIntersects(n,e);if(!r&&!u)return[e];const l=new i.ObjectMatrix;return u&&i.Range.foreach(u,(c,m)=>{l.setValue(c,m-o,1)}),r&&i.Range.foreach(r,(c,m)=>{l.setValue(c,m-o,0)}),a.forEach(c=>{i.Range.foreach(c,(m,h)=>{l.setValue(m,h,1)})}),i.queryObjectMatrix(l,c=>c===1)},Ir=(s,e)=>{var r;const t=(r=s.params)==null?void 0:r.range;if(!t)return[];const n=[],o=Ze(he(t),he(e));if(!o)n.push({type:B.Delete});else{const{step:a,length:u}=o;n.push({type:B.VerticalMove,step:a,length:u})}return n},Au=(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),u=i.Rectangle.getIntersects(n,e);if(!r&&!u)return[e];const l=new i.ObjectMatrix;return u&&i.Range.foreach(u,(c,m)=>{l.setValue(c-o,m,1)}),r&&i.Range.foreach(r,(c,m)=>{l.setValue(c-o,m,0)}),a.forEach(c=>{i.Range.foreach(c,(m,h)=>{l.setValue(m,h,1)})}),i.queryObjectMatrix(l,c=>c===1)},Wu=(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,l=r.endRow-a+1;n.removeRows(a,l)}),i.queryObjectMatrix(n,r=>r===1)},Vu=(s,e)=>{const t=s.params,n=t.range.startRow,o=t.range.endRow-t.range.startRow+1;return e.startRow>=n?[{startRow:e.startRow+o,endRow:e.endRow+o,startColumn:e.startColumn,endColumn:e.endColumn}]:e.endRow<n?[e]:[{startRow:e.startRow,endRow:e.endRow+o,startColumn:e.startColumn,endColumn:e.endColumn}]},$u=(s,e)=>{const t=s.params,n=t.range.startColumn,o=t.range.endColumn-t.range.startColumn+1;return e.startColumn>=n?[{startRow:e.startRow,endRow:e.endRow,startColumn:e.startColumn+o,endColumn:e.endColumn+o}]:e.endColumn<n?[e]:[{startRow:e.startRow,endRow:e.endRow,startColumn:e.startColumn,endColumn:e.endColumn+o}]},et=(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},ks=(s,e)=>{let t=[];switch(e.id){case A.DeleteRangeMoveLeftCommandId:{t=fr(e,s);break}case A.DeleteRangeMoveUpCommandId:{t=Ir(e,s);break}case A.InsertColCommandId:{t=Rr(e,s);break}case A.InsertRangeMoveDownCommandId:{t=Cr(e,s);break}case A.InsertRangeMoveRightCommandId:{t=Sr(e,s);break}case A.InsertRowCommandId:{t=gr(e,s);break}case A.MoveColsCommandId:{t=Us(e,s);break}case A.MoveRangeCommandId:{t=mr(e,s);break}case A.MoveRowsCommandId:{t=Ts(e,s);break}case A.RemoveColCommandId:{t=Ps(e,s);break}case A.RemoveRowCommandId:{t=hr(e,s);break}case A.ReorderRangeCommandId:{t=Pu(e,s);break}}return et(t,s)},Lu=(s,e,t)=>[Be.id,He.id].includes(e.id)||pr(e,t).some(r=>i.Rectangle.intersects(r,s))?ks(s,e):s,Ns=(s,e)=>{let t=[];switch(e.id){case A.DeleteRangeMoveLeftCommandId:return Du(e,s);case A.DeleteRangeMoveUpCommandId:return Au(e,s);case A.InsertRangeMoveDownCommandId:return Nu(e,s);case A.InsertRangeMoveRightCommandId:return Ou(e,s);case A.InsertColCommandId:return $u(e,s);case A.InsertRowCommandId:return Vu(e,s);case A.MoveColsCommandId:return Tu(e,s);case A.MoveRangeCommandId:return Uu(e,s);case A.MoveRowsCommandId:return bu(e,s);case A.ReorderRangeCommandId:return Eu(e,s);case A.RemoveColCommandId:{t=Ps(e,s);break}case A.RemoveRowCommandId:return Wu(e.params,s)}const n=et(t,s);return n?[n]:[]},Bu=(s,e,t)=>[Be.id,He.id,xe.id,ws].includes(e.id)||pr(e,t).some(r=>i.Rectangle.intersects(r,s))?Ns(s,e):s;function vr(s,e){const{id:t,params:n}=e;let o={length:0,step:0,type:B.Unknown};switch(t){case Xe.id:o.type=B.Delete;break;case pe.id:o=Ht({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 we.id:o=Ht({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=Ze(n.range,s),o?o.type=B.HorizontalMove:o={step:0,length:0,type:B.Delete};break;case ae.id:o=Ze(he(n.range),he(s)),o?o.type=B.VerticalMove:o={step:0,length:0,type:B.Delete};break;case re.id:o=Qe(he(n.range),he(s)),o.type=B.VerticalMove;break;case ie.id:o=Qe(n.range,s),o.type=B.HorizontalMove;break;case Le.id:{const r=n.fromRange||new i.ObjectMatrix(n.from).getRange(),a=n.toRange||new i.ObjectMatrix(n.to).getRange();o=ku(r,a,s)}break}return o?Array.isArray(o)?et(o,s):et([o],s):s}function pr(s,e){var n,o,r,a,u,l;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(m=>m.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)||((l=(u=t.getCurrentSelections())==null?void 0:u.map(m=>m.range))==null?void 0:l[0]);return c?[c]:[]}case A.ReorderRangeCommandId:{const d=s,{range:c,order:m}=d.params,h=[];for(let R=c.startRow;R<=c.endRow;R++)R in m&&h.push({startRow:R,endRow:R,startColumn:c.startColumn,endColumn:c.endColumn});return h}}}function Hu(s){switch(s.id){case we.id:{const e=s.params;return[e.sourceRange,{...e.targetRange,startColumn:e.targetRange.startColumn-.5,endColumn:e.targetRange.startColumn-.5}]}case pe.id:{const e=s.params;return[e.sourceRange,{...e.targetRange,startRow:e.targetRange.startRow-.5,endRow:e.targetRange.startRow-.5}]}case Le.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 Fu(s,e){var o,r,a,u,l,d;const t=s.get(i.IUniverInstanceService),n=s.get(g.SheetsSelectionsService);switch(e.id){case A.MoveColsCommandId:{const c=e.params,m=P(t,{unitId:c.unitId,subUnitId:c.subUnitId});return{unitId:m.unitId,subUnitId:m.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,m=P(t,{unitId:c.unitId,subUnitId:c.subUnitId});return{unitId:m.unitId,subUnitId:m.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,m=P(t);return{unitId:m.unitId,subUnitId:m.subUnitId,ranges:[c.fromRange,c.toRange]}}case A.InsertRowCommandId:{const c=e.params,m=c.range;return{unitId:c.unitId,subUnitId:c.subUnitId,ranges:[...m.startRow>0?[{...m,startRow:m.startRow-1,endRow:m.endRow-1}]:[],{...m,startRow:m.startRow,endRow:Number.MAX_SAFE_INTEGER}]}}case A.InsertColCommandId:{const c=e.params,m=c.range;return{unitId:c.unitId,subUnitId:c.subUnitId,ranges:[...m.startColumn>0?[{...m,startColumn:m.startColumn-1,endColumn:m.endColumn-1}]:[],{...m,startColumn:m.startColumn,endColumn:Number.MAX_SAFE_INTEGER}]}}case A.RemoveRowCommandId:{const m=e.params.range,h=P(t);return{unitId:h.unitId,subUnitId:h.subUnitId,ranges:[m,{...m,startRow:m.endRow+1,endRow:Number.MAX_SAFE_INTEGER}]}}case A.RemoveColCommandId:{const m=e.params.range,h=P(t);return{unitId:h.unitId,subUnitId:h.subUnitId,ranges:[m,{...m,startColumn:m.endColumn+1,endColumn:Number.MAX_SAFE_INTEGER}]}}case A.DeleteRangeMoveUpCommandId:case A.InsertRangeMoveDownCommandId:{const c=e,m=P(t),h=((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 h?{unitId:m.unitId,subUnitId:m.subUnitId,ranges:[h,{...h,startRow:h.endRow+1,endRow:Number.MAX_SAFE_INTEGER}]}:{unitId:m.unitId,subUnitId:m.subUnitId,ranges:[]}}case A.DeleteRangeMoveLeftCommandId:case A.InsertRangeMoveRightCommandId:{const m=((u=e.params)==null?void 0:u.range)||((d=(l=n.getCurrentSelections())==null?void 0:l.map(R=>R.range))==null?void 0:d[0]),h=P(t);return m?{unitId:h.unitId,subUnitId:h.subUnitId,ranges:[m,{...m,startColumn:m.endColumn+1,endColumn:Number.MAX_SAFE_INTEGER}]}:{unitId:h.unitId,subUnitId:h.subUnitId,ranges:[]}}case A.ReorderRangeCommandId:{const c=e,{range:m,order:h}=c.params,R=[];for(let S=m.startRow;S<=m.endRow;S++)S in h&&R.push({startRow:S,endRow:S,startColumn:m.startColumn,endColumn:m.endColumn});const C=P(t);return{unitId:C.unitId,subUnitId:C.subUnitId,ranges:R}}}}var ju=Object.getOwnPropertyDescriptor,Gu=(s,e,t,n)=>{for(var o=n>1?void 0:n?ju(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},Sn=(s,e)=>(t,n)=>e(t,n,s);const zu=i.createInterceptorKey("MERGE_REDO"),qu=i.createInterceptorKey("MERGE_UNDO"),wr=Math.floor(Number.MAX_SAFE_INTEGER/10);class Yu 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===Le.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===Xe.id)return;const a=Hu(e);if(a!=null&&a.some(u=>i.Rectangle.intersects(u,this._range)))return}const t=vr(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:zu,MERGE_UNDO:qu}));f(this,"_watchRanges",new Set);f(this,"_refRangeManagerMap",new Map);f(this,"_serializer",Ku());f(this,"_onRefRangeChange",()=>{this._sheetInterceptorService.interceptCommand({getMutations:t=>{const n=this._univerInstanceService.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET).getActiveSheet(),o=Mr(this._univerInstanceService),r=yr(this._univerInstanceService);if(!n||!o||!r)return{redos:[],undos:[],preRedos:[],preUndos:[]};const l=((()=>{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:n.getColumnCount()-1}],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:n.getRowCount()-1}],o,r)}case A.MoveRangeCommandId:{const R=t;return this._checkRange([R.params.fromRange,R.params.toRange],o,r)}case A.InsertRowCommandId:{const S={startRow:t.params.range.startRow,endRow:n.getRowCount()-1,startColumn:0,endColumn:n.getColumnCount()-1,rangeType:i.RANGE_TYPE.ROW};return this._checkRange([S],o,r)}case A.InsertColCommandId:{const C=t.params.range.startColumn,S={startRow:0,endRow:n.getRowCount()-1,startColumn:C,endColumn:n.getColumnCount()-1,rangeType:i.RANGE_TYPE.COLUMN};return this._checkRange([S],o,r)}case A.RemoveRowCommandId:{const S={startRow:t.params.range.startRow,endRow:n.getRowCount()-1,startColumn:0,endColumn:n.getColumnCount()-1,rangeType:i.RANGE_TYPE.ROW};return this._checkRange([S],o,r)}case A.RemoveColCommandId:{const C=t.params.range.startColumn,S={startRow:0,endRow:n.getRowCount()-1,startColumn:C,endColumn:n.getColumnCount()-1,rangeType:i.RANGE_TYPE.COLUMN};return this._checkRange([S],o,r)}case A.DeleteRangeMoveUpCommandId:case A.InsertRangeMoveDownCommandId:{const C=t.params.range||_r(this._selectionManagerService)[0],S={startRow:C.startRow,startColumn:C.startColumn,endColumn:C.endColumn,endRow:wr};return this._checkRange([S],o,r)}case A.DeleteRangeMoveLeftCommandId:case A.InsertRangeMoveRightCommandId:{const C=t.params.range||_r(this._selectionManagerService)[0],S={startRow:C.startRow,startColumn:C.startColumn,endColumn:wr,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)(l.preRedos,null)||[],c=this.interceptor.fetchThroughInterceptors(this.interceptor.getInterceptPoints().MERGE_REDO)(l.redos,null)||[],m=this.interceptor.fetchThroughInterceptors(this.interceptor.getInterceptPoints().MERGE_UNDO)(l.preUndos,null)||[],h=this.interceptor.fetchThroughInterceptors(this.interceptor.getInterceptPoints().MERGE_UNDO)(l.undos,null)||[];return{redos:c,undos:h,preRedos:d,preUndos:m}}})});f(this,"_checkRange",(t,n,o)=>{const r=br(n,o),a=this._refRangeManagerMap.get(r);if(a){const u=new Set;return[...a.keys()].forEach(d=>{const c=a.get(d),m=this._serializer.deserialize(d),h={...m,startRow:+m.startRow,endRow:+m.endRow,startColumn:+m.startColumn,endColumn:+m.endColumn,rangeType:m.rangeType&&+m.rangeType};t.some(R=>i.Rectangle.intersects(R,h))&&c&&c.forEach(R=>{u.add(R)})}),[...u]}return[]});f(this,"registerRefRange",(t,n,o,r)=>{const a=o||Mr(this._univerInstanceService),u=r||yr(this._univerInstanceService);if(!a||!u)return i.toDisposable(()=>{});const l=br(a,u),d=this._serializer.serialize(t);let c=this._refRangeManagerMap.get(l);c||(c=new Map,this._refRangeManagerMap.set(l,c));const m=c.get(d);return m?m.add(n):c.set(d,new Set([n])),i.toDisposable(()=>{const h=c.get(d);h&&(h.delete(n),h.size||(c.delete(d),c.size||this._refRangeManagerMap.delete(l)))})});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 u;this._watchRanges.size===0&&(u=this._commandService.onCommandExecuted(m=>{if(m.type!==i.CommandType.MUTATION)return!1;for(const h of this._watchRanges)h.onMutation(m)}));const l=new Yu(t,n,o,r,a);this._watchRanges.add(l);const d=i.toDisposable(()=>{this._watchRanges.delete(l),this._watchRanges.size===0&&(u==null||u.dispose(),u=null)}),c=this.disposeWithMe(d);return i.toDisposable(()=>{c.dispose(),d.dispose()})}},g.RefRangeService=Gu([Sn(0,i.ICommandService),Sn(1,i.Inject(g.SheetInterceptorService)),Sn(2,i.Inject(i.IUniverInstanceService)),Sn(3,i.Inject(g.SheetsSelectionsService))],g.RefRangeService);function Mr(s){return s.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET).getUnitId()}function yr(s){var e;return(e=s.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:e.getSheetId()}function _r(s){var e;return((e=s.getCurrentSelections())==null?void 0:e.map(t=>t.range))||[]}function br(s,e){return`${s}_${e}`}function Ku(){const s=["startRow","startColumn","endRow","endColumn","rangeType"];return{deserialize:t=>{const n=s.reduce((r,a,u)=>(r[String(u)]=a,r),{});return t.split("_").reduce((r,a,u)=>{const l=String(u);return a&&n[l]&&(r[n[l]]=a),r},{})},serialize:t=>s.reduce((n,o,r)=>{const a=t[o];return a!==void 0?`${n}${r>0?"_":""}${a}`:`${n}`},"")}}var Ju=Object.getOwnPropertyDescriptor,xu=(s,e,t,n)=>{for(var o=n>1?void 0:n?Ju(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},Mt=(s,e)=>(t,n)=>e(t,n,s);const Xu=[ie.id,re.id,ne.id,ae.id],Zu=[pe.id,we.id];function Os(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:u,endColumn:l}=t[o];if(e===i.Dimension.ROWS)for(let d=r;d<=a;d++){const c={startRow:d,endRow:d,startColumn:u,endColumn:l};n.push(c)}else if(e===i.Dimension.COLUMNS)for(let d=u;d<=l;d++){const c={startRow:r,endRow:a,startColumn:d,endColumn:d};n.push(c)}}t=n}return t}const Er=i.createInterceptorKey("mergeCellPermissionCheck");g.MergeCellController=class extends i.Disposable{constructor(t,n,o,r,a,u){super();f(this,"disposableCollection",new i.DisposableCollection);f(this,"interceptor",new i.InterceptorManager({MERGE_CELL_INTERCEPTOR_CHECK:Er}));this._commandService=t,this._refRangeService=n,this._univerInstanceService=o,this._injector=r,this._sheetInterceptorService=a,this._selectionManagerService=u,this._onRefRangeChange(),this._initCommandInterceptor(),this._commandExecutedListener()}_initCommandInterceptor(){const t=this;this._sheetInterceptorService.interceptCommand({getMutations(n){var o;switch(n.id){case sn.id:case on.id:{const r=t._univerInstanceService.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET),a=r.getUnitId(),u=r==null?void 0:r.getActiveSheet();if(!u)return{redos:[],undos:[]};const l=u.getSheetId(),d=u.getConfig().mergeData,c=(o=t._selectionManagerService.getCurrentSelections())==null?void 0:o.map(m=>m.range);if(c&&c.length>0&&c.some(h=>d.some(R=>i.Rectangle.intersects(R,h)))){const h={unitId:a,subUnitId:l,ranges:c},R=ue(t._injector,h),C=[{id:G.id,params:h}],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=[],u=[],l={redos:a,undos:u};if(!r||!r.length)return l;const d=P(this._univerInstanceService,{unitId:n,subUnitId:o});if(!d)return l;const{worksheet:c}=d,h=c.getMergeData().filter(R=>r.some(C=>i.Rectangle.intersects(R,C)));return h.length?(a.push({id:G.id,params:{unitId:n,subUnitId:o,ranges:h}}),u.push({id:j.id,params:{unitId:n,subUnitId:o,ranges:h}}),{undos:u,redos:a}):l}})}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 Me.id:{const r=t.params,a=r.unitId||n,u=r.subUnitId||o;return this._handleInsertRowCommand(r,a,u)}case ye.id:{const r=t.params,a=r.unitId||n,u=r.subUnitId||o;return this._handleInsertColCommand(r,a,u)}case Lt.id:{const r=t.params;return this._handleRemoveColCommand(r,n,o)}case $t.id:{const r=t.params;return this._handleRemoveRowCommand(r,n,o)}case Je.id:{const r=t.params;return this._handleMoveRangeCommand(r,n,o)}case vt.id:{const r=t.params;return this._handleInsertRangeMoveRightCommand(r,n,o)}case xe.id:{const r=t.params;return this._handleInsertRangeMoveDownCommand(r,n,o)}case He.id:{const r=t.params;return this._handleDeleteRangeMoveUpCommand(r,n,o)}case Be.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 u=a.getMergeData(),l=d=>this.refRangeHandle(d,n,o);u.forEach(d=>{this.disposableCollection.add(this._refRangeService.registerRefRange(d,l,n,o))})};this.disposeWithMe(this._commandService.onCommandExecuted(n=>{if(n.id===Ct.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=_e(this._univerInstanceService,n);if(!r)return this._handleNull();const a=be(r,o);if(!a)return this._handleNull();const u=[...a.getMergeData()],l={unitId:n,subUnitId:o,ranges:[]},d={unitId:n,subUnitId:o,ranges:[]},{fromRange:c}=t,{startRow:m,endRow:h}=c;if(u.forEach(S=>{if(m<=S.startRow&&h>=S.endRow){l.ranges.push(S);const I=Ts({id:A.MoveRowsCommandId,params:t},S),v=et(I,S);v&&d.ranges.push(v)}}),l.ranges.length===0)return this._handleNull();const R=ue(this._injector,l),C=ge(this._injector,d);return{preRedos:[{id:G.id,params:l}],redos:[{id:j.id,params:d}],preUndos:[{id:G.id,params:C}],undos:[{id:j.id,params:R}]}}_handleMoveColsCommand(t,n,o){const r=_e(this._univerInstanceService,n);if(!r)return this._handleNull();const a=be(r,o);if(!a)return this._handleNull();const u=[...a.getMergeData()],l={unitId:n,subUnitId:o,ranges:[]},d={unitId:n,subUnitId:o,ranges:[]},{fromRange:c}=t,{startColumn:m,endColumn:h}=c;if(u.forEach(S=>{if(m<=S.startColumn&&h>=S.endColumn){l.ranges.push(S);const I=Us({id:A.MoveColsCommandId,params:t},S),v=et(I,S);v&&d.ranges.push(v)}}),l.ranges.length===0)return this._handleNull();const R=ue(this._injector,l),C=ge(this._injector,d);return{preRedos:[{id:G.id,params:l}],redos:[{id:j.id,params:d}],preUndos:[{id:G.id,params:C}],undos:[{id:j.id,params:R}]}}_handleMoveRangeCommand(t,n,o){const r=_e(this._univerInstanceService,n);if(!r)return this._handleNull();const a=be(r,o);if(!a)return this._handleNull();const u=a.getMergeData(),l=u.filter(C=>i.Rectangle.intersects(C,t.fromRange)),d=u.filter(C=>i.Rectangle.intersects(C,t.toRange)),c=l.map(C=>i.Rectangle.getRelativeRange(C,t.fromRange)).map(C=>i.Rectangle.getPositionRange(C,t.toRange)),m=Os(c).filter(C=>!u.some(S=>i.Rectangle.equals(C,S))),h=[{id:G.id,params:{unitId:n,subUnitId:o,ranges:l}},{id:G.id,params:{unitId:n,subUnitId:o,ranges:d}},{id:j.id,params:{unitId:n,subUnitId:o,ranges:m}}],R=[{id:G.id,params:{unitId:n,subUnitId:o,ranges:m}},{id:j.id,params:{unitId:n,subUnitId:o,ranges:d}},{id:j.id,params:{unitId:n,subUnitId:o,ranges:l}}];return{redos:h,undos:R}}_handleInsertRowCommand(t,n,o){const r=_e(this._univerInstanceService,n);if(!r)return this._handleNull();const a=be(r,o);if(!a)return this._handleNull();const{range:u}=t,{startRow:l,endRow:d}=u,c=i.Tools.deepClone(a.getMergeData()).reduce((M,p)=>(l>p.startRow&&l<=p.endRow&&M.push(p),M),[]);if(c.length===0)return this._handleNull();const m=i.Tools.deepClone(a.getMergeData()).reduce((M,p)=>{if(l>p.startRow&&l<=p.endRow){const w=d-l+1;p.endRow+=w,this._checkIsMergeCell(p)&&M.push(p)}return M},[]),h={unitId:n,subUnitId:o,ranges:c},R=ue(this._injector,h),C={unitId:n,subUnitId:o,ranges:m},S=ge(this._injector,C),I=[{id:G.id,params:h},{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=_e(this._univerInstanceService,n);if(!a)return this._handleNull();const u=be(a,o);if(!u)return this._handleNull();const{startColumn:l,endColumn:d}=r,c=i.Tools.deepClone(u.getMergeData()).reduce((M,p)=>(l>p.startColumn&&l<=p.endColumn&&M.push(p),M),[]);if(c.length===0)return this._handleNull();const m=i.Tools.deepClone(u.getMergeData()).reduce((M,p)=>{if(l>p.startColumn&&l<=p.endColumn){const w=d-l+1;p.endColumn+=w,this._checkIsMergeCell(p)&&M.push(p)}return M},[]),h={unitId:n,subUnitId:o,ranges:c},R=ue(this._injector,h),C={unitId:n,subUnitId:o,ranges:m},S=ge(this._injector,C),I=[{id:G.id,params:h},{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=_e(this._univerInstanceService,n);if(!r)return this._handleNull();const a=be(r,o);if(!a)return this._handleNull();const{range:u}=t,{startColumn:l,endColumn:d}=u,c=i.Tools.deepClone(a.getMergeData()).reduce((w,y)=>(i.Rectangle.intersects(u,y)&&w.push(y),w),[]);if(c.length===0)return this._handleNull();const m=i.Tools.deepClone(a.getMergeData()).reduce((w,y)=>{if(i.Rectangle.intersects(u,y)){if(l<=y.startColumn&&d>=y.endColumn)return w;l>=y.startColumn&&d<=y.endColumn?y.endColumn-=d-l+1:l<y.startColumn?(y.startColumn=l,y.endColumn-=d-l+1):d>y.endColumn&&(y.endColumn=l-1),this._checkIsMergeCell(y)&&w.push(y)}return w},[]),h={unitId:n,subUnitId:o,ranges:c},R=ue(this._injector,h),C={unitId:n,subUnitId:o,ranges:m},S=ge(this._injector,C),I=[{id:G.id,params:h}],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=_e(this._univerInstanceService,n);if(!a)return this._handleNull();const u=be(a,o);if(!u)return this._handleNull();const{startRow:l,endRow:d}=r,c=i.Tools.deepClone(u.getMergeData()).reduce((w,y)=>(i.Rectangle.intersects(r,y)&&w.push(y),w),[]);if(c.length===0)return this._handleNull();const m=i.Tools.deepClone(u.getMergeData()).reduce((w,y)=>{if(i.Rectangle.intersects(r,y)){if(l<=y.startRow&&d>=y.endRow)return w;l>=y.startRow&&d<=y.endRow?y.endRow-=d-l+1:l<y.startRow?(y.startRow=l,y.endRow-=d-l+1):d>y.endRow&&(y.endRow=l-1),this._checkIsMergeCell(y)&&w.push(y)}return w},[]),h={unitId:n,subUnitId:o,ranges:c},R=ue(this._injector,h),C={unitId:n,subUnitId:o,ranges:m},S=ge(this._injector,C),I=[{id:G.id,params:h}],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=_e(this._univerInstanceService,n);if(!r)return this._handleNull();const a=be(r,o);if(!a)return this._handleNull();const u=t.range,l=a.getMaxColumns()-1,d=a.getMergeData(),c=[],m=[];d.forEach(I=>{const{startRow:v,endRow:M,startColumn:p,endColumn:w}=u;if(i.Rectangle.intersects({startRow:v,startColumn:p,endRow:M,endColumn:l},I)&&(c.push(I),i.Rectangle.contains({startRow:v,startColumn:p,endRow:M,endColumn:l},I))){const T=w-p+1;m.push({startRow:I.startRow,startColumn:I.startColumn+T,endRow:I.endRow,endColumn:I.endColumn+T})}});const h={unitId:n,subUnitId:o,ranges:c},R=ue(this._injector,h),C={unitId:n,subUnitId:o,ranges:m},S=ge(this._injector,C);return{preRedos:[{id:G.id,params:h}],redos:[{id:j.id,params:C}],preUndos:[{id:G.id,params:S}],undos:[{id:j.id,params:R}]}}_handleInsertRangeMoveDownCommand(t,n,o){const r=_e(this._univerInstanceService,n);if(!r)return this._handleNull();const a=be(r,o);if(!a)return this._handleNull();const u=t.range,l=a.getMaxRows()-1,d=a.getMergeData(),c=[],m=[];d.forEach(w=>{const{startRow:y,startColumn:b,endColumn:T,endRow:U}=u;if(i.Rectangle.intersects({startRow:y,startColumn:b,endRow:l,endColumn:T},w)&&(c.push(w),i.Rectangle.contains({startRow:y,startColumn:b,endRow:l,endColumn:T},w))){const N=U-y+1;m.push({startRow:w.startRow+N,startColumn:w.startColumn,endRow:w.endRow+N,endColumn:w.endColumn})}});const h={unitId:n,subUnitId:o,ranges:c},R=ue(this._injector,h),C={unitId:n,subUnitId:o,ranges:m},S=ge(this._injector,C),I=[{id:G.id,params:h}],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=_e(this._univerInstanceService,n);if(!r)return this._handleNull();const a=be(r,o);if(!a)return this._handleNull();const u=t.range,l=a.getMaxRows()-1,d=a.getMergeData(),c=[],m=[];d.forEach(w=>{const{startRow:y,startColumn:b,endColumn:T,endRow:U}=u;if(i.Rectangle.intersects({startRow:y,startColumn:b,endRow:l,endColumn:T},w)&&(c.push(w),i.Rectangle.contains({startRow:y,startColumn:b,endRow:l,endColumn:T},w))){const N=U-y+1,W=i.Rectangle.moveVertical(w,-N);m.push(W)}});const h={unitId:n,subUnitId:o,ranges:c},R=ue(this._injector,h),C={unitId:n,subUnitId:o,ranges:m},S=ge(this._injector,C),I=[{id:G.id,params:h}],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=_e(this._univerInstanceService,n);if(!r)return this._handleNull();const a=be(r,o);if(!a)return this._handleNull();const u=t.range,l=a.getMaxColumns()-1,d=a.getMergeData(),c=[],m=[];d.forEach(I=>{const{startRow:v,endRow:M,startColumn:p,endColumn:w}=u;if(i.Rectangle.intersects({startRow:v,startColumn:p,endRow:M,endColumn:l},I)&&(c.push(I),i.Rectangle.contains({startRow:v,startColumn:p,endRow:M,endColumn:l},I))){const T=w-p+1;m.push({startRow:I.startRow,startColumn:I.startColumn-T,endRow:I.endRow,endColumn:I.endColumn-T})}});const h={unitId:n,subUnitId:o,ranges:c},R=ue(this._injector,h),C={unitId:n,subUnitId:o,ranges:m},S=ge(this._injector,C);return{preRedos:[{id:G.id,params:h}],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(Zu.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,u=r.startColumn===a.startColumn&&r.endColumn===a.endColumn,l=u?r.endRow-r.startRow+1:r.endColumn-r.startColumn+1,d=u?r.startRow:r.startColumn,c=u?a.startRow:a.startColumn,m=o.getConfig().mergeData,h=[];m.forEach(I=>{let{startRow:v,endRow:M,startColumn:p,endColumn:w,rangeType:y}=I;i.Rectangle.intersects(I,r)||(u?d<v&&c>M?(v-=l,M-=l):d>M&&c<=v&&(v+=l,M+=l):d<p&&c>w?(p-=l,w-=l):d>w&&c<=p&&(p+=l,w+=l)),I.startRow===I.endRow&&I.startColumn===I.endColumn||h.push({startRow:v,endRow:M,startColumn:p,endColumn:w,rangeType:y})}),o.setMergeData(h),this.disposableCollection.dispose();const{unitId:R,subUnitId:C}=t.params,S=I=>this.refRangeHandle(I,R,C);h.forEach(I=>{this.disposableCollection.add(this._refRangeService.registerRefRange(I,S,R,C))})}if(Xu.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:u}=a,l=t.id.includes("row"),d=t.id.includes("insert"),c=l?u.startRow:u.startColumn,m=l?u.endRow:u.endColumn,h=m-c+1,R=[];r.forEach(v=>{let{startRow:M,endRow:p,startColumn:w,endColumn:y,rangeType:b}=v;d?l?c<=M&&(M+=h,p+=h):c<=w&&(w+=h,y+=h):l?m<M&&(M-=h,p-=h):m<w&&(w-=h,y-=h),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=xu([Mt(0,i.Inject(i.ICommandService)),Mt(1,i.Inject(g.RefRangeService)),Mt(2,i.Inject(i.IUniverInstanceService)),Mt(3,i.Inject(i.Injector)),Mt(4,i.Inject(g.SheetInterceptorService)),Mt(5,i.Inject(g.SheetsSelectionsService))],g.MergeCellController);function _e(s,e){return e?s.getUniverSheetInstance(e):s.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET)}function be(s,e){return e?s.getSheetBySheetId(e):s.getActiveSheet()}function Qu(s,e){return e.some(t=>el(s,t))}function el(s,e){const{startRow:t,startColumn:n,endColumn:o,endRow:r}=e,a=s.getMatrixWithMergedCells(t,n,r,o);let u=!1;return a.forValue((l,d,c)=>{if(c&&(l!==t||d!==n)&&s.cellHasValue(c))return u=!0,!1}),u}function tl(s,e,t,n){const o=[],r=[],a=t.getSheetId();return n.forEach(u=>{const l=nl(t,u),d={unitId:e,subUnitId:a,cellValue:l.getData()},c=ce(s,d);o.push({id:F.id,params:c}),r.push({id:F.id,params:d})}),{undos:o,redos:r}}function nl(s,e){const{startRow:t,startColumn:n,endColumn:o,endRow:r}=e,a=s.getMatrixWithMergedCells(t,n,r,o,i.CellModeEnum.Raw),u=new i.ObjectMatrix;return a.forValue((l,d,c)=>{c&&(l!==t||d!==n)&&u.setValue(l,d,null)}),u}const Ft={type:i.CommandType.COMMAND,id:"sheet.command.add-worksheet-merge",handler:(s,e)=>{const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),o=s.get(i.IUniverInstanceService),r=e.unitId,a=e.subUnitId,u=e.selections,l=Os(u,e.value),d=o.getUniverSheetInstance(r).getSheetBySheetId(a),c=[],m=[],h=Qu(d,l),R={unitId:r,subUnitId:a,ranges:l},C={unitId:r,subUnitId:a,ranges:l};c.push({id:G.id,params:R}),c.push({id:j.id,params:C});const S=ue(s,R),I=ge(s,C);if(m.push({id:G.id,params:I}),m.push({id:j.id,params:S}),h){const M=tl(s,r,d,l);c.unshift(...M.redos),m.push(...M.undos)}return i.sequenceExecute(c,t).result?(n.pushUndoRedo({unitID:r,undoMutations:m,redoMutations:c}),!0):!1}},sl={type:i.CommandType.COMMAND,id:"sheet.command.add-worksheet-merge-all",handler:async s=>{var d;const e=s.get(i.ICommandService),n=(d=s.get(g.SheetsSelectionsService).getCurrentSelections())==null?void 0:d.map(c=>c.range);if(!(n!=null&&n.length))return!1;const r=s.get(i.IUniverInstanceService).getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET);if(!r)return!1;const a=r.getActiveSheet();if(!a)return!1;const u=r.getUnitId(),l=a.getSheetId();return e.executeCommand(Ft.id,{selections:n,unitId:u,subUnitId:l})}},ol={type:i.CommandType.COMMAND,id:"sheet.command.add-worksheet-merge-vertical",handler:async s=>{var d;const e=s.get(i.ICommandService),n=(d=s.get(g.SheetsSelectionsService).getCurrentSelections())==null?void 0:d.map(c=>c.range);if(!(n!=null&&n.length))return!1;const r=s.get(i.IUniverInstanceService).getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET);if(!r)return!1;const a=r.getActiveSheet();if(!a)return!1;const u=r.getUnitId(),l=a.getSheetId();return e.executeCommand(Ft.id,{value:i.Dimension.COLUMNS,selections:n,unitId:u,subUnitId:l})}},rl={type:i.CommandType.COMMAND,id:"sheet.command.add-worksheet-merge-horizontal",handler:async s=>{var d;const e=s.get(i.ICommandService),n=(d=s.get(g.SheetsSelectionsService).getCurrentSelections())==null?void 0:d.map(c=>c.range);if(!(n!=null&&n.length))return!1;const r=s.get(i.IUniverInstanceService).getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET);if(!r)return!1;const a=r.getActiveSheet();if(!a)return!1;const u=r.getUnitId(),l=a.getSheetId();return e.executeCommand(Ft.id,{value:i.Dimension.ROWS,selections:n,unitId:u,subUnitId:l})}};function il(s,e,t,n,o){const r=s.get(i.IUniverInstanceService),a=P(r,{unitId:e,subUnitId:t});if(!a)return;const{worksheet:u}=a;if(u.getMergeData().some(m=>n.some(h=>i.Rectangle.intersects(h,m))))throw new Error("The ranges to be merged overlap with the existing merged cells");s.get(i.ICommandService).executeCommand(Ft.id,{unitId:e,subUnitId:t,selections:n,defaultMerge:o})}class ke{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 u=o.get(a);u&&e[n].push(u)}))}),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 Fe={id:"sheet.mutation.add-worksheet-protection",type:i.CommandType.MUTATION,handler:(s,e)=>{const t=s.get(ke),{unitId:n,rule:o}=e;return t.addRule(n,o),!0}},tt={id:"sheet.mutation.delete-worksheet-protection",type:i.CommandType.MUTATION,handler:(s,e)=>{const t=s.get(ke),{unitId:n,subUnitId:o}=e;return t.deleteRule(n,o),!0}},Tr={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(Fe.id,{unitId:r,rule:o,subUnitId:o.subUnitId})){const l=[{id:Fe.id,params:{unitId:r,rule:o,subUnitId:o.subUnitId}}],d=[{id:tt.id,params:{unitId:r,subUnitId:a}}];n.pushUndoRedo({unitID:r,redoMutations:l,undoMutations:d})}return!0}},Ur={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=uo(s,e);return t.syncExecuteCommand(rt.id,e)?(n.pushUndoRedo({unitID:o,undoMutations:[{id:it.id,params:r}],redoMutations:[{id:rt.id,params:e}]}),!0):!1}},Pr={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:u,insertColumnNums:l,maxRows:d,maxColumns:c}=e,m={unitId:o,subUnitId:r,cellValue:a},h=ce(s,m),R=[{id:F.id,params:m}],C=[{id:F.id,params:h}];if(u){const I={unitId:o,subUnitId:r,range:{startRow:d,endRow:d,startColumn:0,endColumn:c-1}},v=en(s,I);R.unshift({id:re.id,params:I}),C.push({id:ae.id,params:v})}if(l){const I={unitId:o,subUnitId:r,range:{startRow:0,endRow:d-1,startColumn:c,endColumn:c-1+l}},v=Nt(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}},fn={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),u=t.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET);if(!u)return!1;const l=(e==null?void 0:e.unitId)||u.getUnitId(),d=u.getActiveSheet();if(!d)return!1;const c=(e==null?void 0:e.subUnitId)||d.getSheetId(),m=(e==null?void 0:e.ranges)||((p=o.getCurrentSelections())==null?void 0:p.map(w=>w.range));if(!(m!=null&&m.length))return!1;const h=Dt(m,s,l,c),R={subUnitId:c,unitId:l,cellValue:ko(h)},C=ce(s,R),S=a.onCommandExecute({id:fn.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:l,undoMutations:v,redoMutations:I}),!0):!1}},Ds=(s,e)=>({subUnitId:e.sheet.id,unitId:e.unitId,subUnitName:e.sheet.name}),yt={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,u=t.getUniverSheetInstance(r);return u?(a&&u.addStyles(a),u.addWorksheet(n.id,o,n)):!1}},As={type:i.CommandType.COMMAND,id:"sheet.command.copy-sheet",handler:(s,e)=>{var w,y;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),u=P(o,e);if(!u)return!1;const{workbook:l,worksheet:d,unitId:c,subUnitId:m}=u,h=i.Tools.deepClone(d.getConfig());h.name=al(l,a,h.name),h.id=i.generateRandomId();const C={index:l.getSheetIndex(d)+1,sheet:h,unitId:c},S=Ds(s,C),I=r.onCommandExecute({id:As.id,params:{unitId:c,subUnitId:m,targetSubUnitId:h.id}}),v=[...(w=I.preRedos)!=null?w:[],{id:yt.id,params:C},...I.redos],M=[...(y=I.preUndos)!=null?y:[],{id:Xe.id,params:S},...I.undos];return i.sequenceExecute(v,t).result?(n.pushUndoRedo({unitID:c,undoMutations:M,redoMutations:v}),!0):!1}};function al(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 kr={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,u={unitId:o,subUnitId:r,ruleIds:[a.id]};return await t.executeCommand(Te.id,u)&&n.pushUndoRedo({unitID:o,redoMutations:[{id:Te.id,params:u}],undoMutations:[{id:Ce.id,params:{unitId:o,subUnitId:r,rules:[a]}}]}),!0}},Nr={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(tt.id,{unitId:r,subUnitId:a});const u=[{id:tt.id,params:{unitId:r,subUnitId:a}}],l=[{id:Fe.id,params:{unitId:r,rule:o,subUnitId:a}}];return n.pushUndoRedo({unitID:r,redoMutations:u,undoMutations:l}),!0}},Or={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=lo(s,e);return t.syncExecuteCommand(it.id,e)?(n.pushUndoRedo({unitID:o,undoMutations:[{id:rt.id,params:r}],redoMutations:[{id:it.id,params:e}]}),!0):!1}},Dr={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(J.SetDefinedNameMutation.id,o)?(n.pushUndoRedo({unitID:e.unitId,undoMutations:[{id:J.RemoveDefinedNameMutation.id,params:o}],redoMutations:[{id:J.SetDefinedNameMutation.id,params:o}]}),!0):!1}},Ar={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=Bn(o,{unitId:e==null?void 0:e.unitId});if(!a)return!1;const{unitId:u,workbook:l}=a;let d=l.getSheets().length;const c=e==null?void 0:e.sheet,m=c==null?void 0:c.id,h=i.mergeWorksheetSnapshotWithDefault(c||{});e?(d=(I=e.index)!=null?I:d,h.id=m||i.generateRandomId(),h.name=(c==null?void 0:c.name)||l.generateNewSheetName(`${r.t("sheets.tabs.sheet")}`)):(h.id=i.generateRandomId(),h.name=l.generateNewSheetName(`${r.t("sheets.tabs.sheet")}`));const R={index:d,sheet:h,unitId:u},C=Ds(s,R);return t.syncExecuteCommand(yt.id,R)?(n.pushUndoRedo({unitID:u,undoMutations:[{id:Xe.id,params:C}],redoMutations:[{id:yt.id,params:R}]}),!0):!1}},_t={id:"sheet.mutation.register-worksheet-range-theme-style",type:i.CommandType.MUTATION,handler:(s,e)=>{const{unitId:t,rangeThemeStyleJson:n,themeName:o}=e,r=s.get(i.IUniverInstanceService),a=P(r),u=s.get(g.SheetRangeThemeModel);if(!a)return!1;const l=new We(o,n);return u.registerRangeThemeStyle(t,l),!0}},In={id:"sheet.mutation.unregister-worksheet-range-theme-style",type:i.CommandType.MUTATION,handler:(s,e)=>{const{unitId:t,themeName:n}=e,o=s.get(i.IUniverInstanceService),r=P(o),a=s.get(g.SheetRangeThemeModel);return r?(a.unregisterRangeThemeStyle(t,n),!0):!1}},Wr={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))return!1;const l={unitId:t,themeName:n.getName(),rangeThemeStyleJson:n.toJson()},d={unitId:t,themeName:n.getName()};return r.syncExecuteCommand(_t.id,l)&&a.pushUndoRedo({unitID:t,undoMutations:[{id:In.id,params:d}],redoMutations:[{id:_t.id,params:l}]}),!0}},Ws={id:"sheet.command.remove-defined-name",type:i.CommandType.COMMAND,handler:(s,e)=>{var c,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=o.onCommandExecute({id:Ws.id,params:e}),u=[...(c=a.preRedos)!=null?c:[],{id:J.RemoveDefinedNameMutation.id,params:r},...a.redos],l=[...(m=a.preUndos)!=null?m:[],{id:J.SetDefinedNameMutation.id,params:r},...a.undos];return i.sequenceExecute(u,t)?(n.pushUndoRedo({unitID:e.unitId,undoMutations:l.filter(Boolean),redoMutations:u.filter(Boolean)}),!0):!1}},vn={id:"sheet.command.remove-sheet",type:i.CommandType.COMMAND,handler:(s,e)=>{var v,M;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{unitId:u,subUnitId:l,workbook:d,worksheet:c}=a;if(d.getSheets().length<=1)return!1;const m={subUnitId:l,unitId:u,subUnitName:c.getName()},h=ar(s,m),R=r.onCommandExecute({id:vn.id,params:{unitId:u,subUnitId:l}}),C=[...(v=R.preRedos)!=null?v:[],{id:Xe.id,params:m},...R.redos],S=[...(M=R.preUndos)!=null?M:[],{id:yt.id,params:h},...R.undos];return i.sequenceExecute(C,t).result?(n.pushUndoRedo({unitID:u,undoMutations:S,redoMutations:C}),!0):!1}},Vr={type:i.CommandType.COMMAND,id:"sheet.command.remove-worksheet-merge",handler:(s,e)=>{var N;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)||((N=t.getCurrentSelections())==null?void 0:N.map(W=>W.range));if(!(a!=null&&a.length))return!1;const u=P(r);if(!u)return!1;const{subUnitId:l,unitId:d,worksheet:c}=u,m={unitId:d,subUnitId:l,ranges:a},R=c.getConfig().mergeData.filter(W=>a.some(V=>i.Rectangle.intersects(V,W)));if(!R.length)return!1;const C=ue(s,m),S=t.getCurrentSelections();if(!(S!=null&&S.length))return!1;const I=i.Tools.deepClone(S),v=i.Tools.deepClone(S),M=v[v.length-1],{startRow:p,startColumn:w}=M.range;M.primary={startRow:p,startColumn:w,endRow:p,endColumn:w,actualRow:p,actualColumn:w,isMerged:!1,isMergedMainCell:!1};const y=ul(c,R),b={unitId:d,subUnitId:l,cellValue:y.redoParams.getMatrix()},T={unitId:d,subUnitId:l,cellValue:y.undoParams.getMatrix()},U=[{id:G.id,params:C},{id:F.id,params:b},{id:q.id,params:{selections:v}}],k=[{id:j.id,params:C},{id:F.id,params:T},{id:q.id,params:{selections:I}}];return i.sequenceExecute(U,n)?(o.pushUndoRedo({unitID:d,undoMutations:k,redoMutations:U}),!0):!1}};function ul(s,e){const t=new i.ObjectMatrix,n=new i.ObjectMatrix;return e.forEach(o=>{const{startRow:r,startColumn:a,endColumn:u,endRow:l}=o,d=s.getCellMatrix().getValue(r,a);if(d!=null&&d.s)for(let c=r;c<=l;c++)for(let m=a;m<=u;m++)(c!==r||m!==a)&&(t.setValue(c,m,{s:d.s}),n.setValue(c,m,null))}),{redoParams:t,undoParams:n}}class nt{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 pn(s,e){const{startRow:t,startColumn:n,endRow:o,endColumn:r}=s;for(let a=t;a<=o;a++)for(let u=n;u<=r;u++)e(a,u)}const Vs=(s,e,t,n)=>{const{mr:o,worksheet:r}=s;e.startRow<0||e.startColumn<0||pn(e,(a,u)=>{var c,m;const l=r.getMergedCell(a,u);let d=t;if(l&&(t.bc_tr||t.ml_tr||t.bl_tr||t.tl_mr||t.tl_bc||t.tl_br)){if(n){const h=i.Tools.deepClone((c=o.getValue(l.startRow,l.startColumn))==null?void 0:c.s);d=h!=null&&h.bd?Object.assign(h.bd,t):t}o.setValue(l.startRow,l.startColumn,{s:{bd:d}})}else{if(n){const h=i.Tools.deepClone((m=o.getValue(a,u))==null?void 0:m.s);d=h!=null&&h.bd?Object.assign(h.bd,t):t}o.setValue(a,u,{s:{bd:d}})}})},ll=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},u={startRow:s.endRow,startColumn:s.startColumn,endRow:s.endRow,endColumn:s.endColumn},l={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:u,rightRange:l}};function dl(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,u=r===i.BorderType.LEFT||r===i.BorderType.ALL||r===i.BorderType.OUTSIDE,l=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,m=r===i.BorderType.HORIZONTAL||r===i.BorderType.ALL||r===i.BorderType.INSIDE,h=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:T,leftRange:U,bottomRange:k,rightRange:E}=ll(M),N=new i.ObjectMatrix,{worksheet:W,unitId:V,subUnitId:$}=e;return{worksheet:W,unitId:V,subUnitId:$,style:n,color:o,type:r,top:a,left:u,right:d,bottom:l,vertical:c,horizontal:m,tl_br:h,tl_bc:R,tl_mr:C,bl_tr:S,ml_tr:I,bc_tr:v,topRangeOut:p,leftRangeOut:w,bottomRangeOut:y,rightRangeOut:b,topRange:T,leftRange:U,bottomRange:k,rightRange:E,range:M,mr:N,borderStyle:{s:n,cl:{rgb:o}}}}const cl=s=>{const{range:e,mr:t,borderStyle:n,vertical:o,horizontal:r,worksheet:a}=s;o&&pn(e,(u,l)=>{var c,m,h;const d=a.getMergedCell(u,l);if(d){const R=(c=t.getValue(d.startRow,d.startColumn))==null?void 0:c.s;d.startColumn!==e.startColumn&&t.setValue(u,l,{s:{bd:R!=null&&R.bd?Object.assign(R.bd,{l:i.Tools.deepClone(n)}):{l:i.Tools.deepClone(n)}}})}else{if(l!==e.endColumn){const R=(m=t.getValue(u,l))==null?void 0:m.s;t.setValue(u,l,{s:{bd:R!=null&&R.bd?Object.assign(R.bd,{r:i.Tools.deepClone(n)}):{r:i.Tools.deepClone(n)}}})}if(l!==e.startColumn){const R=(h=t.getValue(u,l))==null?void 0:h.s;t.setValue(u,l,{s:{bd:R!=null&&R.bd?Object.assign(R.bd,{l:i.Tools.deepClone(n)}):{l:i.Tools.deepClone(n)}}})}}}),r&&pn(e,(u,l)=>{var c,m,h;const d=a.getMergedCell(u,l);if(d){const R=(c=t.getValue(d.startRow,d.startColumn))==null?void 0:c.s;d.startRow!==e.startRow&&t.setValue(u,l,{s:{bd:R!=null&&R.bd?Object.assign(R.bd,{t:i.Tools.deepClone(n)}):{t:i.Tools.deepClone(n)}}})}else{if(u!==e.endRow){const R=(m=t.getValue(u,l))==null?void 0:m.s;t.setValue(u,l,{s:{bd:R!=null&&R.bd?Object.assign(R.bd,{b:i.Tools.deepClone(n)}):{b:i.Tools.deepClone(n)}}})}if(u!==e.startRow){const R=(h=t.getValue(u,l))==null?void 0:h.s;t.setValue(u,l,{s:{bd:R!=null&&R.bd?Object.assign(R.bd,{t:i.Tools.deepClone(n)}):{t:i.Tools.deepClone(n)}}})}}})};function ml(s){const{borderStyle:e,tl_br:t,tl_bc:n,tl_mr:o,bl_tr:r,ml_tr:a,bc_tr:u}=s,l=(d,c,m)=>{Vs(s,d,c,m)};t&&l(s.range,{tl_br:i.Tools.deepClone(e)},!0),n&&l(s.range,{tl_bc:i.Tools.deepClone(e)},!0),o&&l(s.range,{tl_mr:i.Tools.deepClone(e)},!0),r&&l(s.range,{bl_tr:i.Tools.deepClone(e)},!0),a&&l(s.range,{ml_tr:i.Tools.deepClone(e)},!0),u&&l(s.range,{bc_tr:i.Tools.deepClone(e)},!0)}const hl=s=>{const{top:e,left:t,right:n,bottom:o,borderStyle:r,bottomRange:a,topRange:u,leftRange:l,rightRange:d,bottomRangeOut:c,topRangeOut:m,leftRangeOut:h,rightRangeOut:R}=s,C=(S,I,v)=>{Vs(s,S,I,v)};e&&(C(m,{b:null}),C(u,{t:i.Tools.deepClone(r)},!0)),o&&(C(c,{t:null}),C(a,{b:i.Tools.deepClone(r)},!0)),t&&(C(h,{r:null}),C(l,{l:i.Tools.deepClone(r)},!0)),n&&(C(R,{l:null}),C(d,{r:i.Tools.deepClone(r)},!0))},gl=s=>{const{range:e,worksheet:t,mr:n,top:o,bottom:r,left:a,right:u,vertical:l,horizontal:d,tl_br:c,tl_bc:m,tl_mr:h,bl_tr:R,ml_tr:C,bc_tr:S,topRange:I,bottomRange:v,leftRange:M,rightRange:p,topRangeOut:w,bottomRangeOut:y,leftRangeOut:b,rightRangeOut:T}=s,U=(k,E,N)=>{Vs(s,k,E,N)};!o&&!r&&!a&&!u&&!l&&!d&&!c&&!m&&!h&&!R&&!C&&!S&&(pn(e,(k,E)=>{var W,V,$,L,Y,z,K,oe;const N=t.getMergedCell(k,E);if(N){if(N.endColumn!==e.endColumn){const H=(W=n.getValue(N.startRow,N.startColumn))==null?void 0:W.s;n.setValue(k,E,{s:{bd:H!=null&&H.bd?Object.assign(H.bd,{r:null}):{r:null}}})}if(N.startColumn!==e.startColumn){const H=(V=n.getValue(N.startRow,N.startColumn))==null?void 0:V.s;n.setValue(k,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(k,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(k,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(k,E))==null?void 0:Y.s;n.setValue(k,E,{s:{bd:H!=null&&H.bd?Object.assign(H.bd,{r:null}):{r:null}}})}if(E!==e.startColumn){const H=(z=n.getValue(k,E))==null?void 0:z.s;n.setValue(k,E,{s:{bd:H!=null&&H.bd?Object.assign(H.bd,{l:null}):{l:null}}})}if(k!==e.endRow){const H=(K=n.getValue(k,E))==null?void 0:K.s;n.setValue(k,E,{s:{bd:H!=null&&H.bd?Object.assign(H.bd,{b:null}):{b:null}}})}if(k!==e.startRow){const H=(oe=n.getValue(k,E))==null?void 0:oe.s;n.setValue(k,E,{s:{bd:H!=null&&H.bd?Object.assign(H.bd,{t:null}):{t:null}}})}}}),U(w,{b:null}),U(I,{t:null},!0),U(y,{t:null}),U(v,{b:null},!0),U(b,{r:null}),U(M,{l:null},!0),U(T,{l:null}),U(p,{r:null},!0),U(e,{tl_br:null},!0),U(e,{tl_bc:null},!0),U(e,{tl_mr:null},!0),U(e,{bl_tr:null},!0),U(e,{ml_tr:null},!0),U(e,{bc_tr:null},!0))},bt={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(nt),u=P(o,e);if(!u)return!1;const l=(e==null?void 0:e.ranges)||((v=r.getCurrentSelections())==null?void 0:v.map(M=>M.range));if(!(l!=null&&l.length))return!1;const{activeBorderType:d}=a.getBorderInfo();if(!d)return!1;const c=dl(a,u,l);cl(c),hl(c),ml(c),gl(c);const{unitId:m,subUnitId:h,mr:R}=c,C={unitId:m,subUnitId:h,cellValue:R.getData()},S=ce(s,C);return t.syncExecuteCommand(F.id,C)?(n.pushUndoRedo({unitID:m,undoMutations:[{id:F.id,params:S}],redoMutations:[{id:F.id,params:C}]}),!0):!1}},$r={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(nt).setType(e.value),t.syncExecuteCommand(bt.id)}},Lr={id:"sheet.command.set-border-style",type:i.CommandType.COMMAND,handler:(s,e)=>{const t=s.get(i.ICommandService);return s.get(nt).setStyle(e.value),t.syncExecuteCommand(bt.id)}},Br={id:"sheet.command.set-border-color",type:i.CommandType.COMMAND,handler:(s,e)=>{const t=s.get(i.ICommandService);return s.get(nt).setColor(e.value),t.syncExecuteCommand(bt.id)}},Hr={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:u,style:l}=o,d=s.get(i.ICommandService),c=s.get(nt);return c.setType(a),u&&c.setColor(u),c.setStyle(l),d.syncExecuteCommand(bt.id,{unitId:t,subUnitId:n,ranges:r})}},Fr={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:u,subUnitId:l,worksheet:d}=r,c={subUnitId:l,unitId:u,columnData:a},m=go(c,d);return t.syncExecuteCommand(at.id,c)?(n.pushUndoRedo({unitID:u,undoMutations:[{id:at.id,params:m}],redoMutations:[{id:at.id,params:c}]}),!0):!1}},Et={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),u=s.get(i.IUniverInstanceService),l=P(u,{unitId:t,subUnitId:n});if(!l)return!1;const{worksheet:d}=l,c={unitId:t,subUnitId:n,ranges:o},m={unitId:t,subUnitId:n,reveal:!0,selections:o.map(p=>({range:p,primary:se(p,d),style:null}))},h=Ca(s,c),R={unitId:t,subUnitId:n,selections:jr(o).map(p=>({range:p,primary:se(p,d),style:null}))},C=i.sequenceExecute([{id:lt.id,params:c},{id:q.id,params:m}],a),S=r.onCommandExecute({id:Et.id,params:e}),I=i.sequenceExecute([...S.redos],a);if(C.result&&I.result){const p=r.afterCommandExecute({id:Et.id,params:e});return i.sequenceExecute(p.redos,a),s.get(i.IUndoRedoService).pushUndoRedo({unitID:t,undoMutations:[{id:ut.id,params:h},{id:q.id,params:R},...(v=S.undos)!=null?v:[],...p.undos],redoMutations:[...(M=S.preRedos)!=null?M:[],{id:lt.id,params:c},{id:q.id,params:m},...S.redos,...p.redos]}),!0}return!0}},$s={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:u}=o,l=n.map(c=>r.getHiddenCols(c.startColumn,c.endColumn)).flat();return t.executeCommand(Et.id,{unitId:a,subUnitId:u,ranges:l})}},wn={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 u=P(o,e);if(!u)return!1;const{worksheet:l,unitId:d,subUnitId:c}=u;a=Rl(u.worksheet,a);const m={unitId:d,subUnitId:c,ranges:a},h={unitId:d,subUnitId:c,selections:jr(a).map(b=>({range:b,primary:se(b,l),style:null}))},R=Ra(s,m),C={unitId:d,subUnitId:c,reveal:!0,selections:a.map(b=>({range:b,primary:se(b,l),style:null}))},S=i.sequenceExecute([{id:ut.id,params:m},{id:q.id,params:h}],r),I=n.onCommandExecute({id:wn.id,params:m}),v=i.sequenceExecute([...I.redos],r);if(S.result&&v.result){const b=n.afterCommandExecute({id:wn.id,params:m});return i.sequenceExecute(b.redos,r),s.get(i.IUndoRedoService).pushUndoRedo({unitID:d,undoMutations:[{id:lt.id,params:R},{id:q.id,params:C},...(w=I.undos)!=null?w:[],...b.undos],redoMutations:[...(y=I.preRedos)!=null?y:[],{id:ut.id,params:m},{id:q.id,params:h},...I.redos,...b.redos]}),!0}return!1}};function Rl(s,e){const t=s.getRowCount()-1,n=s.getHiddenCols(),o=[];return e.forEach(r=>{const a=n.filter(u=>u.startColumn>=r.startColumn&&u.endColumn<=r.endColumn);if(a.length){let u=r.startColumn;a.forEach(l=>{l.startColumn>u&&(o.push({startColumn:u,endColumn:l.startColumn-1,startRow:0,endRow:t}),u=l.endColumn+1)}),u<=r.endColumn&&o.push({startColumn:u,endColumn:r.endColumn,startRow:0,endRow:t})}else o.push(r)}),o}function jr(s){return Cl(s).map(t=>{const n=t.startColumn===0?t.endColumn+1:t.startColumn-1;return{...t,startColumn:n,endColumn:n}})}function Cl(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 Ls={id:"sheet.command.set-defined-name",type:i.CommandType.COMMAND,handler:(s,e)=>{var m,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=J.SetDefinedNameMutationFactory(s,e),u=o.onCommandExecute({id:Ls.id,params:e}),l=[...(m=u.preRedos)!=null?m:[],{id:J.RemoveDefinedNameMutation.id,params:a},{id:J.SetDefinedNameMutation.id,params:r},...u.redos],d=[...(h=u.preUndos)!=null?h:[],{id:J.RemoveDefinedNameMutation.id,params:r},{id:J.SetDefinedNameMutation.id,params:a},...u.undos];return i.sequenceExecute(l,t)?(n.pushUndoRedo({unitID:e.unitId,undoMutations:d.filter(Boolean),redoMutations:l.filter(Boolean)}),!0):!1}},Bs=(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}},Ne={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:u,ySplit:l,xSplit:d}=e;return r.freeze={startRow:a,startColumn:u,ySplit:l,xSplit:d},!0}},Gr={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:u,worksheet:l}=r,{startColumn:d,startRow:c,xSplit:m,ySplit:h}=e;if(c>=l.getRowCount()||d>=l.getColumnCount()||m>=l.getColumnCount()||h>=l.getRowCount())return!1;const R={unitId:a,subUnitId:u,...e},C=Bs(s,R);return t.syncExecuteCommand(Ne.id,R)?(n.pushUndoRedo({unitID:a,undoMutations:[{id:Ne.id,params:C}],redoMutations:[{id:Ne.id,params:R}]}),!0):!1}},zr={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:u}=r,l={unitId:a,subUnitId:u,startRow:-1,startColumn:-1,xSplit:0,ySplit:0},d=Bs(s,l);return t.syncExecuteCommand(Ne.id,l)&&o.pushUndoRedo({unitID:a,undoMutations:[{id:Ne.id,params:d}],redoMutations:[{id:Ne.id,params:l}]}),!0}},qr={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);if(!r)return!1;const{worksheet:a}=r,u=a.getConfig().gridlinesColor;if(u===(e==null?void 0:e.color))return!1;const{unitId:l,subUnitId:d}=r,c={color:e==null?void 0:e.color,unitId:l,subUnitId:d},m={color:u,unitId:l,subUnitId:d};return t.syncExecuteCommand(dt.id,c)?(n.pushUndoRedo({unitID:l,undoMutations:[{id:dt.id,params:m}],redoMutations:[{id:dt.id,params:c}]}),!0):!1}},Q={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}},Sl=(s,e)=>{const{unitId:t,subUnitId:n,ruleId:o}=e,a=s.get(X).getRule(t,n,o);return a?{id:Q.id,params:{...e,rule:a}}:null},st={id:"sheet.mutation.set-worksheet-protection",type:i.CommandType.MUTATION,handler:(s,e)=>{const{unitId:t,subUnitId:n,rule:o}=e;return s.get(ke).setRule(t,n,o),!0}},Yr={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:u,subUnitId:l}=r,d=[],c=[];return(a==null?void 0:a.unitType)===r.unitType?r.unitType===D.Worksheet?(d.push({id:st.id,params:{unitId:u,subUnitId:l,rule:r}}),c.push({id:st.id,params:{unitId:u,subUnitId:l,rule:a}})):(d.push({id:Q.id,params:{unitId:u,subUnitId:l,rule:r,ruleId:r.id}}),c.push({id:Q.id,params:{unitId:u,subUnitId:l,ruleId:a.id,rule:a}})):(a&&(a.unitType===D.Worksheet?(d.push({id:tt.id,params:{unitId:u,subUnitId:l}}),c.push({id:Fe.id,params:{unitId:u,rule:a,subUnitId:a.subUnitId}})):a.unitType===D.SelectRange&&(d.push({id:Te.id,params:{unitId:u,subUnitId:l,ruleIds:[a.id]}}),c.push({id:Ce.id,params:{unitId:u,subUnitId:l,rules:[a]}}))),r.unitType===D.Worksheet?(d.push({id:Fe.id,params:{unitId:u,rule:r,subUnitId:r.subUnitId}}),c.unshift({id:tt.id,params:{unitId:u,subUnitId:l}})):r.unitType===D.SelectRange&&(r.id=o.createRuleId(u,l),d.push({id:Ce.id,params:{unitId:u,subUnitId:l,rules:[r]}}),c.unshift({id:Te.id,params:{unitId:u,subUnitId:l,ruleIds:[r.id]}}))),i.sequenceExecute(d,t)&&n.pushUndoRedo({unitID:u,undoMutations:c,redoMutations:d}),!0}},Kr={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:u,subUnitId:l,worksheet:d}=r,c={subUnitId:l,unitId:u,rowData:a},m=So(c,d);return t.syncExecuteCommand(ct.id,c)?(n.pushUndoRedo({unitID:u,undoMutations:[{id:ct.id,params:m}],redoMutations:[{id:ct.id,params:c}]}),!0):!1}},Tt={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),u=s.get(g.SheetInterceptorService),l=P(s.get(i.IUniverInstanceService),{unitId:t,subUnitId:n});if(!l)return!1;const{worksheet:d}=l,c={unitId:t,subUnitId:n,ranges:o},m={unitId:t,subUnitId:n,reveal:!0,selections:o.map(w=>({range:w,primary:se(w,d),style:null}))},h=ba(s,c),R={unitId:t,subUnitId:n,selections:Jr(o).map(w=>({range:w,primary:se(w,d),style:null}))},C=i.sequenceExecute([{id:Ye.id,params:c},{id:q.id,params:m}],r),S=u.onCommandExecute({id:Tt.id,params:e}),I=i.sequenceExecute([...S.redos],r);if(C.result&&I.result){const w=u.afterCommandExecute({id:Tt.id,params:e});return i.sequenceExecute(w.redos,r),a.pushUndoRedo({unitID:t,undoMutations:[...(v=S.preUndos)!=null?v:[],{id:Ke.id,params:h},{id:q.id,params:R},...(M=S.undos)!=null?M:[],...w.undos],redoMutations:[...(p=S.preRedos)!=null?p:[],{id:Ye.id,params:c},{id:q.id,params:m},...S.redos,...w.redos]}),!0}return!0}},Hs={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(m=>m.range).filter(m=>m.rangeType===i.RANGE_TYPE.ROW);if(!(o!=null&&o.length))return!1;const r=P(t);if(!r)return!1;const{worksheet:a,unitId:u,subUnitId:l}=r,d=o.map(m=>a.getHiddenRows(m.startRow,m.endRow)).flat();return n.executeCommand(Tt.id,{unitId:u,subUnitId:l,ranges:d})}},Mn={type:i.CommandType.COMMAND,id:"sheet.command.set-rows-hidden",handler:(s,e)=>{var M,p,w,y,b,T;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 u=(M=e==null?void 0:e.ranges)!=null&&M.length?e.ranges:(p=t.getCurrentSelections())==null?void 0:p.map(U=>U.range).filter(U=>U.rangeType===i.RANGE_TYPE.ROW);if(!(u!=null&&u.length))return!1;const l=P(r,e);if(!l)return!1;u=fl(l.worksheet,u);const{unitId:d,subUnitId:c,worksheet:m}=l,h={unitId:d,subUnitId:c,ranges:u},R={unitId:d,subUnitId:c,selections:Jr(u).map(U=>({range:U,primary:se(U,m),style:null}))},C=Ea(s,h),S={unitId:d,subUnitId:c,reveal:!0,selections:u.map(U=>({range:U,primary:se(U,m),style:null}))},I=a.onCommandExecute({id:Mn.id,params:h});if(i.sequenceExecute([...(w=I.preRedos)!=null?w:[],{id:Ke.id,params:h},{id:q.id,params:R},...I.redos],n).result){const U=a.afterCommandExecute({id:Mn.id,params:h});return i.sequenceExecute(U.redos,n),o.pushUndoRedo({unitID:d,undoMutations:[...(y=I.preUndos)!=null?y:[],{id:Ye.id,params:C},{id:q.id,params:S},...(b=I.undos)!=null?b:[],...U.undos],redoMutations:[...(T=I.preRedos)!=null?T:[],{id:Ke.id,params:h},{id:q.id,params:R},...I.redos,...U.redos]}),!0}return!0}};function fl(s,e){const t=s.getMaxColumns()-1,n=s.getHiddenRows(),o=[];return e.forEach(r=>{const a=n.filter(u=>u.startRow>=r.startRow&&u.endRow<=r.endRow);if(a.length){let u=r.startRow;a.forEach(l=>{l.startRow>u&&(o.push({startRow:u,endRow:l.startRow-1,startColumn:0,endColumn:t}),u=l.endRow+1)}),u<=r.endRow&&o.push({startRow:u,endRow:r.endRow,startColumn:0,endColumn:t})}else o.push(r)}),o}function Jr(s){return Il(s).map(t=>{const n=t.startRow===0?t.endRow+1:t.startRow-1;return{...t,startRow:n,endRow:n}})}function Il(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 vl=["ff","fs","tr","tb"],ee={type:i.CommandType.COMMAND,id:"sheet.command.set-style",handler:(s,e)=>{var k;const t=s.get(i.IUniverInstanceService),n=P(t,e);if(!n)return!1;const{unitId:o,subUnitId:r,worksheet:a}=n,{range:u,style:l}=e,d=s.get(i.ICommandService),c=s.get(i.IUndoRedoService),m=s.get(g.SheetsSelectionsService),h=u?[u]:(k=m.getCurrentSelections())==null?void 0:k.map(E=>E.range);if(!(h!=null&&h.length))return!1;const R=new i.ObjectMatrix,C=du(a);if(i.Tools.isArray(l.value))for(let E=0;E<h.length;E++)C.forOperableEach(h[E],(N,W,V)=>{R.setValue(N,W,{s:{[l.type]:l.value[N-V.startRow][W-V.startColumn]}})});else for(let E=0;E<h.length;E++){const N={s:{[l.type]:l.value}};C.forOperableEach(h[E],(W,V)=>R.setValue(W,V,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(vl.includes(e==null?void 0:e.style.type)){const{suitableRanges:E,remainingRanges:N}=Bt(h,I),W=Es(E,a),{undos:V,redos:$}=p.generateMutationsOfAutoHeight({unitId:o,subUnitId:r,ranges:E,autoHeightRanges:E,lazyAutoHeightRanges:N,cellHeights:W});w=V,y=$}const{undos:b,redos:T}=p.onCommandExecute({id:ee.id,params:e}),U=i.sequenceExecute([...T,...y],d);return M&&U.result?(c.pushUndoRedo({unitID:S.unitId,undoMutations:[{id:F.id,params:v},...b,...w],redoMutations:[{id:F.id,params:S},...T,...y]}),!0):!1}},pl={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,u={style:{type:"bl",value:n.getRange(o,r).getFontWeight()===i.FontWeight.BOLD?i.BooleanNumber.FALSE:i.BooleanNumber.TRUE}};return s.get(i.ICommandService).syncExecuteCommand(ee.id,u)}},wl={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:u}=e.primary;o=n.getRange(a,u).getFontStyle()===i.FontItalic.ITALIC}const r={style:{type:"it",value:o?i.BooleanNumber.FALSE:i.BooleanNumber.TRUE}};return s.get(i.ICommandService).syncExecuteCommand(ee.id,r)}},Ml={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(ee.id,r)}},yl={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(ee.id,r)}},_l={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(ee.id,r)}},bl={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(ee.id,n)}},El={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(ee.id,n)}},xr={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(ee.id,n)}},Xr={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(ee.id,t)}},Zr={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(ee.id,n)}},Qr={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(ee.id,t)}},ei={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(ee.id,n)}},ti={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(ee.id,n)}},ni={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(ee.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(ee.id,o)}},Tl=(s,e)=>{const r=s.get(i.IUniverInstanceService).getUniverSheetInstance(e.unitId).getSheetBySheetId(e.subUnitId).getConfig().tabColor;return{...i.Tools.deepClone(e),color:r}},jt={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}},oi={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,u={color:e.value,unitId:r,subUnitId:a},l=Tl(s,u);return t.syncExecuteCommand(jt.id,u)?(n.pushUndoRedo({unitID:r,undoMutations:[{id:jt.id,params:l}],redoMutations:[{id:jt.id,params:u}]}),!0):!1}},Fs={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}},js={type:i.CommandType.COMMAND,id:"sheet.command.set-workbook-name",handler:(s,e)=>{var l;const t=s.get(i.ICommandService),n=s.get(g.SheetInterceptorService);if(!Bn(s.get(i.IUniverInstanceService),e))return!1;const r=n.onCommandExecute({id:js.id,params:e}),a={name:e.name,unitId:e.unitId},u=[...(l=r.preRedos)!=null?l:[],{id:Fs.id,params:a},...r.redos];return i.sequenceExecute(u,t).result}},Ul=4,Gs={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(u=>{setTimeout(()=>{const l=n.syncExecuteCommand(Ct.id,{unitId:r,subUnitId:a},t);u(l)},Ul)})}},Gt={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:u,unitId:l,subUnitId:d}=a,{anchorCol:c,deltaX:m}=e,R=u.getColumnWidth(c)+m,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=u.getRowCount(),Y=new Array(u.getColumnCount()).fill(void 0).map((z,K)=>({startRow:0,endRow:L-1,startColumn:K,endColumn:K}));v={subUnitId:d,unitId:l,colWidth:R,ranges:Y}}else I===i.RANGE_TYPE.COLUMN?v={subUnitId:d,unitId:l,ranges:S.map(L=>i.Rectangle.clone(L.range)),colWidth:R}:v={subUnitId:d,unitId:l,colWidth:R,ranges:[{startRow:0,endRow:u.getMaxRows()-1,startColumn:c,endColumn:c}]};const M=s.get(g.SheetSkeletonService).getSkeleton(l,d),{suitableRanges:p,remainingRanges:w}=Bt(v.ranges,M);Es(p,u);const y=s.get(g.SheetInterceptorService),{undos:b,redos:T}=y.onCommandExecute({id:Gt.id,params:v}),U=jn(v,u),k=o.syncExecuteCommand(Ve.id,v),{undos:E,redos:N}=y.generateMutationsOfAutoHeight({unitId:l,subUnitId:d,ranges:p,autoHeightRanges:p,lazyAutoHeightRanges:w}),{undos:W,redos:V}=s.get(g.SheetInterceptorService).afterCommandExecute({id:Gt.id,params:v}),$=i.sequenceExecute([...T,...V,...N],o);return k&&$.result&&r.pushUndoRedo({unitID:l,undoMutations:[{id:Ve.id,params:U},...b,...W,...E],redoMutations:[{id:Ve.id,params:v},...T,...V,...N]}),!0}},zt={type:i.CommandType.COMMAND,id:"sheet.command.set-worksheet-col-width",handler:(s,e)=>{var y,b,T,U;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(k=>k.range);if(!(a!=null&&a.length))return!1;const u=P(s.get(i.IUniverInstanceService),e);if(!u)return!1;const{subUnitId:l,unitId:d,worksheet:c}=u,m=s.get(g.SheetSkeletonService).getSkeleton(d,l),h={subUnitId:l,unitId:d,ranges:a,colWidth:e.value},{suitableRanges:R,remainingRanges:C}=Bt(h.ranges,m);Es(R,c);const S=jn(h,c),I=n.syncExecuteCommand(Ve.id,h),{undos:v,redos:M}=r.generateMutationsOfAutoHeight({unitId:d,subUnitId:l,ranges:R,autoHeightRanges:R,lazyAutoHeightRanges:C}),p=r.onCommandExecute({id:zt.id,params:h}),w=i.sequenceExecute([...p.redos,...M],n);if(I&&w.result){const k=r.afterCommandExecute({id:zt.id,params:h});return i.sequenceExecute(k.redos,n),o.pushUndoRedo({unitID:d,undoMutations:[...(T=p.preUndos)!=null?T:[],{id:Ve.id,params:S},...p.undos,...k.undos,...v],redoMutations:[...(U=p.preRedos)!=null?U:[],{id:Ve.id,params:h},...p.redos,...k.redos,...M]}),!0}return!1}};i.CommandType.COMMAND;const ri={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),u=s.get(i.IUniverInstanceService);if(!P(u,e))return!1;const d={unitId:t,subUnitId:n,columnCount:o},c=fo(s,d);return r.syncExecuteCommand(mt.id,d)?(a.pushUndoRedo({unitID:t,undoMutations:[{id:mt.id,params:c}],redoMutations:[{id:mt.id,params:d}]}),!0):!1}},ii={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=Io(s,e);return t.syncExecuteCommand(ht.id,e)?(n.pushUndoRedo({unitID:o,undoMutations:[{id:ht.id,params:r}],redoMutations:[{id:ht.id,params:e}]}),!0):!1}},ai=(s,e)=>{const t=ve(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()}},je={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}},ui={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:u,worksheet:l,unitId:d,subUnitId:c}=a;if(l.getConfig().hidden===i.BooleanNumber.TRUE)return!1;const h={unitId:d,subUnitId:c,hidden:i.BooleanNumber.TRUE},R=ai(s,h);return u.getSheets().filter(v=>v.getConfig().hidden===i.BooleanNumber.FALSE).length===1?(o.emit(r.t("sheets.info.hideSheet")),!1):t.syncExecuteCommand(je.id,h)?(n.pushUndoRedo({unitID:d,undoMutations:[{id:je.id,params:R}],redoMutations:[{id:je.id,params:h}]}),!0):!1}},Pl=(s,e)=>{const t=ve(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()}},qt={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}},yn={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:u}=r,l={subUnitId:u,name:e.name,unitId:a},d=Pl(s,l),c=o.onCommandExecute({id:yn.id,params:e}),m=[...(C=c.preRedos)!=null?C:[],{id:qt.id,params:l},...c.redos],h=[...(S=c.preUndos)!=null?S:[],{id:qt.id,params:d},...c.undos];return i.sequenceExecute(m,t).result?(n.pushUndoRedo({unitID:a,undoMutations:h,redoMutations:m}),!0):!1}},kl=(s,e)=>({...i.Tools.deepClone(e),toOrder:e.fromOrder,fromOrder:e.toOrder}),Yt={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),!0}},zs={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:u}=o,d={fromOrder:r.getConfig().sheetOrder.indexOf(u),toOrder:e.order,unitId:a,subUnitId:u},c=kl(s,d);return t.syncExecuteCommand(Yt.id,d)?(n.pushUndoRedo({unitID:a,undoMutations:[{id:Yt.id,params:c}],redoMutations:[{id:Yt.id,params:d}]}),!0):!1}};class Ut{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 u=o.get(a);u&&e[n].push(u)}))}),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 qs{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 Ys{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 le=()=>[un,Se,Ys,qs],Ge=[_.Edit,_.View,_.ManageCollaborator,_.Delete],Nl=(s="unitId",e="subUnitId",t="permissionId")=>le().reduce((n,o)=>{const r=new o(s,e,t);return n[r.subType]=r.value,n},{}),Pt=()=>[me,ns,Jn,rs,xn,ts,dn,Zn,Qn,mn,ln,es,os,cn,jo,is,ss,Xn,Ko,Yo,zo,Go],li=[_.Edit,_.Print,_.Comment,_.View,_.Copy,_.Export,_.ManageCollaborator,_.CreateSheet,_.DeleteSheet,_.RenameSheet,_.HideSheet,_.Duplicate,_.Share,_.MoveSheet,_.CopySheet,_.RecoverHistory,_.ViewHistory,_.CreatePermissionObject,_.InsertRow,_.InsertColumn,_.DeleteRow,_.DeleteColumn],de=()=>[fe,Vt,Cs,ls],Ie=()=>[as,us,ds,cs,ms,hs,Rs,gs,Ss,fs,Wt,St,ft,Is],_n=[_.Copy,_.DeleteColumn,_.DeleteRow,_.EditExtraObject,_.Filter,_.InsertColumn,_.InsertRow,_.InsertHyperlink,_.PivotTable,_.SetCellStyle,_.SetCellValue,_.SetColumnStyle,_.SetRowStyle,_.Sort];var Ol=Object.getOwnPropertyDescriptor,Dl=(s,e,t,n)=>{for(var o=n>1?void 0:n?Ol(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},ze=(s,e)=>(t,n)=>e(t,n,s);const Al="SHEET_WORKSHEET_PROTECTION_PLUGIN",Wl="SHEET_WORKSHEET_PROTECTION_POINT_PLUGIN";g.WorksheetPermissionService=class extends i.RxDisposable{constructor(e,t,n,o,r,a,u,l){super(),this._permissionService=e,this._univerInstanceService=t,this._injector=n,this._worksheetProtectionRuleModel=o,this._worksheetProtectionPointRuleModel=r,this._resourceManagerService=a,this._rangeProtectionRuleModel=u,this._logService=l,this._init(),this._initRuleChange(),this._initRuleSnapshot(),this._initPointSnapshot()}_init(){const e=t=>{const n=t.getUnitId(),o=r=>{const a=r.getSheetId();[...de(),...Ie()].forEach(u=>{const l=new u(n,a);this._permissionService.addPermissionPoint(l)}),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(l=>{[...le()].forEach(d=>{const c=new d(n,a,l.permissionId);this._permissionService.deletePermissionPoint(c.id)})}),[...de(),...Ie()].forEach(l=>{const d=new l(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(kt.takeUntil(this.dispose$)).subscribe(e),this._univerInstanceService.getTypeOfUnitDisposed$(i.UniverInstanceType.UNIVER_SHEET).pipe(kt.takeUntil(this.dispose$)).subscribe(t=>{t.getSheets().forEach(n=>{const o=t.getUnitId(),r=n.getSheetId();de().forEach(a=>{const u=new a(o,r);this._permissionService.deletePermissionPoint(u.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:Al,businesses:[an.UNIVER_SHEET],onLoad:(n,o)=>{this._worksheetProtectionRuleModel.fromObject(o),Object.keys(o).forEach(r=>{de().forEach(a=>{const u=new a(n,r);u.value=!1,this._permissionService.addPermissionPoint(u)})}),this._worksheetProtectionRuleModel.changeRuleInitState(!0)},onUnLoad:n=>{const o=this._univerInstanceService.getUnit(n);o&&(o.getSheets().forEach(r=>{const a=r.getSheetId();[...de(),...Ie()].forEach(u=>{const l=new u(n,a);this._permissionService.deletePermissionPoint(l.id)})}),Pt().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:Wl,businesses:[an.UNIVER_SHEET],onLoad:(n,o)=>{this._worksheetProtectionPointRuleModel.fromObject(o),Object.keys(o).forEach(r=>{Ie().forEach(a=>{const u=new a(n,r);this._permissionService.addPermissionPoint(u)})})},onUnLoad:n=>{this._worksheetProtectionPointRuleModel.deleteUnitModel(n)}}))}},g.WorksheetPermissionService=Dl([ze(0,i.Inject(i.IPermissionService)),ze(1,i.Inject(i.IUniverInstanceService)),ze(2,i.Inject(i.Injector)),ze(3,i.Inject(ke)),ze(4,i.Inject(Ut)),ze(5,i.Inject(i.IResourceManagerService)),ze(6,i.Inject(X)),ze(7,i.Inject(i.ILogService))],g.WorksheetPermissionService);const bn={id:"sheet.mutation.set-worksheet-permission-points",type:i.CommandType.MUTATION,handler:(s,e)=>{const{rule:t}=e;return s.get(Ut).addRule(t),!0}},di={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(bn.id,{rule:n,unitId:n.unitId,subUnitId:n.subUnitId}),!0}},ci={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:u,subUnitId:l}=o,d={...o,permissionId:r};if(await t.executeCommand(st.id,{unitId:u,subUnitId:l,newRule:d})){const m=[{id:st.id,params:{unitId:u,subUnitId:l,newRule:d}}],h=[{id:st.id,params:{unitId:u,subUnitId:l,rule:a}}];n.pushUndoRedo({unitID:u,redoMutations:m,undoMutations:h})}return!0}},Vl=(s,e)=>{const r=s.get(i.IUniverInstanceService).getUniverSheetInstance(e.unitId).getSheetBySheetId(e.subUnitId).getConfig().rightToLeft;return{...i.Tools.deepClone(e),rightToLeft:r}},En={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}},$l={type:i.CommandType.COMMAND,id:"sheet.command.set-worksheet-right-to-left",handler:async(s,e)=>{var m;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 u=i.BooleanNumber.FALSE;e&&(u=(m=e.rightToLeft)!=null?m:i.BooleanNumber.FALSE);const l={rightToLeft:u,unitId:r,subUnitId:a},d=Vl(s,l);return t.syncExecuteCommand(En.id,l)?(n.pushUndoRedo({unitID:r,undoMutations:[{id:En.id,params:d}],redoMutations:[{id:En.id,params:l}]}),!0):!1}},mi={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),u=s.get(i.IUniverInstanceService);if(!P(u,e))return!1;const d={unitId:t,subUnitId:n,rowCount:o},c=vo(s,d);return r.syncExecuteCommand(gt.id,d)?(a.pushUndoRedo({unitID:t,undoMutations:[{id:gt.id,params:c}],redoMutations:[{id:gt.id,params:d}]}),!0):!1}},Kt={type:i.CommandType.COMMAND,id:"sheet.command.delta-row-height",handler:async(s,e)=>{var k,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:u,unitId:l}=r,{anchorRow:d,deltaY:c}=e,h=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:W,endRow:V}=N;return W<=d&&d<=V})?i.RANGE_TYPE.ROW:i.RANGE_TYPE.NORMAL;let I;if(S===i.RANGE_TYPE.ALL){const N=a.getColumnCount(),W=new Array(a.getRowCount()).fill(void 0).map((V,$)=>({startRow:$,endRow:$,startColumn:0,endColumn:N-1}));I={subUnitId:u,unitId:l,rowHeight:h,ranges:W}}else S===i.RANGE_TYPE.ROW?I={subUnitId:u,unitId:l,ranges:C.map(N=>i.Rectangle.clone(N.range)),rowHeight:h}:I={subUnitId:u,unitId:l,rowHeight:h,ranges:[{startRow:d,endRow:d,startColumn:0,endColumn:a.getMaxColumns()-1}]};const v=po(I,a),M={unitId:l,subUnitId:u,ranges:I.ranges,autoHeightInfo:i.BooleanNumber.FALSE},p=Gn(M,a),w=s.get(i.ICommandService),y=s.get(i.IUndoRedoService),b=o.onCommandExecute({id:Kt.id,params:I}),T=i.sequenceExecute([{id:Ee.id,params:I},{id:Re.id,params:M}],w),U=i.sequenceExecute([...b.redos],w);if(T.result&&U.result){const N=o.afterCommandExecute({id:Kt.id,params:I});return i.sequenceExecute(N.redos,w),y.pushUndoRedo({unitID:l,undoMutations:[...(k=b.preUndos)!=null?k:[],{id:Ee.id,params:v},{id:Re.id,params:p},...b.undos,...N.undos],redoMutations:[...(E=b.preRedos)!=null?E:[],{id:Ee.id,params:I},{id:Re.id,params:M},...b.redos,...N.redos]}),!0}return!1}},Jt={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),u=(p=e==null?void 0:e.ranges)!=null&&p.length?e.ranges:(w=t.getCurrentSelections())==null?void 0:w.map(T=>T.range);if(!(u!=null&&u.length))return!1;const l=P(r,e);if(!l)return!1;const{unitId:d,subUnitId:c,worksheet:m}=l,h={subUnitId:c,unitId:d,ranges:u,rowHeight:e.value},R=po(h,m),C={unitId:d,subUnitId:c,ranges:h.ranges,autoHeightInfo:i.BooleanNumber.FALSE},S=Gn(C,m),I=i.sequenceExecute([{id:Ee.id,params:h},{id:Re.id,params:C}],n),v=a.onCommandExecute({id:Jt.id,params:h}),M=i.sequenceExecute([...v.redos],n);if(I.result&&M.result){const T=a.afterCommandExecute({id:Jt.id,params:h});return i.sequenceExecute(T.redos,n),o.pushUndoRedo({unitID:d,undoMutations:[...(y=v.preRedos)!=null?y:[],{id:Ee.id,params:R},{id:Re.id,params:S},...v.undos,...T.undos],redoMutations:[...(b=v.preRedos)!=null?b:[],{id:Ee.id,params:h},{id:Re.id,params:C},...v.redos,...T.redos]}),!0}return!1}},Tn={type:i.CommandType.COMMAND,id:"sheet.command.set-row-is-auto-height",handler:(s,e)=>{var T,U;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:u,subUnitId:l,worksheet:d}=a,c=(T=e==null?void 0:e.ranges)!=null&&T.length?e.ranges:(U=o.getCurrentSelections())==null?void 0:U.map(k=>k.range);if(!(c!=null&&c.length))return!1;const m={unitId:u,subUnitId:l,ranges:c,autoHeightInfo:i.BooleanNumber.TRUE},h=Gn(m,d),R=t.syncExecuteCommand(Re.id,m),C=s.get(g.SheetSkeletonService).getSkeleton(u,l),{suitableRanges:S,remainingRanges:I}=Bt(m.ranges,C),v=s.get(g.SheetInterceptorService),{undos:M,redos:p}=v.generateMutationsOfAutoHeight({unitId:u,subUnitId:l,ranges:S,autoHeightRanges:S,lazyAutoHeightRanges:I}),{undos:w,redos:y}=v.onCommandExecute({id:Tn.id,params:m}),b=i.sequenceExecute([...y,...p],t);return R&&b.result?(n.pushUndoRedo({unitID:u,undoMutations:[{id:Re.id,params:h},...w,...M],redoMutations:[{id:Re.id,params:m},...y,...p]}),!0):!1}},Ks={type:i.CommandType.COMMAND,id:"sheet.command.set-worksheet-show",handler:(s,e)=>{const{unitId:t,subUnitId:n}=e,o=s.get(i.ICommandService),r=s.get(i.IUndoRedoService),a=s.get(i.IUniverInstanceService);if(!P(s.get(i.IUniverInstanceService)))return!1;const l=a.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET);if(!l)return!1;const d=l.getSheetBySheetId(n);if(!d||d.getConfig().hidden===i.BooleanNumber.FALSE)return!1;const m={unitId:t,subUnitId:n,hidden:i.BooleanNumber.FALSE},h=ai(s,m),R=o.syncExecuteCommand(je.id,m),C={unitId:t,subUnitId:n},S=o.syncExecuteCommand(Ct.id,C);return R&&S?(r.pushUndoRedo({unitID:t,undoMutations:[{id:je.id,params:h}],redoMutations:[{id:je.id,params:m}]}),!0):!1}},hi={type:i.CommandType.COMMAND,id:"sheet.command.split-text-to-columns",handler:(s,e)=>{const{unitId:t,subUnitId:n,range:o,delimiter:r,customDelimiter:a,treatMultipleDelimitersAsOne:u}=e,l=s.get(i.ICommandService),d=s.get(i.IUniverInstanceService),c=s.get(i.IUndoRedoService);if(!P(s.get(i.IUniverInstanceService)))return!1;const h=d.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET);if(!h)return!1;const R=h.getSheetBySheetId(n);if(!R)return!1;const{lastRow:C,rs:S,maxLength:I}=Po(R,o,r,a,u),v=R.getColumnCount(),{startColumn:M}=i.Range.transformRange(o,R);if(o.startColumn!==o.endColumn)return!1;const p=[],w=[],y=M+I+1-v;if(y>0){const N={unitId:t,subUnitId:n,range:{startRow:0,endRow:R.getRowCount()-1,startColumn:v-1,endColumn:v-1+y}};p.push({id:ie.id,params:N});const W=Nt(s,N);w.push({id:ne.id,params:W})}const b={startRow:o.startRow,endRow:C,startColumn:M,endColumn:M+I},T=new i.ObjectMatrix;for(let N=b.startRow;N<=b.endRow;N++)for(let W=b.startColumn;W<=b.endColumn;W++){const V=S[N-b.startRow];W===0&&(V==null?void 0:V.length)===1?T.setValue(N,W,R.getCell(N,W)):T.setValue(N,W,{v:(V==null?void 0:V[W-b.startColumn])||null,p:null,f:null,si:null,custom:null})}const U={unitId:t,subUnitId:n,cellValue:T.clone()},k=ce(s,U);return p.push({id:F.id,params:U}),w.unshift({id:F.id,params:k}),i.sequenceExecute(p,l).result?(c.pushUndoRedo({unitID:t,undoMutations:w,redoMutations:p}),!0):!1}},gi={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,l=s.get(i.IUniverInstanceService).getUnit(t,i.UniverInstanceType.UNIVER_SHEET),d=l==null?void 0:l.getSheetBySheetId(n),c=s.get(i.IUndoRedoService),m=s.get(i.ICommandService);if(!d)return!1;const h=d.getCell(o,r);if(!(h!=null&&h.p))return!1;const R=i.Tools.deepClone(h.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}),m.syncExecuteCommand(v.id,v.params)}},Ri={type:i.CommandType.COMMAND,id:"sheet.command.toggle-gridlines",handler:(s,e)=>{const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),o=s.get(i.IUniverInstanceService),r=P(o);if(!r)return!1;const{worksheet:a}=r,u=a.getConfig().showGridlines;if(u===(e==null?void 0:e.showGridlines))return!1;const{unitId:l,subUnitId:d}=r,c={showGridlines:u===i.BooleanNumber.TRUE?i.BooleanNumber.FALSE:i.BooleanNumber.TRUE,unitId:l,subUnitId:d},m={showGridlines:u,unitId:l,subUnitId:d};return t.syncExecuteCommand(Rt.id,c)?(n.pushUndoRedo({unitID:l,undoMutations:[{id:Rt.id,params:m}],redoMutations:[{id:Rt.id,params:c}]}),!0):!1}},Ci={id:"sheet.command.unregister-worksheet-range-theme-style",type:i.CommandType.COMMAND,handler:(s,e)=>{var h;if(!e)return!1;const{unitId:t,themeName:n}=e,o=s.get(i.IUniverInstanceService),r=s.get(i.ICommandService),a=s.get(i.IUndoRedoService),u=s.get(g.SheetRangeThemeModel);if(!P(o))return!1;const d={unitId:t,themeName:n},c={unitId:t,themeName:n,rangeThemeStyleJson:(h=u.getRangeThemeStyle(t,n))==null?void 0:h.toJson()};return r.syncExecuteCommand(_t.id,e)&&a.pushUndoRedo({unitID:t,undoMutations:[{id:_t.id,params:c}],redoMutations:[{id:In.id,params:d}]}),!0}},Si={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 We(t.name);return r.fromJson(t),o.registerRangeThemeStyle(n,r),!0}},fi={id:"sheet.mutation.empty",type:i.CommandType.MUTATION,handler:()=>!0},Ii={id:"sheet.operation.mark-dirty-row-auto-height",type:i.CommandType.OPERATION,handler:()=>!0},vi={id:"sheet.operation.cancel-mark-dirty-row-auto-height",type:i.CommandType.OPERATION,handler:()=>!0},ot=i.createIdentifier("INumfmtService"),Ll=(s,e)=>{const t=s.get(ot),{values:n,unitId:o,subUnitId:r}=e,a=[],u=[];Object.keys(n).forEach(d=>{n[d].ranges.forEach(m=>{i.Range.foreach(m,(h,R)=>{const C=t.getValue(o,r,h,R);C?a.push({pattern:C.pattern,row:h,col:R}):u.push({startColumn:R,endColumn:R,startRow:h,endRow:h})})})});const l=[];if(a.length){const d=Pn(o,r,a);Object.keys(d.values).forEach(c=>{const m=d.values[c];m.ranges=Yn(m.ranges)}),l.push({id:Un.id,params:Pn(o,r,a)})}return u.length&&l.push({id:Js.id,params:{unitId:o,subUnitId:r,ranges:u}}),l},Un={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(ot),r=e.unitId,a=e.subUnitId,u=Object.keys(t).reduce((l,d)=>{const c=n[d],m=t[d].ranges;return c&&l.push({...c,ranges:m}),l},[]);return o.setValues(r,a,u),!0}},Js={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(ot).deleteValues(t,n,o),!0}},Bl=(s,e)=>{const t=s.get(ot),{ranges:n,unitId:o,subUnitId:r}=e,a=[];if(n.forEach(l=>{i.Range.foreach(l,(d,c)=>{const m=t.getValue(o,r,d,c);m&&a.push({pattern:m.pattern,row:d,col:c})})}),!a.length)return[];const u=Pn(o,r,a);return Object.keys(u.values).forEach(l=>{const d=u.values[l];d.ranges=Yn(d.ranges)}),[{id:Un.id,params:u}]},Pn=(s,e,t)=>{const n=Ja(t,"pattern"),o={},r={},a=xa();return Object.keys(n).forEach(u=>{const l=n[u],d=a();o[d]={pattern:u},l.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}},pi={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}},Mi={id:"sheet.operation.scroll-to-cell",type:i.CommandType.OPERATION,handler:()=>!0},Hl=(s,e,t)=>{const o=s.get(g.SheetsSelectionsService).getCurrentSelections(),{value:r,selections:a,unitId:u,subUnitId:l}=e;if(o){const c=o[(o==null?void 0:o.length)-1].primary;if(c){const{actualColumn:m,actualRow:h}=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===m&&y.endColumn===m&&h===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===h&&y.endRow===h&&m===y.startColumn);w&&(S=w.endRow,C=w.startColumn,I=w.endColumn)}const v={startRow:R,startColumn:C,endRow:S,endColumn:I,actualRow:h,actualColumn:m,isMerged:!0,isMergedMainCell:R===h&&C===m},M=o.map((w,y,b)=>({range:w.range,style:null,primary:y===b.length-1?v:null})),p={unitId:u,subUnitId:l,type:te.ONLY_SET,selections:M};return{id:q.id,params:p}}return null}return null},Fl=(s,e)=>{const n=s.get(g.SheetsSelectionsService).getCurrentSelections(),{unitId:o,subUnitId:r}=e;if(n&&n[(n==null?void 0:n.length)-1].primary){const l={unitId:o,subUnitId:r,type:te.ONLY_SET,selections:[...n]};return{id:q.id,params:l}}return null},yi="maxCellsPerSheet",jl=3e6;var Gl=Object.getOwnPropertyDescriptor,zl=(s,e,t,n)=>{for(var o=n>1?void 0:n?Gl(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 ql="SHEET_DEFINED_NAME_PLUGIN",Yl="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:ql,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=zl([_i(0,J.IDefinedNamesService),_i(1,i.IResourceManagerService)],g.DefinedNameDataController);const bi="sheets.config",Ei={};var Kl=Object.getOwnPropertyDescriptor,Jl=(s,e,t,n)=>{for(var o=n>1?void 0:n?Kl(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},xs=(s,e)=>(t,n)=>e(t,n,s);const xl=[Ne.id],Xl=[re.id,ie.id,ae.id,ne.id,pe.id,we.id];g.SheetsFreezeSyncController=class extends i.Disposable{constructor(t,n,o){var a,u;super();f(this,"_d",new i.DisposableCollection);f(this,"_enabled",!0);this._univerInstanceService=t,this._commandService=n,this._configService=o;const r=(u=(a=this._configService.getConfig(bi))==null?void 0:a.freezeSync)!=null?u:!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)=>{xl.includes(t.id)&&(n||(n={}),n.onlyLocal=!0)})),this._d.add(this._commandService.onCommandExecuted((t,n)=>{if(Xl.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===pe.id?this._handleMoveRowsMutation(r,n):o===we.id&&this._handleMoveColsMutation(r,n)}}))}_handleInsertRowMutation(t,n){const{range:o,unitId:r,subUnitId:a}=t,u=this._getFreeze(r,a);if(u&&o.startRow<u.startRow){const l=o.endRow-o.startRow+1,d={...u,startRow:Math.max(1,u.startRow+l),ySplit:Math.max(1,u.ySplit+l)};this._sequenceExecute(r,a,d,n)}}_handleInsertColMutation(t,n){const{range:o,unitId:r,subUnitId:a}=t,u=this._getFreeze(r,a);if(u&&o.startColumn<u.startColumn){const l=o.endColumn-o.startColumn+1,d={...u,startColumn:Math.max(1,u.startColumn+l),xSplit:Math.max(1,u.xSplit+l)};this._sequenceExecute(r,a,d,n)}}_handleRemoveRowMutation(t,n){const{range:o,unitId:r,subUnitId:a}=t,u=this._getFreeze(r,a);if(u&&o.startRow<u.startRow){const l=Math.min(u.startRow,o.endRow+1)-o.startRow,d={...u,startRow:Math.max(1,u.startRow-l),ySplit:Math.max(1,u.ySplit-l)};this._sequenceExecute(r,a,d,n)}}_handleRemoveColMutation(t,n){const{range:o,unitId:r,subUnitId:a}=t,u=this._getFreeze(r,a);if(u&&o.startColumn<u.startColumn){const l=Math.min(u.startColumn,o.endColumn+1)-o.startColumn,d={...u,startColumn:Math.max(1,u.startColumn-l),xSplit:Math.max(1,u.xSplit-l)};this._sequenceExecute(r,a,d,n)}}_handleMoveRowsMutation(t,n){const{sourceRange:o,targetRange:r,unitId:a,subUnitId:u}=t,l=this._getFreeze(a,u);if(!l||l.startRow<=0||o.startRow>=l.startRow&&r.startRow>=l.startRow||o.endRow<l.startRow&&r.endRow<l.startRow)return;const d=o.endRow-o.startRow+1,c=Math.max(Math.min(l.startRow,o.endRow+1)-o.startRow,0),m={...l};r.startRow>=l.startRow?(m.startRow=Math.max(1,l.startRow-c),m.ySplit=Math.max(1,l.ySplit-c)):(m.startRow=l.startRow+d-c,m.ySplit=l.ySplit+d-c),this._sequenceExecute(a,u,m,n)}_handleMoveColsMutation(t,n){const{sourceRange:o,targetRange:r,unitId:a,subUnitId:u}=t,l=this._getFreeze(a,u);if(!l||l.startColumn<=0||o.startColumn>=l.startColumn&&r.startColumn>=l.startColumn||o.endColumn<l.startColumn&&r.endColumn<l.startColumn)return;const d=o.endColumn-o.startColumn+1,c=Math.max(Math.min(l.startColumn,o.endColumn+1)-o.startColumn,0),m={...l};r.startColumn>=l.startColumn?(m.startColumn=Math.max(1,l.startColumn-c),m.xSplit=Math.max(1,l.xSplit-c)):(m.startColumn=l.startColumn+d-c,m.xSplit=l.xSplit+d-c),this._sequenceExecute(a,u,m,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:Ne.id,params:{...o,unitId:t,subUnitId:n,resetScroll:!1}}],this._commandService,r)}},g.SheetsFreezeSyncController=Jl([xs(0,i.Inject(i.IUniverInstanceService)),xs(1,i.ICommandService),xs(2,i.IConfigService)],g.SheetsFreezeSyncController);var Zl=Object.getOwnPropertyDescriptor,Ql=(s,e,t,n)=>{for(var o=n>1?void 0:n?Zl(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},Oe=(s,e)=>(t,n)=>e(t,n,s);g.SheetPermissionCheckController=class extends i.Disposable{constructor(t,n,o,r,a,u,l,d,c,m){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=u,this._localeService=l,this._lexerTreeBuilder=d,this._contextService=c,this._definedNamesService=m,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 It.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:[Se],worksheetTypes:[Wt,fe]},n);break;case fn.id:o=this.permissionCheckWithRanges({workbookTypes:[me],rangeTypes:[Se],worksheetTypes:[Wt,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 Gt.id:case zt.id:o=this.permissionCheckWithoutRange({worksheetTypes:[St]}),r=this._localeService.t("permission.dialog.setRowColStyleErr");break;case Kt.id:case Jt.id:case Tn.id:o=this.permissionCheckWithoutRange({worksheetTypes:[ft]}),r=this._localeService.t("permission.dialog.setRowColStyleErr");break;case wt.id:case pt.id:o=this._permissionCheckByMoveCommand(n),r=this._localeService.t("permission.dialog.moveRowColErr");break;case Je.id:o=this._permissionCheckByMoveRangeCommand(n),r=this._localeService.t("permission.dialog.moveRangeErr");break;case zs.id:o=this._permissionCheckByWorksheetCommand([me,cn]),r=this._localeService.t("permission.dialog.operatorSheetErr"),o===!1&&this._worksheetProtectionRuleModel.resetOrder();break;case yn.id:o=this._permissionCheckByWorksheetCommand([me,mn]),r=this._localeService.t("permission.dialog.operatorSheetErr"),o===!1&&this._worksheetProtectionRuleModel.resetOrder();break;case Ks.id:{const{unitId:a,subUnitId:u}=n;o=this._permissionCheckByWorksheetCommand([me,ln],a,u),r=this._localeService.t("permission.dialog.operatorSheetErr"),o===!1&&this._worksheetProtectionRuleModel.resetOrder()}break;case Et.id:o=this.permissionCheckWithRanges({workbookTypes:[me],rangeTypes:[Se],worksheetTypes:[fe,St]},n.ranges,n.unitId,n.subUnitId),r=this._localeService.t("permission.dialog.setRowColStyleErr");break;case Tt.id:o=this.permissionCheckWithRanges({workbookTypes:[me],rangeTypes:[Se],worksheetTypes:[fe,ft]},n.ranges,n.unitId,n.subUnitId),r=this._localeService.t("permission.dialog.setRowColStyleErr");break;case $s.id:o=this.permissionCheckWithRanges({workbookTypes:[me],rangeTypes:[Se],worksheetTypes:[fe,St]}),r=this._localeService.t("permission.dialog.setRowColStyleErr");break;case Hs.id:o=this.permissionCheckWithRanges({workbookTypes:[me],rangeTypes:[Se],worksheetTypes:[fe,ft]}),r=this._localeService.t("permission.dialog.setRowColStyleErr");break;case vt.id:o=this._permissionCheckWithInsertRangeMove("right"),r=this._localeService.t("permission.dialog.insertOrDeleteMoveRangeErr");break;case xe.id:o=this._permissionCheckWithInsertRangeMove("bottom"),r=this._localeService.t("permission.dialog.insertOrDeleteMoveRangeErr");break;case Be.id:o=this._permissionCheckWithInsertRangeMove("left"),r=this._localeService.t("permission.dialog.insertOrDeleteMoveRangeErr");break;case He.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===qt.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 u=this._worksheetProtectionRuleModel.getRule(r,a),l=this._rangeProtectionRuleModel.getSubunitRuleList(r,a);u&&this._worksheetProtectionRuleModel.ruleRefresh(u.permissionId),l.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,u=i.Tools.deepClone((c=this._selectionManagerService.getCurrentLastSelection())==null?void 0:c.range);return!(!u||(t==="top"||t==="bottom"?u.endRow=o.getRowCount()-1:(t==="left"||t==="right")&&(u.endColumn=o.getColumnCount()-1),this._rangeProtectionRuleModel.getSubunitRuleList(r,a).map(m=>m.ranges).flat().some(m=>i.Rectangle.getIntersects(u,m))))}_permissionCheckByWorksheetCommand(t,n,o){var c,m;const r=P(this._univerInstanceService,{unitId:n,subUnitId:o});if(!r)return!1;const{unitId:a,subUnitId:u}=r,l=this._worksheetProtectionRuleModel.getRule(a,u),d=this._rangeProtectionRuleModel.getSubunitRuleList(a,u).length>0;return l||d?(m=(c=this._permissionService.getPermissionPoint(new dn(a).id))==null?void 0:c.value)!=null?m:!1:this._permissionService.composePermission(t.map(h=>new h(a).id)).every(h=>h.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,u=this._selectionManagerService.getCurrentLastSelection();if(!u)return!0;const l=(C=(R=u==null?void 0:u.primary)==null?void 0:R.actualRow)!=null?C:0,d=(I=(S=u==null?void 0:u.primary)==null?void 0:S.actualColumn)!=null?I:0,{workbookTypes:c,worksheetTypes:m,rangeTypes:h}=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||m&&m.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||h&&h.some(M=>{var T,U,k,E,N;const p=(U=(T=o.getCell(l,d))==null?void 0:T.selectionProtection)==null?void 0:U[0];if(!(p!=null&&p.ruleId))return!1;const w=(k=this._rangeProtectionRuleModel.getRule(r,a,p.ruleId))==null?void 0:k.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);if(!a)return!1;const{workbook:u,worksheet:l}=a;o||(o=u.getUnitId()),r||(r=l.getSheetId());const d=n!=null?n:(C=this._selectionManagerService.getCurrentSelections())==null?void 0:C.map(S=>S.range);if(!d)return!1;const{workbookTypes:c,worksheetTypes:m,rangeTypes:h}=t,R=[];return c&&R.push(...c.map(S=>new S(o).id)),m&&R.push(...m.map(S=>new S(o,r).id)),h&&this._rangeProtectionRuleModel.getSubunitRuleList(o,r).forEach(S=>{d.some(v=>S.ranges.some(M=>i.Rectangle.intersects(M,v)))&&R.push(...h.map(v=>new v(o,r,S.permissionId).id))}),R.length?this._permissionService.composePermission(R).every(S=>S.value):!0}_permissionCheckByMoveCommand(t){const n=P(this._univerInstanceService);if(!n)return!1;const{worksheet:o,unitId:r,subUnitId:a}=n,u=t.toRange;u.endRow===o.getRowCount()-1?u.endColumn=u.startColumn:u.endRow=u.startRow;const l=this._rangeProtectionRuleModel.getSubunitRuleList(r,a).reduce((d,c)=>[...d,...c.ranges],[]).filter(d=>i.Rectangle.intersects(d,u));return l.length>0?!1:(l.forEach(d=>{var c,m;for(let h=d.startRow;h<=d.endRow;h++)for(let R=d.startColumn;R<=d.endColumn;R++){const C=(m=(c=o.getCell(h,R))==null?void 0:c.selectionProtection)==null?void 0:m[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,u=t.toRange,l=this._rangeProtectionRuleModel.getSubunitRuleList(r,a).reduce((d,c)=>[...d,...c.ranges],[]).filter(d=>i.Rectangle.intersects(d,u));return l.length>0?!1:(l.forEach(d=>{var c,m;for(let h=d.startRow;h<=d.endRow;h++)for(let R=d.startColumn;R<=d.endColumn;R++){const C=(m=(c=o.getCell(h,R))==null?void 0:c.selectionProtection)==null?void 0:m[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,u,l,d,c;const n=t.value,o=t.range,r=n.f;if(r){const m=r.substring(1),h=this._univerInstanceService.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET),R=(a=t.unitId)!=null?a:h.getUnitId(),C=this._definedNamesService.getValueByName(R,m);if(C){let S=C.formulaOrRefString;S.startsWith(J.operatorToken.EQUALS)&&(S=S.slice(1));const I=S.split(",");for(let v=0;v<I.length;v++){const M=I[v],p=J.deserializeRangeWithSheet(M);if(p.sheetName){const w=h.getSheetBySheetName(p.sheetName);if(!w)return!0;const{startRow:y,endRow:b,startColumn:T,endColumn:U}=p.range;for(let k=y;k<=b;k++)for(let E=T;E<=U;E++){const N=(l=(u=w.getCell(k,E))==null?void 0:u.selectionProtection)==null?void 0:l[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!==J.sequenceNodeType.REFERENCE)continue;const{token:M}=v,p=J.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 Vt(b,N).id))return!1}if(!y)return!0;const{startRow:T,endRow:U,startColumn:k,endColumn:E}=p.range;for(let N=T;N<=U;N++)for(let W=k;W<=E;W++){const V=(c=(d=y.getCell(N,W))==null?void 0:d.selectionProtection)==null?void 0:c[0];if((V==null?void 0:V[_.View])===!1)return!1}}return!0}}if(o){const m=P(this._univerInstanceService);if(!m)return!1;const h=t.unitId||m.unitId,R=t.subUnitId||m.subUnitId,S=this._rangeProtectionRuleModel.getSubunitRuleList(h,R).filter(v=>v.ranges.some(M=>i.Rectangle.intersects(M,o))).map(v=>new Se(h,R,v.permissionId).id);if(!this._permissionService.composePermission(S).every(v=>v.value))return!1}return!0}},g.SheetPermissionCheckController=Ql([Oe(0,i.ICommandService),Oe(1,i.IUniverInstanceService),Oe(2,i.IPermissionService),Oe(3,i.Inject(g.SheetsSelectionsService)),Oe(4,i.Inject(X)),Oe(5,i.Inject(ke)),Oe(6,i.Inject(i.LocaleService)),Oe(7,i.Inject(J.LexerTreeBuilder)),Oe(8,i.IContextService),Oe(9,J.IDefinedNamesService)],g.SheetPermissionCheckController);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},xt=(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();Pt().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(l=>{[...le()].forEach(d=>{const c=new d(o,a,l.permissionId);this._permissionService.deletePermissionPoint(c.id)})}),[...de(),...Ie()].forEach(l=>{const d=new l(o,a);this._permissionService.deletePermissionPoint(d.id)})}),Pt().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=td([xt(0,i.Inject(i.IPermissionService)),xt(1,i.Inject(i.IUniverInstanceService)),xt(2,i.Inject(X)),xt(3,i.Inject(ke)),xt(4,i.Inject(Ut))],g.WorkbookPermissionService);var nd=Object.getOwnPropertyDescriptor,sd=(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},De=(s,e)=>(t,n)=>e(t,n,s);g.SheetPermissionInitController=class extends i.Disposable{constructor(e,t,n,o,r,a,u,l,d,c){super(),this._univerInstanceService=e,this._permissionService=t,this._authzIoService=n,this._rangeProtectionRuleModel=o,this._worksheetProtectionRuleModel=r,this._userManagerService=a,this._worksheetProtectionPointRuleModel=u,this._workbookPermissionService=l,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(u=>{const l=u.getSheetId();this._rangeProtectionRuleModel.getSubunitRuleList(o,l).forEach(d=>{a.set(d.permissionId,d),n.push({objectID:d.permissionId,unitID:o,objectType:D.SelectRange,actions:Ge})})}),!n.length){this._rangeProtectionRuleModel.changeRuleInitState(!0);return}this._authzIoService.batchAllowed(n).then(u=>{u.forEach(l=>{const d=a.get(l.objectID);if(d){if(!this._rangeProtectionRuleModel.getRule(o,d.subUnitId,d.id))return;le().forEach(m=>{const h=new m(o,d.subUnitId,l.objectID),R=h.subType,C=l.actions.find(S=>S.action===R);(C==null?void 0:C.allowed)!==void 0&&this._permissionService.updatePermissionPoint(h.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:Ge}).then(t=>{this._rangeProtectionRuleModel.getRule(e.unitId,e.subUnitId,e.rule.id)&&(le().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),u=a.subType,l=t.find(d=>d.action===u);l&&this._permissionService.updatePermissionPoint(a.id,l.allowed)}),this._rangeProtectionRuleModel.ruleRefresh(e.rule.permissionId))}):this._rangeProtectionRuleModel.getSubunitRuleList(e.unitId,e.subUnitId).length===0&&(this._worksheetProtectionPointRuleModel.deleteRule(e.unitId,e.subUnitId),[...Ie()].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:li}).then(o=>{Pt().forEach(r=>{const a=new r(t),u=a.subType,l=o.find(d=>d.action===u);l&&this._permissionService.updatePermissionPoint(a.id,l.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:Ge}).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,u=t.find(l=>l.action===a);u&&this._permissionService.updatePermissionPoint(r.id,u.allowed)}),this._worksheetProtectionRuleModel.ruleRefresh(e.rule.permissionId))}):([...de(),...Ie()].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:_n}).then(t=>{const n=this._worksheetProtectionPointRuleModel.getRule(e.unitId,e.subUnitId);!n||n.permissionId!==e.permissionId||Ie().forEach(o=>{const r=new o(e.unitId,e.subUnitId),a=r.subType,u=t.find(l=>l.action===a);u&&this._permissionService.updatePermissionPoint(r.id,u.allowed)})})}))}async _initWorksheetPermissionFromSnapshot(){const e=async t=>{const n=[],o=t.getUnitId(),r=t.getSheets(),a=new Map;if(r.forEach(u=>{const l=u.getSheetId(),d=this._worksheetProtectionRuleModel.getRule(o,l);d&&(a.set(d.permissionId,d),n.push({objectID:d.permissionId,unitID:o,objectType:D.Worksheet,actions:Ge}));const c=this._worksheetProtectionPointRuleModel.getRule(o,l);c&&(a.set(c.permissionId,c),n.push({objectID:c.permissionId,unitID:o,objectType:D.Worksheet,actions:_n}))}),!n.length){this._worksheetProtectionRuleModel.changeRuleInitState(!0);return}this._authzIoService.batchAllowed(n).then(u=>{u.forEach(l=>{const d=a.get(l.objectID);if(d){const c=this._worksheetProtectionRuleModel.getRule(o,d.subUnitId)||this._worksheetProtectionPointRuleModel.getRule(o,d.subUnitId);if(!c||c.permissionId!==l.objectID)return;[...de(),...Ie()].forEach(m=>{const h=new m(o,d.subUnitId),R=h.subType,C=l.actions.find(S=>S.action===R);(C==null?void 0:C.allowed)!==void 0&&this._permissionService.updatePermissionPoint(h.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();Pt().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(),...Ie()].forEach(l=>{let d=new l(o,a);e.has(d.id)&&(d=e.get(d.id)),this._permissionService.addPermissionPoint(d)}),this._rangeProtectionRuleModel.getSubunitRuleList(o,a).forEach(l=>{le().forEach(d=>{let c=new d(o,a,l.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[u,l]=n;this._authzIoService.allowed({objectID:t,unitID:e,objectType:D.Worksheet,actions:Ge}).then(d=>{if(!this._worksheetProtectionRuleModel.getTargetByPermissionId(e,t))return;let m="";de().forEach(h=>{var I;const R=new h(e,l),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),m+=`${S.action}_${S.allowed}`)}),this._worksheetProtectionRuleModel.ruleRefresh(`${t}_${m}`),o&&this._undoRedoService.clearUndoRedo(e)})}const r=this._worksheetProtectionPointRuleModel.getTargetByPermissionId(e,t);if(r){const[u,l]=r;this._authzIoService.allowed({objectID:t,unitID:e,objectType:D.Worksheet,actions:_n}).then(d=>{this._worksheetProtectionPointRuleModel.getTargetByPermissionId(e,t)&&(Ie().forEach(m=>{var S;const h=new m(e,l),R=h.subType,C=d.find(I=>I.action===R);C&&(((S=this._permissionService.getPermissionPoint(h.id))==null?void 0:S.value)!==C.allowed&&(o=!0),this._permissionService.updatePermissionPoint(h.id,C.allowed))}),o&&this._undoRedoService.clearUndoRedo(e))})}const a=this._rangeProtectionRuleModel.getTargetByPermissionId(e,t);if(a){const[u,l]=a;this._authzIoService.allowed({objectID:t,unitID:e,objectType:D.SelectRange,actions:Ge}).then(d=>{if(!this._rangeProtectionRuleModel.getTargetByPermissionId(e,t))return;let m="";le().forEach(h=>{var I;const R=new h(e,l,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),m+=`${S.action}_${S.allowed}`)}),this._rangeProtectionRuleModel.ruleRefresh(`${t}_${m}`),o&&this._undoRedoService.clearUndoRedo(e)})}}_refreshPermissionByCollaCreate(){this.disposeWithMe(this._commandService.onCommandExecuted((e,t)=>{if(t!=null&&t.fromCollab&&(e.id===Ce.id||e.id===Fe.id||e.id===bn.id)){const n=e.params;this._undoRedoService.clearUndoRedo(n.unitId)}}))}},g.SheetPermissionInitController=sd([De(0,i.IUniverInstanceService),De(1,i.IPermissionService),De(2,i.IAuthzIoService),De(3,i.Inject(X)),De(4,i.Inject(ke)),De(5,i.Inject(i.UserManagerService)),De(6,i.Inject(Ut)),De(7,i.Inject(g.WorkbookPermissionService)),De(8,i.Inject(i.IUndoRedoService)),De(9,i.Inject(i.ICommandService))],g.SheetPermissionInitController);var od=Object.getOwnPropertyDescriptor,rd=(s,e,t,n)=>{for(var o=n>1?void 0:n?od(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},Xs=(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 Ye.id:{const a=t.params;o=a.unitId,r=a.subUnitId}break;case Ke.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 Ee.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=rd([Xs(0,i.Inject(i.ICommandService)),Xs(1,i.Inject(g.SheetRangeThemeModel)),Xs(2,i.Inject(i.IUniverInstanceService))],g.ZebraCrossingCacheController);var id=Object.getOwnPropertyDescriptor,ad=(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},Ti=(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(kt.filter(e=>e.type===D.SelectRange),kt.filter(e=>le().some(t=>e instanceof t)),kt.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 u=this._createKey(e.unitId,e.subUnitId,r,a);this._cache.delete(u)})})}),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 u=this._createKey(e,t,n,o),l=this._cache.get(u);if(l)return l;const d=[];for(const c of r)if(c.ranges.some(m=>m.startRow<=n&&m.endRow>=n&&m.startColumn<=o&&m.endColumn>=o)){const m=le().reduce((h,R)=>{var I;const C=new R(e,t,c.permissionId),S=this._permissionService.getPermissionPoint(C.id);return h[C.subType]=(I=S==null?void 0:S.value)!=null?I:C.value,h},{});d.push({...m,ruleId:c.id,ranges:c.ranges})}return this._cache.set(u,d),d}clear(){this._cache.clear()}},g.RangeProtectionRenderModel=ad([Ti(0,i.Inject(X)),Ti(1,i.Inject(i.IPermissionService))],g.RangeProtectionRenderModel);var ud=Object.getOwnPropertyDescriptor,ld=(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},Zs=(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 u=this._ruleModel.getRule(o,n,a);if(!u)return;const l=this._ensureCellInfoMap(o,n);u.ranges.forEach(d=>{const{startRow:c,endRow:m,startColumn:h,endColumn:R}=d;for(let C=c;C<=m;C++)for(let S=h;S<=R;S++)l.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(u=>{i.Range.foreach(u,(l,d)=>{r.delete(`${l}-${d}`)})}),t.type==="set"&&((a=t.oldRule)==null||a.ranges.forEach(u=>{i.Range.foreach(u,(l,d)=>{this._cellInfoCache.delete(`${l}-${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(u=>{const{startRow:l,endRow:d,startColumn:c,endColumn:m}=u;for(let h=l;h<=d;h++)for(let R=c;R<=m;R++)a.set(`${h}-${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),u=this._ensureCellInfoMap(o,n);r.ranges.forEach(l=>{const{startRow:d,endRow:c,startColumn:m,endColumn:h}=l;for(let R=d;R<=c;R++)for(let C=m;C<=h;C++)a.delete(`${R}-${C}`),u.delete(`${R}-${C}`)}),this._permissionIdCache.delete(r.permissionId)}_getSelectionActions(t,n,o){var c,m,h,R,C,S,I,v,M,p,w,y;const r=(h=(m=this._permissionService.getPermissionPoint((c=new Se(t,n,o.permissionId))==null?void 0:c.id))==null?void 0:m.value)!=null?h:!0,a=(S=(C=this._permissionService.getPermissionPoint((R=new un(t,n,o.permissionId))==null?void 0:R.id))==null?void 0:C.value)!=null?S:!0,u=(M=(v=this._permissionService.getPermissionPoint((I=new Ys(t,n,o.permissionId))==null?void 0:I.id))==null?void 0:v.value)!=null?M:!1,l=(y=(w=this._permissionService.getPermissionPoint((p=new qs(t,n,o.permissionId))==null?void 0:p.id))==null?void 0:w.value)!=null?y:!1;return{[_.Edit]:r,[_.View]:a,[_.ManageCollaborator]:u,[_.Delete]:l}}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"),u=this._ensureRowColInfoMap(t,n,"col");a.clear(),u.clear(),this._ruleModel.getSubunitRuleList(t,n).forEach(l=>{const d=this._getSelectionActions(t,n,l),c={...d,ruleId:l.id,ranges:l.ranges};l.ranges.forEach(m=>{const{startRow:h,endRow:R,startColumn:C,endColumn:S}=m;for(let I=h;I<=R;I++){const v=a.get(`${I}`);v?v.set(l.id,d):a.set(`${I}`,new Map([[l.id,d]]));for(let M=C;M<=S;M++){o.set(`${I}-${M}`,l.id),r.set(`${I}-${M}`,c);const p=u.get(`${M}`);p?p.set(l.id,d):u.set(`${M}`,new Map([[l.id,d]]))}}}),this._permissionIdCache.set(l.permissionId,l.id)})}getRowPermissionInfo(t,n,o,r){var l;const a=(l=this._rowInfoCache.get(t))==null?void 0:l.get(n);if(!a)return!0;const u=a.get(`${o}`);return u?r.every(d=>{for(const c of u.values())if(c[d]===!1)return!1;return!0}):!0}getColPermissionInfo(t,n,o,r){var l;const a=(l=this._colInfoCache.get(t))==null?void 0:l.get(n);if(!a)return!0;const u=a.get(`${o}`);return u?r.every(d=>{for(const c of u.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 u=this._ruleModel.getRule(o,n,a);if(!u)return;const l=this._ensureRowColInfoMap(o,n,"row"),d=this._ensureRowColInfoMap(o,n,"col"),c=this._getSelectionActions(o,n,u);u.ranges.forEach(m=>{const{startRow:h,endRow:R,startColumn:C,endColumn:S}=m;for(let I=h;I<=R;I++){const v=l.get(`${I}`);v?v.set(a,c):l.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"),u=this._ensureRowColInfoMap(n,o,"col");r.ranges.forEach(l=>{const{startRow:d,endRow:c,startColumn:m,endColumn:h}=l;for(let R=d;R<=c;R++){const C=a.get(`${R}`);C==null||C.delete(r.id);for(let S=m;S<=h;S++){const I=u.get(`${S}`);I==null||I.delete(r.id)}}})}})}getCellInfo(t,n,o,r){var c,m;const a=this._ensureCellInfoMap(t,n),u=a.get(`${o}-${r}`);if(u)return u;const l=(m=(c=this._cellRuleCache.get(t))==null?void 0:c.get(n))==null?void 0:m.get(`${o}-${r}`);if(!l)return;const d=this._ruleModel.getRule(t,n,l);if(d){const R={...this._getSelectionActions(t,n,d),ruleId:l,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=ld([Zs(0,i.Inject(X)),Zs(1,i.Inject(i.IPermissionService)),Zs(2,i.Inject(i.IUniverInstanceService))],g.RangeProtectionCache);const Ui="ONLY_REGISTER_FORMULA_RELATED_MUTATIONS_KEY";var dd=Object.getOwnPropertyDescriptor,cd=(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},Qs=(s,e)=>(t,n)=>e(t,n,s);let kn=class extends i.Disposable{constructor(s,e,t){var o;super(),this._commandService=s,this._configService=e,this._dataSyncPrimaryController=t,[F,ie,re,yt,Le,pe,we,ne,ae,Xe,G,Js,j,Fs,qt,Un,Ot,fi,Ke,Ye,Ii,vi].forEach(r=>{var a;this._commandService.registerCommand(r),(a=this._dataSyncPrimaryController)==null||a.registerSyncingMutations(r)}),((o=this._configService.getConfig(Ui))!=null?o:!1)||[Pr,sn,fn,on,As,Be,He,Gt,Kt,or,sr,rr,ir,ys,ye,xe,vt,Qo,Zo,tr,er,Ms,Me,Ar,wt,Je,pt,_s,Lt,bs,$t,vn,Rn,Vr,Qr,Xr,Zr,Hr,Br,bt,$r,Lr,wn,ut,lt,zt,Fr,at,Gr,Ne,zr,ti,It,Jt,Mn,Kr,ct,$s,Hs,Et,Tt,ee,oi,jt,xr,si,ni,ei,js,Gs,Ct,ui,je,yn,zs,Yt,zn,Ee,Tn,Re,Ve,mi,gt,ri,mt,Ho,q,Mi,Dr,Ws,Ls,Ks,Ri,Rt,qr,dt,di,Fe,st,tt,bn,Ao,Yr,kr,Tr,Nr,ci,Ce,Te,Q,gi,ht,ii,hi,it,rt,In,_t,Ci,Wr,Ur,Or,Si,wi,pi].forEach(r=>this.disposeWithMe(this._commandService.registerCommand(r))),this._configService.setConfig(yi,jl)}};kn=cd([Qs(0,i.ICommandService),Qs(1,i.IConfigService),Qs(2,i.Optional(Bi.DataSyncPrimaryController))],kn);var md=Object.getOwnPropertyDescriptor,hd=(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},Pi=(s,e)=>(t,n)=>e(t,n,s);let Nn=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!==J.SetFormulaCalculationResultMutation.id)return;const e=s.params,{unitData:t}=e,n=Object.keys(t),o=[];for(let a=0;a<n.length;a++){const u=n[a],l=t[u];if(l==null)continue;const d=Object.keys(l);for(let c=0;c<d.length;c++){const m=d[c],h=l[m];if(h==null)continue;const R=this._getMergedCellData(u,m,h),C={subUnitId:m,unitId:u,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(),u=new i.ObjectMatrix(t);return u.forValue((l,d,c)=>{const m=a==null?void 0:a.getValue(l,d),h=J.handleNumfmtInCell(m,c,o);u.setValue(l,d,h)}),u.getMatrix()}};Nn=hd([Pi(0,i.Inject(i.IUniverInstanceService)),Pi(1,i.ICommandService)],Nn);var gd=Object.getOwnPropertyDescriptor,Rd=(s,e,t,n)=>{for(var o=n>1?void 0:n?gd(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},Cd=(s,e)=>(t,n)=>e(t,n,s);let On=class extends i.Disposable{constructor(s){super(),this._sheetInterceptorService=s,this._initialize()}_initialize(){this._initInterceptorCellContent()}_initInterceptorCellContent(){this.disposeWithMe(this._sheetInterceptorService.intercept(Ae.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=J.stripErrorMargin(Number(s.v))),t(s)}}))}};On=Rd([Cd(0,i.Inject(g.SheetInterceptorService))],On);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},Dn=(s,e)=>(t,n)=>e(t,n,s);let An=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(Ae.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,u=this._rangeProtectionCache.getCellInfo(n,o,r,a);if(u){const l=u[_.View]===!1,d=!s||s===e.rawData?{...e.rawData}:s;return d.selectionProtection=[u],l?(delete d.s,delete d.v,delete d.p,d):t(d)}return t(s)}}))}_initViewModelBySheetInterceptor(){this.disposeWithMe(this._sheetInterceptorService.intercept(Ae.CELL_CONTENT,{priority:999,effect:i.InterceptorEffectEnum.Value|i.InterceptorEffectEnum.Style,handler:(s,e,t)=>{var a,u,l,d,c;const{unitId:n,subUnitId:o}=e,r=this._worksheetProtectionRuleModel.getRule(n,o);if(r!=null&&r.permissionId){const m=[{[_.View]:(u=(a=this._permissionService.getPermissionPoint(new Vt(n,o).id))==null?void 0:a.value)!=null?u:!1,[_.Edit]:(d=(l=this._permissionService.getPermissionPoint(new fe(n,o).id))==null?void 0:l.value)!=null?d:!1}],h=!((c=m[0])!=null&&c[_.View]),R=!s||s===e.rawData?{...s}:s;return R.hasWorksheetRule=!0,R.selectionProtection=m,h?(delete R.s,delete R.v,delete R.p,R):t(R)}return t(s)}}))}};An=fd([Dn(0,i.IPermissionService),Dn(1,i.Inject(ke)),Dn(2,i.Inject(g.SheetInterceptorService)),Dn(3,i.Inject(g.RangeProtectionCache))],An);const eo=i.createIdentifier("univer.exclusive-range-service");class ki 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(u=>u.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(l=>l.range))||[]});const u=this.getExclusiveRanges(t,n,o);if(u){const l=u.filter(d=>d.groupId!==r);this._exclusiveRanges.get(t).get(n).set(o,l)}}getInterestGroupId(t){const n=[];return t.forEach(o=>{var d;const r=o.range,{unitId:a,sheetId:u}=r;if(!a||!u)return;const l=(d=this._exclusiveRanges.get(a))==null?void 0:d.get(u);if(l)for(const c of l.keys()){const m=l.get(c);if(m){for(const h of m)if(i.Rectangle.intersects(r,h.range)){n.push(c);break}}}}),n}}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},to=(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 u=r.getStyles(),l=a.getCellRaw(n,o);if(l!=null&&l.s){const d=u.get(l.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(u=>{i.Range.foreach(u,(l,d)=>{const c=r.getCellRaw(l,d);if(!c)return;const m=c==null?void 0:c.s,R={...m&&a.get(m)||{}};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(),u=r.getCellMatrix();n.forEach(l=>{l.ranges.forEach(d=>{i.Range.foreach(d,(c,m)=>{const h=r.getCellRaw(c,m);if(h){const C={...a.getStyleByCell(h)||{},n:{pattern:l.pattern}},S=a.setValue(C);h.s=S}else{const R={n:{pattern:l.pattern}},C=a.setValue(R);C&&u.setValue(c,m,{s:C})}})})})}},g.NumfmtService=vd([to(0,i.IResourceManagerService),to(1,i.IUniverInstanceService),to(2,i.ILogService)],g.NumfmtService);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},qe=(s,e)=>(t,n)=>e(t,n,s);const Ni=[ie.id,re.id,ne.id,ae.id],Oi=[pe.id,we.id];g.RangeProtectionRefRangeService=class extends i.Disposable{constructor(t,n,o,r,a,u,l,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=u,this._sheetInterceptorService=l,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 l=c=>this.refRangeHandle(c,o,r);this._selectionProtectionRuleModel.getSubunitRuleList(o,r).reduce((c,m)=>[...c,...m.ranges],[]).forEach(c=>{this.disposableCollection.add(this._refRangeService.registerRefRange(c,l,o,r))})};this.disposeWithMe(this._commandService.onCommandExecuted(o=>{if(o.id===Gs.id){const r=o.params,a=r.subUnitId,u=r.unitId;if(!a||!u)return;t(u,a)}if(o.id===Q.id||o.id===Ce.id){const r=o.params,a=r.subUnitId,u=r.unitId;if(!a||!u)return;t(u,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 pt.id:return this._getRefRangeMutationsByMoveRows(t.params,n,o);case wt.id:return this._getRefRangeMutationsByMoveCols(t.params,n,o);case Me.id:return this._getRefRangeMutationsByInsertRows(t.params,n,o);case ye.id:return this._getRefRangeMutationsByInsertCols(t.params,n,o);case Lt.id:return this._getRefRangeMutationsByDeleteCols(t.params,n,o);case $t.id:return this._getRefRangeMutationsByDeleteRows(t.params,n,o)}return{redos:[],undos:[]}}_getRefRangeMutationsByDeleteCols(t,n,o){const r=this._selectionProtectionRuleModel.getSubunitRuleList(n,o).filter(u=>u.ranges.some(l=>i.Rectangle.intersects(l,t.range))),a=t.range;if(r.length){const u=[],l=[];return r.forEach(d=>{const c=i.Tools.deepClone(d),m=c.ranges.reduce((h,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 h;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)&&h.push(C)}return h},[]);c.ranges=m,c.ranges.length?(u.push({id:Q.id,params:{unitId:n,subUnitId:o,rule:c,ruleId:d.id}}),l.push({id:Q.id,params:{unitId:n,subUnitId:o,rule:d,ruleId:d.id}})):(u.push({id:Te.id,params:{unitId:n,subUnitId:o,ruleIds:[d.id]}}),l.push({id:Ce.id,params:{unitId:n,subUnitId:o,name:"",rules:[d]}}))}),{redos:u,undos:l}}return{undos:[],redos:[]}}_getRefRangeMutationsByDeleteRows(t,n,o){const r=this._selectionProtectionRuleModel.getSubunitRuleList(n,o).filter(u=>u.ranges.some(l=>i.Rectangle.intersects(l,t.range))),a=t.range;if(r.length){const u=[],l=[];return r.forEach(d=>{const c=i.Tools.deepClone(d),m=c.ranges.reduce((h,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 h;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)&&h.push(C)}return h},[]);c.ranges=m,u.push({id:Q.id,params:{unitId:n,subUnitId:o,rule:c,ruleId:d.id}}),l.push({id:Q.id,params:{unitId:n,subUnitId:o,rule:d,ruleId:d.id}})}),{redos:u,undos:l}}return{undos:[],redos:[]}}_getRefRangeMutationsByInsertCols(t,n,o){const r=t.range.startColumn,a=t.range.endColumn-t.range.startColumn+1,u=this._selectionProtectionRuleModel.getSubunitRuleList(n,o).filter(l=>l.ranges.some(d=>r>d.startColumn&&r<=d.endColumn));if(u.length){const l=[],d=[];return u.forEach(c=>{const m=i.Tools.deepClone(c);let h=!1;m.ranges.forEach(R=>{r>R.startColumn&&r<=R.endColumn&&(R.endColumn+=a,h=!0)}),h&&(l.push({id:Q.id,params:{unitId:n,subUnitId:o,rule:m,ruleId:c.id}}),d.push({id:Q.id,params:{unitId:n,subUnitId:o,rule:c,ruleId:c.id}}))}),{redos:l,undos:d}}return{undos:[],redos:[]}}_getRefRangeMutationsByInsertRows(t,n,o){const r=t.range.startRow,a=t.range.endRow-t.range.startRow+1,u=this._selectionProtectionRuleModel.getSubunitRuleList(n,o).filter(l=>l.ranges.some(d=>r>d.startRow&&r<=d.endRow));if(u.length){const l=[],d=[];return u.forEach(c=>{const m=i.Tools.deepClone(c);let h=!1;m.ranges.forEach(R=>{r>R.startRow&&r<=R.endRow&&(R.endRow+=a,h=!0)}),h&&(l.push({id:Q.id,params:{unitId:n,subUnitId:o,rule:m,ruleId:c.id}}),d.push({id:Q.id,params:{unitId:n,subUnitId:o,rule:c,ruleId:c.id}}))}),{redos:l,undos:d}}return{undos:[],redos:[]}}_getRefRangeMutationsByMoveRows(t,n,o){const r=t.toRange,a=r.startRow,u=r.endRow-r.startRow+1,l=this._selectionProtectionRuleModel.getSubunitRuleList(n,o).filter(d=>d.ranges.some(c=>a>c.startRow&&a<=c.endRow));if(l.length){const d=[],c=[];return l.forEach(m=>{const h=i.Tools.deepClone(m),C=t.fromRange.startRow;let S=!1;h.ranges.forEach(I=>{a>I.startRow&&a<=I.endRow&&(C<I.startRow&&(I.startRow=I.startRow-u,I.endRow=I.endRow-u),I.endRow+=u,S=!0)}),S&&(d.push({id:Q.id,params:{unitId:n,subUnitId:o,rule:h,ruleId:m.id}}),c.push({id:Q.id,params:{unitId:n,subUnitId:o,rule:m,ruleId:m.id}}))}),{redos:d,undos:c}}return{undos:[],redos:[]}}_getRefRangeMutationsByMoveCols(t,n,o){const r=t.toRange,a=r.startColumn,u=r.endColumn-r.startColumn+1,l=this._selectionProtectionRuleModel.getSubunitRuleList(n,o).filter(d=>d.ranges.some(c=>a>c.startColumn&&a<=c.endColumn));if(l.length){const d=[],c=[];return l.forEach(m=>{const h=i.Tools.deepClone(m),C=t.fromRange.startColumn;let S=!1;h.ranges.forEach(I=>{a>I.startColumn&&a<=I.endColumn&&(C<I.startColumn&&(I.startColumn=I.startColumn-u,I.endColumn=I.endColumn-u),I.endColumn+=u,S=!0)}),S&&(d.push({id:Q.id,params:{unitId:n,subUnitId:o,rule:h,ruleId:m.id}}),c.push({id:Q.id,params:{unitId:n,subUnitId:o,rule:m,ruleId:m.id}}))}),{redos:d,undos:c}}return{undos:[],redos:[]}}_correctPermissionRange(){this.disposeWithMe(this._commandService.onCommandExecuted(t=>{if(Oi.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,u=r.startColumn===a.startColumn&&r.endColumn===a.endColumn,l=u?r.endRow-r.startRow+1:r.endColumn-r.startColumn+1,d=u?r.startRow:r.startColumn,c=u?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)||(u?d<p&&c>w?(p-=l,w-=l):d>w&&c<=p&&(p+=l,w+=l):d<y&&c>b?(y-=l,b-=l):d>b&&c<=y&&(y+=l,b+=l)),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:h,subUnitId:R}=t.params,C=I=>this.refRangeHandle(I,h,R);this._selectionProtectionRuleModel.getSubunitRuleList(h,R).reduce((I,v)=>[...I,...v.ranges],[]).forEach(I=>{this.disposableCollection.add(this._refRangeService.registerRefRange(I,C,h,R))}),this._selectionProtectionRenderModel.clear()}if(Ni.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,u=t.id.includes("row"),l=t.id.includes("insert"),d=u?a.startRow:a.startColumn,c=u?a.endRow:a.endColumn,m=c-d+1;this._selectionProtectionRuleModel.getSubunitRuleList(n.getUnitId(),o.getSheetId()).forEach(v=>{v.ranges.forEach(p=>{let{startRow:w,endRow:y,startColumn:b,endColumn:T}=p;l?u?d<=w&&(w+=m,y+=m):d<=b&&(b+=m,T+=m):u?c<w&&(w-=m,y-=m):c<b&&(b-=m,T-=m),this._checkIsRightRange({startRow:w,endRow:y,startColumn:b,endColumn:T})&&(p.startColumn=b,p.endColumn=T,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(Ni.includes(t.id)||Oi.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===vn.id){const u=t.params,l=[],d=[];this._rangeProtectionRuleModel.getSubunitRuleList(u.unitId,u.subUnitId).forEach(c=>{l.push(c.id),d.push(c)}),l.length&&d.length&&(r.push({id:Te.id,params:{unitId:u.unitId,subUnitId:u.subUnitId,ruleIds:l}}),n.push({id:Ce.id,params:{unitId:u.unitId,subUnitId:u.subUnitId,name:"",rules:d}}))}return{redos:o,undos:n,preRedos:r,preUndos:a}}})}},g.RangeProtectionRefRangeService=wd([qe(0,i.Inject(X)),qe(1,i.Inject(i.IUniverInstanceService)),qe(2,i.ICommandService),qe(3,i.Inject(g.RefRangeService)),qe(4,i.Inject(g.RangeProtectionRenderModel)),qe(5,i.Inject(g.RangeProtectionCache)),qe(6,i.Inject(g.SheetInterceptorService)),qe(7,i.Inject(X))],g.RangeProtectionRefRangeService);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},Xt=(s,e)=>(t,n)=>e(t,n,s);const _d="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":{le().forEach(t=>{const n=new t(e.unitId,e.subUnitId,e.rule.permissionId);this._permissionService.addPermissionPoint(n)});break}case"delete":{le().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&&le().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:_d,businesses:[an.UNIVER_SHEET],onLoad:(n,o)=>{const r=this._selectionProtectionRuleModel.toObject();r[n]=o,this._selectionProtectionRuleModel.fromObject(r);const a=[];Object.keys(o).forEach(u=>{const l=o[u];this._selectionProtectionRuleModel.getSubunitRuleList(n,u).forEach(d=>{a.push({objectID:d.permissionId,unitID:n,objectType:D.SelectRange,actions:Ge})}),l.forEach(d=>{le().forEach(c=>{const m=new c(n,u,d.permissionId);m.value=!1,this._permissionService.addPermissionPoint(m)})}),this._selectionProtectionCache.reBuildCache(n,u)})},onUnLoad:n=>{this._selectionProtectionCache.deleteUnit(n)}}))}},g.RangeProtectionService=yd([Xt(0,i.Inject(X)),Xt(1,i.Inject(i.IPermissionService)),Xt(2,i.Inject(i.IResourceManagerService)),Xt(3,i.Inject(g.RangeProtectionCache)),Xt(4,i.Inject(i.IUniverInstanceService))],g.RangeProtectionService);var bd=Object.getOwnPropertyDescriptor,Ed=(s,e,t,n)=>{for(var o=n>1?void 0:n?bd(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},Td=(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=Ed([Td(0,i.Inject(g.SheetRangeThemeModel))],g.SheetRangeThemeService);var Ud=Object.defineProperty,Pd=Object.getOwnPropertyDescriptor,kd=(s,e,t)=>e in s?Ud(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,Nd=(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},Di=(s,e)=>(t,n)=>e(t,n,s),Ai=(s,e,t)=>kd(s,typeof e!="symbol"?e+"":e,t);const Od="SHEET_PLUGIN";g.UniverSheetsPlugin=class extends i.Plugin{constructor(e=Ei,t,n){super(),this._config=e,this._injector=t,this._configService=n;const{...o}=i.merge({},Ei,this._config);this._configService.setConfig(bi,o),this._initConfig(),this._initDependencies()}_initConfig(){var e,t,n;(e=this._config)!=null&&e.onlyRegisterFormulaRelatedMutations&&this._configService.setConfig(Ui,!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=[[nt],[g.SheetsSelectionsService],[g.RefRangeService],[g.WorkbookPermissionService],[ot,{useClass:g.NumfmtService}],[g.SheetInterceptorService],[g.SheetRangeThemeService],[g.SheetSkeletonService],[kn],[g.MergeCellController],[On],[g.DefinedNameDataController],[g.ZebraCrossingCacheController],[g.SheetsFreezeSyncController],[g.WorksheetPermissionService],[ke],[Ut],[An],[g.SheetPermissionInitController],[g.SheetPermissionCheckController],[g.SheetRangeThemeModel],[g.RangeProtectionRenderModel],[X],[g.RangeProtectionCache],[g.RangeProtectionRefRangeService],[g.RangeProtectionService],[eo,{useClass:ki,deps:[g.SheetsSelectionsService]}]];(t=this._config)!=null&&t.notExecuteFormula||e.push([Nn]),i.registerDependencies(this._injector,i.mergeOverrideWithDependencies(e,this._config.override)),i.touchDependencies(this._injector,[[g.SheetInterceptorService],[g.RangeProtectionService],[eo],[g.SheetPermissionInitController],[g.SheetsFreezeSyncController]])}onStarting(){i.touchDependencies(this._injector,[[kn],[g.MergeCellController],[g.WorkbookPermissionService],[g.WorksheetPermissionService],[An],[g.SheetSkeletonService]])}onRendered(){i.touchDependencies(this._injector,[[ot]])}onReady(){i.touchDependencies(this._injector,[[Nn],[g.DefinedNameDataController],[g.ZebraCrossingCacheController],[g.SheetRangeThemeModel],[On],[g.RangeProtectionRenderModel],[g.RangeProtectionRefRangeService],[g.RefRangeService],[g.SheetPermissionCheckController]])}},Ai(g.UniverSheetsPlugin,"pluginName",Od),Ai(g.UniverSheetsPlugin,"type",i.UniverInstanceType.UNIVER_SHEET),g.UniverSheetsPlugin=Nd([i.DependentOn(J.UniverFormulaEnginePlugin),Di(1,i.Inject(i.Injector)),Di(2,i.IConfigService)],g.UniverSheetsPlugin);const Dd={WorkbookCommentPermission:Jn,WorkbookCopyPermission:xn,WorkbookCreateProtectPermission:Xn,WorkbookCreateSheetPermission:Zn,WorkbookDeleteSheetPermission:Qn,WorkbookDuplicatePermission:es,WorkbookEditablePermission:me,WorkbookExportPermission:ts,WorkbookHideSheetPermission:ln,WorkbookHistoryPermission:qo,WorkbookManageCollaboratorPermission:dn,WorkbookMoveSheetPermission:cn,WorkbookPrintPermission:ns,WorkbookRecoverHistoryPermission:ss,WorkbookRenameSheetPermission:mn,WorkbookSharePermission:os,WorkbookViewHistoryPermission:is,WorkbookViewPermission:rs,WorksheetCopyPermission:as,WorksheetDeleteColumnPermission:us,WorksheetDeleteProtectionPermission:ls,WorksheetDeleteRowPermission:ds,WorksheetEditExtraObjectPermission:cs,WorksheetEditPermission:fe,WorksheetFilterPermission:ms,WorksheetInsertColumnPermission:hs,WorksheetInsertHyperlinkPermission:gs,WorksheetInsertRowPermission:Rs,WorksheetManageCollaboratorPermission:Cs,WorksheetPivotTablePermission:Ss,WorksheetSetCellStylePermission:fs,WorksheetSetCellValuePermission:Wt,WorksheetSetColumnStylePermission:St,WorksheetSetRowStylePermission:ft,WorksheetSortPermission:Is,WorksheetViewPermission:Vt,RangeProtectionPermissionEditPoint:Se,RangeProtectionPermissionViewPoint:un},Ad=(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 u=o.getPermissionPoint(new fe(e,t).id);if(!(u!=null&&u.value))return!1;const d=r.getSubunitRuleList(e,t).filter(c=>c.ranges.some(m=>n.some(h=>i.Rectangle.intersects(m,h))));return d.length?d.every(c=>{const m=c.permissionId,h=o.getPermissionPoint(new Se(e,t,m).id);return!!(h!=null&&h.value)}):!0},Wi=(s,e,t,n=1,o=!0,r=!0)=>{const a=i.Range.transformRange(s,e),{startRow:u,endRow:l}=a;let d=t.startRow-n,c=e.getMergedCell(d,t.startColumn),m=!c||c.startRow===d&&c.startColumn===t.startColumn;for(;!e.getRowVisible(d)||!m;)d--,c=e.getMergedCell(d,t.startColumn),m=!c||c.startRow===d&&c.startColumn===t.startColumn;if(d>=u)return{...t,startRow:d,endRow:d};if(r){const h={...t,startRow:l,endRow:l};return $i(s,e,h,n,o,!1)}},Vi=(s,e,t,n=1,o=!0,r=!0)=>{const a=i.Range.transformRange(s,e),{startRow:u,endRow:l}=a;let d=t.endRow+n,c=e.getMergedCell(d,t.startColumn),m=!c||c.startRow===d&&c.startColumn===t.startColumn;for(;!e.getRowVisible(d)||!m;)d++,c=e.getMergedCell(d,t.startColumn),m=!c||c.startRow===d&&c.startColumn===t.startColumn;if(d<=l)return{...t,startRow:d,endRow:d};if(r){const h={...t,startRow:u,endRow:u};return Li(s,e,h,n,o,!1)}},$i=(s,e,t,n=1,o=!0,r=!0)=>{const a=i.Range.transformRange(s,e),{startColumn:u,endColumn:l}=a;let d=t.startColumn-n,c=e.getMergedCell(t.startRow,d),m=!c||c.startRow===t.startRow&&c.startColumn===d;for(;!e.getColVisible(d)||!m;)d--,c=e.getMergedCell(t.startRow,d),m=!c||c.startRow===t.startRow&&c.startColumn===d;if(d>=u)return{...t,startColumn:d,endColumn:d};if(r){const h={...t,startColumn:l,endColumn:l};return Wi(s,e,h,n,o,!1)}},Li=(s,e,t,n=1,o=!0,r=!0)=>{const a=i.Range.transformRange(s,e),{startColumn:u,endColumn:l}=a;let d=t.endColumn+n,c=e.getMergedCell(t.startRow,d),m=!c||c.startRow===t.startRow&&c.startColumn===d;for(;!e.getColVisible(d)||!m;)d++,c=e.getMergedCell(t.startRow,d),m=!c||c.startRow===t.startRow&&c.startColumn===d;if(d<=l)return{...t,endColumn:d,startColumn:d};if(r){const h={...t,startColumn:u,endColumn:u};return Vi(s,e,h,n,o,!1)}};function Wn(s,e,t){let n=null;return t.getMatrixWithMergedCells(s,e,s,e).forValue((r,a,u)=>(n={actualRow:r,actualColumn:a,startRow:r,startColumn:a,isMerged:u.rowSpan!==void 0||u.colSpan!==void 0,isMergedMainCell:u.rowSpan!==void 0&&u.colSpan!==void 0,endRow:r+(u.rowSpan!==void 0?u.rowSpan-1:0),endColumn:a+(u.colSpan!==void 0?u.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 Wd=(s,e,t,n,o=1)=>{switch(n){case i.Direction.UP:return Wi(s,e,t,o);case i.Direction.DOWN:return Vi(s,e,t,o);case i.Direction.LEFT:return $i(s,e,t,o);case i.Direction.RIGHT:return Li(s,e,t,o)}},Vd=(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,u=a?o-1>=0?o-1:s.length-1:o+1<s.length?o+1:0,l=s[u];if(!n||!r)return null;const d={...r},{startRow:c,startColumn:m,endRow:h,endColumn:R}=n.range,C=a?d.startRow===c&&d.startColumn===m:d.endRow===h&&d.endColumn===R,S=C&&a;if(!i.Rectangle.equals(n.range,d)){const v=C?l.range:Wd(n.range,t,d,e);if(!v)return null;const M=S?Wn(v.endRow,v.endColumn,t):Wn(v.startRow,v.startColumn,t);return{startRow:M.startRow,startColumn:M.startColumn,endRow:M.endRow,endColumn:M.endColumn}}const I=S?Wn(l.range.endRow,l.range.endColumn,t):Wn(l.range.startRow,l.range.startColumn,t);return{startRow:I.startRow,startColumn:I.startColumn,endRow:I.endRow,endColumn:I.endColumn}};g.AFTER_CELL_EDIT=Zt,g.AddMergeRedoSelectionsOperationFactory=Hl,g.AddMergeUndoMutationFactory=ge,g.AddMergeUndoSelectionsOperationFactory=Fl,g.AddRangeProtectionCommand=Ao,g.AddRangeProtectionMutation=Ce,g.AddRangeThemeMutation=Si,g.AddWorksheetMergeAllCommand=sl,g.AddWorksheetMergeCommand=Ft,g.AddWorksheetMergeHorizontalCommand=rl,g.AddWorksheetMergeMutation=j,g.AddWorksheetMergeVerticalCommand=ol,g.AddWorksheetProtectionCommand=Tr,g.AddWorksheetProtectionMutation=Fe,g.AppendRowCommand=Pr,g.BEFORE_CELL_EDIT=$n,g.BorderStyleManagerService=nt,g.COMMAND_LISTENER_SKELETON_CHANGE=Ua,g.COMMAND_LISTENER_VALUE_CHANGE=Pa,g.CancelFrozenCommand=zr,g.CancelMarkDirtyRowAutoHeightMutation=vi,g.ClearSelectionAllCommand=sn,g.ClearSelectionContentCommand=fn,g.ClearSelectionFormatCommand=on,g.CopySheetCommand=As,g.DISABLE_NORMAL_SELECTIONS=ru,g.DeleteRangeMoveLeftCommand=Be,g.DeleteRangeMoveUpCommand=He,g.DeleteRangeProtectionCommand=kr,g.DeleteRangeProtectionMutation=Te,g.DeleteWorksheetProtectionCommand=Nr,g.DeleteWorksheetProtectionMutation=tt,g.DeleteWorksheetRangeThemeStyleCommand=Or,g.DeleteWorksheetRangeThemeStyleMutation=it,g.DeleteWorksheetRangeThemeStyleMutationFactory=lo,g.DeltaColumnWidthCommand=Gt,g.DeltaRowHeightCommand=Kt,g.EditStateEnum=Do,g.EffectRefRangId=A,g.EmptyMutation=fi,g.ExclusiveRangeService=ki,g.FactoryAddRangeProtectionMutation=tu,g.FactoryDeleteRangeProtectionMutation=eu,g.FactorySetRangeProtectionMutation=Sl,g.IExclusiveRangeService=eo,g.INTERCEPTOR_POINT=Ae,g.INumfmtService=ot,g.IRefSelectionsService=Lo,g.InsertColAfterCommand=or,g.InsertColBeforeCommand=sr,g.InsertColByRangeCommand=ys,g.InsertColCommand=ye,g.InsertColMutation=ie,g.InsertColMutationUndoFactory=Nt,g.InsertDefinedNameCommand=Dr,g.InsertMultiColsLeftCommand=rr,g.InsertMultiColsRightCommand=ir,g.InsertMultiRowsAboveCommand=er,g.InsertMultiRowsAfterCommand=tr,g.InsertRangeMoveDownCommand=xe,g.InsertRangeMoveRightCommand=vt,g.InsertRowAfterCommand=Qo,g.InsertRowBeforeCommand=Zo,g.InsertRowByRangeCommand=Ms,g.InsertRowCommand=Me,g.InsertRowMutation=re,g.InsertRowMutationUndoFactory=en,g.InsertSheetCommand=Ar,g.InsertSheetMutation=yt,g.InsertSheetUndoMutationFactory=Ds,g.InterceptCellContentPriority=so,g.MAX_CELL_PER_SHEET_KEY=yi,g.MERGE_CELL_INTERCEPTOR_CHECK=Er,g.MarkDirtyRowAutoHeightMutation=Ii,g.MoveColsCommand=wt,g.MoveColsMutation=we,g.MoveColsMutationUndoFactory=mo,g.MoveRangeCommand=Je,g.MoveRangeMutation=Le,g.MoveRowsCommand=pt,g.MoveRowsMutation=pe,g.MoveRowsMutationUndoFactory=co,g.OperatorType=B,g.PermissionPointsDefinitions=Dd,g.REF_SELECTIONS_ENABLED=Vo,g.RangeMergeUtil=Ba,g.RangeProtectionPermissionDeleteProtectionPoint=qs,g.RangeProtectionPermissionEditPoint=Se,g.RangeProtectionPermissionManageCollaPoint=Ys,g.RangeProtectionPermissionViewPoint=un,g.RangeProtectionRuleModel=X,g.RangeThemeStyle=We,g.RegisterWorksheetRangeThemeStyleCommand=Wr,g.RegisterWorksheetRangeThemeStyleMutation=_t,g.RemoveColByRangeCommand=bs,g.RemoveColCommand=Lt,g.RemoveColMutation=ne,g.RemoveDefinedNameCommand=Ws,g.RemoveMergeUndoMutationFactory=ue,g.RemoveNumfmtMutation=Js,g.RemoveRangeThemeMutation=pi,g.RemoveRowByRangeCommand=_s,g.RemoveRowCommand=$t,g.RemoveRowMutation=ae,g.RemoveSheetCommand=vn,g.RemoveSheetMutation=Xe,g.RemoveSheetUndoMutationFactory=ar,g.RemoveWorksheetMergeCommand=Vr,g.RemoveWorksheetMergeMutation=G,g.ReorderRangeCommand=Rn,g.ReorderRangeMutation=Ot,g.ReorderRangeUndoMutationFactory=ho,g.ResetBackgroundColorCommand=Qr,g.ResetTextColorCommand=Xr,g.SCOPE_WORKBOOK_VALUE_DEFINED_NAME=Yl,g.SELECTIONS_ENABLED=iu,g.SELECTION_CONTROL_BORDER_BUFFER_COLOR=Fa,g.SELECTION_CONTROL_BORDER_BUFFER_WIDTH=Ha,g.ScrollToCellOperation=Mi,g.SelectRangeCommand=Ho,g.SelectionMoveType=te,g.SetBackgroundColorCommand=Zr,g.SetBoldCommand=pl,g.SetBorderBasicCommand=Hr,g.SetBorderColorCommand=Br,g.SetBorderCommand=bt,g.SetBorderPositionCommand=$r,g.SetBorderStyleCommand=Lr,g.SetColDataCommand=Fr,g.SetColDataMutation=at,g.SetColDataMutationFactory=go,g.SetColHiddenCommand=wn,g.SetColHiddenMutation=ut,g.SetColVisibleMutation=lt,g.SetColWidthCommand=zt,g.SetDefinedNameCommand=Ls,g.SetFontFamilyCommand=bl,g.SetFontSizeCommand=El,g.SetFrozenCommand=Gr,g.SetFrozenMutation=Ne,g.SetFrozenMutationFactory=Bs,g.SetGridlinesColorCommand=qr,g.SetGridlinesColorMutation=dt,g.SetHorizontalTextAlignCommand=ti,g.SetItalicCommand=wl,g.SetNumfmtMutation=Un,g.SetOverlineCommand=_l,g.SetProtectionCommand=Yr,g.SetRangeProtectionMutation=Q,g.SetRangeThemeMutation=wi,g.SetRangeValuesCommand=It,g.SetRangeValuesMutation=F,g.SetRangeValuesUndoMutationFactory=ce,g.SetRowDataCommand=Kr,g.SetRowDataMutation=ct,g.SetRowDataMutationFactory=So,g.SetRowHeightCommand=Jt,g.SetRowHiddenCommand=Mn,g.SetRowHiddenMutation=Ke,g.SetRowVisibleMutation=Ye,g.SetSelectedColsVisibleCommand=$s,g.SetSelectedRowsVisibleCommand=Hs,g.SetSelectionsOperation=q,g.SetSpecificColsVisibleCommand=Et,g.SetSpecificRowsVisibleCommand=Tt,g.SetStrikeThroughCommand=yl,g.SetStyleCommand=ee,g.SetTabColorCommand=oi,g.SetTabColorMutation=jt,g.SetTextColorCommand=xr,g.SetTextRotationCommand=si,g.SetTextWrapCommand=ni,g.SetUnderlineCommand=Ml,g.SetVerticalTextAlignCommand=ei,g.SetWorkbookNameCommand=js,g.SetWorkbookNameMutation=Fs,g.SetWorksheetActivateCommand=Gs,g.SetWorksheetActiveOperation=Ct,g.SetWorksheetColWidthMutation=Ve,g.SetWorksheetColWidthMutationFactory=jn,g.SetWorksheetColumnCountCommand=ri,g.SetWorksheetColumnCountMutation=mt,g.SetWorksheetColumnCountUndoMutationFactory=fo,g.SetWorksheetDefaultStyleCommand=ii,g.SetWorksheetDefaultStyleMutation=ht,g.SetWorksheetDefaultStyleMutationFactory=Io,g.SetWorksheetHideCommand=ui,g.SetWorksheetHideMutation=je,g.SetWorksheetNameCommand=yn,g.SetWorksheetNameMutation=qt,g.SetWorksheetOrderCommand=zs,g.SetWorksheetOrderMutation=Yt,g.SetWorksheetPermissionPointsCommand=di,g.SetWorksheetPermissionPointsMutation=bn,g.SetWorksheetProtectionCommand=ci,g.SetWorksheetProtectionMutation=st,g.SetWorksheetRangeThemeStyleCommand=Ur,g.SetWorksheetRangeThemeStyleMutation=rt,g.SetWorksheetRangeThemeStyleMutationFactory=uo,g.SetWorksheetRightToLeftCommand=$l,g.SetWorksheetRightToLeftMutation=En,g.SetWorksheetRowAutoHeightMutation=zn,g.SetWorksheetRowAutoHeightMutationFactory=Ta,g.SetWorksheetRowCountCommand=mi,g.SetWorksheetRowCountMutation=gt,g.SetWorksheetRowCountUndoMutationFactory=vo,g.SetWorksheetRowHeightMutation=Ee,g.SetWorksheetRowIsAutoHeightCommand=Tn,g.SetWorksheetRowIsAutoHeightMutation=Re,g.SetWorksheetShowCommand=Ks,g.SheetSkeletonChangeType=wo,g.SheetValueChangeType=Mo,g.SplitDelimiterEnum=Uo,g.SplitTextToColumnsCommand=hi,g.ToggleCellCheckboxCommand=gi,g.ToggleGridlinesCommand=Ri,g.ToggleGridlinesMutation=Rt,g.UnitAction=_,g.UnitObject=D,g.UnregisterWorksheetRangeThemeStyleCommand=Ci,g.UnregisterWorksheetRangeThemeStyleMutation=In,g.VALIDATE_CELL=Qt,g.ViewStateEnum=Oo,g.WorkbookCommentPermission=Jn,g.WorkbookCopyPermission=xn,g.WorkbookCopySheetPermission=jo,g.WorkbookCreateProtectPermission=Xn,g.WorkbookCreateSheetPermission=Zn,g.WorkbookDeleteColumnPermission=Go,g.WorkbookDeleteRowPermission=zo,g.WorkbookDeleteSheetPermission=Qn,g.WorkbookDuplicatePermission=es,g.WorkbookEditablePermission=me,g.WorkbookExportPermission=ts,g.WorkbookHideSheetPermission=ln,g.WorkbookHistoryPermission=qo,g.WorkbookInsertColumnPermission=Yo,g.WorkbookInsertRowPermission=Ko,g.WorkbookManageCollaboratorPermission=dn,g.WorkbookMoveSheetPermission=cn,g.WorkbookPrintPermission=ns,g.WorkbookRecoverHistoryPermission=ss,g.WorkbookRenameSheetPermission=mn,g.WorkbookSelectionModel=Wo,g.WorkbookSharePermission=os,g.WorkbookViewHistoryPermission=is,g.WorkbookViewPermission=rs,g.WorksheetCopyPermission=as,g.WorksheetDeleteColumnPermission=us,g.WorksheetDeleteProtectionPermission=ls,g.WorksheetDeleteRowPermission=ds,g.WorksheetEditExtraObjectPermission=cs,g.WorksheetEditPermission=fe,g.WorksheetFilterPermission=ms,g.WorksheetInsertColumnPermission=hs,g.WorksheetInsertHyperlinkPermission=gs,g.WorksheetInsertRowPermission=Rs,g.WorksheetManageCollaboratorPermission=Cs,g.WorksheetPivotTablePermission=Ss,g.WorksheetProtectionPointModel=Ut,g.WorksheetProtectionRuleModel=ke,g.WorksheetSelectProtectedCellsPermission=Ru,g.WorksheetSelectUnProtectedCellsPermission=Cu,g.WorksheetSetCellStylePermission=fs,g.WorksheetSetCellValuePermission=Wt,g.WorksheetSetColumnStylePermission=St,g.WorksheetSetRowStylePermission=ft,g.WorksheetSortPermission=Is,g.WorksheetViewPermission=Vt,g.addMergeCellsUtil=il,g.adjustRangeOnMutation=vr,g.alignToMergedCellsBorders=At,g.baseProtectionActions=Ge,g.checkCellValueType=Vn,g.checkRangesEditablePermission=Ad,g.convertPrimaryWithCoordToPrimary=To,g.convertSelectionDataToRange=ja,g.copyRangeStyles=$e,g.createTopMatrixFromMatrix=bo,g.createTopMatrixFromRanges=_o,g.defaultWorkbookPermissionPoints=li,g.defaultWorksheetPermissionPoint=_n,g.expandToContinuousRange=$a,g.factoryRemoveNumfmtUndoMutation=Bl,g.factorySetNumfmtUndoMutation=Ll,g.findAllRectangle=qn,g.findFirstNonEmptyCell=Za,g.followSelectionOperation=Ue,g.generateNullCell=Kn,g.generateNullCellValue=ko,g.getAddMergeMutationRangeByType=Os,g.getAllRangePermissionPoint=le,g.getAllWorkbookPermissionPoint=Pt,g.getAllWorksheetPermissionPoint=de,g.getAllWorksheetPermissionPointByPointPanel=Ie,g.getCellAtRowCol=au,g.getDefaultRangePermission=Nl,g.getInsertRangeMutations=vs,g.getMoveRangeUndoRedoMutations=rn,g.getNextPrimaryCell=Vd,g.getPrimaryForRange=se,g.getRemoveRangeMutations=ps,g.getSelectionsService=Bo,g.getSeparateEffectedRangesOnCommand=Fu,g.getSheetCommandTarget=P,g.getSheetCommandTargetWorkbook=Bn,g.getSheetMutationTarget=ve,g.getSkeletonChangedEffectedRange=Na,g.getValueChangedEffectedRange=ka,g.getVisibleRanges=Dt,g.handleBaseInsertRange=Qe,g.handleBaseMoveRowsCols=Ht,g.handleBaseRemoveRange=Ze,g.handleCommonDefaultRangeChangeWithEffectRefCommands=Ns,g.handleCommonRangeChangeWithEffectRefCommandsSkipNoInterests=Bu,g.handleDefaultRangeChangeWithEffectRefCommands=ks,g.handleDefaultRangeChangeWithEffectRefCommandsSkipNoInterests=Lu,g.handleDeleteRangeMoveLeft=fr,g.handleDeleteRangeMoveUp=Ir,g.handleDeleteRangeMutation=fu,g.handleIRemoveCol=Ps,g.handleIRemoveRow=hr,g.handleInsertCol=Rr,g.handleInsertRangeMoveDown=Cr,g.handleInsertRangeMoveRight=Sr,g.handleInsertRangeMutation=Su,g.handleInsertRow=gr,g.handleMoveCols=Us,g.handleMoveRange=mr,g.handleMoveRows=Ts,g.isSingleCellSelection=lu,g.packNumberMap=Hn,g.rangeMerge=Yn,g.rangeToDiscreteRange=No,g.rotateRange=he,g.runRefRangeMutations=et,g.setEndForRange=uu,g.splitRangeText=Po,g.transformCellsToRange=Pn,g.unpackNumberMap=Fn,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,I,a,P,M,w){"use strict";var ye=Object.defineProperty;var Ue=(c,h,I)=>h in c?ye(c,h,{enumerable:!0,configurable:!0,writable:!0,value:I}):c[h]=I;var k=(c,h,I)=>Ue(c,typeof h!="symbol"?h+"":h,I);var D;var ee=Object.getOwnPropertyDescriptor,te=(r,n,e,t)=>{for(var i=t>1?void 0:t?ee(n,e):n,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(i)||i);return i},R=(r,n)=>(e,t)=>n(e,t,r);function ne(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,s=n.t("definedName.defaultName")+o;if(e.getValueByName(r,s)==null)return s;let d=o+1;for(;;){const u=n.t("definedName.defaultName")+d;if(e.getValueByName(r,u)==null)return u;d++}}class T{constructor(){k(this,"_definedNameParam");this._definedNameParam={id:h.generateRandomId(10),unitId:"",name:"",formulaOrRefString:"",localSheetId:a.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=a.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 O=class extends I.FBase{constructor(r,n,e,t,i,o,s,d,u,l){super(),this._definedNameParam=r,this._injector=n,this._commandService=e,this._permissionService=t,this._worksheetProtectionRuleModel=i,this._rangeProtectionRuleModel=o,this._worksheetProtectionPointRuleModel=s,this._authzIoService=d,this._localeService=u,this._definedNamesService=l}_apply(){this._definedNameParam.name===""&&(this._definedNameParam.name=ne(this._definedNameParam.unitId,this._localeService,this._definedNamesService)),this._commandService.syncExecuteCommand(a.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=a.SCOPE_WORKBOOK_VALUE_DEFINED_NAME,this._apply()}setHidden(r){this._definedNameParam.hidden=r,this._apply()}delete(){this._commandService.syncExecuteCommand(a.RemoveDefinedNameCommand.id,this._definedNameParam)}getLocalSheetId(){return this._definedNameParam.localSheetId}isWorkbookScope(){return this._definedNameParam.localSheetId===a.SCOPE_WORKBOOK_VALUE_DEFINED_NAME}toBuilder(){const r=this._injector.createInstance(T);return r.load(this._definedNameParam),r}};O=te([R(1,h.Inject(h.Injector)),R(2,h.ICommandService),R(3,h.IPermissionService),R(4,h.Inject(a.WorksheetProtectionRuleModel)),R(5,h.Inject(a.RangeProtectionRuleModel)),R(6,h.Inject(a.WorksheetProtectionPointModel)),R(7,h.Inject(h.IAuthzIoService)),R(8,h.Inject(h.LocaleService)),R(9,P.IDefinedNamesService)],O);var ie=Object.getOwnPropertyDescriptor,re=(r,n,e,t)=>{for(var i=t>1?void 0:t?ie(n,e):n,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(i)||i);return i},E=(r,n)=>(e,t)=>n(e,t,r);c.FPermission=class extends I.FBase{constructor(e,t,i,o,s,d,u,l){super();k(this,"permissionPointsDefinition",a.PermissionPointsDefinitions);k(this,"rangeRuleChangedAfterAuth$");k(this,"sheetRuleChangedAfterAuth$");k(this,"unitPermissionInitStateChange$");this._injector=e,this._commandService=t,this._permissionService=i,this._worksheetProtectionRuleModel=o,this._rangeProtectionRuleModel=s,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,a.WorkbookEditablePermission,t)}async addWorksheetBasePermission(e,t){if(this._rangeProtectionRuleModel.getSubunitRuleList(e,t).length>0)throw new Error("sheet protection cannot intersect with range protection");const o=await this._authzIoService.create({objectType:a.UnitObject.Worksheet,worksheetObject:{collaborators:[],unitID:e,strategies:[],name:"",scope:void 0}});if(this._commandService.syncExecuteCommand(a.AddWorksheetProtectionMutation.id,{unitId:e,subUnitId:t,rule:{permissionId:o,unitType:a.UnitObject.Worksheet,unitId:e,subUnitId:t}}))return o}removeWorksheetPermission(e,t){this._commandService.syncExecuteCommand(a.DeleteWorksheetProtectionMutation.id,{unitId:e,subUnitId:t}),[...a.getAllWorksheetPermissionPoint(),...a.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 s=this._worksheetProtectionRuleModel.getRule(e,t);let d;if(i===a.WorksheetEditPermission||i===a.WorksheetViewPermission)if(s)d=s.permissionId;else{if(this._rangeProtectionRuleModel.getSubunitRuleList(e,t).length>0)throw new Error("sheet protection cannot intersect with range protection");d=await this.addWorksheetBasePermission(e,t)}else{const _=this._worksheetProtectionPointRuleModel.getRule(e,t);_?d=_.permissionId:(d=await this._authzIoService.create({objectType:a.UnitObject.Worksheet,worksheetObject:{collaborators:[],unitID:e,strategies:[],name:"",scope:void 0}}),this._commandService.syncExecuteCommand(a.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),s=this._permissionService.getPermissionPoint(o.id);if(s)return s.value}async addRangeBaseProtection(e,t,i){const o=await this._authzIoService.create({objectType:a.UnitObject.SelectRange,selectRangeObject:{collaborators:[],unitID:e,name:"",scope:void 0}}),s=`ruleId_${h.generateRandomId(6)}`;if(this._worksheetProtectionRuleModel.getRule(e,t))throw new Error("sheet protection cannot intersect with range protection");if(this._rangeProtectionRuleModel.getSubunitRuleList(e,t).some(_=>_.ranges.some(C=>i.some(v=>h.Rectangle.intersects(v.getRange(),C)))))throw new Error("range protection cannot intersect");if(this._commandService.syncExecuteCommand(a.AddRangeProtectionMutation.id,{unitId:e,subUnitId:t,rules:[{permissionId:o,unitType:a.UnitObject.SelectRange,unitId:e,subUnitId:t,ranges:i.map(_=>_.getRange()),id:s}]}))return{permissionId:o,ruleId:s}}removeRangeProtection(e,t,i){this._commandService.syncExecuteCommand(a.DeleteRangeProtectionMutation.id,{unitId:e,subUnitId:t,ruleIds:i})&&this._rangeProtectionRuleModel.getSubunitRuleList(e,t).length===0&&(this._worksheetProtectionPointRuleModel.deleteRule(e,t),[...a.getAllWorksheetPermissionPointByPointPanel()].forEach(d=>{const u=new d(e,t);this._permissionService.updatePermissionPoint(u.id,u.value)}))}setRangeProtectionPermissionPoint(e,t,i,o,s){const d=new o(e,t,i);this._permissionService.getPermissionPoint(d.id)||this._permissionService.addPermissionPoint(d),this._permissionService.updatePermissionPoint(d.id,s)}setRangeProtectionRanges(e,t,i,o){const s=this._rangeProtectionRuleModel.getRule(e,t,i);if(s){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(a.SetRangeProtectionMutation.id,{unitId:e,subUnitId:t,ruleId:i,rule:{...s,ranges:o.map(l=>l.getRange())}})}}getPermissionInfoWithCell(e,t,i,o){const s=h.cellToRange(i,o),d=this._rangeProtectionRuleModel.getSubunitRuleList(e,t).find(u=>u.ranges.some(m=>h.Rectangle.intersects(s,m)));if(d)return{permissionId:d.permissionId,ruleId:d.id}}},c.FPermission=re([E(0,h.Inject(h.Injector)),E(1,h.ICommandService),E(2,h.IPermissionService),E(3,h.Inject(a.WorksheetProtectionRuleModel)),E(4,h.Inject(a.RangeProtectionRuleModel)),E(5,h.Inject(a.WorksheetProtectionPointModel)),E(6,h.Inject(a.WorkbookPermissionService)),E(7,h.Inject(h.IAuthzIoService))],c.FPermission);var oe=Object.getOwnPropertyDescriptor,se=(r,n,e,t)=>{for(var i=t>1?void 0:t?oe(n,e):n,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(i)||i);return i},ae=(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:s,style:d}of this._selections)h.Rectangle.contains(s,n.getRange())?(t.push({range:s,primary:a.getPrimaryForRange(n.getRange(),this._worksheet),style:d}),i=!0):t.push({range:s,primary:null,style:d});i||(t=[{range:n.getRange(),primary:a.getPrimaryForRange(n.getRange(),this._worksheet)}]);const o={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),selections:t};return e.syncExecuteCommand(a.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=a.getNextPrimaryCell(this._selections.concat(),n,this._worksheet);return t?this._injector.createInstance(c.FRange,this._workbook,this._worksheet,t):null}},c.FSelection=se([ae(3,h.Inject(h.Injector))],c.FSelection);var x=(r=>(r[r.Reader=0]="Reader",r[r.Editor=1]="Editor",r[r.Owner=2]="Owner",r[r.UNRECOGNIZED=-1]="UNRECOGNIZED",r))(x||{}),he=Object.getOwnPropertyDescriptor,de=(r,n,e,t)=>{for(var i=t>1?void 0:t?he(n,e):n,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(i)||i);return i},B=(r,n)=>(e,t)=>n(e,t,r);let y=class{constructor(r,n,e,t,i,o,s,d,u){this._unitId=r,this._subUnitId=n,this._ruleId=e,this._permissionId=t,this._ranges=i,this._options=o,this._injector=s,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(s=>{const d=s.getRange();return this._rangesIntersect(d,o)}))))throw new Error("Range protection cannot intersect with other protection rules");await this._commandService.executeCommand(a.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 updateOptions(r){const n=this._rangeProtectionRuleModel.getRule(this._unitId,this._subUnitId,this._ruleId);if(!n)throw new Error(`Rule ${this._ruleId} not found`);const e={...this._options,...r};await this._commandService.executeCommand(a.SetRangeProtectionMutation.id,{unitId:this._unitId,subUnitId:this._subUnitId,ruleId:this._ruleId,rule:{...n}}),Object.assign(this._options,e)}async remove(){await this._commandService.executeCommand(a.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=de([B(6,h.Inject(h.Injector)),B(7,h.Inject(h.ICommandService)),B(8,h.Inject(a.RangeProtectionRuleModel))],y);var q=(r=>(r[r.Reader=0]="Reader",r[r.Editor=1]="Editor",r[r.Owner=2]="Owner",r))(q||{}),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||{}),b=(r=>(r.Edit="RangeEdit",r.View="RangeView",r.ManageCollaborator="RangeManageCollaborator",r.Delete="RangeDeleteProtection",r))(b||{});const V={[g.Edit]:a.WorkbookEditablePermission,[g.View]:a.WorkbookViewPermission,[g.Print]:a.WorkbookPrintPermission,[g.Export]:a.WorkbookExportPermission,[g.Share]:a.WorkbookSharePermission,[g.CopyContent]:a.WorkbookCopyPermission,[g.DuplicateFile]:a.WorkbookDuplicatePermission,[g.Comment]:a.WorkbookCommentPermission,[g.ManageCollaborator]:a.WorkbookManageCollaboratorPermission,[g.CreateSheet]:a.WorkbookCreateSheetPermission,[g.DeleteSheet]:a.WorkbookDeleteSheetPermission,[g.RenameSheet]:a.WorkbookRenameSheetPermission,[g.MoveSheet]:a.WorkbookMoveSheetPermission,[g.HideSheet]:a.WorkbookHideSheetPermission,[g.ViewHistory]:a.WorkbookViewHistoryPermission,[g.ManageHistory]:a.WorkbookHistoryPermission,[g.RecoverHistory]:a.WorkbookRecoverHistoryPermission,[g.CreateProtection]:a.WorkbookCreateProtectPermission,[g.InsertRow]:a.WorkbookInsertRowPermission,[g.InsertColumn]:a.WorkbookInsertColumnPermission,[g.DeleteRow]:a.WorkbookDeleteRowPermission,[g.DeleteColumn]:a.WorkbookDeleteColumnPermission,[g.CopySheet]:a.WorkbookCopySheetPermission},A={[S.Edit]:a.WorksheetEditPermission,[S.View]:a.WorksheetViewPermission,[S.Copy]:a.WorksheetCopyPermission,[S.SetCellValue]:a.WorksheetSetCellValuePermission,[S.SetCellStyle]:a.WorksheetSetCellStylePermission,[S.SetRowStyle]:a.WorksheetSetRowStylePermission,[S.SetColumnStyle]:a.WorksheetSetColumnStylePermission,[S.InsertRow]:a.WorksheetInsertRowPermission,[S.InsertColumn]:a.WorksheetInsertColumnPermission,[S.DeleteRow]:a.WorksheetDeleteRowPermission,[S.DeleteColumn]:a.WorksheetDeleteColumnPermission,[S.Sort]:a.WorksheetSortPermission,[S.Filter]:a.WorksheetFilterPermission,[S.PivotTable]:a.WorksheetPivotTablePermission,[S.InsertHyperlink]:a.WorksheetInsertHyperlinkPermission,[S.EditExtraObject]:a.WorksheetEditExtraObjectPermission,[S.ManageCollaborator]:a.WorksheetManageCollaboratorPermission,[S.DeleteProtection]:a.WorksheetDeleteProtectionPermission,[S.SelectProtectedCells]:a.WorksheetSelectProtectedCellsPermission,[S.SelectUnProtectedCells]:a.WorksheetSelectUnProtectedCellsPermission},j={[b.Edit]:a.RangeProtectionPermissionEditPoint,[b.View]:a.RangeProtectionPermissionViewPoint,[b.ManageCollaborator]:a.RangeProtectionPermissionManageCollaPoint,[b.Delete]:a.RangeProtectionPermissionDeleteProtectionPoint};var ue=Object.getOwnPropertyDescriptor,le=(r,n,e,t)=>{for(var i=t>1?void 0:t?ue(n,e):n,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(i)||i);return i},W=(r,n)=>(e,t)=>n(e,t,r);let H=class{constructor(r,n,e,t,i,o,s){k(this,"_permissionSubject");k(this,"_rangeRulesSubject");k(this,"permission$");k(this,"pointChange$");k(this,"rangeProtectionChange$");k(this,"rangeProtectionRules$");k(this,"_unitId");k(this,"_subUnitId");k(this,"_subscriptions",[]);this._worksheet=r,this._injector=n,this._permissionService=e,this._authzIoService=t,this._commandService=i,this._rangeProtectionRuleModel=o,this._worksheetProtectionPointModel=s,this._unitId=this._worksheet.getWorkbook().getUnitId(),this._subUnitId=this._worksheet.getSheetId(),this._permissionSubject=new M.BehaviorSubject(this._buildSnapshot()),this._rangeRulesSubject=new M.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(w.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(w.distinctUntilChanged((n,e)=>JSON.stringify(n)===JSON.stringify(e)),w.shareReplay({bufferSize:1,refCount:!0}))}_createPointChangeStream(){return this._permissionService.permissionPointUpdate$.pipe(w.filter(r=>r.id.includes(this._unitId)&&r.id.includes(this._subUnitId)),w.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}),w.filter(r=>r!==null),w.shareReplay({bufferSize:1,refCount:!0}))}_createRangeProtectionChangeStream(){return this._rangeProtectionRuleModel.ruleChange$.pipe(w.filter(r=>r.unitId===this._unitId&&r.subUnitId===this._subUnitId),w.map(r=>{const n=this._buildRangeProtectionRules();return{type:r.type==="delete"?"delete":r.type==="set"?"update":"add",rules:n}}),w.shareReplay({bufferSize:1,refCount:!0}))}_createRangeProtectionRulesStream(){const r=this._rangeProtectionRuleModel.ruleChange$.pipe(w.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(w.distinctUntilChanged((n,e)=>n.length!==e.length?!1:n.every((t,i)=>t.id===e[i].id)),w.shareReplay({bufferSize:1,refCount:!0}))}_extractWorksheetPointType(r){for(const[n,e]of Object.entries(A))if(new e(this._unitId,this._subUnitId).id===r)return n;return null}_getRuleEditPermission(r){var i;const n=j[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 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(y,this._unitId,this._subUnitId,n.id,n.permissionId,e,{name:n.description||"",allowEdit:this._getRuleEditPermission(n)})})}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=A[i];if(!o)throw new Error(`Unknown worksheet permission point: ${i}`);const s=this.getPoint(i);if(s===t)continue;const d=new o(this._unitId,this._subUnitId);this._permissionService.getPermissionPoint(d.id)||this._permissionService.addPermissionPoint(d),this._permissionService.updatePermissionPoint(d.id,t),n.push({point:i,value:t,oldValue:s})}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)}debugCellPermission(r,n){const e=[],t=this._rangeProtectionRuleModel.getSubunitRuleList(this._unitId,this._subUnitId);for(const i of t)for(const o of i.ranges)if(r>=o.startRow&&r<=o.endRow&&n>=o.startColumn&&n<=o.endColumn){e.push({ruleId:i.id,rangeRefs:i.ranges.map(s=>`R${s.startRow}C${s.startColumn}:R${s.endRow}C${s.endColumn}`),options:{name:i.description||"",allowEdit:this._getRuleEditPermission(i)}});break}return e.length===0?null:{row:r,col:n,hitRules:e}}async setPoint(r,n){const e=A[r];if(!e)throw new Error(`Unknown worksheet permission point: ${r}`);if(this.getPoint(r)===n)return;const i=new e(this._unitId,this._subUnitId);this._permissionService.getPermissionPoint(i.id)||this._permissionService.addPermissionPoint(i),this._permissionService.updatePermissionPoint(i.id,n);const s=this._buildSnapshot();this._permissionSubject.next(s)}getPoint(r){var i;const n=A[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 s,d,u,l;return this._authzIoService.create({objectType:a.UnitObject.SelectRange,selectRangeObject:{collaborators:(u=(d=(s=o.options)==null?void 0:s.allowedUsers)==null?void 0:d.map(m=>({id:m,role:x.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,s)=>{var l;const d=this._determineViewState(o.options),u=this._determineEditState(o.options);return{permissionId:n[s],unitType:a.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(a.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,s)=>this._setPermissionPoints(n[s],o.options))),e.map((o,s)=>this._injector.createInstance(y,this._unitId,this._subUnitId,o.id,o.permissionId,r[s].ranges,r[s].options||{}))}_determineViewState(r){return(r==null?void 0:r.allowViewByOthers)===!1?a.ViewStateEnum.NoOneElseCanView:a.ViewStateEnum.OthersCanView}_determineEditState(r){var n;return(r==null?void 0:r.allowEdit)===!0&&((n=r==null?void 0:r.allowedUsers)!=null&&n.length)?a.EditStateEnum.DesignedUserCanEdit:a.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=j[n];if(!t)return;const i=new t(this._unitId,this._subUnitId,r);this._permissionService.getPermissionPoint(i.id)||this._permissionService.addPermissionPoint(i),this._permissionService.updatePermissionPoint(i.id,e)}async unprotectRules(r){!r||r.length===0||await this._commandService.executeCommand(a.DeleteRangeProtectionMutation.id,{unitId:this._unitId,subUnitId:this._subUnitId,ruleIds: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()}};H=le([W(1,h.Inject(h.Injector)),W(2,h.IPermissionService),W(3,h.IAuthzIoService),W(4,h.ICommandService),W(5,h.Inject(a.RangeProtectionRuleModel)),W(6,h.Inject(a.WorksheetProtectionPointModel))],H);function ce(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 J(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 me(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 Z(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 $(r,n){return{startRow:r.startRow,endRow:r.endRow,startColumn:0,endColumn:n.getColumnCount()-1,rangeType:h.RANGE_TYPE.ROW}}function L(r,n){return{startRow:0,endRow:n.getRowCount()-1,startColumn:r.startColumn,endColumn:r.endColumn,rangeType:h.RANGE_TYPE.COLUMN}}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,s;o>=0;o--)(s=r[o])&&(i=s(i)||i);return i},F=(r,n)=>(e,t)=>n(e,t,r);c.FWorksheet=class extends I.FBaseInitialable{constructor(e,t,i,o,s,d,u){super(o);k(this,"setActiveSelection",this.setActiveRange);this._fWorkbook=e,this._workbook=t,this._worksheet=i,this._injector=o,this._selectionManagerService=s,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(a.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(),s={unitId:i,subUnitId:o,columnData:{[e]:{s:t}}};return this._commandService.syncExecuteCommand(a.SetColDataCommand.id,s),this}setRowDefaultStyle(e,t){const i=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),s={unitId:i,subUnitId:o,rowData:{[e]:{s:t}}};return this._commandService.syncExecuteCommand(a.SetRowDataCommand.id,s),this}getRange(e,t,i,o){let s,d;if(typeof e=="object")s=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,s={...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,s={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,s)}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(),s=h.Direction.DOWN,d=e+1,u=e+t,l=0,m=this._worksheet.getColumnCount()-1,_=a.copyRangeStyles(this._worksheet,d,u,l,m,!0,e);return this._commandService.syncExecuteCommand(a.InsertRowByRangeCommand.id,{unitId:i,subUnitId:o,direction:s,range:{startRow:d,endRow:u,startColumn:l,endColumn:m},cellValue:_}),this}insertRowsBefore(e,t){const i=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),s=h.Direction.UP,d=e,u=e+t-1,l=0,m=this._worksheet.getColumnCount()-1,_=a.copyRangeStyles(this._worksheet,d,u,l,m,!0,e-1);return this._commandService.syncExecuteCommand(a.InsertRowByRangeCommand.id,{unitId:i,subUnitId:o,direction:s,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(a.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(),s=$(e.getRange(),this._worksheet),d=s,u={startRow:t,endRow:t,startColumn:s.startColumn,endColumn:s.endColumn};return this._commandService.syncExecuteCommand(a.MoveRowsCommand.id,{unitId:i,subUnitId:o,range:s,fromRange:d,toRange:u}),this}hideRow(e){const t=this._workbook.getUnitId(),i=this._worksheet.getSheetId(),o=$(e.getRange(),this._worksheet);return this._commandService.syncExecuteCommand(a.SetRowHiddenCommand.id,{unitId:t,subUnitId:i,ranges:[o]}),this}hideRows(e,t=1){const i=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),s={startRow:e,endRow:e+t-1,startColumn:0,endColumn:this._worksheet.getColumnCount()-1,rangeType:h.RANGE_TYPE.ROW};return this._commandService.syncExecuteCommand(a.SetRowHiddenCommand.id,{unitId:i,subUnitId:o,ranges:[s]}),this}unhideRow(e){const t=this._workbook.getUnitId(),i=this._worksheet.getSheetId(),o=$(e.getRange(),this._worksheet);return this._commandService.syncExecuteCommand(a.SetSpecificRowsVisibleCommand.id,{unitId:t,subUnitId:i,ranges:[o]}),this}showRows(e,t=1){const i=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),s={startRow:e,endRow:e+t-1,startColumn:0,endColumn:this._worksheet.getColumnCount()-1,rangeType:h.RANGE_TYPE.ROW};return this._commandService.syncExecuteCommand(a.SetSpecificRowsVisibleCommand.id,{unitId:i,subUnitId:o,ranges:[s]}),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(),s=[{startRow:e,endRow:e,startColumn:0,endColumn:this._worksheet.getColumnCount()-1}];return this._commandService.syncExecuteCommand(a.SetTextWrapCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:s[0],value:h.WrapStrategy.WRAP}),this._commandService.syncExecuteCommand(a.SetWorksheetRowIsAutoHeightMutation.id,{unitId:i,subUnitId:o,ranges:s,autoHeightInfo:t}),this}setRowHeights(e,t,i){var m;const o=this._workbook.getUnitId(),s=this._worksheet.getSheetId(),d=this._worksheet.getRowManager(),u=[],l=[];for(let _=e;_<e+t;_++){const C=((m=d.getRow(_))==null?void 0:m.ah)||this._worksheet.getConfig().defaultRowHeight,v={startRow:_,endRow:_,startColumn:0,endColumn:this._worksheet.getColumnCount()-1};i<=C?u.push(v):l.push(v)}return l.length>0&&this._commandService.syncExecuteCommand(a.SetRowHeightCommand.id,{unitId:o,subUnitId:s,ranges:l,value:i}),u.length>0&&this._commandService.syncExecuteCommand(a.SetWorksheetRowIsAutoHeightCommand.id,{unitId:o,subUnitId:s,ranges:u}),this}getRowHeight(e){return this._worksheet.getRowHeight(e)}setRowAutoHeight(e,t){const i=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),s=[{startRow:e,endRow:e+t-1,startColumn:0,endColumn:this._worksheet.getColumnCount()-1}];return this._commandService.syncExecuteCommand(a.SetWorksheetRowIsAutoHeightCommand.id,{unitId:i,subUnitId:o,ranges:s}),this}setRangesAutoHeight(e){const t=this._workbook.getUnitId(),i=this._worksheet.getSheetId();return this._commandService.syncExecuteCommand(a.SetWorksheetRowIsAutoHeightCommand.id,{unitId:t,subUnitId:i,ranges:e}),this}setRowHeightsForced(e,t,i){const o=this._workbook.getUnitId(),s=this._worksheet.getSheetId(),d=[{startRow:e,endRow:e+t-1,startColumn:0,endColumn:this._worksheet.getColumnCount()-1}];return this._commandService.syncExecuteCommand(a.SetRowHeightCommand.id,{unitId:o,subUnitId:s,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 s={unitId:t,subUnitId:i,rowData:o};return this._commandService.syncExecuteCommand(a.SetRowDataCommand.id,s),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(),s=h.Direction.RIGHT,d=0,u=this._worksheet.getRowCount()-1,l=e+1,m=e+t,_=a.copyRangeStyles(this._worksheet,d,u,l,m,!1,e);return this._commandService.syncExecuteCommand(a.InsertColByRangeCommand.id,{unitId:i,subUnitId:o,direction:s,range:{startRow:d,endRow:u,startColumn:l,endColumn:m},cellValue:_}),this}insertColumnsBefore(e,t){const i=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),s=h.Direction.LEFT,d=0,u=this._worksheet.getRowCount()-1,l=e,m=e+t-1,_=a.copyRangeStyles(this._worksheet,d,u,l,m,!1,e-1);return this._commandService.syncExecuteCommand(a.InsertColByRangeCommand.id,{unitId:i,subUnitId:o,direction:s,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(a.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(),s=L(e.getRange(),this._worksheet),d=s,u={startRow:0,endRow:this._worksheet.getRowCount()-1,startColumn:t,endColumn:t};return this._commandService.syncExecuteCommand(a.MoveColsCommand.id,{unitId:i,subUnitId:o,range:s,fromRange:d,toRange:u}),this}hideColumn(e){const t=this._workbook.getUnitId(),i=this._worksheet.getSheetId(),o=L(e.getRange(),this._worksheet);return this._commandService.syncExecuteCommand(a.SetColHiddenCommand.id,{unitId:t,subUnitId:i,ranges:[o]}),this}hideColumns(e,t=1){const i=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),s={startRow:0,endRow:this._worksheet.getRowCount()-1,startColumn:e,endColumn:e+t-1,rangeType:h.RANGE_TYPE.COLUMN};return this._commandService.syncExecuteCommand(a.SetColHiddenCommand.id,{unitId:i,subUnitId:o,ranges:[s]}),this}unhideColumn(e){const t=this._workbook.getUnitId(),i=this._worksheet.getSheetId(),o=L(e.getRange(),this._worksheet);return this._commandService.syncExecuteCommand(a.SetSpecificColsVisibleCommand.id,{unitId:t,subUnitId:i,ranges:[o]}),this}showColumns(e,t=1){const i=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),s={startRow:0,endRow:this._worksheet.getRowCount()-1,startColumn:e,endColumn:e+t-1,rangeType:h.RANGE_TYPE.COLUMN};return this._commandService.syncExecuteCommand(a.SetSpecificColsVisibleCommand.id,{unitId:i,subUnitId:o,ranges:[s]}),this}setColumnWidth(e,t){return this.setColumnWidths(e,1,t)}setColumnWidths(e,t,i){const o=this._workbook.getUnitId(),s=this._worksheet.getSheetId(),d=[{startColumn:e,endColumn:e+t-1,startRow:0,endRow:this._worksheet.getRowCount()-1}];return this._commandService.syncExecuteCommand(a.SetColWidthCommand.id,{unitId:o,subUnitId:s,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 s={unitId:t,subUnitId:i,columnData:o};return this._commandService.syncExecuteCommand(a.SetColDataCommand.id,s),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(a.SetFrozenCommand.id,{...e,unitId:this._workbook.getUnitId(),subUnitId:this.getSheetId()}),this}cancelFreeze(){return this._commandService.syncExecuteCommand(a.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(a.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(a.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(a.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(a.SetGridlinesColorCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),color:e}),this}getGridLinesColor(){return this._worksheet.getGridlinesColor()}setTabColor(e){return this._commandService.syncExecuteCommand(a.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===a.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===a.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(s=>s.isSheetHidden()!==h.BooleanNumber.TRUE).length<=1)throw new Error("Cannot hide the only visible sheet");return e.syncExecuteCommand(a.SetWorksheetHideCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId()}),this}showSheet(){return this._injector.get(h.ICommandService).syncExecuteCommand(a.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(a.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),s={startRow:0,endRow:this._worksheet.getRowCount()-1,startColumn:0,endColumn:this._worksheet.getColumnCount()-1};return o.syncExecuteCommand(a.ClearSelectionAllCommand.id,{unitId:t,subUnitId:i,ranges:[s],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(a.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(a.ClearSelectionFormatCommand.id,{unitId:e,subUnitId:t,ranges:[o]}),this}getDataRange(){const e=this.getLastRows(),t=this.getLastColumns();return this.getRange(0,0,e+1,t+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(T).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(),s=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(a.AppendRowCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),cellValue:u.getMatrix(),insertRowNums:d>o-1?1:0,insertColumnNums:e.length>s?e.length-s:0,maxRows:o,maxColumns:s}),this}setRowCount(e){return this._commandService.syncExecuteCommand(a.SetWorksheetRowCountCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),rowCount:e}),this}setColumnCount(e){return this._commandService.syncExecuteCommand(a.SetWorksheetColumnCountCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),columnCount:e}),this}getWorksheetPermission(){return this._injector.createInstance(H,this)}},c.FWorksheet=_e([F(3,h.Inject(h.Injector)),F(4,h.Inject(a.SheetsSelectionsService)),F(5,h.Inject(h.ILogService)),F(6,h.ICommandService)],c.FWorksheet);var Se=Object.getOwnPropertyDescriptor,we=(r,n,e,t)=>{for(var i=t>1?void 0:t?Se(n,e):n,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(i)||i);return i},N=(r,n)=>(e,t)=>n(e,t,r);let z=class{constructor(r,n,e,t,i,o,s,d,u){k(this,"_permissionSubject");k(this,"_subscriptions",[]);k(this,"permission$");k(this,"protectionChange$");this._unitId=r,this._subUnitId=n,this._range=e,this._worksheet=t,this._injector=i,this._permissionService=o,this._authzIoService=s,this._commandService=d,this._rangeProtectionRuleModel=u,this._permissionSubject=new M.BehaviorSubject(this._buildSnapshot()),this.permission$=this._createPermissionStream(),this.protectionChange$=this._createProtectionChangeStream()}_createPermissionStream(){const r=this._permissionService.permissionPointUpdate$.pipe(w.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(w.distinctUntilChanged((n,e)=>JSON.stringify(n)===JSON.stringify(e)),w.shareReplay({bufferSize:1,refCount:!0}))}_createProtectionChangeStream(){return this._rangeProtectionRuleModel.ruleChange$.pipe(w.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),w.map(r=>(this._permissionSubject.next(this._buildSnapshot()),r.type==="delete"?{type:"unprotected",ruleId:r.rule.id}:{type:"protected",rule:this._createFacadeRule(r.rule)})),w.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!==a.ViewStateEnum.NoOneElseCanView,allowEdit:r.editState===a.EditStateEnum.DesignedUserCanEdit};return this._injector.createInstance(y,this._unitId,this._subUnitId,r.id,r.permissionId,n,e)}getPoint(r){const n=j[r];if(!n)return console.warn(`Unknown permission point: ${r}`),!1;const e=this._getProtectionRule();if(e){const s=new n(this._unitId,this._subUnitId,e.permissionId),d=this._permissionService.getPermissionPoint(s.id);if(d)return d.value}const t=this._getLocalPermissionId(),i=new n(this._unitId,this._subUnitId,t),o=this._permissionService.getPermissionPoint(i.id);return o?o.value:!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=j[r];if(!e)throw new Error(`Unknown permission point: ${r}`);if(this.getPoint(r)===n)return;const i=this._getProtectionRule(),o=(i==null?void 0:i.permissionId)||this._getLocalPermissionId(),s=new e(this._unitId,this._subUnitId,o);this._permissionService.getPermissionPoint(s.id)||this._permissionService.addPermissionPoint(s),this._permissionService.updatePermissionPoint(s.id,n),this._permissionSubject.next(this._buildSnapshot())}_getLocalPermissionId(){const r=this._range.getRange();return`local-${this._unitId}-${this._subUnitId}-${r.startRow}-${r.startColumn}-${r.endRow}-${r.endColumn}`}async protect(r){var d,u;if(this.isProtected())throw new Error("Range is already protected");const n=await this._authzIoService.create({objectType:a.UnitObject.SelectRange,selectRangeObject:{collaborators:(u=(d=r==null?void 0:r.allowedUsers)==null?void 0:d.map(l=>({id:l,role:x.Editor,subject:void 0})))!=null?u:[],unitID:this._unitId,name:(r==null?void 0:r.name)||"",scope:void 0}}),e=this._rangeProtectionRuleModel.createRuleId(this._unitId,this._subUnitId),t=this._range.getRange(),i=this._determineViewState(r),o=this._determineEditState(r);return await this._commandService.executeCommand(a.AddRangeProtectionMutation.id,{unitId:this._unitId,subUnitId:this._subUnitId,rules:[{id:e,permissionId:n,unitType:3,unitId:this._unitId,subUnitId:this._subUnitId,ranges:[t],description:r==null?void 0:r.name,viewState:i,editState:o}]}),await this._setPermissionPoints(n,r),this._injector.createInstance(y,this._unitId,this._subUnitId,e,n,[this._range],r||{})}_determineViewState(r){return(r==null?void 0:r.allowViewByOthers)===!1?a.ViewStateEnum.NoOneElseCanView:a.ViewStateEnum.OthersCanView}_determineEditState(r){var n;return(r==null?void 0:r.allowEdit)===!0&&((n=r==null?void 0:r.allowedUsers)!=null&&n.length)?a.EditStateEnum.DesignedUserCanEdit:a.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=j[n];if(!t)return;const i=new t(this._unitId,this._subUnitId,r);this._permissionService.getPermissionPoint(i.id)||this._permissionService.addPermissionPoint(i),this._permissionService.updatePermissionPoint(i.id,e)}async unprotect(){const r=this._getProtectionRule();if(!r)return;const n=r.id;await this._commandService.executeCommand(a.DeleteRangeProtectionMutation.id,{unitId:this._unitId,subUnitId:this._subUnitId,ruleIds:[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!==a.ViewStateEnum.NoOneElseCanView};return n.editState===a.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!==a.ViewStateEnum.NoOneElseCanView};if(e.editState===a.EditStateEnum.DesignedUserCanEdit)try{const s=(await this._authzIoService.listCollaborators({objectID:e.permissionId,unitID:this._unitId})).filter(d=>d.role===x.Editor).map(d=>{var u;return((u=d.subject)==null?void 0:u.userID)||d.id});i.allowEdit=s.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()}};z=we([N(4,h.Inject(h.Injector)),N(5,h.Inject(h.IPermissionService)),N(6,h.Inject(h.IAuthzIoService)),N(7,h.Inject(h.ICommandService)),N(8,h.Inject(a.RangeProtectionRuleModel))],z);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,s;o>=0;o--)(s=r[o])&&(i=s(i)||i);return i},G=(r,n)=>(e,t)=>n(e,t,r);c.FRange=(D=class extends I.FBaseInitialable{constructor(n,e,t,i,o,s){super(i),this._workbook=n,this._worksheet=e,this._range=t,this._injector=i,this._commandService=o,this._formulaDataModel=s,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(s=>h.Rectangle.equals(s,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,s)=>{if(!o)return null;const d=n!=="cell"?this._worksheet.getComposedCellStyle(i+this._range.startRow,s+this._range.startColumn,n==="row"):this._worksheet.getCellStyle(i+this._range.startRow,s+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,s=[];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);s.push(m)}return s}getRawValues(){var d,u;const n=this._worksheet.getCellMatrix(),{startRow:e,endRow:t,startColumn:i,endColumn:o}=this._range,s=[];for(let l=e;l<=t;l++){const m=[];for(let _=i;_<=o;_++){const C=n.getValue(l,_);C!=null&&C.p&&((d=C.p.body)!=null&&d.dataStream)?m.push(C.p.body.dataStream):m.push((u=C==null?void 0:C.v)!=null?u:null)}s.push(m)}return s}getDisplayValues(){var s,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 C=this._worksheet.getCell(l,_);C!=null&&C.p&&((s=C.p.body)!=null&&s.dataStream)?m.push(C.p.body.dataStream):m.push((u=(d=C==null?void 0:C.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 s=n;s<=e;s++){const d=[];for(let u=t;u<=i;u++)d.push(this._worksheet.getCellRaw(s,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,s=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,s,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 J(n)}getHorizontalAlignments(){return this._worksheet.getRange(this._range).getHorizontalAlignments().map(e=>e.map(t=>J(t)))}getVerticalAlignment(){return Z(this._worksheet.getRange(this._range).getVerticalAlignment())}getVerticalAlignments(){return this._worksheet.getRange(this._range).getVerticalAlignments().map(e=>e.map(t=>Z(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(a.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(a.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(a.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(a.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(a.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(a.SetRangeValuesCommand.id,t),this}setRichTextValues(n){const e=n.map(o=>o.map(s=>s&&{p:s instanceof h.RichTextValue?s.getData():s})),t=h.covertCellValues(e,this._range),i={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,value:t};return this._commandService.syncExecuteCommand(a.SetRangeValuesCommand.id,i),this}setWrap(n){return this._commandService.syncExecuteCommand(a.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(a.SetTextWrapCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,value:n}),this}setVerticalAlignment(n){return this._commandService.syncExecuteCommand(a.SetVerticalTextAlignCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,value:me(n)}),this}setHorizontalAlignment(n){return this._commandService.syncExecuteCommand(a.SetHorizontalTextAlignCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,value:ce(n)}),this}setValues(n){const e=h.covertCellValues(n,this._range);return this._commandService.syncExecuteCommand(a.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(a.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(a.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(a.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(a.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(a.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(a.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(a.SetStyleCommand.id,i),this}merge(n=!0){const e=this._workbook.getUnitId(),t=this._worksheet.getSheetId();return a.addMergeCellsUtil(this._injector,e,t,[this._range],n),this}mergeAcross(n=!0){const e=a.getAddMergeMutationRangeByType([this._range],h.Dimension.ROWS),t=this._workbook.getUnitId(),i=this._worksheet.getSheetId();return a.addMergeCellsUtil(this._injector,t,i,e,n),this}mergeVertically(n=!0){const e=a.getAddMergeMutationRangeByType([this._range],h.Dimension.COLUMNS),t=this._workbook.getUnitId(),i=this._worksheet.getSheetId();return a.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(a.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((s,d,u)=>{n(s,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:a.getPrimaryForRange(this.getRange(),this._worksheet),style:null}]};return this._commandService.syncExecuteCommand(a.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(a.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(a.SetWorksheetRangeThemeStyleCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,themeName:n})}removeThemeStyle(n){this._commandService.syncExecuteCommand(a.DeleteWorksheetRangeThemeStyleCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,themeName:n})}getUsedThemeStyle(){return this._injector.get(a.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(a.ClearSelectionAllCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),ranges:[this._range],options:n}),this)}clearContent(){return this._commandService.syncExecuteCommand(a.ClearSelectionContentCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),ranges:[this._range]}),this}clearFormat(){return this._commandService.syncExecuteCommand(a.ClearSelectionFormatCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),ranges:[this._range]}),this}insertCells(n){n===h.Dimension.ROWS?this._commandService.executeCommand(a.InsertRangeMoveDownCommand.id,{range:this._range}):this._commandService.executeCommand(a.InsertRangeMoveRightCommand.id,{range:this._range})}deleteCells(n){n===h.Dimension.ROWS?this._commandService.executeCommand(a.DeleteRangeMoveUpCommand.id,{range:this._range}):this._commandService.executeCommand(a.DeleteRangeMoveLeftCommand.id,{range:this._range})}getDataRegion(n){const{startRow:e,startColumn:t,endRow:i,endColumn:o}=this._range,s=this._worksheet.getMaxRows(),d=this._worksheet.getMaxColumns(),u=this._worksheet.getCellMatrix();let l=e,m=t,_=i,C=o;if(n!==h.Dimension.COLUMNS){let v=!1,U=!1;for(let p=t;p<=o&&(e>0&&!h.isNullCell(u.getValue(e-1,p))&&(v=!0),i<s-1&&!h.isNullCell(u.getValue(i+1,p))&&(U=!0),!(v&&U));p++);v&&(l=e-1),U&&(_=i+1)}if(n!==h.Dimension.ROWS){let v=!1,U=!1;for(let p=e;p<=i&&(t>0&&!h.isNullCell(u.getValue(p,t-1))&&(v=!0),o<d-1&&!h.isNullCell(u.getValue(p,o+1))&&(U=!0),!(v&&U));p++);v&&(m=t-1),U&&(C=o+1)}return this._injector.createInstance(c.FRange,this._workbook,this._worksheet,{startRow:l,startColumn:m,endRow:_,endColumn:C})}isBlank(){const n=this._worksheet.getCellMatrix(),{startRow:e,startColumn:t,endRow:i,endColumn:o}=this._range;let s=!0;for(let d=e;d<=i;d++){for(let u=t;u<=o;u++)if(!h.isNullCell(n.getValue(d,u))){s=!1;break}if(!s)break}return s}offset(n,e,t,i){const{startRow:o,startColumn:s,endRow:d,endColumn:u}=this._range,l=o+n,m=s+e,_=t?l+t-1:d+n,C=i?m+i-1:u+e;if(l<0||m<0||_<0||C<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:C})}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(z,this._workbook.getUnitId(),this._worksheet.getSheetId(),this,n)}},D._enableManualInit(),D),c.FRange=ke([G(3,h.Inject(h.Injector)),G(4,h.ICommandService),G(5,h.Inject(P.FormulaDataModel))],c.FRange);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,s;o>=0;o--)(s=r[o])&&(i=s(i)||i);return i},K=(r,n)=>(e,t)=>n(e,t,r);let Y=class{constructor(r,n,e,t){k(this,"_permissionSubject");k(this,"_collaboratorChangeSubject",new M.Subject);k(this,"permission$");k(this,"pointChange$");k(this,"collaboratorChange$");k(this,"_subscriptions",[]);this._unitId=r,this._injector=n,this._permissionService=e,this._authzIoService=t,this._permissionSubject=new M.BehaviorSubject(this._buildSnapshot()),this.permission$=this._createPermissionStream(),this.pointChange$=this._createPointChangeStream(),this.collaboratorChange$=this._collaboratorChangeSubject.asObservable().pipe(w.shareReplay({bufferSize:1,refCount:!0}))}_createPermissionStream(){const r=this._permissionService.permissionPointUpdate$.pipe(w.filter(n=>n.id.includes(this._unitId))).subscribe(()=>{this._permissionSubject.next(this._buildSnapshot())});return this._subscriptions.push(r),this._permissionSubject.asObservable().pipe(w.distinctUntilChanged((n,e)=>JSON.stringify(n)===JSON.stringify(e)),w.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(w.filter(n=>n.id.includes(this._unitId)),w.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}}),w.filter(n=>n!==null),w.shareReplay({bufferSize:1,refCount:!0}))}_extractWorkbookPointType(r){for(const n in g){const e=g[n],t=V[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=V[i];if(!o)throw new Error(`Unknown workbook permission point: ${i}`);const s=this.getPoint(i);if(s===t)continue;const d=new o(this._unitId);this._permissionService.getPermissionPoint(d.id)||this._permissionService.addPermissionPoint(d),this._permissionService.updatePermissionPoint(d.id,t),n.push({point:i,value:t,oldValue:s})}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=V[r];if(!e)throw new Error(`Unknown workbook permission point: ${r}`);if(this.getPoint(r)===n)return;const i=new e(this._unitId);this._permissionService.getPermissionPoint(i.id)||this._permissionService.addPermissionPoint(i),this._permissionService.updatePermissionPoint(i.id,n);const s=this._buildSnapshot();this._permissionSubject.next(s)}getPoint(r){var i;const n=V[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:q.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()}};Y=be([K(1,h.Inject(h.Injector)),K(2,h.IPermissionService),K(3,h.IAuthzIoService)],Y);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,s;o>=0;o--)(s=r[o])&&(i=s(i)||i);return i},f=(r,n)=>(e,t)=>n(e,t,r);c.FWorkbook=class extends I.FBaseInitialable{constructor(e,t,i,o,s,d,u,l,m,_){super(t);k(this,"id");this._workbook=e,this._injector=t,this._resourceLoaderService=i,this._selectionManagerService=o,this._univerInstanceService=s,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(a.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 s=h.mergeWorksheetSnapshotWithDefault(h.Tools.deepClone((l=o==null?void 0:o.sheet)!=null?l:{}));s.name=e,s.rowCount=t,s.columnCount=i,s.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(a.InsertSheetCommand.id,{unitId:this.id,index:d,sheet:s}),this._commandService.syncExecuteCommand(a.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(a.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=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(a.InsertSheetCommand.id,{unitId:this.id,index:o,sheet:i}),this._commandService.syncExecuteCommand(a.SetWorksheetActiveOperation.id,{unitId:this.id,subUnitId:this._workbook.getSheets()[o].getSheetId()});const s=this._workbook.getActiveSheet();if(!s)throw new Error("No active sheet found");return this._injector.createInstance(c.FWorksheet,this,this._workbook,s)}deleteSheet(e){const t=this.id,i=typeof e=="string"?e:e.getSheetId();return this._commandService.syncExecuteCommand(a.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 a.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 s={unitId:this.getId(),subUnitId:i,selections:[e].map(d=>({range:d.getRange(),primary:a.getPrimaryForRange(d.getRange(),o),style:null}))};return this._commandService.syncExecuteCommand(a.SetSelectionsOperation.id,s),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(s=>!!s.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(a.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(a.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(Y,this._workbook.getUnitId())}getDefinedName(e){const t=this._definedNamesService.getValueByName(this.id,e);return t?this._injector.createInstance(O,{...t,unitId:this.id}):null}getDefinedNames(){const e=this._definedNamesService.getDefinedNameMap(this.id);return e?Object.values(e).map(t=>this._injector.createInstance(O,{...t,unitId:this.id})):[]}insertDefinedName(e,t){const o=this._injector.createInstance(T).setName(e).setRef(t).build();return o.localSheetId=a.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(a.SetDefinedNameCommand.id,e)}updateDefinedNameBuilder(e){this._commandService.syncExecuteCommand(a.SetDefinedNameCommand.id,e)}getRegisteredRangeThemes(){return this._injector.get(a.SheetRangeThemeService).getRegisteredRangeThemes()}registerRangeTheme(e){this._commandService.syncExecuteCommand(a.RegisterWorksheetRangeThemeStyleCommand.id,{unitId:this.getId(),rangeThemeStyle:e})}unregisterRangeTheme(e){this._commandService.syncExecuteCommand(a.UnregisterWorksheetRangeThemeStyleCommand.id,{unitId:this.getId(),themeName:e})}createRangeThemeStyle(e,t){return new a.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([f(1,h.Inject(h.Injector)),f(2,h.Inject(h.IResourceLoaderService)),f(3,h.Inject(a.SheetsSelectionsService)),f(4,h.IUniverInstanceService),f(5,h.ICommandService),f(6,h.IPermissionService),f(7,h.ILogService),f(8,h.Inject(h.LocaleService)),f(9,P.IDefinedNamesService)],c.FWorkbook);class fe extends I.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===a.InsertSheetCommand.id){const o=t.params,{unitId:s,index:d,sheet:u}=o||{},l=s?this.getUniverSheet(s):(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===a.SetWorksheetActiveOperation.id){const{subUnitId:o,unitId:s}=t.params,d=s?this.getUniverSheet(s):(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===a.RemoveSheetCommand.id){const i=this.getCommandSheetTarget(t);if(!i)return;const{workbook:o,worksheet:s}=i,d={workbook:o,worksheet:s};if(this.fireEvent(this.Event.BeforeSheetDelete,d),d.cancel)throw new h.CanceledError}})),this.registerEventHandler(this.Event.BeforeSheetMove,()=>e.beforeCommandExecuted(t=>{if(t.id===a.SetWorksheetOrderMutation.id){const{fromOrder:i,toOrder:o}=t.params,s=this.getCommandSheetTarget(t);if(!s)return;const d={workbook:s.workbook,worksheet:s.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===a.SetWorksheetNameCommand.id){const{name:i}=t.params,o=this.getCommandSheetTarget(t);if(!o)return;const s={workbook:o.workbook,worksheet:o.worksheet,newName:i,oldName:o.worksheet.getSheetName()};if(this.fireEvent(this.Event.BeforeSheetNameChange,s),s.cancel)throw new h.CanceledError}})),this.registerEventHandler(this.Event.BeforeSheetTabColorChange,()=>e.beforeCommandExecuted(t=>{if(t.id===a.SetTabColorMutation.id){const{color:i}=t.params,o=this.getCommandSheetTarget(t);if(!o)return;const s={workbook:o.workbook,worksheet:o.worksheet,newColor:i,oldColor:o.worksheet.getTabColor()};if(this.fireEvent(this.Event.BeforeSheetTabColorChange,s),s.cancel)throw new h.CanceledError}})),this.registerEventHandler(this.Event.BeforeSheetHideChange,()=>e.beforeCommandExecuted(t=>{if(t.id===a.SetWorksheetHideMutation.id){const{hidden:i}=t.params,o=this.getCommandSheetTarget(t);if(!o)return;const s={workbook:o.workbook,worksheet:o.worksheet,hidden:!!i};if(this.fireEvent(this.Event.BeforeSheetHideChange,s),s.cancel)throw new h.CanceledError}})),this.registerEventHandler(this.Event.BeforeGridlineColorChange,()=>e.beforeCommandExecuted(t=>{var i;if(t.id===a.SetGridlinesColorCommand.id){const o=this.getCommandSheetTarget(t);if(!o)return;const s={...o,color:(i=t.params)==null?void 0:i.color};if(this.fireEvent(this.Event.BeforeGridlineColorChange,s),s.cancel)throw new h.CanceledError}})),this.registerEventHandler(this.Event.BeforeGridlineEnableChange,()=>e.beforeCommandExecuted(t=>{var i;if(t.id===a.ToggleGridlinesCommand.id){const o=this.getCommandSheetTarget(t);if(!o)return;const s={...o,enabled:!!((i=t.params)!=null&&i.showGridlines)};if(this.fireEvent(this.Event.BeforeGridlineEnableChange,s),s.cancel)throw new h.CanceledError}})),this.registerEventHandler(this.Event.SheetValueChanged,()=>e.onCommandExecuted(t=>{if(a.COMMAND_LISTENER_VALUE_CHANGE.indexOf(t.id)>-1){if(!this.getActiveSheet())return;const o=a.getValueChangedEffectedRange(t).map(s=>{var d,u;return(u=(d=this.getWorkbook(s.unitId))==null?void 0:d.getSheetBySheetId(s.subUnitId))==null?void 0:u.getRange(s.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===a.InsertSheetCommand.id){const o=t.params,{unitId:s}=o||{},d=s?this.getUniverSheet(s):(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===a.SetWorksheetActiveOperation.id){const i=this.getActiveSheet();if(!i)return;const{workbook:o,worksheet:s}=i;this._fireActiveSheetChanged(o,s)}})),this.registerEventHandler(this.Event.SheetDeleted,()=>e.onCommandExecuted(t=>{var i;if(t.id===a.RemoveSheetCommand.id){const{subUnitId:o,unitId:s}=t.params,d=s?this.getUniverSheet(s):(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===a.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===a.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===a.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===a.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===a.SetGridlinesColorCommand.id||t.id===a.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(T)}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(a.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})}}I.FUniver.extend(fe);class Q{get SheetValueChangeType(){return a.SheetValueChangeType}get SheetSkeletonChangeType(){return a.SheetSkeletonChangeType}get SplitDelimiterType(){return a.SplitDelimiterEnum}}I.FEnum.extend(Q);class X{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"}}I.FEventName.extend(X);var pe=Object.getOwnPropertyDescriptor,Pe=(r,n,e,t)=>{for(var i=t>1?void 0:t?pe(n,e):n,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(i)||i);return i},Ee=(r,n)=>(e,t)=>n(e,t,r);c.FSheetHooks=class extends I.FBase{constructor(n){super(),this._injector=n}},c.FSheetHooks=Pe([Ee(0,h.Inject(h.Injector))],c.FSheetHooks),c.FSheetEventName=X,c.FSheetsEnum=Q,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,I,a,P,M,w){"use strict";var ye=Object.defineProperty;var Ue=(c,h,I)=>h in c?ye(c,h,{enumerable:!0,configurable:!0,writable:!0,value:I}):c[h]=I;var k=(c,h,I)=>Ue(c,typeof h!="symbol"?h+"":h,I);var D;var ee=Object.getOwnPropertyDescriptor,te=(r,n,e,t)=>{for(var i=t>1?void 0:t?ee(n,e):n,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(i)||i);return i},R=(r,n)=>(e,t)=>n(e,t,r);function ne(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,s=n.t("definedName.defaultName")+o;if(e.getValueByName(r,s)==null)return s;let d=o+1;for(;;){const u=n.t("definedName.defaultName")+d;if(e.getValueByName(r,u)==null)return u;d++}}class T{constructor(){k(this,"_definedNameParam");this._definedNameParam={id:h.generateRandomId(10),unitId:"",name:"",formulaOrRefString:"",localSheetId:a.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=a.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 O=class extends I.FBase{constructor(r,n,e,t,i,o,s,d,u,l){super(),this._definedNameParam=r,this._injector=n,this._commandService=e,this._permissionService=t,this._worksheetProtectionRuleModel=i,this._rangeProtectionRuleModel=o,this._worksheetProtectionPointRuleModel=s,this._authzIoService=d,this._localeService=u,this._definedNamesService=l}_apply(){this._definedNameParam.name===""&&(this._definedNameParam.name=ne(this._definedNameParam.unitId,this._localeService,this._definedNamesService)),this._commandService.syncExecuteCommand(a.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=a.SCOPE_WORKBOOK_VALUE_DEFINED_NAME,this._apply()}setHidden(r){this._definedNameParam.hidden=r,this._apply()}delete(){this._commandService.syncExecuteCommand(a.RemoveDefinedNameCommand.id,this._definedNameParam)}getLocalSheetId(){return this._definedNameParam.localSheetId}isWorkbookScope(){return this._definedNameParam.localSheetId===a.SCOPE_WORKBOOK_VALUE_DEFINED_NAME}toBuilder(){const r=this._injector.createInstance(T);return r.load(this._definedNameParam),r}};O=te([R(1,h.Inject(h.Injector)),R(2,h.ICommandService),R(3,h.IPermissionService),R(4,h.Inject(a.WorksheetProtectionRuleModel)),R(5,h.Inject(a.RangeProtectionRuleModel)),R(6,h.Inject(a.WorksheetProtectionPointModel)),R(7,h.Inject(h.IAuthzIoService)),R(8,h.Inject(h.LocaleService)),R(9,P.IDefinedNamesService)],O);var ie=Object.getOwnPropertyDescriptor,re=(r,n,e,t)=>{for(var i=t>1?void 0:t?ie(n,e):n,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(i)||i);return i},E=(r,n)=>(e,t)=>n(e,t,r);c.FPermission=class extends I.FBase{constructor(e,t,i,o,s,d,u,l){super();k(this,"permissionPointsDefinition",a.PermissionPointsDefinitions);k(this,"rangeRuleChangedAfterAuth$");k(this,"sheetRuleChangedAfterAuth$");k(this,"unitPermissionInitStateChange$");this._injector=e,this._commandService=t,this._permissionService=i,this._worksheetProtectionRuleModel=o,this._rangeProtectionRuleModel=s,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,a.WorkbookEditablePermission,t)}async addWorksheetBasePermission(e,t){if(this._rangeProtectionRuleModel.getSubunitRuleList(e,t).length>0)throw new Error("sheet protection cannot intersect with range protection");const o=await this._authzIoService.create({objectType:a.UnitObject.Worksheet,worksheetObject:{collaborators:[],unitID:e,strategies:[],name:"",scope:void 0}});if(this._commandService.syncExecuteCommand(a.AddWorksheetProtectionMutation.id,{unitId:e,subUnitId:t,rule:{permissionId:o,unitType:a.UnitObject.Worksheet,unitId:e,subUnitId:t}}))return o}removeWorksheetPermission(e,t){this._commandService.syncExecuteCommand(a.DeleteWorksheetProtectionMutation.id,{unitId:e,subUnitId:t}),[...a.getAllWorksheetPermissionPoint(),...a.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 s=this._worksheetProtectionRuleModel.getRule(e,t);let d;if(i===a.WorksheetEditPermission||i===a.WorksheetViewPermission)if(s)d=s.permissionId;else{if(this._rangeProtectionRuleModel.getSubunitRuleList(e,t).length>0)throw new Error("sheet protection cannot intersect with range protection");d=await this.addWorksheetBasePermission(e,t)}else{const _=this._worksheetProtectionPointRuleModel.getRule(e,t);_?d=_.permissionId:(d=await this._authzIoService.create({objectType:a.UnitObject.Worksheet,worksheetObject:{collaborators:[],unitID:e,strategies:[],name:"",scope:void 0}}),this._commandService.syncExecuteCommand(a.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),s=this._permissionService.getPermissionPoint(o.id);if(s)return s.value}async addRangeBaseProtection(e,t,i){const o=await this._authzIoService.create({objectType:a.UnitObject.SelectRange,selectRangeObject:{collaborators:[],unitID:e,name:"",scope:void 0}}),s=`ruleId_${h.generateRandomId(6)}`;if(this._worksheetProtectionRuleModel.getRule(e,t))throw new Error("sheet protection cannot intersect with range protection");if(this._rangeProtectionRuleModel.getSubunitRuleList(e,t).some(_=>_.ranges.some(C=>i.some(v=>h.Rectangle.intersects(v.getRange(),C)))))throw new Error("range protection cannot intersect");if(this._commandService.syncExecuteCommand(a.AddRangeProtectionMutation.id,{unitId:e,subUnitId:t,rules:[{permissionId:o,unitType:a.UnitObject.SelectRange,unitId:e,subUnitId:t,ranges:i.map(_=>_.getRange()),id:s}]}))return{permissionId:o,ruleId:s}}removeRangeProtection(e,t,i){this._commandService.syncExecuteCommand(a.DeleteRangeProtectionMutation.id,{unitId:e,subUnitId:t,ruleIds:i})&&this._rangeProtectionRuleModel.getSubunitRuleList(e,t).length===0&&(this._worksheetProtectionPointRuleModel.deleteRule(e,t),[...a.getAllWorksheetPermissionPointByPointPanel()].forEach(d=>{const u=new d(e,t);this._permissionService.updatePermissionPoint(u.id,u.value)}))}setRangeProtectionPermissionPoint(e,t,i,o,s){const d=new o(e,t,i);this._permissionService.getPermissionPoint(d.id)||this._permissionService.addPermissionPoint(d),this._permissionService.updatePermissionPoint(d.id,s)}setRangeProtectionRanges(e,t,i,o){const s=this._rangeProtectionRuleModel.getRule(e,t,i);if(s){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(a.SetRangeProtectionMutation.id,{unitId:e,subUnitId:t,ruleId:i,rule:{...s,ranges:o.map(l=>l.getRange())}})}}getPermissionInfoWithCell(e,t,i,o){const s=h.cellToRange(i,o),d=this._rangeProtectionRuleModel.getSubunitRuleList(e,t).find(u=>u.ranges.some(m=>h.Rectangle.intersects(s,m)));if(d)return{permissionId:d.permissionId,ruleId:d.id}}},c.FPermission=re([E(0,h.Inject(h.Injector)),E(1,h.ICommandService),E(2,h.IPermissionService),E(3,h.Inject(a.WorksheetProtectionRuleModel)),E(4,h.Inject(a.RangeProtectionRuleModel)),E(5,h.Inject(a.WorksheetProtectionPointModel)),E(6,h.Inject(a.WorkbookPermissionService)),E(7,h.Inject(h.IAuthzIoService))],c.FPermission);var oe=Object.getOwnPropertyDescriptor,se=(r,n,e,t)=>{for(var i=t>1?void 0:t?oe(n,e):n,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(i)||i);return i},ae=(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:s,style:d}of this._selections)h.Rectangle.contains(s,n.getRange())?(t.push({range:s,primary:a.getPrimaryForRange(n.getRange(),this._worksheet),style:d}),i=!0):t.push({range:s,primary:null,style:d});i||(t=[{range:n.getRange(),primary:a.getPrimaryForRange(n.getRange(),this._worksheet)}]);const o={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),selections:t};return e.syncExecuteCommand(a.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=a.getNextPrimaryCell(this._selections.concat(),n,this._worksheet);return t?this._injector.createInstance(c.FRange,this._workbook,this._worksheet,t):null}},c.FSelection=se([ae(3,h.Inject(h.Injector))],c.FSelection);var x=(r=>(r[r.Reader=0]="Reader",r[r.Editor=1]="Editor",r[r.Owner=2]="Owner",r[r.UNRECOGNIZED=-1]="UNRECOGNIZED",r))(x||{}),he=Object.getOwnPropertyDescriptor,de=(r,n,e,t)=>{for(var i=t>1?void 0:t?he(n,e):n,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(i)||i);return i},B=(r,n)=>(e,t)=>n(e,t,r);let y=class{constructor(r,n,e,t,i,o,s,d,u){this._unitId=r,this._subUnitId=n,this._ruleId=e,this._permissionId=t,this._ranges=i,this._options=o,this._injector=s,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(s=>{const d=s.getRange();return this._rangesIntersect(d,o)}))))throw new Error("Range protection cannot intersect with other protection rules");await this._commandService.executeCommand(a.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 updateOptions(r){const n=this._rangeProtectionRuleModel.getRule(this._unitId,this._subUnitId,this._ruleId);if(!n)throw new Error(`Rule ${this._ruleId} not found`);const e={...this._options,...r};await this._commandService.executeCommand(a.SetRangeProtectionMutation.id,{unitId:this._unitId,subUnitId:this._subUnitId,ruleId:this._ruleId,rule:{...n}}),Object.assign(this._options,e)}async remove(){await this._commandService.executeCommand(a.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=de([B(6,h.Inject(h.Injector)),B(7,h.Inject(h.ICommandService)),B(8,h.Inject(a.RangeProtectionRuleModel))],y);var q=(r=>(r[r.Reader=0]="Reader",r[r.Editor=1]="Editor",r[r.Owner=2]="Owner",r))(q||{}),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||{}),b=(r=>(r.Edit="RangeEdit",r.View="RangeView",r.ManageCollaborator="RangeManageCollaborator",r.Delete="RangeDeleteProtection",r))(b||{});const V={[g.Edit]:a.WorkbookEditablePermission,[g.View]:a.WorkbookViewPermission,[g.Print]:a.WorkbookPrintPermission,[g.Export]:a.WorkbookExportPermission,[g.Share]:a.WorkbookSharePermission,[g.CopyContent]:a.WorkbookCopyPermission,[g.DuplicateFile]:a.WorkbookDuplicatePermission,[g.Comment]:a.WorkbookCommentPermission,[g.ManageCollaborator]:a.WorkbookManageCollaboratorPermission,[g.CreateSheet]:a.WorkbookCreateSheetPermission,[g.DeleteSheet]:a.WorkbookDeleteSheetPermission,[g.RenameSheet]:a.WorkbookRenameSheetPermission,[g.MoveSheet]:a.WorkbookMoveSheetPermission,[g.HideSheet]:a.WorkbookHideSheetPermission,[g.ViewHistory]:a.WorkbookViewHistoryPermission,[g.ManageHistory]:a.WorkbookHistoryPermission,[g.RecoverHistory]:a.WorkbookRecoverHistoryPermission,[g.CreateProtection]:a.WorkbookCreateProtectPermission,[g.InsertRow]:a.WorkbookInsertRowPermission,[g.InsertColumn]:a.WorkbookInsertColumnPermission,[g.DeleteRow]:a.WorkbookDeleteRowPermission,[g.DeleteColumn]:a.WorkbookDeleteColumnPermission,[g.CopySheet]:a.WorkbookCopySheetPermission},A={[S.Edit]:a.WorksheetEditPermission,[S.View]:a.WorksheetViewPermission,[S.Copy]:a.WorksheetCopyPermission,[S.SetCellValue]:a.WorksheetSetCellValuePermission,[S.SetCellStyle]:a.WorksheetSetCellStylePermission,[S.SetRowStyle]:a.WorksheetSetRowStylePermission,[S.SetColumnStyle]:a.WorksheetSetColumnStylePermission,[S.InsertRow]:a.WorksheetInsertRowPermission,[S.InsertColumn]:a.WorksheetInsertColumnPermission,[S.DeleteRow]:a.WorksheetDeleteRowPermission,[S.DeleteColumn]:a.WorksheetDeleteColumnPermission,[S.Sort]:a.WorksheetSortPermission,[S.Filter]:a.WorksheetFilterPermission,[S.PivotTable]:a.WorksheetPivotTablePermission,[S.InsertHyperlink]:a.WorksheetInsertHyperlinkPermission,[S.EditExtraObject]:a.WorksheetEditExtraObjectPermission,[S.ManageCollaborator]:a.WorksheetManageCollaboratorPermission,[S.DeleteProtection]:a.WorksheetDeleteProtectionPermission,[S.SelectProtectedCells]:a.WorksheetSelectProtectedCellsPermission,[S.SelectUnProtectedCells]:a.WorksheetSelectUnProtectedCellsPermission},j={[b.Edit]:a.RangeProtectionPermissionEditPoint,[b.View]:a.RangeProtectionPermissionViewPoint,[b.ManageCollaborator]:a.RangeProtectionPermissionManageCollaPoint,[b.Delete]:a.RangeProtectionPermissionDeleteProtectionPoint};var ue=Object.getOwnPropertyDescriptor,le=(r,n,e,t)=>{for(var i=t>1?void 0:t?ue(n,e):n,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(i)||i);return i},W=(r,n)=>(e,t)=>n(e,t,r);let H=class{constructor(r,n,e,t,i,o,s){k(this,"_permissionSubject");k(this,"_rangeRulesSubject");k(this,"permission$");k(this,"pointChange$");k(this,"rangeProtectionChange$");k(this,"rangeProtectionRules$");k(this,"_unitId");k(this,"_subUnitId");k(this,"_subscriptions",[]);this._worksheet=r,this._injector=n,this._permissionService=e,this._authzIoService=t,this._commandService=i,this._rangeProtectionRuleModel=o,this._worksheetProtectionPointModel=s,this._unitId=this._worksheet.getWorkbook().getUnitId(),this._subUnitId=this._worksheet.getSheetId(),this._permissionSubject=new M.BehaviorSubject(this._buildSnapshot()),this._rangeRulesSubject=new M.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(w.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(w.distinctUntilChanged((n,e)=>JSON.stringify(n)===JSON.stringify(e)),w.shareReplay({bufferSize:1,refCount:!0}))}_createPointChangeStream(){return this._permissionService.permissionPointUpdate$.pipe(w.filter(r=>r.id.includes(this._unitId)&&r.id.includes(this._subUnitId)),w.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}),w.filter(r=>r!==null),w.shareReplay({bufferSize:1,refCount:!0}))}_createRangeProtectionChangeStream(){return this._rangeProtectionRuleModel.ruleChange$.pipe(w.filter(r=>r.unitId===this._unitId&&r.subUnitId===this._subUnitId),w.map(r=>{const n=this._buildRangeProtectionRules();return{type:r.type==="delete"?"delete":r.type==="set"?"update":"add",rules:n}}),w.shareReplay({bufferSize:1,refCount:!0}))}_createRangeProtectionRulesStream(){const r=this._rangeProtectionRuleModel.ruleChange$.pipe(w.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(w.distinctUntilChanged((n,e)=>n.length!==e.length?!1:n.every((t,i)=>t.id===e[i].id)),w.shareReplay({bufferSize:1,refCount:!0}))}_extractWorksheetPointType(r){for(const[n,e]of Object.entries(A))if(new e(this._unitId,this._subUnitId).id===r)return n;return null}_getRuleEditPermission(r){var i;const n=j[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 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(y,this._unitId,this._subUnitId,n.id,n.permissionId,e,{name:n.description||"",allowEdit:this._getRuleEditPermission(n)})})}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=A[i];if(!o)throw new Error(`Unknown worksheet permission point: ${i}`);const s=this.getPoint(i);if(s===t)continue;const d=new o(this._unitId,this._subUnitId);this._permissionService.getPermissionPoint(d.id)||this._permissionService.addPermissionPoint(d),this._permissionService.updatePermissionPoint(d.id,t),n.push({point:i,value:t,oldValue:s})}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)}debugCellPermission(r,n){const e=[],t=this._rangeProtectionRuleModel.getSubunitRuleList(this._unitId,this._subUnitId);for(const i of t)for(const o of i.ranges)if(r>=o.startRow&&r<=o.endRow&&n>=o.startColumn&&n<=o.endColumn){e.push({ruleId:i.id,rangeRefs:i.ranges.map(s=>`R${s.startRow}C${s.startColumn}:R${s.endRow}C${s.endColumn}`),options:{name:i.description||"",allowEdit:this._getRuleEditPermission(i)}});break}return e.length===0?null:{row:r,col:n,hitRules:e}}async setPoint(r,n){const e=A[r];if(!e)throw new Error(`Unknown worksheet permission point: ${r}`);if(this.getPoint(r)===n)return;const i=new e(this._unitId,this._subUnitId);this._permissionService.getPermissionPoint(i.id)||this._permissionService.addPermissionPoint(i),this._permissionService.updatePermissionPoint(i.id,n);const s=this._buildSnapshot();this._permissionSubject.next(s)}getPoint(r){var i;const n=A[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 s,d,u,l;return this._authzIoService.create({objectType:a.UnitObject.SelectRange,selectRangeObject:{collaborators:(u=(d=(s=o.options)==null?void 0:s.allowedUsers)==null?void 0:d.map(m=>({id:m,role:x.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,s)=>{var l;const d=this._determineViewState(o.options),u=this._determineEditState(o.options);return{permissionId:n[s],unitType:a.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(a.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,s)=>this._setPermissionPoints(n[s],o.options))),e.map((o,s)=>this._injector.createInstance(y,this._unitId,this._subUnitId,o.id,o.permissionId,r[s].ranges,r[s].options||{}))}_determineViewState(r){return(r==null?void 0:r.allowViewByOthers)===!1?a.ViewStateEnum.NoOneElseCanView:a.ViewStateEnum.OthersCanView}_determineEditState(r){var n;return(r==null?void 0:r.allowEdit)===!0&&((n=r==null?void 0:r.allowedUsers)!=null&&n.length)?a.EditStateEnum.DesignedUserCanEdit:a.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=j[n];if(!t)return;const i=new t(this._unitId,this._subUnitId,r);this._permissionService.getPermissionPoint(i.id)||this._permissionService.addPermissionPoint(i),this._permissionService.updatePermissionPoint(i.id,e)}async unprotectRules(r){!r||r.length===0||await this._commandService.executeCommand(a.DeleteRangeProtectionMutation.id,{unitId:this._unitId,subUnitId:this._subUnitId,ruleIds: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()}};H=le([W(1,h.Inject(h.Injector)),W(2,h.IPermissionService),W(3,h.IAuthzIoService),W(4,h.ICommandService),W(5,h.Inject(a.RangeProtectionRuleModel)),W(6,h.Inject(a.WorksheetProtectionPointModel))],H);function ce(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 J(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 me(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 Z(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 $(r,n){return{startRow:r.startRow,endRow:r.endRow,startColumn:0,endColumn:n.getColumnCount()-1,rangeType:h.RANGE_TYPE.ROW}}function z(r,n){return{startRow:0,endRow:n.getRowCount()-1,startColumn:r.startColumn,endColumn:r.endColumn,rangeType:h.RANGE_TYPE.COLUMN}}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,s;o>=0;o--)(s=r[o])&&(i=s(i)||i);return i},F=(r,n)=>(e,t)=>n(e,t,r);c.FWorksheet=class extends I.FBaseInitialable{constructor(e,t,i,o,s,d,u){super(o);k(this,"setActiveSelection",this.setActiveRange);this._fWorkbook=e,this._workbook=t,this._worksheet=i,this._injector=o,this._selectionManagerService=s,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(a.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(),s={unitId:i,subUnitId:o,columnData:{[e]:{s:t}}};return this._commandService.syncExecuteCommand(a.SetColDataCommand.id,s),this}setRowDefaultStyle(e,t){const i=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),s={unitId:i,subUnitId:o,rowData:{[e]:{s:t}}};return this._commandService.syncExecuteCommand(a.SetRowDataCommand.id,s),this}getRange(e,t,i,o){let s,d;if(typeof e=="object")s=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,s={...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,s={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,s)}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(),s=h.Direction.DOWN,d=e+1,u=e+t,l=0,m=this._worksheet.getColumnCount()-1,_=a.copyRangeStyles(this._worksheet,d,u,l,m,!0,e);return this._commandService.syncExecuteCommand(a.InsertRowByRangeCommand.id,{unitId:i,subUnitId:o,direction:s,range:{startRow:d,endRow:u,startColumn:l,endColumn:m},cellValue:_}),this}insertRowsBefore(e,t){const i=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),s=h.Direction.UP,d=e,u=e+t-1,l=0,m=this._worksheet.getColumnCount()-1,_=a.copyRangeStyles(this._worksheet,d,u,l,m,!0,e-1);return this._commandService.syncExecuteCommand(a.InsertRowByRangeCommand.id,{unitId:i,subUnitId:o,direction:s,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(a.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(),s=$(e.getRange(),this._worksheet),d=s,u={startRow:t,endRow:t,startColumn:s.startColumn,endColumn:s.endColumn};return this._commandService.syncExecuteCommand(a.MoveRowsCommand.id,{unitId:i,subUnitId:o,range:s,fromRange:d,toRange:u}),this}hideRow(e){const t=this._workbook.getUnitId(),i=this._worksheet.getSheetId(),o=$(e.getRange(),this._worksheet);return this._commandService.syncExecuteCommand(a.SetRowHiddenCommand.id,{unitId:t,subUnitId:i,ranges:[o]}),this}hideRows(e,t=1){const i=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),s={startRow:e,endRow:e+t-1,startColumn:0,endColumn:this._worksheet.getColumnCount()-1,rangeType:h.RANGE_TYPE.ROW};return this._commandService.syncExecuteCommand(a.SetRowHiddenCommand.id,{unitId:i,subUnitId:o,ranges:[s]}),this}unhideRow(e){const t=this._workbook.getUnitId(),i=this._worksheet.getSheetId(),o=$(e.getRange(),this._worksheet);return this._commandService.syncExecuteCommand(a.SetSpecificRowsVisibleCommand.id,{unitId:t,subUnitId:i,ranges:[o]}),this}showRows(e,t=1){const i=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),s={startRow:e,endRow:e+t-1,startColumn:0,endColumn:this._worksheet.getColumnCount()-1,rangeType:h.RANGE_TYPE.ROW};return this._commandService.syncExecuteCommand(a.SetSpecificRowsVisibleCommand.id,{unitId:i,subUnitId:o,ranges:[s]}),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(),s=[{startRow:e,endRow:e,startColumn:0,endColumn:this._worksheet.getColumnCount()-1}];return this._commandService.syncExecuteCommand(a.SetTextWrapCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:s[0],value:h.WrapStrategy.WRAP}),this._commandService.syncExecuteCommand(a.SetWorksheetRowIsAutoHeightMutation.id,{unitId:i,subUnitId:o,ranges:s,autoHeightInfo:t}),this}setRowHeights(e,t,i){var m;const o=this._workbook.getUnitId(),s=this._worksheet.getSheetId(),d=this._worksheet.getRowManager(),u=[],l=[];for(let _=e;_<e+t;_++){const C=((m=d.getRow(_))==null?void 0:m.ah)||this._worksheet.getConfig().defaultRowHeight,v={startRow:_,endRow:_,startColumn:0,endColumn:this._worksheet.getColumnCount()-1};i<=C?u.push(v):l.push(v)}return l.length>0&&this._commandService.syncExecuteCommand(a.SetRowHeightCommand.id,{unitId:o,subUnitId:s,ranges:l,value:i}),u.length>0&&this._commandService.syncExecuteCommand(a.SetWorksheetRowIsAutoHeightCommand.id,{unitId:o,subUnitId:s,ranges:u}),this}getRowHeight(e){return this._worksheet.getRowHeight(e)}setRowAutoHeight(e,t){const i=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),s=[{startRow:e,endRow:e+t-1,startColumn:0,endColumn:this._worksheet.getColumnCount()-1}];return this._commandService.syncExecuteCommand(a.SetWorksheetRowIsAutoHeightCommand.id,{unitId:i,subUnitId:o,ranges:s}),this}setRangesAutoHeight(e){const t=this._workbook.getUnitId(),i=this._worksheet.getSheetId();return this._commandService.syncExecuteCommand(a.SetWorksheetRowIsAutoHeightCommand.id,{unitId:t,subUnitId:i,ranges:e}),this}setRowHeightsForced(e,t,i){const o=this._workbook.getUnitId(),s=this._worksheet.getSheetId(),d=[{startRow:e,endRow:e+t-1,startColumn:0,endColumn:this._worksheet.getColumnCount()-1}];return this._commandService.syncExecuteCommand(a.SetRowHeightCommand.id,{unitId:o,subUnitId:s,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 s={unitId:t,subUnitId:i,rowData:o};return this._commandService.syncExecuteCommand(a.SetRowDataCommand.id,s),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(),s=h.Direction.RIGHT,d=0,u=this._worksheet.getRowCount()-1,l=e+1,m=e+t,_=a.copyRangeStyles(this._worksheet,d,u,l,m,!1,e);return this._commandService.syncExecuteCommand(a.InsertColByRangeCommand.id,{unitId:i,subUnitId:o,direction:s,range:{startRow:d,endRow:u,startColumn:l,endColumn:m},cellValue:_}),this}insertColumnsBefore(e,t){const i=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),s=h.Direction.LEFT,d=0,u=this._worksheet.getRowCount()-1,l=e,m=e+t-1,_=a.copyRangeStyles(this._worksheet,d,u,l,m,!1,e-1);return this._commandService.syncExecuteCommand(a.InsertColByRangeCommand.id,{unitId:i,subUnitId:o,direction:s,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(a.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(),s=z(e.getRange(),this._worksheet),d=s,u={startRow:0,endRow:this._worksheet.getRowCount()-1,startColumn:t,endColumn:t};return this._commandService.syncExecuteCommand(a.MoveColsCommand.id,{unitId:i,subUnitId:o,range:s,fromRange:d,toRange:u}),this}hideColumn(e){const t=this._workbook.getUnitId(),i=this._worksheet.getSheetId(),o=z(e.getRange(),this._worksheet);return this._commandService.syncExecuteCommand(a.SetColHiddenCommand.id,{unitId:t,subUnitId:i,ranges:[o]}),this}hideColumns(e,t=1){const i=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),s={startRow:0,endRow:this._worksheet.getRowCount()-1,startColumn:e,endColumn:e+t-1,rangeType:h.RANGE_TYPE.COLUMN};return this._commandService.syncExecuteCommand(a.SetColHiddenCommand.id,{unitId:i,subUnitId:o,ranges:[s]}),this}unhideColumn(e){const t=this._workbook.getUnitId(),i=this._worksheet.getSheetId(),o=z(e.getRange(),this._worksheet);return this._commandService.syncExecuteCommand(a.SetSpecificColsVisibleCommand.id,{unitId:t,subUnitId:i,ranges:[o]}),this}showColumns(e,t=1){const i=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),s={startRow:0,endRow:this._worksheet.getRowCount()-1,startColumn:e,endColumn:e+t-1,rangeType:h.RANGE_TYPE.COLUMN};return this._commandService.syncExecuteCommand(a.SetSpecificColsVisibleCommand.id,{unitId:i,subUnitId:o,ranges:[s]}),this}setColumnWidth(e,t){return this.setColumnWidths(e,1,t)}setColumnWidths(e,t,i){const o=this._workbook.getUnitId(),s=this._worksheet.getSheetId(),d=[{startColumn:e,endColumn:e+t-1,startRow:0,endRow:this._worksheet.getRowCount()-1}];return this._commandService.syncExecuteCommand(a.SetColWidthCommand.id,{unitId:o,subUnitId:s,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 s={unitId:t,subUnitId:i,columnData:o};return this._commandService.syncExecuteCommand(a.SetColDataCommand.id,s),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(a.SetFrozenCommand.id,{...e,unitId:this._workbook.getUnitId(),subUnitId:this.getSheetId()}),this}cancelFreeze(){return this._commandService.syncExecuteCommand(a.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(a.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(a.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(a.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(a.SetGridlinesColorCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),color:e}),this}getGridLinesColor(){return this._worksheet.getGridlinesColor()}setTabColor(e){return this._commandService.syncExecuteCommand(a.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===a.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===a.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(s=>s.isSheetHidden()!==h.BooleanNumber.TRUE).length<=1)throw new Error("Cannot hide the only visible sheet");return e.syncExecuteCommand(a.SetWorksheetHideCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId()}),this}showSheet(){return this._injector.get(h.ICommandService).syncExecuteCommand(a.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(a.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),s={startRow:0,endRow:this._worksheet.getRowCount()-1,startColumn:0,endColumn:this._worksheet.getColumnCount()-1};return o.syncExecuteCommand(a.ClearSelectionAllCommand.id,{unitId:t,subUnitId:i,ranges:[s],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(a.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(a.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(T).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(),s=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(a.AppendRowCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),cellValue:u.getMatrix(),insertRowNums:d>o-1?1:0,insertColumnNums:e.length>s?e.length-s:0,maxRows:o,maxColumns:s}),this}setRowCount(e){return this._commandService.syncExecuteCommand(a.SetWorksheetRowCountCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),rowCount:e}),this}setColumnCount(e){return this._commandService.syncExecuteCommand(a.SetWorksheetColumnCountCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),columnCount:e}),this}getWorksheetPermission(){return this._injector.createInstance(H,this)}},c.FWorksheet=_e([F(3,h.Inject(h.Injector)),F(4,h.Inject(a.SheetsSelectionsService)),F(5,h.Inject(h.ILogService)),F(6,h.ICommandService)],c.FWorksheet);var Se=Object.getOwnPropertyDescriptor,we=(r,n,e,t)=>{for(var i=t>1?void 0:t?Se(n,e):n,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(i)||i);return i},N=(r,n)=>(e,t)=>n(e,t,r);let L=class{constructor(r,n,e,t,i,o,s,d,u){k(this,"_permissionSubject");k(this,"_subscriptions",[]);k(this,"permission$");k(this,"protectionChange$");this._unitId=r,this._subUnitId=n,this._range=e,this._worksheet=t,this._injector=i,this._permissionService=o,this._authzIoService=s,this._commandService=d,this._rangeProtectionRuleModel=u,this._permissionSubject=new M.BehaviorSubject(this._buildSnapshot()),this.permission$=this._createPermissionStream(),this.protectionChange$=this._createProtectionChangeStream()}_createPermissionStream(){const r=this._permissionService.permissionPointUpdate$.pipe(w.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(w.distinctUntilChanged((n,e)=>JSON.stringify(n)===JSON.stringify(e)),w.shareReplay({bufferSize:1,refCount:!0}))}_createProtectionChangeStream(){return this._rangeProtectionRuleModel.ruleChange$.pipe(w.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),w.map(r=>(this._permissionSubject.next(this._buildSnapshot()),r.type==="delete"?{type:"unprotected",ruleId:r.rule.id}:{type:"protected",rule:this._createFacadeRule(r.rule)})),w.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!==a.ViewStateEnum.NoOneElseCanView,allowEdit:r.editState===a.EditStateEnum.DesignedUserCanEdit};return this._injector.createInstance(y,this._unitId,this._subUnitId,r.id,r.permissionId,n,e)}getPoint(r){const n=j[r];if(!n)return console.warn(`Unknown permission point: ${r}`),!1;const e=this._getProtectionRule();if(e){const s=new n(this._unitId,this._subUnitId,e.permissionId),d=this._permissionService.getPermissionPoint(s.id);if(d)return d.value}const t=this._getLocalPermissionId(),i=new n(this._unitId,this._subUnitId,t),o=this._permissionService.getPermissionPoint(i.id);return o?o.value:!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=j[r];if(!e)throw new Error(`Unknown permission point: ${r}`);if(this.getPoint(r)===n)return;const i=this._getProtectionRule(),o=(i==null?void 0:i.permissionId)||this._getLocalPermissionId(),s=new e(this._unitId,this._subUnitId,o);this._permissionService.getPermissionPoint(s.id)||this._permissionService.addPermissionPoint(s),this._permissionService.updatePermissionPoint(s.id,n),this._permissionSubject.next(this._buildSnapshot())}_getLocalPermissionId(){const r=this._range.getRange();return`local-${this._unitId}-${this._subUnitId}-${r.startRow}-${r.startColumn}-${r.endRow}-${r.endColumn}`}async protect(r){var d,u;if(this.isProtected())throw new Error("Range is already protected");const n=await this._authzIoService.create({objectType:a.UnitObject.SelectRange,selectRangeObject:{collaborators:(u=(d=r==null?void 0:r.allowedUsers)==null?void 0:d.map(l=>({id:l,role:x.Editor,subject:void 0})))!=null?u:[],unitID:this._unitId,name:(r==null?void 0:r.name)||"",scope:void 0}}),e=this._rangeProtectionRuleModel.createRuleId(this._unitId,this._subUnitId),t=this._range.getRange(),i=this._determineViewState(r),o=this._determineEditState(r);return await this._commandService.executeCommand(a.AddRangeProtectionMutation.id,{unitId:this._unitId,subUnitId:this._subUnitId,rules:[{id:e,permissionId:n,unitType:3,unitId:this._unitId,subUnitId:this._subUnitId,ranges:[t],description:r==null?void 0:r.name,viewState:i,editState:o}]}),await this._setPermissionPoints(n,r),this._injector.createInstance(y,this._unitId,this._subUnitId,e,n,[this._range],r||{})}_determineViewState(r){return(r==null?void 0:r.allowViewByOthers)===!1?a.ViewStateEnum.NoOneElseCanView:a.ViewStateEnum.OthersCanView}_determineEditState(r){var n;return(r==null?void 0:r.allowEdit)===!0&&((n=r==null?void 0:r.allowedUsers)!=null&&n.length)?a.EditStateEnum.DesignedUserCanEdit:a.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=j[n];if(!t)return;const i=new t(this._unitId,this._subUnitId,r);this._permissionService.getPermissionPoint(i.id)||this._permissionService.addPermissionPoint(i),this._permissionService.updatePermissionPoint(i.id,e)}async unprotect(){const r=this._getProtectionRule();if(!r)return;const n=r.id;await this._commandService.executeCommand(a.DeleteRangeProtectionMutation.id,{unitId:this._unitId,subUnitId:this._subUnitId,ruleIds:[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!==a.ViewStateEnum.NoOneElseCanView};return n.editState===a.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!==a.ViewStateEnum.NoOneElseCanView};if(e.editState===a.EditStateEnum.DesignedUserCanEdit)try{const s=(await this._authzIoService.listCollaborators({objectID:e.permissionId,unitID:this._unitId})).filter(d=>d.role===x.Editor).map(d=>{var u;return((u=d.subject)==null?void 0:u.userID)||d.id});i.allowEdit=s.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()}};L=we([N(4,h.Inject(h.Injector)),N(5,h.Inject(h.IPermissionService)),N(6,h.Inject(h.IAuthzIoService)),N(7,h.Inject(h.ICommandService)),N(8,h.Inject(a.RangeProtectionRuleModel))],L);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,s;o>=0;o--)(s=r[o])&&(i=s(i)||i);return i},G=(r,n)=>(e,t)=>n(e,t,r);c.FRange=(D=class extends I.FBaseInitialable{constructor(n,e,t,i,o,s){super(i),this._workbook=n,this._worksheet=e,this._range=t,this._injector=i,this._commandService=o,this._formulaDataModel=s,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(s=>h.Rectangle.equals(s,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,s)=>{if(!o)return null;const d=n!=="cell"?this._worksheet.getComposedCellStyle(i+this._range.startRow,s+this._range.startColumn,n==="row"):this._worksheet.getCellStyle(i+this._range.startRow,s+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,s=[];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);s.push(m)}return s}getRawValues(){var d,u;const n=this._worksheet.getCellMatrix(),{startRow:e,endRow:t,startColumn:i,endColumn:o}=this._range,s=[];for(let l=e;l<=t;l++){const m=[];for(let _=i;_<=o;_++){const C=n.getValue(l,_);C!=null&&C.p&&((d=C.p.body)!=null&&d.dataStream)?m.push(C.p.body.dataStream):m.push((u=C==null?void 0:C.v)!=null?u:null)}s.push(m)}return s}getDisplayValues(){var s,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 C=this._worksheet.getCell(l,_);C!=null&&C.p&&((s=C.p.body)!=null&&s.dataStream)?m.push(C.p.body.dataStream):m.push((u=(d=C==null?void 0:C.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 s=n;s<=e;s++){const d=[];for(let u=t;u<=i;u++)d.push(this._worksheet.getCellRaw(s,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,s=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,s,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 J(n)}getHorizontalAlignments(){return this._worksheet.getRange(this._range).getHorizontalAlignments().map(e=>e.map(t=>J(t)))}getVerticalAlignment(){return Z(this._worksheet.getRange(this._range).getVerticalAlignment())}getVerticalAlignments(){return this._worksheet.getRange(this._range).getVerticalAlignments().map(e=>e.map(t=>Z(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(a.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(a.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(a.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(a.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(a.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(a.SetRangeValuesCommand.id,t),this}setRichTextValues(n){const e=n.map(o=>o.map(s=>s&&{p:s instanceof h.RichTextValue?s.getData():s})),t=h.covertCellValues(e,this._range),i={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,value:t};return this._commandService.syncExecuteCommand(a.SetRangeValuesCommand.id,i),this}setWrap(n){return this._commandService.syncExecuteCommand(a.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(a.SetTextWrapCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,value:n}),this}setVerticalAlignment(n){return this._commandService.syncExecuteCommand(a.SetVerticalTextAlignCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,value:me(n)}),this}setHorizontalAlignment(n){return this._commandService.syncExecuteCommand(a.SetHorizontalTextAlignCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,value:ce(n)}),this}setValues(n){const e=h.covertCellValues(n,this._range);return this._commandService.syncExecuteCommand(a.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(a.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(a.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(a.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(a.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(a.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(a.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(a.SetStyleCommand.id,i),this}merge(n=!0){const e=this._workbook.getUnitId(),t=this._worksheet.getSheetId();return a.addMergeCellsUtil(this._injector,e,t,[this._range],n),this}mergeAcross(n=!0){const e=a.getAddMergeMutationRangeByType([this._range],h.Dimension.ROWS),t=this._workbook.getUnitId(),i=this._worksheet.getSheetId();return a.addMergeCellsUtil(this._injector,t,i,e,n),this}mergeVertically(n=!0){const e=a.getAddMergeMutationRangeByType([this._range],h.Dimension.COLUMNS),t=this._workbook.getUnitId(),i=this._worksheet.getSheetId();return a.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(a.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((s,d,u)=>{n(s,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:a.getPrimaryForRange(this.getRange(),this._worksheet),style:null}]};return this._commandService.syncExecuteCommand(a.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(a.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(a.SetWorksheetRangeThemeStyleCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,themeName:n})}removeThemeStyle(n){this._commandService.syncExecuteCommand(a.DeleteWorksheetRangeThemeStyleCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,themeName:n})}getUsedThemeStyle(){return this._injector.get(a.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(a.ClearSelectionAllCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),ranges:[this._range],options:n}),this)}clearContent(){return this._commandService.syncExecuteCommand(a.ClearSelectionContentCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),ranges:[this._range]}),this}clearFormat(){return this._commandService.syncExecuteCommand(a.ClearSelectionFormatCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),ranges:[this._range]}),this}insertCells(n){n===h.Dimension.ROWS?this._commandService.executeCommand(a.InsertRangeMoveDownCommand.id,{range:this._range}):this._commandService.executeCommand(a.InsertRangeMoveRightCommand.id,{range:this._range})}deleteCells(n){n===h.Dimension.ROWS?this._commandService.executeCommand(a.DeleteRangeMoveUpCommand.id,{range:this._range}):this._commandService.executeCommand(a.DeleteRangeMoveLeftCommand.id,{range:this._range})}getDataRegion(n){const{startRow:e,startColumn:t,endRow:i,endColumn:o}=this._range,s=this._worksheet.getMaxRows(),d=this._worksheet.getMaxColumns(),u=this._worksheet.getCellMatrix();let l=e,m=t,_=i,C=o;if(n!==h.Dimension.COLUMNS){let v=!1,U=!1;for(let p=t;p<=o&&(e>0&&!h.isNullCell(u.getValue(e-1,p))&&(v=!0),i<s-1&&!h.isNullCell(u.getValue(i+1,p))&&(U=!0),!(v&&U));p++);v&&(l=e-1),U&&(_=i+1)}if(n!==h.Dimension.ROWS){let v=!1,U=!1;for(let p=e;p<=i&&(t>0&&!h.isNullCell(u.getValue(p,t-1))&&(v=!0),o<d-1&&!h.isNullCell(u.getValue(p,o+1))&&(U=!0),!(v&&U));p++);v&&(m=t-1),U&&(C=o+1)}return this._injector.createInstance(c.FRange,this._workbook,this._worksheet,{startRow:l,startColumn:m,endRow:_,endColumn:C})}isBlank(){const n=this._worksheet.getCellMatrix(),{startRow:e,startColumn:t,endRow:i,endColumn:o}=this._range;let s=!0;for(let d=e;d<=i;d++){for(let u=t;u<=o;u++)if(!h.isNullCell(n.getValue(d,u))){s=!1;break}if(!s)break}return s}offset(n,e,t,i){const{startRow:o,startColumn:s,endRow:d,endColumn:u}=this._range,l=o+n,m=s+e,_=t?l+t-1:d+n,C=i?m+i-1:u+e;if(l<0||m<0||_<0||C<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:C})}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(L,this._workbook.getUnitId(),this._worksheet.getSheetId(),this,n)}},D._enableManualInit(),D),c.FRange=ke([G(3,h.Inject(h.Injector)),G(4,h.ICommandService),G(5,h.Inject(P.FormulaDataModel))],c.FRange);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,s;o>=0;o--)(s=r[o])&&(i=s(i)||i);return i},K=(r,n)=>(e,t)=>n(e,t,r);let Y=class{constructor(r,n,e,t){k(this,"_permissionSubject");k(this,"_collaboratorChangeSubject",new M.Subject);k(this,"permission$");k(this,"pointChange$");k(this,"collaboratorChange$");k(this,"_subscriptions",[]);this._unitId=r,this._injector=n,this._permissionService=e,this._authzIoService=t,this._permissionSubject=new M.BehaviorSubject(this._buildSnapshot()),this.permission$=this._createPermissionStream(),this.pointChange$=this._createPointChangeStream(),this.collaboratorChange$=this._collaboratorChangeSubject.asObservable().pipe(w.shareReplay({bufferSize:1,refCount:!0}))}_createPermissionStream(){const r=this._permissionService.permissionPointUpdate$.pipe(w.filter(n=>n.id.includes(this._unitId))).subscribe(()=>{this._permissionSubject.next(this._buildSnapshot())});return this._subscriptions.push(r),this._permissionSubject.asObservable().pipe(w.distinctUntilChanged((n,e)=>JSON.stringify(n)===JSON.stringify(e)),w.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(w.filter(n=>n.id.includes(this._unitId)),w.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}}),w.filter(n=>n!==null),w.shareReplay({bufferSize:1,refCount:!0}))}_extractWorkbookPointType(r){for(const n in g){const e=g[n],t=V[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=V[i];if(!o)throw new Error(`Unknown workbook permission point: ${i}`);const s=this.getPoint(i);if(s===t)continue;const d=new o(this._unitId);this._permissionService.getPermissionPoint(d.id)||this._permissionService.addPermissionPoint(d),this._permissionService.updatePermissionPoint(d.id,t),n.push({point:i,value:t,oldValue:s})}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=V[r];if(!e)throw new Error(`Unknown workbook permission point: ${r}`);if(this.getPoint(r)===n)return;const i=new e(this._unitId);this._permissionService.getPermissionPoint(i.id)||this._permissionService.addPermissionPoint(i),this._permissionService.updatePermissionPoint(i.id,n);const s=this._buildSnapshot();this._permissionSubject.next(s)}getPoint(r){var i;const n=V[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:q.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()}};Y=be([K(1,h.Inject(h.Injector)),K(2,h.IPermissionService),K(3,h.IAuthzIoService)],Y);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,s;o>=0;o--)(s=r[o])&&(i=s(i)||i);return i},f=(r,n)=>(e,t)=>n(e,t,r);c.FWorkbook=class extends I.FBaseInitialable{constructor(e,t,i,o,s,d,u,l,m,_){super(t);k(this,"id");this._workbook=e,this._injector=t,this._resourceLoaderService=i,this._selectionManagerService=o,this._univerInstanceService=s,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(a.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 s=h.mergeWorksheetSnapshotWithDefault(h.Tools.deepClone((l=o==null?void 0:o.sheet)!=null?l:{}));s.name=e,s.rowCount=t,s.columnCount=i,s.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(a.InsertSheetCommand.id,{unitId:this.id,index:d,sheet:s}),this._commandService.syncExecuteCommand(a.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(a.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=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(a.InsertSheetCommand.id,{unitId:this.id,index:o,sheet:i}),this._commandService.syncExecuteCommand(a.SetWorksheetActiveOperation.id,{unitId:this.id,subUnitId:this._workbook.getSheets()[o].getSheetId()});const s=this._workbook.getActiveSheet();if(!s)throw new Error("No active sheet found");return this._injector.createInstance(c.FWorksheet,this,this._workbook,s)}deleteSheet(e){const t=this.id,i=typeof e=="string"?e:e.getSheetId();return this._commandService.syncExecuteCommand(a.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 a.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 s={unitId:this.getId(),subUnitId:i,selections:[e].map(d=>({range:d.getRange(),primary:a.getPrimaryForRange(d.getRange(),o),style:null}))};return this._commandService.syncExecuteCommand(a.SetSelectionsOperation.id,s),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(s=>!!s.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(a.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(a.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(Y,this._workbook.getUnitId())}getDefinedName(e){const t=this._definedNamesService.getValueByName(this.id,e);return t?this._injector.createInstance(O,{...t,unitId:this.id}):null}getDefinedNames(){const e=this._definedNamesService.getDefinedNameMap(this.id);return e?Object.values(e).map(t=>this._injector.createInstance(O,{...t,unitId:this.id})):[]}insertDefinedName(e,t){const o=this._injector.createInstance(T).setName(e).setRef(t).build();return o.localSheetId=a.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(a.SetDefinedNameCommand.id,e)}updateDefinedNameBuilder(e){this._commandService.syncExecuteCommand(a.SetDefinedNameCommand.id,e)}getRegisteredRangeThemes(){return this._injector.get(a.SheetRangeThemeService).getRegisteredRangeThemes()}registerRangeTheme(e){this._commandService.syncExecuteCommand(a.RegisterWorksheetRangeThemeStyleCommand.id,{unitId:this.getId(),rangeThemeStyle:e})}unregisterRangeTheme(e){this._commandService.syncExecuteCommand(a.UnregisterWorksheetRangeThemeStyleCommand.id,{unitId:this.getId(),themeName:e})}createRangeThemeStyle(e,t){return new a.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([f(1,h.Inject(h.Injector)),f(2,h.Inject(h.IResourceLoaderService)),f(3,h.Inject(a.SheetsSelectionsService)),f(4,h.IUniverInstanceService),f(5,h.ICommandService),f(6,h.IPermissionService),f(7,h.ILogService),f(8,h.Inject(h.LocaleService)),f(9,P.IDefinedNamesService)],c.FWorkbook);class fe extends I.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===a.InsertSheetCommand.id){const o=t.params,{unitId:s,index:d,sheet:u}=o||{},l=s?this.getUniverSheet(s):(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===a.SetWorksheetActiveOperation.id){const{subUnitId:o,unitId:s}=t.params,d=s?this.getUniverSheet(s):(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===a.RemoveSheetCommand.id){const i=this.getCommandSheetTarget(t);if(!i)return;const{workbook:o,worksheet:s}=i,d={workbook:o,worksheet:s};if(this.fireEvent(this.Event.BeforeSheetDelete,d),d.cancel)throw new h.CanceledError}})),this.registerEventHandler(this.Event.BeforeSheetMove,()=>e.beforeCommandExecuted(t=>{if(t.id===a.SetWorksheetOrderMutation.id){const{fromOrder:i,toOrder:o}=t.params,s=this.getCommandSheetTarget(t);if(!s)return;const d={workbook:s.workbook,worksheet:s.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===a.SetWorksheetNameCommand.id){const{name:i}=t.params,o=this.getCommandSheetTarget(t);if(!o)return;const s={workbook:o.workbook,worksheet:o.worksheet,newName:i,oldName:o.worksheet.getSheetName()};if(this.fireEvent(this.Event.BeforeSheetNameChange,s),s.cancel)throw new h.CanceledError}})),this.registerEventHandler(this.Event.BeforeSheetTabColorChange,()=>e.beforeCommandExecuted(t=>{if(t.id===a.SetTabColorMutation.id){const{color:i}=t.params,o=this.getCommandSheetTarget(t);if(!o)return;const s={workbook:o.workbook,worksheet:o.worksheet,newColor:i,oldColor:o.worksheet.getTabColor()};if(this.fireEvent(this.Event.BeforeSheetTabColorChange,s),s.cancel)throw new h.CanceledError}})),this.registerEventHandler(this.Event.BeforeSheetHideChange,()=>e.beforeCommandExecuted(t=>{if(t.id===a.SetWorksheetHideMutation.id){const{hidden:i}=t.params,o=this.getCommandSheetTarget(t);if(!o)return;const s={workbook:o.workbook,worksheet:o.worksheet,hidden:!!i};if(this.fireEvent(this.Event.BeforeSheetHideChange,s),s.cancel)throw new h.CanceledError}})),this.registerEventHandler(this.Event.BeforeGridlineColorChange,()=>e.beforeCommandExecuted(t=>{var i;if(t.id===a.SetGridlinesColorCommand.id){const o=this.getCommandSheetTarget(t);if(!o)return;const s={...o,color:(i=t.params)==null?void 0:i.color};if(this.fireEvent(this.Event.BeforeGridlineColorChange,s),s.cancel)throw new h.CanceledError}})),this.registerEventHandler(this.Event.BeforeGridlineEnableChange,()=>e.beforeCommandExecuted(t=>{var i;if(t.id===a.ToggleGridlinesCommand.id){const o=this.getCommandSheetTarget(t);if(!o)return;const s={...o,enabled:!!((i=t.params)!=null&&i.showGridlines)};if(this.fireEvent(this.Event.BeforeGridlineEnableChange,s),s.cancel)throw new h.CanceledError}})),this.registerEventHandler(this.Event.SheetValueChanged,()=>e.onCommandExecuted(t=>{if(a.COMMAND_LISTENER_VALUE_CHANGE.indexOf(t.id)>-1){if(!this.getActiveSheet())return;const o=a.getValueChangedEffectedRange(t).map(s=>{var d,u;return(u=(d=this.getWorkbook(s.unitId))==null?void 0:d.getSheetBySheetId(s.subUnitId))==null?void 0:u.getRange(s.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===a.InsertSheetCommand.id){const o=t.params,{unitId:s}=o||{},d=s?this.getUniverSheet(s):(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===a.SetWorksheetActiveOperation.id){const i=this.getActiveSheet();if(!i)return;const{workbook:o,worksheet:s}=i;this._fireActiveSheetChanged(o,s)}})),this.registerEventHandler(this.Event.SheetDeleted,()=>e.onCommandExecuted(t=>{var i;if(t.id===a.RemoveSheetCommand.id){const{subUnitId:o,unitId:s}=t.params,d=s?this.getUniverSheet(s):(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===a.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===a.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===a.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===a.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===a.SetGridlinesColorCommand.id||t.id===a.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(T)}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(a.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})}}I.FUniver.extend(fe);class Q{get SheetValueChangeType(){return a.SheetValueChangeType}get SheetSkeletonChangeType(){return a.SheetSkeletonChangeType}get SplitDelimiterType(){return a.SplitDelimiterEnum}}I.FEnum.extend(Q);class X{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"}}I.FEventName.extend(X);var pe=Object.getOwnPropertyDescriptor,Pe=(r,n,e,t)=>{for(var i=t>1?void 0:t?pe(n,e):n,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=s(i)||i);return i},Ee=(r,n)=>(e,t)=>n(e,t,r);c.FSheetHooks=class extends I.FBase{constructor(n){super(),this._injector=n}},c.FSheetHooks=Pe([Ee(0,h.Inject(h.Injector))],c.FSheetHooks),c.FSheetEventName=X,c.FSheetsEnum=Q,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,f){typeof exports=="object"&&typeof module<"u"?f(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"],f):(P=typeof globalThis<"u"?globalThis:P||self,f(P.UniverSheetsFormula={},P.UniverCore,P.UniverSheets,P.UniverEngineFormula,P.rxjs,P.UniverRpc))})(this,(function(P,f,s,t,w,ut){"use strict";var ba=Object.defineProperty;var ya=(P,f,s)=>f in P?ba(P,f,{enumerable:!0,configurable:!0,writable:!0,value:s}):P[f]=s;var h=(P,f,s)=>ya(P,typeof f!="symbol"?f+"":f,s);const Ut={id:"formula.command.insert-function",type:f.CommandType.COMMAND,handler:async(r,e)=>{const{list:a,listOfRangeHasNumber:n}=e,i=r.get(f.ICommandService),o=new f.ObjectMatrix;a.forEach(c=>{const{range:m,primary:l,formula:p}=c,{row:L,column:N}=l,T=f.generateRandomId(6);o.setValue(L,N,{f:p,si:T});const{startRow:I,startColumn:C,endRow:R,endColumn:d}=m;for(let S=I;S<=R;S++)for(let A=C;A<=d;A++)(S!==L||A!==N)&&o.setValue(S,A,{si:T})}),n&&n.length>0&&n.forEach(c=>{const{primary:m,formula:l}=c;o.setValue(m.row,m.column,{f:l})});const u={value:o.getData()};return i.executeCommand(s.SetRangeValuesCommand.id,u)}},qt={id:"sheets-formula.command.quick-sum",type:f.CommandType.COMMAND,handler:async r=>{const a=r.get(s.SheetsSelectionsService).getCurrentLastSelection();if(!a)return!1;const n=r.get(f.IUniverInstanceService),i=s.getSheetCommandTarget(n);if(!i)return!1;const o=a.range,{worksheet:u}=i;let c=s.findFirstNonEmptyCell(o,u);if(!c)return!1;c=s.alignToMergedCellsBorders(c,u);const m=s.expandToContinuousRange({startRow:c.startRow,startColumn:c.startColumn,endRow:o.endRow,endColumn:o.endColumn},{left:!0,right:!0,up:!0,down:!0},u),l=new f.ObjectMatrix,p=s.alignToMergedCellsBorders({startRow:m.endRow,endRow:m.endRow,startColumn:m.startColumn,endColumn:m.endColumn},u);if(!f.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(!f.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(f.ICommandService);return(await f.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:f.Rectangle.contains(m,a.primary)?a.primary:{...c,actualRow:c.startRow,actualColumn:c.startColumn},style:null}]}}],N)).result}},z={type:f.CommandType.MUTATION,id:"sheet.mutation.data-validation-formula-mark-dirty",handler(){return!0}},Z="sheets-formula.base.config";var X=(r=>(r[r.FORCED=0]="FORCED",r[r.WHEN_EMPTY=1]="WHEN_EMPTY",r[r.NO_CALCULATION=2]="NO_CALCULATION",r))(X||{});const ht={},Kt="sheets-formula.remote.config",Ft={};var J=(r=>(r[r.NOT_REGISTER=1]="NOT_REGISTER",r[r.SUCCESS=2]="SUCCESS",r[r.WAIT=3]="WAIT",r[r.ERROR=4]="ERROR",r))(J||{}),gt=Object.getOwnPropertyDescriptor,kt=(r,e,a,n)=>{for(var i=n>1?void 0:n?gt(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);P.RegisterOtherFormulaService=class extends f.Disposable{constructor(a,n,i){super();h(this,"_formulaCacheMap",new Map);h(this,"_formulaChangeWithRange$",new w.Subject);h(this,"formulaChangeWithRange$",this._formulaChangeWithRange$.asObservable());h(this,"_formulaResult$",new w.Subject);h(this,"formulaResult$",this._formulaResult$.asObservable());h(this,"calculateStarted$",new w.BehaviorSubject(!1));this._commandService=a,this._activeDirtyManagerService=n,this._lifecycleService=i,this._initFormulaRegister(),this._initFormulaCalculationResultChange()}dispose(){super.dispose(),this._formulaChangeWithRange$.complete(),this._formulaResult$.complete(),this.calculateStarted$.complete()}_ensureCacheMap(a,n){let i=this._formulaCacheMap.get(a);i||(i=new Map,this._formulaCacheMap.set(a,i));let o=i.get(n);return o||(o=new Map,i.set(n,o)),o}_createFormulaId(a,n){return`formula.${a}_${n}_${f.generateRandomId(8)}`}_initFormulaRegister(){this._activeDirtyManagerService.register(z.id,{commandId:z.id,getDirtyData(n){return{dirtyUnitOtherFormulaMap:n.params}}});const a=n=>{const{unitId:i,subUnitId:o,formulaText:u,formulaId:c,ranges:m}=n;if(!this._ensureCacheMap(i,o).has(c))return;const p={unitId:i,subUnitId:o,formulaMap:{[c]:{f:u,ranges:m}}};this._commandService.executeCommand(t.SetOtherFormulaMutation.id,p).then(()=>{this._commandService.executeCommand(z.id,{[i]:{[o]:{[c]:!0}}})})};this.disposeWithMe(this._formulaChangeWithRange$.pipe(w.bufferWhen(()=>this.calculateStarted$.pipe(w.filter(n=>n)))).subscribe(n=>n.forEach(a))),this.disposeWithMe(this._formulaChangeWithRange$.pipe(w.filter(()=>this.calculateStarted$.getValue())).subscribe(a))}_initFormulaCalculationResultChange(){this.disposeWithMe(this._commandService.onCommandExecuted(a=>{if(a.id===t.SetFormulaCalculationResultMutation.id){const n=a.params,{unitOtherData:i}=n,o={};for(const u in i){const c=i[u],m={};o[u]=m;for(const l in c){const p=this._ensureCacheMap(u,l),L=c[l],N=[];m[l]=N;for(const T in L){const I=L[T];if(p.has(T)){const C=p.get(T);if(!C)continue;C.result||(C.result={});const R=new f.ObjectMatrix(I),d=new f.ObjectMatrix(C.result);R.forValue((S,A,E)=>{d.setValue(S,A,E)}),C.status=J.SUCCESS,C.callbacks.forEach(S=>{S(I)}),C.callbacks.clear(),N.push(C)}}}}this._formulaResult$.next(o)}}))}registerFormulaWithRange(a,n,i,o=[{startRow:0,endRow:0,startColumn:0,endColumn:0}],u){const c=this._createFormulaId(a,n);return this._ensureCacheMap(a,n).set(c,{result:void 0,status:J.WAIT,formulaId:c,callbacks:new Set,extra:u}),this._formulaChangeWithRange$.next({unitId:a,subUnitId:n,formulaText:i,formulaId:c,ranges:o}),c}deleteFormula(a,n,i){const o={unitId:a,subUnitId:n,formulaIdList:i};this._commandService.executeCommand(t.RemoveOtherFormulaMutation.id,o);const u=this._ensureCacheMap(a,n);i.forEach(c=>u.delete(c))}getFormulaValue(a,n,i){const o=this._ensureCacheMap(a,n),u=o.get(i);return u?u.status===J.SUCCESS||u.status===J.ERROR?Promise.resolve(u):new Promise(c=>{u.callbacks.add(()=>{c(o.get(i))})}):Promise.resolve(null)}getFormulaValueSync(a,n,i){return this._ensureCacheMap(a,n).get(i)}markFormulaDirty(a,n,i){const o=this.getFormulaValueSync(a,n,i);o&&(o.status=J.WAIT,this._commandService.executeCommand(z.id,{[a]:{[n]:{[i]:!0}}}))}},P.RegisterOtherFormulaService=kt([St(0,f.ICommandService),St(1,t.IActiveDirtyManagerService),St(2,f.Inject(f.LifecycleService))],P.RegisterOtherFormulaService);var Qt=Object.getOwnPropertyDescriptor,jt=(r,e,a,n)=>{for(var i=n>1?void 0:n?Qt(e,a):e,o=r.length-1,u;o>=0;o--)(u=r[o])&&(i=u(i)||i);return i},K=(r,e)=>(a,n)=>e(a,n,r);const Bt={done:0,count:0},Ct={onlyLocal:!0};P.TriggerCalculationController=class extends f.Disposable{constructor(a,n,i,o,u,c,m){super();h(this,"_waitingCommandQueue",[]);h(this,"_executingDirtyData",{forceCalculation:!1,dirtyRanges:[],dirtyNameMap:{},dirtyDefinedNameMap:{},dirtyUnitFeatureMap:{},dirtyUnitOtherFormulaMap:{},clearDependencyTreeCache:{}});h(this,"_setTimeoutKey",-1);h(this,"_startExecutionTime",0);h(this,"_totalCalculationTaskCount",0);h(this,"_doneCalculationTaskCount",0);h(this,"_executionInProgressParams",null);h(this,"_restartCalculation",!1);h(this,"_forceCalculating",!1);h(this,"_progress$",new w.BehaviorSubject(Bt));h(this,"progress$",this._progress$.asObservable());this._commandService=a,this._activeDirtyManagerService=n,this._logService=i,this._configService=o,this._formulaDataModel=u,this._localeService=c,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(Bt),this._progress$.complete(),clearTimeout(this._setTimeoutKey)}_getCalculationMode(){var n;const a=this._configService.getConfig(Z);return(n=a==null?void 0:a.initialFormulaComputing)!=null?n:X.WHEN_EMPTY}_commandExecutedListener(){this.disposeWithMe(this._commandService.beforeCommandExecuted(a=>{if(a.id===t.SetFormulaCalculationStartMutation.id){const n=a.params;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},Ct):(this._restartCalculation=!0,this._commandService.executeCommand(t.SetFormulaCalculationStopMutation.id,{})),this._waitingCommandQueue=[]},100)}}))}_generateDirty(a){const n=[],i={},o={},u={},c={},m={};for(const l of a){const p=this._activeDirtyManagerService.get(l.id);if(p==null)continue;const L=p.getDirtyData(l),{dirtyRanges:N,dirtyNameMap:T,dirtyDefinedNameMap:I,dirtyUnitFeatureMap:C,dirtyUnitOtherFormulaMap:R,clearDependencyTreeCache:d}=L;N!=null&&this._mergeDirtyRanges(n,N),T!=null&&this._mergeDirtyNameMap(i,T),I!=null&&this._mergeDirtyNameMap(o,I),C!=null&&this._mergeDirtyUnitFeatureOrOtherFormulaMap(u,C),R!=null&&this._mergeDirtyUnitFeatureOrOtherFormulaMap(c,R),d!=null&&this._mergeDirtyNameMap(m,d)}return{dirtyRanges:n,dirtyNameMap:i,dirtyDefinedNameMap:o,dirtyUnitFeatureMap:u,dirtyUnitOtherFormulaMap:c,forceCalculation:!1,clearDependencyTreeCache:m,maxIteration:this._configService.getConfig(t.ENGINE_FORMULA_CYCLE_REFERENCE_COUNT)}}_mergeDirty(a,n){const i=[...a.dirtyRanges,...n.dirtyRanges],o={...a.dirtyNameMap},u={...a.dirtyDefinedNameMap},c={...a.dirtyUnitFeatureMap},m={...a.dirtyUnitOtherFormulaMap},l={...a.clearDependencyTreeCache};this._mergeDirtyNameMap(o,n.dirtyNameMap),this._mergeDirtyNameMap(u,n.dirtyDefinedNameMap),this._mergeDirtyUnitFeatureOrOtherFormulaMap(c,n.dirtyUnitFeatureMap),this._mergeDirtyUnitFeatureOrOtherFormulaMap(m,n.dirtyUnitOtherFormulaMap),this._mergeDirtyNameMap(l,n.clearDependencyTreeCache);const p=a.maxIteration||n.maxIteration;return{dirtyRanges:i,dirtyNameMap:o,dirtyDefinedNameMap:u,dirtyUnitFeatureMap:c,dirtyUnitOtherFormulaMap:m,forceCalculation:!!this._forceCalculating,clearDependencyTreeCache:l,maxIteration:p}}_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:c,startColumn:m,endRow:l,endColumn:p}=i.range,{startRow:L,startColumn:N,endRow:T,endColumn:I}=u.range;if(c===L&&m===N&&l===T&&p===I){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.SetFormulaCalculationStartMutation.id){const{forceCalculation:u=!1}=i.params;u&&(this._forceCalculating=!0)}else i.id===t.SetFormulaCalculationStopMutation.id&&this.clearProgress();if(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 c=this._localeService.t("formula.progress.calculating");this._calculateProgress(c)}}else if(u===t.FormulaExecuteStageType.START_DEPENDENCY_ARRAY_FORMULA){if(this._executionInProgressParams=o.stageInfo,a===null){const c=this._localeService.t("formula.progress.array-analysis");this._calculateProgress(c)}}else if(u===t.FormulaExecuteStageType.CURRENTLY_CALCULATING_ARRAY_FORMULA&&(this._executionInProgressParams=o.stageInfo,a===null)){const c=this._localeService.t("formula.progress.array-calculation");this._calculateProgress(c)}}else{const u=o.functionsExecutedState;let c="";switch(n--,u){case t.FormulaExecutedStateType.NOT_EXECUTED:c="No tasks are being executed anymore",this._resetExecutingDirtyData();break;case t.FormulaExecutedStateType.STOP_EXECUTION:c="The execution of the formula has been stopped",n=0;break;case t.FormulaExecutedStateType.SUCCESS:c="Formula calculation succeeded",(n===0||n===-1)&&(c+=`. Total time consumed: ${performance.now()-this._startExecutionTime} ms`),this._resetExecutingDirtyData();break;case t.FormulaExecutedStateType.INITIAL:c="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,this._forceCalculating=!1),u===t.FormulaExecutedStateType.STOP_EXECUTION&&this._restartCalculation?(this._restartCalculation=!1,this._commandService.executeCommand(t.SetFormulaCalculationStartMutation.id,{...this._executingDirtyData},Ct)):this._executionInProgressParams=null,this._logService.debug("[TriggerCalculationController]",c)}}))}_resetExecutingDirtyData(){this._executingDirtyData={dirtyRanges:[],dirtyNameMap:{},dirtyDefinedNameMap:{},dirtyUnitFeatureMap:{},dirtyUnitOtherFormulaMap:{},forceCalculation:!1,clearDependencyTreeCache:{}}}_initialExecuteFormula(){const a=this._getCalculationMode(),n=this._getDirtyDataByCalculationMode(a);this._commandService.executeCommand(t.SetFormulaCalculationStartMutation.id,n,Ct),this._registerOtherFormulaService.calculateStarted$.next(!0)}_getDirtyDataByCalculationMode(a){const n=a===X.FORCED,i=a===X.WHEN_EMPTY?this._formulaDataModel.getFormulaDirtyRanges():[];return{forceCalculation:n,dirtyRanges:i,dirtyNameMap:{},dirtyDefinedNameMap:{},dirtyUnitFeatureMap:{},dirtyUnitOtherFormulaMap:{},clearDependencyTreeCache:{},maxIteration:this._configService.getConfig(t.ENGINE_FORMULA_CYCLE_REFERENCE_COUNT)}}},P.TriggerCalculationController=jt([K(0,f.ICommandService),K(1,t.IActiveDirtyManagerService),K(2,f.ILogService),K(3,f.IConfigService),K(4,f.Inject(t.FormulaDataModel)),K(5,f.Inject(f.LocaleService)),K(6,f.Inject(P.RegisterOtherFormulaService))],P.TriggerCalculationController);function $t(r,e,a){var n;return r==null||r[e]==null||((n=r[e])==null?void 0:n[a])==null}function Rt(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 D=(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))(D||{});const zt=[11,12,13,14];function Zt(r,e,a){const{type:n}=a;return zt.includes(n)?Jt(r,e):te(r,e,a)}function Jt(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(c=>{const m=new f.ObjectMatrix(o[c]||{}),l=new f.ObjectMatrix(u[c]||{}),p=new f.ObjectMatrix,L=new f.ObjectMatrix;if(m.forValue((R,d,S)=>{if(S==null)return!0;const A=nt(S);A!==null&&(p.setValue(R,d,A),L.setValue(R,d,l.getValue(R,d)))}),p.getSizeOf()===0)return;const N={subUnitId:c,unitId:i,cellValue:p.getMatrix()},T={id:s.SetRangeValuesMutation.id,params:N};n.push(T);const I={subUnitId:c,unitId:i,cellValue:L.getMatrix()},C={id:s.SetRangeValuesMutation.id,params:I};a.push(C)})}),{undos:a,redos:n}}function te(r,e,a){const{redoFormulaData:n,undoFormulaData:i}=ee(r,e,a),o=[],u=[];return Object.keys(n).forEach(c=>{Object.keys(n[c]).forEach(m=>{if(Object.keys(n[c][m]).length!==0){const l={subUnitId:m,unitId:c,cellValue:n[c][m]},p={id:s.SetRangeValuesMutation.id,params:l};o.push(p)}})}),Object.keys(i).forEach(c=>{Object.keys(i[c]).forEach(m=>{if(Object.keys(i[c][m]).length!==0){const l={subUnitId:m,unitId:c,cellValue:i[c][m]},p={id:s.SetRangeValuesMutation.id,params:l};u.push(p)}})}),{undos:u,redos:o}}function ee(r,e,a){const n={},i={},{unitId:o,sheetId:u}=a;return new Set([...Object.keys(r),...Object.keys(e)]).forEach(m=>{if($t(r,m,u))return;new Set([...Object.keys(r[m]||{}),...Object.keys(e[m]||{})]).forEach(p=>{var S,A;const L=(S=r[m])==null?void 0:S[p],N=(A=e[m])==null?void 0:A[p],T=new f.ObjectMatrix(L||{}),I=new f.ObjectMatrix(N||{});let C=[];m!==o||p!==u?C=ne(I):C=ae(T,I,a);const R=Ne(C,T,I),d=Pe(C,T);n[m]||(n[m]={}),i[m]||(i[m]={}),n[m][p]={...n[m][p],...R},i[m][p]={...i[m][p],...d}})}),{redoFormulaData:n,undoFormulaData:i}}function ae(r,e,a){const{type:n,from:i,to:o,range:u}=a,c=[];return r.forValue((m,l,p)=>{if(p==null||!vt(p))return!0;const L=f.cellToRange(m,l);let N=null,T=!1;if([0,1,2].includes(n))N=ie(n,i,o,L);else if(u!=null){const I=re(L,a);N=I.newCell,T=I.isReverse}if(f.Tools.diffValue(L,N)&&!e.getValue(m,l))return!0;T?c.unshift({oldCell:L,newCell:N}):c.push({oldCell:L,newCell:N})}),c}function ne(r){const e=[];return r.forValue((a,n,i)=>{if(i==null||!vt(i))return!0;const o=f.cellToRange(a,n);e.push({oldCell:o,newCell:o})}),e}function ie(r,e,a,n){if(e==null||a==null)return null;switch(r){case 0:return oe(e,a,n);case 1:return ue(e,a,n);case 2:return ce(e,a,n);default:return null}}function re(r,e){const{type:a,rangeFilteredRows:n}=e,i=e.range;let o=null,u=!1;switch(a){case 3:o=fe(i,r),u=!0;break;case 4:o=me(i,r),u=!0;break;case 5:o=se(i,r,n);break;case 6:o=le(i,r);break;case 7:o=pe(i,r);break;case 8:o=de(i,r);break;case 9:o=Le(i,r),u=!0;break;case 10:o=Te(i,r),u=!0;break}return{newCell:o,isReverse:u}}function oe(r,e,a){const n=s.handleMoveRange({id:s.EffectRefRangId.MoveRangeCommandId,params:{toRange:e,fromRange:r}},a);return s.runRefRangeMutations(n,a)}function ue(r,e,a){const n=s.handleMoveRows({id:s.EffectRefRangId.MoveRowsCommandId,params:{toRange:e,fromRange:r}},a);return s.runRefRangeMutations(n,a)}function ce(r,e,a){const n=s.handleMoveCols({id:s.EffectRefRangId.MoveColsCommandId,params:{toRange:e,fromRange:r}},a);return s.runRefRangeMutations(n,a)}function fe(r,e){const a=s.handleInsertRow({id:s.EffectRefRangId.InsertRowCommandId,params:{range:r,unitId:"",subUnitId:"",direction:f.Direction.DOWN}},e);return s.runRefRangeMutations(a,e)}function me(r,e){const a=s.handleInsertCol({id:s.EffectRefRangId.InsertColCommandId,params:{range:r,unitId:"",subUnitId:"",direction:f.Direction.RIGHT}},e);return s.runRefRangeMutations(a,e)}function se(r,e,a){const n=s.handleIRemoveRow({id:s.EffectRefRangId.RemoveRowCommandId,params:{range:r}},e,a);return s.runRefRangeMutations(n,e)}function le(r,e){const a=s.handleIRemoveCol({id:s.EffectRefRangId.RemoveColCommandId,params:{range:r}},e);return s.runRefRangeMutations(a,e)}function pe(r,e){const a=s.handleDeleteRangeMoveLeft({id:s.EffectRefRangId.DeleteRangeMoveLeftCommandId,params:{range:r}},e);return s.runRefRangeMutations(a,e)}function de(r,e){const a=s.handleDeleteRangeMoveUp({id:s.EffectRefRangId.DeleteRangeMoveUpCommandId,params:{range:r}},e);return s.runRefRangeMutations(a,e)}function Le(r,e){const a=s.handleInsertRangeMoveDown({id:s.EffectRefRangId.InsertRangeMoveDownCommandId,params:{range:r}},e);return s.runRefRangeMutations(a,e)}function Te(r,e){const a=s.handleInsertRangeMoveRight({id:s.EffectRefRangId.InsertRangeMoveRightCommandId,params:{range:r}},e);return s.runRefRangeMutations(a,e)}function Ne(r,e,a){var i,o,u;const n=new f.ObjectMatrix({});for(let c=0;c<r.length;c++){const{oldCell:m,newCell:l}=r[c];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=nt(p);n.setValue(l.startRow,l.startColumn,L)}}return n.getMatrix()}function Pe(r,e){const a=new f.ObjectMatrix({});for(let n=r.length-1;n>=0;n--){const{oldCell:i,newCell:o}=r[n],u=e.getValue(i.startRow,i.startColumn),c=nt(u);if(a.setValue(i.startRow,i.startColumn,c),o){const m=e.getValue(o.startRow,o.startColumn),l=nt(m);a.setValue(o.startRow,o.startColumn,l!=null?l:{f:null,si:null})}}return a.getMatrix()}function nt(r){if(r==null)return null;const{f:e,si:a,x:n=0,y:i=0}=r,o=f.isFormulaString(e),u=f.isFormulaId(a);if(!o&&!u)return{f:null,si:null};const c={};return u&&(c.si=a),o&&n===0&&i===0&&(c.f=e),c.f===void 0&&(c.f=null),c.si===void 0&&(c.si=null),c}function Ee(r){const e=new f.ObjectMatrix({});return new f.ObjectMatrix(r).forValue((n,i,o)=>{const u=nt(o);u!==void 0&&e.setValue(n,i,u)}),e.getMatrix()}function vt(r){const e=(r==null?void 0:r.f)||"",a=(r==null?void 0:r.si)||"",n=f.isFormulaString(e),i=f.isFormulaId(a);return!!(n||i)}function Vt(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 Gt(r,e,a=0,n=0){const i=[];for(let o=0,u=r.length;o<u;o++){const c=r[o];if(typeof c=="string"||c.nodeType!==t.sequenceNodeType.REFERENCE||e.includes(o)){i.push(c);continue}const{token:m}=c,l=t.deserializeRangeWithSheetWithCache(m),{range:p,sheetName:L,unitId:N}=l,T=f.Rectangle.moveOffset(p,a,n);i.push({...c,token:t.serializeRangeToRefString({range:T,unitId:N,sheetName:L})})}return i}function Ht(r,e,a,n){const{type:i,unitId:o,sheetId:u,range:c,from:m,to:l,rangeFilteredRows:p}=e,{range:L,sheetId:N,unitId:T,sheetName:I,refOffsetX:C,refOffsetY:R}=r;if(!Vt(o,u,a,n,T,N))return;const d=f.Rectangle.moveOffset(L,C,R);let S=null;if(i===D.MoveRange){if(m==null||l==null)return;const A=Mt(d,m),E=f.getIntersectRange(d,m);if(E==null||A!==4)return;const O=s.handleMoveRange({id:s.EffectRefRangId.MoveRangeCommandId,params:{toRange:l,fromRange:m}},E),y=s.runRefRangeMutations(O,E);if(y==null)return t.ErrorType.REF;S=Ot(A,y,m,l,d,E)}else if(i===D.MoveRows){if(m==null||l==null)return;const A=Mt(d,m);let E=f.getIntersectRange(d,m);if(E==null&&(m.endRow<d.startRow&&l.endRow<=d.startRow||m.startRow>d.endRow&&l.startRow>d.endRow))return;E==null&&(E={startRow:d.startRow,endRow:d.endRow,startColumn:d.startColumn,endColumn:d.endColumn,rangeType:f.RANGE_TYPE.NORMAL});const O=s.handleMoveRows({id:s.EffectRefRangId.MoveRowsCommandId,params:{toRange:l,fromRange:m}},E),y=s.runRefRangeMutations(O,E);if(y==null)return t.ErrorType.REF;S=Ot(A,y,m,l,d,E)}else if(i===D.MoveCols){if(m==null||l==null)return;const A=Mt(d,m);let E=f.getIntersectRange(d,m);if(E==null&&(m.endColumn<d.startColumn&&l.endColumn<=d.startColumn||m.startColumn>d.endColumn&&l.startColumn>d.endColumn))return;E==null&&(E={startRow:d.startRow,endRow:d.endRow,startColumn:d.startColumn,endColumn:d.endColumn,rangeType:f.RANGE_TYPE.NORMAL});const O=s.handleMoveCols({id:s.EffectRefRangId.MoveColsCommandId,params:{toRange:l,fromRange:m}},E),y=s.runRefRangeMutations(O,E);if(y==null)return t.ErrorType.REF;S=Ot(A,y,m,l,d,E)}if(c!=null){if(i===D.InsertRow){const A=s.handleInsertRow({id:s.EffectRefRangId.InsertRowCommandId,params:{range:c,unitId:"",subUnitId:"",direction:f.Direction.DOWN}},d),E=s.runRefRangeMutations(A,d);if(E==null)return;S={...d,...E}}else if(i===D.InsertColumn){const A=s.handleInsertCol({id:s.EffectRefRangId.InsertColCommandId,params:{range:c,unitId:"",subUnitId:"",direction:f.Direction.RIGHT}},d),E=s.runRefRangeMutations(A,d);if(E==null)return;S={...d,...E}}else if(i===D.RemoveRow){const A=s.handleIRemoveRow({id:s.EffectRefRangId.RemoveRowCommandId,params:{range:c}},d,p),E=s.runRefRangeMutations(A,d);if(E==null)return t.ErrorType.REF;S={...d,...E}}else if(i===D.RemoveColumn){const A=s.handleIRemoveCol({id:s.EffectRefRangId.RemoveColCommandId,params:{range:c}},d),E=s.runRefRangeMutations(A,d);if(E==null)return t.ErrorType.REF;S={...d,...E}}else if(i===D.DeleteMoveLeft){const A=s.handleDeleteRangeMoveLeft({id:s.EffectRefRangId.DeleteRangeMoveLeftCommandId,params:{range:c}},d),E=s.runRefRangeMutations(A,d);if(E==null)return t.ErrorType.REF;S={...d,...E}}else if(i===D.DeleteMoveUp){const A=s.handleDeleteRangeMoveUp({id:s.EffectRefRangId.DeleteRangeMoveUpCommandId,params:{range:c}},d),E=s.runRefRangeMutations(A,d);if(E==null)return t.ErrorType.REF;S={...d,...E}}else if(i===D.InsertMoveDown){const A=s.handleInsertRangeMoveDown({id:s.EffectRefRangId.InsertRangeMoveDownCommandId,params:{range:c}},d),E=s.runRefRangeMutations(A,d);if(E==null)return;S={...d,...E}}else if(i===D.InsertMoveRight){const A=s.handleInsertRangeMoveRight({id:s.EffectRefRangId.InsertRangeMoveRightCommandId,params:{range:c}},d),E=s.runRefRangeMutations(A,d);if(E==null)return;S={...d,...E}}}if(S!=null)return t.serializeRangeToRefString({range:S,sheetName:I,unitId:T})}function Ot(r,e,a,n,i,o){const{startRow:u,endRow:c,startColumn:m,endColumn:l,rangeType:p}=it(e),{startRow:L,startColumn:N,endRow:T,endColumn:I,rangeType:C=f.RANGE_TYPE.NORMAL}=it(a),{startRow:R,startColumn:d,endRow:S,endColumn:A}=it(n),{startRow:E,endRow:O,startColumn:y,endColumn:q}=it(o),{startRow:_,endRow:x,startColumn:b,endColumn:U,rangeType:F=f.RANGE_TYPE.NORMAL}=it(i),M={...i};function B(){return p===f.RANGE_TYPE.COLUMN&&F===f.RANGE_TYPE.COLUMN?!0:m>=b&&l<=U}function k(){return p===f.RANGE_TYPE.ROW&&F===f.RANGE_TYPE.ROW?!0:u>=_&&c<=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(c>x)M.endRow=c;else if(c<=_)M.startRow+=x-L+1;else return;else return;else if(r===2)if(k())if(m<b)M.startColumn=m;else if(m>=U)M.endColumn-=I+1-b;else return;else return;else if(r===3)if(k())if(l>U)M.endColumn=l;else if(l<=b)M.startColumn+=U-N+1;else return;else return;else r===4?(M.startRow=u,M.startColumn=m,M.endRow=c,M.endColumn=l):N<=b&&I>=U||C===f.RANGE_TYPE.ROW&&F===f.RANGE_TYPE.ROW?a.endRow<_?(R>=_&&(M.startRow-=T-L+1),R>=x&&(M.endRow-=T-L+1)):a.startRow>x?(S<=x&&(M.endRow+=T-L+1),S<=_&&(M.startRow+=T-L+1)):a.startRow>=_&&a.endRow<=x&&(R<=_?M.startRow+=T-L+1:R>=x&&(M.endRow-=T-L+1)):L<=_&&T>=x||C===f.RANGE_TYPE.COLUMN&&F===f.RANGE_TYPE.COLUMN?a.endColumn<b?(d>=b&&(M.startColumn-=I-N+1),d>=U&&(M.endColumn-=I-N+1)):a.startColumn>U?(A<=U&&(M.endColumn+=I-N+1),A<=b&&(M.startColumn+=I-N+1)):a.startColumn>=b&&a.endColumn<=U&&(d<=b?M.startColumn+=I-N+1:d>=U&&(M.endColumn-=I-N+1)):((d<=q+1&&A>=U||d<=b&&A>=y-1)&&R<=_&&S>=x||(R<=O+1&&S>=x||R<=_&&S>=E-1)&&d<=b&&A>=U,M.startRow=u,M.startColumn=m,M.endRow=c,M.endColumn=l);return M}function Mt(r,e){const a=tt(r.startRow),n=et(r.endRow),i=tt(r.startColumn),o=et(r.endColumn),u=tt(e.startRow),c=et(e.endRow),m=tt(e.startColumn),l=et(e.endColumn);function p(){return r.rangeType===f.RANGE_TYPE.COLUMN&&e.rangeType===f.RANGE_TYPE.COLUMN?!0:a>=u&&n<=c}function L(){return r.rangeType===f.RANGE_TYPE.ROW&&e.rangeType===f.RANGE_TYPE.ROW?!0:i>=m&&o<=l}function N(){return r.rangeType===f.RANGE_TYPE.ALL&&e.rangeType===f.RANGE_TYPE.ALL}return p()&&L()||N()?4:L()&&a>=u&&a<=c&&n>c?0:L()&&n>=u&&n<=c&&a<u?1:p()&&i>=m&&i<=l&&o>l?2:p()&&o>=m&&o<=l&&i<m?3:null}function tt(r){return isNaN(r)?-1/0:r}function et(r){return isNaN(r)?1/0:r}function it(r){const{startRow:e,endRow:a,startColumn:n,endColumn:i}=r;return{...r,startRow:tt(e),endRow:et(a),startColumn:tt(n),endColumn:et(i)}}function Yt(r,e){const{id:a}=e;let n=null;switch(a){case s.MoveRangeCommand.id:n=Ie(e,r);break;case s.MoveRowsCommand.id:n=Ae(e,r);break;case s.MoveColsCommand.id:n=Se(e,r);break;case s.InsertRowCommand.id:n=Ce(e);break;case s.InsertColCommand.id:n=Re(e);break;case s.InsertRangeMoveRightCommand.id:n=Oe(e,r);break;case s.InsertRangeMoveDownCommand.id:n=Me(e,r);break;case s.RemoveRowCommand.id:n=_e(e,r);break;case s.RemoveColCommand.id:n=De(e,r);break;case s.DeleteRangeMoveUpCommand.id:n=be(e,r);break;case s.DeleteRangeMoveLeftCommand.id:n=ye(e,r);break;case s.SetWorksheetNameCommand.id:n=xe(e,r);break;case s.RemoveSheetCommand.id:n=Ue(e,r);break;case s.SetDefinedNameCommand.id:n=qe(e,r);break;case s.RemoveDefinedNameCommand.id:n=he(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 Ie(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:D.MoveRange,from:n,to:i,unitId:o,sheetId:u}}function Ae(r,e){const{params:a}=r;if(!a)return null;const{fromRange:{startRow:n,endRow:i},toRange:{startRow:o,endRow:u}}=a,c=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:f.RANGE_TYPE.ROW},L={startRow:o,startColumn:0,endRow:u,endColumn:m.getColumnCount()-1,rangeType:f.RANGE_TYPE.ROW};return{type:D.MoveRows,from:p,to:L,unitId:c,sheetId:l}}function Se(r,e){const{params:a}=r;if(!a)return null;const{fromRange:{startColumn:n,endColumn:i},toRange:{startColumn:o,endColumn:u}}=a,c=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:f.RANGE_TYPE.COLUMN},L={startRow:0,startColumn:o,endRow:m.getRowCount()-1,endColumn:u,rangeType:f.RANGE_TYPE.COLUMN};return{type:D.MoveCols,from:p,to:L,unitId:c,sheetId:l}}function Ce(r){const{params:e}=r;if(!e)return null;const{range:a,unitId:n,subUnitId:i}=e;return{type:D.InsertRow,range:a,unitId:n,sheetId:i}}function Re(r){const{params:e}=r;if(!e)return null;const{range:a,unitId:n,subUnitId:i}=e;return{type:D.InsertColumn,range:a,unitId:n,sheetId:i}}function Oe(r,e){const{params:a}=r;if(!a)return null;const{range:n}=a,{unitId:i,sheetId:o}=v(e);return{type:D.InsertMoveRight,range:n,unitId:i,sheetId:o}}function Me(r,e){const{params:a}=r;if(!a)return null;const{range:n}=a,{unitId:i,sheetId:o}=v(e);return{type:D.InsertMoveDown,range:n,unitId:i,sheetId:o}}function _e(r,e){var u,c;const{params:a}=r;if(!a)return null;const{range:n}=a,{unitId:i,sheetId:o}=v(e);return{type:D.RemoveRow,range:n,unitId:i,sheetId:o,rangeFilteredRows:(c=(u=e.getSheetBySheetId(o))==null?void 0:u.getRangeFilterRows(n))!=null?c:[]}}function De(r,e){const{params:a}=r;if(!a)return null;const{range:n}=a,{unitId:i,sheetId:o}=v(e);return{type:D.RemoveColumn,range:n,unitId:i,sheetId:o}}function be(r,e){const{params:a}=r;if(!a)return null;const{range:n}=a,{unitId:i,sheetId:o}=v(e);return{type:D.DeleteMoveUp,range:n,unitId:i,sheetId:o}}function ye(r,e){const{params:a}=r;if(!a)return null;const{range:n}=a,{unitId:i,sheetId:o}=v(e);return{type:D.DeleteMoveLeft,range:n,unitId:i,sheetId:o}}function xe(r,e){const{params:a}=r;if(!a)return null;const{unitId:n,subUnitId:i,name:o}=a,{unitId:u,sheetId:c}=v(e);return{type:D.SetName,unitId:n||u,sheetId:i||c,sheetName:o}}function Ue(r,e){const{params:a}=r;if(!a)return null;const{unitId:n,subUnitId:i}=a,{unitId:o,sheetId:u}=v(e);return{type:D.RemoveSheet,unitId:n||o,sheetId:i||u}}function qe(r,e){const{params:a}=r;if(!a)return null;const{unitId:n,name:i,id:o}=a,{sheetId:u}=v(e);return{type:D.SetDefinedName,unitId:n,sheetId:u,definedName:i,definedNameId:o}}function he(r,e){const{params:a}=r;if(!a)return null;const{unitId:n,name:i,id:o}=a,{sheetId:u}=v(e);return{type:D.RemoveDefinedName,unitId:n,sheetId:u,definedName:i,definedNameId:o}}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},ct=(r,e)=>(a,n)=>e(a,n,r);P.UpdateDefinedNameController=class extends f.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(f.UniverInstanceType.UNIVER_SHEET);if(a==null)return{redos:[],undos:[]};const n=Yt(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 c=[],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 S=0,A=L.length;S<A;S++){const E=L[S];if(typeof E=="string"||E.nodeType!==t.sequenceNodeType.REFERENCE)continue;const{token:O}=E,y=t.deserializeRangeWithSheetWithCache(O),{range:q,sheetName:_,unitId:x}=y,b=((d=e.getSheetBySheetName(_))==null?void 0:d.getSheetId())||"",U={range:q,sheetId:b,unitId:x,sheetName:_,refOffsetX:0,refOffsetY:0};let F=null;if(n===D.RemoveSheet)F=this._removeSheet(l,i,o);else if(n===D.SetName){const{sheetId:M,sheetName:B}=a;if(B==null||b==null||b.length===0||M!==b)continue;F=t.serializeRangeToRefString({range:q,sheetName:B,unitId:x})}else F=Ht(U,a,i,o);F!=null&&(L[S]={...E,token:F},N=!0,T.push(S))}if(!N)return!0;const I=t.generateStringWithSequence(Gt(L,T)),C={id:t.SetDefinedNameMutation.id,params:{unitId:i,...l,formulaOrRefString:I}};c.push(C);const R={id:t.SetDefinedNameMutation.id,params:{unitId:i,...l}};m.push(R)}),{redos:c,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=Be([ct(0,t.IDefinedNamesService),ct(1,f.IUniverInstanceService),ct(2,f.Inject(s.SheetInterceptorService)),ct(3,f.Inject(t.LexerTreeBuilder))],P.UpdateDefinedNameController);var ve=Object.getOwnPropertyDescriptor,Ve=(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},W=(r,e)=>(a,n)=>e(a,n,r);P.UpdateFormulaController=class extends f.Disposable{constructor(e,a,n,i,o,u,c,m){super(),this._univerInstanceService=e,this._commandService=a,this._lexerTreeBuilder=n,this._formulaDataModel=i,this._sheetInterceptorService=o,this._definedNamesService=u,this._configService=c,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||n.trigger===s.SetStyleCommand.id||n.trigger===s.SetBorderCommand.id||n.trigger===s.ClearSelectionFormatCommand.id)return;this._handleSetRangeValuesMutation(n)}})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitAdded$(f.UniverInstanceType.UNIVER_SHEET).subscribe(e=>this._handleWorkbookAdded(e))),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitDisposed$(f.UniverInstanceType.UNIVER_SHEET).pipe(w.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:Ee(o)},{onlyLocal:!0,fromFormula:!0}),this._formulaDataModel.updateArrayFormulaCellData(n,a,i),this._formulaDataModel.updateArrayFormulaRange(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=Rt(n,e,a),o=this._formulaDataModel.getArrayFormulaRange(),u=Rt(o,e,a),c=this._formulaDataModel.getArrayFormulaCellData(),m=Rt(c,e,a);i&&this._commandService.executeCommand(t.SetFormulaDataMutation.id,{formulaData:i},{onlyLocal:!0}),u&&m&&this._commandService.executeCommand(t.SetArrayFormulaDataMutation.id,{arrayFormulaRange:o,arrayFormulaCellData:c},{onlyLocal:!0})}_handleInsertSheetMutation(e){const{sheet:a,unitId:n}=e,i=this._formulaDataModel.getFormulaData(),{id:o,cellData:u}=a,c=new f.ObjectMatrix(u),m=t.initSheetFormulaData(i,n,o,c);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 I;const L=p.getCellMatrix(),N=p.getSheetId(),T=t.initSheetFormulaData(a,n,N,L);i[n][N]=(I=T[n])==null?void 0:I[N]}),this._commandService.executeCommand(t.SetFormulaDataMutation.id,{formulaData:i},{onlyLocal:!0});const u=this._configService.getConfig(Z),c=(l=u==null?void 0:u.initialFormulaComputing)!=null?l:X.WHEN_EMPTY,m=this._getDirtyDataByCalculationMode(c);this._commandService.executeCommand(t.SetFormulaCalculationStartMutation.id,m,{onlyLocal:!0})}_getDirtyDataByCalculationMode(e){const a=e===X.FORCED,n=e===X.WHEN_EMPTY?this._formulaDataModel.getFormulaDirtyRanges():[];return{forceCalculation:a,dirtyRanges:n,dirtyNameMap:{},dirtyDefinedNameMap:{},dirtyUnitFeatureMap:{},dirtyUnitOtherFormulaMap:{},clearDependencyTreeCache:{}}}_getUpdateFormula(e){const a=this._univerInstanceService.getCurrentUnitForType(f.UniverInstanceType.UNIVER_SHEET);if(!a)return{undos:[],redos:[]};const n=Yt(a,e);if(n){const{unitSheetNameMap:i}=this._formulaDataModel.getCalculateData(),o=this._formulaDataModel.getFormulaData(),{newFormulaData:u}=this._getFormulaReferenceMoveInfo(o,i,n),{undos:c,redos:m}=Zt(o,u,n);return{undos:c,redos:m}}return{undos:[],redos:[]}}_getFormulaReferenceMoveInfo(e,a,n){if(!f.Tools.isDefine(e))return{newFormulaData:{},oldFormulaData:{}};const i=Object.keys(e);if(i.length===0)return{newFormulaData:{},oldFormulaData:{}};const o={},u={};for(const c of i){const m=e[c];if(m==null)continue;const l=Object.keys(m);f.Tools.isDefine(o[c])||(o[c]={}),f.Tools.isDefine(u[c])||(u[c]={});for(const p of l){const L=new f.ObjectMatrix(m[p]||{}),N=new f.ObjectMatrix,T=[];L.forValue((I,C,R)=>{var U;if(!R)return!0;const{f:d,x:S,y:A,si:E}=R,O=this._lexerTreeBuilder.sequenceNodesBuilder(d);if(O==null)return!0;let y=!1;const q=[],{type:_,from:x}=n;for(let F=0,M=O.length;F<M;F++){const B=O[F];if(typeof B=="string")continue;const{token:k,nodeType:Q}=B;if((_===D.SetDefinedName||_===D.RemoveDefinedName)&&(Q===t.sequenceNodeType.DEFINED_NAME||Q===t.sequenceNodeType.FUNCTION)){const{definedNameId:At,definedName:at}=n;if(At===void 0||at===void 0)continue;const $=this._definedNamesService.getValueById(c,At);if($==null||$.name!==k)continue;O[F]={...B,token:_===D.SetDefinedName?at:t.ErrorType.REF},y=!0,q.push(F);continue}else if(Q!==t.sequenceNodeType.REFERENCE)continue;const j=t.deserializeRangeWithSheetWithCache(k),{range:V,sheetName:H,unitId:Y}=j,It=Y==null||Y.length===0?c:Y,G=((U=a==null?void 0:a[It])==null?void 0:U[H])||"";if(!Vt(n.unitId,n.sheetId,c,p,Y,G))continue;const xt={range:V,sheetId:G,unitId:Y,sheetName:H,refOffsetX:S||0,refOffsetY:A||0};let ot=null;if(_===D.SetName){const{unitId:At,sheetId:at,sheetName:$}=n;if($==null||G==null||G.length===0||at!==G)continue;ot=t.serializeRangeToRefString({range:V,sheetName:$,unitId:Y})}else if(_===D.RemoveSheet){const{unitId:At,sheetId:at,sheetName:$}=n;if(G==null||G.length===0||at!==G)continue;ot=t.ErrorType.REF}else _!==D.SetDefinedName&&(ot=Ht(xt,n,c,p));ot!=null&&(O[F]={...B,token:ot},y=!0,q.push(F),E&&(S!=null?S:0)===0&&(A!=null?A:0)===0&&T.push(E))}if(!y)if(E&&[D.MoveRows,D.MoveCols,D.MoveRange].includes(_)){if(x&&x.startRow<=I&&I<=x.endRow&&x.startColumn<=C&&C<=x.endColumn)(S!=null?S:0)===0&&(A!=null?A:0)===0&&T.push(E);else if(!T.includes(E))return!0}else return!0;const b=Gt(O,q,S,A);N.setValue(I,C,{f:`=${t.generateStringWithSequence(b)}`})}),u[c]&&(u[c][p]=N.getData())}}return{newFormulaData:u}}},P.UpdateFormulaController=Ve([W(0,f.IUniverInstanceService),W(1,f.ICommandService),W(2,f.Inject(t.LexerTreeBuilder)),W(3,f.Inject(t.FormulaDataModel)),W(4,f.Inject(s.SheetInterceptorService)),W(5,t.IDefinedNamesService),W(6,f.IConfigService),W(7,f.Inject(f.Injector))],P.UpdateFormulaController);const Ge="SHEETS_FORMULA_PLUGIN";var He=Object.getOwnPropertyDescriptor,Ye=(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},_t=(r,e)=>(a,n)=>e(a,n,r);let ft=class extends f.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(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(),c=this._rangeToMatrix(i).getData();return o.push(...this._getDirtyRangesByCellValue(a,e,u)),o.push(...this._getDirtyRangesByCellValue(a,e,c)),o.push(...this._getDirtyRangesForArrayFormula(a,e,c)),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),c=u==null?void 0:u.getSheetBySheetId(a),m=(c==null?void 0:c.getRowCount())||0,l=(c==null?void 0:c.getColumnCount())||0;let p=null;const{startRow:L,endRow:N,startColumn:T,endColumn:I}=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:I});const C=p.getData();return o.push(...this._getDirtyRangesByCellValue(n,a,C)),o.push(...this._getDirtyRangesForArrayFormula(n,a,C)),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 f.ObjectMatrix,{startRow:a,startColumn:n,endRow:i,endColumn:o}=r;for(let u=a;u<=i;u++)for(let c=n;c<=o;c++)e.setValue(u,c,{});return e}_getDirtyRangesByCellValue(r,e,a){const n=[];return a==null||new f.ObjectMatrix(a).getDiscreteRanges().forEach(u=>{n.push({unitId:r,sheetId:e,range:u})}),n}_getDirtyRangesForArrayFormula(r,e,a){var u,c;const n=[];if(a==null)return n;const i=new f.ObjectMatrix(a),o=this._formulaDataModel.getArrayFormulaRange();if((u=o==null?void 0:o[r])!=null&&u[e]){const m=new f.ObjectMatrix((c=o==null?void 0:o[r])==null?void 0:c[e]);i.forValue((l,p)=>{m.forValue((L,N,T)=>{if(T==null)return!0;const{startRow:I,startColumn:C,endRow:R,endColumn:d}=T;l>=I&&l<=R&&p>=C&&p<=d&&n.push({unitId:r,sheetId:e,range:{startRow:I,startColumn:C,endRow:I,endColumn:C}})})})}return n}};ft=Ye([_t(0,t.IActiveDirtyManagerService),_t(1,f.IUniverInstanceService),_t(2,f.Inject(t.FormulaDataModel))],ft);var we=Object.getOwnPropertyDescriptor,Xe=(r,e,a,n)=>{for(var i=n>1?void 0:n?we(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 mt=class extends f.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(Z))==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 f.ObjectMatrix;new f.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 c=new f.ObjectMatrix;new f.ObjectMatrix(u).forValue((l,p,L)=>{c.setValue(l,p,{ref:t.serializeRange(L)})}),this._commandService.executeCommand(s.SetRangeValuesMutation.id,{unitId:n,subUnitId:o,cellValue:c.getMatrix()},{onlyLocal:!0,fromFormula:!0})})}),a&&Object.entries(a).forEach(([n,i])=>{i&&Array.from(Object.entries(i)).forEach(([o,u])=>{const c=new f.ObjectMatrix;new f.ObjectMatrix(u).forValue((l,p)=>{var N,T,I;(I=(T=(N=r==null?void 0:r[n])==null?void 0:N[o])==null?void 0:T[l])!=null&&I[p]||c.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:c.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:f.InterceptorEffectEnum.Value,handler:(r,e,a)=>{var p,L,N;let n=r;const{unitId:i,subUnitId:o,row:u,col:c}=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[c];return l==null?a(n):((!n||n===e.rawData)&&(n={...e.rawData}),l.v==null&&l.t==null?(n.v=0,n.t=f.CellValueType.NUMBER,a(n)):(n==null?void 0:n.t)===f.CellValueType.NUMBER&&n.v!==void 0&&n.v!==null&&f.isRealNum(n.v)?(n.v=t.stripErrorMargin(Number(n.v)),a(n)):(n.v=l.v,n.t=l.t,a(n)))}}))}};mt=Xe([g(0,f.ICommandService),g(1,f.IConfigService),g(2,f.Inject(s.SheetInterceptorService)),g(3,f.Inject(t.FormulaDataModel)),g(4,f.Inject(t.LexerTreeBuilder)),g(5,t.IFunctionService),g(6,t.IDefinedNamesService)],mt);const We=[{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}]}],Ke=[{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}]}],ge=[{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}]}],ke=[{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}]}],Qe=[{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}]}],je=[{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}]}],$e=[{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}]}],ze=[{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}]}],Ze=[{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}]}],Je=[{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.number1.name",detail:"formula.functionList.IMAGE.functionParameter.number1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.IMAGE.functionParameter.number2.name",detail:"formula.functionList.IMAGE.functionParameter.number2.detail",example:"A1:A20",require:1,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}]}],ta=[{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.number1.name",detail:"formula.functionList.AGGREGATE.functionParameter.number1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.AGGREGATE.functionParameter.number2.name",detail:"formula.functionList.AGGREGATE.functionParameter.number2.detail",example:"A1:A20",require:1,repeat:0}]},{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}]}],ea=[{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}]}],aa=[{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}]}],na=[],ia=[{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}]}],ra=[...$e,...Qe,...ta,...ea,...Je,...ke,...aa,...Ze,...ze,...je,...ge,...Ke,...ia,...We,...na];function oa(r,e){let a="";return r.aliasFunctionName?(a=e.t(r.aliasFunctionName),a===r.aliasFunctionName&&(a=r.functionName)):a=r.functionName,a}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},Dt=(r,e)=>(a,n)=>e(a,n,r);const rt=f.createIdentifier("formula.description-service");P.DescriptionService=class{constructor(e,a,n){h(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:c,functionType:m}=o;u.toLocaleUpperCase().indexOf(i)>-1&&m!==t.FunctionType.DefinedName&&a.push({name:u,desc:c})}),a}getSearchListByNameFirstLetter(e){const a=[],n=this._functionService.getDescriptions(),i=e.toLocaleUpperCase().trim();return n.forEach(o=>{const{functionName:u,abstract:c,functionType:m}=o;u.toLocaleUpperCase().indexOf(i)===0&&a.push({name:u,desc:c,functionType:m})}),a}getSearchListByType(e){const a=[];return this._functionService.getDescriptions().forEach(i=>{const{functionName:o,functionType:u,abstract:c}=i;(u===e||e===-1)&&u!==t.FunctionType.DefinedName&&a.push({name:o,desc:c})}),a}registerDescriptions(e){return this._descriptions=this._descriptions.concat(e),this._registerDescriptions(),f.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=ra.filter(o=>e.includes(o.functionName)),n=this._configService.getConfig(Z);this._descriptions=a.concat((i=n==null?void 0:n.description)!=null?i:[])}_registerDescriptions(){const e=this._localeService,a=this._descriptions.map(n=>({functionName:oa(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=ca([Dt(0,t.IFunctionService),Dt(1,f.Inject(f.LocaleService)),Dt(2,f.IConfigService)],P.DescriptionService);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},st=(r,e)=>(a,n)=>e(a,n,r);let lt=class extends f.Disposable{constructor(e,a,n,i){super();h(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(){f.toDisposable(this._definedNamesService.update$.subscribe(()=>{this._registerDescriptions()}))}_changeUnitListener(){f.toDisposable(this._univerInstanceService.getCurrentTypeOfUnit$(f.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:c}=e;!this._descriptionService.hasDescription(i)&&(c==null||c===s.SCOPE_WORKBOOK_VALUE_DEFINED_NAME||c===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(f.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:c,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+(c||""),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:c}=o;c!==s.SCOPE_WORKBOOK_VALUE_DEFINED_NAME&&c!==a&&i.push(u)}),this._descriptionService.unregisterDescriptions(i)}};lt=ma([st(0,rt),st(1,t.IDefinedNamesService),st(2,f.IUniverInstanceService),st(3,f.ICommandService)],lt);var sa=Object.getOwnPropertyDescriptor,la=(r,e,a,n)=>{for(var i=n>1?void 0:n?sa(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);let pt=class extends f.Disposable{constructor(r){super(),this._commandService=r,[Ut,qt,z].forEach(e=>this._commandService.registerCommand(e))}};pt=la([pa(0,f.ICommandService)],pt);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},dt=(r,e)=>(a,n)=>e(a,n,r);let Lt=class extends f.Disposable{constructor(e,a,n,i){super();h(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(){f.toDisposable(this._superTableService.update$.subscribe(()=>{this._registerDescriptions()}))}_changeUnitListener(){f.toDisposable(this._univerInstanceService.getCurrentTypeOfUnit$(f.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,c;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=((c=(u=this._univerInstanceService.getUnit(a))==null?void 0:u.getSheetBySheetId(o.sheetId))==null?void 0:c.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(f.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 c=((p=(l=this._univerInstanceService.getUnit(e))==null?void 0:l.getSheetBySheetId(o.sheetId))==null?void 0:p.getName())||"",m=t.serializeRangeWithSheet(c,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=La([dt(0,rt),dt(1,f.IUniverInstanceService),dt(2,f.ICommandService),dt(3,t.ISuperTableService)],Lt);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},Tt=(r,e)=>(a,n)=>e(a,n,r);function wt(r,e,a,n){const i=r.sequenceNodesBuilder(e);if(i==null)return e;const o=[];for(let u=0,c=i.length;u<c;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===f.AbsoluteRefType.ALL&&T.endAbsoluteRefType===f.AbsoluteRefType.ALL||(T=f.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 f.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(f.UniverInstanceType.UNIVER_SHEET),c=u.getActiveSheet(),m=u.getUnitId(),l=c.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:I,sheetName:C}=N,R=this._univerInstanceService.getUnit(I||e),d=C?R==null?void 0:R.getSheetBySheetName(C):R==null?void 0:R.getSheetBySheetId(a);if(!d)throw new Error("Sheet not found");const S=R.getUnitId(),A=d.getSheetId();if(S!==m||A!==l)return L;const E=s.handleDefaultRangeChangeWithEffectRefCommands(T,i);let O="";if(E){const y=E.startColumn-T.startColumn,q=E.startRow-T.startRow,_=f.moveRangeByOffset(T,y,q);I&&C?O=t.serializeRangeWithSpreadsheet(I,C,_):C?O=t.serializeRangeWithSheet(C,_):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),c=new f.DisposableCollection,m=l=>{const p=this._univerInstanceService.getCurrentUnitForType(f.UniverInstanceType.UNIVER_SHEET),L=p.getActiveSheet(),N=p.getUnitId(),T=L.getSheetId(),I=u==null?void 0:u.map(R=>{if(typeof R=="object"&&R.nodeType===t.sequenceNodeType.REFERENCE){const d=o.get(R.token);if(d.unitId!==N||d.subUnitId!==T)return R;const S=s.handleDefaultRangeChangeWithEffectRefCommands(d.range,l);let A="";if(S){const E=S.startColumn-d.range.startColumn,O=S.startRow-d.range.startRow,y=f.moveRangeByOffset(d.range,E,O);d.unitId&&d.sheetName?A=t.serializeRangeWithSpreadsheet(d.unitId,d.sheetName,y):d.sheetName?A=t.serializeRangeWithSheet(d.sheetName,y):A=t.serializeRange(y)}else A=t.ErrorType.REF;return{...R,token:A}}else return R}),C=I&&t.generateStringWithSequence(I);return i(`=${C}`)};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,I=this._univerInstanceService.getUnit(N||e),C=T?I==null?void 0:I.getSheetBySheetName(T):I==null?void 0:I.getSheetBySheetId(a);if(!C)return;const R=I.getUnitId(),d=C.getSheetId(),S={unitId:R,subUnitId:d,range:L,sheetName:T};o.set(l.token,S),c.add(this._refRangeService.registerRefRange(L,m,R,d))}}),c}_getFormulaDependcy(e,a,n,i){const o=f.isFormulaString(n)?this._lexerTreeBuilder.sequenceNodesBuilder(n):null,u=[];return o==null||o.forEach(c=>{if(typeof c=="object"&&c.nodeType===t.sequenceNodeType.REFERENCE){const m=t.deserializeRangeWithSheetWithCache(c.token),{range:l,unitId:p,sheetName:L}=m;if(l.startAbsoluteRefType===f.AbsoluteRefType.ALL&&l.endAbsoluteRefType===f.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 I=N.getUnitId(),C=T.getSheetId(),R=i[0].startRow,d=i[0].startColumn,S=l.startRow,A=l.startColumn,E=i.map(O=>({startRow:O.startRow-R+S,endRow:O.endRow-R+S,startColumn:O.startColumn-d+A,endColumn:O.endColumn-d+A}));u.push({unitId:I,subUnitId:C,ranges:E})}}),u}registerRangeFormula(e,a,n,i,o){const u=new f.DisposableCollection,c=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},...c.flat()],T=[],I=s.getSeparateEffectedRangesOnCommand(this._injector,l);for(const{unitId:C,subUnitId:R,ranges:d}of N)if(C===I.unitId&&R===I.subUnitId){const S=[],A=d[0].startRow,E=d[0].startColumn,O=A-p,y=E-L;for(const q of I.ranges){const _=d.map(x=>f.getIntersectRange(q,x)).filter(Boolean);_.length>0&&S.push(..._)}S.length>0&&T.push(S.map(q=>({startRow:q.startRow-O,endRow:q.endRow-O,startColumn:q.startColumn-y,endColumn:q.endColumn-y})))}if(T.length>0){const C=f.Rectangle.splitIntoGrid([...T.flat()]),R=f.Rectangle.subtractMulti(n,C);R.sort((O,y)=>O.startRow-y.startRow||O.startColumn-y.startColumn);const d=new Map;for(let O=0;O<C.length;O++){const y=C[O],q=y.startRow,_=y.startColumn,x=q-p,b=_-L,U=s.handleCommonDefaultRangeChangeWithEffectRefCommands(y,l).sort((V,H)=>V.startRow-H.startRow||V.startColumn-H.startColumn);if(!U.length)continue;const F=U[0].startRow,M=U[0].startColumn,B=F-p,k=M-L,Q=[];for(let V=0;V<i.length;V++){const H=i[V],Y=f.isFormulaString(H),It=Y?this._lexerTreeBuilder.moveFormulaRefOffset(H,b,x):H,G=Y?this.transformFormulaByEffectCommand(e,a,It,l):It,xt=wt(this._lexerTreeBuilder,G,-k,-B);Q.push({newFormula:G,orginFormula:xt})}const j={formulas:Q,ranges:U,key:Q.map(V=>V.orginFormula).join("_")};d.has(j.key)?d.get(j.key).push(j):d.set(j.key,[j])}const S=i.map(O=>wt(this._lexerTreeBuilder,O,0,0)).join("_");if(R.length>0){const O=R[0].startRow,y=R[0].startColumn,q=[];for(let x=0;x<i.length;x++){const b=i[x];q.push({newFormula:f.isFormulaString(b)?this._lexerTreeBuilder.moveFormulaRefOffset(b,y-L,O-p):b,orginFormula:b})}const _={formulas:q,ranges:R,key:S};d.has(_.key)?d.get(_.key).push(_):d.set(_.key,[_])}const A=[],E=Array.from(d.keys());for(let O=E.length-1;O>=0;O--){const y=E[O],q=d.get(y).sort((b,U)=>b.ranges[0].startRow-U.ranges[0].startRow||b.ranges[0].startColumn-U.ranges[0].startColumn),_=[];for(let b=0;b<q[0].formulas.length;b++)_.push(q[0].formulas[b].newFormula);const x=f.Rectangle.mergeRanges(q.map(b=>b.ranges).flat());x.sort((b,U)=>b.startRow-U.startRow||b.startColumn-U.startColumn),A.push({formulas:_,ranges:x})}return o(A)}return{undos:[],redos:[]}};return n.forEach(l=>{const p=this._refRangeService.registerRefRange(l,m,e,a);u.add(p)}),[...c.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=Na([Tt(0,f.Inject(s.RefRangeService)),Tt(1,f.Inject(t.LexerTreeBuilder)),Tt(2,f.IUniverInstanceService),Tt(3,f.Inject(f.Injector))],P.FormulaRefRangeService);var Pa=Object.getOwnPropertyDescriptor,Ea=(r,e,a,n)=>{for(var i=n>1?void 0:n?Pa(e,a):e,o=r.length-1,u;o>=0;o--)(u=r[o])&&(i=u(i)||i);return i},Ia=(r,e)=>(a,n)=>e(a,n,r);const bt="sheets-formula.remote-register-function.service",yt=f.createIdentifier(bt);P.RemoteRegisterFunctionService=class{constructor(e){this._functionService=e}async registerFunctions(e){const a=e.map(([n,i])=>Aa(n,i));this._functionService.registerExecutors(...a)}async registerAsyncFunctions(e){const a=e.map(([n,i])=>Sa(n,i));this._functionService.registerExecutors(...a)}async unregisterFunctions(e){this._functionService.unregisterExecutors(...e),this._functionService.unregisterDescriptions(...e),this._functionService.deleteFormulaAstCacheKey(...e)}},P.RemoteRegisterFunctionService=Ea([Ia(0,t.IFunctionService)],P.RemoteRegisterFunctionService);function Aa(r,e){const a=new t.CustomFunction(e),n=new Function(`return ${r}`)();return a.calculateCustom=n,a}function Sa(r,e){const a=new t.AsyncCustomFunction(e),n=new Function(`return ${r}`)();return a.calculateCustom=n,a}var Ca=Object.getOwnPropertyDescriptor,Ra=(r,e,a,n)=>{for(var i=n>1?void 0:n?Ca(e,a):e,o=r.length-1,u;o>=0;o--)(u=r[o])&&(i=u(i)||i);return i},Nt=(r,e)=>(a,n)=>e(a,n,r);const Xt=f.createIdentifier("sheets-formula.register-function-service");P.RegisterFunctionService=class extends f.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 f.DisposableCollection;if(n)o.add(this._descriptionService.registerDescriptions(n));else{const u=i.map(([c,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,c=new f.DisposableCollection;if(o&&this._localeService.load(o),typeof i=="string"){const l={functionName:a,functionType:t.FunctionType.User,description:i,abstract:i||"",functionParameter:[]};c.add(this._descriptionService.registerDescriptions([l]))}else c.add(this._descriptionService.registerDescriptions([i]));const m=u?new t.AsyncCustomFunction(a):new t.CustomFunction(a);return m.calculateCustom=n,this._functionService.registerExecutors(m),c.add(f.toDisposable(()=>this._functionService.unregisterExecutors(a))),c.add(f.toDisposable(()=>this._functionService.unregisterDescriptions(a))),c.add(f.toDisposable(()=>this._functionService.deleteFormulaAstCacheKey(a))),this._remoteRegisterFunctionService&&(this._remoteRegisterFunctionService.registerAsyncFunctions([[n.toString(),a]]),c.add(f.toDisposable(()=>this._remoteRegisterFunctionService.unregisterFunctions([a])))),c}_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),f.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),f.toDisposable(()=>this._remoteRegisterFunctionService.unregisterFunctions(a))}},P.RegisterFunctionService=Ra([Nt(0,f.Inject(f.LocaleService)),Nt(1,f.Inject(rt)),Nt(2,t.IFunctionService),Nt(3,f.Optional(yt))],P.RegisterFunctionService);var Oa=Object.defineProperty,Ma=Object.getOwnPropertyDescriptor,_a=(r,e,a)=>e in r?Oa(r,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):r[e]=a,Wt=(r,e,a,n)=>{for(var i=n>1?void 0:n?Ma(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),Et=(r,e,a)=>_a(r,typeof e!="symbol"?e+"":e,a);P.UniverRemoteSheetsFormulaPlugin=class extends f.Plugin{constructor(e=Ft,a,n){super(),this._config=e,this._injector=a,this._configService=n;const{...i}=f.merge({},Ft,this._config);this._configService.setConfig(Kt,i)}onStarting(){this._injector.add([P.RemoteRegisterFunctionService]),this._injector.get(ut.IRPCChannelService).registerChannel(bt,ut.fromModule(this._injector.get(P.RemoteRegisterFunctionService)))}},Et(P.UniverRemoteSheetsFormulaPlugin,"pluginName","SHEET_FORMULA_REMOTE_PLUGIN"),Et(P.UniverRemoteSheetsFormulaPlugin,"type",f.UniverInstanceType.UNIVER_SHEET),P.UniverRemoteSheetsFormulaPlugin=Wt([f.DependentOn(t.UniverFormulaEnginePlugin),Pt(1,f.Inject(f.Injector)),Pt(2,f.IConfigService)],P.UniverRemoteSheetsFormulaPlugin),P.UniverSheetsFormulaPlugin=class extends f.Plugin{constructor(e=ht,a,n){super(),this._config=e,this._injector=a,this._configService=n;const{...i}=f.merge({},ht,this._config);this._configService.setConfig(Z,i,{merge:!0})}onStarting(){const e=this._injector,a=[[Xt,{useClass:P.RegisterFunctionService}],[rt,{useClass:P.DescriptionService}],[pt],[P.FormulaRefRangeService],[P.RegisterOtherFormulaService],[mt],[P.TriggerCalculationController],[P.UpdateFormulaController],[ft],[lt],[P.UpdateDefinedNameController],[Lt]];if(this._config.notExecuteFormula){const n=e.get(ut.IRPCChannelService);a.push([yt,{useFactory:()=>ut.toModule(n.requestChannel(bt))}])}a.forEach(n=>e.add(n))}onReady(){f.touchDependencies(this._injector,[[pt],[ft],[mt],[P.UpdateFormulaController],[P.UpdateDefinedNameController]]),f.isNodeEnv()&&f.touchDependencies(this._injector,[[P.TriggerCalculationController]])}onRendered(){f.touchDependencies(this._injector,[[lt],[Lt]]),f.isNodeEnv()||f.touchDependencies(this._injector,[[P.TriggerCalculationController]])}},Et(P.UniverSheetsFormulaPlugin,"pluginName",Ge),Et(P.UniverSheetsFormulaPlugin,"type",f.UniverInstanceType.UNIVER_SHEET),P.UniverSheetsFormulaPlugin=Wt([f.DependentOn(t.UniverFormulaEnginePlugin,s.UniverSheetsPlugin),Pt(1,f.Inject(f.Injector)),Pt(2,f.IConfigService)],P.UniverSheetsFormulaPlugin);function Da(r,e,a,n){const i=r.get(t.IFormulaCurrentConfigService),o=r.get(t.Lexer),u=r.get(t.AstTreeBuilder),c=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=c.execute(t.generateExecuteAstNodeData(l));return t.getObjectValue(p)}P.CalculationMode=X,P.IDescriptionService=rt,P.IRegisterFunctionService=Xt,P.IRemoteRegisterFunctionService=yt,P.InsertFunctionCommand=Ut,P.OtherFormulaMarkDirty=z,P.PLUGIN_CONFIG_KEY_BASE=Z,P.QuickSumCommand=qt,P.calculateFormula=Da,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,Y,ut){"use strict";var Ua=Object.defineProperty;var qa=(P,c,s)=>c in P?Ua(P,c,{enumerable:!0,configurable:!0,writable:!0,value:s}):P[c]=s;var h=(P,c,s)=>qa(P,typeof c!="symbol"?c+"":c,s);const qt={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:A,startColumn:C,endRow:R,endColumn:d}=m;for(let S=A;S<=R;S++)for(let E=C;E<=d;E++)(S!==L||E!==N)&&o.setValue(S,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)}},ht={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}},z={type:c.CommandType.MUTATION,id:"sheet.mutation.data-validation-formula-mark-dirty",handler(){return!0}},Z="sheets-formula.base.config";var X=(r=>(r[r.FORCED=0]="FORCED",r[r.WHEN_EMPTY=1]="WHEN_EMPTY",r[r.NO_CALCULATION=2]="NO_CALCULATION",r))(X||{});const Ft={},Kt="sheets-formula.remote.config",Bt={};var kt=Object.getOwnPropertyDescriptor,Qt=(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},St=(r,e)=>(a,n)=>e(a,n,r);P.ImageFormulaCellInterceptorController=class extends c.Disposable{constructor(a,n,i){super();h(this,"_errorValueCell",{v:t.ErrorType.VALUE,t:c.CellValueType.STRING});h(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:100,effect:c.InterceptorEffectEnum.Value,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:A,imageNaturalWidth:C,imageNaturalHeight:R}=p;if(A)return i(this._errorValueCell);const d=T||C,S=N||R,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:S},docTransform:{size:{width:d,height:S},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({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=Qt([St(0,c.ICommandService),St(1,c.Inject(s.SheetInterceptorService)),St(2,c.Inject(t.FormulaDataModel))],P.ImageFormulaCellInterceptorController);var J=(r=>(r[r.NOT_REGISTER=1]="NOT_REGISTER",r[r.SUCCESS=2]="SUCCESS",r[r.WAIT=3]="WAIT",r[r.ERROR=4]="ERROR",r))(J||{}),jt=Object.getOwnPropertyDescriptor,$t=(r,e,a,n)=>{for(var i=n>1?void 0:n?jt(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);P.RegisterOtherFormulaService=class extends c.Disposable{constructor(a,n,i){super();h(this,"_formulaCacheMap",new Map);h(this,"_formulaChangeWithRange$",new Y.Subject);h(this,"formulaChangeWithRange$",this._formulaChangeWithRange$.asObservable());h(this,"_formulaResult$",new Y.Subject);h(this,"formulaResult$",this._formulaResult$.asObservable());h(this,"calculateStarted$",new Y.BehaviorSubject(!1));this._commandService=a,this._activeDirtyManagerService=n,this._lifecycleService=i,this._initFormulaRegister(),this._initFormulaCalculationResultChange()}dispose(){super.dispose(),this._formulaChangeWithRange$.complete(),this._formulaResult$.complete(),this.calculateStarted$.complete()}_ensureCacheMap(a,n){let i=this._formulaCacheMap.get(a);i||(i=new Map,this._formulaCacheMap.set(a,i));let o=i.get(n);return o||(o=new Map,i.set(n,o)),o}_createFormulaId(a,n){return`formula.${a}_${n}_${c.generateRandomId(8)}`}_initFormulaRegister(){this._activeDirtyManagerService.register(z.id,{commandId:z.id,getDirtyData(n){return{dirtyUnitOtherFormulaMap:n.params}}});const a=n=>{const{unitId:i,subUnitId:o,formulaText:u,formulaId:f,ranges:m}=n;if(!this._ensureCacheMap(i,o).has(f))return;const p={unitId:i,subUnitId:o,formulaMap:{[f]:{f:u,ranges:m}}};this._commandService.executeCommand(t.SetOtherFormulaMutation.id,p).then(()=>{this._commandService.executeCommand(z.id,{[i]:{[o]:{[f]:!0}}})})};this.disposeWithMe(this._formulaChangeWithRange$.pipe(Y.bufferWhen(()=>this.calculateStarted$.pipe(Y.filter(n=>n)))).subscribe(n=>n.forEach(a))),this.disposeWithMe(this._formulaChangeWithRange$.pipe(Y.filter(()=>this.calculateStarted$.getValue())).subscribe(a))}_initFormulaCalculationResultChange(){this.disposeWithMe(this._commandService.onCommandExecuted(a=>{if(a.id===t.SetFormulaCalculationResultMutation.id){const n=a.params,{unitOtherData:i}=n,o={};for(const u in i){const f=i[u],m={};o[u]=m;for(const l in f){const p=this._ensureCacheMap(u,l),L=f[l],N=[];m[l]=N;for(const T in L){const A=L[T];if(p.has(T)){const C=p.get(T);if(!C)continue;C.result||(C.result={});const R=new c.ObjectMatrix(A),d=new c.ObjectMatrix(C.result);R.forValue((S,E,I)=>{d.setValue(S,E,I)}),C.status=J.SUCCESS,C.callbacks.forEach(S=>{S(A)}),C.callbacks.clear(),N.push(C)}}}}this._formulaResult$.next(o)}}))}registerFormulaWithRange(a,n,i,o=[{startRow:0,endRow:0,startColumn:0,endColumn:0}],u){const f=this._createFormulaId(a,n);return this._ensureCacheMap(a,n).set(f,{result:void 0,status:J.WAIT,formulaId:f,callbacks:new Set,extra:u}),this._formulaChangeWithRange$.next({unitId:a,subUnitId:n,formulaText:i,formulaId:f,ranges:o}),f}deleteFormula(a,n,i){const o={unitId:a,subUnitId:n,formulaIdList:i};this._commandService.executeCommand(t.RemoveOtherFormulaMutation.id,o);const u=this._ensureCacheMap(a,n);i.forEach(f=>u.delete(f))}getFormulaValue(a,n,i){const o=this._ensureCacheMap(a,n),u=o.get(i);return u?u.status===J.SUCCESS||u.status===J.ERROR?Promise.resolve(u):new Promise(f=>{u.callbacks.add(()=>{f(o.get(i))})}):Promise.resolve(null)}getFormulaValueSync(a,n,i){return this._ensureCacheMap(a,n).get(i)}markFormulaDirty(a,n,i){const o=this.getFormulaValueSync(a,n,i);o&&(o.status=J.WAIT,this._commandService.executeCommand(z.id,{[a]:{[n]:{[i]:!0}}}))}},P.RegisterOtherFormulaService=$t([Ct(0,c.ICommandService),Ct(1,t.IActiveDirtyManagerService),Ct(2,c.Inject(c.LifecycleService))],P.RegisterOtherFormulaService);var zt=Object.getOwnPropertyDescriptor,Zt=(r,e,a,n)=>{for(var i=n>1?void 0:n?zt(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 vt={done:0,count:0},Rt={onlyLocal:!0};P.TriggerCalculationController=class extends c.Disposable{constructor(a,n,i,o,u,f,m){super();h(this,"_waitingCommandQueue",[]);h(this,"_executingDirtyData",{forceCalculation:!1,dirtyRanges:[],dirtyNameMap:{},dirtyDefinedNameMap:{},dirtyUnitFeatureMap:{},dirtyUnitOtherFormulaMap:{},clearDependencyTreeCache:{}});h(this,"_setTimeoutKey",-1);h(this,"_startExecutionTime",0);h(this,"_totalCalculationTaskCount",0);h(this,"_doneCalculationTaskCount",0);h(this,"_executionInProgressParams",null);h(this,"_restartCalculation",!1);h(this,"_forceCalculating",!1);h(this,"_progress$",new Y.BehaviorSubject(vt));h(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(vt),this._progress$.complete(),clearTimeout(this._setTimeoutKey)}_getCalculationMode(){var n;const a=this._configService.getConfig(Z);return(n=a==null?void 0:a.initialFormulaComputing)!=null?n:X.WHEN_EMPTY}_commandExecutedListener(){this.disposeWithMe(this._commandService.beforeCommandExecuted(a=>{if(a.id===t.SetFormulaCalculationStartMutation.id){const n=a.params;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},Rt):(this._restartCalculation=!0,this._commandService.executeCommand(t.SetFormulaCalculationStopMutation.id,{})),this._waitingCommandQueue=[]},100)}}))}_generateDirty(a){const n=[],i={},o={},u={},f={},m={};for(const l of a){const p=this._activeDirtyManagerService.get(l.id);if(p==null)continue;const L=p.getDirtyData(l),{dirtyRanges:N,dirtyNameMap:T,dirtyDefinedNameMap:A,dirtyUnitFeatureMap:C,dirtyUnitOtherFormulaMap:R,clearDependencyTreeCache:d}=L;N!=null&&this._mergeDirtyRanges(n,N),T!=null&&this._mergeDirtyNameMap(i,T),A!=null&&this._mergeDirtyNameMap(o,A),C!=null&&this._mergeDirtyUnitFeatureOrOtherFormulaMap(u,C),R!=null&&this._mergeDirtyUnitFeatureOrOtherFormulaMap(f,R),d!=null&&this._mergeDirtyNameMap(m,d)}return{dirtyRanges:n,dirtyNameMap:i,dirtyDefinedNameMap:o,dirtyUnitFeatureMap:u,dirtyUnitOtherFormulaMap:f,forceCalculation:!1,clearDependencyTreeCache:m,maxIteration:this._configService.getConfig(t.ENGINE_FORMULA_CYCLE_REFERENCE_COUNT)}}_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.maxIteration||n.maxIteration;return{dirtyRanges:i,dirtyNameMap:o,dirtyDefinedNameMap:u,dirtyUnitFeatureMap:f,dirtyUnitOtherFormulaMap:m,forceCalculation:!!this._forceCalculating,clearDependencyTreeCache:l,maxIteration:p}}_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:A}=u.range;if(f===L&&m===N&&l===T&&p===A){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.SetFormulaCalculationStartMutation.id){const{forceCalculation:u=!1}=i.params;u&&(this._forceCalculating=!0)}else i.id===t.SetFormulaCalculationStopMutation.id&&this.clearProgress();if(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,this._forceCalculating=!1),u===t.FormulaExecutedStateType.STOP_EXECUTION&&this._restartCalculation?(this._restartCalculation=!1,this._commandService.executeCommand(t.SetFormulaCalculationStartMutation.id,{...this._executingDirtyData},Rt)):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.SetFormulaCalculationStartMutation.id,n,Rt),this._registerOtherFormulaService.calculateStarted$.next(!0)}_getDirtyDataByCalculationMode(a){const n=a===X.FORCED,i=a===X.WHEN_EMPTY?this._formulaDataModel.getFormulaDirtyRanges():[];return{forceCalculation:n,dirtyRanges:i,dirtyNameMap:{},dirtyDefinedNameMap:{},dirtyUnitFeatureMap:{},dirtyUnitOtherFormulaMap:{},clearDependencyTreeCache:{},maxIteration:this._configService.getConfig(t.ENGINE_FORMULA_CYCLE_REFERENCE_COUNT)}}},P.TriggerCalculationController=Zt([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(P.RegisterOtherFormulaService))],P.TriggerCalculationController);function Jt(r,e,a){var n;return r==null||r[e]==null||((n=r[e])==null?void 0:n[a])==null}function Ot(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 te=[11,12,13,14];function ee(r,e,a){const{type:n}=a;return te.includes(n)?ae(r,e):ne(r,e,a)}function ae(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((R,d,S)=>{if(S==null)return!0;const E=nt(S);E!==null&&(p.setValue(R,d,E),L.setValue(R,d,l.getValue(R,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 A={subUnitId:f,unitId:i,cellValue:L.getMatrix()},C={id:s.SetRangeValuesMutation.id,params:A};a.push(C)})}),{undos:a,redos:n}}function ne(r,e,a){const{redoFormulaData:n,undoFormulaData:i}=ie(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 ie(r,e,a){const n={},i={},{unitId:o,sheetId:u}=a;return new Set([...Object.keys(r),...Object.keys(e)]).forEach(m=>{if(Jt(r,m,u))return;new Set([...Object.keys(r[m]||{}),...Object.keys(e[m]||{})]).forEach(p=>{var S,E;const L=(S=r[m])==null?void 0:S[p],N=(E=e[m])==null?void 0:E[p],T=new c.ObjectMatrix(L||{}),A=new c.ObjectMatrix(N||{});let C=[];m!==o||p!==u?C=oe(A):C=re(T,A,a);const R=Ie(C,T,A),d=Ae(C,T);n[m]||(n[m]={}),i[m]||(i[m]={}),n[m][p]={...n[m][p],...R},i[m][p]={...i[m][p],...d}})}),{redoFormulaData:n,undoFormulaData:i}}function re(r,e,a){const{type:n,from:i,to:o,range:u}=a,f=[];return r.forValue((m,l,p)=>{if(p==null||!Vt(p))return!0;const L=c.cellToRange(m,l);let N=null,T=!1;if([0,1,2].includes(n))N=ue(n,i,o,L);else if(u!=null){const A=ce(L,a);N=A.newCell,T=A.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 oe(r){const e=[];return r.forValue((a,n,i)=>{if(i==null||!Vt(i))return!0;const o=c.cellToRange(a,n);e.push({oldCell:o,newCell:o})}),e}function ue(r,e,a,n){if(e==null||a==null)return null;switch(r){case 0:return fe(e,a,n);case 1:return me(e,a,n);case 2:return se(e,a,n);default:return null}}function ce(r,e){const{type:a,rangeFilteredRows:n}=e,i=e.range;let o=null,u=!1;switch(a){case 3:o=le(i,r),u=!0;break;case 4:o=pe(i,r),u=!0;break;case 5:o=de(i,r,n);break;case 6:o=Le(i,r);break;case 7:o=Te(i,r);break;case 8:o=Ne(i,r);break;case 9:o=Pe(i,r),u=!0;break;case 10:o=Ee(i,r),u=!0;break}return{newCell:o,isReverse:u}}function fe(r,e,a){const n=s.handleMoveRange({id:s.EffectRefRangId.MoveRangeCommandId,params:{toRange:e,fromRange:r}},a);return s.runRefRangeMutations(n,a)}function me(r,e,a){const n=s.handleMoveRows({id:s.EffectRefRangId.MoveRowsCommandId,params:{toRange:e,fromRange:r}},a);return s.runRefRangeMutations(n,a)}function se(r,e,a){const n=s.handleMoveCols({id:s.EffectRefRangId.MoveColsCommandId,params:{toRange:e,fromRange:r}},a);return s.runRefRangeMutations(n,a)}function le(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 pe(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 de(r,e,a){const n=s.handleIRemoveRow({id:s.EffectRefRangId.RemoveRowCommandId,params:{range:r}},e,a);return s.runRefRangeMutations(n,e)}function Le(r,e){const a=s.handleIRemoveCol({id:s.EffectRefRangId.RemoveColCommandId,params:{range:r}},e);return s.runRefRangeMutations(a,e)}function Te(r,e){const a=s.handleDeleteRangeMoveLeft({id:s.EffectRefRangId.DeleteRangeMoveLeftCommandId,params:{range:r}},e);return s.runRefRangeMutations(a,e)}function Ne(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 Ee(r,e){const a=s.handleInsertRangeMoveRight({id:s.EffectRefRangId.InsertRangeMoveRightCommandId,params:{range:r}},e);return s.runRefRangeMutations(a,e)}function Ie(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=nt(p);n.setValue(l.startRow,l.startColumn,L)}}return n.getMatrix()}function Ae(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=nt(u);if(a.setValue(i.startRow,i.startColumn,f),o){const m=e.getValue(o.startRow,o.startColumn),l=nt(m);a.setValue(o.startRow,o.startColumn,l!=null?l:{f:null,si:null})}}return a.getMatrix()}function nt(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 Se(r){const e=new c.ObjectMatrix({});return new c.ObjectMatrix(r).forValue((n,i,o)=>{const u=nt(o);u!==void 0&&e.setValue(n,i,u)}),e.getMatrix()}function Vt(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 Gt(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 Ht(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 wt(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:A,refOffsetX:C,refOffsetY:R}=r;if(!Gt(o,u,a,n,T,N))return;const d=c.Rectangle.moveOffset(L,C,R);let S=null;if(i===b.MoveRange){if(m==null||l==null)return;const E=Mt(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;S=_t(E,D,m,l,d,I)}else if(i===b.MoveRows){if(m==null||l==null)return;const E=Mt(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;S=_t(E,D,m,l,d,I)}else if(i===b.MoveCols){if(m==null||l==null)return;const E=Mt(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;S=_t(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;S={...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;S={...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;S={...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;S={...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;S={...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;S={...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;S={...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;S={...d,...I}}}if(S!=null)return t.serializeRangeToRefString({range:S,sheetName:A,unitId:T})}function _t(r,e,a,n,i,o){const{startRow:u,endRow:f,startColumn:m,endColumn:l,rangeType:p}=it(e),{startRow:L,startColumn:N,endRow:T,endColumn:A,rangeType:C=c.RANGE_TYPE.NORMAL}=it(a),{startRow:R,startColumn:d,endRow:S,endColumn:E}=it(n),{startRow:I,endRow:O,startColumn:D,endColumn:U}=it(o),{startRow:M,endRow:x,startColumn:y,endColumn:q,rangeType:F=c.RANGE_TYPE.NORMAL}=it(i),_={...i};function B(){return p===c.RANGE_TYPE.COLUMN&&F===c.RANGE_TYPE.COLUMN?!0:m>=y&&l<=q}function k(){return p===c.RANGE_TYPE.ROW&&F===c.RANGE_TYPE.ROW?!0:u>=M&&f<=x}if(r===0)if(B())if(u<M)_.startRow=u;else if(u>=x)_.endRow-=T+1-M;else return;else return;else if(r===1)if(B())if(f>x)_.endRow=f;else if(f<=M)_.startRow+=x-L+1;else return;else return;else if(r===2)if(k())if(m<y)_.startColumn=m;else if(m>=q)_.endColumn-=A+1-y;else return;else return;else if(r===3)if(k())if(l>q)_.endColumn=l;else if(l<=y)_.startColumn+=q-N+1;else return;else return;else r===4?(_.startRow=u,_.startColumn=m,_.endRow=f,_.endColumn=l):N<=y&&A>=q||C===c.RANGE_TYPE.ROW&&F===c.RANGE_TYPE.ROW?a.endRow<M?(R>=M&&(_.startRow-=T-L+1),R>=x&&(_.endRow-=T-L+1)):a.startRow>x?(S<=x&&(_.endRow+=T-L+1),S<=M&&(_.startRow+=T-L+1)):a.startRow>=M&&a.endRow<=x&&(R<=M?_.startRow+=T-L+1:R>=x&&(_.endRow-=T-L+1)):L<=M&&T>=x||C===c.RANGE_TYPE.COLUMN&&F===c.RANGE_TYPE.COLUMN?a.endColumn<y?(d>=y&&(_.startColumn-=A-N+1),d>=q&&(_.endColumn-=A-N+1)):a.startColumn>q?(E<=q&&(_.endColumn+=A-N+1),E<=y&&(_.startColumn+=A-N+1)):a.startColumn>=y&&a.endColumn<=q&&(d<=y?_.startColumn+=A-N+1:d>=q&&(_.endColumn-=A-N+1)):((d<=U+1&&E>=q||d<=y&&E>=D-1)&&R<=M&&S>=x||(R<=O+1&&S>=x||R<=M&&S>=I-1)&&d<=y&&E>=q,_.startRow=u,_.startColumn=m,_.endRow=f,_.endColumn=l);return _}function Mt(r,e){const a=tt(r.startRow),n=et(r.endRow),i=tt(r.startColumn),o=et(r.endColumn),u=tt(e.startRow),f=et(e.endRow),m=tt(e.startColumn),l=et(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 tt(r){return isNaN(r)?-1/0:r}function et(r){return isNaN(r)?1/0:r}function it(r){const{startRow:e,endRow:a,startColumn:n,endColumn:i}=r;return{...r,startRow:tt(e),endRow:et(a),startColumn:tt(n),endColumn:et(i)}}function Yt(r,e){const{id:a}=e;let n=null;switch(a){case s.MoveRangeCommand.id:n=Ce(e,r);break;case s.MoveRowsCommand.id:n=Re(e,r);break;case s.MoveColsCommand.id:n=Oe(e,r);break;case s.InsertRowCommand.id:n=_e(e);break;case s.InsertColCommand.id:n=Me(e);break;case s.InsertRangeMoveRightCommand.id:n=De(e,r);break;case s.InsertRangeMoveDownCommand.id:n=be(e,r);break;case s.RemoveRowCommand.id:n=ye(e,r);break;case s.RemoveColCommand.id:n=xe(e,r);break;case s.DeleteRangeMoveUpCommand.id:n=Ue(e,r);break;case s.DeleteRangeMoveLeftCommand.id:n=qe(e,r);break;case s.SetWorksheetNameCommand.id:n=he(e,r);break;case s.RemoveSheetCommand.id:n=Fe(e,r);break;case s.SetDefinedNameCommand.id:n=Be(e,r);break;case s.RemoveDefinedNameCommand.id:n=ve(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 Ce(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 Re(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 Oe(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 _e(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 Me(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 De(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 be(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 ye(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 xe(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 Ue(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 qe(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 he(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 Fe(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 Be(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 ve(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 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},ct=(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=Yt(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 S=0,E=L.length;S<E;S++){const I=L[S];if(typeof I=="string"||I.nodeType!==t.sequenceNodeType.REFERENCE)continue;const{token:O}=I,D=t.deserializeRangeWithSheetWithCache(O),{range:U,sheetName:M,unitId:x}=D,y=((d=e.getSheetBySheetName(M))==null?void 0:d.getSheetId())||"",q={range:U,sheetId:y,unitId:x,sheetName:M,refOffsetX:0,refOffsetY:0};let F=null;if(n===b.RemoveSheet)F=this._removeSheet(l,i,o);else if(n===b.SetName){const{sheetId:_,sheetName:B}=a;if(B==null||y==null||y.length===0||_!==y)continue;F=t.serializeRangeToRefString({range:U,sheetName:B,unitId:x})}else F=wt(q,a,i,o);F!=null&&(L[S]={...I,token:F},N=!0,T.push(S))}if(!N)return!0;const A=t.generateStringWithSequence(Ht(L,T)),C={id:t.SetDefinedNameMutation.id,params:{unitId:i,...l,formulaOrRefString:A}};f.push(C);const R={id:t.SetDefinedNameMutation.id,params:{unitId:i,...l}};m.push(R)}),{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=Ge([ct(0,t.IDefinedNamesService),ct(1,c.IUniverInstanceService),ct(2,c.Inject(s.SheetInterceptorService)),ct(3,c.Inject(t.LexerTreeBuilder))],P.UpdateDefinedNameController);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);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||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(Y.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:Se(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=Ot(n,e,a),o=this._formulaDataModel.getArrayFormulaRange(),u=Ot(o,e,a),f=this._formulaDataModel.getArrayFormulaCellData(),m=Ot(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 A;const L=p.getCellMatrix(),N=p.getSheetId(),T=t.initSheetFormulaData(a,n,N,L);i[n][N]=(A=T[n])==null?void 0:A[N]}),this._commandService.executeCommand(t.SetFormulaDataMutation.id,{formulaData:i},{onlyLocal:!0});const u=this._configService.getConfig(Z),f=(l=u==null?void 0:u.initialFormulaComputing)!=null?l:X.WHEN_EMPTY,m=this._getDirtyDataByCalculationMode(f);this._commandService.executeCommand(t.SetFormulaCalculationStartMutation.id,m,{onlyLocal:!0})}_getDirtyDataByCalculationMode(e){const a=e===X.FORCED,n=e===X.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=Yt(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}=ee(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((A,C,R)=>{var q;if(!R)return!0;const{f:d,x:S,y:E,si:I}=R,O=this._lexerTreeBuilder.sequenceNodesBuilder(d);if(O==null)return!0;let D=!1;const U=[],{type:M,from:x}=n;for(let F=0,_=O.length;F<_;F++){const B=O[F];if(typeof B=="string")continue;const{token:k,nodeType:Q}=B;if((M===b.SetDefinedName||M===b.RemoveDefinedName)&&(Q===t.sequenceNodeType.DEFINED_NAME||Q===t.sequenceNodeType.FUNCTION)){const{definedNameId:At,definedName:at}=n;if(At===void 0||at===void 0)continue;const $=this._definedNamesService.getValueById(f,At);if($==null||$.name!==k)continue;O[F]={...B,token:M===b.SetDefinedName?at:t.ErrorType.REF},D=!0,U.push(F);continue}else if(Q!==t.sequenceNodeType.REFERENCE)continue;const j=t.deserializeRangeWithSheetWithCache(k),{range:V,sheetName:H,unitId:w}=j,It=w==null||w.length===0?f:w,G=((q=a==null?void 0:a[It])==null?void 0:q[H])||"";if(!Gt(n.unitId,n.sheetId,f,p,w,G))continue;const Ut={range:V,sheetId:G,unitId:w,sheetName:H,refOffsetX:S||0,refOffsetY:E||0};let ot=null;if(M===b.SetName){const{unitId:At,sheetId:at,sheetName:$}=n;if($==null||G==null||G.length===0||at!==G)continue;ot=t.serializeRangeToRefString({range:V,sheetName:$,unitId:w})}else if(M===b.RemoveSheet){const{unitId:At,sheetId:at,sheetName:$}=n;if(G==null||G.length===0||at!==G)continue;ot=t.ErrorType.REF}else M!==b.SetDefinedName&&(ot=wt(Ut,n,f,p));ot!=null&&(O[F]={...B,token:ot},D=!0,U.push(F),I&&(S!=null?S:0)===0&&(E!=null?E:0)===0&&T.push(I))}if(!D)if(I&&[b.MoveRows,b.MoveCols,b.MoveRange].includes(M)){if(x&&x.startRow<=A&&A<=x.endRow&&x.startColumn<=C&&C<=x.endColumn)(S!=null?S:0)===0&&(E!=null?E:0)===0&&T.push(I);else if(!T.includes(I))return!0}else return!0;const y=Ht(O,U,S,E);N.setValue(A,C,{f:`=${t.generateStringWithSequence(y)}`})}),u[f]&&(u[f][p]=N.getData())}}return{newFormulaData:u}}},P.UpdateFormulaController=we([g(0,c.IUniverInstanceService),g(1,c.ICommandService),g(2,c.Inject(t.LexerTreeBuilder)),g(3,c.Inject(t.FormulaDataModel)),g(4,c.Inject(s.SheetInterceptorService)),g(5,t.IDefinedNamesService),g(6,c.IConfigService),g(7,c.Inject(c.Injector))],P.UpdateFormulaController);const Ye="SHEETS_FORMULA_PLUGIN";var Xe=Object.getOwnPropertyDescriptor,ge=(r,e,a,n)=>{for(var i=n>1?void 0:n?Xe(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);let ft=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(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:A}=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:A});const C=p.getData();return o.push(...this._getDirtyRangesByCellValue(n,a,C)),o.push(...this._getDirtyRangesForArrayFormula(n,a,C)),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:A,startColumn:C,endRow:R,endColumn:d}=T;l>=A&&l<=R&&p>=C&&p<=d&&n.push({unitId:r,sheetId:e,range:{startRow:A,startColumn:C,endRow:A,endColumn:C}})})})}return n}};ft=ge([Dt(0,t.IActiveDirtyManagerService),Dt(1,c.IUniverInstanceService),Dt(2,c.Inject(t.FormulaDataModel))],ft);var We=Object.getOwnPropertyDescriptor,Ke=(r,e,a,n)=>{for(var i=n>1?void 0:n?We(e,a):e,o=r.length-1,u;o>=0;o--)(u=r[o])&&(i=u(i)||i);return i},K=(r,e)=>(a,n)=>e(a,n,r);let mt=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(Z))==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,A;(A=(T=(N=r==null?void 0:r[n])==null?void 0:N[o])==null?void 0:T[l])!=null&&A[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)))}}))}};mt=Ke([K(0,c.ICommandService),K(1,c.IConfigService),K(2,c.Inject(s.SheetInterceptorService)),K(3,c.Inject(t.FormulaDataModel)),K(4,c.Inject(t.LexerTreeBuilder)),K(5,t.IFunctionService),K(6,t.IDefinedNamesService)],mt);const ke=[{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}]}],Qe=[{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}]}],je=[{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}]}],$e=[{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}]}],ze=[{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}]}],Ze=[{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}]}],Je=[{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}]}],ta=[{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}]}],ea=[{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}]}],aa=[{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}]}],na=[{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}]}],ia=[{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}]}],ra=[{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}]}],oa=[],ua=[{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}]}],ca=[...Je,...ze,...na,...ia,...aa,...$e,...ra,...ea,...ta,...Ze,...je,...Qe,...ua,...ke,...oa];function fa(r,e){let a="";return r.aliasFunctionName?(a=e.t(r.aliasFunctionName),a===r.aliasFunctionName&&(a=r.functionName)):a=r.functionName,a}var ma=Object.getOwnPropertyDescriptor,sa=(r,e,a,n)=>{for(var i=n>1?void 0:n?ma(e,a):e,o=r.length-1,u;o>=0;o--)(u=r[o])&&(i=u(i)||i);return i},bt=(r,e)=>(a,n)=>e(a,n,r);const rt=c.createIdentifier("formula.description-service");P.DescriptionService=class{constructor(e,a,n){h(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=ca.filter(o=>e.includes(o.functionName)),n=this._configService.getConfig(Z);this._descriptions=a.concat((i=n==null?void 0:n.description)!=null?i:[])}_registerDescriptions(){const e=this._localeService,a=this._descriptions.map(n=>({functionName:fa(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=sa([bt(0,t.IFunctionService),bt(1,c.Inject(c.LocaleService)),bt(2,c.IConfigService)],P.DescriptionService);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();h(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)}};lt=pa([st(0,rt),st(1,t.IDefinedNamesService),st(2,c.IUniverInstanceService),st(3,c.ICommandService)],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},Ta=(r,e)=>(a,n)=>e(a,n,r);let pt=class extends c.Disposable{constructor(r){super(),this._commandService=r,[qt,ht,z].forEach(e=>this._commandService.registerCommand(e))}};pt=La([Ta(0,c.ICommandService)],pt);var Na=Object.getOwnPropertyDescriptor,Pa=(r,e,a,n)=>{for(var i=n>1?void 0:n?Na(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);let Lt=class extends c.Disposable{constructor(e,a,n,i){super();h(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([dt(0,rt),dt(1,c.IUniverInstanceService),dt(2,c.ICommandService),dt(3,t.ISuperTableService)],Lt);var Ea=Object.getOwnPropertyDescriptor,Ia=(r,e,a,n)=>{for(var i=n>1?void 0:n?Ea(e,a):e,o=r.length-1,u;o>=0;o--)(u=r[o])&&(i=u(i)||i);return i},Tt=(r,e)=>(a,n)=>e(a,n,r);function Xt(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:A,sheetName:C}=N,R=this._univerInstanceService.getUnit(A||e),d=C?R==null?void 0:R.getSheetBySheetName(C):R==null?void 0:R.getSheetBySheetId(a);if(!d)throw new Error("Sheet not found");const S=R.getUnitId(),E=d.getSheetId();if(S!==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,M=c.moveRangeByOffset(T,D,U);A&&C?O=t.serializeRangeWithSpreadsheet(A,C,M):C?O=t.serializeRangeWithSheet(C,M):O=t.serializeRange(M)}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(),A=u==null?void 0:u.map(R=>{if(typeof R=="object"&&R.nodeType===t.sequenceNodeType.REFERENCE){const d=o.get(R.token);if(d.unitId!==N||d.subUnitId!==T)return R;const S=s.handleDefaultRangeChangeWithEffectRefCommands(d.range,l);let E="";if(S){const I=S.startColumn-d.range.startColumn,O=S.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{...R,token:E}}else return R}),C=A&&t.generateStringWithSequence(A);return i(`=${C}`)};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,A=this._univerInstanceService.getUnit(N||e),C=T?A==null?void 0:A.getSheetBySheetName(T):A==null?void 0:A.getSheetBySheetId(a);if(!C)return;const R=A.getUnitId(),d=C.getSheetId(),S={unitId:R,subUnitId:d,range:L,sheetName:T};o.set(l.token,S),f.add(this._refRangeService.registerRefRange(L,m,R,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 A=N.getUnitId(),C=T.getSheetId(),R=i[0].startRow,d=i[0].startColumn,S=l.startRow,E=l.startColumn,I=i.map(O=>({startRow:O.startRow-R+S,endRow:O.endRow-R+S,startColumn:O.startColumn-d+E,endColumn:O.endColumn-d+E}));u.push({unitId:A,subUnitId:C,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=[],A=s.getSeparateEffectedRangesOnCommand(this._injector,l);for(const{unitId:C,subUnitId:R,ranges:d}of N)if(C===A.unitId&&R===A.subUnitId){const S=[],E=d[0].startRow,I=d[0].startColumn,O=E-p,D=I-L;for(const U of A.ranges){const M=d.map(x=>c.getIntersectRange(U,x)).filter(Boolean);M.length>0&&S.push(...M)}S.length>0&&T.push(S.map(U=>({startRow:U.startRow-O,endRow:U.endRow-O,startColumn:U.startColumn-D,endColumn:U.endColumn-D})))}if(T.length>0){const C=c.Rectangle.splitIntoGrid([...T.flat()]),R=c.Rectangle.subtractMulti(n,C);R.sort((O,D)=>O.startRow-D.startRow||O.startColumn-D.startColumn);const d=new Map;for(let O=0;O<C.length;O++){const D=C[O],U=D.startRow,M=D.startColumn,x=U-p,y=M-L,q=s.handleCommonDefaultRangeChangeWithEffectRefCommands(D,l).sort((V,H)=>V.startRow-H.startRow||V.startColumn-H.startColumn);if(!q.length)continue;const F=q[0].startRow,_=q[0].startColumn,B=F-p,k=_-L,Q=[];for(let V=0;V<i.length;V++){const H=i[V],w=c.isFormulaString(H),It=w?this._lexerTreeBuilder.moveFormulaRefOffset(H,y,x):H,G=w?this.transformFormulaByEffectCommand(e,a,It,l):It,Ut=Xt(this._lexerTreeBuilder,G,-k,-B);Q.push({newFormula:G,orginFormula:Ut})}const j={formulas:Q,ranges:q,key:Q.map(V=>V.orginFormula).join("_")};d.has(j.key)?d.get(j.key).push(j):d.set(j.key,[j])}const S=i.map(O=>Xt(this._lexerTreeBuilder,O,0,0)).join("_");if(R.length>0){const O=R[0].startRow,D=R[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 M={formulas:U,ranges:R,key:S};d.has(M.key)?d.get(M.key).push(M):d.set(M.key,[M])}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),M=[];for(let y=0;y<U[0].formulas.length;y++)M.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:M,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=Ia([Tt(0,c.Inject(s.RefRangeService)),Tt(1,c.Inject(t.LexerTreeBuilder)),Tt(2,c.IUniverInstanceService),Tt(3,c.Inject(c.Injector))],P.FormulaRefRangeService);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},Ca=(r,e)=>(a,n)=>e(a,n,r);const yt="sheets-formula.remote-register-function.service",xt=c.createIdentifier(yt);P.RemoteRegisterFunctionService=class{constructor(e){this._functionService=e}async registerFunctions(e){const a=e.map(([n,i])=>Ra(n,i));this._functionService.registerExecutors(...a)}async registerAsyncFunctions(e){const a=e.map(([n,i])=>Oa(n,i));this._functionService.registerExecutors(...a)}async unregisterFunctions(e){this._functionService.unregisterExecutors(...e),this._functionService.unregisterDescriptions(...e),this._functionService.deleteFormulaAstCacheKey(...e)}},P.RemoteRegisterFunctionService=Sa([Ca(0,t.IFunctionService)],P.RemoteRegisterFunctionService);function Ra(r,e){const a=new t.CustomFunction(e),n=new Function(`return ${r}`)();return a.calculateCustom=n,a}function Oa(r,e){const a=new t.AsyncCustomFunction(e),n=new Function(`return ${r}`)();return a.calculateCustom=n,a}var _a=Object.getOwnPropertyDescriptor,Ma=(r,e,a,n)=>{for(var i=n>1?void 0:n?_a(e,a):e,o=r.length-1,u;o>=0;o--)(u=r[o])&&(i=u(i)||i);return i},Nt=(r,e)=>(a,n)=>e(a,n,r);const gt=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=Ma([Nt(0,c.Inject(c.LocaleService)),Nt(1,c.Inject(rt)),Nt(2,t.IFunctionService),Nt(3,c.Optional(xt))],P.RegisterFunctionService);var Da=Object.defineProperty,ba=Object.getOwnPropertyDescriptor,ya=(r,e,a)=>e in r?Da(r,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):r[e]=a,Wt=(r,e,a,n)=>{for(var i=n>1?void 0:n?ba(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),Et=(r,e,a)=>ya(r,typeof e!="symbol"?e+"":e,a);P.UniverRemoteSheetsFormulaPlugin=class extends c.Plugin{constructor(e=Bt,a,n){super(),this._config=e,this._injector=a,this._configService=n;const{...i}=c.merge({},Bt,this._config);this._configService.setConfig(Kt,i)}onStarting(){this._injector.add([P.RemoteRegisterFunctionService]),this._injector.get(ut.IRPCChannelService).registerChannel(yt,ut.fromModule(this._injector.get(P.RemoteRegisterFunctionService)))}},Et(P.UniverRemoteSheetsFormulaPlugin,"pluginName","SHEET_FORMULA_REMOTE_PLUGIN"),Et(P.UniverRemoteSheetsFormulaPlugin,"type",c.UniverInstanceType.UNIVER_SHEET),P.UniverRemoteSheetsFormulaPlugin=Wt([c.DependentOn(t.UniverFormulaEnginePlugin),Pt(1,c.Inject(c.Injector)),Pt(2,c.IConfigService)],P.UniverRemoteSheetsFormulaPlugin),P.UniverSheetsFormulaPlugin=class extends c.Plugin{constructor(e=Ft,a,n){super(),this._config=e,this._injector=a,this._configService=n;const{...i}=c.merge({},Ft,this._config);this._configService.setConfig(Z,i,{merge:!0})}onStarting(){const e=this._injector,a=[[gt,{useClass:P.RegisterFunctionService}],[rt,{useClass:P.DescriptionService}],[pt],[P.FormulaRefRangeService],[P.RegisterOtherFormulaService],[mt],[P.ImageFormulaCellInterceptorController],[P.TriggerCalculationController],[P.UpdateFormulaController],[ft],[lt],[P.UpdateDefinedNameController],[Lt]];if(this._config.notExecuteFormula){const n=e.get(ut.IRPCChannelService);a.push([xt,{useFactory:()=>ut.toModule(n.requestChannel(yt))}])}a.forEach(n=>e.add(n))}onReady(){c.touchDependencies(this._injector,[[pt],[ft],[mt],[P.ImageFormulaCellInterceptorController],[P.UpdateFormulaController],[P.UpdateDefinedNameController]]),c.isNodeEnv()&&c.touchDependencies(this._injector,[[P.TriggerCalculationController]])}onRendered(){c.touchDependencies(this._injector,[[lt],[Lt]]),c.isNodeEnv()||c.touchDependencies(this._injector,[[P.TriggerCalculationController]])}},Et(P.UniverSheetsFormulaPlugin,"pluginName",Ye),Et(P.UniverSheetsFormulaPlugin,"type",c.UniverInstanceType.UNIVER_SHEET),P.UniverSheetsFormulaPlugin=Wt([c.DependentOn(t.UniverFormulaEnginePlugin,s.UniverSheetsPlugin),Pt(1,c.Inject(c.Injector)),Pt(2,c.IConfigService)],P.UniverSheetsFormulaPlugin);function xa(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=X,P.IDescriptionService=rt,P.IRegisterFunctionService=gt,P.IRemoteRegisterFunctionService=xt,P.InsertFunctionCommand=qt,P.OtherFormulaMarkDirty=z,P.PLUGIN_CONFIG_KEY_BASE=Z,P.QuickSumCommand=ht,P.calculateFormula=xa,Object.defineProperty(P,Symbol.toStringTag,{value:"Module"})}));
49
49
 
50
50
 
51
51
  // @univerjs/sheets-formula/facade