@univerjs/preset-sheets-node-core 0.8.1-nightly.202506191607 → 0.8.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 +16 -16
package/lib/umd/index.js CHANGED
@@ -7,17 +7,17 @@
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("@univerjs/engine-formula"),require("@univerjs/rpc"),require("rxjs"),require("@univerjs/engine-numfmt"),require("rxjs/operators")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/engine-formula","@univerjs/rpc","rxjs","@univerjs/engine-numfmt","rxjs/operators"],i):(g=typeof globalThis<"u"?globalThis:g||self,i(g.UniverSheets={},g.UniverCore,g.UniverEngineFormula,g.UniverRpc,g.rxjs,g.UniverEngineNumfmt,g.rxjs.operators))})(this,function(g,i,Y,Oi,V,Nn,bt){"use strict";var yd=Object.defineProperty;var _d=(g,i,Y)=>i in g?yd(g,i,{enumerable:!0,configurable:!0,writable:!0,value:Y}):g[i]=Y;var f=(g,i,Y)=>_d(g,typeof i!="symbol"?i+"":i,Y);var Qs=(s=>(s.OthersCanView="othersCanView",s.NoOneElseCanView="noOneElseCanView",s))(Qs||{}),xs=(s=>(s.DesignedUserCanEdit="designedUserCanEdit",s.OnlyMe="onlyMe",s))(xs||{});class X{constructor(){f(this,"_model",new Map);f(this,"_ruleChange$",new V.Subject);f(this,"ruleChange$",this._ruleChange$.asObservable());f(this,"_ruleRefresh$",new V.Subject);f(this,"ruleRefresh$",this._ruleRefresh$.asObservable());f(this,"_rangeRuleInitStateChange",new V.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.Tools.generateRandomId(4);const o=this._ensureRuleMap(e,t);for(;o.has(n);)n=i.Tools.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 Ni=(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}}},Me={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}},Di=s=>{const e={...s,ruleIds:s.rules.map(t=>t.id)};return{id:Me.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}},eo={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 C=[{id:ce.id,params:{unitId:u,subUnitId:l,rules:R}}],v=[{id:Me.id,params:{unitId:u,subUnitId:l,ruleIds:R.map(I=>I.id)}}];n.pushUndoRedo({unitID:u,redoMutations:C,undoMutations:v})}return!0}};class ye{constructor(){f(this,"_model",new Map);f(this,"_ruleChange",new V.Subject);f(this,"_ruleRefresh",new V.Subject);f(this,"_resetOrder",new V.Subject);f(this,"ruleChange$",this._ruleChange.asObservable());f(this,"ruleRefresh$",this._ruleRefresh.asObservable());f(this,"resetOrder$",this._resetOrder.asObservable());f(this,"_worksheetRuleInitStateChange",new V.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 Le={id:"sheet.mutation.add-worksheet-protection",type:i.CommandType.MUTATION,handler:(s,e)=>{const{unitId:t,rule:n}=e;return s.get(ye).addRule(t,n),!0}},ze={id:"sheet.mutation.delete-worksheet-protection",type:i.CommandType.MUTATION,handler:(s,e)=>{const{unitId:t,subUnitId:n}=e;return s.get(ye).deleteRule(t,n),!0}},to={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(Le.id,{unitId:r,rule:o,subUnitId:o.subUnitId})){const l=[{id:Le.id,params:{unitId:r,rule:o,subUnitId:o.subUnitId}}],d=[{id:ze.id,params:{unitId:r,subUnitId:a}}];n.pushUndoRedo({unitID:r,redoMutations:l,undoMutations:d})}return!0}},Ai=i.createInterceptorKey("CELL_CONTENT"),Wi=i.createInterceptorKey("ROW_FILTERED"),ke={CELL_CONTENT:Ai,ROW_FILTERED:Wi};var no=(s=>(s[s.DATA_VALIDATION=9]="DATA_VALIDATION",s[s.NUMFMT=10]="NUMFMT",s[s.CELL_IMAGE=11]="CELL_IMAGE",s))(no||{});const so="sheet.interceptor.range-theme-id",oo="sheet.interceptor.ignore-range-theme";var Vi=Object.getOwnPropertyDescriptor,Li=(s,e,t,n)=>{for(var o=n>1?void 0:n?Vi(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 Dn=i.createInterceptorKey("BEFORE_CELL_EDIT"),Jt=i.createInterceptorKey("AFTER_CELL_EDIT"),Xt=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:Dn,AFTER_CELL_EDIT:Jt,VALIDATE_CELL:Xt}));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(ke.CELL_CONTENT,{priority:-1,effect:i.InterceptorEffectEnum.Style|i.InterceptorEffectEnum.Value,handler:n=>n}),this.disposeWithMe(this.writeCellInterceptor.intercept(Jt,{priority:-1,handler:n=>n})),this.disposeWithMe(this.writeCellInterceptor.intercept(Dn,{priority:-1,handler:n=>n})),this.disposeWithMe(this.writeCellInterceptor.intercept(Xt,{priority:-1,handler:n=>n}))}dispose(){super.dispose(),this._workbookDisposables.forEach(t=>t.dispose()),this._workbookDisposables.clear(),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(Jt)(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(Xt)(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===ke.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(ro(o,u),c),c.add(d.registerCellContentInterceptor({getCell(m,h,R,S,C){const v=u.getCellRaw(m,h);return r.fetchThroughInterceptors(ke.CELL_CONTENT,R,S,C)(v,{unitId:o,subUnitId:l,row:m,col:h,worksheet:u,workbook:t,rawData:v})}})),c.add(d.registerRowFilteredInterceptor({getRowFiltered(m){return!!r.fetchThroughInterceptors(ke.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=ro(t,n),r=this._worksheetDisposables.get(o);r&&(r.dispose(),this._worksheetDisposables.delete(o))}},g.SheetInterceptorService=Li([$i(0,i.IUniverInstanceService)],g.SheetInterceptorService);function ro(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 Hi(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 Q={wholeStyle:1,headerRowStyle:2,headerColumnStyle:4,firstRowStyle:8,secondRowStyle:16,lastRowStyle:32,firstColumnStyle:128,secondColumnStyle:256,lastColumnStyle:512};class Oe{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){let r=0;return n&&(r=r|Q.lastRowStyle),o&&(r=r|Q.lastColumnStyle),e>=0&&t>=0&&(r=r|Q.wholeStyle),e%2===1&&(r=r|Q.firstRowStyle),e%2===0&&(r=r|Q.secondRowStyle),e===0&&(r=r|Q.headerRowStyle),t===0&&(r=r|Q.headerColumnStyle),t%2===1&&(r=r|Q.firstColumnStyle),t%2===0&&(r=r|Q.secondColumnStyle),r===0?null:this._getMergeStyle(r)}_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&Q.wholeStyle&&t.push(this.wholeStyle),this.firstColumnStyle&&e&Q.firstColumnStyle&&t.push(this.firstColumnStyle),this.secondColumnStyle&&e&Q.secondColumnStyle&&t.push(this.secondColumnStyle),this.firstRowStyle&&e&Q.firstRowStyle&&t.push(this.firstRowStyle),this.secondRowStyle&&e&Q.secondRowStyle&&t.push(this.secondRowStyle),this.headerColumnStyle&&e&Q.headerColumnStyle&&t.push(this.headerColumnStyle),this.lastColumnStyle&&e&Q.lastColumnStyle&&t.push(this.lastColumnStyle),this.headerRowStyle&&e&Q.headerRowStyle&&t.push(this.headerRowStyle),this.lastRowStyle&&e&Q.lastRowStyle&&t.push(this.lastRowStyle),Hi(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 Bi=(s,e,t)=>new Oe(`light-${s}`,{headerRowStyle:{bg:{rgb:e}},firstColumnStyle:{bg:{rgb:"rgb(255, 255, 255)"}},secondColumnStyle:{bg:{rgb:t}},lastRowStyle:{bg:{rgb:e}}}),ji=(s,e,t)=>new Oe(`middle-${s}`,{headerRowStyle:{bg:{rgb:e}},headerColumnStyle:{bg:{rgb:t}},secondRowStyle:{bg:{rgb:t}},lastRowStyle:{bg:{rgb:e}},lastColumnStyle:{bg:{rgb:t}}}),Fi=(s,e,t,n)=>new Oe(`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}}}),Gi=[{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)"}],zi=[{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)"}],Yi=[{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=Gi.map(({baseName:s,header:e,color:t})=>Bi(s,e,t)),Ki=zi.map(({baseName:s,rowHeader:e,colHeader:t})=>ji(s,e,t)),Ji=Yi.map(({baseName:s,rowHeader:e,firstRow:t,secondRow:n})=>Fi(s,e,t,n)),Xi=[...qi,...Ki,...Ji],io={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)"}}},Zi=new Oe("default",io),Qi=new Oe("default-last-row",{...io,lastRowStyle:{bd:{t:{s:i.BorderStyleTypes.THIN,cl:{rgb:"rgb(68,114,196)"}}},ht:i.HorizontalAlign.CENTER,bl:i.BooleanNumber.TRUE}});var xi=Object.getOwnPropertyDescriptor,ea=(s,e,t,n)=>{for(var o=n>1?void 0:n?xi(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},ao=(s,e)=>(t,n)=>e(t,n,s);const ta="SHEET_RANGE_THEME_MODEL_PLUGIN";g.SheetRangeThemeModel=class extends i.Disposable{constructor(t,n){super();f(this,"_rangeThemeStyleMap",new Map);f(this,"_rangeThemeStyleRuleMap",new Map);f(this,"_rTreeCollection",new Map);f(this,"_defaultRangeThemeMap",new Map);f(this,"_rangeThemeMapChanged$",new V.Subject);f(this,"rangeThemeMapChange$",this._rangeThemeMapChanged$.asObservable());this._sheetInterceptorService=t,this._resourceManagerService=n,this._registerIntercept(),this._initSnapshot(),this._initDefaultTheme()}_initDefaultTheme(){this.registerDefaultRangeTheme(Zi),this.registerDefaultRangeTheme(Qi);for(const t of Xi)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)}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})}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}}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]});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,S=r-m.range.startColumn,C=this.getRangeThemeStyle(t,h);if(C)return C.getStyle(R,S,o===m.range.endRow,r===m.range.endColumn)}}}_registerIntercept(){this.disposeWithMe(this._sheetInterceptorService.intercept(ke.CELL_CONTENT,{id:so,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 Oe(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:ta,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()}},g.SheetRangeThemeModel=ea([ao(0,i.Inject(g.SheetInterceptorService)),ao(1,i.Inject(i.IResourceManagerService))],g.SheetRangeThemeModel);function An(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 T(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 fe(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 nt={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=T(a),l=s.get(g.SheetRangeThemeModel);return u?(l.registerRangeThemeRule(r,{range:o,unitId:t,subUnitId:n}),!0):!1}},uo=(s,e)=>{const t=fe(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}},st={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=T(a),l=s.get(g.SheetRangeThemeModel);return u?(l.removeRangeThemeRule(r,{range:o,unitId:t,subUnitId:n}),!0):!1}},lo=(s,e)=>{const t=fe(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}},co={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(nt.id,e)?(n.pushUndoRedo({unitID:o,undoMutations:[{id:st.id,params:r}],redoMutations:[{id:nt.id,params:e}]}),!0):!1}},Zt=(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}},ve={id:"sheet.mutation.insert-row",type:i.CommandType.MUTATION,handler:(s,e)=>{var S;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 C=m;C<m+h;C++)r?i.insertMatrixArray(C,(S=r[C-o.startRow])!=null?S:c,d):i.insertMatrixArray(C,c,d);return l.setRowCount(l.getRowCount()+o.endRow-o.startRow+1),l.getCellMatrix().insertRows(o.startRow,h),!0}},Et=(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}},me={id:"sheet.mutation.insert-col",type:i.CommandType.MUTATION,handler:(s,e)=>{var S;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 C=c;C<c+m;C++){const v={w:h,hd:0};u?i.insertMatrixArray(C,(S=u[C-a.startColumn])!=null?S:v,d):i.insertMatrixArray(C,v,d)}return o.setColumnCount(o.getColumnCount()+a.endColumn-a.startColumn+1),o.getCellMatrix().insertColumns(a.startColumn,m),!0}},na=(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}},Ie={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}},sa=(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}},ae={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}};function oa(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=Qt(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
10
+ (function(g,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("@univerjs/core"),require("@univerjs/engine-formula"),require("@univerjs/rpc"),require("rxjs"),require("@univerjs/engine-numfmt"),require("rxjs/operators")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/engine-formula","@univerjs/rpc","rxjs","@univerjs/engine-numfmt","rxjs/operators"],i):(g=typeof globalThis<"u"?globalThis:g||self,i(g.UniverSheets={},g.UniverCore,g.UniverEngineFormula,g.UniverRpc,g.rxjs,g.UniverEngineNumfmt,g.rxjs.operators))})(this,function(g,i,Y,Oi,V,Nn,bt){"use strict";var Md=Object.defineProperty;var yd=(g,i,Y)=>i in g?Md(g,i,{enumerable:!0,configurable:!0,writable:!0,value:Y}):g[i]=Y;var f=(g,i,Y)=>yd(g,typeof i!="symbol"?i+"":i,Y);var Zs=(s=>(s.OthersCanView="othersCanView",s.NoOneElseCanView="noOneElseCanView",s))(Zs||{}),Qs=(s=>(s.DesignedUserCanEdit="designedUserCanEdit",s.OnlyMe="onlyMe",s))(Qs||{});class X{constructor(){f(this,"_model",new Map);f(this,"_ruleChange$",new V.Subject);f(this,"ruleChange$",this._ruleChange$.asObservable());f(this,"_ruleRefresh$",new V.Subject);f(this,"ruleRefresh$",this._ruleRefresh$.asObservable());f(this,"_rangeRuleInitStateChange",new V.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.Tools.generateRandomId(4);const o=this._ensureRuleMap(e,t);for(;o.has(n);)n=i.Tools.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 Ni=(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}}},Me={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}},Di=s=>{const e={...s,ruleIds:s.rules.map(t=>t.id)};return{id:Me.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}},xs={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 C=[{id:ce.id,params:{unitId:u,subUnitId:l,rules:R}}],v=[{id:Me.id,params:{unitId:u,subUnitId:l,ruleIds:R.map(I=>I.id)}}];n.pushUndoRedo({unitID:u,redoMutations:C,undoMutations:v})}return!0}};class ye{constructor(){f(this,"_model",new Map);f(this,"_ruleChange",new V.Subject);f(this,"_ruleRefresh",new V.Subject);f(this,"_resetOrder",new V.Subject);f(this,"ruleChange$",this._ruleChange.asObservable());f(this,"ruleRefresh$",this._ruleRefresh.asObservable());f(this,"resetOrder$",this._resetOrder.asObservable());f(this,"_worksheetRuleInitStateChange",new V.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 Le={id:"sheet.mutation.add-worksheet-protection",type:i.CommandType.MUTATION,handler:(s,e)=>{const{unitId:t,rule:n}=e;return s.get(ye).addRule(t,n),!0}},ze={id:"sheet.mutation.delete-worksheet-protection",type:i.CommandType.MUTATION,handler:(s,e)=>{const{unitId:t,subUnitId:n}=e;return s.get(ye).deleteRule(t,n),!0}},eo={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(Le.id,{unitId:r,rule:o,subUnitId:o.subUnitId})){const l=[{id:Le.id,params:{unitId:r,rule:o,subUnitId:o.subUnitId}}],d=[{id:ze.id,params:{unitId:r,subUnitId:a}}];n.pushUndoRedo({unitID:r,redoMutations:l,undoMutations:d})}return!0}},Ai=i.createInterceptorKey("CELL_CONTENT"),Wi=i.createInterceptorKey("ROW_FILTERED"),ke={CELL_CONTENT:Ai,ROW_FILTERED:Wi};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 Vi=Object.getOwnPropertyDescriptor,Li=(s,e,t,n)=>{for(var o=n>1?void 0:n?Vi(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 Dn=i.createInterceptorKey("BEFORE_CELL_EDIT"),Jt=i.createInterceptorKey("AFTER_CELL_EDIT"),Xt=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:Dn,AFTER_CELL_EDIT:Jt,VALIDATE_CELL:Xt}));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(ke.CELL_CONTENT,{priority:-1,effect:i.InterceptorEffectEnum.Style|i.InterceptorEffectEnum.Value,handler:n=>n}),this.disposeWithMe(this.writeCellInterceptor.intercept(Jt,{priority:-1,handler:n=>n})),this.disposeWithMe(this.writeCellInterceptor.intercept(Dn,{priority:-1,handler:n=>n})),this.disposeWithMe(this.writeCellInterceptor.intercept(Xt,{priority:-1,handler:n=>n}))}dispose(){super.dispose(),this._workbookDisposables.forEach(t=>t.dispose()),this._workbookDisposables.clear(),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(Jt)(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(Xt)(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===ke.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,S,C){const v=u.getCellRaw(m,h);return r.fetchThroughInterceptors(ke.CELL_CONTENT,R,S,C)(v,{unitId:o,subUnitId:l,row:m,col:h,worksheet:u,workbook:t,rawData:v})}})),c.add(d.registerRowFilteredInterceptor({getRowFiltered(m){return!!r.fetchThroughInterceptors(ke.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=Li([$i(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 Hi(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 Q={wholeStyle:1,headerRowStyle:2,headerColumnStyle:4,firstRowStyle:8,secondRowStyle:16,lastRowStyle:32,firstColumnStyle:128,secondColumnStyle:256,lastColumnStyle:512};class Oe{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){let r=0;return n&&(r=r|Q.lastRowStyle),o&&(r=r|Q.lastColumnStyle),e>=0&&t>=0&&(r=r|Q.wholeStyle),e%2===1&&(r=r|Q.firstRowStyle),e%2===0&&(r=r|Q.secondRowStyle),e===0&&(r=r|Q.headerRowStyle),t===0&&(r=r|Q.headerColumnStyle),t%2===1&&(r=r|Q.firstColumnStyle),t%2===0&&(r=r|Q.secondColumnStyle),r===0?null:this._getMergeStyle(r)}_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&Q.wholeStyle&&t.push(this.wholeStyle),this.firstColumnStyle&&e&Q.firstColumnStyle&&t.push(this.firstColumnStyle),this.secondColumnStyle&&e&Q.secondColumnStyle&&t.push(this.secondColumnStyle),this.firstRowStyle&&e&Q.firstRowStyle&&t.push(this.firstRowStyle),this.secondRowStyle&&e&Q.secondRowStyle&&t.push(this.secondRowStyle),this.headerColumnStyle&&e&Q.headerColumnStyle&&t.push(this.headerColumnStyle),this.lastColumnStyle&&e&Q.lastColumnStyle&&t.push(this.lastColumnStyle),this.headerRowStyle&&e&Q.headerRowStyle&&t.push(this.headerRowStyle),this.lastRowStyle&&e&Q.lastRowStyle&&t.push(this.lastRowStyle),Hi(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 Bi=(s,e,t)=>new Oe(`light-${s}`,{headerRowStyle:{bg:{rgb:e}},firstColumnStyle:{bg:{rgb:"rgb(255, 255, 255)"}},secondColumnStyle:{bg:{rgb:t}},lastRowStyle:{bg:{rgb:e}}}),ji=(s,e,t)=>new Oe(`middle-${s}`,{headerRowStyle:{bg:{rgb:e}},headerColumnStyle:{bg:{rgb:t}},secondRowStyle:{bg:{rgb:t}},lastRowStyle:{bg:{rgb:e}},lastColumnStyle:{bg:{rgb:t}}}),Fi=(s,e,t,n)=>new Oe(`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}}}),Gi=[{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)"}],zi=[{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)"}],Yi=[{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=Gi.map(({baseName:s,header:e,color:t})=>Bi(s,e,t)),Ki=zi.map(({baseName:s,rowHeader:e,colHeader:t})=>ji(s,e,t)),Ji=Yi.map(({baseName:s,rowHeader:e,firstRow:t,secondRow:n})=>Fi(s,e,t,n)),Xi=[...qi,...Ki,...Ji],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)"}}},Zi=new Oe("default",ro),Qi=new Oe("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}});var xi=Object.getOwnPropertyDescriptor,ea=(s,e,t,n)=>{for(var o=n>1?void 0:n?xi(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},io=(s,e)=>(t,n)=>e(t,n,s);const ta="SHEET_RANGE_THEME_MODEL_PLUGIN";g.SheetRangeThemeModel=class extends i.Disposable{constructor(t,n){super();f(this,"_rangeThemeStyleMap",new Map);f(this,"_rangeThemeStyleRuleMap",new Map);f(this,"_rTreeCollection",new Map);f(this,"_defaultRangeThemeMap",new Map);f(this,"_rangeThemeMapChanged$",new V.Subject);f(this,"rangeThemeMapChange$",this._rangeThemeMapChanged$.asObservable());this._sheetInterceptorService=t,this._resourceManagerService=n,this._registerIntercept(),this._initSnapshot(),this._initDefaultTheme()}_initDefaultTheme(){this.registerDefaultRangeTheme(Zi),this.registerDefaultRangeTheme(Qi);for(const t of Xi)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)}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})}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}}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]});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,S=r-m.range.startColumn,C=this.getRangeThemeStyle(t,h);if(C)return C.getStyle(R,S,o===m.range.endRow,r===m.range.endColumn)}}}_registerIntercept(){this.disposeWithMe(this._sheetInterceptorService.intercept(ke.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 Oe(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:ta,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()}},g.SheetRangeThemeModel=ea([io(0,i.Inject(g.SheetInterceptorService)),io(1,i.Inject(i.IResourceManagerService))],g.SheetRangeThemeModel);function ao(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 T(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 fe(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 nt={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=T(a),l=s.get(g.SheetRangeThemeModel);return u?(l.registerRangeThemeRule(r,{range:o,unitId:t,subUnitId:n}),!0):!1}},uo=(s,e)=>{const t=fe(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}},st={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=T(a),l=s.get(g.SheetRangeThemeModel);return u?(l.removeRangeThemeRule(r,{range:o,unitId:t,subUnitId:n}),!0):!1}},lo=(s,e)=>{const t=fe(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}},co={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(nt.id,e)?(n.pushUndoRedo({unitID:o,undoMutations:[{id:st.id,params:r}],redoMutations:[{id:nt.id,params:e}]}),!0):!1}},Zt=(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}},ve={id:"sheet.mutation.insert-row",type:i.CommandType.MUTATION,handler:(s,e)=>{var S;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 C=m;C<m+h;C++)r?i.insertMatrixArray(C,(S=r[C-o.startRow])!=null?S:c,d):i.insertMatrixArray(C,c,d);return l.setRowCount(l.getRowCount()+o.endRow-o.startRow+1),l.getCellMatrix().insertRows(o.startRow,h),!0}},Et=(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}},me={id:"sheet.mutation.insert-col",type:i.CommandType.MUTATION,handler:(s,e)=>{var S;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 C=c;C<c+m;C++){const v={w:h,hd:0};u?i.insertMatrixArray(C,(S=u[C-a.startColumn])!=null?S:v,d):i.insertMatrixArray(C,v,d)}return o.setColumnCount(o.getColumnCount()+a.endColumn-a.startColumn+1),o.getCellMatrix().insertColumns(a.startColumn,m),!0}},na=(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}},Ie={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}},sa=(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}},ae={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}};function oa(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=Qt(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
11
  `:"";!t.p&&e.p&&(r&&r!==((a=e.p.body)==null?void 0:a.dataStream)?delete e.p:aa(e.p,t.s?t.s:null))}function ra(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 Qt(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 mo(s,e){return s.some(t=>t.startIndex===e)?mo(s,e+1):e}function aa(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=Qt({},e,!0);R&&i.Tools.removeNull(R),i.Tools.isEmptyObject(R)||(h.ts=R),n.push(h)}const m=Qt(c,e,!0);m&&i.Tools.removeNull(m),i.Tools.isEmptyObject(m)?delete u.ts:u.ts=m,n.push(u),t=mo(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=Qt({},e,!0);l&&i.Tools.removeNull(l),i.Tools.isEmptyObject(l)||(u.ts=l),n.push(u)}s.body.textRuns=i.normalizeTextRuns(n)}function ua(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(!Nn.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 la(n)?Nn.isTextFormat((a=n==null?void 0:n.n)==null?void 0:a.pattern)?i.CellValueType.STRING:ho(e,t):Nn.isTextFormat((u=o==null?void 0:o.n)==null?void 0:u.pattern)?i.CellValueType.STRING:ho(e,t)}function ho(s,e){return s.v!==void 0?Wn(s.v,s.t):Wn(e.v,e.t)}function la(s){var e;return!!((e=s==null?void 0:s.n)!=null&&e.pattern)}function Wn(s,e){return s===null?null:typeof s=="string"?i.isRealNum(s)?(+s==0||+s==1)&&e===i.CellValueType.BOOLEAN?i.CellValueType.BOOLEAN:i.willLoseNumericPrecision(s)?i.CellValueType.FORCE_STRING:i.CellValueType.NUMBER:i.isBooleanString(s)?i.CellValueType.BOOLEAN:i.CellValueType.STRING:typeof s=="number"?(s===0||s===1)&&e===i.CellValueType.BOOLEAN?i.CellValueType.BOOLEAN:i.CellValueType.NUMBER:typeof s=="boolean"?i.CellValueType.BOOLEAN:i.CellValueType.FORCE_STRING}function go(s,e){return e.v===void 0||e.v===null?e.v:s===i.CellValueType.NUMBER?Number(e.v):s===i.CellValueType.BOOLEAN?da(e.v)?1:0:s===i.CellValueType.STRING||s===i.CellValueType.FORCE_STRING?`${e.v}`:e.v}function da(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 ca(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 ue=(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,S)=>{const C=i.Tools.deepClone(l==null?void 0:l.getValue(h,R))||{},v=d.getStyleByCell(C),I=d.getStyleByCell(S);C.s=ra(v,I),c.setValue(h,R,ca(C))}),{...e,options:{},cellValue:c.getMatrix()}},B={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 S=l.getValue(m,h)||{};S=ha(R,S,d),i.Tools.isEmptyObject(S)?l.realDeleteValue(m,h):l.setValue(m,h,S)}}),!0}},ma=new Set(["f","p","si","custom","ref"]);function ha(s,e,t){const n=ua(t,s,e);return Object.keys(s).forEach(o=>{const r=o;if(ma.has(r)){const a=s[r];ga(e,r,a)}else r==="v"?s.v!==void 0&&(e.v=go(n,s)):r==="s"&&oa(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 ga(s,e,t){t===void 0||(t===null?delete s[e]:s[e]=t)}const Ro={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=ue(s,m),R=[{id:B.id,params:m}],S=[{id:B.id,params:h}];if(u){const v={unitId:o,subUnitId:r,range:{startRow:d,endRow:d,startColumn:0,endColumn:c-1}},I=Zt(s,v);R.unshift({id:ve.id,params:v}),S.push({id:Ie.id,params:I})}if(l){const v={unitId:o,subUnitId:r,range:{startRow:0,endRow:d-1,startColumn:c,endColumn:c-1+l}},I=Et(s,v);R.unshift({id:me.id,params:v}),S.push({id:ae.id,params:I})}return i.sequenceExecute(R,t).result?(n.pushUndoRedo({unitID:o,undoMutations:S,redoMutations:R}),!0):!1}},Ra=(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)},{}),Sa=(s=0)=>{let e=s;return function(){return e++}};function Ca(s){return s==null?!1:s.v!==void 0&&s.v!==null&&s.v!==""||s.p!==void 0}function fa(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(Ca(o))return{startRow:t,startColumn:n,endRow:t,endColumn:n}}return null}function Vn(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 So(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 va(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 Co(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 Tt(s,e,t,n){const o=[],r=[];for(const h of s){const R=Co(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 S=h[0];for(let C=1;C<h.length;C++)h[C]!==h[C-1]+1&&(R.push([S,h[C-1]]),S=h[C]);return R.push([S,h[h.length-1]]),R}const c=d(a),m=d(u);for(const[h,R]of c)for(const[S,C]of m)l.push({startRow:h,endRow:R,startColumn:S,endColumn:C});return l}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 fo extends i.Disposable{constructor(t){super();f(this,"_worksheetSelections",new Map);f(this,"_selectionMoveStart$",new V.Subject);f(this,"selectionMoveStart$",this._selectionMoveStart$.asObservable());f(this,"_selectionMoving$",new V.Subject);f(this,"selectionMoving$",this._selectionMoving$.asObservable());f(this,"_selectionMoveEnd$",new V.BehaviorSubject([]));f(this,"selectionMoveEnd$",this._selectionMoveEnd$.asObservable());f(this,"_selectionSet$",new V.BehaviorSubject([]));f(this,"selectionSet$",this._selectionSet$.asObservable());f(this,"selectionChanged$");f(this,"_beforeSelectionMoveEnd$",new V.BehaviorSubject([]));f(this,"beforeSelectionMoveEnd$",this._beforeSelectionMoveEnd$.asObservable());this._workbook=t,this.selectionChanged$=V.merge(this._selectionMoveEnd$,this._selectionSet$)}dispose(){super.dispose(),this._beforeSelectionMoveEnd$.complete(),this._selectionMoveEnd$.complete(),this._selectionMoving$.complete(),this._selectionMoveStart$.complete(),this._selectionSet$.complete()}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 Ia=Object.getOwnPropertyDescriptor,pa=(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},wa=(s,e)=>(t,n)=>e(t,n,s);g.SheetsSelectionsService=class extends i.RxDisposable{constructor(t){super();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(V.shareReplay(1),V.takeUntil(this.dispose$));this.selectionMoveStart$=t.pipe(V.switchMap(n=>n?this._ensureWorkbookSelection(n.getUnitId()).selectionMoveStart$:V.of())),this.selectionMoving$=t.pipe(V.switchMap(n=>n?this._ensureWorkbookSelection(n.getUnitId()).selectionMoving$:V.of())),this.selectionMoveEnd$=t.pipe(V.switchMap(n=>n?this._ensureWorkbookSelection(n.getUnitId()).selectionMoveEnd$:V.of([]))),this.selectionSet$=t.pipe(V.switchMap(n=>n?this._ensureWorkbookSelection(n.getUnitId()).selectionSet$:V.of([]))),this.selectionChanged$=t.pipe(V.switchMap(n=>n?this._ensureWorkbookSelection(n.getUnitId()).selectionChanged$:V.of([]))).pipe(V.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]))),V.skip(1)),this._instanceSrv.getTypeOfUnitDisposed$(i.UniverInstanceType.UNIVER_SHEET).pipe(V.takeUntil(this.dispose$)).subscribe(n=>{this._removeWorkbookSelection(n.getUnitId())})}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 fo(o),this._workbookSelections.set(t,n)}return n}_removeWorkbookSelection(t){this._workbookSelections.delete(t)}},g.SheetsSelectionsService=pa([wa(0,i.IUniverInstanceService)],g.SheetsSelectionsService);const Ma="DISABLE_NORMAL_SELECTIONS",ya="SELECTIONS_ENABLED",vo="REF_SELECTIONS_ENABLED",xt={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=Tt(m,s,l,c),R=[],S=[],C={subUnitId:c,unitId:l,cellValue:Vn(h)},v=ue(s,C);R.push({id:B.id,params:C}),S.push({id:B.id,params:v});const I=a.onCommandExecute({id:xt.id});return R.push(...I.redos),S.unshift(...I.undos),i.sequenceExecute(R,n)?(r.pushUndoRedo({unitID:l,undoMutations:S,redoMutations:R}),!0):!1}},en={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=Tt(m,s,l,c),R={subUnitId:c,unitId:l,cellValue:So(h)},S=ue(s,R),C=a.onCommandExecute({id:en.id}),v=[{id:B.id,params:R},...C.redos],I=[...C.undos,{id:B.id,params:S}];return i.sequenceExecute(v,n).result?(r.pushUndoRedo({unitID:l,undoMutations:I,redoMutations:v}),!0):!1}},tn={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=Tt(m,s,l,c),R=[],S=[],C={subUnitId:c,unitId:l,cellValue:va(h)},v=ue(s,C);R.push({id:B.id,params:C}),S.push({id:B.id,params:v});const I=a.onCommandExecute({id:tn.id});return R.push(...I.redos),S.unshift(...I.undos),i.sequenceExecute(R,n)?(r.pushUndoRedo({unitID:l,undoMutations:S,redoMutations:R}),!0):!1}},Ln=(s,e)=>({subUnitId:e.sheet.id,unitId:e.unitId,subUnitName:e.sheet.name}),ot={id:"sheet.mutation.insert-sheet",type:i.CommandType.MUTATION,handler:(s,e)=>{const t=s.get(i.IUniverInstanceService),{sheet:n,index:o,unitId:r}=e,a=t.getUniverSheetInstance(r);return a?a.addWorksheet(n.id,o,n):!1}},Io=(s,e)=>{const t=s.get(i.IUniverInstanceService),{subUnitId:n,unitId:o}=e,r=fe(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}},Ye={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}},$n={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=T(o,e);if(!u)return!1;const{workbook:l,worksheet:d,unitId:c,subUnitId:m}=u,h=i.Tools.deepClone(d.getConfig());h.name=_a(l,a,h.name),h.id=i.Tools.generateRandomId();const S={index:l.getSheetIndex(d)+1,sheet:h,unitId:c},C=Ln(s,S),v=r.onCommandExecute({id:$n.id,params:{unitId:c,subUnitId:m,targetSubUnitId:h.id}}),I=[...(w=v.preRedos)!=null?w:[],{id:ot.id,params:S},...v.redos],M=[...(y=v.preUndos)!=null?y:[],{id:Ye.id,params:C},...v.undos];return i.sequenceExecute(I,t).result?(n.pushUndoRedo({unitID:c,undoMutations:M,redoMutations:I}),!0):!1}};function _a(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 $e={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)=>{l.setValue(c,m,h)}),new i.ObjectMatrix(n.value).forValue((c,m,h)=>{d.setValue(c,m,h)}),!0}};function Ut(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?Ut(r,e,t):r}function ba(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 Ea(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 ne(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 _e=(s,e,t)=>({id:q.id,params:{unitId:e.getUnitId(),subUnitId:t.getSheetId(),reveal:!0,selections:[{range:s,primary:ne(s,t)}]}});function Ta(s){if(!s)return!1;const{range:e,primary:t}=s;return i.Rectangle.equals(e,t)}function Ua(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 po=s=>s.id!==so;function Ne(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,oo,po):s.getCellWithFilteredInterceptors(l,a,oo,po);!c||!c.s||(u[l]||(u[l]={}),u[l][d]={s:c.s})}return u}var Pa=Object.getOwnPropertyDescriptor,ka=(s,e,t,n)=>{for(var o=n>1?void 0:n?Pa(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},Oa=(s,e)=>(t,n)=>e(t,n,s);const wo=i.createIdentifier("sheets-formula.ref-selections.service");g.RefSelectionsService=class extends g.SheetsSelectionsService{constructor(e){super(e)}_init(){const e=this._getAliveWorkbooks$().pipe(V.takeUntil(this.dispose$));this.selectionMoveStart$=e.pipe(V.switchMap(t=>V.merge(...t.map(n=>n.selectionMoveStart$)))),this.selectionMoving$=e.pipe(V.switchMap(t=>V.merge(...t.map(n=>n.selectionMoving$)))),this.selectionMoveEnd$=e.pipe(V.switchMap(t=>V.merge(...t.map(n=>n.selectionMoveEnd$)))),this.selectionSet$=e.pipe(V.switchMap(t=>V.merge(...t.map(n=>n.selectionSet$))))}_getAliveWorkbooks$(){const e=this._instanceSrv.getAllUnitsForType(i.UniverInstanceType.UNIVER_SHEET);e.forEach(n=>this._ensureWorkbookSelection(n.getUnitId()));const t=new V.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(V.map(n=>n.map(o=>this._ensureWorkbookSelection(o.getUnitId()))))}},g.RefSelectionsService=ka([Oa(0,i.IUniverInstanceService)],g.RefSelectionsService);function Mo(s,e){const n=s.get(i.IContextService).getContextValue(vo);return s.get(n&&!e?wo: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 Mo(s).setSelections(o,r,[...t],n),!0}},yo={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=T(s.get(i.IUniverInstanceService),e);if(!a)return!1;const u=[{range:o,primary:ne(o,a.worksheet),style:null}];return r.syncExecuteCommand(q.id,{unitId:t,subUnitId:n,selections:u})}},_o="sheet.command.move-range",qe={type:i.CommandType.COMMAND,id:_o,handler:async(s,e)=>{var y,b;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=T(o);if(!l||!await u.beforeCommandExecute({id:qe.id,params:e}))return!1;const{worksheet:c,subUnitId:m,unitId:h}=l,R=nn(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 S=u.onCommandExecute({id:qe.id,params:e}),C=[...(y=S.preRedos)!=null?y:[],...R.redos,...S.redos,{id:q.id,params:{unitId:h,subUnitId:m,selections:[{range:e.toRange,primary:Na(e.fromRange,e.toRange,c)}],type:te.MOVE_END}}],v=[...(b=S.preUndos)!=null?b:[],...R.undos,...S.undos,{id:q.id,params:{unitId:h,subUnitId:m,selections:[{range:e.fromRange,primary:ne(e.fromRange,c)}],type:te.MOVE_END}}],I=i.sequenceExecute(C,t).result,{undos:M,redos:p}=u.generateMutationsOfAutoHeight({unitId:h,subUnitId:m,ranges:[e.fromRange,e.toRange]}),w=u.afterCommandExecute({id:qe.id,params:e});return I?(i.sequenceExecute([...w.redos,...p],t),n.pushUndoRedo({unitID:h,undoMutations:[...v,...w.undos,...M],redoMutations:[...C,...w.redos,...p]}),!0):!1}};function nn(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),S=h==null?void 0:h.getSheetBySheetId(u),C=R==null?void 0:R.getCellMatrix(),v=S==null?void 0:S.getCellMatrix();if(R&&S&&C&&v){const I=Ut(d,R,!1);if(!i.Rectangle.equals(d,I)&&!n)return null;const M=new i.ObjectMatrix,p=new i.ObjectMatrix,w=new i.ObjectMatrix;i.Range.foreach(a,(P,E)=>{const k=v.getValue(P,E);if(M.setValue(P,E,i.Tools.deepClone(k)),k){const W=h==null?void 0:h.getStyles().get(k.s);w.setValue(P,E,i.Tools.deepClone(W))}p.setValue(P,E,null)});const y=new i.ObjectMatrix,b=new i.ObjectMatrix;i.Range.foreach(d,(P,E)=>{y.setValue(P,E,i.Tools.deepClone(C.getValue(P,E)))}),i.Range.foreach(a,(P,E)=>{const k=i.cellToRange(P,E),W=i.Rectangle.getRelativeRange(k,a),A=i.Rectangle.getPositionRange(W,d),L=i.Tools.deepClone(w.getValue(P,E)),j=i.Tools.deepClone(M.getValue(P,E));j&&L&&(j.s=L),b.setValue(A.startRow,A.startColumn,j)});const O={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:$e.id,params:O}),r.push({id:$e.id,params:U})}return{redos:o,undos:r}}function Na(s,e,t){const n=s.startRow,o=s.startColumn,r=t.getMergedCell(n,o),a=ne(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 sn=(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))(sn||{}),_=(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))(_||{}),N=(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))(N||{});class he{constructor(e,t,n){f(this,"type",N.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=`${N.SelectRange}.${_.Edit}.${n}`}}class on{constructor(e,t,n){f(this,"type",N.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=`${N.SelectRange}.${_.View}.${n}`}}class Hn{constructor(e){f(this,"id");f(this,"value",!0);f(this,"type",N.Workbook);f(this,"status",i.PermissionStatus.INIT);f(this,"subType",_.Comment);this.unitId=e,this.unitId=e,this.id=`${this.type}.${_.Comment}_${e}`}}class Bn{constructor(e){f(this,"id");f(this,"value",!0);f(this,"type",N.Workbook);f(this,"status",i.PermissionStatus.INIT);f(this,"subType",_.Copy);this.unitId=e,this.unitId=e,this.id=`${this.type}.${_.Copy}_${e}`}}class bo{constructor(e){f(this,"id");f(this,"value",!0);f(this,"type",N.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",N.Workbook);f(this,"status",i.PermissionStatus.INIT);f(this,"subType",_.CreatePermissionObject);this.unitId=e,this.unitId=e,this.id=`${this.type}.${_.CreatePermissionObject}_${e}`}}class Fn{constructor(e){f(this,"id");f(this,"value",!0);f(this,"type",N.Workbook);f(this,"status",i.PermissionStatus.INIT);f(this,"subType",_.CreateSheet);this.unitId=e,this.unitId=e,this.id=`${this.type}.${_.CreateSheet}_${e}`}}class Gn{constructor(e){f(this,"id");f(this,"value",!0);f(this,"type",N.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",N.Workbook);f(this,"status",i.PermissionStatus.INIT);f(this,"subType",_.Duplicate);this.unitId=e,this.unitId=e,this.id=`${this.type}.${_.Duplicate}_${e}`}}class le{constructor(e){f(this,"id");f(this,"value",!0);f(this,"type",N.Workbook);f(this,"status",i.PermissionStatus.INIT);f(this,"subType",_.Edit);this.unitId=e,this.unitId=e,this.id=`${this.type}.${_.Edit}_${e}`}}class Yn{constructor(e){f(this,"id");f(this,"value",!0);f(this,"type",N.Workbook);f(this,"status",i.PermissionStatus.INIT);f(this,"subType",_.Export);this.unitId=e,this.unitId=e,this.id=`${this.type}.${_.Export}_${e}`}}class rn{constructor(e){f(this,"id");f(this,"value",!0);f(this,"type",N.Workbook);f(this,"status",i.PermissionStatus.INIT);f(this,"subType",_.HideSheet);this.unitId=e,this.unitId=e,this.id=`${this.type}.${_.HideSheet}_${e}`}}class Eo{constructor(e){f(this,"id");f(this,"value",!0);f(this,"type",N.Workbook);f(this,"status",i.PermissionStatus.INIT);f(this,"subType",_.History);this.unitId=e,this.unitId=e,this.id=`${this.type}.${_.History}_${e}`}}class an{constructor(e){f(this,"id");f(this,"value",!0);f(this,"type",N.Workbook);f(this,"status",i.PermissionStatus.INIT);f(this,"subType",_.ManageCollaborator);this.unitId=e,this.unitId=e,this.id=`${this.type}.${_.ManageCollaborator}_${e}`}}class un{constructor(e){f(this,"id");f(this,"value",!0);f(this,"type",N.Workbook);f(this,"status",i.PermissionStatus.INIT);f(this,"subType",_.MoveSheet);this.unitId=e,this.unitId=e,this.id=`${this.type}.${_.MoveSheet}_${e}`}}class qn{constructor(e){f(this,"id");f(this,"value",!0);f(this,"type",N.Workbook);f(this,"status",i.PermissionStatus.INIT);f(this,"subType",_.Print);this.unitId=e,this.unitId=e,this.id=`${this.type}.${_.Print}_${e}`}}class Kn{constructor(e){f(this,"id");f(this,"value",!0);f(this,"type",N.Workbook);f(this,"status",i.PermissionStatus.INIT);f(this,"subType",_.RecoverHistory);this.unitId=e,this.unitId=e,this.id=`${this.type}.${_.RecoverHistory}_${e}`}}class ln{constructor(e){f(this,"id");f(this,"value",!0);f(this,"type",N.Workbook);f(this,"status",i.PermissionStatus.INIT);f(this,"subType",_.RenameSheet);this.unitId=e,this.unitId=e,this.id=`${this.type}.${_.RenameSheet}_${e}`}}class Jn{constructor(e){f(this,"id");f(this,"value",!0);f(this,"type",N.Workbook);f(this,"status",i.PermissionStatus.INIT);f(this,"subType",_.Share);this.unitId=e,this.unitId=e,this.id=`${this.type}.${_.Share}_${e}`}}class Xn{constructor(e){f(this,"id");f(this,"value",!0);f(this,"type",N.Workbook);f(this,"status",i.PermissionStatus.INIT);f(this,"subType",_.View);this.unitId=e,this.unitId=e,this.id=`${this.type}.${_.View}_${e}`}}class Zn{constructor(e){f(this,"id");f(this,"value",!0);f(this,"type",N.Workbook);f(this,"status",i.PermissionStatus.INIT);f(this,"subType",_.ViewHistory);this.unitId=e,this.unitId=e,this.id=`${this.type}.${_.ViewHistory}_${e}`}}class Qn{constructor(e,t){f(this,"value",!0);f(this,"type",N.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 xn{constructor(e,t){f(this,"value",!0);f(this,"type",N.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 es{constructor(e,t){f(this,"value",!0);f(this,"type",N.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 ts{constructor(e,t){f(this,"value",!0);f(this,"type",N.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 ge{constructor(e,t){f(this,"value",!0);f(this,"type",N.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 ns{constructor(e,t){f(this,"value",!0);f(this,"type",N.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 ss{constructor(e,t){f(this,"value",!0);f(this,"type",N.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 os{constructor(e,t){f(this,"value",!0);f(this,"type",N.Worksheet);f(this,"status",i.PermissionStatus.INIT);f(this,"id");f(this,"subType",_.InsertColumn);this.unitId=e,this.subUnitId=t,this.id=`${this.type}.${_.InsertColumn}_${e}_${t}`}}class rs{constructor(e,t){f(this,"value",!0);f(this,"type",N.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 is{constructor(e,t){f(this,"value",!0);f(this,"type",N.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 as{constructor(e,t){f(this,"value",!0);f(this,"type",N.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 us{constructor(e,t){f(this,"value",!0);f(this,"type",N.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 Da{constructor(e,t){f(this,"value",!0);f(this,"type",N.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 Aa{constructor(e,t){f(this,"value",!0);f(this,"type",N.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 ls{constructor(e,t){f(this,"value",!0);f(this,"type",N.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 Pt{constructor(e,t){f(this,"value",!0);f(this,"type",N.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 rt{constructor(e,t){f(this,"value",!0);f(this,"type",N.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 it{constructor(e,t){f(this,"value",!0);f(this,"type",N.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 ds{constructor(e,t){f(this,"value",!0);f(this,"type",N.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 kt{constructor(e,t){f(this,"value",!0);f(this,"type",N.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 at={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=T(o,e);if(!l)return!1;const{subUnitId:d,unitId:c,workbook:m,worksheet:h}=l,{value:R,range:S,redoUndoId:C}=e,v=S?[S]:(W=r.getCurrentSelections())==null?void 0:W.map(A=>A.range);if(!v||!v.length||!u.getPermissionPoint(new ge(c,d).id))return!1;const I=new i.ObjectMatrix;let M;if(i.Tools.isArray(R))for(let A=0;A<v.length;A++){const{startRow:L,startColumn:j,endRow:K,endColumn:z}=v[A];for(let J=0;J<=K-L;J++)for(let se=0;se<=z-j;se++)I.setValue(J+L,se+j,R[J][se])}else if(i.isICellData(R))for(let A=0;A<v.length;A++){const{startRow:L,startColumn:j,endRow:K,endColumn:z}=v[A];for(let J=L;J<=K;J++)for(let se=j;se<=z;se++)I.setValue(J,se,R)}else M=R;const p={subUnitId:d,unitId:c,cellValue:M!=null?M:I.getMatrix()},w=ue(s,p),y=i.mapObjectMatrix(p.cellValue,(A,L)=>h.getCellHeight(A,L)||void 0);if(!t.syncExecuteCommand(B.id,p))return!1;const{undos:O,redos:U}=a.onCommandExecute({id:at.id,params:p}),{undos:P,redos:E}=a.generateMutationsOfAutoHeight({unitId:c,subUnitId:d,ranges:v,cellHeights:new i.ObjectMatrix(y)});if(i.sequenceExecute([...U,...E],t).result){const A=_e(S!=null?S:I.getRange(),m,h);return n.pushUndoRedo({unitID:c,undoMutations:[{id:B.id,params:w},...O,...P,A],redoMutations:[{id:B.id,params:p},...U,...E,i.Tools.deepClone(A)],id:C}),!0}return!1}};function cs(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(),S=R.getDataRange();if(a.startColumn<=S.endColumn||a.startRow<=S.endRow){let p,w;if(u===i.Dimension.COLUMNS){const b=Math.min(a.endRow,S.endRow);let O=0;for(let P=a.startRow;P<=b;P++){const E=R.getRow(P),k=E?i.getArrayLength(E)-1:0;O=Math.max(O,k)}p={startRow:a.startRow,startColumn:a.startColumn,endRow:b,endColumn:O};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,S.endColumn),O=S.endRow;p={startRow:a.startRow,startColumn:a.startColumn,endRow:O,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=nn(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 C={subUnitId:r,unitId:o,cellValue:l},v=ue(s,C),{undos:I,redos:M}=c.onCommandExecute({id:at.id,params:{...C,range:a}});t.push({id:B.id,params:C},...M),n.push({id:B.id,params:v},...I)}return{redo:t,undo:n}}function ms(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(),S={subUnitId:r,unitId:o,cellValue:Vn([a])},C=ue(s,S),v=d.onCommandExecute({id:at.id,params:S});if(t.push({id:B.id,params:S},...v.redos),n.push(...v.undos,{id:B.id,params:C}),a.startColumn<=R.endColumn||a.startRow<=R.endRow){let I=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 O=h.getRow(b),U=O?i.getArrayLength(O)-1:0;w=Math.max(w,U)}I={startRow:a.startRow,startColumn:a.endColumn+1,endRow:p,endColumn:w};const y=a.endColumn-a.startColumn+1;M={startRow:a.startRow,startColumn:I.startColumn-y,endRow:p,endColumn:I.endColumn-y}}if(u===i.Dimension.ROWS&&a.endRow<R.endRow){const p=Math.min(a.endColumn,R.endColumn),w=R.endRow;I={startRow:a.endRow+1,startColumn:a.startColumn,endRow:w,endColumn:p};const y=a.endRow-a.startRow+1;M={startRow:I.startRow-y,startColumn:a.startColumn,endRow:I.endRow-y,endColumn:p}}if(I&&M){const p=nn(s,{unitId:o,subUnitId:r,range:I},{subUnitId:r,range:M},!0);p&&(t.push(...p.redos),n.push(...p.undos))}}}return{redo:t,undo:n}}function Wa(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 Va(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 To="sheet.command.delete-range-move-left",Ke={type:i.CommandType.COMMAND,id:To,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=T(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},S=a.onCommandExecute({id:Ke.id,params:{range:h}}),{redo:C,undo:v}=ms(s,R),I=[...(y=S.preRedos)!=null?y:[],...C],M=[...S.undos,...v];return I.push(...S.redos),I.push(_e(h,d,l)),M.push(...(b=S.preUndos)!=null?b:[]),i.sequenceExecute(I,t).result?(n.pushUndoRedo({unitID:m,undoMutations:M.reverse(),redoMutations:I}),!0):!1}},Uo="sheet.command.delete-range-move-up",Je={type:i.CommandType.COMMAND,id:Uo,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=T(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},S=a.onCommandExecute({id:Je.id,params:{range:h}}),{redo:C,undo:v}=ms(s,R),I=[...(y=S.preRedos)!=null?y:[],...C],M=[...S.undos,...v];return I.push(...S.redos),I.push(_e(h,c,m)),M.push(...(b=S.preUndos)!=null?b:[]),i.sequenceExecute(I,t).result?(n.pushUndoRedo({unitID:l,undoMutations:M.reverse(),redoMutations:I}),!0):!1}},Po={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(Me.id,u)&&n.pushUndoRedo({unitID:o,redoMutations:[{id:Me.id,params:u}],undoMutations:[{id:ce.id,params:{unitId:o,subUnitId:r,rules:[a]}}]}),!0}},ko={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(ze.id,{unitId:r,subUnitId:a});const u=[{id:ze.id,params:{unitId:r,subUnitId:a}}],l=[{id:Le.id,params:{unitId:r,rule:o,subUnitId:a}}];return n.pushUndoRedo({unitID:r,redoMutations:u,undoMutations:l}),!0}},Oo={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(st.id,e)?(n.pushUndoRedo({unitID:o,undoMutations:[{id:nt.id,params:r}],redoMutations:[{id:st.id,params:e}]}),!0):!1}},No={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(Y.SetDefinedNameMutation.id,o)?(n.pushUndoRedo({unitID:e.unitId,undoMutations:[{id:Y.RemoveDefinedNameMutation.id,params:o}],redoMutations:[{id:Y.SetDefinedNameMutation.id,params:o}]}),!0):!1}},La="sheet.command.insert-range-move-down",ut={type:i.CommandType.COMMAND,id:"sheet.command.insert-range-move-down",handler:async(s,e)=>{var W,A,L;const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),o=s.get(i.IUniverInstanceService),r=s.get(g.SheetsSelectionsService),a=s.get(g.SheetInterceptorService),u=s.get(i.ErrorService),l=s.get(i.LocaleService);if(r.isOverlapping())return u.emit(l.t("sheets.info.overlappingSelections")),!1;const d=T(o);if(!d)return!1;const{unitId:c,subUnitId:m,worksheet:h,workbook:R}=d;let S=e==null?void 0:e.range;if(S||(S=(W=r.getCurrentLastSelection())==null?void 0:W.range),!S)return!1;const C=[],v=[],I=h.getCellMatrix(),M=I.getDataRange(),w=I.getSlice(M.startRow,M.endRow,S.startColumn,S.endColumn).getDataRange().endRow,y=Math.max(w+(S.endRow-S.startRow+1)-M.endRow,0);if(y>0){const j=S.startRow-1,K=h.getRowHeight(j),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:K,hd:i.BooleanNumber.FALSE}))};C.push({id:ve.id,params:z});const J=Zt(s,z);v.push({id:Ie.id,params:J})}const b={};i.Range.foreach(S,(j,K)=>{const z=h.getCell(j,K);z&&(b[j]||(b[j]={}),b[j][K]={s:z.s})});const O={range:S,subUnitId:m,unitId:c,shiftDimension:i.Dimension.ROWS,cellValue:b},{redo:U,undo:P}=cs(s,O);C.push(...U),v.push(...P);const E=a.onCommandExecute({id:ut.id,params:{range:S}});return C.push(...E.redos),C.push(_e(S,R,h)),v.push(...(A=E.preUndos)!=null?A:[]),C.unshift(...(L=E.preRedos)!=null?L:[]),v.unshift(...E.undos),i.sequenceExecute(C,t)?(n.pushUndoRedo({unitID:c,undoMutations:v.reverse(),redoMutations:C}),!0):!1}},hs="sheet.command.insert-range-move-right",Ot={type:i.CommandType.COMMAND,id:hs,handler:async(s,e)=>{var W,A,L;const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),o=s.get(i.IUniverInstanceService),r=s.get(g.SheetsSelectionsService),a=s.get(g.SheetInterceptorService),u=s.get(i.ErrorService),l=s.get(i.LocaleService);if(r.isOverlapping())return u.emit(l.t("sheets.info.overlappingSelections")),!1;const d=T(o);if(!d)return!1;const{workbook:c,worksheet:m,unitId:h,subUnitId:R}=d;let S=e==null?void 0:e.range;if(S||(S=(W=r.getCurrentLastSelection())==null?void 0:W.range),!S)return!1;const C=[],v=[],I=m.getCellMatrix(),M=I.getDataRange(),w=I.getSlice(S.startRow,S.endRow,M.startColumn,M.endColumn).getDataRange().endColumn,y=Math.max(w+(S.endColumn-S.startColumn+1)-M.endColumn,0);if(y>0){const j=S.startColumn-1,K=m.getColumnWidth(j),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:K,hd:i.BooleanNumber.FALSE}))};C.push({id:me.id,params:z});const J=Et(s,z);v.push({id:ae.id,params:J})}const b={};i.Range.foreach(S,(j,K)=>{const z=m.getCell(j,K);!z||!z.s||(b[j]||(b[j]={}),b[j][K]={s:z.s})});const O={range:S,subUnitId:R,unitId:h,shiftDimension:i.Dimension.COLUMNS,cellValue:b},{redo:U,undo:P}=cs(s,O);C.push(...U),v.push(...P);const E=a.onCommandExecute({id:Ot.id,params:{range:S}});return C.push(...E.redos),C.push(_e(S,c,m)),v.push(...(A=E.preUndos)!=null?A:[]),C.unshift(...(L=E.preRedos)!=null?L:[]),v.unshift(...E.undos),i.sequenceExecute(C,t).result?(n.pushUndoRedo({unitID:h,undoMutations:v.reverse(),redoMutations:C}),!0):!1}},Do="sheet.command.insert-row",be={type:i.CommandType.COMMAND,id:Do,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:be.id,params:e})?t.syncExecuteCommand(gs.id,{range:o,direction:r,unitId:a,subUnitId:u,cellValue:l}):!1}},gs={type:i.CommandType.COMMAND,id:"sheet.command.insert-row-by-range",handler:(s,e)=>{var U,P,E,k;const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),o=s.get(i.IUniverInstanceService),r=s.get(g.SheetInterceptorService),a=T(o,e);if(!a)return!1;const{workbook:u,worksheet:l}=a,{range:d,direction:c,unitId:m,subUnitId:h,cellValue:R}=e,{startRow:S,endRow:C}=d;d.rangeType=i.RANGE_TYPE.ROW;const v=c===i.Direction.UP?S:S-1,I=l.getRowHeight(v),M={unitId:m,subUnitId:h,range:d,rowInfo:new Array(C-S+1).fill(void 0).map(()=>({h:I,hd:i.BooleanNumber.FALSE}))},p=Zt(s,M),w=[{id:ve.id,params:M}],y=[{id:Ie.id,params:p}];R&&Object.keys(R).length>0&&w.push({id:B.id,params:{unitId:m,subUnitId:h,cellValue:R}});const b=r.onCommandExecute({id:be.id,params:e});return w.unshift(...(U=b.preRedos)!=null?U:[]),w.push(...(P=b.redos)!=null?P:[]),w.push(_e(d,u,l)),y.unshift(...(E=b.preUndos)!=null?E:[]),y.push(...(k=b.undos)!=null?k:[]),i.sequenceExecute(w,t).result?(n.pushUndoRedo({unitID:e.unitId,undoMutations:y,redoMutations:w}),!0):!1}},Ao={type:i.CommandType.COMMAND,id:"sheet.command.insert-row-before",handler:async s=>{var S;const t=(S=s.get(g.SheetsSelectionsService).getCurrentSelections())==null?void 0:S.map(C=>C.range);let n;if((t==null?void 0:t.length)===1)n=t[0];else return!1;const o=s.get(i.IUniverInstanceService),r=T(o);if(!r)return!1;const{worksheet:a,subUnitId:u,unitId:l}=r,{startRow:d,endRow:c}=n,m=0,h=a.getColumnCount()-1,R={unitId:l,subUnitId:u,direction:i.Direction.UP,range:{startRow:d,endRow:c,startColumn:m,endColumn:h},cellValue:Ne(a,d,c,m,h,!0,d-1)};return s.get(i.ICommandService).executeCommand(be.id,R)}},Wo={type:i.CommandType.COMMAND,id:"sheet.command.insert-row-after",handler:async s=>{var C;const t=(C=s.get(g.SheetsSelectionsService).getCurrentSelections())==null?void 0:C.map(v=>v.range);let n;if((t==null?void 0:t.length)===1)n=t[0];else return!1;const o=s.get(i.IUniverInstanceService),r=T(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,S={unitId:u,subUnitId:l,direction:i.Direction.DOWN,range:{startRow:c,endRow:m,startColumn:h,endColumn:R,rangeType:i.RANGE_TYPE.ROW},cellValue:Ne(a,c,m,h,R,!0,n.endRow)};return s.get(i.ICommandService).executeCommand(be.id,S)}},Vo={type:i.CommandType.COMMAND,id:"sheet.command.insert-multi-rows-above",handler:async(s,e)=>{var I;const n=(I=s.get(g.SheetsSelectionsService).getCurrentSelections())==null?void 0:I.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=T(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,S=u.getColumnCount()-1,C=Ne(u,m,h,R,S,!0,m-1),v={unitId:l,subUnitId:d,direction:i.Direction.UP,range:{startRow:m,endRow:h,startColumn:R,endColumn:S,rangeType:i.RANGE_TYPE.ROW},cellValue:C};return s.get(i.ICommandService).executeCommand(be.id,v)}},Lo={type:i.CommandType.COMMAND,id:"sheet.command.insert-multi-rows-after",handler:async(s,e)=>{var v;const n=(v=s.get(g.SheetsSelectionsService).getCurrentSelections())==null?void 0:v.map(I=>I.range);let o;if((n==null?void 0:n.length)===1)o=n[0];else return!1;const r=s.get(i.IUniverInstanceService),a=T(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,S=u.getColumnCount()-1,C={unitId:l,subUnitId:d,direction:i.Direction.DOWN,range:{startRow:m,endRow:h,startColumn:R,endColumn:S,rangeType:i.RANGE_TYPE.ROW},cellValue:Ne(u,m,h,R,S,!0,o.endRow)};return s.get(i.ICommandService).executeCommand(be.id,C)}},$o="sheet.command.insert-col",Ee={type:i.CommandType.COMMAND,id:$o,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:Ee.id,params:e})?t.syncExecuteCommand(Rs.id,{range:o,direction:r,unitId:u,subUnitId:a,cellValue:l}):!1}},Rs={type:i.CommandType.COMMAND,id:"sheet.command.insert-col-by-range",handler:(s,e)=>{var O,U,P,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),S=R.getSheetBySheetId(e.subUnitId),C=u===i.Direction.LEFT?m:m-1,v=S.getColumnWidth(C),I={unitId:d,subUnitId:l,range:a,colInfo:new Array(h-m+1).fill(void 0).map(()=>({w:v,hd:i.BooleanNumber.FALSE}))},M=Et(s,I),p=[{id:me.id,params:I}],w=[{id:ae.id,params:M}];c&&p.push({id:B.id,params:{unitId:d,subUnitId:l,cellValue:c}});const y=r.onCommandExecute({id:Ee.id,params:e});return p.unshift(...(O=y.preRedos)!=null?O:[]),p.push(...(U=y.redos)!=null?U:[]),p.push(_e(a,R,S)),w.unshift(...(P=y.preUndos)!=null?P:[]),w.push(...(E=y.undos)!=null?E:[]),i.sequenceExecute(p,t).result?(n.pushUndoRedo({unitID:e.unitId,undoMutations:w.filter(Boolean),redoMutations:p.filter(Boolean)}),!0):!1}},Ho={type:i.CommandType.COMMAND,id:"sheet.command.insert-col-before",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=T(o);if(!r)return!1;const{worksheet:a,unitId:u,subUnitId:l}=r,{startColumn:d,endColumn:c}=n,m=0,h=a.getRowCount()-1,R={unitId:u,subUnitId:l,direction:i.Direction.LEFT,range:{startColumn:d,endColumn:c,startRow:m,endRow:h,rangeType:i.RANGE_TYPE.COLUMN},cellValue:Ne(a,m,h,d,c,!1,d-1)};return s.get(i.ICommandService).executeCommand(Ee.id,R)}},Bo={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=T(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,S={unitId:u,subUnitId:l,direction:i.Direction.RIGHT,range:{startColumn:c,endColumn:m,startRow:h,endRow:R},cellValue:Ne(a,h,R,c,m,!1,n.endColumn)};return s.get(i.ICommandService).executeCommand(Ee.id,S)}},jo={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=T(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,S=u.getRowCount()-1,C={unitId:l,subUnitId:d,direction:i.Direction.LEFT,range:{startColumn:m,endColumn:h,startRow:R,endRow:S,rangeType:i.RANGE_TYPE.COLUMN},cellValue:Ne(u,R,S,m,h,!1,m-1)};return s.get(i.ICommandService).executeCommand(Ee.id,C)}},Fo={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=T(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,S=u.getRowCount()-1,C={unitId:l,subUnitId:d,direction:i.Direction.RIGHT,range:{startColumn:m,endColumn:h,startRow:R,endRow:S},cellValue:Ne(u,R,S,m,h,!1,o.endColumn)};return s.get(i.ICommandService).executeCommand(Ee.id,C)}},Go={id:"sheet.command.insert-sheet",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(i.LocaleService),a=An(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=(v=e.index)!=null?v:d,h.id=m||i.Tools.generateRandomId(),h.name=(c==null?void 0:c.name)||l.generateNewSheetName(`${r.t("sheets.tabs.sheet")}`)):(h.id=i.Tools.generateRandomId(),h.name=l.generateNewSheetName(`${r.t("sheets.tabs.sheet")}`));const R={index:d,sheet:h,unitId:u},S=Ln(s,R);return t.syncExecuteCommand(ot.id,R)?(n.pushUndoRedo({unitID:u,undoMutations:[{id:Ye.id,params:S}],redoMutations:[{id:ot.id,params:R}]}),!0):!1}};function zo(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 De={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 Yo(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 Ae={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}};function $a(s,e){return e.getMergeData().some(t=>t.startRow<s&&s<=t.endRow)}function Ha(s,e){return e.getMergeData().some(t=>t.startColumn<s&&s<=t.endColumn)}const qo="sheet.command.move-rows",Nt={id:qo,type:i.CommandType.COMMAND,handler:(s,e)=>{var W,A;const t=s.get(g.SheetsSelectionsService),{fromRange:{startRow:n},toRange:{startRow:o},range:r}=e,a=r?[Jo(r)]:t.getCurrentSelections(),u=a==null?void 0:a.filter(L=>L.range.rangeType===i.RANGE_TYPE.ROW&&L.range.startRow<=n&&n<=L.range.endRow);if((u==null?void 0:u.length)!==1)return!1;const l=s.get(g.SheetInterceptorService),d=s.get(i.IUniverInstanceService),c=T(d,e);if(!c)return!1;const{workbook:m,worksheet:h}=c,R=m.getUnitId(),S=h.getSheetId(),C=s.get(i.ErrorService),v=s.get(i.LocaleService),I=u[0].range,M=u[0].primary,p=Ut(I,h,!1);if(!i.Rectangle.equals(I,p))return C.emit(v.t("sheets.info.partOfCell")),!1;if($a(o,h))return C.emit(v.t("sheets.info.acrossMergedCell")),!1;const w={...I,startRow:o,endRow:o+I.endRow-I.startRow},y={unitId:R,subUnitId:S,sourceRange:I,targetRange:w},b=zo(s,y),O=s.get(i.ICommandService),U=l.onCommandExecute({id:Nt.id,params:e}),P=[...(W=U.preRedos)!=null?W:[],{id:De.id,params:y}],E=[...(A=U.preUndos)!=null?A:[],{id:De.id,params:b}];if(M){const j=o-n<0,K=I.endRow-I.startRow+1,z=j?w:{...w,startRow:w.startRow-K,endRow:w.endRow-K},J={unitId:R,subUnitId:S,type:te.MOVE_END,selections:[{range:z,primary:ne(z,h),style:null}]},se={unitId:R,subUnitId:S,type:te.MOVE_END,selections:[{range:I,primary:M,style:null}]};P.push({id:q.id,params:J}),E.push({id:q.id,params:se})}return P.push(...U.redos),E.push(...U.undos),i.sequenceExecute(P,O).result?(s.get(i.IUndoRedoService).pushUndoRedo({unitID:R,undoMutations:E,redoMutations:P}),!0):!1}},Ko="sheet.command.move-cols",Dt={id:Ko,type:i.CommandType.COMMAND,handler:(s,e)=>{var W,A;const t=s.get(g.SheetsSelectionsService),{fromRange:{startColumn:n},toRange:{startColumn:o},range:r}=e,a=r?[Jo(r)]:t.getCurrentSelections(),u=a==null?void 0:a.filter(L=>L.range.rangeType===i.RANGE_TYPE.COLUMN&&L.range.startColumn<=n&&n<=L.range.endColumn);if((u==null?void 0:u.length)!==1)return!1;const l=s.get(g.SheetInterceptorService),d=s.get(i.IUniverInstanceService),c=T(d,e);if(!c)return!1;const{workbook:m,worksheet:h}=c,R=m.getUnitId(),S=h.getSheetId(),C=s.get(i.ErrorService),v=s.get(i.LocaleService),I=u[0].range,M=u[0].primary,p=Ut(I,h,!1);if(!i.Rectangle.equals(I,p))return C.emit(v.t("sheets.info.partOfCell")),!1;if(Ha(o,h))return C.emit(v.t("sheets.info.acrossMergedCell")),!1;const w={...I,startColumn:o,endColumn:o+I.endColumn-I.startColumn},y={unitId:R,subUnitId:S,sourceRange:I,targetRange:w},b=Yo(s,y),O=s.get(i.ICommandService),U=l.onCommandExecute({id:Dt.id,params:e}),P=[...(W=U.preRedos)!=null?W:[],{id:Ae.id,params:y}],E=[...(A=U.preUndos)!=null?A:[],{id:Ae.id,params:b}];if(M){const L=I.endColumn-I.startColumn+1,z=o-n<0?w:{...w,startColumn:w.startColumn-L,endColumn:w.endColumn-L},J={unitId:R,subUnitId:S,type:te.MOVE_END,selections:[{range:z,primary:ne(z,h),style:null}]},se={unitId:R,subUnitId:S,type:te.MOVE_END,selections:[{range:I,primary:M,style:null}]};P.push({id:q.id,params:J}),E.push({id:q.id,params:se})}return P.push(...U.redos),E.push(...U.undos),i.sequenceExecute(P,O).result&&s.get(i.IUndoRedoService).pushUndoRedo({unitID:R,undoMutations:E,redoMutations:P}),!0}};function Jo(s){return{range:s,primary:null,style:null}}const lt={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=T(r),u=s.get(g.SheetRangeThemeModel);if(!a)return!1;const l=new Oe(o,n);return u.registerRangeThemeStyle(t,l),!0}},dn={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=T(o),a=s.get(g.SheetRangeThemeModel);return r?(a.unregisterRangeThemeStyle(t,n),!0):!1}},Xo={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(!T(o))return!1;const l={unitId:t,themeName:n.getName(),rangeThemeStyleJson:n.toJson()},d={unitId:t,themeName:n.getName()};return r.syncExecuteCommand(lt.id,l)&&a.pushUndoRedo({unitID:t,undoMutations:[{id:dn.id,params:d}],redoMutations:[{id:lt.id,params:l}]}),!0}},Ss={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:Ss.id,params:e}),u=[...(c=a.preRedos)!=null?c:[],{id:Y.RemoveDefinedNameMutation.id,params:r},...a.redos],l=[...(m=a.preUndos)!=null?m:[],{id:Y.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}},Cs="sheet.command.remove-row",fs={type:i.CommandType.COMMAND,id:"sheet.command.remove-row-by-range",handler:(s,e)=>{var v,I,M;if(!e)return!1;const t=s.get(i.IUniverInstanceService),n=T(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=Tt([u],s,l,d).reverse(),m=[],h=[];c.forEach(p=>{const w=[],y=[],b={unitId:l,subUnitId:d,range:p},O=na(b,r),U=r.getCellMatrix().getSlice(p.startRow,p.endRow,0,r.getColumnCount()-1),P={unitId:l,subUnitId:d,cellValue:U.getMatrix()};y.push({id:Ie.id,params:b}),w.push({id:ve.id,params:O}),w.push({id:B.id,params:P}),h.push(...y),m.unshift(...w)});const R=a.onCommandExecute({id:Cs,params:{range:u}}),S=s.get(i.ICommandService);return i.sequenceExecute([...(v=R.preRedos)!=null?v:[],...h,...R.redos,_e(u,o,r)],S).result?(s.get(i.IUndoRedoService).pushUndoRedo({unitID:l,undoMutations:[...(I=R.preUndos)!=null?I:[],...m,...R.undos],redoMutations:[...(M=R.preRedos)!=null?M:[],...h,...R.redos]}),!0):!1}},At={type:i.CommandType.COMMAND,id:Cs,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=T(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:At.id,params:{range:r}})?o.syncExecuteCommand(fs.id,{range:r,unitId:c,subUnitId:d}):!1}},vs="sheet.command.remove-col",Is={type:i.CommandType.COMMAND,id:"sheet.command.remove-col-by-range",handler:(s,e)=>{var I,M,p;if(!e)return!1;const t=s.get(i.IUniverInstanceService),n=T(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=sa(s,c),h=r.getCellMatrix().getSlice(0,r.getRowCount()-1,u.startColumn,u.endColumn),R={unitId:l,subUnitId:d,cellValue:h.getMatrix()},S=a.onCommandExecute({id:vs,params:{range:u}}),C=s.get(i.ICommandService);return i.sequenceExecute([...(I=S.preRedos)!=null?I:[],{id:ae.id,params:c},...S.redos,_e(u,o,r)],C).result?(s.get(i.IUndoRedoService).pushUndoRedo({unitID:l,undoMutations:[...(M=S.preUndos)!=null?M:[],{id:me.id,params:m},{id:B.id,params:R},...S.undos],redoMutations:[...(p=S.preRedos)!=null?p:[],{id:ae.id,params:c},...S.redos]}),!0):!1}},Wt={type:i.CommandType.COMMAND,id:vs,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=T(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:Wt.id,params:{range:r}})?o.syncExecuteCommand(Is.id,{range:r,unitId:c,subUnitId:d}):!1}},cn={id:"sheet.command.remove-sheet",type:i.CommandType.COMMAND,handler:(s,e)=>{var I,M;const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),o=s.get(i.IUniverInstanceService),r=s.get(g.SheetInterceptorService),a=T(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=Io(s,m),R=r.onCommandExecute({id:cn.id,params:{unitId:u,subUnitId:l}}),S=[...(I=R.preRedos)!=null?I:[],{id:Ye.id,params:m},...R.redos],C=[...(M=R.preUndos)!=null?M:[],{id:ot.id,params:h},...R.undos];return i.sequenceExecute(S,t).result?(n.pushUndoRedo({unitID:u,undoMutations:C,redoMutations:S}),!0):!1}},Re=(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)}},F={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}},oe=(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}},Zo={type:i.CommandType.COMMAND,id:"sheet.command.remove-worksheet-merge",handler:(s,e)=>{var k;const t=s.get(g.SheetsSelectionsService),n=s.get(i.ICommandService),o=s.get(i.IUndoRedoService),r=s.get(i.IUniverInstanceService),a=(e==null?void 0:e.ranges)||((k=t.getCurrentSelections())==null?void 0:k.map(W=>W.range));if(!(a!=null&&a.length))return!1;const u=T(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(A=>i.Rectangle.intersects(A,W)));if(!R.length)return!1;const S=oe(s,m),C=t.getCurrentSelections();if(!(C!=null&&C.length))return!1;const v=i.Tools.deepClone(C),I=i.Tools.deepClone(C),M=I[I.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=Ba(c,R),b={unitId:d,subUnitId:l,cellValue:y.redoParams.getMatrix()},O={unitId:d,subUnitId:l,cellValue:y.undoParams.getMatrix()},U=[{id:G.id,params:S},{id:B.id,params:b},{id:q.id,params:{selections:I}}],P=[{id:F.id,params:S},{id:B.id,params:O},{id:q.id,params:{selections:v}}];return i.sequenceExecute(U,n)?(o.pushUndoRedo({unitID:d,undoMutations:P,redoMutations:U}),!0):!1}};function Ba(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}}var ja=Object.getOwnPropertyDescriptor,Fa=(s,e,t,n)=>{for(var o=n>1?void 0:n?ja(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},Ga=(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=Fa([Ga(0,i.Inject(i.Injector))],g.SheetSkeletonService);const Qo=s=>{const{order:e}=s,t={};return Object.keys(e).forEach(n=>{t[e[Number(n)]]=Number(n)}),{...s,order:t}},Vt={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],S=i.Tools.deepClone(l.getCellRaw(R,h));d.setValue(m,h,S)}});const c=l.getCellMatrix();return d.forValue((m,h,R)=>{c.setValue(m,h,R)}),!0}};function ps(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 za=1e4;function Lt(s,e){if(!e)return{suitableRanges:s,remainingRanges:[]};const t=e.worksheet.getColumnCount(),n=Math.ceil(za/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 xo="sheet.command.reorder-range",mn={id:xo,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:Vt.id,params:{unitId:n,subUnitId:t,order:r,range:o}},l={id:Vt.id,params:Qo(u.params)},d=s.get(g.SheetInterceptorService),c=d.onCommandExecute({id:mn.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:S,remainingRanges:C}=Lt([o],s.get(g.SheetSkeletonService).getSkeleton(n,t)),{undos:v,redos:I}=d.generateMutationsOfAutoHeight({unitId:n,subUnitId:t,ranges:[o],autoHeightRanges:S,lazyAutoHeightRanges:C}),M=d.afterCommandExecute({id:mn.id,params:e});return R.result?(i.sequenceExecute([...M.redos,...I],a),s.get(i.IUndoRedoService).pushUndoRedo({unitID:n,undoMutations:[...h,...M.undos,...v],redoMutations:[...m,...M.redos,...I]}),!0):!1}};class Xe{constructor(){f(this,"_borderInfo",{type:i.BorderType.ALL,color:"#000000",style:i.BorderStyleTypes.THIN,activeBorderType:!1});f(this,"_borderInfo$",new V.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 hn(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 ws=(s,e,t,n)=>{const{mr:o,worksheet:r}=s;e.startRow<0||e.startColumn<0||hn(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}})}})},Ya=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 qa(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,S=r.indexOf("tlmr")>-1,C=r.indexOf("bltr")>-1,v=r.indexOf("mltr")>-1,I=r.indexOf("bctr")>-1,M=t[0],{topRangeOut:p,leftRangeOut:w,bottomRangeOut:y,rightRangeOut:b,topRange:O,leftRange:U,bottomRange:P,rightRange:E}=Ya(M),k=new i.ObjectMatrix,{worksheet:W,unitId:A,subUnitId:L}=e;return{worksheet:W,unitId:A,subUnitId:L,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:S,bl_tr:C,ml_tr:v,bc_tr:I,topRangeOut:p,leftRangeOut:w,bottomRangeOut:y,rightRangeOut:b,topRange:O,leftRange:U,bottomRange:P,rightRange:E,range:M,mr:k,borderStyle:{s:n,cl:{rgb:o}}}}const Ka=s=>{const{range:e,mr:t,borderStyle:n,vertical:o,horizontal:r,worksheet:a}=s;o&&hn(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&&hn(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 Ja(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)=>{ws(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 Xa=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,S=(C,v,I)=>{ws(s,C,v,I)};e&&(S(m,{b:null}),S(u,{t:i.Tools.deepClone(r)},!0)),o&&(S(c,{t:null}),S(a,{b:i.Tools.deepClone(r)},!0)),t&&(S(h,{r:null}),S(l,{l:i.Tools.deepClone(r)},!0)),n&&(S(R,{l:null}),S(d,{r:i.Tools.deepClone(r)},!0))},Za=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:S,bc_tr:C,topRange:v,bottomRange:I,leftRange:M,rightRange:p,topRangeOut:w,bottomRangeOut:y,leftRangeOut:b,rightRangeOut:O}=s,U=(P,E,k)=>{ws(s,P,E,k)};!o&&!r&&!a&&!u&&!l&&!d&&!c&&!m&&!h&&!R&&!S&&!C&&(hn(e,(P,E)=>{var W,A,L,j,K,z,J,se;const k=t.getMergedCell(P,E);if(k){if(k.endColumn!==e.endColumn){const H=(W=n.getValue(k.startRow,k.startColumn))==null?void 0:W.s;n.setValue(P,E,{s:{bd:H!=null&&H.bd?Object.assign(H.bd,{r:null}):{r:null}}})}if(k.startColumn!==e.startColumn){const H=(A=n.getValue(k.startRow,k.startColumn))==null?void 0:A.s;n.setValue(P,E,{s:{bd:H!=null&&H.bd?Object.assign(H.bd,{l:null}):{l:null}}})}if(k.endRow!==e.endRow){const H=(L=n.getValue(k.startRow,k.startColumn))==null?void 0:L.s;n.setValue(P,E,{s:{bd:H!=null&&H.bd?Object.assign(H.bd,{b:null}):{b:null}}})}if(k.startRow!==e.startRow){const H=(j=n.getValue(k.startRow,k.startColumn))==null?void 0:j.s;n.setValue(P,E,{s:{bd:H!=null&&H.bd?Object.assign(H.bd,{t:null}):{t:null}}})}}else{if(E!==e.endColumn){const H=(K=n.getValue(P,E))==null?void 0:K.s;n.setValue(P,E,{s:{bd:H!=null&&H.bd?Object.assign(H.bd,{r:null}):{r:null}}})}if(E!==e.startColumn){const H=(z=n.getValue(P,E))==null?void 0:z.s;n.setValue(P,E,{s:{bd:H!=null&&H.bd?Object.assign(H.bd,{l:null}):{l:null}}})}if(P!==e.endRow){const H=(J=n.getValue(P,E))==null?void 0:J.s;n.setValue(P,E,{s:{bd:H!=null&&H.bd?Object.assign(H.bd,{b:null}):{b:null}}})}if(P!==e.startRow){const H=(se=n.getValue(P,E))==null?void 0:se.s;n.setValue(P,E,{s:{bd:H!=null&&H.bd?Object.assign(H.bd,{t:null}):{t:null}}})}}}),U(w,{b:null}),U(v,{t:null},!0),U(y,{t:null}),U(I,{b:null},!0),U(b,{r:null}),U(M,{l:null},!0),U(O,{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))},dt={id:"sheet.command.set-border",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(g.SheetsSelectionsService),a=s.get(Xe),u=T(o,e);if(!u)return!1;const l=(e==null?void 0:e.ranges)||((I=r.getCurrentSelections())==null?void 0:I.map(M=>M.range));if(!(l!=null&&l.length))return!1;const{activeBorderType:d}=a.getBorderInfo();if(!d)return!1;const c=qa(a,u,l);Ka(c),Xa(c),Ja(c),Za(c);const{unitId:m,subUnitId:h,mr:R}=c,S={unitId:m,subUnitId:h,cellValue:R.getData()},C=ue(s,S);return t.syncExecuteCommand(B.id,S)?(n.pushUndoRedo({unitID:m,undoMutations:[{id:B.id,params:C}],redoMutations:[{id:B.id,params:S}]}),!0):!1}},er={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(Xe).setType(e.value),t.syncExecuteCommand(dt.id)}},tr={id:"sheet.command.set-border-style",type:i.CommandType.COMMAND,handler:(s,e)=>{const t=s.get(i.ICommandService);return s.get(Xe).setStyle(e.value),t.syncExecuteCommand(dt.id)}},nr={id:"sheet.command.set-border-color",type:i.CommandType.COMMAND,handler:(s,e)=>{const t=s.get(i.ICommandService);return s.get(Xe).setColor(e.value),t.syncExecuteCommand(dt.id)}},sr={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(Xe);return c.setType(a),u&&c.setColor(u),c.setStyle(l),d.syncExecuteCommand(dt.id,{unitId:t,subUnitId:n,ranges:r})}};function Qa(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 xa(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 or=(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]=xa(d,l)}return{unitId:t,subUnitId:n,columnData:r}},ct={id:"sheet.mutation.set-col-data",type:i.CommandType.MUTATION,handler:(s,e)=>{const{columnData:t}=e,n=s.get(i.IUniverInstanceService),o=T(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}},rr={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=T(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=or(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}},eu=(s,e)=>{if(s.get(i.IUniverInstanceService).getUniverSheetInstance(e.unitId)==null)throw new Error("universheet is null error!");return{unitId:e.unitId,subUnitId:e.subUnitId,ranges:e.ranges}},mt={id:"sheet.mutation.set-col-hidden",type:i.CommandType.MUTATION,handler:(s,e)=>{const n=s.get(i.IUniverInstanceService).getUniverSheetInstance(e.unitId);if(!n)return!1;const o=n.getSheetBySheetId(e.subUnitId).getColumnManager();for(let r=0;r<e.ranges.length;r++){const a=e.ranges[r];for(let u=a.startColumn;u<a.endColumn+1;u++){const l=o.getColumnOrCreate(u);l!=null&&(l.hd=i.BooleanNumber.TRUE)}}return!0}},tu=(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}},ht={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}},$t={type:i.CommandType.COMMAND,id:"sheet.command.set-col-visible-on-cols",handler:(s,e)=>{var I,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=T(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:ne(p,d),style:null}))},h=tu(s,c),R={unitId:t,subUnitId:n,selections:ir(o).map(p=>({range:p,primary:ne(p,d),style:null}))},S=i.sequenceExecute([{id:ht.id,params:c},{id:q.id,params:m}],a),C=r.onCommandExecute({id:$t.id,params:e}),v=i.sequenceExecute([...C.redos],a);return S.result&&v.result&&s.get(i.IUndoRedoService).pushUndoRedo({unitID:t,undoMutations:[{id:mt.id,params:h},{id:q.id,params:R},...(I=C.undos)!=null?I:[]],redoMutations:[...(M=C.preRedos)!=null?M:[],{id:ht.id,params:c},{id:q.id,params:m},...C.redos]}),!0}},Ms={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=T(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($t.id,{unitId:a,subUnitId:u,ranges:l})}},ys={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=T(o,e);if(!u)return!1;const{worksheet:l,unitId:d,subUnitId:c}=u;a=nu(u.worksheet,a);const m={unitId:d,subUnitId:c,ranges:a},h={unitId:d,subUnitId:c,selections:ir(a).map(b=>({range:b,primary:ne(b,l),style:null}))},R=eu(s,m),S={unitId:d,subUnitId:c,reveal:!0,selections:a.map(b=>({range:b,primary:ne(b,l),style:null}))},C=i.sequenceExecute([{id:mt.id,params:m},{id:q.id,params:h}],r),v=n.onCommandExecute({id:ys.id,params:m}),I=i.sequenceExecute([...v.redos],r);return C.result&&I.result?(s.get(i.IUndoRedoService).pushUndoRedo({unitID:d,undoMutations:[{id:ht.id,params:R},{id:q.id,params:S},...(w=v.undos)!=null?w:[]],redoMutations:[...(y=v.preRedos)!=null?y:[],{id:mt.id,params:m},{id:q.id,params:h},...v.redos]}),!0):!1}};function nu(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 ir(s){return su(s).map(t=>{const n=t.startColumn===0?t.endColumn+1:t.startColumn-1;return{...t,startColumn:n,endColumn:n}})}function su(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 _s={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=Y.SetDefinedNameMutationFactory(s,e),u=o.onCommandExecute({id:_s.id,params:e}),l=[...(m=u.preRedos)!=null?m:[],{id:Y.RemoveDefinedNameMutation.id,params:a},{id:Y.SetDefinedNameMutation.id,params:r},...u.redos],d=[...(h=u.preUndos)!=null?h:[],{id:Y.RemoveDefinedNameMutation.id,params:r},{id:Y.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}},He={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}},ar={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=T(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},S=bs(s,R);return t.syncExecuteCommand(He.id,R)?(n.pushUndoRedo({unitID:a,undoMutations:[{id:He.id,params:S}],redoMutations:[{id:He.id,params:R}]}),!0):!1}},ur={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=T(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(He.id,l)&&o.pushUndoRedo({unitID:a,undoMutations:[{id:He.id,params:d}],redoMutations:[{id:He.id,params:l}]}),!0}},gt={id:"sheet.mutation.set-gridlines-color",type:i.CommandType.MUTATION,handler:(s,e)=>{const t=T(s.get(i.IUniverInstanceService),e);if(!t)return!1;const{worksheet:n}=t,o=n.getConfig();return o.gridlinesColor=e.color,!0}},lr={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=T(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(gt.id,c)?(n.pushUndoRedo({unitID:l,undoMutations:[{id:gt.id,params:m}],redoMutations:[{id:gt.id,params:c}]}),!0):!1}},x={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}},ou=(s,e)=>{const{unitId:t,subUnitId:n,ruleId:o}=e,a=s.get(X).getRule(t,n,o);return a?{id:x.id,params:{...e,rule:a}}:null},Ze={id:"sheet.mutation.set-worksheet-protection",type:i.CommandType.MUTATION,handler:(s,e)=>{const{unitId:t,subUnitId:n,rule:o}=e;return s.get(ye).setRule(t,n,o),!0}},dr={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===N.Worksheet?(d.push({id:Ze.id,params:{unitId:u,subUnitId:l,rule:r}}),c.push({id:Ze.id,params:{unitId:u,subUnitId:l,rule:a}})):(d.push({id:x.id,params:{unitId:u,subUnitId:l,rule:r,ruleId:r.id}}),c.push({id:x.id,params:{unitId:u,subUnitId:l,ruleId:a.id,rule:a}})):(a&&(a.unitType===N.Worksheet?(d.push({id:ze.id,params:{unitId:u,subUnitId:l}}),c.push({id:Le.id,params:{unitId:u,rule:a,subUnitId:a.subUnitId}})):a.unitType===N.SelectRange&&(d.push({id:Me.id,params:{unitId:u,subUnitId:l,ruleIds:[a.id]}}),c.push({id:ce.id,params:{unitId:u,subUnitId:l,rules:[a]}}))),r.unitType===N.Worksheet?(d.push({id:Le.id,params:{unitId:u,rule:r,subUnitId:r.subUnitId}}),c.unshift({id:ze.id,params:{unitId:u,subUnitId:l}})):r.unitType===N.SelectRange&&(r.id=o.createRuleId(u,l),d.push({id:ce.id,params:{unitId:u,subUnitId:l,rules:[r]}}),c.unshift({id:Me.id,params:{unitId:u,subUnitId:l,ruleIds:[r.id]}}))),i.sequenceExecute(d,t)&&n.pushUndoRedo({unitID:u,undoMutations:c,redoMutations:d}),!0}},cr=(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]=Qa(d,l)}return{unitId:t,subUnitId:n,rowData:r}},Rt={id:"sheet.mutation.set-row-data",type:i.CommandType.MUTATION,handler:(s,e)=>{const{rowData:t}=e,n=s.get(i.IUniverInstanceService),o=T(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}},mr={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=T(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=cr(c,d);return t.syncExecuteCommand(Rt.id,c)?(n.pushUndoRedo({unitID:u,undoMutations:[{id:Rt.id,params:m}],redoMutations:[{id:Rt.id,params:c}]}),!0):!1}},ru=(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}},St={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}},iu=(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}},Ct={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}},Ht={type:i.CommandType.COMMAND,id:"sheet.command.set-specific-rows-visible",handler:(s,e)=>{var I,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=T(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:ne(w,d),style:null}))},h=ru(s,c),R={unitId:t,subUnitId:n,selections:hr(o).map(w=>({range:w,primary:ne(w,d),style:null}))},S=i.sequenceExecute([{id:St.id,params:c},{id:q.id,params:m}],r),C=u.onCommandExecute({id:Ht.id,params:e}),v=i.sequenceExecute([...C.redos],r);return S.result&&v.result&&a.pushUndoRedo({unitID:t,undoMutations:[...(I=C.preUndos)!=null?I:[],{id:Ct.id,params:h},{id:q.id,params:R},...(M=C.undos)!=null?M:[]],redoMutations:[...(p=C.preRedos)!=null?p:[],{id:St.id,params:c},{id:q.id,params:m},...C.redos]}),!0}},Es={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=T(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(Ht.id,{unitId:u,subUnitId:l,ranges:d})}},Ts={type:i.CommandType.COMMAND,id:"sheet.command.set-rows-hidden",handler:(s,e)=>{var M,p,w,y,b,O;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=T(r,e);if(!l)return!1;u=au(l.worksheet,u);const{unitId:d,subUnitId:c,worksheet:m}=l,h={unitId:d,subUnitId:c,ranges:u},R={unitId:d,subUnitId:c,selections:hr(u).map(U=>({range:U,primary:ne(U,m),style:null}))},S=iu(s,h),C={unitId:d,subUnitId:c,reveal:!0,selections:u.map(U=>({range:U,primary:ne(U,m),style:null}))},v=a.onCommandExecute({id:Ts.id,params:h});return i.sequenceExecute([...(w=v.preRedos)!=null?w:[],{id:Ct.id,params:h},{id:q.id,params:R},...v.redos],n).result&&o.pushUndoRedo({unitID:d,undoMutations:[...(y=v.preUndos)!=null?y:[],{id:St.id,params:S},{id:q.id,params:C},...(b=v.undos)!=null?b:[]],redoMutations:[...(O=v.preRedos)!=null?O:[],{id:Ct.id,params:h},{id:q.id,params:R},...v.redos]}),!0}};function au(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 hr(s){return uu(s).map(t=>{const n=t.startRow===0?t.endRow+1:t.startRow-1;return{...t,startRow:n,endRow:n}})}function uu(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 lu=["ff","fs","tr","tb"],ee={type:i.CommandType.COMMAND,id:"sheet.command.set-style",handler:(s,e)=>{var P;const t=s.get(i.IUniverInstanceService),n=T(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]:(P=m.getCurrentSelections())==null?void 0:P.map(E=>E.range);if(!(h!=null&&h.length))return!1;const R=new i.ObjectMatrix,S=Ua(a);if(i.Tools.isArray(l.value))for(let E=0;E<h.length;E++)S.forOperableEach(h[E],(k,W,A)=>{R.setValue(k,W,{s:{[l.type]:l.value[k-A.startRow][W-A.startColumn]}})});else for(let E=0;E<h.length;E++){const k={s:{[l.type]:l.value}};S.forOperableEach(h[E],(W,A)=>R.setValue(W,A,k))}const C={subUnitId:r,unitId:o,cellValue:R.getMatrix()},v=s.get(g.SheetSkeletonService).getSkeleton(o,r),I=ue(s,C),M=d.syncExecuteCommand(B.id,C),p=s.get(g.SheetInterceptorService);let w=[],y=[];if(lu.includes(e==null?void 0:e.style.type)){const{suitableRanges:E,remainingRanges:k}=Lt(h,v),W=ps(E,a),{undos:A,redos:L}=p.generateMutationsOfAutoHeight({unitId:o,subUnitId:r,ranges:E,autoHeightRanges:E,lazyAutoHeightRanges:k,cellHeights:W});w=A,y=L}const{undos:b,redos:O}=p.onCommandExecute({id:ee.id,params:e}),U=i.sequenceExecute([...O,...y],d);return M&&U.result?(c.pushUndoRedo({unitID:C.unitId,undoMutations:[{id:B.id,params:I},...b,...w],redoMutations:[{id:B.id,params:C},...O,...y]}),!0):!1}},du={type:i.CommandType.COMMAND,id:"sheet.command.set-bold",handler:s=>{const e=s.get(g.SheetsSelectionsService).getCurrentLastSelection();if(!e)return!1;const t=T(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)}},cu={type:i.CommandType.COMMAND,id:"sheet.command.set-italic",handler:s=>{const e=s.get(g.SheetsSelectionsService).getCurrentLastSelection();if(!e)return!1;const t=T(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)}},mu={type:i.CommandType.COMMAND,id:"sheet.command.set-underline",handler:s=>{const e=s.get(g.SheetsSelectionsService).getCurrentLastSelection();if(!e)return!1;const t=T(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)}},hu={type:i.CommandType.COMMAND,id:"sheet.command.set-stroke",handler:s=>{const e=s.get(g.SheetsSelectionsService).getCurrentLastSelection();if(!e)return!1;const t=T(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)}},gu={type:i.CommandType.COMMAND,id:"sheet.command.set-overline",handler:s=>{const e=s.get(g.SheetsSelectionsService).getCurrentLastSelection();if(!e)return!1;const t=T(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)}},Ru={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)}},Su={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)}},gr={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)}},Rr={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)}},Sr={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)}},Cr={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)}},fr={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)}},vr={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)}},Ir={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)}},pr={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)}},Cu=(s,e)=>{const r=s.get(i.IUniverInstanceService).getUniverSheetInstance(e.unitId).getSheetBySheetId(e.subUnitId).getConfig().tabColor;return{...i.Tools.deepClone(e),color:r}},Bt={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}},wr={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=T(s.get(i.IUniverInstanceService));if(!o)return!1;const{unitId:r,subUnitId:a}=o,u={color:e.value,unitId:r,subUnitId:a},l=Cu(s,u);return t.syncExecuteCommand(Bt.id,u)?(n.pushUndoRedo({unitID:r,undoMutations:[{id:Bt.id,params:l}],redoMutations:[{id:Bt.id,params:u}]}),!0):!1}},Us={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}},Ps={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(!An(s.get(i.IUniverInstanceService),e))return!1;const r=n.onCommandExecute({id:Ps.id,params:e}),a={name:e.name,unitId:e.unitId},u=[...(l=r.preRedos)!=null?l:[],{id:Us.id,params:a},...r.redos];return i.sequenceExecute(u,t).result}},ft={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}},fu=4,ks={type:i.CommandType.COMMAND,id:"sheet.command.set-worksheet-activate",handler:(s,e,t)=>{const n=s.get(i.ICommandService),o=T(s.get(i.IUniverInstanceService),e);if(!o)return!1;const{unitId:r,subUnitId:a}=o;return new Promise(u=>{setTimeout(()=>{const l=n.syncExecuteCommand(ft.id,{unitId:r,subUnitId:a},t);u(l)},fu)})}},Os=(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}},We={id:"sheet.mutation.set-worksheet-col-width",type:i.CommandType.MUTATION,handler:(s,e)=>{const t=s.get(i.IUniverInstanceService),n=T(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}},jt={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=T(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,S=n.length===1&&n[0].range.rangeType===i.RANGE_TYPE.ALL,C=n.filter(j=>j.range.rangeType===i.RANGE_TYPE.COLUMN),v=S?i.RANGE_TYPE.ALL:C.some(({range:j})=>{const{startColumn:K,endColumn:z}=j;return K<=c&&c<=z})?i.RANGE_TYPE.COLUMN:i.RANGE_TYPE.NORMAL;let I;if(v===i.RANGE_TYPE.ALL){const j=u.getRowCount(),K=new Array(u.getColumnCount()).fill(void 0).map((z,J)=>({startRow:0,endRow:j-1,startColumn:J,endColumn:J}));I={subUnitId:d,unitId:l,colWidth:R,ranges:K}}else v===i.RANGE_TYPE.COLUMN?I={subUnitId:d,unitId:l,ranges:C.map(j=>i.Rectangle.clone(j.range)),colWidth:R}:I={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}=Lt(I.ranges,M);ps(p,u);const y=s.get(g.SheetInterceptorService),{undos:b,redos:O}=y.onCommandExecute({id:jt.id,params:I}),U=Os(I,u),P=o.syncExecuteCommand(We.id,I),{undos:E,redos:k}=y.generateMutationsOfAutoHeight({unitId:l,subUnitId:d,ranges:p,autoHeightRanges:p,lazyAutoHeightRanges:w}),{undos:W,redos:A}=s.get(g.SheetInterceptorService).afterCommandExecute({id:jt.id,params:I}),L=i.sequenceExecute([...O,...A,...k],o);return P&&L.result&&r.pushUndoRedo({unitID:l,undoMutations:[{id:We.id,params:U},...b,...W,...E],redoMutations:[{id:We.id,params:I},...O,...A,...k]}),!0}},gn={type:i.CommandType.COMMAND,id:"sheet.command.set-worksheet-col-width",handler:(s,e)=>{var y,b,O,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(P=>P.range);if(!(a!=null&&a.length))return!1;const u=T(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:S}=Lt(h.ranges,m);ps(R,c);const C=Os(h,c),v=n.syncExecuteCommand(We.id,h),{undos:I,redos:M}=r.generateMutationsOfAutoHeight({unitId:d,subUnitId:l,ranges:R,autoHeightRanges:R,lazyAutoHeightRanges:S}),p=r.onCommandExecute({id:gn.id,params:h}),w=i.sequenceExecute([...p.redos,...M],n);return v&&w.result?(o.pushUndoRedo({unitID:d,undoMutations:[...(O=p.preUndos)!=null?O:[],{id:We.id,params:C},...p.undos,...I],redoMutations:[...(U=p.preRedos)!=null?U:[],{id:We.id,params:h},...p.redos,...M]}),!0):!1}};i.CommandType.COMMAND;const Mr=(s,e)=>{const t=fe(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()}},vt={id:"sheet.mutation.set-worksheet-column-count",type:i.CommandType.MUTATION,handler:(s,e)=>{const t=s.get(i.IUniverInstanceService),n=fe(t,e);return n?(n.worksheet.setColumnCount(e.columnCount),!0):!1}},yr={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(!T(u,e))return!1;const d={unitId:t,subUnitId:n,columnCount:o},c=Mr(s,d);return r.syncExecuteCommand(vt.id,d)?(a.pushUndoRedo({unitID:t,undoMutations:[{id:vt.id,params:c}],redoMutations:[{id:vt.id,params:d}]}),!0):!1}},It={id:"sheet.mutation.set-worksheet-default-style",type:i.CommandType.MUTATION,handler:(s,e)=>{const{defaultStyle:t}=e,n=s.get(i.IUniverInstanceService),o=T(n);if(!o)return!1;const{worksheet:r}=o;return r?(r.setDefaultCellStyle(t),!0):!1}},_r=(s,e)=>{const t=fe(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()}},br={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=_r(s,e);return t.syncExecuteCommand(It.id,e)?(n.pushUndoRedo({unitID:o,undoMutations:[{id:It.id,params:r}],redoMutations:[{id:It.id,params:e}]}),!0):!1}},Er=(s,e)=>{const t=fe(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()}},Be={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}},Tr={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=T(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=Er(s,h);return u.getSheets().filter(I=>I.getConfig().hidden===i.BooleanNumber.FALSE).length===1?(o.emit(r.t("sheets.info.hideSheet")),!1):t.syncExecuteCommand(Be.id,h)?(n.pushUndoRedo({unitID:d,undoMutations:[{id:Be.id,params:R}],redoMutations:[{id:Be.id,params:h}]}),!0):!1}},vu=(s,e)=>{const t=fe(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()}},Ft={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}},Rn={type:i.CommandType.COMMAND,id:"sheet.command.set-worksheet-name",handler:(s,e)=>{var S,C;const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),o=s.get(g.SheetInterceptorService),r=T(s.get(i.IUniverInstanceService),e);if(!r)return!1;const{unitId:a,subUnitId:u}=r,l={subUnitId:u,name:e.name,unitId:a},d=vu(s,l),c=o.onCommandExecute({id:Rn.id,params:e}),m=[...(S=c.preRedos)!=null?S:[],{id:Ft.id,params:l},...c.redos],h=[...(C=c.preUndos)!=null?C:[],{id:Ft.id,params:d},...c.undos];return i.sequenceExecute(m,t).result?(n.pushUndoRedo({unitID:a,undoMutations:h,redoMutations:m}),!0):!1}},Iu=(s,e)=>({...i.Tools.deepClone(e),toOrder:e.fromOrder,fromOrder:e.toOrder}),Gt={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}},Ns={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=T(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=Iu(s,d);return t.syncExecuteCommand(Gt.id,d)?(n.pushUndoRedo({unitID:a,undoMutations:[{id:Gt.id,params:c}],redoMutations:[{id:Gt.id,params:d}]}),!0):!1}};class pt{constructor(){f(this,"_model",new Map);f(this,"_pointChange",new V.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 Ds{constructor(e,t,n){f(this,"type",N.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=`${N.SelectRange}.${_.Delete}.${n}`}}class As{constructor(e,t,n){f(this,"type",N.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=`${N.SelectRange}.${_.ManageCollaborator}.${n}`}}const re=()=>[on,he,As,Ds],je=[_.Edit,_.View,_.ManageCollaborator,_.Delete],pu=(s="unitId",e="subUnitId",t="permissionId")=>re().reduce((n,o)=>{const r=new o(s,e,t);return n[r.subType]=r.value,n},{}),wt=()=>[le,qn,Hn,Xn,Bn,Yn,an,Fn,Gn,ln,rn,zn,Jn,un,bo,Zn,Kn,jn],Ur=[_.Edit,_.Print,_.Comment,_.View,_.Copy,_.Export,_.ManageCollaborator,_.CreateSheet,_.DeleteSheet,_.RenameSheet,_.HideSheet,_.Duplicate,_.Share,_.MoveSheet,_.CopySheet,_.RecoverHistory,_.ViewHistory,_.CreatePermissionObject],ie=()=>[ge,kt,as,es],Se=()=>[Qn,xn,ts,ns,ss,os,is,rs,us,ls,Pt,rt,it,ds],Sn=[_.Copy,_.DeleteColumn,_.DeleteRow,_.EditExtraObject,_.Filter,_.InsertColumn,_.InsertRow,_.InsertHyperlink,_.PivotTable,_.SetCellStyle,_.SetCellValue,_.SetColumnStyle,_.SetRowStyle,_.Sort];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},Fe=(s,e)=>(t,n)=>e(t,n,s);const yu="SHEET_WORKSHEET_PROTECTION_PLUGIN",_u="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();[...ie(),...Se()].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=>{[...re()].forEach(d=>{const c=new d(n,a,l.permissionId);this._permissionService.deletePermissionPoint(c.id)})}),[...ie(),...Se()].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(bt.takeUntil(this.dispose$)).subscribe(e),this._univerInstanceService.getTypeOfUnitDisposed$(i.UniverInstanceType.UNIVER_SHEET).pipe(bt.takeUntil(this.dispose$)).subscribe(t=>{t.getSheets().forEach(n=>{const o=t.getUnitId(),r=n.getSheetId();ie().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":{ie().forEach(t=>{const n=new t(e.unitId,e.subUnitId);this._permissionService.updatePermissionPoint(n.id,!0)});break}case"set":{ie().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:yu,businesses:[sn.UNIVER_SHEET],onLoad:(n,o)=>{this._worksheetProtectionRuleModel.fromObject(o),Object.keys(o).forEach(r=>{ie().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();[...ie(),...Se()].forEach(u=>{const l=new u(n,a);this._permissionService.deletePermissionPoint(l.id)})}),wt().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:_u,businesses:[sn.UNIVER_SHEET],onLoad:(n,o)=>{this._worksheetProtectionPointRuleModel.fromObject(o),Object.keys(o).forEach(r=>{Se().forEach(a=>{const u=new a(n,r);this._permissionService.addPermissionPoint(u)})})},onUnLoad:n=>{this._worksheetProtectionPointRuleModel.deleteUnitModel(n)}}))}},g.WorksheetPermissionService=Mu([Fe(0,i.Inject(i.IPermissionService)),Fe(1,i.Inject(i.IUniverInstanceService)),Fe(2,i.Inject(i.Injector)),Fe(3,i.Inject(ye)),Fe(4,i.Inject(pt)),Fe(5,i.Inject(i.IResourceManagerService)),Fe(6,i.Inject(X)),Fe(7,i.Inject(i.ILogService))],g.WorksheetPermissionService);const Cn={id:"sheet.mutation.set-worksheet-permission-points",type:i.CommandType.MUTATION,handler:(s,e)=>{const{rule:t}=e;return s.get(pt).addRule(t),!0}},Pr={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(Cn.id,{rule:n,unitId:n.unitId,subUnitId:n.subUnitId}),!0}},kr={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(Ze.id,{unitId:u,subUnitId:l,newRule:d})){const m=[{id:Ze.id,params:{unitId:u,subUnitId:l,newRule:d}}],h=[{id:Ze.id,params:{unitId:u,subUnitId:l,rule:a}}];n.pushUndoRedo({unitID:u,redoMutations:m,undoMutations:h})}return!0}},Or=(s,e)=>{const t=fe(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()}},Mt={id:"sheet.mutation.set-worksheet-row-count",type:i.CommandType.MUTATION,handler:(s,e)=>{const t=s.get(i.IUniverInstanceService),n=fe(t,e);return n?(n.worksheet.setRowCount(e.rowCount),!0):!1}},Nr={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(!T(u,e))return!1;const d={unitId:t,subUnitId:n,rowCount:o},c=Or(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}},Dr=(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}},Ws=(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}},bu=(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}},Ve={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=T(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}},Ce={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=T(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}},Vs={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=T(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}},fn={type:i.CommandType.COMMAND,id:"sheet.command.delta-row-height",handler:async(s,e)=>{var P,E;const n=s.get(g.SheetsSelectionsService).getCurrentSelections(),o=s.get(g.SheetInterceptorService);if(!(n!=null&&n.length))return!1;const r=T(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,S=n.filter(k=>k.range.rangeType===i.RANGE_TYPE.ROW),C=R?i.RANGE_TYPE.ALL:S.some(({range:k})=>{const{startRow:W,endRow:A}=k;return W<=d&&d<=A})?i.RANGE_TYPE.ROW:i.RANGE_TYPE.NORMAL;let v;if(C===i.RANGE_TYPE.ALL){const k=a.getColumnCount(),W=new Array(a.getRowCount()).fill(void 0).map((A,L)=>({startRow:L,endRow:L,startColumn:0,endColumn:k-1}));v={subUnitId:u,unitId:l,rowHeight:h,ranges:W}}else C===i.RANGE_TYPE.ROW?v={subUnitId:u,unitId:l,ranges:S.map(k=>i.Rectangle.clone(k.range)),rowHeight:h}:v={subUnitId:u,unitId:l,rowHeight:h,ranges:[{startRow:d,endRow:d,startColumn:0,endColumn:a.getMaxColumns()-1}]};const I=Dr(v,a),M={unitId:l,subUnitId:u,ranges:v.ranges,autoHeightInfo:i.BooleanNumber.FALSE},p=Ws(M,a),w=s.get(i.ICommandService),y=s.get(i.IUndoRedoService),b=o.onCommandExecute({id:fn.id,params:v}),O=i.sequenceExecute([{id:Ve.id,params:v},{id:Ce.id,params:M}],w),U=i.sequenceExecute([...b.redos],w);return O.result&&U.result?(y.pushUndoRedo({unitID:l,undoMutations:[...(P=b.preUndos)!=null?P:[],{id:Ve.id,params:I},{id:Ce.id,params:p},...b.undos],redoMutations:[...(E=b.preRedos)!=null?E:[],{id:Ve.id,params:v},{id:Ce.id,params:M},...b.redos]}),!0):!1}},vn={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(O=>O.range);if(!(u!=null&&u.length))return!1;const l=T(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=Dr(h,m),S={unitId:d,subUnitId:c,ranges:h.ranges,autoHeightInfo:i.BooleanNumber.FALSE},C=Ws(S,m),v=i.sequenceExecute([{id:Ve.id,params:h},{id:Ce.id,params:S}],n),I=a.onCommandExecute({id:vn.id,params:h}),M=i.sequenceExecute([...I.redos],n);return v.result&&M.result?(o.pushUndoRedo({unitID:d,undoMutations:[...(y=I.preRedos)!=null?y:[],{id:Ve.id,params:R},{id:Ce.id,params:C},...I.undos],redoMutations:[...(b=I.preRedos)!=null?b:[],{id:Ve.id,params:h},{id:Ce.id,params:S},...I.redos]}),!0):!1}},In={type:i.CommandType.COMMAND,id:"sheet.command.set-row-is-auto-height",handler:(s,e)=>{var O,U;const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),o=s.get(g.SheetsSelectionsService),r=s.get(i.IUniverInstanceService),a=T(r,e);if(!a)return!1;const{unitId:u,subUnitId:l,worksheet:d}=a,c=(O=e==null?void 0:e.ranges)!=null&&O.length?e.ranges:(U=o.getCurrentSelections())==null?void 0:U.map(P=>P.range);if(!(c!=null&&c.length))return!1;const m={unitId:u,subUnitId:l,ranges:c,autoHeightInfo:i.BooleanNumber.TRUE},h=Ws(m,d),R=t.syncExecuteCommand(Ce.id,m),S=s.get(g.SheetSkeletonService).getSkeleton(u,l),{suitableRanges:C,remainingRanges:v}=Lt(m.ranges,S),I=s.get(g.SheetInterceptorService),{undos:M,redos:p}=I.generateMutationsOfAutoHeight({unitId:u,subUnitId:l,ranges:C,autoHeightRanges:C,lazyAutoHeightRanges:v}),{undos:w,redos:y}=I.onCommandExecute({id:In.id,params:m}),b=i.sequenceExecute([...y,...p],t);return R&&b.result?(n.pushUndoRedo({unitID:u,undoMutations:[{id:Ce.id,params:h},...w,...M],redoMutations:[{id:Ce.id,params:m},...y,...p]}),!0):!1}},Ls={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(!T(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=Er(s,m),R=o.syncExecuteCommand(Be.id,m),S={unitId:t,subUnitId:n},C=o.syncExecuteCommand(ft.id,S);return R&&C?(r.pushUndoRedo({unitID:t,undoMutations:[{id:Be.id,params:h}],redoMutations:[{id:Be.id,params:m}]}),!0):!1}};var Ar=(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))(Ar||{});class Eu{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 Tu(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+=Uu(a);let r="[".concat(o,"]");return e&&(r+="+"),new RegExp(r)}function Uu(s){return s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const Pu=s=>{var t;return((t=s.body)==null?void 0:t.dataStream.replace(/\r\n$/,""))||""};function ku(s){if(s!=null){if(s.p)return Pu(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 Wr(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 Eu:null,h=[];for(let p=u;p<=d;p++){const w=s.getCell(p,a),y=ku(w);h.push(y),m&&m.update(y)}const R=c?m.getDelimiter():t,S=Tu(R,o,n);let C=-1,v=0,I=0;const M=[];for(const p of h){if(p!==void 0){const w=String(p).split(S);C<0?C=w.length:C=Math.max(C,w.length),M.push(w),v=I}else M.push(void 0);I++}return{rs:M,maxLength:C===-1?0:C,lastRow:v}}const Vr={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(!T(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:S,rs:C,maxLength:v}=Wr(R,o,r,a,u),I=R.getColumnCount(),{startColumn:M}=i.Range.transformRange(o,R);if(o.startColumn!==o.endColumn)return!1;const p=[],w=[],y=M+v+1-I;if(y>0){const k={unitId:t,subUnitId:n,range:{startRow:0,endRow:R.getRowCount()-1,startColumn:I-1,endColumn:I-1+y}};p.push({id:me.id,params:k});const W=Et(s,k);w.push({id:ae.id,params:W})}const b={startRow:o.startRow,endRow:S,startColumn:M,endColumn:M+v},O=new i.ObjectMatrix;for(let k=b.startRow;k<=b.endRow;k++)for(let W=b.startColumn;W<=b.endColumn;W++){const A=C[k-b.startRow];W===0&&(A==null?void 0:A.length)===1?O.setValue(k,W,R.getCell(k,W)):O.setValue(k,W,{v:(A==null?void 0:A[W-b.startColumn])||null,p:null,f:null,si:null,custom:null})}const U={unitId:t,subUnitId:n,cellValue:O.clone()},P=ue(s,U);return p.push({id:B.id,params:U}),w.unshift({id:B.id,params:P}),i.sequenceExecute(p,l).result?(c.pushUndoRedo({unitID:t,undoMutations:w,redoMutations:p}),!0):!1}},Lr={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),S=new i.DocumentDataModel(R),C=i.BuildTextUtils.paragraph.bullet.toggleChecklist({document:S,paragraphIndex:a});if(!C)return!1;i.TextX.apply(S.getBody(),C.serialize());const v={unitId:t,subUnitId:n,cellValue:{[o]:{[r]:{p:R,t:i.CellValueType.STRING}}}},I={id:B.id,params:v},M=ue(s,v),p={id:B.id,params:M},w=[I],y=[p];return c.pushUndoRedo({redoMutations:w,undoMutations:y,unitID:t}),m.syncExecuteCommand(I.id,I.params)}},yt={id:"sheet.mutation.toggle-gridlines",type:i.CommandType.MUTATION,handler:(s,e)=>{const t=T(s.get(i.IUniverInstanceService),e);if(!t)return!1;const{worksheet:n}=t,o=n.getConfig();return o.showGridlines=e.showGridlines,!0}},$r={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=T(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(yt.id,c)?(n.pushUndoRedo({unitID:l,undoMutations:[{id:yt.id,params:m}],redoMutations:[{id:yt.id,params:c}]}),!0):!1}},Hr={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(!T(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(lt.id,e)&&a.pushUndoRedo({unitID:t,undoMutations:[{id:lt.id,params:c}],redoMutations:[{id:dn.id,params:d}]}),!0}},Br={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 Oe(t.name);return r.fromJson(t),o.registerRangeThemeStyle(n,r),!0}},jr={id:"sheet.mutation.empty",type:i.CommandType.MUTATION,handler:()=>!0},Fr={id:"sheet.operation.mark-dirty-row-auto-height",type:i.CommandType.OPERATION,handler:()=>!0},Gr={id:"sheet.operation.cancel-mark-dirty-row-auto-height",type:i.CommandType.OPERATION,handler:()=>!0},zr=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},Yr=s=>{const e=s;return e.forValue((t,n)=>{const o=s.getValue(t-1,n);o&&e.setValue(t,n,o+1)}),e},qr=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},Ou=(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},$s=s=>{const e=[];let t=qr(s);for(;t.area>0;)t.range&&(e.push(t.range),Ou(s,t.range)),t=qr(s);return e},Hs=s=>{const e=zr(s);return $s(e)};class Nu{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=Yr(this._matrix);return $s(e)}}const Qe=i.createIdentifier("INumfmtService"),Du=(s,e)=>{const t=s.get(Qe),{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 S=t.getValue(o,r,h,R);S?a.push({pattern:S.pattern,row:h,col:R}):u.push({startColumn:R,endColumn:R,startRow:h,endRow:h})})})});const l=[];if(a.length){const d=wn(o,r,a);Object.keys(d.values).forEach(c=>{const m=d.values[c];m.ranges=Hs(m.ranges)}),l.push({id:pn.id,params:wn(o,r,a)})}return u.length&&l.push({id:Bs.id,params:{unitId:o,subUnitId:r,ranges:u}}),l},pn={id:"sheet.mutation.set.numfmt",type:i.CommandType.MUTATION,handler:(s,e)=>{if(!e)return!1;const{values:t,refMap:n}=e,o=s.get(Qe),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}},Bs={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(Qe).deleteValues(t,n,o),!0}},Au=(s,e)=>{const t=s.get(Qe),{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=wn(o,r,a);return Object.keys(u.values).forEach(l=>{const d=u.values[l];d.ranges=Hs(d.ranges)}),[{id:pn.id,params:u}]},wn=(s,e,t)=>{const n=Ra(t,"pattern"),o={},r={},a=Sa();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}},Kr={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}},Jr={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}},Xr={id:"sheet.operation.scroll-to-cell",type:i.CommandType.OPERATION,handler:()=>!0},Zr="ONLY_REGISTER_FORMULA_RELATED_MUTATIONS_KEY",Qr="maxCellsPerSheet",Wu=3e6;var Vu=Object.getOwnPropertyDescriptor,Lu=(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},js=(s,e)=>(t,n)=>e(t,n,s);let Mn=class extends i.Disposable{constructor(s,e,t){var o;super(),this._commandService=s,this._configService=e,this._dataSyncPrimaryController=t,[B,me,ve,ot,$e,De,Ae,ae,Ie,Ye,G,Bs,F,Us,Ft,pn,Vt,jr,Ct,St,Fr,Gr].forEach(r=>{var a;this._commandService.registerCommand(r),(a=this._dataSyncPrimaryController)==null||a.registerSyncingMutations(r)}),((o=this._configService.getConfig(Zr))!=null?o:!1)||[Ro,xt,en,tn,$n,Ke,Je,jt,fn,Bo,Ho,jo,Fo,Rs,Ee,ut,Ot,Wo,Ao,Lo,Vo,gs,be,Go,Dt,qe,Nt,fs,Wt,Is,At,cn,mn,Zo,Cr,Rr,Sr,sr,nr,dt,er,tr,ys,mt,ht,gn,rr,ct,ar,He,ur,vr,at,vn,Ts,mr,Rt,Ms,Es,$t,Ht,ee,wr,Bt,gr,pr,Ir,fr,Ps,ks,ft,Tr,Be,Rn,Ns,Gt,Vs,Ve,In,Ce,We,Nr,Mt,yr,vt,yo,q,Xr,No,Ss,_s,Ls,$r,yt,lr,gt,Pr,Le,Ze,ze,Cn,eo,dr,Po,to,ko,kr,ce,Me,x,Lr,It,br,Vr,st,nt,dn,lt,Hr,Xo,co,Oo,Br,Jr,Kr].forEach(r=>this.disposeWithMe(this._commandService.registerCommand(r))),this._configService.setConfig(Qr,Wu)}};Mn=Lu([js(0,i.ICommandService),js(1,i.IConfigService),js(2,i.Optional(Oi.DataSyncPrimaryController))],Mn);var $u=Object.getOwnPropertyDescriptor,Hu=(s,e,t,n)=>{for(var o=n>1?void 0:n?$u(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},xr=(s,e)=>(t,n)=>e(t,n,s);let yn=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!==Y.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),S={subUnitId:m,unitId:u,cellValue:R};o.push({id:B.id,params:S})}}return o.every(a=>this._commandService.executeCommand(a.id,a.params,{onlyLocal:!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=Y.handleNumfmtInCell(m,c,o);u.setValue(l,d,h)}),u.getMatrix()}};yn=Hu([xr(0,i.Inject(i.IUniverInstanceService)),xr(1,i.ICommandService)],yn);const Bu="sheets.config",ei={};var ju=Object.getOwnPropertyDescriptor,Fu=(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},ti=(s,e)=>(t,n)=>e(t,n,s);const Gu="SHEET_DEFINED_NAME_PLUGIN",zu="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:Gu,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=Fu([ti(0,Y.IDefinedNamesService),ti(1,i.IResourceManagerService)],g.DefinedNameDataController);const D={MoveRangeCommandId:_o,InsertRowCommandId:Do,InsertColCommandId:$o,RemoveColCommandId:vs,RemoveRowCommandId:Cs,DeleteRangeMoveLeftCommandId:To,DeleteRangeMoveUpCommandId:Uo,InsertRangeMoveDownCommandId:La,InsertRangeMoveRightCommandId:hs,MoveColsCommandId:Ko,MoveRowsCommandId:qo,ReorderRangeCommandId:xo};var $=(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))($||{});const _n=Number.MAX_SAFE_INTEGER,Te=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=_n),(e.rangeType===i.RANGE_TYPE.ROW||n)&&(e.startColumn=0,e.endColumn=_n),e.rangeType===i.RANGE_TYPE.ALL&&(e.startColumn=0,e.endColumn=_n,e.startRow=0,e.endRow=_n),e},de=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}},zt=(s,e,t)=>{const n={...t},o={...e},r=(C,v)=>{const I=Math.max(C.start,v.start),M=Math.min(C.end,v.end);return M<I?null:{start:I,end:M}},a=C=>C.end-C.start+1,u=(C,v)=>({start:C.start-v.start,end:C.start-v.start+C.end-C.start}),l=(C,v)=>({start:v.start+C.start,end:v.start+C.start+C.end-C.start}),d=e.start>s.start;if(d){const C=Math.min(s.end,e.start)-s.start+1;o.start-=C,o.end-=C}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 C=a(h);if(R){const v=u(n,s),I=l(v,o);n.start=I.start,n.end=I.end}else h.start>s.start?d?(n.end-=C+c,n.start-=c):n.end-=C:d?n.end-=C:n.start>s.start&&n.end>s.end?(n.start-=c,n.end-=c+C):n.end-=C}const S=r(o,n);return R||(o.start<=n.start?(n.start+=m,n.end+=m):S&&(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)}},Fs=(s,e)=>{const{fromRange:t,toRange:n}=s.params||{};if(!n||!t)return[];const o=Te(t),r=Te(n),a=Te(e),u=zt({start:o.startRow,end:o.endRow},{start:r.startRow,end:r.endRow},{start:a.startRow,end:a.endRow});return u===null?[{type:$.Delete}]:[{type:$.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)},qu=(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)},Gs=(s,e)=>{const{fromRange:t,toRange:n}=s.params||{};if(!n||!t)return[];const o=Te(t),r=Te(n),a=Te(e),u=zt({start:o.startColumn,end:o.endColumn},{start:r.startColumn,end:r.endColumn},{start:a.startColumn,end:a.endColumn});return u===null?[{type:$.Delete}]:[{type:$.HorizontalMove,step:u.step||0,length:u.length||0}]},Ku=(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)},ni=(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:$.Delete}),i.Rectangle.contains(n,e)){o.push({type:$.Delete});const u=i.Rectangle.getRelativeRange(e,n),l=i.Rectangle.getPositionRange(u,t);return[{type:$.Set,range:l}]}return o},Ju=(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,S)=>{o.setValue(R,S,1)});const r=new i.ObjectMatrix,a=i.Rectangle.getIntersects(n,e);a&&i.Range.foreach(a,(R,S)=>{o.getValue(R,S)&&(o.setValue(R,S,void 0),r.setValue(R,S,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,S)=>{var I;const C=R+l,v=S+u;o.setValue(C,v,(I=r.getValue(R,S))!=null?I:0)}),i.queryObjectMatrix(o,R=>R===1)},xe=(s,e)=>{const t=Te(s),n=Te(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}},zs=(s,e)=>{var r;const t=(r=s.params)==null?void 0:r.range;if(!t)return[];const n=[],o=xe(t,e);if(!o)n.push({type:$.Delete});else{const{step:a,length:u}=o;n.push({type:$.HorizontalMove,step:a,length:u})}return n},si=(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=xe(de(u),de(e));if(!l)o.push({type:$.Delete});else{const{step:d,length:c}=l;o.push({type:$.VerticalMove,step:d,length:c})}}return o},Xu=(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:$.VerticalMove,step:u-r,length:0}),o}return[]}return[]},et=(s,e)=>{const t=Te(s),n=Te(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 Zu(s,e,t){const n=[];if(i.Rectangle.contains(e,t)&&n.push({type:$.Delete}),i.Rectangle.contains(s,t)){n.push({type:$.Delete});const o=i.Rectangle.getRelativeRange(t,s),r=i.Rectangle.getPositionRange(o,e);return[{type:$.Set,range:r}]}return n}const oi=(s,e)=>{var u;const t=(u=s.params)==null?void 0:u.range;if(!t)return[];const n=[],o=et(de(t),de(e)),{step:r,length:a}=o;return n.push({type:$.VerticalMove,step:r,length:a}),n},ri=(s,e)=>{var u;const t=(u=s.params)==null?void 0:u.range;if(!t)return[];const n=[],o=et(t,e),{step:r,length:a}=o;return n.push({type:$.HorizontalMove,step:r,length:a}),n},ii=(s,e)=>{var u;const t=(u=s.params)==null?void 0:u.range;if(!t)return[];const n=[],o=et(de(t),de(e)),{step:r,length:a}=o;return n.push({type:$.VerticalMove,step:r,length:a}),n},Qu=(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)},ai=(s,e)=>{var u;const t=(u=s.params)==null?void 0:u.range;if(!t)return[];const n=[],o=et(t,e),{step:r,length:a}=o;return n.push({type:$.HorizontalMove,step:r,length:a}),n},xu=(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)},ui=(s,e)=>{var r;const t=(r=s.params)==null?void 0:r.range;if(!t)return[];const n=[],o=xe(t,e);if(!o)n.push({type:$.Delete});else{const{step:a,length:u}=o;n.push({type:$.HorizontalMove,step:a,length:u})}return n},el=(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)},li=(s,e)=>{var r;const t=(r=s.params)==null?void 0:r.range;if(!t)return[];const n=[],o=xe(de(t),de(e));if(!o)n.push({type:$.Delete});else{const{step:a,length:u}=o;n.push({type:$.VerticalMove,step:a,length:u})}return n},tl=(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)},nl=(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)},sl=(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}]},ol=(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}]},tt=(s,e)=>{let t={...e};return s.forEach(n=>{switch(n.type){case $.Delete:{t=null;break}case $.HorizontalMove:{if(!t)return;t.startColumn+=n.step,t.endColumn+=n.step+(n.length||0);break}case $.VerticalMove:{if(!t)return;t.startRow+=n.step,t.endRow+=n.step+(n.length||0);break}case $.Set:{t=n.range;break}}}),t&&(t.endColumn<t.startColumn||t.endRow<t.startRow)?null:t},Ys=(s,e)=>{let t=[];switch(e.id){case D.DeleteRangeMoveLeftCommandId:{t=ui(e,s);break}case D.DeleteRangeMoveUpCommandId:{t=li(e,s);break}case D.InsertColCommandId:{t=ri(e,s);break}case D.InsertRangeMoveDownCommandId:{t=ii(e,s);break}case D.InsertRangeMoveRightCommandId:{t=ai(e,s);break}case D.InsertRowCommandId:{t=oi(e,s);break}case D.MoveColsCommandId:{t=Gs(e,s);break}case D.MoveRangeCommandId:{t=ni(e,s);break}case D.MoveRowsCommandId:{t=Fs(e,s);break}case D.RemoveColCommandId:{t=zs(e,s);break}case D.RemoveRowCommandId:{t=si(e,s);break}case D.ReorderRangeCommandId:{t=Xu(e,s);break}}return tt(t,s)},rl=(s,e,t)=>[Ke.id,Je.id].includes(e.id)||ci(e,t).some(r=>i.Rectangle.intersects(r,s))?Ys(s,e):s,qs=(s,e)=>{let t=[];switch(e.id){case D.DeleteRangeMoveLeftCommandId:return el(e,s);case D.DeleteRangeMoveUpCommandId:return tl(e,s);case D.InsertRangeMoveDownCommandId:return Qu(e,s);case D.InsertRangeMoveRightCommandId:return xu(e,s);case D.InsertColCommandId:return ol(e,s);case D.InsertRowCommandId:return sl(e,s);case D.MoveColsCommandId:return Ku(e,s);case D.MoveRangeCommandId:return Ju(e,s);case D.MoveRowsCommandId:return Yu(e,s);case D.ReorderRangeCommandId:return qu(e,s);case D.RemoveColCommandId:{t=zs(e,s);break}case D.RemoveRowCommandId:return nl(e.params,s)}const n=tt(t,s);return n?[n]:[]},il=(s,e,t)=>[Ke.id,Je.id,ut.id,hs].includes(e.id)||ci(e,t).some(r=>i.Rectangle.intersects(r,s))?qs(s,e):s;function di(s,e){const{id:t,params:n}=e;let o={length:0,step:0,type:$.Unknown};switch(t){case Ye.id:o.type=$.Delete;break;case De.id:o=zt({start:n.sourceRange.startRow,end:n.sourceRange.endRow},{start:n.targetRange.startRow,end:n.targetRange.endRow},{start:s.startRow,end:s.endRow}),o.type=$.VerticalMove;break;case Ae.id:o=zt({start:n.sourceRange.startColumn,end:n.sourceRange.endColumn},{start:n.targetRange.startColumn,end:n.targetRange.endColumn},{start:s.startColumn,end:s.endColumn}),o.type=$.HorizontalMove;break;case ae.id:o=xe(n.range,s),o?o.type=$.HorizontalMove:o={step:0,length:0,type:$.Delete};break;case Ie.id:o=xe(de(n.range),de(s)),o?o.type=$.VerticalMove:o={step:0,length:0,type:$.Delete};break;case ve.id:o=et(de(n.range),de(s)),o.type=$.VerticalMove;break;case me.id:o=et(n.range,s),o.type=$.HorizontalMove;break;case $e.id:{const r=n.fromRange||new i.ObjectMatrix(n.from).getRange(),a=n.toRange||new i.ObjectMatrix(n.to).getRange();o=Zu(r,a,s)}break}return o?Array.isArray(o)?tt(o,s):tt([o],s):s}function ci(s,e){var n,o,r,a,u,l;const{selectionManagerService:t}=e;switch(s.id){case D.MoveColsCommandId:{const d=s.params;return[d.fromRange,{...d.toRange,startColumn:d.toRange.startColumn-.5,endColumn:d.toRange.endColumn-.5}]}case D.MoveRowsCommandId:{const d=s.params;return[d.fromRange,{...d.toRange,startRow:d.toRange.startRow-.5,endRow:d.toRange.startRow-.5}]}case D.MoveRangeCommandId:{const d=s;return[d.params.fromRange,d.params.toRange]}case D.InsertRowCommandId:{const c=s.params.range;return[{...c,startRow:c.startRow-.5,endRow:c.endRow-.5}]}case D.InsertColCommandId:{const c=s.params.range;return[{...c,startColumn:c.startColumn-.5,endColumn:c.endColumn-.5}]}case D.RemoveRowCommandId:return[s.params.range];case D.RemoveColCommandId:return[s.params.range];case D.DeleteRangeMoveUpCommandId:case D.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 D.DeleteRangeMoveLeftCommandId:case D.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 D.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 al(s){switch(s.id){case Ae.id:{const e=s.params;return[e.sourceRange,{...e.targetRange,startColumn:e.targetRange.startColumn-.5,endColumn:e.targetRange.startColumn-.5}]}case De.id:{const e=s.params;return[e.sourceRange,{...e.targetRange,startRow:e.targetRange.startRow-.5,endRow:e.targetRange.startRow-.5}]}case $e.id:{const e=s.params;return[new i.ObjectMatrix(e.from.value).getRange(),new i.ObjectMatrix(e.to.value).getRange()]}case me.id:{const t=s.params.range;return[{...t,startColumn:t.startColumn-.5,endColumn:t.startColumn-.5}]}case ve.id:{const t=s.params.range;return[{...t,startRow:t.startRow-.5,endRow:t.startRow-.5}]}case ae.id:return[s.params.range];case Ie.id:return[s.params.range]}}function ul(s,e){var o,r,a,u,l,d;const t=s.get(i.IUniverInstanceService),n=s.get(g.SheetsSelectionsService);switch(e.id){case D.MoveColsCommandId:{const c=e.params,m=T(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 D.MoveRowsCommandId:{const c=e.params,m=T(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 D.MoveRangeCommandId:{const c=e.params,m=T(t);return{unitId:m.unitId,subUnitId:m.subUnitId,ranges:[c.fromRange,c.toRange]}}case D.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 D.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 D.RemoveRowCommandId:{const m=e.params.range,h=T(t);return{unitId:h.unitId,subUnitId:h.subUnitId,ranges:[m,{...m,startRow:m.endRow+1,endRow:Number.MAX_SAFE_INTEGER}]}}case D.RemoveColCommandId:{const m=e.params.range,h=T(t);return{unitId:h.unitId,subUnitId:h.subUnitId,ranges:[m,{...m,startColumn:m.endColumn+1,endColumn:Number.MAX_SAFE_INTEGER}]}}case D.DeleteRangeMoveUpCommandId:case D.InsertRangeMoveDownCommandId:{const c=e,m=T(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 D.DeleteRangeMoveLeftCommandId:case D.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=T(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 D.ReorderRangeCommandId:{const c=e,{range:m,order:h}=c.params,R=[];for(let C=m.startRow;C<=m.endRow;C++)C in h&&R.push({startRow:C,endRow:C,startColumn:m.startColumn,endColumn:m.endColumn});const S=T(t);return{unitId:S.unitId,subUnitId:S.subUnitId,ranges:R}}}}var ll=Object.getOwnPropertyDescriptor,dl=(s,e,t,n)=>{for(var o=n>1?void 0:n?ll(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},bn=(s,e)=>(t,n)=>e(t,n,s);const cl=i.createInterceptorKey("MERGE_REDO"),ml=i.createInterceptorKey("MERGE_UNDO"),mi=Math.floor(Number.MAX_SAFE_INTEGER/10);class hl 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===$e.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===Ye.id)return;const a=al(e);if(a!=null&&a.some(u=>i.Rectangle.intersects(u,this._range)))return}const t=di(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:cl,MERGE_UNDO:ml}));f(this,"_watchRanges",new Set);f(this,"_refRangeManagerMap",new Map);f(this,"_serializer",gl());f(this,"_onRefRangeChange",()=>{this._sheetInterceptorService.interceptCommand({getMutations:t=>{const n=this._univerInstanceService.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET).getActiveSheet(),o=hi(this._univerInstanceService),r=gi(this._univerInstanceService);if(!n||!o||!r)return{redos:[],undos:[],preRedos:[],preUndos:[]};const l=((()=>{switch(t.id){case D.MoveColsCommandId:{const R=t.params,S=Math.min(R.fromRange.startColumn,R.toRange.startColumn);return this._checkRange([{...R.fromRange,startColumn:S,endColumn:n.getColumnCount()-1}],o,r)}case D.MoveRowsCommandId:{const R=t.params,S=Math.min(R.fromRange.startRow,R.toRange.startRow);return this._checkRange([{...R.fromRange,startRow:S,endRow:n.getRowCount()-1}],o,r)}case D.MoveRangeCommandId:{const R=t;return this._checkRange([R.params.fromRange,R.params.toRange],o,r)}case D.InsertRowCommandId:{const C={startRow:t.params.range.startRow,endRow:n.getRowCount()-1,startColumn:0,endColumn:n.getColumnCount()-1,rangeType:i.RANGE_TYPE.ROW};return this._checkRange([C],o,r)}case D.InsertColCommandId:{const S=t.params.range.startColumn,C={startRow:0,endRow:n.getRowCount()-1,startColumn:S,endColumn:n.getColumnCount()-1,rangeType:i.RANGE_TYPE.COLUMN};return this._checkRange([C],o,r)}case D.RemoveRowCommandId:{const C={startRow:t.params.range.startRow,endRow:n.getRowCount()-1,startColumn:0,endColumn:n.getColumnCount()-1,rangeType:i.RANGE_TYPE.ROW};return this._checkRange([C],o,r)}case D.RemoveColCommandId:{const S=t.params.range.startColumn,C={startRow:0,endRow:n.getRowCount()-1,startColumn:S,endColumn:n.getColumnCount()-1,rangeType:i.RANGE_TYPE.COLUMN};return this._checkRange([C],o,r)}case D.DeleteRangeMoveUpCommandId:case D.InsertRangeMoveDownCommandId:{const S=t.params.range||Ri(this._selectionManagerService)[0],C={startRow:S.startRow,startColumn:S.startColumn,endColumn:S.endColumn,endRow:mi};return this._checkRange([C],o,r)}case D.DeleteRangeMoveLeftCommandId:case D.InsertRangeMoveRightCommandId:{const S=t.params.range||Ri(this._selectionManagerService)[0],C={startRow:S.startRow,startColumn:S.startColumn,endColumn:mi,endRow:S.endRow};return this._checkRange([C],o,r)}case D.ReorderRangeCommandId:{const R=t,{range:S,order:C}=R.params,v=[];for(let I=S.startRow;I<=S.endRow;I++)I in C&&v.push({startRow:I,endRow:I,startColumn:S.startColumn,endColumn:S.endColumn});return this._checkRange(v,o,r)}}})()||[]).reduce((R,S)=>{const C=S(t);return R.push(C),R},[]).reduce((R,S)=>{var C,v;return R.redos.push(...S.redos),R.undos.push(...S.undos),R.preRedos.push(...(C=S.preRedos)!=null?C:[]),R.preUndos.push(...(v=S.preUndos)!=null?v:[]),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=Si(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||hi(this._univerInstanceService),u=r||gi(this._univerInstanceService);if(!a||!u)return i.toDisposable(()=>{});const l=Si(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 hl(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=dl([bn(0,i.ICommandService),bn(1,i.Inject(g.SheetInterceptorService)),bn(2,i.Inject(i.IUniverInstanceService)),bn(3,i.Inject(g.SheetsSelectionsService))],g.RefRangeService);function hi(s){return s.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET).getUnitId()}function gi(s){var e;return(e=s.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:e.getSheetId()}function Ri(s){var e;return((e=s.getCurrentSelections())==null?void 0:e.map(t=>t.range))||[]}function Si(s,e){return`${s}_${e}`}function gl(){const s=["startRow","startColumn","endRow","endColumn","rangeType"],e="_";return{deserialize:t=>{const n=s.reduce((r,a,u)=>(r[String(u)]=a,r),{});return t.split(e).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?e:""}${a}`:`${n}`},"")}}var Rl=Object.getOwnPropertyDescriptor,Sl=(s,e,t,n)=>{for(var o=n>1?void 0:n?Rl(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},_t=(s,e)=>(t,n)=>e(t,n,s);const Cl=[me.id,ve.id,ae.id,Ie.id],fl=[De.id,Ae.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 Ci=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:Ci}));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 xt.id:case tn.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=oe(t._injector,h),S=[{id:G.id,params:h}],C=[{id:F.id,params:R}];return{redos:S,undos:C}}}}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=T(this._univerInstanceService,{unitId:n,subUnitId:o});if(!d)return l;const{worksheet:c}=d,h=c.getMergeData().filter(R=>r.some(S=>i.Rectangle.intersects(R,S)));return h.length?(a.push({id:G.id,params:{unitId:n,subUnitId:o,ranges:h}}),u.push({id:F.id,params:{unitId:n,subUnitId:o,ranges:h}}),{undos:u,redos:a}):l}})}refRangeHandle(t,n,o){switch(t.id){case D.MoveColsCommandId:{const r=t.params;return this._handleMoveColsCommand(r,n,o)}case D.MoveRowsCommandId:{const r=t.params;return this._handleMoveRowsCommand(r,n,o)}case be.id:{const r=t.params,a=r.unitId||n,u=r.subUnitId||o;return this._handleInsertRowCommand(r,a,u)}case Ee.id:{const r=t.params,a=r.unitId||n,u=r.subUnitId||o;return this._handleInsertColCommand(r,a,u)}case Wt.id:{const r=t.params;return this._handleRemoveColCommand(r,n,o)}case At.id:{const r=t.params;return this._handleRemoveRowCommand(r,n,o)}case qe.id:{const r=t.params;return this._handleMoveRangeCommand(r,n,o)}case Ot.id:{const r=t.params;return this._handleInsertRangeMoveRightCommand(r,n,o)}case ut.id:{const r=t.params;return this._handleInsertRangeMoveDownCommand(r,n,o)}case Je.id:{const r=t.params;return this._handleDeleteRangeMoveUpCommand(r,n,o)}case Ke.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===ft.id){const o=n.params,r=o.subUnitId,a=o.unitId;if(!r||!a)return;t(a,r)}if(n.id===F.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(V.first(n=>!!n)).subscribe(n=>{const o=n.getActiveSheet();o&&t(n.getUnitId(),o.getSheetId())})}_handleMoveRowsCommand(t,n,o){const r=pe(this._univerInstanceService,n);if(!r)return this._handleNull();const a=we(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(C=>{if(m<=C.startRow&&h>=C.endRow){l.ranges.push(C);const v=Fs({id:D.MoveRowsCommandId,params:t},C),I=tt(v,C);I&&d.ranges.push(I)}}),l.ranges.length===0)return this._handleNull();const R=oe(this._injector,l),S=Re(this._injector,d);return{preRedos:[{id:G.id,params:l}],redos:[{id:F.id,params:d}],preUndos:[{id:G.id,params:S}],undos:[{id:F.id,params:R}]}}_handleMoveColsCommand(t,n,o){const r=pe(this._univerInstanceService,n);if(!r)return this._handleNull();const a=we(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(C=>{if(m<=C.startColumn&&h>=C.endColumn){l.ranges.push(C);const v=Gs({id:D.MoveColsCommandId,params:t},C),I=tt(v,C);I&&d.ranges.push(I)}}),l.ranges.length===0)return this._handleNull();const R=oe(this._injector,l),S=Re(this._injector,d);return{preRedos:[{id:G.id,params:l}],redos:[{id:F.id,params:d}],preUndos:[{id:G.id,params:S}],undos:[{id:F.id,params:R}]}}_handleMoveRangeCommand(t,n,o){const r=pe(this._univerInstanceService,n);if(!r)return this._handleNull();const a=we(r,o);if(!a)return this._handleNull();const u=a.getMergeData(),l=u.filter(S=>i.Rectangle.intersects(S,t.fromRange)),d=u.filter(S=>i.Rectangle.intersects(S,t.toRange)),c=l.map(S=>i.Rectangle.getRelativeRange(S,t.fromRange)).map(S=>i.Rectangle.getPositionRange(S,t.toRange)),m=Ks(c).filter(S=>!u.some(C=>i.Rectangle.equals(S,C))),h=[{id:G.id,params:{unitId:n,subUnitId:o,ranges:l}},{id:G.id,params:{unitId:n,subUnitId:o,ranges:d}},{id:F.id,params:{unitId:n,subUnitId:o,ranges:m}}],R=[{id:G.id,params:{unitId:n,subUnitId:o,ranges:m}},{id:F.id,params:{unitId:n,subUnitId:o,ranges:d}},{id:F.id,params:{unitId:n,subUnitId:o,ranges:l}}];return{redos:h,undos:R}}_handleInsertRowCommand(t,n,o){const r=pe(this._univerInstanceService,n);if(!r)return this._handleNull();const a=we(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=oe(this._injector,h),S={unitId:n,subUnitId:o,ranges:m},C=Re(this._injector,S),v=[{id:G.id,params:h},{id:F.id,params:S}],I=[{id:G.id,params:C},{id:F.id,params:R}];return{redos:v,undos:I}}_handleInsertColCommand(t,n,o){const{range:r}=t,a=pe(this._univerInstanceService,n);if(!a)return this._handleNull();const u=we(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=oe(this._injector,h),S={unitId:n,subUnitId:o,ranges:m},C=Re(this._injector,S),v=[{id:G.id,params:h},{id:F.id,params:S}],I=[{id:G.id,params:C},{id:F.id,params:R}];return{redos:v,undos:I}}_handleRemoveColCommand(t,n,o){const r=pe(this._univerInstanceService,n);if(!r)return this._handleNull();const a=we(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=oe(this._injector,h),S={unitId:n,subUnitId:o,ranges:m},C=Re(this._injector,S),v=[{id:G.id,params:h}],I=[{id:F.id,params:S}],M=[{id:G.id,params:C}],p=[{id:F.id,params:R}];return{preUndos:M,undos:p,preRedos:v,redos:I}}_handleRemoveRowCommand(t,n,o){const{range:r}=t,a=pe(this._univerInstanceService,n);if(!a)return this._handleNull();const u=we(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=oe(this._injector,h),S={unitId:n,subUnitId:o,ranges:m},C=Re(this._injector,S),v=[{id:G.id,params:h}],I=[{id:F.id,params:S}],M=[{id:G.id,params:C}],p=[{id:F.id,params:R}];return{preUndos:M,undos:p,preRedos:v,redos:I}}_handleInsertRangeMoveRightCommand(t,n,o){const r=pe(this._univerInstanceService,n);if(!r)return this._handleNull();const a=we(r,o);if(!a)return this._handleNull();const u=t.range,l=a.getMaxColumns()-1,d=a.getMergeData(),c=[],m=[];d.forEach(v=>{const{startRow:I,endRow:M,startColumn:p,endColumn:w}=u;if(i.Rectangle.intersects({startRow:I,startColumn:p,endRow:M,endColumn:l},v)&&(c.push(v),i.Rectangle.contains({startRow:I,startColumn:p,endRow:M,endColumn:l},v))){const O=w-p+1;m.push({startRow:v.startRow,startColumn:v.startColumn+O,endRow:v.endRow,endColumn:v.endColumn+O})}});const h={unitId:n,subUnitId:o,ranges:c},R=oe(this._injector,h),S={unitId:n,subUnitId:o,ranges:m},C=Re(this._injector,S);return{preRedos:[{id:G.id,params:h}],redos:[{id:F.id,params:S}],preUndos:[{id:G.id,params:C}],undos:[{id:F.id,params:R}]}}_handleInsertRangeMoveDownCommand(t,n,o){const r=pe(this._univerInstanceService,n);if(!r)return this._handleNull();const a=we(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:O,endRow:U}=u;if(i.Rectangle.intersects({startRow:y,startColumn:b,endRow:l,endColumn:O},w)&&(c.push(w),i.Rectangle.contains({startRow:y,startColumn:b,endRow:l,endColumn:O},w))){const k=U-y+1;m.push({startRow:w.startRow+k,startColumn:w.startColumn,endRow:w.endRow+k,endColumn:w.endColumn})}});const h={unitId:n,subUnitId:o,ranges:c},R=oe(this._injector,h),S={unitId:n,subUnitId:o,ranges:m},C=Re(this._injector,S),v=[{id:G.id,params:h}],I=[{id:F.id,params:S}],M=[{id:G.id,params:C}],p=[{id:F.id,params:R}];return{redos:I,undos:p,preRedos:v,preUndos:M}}_handleDeleteRangeMoveUpCommand(t,n,o){const r=pe(this._univerInstanceService,n);if(!r)return this._handleNull();const a=we(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:O,endRow:U}=u;if(i.Rectangle.intersects({startRow:y,startColumn:b,endRow:l,endColumn:O},w)&&(c.push(w),i.Rectangle.contains({startRow:y,startColumn:b,endRow:l,endColumn:O},w))){const k=U-y+1,W=i.Rectangle.moveVertical(w,-k);m.push(W)}});const h={unitId:n,subUnitId:o,ranges:c},R=oe(this._injector,h),S={unitId:n,subUnitId:o,ranges:m},C=Re(this._injector,S),v=[{id:G.id,params:h}],I=[{id:F.id,params:S}],M=[{id:G.id,params:C}],p=[{id:F.id,params:R}];return{redos:I,undos:p,preRedos:v,preUndos:M}}_handleDeleteRangeMoveLeftCommand(t,n,o){const r=pe(this._univerInstanceService,n);if(!r)return this._handleNull();const a=we(r,o);if(!a)return this._handleNull();const u=t.range,l=a.getMaxColumns()-1,d=a.getMergeData(),c=[],m=[];d.forEach(v=>{const{startRow:I,endRow:M,startColumn:p,endColumn:w}=u;if(i.Rectangle.intersects({startRow:I,startColumn:p,endRow:M,endColumn:l},v)&&(c.push(v),i.Rectangle.contains({startRow:I,startColumn:p,endRow:M,endColumn:l},v))){const O=w-p+1;m.push({startRow:v.startRow,startColumn:v.startColumn-O,endRow:v.endRow,endColumn:v.endColumn-O})}});const h={unitId:n,subUnitId:o,ranges:c},R=oe(this._injector,h),S={unitId:n,subUnitId:o,ranges:m},C=Re(this._injector,S);return{preRedos:[{id:G.id,params:h}],redos:[{id:F.id,params:S}],undos:[{id:F.id,params:R}],preUndos:[{id:G.id,params:C}]}}_checkIsMergeCell(t){return!(t.startRow===t.endRow&&t.startColumn===t.endColumn)}_handleNull(){return{redos:[],undos:[]}}_commandExecutedListener(){this.disposeWithMe(this._commandService.onCommandExecuted(t=>{if(fl.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(v=>{let{startRow:I,endRow:M,startColumn:p,endColumn:w,rangeType:y}=v;i.Rectangle.intersects(v,r)||(u?d<I&&c>M?(I-=l,M-=l):d>M&&c<=I&&(I+=l,M+=l):d<p&&c>w?(p-=l,w-=l):d>w&&c<=p&&(p+=l,w+=l)),v.startRow===v.endRow&&v.startColumn===v.endColumn||h.push({startRow:I,endRow:M,startColumn:p,endColumn:w,rangeType:y})}),o.setMergeData(h),this.disposableCollection.dispose();const{unitId:R,subUnitId:S}=t.params,C=v=>this.refRangeHandle(v,R,S);h.forEach(v=>{this.disposableCollection.add(this._refRangeService.registerRefRange(v,C,R,S))})}if(Cl.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(I=>{let{startRow:M,endRow:p,startColumn:w,endColumn:y,rangeType:b}=I;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),I.startRow===I.endRow&&I.startColumn===I.endColumn||R.push({startRow:M,endRow:p,startColumn:w,endColumn:y,rangeType:b})}),o.setMergeData(R),this.disposableCollection.dispose();const{unitId:S,subUnitId:C}=t.params,v=I=>this.refRangeHandle(I,S,C);R.forEach(I=>{this.disposableCollection.add(this._refRangeService.registerRefRange(I,v,S,C))})}}))}},g.MergeCellController=Sl([_t(0,i.Inject(i.ICommandService)),_t(1,i.Inject(g.RefRangeService)),_t(2,i.Inject(i.IUniverInstanceService)),_t(3,i.Inject(i.Injector)),_t(4,i.Inject(g.SheetInterceptorService)),_t(5,i.Inject(g.SheetsSelectionsService))],g.MergeCellController);function pe(s,e){return e?s.getUniverSheetInstance(e):s.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET)}function we(s,e){return e?s.getSheetBySheetId(e):s.getActiveSheet()}var vl=Object.getOwnPropertyDescriptor,Il=(s,e,t,n)=>{for(var o=n>1?void 0:n?vl(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},pl=(s,e)=>(t,n)=>e(t,n,s);let En=class extends i.Disposable{constructor(s){super(),this._sheetInterceptorService=s,this._initialize()}_initialize(){this._initInterceptorCellContent()}_initInterceptorCellContent(){this.disposeWithMe(this._sheetInterceptorService.intercept(ke.CELL_CONTENT,{priority:11,effect:i.InterceptorEffectEnum.Value|i.InterceptorEffectEnum.Style,handler:(s,e,t)=>{var o;const n=e.workbook.getStyles().getStyleByCell(s);return(o=n==null?void 0:n.n)!=null&&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=Y.stripErrorMargin(Number(s.v))),t(s)}}))}};En=Il([pl(0,i.Inject(g.SheetInterceptorService))],En);var wl=Object.getOwnPropertyDescriptor,Ml=(s,e,t,n)=>{for(var o=n>1?void 0:n?wl(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},Ue=(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 V.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 at.id:i.isICellData(n.value)&&n.value.f?(o=this._permissionCheckWithFormula(n),r=this._localeService.t("permission.dialog.formulaErr")):o=this._permissionCheckBySetRangeValue({workbookTypes:[le],rangeTypes:[he],worksheetTypes:[Pt,ge]},n);break;case en.id:o=this.permissionCheckWithRanges({workbookTypes:[le],rangeTypes:[he],worksheetTypes:[Pt,ge]}),r=this._localeService.t("permission.dialog.editErr");break;case jt.id:case gn.id:o=this.permissionCheckWithoutRange({worksheetTypes:[rt]}),r=this._localeService.t("permission.dialog.setRowColStyleErr");break;case fn.id:case vn.id:case In.id:o=this.permissionCheckWithoutRange({worksheetTypes:[it]}),r=this._localeService.t("permission.dialog.setRowColStyleErr");break;case Dt.id:case Nt.id:o=this._permissionCheckByMoveCommand(n),r=this._localeService.t("permission.dialog.moveRowColErr");break;case qe.id:o=this._permissionCheckByMoveRangeCommand(n),r=this._localeService.t("permission.dialog.moveRangeErr");break;case Ns.id:o=this._permissionCheckByWorksheetCommand([le,un]),r=this._localeService.t("permission.dialog.operatorSheetErr"),o===!1&&this._worksheetProtectionRuleModel.resetOrder();break;case Rn.id:o=this._permissionCheckByWorksheetCommand([le,ln]),r=this._localeService.t("permission.dialog.operatorSheetErr"),o===!1&&this._worksheetProtectionRuleModel.resetOrder();break;case Ls.id:{const{unitId:a,subUnitId:u}=n;o=this._permissionCheckByWorksheetCommand([le,rn],a,u),r=this._localeService.t("permission.dialog.operatorSheetErr"),o===!1&&this._worksheetProtectionRuleModel.resetOrder()}break;case $t.id:o=this.permissionCheckWithRanges({workbookTypes:[le],rangeTypes:[he],worksheetTypes:[ge,rt]},n.ranges),r=this._localeService.t("permission.dialog.setRowColStyleErr");break;case Ht.id:o=this.permissionCheckWithRanges({workbookTypes:[le],rangeTypes:[he],worksheetTypes:[ge,it]},n.ranges),r=this._localeService.t("permission.dialog.setRowColStyleErr");break;case Ms.id:o=this.permissionCheckWithRanges({workbookTypes:[le],rangeTypes:[he],worksheetTypes:[ge,rt]}),r=this._localeService.t("permission.dialog.setRowColStyleErr");break;case Es.id:o=this.permissionCheckWithRanges({workbookTypes:[le],rangeTypes:[he],worksheetTypes:[ge,it]}),r=this._localeService.t("permission.dialog.setRowColStyleErr");break;case Ot.id:o=this._permissionCheckWithInsertRangeMove("right"),r=this._localeService.t("permission.dialog.insertOrDeleteMoveRangeErr");break;case ut.id:o=this._permissionCheckWithInsertRangeMove("bottom"),r=this._localeService.t("permission.dialog.insertOrDeleteMoveRangeErr");break;case Ke.id:o=this._permissionCheckWithInsertRangeMove("left"),r=this._localeService.t("permission.dialog.insertOrDeleteMoveRangeErr");break;case Je.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===Ft.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=T(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=T(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 an(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,S,C,v;const n=T(this._univerInstanceService);if(!n)return!1;const{worksheet:o,unitId:r,subUnitId:a}=n,u=this._selectionManagerService.getCurrentLastSelection();if(!u)return!0;const l=(S=(R=u==null?void 0:u.primary)==null?void 0:R.actualRow)!=null?S:0,d=(v=(C=u==null?void 0:u.primary)==null?void 0:C.actualColumn)!=null?v: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 O,U,P,E,k;const p=(U=(O=o.getCell(l,d))==null?void 0:O.selectionProtection)==null?void 0:U[0];if(!(p!=null&&p.ruleId))return!1;const w=(P=this._rangeProtectionRuleModel.getRule(r,a,p.ruleId))==null?void 0:P.permissionId;if(!w)return!1;const y=new M(r,a,w);return((k=(E=this._permissionService.getPermissionPoint(y.id))==null?void 0:E.value)!=null?k:!1)===!1})===!0)}permissionCheckWithRanges(t,n,o,r){var S;const a=T(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:(S=this._selectionManagerService.getCurrentSelections())==null?void 0:S.map(C=>C.range);if(!d)return!1;const{workbookTypes:c,worksheetTypes:m,rangeTypes:h}=t,R=[];return c&&R.push(...c.map(C=>new C(o).id)),m&&R.push(...m.map(C=>new C(o,r).id)),h&&this._rangeProtectionRuleModel.getSubunitRuleList(o,r).forEach(C=>{d.some(I=>C.ranges.some(M=>i.Rectangle.intersects(M,I)))&&R.push(...h.map(I=>new I(o,r,C.permissionId).id))}),R.length?this._permissionService.composePermission(R).every(C=>C.value):!0}_permissionCheckByMoveCommand(t){const n=T(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 S=(m=(c=o.getCell(h,R))==null?void 0:c.selectionProtection)==null?void 0:m[0];if((S==null?void 0:S[_.Edit])===!1)return!1}}),!0)}_permissionCheckByMoveRangeCommand(t){const n=T(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 S=(m=(c=o.getCell(h,R))==null?void 0:c.selectionProtection)==null?void 0:m[0];if((S==null?void 0:S[_.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(),S=this._definedNamesService.getValueByName(R,m);if(S){let C=S.formulaOrRefString;C.startsWith(Y.operatorToken.EQUALS)&&(C=C.slice(1));const v=C.split(",");for(let I=0;I<v.length;I++){const M=v[I],p=Y.deserializeRangeWithSheet(M);if(p.sheetName){const w=h.getSheetBySheetName(p.sheetName);if(!w)return!0;const{startRow:y,endRow:b,startColumn:O,endColumn:U}=p.range;for(let P=y;P<=b;P++)for(let E=O;E<=U;E++){const k=(l=(u=w.getCell(P,E))==null?void 0:u.selectionProtection)==null?void 0:l[0];if((k==null?void 0:k[_.View])===!1)return!1}}}return!0}else{const C=this._lexerTreeBuilder.sequenceNodesBuilder(r);if(!C)return!0;for(let v=0;v<C.length;v++){const I=C[v];if(typeof I=="string"||I.nodeType!==Y.sequenceNodeType.REFERENCE)continue;const{token:M}=I,p=Y.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 k=y==null?void 0:y.getSheetId();if(!this._permissionService.getPermissionPoint(new kt(b,k).id))return!1}if(!y)return!0;const{startRow:O,endRow:U,startColumn:P,endColumn:E}=p.range;for(let k=O;k<=U;k++)for(let W=P;W<=E;W++){const A=(c=(d=y.getCell(k,W))==null?void 0:d.selectionProtection)==null?void 0:c[0];if((A==null?void 0:A[_.View])===!1)return!1}}return!0}}if(o){const m=T(this._univerInstanceService);if(!m)return!1;const h=t.unitId||m.unitId,R=t.subUnitId||m.subUnitId,C=this._rangeProtectionRuleModel.getSubunitRuleList(h,R).filter(I=>I.ranges.some(M=>i.Rectangle.intersects(M,o))).map(I=>new he(h,R,I.permissionId).id);if(!this._permissionService.composePermission(C).every(I=>I.value))return!1}return!0}},g.SheetPermissionCheckController=Ml([Ue(0,i.ICommandService),Ue(1,i.IUniverInstanceService),Ue(2,i.IPermissionService),Ue(3,i.Inject(g.SheetsSelectionsService)),Ue(4,i.Inject(X)),Ue(5,i.Inject(ye)),Ue(6,i.Inject(i.LocaleService)),Ue(7,i.Inject(Y.LexerTreeBuilder)),Ue(8,i.IContextService),Ue(9,Y.IDefinedNamesService)],g.SheetPermissionCheckController);var yl=Object.getOwnPropertyDescriptor,_l=(s,e,t,n)=>{for(var o=n>1?void 0:n?yl(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},Yt=(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 V.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();wt().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=>{[...re()].forEach(d=>{const c=new d(o,a,l.permissionId);this._permissionService.deletePermissionPoint(c.id)})}),[...ie(),...Se()].forEach(l=>{const d=new l(o,a);this._permissionService.deletePermissionPoint(d.id)})}),wt().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=_l([Yt(0,i.Inject(i.IPermissionService)),Yt(1,i.Inject(i.IUniverInstanceService)),Yt(2,i.Inject(X)),Yt(3,i.Inject(ye)),Yt(4,i.Inject(pt))],g.WorkbookPermissionService);var bl=Object.getOwnPropertyDescriptor,El=(s,e,t,n)=>{for(var o=n>1?void 0:n?bl(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},Pe=(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()}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:N.SelectRange,actions:je})})}),!n.length){this._rangeProtectionRuleModel.changeRuleInitState(!0);return}this._authzIoService.batchAllowed(n).then(u=>{u.forEach(l=>{const d=a.get(l.objectID);d&&re().forEach(c=>{const m=new c(o,d.subUnitId,l.objectID),h=m.subType,R=l.actions.find(S=>S.action===h);(R==null?void 0:R.allowed)!==void 0&&this._permissionService.updatePermissionPoint(m.id,R.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:N.SelectRange,actions:je}).then(t=>{re().forEach(n=>{if(e.type==="set"){const{rule:l,oldRule:d}=e;if(l.permissionId===(d==null?void 0:d.permissionId))return}const o=e.rule,r=new n(o.unitId,o.subUnitId,o.permissionId),a=r.subType,u=t.find(l=>l.action===a);u&&this._permissionService.updatePermissionPoint(r.id,u.allowed)}),this._rangeProtectionRuleModel.ruleRefresh(e.rule.permissionId)}):this._rangeProtectionRuleModel.getSubunitRuleList(e.unitId,e.subUnitId).length===0&&(this._worksheetProtectionPointRuleModel.deleteRule(e.unitId,e.subUnitId),[...Se()].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:N.Workbook,unitID:t,actions:Ur}).then(o=>{wt().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:N.Worksheet,actions:je}).then(t=>{ie().forEach(n=>{const o=new n(e.unitId,e.subUnitId),r=o.subType,a=t.find(u=>u.action===r);a&&this._permissionService.updatePermissionPoint(o.id,a.allowed)}),this._worksheetProtectionRuleModel.ruleRefresh(e.rule.permissionId)}):([...ie(),...Se()].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:N.Worksheet,actions:Sn}).then(t=>{Se().forEach(n=>{const o=new n(e.unitId,e.subUnitId),r=o.subType,a=t.find(u=>u.action===r);a&&this._permissionService.updatePermissionPoint(o.id,a.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:N.Worksheet,actions:je}));const c=this._worksheetProtectionPointRuleModel.getRule(o,l);c&&(a.set(c.permissionId,c),n.push({objectID:c.permissionId,unitID:o,objectType:N.Worksheet,actions:Sn}))}),!n.length){this._worksheetProtectionRuleModel.changeRuleInitState(!0);return}this._authzIoService.batchAllowed(n).then(u=>{u.forEach(l=>{const d=a.get(l.objectID);d&&[...ie(),...Se()].forEach(c=>{const m=new c(o,d.subUnitId),h=m.subType,R=l.actions.find(S=>S.action===h);(R==null?void 0:R.allowed)!==void 0&&this._permissionService.updatePermissionPoint(m.id,R.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(V.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();wt().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();[...ie(),...Se()].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=>{re().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:N.Worksheet,actions:je}).then(d=>{let c="";ie().forEach(m=>{var C;const h=new m(e,l),R=h.subType,S=d.find(v=>v.action===R);S&&(((C=this._permissionService.getPermissionPoint(h.id))==null?void 0:C.value)!==S.allowed&&(o=!0),this._permissionService.updatePermissionPoint(h.id,S.allowed),c+=`${S.action}_${S.allowed}`)}),this._worksheetProtectionRuleModel.ruleRefresh(`${t}_${c}`),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:N.Worksheet,actions:Sn}).then(d=>{Se().forEach(c=>{var S;const m=new c(e,l),h=m.subType,R=d.find(C=>C.action===h);R&&(((S=this._permissionService.getPermissionPoint(m.id))==null?void 0:S.value)!==R.allowed&&(o=!0),this._permissionService.updatePermissionPoint(m.id,R.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:N.SelectRange,actions:je}).then(d=>{let c="";re().forEach(m=>{var C;const h=new m(e,l,t),R=h.subType,S=d.find(v=>v.action===R);S&&(((C=this._permissionService.getPermissionPoint(h.id))==null?void 0:C.value)!==S.allowed&&(o=!0),this._permissionService.updatePermissionPoint(h.id,S.allowed),c+=`${S.action}_${S.allowed}`)}),this._rangeProtectionRuleModel.ruleRefresh(`${t}_${c}`),o&&this._undoRedoService.clearUndoRedo(e)})}}_refreshPermissionByCollaCreate(){this.disposeWithMe(this._commandService.onCommandExecuted((e,t)=>{if(t!=null&&t.fromCollab&&(e.id===ce.id||e.id===Le.id||e.id===Cn.id)){const n=e.params;this._undoRedoService.clearUndoRedo(n.unitId)}}))}},g.SheetPermissionInitController=El([Pe(0,i.IUniverInstanceService),Pe(1,i.IPermissionService),Pe(2,i.IAuthzIoService),Pe(3,i.Inject(X)),Pe(4,i.Inject(ye)),Pe(5,i.Inject(i.UserManagerService)),Pe(6,i.Inject(pt)),Pe(7,i.Inject(g.WorkbookPermissionService)),Pe(8,i.Inject(i.IUndoRedoService)),Pe(9,i.Inject(i.ICommandService))],g.SheetPermissionInitController);var Tl=Object.getOwnPropertyDescriptor,Ul=(s,e,t,n)=>{for(var o=n>1?void 0:n?Tl(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.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(V.filter(t=>t.type===N.SelectRange),V.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 S=c;S<=m;S++)for(let C=h;C<=R;C++)l.delete(`${S}-${C}`)})}),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 S=m;S<=h;S++)a.delete(`${R}-${S}`),u.delete(`${R}-${S}`)}),this._permissionIdCache.delete(r.permissionId)}_getSelectionActions(t,n,o){var c,m,h,R,S,C,v,I,M,p,w,y;const r=(h=(m=this._permissionService.getPermissionPoint((c=new he(t,n,o.permissionId))==null?void 0:c.id))==null?void 0:m.value)!=null?h:!0,a=(C=(S=this._permissionService.getPermissionPoint((R=new on(t,n,o.permissionId))==null?void 0:R.id))==null?void 0:S.value)!=null?C:!0,u=(M=(I=this._permissionService.getPermissionPoint((v=new As(t,n,o.permissionId))==null?void 0:v.id))==null?void 0:I.value)!=null?M:!1,l=(y=(w=this._permissionService.getPermissionPoint((p=new Ds(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:S,endColumn:C}=m;for(let v=h;v<=R;v++){const I=a.get(`${v}`);I?I.set(l.id,d):a.set(`${v}`,new Map([[l.id,d]]));for(let M=S;M<=C;M++){o.set(`${v}-${M}`,l.id),r.set(`${v}-${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(V.filter(t=>t.type===N.SelectRange),V.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:S,endColumn:C}=m;for(let v=h;v<=R;v++){const I=l.get(`${v}`);I?I.set(a,c):l.set(`${v}`,new Map([[a,c]]));for(let M=S;M<=C;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 S=a.get(`${R}`);S==null||S.delete(r.id);for(let C=m;C<=h;C++){const v=u.get(`${C}`);v==null||v.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=Ul([Js(0,i.Inject(X)),Js(1,i.Inject(i.IPermissionService)),Js(2,i.Inject(i.IUniverInstanceService))],g.RangeProtectionCache);var Pl=Object.getOwnPropertyDescriptor,kl=(s,e,t,n)=>{for(var o=n>1?void 0:n?Pl(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},Tn=(s,e)=>(t,n)=>e(t,n,s);let Un=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(ke.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(ke.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 kt(n,o).id))==null?void 0:a.value)!=null?u:!1,[_.Edit]:(d=(l=this._permissionService.getPermissionPoint(new ge(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)}}))}};Un=kl([Tn(0,i.IPermissionService),Tn(1,i.Inject(ye)),Tn(2,i.Inject(g.SheetInterceptorService)),Tn(3,i.Inject(g.RangeProtectionCache))],Un);var Ol=Object.getOwnPropertyDescriptor,Nl=(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},fi=(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(bt.filter(e=>e.type===N.SelectRange),bt.filter(e=>re().some(t=>e instanceof t)),bt.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=re().reduce((h,R)=>{var v;const S=new R(e,t,c.permissionId),C=this._permissionService.getPermissionPoint(S.id);return h[S.subType]=(v=C==null?void 0:C.value)!=null?v:S.value,h},{});d.push({...m,ruleId:c.id,ranges:c.ranges})}return this._cache.set(u,d),d}clear(){this._cache.clear()}},g.RangeProtectionRenderModel=Nl([fi(0,i.Inject(X)),fi(1,i.Inject(i.IPermissionService))],g.RangeProtectionRenderModel);const Xs=i.createIdentifier("univer.exclusive-range-service");class vi extends i.Disposable{constructor(){super(...arguments);f(this,"_exclusiveRanges",new Map);f(this,"_exclusiveRangesChange$",new V.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 Dl=Object.getOwnPropertyDescriptor,Al=(s,e,t,n)=>{for(var o=n>1?void 0:n?Dl(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.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 S=a.setValue(R);c.s=S})})}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 S={...a.getStyleByCell(h)||{},n:{pattern:l.pattern}},C=a.setValue(S);h.s=C}else{const R={n:{pattern:l.pattern}},S=a.setValue(R);S&&u.setValue(c,m,{s:S})}})})})}},g.NumfmtService=Al([Zs(0,i.IResourceManagerService),Zs(1,i.IUniverInstanceService),Zs(2,i.ILogService)],g.NumfmtService);var Wl=Object.getOwnPropertyDescriptor,Vl=(s,e,t,n)=>{for(var o=n>1?void 0:n?Wl(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},Ge=(s,e)=>(t,n)=>e(t,n,s);const Ii=[me.id,ve.id,ae.id,Ie.id],pi=[De.id,Ae.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===ks.id){const r=o.params,a=r.subUnitId,u=r.unitId;if(!a||!u)return;t(u,a)}if(o.id===x.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 Nt.id:return this._getRefRangeMutationsByMoveRows(t.params,n,o);case Dt.id:return this._getRefRangeMutationsByMoveCols(t.params,n,o);case be.id:return this._getRefRangeMutationsByInsertRows(t.params,n,o);case Ee.id:return this._getRefRangeMutationsByInsertCols(t.params,n,o);case Wt.id:return this._getRefRangeMutationsByDeleteCols(t.params,n,o);case At.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 S=i.Tools.deepClone(R),{startColumn:C,endColumn:v}=a;if(C<=S.startColumn&&v>=S.endColumn)return h;C>=S.startColumn&&v<=S.endColumn?S.endColumn-=v-C+1:C<S.startColumn?(S.startColumn=C,S.endColumn-=v-C+1):v>S.endColumn&&(S.endColumn=C-1),this._checkIsRightRange(S)&&h.push(S)}return h},[]);c.ranges=m,c.ranges.length?(u.push({id:x.id,params:{unitId:n,subUnitId:o,rule:c,ruleId:d.id}}),l.push({id:x.id,params:{unitId:n,subUnitId:o,rule:d,ruleId:d.id}})):(u.push({id:Me.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 S=i.Tools.deepClone(R),{startRow:C,endRow:v}=a;if(C<=S.startRow&&v>=S.endRow)return h;C>=S.startRow&&v<=S.endRow?S.endRow-=v-C+1:C<S.startRow?(S.startRow=C,S.endRow-=v-C+1):v>S.endRow&&(S.endRow=C-1),this._checkIsRightRange(S)&&h.push(S)}return h},[]);c.ranges=m,u.push({id:x.id,params:{unitId:n,subUnitId:o,rule:c,ruleId:d.id}}),l.push({id:x.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:x.id,params:{unitId:n,subUnitId:o,rule:m,ruleId:c.id}}),d.push({id:x.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:x.id,params:{unitId:n,subUnitId:o,rule:m,ruleId:c.id}}),d.push({id:x.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),S=t.fromRange.startRow;let C=!1;h.ranges.forEach(v=>{a>v.startRow&&a<=v.endRow&&(S<v.startRow&&(v.startRow=v.startRow-u,v.endRow=v.endRow-u),v.endRow+=u,C=!0)}),C&&(d.push({id:x.id,params:{unitId:n,subUnitId:o,rule:h,ruleId:m.id}}),c.push({id:x.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),S=t.fromRange.startColumn;let C=!1;h.ranges.forEach(v=>{a>v.startColumn&&a<=v.endColumn&&(S<v.startColumn&&(v.startColumn=v.startColumn-u,v.endColumn=v.endColumn-u),v.endColumn+=u,C=!0)}),C&&(d.push({id:x.id,params:{unitId:n,subUnitId:o,rule:h,ruleId:m.id}}),c.push({id:x.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(pi.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(v=>{v.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,S=v=>this.refRangeHandle(v,h,R);this._selectionProtectionRuleModel.getSubunitRuleList(h,R).reduce((v,I)=>[...v,...I.ranges],[]).forEach(v=>{this.disposableCollection.add(this._refRangeService.registerRefRange(v,S,h,R))}),this._selectionProtectionRenderModel.clear()}if(Ii.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(I=>{I.ranges.forEach(p=>{let{startRow:w,endRow:y,startColumn:b,endColumn:O}=p;l?u?d<=w&&(w+=m,y+=m):d<=b&&(b+=m,O+=m):u?c<w&&(w-=m,y-=m):c<b&&(b-=m,O-=m),this._checkIsRightRange({startRow:w,endRow:y,startColumn:b,endColumn:O})&&(p.startColumn=b,p.endColumn=O,p.startRow=w,p.endRow=y)})}),this.disposableCollection.dispose();const{unitId:R,subUnitId:S}=t.params,C=I=>this.refRangeHandle(I,R,S);this._selectionProtectionRuleModel.getSubunitRuleList(R,S).reduce((I,M)=>[...I,...M.ranges],[]).forEach(I=>{this.disposableCollection.add(this._refRangeService.registerRefRange(I,C,R,S))}),this._selectionProtectionRenderModel.clear()}}))}_checkIsRightRange(t){return t.startRow<=t.endRow&&t.startColumn<=t.endColumn}_initReBuildCache(){this.disposeWithMe(this._commandService.onCommandExecuted(t=>{if(Ii.includes(t.id)||pi.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===cn.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:Me.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=Vl([Ge(0,i.Inject(X)),Ge(1,i.Inject(i.IUniverInstanceService)),Ge(2,i.ICommandService),Ge(3,i.Inject(g.RefRangeService)),Ge(4,i.Inject(g.RangeProtectionRenderModel)),Ge(5,i.Inject(g.RangeProtectionCache)),Ge(6,i.Inject(g.SheetInterceptorService)),Ge(7,i.Inject(X))],g.RangeProtectionRefRangeService);var Ll=Object.getOwnPropertyDescriptor,$l=(s,e,t,n)=>{for(var o=n>1?void 0:n?Ll(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},qt=(s,e)=>(t,n)=>e(t,n,s);const Hl="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":{re().forEach(t=>{const n=new t(e.unitId,e.subUnitId,e.rule.permissionId);this._permissionService.addPermissionPoint(n)});break}case"delete":{re().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&&re().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:Hl,businesses:[sn.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:N.SelectRange,actions:je})}),l.forEach(d=>{re().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=$l([qt(0,i.Inject(X)),qt(1,i.Inject(i.IPermissionService)),qt(2,i.Inject(i.IResourceManagerService)),qt(3,i.Inject(g.RangeProtectionCache)),qt(4,i.Inject(i.IUniverInstanceService))],g.RangeProtectionService);var Bl=Object.getOwnPropertyDescriptor,jl=(s,e,t,n)=>{for(var o=n>1?void 0:n?Bl(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},Fl=(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=jl([Fl(0,i.Inject(g.SheetRangeThemeModel))],g.SheetRangeThemeService);var Gl=Object.defineProperty,zl=Object.getOwnPropertyDescriptor,Yl=(s,e,t)=>e in s?Gl(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,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},wi=(s,e)=>(t,n)=>e(t,n,s),Mi=(s,e,t)=>Yl(s,typeof e!="symbol"?e+"":e,t);const Kl="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(Bu,o),this._initConfig(),this._initDependencies()}_initConfig(){var e,t,n;(e=this._config)!=null&&e.onlyRegisterFormulaRelatedMutations&&this._configService.setConfig(Zr,!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=[[Xe],[g.SheetsSelectionsService],[g.RefRangeService],[g.WorkbookPermissionService],[Qe,{useClass:g.NumfmtService}],[g.SheetInterceptorService],[g.SheetRangeThemeService],[g.SheetSkeletonService],[Mn],[g.MergeCellController],[En],[g.DefinedNameDataController],[g.WorksheetPermissionService],[ye],[pt],[Un],[g.SheetPermissionInitController],[g.SheetPermissionCheckController],[g.SheetRangeThemeModel],[g.RangeProtectionRenderModel],[X],[g.RangeProtectionCache],[g.RangeProtectionRefRangeService],[g.RangeProtectionService],[Xs,{useClass:vi,deps:[g.SheetsSelectionsService]}]];(t=this._config)!=null&&t.notExecuteFormula||e.push([yn]),i.registerDependencies(this._injector,i.mergeOverrideWithDependencies(e,this._config.override)),i.touchDependencies(this._injector,[[g.SheetInterceptorService],[g.RangeProtectionService],[Xs],[g.SheetPermissionInitController]])}onStarting(){i.touchDependencies(this._injector,[[Mn],[g.MergeCellController],[g.WorkbookPermissionService],[g.WorksheetPermissionService],[Un],[g.SheetSkeletonService]])}onRendered(){i.touchDependencies(this._injector,[[Qe]])}onReady(){i.touchDependencies(this._injector,[[yn],[g.DefinedNameDataController],[g.SheetRangeThemeModel],[En],[g.RangeProtectionRenderModel],[g.RangeProtectionRefRangeService],[g.RefRangeService],[g.SheetPermissionCheckController]])}},Mi(g.UniverSheetsPlugin,"pluginName",Kl),Mi(g.UniverSheetsPlugin,"type",i.UniverInstanceType.UNIVER_SHEET),g.UniverSheetsPlugin=ql([i.DependentOn(Y.UniverFormulaEnginePlugin),wi(1,i.Inject(i.Injector)),wi(2,i.IConfigService)],g.UniverSheetsPlugin);var yi=(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))(yi||{}),_i=(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))(_i||{});const Jl=[Ve.id,Ce.id,Vs.id,We.id,ft.id,De.id,Ae.id,mt.id,ht.id,Ct.id,St.id,me.id,ve.id,ae.id,Ie.id,yt.id,gt.id,Mt.id,vt.id],Xl=[B.id,$e.id,G.id,F.id,Vt.id,It.id,Rt.id,ct.id,nt.id,st.id];function Zl(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 Ql(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[]}}const xl=1.5,ed="rgba(255, 255, 255, 0.01)";function td(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=bi(t)),o}function bi(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}}const nd=(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:S,endRow:C,endColumn:v}=a[a.length-1];if(r===i.Dimension.COLUMNS){const w=t.find(y=>y.startColumn===m&&y.endColumn===m&&h===y.startRow);w&&(v=w.endColumn,R=w.startRow,C=w.endRow)}else if(r===i.Dimension.ROWS){const w=t.find(y=>y.startRow===h&&y.endRow===h&&m===y.startColumn);w&&(C=w.endRow,S=w.startColumn,v=w.endColumn)}const I={startRow:R,startColumn:S,endRow:C,endColumn:v,actualRow:h,actualColumn:m,isMerged:!0,isMergedMainCell:R===h&&S===m},M=o.map((w,y,b)=>({range:w.range,style:null,primary:y===b.length-1?I:null})),p={unitId:u,subUnitId:l,type:te.ONLY_SET,selections:M};return{id:q.id,params:p}}return null}return null},sd=(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};function Ei(s){return s==null?!1:s.v!==void 0&&s.v!==null&&s.v!==""||s.p!==void 0}function Pn(s,e){return s&&s.spanAnchor?Ei(e.getValue(s.spanAnchor.startRow,s.spanAnchor.startColumn)):Ei(s)}function od(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,S)=>{R===c&&S===d&&u.setValue(R,S,{...r.getValue(R,S),spanAnchor:{startRow:c,endRow:h,startColumn:d,endColumn:m}}),(R!==c||S!==d)&&(u.realDeleteValue(R,S),u.setValue(R,S,{spanAnchor:{startRow:c,endRow:h,startColumn:d,endColumn:m}}))})}),u}function rd(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||Pn(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 id(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||Pn(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 ad(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||Pn(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 ud(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||Pn(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 ld(s,e,t){const n=t.getMaxRows(),o=t.getMaxColumns(),r=od(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:S,range:C,spanAnchor:v}=ad(h,r,1,a);if(v&&R.push(v),S){h=C,m=!0;continue}}if(c&&h.endRow!==n-1){const{hasValue:S,range:C,spanAnchor:v}=ud(h,r,1,a);if(v&&R.push(v),S){h=C,m=!0;continue}}if(u&&h.startColumn!==0){const{hasValue:S,range:C,spanAnchor:v}=rd(h,r,1,a);if(v&&R.push(v),S){h=C,m=!0;continue}}if(l&&h.endColumn!==o-1){const{hasValue:S,range:C,spanAnchor:v}=id(h,r,1,a);if(v&&R.push(v),S){h=C,m=!0;continue}}}return R.length>0&&(h=i.Rectangle.union(h,...R)),h}const Ti=(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 Pi(s,e,h,n,o,!1)}},Ui=(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 ki(s,e,h,n,o,!1)}},Pi=(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 Ti(s,e,h,n,o,!1)}},ki=(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 Ui(s,e,h,n,o,!1)}};function kn(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 Ti(s,e,t,o);case i.Direction.DOWN:return Ui(s,e,t,o);case i.Direction.LEFT:return Pi(s,e,t,o);case i.Direction.RIGHT:return ki(s,e,t,o)}},cd=(s,e,t)=>{let n,o=-1,r;for(let I=0;I<s.length;I++)if(s[I].primary){n=s[I],o=I,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,S=a?d.startRow===c&&d.startColumn===m:d.endRow===h&&d.endColumn===R,C=S&&a;if(!i.Rectangle.equals(n.range,d)){const I=S?l.range:dd(n.range,t,d,e);if(!I)return null;const M=C?kn(I.endRow,I.endColumn,t):kn(I.startRow,I.startColumn,t);return{startRow:M.startRow,startColumn:M.startColumn,endRow:M.endRow,endColumn:M.endColumn}}const v=C?kn(l.range.endRow,l.range.endColumn,t):kn(l.range.startRow,l.range.startColumn,t);return{startRow:v.startRow,startColumn:v.startColumn,endRow:v.endRow,endColumn:v.endColumn}},md={WorkbookCommentPermission:Hn,WorkbookCopyPermission:Bn,WorkbookCreateProtectPermission:jn,WorkbookCreateSheetPermission:Fn,WorkbookDeleteSheetPermission:Gn,WorkbookDuplicatePermission:zn,WorkbookEditablePermission:le,WorkbookExportPermission:Yn,WorkbookHideSheetPermission:rn,WorkbookHistoryPermission:Eo,WorkbookManageCollaboratorPermission:an,WorkbookMoveSheetPermission:un,WorkbookPrintPermission:qn,WorkbookRecoverHistoryPermission:Kn,WorkbookRenameSheetPermission:ln,WorkbookSharePermission:Jn,WorkbookViewHistoryPermission:Zn,WorkbookViewPermission:Xn,WorksheetCopyPermission:Qn,WorksheetDeleteColumnPermission:xn,WorksheetDeleteProtectionPermission:es,WorksheetDeleteRowPermission:ts,WorksheetEditExtraObjectPermission:ns,WorksheetEditPermission:ge,WorksheetFilterPermission:ss,WorksheetInsertColumnPermission:os,WorksheetInsertHyperlinkPermission:rs,WorksheetInsertRowPermission:is,WorksheetManageCollaboratorPermission:as,WorksheetPivotTablePermission:us,WorksheetSetCellStylePermission:ls,WorksheetSetCellValuePermission:Pt,WorksheetSetColumnStylePermission:rt,WorksheetSetRowStylePermission:it,WorksheetSortPermission:ds,WorksheetViewPermission:kt,RangeProtectionPermissionEditPoint:he,RangeProtectionPermissionViewPoint:on},hd=(s,e,t,n)=>{const o=s.get(i.IPermissionService),r=s.get(X),a=o.getPermissionPoint(new le(e).id);if(!(a!=null&&a.value))return!1;const u=o.getPermissionPoint(new ge(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 he(e,t,m).id);return!!(h!=null&&h.value)}):!0};function gd(s,e){return e.some(t=>Rd(s,t))}function Rd(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 Sd(s,e,t,n){const o=[],r=[],a=t.getSheetId();return n.forEach(u=>{const l=Cd(t,u),d={unitId:e,subUnitId:a,cellValue:l.getData()},c=ue(s,d);o.push({id:B.id,params:c}),r.push({id:B.id,params:d})}),{undos:o,redos:r}}function Cd(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 Kt={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=gd(d,l),R={unitId:r,subUnitId:a,ranges:l},S={unitId:r,subUnitId:a,ranges:l};c.push({id:G.id,params:R}),c.push({id:F.id,params:S});const C=oe(s,R),v=Re(s,S);if(m.push({id:G.id,params:v}),m.push({id:F.id,params:C}),h){const M=Sd(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}},fd={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(Kt.id,{selections:n,unitId:u,subUnitId:l})}},vd={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(Kt.id,{value:i.Dimension.COLUMNS,selections:n,unitId:u,subUnitId:l})}},Id={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(Kt.id,{value:i.Dimension.ROWS,selections:n,unitId:u,subUnitId:l})}};function pd(s,e,t,n,o){const r=s.get(i.IUniverInstanceService),a=T(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(Kt.id,{unitId:e,subUnitId:t,selections:n,defaultMerge:o})}const wd=(s,e)=>{const r=s.get(i.IUniverInstanceService).getUniverSheetInstance(e.unitId).getSheetBySheetId(e.subUnitId).getConfig().rightToLeft;return{...i.Tools.deepClone(e),rightToLeft:r}},On={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}},Md={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=T(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=wd(s,l);return t.syncExecuteCommand(On.id,l)?(n.pushUndoRedo({unitID:r,undoMutations:[{id:On.id,params:d}],redoMutations:[{id:On.id,params:l}]}),!0):!1}};g.AFTER_CELL_EDIT=Jt,g.AddMergeRedoSelectionsOperationFactory=nd,g.AddMergeUndoMutationFactory=Re,g.AddMergeUndoSelectionsOperationFactory=sd,g.AddRangeProtectionCommand=eo,g.AddRangeProtectionMutation=ce,g.AddRangeThemeMutation=Br,g.AddWorksheetMergeAllCommand=fd,g.AddWorksheetMergeCommand=Kt,g.AddWorksheetMergeHorizontalCommand=Id,g.AddWorksheetMergeMutation=F,g.AddWorksheetMergeVerticalCommand=vd,g.AddWorksheetProtectionCommand=to,g.AddWorksheetProtectionMutation=Le,g.AppendRowCommand=Ro,g.BEFORE_CELL_EDIT=Dn,g.BorderStyleManagerService=Xe,g.COMMAND_LISTENER_SKELETON_CHANGE=Jl,g.COMMAND_LISTENER_VALUE_CHANGE=Xl,g.CancelFrozenCommand=ur,g.CancelMarkDirtyRowAutoHeightMutation=Gr,g.ClearSelectionAllCommand=xt,g.ClearSelectionContentCommand=en,g.ClearSelectionFormatCommand=tn,g.CopySheetCommand=$n,g.DISABLE_NORMAL_SELECTIONS=Ma,g.DeleteRangeMoveLeftCommand=Ke,g.DeleteRangeMoveUpCommand=Je,g.DeleteRangeProtectionCommand=Po,g.DeleteRangeProtectionMutation=Me,g.DeleteWorksheetProtectionCommand=ko,g.DeleteWorksheetProtectionMutation=ze,g.DeleteWorksheetRangeThemeStyleCommand=Oo,g.DeleteWorksheetRangeThemeStyleMutation=st,g.DeleteWorksheetRangeThemeStyleMutationFactory=lo,g.DeltaColumnWidthCommand=jt,g.DeltaRowHeightCommand=fn,g.EditStateEnum=xs,g.EffectRefRangId=D,g.EmptyMutation=jr,g.ExclusiveRangeService=vi,g.FactoryAddRangeProtectionMutation=Di,g.FactoryDeleteRangeProtectionMutation=Ni,g.FactorySetRangeProtectionMutation=ou,g.IExclusiveRangeService=Xs,g.INTERCEPTOR_POINT=ke,g.INumfmtService=Qe,g.IRefSelectionsService=wo,g.InsertColAfterCommand=Bo,g.InsertColBeforeCommand=Ho,g.InsertColByRangeCommand=Rs,g.InsertColCommand=Ee,g.InsertColMutation=me,g.InsertColMutationUndoFactory=Et,g.InsertDefinedNameCommand=No,g.InsertMultiColsLeftCommand=jo,g.InsertMultiColsRightCommand=Fo,g.InsertMultiRowsAboveCommand=Vo,g.InsertMultiRowsAfterCommand=Lo,g.InsertRangeMoveDownCommand=ut,g.InsertRangeMoveRightCommand=Ot,g.InsertRowAfterCommand=Wo,g.InsertRowBeforeCommand=Ao,g.InsertRowByRangeCommand=gs,g.InsertRowCommand=be,g.InsertRowMutation=ve,g.InsertRowMutationUndoFactory=Zt,g.InsertSheetCommand=Go,g.InsertSheetMutation=ot,g.InsertSheetUndoMutationFactory=Ln,g.InterceptCellContentPriority=no,g.MAX_CELL_PER_SHEET_KEY=Qr,g.MERGE_CELL_INTERCEPTOR_CHECK=Ci,g.MarkDirtyRowAutoHeightMutation=Fr,g.MoveColsCommand=Dt,g.MoveColsMutation=Ae,g.MoveColsMutationUndoFactory=Yo,g.MoveRangeCommand=qe,g.MoveRangeMutation=$e,g.MoveRowsCommand=Nt,g.MoveRowsMutation=De,g.MoveRowsMutationUndoFactory=zo,g.OperatorType=$,g.PermissionPointsDefinitions=md,g.REF_SELECTIONS_ENABLED=vo,g.RangeMergeUtil=Nu,g.RangeProtectionPermissionDeleteProtectionPoint=Ds,g.RangeProtectionPermissionEditPoint=he,g.RangeProtectionPermissionManageCollaPoint=As,g.RangeProtectionPermissionViewPoint=on,g.RangeProtectionRuleModel=X,g.RangeThemeStyle=Oe,g.RegisterWorksheetRangeThemeStyleCommand=Xo,g.RegisterWorksheetRangeThemeStyleMutation=lt,g.RemoveColByRangeCommand=Is,g.RemoveColCommand=Wt,g.RemoveColMutation=ae,g.RemoveDefinedNameCommand=Ss,g.RemoveMergeUndoMutationFactory=oe,g.RemoveNumfmtMutation=Bs,g.RemoveRangeThemeMutation=Kr,g.RemoveRowByRangeCommand=fs,g.RemoveRowCommand=At,g.RemoveRowMutation=Ie,g.RemoveSheetCommand=cn,g.RemoveSheetMutation=Ye,g.RemoveSheetUndoMutationFactory=Io,g.RemoveWorksheetMergeCommand=Zo,g.RemoveWorksheetMergeMutation=G,g.ReorderRangeCommand=mn,g.ReorderRangeMutation=Vt,g.ReorderRangeUndoMutationFactory=Qo,g.ResetBackgroundColorCommand=Cr,g.ResetTextColorCommand=Rr,g.SCOPE_WORKBOOK_VALUE_DEFINED_NAME=zu,g.SELECTIONS_ENABLED=ya,g.SELECTION_CONTROL_BORDER_BUFFER_COLOR=ed,g.SELECTION_CONTROL_BORDER_BUFFER_WIDTH=xl,g.ScrollToCellOperation=Xr,g.SelectRangeCommand=yo,g.SelectionMoveType=te,g.SetBackgroundColorCommand=Sr,g.SetBoldCommand=du,g.SetBorderBasicCommand=sr,g.SetBorderColorCommand=nr,g.SetBorderCommand=dt,g.SetBorderPositionCommand=er,g.SetBorderStyleCommand=tr,g.SetColDataCommand=rr,g.SetColDataMutation=ct,g.SetColDataMutationFactory=or,g.SetColHiddenCommand=ys,g.SetColHiddenMutation=mt,g.SetColVisibleMutation=ht,g.SetColWidthCommand=gn,g.SetDefinedNameCommand=_s,g.SetFontFamilyCommand=Ru,g.SetFontSizeCommand=Su,g.SetFrozenCommand=ar,g.SetFrozenMutation=He,g.SetFrozenMutationFactory=bs,g.SetGridlinesColorCommand=lr,g.SetGridlinesColorMutation=gt,g.SetHorizontalTextAlignCommand=vr,g.SetItalicCommand=cu,g.SetNumfmtMutation=pn,g.SetOverlineCommand=gu,g.SetProtectionCommand=dr,g.SetRangeProtectionMutation=x,g.SetRangeThemeMutation=Jr,g.SetRangeValuesCommand=at,g.SetRangeValuesMutation=B,g.SetRangeValuesUndoMutationFactory=ue,g.SetRowDataCommand=mr,g.SetRowDataMutation=Rt,g.SetRowDataMutationFactory=cr,g.SetRowHeightCommand=vn,g.SetRowHiddenCommand=Ts,g.SetRowHiddenMutation=Ct,g.SetRowVisibleMutation=St,g.SetSelectedColsVisibleCommand=Ms,g.SetSelectedRowsVisibleCommand=Es,g.SetSelectionsOperation=q,g.SetSpecificColsVisibleCommand=$t,g.SetSpecificRowsVisibleCommand=Ht,g.SetStrikeThroughCommand=hu,g.SetStyleCommand=ee,g.SetTabColorCommand=wr,g.SetTabColorMutation=Bt,g.SetTextColorCommand=gr,g.SetTextRotationCommand=pr,g.SetTextWrapCommand=Ir,g.SetUnderlineCommand=mu,g.SetVerticalTextAlignCommand=fr,g.SetWorkbookNameCommand=Ps,g.SetWorkbookNameMutation=Us,g.SetWorksheetActivateCommand=ks,g.SetWorksheetActiveOperation=ft,g.SetWorksheetColWidthMutation=We,g.SetWorksheetColWidthMutationFactory=Os,g.SetWorksheetColumnCountCommand=yr,g.SetWorksheetColumnCountMutation=vt,g.SetWorksheetColumnCountUndoMutationFactory=Mr,g.SetWorksheetDefaultStyleCommand=br,g.SetWorksheetDefaultStyleMutation=It,g.SetWorksheetDefaultStyleMutationFactory=_r,g.SetWorksheetHideCommand=Tr,g.SetWorksheetHideMutation=Be,g.SetWorksheetNameCommand=Rn,g.SetWorksheetNameMutation=Ft,g.SetWorksheetOrderCommand=Ns,g.SetWorksheetOrderMutation=Gt,g.SetWorksheetPermissionPointsCommand=Pr,g.SetWorksheetPermissionPointsMutation=Cn,g.SetWorksheetProtectionCommand=kr,g.SetWorksheetProtectionMutation=Ze,g.SetWorksheetRangeThemeStyleCommand=co,g.SetWorksheetRangeThemeStyleMutation=nt,g.SetWorksheetRangeThemeStyleMutationFactory=uo,g.SetWorksheetRightToLeftCommand=Md,g.SetWorksheetRightToLeftMutation=On,g.SetWorksheetRowAutoHeightMutation=Vs,g.SetWorksheetRowAutoHeightMutationFactory=bu,g.SetWorksheetRowCountCommand=Nr,g.SetWorksheetRowCountMutation=Mt,g.SetWorksheetRowCountUndoMutationFactory=Or,g.SetWorksheetRowHeightMutation=Ve,g.SetWorksheetRowIsAutoHeightCommand=In,g.SetWorksheetRowIsAutoHeightMutation=Ce,g.SetWorksheetShowCommand=Ls,g.SheetSkeletonChangeType=yi,g.SheetValueChangeType=_i,g.SplitDelimiterEnum=Ar,g.SplitTextToColumnsCommand=Vr,g.ToggleCellCheckboxCommand=Lr,g.ToggleGridlinesCommand=$r,g.ToggleGridlinesMutation=yt,g.UnitAction=_,g.UnitObject=N,g.UnregisterWorksheetRangeThemeStyleCommand=Hr,g.UnregisterWorksheetRangeThemeStyleMutation=dn,g.VALIDATE_CELL=Xt,g.ViewStateEnum=Qs,g.WorkbookCommentPermission=Hn,g.WorkbookCopyPermission=Bn,g.WorkbookCopySheetPermission=bo,g.WorkbookCreateProtectPermission=jn,g.WorkbookCreateSheetPermission=Fn,g.WorkbookDeleteSheetPermission=Gn,g.WorkbookDuplicatePermission=zn,g.WorkbookEditablePermission=le,g.WorkbookExportPermission=Yn,g.WorkbookHideSheetPermission=rn,g.WorkbookHistoryPermission=Eo,g.WorkbookManageCollaboratorPermission=an,g.WorkbookMoveSheetPermission=un,g.WorkbookPrintPermission=qn,g.WorkbookRecoverHistoryPermission=Kn,g.WorkbookRenameSheetPermission=ln,g.WorkbookSelectionModel=fo,g.WorkbookSharePermission=Jn,g.WorkbookViewHistoryPermission=Zn,g.WorkbookViewPermission=Xn,g.WorksheetCopyPermission=Qn,g.WorksheetDeleteColumnPermission=xn,g.WorksheetDeleteProtectionPermission=es,g.WorksheetDeleteRowPermission=ts,g.WorksheetEditExtraObjectPermission=ns,g.WorksheetEditPermission=ge,g.WorksheetFilterPermission=ss,g.WorksheetInsertColumnPermission=os,g.WorksheetInsertHyperlinkPermission=rs,g.WorksheetInsertRowPermission=is,g.WorksheetManageCollaboratorPermission=as,g.WorksheetPivotTablePermission=us,g.WorksheetProtectionPointModel=pt,g.WorksheetProtectionRuleModel=ye,g.WorksheetSelectProtectedCellsPermission=Da,g.WorksheetSelectUnProtectedCellsPermission=Aa,g.WorksheetSetCellStylePermission=ls,g.WorksheetSetCellValuePermission=Pt,g.WorksheetSetColumnStylePermission=rt,g.WorksheetSetRowStylePermission=it,g.WorksheetSortPermission=ds,g.WorksheetViewPermission=kt,g.addMergeCellsUtil=pd,g.adjustRangeOnMutation=di,g.alignToMergedCellsBorders=Ut,g.baseProtectionActions=je,g.checkCellValueType=Wn,g.checkRangesEditablePermission=hd,g.convertPrimaryWithCoordToPrimary=bi,g.convertSelectionDataToRange=td,g.copyRangeStyles=Ne,g.createTopMatrixFromMatrix=Yr,g.createTopMatrixFromRanges=zr,g.defaultWorkbookPermissionPoints=Ur,g.defaultWorksheetPermissionPoint=Sn,g.expandToContinuousRange=ld,g.factoryRemoveNumfmtUndoMutation=Au,g.factorySetNumfmtUndoMutation=Du,g.findAllRectangle=$s,g.findFirstNonEmptyCell=fa,g.followSelectionOperation=_e,g.generateNullCell=Vn,g.generateNullCellValue=So,g.getAddMergeMutationRangeByType=Ks,g.getAllRangePermissionPoint=re,g.getAllWorkbookPermissionPoint=wt,g.getAllWorksheetPermissionPoint=ie,g.getAllWorksheetPermissionPointByPointPanel=Se,g.getCellAtRowCol=ba,g.getDefaultRangePermission=pu,g.getInsertRangeMutations=cs,g.getMoveRangeUndoRedoMutations=nn,g.getNextPrimaryCell=cd,g.getPrimaryForRange=ne,g.getRemoveRangeMutations=ms,g.getSelectionsService=Mo,g.getSeparateEffectedRangesOnCommand=ul,g.getSheetCommandTarget=T,g.getSheetCommandTargetWorkbook=An,g.getSheetMutationTarget=fe,g.getSkeletonChangedEffectedRange=Ql,g.getValueChangedEffectedRange=Zl,g.getVisibleRanges=Tt,g.handleBaseInsertRange=et,g.handleBaseMoveRowsCols=zt,g.handleBaseRemoveRange=xe,g.handleCommonDefaultRangeChangeWithEffectRefCommands=qs,g.handleCommonRangeChangeWithEffectRefCommandsSkipNoInterests=il,g.handleDefaultRangeChangeWithEffectRefCommands=Ys,g.handleDefaultRangeChangeWithEffectRefCommandsSkipNoInterests=rl,g.handleDeleteRangeMoveLeft=ui,g.handleDeleteRangeMoveUp=li,g.handleDeleteRangeMutation=Va,g.handleIRemoveCol=zs,g.handleIRemoveRow=si,g.handleInsertCol=ri,g.handleInsertRangeMoveDown=ii,g.handleInsertRangeMoveRight=ai,g.handleInsertRangeMutation=Wa,g.handleInsertRow=oi,g.handleMoveCols=Gs,g.handleMoveRange=ni,g.handleMoveRows=Fs,g.isSingleCellSelection=Ta,g.rangeMerge=Hs,g.rangeToDiscreteRange=Co,g.rotateRange=de,g.runRefRangeMutations=tt,g.setEndForRange=Ea,g.splitRangeText=Wr,g.transformCellsToRange=wn,Object.defineProperty(g,Symbol.toStringTag,{value:"Module"})});
12
+ `)?s.body.dataStream.length-2:s.body.dataStream.length;if(t<r){const u={st:t,ed:r},l=Qt({},e,!0);l&&i.Tools.removeNull(l),i.Tools.isEmptyObject(l)||(u.ts=l),n.push(u)}s.body.textRuns=i.normalizeTextRuns(n)}function ua(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(!Nn.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 la(n)?Nn.isTextFormat((a=n==null?void 0:n.n)==null?void 0:a.pattern)?i.CellValueType.STRING:ho(e,t):Nn.isTextFormat((u=o==null?void 0:o.n)==null?void 0:u.pattern)?i.CellValueType.STRING:ho(e,t)}function ho(s,e){return s.v!==void 0?An(s.v,s.t):An(e.v,e.t)}function la(s){var e;return!!((e=s==null?void 0:s.n)!=null&&e.pattern)}function An(s,e){return s===null?null:typeof s=="string"?i.isRealNum(s)?(+s==0||+s==1)&&e===i.CellValueType.BOOLEAN?i.CellValueType.BOOLEAN:i.willLoseNumericPrecision(s)?i.CellValueType.FORCE_STRING:i.CellValueType.NUMBER:i.isBooleanString(s)?i.CellValueType.BOOLEAN:i.CellValueType.STRING:typeof s=="number"?(s===0||s===1)&&e===i.CellValueType.BOOLEAN?i.CellValueType.BOOLEAN:i.CellValueType.NUMBER:typeof s=="boolean"?i.CellValueType.BOOLEAN:i.CellValueType.FORCE_STRING}function go(s,e){return e.v===void 0||e.v===null?e.v:s===i.CellValueType.NUMBER?Number(e.v):s===i.CellValueType.BOOLEAN?da(e.v)?1:0:s===i.CellValueType.STRING||s===i.CellValueType.FORCE_STRING?`${e.v}`:e.v}function da(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 ca(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 ue=(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,S)=>{const C=i.Tools.deepClone(l==null?void 0:l.getValue(h,R))||{},v=d.getStyleByCell(C),I=d.getStyleByCell(S);C.s=ra(v,I),c.setValue(h,R,ca(C))}),{...e,options:{},cellValue:c.getMatrix()}},B={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 S=l.getValue(m,h)||{};S=ma(R,S,d),i.Tools.isEmptyObject(S)?l.realDeleteValue(m,h):l.setValue(m,h,S)}}),!0}};function ma(s,e,t){const n=new Set(["f","p","si","custom"]),o=ua(t,s,e);return Object.keys(s).forEach(r=>{const a=r;if(n.has(a)){const u=s[a];ha(e,a,u)}else a==="v"?s.v!==void 0&&(e.v=go(o,s)):a==="s"&&oa(t,e,s)}),e.v!==void 0&&(e.t=o,e.v=go(o,e)),e.v===null&&(delete e.t,delete e.v),e}function ha(s,e,t){t===void 0||(t===null?delete s[e]:s[e]=t)}const Ro={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=ue(s,m),R=[{id:B.id,params:m}],S=[{id:B.id,params:h}];if(u){const v={unitId:o,subUnitId:r,range:{startRow:d,endRow:d,startColumn:0,endColumn:c-1}},I=Zt(s,v);R.unshift({id:ve.id,params:v}),S.push({id:Ie.id,params:I})}if(l){const v={unitId:o,subUnitId:r,range:{startRow:0,endRow:d-1,startColumn:c,endColumn:c-1+l}},I=Et(s,v);R.unshift({id:me.id,params:v}),S.push({id:ae.id,params:I})}return i.sequenceExecute(R,t).result?(n.pushUndoRedo({unitID:o,undoMutations:S,redoMutations:R}),!0):!1}},ga=(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)},{}),Ra=(s=0)=>{let e=s;return function(){return e++}};function Sa(s){return s==null?!1:s.v!==void 0&&s.v!==null&&s.v!==""||s.p!==void 0}function Ca(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(Sa(o))return{startRow:t,startColumn:n,endRow:t,endColumn:n}}return null}function Wn(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 So(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 fa(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 Co(s,e,t,n,o){const r=e.get(i.IUniverInstanceService),a=t?r.getUnit(t,i.UniverInstanceType.UNIVER_SHEET):r.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET),u=n?a==null?void 0:a.getSheetBySheetId(n):a==null?void 0:a.getActiveSheet();if(!u)return null;const{startRow:l,endRow:d,startColumn:c,endColumn:m}=s,h=[],R=[];for(let S=l;S<=d;S++)u.getRowFiltered(S)||(o?u.getRowRawVisible(S)&&h.push(S):h.push(S));for(let S=c;S<=m;S++)o?u.getColVisible(S)&&R.push(S):R.push(S);return{rows:h,cols:R}}function Tt(s,e,t,n){const o=[],r=[];for(const h of s){const R=Co(h,e,t,n,!0);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 S=h[0];for(let C=1;C<h.length;C++)h[C]!==h[C-1]+1&&(R.push([S,h[C-1]]),S=h[C]);return R.push([S,h[h.length-1]]),R}const c=d(a),m=d(u);for(const[h,R]of c)for(const[S,C]of m)l.push({startRow:h,endRow:R,startColumn:S,endColumn:C});return l}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 fo extends i.Disposable{constructor(t){super();f(this,"_worksheetSelections",new Map);f(this,"_selectionMoveStart$",new V.Subject);f(this,"selectionMoveStart$",this._selectionMoveStart$.asObservable());f(this,"_selectionMoving$",new V.Subject);f(this,"selectionMoving$",this._selectionMoving$.asObservable());f(this,"_selectionMoveEnd$",new V.BehaviorSubject([]));f(this,"selectionMoveEnd$",this._selectionMoveEnd$.asObservable());f(this,"_selectionSet$",new V.BehaviorSubject([]));f(this,"selectionSet$",this._selectionSet$.asObservable());f(this,"selectionChanged$");f(this,"_beforeSelectionMoveEnd$",new V.BehaviorSubject([]));f(this,"beforeSelectionMoveEnd$",this._beforeSelectionMoveEnd$.asObservable());this._workbook=t,this.selectionChanged$=V.merge(this._selectionMoveEnd$,this._selectionSet$)}dispose(){super.dispose(),this._beforeSelectionMoveEnd$.complete(),this._selectionMoveEnd$.complete(),this._selectionMoving$.complete(),this._selectionMoveStart$.complete(),this._selectionSet$.complete()}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 va=Object.getOwnPropertyDescriptor,Ia=(s,e,t,n)=>{for(var o=n>1?void 0:n?va(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},pa=(s,e)=>(t,n)=>e(t,n,s);g.SheetsSelectionsService=class extends i.RxDisposable{constructor(t){super();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(V.shareReplay(1),V.takeUntil(this.dispose$));this.selectionMoveStart$=t.pipe(V.switchMap(n=>n?this._ensureWorkbookSelection(n.getUnitId()).selectionMoveStart$:V.of())),this.selectionMoving$=t.pipe(V.switchMap(n=>n?this._ensureWorkbookSelection(n.getUnitId()).selectionMoving$:V.of())),this.selectionMoveEnd$=t.pipe(V.switchMap(n=>n?this._ensureWorkbookSelection(n.getUnitId()).selectionMoveEnd$:V.of([]))),this.selectionSet$=t.pipe(V.switchMap(n=>n?this._ensureWorkbookSelection(n.getUnitId()).selectionSet$:V.of([]))),this.selectionChanged$=t.pipe(V.switchMap(n=>n?this._ensureWorkbookSelection(n.getUnitId()).selectionChanged$:V.of([]))).pipe(V.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]))),V.skip(1)),this._instanceSrv.getTypeOfUnitDisposed$(i.UniverInstanceType.UNIVER_SHEET).pipe(V.takeUntil(this.dispose$)).subscribe(n=>{this._removeWorkbookSelection(n.getUnitId())})}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 fo(o),this._workbookSelections.set(t,n)}return n}_removeWorkbookSelection(t){this._workbookSelections.delete(t)}},g.SheetsSelectionsService=Ia([pa(0,i.IUniverInstanceService)],g.SheetsSelectionsService);const wa="DISABLE_NORMAL_SELECTIONS",Ma="SELECTIONS_ENABLED",vo="REF_SELECTIONS_ENABLED",xt={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(M=>M.range));if(!(m!=null&&m.length))return!1;const h=Tt(m,s,l,c),R=[],S=[],C={subUnitId:c,unitId:l,cellValue:Wn(h)},v=ue(s,C);R.push({id:B.id,params:C}),S.push({id:B.id,params:v});const I=a.onCommandExecute({id:xt.id});return R.push(...I.redos),S.unshift(...I.undos),i.sequenceExecute(R,n)?(r.pushUndoRedo({unitID:l,undoMutations:S,redoMutations:R}),!0):!1}},en={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(M=>M.range));if(!(m!=null&&m.length))return!1;const h=Tt(m,s,l,c),R={subUnitId:c,unitId:l,cellValue:So(h)},S=ue(s,R),C=a.onCommandExecute({id:en.id}),v=[{id:B.id,params:R},...C.redos],I=[...C.undos,{id:B.id,params:S}];return i.sequenceExecute(v,n).result?(r.pushUndoRedo({unitID:l,undoMutations:I,redoMutations:v}),!0):!1}},tn={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(M=>M.range));if(!(m!=null&&m.length))return!1;const h=Tt(m,s,l,c),R=[],S=[],C={subUnitId:c,unitId:l,cellValue:fa(h)},v=ue(s,C);R.push({id:B.id,params:C}),S.push({id:B.id,params:v});const I=a.onCommandExecute({id:tn.id});return R.push(...I.redos),S.unshift(...I.undos),i.sequenceExecute(R,n)?(r.pushUndoRedo({unitID:l,undoMutations:S,redoMutations:R}),!0):!1}},Vn=(s,e)=>({subUnitId:e.sheet.id,unitId:e.unitId,subUnitName:e.sheet.name}),ot={id:"sheet.mutation.insert-sheet",type:i.CommandType.MUTATION,handler:(s,e)=>{const t=s.get(i.IUniverInstanceService),{sheet:n,index:o,unitId:r}=e,a=t.getUniverSheetInstance(r);return a?a.addWorksheet(n.id,o,n):!1}},Io=(s,e)=>{const t=s.get(i.IUniverInstanceService),{subUnitId:n,unitId:o}=e,r=fe(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}},Ye={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}},Ln={type:i.CommandType.COMMAND,id:"sheet.command.copy-sheet",handler:(s,e)=>{var M,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=T(o,e);if(!u)return!1;const{workbook:l,worksheet:d,unitId:c,subUnitId:m}=u,h=i.Tools.deepClone(d.getConfig());h.name=ya(l,a,h.name),h.id=i.Tools.generateRandomId();const S={index:l.getSheetIndex(d)+1,sheet:h,unitId:c},C=Vn(s,S),v=r.onCommandExecute({id:Ln.id,params:{unitId:c,subUnitId:m,targetSubUnitId:h.id}}),I=[...(M=v.preRedos)!=null?M:[],{id:ot.id,params:S},...v.redos],w=[...(y=v.preUndos)!=null?y:[],{id:Ye.id,params:C},...v.undos];return i.sequenceExecute(I,t).result?(n.pushUndoRedo({unitID:c,undoMutations:w,redoMutations:I}),!0):!1}};function ya(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 $e={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)=>{l.setValue(c,m,h)}),new i.ObjectMatrix(n.value).forValue((c,m,h)=>{d.setValue(c,m,h)}),!0}};function Ut(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?Ut(r,e,t):r}function _a(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 ba(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 ne(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 _e=(s,e,t)=>({id:q.id,params:{unitId:e.getUnitId(),subUnitId:t.getSheetId(),reveal:!0,selections:[{range:s,primary:ne(s,t)}]}});function Ea(s){if(!s)return!1;const{range:e,primary:t}=s;return i.Rectangle.equals(e,t)}function Ta(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 po=s=>s.id!==no;function Ne(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,po):s.getCellWithFilteredInterceptors(l,a,so,po);!c||!c.s||(u[l]||(u[l]={}),u[l][d]={s:c.s})}return u}var Ua=Object.getOwnPropertyDescriptor,Pa=(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},ka=(s,e)=>(t,n)=>e(t,n,s);const wo=i.createIdentifier("sheets-formula.ref-selections.service");g.RefSelectionsService=class extends g.SheetsSelectionsService{constructor(e){super(e)}_init(){const e=this._getAliveWorkbooks$().pipe(V.takeUntil(this.dispose$));this.selectionMoveStart$=e.pipe(V.switchMap(t=>V.merge(...t.map(n=>n.selectionMoveStart$)))),this.selectionMoving$=e.pipe(V.switchMap(t=>V.merge(...t.map(n=>n.selectionMoving$)))),this.selectionMoveEnd$=e.pipe(V.switchMap(t=>V.merge(...t.map(n=>n.selectionMoveEnd$)))),this.selectionSet$=e.pipe(V.switchMap(t=>V.merge(...t.map(n=>n.selectionSet$))))}_getAliveWorkbooks$(){const e=this._instanceSrv.getAllUnitsForType(i.UniverInstanceType.UNIVER_SHEET);e.forEach(n=>this._ensureWorkbookSelection(n.getUnitId()));const t=new V.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(V.map(n=>n.map(o=>this._ensureWorkbookSelection(o.getUnitId()))))}},g.RefSelectionsService=Pa([ka(0,i.IUniverInstanceService)],g.RefSelectionsService);function Mo(s,e){const n=s.get(i.IContextService).getContextValue(vo);return s.get(n&&!e?wo: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 Mo(s).setSelections(o,r,[...t],n),!0}},yo={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=T(s.get(i.IUniverInstanceService),e);if(!a)return!1;const u=[{range:o,primary:ne(o,a.worksheet),style:null}];return r.syncExecuteCommand(q.id,{unitId:t,subUnitId:n,selections:u})}},_o="sheet.command.move-range",qe={type:i.CommandType.COMMAND,id:_o,handler:async(s,e)=>{var y,b;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=T(o);if(!l||!await u.beforeCommandExecute({id:qe.id,params:e}))return!1;const{worksheet:c,subUnitId:m,unitId:h}=l,R=nn(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 S=u.onCommandExecute({id:qe.id,params:e}),C=[...(y=S.preRedos)!=null?y:[],...R.redos,...S.redos,{id:q.id,params:{unitId:h,subUnitId:m,selections:[{range:e.toRange,primary:Oa(e.fromRange,e.toRange,c)}],type:te.MOVE_END}}],v=[...(b=S.preUndos)!=null?b:[],...R.undos,...S.undos,{id:q.id,params:{unitId:h,subUnitId:m,selections:[{range:e.fromRange,primary:ne(e.fromRange,c)}],type:te.MOVE_END}}],I=i.sequenceExecute(C,t).result,{undos:w,redos:p}=u.generateMutationsOfAutoHeight({unitId:h,subUnitId:m,ranges:[e.fromRange,e.toRange]}),M=u.afterCommandExecute({id:qe.id,params:e});return I?(i.sequenceExecute([...M.redos,...p],t),n.pushUndoRedo({unitID:h,undoMutations:[...v,...M.undos,...w],redoMutations:[...C,...M.redos,...p]}),!0):!1}};function nn(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),S=h==null?void 0:h.getSheetBySheetId(u),C=R==null?void 0:R.getCellMatrix(),v=S==null?void 0:S.getCellMatrix();if(R&&S&&C&&v){const I=Ut(d,R,!1);if(!i.Rectangle.equals(d,I)&&!n)return null;const w=new i.ObjectMatrix,p=new i.ObjectMatrix,M=new i.ObjectMatrix;i.Range.foreach(a,(P,E)=>{const k=v.getValue(P,E);if(w.setValue(P,E,i.Tools.deepClone(k)),k){const W=h==null?void 0:h.getStyles().get(k.s);M.setValue(P,E,i.Tools.deepClone(W))}p.setValue(P,E,null)});const y=new i.ObjectMatrix,b=new i.ObjectMatrix;i.Range.foreach(d,(P,E)=>{y.setValue(P,E,i.Tools.deepClone(C.getValue(P,E)))}),i.Range.foreach(a,(P,E)=>{const k=i.cellToRange(P,E),W=i.Rectangle.getRelativeRange(k,a),A=i.Rectangle.getPositionRange(W,d),L=i.Tools.deepClone(M.getValue(P,E)),j=i.Tools.deepClone(w.getValue(P,E));j&&L&&(j.s=L),b.setValue(A.startRow,A.startColumn,j)});const O={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:w.getMatrix(),subUnitId:u},to:{value:y.getMatrix(),subUnitId:c},unitId:l};o.push({id:$e.id,params:O}),r.push({id:$e.id,params:U})}return{redos:o,undos:r}}function Oa(s,e,t){const n=s.startRow,o=s.startColumn,r=t.getMergedCell(n,o),a=ne(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 sn=(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))(sn||{}),_=(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))(_||{}),N=(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))(N||{});class he{constructor(e,t,n){f(this,"type",N.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=`${N.SelectRange}.${_.Edit}.${n}`}}class on{constructor(e,t,n){f(this,"type",N.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=`${N.SelectRange}.${_.View}.${n}`}}class $n{constructor(e){f(this,"id");f(this,"value",!0);f(this,"type",N.Workbook);f(this,"status",i.PermissionStatus.INIT);f(this,"subType",_.Comment);this.unitId=e,this.unitId=e,this.id=`${this.type}.${_.Comment}_${e}`}}class Hn{constructor(e){f(this,"id");f(this,"value",!0);f(this,"type",N.Workbook);f(this,"status",i.PermissionStatus.INIT);f(this,"subType",_.Copy);this.unitId=e,this.unitId=e,this.id=`${this.type}.${_.Copy}_${e}`}}class bo{constructor(e){f(this,"id");f(this,"value",!0);f(this,"type",N.Workbook);f(this,"subType",_.CopySheet);f(this,"status",i.PermissionStatus.INIT);this.unitId=e,this.unitId=e,this.id=`${this.type}.${_.CopySheet}_${e}`}}class Bn{constructor(e){f(this,"id");f(this,"value",!0);f(this,"type",N.Workbook);f(this,"status",i.PermissionStatus.INIT);f(this,"subType",_.CreatePermissionObject);this.unitId=e,this.unitId=e,this.id=`${this.type}.${_.CreatePermissionObject}_${e}`}}class jn{constructor(e){f(this,"id");f(this,"value",!0);f(this,"type",N.Workbook);f(this,"status",i.PermissionStatus.INIT);f(this,"subType",_.CreateSheet);this.unitId=e,this.unitId=e,this.id=`${this.type}.${_.CreateSheet}_${e}`}}class Fn{constructor(e){f(this,"id");f(this,"value",!0);f(this,"type",N.Workbook);f(this,"status",i.PermissionStatus.INIT);f(this,"subType",_.DeleteSheet);this.unitId=e,this.unitId=e,this.id=`${this.type}.${_.DeleteSheet}_${e}`}}class Gn{constructor(e){f(this,"id");f(this,"value",!0);f(this,"type",N.Workbook);f(this,"status",i.PermissionStatus.INIT);f(this,"subType",_.Duplicate);this.unitId=e,this.unitId=e,this.id=`${this.type}.${_.Duplicate}_${e}`}}class le{constructor(e){f(this,"id");f(this,"value",!0);f(this,"type",N.Workbook);f(this,"status",i.PermissionStatus.INIT);f(this,"subType",_.Edit);this.unitId=e,this.unitId=e,this.id=`${this.type}.${_.Edit}_${e}`}}class zn{constructor(e){f(this,"id");f(this,"value",!0);f(this,"type",N.Workbook);f(this,"status",i.PermissionStatus.INIT);f(this,"subType",_.Export);this.unitId=e,this.unitId=e,this.id=`${this.type}.${_.Export}_${e}`}}class rn{constructor(e){f(this,"id");f(this,"value",!0);f(this,"type",N.Workbook);f(this,"status",i.PermissionStatus.INIT);f(this,"subType",_.HideSheet);this.unitId=e,this.unitId=e,this.id=`${this.type}.${_.HideSheet}_${e}`}}class Eo{constructor(e){f(this,"id");f(this,"value",!0);f(this,"type",N.Workbook);f(this,"status",i.PermissionStatus.INIT);f(this,"subType",_.History);this.unitId=e,this.unitId=e,this.id=`${this.type}.${_.History}_${e}`}}class an{constructor(e){f(this,"id");f(this,"value",!0);f(this,"type",N.Workbook);f(this,"status",i.PermissionStatus.INIT);f(this,"subType",_.ManageCollaborator);this.unitId=e,this.unitId=e,this.id=`${this.type}.${_.ManageCollaborator}_${e}`}}class un{constructor(e){f(this,"id");f(this,"value",!0);f(this,"type",N.Workbook);f(this,"status",i.PermissionStatus.INIT);f(this,"subType",_.MoveSheet);this.unitId=e,this.unitId=e,this.id=`${this.type}.${_.MoveSheet}_${e}`}}class Yn{constructor(e){f(this,"id");f(this,"value",!0);f(this,"type",N.Workbook);f(this,"status",i.PermissionStatus.INIT);f(this,"subType",_.Print);this.unitId=e,this.unitId=e,this.id=`${this.type}.${_.Print}_${e}`}}class qn{constructor(e){f(this,"id");f(this,"value",!0);f(this,"type",N.Workbook);f(this,"status",i.PermissionStatus.INIT);f(this,"subType",_.RecoverHistory);this.unitId=e,this.unitId=e,this.id=`${this.type}.${_.RecoverHistory}_${e}`}}class ln{constructor(e){f(this,"id");f(this,"value",!0);f(this,"type",N.Workbook);f(this,"status",i.PermissionStatus.INIT);f(this,"subType",_.RenameSheet);this.unitId=e,this.unitId=e,this.id=`${this.type}.${_.RenameSheet}_${e}`}}class Kn{constructor(e){f(this,"id");f(this,"value",!0);f(this,"type",N.Workbook);f(this,"status",i.PermissionStatus.INIT);f(this,"subType",_.Share);this.unitId=e,this.unitId=e,this.id=`${this.type}.${_.Share}_${e}`}}class Jn{constructor(e){f(this,"id");f(this,"value",!0);f(this,"type",N.Workbook);f(this,"status",i.PermissionStatus.INIT);f(this,"subType",_.View);this.unitId=e,this.unitId=e,this.id=`${this.type}.${_.View}_${e}`}}class Xn{constructor(e){f(this,"id");f(this,"value",!0);f(this,"type",N.Workbook);f(this,"status",i.PermissionStatus.INIT);f(this,"subType",_.ViewHistory);this.unitId=e,this.unitId=e,this.id=`${this.type}.${_.ViewHistory}_${e}`}}class Zn{constructor(e,t){f(this,"value",!0);f(this,"type",N.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 Qn{constructor(e,t){f(this,"value",!0);f(this,"type",N.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 xn{constructor(e,t){f(this,"value",!0);f(this,"type",N.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 es{constructor(e,t){f(this,"value",!0);f(this,"type",N.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 ge{constructor(e,t){f(this,"value",!0);f(this,"type",N.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 ts{constructor(e,t){f(this,"value",!0);f(this,"type",N.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 ns{constructor(e,t){f(this,"value",!0);f(this,"type",N.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 ss{constructor(e,t){f(this,"value",!0);f(this,"type",N.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 os{constructor(e,t){f(this,"value",!0);f(this,"type",N.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",N.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 is{constructor(e,t){f(this,"value",!0);f(this,"type",N.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 as{constructor(e,t){f(this,"value",!0);f(this,"type",N.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 Na{constructor(e,t){f(this,"value",!0);f(this,"type",N.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 Da{constructor(e,t){f(this,"value",!0);f(this,"type",N.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 us{constructor(e,t){f(this,"value",!0);f(this,"type",N.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 Pt{constructor(e,t){f(this,"value",!0);f(this,"type",N.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 rt{constructor(e,t){f(this,"value",!0);f(this,"type",N.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 it{constructor(e,t){f(this,"value",!0);f(this,"type",N.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 ls{constructor(e,t){f(this,"value",!0);f(this,"type",N.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 kt{constructor(e,t){f(this,"value",!0);f(this,"type",N.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 at={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=T(o,e);if(!l)return!1;const{subUnitId:d,unitId:c,workbook:m,worksheet:h}=l,{value:R,range:S,redoUndoId:C}=e,v=S?[S]:(W=r.getCurrentSelections())==null?void 0:W.map(A=>A.range);if(!v||!v.length||!u.getPermissionPoint(new ge(c,d).id))return!1;const I=new i.ObjectMatrix;let w;if(i.Tools.isArray(R))for(let A=0;A<v.length;A++){const{startRow:L,startColumn:j,endRow:K,endColumn:z}=v[A];for(let J=0;J<=K-L;J++)for(let se=0;se<=z-j;se++)I.setValue(J+L,se+j,R[J][se])}else if(i.isICellData(R))for(let A=0;A<v.length;A++){const{startRow:L,startColumn:j,endRow:K,endColumn:z}=v[A];for(let J=L;J<=K;J++)for(let se=j;se<=z;se++)I.setValue(J,se,R)}else w=R;const p={subUnitId:d,unitId:c,cellValue:w!=null?w:I.getMatrix()},M=ue(s,p),y=i.mapObjectMatrix(p.cellValue,(A,L)=>h.getCellHeight(A,L)||void 0);if(!t.syncExecuteCommand(B.id,p))return!1;const{undos:O,redos:U}=a.onCommandExecute({id:at.id,params:p}),{undos:P,redos:E}=a.generateMutationsOfAutoHeight({unitId:c,subUnitId:d,ranges:v,cellHeights:new i.ObjectMatrix(y)});if(i.sequenceExecute([...U,...E],t).result){const A=_e(S!=null?S:I.getRange(),m,h);return n.pushUndoRedo({unitID:c,undoMutations:[{id:B.id,params:M},...O,...P,A],redoMutations:[{id:B.id,params:p},...U,...E,i.Tools.deepClone(A)],id:C}),!0}return!1}};function ds(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(),S=R.getDataRange();if(a.startColumn<=S.endColumn||a.startRow<=S.endRow){let p,M;if(u===i.Dimension.COLUMNS){const b=Math.min(a.endRow,S.endRow);let O=0;for(let P=a.startRow;P<=b;P++){const E=R.getRow(P),k=E?i.getArrayLength(E)-1:0;O=Math.max(O,k)}p={startRow:a.startRow,startColumn:a.startColumn,endRow:b,endColumn:O};const U=a.endColumn-a.startColumn+1;M={startRow:a.startRow,startColumn:p.startColumn+U,endRow:b,endColumn:p.endColumn+U}}else{const b=Math.min(a.endColumn,S.endColumn),O=S.endRow;p={startRow:a.startRow,startColumn:a.startColumn,endRow:O,endColumn:b};const U=a.endRow-a.startRow+1;M={startRow:p.startRow+U,startColumn:a.startColumn,endRow:p.endRow+U,endColumn:b}}const y=nn(s,{unitId:o,subUnitId:r,range:p},{subUnitId:r,range:M},!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 M=a.startColumn;M<=a.endColumn;M++)l[p][M]=null}const C={subUnitId:r,unitId:o,cellValue:l},v=ue(s,C),{undos:I,redos:w}=c.onCommandExecute({id:at.id,params:{...C,range:a}});t.push({id:B.id,params:C},...w),n.push({id:B.id,params:v},...I)}return{redo:t,undo:n}}function cs(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(),S={subUnitId:r,unitId:o,cellValue:Wn([a])},C=ue(s,S),v=d.onCommandExecute({id:at.id,params:S});if(t.push({id:B.id,params:S},...v.redos),n.push(...v.undos,{id:B.id,params:C}),a.startColumn<=R.endColumn||a.startRow<=R.endRow){let I=null,w=null;if(u===i.Dimension.COLUMNS&&a.endColumn<R.endColumn){const p=Math.min(a.endRow,R.endRow);let M=0;for(let b=a.startRow;b<=p;b++){const O=h.getRow(b),U=O?i.getArrayLength(O)-1:0;M=Math.max(M,U)}I={startRow:a.startRow,startColumn:a.endColumn+1,endRow:p,endColumn:M};const y=a.endColumn-a.startColumn+1;w={startRow:a.startRow,startColumn:I.startColumn-y,endRow:p,endColumn:I.endColumn-y}}if(u===i.Dimension.ROWS&&a.endRow<R.endRow){const p=Math.min(a.endColumn,R.endColumn),M=R.endRow;I={startRow:a.endRow+1,startColumn:a.startColumn,endRow:M,endColumn:p};const y=a.endRow-a.startRow+1;w={startRow:I.startRow-y,startColumn:a.startColumn,endRow:I.endRow-y,endColumn:p}}if(I&&w){const p=nn(s,{unitId:o,subUnitId:r,range:I},{subUnitId:r,range:w},!0);p&&(t.push(...p.redos),n.push(...p.undos))}}}return{redo:t,undo:n}}function Aa(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 Wa(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 To="sheet.command.delete-range-move-left",Ke={type:i.CommandType.COMMAND,id:To,handler:async(s,e)=>{var M,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=T(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=(M=r.getCurrentLastSelection())==null?void 0:M.range),!h)return!1;const R={range:h,subUnitId:c,unitId:m,shiftDimension:i.Dimension.COLUMNS},S=a.onCommandExecute({id:Ke.id,params:{range:h}}),{redo:C,undo:v}=cs(s,R),I=[...(y=S.preRedos)!=null?y:[],...C],w=[...S.undos,...v];return I.push(...S.redos),I.push(_e(h,d,l)),w.push(...(b=S.preUndos)!=null?b:[]),i.sequenceExecute(I,t).result?(n.pushUndoRedo({unitID:m,undoMutations:w.reverse(),redoMutations:I}),!0):!1}},Uo="sheet.command.delete-range-move-up",Je={type:i.CommandType.COMMAND,id:Uo,handler:async(s,e)=>{var M,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=T(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=(M=r.getCurrentLastSelection())==null?void 0:M.range),!h)return!1;const R={range:h,subUnitId:d,unitId:l,shiftDimension:i.Dimension.ROWS},S=a.onCommandExecute({id:Je.id,params:{range:h}}),{redo:C,undo:v}=cs(s,R),I=[...(y=S.preRedos)!=null?y:[],...C],w=[...S.undos,...v];return I.push(...S.redos),I.push(_e(h,c,m)),w.push(...(b=S.preUndos)!=null?b:[]),i.sequenceExecute(I,t).result?(n.pushUndoRedo({unitID:l,undoMutations:w.reverse(),redoMutations:I}),!0):!1}},Po={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(Me.id,u)&&n.pushUndoRedo({unitID:o,redoMutations:[{id:Me.id,params:u}],undoMutations:[{id:ce.id,params:{unitId:o,subUnitId:r,rules:[a]}}]}),!0}},ko={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(ze.id,{unitId:r,subUnitId:a});const u=[{id:ze.id,params:{unitId:r,subUnitId:a}}],l=[{id:Le.id,params:{unitId:r,rule:o,subUnitId:a}}];return n.pushUndoRedo({unitID:r,redoMutations:u,undoMutations:l}),!0}},Oo={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(st.id,e)?(n.pushUndoRedo({unitID:o,undoMutations:[{id:nt.id,params:r}],redoMutations:[{id:st.id,params:e}]}),!0):!1}},No={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(Y.SetDefinedNameMutation.id,o)?(n.pushUndoRedo({unitID:e.unitId,undoMutations:[{id:Y.RemoveDefinedNameMutation.id,params:o}],redoMutations:[{id:Y.SetDefinedNameMutation.id,params:o}]}),!0):!1}},Va="sheet.command.insert-range-move-down",ut={type:i.CommandType.COMMAND,id:"sheet.command.insert-range-move-down",handler:async(s,e)=>{var W,A,L;const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),o=s.get(i.IUniverInstanceService),r=s.get(g.SheetsSelectionsService),a=s.get(g.SheetInterceptorService),u=s.get(i.ErrorService),l=s.get(i.LocaleService);if(r.isOverlapping())return u.emit(l.t("sheets.info.overlappingSelections")),!1;const d=T(o);if(!d)return!1;const{unitId:c,subUnitId:m,worksheet:h,workbook:R}=d;let S=e==null?void 0:e.range;if(S||(S=(W=r.getCurrentLastSelection())==null?void 0:W.range),!S)return!1;const C=[],v=[],I=h.getCellMatrix(),w=I.getDataRange(),M=I.getSlice(w.startRow,w.endRow,S.startColumn,S.endColumn).getDataRange().endRow,y=Math.max(M+(S.endRow-S.startRow+1)-w.endRow,0);if(y>0){const j=S.startRow-1,K=h.getRowHeight(j),z={unitId:c,subUnitId:m,range:{startRow:w.endRow+1,endRow:w.endRow+y,startColumn:w.startColumn,endColumn:w.endColumn},rowInfo:new Array(y).fill(void 0).map(()=>({h:K,hd:i.BooleanNumber.FALSE}))};C.push({id:ve.id,params:z});const J=Zt(s,z);v.push({id:Ie.id,params:J})}const b={};i.Range.foreach(S,(j,K)=>{const z=h.getCell(j,K);z&&(b[j]||(b[j]={}),b[j][K]={s:z.s})});const O={range:S,subUnitId:m,unitId:c,shiftDimension:i.Dimension.ROWS,cellValue:b},{redo:U,undo:P}=ds(s,O);C.push(...U),v.push(...P);const E=a.onCommandExecute({id:ut.id,params:{range:S}});return C.push(...E.redos),C.push(_e(S,R,h)),v.push(...(A=E.preUndos)!=null?A:[]),C.unshift(...(L=E.preRedos)!=null?L:[]),v.unshift(...E.undos),i.sequenceExecute(C,t)?(n.pushUndoRedo({unitID:c,undoMutations:v.reverse(),redoMutations:C}),!0):!1}},ms="sheet.command.insert-range-move-right",Ot={type:i.CommandType.COMMAND,id:ms,handler:async(s,e)=>{var W,A,L;const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),o=s.get(i.IUniverInstanceService),r=s.get(g.SheetsSelectionsService),a=s.get(g.SheetInterceptorService),u=s.get(i.ErrorService),l=s.get(i.LocaleService);if(r.isOverlapping())return u.emit(l.t("sheets.info.overlappingSelections")),!1;const d=T(o);if(!d)return!1;const{workbook:c,worksheet:m,unitId:h,subUnitId:R}=d;let S=e==null?void 0:e.range;if(S||(S=(W=r.getCurrentLastSelection())==null?void 0:W.range),!S)return!1;const C=[],v=[],I=m.getCellMatrix(),w=I.getDataRange(),M=I.getSlice(S.startRow,S.endRow,w.startColumn,w.endColumn).getDataRange().endColumn,y=Math.max(M+(S.endColumn-S.startColumn+1)-w.endColumn,0);if(y>0){const j=S.startColumn-1,K=m.getColumnWidth(j),z={unitId:h,subUnitId:R,range:{startRow:w.startRow+1,endRow:w.endRow,startColumn:w.endColumn+1,endColumn:w.endColumn+y},colInfo:new Array(y).fill(void 0).map(()=>({w:K,hd:i.BooleanNumber.FALSE}))};C.push({id:me.id,params:z});const J=Et(s,z);v.push({id:ae.id,params:J})}const b={};i.Range.foreach(S,(j,K)=>{const z=m.getCell(j,K);!z||!z.s||(b[j]||(b[j]={}),b[j][K]={s:z.s})});const O={range:S,subUnitId:R,unitId:h,shiftDimension:i.Dimension.COLUMNS,cellValue:b},{redo:U,undo:P}=ds(s,O);C.push(...U),v.push(...P);const E=a.onCommandExecute({id:Ot.id,params:{range:S}});return C.push(...E.redos),C.push(_e(S,c,m)),v.push(...(A=E.preUndos)!=null?A:[]),C.unshift(...(L=E.preRedos)!=null?L:[]),v.unshift(...E.undos),i.sequenceExecute(C,t).result?(n.pushUndoRedo({unitID:h,undoMutations:v.reverse(),redoMutations:C}),!0):!1}},Do="sheet.command.insert-row",be={type:i.CommandType.COMMAND,id:Do,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:be.id,params:e})?t.syncExecuteCommand(hs.id,{range:o,direction:r,unitId:a,subUnitId:u,cellValue:l}):!1}},hs={type:i.CommandType.COMMAND,id:"sheet.command.insert-row-by-range",handler:(s,e)=>{var U,P,E,k;const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),o=s.get(i.IUniverInstanceService),r=s.get(g.SheetInterceptorService),a=T(o,e);if(!a)return!1;const{workbook:u,worksheet:l}=a,{range:d,direction:c,unitId:m,subUnitId:h,cellValue:R}=e,{startRow:S,endRow:C}=d;d.rangeType=i.RANGE_TYPE.ROW;const v=c===i.Direction.UP?S:S-1,I=l.getRowHeight(v),w={unitId:m,subUnitId:h,range:d,rowInfo:new Array(C-S+1).fill(void 0).map(()=>({h:I,hd:i.BooleanNumber.FALSE}))},p=Zt(s,w),M=[{id:ve.id,params:w}],y=[{id:Ie.id,params:p}];R&&Object.keys(R).length>0&&M.push({id:B.id,params:{unitId:m,subUnitId:h,cellValue:R}});const b=r.onCommandExecute({id:be.id,params:e});return M.unshift(...(U=b.preRedos)!=null?U:[]),M.push(...(P=b.redos)!=null?P:[]),M.push(_e(d,u,l)),y.unshift(...(E=b.preUndos)!=null?E:[]),y.push(...(k=b.undos)!=null?k:[]),i.sequenceExecute(M,t).result?(n.pushUndoRedo({unitID:e.unitId,undoMutations:y,redoMutations:M}),!0):!1}},Ao={type:i.CommandType.COMMAND,id:"sheet.command.insert-row-before",handler:async s=>{var S;const t=(S=s.get(g.SheetsSelectionsService).getCurrentSelections())==null?void 0:S.map(C=>C.range);let n;if((t==null?void 0:t.length)===1)n=t[0];else return!1;const o=s.get(i.IUniverInstanceService),r=T(o);if(!r)return!1;const{worksheet:a,subUnitId:u,unitId:l}=r,{startRow:d,endRow:c}=n,m=0,h=a.getColumnCount()-1,R={unitId:l,subUnitId:u,direction:i.Direction.UP,range:{startRow:d,endRow:c,startColumn:m,endColumn:h},cellValue:Ne(a,d,c,m,h,!0,d-1)};return s.get(i.ICommandService).executeCommand(be.id,R)}},Wo={type:i.CommandType.COMMAND,id:"sheet.command.insert-row-after",handler:async s=>{var C;const t=(C=s.get(g.SheetsSelectionsService).getCurrentSelections())==null?void 0:C.map(v=>v.range);let n;if((t==null?void 0:t.length)===1)n=t[0];else return!1;const o=s.get(i.IUniverInstanceService),r=T(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,S={unitId:u,subUnitId:l,direction:i.Direction.DOWN,range:{startRow:c,endRow:m,startColumn:h,endColumn:R,rangeType:i.RANGE_TYPE.ROW},cellValue:Ne(a,c,m,h,R,!0,n.endRow)};return s.get(i.ICommandService).executeCommand(be.id,S)}},Vo={type:i.CommandType.COMMAND,id:"sheet.command.insert-multi-rows-above",handler:async(s,e)=>{var I;const n=(I=s.get(g.SheetsSelectionsService).getCurrentSelections())==null?void 0:I.map(w=>w.range);let o;if((n==null?void 0:n.length)===1)o=n[0];else return!1;const r=s.get(i.IUniverInstanceService),a=T(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,S=u.getColumnCount()-1,C=Ne(u,m,h,R,S,!0,m-1),v={unitId:l,subUnitId:d,direction:i.Direction.UP,range:{startRow:m,endRow:h,startColumn:R,endColumn:S,rangeType:i.RANGE_TYPE.ROW},cellValue:C};return s.get(i.ICommandService).executeCommand(be.id,v)}},Lo={type:i.CommandType.COMMAND,id:"sheet.command.insert-multi-rows-after",handler:async(s,e)=>{var v;const n=(v=s.get(g.SheetsSelectionsService).getCurrentSelections())==null?void 0:v.map(I=>I.range);let o;if((n==null?void 0:n.length)===1)o=n[0];else return!1;const r=s.get(i.IUniverInstanceService),a=T(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,S=u.getColumnCount()-1,C={unitId:l,subUnitId:d,direction:i.Direction.DOWN,range:{startRow:m,endRow:h,startColumn:R,endColumn:S,rangeType:i.RANGE_TYPE.ROW},cellValue:Ne(u,m,h,R,S,!0,o.endRow)};return s.get(i.ICommandService).executeCommand(be.id,C)}},$o="sheet.command.insert-col",Ee={type:i.CommandType.COMMAND,id:$o,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:Ee.id,params:e})?t.syncExecuteCommand(gs.id,{range:o,direction:r,unitId:u,subUnitId:a,cellValue:l}):!1}},gs={type:i.CommandType.COMMAND,id:"sheet.command.insert-col-by-range",handler:(s,e)=>{var O,U,P,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),S=R.getSheetBySheetId(e.subUnitId),C=u===i.Direction.LEFT?m:m-1,v=S.getColumnWidth(C),I={unitId:d,subUnitId:l,range:a,colInfo:new Array(h-m+1).fill(void 0).map(()=>({w:v,hd:i.BooleanNumber.FALSE}))},w=Et(s,I),p=[{id:me.id,params:I}],M=[{id:ae.id,params:w}];c&&p.push({id:B.id,params:{unitId:d,subUnitId:l,cellValue:c}});const y=r.onCommandExecute({id:Ee.id,params:e});return p.unshift(...(O=y.preRedos)!=null?O:[]),p.push(...(U=y.redos)!=null?U:[]),p.push(_e(a,R,S)),M.unshift(...(P=y.preUndos)!=null?P:[]),M.push(...(E=y.undos)!=null?E:[]),i.sequenceExecute(p,t).result?(n.pushUndoRedo({unitID:e.unitId,undoMutations:M.filter(Boolean),redoMutations:p.filter(Boolean)}),!0):!1}},Ho={type:i.CommandType.COMMAND,id:"sheet.command.insert-col-before",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=T(o);if(!r)return!1;const{worksheet:a,unitId:u,subUnitId:l}=r,{startColumn:d,endColumn:c}=n,m=0,h=a.getRowCount()-1,R={unitId:u,subUnitId:l,direction:i.Direction.LEFT,range:{startColumn:d,endColumn:c,startRow:m,endRow:h,rangeType:i.RANGE_TYPE.COLUMN},cellValue:Ne(a,m,h,d,c,!1,d-1)};return s.get(i.ICommandService).executeCommand(Ee.id,R)}},Bo={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=T(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,S={unitId:u,subUnitId:l,direction:i.Direction.RIGHT,range:{startColumn:c,endColumn:m,startRow:h,endRow:R},cellValue:Ne(a,h,R,c,m,!1,n.endColumn)};return s.get(i.ICommandService).executeCommand(Ee.id,S)}},jo={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=T(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,S=u.getRowCount()-1,C={unitId:l,subUnitId:d,direction:i.Direction.LEFT,range:{startColumn:m,endColumn:h,startRow:R,endRow:S,rangeType:i.RANGE_TYPE.COLUMN},cellValue:Ne(u,R,S,m,h,!1,m-1)};return s.get(i.ICommandService).executeCommand(Ee.id,C)}},Fo={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=T(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,S=u.getRowCount()-1,C={unitId:l,subUnitId:d,direction:i.Direction.RIGHT,range:{startColumn:m,endColumn:h,startRow:R,endRow:S},cellValue:Ne(u,R,S,m,h,!1,o.endColumn)};return s.get(i.ICommandService).executeCommand(Ee.id,C)}},Go={id:"sheet.command.insert-sheet",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(i.LocaleService),a=ao(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=(v=e.index)!=null?v:d,h.id=m||i.Tools.generateRandomId(),h.name=(c==null?void 0:c.name)||l.generateNewSheetName(`${r.t("sheets.tabs.sheet")}`)):(h.id=i.Tools.generateRandomId(),h.name=l.generateNewSheetName(`${r.t("sheets.tabs.sheet")}`));const R={index:d,sheet:h,unitId:u},S=Vn(s,R);return t.syncExecuteCommand(ot.id,R)?(n.pushUndoRedo({unitID:u,undoMutations:[{id:Ye.id,params:S}],redoMutations:[{id:ot.id,params:R}]}),!0):!1}};function zo(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 De={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 Yo(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 Ae={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}};function La(s,e){return e.getMergeData().some(t=>t.startRow<s&&s<=t.endRow)}function $a(s,e){return e.getMergeData().some(t=>t.startColumn<s&&s<=t.endColumn)}const qo="sheet.command.move-rows",Nt={id:qo,type:i.CommandType.COMMAND,handler:(s,e)=>{var W,A;const t=s.get(g.SheetsSelectionsService),{fromRange:{startRow:n},toRange:{startRow:o},range:r}=e,a=r?[Jo(r)]:t.getCurrentSelections(),u=a==null?void 0:a.filter(L=>L.range.rangeType===i.RANGE_TYPE.ROW&&L.range.startRow<=n&&n<=L.range.endRow);if((u==null?void 0:u.length)!==1)return!1;const l=s.get(g.SheetInterceptorService),d=s.get(i.IUniverInstanceService),c=T(d,e);if(!c)return!1;const{workbook:m,worksheet:h}=c,R=m.getUnitId(),S=h.getSheetId(),C=s.get(i.ErrorService),v=s.get(i.LocaleService),I=u[0].range,w=u[0].primary,p=Ut(I,h,!1);if(!i.Rectangle.equals(I,p))return C.emit(v.t("sheets.info.partOfCell")),!1;if(La(o,h))return C.emit(v.t("sheets.info.acrossMergedCell")),!1;const M={...I,startRow:o,endRow:o+I.endRow-I.startRow},y={unitId:R,subUnitId:S,sourceRange:I,targetRange:M},b=zo(s,y),O=s.get(i.ICommandService),U=l.onCommandExecute({id:Nt.id,params:e}),P=[...(W=U.preRedos)!=null?W:[],{id:De.id,params:y}],E=[...(A=U.preUndos)!=null?A:[],{id:De.id,params:b}];if(w){const j=o-n<0,K=I.endRow-I.startRow+1,z=j?M:{...M,startRow:M.startRow-K,endRow:M.endRow-K},J={unitId:R,subUnitId:S,type:te.MOVE_END,selections:[{range:z,primary:ne(z,h),style:null}]},se={unitId:R,subUnitId:S,type:te.MOVE_END,selections:[{range:I,primary:w,style:null}]};P.push({id:q.id,params:J}),E.push({id:q.id,params:se})}return P.push(...U.redos),E.push(...U.undos),i.sequenceExecute(P,O).result?(s.get(i.IUndoRedoService).pushUndoRedo({unitID:R,undoMutations:E,redoMutations:P}),!0):!1}},Ko="sheet.command.move-cols",Dt={id:Ko,type:i.CommandType.COMMAND,handler:(s,e)=>{var W,A;const t=s.get(g.SheetsSelectionsService),{fromRange:{startColumn:n},toRange:{startColumn:o},range:r}=e,a=r?[Jo(r)]:t.getCurrentSelections(),u=a==null?void 0:a.filter(L=>L.range.rangeType===i.RANGE_TYPE.COLUMN&&L.range.startColumn<=n&&n<=L.range.endColumn);if((u==null?void 0:u.length)!==1)return!1;const l=s.get(g.SheetInterceptorService),d=s.get(i.IUniverInstanceService),c=T(d,e);if(!c)return!1;const{workbook:m,worksheet:h}=c,R=m.getUnitId(),S=h.getSheetId(),C=s.get(i.ErrorService),v=s.get(i.LocaleService),I=u[0].range,w=u[0].primary,p=Ut(I,h,!1);if(!i.Rectangle.equals(I,p))return C.emit(v.t("sheets.info.partOfCell")),!1;if($a(o,h))return C.emit(v.t("sheets.info.acrossMergedCell")),!1;const M={...I,startColumn:o,endColumn:o+I.endColumn-I.startColumn},y={unitId:R,subUnitId:S,sourceRange:I,targetRange:M},b=Yo(s,y),O=s.get(i.ICommandService),U=l.onCommandExecute({id:Dt.id,params:e}),P=[...(W=U.preRedos)!=null?W:[],{id:Ae.id,params:y}],E=[...(A=U.preUndos)!=null?A:[],{id:Ae.id,params:b}];if(w){const L=I.endColumn-I.startColumn+1,z=o-n<0?M:{...M,startColumn:M.startColumn-L,endColumn:M.endColumn-L},J={unitId:R,subUnitId:S,type:te.MOVE_END,selections:[{range:z,primary:ne(z,h),style:null}]},se={unitId:R,subUnitId:S,type:te.MOVE_END,selections:[{range:I,primary:w,style:null}]};P.push({id:q.id,params:J}),E.push({id:q.id,params:se})}return P.push(...U.redos),E.push(...U.undos),i.sequenceExecute(P,O).result&&s.get(i.IUndoRedoService).pushUndoRedo({unitID:R,undoMutations:E,redoMutations:P}),!0}};function Jo(s){return{range:s,primary:null,style:null}}const lt={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=T(r),u=s.get(g.SheetRangeThemeModel);if(!a)return!1;const l=new Oe(o,n);return u.registerRangeThemeStyle(t,l),!0}},dn={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=T(o),a=s.get(g.SheetRangeThemeModel);return r?(a.unregisterRangeThemeStyle(t,n),!0):!1}},Xo={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(!T(o))return!1;const l={unitId:t,themeName:n.getName(),rangeThemeStyleJson:n.toJson()},d={unitId:t,themeName:n.getName()};return r.syncExecuteCommand(lt.id,l)&&a.pushUndoRedo({unitID:t,undoMutations:[{id:dn.id,params:d}],redoMutations:[{id:lt.id,params:l}]}),!0}},Rs={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:Rs.id,params:e}),u=[...(c=a.preRedos)!=null?c:[],{id:Y.RemoveDefinedNameMutation.id,params:r},...a.redos],l=[...(m=a.preUndos)!=null?m:[],{id:Y.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}},Ss="sheet.command.remove-row",Cs={type:i.CommandType.COMMAND,id:"sheet.command.remove-row-by-range",handler:(s,e)=>{if(!e)return!1;const t=s.get(i.IUniverInstanceService),n=T(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=Tt([u],s,l,d).reverse(),m=[],h=[];c.forEach(C=>{var O,U,P,E;const v=[],I=[],w={unitId:l,subUnitId:d,range:C},p=na(w,r),M=r.getCellMatrix().getSlice(C.startRow,C.endRow,0,r.getColumnCount()-1),y={unitId:l,subUnitId:d,cellValue:M.getMatrix()},b=a.onCommandExecute({id:Ss,params:{range:C}});I.push(...(O=b.preRedos)!=null?O:[]),I.push({id:Ie.id,params:w}),I.push(...(U=b.redos)!=null?U:[]),v.push(...(P=b.preUndos)!=null?P:[]),v.push({id:ve.id,params:p}),v.push({id:B.id,params:y}),v.push(...(E=b.undos)!=null?E:[]),h.push(...I),m.unshift(...v)}),h.push(_e(u,o,r));const R=s.get(i.ICommandService);return i.sequenceExecute(h,R).result?(s.get(i.IUndoRedoService).pushUndoRedo({unitID:l,undoMutations:m,redoMutations:h}),!0):!1}},At={type:i.CommandType.COMMAND,id:Ss,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=T(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:At.id,params:{range:r}})?o.syncExecuteCommand(Cs.id,{range:r,unitId:c,subUnitId:d}):!1}},fs="sheet.command.remove-col",vs={type:i.CommandType.COMMAND,id:"sheet.command.remove-col-by-range",handler:(s,e)=>{var I,w,p;if(!e)return!1;const t=s.get(i.IUniverInstanceService),n=T(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=sa(s,c),h=r.getCellMatrix().getSlice(0,r.getRowCount()-1,u.startColumn,u.endColumn),R={unitId:l,subUnitId:d,cellValue:h.getMatrix()},S=a.onCommandExecute({id:fs,params:{range:u}}),C=s.get(i.ICommandService);return i.sequenceExecute([...(I=S.preRedos)!=null?I:[],{id:ae.id,params:c},...S.redos,_e(u,o,r)],C).result?(s.get(i.IUndoRedoService).pushUndoRedo({unitID:l,undoMutations:[...(w=S.preUndos)!=null?w:[],{id:me.id,params:m},{id:B.id,params:R},...S.undos],redoMutations:[...(p=S.preRedos)!=null?p:[],{id:ae.id,params:c},...S.redos]}),!0):!1}},Wt={type:i.CommandType.COMMAND,id:fs,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=T(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:Wt.id,params:{range:r}})?o.syncExecuteCommand(vs.id,{range:r,unitId:c,subUnitId:d}):!1}},cn={id:"sheet.command.remove-sheet",type:i.CommandType.COMMAND,handler:(s,e)=>{var I,w;const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),o=s.get(i.IUniverInstanceService),r=s.get(g.SheetInterceptorService),a=T(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=Io(s,m),R=r.onCommandExecute({id:cn.id,params:{unitId:u,subUnitId:l}}),S=[...(I=R.preRedos)!=null?I:[],{id:Ye.id,params:m},...R.redos],C=[...(w=R.preUndos)!=null?w:[],{id:ot.id,params:h},...R.undos];return i.sequenceExecute(S,t).result?(n.pushUndoRedo({unitID:u,undoMutations:C,redoMutations:S}),!0):!1}},Re=(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)}},F={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}},oe=(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}},Zo={type:i.CommandType.COMMAND,id:"sheet.command.remove-worksheet-merge",handler:(s,e)=>{var k;const t=s.get(g.SheetsSelectionsService),n=s.get(i.ICommandService),o=s.get(i.IUndoRedoService),r=s.get(i.IUniverInstanceService),a=(e==null?void 0:e.ranges)||((k=t.getCurrentSelections())==null?void 0:k.map(W=>W.range));if(!(a!=null&&a.length))return!1;const u=T(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(A=>i.Rectangle.intersects(A,W)));if(!R.length)return!1;const S=oe(s,m),C=t.getCurrentSelections();if(!(C!=null&&C.length))return!1;const v=i.Tools.deepClone(C),I=i.Tools.deepClone(C),w=I[I.length-1],{startRow:p,startColumn:M}=w.range;w.primary={startRow:p,startColumn:M,endRow:p,endColumn:M,actualRow:p,actualColumn:M,isMerged:!1,isMergedMainCell:!1};const y=Ha(c,R),b={unitId:d,subUnitId:l,cellValue:y.redoParams.getMatrix()},O={unitId:d,subUnitId:l,cellValue:y.undoParams.getMatrix()},U=[{id:G.id,params:S},{id:B.id,params:b},{id:q.id,params:{selections:I}}],P=[{id:F.id,params:S},{id:B.id,params:O},{id:q.id,params:{selections:v}}];return i.sequenceExecute(U,n)?(o.pushUndoRedo({unitID:d,undoMutations:P,redoMutations:U}),!0):!1}};function Ha(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}}var Ba=Object.getOwnPropertyDescriptor,ja=(s,e,t,n)=>{for(var o=n>1?void 0:n?Ba(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},Fa=(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=ja([Fa(0,i.Inject(i.Injector))],g.SheetSkeletonService);const Qo=s=>{const{order:e}=s,t={};return Object.keys(e).forEach(n=>{t[e[Number(n)]]=Number(n)}),{...s,order:t}},Vt={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],S=i.Tools.deepClone(l.getCellRaw(R,h));d.setValue(m,h,S)}});const c=l.getCellMatrix();return d.forValue((m,h,R)=>{c.setValue(m,h,R)}),!0}};function Is(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 Ga=1e4;function Lt(s,e){if(!e)return{suitableRanges:s,remainingRanges:[]};const t=e.worksheet.getColumnCount(),n=Math.ceil(Ga/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 xo="sheet.command.reorder-range",mn={id:xo,type:i.CommandType.COMMAND,handler:(s,e)=>{var p,M;const{subUnitId:t,unitId:n,range:o,order:r}=e,a=s.get(i.ICommandService),u={id:Vt.id,params:{unitId:n,subUnitId:t,order:r,range:o}},l={id:Vt.id,params:Qo(u.params)},d=s.get(g.SheetInterceptorService),c=d.onCommandExecute({id:mn.id,params:e}),m=[...(p=c.preRedos)!=null?p:[],u,...c.redos],h=[...(M=c.preUndos)!=null?M:[],l,...c.undos],R=i.sequenceExecute(m,a),{suitableRanges:S,remainingRanges:C}=Lt([o],s.get(g.SheetSkeletonService).getSkeleton(n,t)),{undos:v,redos:I}=d.generateMutationsOfAutoHeight({unitId:n,subUnitId:t,ranges:[o],autoHeightRanges:S,lazyAutoHeightRanges:C}),w=d.afterCommandExecute({id:mn.id,params:e});return R.result?(i.sequenceExecute([...w.redos,...I],a),s.get(i.IUndoRedoService).pushUndoRedo({unitID:n,undoMutations:[...h,...w.undos,...v],redoMutations:[...m,...w.redos,...I]}),!0):!1}};class Xe{constructor(){f(this,"_borderInfo",{type:i.BorderType.ALL,color:"#000000",style:i.BorderStyleTypes.THIN,activeBorderType:!1});f(this,"_borderInfo$",new V.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 hn(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 ps=(s,e,t,n)=>{const{mr:o,worksheet:r}=s;e.startRow<0||e.startColumn<0||hn(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}})}})},za=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 Ya(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,S=r.indexOf("tlmr")>-1,C=r.indexOf("bltr")>-1,v=r.indexOf("mltr")>-1,I=r.indexOf("bctr")>-1,w=t[0],{topRangeOut:p,leftRangeOut:M,bottomRangeOut:y,rightRangeOut:b,topRange:O,leftRange:U,bottomRange:P,rightRange:E}=za(w),k=new i.ObjectMatrix,{worksheet:W,unitId:A,subUnitId:L}=e;return{worksheet:W,unitId:A,subUnitId:L,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:S,bl_tr:C,ml_tr:v,bc_tr:I,topRangeOut:p,leftRangeOut:M,bottomRangeOut:y,rightRangeOut:b,topRange:O,leftRange:U,bottomRange:P,rightRange:E,range:w,mr:k,borderStyle:{s:n,cl:{rgb:o}}}}const qa=s=>{const{range:e,mr:t,borderStyle:n,vertical:o,horizontal:r,worksheet:a}=s;o&&hn(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&&hn(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 Ka(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)=>{ps(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 Ja=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,S=(C,v,I)=>{ps(s,C,v,I)};e&&(S(m,{b:null}),S(u,{t:i.Tools.deepClone(r)},!0)),o&&(S(c,{t:null}),S(a,{b:i.Tools.deepClone(r)},!0)),t&&(S(h,{r:null}),S(l,{l:i.Tools.deepClone(r)},!0)),n&&(S(R,{l:null}),S(d,{r:i.Tools.deepClone(r)},!0))},Xa=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:S,bc_tr:C,topRange:v,bottomRange:I,leftRange:w,rightRange:p,topRangeOut:M,bottomRangeOut:y,leftRangeOut:b,rightRangeOut:O}=s,U=(P,E,k)=>{ps(s,P,E,k)};!o&&!r&&!a&&!u&&!l&&!d&&!c&&!m&&!h&&!R&&!S&&!C&&(hn(e,(P,E)=>{var W,A,L,j,K,z,J,se;const k=t.getMergedCell(P,E);if(k){if(k.endColumn!==e.endColumn){const H=(W=n.getValue(k.startRow,k.startColumn))==null?void 0:W.s;n.setValue(P,E,{s:{bd:H!=null&&H.bd?Object.assign(H.bd,{r:null}):{r:null}}})}if(k.startColumn!==e.startColumn){const H=(A=n.getValue(k.startRow,k.startColumn))==null?void 0:A.s;n.setValue(P,E,{s:{bd:H!=null&&H.bd?Object.assign(H.bd,{l:null}):{l:null}}})}if(k.endRow!==e.endRow){const H=(L=n.getValue(k.startRow,k.startColumn))==null?void 0:L.s;n.setValue(P,E,{s:{bd:H!=null&&H.bd?Object.assign(H.bd,{b:null}):{b:null}}})}if(k.startRow!==e.startRow){const H=(j=n.getValue(k.startRow,k.startColumn))==null?void 0:j.s;n.setValue(P,E,{s:{bd:H!=null&&H.bd?Object.assign(H.bd,{t:null}):{t:null}}})}}else{if(E!==e.endColumn){const H=(K=n.getValue(P,E))==null?void 0:K.s;n.setValue(P,E,{s:{bd:H!=null&&H.bd?Object.assign(H.bd,{r:null}):{r:null}}})}if(E!==e.startColumn){const H=(z=n.getValue(P,E))==null?void 0:z.s;n.setValue(P,E,{s:{bd:H!=null&&H.bd?Object.assign(H.bd,{l:null}):{l:null}}})}if(P!==e.endRow){const H=(J=n.getValue(P,E))==null?void 0:J.s;n.setValue(P,E,{s:{bd:H!=null&&H.bd?Object.assign(H.bd,{b:null}):{b:null}}})}if(P!==e.startRow){const H=(se=n.getValue(P,E))==null?void 0:se.s;n.setValue(P,E,{s:{bd:H!=null&&H.bd?Object.assign(H.bd,{t:null}):{t:null}}})}}}),U(M,{b:null}),U(v,{t:null},!0),U(y,{t:null}),U(I,{b:null},!0),U(b,{r:null}),U(w,{l:null},!0),U(O,{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))},dt={id:"sheet.command.set-border",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(g.SheetsSelectionsService),a=s.get(Xe),u=T(o,e);if(!u)return!1;const l=(e==null?void 0:e.ranges)||((I=r.getCurrentSelections())==null?void 0:I.map(w=>w.range));if(!(l!=null&&l.length))return!1;const{activeBorderType:d}=a.getBorderInfo();if(!d)return!1;const c=Ya(a,u,l);qa(c),Ja(c),Ka(c),Xa(c);const{unitId:m,subUnitId:h,mr:R}=c,S={unitId:m,subUnitId:h,cellValue:R.getData()},C=ue(s,S);return t.syncExecuteCommand(B.id,S)?(n.pushUndoRedo({unitID:m,undoMutations:[{id:B.id,params:C}],redoMutations:[{id:B.id,params:S}]}),!0):!1}},er={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(Xe).setType(e.value),t.syncExecuteCommand(dt.id)}},tr={id:"sheet.command.set-border-style",type:i.CommandType.COMMAND,handler:(s,e)=>{const t=s.get(i.ICommandService);return s.get(Xe).setStyle(e.value),t.syncExecuteCommand(dt.id)}},nr={id:"sheet.command.set-border-color",type:i.CommandType.COMMAND,handler:(s,e)=>{const t=s.get(i.ICommandService);return s.get(Xe).setColor(e.value),t.syncExecuteCommand(dt.id)}},sr={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(Xe);return c.setType(a),u&&c.setColor(u),c.setStyle(l),d.syncExecuteCommand(dt.id,{unitId:t,subUnitId:n,ranges:r})}};function Za(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 Qa(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 or=(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]=Qa(d,l)}return{unitId:t,subUnitId:n,columnData:r}},ct={id:"sheet.mutation.set-col-data",type:i.CommandType.MUTATION,handler:(s,e)=>{const{columnData:t}=e,n=s.get(i.IUniverInstanceService),o=T(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}},rr={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=T(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=or(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}},xa=(s,e)=>{if(s.get(i.IUniverInstanceService).getUniverSheetInstance(e.unitId)==null)throw new Error("universheet is null error!");return{unitId:e.unitId,subUnitId:e.subUnitId,ranges:e.ranges}},mt={id:"sheet.mutation.set-col-hidden",type:i.CommandType.MUTATION,handler:(s,e)=>{const n=s.get(i.IUniverInstanceService).getUniverSheetInstance(e.unitId);if(!n)return!1;const o=n.getSheetBySheetId(e.subUnitId).getColumnManager();for(let r=0;r<e.ranges.length;r++){const a=e.ranges[r];for(let u=a.startColumn;u<a.endColumn+1;u++){const l=o.getColumnOrCreate(u);l!=null&&(l.hd=i.BooleanNumber.TRUE)}}return!0}},eu=(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}},ht={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}},$t={type:i.CommandType.COMMAND,id:"sheet.command.set-col-visible-on-cols",handler:(s,e)=>{var I,w;const{unitId:t,subUnitId:n,ranges:o}=e,r=s.get(g.SheetInterceptorService),a=s.get(i.ICommandService),u=s.get(i.IUniverInstanceService),l=T(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:ne(p,d),style:null}))},h=eu(s,c),R={unitId:t,subUnitId:n,selections:ir(o).map(p=>({range:p,primary:ne(p,d),style:null}))},S=i.sequenceExecute([{id:ht.id,params:c},{id:q.id,params:m}],a),C=r.onCommandExecute({id:$t.id,params:e}),v=i.sequenceExecute([...C.redos],a);return S.result&&v.result&&s.get(i.IUndoRedoService).pushUndoRedo({unitID:t,undoMutations:[{id:mt.id,params:h},{id:q.id,params:R},...(I=C.undos)!=null?I:[]],redoMutations:[...(w=C.preRedos)!=null?w:[],{id:ht.id,params:c},{id:q.id,params:m},...C.redos]}),!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=T(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($t.id,{unitId:a,subUnitId:u,ranges:l})}},Ms={type:i.CommandType.COMMAND,id:"sheet.command.set-col-hidden",handler:(s,e)=>{var w,p,M,y;const t=s.get(g.SheetsSelectionsService),n=s.get(g.SheetInterceptorService),o=s.get(i.IUniverInstanceService),r=s.get(i.ICommandService);let a=(w=e==null?void 0:e.ranges)!=null&&w.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=T(o,e);if(!u)return!1;const{worksheet:l,unitId:d,subUnitId:c}=u;a=tu(u.worksheet,a);const m={unitId:d,subUnitId:c,ranges:a},h={unitId:d,subUnitId:c,selections:ir(a).map(b=>({range:b,primary:ne(b,l),style:null}))},R=xa(s,m),S={unitId:d,subUnitId:c,reveal:!0,selections:a.map(b=>({range:b,primary:ne(b,l),style:null}))},C=i.sequenceExecute([{id:mt.id,params:m},{id:q.id,params:h}],r),v=n.onCommandExecute({id:Ms.id,params:m}),I=i.sequenceExecute([...v.redos],r);return C.result&&I.result?(s.get(i.IUndoRedoService).pushUndoRedo({unitID:d,undoMutations:[{id:ht.id,params:R},{id:q.id,params:S},...(M=v.undos)!=null?M:[]],redoMutations:[...(y=v.preRedos)!=null?y:[],{id:mt.id,params:m},{id:q.id,params:h},...v.redos]}),!0):!1}};function tu(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 ir(s){return nu(s).map(t=>{const n=t.startColumn===0?t.endColumn+1:t.startColumn-1;return{...t,startColumn:n,endColumn:n}})}function nu(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 ys={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=Y.SetDefinedNameMutationFactory(s,e),u=o.onCommandExecute({id:ys.id,params:e}),l=[...(m=u.preRedos)!=null?m:[],{id:Y.RemoveDefinedNameMutation.id,params:a},{id:Y.SetDefinedNameMutation.id,params:r},...u.redos],d=[...(h=u.preUndos)!=null?h:[],{id:Y.RemoveDefinedNameMutation.id,params:r},{id:Y.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}},He={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}},ar={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=T(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},S=_s(s,R);return t.syncExecuteCommand(He.id,R)?(n.pushUndoRedo({unitID:a,undoMutations:[{id:He.id,params:S}],redoMutations:[{id:He.id,params:R}]}),!0):!1}},ur={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=T(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(He.id,l)&&o.pushUndoRedo({unitID:a,undoMutations:[{id:He.id,params:d}],redoMutations:[{id:He.id,params:l}]}),!0}},gt={id:"sheet.mutation.set-gridlines-color",type:i.CommandType.MUTATION,handler:(s,e)=>{const t=T(s.get(i.IUniverInstanceService),e);if(!t)return!1;const{worksheet:n}=t,o=n.getConfig();return o.gridlinesColor=e.color,!0}},lr={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=T(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(gt.id,c)?(n.pushUndoRedo({unitID:l,undoMutations:[{id:gt.id,params:m}],redoMutations:[{id:gt.id,params:c}]}),!0):!1}},x={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}},su=(s,e)=>{const{unitId:t,subUnitId:n,ruleId:o}=e,a=s.get(X).getRule(t,n,o);return a?{id:x.id,params:{...e,rule:a}}:null},Ze={id:"sheet.mutation.set-worksheet-protection",type:i.CommandType.MUTATION,handler:(s,e)=>{const{unitId:t,subUnitId:n,rule:o}=e;return s.get(ye).setRule(t,n,o),!0}},dr={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===N.Worksheet?(d.push({id:Ze.id,params:{unitId:u,subUnitId:l,rule:r}}),c.push({id:Ze.id,params:{unitId:u,subUnitId:l,rule:a}})):(d.push({id:x.id,params:{unitId:u,subUnitId:l,rule:r,ruleId:r.id}}),c.push({id:x.id,params:{unitId:u,subUnitId:l,ruleId:a.id,rule:a}})):(a&&(a.unitType===N.Worksheet?(d.push({id:ze.id,params:{unitId:u,subUnitId:l}}),c.push({id:Le.id,params:{unitId:u,rule:a,subUnitId:a.subUnitId}})):a.unitType===N.SelectRange&&(d.push({id:Me.id,params:{unitId:u,subUnitId:l,ruleIds:[a.id]}}),c.push({id:ce.id,params:{unitId:u,subUnitId:l,rules:[a]}}))),r.unitType===N.Worksheet?(d.push({id:Le.id,params:{unitId:u,rule:r,subUnitId:r.subUnitId}}),c.unshift({id:ze.id,params:{unitId:u,subUnitId:l}})):r.unitType===N.SelectRange&&(r.id=o.createRuleId(u,l),d.push({id:ce.id,params:{unitId:u,subUnitId:l,rules:[r]}}),c.unshift({id:Me.id,params:{unitId:u,subUnitId:l,ruleIds:[r.id]}}))),i.sequenceExecute(d,t)&&n.pushUndoRedo({unitID:u,undoMutations:c,redoMutations:d}),!0}},cr=(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]=Za(d,l)}return{unitId:t,subUnitId:n,rowData:r}},Rt={id:"sheet.mutation.set-row-data",type:i.CommandType.MUTATION,handler:(s,e)=>{const{rowData:t}=e,n=s.get(i.IUniverInstanceService),o=T(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}},mr={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=T(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=cr(c,d);return t.syncExecuteCommand(Rt.id,c)?(n.pushUndoRedo({unitID:u,undoMutations:[{id:Rt.id,params:m}],redoMutations:[{id:Rt.id,params:c}]}),!0):!1}},ou=(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}},St={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}},ru=(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}},Ct={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}},Ht={type:i.CommandType.COMMAND,id:"sheet.command.set-specific-rows-visible",handler:(s,e)=>{var I,w,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=T(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(M=>({range:M,primary:ne(M,d),style:null}))},h=ou(s,c),R={unitId:t,subUnitId:n,selections:hr(o).map(M=>({range:M,primary:ne(M,d),style:null}))},S=i.sequenceExecute([{id:St.id,params:c},{id:q.id,params:m}],r),C=u.onCommandExecute({id:Ht.id,params:e}),v=i.sequenceExecute([...C.redos],r);return S.result&&v.result&&a.pushUndoRedo({unitID:t,undoMutations:[...(I=C.preUndos)!=null?I:[],{id:Ct.id,params:h},{id:q.id,params:R},...(w=C.undos)!=null?w:[]],redoMutations:[...(p=C.preRedos)!=null?p:[],{id:St.id,params:c},{id:q.id,params:m},...C.redos]}),!0}},bs={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=T(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(Ht.id,{unitId:u,subUnitId:l,ranges:d})}},Es={type:i.CommandType.COMMAND,id:"sheet.command.set-rows-hidden",handler:(s,e)=>{var w,p,M,y,b,O;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=(w=e==null?void 0:e.ranges)!=null&&w.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=T(r,e);if(!l)return!1;u=iu(l.worksheet,u);const{unitId:d,subUnitId:c,worksheet:m}=l,h={unitId:d,subUnitId:c,ranges:u},R={unitId:d,subUnitId:c,selections:hr(u).map(U=>({range:U,primary:ne(U,m),style:null}))},S=ru(s,h),C={unitId:d,subUnitId:c,reveal:!0,selections:u.map(U=>({range:U,primary:ne(U,m),style:null}))},v=a.onCommandExecute({id:Es.id,params:h});return i.sequenceExecute([...(M=v.preRedos)!=null?M:[],{id:Ct.id,params:h},{id:q.id,params:R},...v.redos],n).result&&o.pushUndoRedo({unitID:d,undoMutations:[...(y=v.preUndos)!=null?y:[],{id:St.id,params:S},{id:q.id,params:C},...(b=v.undos)!=null?b:[]],redoMutations:[...(O=v.preRedos)!=null?O:[],{id:Ct.id,params:h},{id:q.id,params:R},...v.redos]}),!0}};function iu(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 hr(s){return au(s).map(t=>{const n=t.startRow===0?t.endRow+1:t.startRow-1;return{...t,startRow:n,endRow:n}})}function au(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 uu=["ff","fs","tr","tb"],ee={type:i.CommandType.COMMAND,id:"sheet.command.set-style",handler:(s,e)=>{var P;const t=s.get(i.IUniverInstanceService),n=T(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]:(P=m.getCurrentSelections())==null?void 0:P.map(E=>E.range);if(!(h!=null&&h.length))return!1;const R=new i.ObjectMatrix,S=Ta(a);if(i.Tools.isArray(l.value))for(let E=0;E<h.length;E++)S.forOperableEach(h[E],(k,W,A)=>{R.setValue(k,W,{s:{[l.type]:l.value[k-A.startRow][W-A.startColumn]}})});else for(let E=0;E<h.length;E++){const k={s:{[l.type]:l.value}};S.forOperableEach(h[E],(W,A)=>R.setValue(W,A,k))}const C={subUnitId:r,unitId:o,cellValue:R.getMatrix()},v=s.get(g.SheetSkeletonService).getSkeleton(o,r),I=ue(s,C),w=d.syncExecuteCommand(B.id,C),p=s.get(g.SheetInterceptorService);let M=[],y=[];if(uu.includes(e==null?void 0:e.style.type)){const{suitableRanges:E,remainingRanges:k}=Lt(h,v),W=Is(E,a),{undos:A,redos:L}=p.generateMutationsOfAutoHeight({unitId:o,subUnitId:r,ranges:E,autoHeightRanges:E,lazyAutoHeightRanges:k,cellHeights:W});M=A,y=L}const{undos:b,redos:O}=p.onCommandExecute({id:ee.id,params:e}),U=i.sequenceExecute([...O,...y],d);return w&&U.result?(c.pushUndoRedo({unitID:C.unitId,undoMutations:[{id:B.id,params:I},...b,...M],redoMutations:[{id:B.id,params:C},...O,...y]}),!0):!1}},lu={type:i.CommandType.COMMAND,id:"sheet.command.set-bold",handler:s=>{const e=s.get(g.SheetsSelectionsService).getCurrentLastSelection();if(!e)return!1;const t=T(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)}},du={type:i.CommandType.COMMAND,id:"sheet.command.set-italic",handler:s=>{const e=s.get(g.SheetsSelectionsService).getCurrentLastSelection();if(!e)return!1;const t=T(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)}},cu={type:i.CommandType.COMMAND,id:"sheet.command.set-underline",handler:s=>{const e=s.get(g.SheetsSelectionsService).getCurrentLastSelection();if(!e)return!1;const t=T(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)}},mu={type:i.CommandType.COMMAND,id:"sheet.command.set-stroke",handler:s=>{const e=s.get(g.SheetsSelectionsService).getCurrentLastSelection();if(!e)return!1;const t=T(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)}},hu={type:i.CommandType.COMMAND,id:"sheet.command.set-overline",handler:s=>{const e=s.get(g.SheetsSelectionsService).getCurrentLastSelection();if(!e)return!1;const t=T(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)}},gu={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)}},Ru={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)}},gr={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)}},Rr={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)}},Sr={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)}},Cr={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)}},fr={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)}},vr={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)}},Ir={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)}},pr={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)}},Su=(s,e)=>{const r=s.get(i.IUniverInstanceService).getUniverSheetInstance(e.unitId).getSheetBySheetId(e.subUnitId).getConfig().tabColor;return{...i.Tools.deepClone(e),color:r}},Bt={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}},wr={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=T(s.get(i.IUniverInstanceService));if(!o)return!1;const{unitId:r,subUnitId:a}=o,u={color:e.value,unitId:r,subUnitId:a},l=Su(s,u);return t.syncExecuteCommand(Bt.id,u)?(n.pushUndoRedo({unitID:r,undoMutations:[{id:Bt.id,params:l}],redoMutations:[{id:Bt.id,params:u}]}),!0):!1}},Ts={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}},Us={type:i.CommandType.COMMAND,id:"sheet.command.set-workbook-name",handler:async(s,e)=>{var d;if(!s.get(i.IUniverInstanceService).getUnit(e.unitId,i.UniverInstanceType.UNIVER_SHEET))return!1;const r=s.get(g.SheetInterceptorService).onCommandExecute({id:Us.id,params:e}),a={name:e.name,unitId:e.unitId},u=[...(d=r.preRedos)!=null?d:[],{id:Ts.id,params:a},...r.redos],l=s.get(i.ICommandService);return i.sequenceExecute(u,l).result}},ft={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}},Cu=4,Ps={type:i.CommandType.COMMAND,id:"sheet.command.set-worksheet-activate",handler:(s,e,t)=>{const n=s.get(i.ICommandService),o=T(s.get(i.IUniverInstanceService),e);if(!o)return!1;const{unitId:r,subUnitId:a}=o;return new Promise(u=>{setTimeout(()=>{const l=n.syncExecuteCommand(ft.id,{unitId:r,subUnitId:a},t);u(l)},Cu)})}},ks=(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}},We={id:"sheet.mutation.set-worksheet-col-width",type:i.CommandType.MUTATION,handler:(s,e)=>{const t=s.get(i.IUniverInstanceService),n=T(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}},jt={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=T(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,S=n.length===1&&n[0].range.rangeType===i.RANGE_TYPE.ALL,C=n.filter(j=>j.range.rangeType===i.RANGE_TYPE.COLUMN),v=S?i.RANGE_TYPE.ALL:C.some(({range:j})=>{const{startColumn:K,endColumn:z}=j;return K<=c&&c<=z})?i.RANGE_TYPE.COLUMN:i.RANGE_TYPE.NORMAL;let I;if(v===i.RANGE_TYPE.ALL){const j=u.getRowCount(),K=new Array(u.getColumnCount()).fill(void 0).map((z,J)=>({startRow:0,endRow:j-1,startColumn:J,endColumn:J}));I={subUnitId:d,unitId:l,colWidth:R,ranges:K}}else v===i.RANGE_TYPE.COLUMN?I={subUnitId:d,unitId:l,ranges:C.map(j=>i.Rectangle.clone(j.range)),colWidth:R}:I={subUnitId:d,unitId:l,colWidth:R,ranges:[{startRow:0,endRow:u.getMaxRows()-1,startColumn:c,endColumn:c}]};const w=s.get(g.SheetSkeletonService).getSkeleton(l,d),{suitableRanges:p,remainingRanges:M}=Lt(I.ranges,w);Is(p,u);const y=s.get(g.SheetInterceptorService),{undos:b,redos:O}=y.onCommandExecute({id:jt.id,params:I}),U=ks(I,u),P=o.syncExecuteCommand(We.id,I),{undos:E,redos:k}=y.generateMutationsOfAutoHeight({unitId:l,subUnitId:d,ranges:p,autoHeightRanges:p,lazyAutoHeightRanges:M}),{undos:W,redos:A}=s.get(g.SheetInterceptorService).afterCommandExecute({id:jt.id,params:I}),L=i.sequenceExecute([...O,...A,...k],o);return P&&L.result&&r.pushUndoRedo({unitID:l,undoMutations:[{id:We.id,params:U},...b,...W,...E],redoMutations:[{id:We.id,params:I},...O,...A,...k]}),!0}},gn={type:i.CommandType.COMMAND,id:"sheet.command.set-worksheet-col-width",handler:(s,e)=>{var y,b,O,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(P=>P.range);if(!(a!=null&&a.length))return!1;const u=T(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:S}=Lt(h.ranges,m);Is(R,c);const C=ks(h,c),v=n.syncExecuteCommand(We.id,h),{undos:I,redos:w}=r.generateMutationsOfAutoHeight({unitId:d,subUnitId:l,ranges:R,autoHeightRanges:R,lazyAutoHeightRanges:S}),p=r.onCommandExecute({id:gn.id,params:h}),M=i.sequenceExecute([...p.redos,...w],n);return v&&M.result?(o.pushUndoRedo({unitID:d,undoMutations:[...(O=p.preUndos)!=null?O:[],{id:We.id,params:C},...p.undos,...I],redoMutations:[...(U=p.preRedos)!=null?U:[],{id:We.id,params:h},...p.redos,...w]}),!0):!1}};i.CommandType.COMMAND;const Mr=(s,e)=>{const t=fe(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()}},vt={id:"sheet.mutation.set-worksheet-column-count",type:i.CommandType.MUTATION,handler:(s,e)=>{const t=s.get(i.IUniverInstanceService),n=fe(t,e);return n?(n.worksheet.setColumnCount(e.columnCount),!0):!1}},yr={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(!T(u,e))return!1;const d={unitId:t,subUnitId:n,columnCount:o},c=Mr(s,d);return r.syncExecuteCommand(vt.id,d)?(a.pushUndoRedo({unitID:t,undoMutations:[{id:vt.id,params:c}],redoMutations:[{id:vt.id,params:d}]}),!0):!1}},It={id:"sheet.mutation.set-worksheet-default-style",type:i.CommandType.MUTATION,handler:(s,e)=>{const{defaultStyle:t}=e,n=s.get(i.IUniverInstanceService),o=T(n);if(!o)return!1;const{worksheet:r}=o;return r?(r.setDefaultCellStyle(t),!0):!1}},_r=(s,e)=>{const t=fe(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()}},br={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=_r(s,e);return t.syncExecuteCommand(It.id,e)?(n.pushUndoRedo({unitID:o,undoMutations:[{id:It.id,params:r}],redoMutations:[{id:It.id,params:e}]}),!0):!1}},Er=(s,e)=>{const t=fe(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()}},Be={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}},Tr={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=T(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=Er(s,h);return u.getSheets().filter(I=>I.getConfig().hidden===i.BooleanNumber.FALSE).length===1?(o.emit(r.t("sheets.info.hideSheet")),!1):t.syncExecuteCommand(Be.id,h)?(n.pushUndoRedo({unitID:d,undoMutations:[{id:Be.id,params:R}],redoMutations:[{id:Be.id,params:h}]}),!0):!1}},fu=(s,e)=>{const t=fe(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()}},Ft={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}},Rn={type:i.CommandType.COMMAND,id:"sheet.command.set-worksheet-name",handler:(s,e)=>{var S,C;const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),o=s.get(g.SheetInterceptorService),r=T(s.get(i.IUniverInstanceService),e);if(!r)return!1;const{unitId:a,subUnitId:u}=r,l={subUnitId:u,name:e.name,unitId:a},d=fu(s,l),c=o.onCommandExecute({id:Rn.id,params:e}),m=[...(S=c.preRedos)!=null?S:[],{id:Ft.id,params:l},...c.redos],h=[...(C=c.preUndos)!=null?C:[],{id:Ft.id,params:d},...c.undos];return i.sequenceExecute(m,t).result?(n.pushUndoRedo({unitID:a,undoMutations:h,redoMutations:m}),!0):!1}},vu=(s,e)=>({...i.Tools.deepClone(e),toOrder:e.fromOrder,fromOrder:e.toOrder}),Gt={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}},Os={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=T(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=vu(s,d);return t.syncExecuteCommand(Gt.id,d)?(n.pushUndoRedo({unitID:a,undoMutations:[{id:Gt.id,params:c}],redoMutations:[{id:Gt.id,params:d}]}),!0):!1}};class pt{constructor(){f(this,"_model",new Map);f(this,"_pointChange",new V.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 Ns{constructor(e,t,n){f(this,"type",N.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=`${N.SelectRange}.${_.Delete}.${n}`}}class Ds{constructor(e,t,n){f(this,"type",N.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=`${N.SelectRange}.${_.ManageCollaborator}.${n}`}}const re=()=>[on,he,Ds,Ns],je=[_.Edit,_.View,_.ManageCollaborator,_.Delete],Iu=(s="unitId",e="subUnitId",t="permissionId")=>re().reduce((n,o)=>{const r=new o(s,e,t);return n[r.subType]=r.value,n},{}),wt=()=>[le,Yn,$n,Jn,Hn,zn,an,jn,Fn,ln,rn,Gn,Kn,un,bo,Xn,qn,Bn],Ur=[_.Edit,_.Print,_.Comment,_.View,_.Copy,_.Export,_.ManageCollaborator,_.CreateSheet,_.DeleteSheet,_.RenameSheet,_.HideSheet,_.Duplicate,_.Share,_.MoveSheet,_.CopySheet,_.RecoverHistory,_.ViewHistory,_.CreatePermissionObject],ie=()=>[ge,kt,is,xn],Se=()=>[Zn,Qn,es,ts,ns,ss,rs,os,as,us,Pt,rt,it,ls],Sn=[_.Copy,_.DeleteColumn,_.DeleteRow,_.EditExtraObject,_.Filter,_.InsertColumn,_.InsertRow,_.InsertHyperlink,_.PivotTable,_.SetCellStyle,_.SetCellValue,_.SetColumnStyle,_.SetRowStyle,_.Sort];var pu=Object.getOwnPropertyDescriptor,wu=(s,e,t,n)=>{for(var o=n>1?void 0:n?pu(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},Fe=(s,e)=>(t,n)=>e(t,n,s);const Mu="SHEET_WORKSHEET_PROTECTION_PLUGIN",yu="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();[...ie(),...Se()].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=>{[...re()].forEach(d=>{const c=new d(n,a,l.permissionId);this._permissionService.deletePermissionPoint(c.id)})}),[...ie(),...Se()].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(bt.takeUntil(this.dispose$)).subscribe(e),this._univerInstanceService.getTypeOfUnitDisposed$(i.UniverInstanceType.UNIVER_SHEET).pipe(bt.takeUntil(this.dispose$)).subscribe(t=>{t.getSheets().forEach(n=>{const o=t.getUnitId(),r=n.getSheetId();ie().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":{ie().forEach(t=>{const n=new t(e.unitId,e.subUnitId);this._permissionService.updatePermissionPoint(n.id,!0)});break}case"set":{ie().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:Mu,businesses:[sn.UNIVER_SHEET],onLoad:(n,o)=>{this._worksheetProtectionRuleModel.fromObject(o),Object.keys(o).forEach(r=>{ie().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();[...ie(),...Se()].forEach(u=>{const l=new u(n,a);this._permissionService.deletePermissionPoint(l.id)})}),wt().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:yu,businesses:[sn.UNIVER_SHEET],onLoad:(n,o)=>{this._worksheetProtectionPointRuleModel.fromObject(o),Object.keys(o).forEach(r=>{Se().forEach(a=>{const u=new a(n,r);this._permissionService.addPermissionPoint(u)})})},onUnLoad:n=>{this._worksheetProtectionPointRuleModel.deleteUnitModel(n)}}))}},g.WorksheetPermissionService=wu([Fe(0,i.Inject(i.IPermissionService)),Fe(1,i.Inject(i.IUniverInstanceService)),Fe(2,i.Inject(i.Injector)),Fe(3,i.Inject(ye)),Fe(4,i.Inject(pt)),Fe(5,i.Inject(i.IResourceManagerService)),Fe(6,i.Inject(X)),Fe(7,i.Inject(i.ILogService))],g.WorksheetPermissionService);const Cn={id:"sheet.mutation.set-worksheet-permission-points",type:i.CommandType.MUTATION,handler:(s,e)=>{const{rule:t}=e;return s.get(pt).addRule(t),!0}},Pr={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(Cn.id,{rule:n,unitId:n.unitId,subUnitId:n.subUnitId}),!0}},kr={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(Ze.id,{unitId:u,subUnitId:l,newRule:d})){const m=[{id:Ze.id,params:{unitId:u,subUnitId:l,newRule:d}}],h=[{id:Ze.id,params:{unitId:u,subUnitId:l,rule:a}}];n.pushUndoRedo({unitID:u,redoMutations:m,undoMutations:h})}return!0}},Or=(s,e)=>{const t=fe(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()}},Mt={id:"sheet.mutation.set-worksheet-row-count",type:i.CommandType.MUTATION,handler:(s,e)=>{const t=s.get(i.IUniverInstanceService),n=fe(t,e);return n?(n.worksheet.setRowCount(e.rowCount),!0):!1}},Nr={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(!T(u,e))return!1;const d={unitId:t,subUnitId:n,rowCount:o},c=Or(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}},Dr=(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}},As=(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}},_u=(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}},Ve={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=T(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}},Ce={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=T(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}},Ws={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=T(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}},fn={type:i.CommandType.COMMAND,id:"sheet.command.delta-row-height",handler:async(s,e)=>{var P,E;const n=s.get(g.SheetsSelectionsService).getCurrentSelections(),o=s.get(g.SheetInterceptorService);if(!(n!=null&&n.length))return!1;const r=T(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,S=n.filter(k=>k.range.rangeType===i.RANGE_TYPE.ROW),C=R?i.RANGE_TYPE.ALL:S.some(({range:k})=>{const{startRow:W,endRow:A}=k;return W<=d&&d<=A})?i.RANGE_TYPE.ROW:i.RANGE_TYPE.NORMAL;let v;if(C===i.RANGE_TYPE.ALL){const k=a.getColumnCount(),W=new Array(a.getRowCount()).fill(void 0).map((A,L)=>({startRow:L,endRow:L,startColumn:0,endColumn:k-1}));v={subUnitId:u,unitId:l,rowHeight:h,ranges:W}}else C===i.RANGE_TYPE.ROW?v={subUnitId:u,unitId:l,ranges:S.map(k=>i.Rectangle.clone(k.range)),rowHeight:h}:v={subUnitId:u,unitId:l,rowHeight:h,ranges:[{startRow:d,endRow:d,startColumn:0,endColumn:a.getMaxColumns()-1}]};const I=Dr(v,a),w={unitId:l,subUnitId:u,ranges:v.ranges,autoHeightInfo:i.BooleanNumber.FALSE},p=As(w,a),M=s.get(i.ICommandService),y=s.get(i.IUndoRedoService),b=o.onCommandExecute({id:fn.id,params:v}),O=i.sequenceExecute([{id:Ve.id,params:v},{id:Ce.id,params:w}],M),U=i.sequenceExecute([...b.redos],M);return O.result&&U.result?(y.pushUndoRedo({unitID:l,undoMutations:[...(P=b.preUndos)!=null?P:[],{id:Ve.id,params:I},{id:Ce.id,params:p},...b.undos],redoMutations:[...(E=b.preRedos)!=null?E:[],{id:Ve.id,params:v},{id:Ce.id,params:w},...b.redos]}),!0):!1}},vn={type:i.CommandType.COMMAND,id:"sheet.command.set-row-height",handler:(s,e)=>{var p,M,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:(M=t.getCurrentSelections())==null?void 0:M.map(O=>O.range);if(!(u!=null&&u.length))return!1;const l=T(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=Dr(h,m),S={unitId:d,subUnitId:c,ranges:h.ranges,autoHeightInfo:i.BooleanNumber.FALSE},C=As(S,m),v=i.sequenceExecute([{id:Ve.id,params:h},{id:Ce.id,params:S}],n),I=a.onCommandExecute({id:vn.id,params:h}),w=i.sequenceExecute([...I.redos],n);return v.result&&w.result?(o.pushUndoRedo({unitID:d,undoMutations:[...(y=I.preRedos)!=null?y:[],{id:Ve.id,params:R},{id:Ce.id,params:C},...I.undos],redoMutations:[...(b=I.preRedos)!=null?b:[],{id:Ve.id,params:h},{id:Ce.id,params:S},...I.redos]}),!0):!1}},In={type:i.CommandType.COMMAND,id:"sheet.command.set-row-is-auto-height",handler:(s,e)=>{var O,U;const t=s.get(i.ICommandService),n=s.get(i.IUndoRedoService),o=s.get(g.SheetsSelectionsService),r=s.get(i.IUniverInstanceService),a=T(r,e);if(!a)return!1;const{unitId:u,subUnitId:l,worksheet:d}=a,c=(O=e==null?void 0:e.ranges)!=null&&O.length?e.ranges:(U=o.getCurrentSelections())==null?void 0:U.map(P=>P.range);if(!(c!=null&&c.length))return!1;const m={unitId:u,subUnitId:l,ranges:c,autoHeightInfo:i.BooleanNumber.TRUE},h=As(m,d),R=t.syncExecuteCommand(Ce.id,m),S=s.get(g.SheetSkeletonService).getSkeleton(u,l),{suitableRanges:C,remainingRanges:v}=Lt(m.ranges,S),I=s.get(g.SheetInterceptorService),{undos:w,redos:p}=I.generateMutationsOfAutoHeight({unitId:u,subUnitId:l,ranges:C,autoHeightRanges:C,lazyAutoHeightRanges:v}),{undos:M,redos:y}=I.onCommandExecute({id:In.id,params:m}),b=i.sequenceExecute([...y,...p],t);return R&&b.result?(n.pushUndoRedo({unitID:u,undoMutations:[{id:Ce.id,params:h},...M,...w],redoMutations:[{id:Ce.id,params:m},...y,...p]}),!0):!1}},Vs={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(!T(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=Er(s,m),R=o.syncExecuteCommand(Be.id,m),S={unitId:t,subUnitId:n},C=o.syncExecuteCommand(ft.id,S);return R&&C?(r.pushUndoRedo({unitID:t,undoMutations:[{id:Be.id,params:h}],redoMutations:[{id:Be.id,params:m}]}),!0):!1}};var Ar=(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))(Ar||{});class bu{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 Eu(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+=Tu(a);let r="[".concat(o,"]");return e&&(r+="+"),new RegExp(r)}function Tu(s){return s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const Uu=s=>{var t;return((t=s.body)==null?void 0:t.dataStream.replace(/\r\n$/,""))||""};function Pu(s){if(s!=null){if(s.p)return Uu(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 Wr(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 bu:null,h=[];for(let p=u;p<=d;p++){const M=s.getCell(p,a),y=Pu(M);h.push(y),m&&m.update(y)}const R=c?m.getDelimiter():t,S=Eu(R,o,n);let C=-1,v=0,I=0;const w=[];for(const p of h){if(p!==void 0){const M=String(p).split(S);C<0?C=M.length:C=Math.max(C,M.length),w.push(M),v=I}else w.push(void 0);I++}return{rs:w,maxLength:C===-1?0:C,lastRow:v}}const Vr={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(!T(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:S,rs:C,maxLength:v}=Wr(R,o,r,a,u),I=R.getColumnCount(),{startColumn:w}=i.Range.transformRange(o,R);if(o.startColumn!==o.endColumn)return!1;const p=[],M=[],y=w+v+1-I;if(y>0){const k={unitId:t,subUnitId:n,range:{startRow:0,endRow:R.getRowCount()-1,startColumn:I-1,endColumn:I-1+y}};p.push({id:me.id,params:k});const W=Et(s,k);M.push({id:ae.id,params:W})}const b={startRow:o.startRow,endRow:S,startColumn:w,endColumn:w+v},O=new i.ObjectMatrix;for(let k=b.startRow;k<=b.endRow;k++)for(let W=b.startColumn;W<=b.endColumn;W++){const A=C[k-b.startRow];W===0&&(A==null?void 0:A.length)===1?O.setValue(k,W,R.getCell(k,W)):O.setValue(k,W,{v:(A==null?void 0:A[W-b.startColumn])||null,p:null,f:null,si:null,custom:null})}const U={unitId:t,subUnitId:n,cellValue:O.clone()},P=ue(s,U);return p.push({id:B.id,params:U}),M.unshift({id:B.id,params:P}),i.sequenceExecute(p,l).result?(c.pushUndoRedo({unitID:t,undoMutations:M,redoMutations:p}),!0):!1}},Lr={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),S=new i.DocumentDataModel(R),C=i.BuildTextUtils.paragraph.bullet.toggleChecklist({document:S,paragraphIndex:a});if(!C)return!1;i.TextX.apply(S.getBody(),C.serialize());const v={unitId:t,subUnitId:n,cellValue:{[o]:{[r]:{p:R,t:i.CellValueType.STRING}}}},I={id:B.id,params:v},w=ue(s,v),p={id:B.id,params:w},M=[I],y=[p];return c.pushUndoRedo({redoMutations:M,undoMutations:y,unitID:t}),m.syncExecuteCommand(I.id,I.params)}},yt={id:"sheet.mutation.toggle-gridlines",type:i.CommandType.MUTATION,handler:(s,e)=>{const t=T(s.get(i.IUniverInstanceService),e);if(!t)return!1;const{worksheet:n}=t,o=n.getConfig();return o.showGridlines=e.showGridlines,!0}},$r={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=T(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(yt.id,c)?(n.pushUndoRedo({unitID:l,undoMutations:[{id:yt.id,params:m}],redoMutations:[{id:yt.id,params:c}]}),!0):!1}},Hr={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(!T(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(lt.id,e)&&a.pushUndoRedo({unitID:t,undoMutations:[{id:lt.id,params:c}],redoMutations:[{id:dn.id,params:d}]}),!0}},Br={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 Oe(t.name);return r.fromJson(t),o.registerRangeThemeStyle(n,r),!0}},jr={id:"sheet.mutation.empty",type:i.CommandType.MUTATION,handler:()=>!0},Fr={id:"sheet.operation.mark-dirty-row-auto-height",type:i.CommandType.OPERATION,handler:()=>!0},Gr={id:"sheet.operation.cancel-mark-dirty-row-auto-height",type:i.CommandType.OPERATION,handler:()=>!0},zr=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},Yr=s=>{const e=s;return e.forValue((t,n)=>{const o=s.getValue(t-1,n);o&&e.setValue(t,n,o+1)}),e},qr=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},ku=(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},Ls=s=>{const e=[];let t=qr(s);for(;t.area>0;)t.range&&(e.push(t.range),ku(s,t.range)),t=qr(s);return e},$s=s=>{const e=zr(s);return Ls(e)};class Ou{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=Yr(this._matrix);return Ls(e)}}const Qe=i.createIdentifier("INumfmtService"),Nu=(s,e)=>{const t=s.get(Qe),{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 S=t.getValue(o,r,h,R);S?a.push({pattern:S.pattern,row:h,col:R}):u.push({startColumn:R,endColumn:R,startRow:h,endRow:h})})})});const l=[];if(a.length){const d=wn(o,r,a);Object.keys(d.values).forEach(c=>{const m=d.values[c];m.ranges=$s(m.ranges)}),l.push({id:pn.id,params:wn(o,r,a)})}return u.length&&l.push({id:Hs.id,params:{unitId:o,subUnitId:r,ranges:u}}),l},pn={id:"sheet.mutation.set.numfmt",type:i.CommandType.MUTATION,handler:(s,e)=>{if(!e)return!1;const{values:t,refMap:n}=e,o=s.get(Qe),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}},Hs={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(Qe).deleteValues(t,n,o),!0}},Du=(s,e)=>{const t=s.get(Qe),{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=wn(o,r,a);return Object.keys(u.values).forEach(l=>{const d=u.values[l];d.ranges=$s(d.ranges)}),[{id:pn.id,params:u}]},wn=(s,e,t)=>{const n=ga(t,"pattern"),o={},r={},a=Ra();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}},Kr={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}},Jr={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}},Xr={id:"sheet.operation.scroll-to-cell",type:i.CommandType.OPERATION,handler:()=>!0},Zr="ONLY_REGISTER_FORMULA_RELATED_MUTATIONS_KEY",Qr="maxCellsPerSheet",Au=3e6;var Wu=Object.getOwnPropertyDescriptor,Vu=(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},Bs=(s,e)=>(t,n)=>e(t,n,s);let Mn=class extends i.Disposable{constructor(s,e,t){var o;super(),this._commandService=s,this._configService=e,this._dataSyncPrimaryController=t,[B,me,ve,ot,$e,De,Ae,ae,Ie,Ye,G,Hs,F,Ts,Ft,pn,Vt,jr,Ct,St,Fr,Gr].forEach(r=>{var a;this._commandService.registerCommand(r),(a=this._dataSyncPrimaryController)==null||a.registerSyncingMutations(r)}),((o=this._configService.getConfig(Zr))!=null?o:!1)||[Ro,xt,en,tn,Ln,Ke,Je,jt,fn,Bo,Ho,jo,Fo,gs,Ee,ut,Ot,Wo,Ao,Lo,Vo,hs,be,Go,Dt,qe,Nt,Cs,Wt,vs,At,cn,mn,Zo,Cr,Rr,Sr,sr,nr,dt,er,tr,Ms,mt,ht,gn,rr,ct,ar,He,ur,vr,at,vn,Es,mr,Rt,ws,bs,$t,Ht,ee,wr,Bt,gr,pr,Ir,fr,Us,Ps,ft,Tr,Be,Rn,Os,Gt,Ws,Ve,In,Ce,We,Nr,Mt,yr,vt,yo,q,Xr,No,Rs,ys,Vs,$r,yt,lr,gt,Pr,Le,Ze,ze,Cn,xs,dr,Po,eo,ko,kr,ce,Me,x,Lr,It,br,Vr,st,nt,dn,lt,Hr,Xo,co,Oo,Br,Jr,Kr].forEach(r=>this.disposeWithMe(this._commandService.registerCommand(r))),this._configService.setConfig(Qr,Au)}};Mn=Vu([Bs(0,i.ICommandService),Bs(1,i.IConfigService),Bs(2,i.Optional(Oi.DataSyncPrimaryController))],Mn);var Lu=Object.getOwnPropertyDescriptor,$u=(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},xr=(s,e)=>(t,n)=>e(t,n,s);let yn=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!==Y.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),S={subUnitId:m,unitId:u,cellValue:R};o.push({id:B.id,params:S})}}return o.every(a=>this._commandService.executeCommand(a.id,a.params,{onlyLocal:!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=Y.handleNumfmtInCell(m,c,o);u.setValue(l,d,h)}),u.getMatrix()}};yn=$u([xr(0,i.Inject(i.IUniverInstanceService)),xr(1,i.ICommandService)],yn);const Hu="sheets.config",ei={};var Bu=Object.getOwnPropertyDescriptor,ju=(s,e,t,n)=>{for(var o=n>1?void 0:n?Bu(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);const Fu="SHEET_DEFINED_NAME_PLUGIN",Gu="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:Fu,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=ju([ti(0,Y.IDefinedNamesService),ti(1,i.IResourceManagerService)],g.DefinedNameDataController);const D={MoveRangeCommandId:_o,InsertRowCommandId:Do,InsertColCommandId:$o,RemoveColCommandId:fs,RemoveRowCommandId:Ss,DeleteRangeMoveLeftCommandId:To,DeleteRangeMoveUpCommandId:Uo,InsertRangeMoveDownCommandId:Va,InsertRangeMoveRightCommandId:ms,MoveColsCommandId:Ko,MoveRowsCommandId:qo,ReorderRangeCommandId:xo};var $=(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))($||{});const _n=Number.MAX_SAFE_INTEGER,Te=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=_n),(e.rangeType===i.RANGE_TYPE.ROW||n)&&(e.startColumn=0,e.endColumn=_n),e.rangeType===i.RANGE_TYPE.ALL&&(e.startColumn=0,e.endColumn=_n,e.startRow=0,e.endRow=_n),e},de=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}},zt=(s,e,t)=>{const n={...t},o={...e},r=(C,v)=>{const I=Math.max(C.start,v.start),w=Math.min(C.end,v.end);return w<I?null:{start:I,end:w}},a=C=>C.end-C.start+1,u=(C,v)=>({start:C.start-v.start,end:C.start-v.start+C.end-C.start}),l=(C,v)=>({start:v.start+C.start,end:v.start+C.start+C.end-C.start}),d=e.start>s.start;if(d){const C=Math.min(s.end,e.start)-s.start+1;o.start-=C,o.end-=C}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 C=a(h);if(R){const v=u(n,s),I=l(v,o);n.start=I.start,n.end=I.end}else h.start>s.start?d?(n.end-=C+c,n.start-=c):n.end-=C:d?n.end-=C:n.start>s.start&&n.end>s.end?(n.start-=c,n.end-=c+C):n.end-=C}const S=r(o,n);return R||(o.start<=n.start?(n.start+=m,n.end+=m):S&&(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)}},js=(s,e)=>{const{fromRange:t,toRange:n}=s.params||{};if(!n||!t)return[];const o=Te(t),r=Te(n),a=Te(e),u=zt({start:o.startRow,end:o.endRow},{start:r.startRow,end:r.endRow},{start:a.startRow,end:a.endRow});return u===null?[{type:$.Delete}]:[{type:$.VerticalMove,step:u.step||0,length:u.length||0}]},zu=(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)},Yu=(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)},Fs=(s,e)=>{const{fromRange:t,toRange:n}=s.params||{};if(!n||!t)return[];const o=Te(t),r=Te(n),a=Te(e),u=zt({start:o.startColumn,end:o.endColumn},{start:r.startColumn,end:r.endColumn},{start:a.startColumn,end:a.endColumn});return u===null?[{type:$.Delete}]:[{type:$.HorizontalMove,step:u.step||0,length:u.length||0}]},qu=(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)},ni=(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:$.Delete}),i.Rectangle.contains(n,e)){o.push({type:$.Delete});const u=i.Rectangle.getRelativeRange(e,n),l=i.Rectangle.getPositionRange(u,t);return[{type:$.Set,range:l}]}return o},Ku=(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,S)=>{o.setValue(R,S,1)});const r=new i.ObjectMatrix,a=i.Rectangle.getIntersects(n,e);a&&i.Range.foreach(a,(R,S)=>{o.getValue(R,S)&&(o.setValue(R,S,void 0),r.setValue(R,S,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,S)=>{var I;const C=R+l,v=S+u;o.setValue(C,v,(I=r.getValue(R,S))!=null?I:0)}),i.queryObjectMatrix(o,R=>R===1)},xe=(s,e)=>{const t=Te(s),n=Te(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}},Gs=(s,e)=>{var r;const t=(r=s.params)==null?void 0:r.range;if(!t)return[];const n=[],o=xe(t,e);if(!o)n.push({type:$.Delete});else{const{step:a,length:u}=o;n.push({type:$.HorizontalMove,step:a,length:u})}return n},si=(s,e)=>{var r;const t=(r=s.params)==null?void 0:r.range;if(!t)return[];const n=[],o=xe(de(t),de(e));if(!o)n.push({type:$.Delete});else{const{step:a,length:u}=o;n.push({type:$.VerticalMove,step:a,length:u})}return n},Ju=(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:$.VerticalMove,step:u-r,length:0}),o}return[]}return[]},et=(s,e)=>{const t=Te(s),n=Te(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 Xu(s,e,t){const n=[];if(i.Rectangle.contains(e,t)&&n.push({type:$.Delete}),i.Rectangle.contains(s,t)){n.push({type:$.Delete});const o=i.Rectangle.getRelativeRange(t,s),r=i.Rectangle.getPositionRange(o,e);return[{type:$.Set,range:r}]}return n}const oi=(s,e)=>{var u;const t=(u=s.params)==null?void 0:u.range;if(!t)return[];const n=[],o=et(de(t),de(e)),{step:r,length:a}=o;return n.push({type:$.VerticalMove,step:r,length:a}),n},ri=(s,e)=>{var u;const t=(u=s.params)==null?void 0:u.range;if(!t)return[];const n=[],o=et(t,e),{step:r,length:a}=o;return n.push({type:$.HorizontalMove,step:r,length:a}),n},ii=(s,e)=>{var u;const t=(u=s.params)==null?void 0:u.range;if(!t)return[];const n=[],o=et(de(t),de(e)),{step:r,length:a}=o;return n.push({type:$.VerticalMove,step:r,length:a}),n},Zu=(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)},ai=(s,e)=>{var u;const t=(u=s.params)==null?void 0:u.range;if(!t)return[];const n=[],o=et(t,e),{step:r,length:a}=o;return n.push({type:$.HorizontalMove,step:r,length:a}),n},Qu=(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)},ui=(s,e)=>{var r;const t=(r=s.params)==null?void 0:r.range;if(!t)return[];const n=[],o=xe(t,e);if(!o)n.push({type:$.Delete});else{const{step:a,length:u}=o;n.push({type:$.HorizontalMove,step:a,length:u})}return n},xu=(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)},li=(s,e)=>{var r;const t=(r=s.params)==null?void 0:r.range;if(!t)return[];const n=[],o=xe(de(t),de(e));if(!o)n.push({type:$.Delete});else{const{step:a,length:u}=o;n.push({type:$.VerticalMove,step:a,length:u})}return n},el=(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)},tl=(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)},nl=(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}]},sl=(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}]},tt=(s,e)=>{let t={...e};return s.forEach(n=>{switch(n.type){case $.Delete:{t=null;break}case $.HorizontalMove:{if(!t)return;t.startColumn+=n.step,t.endColumn+=n.step+(n.length||0);break}case $.VerticalMove:{if(!t)return;t.startRow+=n.step,t.endRow+=n.step+(n.length||0);break}case $.Set:{t=n.range;break}}}),t&&(t.endColumn<t.startColumn||t.endRow<t.startRow)?null:t},zs=(s,e)=>{let t=[];switch(e.id){case D.DeleteRangeMoveLeftCommandId:{t=ui(e,s);break}case D.DeleteRangeMoveUpCommandId:{t=li(e,s);break}case D.InsertColCommandId:{t=ri(e,s);break}case D.InsertRangeMoveDownCommandId:{t=ii(e,s);break}case D.InsertRangeMoveRightCommandId:{t=ai(e,s);break}case D.InsertRowCommandId:{t=oi(e,s);break}case D.MoveColsCommandId:{t=Fs(e,s);break}case D.MoveRangeCommandId:{t=ni(e,s);break}case D.MoveRowsCommandId:{t=js(e,s);break}case D.RemoveColCommandId:{t=Gs(e,s);break}case D.RemoveRowCommandId:{t=si(e,s);break}case D.ReorderRangeCommandId:{t=Ju(e,s);break}}return tt(t,s)},ol=(s,e,t)=>[Ke.id,Je.id].includes(e.id)||ci(e,t).some(r=>i.Rectangle.intersects(r,s))?zs(s,e):s,Ys=(s,e)=>{let t=[];switch(e.id){case D.DeleteRangeMoveLeftCommandId:return xu(e,s);case D.DeleteRangeMoveUpCommandId:return el(e,s);case D.InsertRangeMoveDownCommandId:return Zu(e,s);case D.InsertRangeMoveRightCommandId:return Qu(e,s);case D.InsertColCommandId:return sl(e,s);case D.InsertRowCommandId:return nl(e,s);case D.MoveColsCommandId:return qu(e,s);case D.MoveRangeCommandId:return Ku(e,s);case D.MoveRowsCommandId:return zu(e,s);case D.ReorderRangeCommandId:return Yu(e,s);case D.RemoveColCommandId:{t=Gs(e,s);break}case D.RemoveRowCommandId:return tl(e.params,s)}const n=tt(t,s);return n?[n]:[]},rl=(s,e,t)=>[Ke.id,Je.id,ut.id,ms].includes(e.id)||ci(e,t).some(r=>i.Rectangle.intersects(r,s))?Ys(s,e):s;function di(s,e){const{id:t,params:n}=e;let o={length:0,step:0,type:$.Unknown};switch(t){case Ye.id:o.type=$.Delete;break;case De.id:o=zt({start:n.sourceRange.startRow,end:n.sourceRange.endRow},{start:n.targetRange.startRow,end:n.targetRange.endRow},{start:s.startRow,end:s.endRow}),o.type=$.VerticalMove;break;case Ae.id:o=zt({start:n.sourceRange.startColumn,end:n.sourceRange.endColumn},{start:n.targetRange.startColumn,end:n.targetRange.endColumn},{start:s.startColumn,end:s.endColumn}),o.type=$.HorizontalMove;break;case ae.id:o=xe(n.range,s),o?o.type=$.HorizontalMove:o={step:0,length:0,type:$.Delete};break;case Ie.id:o=xe(de(n.range),de(s)),o?o.type=$.VerticalMove:o={step:0,length:0,type:$.Delete};break;case ve.id:o=et(de(n.range),de(s)),o.type=$.VerticalMove;break;case me.id:o=et(n.range,s),o.type=$.HorizontalMove;break;case $e.id:{const r=n.fromRange||new i.ObjectMatrix(n.from).getRange(),a=n.toRange||new i.ObjectMatrix(n.to).getRange();o=Xu(r,a,s)}break}return o?Array.isArray(o)?tt(o,s):tt([o],s):s}function ci(s,e){var n,o,r,a,u,l;const{selectionManagerService:t}=e;switch(s.id){case D.MoveColsCommandId:{const d=s.params;return[d.fromRange,{...d.toRange,startColumn:d.toRange.startColumn-.5,endColumn:d.toRange.endColumn-.5}]}case D.MoveRowsCommandId:{const d=s.params;return[d.fromRange,{...d.toRange,startRow:d.toRange.startRow-.5,endRow:d.toRange.startRow-.5}]}case D.MoveRangeCommandId:{const d=s;return[d.params.fromRange,d.params.toRange]}case D.InsertRowCommandId:{const c=s.params.range;return[{...c,startRow:c.startRow-.5,endRow:c.endRow-.5}]}case D.InsertColCommandId:{const c=s.params.range;return[{...c,startColumn:c.startColumn-.5,endColumn:c.endColumn-.5}]}case D.RemoveRowCommandId:return[s.params.range];case D.RemoveColCommandId:return[s.params.range];case D.DeleteRangeMoveUpCommandId:case D.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 D.DeleteRangeMoveLeftCommandId:case D.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 D.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 il(s){switch(s.id){case Ae.id:{const e=s.params;return[e.sourceRange,{...e.targetRange,startColumn:e.targetRange.startColumn-.5,endColumn:e.targetRange.startColumn-.5}]}case De.id:{const e=s.params;return[e.sourceRange,{...e.targetRange,startRow:e.targetRange.startRow-.5,endRow:e.targetRange.startRow-.5}]}case $e.id:{const e=s.params;return[new i.ObjectMatrix(e.from.value).getRange(),new i.ObjectMatrix(e.to.value).getRange()]}case me.id:{const t=s.params.range;return[{...t,startColumn:t.startColumn-.5,endColumn:t.startColumn-.5}]}case ve.id:{const t=s.params.range;return[{...t,startRow:t.startRow-.5,endRow:t.startRow-.5}]}case ae.id:return[s.params.range];case Ie.id:return[s.params.range]}}function al(s,e){var o,r,a,u,l,d;const t=s.get(i.IUniverInstanceService),n=s.get(g.SheetsSelectionsService);switch(e.id){case D.MoveColsCommandId:{const c=e.params,m=T(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 D.MoveRowsCommandId:{const c=e.params,m=T(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 D.MoveRangeCommandId:{const c=e.params,m=T(t);return{unitId:m.unitId,subUnitId:m.subUnitId,ranges:[c.fromRange,c.toRange]}}case D.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 D.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 D.RemoveRowCommandId:{const m=e.params.range,h=T(t);return{unitId:h.unitId,subUnitId:h.subUnitId,ranges:[m,{...m,startRow:m.endRow+1,endRow:Number.MAX_SAFE_INTEGER}]}}case D.RemoveColCommandId:{const m=e.params.range,h=T(t);return{unitId:h.unitId,subUnitId:h.subUnitId,ranges:[m,{...m,startColumn:m.endColumn+1,endColumn:Number.MAX_SAFE_INTEGER}]}}case D.DeleteRangeMoveUpCommandId:case D.InsertRangeMoveDownCommandId:{const c=e,m=T(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 D.DeleteRangeMoveLeftCommandId:case D.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=T(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 D.ReorderRangeCommandId:{const c=e,{range:m,order:h}=c.params,R=[];for(let C=m.startRow;C<=m.endRow;C++)C in h&&R.push({startRow:C,endRow:C,startColumn:m.startColumn,endColumn:m.endColumn});const S=T(t);return{unitId:S.unitId,subUnitId:S.subUnitId,ranges:R}}}}var ul=Object.getOwnPropertyDescriptor,ll=(s,e,t,n)=>{for(var o=n>1?void 0:n?ul(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},bn=(s,e)=>(t,n)=>e(t,n,s);const dl=i.createInterceptorKey("MERGE_REDO"),cl=i.createInterceptorKey("MERGE_UNDO"),mi=Math.floor(Number.MAX_SAFE_INTEGER/10);class ml 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===$e.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===Ye.id)return;const a=il(e);if(a!=null&&a.some(u=>i.Rectangle.intersects(u,this._range)))return}const t=di(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:dl,MERGE_UNDO:cl}));f(this,"_watchRanges",new Set);f(this,"_refRangeManagerMap",new Map);f(this,"_serializer",hl());f(this,"_onRefRangeChange",()=>{this._sheetInterceptorService.interceptCommand({getMutations:t=>{const n=this._univerInstanceService.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET).getActiveSheet(),o=hi(this._univerInstanceService),r=gi(this._univerInstanceService);if(!n||!o||!r)return{redos:[],undos:[],preRedos:[],preUndos:[]};const l=((()=>{switch(t.id){case D.MoveColsCommandId:{const R=t.params,S=Math.min(R.fromRange.startColumn,R.toRange.startColumn);return this._checkRange([{...R.fromRange,startColumn:S,endColumn:n.getColumnCount()-1}],o,r)}case D.MoveRowsCommandId:{const R=t.params,S=Math.min(R.fromRange.startRow,R.toRange.startRow);return this._checkRange([{...R.fromRange,startRow:S,endRow:n.getRowCount()-1}],o,r)}case D.MoveRangeCommandId:{const R=t;return this._checkRange([R.params.fromRange,R.params.toRange],o,r)}case D.InsertRowCommandId:{const C={startRow:t.params.range.startRow,endRow:n.getRowCount()-1,startColumn:0,endColumn:n.getColumnCount()-1,rangeType:i.RANGE_TYPE.ROW};return this._checkRange([C],o,r)}case D.InsertColCommandId:{const S=t.params.range.startColumn,C={startRow:0,endRow:n.getRowCount()-1,startColumn:S,endColumn:n.getColumnCount()-1,rangeType:i.RANGE_TYPE.COLUMN};return this._checkRange([C],o,r)}case D.RemoveRowCommandId:{const C={startRow:t.params.range.startRow,endRow:n.getRowCount()-1,startColumn:0,endColumn:n.getColumnCount()-1,rangeType:i.RANGE_TYPE.ROW};return this._checkRange([C],o,r)}case D.RemoveColCommandId:{const S=t.params.range.startColumn,C={startRow:0,endRow:n.getRowCount()-1,startColumn:S,endColumn:n.getColumnCount()-1,rangeType:i.RANGE_TYPE.COLUMN};return this._checkRange([C],o,r)}case D.DeleteRangeMoveUpCommandId:case D.InsertRangeMoveDownCommandId:{const S=t.params.range||Ri(this._selectionManagerService)[0],C={startRow:S.startRow,startColumn:S.startColumn,endColumn:S.endColumn,endRow:mi};return this._checkRange([C],o,r)}case D.DeleteRangeMoveLeftCommandId:case D.InsertRangeMoveRightCommandId:{const S=t.params.range||Ri(this._selectionManagerService)[0],C={startRow:S.startRow,startColumn:S.startColumn,endColumn:mi,endRow:S.endRow};return this._checkRange([C],o,r)}case D.ReorderRangeCommandId:{const R=t,{range:S,order:C}=R.params,v=[];for(let I=S.startRow;I<=S.endRow;I++)I in C&&v.push({startRow:I,endRow:I,startColumn:S.startColumn,endColumn:S.endColumn});return this._checkRange(v,o,r)}}})()||[]).reduce((R,S)=>{const C=S(t);return R.push(C),R},[]).reduce((R,S)=>{var C,v;return R.redos.push(...S.redos),R.undos.push(...S.undos),R.preRedos.push(...(C=S.preRedos)!=null?C:[]),R.preUndos.push(...(v=S.preUndos)!=null?v:[]),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=Si(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||hi(this._univerInstanceService),u=r||gi(this._univerInstanceService);if(!a||!u)return i.toDisposable(()=>{});const l=Si(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 ml(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=ll([bn(0,i.ICommandService),bn(1,i.Inject(g.SheetInterceptorService)),bn(2,i.Inject(i.IUniverInstanceService)),bn(3,i.Inject(g.SheetsSelectionsService))],g.RefRangeService);function hi(s){return s.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET).getUnitId()}function gi(s){var e;return(e=s.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:e.getSheetId()}function Ri(s){var e;return((e=s.getCurrentSelections())==null?void 0:e.map(t=>t.range))||[]}function Si(s,e){return`${s}_${e}`}function hl(){const s=["startRow","startColumn","endRow","endColumn","rangeType"],e="_";return{deserialize:t=>{const n=s.reduce((r,a,u)=>(r[String(u)]=a,r),{});return t.split(e).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?e:""}${a}`:`${n}`},"")}}var gl=Object.getOwnPropertyDescriptor,Rl=(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},_t=(s,e)=>(t,n)=>e(t,n,s);const Sl=[me.id,ve.id,ae.id,Ie.id],Cl=[De.id,Ae.id];function qs(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 Ci=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:Ci}));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 xt.id:case tn.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=oe(t._injector,h),S=[{id:G.id,params:h}],C=[{id:F.id,params:R}];return{redos:S,undos:C}}}}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=T(this._univerInstanceService,{unitId:n,subUnitId:o});if(!d)return l;const{worksheet:c}=d,h=c.getMergeData().filter(R=>r.some(S=>i.Rectangle.intersects(R,S)));return h.length?(a.push({id:G.id,params:{unitId:n,subUnitId:o,ranges:h}}),u.push({id:F.id,params:{unitId:n,subUnitId:o,ranges:h}}),{undos:u,redos:a}):l}})}refRangeHandle(t,n,o){switch(t.id){case D.MoveColsCommandId:{const r=t.params;return this._handleMoveColsCommand(r,n,o)}case D.MoveRowsCommandId:{const r=t.params;return this._handleMoveRowsCommand(r,n,o)}case be.id:{const r=t.params,a=r.unitId||n,u=r.subUnitId||o;return this._handleInsertRowCommand(r,a,u)}case Ee.id:{const r=t.params,a=r.unitId||n,u=r.subUnitId||o;return this._handleInsertColCommand(r,a,u)}case Wt.id:{const r=t.params;return this._handleRemoveColCommand(r,n,o)}case At.id:{const r=t.params;return this._handleRemoveRowCommand(r,n,o)}case qe.id:{const r=t.params;return this._handleMoveRangeCommand(r,n,o)}case Ot.id:{const r=t.params;return this._handleInsertRangeMoveRightCommand(r,n,o)}case ut.id:{const r=t.params;return this._handleInsertRangeMoveDownCommand(r,n,o)}case Je.id:{const r=t.params;return this._handleDeleteRangeMoveUpCommand(r,n,o)}case Ke.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===ft.id){const o=n.params,r=o.subUnitId,a=o.unitId;if(!r||!a)return;t(a,r)}if(n.id===F.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(V.first(n=>!!n)).subscribe(n=>{const o=n.getActiveSheet();o&&t(n.getUnitId(),o.getSheetId())})}_handleMoveRowsCommand(t,n,o){const r=pe(this._univerInstanceService,n);if(!r)return this._handleNull();const a=we(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(C=>{if(m<=C.startRow&&h>=C.endRow){l.ranges.push(C);const v=js({id:D.MoveRowsCommandId,params:t},C),I=tt(v,C);I&&d.ranges.push(I)}}),l.ranges.length===0)return this._handleNull();const R=oe(this._injector,l),S=Re(this._injector,d);return{preRedos:[{id:G.id,params:l}],redos:[{id:F.id,params:d}],preUndos:[{id:G.id,params:S}],undos:[{id:F.id,params:R}]}}_handleMoveColsCommand(t,n,o){const r=pe(this._univerInstanceService,n);if(!r)return this._handleNull();const a=we(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(C=>{if(m<=C.startColumn&&h>=C.endColumn){l.ranges.push(C);const v=Fs({id:D.MoveColsCommandId,params:t},C),I=tt(v,C);I&&d.ranges.push(I)}}),l.ranges.length===0)return this._handleNull();const R=oe(this._injector,l),S=Re(this._injector,d);return{preRedos:[{id:G.id,params:l}],redos:[{id:F.id,params:d}],preUndos:[{id:G.id,params:S}],undos:[{id:F.id,params:R}]}}_handleMoveRangeCommand(t,n,o){const r=pe(this._univerInstanceService,n);if(!r)return this._handleNull();const a=we(r,o);if(!a)return this._handleNull();const u=a.getMergeData(),l=u.filter(S=>i.Rectangle.intersects(S,t.fromRange)),d=u.filter(S=>i.Rectangle.intersects(S,t.toRange)),c=l.map(S=>i.Rectangle.getRelativeRange(S,t.fromRange)).map(S=>i.Rectangle.getPositionRange(S,t.toRange)),m=qs(c).filter(S=>!u.some(C=>i.Rectangle.equals(S,C))),h=[{id:G.id,params:{unitId:n,subUnitId:o,ranges:l}},{id:G.id,params:{unitId:n,subUnitId:o,ranges:d}},{id:F.id,params:{unitId:n,subUnitId:o,ranges:m}}],R=[{id:G.id,params:{unitId:n,subUnitId:o,ranges:m}},{id:F.id,params:{unitId:n,subUnitId:o,ranges:d}},{id:F.id,params:{unitId:n,subUnitId:o,ranges:l}}];return{redos:h,undos:R}}_handleInsertRowCommand(t,n,o){const r=pe(this._univerInstanceService,n);if(!r)return this._handleNull();const a=we(r,o);if(!a)return this._handleNull();const{range:u}=t,{startRow:l,endRow:d}=u,c=i.Tools.deepClone(a.getMergeData()).reduce((w,p)=>(l>p.startRow&&l<=p.endRow&&w.push(p),w),[]);if(c.length===0)return this._handleNull();const m=i.Tools.deepClone(a.getMergeData()).reduce((w,p)=>{if(l>p.startRow&&l<=p.endRow){const M=d-l+1;p.endRow+=M,this._checkIsMergeCell(p)&&w.push(p)}return w},[]),h={unitId:n,subUnitId:o,ranges:c},R=oe(this._injector,h),S={unitId:n,subUnitId:o,ranges:m},C=Re(this._injector,S),v=[{id:G.id,params:h},{id:F.id,params:S}],I=[{id:G.id,params:C},{id:F.id,params:R}];return{redos:v,undos:I}}_handleInsertColCommand(t,n,o){const{range:r}=t,a=pe(this._univerInstanceService,n);if(!a)return this._handleNull();const u=we(a,o);if(!u)return this._handleNull();const{startColumn:l,endColumn:d}=r,c=i.Tools.deepClone(u.getMergeData()).reduce((w,p)=>(l>p.startColumn&&l<=p.endColumn&&w.push(p),w),[]);if(c.length===0)return this._handleNull();const m=i.Tools.deepClone(u.getMergeData()).reduce((w,p)=>{if(l>p.startColumn&&l<=p.endColumn){const M=d-l+1;p.endColumn+=M,this._checkIsMergeCell(p)&&w.push(p)}return w},[]),h={unitId:n,subUnitId:o,ranges:c},R=oe(this._injector,h),S={unitId:n,subUnitId:o,ranges:m},C=Re(this._injector,S),v=[{id:G.id,params:h},{id:F.id,params:S}],I=[{id:G.id,params:C},{id:F.id,params:R}];return{redos:v,undos:I}}_handleRemoveColCommand(t,n,o){const r=pe(this._univerInstanceService,n);if(!r)return this._handleNull();const a=we(r,o);if(!a)return this._handleNull();const{range:u}=t,{startColumn:l,endColumn:d}=u,c=i.Tools.deepClone(a.getMergeData()).reduce((M,y)=>(i.Rectangle.intersects(u,y)&&M.push(y),M),[]);if(c.length===0)return this._handleNull();const m=i.Tools.deepClone(a.getMergeData()).reduce((M,y)=>{if(i.Rectangle.intersects(u,y)){if(l<=y.startColumn&&d>=y.endColumn)return M;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)&&M.push(y)}return M},[]),h={unitId:n,subUnitId:o,ranges:c},R=oe(this._injector,h),S={unitId:n,subUnitId:o,ranges:m},C=Re(this._injector,S),v=[{id:G.id,params:h}],I=[{id:F.id,params:S}],w=[{id:G.id,params:C}],p=[{id:F.id,params:R}];return{preUndos:w,undos:p,preRedos:v,redos:I}}_handleRemoveRowCommand(t,n,o){const{range:r}=t,a=pe(this._univerInstanceService,n);if(!a)return this._handleNull();const u=we(a,o);if(!u)return this._handleNull();const{startRow:l,endRow:d}=r,c=i.Tools.deepClone(u.getMergeData()).reduce((M,y)=>(i.Rectangle.intersects(r,y)&&M.push(y),M),[]);if(c.length===0)return this._handleNull();const m=i.Tools.deepClone(u.getMergeData()).reduce((M,y)=>{if(i.Rectangle.intersects(r,y)){if(l<=y.startRow&&d>=y.endRow)return M;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)&&M.push(y)}return M},[]),h={unitId:n,subUnitId:o,ranges:c},R=oe(this._injector,h),S={unitId:n,subUnitId:o,ranges:m},C=Re(this._injector,S),v=[{id:G.id,params:h}],I=[{id:F.id,params:S}],w=[{id:G.id,params:C}],p=[{id:F.id,params:R}];return{preUndos:w,undos:p,preRedos:v,redos:I}}_handleInsertRangeMoveRightCommand(t,n,o){const r=pe(this._univerInstanceService,n);if(!r)return this._handleNull();const a=we(r,o);if(!a)return this._handleNull();const u=t.range,l=a.getMaxColumns()-1,d=a.getMergeData(),c=[],m=[];d.forEach(v=>{const{startRow:I,endRow:w,startColumn:p,endColumn:M}=u;if(i.Rectangle.intersects({startRow:I,startColumn:p,endRow:w,endColumn:l},v)&&(c.push(v),i.Rectangle.contains({startRow:I,startColumn:p,endRow:w,endColumn:l},v))){const O=M-p+1;m.push({startRow:v.startRow,startColumn:v.startColumn+O,endRow:v.endRow,endColumn:v.endColumn+O})}});const h={unitId:n,subUnitId:o,ranges:c},R=oe(this._injector,h),S={unitId:n,subUnitId:o,ranges:m},C=Re(this._injector,S);return{preRedos:[{id:G.id,params:h}],redos:[{id:F.id,params:S}],preUndos:[{id:G.id,params:C}],undos:[{id:F.id,params:R}]}}_handleInsertRangeMoveDownCommand(t,n,o){const r=pe(this._univerInstanceService,n);if(!r)return this._handleNull();const a=we(r,o);if(!a)return this._handleNull();const u=t.range,l=a.getMaxRows()-1,d=a.getMergeData(),c=[],m=[];d.forEach(M=>{const{startRow:y,startColumn:b,endColumn:O,endRow:U}=u;if(i.Rectangle.intersects({startRow:y,startColumn:b,endRow:l,endColumn:O},M)&&(c.push(M),i.Rectangle.contains({startRow:y,startColumn:b,endRow:l,endColumn:O},M))){const k=U-y+1;m.push({startRow:M.startRow+k,startColumn:M.startColumn,endRow:M.endRow+k,endColumn:M.endColumn})}});const h={unitId:n,subUnitId:o,ranges:c},R=oe(this._injector,h),S={unitId:n,subUnitId:o,ranges:m},C=Re(this._injector,S),v=[{id:G.id,params:h}],I=[{id:F.id,params:S}],w=[{id:G.id,params:C}],p=[{id:F.id,params:R}];return{redos:I,undos:p,preRedos:v,preUndos:w}}_handleDeleteRangeMoveUpCommand(t,n,o){const r=pe(this._univerInstanceService,n);if(!r)return this._handleNull();const a=we(r,o);if(!a)return this._handleNull();const u=t.range,l=a.getMaxRows()-1,d=a.getMergeData(),c=[],m=[];d.forEach(M=>{const{startRow:y,startColumn:b,endColumn:O,endRow:U}=u;if(i.Rectangle.intersects({startRow:y,startColumn:b,endRow:l,endColumn:O},M)&&(c.push(M),i.Rectangle.contains({startRow:y,startColumn:b,endRow:l,endColumn:O},M))){const k=U-y+1,W=i.Rectangle.moveVertical(M,-k);m.push(W)}});const h={unitId:n,subUnitId:o,ranges:c},R=oe(this._injector,h),S={unitId:n,subUnitId:o,ranges:m},C=Re(this._injector,S),v=[{id:G.id,params:h}],I=[{id:F.id,params:S}],w=[{id:G.id,params:C}],p=[{id:F.id,params:R}];return{redos:I,undos:p,preRedos:v,preUndos:w}}_handleDeleteRangeMoveLeftCommand(t,n,o){const r=pe(this._univerInstanceService,n);if(!r)return this._handleNull();const a=we(r,o);if(!a)return this._handleNull();const u=t.range,l=a.getMaxColumns()-1,d=a.getMergeData(),c=[],m=[];d.forEach(v=>{const{startRow:I,endRow:w,startColumn:p,endColumn:M}=u;if(i.Rectangle.intersects({startRow:I,startColumn:p,endRow:w,endColumn:l},v)&&(c.push(v),i.Rectangle.contains({startRow:I,startColumn:p,endRow:w,endColumn:l},v))){const O=M-p+1;m.push({startRow:v.startRow,startColumn:v.startColumn-O,endRow:v.endRow,endColumn:v.endColumn-O})}});const h={unitId:n,subUnitId:o,ranges:c},R=oe(this._injector,h),S={unitId:n,subUnitId:o,ranges:m},C=Re(this._injector,S);return{preRedos:[{id:G.id,params:h}],redos:[{id:F.id,params:S}],undos:[{id:F.id,params:R}],preUndos:[{id:G.id,params:C}]}}_checkIsMergeCell(t){return!(t.startRow===t.endRow&&t.startColumn===t.endColumn)}_handleNull(){return{redos:[],undos:[]}}_commandExecutedListener(){this.disposeWithMe(this._commandService.onCommandExecuted(t=>{if(Cl.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(v=>{let{startRow:I,endRow:w,startColumn:p,endColumn:M,rangeType:y}=v;i.Rectangle.intersects(v,r)||(u?d<I&&c>w?(I-=l,w-=l):d>w&&c<=I&&(I+=l,w+=l):d<p&&c>M?(p-=l,M-=l):d>M&&c<=p&&(p+=l,M+=l)),v.startRow===v.endRow&&v.startColumn===v.endColumn||h.push({startRow:I,endRow:w,startColumn:p,endColumn:M,rangeType:y})}),o.setMergeData(h),this.disposableCollection.dispose();const{unitId:R,subUnitId:S}=t.params,C=v=>this.refRangeHandle(v,R,S);h.forEach(v=>{this.disposableCollection.add(this._refRangeService.registerRefRange(v,C,R,S))})}if(Sl.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(I=>{let{startRow:w,endRow:p,startColumn:M,endColumn:y,rangeType:b}=I;d?l?c<=w&&(w+=h,p+=h):c<=M&&(M+=h,y+=h):l?m<w&&(w-=h,p-=h):m<M&&(M-=h,y-=h),I.startRow===I.endRow&&I.startColumn===I.endColumn||R.push({startRow:w,endRow:p,startColumn:M,endColumn:y,rangeType:b})}),o.setMergeData(R),this.disposableCollection.dispose();const{unitId:S,subUnitId:C}=t.params,v=I=>this.refRangeHandle(I,S,C);R.forEach(I=>{this.disposableCollection.add(this._refRangeService.registerRefRange(I,v,S,C))})}}))}},g.MergeCellController=Rl([_t(0,i.Inject(i.ICommandService)),_t(1,i.Inject(g.RefRangeService)),_t(2,i.Inject(i.IUniverInstanceService)),_t(3,i.Inject(i.Injector)),_t(4,i.Inject(g.SheetInterceptorService)),_t(5,i.Inject(g.SheetsSelectionsService))],g.MergeCellController);function pe(s,e){return e?s.getUniverSheetInstance(e):s.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET)}function we(s,e){return e?s.getSheetBySheetId(e):s.getActiveSheet()}var fl=Object.getOwnPropertyDescriptor,vl=(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},Il=(s,e)=>(t,n)=>e(t,n,s);let En=class extends i.Disposable{constructor(s){super(),this._sheetInterceptorService=s,this._initialize()}_initialize(){this._initInterceptorCellContent()}_initInterceptorCellContent(){this.disposeWithMe(this._sheetInterceptorService.intercept(ke.CELL_CONTENT,{priority:11,effect:i.InterceptorEffectEnum.Value|i.InterceptorEffectEnum.Style,handler:(s,e,t)=>{var o;const n=e.workbook.getStyles().getStyleByCell(s);return(o=n==null?void 0:n.n)!=null&&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=Y.stripErrorMargin(Number(s.v))),t(s)}}))}};En=vl([Il(0,i.Inject(g.SheetInterceptorService))],En);var pl=Object.getOwnPropertyDescriptor,wl=(s,e,t,n)=>{for(var o=n>1?void 0:n?pl(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},Ue=(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 V.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 at.id:i.isICellData(n.value)&&n.value.f?(o=this._permissionCheckWithFormula(n),r=this._localeService.t("permission.dialog.formulaErr")):o=this._permissionCheckBySetRangeValue({workbookTypes:[le],rangeTypes:[he],worksheetTypes:[Pt,ge]},n);break;case en.id:o=this.permissionCheckWithRanges({workbookTypes:[le],rangeTypes:[he],worksheetTypes:[Pt,ge]}),r=this._localeService.t("permission.dialog.editErr");break;case jt.id:case gn.id:o=this.permissionCheckWithoutRange({worksheetTypes:[rt]}),r=this._localeService.t("permission.dialog.setRowColStyleErr");break;case fn.id:case vn.id:case In.id:o=this.permissionCheckWithoutRange({worksheetTypes:[it]}),r=this._localeService.t("permission.dialog.setRowColStyleErr");break;case Dt.id:case Nt.id:o=this._permissionCheckByMoveCommand(n),r=this._localeService.t("permission.dialog.moveRowColErr");break;case qe.id:o=this._permissionCheckByMoveRangeCommand(n),r=this._localeService.t("permission.dialog.moveRangeErr");break;case Os.id:o=this._permissionCheckByWorksheetCommand([le,un]),r=this._localeService.t("permission.dialog.operatorSheetErr"),o===!1&&this._worksheetProtectionRuleModel.resetOrder();break;case Rn.id:o=this._permissionCheckByWorksheetCommand([le,ln]),r=this._localeService.t("permission.dialog.operatorSheetErr"),o===!1&&this._worksheetProtectionRuleModel.resetOrder();break;case Vs.id:{const{unitId:a,subUnitId:u}=n;o=this._permissionCheckByWorksheetCommand([le,rn],a,u),r=this._localeService.t("permission.dialog.operatorSheetErr"),o===!1&&this._worksheetProtectionRuleModel.resetOrder()}break;case $t.id:o=this.permissionCheckWithRanges({workbookTypes:[le],rangeTypes:[he],worksheetTypes:[ge,rt]},n.ranges),r=this._localeService.t("permission.dialog.setRowColStyleErr");break;case Ht.id:o=this.permissionCheckWithRanges({workbookTypes:[le],rangeTypes:[he],worksheetTypes:[ge,it]},n.ranges),r=this._localeService.t("permission.dialog.setRowColStyleErr");break;case ws.id:o=this.permissionCheckWithRanges({workbookTypes:[le],rangeTypes:[he],worksheetTypes:[ge,rt]}),r=this._localeService.t("permission.dialog.setRowColStyleErr");break;case bs.id:o=this.permissionCheckWithRanges({workbookTypes:[le],rangeTypes:[he],worksheetTypes:[ge,it]}),r=this._localeService.t("permission.dialog.setRowColStyleErr");break;case Ot.id:o=this._permissionCheckWithInsertRangeMove("right"),r=this._localeService.t("permission.dialog.insertOrDeleteMoveRangeErr");break;case ut.id:o=this._permissionCheckWithInsertRangeMove("bottom"),r=this._localeService.t("permission.dialog.insertOrDeleteMoveRangeErr");break;case Ke.id:o=this._permissionCheckWithInsertRangeMove("left"),r=this._localeService.t("permission.dialog.insertOrDeleteMoveRangeErr");break;case Je.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===Ft.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=T(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=T(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 an(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,S,C,v;const n=T(this._univerInstanceService);if(!n)return!1;const{worksheet:o,unitId:r,subUnitId:a}=n,u=this._selectionManagerService.getCurrentLastSelection();if(!u)return!0;const l=(S=(R=u==null?void 0:u.primary)==null?void 0:R.actualRow)!=null?S:0,d=(v=(C=u==null?void 0:u.primary)==null?void 0:C.actualColumn)!=null?v:0,{workbookTypes:c,worksheetTypes:m,rangeTypes:h}=t;return!(c&&c.some(w=>{var y,b;const p=new w(r);return((b=(y=this._permissionService.getPermissionPoint(p.id))==null?void 0:y.value)!=null?b:!1)===!1})===!0||m&&m.some(w=>{var y,b;const p=new w(r,a);return((b=(y=this._permissionService.getPermissionPoint(p.id))==null?void 0:y.value)!=null?b:!1)===!1})===!0||h&&h.some(w=>{var O,U,P,E,k;const p=(U=(O=o.getCell(l,d))==null?void 0:O.selectionProtection)==null?void 0:U[0];if(!(p!=null&&p.ruleId))return!1;const M=(P=this._rangeProtectionRuleModel.getRule(r,a,p.ruleId))==null?void 0:P.permissionId;if(!M)return!1;const y=new w(r,a,M);return((k=(E=this._permissionService.getPermissionPoint(y.id))==null?void 0:E.value)!=null?k:!1)===!1})===!0)}permissionCheckWithRanges(t,n,o,r){var S;const a=T(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:(S=this._selectionManagerService.getCurrentSelections())==null?void 0:S.map(C=>C.range);if(!d)return!1;const{workbookTypes:c,worksheetTypes:m,rangeTypes:h}=t,R=[];return c&&R.push(...c.map(C=>new C(o).id)),m&&R.push(...m.map(C=>new C(o,r).id)),h&&this._rangeProtectionRuleModel.getSubunitRuleList(o,r).forEach(C=>{d.some(I=>C.ranges.some(w=>i.Rectangle.intersects(w,I)))&&R.push(...h.map(I=>new I(o,r,C.permissionId).id))}),R.length?this._permissionService.composePermission(R).every(C=>C.value):!0}_permissionCheckByMoveCommand(t){const n=T(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 S=(m=(c=o.getCell(h,R))==null?void 0:c.selectionProtection)==null?void 0:m[0];if((S==null?void 0:S[_.Edit])===!1)return!1}}),!0)}_permissionCheckByMoveRangeCommand(t){const n=T(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 S=(m=(c=o.getCell(h,R))==null?void 0:c.selectionProtection)==null?void 0:m[0];if((S==null?void 0:S[_.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(),S=this._definedNamesService.getValueByName(R,m);if(S){let C=S.formulaOrRefString;C.startsWith(Y.operatorToken.EQUALS)&&(C=C.slice(1));const v=C.split(",");for(let I=0;I<v.length;I++){const w=v[I],p=Y.deserializeRangeWithSheet(w);if(p.sheetName){const M=h.getSheetBySheetName(p.sheetName);if(!M)return!0;const{startRow:y,endRow:b,startColumn:O,endColumn:U}=p.range;for(let P=y;P<=b;P++)for(let E=O;E<=U;E++){const k=(l=(u=M.getCell(P,E))==null?void 0:u.selectionProtection)==null?void 0:l[0];if((k==null?void 0:k[_.View])===!1)return!1}}}return!0}else{const C=this._lexerTreeBuilder.sequenceNodesBuilder(r);if(!C)return!0;for(let v=0;v<C.length;v++){const I=C[v];if(typeof I=="string"||I.nodeType!==Y.sequenceNodeType.REFERENCE)continue;const{token:w}=I,p=Y.deserializeRangeWithSheetWithCache(w),M=p.unitId?this._univerInstanceService.getUnit(p.unitId):this._univerInstanceService.getCurrentUnitForType(i.UniverInstanceType.UNIVER_SHEET);if(!M)return!0;let y=p.sheetName?M.getSheetBySheetName(p.sheetName):M.getActiveSheet();const b=M.getUnitId();if(p.sheetName){if(y=M.getSheetBySheetName(p.sheetName),!y)return!0;const k=y==null?void 0:y.getSheetId();if(!this._permissionService.getPermissionPoint(new kt(b,k).id))return!1}if(!y)return!0;const{startRow:O,endRow:U,startColumn:P,endColumn:E}=p.range;for(let k=O;k<=U;k++)for(let W=P;W<=E;W++){const A=(c=(d=y.getCell(k,W))==null?void 0:d.selectionProtection)==null?void 0:c[0];if((A==null?void 0:A[_.View])===!1)return!1}}return!0}}if(o){const m=T(this._univerInstanceService);if(!m)return!1;const h=t.unitId||m.unitId,R=t.subUnitId||m.subUnitId,C=this._rangeProtectionRuleModel.getSubunitRuleList(h,R).filter(I=>I.ranges.some(w=>i.Rectangle.intersects(w,o))).map(I=>new he(h,R,I.permissionId).id);if(!this._permissionService.composePermission(C).every(I=>I.value))return!1}return!0}},g.SheetPermissionCheckController=wl([Ue(0,i.ICommandService),Ue(1,i.IUniverInstanceService),Ue(2,i.IPermissionService),Ue(3,i.Inject(g.SheetsSelectionsService)),Ue(4,i.Inject(X)),Ue(5,i.Inject(ye)),Ue(6,i.Inject(i.LocaleService)),Ue(7,i.Inject(Y.LexerTreeBuilder)),Ue(8,i.IContextService),Ue(9,Y.IDefinedNamesService)],g.SheetPermissionCheckController);var Ml=Object.getOwnPropertyDescriptor,yl=(s,e,t,n)=>{for(var o=n>1?void 0:n?Ml(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},Yt=(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 V.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();wt().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=>{[...re()].forEach(d=>{const c=new d(o,a,l.permissionId);this._permissionService.deletePermissionPoint(c.id)})}),[...ie(),...Se()].forEach(l=>{const d=new l(o,a);this._permissionService.deletePermissionPoint(d.id)})}),wt().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=yl([Yt(0,i.Inject(i.IPermissionService)),Yt(1,i.Inject(i.IUniverInstanceService)),Yt(2,i.Inject(X)),Yt(3,i.Inject(ye)),Yt(4,i.Inject(pt))],g.WorkbookPermissionService);var _l=Object.getOwnPropertyDescriptor,bl=(s,e,t,n)=>{for(var o=n>1?void 0:n?_l(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},Pe=(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()}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:N.SelectRange,actions:je})})}),!n.length){this._rangeProtectionRuleModel.changeRuleInitState(!0);return}this._authzIoService.batchAllowed(n).then(u=>{u.forEach(l=>{const d=a.get(l.objectID);d&&re().forEach(c=>{const m=new c(o,d.subUnitId,l.objectID),h=m.subType,R=l.actions.find(S=>S.action===h);(R==null?void 0:R.allowed)!==void 0&&this._permissionService.updatePermissionPoint(m.id,R.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:N.SelectRange,actions:je}).then(t=>{re().forEach(n=>{if(e.type==="set"){const{rule:l,oldRule:d}=e;if(l.permissionId===(d==null?void 0:d.permissionId))return}const o=e.rule,r=new n(o.unitId,o.subUnitId,o.permissionId),a=r.subType,u=t.find(l=>l.action===a);u&&this._permissionService.updatePermissionPoint(r.id,u.allowed)}),this._rangeProtectionRuleModel.ruleRefresh(e.rule.permissionId)}):this._rangeProtectionRuleModel.getSubunitRuleList(e.unitId,e.subUnitId).length===0&&(this._worksheetProtectionPointRuleModel.deleteRule(e.unitId,e.subUnitId),[...Se()].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:N.Workbook,unitID:t,actions:Ur}).then(o=>{wt().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:N.Worksheet,actions:je}).then(t=>{ie().forEach(n=>{const o=new n(e.unitId,e.subUnitId),r=o.subType,a=t.find(u=>u.action===r);a&&this._permissionService.updatePermissionPoint(o.id,a.allowed)}),this._worksheetProtectionRuleModel.ruleRefresh(e.rule.permissionId)}):([...ie(),...Se()].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:N.Worksheet,actions:Sn}).then(t=>{Se().forEach(n=>{const o=new n(e.unitId,e.subUnitId),r=o.subType,a=t.find(u=>u.action===r);a&&this._permissionService.updatePermissionPoint(o.id,a.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:N.Worksheet,actions:je}));const c=this._worksheetProtectionPointRuleModel.getRule(o,l);c&&(a.set(c.permissionId,c),n.push({objectID:c.permissionId,unitID:o,objectType:N.Worksheet,actions:Sn}))}),!n.length){this._worksheetProtectionRuleModel.changeRuleInitState(!0);return}this._authzIoService.batchAllowed(n).then(u=>{u.forEach(l=>{const d=a.get(l.objectID);d&&[...ie(),...Se()].forEach(c=>{const m=new c(o,d.subUnitId),h=m.subType,R=l.actions.find(S=>S.action===h);(R==null?void 0:R.allowed)!==void 0&&this._permissionService.updatePermissionPoint(m.id,R.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(V.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();wt().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();[...ie(),...Se()].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=>{re().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:N.Worksheet,actions:je}).then(d=>{let c="";ie().forEach(m=>{var C;const h=new m(e,l),R=h.subType,S=d.find(v=>v.action===R);S&&(((C=this._permissionService.getPermissionPoint(h.id))==null?void 0:C.value)!==S.allowed&&(o=!0),this._permissionService.updatePermissionPoint(h.id,S.allowed),c+=`${S.action}_${S.allowed}`)}),this._worksheetProtectionRuleModel.ruleRefresh(`${t}_${c}`),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:N.Worksheet,actions:Sn}).then(d=>{Se().forEach(c=>{var S;const m=new c(e,l),h=m.subType,R=d.find(C=>C.action===h);R&&(((S=this._permissionService.getPermissionPoint(m.id))==null?void 0:S.value)!==R.allowed&&(o=!0),this._permissionService.updatePermissionPoint(m.id,R.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:N.SelectRange,actions:je}).then(d=>{let c="";re().forEach(m=>{var C;const h=new m(e,l,t),R=h.subType,S=d.find(v=>v.action===R);S&&(((C=this._permissionService.getPermissionPoint(h.id))==null?void 0:C.value)!==S.allowed&&(o=!0),this._permissionService.updatePermissionPoint(h.id,S.allowed),c+=`${S.action}_${S.allowed}`)}),this._rangeProtectionRuleModel.ruleRefresh(`${t}_${c}`),o&&this._undoRedoService.clearUndoRedo(e)})}}_refreshPermissionByCollaCreate(){this.disposeWithMe(this._commandService.onCommandExecuted((e,t)=>{if(t!=null&&t.fromCollab&&(e.id===ce.id||e.id===Le.id||e.id===Cn.id)){const n=e.params;this._undoRedoService.clearUndoRedo(n.unitId)}}))}},g.SheetPermissionInitController=bl([Pe(0,i.IUniverInstanceService),Pe(1,i.IPermissionService),Pe(2,i.IAuthzIoService),Pe(3,i.Inject(X)),Pe(4,i.Inject(ye)),Pe(5,i.Inject(i.UserManagerService)),Pe(6,i.Inject(pt)),Pe(7,i.Inject(g.WorkbookPermissionService)),Pe(8,i.Inject(i.IUndoRedoService)),Pe(9,i.Inject(i.ICommandService))],g.SheetPermissionInitController);var El=Object.getOwnPropertyDescriptor,Tl=(s,e,t,n)=>{for(var o=n>1?void 0:n?El(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);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(V.filter(t=>t.type===N.SelectRange),V.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 S=c;S<=m;S++)for(let C=h;C<=R;C++)l.delete(`${S}-${C}`)})}),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 S=m;S<=h;S++)a.delete(`${R}-${S}`),u.delete(`${R}-${S}`)}),this._permissionIdCache.delete(r.permissionId)}_getSelectionActions(t,n,o){var c,m,h,R,S,C,v,I,w,p,M,y;const r=(h=(m=this._permissionService.getPermissionPoint((c=new he(t,n,o.permissionId))==null?void 0:c.id))==null?void 0:m.value)!=null?h:!0,a=(C=(S=this._permissionService.getPermissionPoint((R=new on(t,n,o.permissionId))==null?void 0:R.id))==null?void 0:S.value)!=null?C:!0,u=(w=(I=this._permissionService.getPermissionPoint((v=new Ds(t,n,o.permissionId))==null?void 0:v.id))==null?void 0:I.value)!=null?w:!1,l=(y=(M=this._permissionService.getPermissionPoint((p=new Ns(t,n,o.permissionId))==null?void 0:p.id))==null?void 0:M.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:S,endColumn:C}=m;for(let v=h;v<=R;v++){const I=a.get(`${v}`);I?I.set(l.id,d):a.set(`${v}`,new Map([[l.id,d]]));for(let w=S;w<=C;w++){o.set(`${v}-${w}`,l.id),r.set(`${v}-${w}`,c);const p=u.get(`${w}`);p?p.set(l.id,d):u.set(`${w}`,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(V.filter(t=>t.type===N.SelectRange),V.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:S,endColumn:C}=m;for(let v=h;v<=R;v++){const I=l.get(`${v}`);I?I.set(a,c):l.set(`${v}`,new Map([[a,c]]));for(let w=S;w<=C;w++){const p=d.get(`${w}`);p?p.set(a,c):d.set(`${w}`,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 S=a.get(`${R}`);S==null||S.delete(r.id);for(let C=m;C<=h;C++){const v=u.get(`${C}`);v==null||v.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=Tl([Ks(0,i.Inject(X)),Ks(1,i.Inject(i.IPermissionService)),Ks(2,i.Inject(i.IUniverInstanceService))],g.RangeProtectionCache);var Ul=Object.getOwnPropertyDescriptor,Pl=(s,e,t,n)=>{for(var o=n>1?void 0:n?Ul(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},Tn=(s,e)=>(t,n)=>e(t,n,s);let Un=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(ke.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(ke.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 kt(n,o).id))==null?void 0:a.value)!=null?u:!1,[_.Edit]:(d=(l=this._permissionService.getPermissionPoint(new ge(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)}}))}};Un=Pl([Tn(0,i.IPermissionService),Tn(1,i.Inject(ye)),Tn(2,i.Inject(g.SheetInterceptorService)),Tn(3,i.Inject(g.RangeProtectionCache))],Un);var kl=Object.getOwnPropertyDescriptor,Ol=(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},fi=(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(bt.filter(e=>e.type===N.SelectRange),bt.filter(e=>re().some(t=>e instanceof t)),bt.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=re().reduce((h,R)=>{var v;const S=new R(e,t,c.permissionId),C=this._permissionService.getPermissionPoint(S.id);return h[S.subType]=(v=C==null?void 0:C.value)!=null?v:S.value,h},{});d.push({...m,ruleId:c.id,ranges:c.ranges})}return this._cache.set(u,d),d}clear(){this._cache.clear()}},g.RangeProtectionRenderModel=Ol([fi(0,i.Inject(X)),fi(1,i.Inject(i.IPermissionService))],g.RangeProtectionRenderModel);const Js=i.createIdentifier("univer.exclusive-range-service");class vi extends i.Disposable{constructor(){super(...arguments);f(this,"_exclusiveRanges",new Map);f(this,"_exclusiveRangesChange$",new V.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 Nl=Object.getOwnPropertyDescriptor,Dl=(s,e,t,n)=>{for(var o=n>1?void 0:n?Nl(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.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 S=a.setValue(R);c.s=S})})}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 S={...a.getStyleByCell(h)||{},n:{pattern:l.pattern}},C=a.setValue(S);h.s=C}else{const R={n:{pattern:l.pattern}},S=a.setValue(R);S&&u.setValue(c,m,{s:S})}})})})}},g.NumfmtService=Dl([Xs(0,i.IResourceManagerService),Xs(1,i.IUniverInstanceService),Xs(2,i.ILogService)],g.NumfmtService);var Al=Object.getOwnPropertyDescriptor,Wl=(s,e,t,n)=>{for(var o=n>1?void 0:n?Al(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},Ge=(s,e)=>(t,n)=>e(t,n,s);const Ii=[me.id,ve.id,ae.id,Ie.id],pi=[De.id,Ae.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===Ps.id){const r=o.params,a=r.subUnitId,u=r.unitId;if(!a||!u)return;t(u,a)}if(o.id===x.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 Nt.id:return this._getRefRangeMutationsByMoveRows(t.params,n,o);case Dt.id:return this._getRefRangeMutationsByMoveCols(t.params,n,o);case be.id:return this._getRefRangeMutationsByInsertRows(t.params,n,o);case Ee.id:return this._getRefRangeMutationsByInsertCols(t.params,n,o);case Wt.id:return this._getRefRangeMutationsByDeleteCols(t.params,n,o);case At.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 S=i.Tools.deepClone(R),{startColumn:C,endColumn:v}=a;if(C<=S.startColumn&&v>=S.endColumn)return h;C>=S.startColumn&&v<=S.endColumn?S.endColumn-=v-C+1:C<S.startColumn?(S.startColumn=C,S.endColumn-=v-C+1):v>S.endColumn&&(S.endColumn=C-1),this._checkIsRightRange(S)&&h.push(S)}return h},[]);c.ranges=m,c.ranges.length?(u.push({id:x.id,params:{unitId:n,subUnitId:o,rule:c,ruleId:d.id}}),l.push({id:x.id,params:{unitId:n,subUnitId:o,rule:d,ruleId:d.id}})):(u.push({id:Me.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 S=i.Tools.deepClone(R),{startRow:C,endRow:v}=a;if(C<=S.startRow&&v>=S.endRow)return h;C>=S.startRow&&v<=S.endRow?S.endRow-=v-C+1:C<S.startRow?(S.startRow=C,S.endRow-=v-C+1):v>S.endRow&&(S.endRow=C-1),this._checkIsRightRange(S)&&h.push(S)}return h},[]);c.ranges=m,u.push({id:x.id,params:{unitId:n,subUnitId:o,rule:c,ruleId:d.id}}),l.push({id:x.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:x.id,params:{unitId:n,subUnitId:o,rule:m,ruleId:c.id}}),d.push({id:x.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:x.id,params:{unitId:n,subUnitId:o,rule:m,ruleId:c.id}}),d.push({id:x.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),S=t.fromRange.startRow;let C=!1;h.ranges.forEach(v=>{a>v.startRow&&a<=v.endRow&&(S<v.startRow&&(v.startRow=v.startRow-u,v.endRow=v.endRow-u),v.endRow+=u,C=!0)}),C&&(d.push({id:x.id,params:{unitId:n,subUnitId:o,rule:h,ruleId:m.id}}),c.push({id:x.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),S=t.fromRange.startColumn;let C=!1;h.ranges.forEach(v=>{a>v.startColumn&&a<=v.endColumn&&(S<v.startColumn&&(v.startColumn=v.startColumn-u,v.endColumn=v.endColumn-u),v.endColumn+=u,C=!0)}),C&&(d.push({id:x.id,params:{unitId:n,subUnitId:o,rule:h,ruleId:m.id}}),c.push({id:x.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(pi.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(v=>{v.ranges.forEach(w=>{let{startRow:p,endRow:M,startColumn:y,endColumn:b}=w;i.Rectangle.intersects(w,r)||(u?d<p&&c>M?(p-=l,M-=l):d>M&&c<=p&&(p+=l,M+=l):d<y&&c>b?(y-=l,b-=l):d>b&&c<=y&&(y+=l,b+=l)),this._checkIsRightRange({startRow:p,endRow:M,startColumn:y,endColumn:b})&&(w.startColumn=y,w.endColumn=b,w.startRow=p,w.endRow=M)})}),this.disposableCollection.dispose();const{unitId:h,subUnitId:R}=t.params,S=v=>this.refRangeHandle(v,h,R);this._selectionProtectionRuleModel.getSubunitRuleList(h,R).reduce((v,I)=>[...v,...I.ranges],[]).forEach(v=>{this.disposableCollection.add(this._refRangeService.registerRefRange(v,S,h,R))}),this._selectionProtectionRenderModel.clear()}if(Ii.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(I=>{I.ranges.forEach(p=>{let{startRow:M,endRow:y,startColumn:b,endColumn:O}=p;l?u?d<=M&&(M+=m,y+=m):d<=b&&(b+=m,O+=m):u?c<M&&(M-=m,y-=m):c<b&&(b-=m,O-=m),this._checkIsRightRange({startRow:M,endRow:y,startColumn:b,endColumn:O})&&(p.startColumn=b,p.endColumn=O,p.startRow=M,p.endRow=y)})}),this.disposableCollection.dispose();const{unitId:R,subUnitId:S}=t.params,C=I=>this.refRangeHandle(I,R,S);this._selectionProtectionRuleModel.getSubunitRuleList(R,S).reduce((I,w)=>[...I,...w.ranges],[]).forEach(I=>{this.disposableCollection.add(this._refRangeService.registerRefRange(I,C,R,S))}),this._selectionProtectionRenderModel.clear()}}))}_checkIsRightRange(t){return t.startRow<=t.endRow&&t.startColumn<=t.endColumn}_initReBuildCache(){this.disposeWithMe(this._commandService.onCommandExecuted(t=>{if(Ii.includes(t.id)||pi.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===cn.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:Me.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=Wl([Ge(0,i.Inject(X)),Ge(1,i.Inject(i.IUniverInstanceService)),Ge(2,i.ICommandService),Ge(3,i.Inject(g.RefRangeService)),Ge(4,i.Inject(g.RangeProtectionRenderModel)),Ge(5,i.Inject(g.RangeProtectionCache)),Ge(6,i.Inject(g.SheetInterceptorService)),Ge(7,i.Inject(X))],g.RangeProtectionRefRangeService);var Vl=Object.getOwnPropertyDescriptor,Ll=(s,e,t,n)=>{for(var o=n>1?void 0:n?Vl(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},qt=(s,e)=>(t,n)=>e(t,n,s);const $l="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":{re().forEach(t=>{const n=new t(e.unitId,e.subUnitId,e.rule.permissionId);this._permissionService.addPermissionPoint(n)});break}case"delete":{re().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&&re().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:$l,businesses:[sn.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:N.SelectRange,actions:je})}),l.forEach(d=>{re().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=Ll([qt(0,i.Inject(X)),qt(1,i.Inject(i.IPermissionService)),qt(2,i.Inject(i.IResourceManagerService)),qt(3,i.Inject(g.RangeProtectionCache)),qt(4,i.Inject(i.IUniverInstanceService))],g.RangeProtectionService);var Hl=Object.getOwnPropertyDescriptor,Bl=(s,e,t,n)=>{for(var o=n>1?void 0:n?Hl(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(o=a(o)||o);return o},jl=(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=Bl([jl(0,i.Inject(g.SheetRangeThemeModel))],g.SheetRangeThemeService);var Fl=Object.defineProperty,Gl=Object.getOwnPropertyDescriptor,zl=(s,e,t)=>e in s?Fl(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,Yl=(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},wi=(s,e)=>(t,n)=>e(t,n,s),Mi=(s,e,t)=>zl(s,typeof e!="symbol"?e+"":e,t);const ql="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(Hu,o),this._initConfig(),this._initDependencies()}_initConfig(){var e,t,n;(e=this._config)!=null&&e.onlyRegisterFormulaRelatedMutations&&this._configService.setConfig(Zr,!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=[[Xe],[g.SheetsSelectionsService],[g.RefRangeService],[g.WorkbookPermissionService],[Qe,{useClass:g.NumfmtService}],[g.SheetInterceptorService],[g.SheetRangeThemeService],[g.SheetSkeletonService],[Mn],[g.MergeCellController],[En],[g.DefinedNameDataController],[g.WorksheetPermissionService],[ye],[pt],[Un],[g.SheetPermissionInitController],[g.SheetPermissionCheckController],[g.SheetRangeThemeModel],[g.RangeProtectionRenderModel],[X],[g.RangeProtectionCache],[g.RangeProtectionRefRangeService],[g.RangeProtectionService],[Js,{useClass:vi,deps:[g.SheetsSelectionsService]}]];(t=this._config)!=null&&t.notExecuteFormula||e.push([yn]),i.registerDependencies(this._injector,i.mergeOverrideWithDependencies(e,this._config.override)),i.touchDependencies(this._injector,[[g.SheetInterceptorService],[g.RangeProtectionService],[Js],[g.SheetPermissionInitController]])}onStarting(){i.touchDependencies(this._injector,[[Mn],[g.MergeCellController],[g.WorkbookPermissionService],[g.WorksheetPermissionService],[Un],[g.SheetSkeletonService]])}onRendered(){i.touchDependencies(this._injector,[[Qe]])}onReady(){i.touchDependencies(this._injector,[[yn],[g.DefinedNameDataController],[g.SheetRangeThemeModel],[En],[g.RangeProtectionRenderModel],[g.RangeProtectionRefRangeService],[g.RefRangeService],[g.SheetPermissionCheckController]])}},Mi(g.UniverSheetsPlugin,"pluginName",ql),Mi(g.UniverSheetsPlugin,"type",i.UniverInstanceType.UNIVER_SHEET),g.UniverSheetsPlugin=Yl([i.DependentOn(Y.UniverFormulaEnginePlugin),wi(1,i.Inject(i.Injector)),wi(2,i.IConfigService)],g.UniverSheetsPlugin);var yi=(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))(yi||{}),_i=(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))(_i||{});const Kl=[Ve.id,Ce.id,Ws.id,We.id,ft.id,De.id,Ae.id,mt.id,ht.id,Ct.id,St.id,me.id,ve.id,ae.id,Ie.id,yt.id,gt.id,Mt.id,vt.id],Jl=[B.id,$e.id,G.id,F.id,Vt.id,It.id,Rt.id,ct.id,nt.id,st.id];function Xl(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 Zl(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[]}}const Ql=1.5,xl="rgba(255, 255, 255, 0.01)";function ed(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=bi(t)),o}function bi(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}}const td=(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:S,endRow:C,endColumn:v}=a[a.length-1];if(r===i.Dimension.COLUMNS){const M=t.find(y=>y.startColumn===m&&y.endColumn===m&&h===y.startRow);M&&(v=M.endColumn,R=M.startRow,C=M.endRow)}else if(r===i.Dimension.ROWS){const M=t.find(y=>y.startRow===h&&y.endRow===h&&m===y.startColumn);M&&(C=M.endRow,S=M.startColumn,v=M.endColumn)}const I={startRow:R,startColumn:S,endRow:C,endColumn:v,actualRow:h,actualColumn:m,isMerged:!0,isMergedMainCell:R===h&&S===m},w=o.map((M,y,b)=>({range:M.range,style:null,primary:y===b.length-1?I:null})),p={unitId:u,subUnitId:l,type:te.ONLY_SET,selections:w};return{id:q.id,params:p}}return null}return null},nd=(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};function Ei(s){return s==null?!1:s.v!==void 0&&s.v!==null&&s.v!==""||s.p!==void 0}function Pn(s,e){return s&&s.spanAnchor?Ei(e.getValue(s.spanAnchor.startRow,s.spanAnchor.startColumn)):Ei(s)}function sd(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,S)=>{R===c&&S===d&&u.setValue(R,S,{...r.getValue(R,S),spanAnchor:{startRow:c,endRow:h,startColumn:d,endColumn:m}}),(R!==c||S!==d)&&(u.realDeleteValue(R,S),u.setValue(R,S,{spanAnchor:{startRow:c,endRow:h,startColumn:d,endColumn:m}}))})}),u}function od(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||Pn(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 rd(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||Pn(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 id(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||Pn(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 ad(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||Pn(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 ud(s,e,t){const n=t.getMaxRows(),o=t.getMaxColumns(),r=sd(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:S,range:C,spanAnchor:v}=id(h,r,1,a);if(v&&R.push(v),S){h=C,m=!0;continue}}if(c&&h.endRow!==n-1){const{hasValue:S,range:C,spanAnchor:v}=ad(h,r,1,a);if(v&&R.push(v),S){h=C,m=!0;continue}}if(u&&h.startColumn!==0){const{hasValue:S,range:C,spanAnchor:v}=od(h,r,1,a);if(v&&R.push(v),S){h=C,m=!0;continue}}if(l&&h.endColumn!==o-1){const{hasValue:S,range:C,spanAnchor:v}=rd(h,r,1,a);if(v&&R.push(v),S){h=C,m=!0;continue}}}return R.length>0&&(h=i.Rectangle.union(h,...R)),h}const Ti=(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 Pi(s,e,h,n,o,!1)}},Ui=(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 ki(s,e,h,n,o,!1)}},Pi=(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 Ti(s,e,h,n,o,!1)}},ki=(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 Ui(s,e,h,n,o,!1)}};function kn(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 ld=(s,e,t,n,o=1)=>{switch(n){case i.Direction.UP:return Ti(s,e,t,o);case i.Direction.DOWN:return Ui(s,e,t,o);case i.Direction.LEFT:return Pi(s,e,t,o);case i.Direction.RIGHT:return ki(s,e,t,o)}},dd=(s,e,t)=>{let n,o=-1,r;for(let I=0;I<s.length;I++)if(s[I].primary){n=s[I],o=I,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,S=a?d.startRow===c&&d.startColumn===m:d.endRow===h&&d.endColumn===R,C=S&&a;if(!i.Rectangle.equals(n.range,d)){const I=S?l.range:ld(n.range,t,d,e);if(!I)return null;const w=C?kn(I.endRow,I.endColumn,t):kn(I.startRow,I.startColumn,t);return{startRow:w.startRow,startColumn:w.startColumn,endRow:w.endRow,endColumn:w.endColumn}}const v=C?kn(l.range.endRow,l.range.endColumn,t):kn(l.range.startRow,l.range.startColumn,t);return{startRow:v.startRow,startColumn:v.startColumn,endRow:v.endRow,endColumn:v.endColumn}},cd={WorkbookCommentPermission:$n,WorkbookCopyPermission:Hn,WorkbookCreateProtectPermission:Bn,WorkbookCreateSheetPermission:jn,WorkbookDeleteSheetPermission:Fn,WorkbookDuplicatePermission:Gn,WorkbookEditablePermission:le,WorkbookExportPermission:zn,WorkbookHideSheetPermission:rn,WorkbookHistoryPermission:Eo,WorkbookManageCollaboratorPermission:an,WorkbookMoveSheetPermission:un,WorkbookPrintPermission:Yn,WorkbookRecoverHistoryPermission:qn,WorkbookRenameSheetPermission:ln,WorkbookSharePermission:Kn,WorkbookViewHistoryPermission:Xn,WorkbookViewPermission:Jn,WorksheetCopyPermission:Zn,WorksheetDeleteColumnPermission:Qn,WorksheetDeleteProtectionPermission:xn,WorksheetDeleteRowPermission:es,WorksheetEditExtraObjectPermission:ts,WorksheetEditPermission:ge,WorksheetFilterPermission:ns,WorksheetInsertColumnPermission:ss,WorksheetInsertHyperlinkPermission:os,WorksheetInsertRowPermission:rs,WorksheetManageCollaboratorPermission:is,WorksheetPivotTablePermission:as,WorksheetSetCellStylePermission:us,WorksheetSetCellValuePermission:Pt,WorksheetSetColumnStylePermission:rt,WorksheetSetRowStylePermission:it,WorksheetSortPermission:ls,WorksheetViewPermission:kt,RangeProtectionPermissionEditPoint:he,RangeProtectionPermissionViewPoint:on},md=(s,e,t,n)=>{const o=s.get(i.IPermissionService),r=s.get(X),a=o.getPermissionPoint(new le(e).id);if(!(a!=null&&a.value))return!1;const u=o.getPermissionPoint(new ge(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 he(e,t,m).id);return!!(h!=null&&h.value)}):!0};function hd(s,e){return e.some(t=>gd(s,t))}function gd(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 Rd(s,e,t,n){const o=[],r=[],a=t.getSheetId();return n.forEach(u=>{const l=Sd(t,u),d={unitId:e,subUnitId:a,cellValue:l.getData()},c=ue(s,d);o.push({id:B.id,params:c}),r.push({id:B.id,params:d})}),{undos:o,redos:r}}function Sd(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 Kt={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=qs(u,e.value),d=o.getUniverSheetInstance(r).getSheetBySheetId(a),c=[],m=[],h=hd(d,l),R={unitId:r,subUnitId:a,ranges:l},S={unitId:r,subUnitId:a,ranges:l};c.push({id:G.id,params:R}),c.push({id:F.id,params:S});const C=oe(s,R),v=Re(s,S);if(m.push({id:G.id,params:v}),m.push({id:F.id,params:C}),h){const w=Rd(s,r,d,l);c.unshift(...w.redos),m.push(...w.undos)}return i.sequenceExecute(c,t).result?(n.pushUndoRedo({unitID:r,undoMutations:m,redoMutations:c}),!0):!1}},Cd={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(Kt.id,{selections:n,unitId:u,subUnitId:l})}},fd={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(Kt.id,{value:i.Dimension.COLUMNS,selections:n,unitId:u,subUnitId:l})}},vd={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(Kt.id,{value:i.Dimension.ROWS,selections:n,unitId:u,subUnitId:l})}};function Id(s,e,t,n,o){const r=s.get(i.IUniverInstanceService),a=T(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(Kt.id,{unitId:e,subUnitId:t,selections:n,defaultMerge:o})}const pd=(s,e)=>{const r=s.get(i.IUniverInstanceService).getUniverSheetInstance(e.unitId).getSheetBySheetId(e.subUnitId).getConfig().rightToLeft;return{...i.Tools.deepClone(e),rightToLeft:r}},On={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}},wd={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=T(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=pd(s,l);return t.syncExecuteCommand(On.id,l)?(n.pushUndoRedo({unitID:r,undoMutations:[{id:On.id,params:d}],redoMutations:[{id:On.id,params:l}]}),!0):!1}};g.AFTER_CELL_EDIT=Jt,g.AddMergeRedoSelectionsOperationFactory=td,g.AddMergeUndoMutationFactory=Re,g.AddMergeUndoSelectionsOperationFactory=nd,g.AddRangeProtectionCommand=xs,g.AddRangeProtectionMutation=ce,g.AddRangeThemeMutation=Br,g.AddWorksheetMergeAllCommand=Cd,g.AddWorksheetMergeCommand=Kt,g.AddWorksheetMergeHorizontalCommand=vd,g.AddWorksheetMergeMutation=F,g.AddWorksheetMergeVerticalCommand=fd,g.AddWorksheetProtectionCommand=eo,g.AddWorksheetProtectionMutation=Le,g.AppendRowCommand=Ro,g.BEFORE_CELL_EDIT=Dn,g.BorderStyleManagerService=Xe,g.COMMAND_LISTENER_SKELETON_CHANGE=Kl,g.COMMAND_LISTENER_VALUE_CHANGE=Jl,g.CancelFrozenCommand=ur,g.CancelMarkDirtyRowAutoHeightMutation=Gr,g.ClearSelectionAllCommand=xt,g.ClearSelectionContentCommand=en,g.ClearSelectionFormatCommand=tn,g.CopySheetCommand=Ln,g.DISABLE_NORMAL_SELECTIONS=wa,g.DeleteRangeMoveLeftCommand=Ke,g.DeleteRangeMoveUpCommand=Je,g.DeleteRangeProtectionCommand=Po,g.DeleteRangeProtectionMutation=Me,g.DeleteWorksheetProtectionCommand=ko,g.DeleteWorksheetProtectionMutation=ze,g.DeleteWorksheetRangeThemeStyleCommand=Oo,g.DeleteWorksheetRangeThemeStyleMutation=st,g.DeleteWorksheetRangeThemeStyleMutationFactory=lo,g.DeltaColumnWidthCommand=jt,g.DeltaRowHeightCommand=fn,g.EditStateEnum=Qs,g.EffectRefRangId=D,g.EmptyMutation=jr,g.ExclusiveRangeService=vi,g.FactoryAddRangeProtectionMutation=Di,g.FactoryDeleteRangeProtectionMutation=Ni,g.FactorySetRangeProtectionMutation=su,g.IExclusiveRangeService=Js,g.INTERCEPTOR_POINT=ke,g.INumfmtService=Qe,g.IRefSelectionsService=wo,g.InsertColAfterCommand=Bo,g.InsertColBeforeCommand=Ho,g.InsertColByRangeCommand=gs,g.InsertColCommand=Ee,g.InsertColMutation=me,g.InsertColMutationUndoFactory=Et,g.InsertDefinedNameCommand=No,g.InsertMultiColsLeftCommand=jo,g.InsertMultiColsRightCommand=Fo,g.InsertMultiRowsAboveCommand=Vo,g.InsertMultiRowsAfterCommand=Lo,g.InsertRangeMoveDownCommand=ut,g.InsertRangeMoveRightCommand=Ot,g.InsertRowAfterCommand=Wo,g.InsertRowBeforeCommand=Ao,g.InsertRowByRangeCommand=hs,g.InsertRowCommand=be,g.InsertRowMutation=ve,g.InsertRowMutationUndoFactory=Zt,g.InsertSheetCommand=Go,g.InsertSheetMutation=ot,g.InsertSheetUndoMutationFactory=Vn,g.InterceptCellContentPriority=to,g.MAX_CELL_PER_SHEET_KEY=Qr,g.MERGE_CELL_INTERCEPTOR_CHECK=Ci,g.MarkDirtyRowAutoHeightMutation=Fr,g.MoveColsCommand=Dt,g.MoveColsMutation=Ae,g.MoveColsMutationUndoFactory=Yo,g.MoveRangeCommand=qe,g.MoveRangeMutation=$e,g.MoveRowsCommand=Nt,g.MoveRowsMutation=De,g.MoveRowsMutationUndoFactory=zo,g.OperatorType=$,g.PermissionPointsDefinitions=cd,g.REF_SELECTIONS_ENABLED=vo,g.RangeMergeUtil=Ou,g.RangeProtectionPermissionDeleteProtectionPoint=Ns,g.RangeProtectionPermissionEditPoint=he,g.RangeProtectionPermissionManageCollaPoint=Ds,g.RangeProtectionPermissionViewPoint=on,g.RangeProtectionRuleModel=X,g.RangeThemeStyle=Oe,g.RegisterWorksheetRangeThemeStyleCommand=Xo,g.RegisterWorksheetRangeThemeStyleMutation=lt,g.RemoveColByRangeCommand=vs,g.RemoveColCommand=Wt,g.RemoveColMutation=ae,g.RemoveDefinedNameCommand=Rs,g.RemoveMergeUndoMutationFactory=oe,g.RemoveNumfmtMutation=Hs,g.RemoveRangeThemeMutation=Kr,g.RemoveRowByRangeCommand=Cs,g.RemoveRowCommand=At,g.RemoveRowMutation=Ie,g.RemoveSheetCommand=cn,g.RemoveSheetMutation=Ye,g.RemoveSheetUndoMutationFactory=Io,g.RemoveWorksheetMergeCommand=Zo,g.RemoveWorksheetMergeMutation=G,g.ReorderRangeCommand=mn,g.ReorderRangeMutation=Vt,g.ReorderRangeUndoMutationFactory=Qo,g.ResetBackgroundColorCommand=Cr,g.ResetTextColorCommand=Rr,g.SCOPE_WORKBOOK_VALUE_DEFINED_NAME=Gu,g.SELECTIONS_ENABLED=Ma,g.SELECTION_CONTROL_BORDER_BUFFER_COLOR=xl,g.SELECTION_CONTROL_BORDER_BUFFER_WIDTH=Ql,g.ScrollToCellOperation=Xr,g.SelectRangeCommand=yo,g.SelectionMoveType=te,g.SetBackgroundColorCommand=Sr,g.SetBoldCommand=lu,g.SetBorderBasicCommand=sr,g.SetBorderColorCommand=nr,g.SetBorderCommand=dt,g.SetBorderPositionCommand=er,g.SetBorderStyleCommand=tr,g.SetColDataCommand=rr,g.SetColDataMutation=ct,g.SetColDataMutationFactory=or,g.SetColHiddenCommand=Ms,g.SetColHiddenMutation=mt,g.SetColVisibleMutation=ht,g.SetColWidthCommand=gn,g.SetDefinedNameCommand=ys,g.SetFontFamilyCommand=gu,g.SetFontSizeCommand=Ru,g.SetFrozenCommand=ar,g.SetFrozenMutation=He,g.SetFrozenMutationFactory=_s,g.SetGridlinesColorCommand=lr,g.SetGridlinesColorMutation=gt,g.SetHorizontalTextAlignCommand=vr,g.SetItalicCommand=du,g.SetNumfmtMutation=pn,g.SetOverlineCommand=hu,g.SetProtectionCommand=dr,g.SetRangeProtectionMutation=x,g.SetRangeThemeMutation=Jr,g.SetRangeValuesCommand=at,g.SetRangeValuesMutation=B,g.SetRangeValuesUndoMutationFactory=ue,g.SetRowDataCommand=mr,g.SetRowDataMutation=Rt,g.SetRowDataMutationFactory=cr,g.SetRowHeightCommand=vn,g.SetRowHiddenCommand=Es,g.SetRowHiddenMutation=Ct,g.SetRowVisibleMutation=St,g.SetSelectedColsVisibleCommand=ws,g.SetSelectedRowsVisibleCommand=bs,g.SetSelectionsOperation=q,g.SetSpecificColsVisibleCommand=$t,g.SetSpecificRowsVisibleCommand=Ht,g.SetStrikeThroughCommand=mu,g.SetStyleCommand=ee,g.SetTabColorCommand=wr,g.SetTabColorMutation=Bt,g.SetTextColorCommand=gr,g.SetTextRotationCommand=pr,g.SetTextWrapCommand=Ir,g.SetUnderlineCommand=cu,g.SetVerticalTextAlignCommand=fr,g.SetWorkbookNameCommand=Us,g.SetWorkbookNameMutation=Ts,g.SetWorksheetActivateCommand=Ps,g.SetWorksheetActiveOperation=ft,g.SetWorksheetColWidthMutation=We,g.SetWorksheetColWidthMutationFactory=ks,g.SetWorksheetColumnCountCommand=yr,g.SetWorksheetColumnCountMutation=vt,g.SetWorksheetColumnCountUndoMutationFactory=Mr,g.SetWorksheetDefaultStyleCommand=br,g.SetWorksheetDefaultStyleMutation=It,g.SetWorksheetDefaultStyleMutationFactory=_r,g.SetWorksheetHideCommand=Tr,g.SetWorksheetHideMutation=Be,g.SetWorksheetNameCommand=Rn,g.SetWorksheetNameMutation=Ft,g.SetWorksheetOrderCommand=Os,g.SetWorksheetOrderMutation=Gt,g.SetWorksheetPermissionPointsCommand=Pr,g.SetWorksheetPermissionPointsMutation=Cn,g.SetWorksheetProtectionCommand=kr,g.SetWorksheetProtectionMutation=Ze,g.SetWorksheetRangeThemeStyleCommand=co,g.SetWorksheetRangeThemeStyleMutation=nt,g.SetWorksheetRangeThemeStyleMutationFactory=uo,g.SetWorksheetRightToLeftCommand=wd,g.SetWorksheetRightToLeftMutation=On,g.SetWorksheetRowAutoHeightMutation=Ws,g.SetWorksheetRowAutoHeightMutationFactory=_u,g.SetWorksheetRowCountCommand=Nr,g.SetWorksheetRowCountMutation=Mt,g.SetWorksheetRowCountUndoMutationFactory=Or,g.SetWorksheetRowHeightMutation=Ve,g.SetWorksheetRowIsAutoHeightCommand=In,g.SetWorksheetRowIsAutoHeightMutation=Ce,g.SetWorksheetShowCommand=Vs,g.SheetSkeletonChangeType=yi,g.SheetValueChangeType=_i,g.SplitDelimiterEnum=Ar,g.SplitTextToColumnsCommand=Vr,g.ToggleCellCheckboxCommand=Lr,g.ToggleGridlinesCommand=$r,g.ToggleGridlinesMutation=yt,g.UnitAction=_,g.UnitObject=N,g.UnregisterWorksheetRangeThemeStyleCommand=Hr,g.UnregisterWorksheetRangeThemeStyleMutation=dn,g.VALIDATE_CELL=Xt,g.ViewStateEnum=Zs,g.WorkbookCommentPermission=$n,g.WorkbookCopyPermission=Hn,g.WorkbookCopySheetPermission=bo,g.WorkbookCreateProtectPermission=Bn,g.WorkbookCreateSheetPermission=jn,g.WorkbookDeleteSheetPermission=Fn,g.WorkbookDuplicatePermission=Gn,g.WorkbookEditablePermission=le,g.WorkbookExportPermission=zn,g.WorkbookHideSheetPermission=rn,g.WorkbookHistoryPermission=Eo,g.WorkbookManageCollaboratorPermission=an,g.WorkbookMoveSheetPermission=un,g.WorkbookPrintPermission=Yn,g.WorkbookRecoverHistoryPermission=qn,g.WorkbookRenameSheetPermission=ln,g.WorkbookSelectionModel=fo,g.WorkbookSharePermission=Kn,g.WorkbookViewHistoryPermission=Xn,g.WorkbookViewPermission=Jn,g.WorksheetCopyPermission=Zn,g.WorksheetDeleteColumnPermission=Qn,g.WorksheetDeleteProtectionPermission=xn,g.WorksheetDeleteRowPermission=es,g.WorksheetEditExtraObjectPermission=ts,g.WorksheetEditPermission=ge,g.WorksheetFilterPermission=ns,g.WorksheetInsertColumnPermission=ss,g.WorksheetInsertHyperlinkPermission=os,g.WorksheetInsertRowPermission=rs,g.WorksheetManageCollaboratorPermission=is,g.WorksheetPivotTablePermission=as,g.WorksheetProtectionPointModel=pt,g.WorksheetProtectionRuleModel=ye,g.WorksheetSelectProtectedCellsPermission=Na,g.WorksheetSelectUnProtectedCellsPermission=Da,g.WorksheetSetCellStylePermission=us,g.WorksheetSetCellValuePermission=Pt,g.WorksheetSetColumnStylePermission=rt,g.WorksheetSetRowStylePermission=it,g.WorksheetSortPermission=ls,g.WorksheetViewPermission=kt,g.addMergeCellsUtil=Id,g.adjustRangeOnMutation=di,g.alignToMergedCellsBorders=Ut,g.baseProtectionActions=je,g.checkCellValueType=An,g.checkRangesEditablePermission=md,g.convertPrimaryWithCoordToPrimary=bi,g.convertSelectionDataToRange=ed,g.copyRangeStyles=Ne,g.createTopMatrixFromMatrix=Yr,g.createTopMatrixFromRanges=zr,g.defaultWorkbookPermissionPoints=Ur,g.defaultWorksheetPermissionPoint=Sn,g.expandToContinuousRange=ud,g.factoryRemoveNumfmtUndoMutation=Du,g.factorySetNumfmtUndoMutation=Nu,g.findAllRectangle=Ls,g.findFirstNonEmptyCell=Ca,g.followSelectionOperation=_e,g.generateNullCell=Wn,g.generateNullCellValue=So,g.getAddMergeMutationRangeByType=qs,g.getAllRangePermissionPoint=re,g.getAllWorkbookPermissionPoint=wt,g.getAllWorksheetPermissionPoint=ie,g.getAllWorksheetPermissionPointByPointPanel=Se,g.getCellAtRowCol=_a,g.getDefaultRangePermission=Iu,g.getInsertRangeMutations=ds,g.getMoveRangeUndoRedoMutations=nn,g.getNextPrimaryCell=dd,g.getPrimaryForRange=ne,g.getRemoveRangeMutations=cs,g.getSelectionsService=Mo,g.getSeparateEffectedRangesOnCommand=al,g.getSheetCommandTarget=T,g.getSheetCommandTargetWorkbook=ao,g.getSheetMutationTarget=fe,g.getSkeletonChangedEffectedRange=Zl,g.getValueChangedEffectedRange=Xl,g.getVisibleRanges=Tt,g.handleBaseInsertRange=et,g.handleBaseMoveRowsCols=zt,g.handleBaseRemoveRange=xe,g.handleCommonDefaultRangeChangeWithEffectRefCommands=Ys,g.handleCommonRangeChangeWithEffectRefCommandsSkipNoInterests=rl,g.handleDefaultRangeChangeWithEffectRefCommands=zs,g.handleDefaultRangeChangeWithEffectRefCommandsSkipNoInterests=ol,g.handleDeleteRangeMoveLeft=ui,g.handleDeleteRangeMoveUp=li,g.handleDeleteRangeMutation=Wa,g.handleIRemoveCol=Gs,g.handleIRemoveRow=si,g.handleInsertCol=ri,g.handleInsertRangeMoveDown=ii,g.handleInsertRangeMoveRight=ai,g.handleInsertRangeMutation=Aa,g.handleInsertRow=oi,g.handleMoveCols=Fs,g.handleMoveRange=ni,g.handleMoveRows=js,g.isSingleCellSelection=Ea,g.rangeMerge=$s,g.rangeToDiscreteRange=Co,g.rotateRange=de,g.runRefRangeMutations=tt,g.setEndForRange=ba,g.splitRangeText=Wr,g.transformCellsToRange=wn,Object.defineProperty(g,Symbol.toStringTag,{value:"Module"})});
13
13
 
14
14
 
15
15
  // @univerjs/sheets/facade
16
- (function(l,s){typeof exports=="object"&&typeof module<"u"?s(exports,require("@univerjs/core"),require("@univerjs/core/facade"),require("@univerjs/sheets"),require("@univerjs/engine-formula")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/core/facade","@univerjs/sheets","@univerjs/engine-formula"],s):(l=typeof globalThis<"u"?globalThis:l||self,s(l.UniverSheetsFacade={},l.UniverCore,l.UniverCoreFacade,l.UniverSheets,l.UniverEngineFormula))})(this,function(l,s,_,a,I){"use strict";var te=Object.defineProperty;var ne=(l,s,_)=>s in l?te(l,s,{enumerable:!0,configurable:!0,writable:!0,value:_}):l[s]=_;var b=(l,s,_)=>ne(l,typeof s!="symbol"?s+"":s,_);var F=Object.getOwnPropertyDescriptor,D=(c,r,e,t)=>{for(var n=t>1?void 0:t?F(r,e):r,i=c.length-1,o;i>=0;i--)(o=c[i])&&(n=o(n)||n);return n},k=(c,r)=>(e,t)=>r(e,t,c);function x(c,r,e){const t=e.getDefinedNameMap(c);if(t==null)return r.t("definedName.defaultName")+1;const i=Array.from(Object.values(t)).length+1,o=r.t("definedName.defaultName")+i;if(e.getValueByName(c,o)==null)return o;let h=i+1;for(;;){const d=r.t("definedName.defaultName")+h;if(e.getValueByName(c,d)==null)return d;h++}}class E{constructor(){b(this,"_definedNameParam");this._definedNameParam={id:s.generateRandomId(10),unitId:"",name:"",formulaOrRefString:"",localSheetId:a.SCOPE_WORKBOOK_VALUE_DEFINED_NAME}}setName(r){return this._definedNameParam.name=r,this}setFormula(r){return this._definedNameParam.formulaOrRefString=`=${r}`,this}setRef(r){return this._definedNameParam.formulaOrRefString=r,this}setRefByRange(r,e,t,n){return this._definedNameParam.formulaOrRefString=I.serializeRange({startRow:r,endRow:r+(t!=null?t:1)-1,startColumn:e,endColumn:e+(n!=null?n:1)-1}),this}setComment(r){return this._definedNameParam.comment=r,this}setScopeToWorksheet(r){return this._definedNameParam.localSheetId=r.getSheetId(),this}setScopeToWorkbook(){return this._definedNameParam.localSheetId=a.SCOPE_WORKBOOK_VALUE_DEFINED_NAME,this}setHidden(r){return this._definedNameParam.hidden=r,this}build(){return this._definedNameParam}load(r){return this._definedNameParam=r,this}}let y=class extends _.FBase{constructor(c,r,e,t,n,i,o,h,d,u){super(),this._definedNameParam=c,this._injector=r,this._commandService=e,this._permissionService=t,this._worksheetProtectionRuleModel=n,this._rangeProtectionRuleModel=i,this._worksheetProtectionPointRuleModel=o,this._authzIoService=h,this._localeService=d,this._definedNamesService=u}_apply(){this._definedNameParam.name===""&&(this._definedNameParam.name=x(this._definedNameParam.unitId,this._localeService,this._definedNamesService)),this._commandService.syncExecuteCommand(a.SetDefinedNameCommand.id,this._definedNameParam)}getName(){return this._definedNameParam.name}setName(c){this._definedNameParam.name=c,this._apply()}setFormula(c){this._definedNameParam.formulaOrRefString=`=${c}`,this._apply()}setRef(c){this._definedNameParam.formulaOrRefString=c,this._apply()}getFormulaOrRefString(){return this._definedNameParam.formulaOrRefString}setRefByRange(c,r,e,t){this._definedNameParam.formulaOrRefString=I.serializeRange({startRow:c,endRow:c+(e!=null?e:1)-1,startColumn:r,endColumn:r+(t!=null?t:1)-1}),this._apply()}getComment(){return this._definedNameParam.comment}setComment(c){this._definedNameParam.comment=c,this._apply()}setScopeToWorksheet(c){this._definedNameParam.localSheetId=c.getSheetId(),this._apply()}setScopeToWorkbook(){this._definedNameParam.localSheetId=a.SCOPE_WORKBOOK_VALUE_DEFINED_NAME,this._apply()}setHidden(c){this._definedNameParam.hidden=c,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 c=this._injector.createInstance(E);return c.load(this._definedNameParam),c}};y=D([k(1,s.Inject(s.Injector)),k(2,s.ICommandService),k(3,s.IPermissionService),k(4,s.Inject(a.WorksheetProtectionRuleModel)),k(5,s.Inject(a.RangeProtectionRuleModel)),k(6,s.Inject(a.WorksheetProtectionPointModel)),k(7,s.Inject(s.IAuthzIoService)),k(8,s.Inject(s.LocaleService)),k(9,I.IDefinedNamesService)],y);var B=Object.getOwnPropertyDescriptor,j=(c,r,e,t)=>{for(var n=t>1?void 0:t?B(r,e):r,i=c.length-1,o;i>=0;i--)(o=c[i])&&(n=o(n)||n);return n},f=(c,r)=>(e,t)=>r(e,t,c);l.FPermission=class extends _.FBase{constructor(e,t,n,i,o,h,d){super();b(this,"permissionPointsDefinition",a.PermissionPointsDefinitions);b(this,"rangeRuleChangedAfterAuth$");b(this,"sheetRuleChangedAfterAuth$");this._injector=e,this._commandService=t,this._permissionService=n,this._worksheetProtectionRuleModel=i,this._rangeProtectionRuleModel=o,this._worksheetProtectionPointRuleModel=h,this._authzIoService=d,this.rangeRuleChangedAfterAuth$=this._rangeProtectionRuleModel.ruleRefresh$,this.sheetRuleChangedAfterAuth$=this._worksheetProtectionRuleModel.ruleRefresh$}setWorkbookPermissionPoint(e,t,n){const i=new t(e);this._permissionService.getPermissionPoint(i.id)||this._permissionService.addPermissionPoint(i),this._permissionService.updatePermissionPoint(i.id,n)}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 i=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:i,unitType:a.UnitObject.Worksheet,unitId:e,subUnitId:t}}))return i}removeWorksheetPermission(e,t){this._commandService.syncExecuteCommand(a.DeleteWorksheetProtectionMutation.id,{unitId:e,subUnitId:t}),[...a.getAllWorksheetPermissionPoint(),...a.getAllWorksheetPermissionPointByPointPanel()].forEach(n=>{const i=new n(e,t);this._permissionService.updatePermissionPoint(i.id,!0)}),this._worksheetProtectionPointRuleModel.deleteRule(e,t)}async setWorksheetPermissionPoint(e,t,n,i){const o=this._worksheetProtectionRuleModel.getRule(e,t);let h;if(n===a.WorksheetEditPermission||n===a.WorksheetViewPermission)if(o)h=o.permissionId;else{if(this._rangeProtectionRuleModel.getSubunitRuleList(e,t).length>0)throw new Error("sheet protection cannot intersect with range protection");h=await this.addWorksheetBasePermission(e,t)}else{const g=this._worksheetProtectionPointRuleModel.getRule(e,t);g?h=g.permissionId:(h=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:h}}))}const u=new n(e,t);return this._permissionService.getPermissionPoint(u.id)||this._permissionService.addPermissionPoint(u),this._permissionService.updatePermissionPoint(u.id,i),h}async addRangeBaseProtection(e,t,n){const i=await this._authzIoService.create({objectType:a.UnitObject.SelectRange,selectRangeObject:{collaborators:[],unitID:e,name:"",scope:void 0}}),o=`ruleId_${s.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(g=>g.ranges.some(w=>n.some(S=>s.Rectangle.intersects(S.getRange(),w)))))throw new Error("range protection cannot intersect");if(this._commandService.syncExecuteCommand(a.AddRangeProtectionMutation.id,{unitId:e,subUnitId:t,rules:[{permissionId:i,unitType:a.UnitObject.SelectRange,unitId:e,subUnitId:t,ranges:n.map(g=>g.getRange()),id:o}]}))return{permissionId:i,ruleId:o}}removeRangeProtection(e,t,n){this._commandService.syncExecuteCommand(a.DeleteRangeProtectionMutation.id,{unitId:e,subUnitId:t,ruleIds:n})&&this._rangeProtectionRuleModel.getSubunitRuleList(e,t).length===0&&(this._worksheetProtectionPointRuleModel.deleteRule(e,t),[...a.getAllWorksheetPermissionPointByPointPanel()].forEach(h=>{const d=new h(e,t);this._permissionService.updatePermissionPoint(d.id,d.value)}))}setRangeProtectionPermissionPoint(e,t,n,i,o){const h=new i(e,t,n);this._permissionService.getPermissionPoint(h.id)||this._permissionService.addPermissionPoint(h),this._permissionService.updatePermissionPoint(h.id,o)}setRangeProtectionRanges(e,t,n,i){const o=this._rangeProtectionRuleModel.getRule(e,t,n);if(o){if(this._rangeProtectionRuleModel.getSubunitRuleList(e,t).filter(u=>u.id!==n).some(u=>u.ranges.some(m=>i.some(g=>s.Rectangle.intersects(g.getRange(),m)))))throw new Error("range protection cannot intersect");this._commandService.syncExecuteCommand(a.SetRangeProtectionMutation.id,{unitId:e,subUnitId:t,ruleId:n,rule:{...o,ranges:i.map(u=>u.getRange())}})}}},l.FPermission=j([f(0,s.Inject(s.Injector)),f(1,s.ICommandService),f(2,s.IPermissionService),f(3,s.Inject(a.WorksheetProtectionRuleModel)),f(4,s.Inject(a.RangeProtectionRuleModel)),f(5,s.Inject(a.WorksheetProtectionPointModel)),f(6,s.Inject(s.IAuthzIoService))],l.FPermission);function V(c){switch(c){case"left":return s.HorizontalAlign.LEFT;case"center":return s.HorizontalAlign.CENTER;case"normal":return s.HorizontalAlign.RIGHT;default:throw new Error(`Invalid horizontal alignment: ${c}`)}}function A(c){switch(c){case s.HorizontalAlign.LEFT:return"left";case s.HorizontalAlign.CENTER:return"center";case s.HorizontalAlign.RIGHT:return"normal";default:return"general"}}function O(c){switch(c){case"top":return s.VerticalAlign.TOP;case"middle":return s.VerticalAlign.MIDDLE;case"bottom":return s.VerticalAlign.BOTTOM;default:throw new Error(`Invalid vertical alignment: ${c}`)}}function T(c){switch(c){case s.VerticalAlign.TOP:return"top";case s.VerticalAlign.MIDDLE:return"middle";case s.VerticalAlign.BOTTOM:return"bottom";default:return"general"}}function U(c,r){return{startRow:c.startRow,endRow:c.endRow,startColumn:0,endColumn:r.getColumnCount()-1,rangeType:s.RANGE_TYPE.ROW}}function P(c,r){return{startRow:0,endRow:r.getRowCount()-1,startColumn:c.startColumn,endColumn:c.endColumn,rangeType:s.RANGE_TYPE.COLUMN}}var H=Object.getOwnPropertyDescriptor,L=(c,r,e,t)=>{for(var n=t>1?void 0:t?H(r,e):r,i=c.length-1,o;i>=0;i--)(o=c[i])&&(n=o(n)||n);return n},N=(c,r)=>(e,t)=>r(e,t,c);l.FRange=class extends _.FBaseInitialable{constructor(r,e,t,n,i,o){super(n),this._workbook=r,this._worksheet=e,this._range=t,this._injector=n,this._commandService=i,this._formulaDataModel=o}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:r,startRow:e,endColumn:t,endRow:n}=this._range;return this._worksheet.getMergedCellRange(e,r,n,t).some(o=>s.Rectangle.equals(o,this._range))}getCellStyleData(r="row"){return r!=="cell"?this._worksheet.getComposedCellStyle(this._range.startRow,this._range.startColumn,r==="row"):this._worksheet.getCellStyle(this._range.startRow,this._range.startColumn)}getFontFamily(r="row"){var e,t;return(t=(e=this.getCellStyleData(r))==null?void 0:e.ff)!=null?t:null}getFontSize(r="row"){var e,t;return(t=(e=this.getCellStyleData(r))==null?void 0:e.fs)!=null?t:null}getCellStyle(r="row"){const e=this.getCellStyleData(r);return e?s.TextStyleValue.create(e):null}getCellStyles(r="row"){return this.getCellDatas().map((t,n)=>t.map((i,o)=>{if(!i)return null;const h=r!=="cell"?this._worksheet.getComposedCellStyle(n+this._range.startRow,o+this._range.startColumn,r==="row"):this._worksheet.getCellStyle(n+this._range.startRow,o+this._range.startColumn);return h?s.TextStyleValue.create(h):null}))}getValue(r){var e,t;return r?this.getValueAndRichTextValue():(t=(e=this._worksheet.getCell(this._range.startRow,this._range.startColumn))==null?void 0:e.v)!=null?t:null}getRawValue(){var e;const r=this._worksheet.getCellMatrix().getValue(this._range.startRow,this._range.startColumn);return r!=null&&r.p&&((e=r.p.body)!=null&&e.dataStream)?r.p.body.dataStream:r!=null&&r.v?r.v:null}getDisplayValue(){var e;const r=this._worksheet.getCell(this._range.startRow,this._range.startColumn);return r!=null&&r.p&&((e=r.p.body)!=null&&e.dataStream)?r.p.body.dataStream:r!=null&&r.v?String(r.v):""}getValues(r){var h,d;if(r)return this.getValueAndRichTextValues();const{startRow:e,endRow:t,startColumn:n,endColumn:i}=this._range,o=[];for(let u=e;u<=t;u++){const m=[];for(let g=n;g<=i;g++)m.push((d=(h=this._worksheet.getCell(u,g))==null?void 0:h.v)!=null?d:null);o.push(m)}return o}getRawValues(){var h;const r=this._worksheet.getCellMatrix(),{startRow:e,endRow:t,startColumn:n,endColumn:i}=this._range,o=[];for(let d=e;d<=t;d++){const u=[];for(let m=n;m<=i;m++){const g=r.getValue(d,m);g!=null&&g.p&&((h=g.p.body)!=null&&h.dataStream)?u.push(g.p.body.dataStream):g!=null&&g.v?u.push(g.v):u.push(null)}o.push(u)}return o}getDisplayValues(){var o;const{startRow:r,endRow:e,startColumn:t,endColumn:n}=this._range,i=[];for(let h=r;h<=e;h++){const d=[];for(let u=t;u<=n;u++){const m=this._worksheet.getCell(h,u);m!=null&&m.p&&((o=m.p.body)!=null&&o.dataStream)?d.push(m.p.body.dataStream):m!=null&&m.v?d.push(String(m.v)):d.push("")}i.push(d)}return i}getCellData(){var r;return(r=this._worksheet.getCell(this._range.startRow,this._range.startColumn))!=null?r:null}getCellDatas(){return this.getCellDataGrid()}getCellDataGrid(){const{startRow:r,endRow:e,startColumn:t,endColumn:n}=this._range,i=[];for(let o=r;o<=e;o++){const h=[];for(let d=t;d<=n;d++)h.push(this._worksheet.getCellRaw(o,d));i.push(h)}return i}getRichTextValue(){const r=this.getCellData();return r!=null&&r.p?new s.RichTextValue(r.p):null}getRichTextValues(){return this.getCellDataGrid().map(e=>e.map(t=>t!=null&&t.p?new s.RichTextValue(t.p):null))}getValueAndRichTextValue(){const r=this.getCellData();return r!=null&&r.p?new s.RichTextValue(r.p):r==null?void 0:r.v}getValueAndRichTextValues(){return this.getCellDatas().map(e=>e.map(t=>t!=null&&t.p?new s.RichTextValue(t.p):t==null?void 0:t.v))}getFormula(){var r;return(r=this._formulaDataModel.getFormulaStringByCell(this._range.startRow,this._range.startColumn,this._worksheet.getSheetId(),this._workbook.getUnitId()))!=null?r:""}getFormulas(){const r=[],{startRow:e,endRow:t,startColumn:n,endColumn:i}=this._range,o=this._worksheet.getSheetId(),h=this._workbook.getUnitId();for(let d=e;d<=t;d++){const u=[];for(let m=n;m<=i;m++){const g=this._formulaDataModel.getFormulaStringByCell(d,m,o,h);u.push(g||"")}r.push(u)}return r}getWrap(){return this._worksheet.getRange(this._range).getWrap()===s.BooleanNumber.TRUE}getWraps(){const r=this.getCellDatas(),e=this._workbook.getStyles();return r.map(t=>t.map(n=>{var i;return((i=e.getStyleByCell(n))==null?void 0:i.tb)===s.WrapStrategy.WRAP}))}getWrapStrategy(){return this._worksheet.getRange(this._range).getWrapStrategy()}getHorizontalAlignment(){const r=this._worksheet.getRange(this._range).getHorizontalAlignment();return A(r)}getHorizontalAlignments(){return this._worksheet.getRange(this._range).getHorizontalAlignments().map(e=>e.map(t=>A(t)))}getVerticalAlignment(){return T(this._worksheet.getRange(this._range).getVerticalAlignment())}getVerticalAlignments(){return this._worksheet.getRange(this._range).getVerticalAlignments().map(e=>e.map(t=>T(t)))}setCustomMetaData(r){return this.setValue({custom:r})}setCustomMetaDatas(r){return this.setValues(r.map(e=>e.map(t=>({custom:t}))))}getCustomMetaData(){var e;const r=this.getCellData();return(e=r==null?void 0:r.custom)!=null?e:null}getCustomMetaDatas(){return this.getCellDataGrid().map(e=>e.map(t=>{var n;return(n=t==null?void 0:t.custom)!=null?n:null}))}setBorder(r,e,t){return this._commandService.syncExecuteCommand(a.SetBorderBasicCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),ranges:[this._range],value:{type:r,style:e,color:t}}),this}getBackground(){var e,t;const r=this.getCellStyle();return(t=(e=r==null?void 0:r.background)==null?void 0:e.rgb)!=null?t:s.DEFAULT_STYLES.bg.rgb}getBackgrounds(){return this.getCellStyles().map(e=>e.map(t=>{var n,i;return(i=(n=t==null?void 0:t.background)==null?void 0:n.rgb)!=null?i:s.DEFAULT_STYLES.bg.rgb}))}setBackgroundColor(r){return this._commandService.syncExecuteCommand(a.SetStyleCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,style:{type:"bg",value:{rgb:r}}}),this}setBackground(r){return this.setBackgroundColor(r),this}setTextRotation(r){return this._commandService.syncExecuteCommand(a.SetTextRotationCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,value:r}),this}setValue(r){const e=s.covertCellValue(r);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(r){const e=s.covertCellValue(r);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(r){const e=r instanceof s.RichTextValue?r.getData():r,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(r){const e=r.map(i=>i.map(o=>o&&{p:o instanceof s.RichTextValue?o.getData():o})),t=s.covertCellValues(e,this._range),n={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,value:t};return this._commandService.syncExecuteCommand(a.SetRangeValuesCommand.id,n),this}setWrap(r){return this._commandService.syncExecuteCommand(a.SetTextWrapCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,value:r?s.WrapStrategy.WRAP:s.WrapStrategy.UNSPECIFIED}),this}setWrapStrategy(r){return this._commandService.syncExecuteCommand(a.SetTextWrapCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,value:r}),this}setVerticalAlignment(r){return this._commandService.syncExecuteCommand(a.SetVerticalTextAlignCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,value:O(r)}),this}setHorizontalAlignment(r){return this._commandService.syncExecuteCommand(a.SetHorizontalTextAlignCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,value:V(r)}),this}setValues(r){const e=s.covertCellValues(r,this._range);return this._commandService.syncExecuteCommand(a.SetRangeValuesCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,value:e}),this}setFontWeight(r){let e;if(r==="bold")e=s.BooleanNumber.TRUE;else if(r==="normal")e=s.BooleanNumber.FALSE;else if(r===null)e=null;else throw new Error("Invalid fontWeight");const t={type:"bl",value:e},n={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,style:t};return this._commandService.syncExecuteCommand(a.SetStyleCommand.id,n),this}setFontStyle(r){let e;if(r==="italic")e=s.BooleanNumber.TRUE;else if(r==="normal")e=s.BooleanNumber.FALSE;else if(r===null)e=null;else throw new Error("Invalid fontStyle");const t={type:"it",value:e},n={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,style:t};return this._commandService.syncExecuteCommand(a.SetStyleCommand.id,n),this}setFontLine(r){if(r==="underline")this._setFontUnderline({s:s.BooleanNumber.TRUE});else if(r==="line-through")this._setFontStrikethrough({s:s.BooleanNumber.TRUE});else if(r==="none")this._setFontUnderline({s:s.BooleanNumber.FALSE}),this._setFontStrikethrough({s:s.BooleanNumber.FALSE});else if(r===null)this._setFontUnderline(null),this._setFontStrikethrough(null);else throw new Error("Invalid fontLine");return this}_setFontUnderline(r){const e={type:"ul",value:r},t={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,style:e};this._commandService.syncExecuteCommand(a.SetStyleCommand.id,t)}_setFontStrikethrough(r){const e={type:"st",value:r},t={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,style:e};this._commandService.syncExecuteCommand(a.SetStyleCommand.id,t)}setFontFamily(r){const e={type:"ff",value:r},t={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,style:e};return this._commandService.syncExecuteCommand(a.SetStyleCommand.id,t),this}setFontSize(r){const e={type:"fs",value:r},t={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,style:e};return this._commandService.syncExecuteCommand(a.SetStyleCommand.id,t),this}setFontColor(r){const t={type:"cl",value:r===null?null:{rgb:r}},n={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,style:t};return this._commandService.syncExecuteCommand(a.SetStyleCommand.id,n),this}merge(r=!0){const e=this._workbook.getUnitId(),t=this._worksheet.getSheetId();return a.addMergeCellsUtil(this._injector,e,t,[this._range],r),this}mergeAcross(r=!0){const e=a.getAddMergeMutationRangeByType([this._range],s.Dimension.ROWS),t=this._workbook.getUnitId(),n=this._worksheet.getSheetId();return a.addMergeCellsUtil(this._injector,t,n,e,r),this}mergeVertically(r=!0){const e=a.getAddMergeMutationRangeByType([this._range],s.Dimension.COLUMNS),t=this._workbook.getUnitId(),n=this._worksheet.getSheetId();return a.addMergeCellsUtil(this._injector,t,n,e,r),this}isPartOfMerge(){const{startRow:r,startColumn:e,endRow:t,endColumn:n}=this._range;return this._worksheet.getMergedCellRange(r,e,t,n).length>0}breakApart(){return this._commandService.syncExecuteCommand(a.RemoveWorksheetMergeCommand.id,{ranges:[this._range]}),this}forEach(r){const{startColumn:e,startRow:t,endColumn:n,endRow:i}=this._range;this._worksheet.getMatrixWithMergedCells(t,e,i,n).forValue((o,h,d)=>{r(o,h,d)})}getA1Notation(r,e,t){const n={...this._range,startAbsoluteRefType:e,endAbsoluteRefType:t};return r?I.serializeRangeWithSheet(this._worksheet.getName(),n):I.serializeRange(n)}activate(){return this._injector.createInstance(l.FWorkbook,this._workbook).setActiveRange(this),this}activateAsCurrentCell(){const r=this._worksheet.getMergedCell(this._range.startRow,this._range.startColumn);if(r&&s.Rectangle.equals(r,this._range)||!r&&this._range.startRow===this._range.endRow&&this._range.startColumn===this._range.endColumn){const n=this._injector.createInstance(l.FWorkbook,this._workbook).getActiveRange();if(!n||n.getUnitId()!==this.getUnitId()||n.getSheetId()!==this.getSheetId())return this.activate();if(s.Rectangle.contains(n.getRange(),this._range)){const i={unitId:this.getUnitId(),subUnitId:this.getSheetId(),selections:[{range:n.getRange(),primary:a.getPrimaryForRange(this.getRange(),this._worksheet),style:null}]};return this._commandService.syncExecuteCommand(a.SetSelectionsOperation.id,i),this}return this.activate()}else throw new Error("The range is not a single cell")}splitTextToColumns(r,e,t){this._commandService.syncExecuteCommand(a.SplitTextToColumnsCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,delimiter:e,customDelimiter:t,treatMultipleDelimitersAsOne:r})}useThemeStyle(r){if(r==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:r})}removeThemeStyle(r){this._commandService.syncExecuteCommand(a.DeleteWorksheetRangeThemeStyleCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,themeName:r})}getUsedThemeStyle(){return this._injector.get(a.SheetRangeThemeService).getAppliedRangeThemeStyle({unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range})}clear(r){return r&&r.contentsOnly&&!r.formatOnly?this.clearContent():r&&r.formatOnly&&!r.contentsOnly?this.clearFormat():(this._commandService.syncExecuteCommand(a.ClearSelectionAllCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),ranges:[this._range],options:r}),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(r){r===s.Dimension.ROWS?this._commandService.executeCommand(a.InsertRangeMoveDownCommand.id,{range:this._range}):this._commandService.executeCommand(a.InsertRangeMoveRightCommand.id,{range:this._range})}deleteCells(r){r===s.Dimension.ROWS?this._commandService.executeCommand(a.DeleteRangeMoveUpCommand.id,{range:this._range}):this._commandService.executeCommand(a.DeleteRangeMoveLeftCommand.id,{range:this._range})}getDataRegion(r){const{startRow:e,startColumn:t,endRow:n,endColumn:i}=this._range,o=this._worksheet.getMaxRows(),h=this._worksheet.getMaxColumns(),d=this._worksheet.getCellMatrix();let u=e,m=t,g=n,w=i;if(r!==s.Dimension.COLUMNS){let S=!1,R=!1;for(let v=t;v<=i&&(e>0&&!s.isNullCell(d.getValue(e-1,v))&&(S=!0),n<o-1&&!s.isNullCell(d.getValue(n+1,v))&&(R=!0),!(S&&R));v++);S&&(u=e-1),R&&(g=n+1)}if(r!==s.Dimension.ROWS){let S=!1,R=!1;for(let v=e;v<=n&&(t>0&&!s.isNullCell(d.getValue(v,t-1))&&(S=!0),i<h-1&&!s.isNullCell(d.getValue(v,i+1))&&(R=!0),!(S&&R));v++);S&&(m=t-1),R&&(w=i+1)}return this._injector.createInstance(l.FRange,this._workbook,this._worksheet,{startRow:u,startColumn:m,endRow:g,endColumn:w})}isBlank(){const r=this._worksheet.getCellMatrix(),{startRow:e,startColumn:t,endRow:n,endColumn:i}=this._range;let o=!0;for(let h=e;h<=n;h++){for(let d=t;d<=i;d++)if(!s.isNullCell(r.getValue(h,d))){o=!1;break}if(!o)break}return o}offset(r,e,t,n){const{startRow:i,startColumn:o,endRow:h,endColumn:d}=this._range,u=i+r,m=o+e,g=t?u+t-1:h+r,w=n?m+n-1:d+e;if(u<0||m<0||g<0||w<0)throw new Error("The row or column index is out of range");return this._injector.createInstance(l.FRange,this._workbook,this._worksheet,{startRow:u,startColumn:m,endRow:g,endColumn:w})}setFormula(r){return this.setValue({f:r})}setFormulas(r){return this.setValues(r.map(e=>e.map(t=>({f:t}))))}},l.FRange=L([N(3,s.Inject(s.Injector)),N(4,s.ICommandService),N(5,s.Inject(I.FormulaDataModel))],l.FRange);var z=Object.getOwnPropertyDescriptor,G=(c,r,e,t)=>{for(var n=t>1?void 0:t?z(r,e):r,i=c.length-1,o;i>=0;i--)(o=c[i])&&(n=o(n)||n);return n},$=(c,r)=>(e,t)=>r(e,t,c);l.FSelection=class{constructor(r,e,t,n){this._workbook=r,this._worksheet=e,this._selections=t,this._injector=n}getActiveRange(){const r=this._selections.find(e=>!!e.primary);return r?this._injector.createInstance(l.FRange,this._workbook,this._worksheet,r.range):null}getActiveRangeList(){return this._selections.map(r=>this._injector.createInstance(l.FRange,this._workbook,this._worksheet,r.range))}getCurrentCell(){const r=this._selections.find(e=>!!e.primary);return r?r.primary:null}getActiveSheet(){const r=this._injector.createInstance(l.FWorkbook,this._workbook);return this._injector.createInstance(l.FWorksheet,r,this._workbook,this._worksheet)}updatePrimaryCell(r){const e=this._injector.get(s.ICommandService);let t=[],n=!1;for(const{range:o,style:h}of this._selections)s.Rectangle.contains(o,r.getRange())?(t.push({range:o,primary:a.getPrimaryForRange(r.getRange(),this._worksheet),style:h}),n=!0):t.push({range:o,primary:null,style:h});n||(t=[{range:r.getRange(),primary:a.getPrimaryForRange(r.getRange(),this._worksheet)}]);const i={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),selections:t};return e.syncExecuteCommand(a.SetSelectionsOperation.id,i),new l.FSelection(this._workbook,this._worksheet,t,this._injector)}getNextDataRange(r){if(!this._selections.find(n=>!!n.primary))return null;const t=a.getNextPrimaryCell(this._selections.concat(),r,this._worksheet);return t?this._injector.createInstance(l.FRange,this._workbook,this._worksheet,t):null}},l.FSelection=G([$(3,s.Inject(s.Injector))],l.FSelection);var Y=Object.getOwnPropertyDescriptor,K=(c,r,e,t)=>{for(var n=t>1?void 0:t?Y(r,e):r,i=c.length-1,o;i>=0;i--)(o=c[i])&&(n=o(n)||n);return n},p=(c,r)=>(e,t)=>r(e,t,c);l.FWorksheet=class extends _.FBaseInitialable{constructor(e,t,n,i,o,h,d){super(i);b(this,"setActiveSelection",this.setActiveRange);this._fWorkbook=e,this._workbook=t,this._worksheet=n,this._injector=i,this._selectionManagerService=o,this._logService=h,this._commandService=d}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(l.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(),n=this._worksheet.getSheetId();return this._commandService.syncExecuteCommand(a.SetWorksheetDefaultStyleMutation.id,{unitId:t,subUnitId:n,defaultStyle:e}),this._worksheet.setDefaultCellStyle(e),this}setColumnDefaultStyle(e,t){const n=this._workbook.getUnitId(),i=this._worksheet.getSheetId(),o={unitId:n,subUnitId:i,columnData:{[e]:{s:t}}};return this._commandService.syncExecuteCommand(a.SetColDataCommand.id,o),this}setRowDefaultStyle(e,t){const n=this._workbook.getUnitId(),i=this._worksheet.getSheetId(),o={unitId:n,subUnitId:i,rowData:{[e]:{s:t}}};return this._commandService.syncExecuteCommand(a.SetRowDataCommand.id,o),this}getRange(e,t,n,i){let o,h;if(typeof e=="object")o=e,h=this._worksheet;else if(typeof e=="string"){const{range:d,sheetName:u}=I.deserializeRangeWithSheet(e),m=u?this._workbook.getSheetBySheetName(u):this._worksheet;if(!m)throw new Error("Range not found");h=m,o={...d,unitId:this._workbook.getUnitId(),sheetId:h.getSheetId(),rangeType:s.RANGE_TYPE.NORMAL,startRow:d.rangeType===s.RANGE_TYPE.COLUMN?0:d.startRow,endRow:d.rangeType===s.RANGE_TYPE.COLUMN?h.getMaxRows()-1:d.endRow,startColumn:d.rangeType===s.RANGE_TYPE.ROW?0:d.startColumn,endColumn:d.rangeType===s.RANGE_TYPE.ROW?h.getMaxColumns()-1:d.endColumn}}else if(typeof e=="number"&&t!==void 0)h=this._worksheet,o={startRow:e,endRow:e+(n!=null?n:1)-1,startColumn:t,endColumn:t+(i!=null?i:1)-1,unitId:this._workbook.getUnitId(),sheetId:this._worksheet.getSheetId()};else throw new Error("Invalid range specification");return this._injector.createInstance(l.FRange,this._workbook,h,o)}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 n=this._workbook.getUnitId(),i=this._worksheet.getSheetId(),o=s.Direction.DOWN,h=e+1,d=e+t,u=0,m=this._worksheet.getColumnCount()-1,g=a.copyRangeStyles(this._worksheet,h,d,u,m,!0,e);return this._commandService.syncExecuteCommand(a.InsertRowByRangeCommand.id,{unitId:n,subUnitId:i,direction:o,range:{startRow:h,endRow:d,startColumn:u,endColumn:m},cellValue:g}),this}insertRowsBefore(e,t){const n=this._workbook.getUnitId(),i=this._worksheet.getSheetId(),o=s.Direction.UP,h=e,d=e+t-1,u=0,m=this._worksheet.getColumnCount()-1,g=a.copyRangeStyles(this._worksheet,h,d,u,m,!0,e-1);return this._commandService.syncExecuteCommand(a.InsertRowByRangeCommand.id,{unitId:n,subUnitId:i,direction:o,range:{startRow:h,endRow:d,startColumn:u,endColumn:m},cellValue:g}),this}deleteRow(e){return this.deleteRows(e,1)}deleteRows(e,t){const n={startRow:e,endRow:e+t-1,startColumn:0,endColumn:this._worksheet.getColumnCount()-1};return this._commandService.syncExecuteCommand(a.RemoveRowByRangeCommand.id,{range:n,unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId()}),this}moveRows(e,t){const n=this._workbook.getUnitId(),i=this._worksheet.getSheetId(),o=U(e.getRange(),this._worksheet),h=o,d={startRow:t,endRow:t,startColumn:o.startColumn,endColumn:o.endColumn};return this._commandService.syncExecuteCommand(a.MoveRowsCommand.id,{unitId:n,subUnitId:i,range:o,fromRange:h,toRange:d}),this}hideRow(e){const t=this._workbook.getUnitId(),n=this._worksheet.getSheetId(),i=U(e.getRange(),this._worksheet);return this._commandService.syncExecuteCommand(a.SetRowHiddenCommand.id,{unitId:t,subUnitId:n,ranges:[i]}),this}hideRows(e,t=1){const n=this._workbook.getUnitId(),i=this._worksheet.getSheetId(),o={startRow:e,endRow:e+t-1,startColumn:0,endColumn:this._worksheet.getColumnCount()-1,rangeType:s.RANGE_TYPE.ROW};return this._commandService.syncExecuteCommand(a.SetRowHiddenCommand.id,{unitId:n,subUnitId:i,ranges:[o]}),this}unhideRow(e){const t=this._workbook.getUnitId(),n=this._worksheet.getSheetId(),i=U(e.getRange(),this._worksheet);return this._commandService.syncExecuteCommand(a.SetSpecificRowsVisibleCommand.id,{unitId:t,subUnitId:n,ranges:[i]}),this}showRows(e,t=1){const n=this._workbook.getUnitId(),i=this._worksheet.getSheetId(),o={startRow:e,endRow:e+t-1,startColumn:0,endColumn:this._worksheet.getColumnCount()-1,rangeType:s.RANGE_TYPE.ROW};return this._commandService.syncExecuteCommand(a.SetSpecificRowsVisibleCommand.id,{unitId:n,subUnitId:i,ranges:[o]}),this}setRowHeight(e,t){return this.setRowHeights(e,1,t)}autoFitRow(e,t=s.BooleanNumber.TRUE){const n=this._workbook.getUnitId(),i=this._worksheet.getSheetId(),o=[{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:o[0],value:s.WrapStrategy.WRAP}),this._commandService.syncExecuteCommand(a.SetWorksheetRowIsAutoHeightMutation.id,{unitId:n,subUnitId:i,ranges:o,autoHeightInfo:t}),this}setRowHeights(e,t,n){var m;const i=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),h=this._worksheet.getRowManager(),d=[],u=[];for(let g=e;g<e+t;g++){const w=((m=h.getRow(g))==null?void 0:m.ah)||this._worksheet.getConfig().defaultRowHeight,S={startRow:g,endRow:g,startColumn:0,endColumn:this._worksheet.getColumnCount()-1};n<=w?d.push(S):u.push(S)}return u.length>0&&this._commandService.syncExecuteCommand(a.SetRowHeightCommand.id,{unitId:i,subUnitId:o,ranges:u,value:n}),d.length>0&&this._commandService.syncExecuteCommand(a.SetWorksheetRowIsAutoHeightCommand.id,{unitId:i,subUnitId:o,ranges:d}),this}getRowHeight(e){return this._worksheet.getRowHeight(e)}setRowAutoHeight(e,t){const n=this._workbook.getUnitId(),i=this._worksheet.getSheetId(),o=[{startRow:e,endRow:e+t-1,startColumn:0,endColumn:this._worksheet.getColumnCount()-1}];return this._commandService.syncExecuteCommand(a.SetWorksheetRowIsAutoHeightCommand.id,{unitId:n,subUnitId:i,ranges:o}),this}setRangesAutoHeight(e){const t=this._workbook.getUnitId(),n=this._worksheet.getSheetId();return this._commandService.syncExecuteCommand(a.SetWorksheetRowIsAutoHeightCommand.id,{unitId:t,subUnitId:n,ranges:e}),this}setRowHeightsForced(e,t,n){const i=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),h=[{startRow:e,endRow:e+t-1,startColumn:0,endColumn:this._worksheet.getColumnCount()-1}];return this._commandService.syncExecuteCommand(a.SetRowHeightCommand.id,{unitId:i,subUnitId:o,ranges:h,value:n}),this}setRowCustom(e){const t=this._workbook.getUnitId(),n=this._worksheet.getSheetId(),i={};for(const[h,d]of Object.entries(e))i[Number(h)]={custom:d};const o={unitId:t,subUnitId:n,rowData:i};return this._commandService.syncExecuteCommand(a.SetRowDataCommand.id,o),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 n=this._workbook.getUnitId(),i=this._worksheet.getSheetId(),o=s.Direction.RIGHT,h=0,d=this._worksheet.getRowCount()-1,u=e+1,m=e+t,g=a.copyRangeStyles(this._worksheet,h,d,u,m,!1,e);return this._commandService.syncExecuteCommand(a.InsertColByRangeCommand.id,{unitId:n,subUnitId:i,direction:o,range:{startRow:h,endRow:d,startColumn:u,endColumn:m},cellValue:g}),this}insertColumnsBefore(e,t){const n=this._workbook.getUnitId(),i=this._worksheet.getSheetId(),o=s.Direction.LEFT,h=0,d=this._worksheet.getRowCount()-1,u=e,m=e+t-1,g=a.copyRangeStyles(this._worksheet,h,d,u,m,!1,e-1);return this._commandService.syncExecuteCommand(a.InsertColByRangeCommand.id,{unitId:n,subUnitId:i,direction:o,range:{startRow:h,endRow:d,startColumn:u,endColumn:m},cellValue:g}),this}deleteColumn(e){return this.deleteColumns(e,1)}deleteColumns(e,t){const n={startRow:0,endRow:this._worksheet.getRowCount()-1,startColumn:e,endColumn:e+t-1};return this._commandService.syncExecuteCommand(a.RemoveColByRangeCommand.id,{range:n,unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId()}),this}moveColumns(e,t){const n=this._workbook.getUnitId(),i=this._worksheet.getSheetId(),o=P(e.getRange(),this._worksheet),h=o,d={startRow:0,endRow:this._worksheet.getRowCount()-1,startColumn:t,endColumn:t};return this._commandService.syncExecuteCommand(a.MoveColsCommand.id,{unitId:n,subUnitId:i,range:o,fromRange:h,toRange:d}),this}hideColumn(e){const t=this._workbook.getUnitId(),n=this._worksheet.getSheetId(),i=P(e.getRange(),this._worksheet);return this._commandService.syncExecuteCommand(a.SetColHiddenCommand.id,{unitId:t,subUnitId:n,ranges:[i]}),this}hideColumns(e,t=1){const n=this._workbook.getUnitId(),i=this._worksheet.getSheetId(),o={startRow:0,endRow:this._worksheet.getRowCount()-1,startColumn:e,endColumn:e+t-1,rangeType:s.RANGE_TYPE.COLUMN};return this._commandService.syncExecuteCommand(a.SetColHiddenCommand.id,{unitId:n,subUnitId:i,ranges:[o]}),this}unhideColumn(e){const t=this._workbook.getUnitId(),n=this._worksheet.getSheetId(),i=P(e.getRange(),this._worksheet);return this._commandService.syncExecuteCommand(a.SetSpecificColsVisibleCommand.id,{unitId:t,subUnitId:n,ranges:[i]}),this}showColumns(e,t=1){const n=this._workbook.getUnitId(),i=this._worksheet.getSheetId(),o={startRow:0,endRow:this._worksheet.getRowCount()-1,startColumn:e,endColumn:e+t-1,rangeType:s.RANGE_TYPE.COLUMN};return this._commandService.syncExecuteCommand(a.SetSpecificColsVisibleCommand.id,{unitId:n,subUnitId:i,ranges:[o]}),this}setColumnWidth(e,t){return this.setColumnWidths(e,1,t)}setColumnWidths(e,t,n){const i=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),h=[{startColumn:e,endColumn:e+t-1,startRow:0,endRow:this._worksheet.getRowCount()-1}];return this._commandService.syncExecuteCommand(a.SetColWidthCommand.id,{unitId:i,subUnitId:o,ranges:h,value:n}),this}getColumnWidth(e){return this._worksheet.getColumnWidth(e)}setColumnCustom(e){const t=this._workbook.getUnitId(),n=this._worksheet.getSheetId(),i={};for(const[h,d]of Object.entries(e))i[Number(h)]={custom:d};const o={unitId:t,subUnitId:n,columnData:i};return this._commandService.syncExecuteCommand(a.SetColDataCommand.id,o),this}getMergeData(){return this._worksheet.getMergeData().map(e=>this._injector.createInstance(l.FRange,this._workbook,this._worksheet,e))}getMergedRanges(){return this._worksheet.getSnapshot().mergeData.map(t=>this._injector.createInstance(l.FRange,this._workbook,this._worksheet,t))}getCellMergeData(e,t){const i=this._worksheet.getMergedCell(e,t);if(i)return this._injector.createInstance(l.FRange,this._workbook,this._worksheet,i)}getActiveRange(){return this._fWorkbook.getActiveRange()}setActiveRange(e){const{unitId:t,sheetId:n}=e.getRange();if(t!==this._workbook.getUnitId()||n!==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 n=e[0];this.setFreeze({...t,startColumn:n>0?n:-1,xSplit:n})}else if(arguments.length===2){let[n=0,i=0]=e;n>i&&([n,i]=[i,n]),this._commandService.syncExecuteCommand(a.SetFrozenCommand.id,{startColumn:i+1,xSplit:i-n+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 n=e[0];this.setFreeze({...t,startRow:n>0?n:-1,ySplit:n})}else if(arguments.length===2){let[n=0,i=0]=e;n>i&&([n,i]=[i,n]),this._commandService.syncExecuteCommand(a.SetFrozenCommand.id,{startRow:i+1,ySplit:i-n+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===s.BooleanNumber.FALSE}setHiddenGridlines(e){return this._commandService.syncExecuteCommand(a.ToggleGridlinesCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),showGridlines:e?s.BooleanNumber.FALSE:s.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(s.ICommandService).onCommandExecuted(n=>{if(n.id===a.SetRangeValuesMutation.id){const i=n.params;i.unitId===this._workbook.getUnitId()&&i.subUnitId===this._worksheet.getSheetId()&&i.cellValue&&e(new s.ObjectMatrix(i.cellValue))}})}onBeforeCellDataChange(e){return this._injector.get(s.ICommandService).beforeCommandExecuted(n=>{if(n.id===a.SetRangeValuesMutation.id){const i=n.params;i.unitId===this._workbook.getUnitId()&&i.subUnitId===this._worksheet.getSheetId()&&i.cellValue&&e(new s.ObjectMatrix(i.cellValue))}})}hideSheet(){const e=this._injector.get(s.ICommandService);if(this._workbook.getSheets().filter(o=>o.isSheetHidden()!==s.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(s.ICommandService).syncExecuteCommand(a.SetWorksheetShowCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId()}),this}isSheetHidden(){return this._worksheet.isSheetHidden()===s.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(),n=this._worksheet.getSheetId(),i=this._injector.get(s.ICommandService),o={startRow:0,endRow:this._worksheet.getRowCount()-1,startColumn:0,endColumn:this._worksheet.getColumnCount()-1};return i.syncExecuteCommand(a.ClearSelectionAllCommand.id,{unitId:t,subUnitId:n,ranges:[o],options:e}),this}clearContents(){const e=this._workbook.getUnitId(),t=this._worksheet.getSheetId(),n=this._injector.get(s.ICommandService),i={startRow:0,endRow:this._worksheet.getRowCount()-1,startColumn:0,endColumn:this._worksheet.getColumnCount()-1};return n.syncExecuteCommand(a.ClearSelectionContentCommand.id,{unitId:e,subUnitId:t,ranges:[i]}),this}clearFormats(){const e=this._workbook.getUnitId(),t=this._worksheet.getSheetId(),n=this._injector.get(s.ICommandService),i={startRow:0,endRow:this._worksheet.getRowCount()-1,startColumn:0,endColumn:this._worksheet.getColumnCount()-1};return n.syncExecuteCommand(a.ClearSelectionFormatCommand.id,{unitId:e,subUnitId:t,ranges:[i]}),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 l.FWorksheet?this._worksheet.getSheetId()===e.getSheetId()&&this._workbook.getUnitId()===e.getWorkbook().getUnitId():!1}insertDefinedName(e,t){const i=this._injector.createInstance(E).setName(e).setRef(t).build();i.localSheetId=this.getSheetId(),this._fWorkbook.insertDefinedNameBuilder(i)}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(),n=this._worksheet.getLastRowWithContent(),i=this._worksheet.getRowCount(),o=this._worksheet.getColumnCount(),h=t?n+1:n,d=new s.ObjectMatrix;for(let u=0;u<e.length;u++)d.setValue(h,u,s.covertCellValue(e[u]));return this._commandService.syncExecuteCommand(a.AppendRowCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),cellValue:d.getMatrix(),insertRowNums:h>i-1?1:0,insertColumnNums:e.length>o?e.length-o:0,maxRows:i,maxColumns:o}),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}},l.FWorksheet=K([p(3,s.Inject(s.Injector)),p(4,s.Inject(a.SheetsSelectionsService)),p(5,s.Inject(s.ILogService)),p(6,s.ICommandService)],l.FWorksheet);var q=Object.getOwnPropertyDescriptor,J=(c,r,e,t)=>{for(var n=t>1?void 0:t?q(r,e):r,i=c.length-1,o;i>=0;i--)(o=c[i])&&(n=o(n)||n);return n},C=(c,r)=>(e,t)=>r(e,t,c);l.FWorkbook=class extends _.FBaseInitialable{constructor(e,t,n,i,o,h,d,u,m,g){super(t);b(this,"id");this._workbook=e,this._injector=t,this._resourceLoaderService=n,this._selectionManagerService=i,this._univerInstanceService=o,this._commandService=h,this._permissionService=d,this._logService=u,this._localeService=m,this._definedNamesService=g,this.id=this._workbook.getUnitId()}getWorkbook(){return this._workbook}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(l.FWorksheet,this,this._workbook,e)}getSheets(){return this._workbook.getSheets().map(e=>this._injector.createInstance(l.FWorksheet,this,this._workbook,e))}create(e,t,n,i){var u,m,g;const o=s.mergeWorksheetSnapshotWithDefault(s.Tools.deepClone((u=i==null?void 0:i.sheet)!=null?u:{}));o.name=e,o.rowCount=t,o.columnCount=n,o.id=(m=i==null?void 0:i.sheet)==null?void 0:m.id;const h=(g=i==null?void 0:i.index)!=null?g:this._workbook.getSheets().length;this._commandService.syncExecuteCommand(a.InsertSheetCommand.id,{unitId:this.id,index:h,sheet:o}),this._commandService.syncExecuteCommand(a.SetWorksheetActiveOperation.id,{unitId:this.id,subUnitId:this._workbook.getSheets()[h].getSheetId()});const d=this._workbook.getActiveSheet();if(!d)throw new Error("No active sheet found");return this._injector.createInstance(l.FWorksheet,this,this._workbook,d)}getSheetBySheetId(e){const t=this._workbook.getSheetBySheetId(e);return t?this._injector.createInstance(l.FWorksheet,this,this._workbook,t):null}getSheetByName(e){const t=this._workbook.getSheetBySheetName(e);return t?this._injector.createInstance(l.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 h,d,u;const n=s.mergeWorksheetSnapshotWithDefault(s.Tools.deepClone((h=t==null?void 0:t.sheet)!=null?h:{}));n.name=e,n.id=(d=t==null?void 0:t.sheet)==null?void 0:d.id;const i=(u=t==null?void 0:t.index)!=null?u:this._workbook.getSheets().length;this._commandService.syncExecuteCommand(a.InsertSheetCommand.id,{unitId:this.id,index:i,sheet:n}),this._commandService.syncExecuteCommand(a.SetWorksheetActiveOperation.id,{unitId:this.id,subUnitId:this._workbook.getSheets()[i].getSheetId()});const o=this._workbook.getActiveSheet();if(!o)throw new Error("No active sheet found");return this._injector.createInstance(l.FWorksheet,this,this._workbook,o)}deleteSheet(e){const t=this.id,n=typeof e=="string"?e:e.getSheetId();return this._commandService.syncExecuteCommand(a.RemoveSheetCommand.id,{unitId:t,subUnitId:n})}undo(){return this._univerInstanceService.focusUnit(this.id),this._commandService.syncExecuteCommand(s.UndoCommand.id),this}redo(){return this._univerInstanceService.focusUnit(this.id),this._commandService.syncExecuteCommand(s.RedoCommand.id),this}onBeforeCommandExecute(e){return this._commandService.beforeCommandExecuted(t=>{var n;((n=t.params)==null?void 0:n.unitId)===this.id&&e(t)})}onCommandExecuted(e){return this._commandService.onCommandExecuted(t=>{var n;((n=t.params)==null?void 0:n.unitId)===this.id&&e(t)})}onSelectionChange(e){return s.toDisposable(this._selectionManagerService.selectionMoveEnd$.subscribe(t=>{this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET).getUnitId()===this.id&&(t!=null&&t.length?e(t.map(n=>n.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(),n=e.getRange().sheetId||t.getSheetId(),i=n?this._workbook.getSheetBySheetId(n):this._workbook.getActiveSheet(!0);if(!i)throw new Error("No active sheet found");i.getSheetId()!==t.getSheetId()&&this.setActiveSheet(this._injector.createInstance(l.FWorksheet,this,this._workbook,i));const o={unitId:this.getId(),subUnitId:n,selections:[e].map(h=>({range:h.getRange(),primary:a.getPrimaryForRange(h.getRange(),i),style:null}))};return this._commandService.syncExecuteCommand(a.SetSelectionsOperation.id,o),this}getActiveRange(){const e=this._workbook.getActiveSheet(),n=this._selectionManagerService.getCurrentSelections().find(i=>!!i.primary);return n?this._injector.createInstance(l.FRange,this._workbook,e,n.range):null}getActiveCell(){const e=this._workbook.getActiveSheet(),n=this._selectionManagerService.getCurrentSelections().find(o=>!!o.primary);if(!n)return null;const i={...n.primary,rangeType:s.RANGE_TYPE.NORMAL};return this._injector.createInstance(l.FRange,this._workbook,e,i)}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(l.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 n=t;return n<0?n=0:n>this._workbook.getSheets().length-1&&(n=this._workbook.getSheets().length-1),this._commandService.syncExecuteCommand(a.SetWorksheetOrderCommand.id,{unitId:e.getWorkbook().getUnitId(),order:n,subUnitId:e.getSheetId()}),this}moveActiveSheet(e){const t=this.getActiveSheet();return this.moveSheet(t,e)}getPermission(){return this._injector.createInstance(l.FPermission)}getDefinedName(e){const t=this._definedNamesService.getValueByName(this.id,e);return t?this._injector.createInstance(y,{...t,unitId:this.id}):null}getDefinedNames(){const e=this._definedNamesService.getDefinedNameMap(this.id);return e?Object.values(e).map(t=>this._injector.createInstance(y,{...t,unitId:this.id})):[]}insertDefinedName(e,t){const i=this._injector.createInstance(E).setName(e).setRef(t).build();return i.localSheetId=a.SCOPE_WORKBOOK_VALUE_DEFINED_NAME,this.insertDefinedNameBuilder(i),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()}},l.FWorkbook=J([C(1,s.Inject(s.Injector)),C(2,s.Inject(s.IResourceLoaderService)),C(3,s.Inject(a.SheetsSelectionsService)),C(4,s.IUniverInstanceService),C(5,s.ICommandService),C(6,s.IPermissionService),C(7,s.ILogService),C(8,s.Inject(s.LocaleService)),C(9,I.IDefinedNamesService)],l.FWorkbook);class Q extends _.FUniver{getCommandSheetTarget(r){var i;const e=r.params;if(!e)return this.getActiveSheet();const t=e.unitId?this.getUniverSheet(e.unitId):(i=this.getActiveWorkbook)==null?void 0:i.call(this);if(!t)return;const n=t.getSheetBySheetId(e.subUnitId||e.sheetId)||t.getActiveSheet();if(n)return{workbook:t,worksheet:n}}getSheetTarget(r,e){const t=this.getUniverSheet(r);if(!t)return;const n=t.getSheetBySheetId(e);if(n)return{workbook:t,worksheet:n}}_initWorkbookEvent(r){const e=r.get(s.IUniverInstanceService);this.registerEventHandler(this.Event.WorkbookDisposed,()=>e.unitDisposed$.subscribe(t=>{t.type===s.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===s.UniverInstanceType.UNIVER_SHEET){const n=t,i=r.createInstance(l.FWorkbook,n);this.fireEvent(this.Event.WorkbookCreated,{unitId:t.getUnitId(),type:t.type,workbook:i,unit:i})}}))}_initialize(r){const e=r.get(s.ICommandService);this.registerEventHandler(this.Event.BeforeSheetCreate,()=>e.beforeCommandExecuted(t=>{var n;if(t.id===a.InsertSheetCommand.id){const i=t.params,{unitId:o,index:h,sheet:d}=i||{},u=o?this.getUniverSheet(o):(n=this.getActiveWorkbook)==null?void 0:n.call(this);if(!u)return;const m={workbook:u,index:h,sheet:d};if(this.fireEvent(this.Event.BeforeSheetCreate,m),m.cancel)throw new s.CanceledError}})),this.registerEventHandler(this.Event.BeforeActiveSheetChange,()=>e.beforeCommandExecuted(t=>{var n;if(t.id===a.SetWorksheetActiveOperation.id){const{subUnitId:i,unitId:o}=t.params,h=o?this.getUniverSheet(o):(n=this.getActiveWorkbook)==null?void 0:n.call(this);if(!h||!i)return;const d=h.getSheetBySheetId(i),u=h.getActiveSheet();if(!d||!u)return;const m={workbook:h,activeSheet:d,oldActiveSheet:u};if(this.fireEvent(this.Event.BeforeActiveSheetChange,m),m.cancel)throw new s.CanceledError}})),this.registerEventHandler(this.Event.BeforeSheetDelete,()=>e.beforeCommandExecuted(t=>{if(t.id===a.RemoveSheetCommand.id){const n=this.getCommandSheetTarget(t);if(!n)return;const{workbook:i,worksheet:o}=n,h={workbook:i,worksheet:o};if(this.fireEvent(this.Event.BeforeSheetDelete,h),h.cancel)throw new s.CanceledError}})),this.registerEventHandler(this.Event.BeforeSheetMove,()=>e.beforeCommandExecuted(t=>{if(t.id===a.SetWorksheetOrderMutation.id){const{fromOrder:n,toOrder:i}=t.params,o=this.getCommandSheetTarget(t);if(!o)return;const h={workbook:o.workbook,worksheet:o.worksheet,newIndex:i,oldIndex:n};if(this.fireEvent(this.Event.BeforeSheetMove,h),h.cancel)throw new s.CanceledError}})),this.registerEventHandler(this.Event.BeforeSheetNameChange,()=>e.beforeCommandExecuted(t=>{if(t.id===a.SetWorksheetNameCommand.id){const{name:n}=t.params,i=this.getCommandSheetTarget(t);if(!i)return;const o={workbook:i.workbook,worksheet:i.worksheet,newName:n,oldName:i.worksheet.getSheetName()};if(this.fireEvent(this.Event.BeforeSheetNameChange,o),o.cancel)throw new s.CanceledError}})),this.registerEventHandler(this.Event.BeforeSheetTabColorChange,()=>e.beforeCommandExecuted(t=>{if(t.id===a.SetTabColorMutation.id){const{color:n}=t.params,i=this.getCommandSheetTarget(t);if(!i)return;const o={workbook:i.workbook,worksheet:i.worksheet,newColor:n,oldColor:i.worksheet.getTabColor()};if(this.fireEvent(this.Event.BeforeSheetTabColorChange,o),o.cancel)throw new s.CanceledError}})),this.registerEventHandler(this.Event.BeforeSheetHideChange,()=>e.beforeCommandExecuted(t=>{if(t.id===a.SetWorksheetHideMutation.id){const{hidden:n}=t.params,i=this.getCommandSheetTarget(t);if(!i)return;const o={workbook:i.workbook,worksheet:i.worksheet,hidden:!!n};if(this.fireEvent(this.Event.BeforeSheetHideChange,o),o.cancel)throw new s.CanceledError}})),this.registerEventHandler(this.Event.BeforeGridlineColorChange,()=>e.beforeCommandExecuted(t=>{var n;if(t.id===a.SetGridlinesColorCommand.id){const i=this.getCommandSheetTarget(t);if(!i)return;const o={...i,color:(n=t.params)==null?void 0:n.color};if(this.fireEvent(this.Event.BeforeGridlineColorChange,o),o.cancel)throw new s.CanceledError}})),this.registerEventHandler(this.Event.BeforeGridlineEnableChange,()=>e.beforeCommandExecuted(t=>{var n;if(t.id===a.ToggleGridlinesCommand.id){const i=this.getCommandSheetTarget(t);if(!i)return;const o={...i,enabled:!!((n=t.params)!=null&&n.showGridlines)};if(this.fireEvent(this.Event.BeforeGridlineEnableChange,o),o.cancel)throw new s.CanceledError}})),this.registerEventHandler(this.Event.SheetValueChanged,()=>e.onCommandExecuted(t=>{if(a.COMMAND_LISTENER_VALUE_CHANGE.indexOf(t.id)>-1){if(!this.getActiveSheet())return;const i=a.getValueChangedEffectedRange(t).map(o=>{var h,d;return(d=(h=this.getWorkbook(o.unitId))==null?void 0:h.getSheetBySheetId(o.subUnitId))==null?void 0:d.getRange(o.range)}).filter(Boolean);if(!i.length)return;this.fireEvent(this.Event.SheetValueChanged,{payload:t,effectedRanges:i})}})),this.registerEventHandler(this.Event.SheetCreated,()=>e.onCommandExecuted(t=>{var n;if(t.id===a.InsertSheetCommand.id){const i=t.params,{unitId:o}=i||{},h=o?this.getUniverSheet(o):(n=this.getActiveWorkbook)==null?void 0:n.call(this);if(!h)return;const d=h.getActiveSheet();if(!d)return;const u={workbook:h,worksheet:d};this.fireEvent(this.Event.SheetCreated,u)}})),this.registerEventHandler(this.Event.ActiveSheetChanged,()=>e.onCommandExecuted(t=>{if(t.id===a.SetWorksheetActiveOperation.id){const n=this.getActiveSheet();if(!n)return;const{workbook:i,worksheet:o}=n;this._fireActiveSheetChanged(i,o)}})),this.registerEventHandler(this.Event.SheetDeleted,()=>e.onCommandExecuted(t=>{var n;if(t.id===a.RemoveSheetCommand.id){const{subUnitId:i,unitId:o}=t.params,h=o?this.getUniverSheet(o):(n=this.getActiveWorkbook)==null?void 0:n.call(this);if(!h||!i)return;this._fireSheetDeleted(h,i)}})),this.registerEventHandler(this.Event.SheetMoved,()=>e.onCommandExecuted(t=>{if(t.id===a.SetWorksheetOrderMutation.id){const{toOrder:n}=t.params,i=this.getCommandSheetTarget(t);if(!i)return;this._fireSheetMoved(i.workbook,i.worksheet,n)}})),this.registerEventHandler(this.Event.SheetNameChanged,()=>e.onCommandExecuted(t=>{if(t.id===a.SetWorksheetNameCommand.id){const{name:n}=t.params,i=this.getCommandSheetTarget(t);if(!i)return;this._fireSheetNameChanged(i.workbook,i.worksheet,n)}})),this.registerEventHandler(this.Event.SheetTabColorChanged,()=>e.onCommandExecuted(t=>{if(t.id===a.SetTabColorMutation.id){const{color:n}=t.params,i=this.getCommandSheetTarget(t);if(!i)return;this._fireSheetTabColorChanged(i.workbook,i.worksheet,n)}})),this.registerEventHandler(this.Event.SheetHideChanged,()=>e.onCommandExecuted(t=>{if(t.id===a.SetWorksheetHideMutation.id){const{hidden:n}=t.params,i=this.getCommandSheetTarget(t);if(!i)return;this._fireSheetHideChanged(i.workbook,i.worksheet,!!n)}})),this.registerEventHandler(this.Event.GridlineChanged,()=>e.onCommandExecuted(t=>{if(t.id===a.SetGridlinesColorCommand.id||t.id===a.ToggleGridlinesCommand.id){const n=this.getCommandSheetTarget(t);if(!n)return;this.fireEvent(this.Event.GridlineChanged,{...n,enabled:!n.worksheet.hasHiddenGridLines(),color:n.worksheet.getGridLinesColor()})}})),this._initWorkbookEvent(r)}createUniverSheet(r,e){const n=this._injector.get(s.IUniverInstanceService).createUnit(s.UniverInstanceType.UNIVER_SHEET,r,e);return this._injector.createInstance(l.FWorkbook,n)}createWorkbook(r,e){return this.createUniverSheet(r,e)}getActiveWorkbook(){const r=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET);return r?this._injector.createInstance(l.FWorkbook,r):null}getActiveUniverSheet(){return this.getActiveWorkbook()}getUniverSheet(r){const e=this._univerInstanceService.getUnit(r,s.UniverInstanceType.UNIVER_SHEET);return e?this._injector.createInstance(l.FWorkbook,e):null}getWorkbook(r){return this.getUniverSheet(r)}getPermission(){return this._injector.createInstance(l.FPermission)}onUniverSheetCreated(r){const e=this._univerInstanceService.getTypeOfUnitAdded$(s.UniverInstanceType.UNIVER_SHEET).subscribe(t=>{const n=this._injector.createInstance(l.FWorkbook,t);r(n)});return s.toDisposable(e)}newDefinedName(){return this._injector.createInstance(E)}getActiveSheet(){const r=this.getActiveWorkbook();if(!r)return null;const e=r.getActiveSheet();return e?{workbook:r,worksheet:e}:null}_fireActiveSheetChanged(r,e){this.fireEvent(this.Event.ActiveSheetChanged,{workbook:r,activeSheet:e})}_fireSheetDeleted(r,e){this.fireEvent(this.Event.SheetDeleted,{workbook:r,sheetId:e})}_fireSheetMoved(r,e,t){this.fireEvent(this.Event.SheetMoved,{workbook:r,worksheet:e,newIndex:t})}_fireSheetNameChanged(r,e,t){this.fireEvent(this.Event.SheetNameChanged,{workbook:r,worksheet:e,newName:t})}_fireSheetTabColorChanged(r,e,t){this.fireEvent(this.Event.SheetTabColorChanged,{workbook:r,worksheet:e,newColor:t})}_fireSheetHideChanged(r,e,t){this.fireEvent(this.Event.SheetHideChanged,{workbook:r,worksheet:e,hidden:t})}}_.FUniver.extend(Q);class W{get SheetValueChangeType(){return a.SheetValueChangeType}get SheetSkeletonChangeType(){return a.SheetSkeletonChangeType}get SplitDelimiterType(){return a.SplitDelimiterEnum}}_.FEnum.extend(W);class M{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"}}_.FEventName.extend(M);var X=Object.getOwnPropertyDescriptor,Z=(c,r,e,t)=>{for(var n=t>1?void 0:t?X(r,e):r,i=c.length-1,o;i>=0;i--)(o=c[i])&&(n=o(n)||n);return n},ee=(c,r)=>(e,t)=>r(e,t,c);l.FSheetHooks=class extends _.FBase{constructor(r){super(),this._injector=r}},l.FSheetHooks=Z([ee(0,s.Inject(s.Injector))],l.FSheetHooks),l.FSheetEventName=M,l.FSheetsEnum=W,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})});
16
+ (function(u,s){typeof exports=="object"&&typeof module<"u"?s(exports,require("@univerjs/core"),require("@univerjs/core/facade"),require("@univerjs/sheets"),require("@univerjs/engine-formula")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/core/facade","@univerjs/sheets","@univerjs/engine-formula"],s):(u=typeof globalThis<"u"?globalThis:u||self,s(u.UniverSheetsFacade={},u.UniverCore,u.UniverCoreFacade,u.UniverSheets,u.UniverEngineFormula))})(this,function(u,s,_,a,I){"use strict";var te=Object.defineProperty;var ne=(u,s,_)=>s in u?te(u,s,{enumerable:!0,configurable:!0,writable:!0,value:_}):u[s]=_;var b=(u,s,_)=>ne(u,typeof s!="symbol"?s+"":s,_);var F=Object.getOwnPropertyDescriptor,D=(c,r,e,t)=>{for(var n=t>1?void 0:t?F(r,e):r,i=c.length-1,o;i>=0;i--)(o=c[i])&&(n=o(n)||n);return n},k=(c,r)=>(e,t)=>r(e,t,c);function x(c,r,e){const t=e.getDefinedNameMap(c);if(t==null)return r.t("definedName.defaultName")+1;const i=Array.from(Object.values(t)).length+1,o=r.t("definedName.defaultName")+i;if(e.getValueByName(c,o)==null)return o;let h=i+1;for(;;){const d=r.t("definedName.defaultName")+h;if(e.getValueByName(c,d)==null)return d;h++}}class E{constructor(){b(this,"_definedNameParam");this._definedNameParam={id:s.generateRandomId(10),unitId:"",name:"",formulaOrRefString:"",localSheetId:a.SCOPE_WORKBOOK_VALUE_DEFINED_NAME}}setName(r){return this._definedNameParam.name=r,this}setFormula(r){return this._definedNameParam.formulaOrRefString=`=${r}`,this}setRef(r){return this._definedNameParam.formulaOrRefString=r,this}setRefByRange(r,e,t,n){return this._definedNameParam.formulaOrRefString=I.serializeRange({startRow:r,endRow:r+(t!=null?t:1)-1,startColumn:e,endColumn:e+(n!=null?n:1)-1}),this}setComment(r){return this._definedNameParam.comment=r,this}setScopeToWorksheet(r){return this._definedNameParam.localSheetId=r.getSheetId(),this}setScopeToWorkbook(){return this._definedNameParam.localSheetId=a.SCOPE_WORKBOOK_VALUE_DEFINED_NAME,this}setHidden(r){return this._definedNameParam.hidden=r,this}build(){return this._definedNameParam}load(r){return this._definedNameParam=r,this}}let y=class extends _.FBase{constructor(c,r,e,t,n,i,o,h,d,l){super(),this._definedNameParam=c,this._injector=r,this._commandService=e,this._permissionService=t,this._worksheetProtectionRuleModel=n,this._rangeProtectionRuleModel=i,this._worksheetProtectionPointRuleModel=o,this._authzIoService=h,this._localeService=d,this._definedNamesService=l}_apply(){this._definedNameParam.name===""&&(this._definedNameParam.name=x(this._definedNameParam.unitId,this._localeService,this._definedNamesService)),this._commandService.syncExecuteCommand(a.SetDefinedNameCommand.id,this._definedNameParam)}getName(){return this._definedNameParam.name}setName(c){this._definedNameParam.name=c,this._apply()}setFormula(c){this._definedNameParam.formulaOrRefString=`=${c}`,this._apply()}setRef(c){this._definedNameParam.formulaOrRefString=c,this._apply()}getFormulaOrRefString(){return this._definedNameParam.formulaOrRefString}setRefByRange(c,r,e,t){this._definedNameParam.formulaOrRefString=I.serializeRange({startRow:c,endRow:c+(e!=null?e:1)-1,startColumn:r,endColumn:r+(t!=null?t:1)-1}),this._apply()}getComment(){return this._definedNameParam.comment}setComment(c){this._definedNameParam.comment=c,this._apply()}setScopeToWorksheet(c){this._definedNameParam.localSheetId=c.getSheetId(),this._apply()}setScopeToWorkbook(){this._definedNameParam.localSheetId=a.SCOPE_WORKBOOK_VALUE_DEFINED_NAME,this._apply()}setHidden(c){this._definedNameParam.hidden=c,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 c=this._injector.createInstance(E);return c.load(this._definedNameParam),c}};y=D([k(1,s.Inject(s.Injector)),k(2,s.ICommandService),k(3,s.IPermissionService),k(4,s.Inject(a.WorksheetProtectionRuleModel)),k(5,s.Inject(a.RangeProtectionRuleModel)),k(6,s.Inject(a.WorksheetProtectionPointModel)),k(7,s.Inject(s.IAuthzIoService)),k(8,s.Inject(s.LocaleService)),k(9,I.IDefinedNamesService)],y);var B=Object.getOwnPropertyDescriptor,j=(c,r,e,t)=>{for(var n=t>1?void 0:t?B(r,e):r,i=c.length-1,o;i>=0;i--)(o=c[i])&&(n=o(n)||n);return n},f=(c,r)=>(e,t)=>r(e,t,c);u.FPermission=class extends _.FBase{constructor(e,t,n,i,o,h,d){super();b(this,"permissionPointsDefinition",a.PermissionPointsDefinitions);b(this,"rangeRuleChangedAfterAuth$");b(this,"sheetRuleChangedAfterAuth$");this._injector=e,this._commandService=t,this._permissionService=n,this._worksheetProtectionRuleModel=i,this._rangeProtectionRuleModel=o,this._worksheetProtectionPointRuleModel=h,this._authzIoService=d,this.rangeRuleChangedAfterAuth$=this._rangeProtectionRuleModel.ruleRefresh$,this.sheetRuleChangedAfterAuth$=this._worksheetProtectionRuleModel.ruleRefresh$}setWorkbookPermissionPoint(e,t,n){const i=new t(e);this._permissionService.getPermissionPoint(i.id)||this._permissionService.addPermissionPoint(i),this._permissionService.updatePermissionPoint(i.id,n)}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 i=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:i,unitType:a.UnitObject.Worksheet,unitId:e,subUnitId:t}}))return i}removeWorksheetPermission(e,t){this._commandService.syncExecuteCommand(a.DeleteWorksheetProtectionMutation.id,{unitId:e,subUnitId:t}),[...a.getAllWorksheetPermissionPoint(),...a.getAllWorksheetPermissionPointByPointPanel()].forEach(n=>{const i=new n(e,t);this._permissionService.updatePermissionPoint(i.id,!0)}),this._worksheetProtectionPointRuleModel.deleteRule(e,t)}async setWorksheetPermissionPoint(e,t,n,i){const o=this._worksheetProtectionRuleModel.getRule(e,t);let h;if(n===a.WorksheetEditPermission||n===a.WorksheetViewPermission)if(o)h=o.permissionId;else{if(this._rangeProtectionRuleModel.getSubunitRuleList(e,t).length>0)throw new Error("sheet protection cannot intersect with range protection");h=await this.addWorksheetBasePermission(e,t)}else{const g=this._worksheetProtectionPointRuleModel.getRule(e,t);g?h=g.permissionId:(h=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:h}}))}const l=new n(e,t);return this._permissionService.getPermissionPoint(l.id)||this._permissionService.addPermissionPoint(l),this._permissionService.updatePermissionPoint(l.id,i),h}async addRangeBaseProtection(e,t,n){const i=await this._authzIoService.create({objectType:a.UnitObject.SelectRange,selectRangeObject:{collaborators:[],unitID:e,name:"",scope:void 0}}),o=`ruleId_${s.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(g=>g.ranges.some(C=>n.some(S=>s.Rectangle.intersects(S.getRange(),C)))))throw new Error("range protection cannot intersect");if(this._commandService.syncExecuteCommand(a.AddRangeProtectionMutation.id,{unitId:e,subUnitId:t,rules:[{permissionId:i,unitType:a.UnitObject.SelectRange,unitId:e,subUnitId:t,ranges:n.map(g=>g.getRange()),id:o}]}))return{permissionId:i,ruleId:o}}removeRangeProtection(e,t,n){this._commandService.syncExecuteCommand(a.DeleteRangeProtectionMutation.id,{unitId:e,subUnitId:t,ruleIds:n})&&this._rangeProtectionRuleModel.getSubunitRuleList(e,t).length===0&&(this._worksheetProtectionPointRuleModel.deleteRule(e,t),[...a.getAllWorksheetPermissionPointByPointPanel()].forEach(h=>{const d=new h(e,t);this._permissionService.updatePermissionPoint(d.id,d.value)}))}setRangeProtectionPermissionPoint(e,t,n,i,o){const h=new i(e,t,n);this._permissionService.getPermissionPoint(h.id)||this._permissionService.addPermissionPoint(h),this._permissionService.updatePermissionPoint(h.id,o)}setRangeProtectionRanges(e,t,n,i){const o=this._rangeProtectionRuleModel.getRule(e,t,n);if(o){if(this._rangeProtectionRuleModel.getSubunitRuleList(e,t).filter(l=>l.id!==n).some(l=>l.ranges.some(m=>i.some(g=>s.Rectangle.intersects(g.getRange(),m)))))throw new Error("range protection cannot intersect");this._commandService.syncExecuteCommand(a.SetRangeProtectionMutation.id,{unitId:e,subUnitId:t,ruleId:n,rule:{...o,ranges:i.map(l=>l.getRange())}})}}},u.FPermission=j([f(0,s.Inject(s.Injector)),f(1,s.ICommandService),f(2,s.IPermissionService),f(3,s.Inject(a.WorksheetProtectionRuleModel)),f(4,s.Inject(a.RangeProtectionRuleModel)),f(5,s.Inject(a.WorksheetProtectionPointModel)),f(6,s.Inject(s.IAuthzIoService))],u.FPermission);function V(c){switch(c){case"left":return s.HorizontalAlign.LEFT;case"center":return s.HorizontalAlign.CENTER;case"normal":return s.HorizontalAlign.RIGHT;default:throw new Error(`Invalid horizontal alignment: ${c}`)}}function A(c){switch(c){case s.HorizontalAlign.LEFT:return"left";case s.HorizontalAlign.CENTER:return"center";case s.HorizontalAlign.RIGHT:return"normal";default:return"general"}}function O(c){switch(c){case"top":return s.VerticalAlign.TOP;case"middle":return s.VerticalAlign.MIDDLE;case"bottom":return s.VerticalAlign.BOTTOM;default:throw new Error(`Invalid vertical alignment: ${c}`)}}function T(c){switch(c){case s.VerticalAlign.TOP:return"top";case s.VerticalAlign.MIDDLE:return"middle";case s.VerticalAlign.BOTTOM:return"bottom";default:return"general"}}function U(c,r){return{startRow:c.startRow,endRow:c.endRow,startColumn:0,endColumn:r.getColumnCount()-1,rangeType:s.RANGE_TYPE.ROW}}function P(c,r){return{startRow:0,endRow:r.getRowCount()-1,startColumn:c.startColumn,endColumn:c.endColumn,rangeType:s.RANGE_TYPE.COLUMN}}var H=Object.getOwnPropertyDescriptor,L=(c,r,e,t)=>{for(var n=t>1?void 0:t?H(r,e):r,i=c.length-1,o;i>=0;i--)(o=c[i])&&(n=o(n)||n);return n},N=(c,r)=>(e,t)=>r(e,t,c);u.FRange=class extends _.FBaseInitialable{constructor(r,e,t,n,i,o){super(n),this._workbook=r,this._worksheet=e,this._range=t,this._injector=n,this._commandService=i,this._formulaDataModel=o}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:r,startRow:e,endColumn:t,endRow:n}=this._range;return this._worksheet.getMergedCellRange(e,r,n,t).some(o=>s.Rectangle.equals(o,this._range))}getCellStyleData(r="row"){return r!=="cell"?this._worksheet.getComposedCellStyle(this._range.startRow,this._range.startColumn,r==="row"):this._worksheet.getCellStyle(this._range.startRow,this._range.startColumn)}getFontFamily(r="row"){var e,t;return(t=(e=this.getCellStyleData(r))==null?void 0:e.ff)!=null?t:null}getFontSize(r="row"){var e,t;return(t=(e=this.getCellStyleData(r))==null?void 0:e.fs)!=null?t:null}getCellStyle(r="row"){const e=this.getCellStyleData(r);return e?s.TextStyleValue.create(e):null}getCellStyles(r="row"){return this.getCellDatas().map((t,n)=>t.map((i,o)=>{if(!i)return null;const h=r!=="cell"?this._worksheet.getComposedCellStyle(n+this._range.startRow,o+this._range.startColumn,r==="row"):this._worksheet.getCellStyle(n+this._range.startRow,o+this._range.startColumn);return h?s.TextStyleValue.create(h):null}))}getValue(r){var e,t;return r?this.getValueAndRichTextValue():(t=(e=this._worksheet.getCell(this._range.startRow,this._range.startColumn))==null?void 0:e.v)!=null?t:null}getRawValue(){var e;const r=this._worksheet.getCellMatrix().getValue(this._range.startRow,this._range.startColumn);return r!=null&&r.p&&((e=r.p.body)!=null&&e.dataStream)?r.p.body.dataStream:r!=null&&r.v?r.v:null}getDisplayValue(){var e;const r=this._worksheet.getCell(this._range.startRow,this._range.startColumn);return r!=null&&r.p&&((e=r.p.body)!=null&&e.dataStream)?r.p.body.dataStream:r!=null&&r.v?String(r.v):""}getValues(r){var h,d;if(r)return this.getValueAndRichTextValues();const{startRow:e,endRow:t,startColumn:n,endColumn:i}=this._range,o=[];for(let l=e;l<=t;l++){const m=[];for(let g=n;g<=i;g++)m.push((d=(h=this._worksheet.getCell(l,g))==null?void 0:h.v)!=null?d:null);o.push(m)}return o}getRawValues(){var h;const r=this._worksheet.getCellMatrix(),{startRow:e,endRow:t,startColumn:n,endColumn:i}=this._range,o=[];for(let d=e;d<=t;d++){const l=[];for(let m=n;m<=i;m++){const g=r.getValue(d,m);g!=null&&g.p&&((h=g.p.body)!=null&&h.dataStream)?l.push(g.p.body.dataStream):g!=null&&g.v?l.push(g.v):l.push(null)}o.push(l)}return o}getDisplayValues(){var o;const{startRow:r,endRow:e,startColumn:t,endColumn:n}=this._range,i=[];for(let h=r;h<=e;h++){const d=[];for(let l=t;l<=n;l++){const m=this._worksheet.getCell(h,l);m!=null&&m.p&&((o=m.p.body)!=null&&o.dataStream)?d.push(m.p.body.dataStream):m!=null&&m.v?d.push(String(m.v)):d.push("")}i.push(d)}return i}getCellData(){var r;return(r=this._worksheet.getCell(this._range.startRow,this._range.startColumn))!=null?r:null}getCellDatas(){return this.getCellDataGrid()}getCellDataGrid(){const{startRow:r,endRow:e,startColumn:t,endColumn:n}=this._range,i=[];for(let o=r;o<=e;o++){const h=[];for(let d=t;d<=n;d++)h.push(this._worksheet.getCellRaw(o,d));i.push(h)}return i}getRichTextValue(){const r=this.getCellData();return r!=null&&r.p?new s.RichTextValue(r.p):null}getRichTextValues(){return this.getCellDataGrid().map(e=>e.map(t=>t!=null&&t.p?new s.RichTextValue(t.p):null))}getValueAndRichTextValue(){const r=this.getCellData();return r!=null&&r.p?new s.RichTextValue(r.p):r==null?void 0:r.v}getValueAndRichTextValues(){return this.getCellDatas().map(e=>e.map(t=>t!=null&&t.p?new s.RichTextValue(t.p):t==null?void 0:t.v))}getFormula(){var r;return(r=this._formulaDataModel.getFormulaStringByCell(this._range.startRow,this._range.startColumn,this._worksheet.getSheetId(),this._workbook.getUnitId()))!=null?r:""}getFormulas(){const r=[],{startRow:e,endRow:t,startColumn:n,endColumn:i}=this._range,o=this._worksheet.getSheetId(),h=this._workbook.getUnitId();for(let d=e;d<=t;d++){const l=[];for(let m=n;m<=i;m++){const g=this._formulaDataModel.getFormulaStringByCell(d,m,o,h);l.push(g||"")}r.push(l)}return r}getWrap(){return this._worksheet.getRange(this._range).getWrap()===s.BooleanNumber.TRUE}getWraps(){const r=this.getCellDatas(),e=this._workbook.getStyles();return r.map(t=>t.map(n=>{var i;return((i=e.getStyleByCell(n))==null?void 0:i.tb)===s.WrapStrategy.WRAP}))}getWrapStrategy(){return this._worksheet.getRange(this._range).getWrapStrategy()}getHorizontalAlignment(){const r=this._worksheet.getRange(this._range).getHorizontalAlignment();return A(r)}getHorizontalAlignments(){return this._worksheet.getRange(this._range).getHorizontalAlignments().map(e=>e.map(t=>A(t)))}getVerticalAlignment(){return T(this._worksheet.getRange(this._range).getVerticalAlignment())}getVerticalAlignments(){return this._worksheet.getRange(this._range).getVerticalAlignments().map(e=>e.map(t=>T(t)))}setCustomMetaData(r){return this.setValue({custom:r})}setCustomMetaDatas(r){return this.setValues(r.map(e=>e.map(t=>({custom:t}))))}getCustomMetaData(){var e;const r=this.getCellData();return(e=r==null?void 0:r.custom)!=null?e:null}getCustomMetaDatas(){return this.getCellDataGrid().map(e=>e.map(t=>{var n;return(n=t==null?void 0:t.custom)!=null?n:null}))}setBorder(r,e,t){return this._commandService.syncExecuteCommand(a.SetBorderBasicCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),ranges:[this._range],value:{type:r,style:e,color:t}}),this}getBackground(){var e,t;const r=this.getCellStyle();return(t=(e=r==null?void 0:r.background)==null?void 0:e.rgb)!=null?t:s.DEFAULT_STYLES.bg.rgb}getBackgrounds(){return this.getCellStyles().map(e=>e.map(t=>{var n,i;return(i=(n=t==null?void 0:t.background)==null?void 0:n.rgb)!=null?i:s.DEFAULT_STYLES.bg.rgb}))}setBackgroundColor(r){return this._commandService.syncExecuteCommand(a.SetStyleCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,style:{type:"bg",value:{rgb:r}}}),this}setBackground(r){return this.setBackgroundColor(r),this}setTextRotation(r){return this._commandService.syncExecuteCommand(a.SetTextRotationCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,value:r}),this}setValue(r){const e=s.covertCellValue(r);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(r){const e=s.covertCellValue(r);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(r){const e=r instanceof s.RichTextValue?r.getData():r,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(r){const e=r.map(i=>i.map(o=>o&&{p:o instanceof s.RichTextValue?o.getData():o})),t=s.covertCellValues(e,this._range),n={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,value:t};return this._commandService.syncExecuteCommand(a.SetRangeValuesCommand.id,n),this}setWrap(r){return this._commandService.syncExecuteCommand(a.SetTextWrapCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,value:r?s.WrapStrategy.WRAP:s.WrapStrategy.UNSPECIFIED}),this}setWrapStrategy(r){return this._commandService.syncExecuteCommand(a.SetTextWrapCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,value:r}),this}setVerticalAlignment(r){return this._commandService.syncExecuteCommand(a.SetVerticalTextAlignCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,value:O(r)}),this}setHorizontalAlignment(r){return this._commandService.syncExecuteCommand(a.SetHorizontalTextAlignCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,value:V(r)}),this}setValues(r){const e=s.covertCellValues(r,this._range);return this._commandService.syncExecuteCommand(a.SetRangeValuesCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,value:e}),this}setFontWeight(r){let e;if(r==="bold")e=s.BooleanNumber.TRUE;else if(r==="normal")e=s.BooleanNumber.FALSE;else if(r===null)e=null;else throw new Error("Invalid fontWeight");const t={type:"bl",value:e},n={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,style:t};return this._commandService.syncExecuteCommand(a.SetStyleCommand.id,n),this}setFontStyle(r){let e;if(r==="italic")e=s.BooleanNumber.TRUE;else if(r==="normal")e=s.BooleanNumber.FALSE;else if(r===null)e=null;else throw new Error("Invalid fontStyle");const t={type:"it",value:e},n={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,style:t};return this._commandService.syncExecuteCommand(a.SetStyleCommand.id,n),this}setFontLine(r){if(r==="underline")this._setFontUnderline({s:s.BooleanNumber.TRUE});else if(r==="line-through")this._setFontStrikethrough({s:s.BooleanNumber.TRUE});else if(r==="none")this._setFontUnderline({s:s.BooleanNumber.FALSE}),this._setFontStrikethrough({s:s.BooleanNumber.FALSE});else if(r===null)this._setFontUnderline(null),this._setFontStrikethrough(null);else throw new Error("Invalid fontLine");return this}_setFontUnderline(r){const e={type:"ul",value:r},t={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,style:e};this._commandService.syncExecuteCommand(a.SetStyleCommand.id,t)}_setFontStrikethrough(r){const e={type:"st",value:r},t={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,style:e};this._commandService.syncExecuteCommand(a.SetStyleCommand.id,t)}setFontFamily(r){const e={type:"ff",value:r},t={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,style:e};return this._commandService.syncExecuteCommand(a.SetStyleCommand.id,t),this}setFontSize(r){const e={type:"fs",value:r},t={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,style:e};return this._commandService.syncExecuteCommand(a.SetStyleCommand.id,t),this}setFontColor(r){const t={type:"cl",value:r===null?null:{rgb:r}},n={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,style:t};return this._commandService.syncExecuteCommand(a.SetStyleCommand.id,n),this}merge(r=!0){const e=this._workbook.getUnitId(),t=this._worksheet.getSheetId();return a.addMergeCellsUtil(this._injector,e,t,[this._range],r),this}mergeAcross(r=!0){const e=a.getAddMergeMutationRangeByType([this._range],s.Dimension.ROWS),t=this._workbook.getUnitId(),n=this._worksheet.getSheetId();return a.addMergeCellsUtil(this._injector,t,n,e,r),this}mergeVertically(r=!0){const e=a.getAddMergeMutationRangeByType([this._range],s.Dimension.COLUMNS),t=this._workbook.getUnitId(),n=this._worksheet.getSheetId();return a.addMergeCellsUtil(this._injector,t,n,e,r),this}isPartOfMerge(){const{startRow:r,startColumn:e,endRow:t,endColumn:n}=this._range;return this._worksheet.getMergedCellRange(r,e,t,n).length>0}breakApart(){return this._commandService.syncExecuteCommand(a.RemoveWorksheetMergeCommand.id,{ranges:[this._range]}),this}forEach(r){const{startColumn:e,startRow:t,endColumn:n,endRow:i}=this._range;this._worksheet.getMatrixWithMergedCells(t,e,i,n).forValue((o,h,d)=>{r(o,h,d)})}getA1Notation(r,e,t){const n={...this._range,startAbsoluteRefType:e,endAbsoluteRefType:t};return r?I.serializeRangeWithSheet(this._worksheet.getName(),n):I.serializeRange(n)}activate(){return this._injector.createInstance(u.FWorkbook,this._workbook).setActiveRange(this),this}activateAsCurrentCell(){const r=this._worksheet.getMergedCell(this._range.startRow,this._range.startColumn);if(r&&s.Rectangle.equals(r,this._range)||!r&&this._range.startRow===this._range.endRow&&this._range.startColumn===this._range.endColumn){const n=this._injector.createInstance(u.FWorkbook,this._workbook).getActiveRange();if(!n||n.getUnitId()!==this.getUnitId()||n.getSheetId()!==this.getSheetId())return this.activate();if(s.Rectangle.contains(n.getRange(),this._range)){const i={unitId:this.getUnitId(),subUnitId:this.getSheetId(),selections:[{range:n.getRange(),primary:a.getPrimaryForRange(this.getRange(),this._worksheet),style:null}]};return this._commandService.syncExecuteCommand(a.SetSelectionsOperation.id,i),this}return this.activate()}else throw new Error("The range is not a single cell")}splitTextToColumns(r,e,t){this._commandService.syncExecuteCommand(a.SplitTextToColumnsCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,delimiter:e,customDelimiter:t,treatMultipleDelimitersAsOne:r})}useThemeStyle(r){if(r==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:r})}removeThemeStyle(r){this._commandService.syncExecuteCommand(a.DeleteWorksheetRangeThemeStyleCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,themeName:r})}getUsedThemeStyle(){return this._injector.get(a.SheetRangeThemeService).getAppliedRangeThemeStyle({unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range})}clear(r){return r&&r.contentsOnly&&!r.formatOnly?this.clearContent():r&&r.formatOnly&&!r.contentsOnly?this.clearFormat():(this._commandService.syncExecuteCommand(a.ClearSelectionAllCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),ranges:[this._range],options:r}),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(r){r===s.Dimension.ROWS?this._commandService.executeCommand(a.InsertRangeMoveDownCommand.id,{range:this._range}):this._commandService.executeCommand(a.InsertRangeMoveRightCommand.id,{range:this._range})}deleteCells(r){r===s.Dimension.ROWS?this._commandService.executeCommand(a.DeleteRangeMoveUpCommand.id,{range:this._range}):this._commandService.executeCommand(a.DeleteRangeMoveLeftCommand.id,{range:this._range})}getDataRegion(r){const{startRow:e,startColumn:t,endRow:n,endColumn:i}=this._range,o=this._worksheet.getMaxRows(),h=this._worksheet.getMaxColumns(),d=this._worksheet.getCellMatrix();let l=e,m=t,g=n,C=i;if(r!==s.Dimension.COLUMNS){let S=!1,R=!1;for(let v=t;v<=i&&(e>0&&!s.isNullCell(d.getValue(e-1,v))&&(S=!0),n<o-1&&!s.isNullCell(d.getValue(n+1,v))&&(R=!0),!(S&&R));v++);S&&(l=e-1),R&&(g=n+1)}if(r!==s.Dimension.ROWS){let S=!1,R=!1;for(let v=e;v<=n&&(t>0&&!s.isNullCell(d.getValue(v,t-1))&&(S=!0),i<h-1&&!s.isNullCell(d.getValue(v,i+1))&&(R=!0),!(S&&R));v++);S&&(m=t-1),R&&(C=i+1)}return this._injector.createInstance(u.FRange,this._workbook,this._worksheet,{startRow:l,startColumn:m,endRow:g,endColumn:C})}isBlank(){const r=this._worksheet.getCellMatrix(),{startRow:e,startColumn:t,endRow:n,endColumn:i}=this._range;let o=!0;for(let h=e;h<=n;h++){for(let d=t;d<=i;d++)if(!s.isNullCell(r.getValue(h,d))){o=!1;break}if(!o)break}return o}offset(r,e,t,n){const{startRow:i,startColumn:o,endRow:h,endColumn:d}=this._range,l=i+r,m=o+e,g=t?l+t-1:h+r,C=n?m+n-1:d+e;if(l<0||m<0||g<0||C<0)throw new Error("The row or column index is out of range");return this._injector.createInstance(u.FRange,this._workbook,this._worksheet,{startRow:l,startColumn:m,endRow:g,endColumn:C})}setFormula(r){return this.setValue({f:r})}setFormulas(r){return this.setValues(r.map(e=>e.map(t=>({f:t}))))}},u.FRange=L([N(3,s.Inject(s.Injector)),N(4,s.ICommandService),N(5,s.Inject(I.FormulaDataModel))],u.FRange);var z=Object.getOwnPropertyDescriptor,G=(c,r,e,t)=>{for(var n=t>1?void 0:t?z(r,e):r,i=c.length-1,o;i>=0;i--)(o=c[i])&&(n=o(n)||n);return n},$=(c,r)=>(e,t)=>r(e,t,c);u.FSelection=class{constructor(r,e,t,n){this._workbook=r,this._worksheet=e,this._selections=t,this._injector=n}getActiveRange(){const r=this._selections.find(e=>!!e.primary);return r?this._injector.createInstance(u.FRange,this._workbook,this._worksheet,r.range):null}getActiveRangeList(){return this._selections.map(r=>this._injector.createInstance(u.FRange,this._workbook,this._worksheet,r.range))}getCurrentCell(){const r=this._selections.find(e=>!!e.primary);return r?r.primary:null}getActiveSheet(){const r=this._injector.createInstance(u.FWorkbook,this._workbook);return this._injector.createInstance(u.FWorksheet,r,this._workbook,this._worksheet)}updatePrimaryCell(r){const e=this._injector.get(s.ICommandService);let t=[],n=!1;for(const{range:o,style:h}of this._selections)s.Rectangle.contains(o,r.getRange())?(t.push({range:o,primary:a.getPrimaryForRange(r.getRange(),this._worksheet),style:h}),n=!0):t.push({range:o,primary:null,style:h});n||(t=[{range:r.getRange(),primary:a.getPrimaryForRange(r.getRange(),this._worksheet)}]);const i={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),selections:t};return e.syncExecuteCommand(a.SetSelectionsOperation.id,i),new u.FSelection(this._workbook,this._worksheet,t,this._injector)}getNextDataRange(r){if(!this._selections.find(n=>!!n.primary))return null;const t=a.getNextPrimaryCell(this._selections.concat(),r,this._worksheet);return t?this._injector.createInstance(u.FRange,this._workbook,this._worksheet,t):null}},u.FSelection=G([$(3,s.Inject(s.Injector))],u.FSelection);var Y=Object.getOwnPropertyDescriptor,K=(c,r,e,t)=>{for(var n=t>1?void 0:t?Y(r,e):r,i=c.length-1,o;i>=0;i--)(o=c[i])&&(n=o(n)||n);return n},p=(c,r)=>(e,t)=>r(e,t,c);u.FWorksheet=class extends _.FBaseInitialable{constructor(e,t,n,i,o,h,d){super(i);b(this,"setActiveSelection",this.setActiveRange);this._fWorkbook=e,this._workbook=t,this._worksheet=n,this._injector=i,this._selectionManagerService=o,this._logService=h,this._commandService=d}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(u.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(),n=this._worksheet.getSheetId();return this._commandService.syncExecuteCommand(a.SetWorksheetDefaultStyleMutation.id,{unitId:t,subUnitId:n,defaultStyle:e}),this._worksheet.setDefaultCellStyle(e),this}setColumnDefaultStyle(e,t){const n=this._workbook.getUnitId(),i=this._worksheet.getSheetId(),o={unitId:n,subUnitId:i,columnData:{[e]:{s:t}}};return this._commandService.syncExecuteCommand(a.SetColDataCommand.id,o),this}setRowDefaultStyle(e,t){const n=this._workbook.getUnitId(),i=this._worksheet.getSheetId(),o={unitId:n,subUnitId:i,rowData:{[e]:{s:t}}};return this._commandService.syncExecuteCommand(a.SetRowDataCommand.id,o),this}getRange(e,t,n,i){let o,h;if(typeof e=="object")o=e,h=this._worksheet;else if(typeof e=="string"){const{range:d,sheetName:l}=I.deserializeRangeWithSheet(e),m=l?this._workbook.getSheetBySheetName(l):this._worksheet;if(!m)throw new Error("Range not found");h=m,o={...d,unitId:this._workbook.getUnitId(),sheetId:h.getSheetId(),rangeType:s.RANGE_TYPE.NORMAL,startRow:d.rangeType===s.RANGE_TYPE.COLUMN?0:d.startRow,endRow:d.rangeType===s.RANGE_TYPE.COLUMN?h.getMaxRows()-1:d.endRow,startColumn:d.rangeType===s.RANGE_TYPE.ROW?0:d.startColumn,endColumn:d.rangeType===s.RANGE_TYPE.ROW?h.getMaxColumns()-1:d.endColumn}}else if(typeof e=="number"&&t!==void 0)h=this._worksheet,o={startRow:e,endRow:e+(n!=null?n:1)-1,startColumn:t,endColumn:t+(i!=null?i:1)-1,unitId:this._workbook.getUnitId(),sheetId:this._worksheet.getSheetId()};else throw new Error("Invalid range specification");return this._injector.createInstance(u.FRange,this._workbook,h,o)}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 n=this._workbook.getUnitId(),i=this._worksheet.getSheetId(),o=s.Direction.DOWN,h=e+1,d=e+t,l=0,m=this._worksheet.getColumnCount()-1,g=a.copyRangeStyles(this._worksheet,h,d,l,m,!0,e);return this._commandService.syncExecuteCommand(a.InsertRowByRangeCommand.id,{unitId:n,subUnitId:i,direction:o,range:{startRow:h,endRow:d,startColumn:l,endColumn:m},cellValue:g}),this}insertRowsBefore(e,t){const n=this._workbook.getUnitId(),i=this._worksheet.getSheetId(),o=s.Direction.UP,h=e,d=e+t-1,l=0,m=this._worksheet.getColumnCount()-1,g=a.copyRangeStyles(this._worksheet,h,d,l,m,!0,e-1);return this._commandService.syncExecuteCommand(a.InsertRowByRangeCommand.id,{unitId:n,subUnitId:i,direction:o,range:{startRow:h,endRow:d,startColumn:l,endColumn:m},cellValue:g}),this}deleteRow(e){return this.deleteRows(e,1)}deleteRows(e,t){const n={startRow:e,endRow:e+t-1,startColumn:0,endColumn:this._worksheet.getColumnCount()-1};return this._commandService.syncExecuteCommand(a.RemoveRowByRangeCommand.id,{range:n,unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId()}),this}moveRows(e,t){const n=this._workbook.getUnitId(),i=this._worksheet.getSheetId(),o=U(e.getRange(),this._worksheet),h=o,d={startRow:t,endRow:t,startColumn:o.startColumn,endColumn:o.endColumn};return this._commandService.syncExecuteCommand(a.MoveRowsCommand.id,{unitId:n,subUnitId:i,range:o,fromRange:h,toRange:d}),this}hideRow(e){const t=this._workbook.getUnitId(),n=this._worksheet.getSheetId(),i=U(e.getRange(),this._worksheet);return this._commandService.syncExecuteCommand(a.SetRowHiddenCommand.id,{unitId:t,subUnitId:n,ranges:[i]}),this}hideRows(e,t=1){const n=this._workbook.getUnitId(),i=this._worksheet.getSheetId(),o={startRow:e,endRow:e+t-1,startColumn:0,endColumn:this._worksheet.getColumnCount()-1,rangeType:s.RANGE_TYPE.ROW};return this._commandService.syncExecuteCommand(a.SetRowHiddenCommand.id,{unitId:n,subUnitId:i,ranges:[o]}),this}unhideRow(e){const t=this._workbook.getUnitId(),n=this._worksheet.getSheetId(),i=U(e.getRange(),this._worksheet);return this._commandService.syncExecuteCommand(a.SetSpecificRowsVisibleCommand.id,{unitId:t,subUnitId:n,ranges:[i]}),this}showRows(e,t=1){const n=this._workbook.getUnitId(),i=this._worksheet.getSheetId(),o={startRow:e,endRow:e+t-1,startColumn:0,endColumn:this._worksheet.getColumnCount()-1,rangeType:s.RANGE_TYPE.ROW};return this._commandService.syncExecuteCommand(a.SetSpecificRowsVisibleCommand.id,{unitId:n,subUnitId:i,ranges:[o]}),this}setRowHeight(e,t){return this.setRowHeights(e,1,t)}autoFitRow(e,t=s.BooleanNumber.TRUE){const n=this._workbook.getUnitId(),i=this._worksheet.getSheetId(),o=[{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:o[0],value:s.WrapStrategy.WRAP}),this._commandService.syncExecuteCommand(a.SetWorksheetRowIsAutoHeightMutation.id,{unitId:n,subUnitId:i,ranges:o,autoHeightInfo:t}),this}setRowHeights(e,t,n){var m;const i=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),h=this._worksheet.getRowManager(),d=[],l=[];for(let g=e;g<e+t;g++){const C=((m=h.getRow(g))==null?void 0:m.ah)||this._worksheet.getConfig().defaultRowHeight,S={startRow:g,endRow:g,startColumn:0,endColumn:this._worksheet.getColumnCount()-1};n<=C?d.push(S):l.push(S)}return l.length>0&&this._commandService.syncExecuteCommand(a.SetRowHeightCommand.id,{unitId:i,subUnitId:o,ranges:l,value:n}),d.length>0&&this._commandService.syncExecuteCommand(a.SetWorksheetRowIsAutoHeightCommand.id,{unitId:i,subUnitId:o,ranges:d}),this}getRowHeight(e){return this._worksheet.getRowHeight(e)}setRowAutoHeight(e,t){const n=this._workbook.getUnitId(),i=this._worksheet.getSheetId(),o=[{startRow:e,endRow:e+t-1,startColumn:0,endColumn:this._worksheet.getColumnCount()-1}];return this._commandService.syncExecuteCommand(a.SetWorksheetRowIsAutoHeightCommand.id,{unitId:n,subUnitId:i,ranges:o}),this}setRangesAutoHeight(e){const t=this._workbook.getUnitId(),n=this._worksheet.getSheetId();return this._commandService.syncExecuteCommand(a.SetWorksheetRowIsAutoHeightCommand.id,{unitId:t,subUnitId:n,ranges:e}),this}setRowHeightsForced(e,t,n){const i=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),h=[{startRow:e,endRow:e+t-1,startColumn:0,endColumn:this._worksheet.getColumnCount()-1}];return this._commandService.syncExecuteCommand(a.SetRowHeightCommand.id,{unitId:i,subUnitId:o,ranges:h,value:n}),this}setRowCustom(e){const t=this._workbook.getUnitId(),n=this._worksheet.getSheetId(),i={};for(const[h,d]of Object.entries(e))i[Number(h)]={custom:d};const o={unitId:t,subUnitId:n,rowData:i};return this._commandService.syncExecuteCommand(a.SetRowDataCommand.id,o),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 n=this._workbook.getUnitId(),i=this._worksheet.getSheetId(),o=s.Direction.RIGHT,h=0,d=this._worksheet.getRowCount()-1,l=e+1,m=e+t,g=a.copyRangeStyles(this._worksheet,h,d,l,m,!1,e);return this._commandService.syncExecuteCommand(a.InsertColByRangeCommand.id,{unitId:n,subUnitId:i,direction:o,range:{startRow:h,endRow:d,startColumn:l,endColumn:m},cellValue:g}),this}insertColumnsBefore(e,t){const n=this._workbook.getUnitId(),i=this._worksheet.getSheetId(),o=s.Direction.LEFT,h=0,d=this._worksheet.getRowCount()-1,l=e,m=e+t-1,g=a.copyRangeStyles(this._worksheet,h,d,l,m,!1,e-1);return this._commandService.syncExecuteCommand(a.InsertColByRangeCommand.id,{unitId:n,subUnitId:i,direction:o,range:{startRow:h,endRow:d,startColumn:l,endColumn:m},cellValue:g}),this}deleteColumn(e){return this.deleteColumns(e,1)}deleteColumns(e,t){const n={startRow:0,endRow:this._worksheet.getRowCount()-1,startColumn:e,endColumn:e+t-1};return this._commandService.syncExecuteCommand(a.RemoveColByRangeCommand.id,{range:n,unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId()}),this}moveColumns(e,t){const n=this._workbook.getUnitId(),i=this._worksheet.getSheetId(),o=P(e.getRange(),this._worksheet),h=o,d={startRow:0,endRow:this._worksheet.getRowCount()-1,startColumn:t,endColumn:t};return this._commandService.syncExecuteCommand(a.MoveColsCommand.id,{unitId:n,subUnitId:i,range:o,fromRange:h,toRange:d}),this}hideColumn(e){const t=this._workbook.getUnitId(),n=this._worksheet.getSheetId(),i=P(e.getRange(),this._worksheet);return this._commandService.syncExecuteCommand(a.SetColHiddenCommand.id,{unitId:t,subUnitId:n,ranges:[i]}),this}hideColumns(e,t=1){const n=this._workbook.getUnitId(),i=this._worksheet.getSheetId(),o={startRow:0,endRow:this._worksheet.getRowCount()-1,startColumn:e,endColumn:e+t-1,rangeType:s.RANGE_TYPE.COLUMN};return this._commandService.syncExecuteCommand(a.SetColHiddenCommand.id,{unitId:n,subUnitId:i,ranges:[o]}),this}unhideColumn(e){const t=this._workbook.getUnitId(),n=this._worksheet.getSheetId(),i=P(e.getRange(),this._worksheet);return this._commandService.syncExecuteCommand(a.SetSpecificColsVisibleCommand.id,{unitId:t,subUnitId:n,ranges:[i]}),this}showColumns(e,t=1){const n=this._workbook.getUnitId(),i=this._worksheet.getSheetId(),o={startRow:0,endRow:this._worksheet.getRowCount()-1,startColumn:e,endColumn:e+t-1,rangeType:s.RANGE_TYPE.COLUMN};return this._commandService.syncExecuteCommand(a.SetSpecificColsVisibleCommand.id,{unitId:n,subUnitId:i,ranges:[o]}),this}setColumnWidth(e,t){return this.setColumnWidths(e,1,t)}setColumnWidths(e,t,n){const i=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),h=[{startColumn:e,endColumn:e+t-1,startRow:0,endRow:this._worksheet.getRowCount()-1}];return this._commandService.syncExecuteCommand(a.SetColWidthCommand.id,{unitId:i,subUnitId:o,ranges:h,value:n}),this}getColumnWidth(e){return this._worksheet.getColumnWidth(e)}setColumnCustom(e){const t=this._workbook.getUnitId(),n=this._worksheet.getSheetId(),i={};for(const[h,d]of Object.entries(e))i[Number(h)]={custom:d};const o={unitId:t,subUnitId:n,columnData:i};return this._commandService.syncExecuteCommand(a.SetColDataCommand.id,o),this}getMergeData(){return this._worksheet.getMergeData().map(e=>this._injector.createInstance(u.FRange,this._workbook,this._worksheet,e))}getMergedRanges(){return this._worksheet.getSnapshot().mergeData.map(t=>this._injector.createInstance(u.FRange,this._workbook,this._worksheet,t))}getCellMergeData(e,t){const i=this._worksheet.getMergedCell(e,t);if(i)return this._injector.createInstance(u.FRange,this._workbook,this._worksheet,i)}getActiveRange(){return this._fWorkbook.getActiveRange()}setActiveRange(e){const{unitId:t,sheetId:n}=e.getRange();if(t!==this._workbook.getUnitId()||n!==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 n=e[0];this.setFreeze({...t,startColumn:n>0?n:-1,xSplit:n})}else if(arguments.length===2){let[n=0,i=0]=e;n>i&&([n,i]=[i,n]),this._commandService.syncExecuteCommand(a.SetFrozenCommand.id,{startColumn:i+1,xSplit:i-n+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 n=e[0];this.setFreeze({...t,startRow:n>0?n:-1,ySplit:n})}else if(arguments.length===2){let[n=0,i=0]=e;n>i&&([n,i]=[i,n]),this._commandService.syncExecuteCommand(a.SetFrozenCommand.id,{startRow:i+1,ySplit:i-n+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===s.BooleanNumber.FALSE}setHiddenGridlines(e){return this._commandService.syncExecuteCommand(a.ToggleGridlinesCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),showGridlines:e?s.BooleanNumber.FALSE:s.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(s.ICommandService).onCommandExecuted(n=>{if(n.id===a.SetRangeValuesMutation.id){const i=n.params;i.unitId===this._workbook.getUnitId()&&i.subUnitId===this._worksheet.getSheetId()&&i.cellValue&&e(new s.ObjectMatrix(i.cellValue))}})}onBeforeCellDataChange(e){return this._injector.get(s.ICommandService).beforeCommandExecuted(n=>{if(n.id===a.SetRangeValuesMutation.id){const i=n.params;i.unitId===this._workbook.getUnitId()&&i.subUnitId===this._worksheet.getSheetId()&&i.cellValue&&e(new s.ObjectMatrix(i.cellValue))}})}hideSheet(){const e=this._injector.get(s.ICommandService);if(this._workbook.getSheets().filter(o=>o.isSheetHidden()!==s.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(s.ICommandService).syncExecuteCommand(a.SetWorksheetShowCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId()}),this}isSheetHidden(){return this._worksheet.isSheetHidden()===s.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(),n=this._worksheet.getSheetId(),i=this._injector.get(s.ICommandService),o={startRow:0,endRow:this._worksheet.getRowCount()-1,startColumn:0,endColumn:this._worksheet.getColumnCount()-1};return i.syncExecuteCommand(a.ClearSelectionAllCommand.id,{unitId:t,subUnitId:n,ranges:[o],options:e}),this}clearContents(){const e=this._workbook.getUnitId(),t=this._worksheet.getSheetId(),n=this._injector.get(s.ICommandService),i={startRow:0,endRow:this._worksheet.getRowCount()-1,startColumn:0,endColumn:this._worksheet.getColumnCount()-1};return n.syncExecuteCommand(a.ClearSelectionContentCommand.id,{unitId:e,subUnitId:t,ranges:[i]}),this}clearFormats(){const e=this._workbook.getUnitId(),t=this._worksheet.getSheetId(),n=this._injector.get(s.ICommandService),i={startRow:0,endRow:this._worksheet.getRowCount()-1,startColumn:0,endColumn:this._worksheet.getColumnCount()-1};return n.syncExecuteCommand(a.ClearSelectionFormatCommand.id,{unitId:e,subUnitId:t,ranges:[i]}),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 u.FWorksheet?this._worksheet.getSheetId()===e.getSheetId()&&this._workbook.getUnitId()===e.getWorkbook().getUnitId():!1}insertDefinedName(e,t){const i=this._injector.createInstance(E).setName(e).setRef(t).build();i.localSheetId=this.getSheetId(),this._fWorkbook.insertDefinedNameBuilder(i)}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(),n=this._worksheet.getLastRowWithContent(),i=this._worksheet.getRowCount(),o=this._worksheet.getColumnCount(),h=t?n+1:n,d=new s.ObjectMatrix;for(let l=0;l<e.length;l++)d.setValue(h,l,s.covertCellValue(e[l]));return this._commandService.syncExecuteCommand(a.AppendRowCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),cellValue:d.getMatrix(),insertRowNums:h>i-1?1:0,insertColumnNums:e.length>o?e.length-o:0,maxRows:i,maxColumns:o}),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}},u.FWorksheet=K([p(3,s.Inject(s.Injector)),p(4,s.Inject(a.SheetsSelectionsService)),p(5,s.Inject(s.ILogService)),p(6,s.ICommandService)],u.FWorksheet);var q=Object.getOwnPropertyDescriptor,J=(c,r,e,t)=>{for(var n=t>1?void 0:t?q(r,e):r,i=c.length-1,o;i>=0;i--)(o=c[i])&&(n=o(n)||n);return n},w=(c,r)=>(e,t)=>r(e,t,c);u.FWorkbook=class extends _.FBaseInitialable{constructor(e,t,n,i,o,h,d,l,m,g){super(t);b(this,"id");this._workbook=e,this._injector=t,this._resourceLoaderService=n,this._selectionManagerService=i,this._univerInstanceService=o,this._commandService=h,this._permissionService=d,this._logService=l,this._localeService=m,this._definedNamesService=g,this.id=this._workbook.getUnitId()}getWorkbook(){return this._workbook}getId(){return this.id}getName(){return this._workbook.name}setName(e){this._workbook.setName(e)}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(u.FWorksheet,this,this._workbook,e)}getSheets(){return this._workbook.getSheets().map(e=>this._injector.createInstance(u.FWorksheet,this,this._workbook,e))}create(e,t,n,i){var l,m,g;const o=s.mergeWorksheetSnapshotWithDefault(s.Tools.deepClone((l=i==null?void 0:i.sheet)!=null?l:{}));o.name=e,o.rowCount=t,o.columnCount=n,o.id=(m=i==null?void 0:i.sheet)==null?void 0:m.id;const h=(g=i==null?void 0:i.index)!=null?g:this._workbook.getSheets().length;this._commandService.syncExecuteCommand(a.InsertSheetCommand.id,{unitId:this.id,index:h,sheet:o}),this._commandService.syncExecuteCommand(a.SetWorksheetActiveOperation.id,{unitId:this.id,subUnitId:this._workbook.getSheets()[h].getSheetId()});const d=this._workbook.getActiveSheet();if(!d)throw new Error("No active sheet found");return this._injector.createInstance(u.FWorksheet,this,this._workbook,d)}getSheetBySheetId(e){const t=this._workbook.getSheetBySheetId(e);return t?this._injector.createInstance(u.FWorksheet,this,this._workbook,t):null}getSheetByName(e){const t=this._workbook.getSheetBySheetName(e);return t?this._injector.createInstance(u.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 h,d,l;const n=s.mergeWorksheetSnapshotWithDefault(s.Tools.deepClone((h=t==null?void 0:t.sheet)!=null?h:{}));n.name=e,n.id=(d=t==null?void 0:t.sheet)==null?void 0:d.id;const i=(l=t==null?void 0:t.index)!=null?l:this._workbook.getSheets().length;this._commandService.syncExecuteCommand(a.InsertSheetCommand.id,{unitId:this.id,index:i,sheet:n}),this._commandService.syncExecuteCommand(a.SetWorksheetActiveOperation.id,{unitId:this.id,subUnitId:this._workbook.getSheets()[i].getSheetId()});const o=this._workbook.getActiveSheet();if(!o)throw new Error("No active sheet found");return this._injector.createInstance(u.FWorksheet,this,this._workbook,o)}deleteSheet(e){const t=this.id,n=typeof e=="string"?e:e.getSheetId();return this._commandService.syncExecuteCommand(a.RemoveSheetCommand.id,{unitId:t,subUnitId:n})}undo(){return this._univerInstanceService.focusUnit(this.id),this._commandService.syncExecuteCommand(s.UndoCommand.id),this}redo(){return this._univerInstanceService.focusUnit(this.id),this._commandService.syncExecuteCommand(s.RedoCommand.id),this}onBeforeCommandExecute(e){return this._commandService.beforeCommandExecuted(t=>{var n;((n=t.params)==null?void 0:n.unitId)===this.id&&e(t)})}onCommandExecuted(e){return this._commandService.onCommandExecuted(t=>{var n;((n=t.params)==null?void 0:n.unitId)===this.id&&e(t)})}onSelectionChange(e){return s.toDisposable(this._selectionManagerService.selectionMoveEnd$.subscribe(t=>{this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET).getUnitId()===this.id&&(t!=null&&t.length?e(t.map(n=>n.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(),n=e.getRange().sheetId||t.getSheetId(),i=n?this._workbook.getSheetBySheetId(n):this._workbook.getActiveSheet(!0);if(!i)throw new Error("No active sheet found");i.getSheetId()!==t.getSheetId()&&this.setActiveSheet(this._injector.createInstance(u.FWorksheet,this,this._workbook,i));const o={unitId:this.getId(),subUnitId:n,selections:[e].map(h=>({range:h.getRange(),primary:a.getPrimaryForRange(h.getRange(),i),style:null}))};return this._commandService.syncExecuteCommand(a.SetSelectionsOperation.id,o),this}getActiveRange(){const e=this._workbook.getActiveSheet(),n=this._selectionManagerService.getCurrentSelections().find(i=>!!i.primary);return n?this._injector.createInstance(u.FRange,this._workbook,e,n.range):null}getActiveCell(){const e=this._workbook.getActiveSheet(),n=this._selectionManagerService.getCurrentSelections().find(o=>!!o.primary);if(!n)return null;const i={...n.primary,rangeType:s.RANGE_TYPE.NORMAL};return this._injector.createInstance(u.FRange,this._workbook,e,i)}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(u.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 n=t;return n<0?n=0:n>this._workbook.getSheets().length-1&&(n=this._workbook.getSheets().length-1),this._commandService.syncExecuteCommand(a.SetWorksheetOrderCommand.id,{unitId:e.getWorkbook().getUnitId(),order:n,subUnitId:e.getSheetId()}),this}moveActiveSheet(e){const t=this.getActiveSheet();return this.moveSheet(t,e)}getPermission(){return this._injector.createInstance(u.FPermission)}getDefinedName(e){const t=this._definedNamesService.getValueByName(this.id,e);return t?this._injector.createInstance(y,{...t,unitId:this.id}):null}getDefinedNames(){const e=this._definedNamesService.getDefinedNameMap(this.id);return e?Object.values(e).map(t=>this._injector.createInstance(y,{...t,unitId:this.id})):[]}insertDefinedName(e,t){const i=this._injector.createInstance(E).setName(e).setRef(t).build();return i.localSheetId=a.SCOPE_WORKBOOK_VALUE_DEFINED_NAME,this.insertDefinedNameBuilder(i),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()}},u.FWorkbook=J([w(1,s.Inject(s.Injector)),w(2,s.Inject(s.IResourceLoaderService)),w(3,s.Inject(a.SheetsSelectionsService)),w(4,s.IUniverInstanceService),w(5,s.ICommandService),w(6,s.IPermissionService),w(7,s.ILogService),w(8,s.Inject(s.LocaleService)),w(9,I.IDefinedNamesService)],u.FWorkbook);class Q extends _.FUniver{getCommandSheetTarget(r){var i;const e=r.params;if(!e)return this.getActiveSheet();const t=e.unitId?this.getUniverSheet(e.unitId):(i=this.getActiveWorkbook)==null?void 0:i.call(this);if(!t)return;const n=t.getSheetBySheetId(e.subUnitId||e.sheetId)||t.getActiveSheet();if(n)return{workbook:t,worksheet:n}}getSheetTarget(r,e){const t=this.getUniverSheet(r);if(!t)return;const n=t.getSheetBySheetId(e);if(n)return{workbook:t,worksheet:n}}_initWorkbookEvent(r){const e=r.get(s.IUniverInstanceService);this.registerEventHandler(this.Event.WorkbookDisposed,()=>e.unitDisposed$.subscribe(t=>{t.type===s.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===s.UniverInstanceType.UNIVER_SHEET){const n=t,i=r.createInstance(u.FWorkbook,n);this.fireEvent(this.Event.WorkbookCreated,{unitId:t.getUnitId(),type:t.type,workbook:i,unit:i})}}))}_initialize(r){const e=r.get(s.ICommandService);this.registerEventHandler(this.Event.BeforeSheetCreate,()=>e.beforeCommandExecuted(t=>{var n;if(t.id===a.InsertSheetCommand.id){const i=t.params,{unitId:o,index:h,sheet:d}=i||{},l=o?this.getUniverSheet(o):(n=this.getActiveWorkbook)==null?void 0:n.call(this);if(!l)return;const m={workbook:l,index:h,sheet:d};if(this.fireEvent(this.Event.BeforeSheetCreate,m),m.cancel)throw new s.CanceledError}})),this.registerEventHandler(this.Event.BeforeActiveSheetChange,()=>e.beforeCommandExecuted(t=>{var n;if(t.id===a.SetWorksheetActiveOperation.id){const{subUnitId:i,unitId:o}=t.params,h=o?this.getUniverSheet(o):(n=this.getActiveWorkbook)==null?void 0:n.call(this);if(!h||!i)return;const d=h.getSheetBySheetId(i),l=h.getActiveSheet();if(!d||!l)return;const m={workbook:h,activeSheet:d,oldActiveSheet:l};if(this.fireEvent(this.Event.BeforeActiveSheetChange,m),m.cancel)throw new s.CanceledError}})),this.registerEventHandler(this.Event.BeforeSheetDelete,()=>e.beforeCommandExecuted(t=>{if(t.id===a.RemoveSheetCommand.id){const n=this.getCommandSheetTarget(t);if(!n)return;const{workbook:i,worksheet:o}=n,h={workbook:i,worksheet:o};if(this.fireEvent(this.Event.BeforeSheetDelete,h),h.cancel)throw new s.CanceledError}})),this.registerEventHandler(this.Event.BeforeSheetMove,()=>e.beforeCommandExecuted(t=>{if(t.id===a.SetWorksheetOrderMutation.id){const{fromOrder:n,toOrder:i}=t.params,o=this.getCommandSheetTarget(t);if(!o)return;const h={workbook:o.workbook,worksheet:o.worksheet,newIndex:i,oldIndex:n};if(this.fireEvent(this.Event.BeforeSheetMove,h),h.cancel)throw new s.CanceledError}})),this.registerEventHandler(this.Event.BeforeSheetNameChange,()=>e.beforeCommandExecuted(t=>{if(t.id===a.SetWorksheetNameCommand.id){const{name:n}=t.params,i=this.getCommandSheetTarget(t);if(!i)return;const o={workbook:i.workbook,worksheet:i.worksheet,newName:n,oldName:i.worksheet.getSheetName()};if(this.fireEvent(this.Event.BeforeSheetNameChange,o),o.cancel)throw new s.CanceledError}})),this.registerEventHandler(this.Event.BeforeSheetTabColorChange,()=>e.beforeCommandExecuted(t=>{if(t.id===a.SetTabColorMutation.id){const{color:n}=t.params,i=this.getCommandSheetTarget(t);if(!i)return;const o={workbook:i.workbook,worksheet:i.worksheet,newColor:n,oldColor:i.worksheet.getTabColor()};if(this.fireEvent(this.Event.BeforeSheetTabColorChange,o),o.cancel)throw new s.CanceledError}})),this.registerEventHandler(this.Event.BeforeSheetHideChange,()=>e.beforeCommandExecuted(t=>{if(t.id===a.SetWorksheetHideMutation.id){const{hidden:n}=t.params,i=this.getCommandSheetTarget(t);if(!i)return;const o={workbook:i.workbook,worksheet:i.worksheet,hidden:!!n};if(this.fireEvent(this.Event.BeforeSheetHideChange,o),o.cancel)throw new s.CanceledError}})),this.registerEventHandler(this.Event.BeforeGridlineColorChange,()=>e.beforeCommandExecuted(t=>{var n;if(t.id===a.SetGridlinesColorCommand.id){const i=this.getCommandSheetTarget(t);if(!i)return;const o={...i,color:(n=t.params)==null?void 0:n.color};if(this.fireEvent(this.Event.BeforeGridlineColorChange,o),o.cancel)throw new s.CanceledError}})),this.registerEventHandler(this.Event.BeforeGridlineEnableChange,()=>e.beforeCommandExecuted(t=>{var n;if(t.id===a.ToggleGridlinesCommand.id){const i=this.getCommandSheetTarget(t);if(!i)return;const o={...i,enabled:!!((n=t.params)!=null&&n.showGridlines)};if(this.fireEvent(this.Event.BeforeGridlineEnableChange,o),o.cancel)throw new s.CanceledError}})),this.registerEventHandler(this.Event.SheetValueChanged,()=>e.onCommandExecuted(t=>{if(a.COMMAND_LISTENER_VALUE_CHANGE.indexOf(t.id)>-1){if(!this.getActiveSheet())return;const i=a.getValueChangedEffectedRange(t).map(o=>{var h,d;return(d=(h=this.getWorkbook(o.unitId))==null?void 0:h.getSheetBySheetId(o.subUnitId))==null?void 0:d.getRange(o.range)}).filter(Boolean);if(!i.length)return;this.fireEvent(this.Event.SheetValueChanged,{payload:t,effectedRanges:i})}})),this.registerEventHandler(this.Event.SheetCreated,()=>e.onCommandExecuted(t=>{var n;if(t.id===a.InsertSheetCommand.id){const i=t.params,{unitId:o}=i||{},h=o?this.getUniverSheet(o):(n=this.getActiveWorkbook)==null?void 0:n.call(this);if(!h)return;const d=h.getActiveSheet();if(!d)return;const l={workbook:h,worksheet:d};this.fireEvent(this.Event.SheetCreated,l)}})),this.registerEventHandler(this.Event.ActiveSheetChanged,()=>e.onCommandExecuted(t=>{if(t.id===a.SetWorksheetActiveOperation.id){const n=this.getActiveSheet();if(!n)return;const{workbook:i,worksheet:o}=n;this._fireActiveSheetChanged(i,o)}})),this.registerEventHandler(this.Event.SheetDeleted,()=>e.onCommandExecuted(t=>{var n;if(t.id===a.RemoveSheetCommand.id){const{subUnitId:i,unitId:o}=t.params,h=o?this.getUniverSheet(o):(n=this.getActiveWorkbook)==null?void 0:n.call(this);if(!h||!i)return;this._fireSheetDeleted(h,i)}})),this.registerEventHandler(this.Event.SheetMoved,()=>e.onCommandExecuted(t=>{if(t.id===a.SetWorksheetOrderMutation.id){const{toOrder:n}=t.params,i=this.getCommandSheetTarget(t);if(!i)return;this._fireSheetMoved(i.workbook,i.worksheet,n)}})),this.registerEventHandler(this.Event.SheetNameChanged,()=>e.onCommandExecuted(t=>{if(t.id===a.SetWorksheetNameCommand.id){const{name:n}=t.params,i=this.getCommandSheetTarget(t);if(!i)return;this._fireSheetNameChanged(i.workbook,i.worksheet,n)}})),this.registerEventHandler(this.Event.SheetTabColorChanged,()=>e.onCommandExecuted(t=>{if(t.id===a.SetTabColorMutation.id){const{color:n}=t.params,i=this.getCommandSheetTarget(t);if(!i)return;this._fireSheetTabColorChanged(i.workbook,i.worksheet,n)}})),this.registerEventHandler(this.Event.SheetHideChanged,()=>e.onCommandExecuted(t=>{if(t.id===a.SetWorksheetHideMutation.id){const{hidden:n}=t.params,i=this.getCommandSheetTarget(t);if(!i)return;this._fireSheetHideChanged(i.workbook,i.worksheet,!!n)}})),this.registerEventHandler(this.Event.GridlineChanged,()=>e.onCommandExecuted(t=>{if(t.id===a.SetGridlinesColorCommand.id||t.id===a.ToggleGridlinesCommand.id){const n=this.getCommandSheetTarget(t);if(!n)return;this.fireEvent(this.Event.GridlineChanged,{...n,enabled:!n.worksheet.hasHiddenGridLines(),color:n.worksheet.getGridLinesColor()})}})),this._initWorkbookEvent(r)}createUniverSheet(r,e){const n=this._injector.get(s.IUniverInstanceService).createUnit(s.UniverInstanceType.UNIVER_SHEET,r,e);return this._injector.createInstance(u.FWorkbook,n)}createWorkbook(r,e){return this.createUniverSheet(r,e)}getActiveWorkbook(){const r=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET);return r?this._injector.createInstance(u.FWorkbook,r):null}getActiveUniverSheet(){return this.getActiveWorkbook()}getUniverSheet(r){const e=this._univerInstanceService.getUnit(r,s.UniverInstanceType.UNIVER_SHEET);return e?this._injector.createInstance(u.FWorkbook,e):null}getWorkbook(r){return this.getUniverSheet(r)}getPermission(){return this._injector.createInstance(u.FPermission)}onUniverSheetCreated(r){const e=this._univerInstanceService.getTypeOfUnitAdded$(s.UniverInstanceType.UNIVER_SHEET).subscribe(t=>{const n=this._injector.createInstance(u.FWorkbook,t);r(n)});return s.toDisposable(e)}newDefinedName(){return this._injector.createInstance(E)}getActiveSheet(){const r=this.getActiveWorkbook();if(!r)return null;const e=r.getActiveSheet();return e?{workbook:r,worksheet:e}:null}_fireActiveSheetChanged(r,e){this.fireEvent(this.Event.ActiveSheetChanged,{workbook:r,activeSheet:e})}_fireSheetDeleted(r,e){this.fireEvent(this.Event.SheetDeleted,{workbook:r,sheetId:e})}_fireSheetMoved(r,e,t){this.fireEvent(this.Event.SheetMoved,{workbook:r,worksheet:e,newIndex:t})}_fireSheetNameChanged(r,e,t){this.fireEvent(this.Event.SheetNameChanged,{workbook:r,worksheet:e,newName:t})}_fireSheetTabColorChanged(r,e,t){this.fireEvent(this.Event.SheetTabColorChanged,{workbook:r,worksheet:e,newColor:t})}_fireSheetHideChanged(r,e,t){this.fireEvent(this.Event.SheetHideChanged,{workbook:r,worksheet:e,hidden:t})}}_.FUniver.extend(Q);class W{get SheetValueChangeType(){return a.SheetValueChangeType}get SheetSkeletonChangeType(){return a.SheetSkeletonChangeType}get SplitDelimiterType(){return a.SplitDelimiterEnum}}_.FEnum.extend(W);class M{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"}}_.FEventName.extend(M);var X=Object.getOwnPropertyDescriptor,Z=(c,r,e,t)=>{for(var n=t>1?void 0:t?X(r,e):r,i=c.length-1,o;i>=0;i--)(o=c[i])&&(n=o(n)||n);return n},ee=(c,r)=>(e,t)=>r(e,t,c);u.FSheetHooks=class extends _.FBase{constructor(r){super(),this._injector=r}},u.FSheetHooks=Z([ee(0,s.Inject(s.Injector))],u.FSheetHooks),u.FSheetEventName=M,u.FSheetsEnum=W,Object.defineProperty(u,Symbol.toStringTag,{value:"Module"})});
17
17
 
18
18
 
19
19
  // @univerjs/sheets-numfmt/index
20
- (function(a,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("@univerjs/core"),require("@univerjs/sheets"),require("@univerjs/engine-numfmt"),require("rxjs"),require("@univerjs/engine-formula")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets","@univerjs/engine-numfmt","rxjs","@univerjs/engine-formula"],t):(a=typeof globalThis<"u"?globalThis:a||self,t(a.UniverSheetsNumfmt={},a.UniverCore,a.UniverSheets,a.UniverEngineNumfmt,a.rxjs,a.UniverEngineFormula))})(this,function(a,t,o,A,I,J){"use strict";var de=Object.defineProperty;var ge=(a,t,o)=>t in a?de(a,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):a[t]=o;var R=(a,t,o)=>ge(a,typeof t!="symbol"?t+"":t,o);const O=["$","£","¥","¤","֏","؋","৳","฿","₡","₦","₩","₪","₫","€","₭","₮","₱","₲","₴","₸","₹","₺","₼","₽","₾","₿"],L={US:"$",CA:"C$",GB:"£",JP:"¥",IN:"₹",AU:"A$",CN:"¥",KR:"₩",RU:"₽",AT:"€",BE:"€",CY:"€",EE:"€",FI:"€",FR:"€",DE:"€",GR:"€",IE:"€",IT:"€",LV:"€",LT:"€",LU:"€",MT:"€",NL:"€",PT:"€",SK:"€",SI:"€",ES:"€"},G=[{label:"1930-08-05",suffix:"yyyy-MM-dd"},{label:"1930/08/05",suffix:"yyyy/MM/dd"},{label:"1930年08月05日",suffix:'yyyy"年"MM"月"dd"日"'},{label:"08-05",suffix:"MM-dd"},{label:"8月5日",suffix:'M"月"d"日"'},{label:"13:30:30",suffix:"h:mm:ss"},{label:"13:30",suffix:"h:mm"},{label:"下午01:30",suffix:"A/P hh:mm"},{label:"下午1:30",suffix:"A/P h:mm"},{label:"下午1:30:30",suffix:"A/P h:mm:ss"},{label:"08-05 下午 01:30",suffix:"MM-dd A/P hh:mm"}],x=[{label:"(1,235)",suffix:"#,##0_);(#,##0)"},{label:"(1,235) ",suffix:"#,##0_);[Red](#,##0)",color:"red"},{label:"1,234.56",suffix:"#,##0.00_);#,##0.00"},{label:"1,234.56",suffix:"#,##0.00_);[Red]#,##0.00",color:"red"},{label:"-1,234.56",suffix:"#,##0.00_);-#,##0.00"},{label:"-1,234.56",suffix:"#,##0.00_);[Red]-#,##0.00",color:"red"}],V=[{label:e=>`${e}1,235`,suffix:e=>`"${e}"#,##0.00_);"${e}"#,##0.00`},{label:e=>`${e}1,235`,suffix:e=>`"${e}"#,##0.00_);[Red]"${e}"#,##0.00`,color:"red"},{label:e=>`(${e}1,235)`,suffix:e=>`"${e}"#,##0.00_);("${e}"#,##0.00)`},{label:e=>`(${e}1,235)`,suffix:e=>`"${e}"#,##0.00_);[Red]("${e}"#,##0.00)`,color:"red"},{label:e=>`-${e}1,235`,suffix:e=>`"${e}"#,##0.00_);-"${e}"#,##0.00`},{label:e=>`-${e}1,235`,suffix:e=>`"${e}"#,##0.00_);[Red]-"${e}"#,##0.00`,color:"red"}],X="SHEET_NUMFMT_PLUGIN",E=(e,r=0)=>{var n;return e&&(n=t.numfmt.getFormatInfo(e).maxDecimals)!=null?n:r},D=e=>new Array(Math.min(Math.max(0,Number(e)),30)).fill(0).join(""),U=(e,r)=>e.split(";").map(n=>/\.0?/.test(n)?n.replace(/\.0*/g,`${r>0?".":""}${D(Number(r||0))}`):/0([^0]?)|0$/.test(n)?n.replace(/0([^0]+)|0$/,`0${r>0?".":""}${D(Number(r||0))}$1`):n).join(";"),Q=e=>/\.0?/.test(e)||/0([^0]?)|0$/.test(e),$={id:"sheet.command.numfmt.set.numfmt",type:t.CommandType.COMMAND,handler:(e,r)=>{if(!r)return!1;const i=e.get(t.ICommandService),n=e.get(t.IUniverInstanceService),s=e.get(t.IUndoRedoService),l=o.getSheetCommandTarget(n,r);if(!l)return!1;const{unitId:m,subUnitId:S,worksheet:d}=l,c=r.values.filter(u=>!!u.pattern),b=r.values.filter(u=>!u.pattern),M=o.transformCellsToRange(m,S,c),C={unitId:m,subUnitId:S,ranges:b.map(u=>({startColumn:u.col,startRow:u.row,endColumn:u.col,endRow:u.row}))},T=[],y=[];if(c.length){const u=c.reduce((g,f)=>{A.isTextFormat(f.pattern)&&g.setValue(f.row,f.col,{t:t.CellValueType.STRING});const _=d.getCellRaw(f.row,f.col);if(_){const P=o.checkCellValueType(_.v);P!==_.t&&g.setValue(f.row,f.col,{t:P})}return g},new t.ObjectMatrix).getMatrix(),h=new t.ObjectMatrix;new t.ObjectMatrix(u).forValue((g,f)=>{const _=d.getCellRaw(g,f);_?h.setValue(g,f,{t:_.t}):h.setValue(g,f,{t:void 0})}),Object.keys(M.values).forEach(g=>{const f=M.values[g];f.ranges=o.rangeMerge(f.ranges)}),T.push({id:o.SetNumfmtMutation.id,params:M});const p=o.factorySetNumfmtUndoMutation(e,M);y.push(...p)}if(b.length){C.ranges=o.rangeMerge(C.ranges);const u=b.reduce((g,f)=>{const _=d.getCellRaw(f.row,f.col);if(_){const P=o.checkCellValueType(_.v);P!==_.t&&g.setValue(f.row,f.col,{t:P})}return g},new t.ObjectMatrix).getMatrix(),h=new t.ObjectMatrix;new t.ObjectMatrix(u).forValue((g,f)=>{const _=d.getCellRaw(g,f);_?h.setValue(g,f,{t:_.t}):h.setValue(g,f,{t:void 0})}),T.push({id:o.RemoveNumfmtMutation.id,params:C},{id:o.SetRangeValuesMutation.id,params:{unitId:m,subUnitId:S,cellValue:u}});const p=o.factoryRemoveNumfmtUndoMutation(e,C);y.push({id:o.SetRangeValuesMutation.id,params:{unitId:m,subUnitId:S,cellValue:h.getMatrix()}},...p)}const v=t.sequenceExecute(T,i).result;return v&&s.pushUndoRedo({unitID:m,undoMutations:y,redoMutations:T}),v}},B={id:"sheet.command.numfmt.add.decimal.command",type:t.CommandType.COMMAND,handler:async e=>{const r=e.get(t.ICommandService),i=e.get(o.SheetsSelectionsService),n=e.get(o.INumfmtService),s=e.get(t.IUniverInstanceService),l=i.getCurrentSelections();if(!l||!l.length)return!1;const m=o.getSheetCommandTarget(s);if(!m)return!1;const{unitId:S,subUnitId:d}=m;let c=0;l.forEach(T=>{t.Range.foreach(T.range,(y,v)=>{const u=n.getValue(S,d,y,v);if(!u){const p=m.worksheet.getCellRaw(y,v);if(!c&&p&&p.t===t.CellValueType.NUMBER&&p.v){const g=/\.(\d*)$/.exec(String(p.v));if(g){const f=g[1].length;if(!f)return;c=Math.max(c,f)}}return}const h=E(u.pattern);c=h>c?h:c})});const b=c+1,M=U(`0${b>0?".0":""}`,b),C=[];return l.forEach(T=>{t.Range.foreach(T.range,(y,v)=>{const u=n.getValue(S,d,y,v);if(!u)C.push({row:y,col:v,pattern:M});else{const h=E(u.pattern),p=U(u.pattern,h+1);p!==u.pattern&&C.push({row:y,col:v,pattern:p})}})}),C.length?await r.executeCommand($.id,{values:C}):!1}};class j{constructor(){R(this,"_currencySymbol$",new I.BehaviorSubject("US"));R(this,"currencySymbol$",this._currencySymbol$.asObservable())}setCurrencySymbolByCountryCode(r){this._currencySymbol$.next(r)}getCurrencySymbol(){return this._currencySymbol$.getValue()}}const H={id:"sheet.command.numfmt.set.currency",type:t.CommandType.COMMAND,handler:async e=>{const r=e.get(t.ICommandService),i=e.get(o.SheetsSelectionsService),n=e.get(j),s=L[n.getCurrencySymbol()]||"$",l=i.getCurrentSelections();if(!l||!l.length)return!1;const m=[],S=V[4].suffix(s);return l.forEach(c=>{t.Range.foreach(c.range,(b,M)=>{m.push({row:b,col:M,pattern:S,type:"currency"})})}),await r.executeCommand($.id,{values:m})}},W={id:"sheet.command.numfmt.set.percent",type:t.CommandType.COMMAND,handler:async e=>{const r=e.get(t.ICommandService),n=e.get(o.SheetsSelectionsService).getCurrentSelections();if(!n||!n.length)return!1;const s=[],l="0%";return n.forEach(S=>{t.Range.foreach(S.range,(d,c)=>{s.push({row:d,col:c,pattern:l,type:"percent"})})}),await r.executeCommand($.id,{values:s})}},q={id:"sheet.command.numfmt.subtract.decimal.command",type:t.CommandType.COMMAND,handler:async e=>{const r=e.get(t.ICommandService),i=e.get(o.SheetsSelectionsService),n=e.get(o.INumfmtService),s=e.get(t.IUniverInstanceService),l=i.getCurrentSelections();if(!l||!l.length)return!1;const m=o.getSheetCommandTarget(s);if(!m)return!1;const{unitId:S,subUnitId:d}=m;let c=0;l.forEach(y=>{t.Range.foreach(y.range,(v,u)=>{const h=n.getValue(S,d,v,u);if(!h){const g=m.worksheet.getCellRaw(v,u);if(!c&&g&&g.t===t.CellValueType.NUMBER&&g.v){const f=/\.(\d*)$/.exec(String(g.v));if(f){const _=f[1].length;if(!_)return;c=Math.max(c,_)}}return}const p=E(h.pattern);c=p>c?p:c})});const b=c-1,M=U(`0${b>0?".0":"."}`,b),C=[];return l.forEach(y=>{t.Range.foreach(y.range,(v,u)=>{const h=n.getValue(S,d,v,u);if(!h)C.push({row:v,col:u,pattern:M});else{const p=E(h.pattern);C.push({row:v,col:u,pattern:U(h.pattern,p-1)})}})}),await r.executeCommand($.id,{values:C})}},w="sheets-numfmt.config",K={},ee=e=>t.numfmt.getFormatInfo(e).type||"unknown",Y=(e,r,i="en")=>{const n=t.numfmt.formatColor(e,r),s=n?String(n):void 0,l=t.numfmt.format(e,r,{locale:i,throws:!1});return r<0?{result:l,color:s}:{result:l}},k=(e,r,i)=>e==="General"?{result:String(J.stripErrorMargin(r))}:Y(e,r,i);var te=Object.getOwnPropertyDescriptor,ne=(e,r,i,n)=>{for(var s=n>1?void 0:n?te(r,i):r,l=e.length-1,m;l>=0;l--)(m=e[l])&&(s=m(s)||s);return s},N=(e,r)=>(i,n)=>r(i,n,e);const re={tl:{size:6,color:"#409f11"}};a.SheetsNumfmtCellContentController=class extends t.Disposable{constructor(i,n,s,l,m,S,d){super();R(this,"_local$",new I.BehaviorSubject("en"));R(this,"local$",this._local$.asObservable());this._instanceService=i,this._sheetInterceptorService=n,this._themeService=s,this._commandService=l,this._numfmtService=m,this._localeService=S,this._configService=d,this._initInterceptorCellContent()}get local(){const i=this._local$.getValue();if(i)return i;switch(this._localeService.getCurrentLocale()){case t.LocaleType.FR_FR:return"fr";case t.LocaleType.RU_RU:return"ru";case t.LocaleType.VI_VN:return"vi";case t.LocaleType.ZH_CN:return"zh-CN";case t.LocaleType.ZH_TW:return"zh-TW";case t.LocaleType.EN_US:case t.LocaleType.FA_IR:default:return"en"}}_initInterceptorCellContent(){const i=new t.ObjectMatrix;this.disposeWithMe(I.merge(this._local$,this._localeService.currentLocale$).subscribe(()=>{i.reset()})),this.disposeWithMe(this._sheetInterceptorService.intercept(o.INTERCEPTOR_POINT.CELL_CONTENT,{effect:t.InterceptorEffectEnum.Value|t.InterceptorEffectEnum.Style,handler:(n,s,l)=>{var y,v;const m=s.unitId,S=s.subUnitId;let d;const c=n;if(!c||c.v===void 0||c.v===null)return l(n);if(n!=null&&n.s){const u=s.workbook.getStyles().get(n.s);u!=null&&u.n&&(d=u.n)}if(d||(d=this._numfmtService.getValue(m,S,s.row,s.col)),!d||d.pattern==="General"||c.t!==t.CellValueType.NUMBER&&o.checkCellValueType(c.v)!==t.CellValueType.NUMBER)return l(n);if((!n||n===s.rawData)&&(n={...s.rawData}),A.isTextFormat(d.pattern))return(y=this._configService.getConfig(w))!=null&&y.disableTextFormatMark?(n.t=t.CellValueType.STRING,l(n)):(n.t=t.CellValueType.STRING,n.markers={...n==null?void 0:n.markers,...re},l(n));let b="";const M=i.getValue(s.row,s.col);if(M&&M.parameters===`${c.v}_${d.pattern}`)return l({...n,...M.result});const C=k(d.pattern,Number(c.v),this.local);if(b=C.result,!b)return l(n);const T={v:b,t:t.CellValueType.NUMBER};if(C.color){const u=(v=this._themeService.getColorFromTheme(`${C.color}.500`))!=null?v:C.color;u&&(T.interceptorStyle={cl:{rgb:u}})}return i.setValue(s.row,s.col,{result:T,parameters:`${c.v}_${d.pattern}`}),Object.assign(n,T),l(n)},priority:o.InterceptCellContentPriority.NUMFMT})),this.disposeWithMe(this._commandService.onCommandExecuted(n=>{if(n.id===o.SetNumfmtMutation.id){const s=n.params;Object.keys(s.values).forEach(l=>{s.values[l].ranges.forEach(S=>{t.Range.foreach(S,(d,c)=>{i.realDeleteValue(d,c)})})})}else if(n.id===o.SetRangeValuesMutation.id){const s=n.params;new t.ObjectMatrix(s.cellValue).forValue((l,m)=>{i.realDeleteValue(l,m)})}})),this.disposeWithMe(this._instanceService.getCurrentTypeOfUnit$(t.UniverInstanceType.UNIVER_SHEET).pipe(I.switchMap(n=>{var s;return(s=n==null?void 0:n.activeSheet$)!=null?s:I.of(null)}),I.skip(1)).subscribe(()=>i.reset()))}setNumfmtLocal(i){this._local$.next(i)}},a.SheetsNumfmtCellContentController=ne([N(0,t.IUniverInstanceService),N(1,t.Inject(o.SheetInterceptorService)),N(2,t.Inject(t.ThemeService)),N(3,t.Inject(t.ICommandService)),N(4,t.Inject(o.INumfmtService)),N(5,t.Inject(t.LocaleService)),N(6,t.IConfigService)],a.SheetsNumfmtCellContentController);class z extends t.Disposable{constructor(){super(...arguments);R(this,"_currencySymbol$",new I.BehaviorSubject("US"));R(this,"currencySymbol$",this._currencySymbol$.asObservable())}setCurrencySymbolByCountryCode(i){this._currencySymbol$.next(i)}getCurrencySymbol(){return this._currencySymbol$.getValue()}}var ae=Object.defineProperty,ie=Object.getOwnPropertyDescriptor,se=(e,r,i)=>r in e?ae(e,r,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[r]=i,le=(e,r,i,n)=>{for(var s=n>1?void 0:n?ie(r,i):r,l=e.length-1,m;l>=0;l--)(m=e[l])&&(s=m(s)||s);return s},F=(e,r)=>(i,n)=>r(i,n,e),Z=(e,r,i)=>se(e,typeof r!="symbol"?r+"":r,i);a.UniverSheetsNumfmtPlugin=class extends t.Plugin{constructor(r=K,i,n,s){super(),this._config=r,this._injector=i,this._configService=n,this._commandService=s;const{...l}=t.merge({},K,this._config);this._configService.setConfig(w,l)}onStarting(){t.registerDependencies(this._injector,[[a.SheetsNumfmtCellContentController],[j],[z]]),t.touchDependencies(this._injector,[[a.SheetsNumfmtCellContentController]])}onRendered(){t.touchDependencies(this._injector,[[z]]),[B,q,H,W,$].forEach(r=>{this.disposeWithMe(this._commandService.registerCommand(r))})}},Z(a.UniverSheetsNumfmtPlugin,"pluginName",X),Z(a.UniverSheetsNumfmtPlugin,"type",t.UniverInstanceType.UNIVER_SHEET),a.UniverSheetsNumfmtPlugin=le([t.DependentOn(o.UniverSheetsPlugin),F(1,t.Inject(t.Injector)),F(2,t.IConfigService),F(3,t.ICommandService)],a.UniverSheetsNumfmtPlugin);const ue=e=>O.find(i=>e.includes(i)),ce=()=>O.map(e=>({label:e,value:e})),oe=e=>V.map(r=>({label:r.label(e),value:r.suffix(e),color:r.color})),me=()=>G.map(e=>({label:e.label,value:e.suffix})),fe=()=>x.map(e=>({label:e.label,value:e.suffix,color:e.color}));a.AddDecimalCommand=B,a.CURRENCYFORMAT=V,a.DATEFMTLISG=G,a.MenuCurrencyService=j,a.NUMBERFORMAT=x,a.SHEETS_NUMFMT_PLUGIN_CONFIG_KEY=w,a.SetCurrencyCommand=H,a.SetNumfmtCommand=$,a.SetPercentCommand=W,a.SubtractDecimalCommand=q,a.countryCurrencyMap=L,a.currencySymbols=O,a.getCurrencyFormatOptions=oe,a.getCurrencyOptions=ce,a.getCurrencyType=ue,a.getDateFormatOptions=me,a.getDecimalFromPattern=E,a.getDecimalString=D,a.getNumberFormatOptions=fe,a.getPatternPreview=Y,a.getPatternPreviewIgnoreGeneral=k,a.getPatternType=ee,a.isPatternHasDecimal=Q,a.setPatternDecimal=U,Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})});
20
+ (function(a,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("@univerjs/core"),require("@univerjs/sheets"),require("@univerjs/engine-numfmt"),require("rxjs"),require("@univerjs/engine-formula")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets","@univerjs/engine-numfmt","rxjs","@univerjs/engine-formula"],t):(a=typeof globalThis<"u"?globalThis:a||self,t(a.UniverSheetsNumfmt={},a.UniverCore,a.UniverSheets,a.UniverEngineNumfmt,a.rxjs,a.UniverEngineFormula))})(this,function(a,t,u,A,I,J){"use strict";var de=Object.defineProperty;var ge=(a,t,u)=>t in a?de(a,t,{enumerable:!0,configurable:!0,writable:!0,value:u}):a[t]=u;var R=(a,t,u)=>ge(a,typeof t!="symbol"?t+"":t,u);const O=["$","£","¥","¤","֏","؋","৳","฿","₡","₦","₩","₪","₫","€","₭","₮","₱","₲","₴","₸","₹","₺","₼","₽","₾","₿"],L={US:"$",CA:"C$",GB:"£",JP:"¥",IN:"₹",AU:"A$",CN:"¥",KR:"₩",RU:"₽",AT:"€",BE:"€",CY:"€",EE:"€",FI:"€",FR:"€",DE:"€",GR:"€",IE:"€",IT:"€",LV:"€",LT:"€",LU:"€",MT:"€",NL:"€",PT:"€",SK:"€",SI:"€",ES:"€"},G=[{label:"1930-08-05",suffix:"yyyy-MM-dd"},{label:"1930/08/05",suffix:"yyyy/MM/dd"},{label:"1930年08月05日",suffix:'yyyy"年"MM"月"dd"日"'},{label:"08-05",suffix:"MM-dd"},{label:"8月5日",suffix:'M"月"d"日"'},{label:"13:30:30",suffix:"h:mm:ss"},{label:"13:30",suffix:"h:mm"},{label:"下午01:30",suffix:"A/P hh:mm"},{label:"下午1:30",suffix:"A/P h:mm"},{label:"下午1:30:30",suffix:"A/P h:mm:ss"},{label:"08-05 下午 01:30",suffix:"MM-dd A/P hh:mm"}],x=[{label:"(1,235)",suffix:"#,##0_);(#,##0)"},{label:"(1,235) ",suffix:"#,##0_);[Red](#,##0)",color:"red"},{label:"1,234.56",suffix:"#,##0.00_);#,##0.00"},{label:"1,234.56",suffix:"#,##0.00_);[Red]#,##0.00",color:"red"},{label:"-1,234.56",suffix:"#,##0.00_);-#,##0.00"},{label:"-1,234.56",suffix:"#,##0.00_);[Red]-#,##0.00",color:"red"}],V=[{label:e=>`${e}1,235`,suffix:e=>`"${e}"#,##0.00_);"${e}"#,##0.00`},{label:e=>`${e}1,235`,suffix:e=>`"${e}"#,##0.00_);[Red]"${e}"#,##0.00`,color:"red"},{label:e=>`(${e}1,235)`,suffix:e=>`"${e}"#,##0.00_);("${e}"#,##0.00)`},{label:e=>`(${e}1,235)`,suffix:e=>`"${e}"#,##0.00_);[Red]("${e}"#,##0.00)`,color:"red"},{label:e=>`-${e}1,235`,suffix:e=>`"${e}"#,##0.00_);-"${e}"#,##0.00`},{label:e=>`-${e}1,235`,suffix:e=>`"${e}"#,##0.00_);[Red]-"${e}"#,##0.00`,color:"red"}],X="SHEET_NUMFMT_PLUGIN",E=(e,r=0)=>{var n;return e&&(n=t.numfmt.getFormatInfo(e).maxDecimals)!=null?n:r},D=e=>new Array(Math.min(Math.max(0,Number(e)),30)).fill(0).join(""),U=(e,r)=>e.split(";").map(n=>/\.0?/.test(n)?n.replace(/\.0*/g,`${r>0?".":""}${D(Number(r||0))}`):/0([^0]?)|0$/.test(n)?n.replace(/0([^0]+)|0$/,`0${r>0?".":""}${D(Number(r||0))}$1`):n).join(";"),Q=e=>/\.0?/.test(e)||/0([^0]?)|0$/.test(e),$={id:"sheet.command.numfmt.set.numfmt",type:t.CommandType.COMMAND,handler:(e,r)=>{if(!r)return!1;const i=e.get(t.ICommandService),n=e.get(t.IUniverInstanceService),s=e.get(t.IUndoRedoService),l=u.getSheetCommandTarget(n,r);if(!l)return!1;const{unitId:m,subUnitId:v,worksheet:d}=l,c=r.values.filter(o=>!!o.pattern),T=r.values.filter(o=>!o.pattern),M=u.transformCellsToRange(m,v,c),y={unitId:m,subUnitId:v,ranges:T.map(o=>({startColumn:o.col,startRow:o.row,endColumn:o.col,endRow:o.row}))},b=[],h=[];if(c.length){const o=c.reduce((S,f)=>{A.isTextFormat(f.pattern)&&S.setValue(f.row,f.col,{t:t.CellValueType.STRING});const _=d.getCellRaw(f.row,f.col);if(_){const P=u.checkCellValueType(_.v);P!==_.t&&S.setValue(f.row,f.col,{t:P})}return S},new t.ObjectMatrix).getMatrix(),g=new t.ObjectMatrix;new t.ObjectMatrix(o).forValue((S,f)=>{const _=d.getCellRaw(S,f);_?g.setValue(S,f,{t:_.t}):g.setValue(S,f,{t:void 0})}),Object.keys(M.values).forEach(S=>{const f=M.values[S];f.ranges=u.rangeMerge(f.ranges)}),b.push({id:u.SetNumfmtMutation.id,params:M});const p=u.factorySetNumfmtUndoMutation(e,M);h.push(...p)}if(T.length){y.ranges=u.rangeMerge(y.ranges);const o=T.reduce((S,f)=>{const _=d.getCellRaw(f.row,f.col);if(_){const P=u.checkCellValueType(_.v);P!==_.t&&S.setValue(f.row,f.col,{t:P})}return S},new t.ObjectMatrix).getMatrix(),g=new t.ObjectMatrix;new t.ObjectMatrix(o).forValue((S,f)=>{const _=d.getCellRaw(S,f);_?g.setValue(S,f,{t:_.t}):g.setValue(S,f,{t:void 0})}),b.push({id:u.RemoveNumfmtMutation.id,params:y},{id:u.SetRangeValuesMutation.id,params:{unitId:m,subUnitId:v,cellValue:o}});const p=u.factoryRemoveNumfmtUndoMutation(e,y);h.push({id:u.SetRangeValuesMutation.id,params:{unitId:m,subUnitId:v,cellValue:g.getMatrix()}},...p)}const C=t.sequenceExecute(b,i).result;return C&&s.pushUndoRedo({unitID:m,undoMutations:h,redoMutations:b}),C}},B={id:"sheet.command.numfmt.add.decimal.command",type:t.CommandType.COMMAND,handler:async e=>{const r=e.get(t.ICommandService),i=e.get(u.SheetsSelectionsService),n=e.get(u.INumfmtService),s=e.get(t.IUniverInstanceService),l=i.getCurrentSelections();if(!l||!l.length)return!1;const m=u.getSheetCommandTarget(s);if(!m)return!1;const{unitId:v,subUnitId:d}=m;let c=0;l.forEach(b=>{t.Range.foreach(b.range,(h,C)=>{const o=n.getValue(v,d,h,C);if(!o){const p=m.worksheet.getCellRaw(h,C);if(!c&&p&&p.t===t.CellValueType.NUMBER&&p.v){const S=/\.(\d*)$/.exec(String(p.v));if(S){const f=S[1].length;if(!f)return;c=Math.max(c,f)}}return}const g=E(o.pattern);c=g>c?g:c})});const T=c+1,M=U(`0${T>0?".0":""}`,T),y=[];return l.forEach(b=>{t.Range.foreach(b.range,(h,C)=>{const o=n.getValue(v,d,h,C);if(!o)y.push({row:h,col:C,pattern:M});else{const g=E(o.pattern),p=U(o.pattern,g+1);p!==o.pattern&&y.push({row:h,col:C,pattern:p})}})}),y.length?await r.executeCommand($.id,{values:y}):!1}};class j{constructor(){R(this,"_currencySymbol$",new I.BehaviorSubject("US"));R(this,"currencySymbol$",this._currencySymbol$.asObservable())}setCurrencySymbolByCountryCode(r){this._currencySymbol$.next(r)}getCurrencySymbol(){return this._currencySymbol$.getValue()}}const H={id:"sheet.command.numfmt.set.currency",type:t.CommandType.COMMAND,handler:async e=>{const r=e.get(t.ICommandService),i=e.get(u.SheetsSelectionsService),n=e.get(j),s=L[n.getCurrencySymbol()]||"$",l=i.getCurrentSelections();if(!l||!l.length)return!1;const m=[],v=V[4].suffix(s);return l.forEach(c=>{t.Range.foreach(c.range,(T,M)=>{m.push({row:T,col:M,pattern:v,type:"currency"})})}),await r.executeCommand($.id,{values:m})}},W={id:"sheet.command.numfmt.set.percent",type:t.CommandType.COMMAND,handler:async e=>{const r=e.get(t.ICommandService),n=e.get(u.SheetsSelectionsService).getCurrentSelections();if(!n||!n.length)return!1;const s=[],l="0%";return n.forEach(v=>{t.Range.foreach(v.range,(d,c)=>{s.push({row:d,col:c,pattern:l,type:"percent"})})}),await r.executeCommand($.id,{values:s})}},q={id:"sheet.command.numfmt.subtract.decimal.command",type:t.CommandType.COMMAND,handler:async e=>{const r=e.get(t.ICommandService),i=e.get(u.SheetsSelectionsService),n=e.get(u.INumfmtService),s=e.get(t.IUniverInstanceService),l=i.getCurrentSelections();if(!l||!l.length)return!1;const m=u.getSheetCommandTarget(s);if(!m)return!1;const{unitId:v,subUnitId:d}=m;let c=0;l.forEach(h=>{t.Range.foreach(h.range,(C,o)=>{const g=n.getValue(v,d,C,o);if(!g){const S=m.worksheet.getCellRaw(C,o);if(!c&&S&&S.t===t.CellValueType.NUMBER&&S.v){const f=/\.(\d*)$/.exec(String(S.v));if(f){const _=f[1].length;if(!_)return;c=Math.max(c,_)}}return}const p=E(g.pattern);c=p>c?p:c})});const T=c-1,M=U(`0${T>0?".0":"."}`,T),y=[];return l.forEach(h=>{t.Range.foreach(h.range,(C,o)=>{const g=n.getValue(v,d,C,o);if(!g)y.push({row:C,col:o,pattern:M});else{const p=E(g.pattern);y.push({row:C,col:o,pattern:U(g.pattern,p-1)})}})}),await r.executeCommand($.id,{values:y})}},w="sheets-numfmt.config",K={},ee=e=>t.numfmt.getFormatInfo(e).type||"unknown",Y=(e,r,i="en")=>{const n=t.numfmt.formatColor(e,r),s=n?String(n):void 0,l=t.numfmt.format(e,r,{locale:i,throws:!1});return r<0?{result:l,color:s}:{result:l}},k=(e,r,i)=>e==="General"?{result:String(J.stripErrorMargin(r))}:Y(e,r,i);var te=Object.getOwnPropertyDescriptor,ne=(e,r,i,n)=>{for(var s=n>1?void 0:n?te(r,i):r,l=e.length-1,m;l>=0;l--)(m=e[l])&&(s=m(s)||s);return s},N=(e,r)=>(i,n)=>r(i,n,e);const re={tl:{size:6,color:"#409f11"}};a.SheetsNumfmtCellContentController=class extends t.Disposable{constructor(i,n,s,l,m,v,d){super();R(this,"_local$",new I.BehaviorSubject("en"));R(this,"local$",this._local$.asObservable());this._instanceService=i,this._sheetInterceptorService=n,this._themeService=s,this._commandService=l,this._numfmtService=m,this._localeService=v,this._configService=d,this._initInterceptorCellContent()}get local(){const i=this._local$.getValue();if(i)return i;switch(this._localeService.getCurrentLocale()){case t.LocaleType.FR_FR:return"fr";case t.LocaleType.RU_RU:return"ru";case t.LocaleType.VI_VN:return"vi";case t.LocaleType.ZH_CN:return"zh-CN";case t.LocaleType.ZH_TW:return"zh-TW";case t.LocaleType.EN_US:case t.LocaleType.FA_IR:default:return"en"}}_initInterceptorCellContent(){const i=new t.ObjectMatrix;this.disposeWithMe(I.merge(this._local$,this._localeService.currentLocale$).subscribe(()=>{i.reset()})),this.disposeWithMe(this._sheetInterceptorService.intercept(u.INTERCEPTOR_POINT.CELL_CONTENT,{effect:t.InterceptorEffectEnum.Value|t.InterceptorEffectEnum.Style,handler:(n,s,l)=>{var C,o;const m=s.unitId,v=s.subUnitId;let d;const c=n;if(!c||c.v===void 0||c.v===null)return l(n);if(n!=null&&n.s){const g=s.workbook.getStyles().get(n.s);g!=null&&g.n&&(d=g.n)}if(d||(d=this._numfmtService.getValue(m,v,s.row,s.col)),!d||d.pattern==="General"||u.checkCellValueType(c.v)!==t.CellValueType.NUMBER)return l(n);if((!n||n===s.rawData)&&(n={...s.rawData}),A.isTextFormat(d.pattern))return(C=this._configService.getConfig(w))!=null&&C.disableTextFormatMark?(n.t=t.CellValueType.STRING,l(n)):(n.t=t.CellValueType.STRING,n.markers={...n==null?void 0:n.markers,...re},l(n));let M="";const y=i.getValue(s.row,s.col);if(y&&y.parameters===`${c.v}_${d.pattern}`)return l({...n,...y.result});const b=k(d.pattern,Number(c.v),this.local);if(M=b.result,!M)return l(n);const h={v:M,t:t.CellValueType.NUMBER};if(b.color){const g=(o=this._themeService.getColorFromTheme(`${b.color}.500`))!=null?o:b.color;g&&(h.interceptorStyle={cl:{rgb:g}})}return i.setValue(s.row,s.col,{result:h,parameters:`${c.v}_${d.pattern}`}),Object.assign(n,h),l(n)},priority:u.InterceptCellContentPriority.NUMFMT})),this.disposeWithMe(this._commandService.onCommandExecuted(n=>{if(n.id===u.SetNumfmtMutation.id){const s=n.params;Object.keys(s.values).forEach(l=>{s.values[l].ranges.forEach(v=>{t.Range.foreach(v,(d,c)=>{i.realDeleteValue(d,c)})})})}else if(n.id===u.SetRangeValuesMutation.id){const s=n.params;new t.ObjectMatrix(s.cellValue).forValue((l,m)=>{i.realDeleteValue(l,m)})}})),this.disposeWithMe(this._instanceService.getCurrentTypeOfUnit$(t.UniverInstanceType.UNIVER_SHEET).pipe(I.switchMap(n=>{var s;return(s=n==null?void 0:n.activeSheet$)!=null?s:I.of(null)}),I.skip(1)).subscribe(()=>i.reset()))}setNumfmtLocal(i){this._local$.next(i)}},a.SheetsNumfmtCellContentController=ne([N(0,t.IUniverInstanceService),N(1,t.Inject(u.SheetInterceptorService)),N(2,t.Inject(t.ThemeService)),N(3,t.Inject(t.ICommandService)),N(4,t.Inject(u.INumfmtService)),N(5,t.Inject(t.LocaleService)),N(6,t.IConfigService)],a.SheetsNumfmtCellContentController);class z extends t.Disposable{constructor(){super(...arguments);R(this,"_currencySymbol$",new I.BehaviorSubject("US"));R(this,"currencySymbol$",this._currencySymbol$.asObservable())}setCurrencySymbolByCountryCode(i){this._currencySymbol$.next(i)}getCurrencySymbol(){return this._currencySymbol$.getValue()}}var ae=Object.defineProperty,ie=Object.getOwnPropertyDescriptor,se=(e,r,i)=>r in e?ae(e,r,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[r]=i,le=(e,r,i,n)=>{for(var s=n>1?void 0:n?ie(r,i):r,l=e.length-1,m;l>=0;l--)(m=e[l])&&(s=m(s)||s);return s},F=(e,r)=>(i,n)=>r(i,n,e),Z=(e,r,i)=>se(e,typeof r!="symbol"?r+"":r,i);a.UniverSheetsNumfmtPlugin=class extends t.Plugin{constructor(r=K,i,n,s){super(),this._config=r,this._injector=i,this._configService=n,this._commandService=s;const{...l}=t.merge({},K,this._config);this._configService.setConfig(w,l)}onStarting(){t.registerDependencies(this._injector,[[a.SheetsNumfmtCellContentController],[j],[z]]),t.touchDependencies(this._injector,[[a.SheetsNumfmtCellContentController]])}onRendered(){t.touchDependencies(this._injector,[[z]]),[B,q,H,W,$].forEach(r=>{this.disposeWithMe(this._commandService.registerCommand(r))})}},Z(a.UniverSheetsNumfmtPlugin,"pluginName",X),Z(a.UniverSheetsNumfmtPlugin,"type",t.UniverInstanceType.UNIVER_SHEET),a.UniverSheetsNumfmtPlugin=le([t.DependentOn(u.UniverSheetsPlugin),F(1,t.Inject(t.Injector)),F(2,t.IConfigService),F(3,t.ICommandService)],a.UniverSheetsNumfmtPlugin);const ue=e=>O.find(i=>e.includes(i)),ce=()=>O.map(e=>({label:e,value:e})),oe=e=>V.map(r=>({label:r.label(e),value:r.suffix(e),color:r.color})),me=()=>G.map(e=>({label:e.label,value:e.suffix})),fe=()=>x.map(e=>({label:e.label,value:e.suffix,color:e.color}));a.AddDecimalCommand=B,a.CURRENCYFORMAT=V,a.DATEFMTLISG=G,a.MenuCurrencyService=j,a.NUMBERFORMAT=x,a.SHEETS_NUMFMT_PLUGIN_CONFIG_KEY=w,a.SetCurrencyCommand=H,a.SetNumfmtCommand=$,a.SetPercentCommand=W,a.SubtractDecimalCommand=q,a.countryCurrencyMap=L,a.currencySymbols=O,a.getCurrencyFormatOptions=oe,a.getCurrencyOptions=ce,a.getCurrencyType=ue,a.getDateFormatOptions=me,a.getDecimalFromPattern=E,a.getDecimalString=D,a.getNumberFormatOptions=fe,a.getPatternPreview=Y,a.getPatternPreviewIgnoreGeneral=k,a.getPatternType=ee,a.isPatternHasDecimal=Q,a.setPatternDecimal=U,Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})});
21
21
 
22
22
 
23
23
  // @univerjs/sheets-numfmt/facade
@@ -45,7 +45,7 @@
45
45
 
46
46
 
47
47
  // @univerjs/sheets-formula/index
48
- (function(N,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):(N=typeof globalThis<"u"?globalThis:N||self,f(N.UniverSheetsFormula={},N.UniverCore,N.UniverSheets,N.UniverEngineFormula,N.rxjs,N.UniverRpc))})(this,function(N,f,s,t,H,it){"use strict";var Ca=Object.defineProperty;var Ra=(N,f,s)=>f in N?Ca(N,f,{enumerable:!0,configurable:!0,writable:!0,value:s}):N[f]=s;var h=(N,f,s)=>Ra(N,typeof f!="symbol"?f+"":f,s);const Dt={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:d}=c,{row:T,column:P}=l,L=f.Tools.generateRandomId(6);o.setValue(T,P,{f:d,si:L});const{startRow:S,startColumn:C,endRow:R,endColumn:p}=m;for(let I=S;I<=R;I++)for(let A=C;A<=p;A++)(I!==T||A!==P)&&o.setValue(I,A,{si:L})}),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)}},bt={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,d=s.alignToMergedCellsBorders({startRow:m.endRow,endRow:m.endRow,startColumn:m.startColumn,endColumn:m.endColumn},u);if(!f.Rectangle.equals(d,m))for(const L of u.iterateByColumn(d))(!L.value||!u.cellHasValue(L.value))&&l.setValue(L.row,L.col,{f:`=SUM(${t.serializeRange({startColumn:L.col,endColumn:L.col,startRow:m.startRow,endRow:L.row-1})})`});const T=s.alignToMergedCellsBorders({startRow:m.startRow,startColumn:m.endColumn,endRow:m.endRow,endColumn:m.endColumn},u);if(!f.Rectangle.equals(T,m))for(const L of u.iterateByRow(T))(!L.value||!u.cellHasValue(L.value))&&l.setValue(L.row,L.col,{f:`=SUM(${t.serializeRange({startColumn:m.startColumn,endColumn:L.col-1,startRow:L.row,endRow:L.row})})`});const P=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}]}}],P)).result}},Q={type:f.CommandType.MUTATION,id:"sheet.mutation.data-validation-formula-mark-dirty",handler(){return!0}};function Yt(r,e,a){var n;return r==null||r[e]==null||((n=r[e])==null?void 0:n[a])==null}function Et(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 y=(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))(y||{});const wt=[11,12,13,14];function Xt(r,e,a){const{type:n}=a;return wt.includes(n)?Wt(r,e):Kt(r,e,a)}function Wt(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]||{}),d=new f.ObjectMatrix,T=new f.ObjectMatrix;if(m.forValue((R,p,I)=>{if(I==null)return!0;const A=rt(I);A!==null&&(d.setValue(R,p,A),T.setValue(R,p,l.getValue(R,p)))}),d.getSizeOf()===0)return;const P={subUnitId:c,unitId:i,cellValue:d.getMatrix()},L={id:s.SetRangeValuesMutation.id,params:P};n.push(L);const S={subUnitId:c,unitId:i,cellValue:T.getMatrix()},C={id:s.SetRangeValuesMutation.id,params:S};a.push(C)})}),{undos:a,redos:n}}function Kt(r,e,a){const{redoFormulaData:n,undoFormulaData:i}=gt(r,e,a);if(f.Tools.diffValue(n,i))return{undos:[],redos:[]};const 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]},d={id:s.SetRangeValuesMutation.id,params:l};o.push(d)}})}),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]},d={id:s.SetRangeValuesMutation.id,params:l};u.push(d)}})}),{undos:u,redos:o}}function gt(r,e,a){const n={},i={},{unitId:o,sheetId:u}=a;return new Set([...Object.keys(r),...Object.keys(e)]).forEach(m=>{if(Yt(r,m,u))return;new Set([...Object.keys(r[m]||{}),...Object.keys(e[m]||{})]).forEach(d=>{var I,A;const T=(I=r[m])==null?void 0:I[d],P=(A=e[m])==null?void 0:A[d],L=new f.ObjectMatrix(T||{}),S=new f.ObjectMatrix(P||{});let C=[];m!==o||d!==u?C=Qt(S):C=kt(L,a);const R=ce(C,L,S),p=fe(C,L);n[m]||(n[m]={}),i[m]||(i[m]={}),n[m][d]={...n[m][d],...R},i[m][d]={...i[m][d],...p}})}),{redoFormulaData:n,undoFormulaData:i}}function kt(r,e){const{type:a,from:n,to:i,range:o}=e,u=[];return r.forValue((c,m,l)=>{if(l==null||!yt(l))return!0;const d=f.cellToRange(c,m);let T=null,P=!1;if([0,1,2].includes(a))T=jt(a,n,i,d);else if(o!=null){const L=$t(d,e);T=L.newCell,P=L.isReverse}P?u.unshift({oldCell:d,newCell:T}):u.push({oldCell:d,newCell:T})}),u}function Qt(r){const e=[];return r.forValue((a,n,i)=>{if(i==null||!yt(i))return!0;const o=f.cellToRange(a,n);e.push({oldCell:o,newCell:o})}),e}function jt(r,e,a,n){if(e==null||a==null)return null;switch(r){case 0:return zt(e,a,n);case 1:return Zt(e,a,n);case 2:return Jt(e,a,n);default:return null}}function $t(r,e){const{type:a,rangeFilteredRows:n}=e,i=e.range;let o=null,u=!1;switch(a){case 3:o=te(i,r),u=!0;break;case 4:o=ee(i,r),u=!0;break;case 5:o=ae(i,r,n);break;case 6:o=ne(i,r);break;case 7:o=ie(i,r);break;case 8:o=re(i,r);break;case 9:o=oe(i,r),u=!0;break;case 10:o=ue(i,r),u=!0;break}return{newCell:o,isReverse:u}}function zt(r,e,a){const n=s.handleMoveRange({id:s.EffectRefRangId.MoveRangeCommandId,params:{toRange:e,fromRange:r}},a);return s.runRefRangeMutations(n,a)}function Zt(r,e,a){const n=s.handleMoveRows({id:s.EffectRefRangId.MoveRowsCommandId,params:{toRange:e,fromRange:r}},a);return s.runRefRangeMutations(n,a)}function Jt(r,e,a){const n=s.handleMoveCols({id:s.EffectRefRangId.MoveColsCommandId,params:{toRange:e,fromRange:r}},a);return s.runRefRangeMutations(n,a)}function te(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 ee(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 ae(r,e,a){const n=s.handleIRemoveRow({id:s.EffectRefRangId.RemoveRowCommandId,params:{range:r}},e,a);return s.runRefRangeMutations(n,e)}function ne(r,e){const a=s.handleIRemoveCol({id:s.EffectRefRangId.RemoveColCommandId,params:{range:r}},e);return s.runRefRangeMutations(a,e)}function ie(r,e){const a=s.handleDeleteRangeMoveLeft({id:s.EffectRefRangId.DeleteRangeMoveLeftCommandId,params:{range:r}},e);return s.runRefRangeMutations(a,e)}function re(r,e){const a=s.handleDeleteRangeMoveUp({id:s.EffectRefRangId.DeleteRangeMoveUpCommandId,params:{range:r}},e);return s.runRefRangeMutations(a,e)}function oe(r,e){const a=s.handleInsertRangeMoveDown({id:s.EffectRefRangId.InsertRangeMoveDownCommandId,params:{range:r}},e);return s.runRefRangeMutations(a,e)}function ue(r,e){const a=s.handleInsertRangeMoveRight({id:s.EffectRefRangId.InsertRangeMoveRightCommandId,params:{range:r}},e);return s.runRefRangeMutations(a,e)}function ce(r,e,a){const n=new f.ObjectMatrix({});return r.forEach(i=>{const{oldCell:o,newCell:u}=i,{startRow:c,startColumn:m}=o,l=a.getValue(c,m)||e.getValue(c,m),d=rt(l);if(n.setValue(c,m,{f:null,si:null}),u){const{startRow:T,startColumn:P}=u;n.setValue(T,P,d)}}),n.getMatrix()}function fe(r,e){const a=new f.ObjectMatrix({});return r.reverse().forEach(n=>{const{oldCell:i,newCell:o}=n,{startRow:u,startColumn:c}=i,m=e.getValue(u,c),l=rt(m);if(o){const{startRow:d,startColumn:T}=o;a.setValue(d,T,{f:null,si:null})}a.setValue(u,c,l)}),a.getMatrix()}function rt(r){if(r==null)return;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 me(r){const e=new f.ObjectMatrix({});return new f.ObjectMatrix(r).forValue((n,i,o)=>{const u=rt(o);u&&e.setValue(n,i,u)}),e.getMatrix()}function yt(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 xt(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 Ut(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:d,sheetName:T,unitId:P}=l,L=f.Rectangle.moveOffset(d,a,n);i.push({...c,token:t.serializeRangeToRefString({range:L,unitId:P,sheetName:T})})}return i}function qt(r,e,a,n){const{type:i,unitId:o,sheetId:u,range:c,from:m,to:l,rangeFilteredRows:d}=e,{range:T,sheetId:P,unitId:L,sheetName:S,refOffsetX:C,refOffsetY:R}=r;if(!xt(o,u,a,n,L,P))return;const p=f.Rectangle.moveOffset(T,C,R);let I=null;if(i===y.MoveRange){if(m==null||l==null)return;const A=At(p,m),E=f.getIntersectRange(p,m);if(E==null||A!==4)return;const M=s.handleMoveRange({id:s.EffectRefRangId.MoveRangeCommandId,params:{toRange:l,fromRange:m}},E),D=s.runRefRangeMutations(M,E);if(D==null)return t.ErrorType.REF;I=It(A,D,m,l,p,E)}else if(i===y.MoveRows){if(m==null||l==null)return;const A=At(p,m);let E=f.getIntersectRange(p,m);if(E==null&&(m.endRow<p.startRow&&l.endRow<p.startRow||m.startRow>p.endRow&&l.startRow>p.endRow))return;E==null&&(E={startRow:p.startRow,endRow:p.endRow,startColumn:p.startColumn,endColumn:p.endColumn,rangeType:f.RANGE_TYPE.NORMAL});const M=s.handleMoveRows({id:s.EffectRefRangId.MoveRowsCommandId,params:{toRange:l,fromRange:m}},E),D=s.runRefRangeMutations(M,E);if(D==null)return t.ErrorType.REF;I=It(A,D,m,l,p,E)}else if(i===y.MoveCols){if(m==null||l==null)return;const A=At(p,m);let E=f.getIntersectRange(p,m);if(E==null&&(m.endColumn<p.startColumn&&l.endColumn<p.startColumn||m.startColumn>p.endColumn&&l.startColumn>p.endColumn))return;E==null&&(E={startRow:p.startRow,endRow:p.endRow,startColumn:p.startColumn,endColumn:p.endColumn,rangeType:f.RANGE_TYPE.NORMAL});const M=s.handleMoveCols({id:s.EffectRefRangId.MoveColsCommandId,params:{toRange:l,fromRange:m}},E),D=s.runRefRangeMutations(M,E);if(D==null)return t.ErrorType.REF;I=It(A,D,m,l,p,E)}if(c!=null){if(i===y.InsertRow){const A=s.handleInsertRow({id:s.EffectRefRangId.InsertRowCommandId,params:{range:c,unitId:"",subUnitId:"",direction:f.Direction.DOWN}},p),E=s.runRefRangeMutations(A,p);if(E==null)return;I={...p,...E}}else if(i===y.InsertColumn){const A=s.handleInsertCol({id:s.EffectRefRangId.InsertColCommandId,params:{range:c,unitId:"",subUnitId:"",direction:f.Direction.RIGHT}},p),E=s.runRefRangeMutations(A,p);if(E==null)return;I={...p,...E}}else if(i===y.RemoveRow){const A=s.handleIRemoveRow({id:s.EffectRefRangId.RemoveRowCommandId,params:{range:c}},p,d),E=s.runRefRangeMutations(A,p);if(E==null)return t.ErrorType.REF;I={...p,...E}}else if(i===y.RemoveColumn){const A=s.handleIRemoveCol({id:s.EffectRefRangId.RemoveColCommandId,params:{range:c}},p),E=s.runRefRangeMutations(A,p);if(E==null)return t.ErrorType.REF;I={...p,...E}}else if(i===y.DeleteMoveLeft){const A=s.handleDeleteRangeMoveLeft({id:s.EffectRefRangId.DeleteRangeMoveLeftCommandId,params:{range:c}},p),E=s.runRefRangeMutations(A,p);if(E==null)return t.ErrorType.REF;I={...p,...E}}else if(i===y.DeleteMoveUp){const A=s.handleDeleteRangeMoveUp({id:s.EffectRefRangId.DeleteRangeMoveUpCommandId,params:{range:c}},p),E=s.runRefRangeMutations(A,p);if(E==null)return t.ErrorType.REF;I={...p,...E}}else if(i===y.InsertMoveDown){const A=s.handleInsertRangeMoveDown({id:s.EffectRefRangId.InsertRangeMoveDownCommandId,params:{range:c}},p),E=s.runRefRangeMutations(A,p);if(E==null)return;I={...p,...E}}else if(i===y.InsertMoveRight){const A=s.handleInsertRangeMoveRight({id:s.EffectRefRangId.InsertRangeMoveRightCommandId,params:{range:c}},p),E=s.runRefRangeMutations(A,p);if(E==null)return;I={...p,...E}}}if(I!=null)return t.serializeRangeToRefString({range:I,sheetName:S,unitId:L})}function It(r,e,a,n,i,o){const{startRow:u,endRow:c,startColumn:m,endColumn:l,rangeType:d}=nt(e),{startRow:T,startColumn:P,endRow:L,endColumn:S,rangeType:C=f.RANGE_TYPE.NORMAL}=nt(a),{startRow:R,startColumn:p,endRow:I,endColumn:A}=nt(n),{startRow:E,endRow:M,startColumn:D,endColumn:q}=nt(o),{startRow:b,endRow:x,startColumn:_,endColumn:U,rangeType:F=f.RANGE_TYPE.NORMAL}=nt(i),O={...i};function v(){return d===f.RANGE_TYPE.COLUMN&&F===f.RANGE_TYPE.COLUMN?!0:m>=_&&l<=U}function J(){return d===f.RANGE_TYPE.ROW&&F===f.RANGE_TYPE.ROW?!0:u>=b&&c<=x}if(r===0)if(v())if(u<b)O.startRow=u;else if(u>=x)O.endRow-=L+1-b;else return;else return;else if(r===1)if(v())if(c>x)O.endRow=c;else if(c<=b)O.startRow+=x-T+1;else return;else return;else if(r===2)if(J())if(m<_)O.startColumn=m;else if(m>=U)O.endColumn-=S+1-_;else return;else return;else if(r===3)if(J())if(l>U)O.endColumn=l;else if(l<=_)O.startColumn+=U-P+1;else return;else return;else r===4?(O.startRow=u,O.startColumn=m,O.endRow=c,O.endColumn=l):P<=_&&S>=U||C===f.RANGE_TYPE.ROW&&F===f.RANGE_TYPE.ROW?a.endRow<b?(R>=b&&(O.startRow-=L-T+1),R>=x&&(O.endRow-=L-T+1)):a.startRow>x?(I<=x&&(O.endRow+=L-T+1),I<=b&&(O.startRow+=L-T+1)):a.startRow>=b&&a.endRow<=x&&(R<=b?O.startRow+=L-T+1:R>=x&&(O.endRow-=L-T+1)):T<=b&&L>=x||C===f.RANGE_TYPE.COLUMN&&F===f.RANGE_TYPE.COLUMN?a.endColumn<_?(p>=_&&(O.startColumn-=S-P+1),p>=U&&(O.endColumn-=S-P+1)):a.startColumn>U?(A<=U&&(O.endColumn+=S-P+1),A<=_&&(O.startColumn+=S-P+1)):a.startColumn>=_&&a.endColumn<=U&&(p<=_?O.startColumn+=S-P+1:p>=U&&(O.endColumn-=S-P+1)):((p<=q+1&&A>=U||p<=_&&A>=D-1)&&R<=b&&I>=x||(R<=M+1&&I>=x||R<=b&&I>=E-1)&&p<=_&&A>=U,O.startRow=u,O.startColumn=m,O.endRow=c,O.endColumn=l);return O}function At(r,e){const a=j(r.startRow),n=$(r.endRow),i=j(r.startColumn),o=$(r.endColumn),u=j(e.startRow),c=$(e.endRow),m=j(e.startColumn),l=$(e.endColumn);function d(){return r.rangeType===f.RANGE_TYPE.COLUMN&&e.rangeType===f.RANGE_TYPE.COLUMN?!0:a>=u&&n<=c}function T(){return r.rangeType===f.RANGE_TYPE.ROW&&e.rangeType===f.RANGE_TYPE.ROW?!0:i>=m&&o<=l}function P(){return r.rangeType===f.RANGE_TYPE.ALL&&e.rangeType===f.RANGE_TYPE.ALL}return d()&&T()||P()?4:T()&&a>=u&&a<=c&&n>c?0:T()&&n>=u&&n<=c&&a<u?1:d()&&i>=m&&i<=l&&o>l?2:d()&&o>=m&&o<=l&&i<m?3:null}function j(r){return isNaN(r)?-1/0:r}function $(r){return isNaN(r)?1/0:r}function nt(r){const{startRow:e,endRow:a,startColumn:n,endColumn:i}=r;return{...r,startRow:j(e),endRow:$(a),startColumn:j(n),endColumn:$(i)}}function ht(r,e){const{id:a}=e;let n=null;switch(a){case s.MoveRangeCommand.id:n=se(e,r);break;case s.MoveRowsCommand.id:n=le(e,r);break;case s.MoveColsCommand.id:n=pe(e,r);break;case s.InsertRowCommand.id:n=de(e);break;case s.InsertColCommand.id:n=Le(e);break;case s.InsertRangeMoveRightCommand.id:n=Te(e,r);break;case s.InsertRangeMoveDownCommand.id:n=Ne(e,r);break;case s.RemoveRowCommand.id:n=Pe(e,r);break;case s.RemoveColCommand.id:n=Ee(e,r);break;case s.DeleteRangeMoveUpCommand.id:n=Ie(e,r);break;case s.DeleteRangeMoveLeftCommand.id:n=Ae(e,r);break;case s.SetWorksheetNameCommand.id:n=Se(e,r);break;case s.RemoveSheetCommand.id:n=Ce(e,r);break;case s.SetDefinedNameCommand.id:n=Re(e,r);break;case s.RemoveDefinedNameCommand.id:n=Oe(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 se(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:y.MoveRange,from:n,to:i,unitId:o,sheetId:u}}function le(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(),d={startRow:n,startColumn:0,endRow:i,endColumn:m.getColumnCount()-1,rangeType:f.RANGE_TYPE.ROW},T={startRow:o,startColumn:0,endRow:u,endColumn:m.getColumnCount()-1,rangeType:f.RANGE_TYPE.ROW};return{type:y.MoveRows,from:d,to:T,unitId:c,sheetId:l}}function pe(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(),d={startRow:0,startColumn:n,endRow:m.getRowCount()-1,endColumn:i,rangeType:f.RANGE_TYPE.COLUMN},T={startRow:0,startColumn:o,endRow:m.getRowCount()-1,endColumn:u,rangeType:f.RANGE_TYPE.COLUMN};return{type:y.MoveCols,from:d,to:T,unitId:c,sheetId:l}}function de(r){const{params:e}=r;if(!e)return null;const{range:a,unitId:n,subUnitId:i}=e;return{type:y.InsertRow,range:a,unitId:n,sheetId:i}}function Le(r){const{params:e}=r;if(!e)return null;const{range:a,unitId:n,subUnitId:i}=e;return{type:y.InsertColumn,range:a,unitId:n,sheetId:i}}function Te(r,e){const{params:a}=r;if(!a)return null;const{range:n}=a,{unitId:i,sheetId:o}=V(e);return{type:y.InsertMoveRight,range:n,unitId:i,sheetId:o}}function Ne(r,e){const{params:a}=r;if(!a)return null;const{range:n}=a,{unitId:i,sheetId:o}=V(e);return{type:y.InsertMoveDown,range:n,unitId:i,sheetId:o}}function Pe(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:y.RemoveRow,range:n,unitId:i,sheetId:o,rangeFilteredRows:(c=(u=e.getSheetBySheetId(o))==null?void 0:u.getRangeFilterRows(n))!=null?c:[]}}function Ee(r,e){const{params:a}=r;if(!a)return null;const{range:n}=a,{unitId:i,sheetId:o}=V(e);return{type:y.RemoveColumn,range:n,unitId:i,sheetId:o}}function Ie(r,e){const{params:a}=r;if(!a)return null;const{range:n}=a,{unitId:i,sheetId:o}=V(e);return{type:y.DeleteMoveUp,range:n,unitId:i,sheetId:o}}function Ae(r,e){const{params:a}=r;if(!a)return null;const{range:n}=a,{unitId:i,sheetId:o}=V(e);return{type:y.DeleteMoveLeft,range:n,unitId:i,sheetId:o}}function Se(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:y.SetName,unitId:n||u,sheetId:i||c,sheetName:o}}function Ce(r,e){const{params:a}=r;if(!a)return null;const{unitId:n,subUnitId:i}=a,{unitId:o,sheetId:u}=V(e);return{type:y.RemoveSheet,unitId:n||o,sheetId:i||u}}function Re(r,e){const{params:a}=r;if(!a)return null;const{unitId:n,name:i,id:o}=a,{sheetId:u}=V(e);return{type:y.SetDefinedName,unitId:n,sheetId:u,definedName:i,definedNameId:o}}function Oe(r,e){const{params:a}=r;if(!a)return null;const{unitId:n,name:i,id:o}=a,{sheetId:u}=V(e);return{type:y.RemoveDefinedName,unitId:n,sheetId:u,definedName:i,definedNameId:o}}var Me=Object.getOwnPropertyDescriptor,_e=(r,e,a,n)=>{for(var i=n>1?void 0:n?Me(e,a):e,o=r.length-1,u;o>=0;o--)(u=r[o])&&(i=u(i)||i);return i},ot=(r,e)=>(a,n)=>e(a,n,r);N.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=ht(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 p;const{formulaOrRefString:d}=l,T=this._lexerTreeBuilder.sequenceNodesBuilder(d);if(T==null)return!0;let P=!1;const L=[];for(let I=0,A=T.length;I<A;I++){const E=T[I];if(typeof E=="string"||E.nodeType!==t.sequenceNodeType.REFERENCE)continue;const{token:M}=E,D=t.deserializeRangeWithSheetWithCache(M),{range:q,sheetName:b,unitId:x}=D,_=((p=e.getSheetBySheetName(b))==null?void 0:p.getSheetId())||"",U={range:q,sheetId:_,unitId:x,sheetName:b,refOffsetX:0,refOffsetY:0};let F=null;if(n===y.RemoveSheet)F=this._removeSheet(l,i,o);else if(n===y.SetName){const{sheetId:O,sheetName:v}=a;if(v==null||_==null||_.length===0||O!==_)continue;F=t.serializeRangeToRefString({range:q,sheetName:v,unitId:x})}else F=qt(U,a,i,o);F!=null&&(T[I]={...E,token:F},P=!0,L.push(I))}if(!P)return!0;const S=t.generateStringWithSequence(Ut(T,L)),C={id:t.SetDefinedNameMutation.id,params:{unitId:i,...l,formulaOrRefString:S}};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}},N.UpdateDefinedNameController=_e([ot(0,t.IDefinedNamesService),ot(1,f.IUniverInstanceService),ot(2,f.Inject(s.SheetInterceptorService)),ot(3,f.Inject(t.LexerTreeBuilder))],N.UpdateDefinedNameController);var z=(r=>(r[r.NOT_REGISTER=1]="NOT_REGISTER",r[r.SUCCESS=2]="SUCCESS",r[r.WAIT=3]="WAIT",r[r.ERROR=4]="ERROR",r))(z||{}),De=Object.getOwnPropertyDescriptor,be=(r,e,a,n)=>{for(var i=n>1?void 0:n?De(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);N.RegisterOtherFormulaService=class extends f.Disposable{constructor(a,n,i){super();h(this,"_formulaCacheMap",new Map);h(this,"_formulaChangeWithRange$",new H.Subject);h(this,"formulaChangeWithRange$",this._formulaChangeWithRange$.asObservable());h(this,"_formulaResult$",new H.Subject);h(this,"formulaResult$",this._formulaResult$.asObservable());h(this,"calculateStarted$",new H.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.Tools.generateRandomId(8)}`}_initFormulaRegister(){this._activeDirtyManagerService.register(Q.id,{commandId:Q.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 d={unitId:i,subUnitId:o,formulaMap:{[c]:{f:u,ranges:m}}};this._commandService.executeCommand(t.SetOtherFormulaMutation.id,d).then(()=>{this._commandService.executeCommand(Q.id,{[i]:{[o]:{[c]:!0}}})})};this.disposeWithMe(this._formulaChangeWithRange$.pipe(H.bufferWhen(()=>this.calculateStarted$.pipe(H.filter(n=>n)))).subscribe(n=>n.forEach(a))),this.disposeWithMe(this._formulaChangeWithRange$.pipe(H.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 d=this._ensureCacheMap(u,l),T=c[l],P=[];m[l]=P;for(const L in T){const S=T[L];if(d.has(L)){const C=d.get(L);if(!C)continue;C.result||(C.result={});const R=new f.ObjectMatrix(S),p=new f.ObjectMatrix(C.result);R.forValue((I,A,E)=>{p.setValue(I,A,E)}),C.status=z.SUCCESS,C.callbacks.forEach(I=>{I(S)}),C.callbacks.clear(),P.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:z.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===z.SUCCESS||u.status===z.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=z.WAIT,this._commandService.executeCommand(Q.id,{[a]:{[n]:{[i]:!0}}}))}},N.RegisterOtherFormulaService=be([St(0,f.ICommandService),St(1,t.IActiveDirtyManagerService),St(2,f.Inject(f.LifecycleService))],N.RegisterOtherFormulaService);const Z="sheets-formula.base.config";var Y=(r=>(r[r.FORCED=0]="FORCED",r[r.WHEN_EMPTY=1]="WHEN_EMPTY",r[r.NO_CALCULATION=2]="NO_CALCULATION",r))(Y||{});const Ft={},ye="sheets-formula.remote.config",Bt={};var xe=Object.getOwnPropertyDescriptor,Ue=(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},g=(r,e)=>(a,n)=>e(a,n,r);const vt={done:0,count:0},Ct={onlyLocal:!0};N.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 H.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=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(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:Y.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 d=this._activeDirtyManagerService.get(l.id);if(d==null)continue;const T=d.getDirtyData(l),{dirtyRanges:P,dirtyNameMap:L,dirtyDefinedNameMap:S,dirtyUnitFeatureMap:C,dirtyUnitOtherFormulaMap:R,clearDependencyTreeCache:p}=T;P!=null&&this._mergeDirtyRanges(n,P),L!=null&&this._mergeDirtyNameMap(i,L),S!=null&&this._mergeDirtyNameMap(o,S),C!=null&&this._mergeDirtyUnitFeatureOrOtherFormulaMap(u,C),R!=null&&this._mergeDirtyUnitFeatureOrOtherFormulaMap(c,R),p!=null&&this._mergeDirtyNameMap(m,p)}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 d=a.maxIteration||n.maxIteration;return{dirtyRanges:i,dirtyNameMap:o,dirtyDefinedNameMap:u,dirtyUnitFeatureMap:c,dirtyUnitOtherFormulaMap:m,forceCalculation:!!this._forceCalculating,clearDependencyTreeCache:l,maxIteration:d}}_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:d}=i.range,{startRow:T,startColumn:P,endRow:L,endColumn:S}=u.range;if(c===T&&m===P&&l===L&&d===S){o=!0;break}}o||a.push(i)}}_mergeDirtyNameMap(a,n){Object.keys(n).forEach(i=>{a[i]==null&&(a[i]={}),Object.keys(n[i]).forEach(o=>{var u;(u=n[i])!=null&&u[o]&&(a[i][o]=n[i][o])})})}_mergeDirtyUnitFeatureOrOtherFormulaMap(a,n){Object.keys(n).forEach(i=>{a[i]==null&&(a[i]={}),Object.keys(n[i]).forEach(o=>{a[i][o]==null&&(a[i][o]={}),Object.keys(n[i][o]).forEach(u=>{a[i][o][u]=n[i][o][u]||!1})})})}_initialExecuteFormulaProcessListener(){let a=null,n=0;this.disposeWithMe(this._commandService.onCommandExecuted(i=>{if(i.id===t.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===Y.FORCED,i=a===Y.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)}}},N.TriggerCalculationController=Ue([g(0,f.ICommandService),g(1,t.IActiveDirtyManagerService),g(2,f.ILogService),g(3,f.IConfigService),g(4,f.Inject(t.FormulaDataModel)),g(5,f.Inject(f.LocaleService)),g(6,f.Inject(N.RegisterOtherFormulaService))],N.TriggerCalculationController);function qe(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),d=c.execute(t.generateExecuteAstNodeData(l));return t.getObjectValue(d)}var he=Object.getOwnPropertyDescriptor,Fe=(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},w=(r,e)=>(a,n)=>e(a,n,r);N.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(H.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),u={[n]:{[a]:o}};this._commandService.executeCommand(s.SetRangeValuesMutation.id,{unitId:n,subUnitId:a,cellValue:me(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=Et(n,e,a),o=this._formulaDataModel.getArrayFormulaRange(),u=Et(o,e,a),c=this._formulaDataModel.getArrayFormulaCellData(),m=Et(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(d=>{var S;const T=d.getCellMatrix(),P=d.getSheetId(),L=t.initSheetFormulaData(a,n,P,T);i[n][P]=(S=L[n])==null?void 0:S[P]}),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:Y.WHEN_EMPTY,m=this._getDirtyDataByCalculationMode(c);this._commandService.executeCommand(t.SetFormulaCalculationStartMutation.id,m,{onlyLocal:!0})}_getDirtyDataByCalculationMode(e){const a=e===Y.FORCED,n=e===Y.WHEN_EMPTY?this._formulaDataModel.getFormulaDirtyRanges():[];return{forceCalculation:a,dirtyRanges:n,dirtyNameMap:{},dirtyDefinedNameMap:{},dirtyUnitFeatureMap:{},dirtyUnitOtherFormulaMap:{},clearDependencyTreeCache:{}}}_getUpdateFormula(e){const a=this._univerInstanceService.getCurrentUnitForType(f.UniverInstanceType.UNIVER_SHEET);if(!a)return{undos:[],redos:[]};const n=ht(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}=Xt(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 d of l){const T=new f.ObjectMatrix(m[d]||{}),P=new f.ObjectMatrix;T.forValue((L,S,C)=>{var b;if(!C)return!0;const{f:R,x:p,y:I,si:A}=C,E=this._lexerTreeBuilder.sequenceNodesBuilder(R);if(E==null)return!0;let M=!1;const D=[];for(let x=0,_=E.length;x<_;x++){const U=E[x];if(typeof U=="string")continue;const{token:F,nodeType:O}=U,{type:v}=n;if((v===y.SetDefinedName||v===y.RemoveDefinedName)&&(O===t.sequenceNodeType.DEFINED_NAME||O===t.sequenceNodeType.FUNCTION)){const{definedNameId:et,definedName:at}=n;if(et===void 0||at===void 0)continue;const k=this._definedNamesService.getValueById(c,et);if(k==null||k.name!==F)continue;E[x]={...U,token:v===y.SetDefinedName?at:t.ErrorType.REF},M=!0,D.push(x);continue}else if(O!==t.sequenceNodeType.REFERENCE)continue;const J=t.deserializeRangeWithSheetWithCache(F),{range:tt,sheetName:X,unitId:B}=J,W=B==null||B.length===0?c:B,G=((b=a==null?void 0:a[W])==null?void 0:b[X])||"";if(!xt(n.unitId,n.sheetId,c,d,B,G))continue;const Pt={range:tt,sheetId:G,unitId:B,sheetName:X,refOffsetX:p||0,refOffsetY:I||0};let K=null;if(v===y.SetName){const{unitId:et,sheetId:at,sheetName:k}=n;if(k==null||G==null||G.length===0||at!==G)continue;K=t.serializeRangeToRefString({range:tt,sheetName:k,unitId:B})}else if(v===y.RemoveSheet){const{unitId:et,sheetId:at,sheetName:k}=n;if(G==null||G.length===0||at!==G)continue;K=t.ErrorType.REF}else v!==y.SetDefinedName&&(K=qt(Pt,n,c,d));K!=null&&(E[x]={...U,token:K},M=!0,D.push(x))}if(!M)return!0;const q=Ut(E,D,p,I);P.setValue(L,S,{f:`=${t.generateStringWithSequence(q)}`})}),u[c]&&(u[c][d]=P.getData())}}return{newFormulaData:u}}},N.UpdateFormulaController=Fe([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))],N.UpdateFormulaController);const Be=[{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}]}],ve=[{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}]}],Ve=[{functionName:t.FUNCTION_NAMES_CUBE.CUBEKPIMEMBER,functionType:t.FunctionType.Cube,description:"formula.functionList.CUBEKPIMEMBER.description",abstract:"formula.functionList.CUBEKPIMEMBER.abstract",functionParameter:[{name:"formula.functionList.CUBEKPIMEMBER.functionParameter.number1.name",detail:"formula.functionList.CUBEKPIMEMBER.functionParameter.number1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.CUBEKPIMEMBER.functionParameter.number2.name",detail:"formula.functionList.CUBEKPIMEMBER.functionParameter.number2.detail",example:"A1:A20",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_CUBE.CUBEMEMBER,functionType:t.FunctionType.Cube,description:"formula.functionList.CUBEMEMBER.description",abstract:"formula.functionList.CUBEMEMBER.abstract",functionParameter:[{name:"formula.functionList.CUBEMEMBER.functionParameter.number1.name",detail:"formula.functionList.CUBEMEMBER.functionParameter.number1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.CUBEMEMBER.functionParameter.number2.name",detail:"formula.functionList.CUBEMEMBER.functionParameter.number2.detail",example:"A1:A20",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_CUBE.CUBEMEMBERPROPERTY,functionType:t.FunctionType.Cube,description:"formula.functionList.CUBEMEMBERPROPERTY.description",abstract:"formula.functionList.CUBEMEMBERPROPERTY.abstract",functionParameter:[{name:"formula.functionList.CUBEMEMBERPROPERTY.functionParameter.number1.name",detail:"formula.functionList.CUBEMEMBERPROPERTY.functionParameter.number1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.CUBEMEMBERPROPERTY.functionParameter.number2.name",detail:"formula.functionList.CUBEMEMBERPROPERTY.functionParameter.number2.detail",example:"A1:A20",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_CUBE.CUBERANKEDMEMBER,functionType:t.FunctionType.Cube,description:"formula.functionList.CUBERANKEDMEMBER.description",abstract:"formula.functionList.CUBERANKEDMEMBER.abstract",functionParameter:[{name:"formula.functionList.CUBERANKEDMEMBER.functionParameter.number1.name",detail:"formula.functionList.CUBERANKEDMEMBER.functionParameter.number1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.CUBERANKEDMEMBER.functionParameter.number2.name",detail:"formula.functionList.CUBERANKEDMEMBER.functionParameter.number2.detail",example:"A1:A20",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_CUBE.CUBESET,functionType:t.FunctionType.Cube,description:"formula.functionList.CUBESET.description",abstract:"formula.functionList.CUBESET.abstract",functionParameter:[{name:"formula.functionList.CUBESET.functionParameter.number1.name",detail:"formula.functionList.CUBESET.functionParameter.number1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.CUBESET.functionParameter.number2.name",detail:"formula.functionList.CUBESET.functionParameter.number2.detail",example:"A1:A20",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_CUBE.CUBESETCOUNT,functionType:t.FunctionType.Cube,description:"formula.functionList.CUBESETCOUNT.description",abstract:"formula.functionList.CUBESETCOUNT.abstract",functionParameter:[{name:"formula.functionList.CUBESETCOUNT.functionParameter.number1.name",detail:"formula.functionList.CUBESETCOUNT.functionParameter.number1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.CUBESETCOUNT.functionParameter.number2.name",detail:"formula.functionList.CUBESETCOUNT.functionParameter.number2.detail",example:"A1:A20",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_CUBE.CUBEVALUE,functionType:t.FunctionType.Cube,description:"formula.functionList.CUBEVALUE.description",abstract:"formula.functionList.CUBEVALUE.abstract",functionParameter:[{name:"formula.functionList.CUBEVALUE.functionParameter.number1.name",detail:"formula.functionList.CUBEVALUE.functionParameter.number1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.CUBEVALUE.functionParameter.number2.name",detail:"formula.functionList.CUBEVALUE.functionParameter.number2.detail",example:"A1:A20",require:1,repeat:0}]}],Ge=[{functionName:t.FUNCTION_NAMES_DATABASE.DAVERAGE,functionType:t.FunctionType.Database,description:"formula.functionList.DAVERAGE.description",abstract:"formula.functionList.DAVERAGE.abstract",functionParameter:[{name:"formula.functionList.DAVERAGE.functionParameter.database.name",detail:"formula.functionList.DAVERAGE.functionParameter.database.detail",example:"A4:E10",require:1,repeat:0},{name:"formula.functionList.DAVERAGE.functionParameter.field.name",detail:"formula.functionList.DAVERAGE.functionParameter.field.detail",example:"D4",require:1,repeat:0},{name:"formula.functionList.DAVERAGE.functionParameter.criteria.name",detail:"formula.functionList.DAVERAGE.functionParameter.criteria.detail",example:"A1:B2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATABASE.DCOUNT,functionType:t.FunctionType.Database,description:"formula.functionList.DCOUNT.description",abstract:"formula.functionList.DCOUNT.abstract",functionParameter:[{name:"formula.functionList.DCOUNT.functionParameter.database.name",detail:"formula.functionList.DCOUNT.functionParameter.database.detail",example:"A4:E10",require:1,repeat:0},{name:"formula.functionList.DCOUNT.functionParameter.field.name",detail:"formula.functionList.DCOUNT.functionParameter.field.detail",example:"D4",require:1,repeat:0},{name:"formula.functionList.DCOUNT.functionParameter.criteria.name",detail:"formula.functionList.DCOUNT.functionParameter.criteria.detail",example:"A1:B2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATABASE.DCOUNTA,functionType:t.FunctionType.Database,description:"formula.functionList.DCOUNTA.description",abstract:"formula.functionList.DCOUNTA.abstract",functionParameter:[{name:"formula.functionList.DCOUNTA.functionParameter.database.name",detail:"formula.functionList.DCOUNTA.functionParameter.database.detail",example:"A4:E10",require:1,repeat:0},{name:"formula.functionList.DCOUNTA.functionParameter.field.name",detail:"formula.functionList.DCOUNTA.functionParameter.field.detail",example:"D4",require:1,repeat:0},{name:"formula.functionList.DCOUNTA.functionParameter.criteria.name",detail:"formula.functionList.DCOUNTA.functionParameter.criteria.detail",example:"A1:B2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATABASE.DGET,functionType:t.FunctionType.Database,description:"formula.functionList.DGET.description",abstract:"formula.functionList.DGET.abstract",functionParameter:[{name:"formula.functionList.DGET.functionParameter.database.name",detail:"formula.functionList.DGET.functionParameter.database.detail",example:"A4:E10",require:1,repeat:0},{name:"formula.functionList.DGET.functionParameter.field.name",detail:"formula.functionList.DGET.functionParameter.field.detail",example:"D4",require:1,repeat:0},{name:"formula.functionList.DGET.functionParameter.criteria.name",detail:"formula.functionList.DGET.functionParameter.criteria.detail",example:"A1:B2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATABASE.DMAX,functionType:t.FunctionType.Database,description:"formula.functionList.DMAX.description",abstract:"formula.functionList.DMAX.abstract",functionParameter:[{name:"formula.functionList.DMAX.functionParameter.database.name",detail:"formula.functionList.DMAX.functionParameter.database.detail",example:"A4:E10",require:1,repeat:0},{name:"formula.functionList.DMAX.functionParameter.field.name",detail:"formula.functionList.DMAX.functionParameter.field.detail",example:"D4",require:1,repeat:0},{name:"formula.functionList.DMAX.functionParameter.criteria.name",detail:"formula.functionList.DMAX.functionParameter.criteria.detail",example:"A1:B2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATABASE.DMIN,functionType:t.FunctionType.Database,description:"formula.functionList.DMIN.description",abstract:"formula.functionList.DMIN.abstract",functionParameter:[{name:"formula.functionList.DMIN.functionParameter.database.name",detail:"formula.functionList.DMIN.functionParameter.database.detail",example:"A4:E10",require:1,repeat:0},{name:"formula.functionList.DMIN.functionParameter.field.name",detail:"formula.functionList.DMIN.functionParameter.field.detail",example:"D4",require:1,repeat:0},{name:"formula.functionList.DMIN.functionParameter.criteria.name",detail:"formula.functionList.DMIN.functionParameter.criteria.detail",example:"A1:B2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATABASE.DPRODUCT,functionType:t.FunctionType.Database,description:"formula.functionList.DPRODUCT.description",abstract:"formula.functionList.DPRODUCT.abstract",functionParameter:[{name:"formula.functionList.DPRODUCT.functionParameter.database.name",detail:"formula.functionList.DPRODUCT.functionParameter.database.detail",example:"A4:E10",require:1,repeat:0},{name:"formula.functionList.DPRODUCT.functionParameter.field.name",detail:"formula.functionList.DPRODUCT.functionParameter.field.detail",example:"D4",require:1,repeat:0},{name:"formula.functionList.DPRODUCT.functionParameter.criteria.name",detail:"formula.functionList.DPRODUCT.functionParameter.criteria.detail",example:"A1:B2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATABASE.DSTDEV,functionType:t.FunctionType.Database,description:"formula.functionList.DSTDEV.description",abstract:"formula.functionList.DSTDEV.abstract",functionParameter:[{name:"formula.functionList.DSTDEV.functionParameter.database.name",detail:"formula.functionList.DSTDEV.functionParameter.database.detail",example:"A4:E10",require:1,repeat:0},{name:"formula.functionList.DSTDEV.functionParameter.field.name",detail:"formula.functionList.DSTDEV.functionParameter.field.detail",example:"D4",require:1,repeat:0},{name:"formula.functionList.DSTDEV.functionParameter.criteria.name",detail:"formula.functionList.DSTDEV.functionParameter.criteria.detail",example:"A1:B2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATABASE.DSTDEVP,functionType:t.FunctionType.Database,description:"formula.functionList.DSTDEVP.description",abstract:"formula.functionList.DSTDEVP.abstract",functionParameter:[{name:"formula.functionList.DSTDEVP.functionParameter.database.name",detail:"formula.functionList.DSTDEVP.functionParameter.database.detail",example:"A4:E10",require:1,repeat:0},{name:"formula.functionList.DSTDEVP.functionParameter.field.name",detail:"formula.functionList.DSTDEVP.functionParameter.field.detail",example:"D4",require:1,repeat:0},{name:"formula.functionList.DSTDEVP.functionParameter.criteria.name",detail:"formula.functionList.DSTDEVP.functionParameter.criteria.detail",example:"A1:B2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATABASE.DSUM,functionType:t.FunctionType.Database,description:"formula.functionList.DSUM.description",abstract:"formula.functionList.DSUM.abstract",functionParameter:[{name:"formula.functionList.DSUM.functionParameter.database.name",detail:"formula.functionList.DSUM.functionParameter.database.detail",example:"A4:E10",require:1,repeat:0},{name:"formula.functionList.DSUM.functionParameter.field.name",detail:"formula.functionList.DSUM.functionParameter.field.detail",example:"D4",require:1,repeat:0},{name:"formula.functionList.DSUM.functionParameter.criteria.name",detail:"formula.functionList.DSUM.functionParameter.criteria.detail",example:"A1:B2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATABASE.DVAR,functionType:t.FunctionType.Database,description:"formula.functionList.DVAR.description",abstract:"formula.functionList.DVAR.abstract",functionParameter:[{name:"formula.functionList.DVAR.functionParameter.database.name",detail:"formula.functionList.DVAR.functionParameter.database.detail",example:"A4:E10",require:1,repeat:0},{name:"formula.functionList.DVAR.functionParameter.field.name",detail:"formula.functionList.DVAR.functionParameter.field.detail",example:"D4",require:1,repeat:0},{name:"formula.functionList.DVAR.functionParameter.criteria.name",detail:"formula.functionList.DVAR.functionParameter.criteria.detail",example:"A1:B2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATABASE.DVARP,functionType:t.FunctionType.Database,description:"formula.functionList.DVARP.description",abstract:"formula.functionList.DVARP.abstract",functionParameter:[{name:"formula.functionList.DVARP.functionParameter.database.name",detail:"formula.functionList.DVARP.functionParameter.database.detail",example:"A4:E10",require:1,repeat:0},{name:"formula.functionList.DVARP.functionParameter.field.name",detail:"formula.functionList.DVARP.functionParameter.field.detail",example:"D4",require:1,repeat:0},{name:"formula.functionList.DVARP.functionParameter.criteria.name",detail:"formula.functionList.DVARP.functionParameter.criteria.detail",example:"A1:B2",require:1,repeat:0}]}],He=[{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}]}],Ye=[{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}]}],we=[{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:"39508",require:1,repeat:0},{name:"formula.functionList.ACCRINT.functionParameter.firstInterest.name",detail:"formula.functionList.ACCRINT.functionParameter.firstInterest.detail",example:"39691",require:1,repeat:0},{name:"formula.functionList.ACCRINT.functionParameter.settlement.name",detail:"formula.functionList.ACCRINT.functionParameter.settlement.detail",example:"39569",require:1,repeat:0},{name:"formula.functionList.ACCRINT.functionParameter.rate.name",detail:"formula.functionList.ACCRINT.functionParameter.rate.detail",example:"0.1",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:"0.1",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:"39679",require:1,repeat:0},{name:"formula.functionList.AMORLINC.functionParameter.firstPeriod.name",detail:"formula.functionList.AMORLINC.functionParameter.firstPeriod.detail",example:"39813",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:"0.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:"0.09/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:"0.09/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:"0.08",require:1,repeat:0},{name:"formula.functionList.DURATION.functionParameter.yld.name",detail:"formula.functionList.DURATION.functionParameter.yld.detail",example:"0.09",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:"0.0525",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:"0.06/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:"0.1/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:"0.1",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:"0.08",require:1,repeat:0},{name:"formula.functionList.MDURATION.functionParameter.yld.name",detail:"formula.functionList.MDURATION.functionParameter.yld.detail",example:"0.09",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:"0.1",require:1,repeat:0},{name:"formula.functionList.MIRR.functionParameter.reinvestRate.name",detail:"formula.functionList.MIRR.functionParameter.reinvestRate.detail",example:"0.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:"0.053543",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:"0.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:"0.1",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:"0.0785",require:1,repeat:0},{name:"formula.functionList.ODDFPRICE.functionParameter.yld.name",detail:"formula.functionList.ODDFPRICE.functionParameter.yld.detail",example:"0.0625",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:"0.0575",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-11-11"',require:1,repeat:0},{name:"formula.functionList.ODDLPRICE.functionParameter.maturity.name",detail:"formula.functionList.ODDLPRICE.functionParameter.maturity.detail",example:'"2021-3-1"',require:1,repeat:0},{name:"formula.functionList.ODDLPRICE.functionParameter.lastInterest.name",detail:"formula.functionList.ODDLPRICE.functionParameter.lastInterest.detail",example:'"2009-3-1"',require:1,repeat:0},{name:"formula.functionList.ODDLPRICE.functionParameter.rate.name",detail:"formula.functionList.ODDLPRICE.functionParameter.rate.detail",example:"0.0785",require:1,repeat:0},{name:"formula.functionList.ODDLPRICE.functionParameter.yld.name",detail:"formula.functionList.ODDLPRICE.functionParameter.yld.detail",example:"0.0625",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:"1",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-11-11"',require:1,repeat:0},{name:"formula.functionList.ODDLYIELD.functionParameter.maturity.name",detail:"formula.functionList.ODDLYIELD.functionParameter.maturity.detail",example:'"2021-3-1"',require:1,repeat:0},{name:"formula.functionList.ODDLYIELD.functionParameter.lastInterest.name",detail:"formula.functionList.ODDLYIELD.functionParameter.lastInterest.detail",example:'"2008-10-15"',require:1,repeat:0},{name:"formula.functionList.ODDLYIELD.functionParameter.rate.name",detail:"formula.functionList.ODDLYIELD.functionParameter.rate.detail",example:"0.0575",require:1,repeat:0},{name:"formula.functionList.ODDLYIELD.functionParameter.pr.name",detail:"formula.functionList.ODDLYIELD.functionParameter.pr.detail",example:"84.5",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:"0.025",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:"0.08/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:"0.1/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:"0.0785",require:1,repeat:0},{name:"formula.functionList.PRICE.functionParameter.yld.name",detail:"formula.functionList.PRICE.functionParameter.yld.detail",example:"0.0625",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:"0.0625",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:"0.0785",require:1,repeat:0},{name:"formula.functionList.PRICEMAT.functionParameter.yld.name",detail:"formula.functionList.PRICEMAT.functionParameter.yld.detail",example:"0.0625",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:"0.02",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:"0.0575",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:"0.0914",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:"0.0914",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:"0.1",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:"0.0785",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:"0.0785",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}]}],Xe=[{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}]}],We=[{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}]}],Ke=[{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}]}],ge=[{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}]}],ke=[{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}]}],Qe=[{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}]}],je=[],$e=[{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}]}],ze=[...we,...He,...ge,...ke,...Ke,...Ge,...Qe,...We,...Xe,...Ye,...Ve,...ve,...$e,...Be,...je];function Ze(r,e){let a="";return r.aliasFunctionName?(a=e.t(r.aliasFunctionName),a===r.aliasFunctionName&&(a=r.functionName)):a=r.functionName,a}var Je=Object.getOwnPropertyDescriptor,ta=(r,e,a,n)=>{for(var i=n>1?void 0:n?Je(e,a):e,o=r.length-1,u;o>=0;o--)(u=r[o])&&(i=u(i)||i);return i},Rt=(r,e)=>(a,n)=>e(a,n,r);const ut=f.createIdentifier("formula.description-service");N.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}=o;u.toLocaleUpperCase().indexOf(i)===0&&a.push({name:u,desc:c})}),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=ze.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:Ze(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)}},N.DescriptionService=ta([Rt(0,t.IFunctionService),Rt(1,f.Inject(f.LocaleService)),Rt(2,f.IConfigService)],N.DescriptionService);var ea=Object.getOwnPropertyDescriptor,aa=(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},ct=(r,e)=>(a,n)=>e(a,n,r);function Vt(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,d=t.deserializeRangeWithSheetWithCache(l),{sheetName:T,unitId:P}=d;let L=d.range;L.startAbsoluteRefType===f.AbsoluteRefType.ALL&&L.endAbsoluteRefType===f.AbsoluteRefType.ALL||(L=f.moveRangeByOffset(L,a,n),o.push({unitId:P,sheetName:T,range:L}))}return o.map(u=>`${u.unitId}!${u.sheetName}!${u.range.startRow}!${u.range.endRow}!${u.range.startColumn}!${u.range.endColumn}`).join("|")}N.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(),d=o==null?void 0:o.map(T=>{if(typeof T=="object"&&T.nodeType===t.sequenceNodeType.REFERENCE){const P=t.deserializeRangeWithSheetWithCache(T.token),{range:L,unitId:S,sheetName:C}=P,R=this._univerInstanceService.getUnit(S||e),p=C?R==null?void 0:R.getSheetBySheetName(C):R==null?void 0:R.getSheetBySheetId(a);if(!p)throw new Error("Sheet not found");const I=R.getUnitId(),A=p.getSheetId();if(I!==m||A!==l)return T;const E=s.handleDefaultRangeChangeWithEffectRefCommands(L,i);let M="";if(E){const D=E.startColumn-L.startColumn,q=E.startRow-L.startRow,b=f.moveRangeByOffset(L,D,q);S&&C?M=t.serializeRangeWithSpreadsheet(S,C,b):C?M=t.serializeRangeWithSheet(C,b):M=t.serializeRange(b)}else M=t.ErrorType.REF;return{...T,token:M}}else return T});return d?`=${t.generateStringWithSequence(d)}`:""}registerFormula(e,a,n,i){const o=new Map,u=this._lexerTreeBuilder.sequenceNodesBuilder(n),c=new f.DisposableCollection,m=l=>{const d=this._univerInstanceService.getCurrentUnitForType(f.UniverInstanceType.UNIVER_SHEET),T=d.getActiveSheet(),P=d.getUnitId(),L=T.getSheetId(),S=u==null?void 0:u.map(R=>{if(typeof R=="object"&&R.nodeType===t.sequenceNodeType.REFERENCE){const p=o.get(R.token);if(p.unitId!==P||p.subUnitId!==L)return R;const I=s.handleDefaultRangeChangeWithEffectRefCommands(p.range,l);let A="";if(I){const E=I.startColumn-p.range.startColumn,M=I.startRow-p.range.startRow,D=f.moveRangeByOffset(p.range,E,M);p.unitId&&p.sheetName?A=t.serializeRangeWithSpreadsheet(p.unitId,p.sheetName,D):p.sheetName?A=t.serializeRangeWithSheet(p.sheetName,D):A=t.serializeRange(D)}else A=t.ErrorType.REF;return{...R,token:A}}else return R}),C=S&&t.generateStringWithSequence(S);return i(`=${C}`)};return u==null||u.forEach(l=>{if(typeof l=="object"&&l.nodeType===t.sequenceNodeType.REFERENCE){const d=t.deserializeRangeWithSheetWithCache(l.token),{range:T,unitId:P,sheetName:L}=d,S=this._univerInstanceService.getUnit(P||e),C=L?S==null?void 0:S.getSheetBySheetName(L):S==null?void 0:S.getSheetBySheetId(a);if(!C)return;const R=S.getUnitId(),p=C.getSheetId(),I={unitId:R,subUnitId:p,range:T,sheetName:L};o.set(l.token,I),c.add(this._refRangeService.registerRefRange(T,m,R,p))}}),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:d,sheetName:T}=m;if(l.startAbsoluteRefType===f.AbsoluteRefType.ALL&&l.endAbsoluteRefType===f.AbsoluteRefType.ALL)return;const P=this._univerInstanceService.getUnit(d||e),L=T?P==null?void 0:P.getSheetBySheetName(T):P==null?void 0:P.getSheetBySheetId(a);if(!L)return;const S=P.getUnitId(),C=L.getSheetId(),R=i[0].startRow,p=i[0].startColumn,I=l.startRow,A=l.startColumn,E=i.map(M=>({startRow:M.startRow-R+I,endRow:M.endRow-R+I,startColumn:M.startColumn-p+A,endColumn:M.endColumn-p+A}));u.push({unitId:S,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 d=n[0].startRow,T=n[0].startColumn,P=[{unitId:e,subUnitId:a,ranges:n},...c.flat()],L=[],S=s.getSeparateEffectedRangesOnCommand(this._injector,l);for(const{unitId:C,subUnitId:R,ranges:p}of P)if(C===S.unitId&&R===S.subUnitId){const I=[],A=p[0].startRow,E=p[0].startColumn,M=A-d,D=E-T;for(const q of S.ranges){const b=p.map(x=>f.getIntersectRange(q,x)).filter(Boolean);b.length>0&&I.push(...b)}I.length>0&&L.push(I.map(q=>({startRow:q.startRow-M,endRow:q.endRow-M,startColumn:q.startColumn-D,endColumn:q.endColumn-D})))}if(L.length>0){const C=f.Rectangle.splitIntoGrid([...L.flat()]),R=f.Rectangle.subtractMulti(n,C);R.sort((M,D)=>M.startRow-D.startRow||M.startColumn-D.startColumn);const p=new Map;for(let M=0;M<C.length;M++){const D=C[M],q=D.startRow,b=D.startColumn,x=q-d,_=b-T,U=s.handleCommonDefaultRangeChangeWithEffectRefCommands(D,l).sort((B,W)=>B.startRow-W.startRow||B.startColumn-W.startColumn);if(!U.length)continue;const F=U[0].startRow,O=U[0].startColumn,v=F-d,J=O-T,tt=[];for(let B=0;B<i.length;B++){const W=i[B],G=f.isFormulaString(W),Pt=G?this._lexerTreeBuilder.moveFormulaRefOffset(W,_,x):W,K=G?this.transformFormulaByEffectCommand(e,a,Pt,l):Pt,et=Vt(this._lexerTreeBuilder,K,-J,-v);tt.push({newFormula:K,orginFormula:et})}const X={formulas:tt,ranges:U,key:tt.map(B=>B.orginFormula).join("_")};p.has(X.key)?p.get(X.key).push(X):p.set(X.key,[X])}const I=i.map(M=>Vt(this._lexerTreeBuilder,M,0,0)).join("_");if(R.length>0){const M=R[0].startRow,D=R[0].startColumn,q=[];for(let x=0;x<i.length;x++){const _=i[x];q.push({newFormula:f.isFormulaString(_)?this._lexerTreeBuilder.moveFormulaRefOffset(_,D-T,M-d):_,orginFormula:_})}const b={formulas:q,ranges:R,key:I};p.has(b.key)?p.get(b.key).push(b):p.set(b.key,[b])}const A=[],E=Array.from(p.keys());for(let M=E.length-1;M>=0;M--){const D=E[M],q=p.get(D).sort((_,U)=>_.ranges[0].startRow-U.ranges[0].startRow||_.ranges[0].startColumn-U.ranges[0].startColumn),b=[];for(let _=0;_<q[0].formulas.length;_++)b.push(q[0].formulas[_].newFormula);const x=f.Rectangle.mergeRanges(q.map(_=>_.ranges).flat());x.sort((_,U)=>_.startRow-U.startRow||_.startColumn-U.startColumn),A.push({formulas:b,ranges:x})}return o(A)}return{undos:[],redos:[]}};return n.forEach(l=>{const d=this._refRangeService.registerRefRange(l,m,e,a);u.add(d)}),[...c.flat()].forEach(({unitId:l,subUnitId:d,ranges:T})=>{T.forEach(P=>{const L=this._refRangeService.registerRefRange(P,m,l,d);u.add(L)})}),u}},N.FormulaRefRangeService=aa([ct(0,f.Inject(s.RefRangeService)),ct(1,f.Inject(t.LexerTreeBuilder)),ct(2,f.IUniverInstanceService),ct(3,f.Inject(f.Injector))],N.FormulaRefRangeService);var na=Object.getOwnPropertyDescriptor,ia=(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},ra=(r,e)=>(a,n)=>e(a,n,r);const Ot="sheets-formula.remote-register-function.service",Mt=f.createIdentifier(Ot);N.RemoteRegisterFunctionService=class{constructor(e){this._functionService=e}async registerFunctions(e){const a=e.map(([n,i])=>oa(n,i));this._functionService.registerExecutors(...a)}async registerAsyncFunctions(e){const a=e.map(([n,i])=>ua(n,i));this._functionService.registerExecutors(...a)}async unregisterFunctions(e){this._functionService.unregisterExecutors(...e),this._functionService.unregisterDescriptions(...e),this._functionService.deleteFormulaAstCacheKey(...e)}},N.RemoteRegisterFunctionService=ia([ra(0,t.IFunctionService)],N.RemoteRegisterFunctionService);function oa(r,e){const a=new t.CustomFunction(e),n=new Function(`return ${r}`)();return a.calculateCustom=n,a}function ua(r,e){const a=new t.AsyncCustomFunction(e),n=new Function(`return ${r}`)();return a.calculateCustom=n,a}var ca=Object.getOwnPropertyDescriptor,fa=(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},ft=(r,e)=>(a,n)=>e(a,n,r);const Gt=f.createIdentifier("sheets-formula.register-function-service");N.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))}},N.RegisterFunctionService=fa([ft(0,f.Inject(f.LocaleService)),ft(1,f.Inject(ut)),ft(2,t.IFunctionService),ft(3,f.Optional(Mt))],N.RegisterFunctionService);const ma="SHEETS_FORMULA_PLUGIN";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},_t=(r,e)=>(a,n)=>e(a,n,r);let mt=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 d=null;const{startRow:T,endRow:P,startColumn:L,endColumn:S}=i;e===!0?d=this._rangeToMatrix({startRow:T,startColumn:0,endRow:P,endColumn:l-1}):d=this._rangeToMatrix({startRow:0,startColumn:L,endRow:m,endColumn:S});const C=d.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,d)=>{m.forValue((T,P,L)=>{if(L==null)return!0;const{startRow:S,startColumn:C,endRow:R,endColumn:p}=L;l>=S&&l<=R&&d>=C&&d<=p&&n.push({unitId:r,sheetId:e,range:{startRow:S,startColumn:C,endRow:S,endColumn:C}})})})}return n}};mt=la([_t(0,t.IActiveDirtyManagerService),_t(1,f.IUniverInstanceService),_t(2,f.Inject(t.FormulaDataModel))],mt);var pa=Object.getOwnPropertyDescriptor,da=(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},st=(r,e)=>(a,n)=>e(a,n,r);let lt=class extends f.Disposable{constructor(r,e,a,n){super(),this._commandService=r,this._configService=e,this._sheetInterceptorService=a,this._formulaDataModel=n,this._initialize()}_initialize(){this._commandExecutedListener(),this._initInterceptorCellContent()}_commandExecutedListener(){this.disposeWithMe(this._commandService.onCommandExecuted(r=>{var i;if(r.id!==t.SetArrayFormulaDataMutation.id)return;const e=r.params;if(e==null)return;const{arrayFormulaRange:a,arrayFormulaCellData:n}=e;this._formulaDataModel.setArrayFormulaRange(a),this._formulaDataModel.setArrayFormulaCellData(n),(i=this._configService.getConfig(Z))!=null&&i.writeArrayFormulaToSnapshot&&this._writeArrayFormulaToSnapshot(a,n)}))}_writeArrayFormulaToSnapshot(r,e){Object.entries(r).forEach(([a,n])=>{n&&Array.from(Object.entries(n)).forEach(([i,o])=>{const u=new f.ObjectMatrix;new f.ObjectMatrix(o).forValue((m,l,d)=>{u.setValue(m,l,{ref:t.serializeRange(d)})}),this._commandService.executeCommand(s.SetRangeValuesMutation.id,{unitId:a,subUnitId:i,cellValue:u.getMatrix()},{onlyLocal:!0})})}),Array.from(Object.entries(e)).forEach(([a,n])=>{n&&Array.from(Object.entries(n)).forEach(([i,o])=>{this._commandService.executeCommand(s.SetRangeValuesMutation.id,{unitId:a,subUnitId:i,cellValue:o},{onlyLocal:!0})})})}_initInterceptorCellContent(){this.disposeWithMe(this._sheetInterceptorService.intercept(s.INTERCEPTOR_POINT.CELL_CONTENT,{priority:100,effect:f.InterceptorEffectEnum.Value,handler:(r,e,a)=>{var d,T,P;let n=r;const{unitId:i,subUnitId:o,row:u,col:c}=e,m=this._formulaDataModel.getArrayFormulaCellData(),l=(P=(T=(d=m==null?void 0:m[i])==null?void 0:d[o])==null?void 0:T[u])==null?void 0:P[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)))}}))}};lt=da([st(0,f.ICommandService),st(1,f.IConfigService),st(2,f.Inject(s.SheetInterceptorService)),st(3,f.Inject(t.FormulaDataModel))],lt);var La=Object.getOwnPropertyDescriptor,Ta=(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},pt=(r,e)=>(a,n)=>e(a,n,r);let dt=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)}};dt=Ta([pt(0,ut),pt(1,t.IDefinedNamesService),pt(2,f.IUniverInstanceService),pt(3,f.ICommandService)],dt);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},Ea=(r,e)=>(a,n)=>e(a,n,r);let Lt=class extends f.Disposable{constructor(r){super(),this._commandService=r,[Dt,bt,Q].forEach(e=>this._commandService.registerCommand(e))}};Lt=Pa([Ea(0,f.ICommandService)],Lt);var Ia=Object.defineProperty,Aa=Object.getOwnPropertyDescriptor,Sa=(r,e,a)=>e in r?Ia(r,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):r[e]=a,Ht=(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},Tt=(r,e)=>(a,n)=>e(a,n,r),Nt=(r,e,a)=>Sa(r,typeof e!="symbol"?e+"":e,a);N.UniverRemoteSheetsFormulaPlugin=class extends f.Plugin{constructor(e=Bt,a,n){super(),this._config=e,this._injector=a,this._configService=n;const{...i}=f.merge({},Bt,this._config);this._configService.setConfig(ye,i)}onStarting(){this._injector.add([N.RemoteRegisterFunctionService]),this._injector.get(it.IRPCChannelService).registerChannel(Ot,it.fromModule(this._injector.get(N.RemoteRegisterFunctionService)))}},Nt(N.UniverRemoteSheetsFormulaPlugin,"pluginName","SHEET_FORMULA_REMOTE_PLUGIN"),Nt(N.UniverRemoteSheetsFormulaPlugin,"type",f.UniverInstanceType.UNIVER_SHEET),N.UniverRemoteSheetsFormulaPlugin=Ht([f.DependentOn(t.UniverFormulaEnginePlugin),Tt(1,f.Inject(f.Injector)),Tt(2,f.IConfigService)],N.UniverRemoteSheetsFormulaPlugin),N.UniverSheetsFormulaPlugin=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(Z,i,{merge:!0})}onStarting(){const e=this._injector,a=[[Gt,{useClass:N.RegisterFunctionService}],[ut,{useClass:N.DescriptionService}],[Lt],[N.FormulaRefRangeService],[N.RegisterOtherFormulaService],[lt],[N.TriggerCalculationController],[N.UpdateFormulaController],[mt],[dt],[N.UpdateDefinedNameController]];if(this._config.notExecuteFormula){const n=e.get(it.IRPCChannelService);a.push([Mt,{useFactory:()=>it.toModule(n.requestChannel(Ot))}])}a.forEach(n=>e.add(n))}onReady(){f.touchDependencies(this._injector,[[Lt],[mt],[lt],[N.UpdateFormulaController],[N.UpdateDefinedNameController]]),f.isNodeEnv()&&f.touchDependencies(this._injector,[[N.TriggerCalculationController]])}onRendered(){f.touchDependencies(this._injector,[[dt]]),f.isNodeEnv()||f.touchDependencies(this._injector,[[N.TriggerCalculationController]])}},Nt(N.UniverSheetsFormulaPlugin,"pluginName",ma),Nt(N.UniverSheetsFormulaPlugin,"type",f.UniverInstanceType.UNIVER_SHEET),N.UniverSheetsFormulaPlugin=Ht([f.DependentOn(t.UniverFormulaEnginePlugin,s.UniverSheetsPlugin),Tt(1,f.Inject(f.Injector)),Tt(2,f.IConfigService)],N.UniverSheetsFormulaPlugin),N.CalculationMode=Y,N.IDescriptionService=ut,N.IRegisterFunctionService=Gt,N.IRemoteRegisterFunctionService=Mt,N.InsertFunctionCommand=Dt,N.OtherFormulaMarkDirty=Q,N.PLUGIN_CONFIG_KEY_BASE=Z,N.QuickSumCommand=bt,N.calculateFormula=qe,Object.defineProperty(N,Symbol.toStringTag,{value:"Module"})});
48
+ (function(I,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):(I=typeof globalThis<"u"?globalThis:I||self,f(I.UniverSheetsFormula={},I.UniverCore,I.UniverSheets,I.UniverEngineFormula,I.rxjs,I.UniverRpc))})(this,function(I,f,m,t,H,it){"use strict";var Ca=Object.defineProperty;var Ra=(I,f,m)=>f in I?Ca(I,f,{enumerable:!0,configurable:!0,writable:!0,value:m}):I[f]=m;var h=(I,f,m)=>Ra(I,typeof f!="symbol"?f+"":f,m);const Dt={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:s,primary:l,formula:d}=c,{row:T,column:L}=l,P=f.Tools.generateRandomId(6);o.setValue(T,L,{f:d,si:P});const{startRow:S,startColumn:C,endRow:p,endColumn:E}=s;for(let A=S;A<=p;A++)for(let N=C;N<=E;N++)(A!==T||N!==L)&&o.setValue(A,N,{si:P})}),n&&n.length>0&&n.forEach(c=>{const{primary:s,formula:l}=c;o.setValue(s.row,s.column,{f:l})});const u={value:o.getData()};return i.executeCommand(m.SetRangeValuesCommand.id,u)}},bt={id:"sheets-formula.command.quick-sum",type:f.CommandType.COMMAND,handler:async r=>{const a=r.get(m.SheetsSelectionsService).getCurrentLastSelection();if(!a)return!1;const n=r.get(f.IUniverInstanceService),i=m.getSheetCommandTarget(n);if(!i)return!1;const o=a.range,{worksheet:u}=i;let c=m.findFirstNonEmptyCell(o,u);if(!c)return!1;c=m.alignToMergedCellsBorders(c,u);const s=m.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,d=m.alignToMergedCellsBorders({startRow:s.endRow,endRow:s.endRow,startColumn:s.startColumn,endColumn:s.endColumn},u);if(!f.Rectangle.equals(d,s))for(const P of u.iterateByColumn(d))(!P.value||!u.cellHasValue(P.value))&&l.setValue(P.row,P.col,{f:`=SUM(${t.serializeRange({startColumn:P.col,endColumn:P.col,startRow:s.startRow,endRow:P.row-1})})`});const T=m.alignToMergedCellsBorders({startRow:s.startRow,startColumn:s.endColumn,endRow:s.endRow,endColumn:s.endColumn},u);if(!f.Rectangle.equals(T,s))for(const P of u.iterateByRow(T))(!P.value||!u.cellHasValue(P.value))&&l.setValue(P.row,P.col,{f:`=SUM(${t.serializeRange({startColumn:s.startColumn,endColumn:P.col-1,startRow:P.row,endRow:P.row})})`});const L=r.get(f.ICommandService);return(await f.sequenceExecuteAsync([{id:m.SetRangeValuesCommand.id,params:{range:s,value:l.getMatrix()}},{id:m.SetSelectionsOperation.id,params:{unitId:i.unitId,subUnitId:i.subUnitId,selections:[{range:s,primary:f.Rectangle.contains(s,a.primary)?a.primary:{...c,actualRow:c.startRow,actualColumn:c.startColumn},style:null}]}}],L)).result}},Q={type:f.CommandType.MUTATION,id:"sheet.mutation.data-validation-formula-mark-dirty",handler(){return!0}};function Yt(r,e,a){var n;return r==null||r[e]==null||((n=r[e])==null?void 0:n[a])==null}function Et(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 Xt=[11,12,13,14];function wt(r,e,a){const{type:n}=a;return Xt.includes(n)?Wt(r,e):Kt(r,e,a)}function Wt(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 s=new f.ObjectMatrix(o[c]||{}),l=new f.ObjectMatrix(u[c]||{}),d=new f.ObjectMatrix,T=new f.ObjectMatrix;if(s.forValue((p,E,A)=>{if(A==null)return!0;const N=rt(A);N!==null&&(d.setValue(p,E,N),T.setValue(p,E,l.getValue(p,E)))}),d.getSizeOf()===0)return;const L={subUnitId:c,unitId:i,cellValue:d.getMatrix()},P={id:m.SetRangeValuesMutation.id,params:L};n.push(P);const S={subUnitId:c,unitId:i,cellValue:T.getMatrix()},C={id:m.SetRangeValuesMutation.id,params:S};a.push(C)})}),{undos:a,redos:n}}function Kt(r,e,a){const{redoFormulaData:n,undoFormulaData:i}=gt(r,e,a);if(f.Tools.diffValue(n,i))return{undos:[],redos:[]};const o=[],u=[];return Object.keys(n).forEach(c=>{Object.keys(n[c]).forEach(s=>{if(Object.keys(n[c][s]).length!==0){const l={subUnitId:s,unitId:c,cellValue:n[c][s]},d={id:m.SetRangeValuesMutation.id,params:l};o.push(d)}})}),Object.keys(i).forEach(c=>{Object.keys(i[c]).forEach(s=>{if(Object.keys(i[c][s]).length!==0){const l={subUnitId:s,unitId:c,cellValue:i[c][s]},d={id:m.SetRangeValuesMutation.id,params:l};u.push(d)}})}),{undos:u,redos:o}}function gt(r,e,a){const n={},i={},{type:o,unitId:u,sheetId:c,range:s,from:l,to:d}=a;return new Set([...Object.keys(r),...Object.keys(e)]).forEach(L=>{if(Yt(r,L,c))return;new Set([...Object.keys(r[L]||{}),...Object.keys(e[L]||{})]).forEach(S=>{var x,q;const C=(x=r[L])==null?void 0:x[S],p=(q=e[L])==null?void 0:q[S],E=new f.ObjectMatrix(C||{}),A=new f.ObjectMatrix(p||{});let N=[];L!==u||S!==c?N=Qt(A):N=kt(E,o,l,d,s);const _=ce(N,E,A),R=fe(N,E);n[L]||(n[L]={}),i[L]||(i[L]={}),n[L][S]={...n[L][S],..._},i[L][S]={...i[L][S],...R}})}),{redoFormulaData:n,undoFormulaData:i}}function kt(r,e,a,n,i){const o=[];return r.forValue((u,c,s)=>{if(s==null||!yt(s))return!0;const l=f.cellToRange(u,c);let d=null,T=!1;if([0,1,2].includes(e))d=jt(e,a,n,l);else if(i!=null){const L=$t(e,i,l);d=L.newCell,T=L.isReverse}T?o.unshift({oldCell:l,newCell:d}):o.push({oldCell:l,newCell:d})}),o}function Qt(r){const e=[];return r.forValue((a,n,i)=>{if(i==null||!yt(i))return!0;const o=f.cellToRange(a,n);e.push({oldCell:o,newCell:o})}),e}function jt(r,e,a,n){if(e==null||a==null)return null;switch(r){case 0:return zt(e,a,n);case 1:return Zt(e,a,n);case 2:return Jt(e,a,n);default:return null}}function $t(r,e,a){let n=null,i=!1;switch(r){case 3:n=te(e,a),i=!0;break;case 4:n=ee(e,a),i=!0;break;case 5:n=ae(e,a);break;case 6:n=ne(e,a);break;case 7:n=ie(e,a);break;case 8:n=re(e,a);break;case 9:n=oe(e,a),i=!0;break;case 10:n=ue(e,a),i=!0;break}return{newCell:n,isReverse:i}}function zt(r,e,a){const n=m.handleMoveRange({id:m.EffectRefRangId.MoveRangeCommandId,params:{toRange:e,fromRange:r}},a);return m.runRefRangeMutations(n,a)}function Zt(r,e,a){const n=m.handleMoveRows({id:m.EffectRefRangId.MoveRowsCommandId,params:{toRange:e,fromRange:r}},a);return m.runRefRangeMutations(n,a)}function Jt(r,e,a){const n=m.handleMoveCols({id:m.EffectRefRangId.MoveColsCommandId,params:{toRange:e,fromRange:r}},a);return m.runRefRangeMutations(n,a)}function te(r,e){const a=m.handleInsertRow({id:m.EffectRefRangId.InsertRowCommandId,params:{range:r,unitId:"",subUnitId:"",direction:f.Direction.DOWN}},e);return m.runRefRangeMutations(a,e)}function ee(r,e){const a=m.handleInsertCol({id:m.EffectRefRangId.InsertColCommandId,params:{range:r,unitId:"",subUnitId:"",direction:f.Direction.RIGHT}},e);return m.runRefRangeMutations(a,e)}function ae(r,e){const a=m.handleIRemoveRow({id:m.EffectRefRangId.RemoveRowCommandId,params:{range:r}},e);return m.runRefRangeMutations(a,e)}function ne(r,e){const a=m.handleIRemoveCol({id:m.EffectRefRangId.RemoveColCommandId,params:{range:r}},e);return m.runRefRangeMutations(a,e)}function ie(r,e){const a=m.handleDeleteRangeMoveLeft({id:m.EffectRefRangId.DeleteRangeMoveLeftCommandId,params:{range:r}},e);return m.runRefRangeMutations(a,e)}function re(r,e){const a=m.handleDeleteRangeMoveUp({id:m.EffectRefRangId.DeleteRangeMoveUpCommandId,params:{range:r}},e);return m.runRefRangeMutations(a,e)}function oe(r,e){const a=m.handleInsertRangeMoveDown({id:m.EffectRefRangId.InsertRangeMoveDownCommandId,params:{range:r}},e);return m.runRefRangeMutations(a,e)}function ue(r,e){const a=m.handleInsertRangeMoveRight({id:m.EffectRefRangId.InsertRangeMoveRightCommandId,params:{range:r}},e);return m.runRefRangeMutations(a,e)}function ce(r,e,a){const n=new f.ObjectMatrix({});return r.forEach(i=>{const{oldCell:o,newCell:u}=i,{startRow:c,startColumn:s}=o,l=a.getValue(c,s)||e.getValue(c,s),d=rt(l);if(n.setValue(c,s,{f:null,si:null}),u){const{startRow:T,startColumn:L}=u;n.setValue(T,L,d)}}),n.getMatrix()}function fe(r,e){const a=new f.ObjectMatrix({});return r.reverse().forEach(n=>{const{oldCell:i,newCell:o}=n,{startRow:u,startColumn:c}=i,s=e.getValue(u,c),l=rt(s);if(o){const{startRow:d,startColumn:T}=o;a.setValue(d,T,{f:null,si:null})}a.setValue(u,c,l)}),a.getMatrix()}function rt(r){if(r==null)return;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 me(r){const e=new f.ObjectMatrix({});return new f.ObjectMatrix(r).forValue((n,i,o)=>{const u=rt(o);u&&e.setValue(n,i,u)}),e.getMatrix()}function yt(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 xt(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 Ut(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:s}=c,l=t.deserializeRangeWithSheetWithCache(s),{range:d,sheetName:T,unitId:L}=l,P=f.Rectangle.moveOffset(d,a,n);i.push({...c,token:t.serializeRangeToRefString({range:P,unitId:L,sheetName:T})})}return i}function qt(r,e,a,n){const{type:i,unitId:o,sheetId:u,range:c,from:s,to:l}=e,{range:d,sheetId:T,unitId:L,sheetName:P,refOffsetX:S,refOffsetY:C}=r;if(!xt(o,u,a,n,L,T))return;const p=f.Rectangle.moveOffset(d,S,C);let E=null;if(i===b.MoveRange){if(s==null||l==null)return;const A=At(p,s),N=f.getIntersectRange(p,s);if(N==null||A!==4)return;const _=m.handleMoveRange({id:m.EffectRefRangId.MoveRangeCommandId,params:{toRange:l,fromRange:s}},N),R=m.runRefRangeMutations(_,N);if(R==null)return t.ErrorType.REF;E=It(A,R,s,l,p,N)}else if(i===b.MoveRows){if(s==null||l==null)return;const A=At(p,s);let N=f.getIntersectRange(p,s);if(N==null&&(s.endRow<p.startRow&&l.endRow<p.startRow||s.startRow>p.endRow&&l.startRow>p.endRow))return;N==null&&(N={startRow:p.startRow,endRow:p.endRow,startColumn:p.startColumn,endColumn:p.endColumn,rangeType:f.RANGE_TYPE.NORMAL});const _=m.handleMoveRows({id:m.EffectRefRangId.MoveRowsCommandId,params:{toRange:l,fromRange:s}},N),R=m.runRefRangeMutations(_,N);if(R==null)return t.ErrorType.REF;E=It(A,R,s,l,p,N)}else if(i===b.MoveCols){if(s==null||l==null)return;const A=At(p,s);let N=f.getIntersectRange(p,s);if(N==null&&(s.endColumn<p.startColumn&&l.endColumn<p.startColumn||s.startColumn>p.endColumn&&l.startColumn>p.endColumn))return;N==null&&(N={startRow:p.startRow,endRow:p.endRow,startColumn:p.startColumn,endColumn:p.endColumn,rangeType:f.RANGE_TYPE.NORMAL});const _=m.handleMoveCols({id:m.EffectRefRangId.MoveColsCommandId,params:{toRange:l,fromRange:s}},N),R=m.runRefRangeMutations(_,N);if(R==null)return t.ErrorType.REF;E=It(A,R,s,l,p,N)}if(c!=null){if(i===b.InsertRow){const A=m.handleInsertRow({id:m.EffectRefRangId.InsertRowCommandId,params:{range:c,unitId:"",subUnitId:"",direction:f.Direction.DOWN}},p),N=m.runRefRangeMutations(A,p);if(N==null)return;E={...p,...N}}else if(i===b.InsertColumn){const A=m.handleInsertCol({id:m.EffectRefRangId.InsertColCommandId,params:{range:c,unitId:"",subUnitId:"",direction:f.Direction.RIGHT}},p),N=m.runRefRangeMutations(A,p);if(N==null)return;E={...p,...N}}else if(i===b.RemoveRow){const A=m.handleIRemoveRow({id:m.EffectRefRangId.RemoveRowCommandId,params:{range:c}},p),N=m.runRefRangeMutations(A,p);if(N==null)return t.ErrorType.REF;E={...p,...N}}else if(i===b.RemoveColumn){const A=m.handleIRemoveCol({id:m.EffectRefRangId.RemoveColCommandId,params:{range:c}},p),N=m.runRefRangeMutations(A,p);if(N==null)return t.ErrorType.REF;E={...p,...N}}else if(i===b.DeleteMoveLeft){const A=m.handleDeleteRangeMoveLeft({id:m.EffectRefRangId.DeleteRangeMoveLeftCommandId,params:{range:c}},p),N=m.runRefRangeMutations(A,p);if(N==null)return t.ErrorType.REF;E={...p,...N}}else if(i===b.DeleteMoveUp){const A=m.handleDeleteRangeMoveUp({id:m.EffectRefRangId.DeleteRangeMoveUpCommandId,params:{range:c}},p),N=m.runRefRangeMutations(A,p);if(N==null)return t.ErrorType.REF;E={...p,...N}}else if(i===b.InsertMoveDown){const A=m.handleInsertRangeMoveDown({id:m.EffectRefRangId.InsertRangeMoveDownCommandId,params:{range:c}},p),N=m.runRefRangeMutations(A,p);if(N==null)return;E={...p,...N}}else if(i===b.InsertMoveRight){const A=m.handleInsertRangeMoveRight({id:m.EffectRefRangId.InsertRangeMoveRightCommandId,params:{range:c}},p),N=m.runRefRangeMutations(A,p);if(N==null)return;E={...p,...N}}}if(E!=null)return t.serializeRangeToRefString({range:E,sheetName:P,unitId:L})}function It(r,e,a,n,i,o){const{startRow:u,endRow:c,startColumn:s,endColumn:l,rangeType:d}=nt(e),{startRow:T,startColumn:L,endRow:P,endColumn:S,rangeType:C=f.RANGE_TYPE.NORMAL}=nt(a),{startRow:p,startColumn:E,endRow:A,endColumn:N}=nt(n),{startRow:_,endRow:R,startColumn:x,endColumn:q}=nt(o),{startRow:D,endRow:y,startColumn:M,endColumn:U,rangeType:F=f.RANGE_TYPE.NORMAL}=nt(i),O={...i};function v(){return d===f.RANGE_TYPE.COLUMN&&F===f.RANGE_TYPE.COLUMN?!0:s>=M&&l<=U}function J(){return d===f.RANGE_TYPE.ROW&&F===f.RANGE_TYPE.ROW?!0:u>=D&&c<=y}if(r===0)if(v())if(u<D)O.startRow=u;else if(u>=y)O.endRow-=P+1-D;else return;else return;else if(r===1)if(v())if(c>y)O.endRow=c;else if(c<=D)O.startRow+=y-T+1;else return;else return;else if(r===2)if(J())if(s<M)O.startColumn=s;else if(s>=U)O.endColumn-=S+1-M;else return;else return;else if(r===3)if(J())if(l>U)O.endColumn=l;else if(l<=M)O.startColumn+=U-L+1;else return;else return;else r===4?(O.startRow=u,O.startColumn=s,O.endRow=c,O.endColumn=l):L<=M&&S>=U||C===f.RANGE_TYPE.ROW&&F===f.RANGE_TYPE.ROW?a.endRow<D?(p>=D&&(O.startRow-=P-T+1),p>=y&&(O.endRow-=P-T+1)):a.startRow>y?(A<=y&&(O.endRow+=P-T+1),A<=D&&(O.startRow+=P-T+1)):a.startRow>=D&&a.endRow<=y&&(p<=D?O.startRow+=P-T+1:p>=y&&(O.endRow-=P-T+1)):T<=D&&P>=y||C===f.RANGE_TYPE.COLUMN&&F===f.RANGE_TYPE.COLUMN?a.endColumn<M?(E>=M&&(O.startColumn-=S-L+1),E>=U&&(O.endColumn-=S-L+1)):a.startColumn>U?(N<=U&&(O.endColumn+=S-L+1),N<=M&&(O.startColumn+=S-L+1)):a.startColumn>=M&&a.endColumn<=U&&(E<=M?O.startColumn+=S-L+1:E>=U&&(O.endColumn-=S-L+1)):((E<=q+1&&N>=U||E<=M&&N>=x-1)&&p<=D&&A>=y||(p<=R+1&&A>=y||p<=D&&A>=_-1)&&E<=M&&N>=U,O.startRow=u,O.startColumn=s,O.endRow=c,O.endColumn=l);return O}function At(r,e){const a=j(r.startRow),n=$(r.endRow),i=j(r.startColumn),o=$(r.endColumn),u=j(e.startRow),c=$(e.endRow),s=j(e.startColumn),l=$(e.endColumn);function d(){return r.rangeType===f.RANGE_TYPE.COLUMN&&e.rangeType===f.RANGE_TYPE.COLUMN?!0:a>=u&&n<=c}function T(){return r.rangeType===f.RANGE_TYPE.ROW&&e.rangeType===f.RANGE_TYPE.ROW?!0:i>=s&&o<=l}function L(){return r.rangeType===f.RANGE_TYPE.ALL&&e.rangeType===f.RANGE_TYPE.ALL}return d()&&T()||L()?4:T()&&a>=u&&a<=c&&n>c?0:T()&&n>=u&&n<=c&&a<u?1:d()&&i>=s&&i<=l&&o>l?2:d()&&o>=s&&o<=l&&i<s?3:null}function j(r){return isNaN(r)?-1/0:r}function $(r){return isNaN(r)?1/0:r}function nt(r){const{startRow:e,endRow:a,startColumn:n,endColumn:i}=r;return{...r,startRow:j(e),endRow:$(a),startColumn:j(n),endColumn:$(i)}}function ht(r,e){const{id:a}=e;let n=null;switch(a){case m.MoveRangeCommand.id:n=se(e,r);break;case m.MoveRowsCommand.id:n=le(e,r);break;case m.MoveColsCommand.id:n=pe(e,r);break;case m.InsertRowCommand.id:n=de(e);break;case m.InsertColCommand.id:n=Le(e);break;case m.InsertRangeMoveRightCommand.id:n=Te(e,r);break;case m.InsertRangeMoveDownCommand.id:n=Ne(e,r);break;case m.RemoveRowCommand.id:n=Pe(e,r);break;case m.RemoveColCommand.id:n=Ee(e,r);break;case m.DeleteRangeMoveUpCommand.id:n=Ie(e,r);break;case m.DeleteRangeMoveLeftCommand.id:n=Ae(e,r);break;case m.SetWorksheetNameCommand.id:n=Se(e,r);break;case m.RemoveSheetCommand.id:n=Ce(e,r);break;case m.SetDefinedNameCommand.id:n=Re(e,r);break;case m.RemoveDefinedNameCommand.id:n=Oe(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 se(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 le(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(),s=e.getActiveSheet();if(!s)return null;const l=s.getSheetId(),d={startRow:n,startColumn:0,endRow:i,endColumn:s.getColumnCount()-1,rangeType:f.RANGE_TYPE.ROW},T={startRow:o,startColumn:0,endRow:u,endColumn:s.getColumnCount()-1,rangeType:f.RANGE_TYPE.ROW};return{type:b.MoveRows,from:d,to:T,unitId:c,sheetId:l}}function pe(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(),s=e.getActiveSheet();if(!s)return null;const l=s.getSheetId(),d={startRow:0,startColumn:n,endRow:s.getRowCount()-1,endColumn:i,rangeType:f.RANGE_TYPE.COLUMN},T={startRow:0,startColumn:o,endRow:s.getRowCount()-1,endColumn:u,rangeType:f.RANGE_TYPE.COLUMN};return{type:b.MoveCols,from:d,to:T,unitId:c,sheetId:l}}function de(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 Le(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 Te(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 Ne(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 Pe(r,e){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}}function Ee(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 Ie(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 Ae(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 Se(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:b.SetName,unitId:n||u,sheetId:i||c,sheetName:o}}function Ce(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 Re(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 Oe(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 Me=Object.getOwnPropertyDescriptor,_e=(r,e,a,n)=>{for(var i=n>1?void 0:n?Me(e,a):e,o=r.length-1,u;o>=0;o--)(u=r[o])&&(i=u(i)||i);return i},ot=(r,e)=>(a,n)=>e(a,n,r);I.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===m.SetDefinedNameCommand.id||e.id===m.RemoveDefinedNameCommand.id)return{redos:[],undos:[]};const a=this._univerInstanceService.getCurrentUnitForType(f.UniverInstanceType.UNIVER_SHEET);if(a==null)return{redos:[],undos:[]};const n=ht(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=[],s=[];return Object.values(u).forEach(l=>{var E;const{formulaOrRefString:d}=l,T=this._lexerTreeBuilder.sequenceNodesBuilder(d);if(T==null)return!0;let L=!1;const P=[];for(let A=0,N=T.length;A<N;A++){const _=T[A];if(typeof _=="string"||_.nodeType!==t.sequenceNodeType.REFERENCE)continue;const{token:R}=_,x=t.deserializeRangeWithSheetWithCache(R),{range:q,sheetName:D,unitId:y}=x,M=((E=e.getSheetBySheetName(D))==null?void 0:E.getSheetId())||"",U={range:q,sheetId:M,unitId:y,sheetName:D,refOffsetX:0,refOffsetY:0};let F=null;if(n===b.RemoveSheet)F=this._removeSheet(l,i,o);else if(n===b.SetName){const{sheetId:O,sheetName:v}=a;if(v==null||M==null||M.length===0||O!==M)continue;F=t.serializeRangeToRefString({range:q,sheetName:v,unitId:y})}else F=qt(U,a,i,o);F!=null&&(T[A]={..._,token:F},L=!0,P.push(A))}if(!L)return!0;const S=t.generateStringWithSequence(Ut(T,P)),C={id:t.SetDefinedNameMutation.id,params:{unitId:i,...l,formulaOrRefString:S}};c.push(C);const p={id:t.SetDefinedNameMutation.id,params:{unitId:i,...l}};s.push(p)}),{redos:c,undos:s}}_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}},I.UpdateDefinedNameController=_e([ot(0,t.IDefinedNamesService),ot(1,f.IUniverInstanceService),ot(2,f.Inject(m.SheetInterceptorService)),ot(3,f.Inject(t.LexerTreeBuilder))],I.UpdateDefinedNameController);var z=(r=>(r[r.NOT_REGISTER=1]="NOT_REGISTER",r[r.SUCCESS=2]="SUCCESS",r[r.WAIT=3]="WAIT",r[r.ERROR=4]="ERROR",r))(z||{}),De=Object.getOwnPropertyDescriptor,be=(r,e,a,n)=>{for(var i=n>1?void 0:n?De(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);I.RegisterOtherFormulaService=class extends f.Disposable{constructor(a,n,i){super();h(this,"_formulaCacheMap",new Map);h(this,"_formulaChangeWithRange$",new H.Subject);h(this,"formulaChangeWithRange$",this._formulaChangeWithRange$.asObservable());h(this,"_formulaResult$",new H.Subject);h(this,"formulaResult$",this._formulaResult$.asObservable());h(this,"calculateStarted$",new H.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.Tools.generateRandomId(8)}`}_initFormulaRegister(){this._activeDirtyManagerService.register(Q.id,{commandId:Q.id,getDirtyData(n){return{dirtyUnitOtherFormulaMap:n.params}}});const a=n=>{const{unitId:i,subUnitId:o,formulaText:u,formulaId:c,ranges:s}=n;if(!this._ensureCacheMap(i,o).has(c))return;const d={unitId:i,subUnitId:o,formulaMap:{[c]:{f:u,ranges:s}}};this._commandService.executeCommand(t.SetOtherFormulaMutation.id,d).then(()=>{this._commandService.executeCommand(Q.id,{[i]:{[o]:{[c]:!0}}})})};this.disposeWithMe(this._formulaChangeWithRange$.pipe(H.bufferWhen(()=>this.calculateStarted$.pipe(H.filter(n=>n)))).subscribe(n=>n.forEach(a))),this.disposeWithMe(this._formulaChangeWithRange$.pipe(H.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],s={};o[u]=s;for(const l in c){const d=this._ensureCacheMap(u,l),T=c[l],L=[];s[l]=L;for(const P in T){const S=T[P];if(d.has(P)){const C=d.get(P);if(!C)continue;C.result||(C.result={});const p=new f.ObjectMatrix(S),E=new f.ObjectMatrix(C.result);p.forValue((A,N,_)=>{E.setValue(A,N,_)}),C.status=z.SUCCESS,C.callbacks.forEach(A=>{A(S)}),C.callbacks.clear(),L.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:z.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===z.SUCCESS||u.status===z.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=z.WAIT,this._commandService.executeCommand(Q.id,{[a]:{[n]:{[i]:!0}}}))}},I.RegisterOtherFormulaService=be([St(0,f.ICommandService),St(1,t.IActiveDirtyManagerService),St(2,f.Inject(f.LifecycleService))],I.RegisterOtherFormulaService);const Z="sheets-formula.base.config";var Y=(r=>(r[r.FORCED=0]="FORCED",r[r.WHEN_EMPTY=1]="WHEN_EMPTY",r[r.NO_CALCULATION=2]="NO_CALCULATION",r))(Y||{});const Ft={},ye="sheets-formula.remote.config",Bt={};var xe=Object.getOwnPropertyDescriptor,Ue=(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},g=(r,e)=>(a,n)=>e(a,n,r);const vt={done:0,count:0},Ct={onlyLocal:!0};I.TriggerCalculationController=class extends f.Disposable{constructor(a,n,i,o,u,c,s){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 H.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=c,this._registerOtherFormulaService=s,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:Y.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===m.SetRangeValuesMutation.id){const i=a.params;if(n&&n.onlyLocal===!0||i.trigger===m.SetStyleCommand.id||i.trigger===m.SetBorderCommand.id||i.trigger===m.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={},s={};for(const l of a){const d=this._activeDirtyManagerService.get(l.id);if(d==null)continue;const T=d.getDirtyData(l),{dirtyRanges:L,dirtyNameMap:P,dirtyDefinedNameMap:S,dirtyUnitFeatureMap:C,dirtyUnitOtherFormulaMap:p,clearDependencyTreeCache:E}=T;L!=null&&this._mergeDirtyRanges(n,L),P!=null&&this._mergeDirtyNameMap(i,P),S!=null&&this._mergeDirtyNameMap(o,S),C!=null&&this._mergeDirtyUnitFeatureOrOtherFormulaMap(u,C),p!=null&&this._mergeDirtyUnitFeatureOrOtherFormulaMap(c,p),E!=null&&this._mergeDirtyNameMap(s,E)}return{dirtyRanges:n,dirtyNameMap:i,dirtyDefinedNameMap:o,dirtyUnitFeatureMap:u,dirtyUnitOtherFormulaMap:c,forceCalculation:!1,clearDependencyTreeCache:s,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},s={...a.dirtyUnitOtherFormulaMap},l={...a.clearDependencyTreeCache};this._mergeDirtyNameMap(o,n.dirtyNameMap),this._mergeDirtyNameMap(u,n.dirtyDefinedNameMap),this._mergeDirtyUnitFeatureOrOtherFormulaMap(c,n.dirtyUnitFeatureMap),this._mergeDirtyUnitFeatureOrOtherFormulaMap(s,n.dirtyUnitOtherFormulaMap),this._mergeDirtyNameMap(l,n.clearDependencyTreeCache);const d=a.maxIteration||n.maxIteration;return{dirtyRanges:i,dirtyNameMap:o,dirtyDefinedNameMap:u,dirtyUnitFeatureMap:c,dirtyUnitOtherFormulaMap:s,forceCalculation:!!this._forceCalculating,clearDependencyTreeCache:l,maxIteration:d}}_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:s,endRow:l,endColumn:d}=i.range,{startRow:T,startColumn:L,endRow:P,endColumn:S}=u.range;if(c===T&&s===L&&l===P&&d===S){o=!0;break}}o||a.push(i)}}_mergeDirtyNameMap(a,n){Object.keys(n).forEach(i=>{a[i]==null&&(a[i]={}),Object.keys(n[i]).forEach(o=>{var u;(u=n[i])!=null&&u[o]&&(a[i][o]=n[i][o])})})}_mergeDirtyUnitFeatureOrOtherFormulaMap(a,n){Object.keys(n).forEach(i=>{a[i]==null&&(a[i]={}),Object.keys(n[i]).forEach(o=>{a[i][o]==null&&(a[i][o]={}),Object.keys(n[i][o]).forEach(u=>{a[i][o][u]=n[i][o][u]||!1})})})}_initialExecuteFormulaProcessListener(){let a=null,n=0;this.disposeWithMe(this._commandService.onCommandExecuted(i=>{if(i.id===t.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===Y.FORCED,i=a===Y.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)}}},I.TriggerCalculationController=Ue([g(0,f.ICommandService),g(1,t.IActiveDirtyManagerService),g(2,f.ILogService),g(3,f.IConfigService),g(4,f.Inject(t.FormulaDataModel)),g(5,f.Inject(f.LocaleService)),g(6,f.Inject(I.RegisterOtherFormulaService))],I.TriggerCalculationController);function qe(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 s=o.treeBuilder(e),l=u.parse(s),d=c.execute(t.generateExecuteAstNodeData(l));return t.getObjectValue(d)}var he=Object.getOwnPropertyDescriptor,Fe=(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},X=(r,e)=>(a,n)=>e(a,n,r);I.UpdateFormulaController=class extends f.Disposable{constructor(e,a,n,i,o,u,c,s){super(),this._univerInstanceService=e,this._commandService=a,this._lexerTreeBuilder=n,this._formulaDataModel=i,this._sheetInterceptorService=o,this._definedNamesService=u,this._configService=c,this._injector=s,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===m.RemoveSheetMutation.id){const{subUnitId:a,unitId:n}=e.params;this._handleWorkbookDisposed(n,a)}else e.id===m.InsertSheetMutation.id&&this._handleInsertSheetMutation(e.params)})),this.disposeWithMe(this._commandService.beforeCommandExecuted((e,a)=>{if(e.id===m.SetRangeValuesMutation.id){const n=e.params;if(a&&a.onlyLocal===!0||n.trigger===m.SetStyleCommand.id||n.trigger===m.SetBorderCommand.id||n.trigger===m.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(H.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),u={[n]:{[a]:o}};this._commandService.executeCommand(m.SetRangeValuesMutation.id,{unitId:n,subUnitId:a,cellValue:me(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=Et(n,e,a),o=this._formulaDataModel.getArrayFormulaRange(),u=Et(o,e,a),c=this._formulaDataModel.getArrayFormulaCellData(),s=Et(c,e,a);i&&this._commandService.executeCommand(t.SetFormulaDataMutation.id,{formulaData:i},{onlyLocal:!0}),u&&s&&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),s=t.initSheetFormulaData(i,n,o,c);this._commandService.executeCommand(t.SetFormulaDataMutation.id,{formulaData:s},{onlyLocal:!0})}_handleWorkbookAdded(e){var l;const a={},n=e.getUnitId(),i={[n]:{}};e.getSheets().forEach(d=>{var S;const T=d.getCellMatrix(),L=d.getSheetId(),P=t.initSheetFormulaData(a,n,L,T);i[n][L]=(S=P[n])==null?void 0:S[L]}),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:Y.WHEN_EMPTY,s=this._getDirtyDataByCalculationMode(c);this._commandService.executeCommand(t.SetFormulaCalculationStartMutation.id,s,{onlyLocal:!0})}_getDirtyDataByCalculationMode(e){const a=e===Y.FORCED,n=e===Y.WHEN_EMPTY?this._formulaDataModel.getFormulaDirtyRanges():[];return{forceCalculation:a,dirtyRanges:n,dirtyNameMap:{},dirtyDefinedNameMap:{},dirtyUnitFeatureMap:{},dirtyUnitOtherFormulaMap:{},clearDependencyTreeCache:{}}}_getUpdateFormula(e){const a=this._univerInstanceService.getCurrentUnitForType(f.UniverInstanceType.UNIVER_SHEET);if(!a)return{undos:[],redos:[]};const n=ht(a,e);if(n){const{unitSheetNameMap:i}=this._formulaDataModel.getCalculateData(),o=this._formulaDataModel.getFormulaData(),{newFormulaData:u}=this._getFormulaReferenceMoveInfo(o,i,n),{undos:c,redos:s}=wt(o,u,n);return{undos:c,redos:s}}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 s=e[c];if(s==null)continue;const l=Object.keys(s);f.Tools.isDefine(o[c])||(o[c]={}),f.Tools.isDefine(u[c])||(u[c]={});for(const d of l){const T=new f.ObjectMatrix(s[d]||{}),L=new f.ObjectMatrix;T.forValue((P,S,C)=>{var D;if(!C)return!0;const{f:p,x:E,y:A,si:N}=C,_=this._lexerTreeBuilder.sequenceNodesBuilder(p);if(_==null)return!0;let R=!1;const x=[];for(let y=0,M=_.length;y<M;y++){const U=_[y];if(typeof U=="string")continue;const{token:F,nodeType:O}=U,{type:v}=n;if((v===b.SetDefinedName||v===b.RemoveDefinedName)&&(O===t.sequenceNodeType.DEFINED_NAME||O===t.sequenceNodeType.FUNCTION)){const{definedNameId:et,definedName:at}=n;if(et===void 0||at===void 0)continue;const k=this._definedNamesService.getValueById(c,et);if(k==null||k.name!==F)continue;_[y]={...U,token:v===b.SetDefinedName?at:t.ErrorType.REF},R=!0,x.push(y);continue}else if(O!==t.sequenceNodeType.REFERENCE)continue;const J=t.deserializeRangeWithSheetWithCache(F),{range:tt,sheetName:w,unitId:B}=J,W=B==null||B.length===0?c:B,G=((D=a==null?void 0:a[W])==null?void 0:D[w])||"";if(!xt(n.unitId,n.sheetId,c,d,B,G))continue;const Pt={range:tt,sheetId:G,unitId:B,sheetName:w,refOffsetX:E||0,refOffsetY:A||0};let K=null;if(v===b.SetName){const{unitId:et,sheetId:at,sheetName:k}=n;if(k==null||G==null||G.length===0||at!==G)continue;K=t.serializeRangeToRefString({range:tt,sheetName:k,unitId:B})}else if(v===b.RemoveSheet){const{unitId:et,sheetId:at,sheetName:k}=n;if(G==null||G.length===0||at!==G)continue;K=t.ErrorType.REF}else v!==b.SetDefinedName&&(K=qt(Pt,n,c,d));K!=null&&(_[y]={...U,token:K},R=!0,x.push(y))}if(!R)return!0;const q=Ut(_,x,E,A);L.setValue(P,S,{f:`=${t.generateStringWithSequence(q)}`})}),u[c]&&(u[c][d]=L.getData())}}return{newFormulaData:u}}},I.UpdateFormulaController=Fe([X(0,f.IUniverInstanceService),X(1,f.ICommandService),X(2,f.Inject(t.LexerTreeBuilder)),X(3,f.Inject(t.FormulaDataModel)),X(4,f.Inject(m.SheetInterceptorService)),X(5,t.IDefinedNamesService),X(6,f.IConfigService),X(7,f.Inject(f.Injector))],I.UpdateFormulaController);const Be=[{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}]}],ve=[{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}]}],Ve=[{functionName:t.FUNCTION_NAMES_CUBE.CUBEKPIMEMBER,functionType:t.FunctionType.Cube,description:"formula.functionList.CUBEKPIMEMBER.description",abstract:"formula.functionList.CUBEKPIMEMBER.abstract",functionParameter:[{name:"formula.functionList.CUBEKPIMEMBER.functionParameter.number1.name",detail:"formula.functionList.CUBEKPIMEMBER.functionParameter.number1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.CUBEKPIMEMBER.functionParameter.number2.name",detail:"formula.functionList.CUBEKPIMEMBER.functionParameter.number2.detail",example:"A1:A20",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_CUBE.CUBEMEMBER,functionType:t.FunctionType.Cube,description:"formula.functionList.CUBEMEMBER.description",abstract:"formula.functionList.CUBEMEMBER.abstract",functionParameter:[{name:"formula.functionList.CUBEMEMBER.functionParameter.number1.name",detail:"formula.functionList.CUBEMEMBER.functionParameter.number1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.CUBEMEMBER.functionParameter.number2.name",detail:"formula.functionList.CUBEMEMBER.functionParameter.number2.detail",example:"A1:A20",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_CUBE.CUBEMEMBERPROPERTY,functionType:t.FunctionType.Cube,description:"formula.functionList.CUBEMEMBERPROPERTY.description",abstract:"formula.functionList.CUBEMEMBERPROPERTY.abstract",functionParameter:[{name:"formula.functionList.CUBEMEMBERPROPERTY.functionParameter.number1.name",detail:"formula.functionList.CUBEMEMBERPROPERTY.functionParameter.number1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.CUBEMEMBERPROPERTY.functionParameter.number2.name",detail:"formula.functionList.CUBEMEMBERPROPERTY.functionParameter.number2.detail",example:"A1:A20",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_CUBE.CUBERANKEDMEMBER,functionType:t.FunctionType.Cube,description:"formula.functionList.CUBERANKEDMEMBER.description",abstract:"formula.functionList.CUBERANKEDMEMBER.abstract",functionParameter:[{name:"formula.functionList.CUBERANKEDMEMBER.functionParameter.number1.name",detail:"formula.functionList.CUBERANKEDMEMBER.functionParameter.number1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.CUBERANKEDMEMBER.functionParameter.number2.name",detail:"formula.functionList.CUBERANKEDMEMBER.functionParameter.number2.detail",example:"A1:A20",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_CUBE.CUBESET,functionType:t.FunctionType.Cube,description:"formula.functionList.CUBESET.description",abstract:"formula.functionList.CUBESET.abstract",functionParameter:[{name:"formula.functionList.CUBESET.functionParameter.number1.name",detail:"formula.functionList.CUBESET.functionParameter.number1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.CUBESET.functionParameter.number2.name",detail:"formula.functionList.CUBESET.functionParameter.number2.detail",example:"A1:A20",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_CUBE.CUBESETCOUNT,functionType:t.FunctionType.Cube,description:"formula.functionList.CUBESETCOUNT.description",abstract:"formula.functionList.CUBESETCOUNT.abstract",functionParameter:[{name:"formula.functionList.CUBESETCOUNT.functionParameter.number1.name",detail:"formula.functionList.CUBESETCOUNT.functionParameter.number1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.CUBESETCOUNT.functionParameter.number2.name",detail:"formula.functionList.CUBESETCOUNT.functionParameter.number2.detail",example:"A1:A20",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_CUBE.CUBEVALUE,functionType:t.FunctionType.Cube,description:"formula.functionList.CUBEVALUE.description",abstract:"formula.functionList.CUBEVALUE.abstract",functionParameter:[{name:"formula.functionList.CUBEVALUE.functionParameter.number1.name",detail:"formula.functionList.CUBEVALUE.functionParameter.number1.detail",example:"A1:A20",require:1,repeat:0},{name:"formula.functionList.CUBEVALUE.functionParameter.number2.name",detail:"formula.functionList.CUBEVALUE.functionParameter.number2.detail",example:"A1:A20",require:1,repeat:0}]}],Ge=[{functionName:t.FUNCTION_NAMES_DATABASE.DAVERAGE,functionType:t.FunctionType.Database,description:"formula.functionList.DAVERAGE.description",abstract:"formula.functionList.DAVERAGE.abstract",functionParameter:[{name:"formula.functionList.DAVERAGE.functionParameter.database.name",detail:"formula.functionList.DAVERAGE.functionParameter.database.detail",example:"A4:E10",require:1,repeat:0},{name:"formula.functionList.DAVERAGE.functionParameter.field.name",detail:"formula.functionList.DAVERAGE.functionParameter.field.detail",example:"D4",require:1,repeat:0},{name:"formula.functionList.DAVERAGE.functionParameter.criteria.name",detail:"formula.functionList.DAVERAGE.functionParameter.criteria.detail",example:"A1:B2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATABASE.DCOUNT,functionType:t.FunctionType.Database,description:"formula.functionList.DCOUNT.description",abstract:"formula.functionList.DCOUNT.abstract",functionParameter:[{name:"formula.functionList.DCOUNT.functionParameter.database.name",detail:"formula.functionList.DCOUNT.functionParameter.database.detail",example:"A4:E10",require:1,repeat:0},{name:"formula.functionList.DCOUNT.functionParameter.field.name",detail:"formula.functionList.DCOUNT.functionParameter.field.detail",example:"D4",require:1,repeat:0},{name:"formula.functionList.DCOUNT.functionParameter.criteria.name",detail:"formula.functionList.DCOUNT.functionParameter.criteria.detail",example:"A1:B2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATABASE.DCOUNTA,functionType:t.FunctionType.Database,description:"formula.functionList.DCOUNTA.description",abstract:"formula.functionList.DCOUNTA.abstract",functionParameter:[{name:"formula.functionList.DCOUNTA.functionParameter.database.name",detail:"formula.functionList.DCOUNTA.functionParameter.database.detail",example:"A4:E10",require:1,repeat:0},{name:"formula.functionList.DCOUNTA.functionParameter.field.name",detail:"formula.functionList.DCOUNTA.functionParameter.field.detail",example:"D4",require:1,repeat:0},{name:"formula.functionList.DCOUNTA.functionParameter.criteria.name",detail:"formula.functionList.DCOUNTA.functionParameter.criteria.detail",example:"A1:B2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATABASE.DGET,functionType:t.FunctionType.Database,description:"formula.functionList.DGET.description",abstract:"formula.functionList.DGET.abstract",functionParameter:[{name:"formula.functionList.DGET.functionParameter.database.name",detail:"formula.functionList.DGET.functionParameter.database.detail",example:"A4:E10",require:1,repeat:0},{name:"formula.functionList.DGET.functionParameter.field.name",detail:"formula.functionList.DGET.functionParameter.field.detail",example:"D4",require:1,repeat:0},{name:"formula.functionList.DGET.functionParameter.criteria.name",detail:"formula.functionList.DGET.functionParameter.criteria.detail",example:"A1:B2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATABASE.DMAX,functionType:t.FunctionType.Database,description:"formula.functionList.DMAX.description",abstract:"formula.functionList.DMAX.abstract",functionParameter:[{name:"formula.functionList.DMAX.functionParameter.database.name",detail:"formula.functionList.DMAX.functionParameter.database.detail",example:"A4:E10",require:1,repeat:0},{name:"formula.functionList.DMAX.functionParameter.field.name",detail:"formula.functionList.DMAX.functionParameter.field.detail",example:"D4",require:1,repeat:0},{name:"formula.functionList.DMAX.functionParameter.criteria.name",detail:"formula.functionList.DMAX.functionParameter.criteria.detail",example:"A1:B2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATABASE.DMIN,functionType:t.FunctionType.Database,description:"formula.functionList.DMIN.description",abstract:"formula.functionList.DMIN.abstract",functionParameter:[{name:"formula.functionList.DMIN.functionParameter.database.name",detail:"formula.functionList.DMIN.functionParameter.database.detail",example:"A4:E10",require:1,repeat:0},{name:"formula.functionList.DMIN.functionParameter.field.name",detail:"formula.functionList.DMIN.functionParameter.field.detail",example:"D4",require:1,repeat:0},{name:"formula.functionList.DMIN.functionParameter.criteria.name",detail:"formula.functionList.DMIN.functionParameter.criteria.detail",example:"A1:B2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATABASE.DPRODUCT,functionType:t.FunctionType.Database,description:"formula.functionList.DPRODUCT.description",abstract:"formula.functionList.DPRODUCT.abstract",functionParameter:[{name:"formula.functionList.DPRODUCT.functionParameter.database.name",detail:"formula.functionList.DPRODUCT.functionParameter.database.detail",example:"A4:E10",require:1,repeat:0},{name:"formula.functionList.DPRODUCT.functionParameter.field.name",detail:"formula.functionList.DPRODUCT.functionParameter.field.detail",example:"D4",require:1,repeat:0},{name:"formula.functionList.DPRODUCT.functionParameter.criteria.name",detail:"formula.functionList.DPRODUCT.functionParameter.criteria.detail",example:"A1:B2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATABASE.DSTDEV,functionType:t.FunctionType.Database,description:"formula.functionList.DSTDEV.description",abstract:"formula.functionList.DSTDEV.abstract",functionParameter:[{name:"formula.functionList.DSTDEV.functionParameter.database.name",detail:"formula.functionList.DSTDEV.functionParameter.database.detail",example:"A4:E10",require:1,repeat:0},{name:"formula.functionList.DSTDEV.functionParameter.field.name",detail:"formula.functionList.DSTDEV.functionParameter.field.detail",example:"D4",require:1,repeat:0},{name:"formula.functionList.DSTDEV.functionParameter.criteria.name",detail:"formula.functionList.DSTDEV.functionParameter.criteria.detail",example:"A1:B2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATABASE.DSTDEVP,functionType:t.FunctionType.Database,description:"formula.functionList.DSTDEVP.description",abstract:"formula.functionList.DSTDEVP.abstract",functionParameter:[{name:"formula.functionList.DSTDEVP.functionParameter.database.name",detail:"formula.functionList.DSTDEVP.functionParameter.database.detail",example:"A4:E10",require:1,repeat:0},{name:"formula.functionList.DSTDEVP.functionParameter.field.name",detail:"formula.functionList.DSTDEVP.functionParameter.field.detail",example:"D4",require:1,repeat:0},{name:"formula.functionList.DSTDEVP.functionParameter.criteria.name",detail:"formula.functionList.DSTDEVP.functionParameter.criteria.detail",example:"A1:B2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATABASE.DSUM,functionType:t.FunctionType.Database,description:"formula.functionList.DSUM.description",abstract:"formula.functionList.DSUM.abstract",functionParameter:[{name:"formula.functionList.DSUM.functionParameter.database.name",detail:"formula.functionList.DSUM.functionParameter.database.detail",example:"A4:E10",require:1,repeat:0},{name:"formula.functionList.DSUM.functionParameter.field.name",detail:"formula.functionList.DSUM.functionParameter.field.detail",example:"D4",require:1,repeat:0},{name:"formula.functionList.DSUM.functionParameter.criteria.name",detail:"formula.functionList.DSUM.functionParameter.criteria.detail",example:"A1:B2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATABASE.DVAR,functionType:t.FunctionType.Database,description:"formula.functionList.DVAR.description",abstract:"formula.functionList.DVAR.abstract",functionParameter:[{name:"formula.functionList.DVAR.functionParameter.database.name",detail:"formula.functionList.DVAR.functionParameter.database.detail",example:"A4:E10",require:1,repeat:0},{name:"formula.functionList.DVAR.functionParameter.field.name",detail:"formula.functionList.DVAR.functionParameter.field.detail",example:"D4",require:1,repeat:0},{name:"formula.functionList.DVAR.functionParameter.criteria.name",detail:"formula.functionList.DVAR.functionParameter.criteria.detail",example:"A1:B2",require:1,repeat:0}]},{functionName:t.FUNCTION_NAMES_DATABASE.DVARP,functionType:t.FunctionType.Database,description:"formula.functionList.DVARP.description",abstract:"formula.functionList.DVARP.abstract",functionParameter:[{name:"formula.functionList.DVARP.functionParameter.database.name",detail:"formula.functionList.DVARP.functionParameter.database.detail",example:"A4:E10",require:1,repeat:0},{name:"formula.functionList.DVARP.functionParameter.field.name",detail:"formula.functionList.DVARP.functionParameter.field.detail",example:"D4",require:1,repeat:0},{name:"formula.functionList.DVARP.functionParameter.criteria.name",detail:"formula.functionList.DVARP.functionParameter.criteria.detail",example:"A1:B2",require:1,repeat:0}]}],He=[{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}]}],Ye=[{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}]}],Xe=[{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:"39508",require:1,repeat:0},{name:"formula.functionList.ACCRINT.functionParameter.firstInterest.name",detail:"formula.functionList.ACCRINT.functionParameter.firstInterest.detail",example:"39691",require:1,repeat:0},{name:"formula.functionList.ACCRINT.functionParameter.settlement.name",detail:"formula.functionList.ACCRINT.functionParameter.settlement.detail",example:"39569",require:1,repeat:0},{name:"formula.functionList.ACCRINT.functionParameter.rate.name",detail:"formula.functionList.ACCRINT.functionParameter.rate.detail",example:"0.1",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:"0.1",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:"39679",require:1,repeat:0},{name:"formula.functionList.AMORLINC.functionParameter.firstPeriod.name",detail:"formula.functionList.AMORLINC.functionParameter.firstPeriod.detail",example:"39813",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:"0.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:"0.09/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:"0.09/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:"0.08",require:1,repeat:0},{name:"formula.functionList.DURATION.functionParameter.yld.name",detail:"formula.functionList.DURATION.functionParameter.yld.detail",example:"0.09",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:"0.0525",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:"0.06/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:"0.1/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:"0.1",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:"0.08",require:1,repeat:0},{name:"formula.functionList.MDURATION.functionParameter.yld.name",detail:"formula.functionList.MDURATION.functionParameter.yld.detail",example:"0.09",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:"0.1",require:1,repeat:0},{name:"formula.functionList.MIRR.functionParameter.reinvestRate.name",detail:"formula.functionList.MIRR.functionParameter.reinvestRate.detail",example:"0.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:"0.053543",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:"0.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:"0.1",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:"0.0785",require:1,repeat:0},{name:"formula.functionList.ODDFPRICE.functionParameter.yld.name",detail:"formula.functionList.ODDFPRICE.functionParameter.yld.detail",example:"0.0625",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:"0.0575",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-11-11"',require:1,repeat:0},{name:"formula.functionList.ODDLPRICE.functionParameter.maturity.name",detail:"formula.functionList.ODDLPRICE.functionParameter.maturity.detail",example:'"2021-3-1"',require:1,repeat:0},{name:"formula.functionList.ODDLPRICE.functionParameter.lastInterest.name",detail:"formula.functionList.ODDLPRICE.functionParameter.lastInterest.detail",example:'"2009-3-1"',require:1,repeat:0},{name:"formula.functionList.ODDLPRICE.functionParameter.rate.name",detail:"formula.functionList.ODDLPRICE.functionParameter.rate.detail",example:"0.0785",require:1,repeat:0},{name:"formula.functionList.ODDLPRICE.functionParameter.yld.name",detail:"formula.functionList.ODDLPRICE.functionParameter.yld.detail",example:"0.0625",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:"1",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-11-11"',require:1,repeat:0},{name:"formula.functionList.ODDLYIELD.functionParameter.maturity.name",detail:"formula.functionList.ODDLYIELD.functionParameter.maturity.detail",example:'"2021-3-1"',require:1,repeat:0},{name:"formula.functionList.ODDLYIELD.functionParameter.lastInterest.name",detail:"formula.functionList.ODDLYIELD.functionParameter.lastInterest.detail",example:'"2008-10-15"',require:1,repeat:0},{name:"formula.functionList.ODDLYIELD.functionParameter.rate.name",detail:"formula.functionList.ODDLYIELD.functionParameter.rate.detail",example:"0.0575",require:1,repeat:0},{name:"formula.functionList.ODDLYIELD.functionParameter.pr.name",detail:"formula.functionList.ODDLYIELD.functionParameter.pr.detail",example:"84.5",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:"0.025",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:"0.08/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:"0.1/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:"0.0785",require:1,repeat:0},{name:"formula.functionList.PRICE.functionParameter.yld.name",detail:"formula.functionList.PRICE.functionParameter.yld.detail",example:"0.0625",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:"0.0625",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:"0.0785",require:1,repeat:0},{name:"formula.functionList.PRICEMAT.functionParameter.yld.name",detail:"formula.functionList.PRICEMAT.functionParameter.yld.detail",example:"0.0625",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:"0.02",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:"0.0575",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:"0.0914",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:"0.0914",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:"0.1",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:"0.0785",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:"0.0785",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}]}],we=[{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}]}],We=[{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}]}],Ke=[{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}]}],ge=[{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}]}],ke=[{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}]}],Qe=[{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}]}],je=[],$e=[{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}]}],ze=[...Xe,...He,...ge,...ke,...Ke,...Ge,...Qe,...We,...we,...Ye,...Ve,...ve,...$e,...Be,...je];function Ze(r,e){let a="";return r.aliasFunctionName?(a=e.t(r.aliasFunctionName),a===r.aliasFunctionName&&(a=r.functionName)):a=r.functionName,a}var Je=Object.getOwnPropertyDescriptor,ta=(r,e,a,n)=>{for(var i=n>1?void 0:n?Je(e,a):e,o=r.length-1,u;o>=0;o--)(u=r[o])&&(i=u(i)||i);return i},Rt=(r,e)=>(a,n)=>e(a,n,r);const ut=f.createIdentifier("formula.description-service");I.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:s}=o;u.toLocaleUpperCase().indexOf(i)>-1&&s!==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}=o;u.toLocaleUpperCase().indexOf(i)===0&&a.push({name:u,desc:c})}),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=ze.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:Ze(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)}},I.DescriptionService=ta([Rt(0,t.IFunctionService),Rt(1,f.Inject(f.LocaleService)),Rt(2,f.IConfigService)],I.DescriptionService);var ea=Object.getOwnPropertyDescriptor,aa=(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},ct=(r,e)=>(a,n)=>e(a,n,r);function Vt(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 s=i[u];if(typeof s=="string"||s.nodeType!==t.sequenceNodeType.REFERENCE)continue;const{token:l}=s,d=t.deserializeRangeWithSheetWithCache(l),{sheetName:T,unitId:L}=d;let P=d.range;P.startAbsoluteRefType===f.AbsoluteRefType.ALL&&P.endAbsoluteRefType===f.AbsoluteRefType.ALL||(P=f.moveRangeByOffset(P,a,n),o.push({unitId:L,sheetName:T,range:P}))}return o.map(u=>`${u.unitId}!${u.sheetName}!${u.range.startRow}!${u.range.endRow}!${u.range.startColumn}!${u.range.endColumn}`).join("|")}I.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(),s=u.getUnitId(),l=c.getSheetId(),d=o==null?void 0:o.map(T=>{if(typeof T=="object"&&T.nodeType===t.sequenceNodeType.REFERENCE){const L=t.deserializeRangeWithSheetWithCache(T.token),{range:P,unitId:S,sheetName:C}=L,p=this._univerInstanceService.getUnit(S||e),E=C?p==null?void 0:p.getSheetBySheetName(C):p==null?void 0:p.getSheetBySheetId(a);if(!E)throw new Error("Sheet not found");const A=p.getUnitId(),N=E.getSheetId();if(A!==s||N!==l)return T;const _=m.handleDefaultRangeChangeWithEffectRefCommands(P,i);let R="";if(_){const x=_.startColumn-P.startColumn,q=_.startRow-P.startRow,D=f.moveRangeByOffset(P,x,q);S&&C?R=t.serializeRangeWithSpreadsheet(S,C,D):C?R=t.serializeRangeWithSheet(C,D):R=t.serializeRange(D)}else R=t.ErrorType.REF;return{...T,token:R}}else return T});return d?`=${t.generateStringWithSequence(d)}`:""}registerFormula(e,a,n,i){const o=new Map,u=this._lexerTreeBuilder.sequenceNodesBuilder(n),c=new f.DisposableCollection,s=l=>{const d=this._univerInstanceService.getCurrentUnitForType(f.UniverInstanceType.UNIVER_SHEET),T=d.getActiveSheet(),L=d.getUnitId(),P=T.getSheetId(),S=u==null?void 0:u.map(p=>{if(typeof p=="object"&&p.nodeType===t.sequenceNodeType.REFERENCE){const E=o.get(p.token);if(E.unitId!==L||E.subUnitId!==P)return p;const A=m.handleDefaultRangeChangeWithEffectRefCommands(E.range,l);let N="";if(A){const _=A.startColumn-E.range.startColumn,R=A.startRow-E.range.startRow,x=f.moveRangeByOffset(E.range,_,R);E.unitId&&E.sheetName?N=t.serializeRangeWithSpreadsheet(E.unitId,E.sheetName,x):E.sheetName?N=t.serializeRangeWithSheet(E.sheetName,x):N=t.serializeRange(x)}else N=t.ErrorType.REF;return{...p,token:N}}else return p}),C=S&&t.generateStringWithSequence(S);return i(`=${C}`)};return u==null||u.forEach(l=>{if(typeof l=="object"&&l.nodeType===t.sequenceNodeType.REFERENCE){const d=t.deserializeRangeWithSheetWithCache(l.token),{range:T,unitId:L,sheetName:P}=d,S=this._univerInstanceService.getUnit(L||e),C=P?S==null?void 0:S.getSheetBySheetName(P):S==null?void 0:S.getSheetBySheetId(a);if(!C)return;const p=S.getUnitId(),E=C.getSheetId(),A={unitId:p,subUnitId:E,range:T,sheetName:P};o.set(l.token,A),c.add(this._refRangeService.registerRefRange(T,s,p,E))}}),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 s=t.deserializeRangeWithSheetWithCache(c.token),{range:l,unitId:d,sheetName:T}=s;if(l.startAbsoluteRefType===f.AbsoluteRefType.ALL&&l.endAbsoluteRefType===f.AbsoluteRefType.ALL)return;const L=this._univerInstanceService.getUnit(d||e),P=T?L==null?void 0:L.getSheetBySheetName(T):L==null?void 0:L.getSheetBySheetId(a);if(!P)return;const S=L.getUnitId(),C=P.getSheetId(),p=i[0].startRow,E=i[0].startColumn,A=l.startRow,N=l.startColumn,_=i.map(R=>({startRow:R.startRow-p+A,endRow:R.endRow-p+A,startColumn:R.startColumn-E+N,endColumn:R.endColumn-E+N}));u.push({unitId:S,subUnitId:C,ranges:_})}}),u}registerRangeFormula(e,a,n,i,o){const u=new f.DisposableCollection,c=i.map(l=>this._getFormulaDependcy(e,a,l,n)),s=l=>{const d=n[0].startRow,T=n[0].startColumn,L=[{unitId:e,subUnitId:a,ranges:n},...c.flat()],P=[],S=m.getSeparateEffectedRangesOnCommand(this._injector,l);for(const{unitId:C,subUnitId:p,ranges:E}of L)if(C===S.unitId&&p===S.subUnitId){const A=[],N=E[0].startRow,_=E[0].startColumn,R=N-d,x=_-T;for(const q of S.ranges){const D=E.map(y=>f.getIntersectRange(q,y)).filter(Boolean);D.length>0&&A.push(...D)}A.length>0&&P.push(A.map(q=>({startRow:q.startRow-R,endRow:q.endRow-R,startColumn:q.startColumn-x,endColumn:q.endColumn-x})))}if(P.length>0){const C=f.Rectangle.splitIntoGrid([...P.flat()]),p=f.Rectangle.subtractMulti(n,C);p.sort((R,x)=>R.startRow-x.startRow||R.startColumn-x.startColumn);const E=new Map;for(let R=0;R<C.length;R++){const x=C[R],q=x.startRow,D=x.startColumn,y=q-d,M=D-T,U=m.handleCommonDefaultRangeChangeWithEffectRefCommands(x,l).sort((B,W)=>B.startRow-W.startRow||B.startColumn-W.startColumn);if(!U.length)continue;const F=U[0].startRow,O=U[0].startColumn,v=F-d,J=O-T,tt=[];for(let B=0;B<i.length;B++){const W=i[B],G=f.isFormulaString(W),Pt=G?this._lexerTreeBuilder.moveFormulaRefOffset(W,M,y):W,K=G?this.transformFormulaByEffectCommand(e,a,Pt,l):Pt,et=Vt(this._lexerTreeBuilder,K,-J,-v);tt.push({newFormula:K,orginFormula:et})}const w={formulas:tt,ranges:U,key:tt.map(B=>B.orginFormula).join("_")};E.has(w.key)?E.get(w.key).push(w):E.set(w.key,[w])}const A=i.map(R=>Vt(this._lexerTreeBuilder,R,0,0)).join("_");if(p.length>0){const R=p[0].startRow,x=p[0].startColumn,q=[];for(let y=0;y<i.length;y++){const M=i[y];q.push({newFormula:f.isFormulaString(M)?this._lexerTreeBuilder.moveFormulaRefOffset(M,x-T,R-d):M,orginFormula:M})}const D={formulas:q,ranges:p,key:A};E.has(D.key)?E.get(D.key).push(D):E.set(D.key,[D])}const N=[],_=Array.from(E.keys());for(let R=_.length-1;R>=0;R--){const x=_[R],q=E.get(x).sort((M,U)=>M.ranges[0].startRow-U.ranges[0].startRow||M.ranges[0].startColumn-U.ranges[0].startColumn),D=[];for(let M=0;M<q[0].formulas.length;M++)D.push(q[0].formulas[M].newFormula);const y=f.Rectangle.mergeRanges(q.map(M=>M.ranges).flat());y.sort((M,U)=>M.startRow-U.startRow||M.startColumn-U.startColumn),N.push({formulas:D,ranges:y})}return o(N)}return{undos:[],redos:[]}};return n.forEach(l=>{const d=this._refRangeService.registerRefRange(l,s,e,a);u.add(d)}),[...c.flat()].forEach(({unitId:l,subUnitId:d,ranges:T})=>{T.forEach(L=>{const P=this._refRangeService.registerRefRange(L,s,l,d);u.add(P)})}),u}},I.FormulaRefRangeService=aa([ct(0,f.Inject(m.RefRangeService)),ct(1,f.Inject(t.LexerTreeBuilder)),ct(2,f.IUniverInstanceService),ct(3,f.Inject(f.Injector))],I.FormulaRefRangeService);var na=Object.getOwnPropertyDescriptor,ia=(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},ra=(r,e)=>(a,n)=>e(a,n,r);const Ot="sheets-formula.remote-register-function.service",Mt=f.createIdentifier(Ot);I.RemoteRegisterFunctionService=class{constructor(e){this._functionService=e}async registerFunctions(e){const a=e.map(([n,i])=>oa(n,i));this._functionService.registerExecutors(...a)}async registerAsyncFunctions(e){const a=e.map(([n,i])=>ua(n,i));this._functionService.registerExecutors(...a)}async unregisterFunctions(e){this._functionService.unregisterExecutors(...e),this._functionService.unregisterDescriptions(...e),this._functionService.deleteFormulaAstCacheKey(...e)}},I.RemoteRegisterFunctionService=ia([ra(0,t.IFunctionService)],I.RemoteRegisterFunctionService);function oa(r,e){const a=new t.CustomFunction(e),n=new Function(`return ${r}`)();return a.calculateCustom=n,a}function ua(r,e){const a=new t.AsyncCustomFunction(e),n=new Function(`return ${r}`)();return a.calculateCustom=n,a}var ca=Object.getOwnPropertyDescriptor,fa=(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},ft=(r,e)=>(a,n)=>e(a,n,r);const Gt=f.createIdentifier("sheets-formula.register-function-service");I.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,s,l])=>({functionName:s,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 s=u?new t.AsyncCustomFunction(a):new t.CustomFunction(a);return s.calculateCustom=n,this._functionService.registerExecutors(s),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))}},I.RegisterFunctionService=fa([ft(0,f.Inject(f.LocaleService)),ft(1,f.Inject(ut)),ft(2,t.IFunctionService),ft(3,f.Optional(Mt))],I.RegisterFunctionService);const ma="SHEETS_FORMULA_PLUGIN";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},_t=(r,e)=>(a,n)=>e(a,n,r);let mt=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(m.SetRangeValuesMutation.id,{commandId:m.SetRangeValuesMutation.id,getDirtyData:r=>{const e=r.params;return e.trigger===m.SetStyleCommand.id?{}:{dirtyRanges:this._getSetRangeValuesMutationDirtyRange(e)}}}),this._initialMove(),this._initialRowAndColumn(),this._initialHideRow(),this._initialSheet(),this._initialDefinedName()}_initialMove(){this._activeDirtyManagerService.register(m.MoveRangeMutation.id,{commandId:m.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(m.MoveRowsMutation.id,{commandId:m.MoveRowsMutation.id,getDirtyData:r=>{const e=r.params;return{dirtyRanges:this._getMoveRowsMutationDirtyRange(e),clearDependencyTreeCache:{[e.unitId]:{[e.subUnitId]:"1"}}}}}),this._activeDirtyManagerService.register(m.MoveColsMutation.id,{commandId:m.MoveColsMutation.id,getDirtyData:r=>{const e=r.params;return{dirtyRanges:this._getMoveRowsMutationDirtyRange(e),clearDependencyTreeCache:{[e.unitId]:{[e.subUnitId]:"1"}}}}}),this._activeDirtyManagerService.register(m.ReorderRangeMutation.id,{commandId:m.ReorderRangeMutation.id,getDirtyData:r=>{const e=r.params;return{dirtyRanges:this._getReorderRangeMutationDirtyRange(e),clearDependencyTreeCache:{[e.unitId]:{[e.subUnitId]:"1"}}}}})}_initialRowAndColumn(){this._activeDirtyManagerService.register(m.RemoveRowMutation.id,{commandId:m.RemoveRowMutation.id,getDirtyData:r=>{const e=r.params;return{dirtyRanges:this._getRemoveRowOrColumnMutation(e,!0),clearDependencyTreeCache:{[e.unitId]:{[e.subUnitId]:"1"}}}}}),this._activeDirtyManagerService.register(m.RemoveColMutation.id,{commandId:m.RemoveColMutation.id,getDirtyData:r=>{const e=r.params;return{dirtyRanges:this._getRemoveRowOrColumnMutation(e,!1),clearDependencyTreeCache:{[e.unitId]:{[e.subUnitId]:"1"}}}}}),this._activeDirtyManagerService.register(m.InsertColMutation.id,{commandId:m.InsertColMutation.id,getDirtyData:r=>{const e=r.params;return{clearDependencyTreeCache:{[e.unitId]:{[e.subUnitId]:"1"}}}}}),this._activeDirtyManagerService.register(m.InsertRowMutation.id,{commandId:m.InsertRowMutation.id,getDirtyData:r=>{const e=r.params;return{clearDependencyTreeCache:{[e.unitId]:{[e.subUnitId]:"1"}}}}})}_initialHideRow(){this._activeDirtyManagerService.register(m.SetRowHiddenMutation.id,{commandId:m.SetRowHiddenMutation.id,getDirtyData:r=>{const e=r.params;return{dirtyRanges:this._getHideRowMutation(e),clearDependencyTreeCache:{[e.unitId]:{[e.subUnitId]:"1"}}}}}),this._activeDirtyManagerService.register(m.SetRowVisibleMutation.id,{commandId:m.SetRowVisibleMutation.id,getDirtyData:r=>{const e=r.params;return{dirtyRanges:this._getHideRowMutation(e),clearDependencyTreeCache:{[e.unitId]:{[e.subUnitId]:"1"}}}}})}_initialSheet(){this._activeDirtyManagerService.register(m.RemoveSheetMutation.id,{commandId:m.RemoveSheetMutation.id,getDirtyData:r=>{const e=r.params;return{dirtyNameMap:this._getRemoveSheetMutation(e),clearDependencyTreeCache:{[e.unitId]:{[e.subUnitId]:"1"}}}}}),this._activeDirtyManagerService.register(m.InsertSheetMutation.id,{commandId:m.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),s=(c==null?void 0:c.getRowCount())||0,l=(c==null?void 0:c.getColumnCount())||0;let d=null;const{startRow:T,endRow:L,startColumn:P,endColumn:S}=i;e===!0?d=this._rangeToMatrix({startRow:T,startColumn:0,endRow:L,endColumn:l-1}):d=this._rangeToMatrix({startRow:0,startColumn:P,endRow:s,endColumn:S});const C=d.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 s=new f.ObjectMatrix((c=o==null?void 0:o[r])==null?void 0:c[e]);i.forValue((l,d)=>{s.forValue((T,L,P)=>{if(P==null)return!0;const{startRow:S,startColumn:C,endRow:p,endColumn:E}=P;l>=S&&l<=p&&d>=C&&d<=E&&n.push({unitId:r,sheetId:e,range:{startRow:S,startColumn:C,endRow:S,endColumn:C}})})})}return n}};mt=la([_t(0,t.IActiveDirtyManagerService),_t(1,f.IUniverInstanceService),_t(2,f.Inject(t.FormulaDataModel))],mt);var pa=Object.getOwnPropertyDescriptor,da=(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},st=(r,e)=>(a,n)=>e(a,n,r);let lt=class extends f.Disposable{constructor(r,e,a,n){super(),this._commandService=r,this._configService=e,this._sheetInterceptorService=a,this._formulaDataModel=n,this._initialize()}_initialize(){this._commandExecutedListener(),this._initInterceptorCellContent()}_commandExecutedListener(){this.disposeWithMe(this._commandService.onCommandExecuted(r=>{var i;if(r.id!==t.SetArrayFormulaDataMutation.id)return;const e=r.params;if(e==null)return;const{arrayFormulaRange:a,arrayFormulaCellData:n}=e;this._formulaDataModel.setArrayFormulaRange(a),this._formulaDataModel.setArrayFormulaCellData(n),(i=this._configService.getConfig(Z))!=null&&i.writeArrayFormulaToSnapshot&&this._writeArrayFormulaToSnapshot(n)}))}_writeArrayFormulaToSnapshot(r){Array.from(Object.entries(r)).forEach(([e,a])=>{a&&Array.from(Object.entries(a)).forEach(([n,i])=>{this._commandService.executeCommand(m.SetRangeValuesMutation.id,{unitId:e,subUnitId:n,cellValue:i},{onlyLocal:!0})})})}_initInterceptorCellContent(){this.disposeWithMe(this._sheetInterceptorService.intercept(m.INTERCEPTOR_POINT.CELL_CONTENT,{priority:100,effect:f.InterceptorEffectEnum.Value,handler:(r,e,a)=>{var d,T,L;let n=r;const{unitId:i,subUnitId:o,row:u,col:c}=e,s=this._formulaDataModel.getArrayFormulaCellData(),l=(L=(T=(d=s==null?void 0:s[i])==null?void 0:d[o])==null?void 0:T[u])==null?void 0:L[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)))}}))}};lt=da([st(0,f.ICommandService),st(1,f.IConfigService),st(2,f.Inject(m.SheetInterceptorService)),st(3,f.Inject(t.FormulaDataModel))],lt);var La=Object.getOwnPropertyDescriptor,Ta=(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},pt=(r,e)=>(a,n)=>e(a,n,r);let dt=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===m.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===m.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:s,localSheetId:l}=o;!this._descriptionService.hasDescription(u)&&(l==null||l===m.SCOPE_WORKBOOK_VALUE_DEFINED_NAME||l===a)&&i.push({functionName:u,description:s+(c||""),abstract:s,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!==m.SCOPE_WORKBOOK_VALUE_DEFINED_NAME&&c!==a&&i.push(u)}),this._descriptionService.unregisterDescriptions(i)}};dt=Ta([pt(0,ut),pt(1,t.IDefinedNamesService),pt(2,f.IUniverInstanceService),pt(3,f.ICommandService)],dt);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},Ea=(r,e)=>(a,n)=>e(a,n,r);let Lt=class extends f.Disposable{constructor(r){super(),this._commandService=r,[Dt,bt,Q].forEach(e=>this._commandService.registerCommand(e))}};Lt=Pa([Ea(0,f.ICommandService)],Lt);var Ia=Object.defineProperty,Aa=Object.getOwnPropertyDescriptor,Sa=(r,e,a)=>e in r?Ia(r,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):r[e]=a,Ht=(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},Tt=(r,e)=>(a,n)=>e(a,n,r),Nt=(r,e,a)=>Sa(r,typeof e!="symbol"?e+"":e,a);I.UniverRemoteSheetsFormulaPlugin=class extends f.Plugin{constructor(e=Bt,a,n){super(),this._config=e,this._injector=a,this._configService=n;const{...i}=f.merge({},Bt,this._config);this._configService.setConfig(ye,i)}onStarting(){this._injector.add([I.RemoteRegisterFunctionService]),this._injector.get(it.IRPCChannelService).registerChannel(Ot,it.fromModule(this._injector.get(I.RemoteRegisterFunctionService)))}},Nt(I.UniverRemoteSheetsFormulaPlugin,"pluginName","SHEET_FORMULA_REMOTE_PLUGIN"),Nt(I.UniverRemoteSheetsFormulaPlugin,"type",f.UniverInstanceType.UNIVER_SHEET),I.UniverRemoteSheetsFormulaPlugin=Ht([f.DependentOn(t.UniverFormulaEnginePlugin),Tt(1,f.Inject(f.Injector)),Tt(2,f.IConfigService)],I.UniverRemoteSheetsFormulaPlugin),I.UniverSheetsFormulaPlugin=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(Z,i,{merge:!0})}onStarting(){const e=this._injector,a=[[Gt,{useClass:I.RegisterFunctionService}],[ut,{useClass:I.DescriptionService}],[Lt],[I.FormulaRefRangeService],[I.RegisterOtherFormulaService],[lt],[I.TriggerCalculationController],[I.UpdateFormulaController],[mt],[dt],[I.UpdateDefinedNameController]];if(this._config.notExecuteFormula){const n=e.get(it.IRPCChannelService);a.push([Mt,{useFactory:()=>it.toModule(n.requestChannel(Ot))}])}a.forEach(n=>e.add(n))}onReady(){f.touchDependencies(this._injector,[[Lt],[mt],[lt],[I.UpdateFormulaController],[I.UpdateDefinedNameController]]),f.isNodeEnv()&&f.touchDependencies(this._injector,[[I.TriggerCalculationController]])}onRendered(){f.touchDependencies(this._injector,[[dt]]),f.isNodeEnv()||f.touchDependencies(this._injector,[[I.TriggerCalculationController]])}},Nt(I.UniverSheetsFormulaPlugin,"pluginName",ma),Nt(I.UniverSheetsFormulaPlugin,"type",f.UniverInstanceType.UNIVER_SHEET),I.UniverSheetsFormulaPlugin=Ht([f.DependentOn(t.UniverFormulaEnginePlugin,m.UniverSheetsPlugin),Tt(1,f.Inject(f.Injector)),Tt(2,f.IConfigService)],I.UniverSheetsFormulaPlugin),I.CalculationMode=Y,I.IDescriptionService=ut,I.IRegisterFunctionService=Gt,I.IRemoteRegisterFunctionService=Mt,I.InsertFunctionCommand=Dt,I.OtherFormulaMarkDirty=Q,I.PLUGIN_CONFIG_KEY_BASE=Z,I.QuickSumCommand=bt,I.calculateFormula=qe,Object.defineProperty(I,Symbol.toStringTag,{value:"Module"})});
49
49
 
50
50
 
51
51
  // @univerjs/sheets-formula/facade