@syncfusion/ej2-spreadsheet 28.1.41-37550 → 28.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/ej2-spreadsheet.min.js +9 -0
- package/dist/ej2-spreadsheet.umd.min.js +9 -0
- package/dist/global/ej2-spreadsheet.min.js +9 -0
- package/dist/global/index.d.ts +9 -0
- package/package.json +84 -84
- package/src/workbook/base/workbook.d.ts +1 -1
- package/src/workbook/base/workbook.js +1 -1
- package/styles/material3-dark.scss +1 -1
- package/styles/material3.scss +1 -1
- package/styles/spreadsheet/material3-dark.scss +1 -1
- package/styles/spreadsheet/material3.scss +1 -1
- package/styles/spreadsheet-ribbon/material3-dark.scss +1 -1
- package/styles/spreadsheet-ribbon/material3.scss +1 -1
|
@@ -1 +1,10 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* filename: ej2-spreadsheet.min.js
|
|
3
|
+
* version : 28.2.3
|
|
4
|
+
* Copyright Syncfusion Inc. 2001 - 2024. All rights reserved.
|
|
5
|
+
* Use of this code is subject to the terms of our license.
|
|
6
|
+
* A copy of the current license can be obtained at any time by e-mailing
|
|
7
|
+
* licensing@syncfusion.com. Any infringement will be prosecuted under
|
|
8
|
+
* applicable laws.
|
|
9
|
+
*/
|
|
1
10
|
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("SyncfusionBase"),require("SyncfusionData"),require("SyncfusionPopups"),require("SyncfusionNavigations"),require("SyncfusionInputs"),require("SyncfusionButtons"),require("SyncfusionDropdowns"),require("SyncfusionLists"),require("SyncfusionSplitbuttons"),require("SyncfusionGrids"),require("SyncfusionCharts")):"function"==typeof define&&define.amd?define(["SyncfusionBase","SyncfusionData","SyncfusionPopups","SyncfusionNavigations","SyncfusionInputs","SyncfusionButtons","SyncfusionDropdowns","SyncfusionLists","SyncfusionSplitbuttons","SyncfusionGrids","SyncfusionCharts"],t):"object"==typeof exports?exports.SyncfusionSpreadsheet=t(require("SyncfusionBase"),require("SyncfusionData"),require("SyncfusionPopups"),require("SyncfusionNavigations"),require("SyncfusionInputs"),require("SyncfusionButtons"),require("SyncfusionDropdowns"),require("SyncfusionLists"),require("SyncfusionSplitbuttons"),require("SyncfusionGrids"),require("SyncfusionCharts")):e.SyncfusionSpreadsheet=t(e.SyncfusionBase,e.SyncfusionData,e.SyncfusionPopups,e.SyncfusionNavigations,e.SyncfusionInputs,e.SyncfusionButtons,e.SyncfusionDropdowns,e.SyncfusionLists,e.SyncfusionSplitbuttons,e.SyncfusionGrids,e.SyncfusionCharts)}(self,((e,t,r,n,i,a,s,o,l,d,h)=>(()=>{"use strict";var p={766:t=>{t.exports=e},741:e=>{e.exports=a},60:e=>{e.exports=h},74:e=>{e.exports=t},778:e=>{e.exports=s},707:e=>{e.exports=d},323:e=>{e.exports=i},90:e=>{e.exports=o},215:e=>{e.exports=n},197:e=>{e.exports=r},295:e=>{e.exports=l}},c={};function u(e){var t=c[e];if(void 0!==t)return t.exports;var r=c[e]={exports:{}};return p[e](r,r.exports,u),r.exports}u.d=(e,t)=>{for(var r in t)u.o(t,r)&&!u.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},u.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),u.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var f={};return(()=>{u.r(f),u.d(f,{AutoFill:()=>kh,AutoFillSettings:()=>z,Axis:()=>H,BasicFormulas:()=>So,Border:()=>L,CalcSheetFamilyItem:()=>ko,Calculate:()=>No,CalculateCommon:()=>fo,Cell:()=>Dn,CellFormat:()=>lh,CellRenderer:()=>Zd,CellStyle:()=>w,Chart:()=>U,Clipboard:()=>th,Column:()=>Cl,CommonErrors:()=>zn,ConditionalFormat:()=>F,ConditionalFormatting:()=>Rh,ContextMenu:()=>Yh,DISABLED:()=>Rl,DataBind:()=>Wn,DataLabelSettings:()=>D,DataValidation:()=>Sh,DefineName:()=>N,Delete:()=>yh,Edit:()=>rh,ExcelFileFormats:()=>jn,Filter:()=>Zh,FilterCollection:()=>I,FindAndReplace:()=>Eh,Format:()=>A,Formula:()=>jh,FormulaBar:()=>_h,FormulaError:()=>Ro,FormulaInfo:()=>Oo,FormulasErrorsStrings:()=>_n,Hyperlink:()=>O,Image:()=>V,Insert:()=>vh,KeyboardNavigation:()=>sh,KeyboardShortcut:()=>oh,LegendSettings:()=>T,MajorGridLines:()=>M,MarkerSettings:()=>P,Merge:()=>Nh,MinorGridLines:()=>B,ModuleLoader:()=>xo,NumberFormat:()=>Xh,Open:()=>Wh,OpenSettings:()=>qn,Parser:()=>wo,ProtectSettings:()=>R,ProtectSheet:()=>Ih,Range:()=>fn,Render:()=>Jd,Resize:()=>hh,Ribbon:()=>zh,Row:()=>dl,RowRenderer:()=>$d,Save:()=>Gh,Scroll:()=>ih,ScrollSettings:()=>Yd,Selection:()=>nh,SelectionSettings:()=>Xd,Sheet:()=>mn,SheetRender:()=>Kd,SheetTabs:()=>qh,ShowHide:()=>ph,Sort:()=>Kh,SortCollection:()=>E,Spreadsheet:()=>ip,SpreadsheetChart:()=>ep,SpreadsheetHyperlink:()=>uh,SpreadsheetImage:()=>Jh,SpreadsheetNote:()=>Ah,UndoRedo:()=>gh,UsedRange:()=>gn,Validation:()=>k,ValueChangedArgs:()=>Do,VirtualScroll:()=>ah,WRAPTEXT:()=>Ol,Workbook:()=>sl,WorkbookAutoFill:()=>tl,WorkbookCellFormat:()=>qo,WorkbookChart:()=>jo,WorkbookConditionalFormat:()=>el,WorkbookDataValidation:()=>Ko,WorkbookDelete:()=>Xo,WorkbookEdit:()=>Wo,WorkbookFilter:()=>zo,WorkbookFindAndReplace:()=>Zo,WorkbookFormula:()=>Lo,WorkbookHyperlink:()=>Go,WorkbookImage:()=>_o,WorkbookInsert:()=>Yo,WorkbookMerge:()=>Qo,WorkbookNumberFormat:()=>Po,WorkbookOpen:()=>lo,WorkbookProtectSheet:()=>Jo,WorkbookSave:()=>uo,WorkbookSort:()=>Vo,WrapText:()=>mh,actionEvents:()=>Fl,activeCellChanged:()=>ve,activeCellMergedRange:()=>Et,activeSheetChanged:()=>Ki,addChartEle:()=>Ls,addContextMenuItems:()=>Di,addDPRValue:()=>Hd,addFileMenuItems:()=>Hi,addHighlight:()=>et,addHyperlink:()=>Ue,addListValidationDropdown:()=>vr,addNote:()=>aa,addRibbonTabs:()=>zi,addToolbarItems:()=>_i,addressHandle:()=>cs,afterHyperlinkClick:()=>He,afterHyperlinkCreate:()=>Me,aggregateComputation:()=>Se,applyCF:()=>kt,applyCellFormat:()=>le,applyLockCells:()=>xt,applyMerge:()=>wt,applyNumberFormatting:()=>te,applyPredicates:()=>Kr,applyProtect:()=>Va,applySort:()=>Zi,autoFill:()=>$s,autoFit:()=>Qi,beforeCellUpdate:()=>ar,beforeCheckboxRender:()=>ro,beforeContentLoaded:()=>pi,beforeDataBound:()=>Ti,beforeDelete:()=>Wt,beforeFilter:()=>ze,beforeHyperlinkClick:()=>Be,beforeHyperlinkCreate:()=>Pe,beforeInsert:()=>qt,beforeRibbonCreate:()=>qi,beforeSort:()=>ke,beforeVirtualContentLoaded:()=>ci,beginAction:()=>K,beginSave:()=>X,cMenuBeforeOpen:()=>vi,calculateFormula:()=>ne,cellNavigate:()=>gi,cellValidation:()=>Qe,chartDesignTab:()=>Ds,chartRangeSelection:()=>As,checkColumnValidation:()=>El,checkDateFormat:()=>ue,checkFormulaRef:()=>lr,checkIsFormula:()=>xr,checkMerge:()=>ts,checkNumberFormat:()=>fe,checkPrevMerge:()=>es,checkRange:()=>jr,checkUniqueRange:()=>Ee,clear:()=>Ft,clearAllFilter:()=>We,clearCF:()=>Tt,clearCFRule:()=>At,clearCellRef:()=>hs,clearChartBorder:()=>Os,clearCopy:()=>Ai,clearFilter:()=>Ra,clearFormulaDependentCells:()=>Re,clearInvalid:()=>Ha,clearRange:()=>Ld,clearUndoRedoCollection:()=>ba,clearViewer:()=>os,click:()=>ni,colWidthChanged:()=>Gi,collaborativeUpdate:()=>Ji,columnIndex:()=>Tr,commputeFormulaValue:()=>pr,completeAction:()=>ka,configureLocalizedFormat:()=>Uo,contentLoaded:()=>Zn,contextMenuOpen:()=>fi,convertToDefaultFormat:()=>Ho,copy:()=>Oi,count:()=>pt,createHyperlinkElement:()=>ua,createImageElement:()=>bs,createNoteIndicator:()=>da,created:()=>Ga,cut:()=>Ri,dataBound:()=>Fi,dataChanged:()=>W,dataSourceChanged:()=>q,dataValidate:()=>tt,dateToInt:()=>en,deInitProperties:()=>Xi,defaultLocale:()=>Ml,deleteAction:()=>Ke,deleteChart:()=>Ss,deleteChartColl:()=>Ut,deleteFormatRange:()=>zr,deleteHyperlink:()=>Gt,deleteImage:()=>xs,deleteModel:()=>Ze,deleteNote:()=>oa,destroyComponent:()=>fd,dialog:()=>Al,duplicateSheet:()=>An,duplicateSheetFilterHandler:()=>sr,editAlert:()=>Xa,editHyperlink:()=>na,editNote:()=>sa,editOperation:()=>ei,editValue:()=>ps,enableContextMenuItems:()=>Pi,enableFileMenuItems:()=>Mi,enableFormulaInput:()=>Za,enableRibbonTabs:()=>Vi,enableToolbarItems:()=>wi,executeTaskAsync:()=>v,exportDialog:()=>J,fillColor:()=>Ll,filterByCellValue:()=>Na,filterCellKeyDown:()=>Aa,filterComplete:()=>je,filterRangeAlert:()=>qe,find:()=>rt,findAllValues:()=>se,findCount:()=>ct,findDlg:()=>qa,findHandler:()=>Wa,findKeyUp:()=>lt,findMaxValue:()=>yd,findToolDlg:()=>Z,findWorkbookHandler:()=>it,focus:()=>Fd,focusBorder:()=>Rs,focusChartBorder:()=>zt,focusRenameInput:()=>hi,fontColor:()=>Dl,forRefSelRender:()=>fs,formulaBar:()=>Yn,formulaBarOperation:()=>ri,formulaBarUpdate:()=>oi,formulaInValidation:()=>Oe,formulaKeyUp:()=>si,formulaOperation:()=>ti,freeze:()=>js,getAddressFromSelectedRange:()=>d,getAddressInfo:()=>h,getAlphalabel:()=>Ao,getAutoDetectFormatParser:()=>Xr,getBeforeActionData:()=>Ca,getBorderHeight:()=>Nd,getBottomOffset:()=>Pd,getCell:()=>Ln,getCellAddress:()=>i,getCellIndexes:()=>r,getCellPosition:()=>Gl,getCellRefValue:()=>hr,getChartColIdxFromClientX:()=>ur,getChartRowIdxFromClientY:()=>cr,getChartsIndexes:()=>Vd,getClientX:()=>od,getClientY:()=>ld,getColGroupWidth:()=>Ul,getColIdxFromClientX:()=>Cs,getColIndex:()=>n,getColorCode:()=>Hn,getColumn:()=>bl,getColumnHeaderText:()=>s,getColumnWidth:()=>Sl,getColumnsWidth:()=>wl,getCustomColors:()=>Un,getDPRValue:()=>pd,getData:()=>ln,getDataRange:()=>Ur,getEndEvent:()=>Ql,getExcludedColumnWidth:()=>Rd,getFillInfo:()=>$t,getFilterRange:()=>Fa,getFilteredColumn:()=>Oa,getFormatFromType:()=>Mo,getFormattedBarText:()=>me,getFormattedCellObject:()=>re,getGcd:()=>Jr,getIndexesFromAddress:()=>o,getLeadingSpaces:()=>Mr,getLineHeight:()=>wd,getLines:()=>Ed,getMaxHgt:()=>Ad,getMaxSheetId:()=>Nn,getModel:()=>hn,getModules:()=>yo,getMoveEvent:()=>Jl,getPageX:()=>dd,getPageY:()=>hd,getPassWord:()=>Hs,getRangeAddress:()=>a,getRangeFromAddress:()=>l,getRangeIndexes:()=>t,getRequiredModules:()=>Nl,getRightIdx:()=>Md,getRow:()=>hl,getRowHeight:()=>fl,getRowIdxFromClientY:()=>ys,getRowsHeight:()=>ml,getScrollBarWidth:()=>_l,getSelectedRange:()=>Sn,getSheet:()=>In,getSheetIndex:()=>vn,getSheetIndexByName:()=>bn,getSheetIndexFromAddress:()=>p,getSheetIndexFromId:()=>yn,getSheetName:()=>On,getSheetNameCount:()=>En,getSheetNameFromAddress:()=>Cn,getSheetProperties:()=>Ud,getSiblingsHeight:()=>jl,getSingleSelectedRange:()=>wn,getSkeletonVal:()=>mo,getSplittedAddressForColumn:()=>kr,getStandardHeight:()=>jd,getStartEvent:()=>Zl,getSwapRange:()=>c,getTextHeight:()=>Sd,getTextHeightWithBorder:()=>Od,getTextSpace:()=>Qt,getTextWidth:()=>Id,getTrailingSpaces:()=>Br,getTypeFromFormat:()=>Bo,getUniqueRange:()=>we,getUpdateUsingRaf:()=>Bl,getUpdatedFormula:()=>Pr,getUpdatedFormulaOnInsertDelete:()=>ir,getUpdatedScrollPosition:()=>eo,getValue:()=>Co,getValueFromFormat:()=>dn,getViewportIndexes:()=>Wr,getWorkbookRequiredModules:()=>C,getautofillDDB:()=>Zt,goToSheet:()=>is,goto:()=>nt,gotoDlg:()=>ja,hasTemplate:()=>bd,hiddenMerge:()=>Qa,hideAutoFillElement:()=>Zs,hideAutoFillOptions:()=>Ys,hideFileMenuItems:()=>Bi,hideRibbonTabs:()=>Ui,hideSheet:()=>ga,hideShow:()=>Rt,hideToolbarItems:()=>ji,importProtectWorkbook:()=>zs,inRange:()=>Nr,inView:()=>Wl,initSheet:()=>Rn,initiateChart:()=>Pt,initiateChartModel:()=>Vt,initiateCur:()=>ds,initiateCustomSort:()=>$i,initiateDataValidation:()=>La,initiateEdit:()=>us,initiateFilter:()=>_e,initiateFilterUI:()=>xa,initiateFormulaReference:()=>ls,initiateHyperlink:()=>ra,initiateSort:()=>Ae,initiatelink:()=>Le,insert:()=>Xe,insertChart:()=>ks,insertDesignChart:()=>Fs,insertFormatRange:()=>Vr,insertImage:()=>gs,insertMerge:()=>Nt,insertModel:()=>$e,insertSheetTab:()=>yi,intToDate:()=>Qr,invalidData:()=>Ba,isCellReference:()=>Sr,isChar:()=>wr,isColumnSelected:()=>Er,isCustomDateTime:()=>Vn,isDateTime:()=>tn,isDiscontinuousRange:()=>Dd,isExternalFileLink:()=>vo,isFilterHidden:()=>ul,isFormulaBarEdit:()=>$n,isHeightCheckNeeded:()=>Lr,isHiddenCol:()=>Il,isHiddenRow:()=>cl,isImported:()=>Yr,isInMultipleRange:()=>Rr,isInRange:()=>Or,isLocked:()=>Ar,isLockedCells:()=>Td,isMouseDown:()=>nd,isMouseMove:()=>id,isMouseUp:()=>ad,isNavigationKey:()=>sd,isNumber:()=>rn,isReadOnly:()=>$r,isReadOnlyCells:()=>zd,isRowSelected:()=>Ir,isSingleCell:()=>m,isTouchEnd:()=>rd,isTouchMove:()=>td,isTouchStart:()=>ed,isUndefined:()=>go,isValidCellReference:()=>Fr,isValidation:()=>Je,keyCodes:()=>Pl,keyDown:()=>ai,keyUp:()=>ii,locale:()=>kl,localeData:()=>on,localizedFormatAction:()=>gr,locateElem:()=>Kl,mergedRange:()=>It,mouseDown:()=>Jn,mouseUpAfterSelection:()=>mi,moveOrDuplicateSheet:()=>Yt,moveSheet:()=>kn,moveSheetHandler:()=>mr,onContentScroll:()=>Yi,onHorizontalScroll:()=>di,onSave:()=>Ye,onVerticalScroll:()=>li,openFailure:()=>Ce,openHyperlink:()=>ia,openSuccess:()=>ye,overlay:()=>Tl,overlayEleSize:()=>qs,parseDecimalNumber:()=>ge,parseFormulaArgument:()=>dr,parseIntValue:()=>an,parseLocaleNumber:()=>qr,paste:()=>ki,performAutoFill:()=>Xs,performUndoRedo:()=>ma,positionAutoFillElement:()=>Gs,processIdx:()=>pn,propertyChange:()=>so,protectCellFormat:()=>_a,protectSelection:()=>Ja,protectSheet:()=>Ua,protectSheetWorkBook:()=>ut,protectWorkbook:()=>Ms,protectsheetHandler:()=>gt,queryCellInfo:()=>ht,rangeSelectionByKeydown:()=>Ni,reApplyFormula:()=>Ne,readonlyAlert:()=>Ka,reapplyFilter:()=>Ea,refreshCell:()=>Kt,refreshCellElement:()=>ie,refreshChart:()=>Bt,refreshChartCellModel:()=>Is,refreshChartCellObj:()=>ws,refreshChartCellOnInit:()=>fr,refreshChartSize:()=>Ht,refreshCheckbox:()=>no,refreshClipboard:()=>er,refreshFilterCellsOnResize:()=>ea,refreshFilterRange:()=>wa,refreshFormulaDatasource:()=>Da,refreshImagePosition:()=>Es,refreshImgCellObj:()=>vs,refreshInsertDelete:()=>nr,refreshOverlayElem:()=>ms,refreshRibbon:()=>Si,refreshRibbonIcons:()=>Mt,refreshSheetTabs:()=>Kn,removeAllChildren:()=>Hl,removeContextMenuItems:()=>Li,removeDataValidation:()=>rs,removeDesignChart:()=>Ts,removeElements:()=>qd,removeHighlight:()=>dt,removeHyperlink:()=>ca,removeNoteContainer:()=>pa,removeRangeEle:()=>Xl,removeSheetTab:()=>Ci,removeUniquecol:()=>Ie,removeWorkbookProtection:()=>Vs,renameSheetTab:()=>bi,renderCFDlg:()=>ss,renderFilterCell:()=>Sa,renderInsertDlg:()=>io,replace:()=>at,replaceAll:()=>st,replaceAllDialog:()=>mt,ribbon:()=>Gn,ribbonClick:()=>xi,rowFillHandler:()=>Jt,rowHeightChanged:()=>Wi,saveCompleted:()=>ee,saveError:()=>_t,selectAutoFillRange:()=>Ks,selectRange:()=>Ei,selectionComplete:()=>rr,selectionStatus:()=>_s,setActionData:()=>ya,setAriaOptions:()=>ud,setAutoFill:()=>Xt,setAutoFit:()=>Ta,setCFRule:()=>Ot,setCell:()=>Pn,setCellFormat:()=>ae,setChart:()=>Lt,setColMinWidth:()=>Bd,setColumn:()=>xl,setFilteredCollection:()=>Q,setImage:()=>Dt,setLinkModel:()=>Ve,setLockCells:()=>bt,setMaxHgt:()=>kd,setMerge:()=>St,setPosition:()=>Yl,setProtectWorkbook:()=>Us,setResize:()=>gd,setRow:()=>pl,setRowEleHeight:()=>xd,setRowHeight:()=>gl,setStandardHeight:()=>_d,setStyleAttribute:()=>$l,setTextLineHeight:()=>vd,setUndoRedo:()=>$a,setValue:()=>bo,setVisibleMergeIndex:()=>Gr,setWidthAndHeight:()=>md,sheetCreated:()=>be,sheetNameUpdate:()=>fa,sheetTabs:()=>Xn,sheetsDestroyed:()=>xe,showAggregate:()=>ns,showFindAlert:()=>ot,showNote:()=>la,showSheet:()=>as,skipDefaultValue:()=>Mn,skipHiddenIdx:()=>Dr,sortComplete:()=>Te,sortImport:()=>$,sortRangeAlert:()=>De,spreadsheetCreated:()=>Ya,spreadsheetDestroyed:()=>Qn,startEdit:()=>Ma,tabSwitch:()=>Ii,textDecorationUpdate:()=>oe,toDate:()=>nn,toFraction:()=>Zr,toggleProtect:()=>ao,triggerDataChange:()=>G,unMerge:()=>or,unProtectSheetPassword:()=>Js,unProtectWorkbook:()=>Bs,undoRedoForChartDesign:()=>Ps,unprotectSheet:()=>za,unprotectsheetHandler:()=>vt,updateAction:()=>Cd,updateCFModel:()=>_r,updateCell:()=>Hr,updateNoteContainer:()=>ha,updateRowColCount:()=>he,updateScroll:()=>Ws,updateScrollValue:()=>to,updateSelectedRange:()=>xn,updateSheetFromDataSource:()=>j,updateSortCollection:()=>Ia,updateSortedDataOnCell:()=>Fe,updateTableWidth:()=>Ns,updateToggle:()=>ft,updateToggleItem:()=>ta,updateTranslate:()=>Qs,updateUndoRedoCollection:()=>va,updateUsedRange:()=>de,updateView:()=>tr,updateWrapCell:()=>oo,validationError:()=>Pa,validationHighlight:()=>jt,virtualContentLoaded:()=>ui,workBookeditAlert:()=>yt,workbookDestroyed:()=>_,workbookEditOperation:()=>ce,workbookFormulaOperation:()=>pe,workbookLocale:()=>sn,workbookOpen:()=>Y,workbookReadonlyAlert:()=>Ct,wrap:()=>Bn,wrapEvent:()=>Ge});var e=u(766);function t(t){var n,i=[];if(t){if(t=-1===(t=t.lastIndexOf("!")>-1?t.substring(t.lastIndexOf("!")+1):t).indexOf(":")?t+":"+t:t,!new RegExp(/^(?=.*[a-zA-Z])(?=.*\d)/g).test(t)){var a=t.split(":");t=(0,e.isNullOrUndefined)(t.match(/[0-9]/))?a[0]+"1:"+a[1]+"1":"A"+a[0]+":A"+a[1]}t.split(":").forEach((function(e){n=r(e),i.push(n[0]),i.push(n[1])}))}return i}function r(e){return[parseInt(e.match(/\d+/)[0],10)-1,n(e.match(/[A-Z]+/i)[0].toUpperCase())]}function n(e){for(var t=0,r=(e=e.split("").reverse().join("")).length-1;r>=0;r--)t+=(e[r].charCodeAt(0)-64)*Math.pow(26,r);return t-1}function i(e,t){return s(t+1)+(e+1)}function a(t){return i(t[0],t[1])+":"+((0,e.isNullOrUndefined)(t[2])?i(t[0],t[1]):i(t[2],t[3]))}function s(e){return e/26>1?s(e%26==0?e/26-1:Math.floor(e/26))+String.fromCharCode(e%26==0?"Z".charCodeAt(0):64+e%26):String.fromCharCode(64+e)}function o(e){return t(l(e))}function l(e){var t=e.lastIndexOf("!");return t>-1?e.substring(t+1):e}function d(e){return e.name+"!"+e.selectedRange}function h(e,t){return{sheetIndex:p(e,t),indices:o(t)}}function p(e,t){return t.indexOf("!")>-1?vn(e,Cn(t)):e.activeSheetIndex}function c(e){var t=e.slice();return e[0]>e[2]&&g(t,0,2),e[1]>e[3]&&g(t,1,3),t}function g(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function m(e){return e[0]===e[2]&&e[1]===e[3]}function v(e,t,r,n,i,a){return new y(e,t,r,n,i,a)}var y=function(){function e(e,t,r,n,i,a){this.preventCallback=!1,this.context=e,this.workerTask=t,this.defaultListener=r,this.workerData=n,this.parent=a,i&&(this.preventCallback=!0),this.initWorker()}return e.prototype.terminate=function(){this.worker.terminate(),URL.revokeObjectURL(this.workerUrl)},e.prototype.initWorker=function(){var e=new Blob([this.getFnCode()],{type:"text/javascript"});if(this.workerUrl=URL.createObjectURL(e),this.worker=new Worker(this.workerUrl),this.worker.onmessage=this.messageFromWorker.bind(this),this.worker.onerror=this.onError.bind(this),this.parent.isVue){var t=JSON.parse(JSON.stringify(this.workerData));this.worker.postMessage(t)}else this.worker.postMessage(this.workerData)},e.prototype.messageFromWorker=function(e){this.terminate(),this.defaultListener.apply(this.context,[e.data])},e.prototype.onError=function(e){if(this.terminate(),!e.message||!e.message.includes("FormData"))throw e.message||e;this.defaultListener.apply(this.context,[{isFormDataError:!0}])},e.prototype.getFnCode=function(){var e,t,r="",n="",i=!1;if("function"==typeof this.workerTask)this.workerTask.toString().indexOf("function")<0?n="function "+this.workerTask.toString():(n=this.workerTask.toString(),i=!0),r+="self.workerTask = "+n+"; \n";else if("object"==typeof this.workerTask)for(t=Object.keys(this.workerTask),e=0;e<t.length;e++)this.workerTask[t[e]].toString().indexOf("function")<0?n="function "+this.workerTask[t[e]].toString():(n=this.workerTask[t[e]].toString(),i=!0),r+=(0===e?"self.workerTask":t[e])+"= "+n+"; \n";return r+="self.onmessage = "+(i?"":" function ")+(this.preventCallback?this.getMessageFn.toString():this.getCallbackMessageFn.toString())+"; \n"},e.prototype.getCallbackMessageFn=function(e){postMessage(this.workerTask.apply(this,e.data))},e.prototype.getMessageFn=function(e){this.workerTask.apply(this,e.data)},e}();function C(e,t){return void 0===t&&(t=[]),t.push({member:"dataBind",args:[e]}),t.push({member:"workbookProtectSheet",args:[e]}),e.allowSave&&t.push({member:"workbookSave",args:[e]}),e.allowPrint&&t.push({member:"print",args:[e]}),e.allowOpen&&t.push({member:"workbookOpen",args:[e]}),e.allowEditing&&(t.push({member:"workbookEdit",args:[e]}),t.push({member:"workbookFormula",args:[e]})),e.allowNumberFormatting&&t.push({member:"workbookNumberFormat",args:[e]}),e.allowCellFormatting&&t.push({member:"workbookcellformat",args:[e]}),e.allowSorting&&t.push({member:"workbookSort",args:[e]}),e.allowHyperlink&&t.push({member:"workbookHyperlink",args:[e]}),e.allowFiltering&&t.push({member:"workbookFilter",args:[e]}),e.allowFindAndReplace&&t.push({member:"workbookfindAndReplace",args:[e]}),e.allowInsert&&t.push({member:"workbookinsert",args:[e]}),e.allowDelete&&t.push({member:"workbookdelete",args:[e]}),e.allowDataValidation&&t.push({member:"workbookDataValidation",args:[e]}),e.allowMerge&&t.push({member:"workbookmerge",args:[e]}),e.allowCellFormatting&&t.push({member:"workbookConditionalFormatting",args:[e]}),e.allowImage&&t.push({member:"workbookImage",args:[e]}),e.allowChart&&t.push({member:"workbookChart",args:[e]}),e.allowAutoFill&&t.push({member:"workbookautofill",args:[e]}),t}var b,x=(b=function(e,t){return b=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},b(e,t)},function(e,t){function r(){this.constructor=e}b(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),S=function(e,t,r,n){var i,a=arguments.length,s=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,n);else for(var o=e.length-1;o>=0;o--)(i=e[o])&&(s=(a<3?i(s):a>3?i(t,r,s):i(t,r))||s);return a>3&&s&&Object.defineProperty(t,r,s),s},w=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return x(r,t),S([(0,e.Property)("Calibri")],r.prototype,"fontFamily",void 0),S([(0,e.Property)("bottom")],r.prototype,"verticalAlign",void 0),S([(0,e.Property)("left")],r.prototype,"textAlign",void 0),S([(0,e.Property)("0pt")],r.prototype,"textIndent",void 0),S([(0,e.Property)("#000000")],r.prototype,"color",void 0),S([(0,e.Property)("#ffffff")],r.prototype,"backgroundColor",void 0),S([(0,e.Property)("normal")],r.prototype,"fontWeight",void 0),S([(0,e.Property)("normal")],r.prototype,"fontStyle",void 0),S([(0,e.Property)("11pt")],r.prototype,"fontSize",void 0),S([(0,e.Property)("none")],r.prototype,"textDecoration",void 0),S([(0,e.Property)("")],r.prototype,"border",void 0),S([(0,e.Property)("")],r.prototype,"borderTop",void 0),S([(0,e.Property)("")],r.prototype,"borderBottom",void 0),S([(0,e.Property)("")],r.prototype,"borderLeft",void 0),S([(0,e.Property)("")],r.prototype,"borderRight",void 0),r}(e.ChildProperty),I=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return x(r,t),S([(0,e.Property)()],r.prototype,"sheetIndex",void 0),S([(0,e.Property)()],r.prototype,"filterRange",void 0),S([(0,e.Property)(!1)],r.prototype,"hasFilter",void 0),S([(0,e.Property)()],r.prototype,"column",void 0),S([(0,e.Property)()],r.prototype,"criteria",void 0),S([(0,e.Property)()],r.prototype,"value",void 0),S([(0,e.Property)()],r.prototype,"dataType",void 0),S([(0,e.Property)()],r.prototype,"predicates",void 0),r}(e.ChildProperty),E=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return x(r,t),S([(0,e.Property)()],r.prototype,"sortRange",void 0),S([(0,e.Property)()],r.prototype,"columnIndex",void 0),S([(0,e.Property)()],r.prototype,"order",void 0),S([(0,e.Property)()],r.prototype,"sheetIndex",void 0),r}(e.ChildProperty),N=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return x(r,t),S([(0,e.Property)("")],r.prototype,"name",void 0),S([(0,e.Property)("")],r.prototype,"scope",void 0),S([(0,e.Property)("")],r.prototype,"comment",void 0),S([(0,e.Property)("")],r.prototype,"refersTo",void 0),r}(e.ChildProperty),R=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return x(r,t),S([(0,e.Property)(!1)],r.prototype,"selectCells",void 0),S([(0,e.Property)(!1)],r.prototype,"selectUnLockedCells",void 0),S([(0,e.Property)(!1)],r.prototype,"formatCells",void 0),S([(0,e.Property)(!1)],r.prototype,"formatRows",void 0),S([(0,e.Property)(!1)],r.prototype,"formatColumns",void 0),S([(0,e.Property)(!1)],r.prototype,"insertLink",void 0),r}(e.ChildProperty),O=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return x(r,t),S([(0,e.Property)("")],r.prototype,"address",void 0),r}(e.ChildProperty),k=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return x(r,t),S([(0,e.Property)("WholeNumber")],r.prototype,"type",void 0),S([(0,e.Property)("Between")],r.prototype,"operator",void 0),S([(0,e.Property)("0")],r.prototype,"value1",void 0),S([(0,e.Property)("0")],r.prototype,"value2",void 0),S([(0,e.Property)(!0)],r.prototype,"ignoreBlank",void 0),S([(0,e.Property)(!0)],r.prototype,"inCellDropDown",void 0),S([(0,e.Property)(!1)],r.prototype,"isHighlighted",void 0),S([(0,e.Property)("")],r.prototype,"address",void 0),r}(e.ChildProperty),A=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return x(r,t),S([(0,e.Property)("General")],r.prototype,"format",void 0),S([(0,e.Complex)({},w)],r.prototype,"style",void 0),S([(0,e.Property)(!0)],r.prototype,"isLocked",void 0),r}(e.ChildProperty),F=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return x(r,t),S([(0,e.Property)("GreaterThan")],r.prototype,"type",void 0),S([(0,e.Complex)({},A)],r.prototype,"format",void 0),S([(0,e.Property)("RedFT")],r.prototype,"cFColor",void 0),S([(0,e.Property)("")],r.prototype,"value",void 0),S([(0,e.Property)("")],r.prototype,"range",void 0),S([(0,e.Property)("")],r.prototype,"action",void 0),r}(e.ChildProperty),T=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return x(r,t),S([(0,e.Property)(!0)],r.prototype,"visible",void 0),S([(0,e.Property)("Auto")],r.prototype,"position",void 0),r}(e.ChildProperty),D=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return x(r,t),S([(0,e.Property)(!1)],r.prototype,"visible",void 0),S([(0,e.Property)("Auto")],r.prototype,"position",void 0),r}(e.ChildProperty),L=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return x(r,t),S([(0,e.Property)("")],r.prototype,"color",void 0),S([(0,e.Property)(1)],r.prototype,"width",void 0),r}(e.ChildProperty),P=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return x(r,t),S([(0,e.Property)(!1)],r.prototype,"visible",void 0),S([(0,e.Property)("Circle")],r.prototype,"shape",void 0),S([(0,e.Property)(5)],r.prototype,"size",void 0),S([(0,e.Property)(null)],r.prototype,"fill",void 0),S([(0,e.Property)(!0)],r.prototype,"isFilled",void 0),S([(0,e.Complex)({},L)],r.prototype,"border",void 0),r}(e.ChildProperty),M=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return x(r,t),S([(0,e.Property)(0)],r.prototype,"width",void 0),r}(e.ChildProperty),B=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return x(r,t),S([(0,e.Property)(0)],r.prototype,"width",void 0),r}(e.ChildProperty),H=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return x(r,t),S([(0,e.Property)("")],r.prototype,"title",void 0),S([(0,e.Complex)({},M)],r.prototype,"majorGridLines",void 0),S([(0,e.Complex)({},B)],r.prototype,"minorGridLines",void 0),S([(0,e.Property)(!0)],r.prototype,"visible",void 0),r}(e.ChildProperty),U=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return x(r,t),S([(0,e.Property)("Line")],r.prototype,"type",void 0),S([(0,e.Property)("Material")],r.prototype,"theme",void 0),S([(0,e.Property)(!1)],r.prototype,"isSeriesInRows",void 0),S([(0,e.Complex)({},P)],r.prototype,"markerSettings",void 0),S([(0,e.Property)("")],r.prototype,"range",void 0),S([(0,e.Property)("")],r.prototype,"id",void 0),S([(0,e.Property)("")],r.prototype,"title",void 0),S([(0,e.Property)(290)],r.prototype,"height",void 0),S([(0,e.Property)(480)],r.prototype,"width",void 0),S([(0,e.Property)(0)],r.prototype,"top",void 0),S([(0,e.Property)(0)],r.prototype,"left",void 0),S([(0,e.Complex)({},T)],r.prototype,"legendSettings",void 0),S([(0,e.Complex)({},H)],r.prototype,"primaryXAxis",void 0),S([(0,e.Complex)({},H)],r.prototype,"primaryYAxis",void 0),S([(0,e.Complex)({},D)],r.prototype,"dataLabelSettings",void 0),r}(e.ChildProperty),V=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return x(r,t),S([(0,e.Property)("")],r.prototype,"src",void 0),S([(0,e.Property)("")],r.prototype,"id",void 0),S([(0,e.Property)(300)],r.prototype,"height",void 0),S([(0,e.Property)(400)],r.prototype,"width",void 0),S([(0,e.Property)(0)],r.prototype,"top",void 0),S([(0,e.Property)(0)],r.prototype,"left",void 0),r}(e.ChildProperty),z=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return x(r,t),S([(0,e.Property)("FillSeries")],r.prototype,"fillType",void 0),S([(0,e.Property)(!0)],r.prototype,"showFillOptions",void 0),r}(e.ChildProperty),_="workbookDestroyed",j="updateSheetFromDataSource",q="dataSourceChanged",W="dataChanged",G="triggerDataChange",Y="workbookOpen",X="beginSave",K="actionBegin",$="sortImport",Z="findToolDlg",J="exportDialog",Q="setFilteredCollection",ee="saveCompleted",te="applyNumber",re="getFormattedCell",ne="calculateFormula",ie="refreshCellElem",ae="setCellFormat",se="findAllValues",oe="textDecorationUpdate",le="applyCellFormat",de="updateUsedRange",he="updateRowColCount",pe="workbookFormulaOperation",ce="workbookEditOperation",ue="checkDateFormat",fe="checkNumberFormat",ge="parseDecimalNumber",me="getFormattedBarText",ve="activeCellChanged",ye="openSuccess",Ce="openFailure",be="sheetCreated",xe="sheetsDestroyed",Se="aggregateComputation",we="getUniqueRange",Ie="removeUniquecol",Ee="checkUniqueRange",Ne="reApplyFormula",Re="clearFormulaDependentCells",Oe="formulaInValidation",ke="beforeSort",Ae="initiateSort",Fe="updateSortedDataOnCell",Te="sortComplete",De="sortRangeAlert",Le="initiatelink",Pe="beforeHyperlinkCreate",Me="afterHyperlinkCreate",Be="beforeHyperlinkClick",He="afterHyperlinkClick",Ue="addHyperlink",Ve="setLinkModel",ze="beforeFilter",_e="initiateFilter",je="filterComplete",qe="filterRangeAlert",We="clearAllFilter",Ge="wrapText",Ye="onSave",Xe="insert",Ke="delete",$e="insertModel",Ze="deleteModel",Je="isValidation",Qe="cellValidation",et="addHighlight",tt="dataValidate",rt="find",nt="gotoHandler",it="findHandler",at="replace",st="replaceAll",ot="showFindAlert",lt="findKeyUp",dt="removeHighlight",ht="queryCellInfo",pt="count",ct="findCount",ut="protectSheet",ft="updateToggleItem",gt="protectsheetHandler",mt="replaceAllDialog",vt="unprotectsheetHandler",yt="editAlert",Ct="readonlyAlert",bt="setLockCells",xt="applyLockCells",St="setMerge",wt="applyMerge",It="mergedRange",Et="activeCellMergedRange",Nt="insertMerge",Rt="hideShow",Ot="setCFRule",kt="applyCF",At="clearCFRule",Ft="clear",Tt="clearCF",Dt="setImage",Lt="setChart",Pt="initiateChart",Mt="refreshRibbonIcons",Bt="refreshChart",Ht="refreshChartSize",Ut="deleteChartColl",Vt="initiateChartModel",zt="focusChartBorder",_t="saveError",jt="validationHighlight",qt="beforeInsert",Wt="beforeDelete",Gt="deleteHyperlink",Yt="moveOrDuplicateSheet",Xt="setAutoFill",Kt="refreshCell",$t="getFillInfo",Zt="getautofillDDB",Jt="rowFillHandler",Qt="getTextSpace",er="refreshClipboard",tr="updateView",rr="selectionComplete",nr="refreshInsertDelete",ir="getUpdatedFormulaOnInsertDelete",ar="beforeCellUpdate",sr="duplicateSheetFilterHandler",or="unMerge",lr="checkFormulaRef",dr="parseFormulaArgument",hr="getCellRefValue",pr="commputeFormulaValue",cr="getChartRowIdxFromClientY",ur="getChartColIdxFromClientX",fr="refreshChartCellOnInit",gr="localizedFormatAction",mr="moveSheetHandler",vr="addListValidationDropdown";function yr(t,r,n,i,a){var s=t.value;return rn(s)||s&&"string"==typeof s&&(a&&s.includes(a)&&(t.format.includes(a)||t.format.includes("$"))&&(s=s.replace(a,"").trim()),n&&s.includes(n)&&Cr(s,r,n,i)&&(s=s.split(n).join("").trim()),i||(i=(0,e.getNumericObject)(r).decimal),"."!==i&&s.includes(i)&&(s=s.replace(i,".").trim()),rn(s))?{isNumber:!0,value:s}:{isNumber:!1,value:s}}function Cr(t,r,n,i){for(var a=!1,s=123456..toLocaleString(r).split(n).reverse(),o=t.split(i)[0].split(n),l=0;l<o.length&&(a=l===o.length-1?o[l].length===s[0].length:!(0,e.isUndefined)(s[1])&&(0===l?o[l].length<=s[1].length:o[l].length===s[1].length));l++);return a}var br=u(74);function xr(e,t){return e&&"="===e[0]&&(e.length>1||t)}function Sr(e){var t=e;if((t=t.split("$").join("")).indexOf(":")>-1){var r=t.split(":");if(Fr(r[0])&&Fr(r[1]))return!0}else if(t.indexOf(":")<0&&Fr(t))return!0;return!1}function wr(e){return e.charCodeAt(0)>=65&&e.charCodeAt(0)<=90||e.charCodeAt(0)>=97&&e.charCodeAt(0)<=122}function Ir(e,t){return 0===t[1]&&t[3]===e.colCount-1}function Er(e,t){return 0===t[0]&&t[2]===e.rowCount-1}function Nr(e,t,r){return e&&t>=e[0]&&t<=e[2]&&r>=e[1]&&r<=e[3]}function Rr(e,r,n){for(var i,a=e.split(" "),s=0,o=a.length;s<o&&!(i=Nr(t(a[s]),r,n));s++);return i}function Or(e,t,r){var n=e[0]<=t[0]&&e[2]>=t[2]&&e[1]<=t[1]&&e[3]>=t[3];if(n)return!0;if(r){if(t[0]<e[0]&&t[2]<e[0]||t[0]>e[2]&&t[2]>e[2])return!1;if(t[0]<e[0]&&t[2]>e[0]&&(t[0]=e[0],n=!0),t[2]>e[2]&&(t[2]=e[2],n=!0),t[1]<e[1]&&t[3]<e[1]||t[1]>e[3]&&t[3]>e[3])return!1;t[1]<e[1]&&t[3]>e[1]&&(t[1]=e[1],n=!0),t[3]>e[3]&&(t[3]=e[3],n=!0)}return n}function kr(e,r,n){var i=s(n+1);return e?e.split(" ").forEach((function(n){var a=t(n);if(Or(a,r))e=e.split(n).join(i+(a[0]+1)+":"+i+r[0]+" "+i+(r[2]+2)+":"+i+(a[2]+1));else if(Or(a,r,!0)){var s=void 0;s=r[0]>a[0]?i+(a[0]+1)+":"+i+r[0]:i+(r[2]+2)+":"+i+(a[2]+1),e=e.split(n).join(s)}})):e=i+"1:"+i+r[0]+" "+i+(r[2]+2)+":"+i+"1048576",e}function Ar(e,t){return e||(e={}),!!e.isLocked||!1!==e.isLocked&&(!(!t||!t.isLocked)||!(e.isLocked||!t||!1===t.isLocked))}function Fr(e){for(var t,r=e,n=0,i=r.length,a=0;a<i;a++)wr(r[a])&&n++;var s=(t=r.substring(0,n)).length;if(s!==i&&s<4&&1!==i&&isNaN(parseInt(r,10))){if(Tr(t)>16384)return!1;var o=parseFloat(r.substring(n,i));if(o>0&&o<1048577)return!0}return!1}function Tr(e){var t=0,r=0;if(t<(e=e.toUpperCase()).length&&"!"===e[t]){for(t++;t<e.length&&"!"!==e[t];)t++;t++}for(;t<e.length&&wr(e[t]);){r=26*r+e[t].charCodeAt(0)-64,t++}return 0===r?-1:r}function Dr(e,t,r,n,i){var a;if(void 0===n&&(n="rows"),r)for(var s=t;s<1/0;s++)if((a=e[""+n])[t]&&a[t].hidden)t++;else{if(!i)break;i--,t++}else for(s=t;s>-1&&((a=e[""+n])[t]&&a[t].hidden);s--)t--;return t}function Lr(e,t){var r=Object.keys(e);return(t?r.indexOf("fontSize")>-1:r.indexOf("fontSize")>-1&&Number(e.fontSize.split("pt")[0])>12)||r.indexOf("fontFamily")>-1||r.indexOf("borderTop")>-1||r.indexOf("borderBottom")>-1}function Pr(e,r,n,a,s,o){var l,d;if(r&&(l=(d=s||Ln(r[0],r[1],n,!1,!0)).formula||""),l){o&&a.notify(Re,{cellRef:i(r[0],r[1])}),0===l.indexOf("=")&&(l=l.slice(1));for(var h=["+","-","*","/",">=","<=","<>",">","<","=","%","&"],p=void 0,c=l=l.split("(").join(a.listSeparator).split(")").join(a.listSeparator),u=0;u<h.length;u++)p=c.split(h[u]),c=p.join(a.listSeparator);p=c.split(a.listSeparator);for(var f=[],g=void 0,m=void 0,v=void 0,y=void 0,C=void 0,b=0;b<p.length;b++){if(v=p[b].includes("!")){var x=p[b].lastIndexOf("!");y=p[b].substring(0,x),C=p[b].substring(x+1).toUpperCase()}else C=p[b].toUpperCase();if(Sr(C.trim())&&!C.includes("$")){var S=Mr(C),w=Br(C),I=t(C),E=[e[0]-(r[0]-I[0]),e[1]-(r[1]-I[1]),e[0]-(r[0]-I[2]),e[1]-(r[1]-I[3])];E[1]<0||E[2]<0||E[3]<0||!o&&E[0]<0?g="#REF!":(o&&E[0]<0&&(E[0]=E[2]),g=i(E[0],E[1]),C.includes(":")&&(g+=":"+i(E[2],E[3])),g=Sr(g)?g:"#REF!"),v&&(g=y+"!"+g),(m={})[p[b]]=""+S+g+w,p[b].includes(":")?f.splice(0,0,m):f.push(m)}}var N=void 0,R=void 0,O=l=d.formula;for(b=0;b<f.length;b++){N=Object.keys(f[b])[0],R=f[b][""+N];for(var k=N.length,A=O.indexOf(N),F="",T=0;T<R.length;T++)F+=" ";l=l.slice(0,A)+R+l.slice(A+k),O=O.slice(0,A)+F+O.slice(A+k)}return l}return null}function Mr(e){for(var t="",r=0;r<e.length&&" "===e[r];r++)t+=" ";return t}function Br(e){for(var t="",r=e.length-1;r>=0&&" "===e[r];r--)t=" "+t;return t}function Hr(e,t,r,n,a){var s={cell:r.cell,rowIndex:r.rowIdx,colIndex:r.colIdx,cancel:!1,sheet:t.name};if(r.preventEvt||e.trigger(ar,s),!r.eventOnly&&!s.cancel)if(r.valChange){var o=Ln(s.rowIndex,s.colIndex,t),l=!r.preventEvt&&e.getDisplayText(o),d=!(!o||!o.formula);Pn(s.rowIndex,s.colIndex,t,s.cell,!r.pvtExtend);var h=Ln(s.rowIndex,s.colIndex,t,!1,!0);r.mergedCells&&(delete h.value,delete h.formula),h.formattedText&&delete h.formattedText;var p={action:"updateCellValue",address:[s.rowIndex,s.colIndex],sheetIndex:vn(e,t.name),value:d&&!h.formula?h.value||(0===h.value?"0":""):h.formula||h.value||(0===h.value?"0":""),skipFormatCheck:r.skipFormatCheck,isRandomFormula:r.isRandomFormula,isDelete:r.isDelete,deletedRange:r.deletedRange,fillType:r.fillType,cellInformation:n,isRedo:!a,actionName:r.fillType,isPaste:"paste"===r.requestType};if(e.notify(ce,p),r.isFormulaDependent=p.isFormulaDependent,r.requestType&&null===s.cell&&Pn(s.rowIndex,s.colIndex,t,s.cell,!r.pvtExtend),r.cellDelete&&(delete h.value,delete h.formula,delete h.hyperlink),r.uiRefresh&&e.serviceLocator.getService("cell").refresh(s.rowIndex,s.colIndex,r.lastCell,r.td,r.checkCF,r.checkWrap,r.skipFormatCheck,r.isRandomFormula,r.fillType),!r.preventEvt){var c=e.getDisplayText(h);if(c!==l){var u=Ln(s.rowIndex,s.colIndex,t,!1,!0).value,f={value:u=u||(0===u?"0":""),oldValue:l,formula:h.formula||"",address:t.name+"!"+i(s.rowIndex,s.colIndex),displayText:c};r.requestType&&(f.requestType=r.requestType),e.trigger("cellSave",f)}}}else Pn(s.rowIndex,s.colIndex,t,s.cell,!r.pvtExtend);return s.cancel}function Ur(t,r,n){for(var i=t,a=t,s=r,o=r,l=n.usedRange.rowIndex,d=n.usedRange.colIndex,h=function(t){for(var r=0;r<=d;r++)if(!(0,e.isUndefined)(Ln(t,r,n,null,!0).value))return!1;return!0},p=function(t){for(var r=i;r<=a;r++)if(!(0,e.isUndefined)(Ln(r,t,n,null,!0).value))return!1;return!0},c=i;c<=l&&(!(0,e.isUndefined)(Ln(c,r,n,null,!0).value)||!h(c));c++)a=c;for(c=i;c>=0&&(!(0,e.isUndefined)(Ln(c,r,n,null,!0).value)||!h(c));c--)i=c;for(c=s;c<=d&&(!(0,e.isUndefined)(Ln(t,c,n,null,!0).value)||!p(c));c++)o=c;for(c=s;c>=0&&(!(0,e.isUndefined)(Ln(t,c,n,null,!0).value)||!p(c));c--)s=c;return[i,s,a,o]}function Vr(e,r,n){var i=t(e.model.selectedRange),a=0,s=0;if("Column"===e.modelType){if((n||"before"===e.insertType&&e.isUndoRedo)&&(i=[0,e.start,0,e.end]),"before"===e.insertType)r[1]<=i[1]&&r[3]>=i[1]?(a=0,s=i[3]-i[1]+1):i[1]<r[1]&&(a=s=i[3]-i[1]+1);else{if(e.isUndoRedo){var o=e.end-e.start+1;i=[0,e.start-o,0,e.end-o]}r[1]<=i[3]&&r[3]>=i[3]?(a=0,s=i[3]-i[1]+1):i[3]<r[3]&&(a=s=i[3]-i[1]+1)}return[r[0],r[1]+a,r[2],r[3]+s]}if((n||"above"===e.insertType&&e.isUndoRedo)&&(i=[e.start,0,e.end,0]),"above"===e.insertType)r[0]<=i[0]&&r[2]>=i[0]?(a=0,s=i[2]-i[0]+1):i[0]<r[0]&&(a=s=i[2]-i[0]+1);else{if(e.isUndoRedo){o=e.end-e.start+1;i=[e.start-o,0,e.end-o,0]}r[0]<=i[2]&&r[2]>=i[2]?(a=0,s=i[2]-i[0]+1):i[2]<r[2]&&(a=s=i[2]-i[0]+1)}return[r[0]+a,r[1],r[2]+s,r[3]]}function zr(e,t){var r,n=0,i=0;return"Column"===e.modelType?((r=[0,e.start,e.model.usedRange.rowIndex,e.end])[3]<t[1]?n=i=r[3]-r[1]+1:r[1]>=t[1]&&r[3]<=t[3]?i=r[3]-r[1]+1:r[1]>=t[1]&&r[1]<=t[3]?i=t[3]-r[1]+1:r[1]<t[1]&&r[3]>=t[1]?(n=t[1]-r[1],i=r[3]-r[1]+1):r[1]<t[1]&&r[3]<t[3]&&(n=r[3]-t[1]+(r[3]-r[1])+1,i=r[3]-r[1]+1),[t[0],t[1]-n,t[2],t[3]-i]):((r=[e.start,0,e.end,e.model.usedRange.colIndex])[2]<t[0]?n=i=r[2]-r[0]+1:r[0]>=t[0]&&r[2]<=t[2]?i=r[2]-r[0]+1:r[0]>=t[0]&&r[0]<=t[2]?i=t[2]-r[0]+1:r[0]<t[0]&&r[2]>=t[0]?(n=t[0]-r[0],i=r[2]-r[0]+1):r[0]<t[0]&&r[2]<t[2]&&(n=r[2]-t[0]+(r[2]-r[0])+1,i=r[2]-r[0]+1),[t[0]-n,t[1],t[2]-i,t[3]])}function _r(e,r,n,i,s,o,l){for(var d,h,p=e.length-1;p>=0;p--){d=e[p].range.trim().split(",");for(var c=0;c<d.length;c++){if(n>=(h=t(d[c].includes(":")?d[c]:d[c]+":"+d[c]))[0]&&i>=h[1]&&n<=h[2]&&i<=h[3]){r.push(e[p]),e.splice(p,1);break}if(s&&s[0]>=h[0]&&s[1]>=h[1]&&s[0]<=h[2]&&s[1]<=h[3]){var u={action:"autofillWithCF",cFColor:e[p].cFColor,range:a(o),type:e[p].type,value:e[p].value};e.splice(p,1);for(var f=0,g=l.conditionalFormats;f<g.length&&("autofillWithCF"!==g[f].action||g[f].range!==u.range);f++)f===g.length-1&&(r.push(u),l.conditionalFormats.push(u));break}}}}function jr(e,r){for(var n,i,a,s,o,l=r.trim().split(","),d=function(e){for(var r=0;r<l.length;r++){if(o=t(l[r].includes(":")?l[r]:l[r]+":"+l[r]),e[0]<=o[0]&&e[1]<=o[1]&&e[2]>=o[2]&&e[3]>=o[3])return!0;if(a=e[0]>=o[0]&&e[0]<=o[2],s=e[2]>=o[0]&&e[2]<=o[2],n=e[1]>=o[1]&&e[1]<=o[3],i=e[3]>=o[1]&&e[3]<=o[3],a&&s){if(n||i||e[1]<o[1]&&e[3]>o[3]){if(e[0]-o[0]>0)return!0;if(o[2]-e[2]>0)return!0}if(n&&e[1]!==o[1])return!0;if(i&&e[3]!==o[3])return!0}else if(n&&i){if(a||s||e[0]<o[0]&&e[2]>o[2]){if(e[1]-o[1]>0)return!0;if(o[3]-e[3]>0)return!0}if(a){if(e[0]!==o[0])return!0}else if(s&&e[2]!==o[2])return!0}else if(a||s){if(n){if(e[1]!==o[1])return!0;if(e[0]-o[0]>0)return!0;if(o[2]-e[2]>0)return!0}else if(i){if(e[3]!==o[3])return!0;if(e[0]-o[0]>0)return!0;if(o[2]-e[2]>0)return!0}else if(e[1]<o[1]&&e[3]>o[3])return!0}else if((n||i)&&e[0]<o[0]&&e[2]>o[2])return!0}return!1},h=0;h<e.length;h++)if(d(e[h]))return!0;return!1}function qr(t,r,n){var i;n||(n=(0,e.getNumericObject)(r.locale));for(var a=0;a<t.length;a++)rn(t[a])?"."===n.group&&(t[a]=t[a].toString(),t[a].indexOf(".")&&Cr(t[a],r.locale,n.group,n.decimal)&&(t[a]=t[a].split(n.group).join(""))):(i={formattedText:t[a],value:t[a],format:"General",cell:{value:t[a],format:"General"},isEdit:!0},r.notify(re,i),rn(i.value)&&(t[a]=i.value.toString()));return t}function Wr(e,t){var n=e.getActiveSheet(),i=[[t.topIndex+e.frozenRowCount(n),t.leftIndex+e.frozenColCount(n),t.bottomIndex,t.rightIndex]];if(n.frozenRows||n.frozenColumns){var a=e.frozenRowCount(n),s=e.frozenColCount(n),o=r(n.topLeftCell);if(a&&s){i.push([o[0],o[1],a-1,s-1]);var l=r(n.paneTopLeftCell);i.push([l[0],o[1],t.bottomIndex,s-1])}a&&i.push([o[0],t.leftIndex+s,a-1,t.rightIndex]),s&&i.push([t.topIndex+a,o[1],t.bottomIndex,s-1])}return i}function Gr(e){var t;cl(e.sheet,e.rowIdx)&&((t=Dr(e.sheet,e.rowIdx,!0))<e.rowIdx+e.cell.rowSpan&&(e.rowIdx=t,e.isMergedHiddenCell=!0));Il(e.sheet,e.colIdx)&&((t=Dr(e.sheet,e.colIdx,!0,"columns"))<e.colIdx+e.cell.colSpan&&(e.colIdx=t,e.isMergedHiddenCell=!0))}function Yr(e){return e.workbookOpenModule&&e.workbookOpenModule.preventFormatCheck}function Xr(t){var r=new e.Internationalization,n={intl:r,updateValue:!0,value:"",curSymbol:(0,e.getNumberDependable)(t.locale,e.defaultCurrencyCode)},i={args:n,intl:r},a=(0,e.getNumericObject)(t.locale);return function(e){if(!e.format&&e.value&&!rn(e.value)&&(n.cell=e,n.value=e.value,t.notify(ue,n),!e.format)){var r=e.value.toString();r.includes(i.args.curSymbol)||r.includes(a.group)||r.includes("%")?(i.fResult=r,t.notify(fe,i)):"."===a.decimal||rn(r)||r.includes(a.decimal)&&rn(r=r.replace(a.decimal,"."))&&(e.value=r)}}}function Kr(e,t,r){var n=new br.Query;t.length&&n.where(br.Predicate.and(t));var i=e.executeLocal(n);if(r)for(var a=0,s=r.length;a<s&&i.length;a++)n=new br.Query,r[a].length&&n.where(br.Predicate.or(r[a])),i=new br.DataManager(i).executeLocal(n);return i}function $r(e,t,r){return e&&e.isReadOnly||r&&r.isReadOnly||t&&t.isReadOnly}function Zr(e){var t=e.toString();if(e===parseInt(t,10))return parseInt(t,10)+" ";var r=t.indexOf(".")>-1?t.split(".")[1]:0,n=Math.pow(10,r.toString().replace("-","").length),i=Math.abs(Jr(r,n));return r/i+"/"+n/i}function Jr(e,t){return e=Number(e),(t=Number(t))?Jr(t,e%t):e}function Qr(e){(e=(e=Number(e))>0&&e<1?1+e:0===e?1:e)>60&&(e-=1);var t=new Date("01/01/1900"),r=Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds());return new Date(new Date(864e5*(e-1)+r).toUTCString().replace(" GMT",""))}function en(e,t,r){var n=new Date("01/01/1900"),i=tn(e)?e:new Date(e),a=Date.UTC(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds()),s=(Date.UTC(i.getFullYear(),i.getMonth(),i.getDate(),i.getHours(),i.getMinutes(),i.getSeconds(),i.getMilliseconds())-a)/864e5;return(t?s:parseInt(s.toString(),10))+(r?0:s>60?2:1)}function tn(e){return"[object Date]"===Object.prototype.toString.call(e)&&!isNaN(e.valueOf())}function rn(e){return e-parseFloat(e)>=0}function nn(t,r,n,i,a,s){var o,l=e.IntlBase.getDependables(e.cldrData,n,null).dateObject,d=l.dateTimeFormats.availableFormats,h={dateObj:null,isCustom:!1,type:""},p=function(){"time"===h.type&&(h.dateObj=new Date((o?o.toDateString():"01/01/1900")+" "+h.dateObj.toLocaleTimeString()))};if(i&&(h.dateObj=r.parseDate(t,{format:i}),h.dateObj&&(h.type=t.toString().indexOf(":")>-1?"time":"datetime",p(),h.isCustom=!0)),(0,e.isNullOrUndefined)(h.dateObj)){if((t=t.toString())&&t.indexOf("/")>-1||t.indexOf("-")>0){var c=a&&a.format||i;if(c){var u=c.toLowerCase().includes("dd-mm-yy");if((u||c.toLowerCase().includes("dd/mm/yy"))&&(c=u?"d-M-y":"d/M/y",h.dateObj=r.parseDate(t,{format:c,skeleton:"yMd"}),h.dateObj))return h.type="date",h}}var f=function(t){if(t.indexOf(":")<0)for(var n=0,i=Object.keys(l.dateFormats);n<i.length;n++){var a=i[n];if(h.dateObj=r.parseDate(t,{format:l.dateFormats[""+a],skeleton:a}),h.dateObj){h.type="date",h.isCustom=!1;break}}if((0,e.isNullOrUndefined)(h.dateObj))for(var s=void 0,o=0,c=Object.keys(d);o<c.length;o++){a=c[o];if(s=d[""+a],h.dateObj=r.parseDate(t,{format:s,skeleton:a}),!h.dateObj&&t.indexOf(":")>-1&&s.indexOf(":")>-1&&(h.dateObj=r.parseDate(t,{format:s.split(" ")[0]})),h.dateObj){h.type=t.toString().indexOf(":")>-1?"time":"datetime",p(),h.isCustom=!0;break}}if((0,e.isNullOrUndefined)(h.dateObj))for(var u=0,f=Object.keys(l.timeFormats);u<f.length;u++){a=f[u];if(h.dateObj=r.parseDate(t,{format:l.timeFormats[""+a],skeleton:a}),h.dateObj){h.type="time",p(),h.isCustom=!1;break}}};if(s){var g=t.split(" ");g.length>=2&&(f(g.shift()),h.dateObj&&(o=h.dateObj,h.dateObj=null,f(g.join(" ")),h.dateObj&&(h.type="datetime")))}else f(t)}return"#DIV/0!"===t||h.dateObj||"Invalid Date"===new Date(t).toString()||(h.dateObj=new Date(t),h.type="date"),h}function an(e,t){if(e&&"."!==e&&"-"!==e){var r=e.toString(),n=Number.MAX_SAFE_INTEGER.toString().length;if(r.startsWith("-")&&(r=(r=r.slice(1)).includes("-")?e:r),/^\d*\.?\d*$/.test(r))return t&&r.length>n?e:parseFloat(e)}return e}var sn="spreadsheetLocale",on={SortOutOfRangeError:"Select a cell or range inside the used range and try again."};function ln(r,n,a,l,d,h,p,c,u,f,g,m){return void 0===u&&(u=!0),new Promise((function(v){v(function(){var v,y=n.lastIndexOf("!");y>-1?(v=vn(r,n.substring(0,y)),n=n.substring(y+1)):v=r.activeSheetIndex;var C=In(r,v),b=o(f||n),x={sheet:C,indexes:b,formulaCellRef:p,sheetIndex:c,promise:new Promise((function(e){e(void 0)}))};return r.notify(j,x),x.promise.then((function(){var o,p,c,f=b[0],v=r.frozenRowCount(C),y=r.frozenColCount(C),x=!!m;if(a){var S,w,I,E,N,R,O,k;c=[],l?(R=(0,e.getNumericObject)(r.locale),O=new e.Internationalization(r.locale)):k=Xr(r),n.split(",").forEach((function(n,i){for(b=t(n),S=0,f=b[0];f<=b[2];){for(w=c[S]||{},p=hl(C,f),o=b[1];o<=b[3];)if(!u||!cl(C,f)||h&&ul(C,f)){E=s(o+1);var a=p?Ln(f,o,C):null;l?(a&&(a.value||0===a.value)?(a.formattedText&&a.format&&!a.format.includes("*")?Vn(a.format,!1)?w[E]=Qr(a.value):w[E]=a.formattedText.toString().trim():w[E]=dn(r,a,f,o,!1,O),"string"==typeof(N=a.value)&&("."!==R.decimal&&N.includes(R.decimal)?rn(I=N.replace(R.decimal,"."))&&(N=parseFloat(I)):rn(N)&&(N=parseFloat(N)))):(w[E]="",N=null),w[E+"_value"]=N):(a&&(a.formula||!(0,e.isNullOrUndefined)(a.value))||Object.keys(w).length)&&(o===g?((N={value:dn(r,a,f,o,!0)}).value&&"string"==typeof N.value&&(rn(N.value)?a.format&&"@"===a.format||(N.value=parseFloat(N.value)):a.format||(k(a),rn(a.value)&&(N.value=parseFloat(a.value)))),w[E]=(0,e.extend)({},a,N)):w[E]=a),o===b[3]&&Object.keys(w).length&&(w.__rowIndex=(f+1).toString(),c[S]=w,x&&0===i&&!ul(C,f)&&m.push(w),S++),o++}else f++;f++}}))}else{c=new Map;for(var A=!(l||!d||!d.length);f<=b[2];)if(A&&f>=v&&f<d[0])f=d[0];else if(l||!cl(C,f)){for(p=hl(C,f),o=b[1];o<=b[3];){var F={cell:Ln(f,o,C),address:i(f,o),rowIndex:f,colIndex:o};r.trigger(ht,F);var T=Ln(f,o,C,!1,!0);if(T.formula&&T.formula.toUpperCase().includes("UNIQUE")&&r.notify(ne,{cell:T,rowIdx:f,colIdx:o,sheetIndex:r.activeSheetIndex,address:F.address}),T.colSpan>1&&T.rowSpan>1)for(var D=void 0,L=f,P=f+T.rowSpan;L<P;L++)for(var M=o,B=o+T.colSpan;M<B;M++)L===f&&M===o||(D=new Object,L!==f&&(D.rowSpan=f-L),M!==o&&(D.colSpan=o-M),C.rows[L]&&C.rows[L].cells&&C.rows[L].cells[M]&&(delete C.rows[L].cells[M].value,delete C.rows[L].cells[M].formula),Pn(L,M,C,D,!0));else if(T.colSpan>1)for(L=o+1,P=o+T.colSpan;L<P;L++)Pn(f,L,C,{colSpan:o-L},!0),C.rows[f]&&C.rows[f].cells&&C.rows[f].cells[L]&&(delete C.rows[f].cells[L].value,delete C.rows[f].cells[L].formula);else if(T.rowSpan>1)for(L=f+1,P=f+T.rowSpan;L<P;L++)Pn(L,o,C,{rowSpan:f-L},!0),C.rows[L]&&C.rows[L].cells&&C.rows[L].cells[o]&&(delete C.rows[L].cells[o].value,delete C.rows[L].cells[o].formula);if(l||!Il(C,o))if(A&&o>=y&&o<d[1])o=d[1];else{if(T.style){var H={};Object.assign(H,T.style),T.style=H}c.set(F.address,T),o++}else o++}f++}else f++}return c}))}())}))}function dn(t,r,n,i,a,s){if(r){if((0,e.isNullOrUndefined)(r.value))return"";if(r.format){var o={value:r.value,formattedText:r.value,cell:r,format:r.format,checkDate:!a,rowIndex:n,colIndex:i,dataUpdate:!0};return t.notify(re,o),o.dateObj&&"Invalid Date"!==o.dateObj.toString()?o.dateObj:a?o.value:o.formattedText.toString().trim()}if(a)return r.value;var l=r.value;if(rn(l)&&((l=Number(r.value).toString()).includes(".")||l.length>11)){var d={args:{value:l,updateValue:!0},fResult:l,cellVal:l,intl:s};t.notify(ge,d),l=d.fResult}return l}return""}function hn(t,r){var n,i,a;if((0,e.isUndefined)(t[r])||!t[r]||t[r].index!==r)for(var s=0;s<=r;s++)if(t&&t[s]){if((n=t[s].index-s)>0){for(t.forEach((function(e,t){e&&e.index&&(a=e.index,i=1),e&&!e.index&&0!==t&&(e.index=a+i),i++}));n--;)t.splice(s,0,null);s+=n}}else t?t[s]=null:t=[];return t[r]}function pn(t,r,n,i){var a,s,o=0,l=t.length;i&&t.length>0&&t.sort((function(t,r){return(0,e.isNullOrUndefined)(t)||(0,e.isUndefined)(t.index)||(0,e.isNullOrUndefined)(r)||(0,e.isUndefined)(r.index)?0:t.index-r.index}));for(var d,h=function(i){if((0,e.isNullOrUndefined)(t[i])||(0,e.isUndefined)(t[i].index)||(s=o=t[i].index-i,delete t[i].index),o>0){for(a=0;o--;)r?(n.createSheet(i+a),a++):t.splice(i,0,null);i+=s,l+=s}if(r){t[i].id<1&&(t[i].id=Nn(n.sheets),t[i].properties&&(t[i].properties.id=t[i].id)),t[i].name||n.setSheetPropertyOnMute(t[i],"name","Sheet"+En(n));var h=0;t[i].rows.forEach((function(e){h=Math.max(h,e&&e.cells&&e.cells.length-1||0)})),n.setSheetPropertyOnMute(t[i],"usedRange",{rowIndex:t[i].rows.length?t[i].rows.length-1:0,colIndex:h})}d=i},p=0;p<l;p++)h(p),p=d}var cn=function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},e(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),un=function(e,t,r,n){var i,a=arguments.length,s=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,n);else for(var o=e.length-1;o>=0;o--)(i=e[o])&&(s=(a<3?i(s):a>3?i(t,r,s):i(t,r))||s);return a>3&&s&&Object.defineProperty(t,r,s),s},fn=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return cn(r,t),r.prototype.setProperties=function(e,r){var n=this;if(this.parentObj.isComplexArraySetter&&this.controlParent&&this.controlParent.isAngular)if(Object.keys(e).length){void 0===this.parentObj.currRangeIdx?this.parentObj.currRangeIdx=0:this.parentObj.currRangeIdx+=1;var i=this.parentObj.ranges[this.parentObj.currRangeIdx];i&&i.info&&(this.info=i.info),setTimeout((function(){void 0!==n.parentObj.currRangeIdx&&delete n.parentObj.currRangeIdx}))}else if(this.controlParent.tagObjects[0].instance&&this.controlParent.tagObjects[0].instance.hasChanges&&!this.controlParent.tagObjects[0].instance.isInitChanges){var a=this.controlParent.sheets.indexOf(this.parentObj);if(void 0===this.parentObj.changedRangeIdx){for(var s,o=this.controlParent.tagObjects[0].instance.list[a].tagObjects,l=0;l<o.length;l++)if("ranges"===o[l].name){o[l].instance.list.forEach((function(e,t){e.hasChanges&&(s=t)}));break}this.parentObj.changedRangeIdx=s}}t.prototype.setProperties.call(this,e,r)},un([(0,e.Property)(null)],r.prototype,"dataSource",void 0),un([(0,e.Property)("A1")],r.prototype,"startCell",void 0),un([(0,e.Property)(null)],r.prototype,"query",void 0),un([(0,e.Property)(null)],r.prototype,"fieldsOrder",void 0),un([(0,e.Property)(!0)],r.prototype,"showFieldAsHeader",void 0),un([(0,e.Property)("")],r.prototype,"template",void 0),un([(0,e.Property)("A1")],r.prototype,"address",void 0),r}(e.ChildProperty),gn=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return cn(r,t),un([(0,e.Property)(0)],r.prototype,"rowIndex",void 0),un([(0,e.Property)(0)],r.prototype,"colIndex",void 0),r}(e.ChildProperty),mn=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return cn(r,t),un([(0,e.Property)(null)],r.prototype,"rows",void 0),un([(0,e.Property)(null)],r.prototype,"columns",void 0),un([(0,e.Complex)({},R)],r.prototype,"protectSettings",void 0),un([(0,e.Collection)([],fn)],r.prototype,"ranges",void 0),un([(0,e.Collection)([],F)],r.prototype,"conditionalFormats",void 0),un([(0,e.Property)(0)],r.prototype,"index",void 0),un([(0,e.Property)("")],r.prototype,"name",void 0),un([(0,e.Property)(100)],r.prototype,"rowCount",void 0),un([(0,e.Property)(100)],r.prototype,"colCount",void 0),un([(0,e.Property)("A1:A1")],r.prototype,"selectedRange",void 0),un([(0,e.Property)("A1")],r.prototype,"activeCell",void 0),un([(0,e.Complex)({},gn)],r.prototype,"usedRange",void 0),un([(0,e.Property)("A1")],r.prototype,"topLeftCell",void 0),un([(0,e.Property)(!0)],r.prototype,"showHeaders",void 0),un([(0,e.Property)(!0)],r.prototype,"showGridLines",void 0),un([(0,e.Property)(!1)],r.prototype,"isProtected",void 0),un([(0,e.Property)("Visible")],r.prototype,"state",void 0),un([(0,e.Property)(0)],r.prototype,"frozenRows",void 0),un([(0,e.Property)(0)],r.prototype,"frozenColumns",void 0),un([(0,e.Property)("A1")],r.prototype,"paneTopLeftCell",void 0),un([(0,e.Property)("")],r.prototype,"password",void 0),un([(0,e.Property)(null)],r.prototype,"standardHeight",void 0),un([(0,e.Property)(!1)],r.prototype,"isSheetCalculated",void 0),r}(e.ChildProperty);function vn(e,t){var r;t.startsWith("'")&&t.endsWith("'")&&(t=t.replace(/''/g,"'").replace(/^'|'$/g,""));for(var n=0;n<e.sheets.length;n++)if(e.sheets[n].name.toLowerCase()===t.toLowerCase()){r=n;break}return r}function yn(e,t){for(var r,n=0;n<e.sheets.length;n++)if(e.sheets[n].id===t){r=n;break}return r}function Cn(e){var t=e.lastIndexOf("!");return t>-1?e.substring(0,t).replace(/'/gi,""):e.replace(/'/gi,"")}function bn(e,t,r){for(var n=r.length,i=0;i<n;i++)if(r[i].sheet.toUpperCase()===t.toUpperCase())return r[i].index;return-1}function xn(e,t,r,n){void 0===r&&(r={}),e.setSheetPropertyOnMute(r,"selectedRange",n?r.selectedRange+" "+t:t)}function Sn(e){return e&&e.selectedRange||"A1"}function wn(e){return e.selectedRange.split(" ")[0]}function In(e,t){return e.sheets[t]}function En(e){var t=[];e.sheets.forEach((function(e){t.push(e.name.toLowerCase())}));for(var r=0;r<t.length;r++){if(!(t.indexOf("sheet"+e.sheetNameCount)>-1))return e.sheetNameCount++;e.sheetNameCount++}return e.sheetNameCount++}function Nn(e){var t=0;return e.forEach((function(e){t=Math.max(e.id,t)})),t+1}function Rn(t,n,a){var s=n||t.sheets;s.forEach((function(n){if(n.id=n.id||0,n.name=n.name||"",t.setSheetPropertyOnMute(n,"rowCount",n.rowCount||100),t.setSheetPropertyOnMute(n,"colCount",n.colCount||100),t.setSheetPropertyOnMute(n,"topLeftCell",n.topLeftCell||"A1"),t.setSheetPropertyOnMute(n,"activeCell",n.activeCell||"A1"),t.setSheetPropertyOnMute(n,"selectedRange",n.selectedRange||n.activeCell+":"+n.activeCell),t.setSheetPropertyOnMute(n,"usedRange",n.usedRange||{rowIndex:0,colIndex:0}),t.setSheetPropertyOnMute(n,"ranges",n.ranges?n.ranges:[]),t.setSheetPropertyOnMute(n,"rows",n.rows&&(0,e.extend)([],n.rows,null,!0)||[]),t.setSheetPropertyOnMute(n,"columns",n.columns||[]),t.setSheetPropertyOnMute(n,"showHeaders",!!(0,e.isUndefined)(n.showHeaders)||n.showHeaders),t.setSheetPropertyOnMute(n,"showGridLines",!!(0,e.isUndefined)(n.showGridLines)||n.showGridLines),t.setSheetPropertyOnMute(n,"state",n.state||"Visible"),n.maxHgts=n.maxHgts||[],n.isImportProtected=n.isProtected&&a,n.protectSettings=n.protectSettings||{selectCells:!1,formatCells:!1,formatRows:!1,formatColumns:!1,insertLink:!1},n.isProtected=n.isProtected||!1,!n.paneTopLeftCell||"A1"===n.paneTopLeftCell){n.frozenRows=n.frozenRows?n.frozenRows:0,n.frozenColumns=n.frozenColumns?n.frozenColumns:0;var s=r(n.topLeftCell);t.setSheetPropertyOnMute(n,"paneTopLeftCell",i(n.frozenRows?s[0]+n.frozenRows:s[0],n.frozenColumns?s[1]+n.frozenColumns:s[1]))}pn(n.columns),function(e,t){e.forEach((function(e){e&&e.cells&&pn(e.cells,null,void 0,t)})),pn(e,null,void 0,t)}(n.rows,a)})),pn(s,!0,t)}function On(e,t){return void 0===t&&(t=e.activeSheetIndex),In(e,t).name}function kn(e,t,r,n,i){var a=!!r;r=r||[e.activeSheetIndex];var s=On(e),o={action:"moveSheet",eventArgs:{position:t=function(e,t,r){for(var n=t;r?n>=0:n<e.length;r?n--:n++)if("Hidden"!==e[n].state&&"VeryHidden"!==e[n].state){t=n;break}return t}(e.sheets,t,e.activeSheetIndex>t),sheetIndexes:r,cancel:!1}};n&&e.trigger("actionBegin",o),o.eventArgs.cancel||(e.notify(mr,{prevIndex:e.activeSheetIndex,currentIndex:t}),r.forEach((function(r,n){e.sheets.splice(t+n,0,e.sheets.splice(r+(t>r?-1*n:0),1)[0])})),e.setProperties({activeSheetIndex:i?vn(e,s):t>r[0]?t-(r.length-1):t},!0),e.notify(Yt,{refresh:a}),n&&(delete o.eventArgs.cancel,e.trigger("actionComplete",o)))}function An(t,r,n,i){var a={action:"duplicateSheet",eventArgs:{sheetIndex:r=(0,e.isUndefined)(r)?t.activeSheetIndex:r,cancel:!1}};if(n&&t.trigger("actionBegin",a),!a.eventArgs.cancel){var s=In(t,r),o=(0,e.extend)({},s.properties?s.properties:s,{},!0);o.id=Nn(t.sheets);var l=o.name;/^\(\d+\)$/.test("("+l.split(" (")[1])&&(l=l.split(" (")[0]);var d=[];t.sheets.forEach((function(e){d.push(e.name)}));for(var h=2;;h++)if(-1===d.indexOf(l+" ("+h+")")){o.name=l+" ("+h+")";break}t.notify(sr,{sheetIndex:r,newSheetIndex:r+1}),t.createSheet(r+1,[o]),t.notify(pe,{action:"addSheet",sheetName:"Sheet"+o.id,visibleName:o.name,sheetId:o.id}),i||t.setProperties({activeSheetIndex:r+1},!0),t.notify(Yt,{refresh:!0,isDuplicate:!0}),n&&(delete a.eventArgs.cancel,t.trigger("actionComplete",a))}}var Fn=function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},e(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Tn=function(e,t,r,n){var i,a=arguments.length,s=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,n);else for(var o=e.length-1;o>=0;o--)(i=e[o])&&(s=(a<3?i(s):a>3?i(t,r,s):i(t,r))||s);return a>3&&s&&Object.defineProperty(t,r,s),s},Dn=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return Fn(r,t),Tn([(0,e.Property)("")],r.prototype,"notes",void 0),Tn([(0,e.Collection)([],V)],r.prototype,"image",void 0),Tn([(0,e.Collection)([],U)],r.prototype,"chart",void 0),Tn([(0,e.Property)("")],r.prototype,"value",void 0),Tn([(0,e.Property)("")],r.prototype,"formula",void 0),Tn([(0,e.Property)(0)],r.prototype,"index",void 0),Tn([(0,e.Property)("General")],r.prototype,"format",void 0),Tn([(0,e.Complex)({},w)],r.prototype,"style",void 0),Tn([(0,e.Property)("")],r.prototype,"hyperlink",void 0),Tn([(0,e.Property)(!1)],r.prototype,"wrap",void 0),Tn([(0,e.Property)(!0)],r.prototype,"isLocked",void 0),Tn([(0,e.Property)("")],r.prototype,"validation",void 0),Tn([(0,e.Property)(1)],r.prototype,"colSpan",void 0),Tn([(0,e.Property)(1)],r.prototype,"rowSpan",void 0),Tn([(0,e.Property)(!1)],r.prototype,"isReadOnly",void 0),r}(e.ChildProperty);function Ln(e,t,r,n,i){var a=hl(r,e);if(!a||!a.cells){if(!n)return i?{}:null;a?r.rows[e].cells=[]:r.rows[e]={cells:[]}}return r.rows[e].cells[t]||(i?{}:null)}function Pn(t,r,n,i,a){n.rows[t]?n.rows[t].cells||(n.rows[t].cells=[]):n.rows[t]={cells:[]},a&&n.rows[t].cells[r]?(0,e.extend)(n.rows[t].cells[r],i,null,!0):n.rows[t].cells[r]=i}function Mn(e,t){var r,n={fontFamily:"Calibri",verticalAlign:"bottom",textIndent:"0pt",backgroundColor:"#ffffff",color:"#000000",textAlign:"left",fontSize:"11pt",fontWeight:"normal",fontStyle:"normal",textDecoration:"none",border:"",borderLeft:"",borderTop:"",borderRight:"",borderBottom:""},i={};return Object.keys(t?n:e).forEach((function(t){(r=e[""+t])!==n[""+t]&&(i[""+t]=r)})),i}function Bn(e,t,r,n,i){void 0===t&&(t=!0);for(var a=r.getAddressInfo(e),s=a.indices,o=In(r,a.sheetIndex),l=a.sheetIndex===r.activeSheetIndex,d=s[0];d<=s[2];d++)for(var h=s[1];h<=s[3];h++)!Hr(r,o,{cell:{wrap:t},rowIdx:d,colIdx:h,preventEvt:n})&&l&&r.notify(Ge,{range:[d,h,d,h],wrap:t,sheet:o,initial:!0,isPublic:i});r.setProperties({sheets:r.sheets},!0)}function Hn(e){var t;if(e.indexOf("[")>-1){var r=e.split("[")[1].split("]")[0];["Black","Blue","Cyan","Green","Magenta","Red","White","Yellow"].indexOf(r)>-1&&(t=r)}return t}function Un(){return["Black","Blue","Cyan","Green","Magenta","Red","White","Yellow"]}function Vn(e,t,r,n){var i;if(e.includes('"')){var a,s,o=e.split(";");o.forEach((function(e,t){for(var r=0;r<e.length;r++)if('"'===e[r]&&"\\"!==e[r-1]){a=r;do{a=e.indexOf('"',a+1),s=e[a-1]}while("\\"===s||"_"===s||"*"===s);if(-1===a)break;e=e.substring(0,r)+e.substring(a+1),r--}o[t]=e})),e=o.join(";")}return!e.includes("d")&&!e.includes("y")||e.includes("#")||Hn(e)||(r&&(r.type="date"),n&&e.includes(" ")&&2===e.split(" ").length?e=e.split(" ")[1]:t=!1,i=!0),t&&(e.includes("h")||e.includes("m")||e.includes("s"))&&!e.includes("#")&&!Hn(e)&&(r&&(r.type=r.type||"",r.type+="time"),i=!0),i}var zn,_n,jn,qn=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return Fn(r,t),Tn([(0,e.Property)(0)],r.prototype,"chunkSize",void 0),Tn([(0,e.Property)(3)],r.prototype,"retryCount",void 0),Tn([(0,e.Property)(500)],r.prototype,"retryAfterDelay",void 0),r}(e.ChildProperty),Wn=function(){function n(e){this.parent=e,this.requestedInfo=[],this.addEventListener()}return n.prototype.addEventListener=function(){this.parent.on(j,this.updateSheetFromDataSourceHandler,this),this.parent.on(q,this.dataSourceChangedHandler,this),this.parent.on(W,this.dataChangedHandler,this),this.parent.on(G,this.triggerDataChangeHandler,this)},n.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(j,this.updateSheetFromDataSourceHandler),this.parent.off(q,this.dataSourceChangedHandler),this.parent.off(W,this.dataChangedHandler),this.parent.off(G,this.triggerDataChangeHandler))},n.prototype.updateSheetFromDataSourceHandler=function(e){var r,n,i,a,s,o,l,d,h,p,c,u,f=this,g=[],m=[],v=new br.Deferred;e.promise=v.promise;var y=e.autoDetectFormat,C=y&&Xr(this.parent);if(e.sheet&&e.sheet.ranges.length)for(var b,x=function(x){var w=e.sheet.ranges[x];u=t(w.startCell),e.loadFromStartCell&&(e.indexes=u);var I=e.indexes[0],E=e.indexes[2];h=u[0],o=w.dataSource instanceof br.DataManager?w.dataSource:w.dataSource?new br.DataManager(w.dataSource):new br.DataManager,s=s||o.dataSource.url,e.sheet.isLocalData=!o.dataSource.url,h<=I?I-=h:h<=E?(E-=h,I=0):I=-1,w.showFieldAsHeader&&0!==I&&(I-=1);var N=!1,R=0;S.initRangeInfo(w);var O=S.getMaxCount(w);if(c=S.getLoadedInfo(I,E,w),I=c.unloadedRange[0],E=c.unloadedRange[1],w.info.insertRowRange&&(w.info.insertRowRange.forEach((function(e){R+=e[1]-e[0]+1})),I-=R,E-=R),I>=O?N=!0:E>O&&(E=O),e.loadComplete||S.requestedInfo.push({deferred:v,indexes:e.indexes,isNotLoaded:c.isNotLoaded}),I>=0&&c.isNotLoaded&&!N){var k;m[x]=I,g[x]=!1,w.fieldsOrder&&(k=[].slice.call(w.fieldsOrder));var A=(w.query?w.query:new br.Query).clone();e.loadFullData||(A=A.range(I,E>=O?E:E+1)),o.executeQuery(A.requiresCount()).then((function(s){if(f.parent&&!f.parent.isDestroyed){if(a=s.result&&s.result.result?s.result.result:s.result,i=t(w.startCell),h=i[0],p=i[1],a&&a.length){if(w.info.count||(O=s.count,w.info.count=s.count),n=w.info.flds||k||Object.keys(a[0]),w.info.fldLen||(w.info.fldLen=n.length,w.info.flds=n),w.info.insertColumnRange){var o=0;w.info.insertColumnRange.forEach((function(e){for(var t=e[0];t<=e[1];t++)t<=p?n.splice(0,0,"emptyCell"+o):n.splice(t-p,0,"emptyCell"+o),o++}))}0===m[x]&&w.showFieldAsHeader&&(l=h+m[x]+R,n.forEach((function(t,n){(r=Ln(l,p+n,e.sheet,!0))?t.includes("emptyCell")||(r.value=t):e.sheet.rows[h+m[x]].cells[p+n]=t.includes("emptyCell")?{}:{value:t}}))),a.forEach((function(t,i){l=h+m[x]+i+(w.showFieldAsHeader?1:0)+R,n.forEach((function(n,i){(r=Ln(l,d=p+i,e.sheet,!0))?(b=r.value,n.includes("emptyCell")||Pn(l,d,e.sheet,f.getCellDataFromProp(t[n]),!0)):(b=void 0,r=e.sheet.rows[l].cells[d]=n.includes("emptyCell")?{}:f.getCellDataFromProp(t[n])),y&&C(r),e.updateDependentCellsCallback&&b!==r.value&&e.updateDependentCellsCallback(l,d)}))}))}else n=[];var u;u=h+(O||s.count)>0?h+(O||s.count)+(w.showFieldAsHeader?1:0)+R-1:e.sheet.usedRange.rowIndex;var v=p+n.length-1<0?e.sheet.usedRange.colIndex:p+n.length-1;e.loadFullData&&(E=u);var S={rowIndex:u,colIndex:v};if(f.parent.scrollSettings&&f.parent.scrollSettings.isFinite&&(S.rowIndex=u<e.sheet.rowCount?u:e.sheet.rowCount-1,S.colIndex=v<e.sheet.colCount?v:e.sheet.colCount-1),e.sheet.usedRange.rowIndex<S.rowIndex&&f.parent.setSheetPropertyOnMute(e.sheet,"usedRange",{rowIndex:S.rowIndex,colIndex:e.sheet.usedRange.colIndex}),e.sheet.usedRange.colIndex<S.colIndex&&f.parent.setSheetPropertyOnMute(e.sheet,"usedRange",{rowIndex:e.sheet.usedRange.rowIndex,colIndex:S.colIndex}),R?(c=f.getLoadedInfo(I,E,w),I=c.unloadedRange[0],E=c.unloadedRange[1],I>O&&(c.isNotLoaded=!1),c.isNotLoaded&&(E>O&&(E=O),w.info.loadedRange.push([I,E]))):w.info.loadedRange.push([I,E]),g[x]=!0,-1===g.indexOf(!1)){var N=void 0;if(E+h<h+w.info.count){e.rangeSettingCount||(e.rangeSettingCount=[]),e.rangeSettingCount.push(x),N=!0;var A={sheet:e.sheet,indexes:[0,0,u,v],promise:new Promise((function(e){e(void 0)})),rangeSettingCount:e.rangeSettingCount,loadComplete:e.loadComplete,autoDetectFormat:e.autoDetectFormat,resolveAfterFullDataLoaded:e.resolveAfterFullDataLoaded};f.updateSheetFromDataSourceHandler(A),A.promise.then((function(){"workbook"!==f.parent.getModuleName()&&(e.rangeSettingCount.pop(),e.rangeSettingCount.length||f.parent.notify("created",null),e.formulaCellRef?f.notfyFormulaCellRefresh(e.formulaCellRef,e.sheetIndex):e.loadComplete&&e.loadComplete())}))}else e.formulaCellRef?f.notfyFormulaCellRefresh(e.formulaCellRef,e.sheetIndex):e.loadComplete&&e.loadComplete();N&&e.resolveAfterFullDataLoaded||(f.checkResolve(e.indexes),e.resolveAfterFullDataLoaded&&f.checkResolve([0,0,0,0]))}}}))}else 0===x&&-1===g.indexOf(!1)&&(e.loadComplete&&e.loadComplete(),S.checkResolve(e.indexes))},S=this,w=e.sheet.ranges.length-1;w>=0;w--)x(w);else v.resolve()},n.prototype.notfyFormulaCellRefresh=function(e,r){this.parent.formulaRefCell=null,this.parent.notify(tr,{indexes:t(e),sheetIndex:r,refreshing:!0})},n.prototype.checkResolve=function(e){var t,r,n=0;this.requestedInfo.forEach((function(i,a){((r=JSON.stringify(i.indexes)===JSON.stringify(e))||t)&&(0===a?(i.deferred.resolve(),n++,t=!0):!t||!i.isLoaded&&i.isNotLoaded?r&&t?(i.deferred.resolve(),n++):r?i.isLoaded=!0:t=!1:(i.deferred.resolve(),n++))})),this.requestedInfo.splice(0,n)},n.prototype.getCellDataFromProp=function(t){var r={};return"[object Object]"===Object.prototype.toString.call(t)?t.formula?r.formula=t.formula:(0,e.isNullOrUndefined)(t.value)||("string"==typeof t.value&&(0===t.value.indexOf("http://")||0===t.value.indexOf("https://")||0===t.value.indexOf("ftp://")||0===t.value.indexOf("www."))?(r.hyperlink=t.value,r.style={textDecoration:"underline",color:"#00e"}):r.value=t.value):xr(t)?r.formula=t:"string"==typeof t&&(0===t.indexOf("http://")||0===t.indexOf("https://")||0===t.indexOf("ftp://")||0===t.indexOf("www."))?(r.hyperlink=t,r.style={textDecoration:"underline",color:"#00e"}):r.value=t,r},n.prototype.getLoadedInfo=function(e,t,r){var n=!0;return r.info.loadedRange.forEach((function(r){r[0]<=e&&e<=r[1]?r[0]<=t&&t<=r[1]?n=!1:e=r[1]+1:r[0]<=t&&t<=r[1]&&(t=r[0]-1)})),{isNotLoaded:n,unloadedRange:[e,t]}},n.prototype.getMaxCount=function(e){if(e.query)for(var t=e.query.queries,r=0;r<t.length;r++)if("onTake"===t[r].fn)return Math.min(t[r].e.nos,e.info.count||t[r].e.nos);return e.info.count},n.prototype.initRangeInfo=function(e){e.info||(e.info={loadedRange:[]})},n.prototype.dataSourceChangedHandler=function(e){var t,n=this,i=this.parent.sheets[e.sheetIdx],a=i.ranges[e.rangeIdx];if(a&&(this.checkRangeHasChanges(i,e.rangeIdx)||!a.info)){var s=a.showFieldAsHeader,o=r(a.startCell);a.info&&(a.info.loadedRange.forEach((function(e){for(var r=e[0];r<=e[1]&&r<a.info.count+(s?1:0);r++)if(t=i.rows[r+o[0]])for(var n=o[1];n<o[1]+a.info.fldLen;n++)t.cells&&t.cells[n]&&delete t.cells[n]})),a.info=null);var l={sheet:i,indexes:[0,0,i.rowCount-1,i.colCount-1],loadFullData:!0,promise:new Promise((function(e){e(void 0)}))};this.updateSheetFromDataSourceHandler(l),l.promise.then((function(){n.parent.trigger("dataSourceChanged",{data:e.changedData,action:"dataSourceChanged",rangeIndex:e.rangeIdx,sheetIndex:e.sheetIdx}),n.parent.notify(tr,{sheetIndex:e.sheetIdx,checkWrap:!0,checkCF:!0})}))}},n.prototype.checkRangeHasChanges=function(e,t){return!this.parent.isAngular||e.changedRangeIdx===t&&(delete e.changedRangeIdx,!0)},n.prototype.dataChangedHandler=function(e){var n,a,s,o,l,d,h,p,c,u=this,f=[{}],g=void 0===e.sheetIdx?this.parent.activeSheetIndex:e.sheetIdx,m=this.parent.sheets[g];m.ranges.forEach((function(v,y){if(v.dataSource){var C=void 0;if(o=r(v.startCell),s=o.concat([o[0]+v.info.count+(v.showFieldAsHeader?0:-1),o[1]+v.info.fldLen-1]),"Row"===e.modelType||"Column"===e.modelType){if("Column"===e.modelType){if(e.insertType)l=s[1]<e.index&&s[3]>=e.index,p=[e.index],l||s[3]+1===e.index&&"after"===e.insertType?(e.model.forEach((function(){v.info.flds.splice(e.index-o[1],0,"")})),v.info.fldLen+=e.model.length):s[1]>=e.index&&(v.startCell=i(o[0],o[1]+e.model.length));else if(l=s[1]<=e.startIndex&&s[3]>=e.startIndex)for(var b=e.startIndex;b<=e.endIndex;b++)b<=s[3]&&(v.info.flds.splice(e.startIndex,1),v.info.fldLen-=1);return}if(e.insertType){if(l=(v.showFieldAsHeader||"above"!==e.insertType&&!e.isMethod?s[0]<e.index:s[0]<=e.index)&&s[2]>=e.index,p=[e.index],l||s[2]+1===e.index&&"below"===e.insertType?(C=!0,v.info.count+=e.model.length):s[0]>=e.index&&(v.startCell=i(o[0]+e.model.length,o[1])),e.isMethod)return}else l=s[0]<=e.startIndex&&s[2]>=e.startIndex,e.isDataRequest?p=[e.startIndex,s[1],e.startIndex,s[1]]:n="delete"}else{var x=e.address||e.range||e.fillRange;p=t(e.requestType&&e.requestType.toLowerCase().includes("paste")?e.pastedRange.substring(e.pastedRange.lastIndexOf("!")+1):e.sheetIdx>-1?e.address:x.substring(x.lastIndexOf("!")+1));var S=[v.showFieldAsHeader?s[0]+1:s[0]].concat(s.slice(1,4));if(v.showFieldAsHeader&&p[0]===o[0])for(b=p[1];b<=p[3];b++)b>=S[1]&&b<=S[3]&&(v.info.flds[b-o[1]]=Ln(o[0],b,m,!1,!0).value||"");if(l=Or(S,p,!0),"paste"===e.requestType&&e.copiedInfo.isCut){if(c=[].slice.call(e.copiedInfo.range),v.showFieldAsHeader&&c[0]===o[0]){for(b=c[1];b<=c[3];b++)b>=S[1]&&b<=S[3]&&(v.info.flds[b-o[1]]="");l=!1}d=Or(S,c,!0)}}if(l||C||d){if("Row"!==e.modelType||e.insertType||e.isDataRequest){n=C?"add":"edit";var w=0;if(d){w=c[2]-c[0]+1;var I=function(e){f[e]={},v.info.flds.forEach((function(t,r){t&&(a=Ln(c[0]+e,o[1]+r,m),f[e][""+t]=u.getFormattedValue(a))}))};for(b=0;b<w;b++)I(b)}if(l||C)for(var E,N=!(e.isDataRequest||d||C||e.skipFilterCheck),R=function(e,t){if(N&&ul(m,p[0]+e))return E=t,"continue";f[t+w]={},v.info.flds.forEach((function(r,n){r&&(a=Ln(p[0]+e,o[1]+n,m),f[t+w][""+r]=u.getFormattedValue(a))})),t++,E=t},O=(b=0,0);b<(C?e.model.length:p[2]-p[0]+1||1);b++)R(b,O),O=E}else{if(e.deletedModel.forEach((function(e,t){f[t]={},v.info.flds.forEach((function(r,n){e.cells?(a=e.cells[o[1]+n],f[t][""+r]=u.getFormattedValue(a)):f[t][""+r]=null})),v.info.count-=1})),e.isMethod)return;h={count:e.deletedModel.length,index:e.endIndex}}e.isDataRequest?e.data=f:u.parent.trigger("dataSourceChanged",{data:f,action:n,rangeIndex:y,sheetIndex:g})}else h&&h.count&&s[0]>h.index&&(v.startCell=i(o[0]-h.count,o[1]))}}))},n.prototype.getFormattedValue=function(e){var t=this.parent.getDisplayText(e);return""===t?null:e&&!e.format&&"number"==typeof e.value?e.value:t},n.prototype.triggerDataChangeHandler=function(t){var r=!0;if((("delete"===t.action||"insert"===t.action)&&["Sheet"].indexOf(t.eventArgs.modelType)>-1||"clear"===t.action&&["Clear Formats","Clear Hyperlinks"].indexOf(t.eventArgs.type)>-1||"clipboard"===t.action&&"Formats"===t.eventArgs.requestType)&&(r=!1),r&&["insert","delete","edit","cellDelete","cellSave","autofill","clipboard","clear"].indexOf(t.action)>-1){var n=void 0;!t.isUndo||"delete"!==t.action&&"insert"!==t.action?n=t.eventArgs:(n=(0,e.extend)({},t.eventArgs),"delete"===t.action?(n.index=n.startIndex,n.model=n.deletedModel,n.insertType="below"):(n.startIndex=n.index,n.endIndex=t.eventArgs.index+t.eventArgs.model.length-1,n.deletedModel=n.model,delete n.insertType)),this.parent.notify(W,n)}},n.prototype.getModuleName=function(){return"dataBind"},n.prototype.destroy=function(){this.removeEventListener(),this.parent=null,this.requestedInfo=[]},n}(),Gn="ribbon",Yn="formulaBar",Xn="sheetTabs",Kn="refreshSheetTabs",$n="isFormulaBarEdit",Zn="contentLoaded",Jn="mouseDown",Qn="spreadsheetDestroyed",ei="editOperation",ti="formulaOperation",ri="formulaBarOperation",ni="click",ii="keyUp",ai="keyDown",si="formulaKeyUp",oi="formulaBarUpdate",li="verticalScroll",di="horizontalScroll",hi="focusRenameInput",pi="beforeContentLoaded",ci="beforeVirtualContentLoaded",ui="virtualContentLoaded",fi="contextMenuOpen",gi="cellNavigate",mi="mouseUpAfterSelection",vi="contextmenuBeforeOpen",yi="insertSheetTab",Ci="removeSheetTab",bi="renameSheetTab",xi="ribboClick",Si="ribbonRefresh",wi="enableToolbarItems",Ii="tabSwitch",Ei="selectRange",Ni="rangeSelectionByKeydown",Ri="cut",Oi="copy",ki="paste",Ai="clearCopy",Fi="dataBound",Ti="beforeDataBound",Di="addContextMenuItems",Li="removeContextMenuItems",Pi="enableContextMenuItems",Mi="enableFileMenuItems",Bi="hideFileMenuItems",Hi="addFileMenuItems",Ui="hideRibbonTabs",Vi="enableRibbonTabs",zi="addRibbonTabs",_i="addToolbarItems",ji="hideToolbarItems",qi="beforeRibbonCreate",Wi="rowHeightChanged",Gi="colWidthChanged",Yi="onContentScroll",Xi="deInitProperties",Ki="activeSheetChanged",$i="initiateCustomSort",Zi="applySort",Ji="collaborativeUpdate",Qi="autoFitRowsColumns",ea="refreshFilterCellsOnResize",ta="updateToggleItem",ra="initiateHyperlink",na="editHyperlink",ia="openHyperlink",aa="addNote",sa="editNote",oa="deleteNote",la="showNote",da="createNoteIndicator",ha="updateNoteContainer",pa="removeNoteContainer",ca="removeHyperlink",ua="createHyperlinkElement",fa="sheetNameUpdate",ga="hideSheet",ma="performUndoRedo",va="updateUndoRedoCollection",ya="setActionData",Ca="getBeforeActionData",ba="clearUndoRedoCollection",xa="initiateFilterUI",Sa="renderFilterCell",wa="refreshFilterRange",Ia="updateSortCollection",Ea="reapplyFilter",Na="filterByCellValue",Ra="clearFilter",Oa="getFilteredColumn",ka="actionComplete",Aa="filterCellKeyDown",Fa="getFilterRange",Ta="setAutoFit",Da="refreshFormulaDatasource",La="initiatedatavalidation",Pa="validationError",Ma="startEdit",Ba="invalidData",Ha="clearInvalid",Ua="protectSheet",Va="applyProtect",za="unprotectSheet",_a="protectCellFormat",ja="renderGotoDlgt",qa="renderFindDlg",Wa="findHandler",Ga="created",Ya="spreadsheetCreated",Xa="editAlert",Ka="readonlyAlert",$a="setUndoRedo",Za="enableFormulaInput",Ja="protectSelection",Qa="hiddenMerge",es="checkPrevMerge",ts="checkMerge",rs="removeDataValidation",ns="showAggregate",is="goToSheet",as="showSheet",ss="renderCFDlg",os="clearViewer",ls="initiateFormulaReference",ds="initiateCur",hs="clearCellRef",ps="editValue",cs="addressHandle",us="initiateEdit",fs="forRefSelRender",gs="insertImage",ms="refreshOverlayElem",vs="refreshImgCellObj",ys="getRowIdxFromClientY",Cs="getColIdxFromClientX",bs="createImageElement",xs="deleteImage",Ss="deleteChart",ws="refreshChartCellObj",Is="refreshChartCellModel",Es="refreshImagePosition",Ns="updateTableWidth",Rs="focusBorder",Os="clearChartBorder",ks="insertChart",As="chartRangeSelection",Fs="insertDesignChart",Ts="removeDesignChart",Ds="chartDesignTab",Ls="addChartEle",Ps="undoRedoForChartDesign",Ms="protectWorkbook",Bs="unProtectWorkbook",Hs="getPassWord",Us="setProtectWorkbook",Vs="removeWorkbookProtection",zs="importProtectWorkbook",_s="selectionStatus",js="freeze",qs="overlayEleSize",Ws="updateScroll",Gs="positionAutoFillElement",Ys="hideAutoFillOptions",Xs="performAutoFill",Ks="selectAutoFillRange",$s="autoFill",Zs="hideAutoFillElement",Js="unProtectSheetPassword",Qs="updateTranslate",eo="getUpdatedScrollPosition",to="updateScrollValue",ro="beforeCheckboxfilterRenderer",no="refreshCheckbox",io="renderInsertDlg",ao="toggleProtect",so="propertyChange",oo="updateWrapCell",lo=function(){function r(e){this.loopIndex=0,this.processedLoopIndex=0,this.retryCount=0,this.currentDocumentId=null,this.parent=e,this.addEventListener()}return r.prototype.open=function(e){this.load(e)},r.prototype.load=function(t,r){var n=this;if(this.parent.allowOpen)if(t.jsonObject)this.fetchSuccess(t.jsonObject,t,null,!0,!0);else{var i=new FormData;if(t.file)i.append("file",t.file);else{if(!(t.sheetIndex>=0))return void(this.parent.isOpen=!1);i.append("sheetPassword",t.sheetPassword),i.append("sheetIndex",t.sheetIndex.toString())}var a={passWord:""};t.password&&t.password.length&&(a.passWord=t.password),a.passWord&&a.passWord.length&&(t.password=a.passWord),t.password&&i.append("password",t.password),i.append("IsManualCalculationEnabled",("Manual"===this.parent.calculationMode).toString());var s={file:t.file||null,cancel:!1,requestData:{method:"POST",body:i},password:a.passWord},o=t.guid;if((0,e.isNullOrUndefined)(t.sheetPassword)&&!o&&(0,e.isNullOrUndefined)(r)?(this.parent.trigger("beforeOpen",s),this.parent.notify(K,{eventArgs:s,action:"beforeOpen"})):o&&i.append("guid",o),s.cancel)this.parent.isOpen=!1;else{var l={chunkSize:null,documentId:null};this.parent.openSettings.chunkSize>0&&(0,e.isNullOrUndefined)(t.sheetPassword)&&(this.setToDefaults(r),(0,e.isNullOrUndefined)(this.parent.openSettings.chunkSize)||0===this.parent.openSettings.chunkSize||(l.chunkSize=this.parent.openSettings.chunkSize.toString()),(0,e.isNullOrUndefined)(this.currentDocumentId)||(l.documentId=this.currentDocumentId),(0,e.isNullOrUndefined)(l)||i.append("chunkPayload",JSON.stringify(l))),fetch(this.parent.openUrl,s.requestData).then((function(e){return e.ok?e.json():Promise.reject({status:e.status,statusText:e.statusText,url:e.url})})).then((function(e){return n.fetchSuccess(e,s,t.orginalFile,void 0,!0)})).catch((function(e){-1===e.toString().indexOf("Unexpected end of JSON input")&&n.parent.openSettings.chunkSize>0&&n.retryCount<n.parent.openSettings.retryCount?setTimeout((function(){n.retryCount++,n.load(t,!0)}),n.parent.openSettings.retryAfterDelay):(n.retryCount>=n.parent.openSettings.retryCount&&(n.retryCount=0),n.fetchFailure(e))}))}}},r.prototype.fetchFailure=function(t){(0,e.isUndefined)(t.status)&&(0,e.isUndefined)(t.statusText)&&(t.statusText="Improper response"),this.parent.notify(Ce,t),this.parent.isOpen=!1},r.prototype.fetchSuccess=function(t,r,n,i,a){var s="string"==typeof t?JSON.parse(t):t,o=s.Workbook;if((0,e.isNullOrUndefined)(o)){var l=s.chunkTotalCount;this.currentDocumentId=s.documentId,this.chunkList=new Array(l);var d=0,h=l>this.parent.openSettings.chunkSize?this.parent.openSettings.chunkSize:l,p=0;this.processedLoopIndex=0;var c=this;if(!(0,e.isNullOrUndefined)(l))for(;d<l;)c.processChunk(d,h,p,"",r,n,i,a),h=(d+=c.parent.openSettings.chunkSize)+c.parent.openSettings.chunkSize<l?c.parent.openSettings.chunkSize:l-d,p++,c.processedLoopIndex++}else{if(["UnsupportedFile","InvalidUrl","NeedPassword","InCorrectPassword","InCorrectSheetPassword","CorrectSheetPassword","DataLimitExceeded","FileSizeLimitExceeded","ExternalWorkbook"].indexOf(o)>-1)return n&&(r.file=n),void this.parent.notify(ye,{context:this,data:o,guid:s.Guid,eventArgs:r,isOpenFromJson:i});this.updateModel(o,i,a),this.parent.notify(ye,{context:this,data:o,isOpenFromJson:i,eventArgs:r}),this.parent.isOpen=!1,r&&r.password&&r.password.length>0&&(this.parent.showSheetTabs&&(this.parent.element.querySelector(".e-add-sheet-tab").removeAttribute("disabled"),this.parent.element.querySelector(".e-add-sheet-tab").classList.remove("e-disabled")),this.parent.password="")}},r.prototype.processChunk=function(t,r,n,i,a,s,o,l){var d=this,h={currentChunk:t.toString(),chunkSize:r.toString(),loopIndex:n.toString(),documentId:this.currentDocumentId},p=new FormData;p.append("chunkPayload",JSON.stringify(h));var c={file:s||null,cancel:!1,requestData:{method:"POST",body:p},password:a.password};fetch(this.parent.openUrl,c.requestData).then((function(e){return e.ok?e.json():Promise.reject({status:e.status,statusText:e.statusText,url:e.url})})).then((function(e){if(""!==e){for(var t=atob(e.chunk),r=new Uint8Array(t.length),n=0;n<t.length;n++)r[n]=t.charCodeAt(n);if(t=new TextDecoder("utf-8").decode(r),d.chunkList[e.loopIndex]=t,d.loopIndex++,d.loopIndex===d.processedLoopIndex){for(var h=d.chunkList.splice(0,d.loopIndex),p=0;p<h.length;p++)i+=h.slice(p,p+1).join("");e=JSON.parse(i),d.setToDefaults(),d.fetchSuccess(e,a,s,o,l)}}})).catch((function(h){if((0,e.isNullOrUndefined)(d.currentFailedChunkIndex)||d.currentFailedChunkIndex===t){if(d.currentFailedChunkIndex=t,!(d.retryCount<d.parent.openSettings.retryCount))return d.retryCount=0,d.fetchFailure(h);setTimeout((function(){d.processedLoopIndex=n,d.processChunk(t,r,n,i,a,s,o,l),d.retryCount++}),d.parent.openSettings.retryAfterDelay)}}))},r.prototype.setToDefaults=function(e){this.currentFailedChunkIndex=null,e||(this.retryCount=0),this.loopIndex=0,this.processedLoopIndex=0,this.chunkList=[]},r.prototype.updateModel=function(t,r,n){this.parent.notify(pe,{action:"unRegisterSheet"}),this.setSelectAllRange(t.sheets,r),this.parent.sheetNameCount=1,this.parent.sheets=[],this.parent.notify(xe,{}),this.parent.notify(ba,null),t.activeSheetIndex=t.activeSheetIndex||t.sheets.findIndex((function(e){return"Hidden"!==e.state})),this.parent.setProperties({isProtected:t.isProtected||!1,password:t.password||"",sheets:t.sheets,activeSheetIndex:t.activeSheetIndex,definedNames:t.definedNames||[],filterCollection:t.filterCollection||[],sortCollection:t.sortCollection||[],listSeparator:t.listSeparator||this.parent.listSeparator},!0),(0,e.isNullOrUndefined)(t.showSheetTabs)||(this.parent.showSheetTabs=t.showSheetTabs),Rn(this.parent,void 0,n),this.parent.notify(be,null),this.parent.notify(pe,{action:"registerSheet",isImport:!0}),this.parent.notify(pe,{action:"initiateDefinedNames"}),this.parent.notify(ut,null)},r.prototype.setSelectAllRange=function(r,n){var i,s,o=this;r.forEach((function(r){if(r.selectedRange){var l=t(r.selectedRange),d=((0,e.isUndefined)(r.rowCount)?100:r.rowCount)-1,h=((0,e.isUndefined)(r.colCount)?100:r.colCount)-1;65535===l[2]&&(l[2]=d),255===l[3]&&(l[3]=h),65535===l[0]&&(l[0]=d),255===l[1]&&(l[1]=h),r.selectedRange=a(l)}if(n&&o.parent.isAngular)for(var p=0;p<o.parent.sheets.length;p++)if(i=In(o.parent,p),r.name===i.name){r.ranges&&r.ranges.forEach((function(e,t){(s=i.ranges[t])&&s.template&&(e.template=s.template)}));break}}))},r.prototype.sheetsDestroyHandler=function(t){(0,e.isNullOrUndefined)(t.sheetIndex)&&(this.preventFormatCheck=null)},r.prototype.addEventListener=function(){this.parent.on(Y,this.open.bind(this)),this.parent.on(xe,this.sheetsDestroyHandler,this)},r.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(Y,this.open.bind(this)),this.parent.off(xe,this.sheetsDestroyHandler))},r.prototype.destroy=function(){this.removeEventListener(),this.parent.refreshing||(this.preventFormatCheck=null),this.parent=null},r.prototype.getModuleName=function(){return"workbookOpen"},r}(),ho=function(){function e(e){this.parent=e}return e.prototype.processSheet=function(e,t){return[t,JSON.parse(e,(function(e,t){if(!Array.isArray(t)&&"string"!=typeof t||t.length)return t}))]},e.prototype.processSave=function(e,t,r,n,i){var a,s=this,o=new FormData,l=Object.keys(t);for(o.append("JSONData",JSON.stringify(e)),a=0;a<l.length;a++)o.append(l[a],t[l[a]]);for(l=Object.keys(r),a=0;a<l.length;a++)o.append(l[a],r[l[a]]);o.append("pdfLayoutSettings",JSON.stringify(n)),fetch(t.url,{method:"POST",body:o}).then((function(e){return e.ok?e.blob():Promise.reject({message:e.statusText})})).then((function(e){new Promise((function(t){var n=new FileReader;n.onload=function(){var a=n.result.toString(),o=r.customParams&&"string"==typeof r.customParams&&"saveashtml"===r.customParams.toLowerCase();if(a.indexOf("data:text/plain;base64,")>-1||!o&&a.indexOf("data:text/html;base64,")>-1||a.indexOf("data:application/json;base64,")>-1){var l=void 0;if((a=(a=a.replace("data:text/plain;base64,","")).replace("data:text/html;base64,","")).indexOf("data:application/json;base64,")>-1?(a=a.replace("data:application/json;base64,",""),l=atob(a).split(".")):l=atob(a).split(/(\r\n|\n|\r)/gm),l.length){var d=l[0].length>1&&'"'===l[0][0]?l[0].split('"')[1]+".":l[0];i?i.apply(s,[{dialog:d}]):postMessage({dialog:d})}}else i?i.apply(s,[e]):postMessage(e);t(n.result)},n.readAsDataURL(e)}))})).catch((function(e){i?i.apply(s,[{error:e.message}]):postMessage({error:e.message})}))},e}(),po=function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},e(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),co=function(){return co=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},co.apply(this,arguments)},uo=function(t){function r(e){var r=t.call(this,e)||this;return r.isProcessCompleted=!1,r.saveJSON={},r.isFullPost=!1,r.needBlobData=!1,r.customParams=null,r.pdfLayoutSettings={fitSheetOnOnePage:!1},r.addEventListener(),r}return po(r,t),r.prototype.getModuleName=function(){return"workbookSave"},r.prototype.destroy=function(){this.removeEventListener(),this.parent=null},r.prototype.addEventListener=function(){this.parent.on(X,this.initiateSave,this),this.parent.on("getStringifyObject",this.performStringifyAction,this)},r.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(X,this.initiateSave),this.parent.off("getStringifyObject",this.performStringifyAction))},r.prototype.initiateSave=function(e){var t=e.saveSettings;this.saveSettings={saveType:t.saveType,url:t.url,fileName:t.fileName||"Sample"},this.isFullPost=e.isFullPost,this.needBlobData=e.needBlobData,this.needBlobData&&(this.isFullPost=!1),this.customParams=e.customParams,this.pdfLayoutSettings=e.pdfLayoutSettings,this.updateBasicSettings(),this.processSheets(t.autoDetectFormat,e.jsonConfig)},r.prototype.updateBasicSettings=function(){var e=this.getStringifyObject(this.parent,["sheets","_isScalar","observers","closed","isStopped","hasError","__isAsync","beforeCellFormat","beforeCellRender","beforeDataBound","beforeOpen","beforeSave","beforeSelect","beforeSort","cellEdit","cellEdited","cellEditing","cellSave","beforeCellSave","contextMenuItemSelect","contextMenuBeforeClose","contextMenuBeforeOpen","created","dataBound","fileMenuItemSelect","fileMenuBeforeClose","fileMenuBeforeOpen","saveComplete","sortComplete","select","actionBegin","actionComplete","afterHyperlinkClick","afterHyperlinkCreate","beforeHyperlinkClick","beforeHyperlinkCreate","openComplete","openFailure","queryCellInfo","dialogBeforeOpen","dataSourceChanged","beforeConditionalFormat","beforeCellUpdate"]),t=JSON.parse(e);this.parent.sheets.length&&(t.sheets=[]),this.saveJSON=t,this.saveJSON.filterCollection=[]},r.prototype.processSheets=function(e,t){var r,n,i,a,s=this,o=["dataSource","startCell","query","showFieldAsHeader","result"];if(this.parent.isAngular&&o.push("template"),t)if(t.onlyValues)o.push.apply(o,["style","formula","format","conditionalFormats","validation","hyperlink","wrap","chart","image","notes"]);else{var l={style:t.ignoreStyle,formula:t.ignoreFormula,format:t.ignoreFormat,conditionalFormats:t.ignoreConditionalFormat,validation:t.ignoreValidation,wrap:t.ignoreWrap,chart:t.ignoreChart,image:t.ignoreImage,notes:t.ignoreNote};for(var d in t.ignoreFreezePane&&o.push.apply(o,["frozenColumns","frozenRows"]),l)l[d]&&o.push(d)}for(var h=0,p=this.parent.sheets.length;h<p;h++){r=!1,n=!1;for(var c=0,u=(i=this.parent.sheets[h]).ranges.length;c<u;c++)if((a=i.ranges[c]).dataSource&&(n=!0,!a.info||!a.info.loadedRange||!a.info.loadedRange.length)){r=!0;break}if(r){this.parent.notify(j,{sheet:i,sheetIndex:h,loadComplete:function(e){v(s,s.processSheet,s.updateSheet,[s.getStringifyObject(s.parent.sheets[e],o,e,!1,!0),e],null,s.parent)}.bind(this,h),loadFromStartCell:!0,autoDetectFormat:e})}else v(this,this.processSheet,this.updateSheet,[this.getStringifyObject(i,o,h,e&&n,!0),h],null,this.parent)}},r.prototype.updateSheet=function(e){this.saveJSON.sheets[e[0]]=e[1],this.isProcessCompleted=this.getSheetLength(this.saveJSON.sheets)===this.parent.sheets.length,this.isProcessCompleted&&this.save(this.saveSettings)},r.prototype.getSheetLength=function(e){var t=0;return e.forEach((function(e){e&&t++})),t},r.prototype.save=function(e){var t={cancel:!1,jsonObject:this.saveJSON};this.parent.notify(Ye,t),t.cancel||(this.isFullPost?(this.initiateFullPostSave(),this.saveJSON={}):v(this,{workerTask:this.processSave},this.updateSaveResult,[this.saveJSON,e,this.customParams,this.pdfLayoutSettings],!0,this.parent))},r.prototype.updateSaveResult=function(e){if(e.isFormDataError)this.processSave(this.saveJSON,this.saveSettings,this.customParams,this.pdfLayoutSettings,this.updateSaveResult);else{this.saveJSON={};var t={status:"Success",message:"",url:this.saveSettings.url,fileName:this.saveSettings.fileName,saveType:this.saveSettings.saveType,blobData:null};"object"==typeof e&&e.error?(t.status="Failure",t.message=e.error.toString()):"object"==typeof e&&e.dialog?this.parent.notify(_t,{content:e.dialog}):this.needBlobData?t.blobData=e:this.ClientFileDownload(e),this.parent.trigger("saveComplete",t),this.parent.notify(ee,t)}},r.prototype.ClientFileDownload=function(e){var t=this.parent.createElement("a",{attrs:{download:this.getFileNameWithExtension()}}),r=URL.createObjectURL(e);t.href=r,document.body.appendChild(t),t.click(),URL.revokeObjectURL(r),document.body.removeChild(t)},r.prototype.initiateFullPostSave=function(){var t,r=Object.keys(this.saveSettings),n=this.parent.createElement("form",{attrs:{method:"POST",action:this.saveSettings.url}}),i=this.parent.createElement("input",{attrs:{type:"hidden",name:"JSONData"}});for(i.value=JSON.stringify(this.saveJSON),n.appendChild(i),t=0;t<r.length;t++)(i=this.parent.createElement("input",{attrs:{type:"hidden",name:r[t]}})).value=this.saveSettings[r[t]],n.appendChild(i);for(r=Object.keys(this.customParams),t=0;t<r.length;t++)(i=this.parent.createElement("input",{attrs:{type:"hidden",name:r[t]}})).value=this.customParams[r[t]],n.appendChild(i);(i=this.parent.createElement("input",{attrs:{type:"hidden",name:"pdfLayoutSettings"}})).value=JSON.stringify(this.pdfLayoutSettings),n.appendChild(i),document.body.appendChild(n),n.submit(),(0,e.detach)(n),this.parent.notify(ee,{})},r.prototype.performStringifyAction=function(e){e.model='{"jsonObject":{"Workbook":{"sheets":[';for(var t=0,r=this.parent.sheets.length-1;t<=r;t++)e.model+=this.getStringifyObject(this.parent.sheets[t],e.skipProps,t)+(t<r?",":"]}}}")},r.prototype.getStringifyObject=function(e,t,r,n,i){var a=this;void 0===t&&(t=[]),0===r&&this.parent.notify(Ie,{clearAll:!0}),i&&this.parent.notify(Q,{sheetIdx:r,isSaveAction:!0,saveJson:this.saveJSON});var s,o=[],l=n&&Xr(this.parent),d=JSON.stringify(e,(function(i,d){if(!(t.indexOf(i)>-1)){if("cellStyle"===i)return a.parent.commonCellStyle;if(d&&d.cells)for(var h=0,p=d.cells.length;h<p;h++){var c=d.cells[h],u=[Number(i),h];if(c&&(c.value?n&&!c.formula&&l(c):c.formula&&c.formula.indexOf("=UNIQUE(")<0&&("Automatic"===a.parent.calculationMode&&a.parent.notify(pe,{action:"refreshCalculate",value:c.formula,rowIndex:u[0],colIndex:h,isFormula:xr(c.formula),sheetIndex:r,isRefreshing:!0}),c.value=Ln(u[0],h,e).value),c.chart)){o.push({index:u,chart:c.chart}),s=[];for(var f=0,g=c.chart.length;f<g;f++){var m=Object.assign({},c.chart[f]);delete m.id,s.push(m)}c.chart=s}}if("validation"===i&&d&&"string"==typeof d.type&&"Time"===d.type&&["value1","value2"].forEach((function(e){var t=d[e]&&d[e].toString();t&&!rn(Number(t))&&(d[e]=a.getDateAsNumber({range:[],cell:{value:t}},t))})),d&&d.properties&&d.maxHgts&&(d.properties=co({},d.properties,{maxHgts:d.maxHgts})),d&&"object"==typeof d&&d.hasOwnProperty("properties")){if(d.propName&&"conditionalFormats"===d.propName.toString()){var v=d.properties;if(v.format&&v.format.style){var y=v.format.style;y&&"#ffffff"===y.backgroundColor&&"#000000"===y.color&&"bold"!==y.fontWeight&&"italic"!==y.fontStyle&&"underline"!==y.textDecoration&&delete v.format}}return d.properties}return null!==d?d:void 0}})),h=In(this.parent,r);return o.forEach((function(e){Pn(e.index[0],e.index[1],h,{chart:e.chart},!0)})),d},r.prototype.getDateAsNumber=function(e,t){var r={value:t,rowIndex:e.range[0],cell:e.cell,colIndex:e.range[1],sheetIndex:e.sheetIdx,updatedVal:""};return this.parent.notify(ue,r),r.updatedVal||t},r.prototype.getFileNameWithExtension=function(e){e||(e=this.saveSettings.fileName);var t=this.getFileExtension(),r=e.lastIndexOf(".");return r>-1&&(e=e.substr(0,r)),e+t},r.prototype.getFileExtension=function(){return"."+this.saveSettings.saveType.toLowerCase()},r}(ho);!function(e){e[e.NA=0]="NA",e[e.Value=1]="Value",e[e.Ref=2]="Ref",e[e.DivZero=3]="DivZero",e[e.Num=4]="Num",e[e.Name=5]="Name",e[e.Null=6]="Null",e[e.Calc=7]="Calc"}(zn||(zn={})),function(e){e[e.OperatorsCannotStartWithExpression=0]="OperatorsCannotStartWithExpression",e[e.ReservedWordAND=1]="ReservedWordAND",e[e.ReservedWordXOR=2]="ReservedWordXOR",e[e.ReservedWordIf=3]="ReservedWordIf",e[e.NumberContains2DecimalPoints=4]="NumberContains2DecimalPoints",e[e.ReservedWordElse=5]="ReservedWordElse",e[e.ReservedWordNOT=6]="ReservedWordNOT",e[e.InvalidCharInNumber=7]="InvalidCharInNumber",e[e.InvalidCharactersFollowingWithOperator=6]="InvalidCharactersFollowingWithOperator",e[e.MismatchedParentheses=8]="MismatchedParentheses",e[e.UnknownFormulaName=9]="UnknownFormulaName",e[e.RequiresASingleArgument=10]="RequiresASingleArgument",e[e.Requires3Args=11]="Requires3Args",e[e.InvalidMathArgument=12]="InvalidMathArgument",e[e.Requires2Args=13]="Requires2Args",e[e.BadIndex=14]="BadIndex",e[e.TooComplex=15]="TooComplex",e[e.CircularReference=16]="CircularReference",e[e.MissingFormula=17]="MissingFormula",e[e.ImproperFormula=18]="ImproperFormula",e[e.InvalidExpression=19]="InvalidExpression",e[e.CellEmpty=20]="CellEmpty",e[e.BadFormula=21]="BadFormula",e[e.EmptyExpression=22]="EmptyExpression",e[e.VirtualModeRequired=23]="VirtualModeRequired",e[e.MismatchedTics=24]="MismatchedTics",e[e.WrongNumberArguments=25]="WrongNumberArguments",e[e.InvalidArguments=26]="InvalidArguments",e[e.IterationsDoNotConverge=27]="IterationsDoNotConverge",e[e.CalculationOverflow=29]="CalculationOverflow",e[e.AlreadyRegistered=28]="AlreadyRegistered",e[e.MissingSheet=30]="MissingSheet",e[e.CannotParse=31]="CannotParse",e[e.ExpressionCannotEndWithAnOperator=32]="ExpressionCannotEndWithAnOperator",e[e.Spill=33]="Spill",e[e.Div=34]="Div"}(_n||(_n={})),function(e){e.xlsx="xlsx",e.xlsm="xlsm",e.xlsb="xlsb",e.xltx="xltx",e.xltm="xltm",e.xls="xls",e.xml="xml",e.xlam="xlam",e.xla="xla",e.xlw="xlw",e.xlr="xlr",e.prn="prn",e.txt="txt",e.csv="csv",e.dif="dif",e.slk="slk"}(jn||(jn={}));var fo=function(){function e(e){this.parent=e}return e.prototype.getModuleName=function(){return"calc-common"},e}();function go(e){return void 0===e}function mo(e){switch(e){case"dd-MMM-yyyy":case"dd MMM yyyy":e="medium";break;case"MMM yyyy":e="yMMM";break;case"MM/dd/yyyy":case"dd/MM/yyyy":case"dd/MM/yy":e="short";break;case"dddd MMMM dd yyyy":case"dd MMMM yyyy":e="long";break;case"d MMMM yyyy":e="yMMMd";break;case"yyyy":e="y";break;case"h:mm":e="Hm";break;case"h:mm tt":e="hm";break;case"h":e="H";break;case"h tt":e="h";break;case"dddd":case"ddd":e="E";break;case"h:mm:ss tt":e="hms";break;case"h:mm:ss":e="Hms";break;case"d":e="d";break;case"d dddd":e="Ed";break;case"M":e="M";break;case"Md":e="Md";break;case"MMM":e="MMM";break;case"ddd MMM d":e="MMMEd";break;case"MMM d":e="MMMd";break;case"M/yyyy":e="yM";break;default:e=""}return e}function vo(e){var t=!1;for(var r in jn)if(e.indexOf("."+r+"]")>-1){t=!0;break}return t}function yo(e){var t=[];return e.includeBasicFormulas&&t.push({member:"basic-formulas",args:[e]}),t}function Co(t,r){for(var n=r,i=t.replace(/\[/g,".").replace(/\]/g,"").split("."),a=0;a<i.length&&!(0,e.isUndefined)(n);a++)n=n[i[a]];return n}function bo(t,r,n){var i,a,s=t.replace(/\[/g,".").replace(/\]/g,"").split("."),o=n||{},l=o,d=s.length;for(i=0;i<d;i++)a=s[i],i+1===d?l[""+a]=void 0===r?{}:r:(0,e.isNullOrUndefined)(l[""+a])&&(l[""+a]={}),l=l[""+a];return o}var xo=function(){function e(e){this.loadedModules=[],this.parent=e}return e.prototype.inject=function(e,t){var r=e.length;if(0!==r){this.loadedModules.length&&this.clearUnusedModule(e);for(var n=0;n<r;n++)for(var i=e[n],a=0,s=t;a<s.length;a++){var o=s[a],l=i.member;if(o.prototype.getModuleName()===i.member&&!this.isModuleLoaded(l)){var d=this.createInstance(o,i.args),h=this.getMemberName(l);i.isProperty?bo(h,o,this.parent):bo(h,d,this.parent);var p=i;p.member=h,this.loadedModules.push(p)}}}else this.clean()},e.prototype.createInstance=function(e,t){var r=t;return r.unshift(void 0),new(Function.prototype.bind.apply(e,r))},e.prototype.clean=function(){for(var e=0,t=this.loadedModules;e<t.length;e++){var r=t[e];r.isProperty||Co(r.member,this.parent).destroy()}this.loadedModules=[]},e.prototype.clearUnusedModule=function(e){for(var t=this,r=e.map((function(e){return t.getMemberName(e.member)})),n=0,i=this.loadedModules.filter((function(e){return-1===r.indexOf(e.member)}));n<i.length;n++){var a=i[n];a.isProperty||Co(a.member,this.parent).destroy(),this.loadedModules.splice(this.loadedModules.indexOf(a),1),this.deleteObject(this.parent,a.member)}},e.prototype.getMemberName=function(e){return e[0].toLowerCase()+e.substring(1)+"Module"},e.prototype.deleteObject=function(e,t){delete e[""+t]},e.prototype.isModuleLoaded=function(e){for(var t=0,r=this.loadedModules;t<r.length;t++){if(r[t].member===this.getMemberName(e))return!0}return!1},e}(),So=function(){function t(e){this.formulas=[{formulaName:"SUM",category:"Math & Trig",description:"Sums individual values, cell references or ranges."},{formulaName:"SUMIFS",category:"Math & Trig",description:"Sums the cells specified by a given set of conditionsor criteria."},{formulaName:"SUMPRODUCT",category:"Math & Trig",description:"Returns sum of the product of given ranges of arrays."},{formulaName:"ABS",category:"Math & Trig",description:"Returns the absolute value of a number."},{formulaName:"RAND",category:"Math & Trig",description:"Return a random number between 0 and 1."},{formulaName:"FLOOR",category:"Math & Trig",description:"Returns the round a number down to the nearest integer."},{formulaName:"CEILING",category:"Math & Trig",description:"Returns a number rounded up to a multiple of another number."},{formulaName:"SUMIF",category:"Math & Trig",description:"It will sum up cells that meet the given criteria."},{formulaName:"PRODUCT",category:"Math & Trig",description:"Multiplies all the numbers given as arguments and returns the product."},{formulaName:"AVERAGE",category:"Statistical",description:"The sum of the numbers divided by how many numbers are being averaged."},{formulaName:"AVERAGEIF",category:"Statistical",description:"Computes the average of the numbers in a range that meet the supplied criteria."},{formulaName:"COUNT",category:"Statistical",description:"Counts the numbers in the list of arguments, exclude text entries."},{formulaName:"COUNTA",category:"Statistical",description:"Counts the non-empty values in the list of arguments."},{formulaName:"COUNTIF",category:"Statistical",description:"Counts the number of cells in a range that meet a specified condition."},{formulaName:"COUNTIFS",category:"Statistical",description:"Counts the number of times each cells in all the ranges that meet the specific conditions."},{formulaName:"AVERAGEA",category:"Statistical",description:"Calculates the average of values in the list of arguments.Arguments can be numbers, names, arrays or references."},{formulaName:"AVERAGEIFS",category:"Statistical",description:"Conditionally returns the average of the contents of cells for the set of ranges."},{formulaName:"MIN",category:"Statistical",description:"Returns the smaller number in set of arguments."},{formulaName:"MAX",category:"Statistical",description:"Returns the largest number in set of arguments."},{formulaName:"DATE",category:"Date",description:"Returns the date, given the year, month and day of the month."},{formulaName:"DAY",category:"Date",description:"Returns the day of a given date."},{formulaName:"TODAY",category:"Date",description:"Returns the current date as date value."},{formulaName:"DAYS",category:"Date",description:"Returns the number of days between two dates."},{formulaName:"WEEKDAY",category:"Date",description:"Returns the day of the week corresponding to a date."},{formulaName:"IF",category:"Logical",description:"Returns one value if a logical expression is TRUE and another if it is FALSE"},{formulaName:"AND",category:"Logical",description:"Returns TRUE if all the arguments are considered TRUE, and FALSE otherwise."},{formulaName:"IFS",category:"Logical",description:"Checks multiple conditions and returns a value corresponding to the first TRUE result."},{formulaName:"IFERROR",category:"Logical",description:"Returns a value you specify if a formula evaluates to an error; otherwise, it returns the result of the formula."},{formulaName:"CHOOSE",category:"Lookup & Reference",description:"Returns a value from a list, given an index number."},{formulaName:"INDEX",category:"Lookup & Reference",description:"Returns a value from a table, given a row and column number."},{formulaName:"FIND",category:"Text",description:"Returns the position of a string of text within another string."},{formulaName:"CONCATENATE",category:"Text",description:" Used to join two or more strings together."},{formulaName:"CONCAT",category:"Text",description:"Concatenates a list or range of text strings."},{formulaName:"SUBTOTAL",category:"Lookup & Reference",description:"Returns a subtotal in a list or database."},{formulaName:"RADIANS",category:"Math & Trig",description:"Converts degrees to radians."},{formulaName:"OR",category:"Logical",description:"Returns TRUE if any arguments considered TRUE, and all the arguments are FALSE it will return FALSE."},{formulaName:"NOT",category:"Logical",description:"Returns the inverse of a given logical expression."},{formulaName:"MATCH",category:"Lookup & Reference",description:"Returns the relative position of an checked item in range that matches a specified value in a specified order"},{formulaName:"RANDBETWEEN",category:"Math & Trig",description:"Returns an integer random number in a specified range."},{formulaName:"SLOPE",category:"Statistical",description:"Returns the slope of the line from linear regression of the data points."},{formulaName:"INTERCEPT",category:"Statistical",description:"Calculates the point of the Y-intercept line via linear regression."},{formulaName:"RSQ",category:"Statistical",description:"Returns the square of the Pearson product moment correlation coefficient based on data points in known_ys and known_xs"},{formulaName:"UNIQUE",category:"Lookup & Reference",description:"Returns a unique values from a range or array."},{formulaName:"ROUNDUP",category:"Math & Trig",description:"Rounds a number away from zero."},{formulaName:"ROUNDDOWN",category:"Math & Trig",description:"Rounds a number down, toward zero."},{formulaName:"INT",category:"Math & Trig",description:"Returns a number to the nearest integer."},{formulaName:"LN",category:"Math & Trig",description:"Returns the natural logarithm of a number."},{formulaName:"ISNUMBER",category:"Information",description:"Returns TRUE, if the argument is number and FALSE otherwise."},{formulaName:"ROUND",category:"Math & Trig",description:"Rounds a number to a specified number of digits."},{formulaName:"LOG",category:"Math & Trig",description:"Returns the logarithm of a number to the base that you specify."},{formulaName:"POWER",category:"Math & Trig",description:"Returns the result of a number raised to power."},{formulaName:"SQRT",category:"Math & Trig",description:"Returns the square root of a positive number."},{formulaName:"TRUNC",category:"Math & Trig",description:"Returns the truncated value of a number to a specified number of decimal places."},{formulaName:"EXP",category:"Math & Trig",description:"Returns e raised to the power of the given number."},{formulaName:"GEOMEAN",category:"Statistical",description:"Returns the geometric mean of an array or range of positive data."},{formulaName:"TEXT",category:"Lookup & Reference",description:"Converts a value to text in specified number format."},{formulaName:"SORT",category:"Lookup & Reference",description:"Sorts a range of an array."},{formulaName:"LOOKUP",category:"Lookup & Reference",description:"Looks for a value in a one-row or one-column range, then returns a value from the same position in a second one-row or one-column range."},{formulaName:"VLOOKUP",category:"Lookup & Reference",description:"Looks for a specific value in the first column of a lookup range and returns a corresponding value from a different column within the same row."},{formulaName:"HLOOKUP",category:"Lookup & Reference",description:"Looks for a value in the top row of the array of values and then returns a value in the same column from a row in the array that you specify."},{formulaName:"T",category:"Text",description:"Checks whether a value is text or not and returns the text."},{formulaName:"EXACT",category:"Text",description:"Checks whether a two text strings are exactly same and returns TRUE or FALSE."},{formulaName:"LEN",category:"Text",description:"Returns a number of characters in a given string."},{formulaName:"MOD",category:"Math & Trig",description:"Returns a remainder after a number is divided by divisor."},{formulaName:"ODD",category:"Math & Trig",description:"Rounds a positive number up and negative number down to the nearest odd integer."},{formulaName:"PI",category:"Math & Trig",description:"Returns the value of pi."},{formulaName:"COUNTBLANK",category:"Statistical",description:"Returns the number of empty cells in a specified range of cells."},{formulaName:"EVEN",category:"Math & Trig",description:"Rounds a positive number up and negative number down to the nearest even integer."},{formulaName:"FACT",category:"Math & Trig",description:"Returns the factorial of a number."},{formulaName:"DECIMAL",category:"Math & Trig",description:"Converts a text representation of a number in a given base into a decimal number."},{formulaName:"DEGREES",category:"Math & Trig",description:"Converts radians to degrees."},{formulaName:"ADDRESS",category:"Lookup & Reference",description:"Returns a cell reference as text, given specified row and column numbers."},{formulaName:"TIME",category:"Date & Time",description:"Converts hours, minutes, seconds to the time formatted text."},{formulaName:"CHAR",category:"Text",description:"Returns the character from the specified number."},{formulaName:"CODE",category:"Text",description:"Returns the numeric code for the first character in a given string."},{formulaName:"DOLLAR",category:"Text",description:"Converts the number to currency formatted text."},{formulaName:"SMALL",category:"Statistical",description:"Returns the k-th smallest value in a given array."},{formulaName:"LARGE",category:"Statistical",description:"Returns the k-th largest value in a given array."},{formulaName:"MEDIAN",category:"Statistical",description:"Returns the median of the given set of numbers."},{formulaName:"EDATE",category:"Date & Time",description:"Returns a date with given number of months before or after the specified date."},{formulaName:"EOMONTH",category:"Date & Time",description:"Returns the last day of the month that is a specified number of months before or after an initially supplied start date."},{formulaName:"DATEVALUE",category:"Date & Time",description:"Converts a date string into date value."},{formulaName:"HOUR",category:"Date & Time",description:"Returns the number of hours in a specified time string."},{formulaName:"MINUTE",category:"Date & Time",description:"Returns the number of minutes in a specified time string."},{formulaName:"SECOND",category:"Date & Time",description:"Returns the number of seconds in a specified time string."},{formulaName:"NOW",category:"Date & Time",description:"Returns the current date and time."},{formulaName:"MONTH",category:"Date & Time",description:"Returns the number of months in a specified date string."},{formulaName:"PROPER",category:"Text",description:"Converts a text to proper case; first letter to uppercase and other letters to lowercase."}],this.isConcat=!1,this.parent=e,this.init()}return t.prototype.init=function(){for(var t,r=0;r<this.formulas.length;r++)t=(0,e.getValue)("Compute"+this.formulas[r].formulaName,this).bind(this),this.addFormulaCollection(this.formulas[r].formulaName.toUpperCase(),t,this.formulas[r].category,this.formulas[r].description)},t.prototype.addFormulaCollection=function(e,t,r,n){this.parent.libraryFormulas={fName:e,handler:t,category:r,description:n}},t.prototype.ComputeSUM=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=!1;if(t.length&&"isSubtotal"===t[t.length-1]&&(n=!0,t.pop()),(0,e.isNullOrUndefined)(t)||1===t.length&&""===t[0])return this.parent.formulaErrorStrings[_n.InvalidArguments];var i,a,s=0,o=0;if(!(0,e.isNullOrUndefined)(t))for(var l=t,d=function(e){e.toString().indexOf(".")>-1&&(o=Math.max(o,e.split(".")[1].length))},h=0;h<l.length;h++){var p=l[h].toString();if(p.indexOf(":")>-1&&this.parent.isCellReference(p)){for(var c=this.parent.getCellCollection(p.split(this.parent.tic).join("")),u=0;u<c.length;u++)if(i=n?this.parent.getValueFromArg(c[u],null,null,!0):this.parent.getValueFromArg(c[u]),!n||!i.includes("SUBTOTAL(")){if(this.parent.getErrorStrings().indexOf(i)>-1)return i;(0,e.isNullOrUndefined)(i[0])||isNaN(this.parent.parseFloat(i))||(d(i),s+=this.parent.parseFloat(i))}}else{if(l[h].indexOf(this.parent.tic)>-1&&(isNaN(this.parent.parseFloat(l[h].split(this.parent.tic).join("")))||""===l[h].split(this.parent.tic).join("").trim()))return this.parent.getErrorStrings()[zn.Value];if(l[h].split(this.parent.tic).join("")===this.parent.trueValue&&(l[h]="1"),l[h].split(this.parent.tic).join("")===this.parent.falseValue&&(l[h]="0"),a=n?this.parent.getValueFromArg(l[h].split(this.parent.tic).join(""),null,null,!0):this.parent.getValueFromArg(l[h].split(this.parent.tic).join("")),n&&a.includes("SUBTOTAL("))continue;if(this.parent.getErrorStrings().indexOf(a)>-1)return a;if((0,e.isNullOrUndefined)(a)||isNaN(this.parent.parseFloat(a)))continue;a.length>0&&(d(a),s+=this.parent.parseFloat(a+""))}}return s.toString().indexOf(".")>-1?s.toFixed(o):s},t.prototype.ComputeINT=function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=this.parent.getErrorStrings();return""===t[0]&&1===t.length?this.parent.formulaErrorStrings[_n.InvalidArguments]:t.length>1?this.parent.formulaErrorStrings[_n.WrongNumberArguments]:(e=this.parent.getValueFromArg(t[0]),n.indexOf(e)>-1?e:(e.toUpperCase()===this.parent.trueValue?e="1":e.toUpperCase()===this.parent.falseValue&&(e="0"),this.parent.isCellReference(t[0])||(-1===t[0].indexOf(this.parent.tic+this.parent.tic)&&(e=e.split(this.parent.tic).join("")),""!==e.trim())?(e.indexOf("%")>-1&&(e=(.01*Number(e.split("%")[0])).toString()),isNaN(this.parent.parseFloat(e))?n[zn.Value]:(e=this.parent.parseFloat(e),e=Math.floor(e))):n[zn.Value]))},t.prototype.ComputeTODAY=function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];if(1!==t.length||""!==t[0])e=this.parent.formulaErrorStrings[_n.InvalidArguments];else{var n=new Date(Date.now());"spreadsheet"===this.parent.parentObject.getModuleName()?(e=this.parent.parentObject.dateToInt(n),0===this.parent.parser.storedStringText.toUpperCase().indexOf("TODAY")&&""!==this.parent.cell&&this.parent.parentObject.setDateFormat(this.parent.getSheetId(this.parent.grid),this.parent.rowIndex(this.parent.cell)-1,this.parent.colIndex(this.parent.cell)-1)):e=n.getFullYear()+"/"+this.parent.calculateDate((n.getMonth()+1).toString())+"/"+this.parent.calculateDate(n.getDate().toString())}return e},t.prototype.ComputeWEEKDAY=function(){for(var t,r,n,i=[],a=0;a<arguments.length;a++)i[a]=arguments[a];if(""===i[0]&&(0,e.isNullOrUndefined)(i[1])||i.length>2)return this.parent.formulaErrorStrings[_n.InvalidArguments];if(""===i[0]&&""===i[1]||""===i[1])return this.parent.getErrorStrings()[zn.Num].toString();if(1===i.length&&i.push("1"),i[0].indexOf(this.parent.tic)>-1&&""===i[0].split(this.parent.tic).join("").trim()||""===i[1].split(this.parent.tic).join("").trim()||i[1].indexOf(this.parent.tic)>-1&&isNaN(this.parent.parseFloat(i[1].split(this.parent.tic).join(""))))return this.parent.getErrorStrings()[zn.Value];if(this.parent.isCellReference(i[0])){if((t=this.parent.getValueFromArg(i[0].split(this.parent.tic).join(""))||"0").indexOf(this.parent.tic)>-1)return this.parent.getErrorStrings()[zn.Value]}else t=i[0].indexOf(this.parent.tic)>-1&&isNaN(this.parent.parseFloat(i[0].split(this.parent.tic).join("")))?this.parent.getValueFromArg(i[0]):this.parent.getValueFromArg(i[0].split(this.parent.tic).join(""))||"0";if(r=this.parent.isCellReference(i[1])?this.parent.getValueFromArg(i[1].split(this.parent.tic).join(""))||"0":this.parent.getValueFromArg(i[1].split(this.parent.tic).join("")),this.parent.getErrorStrings().indexOf(t)>-1)return t;if(this.parent.getErrorStrings().indexOf(r)>-1)return r;if(t=t===this.parent.trueValue?"1":t===this.parent.falseValue?"0":t,r=r===this.parent.trueValue?"1":r===this.parent.falseValue?"0":r,n=this.parent.parseFloat(t),r=this.parent.parseFloat(r),isNaN(r)||isNaN(n))return this.parent.getErrorStrings()[zn.Value];if(n<0||n>2958465)return this.parent.getErrorStrings()[zn.Num].toString();switch(r=parseInt(r.toString(),10),n=n<1?0:Math.floor(n)%7,r){case 1:case 17:n=n<=0?n+7:n;break;case 2:case 11:n=(n-=1)<=0?n+7:n;break;case 3:n=(n-=2)<0?n+7:n;break;case 12:n=(n+=5)>7?n-7:n;break;case 13:n=(n+=4)>7?n-7:n;break;case 14:n=(n+=3)>7?n-7:n;break;case 15:n=(n+=2)>7?n-7:n;break;case 16:n=(n+=1)>7?n-7:n;break;default:n=this.parent.getErrorStrings()[zn.Num].toString()}return n},t.prototype.ComputePROPER=function(){for(var t,r,n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];var a=this.parent.getErrorStrings();return n.length&&"nestedFormulaTrue"===n[n.length-1]&&(r=!0,n.pop()),(0,e.isNullOrUndefined)(n)||""===n[0].trim()&&1===n.length?this.parent.formulaErrorStrings[_n.InvalidArguments]:n.length>1?this.parent.formulaErrorStrings[_n.WrongNumberArguments]:(t=this.parent.getValueFromArg(n[0]).trim(),a.indexOf(t)>-1||(n[0].indexOf(this.parent.tic)>-1?n[0]!==t&&n[0].startsWith("n")?t=this.parent.removeTics(t.trim()):(t=this.parent.removeTics(n[0].trim())).indexOf(this.parent.tic+this.parent.tic)>-1&&(t=t.replace(/""/g,this.parent.tic)):!n[0].startsWith("n")&&2===t.split("%").length&&this.parent.isNumber(t.split("%")[0])&&(t=(Number(t.split("%")[0])/100).toString()),t=t.toLowerCase().replace(/\b\w/g,(function(e){return e.toUpperCase()})).replace(/(\d)([a-z])/g,(function(e,t,r){return t+r.toUpperCase()})),r&&(t=this.parent.tic+t+this.parent.tic)),t)},t.prototype.ComputeSUMPRODUCT=function(){for(var t,r,n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];if((0,e.isNullOrUndefined)(n)||1===n.length&&""===n[0])return this.parent.formulaErrorStrings[_n.InvalidArguments];for(var a,s=0,o=0,l=null,d=n,h=[],p=0;p<d.length;p++)h.push(this.parent.getCellCollection(d[p]).length);for(var c=0;c<h.length;c++)if(h[c]&&h[c+1]&&h[c]!==h[c+1])return this.parent.getErrorStrings()[zn.Value];for(var u=0;u<d.length;++u){var f=d[u];if(f.startsWith(this.parent.tic)||!this.parent.isCellReference(f)){var g=this.parent.getValueFromArg(f);return a=g.indexOf('"'),this.parent.getErrorStrings().indexOf(g)>-1?g:a>-1?0:this.parent.getErrorStrings()[zn.Value]}p=f.indexOf(":");var m=this.parent.rowIndex(f.substr(0,p)),v=this.parent.rowIndex(f.substr(p+1));if(!(-1!==m||-1===v)==(-1===m||-1!==v))return this.parent.getErrorStrings()[zn.Name];m>v&&(m=(t=[v,m])[0],v=t[1]);var y=this.parent.colIndex(f.substr(0,p)),C=this.parent.colIndex(f.substr(p+1));if(y>C&&(y=(r=[C,y])[0],C=r[1]),null===l)for(o=(v-m+1)*(C-y+1),l=[],p=0;p<o;++p)l[p]=1;p=0;for(var b=m;b<=v;++b)for(var x=y;x<=C;++x){var S=this.getSheetReference(f)+this.parent.convertAlpha(x)+b,w=this.parent.getValueFromArg(S);if(this.parent.getErrorStrings().indexOf(w)>-1)return w;if(isNaN(this.parent.parseFloat(w)))l[p]=0;else{if(isNaN(l[p]))return this.parent.getErrorStrings()[zn.Name];l[p]=l[p]*this.parent.parseFloat(w)}p++}}for(p=0;p<o;++p)s+=l[p];return s},t.prototype.ComputeROUNDUP=function(){for(var t,r,n,i,a,s=[],o=0;o<arguments.length;o++)s[o]=arguments[o];var l=s.length;if(!(0,e.isNullOrUndefined)(s)&&l>2&&(t=this.parent.formulaErrorStrings[_n.InvalidArguments]),1===l&&""!==s[0])i=s[0].indexOf('"'),r="TRUE"===(r=(r=s[0].indexOf('"')>-1?s[0].replace('"',""):s[0]).indexOf('"')>-1?r.replace('"',""):r).toUpperCase()?"1":"FALSE"===r?"0":r,r=this.parent.getValueFromArg(r),(a=this.parent.parseFloat(r))>0?a+=.4999999999:a<0&&(a-=.4999999999),t=(a=this.parent.parseFloat(a.toFixed(0))).toString();else if(2===l){if(i=s[0].indexOf('"')>-1?s[0].indexOf('"'):s[1].indexOf('"')>-1?s[1].indexOf('"'):-1,this.parent.isCellReference(s[0]))r=this.parent.getValueFromArg(s[0])||"0";else{if(s[0].indexOf(this.parent.tic)>-1&&(s[0].split(this.parent.tic).join("")===this.parent.trueValue||s[0].split(this.parent.tic).join("")===this.parent.falseValue))return this.parent.getErrorStrings()[zn.Value];r=this.parent.getValueFromArg(s[0]).split(this.parent.tic).join("")}if(this.parent.getErrorStrings().indexOf(r)>-1)return r;if(this.parent.isCellReference(s[1]))n=this.parent.getValueFromArg(s[1])||"0";else{if(s[1].indexOf(this.parent.tic)>-1&&(s[1].split(this.parent.tic).join("")===this.parent.trueValue||s[1].split(this.parent.tic).join("")===this.parent.falseValue))return this.parent.getErrorStrings()[zn.Value];n=this.parent.getValueFromArg(s[1]).split(this.parent.tic).join("")}if(this.parent.getErrorStrings().indexOf(n)>-1)return n;r="TRUE"===r.toUpperCase()?"1":"FALSE"===r?"0":r,n="TRUE"===n.toUpperCase()?"1":"FALSE"===n?"0":n;var d=isNaN(Number(r))||""===r.trim(),h=isNaN(Number(n))||""===n.trim();if((s[0].indexOf('"')>-1||this.parent.isCellReference(s[0]))&&d||(s[1].indexOf('"')>-1||this.parent.isCellReference(s[1]))&&h)return this.parent.getErrorStrings()[zn.Value];var p=Math.ceil(this.parent.parseFloat(n));if(a=this.parent.parseFloat(r),p>0){var c=r.split("."),u=2===c.length?c[1].length>=p?p:c[1].length:0;t=(a=this.parent.parseFloat(this.preciseRound(a,u,"ROUNDUP"))).toString(),isNaN(a)&&(t=p.toString().indexOf('"')>-1?this.parent.getErrorStrings()[zn.Value]:this.parent.getErrorStrings()[zn.Name])}else a>0?a=a/Math.pow(10,-p)+.49999:a<0&&(a=a/Math.pow(10,-p)-.49999),t=(a=a>0&&p<-9?1*Math.pow(10,-p):this.parent.parseFloat(a.toFixed(0))*Math.pow(10,-p)).toString(),isNaN(a)&&(t=p.toString().indexOf('"')>-1?this.parent.getErrorStrings()[zn.Value]:t=this.parent.getErrorStrings()[zn.Name])}else t=i>-1?this.parent.getErrorStrings()[zn.Value]:this.parent.formulaErrorStrings[_n.InvalidArguments];return t},t.prototype.ComputeROUNDDOWN=function(){for(var t,r,n,i,a,s=[],o=0;o<arguments.length;o++)s[o]=arguments[o];var l=s.length;if(!(0,e.isNullOrUndefined)(s)&&l>2&&(t=this.parent.formulaErrorStrings[_n.InvalidArguments]),1===l&&""!==s[0])i=s[0].indexOf('"'),r="TRUE"===(r=(r=s[0].indexOf('"')>-1?s[0].replace('"',""):s[0]).indexOf('"')>-1?r.replace('"',""):r).toUpperCase()?"1":"FALSE"===r?"0":r,r=this.parent.getValueFromArg(r),(a=this.parent.parseFloat(r))>0?a-=.4999999999:a<0&&(a+=.4999999999),t=(a=this.parent.parseFloat(a.toFixed(0))).toString();else if(2===l){if(i=s[0].indexOf('"')>-1?s[0].indexOf('"'):s[1].indexOf('"')>-1?s[1].indexOf('"'):-1,this.parent.isCellReference(s[0]))r=this.parent.getValueFromArg(s[0])||"0";else{if(s[0].indexOf(this.parent.tic)>-1&&(s[0].split(this.parent.tic).join("")===this.parent.trueValue||s[0].split(this.parent.tic).join("")===this.parent.falseValue))return this.parent.getErrorStrings()[zn.Value];r=this.parent.getValueFromArg(s[0]).split(this.parent.tic).join("")}if(this.parent.getErrorStrings().indexOf(r)>-1)return r;if(this.parent.isCellReference(s[1]))n=this.parent.getValueFromArg(s[1])||"0";else{if(s[1].indexOf(this.parent.tic)>-1&&(s[1].split(this.parent.tic).join("")===this.parent.trueValue||s[1].split(this.parent.tic).join("")===this.parent.falseValue))return this.parent.getErrorStrings()[zn.Value];n=this.parent.getValueFromArg(s[1]).split(this.parent.tic).join("")}if(this.parent.getErrorStrings().indexOf(n)>-1)return n;r="TRUE"===r.toUpperCase()?"1":"FALSE"===r?"0":r,n="TRUE"===n.toUpperCase()?"1":"FALSE"===n?"0":n;var d=isNaN(Number(r))||""===r.trim(),h=isNaN(Number(n))||""===n.trim();if((s[0].indexOf('"')>-1||this.parent.isCellReference(s[0]))&&d||(s[1].indexOf('"')>-1||this.parent.isCellReference(s[1]))&&h)return this.parent.getErrorStrings()[zn.Value];var p=Math.ceil(this.parent.parseFloat(n));if(a=this.parent.parseFloat(r),p>0){var c=r.indexOf("."),u=0;-1!==c&&(u=(u=r.length-c-1)>=p?p:u),t=(a=this.parent.parseFloat(this.preciseRound(a,u,"ROUNDDOWN"))).toString(),isNaN(a)&&(t=p.toString().indexOf('"')>-1?this.parent.getErrorStrings()[zn.Value]:this.parent.getErrorStrings()[zn.Name])}else a>0?a=a/Math.pow(10,-p)-.49999:a<0&&(a=a/Math.pow(10,-p)+.49999),t=(a=a>0&&p<-9?1*Math.pow(10,-p):this.parent.parseFloat(a.toFixed(0))*Math.pow(10,-p)).toString(),isNaN(a)&&(t=p.toString().indexOf('"')>-1?this.parent.getErrorStrings()[zn.Value]:t=this.parent.getErrorStrings()[zn.Name])}else t=i>-1?this.parent.getErrorStrings()[zn.Value]:this.parent.formulaErrorStrings[_n.InvalidArguments];return t},t.prototype.ComputeCOUNT=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=!1;if(t.length&&"isSubtotal"===t[t.length-1]&&(n=!0,t.pop()),(0,e.isNullOrUndefined)(t)||1===t.length&&""===t[0])return this.parent.formulaErrorStrings[_n.WrongNumberArguments];for(var i,a,s,o,l=t,d=0,h=0;h<l.length;h++)if(i=l[h],this.parent.isCellReference(i))if(i.indexOf(":")>-1){a=this.parent.getCellCollection(i.split(this.parent.tic).join(""));for(var p=0;p<a.length;p++)s=n?this.parent.getValueFromArg(a[p],null,null,!0):this.parent.getValueFromArg(a[p]),n&&s.includes("SUBTOTAL(")||isNaN(this.parent.parseFloat(s))||i.length>0&&""!==s.trim()&&d++}else{if(s=n?this.parent.getValueFromArg(i,null,null,!0):this.parent.getValueFromArg(i),n&&s.includes("SUBTOTAL("))continue;isNaN(this.parent.parseFloat(s))||i.length>0&&""!==s.trim()&&d++}else o=this.parent.getValueFromArg(i).split(this.parent.tic).join(""),0===i.length&&""===o.trim()?d++:isNaN(this.parent.parseFloat(o))&&i!==this.parent.trueValue&&i!==this.parent.falseValue||i.length>0&&""!==i.trim()&&""!==o.trim()&&d++;return d},t.prototype.ComputeDATE=function(){for(var t,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];if(r.length&&"nestedFormulaTrue"===r[r.length-1]&&(t=!0,r.pop()),(0,e.isNullOrUndefined)(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[_n.WrongNumberArguments];if(3!==r.length)return this.parent.formulaErrorStrings[_n.WrongNumberArguments];for(var i=[],a=0;a<r.length;++a)i[a]=this.parent.getValueFromArg(r[a]);i[0]=i[0]===this.parent.trueValue?"1":i[0]===this.parent.falseValue?"0":i[0],i[1]=i[1]===this.parent.trueValue?"1":i[1]===this.parent.falseValue?"0":i[1],i[2]=i[2]===this.parent.trueValue?"1":i[2]===this.parent.falseValue?"0":i[2];for(var s=0;s<i.length;s++){var o=i[s];if(this.parent.getErrorStrings().indexOf(o)>-1)return o;if('""'===o||'"0"'===o&&'"0"'!==r[s]||'"TRUE"'===o||'"FALSE"'===o)return this.parent.getErrorStrings()[zn.Value].toString()}var l=Math.floor(this.parent.parseFloat(i[0].split(this.parent.tic).join(""))),d=Math.floor(this.parent.parseFloat(i[1].split(this.parent.tic).join(""))),h=Math.floor(this.parent.parseFloat(i[2].split(this.parent.tic).join(""))),p=0;if(isNaN(l)||isNaN(d)||isNaN(h))return this.parent.getErrorStrings()[zn.Value].toString();if(l<0&&d<=12||l>=1e4&&d>0)return this.parent.getErrorStrings()[zn.Num].toString();for(;d>12;)d-=12,l++;if(0===(p=this.parent.getSerialDateFromDate(l,d,h)))return this.parent.getErrorStrings()[zn.Num].toString();var c=this.parent.fromOADate(p);if("Invalid Date"!==c.toString()){if(c.getFullYear()<1900||1e4<=c.getFullYear())return this.parent.getErrorStrings()[zn.Num].toString();if(!t)return new e.Internationalization(this.parent.parentObject.locale||"en-US").formatDate(c,{type:"date",skeleton:"yMd"})}return p.toString()},t.prototype.ComputeFLOOR=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];if((0,e.isNullOrUndefined)(t)||1===t.length&&""===t[0])return this.parent.formulaErrorStrings[_n.InvalidArguments];var n,i=t;if(2!==i.length)return this.parent.formulaErrorStrings[_n.WrongNumberArguments];if(""===i[0]&&""===i[1]||""===i[0]&&!i[1].includes('"'))return 0;""!==i[1]||i[0].includes('"')||(i[1]="0");for(var a=0;a<i.length;a++){var s=i[a].split(this.parent.tic).join("").trim();if(""===s||i[a].indexOf(this.parent.tic)>-1&&isNaN(this.parent.parseFloat(s)))return this.parent.getErrorStrings()[zn.Value];if(Sr(i[a])){if((n=(n=this.parent.getValueFromArg(i[a])||"0")===this.parent.trueValue?"1":n===this.parent.falseValue?"0":n).toUpperCase().match(/[A-Z]/)||n.includes('"')||!this.parent.isNumber(n))return this.parent.getErrorStrings()[zn.Value]}else if((n=(n=this.parent.getValueFromArg(i[a].split(this.parent.tic).join("")))===this.parent.trueValue?"1":n===this.parent.falseValue?"0":n).toUpperCase().match(/[A-Z]/)||n.includes('"')||!this.parent.isNumber(n))return this.parent.getErrorStrings()[zn.Value];i[a]=n}var o=this.parent.parseFloat(i[0]),l=this.parent.parseFloat(i[1]);return o>0&&l<0?this.parent.getErrorStrings()[zn.Num]:(o>0||o<0)&&0===l?this.parent.getErrorStrings()[zn.DivZero]:isNaN(o)?this.parent.getErrorStrings()[zn.Name]:0===o&&0===l?0:Math.floor(o/l)*l},t.prototype.ComputeCEILING=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];if((0,e.isNullOrUndefined)(t)||1===t.length&&""===t[0])return this.parent.formulaErrorStrings[_n.InvalidArguments];var n,i=t;if(2!==i.length)return this.parent.formulaErrorStrings[_n.WrongNumberArguments];if(""===i[0]&&""===i[1]||""===i[0]&&!i[1].includes('"'))return 0;""!==i[1]||i[0].includes('"')||(i[1]="0");for(var a=0;a<i.length;a++){var s=i[a].split(this.parent.tic).join("").trim();if(""===s||i[a].indexOf(this.parent.tic)>-1&&isNaN(this.parent.parseFloat(s)))return this.parent.getErrorStrings()[zn.Value];if(Sr(i[a])){if((n=(n=this.parent.getValueFromArg(i[a])||"0")===this.parent.trueValue?"1":n===this.parent.falseValue?"0":n).toUpperCase().match(/[A-Z]/)||n.includes('"')||!this.parent.isNumber(n))return this.parent.getErrorStrings()[zn.Value]}else if((n=(n=this.parent.getValueFromArg(i[a].split(this.parent.tic).join("")))===this.parent.trueValue?"1":n===this.parent.falseValue?"0":n).toUpperCase().match(/[A-Z]/)||n.includes('"')||!this.parent.isNumber(n))return this.parent.getErrorStrings()[zn.Value];i[a]=n}var o=this.parent.parseFloat(i[0]),l=this.parent.parseFloat(i[1]);return o>0&&l<0?this.parent.getErrorStrings()[zn.Num]:isNaN(o)?this.parent.getErrorStrings()[zn.Name]:(o>0||0===o)&&0===l?0:Math.ceil(o/l)*l},t.prototype.ComputeDAY=function(){for(var t,r,n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];var a=this.parent.getErrorStrings();if((0,e.isNullOrUndefined)(n)||1===n.length&&""===n[0])return this.parent.formulaErrorStrings[_n.InvalidArguments];if(n.length>1)return this.parent.formulaErrorStrings[_n.WrongNumberArguments];if(n[0].startsWith(this.parent.tic)){if(""===(r=n[0].split(this.parent.tic).join(""))||r===this.parent.trueValue||r===this.parent.falseValue)return a[zn.Value]}else if(r=this.parent.getValueFromArg(n[0].split(this.parent.tic).join("")),this.parent.isCellReference(n[0])&&r.indexOf(this.parent.tic)>-1)return a[zn.Value];return a.indexOf(r)>-1?r:Number(r)<0?a[zn.Num]:0===Math.floor(Number(r))||r===this.parent.falseValue?0:r===this.parent.trueValue?1:(t=this.parent.isNaN(Number(r))?this.parent.parseDate(r):this.parent.intToDate(r),"[object Date]"===Object.prototype.toString.call(t)&&(t=new Date(t).getFullYear()<1900||new Date(t).getFullYear()>9999?this.parent.isNumber(r)?"Num":"NaN":t.getDate()),"NaN"===t.toString()?a[zn.Value]:"Num"===t.toString()?a[zn.Num]:t)},t.prototype.ComputeIF=function(){for(var t,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];if(r.length&&"nestedFormulaTrue"===r[r.length-1]&&(t=!0,r.pop()),(0,e.isNullOrUndefined)(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[_n.InvalidArguments];if(this.parent.getErrorStrings().indexOf(r[0])>0)return r[0];var i,a,s,o=r;if(4===o.length&&"nestedFormulaTrue"===o[3]&&(i=!0,o.pop()),o.length>3||1===o.length)return this.parent.formulaErrorStrings[_n.WrongNumberArguments];if(o.length<=3){var l=void 0,d=void 0,h="";if(a=this.parent.getValueFromArg(o[0]),this.parent.getErrorStrings().indexOf(a)>-1)return a;var p=a.toUpperCase(),c=this.parent.parseFloat(a);if(p===this.parent.trueValue||c<0||c>0){if(t&&o[1].includes(":")){l=this.parent.getCellCollection(o[1]);for(var u=0;u<l.length;u++)d=this.parent.getValueFromArg(l[u]),isNaN(this.parent.parseFloat(d))||(h+=d+",");return h.slice(0,h.length-1)}s=""===o[1]?"0":this.parent.getValueFromArg(o[1])}else{if(p!==this.parent.falseValue&&0!==c)return this.parent.formulaErrorStrings[_n.Requires3Args];if((0,e.isNullOrUndefined)(o[2]))return this.parent.falseValue;if(t&&o[2].includes(":")){l=this.parent.getCellCollection(o[2]);for(u=0;u<l.length;u++)d=this.parent.getValueFromArg(l[u]),isNaN(this.parent.parseFloat(d))||(h+=d+",");return h.slice(0,h.length-1)}s=""===o[2]?"0":this.parent.getValueFromArg(o[2])}}return!i&&s.indexOf(this.parent.tic)>-1?s.split(this.parent.tic).join(""):""===s?"0":s},t.prototype.ComputeIFERROR=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];if((0,e.isNullOrUndefined)(t)||1===t.length&&""===t[0])return this.parent.formulaErrorStrings[_n.InvalidArguments];var n,i=t;if(2!==i.length)return this.parent.formulaErrorStrings[_n.WrongNumberArguments];if(this.parent.isCellReference(i[0])){if(n=this.parent.getValueFromArg(i[0])||"0",-1===this.parent.getErrorStrings().indexOf(n)&&"NaN"!==n)return n}else if(n=this.parent.getValueFromArg(i[0],null,!0)||"0",-1===this.parent.getErrorStrings().indexOf(n)&&"NaN"!==n)return n=n.split(this.parent.tic).join("").trim();return n=this.parent.isCellReference(i[1])?this.parent.getValueFromArg(i[1])||"0":(n=this.parent.getValueFromArg(i[1])||"0").split(this.parent.tic).join("").trim()},t.prototype.ComputePRODUCT=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=!1;if(t.length&&"isSubtotal"===t[t.length-1]&&(n=!0,t.pop()),(0,e.isNullOrUndefined)(t)||1===t.length&&""===t[0])return this.parent.formulaErrorStrings[_n.InvalidArguments];var i,a,s,o=1,l=!0;if(!(0,e.isNullOrUndefined)(t))for(var d=t,h=0;h<d.length;h++){var p=d[h];if(p.indexOf(":")>-1&&this.parent.isCellReference(p)){for(var c=this.parent.getCellCollection(p),u=0;u<c.length;u++)if(i=n?this.parent.getValueFromArg(c[u],null,null,!0):this.parent.getValueFromArg(c[u]),(!n||!i.includes("SUBTOTAL("))&&rn(i)){if(this.parent.getErrorStrings().indexOf(i)>-1)return i;s=this.parent.parseFloat(i),isNaN(s)||i.length>0&&(o*=s,l=!1)}}else if(-1===p.indexOf(":")&&this.parent.isCellReference(p)){if(a=n?this.parent.getValueFromArg(d[h],null,null,!0):this.parent.getValueFromArg(d[h]),n&&a.includes("SUBTOTAL("))continue;if(!rn(a))continue;if(this.parent.getErrorStrings().indexOf(a)>-1)return a}else{if((a=d[h]).indexOf(this.parent.tic)>-1&&""===a.split(this.parent.tic).join("").trim()||d[h].indexOf(this.parent.tic)>-1&&isNaN(this.parent.parseFloat(a.split(this.parent.tic).join(""))))return this.parent.getErrorStrings()[zn.Value];if(a=(a=this.parent.getValueFromArg(d[h].split(this.parent.tic).join("")))===this.parent.trueValue?"1":a===this.parent.falseValue?"0":a.split(this.parent.tic).join(""),this.parent.getErrorStrings().indexOf(a)>-1)return a}s=this.parent.parseFloat(a),isNaN(s)||a.length>0&&(o*=s,l=!1)}return l?"0":o.toString()},t.prototype.ComputeDAYS=function(){for(var t=this,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var i=this.parent.getErrorStrings();if((0,e.isNullOrUndefined)(r)&&1===r.length&&""===r[0])return this.parent.formulaErrorStrings[_n.InvalidArguments];if(2!==r.length)return this.parent.formulaErrorStrings[_n.WrongNumberArguments];var a=function(e){var r=t.parent.getValueFromArg(e).trim();if(r.indexOf(t.parent.tic)>-1&&(""===(r=r.split(t.parent.tic).join("").trim())||t.parent.isCellReference(e)||r.toUpperCase()===t.parent.trueValue||r.toUpperCase()===t.parent.falseValue))return i[zn.Value];if((r=r.split(t.parent.tic).join("")).toUpperCase()===t.parent.trueValue)r="1";else if(""===r||r.toUpperCase()===t.parent.falseValue)r="0";else if(Number(r)<0)return i[zn.Num];var n={value:r.toString()};return t.parent.parentObject.notify(ue,n),(n.isDate||n.isTime)&&(r=(t.parent.parseDate(r).getTime()/864e5).toString()),r},s=a(r[0]);if(i.indexOf(s)>-1)return s;var o=a(r[1]);if(i.indexOf(o)>-1)return o;var l=Math.floor(Number(s))-Math.floor(Number(o));return isNaN(l)?i[zn.Value]:l},t.prototype.ComputeUNIQUE=function(){for(var t,r,n=this,i=[],a=0;a<arguments.length;a++)i[a]=arguments[a];var s=this.parent.getErrorStrings();if("isComputeExp"===i[i.length-1]&&(r=!0,i.pop()),(0,e.isNullOrUndefined)(i)||""===i[0]&&1===i.length)return this.parent.formulaErrorStrings[_n.InvalidArguments];if(i.length>3)return this.parent.formulaErrorStrings[_n.WrongNumberArguments];var o=function(t){if((0,e.isNullOrUndefined)(t))return n.parent.falseValue;var r=n.parent.getValueFromArg(t);return s.indexOf(r)>-1?r:0===Number(r)?n.parent.falseValue:Number(r)<0||Number(r)>0?n.parent.trueValue:(n.parent.isCellReference(t)||(r=n.parent.removeTics(r)),r.toUpperCase()===n.parent.trueValue||r.toUpperCase()===n.parent.falseValue?r.toUpperCase():r.indexOf(n.parent.tic)>-1||t.indexOf(n.parent.tic)>-1?s[zn.Value]:s[zn.Name])},l=o(i[1]);if(s.indexOf(l)>-1)return l;var d=o(i[2]);if(s.indexOf(d)>-1)return d;var h=[];if(i[0].indexOf(":")>-1){if((0,e.isNullOrUndefined)(i[0].match(/[0-9]/))){var p=i[0].split(":");i[0]=p[0]+"1:"+p[1]+(this.parent.spreadSheetUsedRange[0]+1)}else if((0,e.isNullOrUndefined)(i[0].toUpperCase().match(/[A-Z]/))){p=i[0].split(":");i[0]="A"+p[0]+":"+Ao(this.parent.spreadSheetUsedRange[1]+1)+p[1]}var c=i[0].split(":");if(this.parent.isCellReference(c[0])&&this.parent.isCellReference(c[1])){for(var u=this.parent.dependencyCollection,f=0;f<u.length&&!r;f++)u[f].split(":")[0]===i[0].split(":")[0]&&this.clearDependency(u[f]);-1===this.parent.dependencyCollection.indexOf(i[0])?r||this.parent.dependencyCollection.push(i[0]):this.clearDependency(i[0]);var g=i[0].indexOf(":"),m=void 0,v=this.parent.rowIndex(this.parent.substring(i[0],0,g)),y=this.parent.colIndex(this.parent.substring(i[0],0,g)),C=this.parent.rowIndex(this.parent.substring(i[0],g+1,g+i[0].length-g-1)),b=this.parent.colIndex(this.parent.substring(i[0],g+1,g+i[0].length-g-1));v>C&&(m=C,C=v,v=m),y>b&&(m=b,b=y,y=m);var x="";0===i[0].indexOf("!")&&(x=i[0].substring(0,i[0].replace("!","").indexOf("!")+2)),i[0]=x+Ao(y)+v+":"+Ao(b)+C;var S,w=b-y,I=this.parent.getCellCollection(i[0]),E=void 0;if(E=S=this.parent.actCell,l===this.parent.falseValue)if(0===w)for(f=0;f<I.length;f++){A=""===(A=this.parent.getValueFromArg(I[f]))?"0":A,h.push(A)}else{var N="",R=w;for(f=0;f<I.length;f++){if(f===I.length-1)N=N+(A=""===(A=this.parent.getValueFromArg(I[f]))?"0":A)+"++",h.push(N.substring(0,N.length-2));if(f<=R)N=N+(A=""===(A=this.parent.getValueFromArg(I[f]))?"0":A)+"++";else h.push(N.substring(0,N.length-2)),R=w+f,N=(A=""===(A=this.parent.getValueFromArg(I[f]))?"0":A)+"++"}}else{N="",R=w+1;var O=C-v;for(f=0;f<R;f++){for(var k=0;k<=O;k++){var A;N=N+(A=""===(A=this.parent.getValueFromArg(I[k*R+f]))?"0":A)+"++"}h.push(N.substring(0,N.length-2)),N=""}}var F,T=[],D=[],L=[],P=[];for(f=0;f<h.length;f++)-1===T.indexOf(h[f].toLowerCase())?(T.push(h[f].toLowerCase()),L.push(h[f])):(-1===D.indexOf(h[f].toLowerCase())&&D.push(h[f].toLowerCase()),P.push(h[f]));if(d===this.parent.trueValue){var M=[];for(f=0;f<L.length;f++)-1===D.indexOf(L[f].toLowerCase())&&M.push(L[f]);if(0===(L=M).length)return s[zn.Calc]}if(r)return 0!==w?(F=[],L.forEach((function(e){F=F.concat(e.split("++"))}))):F=l===this.parent.falseValue?L:L[0].split("++"),F;E.indexOf("!")>-1&&(E=E.substring(E.lastIndexOf("!")+1));var B=this.parent.rowIndex(E),H=this.parent.colIndex(E);if(0===this.parent.dependencyLevel){var U=!1;if(l===this.parent.falseValue)for(f=B,R=L.length+B;f<R;f++)for(var V=H,z=(G=L[0].split("++")).length+H;V<z;V++)f===R-1&&V===z-1&&-1===this.parent.uniqueRange.indexOf(S+":"+Ao(V)+f)&&this.parent.uniqueRange.push(S+":"+Ao(V)+f),this.checkSpill(V,f)&&(U=!0);else for(f=H,R=L.length+H;f<R;f++){var _=B;for(z=(G=L[0].split("++")).length+B;_<z;_++)f===R-1&&_===z-1&&-1===this.parent.uniqueRange.indexOf(this.parent.actCell+":"+Ao(f)+_)&&this.parent.uniqueRange.push(this.parent.actCell+":"+Ao(f)+_),this.checkSpill(f,_)&&(U=!0)}if(U)return this.parent.formulaErrorStrings[_n.Spill]}else if(this.parent.dependencyLevel>0&&this.parent.getValueFromArg(Ao(H)+B,!0).indexOf("#SPILL!")>-1)return this.parent.formulaErrorStrings[_n.Spill];if(l===this.parent.falseValue){var j=this.parent.getSheetFamilyItem(this.parent.grid),q="",W=void 0;null!==j.sheetNameToParentObject&&j.sheetNameToParentObject.size>0&&(W=(q=j.parentObjectToToken.get(this.parent.grid))+E);for(f=0;f<L.length;f++){var G=L[f].split("++");f>0&&(B++,H=this.parent.colIndex(E));for(var Y=0;Y<G.length;Y++)this.setValueRefresh(G[Y],B,H),(f>0||Y>0)&&this.parent.refresh(q+Ao(H)+B.toString(),W),G[Y+1]&&H++}t=L[0].split("++")[0]}else{for(f=0;f<L.length;f++){G=L[f].split("++");for(var X=0;X<G.length;X++)this.setValueRefresh(G[X],B,H),G[X+1]?B++:(H++,B=this.parent.rowIndex(E))}t=L[0].split("++")[0]}}}else if(this.parent.isCellReference(i[0]))-1===this.parent.dependencyCollection.indexOf(i[0])?r||this.parent.dependencyCollection.push(i[0]):this.clearDependency(i[0]),t=this.parent.getValueFromArg(i[0]);else{if(t=this.parent.getValueFromArg(i[0].trim()),s.indexOf(t)>-1)return t;t=this.parent.removeTics(t)}return t},t.prototype.setValueRefresh=function(e,t,r){this.parent.parentObject.setValueRowCol(this.parent.getSheetId(this.parent.grid),e,t,r)},t.prototype.checkSpill=function(e,t){var r,n=!1,i=this.parent.getValueFromArg(Ao(e)+t,!0),a="!"+this.parent.getSheetID(this.parent.grid)+"!"+Ao(e)+t;return this.parent.getFormulaInfoTable().get(a)&&(r=this.parent.getFormulaInfoTable().get(a).formulaText),i&&(i.toUpperCase().indexOf("UNIQUE")<0||r&&!r.toUpperCase().includes("UNIQUE"))&&i!==this.parent.formulaErrorStrings[_n.WrongNumberArguments]&&(n=!0),n},t.prototype.clearDependency=function(e){var t=this.parent.actCell,r="";if(t.lastIndexOf("!")>-1){var n=t;t=n.substring(n.lastIndexOf("!")+1),r=n.substring(0,n.lastIndexOf("!"))+"!"}for(var i=this.parent.rowIndex(t),a=this.parent.colIndex(t),s=e.indexOf(":"),o=this.parent.rowIndex(this.parent.substring(e,0,s)),l=this.parent.colIndex(this.parent.substring(e,0,s)),d=this.parent.rowIndex(this.parent.substring(e,s+1,s+e.length-s-1))-o+i,h=this.parent.colIndex(this.parent.substring(e,s+1,s+e.length-s-1))-l+a,p=this.parent.getFormulaInfoTable().get("!"+this.parent.getSheetID(this.parent.grid)+"!"+t)?this.parent.getFormulaInfoTable().get("!"+this.parent.getSheetID(this.parent.grid)+"!"+t).getFormulaText():"",c=i;c<=d;c++)for(var u=a;u<=h;u++)if(this.parent.dependencyLevel>0||p.indexOf("UNIQUE")>-1){if(this.parent.getValueFromArg("!"+this.parent.getSheetID(this.parent.grid)+"!"+Ao(a)+i,!0).indexOf("#SPILL!")>-1)return;this.parent.parentObject.setValueRowCol(this.parent.getSheetID(this.parent.grid)+1,"",c,u),this.parent.refresh("!"+this.parent.getSheetID(this.parent.grid)+"!"+Ao(u)+c,t),this.parent.actCell=r+t}},t.prototype.ComputeT=function(){for(var t,r,n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];var a=this.parent.getErrorStrings();if(n.length&&"nestedFormulaTrue"===n[n.length-1]&&(r=!0,n.pop()),(0,e.isNullOrUndefined)(n)||1===n.length&&""===n[0].trim())return this.parent.formulaErrorStrings[_n.InvalidArguments];if(n.length>1)return this.parent.formulaErrorStrings[_n.WrongNumberArguments];if(t=this.parent.getValueFromArg(n[0]).trim(),a.indexOf(t)>-1)return t;if(n[0].indexOf(this.parent.tic)>-1)(t=this.parent.removeTics(n[0].trim())).indexOf(this.parent.tic+this.parent.tic)>-1&&(t=t.replace(/""/g,this.parent.tic));else if(2===t.split("%").length&&this.parent.isNumber(t.split("%")[0])&&(t=(Number(t.split("%")[0])/100).toString()),this.parent.isNumber(t)||t.toUpperCase()===this.parent.trueValue||t.toUpperCase()===this.parent.falseValue)return"";return r&&(t=this.parent.tic+t+this.parent.tic),t},t.prototype.ComputeHOUR=function(){for(var t,r,n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];if(1!==n.length||(0,e.isNullOrUndefined)(n)||""===n[0])return this.parent.formulaErrorStrings[_n.InvalidArguments];if(""===n[0].split(this.parent.tic).join("").trim())return this.parent.getErrorStrings()[zn.Value];if(this.parent.isCellReference(n[0])){if((t=this.parent.getValueFromArg(n[0].split(this.parent.tic).join(""))||"0").indexOf(this.parent.tic)>-1)return this.parent.getErrorStrings()[zn.Value]}else{if(n[0].indexOf(this.parent.tic)>-1&&(n[0].split(this.parent.tic).join("")===this.parent.trueValue||n[0].split(this.parent.tic).join("")===this.parent.falseValue))return this.parent.getErrorStrings()[zn.Value];t=this.parent.getValueFromArg(n[0]).split(this.parent.tic).join("")}if(this.parent.getErrorStrings().indexOf(t)>-1)return t;if(t=t===this.parent.trueValue?"1":t===this.parent.falseValue?"0":t,this.parent.isNumber(t)){if(this.parent.parseFloat(t)<0||this.parent.parseFloat(t)>2958465)return this.parent.getErrorStrings()[zn.Num];r=this.parent.intToTime(t)}else{var a={value:t.toString()};if(this.parent.parentObject.notify(ue,a),!a.isDate&&!a.isTime)return this.parent.getErrorStrings()[zn.Value];r=a.dateObj}if("Invalid Date"===r.toString()&&(r=new Date(Date.parse(t))),"Invalid Date"===r.toString()){var s=new Date(Date.now()).toLocaleDateString()+" "+t;r=new Date(Date.parse(s))}return"Invalid Date"===r.toString()&&(r=this.parent.fromOADate(this.parent.parseFloat(t))),"Invalid Date"===r.toString()||r.getFullYear()<1900||r.getFullYear()>9999?this.parent.getErrorStrings()[zn.Value]:r.getHours()},t.prototype.ComputeMINUTE=function(){for(var t,r,n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];if(1!==n.length||(0,e.isNullOrUndefined)(n)||""===n[0])return this.parent.formulaErrorStrings[_n.InvalidArguments];if(""===n[0].split(this.parent.tic).join("").trim())return this.parent.getErrorStrings()[zn.Value];if(this.parent.isCellReference(n[0])){if((t=this.parent.getValueFromArg(n[0].split(this.parent.tic).join(""))||"0").indexOf(this.parent.tic)>-1)return this.parent.getErrorStrings()[zn.Value]}else{if(n[0].indexOf(this.parent.tic)>-1&&(n[0].split(this.parent.tic).join("")===this.parent.trueValue||n[0].split(this.parent.tic).join("")===this.parent.falseValue))return this.parent.getErrorStrings()[zn.Value];t=this.parent.getValueFromArg(n[0]).split(this.parent.tic).join("")}if(this.parent.getErrorStrings().indexOf(t)>-1)return t;if(t=t===this.parent.trueValue?"1":t===this.parent.falseValue?"0":t,this.parent.isNumber(t)){if(this.parent.parseFloat(t)<0||this.parent.parseFloat(t)>2958465)return this.parent.getErrorStrings()[zn.Num];r=this.parent.intToTime(t)}else{var a={value:t.toString()};if(this.parent.parentObject.notify(ue,a),!a.isDate&&!a.isTime)return this.parent.getErrorStrings()[zn.Value];r=a.dateObj}if("Invalid Date"===r.toString()&&(r=new Date(Date.parse(t))),"Invalid Date"===r.toString()){var s=new Date(Date.now()).toLocaleDateString()+" "+t;r=new Date(Date.parse(s))}return"Invalid Date"===r.toString()&&(r=this.parent.fromOADate(this.parent.parseFloat(t))),"Invalid Date"===r.toString()||r.getFullYear()<1900||r.getFullYear()>9999?this.parent.getErrorStrings()[zn.Value]:r.getMinutes()},t.prototype.ComputeSECOND=function(){for(var t,r,n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];if(1!==n.length||(0,e.isNullOrUndefined)(n)||""===n[0])return this.parent.formulaErrorStrings[_n.InvalidArguments];if(""===n[0].split(this.parent.tic).join("").trim())return this.parent.getErrorStrings()[zn.Value];if(this.parent.isCellReference(n[0])){if((t=this.parent.getValueFromArg(n[0].split(this.parent.tic).join(""))||"0").indexOf(this.parent.tic)>-1)return this.parent.getErrorStrings()[zn.Value]}else{if(n[0].indexOf(this.parent.tic)>-1&&(n[0].split(this.parent.tic).join("")===this.parent.trueValue||n[0].split(this.parent.tic).join("")===this.parent.falseValue))return this.parent.getErrorStrings()[zn.Value];t=this.parent.getValueFromArg(n[0]).split(this.parent.tic).join("")}if(this.parent.getErrorStrings().indexOf(t)>-1)return t;if(t=t===this.parent.trueValue?"1":t===this.parent.falseValue?"0":t,this.parent.isNumber(t)){if(this.parent.parseFloat(t)<0||this.parent.parseFloat(t)>2958465)return this.parent.getErrorStrings()[zn.Num];r=this.parent.intToTime(t)}else{var a={value:t.toString()};if(this.parent.parentObject.notify(ue,a),!a.isDate&&!a.isTime)return this.parent.getErrorStrings()[zn.Value];r=a.dateObj}if("Invalid Date"===r.toString()&&(r=new Date(Date.parse(t))),"Invalid Date"===r.toString()){var s=new Date(Date.now()).toLocaleDateString()+" "+t;r=new Date(Date.parse(s))}return"Invalid Date"===r.toString()&&(r=this.parent.fromOADate(this.parent.parseFloat(t))),"Invalid Date"===r.toString()||r.getFullYear()<1900||r.getFullYear()>9999?this.parent.getErrorStrings()[zn.Value]:r.getSeconds()},t.prototype.ComputeMONTH=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=this.parent.getErrorStrings();if(1===e.length&&""===e[0])return this.parent.formulaErrorStrings[_n.InvalidArguments];if(1!==e.length)return this.parent.formulaErrorStrings[_n.WrongNumberArguments];var n=this.parent.getValueFromArg(e[0]).trim();if(r.indexOf(n)>-1)return n;if(this.parent.isCellReference(e[0])){if(n.indexOf(this.parent.tic)>-1)return r[zn.Value];if(""===n)return 1}else{if('"TRUE"'===n.toUpperCase()||'"FALSE"'===n.toUpperCase())return r[zn.Value];n=n.split(this.parent.tic).join("")}if(""===n)return r[zn.Value];if(n===this.parent.trueValue||n===this.parent.falseValue||Number(n)>-1&&Number(n)<32)return 1;if(Number(n)<0)return r[zn.Num];n.indexOf("%")>-1&&(n=(.01*Number(n.split("%")[0])).toString()),this.parent.isNumber(n)&&(n=parseInt(Math.floor(Number(n)).toString(),10));var i=this.parent.parseDate(n);return"Invalid Date"===i.toString()?this.parent.isNumber(n)?r[zn.Num]:r[zn.Value]:i.getFullYear()<1900||1e4<=i.getFullYear()?r[zn.Num]:(i.getMonth()+1).toString()},t.prototype.ComputeNOW=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];if(1!==t.length||""!==t[0])return this.parent.formulaErrorStrings[_n.InvalidArguments];var n=new Date(Date.now()),i=(new e.Internationalization).getDateFormat({format:"M/d/yyyy h:mm:ss a"});return this.parent.parentObject.dateToInt(i(n),!0).toString()},t.prototype.ComputeEXACT=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r,n,i,a=!1,s=e.length&&"nestedFormulaTrue"===e[e.length-1],o=this.parent.getErrorStrings();if(s&&e.pop(),!e||!e[0]&&1===e.length)return this.parent.formulaErrorStrings[_n.InvalidArguments];if(2!==e.length)return this.parent.formulaErrorStrings[_n.WrongNumberArguments];if(e[0]){if(r=this.parent.getValueFromArg(e[0]),o.indexOf(r)>-1)return r;-1===r.indexOf(this.parent.tic)&&r.includes("%")&&(r=(Number(r.split("%")[0])/100).toString()),this.parent.isCellReference(e[0])?i=!0:r=r.split(this.parent.tic).join("")}if(e[1]){if(n=this.parent.getValueFromArg(e[1]),o.indexOf(n)>-1)return n;-1===n.indexOf(this.parent.tic)&&n.includes("%")&&(n=(Number(n.split("%")[0])/100).toString()),this.parent.isCellReference(e[1])?i||0!==r.trim().length||0!==n.trim().length||(a=!1):(n=n.split(this.parent.tic).join(""),i&&0===r.trim().length&&0===n.trim().length&&(a=!1))}return r===n&&(a=!0,s&&(a=this.parent.tic+a+this.parent.tic)),a},t.prototype.ComputeLEN=function(){for(var t,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var i=this.parent.getErrorStrings();return(0,e.isNullOrUndefined)(r)||""===r[0].trim()&&1===r.length?this.parent.formulaErrorStrings[_n.InvalidArguments]:r.length>1?this.parent.formulaErrorStrings[_n.WrongNumberArguments]:(t=this.parent.getValueFromArg(r[0]).trim(),i.indexOf(t)>-1?t:(r[0].indexOf(this.parent.tic)>-1?r[0]!==t&&r[0].startsWith("n")?t=this.parent.removeTics(t.trim()):(t=this.parent.removeTics(r[0].trim())).indexOf(this.parent.tic+this.parent.tic)>-1&&(t=t.replace(/""/g,this.parent.tic)):!r[0].startsWith("n")&&2===t.split("%").length&&this.parent.isNumber(t.split("%")[0])&&(t=(Number(t.split("%")[0])/100).toString()),t.length))},t.prototype.ComputeMOD=function(){for(var t,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];if((0,e.isNullOrUndefined)(r)||2!==r.length)return this.parent.formulaErrorStrings[_n.InvalidArguments];if(""===r[1]&&!r[0].includes('"'))return this.parent.formulaErrorStrings[_n.Div];if(""===r[0]&&!r[1].includes('"'))return 0;for(var i=0;i<r.length;i++){var a=r[i].split(this.parent.tic).join("").trim();if(""===a||r[i].indexOf(this.parent.tic)>-1&&isNaN(this.parent.parseFloat(a)))return this.parent.getErrorStrings()[zn.Value];if(Sr(r[i])){if((t=(t=this.parent.getValueFromArg(r[i])||"0")===this.parent.trueValue?"1":t===this.parent.falseValue?"0":t).toUpperCase().match(/[A-Z]/)||t.includes('"')||!this.parent.isNumber(t))return this.parent.getErrorStrings()[zn.Value]}else if(t=(t=this.parent.getValueFromArg(r[i].split(this.parent.tic).join("")))===this.parent.trueValue?"1":t===this.parent.falseValue?"0":t,this.parent.getErrorStrings().indexOf(t)>-1)return t;r[i]=t}var s=r[0],o=r[1];if("0"===o||""===o)return this.parent.formulaErrorStrings[_n.Div];if("0"===s||""===s)return 0;var l=((s=parseFloat(s))%(o=parseFloat(o))+o)%o;return isNaN(l)?this.parent.getErrorStrings()[zn.Name]:l},t.prototype.ComputeODD=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];if((0,e.isNullOrUndefined)(t)||1!==t.length||""===t[0])return this.parent.formulaErrorStrings[_n.InvalidArguments];var n,i=t[0].split(this.parent.tic).join("").trim();if(""===i||t[0].indexOf(this.parent.tic)>-1&&isNaN(this.parent.parseFloat(i)))return this.parent.getErrorStrings()[zn.Value];if(Sr(t[0])){if((n=this.parent.getValueFromArg(t[0]))===this.parent.trueValue)n="1";else if(""===n||n===this.parent.falseValue)n="0";else if(n.toUpperCase().match(/[A-Z]/)||n.includes('"')||!this.parent.isNumber(n))return this.parent.getErrorStrings()[zn.Value]}else{if("#NAME?"===(n=this.parent.getValueFromArg(t[0].split(this.parent.tic).join(""))))return this.parent.getErrorStrings()[zn.Name];if(n===this.parent.trueValue)n="1";else if(""===n||n===this.parent.falseValue)n="0";else if(n.toUpperCase().match(/[A-Z]/)||!this.parent.isNumber(n))return this.parent.getErrorStrings()[zn.Value]}var a=Math.ceil(parseInt(n,10)),s=0===a;return a=a%2==0?a>0?a+1:a-1:a,Math.ceil(parseInt(n,10))%2!=0&&(parseInt(n,10)>0&&parseFloat(n)>parseInt(n,10)?a+=2:parseInt(n,10)<0&&parseFloat(n)<parseInt(n,10)&&(a-=2)),isNaN(a)?this.parent.getErrorStrings()[zn.Name]:s?1:a},t.prototype.ComputeEVEN=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];if((0,e.isNullOrUndefined)(t)||1!==t.length||""===t[0])return this.parent.formulaErrorStrings[_n.InvalidArguments];var n,i=t[0].split(this.parent.tic).join("").trim();if(""===i||t[0].indexOf(this.parent.tic)>-1&&isNaN(this.parent.parseFloat(i)))return this.parent.getErrorStrings()[zn.Value];if(Sr(t[0])){if((n=this.parent.getValueFromArg(t[0]))===this.parent.trueValue)n="1";else if(""===n||n===this.parent.falseValue)n="0";else if(n.toUpperCase().match(/[A-Z]/)||n.includes('"')||!this.parent.isNumber(n))return this.parent.getErrorStrings()[zn.Value]}else{if("#NAME?"===(n=this.parent.getValueFromArg(t[0].split(this.parent.tic).join(""))))return this.parent.getErrorStrings()[zn.Name];if(n===this.parent.trueValue)n="1";else if(""===n||n===this.parent.falseValue)n="0";else if(n.toUpperCase().match(/[A-Z]/)||!this.parent.isNumber(n))return this.parent.getErrorStrings()[zn.Value]}var a=Math.ceil(parseInt(n,10));return a=a%2==0?a:a>0?a+1:a-1,Math.ceil(parseInt(n,10))%2==0&&(parseInt(n,10)>0&&parseFloat(n)>parseInt(n,10)?a+=2:parseInt(n,10)<0&&parseFloat(n)<parseInt(n,10)&&(a-=2)),isNaN(a)?this.parent.getErrorStrings()[zn.Name]:a},t.prototype.ComputePI=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e&&""!==e[0]?this.parent.formulaErrorStrings[_n.InvalidArguments]:Math.PI},t.prototype.ComputeMEDIAN=function(){for(var t,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var i=[];if((0,e.isNullOrUndefined)(r)||""===r[0]&&1===r.length)return this.parent.formulaErrorStrings[_n.InvalidArguments];for(var a=0;a<r.length;a++)if(this.parent.isCellReference(r[a]))if(r[a].indexOf(":")>-1)for(var s=this.parent.getCellCollection(r[a]),o=0;o<s.length;o++){var l=this.parent.getValueFromArg(s[o]);if(this.parent.getErrorStrings().indexOf(l)>-1)return l;""!==l.trim()&&i.push(this.parent.parseFloat(l))}else{var d=this.parent.getValueFromArg(r[a]);if(this.parent.getErrorStrings().indexOf(d)>-1)return d;""!==d.trim()&&i.push(this.parent.parseFloat(d))}else if(""===r[a]||r[a]===this.parent.falseValue&&!this.parent.isCellReference(r[a]))i.push(0);else if(r[a]!==this.parent.trueValue||this.parent.isCellReference(r[a])){if(r[a].indexOf(this.parent.tic)>-1&&isNaN(parseFloat(r[a].split(this.parent.tic).join(""))))return this.parent.getErrorStrings()[zn.Value];var h=this.parent.getValueFromArg(r[a]).split(this.parent.tic).join("");if(this.parent.getErrorStrings().indexOf(h)>-1)return h;i.push(this.parent.parseFloat(h))}else i.push(1);for(var p=(i=i.sort((function(e,t){return e-t}))).length,c=0;c<p&&(!isNaN(i[c])||(i.splice(c,1),p=i.length,c--,0!==i.length));c++);if(i.length%2==0||isNaN(i[parseInt((i.length/2).toString(),10)])){if(isNaN(i[i.length/2])||isNaN(i[i.length/2-1]))return this.parent.getErrorStrings()[zn.Num];t=(i[i.length/2]+i[i.length/2-1])/2}else t=i[parseInt((i.length/2).toString(),10)];return t},t.prototype.ComputeEDATE=function(){for(var t,r,n,i=[],a=0;a<arguments.length;a++)i[a]=arguments[a];if(2!==i.length||(0,e.isNullOrUndefined)(i))return this.parent.formulaErrorStrings[_n.InvalidArguments];if(""===i[0]||""===i[1])return this.parent.getErrorStrings()[zn.NA];if(""===i[0].split(this.parent.tic).join("")||""===i[1].split(this.parent.tic).join("")||i[1].indexOf(this.parent.tic)>-1&&isNaN(this.parent.parseFloat(i[1].split(this.parent.tic).join(""))))return this.parent.getErrorStrings()[zn.Value];if(this.parent.isCellReference(i[0])){if(i[0].indexOf(":")>-1)return this.parent.getErrorStrings()[zn.Value];if((t=this.parent.getValueFromArg(i[0].split(this.parent.tic).join(""))||"0").indexOf(this.parent.tic)>-1)return this.parent.getErrorStrings()[zn.Value]}else t=this.parent.getValueFromArg(i[0].split(this.parent.tic).join(""));if(this.parent.isCellReference(i[1])){if(i[1].indexOf(":")>-1)return this.parent.getErrorStrings()[zn.Value];r=this.parent.getValueFromArg(i[1].split(this.parent.tic).join(""))||"0"}else r=this.parent.getValueFromArg(i[1].split(this.parent.tic).join(""));if(this.parent.getErrorStrings().indexOf(r)>-1)return r;if(r=parseInt(r,10),this.parent.isNumber(t)){if((t=parseInt(t,10))<0||t>2958465)return this.parent.getErrorStrings()[zn.Num];n=this.parent.fromOADate(t)}else n=this.parent.checkDateFormat(t);if(isNaN(r)||(0,e.isNullOrUndefined)(this.parent.isDate(n))||n.getFullYear()>9999)return this.parent.getErrorStrings()[zn.Value];var s=n.getDate();n.setMonth(n.getMonth()+r),s!==n.getDate()&&n.setDate(0);var o=this.parent.parentObject.dateToInt(n);return"0"===t.toString()&&(o-=1),o<0||o>2958465?this.parent.getErrorStrings()[zn.Num]:o.toString()},t.prototype.ComputeEOMONTH=function(){for(var t,r,n,i=[],a=0;a<arguments.length;a++)i[a]=arguments[a];if(2!==i.length||(0,e.isNullOrUndefined)(i))return this.parent.formulaErrorStrings[_n.InvalidArguments];if(""===i[0]||""===i[1])return this.parent.getErrorStrings()[zn.NA];if(""===i[0].split(this.parent.tic).join("")||""===i[1].split(this.parent.tic).join("")||i[1].indexOf(this.parent.tic)>-1&&isNaN(this.parent.parseFloat(i[1].split(this.parent.tic).join(""))))return this.parent.getErrorStrings()[zn.Value];if(this.parent.isCellReference(i[0])){if(i[0].indexOf(":")>-1)return this.parent.getErrorStrings()[zn.Value];if((t=this.parent.getValueFromArg(i[0].split(this.parent.tic).join(""))||"0").indexOf(this.parent.tic)>-1)return this.parent.getErrorStrings()[zn.Value]}else t=this.parent.getValueFromArg(i[0]).split(this.parent.tic).join("");if(this.parent.getErrorStrings().indexOf(t)>-1)return t;if(this.parent.isCellReference(i[1])){if(i[1].indexOf(":")>-1)return this.parent.getErrorStrings()[zn.Value];r=this.parent.getValueFromArg(i[1].split(this.parent.tic).join(""))||"0"}else r=this.parent.getValueFromArg(i[1].split(this.parent.tic).join(""));if(this.parent.getErrorStrings().indexOf(r)>-1)return r;if(r=parseInt(r,10),this.parent.isNumber(t)){if((t=parseInt(t,10))<0||t>2958465)return this.parent.getErrorStrings()[zn.Num];n=this.parent.fromOADate(t)}else n=this.parent.checkDateFormat(t);if(isNaN(r)||(0,e.isNullOrUndefined)(this.parent.isDate(n))||n.getFullYear()>9999)return this.parent.getErrorStrings()[zn.Value];n=new Date(n.getFullYear(),n.getMonth()+(r+1),0);var s=this.parent.parentObject.dateToInt(n);return s<0||s>2958465||n.getFullYear()<1900?this.parent.getErrorStrings()[zn.Num]:s.toString()},t.prototype.ComputeDATEVALUE=function(){for(var t,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var i=this.parent.getErrorStrings();if(""===r[0])return this.parent.formulaErrorStrings[_n.InvalidArguments];if(r.length>1)return this.parent.formulaErrorStrings[_n.WrongNumberArguments];if(t=this.parent.getValueFromArg(r[0])||"0",i.indexOf(t)>-1)return t;if(this.parent.isCellReference(r[0])){if(r[0].indexOf(":")>-1||t.startsWith(this.parent.tic))return i[zn.Value]}else t=r[0].split(this.parent.tic).join("")||"0";if(this.parent.isNumber(t)||(0,e.isNullOrUndefined)(this.parent.isDate(t)))return i[zn.Value];var a=this.parent.parseDate(t);return i.indexOf(t)>-1?t:(0,e.isNullOrUndefined)(a)||"Invalid Date"===a.toString()||a.getFullYear()<1900||a.getFullYear()>9999?this.parent.getErrorStrings()[zn.Value]:(t=this.parent.toOADate(a).toString(),parseFloat(t).toFixed(0).toString())},t.prototype.ComputeCOUNTBLANK=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=0;if(1!==t.length||(0,e.isNullOrUndefined)(t)||!this.parent.isCellReference(t[0]))return this.parent.formulaErrorStrings[_n.InvalidArguments];if(""===t[0])return this.parent.getErrorStrings()[zn.Value];for(var i=this.parent.getCellCollection(t[0]),a=0;a<i.length;a++)""===this.parent.getValueFromArg(i[a])&&n++;return n},t.prototype.ComputeFACT=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=1,n=this.parent.getErrorStrings();if(""===e[0])return this.parent.formulaErrorStrings[_n.InvalidArguments];if(1!==e.length)return this.parent.formulaErrorStrings[_n.WrongNumberArguments];var i=e[0];if(this.parent.isCellReference(e[0])||isNaN(Number(i.split(this.parent.tic).join("")))){if(i=this.parent.getValueFromArg(e[0]),n.indexOf(i)>-1)return i;if(i.startsWith(this.parent.tic)||i.match(/^(\d*\.\d+|\d+)\s*[+\-*/]\s*(\d*\.\d+|\d+)$/))return n[zn.Value];if(""===i)return 1}if(i=i.split(this.parent.tic).join("").trim(),n.indexOf(i)>-1)return i;if(i.toUpperCase()===this.parent.trueValue||i.toUpperCase()===this.parent.falseValue)return 1;i.indexOf("%")>-1&&(i=(Number(i.split("%")[0])/100).toString());var a=parseInt(i,10);if(a<0||a>170)return n[zn.Num];if(i.toUpperCase().match(/[A-Z]/)||""===i)return n[zn.Value];if(i.indexOf(":")>-1)return 0;for(var s=1;s<=a;s++)r*=s;return r},t.prototype.ComputeDECIMAL=function(){for(var t,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];if((0,e.isNullOrUndefined)(r)||2!==r.length)return this.parent.formulaErrorStrings[_n.InvalidArguments];if(r[0].match(/[@#$%^&*()?:{}|<>+-]/g))return this.parent.getErrorStrings()[zn.Num];if(r[1].indexOf(this.parent.tic)>-1&&isNaN(this.parent.parseFloat(r[1].split(this.parent.tic).join(""))))return this.parent.getErrorStrings()[zn.Value];var i=void 0,a=void 0;i=this.parent.isCellReference(r[0].toString())?this.parent.getValueFromArg(r[0]):this.parent.getValueFromArg(r[0]).split(this.parent.tic).join(""),a=this.parent.isCellReference(r[1].toString())?this.parent.getValueFromArg(r[1]):this.parent.getValueFromArg(r[1]).split(this.parent.tic).join("");var s=parseInt(i,10),o=parseInt(a,10);return this.parent.getErrorStrings().indexOf(i)>-1?i:this.parent.getErrorStrings().indexOf(a)>-1?a:""===i&&""!==a?0:""===i||s<0||!isNaN(s)&&!Number.isInteger(parseFloat(i))||""===a||o<2||o>36||isNaN(o)||isNaN(this.parent.parseFloat(i))&&this.parent.parseFloat(a)<=10?this.parent.getErrorStrings()[zn.Num]:(t=parseInt(i,parseInt(a,10)),isNaN(t)?this.parent.getErrorStrings()[zn.Num]:t)},t.prototype.ComputeDEGREES=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=this.parent.getErrorStrings();if((0,e.isNullOrUndefined)(t)||""===t[0]&&1===t.length)return this.parent.formulaErrorStrings[_n.InvalidArguments];if(1!==t.length)return this.parent.formulaErrorStrings[_n.WrongNumberArguments];var i=this.parent.getValueFromArg(t[0]).trim();if(n.indexOf(i)>-1)return i;if(this.parent.isCellReference(t[0])){if(""===i||i.indexOf(":")>-1)return 0;if(i.indexOf(this.parent.tic)>-1||isNaN(Number(i))&&!isNaN(parseInt(i,10)))return n[zn.Value]}else if(i.indexOf('"TRUE"')>-1)return n[zn.Value];if((i=i.split(this.parent.tic).join("")).toUpperCase()===this.parent.trueValue)i="1";else if(i.toUpperCase()===this.parent.falseValue)i="0";else if(i.indexOf("%")>-1)i=(Number(i.split("%")[0])/100).toString();else if(i.toUpperCase().match(/[A-Z]/)||isNaN(parseInt(i,10)))return n[zn.Value];return parseFloat(i)*(180/Math.PI)},t.prototype.ComputeADDRESS=function(){for(var t,r=this,n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];var a=this.parent.getErrorStrings();if((0,e.isNullOrUndefined)(n)||1===n.length&&""===n[0].trim())return this.parent.formulaErrorStrings[_n.InvalidArguments];if(n.length<2||n.length>5)return this.parent.formulaErrorStrings[_n.WrongNumberArguments];if(""===n[0].split(this.parent.tic).join("").trim()||""===n[1].split(this.parent.tic).join("").trim())return a[zn.Value];var s=function(e){var t=r.parent.getValueFromArg(e).trim();return a.indexOf(t)>0?t:(t.toUpperCase()===r.parent.trueValue?t="1":t.toUpperCase()===r.parent.falseValue&&(t="0"),r.parent.isCellReference(e)&&t.indexOf(r.parent.tic)>-1?a[zn.Value]:(2===(t=r.parent.removeTics(t)).split("%").length&&r.parent.isNumber(t.split("%")[0])&&(t=(Number(t.split("%")[0])/100).toString()),t))},o=s(n[0]);if(a.indexOf(o)>0)return o;if(o=Number(o),isNaN(o)||o<1)return a[zn.Value];o=o.toString();var l,d,h,p=s(n[1]);if(a.indexOf(p)>0)return p;if(p=Number(p),isNaN(p)||p<1)return a[zn.Value];if(p=p.toString(),(0,e.isNullOrUndefined)(n[2])||""===n[2].trim())l="1";else{if(l=s(n[2]),a.indexOf(l)>0)return l;if(l=Number(l),isNaN(l)||l<1||l>4)return a[zn.Value];l=l.toString()}if((0,e.isNullOrUndefined)(n[3])||""===n[3].trim())d="1";else{if(d=s(n[3]),a.indexOf(d)>0)return d;d.toUpperCase()===this.parent.trueValue||Number(d)>1?d="1":""!==d&&d.toUpperCase()!==this.parent.falseValue||(d="0")}if("1"===d)"1"===l?t="$"+Ao(parseInt(p,10))+"$"+parseInt(o,10):"2"===l?t=Ao(parseInt(p,10))+"$"+parseInt(o,10):"3"===l?t="$"+Ao(parseInt(p,10))+parseInt(o,10):"4"===l&&(t=Ao(parseInt(p,10))+parseInt(o,10));else{if("0"!==d)return a[zn.Name];"1"===l?t="R"+parseInt(o,10)+"C"+parseInt(p,10):"2"===l?t="R"+parseInt(o,10)+"C["+parseInt(p,10)+"]":"3"===l?t="R["+parseInt(o,10)+"]C"+parseInt(p,10):"4"===l&&(t="R["+parseInt(o,10)+"]C["+parseInt(p,10)+"]")}return!(0,e.isNullOrUndefined)(n[4])&&""!==n[4]&&(h=this.parent.getValueFromArg(n[4]).split(this.parent.tic).join(""),a.indexOf(h)>0)?h:((0,e.isNullOrUndefined)(h)||(t=h+"!"+t),t)},t.prototype.ComputeTIME=function(){for(var t,r,n,i,a=[],s=0;s<arguments.length;s++)a[s]=arguments[s];if((0,e.isNullOrUndefined)(a)||3!==a.length)return this.parent.formulaErrorStrings[_n.InvalidArguments];if(a[0].indexOf(this.parent.tic)>-1&&""===a[0].split(this.parent.tic).join("").trim())return this.parent.getErrorStrings()[zn.Value];if(a[1].indexOf(this.parent.tic)>-1&&""===a[1].split(this.parent.tic).join("").trim())return this.parent.getErrorStrings()[zn.Value];if(a[2].indexOf(this.parent.tic)>-1&&""===a[2].split(this.parent.tic).join("").trim())return this.parent.getErrorStrings()[zn.Value];if(this.parent.isCellReference(a[0])){if((r=this.parent.getValueFromArg(a[0].split(this.parent.tic).join(""))||"0").indexOf(this.parent.tic)>-1)return this.parent.getErrorStrings()[zn.Value]}else{if(a[0].indexOf(this.parent.tic)>-1&&(a[0].split(this.parent.tic).join("")===this.parent.trueValue||a[0].split(this.parent.tic).join("")===this.parent.falseValue))return this.parent.getErrorStrings()[zn.Value];r=this.parent.getValueFromArg(a[0]).split(this.parent.tic).join("")||"0"}if(this.parent.getErrorStrings().indexOf(r)>-1)return r;if(isNaN(this.parent.parseFloat(r))&&r!==this.parent.trueValue&&r!==this.parent.falseValue)return this.parent.getErrorStrings()[zn.Value];if(this.parent.isCellReference(a[1])){if((n=this.parent.getValueFromArg(a[1].split(this.parent.tic).join(""))||"0").indexOf(this.parent.tic)>-1)return this.parent.getErrorStrings()[zn.Value]}else{if(a[1].indexOf(this.parent.tic)>-1&&(a[1].split(this.parent.tic).join("")===this.parent.trueValue||a[1].split(this.parent.tic).join("")===this.parent.falseValue))return this.parent.getErrorStrings()[zn.Value];n=this.parent.getValueFromArg(a[1]).split(this.parent.tic).join("")||"0"}if(this.parent.getErrorStrings().indexOf(n)>-1)return n;if(isNaN(this.parent.parseFloat(n))&&n!==this.parent.trueValue&&n!==this.parent.falseValue)return this.parent.getErrorStrings()[zn.Value];if(this.parent.isCellReference(a[2])){if((i=this.parent.getValueFromArg(a[2].split(this.parent.tic).join(""))||"0").indexOf(this.parent.tic)>-1)return this.parent.getErrorStrings()[zn.Value]}else{if(a[2].indexOf(this.parent.tic)>-1&&(a[2].split(this.parent.tic).join("")===this.parent.trueValue||a[2].split(this.parent.tic).join("")===this.parent.falseValue))return this.parent.getErrorStrings()[zn.Value];i=this.parent.getValueFromArg(a[2]).split(this.parent.tic).join("")||"0"}if(this.parent.getErrorStrings().indexOf(i)>-1)return i;if(isNaN(this.parent.parseFloat(i))&&i!==this.parent.trueValue&&i!==this.parent.falseValue)return this.parent.getErrorStrings()[zn.Value];if(r=r===this.parent.trueValue?"1":r===this.parent.falseValue?"0":r,n=n===this.parent.trueValue?"1":n===this.parent.falseValue?"0":n,i=i===this.parent.trueValue?"1":i===this.parent.falseValue?"0":i,r=parseInt(this.parent.parseFloat(r).toString(),10),n=parseInt(this.parent.parseFloat(n).toString(),10),i=parseInt(this.parent.parseFloat(i).toString(),10),isNaN(r)||isNaN(n)||isNaN(i))return this.parent.getErrorStrings()[zn.Value];if(r>32767||n>32767||i>32767)return this.parent.getErrorStrings()[zn.Num];var o=new Date(1900,0,1,r,n,i);if(o.getFullYear()<1900)return this.parent.getErrorStrings()[zn.Num];var l=o.getHours(),d=o.getMinutes(),h=o.getSeconds(),p="AM",c=l;c>=12&&(c=l-12,p="PM"),0===c&&(c=12);var u={value:(t=(c=c<10?"0"+c:c)+":"+(d=d<10?"0"+d:d)+":"+(h=h<10?"0"+h:h)+" "+p).toString()};return this.parent.parentObject.notify(ue,u),u.isTime&&(t=u.updatedVal),t},t.prototype.ComputeCHAR=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=this.parent.getErrorStrings();if((0,e.isNullOrUndefined)(t)||""===t[0])return this.parent.formulaErrorStrings[_n.InvalidArguments];if(1!==t.length)return this.parent.formulaErrorStrings[_n.WrongNumberArguments];var i=this.parent.getValueFromArg(t[0]).trim();if(n.indexOf(i)>-1)return i;if(i.indexOf('"TRUE"')>-1||this.parent.isCellReference(t[0])&&i.startsWith(this.parent.tic))return n[zn.Value];if(i=i.split(this.parent.tic).join(""),this.parent.isNumber(i)?i=Math.floor(Number(i)).toString():i.indexOf("%")>-1?i=Math.floor(Number(i.split("%")[0])/100).toString():i===this.parent.trueValue&&(i="1"),!i.toUpperCase().match(/^[0-9]+$/))return n[zn.Value];var a=parseInt(i,10);return a>255||a<=0?n[zn.Value]:String.fromCharCode(a)},t.prototype.ComputeCODE=function(){for(var t,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var i=this.parent.getErrorStrings();return(0,e.isNullOrUndefined)(r)||1===r.length&&""===r[0].trim()?this.parent.formulaErrorStrings[_n.InvalidArguments]:r.length>1?this.parent.formulaErrorStrings[_n.WrongNumberArguments]:(t=this.parent.getValueFromArg(r[0]).trim(),i.indexOf(t)>-1?t:(r[0].indexOf(this.parent.tic)>-1?t=r[0]!==t&&r[0].startsWith("n")?this.parent.removeTics(t.trim()):this.parent.removeTics(r[0].trim()):!r[0].startsWith("n")&&2===t.split("%").length&&this.parent.isNumber(t.split("%")[0])&&(t=(Number(t.split("%")[0])/100).toString()),""===t?i[zn.Value]:t=t.charCodeAt(0)))},t.prototype.ComputeDOLLAR=function(){for(var t,r,n,i=[],a=0;a<arguments.length;a++)i[a]=arguments[a];if(i.length&&"nestedFormulaTrue"===i[i.length-1]&&(n=!0,i.pop()),1===i.length&&(""===i[0]&&(r=!0),i.push("2")),(0,e.isNullOrUndefined)(i)||2!==i.length||r)return this.parent.formulaErrorStrings[_n.InvalidArguments];for(var s=0;s<i.length;s++)if(i[s].indexOf(this.parent.tic)>-1&&isNaN(this.parent.parseFloat(i[s])))return this.parent.getErrorStrings()[zn.Value];var o=this.parent.getValueFromArg(i[0]).split(this.parent.tic).join(""),l=this.parent.getValueFromArg(i[1]).split(this.parent.tic).join("");if(o=""===o||o===this.parent.falseValue?"0":o===this.parent.trueValue?"1":o,l=""===l||l===this.parent.falseValue?"0":l===this.parent.trueValue?"1":l,"#NAME?"===o||"#NAME?"===l)return this.parent.getErrorStrings()[zn.Name];if(!o.toUpperCase().match(/^[-]?[0-9.]+$/)||!l.toUpperCase().match(/^[-]?[0-9.]+$/))return this.parent.getErrorStrings()[zn.Value];for(var d=new e.Internationalization,h=parseInt(l,10),p=Math.pow(10,-1*h),c="",u=1;u<=h;u++)c+="0";var f=Math.round(this.parent.parseFloat(o)/p)*p;return t=isNaN(f)?this.parent.getErrorStrings()[zn.Value]:d.formatNumber(f,{format:"$#,##0."+c+";($#,##0."+c+");$0."+c}),n&&(t=this.parent.tic+t+this.parent.tic),t},t.prototype.ComputeSMALL=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=this.parent.getErrorStrings();if((0,e.isNullOrUndefined)(t)||1===t.length||""===t[0])return""===t[0]&&""===t[1]?n[zn.Num]:this.parent.formulaErrorStrings[_n.InvalidArguments];if(t.length>2)return this.parent.formulaErrorStrings[_n.WrongNumberArguments];var i,a=[],s=[],o=[];if(!(0,e.isNullOrUndefined)(t[0])){var l=void 0;if(this.parent.isCellReference(t[0])){a=this.parent.getCellCollection(t[0]);for(var d=0;d<a.length;d++){if(l=this.parent.getValueFromArg(a[d]),n.indexOf(l)>-1)return l;s.push(l)}}else{if(l=this.parent.getValueFromArg(t[0]).split(this.parent.tic).join(""),n.indexOf(l)>-1)return l;s.push(l)}for(d=0;d<s.length;d++)""===s[d]||isNaN(this.parent.parseFloat(s[d]))||o.push(this.parent.parseFloat(s[d]));if(0===o.length&&((0,e.isNullOrUndefined)(s[0])||t[0].indexOf(this.parent.tic)>-1))return n[zn.Value]}if(o=o.sort((function(e,t){return e-t})),!(0,e.isNullOrUndefined)(t[1])){if(this.parent.isCellReference(t[1])){if(""===(i=this.parent.getValueFromArg(t[1])))return n[zn.Num];if(""===i.trim())return n[zn.Value];i.toUpperCase()===this.parent.trueValue?i="1":i.toUpperCase()===this.parent.falseValue&&(i="0")}else i=this.parent.getValueFromArg(t[1]).split(this.parent.tic).join("");if(n.indexOf(i)>-1)return i;if(""===i.trim())return t[1].length>0?n[zn.Value]:n[zn.Num];if(isNaN(this.parent.parseFloat(i)))if(t[1].toUpperCase()===this.parent.trueValue)i="1";else{if(t[1].toUpperCase()!==this.parent.falseValue)return n[zn.Value];i="0"}}var h=Number(i)<1?0:Math.floor(Number(i));return(0,e.isNullOrUndefined)(o[h-1])&&!isNaN(Number(h))?n[zn.Num]:o[h-1]},t.prototype.ComputeLARGE=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=this.parent.getErrorStrings();if((0,e.isNullOrUndefined)(t)||1===t.length||""===t[0])return""===t[0]&&""===t[1]?n[zn.Num]:this.parent.formulaErrorStrings[_n.InvalidArguments];if(t.length>2)return this.parent.formulaErrorStrings[_n.WrongNumberArguments];var i,a=[],s=[],o=[];if(!(0,e.isNullOrUndefined)(t[0])){var l=void 0;if(this.parent.isCellReference(t[0])){a=this.parent.getCellCollection(t[0]);for(var d=0;d<a.length;d++){if(l=this.parent.getValueFromArg(a[d]),n.indexOf(l)>-1)return l;s.push(l)}}else{if(l=this.parent.getValueFromArg(t[0]).split(this.parent.tic).join(""),n.indexOf(l)>-1)return l;s.push(l)}for(d=0;d<s.length;d++)""===s[d]||isNaN(this.parent.parseFloat(s[d]))||o.push(this.parent.parseFloat(s[d]));if(0===o.length&&((0,e.isNullOrUndefined)(s[0])||t[0].indexOf(this.parent.tic)>-1))return n[zn.Value]}if(o=o.sort((function(e,t){return t-e})),!(0,e.isNullOrUndefined)(t[1])){if(this.parent.isCellReference(t[1])){if(""===(i=this.parent.getValueFromArg(t[1])))return n[zn.Num];if(""===i.trim())return n[zn.Value];i.toUpperCase()===this.parent.trueValue?i="1":i.toUpperCase()===this.parent.falseValue&&(i="0")}else i=this.parent.getValueFromArg(t[1]).split(this.parent.tic).join("");if(n.indexOf(i)>-1)return i;if(""===i.trim())return t[1].length>0?n[zn.Value]:n[zn.Num];if(isNaN(this.parent.parseFloat(i)))if(t[1].toUpperCase()===this.parent.trueValue)i="1";else{if(t[1].toUpperCase()!==this.parent.falseValue)return n[zn.Value];i="0"}}var h=Number(i)<1?0:Math.ceil(Number(i));return(0,e.isNullOrUndefined)(o[h-1])&&!isNaN(Number(h))?n[zn.Num]:o[h-1]},t.prototype.ComputeCHOOSE=function(){for(var t=this,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];if((0,e.isNullOrUndefined)(r)||""===r[0]&&1===r.length)return this.parent.formulaErrorStrings[_n.InvalidArguments];if(r.length<2)return this.parent.formulaErrorStrings[_n.WrongNumberArguments];var i,a,s=this.parent.getErrorStrings();if(a=r[0],(a=t.parent.getValueFromArg(a)).toUpperCase()===t.parent.trueValue?a="1":a.toUpperCase()===t.parent.falseValue&&(a="0"),i=a,s.indexOf(i)>-1)return i;if(this.parent.isCellReference(r[0])){if(r[0].indexOf(":")>-1)return s[zn.Value]}else 2===(i=this.parent.removeTics(i)).split("%").length&&this.parent.isNumber(i.split("%")[0])&&(i=(.01*Number(i.split("%")[0])).toString());return(i=Math.floor(this.parent.parseFloat(i)))<1||isNaN(i)||(0,e.isNullOrUndefined)(r[i])?s[zn.Value]:(""===(i=r[i])&&(i="0"),this.parent.isCellReference(i)?i.indexOf(":")>-1?s[zn.Value]:this.parent.getValueFromArg(i):(i.indexOf(this.parent.tic)>-1&&(s.indexOf(i.split(this.parent.tic).join(""))>-1||this.parent.removeTics(i).match(/^(\d*\.\d+|\d+)\s*[-*/]\s*(\d*\.\d+|\d+)$/))&&(i=this.parent.removeTics(i)),(i=this.parent.removeTics(this.parent.getValueFromArg(i))).indexOf(this.parent.tic+this.parent.tic)>-1?i.replace(/""/g,this.parent.tic):(2===i.split("%").length&&this.parent.isNumber(i.split("%")[0])&&(i=(.01*Number(i.split("%")[0])).toString()),i)))},t.prototype.ComputeSUMIF=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=e;if(r[0].indexOf(":")<0&&!this.parent.isCellReference(r[0])||r[2]&&r[2].indexOf(":")<0&&!this.parent.isCellReference(r[2]))return this.parent.formulaErrorStrings[_n.ImproperFormula];if(r.length>3||r.length<2)return this.parent.formulaErrorStrings[_n.WrongNumberArguments];var n=this.parent.computeSumIfAndAvgIf(e,!1);return"string"==typeof n&&(this.parent.formulaErrorStrings.indexOf(n)||this.parent.getErrorStrings().indexOf(n))?n:n[0]},t.prototype.ComputeABS=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r,n=e,i="";if(0===e.length||e.length>1)return this.parent.formulaErrorStrings[_n.WrongNumberArguments];if(""===n[0])return this.parent.formulaErrorStrings[_n.InvalidArguments];var a=n[0].split(this.parent.tic).join("").trim();if(""===a||n[0].indexOf(this.parent.tic)>-1&&isNaN(this.parent.parseFloat(a)))return this.parent.getErrorStrings()[zn.Value];if(this.parent.isCellReference(n[0])){if(i=this.parent.getValueFromArg(n[0]),this.parent.getErrorStrings().indexOf(i)>-1)return this.parent.getErrorStrings()[zn.Value];if(i===this.parent.trueValue&&(i="1"),""!==i&&i!==this.parent.falseValue||(i="0"),r=this.parent.parseFloat(i),isNaN(r)&&!this.parent.isNumber(i))return this.parent.getErrorStrings()[zn.Value]}else{if((i=this.parent.getValueFromArg(n[0]).split(this.parent.tic).join())===this.parent.trueValue&&(i="1"),i===this.parent.falseValue&&(i="0"),this.parent.getErrorStrings().indexOf(i)>-1)return i;if(r=this.parent.parseFloat(i),isNaN(r)&&!this.parent.isNumber(i))return this.parent.getErrorStrings()[zn.Value]}return Math.abs(r)},t.prototype.ComputeAVERAGE=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=!1;if(t.length&&"isSubtotal"===t[t.length-1]&&(n=!0,t.pop()),(0,e.isNullOrUndefined)(t)||1===t.length&&""===t[0])return this.parent.formulaErrorStrings[_n.InvalidArguments];for(var i=t,a=0;a<i.length;a++)if(i[a].indexOf(":")>-1&&i[a].indexOf(this.parent.tic)>-1)return this.parent.getErrorStrings()[zn.Value];return this.parent.calculateAvg(i,n)},t.prototype.ComputeAVERAGEIF=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=e;if(r[0].indexOf(":")<0&&!this.parent.isCellReference(r[0]))return this.parent.formulaErrorStrings[_n.ImproperFormula];var n=this.parent.computeSumIfAndAvgIf(e,!0);return 0===n[1]||"NaN"===n[0].toString()?this.parent.formulaErrorStrings[_n.Div]:"string"==typeof n&&(this.parent.formulaErrorStrings.indexOf(n)||this.parent.getErrorStrings().indexOf(n))?n:this.parent.parseFloat(n[0])/this.parent.parseFloat(n[1])},t.prototype.ComputeCONCATENATE=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=this.parent.getErrorStrings();if((0,e.isNullOrUndefined)(t)||1===t.length&&""===t[0])return this.parent.formulaErrorStrings[_n.InvalidArguments];for(var i=t,a="",s="",o=0;o<i.length;o++){var l=i[o];if(this.parent.isCellReference(l)){if(l.indexOf(":")>-1){if(!this.isConcat)return n[zn.Value];for(var d=this.parent.getCellCollection(l),h=0;h<d.length;h++){a+=this.parent.getValueFromArg(d[h])}}else{if(1===i.length&&i[0].indexOf(this.parent.tic)<0&&!Fr(i[0]))return n[zn.Name];s=this.parent.getValueFromArg(l)}if(n.indexOf(s)>-1)return s}else if(l.startsWith(this.parent.tic)&&l.endsWith(this.parent.tic)&&l.indexOf('""')>-1?s=(s=l.substring(1,l.length-1)).replace(/""/g,'"'):(s=l.split(this.parent.tic).join(""),(this.parent.isNumber(s)||(0,e.isNullOrUndefined)(this.parent.isDate(s))||l.startsWith(" n"))&&(s=this.parent.getValueFromArg(l).split(this.parent.tic).join(""))),n.indexOf(s)>-1)return s;a+=s}return this.isConcat=!1,a},t.prototype.ComputeCONCAT=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this.isConcat=!0,this.ComputeCONCATENATE.apply(this,e)},t.prototype.ComputeMAX=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this.parent.computeMinMax(e,"max")},t.prototype.ComputeMIN=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this.parent.computeMinMax(e,"min")},t.prototype.ComputeRAND=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return 1===e.length&&""===e[0]&&(e.length=0),e.length>0?this.parent.formulaErrorStrings[_n.WrongNumberArguments]:Math.random().toString()},t.prototype.ComputeAND=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=t;return(0,e.isNullOrUndefined)(t)||1===n.length&&""===n[0]?this.parent.formulaErrorStrings[_n.InvalidArguments]:this.parent.computeAndOrNot(n,"and")},t.prototype.ComputeOR=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=t;return(0,e.isNullOrUndefined)(t)||1===n.length&&""===n[0]?this.parent.formulaErrorStrings[_n.InvalidArguments]:this.parent.computeAndOrNot(n,"or")},t.prototype.ComputeNOT=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=t;return(0,e.isNullOrUndefined)(t)||t.length>1||""===t[0]?this.parent.formulaErrorStrings[_n.WrongNumberArguments]:this.parent.computeAndOrNot(n,"not")},t.prototype.ComputeFIND=function(){for(var t=this,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var i=this.parent.getErrorStrings();if((0,e.isNullOrUndefined)(r)||1===r.length)return this.parent.formulaErrorStrings[_n.InvalidArguments];if(r.length>3)return this.parent.formulaErrorStrings[_n.WrongNumberArguments];var a,s,o=function(e){var r=t.parent.getValueFromArg(e);return i.indexOf(r)>-1||t.parent.isCellReference(e)||(2===r.split("%").length&&t.parent.isNumber(r.split("%")[0])?r=(.01*Number(r.split("%")[0])).toString():e.indexOf(t.parent.tic)>-1&&(t.parent.removeTics(e).match(/^(\d*\.\d+|\d+)\s*[-*/]\s*(\d*\.\d+|\d+)$/)?r=t.parent.getValueFromArg(t.parent.removeTics(e)):r.indexOf(t.parent.tic+t.parent.tic)>-1&&(r=r.replace(/""/g,t.parent.tic)))),r};if(!(0,e.isNullOrUndefined)(r[0])){if(a=o(r[0]),i.indexOf(a)>-1)return a;this.parent.isCellReference(r[0])||(a=this.parent.removeTics(a))}if(!(0,e.isNullOrUndefined)(r[1])){if(s=o(r[1]),i.indexOf(s)>-1)return s;this.parent.isCellReference(r[1])||(s=this.parent.removeTics(s))}var l=1;if(!(0,e.isNullOrUndefined)(r[2])){if(l=o(r[2]),i.indexOf(l)>-1)return l;if(l.toUpperCase()===this.parent.trueValue?l="1":l.toUpperCase()===this.parent.falseValue&&(l="0"),this.parent.isCellReference(r[2])||(l=this.parent.removeTics(l)),l=this.parent.parseFloat(l),isNaN(l)||l<=0)return i[zn.Value]}return(l=s.indexOf(a,l-1))<0?i[zn.Value]:(Number(l)+Number(1)).toString()},t.prototype.ComputeINDEX=function(){for(var t,r,n=this,i=[],a=0;a<arguments.length;a++)i[a]=arguments[a];var s,o,l=this.parent.getErrorStrings();if(i.length&&"nestedFormulaTrue"===i[i.length-1]&&(t=!0,i.pop()),(0,e.isNullOrUndefined)(i)||1===i.length&&""===i[0])return this.parent.formulaErrorStrings[_n.InvalidArguments];if(i.length<2||i.length>4)return this.parent.formulaErrorStrings[_n.WrongNumberArguments];if(""===i[0])return l[zn.Value];if(-1===i[0].indexOf(":"))return l[zn.Ref];var d=function(t){if((0,e.isNullOrUndefined)(t)||""===t)return 1;var r=n.parent.getValueFromArg(t);return l.indexOf(r)>-1?r:(r.toUpperCase()===n.parent.trueValue?r="1":r.toUpperCase()===n.parent.falseValue&&(r="0"),r.indexOf(n.parent.tic)>-1&&(r=n.parent.removeTics(r),-1===t.indexOf(n.parent.tic)||""===r.trim())?l[zn.Value]:(2===r.split("%").length&&n.parent.isNumber(r.split("%")[0])&&(r=(Number(r.split("%")[0])/100).toString()),r=parseInt(Number(r).toString(),10),isNaN(r)||r<0?l[zn.Value]:(0===r&&(r=1),r)))};if(r=i[0],s=d(i[1]),l.indexOf(s.toString())>-1)return s.toString();if(o=d(i[2]),l.indexOf(o.toString())>-1)return o.toString();var h=r.indexOf(":"),p=this.parent.rowIndex(r.substring(0,h)),c=this.parent.rowIndex(r.substring(h+1)),u=this.parent.colIndex(r.substring(0,h)),f=this.parent.colIndex(r.substring(h+1));return s>c-p+1||o>f-u+1?l[zn.Ref]:(s=p+s-1,o=u+o-1,""===(r=this.parent.getValueFromArg(this.getSheetReference(r)+this.parent.convertAlpha(o)+s))?0:t&&-1===l.indexOf(r)&&!this.parent.isNumber(r)&&r!==this.parent.trueValue&&r!==this.parent.falseValue?this.parent.tic+r+this.parent.tic:r)},t.prototype.getSheetReference=function(e){return 0===e.indexOf(this.parent.sheetToken)&&e.lastIndexOf(this.parent.sheetToken)>e.indexOf(this.parent.sheetToken)?e.substring(0,e.lastIndexOf(this.parent.sheetToken)+1):""},t.prototype.ComputeIFS=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=t;if((0,e.isNullOrUndefined)(t)||1===n.length&&""===n[0]||n.length%2!=0)return this.parent.formulaErrorStrings[_n.WrongNumberArguments];for(var i="",a="",s=0;s<n.length;s++){if(i=this.parent.getValueFromArg(n[s]),""===n[s])return this.parent.getErrorStrings()[zn.NA];if(this.parent.getErrorStrings().indexOf(i)>-1)return i;if(i!==this.parent.trueValue&&i!==this.parent.falseValue)return this.parent.getErrorStrings()[zn.Value];if(i===this.parent.trueValue)return this.parent.isCellReference(n[s+1].split(this.parent.tic).join(""))||n[s+1].includes(this.parent.arithMarker)?a=""===(a=this.parent.getValueFromArg(n[s+1]))?"0":a:(a=""===n[s+1]?"0":this.parent.getValueFromArg(n[s+1])).indexOf(this.parent.tic)>-1&&(a=a.split(this.parent.tic).join("")),s+=1,a;i===this.parent.falseValue&&(s+=1)}return this.parent.getErrorStrings()[zn.NA]},t.prototype.ComputeCOUNTA=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=!1;if(t.length&&"isSubtotal"===t[t.length-1]&&(n=!0,t.pop()),(0,e.isNullOrUndefined)(t)||1===t.length&&""===t[0])return this.parent.formulaErrorStrings[_n.WrongNumberArguments];for(var i,a,s,o=t,l=0,d=0;d<o.length;d++)if(this.parent.isCellReference(o[d]))if(o[d].indexOf(":")>-1){i=this.parent.getCellCollection(o[d].split(this.parent.tic).join(""));for(var h=0;h<i.length;h++)a=n?this.parent.getValueFromArg(i[h],null,null,!0):this.parent.getValueFromArg(i[h]),n&&a.includes("SUBTOTAL(")||a.length>0&&l++}else{if(a=n?this.parent.getValueFromArg(o[d],null,null,!0):this.parent.getValueFromArg(o[d]),n&&a.includes("SUBTOTAL("))continue;a.length>0&&l++}else((s=this.parent.getValueFromArg(o[d]).split(this.parent.tic).join("")).length>0||0===s.length&&""===s.trim())&&l++;return l},t.prototype.ComputeAVERAGEA=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];if((0,e.isNullOrUndefined)(t)||1===t.length&&""===t[0])return this.parent.formulaErrorStrings[_n.WrongNumberArguments];for(var n,i,a,s,o=t,l=0,d=0,h=0;h<o.length;h++)if(this.parent.isCellReference(o[h]))if(o[h].indexOf(":")>-1){n=this.parent.getCellCollection(o[h].split(this.parent.tic).join(""));for(var p=0;p<n.length;p++){if(i=this.parent.getValueFromArg(n[p]),i=this.processLogicalCellValue(i),this.parent.getErrorStrings().indexOf(i)>-1)return i;(0,e.isNullOrUndefined)(i)||""===i||(s=this.parent.parseFloat(i),l+=i=isNaN(s)?0:s,d+=1)}}else{if(i=this.parent.getValueFromArg(o[h]),i=this.processLogicalCellValue(i),this.parent.getErrorStrings().indexOf(i)>-1)return i;if((0,e.isNullOrUndefined)(i)||""===i)continue;s=this.parent.parseFloat(i),l+=i=isNaN(s)?0:s,d+=1}else{if(o[h].indexOf(this.parent.tic)>-1&&(isNaN(this.parent.parseFloat(o[h].split(this.parent.tic).join("")))||""===o[h].split(this.parent.tic).join("").trim()))return this.parent.getErrorStrings()[zn.Value];if(o[h]=this.processLogicalCellValue(o[h]),a=this.parent.getValueFromArg(o[h].split(this.parent.tic).join("")),this.parent.getErrorStrings().indexOf(a)>-1)return a;l+=this.parent.parseFloat(a),d+=1}return 0===d?this.parent.getErrorStrings()[zn.DivZero]:l/d},t.prototype.processLogicalCellValue=function(e){var t=e;return t.toUpperCase()===this.parent.trueValue?t="1":t.toUpperCase()===this.parent.falseValue&&(t="0"),t},t.prototype.ComputeSORT=function(){for(var t,r,n=this,i=[],a=0;a<arguments.length;a++)i[a]=arguments[a];i.length&&"nestedFormulaTrue"===i[i.length-1]&&(t=!0,i.pop());var s,o,l=i,d=[];if((0,e.isNullOrUndefined)(i)||""===i[0]||l.length>4)return this.parent.formulaErrorStrings[_n.WrongNumberArguments];l[1]=l[1]?l[1]:"1",l[2]=l[2]?l[2]:"1",l[3]=l[3]?l[3]:"FALSE",l[0]=l[0].split("$").join("");var h=[];if(l[0].indexOf(":")>-1){var p=l[0].split(":");if(this.parent.isCellReference(p[0])&&this.parent.isCellReference(p[1])){var c=l[0].indexOf(":"),u=void 0,f=this.parent.rowIndex(this.parent.substring(l[0],0,c)),g=this.parent.colIndex(this.parent.substring(l[0],0,c)),m=this.parent.rowIndex(this.parent.substring(l[0],c+1,c+l[0].length-c-1)),v=this.parent.colIndex(this.parent.substring(l[0],c+1,c+l[0].length-c-1));if(f>m&&(u=m,m=f,f=u),g>v&&(u=v,v=g,g=u),this.parent.isCellReference(l[3])){if(l[3]=this.parent.getValueFromArg(l[3]).toUpperCase(),l[3]!==this.parent.trueValue&&l[3]!==this.parent.falseValue)if(rn(l[3]))l[3]=0===Number(l[3])?this.parent.falseValue:this.parent.trueValue;else{if(""!==l[3])return this.parent.getErrorStrings()[zn.Value];l[3]=this.parent.falseValue}}else if(r=l[3].startsWith(this.parent.tic)&&l[3].endsWith(this.parent.tic),l[3]=this.parent.getValueFromArg(l[3]),l[3]=rn(l[3])?0===Number(l[3])?this.parent.falseValue:this.parent.trueValue:l[3].split(this.parent.tic).join("").toUpperCase(),l[3]!==this.parent.trueValue&&l[3]!==this.parent.falseValue)return this.parent.getErrorStrings()[r?zn.Value:zn.Name];if(this.parent.isCellReference(l[2])?(l[2]=this.parent.getValueFromArg(l[2]),l[2]=l[2]===this.parent.trueValue?"1":l[2]):(l[2]=this.parent.getValueFromArg(l[2]),l[2]=l[2]===this.parent.trueValue?"1":l[2].split(this.parent.tic).join("")),l[2]=rn(l[2])?Math.floor(Number(l[2])).toString():l[2],"1"!==l[2]&&"-1"!==l[2])return this.parent.getErrorStrings().indexOf(l[2])>-1?this.parent.getErrorStrings()[zn.Name]:this.parent.getErrorStrings()[zn.Value];var y="1"===l[2]?"Ascending":"Descending";if(this.parent.isCellReference(l[1])){if(l[1]=this.parent.getValueFromArg(l[1]),l[1]=rn(l[1])?Math.floor(Number(l[1])).toString():l[1]===this.parent.trueValue?"1":l[1]===this.parent.falseValue?"0":l[1],isNaN(this.parseDouble(l[1]))||(this.parseDouble(l[1])<1||(l[3]===this.parent.trueValue?m-f+1<this.parseDouble(l[1]):v-g+1<this.parseDouble(l[1]))))return this.parent.getErrorStrings()[zn.Value]}else if(r=l[1].startsWith(this.parent.tic)&&l[1].endsWith(this.parent.tic),l[1]=this.parent.getValueFromArg(l[1]),l[1]=rn(l[1])?Math.floor(Number(l[1])).toString():l[1]===this.parent.trueValue?"1":l[1]===this.parent.falseValue?"0":l[1].split(this.parent.tic).join(""),isNaN(this.parseDouble(l[1]))?r:this.parseDouble(l[1])<1||(l[3]===this.parent.trueValue?m-f+1<this.parseDouble(l[1]):v-g+1<this.parseDouble(l[1])))return this.parent.getErrorStrings()[zn.Value];var C="";0===l[0].indexOf("!")&&(C=(C=(C=l[0]).replace("!","")).indexOf("!"),C=l[0].substring(0,C+2)),l[0]=C+Ao(g)+f+":"+Ao(v)+m,o=this.parent.getCellCollection(l[0]);for(var b=0;b<o.length;b++)h.push(this.parent.getValueFromArg(o[b]));var x=[],S=[],w=[],I=[],E=[],N=v-g+1,R=function(e){e?"TRUE"===e.toUpperCase()||"FALSE"===e.toUpperCase()?(I.push(e),x.push(e)):isNaN(n.parseDouble(e))?(w.push(e),x.push(e)):(S.push(n.parseDouble(e)),x.push(n.parseDouble(e))):""===e&&(E.push(n.parseDouble(e).toString()),x.push(n.parseDouble(e).toString()))};if("TRUE"===l[3])for(b=0;b<N;b++)R(h[b+(this.parseDouble(l[1])-1)*N]);if("FALSE"===l[3])for(b=0;b<h.length;b++)R(h[b*N+this.parseDouble(l[1])-1]);for(var O=S.length>0?br.DataUtil.sort(S,null,br.DataUtil.fnSort(y)):[],k=w.length>0?br.DataUtil.sort(w,null,br.DataUtil.fnSort(y)):[],A=I.length>0?br.DataUtil.sort(I,null,br.DataUtil.fnSort(y)):[],F="Ascending"===y?O.concat(k,A,E):A.concat(k,O,E),T=[],D=0;D<F.length;D++)for(var L=0;L<x.length;L++)JSON.stringify(F[D])===JSON.stringify(x[L])&&-1===T.indexOf(L)&&T.push(L);if("TRUE"===l[3]){for(var P=f,M=0;P<=m;P++,M++){D=0;for(var B=0;D<T.length;D++,B++){var H=this.parent.getValueFromArg(C+Ao(T[D]+g)+P);if(t&&""!==H)d.push(H);else{H=""===H?"0":H,j=(j=this.parent.actCell).indexOf("!")>-1?j.substring(j.lastIndexOf("!")+1):j;var U=this.parent.rowIndex(j),V=this.parent.colIndex(j);this.parent.parentObject.setValueRowCol(this.parent.getSheetID(this.parent.grid)+1,H,U+M,V+B)}}}s=this.parent.getValueFromArg(C+Ao(T[0]+g)+f)}if("FALSE"===l[3]){for(D=0,M=0;D<T.length;D++,M++){var z=g;for(B=0;z<=v;z++,B++){var _=this.parent.getValueFromArg(C+Ao(z)+(T[D]+f));if(t&&""!==_)d.push(_);else{var j;_=""===_?"0":_,j=(j=this.parent.actCell).indexOf("!")>-1?j.substring(j.lastIndexOf("!")+1):j;V=this.parent.colIndex(j),U=this.parent.rowIndex(j);this.parent.parentObject.setValueRowCol(this.parent.getSheetID(this.parent.grid)+1,_,U+M,V+B)}}}s=this.parent.getValueFromArg(C+Ao(g)+(T[0]+f))}}}return t?d.join(","):""===s?"0":s},t.prototype.ComputeCOUNTIF=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n,i=t;if((0,e.isNullOrUndefined)(t)||""===t[0]||2!==i.length)return this.parent.formulaErrorStrings[_n.WrongNumberArguments];if(i[0].indexOf(":")<0&&!this.parent.isCellReference(i[0]))return this.parent.getErrorStrings()[zn.Name];var a,s=0,o=[],l="equal";if(""===i[1])return 0;var d=i[1].startsWith(this.parent.tic)&&i[1].endsWith(this.parent.tic),h=i[1].split(this.parent.tic).join(""),p=h.includes("*"),c="*"===h||"<>*"===h,u=p&&!c?h.replace(/\*/g,"").trim():h,f=!1;if(!d&&this.parent.isCellReference(u)&&(u=this.parent.getValueFromArg(u),f=!0),p&&!c){var g=h.indexOf("*");"*"===h[0]&&(u="*"+u),"*"===h[h.length-1]&&(u+="*"),g>0&&g<h.length-1&&(u=h.substring(0,g)+"*"+h.substring(g+1))}(h=u).startsWith("<=")?(l="lessEq",h=h.substring(2)):h.startsWith(">=")?(l="greaterEq",h=h.substring(2)):h.startsWith("<>")?(l="notEq",h=h.substring(2)):h.startsWith("<")?(l="less",h=h.substring(1)):h.startsWith(">")?(l="greater",h=h.substring(1)):h.startsWith("=")&&(l="equal",h=h.substring(1));var m=h.indexOf("*")>-1||h.indexOf("?")>-1;if((!d&&this.parent.isCellReference(h)&&!f||h.includes(this.parent.arithMarker)||h.includes(this.parent.getParseDecimalSeparator())&&!m)&&(h=this.parent.getValueFromArg(h)),i[0].indexOf(":")>-1&&this.parent.isCellReference(i[0])){n=this.parent.getCellCollection(i[0].split(this.parent.tic).join(""));for(var v=0;v<n.length;v++)a=this.parent.getValueFromArg(n[v]),m&&(a=this.parent.findWildCardValue(h.toLowerCase(),a.toLowerCase())),o.push(a),o.push(h),this.parent.processLogical(o,l)===this.parent.trueValue&&s++}return s},t.prototype.ComputeSUMIFS=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this.calculateIFS(e)},t.prototype.calculateIFS=function(t,r){var n=this;if((0,e.isNullOrUndefined)(t)||""===t[0]||t.length<2||t.length>127)return this.parent.formulaErrorStrings[_n.WrongNumberArguments];if(3===t.length&&t[2].includes(this.parent.tic+this.parent.tic)){var i,a="",s=this.parent.getParseArgumentSeparator();return t[2].split(this.parent.tic+this.parent.tic).forEach((function(e){(e=e.trim().split(n.parent.tic).join(""))&&(i=n.parent.computeIfsFormulas([t[0],t[1],e],n.parent.falseValue,r).toString(),a+=(a?s:"")+i)})),a}return this.parent.computeIfsFormulas(t,this.parent.falseValue,r)},t.prototype.ComputeTEXT=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=t.length,i=t[0],a=t[1];if(2!==n)return this.parent.formulaErrorStrings[_n.WrongNumberArguments];var s=i,o=a;if(""===a)return this.parent.getValueFromArg(s);var l=new Date(1900,0,1,0,0,0),d=s+","+o,h=new e.Internationalization;if(this.parent.getErrorStrings().indexOf(d)>-1)return d;if(rn((s=this.parent.getValueFromArg(s)).split(this.parent.tic).join(""))&&(s=s.split(this.parent.tic).join("")),""===(o=a.startsWith('"')&&a.endsWith('"')?o.split(this.parent.tic).join(""):this.parent.getValueFromArg(o)))return"";""===s&&(o.length>0&&(o.toUpperCase().indexOf("M")>-1||o.toUpperCase().indexOf("D")>-1||o.toUpperCase().indexOf("Y")>-1||o.toUpperCase().indexOf("S")>-1||o.toUpperCase().indexOf("T")>-1)||o.toUpperCase().indexOf("H")>-1)&&(s=l.toString());var p=this.parseDouble(s);if(isNaN(p)&&null!==this.parent.isDate(new Date(s))&&(p=this.parent.toOADate(new Date(s))),l=Date.parse(s.split(this.parent.tic).join("")),!isNaN(p)||!isNaN(l))if(o.length>0&&-1===o.indexOf("#")&&(o.toUpperCase().indexOf("M")>-1||o.toUpperCase().indexOf("D")>-1||o.toUpperCase().indexOf("Y")>-1||o.toUpperCase().indexOf("S")>-1||o.toUpperCase().indexOf("T")>-1)||o.toUpperCase().indexOf("H")>-1){var c=(o=(o=o.split("Y").join("y").split("D").join("d").split("H").join("h")).split("S").join("s").split("m").join("M").split("AM/PM").join("tt")).split(""),u=!1,f=!1,g=0,m=0,v=0;for(g=0;g<c.length;){var y=c[g];"s"===y&&"M"===c[m]&&(c[m]="m","M"===c[m-1]&&(c[m-1]="m")),this.parent.isChar(y)?(m=g,"M"===y&&v++):v>1&&v++,"M"===y&&u&&(c[g]="m",f=!0),"h"===y?u=!0:this.parent.isChar(y)&&"M"!==y&&"h"!==y&&!f&&(u=!1,f=!1),g++}o=(o=String(c)).split(",").join("").split("\n").join(" ");var C=this.parent.fromOADate(p);0===p&&(C=l);var b=mo(o);if(""===b){var x=en(C);return this.parent.parentObject.getDisplayText({format:o,value:x})}s=h.getDateFormat({skeleton:b,type:"date"})(new Date(C.toString()))}else s=this.parent.parentObject.getDisplayText({format:o,value:p});return s},t.prototype.ComputeCOUNTIFS=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this.parent.computeIfsFormulas(e,this.parent.trueValue)},t.prototype.ComputeAVERAGEIFS=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this.calculateIFS(e,this.parent.trueValue)},t.prototype.ComputeMATCH=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=t.slice(),i=this.parent.getErrorStrings();if((0,e.isNullOrUndefined)(n)||1===n.length&&""===n[0])return this.parent.formulaErrorStrings[_n.InvalidArguments];if(n.length<2||n.length>3)return this.parent.formulaErrorStrings[_n.WrongNumberArguments];n[0]=this.parent.getValueFromArg(t[0]);var a,s=n[0].indexOf(this.parent.tic)>-1;if(n[0]=n[0].split(this.parent.tic).join(""),i.indexOf(n[0])>-1)return n[0];if(""===n[0])return i[zn.NA];if(isNaN(Number(n[0]))&&(s=!0),(0,e.isNullOrUndefined)(t[2]))n[2]="1";else{if(n[2]=this.parent.getValueFromArg(n[2]),n[2].indexOf(this.parent.tic)>-1&&isNaN(Number(n[2].split(this.parent.tic).join(""))))return i[zn.Value];n[2].toUpperCase()===this.parent.trueValue?n[2]="1":n[2].toUpperCase()===this.parent.falseValue&&(n[2]="0")}a=parseFloat(n[2]),-1===[-1,0,1].indexOf(a)&&(a=0);var o,l=[],d=!1;if(n[1].indexOf(":")>-1||this.parent.isCellReference(n[1])){o=this.parent.getCellCollection(n[1]);for(var h=0;h<o.length;h++){var p=this.parent.getValueFromArg(o[h]);(p.indexOf(this.parent.tic)>-1||isNaN(Number(p)))&&(d=!0),l[h]=p.split(this.parent.tic).join("")}if(s&&!d||!s&&d)return i[zn.NA]}for(var c=0,u="",f=!1,g=isNaN(Number(n[0]))?n[0]:Number(n[0]),m=0;m<l.length;m++)if(""!==l[m]){if(-1===a&&(s||d))break;var v=isNaN(Number(l[m]))?l[m]:Number(l[m]);if(1===a)g===v?(c=m+1,f=!0,isNaN(Number(n[0]))&&(s=!1)):g>v&&!s&&!f&&(!u||v>(isNaN(Number(u))?u:Number(u)))&&(c=m+1,u=l[m]);else if(0===a){if((n[0].indexOf("*")>-1||n[0].indexOf("?")>-1)&&(l[m]=this.parent.findWildCardValue(n[0],l[m])),n[0]===l[m])return m+1}else if(-1===a){if(!(Number(l[m])>Number(l[m+1])||m===l.length-1))return i[zn.NA];g===v?(c=m+1,g=void 0):g<v&&(!u||v<(isNaN(Number(u))?u:Number(u)))&&(c=m+1,u=l[m])}}else m===l.length-1&&l.pop();return s&&d&&1===a?l.length:c||i[zn.NA]},t.prototype.ComputeLOOKUP=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=t;return(0,e.isNullOrUndefined)(n)||1===n.length&&""===n[0]?this.parent.formulaErrorStrings[_n.WrongNumberArguments]:this.parent.computeLookup(n)},t.prototype.ComputeVLOOKUP=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=e;return this.parent.computeVHLookup(r,!0)},t.prototype.ComputeHLOOKUP=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=e;return this.parent.computeVHLookup(r)},t.prototype.ComputeSUBTOTAL=function(){for(var t,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var i=this.parent.getErrorStrings();if((0,e.isNullOrUndefined)(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[_n.InvalidArguments];if(r.length<2)return this.parent.formulaErrorStrings[_n.WrongNumberArguments];if(t=this.parent.getValueFromArg(r[0]).trim(),i.indexOf(t)>-1)return t;if(""===t.split(this.parent.tic).join("").trim())return i[zn.Value];if(this.parent.isCellReference(r[0])||(t=this.parent.removeTics(t)),t.toUpperCase()===this.parent.trueValue?t="1":t.toUpperCase()===this.parent.falseValue?t="0":2===t.split("%").length&&this.parent.isNumber(t.split("%")[0])&&(t=(Number(t.split("%")[0])/100).toString()),t=this.parent.parseFloat(t),isNaN(t)||(1>t||t>11)&&(101>t||t>111))return i[zn.Value];var a=r.slice(1,r.length);switch(t){case 1:case 101:t=this.ComputeAVERAGE.apply(this,a.concat(["isSubtotal"]));break;case 2:case 102:t=this.ComputeCOUNT.apply(this,a.concat(["isSubtotal"]));break;case 3:case 103:t=this.ComputeCOUNTA.apply(this,a.concat(["isSubtotal"]));break;case 4:case 104:t=this.ComputeMAX.apply(this,a.concat(["isSubtotal"]));break;case 5:case 105:t=this.ComputeMIN.apply(this,a.concat(["isSubtotal"]));break;case 6:case 106:t=this.ComputePRODUCT.apply(this,a.concat(["isSubtotal"]));break;case 7:case 107:t=this.ComputeDAY.apply(this,a);break;case 8:case 108:t=this.ComputeCONCAT.apply(this,a);break;case 9:case 109:t=this.ComputeSUM.apply(this,a.concat(["isSubtotal"]));break;case 10:case 110:t=this.ComputeAVERAGEA.apply(this,a);break;case 11:case 111:t=this.ComputeABS.apply(this,a);break;default:t=i[zn.Value]}return t},t.prototype.ComputeRADIANS=function(){for(var t,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var i=this.parent.getErrorStrings();return(0,e.isNullOrUndefined)(r)||""===r[0]&&1===r.length||2===r[0].split("!").length&&-1===r[0].indexOf(this.parent.tic)?this.parent.formulaErrorStrings[_n.InvalidArguments]:r.length>1?this.parent.formulaErrorStrings[_n.WrongNumberArguments]:r[0].indexOf(":")>-1||""===r[0].split(this.parent.tic).join("").trim()||"!"===r[0].split(this.parent.tic).join("").trim()||2===r[0].split("!").length?i[zn.Value]:(t=this.parent.getValueFromArg(r[0]).trim(),i.indexOf(t)>-1?t:t.indexOf(this.parent.tic)>-1&&-1===r[0].indexOf(this.parent.tic)||t.split(this.parent.tic).length>3?i[zn.Value]:(t.toUpperCase()===this.parent.trueValue?t="1":t.toUpperCase()===this.parent.falseValue?t="0":2===t.split("%").length&&this.parent.isNumber(t.split("%")[0])&&(t=(Number(t.split("%")[0])/100).toString()),t=this.parent.parseFloat(t.split(this.parent.tic).join("")),isNaN(t)?this.parent.isCellReference(r[0])||r[0].indexOf(this.parent.tic)>-1?i[zn.Value]:i[zn.Name]:t=Math.PI*t/180))},t.prototype.ComputeRANDBETWEEN=function(){for(var e,t,r=this,n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];if(1===n.length&&""===n[0])return this.parent.formulaErrorStrings[_n.InvalidArguments];if(2!==n.length)return this.parent.formulaErrorStrings[_n.WrongNumberArguments];var a=this.parent.getErrorStrings(),s=function(e){var t;if(t=r.parent.getValueFromArg(e),a.indexOf(t)>-1)return t;if(r.parent.isCellReference(e)){if(""===t)t="0";else if(e.indexOf(":")>-1||t.match(/^(\d*\.\d+|\d+)\s*[+\-*/]\s*(\d*\.\d+|\d+)$/))return a[zn.Value]}else{if(""===t)return a[zn.NA];if(e.indexOf(r.parent.tic)>-1&&r.parent.removeTics(e).match(/^(\d*\.\d+|\d+)\s*[+*]\s*(\d*\.\d+|\d+)$/))return a[zn.Value];if(t.indexOf(r.parent.tic)>-1&&(t=r.parent.removeTics(t)).indexOf(":")>-1){var n=t.split(":");if(!(n.length<=3))return a[zn.Value];if(!r.parent.isNumber(n[0])||!r.parent.isNumber(n[1]))return a[zn.Value];var i=Number(n[0])+Number(Number(n[1])/60);if(3===n.length){if(!r.parent.isNumber(n[2]))return a[zn.Value];i+=Number(Number(n[2])/3600)}t=(i/24).toString()}2===t.split("%").length&&r.parent.isNumber(t.split("%")[0])&&(t=(.01*Number(t.split("%")[0])).toString())}return t=parseFloat(t),isNaN(t)?a[zn.Value]:t};return t=s(n[1]),a.indexOf(t)>-1?t:(e=s(n[0]),a.indexOf(e)>-1?e:0===e&&0===t?"0":t<e?a[zn.Num]:(e=Math.ceil(e),t=Math.floor(t),Math.floor(Math.random()*(t-e+1)+e)))},t.prototype.ComputeSLOPE=function(){for(var t=this,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var i=this.parent.getErrorStrings();if((0,e.isNullOrUndefined)(r)||1===r.length&&""===r[0].trim())return this.parent.formulaErrorStrings[_n.InvalidArguments];if(2!==r.length)return this.parent.formulaErrorStrings[_n.WrongNumberArguments];if(""===r[0]||""===r[1])return i[zn.Value];var a=function(e){return e=-1===e.indexOf(t.parent.tic)?t.parent.getCellCollection(e.split(t.parent.tic).join("")):void 0},s=a(r[0].trim()),o=a(r[1].trim());if((0,e.isNullOrUndefined)(s)||(0,e.isNullOrUndefined)(o)||s.length<2&&o.length<2)return i[zn.DivZero];if(s.length!==o.length)return i[zn.NA];var l=function(e){e=t.getDataCollection(e);for(var r=0;r<e.length;r++)if(i.indexOf(e[r])>-1)return e[r].toString();return e};if(s=l(s),i.indexOf(s.toString())>-1)return s.toString();if(o=l(o),i.indexOf(o.toString())>-1)return o.toString();for(var d=0,h=0,p=0,c=0,u=0,f=0,g=o.length;f<g;++f)""!==o[f]&&"NaN"!==Number(o[f]).toString()&&""!==s[f]&&"NaN"!==Number(s[f]).toString()&&(d+=Number(o[f])*Number(s[f]),p+=Number(o[f]),c+=Number(s[f]),h+=Number(o[f])*Number(o[f]),u++);var m=((d-p*c/u)/(h-p*p/u)).toString();return"NaN"===m?i[zn.DivZero]:m},t.prototype.ComputeINTERCEPT=function(){for(var t=this,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var i=this.parent.getErrorStrings();if((0,e.isNullOrUndefined)(r)||1===r.length&&""===r[0].trim())return this.parent.formulaErrorStrings[_n.InvalidArguments];if(2!==r.length)return this.parent.formulaErrorStrings[_n.WrongNumberArguments];if(""===r[0]||""===r[1])return i[zn.Value];var a=function(e){return e=-1===e.indexOf(t.parent.tic)?t.parent.getCellCollection(e.split(t.parent.tic).join("")):void 0},s=a(r[0].trim()),o=a(r[1].trim());if((0,e.isNullOrUndefined)(s)||(0,e.isNullOrUndefined)(o)||s.length<2&&o.length<2)return i[zn.DivZero];if(s.length!==o.length)return i[zn.NA];var l=function(e){e=t.getDataCollection(e);for(var r=0;r<e.length;r++)if(i.indexOf(e[r])>-1)return e[r];return e};if(s=l(s),i.indexOf(s.toString())>-1)return s.toString();if(o=l(o),i.indexOf(o.toString())>-1)return o.toString();var d,h=0,p=0,c=0,u=0,f=0,g=function(e){for(var t=0,r=o.length;t<r;++t)""!==s[t]&&"NaN"!==Number(s[t]).toString()&&""!==o[t]&&"NaN"!==Number(o[t]).toString()&&(e?(h+=Number(s[t]),p+=Number(o[t]),c++):(d=Number(o[t])-p,u+=d*(Number(s[t])-h),f+=d*d))};g(!0),h/=c,p/=c,g(!1);var m=(h-u/f*p).toString();return"NaN"===m?i[zn.DivZero]:m},t.prototype.ComputeLN=function(){for(var t,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var i=this.parent.getErrorStrings();return(0,e.isNullOrUndefined)(r)||""===r[0]&&1===r.length?this.parent.formulaErrorStrings[_n.InvalidArguments]:0===r.length||r.length>1?this.parent.formulaErrorStrings[_n.WrongNumberArguments]:(t=this.parent.getValueFromArg(r[0]),i.indexOf(t)>-1?t:(t.toUpperCase()===this.parent.trueValue?t="1":t.toUpperCase()===this.parent.falseValue&&(t="0"),this.parent.isCellReference(r[0])||""!==(t=this.parent.removeTics(t)).trim()?(2===t.split("%").length&&this.parent.isNumber(t.split("%")[0])&&(t=(.01*Number(t.split("%")[0])).toString()),(t=this.parent.parseFloat(t))<=0?i[zn.Num]:isNaN(t)?i[zn.Value]:Math.log(t)):i[zn.Value]))},t.prototype.ComputeISNUMBER=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=e;if(1===e.length&&""===e[0])return this.parent.formulaErrorStrings[_n.InvalidArguments];if(1!==e.length)return this.parent.formulaErrorStrings[_n.WrongNumberArguments];var n=this.parent.isCellReference(r[0])?this.parent.getValueFromArg(r[0]):this.parent.getValueFromArg(r[0].split(this.parent.tic).join(""));if(""===n.toString()||e.toString().startsWith(this.parent.tic))return!1;var i=this.parent.parseFloat(n);return!isNaN(i)},t.prototype.ComputeROUND=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(!e.length||1===e.length||e.length>2)return this.parent.formulaErrorStrings[_n.WrongNumberArguments];var r=e;if(1===e.length){var n="TRUE"===r[0].split(this.parent.tic).join("")?"1":"FALSE"===r[0].split(this.parent.tic).join("")?"0":r[0];return isNaN(this.parent.parseFloat(n))?this.parent.formulaErrorStrings[_n.InvalidArguments]:Math.round(this.parent.parseFloat(n)).toString()}var i=this.parent.getValueFromArg(r[0]);if(this.parent.getErrorStrings().indexOf(i)>-1)return i;var a=this.parent.getValueFromArg(r[1]);if(this.parent.getErrorStrings().indexOf(a)>-1)return a;a="TRUE"===a?"1":"FALSE"===a?"0":a,i=(i="TRUE"===i?"1":"FALSE"===i?"0":i).split(this.parent.tic).join(""),a=a.split(this.parent.tic).join("");var s=isNaN(Number(i))||""===i.trim(),o=isNaN(Number(a))||""===a.trim();if((r[0].indexOf('"')>-1||this.parent.isCellReference(r[0]))&&s||(r[1].indexOf('"')>-1||this.parent.isCellReference(r[1]))&&o)return this.parent.getErrorStrings()[zn.Value];if(""===i&&""===a||""===i)return 0;var l,d=this.parent.parseFloat(i),h=this.parent.parseFloat(a);if(!isNaN(h)&&!isNaN(d)&&h>0)l=this.parent.parseFloat(this.preciseRound(d,h,"ROUND"));else{var p=Math.pow(10,-h);l=Math.round(d/p)*p}return l.toString()},t.prototype.preciseRound=function(e,t,r){var n=Math.pow(10,t),i=Math.abs(e)*n;return((e>=0?1:-1)*(("ROUND"===r?Math.round(i):"ROUNDDOWN"===r?Math.floor(i):Math.ceil(i))/n)).toFixed(t)},t.prototype.ComputePOWER=function(){for(var t,r=this,n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];var a=this.parent.getErrorStrings();if((0,e.isNullOrUndefined)(n)||1===n.length&&""===n[0].trim())return this.parent.formulaErrorStrings[_n.InvalidArguments];if(n.length>2)return this.parent.formulaErrorStrings[_n.WrongNumberArguments];if(""===n[0].trim()&&""===n[1].trim())return a[zn.Num];var s=function(e){var t=r.parent.getValueFromArg(e);if(a.indexOf(t)>-1)return t;if(t.toUpperCase()===r.parent.trueValue?t="1":t.toUpperCase()===r.parent.falseValue&&(t="0"),t.indexOf(r.parent.tic)>-1&&(t=r.parent.removeTics(t),-1===e.indexOf(r.parent.tic)||""===t.trim()))return a[zn.Value];if(2===t.split("%").length&&r.parent.isNumber(t.split("%")[0]))t=(Number(t.split("%")[0])/100).toString();else if(t.indexOf("/")>-1&&r.parent.isNumber(t.split("/").join("")))return a[zn.Num];return t=r.parent.parseFloat(t),isNaN(t)?a[zn.Value]:t},o=s(n[0]);if(a.indexOf(o)>-1)return o;var l=s(n[1]);return a.indexOf(l)>-1?l:isNaN(o)||isNaN(l)?a[zn.Value]:0===o&&l<0?a[zn.DivZero]:0===o&&0===l?a[zn.Num]:(t=Math.pow(o,l),isNaN(t)||t===1/0?a[zn.Num]:t.toString())},t.prototype.ComputeSQRT=function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=t[0];if(0===t.length||t.length>1||""===n)return this.parent.formulaErrorStrings[_n.WrongNumberArguments];if(""===n.split(this.parent.tic).join("").trim())return this.parent.getErrorStrings()[zn.Value];if(this.parent.isCellReference(n)){if((e=this.parent.getValueFromArg(n)||"0").indexOf(this.parent.tic)>-1)return this.parent.getErrorStrings()[zn.Value]}else{if(n.indexOf(this.parent.tic)>-1&&(n.split(this.parent.tic).join("")===this.parent.trueValue||n.split(this.parent.tic).join("")===this.parent.falseValue))return this.parent.getErrorStrings()[zn.Value];e=this.parent.getValueFromArg(n).split(this.parent.tic).join("")}if(this.parent.getErrorStrings().indexOf(e)>-1)return e;if(e=e===this.parent.trueValue?"1":e===this.parent.falseValue?"0":e,this.parent.parseFloat(e)<0)return this.parent.getErrorStrings()[zn.Num];if(isNaN(this.parent.parseFloat(e))){var i={value:e};if(this.parent.parentObject.notify(ue,i),!i.isDate&&!i.isTime)return this.parent.getErrorStrings()[zn.Value];e=i.updatedVal}return Math.sqrt(this.parent.parseFloat(e))},t.prototype.ComputeLOG=function(){for(var t,r,n=this,i=[],a=0;a<arguments.length;a++)i[a]=arguments[a];var s=this.parent.getErrorStrings();if((0,e.isNullOrUndefined)(i)||1===i.length&&""===i[0])return this.parent.formulaErrorStrings[_n.InvalidArguments];if(i.length>2)return this.parent.formulaErrorStrings[_n.WrongNumberArguments];var o=function(e){var t=n.parent.getValueFromArg(e);if(t===n.parent.trueValue?t="1":t===n.parent.falseValue&&(t="0"),!n.parent.isCellReference(e)&&""!==t){if(t.indexOf(n.parent.tic)>-1&&-1===s.indexOf(t.split(n.parent.tic).join(""))){if(""===(t=n.parent.removeTics(t)).trim())return s[zn.Value];if(t.indexOf(":")>-1){var r=t.split(":");if(!(r.length<=3))return s[zn.Value];if(!n.parent.isNumber(r[0])||!n.parent.isNumber(r[1]))return s[zn.Value];var i=Number(r[0])+Number(Number(r[1])/60);if(3===r.length){if(!n.parent.isNumber(r[2]))return s[zn.Value];i+=Number(Number(r[2])/3600)}t=(i/24).toString()}}2===t.split("%").length&&n.parent.isNumber(t.split("%")[0])&&(t=(.01*Number(t.split("%")[0])).toString())}return t};if(!(0,e.isNullOrUndefined)(i[0])){if(t=o(i[0]),s.indexOf(t)>-1)return t;t=this.parent.parseFloat(t)}if(r=10,!(0,e.isNullOrUndefined)(i[1])){if(r=o(i[1]),s.indexOf(r)>-1)return r;r=this.parent.parseFloat(r)}return t=Number(t),isNaN(t)||isNaN(r)?s[zn.Value]:t<=0||r<=0?s[zn.Num]:1===r?s[zn.DivZero]:(Math.log(t)/Math.LN10/(Math.log(r)/Math.LN10)).toString()},t.prototype.ComputeTRUNC=function(){for(var t,r=this,n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];var a=0,s=this.parent.getErrorStrings();if((0,e.isNullOrUndefined)(n)||""===n[0]&&1===n.length)return this.parent.formulaErrorStrings[_n.InvalidArguments];if(0===n.length||n.length>2)return this.parent.formulaErrorStrings[_n.WrongNumberArguments];var o=function(e){var t=r.parent.getValueFromArg(e);if(s.indexOf(t)>-1)return t;if(t===r.parent.trueValue)t="1";else if(t===r.parent.falseValue)t="0";else if(!r.parent.isCellReference(e)){if(e.indexOf(r.parent.tic)>-1&&r.parent.removeTics(e).match(/^(\d*\.\d+|\d+)\s*[*]\s*(\d*\.\d+|\d+)$/))t=r.parent.getValueFromArg(r.parent.removeTics(e));else if(t.indexOf(r.parent.tic)>-1){if(""===(t=r.parent.removeTics(t)).trim())return s[zn.Value];if(t.indexOf(":")>-1){var n=t.split(":");if(!(n.length<=3))return s[zn.Value];if(!r.parent.isNumber(n[0])||!r.parent.isNumber(n[1]))return s[zn.Value];var i=Number(n[0])+Number(Number(n[1])/60);if(3===n.length){if(!r.parent.isNumber(n[2]))return s[zn.Value];i+=Number(Number(n[2])/3600)}t=(i/24).toString()}}2===t.split("%").length&&r.parent.isNumber(t.split("%")[0])&&(t=(.01*Number(t.split("%")[0])).toString())}return t};if(!(0,e.isNullOrUndefined)(n[0])){if(t=o(n[0]),s.indexOf(t)>-1)return t;if(t=this.parent.parseFloat(t),isNaN(t))return s[zn.Value]}if(!(0,e.isNullOrUndefined)(n[1])){if(a=o(n[1]),s.indexOf(a)>-1)return a;if(a=this.parent.parseFloat(a),isNaN(a))return s[zn.Value]}return a=Math.pow(10,Math.floor(a)),(((t=Number(t))<0?-1:1)*Math.floor(a*Math.abs(t))/a).toString()},t.prototype.ComputeEXP=function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=this.parent.getErrorStrings();if(""===t[0]&&1===t.length)return this.parent.formulaErrorStrings[_n.InvalidArguments];if(1!==t.length)return this.parent.formulaErrorStrings[_n.WrongNumberArguments];if(""===t[0].split(this.parent.tic).join("").trim())return n[zn.Value];if(e=this.parent.getValueFromArg(t[0]),n.indexOf(e)>-1)return e;if(e.indexOf(this.parent.tic)>-1&&(this.parent.isCellReference(t[0])||isNaN(Number(e.split(this.parent.tic).join("")))))return n[zn.Value];if((e=e.split(this.parent.tic).join(""))===this.parent.trueValue)e="1";else if(e===this.parent.falseValue||""===e)e="0";else if(e.indexOf("%")>-1)e=(Number(e.split("%")[0])/100).toString();else if(e.indexOf(":")>-1)return"0";var i=this.parent.parseFloat(e);return isNaN(i)?n[zn.Value]:i>709?n[zn.Num]:Math.exp(i).toString()},t.prototype.ComputeGEOMEAN=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r,n,i,a,s,o=e,l=1,d=0,h=0,p=0;if(0===e.length)return this.parent.formulaErrorStrings[_n.WrongNumberArguments];if(1===o.length&&""===o[0])return l.toString();for(n=0;n<o.length;n++)if(o[n].indexOf(":")>-1){if(o[0]===this.parent.tic)return this.parent.getErrorStrings()[zn.Value];for(a=this.parent.getCellCollection(o[n].split(this.parent.tic).join("")),i=0;i<a.length;i++){if(s=(p=(h=this.parent.getValueFromArg(a[i])).split(this.parent.tic).join(""))===this.parent.trueValue||p===this.parent.falseValue,(r=this.parent.parseFloat(h))<=0)return this.parent.getErrorStrings()[zn.Num];s||this.parent.getErrorStrings().indexOf(h)>-1||(isNaN(r)||(d++,l*=r))}}else{if(h=this.parent.getValueFromArg(o[n]),this.parent.getErrorStrings().indexOf(h)>-1)return h;var c=h.split(this.parent.tic).join("");if(h.indexOf('"')>-1&&isNaN(this.parent.parseFloat(c)))return this.parent.getErrorStrings()[zn.Value];if(o[n]=o[n].startsWith("n")?o[n].slice(1):o[n],""===h&&""===o[n])return this.parent.getErrorStrings()[zn.Num];if(("TRUE"===c||"FALSE"===c)&&this.parent.isCellReference(o[n]))continue;if(h.length>0){if(h="TRUE"===(h=h.indexOf('"')>-1?c:h).split(this.parent.tic).join("")?"1":"FALSE"===h.split(this.parent.tic).join("")?"0":h,!this.parent.isCellReference(o[n])&&isNaN(this.parent.parseFloat(h)))return this.parent.getErrorStrings()[zn.Value];if((r=this.parent.parseFloat(h))<=0)return this.parent.getErrorStrings()[zn.Num];isNaN(r)||(d++,l*=r)}}return d>0&&(l=Math.pow(l,1/d)),l.toString()},t.prototype.ComputeRSQ=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=0,n=e;if(2!==n.length)return this.parent.formulaErrorStrings[_n.WrongNumberArguments];if(""===n[0]||""===n[1])return this.parent.getErrorStrings()[zn.Value];if(n[0].includes('"')||n[1].includes('"'))return this.parent.getErrorStrings()[zn.NA];if(-1===n[0].indexOf(":")&&Sr(n[0])&&-1===n[1].indexOf(":")&&Sr(n[1]))return this.parent.getErrorStrings()[zn.DivZero];var i=this.parent.getCellCollection(n[0]),a=this.parent.getCellCollection(n[1]);if(i.length!==a.length)return this.parent.getErrorStrings()[zn.NA];for(var s=this.getDataCollection(a),o=0;o<s.length;o++)if(this.parent.getErrorStrings().indexOf(s[o])>-1)return s[o];for(var l,d,h=this.getDataCollection(i),p=0;p<h.length;p++)if(this.parent.getErrorStrings().indexOf(h[p])>-1)return h[p];for(var c=0;c<s.length;c++)l=Number(s[c]),d=Number(h[c]),rn(l)&&rn(d)&&r++;if(r<=1)return this.parent.getErrorStrings()[zn.DivZero];if(2===r)return 1;var u=this.getMeanArray(s,h),f=u[0],g=u[1],m=this.getCorrelation(s,h,f,g);return Math.pow(m,2)},t.prototype.getCorrelation=function(e,t,r,n){for(var i,a,s=0,o=0,l=0,d=0;d<e.length;d++)rn(e[d])&&rn(t[d])&&(s+=(a=Number(e[d])-r)*(i=Number(t[d])-n),o+=Math.pow(a,2),l+=Math.pow(i,2));return s/Math.sqrt(o*l)},t.prototype.getMeanArray=function(e,t){for(var r=0,n=0,i=0,a=0;a<e.length;a++)rn(e[a])&&rn(t[a])&&(n+=Number(e[a]),i+=Number(t[a]),r++);return[n/r,i/r]},t.prototype.getDataCollection=function(e){for(var t=[],r=0,n=e.length;r<n;r++)t.push(this.parent.getValueFromArg(e[r]));return t},t.prototype.parseDouble=function(e){var t=this.parent.parseFloat(e.toString());return isNaN(t)?NaN:t},t.prototype.spreadsheetDisplayText=function(e){if(this.parent.parentObject&&this.parent.parentObject.element&&this.parent.parentObject.element.classList.contains("e-spreadsheet")&&this.parent.isCellReference(e)){var t=this.parent.parentObject.getIndexes(e);e=this.parent.parentObject.getDisplayText(this.parent.parentObject.getActiveSheet().rows[t.startIdx].cells[t.endIdx])}return e},t.prototype.spreadsheetFormat=function(e){if(this.parent.parentObject&&this.parent.parentObject.element&&this.parent.parentObject.element.classList.contains("e-spreadsheet")&&this.parent.isCellReference(e)){var t=this.parent.parentObject.getIndexes(e);e=this.parent.parentObject.getActiveSheet().rows[t.startIdx].cells[t.endIdx].format}return e},t.prototype.getModuleName=function(){return"basic-formulas"},t}(),wo=function(){function t(e){this.emptyStr="",this.storedStringText=this.emptyStr,this.sheetToken="!",this.tokenAdd="a",this.tokenSubtract="s",this.tokenMultiply="m",this.tokenDivide="d",this.tokenLess="l",this.charEm="r",this.charEp="x",this.tokenGreater="g",this.tokenEqual="e",this.tokenLessEq="k",this.tokenGreaterEq="j",this.tokenNotEqual="o",this.tokenAnd="c",this.tokenEm="v",this.tokenEp="t",this.tokenOr=String.fromCharCode(126),this.charAnd="i",this.charLess="<",this.charGreater=">",this.charEqual="=",this.charLessEq="f",this.charGreaterEq="h",this.charNoEqual="z",this.stringGreaterEq=">=",this.stringLessEq="<=",this.stringNoEqual="<>",this.stringAnd="&",this.stringOr="^",this.charOr="w",this.charAdd="+",this.charSubtract="-",this.charMultiply="*",this.charDivide="/",this.fixedReference="$",this.spaceString=" ",this.ignoreBracet=!1,this.isError=!1,this.isFormulaParsed=!1,this.findNamedRange=!1,this.stringsColl=new Map,this.tokens=[this.tokenAdd,this.tokenSubtract,this.tokenMultiply,this.tokenDivide,this.tokenLess,this.tokenGreater,this.tokenEqual,this.tokenLessEq,this.tokenGreaterEq,this.tokenNotEqual,this.tokenAnd,this.tokenOr],this.charNOTop=String.fromCharCode(167),this.specialSym=["~","@","#","?"],this.isFailureTriggered=!1,this.parent=e}return t.prototype.parse=function(t,r){var n=this;if(this.parent.isTextEmpty(t))return t;if(vo(t))return this.parent.getErrorStrings()[zn.Ref];this.parent.getFormulaCharacter()!==String.fromCharCode(0)&&this.parent.getFormulaCharacter()===t[0]&&(t=t.substring(1)),(this.parent.namedRanges.size>0||this.parent.storedData.size>0)&&(t=this.checkForNamedRangeAndKeyValue(t),this.findNamedRange=!1),t=(t=t.replace(/[-+*/&^]+/g,(function(e){for(var t="";1<e.length;)switch(e.substring(0,2)){case"++":case"--":e="+"+e.substring(2);break;case"+-":case"-+":e="-"+e.substring(2);break;case"*+":e="*"+e.substring(2);break;case"/+":e="/"+e.substring(2);break;case"^+":e="^"+e.substring(2);break;case"&+":e="&"+e.substring(2);break;case"*-":case"/-":case"^-":case"&-":t=e.substring(0,1),e=e.substring(1);break;default:throw new Ro(n.parent.formulaErrorStrings[_n.InvalidExpression],!0)}return t+e}))).split("-(-").join("(");var i=this.storeStrings(t);t=this.storedStringText;var a=0;if((0,e.isNullOrUndefined)(i)&&(t=t.split(" ").join("")),(t=(t=t.split("=>").join(">=")).split("=<").join("<="))[t.length-1]===this.parent.arithMarker&&this.indexOfAny(t,this.tokens)===t.length-2||(t=t.toUpperCase()),t.indexOf(this.sheetToken)>-1){var s=this.parent.getSheetFamilyItem(this.parent.grid);if(null!=s.sheetNameToParentObject&&s.sheetNameToParentObject.size>0){t[0]!==this.sheetToken.toString()&&(t=this.parent.setTokensForSheets(t));var o=this.parent.getSheetToken(t.split(this.parent.tic).join(this.emptyStr)),l=this.checkScopedRange(t.split('"').join(this.emptyStr).split(this.sheetToken).join(""));(0,e.isNullOrUndefined)(o)&&""!==o&&this.parent.namedRanges.size>0&&""!==l&&(t=l)}}t=this.markLibraryFormulas(t);try{t=this.formulaAutoCorrection(t)}catch(e){if(!(p={message:e.message,exception:e,isForceCalculable:e.formulaCorrection,computeForceCalculate:!1}).isForceCalculable)throw this.parent.formulaErrorStrings[_n.InvalidExpression];if(this.isFailureTriggered||(this.parent.trigger("onFailure",p),this.isFailureTriggered=!0),!p.isForceCalculable||!p.computeForceCalculate)throw this.parent.formulaErrorStrings[_n.InvalidExpression];t=this.formulaAutoCorrection(t,p),this.parent.storedData.get(r).formulaText="="+t}if(!this.ignoreBracet)for(a=t.indexOf(")");a>-1;){var d=t.substring(0,a).lastIndexOf("(");if(-1===d)throw new Ro(this.parent.formulaErrorStrings[_n.MismatchedParentheses]);if(d===a-1)throw new Ro(this.parent.formulaErrorStrings[_n.EmptyExpression]);var h=this.emptyStr;h=this.ignoreBracet?this.parent.substring(t,d,a-d+1):this.parent.substring(t,d+1,a-d-1);try{t=t.substring(0,d)+this.parseSimple(h)+t.substring(a+1)}catch(e){if(e===this.parent.formulaErrorStrings[_n.CircularReference])throw e;var p=this.exceptionArgs(e);this.isFailureTriggered||(this.parent.trigger("onFailure",p),this.isFailureTriggered=!0);var c="string"==typeof p.exception?p.exception:p.message;return(this.parent.getErrorLine(e)?"":"#"+this.parent.getErrorLine(e)+": ")+c}a=t.indexOf(")")}if(!this.ignoreBracet&&t.indexOf("(")>-1)throw new Ro(this.parent.formulaErrorStrings[_n.MismatchedParentheses]);return t=this.parseSimple(t),null!==i&&i.size>0&&(t=this.setStrings(t,i)),t},t.prototype.exceptionArgs=function(e){return{message:e.message,exception:e,isForceCalculable:e.formulaCorrection,computeForceCalculate:!1}},t.prototype.formulaAutoCorrection=function(t,r){var n=["*","+","-","/","^","&"],i=[">","=","<"],a=0,s="",o="",l="",d="",h="",p="",c="",u=0;if(this.parent.formulaErrorStrings.indexOf(t)>-1)return t;if(this.indexOfAny(t,this.specialSym)>-1)throw new Ro(this.parent.formulaErrorStrings[_n.InvalidExpression],!1);for(;a<t.length;)if(t=t.split("-*").join("-").split("/*").join("/").split("*/").join("*").split("-/").join("-").split("*+").join("*").split("+*").join("+"),this.parent.isDigit(t[a])&&t.length>a+1&&this.indexOfAny(t[a+1],n)>-1&&t.length>a+2&&!(0,e.isNullOrUndefined)(t[a+2])&&this.indexOfAny(t[a+2],n)>-1&&("-"!==t[a+2]||"*"!==t[a+1]&&"/"!==t[a+1]&&"^"!==t[a+1]&&"&"!==t[a+1])){if(!r||!r.computeForceCalculate)throw this.parent.formulaErrorStrings[_n.ImproperFormula];this.parent.isDigit(t[a])?(u<1?(p=t[a],l=t[a+1],(0,e.isNullOrUndefined)(l)&&(l=this.emptyStr),u+=1,s=s+p+(l="&"===l?"":l)):u<2&&(c=t[a],d=t[a-1],h=t[a+1],u=0,s="-"===d?s+d+c+(h="&"===(h=(0,e.isNullOrUndefined)(h)?this.emptyStr:h)?"":h):s+c+(h=(0,e.isNullOrUndefined)(h)?this.emptyStr:h)),a+=2):(s="-"===t[a]?s+t[a]:s,a+=1)}else if((this.parent.isDigit(t[a])||t[a]===this.parent.rightBracket||this.parent.storedData.has(t[a].toUpperCase()))&&((0,e.isNullOrUndefined)(t[a+1])||this.indexOfAny(t[a+1],n)>-1))o="&"===(o=(0,e.isNullOrUndefined)(t[a+1])?this.emptyStr:t[a+1])&&"-"!==t[a+2]?"":o,s="-"===t[a-1]?s+t[a-1]+t[a]+o:s+t[a]+o,a+=2;else if(this.indexOfAny(t[a],i)>-1&&!(0,e.isNullOrUndefined)(t[a-1])&&!(0,e.isNullOrUndefined)(t[a+1]))s+=t[a],a+=1;else if("q"===t[a])for(;t[a]!==this.parent.leftBracket;)s+=t[a],a+=1;else t[a]===this.parent.leftBracket||t[a]===this.parent.rightBracket||"{"===t[a]||"}"===t[a]||"("===t[a]||")"===t[a]||this.parent.isUpperChar(t[a])||t[a].indexOf(":")>-1||t[a]===this.parent.getParseArgumentSeparator()||"%"===t[a]&&this.parent.isDigit(t[a-1])||t[a]===this.parent.tic||" "===t[a]||t[a]===this.parent.getParseDecimalSeparator()||t[a]===this.sheetToken||"$"===t[a]||"_"===t[a]?(s+=t[a],a+=1):(this.parent.isDigit(t[a])&&(s="-"===t[a-1]?s+t[a-1]+t[a]:s+t[a]),"-"!==t[a]&&"+"!==t[a]||(s=(s+=t[a]).split("++").join("+").split("+-").join("-").split("-+").join("-")),"/"!==t[a]&&"*"!==t[a]&&"^"!==t[a]||(s+=t[a]),a+=1);return s=s===this.emptyStr?t:s,this.indexOfAny(s[s.length-1],n)>-1&&(s=s.substring(0,s.length-1)),s=s.split("--").join("-").split("-+").join("-").split("+-").join("-")},t.prototype.checkScopedRange=function(t){var r=this,n=this.emptyStr,i="NaN",a=this.parent.getSheetID(this.parent.grid),s=this.parent.getSheetFamilyItem(this.parent.grid);if(t[0]===this.sheetToken.toString()){var o=t.indexOf(this.sheetToken,1),l=parseInt(t.substr(1,o-1),10);o>1&&!this.parent.isNaN(l)&&(t=t.substring(o+1),a=l)}var d="!"+a.toString();return null===s||null==s.sheetNameToToken||s.sheetNameToToken.forEach((function(a,o){if(s.sheetNameToToken.get(o).toString()===d+"!"){var l=r.emptyStr;r.parent.namedRanges.forEach((function(a,o){l=(0,e.isNullOrUndefined)(r.parent.parentObject)?s.sheetNameToToken.get(o).toUpperCase():r.parent.parentObject.getActiveSheet().name+r.sheetToken+t.toUpperCase(),r.parent.getNamedRanges().has(l)&&(n=r.parent.getNamedRanges().get(l).toUpperCase(),i=n)}))}})),i},t.prototype.storeStrings=function(e){var t,r=0,n=0,i=0,a="",s=null;if(e.indexOf(this.parent.tic)>-1)for(r=e.indexOf(this.parent.tic);r>-1&&e.length>0;){if(null===s&&(s=this.stringsColl),-1===(n=r+1<e.length?e.indexOf(this.parent.tic,r+1):-1))throw new Ro(this.parent.formulaErrorStrings[_n.MismatchedTics]);t=this.parent.substring(e,r,n-r+1),a=this.parent.tic+this.spaceString+i.toString()+this.parent.tic,s=s.set(a,t),e=e.substring(0,r)+a+e.substring(n+1),(r+=a.length)<=e.length&&(r=e.indexOf(this.parent.tic,r)),i++}return this.storedStringText=e,s},t.prototype.setStrings=function(e,t){for(var r=0;r<t.size;r++)t.forEach((function(t,r){e=e.split(r).join(t)}));return e},t.prototype.parseSimple=function(e){var t=e;if(t.length>0&&"+"===t[0]&&(t=t.substring(1)),"#DIV/0!"===t)return"#DIV/0!";if("#NAME?"===t)return"#NAME?";if(""===t)return t;if(this.parent.formulaErrorStrings.indexOf(t)>-1)return t;t=(t=(t=(t=(t=(t=t.split(this.stringLessEq).join(this.charLessEq)).split(this.stringGreaterEq).join(this.charGreaterEq)).split(this.stringNoEqual).join(this.charNoEqual)).split(this.stringAnd).join(this.charAnd)).split(this.stringOr).join(this.charOr)).split(this.fixedReference).join(this.emptyStr);var r=[this.tokenEp,this.tokenEm],n=[this.tokenMultiply,this.tokenDivide],i=[this.tokenAdd,this.tokenSubtract],a=[this.charMultiply,this.charDivide],s=[this.charAdd,this.charSubtract],o=[this.tokenLess,this.tokenGreater,this.tokenEqual,this.tokenLessEq,this.tokenGreaterEq,this.tokenNotEqual],l=[this.charLess,this.charGreater,this.charEqual,this.charLessEq,this.charGreaterEq,this.charNoEqual],d=[this.charEp,this.charEm],h=[this.tokenAnd],p=[this.charAnd],c=[this.charOr],u=[this.tokenOr];return t=this.parseSimpleOperators(t,r,d),t=this.parseSimpleOperators(t,u,c),t=this.parseSimpleOperators(t,n,a),t=this.parseSimpleOperators(t,i,s),t=this.parseSimpleOperators(t,o,l),t=this.parseSimpleOperators(t,h,p)},t.prototype.parseSimpleOperators=function(t,r,n){if(this.parent.getErrorStrings().indexOf(t)>-1)return t;for(var i=t,a=0,s="",o=0;o<n.length;o++)s+=n[o];if((i=(i=(i=i.split("---").join("-").split("--").join("+").split(this.parent.getParseArgumentSeparator()+"-").join(this.parent.getParseArgumentSeparator()+"u").split(this.parent.leftBracket+"-").join(this.parent.leftBracket+"u").split("=-").join("=u")).split(",+").join(",").split(this.parent.leftBracket+"+").join(this.parent.leftBracket).split("=+").join("=").split(">+").join(">").split("<+").join("<").split("/+").join("/").split("*+").join("*").split("++").join("+").split("*-").join("*u").split("/-").join("/u").split("w-").join("wu").split("i-").join("iu").toString()).split(">-").join(">u").split("<-").join("<u").split("h-").join("hu").split("f-").join("fu").split("z-").join("zu")).length>0&&"-"===i[0])i="0-"+(i=i.substring(1).split("-").join(this.tokenOr)),i=(i=this.parseSimpleOperators(i,[this.tokenSubtract],[this.charSubtract])).split(this.tokenOr).join("-");else if(i.length>0&&i.indexOf("u")>-1){for(var l=i.split(this.parent.getParseArgumentSeparator()),d=0;d<l.length;d++)if(l[d].startsWith("u")){var h=l[d].split("u").join("0-");h=this.parseSimpleOperators(h,[this.tokenSubtract],[this.charSubtract]),l[d]=h}i=l.join(this.parent.getParseArgumentSeparator())}else i.length>0&&"+"===i[0]?i=i.substring(1):i.length>0&&"+"===i[i.length-1]&&(i=i.substring(0,i.length-1));try{if(this.indexOfAny(i,n)>-1){if(i.includes(" ")){for(var p="",c=0;c<i.length;c++){var u=i[c];if(n.indexOf(u)>=0)p=p.trim()+u;else{if(" "===u&&n.indexOf(p[p.length-1])>=0)continue;p+=u}}i=p}a=this.indexOfAny(i,n);for(var f=this.parent.getParseDecimalSeparator();a>-1;){var g="",m="",v=0,y=0,C=!1,b=["*","+","-","/","w","=","<",">"],x=i[a]===this.charNOTop,S=0;if(x)v=a;else if(i[S=a-1]===this.parent.arithMarker){if((I=this.findLeftMarker(i.substring(0,S-1)))<0)throw new Ro(this.parent.formulaErrorStrings[_n.CannotParse]);g=this.parent.substring(i,I+1,S-I-1),v=I+1}else if(i[S]===this.parent.rightBracket){for(var w=0,I=S-1;I>0&&("q"!==i[I]||0!==w);)"q"===i[I]?w--:i[I]===this.parent.rightBracket&&w++,I--;if(I<0)throw new Ro(this.parent.formulaErrorStrings[_n.CannotParse]);g=this.parent.substring(i,I,S-I+1),v=I}else if(i[S]===this.parent.tic[0]){var E=i.substring(0,S-1).lastIndexOf(this.parent.tic);if(E<0)throw new Ro(this.parent.formulaErrorStrings[_n.CannotParse]);g=this.parent.substring(i,E,S-E+1),v=E}else{for(var N=!1;S>-1&&(this.parent.isDigit(i[S])||!N&&(i[S]===f||"%"===i[S]));)this.parent.isDigit(i[S])||"%"===i[S]||(N=!0),S-=1;if(S>-1&&N&&i[S]===f)throw new Ro(this.parent.formulaErrorStrings[_n.NumberContains2DecimalPoints]);if(0===(S+=1)||S>0&&!this.parent.isUpperChar(i[S-1]))g="n"+this.parent.substring(i,S,a-S),v=S;else if(S>0&&"E"===i[S-1]&&("TRUE"===i.substring(S-4,S)&&((0,e.isNullOrUndefined)(i[S-5])||b.indexOf(i[S-5])>-1)||"FALSE"===i.substring(S-5,S)&&((0,e.isNullOrUndefined)(i[S-6])||b.indexOf(i[S-6])>-1))&&("TRUE"===i.substring(S+1,S+5)||"FALSE"===i.substring(S+1,S+6)))S="TRUE"===i.substring(S-4,S)?S-4:S-5,g="TRUE"===i.substring(S,a)?"n1":"FALSE"===i.substring(S,a)?"n0":g,v=S,C=!0;else{for(S-=1;S>-1&&(this.parent.isUpperChar(i[S])||this.parent.isDigit(i[S]));)S-=1;if(S>-1&&i[S]===this.sheetToken){for(S-=1;S>-1&&i[S]!==this.sheetToken;)S-=1;S>-1&&i[S]===this.sheetToken&&(S-=1)}if(S>-1&&":"===i[S]){for(S-=1;S>-1&&this.parent.isDigit(i[S]);)S-=1;for(;S>-1&&this.parent.isUpperChar(i[S]);)S-=1;if(S>-1&&i[S]===this.sheetToken){for(S--;S>-1&&i[S]!==this.sheetToken;)S--;S>-1&&i[S]===this.sheetToken&&S--}S+=1,g=this.parent.substring(i,S,a-S),g=this.parent.getCellFrom(g)}else{var R=!1;S>0&&!this.parent.isUpperChar(i[S])&&(R="u"===i[S]&&i[S-1]===this.parent.getParseArgumentSeparator()),R||(S+=1),g=this.parent.substring(i,S,a-S)}this.parent.updateDependentCell(g),v=S}(this.parent.namedRanges.size>0&&this.parent.namedRanges.has(g.toUpperCase())||this.parent.storedData.has(g.toUpperCase()))&&(g="n"+this.checkForNamedRangeAndKeyValue(g))}if(a===i.length-1)throw new Ro(this.parent.formulaErrorStrings[_n.ExpressionCannotEndWithAnOperator]);if((R="u"===i[S=a+1])&&(S+=1),i[S]===this.parent.tic[0]){if((I=i.substring(S+1).indexOf(this.parent.tic))<0)throw this.parent.formulaErrorStrings[_n.CannotParse];m=this.parent.substring(i,S,I+2),y=I+S+2}else if(i[S]===this.parent.arithMarker){if((I=this.findRightMarker(i.substring(S+1)))<0)throw new Ro(this.parent.formulaErrorStrings[_n.CannotParse]);m=this.parent.substring(i,S+1,I),y=I+S+2}else if("q"===i[S]){for(w=0,I=S+1;I<i.length&&(i[I]!==this.parent.rightBracket||0!==w);)i[I]===this.parent.rightBracket?w++:"q"===i[I]&&w--,I++;if(I===i.length)throw this.parent.formulaErrorStrings[_n.CannotParse];m=this.parent.substring(i,S,I-S+1),R&&(m="u"+m),y=I+1}else if(this.parent.isDigit(i[S])||i[S]===f){N=i[S]===f;for(S+=1;S<i.length&&(this.parent.isDigit(i[S])||!N&&i[S]===f);)i[S]===f&&(N=!0),S+=1;if(S<i.length&&"%"===i[S]&&(S+=1),N&&S<i.length&&i[S]===f)throw this.parent.formulaErrorStrings[_n.NumberContains2DecimalPoints];m="n"+this.parent.substring(i,a+1,S-a-1),y=S}else if(this.parent.isUpperChar(i[S])||i[S]===this.sheetToken||"u"===i[S]){if(i[S]===this.sheetToken)for(S+=1;S<i.length&&i[S]!==this.sheetToken;)S+=1;S+=1;for(var O=0,k=!1;S<i.length&&(this.parent.isUpperChar(i[S])||"_"===i[S]||i[S]===f||"["===i[S]||"]"===i[S]||"#"===i[S]||" "===i[S]||"%"===i[S]||i[S]===f&&k);)S!==i.length-1&&"["===i[S]&&"["===i[S+1]&&(k=!0),S!==i.length-1&&"]"===i[S]&&"]"===i[S+1]&&(k=!1),S++,O++;var A=S===i.length||!this.parent.isDigit(i[S]);if(O>1){for(;S<i.length&&(this.parent.isUpperChar(i[S])||this.parent.isDigit(i[S])||" "===i[S]||"_"===i[S]);)S++;A=!0}for(;S<i.length&&this.parent.isDigit(i[S]);)S+=1;if(S<i.length&&":"===i[S]){if((S+=1)<i.length&&i[S]===this.sheetToken){for(S++;S<i.length&&i[S]!==this.sheetToken;)S+=1;S<i.length&&i[S]===this.sheetToken&&S++}for(;S<i.length&&this.parent.isUpperChar(i[S]);)S+=1;for(;S<i.length&&this.parent.isDigit(i[S]);)S+=1;S-=1,m=this.parent.substring(i,a+1,S-a),m=this.parent.getCellFrom(m)}else S-=1,m=this.parent.substring(i,a+1,S-a),(R="u"===i[S])&&(m="u"+m);A&&m.startsWith(this.sheetToken)&&(A=!this.parent.isCellReference(m)),A||this.parent.updateDependentCell(m),(this.parent.namedRanges.size>0&&this.parent.namedRanges.has(m.toUpperCase())||this.parent.storedData.has(m.toUpperCase()))&&(m="n"+this.checkForNamedRangeAndKeyValue(m));var F=["*","+","-","/","w"].indexOf(i[S-m.length])>-1;m="TRUE"===m&&(C||F)?"n1":"FALSE"===m&&(C||F)?"n0":m,y=S+1}var T=s.indexOf(i[a]),D=this.parent.arithMarker+g+m+r[T]+this.parent.arithMarker;v>0&&(D=i.substring(0,v)+D),y<i.length&&(D+=i.substring(y)),i=D=D.split(this.parent.arithMarker2).join(this.parent.arithMarker.toString()),a=this.indexOfAny(i,n)}}else if(i.length>0&&(this.parent.isUpperChar(i[0])||i[0]===this.sheetToken)){var L=!0,P=!0,M=!1,B=i.length;for(I=0;I<B;++I)if(i[I]===this.sheetToken){if(I>0&&!M)throw this.parent.getErrorStrings()[zn.Ref];for(M=!0,I++;I<B&&this.parent.isDigit(i[I]);)I++;if(I===B||i[I]!==this.sheetToken){L=!1;break}}else{if(!P&&this.parent.isChar(i[I])){L=!1;break}if(!this.parent.isChar(i[I])&&!this.parent.isDigit(i[I])&&i[I]!==this.sheetToken){L=!1;break}P=this.parent.isUpperChar(i[I])}L&&this.parent.updateDependentCell(i)}return i}catch(e){if(e===this.parent.formulaErrorStrings[_n.CircularReference])throw e;return e}},t.prototype.indexOfAny=function(e,t){for(var r=0;r<e.length;r++)if(t.indexOf(e[r])>-1)return r;return-1},t.prototype.findLeftMarker=function(e){var t=-1;if(e.indexOf(this.parent.arithMarker)>-1)for(var r=0,n=e.length-1;n>=0;--n)if(e[n]===this.parent.rightBracket)r--;else if(e[n]===this.parent.leftBracket)r++;else if(e[n]===this.parent.arithMarker&&0===r){t=n;break}return t},t.prototype.findRightMarker=function(e){var t=-1;if(e.indexOf(this.parent.arithMarker)>-1)for(var r=0,n=0;n<e.length;++n)if(e[n]===this.parent.rightBracket)r--;else if(e[n]===this.parent.leftBracket)r++;else if(e[n]===this.parent.arithMarker&&0===r){t=n;break}return t},t.prototype.parseFormula=function(t,r){if(t.length>0&&t[0]===this.parent.getFormulaCharacter()&&(t=t.substring(1)),t.indexOf("#REF!")>-1)return this.parent.getErrorStrings()[zn.Ref];t.length>0&&"+"===t[0]&&(t=t.substring(1));try{this.isFailureTriggered=!1,this.isError=!1,t=this.parse(t.trim(),r),this.isFormulaParsed=!0}catch(r){var n=this.exceptionArgs(r);this.isFailureTriggered||(this.parent.trigger("onFailure",n),this.isFailureTriggered=!0);var i="string"==typeof n.exception?n.exception:n.message;t=((0,e.isNullOrUndefined)(this.parent.getErrorLine(r))?"":"#"+this.parent.getErrorLine(r)+": ")+i,this.isError=!0}return t},t.prototype.markLibraryFormulas=function(t){var r=0,n=t.indexOf(")");if(-1===n)t=this.markNamedRanges(t);else for(;n>-1;){for(var i=0,a=n-1;a>-1&&("("!==t[a]||0!==i);)")"===t[a]&&i++,a--;if(-1===a)throw new Ro(this.parent.formulaErrorStrings[_n.MismatchedParentheses]);for(var s=a-1;s>-1&&this.parent.isChar(t[s]);)s--;var o=a-s-1,l=this.parent.substring(t,s+1,o);if(o>0&&!(0,e.isNullOrUndefined)(this.parent.getFunction(l))){var d=this.parent.substring(t,a,n-a+1),h=this.parent.getParseArgumentSeparator();if("AREAS"===l)this.ignoreBracet=!0;else if(this.ignoreBracet=!1,l.includes("IFS")&&"COUNTIFS"!==l&&d.includes("{")){var p=d.indexOf("{"),c=this.parent.substring(d,p,d.indexOf("}")-p+1);d=d.split(c).join(c.split(h).join(this.parent.tic+this.parent.tic))}try{var u=void 0;d=d.split("(").join("").split(")").join(""),d="("+this.formulaAutoCorrection(d,u)+")"}catch(e){if(!(u={message:e.message,exception:e,isForceCalculable:e.formulaCorrection,computeForceCalculate:!1}).isForceCalculable)throw this.parent.formulaErrorStrings[_n.ImproperFormula];if(this.isFailureTriggered||(this.parent.trigger("onFailure",u),this.isFailureTriggered=!0,r+=1),u.computeForceCalculate=r>0||u.computeForceCalculate,!u.isForceCalculable)throw this.parent.formulaErrorStrings[_n.ImproperFormula];if(!u.computeForceCalculate)throw this.parent.formulaErrorStrings[_n.ImproperFormula];d=d.split("(").join("").split(")").join(""),d="("+this.formulaAutoCorrection(d,u)+")"}d=this.markNamedRanges(d),d=this.swapInnerParens(d),-1===(d=this.addParensToArgs(d)).lastIndexOf(h)&&d.length>2&&"("===d[0]&&")"===d[d.length-1]&&"{"!==d[1]&&"("!==d[1]&&(d=(d=d.substring(0,d.length-1)+"}"+d.substring(d.length-1))[0]+"{"+d.substring(1)),t=t.substring(0,s+1)+"q"+this.parent.substring(t,s+1,o)+d.split("(").join(this.parent.leftBracket).split(")").join(this.parent.rightBracket)+t.substring(n+1)}else{if(o>0)return this.parent.getErrorStrings()[zn.Name];var f=this.emptyStr;a>0&&(f=t.substring(0,a)),f=f+"{"+this.parent.substring(t,a+1,n-a-1)+"}",n<t.length&&(f+=t.substring(n+1)),t=f=this.markNamedRanges(f)}n=t.indexOf(")")}return t=t.split("{").join("(").split("}").join(")")},t.prototype.swapInnerParens=function(e){return e.length>2&&(e=e[0]+e.substr(1,e.length-2).split("(").join("{").split(")").join("}")+e[e.length-1]),e},t.prototype.addParensToArgs=function(e){if(0===e.length)return this.emptyStr;var t=[];t.push(this.parent.getParseArgumentSeparator()),t.push(this.parent.rightBracket);var r=e.lastIndexOf(this.parent.getParseArgumentSeparator()),n=0;if(-1===r){if(e.length>2&&"("===e[0]&&")"===e[e.length-1])if("{"!==e[1]&&"("!==e[1])e=(e=e.substring(0,e.length-1)+"}"+e.substring(e.length-1))[0]+"{"+e.substring(1);else{r=this.lastIndexOfAny(e,["+","-","*","/"]),0===n&&")"===e[e.length-1]&&(n=e.length-1),n>0&&"{"!==e[r+1]&&"}"===e[r-1]&&(e=(e=e.substr(0,n)+"}"+e.substr(n)).substr(0,r+1)+"{"+e.substr(r+1))}}else for(var i=!0;r>-1;){var a=this.indexOfAny(e.substring(r+1,e.length),t);a>=0?a=r+a+1:-1===a&&")"===e[e.length-1]&&(a=e.length-1),a>0&&"{"!==e[r+1]&&"}"!==e[a-1]&&"¢"!==e[a-1]&&(e=(e=e.substr(0,a).trim()+"}"+e.substr(a)).substr(0,r+1)+"{"+e.substr(r+1).trim()),r=e.substr(0,r).lastIndexOf(this.parent.getParseArgumentSeparator()),i&&-1===r&&"("===e[0]&&(r=0,i=!1)}return e=e.split("{}").join(this.emptyStr)},t.prototype.lastIndexOfAny=function(e,t){for(var r=e.length-1;r>-1;r--)if(t.indexOf(e[r])>-1)return r;return-1},t.prototype.markNamedRanges=function(t){var r=[")",this.parent.getParseArgumentSeparator(),"}","+","-","*","/","<",">","=","&",":"],n=t.length>0&&("("===t[0]||"{"===t[0])?1:0;t.indexOf("#N/A")>-1&&(t=t.split("#N/A").join("#N~A")),t.indexOf("#DIV/0!")>-1&&(t=t.split("#DIV/0!").join("#DIV~0!"));for(var i=this.indexOfAny(t.substring(n),r);i>-1&&i+n<t.length;){var a=this.emptyStr,s=null;if(this.parent.substring(t,n,i).indexOf("[")>-1?s=this.getTableRange(this.parent.substring(t,n,i)):(this.parent.storedData.has(this.parent.substring(t,n,i))||this.parent.namedRanges.has(this.parent.substring(t,n,i)))&&(s=this.checkForNamedRangeAndKeyValue(this.parent.substring(t,n,i))),(0,e.isNullOrUndefined)(s)&&("NaN"!==(a=this.checkScopedRange(this.parent.substring(t,n,i)))?(this.findNamedRange=!0,s=a):this.parent.substring(t,n,i).startsWith(this.sheetToken.toString()),!(0,e.isNullOrUndefined)(s)&&this.findNamedRange&&s.indexOf(this.fixedReference)>-1&&(s=s.split(this.fixedReference).join(this.emptyStr))),(0,e.isNullOrUndefined)(s)||(s=s.toUpperCase(),s=this.parent.setTokensForSheets(s),s=this.markLibraryFormulas(s)),(0,e.isNullOrUndefined)(s)||s===this.emptyStr)for(n+=i+1;n<t.length&&!this.parent.isUpperChar(t[n])&&t[n]!==this.sheetToken;)n++;else t=t.substring(0,n)+s+t.substring(n+i),n+=s.length+1;for(i=n,n<t.length-1&&"{"===t[n]&&(n+=1),i=this.indexOfAny(t.substring(n),r);0===i&&n<t.length-1;)n++,i=this.indexOfAny(t.substring(n),r);if((-1===i||t.substring(n).indexOf("[")>-1)&&n<t.length){if(s=t.substring(n).indexOf("[")>-1?this.getTableRange(t.substring(n)):this.parent.storedData.has(t.substring(n))?this.parent.storedData.size>0?this.checkForNamedRangeAndKeyValue(t.substring(n)):s:this.parent.namedRanges.size>0?this.checkForNamedRangeAndKeyValue(t.substring(n)):s,(0,e.isNullOrUndefined)(s)&&"NaN"!==(a=this.checkScopedRange(t.substring(n)))&&(s=a),!(0,e.isNullOrUndefined)(s)&&s!==this.emptyStr&&(s=s.toUpperCase(),s=this.parent.setTokensForSheets(s),null!=(s=this.markLibraryFormulas(s)))){var o=t.substring(n);t=")"===o[o.length-1]?t.substring(0,n)+s+")":t.substring(0,n)+s,n+=s.toString().length+1}i=n<t.length?this.indexOfAny(t.substring(n),r):-1}}return t.indexOf("#N~A")>-1&&(t=t.split("#N~A").join("#N/A")),t.indexOf("#DIV~0!")>-1&&(t=t.split("#DIV~0!").join("#DIV/0!")),t},t.prototype.checkForNamedRangeAndKeyValue=function(t){var r=this.emptyStr;if(t.indexOf("[")>-1){var n=this.getTableRange(t);(0,e.isNullOrUndefined)(n)||(this.findNamedRange=!0,t=n)}if("NaN"!==(r=this.checkScopedRange(t)))this.findNamedRange=!0,t=r;else{if(t.indexOf(this.sheetToken)>-1){var i=this.parent.getSheetFamilyItem(this.parent.grid),a=t.split('"').join(this.emptyStr);if(a=a.substr(0,a.indexOf(this.sheetToken)),i.sheetNameToToken.has(a.toUpperCase()))parseInt(i.sheetNameToToken.get(a.toUpperCase()).split(this.sheetToken).join(this.emptyStr))}this.parent.storedData.size>0&&this.parent.storedData.has(t)&&(t="A"+this.parent.colIndex(t)),this.parent.namedRanges.size>0&&this.parent.namedRanges.has(t.toUpperCase())&&((0,e.isNullOrUndefined)(this.parent.parentObject)?(t=this.parse(this.parent.namedRanges.get(t.toUpperCase())),(t=this.parent.setTokensForSheets(t)).indexOf(this.fixedReference)>-1&&t.split(this.fixedReference).join(this.emptyStr),this.findNamedRange=!0):t=this.parse(this.parent.namedRanges.get(t.toUpperCase()))),this.findNamedRange&&"!"!==t[0]&&"q"!==t[0]&&"bq"!==t[0]&&(t=this.parent.setTokensForSheets(t)).indexOf(this.fixedReference)>-1&&(t=t.split(this.fixedReference).join(this.emptyStr))}return t},t.prototype.getTableRange=function(e){var t=(e=e.replace(" ",this.emptyStr).toUpperCase()).replace("]",this.emptyStr).replace("#DATA",this.emptyStr);t.indexOf(this.parent.getParseArgumentSeparator())>-1&&(t.substring(0,t.indexOf(this.parent.getParseArgumentSeparator())).replace("[",this.emptyStr),t=t.replace("[",this.emptyStr).replace(this.parent.getParseArgumentSeparator(),"_"));this.emptyStr;return t.toUpperCase()},t.prototype.findNextEndIndex=function(e,t){for(var r=0,n=t,i=!1;!i&&t<e.length;)"["===e[n]?r++:"]"===e[n]&&0===--r&&(i=!0),t++;return t-=n},t}(),Io=function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},e(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Eo=function(e,t,r,n){var i,a=arguments.length,s=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,n);else for(var o=e.length-1;o>=0;o--)(i=e[o])&&(s=(a<3?i(s):a>3?i(t,r,s):i(t,r))||s);return a>3&&s&&Object.defineProperty(t,r,s),s},No=function(n){function a(t){var r=n.call(this,null,null)||this;r.lFormulas=new Map,r.storedData=new Map,r.keyToRowsMap=new Map,r.rowsToKeyMap=new Map,r.rightBracket=String.fromCharCode(161),r.leftBracket=String.fromCharCode(162),r.sheetToken="!",r.emptyString="",r.leftBrace="{",r.rightBrace="}",r.cell=r.emptyString,r.cellPrefix="!0!A",r.treatEmptyStringAsZero=!1,r.tic='"',r.singleTic="'",r.trueValue="TRUE",r.falseValue="FALSE",r.parseDecimalSeparator=".",r.arithMarker=String.fromCharCode(180),r.arithMarker2=r.arithMarker+r.arithMarker,r.dependentCells=null,r.dependentFormulaCells=null,r.minValue=Number.MIN_SAFE_INTEGER,r.maxValue=Number.MAX_SAFE_INTEGER,r.categoryCollection=["All"],r.dependencyLevel=0,r.randomValues=new Map,r.isRandomVal=!1,r.randCollection=[],r.dependencyCollection=[],r.uniqueRange=[],r.formulaErrorStrings=["binary operators cannot start an expression","cannot parse","bad library","invalid char in front of","number contains 2 decimal points","expression cannot end with an operator","invalid characters following an operator","invalid character in number","mismatched parentheses","unknown formula name","requires a single argument","requires 3 arguments","invalid Math argument","requires 2 arguments","#NAME?","too complex","#CIRCULARREF!","missing formula","improper formula","invalid expression","cell empty","bad formula","empty expression","","mismatched string quotes","wrong number of arguments","invalid arguments","iterations do not converge","Control is already registered","Calculation overflow","Missing sheet","cannot_parse","expression_cannot_end_with_an_operator","#SPILL!","#DIV/0!"],r.errorStrings=null,r.parseArgumentSeparator=",",r.dateTime1900=new Date(1900,0,1,0,0,0),r.isParseDecimalSeparatorChanged=!1,r.isArgumentSeparatorChanged=!1,r.sheetFamilyID=0,r.defaultFamilyItem=null,r.sheetFamiliesList=null,r.modelToSheetID=null,r.tokenCount=0,r.sortedSheetNames=null,r.tempSheetPlaceHolder=String.fromCharCode(133),r.namedRanges=new Map,r.formulaInfoTable=null,r.oaDate=new Date(1899,11,30),r.millisecondsOfaDay=864e5,r.parseDateTimeSeparator="/";var i=new xo(r);return r.includeBasicFormulas&&s.Inject(So),r.injectedModules&&r.injectedModules.length&&i.inject(r.requiredModules(),r.injectedModules),r.parentObject=(0,e.isNullOrUndefined)(t)?r:t,r.grid=r.parentObject,r.parser=new wo(r),r}var s;return Io(a,n),s=a,Object.defineProperty(a.prototype,"libraryFormulas",{get:function(){return this.lFormulas},set:function(e){this.lFormulas.set(e.fName,{handler:e.handler,category:e.category,description:e.description})},enumerable:!0,configurable:!0}),a.prototype.getParseArgumentSeparator=function(){return this.isArgumentSeparatorChanged||","===this.parseArgumentSeparator||(this.parseArgumentSeparator=","),this.parseArgumentSeparator},a.prototype.setParseArgumentSeparator=function(e){this.parseArgumentSeparator=e,this.isArgumentSeparatorChanged=!0},a.prototype.getParseDateTimeSeparator=function(){return this.parseDateTimeSeparator},a.prototype.setTreatEmptyStringAsZero=function(e){this.treatEmptyStringAsZero=e},a.prototype.getTreatEmptyStringAsZero=function(){return this.treatEmptyStringAsZero},a.prototype.setParseDateTimeSeparator=function(e){this.parseDateTimeSeparator=e},a.prototype.requiredModules=function(){return yo(this)},a.Inject=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.prototype.injectedModules||(this.prototype.injectedModules=[]);for(var r=0;r<e.length;r++)-1===this.prototype.injectedModules.indexOf(e[r])&&this.prototype.injectedModules.push(e[r])},a.prototype.getInjectedModules=function(){return this.injectedModules},a.prototype.onPropertyChanged=function(e,t){},a.prototype.getModuleName=function(){return"calculate"},a.prototype.getFormulaCharacter=function(){return"="},a.prototype.isUpperChar=function(e){var t=e.charCodeAt(0);return t>64&&t<91},a.prototype.resetKeys=function(){this.storedData.clear(),this.keyToRowsMap.clear(),this.rowsToKeyMap.clear()},a.prototype.updateDependentCell=function(e){var t=this,r=this.cell;if(r!==this.emptyString){var n=this.getSheetFamilyItem(this.grid);if(n.sheetNameToParentObject&&(r.includes(this.sheetToken)||(r=n.parentObjectToToken.get(this.grid)+r),e.includes(this.sheetToken)||(e=n.parentObjectToToken.get(this.grid)+e)),r!==e){var i=this.getDependentCells();i.has(e)||i.set(e,[]);var a=i.get(e);if(-1===a.indexOf(r)){var s=this.getDependentFormulaCells(),o={},l=function(e){if(s.has(e)){var n=s.get(e);if(n.has(r))throw t.formulaErrorStrings[_n.CircularReference];o[e]||(o[e]=!0,n.forEach((function(e){l(e)})))}};l(e),a.push(r),s.has(r)?s.get(r).has(e)||s.get(r).set(e,e):(s.set(r,new Map),s.get(r).set(e,e))}}}},a.prototype.getDependentCells=function(){return null==this.dependentCells&&(this.dependentCells=new Map),this.dependentCells},a.prototype.getDependentFormulaCells=function(){if(this.isSheetMember()){var e=this.getSheetFamilyItem(this.grid);return null==e.sheetDependentFormulaCells&&(e.sheetDependentFormulaCells=new Map),e.sheetDependentFormulaCells}return null==this.dependentFormulaCells&&(this.dependentFormulaCells=new Map),this.dependentFormulaCells},a.prototype.getLibraryFormulas=function(){return this.lFormulas},a.prototype.getFunction=function(e){return this.getLibraryFormulas().has(e.toUpperCase())?this.getLibraryFormulas().get(e.toUpperCase()).handler:null},a.prototype.intToDate=function(e){var t=Number(e);(t=t>0&&t<1?1+t:0===t?1:t)>60&&(t-=1);var r=new Date("01/01/1900"),n=Date.UTC(r.getFullYear(),r.getMonth(),r.getDate(),r.getHours(),r.getMinutes(),r.getSeconds(),r.getMilliseconds());return new Date(new Date(864e5*(t-1)+n).toUTCString().replace(" GMT",""))},a.prototype.getFormulaInfoTable=function(){if(this.isSheetMember()){var e=this.getSheetFamilyItem(this.grid);return null===e.sheetFormulaInfotable&&(e.sheetFormulaInfotable=new Map),e.sheetFormulaInfotable}return null===this.formulaInfoTable&&(this.formulaInfoTable=new Map),this.formulaInfoTable},a.prototype.getFormula=function(e){return e=e.toUpperCase(),this.storedData.has(e)?this.storedData.get(e).getFormulaText():""},a.prototype.getParseDecimalSeparator=function(){return this.isParseDecimalSeparatorChanged||"."===this.parseDecimalSeparator||(this.parseDecimalSeparator="."),this.parseDecimalSeparator},a.prototype.setParseDecimalSeparator=function(e){this.parseDecimalSeparator=e,this.isParseDecimalSeparatorChanged=!0},a.prototype.getSheetToken=function(e){var t=0,r=this.emptyString;if(t<e.length&&e[t]===this.sheetToken){for(t++;t<e.length&&e[t]!==this.sheetToken;)t++;r=e.substring(0,t+1)}if(t<e.length)return r;throw this.formulaErrorStrings[_n.BadIndex]},a.prototype.getSheetID=function(e){var t=this.getSheetFamilyItem(e);if(null!=t.sheetNameToParentObject&&t.sheetNameToParentObject.size>0){var r=t.parentObjectToToken.get(e);if(r){r=r.split(this.sheetToken).join(this.emptyString);var n=this.parseFloat(r);if(!this.isNaN(n))return n}}return-1},a.prototype.parseFloat=function(e){var t=Number(e);return isNaN(t)&&"string"==typeof e&&e.includes(",")&&(t=Number(e.split(",").join(""))),t},a.prototype.rowIndex=function(e){var t=0,r=!1;if(t<e.length&&e[t]===this.sheetToken){for(t++;t<e.length&&e[t]!==this.sheetToken;)t++;t++}for(;t<e.length&&this.isChar(e[t]);)r=!0,t++;var n=parseInt(e.substring(t),10);if(t<e.length&&!this.isNaN(n))return n;if(r)return-1;throw this.formulaErrorStrings[_n.BadIndex]},a.prototype.colIndex=function(e){var t=0,r=0;if(t<(e=e.toUpperCase()).length&&e[t]===this.sheetToken){for(t++;t<e.length&&e[t]!==this.sheetToken;)t++;t++}for(;t<e.length&&this.isChar(e[t]);){r=26*r+e[t].charCodeAt(0)-64,t++}return 0===r?-1:r},a.prototype.getErrorStrings=function(){return null===this.errorStrings&&(this.errorStrings=["#N/A","#VALUE!","#REF!","#DIV/0!","#NUM!","#NAME?","#NULL!","#CALC!"]),this.errorStrings},a.prototype.substring=function(e,t,r){return e.substring(t,r+t)},a.prototype.isChar=function(e){return e.charCodeAt(0)>=65&&e.charCodeAt(0)<=90||e.charCodeAt(0)>=97&&e.charCodeAt(0)<=122},a.prototype.getSheetFamilyItem=function(e,t){return 0===this.sheetFamilyID?(null==this.defaultFamilyItem&&(this.defaultFamilyItem=new ko),this.defaultFamilyItem):(null==this.sheetFamiliesList&&(this.sheetFamiliesList=new Map),void 0===t&&(t=this.modelToSheetID.get(e)),this.sheetFamiliesList.has(t)||this.sheetFamiliesList.set(t,new ko),this.sheetFamiliesList.get(t))},a.prototype.setKeyValue=function(e,t){e=e.toUpperCase();var r=t.toString().trim();this.storedData.get(e)&&0!==r.indexOf(this.leftBrace)||(this.storedData.set(e,new Oo),this.keyToRowsMap.set(e,this.keyToRowsMap.size+1),this.rowsToKeyMap.set(this.rowsToKeyMap.size+1,e));var n=this.storedData.get(e);if(null!=n.getFormulaText()&&n.getFormulaText().length>0&&n.getFormulaText()!==r){var i=this.cellPrefix+this.keyToRowsMap.get(e).toString();null!=this.getDependentFormulaCells().get(i)&&this.clearFormulaDependentCells(i)}r.length>0&&r[0]===this.getFormulaCharacter()?n.setFormulaText(r):n.getFormulaValue()!==r&&(n.setFormulaText(""),n.setParsedFormula(""),n.setFormulaValue(r))},a.prototype.clearFormulaDependentCells=function(e){var t=this,r=this.getDependentFormulaCells().get(e);r&&(r.forEach((function(r,n){var i=n,a=t.getDependentCells().get(i);t.arrayRemove(a,e),0===a.length&&t.getDependentCells().delete(i)})),this.getDependentFormulaCells().delete(e))},a.prototype.arrayRemove=function(e,t){var r=e.indexOf(t);return-1!==r&&e.splice(r,1),e},a.prototype.getKeyValue=function(t){if(t=t.toUpperCase(),null!==this.storedData.has(t)){var r=this.storedData.get(t),n=r.getFormulaText();if(n.length>0&&n[0]===this.getFormulaCharacter()){this.cell=this.cellPrefix+this.keyToRowsMap.get(t).toString(),n=n.substring(1);try{r.setParsedFormula(this.parser.parseFormula(n,t))}catch(e){var i={message:e.message,exception:e,isForceCalculable:!1,computeForceCalculate:!1};return this.trigger("onFailure",i),r.setFormulaValue(i.message),this.storedData.get(t).getFormulaValue()}try{r.setFormulaValue(this.computeFormula(r.getParsedFormula()))}catch(t){i={message:t.message,exception:t,isForceCalculable:!1,computeForceCalculate:!1};this.trigger("onFailure",i);var a="string"==typeof i.exception?i.exception:i.message;return((0,e.isNullOrUndefined)(this.getErrorLine(t))?"":"#"+this.getErrorLine(t)+": ")+a}}return this.storedData.get(t).getFormulaValue()}return this.emptyString},a.prototype.getNamedRanges=function(){return this.namedRanges},a.prototype.addNamedRange=function(e,t){var r=e.split(this.sheetToken);if(r.length>1){var n=this.getSheetId(this.grid).toString();if(!this.getSheetFamilyItem(n).parentObjectToToken.get(n))return!1;e=r[0]+this.sheetToken+r[1].toUpperCase()}else e=e.toUpperCase();return this.namedRanges.set(e,t),!0},a.prototype.updateNamedRange=function(e,t){var r=new Map;this.namedRanges.forEach((function(n,i){var a=i;if(i.includes(e)){var s=i.split("!");s[0]=t,a=s.join("!")}r.set(a,n)})),this.namedRanges=r},a.prototype.removeNamedRange=function(e){return e=e.toUpperCase(),null!=this.namedRanges.get(e)&&(this.namedRanges.delete(e),!0)},a.prototype.convertAlpha=function(e){for(var t=[],r=0;e>0;){e--;var n="A".charCodeAt(0);t[r]=String.fromCharCode(e%26+n),e=parseInt((e/26).toString(),10),r++}for(var i=[],a=0;a<r;a++)i[r-a-1]=t[a];return i.join("")},a.prototype.getCellCollection=function(e){if(e.indexOf(":")<0){if(!this.isCellReference(e))return e.split(this.getParseArgumentSeparator());e=e+":"+e}var t=this.emptyString,r=e.indexOf(this.sheetToken);if(r>-1)for(var n=r+1;n<e.length;){if(e[n]===this.sheetToken){t=e.substr(0,n+1);break}n++}var i,a,s,o,l=e.indexOf(":");if(l>0&&this.isChar(e[l-1]))for(var d=l-2;d>=0&&this.isDigit(e[d]);)d--;i=this.rowIndex(this.substring(e,0,l)),a=this.rowIndex(this.substring(e,l+1,l+e.length-l-1)),s=this.colIndex(this.substring(e,0,l)),o=this.colIndex(this.substring(e,l+1,l+e.length-l-1)),i>a&&(l=a,a=i,i=l),s>o&&(l=o,o=s,s=l);var h,p=[],c=0;for(l=i;l<=a;l++)for(h=s;h<=o;h++)p[c]=t+this.emptyString+this.convertAlpha(h)+l.toString(),c++;return p},a.prototype.computeFormula=function(e,t){return this.calculateFormula(e,!1,t)},a.prototype.calculateFormula=function(t,r,n){var i,a,s,o,l=this,d=!1;if(this.parser.isError)return t;i=this.parser.isFormulaParsed?t:this.parser.parseFormula(t),this.parser.isFormulaParsed=!1;try{if((a=this.findLastIndexOfq(i))>0&&(d=!0),i!==this.emptyString&&a>-1)for(var h=a+1,p=function(){if(i[h]!==c.rightBracket)return h++,"continue";var t=i.substring(a,h+1),p=t.split(c.leftBracket)[0].split("q").join(c.emptyString),u=void 0;if(c.getLibraryFormulas().get(p.toUpperCase()).isCustom){u=t.substring(t.indexOf(c.leftBracket)+1,t.indexOf(c.rightBracket)).split(c.getParseArgumentSeparator());var f=0,g=[],m=void 0;for(f=0;f<u.length;f++)u[f].includes(":")&&c.isCellReference(u[f])&&(m=c.getCellCollection(u[f])).length>1?(g.push(u[f]),m.forEach((function(e){l.updateDependentCell(e)}))):g.push(c.getValueFromArg(u[f]));u=g}else{var v=t.substring(t.indexOf(c.leftBracket)+1,t.indexOf(c.rightBracket));u=[];for(var y=c.getParseArgumentSeparator(),C="",b=void 0,x=0,S=v.length-1;x<=S;x++)'"'===v[x]&&(b=!b),v[x]!==y||b?(C+=v[x],x===S&&u.push(C)):(u.push(C),C="",x===S&&u.push(C));if(u.length||(u=[""]),d&&p){["IF","INDEX","SORT","T","EXACT","PROPER","DOLLAR","DATE"].some((function(e){return e===p}))&&u.push("nestedFormulaTrue"),"IF"===p&&u.push("nestedFormulaTrue")}n&&"UNIQUE"===p&&u.push("isComputeExp")}if(s=(0,e.isNullOrUndefined)(c.getFunction(p))?c.getErrorStrings()[zn.Name]:c.getFunction(p).apply(void 0,u),d){o=c.processNestedFormula(i,t,s);var w=c.findLastIndexOfq(o);return 0===w&&(d=!1),-1===w&&(s=c.computeValue(o,r)),a=h=w,i=o,"continue"}return"break"},c=this;h>-1;){if("break"===p())break}else this.formulaErrorStrings.indexOf(i)>-1?s=i:i!==this.emptyString&&-1===a&&(s=this.computeValue(i,r))}catch(t){var u={message:t.message,exception:t,isForceCalculable:!1,computeForceCalculate:!1};this.trigger("onFailure",u);var f="string"==typeof u.exception?u.exception:u.message;s=((0,e.isNullOrUndefined)(this.getErrorLine(t))?"":"#"+this.getErrorLine(t)+": ")+f}return s},a.prototype.computeSumIfAndAvgIf=function(t,r){if((0,e.isNullOrUndefined)(t)||t[0]===this.emptyString||0===t.length)return this.formulaErrorStrings[_n.WrongNumberArguments];for(var n=t,i=0;i<n.length;i++)if(this.isCellReference(n[i])&&(0,e.isNullOrUndefined)(n[i].match(/[0-9]/))&&n[i].indexOf("!")<0){var a=n[i].split(":");n[i]=a[0]+"1:"+a[1]+this.spreadSheetUsedRange[0]}var s=n.length;if(2!==s&&3!==s&&0===s)return this.formulaErrorStrings[_n.WrongNumberArguments];if(""===n[1])return r?this.getErrorStrings()[zn.DivZero]:"0";var o=n[0],l=n[1].startsWith(this.tic)&&n[1].endsWith(this.tic),d=n[1].split(this.tic).join(this.emptyString);if(d.length>255)return this.getErrorStrings()[zn.Value];var h=d.includes("*"),p=d.includes("?"),c=h?d.replace(/\*/g,"").trim():d,u=!1;if(!l&&this.isCellReference(c)&&(c=this.getValueFromArg(c),u=!0),h){var f=d.indexOf("*");"*"===d[0]&&(c="*"+c),"*"===d[d.length-1]&&(c+="*"),f>0&&f<d.length-1&&(c=d.substring(0,f)+"*"+d.substring(f+1))}d=c;var g=this.parser.tokenEqual;d.startsWith("<=")?(g=this.parser.tokenLessEq,d=d.substring(2)):d.startsWith(">=")?(g=this.parser.tokenGreaterEq,d=d.substring(2)):d.startsWith("<>")?(g=this.parser.tokenNotEqual,d=d.substring(2)):d.startsWith("<")?(g=this.parser.tokenLess,d=d.substring(1)):d.startsWith(">")?(g=this.parser.tokenGreater,d=d.substring(1)):d.startsWith("=")&&(g=this.parser.tokenEqual,d=d.substring(1)),(!l&&this.isCellReference(d)&&!u||d.includes(this.arithMarker)||d.includes(this.getParseDecimalSeparator())&&!h&&!p)&&(d=this.getValueFromArg(d));var m=this.parseFloat(d),v=n[0],y=this.getCellCollection(s>2?n[2]:o),C=this.getCellCollection(v);if(C.length>y.length){var b=this.colIndex(y[y.length-1])+this.colIndex(C[C.length-1])-this.colIndex(C[0]),x=n[2].split(":");x[1]=(this.convertAlpha(b)+this.rowIndex(C[C.length-1])).toString(),y=this.getCellCollection(x.join(":"))}var S=this.getComputeSumIfValue(C,y,d.toLowerCase(),m,g,h,p);return[S[0],S[1]]},a.prototype.computeLookup=function(r){var n,i,a,s,o,l,d=[],h=[],p=[],c=[],u=[],f=r,g=f.length;if(1===g||g>3)return this.formulaErrorStrings[_n.WrongNumberArguments];if(""===f[1]||""===f[2])return this.getErrorStrings()[zn.Value];if(o=this.getValueFromArg(f[0]),f[0].indexOf(this.tic)>-1&&f[0].toUpperCase().split(this.tic).join("")!==this.trueValue&&f[0].toUpperCase().split(this.tic).join("")!==this.falseValue&&this.isNaN(this.parseFloat(f[0].split(this.tic).join("")))&&(o=o.split(this.tic).join("")),this.getErrorStrings().indexOf(o)>-1)return o;var m=f[1].split(":");if(2===m.length&&this.isCellReference(m[0])&&this.isCellReference(m[1])&&2===g){var v=f[1].indexOf(":"),y=this.rowIndex(this.substring(f[1],0,v)),C=this.colIndex(this.substring(f[1],0,v)),b=this.rowIndex(this.substring(f[1],v+1,v+f[1].length-v-1)),x=this.colIndex(this.substring(f[1],v+1,v+f[1].length-v-1));y>b&&(y=(n=[b,y])[0],b=n[1]),C>x&&(C=(i=[x,C])[0],x=i[1]);var S="";0===f[1].indexOf("!")&&(S=(S=(S=f[1]).replace("!","")).indexOf("!"),S=f[1].substring(0,S+2));var w=x-C+1,I=b-y+1;I>w||I===w?(a=S+Ao(C)+y+":"+Ao(C)+b,s=S+Ao(x)+y+":"+Ao(x)+b):I<w&&(a=S+Ao(C)+y+":"+Ao(x)+y,s=S+Ao(C)+b+":"+Ao(x)+b),y===b&&C===x||(l=!0)}if(l)d=this.getCellCollection(a),h=this.getCellCollection(s);else{d=this.getCellCollection(f[1]);var E=2===g?f[1]:f[2];h=this.getCellCollection(E);var N=t(f[1]),R=t(E),O=N[1]===N[3]||N[0]===N[2],k=R[1]===R[3]||R[0]===R[2];if(!O||!k)return this.getErrorStrings()[zn.NA]}for(var A=0;A<d.length;A++)c.push(this.getValueFromArg(d[A]).split(this.tic).join(""));var F=c.map((function(e){return""===e?NaN:Number(e)})).sort((function(e,t){return e-t})),T=F[F.length-1],D=F[0],L=this.parseFloat(o);if(this.isNaN(L)){for(var P=0;P<d.length;P++)if(p[P]=this.getValueFromArg(d[P]).split(this.tic).join(""),!(0,e.isNullOrUndefined)(h[P])&&""!==o&&""!==p[P])if(o.toUpperCase()===p[P].toUpperCase())u.push(this.getValueFromArg(h[P]).split(this.tic).join("")||"0");else if(o.indexOf("*")>-1||o.indexOf("?")>-1){var M=o;if(o.indexOf("*")>-1){M=M.replace(/\*/g,"").trim(),this.isCellReference(M)&&(M=this.getValueFromArg(M));var B=o.indexOf("*");"*"===o[0]&&(M="*"+M),"*"===o[o.length-1]&&(M+="*"),B>0&&B<o.length-1&&(M=o.substring(0,B)+"*"+o.substring(B+1))}var H=[],U=this.findWildCardValue(M.toLowerCase(),p[P].toLowerCase());H.push(U),H.push(o),this.processLogical(H,"equal")===this.trueValue&&u.push(this.getValueFromArg(h[P]).split(this.tic).join("")||"0")}}else for(var V=0;V<F.length;V++)p[V]=F[V].toString().split(this.tic).join(""),(0,e.isNullOrUndefined)(h[V])||""===p[V]||L!==this.parseFloat(p[V])||u.push(this.getValueFromArg(h[V]).split(this.tic).join("")||"0");if(u.length>0)return u[u.length-1];if(L>T&&!(0,e.isNullOrUndefined)(h[d.length-1]))return this.getValueFromArg(h[d.length-1]).split(this.tic).join("")||"0";if(L<D)return this.getErrorStrings()[zn.NA];if(c.indexOf(o.split(this.tic).join(""))<0&&o!==this.trueValue&&o!==this.falseValue)if(this.isNaN(L)||this.isNaN(T)||this.isNaN(D)){if(this.isNaN(L)&&""!==o&&/^[a-zA-Z!@#$%^&*()_+{}[\]:;<>,.?~\\/-]/.test(o)){var z=c.sort();v=this.findClosestMatch(o.split(this.tic).join(""),z);if(!(0,e.isNullOrUndefined)(h[v])&&v>=0)return this.getValueFromArg(h[v]).split(this.tic).join("")||"0"}}else{for(var _=[],j=0;j<F.length;j++)L>F[j]&&_.push(F[j]);var v=_.length-1;if(!(0,e.isNullOrUndefined)(h[v])&&v>=0)return this.getValueFromArg(h[v]).split(this.tic).join("")||"0"}return this.getErrorStrings()[zn.NA]},a.prototype.computeVHLookup=function(t,r){var n,i,a=this,s=t;if((0,e.isNullOrUndefined)(s)||s.length<3||s.length>4)return this.formulaErrorStrings[_n.WrongNumberArguments];if(""===s[1])return this.getErrorStrings()[zn.NA];var o=this.getValueFromArg(s[0]);if(o){if(o.includes(this.tic)){var l=o.split(this.tic).join("");if(l&&!this.isNumber(l)){var d=l.toUpperCase();d!==this.trueValue&&d!==this.falseValue&&(o=l)}}}else o="0";var h=this.getErrorStrings();if(h.indexOf(o)>-1)return o;var p,c=(this.getValueFromArg(s[2])||"0").split(this.tic).join("").toUpperCase(),u=this.parseFloat(c===this.trueValue?"1":c);if(u<1)return h[zn.Value];if(s[3]){if(s[3]=this.getValueFromArg(s[3]).split(this.tic).join(""),h.indexOf(s[3])>-1)return s[3];var f=s[3].toUpperCase();if(f===this.falseValue||"0"===s[3])p=!0;else if(f!==this.trueValue&&"1"!==s[3])return h[zn.Value]}var g,m,v,y,C,b,x=s[1].split(":");if(!this.isCellReference(x[0])||!this.isCellReference(x[1]))return h[zn.Value];var S=this.rowIndex(x[0]),w=this.colIndex(x[0]),I=this.rowIndex(x[1]),E=this.colIndex(x[1]);if(S>I&&(S=(n=[I,S])[0],I=n[1]),w>E&&(w=(i=[E,w])[0],E=i[1]),!(S>0&&I<=1048576&&w>0&&E<=16384))return this.getErrorStrings()[zn.Name];y=this.grid;var N="",R=this.getSheetFamilyItem(y);s[1].startsWith("!")?(N=s[1].substring(0,s[1].replace("!","").indexOf("!")+2),null!==R.tokenToParentObject&&(this.grid=R.tokenToParentObject.get(N))):null!==R.parentObjectToToken&&(N=R.parentObjectToToken.get(y));var O=this.getSheetId(this.grid),k={action:"getSheetInfo",sheetInfo:[]};if(this.parentObject.notify(pe,k),-1===bn(this.parentObject,"Sheet"+O,k.sheetInfo))return this.grid=y,h[zn.Ref];var A,F,T=this.getCellValueFn(y,this.cell,O,!0);if(r){var D=w+u-1;if(D>E)return h[zn.Ref];g=S,m=I;var L=N+Ao(w);C=function(e){return T(e,w,L+e)};var P=N+Ao(D);b=function(){return T(v,D,P+v)||"0"}}else{var M,B=S+u-1;if(B>I)return h[zn.Ref];g=w,m=E,C=function(e){return M=N+Ao(e),T(S,e,M+S)},b=function(){return T(B,v,M+B)||"0"}}var H=[];if(p){var U=void 0;if(this.isNumber(o)){var V=this.parseFloat(o);U=function(){return V===a.parseFloat(F)}}else if(o.includes("*")||o.includes("?")){var z=o,_=o.indexOf("*");_>-1&&(z=z.replace(/\*/g,"").trim(),this.isCellReference(z)&&(z=this.getValueFromArg(z)),0===_?z="*"+z:_===o.length-1?z+="*":z=o.substring(0,_)+"*"+o.substring(_+1)),z=z.toLowerCase(),U=function(){return a.processLogical([a.findWildCardValue(z,F.toLowerCase()),o],"equal")===a.trueValue}}else{var j=o.toUpperCase();U=function(){return j===F.toUpperCase()}}for(v=g;v<=m;v++)(F=C(v))&&U()&&H.push(b());A=H.length?H[0]:h[zn.NA]}else if(o.indexOf("*")>-1||o.indexOf("?")>-1)A=h[zn.NA];else{var q,W=void 0;if(this.isNumber(o)){var G=this.parseFloat(o),Y=br.DataUtil.fnSort("");W=function(){q=Y(a.isNumber(F)?a.parseFloat(F):F||null,G)}}else{var X=new Intl.Collator(this.parentObject.locale||"en-US",{sensitivity:"base"});W=function(){q=!F||a.isNumber(F)?null:X.compare(F,o)}}var K=void 0;for(v=g;v<=m;v++)F=C(v),K||(W(),0===q||q<0?H.push(b()):q>0&&H.length&&(K=!0));A=H.length?H[H.length-1]:h[zn.NA]}return this.grid=y,A},a.prototype.findClosestMatch=function(e,t){for(var r=0,n=t.length-1;r<=n;){var i=Math.floor((r+n)/2),a=t[i],s=this.compareStrings(e.toLowerCase(),a.toLowerCase());if(0===s)return i;1===s?r=i+1:n=i-1}for(var o=r-1;o>=0;o--)if(-1!==this.compareStrings(e.toLowerCase(),t[o].toLowerCase()))return o;return-1},a.prototype.compareStrings=function(e,t){for(var r=Math.min(e.length,t.length),n=0;n<r;n++){var i=e.charCodeAt(n),a=t.charCodeAt(n);if(i<a)return-1;if(i>a)return 1}return e.length<t.length?-1:e.length>t.length?1:0},a.prototype.findWildCardValue=function(e,t){var r="";if(e.indexOf("?")>-1){var n=RegExp(e.replace(/\?/g,"[\\s\\S]"));r=t.length===e.length&&this.isNaN(this.parseFloat(t))&&t.match(n)?e:t}else if(e.indexOf("*")>-1){for(var i=e.indexOf("*"),a="",s="",o=this.falseValue,l=this.falseValue,d=i-1;d>=0;d--)a+=e[d],l=this.trueValue;for(d=i+1;d<e.length;d++)s+=e[d],o=this.trueValue;var h=""===a?-1:t.indexOf(a.split("").reverse().join("")),p=""===s?-1:t.indexOf(s);if(h>-1||p>-1){var c=a.split("").reverse().join("")===t.substr(0,a.length),u=s===t.substring(t.length-s.length,t.length);l===this.trueValue&&o===this.trueValue&&this.isNaN(this.parseFloat(a))&&this.isNaN(this.parseFloat(s))?r=c&&u?e:t:l===this.trueValue&&this.isNaN(this.parseFloat(a))?r=c?e:t:o===this.trueValue&&this.isNaN(this.parseFloat(s))&&(r=u?e:t)}else r=t}return r},a.prototype.getComputeSumIfValue=function(e,t,r,n,i,a,s){var o=0,l=0;switch(i){case this.parser.tokenEqual:for(var d=a?r.replace(/\*/g,""):r,h=0;h<e.length;h++){var p=this.getValueFromRange(t,h),c=this.getValueFromArg(e[h].split(this.tic).join("")).toLowerCase(),u=this.parseFloat(c);if(c===r&&u===n){var f=this.getValueFromArg(t[h].split(this.tic).join("")),g=this.parseFloat(f);this.isNaN(g)||(o+=g,l+=1)}else if(c===r)this.isNaN(p)||(o+=p,l+=1);else if(a&&d&&c&&this.isNaN(this.parseFloat(c))){var m=r.indexOf("*");("*"===r[0]&&d.length<=c.length&&d===c.slice(c.length-d.length,c.length)||"*"===r[r.length-1]&&d.length<=c.length&&d===c.slice(0,d.length)||m>-1&&c.startsWith(r.substr(0,m))&&c.endsWith(r.substr(m+1)))&&(this.isNaN(p)||(o+=p,l+=1))}else if(a&&!d&&c&&this.isNaN(this.parseFloat(c)))this.isNaN(p)||(o+=p,l+=1);else if(s&&d&&c&&this.isNaN(this.parseFloat(c))){var v=RegExp(d.replace(/\?/g,"[\\s\\S]"));c.length===r.length&&c.match(v)&&(this.isNaN(p)||(o+=p,l+=1))}}break;case this.parser.tokenLess:for(h=0;h<e.length;h++){c=this.getValueFromArg(e[h].split(this.tic).join(""));if((u=this.parseFloat(c))<n){f=this.getValueFromArg(t[h].split(this.tic).join("")),g=this.parseFloat(f);this.isNaN(g)||(o+=g,l+=1)}}break;case this.parser.tokenGreater:for(h=0;h<e.length;h++){c=this.getValueFromArg(e[h].split(this.tic).join(""));if((u=this.parseFloat(c))>n){f=this.getValueFromArg(t[h].split(this.tic).join("")),g=this.parseFloat(f);this.isNaN(g)||(o+=g,l+=1)}}break;case this.parser.tokenLessEq:for(h=0;h<e.length;h++){c=this.getValueFromArg(e[h].split(this.tic).join(""));if((u=this.parseFloat(c))<=n){f=this.getValueFromArg(t[h].split(this.tic).join("")),g=this.parseFloat(f);this.isNaN(g)||(o+=g,l+=1)}}break;case this.parser.tokenGreaterEq:for(h=0;h<e.length;h++){c=this.getValueFromArg(e[h].split(this.tic).join(""));if((u=this.parseFloat(c))>=n){f=this.getValueFromArg(t[h].split(this.tic).join("")),g=this.parseFloat(f);this.isNaN(g)||(o+=g,l+=1)}}break;case this.parser.tokenNotEqual:for(d=a?r.replace(/\*/g,""):r,h=0;h<e.length;h++){p=this.getValueFromRange(t,h),c=this.getValueFromArg(e[h].split(this.tic).join("")).toLowerCase(),u=this.parseFloat(c);if(c===r||u===n||a||s)if(a&&d&&c&&this.isNaN(this.parseFloat(c))){m=r.indexOf("*");("*"===r[0]&&d.length<=c.length&&d!==c.slice(c.length-d.length,c.length)||"*"===r[r.length-1]&&d.length<=c.length&&d!==c.slice(0,d.length)||m>-1&&!c.startsWith(r.substr(0,m))||!c.endsWith(r.substr(m+1)))&&(this.isNaN(p)||(o+=p,l+=1))}else if(!a||d||this.isNaN(this.parseFloat(c))){if(s&&d&&c&&this.isNaN(this.parseFloat(c))){v=RegExp(d.replace(/\?/g,"[\\s\\S]"));c.length===r.length&&c.match(v)||this.isNaN(p)||(o+=p,l+=1)}}else this.isNaN(p)||(o+=p,l+=1);else{f=this.getValueFromArg(t[h].split(this.tic).join("")),g=this.parseFloat(f);this.isNaN(g)||(o+=g,l+=1)}}}return[o,l]},a.prototype.getValueFromRange=function(e,t){var r=e[t];return r=this.getValueFromArg(r),this.parseFloat(r.toString())},a.prototype.computeAndOrNot=function(e,t){for(var r,n,i=this,a="and"===t,s="or"===t,o="not"===t,l=!(!a&&!o),d=[],h=e,p=0;p<h.length;p++){if(h[p]===this.tic)return this.getErrorStrings()[zn.Value];if(this.isCellReference(h[p]))for(var c=this.getCellCollection(h[p]),u=0;u<c.length;u++){if(this.getErrorStrings().indexOf(c[u])>-1)return c[u];if(c[u][0]===this.tic)return this.getErrorStrings()[zn.Name];if(r=this.getValueFromArg(c[u]),this.getErrorStrings().indexOf(r)>-1)return r;n=this.parseFloat(r),r===this.falseValue||""!==r&&0===n||o&&""===r?d.push(this.falseValue):r===this.trueValue||!isNaN(n)&&""!==r?d.push(this.trueValue):(""===r||isNaN(n))&&d.push(this.getErrorStrings()[zn.Value])}else{if(r=this.getValueFromArg(h[p]).split(this.tic).join("").toUpperCase(),this.getErrorStrings().indexOf(r)>-1)return r;n=this.parseFloat(r),r===this.falseValue||""===h[p]||""!==r&&0===n?d.push(this.falseValue):r===this.trueValue||!isNaN(n)&&""!==r?d.push(this.trueValue):(""===r||isNaN(n))&&d.push(this.getErrorStrings()[zn.Value])}}if(d.every((function(e){return e===i.getErrorStrings()[zn.Value]})))return this.getErrorStrings()[zn.Value];for(u=0;u<d.length;u++){if((a||o)&&d[u]===this.falseValue){l=!1;break}if(s&&d[u]===this.trueValue){l=!0;break}}return(l=o?!l:l)?this.trueValue:this.falseValue},a.prototype.removeTics=function(e){return e.length>1&&e[0]===this.tic[0]&&e[e.length-1]===this.tic[0]&&(e=this.substring(e,1,e.length-2)),e},a.prototype.getCellFrom=function(e){var t,r="",n=e.indexOf(":")>-1?e.split(":"):[e],i=n.length-1,a=this.rowIndex(n[0]);if(a===this.rowIndex(n[i])){var s=this.colIndex(n[0]),o=this.colIndex(n[i]),l=this.colIndex(this.cell);l>=s&&l<=o&&(r=Ao(l).toString()+a.toString())}else if(this.colIndex(n[0])===this.colIndex(n[i])){t=this.colIndex(n[0]);var d=this.rowIndex(n[i]),h=this.rowIndex(this.cell);h>=a&&h<=d&&(r=Ao(t).toString()+h.toString())}return r},a.prototype.computeValue=function(e,t,r){try{var n=[],i=0,a="";n.length=0;for(var s=this.getParseDecimalSeparator();i<e.length;){var o="u"===e[i];if(o&&(i+=1),e[i]!==this.arithMarker){if(this.isDigit(e[i])){for(var l=this.emptyString;i<e.length&&(this.isDigit(e[i])||e[i]===s);)l+=e[i]===s?".":e[i],i+=1;if(n.push(l),!e[i])return n.toString()}if(e[i]===this.sheetToken){for(a=e[i],i+=1;i<e.length&&e[i]!==this.sheetToken;)a+=e[i],i+=1;i<e.length&&(a+=e[i],i+=1)}else if(this.isUpperChar(e[i])){l=this.emptyString;for(var d="";i<e.length&&this.isUpperChar(e[i]);){l+=e[i],i+=1}for(;i<e.length&&this.isDigit(e[i]);){l+=e[i],i+=1}if(i<e.length&&":"===e[i]){if(l+=e[i],(i+=1)<e.length&&e[i]===this.sheetToken)for(l+=e[i],i+=1;i<e.length&&e[i]!==this.sheetToken;)l+=e[i],i+=1;for(;i<e.length&&this.isUpperChar(e[i]);)l+=e[i],i+=1;for(;i<e.length&&this.isDigit(e[i]);)l+=e[i],i+=1;l=a+this.getCellFrom(l)}else l=a+l;if(d=this.getParentObjectCellValue(l,t).toString(),a="","string"==typeof d&&this.getErrorStrings().indexOf(d)>-1)return d;o&&(d=this.isNaN(this.parseFloat(d))?"-"+d:(-this.parseFloat(d)).toString()),n.push(d)}else if("q"===e[i]){var h=e.substring(i+1).indexOf(this.leftBracket),p=e.substring(i+h+1).indexOf(this.rightBracket);e=this.substring(e,i+h+2,p-1)}else if(e[i]===this.tic[0]){l=e[i].toString();for(i+=1;i<e.length&&e[i]!==this.tic[0];)l+=e[i],i+=1;(d=l.split(this.tic).join(this.emptyString))===this.trueValue||d===this.falseValue||!this.isNaN(this.parseFloat(d))&&""!==d?n.push(this.tic+d+this.tic):n.push(d),i+=1}else if("%"===e[i]&&n.length>0){var c=n[0],u=this.parseFloat(c);this.isNaN(u)||(n.pop(),n.push((u/100).toString())),i+=1}else if(0===e.substring(i).indexOf(this.trueValue))n.push(this.trueValue),i+=this.trueValue.length;else if(0===e.substring(i).indexOf(this.falseValue))n.push(this.falseValue),i+=this.falseValue.length;else if(e[i]===this.tic[0]||"|"===e[i]){l=e[i].toString();for(i++;i<e.length&&e[i]!==this.tic[0];)l+=e[i],i+=1;n.push(l+this.tic),i+=1}else{if(" "===e[i]&&i<e.length-1){i+=1;continue}switch(e[i]){case"#":var f=0;this.getErrorStrings().indexOf(e.substring(i))>-1?(f=-1===e.indexOf("!")||-1===e.substring(i).indexOf("!")?e.indexOf("#N/A")>-1?e.indexOf("#N/A")+4+i:e.indexOf("?")+1+i:e.indexOf("!")+1+i,n.push(this.substring(e,i,f-i))):(f=i+1,n.push(this.substring(e,i,f-i))),i=f;break;case"n":l="";if("n"===e[i+=1])continue;if(0===e.substring(i).indexOf("Infinity"))i+=(l="Infinity").length;else{for(("u"===e[i]||o||"-"===e[i])&&(l="-",o?o=!1:i+=1);i<e.length&&(this.isDigit(e[i])||e[i]===s||"."===e[i]);)l+=e[i]===s?".":e[i],i+=1;if(i<e.length&&"%"===e[i])if(i+=1,""===l){if(n.length>0){c=n[0],u=this.parseFloat(c);this.isNaN(u)||(n.pop(),n.push((u/100).toString()))}}else l=(this.parseFloat(l)/100).toString()}l&&n.push(l);break;case this.parser.tokenAdd:this.getValArithmetic(n,"add",r),i+=1;break;case this.parser.tokenSubtract:this.getValArithmetic(n,"sub",r),i+=1;break;case this.parser.tokenMultiply:this.getValArithmetic(n,"mul",r),i+=1;break;case this.parser.tokenDivide:this.getValArithmetic(n,"div",r),i+=1;break;case this.parser.tokenLess:this.processLogical(n,"less"),i+=1;break;case this.parser.tokenGreater:this.processLogical(n,"greater"),i+=1;break;case this.parser.tokenGreaterEq:this.processLogical(n,"greaterEq"),i+=1;break;case this.parser.tokenLessEq:this.processLogical(n,"lessEq"),i+=1;break;case this.parser.tokenNotEqual:this.processLogical(n,"notEq"),i+=1;break;case this.parser.tokenOr:this.processLogical(n,"or"),i+=1;break;case this.parser.tokenAnd:this.processLogical(n,"and"),i+=1;break;case this.parser.tokenEqual:this.processLogical(n,"equal"),i+=1;break;default:return this.getErrorStrings()[zn.Value]}}}else i+=1}if(0===n.length)return this.emptyString;l=this.emptyString;for(var g=n.length;g>0;){var m=n.pop();if(this.getErrorStrings().indexOf(m)>-1)return m;if((l=m+l)===this.emptyString&&this.isCellReference(e)&&this.getTreatEmptyStringAsZero())return"0";g--}return l}catch(e){if(this.getErrorStrings().indexOf(e)>-1||this.formulaErrorStrings.indexOf(e)>-1)throw e;throw new Ro(this.formulaErrorStrings[_n.InvalidExpression])}},a.prototype.getValArithmetic=function(e,t,r){var n=!1,i=e.pop(),a=-1!==i.indexOf(".")?i.split(".")[1].length:0,s=Math.pow(10,a),o=e.pop(),l=-1!==o.indexOf(".")?o.split(".")[1].length:0,d=Math.pow(10,l),h=s>=d?s:d,p=s*d;i=(i=i===this.trueValue?"1":i===this.falseValue?"0":i)===this.emptyString?"0":this.getErrorStrings().indexOf(i.toString())<0?this.parseFloat(i+"").toString():i;var c=Number(i);isNaN(c)&&!r&&(n=!0,i===this.getErrorStrings()[zn.DivZero]?e.push(this.getErrorStrings()[zn.DivZero]):e.push(this.getErrorStrings()[zn.Value])),o=(o=o===this.trueValue?"1":o===this.falseValue?"0":o)===this.emptyString?"0":this.getErrorStrings().indexOf(o.toString())<0?this.parseFloat(o+"").toString():o,c=Number(o),isNaN(c)&&!r&&(n=!0,o===this.getErrorStrings()[zn.DivZero]?e.push(this.getErrorStrings()[zn.DivZero]):e.push(this.getErrorStrings()[zn.Value])),"add"!==t||n||e.push(((Number(o)*h+Number(i)*h)/h).toString()),"sub"!==t||n||e.push(((Number(o)*h-Number(i)*h)/h).toString()),"mul"!==t||n||e.push((Number(o)*d*(Number(i)*s)/p).toString()),"div"!==t||n||(this.isNaN(this.parseFloat(i))||this.isNaN(this.parseFloat(o))?e.push(this.getErrorStrings()[zn.Value]):0===this.parseFloat(i)?e.push(this.getErrorStrings()[zn.DivZero]):e.push((Number(o)*p/(Number(i)*p)).toString()))},a.prototype.processLogical=function(t,r){var n,i,a,s,o,l,d=!1;return"and"!==r&&"equal"!==r&&(n=t.pop(),i=t.pop(),this.getErrorStrings().indexOf(n)>-1?(l=n,d=!0):this.getErrorStrings().indexOf(i)>-1&&(l=i,d=!0),this.isNaN(this.parseFloat(n))&&this.isNaN(this.parseFloat(i))&&(n=n.toString().toLowerCase(),i=i.toString().toLowerCase()),(0,e.isNullOrUndefined)(n)||(a=n.indexOf(this.tic)>-1?n:this.parseFloat(n)),(0,e.isNullOrUndefined)(i)||(s=i.indexOf(this.tic)>-1?i:this.parseFloat(i)),"*"===n&&this.isNaN(this.parseFloat(i))&&""!==i&&(o=!0)),"less"!==r||d||(l=this.isNaN(a)||this.isNaN(s)?i.toUpperCase().split(this.tic).join("").localeCompare(n.toUpperCase().split(this.tic).join(""))<0?this.trueValue:this.falseValue:s<a?this.trueValue:this.falseValue),"greater"!==r||d||(l=this.isNaN(a)||this.isNaN(s)?i.toUpperCase().split(this.tic).join("").localeCompare(n.toUpperCase().split(this.tic).join(""))>0?this.trueValue:this.falseValue:s>a?this.trueValue:this.falseValue),"lessEq"!==r||d||(l=this.isNaN(a)||this.isNaN(s)?i.toUpperCase().split(this.tic).join("").localeCompare(n.toUpperCase().split(this.tic).join(""))<=0?this.trueValue:this.falseValue:s<=a?this.trueValue:this.falseValue),"greaterEq"!==r||d||(l=this.isNaN(a)||this.isNaN(s)?i.toUpperCase().split(this.tic).join("").localeCompare(n.toUpperCase().split(this.tic).join(""))>=0?this.trueValue:this.falseValue:s>=a?this.trueValue:this.falseValue),"notEq"!==r||d||(l=i!==n?this.trueValue:this.falseValue,o&&(l=this.falseValue)),"and"!==r||d||(n=t.pop().toString(),i="",t.length>0&&(i=t.pop().toString()),l=this.getErrorStrings().indexOf(n)>-1?n:this.getErrorStrings().indexOf(i)>-1?i:(l=this.emptyString+i+n+this.emptyString).split(this.tic).join("")),"equal"!==r||d||(n=t.pop(),i=t.pop(),this.getErrorStrings().indexOf(n)>-1?l=n:this.getErrorStrings().indexOf(i)>-1?l=i:(this.isNaN(this.parseFloat(n))&&this.isNaN(this.parseFloat(i))&&(n=n.toString().toLowerCase(),i=i.toString().toLowerCase()),"*"===n&&this.isNaN(this.parseFloat(i))&&""!==i&&(o=!0),l=n===i||o?this.trueValue:this.falseValue)),"or"!==r||d||(l=Math.pow(this.parseFloat(s),this.parseFloat(a)).toString(),l=this.isNaN(this.parseFloat(l))?this.getErrorStrings()[zn.Value]:l),t.push(l),l},a.prototype.computeStoreCells=function(e){for(var n,a=e.cellValue,s=e.cellRange,o=e.criteria,l=e.argArray,d=e.isCriteria,h=e.storedCells,p=e.isCountIfS===this.trueValue,c=e.countVal||0,u=d===this.trueValue?h:a,f=[],g=0;g<u.length;g++){var m=[],v=this.getValueFromArg(a[g]),y=l[p?1+2*c:2+c],C=y.startsWith(this.tic)&&y.endsWith(this.tic),b=(n=y.trim().split(this.tic).join(this.emptyString)).includes("*"),x="*"===n||"<>*"===n,S=b&&!x?n.replace(/\*/g,"").trim():n,w=!1;if(!C&&this.isCellReference(S)&&(S=this.getValueFromArg(S),w=!0),b&&!x){var I=n.indexOf("*");"*"===n[0]&&(S="*"+S),"*"===n[n.length-1]&&(S+="*"),I>0&&I<n.length-1&&(S=n.substring(0,I)+"*"+n.substring(I+1))}n=S;var E="";if((d=p?this.trueValue:d)===this.trueValue){var N="",R=0,O=0,k=void 0,A=void 0,F=void 0,T=void 0;h[g]=p&&!c?a[g]:h[g],N=h[g],c&&(A=(k=s[c-1]).indexOf("!")>-1?t(k.substring(k.lastIndexOf("!")+1)):t(k),F=N.indexOf("!")>-1?r(N.substring(N.lastIndexOf("!")+1)):r(N),T=s[c].indexOf("!")>-1?t(s[c].substring(s[c].lastIndexOf("!")+1)):t(s[c]));var D=N.indexOf("!")>-1,L=void 0,P="",M="";for(D&&(M=N.substring(0,N.lastIndexOf("!")+1),N=N.substring(N.lastIndexOf("!")+1));!this.isDigit(N[R]);)R+=1;if(this.isCellReference(s[c])&&s[c].indexOf(":")>-1)for(E=p&&!c?u[g].indexOf("!")>-1?u[g].substring(u[g].lastIndexOf("!")+1):u[g]:i(T[0]+(F[0]-A[0]),T[1]+(F[1]-A[1])),(L=s[c].indexOf("!")>-1)&&(P=s[c].substring(0,s[c].lastIndexOf("!")+1));!this.isDigit(E[O]);)O+=1;var B=this.substring(N,R),H=this.substring(E,O),U=this.substring(N,R,N.length-R),V=this.substring(E,O,E.length-R);D&&(B=M+B,H=M+H),U!==V&&(h[g]=this.substring(h[g],D?M.length+R:R)+V),E=h[g].split(B).join(H),L?(E.indexOf("!")>-1&&(E=E.substring(E.lastIndexOf("!")+1)),E=P+E):E=E.substring(E.lastIndexOf("!")+1),v=this.getValueFromArg(E),n=p?n:o[c-1].split(this.tic).join(this.emptyString)}var z="equal";n.startsWith("<=")?(z="lessEq",n=n.substring(2)):n.startsWith(">=")?(z="greaterEq",n=n.substring(2)):n.startsWith("<>")?(z="notEq",n=n.substring(2)):n.startsWith("<")?(z="less",n=n.substring(1)):n.startsWith(">")?(z="greater",n=n.substring(1)):n.startsWith("=")&&(z="equal",n=n.substring(1)),(!C&&this.isCellReference(n)&&(!w||""!==E&&!p)||n.includes(this.arithMarker))&&(n=this.getValueFromArg(n)),(n.indexOf("*")>-1||n.indexOf("?")>-1)&&(v=this.findWildCardValue(n.toLowerCase(),v.toLowerCase())),m.push(v.toLowerCase()),m.push(n.toLowerCase()),this.processLogical(m,z)===this.trueValue&&(d===this.falseValue?f.push(a[g]):f.push(E))}return h=f,f=[],h},a.prototype.computeIfsFormulas=function(n,a,s){if(a===this.trueValue&&((0,e.isNullOrUndefined)(n)||""===n[0]||n.length<2||n.length>127||n.length%2!=0))return this.formulaErrorStrings[_n.WrongNumberArguments];for(var o=n,l=[],d=[],h=[],p=0,c=0;c<o.length;c++)o[c].indexOf(":")>-1&&this.isCellReference(o[c])?l.push(o[c].trim()):d.push(o[c].trim());var u,f,g=[];for(c=0;c<l.length;c++)g.push(this.getCellCollection(l[c]).length);for(var m=0;m<g.length;m++)if(g[m]&&g[m+1]&&g[m]!==g[m+1])return this.getErrorStrings()[zn.Value];for(var v=0;v<d.length;v++)if(""===d[v])return s===this.trueValue?this.getErrorStrings()[zn.DivZero]:0;if(a===this.falseValue){f=this.falseValue;var y={cellValue:u=this.getCellCollection(l[1]),cellRange:l,criteria:d,argArray:o,isCriteria:f,storedCells:h,isCountIfS:a};if(0===(h=this.computeStoreCells(y)).length)return s===this.trueValue?this.getErrorStrings()[zn.DivZero]:0}for(c=a===this.trueValue?0:2;c<l.length;c++){f=this.trueValue,f=a===this.trueValue&&0===c?this.falseValue:this.trueValue;y={cellValue:u=this.getCellCollection(l[c]),cellRange:l,criteria:d,argArray:o,isCriteria:f,storedCells:h,isCountIfS:a,countVal:c};if(0===(h=this.computeStoreCells(y)).length)return s===this.trueValue?this.getErrorStrings()[zn.DivZero]:0}var C=0,b=l[0].indexOf("!")>-1?t(l[0].substring(l[0].lastIndexOf("!")+1)):t(l[0]),x=l[l.length-1],S=x.indexOf("!")>-1?t(x.substring(x.lastIndexOf("!")+1)):t(x);for(m=0;m<h.length;m++){var w="",I="",E=0,N=0,R=(w=h[m]).indexOf("!")>-1,O=void 0,k="",A="";for(R&&(A=w.substring(0,w.lastIndexOf("!")+1),w=w.substring(w.lastIndexOf("!")+1));!this.isDigit(w[E]);)E+=1;if(this.isCellReference(l[0])&&l[0].indexOf(":")>-1)for(I=i(b[0]+(r(w)[0]-S[0]),b[1]+(r(w)[1]-S[1])),(O=l[0].indexOf("!")>-1)&&(k=l[0].substring(0,l[0].lastIndexOf("!")+1));!this.isDigit(I[N]);)N+=1;var F=this.substring(w,E),T=this.substring(I,N),D=this.substring(w,E,w.length-E),L=this.substring(I,N,I.length-E);if(R&&(F=A+F,T=A+T),D!==L&&(h[m]=this.substring(h[m],R?A.length+E:E)+L),u=h[m].split(F).join(T),O?(u.indexOf("!")>-1&&(u=u.substring(u.lastIndexOf("!")+1)),u=k+u):u=u.substring(u.lastIndexOf("!")+1),a===this.trueValue)p+=1;else{var P=this.getValueFromArg(u),M=parseFloat(""===P&&s!==this.trueValue?"0":P);this.isNumber(M)&&(C++,p+=M)}}return s===this.trueValue&&(p/=C),p},a.prototype.processNestedFormula=function(e,t,r){if(r&&!r.toString().includes('"')){var n=e.indexOf(t)+t.length;if('"'===e[n]&&this.getErrorStrings().indexOf(r.toString())<0&&!this.isNumber(r)&&r!==this.trueValue&&r!==this.falseValue)return e.split(t).join('"'+r+'"')}return e.split(t).join("n"+r)},a.prototype.isNaN=function(e){return"NaN"===e.toString()||"string"==typeof e},a.prototype.isNumber=function(e){return e-parseFloat(e)>=0},a.prototype.fromOADate=function(e){(e=e>0&&e<1?1+e:0===e?1:e)>60&&(e-=1);var t=new Date("01/01/1900"),r=Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds());return new Date(new Date((e-1)*this.millisecondsOfaDay+r).toUTCString().replace(" GMT",""))},a.prototype.getSerialDateFromDate=function(e,t,r){var n=0;e<1900&&(e+=1900);for(var i=!1;!i;){for(;t>12;)e++,t-=12;for(;t<1;)t+=12,e--;i=!0;for(var a=new Date(e,t,1,-1).getDate();r>a;)a=new Date(e,t,1,-1).getDate(),t++,r-=a,i=!1;r<1&&(--t<1&&(t=12,e--),r=(a=new Date(e,t,1,-1).getDate())+r,i=!1)}var s=Date.parse(e+"/"+t+"/"+r);return this.isNaN(s)||(n=this.toOADate(new Date(s))),n},a.prototype.intToTime=function(t){var r=t.toString().split(".");return(0,e.isNullOrUndefined)(r[1])||(t=parseFloat(r[0]+1+"."+r[1])||t),this.intToDate(t.toString())},a.prototype.toOADate=function(e,t,r){var n=new Date("01/01/1900"),i=tn(e)?e:new Date(e),a=Date.UTC(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds()),s=(Date.UTC(i.getFullYear(),i.getMonth(),i.getDate(),i.getHours(),i.getMinutes(),i.getSeconds(),i.getMilliseconds())-a)/864e5;return(t?s:parseInt(s.toString(),10))+(r?0:s>60?2:1)},a.prototype.calculateDate=function(e){return this.parseFloat(e)<10?"0"+e:e},a.prototype.isTextEmpty=function(e){return null===e||""===e},a.prototype.isDigit=function(e){var t=e.charCodeAt(0);return t>47&&t<58},a.prototype.findLastIndexOfq=function(e){for(var t=e.lastIndexOf("q"),r=e.lastIndexOf(this.leftBracket);r<t;)t=e.substring(0,t).lastIndexOf("q");return t},a.prototype.getValueFromArg=function(e,t,r,n){if(!(e=e.trim())||this.getErrorStrings().indexOf(e)>-1)return e;var i=e[0];if(i===this.tic||i===this.singleTic){var a=e.split(this.tic).join("");if(this.isNaN(this.parseFloat(a))){var s=this.isDate(a);if(s&&!this.isNaN(s.getDate()))return this.toOADate(s,!0).toString()}if(e.endsWith(this.tic))"."!==(o=this.getParseDecimalSeparator())&&a.includes(o)&&(a=a.replace(o,"."),this.isNumber(a)&&(e=a));return e}if(!this.isUpperChar(i)){var o=this.getParseDecimalSeparator();if(this.isDigit(i)||i===o||"-"===i||"n"===i){if("n"===i&&(e=e.substring(1)).indexOf('"n')>-1&&(e=e.replace('"n','"')),"."!==o&&e.includes(o)){a=e.replace(o,".");this.isNumber(a)&&(e=a)}return e}}var l=i===this.sheetToken;if(l||this.isUpperChar(i)&&!["+","-","/","*",")",")","{"].some((function(t){return e.includes(t)}))){var d=this.isCellReference(e);if(d&&!l){var h=this.getSheetFamilyItem(this.grid);null!==h.sheetNameToParentObject&&h.parentObjectToToken.has(this.grid)&&(e=h.parentObjectToToken.get(this.grid)+e)}if(e===this.cell){var p=this.getDependentCells().get(e);if(null!=p&&p.indexOf(e)>-1&&this.arrayRemove(p,e),this.getDependentFormulaCells().has(this.cell)||this.clearFormulaDependentCells(this.cell),!t)throw new Ro(this.formulaErrorStrings[_n.CircularReference])}var c=this.getParentObjectCellValue(e,!1,t,n).toString();return d&&this.updateDependentCell(e),c}return this.computeValue(e,!1,r)},a.prototype.isDate=function(e){if("object"==typeof e||null!==Date.parse(e)){var t=void 0;return(t="string"==typeof e?this.checkDateFormat(e):new Date(Date.parse(e)))>=this.dateTime1900?t:null}return null},a.prototype.isValidCellReference=function(t){var r=0,n=0,i=[89,71,69],a=this.emptyString;if(this.namedRanges.has(t))return!1;for(var s=0;s<t.length;s++)this.isChar(t[s])&&r++;if((a=t.substring(0,r)).length<4){for(;n<a.length;){if((0,e.isNullOrUndefined)(a[n])||!(a[n].charCodeAt(0)<i[n])){if((0,e.isNullOrUndefined)(a[n])&&n>0)break;return!1}n++}if(this.parseFloat(t.substring(r,t.length))<1048576)return!0}return!1},a.prototype.parseDate=function(e){if(!this.isNaN(e)){if(e instanceof Date)return new Date(e);var t=parseInt(e,10);return t<0?this.getErrorStrings()[zn.Num]:t<=60?new Date(this.dateTime1900.getTime()+864e5*(t-1)):new Date(this.dateTime1900.getTime()+864e5*(t-2))}return"string"!=typeof e||(e=this.checkDateFormat(e,!0),this.isNaN(e))?this.getErrorStrings()[zn.Value]:e},a.prototype.checkDateFormat=function(e,t){if("spreadsheet"===this.parentObject.getModuleName()&&"en-US"!==this.parentObject.locale){var r={value:e,cell:{value:e}};if(this.parentObject.notify("checkDateFormat",r),r.isDate)return r.dateObj}return t?new Date(e):new Date(Date.parse(e))},a.prototype.isCellReference=function(e){if((e=e.trim())===this.emptyString)return!1;e=this.setTokensForSheets(e);var t=this.getSheetToken(e),r=!1;""!==t&&(e=e.split(t).join(this.emptyString));var n=!1,i=!1;if(e.indexOf(":")!==e.lastIndexOf(":"))return!1;for(var a=e.split("").join(this.getParseArgumentSeparator()).split(this.getParseArgumentSeparator()),s=0;s<a.length;s++)if(this.isChar(a[s]))n=!0;else if(this.isDigit(a[s]))i=!0;else{if(":"!==a[s])return!1;n&&i&&(r=!0),n=!1,i=!1}return e.indexOf(":")>-1&&-1===e.indexOf(this.tic)?!!(r&&n&&i)||!(!(n&&!i||!n&&i)||r):!!(n&&i&&-1===e.indexOf(this.tic)&&this.isValidCell(e))},a.prototype.setTokensForSheets=function(e){var t=this.getSheetFamilyItem(this.grid),r=this.getSortedSheetNames();if(null!=r)for(var n=0;n<r.length;n++){var i=t.sheetNameToToken.get(r[n]);i=i.split(this.sheetToken).join(this.tempSheetPlaceHolder);var a=this.singleTic+"SHEET"+r[n]+this.singleTic+this.sheetToken;-1===e.indexOf(a)&&(a="SHEET"+r[n]+this.sheetToken),e=e.split(a).join(i),a=r[n]+this.sheetToken,e=e.split(a).join(i)}if((e=e.split(this.tempSheetPlaceHolder).join(this.sheetToken)).indexOf("!!")>-1){var s=(e=e.replace("!!","!")).split("!");s[1]=(parseInt(s[1],10)+1).toString(),e=s.join("!")}return e},a.prototype.getParentObjectCellValue=function(e,t,r,n){if(e===this.trueValue||e===this.falseValue)return e;var i,a=e.lastIndexOf(this.sheetToken),s=this.grid;if(a>-1){if(null===(o=this.getSheetFamilyItem(s)).tokenToParentObject)return this.getErrorStrings()[zn.Value];this.grid=o.tokenToParentObject.get(e.substring(0,a+1)),i=e.substring(a+1)}else{for(var o,l=0;l<e.length&&this.isChar(e[l]);)l++;if(l===e.length)return""===e?this.getErrorStrings()[zn.Value]:this.getErrorStrings()[zn.Name];i=e,(o=this.getSheetFamilyItem(s)).isSheetMember&&null!=o.parentObjectToToken&&(e=o.parentObjectToToken.get(this.grid)+e)}if(this.isDigit(i[0])){var d=i.search(/[a-zA-Z]/);d>0&&(i=i.substring(d,i.length)+i.substring(0,d))}var h,p=this.rowIndex(i),c=this.colIndex(i);if(p>0&&p<=1048576&&c>0&&c<=16384){var u=this.getSheetId(this.grid);if(this.parentObject.notify){var f={action:"getSheetInfo",sheetInfo:[]};if(this.parentObject.notify(pe,f),-1===bn(this.parentObject,"Sheet"+u,f.sheetInfo))return this.grid=s,this.getErrorStrings()[zn.Ref]}h=this.getCellValueFn(s,this.cell,u,!1,t,r,n)(p,c,e)}else h=this.getErrorStrings()[zn.Name];return this.grid=s,h},a.prototype.getCellValueFn=function(t,r,n,i,a,s,o){var l=this,d=r;d&&(d=t===this.grid?"":d+","+("string"==typeof t&&Number(t)>-1?t:this.getSheetID(t)));var h=this.parentObject.getValueRowCol.bind(this.parentObject)||this.getValueRowCol.bind(this);return function(t,p,c){if(r===c&&!s)throw l.formulaErrorStrings[_n.CircularReference];l.cell=c;var u=h(n,t,p,d,a,s,o);if((0,e.isNullOrUndefined)(u))u=l.emptyString;else{u=u.toString();var f=l.getParseDecimalSeparator();if("."!==f&&u.includes(f)){var g=u.replace(f,".");l.isNumber(g)&&(u=g)}}return l.cell=r,i&&l.updateDependentCell(c),u}},a.prototype.isValidCell=function(e){if(0===e.search(/\d/)){var t=e.search(/[a-zA-Z]/);e=e.substring(t,e.length)+e.substring(0,t)}var r=this.rowIndex(e),n=this.colIndex(e);return r>0&&r<=1048576&&n>0&&n<=16384},a.prototype.getSheetId=function(e){return e&&"string"==typeof e&&Number(e)>-1?Number(e):this.getSheetID(e)+1},a.prototype.getValueRowCol=function(e,t,r){var n=this.rowsToKeyMap.get(t).toString(),i=this.getKeyValue(n).toString();if(null!=i&&"%"===i[i.length-1]&&i.length>1){var a=this.parseFloat(i.substring(0,i.length-1));this.isNaN(a)&&(i=(Number(a)/100).toString())}return i},a.prototype.defineFunction=function(t,r,n){"string"==typeof r&&(r=(0,e.getValue)(r,window)),t=t.toUpperCase(),this.libraryFormulas.set(t,{handler:r,isCustom:!0,description:n})},a.prototype.valueChanged=function(t,r,n,i,a,s,o,l,d,h,p,c){var u=t;this.spreadSheetUsedRange=i,this.grid=t;var f=!0,g=!0,m=this.getSheetFamilyItem(u),v=Ao(r.getColIndex())+r.getRowIndex().toString();(this.actCell=s+"!"+v,null!==m.sheetNameToParentObject&&m.sheetNameToParentObject.size>0)&&(v=m.parentObjectToToken.get(u)+v);var y=r.getValue().toUpperCase();if(y.indexOf("=RAND()")>-1||y.indexOf("=NOW()")>-1||y.indexOf("NOW()")>-1||y.indexOf("RAND()")>-1||y.indexOf("=RANDBETWEEN(")>-1||y.indexOf("RANDBETWEEN(")>-1||this.randomValues.has(v)){var C=this.randCollection.toString();this.randomValues.has(v)?this.randomValues.has(v)&&(y.indexOf("=RAND()")>-1||y.indexOf("=NOW()")>-1||y.indexOf("NOW()")>-1||y.indexOf("RAND()")>-1||y.indexOf("=RANDBETWEEN(")>-1||y.indexOf("RANDBETWEEN(")>-1?this.randomValues.set(v,r.getValue()):r.getValue().toUpperCase()!==this.randomValues.get(v.toUpperCase())&&(this.randomValues.delete(v),C=C.split(v+this.parseArgumentSeparator).join("").split(this.parseArgumentSeparator+v).join("").split(v).join(""),this.randCollection=C.split(this.parseArgumentSeparator)),0===this.randomValues.size&&this.randCollection.length&&(this.isRandomVal=!1,this.randomValues.clear(),this.randCollection=[])):(this.randomValues.set(v,r.getValue()),this.randCollection.push(v),this.isRandomVal=!0)}if(r.getValue()&&r.getValue()[0]===this.getFormulaCharacter()){this.cell=v;var b=void 0;if((0,e.isNullOrUndefined)(g)||(g=n),this.getFormulaInfoTable().has(v)){if(b=this.getFormulaInfoTable().get(v),r.getValue()!==b.getFormulaText()||null==b.getParsedFormula()){b.setFormulaText(r.getValue()),this.getDependentFormulaCells().has(this.cell)&&this.clearFormulaDependentCells(this.cell);try{b.setParsedFormula(this.parser.parseFormula(r.getValue()))}catch(e){b.setFormulaValue(e),g=!1}}else this.parser.isError=!1;if(g)this.parser.isFormulaParsed=!0,f=(x=this.calculateFormula(b.getParsedFormula(),a))!==b.getFormulaValue()&&(!this.parentObject.isEdit||x!==this.formulaErrorStrings[_n.CircularReference]),b.setFormulaValue(x)}else{(b=new Oo).setFormulaText(r.getValue()),this.getDependentFormulaCells().has(v)||this.getDependentFormulaCells().set(v,new Map),this.getFormulaInfoTable().set(v,b);try{b.setParsedFormula(this.parser.parseFormula(r.getValue()))}catch(e){b.setFormulaValue(e),g=!1}var x;if(g)f=(x=this.calculateFormula(b.getParsedFormula(),a))!==this.formulaErrorStrings[_n.CircularReference],b.setFormulaValue(x)}g&&(void 0===this.parentObject.setValueRowCol?this.setValueRowCol(this.getSheetID(u)+1,b.getFormulaValue(),r.getRowIndex(),r.getColIndex()):this.parentObject.setValueRowCol(this.getSheetId(u),b.getFormulaValue(),r.getRowIndex(),r.getColIndex(),b.getFormulaText(),o))}else this.getFormulaInfoTable().has(v)&&(this.getFormulaInfoTable().delete(v),this.getDependentFormulaCells().has(v)&&this.clearFormulaDependentCells(v));g&&f&&this.getDependentCells().has(v)&&("Automatic"===this.parentObject.calculationMode||!this.parentObject.isEdit||p)&&this.getDependentCells().get(v).toString()!==v&&this.refresh(v,void 0,void 0,l,d,h,p,c)},a.prototype.setValueRowCol=function(e,t,r,n){},a.prototype.getSortedSheetNames=function(){var e=this.getSheetFamilyItem(this.grid);if(null!=e&&null!=e.sheetNameToToken){var t=[];e.sheetNameToToken.forEach((function(e,r){t.push(r),t.sort()})),this.sortedSheetNames=t,this.sortedSheetNames.sort(),this.sortedSheetNames.length>9&&this.sortedSheetNames[0].includes("1")&&this.sortedSheetNames[1].includes("10")&&(this.sortedSheetNames.splice(this.sortedSheetNames.indexOf("2"),0,this.sortedSheetNames[0]),this.sortedSheetNames.splice(0,1))}return this.sortedSheetNames},a.prototype.getErrorLine=function(e){var t=e.stack?e.stack.split("\n")[1].split(":"):null;return t?t[t.length-2]:null},a.prototype.createSheetFamilyID=function(){return this.sheetFamilyID===Number.MAX_SAFE_INTEGER&&(this.sheetFamilyID=Number.MIN_SAFE_INTEGER),this.sheetFamilyID++},a.prototype.computeMinMax=function(t,r){var n,i,a=!1;if(t.length&&"isSubtotal"===t[t.length-1]&&(a=!0,t.pop()),(0,e.isNullOrUndefined)(t)||0===t.length)return this.formulaErrorStrings[_n.WrongNumberArguments];n="max"===r?this.minValue:this.maxValue;for(var s=0,o=t.length;s<o;s++)t[s].split(this.tic).join("").trim()===this.emptyString&&(n=0);var l=t;if(l.length>255)return this.getErrorStrings()[zn.Value];for(var d=0;d<l.length;d++)if(l[d].indexOf(":")>-1&&this.isCellReference(l[d])){for(var h=this.getCellCollection(l[d]),p=0;p<h.length;p++)if(i=a?this.getValueFromArg(h[p],null,null,!0):this.getValueFromArg(h[p]),!a||!i.includes("SUBTOTAL(")){var c=this.parseFloat(i);""===i||this.isNaN(this.parseFloat(c))||this.getErrorStrings().indexOf(i)>-1||(n="max"===r?Math.max(n,c):Math.min(n,c))}}else{var u=a?this.getValueFromArg(l[d],null,null,!0):this.getValueFromArg(l[d]);if(a&&u.includes("SUBTOTAL("))continue;c=0;var f=this.isCellReference(l[d]),g=""===u&&f,m=this.isNaN(this.parseFloat(u))&&f,v=u===(this.trueValue||this.falseValue)&&f;if(l[d]=l[d].startsWith("n")?l[d].slice(1):l[d],this.getErrorStrings().indexOf(u)>-1)return u;if(u===this.trueValue&&l[d]===this.trueValue)u="1";else if(u===this.falseValue&&l[d]===this.falseValue)u="0";else if(g||m||v)continue;if(u.indexOf('"')>-1&&(u=u.split(this.tic).join("")),this.isNaN(this.parseFloat(u)))return this.getErrorStrings()[zn.Value];c=this.parseFloat(u),n="max"===r?Math.max(n,c):Math.min(n,c)}return n!==this.minValue&&n!==this.maxValue||(n=0),n.toString()},a.prototype.calculateAvg=function(t,r){for(var n,i,a=t,s=[],o=0,l=0,d=0;d<a.length;d++)if(this.isCellReference(a[d]))if(a[d].indexOf(":")>-1){s=this.getCellCollection(a[d]);for(var h=0;h<s.length;h++)if(n=r?this.getValueFromArg(s[h],null,null,!0):this.getValueFromArg(s[h]),!r||!n.includes("SUBTOTAL(")){if(this.getErrorStrings().indexOf(n)>-1)return n;(0,e.isNullOrUndefined)(n)||isNaN(this.parseFloat(n))||""===n||(o+=this.parseFloat(n),l+=1)}}else{if(n=r?this.getValueFromArg(a[d],null,null,!0):this.getValueFromArg(a[d]),r&&n.includes("SUBTOTAL("))continue;if(this.getErrorStrings().indexOf(n)>-1)return n;if((0,e.isNullOrUndefined)(n)||isNaN(this.parseFloat(n))||""===n)continue;o+=this.parseFloat(n),l+=1}else{if(a[d].indexOf(this.tic)>-1&&(isNaN(this.parseFloat(a[d].split(this.tic).join("")))||""===a[d].split(this.tic).join("").trim()))return this.getErrorStrings()[zn.Value];if(0!==a[d].length&&t[d]!==this.falseValue||(a[d]="0"),t[d]===this.trueValue&&(a[d]="1"),i=this.getValueFromArg(a[d].split(this.tic).join("")),this.getErrorStrings().indexOf(i)>-1)return i;o+=this.parseFloat(i),l+=1}return 0===l?this.getErrorStrings()[zn.DivZero]:(o/l).toString()},a.prototype.registerGridAsSheet=function(t,r,n){(0,e.isNullOrUndefined)(this.modelToSheetID)&&(this.modelToSheetID=new Map),(0,e.isNullOrUndefined)(this.modelToSheetID.get(r))&&this.modelToSheetID.set(r,n);var i=this.getSheetFamilyItem(r);i.isSheetMember=!0;var a=t.toUpperCase();if(0===i.parentObjectToToken.size&&(i.parentObjectToToken=new Map),0===i.sheetNameToParentObject.size&&(i.sheetNameToParentObject=new Map),0===i.sheetNameToToken.size&&(i.sheetNameToToken=new Map),0===i.tokenToParentObject.size&&(i.tokenToParentObject=new Map),(0,e.isUndefined)(i.sheetNameToParentObject.get(a))){s=this.sheetToken+this.tokenCount.toString()+this.sheetToken;this.tokenCount++,i.tokenToParentObject.set(s,r),i.parentObjectToToken.set(r,s),i.sheetNameToToken.set(a,s),i.sheetNameToParentObject.set(a,r)}else{var s=i.sheetNameToToken.get(a);i.tokenToParentObject.set(s,r),i.parentObjectToToken.set(r,s)}return t},a.prototype.unregisterGridAsSheet=function(t,r,n){var i=this,a=[r];n&&(a=[],(0,e.isNullOrUndefined)(this.modelToSheetID)||this.modelToSheetID.forEach((function(e,t){a.push(t)}))),a.forEach((function(e){var r=i.getSheetFamilyItem(e),a=(n?e:t).toUpperCase();if(null!=r.sheetNameToParentObject&&r.sheetNameToParentObject.has(a)){r.sheetNameToParentObject.delete(a);var s=r.sheetNameToToken.get(a);r.sheetNameToToken.delete(a),r.tokenToParentObject.delete(s),r.parentObjectToToken.delete(e)}}))},a.prototype.computeExpression=function(e,t){var r=this.parser.parseFormula(e);return this.computeFormula(r,t)},a.prototype.isSheetMember=function(){var t=this.getSheetFamilyItem(this.grid);return!(0,e.isNullOrUndefined)(t)&&t.isSheetMember},a.prototype.dispose=function(){this.resetKeys(),this.namedRanges.clear(),this.lFormulas.clear()},a.prototype.refreshRandValues=function(e){var t,r,n,i,a="";if(this.randomValues.has(e)){this.randomValues.delete(e);var s=this.randCollection.indexOf(e);s>-1&&this.randCollection.splice(s,1),0!==this.randomValues.size||this.randCollection.length||(this.randomValues.clear(),this.randCollection=[])}for(var o=0;o<this.randomValues.size;o++)t=this.rowIndex(this.randCollection[o]),r=this.colIndex(this.randCollection[o]),a=(parseFloat(this.getSheetToken(this.randCollection[o]).split(this.sheetToken).join(""))+1).toString(),i=this.getSheetFamilyItem(a),this.grid=i.sheetNameToParentObject.get(a),n=this.randomValues.get(this.randCollection[o]),n=this.computeFormula(n),void 0===this.parentObject.setValueRowCol?this.setValueRowCol(this.getSheetID(this.grid)+1,n,t,r):this.parentObject.setValueRowCol(this.getSheetId(this.grid),n,t,r)},a.prototype.refresh=function(e,t,r,n,a,s,o,l){var d,h=this;r||(d=!0,r=[]);var p=this.getSheetFamilyItem(this.grid);try{var c=this.getDependentCells().get(e);if(c&&0!==c.length&&("Automatic"===this.parentObject.calculationMode||o||"calculate"===l)){var u=void 0;for(u=0;u<c.length;u++){var f=c[u];if(!(t&&f.indexOf(t)>-1||f===e||r.indexOf(f)>-1)){var g=this.getSheetToken(f),m=this.parentObject.sheets,v=this.parentObject.activeSheetIndex;if(g.length){this.grid=p.tokenToParentObject.get(g);var y=Number(this.grid),C="";if(!this.isNaN(y)&&m)for(var b=0;b<m.length;b++)m[b].id===y&&(C=m[b].name,v=b);this.actCell=C+"!"+f.split(g)[1]}else this.actCell=f.split(g)[1];try{var x=function(e,t){t&&(h.cell=e,h.parser.isFormulaParsed=!0,t.setFormulaValue(h.calculateFormula(t.getParsedFormula(),!0)))},S=this.rowIndex(f),w=this.colIndex(f),I=this.getFormulaInfoTable().get(f);if(void 0===this.parentObject.setValueRowCol)x(f,I),this.setValueRowCol(this.getSheetID(this.grid)+1,I.getFormulaValue(),S,w);else{var E=m&&m[v].rows&&m[v].rows[S-1]&&m[v].rows[S-1].cells&&m[v].rows[S-1].cells[w-1],N=void 0;if(E&&E.formula&&E.formula.toLowerCase().includes("unique")){if(this.uniqueCells&&-1!==this.uniqueCells.indexOf(f))continue;this.uniqueCells||(this.uniqueCells=[]),this.uniqueCells.push(f),x(f,I),N=I.getFormulaValue(),this.uniqueCells.splice(this.uniqueCells.indexOf(f),1),this.uniqueCells.length||(this.uniqueCells=null)}else-1===r.indexOf(f)&&r.push(f),N=null;this.parentObject.setValueRowCol(this.getSheetId(this.grid),N,S,w,I.getFormulaText())}this.refresh(f,null,r,null,a)}catch(e){continue}}}}if(d){if(!a&&s&&4===s.length){g=this.getSheetToken(e);for(var R=[],O=s[0],k=s[2];O<=k;O++)for(var A=s[1],F=s[3];A<=F&&(O!==k||A!==F);A++){E=g+i(O,A);this.refresh(E,null,r,null,a),R.push(E)}var T=new Set(R);r&&(r=r.filter((function(e){return!T.has(e)})))}var D=this.parentObject.sheets;D||(r=[]),r.forEach((function(e){for(var t,r=h.getSheetId(p.tokenToParentObject.get(h.getSheetToken(e))),i=0;i<D.length;i++)if(D[i].id===r){t=i;break}var a=h.rowIndex(e)-1,s=h.colIndex(e)-1,o=D[t].rows[a]&&D[t].rows[a].cells[s];o&&h.parentObject.notify("calculateFormula",{cell:o,rowIdx:a,colIdx:s,sheetIndex:t,isDependentRefresh:!0,isRandomFormula:n,action:l})}))}}finally{this.getDependentCells().has(e)&&(this.grid=p.tokenToParentObject.get(this.getSheetToken(e)))}},Eo([(0,e.Property)(!0)],a.prototype,"includeBasicFormulas",void 0),Eo([(0,e.Event)()],a.prototype,"onFailure",void 0),a=s=Eo([e.NotifyPropertyChanges],a)}(e.Base),Ro=function(e,t){this.formulaCorrection=!1,this.message=e,this.formulaCorrection=t},Oo=function(){function e(){this.calcID=Number.MIN_VALUE+1,this.calcID1=Number.MIN_VALUE+1}return e.prototype.getFormulaText=function(){return this.formulaText},e.prototype.setFormulaText=function(e){this.formulaText=e},e.prototype.getFormulaValue=function(){return this.formulaValue},e.prototype.setFormulaValue=function(e){this.formulaValue=e},e.prototype.getParsedFormula=function(){return this.parsedFormula},e.prototype.setParsedFormula=function(e){this.parsedFormula=e},e}(),ko=function(){this.isSheetMember=!1,this.parentObjectToToken=new Map,this.sheetDependentFormulaCells=new Map,this.sheetNameToParentObject=new Map,this.sheetNameToToken=new Map,this.tokenToParentObject=new Map,this.sheetFormulaInfotable=new Map};function Ao(e){for(var t=[],r=0;e>0&&r<9;){e--;var n="A".charCodeAt(0);t[r]=String.fromCharCode(e%26+n),e=parseInt((e/26).toString(),10),r++}for(var i=[],a=0;a<r;a++)i[r-a-1]=t[a];return i.join("")}var Fo,To,Do=function(e,t,r){return this.row=e,this.col=t,this.value=r,this.getRowIndex=function(){return e},this.setRowIndex=function(t){e=t},this.getColIndex=function(){return t},this.setColIndex=function(e){t=e},this.getValue=function(){return r},this},Lo=function(){function r(e){this.uniqueOBracket=String.fromCharCode(129),this.uniqueCBracket=String.fromCharCode(130),this.uniqueCSeparator=String.fromCharCode(131),this.uniqueCOperator=String.fromCharCode(132),this.uniquePOperator=String.fromCharCode(133),this.uniqueSOperator=String.fromCharCode(134),this.uniqueMOperator=String.fromCharCode(135),this.uniqueDOperator=String.fromCharCode(136),this.uniqueModOperator=String.fromCharCode(137),this.uniqueConcateOperator=String.fromCharCode(138),this.uniqueEqualOperator=String.fromCharCode(139),this.uniqueExpOperator=String.fromCharCode(140),this.uniqueGTOperator=String.fromCharCode(141),this.uniqueLTOperator=String.fromCharCode(142),this.sheetInfo=[],this.parent=e,this.init()}return r.prototype.init=function(){var e=this;this.addEventListener(),this.initCalculate(),this.registerSheet(),this.parent.customFormulaCollection.forEach((function(t,r){e.addCustomFunction(t.handler,r,t.description)}))},r.prototype.destroy=function(){var e=this;(this.removeEventListener(),this.parent.refreshing)&&(this.clearAllUniqueFormulaValue(),this.calculateInstance.getLibraryFormulas().forEach((function(t,r){t.isCustom&&e.parent.customFormulaCollection.set(r,{handler:t.handler,description:t.description})})));this.calculateInstance.dispose(),this.calculateInstance=null,this.sheetInfo&&(this.sheetInfo=[]),this.parent=null},r.prototype.addEventListener=function(){this.parent.on(pe,this.performFormulaOperation,this),this.parent.on(Se,this.aggregateComputation,this),this.parent.on(we,this.getUniqueRange,this),this.parent.on(Ie,this.removeUniquecol,this),this.parent.on(Re,this.clearFormulaDependentCells,this),this.parent.on(Oe,this.formulaInValidation,this),this.parent.on(nr,this.refreshInsertDelete,this),this.parent.on(ir,this.getUpdatedFormulaOnInsertDelete,this),this.parent.on(lr,this.autoCorrectCellRef,this),this.parent.on(dr,this.parseFormulaArgument,this),this.parent.on(hr,this.getCellRefValue,this),this.parent.on(pr,this.commputeFormulaValue,this)},r.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(pe,this.performFormulaOperation),this.parent.off(Se,this.aggregateComputation),this.parent.off(we,this.getUniqueRange),this.parent.off(Ie,this.removeUniquecol),this.parent.off(Re,this.clearFormulaDependentCells),this.parent.off(Oe,this.formulaInValidation),this.parent.off(nr,this.refreshInsertDelete),this.parent.off(ir,this.getUpdatedFormulaOnInsertDelete),this.parent.off(lr,this.autoCorrectCellRef),this.parent.off(dr,this.parseFormulaArgument),this.parent.off(hr,this.getCellRefValue),this.parent.off(pr,this.commputeFormulaValue))},r.prototype.getModuleName=function(){return"workbookFormula"},r.prototype.initCalculate=function(){this.calculateInstance=new No(this.parent),this.calcID=this.calculateInstance.createSheetFamilyID(),this.calculateInstance.setTreatEmptyStringAsZero(!0),this.calculateInstance.grid=this.parent.getActiveSheet().id.toString(),this.calculateInstance.setParseArgumentSeparator(this.parent.listSeparator);var t=(0,e.getNumericObject)(this.parent.locale).decimal;"."!==t&&this.parent.listSeparator!==t&&this.calculateInstance.setParseDecimalSeparator(t)},r.prototype.clearFormulaDependentCells=function(t){if(t.isOpen)return this.calculateInstance.getDependentCells().clear(),this.calculateInstance.getFormulaInfoTable().clear(),void this.calculateInstance.getDependentFormulaCells().clear();var r=t.cellRef.split(":")[0],n=this.parent.getActiveSheet().id.toString(),i=this.calculateInstance.getSheetFamilyItem(n);i.isSheetMember&&!(0,e.isNullOrUndefined)(i.parentObjectToToken)&&(r=i.parentObjectToToken.get(n)+r),t.clearFormulaInfo&&this.calculateInstance.getFormulaInfoTable().has(r)&&this.calculateInstance.getFormulaInfoTable().delete(r),this.calculateInstance.clearFormulaDependentCells(r)},r.prototype.formulaInValidation=function(t){var r=this.calculateInstance.getLibraryFormulas().get(t.value);t.skip=(0,e.isNullOrUndefined)(r)},r.prototype.performFormulaOperation=function(t){var r,n,i,a=t.action;"refreshCalculate"!==a&&(r=this.calculateInstance.getLibraryFormulas(),n=Array.from(r.values()));var s=this.calculateInstance.getSheetFamilyItem(t.sheetId);switch(a){case"getLibraryFormulas":t.formulaCollection=Array.from(r.keys());break;case"getFormulaCategory":i=["All"];for(var o=1;o<Array.from(r.values()).length;o++)i.indexOf(n[o].category)<0&&i.push(n[o].category);t.categoryCollection=i;break;case"dropDownSelectFormulas":for(o=0;o<Array.from(r.values()).length;o++)t.selectCategory===n[o].category&&(t.formulaCollection[o]=Array.from(r.keys())[o]);break;case"getFormulaDescription":for(o=0;o<Array.from(r.values()).length;o++)t.selectedList===Array.from(r.keys())[o]&&(t.description=n[o].description,t.isCustom=n[o].isCustom);break;case"registerSheet":this.registerSheet(t.sheetIndex,t.sheetCount),t.isImport&&(this.calculateInstance.setParseArgumentSeparator(this.parent.listSeparator),this.updateSheetInfo());break;case"unRegisterSheet":this.unRegisterSheet(t.sheetIndex,t.sheetCount,t.propertyChange);break;case"initSheetInfo":this.updateSheetInfo();break;case"refreshCalculate":this.refreshCalculate(t);break;case"refreshRandomFormula":this.refreshRandomFormula(),this.calculateInstance.cell="";break;case"setArgumentSeparator":this.calculateInstance.setParseArgumentSeparator(this.parent.listSeparator);break;case"addDefinedName":t.isAdded=this.addDefinedName(t.definedName,!1,t.index,t.isEventTrigger);break;case"removeDefinedName":t.isRemoved=this.removeDefinedName(t.definedName,t.scope,t.isEventTrigger);break;case"initiateDefinedNames":this.initiateDefinedNames();break;case"renameUpdation":this.renameUpdation(t.value,t.pName);break;case"addSheet":this.sheetInfo.push({visibleName:t.visibleName,sheet:t.sheetName,index:t.sheetId});break;case"getSheetInfo":t.sheetInfo=this.sheetInfo;break;case"deleteSheetTab":for(o=0;o<this.sheetInfo.length;o++)if(this.sheetInfo[o].index===t.sheetId){var l=this.sheetInfo[o].visibleName,d=this.sheetInfo[o].sheet;this.sheetInfo.splice(o,1);var h=t.sheetId.toString();this.sheetDeletion(d,h),this.calculateInstance.unregisterGridAsSheet(h,h),this.definedNamesDeletion(l);break}break;case"getReferenceError":t.refError=this.referenceError();break;case"getAlpha":t.col=Ao(t.col);break;case"addCustomFunction":this.addCustomFunction(t.functionHandler,t.functionName,t.formulaDescription);break;case"computeExpression":t.calcValue=this.calculateInstance.computeExpression(t.formula,t.isFromComputeExpression);break;case"registerGridInCalc":this.calculateInstance.grid=t.sheetID;break;case"dependentCellsAvailable":case"checkFormulaAdded":s.isSheetMember&&!(0,e.isNullOrUndefined)(s.parentObjectToToken)&&(t.address=s.parentObjectToToken.get(t.sheetId)+t.address),"checkFormulaAdded"===a?t.added=this.calculateInstance.getFormulaInfoTable().has(t.address):t.isAvailable=this.calculateInstance.getDependentCells().has(t.address);break;case"calculateNow":this.calculateNow(t);break;case"ClearDependentCellCollection":this.calculateInstance.getDependentFormulaCells().clear(),this.calculateInstance.getDependentCells().clear(),this.calculateInstance.getFormulaInfoTable().clear()}},r.prototype.definedNamesDeletion=function(e){var t=this.parent.definedNames;if(t&&t.length>0)for(var r=t.length-1;r>=0;r--)t[r].refersTo.substring(1,t[r].refersTo.lastIndexOf("!")).split("'").join("")===e&&this.removeDefinedName(t[r].name,t[r].scope)},r.prototype.referenceError=function(){return this.calculateInstance.getErrorStrings()[zn.Ref]},r.prototype.getSheetInfo=function(){return this.sheetInfo},r.prototype.addCustomFunction=function(e,t,r){this.calculateInstance.defineFunction(t,e,r)},r.prototype.updateSheetInfo=function(){var e=this;this.sheetInfo=[],this.parent.sheets.forEach((function(t){e.sheetInfo.push({visibleName:t.name,sheet:"Sheet"+t.id,index:t.id})}))},r.prototype.getSheetRefUpdateOnDelete=function(){var e,t,r,n=this,i=this.calculateInstance.namedRanges;return i&&i.size&&(r=!0,e=Array.from(i.keys()),t=Array.from(i.values())),function(i,a){var s;r&&!a.includes(i)&&(a=a.replace(/\w+/g,(function(r){var n=e.indexOf(r);return-1!==n?(s=!0,t[n]):r})));for(var o=i.toUpperCase(),l=(a=a.toUpperCase()).indexOf(o);l>-1;)l=(a=a.split(("'"===a[l-1]&&"'"===a[l+o.length]?"'"+o+"'":o)+n.calculateInstance.sheetToken).join(n.referenceError())).indexOf(o);return{value:a,isNamedRange:s}}},r.prototype.sheetDeletion=function(t,r){var n,i,a,s=this,o=this.calculateInstance.getDependentCells(),l=this.calculateInstance.getSheetFamilyItem(r),d=this.getSheetRefUpdateOnDelete();o.forEach((function(o,h){o.forEach((function(o){n=s.calculateInstance.getFormulaInfoTable().get(o),(0,e.isNullOrUndefined)(n)||(a=d(t,n.formulaText)).value!==n.formulaText&&(i=o.slice(0,o.lastIndexOf(s.calculateInstance.sheetToken)+1),a.sheetId=l.tokenToParentObject.has(i)?Number(l.tokenToParentObject.get(i)):parseInt(o.split("!")[1],10)+1,s.updateDataContainer([s.calculateInstance.rowIndex(o)-1,s.calculateInstance.colIndex(o)-1],a),s.calculateInstance.refresh(n.getParsedFormula())),i=h.slice(0,h.lastIndexOf(s.calculateInstance.sheetToken)+1),r===(l.tokenToParentObject.has(i)?l.tokenToParentObject.get(i):h.split("!")[1])&&(s.calculateInstance.getFormulaInfoTable().delete(h),s.calculateInstance.clearFormulaDependentCells(h))}))}))},r.prototype.renameUpdation=function(e,t){var r,n,i=this,a=t.toUpperCase(),s=new RegExp("[!@#$%^&()+=';,.{}|\\\":<>~_-]","g"),o=new RegExp(t.replace(s,"\\$&")+'(?=[\'!])(?=[^"]*(?:"[^"]*"[^"]*)*$)',"gi"),l=function(t){xr(t.value1)&&t.value1.toUpperCase().includes(a)&&t.value1.match(o)&&(t.value1=t.value1.replace(o,e)),xr(t.value2)&&t.value2.toUpperCase().includes(a)&&t.value2.match(o)&&(t.value2=t.value2.replace(o,e))};this.sheetInfo.forEach((function(s,d){if((r=In(i.parent,d))&&r.rows&&r.rows.length)for(var h=0,p=r.rows.length;h<p;h++)if(r.rows[h]&&r.rows[h].cells)for(var c=0,u=r.rows[h].cells.length;c<u;c++)(n=Ln(h,c,r,!1,!0)).formula&&xr(n.formula)&&n.formula.toUpperCase().includes(a)&&n.formula.match(o)&&(n.formula=n.formula.replace(o,e)),n.validation&&l(n.validation);if(r&&r.columns&&r.columns.length)for(var f=void 0,g=(h=0,r.columns.length);h<g;h++)(f=r.columns[h])&&f.validation&&l(f.validation);var m=i.parent.definedNames;for(h=0;h<m.length;h++)xr(m[h].refersTo)&&m[h].refersTo.includes(t)&&m[h].refersTo.match(o)&&(m[h].refersTo=m[h].refersTo.replace(o,e),m[h].scope.includes(t)&&(m[h].scope=e));i.calculateInstance.updateNamedRange(t,e),s.visibleName===t&&(s.visibleName=e)}))},r.prototype.updateDataContainer=function(e,t){for(var r,n,a,s=0,o=this.parent.sheets.length;s<o;s++)if((r=In(this.parent,s)).id===t.sheetId){e[0]in r.rows?(n=r.rows[e[0]],e[1]in n.cells?((a=n.cells[e[1]]).formula=t.isNamedRange?a.formula:t.value,t.visible?s===this.parent.activeSheetIndex&&r.activeCell===i(e[0],e[1])&&this.parent.notify(rr,{}):a.value=this.referenceError()):n.cells[e[1]]=a={}):(n=r.rows[e[0]]={})[e[1]]=a={};break}},r.prototype.parseSheetRef=function(e,t){var r,n,i,a,s,o,l=new RegExp("[!@#$%^&()+=';,.{}|\":<>~_-]","g"),d=0,h=this.getSheetInfo(),p=h.length,c=[];c.length=0;var u,f='(?=[\'!])(?=[^"]*(?:"[^"]*"[^"]*)*$)',g=RegExp;for(d=0;d<p;d++)if(h[d].sheet!==h[d].visibleName&&(r=new g(h[d].visibleName.replace(l,"\\$&")+f,"gi"),a=d,e.match(r))){for(var m=d+1;m<p;m++)h[m].visibleName.includes(h[d].visibleName)&&(n=new g(h[m].visibleName.replace(l,"\\$&")+f,"gi"),i=e.search(n),s=e.search(r),i>-1&&(i<s||i===s&&h[m].visibleName.length>h[d].visibleName.length)&&(o=new RegExp("Sheet","gi"),0!==h[m].visibleName.search(o)&&(r=n,a=m)));e=e.replace(r,a+"/"),c.push(a)}for(d=0;d<c.length;)r=new g(c[d]+"/"+f,"gi"),u=t?"`"+h[c[d]].sheet+"`":h[c[d]].sheet,e=e.replace(r,u),d++;return e},r.prototype.registerSheet=function(e,t){var r;for(void 0===e&&(e=0),void 0===t&&(t=this.parent.sheets.length);e<t;)r=In(this.parent,e).id+"",this.calculateInstance.registerGridAsSheet(r,r,this.calcID),e++},r.prototype.unRegisterSheet=function(e,t,r){var n;if(void 0===e&&(e=0),void 0===t&&(t=this.parent.sheets.length),this.calculateInstance.tokenCount=0,r)this.calculateInstance.unregisterGridAsSheet(n,n,r);else for(;e<t;)n=In(this.parent,e).id+"",this.calculateInstance.unregisterGridAsSheet(n,n),e++},r.prototype.getUniqueRange=function(e){e.range=this.calculateInstance.uniqueRange},r.prototype.removeUniquecol=function(e){if(e&&e.clearAll)this.clearAllUniqueFormulaValue();else for(var r=this.parent.getActiveSheet(),n=0;n<this.calculateInstance.uniqueRange.length;n++){var i=this.calculateInstance.uniqueRange[n].split(":")[0].split("!");if(i[0]===r.name&&i[1]===r.activeCell){var s=t(this.calculateInstance.uniqueRange[n]);this.calculateInstance.uniqueRange.splice(n,1);for(var o=s[0];o<=s[2];o++)for(var l=s[1];l<=s[3];l++){Ln(o,l,this.parent.getActiveSheet()).formula="",this.parent.updateCell({value:"",formula:""},a([o,l]))}}}},r.prototype.refreshCalculate=function(t){t.sheet=(0,e.isNullOrUndefined)(t.sheetIndex)?this.parent.getActiveSheet():In(this.parent,t.sheetIndex);var r=t.sheet.id+"",n=this.calculateInstance.getSheetFamilyItem(r),i=s(t.colIndex+1)+(t.rowIndex+1);n.isSheetMember&&!(0,e.isNullOrUndefined)(n.parentObjectToToken)&&(i=n.parentObjectToToken.get(r)+i),t.isFormula?this.calculateFormula(t,i):(this.calculateInstance.getFormulaInfoTable().has(i)&&(this.calculateInstance.getFormulaInfoTable().delete(i),this.calculateInstance.clearFormulaDependentCells(i)),this.calculateInstance.refresh(i,null,null,null,t.isDelete,t.deletedRange),"Automatic"===this.parent.calculationMode&&this.calculateInstance.refreshRandValues(i)),this.calculateInstance.cell="",t.isFormulaDependent=this.calculateInstance.getDependentCells().has(i),t.value&&(t.value=t.value.toString().split("^+").join("^").split("&+").join("&"))},r.prototype.calculateFormula=function(e,r){var n=this,i=e.sheet;this.autoCorrectFormula(e,i);var a=e.value;e.isClipboard&&a.toUpperCase().includes("UNIQUE")&&Pn(e.rowIndex,e.colIndex,i,{value:""},!0);var s=a;a=this.parseSheetRef(a);var o=new Do(e.rowIndex+1,e.colIndex+1,a),l=[i.usedRange.rowIndex,i.usedRange.colIndex];this.calculateInstance.valueChanged(i.id.toString(),o,!0,l,e.isRefreshing,i.name,e.isRandomFormula,null,e.isDelete,e.deletedRange,e.isDependentRefresh,e.action),!0!==this.calculateInstance.isRandomVal||e.isRandomFormula||"Automatic"!==this.parent.calculationMode||this.refreshRandomFormula();var d=Ln(e.rowIndex,e.colIndex,i);if(d&&s&&!e.isDependentRefresh){var h=void 0;if(0===(s=s.toUpperCase()).indexOf("=SUM(")?h="=SUM(":0===s.indexOf("=AVERAGE(")?h="=AVERAGE(":0===s.indexOf("=ROUNDDOWN(")?h="=ROUNDDOWN(":0===s.indexOf("=ROUNDUP(")?h="=ROUNDUP(":0===s.indexOf("=MOD(")&&(h="=MOD("),h){if((s=s.replace(h,"")).includes(")")){s=s.slice(0,s.lastIndexOf(")"));for(var p=void 0,c=void 0;s.includes("(")&&s.includes(")");)c=s.indexOf("("),p=s.slice(c+1),s=s.slice(0,c)+(p.includes(")")?p.slice(p.indexOf(")")+1):p)}var u,f=s.split(this.calculateInstance.getParseArgumentSeparator()),g=void 0,m=void 0,v=void 0,y=void 0,C=void 0;for(c=0;c<f.length;c++)if((u=f[c].split(":")[0]).includes("!")?(y=u.substring(0,u.lastIndexOf("!")).split("'").join(""),u=u.substring(u.lastIndexOf("!")+1)):y="",Sr(u)&&(m=y&&void 0!==(v=vn(this.parent,y))?In(this.parent,v):i,(g=Ln((C=t(u))[0],C[1],m))&&g.format&&(!e.fillType||!d.format))){d.format=g.format;break}}else{var b=this.calculateInstance.getDependentFormulaCells().get(r);if(b&&b.size&&this.calculateInstance.getFormulaInfoTable().has(r)&&-1===this.calculateInstance.getFormulaInfoTable().get(r).getParsedFormula().lastIndexOf("q")&&!d.format){var x,S,w,I,E,N,R=this.calculateInstance.getSheetFamilyItem(null,this.calcID);b.forEach((function(e){x||(w=e.slice(0,e.lastIndexOf("!")+1),Sr(e=e.replace(w,""))&&(N=t(e),R.tokenToParentObject.has(w)?(E=yn(n.parent,Number(R.tokenToParentObject.get(w))),I=void 0!==E?In(n.parent,E):i):I=i,(S=Ln(N[0],N[1],I))&&S.format&&(x=S.format)))})),x&&(d.format=x)}}}},r.prototype.refreshRandomFormula=function(){var e,t,r="",n=this.calculateInstance.randCollection;if(this.calculateInstance.randomValues.size>1&&this.calculateInstance.randomValues.size===n.length)for(var i=0;i<this.calculateInstance.randomValues.size;i++){e=this.calculateInstance.rowIndex(n[i]),t=this.calculateInstance.colIndex(n[i]),r=this.calculateInstance.randomValues.get(n[i]);var a=(parseFloat(this.calculateInstance.getSheetToken(n[i]).split(this.calculateInstance.sheetToken).join(""))+1).toString(),s=In(this.parent,yn(this.parent,Number(a)));if(s&&Ln(e-1,t-1,s).formula){var o=new Do(e,t,r);this.calculateInstance.valueChanged(a,o,!0,void 0,void 0,void 0,!1,!0)}}},r.prototype.autoCorrectFormula=function(t,r){if(!(0,e.isNullOrUndefined)(t.value)){var n=t.value;2===(n=(n=this.autoCorrectCellRef({formula:t.value})).toString()).split("(").length&&n.indexOf(")")<0&&(n+=")");var i=void 0;0===n.indexOf("=")&&(n=n.slice(1),i=!0);var a=n.match(/</g),s=n.match(/>/g),o=n.match(/=/g);if(a){for(var l="",d=0;d<a.length;d++)l+=a[d];n=n.replace(l,"<")}if(s){for(var h="",p=0;p<s.length;p++)h+=s[p];n=n.replace(h,">")}if(o){for(var c="",u=0;u<o.length;u++)c+=o[u];n=n.split(c).join("=")}n=i?"="+n:n,(a||s||o)&&(Ln(t.rowIndex,t.colIndex,r).formula=n),t.value=n}},r.prototype.correctCellReference=function(e){var t,r,n,i,a,s=this,o=e.split(":");return o.forEach((function(l,d){if(r=l.split("!"),e=r[1]||l,a=null,e.includes("&"))t=e.split("&"),s.calculateInstance.isCellReference(t[1].split("$").join(""))&&(t[1]=s.getUpdatedCellRef(t[1]),a=t.join("&"));else if(s.calculateInstance.isCellReference(e.split("$").join("")))a=s.getUpdatedCellRef(e),r.length>1&&(a=r[0]+"!"+a);else if(n=l.match(/[/+\-*^><>=<=<>]+/g)){t=l.split(n[0]);for(var h=0;h<t.length;h++)r=t[h].split("!"),e=r[1]||r[0],s.calculateInstance.isCellReference(e.split("$").join(""))&&(t[h]=s.getUpdatedCellRef(e),r.length>1&&(t[h]=r[0]+"!"+t[h]));a=t.join(n[0])}a&&a!==l&&(i=!0,o[d]=a)})),{isInvalid:i,ref:o.join(":")}},r.prototype.autoCorrectCellRef=function(e){var t,r=e.formula.lastIndexOf(")");if(r>-1&&2===e.formula.split(")").length){for(var n=r-1;n>-1&&"("!==e.formula[n];){if(")"===e.formula[n])return e.formula;n--}if(n>-1){for(var i=e.formula.substring(n+1,r),a=this.calculateInstance.getParseArgumentSeparator(),s=i.split(a),o=void 0,l=0;l<s.length;l++)(t=this.correctCellReference(s[l])).isInvalid&&(o=!0,s[l]=t.ref);o&&(e.formula=e.formula.split(i).join(s.join(a)),e.isInvalid=!0)}}else e.formula.startsWith("=")&&!e.formula.includes(")")&&(t=this.correctCellReference(e.formula.substring(1,e.formula.length))).isInvalid&&(e.formula="="+t.ref,e.isInvalid=!0);return e.formula},r.prototype.getUpdatedCellRef=function(e){var t=e,r=0===(e=e.trim()).indexOf("$"),n=e.search(/[a-zA-Z]/),i=e.search(/\d/);return n=r?n-1:n,(r?i>1:i>0)&&rn(e.substring(i,e.length))?t:e.substring(n,e.length)+e.substring(0,n)},r.prototype.initiateDefinedNames=function(){for(var e=this.parent.definedNames,t=0;t<e.length;){var r=e[t],n=this.parseSheetRef(r.refersTo),i=l(n),a=!1,s=n.indexOf("http:")>-1||n.indexOf("https:")>-1;if((i=(i=i.split("$").join("")).split("=").join("")).indexOf(":")>-1){var o=i.split(":");(Sr(o[0])&&Sr(o[1])||o[0].match(/[0-9]/)&&o[1].match(/[0-9]/)||o[0].toUpperCase().match(/[A-Z]/)&&o[1].toUpperCase().match(/[A-Z]/))&&(a=!0)}else i.indexOf(":")<0&&Sr(i)&&(a=!0);s&&(a=!1),a?this.addDefinedName(r,!0,void 0,!0):(this.removeDefinedName(r.name,r.scope,!0),t--),t++}},r.prototype.addDefinedName=function(e,t,r,n){(void 0===r||r<-1)&&(r=this.parent.definedNames.length);var i,a=!0,s=e.name;if(e.refersTo.indexOf("!")<0){var o=On(this.parent);o=-1!==o.indexOf(" ")?"'"+o+"'":o,e.refersTo=o+"!"+(e.refersTo.indexOf("=")<0?e.refersTo:e.refersTo.split("=")[1])}var l=e.refersTo,d=this.parseSheetRef(e.refersTo);e.scope?(i=vn(this.parent,e.scope))>-1&&(s=On(this.parent,i)+"!"+s):e.scope="",e.comment||(e.comment=""),!t&&this.checkIsNameExist(e.name,e.scope)?a=!1:(this.calculateInstance.addNamedRange(s,"="===d[0]?d.substr(1):d),"="!==d[0]&&(e.refersTo="="+l),this.parent.definedNames.indexOf(e)<0&&this.parent.definedNames.splice(r,0,e));var h={name:e.name,scope:e.scope,comment:e.comment,refersTo:e.refersTo,cancel:!1};return n||this.parent.notify("actionComplete",{eventArgs:h,action:"addDefinedName"}),a},r.prototype.removeDefinedName=function(e,t,r){var n=!1,i=this.getIndexFromNameColl(e,t);if(i>-1){var a=e;if(t){var s=vn(this.parent,t);s>-1&&(a=On(this.parent,s)+"!"+e)}if(this.calculateInstance.removeNamedRange(a),this.parent.definedNames.splice(i,1),!r){var o={name:e,scope:t,cancel:!1};this.parent.notify("actionComplete",{eventArgs:o,action:"removeDefinedName"})}n=!0}return n},r.prototype.checkIsNameExist=function(e,t){return this.parent.definedNames.some((function(r){return r.name===e&&(t?r.scope===t:""===r.scope)}))},r.prototype.getIndexFromNameColl=function(e,t){void 0===t&&(t="");var r=-1;return this.parent.definedNames.filter((function(n,i){n.name===e&&n.scope===t&&(r=i)})),r},r.prototype.calculateNow=function(e){var t,r=this,n=new br.Deferred;e.promise=n.promise;var a=e.sheets.length,o=function(){if(! --a){p={isRefreshing:!0,action:"calculate"},c=r.calculateInstance.getFormulaInfoTable(),e.sheets.forEach((function(e){d=e.id.toString(),o=r.calculateInstance.getSheetFamilyItem(d),l=o.isSheetMember?o.parentObjectToToken.get(d):"",r.parent.setSheetPropertyOnMute(e,"isSheetCalculated",!0),p.sheet=e,e.rows.forEach((function(e,n){p.rowIndex=n,e&&e.cells&&e.cells.forEach((function(e,i){e&&xr(e.formula)&&(h=l+s(i+1)+(n+1),(void 0===e.value||null===e.value||!c.has(h)||t&&t[h])&&(p.colIndex=i,p.value=e.formula,r.calculateFormula(p,h)))}))}))})),n.resolve(),r.calculateInstance.cell="","Automatic"===r.parent.calculationMode&&"CalculateWorkbook"===e.scope&&r.parent.setProperties({calculationMode:"Manual"},!0);var i=r.parent.getActiveSheet();i.conditionalFormats&&i.conditionalFormats.length&&r.parent.notify(kt,{indexes:[],isAction:!0,refreshAll:!0,isEdit:!0})}var o,l,d,h,p,c},l=function(e){var n=e.id.toString(),a=r.calculateInstance.getSheetFamilyItem(n),s=a.isSheetMember?a.parentObjectToToken.get(n):"";t={};var o=r.calculateInstance.getDependentCells();return function(e,r){var n=s+i(e,r);o.has(n)&&o.get(n).forEach((function(e){t[e]||(t[e]=!0)}))}};e.sheets.forEach((function(e){e.ranges.some((function(e){return e.dataSource&&(!e.info||!e.info.loadedRange||!e.info.loadedRange.length)}))?r.parent.notify(j,{sheet:e,autoDetectFormat:!0,loadFromStartCell:!0,updateDependentCellsCallback:l(e),loadComplete:o}):o()}))},r.prototype.toFixed=function(e){var t=Number(e);return Math.round(t)!==t&&(e=t.toFixed(2)),e},r.prototype.commputeFormulaValue=function(e){var t=this.parseSheetRef(e.value);e.value=this.calculateInstance.computeExpression(t).toString()},r.prototype.getCellRefValue=function(e){var t,r,n=this.getSheetInfo(),i=n.length,a=this.calculateInstance.sheetToken,s=e.value,o=s.lastIndexOf(a);if(-1!==o){var l=s.substring(0,o);l.length>0&&l[0]===this.calculateInstance.getFormulaCharacter()&&(l=l.substring(1,e.value.length));for(var d=0;d<i;d++)if(l.toUpperCase()===n[d].visibleName.toUpperCase()){t=d;break}r=a+t+a+s.substring(o+1).toUpperCase()}else s.length>0&&s[0]===this.calculateInstance.getFormulaCharacter()&&(r=s.substring(1,e.value.length).toUpperCase());e.value=this.calculateInstance.getValueFromArg(r)},r.prototype.aggregateComputation=function(e){var r,n,a=this.parent.getActiveSheet(),s=wn(a),o=t(s.split(":")[1]);o[0]+1===a.rowCount&&o[1]+1===a.colCount&&(s="A1:"+i(a.usedRange.rowIndex,a.usedRange.colIndex));var l=this.calculateInstance.getCellCollection(s);for(n=0;n<l.length;n++)if(rn(r=this.calculateInstance.getValueFromArg(l[n]))){e.countOnly=!1;break}if(e.Count=this.calculateInstance.getFunction("COUNTA")(s),e.Count&&!e.countOnly){var d=["SUM","AVERAGE","MIN","MAX"],h=[],p=t(a.activeCell),c=Ln(p[0],p[1],a,!1,!0);for(n=0;n<4;n++){if(r=this.toFixed(this.calculateInstance.getFunction(d[n])(s)),c.format){var u={formattedText:r,value:r,format:c.format,cell:{value:r,format:c.format}};this.parent.notify(re,u),r=u.formattedText}h.push(r)}e.Sum=h[0],e.Avg=h[1],e.Min=h[2],e.Max=h[3]}},r.prototype.refreshInsertDelete=function(e){var t=this;if("Sheet"!==e.modelType){var r,n=this.calculateInstance.getDependentFormulaCells(),i=yn(this.parent,e.sheet.id);this.parent.sheets.forEach((function(n,a){for(var s=0,o=n.usedRange.rowIndex;s<=o;s++)for(var l=0,d=n.usedRange.colIndex;l<=d;l++)(r=Ln(s,l,n,!1,!0)).formula&&xr(r.formula)&&(a===i?!e.isInsert&&("Row"===e.modelType?s>=e.startIndex&&s<=e.endIndex:l>=e.startIndex&&l<=e.endIndex)||t.updateFormula(e,r,s,l,i):r.formula.includes(e.sheet.name)&&t.updateFormula(e,r,s,l,i,!0,n))})),n.clear(),this.calculateInstance.getDependentCells().clear(),this.calculateInstance.getFormulaInfoTable().clear(),this.refreshNamedRange(e)}},r.prototype.getUpdatedFormulaOnInsertDelete=function(e){if(e.sheetNames){e.updateSheetRef||(e.updateSheetRef=this.getSheetRefUpdateOnDelete());var t=this.parseSheetRef(e.cell.formula,!1),r=t;e.sheetNames.forEach((function(t){r=e.updateSheetRef(t,r).value})),r!==t&&(e.cell.formula=r)}else this.updateFormula(e.insertDeleteArgs,e.cell,e.row,e.col,e.sheetIdx,e.otherSheet,e.formulaSheet)},r.prototype.updateFormula=function(r,n,i,o,l,d,h){var p,u,f,g,m,v,y=new RegExp(/^(?=.*[a-zA-Z])(?=.*\d)/g);n.formula&&n.formula.includes("UNIQUE")&&void 0!==i&&this.clearUniqueRange(i,o,h||r.sheet);for(var C,b,x,S=this.parseFormulaArgument({formula:this.parseSheetRef(n.formula,!0),rangeRef:!0}),w=this.getSheetInfo(),I=!n.formula.includes(this.parent.listSeparator),E=0;E<S.length;E++)if(p=S[E].trim(),(b=p.includes("$"))&&(p=p.replace(/[$]/g,"")),m=!0,this.calculateInstance.isCellReference(p)){if(g=p.includes(":"),(u=E&&S[E-1].trim())&&"!"===u[u.length-1]){if((u=u.replace(/['!]/g,""))!==(w[l].sheet===w[l].visibleName?r.sheet.name:"`"+w[l].sheet+"`"))continue}else if(d)continue;!y.test(p)&&p.indexOf(":")>-1&&(m=!1,v=!!(0,e.isNullOrUndefined)(p.match(/[0-9]/))),f=c(t(p)),this.parent.updateRangeOnInsertDelete(r,f,g,i,o,b,I)&&(S[E]=f[2]<f[0]||f[3]<f[1]?this.calculateInstance.getErrorStrings()[zn.Ref]:m?(x=void 0,x=(b?"$":"")+s(f[1]+1)+(b?"$":"")+(f[0]+1),f[0]===f[2]&&f[1]===f[3]||(x+=":"+(b?"$":"")+s(f[3]+1)+(b?"$":"")+(f[2]+1)),x):v?a(f).replace(/\d/g,""):a(f).replace(/[a-zA-Z]/g,""),C=!0)}var N="="+S.join("");if(C){var R,O=RegExp;w.forEach((function(e){N.includes("`"+e.sheet+"`")&&(R=new O("`"+e.sheet+"`","gi"),N=N.replace(R,e.visibleName))})),n.formula!==N&&(n.formula=N,"Manual"===this.parent.calculationMode&&(r.isInsert||r.isDelete)||(n.value=null))}},r.prototype.clearUniqueRange=function(e,r,n){var i={cellIdx:[e,r,e,r],isUnique:!1,uniqueRange:"",sheetName:n.name};this.parent.notify(Ee,i);for(var a=t(i.uniqueRange),s=a[0];s<=a[2];s++)for(var o=a[1];o<=a[3];o++)delete Ln(s,o,n,!1,!0).value},r.prototype.clearAllUniqueFormulaValue=function(){for(var e,r,n,i=this.calculateInstance.uniqueRange,a=0;a<i.length;a++){var s=i[a].lastIndexOf("!");if(r=In(this.parent,vn(this.parent,i[a].substring(0,s))),!(e=Ln((n=t(i[a].substring(s+1)))[0],n[1],r))||"#SPILL!"!==e.value)for(var o=n[0];o<=n[2];o++)for(var l=n[1];l<=n[3];l++)(e=Ln(o,l,r))&&e.value&&delete e.value}},r.prototype.parseFormulaArgument=function(e){for(var t,r,n=0,i=[],a=this.markSpecialChar(e.formula.replace("=",""),e.rangeRef),s=RegExp,o=new s(e.rangeRef?/\(|\)|=|\^|>|<|\+|-|\*|\/|%|&/g:/\(|\)|=|\^|>|<|:|\+|-|\*|\/|%|&/g),l=new s(this.parent.listSeparator,"g"),d=(a=a.split(new s(o.source+"|"+l.source,"g"))).length;n<d;)(t=a[n])?(1===t.length?i.push(this.isUniqueChar(t)?this.getUniqueCharVal(t):t):(r=t[0],t.indexOf("!")>0?(this.isUniqueChar(r)&&(i.push(this.getUniqueCharVal(r)),t=t.substr(1)),r=t.indexOf("!")+1,i.push(t.substring(0,r)),(r=(t=t.substring(r)).indexOf(":"))>-1&&t.indexOf("!")>r?(i.push(t.substring(0,r)),i.push(":"),r=(t=t.substring(r+1)).indexOf("!")+1,i.push(t.substring(0,r)),i.push(t.substring(r))):i.push(t)):this.isUniqueChar(r)?(i.push(this.getUniqueCharVal(r)),i.push(t.substr(1))):i.push(t)),n++):n++;return e.formulaArr=i,i},r.prototype.getUniqueCharVal=function(e){switch(e){case this.uniqueOBracket:return"(";case this.uniqueCBracket:return")";case this.uniqueCSeparator:return this.parent.listSeparator;case this.uniqueCOperator:return":";case this.uniquePOperator:return"+";case this.uniqueSOperator:return"-";case this.uniqueMOperator:return"*";case this.uniqueDOperator:return"/";case this.uniqueModOperator:return"%";case this.uniqueConcateOperator:return"&";case this.uniqueEqualOperator:return"=";case this.uniqueExpOperator:return"^";case this.uniqueGTOperator:return">";case this.uniqueLTOperator:return"<"}return""},r.prototype.isUniqueChar=function(e){var t=e.charCodeAt(e);return t>=129&&t<=142},r.prototype.markSpecialChar=function(e,t){e=e.replace(/\(/g,"("+this.uniqueOBracket).replace(/\)/g,")"+this.uniqueCBracket);var r=RegExp;return(e=(e=(e=(e=(e=(e=(e=t?e.replace(new r(this.parent.listSeparator,"g"),this.parent.listSeparator+this.uniqueCSeparator):e.replace(new r(this.parent.listSeparator,"g"),this.parent.listSeparator+this.uniqueCSeparator).replace(/:/g,":"+this.uniqueCOperator)).replace(/\+/g,"+"+this.uniquePOperator).replace(/-/g,"-"+this.uniqueSOperator)).replace(/\*/g,"*"+this.uniqueMOperator).replace(/\//g,"/"+this.uniqueDOperator)).replace(/&/g,"&"+this.uniqueConcateOperator)).replace(/=/g,"="+this.uniqueEqualOperator)).replace(/\^/g,"^"+this.uniqueExpOperator)).replace(/>/g,">"+this.uniqueGTOperator).replace(/</g,"<"+this.uniqueLTOperator)).replace(/%/g,"%"+this.uniqueModOperator)},r.prototype.refreshNamedRange=function(r){var n=this;if(r.definedNames&&r.definedNames.length)r.definedNames.forEach((function(e){n.parent.removeDefinedName(e.name,e.scope),n.parent.addDefinedName(e)}));else{var i=this.parent.definedNames.length;if(i)for(var s,o,l,d,h,p,c,u,f,g=Object.assign({},this.parent.definedNames),m=new RegExp(/^(?=.*[a-zA-Z])(?=.*\d)/g),v=0;v<i;v++){u=!0;var y=(d=g[v]).refersTo.lastIndexOf("!");l=d.refersTo.substring(y+1),(p=o=d.refersTo.substring(1,y)).match(/'/g)&&(p=p.slice(1,-1)),p===r.sheet.name&&(!m.test(l)&&l.indexOf(":")>-1&&(u=!1,f=!!(0,e.isNullOrUndefined)(l.match(/[0-9]/))),s=t(l),h=this.parent.updateRangeOnInsertDelete(r,s),c=u?a(s):f?a(s).replace(/\d/g,""):a(s).replace(/[a-zA-Z]/g,""),r.isInsert?this.updateDefinedNames(d,o,c,h):"Row"===r.modelType?this.updateDefinedNames(d,o,c,h,[s[0],s[2]],r):"Column"===r.modelType&&this.updateDefinedNames(d,o,c,h,[s[1],s[3]],r))}}},r.prototype.updateDefinedNames=function(e,t,r,n,i,a){if(n){var s=this.parent.definedNames.indexOf(e),o={action:"removeDefinedName",isRemoved:!1,definedName:e.name,scope:e.scope,isEventTrigger:!0};if(this.parent.notify(pe,o),i){var l={name:e.name,comment:e.comment,refersTo:e.refersTo,scope:e.scope};if(l=new N(this.parent,"definedNames",l,!0),a.definedNames?a.definedNames.push(l):a.definedNames=[l],i[1]<i[0])return}e.refersTo=t+"!"+r,this.parent.notify(pe,{action:"addDefinedName",definedName:e,isAdded:!1,index:s,isEventTrigger:!0});var d={name:e.name,scope:e.scope,comment:e.comment,refersTo:e.refersTo,cancel:!1};this.parent.notify("actionComplete",{eventArgs:d,action:"refreshNamedRange"})}},r}(),Po=function(){function r(t){this.parent=t,this.localeObj=(0,e.getNumericObject)(this.parent.locale);var r=e.IntlBase.getDependables(e.cldrData,this.parent.locale,null).dateObject;r.dayPeriods&&r.dayPeriods&&r.dayPeriods.format&&r.dayPeriods.format.wide?(this.localeObj.am=r.dayPeriods.format.wide.am||"AM",this.localeObj.pm=r.dayPeriods.format.wide.pm||"PM"):(this.localeObj.am="AM",this.localeObj.pm="PM"),this.updateLocalizedFormats(r),this.addEventListener()}return r.prototype.numberFormatting=function(r){var n=this.parent.activeSheetIndex,i=!0;r.range&&r.range.indexOf("!")>-1&&(i=(n=vn(this.parent,r.range.substring(0,r.range.lastIndexOf("!"))))===this.parent.activeSheetIndex);var a,s,o,l,d,h=In(this.parent,n),p=c(t(r.range?r.range.lastIndexOf("!")>-1?r.range.substring(r.range.lastIndexOf("!")+1):r.range:h.selectedRange));r.curSym=(0,e.getNumberDependable)(this.parent.locale,e.defaultCurrencyCode);for(var u=p[0];u<=p[2];u++){l=hl(h,u),d=i&&!cl(h,u);for(var f=p[1];f<=p[3];f++)o=(s=Ln(u,f,h,!1,!0)).format,$r(s,h.columns[f],l)||Hr(this.parent,h,{cell:{format:r.format},rowIdx:u,colIdx:f})||((s=Ln(u,f,h)).rowSpan<0||s.colSpan<0||(a={value:s.value,format:s.format,rowIndex:u,colIndex:f,sheetIndex:n,cell:s,refresh:i,curSymbol:r.curSym},this.getFormattedCell(a),d&&(this.setCell(a),a.td&&this.parent.notify(ie,a),o&&o!==r.format&&o.includes("[")&&-1===["Black","Blue","Cyan","Green","Magenta","Red","White","Yellow"].indexOf(Hn(r.format))&&this.removeFormatColor(a,{format:o,style:s.style}))),this.parent.setUsedRange(u,f))}h.conditionalFormats&&h.conditionalFormats.length&&this.parent.notify(kt,{indexes:p,isAction:!0,isEdit:!0}),this.parent.chartColl&&this.parent.chartColl.length&&this.parent.notify(Bt,{range:p})},r.prototype.isDigitPlaceHolder=function(e){return"#"===e||"0"===e||"?"===e||"."===e},r.prototype.parseToLocalizedFormat=function(e){if(e.decimalGroupSepsChanged&&(e.format.includes(".")||e.format.includes(","))){for(var t,r=void 0,n=void 0,i=e.format.split(""),a=0;a<i.length;a++)'"'===(r=i[a])?(n=e.format.indexOf('"',a+1))>-1&&(a=n):"_"===r||"*"===r||"\\"===r?a++:"["===r?(n=e.format.indexOf("]",a+1))>-1&&(a=n):","===r?this.isDigitPlaceHolder(i[a-1])&&(i[a]=this.localeObj.group):"."===r&&(i[a-1]?(t=i[a-1].toLowerCase(),["d","m","y","h"].some((function(e){return t===e}))||(i[a]=this.localeObj.decimal)):i[a]=this.localeObj.decimal);e.format=i.join("")}e.curChanged&&e.format.includes('"'+e.curSym+'"')&&(e.format=e.format.split('"'+e.curSym+'"').join(e.curSym))},r.prototype.updateLocalizedFormats=function(t,r){var n,i=this;To={currency:["$#,##0.00","$#,##0","$#,##0_);($#,##0)","$#,##0_);[Red]($#,##0)","$#,##0.00_);($#,##0.00)","$#,##0.00_);[Red]($#,##0.00)"],accounting:['_($* #,##0_);_($* (#,##0);_($* "-"_);_(@_)','_(* #,##0_);_(* (#,##0);_(* "-"_);_(@_)','_($* #,##0.00_);_($* (#,##0.00);_($* "-"??_);_(@_)','_(* #,##0.00_);_(* (#,##0.00);_(* "-"??_);_(@_)'],time:t.timeFormats&&"HH:mm:ss"===t.timeFormats.medium?"HH:mm:ss":"h:mm:ss AM/PM"};var a=(0,e.getNumberDependable)(this.parent.locale,e.defaultCurrencyCode),s={curChanged:"$"!==a,curSym:a,decimalGroupSepsChanged:"."!==this.localeObj.decimal&&","!==this.localeObj.group};if(s.curChanged){var o=new e.Internationalization(this.parent.locale).getNumberPattern({currency:"$",useGrouping:!0,format:"c0"},!0);if(o&&o.endsWith("$")){var l=o[o.indexOf("$")-1].trim().length?"":" ";To.currency.forEach((function(e,t){if(e.includes("$#,##0")){var r="",n=e.split("$#,##0.")[1];if(n)for(var i=0;"0"===n[i];)r+="0",i++;r&&(r="."+r),To.currency[t]=e.split("$#,##0"+r).join("#,##0"+r+l+'"'+a+'"')}})),To.accounting.forEach((function(e,t){if(e.slice(0,e.indexOf("#")).includes("$")){var r,n=e.split(";");n.forEach((function(e,t){e.includes("$")&&(e=e.replace("$",""),(r=e.includes("0)")?e.indexOf("0)")+2:e.lastIndexOf(e.includes("0")?"0":e.includes("?")?"?":e.includes('"-"')?'"':"#")+1)>0&&(n[t]=e.slice(0,r)+l+'"'+a+'"'+e.slice(r)))})),To.accounting[t]=n.join(";")}}))}else{var d=function(e,t,r){return r[t]=e.split("$").join('"'+a+'"')};To.currency.forEach(d),To.accounting.forEach(d)}}var h=["General","0","0.00","#,##0","#,##0.00","#,##0_);(#,##0)","#,##0_);[Red](#,##0)","#,##0.00_);(#,##0.00)","#,##0.00_);[Red](#,##0.00)",To.currency[2],To.currency[3],To.currency[4],To.currency[5],"0%","0.00%","0.00E+00","##0.0E+0","# ?/?","# ??/??","m/d/yyyy","d-mmm-yy","d-mmm","mmm-yy","h:mm AM/PM","h:mm:ss AM/PM","h:mm","h:mm:ss","m/d/yyyy h:mm","mm:ss","mm:ss.0","@","[h]:mm:ss"].concat(To.accounting);r?(n=this.customFormats).splice.apply(n,[0,h.length].concat(h)):(this.customFormats=h,this.localizedFormats=[]);var p,c=[0,1,2,3,4,37,38,39,40,5,6,7,8,9,10,11,48,12,13,14,15,16,17,18,19,20,21,22,45,47,49,46,42,41,44,43];c.forEach((function(e,t){Fo&&Fo.has(e)&&(i.customFormats[t]=Fo.get(e),(p=[5,6,7,8].indexOf(e))>-1?To.currency[p+2]=i.customFormats[t]:(p=[42,41,44,43].indexOf(e))>-1&&(To.accounting[p]=i.customFormats[t])),s.format=i.customFormats[t],i.parseToLocalizedFormat(s),i.localizedFormats[t]=s.format}));for(var u,f=function(e){g.localizedFormats.findIndex((function(t,r){return t===i.localizedFormats[e]&&r<c.length}))>-1&&(g.localizedFormats.splice(e,1),g.customFormats.splice(e,1),e--),u=e},g=this,m=c.length;m<this.localizedFormats.length;m++)f(m),m=u},r.prototype.localizedFormatAction=function(t){"getLocalizedFormats"===t.action?(t.defaultFormats=this.customFormats,t.localizedFormats=this.localizedFormats):"mapNumberFormatId"===t.action?this.updateLocalizedFormats(e.IntlBase.getDependables(e.cldrData,this.parent.locale,null).dateObject,!0):(t.curSym=(0,e.getNumberDependable)(this.parent.locale,e.defaultCurrencyCode),"parseToDefaultFormat"===t.action?this.parseToDefaultFormat(t):(t.decimalGroupSepsChanged="."!==this.localeObj.decimal&&","!==this.localeObj.group,t.curChanged="$"!==t.curSym,t.defaultFormat||(t.defaultFormat=t.format,this.parseToLocalizedFormat(t)),-1===this.localizedFormats.indexOf(t.format)&&(this.localizedFormats.push(t.format),this.customFormats.push(t.defaultFormat))))},r.prototype.parseToDefaultFormat=function(e){var t=this,r="."!==this.localeObj.decimal&&e.format.includes(this.localeObj.decimal),n=","!==this.localeObj.group&&e.format.includes(this.localeObj.group),i="$"!==e.curSym&&e.format.includes(e.curSym);if(r||n||i){var a,s,o,l=e.format.split(";");l.forEach((function(d,h){for(var p=d.split(""),c=0;c<p.length;c++)'"'===(o=p[c])?c=d.indexOf('"',c+1):"_"===o||"*"===o||"\\"===o?c++:"["===o?(a=d.indexOf("]",c+1))>-1&&(c=a):r&&o===t.localeObj.decimal?(s=p[c-1])?(s=s.toLowerCase(),["d","m","y","h"].some((function(e){return s===e}))||(p[c]=".")):p[c]=".":n&&o===t.localeObj.group?t.isDigitPlaceHolder(p[c-1])&&(p[c]=","):i&&(o===e.curSym?p[c]='"'+e.curSym+'"':e.curSym.startsWith(o)&&d.substring(c,c+e.curSym.length)===e.curSym&&p.splice(c,e.curSym.length,'"'+e.curSym+'"'));l[h]=p.join("")})),e.format=l.join(";")}},r.prototype.getFormattedCell=function(t){var r=void 0===t.value||null===t.value?"":t.value;t.sheetIndex=void 0===t.sheetIndex?this.parent.activeSheetIndex:t.sheetIndex;var n=In(this.parent,t.sheetIndex),i=t.cell||Ln(t.rowIndex,t.colIndex,n,!1,!0),a=!1,s=new e.Internationalization;if(t.curSymbol||(t.curSymbol=(0,e.getNumberDependable)(this.parent.locale,e.defaultCurrencyCode)),t.format&&"General"!==t.format||t.skipFormatCheck||i.formula&&i.formula.toLowerCase().startsWith("=text("))t.type=Bo(t.format),t.skipFormatCheck&&!t.format&&"General"===t.type&&(t.format="General");else if(t.type=t.format="General",!i.formula||i.formula&&-1===i.formula.indexOf("&-")){var o={value:r,updatedVal:r,cell:i,isEdit:t.isEdit,intl:s};this.checkDateFormat(o),(o.isDate||o.isTime)&&(a=!0,i.value=t.value=o.updatedVal,i.format&&"General"!==i.format?(t.format=i.format,t.type=Bo(t.format)):i.format=t.format=Mo(o.isDate?"ShortDate":"Time"))}if(i.format&&this.isCustomType(i)){t.type="Custom";var l=i.format.indexOf("@")>-1;""!==r&&!l&&this.isPercentageValue(r.toString(),t,i)&&(r=t.value.toString());var d=void 0,h={};Fo&&Yr(this.parent)&&(i.format=t.format=this.getMatchingCustomFormat(i.format));var p=i.format;i.format=i.format.split("\\").join("");var c=i.format.split(";");if(Vn(c[0],!0,h,!0))""!==r&&(t.result=this.processCustomDateTime(t,i,"time"!==h.type,c),d=!t.formatApplied),t.result=t.result||i.value;else if(c.length>1){if(i.format.indexOf("<")>-1||i.format.indexOf(">")>-1)t.result=this.processCustomConditions(i,t);else(u=yr(i,this.parent.locale,this.localeObj.group,this.localeObj.decimal,t.curSymbol)).isNumber?(i.value=u.value,this.processCustomAccounting(i,t,c,c[0]),d=!1):(t.result=this.processCustomText(i,t,c),d=!0);i.format=p}else if(l)d=!0,t.result=this.processCustomText(i,t);else{var u;if((u=yr({value:r},this.parent.locale,this.localeObj.group,this.localeObj.decimal)).isNumber)if(i.value=t.value=u.value,i.format.includes("E+0")){t.format!==i.format&&(t.format=i.format),this.checkAndSetColor(t);var f=t.format.split("E")[0],g=f.split(".");"."!==this.localeObj.decimal&&1===g.length&&(g=f.split(this.localeObj.decimal)),t.result=g[0].length>1?this.scientificHashFormat(t,g):this.scientificFormat(t)}else t.result=this.processCustomNumberFormat(i,t),d=!rn(i.value);else i.format&&i.format.includes("[")&&this.removeFormatColor(t,{format:i.format,style:i.style}),d=t.dataUpdate=!0}t.dataUpdate?t.formattedText=t.result||((0,e.isNullOrUndefined)(t.value)?"":t.value.toString()):(t.value=t.result,t.formattedText=(0,e.isNullOrUndefined)(t.value)?"":t.value.toString()),t.isRightAlign=!d&&!(0,e.isNullOrUndefined)(t.value)}else{var m=this.processFormats(t,r,a,i,s,n);t.formattedText=m.fResult||(void 0===t.value||null===t.value?"":t.value.toString()),t.isRightAlign=m.rightAlign}return void 0!==t.rowIndex&&(i.format&&t.formattedText&&t.formattedText!==i.value&&"General"!==i.format?i.formattedText=t.formattedText:i.formattedText&&delete i.formattedText),t.formattedText},r.prototype.isCustomType=function(e){var t=Bo(e.format);return"General"===t&&"General"!==e.format||"Time"===t&&this.parent.isEdit},r.prototype.processCustomFill=function(e,t,r,n){var i=e[e.indexOf("*")+1],a=e.split("*"+i);if(void 0===r.rowIndex||r.dataUpdate)n=n||this.processCustomNumberFormat({format:a.join(""),value:t.value},r);else{var s=void 0;if(a[1]){var o=parseFloat(t.value);o<0?(s=this.processCustomNumberFormat({format:a[1],value:Math.abs(o).toString()},r),n="-"+a[0].split("'").join("")):(s=this.processCustomNumberFormat({format:a[1],value:t.value},r),n=a[0].split("'").join("")),0===o&&(s=s.split("0").join(""))}else n=n||this.processCustomNumberFormat({format:a[0],value:t.value},r);r.isRowFill=!0,this.setCell(r),this.parent.notify(Jt,{cell:t,cellEle:r.td,rowIdx:r.rowIndex,colIdx:r.colIndex,beforeFillText:n,repeatChar:i,afterFillText:s}),n=this.parent.isPrintingProcessing?n+s:n}return n},r.prototype.processCustomDateTime=function(t,r,n,i){var a,s=this;if("."!==this.localeObj.decimal&&r.value&&r.value.toString().includes(this.localeObj.decimal)){var o=r.value.replace(this.localeObj.decimal,".");rn(o)&&(r.value=t.value=o)}var l;if(rn(r.value)){if(i.length>1&&parseFloat(r.value)<=0&&(t.formatApplied=this.processCustomAccounting(r,t,i),t.formatApplied))return t.result}else if(a=function(){var t=r.value.toString();if(t.includes(s.localeObj.dateSeparator)||t.indexOf("-")>0||t.includes(s.localeObj.timeSeparator))return!0;var n=e.IntlBase.getDependables(e.cldrData,s.parent.locale,null).dateObject,i=n.months["stand-alone"]&&n.months["stand-alone"].abbreviated;return i&&!!Object.keys(i).find((function(e){return t.includes(i[""+e])}))}(),!a)return this.processCustomText(r,t,i);var d=i[0],h=new e.Internationalization,p=function(i){var o,p;if(a){var u=void 0;if(r.format.includes("[h]")){var f=r.value.toString().split(":");f.length>1&&Number(f[0])>=24&&(u=Number(f[0])/24,f[0]="24",r.value=f.join(":"))}if(o=(p=nn(r.value,new e.Internationalization,s.parent.locale,d,r)).dateObj&&"Invalid Date"!==p.dateObj.toString()){if(p.dateObj.getFullYear()<1900)return"";var g=en(p.dateObj,r.value.toString().includes(":"),"time"===p.type);u>=1&&(g+=u,p.dateObj=Qr(g)),r.value=g.toString()}}else{if(s.checkAndProcessNegativeValue(t,r.value))return t.formatApplied=!0,t.formattedText;o=(p={dateObj:Qr(parseFloat(r.value))}).dateObj&&"Invalid Date"!==p.dateObj.toString()}if(o){i&&n&&(t.dateObj=p.dateObj),t.formatApplied=!0;var m=void 0;if(d.startsWith("MM-dd-yyyy "))d=d.split(" ").splice(1).join(" "),m=h.formatDate(p.dateObj,{type:"date",skeleton:"yMd"})+(d?" "+h.formatDate(p.dateObj,{type:l,format:d}):"");else if(m=h.formatDate(p.dateObj,{type:l,format:d}),(d=d.toLowerCase()).startsWith("[h]"))m=(24*Number(r.value.toString().split(".")[0])+p.dateObj.getHours()).toString()+m.slice(m.indexOf("]")+1);else if(d.startsWith("[m")){m=(1440*Number(r.value.toString().split(".")[0])+60*p.dateObj.getHours()+p.dateObj.getMinutes()).toString()+m.slice(m.indexOf("]")+1)}else d.startsWith("[s")&&(m=(86400*Number(r.value.toString().split(".")[0])+60*(60*p.dateObj.getHours()+p.dateObj.getMinutes())+p.dateObj.getSeconds()).toString());return c?m.replace(s.localeObj.am,"A").replace(s.localeObj.pm,"P"):m}return""};d=d.split("_(").join(" ").split("_)").join(" "),r.format.indexOf("h")>-1&&(d=d.split("h").join("H"),l="time"),r.format.indexOf("s")>-1&&(l="time");var c=r.format.indexOf("A/P")>-1;if((r.format.indexOf("AM/PM")>-1||c)&&(d=(d=d.split("H").join("h")).split("A/P").join("AM/PM").split("AM/PM").join("a"),l="time"),r.format.indexOf("d")>-1){l="date";for(var u=d.split(" "),f=void 0,g=void 0,m=void 0,v=void 0,y=0;y<u.length;y++){v=u[y].includes(this.localeObj.dateSeparator)?this.localeObj.dateSeparator:"-",g=u[y].split(v);for(var C=0;C<g.length;C++)(f=(m=g[C]).match(/d/g))&&f.length>2&&(g[C]=m.split("d").join("E"));u[y]=g.join(v)}d=u.join(" ")}if(r.format.indexOf("m")>-1)if(r.format.indexOf("s")>-1||r.format.indexOf("h")>-1)l="time",r.format.includes(" ")&&((u=d.split(" "))[0].includes("d")||u[0].includes("y"))&&(u[0]=u[0].split("m").join("M"),d=u.join(" "));else if(l="date",(d=d.split("m").join("M")).includes("MMMMM")){var b=d;d="MMMM";var x=p()[0];return d=b.split("MMMMM").join("p"),p(t.checkDate).split("p").join(x)}return p(t.checkDate)},r.prototype.processCustomConditions=function(e,t){if(rn(e.value)){for(var r=e.format.split(";"),n=Number(e.value),i=void 0,a=void 0,s=void 0,o=0;o<r.length;o++){if(e.format=r[o],(s=Hn(e.format))&&(e.format=e.format.split("["+s+"]").join("")),!e.format.includes("[")){e.format=r[o],a=!1;break}var l=(i=e.format.split("[")[1].split("]")[0]).split("<="),d=i.split(">="),h=i.split("<"),p=i.split(">");if(2===l.length&&n<=Number(l[1])||2===d.length&&n>=Number(d[1])||2===h.length&&n<Number(h[1])||2===p.length&&n>Number(p[1])){e.format=r[o].split("["+i+"]").join(""),a=!1;break}a=2===i.split(/<=|>=|<|>/).length}return a?(this.removeFormatColor(t,{format:r.join(""),style:e.style}),this.processCustomFill("*#",e,t,"#####")):this.processCustomNumberFormat(e,t)}return e.value},r.prototype.processCustomAccounting=function(e,t,r,n){var i=parseFloat(e.value);return i<0?r[1].includes("@")||(n=r[1]):0===i&&r[2]&&!r[2].includes("@")&&(n=r[2].includes(t.curSymbol+"0")?r[2].split("0").join("#"):r[2]),!!n&&(t.result=this.processCustomNumberFormat({format:e.format,value:i<0?Math.abs(i).toString():e.value,style:e.style},t,n),!0)},r.prototype.processCustomText=function(e,t,r){var n,i=e.value||e.value?e.value.toString():"";if(r)if(r[3])n=r[3];else{if(!r[1]||!r[1].includes("@"))return i;n=r[1]}else n=e.format;var a=this.processCustomNumberFormat({format:n.split("@").join("#"),value:i.split(i).join("1")},t);return a&&(a=a.split("1").join(i),"."!==this.localeObj.decimal&&rn(a)&&a.includes(".")&&(a=a.replace(".",this.localeObj.decimal))),a},r.prototype.thousandSeparator=function(e,t){for(;e;)t/=1e3,e--;return t},r.prototype.getSeparatorCount=function(e){for(var t=0,r=["#","0"],n=0;n<e.format.length;n++)'"'===e.format[n]&&"\\"!==e.format[n-1]?n=e.format.indexOf('"',n+1):","!==e.format[n]||r.indexOf(e.format[n+1])>-1||t++;return t},r.prototype.processDigits=function(e,t){t=t.split("?").join("0");var r=e.value.toString();if((r=this.getFormattedNumber(t,parseFloat(r)))&&r.includes(this.localeObj.decimal)){var n=r.split(this.localeObj.decimal);r=n[0]+this.localeObj.decimal+n[1].split("0").join(" ")}return r||e.value},r.prototype.processFormatWithSpace=function(e,t,r){var n=" ",i={cell:t,char:n,width:0};this.parent.notify(Qt,i);for(var a,s=i.width,o={format:e,formattedText:""},l=0;l<e.length;l++)if("_"===e[l]){i.char=e[l+1],this.parent.notify(Qt,i);var d=i.width;a=Math.round(d/s),e=e.replace(e[l]+e[l+1],n.repeat(a))}var h=e.length-e.trim().length;if(h>0){if(o.formattedText=this.getFormattedNumber(e.trim(),r)," "===e[0]){for(var p=1,c=1;" "===e[c];)p++,c++;h-=p,o.formattedText=n.repeat(p)+o.formattedText}o.formattedText+=n.repeat(h)}else o.formattedText=this.getFormattedNumber(e,r);return o.format=e,o},r.prototype.removeFormatColor=function(e,t){["Black","Blue","Cyan","Green","Magenta","Red","White","Yellow"].indexOf(Hn(t.format))>-1&&(e.color=t.style&&t.style.color?t.style.color:"",this.applyColor(e))},r.prototype.processCustomNumberFormat=function(e,t,r){if(!e.format)return"";var n=e.value,i=yr(e,this.parent.locale,this.localeObj.group,this.localeObj.decimal);if(i.isNumber){var a=void 0,s=void 0;e.value=i.value;var o=parseFloat(e.value.toString()),l=r||e.format;if(e.format.indexOf("[")>-1){var d=Hn(l);d?(l=l.split("["+d+"]").join(""),t.color=d.toLowerCase(),this.applyColor(t)):this.removeFormatColor(t,e)}(l.indexOf('"')>-1||l.indexOf("\\")>-1)&&(l=this.processText(l),(s=0===o&&!l.includes("#")&&!l.includes("0"))&&(l+="#"));var h=this.getSeparatorCount(e);if(h){a=!0;var p=this.thousandSeparator(h,o);-1===l.indexOf(".")&&(p=Math.round(p)),n=this.getFormattedNumber(l.split(",").join(""),p),0===p&&(n=n.replace("0",""))}if(l.indexOf("?")>-1&&(a=!0,n=this.processDigits(e,l),l=l.split("?").join("")),l.indexOf("_")>-1)a=!0,l=(p=this.processFormatWithSpace(l,e,o)).format,n=p.formattedText;if(n&&l.indexOf("?")>-1&&(n=n.replace("?"," ")),l.indexOf("*")>-1&&(a=!0,n=this.processCustomFill(l,e,t)),"General"===l&&(a=!0,n=o.toString()),a||(n=this.getFormattedNumber(l,o)),s&&n&&(n=n.replace("0","")),"#"===l[0]&&o>=0&&o<1){var c=l.split("#").join("").split(".");if(!c[0].includes("0")){0!==o||!l.includes(".")||c[1]&&c[1].includes("0")||(n=(n=this.getFormattedNumber(l,.1)).replace("1",""));var u=n.split(this.localeObj.decimal);u[0]=u[0].toString().replace(/^0+/,""),n=u.join(this.localeObj.decimal)}}"-0"===n&&(n="0")}return n},r.prototype.processText=function(e){var t=e;return t.indexOf('"')>-1?t=t.split('"').join("'"):t.indexOf("\\")>-1&&(t=t.split("\\").join("")),t},r.prototype.processFormats=function(e,t,r,n,i,a){var s;if(""!==t){var o=void 0;switch("General"!==e.type&&"Text"!==e.type&&this.isPercentageValue(t.toString(),e,n)&&(t=e.value.toString()),e.type){case"General":(s={args:e,fResult:t,intl:i,isRightAlign:r,cell:n,rowIdx:Number(e.rowIndex),colIdx:Number(e.colIndex),sheet:a}).fResult.toString().startsWith("\n")||s.fResult.toString().endsWith("\n ")||this.autoDetectGeneralFormat(s),t=s.fResult,r=s.isRightAlign;break;case"Number":(o=yr({value:t},this.parent.locale,this.localeObj.group,this.localeObj.decimal)).isNumber&&(n.value=e.value=o.value,t=this.applyNumberFormat(e,i),r=!0);break;case"Currency":(o=yr({value:t,format:e.format},this.parent.locale,this.localeObj.group,this.localeObj.decimal,e.curSymbol)).isNumber&&(n.value=e.value=o.value,t=this.currencyFormat(e,i,n),r=!0);break;case"Percentage":(o=yr({value:t},this.parent.locale,this.localeObj.group,this.localeObj.decimal)).isNumber&&(n.value=e.value=o.value,t=this.percentageFormat(e,i),r=!0);break;case"Accounting":t=this.accountingFormat(e,t,i,n),r=e.formatApplied;break;case"ShortDate":r=!!(t=this.checkAndProcessNegativeValue(e,e.value)?e.formattedText:this.shortDateFormat(e,i,n));break;case"LongDate":r=!!(t=this.checkAndProcessNegativeValue(e,e.value)?e.formattedText:this.longDateFormat(e,i));break;case"Time":r=!!(t=this.checkAndProcessNegativeValue(e,e.value)?e.formattedText:this.timeFormat(e,i,n));break;case"Fraction":(o=yr({value:t},this.parent.locale,this.localeObj.group,this.localeObj.decimal)).isNumber&&(n.value=e.value=o.value,t=this.fractionFormat(e),r=!0);break;case"Scientific":(o=yr({value:t},this.parent.locale,this.localeObj.group,this.localeObj.decimal)).isNumber&&(n.value=e.value=o.value,t=this.scientificFormat(e),r=!0);break;case"Text":"."!==this.localeObj.decimal&&rn(t)&&t.toString().includes(".")&&(t=t.toString().replace(".",this.localeObj.decimal)),r=!1}}return{fResult:t,rightAlign:r}},r.prototype.autoDetectGeneralFormat=function(t){var r,n=t.fResult,i=t.args.cell&&t.args.cell.formula&&t.args.cell.formula.indexOf("ADDRESS(")>0,a=t.args.cell&&t.args.cell.formula&&t.args.cell.formula.indexOf("DOLLAR(")>0,s=t.args.cell&&t.args.cell.formula&&t.args.cell.formula.indexOf("TEXT(")>0;if(!(a&&t.fResult&&t.fResult.toString().includes(t.args.curSymbol)||s)){if(t.fResult&&"."!==this.localeObj.decimal)r=o=t.fResult.toString(),o.includes(this.localeObj.decimal)&&rn(o=o.replace(this.localeObj.decimal,"."))&&(o.includes("E")?t.fResult=o:(t.fResult=t.args.value=o=Number(o).toString(),Pn(t.rowIdx,t.colIdx,t.sheet,{value:o},!0)),r=o.replace(".",this.localeObj.decimal));if(rn(t.fResult)){var o=Number(t.fResult).toString();if(t.fResult.toString().includes("E")?(t.args.format=Mo("Scientific"),Pn(t.rowIdx,t.colIdx,t.sheet,{value:o,format:t.args.format},!0),t.args.value=o,t.fResult=this.scientificFormat(t.args)):t.args.format&&(t.args.format.indexOf("%")>-1?t.fResult=this.percentageFormat(t.args,t.intl):t.args.format.indexOf(t.args.curSymbol)>-1?t.fResult=this.currencyFormat(t.args,t.intl,t.args.cell):t.fResult=this.applyNumberFormat(t.args,t.intl)),"General"===t.args.format){if(t.args.cell&&t.args.cell.formula&&o.includes(".")&&o.length>11){var l=o.indexOf(".")+1;r=null,t.args.cell.formula.includes("RANDBETWEEN")&&(t.fResult=o=l<7?o:parseFloat(o).toFixed(0))}t.cellVal=o,t.prevVal=r,this.parseDecimalNumber(t),(0,e.isNullOrUndefined)(t.fResult)&&!(0,e.isNullOrUndefined)(t.cellVal)&&(t.fResult=t.cellVal)}t.isRightAlign=!0}t.fResult&&this.updateAutoDetectNumberFormat(t),i&&(t.isRightAlign=!1,t.fResult=n)}},r.prototype.parseDecimalNumber=function(e){var t=e.cellVal.split(".");if(t[0].length>11)e.cellVal=Math.abs(Number(t[0])).toString().substring(0,6).replace(/0+$/,""),(i=e.cellVal.length-1)>-1&&(e.fResult=this.scientificFormat(e.args,i>5?5:i));else if(t[1])if(e.cellVal.length>11){var r=10-(t[0].length-(Math.sign(Number(e.cellVal))<0?1:0));e.fResult=Number(Number(e.cellVal).toFixed(r>0?r:0)).toString()}else if(e.cellVal.includes("e-")){var n=e.cellVal.split("e-"),i=Number(n[1])+(n[0].includes(".")?n[0].split(".")[1].length:0);n[0]=n[0].replace(".",this.localeObj.decimal),1===n[1].length&&(n[1]="0"+n[1]),e.args.updateValue||Pn(e.rowIdx,e.colIdx,e.sheet,{value:Number(e.cellVal).toFixed(i)},!0),e.fResult=n.join("E-")}else e.prevVal?e.fResult=e.prevVal:e.args.updateValue&&"."!==this.localeObj.decimal&&(e.fResult=e.cellVal.replace(".",this.localeObj.decimal))},r.prototype.updateAutoDetectNumberFormat=function(e){var t=e.fResult.toString(),r=e.args.cell||e.cell;if(this.isPercentageValue(t,e.args,r))r.format=t.includes(this.localeObj.decimal)?Mo("Percentage"):"0%",e.args.updateValue||(e.args.format=r.format,e.fResult=this.percentageFormat(e.args,e.intl),e.isRightAlign=!0);else{if(t.includes(" ")){var n=t.split(" ");if(n[1].includes("/")&&rn(n[0])&&Number(n[0])%1==0){var i=n[1].split("/");if(rn(i[0])&&Number(i[0])%1==0&&rn(i[1])&&Number(i[1])%1==0)return r.format="# "+(i[0].length>1||i[1].length>1?"??/??":"?/?"),r.value=(Number(n[0])+Number(i[0])/Number(i[1])).toString(),void(e.args.updateValue||(e.args.value=r.value,e.args.format=r.format,e.fResult=this.fractionFormat(e.args),e.isRightAlign=!0))}}var a="";t.includes(e.args.curSymbol)&&(a=t.includes(this.localeObj.decimal)?To.currency[0]:To.currency[1],t=t.replace(e.args.curSymbol,"")),("."===this.localeObj.decimal||e.args.isEdit&&!r.formula)&&t.includes(this.localeObj.group)&&Cr(t,this.parent.locale,this.localeObj.group,this.localeObj.decimal)&&(t=t.split(this.localeObj.group).join(""),a||(a=t.includes(this.localeObj.decimal)?"#,##0.00":"#,##0")),a?rn(t=t.replace(this.localeObj.decimal,"."))&&(e.args.value=Number(t).toString(),e.args.updateValue?(e.args.cell.value=e.args.value,e.args.cell.format=a):(Pn(e.rowIdx,e.colIdx,e.sheet,{value:e.args.value,format:a},!0),a.includes('"')&&(a=this.processText(a)),e.fResult=this.getFormattedNumber(a,Number(e.args.value)),e.isRightAlign=!0)):"."!==this.localeObj.decimal&&"General"===e.args.format&&rn(t)&&t.includes(".")&&(e.fResult=Number(t).toString().replace(".",this.localeObj.decimal))}},r.prototype.isPercentageValue=function(e,t,r){if(e.includes("%")){var n=e.split("%");if(""!==n[0]&&""===n[1].trim()){var i=yr({value:n[0]},this.parent.locale,this.localeObj.group,this.localeObj.decimal);if(i.isNumber)return t.value=Number(i.value)/100,r.value=t.value.toString(),!0}}return!1},r.prototype.findSuffix=function(e,t){var r=e.length-t.length;return e.substr(0,r<0?0:r)+t},r.prototype.applyNumberFormat=function(t,r){t.format=this.isCustomFormat(t.format);var n=t.format.split(";");if(Number(t.value)>0)t.format=n[0];else if(0===Number(t.value)){if(t.format=n[2]?n[2]:n[0],t.format.indexOf('"')>-1&&-1===t.format.indexOf("#"))return t.format=t.format.split("_").join(" ").split("*").join(" ").split("?").join(" ").split('"').join(""),t.format}else if(Number(t.value)<0)t.format=(0,e.isNullOrUndefined)(n[1])?n[0]:n[1].split("*").join(" "),t.format.indexOf("-")>-1&&(t.value=t.value.toString().split("-").join(""));else if(t.format=n[3]?n[3]:n[0],t.format=t.format.split("_").join(" ").split("*").join(" ").split("?").join(" "),t.format.indexOf("@")>-1)return t.format.split("@").join(t.value.toString());if(t.format=t.format.split("_").join(" ").split("*").join(" ").split('"').join(""),t.format.indexOf("?")>-1&&t.format.indexOf(this.localeObj.decimal)>-1){var i=t.format.split(this.localeObj.decimal)[1].length,a="";if(Number(t.value)%1)a=i>t.value.toString().split(".")[1].length?" ":"0";t.format=t.format.split("?").join(a)}else t.format=t.format.split("?").join(" ");return Number(t.value)<0&&t.cell&&t.cell.format&&(t.format=t.cell.format),r.formatNumber(Number(t.value),{format:t.format})},r.prototype.isCustomFormat=function(e){return'_-* #,##0.00_-;-* #,##0.00_-;_-* "-"_-;_-@_-'!==e&&'_-* #,##0_-;-* #,##0_-;_-* "-"_-;_-@_-'!==e||(e=""),e=(e=""===e?Mo("Number"):e).toString().split("_)").join(" ").split("_(").join(" ").split("[Red]").join("")},r.prototype.currencyFormat=function(t,r,n){t.format=t.format||Mo("Currency"),t.format=t.format.split("_(").join(" ").split("_)").join(" ");var i=t.format.split(";"),a=Hn(t.format),s=Number(t.value);return s>=0||(0,e.isNullOrUndefined)(i[1])?(a&&(t.color=n.style&&n.style.color?n.style.color:"",this.applyColor(t)),t.format=i[0]):(s=Math.abs(s),t.format=i[1].split("["+a+"]").join("").split("*").join(" "),a&&(t.color=a.toLowerCase(),this.applyColor(t))),t.format=this.getFormatForOtherCurrency(t.format),t.format.includes('"')&&(t.format=this.processText(t.format)),r.formatNumber(s,{format:t.format,currency:e.defaultCurrencyCode})},r.prototype.applyColor=function(e){e.refresh&&(this.setCell(e),e.td&&e.td.style.color!==e.color&&this.parent.notify(le,{style:{color:e.color},rowIdx:e.rowIndex,colIdx:e.colIndex,td:e.td}))},r.prototype.setCell=function(e){if(!e.td){var t={sheet:In(this.parent,e.sheetIndex),cell:e.cell,rowIdx:e.rowIndex,colIdx:e.colIndex};(e.cell.rowSpan>1||e.cell.colSpan>1)&&Gr(t),e.td=this.parent.getCell(t.rowIdx,t.colIdx)}},r.prototype.percentageFormat=function(e,t){return e.format=""===e.format?Mo("Percentage"):e.format,t.formatNumber(Number(e.value),{format:e.format})},r.prototype.accountingFormat=function(t,r,n,i){t.format=t.format||Mo("Accounting"),t.format=t.format.split("_(").join(" ").split("_)").join(" ").split("[Red]").join("").split("_").join("");var a=t.format.split(";"),s=yr({value:r},this.parent.locale,this.localeObj.group,this.localeObj.decimal);if(s.isNumber){i.value=t.value=s.value;var o=Number(t.value);if(o>=0?t.format=0===o&&a[2]?a[2]:a[0]:(t.format=a[1].split("*").join(" "),o=Math.abs(o)),t.format.includes(t.curSymbol)&&t.format.includes('"')&&(t.format=this.processText(t.format)),t.format=this.getFormatForOtherCurrency(t.format),t.formatApplied=!0,0===o){if(t.format=this.processText(t.format.split("*").join(" ").split("?").join(" ")),!t.format.includes("#")&&!t.format.includes("0")){t.format+="#";var l=n.formatNumber(o,{format:t.format,currency:e.defaultCurrencyCode});return l.includes("0")&&(l=l.replace("0","")),l}return n.formatNumber(o,{format:t.format,currency:e.defaultCurrencyCode})}return n.formatNumber(o,{format:t.format,currency:e.defaultCurrencyCode})}return a[3]?this.processCustomText(i,t,a):r},r.prototype.getFormatForOtherCurrency=function(e){if(e.indexOf("[$")>-1){var t=e.split("]")[0].split("[$")[1].split("-")[0];e=e.indexOf("0")>e.indexOf("[$")?t+e.slice(e.indexOf("]")+1,e.length):e.slice(0,e.indexOf("[$"))+t}return e},r.prototype.checkAndProcessNegativeValue=function(e,t){if(t&&rn(t)&&Number(t)<0){if(void 0===e.rowIndex||e.dataUpdate)return e.formattedText="#".repeat(e.dataUpdate?7:10),!0;e.isRowFill=!0,this.setCell(e);var r={cell:e.cell,cellEle:e.td,rowIdx:e.rowIndex,colIdx:e.colIndex,repeatChar:"#"};return this.parent.notify(Jt,r),e.formattedText=r.formattedText,!0}return!1},r.prototype.shortDateFormat=function(e,t,r){var n,i,a;if(Fo&&Yr(this.parent)&&r&&"m/d/yyyy"===r.format&&Fo.has(14)&&(r.format=e.format=Fo.get(14)),""===e.format||"General"===e.format||"mm-dd-yyyy"===e.format||"m/d/yyyy"===e.format?(i="MM-dd-yyyy",n={type:"date",skeleton:"yMd"}):(i=e.format,n=e.format===Mo("ShortDate")?{type:"date",skeleton:"yMd"}:{type:"date",format:e.format}),!rn(e.value)&&e.value&&r){e.value=e.value.toString();var s={value:e.value,updatedVal:e.value,cell:r,isEdit:e.isEdit,intl:t,skipCellFormat:!0,format:i};if(this.checkDateFormat(s),!s.isDate&&!s.isTime)return"";r.value=e.value=s.updatedVal,a=s.dateObj}else{if(!(a=Qr(e.value))||"Invalid Date"===a.toString())return"";if(a.getFullYear()<1900||a.getFullYear()>9999)return rn(e.value)?e.value.toString():""}return e.checkDate&&(e.dateObj=a),t.formatDate(a,n)},r.prototype.longDateFormat=function(e,t){var r;if(e.value=e.value.toString(),(e.value.includes(this.localeObj.dateSeparator)||e.value.indexOf("-")>0)&&!rn(e.value)){if(!((r=nn(e.value,t,this.parent.locale,"",e.cell).dateObj)&&"Invalid Date"!==r.toString()&&r.getFullYear()>=1900))return rn(e.value)?e.value:"";e.value=en(r).toString(),e.cell&&(e.cell.value=e.value)}else if((r=Qr(e.value))&&"Invalid Date"!==r.toString()&&r.getFullYear()<1900)return rn(e.value)?e.value:"";return e.checkDate&&(e.dateObj=r),t.formatDate(r,{type:"date",skeleton:"full"})},r.prototype.timeFormat=function(t,r,n){if((0,e.isNullOrUndefined)(t.value))return"";var i,a=Mo("Time");""!==t.format&&"General"!==t.format||(i=a),i="h:mm:ss AM/PM"===t.format?"h:mm:ss a":t.format;var s=t.value.toString();if(!rn(s)&&n){var o={value:s,updatedVal:s,cell:n,isEdit:t.isEdit,intl:r,skipCellFormat:!0};if(this.checkDateFormat(o),!o.isDate&&!o.isTime)return"";n.value=s=o.updatedVal}var l=s.split(".");return(0,e.isNullOrUndefined)(l[1])||(s=parseFloat(l[0]+1+"."+l[1])||s),r.formatDate(Qr(s),{type:"time",skeleton:"medium",format:i})},r.prototype.scientificHashFormat=function(e,t){var r,n=this.findDecimalPlaces(e.format),i=t[0].split("0").length-1+(t[0].split("#").length-1),a=Number(e.value).toExponential(n+i);if(a.includes("e+"))r="e+";else{if(!a.includes("e-"))return a;r="e-"}var s,o=a.split(r),l=o[0].split("."),d=Number(o[1]);if("e-"===r){var h=d+Math.abs(d-i*(d>i?2:1));s=h-d,o[1]=h.toString()}else s=d%i,o[1]=(d-s).toString();s>0&&(l[0]+=l[1].substring(0,s),l[1]=l[1].slice(s),o[0]=l.join("."));var p=Number("1"+"0".repeat(n));return this.getFormattedNumber(t.join("."),Number((Math.round(Number(o[0])*p)/p).toFixed(n)))+r.toUpperCase()+this.findSuffix(e.format.split("+")[1],o[1])},r.prototype.scientificFormat=function(e,t){e.format||(e.format=Mo("Scientific"));var r=e.format.split("+")[1]||"00";void 0===t&&(t=this.findDecimalPlaces(e.format));var n=Number(e.value).toExponential(t);return n.indexOf("e+")>-1?n=n.split("e+")[0]+"E+"+this.findSuffix(r,n.split("e+")[1]):n.indexOf("e-")>-1&&(n=n.split("e-")[0]+"E-"+this.findSuffix(r,n.split("e-")[1])),n.replace(".",this.localeObj.decimal)},r.prototype.fractionFormat=function(e){e.format=e.format||Mo("Fraction"),this.checkAndSetColor(e);var t=e.value.toString().split("."),r=this.getFormattedNumber(e.format.split(" ")[0],Number(t[0])),n=e.format.split("?").length/2;if(2===t.length&&!t[1].startsWith("0".repeat(n))){var i=Zr(Number(e.value));if(i)return r+" "+i}return r+" "+" ".repeat(2*n)},r.prototype.checkAndSetColor=function(e){var t=Hn(e.format);t&&(e.format=e.format.split("["+t+"]").join(""),e.color=t.toLowerCase(),this.applyColor(e))},r.prototype.findDecimalPlaces=function(e){var t=e.toUpperCase().indexOf("E");if(t>-1){var r=e.indexOf(this.localeObj.decimal);return-1===r&&"."!==this.localeObj.decimal&&(r=e.indexOf(".")),r>0?e.substring(r+1,t).length:0}return 2},r.prototype.checkDateFormat=function(t){if(!(0,e.isNullOrUndefined)(t.value)){var r=t.cell||Ln(t.rowIndex,t.colIndex,In(this.parent,(0,e.isNullOrUndefined)(t.sheetIndex)?this.parent.activeSheetIndex:t.sheetIndex),!1,!0),n=this.checkCustomDateFormat(t.value.toString(),r,t.isEdit);if("Invalid"!==n.val){var i=void 0;if(n.format.startsWith("[h]")){var a=n.val.split(":");a.length>1&&Number(a[0])>=24&&(i=Number(a[0])/24,a[0]="24",n.val=a.join(":"))}var s=nn(n.val,t.intl||new e.Internationalization(this.parent.locale),this.parent.locale,n.format||t.format,t.skipCellFormat&&r,n.isDateTime);if(s.dateObj&&"Invalid Date"!==s.dateObj.toString()){var o=s.dateObj.getFullYear();if(o>=1900&&o<=9999){t.isTime="time"===s.type;var l=en(s.dateObj,n.val.includes(":"),t.isTime);if(i>=1&&(l+=i,s.dateObj=Qr(l)),n.val=l.toString(),(!r.format||"General"===r.format)&&(t.isTime?r.format=Mo("Time"):r.format=Mo("ShortDate"),t.updateValue))return void(r.value=n.val);t.isDate="date"===s.type||"datetime"===s.type,t.dateObj=s.dateObj}t.updatedVal=n.val}}}},r.prototype.checkCustomTimeFormat=function(e,t){var r=this,n=[],i=" "+this.localeObj.am,a=" "+this.localeObj.pm,s=e.includes(i)||e.includes(a);s||(e.includes(i.toLowerCase())||e.includes(a.toLowerCase()))&&(e=e.replace(i.toLowerCase(),i).replace(a.toLowerCase(),a),s=!0);var o,l=e.split(this.localeObj.timeSeparator),d=3===l.length&&s;if(l.length<=3){var h,p,c=s?12:23;l.forEach((function(t,s){t=t.trim(),l[s]=t,t.includes(i)||t.includes(a)?(o=" AM/PM",t=t.replace(i,"").replace(a,"")):o="",rn(h=Number(t))&&h>=0?h>=24&&0===s&&l.length>1?n.push("[h]"):h<=c&&0===s?(n.push("h"+o),1===l.length&&(o?((p=e.split(" "))[0]+=r.localeObj.timeSeparator+"00",l[0]=p.join(" ")):(n=[],e="Invalid"))):h<=60&&(1===n.length||2===n.length)?(1===n.length?(n.push("mm"+o),2===l.length&&"[h]"===n[0]&&n.push("ss")):n.push("ss"),1===t.length&&(l[s]="0"+l[s])):(n=[],e="Invalid"):(n=[],e="Invalid")}))}else e="Invalid";if(n.length){e=l.join(this.localeObj.timeSeparator);var u=void 0;if(d?u=this.customFormats[24]:(u=n.join(":"),Fo&&(u=this.getMatchingCustomFormat(u))),!t.format||"General"===t.format)return t.format=u,{val:e,format:u}}return{val:e,format:""}},r.prototype.checkCustomDateFormat=function(t,r,n){var i,a,s=this,o=r.format;if(t.includes(this.localeObj.dateSeparator)&&(!t.includes(" "+this.localeObj.am)&&!t.includes(" "+this.localeObj.pm)||t.replace(" "+this.localeObj.am,"").replace(" "+this.localeObj.pm,"").includes(this.localeObj.dateSeparator)))i=this.localeObj.dateSeparator;else{if(!(t.indexOf("-")>0))return t.includes(this.localeObj.timeSeparator)||t.includes(" "+this.localeObj.am)||t.includes(" "+this.localeObj.pm)?this.checkCustomTimeFormat(t,r):{val:"Invalid",format:""};i="-"}if(t.includes(this.localeObj.timeSeparator)&&t.includes(" ")){var l=t.split(" ");if(t=l.shift(),"Invalid"===(a=this.checkCustomTimeFormat(l.join(" "),r)).val)return{val:"Invalid",format:""}}var d,h,p=t.split(i),c="",u=[],f=function(e){c=u.join(i),o&&"General"!==o||(r.format=e)},g=e.IntlBase.getDependables(e.cldrData,this.parent.locale,null).dateObject,m=g.months["stand-alone"]?g.months["stand-alone"].wide:{},v=g.months["stand-alone"]?g.months["stand-alone"].abbreviated:{1:""},y=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],C=function(e,t,r,n){v[""+t]&&v[""+t].toLowerCase()===r?d=y[Number(t)-1]:e.substring(0,n)===r&&(d=y[Number(t)-1])};if(2===p.length){var b=function(e){t=d,u[0]="MMM",Number(e)<=31&&Number(e)>0?(t=e+i+t,"/"!==s.localeObj.dateSeparator&&"-"!==i&&(t+=i+(new Date).getFullYear()),u.splice(0,0,"dd"),f(s.customFormats[21])):(2===e.length&&rn(e)&&Number(e)>-1&&(e=(Number(e)<30?(new Date).getFullYear().toString().slice(0,2):"19")+e),Number(e)>=1900&&Number(e)<=9999?(t="1"+i+t+i+e,u[1]="yyyy",f(s.customFormats[22])):t="Invalid")};p[0]=p[0].toLowerCase().trim(),p[1]=p[1].toLowerCase().trim(),!Number(p[0])&&p[0].length>=v[1].length?(Object.keys(m).find((function(e){return C(m[""+e].toLowerCase(),e,p[0],p[0].length)})),(0,e.isNullOrUndefined)(d)||p[0].includes(",")||b(p[1])):!Number(p[1])&&p[1].length>=v[1].length?(Object.keys(m).find((function(e){return C(m[""+e].toLowerCase(),e,p[1],p[1].length)})),(0,e.isNullOrUndefined)(d)||b(p[0])):Number(p[0])&&Number(p[0])<=12&&Number(p[1])&&("/"===this.localeObj.dateSeparator||"-"===i||n&&!r.formula)&&(d=y[Number(p[0])-1],b(p[1])),u.length||(t="Invalid")}else if(p.length>2)for(var x=function(r){rn(p[r])?4!==p[r].length&&2!==p[r].length&&1!==p[r].length&&(t="Invalid"):(p[r]=p[r].trim(),Object.keys(m).find((function(e){return C(m[""+e].toLowerCase(),e,p[r].trim().toLowerCase(),p[r].length)})),(0,e.isNullOrUndefined)(d)?t="Invalid":1===r&&(u[1]="MMM",p[2]=p[2].trim(),2===p[2].length&&rn(p[2])&&Number(p[2])>-1&&(p[2]=(Number(p[2])<30?(new Date).getFullYear().toString().slice(0,2):"19")+p[2]),Number(p[0])<=31&&Number(p[2])>=1900&&Number(p[2])<=9999&&(t=p[0]+i+d,t+=i+p[2],u[0]="d",u[2]="yy",f(S.customFormats[20]),u[2]="yyyy",c=u.join(i))))},S=this,w=0;w<p.length;w++)x(w);return a&&"Invalid"!==t&&(o&&"General"!==o||(r.format=this.customFormats[27]),c&&a.format&&(c+=" "+a.format),t+=" "+a.val,h=!0),{val:t,format:c,isDateTime:h}},r.prototype.formattedBarText=function(t){var r=this;if(""!==t.value&&!(0,e.isNullOrUndefined)(t.value)){var n={},i=t.cell&&t.cell.format||"",a=t.type||(i&&Vn(i,!0,n,!0)?n.type:""),s=new e.Internationalization,o=t.value,l=!t.showFormattedText||"dd-MM-yyyy"!==i&&"dd/MM/yyyy"!==i?Mo("ShortDate"):i,d=Mo("Time");"h:mm:ss AM/PM"===d&&(d="h:mm:ss a");var h=i.toLowerCase(),p=function(){"."!==r.localeObj.decimal&&t.value&&(t.value=t.value.toString(),rn(t.value)&&t.value.includes(".")&&(t.value=t.value.replace(".",r.localeObj.decimal)))};if("time"!==a||!h.includes("m")||h.includes(":m")||h.includes("m:")||h.includes("[m")||h.includes("am")||(a="date"),"date"===a){var c=t.value.toString();t.value=this.shortDateFormat({type:a,value:t.value,format:l},s,t.cell),t.value&&c.includes(".")&&(t.value+=" "+this.timeFormat({type:a,value:c,format:d},s))}else a.includes("time")?o&&Number(o)>=1||"datetime"===a?t.value=this.shortDateFormat({type:a,value:t.value,format:l},s)+" "+this.timeFormat({type:a,value:t.value,format:d},s):t.value=this.timeFormat({type:a,value:t.value,format:d},s):t.cell.format&&t.cell.format.includes("%")&&rn(t.cell.value)?(t.value=this.parent.getDisplayText(t.cell),t.value.includes("%")||(t.value=o,p())):p();(!t.value||t.value&&t.value.toString().indexOf("null")>-1)&&(t.value=o)}},r.prototype.getFormattedNumber=function(t,r){return(new e.Internationalization).formatNumber(Number(r),{format:t})||""},r.prototype.getMatchingCustomFormat=function(e){return"#,##0_);(#,##0)"===e&&Fo.has(37)?Fo.get(37):"#,##0_);[Red](#,##0)"===e&&Fo.has(38)?Fo.get(38):"#,##0.00_);(#,##0.00)"===e&&Fo.has(39)?Fo.get(39):"#,##0.00_);[Red](#,##0.00)"===e&&Fo.has(40)?Fo.get(40):"d-mmm-yy"===e&&Fo.has(15)?Fo.get(15):"d-mmm"===e&&Fo.has(16)?Fo.get(16):"mmm-yy"===e&&Fo.has(17)?Fo.get(17):"h:mm AM/PM"===e&&Fo.has(18)?Fo.get(18):"h:mm:ss AM/PM"===e&&Fo.has(19)?Fo.get(19):"h:mm"===e&&Fo.has(20)?Fo.get(20):"h:mm:ss"===e&&Fo.has(21)?Fo.get(21):"m/d/yyyy h:mm"===e&&Fo.has(22)?Fo.get(22):"mm:ss"===e&&Fo.has(45)?Fo.get(45):e},r.prototype.addEventListener=function(){this.parent.on(te,this.numberFormatting,this),this.parent.on(re,this.getFormattedCell,this),this.parent.on(ue,this.checkDateFormat,this),this.parent.on(me,this.formattedBarText,this),this.parent.on(fe,this.updateAutoDetectNumberFormat,this),this.parent.on(ge,this.parseDecimalNumber,this),this.parent.on(gr,this.localizedFormatAction,this)},r.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(te,this.numberFormatting),this.parent.off(re,this.getFormattedCell),this.parent.off(ue,this.checkDateFormat),this.parent.off(me,this.formattedBarText),this.parent.off(fe,this.updateAutoDetectNumberFormat),this.parent.off(ge,this.parseDecimalNumber),this.parent.off(gr,this.localizedFormatAction))},r.prototype.destroy=function(){this.removeEventListener(),Fo&&!this.parent.refreshing&&(Fo.clear(),Fo=null),To=this.parent=this.localeObj=this.customFormats=this.localizedFormats=null},r.prototype.getModuleName=function(){return"workbookNumberFormat"},r}();function Mo(e){var t=e.split(" ").join("");if(!To)switch(t){case"Currency":return"$#,##0.00";case"Accounting":return'_($* #,##0.00_);_($* (#,##0.00);_($* "-"??_);_(@_)';case"Time":return"h:mm:ss AM/PM";default:return"General"}var r=function(e,t){return Fo&&Fo.has(t)?Fo.get(t):e},n="General";switch(t){case"Number":n=r("0.00",2);break;case"Currency":n=To.currency[0];break;case"Accounting":n=To.accounting[2];break;case"ShortDate":n=r("m/d/yyyy",14);break;case"LongDate":n="dddd, mmmm dd, yyyy";break;case"Time":n=To.time;break;case"Percentage":n=r("0.00%",10);break;case"Fraction":n=r("# ?/?",12);break;case"Scientific":n=r("0.00E+00",11);break;case"Text":n=r("@",49);break;case"CurrencyWithColorCode":n=To.currency[5]}return n}function Bo(e,t){var r="General";switch(e){case"0":case"0.00":case"#,##0":case"#,##0.00":r="Number";break;case"$#,##0.00":case"$#,##0":case"$#,##0_);[Red]($#,##0)":case"$#,##0.00_);($#,##0.00)":case"$#,##0_);($#,##0)":case"$#,##0.00_);[Red]($#,##0.00)":r="Currency";break;case'_($* #,##0.00_);_($* (#,##0.00);_($* "-"??_);_(@_)':case'_ $ * #,##0.00_ ;_ $ * -#,##0.00_ ;_ $ * "-"??_ ;_ @_ ':case'_($* #,##0_);_($* (#,##0);_($* "-"_);_(@_)':r="Accounting";break;case"mm-dd-yyyy":case"m/d/yyyy":case"dd/MM/yyyy":r="ShortDate";break;case"dddd, mmmm dd, yyyy":r="LongDate";break;case"h:mm:ss AM/PM":r="Time";break;case"0.00%":case"0%":r="Percentage";break;case"0.00E+00":r="Scientific";break;case"@":r="Text";break;default:if(e){if(!To)break;if(e===To.time?r="Time":To.currency.indexOf(e)>-1?r="Currency":To.accounting.indexOf(e)>-1?t&&(r="Accounting"):e.includes("?/?")&&(r="Fraction"),Fo&&"General"===r&&t){var n=function(t){return t.some((function(t){return Fo.has(t)&&Fo.get(t)===e}))};n([1,2,3,4])?r="Number":n([14])?r="ShortDate":n([9,10])?r="Percentage":n([11])?r="Scientific":n([49])&&(r="Text")}t=!1}}return t&&To&&("Currency"===r&&"$#,##0.00"!==To.currency[0]||"Accounting"===r&&'_($* #,##0.00_);_($* (#,##0.00);_($* "-"??_);_(@_)'!==To.accounting[2])&&(r="General"),r}function Ho(e,t){var r={action:"parseToDefaultFormat",format:t};return e.notify(gr,r),r.format}function Uo(e,t,r){void 0===r&&(r=!0),r&&Fo&&(Fo.clear(),Fo=null),t&&t.length&&(Fo||(Fo=new Map),t.forEach((function(e){Fo.set(e.id,e.code)}))),e&&e.notify(gr,{action:"mapNumberFormatId"})}var Vo=function(){function t(e){this.parent=e,this.addEventListener()}return t.prototype.destroy=function(){this.removeEventListener(),this.parent=null},t.prototype.addEventListener=function(){this.parent.on(Ae,this.initiateSortHandler,this),this.parent.on(Fe,this.updateSortedDataOnCell,this)},t.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(Ae,this.initiateSortHandler),this.parent.off(Fe,this.updateSortedDataOnCell))},t.prototype.initiateSortHandler=function(t){var i=this,o=t.args,l=new br.Deferred,d=this.parent.getAddressInfo(o.range),h=In(this.parent,d.sheetIndex),p=c(d.indices),u=o.sortOptions||{sortDescriptors:{},containsHeader:!0},f=!1;if(t.promise=l.promise,p[0]>h.usedRange.rowIndex||p[1]>h.usedRange.colIndex)l.reject(this.parent.serviceLocator.getService(sn).getConstant("SortOutOfRangeError"));else{var g=u.containsHeader,m=o.checkForHeader;if((p[0]===p[2]||m)&&(m||(p=Ur(p[0],p[1],h)),f=!0,(0,e.isNullOrUndefined)(u.containsHeader)&&(g=typeof Ln(p[0],p[1],h,null,!0).value!=typeof Ln(p[0]+1,p[1],h,null,!0).value||!this.isSameStyle(Ln(p[0],p[1],h,null,!0).style,Ln(p[0]+1,p[1],h,null,!0).style))),((0,e.isNullOrUndefined)(o.sortOptions)||(0,e.isNullOrUndefined)(o.sortOptions.containsHeader))&&!f){var v=Ln(p[0],p[1],h),y=Ln(p[0]+1,p[1],h);v&&y&&(g=typeof v.value!=typeof y.value||!this.isSameStyle(v.style,y.style))}p[0]=g?p[0]+1:p[0];var C=s(r(h.activeCell)[1]+1);delete u.containsHeader;var b=u.sortDescriptors,x=new br.Query;if(Array.isArray(b)){b&&0!==b.length||(b=[{field:C}]);for(var S=b.length,w=S-1;w>-1;w--)if(b[S-1].field||(b[S-1].field=C),b[w].field){var I=b[w].sortComparer||this.sortComparer.bind(this,b[w],u.caseSensitive);x.sortBy(b[w].field,I),C=b[w].field}}else{b||(b={field:C}),b.field||(b.field=C);I=b.sortComparer||this.sortComparer.bind(this,b,u.caseSensitive);x.sortBy(b.field,I),C=b.field}var E=a(p);ln(this.parent,h.name+"!"+E,!0,null,null,null,null,null,void 0,null,n(C)).then((function(e){new br.DataManager(e).executeQuery(x).then((function(r){i.parent.notify("setActionData",{args:{action:"beforeSort",eventArgs:{range:E,cellDetails:e,sortedCellDetails:r.result}}}),i.updateSortedDataOnCell({result:r.result,range:p,sheet:h,jsonData:e});var n={range:h.name+"!"+E,sortOptions:o.sortOptions};t.previousSort&&(n.previousSort=t.previousSort),l.resolve(n)}))}))}},t.prototype.updateSortedDataOnCell=function(t){for(var r,n,i,a=this,o=[],l=function(n,i){for(var l=t.range[1],d=0;l<=t.range[3];l++,d++){if(o[d]||(o[d]=s(l+1)),i[o[d]])r=(0,e.extend)({},i[o[d]],null,!0);else{if(!Ln(n,l,t.sheet))continue;r=null}(r=a.skipBorderOnSorting(n,l,t.sheet,r))&&r.validation&&delete r.validation;var h=Ln(n,l,t.sheet);h&&h.validation&&(r=Object.assign({},r,{validation:h.validation})),r&&r.formula&&(r.formula=Pr([n,l],[parseInt(i.__rowIndex,10)-1,l],t.sheet,a.parent,r,!0)),Pn(n,l,t.sheet,r)}},d=t.isUndo&&{},h=t.range[0],p=0;h<=t.range[2];h++,p++)if(cl(t.sheet,h))p--;else if(i=t.result[p],t.isUndo){if(i&&(d[n=parseInt(i.__rowIndex,10)-1]=!0,l(n,i),h===n))continue;!d[h]&&t.sheet.rows[h]&&l(h,{})}else l(h,i||{})},t.prototype.skipBorderOnSorting=function(e,t,r,n){var i=Ln(e,t,r),a=["borderBottom","borderTop","borderRight","borderLeft","border"];if(n&&n.style)for(var s=0,o=a;s<o.length;s++){var l=o[s];delete n.style[""+l]}if(i&&i.style)for(var d=0,h=a;d<h.length;d++){l=h[d];i.style[""+l]&&(n||(n={}),n.style||(n.style={}),n.style[""+l]=i.style[""+l])}return n},t.prototype.isSameStyle=function(e,t){e||(e={}),t||(t={});for(var r=!0,n=Object.keys(e),i=0;i<n.length;i++){if(e[n[i]]!==t[n[i]]&&this.parent.cellStyle[n[i]]!==e[n[i]]){r=!1;break}r=!0}return r},t.prototype.sortComparer=function(t,r,n,i){var a=t.order||"",s=br.DataUtil.fnSort(a),o=!1;if(n&&i&&("string"==typeof n.value||"string"==typeof i.value)&&""!==n.value&&""!==i.value&&(rn(n.value)&&(n.value=an(n.value),!0),rn(i.value)&&(i.value=an(i.value),o=!0),!o&&!o)){var l={sensitivity:r?"case":"base"},d=new Intl.Collator(this.parent.locale,l);return a&&"ascending"!==a.toLowerCase()?-1*d.compare(n.value,i.value):d.compare(n.value,i.value)}var h=(0,e.isNullOrUndefined)(n)||n&&((0,e.isNullOrUndefined)(n.value)||""===n.value),p=(0,e.isNullOrUndefined)(i)||i&&((0,e.isNullOrUndefined)(i.value)||""===i.value);return h&&p?-1:h?1:p?-1:s(n?n.value:n,i?i.value:i)},t.prototype.getModuleName=function(){return"workbookSort"},t}(),zo=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.addEventListener=function(){this.parent.on(_e,this.initiateFilterHandler,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off(_e,this.initiateFilterHandler)},e.prototype.initiateFilterHandler=function(e){var t=this,r=e.args,n=new br.Deferred,i=In(this.parent,p(this.parent,r.range)),s=r.filterOptions||{};if(e.promise=n.promise,s.datasource){this.setFilter(s.datasource,s.predicates,r.range,e.refresh,s.equalOrPredicates);var l={range:r.range,filterOptions:s};n.resolve(l)}else{var d=c(o(r.range));if(d[0]>i.usedRange.rowIndex||d[1]>i.usedRange.colIndex)return void n.reject("Select a cell or range inside the used range and try again.");d[0]===d[2]&&d[2]-d[0]==0&&(d[0]=0,d[1]=0,d[3]=i.usedRange.colIndex),d[2]=i.usedRange.rowIndex,d[0]=d[0]+1;var h=a(d);ln(this.parent,i.name+"!"+h,!0,!0,null,null,null,null,!1).then((function(i){var a=new br.DataManager(i);t.setFilter(a,s.predicates,r.range,e.refresh);var o={range:h,filterOptions:s};n.resolve(o)}))}},e.prototype.setFilter=function(e,r,n,i,a){var s=this;if(e&&r){var o,l,d=e.dataSource.json,h=Kr(e,r,a),p="__rowIndex";if(n.indexOf("!")>-1?(l=vn(this.parent,n.substring(0,n.lastIndexOf("!"))),o=In(this.parent,l)):(o=this.parent.getActiveSheet(),l=vn(this.parent,o.name)),"spreadsheet"===this.parent.getModuleName()){var c,u,f=this.parent;if(f.scrollSettings.enableVirtualization&&(o.rows||d).length>f.viewport.rowCount+2*f.getThreshold("row")||o.frozenRows||o.frozenColumns||i){d.forEach((function(e){c=h.indexOf(e)<0,pl(o,Number(e[""+p])-1,{hidden:c,isFiltered:c})})),u=l===f.activeSheetIndex;var g=t(o.paneTopLeftCell);this.parent.updateTopLeftCell(Dr(o,g[0],!0)-this.parent.frozenRowCount(o),null,"col")}else d.forEach((function(e){if(c=h.indexOf(e)<0,u)pl(o,Number(e[""+p])-1,{hidden:c,isFiltered:c});else{var t={startIndex:Number(e[""+p])-1,hide:c,isFiltering:!0,sheetIndex:l};t.endIndex=t.startIndex,s.parent.notify(Rt,t),u=t.refreshUI}}));u&&f.renderModule.refreshSheet(!1,!1,document.activeElement.id!==this.parent.element.id+"_SearchBox")}else{var m;d.forEach((function(e){m=h.indexOf(e)<0,pl(o,Number(e[""+p])-1,{hidden:m,isFiltered:m})}))}}},e.prototype.getModuleName=function(){return"workbookFilter"},e}(),_o=function(){function r(e){this.parent=e,this.addEventListener()}return r.prototype.setImage=function(r){var n,i=r.range?r.range.lastIndexOf("!"):-1,a=r.range?i>-1?r.range.substring(i+1):r.range:this.parent.getActiveSheet().selectedRange,s=r.range&&i>-1?vn(this.parent,r.range.substring(0,i)):this.parent.activeSheetIndex,o=t(a),l=(0,e.isUndefined)(s)?this.parent.getActiveSheet():In(this.parent,s),d=Ln(o[0],o[1],l),h=r.options;if(d&&d.image){n=d.image;for(var p=0;p<h.length;p++)n.push(h[p])}Pn(o[0],o[1],l,{image:d&&d.image?n:h},!0)},r.prototype.addEventListener=function(){this.parent.on(Dt,this.setImage,this)},r.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off(Dt,this.setImage)},r.prototype.destroy=function(){this.removeEventListener(),this.parent=null},r.prototype.getModuleName=function(){return"workbookImage"},r}(),jo=function(){function r(e){this.parent=e,this.addEventListener()}return r.prototype.addEventListener=function(){this.parent.on(Lt,this.setChartHandler,this),this.parent.on(Ut,this.deleteChartColl,this),this.parent.on(Ht,this.refreshChartSize,this),this.parent.on(zt,this.focusChartBorder,this)},r.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(Lt,this.setChartHandler),this.parent.off(Ut,this.deleteChartColl),this.parent.off(Ht,this.refreshChartSize),this.parent.off(zt,this.focusChartBorder))},r.prototype.setChartHandler=function(r){var n=0,i=[];r.isInitCell=!(0,e.isNullOrUndefined)(r.isInitCell)&&r.isInitCell,r.isUndoRedo=!!(0,e.isNullOrUndefined)(r.isUndoRedo)||r.isUndoRedo,r.isPaste=!(0,e.isNullOrUndefined)(r.isPaste)&&r.isPaste;var s,o,l=r.chart;if(l.length>0)for(;n<l.length;){if(!1===r.isCut&&document.getElementById(r.chart[n].id)&&(l[n]={range:l[n].range,id:(0,e.getUniqueID)("e_spreadsheet_chart"),theme:l[n].theme,isSeriesInRows:l[n].isSeriesInRows,type:l[n].type,markerSettings:l[n].markerSettings}),document.getElementById(r.chart[n].id))return;if((s=l[n]).theme=s.theme||"Material",s.type=s.type||"Line",s.isSeriesInRows=s.isSeriesInRows||!1,(0,e.isNullOrUndefined)(s.range)){var d=this.parent.getActiveSheet();s.range=d.selectedRange,0===(i=c(t(s.range)))[0]&&i[2]===d.rowCount-1&&i[2]>d.usedRange.rowIndex&&(i[2]=d.usedRange.rowIndex),0===i[1]&&i[3]===d.colCount-1&&i[3]>d.usedRange.colIndex&&(i[3]=d.usedRange.colIndex)}else i=c(t(s.range));var h=a(i);if(s.range.indexOf("!")>0?s.range=s.range.substring(0,s.range.lastIndexOf("!"))+"!"+h:s.range=this.parent.getActiveSheet().name+"!"+h,(0,e.isNullOrUndefined)(s.id)&&(s.id=(0,e.getUniqueID)("e_spreadsheet_chart")),s.markerSettings&&s.markerSettings.visible&&(void 0===s.markerSettings.isFilled&&(s.markerSettings.isFilled=!0),void 0===s.markerSettings.shape&&(s.markerSettings.shape="Circle")),s.height=s.height||290,s.width=s.width||480,this.parent.notify(Pt,{option:s,isInitCell:r.isInitCell,triggerEvent:r.isUndoRedo,dataSheetIdx:r.dataSheetIdx,range:r.range,isPaste:r.isPaste}),this.parent.chartColl.push(s),!r.isInitCell||r.isPaste){var p=void 0===r.sheetId?s.range&&s.range.lastIndexOf("!")>0?vn(this.parent,s.range.substring(0,s.range.lastIndexOf("!"))):this.parent.activeSheetIndex:yn(this.parent,r.sheetId),u={clientY:s.top,isImage:!0},f={clientX:s.left,isImage:!0};this.parent.notify(cr,u),this.parent.notify(ur,f);d=(0,e.isUndefined)(p)?this.parent.getActiveSheet():this.parent.sheets[p];var g=Ln(u.clientY,f.clientX,d);this.parent.isPrintingProcessing||(g&&g.chart?g.chart.push(s):Pn(u.clientY,f.clientX,d,{chart:[s]},!0))}else{var m=t(r.range);u={clientY:s.top,isImage:!0},f={clientX:s.left,isImage:!0};this.parent.notify(cr,u),this.parent.notify(ur,f);var v={prevTop:s.top,prevLeft:s.left,prevRowIdx:m[0],prevColIdx:m[1],prevHeight:s.height,prevWidth:s.width,currentTop:s.top,currentLeft:s.left,currentRowIdx:u.clientY,currentColIdx:f.clientX,currentHeight:s.height,currentWidth:s.width,id:s.id,requestType:"chartRefreshOnInit"};m[0]===u.clientY&&m[1]===f.clientX||(o=l.length,this.parent.notify(fr,v),n-=o-l.length)}n++}},r.prototype.refreshChartSize=function(t){for(var r,n=1,i=this.parent.sheets.length+1;n<i;){var a=this.parent.chartColl;if(r=a?a.length:0)for(;r--;){var s=this.parent.chartColl[r];if(!(0,e.isNullOrUndefined)(t.overlayEle.querySelector("#"+s.id))){var o=this.parent.element.querySelector("."+s.id),l=(0,e.getComponent)(o,"chart")||(0,e.getComponent)(o,"accumulationchart");l&&(l.height=t.height,l.width=t.width)}}n++}},r.prototype.focusChartBorder=function(t){for(var r=0;r<this.parent.chartColl.length;r++){var n=document.getElementById(t.id),i=document.getElementById(this.parent.chartColl[r].id);n&&i&&(0,e.closest)(i,"."+n.classList[1])===n&&this.parent.notify(Pt,{option:this.parent.chartColl[r],isRefresh:!0})}},r.prototype.deleteChartColl=function(e){for(var t=0;t<this.parent.chartColl.length;t++)this.parent.chartColl[t].id+"_overlay"===e.id&&this.parent.chartColl.splice(t,1)},r.prototype.destroy=function(){this.removeEventListener(),this.parent=null},r.prototype.getModuleName=function(){return"workbookChart"},r}(),qo=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.format=function(e){var r,n=this,i=e.range;if(i&&"string"==typeof i&&i.indexOf("!")>-1){var a=i.lastIndexOf("!");i=i.substring(a+1),r=this.parent.sheets[vn(this.parent,e.range.substring(0,a))]}else r=this.parent.getActiveSheet();void 0===i&&(i=r.selectedRange);var s="object"!=typeof i&&e.onActionUpdate,o={range:i,style:Object.assign({},e.style),requestType:"CellFormat"};e.borderType&&(o.borderType=e.borderType);var l={},d="object"==typeof o.range?o.range:c(t(o.range)),h=$r(Ln(d[0],d[1],r),bl(r,d[1]),hl(r,d[0])),p=!!bl(r,d[1])&&bl(r,d[1]).isReadOnly,u=!!hl(r,d[0])&&hl(r,d[0]).isReadOnly;if(Object.assign(l,o.style,null,!0),!s||h||p||u||(this.parent.trigger("beforeCellFormat",o),this.parent.notify("actionBegin",{eventArgs:o,action:"format"}),!o.cancel)){var f,g;e.borderType&&(this.setTypedBorder(r,e.style.border,d,e.borderType,e.onActionUpdate),delete e.style.border,delete o.style.border);var m,v,y,C={cell:null,rowIdx:0,colIdx:0,eventOnly:!0,preventEvt:!s},b=function(e){return C.cell={style:e},C.rowIdx=f,C.colIdx=g,Hr(n.parent,r,C)};if(void 0!==o.style.borderTop){for(g=d[1];g<=d[3];g++)f=d[0],b({borderTop:o.style.borderTop})||(e.isUndoRedo||(this.checkAdjacentBorder(r,"borderBottom",f-1,g),this.checkFullBorder(r,"borderBottom",f-1,g)),this.checkFullBorder(r,"borderTop",f,g),this.setCellBorder(r,C.cell.style,f,g,e.onActionUpdate,g===d[3],null,null,e.isUndoRedo));delete o.style.borderTop}if(void 0!==o.style.borderBottom){var x=void 0,S=void 0;for(g=d[1];g<=d[3];g++)S=(x=Ln(f=d[0],g,r,!1,!0)).rowSpan>0?Ln(d[2],d[1],r,!1,!0):Ln(d[2],d[3],r,!1,!0),x.rowSpan>1&&S.rowSpan<0||(f=d[2]),b({borderBottom:o.style.borderBottom})||(e.isUndoRedo||(this.checkAdjacentBorder(r,"borderTop",d[2]+1,g),this.checkFullBorder(r,"borderTop",d[2]+1,g)),this.checkFullBorder(r,"borderBottom",d[2],g),this.setCellBorder(r,C.cell.style,f,g,e.onActionUpdate,g===d[3],null,null,e.isUndoRedo),this.setBottomBorderPriority(r,d[2],g));delete o.style.borderBottom}if(void 0!==o.style.borderLeft){for(var w=d[0];w<=d[2];w++)g=d[1],b({borderLeft:o.style.borderLeft})||(e.isUndoRedo||(this.checkAdjacentBorder(r,"borderRight",w,g-1),this.checkFullBorder(r,"borderRight",w,g-1)),this.checkFullBorder(r,"borderLeft",w,g),this.setCellBorder(r,C.cell.style,w,g,e.onActionUpdate,null,null,null,e.isUndoRedo));delete o.style.borderLeft}if(void 0!==o.style.borderRight){for(var I=d[0];I<=d[2];I++)g=d[3],b({borderRight:o.style.borderRight})||(e.isUndoRedo||(this.checkAdjacentBorder(r,"borderLeft",I,g+1),this.checkFullBorder(r,"borderLeft",I,g+1)),this.checkFullBorder(r,"borderRight",I,g),this.setCellBorder(r,C.cell.style,I,g,e.onActionUpdate,null,null,null,e.isUndoRedo));delete o.style.borderRight}if(Object.keys(o.style).length){var E=this.parent,N=E.viewport&&this.parent.getActiveSheet().id===r.id,R=this.parent.frozenRowCount(r),O=this.parent.frozenColCount(r),k=[R+E.viewport.topIndex,O+E.viewport.leftIndex,E.viewport.bottomIndex,E.viewport.rightIndex],A=void 0,F=void 0,T=void 0,D=void 0;for(f=d[0];f<=d[2];f++)if(!(F=hl(r,f)||{}).isFiltered)for(A=f>=k[0]&&f<=k[2]||f<R,T=!1,g=d[1];g<=d[3];g++)if(!b(o.style)){void 0===v&&(void 0!==o.style.border?(m=o.style.border,delete o.style.border,v=!0):v=!1),y=Ln(f,g,r,!1,!0);var L=bl(r,g),P=hl(r,f);if(!(y&&y.isReadOnly||L&&L.isReadOnly||P&&P.isReadOnly)){if(y.rowSpan>1||y.colSpan>1)for(var M=f,B=y.rowSpan>1?f+(y.rowSpan-1):f;M<=B;M++)for(var H=g,U=y.colSpan>1?g+(y.colSpan-1):g;H<=U;H++)v&&this.setFullBorder(r,m,d,M,H,e.onActionUpdate,!0),this.setCellStyle(r,M,H,o.style);if(v&&this.setFullBorder(r,m,d,f,g,e.onActionUpdate),this.setCellStyle(r,f,g,o.style),N)if(A&&(g>=k[1]&&g<=k[3]||g<O)){if(D=null,o.style.color&&y.format&&y.format.includes("[")){var V=Hn(y.format);V&&(D=V.toLowerCase())}this.parent.notify(le,{style:o.style,rowIdx:f,colIdx:g,lastCell:g===d[3],isHeightCheckNeeded:!0,manualUpdate:!0,onActionUpdate:e.onActionUpdate,formatColor:D})}else F.customHeight||(T=T||Lr(o.style,e.onActionUpdate))&&this.parent.notify(le,{rowIdx:f,colIdx:g,lastCell:g===d[3],checkHeight:!0,outsideViewport:!A,onActionUpdate:e.onActionUpdate})}}}v&&(o.style.border=m),this.parent.setUsedRange(d[2],d[3]),e.refreshRibbon&&this.parent.notify(ve,null),r.conditionalFormats&&r.conditionalFormats.length&&this.parent.notify(kt,{indexes:d}),!s||h||p||u||(o.style=l,o.range=r.name+"!"+i,this.parent.notify("actionComplete",{eventArgs:o,action:"format"}))}else e.cancel=!0},e.prototype.setBottomBorderPriority=function(e,t,r){if(cl(e,t+1)){var n=this.skipHiddenRows(e,t+1);""!==this.parent.getCellStyleValue(["borderTop"],[n,r]).borderTop&&(e.rows[t].cells[r].style.bottomPriority=!0)}},e.prototype.setFullBorder=function(e,t,r,n,i,a,s){var o={};n===r[0]&&(this.checkAdjacentBorder(e,"borderBottom",n-1,i),this.checkFullBorder(e,"borderBottom",n-1,i)),i===r[1]&&(this.checkAdjacentBorder(e,"borderRight",n,i-1),this.checkFullBorder(e,"borderRight",n,i-1)),i===r[3]?(this.checkAdjacentBorder(e,"borderLeft",n,i+1),this.checkFullBorder(e,"borderLeft",n,i+1)):this.checkAdjacentBorder(e,"border",n,i+1),o.borderRight=t,o.borderTop=t,o.borderLeft=t,o.borderBottom=t,this.setCellBorder(e,o,n,i,a,i===r[3],null,s),n===r[2]?(this.checkAdjacentBorder(e,"borderTop",n+1,i),this.checkFullBorder(e,"borderTop",n+1,i),this.setBottomBorderPriority(e,n,i)):this.checkAdjacentBorder(e,"border",n+1,i)},e.prototype.checkAdjacentBorder=function(e,t,r,n){var i={};""!==this.parent.getCellStyleValue([t],[r,n])[""+t]&&(i[""+t]=void 0,this.setCellStyle(e,r,n,i))},e.prototype.checkFullBorder=function(e,t,r,n){var i=this.parent.getCellStyleValue(["border"],[r,n]).border;if(""!==i){var a={border:void 0};["borderBottom","borderTop","borderLeft","borderRight"].forEach((function(e){e!==t&&(a[""+e]=i)})),this.setCellStyle(e,r,n,a)}},e.prototype.textDecorationActionUpdate=function(e){var r=this.parent.getActiveSheet(),n={range:r.selectedRange,style:e.style,requestType:"CellFormat"},i=c(t(r.selectedRange)),a=$r(Ln(i[0],i[1],r),bl(r,i[1]),hl(r,i[0])),s=!!bl(r,i[1])&&bl(r,i[1]).isReadOnly,o=!!hl(r,i[0])&&hl(r,i[0]).isReadOnly;if(a||s||o||(this.parent.trigger("beforeCellFormat",n),this.parent.notify("actionBegin",{eventArgs:n,action:"format"}),!n.cancel)){var l=e.style.textDecoration.toLowerCase(),d=l,h=t(r.activeCell),p=this.parent.getCellStyleValue(["textDecoration"],h).textDecoration.toLowerCase(),u=!1;"underline"===p?d="underline"===l?"none":"underline line-through":"line-through"===p?d="line-through"===l?"none":"underline line-through":"underline line-through"===p&&(d="underline"===l?"line-through":"underline",u=!0),"none"===d&&(u=!0);var f={textDecoration:d};this.format({style:f,range:h,refreshRibbon:e.refreshRibbon,onActionUpdate:!0});for(var g=i[0];g<=i[2];g++)for(var m=i[1];m<=i[3];m++)if(g!==h[0]||m!==h[1]){if(f={},"none"===(p=this.parent.getCellStyleValue(["textDecoration"],[g,m]).textDecoration.toLowerCase())){if(u)continue;f.textDecoration=l}else if("underline"===p||"line-through"===p)if(u){if(l!==p)continue;f.textDecoration="none"}else f.textDecoration=l!==p?"underline line-through":l;else if("underline line-through"===p){if(!u)continue;f.textDecoration="underline"===l?"line-through":"underline"}this.format({style:f,range:[g,m,g,m],refreshRibbon:e.refreshRibbon,onActionUpdate:!0})}a||s||o||(n.range=r.name+"!"+n.range,n.style.textDecoration=d,this.parent.notify("actionComplete",{eventArgs:n,action:"format"}))}else e.cancel=!0},e.prototype.setTypedBorder=function(e,t,r,n,i){var a;if("Outer"===n){for(var s=r[1];s<=r[3];s++)this.checkAdjacentBorder(e,"borderBottom",r[0]-1,s),this.checkFullBorder(e,"borderBottom",r[0]-1,s),this.setCellBorder(e,{borderTop:t},r[0],s,i,s===r[3]),this.checkAdjacentBorder(e,"borderTop",r[2]+1,s),this.checkFullBorder(e,"borderTop",r[2]+1,s),this.setCellBorder(e,{borderBottom:t},r[2],s,i,s===r[3],n),this.setBottomBorderPriority(e,r[2],s);for(var o=r[0];o<=r[2];o++)this.checkAdjacentBorder(e,"borderRight",o,r[1]-1),this.checkFullBorder(e,"borderRight",o,r[1]-1),this.setCellBorder(e,{borderLeft:t},o,r[1],i),this.checkAdjacentBorder(e,"borderLeft",o,r[3]+1),this.checkFullBorder(e,"borderLeft",o,r[3]+1),this.setCellBorder(e,{borderRight:t},o,r[3],i,null,n)}else if("Inner"===n)for(var l=r[0];l<=r[2];l++)for(var d=r[1];d<=r[3];d++){var h={};""!==(a=this.parent.getCellStyleValue(["border"],[l,d]).border)&&(h.border=void 0,d!==r[3]&&d!==r[1]&&l!==r[0]&&l!==r[2]||(l===r[0]&&(h.borderTop=a),l===r[2]&&(h.borderBottom=a),d===r[3]&&(h.borderRight=a),d===r[1]&&(h.borderLeft=a))),d!==r[3]&&(h.borderRight=t),l!==r[0]&&(h.borderTop=t),l!==r[2]&&(h.borderBottom=t),d!==r[1]&&(h.borderLeft=t),this.setCellBorder(e,h,l,d,i,d===r[3])}else if("Vertical"===n)for(l=r[0];l<=r[2];l++)for(d=r[1];d<=r[3];d++){h={borderRight:t,borderLeft:t};d===r[1]&&(this.checkAdjacentBorder(e,"borderRight",l,d-1),this.checkFullBorder(e,"borderRight",l,d-1)),d===r[3]&&(this.checkAdjacentBorder(e,"borderLeft",l,d+1),this.checkFullBorder(e,"borderLeft",l,d+1)),this.setCellBorder(e,h,l,d,i)}else for(l=r[0];l<=r[2];l++)for(d=r[1];d<=r[3];d++){h={borderTop:t,borderBottom:t};l===r[0]&&(this.checkAdjacentBorder(e,"borderBottom",l-1,d),this.checkFullBorder(e,"borderBottom",l-1,d)),this.setCellBorder(e,h,l,d,i,d===r[3]),l===r[2]&&(this.checkAdjacentBorder(e,"borderTop",l+1,d),this.checkFullBorder(e,"borderTop",l+1,d),this.setBottomBorderPriority(e,l,d))}},e.prototype.setCellBorder=function(e,t,r,n,i,a,s,o,l){var d=Ln(r,n,e),h=bl(e,n),p=hl(e,r);if(!(d&&d.isReadOnly||h&&h.isReadOnly||p&&p.isReadOnly||(this.setCellStyle(e,r,n,t),o||this.parent.getActiveSheet().id!==e.id))){if("Outer"===s&&(t.borderBottom||t.borderRight)){var c={range:[r,n,r,n]};this.parent.notify(Et,c),r=c.range[0],n=c.range[1]}l&&(""===t.borderTop&&""!==this.parent.getCellStyleValue(["borderBottom"],[r-1,n]).borderBottom&&(t.borderTop=this.parent.getCellStyleValue(["borderBottom"],[r-1,n]).borderBottom),""===t.borderLeft&&""!==this.parent.getCellStyleValue(["borderRight"],[r,n-1]).borderRight&&(t.borderLeft=this.parent.getCellStyleValue(["borderRight"],[r,n-1]).borderRight),""===t.borderRight&&""!==this.parent.getCellStyleValue(["borderLeft"],[r,n+1]).borderLeft&&(t.borderRight=this.parent.getCellStyleValue(["borderLeft"],[r,n+1]).borderLeft)),this.parent.notify(le,{style:t,rowIdx:r,colIdx:n,onActionUpdate:i,first:"",lastCell:a,isHeightCheckNeeded:!0,manualUpdate:!0})}},e.prototype.setCellStyle=function(e,t,r,n){e.rows[t]?e.rows[t].cells||(e.rows[t].cells=[]):e.rows[t]={cells:[]},e.rows[t].cells[r]||(e.rows[t].cells[r]={}),e.rows[t].cells[r].style||(e.rows[t].cells[r].style={}),Object.assign(e.rows[t].cells[r].style,n,null,!0)},e.prototype.skipHiddenRows=function(e,t){return cl(e,++t)&&(t=this.skipHiddenRows(e,t)),t},e.prototype.addEventListener=function(){this.parent.on(ae,this.format,this),this.parent.on(oe,this.textDecorationActionUpdate,this),this.parent.on(Ft,this.clearCellObj,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(ae,this.format),this.parent.off(oe,this.textDecorationActionUpdate),this.parent.off(Ft,this.clearCellObj))},e.prototype.clearCellObj=function(e){for(var t,r,n,i,a,s=e.range?e.range.lastIndexOf("!"):0,l=e.range?s>0?e.range.substring(s+1):e.range:this.parent.getActiveSheet().selectedRange,d=e.range&&s>0?vn(this.parent,e.range.substring(0,s)):this.parent.activeSheetIndex,h=In(this.parent,d),p=c(o(l)),u=p[0],f=p[2],g=h.conditionalFormats&&h.conditionalFormats.length&&[].slice.call(h.conditionalFormats),m=[];u<=f;u++)for(n=p[1],i=p[3];n<=i;n++){var v=Ln(u,n,h),y=$r(v,bl(h,n),hl(h,u));if(v&&!y)switch(e.type){case"Clear Formats":delete v.format,delete v.rowSpan,delete v.style,delete v.wrap,delete v.colSpan,delete v.formattedText;break;case"Clear Contents":v.hyperlink&&this.parent.notify(Gt,{sheet:h,rowIdx:u,colIdx:n,preventRefresh:!0}),a=!(!v.value&&!v.formula),delete v.value,delete v.formula,delete v.formattedText,a&&(r={action:"refreshCalculate",rowIndex:u,colIndex:n,sheetIndex:d},this.parent.notify(pe,r),g&&!t&&((t=r.isFormulaDependent)||_r(g,m,u,n)));break;case"Clear Hyperlinks":delete v.hyperlink;break;case"Clear All":a=!(!v.value&&!v.formula),Pn(u,n,h,{},!1),a&&(r={action:"refreshCalculate",rowIndex:u,colIndex:n,sheetIndex:d},this.parent.notify(pe,r),g&&!t&&(t=r.isFormulaDependent))}}(m.length||t)&&d===this.parent.activeSheetIndex&&this.parent.notify(kt,{cfModel:!t&&m,refreshAll:t,isAction:!0})},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.getModuleName=function(){return"workbookcellformat"},e}(),Wo=function(){function r(e){this.parent=e,this.addEventListener()}return r.prototype.destroy=function(){this.removeEventListener(),this.parent=null},r.prototype.addEventListener=function(){this.parent.on(ce,this.performEditOperation,this)},r.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off(ce,this.performEditOperation)},r.prototype.getModuleName=function(){return"workbookEdit"},r.prototype.performEditOperation=function(e){if("updateCellValue"===e.action)e.isFormulaDependent=this.updateCellValue(e.address,e.value,e.sheetIndex,e.isValueOnly,e.skipFormatCheck,e.isRandomFormula,e.skipCellFormat,e.isDelete,e.deletedRange,e.fillType,e.cellInformation,e.isRedo,e.isDependentUpdate,e.actionName,e.isPaste)},r.prototype.updateCellValue=function(r,n,a,s,o,l,d,h,p,c,u,f,g,m,v){var y,C;void 0===a&&(a=this.parent.activeSheetIndex),y="string"==typeof r?t(r):r;var b=In(this.parent,a),x=Ln(y[0],y[1],b,!0);if(x||(x=b.rows[y[0]].cells[y[1]]={}),s)x.value=n,x.formattedText&&delete x.formattedText;else{var S=xr(n);S="#SPILL!"===n||S;var w=!1;x.formula&&x.formula.indexOf("UNIQUE")>-1&&""===n&&(w=!0);var I=!("Text"===Bo(x.format)||S&&n.toLowerCase().startsWith("=text("));(S="Text"!==Bo(x.format)&&S)||w||(x.formula&&(x.formula=""),x.value=I?an(n,v):n);var E={action:"refreshCalculate",value:n,rowIndex:y[0],colIndex:y[1],sheetIndex:a,isFormula:S,isRandomFormula:l,isDelete:h,deletedRange:p,fillType:c,isDependentRefresh:g};if(I&&!o){var N={value:n,rowIndex:y[0],colIndex:y[1],sheetIndex:a,updatedVal:"",skipCellFormat:d};if(S)!(0,e.isNullOrUndefined)(n)&&n.toLowerCase().includes("unique(")&&n.length>0&&(x.value=n);else if(this.parent.notify(ue,N),!(0,e.isNullOrUndefined)(N.updatedVal)&&N.updatedVal.length>0)x.value=N.updatedVal;else if(this.parent.isEdit&&n&&!rn(n))if(x.format){var R={value:x.value,format:x.format,formattedText:x.value,type:"General",cell:x,rowIndex:y[0],colIndex:y[1]};this.parent.notify(re,R)}else{var O=(0,e.getNumberDependable)(this.parent.locale,e.defaultCurrencyCode);if(n.includes(O)||n.includes("%")||n.includes((0,e.getNumericObject)(this.parent.locale).group)){var k=new e.Internationalization,A={intl:k,updateValue:!0,value:"",curSymbol:O,cell:x};this.parent.notify(fe,{args:A,intl:k,fResult:n,cell:x})}}}if("#SPILL!"===n)x.value=n;else{var F={cellIdx:y,isUnique:!1};if(this.parent.notify(Ee,F),"Manual"===this.parent.calculationMode&&S&&(0,e.isNullOrUndefined)(g)&&("autofill"!==m&&"FillSeries"!==m||"autofill"===m&&""!==x.formula)&&!this.parent.isEdit&&(0,e.isNullOrUndefined)(this.parent.element.querySelector(".e-text-replaceInp"))&&(w=!0,f||void 0!==x.value||(w=!1)),w||h?n=x.value:(this.parent.notify(pe,E),C=E.isFormulaDependent),S){if(x.formula=E.value,!("Manual"===this.parent.calculationMode&&w&&f&&!this.parent.isEdit&&u&&u.cellDetails&&u.cellDetails.length>0&&0===u.cutCellDetails.length)||(0,e.isNullOrUndefined)(u.cellDetails[0].autoFillText)&&(0,e.isNullOrUndefined)(u.cellDetails[0].copyCellValue))n=x.value,"Manual"===this.parent.calculationMode&&u&&f&&u.displayText&&(n=x.value=u.displayText);else for(var T=0;T<u.cellDetails.length;T++)if(u.cellDetails[T].rowIndex===r[0]&&u.cellDetails[T].colIndex===r[1]){n=u.cellDetails[T].copyCellValue?x.value=u.cellDetails[T].copyCellValue:x.value=u.cellDetails[T].autoFillText;break}var D=x.formula.toLowerCase();"=now()"!==D||x.format&&"General"!==x.format?D.includes("=time(")&&!x.format&&(x.format="h:mm AM/PM"):x.format=Mo("ShortDate")+" h:mm"}else!x.value||"string"!=typeof x.value||0!==x.value.indexOf("www.")&&0!==x.value.indexOf("https://")&&0!==x.value.indexOf("http://")&&0!==x.value.indexOf("ftp://")||this.parent.notify(Ve,{hyperlink:x.value,cell:b.name+"!"+i(y[0],y[1])})}}return this.parent.setUsedRange(y[0],y[1],b),!this.parent.chartColl.length||this.parent.isEdit||l||this.parent.notify(Bt,{cell:x,rIdx:y[0],cIdx:y[1],sheetIdx:a}),C},r}(),Go=function(){function r(e){this.parent=e,this.addEventListener()}return r.prototype.destroy=function(){this.removeEventListener(),this.parent=null},r.prototype.addEventListener=function(){this.parent.on(Ve,this.setLinkHandler,this)},r.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off(Ve,this.setLinkHandler)},r.prototype.setLinkHandler=function(r){var n,i=r.hyperlink,a=r.cell;if(a&&-1!==a.indexOf("!")){var s=a.lastIndexOf("!");if(n=In(this.parent,vn(this.parent,a.substring(0,s))),a=a.substring(s+1),!n)return}else n=this.parent.getActiveSheet(),a=a||n.selectedRange;var o=!r.triggerEvt&&n.isProtected;if(!o||n.protectSettings.insertLink){var l,d=c(t(a));"string"==typeof i?0===i.toLowerCase().indexOf("www.")&&(i="http://"+i):0===i.address.toLowerCase().indexOf("www.")&&(i.address="http://"+i.address);for(var h=t(n.activeCell),p=d[0];p<=d[2];p++)for(var u=d[1];u<=d[3];u++)o&&Ar(Ln(p,u,n),bl(n,u))||(l={hyperlink:i},(0,e.isNullOrUndefined)(r.displayText)||(r.triggerEvt||r.isUndoRedo?p===h[0]&&u===h[1]&&(l.value=r.displayText,delete l.formattedText):(l.value=r.displayText,delete l.formattedText)),l.style={textDecoration:"underline",color:"#00e"},Hr(this.parent,n,{cell:l,rowIdx:p,colIdx:u,preventEvt:!r.triggerEvt}))}},r.prototype.getModuleName=function(){return"workbookHyperlink"},r}(),Yo=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.insertModel=function(e){var t,r,n,i,a=this;if(e.model){var s,o,l,d,h=[];if("number"==typeof e.start){s=e.start,e.end=e.end||s,s>e.end&&(s=e.end,e.end=e.start),"Row"===e.modelType&&s<e.model.maxHgts.length&&(d=[]);for(var p=s;p<=e.end;p++)h.push({}),d&&d.push(null)}else e.start?(s=e.start[0].index||0,h=e.start,l=!0):(s=0,h.push({})),"Row"===e.modelType&&s<e.model.maxHgts.length&&(d=[],h.forEach((function(){d.push(null)})));var c={model:h,index:s,modelType:e.modelType,insertType:e.insertType,cancel:!1,isUndoRedo:e.isUndoRedo},u={eventArgs:c,action:"insert"};if(e.isAction){if(this.parent.notify(K,u),c.cancel)return;delete c.cancel,c.isAction=e.isAction}var f={startIndex:s,endIndex:s+h.length-1,modelType:e.modelType,sheet:e.model,isInsert:!0};if("Row"===e.modelType){if(void 0!==e.checkCount&&e.model.rows&&e.checkCount===e.model.rows.length)return;if(this.parent.notify(nr,f),e.model=e.model,e.model.rows||(e.model.rows=[]),l&&e.model.usedRange.rowIndex>-1&&s>e.model.usedRange.rowIndex)for(p=e.model.usedRange.rowIndex;p<s-1;p++)h.splice(0,0,{});var g=this.parent.frozenRowCount(e.model);s<g&&(this.parent.setSheetPropertyOnMute(e.model,"frozenRows",e.model.frozenRows+h.length),c.freezePane=!0),(t=e.model.rows).splice.apply(t,[s,0].concat(h)),d&&(r=e.model.maxHgts).splice.apply(r,[s,0].concat(d)),this.setRowColCount(f.startIndex,f.endIndex,e.model,"row"),s>e.model.usedRange.rowIndex?this.parent.setUsedRange(s+(h.length-1),e.model.usedRange.colIndex,e.model,!0):this.parent.setUsedRange(e.model.usedRange.rowIndex+h.length,e.model.usedRange.colIndex,e.model,!0);var m,v,y=s+h.length,C=void 0,b=function(t){e.model.rows[y]&&e.model.rows[y].cells&&e.model.rows[y].cells[t]&&void 0!==(C=e.model.rows[y].cells[t]).rowSpan&&C.rowSpan<0&&void 0===C.colSpan&&x.parent.notify(Nt,{range:[y,t,y,t],insertCount:h.length,insertModel:"Row"}),m=Ln(s-1,t,e.model,!1,!0).style,C=Ln(s+1,t,e.model,!1,!0),m&&(v={},Object.keys(m).forEach((function(e){"borderLeft"!==e&&"borderRight"!==e&&"borderTop"!==e&&"borderBottom"!==e&&(v[e]=m[e])})),C.style&&x.checkBorder(C.style,e.model.rows[s-1].cells[t].style,v),e.isUndoRedo||h.forEach((function(e){e.cells||(e.cells=[]),e.cells[t]||(e.cells[t]={}),e.cells[t].style||(e.cells[t].style={}),Object.assign(e.cells[t].style,v)})))},x=this;for(p=0;p<=e.model.usedRange.colIndex;p++)b(p);c.sheetCount=e.model.rows.length}else if("Column"===e.modelType){if(void 0!==e.checkCount&&e.model.columns&&e.checkCount===e.model.columns.length)return;this.parent.notify(nr,f),e.model=e.model,e.model.columns||(e.model.columns=[]),s&&!e.model.columns[s-1]&&(e.model.columns[s-1]={}),(n=e.model.columns).splice.apply(n,[s,0].concat(h));var S=this.parent.frozenColCount(e.model);s<S&&(this.parent.setSheetPropertyOnMute(e.model,"frozenColumns",e.model.frozenColumns+h.length),c.freezePane=!0),this.setRowColCount(f.startIndex,f.endIndex,e.model,"col"),s>e.model.usedRange.colIndex?this.parent.setUsedRange(e.model.usedRange.rowIndex,s+(h.length-1),e.model,!0):this.parent.setUsedRange(e.model.usedRange.rowIndex,e.model.usedRange.colIndex+h.length,e.model,!0),e.model.rows||(e.model.rows=[]);var w=[];e.columnCellsModel||(e.columnCellsModel=[]);for(p=0;p<h.length;p++)w.push(null);o=[];var I,E;for(C=void 0,p=0;p<=e.model.usedRange.rowIndex;p++){e.model.rows[p]?e.model.rows[p].cells||(e.model.rows[p].cells=[]):e.model.rows[p]={cells:[]},s&&!e.model.rows[p].cells[s-1]&&(e.model.rows[p].cells[s-1]={}),(i=e.model.rows[p].cells).splice.apply(i,[s,0].concat(e.columnCellsModel[p]&&e.columnCellsModel[p].cells?e.columnCellsModel[p].cells:w));y=s+h.length;if(e.model.rows[p].cells[y]&&void 0!==(C=e.model.rows[p].cells[y]).colSpan&&C.colSpan<0&&void 0===C.rowSpan&&o.push({range:[p,y,p,y],insertCount:w.length,insertModel:"Column"}),I=Ln(p,s-1,e.model,!1,!0).style,C=Ln(p,s+1,e.model,!1,!0),I&&(E={},Object.keys(I).forEach((function(e){"borderLeft"!==e&&"borderRight"!==e&&"borderTop"!==e&&"borderBottom"!==e&&(E[e]=I[e])})),C.style&&this.checkBorder(C.style,e.model.rows[p].cells[s-1].style,E),!e.isUndoRedo))for(var N=s;N<y;N++)e.model.rows[p].cells[N]||(e.model.rows[p].cells[N]={}),e.model.rows[p].cells[N].style||(e.model.rows[p].cells[N].style={}),Object.assign(e.model.rows[p].cells[N].style,E)}o.forEach((function(e){a.parent.notify(Nt,e)})),c.sheetCount=e.model.columns.length}else{if(void 0!==e.checkCount&&e.checkCount===this.parent.sheets.length)return;var R,O=h,k=On(this.parent),A=e.isFromUpdateAction;for(p=0;p<O.length;p++)if(O[p].name)for(N=0;N<this.parent.sheets.length;N++)if(O[p].name===this.parent.sheets[N].name){O.splice(p,1),p--;break}if(!O.length)return;delete h[0].index,this.parent.createSheet(s,h),e.activeSheetIndex?(c.activeSheetIndex=e.activeSheetIndex,this.parent.setProperties({activeSheetIndex:e.activeSheetIndex},!0)):!e.isAction&&e.start<this.parent.activeSheetIndex&&this.parent.setProperties({activeSheetIndex:this.parent.skipHiddenSheets(this.parent.activeSheetIndex)},!0),A&&this.parent.setProperties({activeSheetIndex:vn(this.parent,k)},!0),h.forEach((function(e){l&&a.updateRangeModel(e.ranges);var t=a.parent.viewport,r={sheet:e,resolveAfterFullDataLoaded:!0,indexes:[t.topIndex,t.leftIndex,t.bottomIndex,t.rightIndex],promise:new Promise((function(e){e(void 0)}))};a.parent.notify(j,r),R=e.id,a.parent.notify(pe,{action:"addSheet",visibleName:e.name,sheetName:"Sheet"+R,sheetId:R})})),c.activeSheetIndex=e.activeSheetIndex,c.sheetCount=this.parent.sheets.length}"Sheet"!==e.modelType&&(this.insertConditionalFormats(e),this.parent.notify(er,{start:s,end:s+h.length-1,modelType:e.modelType,model:e.model,isInsert:!0}),c.activeSheetIndex=vn(this.parent,e.model.name)),this.parent.notify(Xe,u)}},e.prototype.setRowColCount=function(e,t,r,n){var i=n+"Count";this.parent.setSheetPropertyOnMute(r,i,r[""+i]+(t-e+1)),r.id===this.parent.getActiveSheet().id&&this.parent.notify(he,{index:r[""+i]-1,update:n,isInsert:!0,start:e,end:t})},e.prototype.updateRangeModel=function(e){e.forEach((function(e){e.dataSource&&(e.startCell=e.startCell||"A1",e.showFieldAsHeader=void 0===e.showFieldAsHeader||e.showFieldAsHeader,e.template=e.template||"",e.address=e.address||"A1")}))},e.prototype.checkBorder=function(e,t,r){e.borderLeft&&e.borderLeft===t.borderLeft&&(r.borderLeft=e.borderLeft),e.borderRight&&e.borderRight===t.borderRight&&(r.borderRight=e.borderRight),e.borderTop&&e.borderTop===t.borderTop&&(r.borderTop=e.borderTop),e.borderBottom&&e.borderBottom===t.borderBottom&&(r.borderBottom=e.borderBottom)},e.prototype.setInsertInfo=function(e,t,r,n,i){void 0===i&&(i="Row");var a=r=t+(r-1);e.ranges.forEach((function(e){e.info&&t<e.info[""+n]&&(e.info["insert"+i+"Range"]?e.info["insert"+i+"Range"].push([t,a]):e.info["insert"+i+"Range"]=[[t,a]],e.info[""+n]+=a-t+1)}))},e.prototype.insertConditionalFormats=function(e){var r=e.model.conditionalFormats;if("delete"===e.prevAction)this.parent.setSheetPropertyOnMute(e.model,"conditionalFormats",e.conditionalFormats);else if(r)for(var n=0,i=r.length;n<i;n++)r[n].range=a(Vr(e,t(r[n].range),!e.isAction&&!e.isUndoRedo))},e.prototype.addEventListener=function(){this.parent.on($e,this.insertModel,this)},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off($e,this.insertModel)},e.prototype.getModuleName=function(){return"workbookinsert"},e}(),Xo=function(){function r(e){this.parent=e,this.addEventListener()}return r.prototype.deleteModel=function(e){var t=this,r=this.parent.sheets.length;if("Sheet"!==e.modelType||1!==r){var n=e.modelType.toLowerCase()+"s";if(e.start=e.start,e.start>e.end){var i=e.start;e.start=e.end,e.end=i}var a={startIndex:e.start,endIndex:e.end,modelType:e.modelType,cancel:!1,isUndoRedo:e.isUndoRedo},s={eventArgs:a,action:"delete"};if(!e.isAction||(this.parent.notify(K,s),!a.cancel)){var o,l,d=[],h=e.end-e.start+1,p={startIndex:e.start,endIndex:e.end,modelType:e.modelType,sheet:e.model,isDelete:!0},c=this.parent.scrollSettings.isFinite;if("Row"===e.modelType){if(void 0!==e.checkCount&&e.checkCount===e.model.usedRange.rowIndex)return;if(this.parent.notify(nr,p),e.model=e.model,c){if(e.start>=e.model.rowCount)return;e.end>=e.model.rowCount&&(e.end=e.model.rowCount-1)}else{if(e.start>e.model.usedRange.rowIndex)return;e.end>e.model.usedRange.rowIndex&&(e.end-=e.end-e.model.usedRange.rowIndex)}this.setRowColCount(e.start,e.end,e.model,"row"),e.start<=e.model.usedRange.rowIndex&&(this.parent.setSheetPropertyOnMute(e.model,"usedRange",{rowIndex:e.model.usedRange.rowIndex-(e.end-e.start+1),colIndex:e.model.usedRange.colIndex}),e.model.usedRange.rowIndex<0&&this.parent.setSheetPropertyOnMute(e.model,"usedRange",{rowIndex:0,colIndex:e.model.usedRange.colIndex}));var u=this.parent.frozenRowCount(e.model);e.start<u&&(u=e.end<u?e.end-e.start+1:u-e.start,u=e.model.frozenRows-u,this.parent.setSheetPropertyOnMute(e.model,"frozenRows",u),a.freezePane=!0);var f=e.end+1,g=void 0,m=void 0;if(e.model.rows[e.start]&&e.model.rows[e.start].cells)for(var v=0;v<=e.model.usedRange.colIndex;v++){if(e.model.rows[e.start].cells[v]&&void 0!==e.model.rows[e.start].cells[v].rowSpan&&e.model.rows[e.start].cells[v].rowSpan<0&&void 0===e.model.rows[e.start].cells[v].colSpan&&(m={range:[e.start,v,e.start,v]},this.parent.notify(Et,m),m.range=m.range,m.range[2]<=e.end&&((l=Ln(m.range[0],v,e.model))&&l.rowSpan>1&&(l.rowSpan-(m.range[2]-e.start+1)>1?Pn(m.range[0],v,e.model,{colSpan:l.rowSpan-(m.range[2]-e.start+1)},!0):delete e.model.rows[m.range[0]].cells[v].rowSpan),m=null)),e.model.rows[f]&&e.model.rows[f].cells&&e.model.rows[f].cells[v]&&void 0!==e.model.rows[f].cells[v].rowSpan&&e.model.rows[f].cells[v].rowSpan<0&&void 0===e.model.rows[f].cells[v].colSpan)if(m||(m={range:[f,v,f,v]},this.parent.notify(Et,m)),g=new Object,m.range=m.range,Object.assign(g,Ln(m.range[0],m.range[1],e.model)),g&&g.rowSpan&&(g.rowSpan>1||g.colSpan>1))(b=[])[1]=v,b[3]=g.colSpan>1?v+(g.colSpan-1):v,m.range=m.range,m.range[0]<e.start?(b[0]=b[2]=m.range[0],g.rowSpan-h>1&&(b[2]+=g.rowSpan-h-1)):(b[0]=b[2]=e.start,g.rowSpan-(e.end-m.range[0]+1)>1&&(b[2]+=g.rowSpan-(e.end-m.range[0]+1)-1)),d.push({range:b,isAction:!1,preventRefresh:!0,merge:!0,type:"All",skipChecking:!0});m=null}a.sheetCount=e.model.usedRange.rowIndex}else if("Column"===e.modelType){if(void 0!==e.checkCount&&e.checkCount===e.model.usedRange.colIndex)return;if(this.parent.notify(nr,p),e.model=e.model,c){if(e.start>=e.model.colCount)return;e.end>=e.model.colCount&&(e.end=e.model.colCount-1)}else{if(e.start>e.model.usedRange.colIndex)return;e.end>e.model.usedRange.colIndex&&(e.end-=e.end-e.model.usedRange.colIndex)}this.setRowColCount(e.start,e.end,e.model,"col"),e.start<=e.model.usedRange.colIndex&&(this.parent.setSheetPropertyOnMute(e.model,"usedRange",{rowIndex:e.model.usedRange.rowIndex,colIndex:e.model.usedRange.colIndex-h}),e.model.usedRange.colIndex<0&&this.parent.setSheetPropertyOnMute(e.model,"usedRange",{rowIndex:e.model.usedRange.rowIndex,colIndex:0}));var y=this.parent.frozenColCount(e.model);e.start<y&&(y=e.end<y?e.end-e.start+1:y-e.start,y=e.model.frozenColumns-y,this.parent.setSheetPropertyOnMute(e.model,"frozenColumns",y),this.parent.updateTopLeftCell(),a.freezePane=!0),o=[];for(f=e.end+1,g=void 0,m=void 0,v=0;v<=e.model.usedRange.rowIndex;v++)if(o.push({}),e.model.rows[v]&&e.model.rows[v].cells){if(e.model.rows[v].cells[e.start]&&void 0!==e.model.rows[v].cells[e.start].colSpan&&e.model.rows[v].cells[e.start].colSpan<0&&void 0===e.model.rows[v].cells[e.start].rowSpan&&(m={range:[v,e.start,v,e.start]},this.parent.notify(Et,m),m.range=m.range,m.range[3]<=e.end)){var C=Ln(v,m.range[1],e.model);C&&C.colSpan>1&&(C.colSpan-(m.range[3]-e.start+1)>1?Pn(v,m.range[1],e.model,{colSpan:C.colSpan-(m.range[3]-e.start+1)},!0):delete e.model.rows[v].cells[m.range[1]].colSpan),m=null}var b;if(e.model.rows[v].cells[f]&&void 0!==e.model.rows[v].cells[f].colSpan&&e.model.rows[v].cells[f].colSpan<0&&void 0===e.model.rows[v].cells[f].rowSpan)if(m||(m={range:[v,f,v,f]},this.parent.notify(Et,m)),g=new Object,m.range=m.range,Object.assign(g,Ln(m.range[0],m.range[1],e.model)),g&&g.colSpan&&(g.colSpan>1||g.rowSpan>1))(b=[])[0]=v,b[2]=g.rowSpan>1?v+(g.rowSpan-1):v,m.range=m.range,m.range[1]<e.start?(b[1]=b[3]=m.range[1],g.colSpan-h>1&&(b[3]+=g.colSpan-h-1)):(b[1]=b[3]=e.start,g.colSpan-(e.end-m.range[1]+1)>1&&(b[3]+=g.colSpan-(e.end-m.range[1]+1)-1)),d.push({range:b,isAction:!1,preventRefresh:!0,merge:!0,type:"All",skipChecking:!0});o[v].cells=e.model.rows[v].cells.splice(e.start,h),m=null}a.sheetCount=e.model.usedRange.colIndex,a.deletedCellsModel=o}else{if(e.end-e.start==this.parent.sheets.length-1||void 0!==e.checkCount&&e.checkCount===this.parent.sheets.length)return;this.parent.notify(nr,p),a.sheetCount=this.parent.sheets.length,a.activeSheetIndex=this.parent.activeSheetIndex}var x=[],S="Row"===e.modelType&&e.start<e.model.maxHgts.length,w=e.model[""+n];for(v=e.start;v<=e.end;v++)"Sheet"===e.modelType&&w[v]&&this.parent.notify(pe,{action:"deleteSheetTab",sheetId:w[v].id}),w[e.start]||e.start<w.length?(x.push(w[e.start]||{}),w.splice(e.start,1)):x.push({}),v===e.start&&(x[0].index=e.start),S&&e.model.maxHgts.splice(e.start,1);d.forEach((function(e){return t.parent.notify(St,e)})),this.parent.notify(Wt,e),"Sheet"!==e.modelType&&(this.parent.notify(er,e),a.refreshSheet=e.refreshSheet,a.activeSheetIndex=vn(this.parent,e.model.name),a.conditionalFormats=[],this.deleteConditionalFormats(e,a)),a.definedNames=p.definedNames,a.isAction=e.isAction,a.deletedModel=x,delete a.cancel,this.parent.notify(Ke,s)}}},r.prototype.setRowColCount=function(e,t,r,n){var i=n+"Count",a=r[""+i];t>=a&&(t=a-1),t<e||(this.parent.setSheetPropertyOnMute(r,i,a-(t-e+1)),r.id===this.parent.getActiveSheet().id&&this.parent.notify(he,{index:a-1,update:n,isDelete:!0,start:e,end:t}))},r.prototype.deleteConditionalFormats=function(r,n){var i=r.model.conditionalFormats;if(i)for(var s=0;s<i.length;s++){n.conditionalFormats.push((0,e.extend)({},i[s],null,!0));var o=t(i[s].range),l=t(r.model.selectedRange);"Column"===r.modelType&&l[1]<=o[1]&&l[3]>=o[3]||"Row"===r.modelType&&l[0]<=o[0]&&l[2]>=o[2]?(i.splice(i.indexOf(i[s]),1),s--):i[s].range=a(zr(r,o))}},r.prototype.addEventListener=function(){this.parent.on(Ze,this.deleteModel,this)},r.prototype.destroy=function(){this.removeEventListener(),this.parent=null},r.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off(Ze,this.deleteModel)},r.prototype.getModuleName=function(){return"workbookdelete"},r}(),Ko=function(){function r(e){this.parent=e,this.addEventListener()}return r.prototype.destroy=function(){this.removeEventListener(),this.parent=null},r.prototype.addEventListener=function(){this.parent.on(Qe,this.validationHandler,this),this.parent.on(et,this.addHighlightHandler,this),this.parent.on(dt,this.removeHighlightHandler,this),this.parent.on(qt,this.beforeInsertDeleteHandler,this),this.parent.on(Wt,this.beforeInsertDeleteHandler,this),this.parent.on(nr,this.beforeInsertDeleteHandler,this)},r.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(Qe,this.validationHandler),this.parent.off(et,this.addHighlightHandler),this.parent.off(dt,this.removeHighlightHandler),this.parent.off(qt,this.beforeInsertDeleteHandler),this.parent.off(Wt,this.beforeInsertDeleteHandler),this.parent.off(nr,this.beforeInsertDeleteHandler))},r.prototype.validationHandler=function(r){var n,i,a=this,s=r.range,o="",l=r.range.lastIndexOf("!");if(l>-1&&(s=r.range.substring(l+1),o=r.range.substring(0,l)),o){var d=vn(this.parent,o);n=In(this.parent,d),i=d===this.parent.activeSheetIndex}else n=this.parent.getActiveSheet(),i=!0;this.parent.dataValidationRange=(this.parent.dataValidationRange.indexOf("!")>-1?"":n.name+"!")+this.parent.dataValidationRange+s+",";var h=this.getRangeWhenColumnSelected(s,n);s=h.range,(0,e.isNullOrUndefined)(o)||(r.range=o+"!"+s),r.range=r.range||n.selectedRange;var p,u,f,g=c(t(r.range));r.viewport&&h.isFullCol&&(f=Wr(this.parent,r.viewport)),!r.isRemoveValidation&&"List"===r.rules.type&&r.rules.value1&&(r.rules.value1=r.rules.value1.trim(),r.rules.value1[r.rules.value1.length-1]===this.parent.listSeparator&&(r.rules.value1=r.rules.value1.substring(0,r.rules.value1.length-1)));for(var m,v=c(t(n.activeCell)),y=function(t){if(h.isFullCol){if(u=bl(n,t),!r.isRemoveValidation){var i=Object.assign({},r.rules),s=Pr(d=[0,t,0,t],c=g,n,C.parent,{formula:r.rules.value1});if(i.value1=s,(0,e.isNullOrUndefined)(r.rules.value2)||""===r.rules.value2)"Custom"===r.rules.type&&delete i.value2;else{var o=Pr(d,c,n,C.parent,{formula:r.rules.value2});i.value2=o}return u.validation=i,t===v[1]&&(m="List"===u.validation.type),"continue"}u&&u.validation&&(t===v[1]&&(m="List"===u.validation.type),delete u.validation,f&&f.forEach((function(e){for(var r=e[0];r<=e[2];r++)p=Ln(r,t,n),a.parent.notify(le,{rowIdx:r,colIdx:t,style:a.parent.getCellStyleValue(["backgroundColor","color"],[r,t])})})))}for(var l=g[0];l<=g[2];l++)if(r.isRemoveValidation)(u=bl(n,t))&&u.validation&&(l===g[2]&&(u.validation.address=kr(u.validation.address,[g[0],t,g[2],t],t)),C.parent.notify(le,{rowIdx:l,colIdx:t,style:C.parent.getCellStyleValue(["backgroundColor","color"],[l,t])})),(p=Ln(l,t,n))&&p.validation&&(l===v[0]&&t===v[1]&&(m="List"===p.validation.type),Hr(C.parent,n,{cell:{validation:{}},rowIdx:l,colIdx:t})?m=!1:(delete p.validation,C.parent.notify(le,{rowIdx:l,colIdx:t,style:C.parent.getCellStyleValue(["backgroundColor","color"],[l,t])})));else{i=Object.assign({},r.rules);var d,c,y=Pr(d=[l,t,l,t],c=g,n,C.parent,{formula:r.rules.value1});if(i.value1=y,(0,e.isNullOrUndefined)(r.rules.value2)||""===r.rules.value2)"Custom"===r.rules.type&&delete i.value2;else{o=Pr(d,c,n,C.parent,{formula:r.rules.value2});i.value2=o}p={validation:Object.assign({},i)},Hr(C.parent,n,{cell:p,rowIdx:l,colIdx:t}),l===v[0]&&t===v[1]&&(m="List"===p.validation.type),l===g[2]&&(u=bl(n,t))&&u.validation&&(u.validation.address=kr(u.validation.address,[g[0],t,g[2],t],t))}},C=this,b=g[1];b<=g[3];b++)y(b);if(i&&m){var x=void 0,S=Ln(v[0],v[1],n,!1,!0);r.isRemoveValidation?x={}:(x=S.validation)||(x=(u=bl(n,v[1]))&&u.validation||{}),this.parent.notify(vr,{validation:x,cell:S,rowIdx:v[0],colIdx:v[1],isRefresh:!0})}},r.prototype.addHighlightHandler=function(e){this.invalidDataHandler(e.range,!1,e.td,e.isclearFormat)},r.prototype.removeHighlightHandler=function(e){this.invalidDataHandler(e.range,!0)},r.prototype.getRange=function(e){var r=t(e),n=this.parent.getActiveSheet(),i=n.colCount,a=n.rowCount;return r[2]===a-1&&0===r[0]?e=e.replace(/[0-9]/g,""):r[3]===i-1&&0===r[2]&&(e=e.replace(/\D/g,"")),e},r.prototype.invalidDataHandler=function(e,r,n,i){for(var a=e?p(this.parent,e):this.parent.activeSheetIndex,s=In(this.parent,a),o=(e=e||s.selectedRange).includes("!")?Cn(e):s.name,d=this.getRangeWhenColumnSelected(l(e),s),h=d.isFullCol,u=(e=o+"!"+d.range)?c(t(e)):[],f=(e=this.getRange(e))?u[0]:0,g=e?u[2]:s.rows.length;f<=g;f++)if(s&&s.rows[f])for(var m=e?u[1]:0,v=e?u[3]:s.rows[f].cells.length;m<=v;m++){var y=void 0;if(s.rows[f].cells&&s.rows[f].cells[m]){var C=bl(s,m),b=s.rows[f].cells[m];if(b&&b.validation){if(y=b.validation,i&&!y.isHighlighted)return;r?y.isHighlighted&&(b.validation.isHighlighted=!1):b.validation.isHighlighted=!0}else if(C&&C.validation){if(y=C.validation,i&&!y.isHighlighted)return;if(y.address&&!El(C,f,m))continue;r&&h?y.isHighlighted&&(C.validation.isHighlighted=!1):h&&(C.validation.isHighlighted=!0)}if(y&&this.parent.allowDataValidation){var x={value:b.value?b.value:"",range:[f,m],sheetIdx:a,td:n,isValid:!0};this.parent.notify(Je,x),x.isValid||cl(s,f)||a!==this.parent.activeSheetIndex||this.parent.notify(jt,{isRemoveHighlightedData:r,rowIdx:f,colIdx:m,td:n})}}}},r.prototype.beforeInsertDeleteHandler=function(t){var r,n=this;if("Sheet"===t.modelType){if(t.name!==nr)return;r=!0}else if(t.name===nr)return;var i,a,s,o,l=t.name===qt;if(l)s=In(this.parent,t.activeSheetIndex),a=t.index+(t.model.length-1),i={insertDeleteArgs:{startIndex:t.index,endIndex:a,modelType:t.modelType,isInsert:!0,sheet:s},sheetIdx:t.activeSheetIndex},o=t.index-1;else if(r){var d=[],h=void 0,p={action:"getSheetInfo",sheetInfo:[]};this.parent.notify(pe,p);for(var c=t.startIndex;c<=t.endIndex;c++){h=this.parent.sheets[c].id;for(var u=0;u<p.sheetInfo.length;u++)if(p.sheetInfo[u].index===h){d.push(p.sheetInfo[u].sheet);break}}i={sheetNames:d}}else s=t.model,i={insertDeleteArgs:{startIndex:t.start,modelType:t.modelType,endIndex:t.end,sheet:s},sheetIdx:yn(this.parent,s.id)};var f,g,m,v,y,C,b,x=function(e){!xr(e.value1)||i.otherSheet&&!e.value1.includes(s.name)||(i.cell={formula:e.value1},n.parent.notify(ir,i),e.value1=i.cell.formula),!xr(e.value2)||i.otherSheet&&!e.value2.includes(s.name)||(i.cell={formula:e.value2},n.parent.notify(ir,i),e.value2=i.cell.formula)},S="Column"===t.modelType,w=function(r,n){if(r){i.insertDeleteArgs.forceUpdate=!0;for(var o=t.index;o<=a;o++)r=(0,e.extend)({},r),x(r),n?xl(s,o,{validation:r}):S?Pn(y,o,s,{validation:r},!0):Pn(o,C,s,{validation:r},!0);delete i.insertDeleteArgs.forceUpdate}};this.parent.sheets.forEach((function(e,n){if(r){if(n>=t.startIndex&&n<=t.endIndex)return}else n===i.sheetIdx?(b=l,delete i.otherSheet,delete i.formulaSheet):(i.otherSheet=!0,i.formulaSheet=e,b=!1);for(m=e.usedRange.rowIndex+1,C=0,v=e.usedRange.colIndex+1;C<v;C++)if(!(b&&S&&C>=t.index&&C<=a))for((g=e.columns&&e.columns[C])&&g.validation&&(x(g.validation),b&&S&&o===C&&w(g.validation,!0)),y=0;y<m;y++)(f=Ln(y,C,e,!1,!0)).validation&&(!b||S||y<t.index||y>a)&&(x(f.validation),b&&o===(S?C:y)&&w(f.validation))}))},r.prototype.getRangeWhenColumnSelected=function(e,t){var r,n=e.split(":");return e.match(/\D/g)&&!e.match(/[0-9]/g)?(n[0]+=1,n[1]+=t.rowCount,e=n[0]+":"+n[1],r=!0):!e.match(/\D/g)&&e.match(/[0-9]/g)&&(n[0]="A"+n[0],n[1]=i(0,t.colCount-1).replace(/[0-9]/g,"")+n[1],e=n[0]+":"+n[1]),{range:e,isFullCol:r}},r.prototype.getModuleName=function(){return"workbookDataValidation"},r}(),$o=function(){return $o=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},$o.apply(this,arguments)},Zo=function(){function n(e){this.parent=e,this.addEventListener()}return n.prototype.destroy=function(){this.removeEventListener(),this.parent=null},n.prototype.addEventListener=function(){this.parent.on(rt,this.find,this),this.parent.on(at,this.replace,this),this.parent.on(st,this.replaceAll,this),this.parent.on(pt,this.totalCount,this),this.parent.on(se,this.findAllValues,this)},n.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(rt,this.find),this.parent.off(at,this.replace),this.parent.off(st,this.replaceAll),this.parent.off(pt,this.totalCount),this.parent.off(se,this.findAllValues))},n.prototype.find=function(r){r.sheetIndex=(0,e.isUndefined)(r.sheetIndex)?this.parent.activeSheetIndex:r.sheetIndex;var n,i=this.parent.sheets[r.sheetIndex],a=t(i.activeCell),s={startRow:a[0],startCol:a[1],findVal:r.isCSen?r.value:r.value.toLowerCase(),activeCell:a};("By Row"===r.searchBy?s.startRow>i.usedRange.rowIndex:s.startCol>i.usedRange.colIndex)?"next"===r.findOpt?s.startRow=s.startCol=0:(s.startRow=i.usedRange.rowIndex,s.startCol=i.usedRange.colIndex):"By Row"===r.searchBy?s.startCol>i.usedRange.colIndex&&("next"===r.findOpt?(s.startRow++,s.startRow>i.usedRange.rowIndex&&(s.startRow=0),s.startCol=0):(s.startRow--,s.startRow<0&&(s.startRow=i.usedRange.rowIndex),s.startCol=i.usedRange.colIndex)):s.startRow>i.usedRange.rowIndex&&("next"===r.findOpt?(s.startCol++,s.startCol>i.usedRange.colIndex&&(s.startRow=0),s.startRow=0):(s.startCol--,s.startCol<0&&(s.startCol=i.usedRange.colIndex),s.startRow=i.usedRange.colIndex)),"Workbook"===r.mode?(s.sheets=this.parent.sheets,s.sheetIdx=r.sheetIndex):(s.sheets=[i],s.sheetIdx=0);var o=r.showDialog&&this.parent.element&&this.parent.element.querySelector(".e-header-panel");o&&(n=(o.offsetHeight||(i.showHeaders?30:0))+1),r.localeObj=(0,e.getNumericObject)(this.parent.locale),"next"===r.findOpt?this.findNext(r,s):this.findPrevious(r,s),r.showDialog&&this.parent.notify(Z,{findValue:r.value,isPublic:!0,headerHgt:n})},n.prototype.findNext=function(e,t){var r=this,n=function(n,i,a){for(var s,o,l=n;l<=i&&(s=t.sheets[l],!(o=l===t.sheetIdx?a?r.findNextOnSheet(e,t.startRow,t.startCol,t.findVal,s,void 0,t.activeCell):r.findNextOnSheet(e,0,0,t.findVal,s,"By Row"===e.searchBy?t.startRow:t.startCol):r.findNextOnSheet(e,0,0,t.findVal,s)));l++);return o},i=n(t.sheetIdx,t.sheets.length-1,!0);i||(i=n(0,t.sheetIdx)),i?this.parent.notify(nt,{address:i}):this.parent.notify(ot,null)},n.prototype.findNextOnSheet=function(e,t,r,n,i,a,s){var o,l,d;if("By Row"===e.searchBy){void 0===a&&(a=i.rows.length-1);var h=void 0;for(l=t;l<=a;l++)if(!cl(i,l))for(d=s&&l===t?r:0,h=i.rows[l]&&i.rows[l].cells&&i.rows[l].cells.length;d<h;d++)if(!Il(i,d)&&(o=this.checkMatch(e,n,l,d,i,s)))return o}else{void 0===a&&(a=i.usedRange.colIndex);var p=i.rows&&i.rows.length-1;for(d=r;d<=a;d++)if(!Il(i,d))for(l=s&&d===r?t:0;l<=p;l++)if(!cl(i,l)&&(o=this.checkMatch(e,n,l,d,i,s)))return o}return o},n.prototype.findPrevious=function(e,t){var r,n=this,i=function(r,i,a){for(var s,o,l=r;l>=i&&(s=t.sheets[l],!(o=l===t.sheetIdx?a?n.findPrevOnSheet(e,t.startRow,t.startCol,0,0,t.findVal,s,t.activeCell):"By Row"===e.searchBy?n.findPrevOnSheet(e,s.usedRange.rowIndex,s.usedRange.colIndex,t.startRow,0,t.findVal,s):n.findPrevOnSheet(e,s.usedRange.rowIndex,s.usedRange.colIndex,0,t.startCol,t.findVal,s):n.findPrevOnSheet(e,s.usedRange.rowIndex,s.usedRange.colIndex,0,0,t.findVal,s)));l--);return o};(r=i(t.sheetIdx,0,!0))||(r=i(t.sheets.length-1,t.sheetIdx)),r?this.parent.notify(nt,{address:r}):this.parent.notify(ot,null)},n.prototype.findPrevOnSheet=function(e,t,r,n,i,a,s,o){var l,d,h;if("By Row"===e.searchBy){for(h=t;h>=n;h--)if(!cl(s,h))for(d=o&&h===t?r:s.rows[h]&&s.rows[h].cells&&s.rows[h].cells.length-1;d>=i;d--)if(!Il(s,d)&&(l=this.checkMatch(e,a,h,d,s,o)))return l}else for(d=r;d>=i;d--)if(!Il(s,d))for(h=o&&d===r?t:s.rows&&s.rows.length-1;h>=n;h--)if(!cl(s,h)&&(l=this.checkMatch(e,a,h,d,s,o)))return l;return l},n.prototype.checkMatch=function(e,t,r,n,a,s){if(s&&r===s[0]&&n===s[1])return null;var o=Ln(r,n,a,!1,!0);if(a.isProtected&&!a.protectSettings.selectCells&&a.protectSettings.selectUnLockedCells&&Ar(o,bl(a,n)))return null;var l=function(s){if(s)if(e.isCSen||(s=s.toLowerCase()),e.isEMatch){if(s===t)return a.name+"!"+i(r,n)}else if(s.includes(t))return a.name+"!"+i(r,n);return null},d=this.getDisplayText(o,r,n,e.localeObj),h=l(d);return h||!(o=Ln(r,n,a,!1,!0)).format||Vn(o.format,!0)||d.includes("%")||(h=l(this.getCellVal(o,e.localeObj))),h},n.prototype.replace=function(n){var a=this,s=(0,e.isUndefined)(n.sheetIndex)?this.parent.activeSheetIndex:n.sheetIndex,o=In(this.parent,n.sheetIndex);if(o.isProtected)this.parent.notify(yt,null);else{var l,d=t(n.address||o.activeCell),h=Ln(d[0],d[1],o,!1,!0),p=this.parent.getDisplayText(h).toString();n.value=n.value.toString(),n.isCSen||(l=n.value.toLowerCase());var c=(0,e.getNumericObject)(this.parent.locale),u=function(e){var t;if(n.isCSen)t=n.isEMatch?p===n.value&&n.replaceValue:p.indexOf(n.value)>-1&&p.replace(n.value,n.replaceValue);else if(n.isEMatch)t=p.toLowerCase()===l&&n.replaceValue;else{var r=RegExp;t=p.toLowerCase().includes(l)&&p.replace(new r(n.value.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"ig"),n.replaceValue)}return e||f||!h.format||Vn(h.format,!0)||p.includes("%")||(p=a.getCellVal(h,c))&&(t=u(!0)),t},f=u();if(f||(n.findOpt="next",this.find(n),d=r(o.activeCell),h=Ln(d[0],d[1],o,!1,!0),p=this.parent.getDisplayText(h).toString(),f=u()))if($r(Ln(d[0],d[1],o),bl(o,d[1]),hl(o,d[0])))this.parent.notify(Ct,null);else{var g={address:o.name+"!"+i(d[0],d[1]),cancel:!1,compareValue:n.value,replaceValue:n.replaceValue,sheetIndex:s};if(n.isAction){if(this.parent.notify(K,{action:"beforeReplace",eventArgs:g}),g.cancel)return;delete g.cancel}Hr(this.parent,o,{cell:{value:f},rowIdx:d[0],colIdx:d[1],uiRefresh:!0,checkCF:!0,valChange:!0}),n.isAction&&this.parent.notify("actionComplete",{action:"replace",eventArgs:g})}}},n.prototype.replaceAll=function(t){for(var n,a,s,o,l=this,d="Sheet"===t.mode?t.sheetIndex:0,h=this.parent.sheets[d],c=h.usedRange.rowIndex,u=0,f=h.usedRange.colIndex,g=0,m=[],v=t.isAction,y=$o({addressCollection:m,cancel:!1},t),C=function(e,n){requestAnimationFrame?requestAnimationFrame((function(){if(!y.cancel&&y.addressCollection[n]){var i=r(y.addressCollection[n].substring(y.addressCollection[n].lastIndexOf("!")+1)),a=p(l.parent,y.addressCollection[n]);Hr(l.parent,l.parent.sheets[a],{cell:{value:e},rowIdx:i[0],uiRefresh:!0,checkCF:!0,colIdx:i[1],valChange:!0,skipFormatCheck:t.skipFormatCheck}),n===y.addressCollection.length-1&&v&&l.parent.notify("actionComplete",{action:"replaceAll",eventArgs:y})}})):l.parent.updateCell({value:e},y.addressCollection[n])},b=function(e){var r;if(e)if(t.isCSen)t.isEMatch?e===t.value&&(C(t.replaceValue,m.length),m.push(h.name+"!"+i(u,g)),r=!0):e.indexOf(t.value)>-1&&(C(e.replace(t.value,t.replaceValue),m.length),m.push(h.name+"!"+i(u,g)),r=!0);else if(t.isEMatch)e.toLowerCase()===t.value&&(C(t.replaceValue,m.length),m.push(h.name+"!"+i(u,g)),r=!0);else{var n=e.toLowerCase();if(e===t.value||n.indexOf(t.value.toString().toLowerCase())>-1||n===t.value||e===t.value||n.indexOf(t.value)>-1){var a=RegExp;s=new a(t.value.toString().replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"ig"),C(e.replace(s,t.replaceValue),m.length),m.push(h.name+"!"+i(u,g)),r=!0}}return r},x=(0,e.getNumericObject)(this.parent.locale);u<=c+1;u++){if(g>f&&u>c&&"Workbook"===t.mode){if(d++,!(h=this.parent.sheets[d]))break;g=0,u=0,f=h.usedRange.colIndex,c=h.usedRange.rowIndex}if(a=h.rows[u])for(g===f+1&&(g=0);g<=f;g++)if(a&&(o=a.cells&&a.cells[g])){if($r(o,bl(h,g),a))continue;b(n=this.getDisplayText(o,u,g,x).toString())||!o.format||Vn(o.format,!0)||n.includes("%")||b(this.getCellVal(a.cells[g],x))}}m.length&&v?(this.parent.notify("actionBegin",{action:"beforeReplaceAll",eventArgs:y}),y.cancel||this.parent.notify(mt,{count:y.addressCollection.length,replaceValue:y.replaceValue})):this.parent.notify(mt,{count:y.addressCollection.length,replaceValue:y.replaceValue})},n.prototype.getDisplayText=function(e,t,r,n){if(!e)return"";if(!e.value&&0!==e.value)return e.hyperlink?"string"==typeof e.hyperlink?e.hyperlink:e.hyperlink.address||"":"";var i=e.value.toString();if(e.format||i.includes(n.dateSeparator)){var a={value:e.value,format:e.format,formattedText:e.value,cell:e,rowIndex:t,colIndex:r};return this.parent.notify(re,a),a.formattedText}return i},n.prototype.getCellVal=function(e,t){return rn(e.value)?"."!==t.decimal?e.value.toString().split(".").join(t.decimal):e.value.toString():e.value?e.value.toString().toLowerCase():""},n.prototype.totalCount=function(t){var n,i=this,a=this.parent.sheets[t.sheetIndex],s=r(a.activeCell),o=0,l=0,d=t.value.toLowerCase(),h=(0,e.getNumericObject)(this.parent.locale);a.rows.filter((function(e,t){return e&&e.cells&&!e.isFiltered&&!e.hidden&&e.cells.filter((function(e,r){!e||!e.value&&0!==e.value||Il(a,r)||a.isProtected&&!a.protectSettings.selectCells&&Ar(e,bl(a,r))||((n=i.getDisplayText(e,t,r,h).toLowerCase()).includes(d)||e.format&&!Vn(e.format,!0)&&!n.includes("%")&&i.getCellVal(e,h).includes(d))&&(o++,(t===s[0]&&r>=s[1]||t>s[0])&&l++)}))}));var p=o;(o=p-(l-=1))>p&&(o=p),0===o||this.parent.getDisplayText(Ln(s[0],s[1],a)).toLowerCase().includes(d)||(o-=1),t.findCount=o+" of "+p},n.prototype.findAllValues=function(t){for(var r,n=t.sheetIndex,a=this.parent.sheets[n],s=a.usedRange.rowIndex,o=0,l=a.usedRange.colIndex,d=0,h=this.parent.sheets.length,p=t.sheetIndex;o<=s+1;o++){if(1!==p&&t.sheetIndex===h&&(n=1),o>s&&d>l&&"Workbook"===t.mode){if(++n>h-1&&(n=0),p===n)return void 0;(a=this.parent.sheets[n])&&(o=0,d=0,l=a.usedRange.colIndex,s=a.usedRange.rowIndex)}if(!(0,e.isNullOrUndefined)(a)&&a.rows[o]){var c=a.rows[o];for(d===l+2&&(d=0);d<=l+1;d++)if(c&&c.cells&&c.cells[d]){var u=a.rows[o].cells[d];if(u&&!(0,e.isNullOrUndefined)(u.value)&&""!==u.value&&(!a.isProtected||a.protectSettings.selectCells||a.protectSettings.selectUnLockedCells&&!Ar(u,bl(a,d)))){var f=void 0;if(u.format)f=this.parent.getDisplayText(a.rows[o].cells[d]).toString();else f=u.value.toString();if(t.isCSen&&t.isEMatch)f===t.value&&(r=a.name+"!"+i(o,d),t.findCollection.push(r));else if(t.isCSen&&!t.isEMatch){var g=f.indexOf(t.value)>-1;(f===t.value||g)&&(r=a.name+"!"+i(o,d),t.findCollection.push(r))}else if(!t.isCSen&&t.isEMatch){(m=f.toString().toLowerCase())===t.value.toLowerCase()&&(r=a.name+"!"+i(o,d),t.findCollection.push(r))}else if(!t.isCSen&&!t.isEMatch){var m;g=(m=f.toString().toLowerCase()).indexOf(t.value.toLowerCase())>-1;(m===t.value||f===t.value||g||f===t.value)&&(r=a.name+"!"+i(o,d),t.findCollection.push(r))}}}}}},n.prototype.getModuleName=function(){return"workbookfindAndReplace"},n}(),Jo=function(){function t(e){this.parent=e,this.addEventListener()}return t.prototype.protectsheetHandler=function(t){var r=(0,e.isNullOrUndefined)(t.sheetIndex)?this.parent.activeSheetIndex:t.sheetIndex,n=In(this.parent,r);this.parent.setSheetPropertyOnMute(n,"isProtected",!0),this.parent.setSheetPropertyOnMute(n,"protectSettings",{selectCells:t.protectSettings.selectCells,formatCells:t.protectSettings.formatCells,formatColumns:t.protectSettings.formatColumns,formatRows:t.protectSettings.formatRows,insertLink:t.protectSettings.insertLink,selectUnLockedCells:t.protectSettings.selectUnLockedCells}),this.parent.notify(ut,{sheetIndex:r,triggerEvent:t.triggerEvent}),this.parent.notify(ft,{props:"Protect"}),n.password=t.password?t.password:"",n.columns.forEach((function(t){t&&(0,e.isUndefined)(t.isLocked)&&(t.isLocked=!0)}))},t.prototype.unprotectsheetHandler=function(t){var r=this.parent.getActiveSheet();(0,e.isNullOrUndefined)(t.sheet)||(r=this.parent.sheets[t.sheet]),r.isImportProtected&&(r.isImportProtected=!1),r.protectSettings.formatCells=r.protectSettings.formatColumns=!1,r.protectSettings.formatRows=r.protectSettings.selectCells=!1,this.parent.setSheetPropertyOnMute(r,"isProtected",!1),this.parent.notify(ut,r.protectSettings),this.parent.notify(ft,{props:"Protect"})},t.prototype.destroy=function(){this.removeEventListener(),this.parent=null},t.prototype.addEventListener=function(){this.parent.on(gt,this.protectsheetHandler,this),this.parent.on(vt,this.unprotectsheetHandler,this),this.parent.on(bt,this.lockCells,this)},t.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(gt,this.protectsheetHandler),this.parent.off(bt,this.lockCells),this.parent.off(gt,this.unprotectsheetHandler))},t.prototype.lockCells=function(e){var t=this.parent.getAddressInfo(e.range),r=c(t.indices),n=In(this.parent,t.sheetIndex),i=!!e.isLocked&&e.isLocked;if(0===r[0]&&r[2]===n.rowCount-1)for(var a=r[1];a<=r[3];a++)xl(n,a,{isLocked:e.isLocked});for(a=r[0];a<=r[2];a++)for(var s=r[1];s<=r[3];s++)Pn(a,s,n,{isLocked:i},!0);e.triggerEvent&&this.parent.notify("actionComplete",{action:"lockCells",eventArgs:e})},t.prototype.getModuleName=function(){return"workbookProtectSheet"},t}(),Qo=function(){function r(e){this.parent=e,this.addEventListener()}return r.prototype.merge=function(r){r.sheetIndex=(0,e.isUndefined)(r.sheetIndex)?this.parent.activeSheetIndex:r.sheetIndex,r.isAction&&(this.parent.notify("actionBegin",{eventArgs:r,action:"merge"}),r.model||(r.model=[])),"string"==typeof r.range&&(r.range=t(r.range));var n=r.range=c(r.range);if(r.skipChecking||this.mergedRange(r),r.merge&&"All"!==r.type){if("Horizontally"===r.type)for(var i=r.range[0],a=r.range[2];i<=a;i++)r.range=[i,n[1],i,n[3]],this.mergeAll(r,i-n[0]);else if("Vertically"===r.type){var s=r.range[1];for(a=r.range[3];s<=a;s++)r.range=[n[0],s,n[2],s],this.mergeAll(r,0,s-n[1])}}else this.mergeAll(r),r.refreshRibbon&&this.parent.notify(ve,null);r.range=n,this.parent.setUsedRange(r.range[2],r.range[3]),r.isAction&&this.parent.notify("actionComplete",{eventArgs:r,action:"merge"}),r.sheetIndex===this.parent.activeSheetIndex&&(this.parent.notify("selectRange",{address:In(this.parent,r.sheetIndex).selectedRange,skipChecking:!0}),this.parent.chartColl&&this.parent.chartColl.length&&this.parent.notify(Bt,{range:r.range}))},r.prototype.mergeAll=function(t,r,n){void 0===r&&(r=0),void 0===n&&(n=0);var i,a,s,o,l,d,h=0;t.range=t.range;for(var p=(0,e.isUndefined)(t.sheetIndex)?this.parent.getActiveSheet():In(this.parent,t.sheetIndex),c={cell:new Object,rowIdx:t.range[0],colIdx:t.range[1],valChange:!t.merge,preventEvt:!0,uiRefresh:!t.preventRefresh,skipFormatCheck:!0},u=t.range[0],f=r;u<=t.range[2];u++,f++){a=0,t.isAction&&!t.model[f]&&t.model.push({cells:[]});for(var g=t.range[1],m=n;g<=t.range[3];g++,m++){if((i=Ln(u,g,p))&&(i.value||0===i.value||i.formula)&&!s&&(s=i.formula||i.value,l=i.format),t.isAction&&t.merge&&(d=t.model[f].cells[m]={},(0,e.extend)(d,i,null,!0)),i){delete i.rowSpan,delete i.colSpan,d=!t.merge&&!t.isAction&&t.model&&t.model[f]&&t.model[f].cells[m];var v="Manual"===this.parent.calculationMode&&this.parent.getActiveSheet().isSheetCalculated&&!(0,e.isNullOrUndefined)(i.value)&&""!==i.value;d?(v&&(d.value=i.value),Pn(u,g,p,d)):t.model&&t.model[f].cells[m]&&v&&(t.model[f].cells[m].value=i.value)}if(u===t.range[0]&&g===t.range[1]){if(t.merge){t.range[3]-t.range[1]>0&&(c.cell.colSpan=t.range[3]-t.range[1]+1),t.range[2]-t.range[0]>0&&(c.cell.rowSpan=t.range[2]-t.range[0]+1),Hr(this.parent,p,c),c.valChange=c.mergedCells=!0;continue}}else c.rowIdx=u,c.colIdx=g,c.cell={},t.merge&&(u!==t.range[0]&&(c.cell.rowSpan=-h),g!==t.range[1]&&(a++,c.cell.colSpan=-a));Hr(this.parent,p,c),o||(o=c.isFormulaDependent)}h++}if(t.merge)if(s||0===s){delete c.mergedCells,c.cell={};var y=Ln(t.range[0],t.range[1],p);y&&(y.value||y.formula)||(xr(s)?c.cell.formula=s:c.cell.value=s,l&&(c.cell.format=l)),c.rowIdx=t.range[0],c.colIdx=t.range[1],Hr(this.parent,p,c)}else t.preventRefresh||this.parent.notify(wt,{rowIdx:t.range[0],colIdx:t.range[1]});t.preventRefresh||this.refreshCF(p,t.range[0],t.range[1],o)},r.prototype.refreshCF=function(e,t,r,n){e.conditionalFormats&&e.conditionalFormats.length&&this.parent.notify(kt,{indexes:[t,r],refreshAll:n,isAction:!0})},r.prototype.activeCellRange=function(t){t.range=t.range;var r=this.parent.getActiveSheet(),n=Ln(t.range[0],t.range[1],r);n&&(!(0,e.isNullOrUndefined)(n.rowSpan)&&n.rowSpan<0&&(t.range[0]+=n.rowSpan,t.insertCount&&(t.range[0]-=t.insertCount)),!(0,e.isNullOrUndefined)(n.colSpan)&&n.colSpan<0&&(t.range[1]+=n.colSpan,t.insertCount&&(t.range[1]-=t.insertCount)),(n=Ln(t.range[0],t.range[1],r))&&(n.rowSpan>1&&(t.range[0]+(n.rowSpan-1)>=t.range[2]||t.insertCount)&&(t.range[2]=t.range[0]+(n.rowSpan-1)),n.colSpan>1&&(t.range[1]+(n.colSpan-1)>=t.range[3]||t.insertCount)&&(t.range[3]=t.range[1]+(n.colSpan-1))))},r.prototype.mergedRange=function(e){"string"==typeof e.range&&(e.range=t(e.range)),e.range[0]<=e.range[2]&&e.range[1]<=e.range[3]?this.forward(e):e.range[0]>=e.range[2]&&e.range[1]>=e.range[3]?this.reverse(e):e.range[0]<e.range[2]&&e.range[1]>e.range[3]?this.forwardReverse(e):e.range[0]>e.range[2]&&e.range[1]<e.range[3]&&this.reverseForward(e)},r.prototype.forward=function(t){t.range=t.range;var r,n,i=(0,e.isUndefined)(t.sheetIndex)?this.parent.getActiveSheet():In(this.parent,t.sheetIndex),a=Ln(t.range[0],t.range[1],i),s=r=t.range[0],o=n=t.range[1];if(a&&(!(0,e.isNullOrUndefined)(a.rowSpan)&&a.rowSpan<0&&(s=r=t.range[0]+a.rowSpan),!(0,e.isNullOrUndefined)(a.colSpan)&&a.colSpan<0&&(o=n=t.range[1]+a.colSpan),(a=Ln(s,o,i))&&(a.rowSpan>1&&(r+=a.rowSpan-1,s+(a.rowSpan-1)>=t.range[2]&&(t.range[2]=t.range[0],t.range[2]=s+(a.rowSpan-1))),a.colSpan>1&&(n+=a.colSpan-1,o+(a.colSpan-1)>=t.range[3]&&(t.range[3]=t.range[1],t.range[3]=o+(a.colSpan-1))))),t.range[0]=s,t.range[1]=o,t.range[0]===s&&t.range[1]===o&&t.range[2]===r&&t.range[3]===n&&(t.isActiveCell=!0),!t.skipChecking){for(var l=t.range[1];l<=t.range[3];l++)(a=Ln(t.range[2],l,i))&&(s=t.range[2],o=l,!(0,e.isNullOrUndefined)(a.colSpan)&&a.colSpan<0&&(o+=a.colSpan)<t.range[1]&&(t.range[1]=o),!(0,e.isNullOrUndefined)(a.rowSpan)&&a.rowSpan<0&&(s+=a.rowSpan)<t.range[0]&&(t.range[0]=s),(a=Ln(s,o,i))&&(a.colSpan>1&&o+(a.colSpan-1)>t.range[3]&&(t.range[3]=o,t.range[3]=o+(a.colSpan-1)),a.rowSpan>1&&s+(a.rowSpan-1)>t.range[2]&&(t.range[2]=s,t.range[2]=s+(a.rowSpan-1))));var d,h;for(l=t.range[1];l<=t.range[3];l++)(a=Ln(t.range[0],l,i))&&(h=l,d=t.range[0],!(0,e.isNullOrUndefined)(a.colSpan)&&a.colSpan<0&&(h+=a.colSpan)<t.range[1]&&(t.range[1]=h),!(0,e.isNullOrUndefined)(a.rowSpan)&&a.rowSpan<0&&(d+=a.rowSpan)<t.range[0]&&(t.range[0]=d));for(l=t.range[0];l<=t.range[2];l++)(a=Ln(l,t.range[3],i))&&(s=l,o=t.range[3],!(0,e.isNullOrUndefined)(a.rowSpan)&&a.rowSpan<0&&(s+=a.rowSpan)<t.range[0]&&(t.range[0]=s),!(0,e.isNullOrUndefined)(a.colSpan)&&a.colSpan<0&&(o+=a.colSpan)<t.range[1]&&(t.range[1]=o),(a=Ln(s,o,i))&&(a.rowSpan>1&&s+(a.rowSpan-1)>t.range[2]&&(t.range[2]=s,t.range[2]=s+(a.rowSpan-1)),a.colSpan>1&&o+(a.colSpan-1)>t.range[3]&&(t.range[3]=o,t.range[3]=o+(a.colSpan-1))))}},r.prototype.forwardReverse=function(t){var r=this.parent.getActiveSheet();t.range=t.range;var n=t.range[1],i=Ln(t.range[0],t.range[1],r),a=t.range[0];if(i&&(!(0,e.isNullOrUndefined)(i.colSpan)&&i.colSpan<0&&(n+=i.colSpan,t.range[3]>=n&&(t.range[3]=n)),!(0,e.isNullOrUndefined)(i.rowSpan)&&i.rowSpan<0&&(a+=i.rowSpan)<t.range[0]&&(t.range[0]=a),(i=Ln(a,n,r))&&(i.rowSpan>1&&a+(i.rowSpan-1)>=t.range[2]&&(t.range[2]=a+(i.rowSpan-1)),i.colSpan>1&&n+(i.colSpan-1)>=t.range[1]&&(t.range[1]=n+(i.colSpan-1)))),t.range[0]=a,!t.skipChecking){for(var s,o,l,d,h=t.range[3];h<=t.range[1];h++)(i=Ln(t.range[2],h,r))&&(o=h,s=t.range[2],!(0,e.isNullOrUndefined)(i.rowSpan)&&i.rowSpan<0&&(s+=i.rowSpan)<t.range[0]&&(t.range[0]=s),!(0,e.isNullOrUndefined)(i.colSpan)&&i.colSpan<0&&(o+=i.colSpan)<t.range[3]&&(t.range[3]=o),(i=Ln(s,o,r))&&(i.rowSpan>1&&s+(i.rowSpan-1)>t.range[2]&&(t.range[2]=s+(i.rowSpan-1)),i.colSpan>1&&o+(i.colSpan-1)>t.range[1]&&(t.range[1]=o+(i.colSpan-1))));for(h=t.range[3];h<=t.range[1];h++)(i=Ln(t.range[0],h,r))&&(o=h,l=t.range[0],!(0,e.isNullOrUndefined)(i.rowSpan)&&i.rowSpan<0&&(l+=i.rowSpan)<t.range[0]&&(t.range[0]=l),!(0,e.isNullOrUndefined)(i.colSpan)&&i.colSpan<0&&(o+=i.colSpan),(i=Ln(l,o,r))&&(i.rowSpan>1&&l+(i.rowSpan-1)>t.range[2]&&(t.range[2]=l+(i.rowSpan-1)),i.colSpan>1&&o+(i.colSpan-1)>t.range[1]&&(t.range[1]=o,t.range[1]=o+(i.colSpan-1))));for(h=t.range[0];h<=t.range[2];h++)(i=Ln(h,t.range[3],r))&&(l=h,d=t.range[3],!(0,e.isNullOrUndefined)(i.rowSpan)&&i.rowSpan<0&&(l+=i.rowSpan)<t.range[0]&&(t.range[0]=l),!(0,e.isNullOrUndefined)(i.colSpan)&&i.colSpan<0&&(d+=i.colSpan)<t.range[3]&&(t.range[3]=d),(i=Ln(l,d,r))&&(i.rowSpan>1&&l+(i.rowSpan-1)>t.range[2]&&(t.range[2]=l,t.range[2]=l+(i.rowSpan-1)),i.colSpan>1&&d+(i.colSpan-1)>t.range[1]&&(t.range[1]=d,t.range[1]=d+(i.colSpan-1))))}},r.prototype.reverse=function(t){t.range=t.range;var r=t.range[1],n=(0,e.isUndefined)(t.sheetIndex)?this.parent.getActiveSheet():In(this.parent,t.sheetIndex),i=Ln(t.range[0],t.range[1],n),a=t.range[0];i&&(!(0,e.isNullOrUndefined)(i.colSpan)&&i.colSpan<0&&(r+=i.colSpan),!(0,e.isNullOrUndefined)(i.rowSpan)&&i.rowSpan<0&&(a+=i.rowSpan),t.range[2]>=a&&(t.range[2]=a,t.isActiveCell=!0),t.range[3]>=r?(t.range[3]=r,t.range[2]===a&&(t.isActiveCell=!0)):t.isActiveCell&&(t.isActiveCell=!1),(i=Ln(a,r,n))&&(i.rowSpan>1&&a+(i.rowSpan-1)>=t.range[0]&&(t.range[0]=a,t.range[0]=a+(i.rowSpan-1)),i.colSpan>1&&r+(i.colSpan-1)>=t.range[1]&&(t.range[1]=r,t.range[1]=r+(i.colSpan-1))));var s=t.range[3];if(!t.skipChecking){for(var o=t.range[3];o<=t.range[1];o++)(i=Ln(t.range[2],o,n))&&(s=o,a=t.range[2],!(0,e.isNullOrUndefined)(i.rowSpan)&&i.rowSpan<0&&(a+=i.rowSpan)<t.range[2]&&(t.range[2]=a),!(0,e.isNullOrUndefined)(i.colSpan)&&i.colSpan<0&&(s+=i.colSpan)<t.range[3]&&(t.range[3]=s),(i=Ln(a,s,n))&&(i.rowSpan>1&&a+(i.rowSpan-1)>t.range[0]&&(t.range[0]=a,t.range[0]=a+(i.rowSpan-1)),i.colSpan>1&&s+(i.colSpan-1)>t.range[1]&&(t.range[1]=s,t.range[1]=s+(i.colSpan-1))));s=t.range[3];for(o=t.range[3];o<=t.range[1];o++)(i=Ln(t.range[0],o,n))&&(s=o,a=t.range[0],!(0,e.isNullOrUndefined)(i.colSpan)&&i.colSpan<0&&(s+=i.colSpan),!(0,e.isNullOrUndefined)(i.rowSpan)&&i.rowSpan<0&&(a+=i.rowSpan),(i=Ln(a,s,n))&&(i.colSpan>1&&s+(i.colSpan-1)>t.range[1]&&(t.range[1]=s,t.range[1]=s+(i.colSpan-1)),i.rowSpan>1&&a+(i.rowSpan-1)>t.range[0]&&(t.range[0]=a,t.range[0]=a+(i.rowSpan-1))));var l,d;for(o=t.range[2];o<=t.range[0];o++)(i=Ln(o,t.range[3],n))&&(d=o,l=t.range[3],!(0,e.isNullOrUndefined)(i.rowSpan)&&i.rowSpan<0&&(d+=i.rowSpan)<t.range[2]&&(t.range[2]=d),!(0,e.isNullOrUndefined)(i.colSpan)&&i.colSpan<0&&(l+=i.colSpan)<t.range[3]&&(t.range[3]=l),(i=Ln(d,l,n))&&(i.rowSpan>1&&d+(i.rowSpan-1)>t.range[0]&&(t.range[0]=d,t.range[0]=d+(i.rowSpan-1)),i.colSpan>1&&l+(i.colSpan-1)>t.range[1]&&(t.range[1]=l,t.range[1]=l+(i.colSpan-1))))}},r.prototype.reverseForward=function(t){t.range=t.range;var r=(0,e.isUndefined)(t.sheetIndex)?this.parent.getActiveSheet():In(this.parent,t.sheetIndex),n=t.range[0],i=t.range[1],a=Ln(t.range[0],t.range[1],r);if(a&&(!(0,e.isNullOrUndefined)(a.rowSpan)&&a.rowSpan<0&&(n+=a.rowSpan,t.range[2]>=n&&(t.range[2]=n)),!(0,e.isNullOrUndefined)(a.colSpan)&&a.colSpan<0&&(i+=a.colSpan),(a=Ln(n,i,r))&&(a.rowSpan>1&&n+(a.rowSpan-1)>=t.range[0]&&(t.range[0]=n,t.range[0]=n+(a.rowSpan-1)),a.colSpan>1&&i+(a.colSpan-1)>=t.range[3]&&(t.range[3]=t.range[1],t.range[3]=i+(a.colSpan-1)))),!t.skipChecking){for(var s,o,l,d,h=t.range[3],p=t.range[1];p<=t.range[3];p++)(a=Ln(t.range[2],p,r))&&(s=t.range[2],h=p,!(0,e.isNullOrUndefined)(a.rowSpan)&&a.rowSpan<0&&(s+=a.rowSpan)<t.range[2]&&(t.range[2]=s),!(0,e.isNullOrUndefined)(a.colSpan)&&a.colSpan<0&&(h+=a.colSpan)<t.range[1]&&(t.range[1]=h),(a=Ln(s,h,r))&&(a.colSpan>1&&h+(a.colSpan-1)>t.range[3]&&(t.range[3]=h+(a.colSpan-1)),a.rowSpan>1&&a.rowSpan-1+s>t.range[0]&&(t.range[0]=a.rowSpan-1+s)));for(p=t.range[1];p<=t.range[3];p++)(a=Ln(t.range[0],p,r))&&(l=p,o=t.range[0],!(0,e.isNullOrUndefined)(a.colSpan)&&a.colSpan<0&&(l+=a.colSpan)<t.range[1]&&(t.range[1]=l),!(0,e.isNullOrUndefined)(a.rowSpan)&&a.rowSpan<0&&(o+=a.rowSpan),(a=Ln(o,l,r))&&a.rowSpan>1&&o+(a.rowSpan-1)>t.range[0]&&(t.range[0]=o+(a.rowSpan-1)));for(p=t.range[2];p<=t.range[0];p++)(a=Ln(p,t.range[3],r))&&(s=p,d=t.range[3],!(0,e.isNullOrUndefined)(a.rowSpan)&&a.rowSpan<0&&(s+=a.rowSpan)<t.range[2]&&(t.range[2]=s),!(0,e.isNullOrUndefined)(a.colSpan)&&a.colSpan<0&&(d+=a.colSpan)<t.range[1]&&(t.range[1]=d),(a=Ln(s,d,r))&&(a.rowSpan>1&&a.rowSpan-1+s>t.range[0]&&(t.range[0]=a.rowSpan-1+s),a.colSpan>1&&a.colSpan-1+d>t.range[3]&&(t.range[3]=d,t.range[3]=a.colSpan-1+d)))}},r.prototype.insertHandler=function(e){this.activeCellRange(e),e.range=e.range,"Row"===e.insertModel?e.range[2]+=e.insertCount:e.range[3]+=e.insertCount,e.preventRefresh=!0,e.merge=!0,this.mergeAll(e)},r.prototype.addEventListener=function(){this.parent.on(St,this.merge,this),this.parent.on(It,this.mergedRange,this),this.parent.on(Et,this.activeCellRange,this),this.parent.on(Nt,this.insertHandler,this)},r.prototype.destroy=function(){this.removeEventListener(),this.parent=null},r.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(St,this.merge),this.parent.off(It,this.mergedRange),this.parent.off(Et,this.activeCellRange),this.parent.off(Nt,this.insertHandler))},r.prototype.getModuleName=function(){return"workbookmerge"},r}(),el=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.addEventListener=function(){this.parent.on(Ot,this.setCFRule,this),this.parent.on(At,this.clearCFRule,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(Ot,this.setCFRule),this.parent.off(At,this.clearCFRule))},e.prototype.setCFRule=function(e){var r=e.cfModel,n=void 0===e.sheetIdx?p(this.parent,r.range):e.sheetIdx,i=In(this.parent,n),s=c(t(r.range||i.selectedRange));if(r.range=a(s),e.isAction){var o={range:r.range,type:r.type,cancel:!1,cFColor:r.cFColor,value:r.value,sheetIdx:n};if(this.parent.notify(K,{eventArgs:o,action:"conditionalFormat"}),o.cancel)return;r.type=o.type,r.cFColor=o.cFColor,r.value=o.value,o.range!==r.range&&(r.range=o.range,s=c(t(o.range))),delete o.cancel}i.conditionalFormats||this.parent.setSheetPropertyOnMute(i,"conditionalFormats",[]),i.conditionalFormats.push(r),n!==this.parent.activeSheetIndex?e.isUndoRedo&&!e.isFromUpdateAction&&this.parent.notify(nt,{address:i.name+"!"+r.range}):this.parent.notify(kt,{cfModel:[r],isAction:!0}),this.parent.setUsedRange(s[2],s[3]),e.isAction&&this.parent.notify("actionComplete",{eventArgs:{range:r.range,type:r.type,cFColor:r.cFColor,value:r.value,sheetIdx:n},action:"conditionalFormat"})},e.prototype.clearCFRule=function(e){void 0===e.sheetIdx&&(e.sheetIdx=this.parent.activeSheetIndex);var r=In(this.parent,e.sheetIdx),n=r.conditionalFormats,i=n&&n[n.length-1]&&"autofillWithCF"!==n[n.length-1].action;if(e.isUndo){var s;if(e.updatedCFModel)e.updatedCFModel.forEach((function(e){(s=n.indexOf(e))>-1&&n.splice(s,1)}));return n.splice.apply(n,[n.length,0].concat(e.oldCFModel)),this.parent.notify(kt,{cfModel:e.oldCFModel,isAction:!0}),void(e.sheetIdx!==this.parent.activeSheetIndex&&this.parent.notify(nt,{address:r.name+"!"+e.range}))}if(n&&n.length){var o,l,d,h,p,c,u,f,g,m=e.range&&("string"==typeof e.range?t(e.range):e.range);e.oldCFModel=[],e.updatedCFModel=[];for(var v=[],y=[],C=[],b=0;b<n.length;b++){l=(o=n[b]).range.split(",");for(var x=0;x<l.length;x++){if(d=t(l[x]),e.range)if(m[0]<=d[0]&&m[1]<=d[1]&&m[2]>=d[2]&&m[3]>=d[3])l.splice(x,1),x--;else{if(u=m[0]>=d[0]&&m[0]<=d[2],f=m[2]>=d[0]&&m[2]<=d[2],p=m[1]>=d[1]&&m[1]<=d[3],c=m[3]>=d[1]&&m[3]<=d[3],h=[],u&&f?((p||c||m[1]<d[1]&&m[3]>d[3])&&(m[0]-d[0]>0&&h.push(a([d[0],d[1],m[0]-1,d[3]])),d[2]-m[2]>0&&h.push(a([m[2]+1,d[1],d[2],d[3]]))),p&&m[1]!==d[1]&&h.push(a([m[0],d[1],m[2],m[1]-1])),c&&m[3]!==d[3]&&h.push(a([m[0],m[3]+1,m[2],d[3]]))):p&&c?((u||f||m[0]<d[0]&&m[2]>d[2])&&(m[1]-d[1]>0&&h.push(a([d[0],d[1],d[2],m[1]-1])),d[3]-m[3]>0&&h.push(a([d[0],m[3]+1,d[2],d[3]]))),u?m[0]!==d[0]&&h.push(a([d[0],m[1],m[0]-1,m[3]])):f&&m[2]!==d[2]&&h.push(a([m[2]+1,m[1],d[2],m[3]]))):(u||f)&&(p?(m[1]!==d[1]&&h.push(a([d[0],d[1],d[2],m[1]-1])),m[0]-d[0]>0?h.push(a([d[0],m[1],m[0]-1,d[3]])):d[2]-m[2]>0&&h.push(a([m[2]+1,m[1],d[2],d[3]]))):c&&(m[3]!==d[3]&&h.push(a([d[0],m[3]+1,d[2],d[3]])),m[0]-d[0]>0?h.push(a([d[0],d[1],m[0]-1,m[3]])):d[2]-m[2]>0&&h.push(a([m[2]+1,d[1],d[2],m[3]])))),!h.length)continue;l[x]=h.join(",")}else m=d,l.splice(x,1),x--;e.sheetIdx===this.parent.activeSheetIndex&&this.parent.notify(Tt,{indexes:m.slice()})}if((g=l.join(","))!==o.range){if(e.cfModel&&(e.cfModel.cFColor!==o.cFColor||e.cfModel.type!==o.type||e.cfModel.value!==o.value)){C.push(o);continue}y.push(o.range),g?(e.oldCFModel.push({type:o.type,cFColor:o.cFColor,format:o.format,range:o.range,value:o.value}),o.range=g,o.result&&(delete o.result,this.parent.notify(kt,{cfModel:[o],isAction:!0})),e.updatedCFModel.push(o),v.push(o)):(e.oldCFModel.push(o),v.concat(n.splice(b,1)),b--)}}if(e.sheetIdx!==this.parent.activeSheetIndex?e.isUndoRedo&&!e.isFromUpdateAction&&this.parent.notify(nt,{address:r.name+"!"+e.range}):C.length&&this.parent.notify(kt,{cfModel:C,isAction:!0}),(e.isAction||e.isClear)&&e.oldCFModel.length){var S={cFormats:v,oldRange:y,previousConditionalFormats:e.oldCFModel,sheetIdx:e.sheetIdx,selectedRange:e.range};e.updatedCFModel.length&&(S.conditionalFormats=e.updatedCFModel),e.isClear?e.cfClearActionArgs=S:i&&this.parent.notify("actionComplete",{eventArgs:S,action:"clearCF"})}}},e.prototype.getModuleName=function(){return"workbookConditionalFormatting"},e}(),tl=function(){function r(e){this.parent=e,this.addEventListener()}return r.prototype.getFillInfo=function(t){for(var r=this.parent.serviceLocator.getService(sn),n="",i=!0,a="CopyCells",s=[],o=["Down","Up"].indexOf(t.direction)>-1,l=this.getRangeData({range:t.dataRange,sheetIdx:this.parent.activeSheetIndex}),d=l.join().replace(/,/g,"").length,h=this.isRange(t.dataRange)&&d?l.length:1;h--;)if(rn(n=l[h]&&!(0,e.isNullOrUndefined)(l[h].value)?l[h].value:"")||xr(n)||rn(n[n.length-1])){i=!1,a=this.parent.autoFillSettings.fillType;break}return d&&!i||(s.push(r.getConstant("FillSeries")),a="FillSeries"===t.fillType?a:t.fillType),(!o||o&&t.dataRange[1]!==t.dataRange[3])&&s.push("Flash Fill"),{fillType:a,disableItems:s}},r.prototype.isRange=function(e){return e&&(e[0]!==e[2]||e[1]!==e[3])},r.prototype.autoFill=function(e){if(e.dataRange&&e.fillRange&&e.direction&&this.parent.allowEditing&&(!this.parent.getActiveSheet().isProtected||!e.isLockedCell)){var r=c(t(e.dataRange)),n=c(t(e.fillRange)),i={dataRange:r,fillRange:n,direction:e.direction,fillType:e.fillType||this.fillInfo.fillType,dataSheetIndex:p(this.parent,e.dataRange),fillSheetIndex:p(this.parent,e.fillRange),cells:e.cells};switch(this.fillInfo=this.getFillInfo({dataRange:r,fillRange:n,fillType:e.fillType,direction:e.direction}),this.fillInfo.fillType=e.isFillOptClick?e.fillType:this.fillInfo.fillType,e.fillType){case"FillSeries":case"FillWithoutFormatting":this.fillSeries(i);break;case"CopyCells":case"FillFormattingOnly":this.copyCells(i)}}},r.prototype.fillSeries=function(t){var r,n,i,a,o,l,d,h,p,c,u,f,g,m,v,y,C,b,x,S,w,I,E,N,R,O,k={},A=0,F=(0,e.isUndefined)(t.dataSheetIndex)?this.parent.activeSheetIndex:t.dataSheetIndex,T=In(this.parent,F);(0,e.isUndefined)(t.fillSheetIndex)?(R=this.parent.activeSheetIndex,O=!0):O=(R=t.fillSheetIndex)===this.parent.activeSheetIndex;for(var D,L,P=In(this.parent,R),M=t.dataRange[0],B=t.dataRange[1],H=t.dataRange[2],U=t.dataRange[3],V=t.fillRange[0],z=t.fillRange[1],_=t.fillRange[2],j=t.fillRange[3],q=["Down","Up"].indexOf(t.direction)>-1,W=["Up","Left"].indexOf(t.direction)>-1,G=q?U-B:H-M,Y="FillSeries"===t.fillType,X=T.conditionalFormats&&T.conditionalFormats.length&&[].slice.call(T.conditionalFormats),K=[],$=O&&this.applyWrapToOuterCells(P);A<=G;){l=(o=this.updateFillValues(q,M,B,H,U,V,z,_,j,A)).patternRange,d=o.fillRange,i=this.getPattern(l,{isReverseFill:W,isVFill:q},F),h=this.getRangeData({range:l,sheetIdx:F}),q||(h=this.getRangeData({range:l,sheetIdx:F},!0));var Z=!1;h[0]&&h[0].formula&&h[0].formula.match(/=[A-Za-z]+\(([^:]+):([^:]+)\)/)&&(Z=!0),f=h.length;for(var J=0;J<f;J++)if(h[J]&&h[J].isReadOnly)return void this.parent.notify(Ct,null);if(!i||!i.length)return;for(n=i.length,S=(x=this.getSelectedRange(P,{rowIndex:d[0],colIndex:d[1]},{rowIndex:d[2],colIndex:d[3]})).length,W&&(x=x.reverse(),i=i.reverse(),i=this.ensurePattern(i),h=h.reverse()),g=0;g<S;){switch(w=x[g],rn(a=i[g%n])&&(a=i[a]),v=g%f,a.type){case"number":case"date":if(a.isStartWithMonth&&1===f?(E=Qr(a.regVal.a),N=new Date(E),E.setMonth(E.getMonth()+a.regVal.b*a.i),N.getDate()>28&&N.getDate()!==E.getDate()&&(N.setDate(1),N.setMonth(N.getMonth()+a.regVal.b*a.i),N.setDate(new Date(N.getFullYear(),N.getMonth()+1,0).getDate()),E=N),r=en(E).toString()):(r=this.round(a.regVal.a+a.regVal.b*a.i,5).toString(),a.val&&(c="string"==typeof a.val[0]&&a.val[0].match(/^0+/))&&(p=this.getNextFormattedValue(a.val[0],Number(r)))),a.dataVal){if(void 0===a.copy&&!c&&(a.copy=a.val.length>2,a.copy))for(var Q=2;Q<a.val.length&&(a.copy=Math.abs(this.round(a.regVal.a+a.regVal.b*Q,5))!==a.val[Q],!a.copy);Q++);r=a.copy?h[v]&&!(0,e.isNullOrUndefined)(h[v].value)?h[v].value:"":a.start?Math.abs(Number(r))+a.dataVal:c?a.dataVal+p:a.dataVal+Math.abs(Number(r))}W?a.i--:a.i++;break;case"string":var ee=a.i%a.val.length;r=a.val[ee],a.i++;break;case"formula":for(b=!1,r="=",m=0,y=a.val.length;m<y;)"object"==typeof(u=a.val[m])?(b=!0,(C=this.round(u.a+u.b*a.i,5))<1?(r+="#REF!",Z&&(m=y-1,r+=a.val[m])):r+=q?u.c+(u.b?C:"$"+C):(u.b?s(C):u.c.substring(0,u.c.search(/\d/))+"$"+s(C))+u.c.trim()):r+=u,m++;b&&W?a.i--:a.i++;break;case"time":r=(a.regVal.a+a.regVal.b*a.i).toString(),W?a.i--:a.i++}if((I=Ln(w.rowIndex,w.colIndex,P,!1,!0))&&I.isReadOnly)return void this.parent.notify(Ct,null);if(Y?Object.assign(k,h[v],null,!0):("FillWithoutFormatting"===t.fillType&&h[v]&&h[v].hyperlink?(k.hyperlink=h[v].hyperlink,k.style={textDecoration:"none",color:"inherit"}):k.style=I.style,k.format=I.format,k.wrap=I.wrap,k.rowSpan=I.rowSpan,k.colSpan=I.colSpan),h[v]&&h[v].validation){k.validation=Object.assign({},h[v].validation);var te=[w.rowIndex,w.colIndex,w.rowIndex,w.colIndex],re=[t.dataRange[0],t.dataRange[1],t.dataRange[2],t.dataRange[3]],ne=this.parent.sheets[this.parent.activeSheetIndex],ie=Pr(te,re,ne,this.parent,{formula:k.validation.value1});k.validation.value1=ie,""!==k.validation.value2&&(ie=Pr(te,re,ne,this.parent,{formula:k.validation.value2}),k.validation.value2=ie)}var ae=xr(r);ae&&(k.formula=r),("0"!==r||"0"===r&&"FillWithoutFormatting"!==t.fillType)&&(k.value=ae&&"Manual"===this.parent.calculationMode&&"FillWithoutFormatting"===t.fillType?(0,e.isNullOrUndefined)(h[v])?"0":h[v].value:r),(0,e.isNullOrUndefined)(k.notes)||delete k.notes,D={cell:k,rowIdx:w.rowIndex,colIdx:w.colIndex,valChange:!0,uiRefresh:O,pvtExtend:!0,skipFormatCheck:!0,fillType:t.fillType},!O||cl(P,w.rowIndex)||Il(P,w.colIndex)||(D.td=this.parent.getCell(w.rowIndex,w.colIndex),D.td&&(D.uiRefresh=!0)),Hr(this.parent,P,D)||(O&&$(D),X&&!L&&((L=D.isFormulaDependent)||_r(X,K,w.rowIndex,w.colIndex,t.dataRange,t.fillRange,T))),k={},g++}A++}(K.length||L)&&this.parent.notify(kt,{cfModel:!L&&K,refreshAll:L,isAction:!0,isEdit:!0})},r.prototype.copyCells=function(t){var r,n,i,a,s,o,l,d,h,p,c,u,f=0,g={},m=t.dataRange[0],v=t.dataRange[1],y=t.dataRange[2],C=t.dataRange[3],b=t.fillRange[0],x=t.fillRange[1],S=t.fillRange[2],w=t.fillRange[3],I=["Down","Up"].indexOf(t.direction)>-1,E=["Up","Left"].indexOf(t.direction)>-1,N=I?C-v:y-m,R=(0,e.isUndefined)(t.dataSheetIndex)?this.parent.activeSheetIndex:t.dataSheetIndex,O=In(this.parent,R);(0,e.isUndefined)(t.fillSheetIndex)?(u=!0,c=this.parent.activeSheetIndex):(u=t.fillSheetIndex===this.parent.activeSheetIndex,c=t.fillSheetIndex);for(var k,A,F,T=In(this.parent,c),D="FillFormattingOnly"===t.fillType,L=O.conditionalFormats&&O.conditionalFormats.length&&[].slice.call(O.conditionalFormats),P=u&&this.applyWrapToOuterCells(T),M=[];f<=N;){i=(s=this.updateFillValues(I,m,v,y,C,b,x,S,w,f)).patternRange,a=s.fillRange,l=(o=this.getRangeData({range:i,sheetIdx:R})).length;for(var B=0;B<l;B++)if(o[B]&&o[B].isReadOnly)return void this.parent.notify(Ct,null);for(h=(d=this.getSelectedRange(T,{rowIndex:a[0],colIndex:a[1]},{rowIndex:a[2],colIndex:a[3]})).length,r=0,E&&(d=d.reverse());r<h;){if(n=r%l,p=d[r],D&&(k=Ln(p.rowIndex,p.colIndex,T)),Object.assign(g,o[n],null,!0),D&&(g.value=k.value,g.formula=k.formula),g&&g.isReadOnly)return void this.parent.notify(Ct,null);F={cell:g,rowIdx:p.rowIndex,colIdx:p.colIndex,valChange:!0,pvtExtend:!0,fillType:t.fillType},!u||cl(T,p.rowIndex)||Il(T,p.colIndex)||(F.td=this.parent.getCell(p.rowIndex,p.colIndex),F.uiRefresh=!!F.td),Hr(this.parent,T,F,t.cells)||(u&&P(F),L&&!A&&((A=F.isFormulaDependent)||_r(L,M,p.rowIndex,p.colIndex,t.dataRange,t.fillRange,O))),g={},r++}f++}(M.length||A)&&this.parent.notify(kt,{cfModel:!A&&M,refreshAll:A,isAction:!0,isEdit:!0})},r.prototype.applyWrapToOuterCells=function(e){var t,r,n,i=this,a=this.parent.frozenRowCount(e),s=this.parent.frozenColCount(e),o=this.parent.viewport;return o&&(t=o.topIndex+a,r=o.leftIndex+s),function(o){!o.td&&Ln(o.rowIdx,o.colIdx,e,!1,!0).wrap&&(o.rowIdx>=a&&o.rowIdx<t||o.colIdx>=s&&o.colIdx<r)&&(n||(n={range:null,wrap:!0,sheet:e,initial:!0,outsideViewport:!0}),n.range=[o.rowIdx,o.colIdx,o.rowIdx,o.colIdx],i.parent.notify(Ge,n))}},r.prototype.updateFillValues=function(e,t,r,n,i,a,s,o,l,d){var h,p,c,u;return e?(h={rowIndex:t,colIndex:r+d},p={rowIndex:n,colIndex:r+d},c={rowIndex:a,colIndex:s+d},u={rowIndex:o,colIndex:s+d}):(h={rowIndex:t+d,colIndex:r},p={rowIndex:t+d,colIndex:i},c={rowIndex:a+d,colIndex:s},u={rowIndex:a+d,colIndex:l}),{patternRange:[h.rowIndex,h.colIndex,p.rowIndex,p.colIndex],fillRange:[c.rowIndex,c.colIndex,u.rowIndex,u.colIndex]}},r.prototype.getDataPattern=function(t,r){var n,i,a,s,o,l=0,d={val:null,type:null},h=[],p=this.getRangeData({range:t,sheetIdx:(0,e.isUndefined)(r)?this.parent.activeSheetIndex:r}),c=p.length;if(c){for(var u=void 0,f=void 0,g=void 0,m=void 0,v=function(e){return!s&&e&&"-"===e[e.length-1]?e.slice(0,e.length-1):e};l<c;){if(o=!1,p[l])if(p[l].formula&&xr(p[l].formula))n=p[l].formula,a="formula";else{n=(0,e.isNullOrUndefined)(p[l].value)?"":p[l].value;var y={};if(g=p[l].format,m=rn(n),g&&Vn(g,!0,y)){if(a=y.type,n&&!m){var C={value:n,updatedVal:n,cell:p[l]};this.parent.notify(ue,C),C.isDate||C.isTime?p[l].value=n=C.updatedVal:a="string"}o="date"===a&&g.toLowerCase().startsWith("mmm")}else a=m?"number":"string"}else n="",a="string";if(f="","string"===a){if(s=!1,rn(n[0])){u=0;do{u++}while(rn(n[u]));" "===n[u]&&(s=!0,a="number",f=n.slice(u,n.length),n=Number(n.slice(0,u)))}if(!s&&rn(n[n.length-1])){u=1;do{u++}while(rn(n[n.length-u]));a="number",u-=1,f=n.slice(0,n.length-u),i=n.slice(n.length-u,n.length),n=i.match(/^0+/)?i:Number(i),d.dataVal&&d.dataVal!==f&&d.dataVal===v(f)&&(f=d.dataVal)}}0===l?(d={val:[n],type:a,isStartWithMonth:o},f&&(d.dataVal=f,d.start=s)):a!==d.type||d.dataVal&&v(d.dataVal)!==v(f)?(h.push(d),d={val:[n],type:a},f&&(d.dataVal=f,d.start=s)):d.val.push(n),l++}return h.push(d),h}return[{val:null,type:null}]},r.prototype.getPredictionValue=function(e,t){for(var r=0,n=0,i=0,a=0,s=0,o=0,l=0,d=e.length;r<d;)n+=r,i+=Number(e[r]),a+=r*Number(e[r]),s+=r*r,r++;return t?(o=(i*s-n*a)/(d*s-n*n),l=(d*a-n*i)/(d*s-n*n)):(o=this.round((i*s-n*a)/(d*s-n*n),5),l=this.round((d*a-n*i)/(d*s-n*n),5)),{a:o,b:l}},r.prototype.getPattern=function(e,t,r){var n,i,a,s,o,l,d=0,h=[],p=this.getDataPattern(e,r),c=p.length;if(p){for(;d<c;){switch((l=p[d]).type){case"number":case"date":if(i=h.length,o=l.val.length,s=t.isReverseFill?-1:o,1===o){var u=parseFloat(l.val[0])+1;"string"==typeof l.val[0]&&l.val[0].match(/^0+/)?l.val.push(this.getNextFormattedValue(l.val[0],u)):l.val.push(u)}for(a={regVal:this.getPredictionValue(l.dataVal?l.val.slice(0,2):l.val),type:l.type,i:s,isStartWithMonth:l.isStartWithMonth},l.dataVal&&(a.dataVal=l.dataVal,a.val=l.val,a.start=l.start),h.push(a),n=1;n<o;)h.push(i),n++;break;case"string":for(i=h.length,a={val:l.val,type:l.type,i:0},h.push(a),n=1,o=l.val.length;n<o;)h.push(i),n++;break;case"formula":if(o=l.val.length,l=this.getFormulaPattern(l.val,t),s=t.isReverseFill?-1:o,l.isInPattern)for(i=h.length,a={val:l.val,type:"formula",i:s},h.push(a),n=1;n<o;)h.push(i),n++;else for(n=0,s=t.isReverseFill?-1:1;n<o;)h.push({val:l.val[n],type:"formula",i:s}),n++;break;case"time":if(i=h.length,o=l.val.length,s=t.isReverseFill?-1:o,1===o){var f=Qr(l.val[0]),g=Number(l.val[0]),m=g>0&&g<1,v=en(new Date(f.getTime()+36e5),!0,m);l.val.push(v)}for(a={regVal:this.getPredictionValue(l.val,!0),type:l.type,i:s},h.push(a),n=1;n<o;)h.push(i),n++}d++}return h}return[{regVal:null}]},r.prototype.getNextFormattedValue=function(t,r){var n=(new e.Internationalization).formatNumber(Math.abs(r),{minimumIntegerDigits:t.length,useGrouping:!1}),i=yr({value:n},this.parent.locale);return i.isNumber?i.value:n},r.prototype.isCellReference=function(e){return/^[a-z]{1,3}\d{1,7}$/gi.test(e)?"relative":/^\$[a-z]{1,3}\$\d{1,7}$/gi.test(e)?"absolute":!!/^((\$[a-z]{1,3})\d{1,7}|[a-z]{1,3}(\$\d{1,7}))$/gi.test(e)&&"mixed"},r.prototype.round=function(e,t){return Number(Math.round(parseFloat(e+"e"+t))+"e-"+t)||Number(e)},r.prototype.getRangeData=function(t,r){for(var n,i,a=[],s=(0,e.isUndefined)(t.sheetIdx)?this.parent.getActiveSheet():In(this.parent,t.sheetIdx),o=t.range[0],l=t.range[1],d=t.range[2],h=t.range[3],p=l;o<=d;)if(cl(s,o))o++;else{for(l=p;l<=h;)if(Il(s,l))l++;else{if(n=Ln(o,l,s),r&&(n=Object.assign({},Ln(o,l,s)),i=Object.assign({},bl(s,l)),n&&!n.validation&&i&&i.validation)){n.validation=Object.assign({},bl(s,l).validation);var c=[o,l,o,l],u=[0,l,0,l],f=Pr(c,u,s,this.parent,{formula:i.validation.value1});n.validation.value1=f,""!==n.validation.value2&&(f=Pr(c,u,s,this.parent,{formula:i.validation.value2}),n.validation.value2=f)}a.push(n),l++}o++}return a},r.prototype.getFormulaPattern=function(e,t){for(var r,n,i,a,s=[],o=0,l=e.length,d={};o<l;)d.formula=e[o],this.parent.notify(dr,d),s.push(d.formulaArr),o++;var h=this.isInPattern(s,t.isVFill);if(h){for(o=(i=s[0]).length;o--;)n=i[o],(a=this.isCellReference(n))&&"absolute"!==a&&(i[o]=this.getCellRefPrediction(n,t,null,a));return{isInPattern:h,val:i}}for(o=0;o<l;){for(r=(i=s[o]).length;r--;)n=i[r],(a=this.isCellReference(n.trim()))&&"absolute"!==a&&(s[o][r]=this.getCellRefPrediction(n,t,l,a));o++}return{isInPattern:h,val:s}},r.prototype.generateColCount=function(e){for(var t=0,r=0;r<e.length;r++){t=26*t+(e.charCodeAt(r)-64)}return t},r.prototype.getCellRefPrediction=function(e,t,r,n){e=e.toUpperCase();var i=new RegExp("[a-z$]","gi"),a=new RegExp("[0-9$]","g"),s=t.isVFill?e.replace(a,""):e.replace(i,""),o=t.isVFill?Number(e.replace(i,"")):this.generateColCount(e.replace(a,"").trim()),l=null,d=[o],h="$"===e[0];if(!h&&e.includes("$")&&"$"===e.trim()[0])for(var p=1;p<e.length;p++)if("$"===e[p]){l=p,h=!0;break}return r&&1!==r?d.push(o+r):d.push(o+1),o=this.getPredictionValue(d),n&&"mixed"===n&&(h===t.isVFill?s=l?s.substring(0,l)+"$"+s.substring(l):"$"+s:o.b=0),o.c=s,o},r.prototype.isInPattern=function(e,t){var r,n,i,a,s,o,l,d=0,h=1,p=e.length,c=new RegExp("[0-9$]","g"),u=new RegExp("[a-z$]","gi");if(1===p)return!1;for(;h<p;){if(r=e[d],i=e[h],(n=r.length)!==i.length)return!1;for(;n--;)if(a=r[n],s=i[n],this.isCellReference(a)===this.isCellReference(s)){if(t?(o=Number(a.replace(u,"")),l=Number(s.replace(u,""))):(o=this.generateColCount(a.replace(c,"")),l=this.generateColCount(s.replace(c,""))),o!==l-1)return!1}else if(a!==s)return!1;d++,h++}return!0},r.prototype.ensurePattern=function(e){for(var t,r=-1,n=e.length;n--;)"object"==typeof(t=e[n])?(r=n,"string"===t.type&&(t.val=t.val.reverse())):e[n]=r;return e},r.prototype.getSelectedRange=function(e,t,r){var n,i,a,s=[],o=c([t.rowIndex,t.colIndex,r.rowIndex,r.colIndex]);n=o[0];for(var l=o[2];n<=l;)if(ul(e,n))n++;else{for(i=o[1],a=o[3];i<=a;)s.push({rowIndex:n,colIndex:i}),i++;n++}return s},r.prototype.getFillType=function(e){return e.fillType=this.fillInfo.fillType,e.disableItems=this.fillInfo.disableItems,e},r.prototype.addEventListener=function(){this.parent.on(Xt,this.autoFill,this),this.parent.on($t,this.getFillType,this)},r.prototype.destroy=function(){this.removeEventListener(),this.parent=null},r.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(Xt,this.autoFill),this.parent.off($t,this.getFillType))},r.prototype.getModuleName=function(){return"workbookautofill"},r}(),rl=function(){function t(){this.services={}}return t.prototype.getService=function(t){if((0,e.isNullOrUndefined)(this.services[""+t]))throw"The service "+t+" is not registered";return this.services[""+t]},t.prototype.register=function(t,r){(0,e.isNullOrUndefined)(this.services[""+t])&&(this.services[""+t]=r)},t}(),nl=function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},e(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),il=function(){return il=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},il.apply(this,arguments)},al=function(e,t,r,n){var i,a=arguments.length,s=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,n);else for(var o=e.length-1;o>=0;o--)(i=e[o])&&(s=(a<3?i(s):a>3?i(t,r,s):i(t,r))||s);return a>3&&s&&Object.defineProperty(t,r,s),s},sl=function(n){function a(e){var t=n.call(this,e)||this;return t.isEdit=!1,t.sheetNameCount=1,t.dataValidationRange="",t.isOpen=!1,t.chartColl=[],t.isPrintingProcessing=!1,t.currentPrintSheetIndex=0,t.customFormulaCollection=new Map,s.Inject(Wn,uo,lo,Po,qo,Wo,Lo,Vo,Go,zo,Yo,Zo,Ko,Jo,Qo,el,_o,jo,tl),t.commonCellStyle={},e&&e.cellStyle&&(t.commonCellStyle=e.cellStyle),"workbook"===t.getModuleName()&&(t.serviceLocator=new rl,t.initWorkbookServices(),t.dataBind(),t.initEmptySheet()),t}var s;return nl(a,n),s=a,a.prototype.preRender=function(){Object.keys(this.commonCellStyle).length||(this.commonCellStyle=Mn(this.cellStyle,!0)),"spreadsheet"!==this.getModuleName()||this.refreshing||this.initEmptySheet()},a.prototype.initWorkbookServices=function(){this.serviceLocator.register(sn,new e.L10n(this.getModuleName(),on,this.locale))},a.prototype.render=function(){},a.prototype.requiredModules=function(){return C(this)},a.prototype.getPersistData=function(){return this.addOnPersist([])},a.prototype.cellFormat=function(e,t){var r=this.getActiveSheet();t=t||r.selectedRange,this.notify(ae,{style:e,range:t,refreshRibbon:t.indexOf(r.activeCell)>-1})},a.prototype.lockCells=function(e,t){var r=this.getActiveSheet();e=e||r.selectedRange,this.notify(bt,{range:e,isLocked:t,triggerEvent:!0})},a.prototype.getCellStyleValue=function(e,t){var r=this,n=Ln(t[0],t[1],this.getActiveSheet()),i={};return e.forEach((function(e){i[""+e]=r.cellStyle[""+e],n&&n.style&&n.style[""+e]&&(i[""+e]=n.style[""+e])})),i},a.prototype.numberFormat=function(e,t){this.notify(te,{format:e,range:t}),this.notify(gr,{action:"addToCustomFormats",format:e})},a.prototype.createSheet=function(e,t){var r;void 0===e&&(e=this.sheets.length),void 0===t&&(t=[{}]),(r=this.sheets).splice.apply(r,[e,0].concat(t)),Rn(this,t),this.notify(be,{sheetIndex:e||0,sheets:t}),this.notify(pe,{action:"registerSheet",sheetIndex:e||0,sheetCount:e+t.length})},a.prototype.removeSheet=function(e){this.sheets.splice(e,1)},a.prototype.destroy=function(){this.notify(_,null),n.prototype.destroy.call(this)},a.prototype.onPropertyChanged=function(t,r){for(var n=0,i=Object.keys(t);n<i.length;n++){switch(i[n]){case"cellStyle":(0,e.merge)(this.commonCellStyle,t.cellStyle);break;case"sheets":t.sheets===this.sheets?(this.notify(pe,{action:"unRegisterSheet",propertyChange:!0}),this.sheetNameCount=1,this.notify(xe,{}),Rn(this),this.notify(be,null),this.notify(pe,{action:"registerSheet"})):Rn(this);break;case"listSeparator":this.notify(pe,{action:"setArgumentSeparator"})}}},a.prototype.appendTo=function(e){n.prototype.appendTo.call(this,e)},a.prototype.hideRow=function(e,t,r){void 0===t&&(t=e),void 0===r&&(r=!0);for(var n=this.getActiveSheet(),i=e;i<=t;i++)pl(n,i,{hidden:r})},a.prototype.hideColumn=function(e,t,r){void 0===t&&(t=e),void 0===r&&(r=!0);for(var n=this.getActiveSheet(),i=e;i<=t;i++)xl(n,i,{hidden:r})},a.prototype.setBorder=function(e,t,r,n){this.notify(ae,{style:e,borderType:r,range:t||this.getActiveSheet().selectedRange,isUndoRedo:n})},a.prototype.insertRow=function(e,t,r){this.notify($e,{model:this.getSheetModel(r),start:e,end:t,modelType:"Row",insertType:"below"})},a.prototype.insertColumn=function(e,t,r){this.notify($e,{model:this.getSheetModel(r),start:e,end:t,modelType:"Column",insertType:"after"})},a.prototype.insertSheet=function(e,t){this.notify($e,{model:this,start:e,end:t,modelType:"Sheet"})},a.prototype.delete=function(t,r,n,i){var a;if(t=t||0,r=(0,e.isNullOrUndefined)(r)?t:r,n&&"Sheet"!==n){if(!(a=this.getSheetModel(i)))return}else if(a=this,Math.abs(r-t)>=this.sheets.length)return;this.notify(Ze,{model:a,start:t,end:r,modelType:n||"Sheet"})},a.prototype.moveSheet=function(e,t){kn(this,e,t)},a.prototype.duplicateSheet=function(e){An(this,e)},a.prototype.getSheetModel=function(t){if((0,e.isNullOrUndefined)(t))return this.getActiveSheet();var r="string"==typeof t?vn(this,t):t;return(0,e.isNullOrUndefined)(r)||r>=this.sheets.length?null:this.sheets[r]},a.prototype.merge=function(e,t){var r,n;e?n=In(this,r=this.isPrintingProcessing?this.currentPrintSheetIndex:p(this,e)):(e=(n=this.getActiveSheet()).selectedRange,r=this.activeSheetIndex),this.notify(St,{merge:!0,range:e,type:t||"All",sheetIndex:r,refreshRibbon:e.indexOf(n.activeCell)>-1,preventRefresh:this.activeSheetIndex!==r})},a.prototype.unMerge=function(e){var t,r;e?r=In(this,t=p(this,e)):(e=(r=this.getActiveSheet()).selectedRange,t=this.activeSheetIndex),this.notify(St,{merge:!1,range:e,sheetIndex:t,type:"All",refreshRibbon:e.indexOf(r.activeCell)>-1,preventRefresh:this.activeSheetIndex!==t})},a.prototype.computeExpression=function(e){var t={action:"computeExpression",formula:e,isFromComputeExpression:!0};return this.notify(pe,t),t.calcValue},a.prototype.initEmptySheet=function(){this.sheets.length?Rn(this):this.createSheet()},a.prototype.getActiveSheet=function(){return this.sheets[this.activeSheetIndex]},a.prototype.skipHiddenSheets=function(e,t,r){return void 0===r&&(r=0),this.sheets[e]&&"Visible"!==this.sheets[e].state&&(void 0===t&&(t=e),e=e&&e+1===this.sheets.length?t-1:e<t?--e:++e,e=this.skipHiddenSheets(e,t,++r)),r===this.sheets.length?(this.setSheetPropertyOnMute(this.sheets[0],"state","Visible"),0):e},a.prototype.setUsedRange=function(e,t,r,n,i){void 0===r&&(r=this.getActiveSheet()),i?this.setSheetPropertyOnMute(r,"usedRange",{rowIndex:e,colIndex:t}):(e>r.usedRange.rowIndex&&(this.setSheetPropertyOnMute(r,"usedRange",{rowIndex:e,colIndex:r.usedRange.colIndex}),r!==this.getActiveSheet()||n||this.notify(he,{index:e,update:"row"})),t>r.usedRange.colIndex&&(this.setSheetPropertyOnMute(r,"usedRange",{rowIndex:r.usedRange.rowIndex,colIndex:t}),r!==this.getActiveSheet()||n||this.notify(he,{index:t,update:"col"})))},a.prototype.getData=function(e){return ln(this,e)},a.prototype.getModuleName=function(){return"workbook"},a.prototype.goTo=function(e){},a.prototype.getValueRowCol=function(t,r,n,a,s,o,l){var d=yn(this,t),h=In(this,d),p=Ln(r-1,n-1,h);if(a&&a.includes("!")&&!p&&h.ranges&&h.ranges.length){var c;if(this.formulaRefCell&&this.formulaRefCell===a)return p&&p.value;if(h.ranges.forEach((function(e){e.info&&e.info.loadedRange&&e.info.loadedRange.length||(c=!0)})),c){if(this.formulaRefCell=a,d=yn(this,Number(a.substring(a.lastIndexOf(",")+1,a.length))),(0,e.isNullOrUndefined)(d))return p&&p.value;a=a.substring(a.lastIndexOf("!")+1,a.lastIndexOf(",")),ln(this,h.name+"!A1:"+i(r-1,n-1),null,null,null,null,a,d)}}else p&&p.formula&&(s||(0,e.isNullOrUndefined)(p.value))&&!o&&"Automatic"===this.calculationMode&&this.notify(ne,{cell:p,rowIdx:r-1,colIdx:n-1,sheetIndex:d,formulaRefresh:!0});if(p&&!rn(p.value)&&!this.isEdit){var u={formattedText:p.value,value:p.value,format:p.format,cell:p,skipFormatCheck:!1};this.notify(re,u),p=u.cell}return l&&p&&p.formula&&p.formula.includes("SUBTOTAL(")?p.formula:p&&p.value},a.prototype.setValueRowCol=function(e,t,r,n,i,a){this.notify(ce,{action:"updateCellValue",address:[r-1,n-1],value:t,sheetIndex:yn(this,e),isValueOnly:!0,formula:i,isRandomFormula:a})},a.prototype.open=function(e){this.notify(Y,e)},a.prototype.openFromJson=function(e,t){this.isOpen=!0;var r="object"==typeof e.file?JSON.stringify(e.file):e.file;if(""!==r&&t){var n=[];if(t.onlyValues)n.push.apply(n,["style","formula","format","conditionalFormats","validation","hyperlink","wrap","chart","image","notes"]);else{var i={style:t.ignoreStyle,formula:t.ignoreFormula,format:t.ignoreFormat,conditionalFormats:t.ignoreConditionalFormat,validation:t.ignoreValidation,wrap:t.ignoreWrap,chart:t.ignoreChart,image:t.ignoreImage,notes:t.ignoreNote};for(var a in t.ignoreFreezePane&&n.push.apply(n,["frozenColumns","frozenRows"]),i)i[a]&&n.push(a)}r=JSON.stringify(JSON.parse(r),(function(e,t){if(!(n.indexOf(e)>-1))return t}))}this.notify(Y,{jsonObject:r,triggerEvent:e.triggerEvent})},a.prototype.save=function(e,t){if(void 0===e&&(e={}),this.allowSave){var r={url:this.saveUrl,fileName:e.fileName||"Sample",saveType:"Xlsx"},n=il({},r,e,{customParams:{},isFullPost:!0,needBlobData:!1,cancel:!1,autoDetectFormat:!1,pdfLayoutSettings:{fitSheetOnOnePage:!1,orientation:"Portrait"}});this.trigger("beforeSave",n),this.notify(K,{eventArgs:n,action:"beforeSave"}),n.cancel||this.notify(X,{saveSettings:n,isFullPost:n.isFullPost,needBlobData:n.needBlobData,customParams:n.customParams,pdfLayoutSettings:n.pdfLayoutSettings,jsonConfig:t})}},a.prototype.saveAsJson=function(e){var t=this;return new Promise((function(r){t.on(Ye,(function(e){e.cancel=!0,t.off(Ye),r({jsonObject:{Workbook:e.jsonObject}}),t.notify(ee,e)})),t.save({},e)}))},a.prototype.addHyperlink=function(e,t){var r={hyperlink:e,cell:t};this.notify(Ve,r)},a.prototype.findHandler=function(e){this.notify(rt,e)},a.prototype.replaceHandler=function(e){"replace"===e.replaceBy?this.notify(at,e):this.notify(st,e)},a.prototype.protectSheet=function(t,r,n){(0,e.isNullOrUndefined)(t)?t=this.activeSheetIndex:"string"==typeof t&&(t=vn(this,t));var i=this.sheets[t];i&&(this.setSheetPropertyOnMute(i,"isProtected",!0),this.setSheetPropertyOnMute(i,"password",n||""),this.setSheetPropertyOnMute(i,"protectSettings",r||{}),this.notify(gt,{protectSettings:i.protectSettings,password:i.password,sheetIndex:t}))},a.prototype.unprotectSheet=function(t){if((0,e.isNullOrUndefined)(t)?t=this.activeSheetIndex:"string"==typeof t&&(t=vn(this,t)),this.sheets[t]){var r={sheet:t};this.notify(vt,r)}},a.prototype.sort=function(e,t,r){if(!this.allowSorting)return Promise.reject();var n={args:{range:t||this.getActiveSheet().selectedRange,sortOptions:e||{sortDescriptors:{}},cancel:!1},promise:new Promise((function(e){e(void 0)})),previousSort:r};return this.notify(Ae,n),n.promise},a.prototype.addDataValidation=function(t,r){(0,e.isNullOrUndefined)(t.value1)||("List"===t.type?t.value1.length>256&&(t.value1=t.value1.substring(0,255)):(t.value1=qr([t.value1],this)[0],t.value2&&(t.value2=qr([t.value2],this)[0])),this.notify(Qe,{rules:t,range:r||this.getActiveSheet().selectedRange}))},a.prototype.removeDataValidation=function(e){this.notify(Qe,{range:e,isRemoveValidation:!0})},a.prototype.addInvalidHighlight=function(e){this.notify(et,{range:e})},a.prototype.removeInvalidHighlight=function(e){this.notify(dt,{range:e})},a.prototype.isValidCell=function(e){var t=this.getActiveSheet(),n=r(e||t.activeCell),i=Ln(n[0],n[1],t);if(i&&i.validation||t.columns&&t.columns[n[1]]&&t.columns[n[1]].validation){var a={value:i.value?i.value:"",range:n,sheetIdx:this.activeSheetIndex,td:null,isValid:!0};return this.notify(Je,a),a.isValid}return!0},a.prototype.conditionalFormat=function(e){if(e.range?","!==this.listSeparator&&e.range.includes(this.listSeparator)&&(e.range=e.range.split(this.listSeparator).join(",")):e.range=this.getActiveSheet().selectedRange,e.value){var t=void 0;qr(t="Between"===e.type?","!==this.listSeparator&&e.value.includes(this.listSeparator)?e.value.split(this.listSeparator):e.value.split(","):[e.value],this),e.value=t.join(",")}this.notify(Ot,{cfModel:e})},a.prototype.clearConditionalFormat=function(e){var t={};if(e&&e.includes("!")){var r=e.lastIndexOf("!");t.range=e.substring(r+1),t.sheetIdx=vn(this,e.substring(0,r))}else t.range=e||this.getActiveSheet().selectedRange,t.sheetIdx=this.activeSheetIndex;this.notify(At,t)},a.prototype.updateCell=function(t,r,n){(0,e.isNullOrUndefined)(n)&&(n=!0),this.updateCellDetails(t,r,void 0,void 0,n)},a.prototype.updateCellDetails=function(n,i,a,s,l){var d,h;if(i||(i=this.getActiveSheet().activeCell),i.includes("!")){if(d=o(i),void 0===(h=vn(this,i.substring(0,i.lastIndexOf("!")))))return}else d=t(i),h=this.activeSheetIndex;var p=In(this,h);Hr(this,p,{cell:n,rowIdx:d[0],colIdx:d[1],preventEvt:!0});var c=(0,e.isNullOrUndefined)(n.value)?n.formula||null:n.value,u=null!==c,f=Ln(d[0],d[1],p,!1,!0);if(u?(delete f.formattedText,this.notify(ce,{action:"updateCellValue",address:d,value:c,sheetIndex:h,cellInformation:a,isRedo:s,isDependentUpdate:l}),this.isEdit&&"#CIRCULARREF!"===f.value&&(f.value="0")):!(0,e.isNullOrUndefined)(n.format)&&f.formattedText&&delete f.formattedText,h===this.activeSheetIndex){var g={sheet:p,cell:f,rowIdx:d[0],colIdx:d[1]};(f.rowSpan>1||f.colSpan>1)&&Gr(g);var m=!cl(p,g.rowIdx)&&!Il(p,g.colIdx)&&this.getCell(g.rowIdx,g.colIdx);m&&this.serviceLocator.getService("cell").refresh(g.rowIdx,g.colIdx,!0,m,u,u);var v=r(p.activeCell);d[0]===v[0]&&d[1]===v[1]&&(this.notify(Mt,null),this.notify(ri,{action:"refreshFormulabar",cell:f}),m&&n.validation&&(g.validation=f.validation,g.td=m,g.isRefresh=!0,this.notify(vr,g)))}},a.prototype.getRowData=function(t,r){(0,e.isNullOrUndefined)(t)&&(t=0),(0,e.isNullOrUndefined)(r)&&(r=this.activeSheetIndex);var n={sheetIdx:r,startIndex:t,modelType:"Row",isDataRequest:!0};return this.notify(W,n),n.data},a.prototype.updateRange=function(e,t){void 0===t&&(t=this.activeSheetIndex);var r=In(this,t);r&&(e.startCell||(e.startCell="A1"),void 0===e.showFieldAsHeader&&(e.showFieldAsHeader=!0),e.template&&!e.address&&(e.address=e.startCell),r.ranges.push(e),this.setSheetPropertyOnMute(r,"ranges",r.ranges),e.dataSource&&this.notify(q,{sheetIdx:t,rangeIdx:r.ranges.length-1,changedData:e.dataSource}))},a.prototype.wrap=function(e,t){void 0===t&&(t=!0),Bn(e,t,this,null,!0)},a.prototype.addDefinedName=function(e){var t={action:"addDefinedName",isAdded:!1,definedName:e};return this.notify(pe,t),t.isAdded},a.prototype.removeDefinedName=function(e,t){void 0===t&&(t="");var r={action:"removeDefinedName",isRemoved:!1,definedName:e,scope:t};return this.notify(pe,r),r.isRemoved},a.prototype.insertImage=function(e,t){this.notify(Dt,{options:e,range:t||this.getActiveSheet().selectedRange})},a.prototype.autoFill=function(e,t,r,n){var i={dataRange:t||this.getActiveSheet().selectedRange,fillRange:e,direction:r||"Down",fillType:n||"FillSeries"};this.notify(Xt,i)},a.prototype.insertChart=function(e){this.notify(Lt,{chart:e})},a.prototype.deleteChart=function(e){this.notify(Ss,{id:e})},a.prototype.filter=function(e,t){if(!this.allowFiltering)return Promise.reject();var r={args:{range:t||this.getActiveSheet().selectedRange,filterOptions:e,cancel:!1},promise:new Promise((function(e){e(void 0)}))};return this.notify(_e,r),r.promise},a.prototype.addCustomFunction=function(e,t,r){t=t||("string"==typeof e?e:e.name.replace("bound ",""));var n={action:"addCustomFunction",functionHandler:e,functionName:t,formulaDescription:r};this.notify(pe,n)},a.prototype.clear=function(e){this.notify(Ft,e)},a.prototype.getDisplayText=function(t){if(!t)return"";if(t.format&&!(0,e.isNullOrUndefined)(t.value)){var r={formattedText:t.value,value:t.value,format:t.format,cell:t,skipFormatCheck:!0};return this.notify(re,r),r.formattedText}return!t.value&&t.hyperlink?"string"==typeof t.hyperlink?t.hyperlink:t.hyperlink.address:t.value||"number"==typeof t.value?t.value.toString():""},a.prototype.freezePanes=function(e,t,r){void 0===e&&(e=1),void 0===t&&(t=1);var n=this.getSheetModel(r);!this.allowFreezePane||n.frozenRows===e&&n.frozenColumns===t||(this.setSheetPropertyOnMute(n,"frozenRows",e),this.setSheetPropertyOnMute(n,"frozenColumns",t),this.updateTopLeftCell(),n.id===this.getActiveSheet().id&&"spreadsheet"===this.getModuleName()&&this.renderModule.refreshSheet())},a.prototype.Unfreeze=function(e){this.freezePanes(0,0,e)},a.prototype.unfreezePanes=function(e){this.freezePanes(0,0,e)},a.prototype.calculateNow=function(t,r){"Workbook"===t&&"Manual"===this.calculationMode&&(t="CalculateWorkbook",this.setProperties({calculationMode:"Automatic"},!0));var n={action:"calculateNow",scope:t,sheets:"Workbook"===t||"CalculateWorkbook"===t?this.sheets:[In(this,r="string"==typeof r?vn(this,r):(0,e.isNullOrUndefined)(r)?this.activeSheetIndex:r)],promise:new Promise((function(e){e(void 0)}))};return this.notify(pe,n),n.promise},a.prototype.updateTopLeftCell=function(t,n,a,s){s||(s=this.getActiveSheet());var o=r(s.topLeftCell);s.frozenRows||s.frozenColumns?(((0,e.isNullOrUndefined)(t)||t<0)&&(t=s.frozenRows?0:o[0]),((0,e.isNullOrUndefined)(n)||n<0)&&(n=s.frozenColumns?0:o[1]),t+=this.frozenRowCount(s),n+=this.frozenColCount(s),a&&("row"===a?t=r(s.paneTopLeftCell)[0]:n=r(s.paneTopLeftCell)[1]),this.setSheetPropertyOnMute(s,"paneTopLeftCell",i(t,n)),s.frozenRows&&(t=o[0]),s.frozenColumns&&(n=o[1])):((0,e.isNullOrUndefined)(t)&&(t=o[0]),(0,e.isNullOrUndefined)(n)&&(n=o[1]),this.setSheetPropertyOnMute(s,"paneTopLeftCell",i(t,n))),this.setSheetPropertyOnMute(s,"topLeftCell",i(t,n))},a.prototype.getAddressInfo=function(e){return h(this,e)},a.prototype.setSheetPropertyOnMute=function(e,t,r){this.isProtectedOnChange=!0,e[""+t]=r,this.isProtectedOnChange=!1},a.prototype.frozenRowCount=function(e){return e.frozenRows?"A1"===e.topLeftCell?e.frozenRows:r(e.topLeftCell)[0]+e.frozenRows:0},a.prototype.frozenColCount=function(e){return e.frozenColumns?"A1"===e.topLeftCell?e.frozenColumns:r(e.topLeftCell)[1]+e.frozenColumns:0},a.prototype.updateRangeOnInsertDelete=function(e,t,r,n,i,a,s){var o,l=!1;if(e.isInsert)if(o=e.endIndex-e.startIndex+1,"Row"===e.modelType)if(e.forceUpdate)t[0]+=1,t[2]+=1,l=!0;else{var d=!a&&s&&t[2]===e.startIndex-1&&n===e.startIndex&&t[1]===t[3];e.startIndex<=t[0]&&(t[0]+=o,l=!0),(e.startIndex<=t[2]||r&&e.startIndex===t[2]+1&&d)&&(t[2]+=o,l=!0)}else if(e.forceUpdate)t[1]+=1,t[3]+=1,l=!0;else{d=!a&&s&&t[3]===e.startIndex-1&&i===e.startIndex&&t[0]===t[2];e.startIndex<=t[1]&&(t[1]+=o,l=!0),(e.startIndex<=t[3]||r&&e.startIndex===t[3]+1&&d)&&(t[3]+=o,l=!0)}else"Row"===e.modelType?((o=t[0]-e.startIndex)>0&&(t[0]>e.endIndex?(o=e.endIndex-e.startIndex+1)>0&&(t[0]-=o,l=!0):(t[0]-=o,l=!0)),e.startIndex<=t[2]&&(e.endIndex<=t[2]?t[2]-=e.endIndex-e.startIndex+1:t[2]-=t[2]-e.startIndex+1,l=!0)):((o=t[1]-e.startIndex)>0&&(t[1]>e.endIndex?(o=e.endIndex-e.startIndex+1)>0&&(t[1]-=o,l=!0):(t[1]-=o,l=!0)),e.startIndex<=t[3]&&(e.endIndex<=t[3]?t[3]-=e.endIndex-e.startIndex+1:t[3]-=t[3]-e.startIndex+1,l=!0));return l},a.prototype.getCell=function(e,t,r){return null},a.prototype.dateToInt=function(e,t){return en(e,t)},a.prototype.setDateFormat=function(e,t,r){var n=In(this,yn(this,e)),i=Ln(t,r,n,null,!0).format;i&&"General"!==i||Pn(t,r,n,{format:Mo("ShortDate")},!0)},al([(0,e.Collection)([],mn)],a.prototype,"sheets",void 0),al([(0,e.Property)(0)],a.prototype,"activeSheetIndex",void 0),al([(0,e.Property)("100%")],a.prototype,"height",void 0),al([(0,e.Property)(!0)],a.prototype,"allowFindAndReplace",void 0),al([(0,e.Property)()],a.prototype,"filterCollection",void 0),al([(0,e.Property)()],a.prototype,"sortCollection",void 0),al([(0,e.Property)("100%")],a.prototype,"width",void 0),al([(0,e.Property)(!0)],a.prototype,"showRibbon",void 0),al([(0,e.Property)(!0)],a.prototype,"showFormulaBar",void 0),al([(0,e.Property)(!0)],a.prototype,"showSheetTabs",void 0),al([(0,e.Property)(!0)],a.prototype,"allowEditing",void 0),al([(0,e.Property)(!0)],a.prototype,"allowOpen",void 0),al([(0,e.Property)(!0)],a.prototype,"allowSave",void 0),al([(0,e.Property)(!0)],a.prototype,"allowSorting",void 0),al([(0,e.Property)(!0)],a.prototype,"allowFiltering",void 0),al([(0,e.Property)(!0)],a.prototype,"allowNumberFormatting",void 0),al([(0,e.Property)(!0)],a.prototype,"allowCellFormatting",void 0),al([(0,e.Property)(!0)],a.prototype,"allowHyperlink",void 0),al([(0,e.Property)(!0)],a.prototype,"enableNotes",void 0),al([(0,e.Property)(!0)],a.prototype,"allowInsert",void 0),al([(0,e.Property)(!0)],a.prototype,"allowDelete",void 0),al([(0,e.Property)(!0)],a.prototype,"allowMerge",void 0),al([(0,e.Property)(!0)],a.prototype,"allowDataValidation",void 0),al([(0,e.Property)(!0)],a.prototype,"allowImage",void 0),al([(0,e.Property)(!0)],a.prototype,"allowChart",void 0),al([(0,e.Property)(!0)],a.prototype,"allowAutoFill",void 0),al([(0,e.Property)(!0)],a.prototype,"allowPrint",void 0),al([(0,e.Property)("Automatic")],a.prototype,"calculationMode",void 0),al([(0,e.Complex)({},z)],a.prototype,"autoFillSettings",void 0),al([(0,e.Property)(!0)],a.prototype,"allowConditionalFormat",void 0),al([(0,e.Complex)({},w)],a.prototype,"cellStyle",void 0),al([(0,e.Property)("")],a.prototype,"openUrl",void 0),al([(0,e.Complex)({},qn)],a.prototype,"openSettings",void 0),al([(0,e.Property)("")],a.prototype,"saveUrl",void 0),al([(0,e.Property)("")],a.prototype,"password",void 0),al([(0,e.Property)(!1)],a.prototype,"isProtected",void 0),al([(0,e.Collection)([],N)],a.prototype,"definedNames",void 0),al([(0,e.Event)()],a.prototype,"beforeOpen",void 0),al([(0,e.Event)()],a.prototype,"openFailure",void 0),al([(0,e.Event)()],a.prototype,"beforeSave",void 0),al([(0,e.Event)()],a.prototype,"saveComplete",void 0),al([(0,e.Event)()],a.prototype,"beforeCellFormat",void 0),al([(0,e.Event)()],a.prototype,"queryCellInfo",void 0),al([(0,e.Event)()],a.prototype,"beforeCellUpdate",void 0),al([(0,e.Property)(!0)],a.prototype,"allowFreezePane",void 0),al([(0,e.Property)(",")],a.prototype,"listSeparator",void 0),a=s=al([e.NotifyPropertyChanges],a)}(e.Component),ol=function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},e(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),ll=function(e,t,r,n){var i,a=arguments.length,s=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,n);else for(var o=e.length-1;o>=0;o--)(i=e[o])&&(s=(a<3?i(s):a>3?i(t,r,s):i(t,r))||s);return a>3&&s&&Object.defineProperty(t,r,s),s},dl=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return ol(r,t),ll([(0,e.Collection)([],Dn)],r.prototype,"cells",void 0),ll([(0,e.Property)(0)],r.prototype,"index",void 0),ll([(0,e.Property)(20)],r.prototype,"height",void 0),ll([(0,e.Property)(!1)],r.prototype,"customHeight",void 0),ll([(0,e.Property)(!1)],r.prototype,"hidden",void 0),ll([(0,e.Complex)({},A)],r.prototype,"format",void 0),ll([(0,e.Property)(!1)],r.prototype,"isReadOnly",void 0),r}(e.ChildProperty);function hl(e,t){return e.rows[t]}function pl(e,t,r){e.rows[t]||(e.rows[t]={}),Object.keys(r).forEach((function(n){e.rows[t][""+n]=r[""+n]}))}function cl(e,t){return e.rows[t]&&e.rows[t].hidden}function ul(e,t){return e.rows[t]&&e.rows[t].isFiltered}function fl(e,t,r,n){var i,a;if(e&&e.standardHeight&&(a=e.standardHeight),e&&e.rows&&e.rows[t]){if(!n&&e.rows[t].hidden)return 0;i=void 0===e.rows[t].height?void 0===a?20:a:e.rows[t].height}else i=void 0===a?20:a;if(r&&window.devicePixelRatio%1>0){var s=i*window.devicePixelRatio%1;return i+(s?(s>.5?1-s:-1*s)/window.devicePixelRatio:0)}return i}function gl(e,t,r){e&&e.rows&&(e.rows[t]||(e.rows[t]={}),e.rows[t].height=r)}function ml(e,t,r,n,i){void 0===r&&(r=t);var a,s=0;t>r&&(a=t,t=r,r=a);for(var o=t;o<=r;o++)s+=fl(e,o,n,i);return s}var vl=function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},e(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),yl=function(e,t,r,n){var i,a=arguments.length,s=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,n);else for(var o=e.length-1;o>=0;o--)(i=e[o])&&(s=(a<3?i(s):a>3?i(t,r,s):i(t,r))||s);return a>3&&s&&Object.defineProperty(t,r,s),s},Cl=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return vl(r,t),yl([(0,e.Property)(0)],r.prototype,"index",void 0),yl([(0,e.Property)(64)],r.prototype,"width",void 0),yl([(0,e.Property)(!1)],r.prototype,"customWidth",void 0),yl([(0,e.Property)(!1)],r.prototype,"hidden",void 0),yl([(0,e.Complex)({},A)],r.prototype,"format",void 0),yl([(0,e.Property)(!0)],r.prototype,"isLocked",void 0),yl([(0,e.Property)("")],r.prototype,"validation",void 0),yl([(0,e.Property)(!1)],r.prototype,"isReadOnly",void 0),r}(e.ChildProperty);function bl(e,t){return e.columns?e.columns[t]||(e.columns[t]={}):(e.columns=[],e.columns[t]={}),e.columns[t]}function xl(e,t,r){var n=bl(e,t);Object.keys(r).forEach((function(e){n[""+e]=r[""+e]}))}function Sl(e,t,r,n){var i;if(e&&e.columns&&e.columns[t]){if(!r&&e.columns[t].hidden)return 0;i=e.columns[t].width||e.columns[t].customWidth?e.columns[t].width:64}else i=64;if(n&&window.devicePixelRatio%1>0){var a=i*window.devicePixelRatio%1;return i+(a?(a>.5?1-a:-1*a)/window.devicePixelRatio:0)}return i}function wl(e,t,r,n){void 0===r&&(r=t);var i=0;if(t>r){var a=t;t=r,r=a}for(var s=t;s<=r;s++)i+=Sl(e,s,null,n);return i}function Il(e,t){return e.columns[t]&&e.columns[t].hidden}function El(e,t,r){return!!(e&&e.validation&&(!e.validation.address||e.validation.address&&Rr(e.validation.address,t,r)))}function Nl(e){var t=[];return function(e,t){e.showRibbon&&t.push({member:"ribbon",args:[e]});e.showFormulaBar&&t.push({member:"formulaBar",args:[e]});e.showSheetTabs&&t.push({member:"sheetTabs",args:[e]});e.allowEditing&&(t.push({member:"edit",args:[e]}),t.push({member:"formula",args:[e]}));e.allowOpen&&t.push({member:"open",args:[e]});e.allowSave&&t.push({member:"save",args:[e]});e.enableContextMenu&&t.push({member:"contextMenu",args:[e]});e.allowAutoFill&&t.push({member:"autofill",args:[e]});"None"!==e.selectionSettings.mode&&t.push({member:"selection",args:[e]});e.enableKeyboardNavigation&&t.push({member:"keyboardNavigation",args:[e]});e.allowNumberFormatting&&t.push({member:"numberFormat",args:[e]});e.enableKeyboardShortcut&&t.push({member:"keyboardShortcut",args:[e]});e.enableClipboard&&t.push({member:"clipboard",args:[e]});e.allowCellFormatting&&t.push({member:"cellformat",args:[e]});e.allowSorting&&t.push({member:"sort",args:[e]});e.allowResizing&&t.push({member:"resize",args:[e]});t.push({member:"protectSheet",args:[e]}),t.push({member:"workbookFormula",args:[e]}),t.push({member:"workbookEdit",args:[e]}),e.allowHyperlink&&t.push({member:"spreadsheetHyperlink",args:[e]});e.enableNotes&&t.push({member:"spreadsheetNote",args:[e]});e.allowUndoRedo&&t.push({member:"undoredo",args:[e]});e.allowFiltering&&t.push({member:"filter",args:[e]});e.allowWrap&&t.push({member:"wrapText",args:[e]});e.allowInsert&&t.push({member:"insert",args:[e]});e.allowDelete&&t.push({member:"delete",args:[e]});e.allowDataValidation&&t.push({member:"dataValidation",args:[e]});e.allowFindAndReplace&&t.push({member:"findAndReplace",args:[e]});e.allowMerge&&t.push({member:"merge",args:[e]});e.allowConditionalFormat&&t.push({member:"conditionalFormatting",args:[e]});e.allowImage&&t.push({member:"spreadsheetImage",args:[e]});e.allowChart&&t.push({member:"spreadsheetChart",args:[e]})}(e,t),C(e,t),t}var Rl="e-disabled",Ol="e-wraptext",kl="spreadsheetLocale",Al="dialog",Fl="actionEvents",Tl="shape",Dl={Custom:["#ffffff","#000000","#e7e6e6","#44546a","#4472c4","#ed7d31","#a5a5a5","#ffc000","#70ad47","#ff0000","#f2f2f2","#808080","#cfcdcd","#d5dce4","#d9e2f3","#fbe4d5","#ededed","#fff2cc","#e2efd9","#ffcccc","#d9d9d9","#595959","#aeaaaa","#acb9ca","#b4c6e7","#f7caac","#dbdbdb","#ffe599","#c5e0b3","#ff8080","#bfbfbf","#404040","#747070","#8496b0","#8eaadb","#f4b083","#c9c9c9","#ffd966","#a8d08d","#ff3333","#a6a6a6","#262626","#3b3838","#323e4f","#2f5496","#c45911","#7b7b7b","#bf8f00","#538135","#b30000","#7f7f7f","#0d0d0d","#161616","#212934","#1f3763","#823b0b","#525252","#7f5f00","#375623","#660000"]},Ll={Custom:["#ffffff","#000000","#ffff00","#00ff00","#00ffff","#0000ff","#ff0000","#000080","#800080","#996633","#f2f2f2","#808080","#ffffcc","#b3ffb3","#ccffff","#ccccff","#ffcccc","#ccccff","#ff80ff","#f2e6d9","#d9d9d9","#595959","#ffff80","#80ff80","#b3ffff","#8080ff","#ff8080","#8080ff","#ff00ff","#dfbf9f","#bfbfbf","#404040","#ffff33","#33ff33","#33ffff","#3333ff","#ff3333","#0000b3","#b300b3","#c68c53","#a6a6a6","#262626","#e6e600","#00b300","#009999","#000099","#b30000","#000066","#660066","#86592d","#7f7f7f","#0d0d0d","#999900","#006600","#006666","#000066","#660000","#00004d","#4d004d","#734d26"]},Pl={UP:38,DOWN:40,LEFT:37,RIGHT:39,FIRSTALPHABET:65,LASTALPHABET:90,SPACE:32,BACKSPACE:8,TAB:9,DELETE:46,ENTER:13,ESC:27},Ml={FindValue:"Find value",ReplaceValue:"Replace value",FindReplaceTooltip:"Find & Replace",InsertingEmptyValue:"Reference value is not valid.",ReplaceAllEnd:" matches replaced with ",ByRow:"By Rows",ByColumn:"By Columns",MatchCase:"Match case",MatchExactCellElements:"Match entire cell contents",EnterCellAddress:"Enter cell address",FindAndReplace:"Find and Replace",FindNextBtn:"Find Next",FindPreviousBtn:"Find Previous",ReplaceBtn:"Replace",ReplaceAllBtn:"Replace All",GotoHeader:"Go To",Sheet:"Sheet",Workbook:"Workbook",NoElements:"We couldn't find what you were looking for.",FindWhat:"Find what",ReplaceWith:"Replace with",Cut:"Cut",Copy:"Copy",Paste:"Paste",PasteSpecial:"Paste Special",Link:"Link",Spreadsheet:"Spreadsheet",AddNote:"Add Note",EditNote:"Edit Note",DeleteNote:"Delete Note",Hyperlink:"Hyperlink",EditHyperlink:"Edit Hyperlink",OpenHyperlink:"Open Hyperlink",RemoveHyperlink:"Remove Hyperlink",InvalidHyperlinkAlert:"The address of this site is not valid. Check the address and try again.",InsertLink:"Insert Link",EditLink:"Edit Link",All:"All",Values:"Values",Formats:"Formats",Bold:"Bold",Font:"Font",FontSize:"Font Size",Italic:"Italic",Underline:"Underline",Strikethrough:"Strikethrough",TextColor:"Text Color",FillColor:"Fill Color",HorizontalAlignment:"Horizontal Alignment",AlignLeft:"Align Left",AlignCenter:"Center",AlignRight:"Align Right",VerticalAlignment:"Vertical Alignment",AlignTop:"Align Top",AlignMiddle:"Align Middle",AlignBottom:"Align Bottom",WrapText:"Wrap Text",MergeCells:"Merge Cells",MergeAll:"Merge All",MergeHorizontally:"Merge Horizontally",MergeVertically:"Merge Vertically",Unmerge:"Unmerge",UnmergeCells:"Unmerge Cells",SelectMergeType:"Select Merge Type",MergeCellsAlert:"Merging cells will only preserve the top-leftmost(Uppermost) value. Merge anyway?",Borders:"Borders",TopBorders:"Top Borders",LeftBorders:"Left Borders",RightBorders:"Right Borders",BottomBorders:"Bottom Borders",AllBorders:"All Borders",HorizontalBorders:"Horizontal Borders",VerticalBorders:"Vertical Borders",OutsideBorders:"Outside Borders",InsideBorders:"Inside Borders",NoBorders:"No Borders",BorderColor:"Border Color",BorderStyle:"Border Style",InsertFunction:"Insert Function",CalcOptions:"Calculation Options",CalcOptionsTip:"Choose to calculate formulas either automatically or manually",CalcActiveSheet:"Calculate Sheet",CalcWorkbook:"Calculate Workbook",Automatic:"Automatic",Manual:"Manual",CalcSheetTip:"Calculate the active sheet",CalcWorkbookTip:"Calculate the entire workbook",Insert:"Insert",Delete:"Delete",DuplicateSheet:"Duplicate",MoveRight:"Move Right",MoveLeft:"Move Left",Rename:"Rename",Hide:"Hide",FileName:"File Name",PROPER:"Converts a text to proper case; first letter to uppercase and other letters to lowercase.",NameBox:"Name Box",ShowHeaders:"Show Headers",HideHeaders:"Hide Headers",ShowGridLines:"Show Gridlines",ExtendValidation:"The selection contains some cells without data validation. Do you want to extend validation to these cells?",Yes:"Yes",No:"No",HideGridLines:"Hide Gridlines",FreezePanes:"Freeze Panes",FreezeRows:"Freeze Rows",FreezeColumns:"Freeze Columns",UnfreezePanes:"Unfreeze Panes",UnfreezeRows:"Unfreeze Rows",UnfreezeColumns:"Unfreeze Columns",AddSheet:"Add Sheet",ListAllSheets:"List All Sheets",CollapseToolbar:"Collapse Toolbar",ExpandToolbar:"Expand Toolbar",CollapseFormulaBar:"Collapse Formula Bar",ExpandFormulaBar:"Expand Formula Bar",File:"File",Home:"Home",Formulas:"Formulas",View:"View",New:"New",Open:"Open",SaveAs:"Save As",Print:"Print",Update:"Update",ExcelXlsx:"Microsoft Excel",ExcelXls:"Microsoft Excel 97-2003",CSV:"Comma-separated values",FormulaBar:"Formula Bar",Sort:"Sort",SortAscending:"Ascending",SortDescending:"Descending",CustomSort:"Custom Sort",AddColumn:"Add Column",ContainsHeader:"Data contains header",CaseSensitive:"Case sensitive",SortBy:"Sort by",ThenBy:"Then by",SelectAColumn:"Select a column",SortEmptyFieldError:"All sort criteria must have a column specified. Check the selected sort criteria and try again.",SortDuplicateFieldError:" is being sorted by values more than once. Delete the duplicate sort criteria and try again.",SortOutOfRangeError:"Select a cell or range inside the used range and try again.",MultiRangeSortError:"This can't be done on a multiple range selection. Select a single range and try again.",SortAndFilter:"Sort & Filter",Filter:"Filter",ClearAllFilter:"Clear",ClearFilterFrom:"Clear Filter From ",ReapplyFilter:"Reapply",FilterCellValue:"Filter by Value of Selected Cell",FilterOutOfRangeError:"Select a cell or range inside the used range and try again.",HideRow:"Hide Row",HideRows:"Hide Rows",UnhideRows:"Unhide Rows",HideColumn:"Hide Column",HideColumns:"Hide Columns",UnhideColumns:"Unhide Columns",InsertRow:"Insert Row",InsertRows:"Insert Rows",Above:"Above",Below:"Below",InsertColumn:"Insert Column",InsertColumns:"Insert Columns",Before:"Before",After:"After",DeleteRow:"Delete Row",DeleteRows:"Delete Rows",DeleteColumn:"Delete Column",DeleteColumns:"Delete Columns",Ok:"OK",Close:"Close",MoreOptions:"More Options",Cancel:"Cancel",Apply:"Apply",MoreColors:"More Colors",StandardColors:"Standard Colors",General:"General",Number:"Number",Currency:"Currency",Accounting:"Accounting",ShortDate:"Short Date",LongDate:"Long Date",Time:"Time",Percentage:"Percentage",Fraction:"Fraction",Scientific:"Scientific",Text:"Text",Custom:"Custom",MobileFormulaBarPlaceHolder:"Enter value or Formula",NumberFormat:"Number Format",PasteAlert:"You can't paste this here, because the copy area and paste area aren't in the same size. Please try pasting in a different range.",DestroyAlert:"Are you sure you want to destroy the current workbook without saving and create a new workbook?",SheetRenameInvalidAlert:"Sheet name contains invalid character.",SheetRenameEmptyAlert:"Sheet name cannot be empty.",SheetRenameAlreadyExistsAlert:"Sheet name already exists. Please enter another name.",DeleteSheetAlert:"You can't undo deleting sheets, and you might be removing some data. If you don't need it, click OK to delete.",DeleteSingleLastSheetAlert:"A Workbook must contain at least one visible worksheet.",PickACategory:"Pick a category",Description:"Description",UnsupportedFile:"Unsupported File",DataLimitExceeded:"File data is too large and it takes more time to process, do you want to continue?",FileSizeLimitExceeded:"File size is too large and it takes more time to process, do you want to continue?",InvalidUrl:"Invalid URL",SUM:"Adds a series of numbers and/or cells.",SUMIF:"Adds the cells based on specified condition.",SUMIFS:"Adds the cells based on specified conditions.",ABS:"Returns the value of a number without its sign.",RAND:"Returns a random number between 0 and 1.",RANDBETWEEN:"Returns a random integer based on specified values.",FLOOR:"Rounds a number down to the nearest multiple of a given factor.",CEILING:"Rounds a number up to the nearest multiple of a given factor.",PRODUCT:"Multiplies a series of numbers and/or cells.",INT:"Returns a number to the nearest integer.",ROUNDUP:"Rounds a number away from zero.",SUMPRODUCT:"Returns sum of the product of given ranges of arrays.",SORT:"Sorts a range of an array",T:"Checks whether a value is text or not and returns the text.",EXACT:"Checks whether a two text strings are exactly same and returns TRUE or FALSE.",LEN:"Returns a number of characters in a given string.",MOD:"Returns a remainder after a number is divided by divisor.",ODD:"Rounds a positive number up and negative number down to the nearest odd integer.",PI:"Returns the value of pi.",COUNTBLANK:"Returns the number of empty cells in a specified range of cells.",EVEN:"Rounds a positive number up and negative number down to the nearest even integer.",DECIMAL:"Converts a text representation of a number in a given base into a decimal number.",DEGREES:"Converts radians to degrees.",ADDRESS:"Returns a cell reference as text, given specified row and column numbers.",TIME:"Converts hours, minutes, seconds to the time formatted text.",CHAR:"Returns the character from the specified number.",CODE:"Returns the numeric code for the first character in a given string.",DOLLAR:"Converts the number to currency formatted text.",SMALL:"Returns the k-th smallest value in a given array.",LARGE:"Returns the k-th largest value in a given array.",FACT:"Returns the factorial of a number.",MEDIAN:"Returns the median of the given set of numbers.",EDATE:"Returns a date with given number of months before or after the specified date.",DATEVALUE:"Converts a date string into date value.",HOUR:"Returns the number of hours in a specified time string.",SECOND:"Returns the number of seconds in a specified time string.",MINUTE:"Returns the number of minutes in a specified time string.",NOW:"Returns the current date and time.",MONTH:"Returns the number of months in a specified date string.",TODAY:"Returns the current date as date value.",WEEKDAY:"Returns the day of the week corresponding to a date.",AVERAGE:"Calculates average for the series of numbers and/or cells excluding text.",AVERAGEIF:"Calculates average for the cells based on specified criterion.",AVERAGEIFS:"Calculates average for the cells based on specified conditions.",AVERAGEA:"Calculates the average for the cells evaluating TRUE as 1, text and FALSE as 0.",COUNT:"Counts the cells that contain numeric values in a range.",COUNTIF:"Counts the cells based on specified condition.",COUNTIFS:"Counts the cells based on specified conditions.",COUNTA:"Counts the cells that contains values in a range.",MIN:"Returns the smallest number of the given arguments.",MAX:"Returns the largest number of the given arguments.",DATE:"Returns the date based on given year, month, and day.",DAY:"Returns the day from the given date.",DAYS:"Returns the number of days between two dates.",IF:"Returns value based on the given expression.",IFS:"Returns value based on the given multiple expressions.",CalculateAND:"Returns TRUE if all the arguments are TRUE, otherwise returns FALSE.",CalculateOR:"Returns TRUE if any of the arguments are TRUE, otherwise returns FALSE.",IFERROR:"Returns value if no error found else it will return specified value.",CHOOSE:"Returns a value from list of values, based on index number.",INDEX:"Returns a value of the cell in a given range based on row and column number.",FIND:"Returns the position of a string within another string, which is case sensitive.",TEXT:"Converts a value to text in specified number format.",CONCATENATE:"Combines two or more strings together.",CONCAT:"Concatenates a list or a range of text strings.",SUBTOTAL:"Returns subtotal for a range using the given function number.",RADIANS:"Converts degrees into radians.",MATCH:"Returns the relative position of a specified value in given range.",LN:"Returns the natural logarithm of a number.",INTERCEPT:"Calculates the point of the Y-intercept line via linear regression.",UNIQUE:"Returns a unique values from a range or array",SLOPE:"Returns the slope of the line from linear regression of the data points.",LOOKUP:"Looks for a value in a one-row or one-column range, then returns a value from the same position in a second one-row or one-column range.",HLOOKUP:"Looks for a value in the top row of the array of values and then returns a value in the same column from a row in the array that you specify.",VLOOKUP:"Looks for a specific value in the first column of a lookup range and returns a corresponding value from a different column within the same row.",NOT:"Returns the inverse of a given logical expression.",EOMONTH:"Returns the last day of the month that is a specified number of months before or after an initially supplied start date.",SQRT:"Returns the square root of a positive number.",ROUNDDOWN:"Rounds a number down, toward zero.",RSQ:"Returns the square of the Pearson product moment correlation coefficient based on data points in known_y's and known_x's.",DefineNameExists:"This name already exists, try different name.",DefineNameInValid:"The name that you entered is not valid.",CircularReference:"When a formula refers to one or more circular references, this may result in an incorrect calculation.",OR:"OR",AND:"AND",CustomFilterDatePlaceHolder:"Choose a date",CustomFilterPlaceHolder:"Enter the value",CustomFilter:"Custom Filter",Between:"Between",DateTimeFilter:"DateTime Filters",Undo:"Undo",Redo:"Redo",DateFilter:"Date Filters",TextFilter:"Text Filters",NumberFilter:"Number Filters",ClearFilter:"Clear Filter",NoResult:"No Matches Found",FilterFalse:"False",FilterTrue:"True",Blanks:"Blanks",SelectAll:"Select All",GreaterThanOrEqual:"Greater Than Or Equal",GreaterThan:"Greater Than",LessThanOrEqual:"Less Than Or Equal",LessThan:"Less Than",NotEqual:"Not Equal",Equal:"Equal",Contains:"Contains",NotContains:"Does Not Contains",EndsWith:"Ends With",NotEndsWith:"Does Not End With",StartsWith:"Starts With",NotStartsWith:"Does Not Start With",IsEmpty:"Empty",IsNotEmpty:"Not Empty",ClearButton:"Clear",FilterButton:"Filter",CancelButton:"Cancel",OKButton:"OK",Search:"Search",ProtectSheet:"Protect Sheet",UnprotectSheet:"Unprotect Sheet",SelectCells:"Select locked cells",SelectUnlockedCells:"Select unlocked cells",FormatCells:"Format cells",FormatRows:"Format rows",FormatColumns:"Format columns",InsertLinks:"Insert links",ProtectContent:"Protect the contents of locked cells",ProtectAllowUser:" Allow all users of this worksheet to:",EditAlert:"The cell you're trying to change is protected. To make change, unprotect the sheet.",ReadonlyAlert:"You are trying to modify a cell that is in read-only mode. To make changes, please disable the read-only status.",SearchWithin:"Search within",SearchBy:"Search by",Reference:"Reference",DataValidation:"Data Validation",CellRange:"Cell Range",Allow:"Allow",Data:"Data",Minimum:"Minimum",Maximum:"Maximum",IgnoreBlank:"Ignore blank",WholeNumber:"Whole Number",Decimal:"Decimal",Date:"Date",TextLength:"Text Length",List:"List",NotBetween:"Not Between",EqualTo:"Equal To",NotEqualTo:"Not Equal To",GreaterThanOrEqualTo:"Greater Than Or Equal To",LessThanOrEqualTo:"Less Than Or Equal To",InCellDropDown:"In-cell-dropdown",Sources:"Sources",Value:"Value",Formula:"Formula",Retry:"Retry",DialogError:"The list source must be a reference to single row or column.",MinMaxError:"The Maximum must be greater than or equal to the Minimum.",InvalidNumberError:"Please enter a valid number.",InvalidFormula:"Please enter a valid formula.",MoreValidation:"This selection contains more than one validation. \n Erase current settings and continue?",FileNameError:"A file name can't contain characters like \\ / : * ? \" < > [ ] |",ListLengthError:"The list values allows only upto 256 characters",ValidationError:"This value doesn't match the data validation restrictions defined for the cell.",EmptyError:"You must enter a value",ClearHighlight:"Clear Highlight",HighlightInvalidData:"Highlight Invalid Data",ClearValidation:"Clear Validation",HighlightCellsRules:"Highlight Cells Rules",CFEqualTo:"Equal To",TextThatContains:"Text that Contains",Save:"Save",EmptyFileName:"File name cannot be empty.",LargeName:"The name is too long.",ADateOccuring:"A Date Occuring",DuplicateValues:"Duplicate Values",TopBottomRules:"Top/Bottom Rules",Directional:"Directional",Shapes:"Shapes",Indicators:"Indicators",Ratings:"Ratings",Top10Items:"Top 10 Items",Top10:"Top 10",Bottom10Items:"Bottom 10 Items",Bottom10:"Bottom 10",AboveAverage:"Above Average",BelowAverage:"Below Average",FormatCellsGreaterThan:"Format cells that are GREATER THAN:",FormatCellsLessThan:"Format cells that are LESS THAN:",FormatCellsBetween:"Format cells that are BETWEEN:",FormatCellsEqualTo:"Format cells that are EQUAL TO:",FormatCellsThatContainTheText:"Format cells that contain the text:",FormatCellsThatContainADateOccurring:"Format cells that contain a date occurring:",FormatCellsDuplicate:"Format cells that contain:",FormatCellsTop:"Format cells that rank in the TOP:",FormatCellsBottom:"Format cells that rank in the BOTTOM:",FormatCellsAbove:"Format cells that are ABOVE AVERAGE:",FormatCellsBelow:"Format cells that are BELOW AVERAGE:",With:"with",DataBars:"Data Bars",ColorScales:"Color Scales",IconSets:"Icon Sets",ClearRules:"Clear Rules",SelectedCells:"Clear Rules from Selected Cells",EntireSheet:"Clear Rules from Entire Sheet",ISNUMBER:"Returns true when the value parses as a numeric value.",ROUND:"Rounds a number to a specified number of digits.",GEOMEAN:"Returns the geometric mean of an array or range of positive data.",POWER:"Returns the result of a number raised to power",LOG:"Returns the logarithm of a number to the base that you specify.",TRUNC:"Returns the truncated value of a number to a specified number of decimal places.",EXP:"Returns e raised to the power of the given number.",Clear:"Clear",ClearContents:"Clear Contents",ClearAll:"Clear All",ClearFormats:"Clear Formats",ClearHyperlinks:"Clear Hyperlinks",LightRedFillWithDarkRedText:"Light Red Fill with Dark Red Text",YellowFillWithDarkYellowText:"Yellow Fill with Dark Yellow Text",GreenFillWithDarkGreenText:"Green Fill with Dark Green Text",RedFill:"Red Fill",RedText:"Red Text",Duplicate:"Duplicate",Unique:"Unique",And:"and",WebPage:"Web Page",ThisDocument:"This Document",DisplayText:"Display Text",Url:"URL",CellReference:"Cell Reference",DefinedNames:"Defined Names",EnterTheTextToDisplay:"Enter the text to display",EnterTheUrl:"Enter the URL",Image:"Image",ConditionalFormatting:"Conditional Formatting",BlueDataBar:"Blue Data Bar",GreenDataBar:"Green Data Bar",RedDataBar:"Red Data Bar",OrangeDataBar:"Orange Data Bar",LightBlueDataBar:"Light blue Data Bar",PurpleDataBar:"Purple Data Bar",GYRColorScale:"Green - Yellow - Red Color Scale",RYGColorScale:"Red - Yellow - Green Color Scale",GWRColorScale:"Green - White - Red Color Scale",RWGColorScale:"Red - White - Green Color Scale",BWRColorScale:"Blue - White - Red Color Scale",RWBColorScale:"Red - White - Blue Color Scale",WRColorScale:"White - Red Color Scale",RWColorScale:"Red - White Color Scale",GWColorScale:"Green - White Color Scale",WGColorScale:"White - Green Color Scale",GYColorScale:"Green - Yellow Color Scale",YGColorScale:"Yellow - Green Color Scale",ThreeArrowsColor:"3 Arrows (Colored)",ThreeArrowsGray:"3 Arrows (Gray)",ThreeTriangles:"3 Triangles",FourArrowsColor:"4 Arrows (Gray)",FourArrowsGray:"4 Arrows (Colored)",FiveArrowsColor:"5 Arrows (Gray)",FiveArrowsGray:"5 Arrows (Colored)",ThreeTrafficLights1:"3 Traffic Lights (Unrimmed)",ThreeTrafficLights2:"3 Traffic Lights (Rimmed)",ThreeSigns:"3 Signs",FourTrafficLights:"4 Traffic Lights",RedToBlack:"Red To Black",ThreeSymbols1:"3 Symbols (Circled)",ThreeSymbols2:"3 Symbols (Uncircled)",ThreeFlags:"3 Flags",ThreeStars:"3 Stars",FourRatings:"4 Ratings",FiveQuarters:"5 Quarters",FiveRatings:"5 Ratings",FiveBoxes:"5 Boxes",Chart:"Chart",Column:"Column",Bar:"Bar",Area:"Area",Pie:"Pie",Doughnut:"Doughnut",PieAndDoughnut:"Pie/Doughnut",Line:"Line",LineMarker:"Line with Markers",Radar:"Radar",Scatter:"Scatter",ChartDesign:"Chart Design",ClusteredColumn:"Clustered Column",StackedColumn:"Stacked Column",StackedColumn100:"100% Stacked Column",ClusteredBar:"Clustered Bar",StackedBar:"Stacked Bar",StackedBar100:"100% Stacked Bar",StackedArea:"Stacked Area",StackedArea100:"100% Stacked Area",StackedLine:"Stacked Line",StackedLineMarker:"Stacked Line with Markers",StackedLine100:"100% Stacked Line",StackedLine100Marker:"100% Stacked Line with Markers",AddChartElement:"Add Chart Element",Axes:"Axes",AxisTitle:"Axis Title",ChartTitle:"Chart Title",DataLabels:"Data Labels",Gridlines:"Gridlines",Legends:"Legends",PrimaryHorizontal:"Primary Horizontal",PrimaryVertical:"Primary Vertical",None:"None",AboveChart:"Above Chart",Center:"Center",InsideEnd:"Inside End",InsideBase:"Inside Base",OutsideEnd:"OutSide End",PrimaryMajorHorizontal:"Primary Major Horizontal",PrimaryMajorVertical:"Primary Major Vertical",PrimaryMinorHorizontal:"Primary Minor Horizontal",PrimaryMinorVertical:"Primary Minor Vertical",Right:"Right",Left:"Left",Bottom:"Bottom",Top:"Top",SwitchRowColumn:"Switch Row/Column",ChartTheme:"Chart Theme",ChartType:"Chart Type",Material:"Material",Fabric:"Fabric",Bootstrap:"Bootstrap",HighContrastLight:"HighContrast Light",MaterialDark:"Material Dark",FabricDark:"Fabric Dark",HighContrast:"HighContrast",BootstrapDark:"Bootstrap Dark",Bootstrap4:"Bootstrap4",Bootstrap5Dark:"Bootstrap5 Dark",Bootstrap5:"Bootstrap5",Tailwind:"Tailwind",TailwindDark:"Tailwind Dark",Tailwind3:"Tailwind 3",Tailwind3Dark:"Tailwind 3 Dark",VerticalAxisTitle:"Vertical Axis Title",HorizontalAxisTitle:"Horizontal Axis Title",EnterTitle:"Enter Title",ProtectWorkbook:"Protect Workbook",Password:"Password (optional):",EnterThePassword:"Enter the password",ConfirmPassword:"Confirm Password",EnterTheConfirmPassword:"Re-enter your password",PasswordAlert:"Confirmation password is not identical",UnprotectWorkbook:"Unprotect Workbook",UnprotectPasswordAlert:"The password you supplied is not correct.",IncorrectPassword:"Unable to open the file or worksheet with the given password",PasswordAlertMsg:"Please enter the password",ConfirmPasswordAlertMsg:"Please enter the confirm password",IsProtected:"is protected",PDF:"PDF Document",AutoFillMergeAlertMsg:"To do this, all the merged cells need to be the same size.",FillSeries:"Fill Series",CopyCells:"Copy Cells",FillFormattingOnly:"Fill Formatting Only",FillWithoutFormatting:"Fill Without Formatting",CustomFormat:"Custom Number Formats",CustomFormatPlaceholder:"Type or Select a custom format",CustomFormatTypeList:"Type",UnprotectWorksheet:"Unprotect Sheet",ReEnterPassword:"Re-enter password to proceed",SheetPassword:"Password to unprotect sheet:",Fluent:"Fluent",FluentDark:"Fluent Dark",Fluent2:"Fluent 2",Fluent2Dark:"Fluent 2 Dark",Fluent2HighContrast:"Fluent 2 HighContrast",Material3:"Material 3",Material3Dark:"Material 3 Dark",CellReferenceTypoError:"We found a typo in your cell reference. Do you want to correct this reference as follows?",InvalidFormulaError:"We found that you typed a formula which is invalid.",InvalidArguments:"We found that you typed a formula with an invalid arguments.",EmptyExpression:"We found that you typed a formula with an empty expression.",MismatchedParenthesis:"We found that you typed a formula with one or more missing opening or closing parenthesis.",ImproperFormula:"We found that you typed a formula which is improper.",WrongNumberOfArguments:"We found that you typed a formula with a wrong number of arguments.",Requires3Arguments:"We found that you typed a formula which requires 3 arguments.",MismatchedStringQuotes:"We found that you typed a formula with a mismatched quotes.",FormulaCircularRef:"We found that you typed a formula with a circular reference.",AddCurrentSelection:"Add current selection to filter",ExternalWorkbook:"An imported excel file contains an external workbook reference. Do you want to import that file?"};function Bl(e){requestAnimationFrame((function(){e()}))}function Hl(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function Ul(e){var t=30;return e.toString().length>3&&(t=10*e.toString().length),t}var Vl=null,zl=1.24;function _l(){if(null!==Vl)return Vl;var e,t=document.createElement("div");return t.style.cssText="width:100px;height: 100px;overflow: scroll;position: absolute;top: -9999px;",document.body.appendChild(t),e=t.offsetWidth-t.clientWidth|0,document.body.removeChild(t),Vl=e}function jl(e,t,r){return void 0===r&&(r=1),ql(e,"previous",t=t||["e-ribbon","e-formula-bar-panel","e-sheet-tab-panel","e-header-toolbar"],r)+ql(e,"next",t,r)}function ql(e,t,r,n){for(var i=e[t+"ElementSibling"],a=0;i;)r.some((function(e){return i.classList.contains(e)}))&&(a+=i.getBoundingClientRect().height*n),i=i[t+"ElementSibling"];return a}function Wl(e,t,r){if(e.scrollSettings.enableVirtualization){var n=e.getActiveSheet(),i=e.frozenRowCount(n),a=e.frozenColCount(n),s=e.viewport.topIndex+i,o=e.viewport.leftIndex+a,l=e.viewport.bottomIndex,d=e.viewport.rightIndex;if(n.frozenRows||n.frozenColumns){if(e.insideViewport(t[0],t[1])||e.insideViewport(t[2],t[3]))return!0}else if(s<=t[0]&&l>=t[2]&&o<=t[1]&&d>=t[3])return!0;var h=!1;if(r){if(t[0]<s&&t[2]<s||t[0]>l&&t[2]>l)return!1;if(t[0]<s&&t[2]>s&&t[0]>=i&&(t[0]=s,h=!0),t[2]>l&&(t[2]=l,h=!0),t[1]<o&&t[3]<o||t[1]>d&&t[3]>d)return!1;t[1]<o&&t[3]>o&&t[1]>=a&&(t[1]=o,h=!0),t[3]>d&&(t[3]=d,h=!0)}return h}return!0}function Gl(e,t,r,n,i,a,s,o){var l,d={idx:0,size:0},h={idx:0,size:0},p=h.size,c=d.size;for(l=h.idx;l<t[0];l++)r&&r-1<t[0]&&l<r||(p+=fl(e,l,!o));for(l=d.idx;l<t[1];l++)n&&n-1<t[1]&&l<n||(c+=Sl(e,l,null,!o));return r&&t[0]<r&&(e.showHeaders&&(p+=30),i&&(p-=i)),n&&t[1]<n&&(e.showHeaders&&(c+=s||30),a&&(c-=a)),{top:p,left:c}}function Yl(t,r,n,i,a,s,o){void 0===i&&(i="e-selection");var l=t.getActiveSheet();if(!l.frozenRows&&!l.frozenColumns){var d=Kl(t,r,n,l,t.enableRtl,0,0,a);return r&&!t.getMainContent().querySelector("."+i)&&t.getMainContent().appendChild(r),d}var h,p=t.frozenRowCount(l),u=t.frozenColCount(l);if("e-active-cell"===i){if(n[0]<p||n[1]<u)r.style.display="none",(v=(h=n[0]<p&&n[1]<u?t.getSelectAllContent():n[0]<p?t.getColumnHeaderContent():t.getRowHeaderContent()).querySelector("."+i))||(v=r.cloneNode(!0),h.appendChild(v)),Kl(t,r=v,n,l,t.enableRtl,p,u,a,!0,t.viewport.beforeFreezeHeight,t.viewport.beforeFreezeWidth,t.sheetModule.colGroupWidth);else Kl(t,r,n,l,t.enableRtl,p,u,a);r.style.display&&(r.style.display=""),Xl(t.getSelectAllContent(),h,"e-active-cell"),Xl(t.getColumnHeaderContent(),h,"e-active-cell"),Xl(t.getRowHeaderContent(),h,"e-active-cell")}else if("e-autofill"===i){var f=void 0,g=t.frozenRowCount(l),m=t.frozenColCount(l);if(n[0]<g||n[1]<m)r.style.display="none",(v=(f=n[0]<g&&n[1]<m?t.getSelectAllContent():n[0]<g?t.getColumnHeaderContent():t.getRowHeaderContent()).querySelector("."+i))||(v=r.cloneNode(!0),f.appendChild(v)),Kl(t,r=v,n,l,t.enableRtl,g,m,a,!0,t.viewport.beforeFreezeHeight,t.viewport.beforeFreezeWidth,t.sheetModule.colGroupWidth,"e-autofill");else Kl(t,r,n,l,t.enableRtl,g,m,a,!1,0,0,0,"e-autofill");r.style.display&&(r.style.display=""),Xl(t.getSelectAllContent(),f,"e-autofill"),Xl(t.getColumnHeaderContent(),f,"e-autofill"),Xl(t.getRowHeaderContent(),f,"e-autofill")}else if("e-filloption"===i){f=void 0,g=t.frozenRowCount(l),m=t.frozenColCount(l);if(n[0]<g||n[1]<m)if(n[3]+1===m&&n[2]+1>g)Kl(t,t.getMainContent().querySelector(".e-filloption"),n,l,t.enableRtl,g,m,a,!1,0,0,0,"e-filloption",!0,{left:-4});else if(n[2]+1===g&&n[3]+1>m)Kl(t,t.getMainContent().querySelector(".e-filloption"),n,l,t.enableRtl,g,m,a,!1,0,0,0,"e-filloption",!0,{top:-4});else if(n[3]+1===m&&n[2]+1<g){(f=t.getColumnHeaderContent()).querySelector("."+i)||t.notify(Zt,{id:t.element.id+"_autofilloptionbtn",appendElem:f}),r=t.autofillModule.autoFillDropDown.element,Kl(t,r,n,l,t.enableRtl,g,m,a,!1,0,0,0,"e-filloption",!0,{left:-4})}else if(n[2]+1===g&&n[3]+1===m)Kl(t,t.getMainContent().querySelector(".e-filloption"),n,l,t.enableRtl,g,m,a,!1,0,0,0,"e-filloption",!0,{top:-4,left:-4});else{var v;(v=(f=n[0]<g&&n[1]<m?t.getSelectAllContent():n[0]<g?t.getColumnHeaderContent():t.getRowHeaderContent()).querySelector("."+i))||t.notify(Zt,{id:t.element.id+"_autofilloptionbtn",appendElem:f}),r=t.autofillModule.autoFillDropDown.element,Kl(t,r,n,l,t.enableRtl,g,m,a,!0,t.viewport.beforeFreezeHeight,t.viewport.beforeFreezeWidth,t.sheetModule.colGroupWidth,"e-filloption",!0)}else Kl(t,t.getMainContent().querySelector(".e-filloption"),n,l,t.enableRtl,g,m,a,!1,0,0,0,"e-filloption",!0);r.style.display&&(r.style.display=""),Xl(t.getSelectAllContent(),f,"e-filloption"),Xl(t.getColumnHeaderContent(),f,"e-filloption"),Xl(t.getRowHeaderContent(),f,"e-filloption")}else{var y=c(n);if(y[0]<p||y[1]<u){r&&!r.classList.contains("e-multi-range")&&r.classList.add("e-hide");var C,b=[];y[0]<p&&y[1]<u?y[2]<p&&y[3]<u?(b.push(n),s||(Xl(t.getColumnHeaderContent(),h,i,!0),Xl(t.getRowHeaderContent(),h,i,!0))):y[2]>p-1?y[3]<u?(s||Xl(t.getColumnHeaderContent(),h,i,!0),b.push([y[0],y[1],p-1,y[3]]),b.push([p,y[1],y[2],y[3]])):(b.push([y[0],y[1],p-1,u-1]),b.push([p,y[1],y[2],u-1]),b.push([y[0],u,p-1,y[3]]),b.push([p,u,y[2],y[3]])):y[2]<p?(b.push([y[0],y[1],y[2],u-1]),b.push([y[0],u,y[2],y[3]]),s||Xl(t.getRowHeaderContent(),h,i,!0)):(b.push([p,y[1],y[2],u-1]),b.push([y[0],y[1],p-1,u-1]),b.push([p,u,y[2],y[3]]),b.push([y[0],u,p-1,y[3]])):y[0]<p?y[2]<p?(b.push(n),s||Xl(t.getRowHeaderContent(),h,i,!0)):(b.push([y[0],y[1],p-1,y[3]]),b.push([p,y[1],y[2],y[3]]),s||(Xl(t.getSelectAllContent(),h,i,!0),Xl(t.getRowHeaderContent(),h,i,!0))):y[3]<u?(b.push(n),s||Xl(t.getSelectAllContent(),h,i,!0)):(b.push([y[0],y[1],y[2],u-1]),b.push([y[0],u,y[2],y[3]]),s||(Xl(t.getSelectAllContent(),h,i,!0),Xl(t.getColumnHeaderContent(),h,i,!0))),b.forEach((function(n){var d;h=n[2]<p&&n[3]<u?t.getSelectAllContent():n[2]<p?t.getColumnHeaderContent():n[3]<u?t.getRowHeaderContent():t.getMainContent(),"e-copy-indicator"===i||"e-range-indicator"===i?(d=r.cloneNode(!0),h.appendChild(d),p&&(n[2]+1===p&&b.forEach((function(t){t!==n&&(C=d.getElementsByClassName("e-bottom")[0])&&t[0]===p&&(0,e.detach)(C)})),n[0]===p&&h.parentElement.classList.contains("e-main-panel")&&b.forEach((function(t){t!==n&&(C=d.getElementsByClassName("e-top")[0])&&t[2]+1===p&&(0,e.detach)(C)}))),u&&(n[3]+1===u&&b.forEach((function(t){t!==n&&(C=d.getElementsByClassName("e-right")[0])&&t[1]===u&&(0,e.detach)(C)})),n[1]===u&&(h.classList.contains("e-sheet-content")||h.classList.contains("e-column-header"))&&b.forEach((function(t){t!==n&&(C=d.getElementsByClassName("e-left")[0])&&t[3]+1===u&&(0,e.detach)(C)})))):((d=h.querySelector("."+i))||(d=r.cloneNode(!0),s&&!d.classList.contains("e-multi-range")&&d.classList.add("e-multi-range"),h.appendChild(d)),o&&d.classList.remove(i)),Kl(t,d,n,l,t.enableRtl,p,u,a,!1,t.viewport.beforeFreezeHeight,t.viewport.beforeFreezeWidth,t.sheetModule.colGroupWidth),d.classList.contains("e-hide")&&d.classList.remove("e-hide")}))}else s||(Xl(t.getSelectAllContent(),null,i,!0),Xl(t.getColumnHeaderContent(),null,i,!0),Xl(t.getRowHeaderContent(),null,i,!0)),Kl(t,r,n,l,t.enableRtl,p,u,a),"e-range-indicator"!==i&&t.getMainContent().querySelector("."+i)||t.getMainContent().appendChild(r),r.classList.contains("e-hide")&&r.classList.remove("e-hide"),o&&r.classList.remove(i)}}function Xl(t,r,n,i,a){if(i||t!==r)if(a)for(var s=t.querySelectorAll("."+n),o=0;o<s.length;)s[o].classList.remove(n),o++;else{var l=t.querySelector("."+n);l&&!l.classList.contains("e-multi-range")&&(0,e.detach)(l)}}function Kl(t,r,n,i,a,s,o,l,d,h,p,u,f,g,m){var v,y,C=c(n),b=Gl(i,C,s,o,h,p,u),x=[Dr(i,0,!0),Dr(i,0,!0,"columns")];t.scrollSettings.isFinite?(v=C[0]>=i.rowCount?0:ml(i,C[0],C[2]<i.rowCount?C[2]:i.rowCount-1,!0),y=C[1]>=i.colCount?0:wl(i,C[1],C[3]<i.colCount?C[3]:i.colCount-1,!0)):(v=ml(i,C[0],C[2],!0),y=wl(i,C[1],C[3],!0));var S=0===C[1]&&C[3]===i.colCount-1,w=0===C[0]&&C[2]===i.rowCount-1,I=0,E=-5,N=-5,R=0,O=6,k=6;if((0,e.isNullOrUndefined)(f)){if((A={top:(C[0]===x[0]?b.top:b.top-pd(1))+"px",height:v&&v+(C[0]===x[0]?0:pd(1))+"px",width:y&&y+(C[1]===x[1]?0:pd(1))+(d&&o&&C[1]<o&&C[3]>=o?1:0)+"px"})[a?"right":"left"]=(C[1]===x[1]?b.left:b.left-1)+"px",r)return $l([{element:r,attrs:A}],l)}else{S&&(E=-5,N=-2,O=6,k=3),w&&(N=-5,E=0,O=1,k=6),w||(I+=v),S||(R+=y),I+=Math.round(b.top)+E,R+=Math.round(b.left)+N;var A={};g?((0,e.removeClass)([r],"e-hide"),I=m&&m.top?m.top:I,R=m&&m.left?m.left:R,(A={top:I+O+"px"})[a?"right":"left"]=R+k+"px",r&&$l([{element:r,attrs:A}],l)):((A={top:I+"px"})[a?"right":"left"]=R+"px",r&&$l([{element:r,attrs:A}],l))}}function $l(t,r){return new Promise((function(n){var i=function(){t.forEach((function(t){(0,e.setStyleAttribute)(t.element,t.attrs),n()}))};r?i():requestAnimationFrame((function(){return i()}))}))}function Zl(){return e.Browser.isPointer?"pointerdown":"mousedown touchstart"}function Jl(){return e.Browser.isPointer?"pointermove":"mousemove touchmove"}function Ql(){return e.Browser.isPointer?"pointerup":"mouseup touchend"}function ed(e){return"touchstart"===e.type||"pointerdown"===e.type&&"touch"===e.pointerType}function td(e){return"touchmove"===e.type||"pointermove"===e.type&&"touch"===e.pointerType}function rd(e){return"touchend"===e.type||"pointerup"===e.type&&"touch"===e.pointerType}function nd(e){return e&&("mousedown"===e.type||"pointerdown"===e.type)}function id(e){return e&&("mousemove"===e.type||"pointermove"===e.type)}function ad(e){return e&&("mouseup"===e.type||"pointerup"===e.type)}function sd(e){return e===Pl.UP||e===Pl.DOWN||e===Pl.LEFT||e===Pl.RIGHT}function od(e){return e.changedTouches?e.changedTouches[0].clientX:e.clientX}function ld(e){return e.changedTouches?e.changedTouches[0].clientY:e.clientY}function dd(e){return e.changedTouches?e.changedTouches[0].pageX:e.pageX}function hd(e){return e.changedTouches?e.changedTouches[0].pageY:e.pageY}function pd(e,t){if(window.devicePixelRatio%1>0){var r=e*window.devicePixelRatio%1;return e+(r?(r>.5||t?1-r:-1*r)/window.devicePixelRatio:0)}return e}var cd={role:"role",selected:"aria-selected",multiselectable:"aria-multiselectable",busy:"aria-busy",colcount:"aria-colcount"};function ud(e,t){Object.keys(t).forEach((function(r){e&&e.setAttribute(cd[""+r],t[""+r])}))}function fd(t,r){if(t){var n=(0,e.getComponent)(t,r);n&&n.destroy()}}function gd(e,t,r,n,i){var a,s,o,l,d,h,p,c,u,f=i.getActiveSheet(),g=i.frozenRowCount(f),m=i.frozenColCount(f);if(n){var v=e<m?i.getSelectAllContent():i.getColumnHeaderContent();a=v.getElementsByTagName("th")[t],s=v.getElementsByTagName("col")[t],o=(e<m?i.getRowHeaderContent():i.getMainContent()).getElementsByTagName("col")[t]}else{a=s=g||m?i.getRow(e,null,m-1):i.getRow(e,i.getRowHeaderTable()),s.style.height=parseInt(r,10)>0?pd(parseInt(r,10))+"px":"2px",(o=i.getRow(e,null,m)).style.height=parseInt(r,10)>0?pd(parseInt(r,10))+"px":"0px";var y=void 0;if(f.showHeaders){var C=i.getRowHeaderContent().getElementsByClassName("e-row"),b=[];b[0]=C[t].getElementsByTagName("td")[0].cloneNode(!0),y=yd(i.getRowHeaderTable(),b,!1,i)+1}for(var x=i.getMainContent().getElementsByClassName("e-row"),S=[],w=0,I=0,E=e,N=0;N<x[t].getElementsByTagName("td").length;N++){var R=x[t].getElementsByTagName("td")[N];S[N]=R.cloneNode(!0);var O=Ln(E,N,f,!1,!0);if(I=I<(w=O.value?Sd(i,O.style):w)?w:I,R.getElementsByClassName("e-cf-databar")[0]){var k=Number(o.style.height.split("px")[0]);i.notify(kt,{indexes:[E,N],cell:O,ele:R,isRender:!0,resizedRowHeight:k})}}var A=I+1,F=y>=A?y:A;parseInt(o.style.height,10)<F||a&&a.classList.contains("e-reach-fntsize")&&parseInt(o.style.height,10)===F?(f.showHeaders&&(a.classList.add("e-reach-fntsize"),s.style.lineHeight=parseInt(r,10)>=4?parseInt(r,10)-4+"px":parseInt(r,10)>0?parseInt(r,10)-1+"px":"0px"),o.style.lineHeight=parseInt(r,10)>0?parseInt(r,10)-1+"px":"0px"):(s&&s.style.removeProperty("line-height"),o.style.removeProperty("line-height"),a&&a.classList.contains("e-reach-fntsize")&&a.classList.remove("e-reach-fntsize"))}if(h=o.previousElementSibling,u=o.nextElementSibling,h&&(f.showHeaders&&(l=a.previousElementSibling,d=s.previousElementSibling),h=o.previousElementSibling),u&&(f.showHeaders&&(p=a.nextElementSibling,c=s.nextElementSibling),u=o.nextElementSibling),parseInt(r,10)<=0&&!o.classList.contains("e-zero")&&!o.classList.contains("e-zero-start")){if(h&&u)if(n?(f.showHeaders&&(s.style.width="2px"),o.style.width="0px"):(f.showHeaders&&(s.style.height="2px"),o.style.height="0px"),h.classList.contains("e-zero-start")?(f.showHeaders&&a.classList.add("e-zero-start"),o.classList.add("e-zero-start")):(f.showHeaders&&a.classList.add("e-zero"),o.classList.add("e-zero")),!p||p.classList.contains("e-zero")||p.classList.contains("e-zero-last")||(f.showHeaders&&a.classList.add("e-zero-last"),o.classList.add("e-zero-last")),h.classList.contains("e-zero-last")&&(f.showHeaders&&l.classList.remove("e-zero-last"),h.classList.remove("e-zero-last")),f.showHeaders&&l.classList.contains("e-zero")?(a.classList.contains("e-zero-end"),md(d,-2,n)):f.showHeaders&&md(d,-1,n),f.showHeaders&&l.classList.contains("e-zero-start")&&md(s,-1,n),f.showHeaders&&p.classList.contains("e-zero"))if(a.classList.contains("e-zero-start"))for(;p;){if(p.classList.contains("e-zero")&&0!==parseInt(c.style.height,10)&&!n||0!==parseInt(c.style.width,10)&&n){n?(s.style.width=parseInt(s.style.width,10)-1+"px",c.style.width=parseInt(c.style.width,10)-1+"px"):(s.style.height=parseInt(s.style.height,10)-1+"px",c.style.height=parseInt(c.style.height,10)-1+"px"),p.classList.remove("e-zero"),p.classList.add("e-zero-start");break}var T=void 0;p.classList.remove("e-zero"),p.classList.add("e-zero-start"),n?(T=parseInt(p.getAttribute("aria-colindex"),10)-1,p=i.getColHeaderTable().getElementsByTagName("th")[T+1],c=i.getColHeaderTable().getElementsByTagName("col")[T+1]):(T=parseInt(p.getAttribute("aria-rowindex"),10)-1,p=i.getRowHeaderTable().getElementsByTagName("tr")[T+1],c=i.getRowHeaderTable().getElementsByTagName("tr")[T+1])}else md(s,-2,n);else f.showHeaders&&(p.classList.contains("e-zero-end")?n?s.style.width="0px":s.style.height="0px":md(c,-1,n));else if(h)n?(f.showHeaders&&(s.style.width="1px"),o.style.width="0px"):(f.showHeaders&&(s.style.height="1px"),o.style.height="0px"),f.showHeaders&&a.classList.add("e-zero-end"),o.classList.add("e-zero-end"),f.showHeaders&&a.classList.add("e-zero-last"),o.classList.add("e-zero-last"),f.showHeaders&&l.classList.contains("e-zero")?md(d,-2,n):md(d,-1,n);else if(p)if(a.classList.add("e-zero-start"),o.classList.add("e-zero-start"),p.classList.contains("e-zero")||(a.classList.add("e-zero-last"),o.classList.add("e-zero-last")),n?(s.style.width="1px",o.style.width="0px"):(s.style.height="1px",o.style.height="0px"),f.showHeaders&&p.classList.contains("e-zero"))for(;p;){if(p.classList.contains("e-zero")&&0!==parseInt(c.style.width,10)&&n||0!==parseInt(c.style.height,10)&&!n){n?(c.style.width=parseInt(c.style.width,10)-1+"px",s.style.width=parseInt(s.style.width,10)-1+"px"):(c.style.height=parseInt(c.style.height,10)-1+"px",s.style.height=parseInt(s.style.height,10)-1+"px"),p.classList.add("e-zero-start"),p.classList.remove("e-zero");break}T=void 0;p.classList.add("e-zero-start"),p.classList.remove("e-zero"),n?(T=parseInt(p.getAttribute("aria-colindex"),10)-1,c=i.getColHeaderTable().getElementsByTagName("col")[T+1],p=i.getColHeaderTable().getElementsByTagName("th")[T+1]):(T=parseInt(p.getAttribute("aria-rowindex"),10)-1,c=i.getRowHeaderTable().getElementsByTagName("tr")[T+1],p=i.getRowHeaderTable().getElementsByTagName("tr")[T+1])}else f.showHeaders&&md(c,-1,n)}else if(parseInt(r,10)>0){var D=pd(parseInt(r,10))+"px";n?(s.style.width=D,o.style.width=D):(s.style.height=D,o.style.height=D),f.showHeaders&&l&&p?(l.classList.contains("e-zero")?a.classList.contains("e-zero")?n?(d.style.width=parseInt(d.style.width,10)+2+"px",s.style.width=parseInt(s.style.width,10)-1+"px"):(d.style.height=parseInt(d.style.height,10)+2+"px",s.style.height=parseInt(s.style.height,10)-1+"px"):md(s,-1,n):a.classList.contains("e-zero")?md(d,1,n):a.classList.contains("e-zero-start")&&(n?(d.style.width=parseInt(d.style.width,10)+1+"px",s.style.width=parseInt(s.style.width,10)-1+"px"):(d.style.height=parseInt(d.style.height,10)+1+"px",s.style.height=parseInt(s.style.height,10)-1+"px")),p.classList.contains("e-zero")?md(s,-1,n):(a.classList.contains("e-zero")||a.classList.contains("e-zero-start"))&&md(c,1,n),a.classList.contains("e-zero")&&a.classList.remove("e-zero"),a.classList.contains("e-zero-start")&&a.classList.remove("e-zero-start"),o.classList.contains("e-zero")&&o.classList.remove("e-zero"),o.classList.contains("e-zero-start")&&o.classList.remove("e-zero-start"),a.classList.contains("e-zero-last")&&a.classList.remove("e-zero-last"),o.classList.contains("e-zero-last")&&o.classList.remove("e-zero-last"),(l.classList.contains("e-zero")||l.classList.contains("e-zero-start"))&&(l.classList.add("e-zero-last"),h.classList.add("e-zero-last"))):f.showHeaders&&l?(l.classList.contains("e-zero")?a.classList.contains("e-zero")?n?(s.style.width=parseInt(s.style.width,10)-1+"px",d.style.width=parseInt(d.style.width,10)+2+"px"):(s.style.height=parseInt(s.style.height,10)-1+"px",d.style.height=parseInt(d.style.height,10)+2+"px"):md(s,-1,n):a.classList.contains("e-zero")?md(d,1,n):md(s,-1,n),a.classList.contains("e-zero")&&a.classList.remove("e-zero"),a.classList.contains("e-zero-end")&&a.classList.remove("e-zero-end"),o.classList.contains("e-zero")&&o.classList.remove("e-zero"),o.classList.contains("e-zero-end")&&o.classList.remove("e-zero-end")):f.showHeaders&&p&&(p.classList.contains("e-zero")?md(s,-1,n):a.classList.contains("e-zero-start")&&(md(c,1,n),a.classList.remove("e-zero-start")),a.classList.contains("e-zero")&&a.classList.remove("e-zero"),o.classList.contains("e-zero")&&o.classList.remove("e-zero"),a.classList.contains("e-zero-start")&&a.classList.remove("e-zero-start"),o.classList.contains("e-zero-start")&&o.classList.remove("e-zero-start"))}}function md(e,t,r){r?e.style.width=parseInt(e.style.width,10)+t+"px":e.style.height=parseInt(e.style.height,10)+t+"px"}function vd(e){zl=e}function yd(e,t,r,n,i,a){var s,o,l=n.createElement("div",{className:n.element.className,styles:"display: block"}),d=n.createElement("table",{className:e.className+"e-resizetable",styles:"width: auto;height: auto"}),h=n.createElement("tr");r?t.forEach((function(e){var t=h.cloneNode();t.appendChild(e),d.appendChild(t)})):(t.forEach((function(e){h.appendChild(e.cloneNode(!0))})),d.appendChild(h)),l.appendChild(d),document.body.appendChild(l);var p=d.getBoundingClientRect().width,c=d.getBoundingClientRect().height;return a?(s=r&&parseInt(i,10)>p?p:parseInt(i,10),o=!r&&parseInt(i,10)>c?c:parseInt(i,10)):(o=c,s=p),document.body.removeChild(l),r?Math.ceil(s):Math.ceil(o)}function Cd(t,r,n,i,a,s){var l,d,c,u,f,g,m,v,y,C,b,x,S,w,I,E=t.eventArgs,N=t.isFromUpdateAction||(0,e.isUndefined)(n);if(t.isUndoRedo)return N=t.isFromUpdateAction=!0,delete t.isUndoRedo,void r.notify(ma,t);if(N&&!s){var R=E.address||E.range||E.pastedRange||E.addressCollection&&E.addressCollection[0]||E.dataRange,O=(0,e.isUndefined)(E.sheetIndex)?(0,e.isUndefined)(E.sheetIdx)?(0,e.isUndefined)(E.activeSheetIndex)?R?p(r,R):r.activeSheetIndex:E.activeSheetIndex:E.sheetIdx:E.sheetIndex;if(O!==r.activeSheetIndex){var k={sheet:In(r,O),resolveAfterFullDataLoaded:!0,indexes:[0,0,0,0],promise:new Promise((function(e){e(void 0)}))};return r.notify(j,k),void k.promise.then((function(){Cd(t,r,n,i,a,!0)}))}}var A,F=yn(r,E.index);switch(t.action){case"sorting":u={args:{range:t.eventArgs.range,sortOptions:t.eventArgs.sortOptions,cancel:!1},promise:c=new Promise((function(e){e(void 0)}))},r.notify(Ae,u),u.promise.then((function(e){r.serviceLocator.getService("cell").refreshRange(o(e.range))}));break;case"cellSave":g=(S={element:(f=t.eventArgs).element,value:f.value,oldValue:f.oldValue,address:f.address,displayText:f.displayText,formula:f.formula,originalEvent:f.originalEvent}).formula?{formula:S.formula}:{value:S.value},r.updateCellInfo(g,S.address,!1,t.eventArgs,n),!0===n&&r.trigger("cellSave",S);break;case"addNote":case"editNote":case"deleteNote":A=o(t.eventArgs.address),n&&(Hr(r,r.getActiveSheet(),{rowIdx:A[0],colIdx:A[1],preventEvt:!0,cell:{notes:t.eventArgs.notes}}),r.serviceLocator.getService("cell").refreshRange(o(E.address),!1,!1,!0,!1,Yr(r)));break;case"cellDelete":w=h(r,t.eventArgs.address),Ld(r,w.indices,w.sheetIndex);break;case"format":if("CellFormat"===E.requestType){if(E.style&&E.style.border&&!(0,e.isNullOrUndefined)(E.borderType)){var T={};Object.assign(T,E.style,null,!0),E.style.border=void 0,r.notify(ae,{style:E.style,refreshRibbon:!0,range:E.range}),E.style.border=T.border,r.setBorder(E.style,E.range,E.borderType),E.style=T}else r.notify(ae,{style:E.style,refreshRibbon:!0,range:E.range});Bl((function(){return r.selectRange(r.getActiveSheet().selectedRange)}))}else r.numberFormat(E.format,E.range);break;case"clipboard":m=new Promise((function(e){e(void 0)})),x=r.getAddressInfo(E.copiedRange),r.notify(E.copiedInfo.isCut?Ri:Oi,{range:x.indices,sId:In(r,x.sheetIndex).id,promise:c,invokeCopy:!0,isPublic:!0,isFromUpdateAction:!0}),m.then((function(){return r.notify(ki,{range:o(E.pastedRange),sIdx:vn(r,Cn(E.pastedRange)),type:E.type,isAction:!1,isInternal:!0,isFromUpdateAction:!0})}));break;case"gridLines":r.setSheetPropertyOnMute(r.sheets[E.sheetIdx],"showGridLines",E.isShow),r.serviceLocator.getService("sheet").toggleGridlines(),r.notify(Mt,null);break;case"headers":r.setSheetPropertyOnMute(r.sheets[E.sheetIdx],"showHeaders",E.isShow),r.serviceLocator.getService("sheet").showHideHeaders(),r.notify(Mt,null);break;case"resize":case"resizeToFit":N&&(C=bl(y=r.sheets[E.sheetIndex],E.index),b=hl(y,E.index),(E.isCol&&C&&C.hidden||b&&b.hidden)&&r.notify(Rt,{startIndex:E.index,endIndex:E.index,hide:!1,isCol:E.isCol,sheetIndex:E.sheetIndex})),E.isCol?void 0===E.hide?r.setColWidth(N&&!(0,e.isUndefined)(n)?E.oldWidth:E.width,E.index,E.sheetIndex):r.hideColumn(E.index,E.index,E.hide):(void 0===E.hide?r.setRowHeight(N&&!(0,e.isUndefined)(n)?E.oldHeight:E.height,E.index,E.sheetIndex):r.hideRow(E.index,E.index,E.hide),r.notify(ea,{rowIndex:E.index}));break;case"renameSheet":r.setSheetPropertyOnMute(r.sheets[F],"name",E.value),r.notify(fa,{items:r.element.querySelector(".e-sheet-tabs-items"),value:E.value,idx:F});break;case"hideSheet":r.notify(ga,{sheetIndex:E.sheetIndex});break;case"showSheet":r.notify(as,E);break;case"removeSheet":r.notify(Ci,{index:E.index,isAction:!0,count:E.sheetCount,clicked:!0});break;case"gotoSheet":r.notify(is,{selectedIndex:E.currentSheetIndex,previousIndex:E.previousSheetIndex});break;case"moveSheet":kn(r,E.position,E.sheetIndexes,null,N);break;case"wrap":Bn(t.eventArgs.address,t.eventArgs.wrap,r);break;case"hideShow":E.isCol?r.notify(Rt,{startIndex:E.startIndex,endIndex:E.endIndex,isCol:!0,hide:!1===n?!E.hide:E.hide,sheetIndex:E.sheetIndex,hiddenIndexes:E.hiddenIndexes}):r.notify(Rt,{startIndex:E.startIndex,endIndex:E.endIndex,hide:!1===n?!E.hide:E.hide,sheetIndex:E.sheetIndex});break;case"replace":r.notify(at,{value:E.compareValue,replaceValue:E.replaceValue,sheetIndex:E.sheetIndex,address:E.address});break;case"replaceAll":r.notify(st,E);break;case"filter":c=new Promise((function(e){e(void 0)})),!1===n?r.notify(xa,{predicates:E.previousPredicates,range:E.range,sIdx:E.sheetIndex,promise:c,isInternal:!0}):r.notify(xa,{predicates:E.predicates,range:E.range,sIdx:E.sheetIndex,promise:c,isInternal:!0,useFilterRange:E.useFilterRange,allowHeaderFilter:E.allowHeaderFilter}),a&&!N&&c.then((function(){r.notify(ka,(0,e.extend)({isUndo:!n,isUndoRedo:!N},a))}));break;case"insert":if("Sheet"===t.eventArgs.modelType)y=r;else if(!(y=In(r,t.eventArgs.activeSheetIndex)))break;!1===n?r.notify(Ze,{model:y,start:t.eventArgs.index,isUndoRedo:!0,end:t.eventArgs.index+(t.eventArgs.model.length-1),modelType:t.eventArgs.modelType}):r.notify($e,{model:y,start:t.eventArgs.index,end:t.eventArgs.index+(t.eventArgs.model.length-1),modelType:t.eventArgs.modelType,checkCount:void 0===n?t.eventArgs.sheetCount:null,activeSheetIndex:t.eventArgs.activeSheetIndex,isUndoRedo:!0,insertType:t.eventArgs.insertType,isFromUpdateAction:N});break;case"delete":if("Sheet"===t.eventArgs.modelType)y=r;else if(!(y=In(r,t.eventArgs.activeSheetIndex)))break;!1===n?r.notify($e,{model:y,start:t.eventArgs.deletedModel,modelType:t.eventArgs.modelType,columnCellsModel:t.eventArgs.deletedCellsModel,definedNames:t.eventArgs.definedNames,activeSheetIndex:t.eventArgs.activeSheetIndex,isUndoRedo:!0,insertType:"Row"===t.eventArgs.modelType?"above":"before",conditionalFormats:t.eventArgs.conditionalFormats,prevAction:t.action}):r.notify(Ze,{model:y,start:t.eventArgs.startIndex,checkCount:t.eventArgs.sheetCount,end:t.eventArgs.endIndex,modelType:t.eventArgs.modelType,isUndoRedo:!0,insertType:"Row"===t.eventArgs.modelType?"above":"before"});break;case"validation":!1===n?r.notify(rs,{range:E.range}):r.notify(Qe,{rules:{type:E.type,operator:E.operator,value1:E.value1,value2:E.value2,ignoreBlank:E.ignoreBlank,inCellDropDown:E.inCellDropDown},range:E.range});break;case"removeHighlight":case"addHighlight":r.notify(Ba,{isRemoveHighlight:"removeHighlight"===t.action?!1!==n:!1===n,range:E.range,isPublic:!0});break;case"merge":t.eventArgs.isAction=!1,v=[];for(var D=0,L=E.model.length;D<L;D++){v.push({cells:[]});for(var P=0,M=E.model[D].cells.length;P<M;P++)v[D].cells[P]={},Object.assign(v[D].cells[P],E.model[D].cells[P])}if(r.notify(St,t.eventArgs),"Manual"===r.calculationMode&&n&&r.getActiveSheet().isSheetCalculated)for(var B=0;B<E.model.length;B++)for(var H=E.model[B].cells,U=0;U<H.length;U++){var V=E.model[B].cells[U].value;v[B].cells[U].value=(0,e.isNullOrUndefined)(V)||""===V?v[B].cells[U].value:V}E.model=v;break;case"clear":I={options:t.eventArgs,isFromUpdateAction:N},r.notify(os,I),!N&&I.cfClearActionArgs&&(E.cfClearActionArgs.previousConditionalFormats=I.cfClearActionArgs.previousConditionalFormats,E.cfClearActionArgs.conditionalFormats=I.cfClearActionArgs.conditionalFormats);break;case"conditionalFormat":!1===n?r.notify(At,{range:E.range,cfModel:{type:E.type,cFColor:E.cFColor,value:E.value},sheetIdx:E.sheetIdx,isUndoRedo:!E.cancel,isFromUpdateAction:N}):r.notify(Ot,{cfModel:{type:E.type,cFColor:E.cFColor,value:E.value,range:E.range},sheetIdx:E.sheetIdx,isUndoRedo:!0,isFromUpdateAction:N});break;case"clearCF":if(!1===n)r.notify(At,{oldCFModel:E.previousConditionalFormats,updatedCFModel:E.conditionalFormats,range:E.selectedRange,isUndo:!0,sheetIdx:E.sheetIdx});else{var z={range:E.selectedRange,sheetIdx:E.sheetIdx,isUndoRedo:!0,isFromUpdateAction:N};r.notify(At,z),N||(E.previousConditionalFormats=z.oldCFModel,z.updatedCFModel.length?E.conditionalFormats=z.updatedCFModel:delete E.conditionalFormats)}break;case"insertImage":!1===n?r.notify(xs,{id:t.eventArgs.id,sheetIdx:t.eventArgs.sheetIndex+1,range:t.eventArgs.range,preventEventTrigger:!0}):r.notify(bs,{options:{src:t.eventArgs.imageData,height:t.eventArgs.imageHeight,width:t.eventArgs.imageWidth,id:t.eventArgs.id},range:t.eventArgs.range,isPublic:!1,isUndoRedo:!0});break;case"deleteImage":!1===n?r.notify(bs,{options:{src:t.eventArgs.imageData,height:t.eventArgs.imageHeight,width:t.eventArgs.imageWidth,id:t.eventArgs.id},range:t.eventArgs.address,isPublic:!1,isUndoRedo:!0}):r.notify(xs,{id:t.eventArgs.id,range:t.eventArgs.address,preventEventTrigger:!0});break;case"imageRefresh":d=document.getElementById(t.eventArgs.id),!1===n?r.notify(vs,{prevTop:t.eventArgs.currentTop,prevLeft:t.eventArgs.currentLeft,currentTop:t.eventArgs.prevTop,currentLeft:t.eventArgs.prevLeft,id:t.eventArgs.id,currentHeight:t.eventArgs.prevHeight,currentWidth:t.eventArgs.prevWidth,requestType:"imageRefresh",prevHeight:t.eventArgs.currentHeight,prevWidth:t.eventArgs.currentWidth,isUndoRedo:!0}):(t.eventArgs.isUndoRedo=!0,r.notify(vs,t.eventArgs)),d&&(d.style.height=!1===n?t.eventArgs.prevHeight+"px":t.eventArgs.currentHeight+"px",d.style.width=!1===n?t.eventArgs.prevWidth+"px":t.eventArgs.currentWidth+"px",d.style.top=!1===n?t.eventArgs.prevTop+"px":t.eventArgs.currentTop+"px",d.style.left=!1===n?t.eventArgs.prevLeft+"px":t.eventArgs.currentLeft+"px");break;case"insertChart":if(!1===n)r.notify(Ss,{id:E.id,range:E.range,isUndoRedo:!0});else{var _=[{type:E.type,theme:E.theme,markerSettings:E.markerSettings,isSeriesInRows:E.isSeriesInRows,range:E.range,id:E.id,height:E.height,width:E.width,top:E.top,left:E.left}];r.notify(Lt,{chart:_,isUndoRedo:!1,range:E.posRange})}break;case"deleteChart":if(!1===n){var q=[{type:E.type,theme:E.theme,markerSettings:E.markerSettings,isSeriesInRows:E.isSeriesInRows,range:E.range,id:E.id,height:E.height,width:E.width,top:E.top,left:E.left}];r.notify(Lt,{chart:q,isUndoRedo:!1,range:E.posRange})}else r.notify(Ss,{id:E.id,range:E.range,isUndoRedo:!0});break;case"chartRefresh":(l=document.getElementById(t.eventArgs.id))&&(l.style.height=!1===n?t.eventArgs.prevHeight+"px":t.eventArgs.currentHeight+"px",l.style.width=!1===n?t.eventArgs.prevWidth+"px":t.eventArgs.currentWidth+"px",l.style.top=!1===n?t.eventArgs.prevTop+"px":t.eventArgs.currentTop+"px",l.style.left=!1===n?t.eventArgs.prevLeft+"px":t.eventArgs.currentLeft+"px"),!1===n?(r.notify(ws,(0,e.extend)({},t.eventArgs,{currentColIdx:t.eventArgs.prevColIdx,currentHeight:t.eventArgs.prevHeight,currentLeft:t.eventArgs.prevLeft,currentRowIdx:t.eventArgs.prevRowIdx,currentTop:t.eventArgs.prevTop,currentWidth:t.eventArgs.prevWidth,prevColIdx:t.eventArgs.currentColIdx,prevHeight:t.eventArgs.currentHeight,prevLeft:t.eventArgs.currentLeft,prevRowIdx:t.eventArgs.currentRowIdx,prevTop:t.eventArgs.currentTop,prevWidth:t.eventArgs.currentWidth,isUndoRedo:!0})),r.notify(Ht,{height:t.eventArgs.prevHeight.toString(),width:t.eventArgs.prevWidth.toString(),overlayEle:l})):(t.eventArgs.isUndoRedo=!0,r.notify(ws,t.eventArgs),r.notify(Ht,{height:t.eventArgs.currentHeight.toString(),width:t.eventArgs.currentWidth.toString(),overlayEle:l}));break;case"chartDesign":r.notify(Ds,t.eventArgs);break;case"autofill":N&&E.undoArgs&&(E.undoArgs.isFromUpdateAction=E.undoArgs.isUndo=E.undoArgs.preventEvt=!0,E.undoArgs.isPublic=!0,r.notify(ma,E.undoArgs)),r.notify(Xt,{fillRange:t.eventArgs.fillRange,dataRange:t.eventArgs.dataRange,fillType:t.eventArgs.fillType,direction:t.eventArgs.direction,cells:t.eventArgs.beforeActionData});break;case"removeValidation":!1!==n&&r.notify(rs,{range:E.range,isCol:E.isColSelected});break;case"addDefinedName":if(!1===n)r.notify(pe,{action:"removeDefinedName",isRemoved:!1,definedName:E.name,scope:E.scope,isEventTrigger:!0});else{var W={name:E.name,refersTo:E.refersTo,scope:E.scope,comment:E.comment};r.notify(pe,{action:"addDefinedName",isAdded:!1,definedName:W,isEventTrigger:!0})}break;case"hyperlink":r.notify(Ve,{hyperlink:E.hyperlink,cell:E.address,displayText:E.displayText,isUndoRedo:!0}),r.serviceLocator.getService("cell").refreshRange(o(E.address),!1,!1,!1,!0,Yr(r));break;case"removeHyperlink":r.notify(ca,{range:E.address,preventEventTrigger:!0});break;case"freezePanes":r.freezePanes(E.row,E.column,E.sheetIndex);break;case"duplicateSheet":An(r,E.sheetIndex,null,N);break;case"protectSheet":E.isProtected?r.notify(gt,E):(r.setSheetPropertyOnMute(In(r,E.sheetIndex),"password",""),r.notify(Va,{isActive:!0,sheetIndex:E.sheetIndex}));break;case"protectWorkbook":E.isProtected?r.notify(Us,E):r.notify(Vs,null);break;case"lockCells":r.notify(bt,E)}}function bd(e,r,n,i){for(var a,s=e.sheets[i].ranges,o=0,l=s.length;o<l;o++)if(s[o].template&&(a=t(s[o].address.length?s[o].address:s[o].startCell))[0]<=r&&a[1]<=n&&a[2]>=r&&a[3]>=n)return!0;return!1}function xd(e,t,r,n,i,a,s,o){void 0===s&&(s=!0);var l=fl(t,n,!0),d=pd(r);if(!o){var h=e.frozenColCount(t);if((i=i||(t.frozenRows?e.getRow(n,null,h):e.getRow(n)))&&(i.style.height=d+"px"),t.frozenColumns)a=a||e.getRow(n,null,h-1);else{var p=e.frozenRowCount(t);a=a||e.getRow(n,n<p?e.sheetModule.getSelectAllTable():e.getRowHeaderTable())}a&&(a.style.height=d+"px")}gl(t,n,r),e.setProperties({sheets:e.sheets},!0),s&&e.notify(Wi,{rowIdx:n,threshold:d-l})}function Sd(e,t,r,n){void 0===r&&(r=1);var i=t&&t.fontSize||e.cellStyle.fontSize,a=(i.indexOf("pt")>-1?parseInt(i,10)/.75:parseInt(i,10))*(n||wd(t&&t.fontFamily?t:e.cellStyle))*r;return Math.ceil(a%1>.9?a+1:a)}function wd(e){var t=zl;return e&&("Arial Black"===e.fontFamily||"Comic Sans MS"===e.fontFamily?t=1.44:'"Segoe UI", sans-serif'===e.fontFamily&&(t=1.36)),t}function Id(e,t,r,n){t||(t=r);var i=document.createElement("canvas").getContext("2d");return i.font=(t.fontStyle||r.fontStyle)+" "+(t.fontWeight||r.fontWeight)+" "+(t.fontSize||r.fontSize)+" "+(t.fontFamily||r.fontFamily),n?i.measureText(e).width:pd(i.measureText(e).width,!0)}function Ed(e,t,r,n){var i,a,s,o,l,d=0,h=e.toString().split(" "),p=Id(" ",r,n),c=0,u=0,f=0,g=function(e,a){d&&c++,i/t>=1&&(e.split("").forEach((function(e){o=Id(e,r,n,!0),(s+=o)>t&&(c++,s=o)})),i=pd(s,!0)),a||m(i),d=i},m=function(e){i+=(e+p)/t>=1?0:p};return h.forEach((function(e){s=0,o=0,i=Id(e,r,n),(d+i)/t>1?(a=e.split("-")).length>1?a.forEach((function(p){s=0,o=0,l||(l=Id("-",r,n)),i=Id(p,r,n),a[a.length-1]!==p&&(i+=l),(d+i)/t>=1?g(p,a[a.length-1]!==p):(a[a.length-1]===p&&h[h.length-1]!==e&&m(d+i),d+=i)})):g(e,!1):(m(d+i),d+=i)})),d&&(u=(d-p)/t,f=parseFloat(u.toString().split(".")[0]),c+=u+.05>=f+1?Math.ceil(u)+1:Math.ceil(u)),c}function Nd(e,t,r){var n=0,i=Ln(e,t,r,null,!0);i.style&&(i.style.border?n=(0===e?2:1)*parseFloat(i.style.border.split("px")[0]):(0===e&&i.style.borderTop&&(n=parseFloat(i.style.borderTop.split("px")[0])),i.style.borderBottom&&(n+=parseFloat(i.style.borderBottom.split("px")[0]))));var a=Ln(e+1,t,r,null,!0);return i.style&&(i.style.border||i.style.borderBottom)||!a.style||!a.style.borderTop||(n+=parseFloat(a.style.borderTop.split("px")[0])),Math.ceil(n)||1}function Rd(e,t,r,n){return void 0===n&&(n=r),wl(e,r,n,!0)-pd(4+(function(e,t,r){var n=0,i=Ln(e,t,r,null,!0),a=Ln(e,t+1,r,null,!0);return i.style&&(i.style.border?n=(0===t?2:1)*parseFloat(i.style.border.split("px")[0]):(0===t&&i.style.borderLeft&&(n=parseFloat(i.style.borderLeft.split("px")[0])),i.style.borderRight&&(n+=parseFloat(i.style.borderRight.split("px")[0])))),i.style&&(i.style.border||i.style.borderRight)||!a.style||!a.style.borderLeft||(n+=parseFloat(a.style.borderLeft.split("px")[0])),n>0&&n<1?1:n}(t,r,e)||1))}function Od(e,t,r,n,i,a,s){return Sd(e,i,a,s)+Nd(t,r,n)}function kd(e,t,r,n){e.maxHgts[t]||(e.maxHgts[t]={}),e.maxHgts[t][r]=n}function Ad(e,t){var r=0,n=e.maxHgts[t];return n&&Object.keys(n).forEach((function(e){n[""+e]>r&&(r=n[""+e])})),r}function Fd(t){if(!document.activeElement.classList.contains("e-text-findNext-short"))if(e.Browser.isIE){var r=window.scrollX,n=window.scrollY;t.focus(),window.scrollTo(r,n)}else{if(t.classList.contains("e-input")){var i=t,a=i.value.length;i.setSelectionRange(a,a)}t.focus({preventScroll:!0})}}function Td(r,n){for(var i,a=r.getActiveSheet(),s=(0,e.isNullOrUndefined)(n)?c(t(a.selectedRange)):n,o=s[0];o<=s[2];o++)for(var l=s[1];l<=s[3];l++){if(Ar(Ln(o,l,a),bl(a,l))){i=!0;break}}return i}function Dd(e){return e.includes(" ")}function Ld(t,r,n){for(var i,a,s,l,d,h,p=In(t,n),c=n===t.activeSheetIndex,u=p.conditionalFormats&&p.conditionalFormats.length&&[].slice.call(p.conditionalFormats),f=[],g=!1,m=r[0],v=r[2];m<=v;m++)if(!ul(p,m))for(var y=r[1],C=r[3];y<=C;y++){var b={cellIdx:[m,y],isUnique:!1,uniqueRange:""};if(t.notify(Ee,b),i=!1,""!==b.uniqueRange){var x=o(b.uniqueRange);i="#SPILL!"===Ln(x[0],x[1],p).value}var S=m===v&&y===C;if(!b.isUnique||i)if((a=Ln(m,y,p))&&0===a.value||a&&a.value&&((0,e.isNullOrUndefined)(a.value)||""!==a.value)){g=!1,s={},a.formula&&(s.formula=""),(a.value||0===a.value)&&(s.value=""),a.hyperlink&&(s.hyperlink="");var w={sheet:p,cell:a,rowIdx:m,colIdx:y};if((a.colSpan>1||a.rowSpan>1)&&Gr(w),d={cell:s,rowIdx:m,colIdx:y,valChange:!0,uiRefresh:c,td:l=t.getCell(w.rowIdx,w.colIdx),cellDelete:!0,isDelete:!S,deletedRange:r},!Object.keys(s).length||Hr(t,p,d))continue;u&&!h&&((h=d.isFormulaDependent)||_r(u,f,m,y)),l&&(l.querySelector(".e-cf-databar")&&l.removeChild(l.querySelector(".e-cf-databar")),l.querySelector(".e-iconsetspan")&&l.removeChild(l.querySelector(".e-iconsetspan")))}else if(!g&&d&&(g=S,d.isDelete=!S,!Object.keys(s).length||Hr(t,p,d)))continue}(f.length||h)&&c&&t.notify(kt,{cfModel:!h&&f,refreshAll:h,isAction:!0,isEdit:!0})}function Pd(e,t){for(var r=0,n=e.getActiveSheet(),i=(n.frozenRows?e.viewport.height-e.sheetModule.getColHeaderHeight(n,!0):e.viewport.height)-17||20,a=t;;a++)if((r+=fl(n,a,!0))>=i)return{index:a,height:r}}function Md(e,t){for(var r=0,n=e.getActiveSheet(),i=e.getMainContent().parentElement.offsetWidth-e.sheetModule.getRowHeaderWidth(n)-e.sheetModule.getScrollSize(),a=t;;a++)if((r+=Sl(n,a,null,!0))>=i)return a}function Bd(e,t){e.renderModule.setSheetPanelSize(t)}function Hd(e){if(window.devicePixelRatio%1>0){var t=e*window.devicePixelRatio%1;return e+(t?(t>.5?1-t:-1*t)/window.devicePixelRatio:0)}return e}function Ud(e,t){var r=[];if(t){var n=Object.getPrototypeOf(new Dn(e,"cells",{},!0)).constructor.prototype.propList,i=n.colPropNames.concat(n.complexPropNames).concat(n.propNames);i.push("formattedText");var a,s=(n=Object.getPrototypeOf(new dl(e,"rows",{},!0)).constructor.prototype.propList).colPropNames.concat(n.complexPropNames).concat(n.propNames),o=(n=Object.getPrototypeOf(new Cl(e,"columns",{},!0)).constructor.prototype.propList).colPropNames.concat(n.complexPropNames).concat(n.propNames),l=(n=Object.getPrototypeOf(new mn(e,"sheets",{},!0)).constructor.prototype.propList).colPropNames.concat(n.complexPropNames).concat(n.propNames);l.splice(l.indexOf("rows"),1),l.splice(l.indexOf("columns"),1),l.splice(l.indexOf("cells"),1),s.splice(s.indexOf("cells"),1),r.push.apply(r,l),-1===t.indexOf("rows")&&r.push.apply(r,s),-1===t.indexOf("columns")&&r.push.apply(r,o),-1===t.indexOf("cells")&&r.push.apply(r,i),t.forEach((function(e){a=r.indexOf(e),r.indexOf(e)>-1&&r.splice(a,1)}))}else r.push("ranges");var d={skipProps:r};return e.notify("getStringifyObject",d),d.model}function Vd(e){for(var t,r=[],n=e.getActiveSheet().name,i=0,a=e.chartColl.length;i<a;i++)if(n===Cn((t=e.chartColl[i]).range)){var s={clientY:t.top,isImage:!0},o={clientX:t.left,isImage:!0};e.notify(ys,s),e.notify(Cs,o),r.push({chart:t,chartRowIdx:s.clientY,chartColIdx:o.clientX})}return r}function zd(r,n){for(var i,a=r.getActiveSheet(),s=(0,e.isNullOrUndefined)(n)?c(t(a.selectedRange)):n,o=s[0];o<=s[2];o++)for(var l=s[1];l<=s[3];l++){if($r(Ln(o,l,a),bl(a,l),hl(a,o))){i=!0;break}}return i}function _d(e,t,r){var n=e.sheets[t];n&&(n.standardHeight=r,e.dataBind())}function jd(e,t){return e.sheets[t].standardHeight}function qd(e){e.forEach((function(e){e&&e.parentNode&&e.parentNode.removeChild(e)}))}var Wd=function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},e(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Gd=function(e,t,r,n){var i,a=arguments.length,s=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,n);else for(var o=e.length-1;o>=0;o--)(i=e[o])&&(s=(a<3?i(s):a>3?i(t,r,s):i(t,r))||s);return a>3&&s&&Object.defineProperty(t,r,s),s},Yd=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return Wd(r,t),Gd([(0,e.Property)(!1)],r.prototype,"isFinite",void 0),Gd([(0,e.Property)(!0)],r.prototype,"enableVirtualization",void 0),r}(e.ChildProperty),Xd=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return Wd(r,t),Gd([(0,e.Property)("Multiple")],r.prototype,"mode",void 0),r}(e.ChildProperty),Kd=function(){function n(e){this.colGroupWidth=30,this.parent=e,this.col=e.createElement("col"),this.rowRenderer=e.serviceLocator.getService("row"),this.cellRenderer=e.serviceLocator.getService("cell"),this.addEventListener()}return n.prototype.refreshSelectALLContent=function(){var e,t=this.parent.getActiveSheet();if(t.frozenColumns||t.frozenRows){var r=this.getSelectAllTable().querySelector("thead"),n=this.rowRenderer.render();r.appendChild(n),e=this.parent.createElement("th",{className:"e-select-all-cell"}),n.appendChild(e)}else(e=this.headerPanel.firstElementChild).classList.add("e-select-all-cell");e.appendChild(this.parent.createElement("button",{className:"e-selectall",id:this.parent.element.id+"_select_all",attrs:{"aria-label":this.parent.serviceLocator.getService(kl).getConstant("SelectAll"),type:"button"}}))},n.prototype.updateLeftColGroup=function(e,t){e&&(this.colGroupWidth=e),t||(t=this.getRowHeaderPanel());var r,n=t.querySelector("table"),i=this.parent.getActiveSheet(),a=document.createDocumentFragment();if(e)n.querySelector("colgroup").firstElementChild.style.width=this.colGroupWidth+"px";else{r=this.parent.createElement("colgroup");var s=this.col.cloneNode();s.style.width=this.colGroupWidth+"px",a.appendChild(s),r.appendChild(a),n.insertBefore(r,n.querySelector("tbody"))}(i.frozenRows||i.frozenColumns)&&(n=this.getSelectAllTable(),e?n.querySelector("colgroup").firstElementChild.style.width=this.colGroupWidth+"px":n.insertBefore(r.cloneNode(!0),n.querySelector("thead"))),this.setPanelWidth(i,t),this.setPanelHeight(i)},n.prototype.setPanelWidth=function(t,r,n){var i,a=this.getScrollSize(!0),s=this.getRowHeaderWidth(t),o=this.parent.enableRtl,l=o?"right":"left",d=this.getColHeaderPanel(),h=this.getContentPanel();if(n&&(i=o?"left":"right",h.style[""+i]=d.style[""+i]=""),t.frozenColumns){var p=document.getElementById(this.parent.element.id+"_sheet").getElementsByClassName("e-frozen-column")[0];p.style.height="calc(100% - "+a+"px)",n&&(p.style[""+i]=""),p.style[""+l]=s-pd(1)+"Px",p.style.display=""}var c="calc(100% - "+s+"px)";this.setHeaderPanelWidth(this.getSelectAllContent(),s),d.style.width=c,d.style[""+l]=s+"px",this.setHeaderPanelWidth(r,s),h.style.width=c,h.style[""+l]=s+"px";var u=this.contentPanel.nextElementSibling?this.contentPanel.nextElementSibling:null;u&&(a?u.style.height=a+1+"px":(u.style.height="1px",u.style.borderTopWidth="0px"),u=u.firstElementChild,n&&(u.style[""+i]=""),u.style[""+l]=s+"px",u.style.width=c,e.Browser.userAgent.indexOf("Mac OS")>-1&&"safari"===e.Browser.info.name&&(u.style.height="7px",u.style.top="-7px"))},n.prototype.getScrollSize=function(e){var t=parseInt(this.headerPanel.style[this.parent.enableRtl?"margin-left":"margin-right"],10);return t?t+(e?1:0):0},n.prototype.setHeaderPanelWidth=function(e,t){[].slice.call(e.querySelectorAll("col.e-empty")).forEach((function(e){t+=parseInt(e.style.width,10)})),e.style.width=t+"px"},n.prototype.setPanelHeight=function(t){var r=this.getScrollSize(!0),n=this.contentPanel,i=this.headerPanel;if(t.frozenRows){var a=this.getColHeaderHeight(t);t.showHeaders||t.frozenColumns?i.style.height="":i.style.height=a+"px",n.style.height="calc(100% - "+(a+r)+"px)";var s=document.getElementById(this.parent.element.id+"_sheet").getElementsByClassName("e-frozen-row")[0];s.style.width=e.Browser.isDevice?"100%":"calc(100% - "+r+"px)",s.style.top=a-1-(t.showHeaders?1:0)+"px",s.style.display=""}else n.style.height="calc(100% - "+((t.showHeaders?pd(31):0)+r)+"px)"},n.prototype.renderPanel=function(){this.contentPanel=this.parent.createElement("div",{className:"e-main-panel",attrs:{tabindex:"0"}});var t=this.parent.getActiveSheet(),r=this.parent.element.id,n=document.createDocumentFragment(),i=this.parent.createElement("div",{className:"e-row-header",id:r+"_row_header"});n.appendChild(i),this.initHeaderPanel(),this.parent.allowScrolling&&this.parent.scrollModule.setPadding();var a=document.getElementById(this.parent.element.id+"_sheet");t.frozenColumns&&a.classList.add("e-frozen-columns"),t.frozenRows&&a.classList.add("e-frozen-rows"),this.updateHideHeaders(t,a),t.showGridLines||a.classList.add("e-hide-gridlines");var s=this.parent.createElement("div",{className:"e-sheet-content",id:r+"_main_content"});n.appendChild(s),this.parent.allowScrolling||(s.style.overflow="hidden"),t.frozenRows&&a.appendChild(this.parent.createElement("div",{className:"e-frozen-row",styles:"display: none"})),t.frozenColumns&&a.appendChild(this.parent.createElement("div",{className:"e-frozen-column",styles:"display: none"})),e.Browser.userAgent.indexOf("Mac OS")>-1&&"safari"===e.Browser.info.name&&a.classList.add("e-mac-safari"),this.contentPanel.appendChild(n)},n.prototype.initHeaderPanel=function(){var e=this.parent.element.id,t=document.createDocumentFragment();this.headerPanel=this.parent.createElement("div",{className:"e-header-panel"});var r=this.parent.createElement("div",{className:"e-selectall-container",id:e+"_selectall"});t.appendChild(r);var n=this.parent.createElement("div",{className:"e-column-header",id:e+"_col_header"});t.appendChild(n),this.headerPanel.appendChild(t)},n.prototype.createHeaderTable=function(){var e=this.contentPanel.querySelector(".e-row-header"),t=this.parent.getActiveSheet();(t.frozenRows||t.frozenColumns)&&this.updateTable(t.frozenRows?["thead","tbody"]:["thead"],"selectall",this.headerPanel.querySelector(".e-selectall-container")),this.updateTable(t.frozenRows?["thead","tbody"]:["thead"],"colhdr",this.headerPanel.querySelector(".e-column-header")),this.updateTable(["tbody"],"rowhdr",e),this.updateLeftColGroup(null,e)},n.prototype.updateTable=function(e,t,r){var n=this,i=document.createDocumentFragment(),a=this.parent.createElement("table",{className:"e-table e-"+t+"-table",attrs:{role:"grid"}});e.forEach((function(e){i.appendChild(n.parent.createElement(e))})),a.appendChild(i),r.appendChild(a)},n.prototype.renderTable=function(r){var n,i,a,s,o=this,l=this.parent.getActiveSheet(),d=document.createDocumentFragment();if(d.appendChild(this.headerPanel),d.appendChild(this.contentPanel),this.parent.allowScrolling){var h=this.parent.createElement("div",{className:"e-scrollbar"});h.appendChild(this.parent.createElement("div",{className:"e-scroller"})),d.appendChild(h)}this.createHeaderTable(),this.updateTable(["tbody"],"content",this.contentPanel.lastElementChild);var p,c=this.parent.createElement("colgroup"),u=this.contentPanel.querySelector(".e-sheet-content tbody");this.refreshSelectALLContent();var f=this.getSelectAllContent().querySelector("colgroup"),g=this.getRowHeaderPanel().querySelector("colgroup"),m=this.getSelectAllContent().querySelector("thead .e-header-row"),v=this.contentPanel.querySelector(".e-row-header tbody"),y=this.getSelectAllContent().querySelector("tbody"),C=this.headerPanel.querySelector(".e-column-header thead"),b=this.headerPanel.querySelector(".e-column-header tbody"),x=this.rowRenderer.render();C.appendChild(x),this.getColHeaderTable().insertBefore(c,C);var S=this.parent.frozenRowCount(l),w=this.parent.frozenColCount(l),I=Dr(l,w-1,!1,"columns");this.parent.notify(pi,{top:r.top,left:r.left});var E,N=l.colCount.toString(),R=l.colCount.toString(),O=r.top&&r.left?"RowColumn":r.top?"Row":r.left?"Column":"";this.parent.getColHeaderTable().setAttribute("aria-colcount",N),this.parent.getRowHeaderTable().setAttribute("aria-rowcount",R),(0,e.attributes)(this.parent.getContentTable(),{"aria-rowcount":R,"aria-colcount":N}),r.cells.forEach((function(e,d){(n=t(d))[1]!==r.indexes[1]&&i||(n[1]===r.indexes[1]&&(a=o.rowRenderer.render(n[0],!0)),w&&S&&n[1]<w&&n[0]<S?((E=y.querySelector(".e-empty"))?y.insertBefore(a,E):y.appendChild(a),i=a):w&&n[1]<w?(v.appendChild(a),i=a):(i=o.rowRenderer.render(n[0]),S&&n[0]<S?(E=b.querySelector(".e-empty"))?b.insertBefore(i,E):b.appendChild(i):u.appendChild(i),n[1]===r.indexes[1]&&(S&&n[0]<S?y.appendChild(a):v.appendChild(a))),n[1]===r.indexes[1]&&o.cellRenderer.renderRowHeader(n[0],a)),s=o.cellRenderer.render({colIdx:n[1],rowIdx:n[0],cell:e,address:d,lastCell:n[1]===r.indexes[3],isHeightCheckNeeded:!0,row:i,hRow:a,pRow:i.previousSibling,pHRow:a.previousSibling,isRefreshing:r.isRefreshing,first:O?O.includes("Row")?n[0]===r.indexes[0]?"Row":O.includes("Column")&&n[1]===r.indexes[1]?"Column":"":n[1]===r.indexes[1]?"Column":"":""});var h=o.parent.scrollSettings.enableVirtualization&&o.parent.viewport.topIndex!==Dr(l,0,!0),C=o.parent.scrollSettings.enableVirtualization&&o.parent.viewport.leftIndex!==Dr(l,0,!0,"columns");if(h&&o.checkRowMerge(n,r.indexes,s,e,l),C&&o.checkColMerge(n,r.indexes,s,e,l),w&&n[1]===I&&(i=null),n[0]===r.indexes[0])if(w&&n[1]<w){p=o.updateCol(l,n[1],f);var N=g.querySelector(".e-empty");N?g.insertBefore(p.cloneNode(!0),N):g.appendChild(p.cloneNode(!0)),o.cellRenderer.renderColHeader(n[1],m)}else o.updateCol(l,n[1],c),o.cellRenderer.renderColHeader(n[1],x)})),this.parent.isReact&&this.parent.renderReactTemplates(),u.parentElement.insertBefore(c.cloneNode(!0),u),Bl((function(){if(o.parent){var e=o.parent.getMainContent(),t=document.getElementById(o.parent.element.id+"_sheet");if(t.childElementCount&&t.querySelector(".e-header-panel")!==o.headerPanel)for(var n=t.children,i=0;i<n.length;i++)n[i].classList.contains("e-frozen-row")||n[i].classList.contains("e-frozen-column")||n[i].classList.contains("e-ss-overlay")||t.removeChild(n[i]);if(t.appendChild(d),t.style.backgroundColor="",l.conditionalFormats&&l.conditionalFormats.length&&o.parent.notify(kt,{indexes:r.indexes}),o.checkRowHeightChanged(r,l),r.top&&(e.parentElement.scrollTop=r.top),r.left&&(e.scrollLeft=r.left,o.parent.getColumnHeaderContent().scrollLeft=r.left),o.parent.notify(Zn,r),o.checkTableWidth(l),o.parent.notify(ei,{action:"renderEditor",initLoad:r.initLoad&&!o.parent.isOpen}),r.initLoad||o.parent.isOpen||o.parent.hideSpinner(),ud(e,{busy:!1}),o.parent.trigger(Fi,{}),o.parent.isEdit&&o.parent.notify(us,null),r.openOptions&&r.openOptions.eventArgs&&r.openOptions.eventArgs.triggerEvent&&o.parent.trigger("openComplete",{response:r.openOptions}),r.initLoad){var a=!0;if(o.parent.scrollSettings.enableVirtualization)for(i=0;i<l.ranges.length;i++)if(l.ranges[i].info.count-1>o.parent.viewport.bottomIndex){a=!1;break}a?o.parent.isReact?setTimeout((function(){o.parent&&o.triggerCreatedEvent()})):o.triggerCreatedEvent():o.parent.isOpen||o.parent.hideSpinner()}}}))},n.prototype.triggerCreatedEvent=function(){this.parent.isOpen||this.parent.hideSpinner(),this.parent.createdHandler&&(this.parent.createdHandler.observers?(this.parent.created.observers=this.parent.createdHandler.observers,this.parent.isAngular&&this.parent.createdHandler.currentObservers&&(this.parent.created.currentObservers=this.parent.createdHandler.currentObservers)):this.parent.setProperties({created:this.parent.createdHandler},!0),this.parent.createdHandler=void 0,this.parent.trigger(Ga,null),this.parent&&this.parent.notify(ba,null)),this.parent&&this.parent.notify(Ya,null)},n.prototype.checkRowHeightChanged=function(e,t){var r={top:e.top,left:e.left,sheet:t};this.parent.notify(eo,r),e.top!==r.top&&(this.parent.scrollModule&&this.parent.scrollModule.offset.top.idx&&r.top-e.top<fl(t,this.parent.scrollModule.offset.top.idx)&&(this.parent.scrollModule.offset.top.size=r.top),e.top=r.top),e.left!==r.left&&(this.parent.scrollModule&&this.parent.scrollModule.offset.left.idx&&r.left-e.left<Sl(t,this.parent.scrollModule.offset.left.idx)&&(this.parent.scrollModule.offset.left.size=r.left),e.left=r.left)},n.prototype.checkTableWidth=function(e){if(this.parent.scrollSettings.isFinite&&!this.parent.scrollSettings.enableVirtualization&&e.colCount-1===this.parent.viewport.rightIndex){var t=wl(e,this.parent.viewport.leftIndex+this.parent.frozenColCount(e),this.parent.viewport.rightIndex),r=this.getRowHeaderWidth(e),n=this.getScrollSize();t<this.contentPanel.getBoundingClientRect().width-r-n?(this.getContentPanel().style.width=t+"px",this.getColHeaderPanel().style.width=t+"px"):this.getContentPanel().style.width.includes("calc")||(this.getContentPanel().style.width="calc(100% - "+r+"px)",this.getColHeaderPanel().style.width="calc(100% - "+r+"px)")}},n.prototype.clearCFResult=function(e){e.conditionalFormats&&e.conditionalFormats.length&&e.conditionalFormats.forEach((function(e){delete e.result}))},n.prototype.refreshColumnContent=function(e){var r,n=this,i=0,a=this.parent.getActiveSheet(),s=document.createDocumentFragment(),o=document.createDocumentFragment(),l=this.parent.element.querySelector(".e-sheet-content tbody"),d=this.parent.element.querySelector(".e-column-header tbody"),h=this.parent.element.querySelector(".e-sheet-content colgroup");h=h.cloneNode(),s.appendChild(h),l=s.appendChild(l.cloneNode(!0));var p=h.cloneNode();o.appendChild(p);var c=this.parent.element.querySelector(".e-column-header thead"),u=(c=o.appendChild(c.cloneNode(!0))).querySelector("tr");u.innerText="";var f=this.parent.frozenRowCount(a),g=this.parent.frozenColCount(a);f&&(d=o.appendChild(d.cloneNode(!0)));var m=Dr(a,f-1,!1),v=this.parent.scrollSettings.enableVirtualization&&this.parent.viewport.topIndex!==Dr(a,0,!0);this.clearCFResult(a),e.cells.forEach((function(s,o){var c=t(o);if(c[0]===e.indexes[0]){var y=n.updateCol(a,c[1],p);h.appendChild(y.cloneNode()),n.cellRenderer.renderColHeader(c[1],u)}if(c[1]-g===e.indexes[1]){if(!(r=c[0]<f?d.children[i]:l.children[i]))return;r.innerText="",i++}if(r){var C=n.cellRenderer.render({colIdx:c[1],rowIdx:c[0],cell:s,address:o,row:r,pRow:r.previousSibling,first:e.skipUpdateOnFirst||c[1]!==e.indexes[1]?v&&c[0]===e.indexes[0]?"Row":"":"Column",isRefreshing:!0});n.checkColMerge(c,e.indexes,C,s,a),f&&c[0]===m&&(i=0)}}));var y=function(){var t=n.getColHeaderTable();Hl(t),t.appendChild(o),Hl(t=n.getContentTable()),t.appendChild(s),n.parent.notify(ui,{refresh:"Column",prevRowColCnt:e.prevRowColCnt}),a.conditionalFormats&&a.conditionalFormats.length&&n.parent.notify(kt,{indexes:e.indexes,isRender:!0}),n.parent.isEdit&&n.parent.notify(fs,{}),n.parent.allowChart&&n.parent.notify(As,null),n.parent.isOpen||n.parent.hideSpinner(),ud(n.parent.getMainContent(),{busy:!1})};e.insertDelete?y():Bl((function(){return y()}))},n.prototype.refreshRowContent=function(r){var n,i,a,s=this,o=this.colGroupWidth,l=this.parent.getActiveSheet(),d=document.createDocumentFragment(),h=document.createDocumentFragment(),p=this.parent.createElement("tbody"),c=p.cloneNode();h.appendChild(c),d.appendChild(p);var u=this.parent.frozenColCount(l),f=Dr(l,u-1,!1,"columns"),g=this.parent.scrollSettings.enableVirtualization&&this.parent.viewport.leftIndex!==Dr(l,0,!0,"columns");this.clearCFResult(l),r.cells.forEach((function(e,d){var h=t(d);h[1]!==r.indexes[1]&&n||(h[1]===r.indexes[1]&&(i=s.rowRenderer.render(h[0],!0)),u&&h[1]<u?(c.appendChild(i),n=i):(h[1]===r.indexes[1]&&c.appendChild(i),n=s.rowRenderer.render(h[0]),p.appendChild(n)),h[1]===r.indexes[1]&&(s.cellRenderer.renderRowHeader(h[0],i),o=Ul(h[0]+1))),u&&(i=c.lastElementChild||i),a=s.cellRenderer.render({rowIdx:h[0],colIdx:h[1],cell:e,address:d,lastCell:h[1]===r.indexes[3],row:n,hRow:i,pRow:n.previousSibling,pHRow:i.previousSibling,isHeightCheckNeeded:!0,first:r.skipUpdateOnFirst||h[0]!==r.indexes[0]?g&&h[1]===r.indexes[1]?"Column":"":"Row",isRefreshing:!0}),s.checkRowMerge(h,r.indexes,a,e,l),u&&h[1]===f&&(n=null)})),this.colGroupWidth!==o&&this.updateLeftColGroup(o);var m=this.contentPanel.querySelector(".e-row-header tbody");m&&((0,e.detach)(m),this.getRowHeaderTable().appendChild(h));var v=this.contentPanel.querySelector(".e-sheet-content tbody");v&&((0,e.detach)(v),this.getContentTable().appendChild(d)),this.parent.notify(ui,{refresh:"Row",prevRowColCnt:r.prevRowColCnt}),l.conditionalFormats&&l.conditionalFormats.length&&this.parent.notify(kt,{indexes:r.indexes,isRender:!0}),this.parent.allowChart&&this.parent.notify(As,{}),this.parent.isEdit&&this.parent.notify(fs,null),this.parent.isOpen||this.parent.hideSpinner(),ud(this.parent.getMainContent(),{busy:!1})},n.prototype.updateCol=function(t,r,n){var i=this.col.cloneNode();if(i.style.width=(0,e.formatUnit)(Sl(t,r,null,!0)),n){var a=n.querySelector(".e-empty");return a?n.insertBefore(i,a):n.appendChild(i)}return i},n.prototype.updateColContent=function(r){var n=this;Bl((function(){var i,a,s,o,l,d,h=0,p=n.parent.getActiveSheet(),c=n.parent.element.querySelector(".e-column-header .e-header-row"),u=n.parent.element.querySelector(".e-sheet-content colgroup"),f=n.parent.element.querySelector(".e-column-header colgroup"),g=c.firstElementChild,m=u.firstElementChild,v=f.firstElementChild,y=n.parent.element.querySelector(".e-sheet-content tbody"),C=n.parent.element.querySelector(".e-column-header tbody"),b=n.parent.frozenRowCount(p),x=n.parent.frozenColCount(p),S=Dr(p,b-1,!1),w=Dr(p,r.indexes[0],!0);n.clearCFResult(p),r.cells.forEach((function(I,E){if(!l){var N=t(E);if("first"===r.direction&&N[1]===r.indexes[1]&&n.checkColMerge([N[0],n.parent.viewport.leftIndex+x],r.indexes,((N[0]<b?C:y).rows[h]||{cells:[]}).cells[r.indexes[3]-r.indexes[1]+1],Ln(N[0],n.parent.viewport.leftIndex+x,p)||{},p),N[0]===w&&("last"===r.direction?((o=n.col.cloneNode()).style.width=(0,e.formatUnit)(Sl(p,N[1],null,!0)),u.insertBefore(o,m),f.insertBefore(o.cloneNode(),v),n.cellRenderer.renderColHeader(N[1],c,g)):(o=n.updateCol(p,N[1],u),f.appendChild(o.cloneNode()),n.cellRenderer.renderColHeader(N[1],c)),n.parent.scrollSettings.enableVirtualization&&r.direction&&((0,e.detach)(u[r.direction+"ElementChild"]),(0,e.detach)(f[r.direction+"ElementChild"]),(0,e.detach)(c[r.direction+"ElementChild"]))),N[1]===r.indexes[1]){if(N[0]<b)i=C.children[h];else if(!(i=y.children[h]))return void(l=!0);h++,a=i.firstElementChild}d={colIdx:N[1],rowIdx:N[0],cell:I,address:E,row:i,lastCell:N[1]===r.indexes[3],isHeightCheckNeeded:"first"===r.direction,first:"last"!==r.direction||r.skipUpdateOnFirst||N[1]!==r.indexes[1]?"":"Column",checkNextBorder:"last"===r.direction&&N[3]===r.indexes[3]?"Column":"",isRefreshing:"first"===r.direction},"last"===r.direction?(d.refChild=a,s=n.cellRenderer.render(d),n.checkColMerge(N,r.indexes,s,I,p,((N[0]<b?C:y).rows[h-1]||{cells:[]}).cells[1])):s=n.cellRenderer.render(d),n.parent.scrollSettings.enableVirtualization&&r.direction&&(0,e.detach)(i[r.direction+"ElementChild"]),b&&N[0]===S&&(h=0)}})),n.parent.notify(ui,{refresh:"Column",prevRowColCnt:r.prevRowColCnt}),p.conditionalFormats&&p.conditionalFormats.length&&n.parent.notify(kt,{indexes:r.indexes,isRender:!0}),n.parent.allowChart&&n.parent.notify(As,null),n.parent.isEdit&&n.parent.notify(fs,{}),n.parent.isOpen||n.parent.hideSpinner(),ud(n.parent.getMainContent(),{busy:!1})}))},n.prototype.updateRowContent=function(r){var n=this,i=this.parent.getMainContent();if(""!==r.direction||i.children.length){var a,s,o,l,d=0,h=this.colGroupWidth,p=this.parent.getActiveSheet(),c=i.querySelector("tbody"),u=this.parent.getRowHeaderContent().querySelector("tbody"),f=document.createDocumentFragment(),g=document.createDocumentFragment();this.parent.showSpinner();var m=this.parent.frozenColCount(p),v=this.parent.frozenRowCount(p),y=Dr(p,r.indexes[1],!0,"columns"),C=Dr(p,m-1,!1,"columns");this.clearCFResult(p),r.cells.forEach((function(i,b){var x=t(b);"first"===r.direction&&x[0]===r.indexes[0]&&(void 0===l&&(l=(x[1]<m?u:c).rows[r.indexes[2]-r.indexes[0]+1]||null),n.checkRowMerge([n.parent.viewport.topIndex+v,x[1]],r.indexes,(l||{cells:[]}).cells[x[1]<m?d+1:d],Ln(n.parent.viewport.topIndex+v,x[1],p)||{},p)),x[1]!==y&&a||(x[1]===y&&(s=n.rowRenderer.render(x[0],!0)),m&&x[1]<m?(f.appendChild(s),a=s):(a=n.rowRenderer.render(x[0]),g.appendChild(a),x[1]===y&&f.appendChild(s),n.parent.scrollSettings.enableVirtualization&&r.direction&&(0,e.detach)(c[r.direction+"ElementChild"])),x[1]===y&&(n.cellRenderer.renderRowHeader(x[0],s),h=Ul(x[0]+1),n.parent.scrollSettings.enableVirtualization&&r.direction&&(0,e.detach)(u[r.direction+"ElementChild"]))),m&&(s=f.lastElementChild||s),o=n.cellRenderer.render({colIdx:x[1],rowIdx:x[2],cell:i,address:b,row:a,lastCell:x[1]===r.indexes[3],pHRow:s.previousSibling,checkNextBorder:"last"===r.direction&&x[2]===r.indexes[2]?"Row":"",pRow:a.previousSibling,isHeightCheckNeeded:"first"===r.direction||""===r.direction,hRow:s,first:"last"!==r.direction||r.skipUpdateOnFirst||x[0]!==r.indexes[0]?"":"Row",isRefreshing:"first"===r.direction}),"last"===r.direction&&c.rows.length&&n.checkRowMerge(x,r.indexes,o,i,p,(x[1]<m?u:c).rows[0].cells[x[1]<m?d+1:d]),d++,m&&x[1]===C&&(a=null,l=void 0,d=0)})),this.colGroupWidth!==h&&this.updateLeftColGroup(h),"last"===r.direction?(u.insertBefore(f,u.firstElementChild),c.insertBefore(g,c.firstElementChild)):(u.appendChild(f),c.appendChild(g)),this.parent.scrollSettings.enableVirtualization&&this.parent.notify(ui,{refresh:"Row",prevRowColCnt:r.prevRowColCnt}),p.conditionalFormats&&p.conditionalFormats.length&&this.parent.notify(kt,{indexes:r.indexes,isRender:!0}),this.parent.isEdit&&this.parent.notify(fs,null),this.parent.allowChart&&this.parent.notify(As,{}),this.parent.isOpen||this.parent.hideSpinner(),ud(this.parent.getMainContent(),{busy:!1})}},n.prototype.checkRowMerge=function(t,r,n,i,a,s){if(this.parent.scrollSettings.enableVirtualization&&n&&(!(0,e.isNullOrUndefined)(i.rowSpan)||!(0,e.isNullOrUndefined)(i.colSpan))){var o=this.parent.frozenRowCount(a),l=this.parent.viewport.topIndex+o;if(t[0]===l){if(i.rowSpan<0){var d={td:n,rowIdx:t[0],colIdx:t[1],isRow:!0,isFreezePane:!0};if(this.parent.notify(ts,d),d.insideFreezePane)return;l>=r[2]&&this.refreshPrevMerge(r[2]+1,t[1])}s&&this.refreshFirstCell(t[0]+(r[2]-r[0])+1,t[1],a,s)}else if(i.rowSpan>1){var h=r[2]+1;t[0]+i.rowSpan-1>=h&&t[0]<h&&this.refreshPrevMerge(h,t[1],l)}}},n.prototype.refreshPrevMerge=function(e,t,r){var n=this.parent.getCell(e,t,this.parent.getRow(r||0,null,t));n&&this.cellRenderer.refresh(e,t,null,n)},n.prototype.refreshFirstCell=function(e,t,r,n){var i=Ln(e,t,r,!1,!0);(i.rowSpan<0||i.colSpan<0)&&this.cellRenderer.refresh(e,t,null,n)},n.prototype.checkColMerge=function(t,r,n,i,a,s){if(this.parent.scrollSettings.enableVirtualization&&n&&(!(0,e.isNullOrUndefined)(i.rowSpan)||!(0,e.isNullOrUndefined)(i.colSpan))){var o=this.parent.frozenColCount(a),l=this.parent.viewport.leftIndex+o;if(t[1]===l){if(i.colSpan<0){var d={td:n,colIdx:t[1],rowIdx:t[0],isFreezePane:!0};if(this.parent.notify(ts,d),d.insideFreezePane)return;if(l>=r[3])(h=this.parent.getCell(t[0],t[3]+1,this.parent.getRow(t[0],null,t[3]+1)))&&this.cellRenderer.refresh(t[0],r[3]+1,null,h)}s&&this.refreshFirstCell(t[0],t[1]+(r[3]-r[1])+1,a,s)}else if(i.colSpan>1){var h;if(t[1]+i.colSpan-1>=r[3]+1&&t[1]<r[3]+1)(h=this.parent.getCell(t[0],t[3]+1,this.parent.getRow(t[0],null,t[3]+1)))&&this.cellRenderer.refresh(t[0],r[3]+1,null,h)}}},n.prototype.toggleGridlines=function(){var e=document.getElementById(this.parent.element.id+"_sheet");this.parent.getActiveSheet().showGridLines?e.classList.remove("e-hide-gridlines"):e.classList.add("e-hide-gridlines")},n.prototype.showHideHeaders=function(){var e=this,t=this.parent.getActiveSheet();Bl((function(){if(t.showHeaders){var r=e.getContentPanel();e.setPanelWidth(t,e.getRowHeaderPanel()),e.setPanelHeight(t),document.getElementById(e.parent.element.id+"_sheet").classList.remove("e-hide-headers"),e.getColHeaderPanel().scrollLeft=r.scrollLeft,e.parent.selectRange(t.selectedRange)}else e.updateHideHeaders(t,document.getElementById(e.parent.element.id+"_sheet")),e.setPanelHeight(t),e.parent.frozenColCount(t)||e.parent.frozenRowCount(t)?(e.setPanelWidth(t,e.getRowHeaderPanel()),e.parent.selectRange(t.selectedRange)):(e.getContentPanel().style.width="",e.getContentPanel().style[e.parent.enableRtl?"right":"left"]=""),e.getScrollElement().style.left=e.getRowHeaderWidth(t)+"px"}))},n.prototype.updateHideHeaders=function(e,t){e.showHeaders||t.classList.add("e-hide-headers")},n.prototype.rowHeightChanged=function(e){if(e.threshold||e.isHideShow){var t=this.parent.getActiveSheet();e.rowIdx<this.parent.frozenRowCount(t)&&this.setPanelHeight(t)}},n.prototype.colWidthChanged=function(e){if(e.threshold||e.isHideShow){var t=this.parent.getActiveSheet();e.colIdx<this.parent.frozenColCount(t)&&this.setPanelWidth(t,this.getRowHeaderPanel()),this.checkTableWidth(t)}},n.prototype.getRowHeaderWidth=function(e,t,n){var i=0,a=n?this.parent.viewport.scaleX:1;if(!t&&e.frozenColumns){var s=r(e.topLeftCell)[1];i=wl(e,s,s+e.frozenColumns-1,!0)/a}return i+=e.showHeaders?pd(this.colGroupWidth)/a:0},n.prototype.getColHeaderHeight=function(e,t){var n=r(e.topLeftCell)[0];return(e.showHeaders&&!t?pd(31):0)+ml(e,n,n+e.frozenRows-1,!0)},n.prototype.getSelectAllContent=function(){return this.headerPanel.getElementsByClassName("e-selectall-container")[0]},n.prototype.getScrollElement=function(){var e;return this.contentPanel&&(e=this.contentPanel.parentElement||this.contentPanel.nextElementSibling),e&&e.querySelector(".e-scroller")},n.prototype.getSelectAllTable=function(){return this.headerPanel.getElementsByClassName("e-selectall-table")[0]},n.prototype.getColHeaderTable=function(){return this.headerPanel.getElementsByClassName("e-colhdr-table")[0]},n.prototype.getRowHeaderTable=function(){return this.contentPanel.getElementsByClassName("e-rowhdr-table")[0]},n.prototype.getContentTable=function(){return this.contentPanel.getElementsByClassName("e-content-table")[0]},n.prototype.getRowHeaderPanel=function(){return this.contentPanel.getElementsByClassName("e-row-header")[0]},n.prototype.getColHeaderPanel=function(){return this.headerPanel.getElementsByClassName("e-column-header")[0]},n.prototype.getContentPanel=function(){return this.contentPanel.getElementsByClassName("e-sheet-content")[0]},n.prototype.addEventListener=function(){this.parent.on(Ga,this.triggerCreatedEvent,this),this.parent.on(Wi,this.rowHeightChanged,this),this.parent.on(Gi,this.colWidthChanged,this),this.parent.on(Qn,this.removeEventListener,this)},n.prototype.destroy=function(){this.headerPanel&&(Hl(this.headerPanel),this.headerPanel.remove()),this.headerPanel=null,this.contentPanel&&(Hl(this.contentPanel),this.contentPanel.remove()),this.contentPanel=null,this.col&&(Hl(this.col),this.col.remove()),this.col=null,this.rowRenderer=null,this.cellRenderer=null,this.colGroupWidth=null,this.parent=null},n.prototype.removeEventListener=function(){this.parent.off(Ga,this.triggerCreatedEvent),this.parent.off(Wi,this.rowHeightChanged),this.parent.off(Gi,this.colWidthChanged),this.parent.off(Qn,this.removeEventListener)},n}(),$d=function(){function t(e){this.parent=e,this.element=this.parent.createElement("tr"),this.cellRenderer=e.serviceLocator.getService("cell"),this.parent.on(Xi,this.initProps,this)}return t.prototype.render=function(t,r,n){var i=this.element.cloneNode(),a=this.parent.getActiveSheet();if(void 0===t)return i.classList.add("e-header-row"),i;if(i.classList.add("e-row"),!this.bottomBorderWidth){var s=1;if(window.devicePixelRatio%1>0){var o=1*window.devicePixelRatio%1;s=1+(o?(o>.5?1-o:-1*o)/window.devicePixelRatio:0)}this.bottomBorderWidth=s}var l=fl(a,t,!0),d=fl(a,t),h={height:l+"px",lineHeight:d<20?l>this.bottomBorderWidth?l-this.bottomBorderWidth+"px":"0px":""};if(Object.assign(i.style,h),(0,e.attributes)(i,{"aria-rowindex":(t+1).toString()}),r&&!n){if(d<20){s=this.bottomBorderWidth-1+4;i.style.lineHeight=l>=s?l-s+"px":l>this.bottomBorderWidth?l-this.bottomBorderWidth+"px":"0px",i.classList.contains("e-reach-fntsize")||i.classList.add("e-reach-fntsize")}cl(a,t+1)&&!cl(a,t-1)&&i.classList.add("e-hide-start"),0!==t&&cl(a,t-1)&&!cl(a,t+1)&&i.classList.add("e-hide-end")}return i},t.prototype.refresh=function(e,t,n,a,s){var o,l=this,d=this.parent.getActiveSheet();if(a)o=this.render(e,a,s),this.cellRenderer.renderRowHeader(e,o);else{var h,p,c=function(){for(;h<=p;)Il(d,h)||l.cellRenderer.render({colIdx:h,rowIdx:e,cell:Ln(e,h,d),address:i(e,h),lastCell:h===p,row:o,hRow:n,isHeightCheckNeeded:!0,pRow:t,first:e===l.parent.viewport.topIndex&&Dr(d,e,!0)!==Dr(d,0,!0)?"Row":"",skipFormatCheck:Yr(l.parent),checkCF:!0}),h++},u=this.parent.frozenColCount(d);u&&(o=n,h=r(d.topLeftCell)[0],p=u-1,c()),o=this.render(e,a,s),h=this.parent.viewport.leftIndex+u,p=this.parent.viewport.rightIndex,c()}return o},t.prototype.initProps=function(){this.bottomBorderWidth=null},t.prototype.destroy=function(){this.parent.off(Xi,this.initProps),this.element&&this.element.remove(),this.bottomBorderWidth&&(this.bottomBorderWidth=null),this.parent=null,this.element=null},t}(),Zd=function(){function n(e){this.parent=e,this.element=this.parent.createElement("td"),this.th=this.parent.createElement("th",{className:"e-header-cell"}),this.tableRow=e.createElement("tr",{className:"e-row"}),this.parent.on(tr,this.updateView,this),this.parent.on(ne,this.calculateFormula,this)}return n.prototype.renderColHeader=function(t,r,n){var i=this.th.cloneNode(),a=s(t+1);i.innerText=a;var o=this.parent.getActiveSheet();Il(o,t+1)&&i.classList.add("e-hide-start"),0!==t&&Il(o,t-1)&&i.classList.add("e-hide-end"),n?r.insertBefore(i,n):r.appendChild(i),this.parent.trigger("beforeCellRender",{cell:null,element:i,address:a,colIndex:t}),this.parent.notify(Sa,{td:i,rowIndex:0,colIndex:t}),(0,e.attributes)(i,{"aria-colindex":(t+1).toString(),tabindex:"-1"})},n.prototype.renderRowHeader=function(t,r,n){var i=this.element.cloneNode();(0,e.addClass)([i],"e-header-cell"),(0,e.attributes)(i,{role:"rowheader",tabindex:"-1"}),i.innerText=(t+1).toString(),n?r.insertBefore(i,n):r.appendChild(i),this.parent.trigger("beforeCellRender",{cell:null,element:i,address:""+(t+1),rowIndex:t})},n.prototype.render=function(t){var r=this.parent.getActiveSheet();if(t.td=this.element.cloneNode(),t.td.className="e-cell",(0,e.attributes)(t.td,{"aria-colindex":(t.colIdx+1).toString(),tabindex:"-1"}),this.checkMerged(t))return this.createImageAndChart(t),t.refChild?t.row.insertBefore(t.td,t.refChild):t.row.appendChild(t.td),t.td;t.isRefresh=!1,t.skipFormatCheck=Yr(this.parent);var n=this.update(t);t.checkCF&&t.cell&&r.conditionalFormats&&r.conditionalFormats.length&&this.parent.notify(kt,{indexes:[t.rowIdx,t.colIdx],cell:t.cell,ele:t.td,isRender:!0}),t.td.classList.contains("e-cell-template")||this.parent.notify(Sa,{td:t.td,rowIndex:t.rowIdx,colIndex:t.colIdx}),t.refChild?t.row.insertBefore(t.td,t.refChild):t.row.appendChild(t.td);var i={cell:t.cell,element:t.td,address:t.address,rowIndex:t.rowIdx,colIndex:t.colIdx,needHeightCheck:!1,row:t.row};if(this.parent.trigger("beforeCellRender",i),!r.rows[t.rowIdx]||!r.rows[t.rowIdx].customHeight){if(i.needHeightCheck||n&&i.element&&i.element.children.length){var a=i.element.cloneNode(!0);a.style.width=Sl(r,t.colIdx,!0)+"px",this.tableRow.appendChild(a)}if(t.lastCell&&this.tableRow.childElementCount){var s=this.getRowHeightOnInit();s>fl(r,t.rowIdx)&&xd(this.parent,r,s,t.rowIdx,t.row,t.hRow),this.tableRow.innerText=""}}return this.setWrapByValue(r,t),i.element},n.prototype.setWrapByValue=function(t,r){r.cell&&(0,e.isNullOrUndefined)(r.cell.wrap)&&r.cell.value&&r.cell.value.toString().includes("\n")&&(Pn(r.rowIdx,r.colIdx,t,{wrap:!0},!0),this.parent.notify(Ge,{range:[r.rowIdx,r.colIdx,r.rowIdx,r.colIdx],wrap:!0,initial:!0,sheet:t,td:r.td,row:r.row,hRow:r.hRow}))},n.prototype.update=function(t){var r,n=this.parent.getActiveSheet();if(!t.isRefresh||t.cell&&t.cell.template){var i=this.processTemplates(t.cell,t.rowIdx,t.colIdx);i&&("string"==typeof i?t.td.innerHTML=i:(Hl(t.td),(0,e.append)(i,t.td)),t.td.classList.add("e-cell-template"),r=!0)}if(t.isRefresh){if(t.td.rowSpan&&(this.mergeFreezeRow(n,t.rowIdx,t.colIdx,t.td.rowSpan,t.row,!0),t.td.removeAttribute("rowSpan")),t.td.colSpan&&(this.mergeFreezeCol(n,t.rowIdx,t.colIdx,t.td.colSpan,!0),t.td.removeAttribute("colSpan")),this.checkMerged(t))return!1;if(t.cell&&!t.cell.hyperlink){var a=t.td.querySelector(".e-hyperlink");a&&(0,e.detach)(a)}if(t.cell&&t.td.children.length>0&&t.td.children[t.td.childElementCount-1].className.indexOf("e-addNoteIndicator")>-1){var s=t.td.querySelector(".e-addNoteIndicator");s&&(0,e.detach)(s)}t.cell&&this.parent.allowWrap||!t.td.classList.contains("e-wraptext")||t.td.classList.remove("e-wraptext")}t.cell&&t.cell.formula&&!t.isRandomFormula&&"Automatic"===this.parent.calculationMode&&(this.calculateFormula(t),t.fillType&&"FillWithoutFormatting"===t.fillType&&delete t.cell.format);var o={value:t.cell&&t.cell.value,type:t.cell&&Bo(t.cell.format),format:t.cell&&t.cell.format,formattedText:t.cell&&t.cell.value,isRightAlign:!1,cell:t.cell,rowIndex:t.rowIdx,colIndex:t.colIdx,td:t.td,skipFormatCheck:t.skipFormatCheck,refresh:!0};"Manual"===this.parent.calculationMode&&t.cell&&!t.cell.value&&""!==t.cell.value&&t.cell.formula&&(o.value=0,t.cell.value="0"),t.cell&&this.parent.notify(re,o),this.parent.refreshNode(t.td,o);var l={};if(t.cell){if(t.cell.style&&(l=t.cell.style.properties?Mn(t.cell.style,!0):t.cell.style),void 0!==o.color&&(l.color=o.color),this.createImageAndChart(t),t.cell.hyperlink&&("FillFormattingOnly"===t.fillType?(t.td.style.textDecoration="underline",t.td.style.color="#00e"):this.parent.notify(ua,{cell:t.cell,style:l,td:t.td,rowIdx:t.rowIdx,colIdx:t.colIdx,fillType:t.fillType})),t.cell.rowSpan>1){var d=t.rowSpan||t.cell.rowSpan-this.parent.hiddenCount(t.rowIdx,t.rowIdx+(t.cell.rowSpan-1));d>1&&(t.td.rowSpan=d,this.mergeFreezeRow(n,t.rowIdx,t.colIdx,d,t.row))}if(t.cell.colSpan>1){var h=t.colSpan||t.cell.colSpan-this.parent.hiddenCount(t.colIdx,t.colIdx+(t.cell.colSpan-1),"columns");h>1&&(t.td.colSpan=h,this.mergeFreezeCol(n,t.rowIdx,t.colIdx,h))}(0,e.isNullOrUndefined)(t.cell.notes)?!(0,e.isNullOrUndefined)(t.td)&&t.td.children.length>0&&t.td.children[t.td.childElementCount-1].className.indexOf("e-addNoteIndicator")>-1&&this.parent.notify(oa,{rowIndex:t.rowIdx,columnIndex:t.colIdx}):this.parent.notify(da,{targetElement:t.td,rowIndex:t.rowIdx,columnIndex:t.colIdx}),t.cell.isNoteEditable&&this.parent.notify(la,{rowIndex:t.rowIdx,columnIndex:t.colIdx,isNoteEditable:!0,isScrollWithNote:!0,cellElement:t.td})}if(t.isRefresh&&(0,e.isNullOrUndefined)(t.cell)&&!(0,e.isNullOrUndefined)(t.td)&&t.td.children.length>0&&t.td.children[t.td.childElementCount-1].className.indexOf("e-addNoteIndicator")>-1&&this.parent.notify(oa,{rowIndex:t.rowIdx,columnIndex:t.colIdx}),t.isRefresh&&this.removeStyle(t.td,t.rowIdx,t.colIdx),t.lastCell&&this.parent.chartColl&&this.parent.chartColl.length&&this.parent.notify(Bt,{cell:t.cell,rIdx:t.rowIdx,cIdx:t.colIdx,sheetIdx:this.parent.activeSheetIndex}),this.applyStyle(t,l),"Row"===t.checkNextBorder){var p=this.parent.getCellStyleValue(["borderTop"],[Number(this.parent.getContentTable().rows[0].getAttribute("aria-rowindex"))-1,t.colIdx]).borderTop;""===p||t.cell&&t.cell.style&&t.cell.style.bottomPriority||(t.style={borderBottom:p},this.parent.notify(le,t))}if("Column"===t.checkNextBorder){var c=this.parent.getCellStyleValue(["borderLeft"],[t.rowIdx,t.colIdx+1]).borderLeft;""===c||t.cell&&t.cell.style&&(t.cell.style.borderRight||t.cell.style.border)||(t.style={borderRight:c},this.parent.notify(le,t))}t.cell&&!(0,e.isNullOrUndefined)(t.cell.wrap)&&this.parent.notify(Ge,{range:[t.rowIdx,t.colIdx,t.rowIdx,t.colIdx],wrap:t.cell.wrap,sheet:n,initial:!0,td:t.td,row:t.row,hRow:t.hRow,isCustomHgt:!t.isRefresh&&fl(n,t.rowIdx)>(n&&n.standardHeight?n.standardHeight:20)});var u=t.cell&&t.cell.validation||n.columns&&n.columns[t.colIdx]&&n.columns[t.colIdx].validation;if(u&&(!u.address||Rr(u.address,t.rowIdx,t.colIdx))){if(u.isHighlighted){var f=this.parent.activeSheetIndex;if(u&&this.parent.allowDataValidation){var g={value:t.cell&&(t.cell.value||0===t.cell.value)?t.cell.value:"",range:[t.rowIdx,t.colIdx],sheetIdx:f,td:t.td,isValid:!0};this.parent.notify(Je,g),g.isValid||cl(n,t.rowIdx)||f!==this.parent.activeSheetIndex||this.parent.notify(jt,{isRemoveHighlightedData:!1,rowIdx:t.rowIdx,colIdx:t.colIdx,td:t.td})}}"List"!==u.type||t.isRefresh||t.address!==n.activeCell||(t.validation=u,this.parent.notify(vr,t))}return r},n.prototype.applyStyle=function(t,r){(Object.keys(r).length||Object.keys(this.parent.commonCellStyle).length||t.lastCell)&&(t.style=(0,e.extend)({},this.parent.commonCellStyle,r),this.parent.notify(le,t))},n.prototype.createImageAndChart=function(e){if(e.cell.chart&&e.cell.chart.length>0&&this.parent.notify(Lt,{chart:e.cell.chart,isInitCell:!0,range:i(e.rowIdx,e.colIdx),isUndoRedo:!1}),e.cell.image&&e.cell.image.length>0)for(var t=0;t<e.cell.image.length;t++)e.cell.image[t]&&this.parent.notify(bs,{options:{src:e.cell.image[t].src,id:e.cell.image[t].id,height:e.cell.image[t].height,width:e.cell.image[t].width,top:e.cell.image[t].top,left:e.cell.image[t].left},range:a([e.rowIdx,e.colIdx,e.rowIdx,e.colIdx]),isPublic:!1})},n.prototype.calculateFormula=function(t){if(void 0!==t.cell.value&&null!==t.cell.value){var r={action:"checkFormulaAdded",added:!0,address:t.address,sheetId:(void 0===t.sheetIndex?this.parent.getActiveSheet():In(this.parent,t.sheetIndex)).id.toString()};if(this.parent.notify(pe,r),r.added)return}else t.formulaRefresh&&(t.cell.value="");var n=xr(t.cell.formula),i={action:"refreshCalculate",value:t.cell.formula,rowIndex:t.rowIdx,colIndex:t.colIdx,isFormula:n,sheetIndex:t.sheetIndex,isRefreshing:t.isRefreshing,isDependentRefresh:t.isDependentRefresh,isRandomFormula:t.isRandomFormula,fillType:t.fillType};("Automatic"===this.parent.calculationMode||t.isSortAction||"calculate"===t.action||t.isDependentRefresh)&&this.parent.notify(pe,i),(void 0===t.cell.value&&"Manual"===this.parent.calculationMode&&!this.parent.getActiveSheet().isSheetCalculated||this.parent.isEdit&&"#CIRCULARREF!"===t.cell.value)&&(t.cell.value="0"),t.cell.value=Ln(t.rowIdx,t.colIdx,(0,e.isNullOrUndefined)(t.sheetIndex)?this.parent.getActiveSheet():In(this.parent,t.sheetIndex)).value,n&&(t.cell.formula.indexOf("^+")>-1||t.cell.formula.indexOf("&+")>-1)&&(t.cell.formula=i.value)},n.prototype.checkMerged=function(e){if(e.cell&&(e.cell.colSpan<0||e.cell.rowSpan<0)){var t=this.parent.getActiveSheet();if(t.frozenRows||t.frozenColumns){var r={range:[e.rowIdx,e.colIdx,e.rowIdx,e.colIdx]};this.parent.notify(Et,r);var n=this.parent.frozenRowCount(t),i=this.parent.frozenColCount(t);r.range=r.range,(t.frozenRows&&t.frozenColumns?r.range[0]<n&&r.range[1]<i?e.rowIdx<n&&e.colIdx<i:r.range[0]<n?e.rowIdx<n:!(r.range[1]<i)||e.colIdx<i:n?r.range[0]>=n||e.rowIdx<n:r.range[1]>=i||e.colIdx<i)&&(e.td.style.display="none")}else e.td.style.display="none";e.isMerged=!0;var a=e.cell.rowSpan,s=e.cell.colSpan;return(s<0||a<0)&&(this.parent.notify(es,e),s<0&&e.cell.style&&e.cell.style.borderTop&&this.applyStyle(e,{borderTop:e.cell.style.borderTop}),a<0&&e.cell.style&&e.cell.style.borderLeft&&this.applyStyle(e,{borderLeft:e.cell.style.borderLeft})),e.isMerged}return!1},n.prototype.mergeFreezeRow=function(t,n,i,a,s,o){var l=this.parent.frozenRowCount(t);if(l&&n<l&&n+(a-1)>=l){var d=void 0,h=0,p=void 0,c=this.parent.frozenColCount(t),u=s||this.parent.getRow(n,null,i),f=[].slice.call(u.parentElement.querySelectorAll(".e-empty"));if(o){var g=n+a-l;if(g<f.length)return;var m=0;if(g===f.length){var v=void 0,y=void 0,C=void 0;for(c&&i<c?(y=r(t.topLeftCell)[1],C=c):(y=this.parent.viewport.leftIndex+c,C=this.parent.viewport.rightIndex);y<C;y++)y!==i&&(v=Ln(n,y,t,!1,!0)).rowSpan&&n+v.rowSpan-l>m&&(m=n+v.rowSpan-l);if(m===g)return}else m=g;var b=n+(a-1);for(y=m,C=f.length;y<C;y++)h+=fl(t,b),b--,(0,e.detach)(f.pop());return this.updateSpanTop(i,c,h,!0),void(f.length||this.updateColZIndex(i,c,!0))}this.updateColZIndex(i,c);for(y=l,C=n+(a-1);y<=C;y++)h+=-(p=fl(t,Dr(t,y,!0),!0)),l+f.length>y||((d=u.cloneNode()).classList.add("e-empty"),d.style.visibility="hidden",d.style.height=p+"px",u.parentElement.appendChild(d));this.updateSpanTop(i,c,h)}},n.prototype.updateSpanTop=function(e,t,r,n){var i=this.parent.serviceLocator.getService("sheet").contentPanel;if(n){if(!parseInt(i.style.top,10))return;r=parseInt(i.style.top,10)+r}if(t&&e<t&&(n||!parseInt(i.style.top,10)||r<parseInt(i.style.top,10))){i.style.top=r+"px";var a=i.nextElementSibling;a&&(a.style.top=r+"px")}},n.prototype.mergeFreezeCol=function(t,n,i,a,s){var o=this.parent.frozenColCount(t);if(o&&i<o&&i+(a-1)>=o){var l=void 0,d=void 0,h=this.parent.frozenRowCount(t),p=(n<h?this.parent.getSelectAllContent():this.parent.getRowHeaderContent()).querySelector("colgroup"),c=[].slice.call(p.querySelectorAll(".e-empty"));if(s){var u=i+a-o;if(u<c.length)return;var f=0;if(u===c.length){var g=void 0,m=void 0,v=void 0;for(h&&n<o?(m=h,v=r(t.topLeftCell)[0]):(m=this.parent.viewport.bottomIndex,v=this.parent.viewport.topIndex+h);v<m;v++)v!==n&&(g=Ln(v,i,t,!1,!0)).colSpan&&i+g.colSpan-o>f&&(f=i+g.colSpan-o);if(f===u)return}else f=u;for(v=f,m=c.length;v<m;v++)(0,e.detach)(c.pop());return this.parent.serviceLocator.getService("sheet").setPanelWidth(t,this.parent.getRowHeaderContent()),void(c.length||this.updateRowZIndex(n,h,!0))}this.updateRowZIndex(n,h);for(v=o,m=i+(a-1);v<=m;v++)o+c.length>v||((l=p.childNodes[0].cloneNode()).classList.add("e-empty"),l.style.visibility="hidden",d=Sl(t,Dr(t,v,!0,"columns"),null,!0),l.style.width=d+"px",p.appendChild(l),v===m&&this.parent.serviceLocator.getService("sheet").setPanelWidth(t,this.parent.getRowHeaderContent()))}},n.prototype.updateColZIndex=function(e,t,r){e<t?this.updateSelectAllZIndex(r):(this.parent.getColumnHeaderContent().style.zIndex=r?"":"2",this.updatedHeaderZIndex(r))},n.prototype.updateSelectAllZIndex=function(e){var t=this.parent.element.querySelector(".e-frozen-row"),r=this.parent.element.querySelector(".e-frozen-column");e?(this.parent.getSelectAllContent().style.zIndex="",t&&(t.style.zIndex=""),r&&(r.style.zIndex="")):this.parent.getRowHeaderContent().style.zIndex||this.parent.getColumnHeaderContent().style.zIndex?(this.parent.getSelectAllContent().style.zIndex="3",t&&(t.style.zIndex="4"),r&&(r.style.zIndex="4")):this.parent.getSelectAllContent().style.zIndex="2"},n.prototype.updatedHeaderZIndex=function(e){if(!e&&"2"===this.parent.getSelectAllContent().style.zIndex){this.parent.getSelectAllContent().style.zIndex="3";var t=this.parent.element.querySelector(".e-frozen-row"),r=this.parent.element.querySelector(".e-frozen-column");r&&(r.style.zIndex="4"),t&&(t.style.zIndex="4")}},n.prototype.updateRowZIndex=function(e,t,r){e<t?this.updateSelectAllZIndex(r):(this.parent.getRowHeaderContent().style.zIndex=r?"":"2",this.updatedHeaderZIndex(r))},n.prototype.processTemplates=function(e,r,n){for(var i,a=this.parent.getActiveSheet(),s=a.ranges,o=0,l=s.length;o<l;o++)if(s[o].template&&(i=t(s[o].address.length?s[o].address:s[o].startCell))[0]<=r&&i[1]<=n&&i[2]>=r&&i[3]>=n){if(e)return this.compileCellTemplate(s[o].template,Object.assign({rowIndex:r,colIndex:n},e));if(!Ln(r,n,a,!0))return this.compileCellTemplate(s[o].template,Object.assign({rowIndex:r,colIndex:n},Ln(r,n,a,null,!0)))}return""},n.prototype.compileCellTemplate=function(t,r){var n;if("string"==typeof t){var i=void 0;return i=0===t.trim().indexOf("#")?document.querySelector(t).innerHTML.trim():t,n=(0,e.compile)(i),!this.parent.isVue||this.isSelector(t)?n(r,this.parent,"ranges","",!0)[0].outerHTML:n(r,this.parent,"ranges","")}var a=(n=(0,e.compile)(t))(r,this.parent,"ranges","");return a[0]?a:[a]},n.prototype.isSelector=function(e){try{return!!document.querySelector(e)}catch(e){return!1}},n.prototype.getRowHeightOnInit=function(){var e=this.parent.createElement("table",{className:"e-table e-test-table"});e.appendChild(this.parent.createElement("tbody")).appendChild(this.tableRow),this.parent.element.appendChild(e);var t=this.tableRow.getBoundingClientRect().height;return this.parent.element.removeChild(e),t<20?20:t},n.prototype.removeStyle=function(e,t,r){var n;if(e.style.length){var i=(n=this.parent.getCellStyleValue(["borderLeft","border"],[t,r+1])).borderLeft||n.border,a=(n=this.parent.getCellStyleValue(["borderTop","border"],[t+1,r])).borderTop||n.border;i||a?[].slice.call(e.style).forEach((function(t){i&&a?t.includes("border-right")||t.includes("border-bottom")||e.style.removeProperty(t):(!i||t.indexOf("border-right")>-1||a&&"none"!==a)&&(!a||t.indexOf("border-bottom")>-1||i&&"none"!==i)||e.style.removeProperty(t)})):e.removeAttribute("style")}var s=this.parent.getCell(t-1,r);if(s&&s.style.borderBottom){var o=Number(s.parentElement.getAttribute("aria-rowindex"))-1;(n=this.parent.getCellStyleValue(["borderBottom","border"],[o,r])).borderBottom||n.border||(s.style.borderBottom="")}var l=e.previousElementSibling;l&&l.style.borderRight&&(r=Number(l.getAttribute("aria-colindex"))-1,(n=this.parent.getCellStyleValue(["borderRight","border"],[t,r])).borderRight||n.border||(l.style.borderRight=""))},n.prototype.refreshRange=function(e,t,r,n,a,s,o,l,d,h){void 0===d&&(d=!0);var p,c,u=this.parent.getActiveSheet(),f=e.slice();if(Wl(this.parent,f,!0))for(var g=f[0];g<=f[2];g++)if(!cl(u,g))for(var m=f[1];m<=f[3];m++)Il(u,m)||((c=this.parent.getCell(g,m))&&(p={rowIdx:g,colIdx:m,td:c,cell:Ln(g,m,u),isRefreshing:t,lastCell:m===f[3],isRefresh:!0,isHeightCheckNeeded:d,manualUpdate:!0,first:"",onActionUpdate:n,skipFormatCheck:s,isFromAutoFillOption:l},o&&(p.address=i(g,m)),this.update(p),a&&u.conditionalFormats&&u.conditionalFormats.length&&this.parent.notify(kt,{indexes:[g,m],isAction:!0}),this.parent.notify(Sa,{td:c,rowIndex:g,colIndex:m}),r&&this.setWrapByValue(u,p)),"Manual"===this.parent.calculationMode&&h&&(c?p.isSortAction=h:p={rowIdx:g,colIdx:m,td:c,cell:Ln(g,m,u),isRefreshing:t,lastCell:m===f[3],isRefresh:!0,isHeightCheckNeeded:d,manualUpdate:!0,first:"",onActionUpdate:n,skipFormatCheck:s,isFromAutoFillOption:l,isSortAction:h},p.cell&&p.cell.formula&&u.isSheetCalculated&&this.calculateFormula(p)))},n.prototype.refresh=function(e,t,r,n,i,a,s,o,l){var d=this.parent.getActiveSheet();if((n||!cl(d,e)&&!Il(d,t))&&(n||!this.parent.scrollSettings.enableVirtualization||this.parent.insideViewport(e,t))){var h=n||this.parent.getCell(e,t);if(!h)return;var p={rowIdx:e,colIdx:t,td:h,cell:Ln(e,t,d),isRefresh:!0,lastCell:r,isHeightCheckNeeded:!0,manualUpdate:!0,first:"",skipFormatCheck:s,isRandomFormula:o,fillType:l};this.update(p),i&&d.conditionalFormats&&d.conditionalFormats.length&&this.parent.notify(kt,{indexes:[e,t],isAction:!0}),this.parent.notify(Sa,{td:h,rowIndex:e,colIndex:t}),a&&this.setWrapByValue(d,p)}},n.prototype.updateView=function(r){if((0,e.isNullOrUndefined)(r.sheetIndex)||r.sheetIndex===this.parent.activeSheetIndex){if(!r.indexes){var n=this.parent.getActiveSheet(),i=this.parent.frozenRowCount(n),a=this.parent.frozenColCount(n),s=t(n.topLeftCell);i&&a&&this.refreshRange([s[0],s[1],i-1,a-1],r.refreshing,r.checkWrap,!1,r.checkCF),i&&this.refreshRange([s[0],this.parent.viewport.leftIndex+a,i-1,this.parent.viewport.rightIndex],r.refreshing,r.checkWrap,!1,r.checkCF),a&&this.refreshRange([this.parent.viewport.topIndex+i,s[1],this.parent.viewport.bottomIndex,a-1],r.refreshing,r.checkWrap,!1,r.checkCF),r.indexes=[this.parent.viewport.topIndex+i,this.parent.viewport.leftIndex+a,this.parent.viewport.bottomIndex,this.parent.viewport.rightIndex]}this.refreshRange(r.indexes,r.refreshing,r.checkWrap,!1,r.checkCF)}else r.refreshing&&this.calculateFormula({cell:Ln(r.indexes[0],r.indexes[1],In(this.parent,r.sheetIndex),!0,!0),rowIdx:r.indexes[0],colIdx:r.indexes[1],sheetIndex:r.sheetIndex})},n.prototype.destroy=function(){this.parent.off(tr,this.updateView),this.parent.off(ne,this.calculateFormula),this.element&&this.element.remove(),this.element=null,this.th&&this.th.remove(),this.th=null,this.tableRow&&this.tableRow.remove(),this.tableRow=null,this.parent=null},n}(),Jd=function(){function t(e){this.parent=e,this.addEventListener(),this.instantiateRenderer()}return t.prototype.render=function(){this.parent.setProperties({activeSheetIndex:this.parent.skipHiddenSheets(this.parent.activeSheetIndex)},!0),this.parent.isMobileView()||(this.parent.notify(Gn,null),this.parent.notify(Yn,null));var e=this.parent.createElement("div",{id:this.parent.element.id+"_sheet_panel",className:"e-sheet-panel"});this.parent.enableRtl&&e.classList.add("e-rtl"),this.parent.element.appendChild(e),this.parent.showSheetTabs?this.parent.notify(Xn,null):(this.parent.notify(pe,{action:"initSheetInfo"}),this.parent.notify(pe,{action:"initiateDefinedNames"})),this.parent.isMobileView()&&(this.parent.notify(Yn,null),this.parent.notify(Gn,null)),this.parent.password&&(this.parent.password.length>0||this.parent.isProtected)&&(this.parent.isProtected=!0,this.parent.showSheetTabs&&(this.parent.element.querySelector(".e-add-sheet-tab").setAttribute("disabled","true"),this.parent.element.querySelector(".e-add-sheet-tab").classList.add("e-disabled"))),"None"===this.parent.selectionSettings.mode&&(this.parent.allowAutoFill=!1),this.setSheetPanelSize(),this.renderSheet(e),this.checkTopLeftCell(!this.parent.refreshing)},t.prototype.checkTopLeftCell=function(e,t,n,i,a,s){var o=this.parent.getActiveSheet();this.parent.showSpinner();var l,d="A1"===o.topLeftCell,h=r(o.topLeftCell);if(o.topLeftCell!==o.paneTopLeftCell&&(o.frozenRows||o.frozenColumns)){var p=r(o.paneTopLeftCell);l=this.parent.scrollSettings.enableVirtualization,d=o.frozenRows&&o.frozenColumns?h[0]+o.frozenRows===p[0]&&h[1]+o.frozenColumns===p[1]:o.frozenRows?h[0]+o.frozenRows===p[0]&&0===h[1]:h[1]+o.frozenColumns===p[1]&&0===h[0],h[0]&&p[0]>h[0]?this.parent.viewport.beforeFreezeHeight=ml(o,0,h[0]-1,!0):this.parent.viewport.beforeFreezeHeight=0,h[1]&&p[1]>h[1]?this.parent.viewport.beforeFreezeWidth=wl(o,0,h[1]-1,!0):this.parent.viewport.beforeFreezeWidth=0}else this.parent.viewport.beforeFreezeHeight=this.parent.viewport.beforeFreezeWidth=0;var c=this.parent.frozenRowCount(o),u=this.parent.frozenColCount(o);if(!this.parent.scrollSettings.enableVirtualization||d)this.refreshUI({rowIndex:h[0],colIndex:h[1],refresh:"All"},null,e,t,a,s),l&&(this.parent.viewport.topIndex=Dr(o,c,!0)-c,this.parent.viewport.leftIndex=Dr(o,u,!0,"columns")-u);else{var f=o.paneTopLeftCell===o.topLeftCell?h:r(o.paneTopLeftCell),g={preventScroll:!0};g.scrollTop=n||(f[0]>c?ml(o,c,f[0]-1,!0):0),g.scrollLeft=i||(f[1]>u?wl(o,u,f[1]-1,!0):0),this.parent.notify(Yi,g);var m=this.parent.getThreshold("row"),v=o.frozenRows?h[0]:h[0]>m?Dr(o,h[0]-m,!0):0,y=[];o.frozenRows&&y.push(f[0]-m>c?f[0]-m:c),m=this.parent.getThreshold("col");var C=o.frozenColumns?h[1]:h[1]>m?Dr(o,h[1]-m,!0,"columns"):0;o.frozenColumns?(y.length||y.push(c),y.push(f[1]-m>u?f[1]-m:u)):y.length&&y.push(u),this.refreshUI({rowIndex:v,colIndex:C,refresh:"All",top:g.scrollTop,left:g.scrollLeft,frozenIndexes:y},null,e,t,a,s),l&&(c&&y[0]>=c&&(this.parent.viewport.topIndex=Dr(o,y[0],!0)-c),u&&y[1]>=u&&(this.parent.viewport.leftIndex=Dr(o,y[1],!0,"columns")-u))}},t.prototype.renderSheet=function(e){void 0===e&&(e=document.getElementById(this.parent.element.id+"_sheet_panel")),e.appendChild(this.parent.createElement("div",{className:"e-sheet",id:this.parent.element.id+"_sheet",styles:"background-color: #fff"})),this.parent.serviceLocator.getService("sheet").renderPanel()},t.prototype.refreshUI=function(t,n,a,s,o,l){var d=this;"All"!==t.refresh&&this.parent.showSpinner();var h=this.parent.serviceLocator.getService("sheet"),p=this.parent.getActiveSheet(),c=On(this.parent),u={rowCount:p.rowCount,colCount:p.colCount};if(t.frozenIndexes=t.frozenIndexes?t.frozenIndexes:[],!n)if(this.parent.scrollSettings.enableVirtualization){var f=t.rowIndex+this.parent.viewport.rowCount+2*this.parent.getThreshold("row"),g=t.colIndex+this.parent.viewport.colCount+2*this.parent.getThreshold("col"),m=this.parent.frozenRowCount(p),v=this.parent.frozenColCount(p);t.frozenIndexes.length&&(f+=t.frozenIndexes[0]-m,g+=t.frozenIndexes[1]-v),"Row"===t.refresh?f+=m:f+=p.frozenRows,"Column"===t.refresh?g+=v:g+=p.frozenColumns;var y=t.frozenIndexes[0]>m?t.frozenIndexes[0]:t.rowIndex+("Row"===t.refresh?m:p.frozenRows),C=this.parent.skipHidden(y,f,"rows",!1);if(f=C[1],y!==C[0])(w=r(p.paneTopLeftCell))[0]===y&&this.parent.updateTopLeftCell(C[0]-m,w[1],"col");C[0]-=m;var b=p.rowCount-1,x=0,S=t.rowIndex;if(this.parent.scrollSettings.isFinite&&f>b)if(x=f-b,f=Dr(p,b,!1),C[0]+m>Dr(p,m,!0))E=(E=t.rowIndex-x)<0?0:E,E=this.decreaseHidden(E,t.rowIndex-1,m),t.top&&E<t.rowIndex&&this.parent.notify(Qs,{height:ml(p,E+m,t.rowIndex-1+m,!0),isRender:!0}),this.parent.viewport.topIndex=C[0]=E,S="Row"===t.refresh?E:S;"Row"===t.refresh?t.rowIndex=Dr(p,S+m,!0)-m:S=t.rowIndex=m?Dr(p,S,!0):C[0];var w,I=t.frozenIndexes[1]>v?t.frozenIndexes[1]:t.colIndex+("Column"===t.refresh?v:p.frozenColumns);if(g=(C=this.parent.skipHidden(I,g,"columns",!1))[1],I!==C[0])(w=r(p.paneTopLeftCell))[1]===I&&this.parent.updateTopLeftCell(w[0],C[0]-v,"row");C[0]-=v,b=p.colCount-1,x=0;var E,N=t.colIndex;if(this.parent.scrollSettings.isFinite&&g>b)if(x=g-b,g=Dr(p,b,!1,"columns"),C[0]+v>Dr(p,v,!0,"columns"))E=(E=t.colIndex-x)>-1?E:0,E=this.decreaseHidden(E,t.colIndex-1,v,"columns"),t.left&&E<t.colIndex&&this.parent.notify(Qs,{width:wl(p,E+v,t.colIndex-1+v,!0),isRender:!0}),this.parent.viewport.leftIndex=C[0]=E,N="Column"===t.refresh?E:N;"Column"===t.refresh?t.colIndex=Dr(p,N+v,!0,"columns")-v:N=t.colIndex=v?Dr(p,N,!0,"columns"):C[0],"Row"===t.refresh&&(S+=m,m&&(f+=r(p.topLeftCell)[0]),g=this.parent.viewport.rightIndex),"Column"===t.refresh&&(N+=v,v&&(g+=r(p.topLeftCell)[1]),f=this.parent.viewport.bottomIndex),this.parent.viewport.topIndex=t.rowIndex,this.parent.viewport.bottomIndex=f,this.parent.viewport.leftIndex=t.colIndex,this.parent.viewport.rightIndex=g,n=i(S,N)+":"+i(f,g)}else"All"===t.refresh&&this.updateTopLeftScrollPosition((0,e.extend)(t,{sheet:p})),this.parent.viewport.bottomIndex=p.rowCount-1,this.parent.viewport.rightIndex=p.colCount-1,n=i(t.rowIndex,t.colIndex)+":"+i(this.parent.viewport.bottomIndex,this.parent.viewport.rightIndex);"All"===t.refresh&&this.parent.trigger(Ti,{});var R=this.parent.isOpen||this.parent.refreshing;ud(this.parent.getMainContent(),{busy:!0});var O=this.parent.sheets.length;ln(this.parent,c+"!"+n,null,null,t.frozenIndexes).then((function(e){if(d.parent&&!(O<d.parent.sheets.length)){var i=yn(d.parent,p.id);if(o||void 0!==i&&i===d.parent.activeSheetIndex){var c,f=[t.rowIndex,t.colIndex].concat(r(n.split(":")[1]));switch(t.refresh){case"All":h.renderTable({cells:e,indexes:f,top:t.top,left:t.left,initLoad:a,isRefreshing:s,isOpen:R,openOptions:l});break;case"Row":h.refreshRowContent({cells:e,indexes:f,skipUpdateOnFirst:t.skipUpdateOnFirst,prevRowColCnt:u}),c={isEdit:false},d.parent.notify($n,c),c.isEdit&&d.parent.notify(ei,{action:"startEdit",refreshCurPos:!1});break;case"Column":h.refreshColumnContent({cells:e,indexes:f,skipUpdateOnFirst:t.skipUpdateOnFirst,prevRowColCnt:u,insertDelete:t.insertDelete});break;case"RowPart":h.updateRowContent({cells:e,indexes:f,direction:t.direction,skipUpdateOnFirst:t.skipUpdateOnFirst,prevRowColCnt:u});break;case"ColumnPart":h.updateColContent({cells:e,indexes:f,direction:t.direction,skipUpdateOnFirst:t.skipUpdateOnFirst,prevRowColCnt:u})}d.parent&&d.parent.isReact&&d.parent.renderReactTemplates()}else i>-1&&d.checkTopLeftCell()}})),this.parent.notify(ci,{refresh:t.refresh,skipTranslate:t.skipTranslate})},t.prototype.updateTopLeftScrollPosition=function(e){var t=r(e.sheet.topLeftCell),n=r(e.sheet.paneTopLeftCell);if(e.sheet.frozenRows){var i=this.parent.frozenRowCount(e.sheet);n[0]>i&&(e.top=ml(e.sheet,i,n[0]-1,!0))}else e.rowIndex&&(e.rowIndex=0),0!==t[0]&&(e.top=ml(e.sheet,0,t[0]-1,!0));if(e.sheet.frozenColumns){var a=this.parent.frozenColCount(e.sheet);n[1]>a&&(e.left=wl(e.sheet,a,n[1]-1,!0))}else e.colIndex&&(e.colIndex=0),0!==t[1]&&(e.left=wl(e.sheet,0,t[1]-1,!0))},t.prototype.removeSheet=function(){document.getElementById(this.parent.element.id+"_sheet")&&(0,e.remove)(document.getElementById(this.parent.element.id+"_sheet"))},t.prototype.refreshSheet=function(e,t,r,n,i){var a=0,s=0;if(t){var o=this.parent.element.getElementsByClassName("e-main-panel")[0];o&&(a=o.scrollTop);var l=this.parent.getMainContent();l&&(s=l.scrollLeft)}this.removeSheet(),this.renderSheet(),this.parent.notify(Xi,{}),this.checkTopLeftCell(!1,e,a,s,n,i),r&&Fd(this.parent.element)},t.prototype.setSheetPanelSize=function(e){var t,r=document.getElementById(this.parent.element.id+"_sheet_panel"),n=this.parent.element.getBoundingClientRect();if(this.parent.viewport.scaleY=this.parent.viewport.scaleX=1,this.parent.enableScaling){var i=this.parent.element.offsetHeight,a=i/n.height;1!==a&&Math.abs(i-n.height)>=.1*i&&(this.parent.viewport.scaleY=a);var s=this.parent.element.offsetWidth,o=s/n.width;1!==o&&Math.abs(s-n.width)>=.1*s&&(this.parent.viewport.scaleX=o)}"auto"===this.parent.height?(r.style.height="260px",t=230):(t=n.height*this.parent.viewport.scaleY-jl(r,null,this.parent.viewport.scaleY),r.style.height=t+"px",t-=32/this.parent.viewport.scaleY),void 0!==e&&(this.colMinWidth=e),this.parent.viewport.height=t;var l=n.width*this.parent.viewport.scaleX;this.parent.viewport.width=l-32/this.parent.viewport.scaleX,this.parent.viewport.rowCount=this.roundValue(t,20),this.parent.viewport.colCount=this.roundValue(l,this.colMinWidth||64)},t.prototype.roundValue=function(e,t){var r=e/t,n=Math.round(r);return Math.abs(r-n)<.5?n:n-1},t.prototype.moveOrDuplicateSheetHandler=function(e){this.parent.notify(Kn,null),e.refresh&&this.refreshSheet(e.isDuplicate)},t.prototype.decreaseHidden=function(e,t,r,n){void 0===n&&(n="rows"),e+=r,t+=r;for(var i=this.parent.getActiveSheet(),a=t;a>=e;a--)if(i[""+n][a]&&i[""+n][a].hidden&&--e<r){e=Dr(i,r,!0,n);break}return e-r},t.prototype.instantiateRenderer=function(){this.parent.serviceLocator.register("cell",new Zd(this.parent)),this.parent.serviceLocator.register("row",new $d(this.parent)),this.parent.serviceLocator.register("sheet",new Kd(this.parent))},t.prototype.destroy=function(){this.removeEventListener(),this.parent.serviceLocator.getService("row").destroy(),this.parent.serviceLocator.getService("cell").destroy(),this.colMinWidth&&(this.colMinWidth=null),this.parent=null},t.prototype.addEventListener=function(){this.parent.on(Qn,this.destroy,this),this.parent.on(Yt,this.moveOrDuplicateSheetHandler,this),this.parent.on(eo,this.updateTopLeftScrollPosition,this)},t.prototype.removeEventListener=function(){this.parent.off(Qn,this.destroy),this.parent.off(Yt,this.moveOrDuplicateSheetHandler),this.parent.off(eo,this.updateTopLeftScrollPosition)},t}(),Qd=function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function s(e){try{l(n.next(e))}catch(e){a(e)}}function o(e){try{l(n.throw(e))}catch(e){a(e)}}function l(e){e.done?i(e.value):new r((function(t){t(e.value)})).then(s,o)}l((n=n.apply(e,t||[])).next())}))},eh=function(e,t){var r,n,i,a,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function o(a){return function(o){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&a[0]?n.return:a[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;switch(n=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,n=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],n=0}finally{r=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,o])}}},th=function(){function n(e){this.parent=e,this.init(),this.addEventListener()}return n.prototype.init=function(){this.parent.element.appendChild(this.parent.createElement("input",{className:"e-clipboard",attrs:{contenteditable:"true",tabindex:"-1","aria-hidden":"true"}}))},n.prototype.addEventListener=function(){var t=this.getClipboardEle();this.parent.on(Ri,this.cut,this),this.parent.on(Oi,this.copy,this),this.parent.on(ki,this.paste,this),this.parent.on(Ai,this.clearCopiedInfo,this),this.parent.on(Ii,this.tabSwitchHandler,this),this.parent.on(vi,this.cMenuBeforeOpenHandler,this),this.parent.on(xi,this.ribbonClickHandler,this),this.parent.on(Zn,this.initCopyIndicator,this),this.parent.on(Wi,this.rowHeightChanged,this),this.parent.on(Gi,this.colWidthChanged,this),this.parent.on(er,this.refreshOnInsertDelete,this),e.EventHandler.add(t,"cut",this.cut,this),e.EventHandler.add(t,"copy",this.copy,this),e.EventHandler.add(t,"paste",this.paste,this)},n.prototype.removeEventListener=function(){var t=this.getClipboardEle();this.parent.isDestroyed||(this.parent.off(Ri,this.cut),this.parent.off(Oi,this.copy),this.parent.off(ki,this.paste),this.parent.off(Ai,this.clearCopiedInfo),this.parent.off(Ii,this.tabSwitchHandler),this.parent.off(vi,this.cMenuBeforeOpenHandler),this.parent.off(xi,this.ribbonClickHandler),this.parent.off(Zn,this.initCopyIndicator),this.parent.off(Wi,this.rowHeightChanged),this.parent.off(Gi,this.colWidthChanged),this.parent.off(er,this.refreshOnInsertDelete)),e.EventHandler.remove(t,"cut",this.cut),e.EventHandler.remove(t,"copy",this.copy),e.EventHandler.remove(t,"paste",this.paste)},n.prototype.ribbonClickHandler=function(e){var t=this.parent.element.id;switch(e.item.id){case t+"_cut":this.cut({invokeCopy:!0});break;case t+"_copy":this.copy({invokeCopy:!0})}},n.prototype.tabSwitchHandler=function(e){0!==e.activeTab||this.copiedInfo||this.copiedShapeInfo||this.hidePaste()},n.prototype.cMenuBeforeOpenHandler=function(e){var t=this.parent.getActiveSheet(),n=this.parent.serviceLocator.getService(kl),i=[],a=[],s=[],o=[],l=r(t.activeCell),d=Ln(l[0],l[1],t),h=t.isProtected&&Ar(d,bl(t,l[1])),p=$r(d,bl(t,l[1]),hl(t,l[0]));"Content"!==e.target&&"RowHeader"!==e.target&&"ColumnHeader"!==e.target&&"SelectAll"!==e.target||(this.parent.enableContextMenuItems([n.getConstant("Paste"),n.getConstant("PasteSpecial")],!!(this.copiedInfo||this.copiedShapeInfo&&!h)),this.parent.enableContextMenuItems([n.getConstant("Cut")],!h)),"Content"===e.target&&(t.isProtected&&this.parent.enableContextMenuItems([n.getConstant("Filter"),n.getConstant("Sort"),n.getConstant("AddNote")],!1),h?this.parent.enableContextMenuItems([n.getConstant("Cut"),n.getConstant("Hyperlink"),n.getConstant("EditNote"),n.getConstant("DeleteNote")],!1):p?this.parent.enableContextMenuItems([n.getConstant("Cut"),n.getConstant("Paste"),n.getConstant("PasteSpecial"),n.getConstant("Filter"),n.getConstant("Sort"),n.getConstant("Hyperlink"),n.getConstant("EditHyperlink"),n.getConstant("OpenHyperlink"),n.getConstant("RemoveHyperlink")],!1):t.isProtected&&!t.protectSettings.insertLink&&this.parent.enableContextMenuItems([n.getConstant("Hyperlink")],!1)),t.isProtected&&("ColumnHeader"===e.target&&(s=[n.getConstant("DeleteColumn"),n.getConstant("DeleteColumns"),n.getConstant("InsertColumn"),n.getConstant("InsertColumns")],o=[n.getConstant("HideColumn"),n.getConstant("HideColumns"),n.getConstant("UnhideColumns")],this.parent.enableContextMenuItems(s,!1),this.parent.enableContextMenuItems(o,t.protectSettings.formatColumns)),"RowHeader"===e.target&&(i=[n.getConstant("DeleteRow"),n.getConstant("DeleteRows"),n.getConstant("InsertRow"),n.getConstant("InsertRows")],a=[n.getConstant("HideRow"),n.getConstant("HideRows"),n.getConstant("UnhideRows")],this.parent.enableContextMenuItems(i,!1),this.parent.enableContextMenuItems(a,t.protectSettings.formatRows)))},n.prototype.rowHeightChanged=function(e){if(this.copiedInfo){var t=this.getCopyIndicator();t&&(this.copiedInfo.range[0]>e.rowIdx?t.style.top=parseFloat(t.style.top)+e.threshold+"px":Nr(this.copiedInfo.range,e.rowIdx,this.copiedInfo.range[1])&&(t.style.height=parseFloat(t.style.height)+e.threshold+"px"))}},n.prototype.colWidthChanged=function(e){if(this.copiedInfo){var t=this.getCopyIndicator();t&&(this.copiedInfo.range[1]>e.colIdx?t.style.left=parseFloat(t.style.left)+e.threshold+"px":Nr(this.copiedInfo.range,this.copiedInfo.range[0],e.colIdx)&&(t.style.width=parseFloat(t.style.width)+e.threshold+"px"))}},n.prototype.cut=function(e){this.setCopiedInfo(e,!0)},n.prototype.copy=function(e){this.setCopiedInfo(e,!1)},n.prototype.paste=function(r){if(this.parent.isEdit||this.parent.element.getElementsByClassName("e-dlg-overlay").length>0){this.parent.element.getElementsByClassName("e-spreadsheet-edit")[0].style.height="auto"}else{var n,i=r&&r.clipboardData||window.clipboardData;if(!(i&&r.clipboardData&&r.clipboardData.getData("isInternalCut").length)||this.copiedInfo)if(i||this.copiedShapeInfo||r.isInternal&&this.copiedInfo){r.isInternal=!i;var s=void 0,o=this.getCopiedIdx();r.isAction=!!i||r.isAction;var l=r&&r.sIdx>-1?r.sIdx:this.parent.activeSheetIndex,d=In(this.parent,l),h=c(r&&r.range||t(d.selectedRange)),p=void 0,u=void 0;if(i){if(u=(p=this.getExternalCells(r)).model,!r.isInternal&&p.internal&&(i=!1,!this.copiedInfo))return;if(!u||!u.length){if(p.file)return void this.parent.notify(gs,{file:p.file});if(!this.copiedInfo)return;i=!1}}var f=Object.assign({isExternal:i},this.copiedInfo),g=void 0,v=void 0,y=void 0,C=void 0,b=void 0,x=void 0,S=void 0,w=void 0,I=void 0;i?(v=l,S=In(this.parent,v),y={},b="Sheet"!==(x=p.selection)&&(h[2]-h[0]+1)%p.rowCount==0&&(h[3]-h[1]+1)%p.colCount==0,g=[0,0,p.usedRowIndex,p.usedColIndex]):(v=o,y=bl(d,(g=c(this.copiedShapeInfo?t(d.selectedRange):this.copiedInfo.range))[1]),C=m(g)&&this.isRangeMerged(h,d),S=In(this.parent,v),b=!C&&(h[2]-h[0]+1)%(g[2]-g[0]+1)==0&&(h[3]-h[1]+1)%(g[3]-g[1]+1)==0,S&&(w=0===g[1]&&g[3]===S.colCount-1,I=0===g[0]&&g[2]===S.rowCount-1,w?I?(x="Sheet",g[2]=S.usedRange.rowIndex,g[3]=S.usedRange.colIndex):(x="Row",g[3]=S.usedRange.colIndex):I&&(x="Column",g[2]=S.usedRange.rowIndex))),n=b?h:[h[0],h[1]].concat([h[0]+g[2]-g[0],h[1]+g[3]-g[1]||h[1]]),x&&(("Sheet"===x||"Column"===x)&&n[2]<d.usedRange.rowIndex&&(n[2]=d.usedRange.rowIndex),("Sheet"===x||"Row"===x)&&n[3]<d.usedRange.colIndex&&(n[3]=d.usedRange.colIndex));var E=r&&r.type||"All";if(zd(this.parent,n))return void this.parent.notify(Ka,null);if(r.isAction&&!this.copiedShapeInfo){var N={requestType:"paste",copiedInfo:this.copiedInfo,copiedRange:a(g),pastedRange:a(n),type:E,cancel:!1};if(this.parent.notify(K,{eventArgs:N,action:"clipboard"}),N.cancel)return;h=t(N.pastedRange),n=(b=i?"Sheet"!==p.selection&&(h[2]-h[0]+1)%p.rowCount==0&&(h[3]-h[1]+1)%p.colCount==0:!C&&!w&&(h[2]-h[0]+1)%(g[2]-g[0]+1)==0&&!I&&(h[3]-h[1]+1)%(g[3]-g[1]+1)==0)?h:[h[0],h[1]].concat([h[0]+g[2]-g[0],h[1]+g[3]-g[1]||h[1]]),E=N.type}var R=void 0;x?(R=[].concat(n),"Sheet"!==x&&"Column"!==x||(n[2]<d.usedRange.rowIndex&&(n[2]=d.usedRange.rowIndex),g[2]<d.usedRange.rowIndex&&(g[2]+=d.usedRange.rowIndex-g[2]),R[2]<d.rowCount&&(R[2]=d.rowCount-1)),"Sheet"!==x&&"Row"!==x||(n[3]<d.usedRange.colIndex&&(g[3]+=d.usedRange.colIndex-n[3],n[3]=d.usedRange.colIndex),g[3]<d.usedRange.colIndex&&(g[3]+=d.usedRange.colIndex-g[3]),R[3]<d.colCount&&(R[3]=d.colCount-1))):R=n;var O=void 0,k=void 0,A=void 0,F=h[0],T=[];if(d.isProtected&&Td(this.parent,n))return void this.parent.notify(Xa,null);if(this.copiedShapeInfo&&!this.copiedInfo){var D=this.copiedShapeInfo.pictureElem;D.classList.contains("e-datavisualization-chart")?(this.copiedShapeInfo.chartInfo.top=null,this.copiedShapeInfo.chartInfo.left=null,this.parent.notify(Lt,{chart:[this.copiedShapeInfo.chartInfo],isInitCell:!0,isUndoRedo:!0,isPaste:!0,dataSheetIdx:this.copiedShapeInfo.sheetIdx,isCut:this.copiedShapeInfo.isCut,range:r.range||d.selectedRange,sheetId:d.id})):this.parent.notify(bs,{options:{src:D.style.backgroundImage.replace(/url\((['"])?(.*?)\1\)/gi,"$2"),height:this.copiedShapeInfo.height,width:this.copiedShapeInfo.width,id:this.copiedShapeInfo.isCut?D.id:""},range:a([F,h[1],F,h[1]]),isPublic:!1,isUndoRedo:!0});var L=Ln(F,h[1],d);if(L&&!(0,e.isNullOrUndefined)(L.image)&&L.image.length>0){var P={requestType:"imagePaste",copiedShapeInfo:this.copiedShapeInfo,pasteSheetIndex:this.parent.activeSheetIndex,pastedRange:On(this.parent)+"!"+a([F,h[1],F,h[1]]),pastedPictureElement:document.getElementById(L.image[L.image.length-1].id)};this.parent.notify(ka,{eventArgs:P,action:"clipboard"})}}else{var M=[],B=this.isInRange(g,h,o),H=!1,U=!1,V=0,z=[];b||"Values"===E||this.setCF(g,n,S,d,z);for(var _=void 0,j=!1,q=[],W={sheet:d,isExternal:!!i},G=this.setCell(W),Y=!i&&this.copiedInfo.isCut&&this.setCell({sheet:S}),X=g[0],$=0;X<=g[2];X++,$++)if(i||f.isCut||!ul(S,X)){B&&(M[h[0]+$]={cells:[]});for(var Z=g[1],J=0;Z<=g[3];Z++,J++){if(B&&(M[h[0]+$].cells[h[1]+J]=Ln(h[0]+$,h[1]+J,S,!1,!0)),O=i?u[X]&&u[X].cells[Z]||{}:(0,e.extend)({},B&&M[X]&&M[X].cells[Z]?M[X].cells[Z]:Ln(X,Z,S),null,!0),y=bl(S,Z),!O.validation&&y.validation&&(O.validation=y.validation),O&&O.isReadOnly&&delete O.isReadOnly,w||I){if(O&&O.rowSpan)if(O.rowSpan>0)O.rowSpan+X-1<=g[2]?H=!0:O={};else if(H){if(O.rowSpan<0){var Q=O.rowSpan,ee=O.colSpan?O.colSpan:0,te=Ln(F+Q,h[1]+J+ee,d);te&&!te.rowSpan&&(O={})}}else O={};O&&O.colSpan&&(O.colSpan>0?O.colSpan+Z-1<=g[3]?U=!0:O={}:U||(O={}))}if(O&&E){var re=void 0;switch(E){case"Formats":re={format:O.format,style:O.style},this.copiedInfo&&!this.copiedInfo.isCut&&(O.rowSpan&&(re.rowSpan=O.rowSpan),O.colSpan&&(re.colSpan=O.colSpan)),O=re;break;case"Values":if((O={value:O.value}).value&&O.value.toString().indexOf("\n")>-1)this.parent.getCell(h[0],h[1]).classList.add("e-alt-unwrap")}k=["Formats","Values"].indexOf(E)>-1}if(!this.parent.scrollSettings.isFinite&&(g[2]-g[0]>1048575-h[0]||g[3]-g[1]>16383-h[1])||this.parent.scrollSettings.isFinite&&(g[2]-g[0]>d.rowCount-1-h[0]||g[3]-g[1]>d.colCount-1-h[1]))return void this.showDialog();if(b){for(var ne=h[0];ne<=h[2];ne+=g[2]-g[0]+1)if(f.isCut||V||!ul(d,ne+$))for(var ie=h[1];ie<=h[3];ie+=g[3]-g[1]+1){if(X!==g[0]||Z!==g[1]||void 0!==_&&!_.length||"Values"===E||(_=this.setCF(g,[ne,ie,ne+(g[2]-g[0]),ie+(g[3]-g[1])],S,d,z,_)),A=Ln(ne+$,ie+J,d,!1,!0),!(i||(0,e.isNullOrUndefined)(A.colSpan)&&(0,e.isNullOrUndefined)(A.rowSpan))){if(w||I)continue;var ae={range:[ne+$,ie+J,ne+$,ie+J],merge:!1,isAction:!1,type:"All",sheetIndex:l,preventRefresh:l!==this.parent.activeSheetIndex};T.push(ae),this.parent.notify(St,ae)}var se=ie+J;if(O=(0,e.extend)({},O||{},null,!0),!k&&this.copiedInfo&&!this.copiedInfo.isCut&&O.formula){var oe=Pr([ne+$,se],[X,Z],S,this.parent,B?O:null);(0,e.isNullOrUndefined)(oe)||(O.formula=oe)}if(this.copiedInfo&&!this.copiedInfo.isCut&&O.validation){var le=h,de=g,he=Pr(le,de,S,this.parent,{formula:O.validation.value1});O.validation.value1=he,""!==O.validation.value2&&(he=Pr(le,de,S,this.parent,{formula:O.validation.value2}),O.validation.value2=he)}d.isProtected&&O&&!1!==O.isLocked&&(O.isLocked=A.isLocked),A&&A.formula&&A.formula.indexOf("=UNIQUE(")>-1&&this.parent.notify(Ie,null);var ce={cellIdx:[X,Z],isUnique:!1,uniqueRange:"",sheetName:S.name};this.parent.notify(Ee,ce),ce.isUnique&&(O.value=null),j=!1,O&&O.formula&&O.formula.indexOf("=UNIQUE(")>-1&&(j=!0,q.push([ne,se]),O.value=null),G(ne+$,se,O,se===h[3],k,j,r.beforeActionData,r.isUndo)||O.formula&&this.copiedInfo&&this.copiedInfo.isCut&&this.parent.notify(Re,{cellRef:a([X,Z,X,Z])})}}else!i&&bd(this.parent,X,Z,o)||(C?G(F,h[1]+J,{value:O.value},Z===g[3],!0):G(F,h[1]+J,O,Z===g[3],k));if(!i&&this.copiedInfo.isCut&&(!Nr(h,X,Z)||o!==this.parent.activeSheetIndex)){var ue=Ln(X,Z,S);if(ue){if(ue.isReadOnly)continue;if(ue.isLocked||(0,e.isNullOrUndefined)(ue.isLocked))if(!w&&!I||void 0===ue.rowSpan&&void 0===ue.colSpan)ue=null;else{if(!(ue.rowSpan>1||ue.colSpan>1))continue;this.parent.notify(St,{merge:!1,range:[X,Z,X,Z],type:"All"}),ue=null}else!1===ue.isLocked&&(ue=S.isProtected?{isLocked:!1}:null)}Y(X,Z,ue,Z===g[3])}}F++}else $--,V++;if(q.length)for(X=0;X<q.length;X++)this.parent.serviceLocator.getService("cell").refresh(q[X][0],q[X][1]);W.isRandFormula&&"Automatic"===this.parent.calculationMode&&this.parent.notify(pe,{action:"refreshRandomFormula"}),this.parent.notify(Mt,null);var fe=n[2]-V,ge=R[2]-V;n[2]=fe,R[2]=ge,this.parent.setUsedRange(n[2],n[3]);var me=a(R);l!==this.parent.activeSheetIndex||r.isFromUpdateAction||this.parent.notify(Ei,{address:me}),!i&&this.copiedInfo.isCut&&(s=this.copiedInfo.isCut,o===this.parent.activeSheetIndex&&this.parent.serviceLocator.getService("cell").refreshRange(g),this.clearCopiedInfo()),(i||B)&&this.copiedInfo&&this.clearCopiedInfo();var ve=void 0;if(s){_&&_.length&&"Values"!==E&&(ve={range:g,sheetIdx:v,isClear:!0},this.parent.notify(At,ve)),kd(S,g[0],g[1],(this.parent.getRow(g[0],null,this.parent.frozenColCount(S))||{offsetHeight:20}).offsetHeight);var ye=Ad(S,g[0]);xd(this.parent,S,ye,g[0])}z.length&&l===this.parent.activeSheetIndex&&this.parent.notify(kt,{cfModel:z,isAction:!0});var Ce=In(this.parent,o);if(!i&&g[0]===g[2]&&"Row"===x){for(ye=Ce.rows[g[0]].height,X=h[0];X<=h[2];X++)xd(this.parent,this.parent.getActiveSheet(),ye,X);if(s){var be=Ce&&Ce.standardHeight?Ce.standardHeight:20;xd(this.parent,Ce,be,g[0])}}if(r.isAction){P={requestType:"paste",copiedInfo:f,mergeCollection:T,pasteSheetIndex:this.parent.activeSheetIndex,copiedRange:S.name+"!"+(f.range?a(f.range):S.selectedRange),pastedRange:d.name+"!"+a(n),type:E||"All",selectedRange:me};V&&(P.skipFilterCheck=!0),ve&&ve.cfClearActionArgs&&(P.cfClearActionArgs=ve.cfClearActionArgs),z.length&&(P.cfActionArgs={cfModel:z,sheetIdx:l}),this.parent.notify(ka,{eventArgs:P,action:"clipboard"})}r.focus&&Fd(this.parent.element)}}else this.getClipboardEle().select()}},n.prototype.setCF=function(e,r,n,i,s,o){var l,d,h=this,p=function(t){l=[r[0]+(d[0]<=e[0]?0:d[0]-e[0]),r[1]+(d[1]<=e[1]?0:d[1]-e[1]),r[2]-(d[2]>=e[2]?0:e[2]-d[2]),r[3]-(d[3]>=e[3]?0:e[3]-d[3])],i.conditionalFormats||h.parent.setSheetPropertyOnMute(i,"conditionalFormats",[]);var n={range:a(l),type:t.type,cFColor:t.cFColor,value:t.value,format:t.format};i.conditionalFormats.push(n),s.push(n)};if(o)for(var c=0,u=o.length;c<u;c++)d=t(o[c].range),p(o[c]);else if(o=[],n.conditionalFormats)for(c=0,u=n.conditionalFormats.length;c<u;c++)d=t(n.conditionalFormats[c].range),jr([e],n.conditionalFormats[c].range)&&(o.push(n.conditionalFormats[c]),p(n.conditionalFormats[c]));return o},n.prototype.isRangeMerged=function(e,t){var r=Ln(e[0],e[1],t);if(r&&(r.colSpan>1||r.rowSpan>1)){var n={range:e.slice(2,4).concat(e.slice(2,4))};return this.parent.notify(Et,n),n.range[0]===e[0]&&n.range[1]===e[1]&&n.range[2]===e[2]&&n.range[3]===e[3]}return!1},n.prototype.updateFilter=function(e,r){var n,i;this.parent.notify(Q,null);for(var s=0;s<this.parent.sheets.length;s++)if(this.parent.filterCollection&&this.parent.filterCollection[s]&&this.parent.filterCollection[s].sheetIndex===yn(this.parent,e.sId)){var o=e.range,l=t(this.parent.filterCollection[s].filterRange);o=c(o),l[0]===o[0]&&l[2]===o[2]&&l[1]===o[1]&&l[3]===o[3]&&(n=!0,i=[Math.abs(o[0]-l[0]),Math.abs(o[1]-l[1]),Math.abs(o[2]-l[2]),Math.abs(o[3]-l[3])])}var d=this.parent.getCell(e.range[0],e.range[1]),h=(d=d?d.querySelector(".e-filter-icon")?d:this.parent.getCell(e.range[2],e.range[3]):d)?d.querySelector(".e-sortasc-filter"):d,p=d?d.querySelector(".e-sortdesc-filter"):d;if(n)for(var u=0;u<this.parent.filterCollection.length;u++){var f=this.parent.filterCollection[u],g=e&&e.sId?yn(this.parent,e.sId):this.parent.activeSheetIndex;if(f.sheetIndex===g&&this.parent.notify(xa,{predicates:null,range:f.filterRange,sIdx:g,isCut:!0}),f.sheetIndex===g&&g===this.parent.activeSheetIndex&&(i=[r[0]+i[0],r[1]+i[1],Math.abs(r[2]-i[2]),Math.abs(r[3]-i[3])],this.parent.notify(xa,{predicates:null,range:a(i),sIdx:null,isCut:!0}),e.range[3]===e.range[1])){var m=this.parent.getCell(r[0],r[1]);h&&m&&m.querySelector(".e-filter-icon").classList.add("e-sortasc-filter"),p&&m&&m.querySelector(".e-filter-icon").classList.add("e-sortdesc-filter")}}},n.prototype.isInRange=function(e,t,r){var n=this.parent.activeSheetIndex;return Nr(e,t[0],t[1])&&r===n||Nr(e,t[2],t[3])&&r===n},n.prototype.setCell=function(e){var t=this,r=e.sheet,n=r.name===this.parent.getActiveSheet().name;return function(a,s,o,l,d,h,p,c){o&&o.formula&&(o.formula.indexOf("RANDBETWEEN(")>-1||o.formula.indexOf("RAND(")>-1||o.formula.indexOf("NOW(")>-1)&&(e.isRandFormula=!0);var u=Hr(t.parent,r,{cell:o,rowIdx:a,colIdx:s,pvtExtend:!d,valChange:!h,lastCell:l,uiRefresh:n,requestType:"paste",skipFormatCheck:!e.isExternal,isRandomFormula:e.isRandFormula},p,c);if(!u&&o){if(o.validation){var f=i(a,s);t.parent.dataValidationRange+=f+":"+f+","}if(o.style&&e.isExternal){var g=Od(t.parent,a,s,r,o.style||t.parent.cellStyle,o.wrap?Ed(t.parent.getDisplayText(o),Rd(r,a,s,o.colSpan>1?s+o.colSpan-1:s),o.style,t.parent.cellStyle):1);(g=Math.round(g))<20&&(g=20),kd(r,a,s,g);var m=ml(r,a),v=Ad(r,a);v>m&&xd(t.parent,r,v,a)}}return u}},n.prototype.getCopiedIdx=function(){if(this.copiedInfo){for(var e=0;e<this.parent.sheets.length;e++)if(this.parent.sheets[e].id===this.copiedInfo.sId)return e;this.clearCopiedInfo()}return-1},n.prototype.setCopiedInfo=function(r,n){var i=this;if(!this.parent.isEdit){var s=new br.Deferred;r.promise=s.promise;var o,l=this.parent.getActiveSheet();if(r&&r.range){var d=0===r.range[1]&&r.range[3]===l.colCount-1,h=0===r.range[0]&&r.range[2]===l.rowCount-1,p={range:r.range};d||h||this.parent.notify(It,p),o=p.range}else o=t(l.selectedRange);if(n&&zd(this.parent,o))this.parent.notify(Ka,null);else{if(r&&!r.isPublic&&!r.clipboardData){var c={copiedRange:l.name+"!"+a(o),cancel:!1,action:n?"cut":"copy"};if(this.parent.notify(K,c),c.cancel)return}var u={sheet:l,indexes:[0,0,l.rowCount-1,l.colCount-1],isFinite:this.parent.scrollSettings.isFinite,promise:new Promise((function(e){e(void 0)}))},f=document.getElementsByClassName("e-ss-overlay-active"),g=f.length;!l.isLocalData||r&&r.clipboardData||0!==o[0]||o[2]!==l.rowCount-1||g||(this.parent.showSpinner(),this.parent.notify("updateSheetFromDataSource",u)),this.checkForUncalculatedFormula(o,r&&r.sId?r.sId:l.id),u.promise.then((function(){if(g>0){var t={clientY:f[0].offsetTop,isImage:!0};i.parent.notify(ys,t);var d={clientX:f[0].offsetLeft,isImage:!0};if(i.parent.notify(Cs,d),i.copiedShapeInfo={sId:r&&r.sId?r.sId:l.id,sheetIdx:l.index,isCut:n,pictureElem:f[0],copiedRange:a([t.clientY,d.clientX,t.clientY,d.clientX]),height:f[0].offsetHeight,width:f[0].offsetWidth,chartInfo:i.getChartElemInfo(f[0])},!f[0].classList.contains("e-datavisualization-chart")){var h=window.getComputedStyle(f[0]).backgroundImage.slice(5,-2);i.addImgToClipboard(h,i.copiedShapeInfo.height,i.copiedShapeInfo.width)}i.hidePaste(!0),n&&(f[0].classList.contains("e-datavisualization-chart")?i.parent.deleteChart(i.copiedShapeInfo.chartInfo.id):i.parent.notify(xs,{id:i.copiedShapeInfo.pictureElem.id,sheetIdx:i.copiedShapeInfo.sId,range:i.copiedShapeInfo.copiedRange}))}else r&&r.clipboardData||(i.copiedInfo&&i.clearCopiedInfo(),i.copiedInfo={range:o,sId:r&&r.sId?r.sId:l.id,isCut:n},i.hidePaste(!0),r.isFromUpdateAction||i.initCopyIndicator(),e.Browser.isIE||i.getClipboardEle().select(),r&&r.invokeCopy&&document.execCommand(n?"cut":"copy"),i.parent.hideSpinner());e.Browser.isIE&&i.setExternalCells(r,n),s.resolve()})),r&&r.clipboardData&&(this.setExternalCells(r,n),this.getClipboardEle().setAttribute("aria-label",l.selectedRange+" "+this.parent.serviceLocator.getService(kl).getConstant(n?"Cut":"Copy")))}}},n.prototype.imageToCanvas=function(e,t,r){return new Promise((function(n){var i=document.createElement("canvas"),a=i.getContext("2d"),s=new Image;s.src=e,s.crossOrigin="anonymous",s.onload=function(){i.width=r,i.height=t,a.drawImage(s,0,0,r,t),i.toBlob((function(e){n(e)}),"image/png")}}))},n.prototype.addImgToClipboard=function(e,t,r){return Qd(this,void 0,void 0,(function(){var n,i,a;return eh(this,(function(s){switch(s.label){case 0:return i=window.navigator,[4,this.imageToCanvas(e,t,r)];case 1:return a=s.sent(),[4,i.clipboard.write([new ClipboardItem((n={},n[a.type]=a,n))])];case 2:return s.sent(),[2]}}))}))},n.prototype.checkForUncalculatedFormula=function(t,r){for(var n,i=yn(this.parent,r),a=In(this.parent,i),s=t[0];s<=t[2];s++)for(var o=t[1];o<=t[3];o++)(n=Ln(s,o,a,null,!0)).formula&&(0,e.isUndefined)(n.value)&&this.parent.notify(pe,{action:"refreshCalculate",value:n.formula,rowIndex:s,colIndex:o,isFormula:xr(n.formula),sheetIndex:i})},n.prototype.getChartElemInfo=function(e){var t=this.parent.chartColl;if(e.classList.contains("e-datavisualization-chart"))for(var r=e.getElementsByClassName("e-control")[0].id,n=0;n<t.length;n++){if(t[n].id===r)return t[n]}return null},n.prototype.clearCopiedInfo=function(){this.copiedInfo&&(this.parent.getActiveSheet().id===this.copiedInfo.sId&&(this.removeIndicator(this.parent.getSelectAllContent()),this.removeIndicator(this.parent.getColumnHeaderContent()),this.removeIndicator(this.parent.getRowHeaderContent()),this.removeIndicator(this.parent.getMainContent())),this.copiedInfo=null,this.hidePaste()),this.copiedShapeInfo&&(this.copiedShapeInfo=null,this.hidePaste())},n.prototype.removeIndicator=function(t){if(t){var r=t.getElementsByClassName("e-copy-indicator")[0];r&&(0,e.detach)(r)}},n.prototype.initCopyIndicator=function(){if(this.copiedInfo&&this.parent.getActiveSheet().id===this.copiedInfo.sId){var e=this.parent.createElement("div",{className:"e-copy-indicator"});e.appendChild(this.parent.createElement("div",{className:"e-top"})),e.appendChild(this.parent.createElement("div",{className:"e-bottom"})),e.appendChild(this.parent.createElement("div",{className:"e-left"})),e.appendChild(this.parent.createElement("div",{className:"e-right"})),Yl(this.parent,e,this.copiedInfo.range,"e-copy-indicator")}},n.prototype.showDialog=function(){var e=this;this.parent.serviceLocator.getService(Al).show({header:"Spreadsheet",height:205,width:340,isModal:!0,showCloseIcon:!0,content:this.parent.serviceLocator.getService(kl).getConstant("PasteAlert"),beforeOpen:function(t){var r={dialogName:"PasteDialog",element:t.element,target:t.target,cancel:t.cancel};e.parent.trigger("dialogBeforeOpen",r),r.cancel&&(t.cancel=!0)}})},n.prototype.hidePaste=function(e){this.parent.getActiveSheet().isProtected&&(e=!1),this.parent.notify(wi,[{items:[this.parent.element.id+"_paste"],enable:e||!1}])},n.prototype.setExternalCells=function(t,r){var n,i,a,s="",o=this.parent.getActiveSheet(),l=c(this.copiedInfo.range),d=0===l[1]&&l[3]===o.colCount-1,h=0===l[0]&&l[2]===o.rowCount-1,p='<html><body><table class="e-spreadsheet" xmlns="http://www.w3.org/1999/xhtml" style="border-collapse:collapse;"';(d||h)&&(p+=' aria-rowcount="'+o.usedRange.rowIndex+'" aria-colcount="'+o.usedRange.colIndex+'"',p+=' aria-label="'+(d&&h?"Sheet":d?"Row":"Column")+'"'),p+="><tbody>";for(var u=l[0];u<=l[2];u++)if(r||!ul(o,u)){p+="<tr>";for(var f=l[1];f<=l[3];f++)if(!((n=Ln(u,f,o,!1,!0)).colSpan<0||n.rowSpan<0)){if(p+="<td",n.colSpan&&(p+=' colspan="'+n.colSpan+'"'),n.rowSpan&&(p+=' rowspan="'+n.rowSpan+'"'),n.style?(a="",n.style.whiteSpace||(a+="white-space:"+(n.wrap?"normal":"nowrap")+";"),n.style.verticalAlign||(a+="vertical-align:bottom;"),Object.keys(n.style).forEach((function(e){var t=n.style[""+e];e.includes("border")&&t.includes("dashed")&&t.includes("1px")&&(t=t.replace("1px","thin"));var r=e.match(/[A-Z]/);a+=("backgroundColor"===e?"background":r?e.replace(r[0],"-"+r[0].toLowerCase()):e)+":"+("backgroundColor"===e||"color"===e?n.style[""+e].slice(0,7):t)+";"})),p+=a.includes('"')?" style='"+a+"'":' style="'+a+'"'):p+=' style="white-space:'+(n.wrap?"normal":"nowrap")+';vertical-align:bottom;"',(0,e.isNullOrUndefined)(n.value))p+="></td>";else{if(i=n.value,n.format&&"General"!==n.format){p+=n.value.toString().includes('"')?" cell-value='"+i+"'":' cell-value="'+n.value+'"',p+=n.format.includes('"')?" num-format='"+n.format+"'":' num-format="'+n.format+'"';var g={formattedText:i,value:i,format:n.format,cell:n,rowIndex:u,colIndex:f,dataUpdate:!0};this.parent.notify(re,g),i=g.formattedText}p+=">",p+=i,s+=i,p+="</td>"}s+=f===l[3]?"":"\t"}p+="</tr>",s+=u===l[2]?"":"\n"}p+="</tbody></table></body></html>",e.Browser.isIE?(window.clipboardData.setData("text",s),r&&window.clipboardData.setData("isInternalCut",s)):(t.clipboardData.setData("text/html",p),t.clipboardData.setData("text/plain",s),r&&t.clipboardData.setData("isInternalCut",s),t.preventDefault())},n.prototype.getExternalCells=function(t){var r,n,i=this,a=[],s={model:a},o=this.parent.createElement("span"),l=function(){return setTimeout((function(){i.getClipboardEle().innerHTML=""}),0)};if(e.Browser.isIE)n=window.clipboardData.getData("text");else{if(r=t.clipboardData.getData("text/html"),n=t.clipboardData.getData("text/plain"),this.copiedInfo&&r.includes('<table class="e-spreadsheet"')){var d=!1;if(!this.copiedInfo.isCut){var h={sheetIdx:yn(this.parent,this.copiedInfo.sId)};if(this.parent.notify(Fa,h),h.isFiltered){var p=h.filterRange,c=this.copiedInfo.range;d=p[0]===c[0]&&p[1]===c[1]&&p[2]===c[2]&&p[3]===c[3]}}if(!d)return l(),{internal:!0}}o.innerHTML=r}if(o.querySelector("table"))this.generateCells(o,s);else if(o.querySelector("img")){var u=o.querySelector("img");this.parent.notify(bs,{options:{src:u.src,height:u.height,width:u.width},isPublic:!0})}else if(n){var f,g,m,v=[];r&&(g=[].slice.call(o.children));var y=this.cellStyle(o);s.colCount=1,n.split("\n").forEach((function(e){f=null,r&&(m=g.filter((function(t){return t.textContent&&t.textContent.replace(/(\r\n|\n|\r|\s)/gm," ").trim()===e.trim()}))[0])&&(f=y(m),g.splice(g.indexOf(m),1)),e.split("\t").forEach((function(e,t){(e||f)&&(v[t]={},f&&(f.whiteSpace&&"nowrap"!==f.whiteSpace?(v[t].wrap=!0,delete f.whiteSpace,Object.keys(f).length&&(v[t].style=f)):v[t].style=f),e&&(xr(e)?v[t].formula=e:v[t].value=an(e.trim(),!0)))})),a.push({cells:v}),s.colCount=Math.max(s.colCount,v.length),v=[]})),s.rowCount=a.length,s.usedRowIndex=a.length-1,s.usedColIndex=s.colCount-1}else if(t.clipboardData.files&&t.clipboardData.files[0]&&t.clipboardData.files[0].type.includes("image"))return l(),{file:t.clipboardData.files[0]};return l(),s},n.prototype.generateCells=function(t,r){var n=r.model,i=t.querySelector("table"),a=i.classList.contains("e-spreadsheet"),s={},o={};r.usedRowIndex=i.rows.length-1,r.rowCount=i.rows.length,a&&(r.selection=i.getAttribute("aria-label"),r.selection&&("Sheet"===r.selection?(r.usedRowIndex=Number(i.getAttribute("aria-rowcount")),r.usedColIndex=Number(i.getAttribute("aria-colcount"))):"Row"===r.selection?r.usedColIndex=Number(i.getAttribute("aria-colcount")):r.usedRowIndex=Number(i.getAttribute("aria-rowcount"))));var l=[];(0,e.isNullOrUndefined)(i)||(0,e.isNullOrUndefined)(i.getAttribute("style"))||(l.push(i.getAttribute("style")),this.generateStyles(l,s));var d,h,p,c,u,f,g,m=this.cellStyle(t,a),v=1;r.colCount=1;for(var y=[],C=0,b=r.usedRowIndex;C<=b;C++){d=i.rows[C],(0,e.isNullOrUndefined)(d.getAttribute("style"))||(y.push(d.getAttribute("style")),this.generateStyles(y,o)),n[C]||(n[C]={cells:[]}),h=n[C].cells,r.colCount=Math.max(r.colCount,d.cells.length),u=r.usedColIndex<d.cells.length?r.usedColIndex:d.cells.length-1;for(var x=0;x<=u;x++){if(c=d.cells[x],g=x,h[x]&&(x=this.getNewIndex(h,x)),h[x]={},p=m(c,o,s),c.textContent=c.textContent.replace(/(\r\n|\n|\r)/gm,""),c.textContent=c.textContent.replace(/\s+/g," "),p.whiteSpace&&"nowrap"!==p.whiteSpace&&(h[x].wrap=!0,delete p.whiteSpace),Object.keys(p).length&&(p.border&&(["borderBottom","borderTop","borderLeft","borderRight"].forEach((function(e){p[""+e]=p.border})),delete p.border),h[x].style=p),c.textContent&&(h[x].value=an(c.textContent.trim(),!0)),f=a?"num-format":"number-format",c.getAttribute(f)&&(h[x].format=c.getAttribute(f),h[x].value&&c.getAttribute("cell-value")&&(h[x].value=an(c.getAttribute("cell-value").trim(),!0))),c.getAttribute("colspan")&&parseInt(c.getAttribute("colspan"),10)>1&&(h[x].colSpan=parseInt(c.getAttribute("colspan"),10)),c.getAttribute("rowspan")&&parseInt(c.getAttribute("rowspan"),10)>1&&(h[x].rowSpan=parseInt(c.getAttribute("rowspan"),10)),h[x].colSpan>1&&h[x].rowSpan>1)for(var S=void 0,w=C,I=C+h[x].rowSpan;w<I;w++)for(var E=x,N=x+h[x].colSpan;E<N;E++)w===C&&E===x||(S=h[x].style?{style:(0,e.extend)({},h[x].style)}:{},w!==C&&(S.rowSpan=C-w),E!==x&&(S.colSpan=x-E),n[w]||(n[w]={cells:[]}),n[w].cells[E]=S);else if(h[x].colSpan>1)for(w=x+1,I=x+h[x].colSpan;w<I;w++)h[w]={colSpan:x-w,style:(0,e.extend)({},p)};else if(h[x].rowSpan>1)for(w=C+1,I=C+h[x].rowSpan;w<I;w++)n[w]||(n[w]={cells:[]}),n[w].cells[x]={rowSpan:C-w,style:(0,e.extend)({},p)};x=g}v=Math.max(v,h.length)}r.usedColIndex=v-1},n.prototype.getNewIndex=function(e,t){return e[t]&&(t++,t=this.getNewIndex(e,t)),t},n.prototype.cellStyle=function(e,t){var r,n,i=this;if(!t){r=e.querySelector("style")&&e.querySelector("style").innerHTML;var a=Object.keys(this.parent.commonCellStyle);if(a&&a.length&&r){var s=r.includes("td")?r.split("td")[1]:r;s=s.includes("{")?s.split("{")[1].split("}")[0]:s.split("}")[0],n={};for(var o=0;o<a.length;o++){var l=a[o],d=l.match(/[A-Z]/);d&&(l=l.replace(d[0],"-"+d[0].toLowerCase())),s.indexOf(l)>-1&&(n[a[o]]=s.split(l+":")[1].split(";")[0].trim())}}}return function(e,a,s){var o,l={};if(t){if(!e.getAttribute("style"))return l;o=e.getAttribute("style").split(";")}else{if(o=[],r&&e.className&&r.includes(e.classList[0])){var d=r.split(e.classList[0]);o.push(d[d.length-1].split("{")[1].split("}")[0])}var h=[].slice.call(e.querySelectorAll("*"));h.unshift(e),h.forEach((function(e){e.getAttribute("style")&&o.push(e.getAttribute("style")),"B"===e.tagName&&o.push("font-weight:bold"),"I"===e.tagName&&o.push("font-style:italic"),"U"===e.tagName&&o.push("text-decoration:underline")})),Object.assign(l,s,a,n)}return o.length&&i.generateStyles(o,l),e.querySelector("S")&&(l.textDecoration=l.textDecoration?"underline line-through":"line-through"),l.textDecoration&&-1===["underline","line-through","underline line-through","none"].indexOf(l.textDecoration)&&(l.textDecoration="none"),l.textAlign&&-1===["left","center","right"].indexOf(l.textAlign)&&(l.textAlign="left"),l.verticalAlign&&-1===["bottom","middle","top"].indexOf(l.verticalAlign)&&(l.verticalAlign="bottom"),l.fontSize&&(l.fontSize=Math.round(parseFloat(l.fontSize.indexOf("px")>-1?(.75*parseFloat(l.fontSize)).toString():l.fontSize.indexOf("em")>-1?(16*parseFloat(l.fontSize)/1.3333).toString():l.fontSize))+"pt"),l.fontWeight&&-1===["bold","normal"].indexOf(l.fontWeight)&&(l.fontWeight=l.fontWeight>"599"?"bold":"normal"),l}},n.prototype.generateStyles=function(e,t){var r,n,i,a,s,o=["font-family","vertical-align","text-align","text-indent","color","white-space","font-weight","font-style","font-size","text-decoration","background","background-color"],l=["fontFamily","verticalAlign","textAlign","textIndent","color","whiteSpace","fontWeight","fontStyle","fontSize","textDecoration","backgroundColor","backgroundColor"],d=["border-bottom","border-top","border-right","border-left","border"],h=["borderBottom","borderTop","borderRight","borderLeft","border"];e&&e.length&&e.forEach((function(e){e.split(";").forEach((function(e){if(n=e.split(":")[0].trim(),(r=o.indexOf(n))>-1)n=e.split(":")[1].trim(),t[l[r]]=n;else if((r=d.indexOf(n))>-1){if("none"===(n=e.split(":")[1].trim()))n=void 0;else if(n.includes("pt")){i=n.split("pt"),a=i[0].split(" ");for(var p=0;p<a.length;p++)if(s=parseFloat(a[p])){a.splice(p,1),a.unshift((s/.75).toFixed(2)+"px"),i[0]=a.join(" ");break}n=i.join("")}t[h[r]]=n}}))}))},n.prototype.refreshOnInsertDelete=function(e){if(this.copiedInfo){if(e.model.id!==this.copiedInfo.sId)return;var t=this.copiedInfo.range;if(e.isInsert){if("Column"===e.modelType){if(e.start<=t[3]){if(e.start<=t[1]){var r=e.end-e.start+1;t[1]+=r,t[3]+=r}else t[3]=t[1]+(e.start-t[1]-1);this.performAction()}}else if(e.start<=t[2]){if(e.start<=t[0]){r=e.end-e.start+1;t[0]+=r,t[2]+=r}else t[2]=t[1]+(e.start-t[1]-1);this.performAction()}}else this.clearCopiedInfo()}},n.prototype.performAction=function(){var e=this.getCopyIndicator();e&&Yl(this.parent,e,this.copiedInfo.range,"e-copy-indicator")},n.prototype.getClipboardEle=function(){return this.parent.element.getElementsByClassName("e-clipboard")[0]},n.prototype.getCopyIndicator=function(){return this.parent.element.getElementsByClassName("e-copy-indicator")[0]},n.prototype.getModuleName=function(){return"clipboard"},n.prototype.destroy=function(){this.removeEventListener();var t=this.getClipboardEle();(0,e.detach)(t),this.parent=null},n}(),rh=function(){function n(e){this.editorElem=null,this.editCellData={},this.isEdit=!1,this.isCellEdit=!0,this.isNewValueEdit=!0,this.isAltEnter=!1,this.curEndPos=null,this.curStartPos=null,this.uniqueColl="",this.uniqueActCell="",this.isSpill=!1,this.keyCodes={BACKSPACE:8,SPACE:32,TAB:9,DELETE:46,ESC:27,ENTER:13,FIRSTALPHABET:65,LASTALPHABET:90,FIRSTNUMBER:48,LASTNUMBER:59,FIRSTNUMPAD:96,LASTNUMPAD:111,SYMBOLSETONESTART:186,SYMBOLSETONEEND:192,SYMBOLSETTWOSTART:219,SYMBOLSETTWOEND:222,FIREFOXEQUALPLUS:61,FIREFOXMINUS:173,F2:113},this.formulaErrorStrings=["mismatched parentheses","requires 3 arguments","improper formula","empty expression","mismatched string quotes","wrong number of arguments","invalid arguments"],this.parent=e,this.addEventListener()}return n.prototype.destroy=function(){this.isEdit&&this.cancelEdit(!0,!1),this.removeEventListener(),this.editorElem=null,this.formulaErrorStrings&&(this.formulaErrorStrings=[]),this.editCellData&&(this.editCellData={}),this.keyCodes&&(this.keyCodes={}),this.parent=null},n.prototype.addEventListener=function(){e.Browser.isDevice&&"safari"===e.Browser.info.name&&(e.Browser.isIos||e.Browser.isIos7)?e.EventHandler.add(this.parent.element,"touchend",this.tapHandler,this):e.EventHandler.add(this.parent.element,"dblclick",this.dblClickHandler,this),this.parent.on(Jn,this.mouseDownHandler,this),this.parent.on(ii,this.keyUpHandler,this),this.parent.on(ai,this.keyDownHandler,this),this.parent.on(ei,this.performEditOperation,this),this.parent.on(ds,this.initiateCurPosition,this),this.parent.on(ps,this.updateFormulaBarValue,this),this.parent.on(cs,this.addressHandler,this),this.parent.on(us,this.initiateRefSelection,this),this.parent.on(fs,this.refSelectionRender,this),this.parent.on(Ee,this.checkUniqueRange,this),this.parent.on(Ne,this.reApplyFormula,this),this.parent.on(Ki,this.sheetChangeHandler,this),this.parent.on(Ka,this.readOnlyAlertHandler,this)},n.prototype.removeEventListener=function(){e.Browser.isDevice&&"safari"===e.Browser.info.name&&(e.Browser.isIos||e.Browser.isIos7)?e.EventHandler.remove(this.parent.element,"touchend",this.tapHandler):e.EventHandler.remove(this.parent.element,"dblclick",this.dblClickHandler),this.parent.isDestroyed||(this.parent.off(Jn,this.mouseDownHandler),this.parent.off(ii,this.keyUpHandler),this.parent.off(ai,this.keyDownHandler),this.parent.off(ei,this.performEditOperation),this.parent.off(ds,this.initiateCurPosition),this.parent.off(ps,this.updateFormulaBarValue),this.parent.off(cs,this.addressHandler),this.parent.off(us,this.initiateRefSelection),this.parent.off(fs,this.refSelectionRender),this.parent.off(Ee,this.checkUniqueRange),this.parent.off(Ne,this.reApplyFormula),this.parent.off(Ki,this.sheetChangeHandler),this.parent.off(Ka,this.readOnlyAlertHandler))},n.prototype.getModuleName=function(){return"edit"},n.prototype.performEditOperation=function(t){switch(t.action){case"renderEditor":if(this.renderEditor(),t.initLoad&&e.Browser.isDevice&&"safari"===e.Browser.info.name&&(e.Browser.isIos||e.Browser.isIos7)){var r=this.parent.createElement("div",{className:"e-ss-focus-edit",attrs:{contentEditable:"true",inputmode:"none",tabindex:"-1"}}),n=this.parent.element.querySelector(".e-sheet-panel");n&&(n.style.position="relative",n.appendChild(r)),this.parent.element.onfocus=function(){Fd(r)}}break;case"refreshEditor":this.refreshEditor(t.value,t.refreshFormulaBar,t.refreshEditorElem,t.isAppend,t.trigEvent),t.refreshCurPos&&this.setCursorPosition();break;case"startEdit":if(this.isEdit){var i={isEdit:!1};this.parent.notify($n,i),i.isEdit&&(this.isNewValueEdit=t.isNewValueEdit,this.startEdit(t.address,t.value,t.refreshCurPos))}else this.isNewValueEdit=t.isNewValueEdit,this.startEdit(t.address,t.value,t.refreshCurPos);break;case"endEdit":this.isEdit&&this.endEdit(t.refreshFormulaBar,null,t.isPublic);break;case"cancelEdit":this.isEdit&&this.cancelEdit(t.refreshFormulaBar);break;case"getCurrentEditValue":t.editedValue=this.editCellData.value,void 0!==t.endFormulaRef&&(t.endFormulaRef=this.endFormulaRef);break;case"refreshDependentCellValue":this.refreshDependentCellValue(t.rowIdx,t.colIdx,t.sheetIdx);break;case"getElement":t.element=this.getEditElement(this.parent.getActiveSheet());break;case"focusEditorElem":this.editorElem.focus();break;case"getCurrentEditSheetIdx":t.sheetIndex=this.editCellData.sheetIndex}},n.prototype.keyUpHandler=function(e){if(this.isEdit){var t=this.getEditElement(this.parent.getActiveSheet());if(e.altKey&&13===e.keyCode?(t.focus(),this.altEnter(),this.isAltEnter=!0):this.isCellEdit&&this.editCellData.value!==t.textContent&&16!==e.keyCode&&(!e.shiftKey||e.shiftKey&&!sd(e.keyCode))&&this.refreshEditor(t.textContent,this.isCellEdit),xr(this.editCellData.value,!0)&&(!e||16!==e.keyCode&&17!==e.keyCode&&(!e.shiftKey||!sd(e.keyCode)))&&(this.updateFormulaReference(t),this.endFormulaRef)){var r=this.getCurPosition(),n=["+","-","*","/",this.parent.listSeparator,"(","=","&",":"];r.end&&n.indexOf(this.editCellData.value[r.end-1])>-1&&(this.endFormulaRef=!1)}}},n.prototype.updateFormulaReference=function(e){var t=this.parent.element.querySelector(".e-formularef-indicator");t&&t.parentElement.removeChild(t),this.editCellData.value!==e.textContent&&this.refreshEditor(e.textContent,!0);var r=this.editCellData.sheetIndex,n=this.editCellData.value;this.parent.notify(ls,{range:n,formulaSheetIdx:r})},n.prototype.keyDownHandler=function(t){var n=t.target,i=t.keyCode,a=this.parent.getActiveSheet(),s=r(a.activeCell),o=Ln(s[0],s[1],a,!1,!0);if(!(0,e.closest)(n,".e-spreadsheet .e-dialog"))if(!a.isProtected||n.classList.contains("e-sheet-rename")||!Ar(o,bl(a,s[1]))||n.classList.contains("e-formula-bar")&&!n.disabled){if(this.isEdit){var l=this.getEditElement(a),d=xr(this.editCellData.value,!0);if((this.isCellEdit||d&&this.editCellData.value!==l.textContent&&16!==t.keyCode&&17!==t.keyCode)&&(s[1]<this.parent.frozenColCount(a)&&(!a.frozenRows||s[0]>=this.parent.frozenRowCount(a))&&l&&"auto"!==l.style.height&&Id(l.textContent,o.style,this.parent.cellStyle)>parseInt(l.style.maxWidth,10)&&(l.style.height="auto"),Id(l.textContent,o.style,this.parent.cellStyle)>parseInt(l.style.maxWidth,10)-5&&(l.style.height="auto"),s[0]<this.parent.frozenRowCount(a)&&l&&!l.style.overflow&&Id(l.textContent,o.style,this.parent.cellStyle)>parseInt(l.style.maxWidth,10)&&(l.style.overflow="auto"),(!t.shiftKey||t.shiftKey&&!sd(t.keyCode))&&this.refreshEditor(l.textContent,this.isCellEdit,!1,!1,!1)),!t.altKey)switch(i){case this.keyCodes.ENTER:if(e.Browser.isWindows&&t.preventDefault(),this.isAltEnter){var h=l.textContent;h&&h.indexOf("\n")>-1&&(Bn(this.parent.getActiveSheet().selectedRange,!0,this.parent,!0),this.refreshEditor(l.textContent,this.isCellEdit,!1,!1,!1),this.isAltEnter=!1)}if(d){var p=this.parent.element.querySelector(".e-formularef-indicator");p&&p.parentElement.removeChild(p),In(this.parent,this.editCellData.sheetIndex).id===a.id||this.parent.goTo(this.editCellData.fullAddr),this.endEdit(!1,t)}else this.endEdit(!1,t);break;case this.keyCodes.TAB:this.hasFormulaSuggSelected()||this.endEdit(!1,t);break;case this.keyCodes.ESC:this.cancelEdit(!0,!0,t)}}else if(n.classList.contains("e-spreadsheet")||(0,e.closest)(n,".e-sheet-panel")){13===i&&"true"===n.contentEditable&&t.preventDefault();var c=String.fromCharCode(i),u=i>=this.keyCodes.FIRSTALPHABET&&i<=this.keyCodes.LASTALPHABET||c.toLowerCase()!==c.toUpperCase()&&!(i>=112&&i<=123),f=i>=this.keyCodes.FIRSTNUMBER&&i<=this.keyCodes.LASTNUMBER,g=i>=this.keyCodes.FIRSTNUMPAD&&i<=this.keyCodes.LASTNUMPAD,m=i>=this.keyCodes.SYMBOLSETONESTART&&i<=this.keyCodes.SYMBOLSETONEEND;m||(m=i>=this.keyCodes.SYMBOLSETTWOSTART&&i<=this.keyCodes.SYMBOLSETTWOEND);var v=i===this.keyCodes.FIREFOXEQUALPLUS||i===this.keyCodes.FIREFOXMINUS,y=!t.shiftKey&&!t.ctrlKey&&!t.metaKey&&i===this.keyCodes.F2,C=i===this.keyCodes.BACKSPACE,b=/(Macintosh|MacIntel|MacPPC|Mac68K|Mac|Mac OS|iPod|iPad)/i.test(navigator.userAgent)&&C,x=this.parent.element.querySelector(".e-readonly-alert-dlg"),S=this.parent.element.getElementsByClassName("e-ss-overlay-active");if((!t.ctrlKey&&!t.metaKey&&!t.altKey&&(!t.shiftKey&&i===this.keyCodes.SPACE||u||f||g||m||"mozilla"===e.Browser.info.name&&v)||y||C)&&(y&&(this.isNewValueEdit=!1),x||(zd(this.parent)&&0===S.length?this.parent.notify(Ka,null):S.length?C&&!b&&this.editingHandler("delete"):(this.startEdit(null,null,!0,!0),Fd(this.getEditElement(a))))),i===this.keyCodes.DELETE||b){var w=a.isProtected&&Td(this.parent);x||(w?this.parent.notify(Xa,null):zd(this.parent)&&0===S.length?this.parent.notify(Ka,null):(this.editingHandler("delete"),this.parent.notify(ve,null)))}}}else if((i>=this.keyCodes.FIRSTALPHABET&&i<=this.keyCodes.LASTALPHABET||i>=this.keyCodes.FIRSTNUMBER&&i<=this.keyCodes.LASTNUMBER||i===this.keyCodes.DELETE||i===this.keyCodes.BACKSPACE||i===this.keyCodes.SPACE||i>=this.keyCodes.FIRSTNUMPAD&&i<=this.keyCodes.LASTNUMPAD||i>=this.keyCodes.SYMBOLSETONESTART&&i<=this.keyCodes.SYMBOLSETONEEND||i>=219&&i<=222||!t.shiftKey&&!t.ctrlKey&&!t.metaKey&&i===this.keyCodes.F2)&&67!==i&&89!==i&&90!==i){if(a.protectSettings.insertLink&&75===i)return;if(t.altKey&&(65===i||70===i||72===i||77===i||78===i||87===i))return;t.ctrlKey||70===t.keyCode||this.parent.element.querySelector(".e-editAlert-dlg")||n.parentElement.classList.contains("e-unprotectpwd-content")||n.parentElement.classList.contains("e-password-content")||n.parentElement.classList.contains("e-sheet-password-content")||n.parentElement.classList.contains("e-unprotectsheetpwd-content")||n.parentElement.classList.contains("e-reenterpwd-content")||this.parent.notify(Xa,null)}},n.prototype.renderEditor=function(){if(!this.editorElem||!(0,e.select)("#"+this.parent.element.id+"_edit",this.parent.element)){var t=this.parent.createElement("div",{id:this.parent.element.id+"_edit",className:"e-spreadsheet-edit",attrs:{contentEditable:"true",role:"textbox",spellcheck:"false","aria-multiline":"true"}});this.parent.element.getElementsByClassName("e-spreadsheet-edit")[0]&&this.parent.element.getElementsByClassName("e-spreadsheet-edit")[0].remove();var r=this.parent.element.querySelector(".e-sheet-content");if(!r)return;r.appendChild(t),this.editorElem=t}this.parent.notify(ti,{action:"renderAutoComplete"})},n.prototype.refreshEditor=function(e,t,r,n,i,a){void 0===i&&(i=!0),n?e=this.editCellData.value=this.editCellData.value+e:this.editCellData.value=a||e;var s=this.getEditElement(this.parent.getActiveSheet());r&&s&&(s.textContent=e),t&&this.parent.notify(ri,{action:"refreshFormulabar",value:e}),this.parent.isEdit&&s&&i&&this.editCellData.value===s.textContent&&this.triggerEvent("cellEditing").cancel&&this.cancelEdit(!1,!1,null,!0)},n.prototype.startEdit=function(e,t,n,i){void 0===n&&(n=!0),this.parent.showSheetTabs&&this.parent.element.querySelector(".e-add-sheet-tab").setAttribute("disabled","true");var a=this.parent.getActiveSheet(),s=r(a.activeCell),o=Ln(s[0],s[1],a,!1,!0);if("Manual"===this.parent.calculationMode&&xr(o.formula)&&(this.editCellData.prevFormulaValue=o.value),bd(this.parent,s[0],s[1],this.parent.activeSheetIndex)){var l=this.parent.getCell(s[0],s[1]),d=!1,h=l.innerHTML;if(l&&h.indexOf("<")>-1&&h.indexOf(">")>-1&&h.indexOf("input")>-1&&(d=!0),d)return}var p=this.updateEditCellDetail(e,t);this.initiateEditor(n,p),this.positionEditor(),this.parent.isEdit=this.isEdit=!0,this.parent.notify(Ai,null),this.parent.notify(wi,[{enable:!1}]),o.formula&&!i&&this.parent.notify(ls,{range:o.formula,formulaSheetIdx:this.editCellData.sheetIndex})},n.prototype.setCursorPosition=function(){var e=this.getEditElement(this.parent.getActiveSheet()),t=e.textContent.length;if(t){var r=document.getSelection(),n=document.createRange();n.setStart(e.firstChild,t),n.collapse(!0),r.removeAllRanges(),r.addRange(n)}e.focus()},n.prototype.hasFormulaSuggSelected=function(){var e=document.getElementById(this.parent.element.id+"_ac_popup");return e&&"visible"===e.style.visibility&&e.querySelectorAll(".e-item-focus").length>0},n.prototype.editingHandler=function(r){var n,i=document.getElementsByClassName("e-ss-overlay-active"),s=i.length;if("delete"===r)if(s>0)i[0].classList.contains("e-datavisualization-chart")?this.parent.notify(Ss,{id:i[0].id,sheetIdx:this.parent.activeSheetIndex+1}):this.parent.notify(xs,{id:i[0].id,sheetIdx:this.parent.activeSheetIndex+1});else{var d=this.parent.getActiveSheet(),h=d.selectedRange,p=o(h);h=a(p=p[0]>p[2]||p[1]>p[3]?c(p):p);var u={address:d.name+"!"+h,cancel:!1};if(this.parent.notify(K,{action:"cellDelete",eventArgs:u}),u.cancel)return;p=t(h=l(u.address)),Ld(this.parent,p,this.parent.activeSheetIndex),this.parent.notify(rr,{}),0===p[0]&&0===p[1]&&p[2]>=d.usedRange.rowIndex&&p[3]>=d.usedRange.colIndex&&this.parent.setUsedRange(0,0,d,!1,!0);var f={cellIdx:p,isUnique:!1};if(this.checkUniqueRange(f),f.isUnique){var g=t(this.uniqueColl);(S=Ln(g[0],g[1],this.parent.getActiveSheet()))&&S.value&&(n=S.value.toString().indexOf("#SPILL!")>-1)}if(f.isUnique&&this.uniqueColl.split(":")[0]===h.split(":")[0]){for(var m=t(this.uniqueColl),v=m[0];v<=m[2];v++)for(var y=m[1];y<=m[3];y++)this.parent.updateCell({value:"",formula:""},a([v,y]));this.parent.notify(Ie,null),this.uniqueColl=""}else if(f.isUnique){var C=t(this.uniqueColl);if("#SPILL!"===Ln(C[0],C[1],d).value){var b=!1;for(y=C[0];y<=C[2];y++)for(var x=C[1];x<=C[3];x++){var S=Ln(y,x,d);y===C[0]&&x===C[1]?b=!1:S&&!(0,e.isNullOrUndefined)(S.value)&&""!==S.value&&(b=!0)}b||this.reApplyFormula()}}f.isUnique?this.parent.notify(ka,{action:"cellDelete",eventArgs:{address:d.name+"!"+h,isSpill:n}}):this.parent.notify(ka,{action:"cellDelete",eventArgs:{address:d.name+"!"+h}})}},n.prototype.getCurPosition=function(){var e={},t=window.getSelection();if(t&&t.focusNode&&t.focusNode.classList&&t.focusNode.classList.contains("e-formula-bar-panel")){var r=t.focusNode.getElementsByClassName("e-formula-bar e-css")[0];r.value===this.editCellData.value&&(e.start=r.selectionStart,e.end=r.selectionEnd)}else if(this.getEditElement(this.parent.getActiveSheet()).textContent===this.editCellData.value&&(e.start=t.anchorOffset,e.end=t.focusOffset,e.start>e.end)){var n=e.start;e.start=e.end,e.end=n}return e},n.prototype.mouseDownHandler=function(t){if(!(0,e.closest)(t.target,".e-findtool-dlg")&&!(0,e.closest)(t.target,".e-validation-error-dlg")&&this.isEdit){var n=this.getCurPosition(),i=void 0,a=void 0;n.start&&(this.curStartPos=i=n.start),n.end&&(this.curEndPos=a=n.end);var s=t.target,o=this.parent.getActiveSheet(),l=this.parent.element.querySelector(".e-formularef-indicator");this.isCellEdit=s.classList.contains("e-spreadsheet-edit");var d=xr(this.editCellData.value,!0),h=this.getEditElement(o),p=["+","-","*","/",this.parent.listSeparator,"(","=","&",":"];if(s.classList.contains("e-cell")||s.classList.contains("e-header-cell")||s.classList.contains("e-selectall")||(0,e.closest)(s,".e-toolbar-item.e-active")||(0,e.closest)(s,".e-table")){if(this.isAltEnter){var c=h.textContent;c&&c.indexOf("\n")>-1&&(this.isAltEnter=!1,Bn(this.parent.getActiveSheet().selectedRange,!0,this.parent),this.refreshEditor(h.textContent,this.isCellEdit))}if(!d||this.endFormulaRef)this.endFormulaRef=!1,this.endEdit(!1,t);else{var u=r(o.activeCell),f=Ln(u[0],u[1],o),g=document.activeElement.classList.contains("e-formula-bar")?document.activeElement.value:h.textContent;if(this.editCellData.value===g)if(i===a){if(this.editCellData.sheetIndex!==vn(this.parent,o.name)){if(-1===p.indexOf(g.substring(i-1,i)))return l&&l.parentElement.removeChild(l),this.parent.goTo(this.editCellData.fullAddr),void this.endEdit(!1,t)}else if(-1===p.indexOf(h.textContent.substring(i-1,i)))return l&&l.parentElement.removeChild(l),void this.endEdit(!1,t)}else-1!==p.indexOf(g.substring(i-1,i))&&Sr(g.substring(i,a))&&g.indexOf(":")!==a&&(this.editCellData.value=g.substring(0,i)+g.substring(a,g.length));if(!f)return;if((d=f.formula&&(xr(f.formula)||this.editCellData.value&&0===this.editCellData.value.toString().indexOf("=")))&&this.parent.isEdit){var m=a;this.editCellData.value.length===m?(")"===this.editCellData.value.substring(this.editCellData.value.length-1)||rn(this.editCellData.value.substring(this.editCellData.value.length-1)))&&(l&&l.parentElement.removeChild(l),this.endEdit(!1,t)):this.editCellData.value===g&&-1===p.indexOf(g.substring(m-1,m))&&(l&&l.parentElement.removeChild(l),this.endEdit(!1,t))}}}else if(d&&this.editCellData.value===h.textContent&&h.textContent.indexOf("(")!==h.textContent.length-1&&!this.isCellEdit&&!s.classList.contains("e-formula-bar")&&-1===p.indexOf(this.editCellData.value.substring(i-1,i))&&In(this.parent,this.editCellData.sheetIndex).id===o.id){m=window.getSelection().focusOffset;if(-1===p.indexOf(h.textContent.substring(m-1,m)))return l&&l.parentElement.removeChild(l),this.parent.goTo(this.editCellData.fullAddr),void(this.isEdit&&this.endEdit(!1,t))}}},n.prototype.tapHandler=function(e){var t=this;if(!this.tapedTwice)return this.tapedTwice=!0,void setTimeout((function(){if(t.tapedTwice=!1,!t.parent.isEdit&&e.target.classList.contains("e-cell")){var r=t.parent.element.querySelector(".e-ss-focus-edit");r&&Fd(r)}}),300);e.preventDefault(),this.dblClickHandler(e)},n.prototype.dblClickHandler=function(t){var n=t.target;if(!(0,e.closest)(n,".e-datavisualization-chart")&&!n.classList.contains("e-ss-overlay")&&(n.classList.contains("e-active-cell")||n.classList.contains("e-cell")||n.classList.contains("e-wrap-content")||(0,e.closest)(n,".e-sheet-content")||n.classList.contains("e-table"))){var i=this.parent.getActiveSheet(),a=r(i.activeCell),s=Ln(a[0],a[1],i,!1,!0);if($r(s,bl(i,a[1]),hl(i,a[0])))this.parent.notify(Ka,null);else if(i.isProtected&&Ar(s,bl(i,a[1])))this.parent.notify(Xa,null);else if(this.isEdit){if(!n.classList.contains("e-spreadsheet-edit"))if(xr(this.editCellData.value)){var o=this.editCellData.fullAddr.substring(0,this.editCellData.fullAddr.lastIndexOf("!"));this.parent.getActiveSheet().name===o&&this.endEdit()}else this.endEdit()}else this.isNewValueEdit=!1,this.startEdit(),Fd(this.getEditElement(i))}},n.prototype.updateEditCellDetail=function(r,n){var i,a,s;if(i=(0,e.isNullOrUndefined)(this.editCellData.sheetIndex)?r&&r.lastIndexOf("!")>-1?vn(this.parent,Cn(r)):this.parent.activeSheetIndex:this.editCellData.sheetIndex,this.editCellData.addr?xr(this.editCellData.value,!0)&&(a=In(this.parent,i),this.isNewValueEdit=!1):(a=In(this.parent,i),r=r?l(r):a.activeCell),r){var o=t(r),d=o[0],h=o[1],p=Ln(d,h,a,!1,!0);if(p.colSpan>1||p.rowSpan>1){var c={sheet:a,cell:p,rowIdx:d,colIdx:h};Gr(c),d=c.rowIdx,h=c.colIdx,s=c.isMergedHiddenCell}var u=this.parent.getCell(d,h),f=Gl(a,o,this.parent.frozenRowCount(a),this.parent.frozenColCount(a),this.parent.viewport.beforeFreezeHeight,this.parent.viewport.beforeFreezeWidth,this.parent.sheetModule.colGroupWidth);this.editCellData={addr:r,fullAddr:On(this.parent,i)+"!"+r,rowIndex:d,colIndex:h,sheetIndex:i,element:u,value:n||"",position:f,prevFormulaValue:this.editCellData.prevFormulaValue}}return s},n.prototype.initiateEditor=function(t,r){var n=this;ln(this.parent,this.editCellData.fullAddr,!1,r).then((function(r){n.parent&&r.forEach((function(r){var i,a=function(){var e={cell:r,value:r?r.value:"",showFormattedText:n.editCellData.showFormattedText};n.parent.notify(me,e),i=r?r.formula||e.value:"",n.editCellData.oldValue=i};a();var s,o=n.triggerEvent("cellEdit",null,i);o.cancel?n.cancelEdit(!0,!1,null,!0):(o.showFormattedText&&(n.editCellData.showFormattedText=!0,a()),n.editCellData.value?i=n.editCellData.value:n.editCellData.value=i,n.isNewValueEdit?(s=i,i=""):n.isNewValueEdit=!0,(0,e.isUndefined)(i)||n.refreshEditor(i,!1,!0,!1,!1,s),t&&n.setCursorPosition())}))}))},n.prototype.positionEditor=function(t){var r,n=this.editCellData.element,i={isEdit:!1};if(this.parent.notify($n,i),i.isEdit&&(0,e.isNullOrUndefined)(n)&&(n=r=this.parent.getCell(this.editCellData.rowIndex,this.editCellData.colIndex),this.editCellData.element=r),n){n.classList.add("e-ss-edited");var a=this.parent.getActiveSheet(),s=Ln(this.editCellData.rowIndex,this.editCellData.colIndex,a,!1,!0),o=this.editCellData.position.left+1,l=this.editCellData.position.top+1,d={range:[this.editCellData.rowIndex,this.editCellData.colIndex,this.editCellData.rowIndex,this.editCellData.colIndex]};this.parent.notify(Et,d);var h=ml(a,d.range[0],d.range[2])-3,p=wl(a,d.range[1],d.range[3])-3,c=this.parent.getMainContent(),u=c.parentElement,f=void 0,g=this.parent.frozenColCount(a),m=void 0,v=void 0,y=this.parent.frozenRowCount(a),C=void 0;if(this.editCellData.colIndex<g)f=Math.abs(this.parent.getRowHeaderContent().getBoundingClientRect()[this.parent.enableRtl?"left":"right"]-n.getBoundingClientRect()[this.parent.enableRtl?"right":"left"])-1,this.editCellData.rowIndex<y?"2"===this.parent.getRowHeaderContent().style.zIndex&&(m="3"):Id(s.value,s.style,this.parent.cellStyle)>f&&(C=!0);else{f=u.offsetWidth-(o-c.scrollLeft)-28-this.parent.sheetModule.getRowHeaderWidth(a);var b=n.getBoundingClientRect(),x=u.getBoundingClientRect(),S=this.parent.enableRtl?b.left:b.right,w=this.parent.enableRtl?x.left:x.right,I=this.parent.getScrollElement(),E=this.parent.sheetModule.getScrollSize();this.parent.enableRtl?w+E>S&&(I.scrollLeft-=b.width):w-E<S&&(I.scrollLeft+=b.width)}this.editCellData.rowIndex<y&&(v=!0);var N=!v&&(s&&s.wrap||n&&t||C)?"auto;":h+"px;",R="display:block;top:"+l+"px;"+(this.parent.enableRtl?"right:":"left:")+o+"px;min-width:"+p+"px;max-width:"+(s&&s.wrap?p:f)+"px;height:"+N+(s&&s.wrap?"width:"+p+"px;":"")+"min-height:"+h+"px;"+(m?"z-index: "+m+";":"")+(v&&(s&&!s.wrap||n&&t)&&(Id(s.value,s.style,this.parent.cellStyle)>f||n&&t)?"overflow: auto;":"");n.style.cssText.split(";").forEach((function(e){e.includes("border")||(R+=e+";")}));var O=this.getEditElement(a,!0);O.setAttribute("style",R),Id(O.textContent,s.style,this.parent.cellStyle)>f&&(O.style.height="auto");var k=this.parent.element.querySelector(".e-active-cell");k&&(k.style.height=h+4+"px"),n.classList.contains("e-right-align")?O.classList.add("e-right-align"):n.classList.contains("e-center-align")&&O.classList.add("e-center-align")}},n.prototype.updateEditedValue=function(e,r,n,i){var a=this,s=this.editCellData.oldValue;r&&(this.editCellData.value=r);var o=this.editCellData.value;this.parent.notify(ya,{args:{action:"beforeCellSave",eventArgs:{address:this.editCellData.addr}}});var l=!0;if(this.parent.allowDataValidation){var d=this.parent.getActiveSheet(),h=t(d.activeCell),p=Ln(h[0],h[1],d,!1,!0),c=bl(d,h[1]);if(p.validation||El(c,h[0],h[1])){var u=this.editCellData.value||this.getEditElement(d).innerText,f=this.parent.activeSheetIndex,g={value:u,range:"string"==typeof this.editCellData.addr?t(this.editCellData.addr):this.editCellData.addr,sheetIdx:f,isEdit:!0,td:null,isValid:!0},m=Object.assign({},p,{value:u});Pn(h[0],h[1],d,m),this.parent.notify(Je,g),Pn(h[0],h[1],d,p),(l=g.isValid)?xr(u)||!p.format?this.editCellData.value||(this.editCellData.value=u):(u!==g.value||!this.editCellData.value&&g.value)&&(this.editCellData.value=g.value):this.isCellEdit=!0}}if(!i&&xr(this.editCellData.value)){var v={formula:this.editCellData.value};if(this.parent.notify(lr,v),v.isInvalid){var y;this.isCellEdit=!0,l=!1;var C=this.parent.serviceLocator.getService(kl),b=this.parent.serviceLocator.getService(Al);b.show({width:400,isModal:!0,showCloseIcon:!0,target:this.parent.element,cssClass:"e-validation-error-dlg",content:C.getConstant("CellReferenceTypoError")+"<br>"+v.formula,beforeOpen:function(){return a.editCellData.element.focus()},buttons:[{buttonModel:{content:C.getConstant("Yes"),isPrimary:!0},click:function(){y=!0,b.hide()}},{buttonModel:{content:C.getConstant("No")},click:function(){return b.hide()}}],close:function(){if(y)r=a.editCellData.value=v.formula,a.updateCell(s,e,r,o,n),a.parent.notify(ri,{action:"refreshFormulabar",value:v.formula});else{var t=a.getEditElement(a.parent.getActiveSheet());t.innerText&&window.getSelection().selectAllChildren(t)}}},!1)}}l?this.updateCell(s,e,r,o,n):n&&n.preventDefault()},n.prototype.updateCell=function(r,n,i,a,s){var o=r?r.toString().toUpperCase():"",l=this.parent.getActiveSheet();(r||0===r)&&(r=r.toString());var d=this.editCellData.value;d&&(d=d.toString());var h=r!==d||"Manual"===this.parent.calculationMode&&xr(o);if(h||o.indexOf("=NOW()")>-1||o.indexOf("NOW()")>-1||o.indexOf("=RAND()")>-1||o.indexOf("RAND()")>-1||o.indexOf("=RANDBETWEEN(")>-1||o.indexOf("RANDBETWEEN(")>-1){var p=t(l.activeCell);r&&r.indexOf("=UNIQUE(")>-1&&""===this.editCellData.value&&this.parent.notify(Ie,null);var c={cellIdx:p,isUnique:!1};this.checkUniqueRange(c);var u=c.isUnique;if(u&&""!==r&&""===this.editCellData.value)if(-1===Ln((x=t(this.uniqueColl))[0],x[1],l).value.toString().indexOf("#SPILL!"))return;r&&r.indexOf("UNIQUE")>-1&&this.editCellData.value&&this.editCellData.value.toString().indexOf("UNIQUE")>-1&&u&&this.updateUniqueRange("");var f={action:"updateCellValue",address:this.editCellData.addr,value:this.editCellData.value,skipCellFormat:this.editCellData.showFormattedText};this.parent.notify(ce,f);var g=Ln(p[0],p[1],l,!0),m=void 0;(0,e.isNullOrUndefined)(g)||(m=g.value.toString());var v="#CIRCULARREF!"===m;if(this.formulaErrorStrings.indexOf(m)>-1||v){var y=void 0;if(s){var C=s.target;["e-toolbar-item","e-tab-wrap","e-text-wrap","e-tab-text","e-caret"].some((function(e){return C.classList.contains(e)}))&&(0,e.closest)(C,".e-ribbon")||["e-scroller","e-main-panel","e-autofill"].some((function(e){return C.classList.contains(e)}))||(y=this.showFormulaAlertDlg(m,v)),y||s.preventDefault()}if(!y)return delete g.value,delete g.formula,this.parent.notify(Re,{cellRef:l.activeCell,clearFormulaInfo:!0}),void(xr(o)?this.parent.updateCellInfo({formula:o},l.activeCell):r&&this.parent.updateCellInfo({value:r},l.activeCell));g.value="0"}var b=void 0;f.isFormulaDependent&&(b=Wr(this.parent,this.parent.viewport));var x,S=Ln(p[0],p[1],l,!0),w=this.getRefreshNodeArgs(S,this.editCellData.element,this.editCellData.rowIndex,this.editCellData.colIndex);if(this.editCellData.value=w.value,this.parent.notify(Bt,{cell:null,rIdx:this.editCellData.rowIndex,cIdx:this.editCellData.colIndex,viewportIndexes:b}),l.conditionalFormats&&l.conditionalFormats.length&&this.parent.notify(kt,{indexes:[this.editCellData.rowIndex,this.editCellData.colIndex],isAction:!0,refreshAll:f.isFormulaDependent,isEdit:!0}),S&&S.formula&&(this.editCellData.formula=S.formula),S&&S.wrap&&this.parent.notify(Ge,{range:p,wrap:!0,sheet:l}),n&&this.parent.refreshNode(this.editCellData.element,w),S&&S.hyperlink&&this.parent.serviceLocator.getService("cell").refreshRange(p),u)if(Ln((x=t(this.uniqueColl))[0],x[1],l).value.toString().indexOf("#SPILL!")>-1&&(this.isSpill=!0),""!==r&&""===this.editCellData.value||this.editCellData.formula&&this.editCellData.formula.length>1&&r!==this.editCellData.formula){for(var I=!1,E=x[0];E<=x[2];E++)for(var N=x[1];N<=x[3];N++){var R=Ln(E,N,l);E===x[0]&&N===x[1]?I=!1:R&&!(0,e.isNullOrUndefined)(R.value)&&""!==R.value&&(I=!0)}I||this.reApplyFormula()}else this.updateUniqueRange(a)}this.triggerEvent("cellSave",s,i,!h),this.resetEditState(),this.focusElement(s)},n.prototype.checkUniqueRange=function(e){var r={range:[]};this.parent.notify(we,r);var n=r.range;e.sheetName||(e.sheetName=this.parent.getActiveSheet().name);for(var i=0;i<n.length;i++)if(n[i].substring(0,n[i].lastIndexOf("!"))===e.sheetName)for(var s=t(n[i]),o=s[0];o<=s[2];o++)for(var l=s[1];l<=s[3];l++)if(e.cellIdx[0]===o&&e.cellIdx[1]===l){e.isUnique=!0,this.uniqueCell=!0;var d=""!==this.uniqueColl?t(this.uniqueColl):[0,0,0,0],h=t(n[i]);if(d[0]===h[0]&&d[1]===h[1]){var p=[d[0],h[1],d[0],h[1]];p[2]=d[2]>h[2]?d[2]:h[2],p[3]=d[3]>h[3]?d[3]:h[3],this.uniqueColl=a(p),e.uniqueRange=a(p)}else this.uniqueColl=n[i],e.uniqueRange=n[i]}},n.prototype.updateUniqueRange=function(e){var r=t(this.uniqueColl),n=!1;"#SPILL!"!==Ln(r[0],r[1],this.parent.getActiveSheet()).value&&(n=!0);for(var i=r[0];i<=r[2];i++)for(var s=r[1];s<=r[3];s++)n&&(i===r[0]&&s===r[1]?this.parent.updateCell({value:"#SPILL!"},a([i,s])):a([i,s]).split(":")[0]===this.editCellData.addr?this.parent.updateCell({value:e},a([i,s])):this.parent.updateCell({value:""},a([i,s])))},n.prototype.reApplyFormula=function(){var e=t(this.uniqueColl),r=Ln(e[0],e[1],this.parent.getActiveSheet());this.parent.updateCell({value:""},a([e[0],e[1]]));for(var n=this.parent.sheets,i=r.formula,s=0;s<n.length;s++)i.indexOf(n[s].name)>-1&&(i=i.replace(n[s].name,"!"+s));this.parent.notify(pe,{action:"computeExpression",formula:i}),this.uniqueCell=!1,""!==this.uniqueActCell&&(this.editCellData.value=this.uniqueActCell,this.uniqueActCell="")},n.prototype.refreshDependentCellValue=function(e,r,n){if(e&&r&&(e--,r--,(this.editCellData.rowIndex!==e||this.editCellData.colIndex!==r)&&this.parent.activeSheetIndex===n||this.uniqueCell&&this.parent.activeSheetIndex===n)){var i=In(this.parent,n),a=void 0;if(cl(i,e)||Il(i,r)||(a=this.parent.getCell(e,r)),a){if(a.parentElement){var s=a.parentElement.getAttribute("aria-rowindex");if(s&&Number(s)-1!==e)return}var o=Ln(e,r,i),l=t(i.activeCell);l[0]===e&&l[1]===r&&(this.uniqueActCell=o.value);var d=this.getRefreshNodeArgs(o,a,e,r);this.parent.refreshNode(a,d)}}},n.prototype.getRefreshNodeArgs=function(e,t,r,n){var i={value:(e=e||{}).value,format:e.format,formattedText:e.value,isRightAlign:!1,type:"General",cell:e,rowIndex:r,td:t,colIndex:n,refresh:!0,isEdit:!0};return this.parent.notify(re,i),i},n.prototype.endEdit=function(e,t,r){void 0===e&&(e=!1),e&&this.refreshEditor(this.editCellData.oldValue,!1,!0,!1,!1);var n=this.triggerEvent("beforeCellSave");if(n.cancel)this.parent.isEdit&&t&&t.preventDefault();else{if(n.value&&n.value.toString().indexOf("\n")>-1){var i=Ln(this.editCellData.rowIndex,this.editCellData.colIndex,this.parent.getActiveSheet());Bn(this.parent.getActiveSheet().selectedRange,!i||!1!==i.wrap,this.parent),this.refreshEditor(n.value,this.isCellEdit,!1,!1,!1)}this.updateEditedValue(!0,n.value,t,r)}},n.prototype.cancelEdit=function(e,t,r,n){void 0===e&&(e=!0),void 0===t&&(t=!0),this.refreshEditor(this.editCellData.oldValue,e,!1,!1,!1),n||(t?this.triggerEvent("cellSave",r,void 0,!0):this.triggerEvent("cellEdited")),this.resetEditState(),this.focusElement()},n.prototype.focusElement=function(e){if(e&&9===e.keyCode&&document.activeElement.classList.contains("e-formula-bar")){var t=this.parent.element.querySelector(".e-formula-bar-panel "+(e.shiftKey?".e-insert-function":".e-combobox"));t&&Fd(t)}else Fd(this.parent.element);this.parent.notify(wi,[{enable:!0}])},n.prototype.triggerEvent=function(e,r,n,i){var a=this.parent.getActiveSheet(),s=Ln(this.editCellData.rowIndex,this.editCellData.colIndex,a),o={element:this.editCellData.element,value:n||this.editCellData.value,oldValue:this.editCellData.oldValue,address:this.editCellData.fullAddr,displayText:this.parent.getDisplayText(s),previousFormulaValue:this.editCellData.prevFormulaValue};if(o.address){var l={cellIdx:t(o.address),isUnique:!1};this.checkUniqueRange(l),l.isUnique&&(o.isSpill=this.isSpill)}var d=(o.value?o.value.toString():o.value)!==(o.oldValue||0===o.oldValue?o.oldValue.toString():o.oldValue);if(d||"Manual"===this.parent.calculationMode&&!i&&xr(o.value)){if("cellSave"!==e&&(o.cancel=!1),"beforeCellSave"===e)if(this.parent.notify(K,{eventArgs:o,action:"cellSave",preventAction:!0}),s=xr(o.value)?{formula:o.value}:{value:o.value},Hr(this.parent,a,{cell:s,rowIdx:this.editCellData.rowIndex,colIdx:this.editCellData.colIndex,eventOnly:!0}))return this.cancelEdit(!1,!1,null,!0),o.cancel=!0,o;this.parent.trigger(e,o),"cellSave"===e&&(this.parent.trigger("cellEdited",o),this.editCellData.formula?o.formula=this.editCellData.formula:d||(o.formula=o.value),o.originalEvent=r,this.parent.notify(ka,{eventArgs:o,action:"cellSave"}))}else"beforeCellSave"!==e&&("cellSave"===e?this.parent.trigger("cellEdited",o):this.parent.trigger(e,o));return o},n.prototype.altEnter=function(){this.positionEditor(!0);var e,t=window.getSelection(),r=t.anchorNode,n=document.createRange();0===(e=3===r.nodeType?t.anchorOffset:r.textContent.length)&&r.textContent.length>0&&(e=r.textContent.length);var i=r.textContent,a=i.slice(0,e),s=i.slice(e)||" ";r.textContent=a+"\n"+s,n=document.createRange(),3===r.nodeType?(n.setStart(r,e+1),n.setEnd(r,e+1)):1===r.nodeType&&(n.setStart(r.firstChild,e+1),n.setEnd(r.firstChild,e+1)),t.removeAllRanges(),t.addRange(n)},n.prototype.resetEditState=function(t){if(void 0===t&&(t=!0),t){var r=this.getEditElement(this.parent.getActiveSheet());(xr(r.textContent)||""===r.textContent)&&this.parent.notify(hs,null),this.editCellData.element&&(this.editCellData.element.classList.remove("e-ss-edited"),this.editorElem.textContent="",r===this.editorElem?(this.editorElem.removeAttribute("style"),this.editorElem.classList.remove("e-right-align")):(0,e.detach)(r))}if(this.editCellData={},this.parent.isEdit=this.isEdit=!1,this.isCellEdit=!0,this.parent.notify(ti,{action:"endEdit"}),this.parent.showSheetTabs&&!this.parent.isProtected){var n=this.parent.element.querySelector(".e-add-sheet-tab");n&&n.removeAttribute("disabled")}},n.prototype.refSelectionRender=function(){var e=this.getEditElement(this.parent.getActiveSheet());e&&xr(e.textContent)&&this.parent.notify(ls,{range:e.textContent,formulaSheetIdx:this.editCellData.sheetIndex})},n.prototype.initiateRefSelection=function(){var e=this.editCellData.fullAddr.substring(0,this.editCellData.fullAddr.lastIndexOf("!")),t=this.editCellData.value;this.parent.getActiveSheet().name===e&&xr(this.editCellData.value,!0)?(this.startEdit(this.editCellData.addr,t,!1),this.parent.notify(ls,{range:this.editCellData.value,formulaSheetIdx:this.editCellData.sheetIndex}),this.getEditElement(this.parent.getActiveSheet()).textContent=t,this.initiateCurPosition()):this.initiateCurPosition()},n.prototype.addressHandler=function(e){var t=this.parent.serviceLocator.getService(Al).dialogInstance;if(t&&t.element&&t.element.classList.contains("e-validation-error-dlg"))e.isAlertDlgOpen=!0;else{if(!this.curStartPos){var r=this.getCurPosition();r.start&&(this.curStartPos=r.start),r.end&&(this.curEndPos=r.end)}var n=e.range,i=this.editCellData.sheetIndex,a=this.getEditElement(this.parent.getActiveSheet());this.parent.activeSheetIndex!==i&&(n="'"+this.parent.getActiveSheet().name+"'!"+n);var s=this.editCellData.value;if(e.isSelect)this.parent.notify(ls,{range:s+n,formulaSheetIdx:i});else if(this.parent.activeSheetIndex===i){var o=void 0,l=void 0,d=document.activeElement.classList.contains("e-formula-bar")?document.activeElement.value:a.textContent;e.isMouseDown&&d!==s?(o=d.substring(0,this.curEndPos)+this.parent.listSeparator,l=d.substring(this.curEndPos),this.refreshEditor(o+l,!1,!0),this.parent.notify(ls,{range:a.textContent,formulaSheetIdx:i}),this.curEndPos+=this.parent.listSeparator.length,this.curStartPos=this.curEndPos,o+=n):(o=s.substring(0,this.curStartPos)+n,l=s.substring(this.curStartPos)),a.textContent=o+l,this.curEndPos=o.length}}},n.prototype.updateFormulaBarValue=function(e){var t=this.editCellData.value,r=this.parent.getActiveSheet().selectedRange.split(" "),n=r[r.length-1];n=m(o(n))?n.split(":")[0]:n;var i=this.parent.element.querySelector(".e-formula-bar");if(t&&xr(t,!0)){var a=this.editCellData.fullAddr.substring(0,this.editCellData.fullAddr.lastIndexOf("!")),s=this.parent.getActiveSheet().name!==a;s&&(n="'"+this.parent.getActiveSheet().name+"'!"+n);var l=void 0,d=void 0;s&&e.isMouseDown&&r.length>1&&e.formulaBarVal&&e.formulaBarVal!==t?(l=e.formulaBarVal.substring(0,this.curEndPos)+this.parent.listSeparator,d=e.formulaBarVal.substring(this.curEndPos),this.refreshEditor(l+d,!0),this.curEndPos+=this.parent.listSeparator.length,this.curStartPos=this.curEndPos,l+=n):(l=t.substring(0,this.curStartPos)+n,d=t.substring(this.curStartPos)),i.value=l+d,this.curEndPos=l.length}},n.prototype.setFormulaBarCurPosition=function(e,t,r){e.setSelectionRange&&(e.focus(),e.selectionStart=t,e.selectionEnd=t,e.setSelectionRange(t,r))},n.prototype.initiateCurPosition=function(e){void 0===e&&(e={isCellEdit:!1});var t=this.getEditElement(this.parent.getActiveSheet(),!0);if(e.isCellEdit){var r=this.getCurPosition();if(!this.endFormulaRef&&r.start===r.end){this.updateFormulaReference(t);var n=["+","-","*","/",this.parent.listSeparator,"(","=","&",":"];r.end&&-1===n.indexOf(this.editCellData.value[r.end-1])&&(this.endFormulaRef=!0)}}else{var i=t.innerText,a=window.getSelection();if(a&&a.focusNode&&a.focusNode.classList&&a.focusNode.classList.contains("e-formula-bar-panel")){var s=this.parent.element.querySelector(".e-formula-bar");this.setFormulaBarCurPosition(s,this.curEndPos,this.curEndPos)}else{if(i){var o=document.createRange();i.indexOf(")"),i.length,o.setStart(t.childNodes[0],this.curEndPos),o.setEnd(t.childNodes[0],this.curEndPos),a.removeAllRanges(),a.addRange(o)}if(this.editCellData.sheetIndex!==this.parent.activeSheetIndex){var l=this.parent.element.querySelector(".e-formula-bar");l.value&&(l.value.indexOf(")")===this.curEndPos-1?this.setFormulaBarCurPosition(l,this.curEndPos-1,this.curEndPos-1):this.setFormulaBarCurPosition(l,this.curEndPos,this.curEndPos))}}}},n.prototype.getEditElement=function(e,t){if((this.isEdit||t)&&(e.frozenRows||e.frozenColumns)){var n=this.parent.frozenRowCount(e),i=this.parent.frozenColCount(e),a=r(e.activeCell),s=void 0;if(a[0]<n&&a[1]<i)s=this.parent.getSelectAllContent();else if(a[0]<n)s=this.parent.getColumnHeaderContent();else{if(!(a[1]<i))return this.editorElem;s=this.parent.getRowHeaderContent()}var o=s.getElementsByClassName("e-spreadsheet-edit")[0];return!o&&t&&(o=s.appendChild(this.editorElem.cloneNode())),o}return this.editorElem},n.prototype.sheetChangeHandler=function(){this.isEdit||(this.editCellData.value=null)},n.prototype.showFormulaAlertDlg=function(e,t){var r,n,i=this,a=this.parent.serviceLocator.getService(kl),s=this.parent.serviceLocator.getService("dialog"),o=this.getFormulaErrorKey(e),l=a.getConstant(o),d=s.dialogInstance;return d&&d.visible&&d.element.classList.contains("e-circularref-dlg")||s.show({width:400,isModal:!0,showCloseIcon:!0,target:this.parent.element,cssClass:"e-validation-error-dlg e-circularref-dlg",content:l,beforeOpen:function(e){if(t){var a=i.parent.getActiveSheet(),o={dialogName:"CircularReferenceDialog",element:e.element,target:e.target,cancel:e.cancel,cellAddress:a.name+"!"+a.activeCell,content:l};if(i.parent.trigger("dialogBeforeOpen",o),o.cancel)return e.cancel=n=!0,void s.hide(!0);o.content!==l&&(s.dialogInstance.content=o.content,s.dialogInstance.dataBind())}if(window.getSelection().rangeCount>0){var d=window.getSelection().getRangeAt(0);r=d.endOffset}},buttons:[{buttonModel:{content:a.getConstant("Ok"),isPrimary:!0},click:function(){return s.hide()}}],close:function(){if(!n){var e=i.getEditElement(i.parent.getActiveSheet());if(e.childElementCount){var t=e.textContent;r=t.length,e.textContent=t}var a=document.getSelection(),s=document.createRange();s.setStart(e.firstChild,r),s.collapse(!0),a.removeAllRanges(),a.addRange(s),e.focus()}}},!1),n},n.prototype.getFormulaErrorKey=function(e){var t;switch(e){case"invalid arguments":t="InvalidArguments";break;case"improper formula":t="ImproperFormula";break;case"empty expression":t="EmptyExpression";break;case"mismatched parentheses":t="MismatchedParenthesis";break;case"mismatched string quotes":t="MismatchedStringQuotes";break;case"wrong number of arguments":t="WrongNumberOfArguments";break;case"requires 3 arguments":t="Requires3Arguments";break;case"#CIRCULARREF!":t="FormulaCircularRef";break;default:t="InvalidFormulaError"}return t},n.prototype.readOnlyAlertHandler=function(){var t,r=this,n=this.parent.serviceLocator.getService(kl),i=this.parent.serviceLocator.getService("dialog"),a=this.parent.element.querySelector(".e-find-dlg");(0,e.isNullOrUndefined)(a)||(t=(0,e.getComponent)(a,"dialog")),i.show({content:n.getConstant("ReadonlyAlert"),isModal:!0,closeOnEscape:!0,showCloseIcon:!0,width:"400px",cssClass:"e-readonly-alert-dlg",beforeOpen:function(e){var t={dialogName:"ReadOnlyAlertDialog",content:n.getConstant("ReadonlyAlert"),element:e.element,target:e.target,cancel:e.cancel};r.parent.trigger("dialogBeforeOpen",t),t.cancel&&(e.cancel=!0,Bl((function(){return i.destroyDialog()}))),i.dialogInstance.content=t.content,Fd(r.parent.element)},close:function(){(0,e.isNullOrUndefined)(a)||(i.dialogInstance=t),Fd(r.parent.element)}})},n}(),nh=function(){function n(e){this.invalidOperators=["%"],this.formulaRange=[],this.isNoteActiveElement=!1,this.isNoteTouch=!1,this.parent=e,this.addEventListener(),this.mouseMoveEvt=this.mouseMoveHandler.bind(this)}return n.prototype.addEventListener=function(){this.parent.on(Zn,this.init,this),this.parent.on(Jn,this.mouseDownHandler,this),this.parent.on(ui,this.virtualContentLoadedHandler,this),this.parent.on(gi,this.cellNavigateHandler,this),this.parent.on(Ei,this.selectRange,this),this.parent.on(Wi,this.rowHeightChanged,this),this.parent.on(Gi,this.colWidthChanged,this),this.parent.on(Ja,this.protectHandler,this),this.parent.on(ls,this.initiateFormulaSelection,this),this.parent.on(hs,this.clearBorder,this),this.parent.on(ys,this.getRowIdxFromClientY,this),this.parent.on(Cs,this.getColIdxFromClientX,this),this.parent.on(cr,this.getRowIdxFromClientY,this),this.parent.on(ur,this.getColIdxFromClientX,this),this.parent.on(Rs,this.chartBorderHandler,this),this.parent.on(_s,this.isTouchSelectionStarted,this),this.parent.on(Ni,this.selectionByKeydown,this)},n.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(Zn,this.init),this.parent.off(Jn,this.mouseDownHandler),this.parent.off(ui,this.virtualContentLoadedHandler),this.parent.off(gi,this.cellNavigateHandler),this.parent.off(Ei,this.selectRange),this.parent.off(Wi,this.rowHeightChanged),this.parent.off(Gi,this.colWidthChanged),this.parent.off(Ja,this.protectHandler),this.parent.off(ls,this.initiateFormulaSelection),this.parent.off(hs,this.clearBorder),this.parent.off(ys,this.getRowIdxFromClientY),this.parent.off(Cs,this.getColIdxFromClientX),this.parent.off(cr,this.getRowIdxFromClientY),this.parent.off(ur,this.getColIdxFromClientX),this.parent.off(Rs,this.chartBorderHandler),this.parent.off(_s,this.isTouchSelectionStarted),this.parent.off(Ni,this.selectionByKeydown))},n.prototype.isTouchSelectionStarted=function(e){e.touchSelectionStarted=this.touchSelectionStarted},n.prototype.selectionByKeydown=function(e){this.selectRangeByIdx(e.range,e.e,!1,!1,!1,!1,void 0,!1)},n.prototype.rowHeightChanged=function(e){var n=this;e.threshold&&Bl((function(){if(n.parent){var i=n.parent.getActiveSheet(),a=n.getActiveCell();if(a&&(i.frozenRows||i.frozenColumns||i.selectedRange.includes(" ")))n.selectRange({address:i.selectedRange});else{var s,o=c(t(i.selectedRange)),l={range:o,isActiveCell:!1,skipChecking:!0};if(a){var d=r(i.activeCell)[0];if(n.parent.notify(It,l),l.isActiveCell)s=Ln(o[0],o[1],i,!1,!0).rowSpan>1&&o[0]<=e.rowIdx&&o[2]>=e.rowIdx;d===e.rowIdx||s?a.style.height=parseFloat(a.style.height)+e.threshold+"px":d>e.rowIdx&&(a.style.top=parseFloat(a.style.top)+e.threshold+"px")}if(a=n.getSelectionElement()){if(s||o[0]===o[2]&&o[1]===o[3])return;var h=o[0],p=o[2];h<=e.rowIdx&&p>=e.rowIdx&&a?a.style.height=parseFloat(a.style.height)+e.threshold+"px":h>e.rowIdx&&a&&(a.style.top=parseFloat(a.style.top)+e.threshold+"px")}}}}))},n.prototype.colWidthChanged=function(e){var n=this;e.threshold&&Bl((function(){if(n.parent){var i=n.parent.getActiveSheet(),a=n.getActiveCell(),s=n.parent.enableRtl;if(a&&(i.frozenRows||i.frozenColumns||i.selectedRange.includes(" ")))n.selectRange({address:i.selectedRange});else{var o,l=c(t(i.selectedRange)),d={range:l,isActiveCell:!1,skipChecking:!0};if(a){n.parent.notify(It,d);var h=r(i.activeCell)[1];if(d.isActiveCell){var p=Ln(l[0],l[1],i,!1,!0);o=p.rowSpan>1||p.colSpan>1}h===e.colIdx||o?a.style.width=parseFloat(a.style.width)+e.threshold+"px":h>e.colIdx&&(s?a.style.right=parseFloat(a.style.right)+e.threshold+"px":a.style.left=parseFloat(a.style.left)+e.threshold+"px")}if((a=n.getSelectionElement())&&!o&&(l[0]!==l[2]||l[1]!==l[3])){var u=l[1],f=l[3];u<=e.colIdx&&f>=e.colIdx&&a?a.style.width=parseFloat(a.style.width)+e.threshold+"px":u>e.colIdx&&a&&(s?a.style.right=parseFloat(a.style.right)+e.threshold+"px":a.style.left=parseFloat(a.style.left)+e.threshold+"px")}}}}))},n.prototype.selectRange=function(e){e.address="Single"===this.parent.selectionSettings.mode?a(r(e.address)):e.address,this.selectMultiRange(e.address,null,null,e.skipChecking)},n.prototype.init=function(){this.createSelectionElement();var e=this.parent.getActiveSheet(),n=c(t(e.selectedRange)),i=r(e.activeCell),a=n[0]<=i[0]&&n[2]>=i[0]&&n[1]<=i[1]&&n[3]>=i[1];this.selectMultiRange(e.selectedRange,!0,a)},n.prototype.selectMultiRange=function(e,r,n,i){var a=this,s=this.parent.activeSheetIndex;e.indexOf("!")>-1&&(s=vn(this.parent,Cn(e)),e=e.substring(e.lastIndexOf("!")+1)),this.parent.activeSheetIndex===s?e.split(" ").forEach((function(e,s){a.selectRangeByIdx(t(e),{type:"mousedown",ctrlKey:0!==s},null,n,r,i)})):xn(this.parent,e,this.parent.sheets[s])},n.prototype.createSelectionElement=function(){var e=this.parent.getMainContent(),t=this.parent.createElement("div",{className:"e-selection"});e.appendChild(t),t=this.parent.createElement("div",{className:"e-active-cell"}),e.appendChild(t)},n.prototype.mouseDownHandler=function(n){var i=this;if(this.isNoteActiveElement=!(0,e.isNullOrUndefined)(document)&&!(0,e.isNullOrUndefined)(document.activeElement)&&"string"==typeof document.activeElement.className&&document.activeElement.className.indexOf("e-addNoteContainer")>-1,!((0,e.closest)(n.target,".e-scrollbar")||n.target.classList.contains("e-main-panel")||n.target.classList.contains("e-sheet"))){var s={action:"getCurrentEditValue",editedValue:""},l=this.parent.getActiveSheet();this.parent.notify(ei,s);var d=xr(s.editedValue,!0),h=this.parent.enableNotes&&!(0,e.isNullOrUndefined)(this.parent.spreadsheetNoteModule.noteCellIndexes)?this.parent.spreadsheetNoteModule.noteCellIndexes:r(this.parent.getActiveSheet().activeCell),p=this.parent.getCell(h[0],h[1]);if(!(0,e.isNullOrUndefined)(p)&&null!==p.children&&p.children.length>0&&this.isNoteActiveElement&&p.children[p.children.length-1].classList.contains("e-addNoteIndicator")){var c=Ln(h[0],h[1],l),u=!(0,e.isNullOrUndefined)(c)&&c.notes?"editNote":"addNote",f=document.getElementsByClassName("e-addNoteContainer")[0],g=On(this.parent,this.parent.activeSheetIndex)+"!"+a(h);if((0,e.isNullOrUndefined)(f)||(0,e.isNullOrUndefined)(f.value)||"e-addNoteContainer"===n.target.className||!(0,e.isNullOrUndefined)(c)&&!(0,e.isNullOrUndefined)(c.notes)&&c.notes===f.value)"e-addNoteContainer"!==n.target.className&&Hr(this.parent,this.parent.getActiveSheet(),{rowIdx:h[0],colIdx:h[1],preventEvt:!0,cell:{isNoteEditable:!1}});else{this.parent.notify(ya,{args:{action:"beforeCellSave",eventArgs:{address:g}}}),Hr(this.parent,this.parent.getActiveSheet(),{rowIdx:h[0],colIdx:h[1],preventEvt:!0,cell:{notes:f.value,isNoteEditable:!1}});var v={notes:f.value,address:g};this.parent.notify(ka,{eventArgs:v,action:u})}this.parent.spreadsheetNoteModule.isShowNote=null}if(!this.isNoteTouch&&"e-addNoteContainer"!==n.target.className&&document.getElementsByClassName("e-addNoteContainer")&&document.getElementsByClassName("e-addNoteContainer").length>0&&this.parent.notify(pa,""),this.isNoteTouch&&n.type.indexOf("mouse")>-1&&(this.isNoteTouch=!1),!this.parent.isEdit||d){var y=document.getElementById(this.parent.element.id+"_overlay");if("string"==typeof n.target.className){if(n.target.className.indexOf("e-ss-overlay")>-1)return}else y&&y.classList.remove("e-ss-overlay-active");if((0,e.closest)(n.target,".e-datavisualization-chart"))return;if(l.isProtected&&!l.protectSettings.selectCells&&!l.protectSettings.selectUnLockedCells)return;if(!(0,e.closest)(n.target,".e-findtool-dlg")&&!(0,e.closest)(n.target,".e-dragfill-ddb")&&this.getSheetElement().contains(n.target)&&!n.target.classList.contains("e-colresize")&&!n.target.classList.contains("e-rowresize")){var C=this.parent.getActiveSheet(),b=this.parent.selectionSettings.mode,x=this.getRowIdxFromClientY({clientY:ld(n),target:n.target}),S=this.getColIdxFromClientX({clientX:od(n),target:n.target}),w=r(C.activeCell),I=void 0,E=void 0;if(C.showHeaders){var N=n.target;if(C.frozenColumns||C.frozenRows){var R=this.parent.getSelectAllContent().querySelector("thead");E=R?(this.parent.getColumnHeaderContent().contains(N)||R.contains(N))&&N.classList.contains("e-header-cell"):this.parent.getColumnHeaderContent().contains(N)&&N.classList.contains("e-header-cell"),I=(R=this.parent.getSelectAllContent().querySelector("tbody"))?(this.parent.getRowHeaderContent().contains(N)||R.contains(N))&&N.classList.contains("e-header-cell"):this.parent.getRowHeaderContent().contains(N)&&N.classList.contains("e-header-cell")}else I=this.parent.getRowHeaderContent().contains(n.target),E=this.parent.getColumnHeaderContent().contains(n.target)}if(3===n.which&&this.isSelected(x,S))return;if(n.target.classList.contains("e-autofill")){this.isautoFillClicked=!0;var O=n.target.parentElement&&n.target.parentElement.querySelector(".e-dragfill-ddb");O&&!O.classList.contains("e-hide")||(this.dAutoFillCell=C.selectedRange)}var k=t(C.topLeftCell),A=void 0;if(I?(this.isRowSelected=!0,n.shiftKey&&"Single"!==b||(this.startCell=[x,0]),A=[this.startCell[0],C.frozenColumns?k[1]:0,x,C.colCount-1]):E?(this.isColSelected=!0,n.shiftKey&&"Single"!==b||(this.startCell=[0,S]),A=[C.frozenRows?k[0]:0,this.startCell[1],C.rowCount-1,S]):(0,e.closest)(n.target,".e-select-all-cell")?(this.startCell=[C.frozenRows?k[0]:0,C.frozenColumns?k[1]:0],A=[].concat(this.startCell,[C.rowCount-1,C.colCount-1])):n.target.classList.contains("e-sheet-content")||(n.shiftKey&&"Single"!==b||(this.startCell=[x,S]),this.isautoFillClicked||(0,e.closest)(n.target,".e-filloption")||(A=[].concat(this.startCell?this.startCell:r(C.activeCell),[x,S]))),ed(n)&&!I&&!E&&A){var F=this.isRowColSelected(A);this.isRowSelected=F.isRowSelected,this.isColSelected=F.isColSelected}var T=n.ctrlKey&&A&&C.selectedRange.includes(a(A));if(!T&&"Multiple"===b&&(!rd(n)&&(!ed(n)||ed(n)&&w[0]===x&&w[1]===S)||E||I)?(document.addEventListener(Jl().split(" ")[0],this.mouseMoveEvt),e.Browser.isPointer||(e.Browser.isIos&&ed(n)&&n.target&&n.target.classList.contains("e-cell")&&n.preventDefault(),document.addEventListener(Jl().split(" ")[1],this.mouseMoveEvt,{passive:!1})),this.touchSelectionStarted=!0):this.touchSelectionStarted=!1,!rd(n))if(T){if(this.parent.isEdit){var D=function(t){e.EventHandler.remove(document,Ql(),D),i.updateFormulaCursorPosition(t)};e.EventHandler.add(document,Ql(),D,this)}}else e.EventHandler.add(document,Ql(),this.mouseUpHandler,this);var L="e-addNoteIndicator"===n.target.className||n.target.children.length>0&&n.target.children[n.target.childElementCount-1].className.indexOf("e-addNoteIndicator")>-1;if(ed(n)&&L){var P=r(a(A).split(":")[0]);this.parent.notify(la,{rowIndex:P[0],columnIndex:P[1],isNoteEditable:!1}),this.isNoteTouch=!0,this.parent.spreadsheetNoteModule.isNoteVisibleOnTouch=!0}if(ed(n)&&!E&&!I)return void(this.touchEvt=n);if(A&&this.selectRangeByIdx(A,n),!this.isNoteTouch&&n.type.indexOf("mouse")>-1&&L){var M=r(a(A).split(":")[0]);this.parent.notify(la,{rowIndex:M[0],columnIndex:M[1],isNoteEditable:!1}),this.parent.spreadsheetNoteModule.isNoteVisible=!0}this.parent.isMobileView()&&(this.parent.element.classList.add("e-mobile-focused"),this.parent.renderModule.setSheetPanelSize())}}if(d&&(n.target.classList.contains("e-cell")||n.target.classList.contains("e-wrap-content")||n.target.classList.contains("e-header-cell"))&&this.parent.isEdit){var B=(A=this.parent.getActiveSheet().selectedRange).split(" ");A=m(o(B[B.length-1]))?B[B.length-1].split(":")[0]:B[B.length-1],this.parent.notify(cs,{range:A,isSelect:!1,isMouseDown:n.ctrlKey})}}},n.prototype.mouseMoveHandler=function(n){var i=this,s=this.parent.getActiveSheet();td(n)&&n.preventDefault();var o={action:"getCurrentEditValue",editedValue:""};this.parent.notify(ei,o);var l,d,h=xr(o.editedValue,!0),p=this.parent.getMainContent().parentElement,c=this.parent.element.getElementsByClassName("e-scroller")[0],u=p.getBoundingClientRect(),f=this.parent.frozenColCount(s),g=u.left+this.parent.sheetModule.getRowHeaderWidth(s,!1,!0),m=u.right-_l(),v=u.top,y=u.bottom,C=od(n),b=ld(n),x=this.isRowSelected?s.colCount-1:this.getColIdxFromClientX({clientX:C,target:n.target}),S=this.isColSelected?s.rowCount-1:this.getRowIdxFromClientY({clientY:b,target:n.target});if(n.ctrlKey){var w=s.selectedRange.split(" ");l=t(w[w.length-1])}else l=t(s.selectedRange);if(e.Browser.isDevice){var I=screen.availWidth;m>=I-40&&(m-=40-(I-m)),!s.showHeaders&&g<40&&(g+=40-g)}var E={range:[S,x,S,x]};if(this.parent.notify(Et,E),!(E.range[2]===l[2]&&E.range[3]===l[3]&&b<=y&&b>=v&&C<=m&&C>=g)){var N=this.parent.frozenRowCount(s);h||(l=r(s.activeCell));var R,O,k=b>y&&!this.isColSelected&&S<s.rowCount,A=b<v&&S>=0&&!this.isColSelected&&!!p.scrollTop&&(!N||l[0]>=N),F=C>m&&!this.isRowSelected&&x<s.colCount,T=C<g&&x>=0&&!this.isRowSelected&&!!c.scrollLeft&&(!f||l[1]>=f);if(this.clearInterval(),k||A||F||T){(A||T)&&(R=S,O=x);var D=function(){if(k||A){if((S=i.getRowIdxFromClientY({clientY:k?y:v}))>=s.rowCount)return void i.clearInterval();p.scrollTop+=(k?1:-1)*fl(s,S)}if(F||T){if((x=i.getColIdxFromClientX({clientX:F?m:g,isFScroll:!0}))>=s.colCount)return void i.clearInterval();c.scrollLeft+=(F?1:-1)*Sl(s,x)}if(A&&s.frozenRows&&!p.scrollTop||T&&s.frozenColumns&&!c.scrollLeft)return i.selectRangeByIdx([].concat(l[0],l[1],[R,O]),n),void i.clearInterval();i.selectRangeByIdx([].concat(l[0],l[1],[S,x]),n)};D(),this.scrollInterval=setInterval((function(){D(),i.clearInterval(),i.scrollInterval=setInterval(D,100)}))}else{var L=[].concat(l[0],l[1],[S,x]);if(N&&L[0]<N&&L[2]>=N&&p.scrollTop&&(p.scrollTop=0,L[2]=N),f&&L[1]<f&&L[3]>=f&&c.scrollLeft&&(c.scrollLeft=0,L[3]=f),this.isautoFillClicked){n.target.classList.contains("e-autofill")&&(this.dAutoFillCell=s.selectedRange);var P={e:n,indexes:null};this.parent.notify(Ks,P),d=L=P.indexes}this.selectRangeByIdx(L,n)}if(h&&this.parent.isEdit&&!(0,e.closest)(n.target,"#"+this.parent.element.id+"_edit")){var M=(this.isautoFillClicked?a(d):this.parent.getActiveSheet().selectedRange).split(" ");this.parent.notify(cs,{range:M[M.length-1],isSelect:!1})}}},n.prototype.mouseUpHandler=function(r){var n=this.getRowIdxFromClientY({clientY:ld(r),target:r.target}),i=this.getColIdxFromClientX({clientX:od(r),target:r.target});this.clearInterval(),!rd(r)||this.isColSelected||this.isRowSelected||this.getRowIdxFromClientY({clientY:ld(this.touchEvt),target:r.target})!==n||this.getColIdxFromClientX({clientX:od(this.touchEvt),target:r.target})!==i||this.mouseDownHandler(r),document.removeEventListener(Jl().split(" ")[0],this.mouseMoveEvt),e.Browser.isPointer||document.removeEventListener(Jl().split(" ")[1],this.mouseMoveEvt),e.EventHandler.remove(document,Ql(),this.mouseUpHandler);var a=this.parent.getActiveSheet();if((a.frozenRows||a.frozenColumns)&&Xl(this.parent.element,null,"e-cur-selection",!0,!0),this.parent.notify(mi,r),this.isautoFillClicked){var s=this.parent.getActiveSheet(),o=t(s.selectedRange);if(!(this.isColSelected&&o[1]===i||this.isRowSelected&&o[0]===n)){var l=r.target.parentElement&&r.target.parentElement.querySelector(".e-dragfill-ddb");l&&!l.classList.contains("e-hide")||(this.dAutoFillCell=s.selectedRange),this.parent.notify(Xs,{event:r,dAutoFillCell:this.dAutoFillCell})}this.isautoFillClicked=!1}else r.ctrlKey||Dd(Sn(this.parent.getActiveSheet()))?this.parent.notify(Zs,null):this.parent.notify(Gs,null);this.updateFormulaCursorPosition(r)},n.prototype.updateFormulaCursorPosition=function(e){if(this.parent.isEdit){var t={action:"getCurrentEditValue",editedValue:""};this.parent.notify(ei,t),xr(t.editedValue,!0)&&this.parent.notify(ds,{isCellEdit:e.target.classList.contains("e-spreadsheet-edit")})}},n.prototype.isSelected=function(e,r){for(var n,i=!1,a=this.parent.getActiveSheet().selectedRange.split(" "),s=0;s<a.length;s++)if((n=c(t(a[s])))[0]<=e&&e<=n[2]&&n[1]<=r&&r<=n[3]){i=!0;break}return i},n.prototype.virtualContentLoadedHandler=function(e){var r,n,i,a=this,s=this.parent.getActiveSheet();s.selectedRange.split(" ").forEach((function(o,l){if(r=t(o),i=0===r[1]&&r[3]===e.prevRowColCnt.colCount-1,n=0===r[0]&&r[2]===e.prevRowColCnt.rowCount-1,i||n)r=n&&i?[0,0,s.rowCount-1,s.colCount-1]:n?[0,r[1],s.rowCount-1,r[3]]:[r[0],0,r[2],s.colCount-1],s.frozenRows||s.frozenColumns?a.selectRangeByIdx(r,{type:"mousedown",ctrlKey:0!==l},!1,!1,!1,!1,void 0,!0):a.selectRangeByIdx(r,null,!0,null,null,null,l);else{r=t(o);var d=a.parent.viewport.topIndex+a.parent.frozenRowCount(s),h=a.parent.viewport.leftIndex+a.parent.frozenColCount(s);a.highlightHdr(r,0!==l,r[0]>=d||r[2]>=d,r[1]>=h||r[3]>=h)}}))},n.prototype.clearInterval=function(){this.scrollInterval&&(clearInterval(this.scrollInterval),this.scrollInterval=null)},n.prototype.getScrollLeft=function(){return this.parent.scrollModule?this.parent.scrollModule.prevScroll.scrollLeft:0},n.prototype.cellNavigateHandler=function(e){var t=this.parent.getActiveSheet();(!t.isProtected||t.protectSettings.selectCells||t.protectSettings.selectUnLockedCells)&&(e.type="mousedown",this.selectRangeByIdx(e.range,e,!1,!1,!1,!1,void 0,e.preventAnimation))},n.prototype.getColIdxFromClientX=function(t){var r,n,i=this,a=0,s=this.parent.getActiveSheet(),o=0;if(t.isImage)o=t.clientX;else{var l=document.getElementById(this.parent.element.id+"_sheet").getBoundingClientRect();o=this.parent.enableRtl?l.right-this.parent.sheetModule.getRowHeaderWidth(s,!0,!0)-1-t.clientX:t.clientX-(l.left+this.parent.sheetModule.getRowHeaderWidth(s,!0,!0)+1),o+=this.parent.viewport.beforeFreezeWidth;t.target&&((0,e.closest)(t.target,".e-row-header")||(0,e.closest)(t.target,".e-selectall-container"))&&!this.isScrollableArea(t.clientX,t.target,!0)||!(!this.parent.frozenColCount(s)||o>(r=i.parent.element.querySelector(".e-frozen-column"),parseInt(r.style[i.parent.enableRtl?"right":"left"],10)/i.parent.viewport.scaleX)||t.isFScroll)||(o+=this.getScrollLeft()/this.parent.viewport.scaleX)}for(var d=0;;d++)if(n=a+=Sl(s,d,null,!t.isImage)/this.parent.viewport.scaleX,o<(t.isImage?Number(Hd(n).toFixed(2)):n)||this.parent.scrollSettings.isFinite&&d===s.colCount-1)return t.isImage||(t.size=o),t.clientX=d,d},n.prototype.isScrollableArea=function(e,t,r){return!!t.classList.contains("e-table")&&(r?e>this.parent.getMainContent().getBoundingClientRect().left:e>this.parent.getMainContent().parentElement.getBoundingClientRect().top)},n.prototype.getRowIdxFromClientY=function(t){var r,n=0,i=this.parent.getActiveSheet(),a=0;if(t.isImage)a=t.clientY;else{var s=document.getElementById(this.parent.element.id+"_sheet");a=t.clientY+this.parent.viewport.beforeFreezeHeight-(s.getBoundingClientRect().top+(i.showHeaders?31/this.parent.viewport.scaleY:0)),t.target&&(0,e.closest)(t.target,".e-header-panel")&&!this.isScrollableArea(t.clientY,t.target)||(a+=this.parent.getMainContent().parentElement.scrollTop/this.parent.viewport.scaleY)}for(var o=0;;o++)if(r=n+=fl(i,o,!t.isImage)/this.parent.viewport.scaleY,a<(t.isImage?Number(Hd(r).toFixed(2)):r)||this.parent.scrollSettings.isFinite&&o===i.rowCount-1)return t.isImage||(t.size=a),t.clientY=o,o},n.prototype.initFormulaReferenceIndicator=function(e){if(this.parent.isEdit){var t=this.parent.createElement("div",{className:"e-formularef-indicator"});t.appendChild(this.parent.createElement("div",{className:"e-top"})),t.appendChild(this.parent.createElement("div",{className:"e-bottom"})),t.appendChild(this.parent.createElement("div",{className:"e-left"})),t.appendChild(this.parent.createElement("div",{className:"e-right"})),this.parent.getMainContent().appendChild(t),Yl(this.parent,t,e,"e-formularef-indicator")}},n.prototype.isMouseEvent=function(e){return nd(e)||ad(e)||id(e)},n.prototype.selectRangeByIdx=function(r,n,i,s,o,l,d,h){var p=this,c=n&&this.isMouseEvent(n);if(!(n&&n.target&&c&&(0,e.closest)(n.target,"#"+this.parent.element.id+"_edit"))){var u={action:"getCurrentEditValue",editedValue:"",endFormulaRef:!1};this.parent.notify(ei,u);var f,g=!!this.parent.isEdit&&xr(u.editedValue,!0)&&!u.endFormulaRef,v=n&&n.ctrlKey&&nd(n);v||(f=this.getSelectionElement(n,d));var y,C=this.parent.getActiveSheet(),b=t(C.topLeftCell),x=this.parent.element.querySelector(".e-formularef-indicator"),S={range:[].slice.call(r),isActiveCell:!1,skipChecking:l},w=this.isRowColSelected(r);w.isColSelected||w.isRowSelected||this.parent.notify(It,S),r!==S.range&&(y=!0),r=S.range;var I=new Promise((function(e){e(void 0)})),E={range:a(r),cancel:!1};if(C.isProtected){var N=Ln(r[2],r[3],C);if(C.protectSettings.selectUnLockedCells&&!C.protectSettings.selectCells)if((0,e.isNullOrUndefined)(N)){if(!C.protectSettings.selectCells)return}else{if(!0===N.isLocked||(0,e.isNullOrUndefined)(N.isLocked))return;var R=this.parent.element.getElementsByClassName("e-sheet-panel")[0];R&&R.classList.contains("e-protected")&&R.classList.remove("e-protected")}}if(this.parent.trigger("beforeSelect",E),!E.cancel){if(g&&x&&x.parentElement.removeChild(x),this.parent.notify(Ys,null),!m(r)&&!S.isActiveCell||v){if(v)if(void 0===d){var O=a(r);if(C.selectedRange.includes(O)&&!g)return(L=C.selectedRange.split(" ")).length>1?(L.splice(L.indexOf(O),1),O=L.join(" ")):O=C.activeCell+":"+C.activeCell,void this.selectRange({address:O});f=this.getSelectionElement(n,d)}else f=this.getSelectionElement(n,d);if(g&&this.parent.isEdit){if(n&&n.target&&(!c||!n.target.classList.contains("e-spreadsheet-edit"))&&this.parent.isEdit){F={range:a(r),isSelect:!0};if(this.parent.notify(cs,F),F.isAlertDlgOpen)return;this.initFormulaReferenceIndicator(r)}}else{A=void 0;f&&(f.classList.remove("e-hide"),(C.frozenRows||C.frozenColumns)&&((n&&n.target||v)&&(A="e-cur-selection",id(n)&&f.classList.contains("e-cur-selection")?f.classList.add("e-hide"):f.classList.add(A)),!v&&(this.isColSelected||this.isRowSelected)&&nd(n)&&(Xl(this.parent.getSelectAllContent(),null,"e-selection"),Xl(this.parent.getColumnHeaderContent(),null,"e-selection"),Xl(this.parent.getRowHeaderContent(),null,"e-selection"))));var k=this.isColSelected&&this.isRowSelected?void 0:this.getOffset(r[2],r[3]);y&&k&&(k.left={idx:0,size:0}),I=Yl(this.parent,f,r,A,h,v,v&&!n.target)||I}}else{if(f&&(f.classList.contains("e-multi-range")||f.classList.add("e-hide"),C.frozenRows||C.frozenColumns)){var A=id(n)?"e-cur-selection":"e-selection";Xl(this.parent.getSelectAllContent(),null,A,!0),Xl(this.parent.getColumnHeaderContent(),null,A,!0),Xl(this.parent.getRowHeaderContent(),null,A,!0)}if(C.frozenColumns||C.frozenRows||!f||Yl(this.parent,f,r),g&&n&&n.target&&(!c||!n.target.classList.contains("e-spreadsheet-edit"))&&this.parent.isEdit){var F={range:a(r).split(":")[0],isSelect:!0};if(this.parent.notify(cs,F),F.isAlertDlgOpen)return;this.initFormulaReferenceIndicator(r)}}var T={action:"getCurrentEditSheetIdx",sheetIndex:null};this.parent.notify(ei,T),C.frozenColumns&&r[1]>0&&r[1]===b[1]&&r[3]===C.colCount-1&&(r[1]=0),C.frozenRows&&r[0]>0&&r[0]===b[0]&&r[2]===C.rowCount-1&&(r[0]=0);var D=a(r);if(n&&n.ctrlKey&&(id(n)||ad(n))&&!g)D=C.selectedRange.slice(0,C.selectedRange.lastIndexOf(" "))+" "+D;else if(d>-1){var L;(L=C.selectedRange.split(" "))[d]=D,D=L.join(" ")}if(g||this.isautoFillClicked)o||this.isautoFillClicked||xn(this.parent,D,C,v);else{var P=!1;C.selectedRange!==D&&(P=!0),xn(this.parent,D,C,v),P&&I.then((function(){p.parent&&p.parent.trigger("select",{range:p.parent.getActiveSheet().selectedRange})}))}w=this.isRowColSelected(r),this.isRowSelected=w.isRowSelected,this.isColSelected=w.isColSelected,this.highlightHdr(r,n&&n.ctrlKey),i||n&&("mousemove"===n.type||td(n))||(g?T.sheetIndex===this.parent.getActiveSheet().id-1&&o?(s=!0,this.updateActiveCell(s?t(C.activeCell):r,o,h)):this.parent.isEdit||this.updateActiveCell(s?t(C.activeCell):r,o,h):this.updateActiveCell(s?t(C.activeCell):r,o,h)),(0,e.isNullOrUndefined)(n)&&(n={type:"mousedown"}),g&&o||this.parent.notify(rr,n),v||Dd(Sn(this.parent.getActiveSheet()))?this.parent.notify(Zs,null):this.parent.notify(Gs,{preventAnimation:h}),this.parent.showAggregate&&this.parent.notify(ns,{}),this.parent.notify(ms,null)}}},n.prototype.isRowColSelected=function(e){var t=this.parent.getActiveSheet();return{isRowSelected:0===e[1]&&e[3]===t.colCount-1,isColSelected:0===e[0]&&e[2]===t.rowCount-1}},n.prototype.updateActiveCell=function(e,r,n){var a,s,o,l=this.parent.getActiveSheet(),d=t(l.topLeftCell);this.isColSelected?(a=d[0],s=e[1],this.isRowSelected&&(s=d[1])):(a=e[0],s=e[1],this.isRowSelected&&(s=d[1]));var h={range:[a,s].concat([a,s])};if(this.parent.notify(Et,h),e!==h.range&&(o=!0),e=h.range,l.activeCell!==i(e[0],e[1])||r){if(this.previousActiveCell=l.activeCell.indexOf(":")>-1?this.previousActiveCell:l.activeCell,this.parent.setSheetPropertyOnMute(l,"activeCell",i(e[0],e[1])),l.isProtected){var p=this.parent.element.querySelector(".e-formula-bar"),c=Ar(Ln(e[0],e[1],l),bl(l,e[1]));c&&p&&!p.disabled?p.disabled=!0:!c&&p&&p.disabled&&(p.disabled=!1)}if(this.getActiveCell()){var u=this.getOffset(e[2],e[3]);o&&(u.left={idx:0,size:0}),Yl(this.parent,this.getActiveCell(),e,"e-active-cell",n)}this.parent.notify(ve,null)}else Yl(this.parent,this.getActiveCell(),e,"e-active-cell",n)},n.prototype.getOffset=function(e,t){var r={left:{idx:0,size:0},top:{idx:0,size:0}};return this.parent.scrollModule&&(t>=this.parent.scrollModule.offset.left.idx&&(r.left=this.parent.scrollModule.offset.left),e>=this.parent.scrollModule.offset.top.idx&&(r.top=this.parent.scrollModule.offset.top)),r},n.prototype.getSelectionElement=function(r,n){var i=this.parent.getActiveSheet();if(r&&r.ctrlKey&&!this.parent.isEdit){if(ad(r)||id(r))return i.frozenColumns||i.frozenRows?(a=this.parent.getMainContent().querySelector(".e-cur-selection"))||(a=this.parent.element.querySelector(".e-multi-range"))&&a.cloneNode():this.parent.getMainContent().querySelector(".e-selection:last-child");var a,s=this.parent.getMainContent().getElementsByClassName("e-selection")[0];return(a=s.cloneNode()).classList.add("e-multi-range"),i.frozenColumns||i.frozenRows?(i.selectedRange.includes(" ")||(s.classList.remove("e-hide"),Yl(this.parent,s,c(t(i.selectedRange)),void 0,!1,!0)),!this.parent.getMainContent().querySelector(".e-multi-range")&&s.classList.contains("e-hide")?s:a):(s.classList.remove("e-hide"),this.parent.getMainContent().appendChild(a))}return n>-1?i.frozenRows||i.frozenColumns?this.parent.element.querySelector(".e-sheet").getElementsByClassName("e-selection")[n]:this.parent.getMainContent().getElementsByClassName("e-selection")[n]:([].slice.call(this.parent.element.getElementsByClassName("e-multi-range")).forEach((function(t){(0,e.remove)(t)})),this.parent.getMainContent().getElementsByClassName("e-selection")[0])},n.prototype.getActiveCell=function(){return this.parent.getMainContent().getElementsByClassName("e-active-cell")[0]},n.prototype.getSheetElement=function(){return document.getElementById(this.parent.element.id+"_sheet")},n.prototype.highlightHdr=function(t,n,i,a){var s=this;void 0===i&&(i=!0),void 0===a&&(a=!0);var o=this.parent.getActiveSheet();if(o.showHeaders){n||((0,e.removeClass)(this.getSheetElement().querySelectorAll(".e-highlight"),"e-highlight"),(0,e.removeClass)(this.getSheetElement().querySelectorAll(".e-prev-highlight"),"e-prev-highlight"));var l=this.parent.element.getElementsByClassName("e-select-all-cell")[0];l&&(0,e.removeClass)([l],["e-prev-highlight-right","e-prev-highlight-bottom"]);var d=[],h=[],p=c(t);this.isRowSelected&&(p[1]=Dr(o,p[1],!0,"columns")),this.isColSelected&&(p[0]=Dr(o,p[0],!0));var u,f,g=[0,0,0,0],m=[0,0,0,0],v=r(o.topLeftCell),y=function(e,t,r){var n,i,a;e&&p[u]<e?(v[u]=Dr(o,v[u],!0,t),(a=Dr(o,p[u],!0,t))===v[u]&&(p[u]=a),i=s.parent.hiddenCount(v[u],p[u]-1,t,o),g[u]=p[u]-i-v[u],n=p[f]<e?p[f]:e-1,g[f]=n-s.parent.hiddenCount(p[u],n,t,o)-i-v[u]+1,n=s.parent.viewport[""+r]+e,p[f]>=n&&(m[u]=0,m[u]-=s.parent.hiddenCount(n,n,t,o),m[f]=p[f]-s.parent.hiddenCount(n,p[f],t,o)-n+1)):((n=Dr(o,s.parent.viewport[""+r]+e,!0,t))===(a=Dr(o,p[u],!0,t))&&(p[u]=n),i=s.parent.hiddenCount(n,p[u]-1,t,o),m[u]=p[u]-i-n,m[f]=p[f]-s.parent.hiddenCount(p[u],p[f],t,o)-i-n+1)},C=function(e,t,r){for(var n=[].slice.call(t.getElementsByClassName("e-header-cell")),i=e[u];i<e[f];i++)n[i]&&r.push(n[i])};if(i){if(u=0,f=2,y(this.parent.frozenRowCount(o),"rows","topIndex"),o.frozenRows){var b=this.parent.getSelectAllContent().querySelector("tbody");b&&C(g,b,d)}C(m,this.parent.getRowHeaderContent(),d)}if(a){if(u=1,f=3,y(this.parent.frozenColCount(o),"columns","leftIndex"),o.frozenColumns){var x=this.parent.getSelectAllContent().querySelector("thead");x&&C(g,x,h)}C(m,this.parent.getColumnHeaderContent(),h)}o.isProtected&&!o.protectSettings.selectCells?(0,e.removeClass)([].concat(d,h),"e-highlight"):(0,e.addClass)([].concat(d,h),"e-highlight"),d.length&&d[0].parentElement.previousElementSibling&&d[0].parentElement.previousElementSibling.classList.add("e-prev-highlight"),h.length&&h[0].previousElementSibling&&h[0].previousElementSibling.classList.add("e-prev-highlight"),this.isRowSelected&&this.isColSelected&&(o.isProtected&&!o.protectSettings.selectCells?document.getElementById(this.parent.element.id+"_select_all").classList.remove("e-highlight"):document.getElementById(this.parent.element.id+"_select_all").classList.add("e-highlight")),l&&(Dr(o,p[0],!0)===Dr(o,0,!0)&&l.classList.add("e-prev-highlight-bottom"),Dr(o,p[1],!0,"columns")===Dr(o,0,!0,"columns")&&l.classList.add("e-prev-highlight-right"))}},n.prototype.protectHandler=function(){var e=t(this.parent.getActiveSheet().selectedRange),n=c(e),i=r(this.parent.getActiveSheet().activeCell),a=n[0]<=i[0]&&n[2]>=i[0]&&n[1]<=i[1]&&n[3]>=i[1];this.selectRangeByIdx(e,null,null,a)},n.prototype.initiateFormulaSelection=function(e){this.processFormulaEditRange(e.range,e.formulaSheetIdx)},n.prototype.processFormulaEditRange=function(e,t){var r,n=t,i=0,a={formula:e};this.parent.notify(dr,a);var s=a.formulaArr,o=s.length,l=0,d=[["e-vborderright","e-vborderbottom"],["e-pborderright","e-pborderbottom"],["e-cborderright","e-cborderbottom"],["e-gborderright","e-gborderbottom"],["e-oborderright","e-oborderbottom"],["e-bborderright","e-bborderbottom"]];this.clearBorder();for(var h=this.parent.getActiveSheet().id-1;i<o&&(r=s[i],!(this.invalidOperators.indexOf(r)>-1));){if(Sr(r.toUpperCase())){if(r=r.replace(/\$/g,""),i>0&&s[i-1].lastIndexOf("!")===s[i-1].length-1){var p=s[i-1].substring(1,s[i-1].lastIndexOf("!")-1);n=vn(this.parent,p)}":"===s[i+1]&&s[++i+1]&&Sr(s[i+1].toUpperCase())&&(r=r+":"+s[i+1],i++),h===n&&this.updateFormulaEditRange(r,l,d),n=t,l++}i++}},n.prototype.updateFormulaEditRange=function(e,r,n){var i=t(e);this.formulaRange[r]=e,this.dStartCell={rowIndex:i[0],colIndex:i[1]},this.dEndCell={rowIndex:i[2],colIndex:i[3]},this.focusBorder(this.dStartCell,this.dEndCell,n[r%6])},n.prototype.chartBorderHandler=function(e){this.focusBorder(e.startcell,e.endcell,e.classes,!0)},n.prototype.focusBorder=function(r,n,i,a){a=!(0,e.isNullOrUndefined)(a)&&a;var s=this.parent.getActiveSheet(),o=c([r.rowIndex,r.colIndex,n.rowIndex,n.colIndex]),l=t(s.topLeftCell),d=this.parent.hiddenCount(l[1],o[3]-1,"columns",s);if(a&&d>0&&(o[1]-=d,o[3]-=d),s.frozenRows||s.frozenColumns){var h=this.parent.createElement("div",{className:a?"e-range-indicator e-chart-range":"e-range-indicator e-formuala-range"});return h.appendChild(this.parent.createElement("div",{className:"e-top"})),h.appendChild(this.parent.createElement("div",{className:"e-bottom"})),h.appendChild(this.parent.createElement("div",{className:"e-left"})),h.appendChild(this.parent.createElement("div",{className:"e-right"})),void Yl(this.parent,h,o,"e-range-indicator")}var p=o[0],u=o[1],f=o[2],g=o[3];p&&this.getEleFromRange([p-1,u,p-1,g]).forEach((function(e){e&&(e.classList.add(i[1]),a||e.classList.add("e-formularef-selection"))})),this.getEleFromRange([p,g,f,g]).forEach((function(e){e&&(e.classList.add(i[0]),a||e.classList.add("e-formularef-selection"))})),this.getEleFromRange([f,u,f,g]).forEach((function(e){e&&(e.classList.add(i[1]),a||e.classList.add("e-formularef-selection"))})),u&&this.getEleFromRange([p,u-1,f,u-1]).forEach((function(e){e&&(e.classList.add(i[0]),a||e.classList.add("e-formularef-selection"))}))},n.prototype.getEleFromRange=function(e){var t,r,n,i,a=e[0],s=e[1],o=e[2],l=e[3],d=[],h=[];if(a>o&&(n=a,a=o,o=n),s>l&&(n=s,s=l,l=n),this.parent.scrollSettings.enableVirtualization)for(t=a;t<=o;t++)if((r=t)>-1){var p=this.parent.getRow(r,null);p&&(i=p.getElementsByClassName("e-cell"),d=l===s?[i[l]]:this.getRowCells(i,s,l+1),this.merge(h,d))}return h},n.prototype.getRowCells=function(e,t,r){for(var n=[];t<r;t++)e[t]&&n.push(e[t]);return n},n.prototype.merge=function(e,t){e&&t&&Array.prototype.push.apply(e,t)},n.prototype.clearBorder=function(){var t=this.parent.getActiveSheet();if(t.frozenColumns||t.frozenRows)[].slice.call(this.parent.element.getElementsByClassName("e-formuala-range")).forEach((function(t){(0,e.detach)(t)}));else for(var r=this.parent.element.getElementsByClassName("e-formularef-selection"),n=r.length-1;n>=0;n--)for(var i=r[n],a=["e-vborderright","e-vborderbottom","e-pborderright","e-pborderbottom","e-cborderright","e-cborderbottom","e-gborderright","e-gborderbottom","e-oborderright","e-oborderbottom","e-bborderright","e-bborderbottom","e-formularef-selection"],s=0;s<a.length;s++)i.classList.remove(a[s])},n.prototype.getModuleName=function(){return"selection"},n.prototype.destroy=function(){this.removeEventListener(),this.parent=null},n}(),ih=function(){function t(e){this.clientX=0,this.isKeyScroll=!0,this.parent=e,this.addEventListener(),this.initProps()}return t.prototype.onContentScroll=function(t){if(this.parent){var r,n,i=this.parent.getMainContent().parentElement,a=t.scrollLeft,s=t.scrollTop||i.scrollTop,o=a&&this.parent.enableRtl?this.initScrollValue-a:a;if(this.parent.allowAutoFill){var l=document.querySelector("#"+this.parent.element.id+"_autofilloptionbtn-popup"),d=document.querySelector("#"+this.parent.element.id+"_autofilloptionbtn");if(l)(0,e.getComponent)(d,"dropdown-btn").toggle()}if(!(0,e.isNullOrUndefined)(a)&&this.prevScroll.scrollLeft!==o){var h=o>this.prevScroll.scrollLeft;n=this.offset.left.size,this.offset.left=this.getColOffset(o,h,t.skipHidden),t.preventScroll||(this.parent.getColumnHeaderContent().scrollLeft=a,this.parent.getMainContent().scrollLeft=a,t.scrollLeft=a),r={cur:this.offset.left,prev:{idx:this.leftIndex,size:n},increase:h,preventScroll:t.preventScroll},this.updateTopLeftCell(h,!0),this.parent.notify(hi,null),this.parent.notify(di,r),this.updateNoteContainer(),this.parent.scrollSettings.enableVirtualization||!h||this.parent.scrollSettings.isFinite||this.updateNonVirtualCols(),this.leftIndex=r.prev.idx,this.prevScroll.scrollLeft=o}if(Math.round(this.prevScroll.scrollTop)!==Math.round(s)){t.skipRowVirualScroll&&(this.prevScroll.scrollTop=0,this.offset.top={idx:0,size:0});var p=s>this.prevScroll.scrollTop;n=this.offset.top.size,this.offset.top=this.getRowOffset(s,p),r={cur:this.offset.top,prev:{idx:this.topIndex,size:n},increase:p,preventScroll:t.preventScroll},this.updateTopLeftCell(p),t.preventScroll&&this.offset.top.idx<=this.parent.getThreshold("row")?this.offset.top={idx:0,size:0}:t.skipRowVirualScroll?r.prev.idx=r.cur.idx:(this.parent.notify(hi,null),this.parent.notify(li,r),this.updateNoteContainer()),this.parent.scrollSettings.enableVirtualization||!p||this.parent.scrollSettings.isFinite||this.updateNonVirtualRows(),this.topIndex=r.prev.idx,this.prevScroll.scrollTop=s}var c={isEdit:!1};if(this.parent.notify($n,c),c.isEdit)this.parent.element.querySelector(".e-formula-bar").focus();this.isKeyScroll=!0}},t.prototype.updateNoteContainer=function(){document.getElementsByClassName("e-addNoteContainer")&&document.getElementsByClassName("e-addNoteContainer").length>0&&this.parent.notify(ha,null)},t.prototype.updateScrollValue=function(e){void 0!==e.scrollLeft&&(this.prevScroll.scrollLeft=e.scrollLeft+(this.prevScroll.scrollLeft-this.offset.left.size),this.offset.left.size=e.scrollLeft),void 0!==e.scrollTop&&(this.prevScroll.scrollTop=e.scrollTop+(this.prevScroll.scrollTop-this.offset.top.size),this.offset.top.size=e.scrollTop)},t.prototype.updateNonVirtualRows=function(){var e=this.parent.getActiveSheet(),t=this.parent.getThreshold("row");this.offset.top.idx>e.rowCount-(this.parent.viewport.rowCount+t)&&(this.parent.renderModule.refreshUI({rowIndex:e.rowCount,colIndex:0,direction:"first",refresh:"RowPart"},i(e.rowCount,0)+":"+i(e.rowCount+t-1,e.colCount-1)),this.parent.setSheetPropertyOnMute(e,"rowCount",e.rowCount+t),this.parent.viewport.bottomIndex=e.rowCount-1)},t.prototype.updateNonVirtualCols=function(){var e=this.parent.getActiveSheet(),t=this.parent.getThreshold("col");this.offset.left.idx>e.colCount-(this.parent.viewport.colCount+t)&&(this.parent.renderModule.refreshUI({rowIndex:0,colIndex:e.colCount,direction:"first",refresh:"ColumnPart"},i(0,e.colCount)+":"+i(e.rowCount-1,e.colCount+t-1)),this.parent.setSheetPropertyOnMute(e,"colCount",e.colCount+t),this.parent.viewport.rightIndex=e.colCount-1)},t.prototype.updateTopLeftCell=function(e,t){var r=this.parent.getActiveSheet(),n=this.offset.top.idx,i=this.offset.left.idx;if(!e){var a=this.parent.frozenRowCount(r);n=Dr(r,n+a,!0)-a;var s=this.parent.frozenColCount(r);i=Dr(r,i+s,!0,"columns")-s}t?this.parent.updateTopLeftCell(null,i,"row"):this.parent.updateTopLeftCell(n,null,"col")},t.prototype.getRowOffset=function(e,t){var r=this.offset.top.size,n=this.parent.getActiveSheet(),i=t?this.offset.top.idx+1:this.offset.top.idx?this.offset.top.idx-1:0,a=this.parent.frozenRowCount(n),s=this.parent.scrollSettings.isFinite?n.rowCount:1/0;for(e=Math.round(e);i<s;)if(t){if(r+=o=fl(n,i-1+a,!0),Math.abs(Math.round(r)-e)<=1)return{idx:Dr(n,i+a,!0)-a,size:r};if(Math.round(r)>e)return{idx:i-1,size:r-o};i++}else{var o;if((r-=o=fl(n,i+a,!0))<=0)return{idx:0,size:0};if(Math.abs(Math.round(r)-e)<=1)return{idx:i,size:r};if(Math.round(r)<e)return r+=o,Math.round(r)>e?{idx:i,size:r-o<0?0:r-o}:{idx:Dr(n,i+1+a,!0)-a,size:r};i--}return{idx:this.offset.top.idx,size:this.offset.top.size}},t.prototype.getColOffset=function(e,t,r){for(var n=this.offset.left.size,i=this.parent.getActiveSheet(),a=t?this.offset.left.idx+1:this.offset.left.idx?this.offset.left.idx-1:0,s=this.parent.frozenColCount(i),o=this.parent.scrollSettings.isFinite?i.colCount:1/0;a<o;)if(t){if(n+=l=Sl(i,a-1+s,r,!0),Math.abs(Math.round(n)-e)<=1)return{idx:Dr(i,a+s,!0,"columns")-s,size:n};if(Math.round(n)>e)return{idx:a-1,size:n-l};a++}else{var l;if((n-=l=Sl(i,a+s,r,!0))<=0)return{idx:0,size:0};if(Math.abs(Math.round(n)-e)<=1)return{idx:a,size:n};if(Math.round(n)<e)return n+=l,Math.round(n)>e?{idx:a,size:(n-=l)<0?0:n}:{idx:Dr(i,a+1+s,!0,"columns")-s,size:n};a--}return{idx:this.offset.left.idx,size:this.offset.left.size}},t.prototype.contentLoaded=function(e){if(!this.parent.scrollSettings.enableVirtualization){var t=this.parent.createElement("div",{className:"e-virtualtrack"});this.updateNonVirualScrollWidth({scrollTrack:t}),this.parent.getScrollElement().appendChild(t)}e.left&&(this.parent.getScrollElement().scrollLeft=e.left),this.setScrollEvent(),this.parent.enableRtl&&(this.initScrollValue=this.parent.getScrollElement().scrollLeft)},t.prototype.updateNonVirualScrollWidth=function(e){e.scrollTrack||(e.scrollTrack=this.parent.getScrollElement().getElementsByClassName("e-virtualtrack")[0]),e.scrollTrack.style.width=Math.abs(this.parent.getContentTable().getBoundingClientRect().width+(this.parent.scrollSettings.isFinite?this.parent.sheetModule.getScrollSize():0))+"px"},t.prototype.onHeaderWheel=function(e){e.preventDefault(),this.parent.getMainContent().parentElement.scrollTop+=e.deltaY,this.parent.getScrollElement().scrollLeft+=e.deltaX},t.prototype.onContentWheel=function(e){0!==e.deltaX&&(e.preventDefault(),this.parent.getScrollElement().scrollLeft+=e.deltaX)},t.prototype.scrollHandler=function(e){this.onContentScroll({scrollLeft:e.target.scrollLeft})},t.prototype.updateScroll=function(t){(0,e.isNullOrUndefined)(t.left)?this.parent.sheetModule.contentPanel.scrollTop=t.top:this.parent.getScrollElement().scrollLeft=t.left},t.prototype.setScrollEvent=function(){e.EventHandler.add(this.parent.sheetModule.contentPanel,"scroll",this.onContentScroll,this),e.EventHandler.add(this.parent.getColumnHeaderContent(),"wheel",this.onHeaderWheel,this),e.EventHandler.add(this.parent.getSelectAllContent(),"wheel",this.onHeaderWheel,this),e.EventHandler.add(this.parent.getMainContent(),"wheel",this.onContentWheel,this),e.EventHandler.add(this.parent.getRowHeaderContent(),"wheel",this.onContentWheel,this),e.EventHandler.add(this.parent.getScrollElement(),"scroll",this.scrollHandler,this)},t.prototype.initProps=function(){this.topIndex=0,this.leftIndex=0,this.prevScroll={scrollLeft:0,scrollTop:0},this.offset={left:{idx:0,size:0},top:{idx:0,size:0}}},t.prototype.setPadding=function(e){this.parent.sheetModule.contentPanel.style.overflowY="scroll";var t=_l();if(t>0){var r=this.parent.getColumnHeaderContent(),n=this.parent.enableRtl?{margin:"marginLeft",border:"borderLeftWidth"}:{margin:"marginRight",border:"borderRightWidth"};r.parentElement.style[n.margin]=t+"px",r.style[n.border]="1px"}e&&(this.initScrollValue=0)},t.prototype.setClientX=function(t){if("mousedown"!==t.type&&"mouse"!==t.pointerType){var r={touchSelectionStarted:!1};if(this.parent.notify(_s,r),!r.touchSelectionStarted&&!r.isOverlayClicked){this.clientX=this.getPointX(t);var n=document.getElementById(this.parent.element.id+"_sheet");e.EventHandler.add(n,e.Browser.isPointer?"pointermove":"touchmove",this.onTouchScroll,this),e.EventHandler.add(n,e.Browser.isPointer?"pointerup":"touchend",this.pointerUpHandler,this)}}},t.prototype.getPointX=function(e){return e.touches&&e.touches.length?e.touches[0].clientX:e.clientX},t.prototype.onTouchScroll=function(e){if("mouse"!==e.pointerType){var t=this.getPointX(e),r=this.clientX-t,n=this.parent.element.getElementsByClassName("e-scroller")[0];(r>10||r<-10)&&n.scrollLeft+r>=0&&(e.preventDefault(),this.clientX=t,Bl((function(){n.scrollLeft+=r})))}},t.prototype.pointerUpHandler=function(){var t=document.getElementById(this.parent.element.id+"_sheet");e.EventHandler.remove(t,e.Browser.isPointer?"pointermove":"touchmove",this.onTouchScroll),e.EventHandler.remove(t,e.Browser.isPointer?"pointerup":"touchend",this.pointerUpHandler)},t.prototype.addEventListener=function(){this.parent.on(Zn,this.contentLoaded,this),this.parent.on(Yi,this.onContentScroll,this),this.parent.on(Ws,this.updateScroll,this),this.parent.on(Xi,this.initProps,this),this.parent.on(Qn,this.destroy,this),this.parent.on(Jn,this.setClientX,this),this.parent.on(to,this.updateScrollValue,this),this.parent.scrollSettings.enableVirtualization||(this.parent.on(ui,this.updateNonVirualScrollWidth,this),this.parent.on(Gi,this.updateNonVirualScrollWidth,this))},t.prototype.destroy=function(){this.removeEventListener();var t=document.querySelector("#"+this.parent.element.id+"_autofilloptionbtn");if(t){var r=(0,e.getComponent)(t,"dropdown-btn");r&&r.destroy()}this.parent=null},t.prototype.removeEventListener=function(){this.parent.off(Zn,this.contentLoaded),this.parent.off(Yi,this.onContentScroll),this.parent.off(Ws,this.updateScroll),this.parent.off(Xi,this.initProps),this.parent.off(Qn,this.destroy),this.parent.off(Jn,this.setClientX),this.parent.off(to,this.updateScrollValue),this.parent.scrollSettings.enableVirtualization||(this.parent.off(ui,this.updateNonVirualScrollWidth),this.parent.off(Gi,this.updateNonVirualScrollWidth))},t}(),ah=function(){function n(e){this.scroll=[],this.parent=e,this.addEventListener()}return n.prototype.createVirtualElement=function(t){var n=this.parent.getActiveSheet(),i=this.parent.getMainContent();this.content=this.parent.createElement("div",{className:"e-virtualable"}),this.content.appendChild(i.querySelector(".e-table")),i.appendChild(this.content);var a,s=i.appendChild(this.parent.createElement("div",{className:"e-virtualtrack"})),o=0;this.parent.sheets.length>this.scroll.length&&this.initScroll();var l=this.parent.viewport.bottomIndex;n.rowCount>l+1||n.usedRange.rowIndex>l?(!this.parent.scrollSettings.isFinite&&n.rowCount<=n.usedRange.rowIndex&&this.parent.setSheetPropertyOnMute(n,"rowCount",n.usedRange.rowIndex+1),this.setScrollCount(n.rowCount,"row")):(this.parent.scrollSettings.isFinite||this.parent.setSheetPropertyOnMute(n,"rowCount",l+1),this.scroll[this.parent.activeSheetIndex].rowCount=n.rowCount);var d=this.parent.frozenRowCount(n),h=r(n.topLeftCell);t.top&&(o=t.top,n.frozenRows&&(o+=ml(n,h[0],d-1,!0)),d=r(n.paneTopLeftCell)[0]),o+=ml(n,d,this.scroll[this.parent.activeSheetIndex].rowCount-1,!0),l=this.parent.viewport.rightIndex;var p=0,c=this.parent.frozenColCount(n);t.left?(p=t.left,c&&(p+=wl(n,h[1],c-1,!0)),d=r(n.paneTopLeftCell)[1]):d=c,n.colCount>l+1||n.usedRange.colIndex>l?(!this.parent.scrollSettings.isFinite&&n.colCount<=n.usedRange.colIndex&&this.parent.setSheetPropertyOnMute(n,"colCount",n.usedRange.colIndex+1),p+=wl(n,d,l,!0),this.setScrollCount(n.colCount,"col"),a=p+wl(n,l+1,this.scroll[this.parent.activeSheetIndex].colCount-1,!0)):(this.parent.scrollSettings.isFinite||this.parent.setSheetPropertyOnMute(n,"colCount",l+1),p+=wl(n,d,n.colCount-1,!0),this.scroll[this.parent.activeSheetIndex].colCount=n.colCount,a=p),(0,e.isNullOrUndefined)(this.parent.viewport.leftIndex)&&(this.parent.viewport.leftIndex=0),(0,e.isNullOrUndefined)(this.parent.viewport.topIndex)&&(this.parent.viewport.topIndex=0),t.left&&(p=wl(n,this.parent.viewport.leftIndex+c,l,!0)),(0,e.isNullOrUndefined)(this.translateX)&&(this.translateX=0),(0,e.isNullOrUndefined)(this.translateY)&&(this.translateY=0),i=this.parent.getRowHeaderContent(),this.rowHeader=this.content.cloneNode(),this.rowHeader.appendChild(i.querySelector(".e-table")),i.appendChild(this.rowHeader);var u=i.appendChild(s.cloneNode());this.rowHeader.style.transform="translate(0px, "+this.translateY+"px)",i=this.parent.getColumnHeaderContent(),this.colHeader=this.content.cloneNode(),this.colHeader.appendChild(i.querySelector(".e-table")),i.appendChild(this.colHeader);var f=i.appendChild(s.cloneNode());if(this.colHeader.style.width=p+"px",u.style.height=o+"px",f.style.width=a+"px",this.colHeader.style.transform="translate("+this.translateX+"px, 0px)",this.content.style.transform="translate("+this.translateX+"px, "+this.translateY+"px)",this.content.style.width=p+"px",s.style.height=o+"px",s.style.width=a+"px",this.parent.allowScrolling){var g=f.cloneNode(!0);g.style.width=a+(this.parent.scrollSettings.isFinite?this.parent.sheetModule.getScrollSize():0)+"px",this.parent.getScrollElement().appendChild(g)}},n.prototype.initScroll=function(){for(var e=0;e<this.parent.sheets.length;)this.scroll[e]||this.scroll.push({rowCount:0,colCount:0}),e++},n.prototype.setScrollCount=function(e,t){var r=this.parent.activeSheetIndex;this.scroll[r][t+"Count"]&&this.scroll[r][t+"Count"]===e||(this.scroll[r][t+"Count"]=e)},n.prototype.getRowAddress=function(e){var t=this.parent.getActiveSheet();return a([e[0],t.frozenColumns?r(t.topLeftCell)[1]:this.parent.viewport.leftIndex,e[1],this.parent.viewport.rightIndex])},n.prototype.getColAddress=function(e){var t=this.parent.getActiveSheet();return a([t.frozenRows?r(t.topLeftCell)[0]:this.parent.viewport.topIndex,e[0],this.parent.viewport.bottomIndex,e[1]])},n.prototype.updateScrollCount=function(e,t,r){void 0===r&&(r=e);var n=this.parent.getActiveSheet(),i=e+this.parent.viewport[t+"Count"]+1+r,a=this.scroll[this.parent.activeSheetIndex][t+"Count"];if(i<a){if(n[t+"Count"]===a)return;i=a}this.parent.scrollSettings.isFinite||this.parent.setSheetPropertyOnMute(n,t+"Count",i)},n.prototype.onVerticalScroll=function(e){var n=e.cur.idx,i=e.cur.size,a=e.prev.idx,s=Math.abs(n-a),o=this.parent.getThreshold("row");if(s>Math.round(o/2)){var l=void 0,d=void 0,h=void 0,p=this.parent.getActiveSheet();if(n<=o&&!e.increase){if(this.translateY&&a>o){this.translateY=0;var c=this.parent.frozenColCount(p),u=this.parent.frozenRowCount(p);if(e.preventScroll)this.parent.viewport.topIndex=a-(o-u);else{var f=c?r(p.topLeftCell)[1]:this.parent.viewport.leftIndex,g=c?[u,this.parent.viewport.leftIndex+c]:[];if(s<this.parent.viewport.rowCount+o){l=Dr(p,u,!0),d=Dr(p,this.parent.viewport.topIndex+u-1,!1),this.parent.viewport.topIndex=l-u;var m=this.skipHiddenLastIdx(this.parent.viewport.bottomIndex-(d-l+1-this.hiddenCount(l,d)),this.parent.viewport.bottomIndex);this.parent.viewport.bottomIndex=Dr(p,m,!1),this.parent.renderModule.refreshUI({colIndex:f,rowIndex:l,direction:"last",refresh:"RowPart",skipUpdateOnFirst:!0,frozenIndexes:g},this.getRowAddress([l,Dr(p,d,!1)]))}else{var v=this.parent.viewport.leftIndex;this.parent.renderModule.refreshUI({rowIndex:0,colIndex:f,refresh:"Row",skipUpdateOnFirst:!0,frozenIndexes:g,skipTranslate:!0}),c&&(this.parent.viewport.leftIndex=v),this.translate({refresh:"Row"})}Fd(this.parent.element),n=0}}this.updateScrollCount(o,"row")}if(a<o&&(s=Math.abs(n-o)),!e.increase&&this.parent.scrollSettings.isFinite&&this.parent.viewport.bottomIndex===Dr(p,p.rowCount-1,!1)){u=this.parent.frozenRowCount(p);var y=this.parent.viewport.topIndex+u+t(p.paneTopLeftCell)[0]-1;if(n+u>y)return void(e.prev.idx=n);s=y-(n+u)}if(n>o){if(h=this.parent.viewport.topIndex,this.parent.viewport.topIndex=n-o,e.increase&&h>this.parent.viewport.topIndex)return void(this.parent.viewport.topIndex=h);u=this.parent.frozenRowCount(p);if(e.preventScroll)this.setThresholdHeight(i,o,u),this.translate({refresh:"Row"});else{f=void 0;var C=[];if((c=this.parent.frozenColCount(p))?(f=r(p.topLeftCell)[1],C.push(u),C.push(this.parent.viewport.leftIndex+c)):f=this.parent.viewport.leftIndex,s<this.parent.viewport.rowCount+o)if(e.increase){if(l=this.parent.viewport.bottomIndex+1,d=this.parent.viewport.bottomIndex+(this.parent.viewport.topIndex-h),(d-=this.hiddenCount(h+u,this.parent.viewport.topIndex-1+u))<=this.parent.viewport.bottomIndex||this.parent.scrollSettings.isFinite&&l>Dr(p,p.rowCount-1,!1,"rows"))return void(this.parent.viewport.topIndex=h);var b=this.parent.skipHidden(l,d,"rows",!1),x=this.checkLastIdx(b[1],"row");l=b[0],d=x.index;var S=this.parent.viewport.topIndex+u;if(x.diff)S=Dr(p,h,!0,"rows",d-l+1-this.hiddenCount(l,d))+u;this.parent.viewport.topIndex=Dr(p,S,!x.diff)-u,this.setThresholdHeight(i,n-this.parent.viewport.topIndex,u,!!x.diff,h===Dr(p,u,!0)),this.parent.viewport.bottomIndex=d,this.parent.renderModule.refreshUI({colIndex:f,rowIndex:l,direction:"first",refresh:"RowPart",frozenIndexes:C},this.getRowAddress([l,d]))}else{if((l=Dr(p,this.parent.viewport.topIndex+u,!1))<u&&(l=Dr(p,l=u,!0)),this.parent.viewport.topIndex=l-u,(d=Dr(p,h+u-1,!1))<u||d<l)return void(this.parent.viewport.topIndex=h);m=this.skipHiddenLastIdx(this.parent.viewport.bottomIndex-(d-l+1-this.hiddenCount(l,d)),this.parent.viewport.bottomIndex);this.parent.viewport.bottomIndex=Dr(p,m,!1),this.setThresholdHeight(i,n-this.parent.viewport.topIndex,u),this.parent.renderModule.refreshUI({colIndex:f,rowIndex:l,direction:"last",refresh:"RowPart",frozenIndexes:C},this.getRowAddress([l,d]))}else h=this.parent.viewport.leftIndex,this.parent.viewport.topIndex=Dr(p,this.parent.viewport.topIndex+u,!1)-u,this.parent.viewport.topIndex<0&&(this.parent.viewport.topIndex=Dr(p,u,!0)-u),this.parent.renderModule.refreshUI({rowIndex:this.parent.viewport.topIndex,colIndex:f,refresh:"Row",frozenIndexes:C,skipTranslate:!0}),c&&(this.parent.viewport.leftIndex=h),this.setThresholdHeight(i,n-this.parent.viewport.topIndex,u,this.parent.scrollSettings.isFinite&&this.parent.viewport.bottomIndex===Dr(p,p.rowCount-1,!1)),this.translate({refresh:"Row"});this.updateScrollCount(n,"row",o),this.focusSheet()}}e.prev.idx=n}},n.prototype.skipHiddenLastIdx=function(e,t,r){void 0===r&&(r="rows");for(var n=this.parent.getActiveSheet(),i=0,a=e;a<=t;a++)n[""+r][a]&&n[""+r][a].hidden&&i++;return i&&(e=this.skipHiddenLastIdx(e-i,e-1,r)),e},n.prototype.hiddenCount=function(e,t,r){void 0===r&&(r="rows");for(var n=0,i=this.parent.getActiveSheet(),a=e;a<=t;a++)i[""+r][a]&&i[""+r][a].hidden&&n++;return n},n.prototype.checkLastIdx=function(e,t){var r=0;if(this.parent.scrollSettings.isFinite){var n=this.parent.getActiveSheet(),i=Dr(n,n[t+"Count"]-1,!1);e>i&&(r=e-i,e=i)}return{index:e,diff:r}},n.prototype.onHorizontalScroll=function(e){var n=e.cur.idx,i=e.cur.size,a=e.prev.idx,s=Math.abs(n-a),o=this.parent.getThreshold("col");if(s>Math.round(o/2)){var l=void 0,d=void 0,h=void 0,p=this.parent.getActiveSheet();if(n<=o&&!e.increase){if(this.translateX&&a>o){this.translateX=0;var c=this.parent.frozenColCount(p),u=this.parent.frozenRowCount(p);if(e.preventScroll)this.parent.viewport.leftIndex=a-(o-c);else{var f=u?r(p.topLeftCell)[0]:this.parent.viewport.topIndex,g=u?[this.parent.viewport.topIndex+u,c]:[];if(s<this.parent.viewport.colCount+o){l=Dr(p,c,!0,"columns"),d=Dr(p,this.parent.viewport.leftIndex+c-1,!1,"columns"),this.parent.viewport.leftIndex=l-c;var m=this.skipHiddenLastIdx(this.parent.viewport.rightIndex-(d-l+1-this.hiddenCount(l,d,"columns")),this.parent.viewport.rightIndex,"columns");this.parent.viewport.rightIndex=Dr(p,m,!1,"columns"),this.parent.renderModule.refreshUI({rowIndex:f,colIndex:l,direction:"last",refresh:"ColumnPart",skipUpdateOnFirst:!0,frozenIndexes:g},this.getColAddress([l,Dr(p,d,!1,"columns")]))}else{var v=this.parent.viewport.topIndex;this.parent.renderModule.refreshUI({rowIndex:f,colIndex:0,refresh:"Column",skipUpdateOnFirst:!0,frozenIndexes:g,skipTranslate:!0}),u&&(this.parent.viewport.topIndex=v),this.translate({refresh:"Column"})}Fd(this.parent.element),n=0}}this.updateScrollCount(o,"col")}if(a<o&&(s=Math.abs(n-o)),!e.increase&&this.parent.scrollSettings.isFinite&&this.parent.viewport.rightIndex===Dr(p,p.colCount-1,!1,"columns")){c=this.parent.frozenColCount(p);var y=this.parent.viewport.leftIndex+c+t(p.paneTopLeftCell)[1]-1;if(n+c>(y+=this.hiddenCount(this.parent.viewport.leftIndex+c,y)))return void(e.prev.idx=n);s=y-(n+c)}if(n>o){if(h=this.parent.viewport.leftIndex,this.parent.viewport.leftIndex=n-o,e.increase&&h>this.parent.viewport.leftIndex)return void(this.parent.viewport.leftIndex=h);c=this.parent.frozenColCount(p);if(e.preventScroll)this.setThresholdWidth(i,o,c),this.translate({refresh:"Column"});else{f=(u=this.parent.frozenRowCount(p))?r(p.topLeftCell)[0]:this.parent.viewport.topIndex;var C=[];if(u&&(C=[u+this.parent.viewport.topIndex,c]),s<this.parent.viewport.colCount+o)if(e.increase){if(l=this.parent.viewport.rightIndex+1,d=this.parent.viewport.rightIndex+(this.parent.viewport.leftIndex-h),(d-=this.hiddenCount(h+c,this.parent.viewport.leftIndex-1+c,"columns"))<=this.parent.viewport.rightIndex||this.parent.scrollSettings.isFinite&&l>Dr(p,p.colCount-1,!1,"columns"))return void(this.parent.viewport.leftIndex=h);var b=this.parent.skipHidden(l,d,"columns",!1),x=this.checkLastIdx(b[1],"col");l=b[0],d=x.index,this.parent.viewport.leftIndex=Dr(p,this.parent.viewport.leftIndex-x.diff+c,!x.diff,"columns")-c,this.setThresholdWidth(i,n-this.parent.viewport.leftIndex,c,!!x.diff,h===Dr(p,c,!0,"columns")),this.parent.viewport.rightIndex=d,this.parent.renderModule.refreshUI({rowIndex:f,colIndex:l,direction:"first",refresh:"ColumnPart",frozenIndexes:C},this.getColAddress([l,d]))}else{if((l=Dr(p,this.parent.viewport.leftIndex+c,!1,"columns"))<c&&(l=Dr(p,l=c,!0,"columns")),this.parent.viewport.leftIndex=l-c,(d=Dr(p,h+c-1,!1,"columns"))<c||d<l)return void(this.parent.viewport.leftIndex=h);m=this.skipHiddenLastIdx(this.parent.viewport.rightIndex-(d-l+1-this.hiddenCount(l,d,"columns")),this.parent.viewport.rightIndex,"columns");this.parent.viewport.rightIndex=Dr(p,m,!1,"columns"),this.setThresholdWidth(i,n-this.parent.viewport.leftIndex,c),this.parent.renderModule.refreshUI({rowIndex:f,colIndex:l,direction:"last",refresh:"ColumnPart",frozenIndexes:C},this.getColAddress([l,d]))}else h=this.parent.viewport.topIndex,this.parent.viewport.leftIndex=Dr(p,this.parent.viewport.leftIndex+c,!1,"columns")-c,this.parent.viewport.leftIndex<0&&(this.parent.viewport.leftIndex=Dr(p,c,!0,"columns")-c),this.parent.renderModule.refreshUI({rowIndex:f,colIndex:this.parent.viewport.leftIndex,refresh:"Column",frozenIndexes:C,skipTranslate:!0}),u&&(this.parent.viewport.topIndex=h),this.setThresholdWidth(i,n-this.parent.viewport.leftIndex,c,this.parent.scrollSettings.isFinite&&this.parent.viewport.rightIndex===Dr(p,p.colCount-1,!1,"columns")),this.translate({refresh:"Column"});this.updateScrollCount(n,"col",o),this.focusSheet()}}e.prev.idx=n}},n.prototype.focusSheet=function(){document.activeElement.classList.contains("e-text-findNext-short")&&(0,e.closest)(document.activeElement,"#"+this.parent.element.id)||Fd(this.parent.element)},n.prototype.setThresholdHeight=function(e,t,r,n,i){var a=this.parent.getActiveSheet(),s=this.parent.viewport.topIndex+r,o=s+t-1;this.translateY=n||i||o<s?s<=r?0:ml(a,r,s-1,!0):e-ml(a,s,o,!0)},n.prototype.setThresholdWidth=function(e,t,r,n,i){var a=this.parent.getActiveSheet(),s=this.parent.viewport.leftIndex+r,o=s+t-1;this.translateX=n||i||o<s?s<=r?0:wl(a,r,s-1,!0):e-wl(a,s,o,!0)},n.prototype.translate=function(e){if(!e.skipTranslate&&this.content){var t=this.translateX||0;t=this.parent.enableRtl?-t:t,"Row"!==e.refresh&&"RowPart"!==e.refresh||(this.content.style.transform="translate("+t+"px, "+this.translateY+"px)",this.rowHeader.style.transform="translate(0px, "+this.translateY+"px)"),"Column"!==e.refresh&&"ColumnPart"!==e.refresh||(this.content.style.transform="translate("+t+"px, "+this.translateY+"px)",this.colHeader.style.transform="translate("+t+"px, 0px)")}},n.prototype.updateColumnWidth=function(e){if("Column"===e.refresh){this.content.style.width="";var t=this.parent.getActiveSheet(),r=wl(t,this.parent.viewport.leftIndex+this.parent.frozenColCount(t),this.parent.viewport.rightIndex,!0);if(this.colHeader.style.width=r+"px",this.content.style.width=r+"px",!this.parent.scrollSettings.isFinite||e.isUpdate){var n=this.parent.element.querySelector(".e-scroller .e-virtualtrack");if(!n)return;var i=parseInt(n.style.width,10),a=r+this.translateX+this.parent.viewport.beforeFreezeWidth;if(a>i){var s=a-i;n.style.width=i+s+"px"}else{s=i-a;var o=this.parent.getMainContent().getElementsByClassName("e-virtualtrack")[0];i-s<parseInt(o.style.width,10)&&(n.style.width=o.style.width)}}}else if(!this.parent.scrollSettings.isFinite){o=this.parent.getMainContent().getElementsByClassName("e-virtualtrack")[0];var l=parseInt(o.style.height,10),d=this.content.getBoundingClientRect().height+this.translateY+this.parent.viewport.beforeFreezeHeight;if(d>l){s=d-l;o.style.height=l+s+"px"}else{s=l-d;var h=this.parent.getRowHeaderContent().getElementsByClassName("e-virtualtrack")[0];l-s<parseInt(h.style.height,10)&&(o.style.height=h.style.height)}}},n.prototype.updateRowColCount=function(e){if(this.scroll.length){var t=this.parent.getActiveSheet();if("row"===e.update){if(e.index!==this.scroll[this.parent.activeSheetIndex].rowCount-1){var r=this.getVTrackHeight("height"),n=r;if(e.index>=this.scroll[this.parent.activeSheetIndex].rowCount?void 0===e.start?n+=ml(t,this.scroll[this.parent.activeSheetIndex].rowCount,e.index,!0):n+=ml(t,e.start,e.end,!0):void 0===e.start?n-=ml(t,e.index+1,this.scroll[this.parent.activeSheetIndex].rowCount-1,!0):n-=ml(t,e.start,e.end,!0),!e.isDelete&&n<r)return;this.scroll[this.parent.activeSheetIndex].rowCount=e.index+1,this.updateVTrack(this.rowHeader,n,"height"),this.scroll[this.parent.activeSheetIndex].rowCount>t.rowCount&&this.parent.setSheetPropertyOnMute(t,"rowCount",this.scroll[this.parent.activeSheetIndex].rowCount)}}else if(e.index!==this.scroll[this.parent.activeSheetIndex].colCount-1){var i=this.getVTrackHeight("width"),a=i;if(e.index>=this.scroll[this.parent.activeSheetIndex].colCount?void 0===e.start?a+=wl(t,this.scroll[this.parent.activeSheetIndex].colCount,e.index,!0):a+=wl(t,e.start,e.end,!0):void 0===e.start?a-=wl(t,e.index+1,this.scroll[this.parent.activeSheetIndex].colCount-1,!0):a-=wl(t,e.start,e.end,!0),!e.isDelete&&a<i)return;this.scroll[this.parent.activeSheetIndex].colCount=e.index+1,this.updateVTrack(this.colHeader,a,"width"),this.scroll[this.parent.activeSheetIndex].colCount>t.colCount&&this.parent.setSheetPropertyOnMute(t,"colCount",this.scroll[this.parent.activeSheetIndex].colCount)}}},n.prototype.getVTrackHeight=function(e){var t=this.content.nextElementSibling.style[""+e];if(t.includes("e+")){var r=(t=t.split("px")[0]).split("e+");return Number(r[0])*Math.pow(10,Number(r[1]))}return parseFloat(t)},n.prototype.updateVTrackHeight=function(e){var t=this.parent.frozenRowCount(this.parent.getActiveSheet());if(e.rowIdx<this.scroll[this.parent.activeSheetIndex].rowCount&&this.updateVTrack(this.rowHeader,this.getVTrackHeight("height")+e.threshold,"height"),e.rowIdx>=t&&e.rowIdx<this.parent.scrollModule.offset.top.idx+t){var r=this.parent.element.getElementsByClassName("e-main-panel")[0];r&&(this.parent.scrollModule.prevScroll.scrollTop=r.scrollTop+e.threshold,r.scrollTop+=e.threshold),this.parent.scrollModule.offset.top.size+=e.threshold,e.rowIdx<this.parent.viewport.topIndex+t&&(this.translateY+=e.threshold,this.translate({refresh:"Row"}))}},n.prototype.updateVTrackWidth=function(e){if(!Il(this.parent.getActiveSheet(),e.colIdx)){var t=this.parent.frozenColCount(this.parent.getActiveSheet());if(e.colIdx>=this.parent.viewport.leftIndex+t&&e.colIdx<=this.parent.viewport.rightIndex){var r=this.parent.getColumnHeaderContent().getElementsByClassName("e-virtualtrack")[0];r.style.width=parseFloat(r.style.width)+e.threshold+"px";var n=this.parent.getMainContent().getElementsByClassName("e-virtualtrack")[0];n.style.width=parseFloat(n.style.width)+e.threshold+"px";var i=this.parent.getScrollElement().getElementsByClassName("e-virtualtrack")[0];i.style.width=parseFloat(i.style.width)+e.threshold+"px";var a=this.parent.getColumnHeaderContent().getElementsByClassName("e-virtualable")[0];a.style.width=parseFloat(a.style.width)+e.threshold+"px";var s=this.parent.getMainContent().getElementsByClassName("e-virtualable")[0];s.style.width=parseFloat(s.style.width)+e.threshold+"px"}else e.colIdx>=t&&e.colIdx<this.parent.viewport.leftIndex+t&&(this.parent.scrollModule.offset.left.size+=e.threshold,this.translateX+=e.threshold,this.translate({refresh:"Column"}))}},n.prototype.updateVTrack=function(e,t,r){e.nextElementSibling.style[""+r]=t+"px",this.content.nextElementSibling.style[""+r]=t+"px","width"===r&&this.parent.allowScrolling&&(this.parent.getScrollElement().firstElementChild.style.width=t+"px")},n.prototype.deInitProps=function(){this.parent.viewport.leftIndex=null,this.parent.viewport.topIndex=null,this.parent.viewport.bottomIndex=null,this.translateX=null,this.translateY=null},n.prototype.updateScrollProps=function(e){var t=this;void 0===e&&(e={sheetIndex:0,sheets:this.parent.sheets}),0===this.scroll.length?this.initScroll():e.sheets.forEach((function(){t.scroll.splice(e.sheetIndex,0,{rowCount:0,colCount:0})}))},n.prototype.sliceScrollProps=function(t){(0,e.isNullOrUndefined)(t.sheetIndex)?this.scroll.length=0:this.scroll.splice(t.sheetIndex,1)},n.prototype.updateTranslate=function(e){if(e.height){if(e.isRender)this.translateY-=e.height;else{var t=parseInt(this.parent.getMainContent().getElementsByClassName("e-virtualtrack")[0].style.height,10);e.isHide?(this.updateVTrack(this.rowHeader,t-e.height,"height"),this.setThresholdHeight(this.translateY,e.prevSize-1-this.parent.viewport.topIndex+1,this.parent.frozenRowCount(this.parent.getActiveSheet()))):(this.updateVTrack(this.rowHeader,t+e.height,"height"),this.translateY=this.translateY+e.size)}this.translate({refresh:"Row"})}e.width&&(this.translateX-=e.width,this.translate({refresh:"Column"}))},n.prototype.addEventListener=function(){this.parent.on(pi,this.createVirtualElement,this),this.parent.on(ci,this.translate,this),this.parent.on(ui,this.updateColumnWidth,this),this.parent.on(Ns,this.updateColumnWidth,this),this.parent.on(li,this.onVerticalScroll,this),this.parent.on(di,this.onHorizontalScroll,this),this.parent.on(he,this.updateRowColCount,this),this.parent.on(Wi,this.updateVTrackHeight,this),this.parent.on(Gi,this.updateVTrackWidth,this),this.parent.on(Xi,this.deInitProps,this),this.parent.on(xe,this.sliceScrollProps,this),this.parent.on(be,this.updateScrollProps,this),this.parent.on(Qs,this.updateTranslate,this),this.parent.on(Qn,this.destroy,this)},n.prototype.destroy=function(){this.removeEventListener();var e=document.querySelectorAll(".e-addNoteIndicator");e&&e.forEach((function(e){e.remove()})),this.rowHeader&&(Hl(this.rowHeader),this.rowHeader.remove()),this.colHeader&&(Hl(this.colHeader),this.colHeader.remove()),this.content&&(Hl(this.content),this.content.remove()),this.rowHeader=null,this.colHeader=null,this.content=null,this.parent=null,this.scroll.length=0,this.translateX=null,this.translateY=null},n.prototype.removeEventListener=function(){this.parent.off(pi,this.createVirtualElement),this.parent.off(ci,this.translate),this.parent.off(ui,this.updateColumnWidth),this.parent.off(Ns,this.updateColumnWidth),this.parent.off(li,this.onVerticalScroll),this.parent.off(di,this.onHorizontalScroll),this.parent.off(he,this.updateRowColCount),this.parent.off(Wi,this.updateVTrackHeight),this.parent.off(Gi,this.updateVTrackWidth),this.parent.off(xe,this.sliceScrollProps),this.parent.off(be,this.updateScrollProps),this.parent.off(Qs,this.updateTranslate),this.parent.off(Qn,this.destroy)},n}(),sh=function(){function n(e){this.parent=e,this.addEventListener()}return n.prototype.addEventListener=function(){this.parent.on(ai,this.keyDownHandler,this)},n.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off(ai,this.keyDownHandler)},n.prototype.keyDownHandler=function(n){var i=this,s=n.target,o=this.parent.enableRtl;if(n.altKey&&38===n.keyCode&&this.parent.element.lastElementChild.classList.contains("e-filter-popup"))this.parent.notify(Aa,{closePopup:!0});else{if(this.parent.allowPrint&&n.ctrlKey&&80===n.keyCode&&this.parent.enableKeyboardShortcut)return n.preventDefault(),void this.parent.print();var l=n.target;if((0,e.isNullOrUndefined)(l)||!l.classList.contains("e-addNoteContainer")){var d=this.parent.serviceLocator.getService(Al).dialogInstance,h=s.id===this.parent.element.id+"_name_box";if("None"===this.parent.selectionSettings.mode||d||this.parent.isEdit||s.classList.contains("e-ss-ddb")&&117!==n.keyCode&&9!==n.keyCode||h&&117!==n.keyCode||s.classList.contains("e-sheet-rename")||s.id===this.parent.element.id+"_SearchBox"||s.classList.contains("e-chk-hidden")||s.classList.contains("e-ddl")&&s.classList.contains("e-input-focus")){if(d){if(13===n.keyCode)d.element.classList.contains("e-spreadsheet-function-dlg")&&(s.classList.contains("e-formula-list")||s.classList.contains("e-list-item"))&&Fd(d.element.querySelector(".e-footer-content .e-primary"));else if(9===n.keyCode)if(d.element.classList.contains("e-find-dlg")){var p=d.element.querySelectorAll(".e-footer-content .e-btn:not(:disabled)"),c=p.length?p[p.length-1].className:"e-findnreplace-checkmatch";if(n.shiftKey){if(document.activeElement.classList.contains("e-dlg-closeicon-btn"))if(n.preventDefault(),p.length)Fd(p[p.length-1]);else{var u=d.element.querySelector(".e-findnreplace-exactmatchcheckbox");u&&(Fd(u.querySelector(".e-findnreplace-checkmatch")),u.classList.add("e-focus"))}}else document.activeElement.className.includes(c)&&Fd(d.element)}else if(d.element.classList.contains("e-protect-dlg")){if(n.shiftKey?document.activeElement.classList.contains("e-primary"):document.activeElement.id===this.parent.element.id+"_protect_check")if((f=d.element.querySelector(".e-protect-option-list"))&&!f.querySelector(".e-list-item.e-focused"))(m=f.querySelector(".e-list-item"))&&m.classList.add("e-focused")}else if(d.element.classList.contains("e-custom-format-dlg"))if(n.shiftKey){if(document.activeElement.className.includes("e-list-item e-active")){(f=(0,e.closest)(document.activeElement,".e-custom-listview"))&&Fd(f)}}else if(document.activeElement.classList.contains("e-btn")&&document.activeElement.parentElement.classList.contains("e-custom-dialog")){var f=d.element.querySelector(".e-custom-listview"),g=(0,e.getComponent)(f,"listview");if(f){var m;if(!(m=f.querySelector(".e-list-item.e-active"))){if(!(m=f.querySelector(".e-list-item")))return;g.selectItem(m)}n.preventDefault(),m.focus()}}else document.activeElement.classList.contains("e-list-item")&&Fd(d.element);else if(d.element.classList.contains("e-spreadsheet-function-dlg")){if(n.shiftKey&&document.activeElement.className.includes("e-list-item e-active"))(f=(0,e.closest)(document.activeElement,".e-formula-list"))&&Fd(f)}else if(d.element.classList.contains("e-goto-dlg")&&!d.element.classList.contains("e-dlg-modal"))if(n.shiftKey){if(document.activeElement.className.includes("e-dlg-closeicon-btn")){var v=d.element.querySelector(".e-footer-content .e-btn");v&&(n.preventDefault(),Fd(v))}}else document.activeElement.className.includes("e-btn-goto-ok")&&Fd(d.element)}else h&&9===n.keyCode&&n.shiftKey&&this.focusEle(n,".e-formula-bar",!1,!0);he={action:"getCurrentEditValue",editedValue:""};this.parent.notify(ei,he);var y=xr(he.editedValue,!0);this.parent.isEdit&&y&&n.shiftKey&&!n.ctrlKey&&sd(n.keyCode)&&this.shiftSelection(n)}else{var C=this.parent.getActiveSheet(),b=r(C.activeCell);if(n.altKey){if(40===n.keyCode){if(s.classList.contains("e-dropdown-btn")||s.classList.contains("e-split-btn"))return;var x={e:n,isFilterCell:!1};if(this.parent.notify(Aa,x),x.isFilterCell)return}if(40===n.keyCode&&!document.getElementById(this.parent.element.id+"listValid_popup"))if(se=this.parent.getCell(b[0],b[1])){var S=se.querySelector(".e-validation-list .e-ddl");if(S){Fd(S);var w=S.querySelector(".e-dropdownlist")||S;return void((g=(0,e.getComponent)(w,"dropdownlist"))&&g.showPopup())}}}s.id===this.parent.element.id+"_File"&&Fd(this.parent.element);var I,E=s.classList.contains("e-add-sheet-tab")||s.classList.contains("e-sheets-list")||s.classList.contains("e-tab-wrap")&&!!(0,e.closest)(s,".e-sheet-tabs-items")||s.classList.contains("e-aggregate-list")||s.classList.contains("e-scroll-nav");[9,37,38,39,40,33,34,35,36].indexOf(n.keyCode)>-1&&!E&&n.preventDefault();var N=t(C.selectedRange);if(36===n.keyCode){var R=this.parent.frozenColCount(C),O=void 0;if(n.ctrlKey||n.metaKey){var k=Dr(C,this.parent.frozenRowCount(C),!0);n.shiftKey?O=[b[0],b[1],k,Dr(C,R,!0,"columns")]:(O=[k,Dr(C,R,!0,"columns"),k])[3]=O[1],(M=this.parent.element.querySelector(".e-main-panel")).scrollTop&&(M.scrollTop=0);var A=this.parent.getScrollElement();A.scrollLeft&&(A.scrollLeft=0)}else if(n.shiftKey){var F=Dr(C,R,!0,"columns");O=C.frozenColumns&&Dr(C,b[1],!0,"columns")===F?[N[0],b[1],N[2],Dr(C,0,!0,"columns")]:[N[0],b[1],N[2],F],this.scrollNavigation([O[2],O[3]],!0)}else{F=Dr(C,R,!0,"columns");!C.frozenColumns||F!==b[1]&&R!==b[1]||(F=Dr(C,0,!0,"columns")),O=[b[0],F,b[0],F],this.scrollNavigation([O[0],O[1]],!0)}this.updateSelection(C,O,n)}else if(n.ctrlKey||n.metaKey){if(35===n.keyCode){n.preventDefault();var T=Dr(C,C.usedRange.rowIndex,!1);T=T>-1?T:C.usedRange.rowIndex;var D=Dr(C,C.usedRange.colIndex,!1,"columns");D=D>-1?D:C.usedRange.colIndex,n.shiftKey||(b[0]=T,b[1]=D),b[2]=T,b[3]=D,this.updateSelection(C,b.concat(b),n),this.scrollNavigation([T,D],!0)}else 32!==n.keyCode||n.shiftKey||(N[0]=0,N[2]=C.rowCount-1,this.updateSelection(C,N,{shiftKey:!0}));if(40===n.keyCode||39===n.keyCode||38===n.keyCode||37===n.keyCode)n.shiftKey?(40===n.keyCode?N[2]=this.getNextNonEmptyCell(N[2],b[1],"down"):39===n.keyCode&&!o||37===n.keyCode&&o?N[3]=this.getNextNonEmptyCell(b[0],N[3],"right"):38===n.keyCode?N[2]=this.getNextNonEmptyCell(N[2],b[1],"top"):N[3]=this.getNextNonEmptyCell(b[0],N[3],"left"),this.updateSelection(C,N,n),this.scrollNavigation([N[2],N[3]],!0)):(37===n.keyCode&&!o||39===n.keyCode&&o?b[1]=this.getNextNonEmptyCell(b[0],b[1],"left"):38===n.keyCode?b[0]=this.getNextNonEmptyCell(b[0],b[1],"top"):39===n.keyCode&&!o||37===n.keyCode&&o?b[1]=this.getNextNonEmptyCell(b[0],b[1],"right"):b[0]=this.getNextNonEmptyCell(b[0],b[1],"down"),this.parent.selectRange(a(b)),this.scrollNavigation([b[0],b[1]],!0));else if(117===n.keyCode){var L=document.activeElement;L.classList.contains("e-spreadsheet")||(0,e.closest)(L,".e-sheet")?this.setFocus("Sheet",n,!0):E?this.setFocus("SheetTabs",n):(0,e.closest)(L,".e-ribbon")?this.setFocus("Ribbon",n):(h||L.classList.contains("e-insert-function"))&&this.setFocus("FormulaBar",n)}}else{if(n.shiftKey){if(32===n.keyCode&&(n.preventDefault(),N[1]=0,N[3]=C.colCount-1,this.updateSelection(C,N,n)),this.shiftSelection(n),(34===n.keyCode||33===n.keyCode)&&this.parent.scrollModule&&this.parent.scrollModule.isKeyScroll){var P=0,M=this.parent.element.querySelector(".e-main-panel"),B=Dr(C,r(C.paneTopLeftCell)[0],!0),H=Pd(this.parent,B).height;if(34===n.keyCode){if(P=H+this.parent.scrollModule.offset.top.size,!this.parent.scrollSettings.isFinite)(q=this.parent.getMainContent().querySelector(".e-virtualtrack"))&&parseFloat(q.style.height)<P+H&&(q.style.height=P+H+"px")}else if(P=this.parent.scrollModule.offset.top.size-H,Math.round(P)<0){if(!M.scrollTop)return void this.parent.selectRange(a([N[0],N[1],B,N[3]]));P=0}var U=Dr(C,t(C.selectedRange)[2],!0),V=B>U?0:U-B;this.parent.scrollModule&&M.scrollTop&&(this.parent.scrollModule.isKeyScroll=!1),M.scrollTop=P,Bl((function(){34===n.keyCode?(N[2]=Dr(C,r(C.paneTopLeftCell)[0]+V,!0),i.parent.scrollSettings.isFinite&&N[2]>C.rowCount-1&&(N[2]=Dr(C,C.rowCount-1,!1),N[2]=N[2]<0?0:N[2])):(N[2]=Dr(C,r(C.paneTopLeftCell)[0]+V,!1),N[2]=N[2]<0?0:N[2]),i.updateSelection(C,N,n)}))}}else if(9===n.keyCode||(this.parent.enableRtl?37===n.keyCode:39===n.keyCode)){if((se=Ln(b[0],b[1],C))&&se.colSpan>1&&(b[1]+=se.colSpan-1),b[1]<C.colCount-1&&(!C.isProtected||C.protectSettings.selectCells))b[1]+=1,I=!0;else if(C.protectSettings.selectUnLockedCells){var z=this.getNextUnlockedCell("right",b);I=b[1]!==z[1]||b[0]!==z[0],b[1]=z[1],b[0]=z[0]}}else if(13===n.keyCode||40===n.keyCode){if((se=Ln(b[0],b[1],C))&&se.rowSpan>1&&(b[0]+=se.rowSpan-1),b[0]<C.rowCount-1&&(!C.isProtected||C.protectSettings.selectCells))I=!0,b[0]+=1;else if(C.protectSettings.selectUnLockedCells){z=this.getNextUnlockedCell("down",b);I=b[0]!==z[0]||b[1]!==z[1],b[1]=z[1],b[0]=z[0]}}else if((34===n.keyCode||33===n.keyCode)&&this.parent.scrollModule&&this.parent.scrollModule.isKeyScroll){M=this.parent.element.querySelector(".e-main-panel"),P=0;var _=Dr(C,r(C.paneTopLeftCell)[0],!0),j=Dr(C,r(C.activeCell)[0],!0);H=Pd(this.parent,_).height;if(34===n.keyCode){var q;if(P=this.parent.scrollModule.offset.top.size+H,!this.parent.scrollSettings.isFinite)(q=this.parent.getMainContent().querySelector(".e-virtualtrack"))&&parseFloat(q.style.height)<P+H&&(q.style.height=P+H+"px")}else{if(P=this.parent.scrollModule.offset.top.size-H,C.frozenRows&&b[0]<this.parent.frozenRowCount(C))return void this.parent.selectRange(a([_,N[1],_,N[1]]));if(Math.round(P)<0){if(!M.scrollTop)return;P=0}}var W=_>j?0:j-_;this.parent.scrollModule&&M.scrollTop&&(this.parent.scrollModule.isKeyScroll=!1),M.scrollTop=P,Bl((function(){var e;34===n.keyCode?(e=Dr(C,r(C.paneTopLeftCell)[0]+W,!0),i.parent.scrollSettings.isFinite&&e>C.rowCount-1&&(e=(e=Dr(C,C.rowCount-1,!1))<0?0:e)):(e=r(C.paneTopLeftCell)[0]+W,e-=i.parent.hiddenCount(_,j),e=(e=Dr(C,e,!1))<0?0:e),i.parent.notify(gi,{range:[e,b[1],e,b[1]],preventAnimation:!0})}))}if(n.shiftKey?9===n.keyCode:this.parent.enableRtl?39===n.keyCode:37===n.keyCode){if(b[1]>0&&(!C.isProtected||C.protectSettings.selectCells))b[1]-=1,I=!0;else if(C.protectSettings.selectUnLockedCells){z=this.getNextUnlockedCell("left",b);I=b[1]!==z[1]||b[0]!==z[0],b[1]=z[1],b[0]=z[0]}if(b[1]<=0){var G=this.parent.getMainContent();0===b[1]&&G.scrollLeft&&!this.parent.enableRtl&&(G.scrollLeft=0)}}else if((n.shiftKey?13===n.keyCode:38===n.keyCode)&&!this.parent.element.querySelector(".e-find-toolbar")){if(b[0]>0&&(!C.isProtected||C.protectSettings.selectCells))b[0]-=1,I=!0;else if(C.protectSettings.selectUnLockedCells){var Y=this.getNextUnlockedCell("up",b);I=b[0]!==Y[0]||b[1]!==Y[1],b[1]=Y[1],b[0]=Y[0]}if(b[0]<=0){var X=this.parent.getMainContent().parentElement;0===b[0]&&X.scrollTop&&(X.scrollTop=0)}}}if(!I||this.parent.scrollModule&&!this.parent.scrollModule.isKeyScroll||E||(0,e.closest)(document.activeElement,".e-ribbon")||s.classList.contains("e-insert-function")||s.classList.contains("e-formula-bar")&&(!s.classList.contains("e-formula-bar")||"TEXTAREA"!==s.nodeName||13!==n.keyCode)){if(9===n.keyCode){var K=this.parent.showRibbon&&(0,e.closest)(document.activeElement,".e-ribbon");if(K)(0,e.closest)(document.activeElement,".e-tab-header")?n.shiftKey||K.classList.contains("e-collapsed")?this.focusEle(n,".e-ribbon .e-drop-icon"):this.focusEle(n,".e-ribbon .e-content .e-toolbar-item:not(.e-separator):not(.e-overlay) .e-btn"):(0,e.closest)(document.activeElement,".e-content")?n.shiftKey?this.focusEle(n,".e-ribbon .e-toolbar-items .e-toolbar-item.e-active .e-tab-wrap",!0):this.focusEle(n,".e-ribbon .e-drop-icon"):document.activeElement.classList.contains("e-drop-icon")&&(n.shiftKey&&!K.classList.contains("e-collapsed")?this.focusEle(n,".e-ribbon .e-content .e-toolbar-item:not(.e-separator):not(.e-overlay) .e-btn"):this.focusEle(n,".e-ribbon .e-toolbar-items .e-toolbar-item.e-active .e-tab-wrap",!0));else if(s.classList.contains("e-insert-function"))n.shiftKey?this.focusEle(n,".e-formula-bar-panel .e-combobox"):this.focusEle(n,".e-formula-bar",!1,!0);else if(E)if(n.shiftKey){var $=s.classList.contains("e-aggregate-list")||s.classList.contains("e-scroll-left-nav");if(s.classList.contains("e-add-sheet-tab")||$||s.classList.contains("e-sheets-list")&&s.previousElementSibling&&s.previousElementSibling.disabled){var Z=!$&&this.parent.element.querySelector(".e-aggregate-list");if(Z)this.focusEle(n,null,!1,!1,Z);else if(!s.classList.contains("e-scroll-left-nav")&&this.parent.element.querySelector(".e-sheet-tab-panel .e-scroll-nav"))this.focusEle(n,".e-sheet-tab-panel .e-scroll-right-nav",!0);else{(Q=[].slice.call(this.parent.element.querySelectorAll(".e-sheet-tab-panel .e-toolbar-item")))[Q.length-1]&&this.focusEle(n,null,!0,!1,Q[Q.length-1].querySelector(".e-tab-wrap"))}}else if(s.classList.contains("e-scroll-right-nav"))this.focusEle(n,".e-sheet-tab-panel .e-scroll-left-nav",!0);else if(s.classList.contains("e-tab-wrap")){0===(z=(Q=[].slice.call(this.parent.element.querySelectorAll(".e-sheet-tab-panel .e-toolbar-item"))).indexOf(s.parentElement))?this.focusEle(n,".e-sheet-tab-panel .e-sheets-list"):this.focusEle(n,null,!0,!1,Q[z-1].querySelector(".e-tab-wrap"))}}else{var J=!!this.parent.element.querySelector(".e-aggregate-list");if(s.classList.contains("e-aggregate-list")||!J&&s.classList.contains("e-scroll-right-nav"))this.focusEle(n,".e-sheet-tab-panel .e-icon-btn:not(:disabled)");else if(s.classList.contains("e-sheets-list"))this.focusEle(n,".e-sheet-tab-panel .e-toolbar-item .e-tab-wrap",!0);else if(s.classList.contains("e-scroll-left-nav"))this.focusEle(n,".e-sheet-tab-panel .e-scroll-right-nav",!0);else if(s.classList.contains("e-tab-wrap")){var Q,ee=(Q=[].slice.call(this.parent.element.querySelectorAll(".e-sheet-tab-panel .e-toolbar-item"))).indexOf(s.parentElement);if(ee===Q.length-1){var te=!!this.parent.element.querySelector(".e-sheet-tab-panel .e-scroll-nav");!te&&J||this.focusEle(n,".e-sheet-tab-panel ."+(te?"e-scroll-nav":"e-icon-btn:not(:disabled)"),te)}else this.focusEle(n,null,!0,!1,Q[ee+1].querySelector(".e-tab-wrap"))}}}}else{if(40===n.keyCode||38===n.keyCode||13===n.keyCode)for(;cl(C,b[0]);)if((40===n.keyCode||!n.shiftKey&&13===n.keyCode)&&(b[0]=b[0]+1),(38===n.keyCode||n.shiftKey&&13===n.keyCode)&&(b[0]=b[0]-1,b[0]<0))return;if(37===n.keyCode||39===n.keyCode||9===n.keyCode)for(;Il(C,b[1]);)if((39===n.keyCode||!n.shiftKey&&9===n.keyCode)&&(b[1]=b[1]+1),(37===n.keyCode||n.shiftKey&&9===n.keyCode)&&(b[1]=b[1]-1,b[1]<0))return;var re=t(C.topLeftCell);C.frozenRows&&b[0]<re[0]&&(b[0]=Dr(C,re[0],!0)),C.frozenColumns&&b[1]<re[1]&&(b[1]=Dr(C,re[1],!0,"columns")),this.scrollNavigation(b);var ne=a(b),ie=function(t){var r;ne!==C.selectedRange&&(i.parent.selectionModule.previousActiveCell=C.activeCell,document.getElementsByClassName("e-addNoteContainer")&&document.getElementsByClassName("e-addNoteContainer").length>0&&i.parent.notify(pa,""),i.parent.setSheetPropertyOnMute(C,"activeCell",ne),i.parent.notify(gi,{range:b.concat(b),preventAnimation:t}),e.Browser.isDevice&&"safari"===e.Browser.info.name&&(e.Browser.isIos||e.Browser.isIos7)&&(r=i.parent.element.querySelector(".e-ss-focus-edit")),(r=r||i.parent.getCell(b[0],b[1]))&&Fd(r))};if(this.parent.scrollModule&&this.parent.scrollModule.isKeyScroll){if(ne===C.selectedRange)return;Bl(ie.bind(this,!0))}else ie()}}}else if("Escape"===n.key||27===n.keyCode){var ae=!(0,e.isNullOrUndefined)(this.parent.spreadsheetNoteModule.noteCellIndexes)?this.parent.spreadsheetNoteModule.noteCellIndexes:r(this.parent.getActiveSheet().activeCell),se=Ln(ae[0],ae[1],this.parent.getActiveSheet()),oe=this.parent.getCell(ae[0],ae[1]),le=On(this.parent,this.parent.activeSheetIndex)+"!"+a(ae);if(!(0,e.isNullOrUndefined)(l)&&!(0,e.isNullOrUndefined)(l.value)&&((0,e.isNullOrUndefined)(se)||(0,e.isNullOrUndefined)(se.notes)||se.notes!==l.value)&&document.activeElement.className.indexOf("e-addNoteContainer")>-1){var de=!(0,e.isNullOrUndefined)(se)&&se.notes?"editNote":"addNote";this.parent.notify(ya,{args:{action:"beforeCellSave",eventArgs:{address:le}}}),Hr(this.parent,this.parent.getActiveSheet(),{rowIdx:ae[0],colIdx:ae[1],preventEvt:!0,cell:{notes:l.value,isNoteEditable:!1}});var he={notes:l.value,address:le};this.parent.notify(ka,{eventArgs:he,action:de})}this.parent.spreadsheetNoteModule.isShowNote=null,this.parent.notify(pa,""),Fd(oe)}}},n.prototype.setFocus=function(e,t,r){"Sheet"===e?t.shiftKey?this.parent.showFormulaBar?this.focusEle(t,".e-formula-bar-panel .e-combobox"):this.setFocus("FormulaBar",t,r):this.parent.showSheetTabs?this.focusEle(t,".e-sheet-tab-panel .e-icon-btn:not(:disabled)"):this.setFocus("SheetTabs",t,r):"SheetTabs"===e?t.shiftKey?r||this.focusEle(t,".e-selectall"):this.parent.showRibbon?this.focusEle(t,".e-ribbon .e-toolbar-items .e-toolbar-item.e-active .e-tab-wrap",!0):this.setFocus("Ribbon",t,r):"Ribbon"===e?t.shiftKey?this.parent.showSheetTabs?this.focusEle(t,".e-sheet-tab-panel .e-icon-btn:not(:disabled)"):r||this.focusEle(t,".e-selectall"):this.parent.showFormulaBar?this.focusEle(t,".e-formula-bar-panel .e-combobox"):this.setFocus("FormulaBar",t,r):"FormulaBar"===e&&(t.shiftKey?this.parent.showRibbon?this.focusEle(t,".e-ribbon .e-toolbar-items .e-toolbar-item.e-active .e-tab-wrap",!0):this.setFocus("Ribbon",t,r):r||this.focusEle(t,".e-selectall"))},n.prototype.focusEle=function(t,r,n,i,a){if(a=a||this.parent.element.querySelector(r),n&&!a){var s=(o=this.parent.element.querySelector(".e-ribbon .e-tab"))&&(0,e.getComponent)(o,"tab").selectedItem||0;a=(a=this.parent.element.querySelector(".e-tab-header").getElementsByClassName("e-toolbar-item")[s])&&a.querySelector(".e-tab-wrap")}if(a)if(t.preventDefault(),i)a.click(),Fd(a),a.setSelectionRange(a.value.length,a.value.length);else if(n){var o;if(a.setAttribute("tabindex","0"),a.parentElement.classList.contains("e-active")&&a.parentElement.classList.contains("e-toolbar-item"))!(o=this.parent.element.querySelector(".e-sheet-tab-panel .e-sheet-tab"))&&o.classList.contains("e-focused")&&o.classList.add("e-focused");a.focus()}else Fd(a)},n.prototype.updateSelection=function(e,t,r){e.isProtected&&!e.protectSettings.selectCells&&e.protectSettings.selectUnLockedCells&&Td(this.parent,c(t))||this.parent.notify(gi,{range:t,shiftKey:r.shiftKey})},n.prototype.getNextNonEmptyCell=function(r,n,i){var a,s,o=this.parent.getActiveSheet(),l=function(t,r){var n=Ln(t,r,o,null,!0).value;return!(0,e.isNullOrUndefined)(n)&&""!==n};if("down"===i){a=l(p=Dr(o,r+1,!0),n);for(var d=Dr(o,o.rowCount-1,!1),h=p;h<o.rowCount;h++){if(h===d)return h;if(a){if(!l(Dr(o,h,!0),n))return Dr(o,h-1,!1)}else if(l(s=Dr(o,h+1,!0),n))return s}return r}if("top"===i){var p;a=l(p=Dr(o,r-1,!1),n);for(var c=this.parent.frozenRowCount(o)?t(o.topLeftCell)[0]:0,u=Dr(o,c,!0),f=p;f>=0;f--){if(f===u)return f;if(a){if(!l(Dr(o,f,!1),n))return Dr(o,f+1,!0)}else if(l(s=Dr(o,f-1,!1),n))return s}return r}if("right"===i){var g;a=l(r,g=Dr(o,n+1,!0,"columns"));for(var m=Dr(o,o.colCount-1,!1,"columns"),v=g;v<o.colCount;v++){if(v===m)return v;if(a){if(!l(r,Dr(o,v,!0,"columns")))return Dr(o,v-1,!1,"columns")}else if(l(r,s=Dr(o,v+1,!0,"columns")))return s}return n}a=l(r,g=Dr(o,n-1,!1,"columns"));c=this.parent.frozenColCount(o)?t(o.topLeftCell)[1]:0,u=Dr(o,c,!0,"columns");for(var y=g;y>=0;y--){if(y===u)return y;if(a){if(!l(r,Dr(o,y,!1,"columns")))return Dr(o,y+1,!0,"columns")}else if(l(r,s=Dr(o,y-1,!1,"columns")))return s}return n},n.prototype.getNextUnlockedCell=function(e,t){var r,n=this.parent.getActiveSheet();if("right"===e)for(var i=t[0],a=void 0,s=void 0,o=n.usedRange.rowIndex,l=n.usedRange.colIndex;i<=o;){for(a=void 0===a?t[1]+1:0,s&&i===t[0]&&(l=t[1]-1);a<=l;a++)if(!Ar(Ln(i,a,n),r=bl(n,a)||{})&&!r.hidden&&!cl(n,i))return[i,a];i!==n.usedRange.rowIndex||s?i++:(i=0,o=t[0],s=!0)}else if("left"===e)for(i=t[0],a=void 0,s=void 0,o=0,l=0;i>=o;){for(a=void 0===a?t[1]-1:n.usedRange.colIndex,s&&i===t[0]&&(l=t[1]+1);a>=l;a--)if(!Ar(Ln(i,a,n),r=bl(n,a)||{})&&!r.hidden&&!cl(n,i))return[i,a];0!==i||s?i--:(i=n.usedRange.rowIndex,o=t[0],s=!0)}else if("down"===e)for(a=t[1],i=void 0,s=void 0,l=n.usedRange.colIndex,o=n.usedRange.rowIndex;a<=l;){for(i=void 0===i?t[0]+1:0,s&&a===t[1]&&(o=t[0]-1);i<=o;i++)if(!Ar(Ln(i,a,n),r=bl(n,a)||{})&&!r.hidden&&!cl(n,i))return[i,a];a!==n.usedRange.colIndex||s?a++:(a=0,l=t[1],s=!0)}else for(a=t[1],i=void 0,s=void 0,l=0,o=0;a>=l;){for(i=void 0===i?t[0]-1:n.usedRange.rowIndex,s&&a===t[1]&&(o=t[0]+1);i>=o;i--)if(!Ar(Ln(i,a,n),r=bl(n,a)||{})&&!r.hidden&&!cl(n,i))return[i,a];0!==a||s?a--:(a=n.usedRange.colIndex,l=t[1],s=!0)}return t},n.prototype.shiftSelection=function(n){var i=this.parent.getActiveSheet(),s=t(i.selectedRange),o=c(s),l=!0,d=this.parent.enableRtl;if(38===n.keyCode){for(var h=o[1];h<=o[3];h++){var p=Ln(s[2],h,i);if(!(0,e.isNullOrUndefined)(p)&&p.rowSpan&&p.rowSpan<0){s[2]=Dr(i,s[2]-(Math.abs(p.rowSpan)+1),!1),l=!1;break}}l&&(s[2]=Dr(i,s[2]-1,!1));var u=this.parent.frozenRowCount(i)?t(i.topLeftCell)[0]:0;if(s[2]<u)return}if(40===n.keyCode){for(h=o[1];h<=o[3];h++){p=Ln(s[2],h,i);if(!(0,e.isNullOrUndefined)(p)&&p.rowSpan&&p.rowSpan>0){s[2]=Dr(i,s[2]+Math.abs(p.rowSpan),!0),l=!1;break}}if(l&&(s[2]=Dr(i,s[2]+1,!0)),s[2]>=i.rowCount&&(s[2]=Dr(i,i.rowCount-1,!1),s[2]<0))return}if(39===n.keyCode&&!d||37===n.keyCode&&d){for(h=o[0];h<=o[2];h++){p=Ln(h,s[3],i);if(!(0,e.isNullOrUndefined)(p)&&p.colSpan&&p.colSpan>0){s[3]=Dr(i,s[3]+Math.abs(p.colSpan),!0,"columns"),l=!1;break}}if(l&&(s[3]=Dr(i,s[3]+1,!0,"columns")),s[3]>=i.colCount&&(s[3]=Dr(i,i.colCount-1,!1,"columns"),s[3]<0))return}if(37===n.keyCode&&!d||39===n.keyCode&&d){for(h=o[0];h<=o[2];h++){p=Ln(h,s[3],i);if(!(0,e.isNullOrUndefined)(p)&&p.colSpan&&p.colSpan<0){s[3]=Dr(i,s[3]-(Math.abs(p.colSpan)+1),!1,"columns"),l=!1;break}}l&&(s[3]=Dr(i,s[3]-1,!1,"columns"));u=this.parent.frozenColCount(i)?t(i.topLeftCell)[1]:0;if(s[3]<u)return}if(!this.parent.scrollSettings.enableVirtualization&&n.shiftKey&&n.ctrlKey){var f=[i.usedRange.rowIndex,i.usedRange.colIndex];if(37===n.keyCode&&(s[3]<=f[1]?s[3]=Dr(i,0,!0,"columns"):s[3]=Dr(i,f[1],!0,"columns")),38===n.keyCode&&(s[2]<=f[0]?s[2]=Dr(i,0,!0):s[2]=Dr(i,f[0],!0)),39===n.keyCode&&(s[3]<=f[1]?s[3]=Dr(i,f[1],!1,"columns"):s[3]=Dr(i,i.colCount,!1,"columns"),s[3]<0))return;if(40===n.keyCode&&(s[2]<=f[0]?s[2]=Dr(i,f[0],!1):s[2]=Dr(i,i.rowCount,!1),s[2]<0))return}if(37===n.keyCode||39===n.keyCode||38===n.keyCode||40===n.keyCode){var g=r(i.activeCell);this.parent.isEdit&&n.shiftKey?(n.preventDefault(),this.parent.notify(Ni,{range:s,e:n}),this.parent.notify(cs,{range:a(c(s)),isSelect:!1}),this.parent.notify(ds,{})):this.parent.notify(gi,{range:s,shiftKey:n.shiftKey}),this.scrollNavigation([Er(i,s)?g[0]:s[2],Ir(i,s)?g[1]:s[3]])}},n.prototype.scrollNavigation=function(e,n){if(this.parent.allowScrolling){var i=this.parent.enableRtl?-1:1,a=this.parent.getMainContent().parentElement,s=this.parent.getScrollElement(),o=this.parent.getActiveSheet(),l=c(t(o.selectedRange)),d=r(o.topLeftCell),h=this.parent.frozenRowCount(o),p=this.parent.frozenColCount(o),u=r(o.paneTopLeftCell),f=Dr(o,e[0]<h?d[0]:u[0],!0),g=this.parent.scrollModule.offset.top.size;if(a.scrollTop)if(h&&e[0]!==l[2]){if(e[0]===h)return void(a.scrollTop=0);e[0]===h-1&&(a.scrollTop=0)}else if(e[0]===Dr(o,0,!0))return void(a.scrollTop=0);if(s&&s.scrollLeft)if(p&&e[1]!==l[3]){if(e[1]===p)return void(s.scrollLeft=0);e[1]===p-1&&(s.scrollLeft=0)}else if(e[1]===Dr(o,0,!0,"columns"))return void(s.scrollLeft=0);var m=Pd(this.parent,f).index;if(m<=e[0]){if(e[0]>=h)if(n){var v=a.getBoundingClientRect().height,y=ml(o,u[0],e[0],!0);a.scrollTop=y>2*v?g+y-v:g+y-fl(o,e[0],!0),Fd(this.parent.element)}else a.scrollTop=g+ml(o,m,e[0],!0)}else f>e[0]&&(a.scrollTop&&(this.parent.scrollModule.isKeyScroll=!1),a.scrollTop=g-Math.ceil(ml(o,e[0],f-1,!0)),n&&Fd(this.parent.element));var C=Md(this.parent,u[1]);if(C<=e[1]&&s){if(e[1]>=p)if(n){var b=s.getBoundingClientRect().width,x=wl(o,u[1],e[1],!0);s.scrollLeft=x>2*b?(this.parent.scrollModule.offset.left.size+x-b)*i:(this.parent.scrollModule.offset.left.size+(x-Sl(o,e[0],null,!0)))*i,Fd(this.parent.element)}else s.scrollLeft=(this.parent.scrollModule.offset.left.size+wl(o,C,e[1],!0))*i}else u[1]>e[1]&&s&&(s.scrollLeft&&(this.parent.scrollModule.isKeyScroll=!1),s.scrollLeft=(this.parent.scrollModule.offset.left.size-wl(o,e[1],u[1]-1,!0))*i,n&&Fd(this.parent.element))}},n.prototype.getModuleName=function(){return"keyboardNavigation"},n.prototype.destroy=function(){this.removeEventListener(),this.parent=null},n}(),oh=function(){function n(e){this.parent=e,this.addEventListener()}return n.prototype.addEventListener=function(){this.parent.on(ai,this.keyDownHandler,this),this.parent.on(ii,this.keyUpHandler,this)},n.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(ai,this.keyDownHandler),this.parent.off(ii,this.keyUpHandler))},n.prototype.isTrgtNotInput=function(t){var r=t.target;return!((0,e.closest)(r,".e-filter-popup")||(0,e.closest)(r,".e-find-dlg")||(0,e.closest)(r,".e-hyperlink-dlg")||(0,e.closest)(r,".e-sheet-tab")||(0,e.closest)(r,".e-name-box")||(0,e.closest)(r,".e-link-dialog"))},n.prototype.ribbonShortCuts=function(t){if(this.parent.showRibbon&&t.altKey&&!t.ctrlKey&&!t.shiftKey){var n=(0,e.getComponent)(this.parent.element.querySelector(".e-ribbon .e-tab"),"tab"),i=void 0;if(72===t.keyCode)i=1;else if(78===t.keyCode)i=2;else if(65===t.keyCode)i=4;else if(87===t.keyCode)i=5;else if(77===t.keyCode)i=3;else if(70===t.keyCode)t.preventDefault(),(0,e.select)("#"+this.parent.element.id+"_File",this.parent.element).click();else if(18===t.keyCode){t.preventDefault();var a=r(this.parent.getActiveSheet().activeCell),s={sheetIdx:this.parent.activeSheetIndex};if(this.parent.notify(Fa,s),!(s.hasFilter&&s.filterRange&&s.filterRange[0]===a[0]&&s.filterRange[1]<=a[1]&&s.filterRange[3]>=a[1])){var o=document.activeElement;if(!(o.classList.contains("e-spreadsheet-edit")||o.classList.contains("e-sheet-rename")||o.id===this.parent.element.id+"_name_box"||(0,e.closest)(o,".e-dropdown-btn")||(0,e.closest)(o,".e-split-btn")||(0,e.closest)(o,".e-popup-open"))){var l=this.parent.getCell(a[0],a[1]);if(l&&l.querySelector(".e-validation-list"))return;if((0,e.closest)(o,".e-ribbon"))return void Fd(this.parent.element);for(var d=0;d<=this.parent.ribbonModule.ribbon.items.length;d++)if(d===this.parent.ribbonModule.ribbon.selectedTab){var h=this.parent.element.querySelector(".e-toolbar-items").children[d+2].children[0];return h.setAttribute("tabindex","0"),void Fd(h)}}}}i&&(n.items[i].disabled||n.items[i].cssClass.includes("e-hide")?Fd(this.parent.element):(t.preventDefault(),n.select(i,Object.assign(t,{isShortcut:!0}))))}},n.prototype.keyUpHandler=function(t){if(37===t.keyCode||39===t.keyCode){var r=document.activeElement;if(r.classList.contains("e-colorpicker-wrapper")||r.classList.contains("e-split-btn-wrapper")){var n=r.querySelector(".e-split-btn");n&&Fd(n)}}else if(13===t.keyCode){var i=t.target;if(i.classList.contains("e-scroll-nav")){var a=function(){i.getAttribute("tabindex")||(i.setAttribute("tabindex","0"),Fd(i)),e.EventHandler.remove(i,"blur",a)};e.EventHandler.add(i,"blur",a,this)}}},n.prototype.keyDownHandler=function(n){var i="None"===this.parent.selectionSettings.mode;this.ribbonShortCuts(n);var s=this.parent.getActiveSheet(),o=n.target,l=n.target;if((0,e.isNullOrUndefined)(l)||!l.classList.contains("e-addNoteContainer")){if((n.ctrlKey||n.metaKey)&&this.isTrgtNotInput(n)){(0,e.closest)(o,".e-find-dlg")||i||([79,83].indexOf(n.keyCode)>-1?n.preventDefault():65!==n.keyCode||this.parent.isEdit||n.preventDefault());var d=r(s.activeCell);if(79===n.keyCode)this.parent.allowOpen&&this.parent.openUrl&&(0,e.select)("#"+this.parent.element.id+"_fileUpload",this.parent.element).click();else if(83===n.keyCode)this.parent.saveUrl&&this.parent.allowSave&&this.parent.notify(J,null);else if(67!==n.keyCode||i)if(75!==n.keyCode||i)if(90!==n.keyCode||i)if(89!==n.keyCode||i){if((82===n.keyCode||68===n.keyCode)&&!i){n.preventDefault();var h=c(t(s.selectedRange)),p={colIndex:h[1],rowIndex:h[0]},u=void 0,f=void 0;if(68===n.keyCode?(h[0]===h[2]?p.rowIndex=h[0]-1:h[0]+=1,f=a([p.rowIndex,p.colIndex,p.rowIndex,h[3]]),u="Down"):(h[1]===h[3]?p.colIndex=h[1]-1:h[1]+=1,u="Right",f=a([p.rowIndex,p.colIndex,h[2],p.colIndex])),p.rowIndex<0||p.colIndex<0)return;this.parent.notify(Xs,{fillType:Ln(p.rowIndex,p.colIndex,s,!1,!0).formula?"FillSeries":"CopyCells",dAutoFillCell:f,rangeInfo:{direction:u,startCell:p,endCell:{rowIndex:h[2],colIndex:h[3]},fillRange:h}}),this.parent.notify(rr,{type:"mousedown"}),this.parent.notify(Mt,null)}}else this.parent.isEdit||(n.preventDefault(),this.parent.notify(ma,{isUndo:!1}));else this.parent.isEdit||(n.preventDefault(),this.parent.notify(ma,{isUndo:!0}));else{var g=s.rows[d[0]],m=void 0;n.preventDefault(),(0,e.isNullOrUndefined)(g)||(m=g.cells[d[1]]),(0,e.isNullOrUndefined)(m)&&Pn(d[0],d[1],s,m,!1),m&&m.hyperlink?this.parent.notify(na,null):this.parent.notify(ra,null)}else this.parent.notify(Oi,{promise:Promise});var v=s.isProtected&&Ar(Ln(d[0],d[1],s),bl(s,d[1]));if(70===n.keyCode&&!i&&this.parent.allowFindAndReplace&&(n.preventDefault(),this.parent.notify(Z,{})),v&&s.isProtected&&86!==n.keyCode||70===n.keyCode||i||(71===n.keyCode?(n.preventDefault(),this.parent.notify(ja,null)):72===n.keyCode?(n.preventDefault(),this.parent.notify(qa,null)):88===n.keyCode?this.parent.notify(Ri,{promise:Promise}):86===n.keyCode&&this.parent.notify(ki,{isAction:!0}),!n.shiftKey||76!==n.keyCode||this.parent.isEdit||s.isProtected||(n.preventDefault(),this.parent.notify(xa,{}))),!i&&(!s.isProtected||s.protectSettings.formatCells))if(66===n.keyCode)n.preventDefault(),y="bold"===(y=this.parent.getCellStyleValue(["fontWeight"],d).fontWeight)?"normal":"bold",this.parent.notify(ae,{style:{fontWeight:y},onActionUpdate:!0,refreshRibbon:!0});else if(73===n.keyCode){var y;n.preventDefault(),y="italic"===(y=this.parent.getCellStyleValue(["fontStyle"],d).fontStyle)?"normal":"italic",this.parent.notify(ae,{style:{fontStyle:y},onActionUpdate:!0,refreshRibbon:!0})}else n.ctrlKey&&85===n.keyCode&&!n.shiftKey?(n.preventDefault(),this.parent.notify(oe,{style:{textDecoration:"underline"},refreshRibbon:!0})):n.ctrlKey&&53===n.keyCode&&!n.shiftKey&&(n.preventDefault(),this.parent.notify(oe,{style:{textDecoration:"line-through"},refreshRibbon:!0}))}if(27===n.keyCode&&this.parent.notify(Ai,null),((n.ctrlKey||n.metaKey)&&119===n.keyCode||13===n.keyCode&&o.classList.contains("e-drop-icon"))&&this.parent.showRibbon){n.preventDefault();var C=this.parent.element.querySelector(".e-drop-icon");C&&C.click()}if((n.ctrlKey||n.metaKey)&&!i)if(57===n.keyCode){if(!s.isProtected||s.protectSettings.formatRows){n.preventDefault();d=t(s.selectedRange);this.parent.notify(Rt,{startIndex:d[0],endIndex:d[2],hide:!n.shiftKey,isCol:!1,actionUpdate:!0})}}else if(48===n.keyCode&&(!s.isProtected||s.protectSettings.formatColumns)){d=t(s.selectedRange);this.parent.notify(Rt,{startIndex:d[1],endIndex:d[3],hide:!n.shiftKey,isCol:!0,actionUpdate:!0})}if(n.shiftKey&&!i)if(113!==n.keyCode||s.isProtected){if(114===n.keyCode)n.preventDefault(),this.parent.notify(io,null);else if(116===n.keyCode&&this.parent.allowFindAndReplace)n.preventDefault(),this.parent.notify(Z,{});else if(121===n.keyCode){var b=document.activeElement.className;["e-spreadsheet","e-cell","e-header-cell","e-clipboard","e-rowhdr-table","e-selectall-table","e-main-panel"].some((function(e){return b.includes(e)}))&&this.focusTarget(s)}}else n.preventDefault(),n.target.children.length>0&&"string"==typeof n.target.children[n.target.children.length-1].className&&n.target.children[n.target.children.length-1].className.indexOf("e-addNoteIndicator")>-1?this.parent.notify(sa,null):this.parent.notify(aa,null);if(n.altKey&&!i&&((n.ctrlKey||n.metaKey)&&78===n.keyCode?(n.preventDefault(),this.parent.refresh(!0)):113===n.keyCode&&this.parent.saveUrl&&(n.preventDefault(),this.parent.notify(J,null))),(n.ctrlKey||n.metaKey)&&n.shiftKey&&!i){if(!s.isProtected||s.protectSettings.formatCells){var x=s.selectedRange,S=void 0;if(192===n.keyCode)S="General";else if(52===n.keyCode)S=Mo("CurrencyWithColorCode");else if(53===n.keyCode)S="0%";else if(54===n.keyCode)S=Mo("Scientific");else if(51===n.keyCode)S="dd-mmm-yy";else if(50===n.keyCode)S="h:mm AM/PM";else if(49===n.keyCode)S=Mo("Number");else if(55===n.keyCode){n.preventDefault();this.parent.notify(ae,{style:{border:"1px solid #000000"},onActionUpdate:!0,borderType:"Outer"})}if(S)if(!zd(this.parent,c(t(x)))){var w={format:S,range:x,cancel:!1,requestType:"NumberFormat"},I={range:s.name+"!"+w.range,format:w.format,requestType:"NumberFormat"};this.parent.trigger("beforeCellFormat",w),this.parent.notify(K,{eventArgs:w,action:"format"}),w.cancel||(this.parent.notify(te,w),this.parent.notify(rr,{type:"mousedown"}),this.parent.notify(ka,{eventArgs:I,action:"format"}),this.parent.notify(Mt,null))}}if(85===n.keyCode){n.preventDefault();var E=this.parent.element.querySelector(".e-formula-bar-panel .e-drop-icon");E&&E.click()}}122!==n.keyCode||!n.shiftKey||n.ctrlKey||this.parent.isProtected||this.parent.notify($e,{model:this.parent,start:this.parent.activeSheetIndex+1,end:this.parent.activeSheetIndex+1,modelType:"Sheet",isAction:!0,activeSheetIndex:this.parent.activeSheetIndex+1}),n.shiftKey&&n.altKey&&75===n.keyCode&&this.parent.showSheetTabs&&this.parent.element.querySelector(".e-sheets-list").click()}},n.prototype.focusTarget=function(e){var r,n=c(t(e.selectedRange)),i=0===n[1]&&n[3]===e.colCount-1,a=0===n[0]&&n[2]===e.rowCount-1;if(i&&a)r=this.parent.element.querySelector(".e-selectall");else if(i){var s=this.parent.frozenRowCount(e);if(n[0]<s){r=(p=this.parent.getRow(n[0],this.parent.sheetModule.getSelectAllTable()))&&p.cells[0]}else{n[0]=Dr(e,n[0],!0);var o=Dr(e,t(e.paneTopLeftCell)[0],!0),l=Pd(this.parent,o).index,d=void 0;r=(d=n[0]>o&&n[0]<l?this.parent.getRow(n[0],this.parent.getRowHeaderTable()):n[0]>=l?this.parent.getRow(l-1,this.parent.getRowHeaderTable()):this.parent.getRow(o+1,this.parent.getRowHeaderTable()))&&d.cells[0]}}else if(a){var h=this.parent.frozenColCount(e);if(n[1]<h){var p;r=(p=this.parent.element.querySelector(".e-selectall-container .e-header-row"))&&this.parent.getCell(0,n[1],p)}else{n[1]=Dr(e,n[1],!0,"columns");var u=Dr(e,t(e.paneTopLeftCell)[1],!0,"columns"),f=Md(this.parent,u);d=this.parent.element.querySelector(".e-column-header .e-header-row");r=n[1]>u&&n[1]<f?d&&this.parent.getCell(0,n[1],d):n[1]>=f?d&&this.parent.getCell(0,f-1,d):d&&this.parent.getCell(0,u+1,d)}}else{var g=t(e.paneTopLeftCell);r=this.parent.getCell(n[0],n[1]);s=this.parent.frozenRowCount(e),h=this.parent.frozenColCount(e);if(n[0]<s&&n[1]<h)r=this.parent.getCell(n[0],n[1]);else if(n[0]<s){u=t(e.paneTopLeftCell)[1],f=Md(this.parent,u);r=n[1]>u&&n[1]<f?this.parent.getCell(n[0],n[1]):n[1]>=f?this.parent.getCell(n[0],f-1):this.parent.getCell(n[0],u+1)}else if(n[1]<h){o=t(e.paneTopLeftCell)[0],l=Pd(this.parent,o).index;r=n[0]>o&&n[0]<l?this.parent.getCell(n[0],n[1]):n[0]>=l?this.parent.getCell(l-1,n[1]):this.parent.getCell(o+1,n[1])}else{o=t(e.paneTopLeftCell)[0],l=Pd(this.parent,o).index,u=t(e.paneTopLeftCell)[1],f=Md(this.parent,u);r=n[0]>o&&n[0]<l?n[1]>u&&n[1]<f?this.parent.getCell(n[0],n[1]):n[1]>=f?this.parent.getCell(n[0],f-1):this.parent.getCell(n[0],u+1):n[0]>=l?n[1]>u&&n[1]<f?this.parent.getCell(l-1,n[1]):n[1]>=f?this.parent.getCell(l-1,f-1):this.parent.getCell(l-1,u+1):n[1]>u&&n[1]<f?this.parent.getCell(o+1,n[1]):n[1]>=f?this.parent.getCell(o+1,f-1):this.parent.getCell(o+1,u+1)}r||(r=this.parent.getCell(g[0]+1,g[1]+1))}r&&Fd(r)},n.prototype.getModuleName=function(){return"keyboardShortcut"},n.prototype.destroy=function(){this.removeEventListener(),this.parent=null},n}(),lh=function(){function r(e){this.checkHeight=!1,this.parent=e,this.addEventListener()}return r.prototype.applyCellFormat=function(e){if(e.checkHeight)return this.checkHeight||(this.checkHeight=!0),void this.updateRowHeight(e.rowIdx,e.colIdx,e.lastCell,e.onActionUpdate,e.outsideViewport);var t=Object.keys(e.style),r=this.parent.getActiveSheet();if(!(e.lastCell&&!t.length&&Ad(r,e.rowIdx)<=(r.standardHeight||20))){var n=e.td||this.parent.getCell(e.rowIdx,e.colIdx);if(n){this.updateMergeBorder(e,r);var i=void 0;if(e.formatColor&&n.style.color===e.formatColor&&(i=e.style.color,delete e.style.color),void 0!==e.style.border||void 0!==e.style.borderTop||void 0!==e.style.borderLeft){var a={};Object.keys(e.style).forEach((function(t){a[""+t]=e.style[""+t]})),void 0!==a.border&&(Object.assign(n.style,{borderRight:e.style.border,borderBottom:e.style.border}),this.setLeftBorder(e.style.border,n,e.rowIdx,e.colIdx,e.row,e.onActionUpdate,e.first,r),this.setTopBorder(e.style.border,n,e.rowIdx,e.colIdx,e.pRow,e.pHRow,e.onActionUpdate,e.first,e.lastCell,e.manualUpdate,r),delete a.border),void 0!==a.borderTop&&(this.setTopBorder(e.style.borderTop,n,e.rowIdx,e.colIdx,e.pRow,e.pHRow,e.onActionUpdate,e.first,e.lastCell,e.manualUpdate,r),delete a.borderTop),void 0!==a.borderLeft&&(this.setLeftBorder(e.style.borderLeft,n,e.rowIdx,e.colIdx,e.row,e.onActionUpdate,e.first,r),delete a.borderLeft),Object.keys(a).length&&(void 0!==a.borderBottom&&this.setThickBorderHeight(a.borderBottom,e.rowIdx,e.colIdx,n,e.row,e.hRow,e.onActionUpdate,e.lastCell,e.manualUpdate),Object.assign(n.style,a))}else{void 0!==e.style.borderBottom&&this.setThickBorderHeight(e.style.borderBottom,e.rowIdx,e.colIdx,n,e.row,e.hRow,e.onActionUpdate,e.lastCell,e.manualUpdate),Object.assign(n.style,e.style),n&&n.querySelector(".e-cf-databar")&&e.style.verticalAlign&&(n.querySelector(".e-databar-value").style.alignItems="top"===e.style.verticalAlign?"start":"middle"===e.style.verticalAlign?"center":"end");var s=Ln(e.rowIdx,e.colIdx,r);if(s&&(s.rowSpan||s.colSpan)&&n.offsetHeight>0)(o=Sd(this.parent,s.style||this.parent.cellStyle))>n.offsetHeight&&xd(this.parent,r,n.offsetHeight,e.rowIdx)}var o,l=Ln(e.rowIdx,e.colIdx,r,null,!0);if(r.rows[e.rowIdx]&&r.rows[e.rowIdx].customHeight){if(!l.wrap&&(e.style.fontSize||e.style.fontFamily)){var d=fl(r,e.rowIdx,!0)-Nd(e.rowIdx,e.colIdx,r);d<Sd(this.parent,l.style)?n.style.lineHeight=d+"px":n.style.lineHeight&&(n.style.lineHeight="")}}else if(e.isHeightCheckNeeded)if(e.manualUpdate)this.checkHeight||(this.checkHeight=Lr(e.style,e.onActionUpdate)),n&&n.children[0]&&"e-cf-databar"===n.children[0].className&&e.style.fontSize&&(n.children[0].querySelector(".e-databar-value").style.fontSize=e.style.fontSize),e.isFromAutoFillOption||this.updateRowHeight(e.rowIdx,e.colIdx,e.lastCell,e.onActionUpdate),l.wrap&&(e.style.fontSize||e.style.fontFamily)&&(n.style.lineHeight=parseFloat(l.style&&l.style.fontSize||this.parent.cellStyle.fontSize)*wd(l.style&&l.style.fontFamily?l.style:this.parent.cellStyle)+"pt");else if(!l.wrap&&Lr(e.style)&&kd(r,e.rowIdx,e.colIdx,Od(this.parent,e.rowIdx,e.colIdx,r,e.style)),e.lastCell)(o=Ad(r,e.rowIdx))>(r.standardHeight||20)&&o>fl(r,e.rowIdx)&&xd(this.parent,r,o,e.rowIdx,e.row,e.hRow);void 0!==i&&(e.style.color=i)}else this.updateRowHeight(e.rowIdx,e.colIdx,!0,e.onActionUpdate)}},r.prototype.updateRowHeight=function(e,t,r,n,i){if(this.checkHeight){var a=this.parent.getActiveSheet(),s=Ln(e,t,a,null,!0);if(!s.rowSpan){var o=0;o=Od(this.parent,e,t,a,s.style||this.parent.cellStyle,s.wrap&&!s.colSpan?Ed(this.parent.getDisplayText(s),Rd(a,e,t),s.style,this.parent.cellStyle):1);var l=s.value&&s.value.toString();if(l&&l.indexOf("\n")>-1){var d=void 0,h=l.split("\n"),p=0,c=h.length;for(d=0;d<c;d++){var u=Ed(h[d],Rd(a,e,t),s.style,this.parent.cellStyle);0===u&&(u=1),p+=u}o=Od(this.parent,e,t,a,s.style||this.parent.cellStyle,p)}var f=a&&a.standardHeight?a.standardHeight:20;if(o<f&&(o=f),kd(a,e,t,o),!i){var g=this.parent.getCell(e,t);g&&g.children[0]&&"e-cf-databar"===g.children[0].className&&(g.children[0].style.height="100%",g.children[0].firstElementChild.nextElementSibling.style.height="100%")}if(r){this.checkHeight=!1;var m=Ad(a,e),v=fl(a,e);(n?m!==v:m>v)&&xd(this.parent,a,m,e,null,null,!0,i)}}}},r.prototype.updateMergeBorder=function(e,t){var r=Ln(e.rowIdx,e.colIdx,t,null,!0),n={range:[e.rowIdx,e.colIdx,e.rowIdx,e.colIdx]};if(this.parent.notify(Et,n),r.rowSpan>1&&!e.style.borderBottom){var i=Ln(n.range[2],n.range[1],t,null,!0);i.style&&i.style.borderBottom&&(e.style.borderBottom=i.style.borderBottom)}if(r.colSpan>1&&!e.style.borderRight){var a=Ln(n.range[0],n.range[3],t,null,!0);a.style&&a.style.borderRight&&(e.style.borderRight=a.style.borderRight)}},r.prototype.setLeftBorder=function(e,t,r,n,i,a,s,o){if(!s||!s.includes("Column")){var l=this.parent.enableRtl?this.parent.getCell(r,n+1,i):this.parent.getCell(r,n-1,i);if(l){var d=Ln(r,n-1,o,!1,!0);if(d.rowSpan&&1!==d.rowSpan||d.colSpan&&1!==d.colSpan){var h={range:[r,n-1,r,n-1]};if(this.parent.notify(Et,h),(d=Ln(h.range[0],h.range[1],o,!1,!0)).style&&d.style.borderRight&&"none"!==d.style.borderRight)return;if((d=Ln(h.range[0],h.range[3],o,null,!0)).style&&d.style.borderRight&&"none"!==d.style.borderRight)return;t.style.borderLeft=e}else a&&""!==e&&n===this.parent.viewport.leftIndex&&(this.parent.getMainContent().scrollLeft-=this.getBorderSize(e)),l.style.borderRight="none"===e?l.style.borderRight:e}else t.style.borderLeft=e}},r.prototype.setTopBorder=function(e,t,r,n,i,a,s,o,l,d,h){if(!o||!o.includes("Row")){var p=n,c=Ln(r,n,h,!1,!0);c.colSpan>1&&Il(h,n)&&(p=Dr(h,n,!0,"columns"))>n+c.colSpan-1&&(p=n);var u=this.parent.getCell(r-1,p,i);if(u)if((c=Ln(r-1,n,h,!1,!0)).rowSpan&&1!==c.rowSpan||c.colSpan&&1!==c.colSpan){var f={range:[r-1,n,r-1,n]};if(this.parent.notify(Et,f),(c=Ln(f.range[0],f.range[1],h,!1,!0)).style&&c.style.borderBottom&&"none"!==c.style.borderBottom)return;if((c=Ln(f.range[2],f.range[1],h,null,!0)).style&&c.style.borderBottom&&"none"!==c.style.borderBottom)return;t.style.borderTop=e}else{if(cl(h,r-1)){var g=[Number(u.parentElement.getAttribute("aria-rowindex"))-1,n];if(this.parent.getCellStyleValue(["bottomPriority"],g).bottomPriority)return}s&&""!==e&&h.topLeftCell.includes(""+(r+1))&&(this.parent.getMainContent().parentElement.scrollTop-=this.getBorderSize(e)),this.setThickBorderHeight(e,r-1,n,u,i,a,s,l,d),u.style.borderBottom="none"===e?u.style.borderBottom:e}else t.style.borderTop=e}},r.prototype.setThickBorderHeight=function(e,t,r,n,i,a,s,o,l){var d=e?this.getBorderSize(e):1,h=this.parent.getActiveSheet();if(d>2&&(!h.rows[t]||!h.rows[t].customHeight))if(l)this.checkHeight||(this.checkHeight=!0),this.updateRowHeight(t,r,o,s);else{var p=fl(h,t),c=Math.ceil(this.parent.calculateHeight(this.parent.getCellStyleValue(["fontFamily","fontSize"],[t,r]),1,3));c>p&&xd(this.parent,h,c,t,i,a)}!s||!o&&this.checkHeight||!(d<3)||h.rows[t]&&h.rows[t].customHeight||(this.checkHeight||(this.checkHeight=!0),this.updateRowHeight(t,r,o,s))},r.prototype.getBorderSize=function(e){var t=e.split(" ")[0];return"thin"===t?1:"medium"===t?2:"thick"===t?3:parseInt(t,10)||1},r.prototype.clearObj=function(r){var n,i,s,o=this,l=r.options,d=l.range?l.range.indexOf("!")>0?l.range.substring(l.range.lastIndexOf("!")+1):l.range:this.parent.getActiveSheet().selectedRange,h=l.range&&l.range.indexOf("!")>0?vn(this.parent,l.range.substring(0,l.range.lastIndexOf("!"))):this.parent.activeSheetIndex,p=c(t(d)),u=this.parent.sheets[h],f=p[0],g=p[2],m=this.parent.element.getElementsByClassName("e-ss-overlay-active"),v=m.length>0,y={range:d,type:l.type,requestType:"clear",sheetIndex:h},C=function(){r.isAction&&o.parent.notify(K,{action:"beforeClear",eventArgs:y})},b=function(){r.isAction&&(y={range:u.name+"!"+d,type:l.type,sheetIndex:h},s&&(y.cfClearActionArgs=s.cfClearActionArgs),o.parent.notify(ka,{eventArgs:y,action:"clear"}))},x="Clear All"===l.type;if(v)m[0].classList.contains("e-datavisualization-chart")?("Clear Contents"===l.type||x)&&(C(),this.parent.notify(Ss,{id:m[0].id,sheetIdx:this.parent.activeSheetIndex+1}),b()):x&&(C(),this.parent.notify(xs,{id:m[0].id,sheetIdx:this.parent.activeSheetIndex+1}),b());else{if(C(),"Clear Formats"===l.type||x)for(s={range:d,sheetIdx:h,isClear:!0},this.parent.notify(At,s),r.cfClearActionArgs=s.cfClearActionArgs,x&&(this.parent.notify(Qe,{range:d,isRemoveValidation:!0,viewport:this.parent.viewport}),0===f&&0===p[1]&&g>=u.usedRange.rowIndex&&p[3]>=u.usedRange.colIndex&&this.parent.setUsedRange(f,p[1],u,!1,!0));f<=g;f++)for(n=p[1],i=p[3];n<=i;n++){var S=Ln(f,n,u),w=this.parent.getCell(f,n);S&&(x&&S.formula&&this.parent.notify(Re,{cellRef:a([f,n,f,n])}),S.wrap&&this.parent.notify(Ge,{range:[f,n,f,n],wrap:!1,sheet:u}),S.hyperlink&&(w&&(0,e.removeClass)(w.querySelectorAll(".e-hyperlink"),"e-hyperlink-style"),x&&this.parent.removeHyperlink(u.name+"!"+a([f,n,f,n]))))}"Clear Hyperlinks"===l.type&&this.parent.removeHyperlink(u.name+"!"+d),this.parent.notify(Ft,{range:u.name+"!"+d,type:l.type}),this.parent.serviceLocator.getService("cell").refreshRange(c(t(d)),!1,!1,!1,!1,Yr(this.parent),!x),this.parent.notify(et,{range:d,isclearFormat:!0}),r.isFromUpdateAction||this.parent.notify(Ei,{address:d}),this.parent.notify(ve,null),b()}},r.prototype.addEventListener=function(){this.parent.on(le,this.applyCellFormat,this),this.parent.on(os,this.clearObj,this)},r.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(le,this.applyCellFormat),this.parent.off(os,this.clearObj))},r.prototype.destroy=function(){this.removeEventListener(),this.parent=null,this.checkHeight=null},r.prototype.getModuleName=function(){return"cellformat"},r}(),dh=u(197),hh=function(){function n(e){this.parent=e,this.addEventListener()}return n.prototype.addEventListener=function(){this.parent.on(Zn,this.wireEvents,this),this.parent.on(Qi,this.autoFit,this),this.parent.on(Ta,this.setAutoFitHandler,this),this.parent.on(so,this.propertyChange,this)},n.prototype.autoFit=function(e){for(var t=e.isRow?this.parent.getRowHeaderTable():this.parent.getColHeaderTable().rows[0],r=e.startIndex;r<=e.endIndex;r++)this.trgtEle=e.isRow?this.parent.getRow(r,t):this.parent.getCell(null,r,t),this.setAutofit(r,!e.isRow)},n.prototype.wireEvents=function(){var t=this.parent.getRowHeaderContent(),r=this.parent.element.getElementsByClassName("e-header-panel")[0];r&&(e.EventHandler.add(r,"dblclick",this.dblClickHandler,this),e.EventHandler.add(t,"dblclick",this.dblClickHandler,this),e.EventHandler.add(r,"mousedown",this.mouseDownHandler,this),e.EventHandler.add(t,"mousedown",this.mouseDownHandler,this),this.wireResizeCursorEvent(t,r))},n.prototype.wireResizeCursorEvent=function(t,r){e.EventHandler.add(t,"mousemove",this.setTarget,this),e.EventHandler.add(r,"mousemove",this.setTarget,this)},n.prototype.unWireResizeCursorEvent=function(){e.EventHandler.remove(this.parent.getRowHeaderContent(),"mousemove",this.setTarget);var t=this.parent.element.getElementsByClassName("e-header-panel")[0];t&&e.EventHandler.remove(t,"mousemove",this.setTarget)},n.prototype.unwireEvents=function(){var t=this.parent.getRowHeaderContent(),r=this.parent.element.getElementsByClassName("e-header-panel")[0];r&&(e.EventHandler.remove(r,"dblclick",this.dblClickHandler),e.EventHandler.remove(t,"dblclick",this.dblClickHandler),e.EventHandler.remove(r,"mousedown",this.mouseDownHandler),e.EventHandler.remove(t,"mousedown",this.mouseDownHandler),this.unWireResizeCursorEvent())},n.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(Zn,this.wireEvents),this.parent.off(Qi,this.autoFit),this.parent.off(Ta,this.setAutoFitHandler),this.parent.off(so,this.propertyChange))},n.prototype.mouseMoveHandler=function(e){var t=this.parent.element.getElementsByClassName("e-colresize-handler")[0],r=this.parent.element.getElementsByClassName("e-rowresize-handler")[0];if(this.resizeTooltip(null,!0,e),t||r){this.isMouseMoved=!0;var n=this.parent.enableRtl;t?(n?e.x<this.trgtEle.parentElement.firstChild.getBoundingClientRect().right:e.x>this.trgtEle.parentElement.firstChild.getBoundingClientRect().left)&&(t.style.left=e.clientX-document.getElementById(this.parent.element.id+"_sheet").getBoundingClientRect().left+"px"):r&&e.y>=this.trgtEle.parentElement.parentElement.firstChild.getBoundingClientRect().top&&(r.style.top=e.clientY-document.getElementById(this.parent.element.id+"_sheet").getBoundingClientRect().top+"px")}},n.prototype.mouseDownHandler=function(t){if((0,e.closest)(t.target,".e-header-cell")&&!t.target.className.includes("e-filter-icon")){if(this.event=t,this.trgtEle=t.target,this.trgtEle.parentElement.classList.contains("e-hide-end")||this.trgtEle.classList.contains("e-hide-end")){var r=this.trgtEle.offsetHeight,n=t.offsetY;(r>=10&&n<5||r-2<8&&n<Math.ceil((n-2)/2))&&this.trgtEle.classList.add("e-skip-resize")}this.updateTarget(t,this.trgtEle);var i=this.trgtEle,a=i.classList.contains("e-colresize")?"e-colresize-handler":i.classList.contains("e-rowresize")?"e-rowresize-handler":"";this.createResizeHandler(i,a),this.unWireResizeCursorEvent(),e.EventHandler.add(this.parent.element,"mousemove",this.mouseMoveHandler,this),e.EventHandler.add(document,"mouseup",this.mouseUpHandler,this)}},n.prototype.mouseUpHandler=function(t){var r=this.parent.element.getElementsByClassName("e-resize-handle")[0];this.resizeOn(t),this.isMouseMoved=null;var n=document.querySelector(".e-header-tooltip");r&&((0,e.detach)(r),this.updateCursor()),n&&n.remove(),e.EventHandler.remove(document,"mouseup",this.mouseUpHandler),e.EventHandler.remove(this.parent.element,"mousemove",this.mouseMoveHandler);var i=this.parent.element.getElementsByClassName("e-header-panel")[0];i&&this.wireResizeCursorEvent(this.parent.getRowHeaderContent(),i),this.parent.notify(Gs,null),this.parent.notify(Ys,null)},n.prototype.dblClickHandler=function(t){if((0,e.closest)(t.target,".e-header-cell")&&!t.target.className.includes("e-filter-icon")){if(this.trgtEle=t.target,this.updateTarget(t,this.trgtEle),this.trgtEle.classList.contains("e-colresize")){var r=parseInt(this.trgtEle.getAttribute("aria-colindex"),10)-1,n=Sl(this.parent.getActiveSheet(),r)+"px";this.trgtEle.classList.contains("e-unhide-column")?this.showHiddenColumns(r-1):this.setAutofit(r,!0,n,this.trgtEle)}else if(this.trgtEle.classList.contains("e-rowresize")){var i=parseInt(this.trgtEle.parentElement.getAttribute("aria-rowindex"),10)-1,a=fl(this.parent.getActiveSheet(),i)+"px";this.setAutofit(i,!1,a)}this.parent.notify(Gs,null)}},n.prototype.setTarget=function(t){if((0,e.closest)(t.target,".e-header-cell")&&!t.target.className.includes("e-filter-icon")){var r,n,i,a,s=t.target,o=this.parent.getActiveSheet();if(o.isProtected&&(!o.protectSettings.formatColumns||!o.protectSettings.formatRows)){if(!o.protectSettings.formatRows&&!o.protectSettings.formatColumns)return;if(o.protectSettings.formatRows&&(0,e.closest)(s,".e-colhdr-table"))return;if(o.protectSettings.formatColumns&&(0,e.closest)(s,".e-rowhdr-table"))return}if((0,e.closest)(s,".e-header-row"))n=s.offsetWidth,a="e-colresize",i=this.parent.enableRtl?n-t.offsetX:t.offsetX,(l=this.getColPrevSibling(s))&&!l.classList.contains("e-select-all-cell")?r=l:Number(s.getAttribute("aria-colindex"))>1&&(r=s);else if((0,e.closest)(s,".e-row")){var l;i=t.offsetY,n=s.offsetHeight,a="e-rowresize",(l=this.getRowPrevSibling(s))?r=l.firstElementChild:Number(s.parentElement.getAttribute("aria-rowindex"))>1&&(r=s)}if(n-2<8&&i!==Math.ceil((n-2)/2))i<Math.ceil((n-2)/2)?(s.classList.add(a),r&&r.classList.add(a)):i>Math.ceil((n-2)/2)&&s.classList.add(a);else if(n-5<i&&i<=n&&n>=10)s.classList.add(a);else if(i<5&&r&&n>=10)s.classList.add(a),r.classList.add(a);else for(var d=this.parent.element.getElementsByClassName(a),h=0;h<d.length;h++)d[h].classList.remove(a)}},n.prototype.getColPrevSibling=function(t){var r=this.parent.frozenColCount(this.parent.getActiveSheet());return t.previousElementSibling||(r&&(0,e.closest)(t,".e-column-header")?this.parent.getSelectAllContent().querySelector(".e-header-row").lastElementChild:null)},n.prototype.getRowPrevSibling=function(t){var r=this.parent.frozenRowCount(this.parent.getActiveSheet());return t.parentElement.previousElementSibling||(r&&(0,e.closest)(t,".e-row-header")?this.parent.getSelectAllContent().querySelector("tbody").lastElementChild:null)},n.prototype.updateTarget=function(r,n){if((0,e.closest)(n,".e-header-row")){var i=this.parent.enableRtl?n.offsetWidth-r.offsetX:r.offsetX;if(n.offsetWidth<10&&i<Math.ceil((n.offsetWidth-2)/2)||i<5&&n.offsetWidth>=10&&n.classList.contains("e-colresize")){var a=this.parent.getActiveSheet(),s=Number(this.trgtEle.getAttribute("aria-colindex"))-2;(o=this.getColPrevSibling(n))&&!Il(a,s)?this.trgtEle=o:s>-1&&this.trgtEle.classList.add("e-unhide-column")}}else if(n.offsetHeight<10&&r.offsetY<Math.ceil((n.offsetHeight-2)/2)||r.offsetY<5&&n.offsetHeight>=10&&n.classList.contains("e-rowresize")){var o;a=this.parent.getActiveSheet(),s=Number(n.parentElement.getAttribute("aria-rowindex"))-2;if((o=this.getRowPrevSibling(n))||cl(a,s))if("dblclick"===r.type&&cl(a,s)){var l=c(t(a.selectedRange)),d=void 0;d=s<=l[2]&&s>l[0]&&Ir(a,l)?{startIndex:l[0],endIndex:l[2],hide:!1,autoFit:!0}:{startIndex:s,endIndex:s,hide:!1,autoFit:!0},this.parent.notify(Rt,d)}else cl(a,s)||(this.trgtEle=o.getElementsByClassName("e-header-cell")[0])}},n.prototype.setAutoFitHandler=function(e){e.isCol&&Il(this.parent.getActiveSheet(),e.idx)?this.showHiddenColumns(e.idx):this.setAutofit(e.idx,e.isCol,null,null,e.sheetIdx)},n.prototype.getWrapText=function(e,t,r){var n,i=this,a=e.toString().split(" "),s=Id(" ",r,this.parent.cellStyle),o=0,l=0,d=e,h="",p=function(){var e=parseInt(l.toString(),10);(e>o||e===o&&Id(h.trim(),r,i.parent.cellStyle)>Id(d,r,i.parent.cellStyle))&&(d=h.trim(),o=e)};return a.forEach((function(e,o){n=Id(e,r,i.parent.cellStyle),(l+n)/t>1?(p(),h="",l=n):l+=n+=(l+n+s)/t>=1?0:s,h+=e+" ",o===a.length-1&&p()})),d},n.prototype.setAutofit=function(r,n,i,a,s){var o,l,d=this,h=(0,e.isNullOrUndefined)(s)?this.parent.getActiveSheet():In(this.parent,s),p=!!(0,e.isNullOrUndefined)(s)||s===this.parent.activeSheetIndex;if(a){var c={cancel:!1,index:r,isCol:n,sheetIndex:this.parent.activeSheetIndex};if(n?(c.oldWidth=i,c.autoFitWithHeader=!1):c.oldHeight=i,this.parent.notify(K,{eventArgs:c,action:"resizeToFit"}),c.cancel)return;o=c.autoFitWithHeader}var u,f,g,m={},v=this.parent.createElement("table",{className:this.parent.getContentTable().className+" e-resizetable",styles:"height: auto"}),y=this.parent.createElement("tbody"),C=this.parent.createElement("tr",{className:"e-row"}),b=this.parent.createElement("td",{className:"e-cell"}),x=0,S=0;if(n){var w;v.style.width="auto";var I=function(e){(u=b.cloneNode()).textContent=e,u.style.fontFamily=m.style&&m.style.fontFamily||d.parent.cellStyle.fontFamily,u.style.fontSize=m.style&&m.style.fontSize||d.parent.cellStyle.fontSize,u.style.fontWeight=m.style&&m.style.fontWeight||d.parent.cellStyle.fontWeight,(w=C.cloneNode()).appendChild(u),y.appendChild(w)};o&&I(a.textContent);for(var E=0,N=h.rows.length;E<N;E++)(m=Ln(E,r,h))&&m.value&&(m.wrap?(g=!0,I(this.getWrapText(this.parent.getDisplayText(m),Rd(h,r,r,m.colSpan>1?r+m.colSpan-1:r),m.style))):I(this.parent.getDisplayText(m)));l=Sl(h,r)}else{var R=h.rows[r]&&h.rows[r].cells?h.rows[r].cells.length:0;f=this.parent.createElement("colgroup");for(var O=0;O<R;O++)(m=Ln(r,O,h))&&(u=b.cloneNode(),m.wrap&&u.classList.add("e-wraptext"),u.textContent=this.parent.getDisplayText(m),u.style.fontFamily=m.style&&m.style.fontFamily||this.parent.cellStyle.fontFamily,u.style.fontSize=m.style&&m.style.fontSize||this.parent.cellStyle.fontSize,C.appendChild(u),x+=S=m.colSpan&&m.colSpan>=1?this.getMergedColumnsWidth(m.colSpan,O,h):m.colSpan&&m.colSpan<1?0:Sl(h,O,!1,!0),f.appendChild(this.parent.createElement("col",{styles:"width:"+S+"px"})));v.appendChild(f),y.appendChild(C),l=fl(h,r)}v.appendChild(y),x&&(v.style.width=x+"px");var k=this.parent.createElement("div",{className:this.parent.element.className,styles:"display: block"});k.appendChild(v),document.body.appendChild(k);var A=v.getBoundingClientRect();document.body.removeChild(k);var F,T=Math.ceil(n?A.width:A.height),D=(n?this.getFloatingElementWidth(T+(g?1:0),r):T)||l;if(n){F=D>0?-(l-D):-l;var L=this.parent.frozenColCount(h);L&&r>=t(h.topLeftCell)[1]&&r<L||r>=this.parent.viewport.leftIndex+L&&r<=this.parent.viewport.rightIndex?(bl(h,r).width=D>0?D:0,p&&(this.resizeStart(r,this.parent.getViewportIndex(r,!0),D+"px",n,!0,i),this.parent.notify(Gi,{threshold:F,colIdx:r}))):(p&&this.parent.notify(Gi,{threshold:F,colIdx:r}),bl(h,r).width=D>0?D:0)}else{var P=this.parent.frozenRowCount(h);F=-(l-(D=D>20?D:20)),P&&r>=t(h.topLeftCell)[0]&&r<P||r>=this.parent.viewport.topIndex+P&&r<=this.parent.viewport.bottomIndex?(gl(h,r,D),pl(h,r,{customHeight:!1}),p&&(this.resizeStart(r,this.parent.getViewportIndex(r),D+"px",n,!0,i),this.parent.notify(Wi,{threshold:F,rowIdx:r}))):(p&&this.parent.notify(Wi,{threshold:F,rowIdx:r}),gl(h,r,D))}p&&this.parent.selectRange(h.selectedRange)},n.prototype.getMergedColumnsWidth=function(e,t,r){for(var n=0,i=0;i<e;i++)n+=Sl(r,t,!1,!0),t++;return n},n.prototype.createResizeHandler=function(e,t){var r=this.parent.createElement("div",{className:t});r.classList.add("e-resize-handle");var n=document.getElementById(this.parent.element.id+"_sheet");e.classList.contains("e-colresize")?(r.style.height=this.parent.getMainContent().parentElement.clientHeight+this.parent.getColumnHeaderContent().offsetHeight+"px",r.style.left=this.event.clientX-n.getBoundingClientRect().left+"px",r.style.top="0px"):e.classList.contains("e-rowresize")&&(r.style.width=this.parent.getMainContent().parentElement.clientWidth+"px",r.style.left="0px",r.style.top=this.event.clientY-n.getBoundingClientRect().top+"px"),n.appendChild(r),this.resizeTooltip(e,!1),this.updateCursor()},n.prototype.resizeTooltip=function(t,r,n){if(r){var i=this.parent.enableRtl,a=document.querySelector(".e-header-tooltip"),s=this.parent.element.getElementsByClassName("e-colresize-handler")[0],o=this.parent.element.getElementsByClassName("e-rowresize-handler")[0];if(s){var l=i?Math.round(this.trgtEle.getBoundingClientRect().right)-n.clientX:n.clientX-Math.round(this.trgtEle.getBoundingClientRect().left);a&&(a.firstChild.textContent=l>0?"Width:("+l.toString()+" pixels)":"Width: 0.00")}else if(o){var d=n.clientY-Math.round(this.trgtEle.getBoundingClientRect().top);a&&(a.firstChild.textContent=d>0?"Height:("+d.toString()+" pixels)":"Height: 0.00")}}else{var h=t.classList.contains("e-colresize"),p=t.classList.contains("e-rowresize");if(h||p){var c=h?"e-colresize-handler":"e-rowresize-handler",u=new dh.Tooltip({cssClass:"e-header-tooltip",showTipPointer:!1});h?u.content=(0,e.initializeCSPTemplate)((function(){return"Width:("+Math.round(t.getBoundingClientRect().width).toString()+" pixels)"})):p&&(u.content=(0,e.initializeCSPTemplate)((function(){return"Height:("+Math.round(t.getBoundingClientRect().height).toString()+" pixels)"})),u.offsetX=-(this.parent.getMainContent().parentElement.clientWidth/2-Math.round(t.getBoundingClientRect().width))),u.appendTo("."+c),u.open(),u.refresh()}}},n.prototype.setColWidth=function(e,t,r,n){var i=this.parent.getActiveSheet(),a=pd(r)-n;if(a<0&&n<-a&&(a=-n),r>0){if(this.isMouseMoved&&this.trgtEle.classList.contains("e-unhide-column"))return this.showHiddenColumns(e,r),void this.parent.notify(ka,{eventArgs:{index:e,width:"0px",isCol:!0,sheetIndex:this.parent.activeSheetIndex,oldWidth:n+"px",hide:!1},action:"resize"});this.resizeStart(e,t,r+"px",!0,!1,n+"px"),xl(i,e,{width:r,customWidth:!0}),this.parent.notify(Gi,{threshold:a,colIdx:e,checkWrapCell:!0})}else this.isMouseMoved&&(this.parent.hideColumn(e),this.showHideCopyIndicator(),this.parent.notify(ka,{eventArgs:{index:e,width:"0px",isCol:!0,sheetIndex:this.parent.activeSheetIndex,oldWidth:n+"px",hide:!0},action:"resize"}))},n.prototype.showHideCopyIndicator=function(){var t=this.parent.element.getElementsByClassName("e-copy-indicator")[0],r=!1;t&&((0,e.detach)(t),this.parent.notify(Zs,null),r=!0),r&&this.parent.notify(Zn,{})},n.prototype.showHiddenColumns=function(e,n){var i,a,s,o=this,l=this.parent.getActiveSheet(),d=t(l.selectedRange);if(e>=d[1]&&e<=d[3]&&d[2]===l.rowCount-1&&r(l.activeCell)[0]===r(l.topLeftCell)[0]?(i=d[1],a=d[3],s=this.parent.getMainContent().querySelector("colgroup")):i=a=e,void 0!==n)for(var h=i;h<=a;h++)xl(l,h,{width:n,customWidth:!0}),h>=this.parent.viewport.leftIndex&&h<=this.parent.viewport.rightIndex&&!Il(l,h)&&(s.children[this.parent.getViewportIndex(h,!0)].style.width=n+"px");this.trgtEle&&this.trgtEle.classList.remove("e-unhide-column");var p={startIndex:i,endIndex:a,hide:!1,isCol:!0,autoFit:!0};if(this.parent.notify(Rt,p),this.showHideCopyIndicator(),void 0===n)if(p.autoFit)this.autoFit({isRow:!1,startIndex:i,endIndex:a});else{var c=function(){o.parent.off(Zn,c),o.autoFit({isRow:!1,startIndex:i,endIndex:a})};this.parent.on(Zn,c,this)}},n.prototype.setRowHeight=function(e,t,r,n){var i=this.parent.getActiveSheet(),a=this.parent.frozenColCount(i),s=parseInt(this.parent.getRow(e,null,a).style.height,10),o=r,l=pd(parseInt(o,10))-s;l<0&&s<-l&&(l=-s),this.resizeStart(e,t,o,!1,!1,n),pl(i,e,{height:parseInt(o,10)>0?parseInt(o,10):0,customHeight:!0}),this.parent.notify(Wi,{threshold:l,rowIdx:e,isCustomHgt:!0})},n.prototype.resizeOn=function(e){var r,n,i=this,a=this.parent.getActiveSheet(),s=t(a.activeCell),o=Ln(s[0],s[1],a);if(this.trgtEle.classList.contains("e-rowresize")){var l=Number(this.trgtEle.parentElement.getAttribute("aria-rowindex"))-2;if(this.isMouseMoved&&cl(a,l)&&this.trgtEle.classList.contains("e-skip-resize")&&e.clientY>this.trgtEle.getBoundingClientRect().top){this.trgtEle.classList.remove("e-skip-resize");var d={startIndex:l,endIndex:l,hide:!1,skipAppend:!0};this.parent.notify(Rt,d);var h=this.parent.getRowHeaderTable().tBodies[0],p=this.parent.getContentTable().tBodies[0];d.hdrRow.style.display="none",d.row.style.display="none",h.insertBefore(d.hdrRow,h.children[d.insertIdx]),p.insertBefore(d.row,p.children[d.insertIdx]),this.trgtEle=d.hdrRow.firstElementChild,d.hdrRow.nextElementSibling.classList.remove("e-hide-end"),d.mergeCollection.forEach((function(e){i.parent.notify(St,e)}))}else if(this.trgtEle.classList.contains("e-skip-resize")){if(this.trgtEle.classList.remove("e-skip-resize"),!this.isMouseMoved&&cl(a,l)||!this.trgtEle.parentElement.previousElementSibling)return;this.trgtEle=this.trgtEle.parentElement.previousElementSibling.getElementsByClassName("e-header-cell")[0]}n=r=parseInt(this.trgtEle.parentElement.getAttribute("aria-rowindex"),10)-1,r=this.parent.getViewportIndex(n);var u=this.parent.frozenColCount(a),f=this.parent.getRow(n,null,u).style.height,g=e.clientY-this.event.clientY+parseInt(f,10);if(g<=0)return this.parent.hideRow(n),this.showHideCopyIndicator(),pl(a,n,{height:0,customHeight:!0}),void this.parent.notify(ka,{eventArgs:{index:n,height:"0px",isCol:!1,sheetIndex:this.parent.activeSheetIndex,oldHeight:f},action:"resize"});if(this.setRowHeight(n,r,g+"px",f),this.parent.notify(ea,{rowIndex:n}),"none"===this.trgtEle.parentElement.style.display){var m=this.parent.getActiveSheet(),v=c(t(m.selectedRange));if(n<=v[2]&&n>v[0]){g=fl(m,n);for(var y=void 0,C=v[0];C<=v[2];C++)C!==n&&(f=fl(m,C)+"px",pl(m,C,{customHeight:!0,height:g}),cl(m,C)?y||(y=C):(this.parent.getRow(C).style.height=g+"px",m.showHeaders&&(this.parent.getRow(C,this.parent.getRowHeaderTable()).style.height=g+"px")),this.parent.notify(ka,{eventArgs:{index:C,height:g+"px",isCol:!1,sheetIndex:this.parent.activeSheetIndex,oldHeight:f},action:"resize"}));this.parent.hideRow(v[0],n-1,!1),this.showHideCopyIndicator(),r+=Math.abs(n-y)}else 0===r||cl(m,n-1)?0!==r&&this.trgtEle.parentElement.classList.add("e-hide-end"):this.trgtEle.parentElement.previousElementSibling.classList.remove("e-hide-start"),this.parent.selectRange(m.selectedRange);this.trgtEle.parentElement.style.display="",this.parent.getContentTable().rows[r].style.display=""}}else if(this.trgtEle.classList.contains("e-colresize")){this.isMouseMoved&&this.trgtEle.classList.contains("e-unhide-column")&&e.clientX<this.trgtEle.getBoundingClientRect().left&&(this.trgtEle.classList.remove("e-unhide-column"),this.trgtEle.previousElementSibling&&(this.trgtEle=this.trgtEle.previousElementSibling)),r=parseInt(this.trgtEle.getAttribute("aria-colindex"),10)-1;var b=void 0;this.trgtEle.classList.contains("e-unhide-column")?(r-=1,b=0):b=Sl(this.parent.getActiveSheet(),r),this.setColWidth(r,this.parent.getViewportIndex(r,!0),(this.parent.enableRtl?this.event.clientX-e.clientX:e.clientX-this.event.clientX)+b,b)}o&&o.format&&o.format.includes("*")&&this.parent.notify(re,{value:o.value,format:o.format,cell:o,formattedText:o.value,rowIndex:s[0],colIndex:s[1]})},n.prototype.resizeStart=function(e,t,r,n,i,a){gd(e,t,r,n,this.parent);var s,o,l=i?"resizeToFit":"resize";n?(s={index:e,width:r,isCol:n,sheetIndex:this.parent.activeSheetIndex,oldWidth:a},o=a!==r):(s={index:e,height:r,isCol:n,sheetIndex:this.parent.activeSheetIndex,oldHeight:a},o=a!==r),o&&this.parent.notify(ka,{eventArgs:s,action:l})},n.prototype.updateCursor=function(){this.parent.element.getElementsByClassName("e-colresize-handler")[0]?this.parent.element.classList.add("e-col-resizing"):this.parent.element.classList.contains("e-col-resizing")&&this.parent.element.classList.remove("e-col-resizing"),this.parent.element.getElementsByClassName("e-rowresize-handler")[0]?this.parent.element.classList.add("e-row-resizing"):this.parent.element.classList.contains("e-row-resizing")&&this.parent.element.classList.remove("e-row-resizing")},n.prototype.getFloatingElementWidth=function(e,t){var r=e,n={filterRange:[],hasFilter:!1};return this.parent.notify(Fa,n),n.hasFilter&&n.filterRange&&n.filterRange[1]<=t&&n.filterRange[3]>=t&&(r=e+22),r},n.prototype.destroy=function(){this.unwireEvents(),this.removeEventListener(),this.trgtEle&&this.trgtEle.remove(),this.trgtEle=null,this.event=null,this.parent=null},n.prototype.getModuleName=function(){return"resize"},n.prototype.propertyChange=function(e){"allowResizing"===e.propertyName&&this.wireEvents()},n}(),ph=function(){function n(e){this.parent=e,this.addEventListener()}return n.prototype.hideShow=function(r){var n=this,i=(0,e.isUndefined)(r.sheetIndex)?this.parent.activeSheetIndex:r.sheetIndex,a=In(this.parent,i);if(zd(this.parent,t(this.parent.getActiveSheet().selectedRange)))this.parent.notify(Ka,null);else{if(r.startIndex>r.endIndex){var s=r.startIndex;r.startIndex=r.endIndex,r.endIndex=s}var o;if(r.actionUpdate){if(r.sheetIndex=i,o={eventArgs:r,action:"hideShow"},this.parent.notify(K,o),r.cancel)return;delete r.cancel}r.hide&&(r.hiddenIndexes=[]);var l=function(e){r.isCol?(n.hideCol(r),e&&n.parent.sheetModule.colWidthChanged({colIdx:r.startIndex,isHideShow:!0})):(n.hideRow(r),e&&n.parent.sheetModule.rowHeightChanged({rowIdx:r.startIndex,isHideShow:!0}))},d=r.isCol?this.parent.frozenColCount(a):this.parent.frozenRowCount(a);if(d&&r.startIndex<d){var h=void 0;if(r.freezePane=!0,r.endIndex>=d&&(h=r.endIndex,r.endIndex=d-1),l(!0),delete r.freezePane,void 0!==h){var p=r.startIndex;r.endIndex=h,r.startIndex=d,l(!this.parent.scrollSettings.enableVirtualization),r.startIndex=p}}else l(!this.parent.scrollSettings.enableVirtualization);r.actionUpdate&&(this.updateIndexOnlyForHiddenColumnsAndRows(r,a),this.parent.notify(ka,o),Fd(this.parent.element))}},n.prototype.updateIndexOnlyForHiddenColumnsAndRows=function(e,t){for(var r=e.startIndex,n=e.endIndex,i=e.startIndex;i<=n;i++)if(!1===(e.isCol?bl(t,i):hl(t,i)||{}).hidden){e.startIndex=i;break}for(var a=e.endIndex;a>=r;a--)if(!1===(e.isCol?bl(t,a):hl(t,a)||{}).hidden){e.endIndex=a;break}},n.prototype.hideRow=function(n){var a,s,o,l,d,h,p=this,c=(0,e.isUndefined)(n.sheetIndex)?this.parent.activeSheetIndex:n.sheetIndex,u=In(this.parent,c),f=0,g=Object.assign({},n),m=this.parent.scrollSettings.isFinite&&!g.freezePane;if(m){if(g.startIndex>=u.rowCount)return;g.endIndex>=u.rowCount&&(g.endIndex=u.rowCount-1),h=0}var v=this.parent.frozenRowCount(u);if(g.hide){for(var y,C=void 0,b=void 0,x=[],S=[],w=m&&g.endIndex===Dr(u,u.rowCount-1,!1),I=g.startIndex;I<=g.endIndex;I++)if(cl(u,I))g.isFiltering&&!ul(u,I)&&pl(u,I,{isFiltered:!0});else if(void 0===s&&(g.freezePane?(y=this.parent.sheetModule.getSelectAllTable(),C=this.parent.getColHeaderTable()):(y=this.parent.getRowHeaderTable(),C=this.parent.getContentTable()),s=this.parent.getViewportIndex(I),f=0),d={hidden:!0},g.isFiltering&&(d.isFiltered=!0),g.isFiltering||(x=Vd(this.parent)),pl(u,I,d),g.isFiltering||(S=Vd(this.parent)),c===this.parent.activeSheetIndex)if(m&&(h+=fl(u,I,!0,!0)),this.refreshChart(I,"rows"),g.isFiltering||this.refreshChartCellModel(x,S),b=C&&C.rows[s]){if(!l)for(var E=0;E<=u.usedRange.colIndex;E++)if(((a=Ln(I,E,u)||{}).colSpan||a.rowSpan)&&(g.startIndex>=this.parent.viewport.topIndex||this.parent.scrollSettings.enableVirtualization)){l=!0;break}if(l)continue;if(y.rows[s]&&(0,e.detach)(y.rows[s]),(0,e.detach)(b),f++,(b=C.rows[s])&&I===g.endIndex){var N=void 0,R=(o=Dr(u,I+1,!0))!==Dr(u,0,!0)&&o===(this.parent.viewport.topIndex>=g.startIndex?g.endIndex+1:this.parent.viewport.topIndex)?"Row":"";for(E=this.parent.viewport.leftIndex;E<=this.parent.viewport.rightIndex;E++){""!==(te=this.parent.getCellStyleValue(["borderTop"],[o,E]).borderTop)&&(N=b.cells[E],this.parent.notify(le,{onActionUpdate:!1,rowIdx:o,colIdx:E,style:{borderTop:te},row:b,pRow:b.previousElementSibling,first:R,td:N}))}}}else I<=this.parent.viewport.bottomIndex?f++:f--;if(g.refreshUI)return;if(l&&(g.startIndex>=this.parent.viewport.topIndex||!this.parent.scrollSettings.enableVirtualization))return void(g.isFiltering?n.refreshUI=!0:(this.parent.selectRange(u.selectedRange),u.frozenRows||u.frozenColumns?(this.parent.renderModule.refreshSheet(!1,!1,!0),n.refreshUI=!0):this.parent.renderModule.refreshUI({rowIndex:this.parent.viewport.topIndex,colIndex:this.parent.viewport.leftIndex,refresh:"Row"})));if(!f)return;this.parent.selectRange(u.selectedRange);var O=function(){if(u.showHeaders){var e=g.freezePane?1:0;s===e?y.rows[e]&&y.rows[e].classList.add("e-hide-end"):(y&&y.rows[s-1]&&y.rows[s-1].classList.add("e-hide-start"),y&&y.rows[s]&&y.rows[s].classList.add("e-hide-end"))}};if(!g.freezePane&&this.parent.scrollSettings.enableVirtualization){var k=g.startIndex,A=g.startIndex;if(g.startIndex<r(u.paneTopLeftCell)[0]||f>this.parent.viewport.rowCount){if(g.isFiltering)return void(n.refreshUI=!0);this.parent.updateTopLeftCell(Dr(u,g.startIndex-1<v?v:g.startIndex-1,!0)-v,null,"col"),this.parent.renderModule.refreshSheet(!1,!1,!0)}else{A=(k=this.parent.viewport.bottomIndex+1)+f-1;var F=this.parent.skipHidden(k,A,"rows",!1);if(k=F[0],A=F[1],m){if(k>=u.rowCount)return void(this.parent.viewport.topIndex+v===Dr(u,v,!0)?(O(),this.parent.notify(Qs,{isHide:!0,height:h}),w&&(this.parent.viewport.bottomIndex=Dr(u,u.rowCount-1,!1))):this.parent.renderModule.refreshSheet(!1,!1,!0));if(A>=u.rowCount)return void this.parent.renderModule.refreshSheet(!1,!1,!0);this.parent.notify(Qs,{isHide:!0,height:h})}this.parent.viewport.bottomIndex=A;var T=void 0,D=this.parent.frozenColCount(u),L=[];D?(L.push(v),L.push(this.parent.viewport.leftIndex+D),T=r(u.topLeftCell)[1]):T=this.parent.viewport.leftIndex,this.parent.renderModule.refreshUI({colIndex:T,rowIndex:k,direction:"",refresh:"RowPart",frozenIndexes:L},i(k,T)+":"+i(A,this.parent.viewport.rightIndex))}}O()}else{var P=void 0,M=void 0,B=void 0,H=(b=void 0,void 0),U=void 0,V=(C=void 0,void 0),z=void 0,_=g.startIndex-1,j=[],q=g.freezePane,W="lastElementChild",G=0,Y=this.parent.viewport.topIndex+v;if(m){var X=Dr(u,u.rowCount-1,!1);if(this.parent.viewport.bottomIndex===X)if(Y===Dr(u,v,!0))q=!0;else{var K=t(u.paneTopLeftCell)[0];u.rowCount-1-K+1-this.parent.hiddenCount(K,u.rowCount-1)<this.parent.viewport.rowCount+Math.round(this.parent.getThreshold("row")/2)&&(W="firstElementChild")}}x=Vd(this.parent),I=g.startIndex;for(var $=g.endIndex;I<=$;I++)if(cl(u,I))if(void 0===H){if(d={hidden:!1},g.isFiltering&&(d.isFiltered=!1),!q&&I>this.parent.viewport.bottomIndex){if(pl(u,I,d),void 0===z)return}else if(void 0===z&&(z=I),pl(u,I,d),c===this.parent.activeSheetIndex){m&&(h+=fl(u,I,!0,!0)),this.refreshChart(I,"rows"),void 0===s&&(P=document.createDocumentFragment(),M=document.createDocumentFragment(),U=this.parent.serviceLocator.getService("row"),g.freezePane?(V=this.parent.sheetModule.getSelectAllTable(),C=this.parent.getColHeaderTable()):(V=this.parent.getRowHeaderTable(),C=this.parent.getContentTable(),I<this.parent.viewport.topIndex+v&&(this.parent.viewport.topIndex=I-v)),s=this.parent.getViewportIndex(I)),_++,B=U.refresh(I,null,null,!0,!0),P.appendChild(B),V&&V.rows.length&&!q&&(0,e.detach)(V.tBodies[0][""+W]),b=M.appendChild(U.refresh(I,b,B)),C&&C.rows.length&&!q&&((0,e.detach)(C.tBodies[0][""+W]),"firstElementChild"===W&&(void 0!==s&&s-1>-1&&(s-=1),G+=fl(u,this.parent.viewport.topIndex,!0),this.parent.viewport.topIndex=Dr(u,this.parent.viewport.topIndex+1,!0)));for(E=this.parent.viewport.leftIndex;E<=this.parent.viewport.rightIndex;E++)if(void 0!==(a=Ln(I,E,u)||{}).rowSpan||void 0!==a.colSpan){var Z={range:[I,E,I,E],isAction:!1,merge:!0,type:"All",skipChecking:!0};this.parent.notify(Et,Z),j.length&&Z.range[1]===j[j.length-1].range[1]&&Z.range[0]===j[j.length-1].range[0]||j.push(Z)}}}else $=I;else{if(g.startIndex===g.endIndex)return;void 0===s?_++:H=I}S=Vd(this.parent);if(this.refreshChartCellModel(x,S),void 0===s)return;var J=void 0;if(!g.freezePane){if(g.isFiltering&&g.startIndex<r(u.paneTopLeftCell)[0]&&(n.refreshUI=!0,void 0===H||H===g.endIndex))return;var Q=this.parent.viewport.bottomIndex;this.parent.viewport.bottomIndex=this.parent.viewport.topIndex+v+this.parent.viewport.rowCount+2*this.parent.getThreshold("row");var ee=this.parent.hiddenCount(g.endIndex+1,this.parent.viewport.bottomIndex);f=this.parent.hiddenCount(this.parent.viewport.topIndex+v,g.startIndex)+ee,this.parent.viewport.bottomIndex+=f,m&&this.parent.viewport.bottomIndex>=u.rowCount&&(this.parent.viewport.bottomIndex=Dr(u,u.rowCount-1,!1)),!g.isFiltering&&z>=Y&&z<=Q&&z>this.parent.viewport.bottomIndex-ee-Math.abs(_-z)&&(J=!0)}if(g.insertIdx=n.insertIdx=s,g.row=n.row=M.querySelector(".e-row"),g.mergeCollection=n.mergeCollection=j,u.showHeaders&&(n.hdrRow=g.hdrRow=P.querySelector(".e-row"),0!==s&&!cl(u,_-1)&&V.rows[s-1]&&V.rows[s-1].classList.remove("e-hide-start"),0!==g.startIndex&&cl(u,g.startIndex-1)&&g.hdrRow.classList.add("e-hide-end"),cl(u,_+1)?P.lastElementChild.classList.add("e-hide-start"):V.rows[s]&&V.rows[s].classList.remove("e-hide-end")),b&&C&&C.rows[s]){o=Dr(u,_+1,!0);for(I=this.parent.viewport.leftIndex;I<=this.parent.viewport.rightIndex;I++){var te;if(""!==(te=this.parent.getCellStyleValue(["borderTop"],[o,I]).borderTop)){this.parent.notify(le,{onActionUpdate:!1,rowIdx:o,colIdx:I,style:{borderTop:te},pRow:b,td:C.rows[s].cells[I],first:""});var re=Dr(u,z-1,!1);re>-1?!C.rows[s-1]||this.parent.getCellStyleValue(["borderBottom"],[re,I]).borderBottom||this.parent.getCellStyleValue(["borderTop"],[z,I]).borderTop||(C.rows[s-1].cells[I].style.borderBottom=""):C.rows[s].cells[I].style.borderTop=""}}}if(g.skipAppend)return;m&&this.parent.notify(Qs,{height:h,size:G}),J||Math.abs(_-z)>this.parent.viewport.rowCount+2*this.parent.getThreshold("row")?this.parent.renderModule.refreshSheet(!1,!1,!0):(V&&(V.tBodies[0].rows.length?V.tBodies[0].insertBefore(P,V.rows[s]):V.tBodies[0].appendChild(P)),C&&C.tBodies[0]&&(C.tBodies[0].rows.length?C.tBodies[0].insertBefore(M,C.rows[s]):C.tBodies[0].appendChild(M)),this.parent.selectRange(u.selectedRange),g.autoFit&&u.showHeaders&&this.parent.notify(Qi,{startIndex:g.startIndex,endIndex:g.endIndex,isRow:!0}),j.forEach((function(e){p.parent.notify(St,e)})),void 0!==H&&H!==g.endIndex&&(g.startIndex=H,this.hideRow(g)))}},n.prototype.hideCol=function(t){for(var n,i=this,s=(0,e.isUndefined)(t.sheetIndex)?this.parent.activeSheetIndex:t.sheetIndex,o=In(this.parent,s),l=[],d=[],h=r(o.paneTopLeftCell),p=this.parent.frozenColCount(o),c=this.parent.frozenRowCount(o),u=this.parent.viewport.leftIndex+p,f=Dr(o,o.colCount-1,!1,"columns"),g=t.startIndex;g<=t.endIndex;g++){if(t.hide){if(Il(o,g))continue}else if(!Il(o,g)||t.hiddenIndexes&&-1===t.hiddenIndexes.indexOf(g))continue;var m=Vd(this.parent);xl(o,g,{hidden:t.hide});var v=Vd(this.parent);this.refreshChart(g,"columns"),this.refreshChartCellModel(m,v),this.parent.scrollSettings.enableVirtualization&&!t.freezePane&&(g<u||g>this.parent.viewport.rightIndex&&(!this.parent.scrollSettings.isFinite||!(f===this.parent.viewport.rightIndex&&g>=f&&g<o.colCount)))?g<u&&d.push(g):(l.push(g),t.hide&&(t.hiddenIndexes.push(g),g<=h[1]&&(n=!0)))}if((d.length||l.length)&&s===this.parent.activeSheetIndex){var y,C,b=r(o.topLeftCell),x=function(){var e;return e=i.parent.scrollSettings.enableVirtualization?[c?b[0]:i.parent.viewport.topIndex,i.parent.viewport.bottomIndex]:[0,o.rowCount-1],t.freezePane?(y=i.parent.getRowHeaderTable(),C=i.parent.sheetModule.getSelectAllTable()):(y=i.parent.getContentTable(),C=i.parent.getColHeaderTable()),e};if(t.hide){if(!l.length)return;if((l.length<=this.parent.getThreshold("col")||!this.parent.scrollSettings.enableVirtualization||t.freezePane)&&this.removeCell(o,l,x(),y,C),!t.freezePane&&this.parent.scrollSettings.enableVirtualization){if(n)return this.parent.updateTopLeftCell(null,Dr(o,l[0]-1<p?p:l[0]-1,!0,"columns")-p,"row"),void this.parent.renderModule.refreshSheet(!1,!1,!0);var S=[],w=this.parent.viewport.topIndex,I=c?b[0]:w;if(c&&(S=[c+w,p]),this.parent.scrollSettings.isFinite){var E=Dr(o,o.colCount-1,!1,"columns"),N=this.parent.viewport.leftIndex+p,R=this.parent.viewport.rightIndex;if(R+l.length>=E){var O=Dr(o,N-(R+l.length-E),!1,"columns");return O>=p&&(this.parent.viewport.leftIndex=O,this.parent.viewport.leftIndex-=this.parent.hiddenCount(R,E)),this.parent.viewport.rightIndex=E,N!==this.parent.viewport.leftIndex+p||R!==this.parent.viewport.rightIndex?(this.parent.renderModule.refreshUI({colIndex:this.parent.viewport.leftIndex,refresh:"Column",frozenIndexes:S,rowIndex:I,skipUpdateOnFirst:this.parent.viewport.leftIndex+p===Dr(o,p,!0,"columns")}),c&&(this.parent.viewport.topIndex=w)):this.parent.notify(Ns,{refresh:"Column",isUpdate:!0}),void this.parent.selectRange(o.selectedRange)}}if(l.length<=this.parent.getThreshold("col")){var k=this.parent.skipHidden(this.parent.viewport.rightIndex+1,this.parent.viewport.rightIndex+l.length,"columns");this.parent.viewport.rightIndex=k[1],this.parent.renderModule.refreshUI({rowIndex:I,colIndex:k[0],direction:"",refresh:"ColumnPart",frozenIndexes:S},""+a([I,k[0],this.parent.viewport.bottomIndex,k[1]]))}else this.parent.renderModule.refreshUI({skipUpdateOnFirst:this.parent.viewport.leftIndex+p===Dr(o,p,!0,"columns"),rowIndex:I,colIndex:this.parent.viewport.leftIndex,refresh:"Column",frozenIndexes:S}),c&&(this.parent.viewport.topIndex=w)}this.parent.selectRange(o.selectedRange)}else{if(d.length&&this.parent.scrollSettings.enableVirtualization){d.sort((function(e,t){return e-t}));var A=d[0]-1<p?p:d[0]-1;return this.parent.updateTopLeftCell(null,Dr(o,A,!0,"columns")-p,"row"),this.parent.renderModule.refreshSheet(!1,!1,!0),void(t.autoFit&&(t.autoFit=!1))}(!this.parent.scrollSettings.isFinite||this.parent.viewport.rightIndex<f)&&(l.length<=this.parent.getThreshold("col")||!this.parent.scrollSettings.enableVirtualization||t.freezePane)?(this.appendCell(o,l,x(),y,C,t.freezePane),this.parent.scrollSettings.enableVirtualization&&!t.freezePane&&this.parent.notify(ui,{refresh:"Column",prevRowColCnt:{rowCount:o.rowCount,colCount:o.colCount}}),this.parent.selectRange(o.selectedRange)):this.parent.renderModule.refreshSheet(!1,!1,!0)}}},n.prototype.removeCell=function(t,r,n,i,a){var s,o,l,d,h,p=this,c=n[0],u=n[1],f=0,g=r.length-1,m=this.parent.frozenRowCount(t),v=i.getElementsByTagName("colgroup")[0],y=this.parent.getViewportIndex(r[0],!0)+1,C=Dr(t,m-1,!1);for(t.showHeaders&&(l=a.getElementsByTagName("colgroup")[0],s=a.rows[0]);c<=u;)cl(t,c)?c++:(o=m&&c<m?a.rows[f+1]:i.rows[f],r.forEach((function(n,i){if(0===f&&c>=m&&(t.showHeaders&&((0,e.detach)(l.children[y]),(0,e.detach)(s.cells[y])),(0,e.detach)(v.children[y])),(0,e.detach)(o.cells[y]),0===i&&(void 0!==(d=Ln(c,n,t,!1,!0)).colSpan&&(void 0===d.rowSpan||d.colSpan>1)||d.rowSpan<0&&c-1>-1&&cl(t,c-1)&&Math.abs(d.rowSpan)===p.parent.hiddenCount(c+d.rowSpan,c,"rows",t))&&p.parent.notify(Qa,{rowIdx:c,colIdx:n,model:"col",start:r[0],end:r[g]}),i===g){h=Dr(t,n+1,!0,"columns");var a=p.parent.getCellStyleValue(["borderLeft"],[f,h]).borderLeft;""!==a&&p.parent.notify(le,{onActionUpdate:!1,rowIdx:f,colIdx:h,style:{borderLeft:a},row:o,first:""}),(void 0!==(d=Ln(c,n,t)||{}).colSpan&&(void 0===d.rowSpan||d.colSpan>1)||d.rowSpan<0&&c-1>-1&&cl(t,c-1)&&Math.abs(d.rowSpan)===p.parent.hiddenCount(c+d.rowSpan,c,"rows",t))&&p.parent.notify(Qa,{rowIdx:c,colIdx:n,model:"col",start:r[0],end:r[g],isEnd:!0})}})),m&&c===C?(f=0,c=this.parent.viewport.topIndex+m):(f++,c++));y-1>-1&&t.showHeaders&&s.cells[y-1]&&s.cells[y-1].classList.add("e-hide-start"),t.showHeaders&&s.cells[y]&&s.cells[y].classList.add("e-hide-end")},n.prototype.appendCell=function(t,r,n,a,s,o){var l,d,h,p,c=this,u=n[0],f=n[1],g=0,m=r.length-1,v=this.parent.frozenRowCount(t),y=a.getElementsByTagName("colgroup")[0];t.showHeaders&&(h=s.getElementsByTagName("colgroup")[0],l=s.rows[0]);var C=this.parent.serviceLocator.getService("cell");r.sort((function(e,t){return e-t}));for(var b,x,S,w,I=[],E=[],N=Dr(t,v-1,!1);u<=f;)cl(t,u)?u++:(d=v&&u<v?s.rows[g+1]:a.rows[g],r.forEach((function(n,a){(0===g&&(E[a]=c.parent.getViewportIndex(n,!0),t.showHeaders&&(x=l.cells[E[a]])&&(0===a&&r[a]&&!Il(t,r[a]-1)&&x.previousSibling&&x.previousElementSibling.classList.remove("e-hide-start"),a===m&&x.classList.remove("e-hide-end")),u>=v&&(y.children[E[a]]?(y.insertBefore(c.parent.sheetModule.updateCol(t,n),y.children[E[a]]),t.showHeaders&&C.renderColHeader(n,l,x)):(y.appendChild(c.parent.sheetModule.updateCol(t,n)),t.showHeaders&&C.renderColHeader(n,l)),o||((0,e.detach)(y.lastChild),t.showHeaders&&(0,e.detach)(l.lastChild)),t.showHeaders&&a===m&&((0,e.detach)(h),s.insertBefore(y.cloneNode(!0),s.tHead)))),o||(0,e.detach)(d.lastChild),x=d.cells[E[a]],w={rowIdx:u,colIdx:n,cell:Ln(u,n,t),row:d,address:i(u,n),lastCell:n===m,isHeightCheckNeeded:!0,first:n!==Dr(t,0,!0,"columns")&&n===c.parent.viewport.leftIndex?"Column":"",checkNextBorder:a===m?"Column":"",checkCF:!0},x&&(w.refChild=x),b=C.render(w),0===a&&b.previousSibling)&&(""!==c.parent.getCellStyleValue(["borderLeft"],[g,Dr(t,r[r.length-1]+1,!0,"columns")]).borderLeft&&(p=Dr(t,r[0]-1,!1,"columns"))>-1&&!c.parent.getCellStyleValue(["borderRight"],[g,p]).borderRight&&!c.parent.getCellStyleValue(["borderLeft"],[g,r[0]]).borderLeft&&(b.previousSibling.style.borderRight=""));if(void 0!==(S=Ln(u,n,t)||{}).colSpan&&(void 0===S.rowSpan||S.colSpan>1)||S.rowSpan<0&&u-1>-1&&cl(t,u-1)&&Math.abs(S.rowSpan)===c.parent.hiddenCount(u+S.rowSpan,u,"rows",t)){var f={range:[u,n,u,n],isAction:!1,merge:!0,type:"All",skipChecking:!0};c.parent.notify(Et,f),I.length&&f.range[1]===I[I.length-1].range[1]&&f.range[0]===I[I.length-1].range[0]||I.push(f)}})),v&&u===N?(u=this.parent.viewport.topIndex+v,g=0):(u++,g++));I.forEach((function(e){c.parent.notify(St,e)})),this.parent.viewport.rightIndex=Dr(t,this.parent.viewport.rightIndex-r.length,!1,"columns")},n.prototype.refreshChart=function(e,t){this.parent.notify(Bt,{rIdx:e,showHide:t})},n.prototype.refreshChartCellModel=function(e,t){this.parent.notify(Is,{prevChartIndexes:e,currentChartIndexes:t})},n.prototype.addEventListener=function(){this.parent.on(Rt,this.hideShow,this),this.parent.on(Qn,this.destroy,this)},n.prototype.destroy=function(){this.removeEventListener(),this.parent=null},n.prototype.removeEventListener=function(){this.parent.off(Rt,this.hideShow),this.parent.off(Qn,this.destroy)},n}(),ch=u(215),uh=function(){function n(e){this.divElements=[],this.inputElements=[],this.parent=e,this.addEventListener()}return n.prototype.destroy=function(){this.removeEventListener(),this.parent=null},n.prototype.addEventListener=function(){this.parent.on(ra,this.initiateHyperlinkHandler,this),this.parent.on(na,this.editHyperlinkHandler,this),this.parent.on(ia,this.openHyperlinkHandler,this),this.parent.on(ni,this.hyperlinkClickHandler,this),this.parent.on(ua,this.createHyperlinkEle,this),this.parent.on(ii,this.keyUpHandler,this),this.parent.on(Gt,this.removeHyperlink,this),this.parent.on(ca,this.removeHyperlinkHandler,this)},n.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(ra,this.initiateHyperlinkHandler),this.parent.off(na,this.editHyperlinkHandler),this.parent.off(ia,this.openHyperlinkHandler),this.parent.off(ni,this.hyperlinkClickHandler),this.parent.off(ua,this.createHyperlinkEle),this.parent.off(ii,this.keyUpHandler),this.parent.off(Gt,this.removeHyperlink),this.parent.off(ca,this.removeHyperlinkHandler))},n.prototype.getModuleName=function(){return"spreadsheetHyperlink"},n.prototype.keyUpHandler=function(t){var r=t.target;if((0,e.closest)(r,".e-document")){var n=document.querySelector(".e-hyp-text"),i=this.parent.element.querySelector(".e-hyperlink-alert-span"),a=((0,e.closest)(r,".e-hyperlink-dlg")||(0,e.closest)(r,".e-edithyperlink-dlg")).getElementsByClassName("e-footer-content")[0].firstChild;n&&!(0,e.isNullOrUndefined)(n.value)&&(Sr(n.value.toUpperCase())?i&&(i.remove(),a.removeAttribute("disabled")):(this.showDialog(),a.setAttribute("disabled","true")))}if(r.classList.contains("e-text")&&(0,e.closest)(r,".e-cont")&&(0,e.closest)(r,".e-webpage")&&(0,e.closest)(r,".e-webpage").getElementsByClassName("e-cont")[1]===r.parentElement){a=((0,e.closest)(r,".e-hyperlink-dlg")||(0,e.closest)(r,".e-edithyperlink-dlg")).getElementsByClassName("e-footer-content")[0].firstChild;if(""!==r.value)a.removeAttribute("disabled");else!!(0,e.closest)(r,".e-link-dialog").querySelector(".e-webpage").querySelectorAll(".e-cont")[1].querySelector(".e-text").value||a.setAttribute("disabled","true")}},n.prototype.initiateHyperlinkHandler=function(){var e=this,t=this.parent.getActiveSheet();if(!t.isProtected||t.protectSettings.insertLink&&!Td(this.parent))if(zd(this.parent))this.parent.notify(Ka,null);else{var r=this.parent.serviceLocator.getService(kl);if(!this.parent.element.querySelector(".e-hyperlink-dlg")){var n,i=this.parent.serviceLocator.getService(Al);i.show({width:323,isModal:!0,showCloseIcon:!0,cssClass:"e-hyperlink-dlg",header:r.getConstant("InsertLink"),beforeOpen:function(t){var r={dialogName:"InsertLinkDialog",element:t.element,target:t.target,cancel:t.cancel};e.parent.trigger("dialogBeforeOpen",r),r.cancel?t.cancel=!0:(i.dialogInstance.content=e.hyperlinkContent(),n=i.dialogInstance.content.querySelector(".e-text").value,i.dialogInstance.dataBind(),Fd(e.parent.element))},open:function(){setTimeout((function(){Fd(i.dialogInstance.element.querySelectorAll(".e-webpage input")[1])}))},beforeClose:this.dialogBeforeClose.bind(this),buttons:[{buttonModel:{content:r.getConstant("Insert"),isPrimary:!0,disabled:!0},click:function(){e.dlgClickHandler(n),i.hide()}}]})}}else this.parent.notify(Xa,null)},n.prototype.dialogBeforeClose=function(){var e=this.headerTabs;e&&e.element&&(e.destroy(),e.element.remove()),this.headerTabs=null,qd(this.inputElements),this.inputElements=[],qd(this.divElements),this.divElements=[]},n.prototype.dlgClickHandler=function(e){var t,r,n=this.parent.getActiveSheet(),i=n.name+"!"+n.selectedRange,a=this.parent.element.querySelector(".e-link-dialog").getElementsByClassName("e-content")[0].querySelector(".e-item.e-active");if(a)if((t=a.getElementsByClassName("e-cont")[0].querySelector(".e-text").value)===e&&(t=null),a.querySelector(".e-webpage")){var s={address:r=a.getElementsByClassName("e-cont")[1].querySelector(".e-text").value};this.parent.insertHyperlink(s,i,t,!1)}else{r=a.getElementsByClassName("e-cont")[1].querySelector(".e-text").value;var o=a.getElementsByClassName("e-cont")[2];if(o.getElementsByClassName("e-list-item")[0].querySelector(".e-active")){s={address:r=a.getElementsByClassName("e-cont")[2].querySelector(".e-active").textContent+"!"+r.toUpperCase()};this.parent.insertHyperlink(s,i,t,!1)}else if(o.querySelector(".e-active"))for(var l=a.getElementsByClassName("e-cont")[2].querySelector(".e-active").textContent,d=0;d<this.parent.definedNames.length;d++)if(this.parent.definedNames[d].name===l){s={address:this.parent.definedNames[d].name};this.parent.insertHyperlink(s,i,t,!1)}}},n.prototype.showDialog=function(){this.parent.element.querySelector(".e-hyperlink-alert-span")&&this.parent.element.querySelector(".e-hyperlink-alert-span").remove();var e=this.parent.serviceLocator.getService(kl),t=this.parent.createElement("span",{className:"e-hyperlink-alert-span"});t.innerText=e.getConstant("HyperlinkAlert"),(this.parent.element.querySelector(".e-hyperlink-dlg")||this.parent.element.querySelector(".e-edithyperlink-dlg")).querySelector(".e-dlg-content").appendChild(t)},n.prototype.editHyperlinkHandler=function(){var e,t=this,r=this.parent.serviceLocator.getService(kl),n=this.parent.serviceLocator.getService(Al);n.show({width:323,isModal:!0,showCloseIcon:!0,cssClass:"e-edithyperlink-dlg",header:r.getConstant("EditLink"),beforeOpen:function(r){var i={dialogName:"EditLinkDialog",element:r.element,target:r.target,cancel:r.cancel};t.parent.trigger("dialogBeforeOpen",i),i.cancel&&(r.cancel=!0),n.dialogInstance.content=t.hyperEditContent(),e=n.dialogInstance.content.querySelector(".e-text").value,n.dialogInstance.dataBind(),Fd(t.parent.element)},open:function(){setTimeout((function(){n.dialogInstance.element.querySelector(".e-webpage")?Fd(n.dialogInstance.element.querySelectorAll(".e-webpage input")[1]):Fd(n.dialogInstance.element.querySelectorAll(".e-document input")[1])}))},buttons:[{buttonModel:{content:r.getConstant("Update"),isPrimary:!0},click:function(){t.dlgClickHandler(e),n.hide()}}]})},n.prototype.openHyperlinkHandler=function(){var e=r(this.parent.getActiveSheet().activeCell),t=this.parent.getCell(e[0],e[1]);t.getElementsByClassName("e-hyperlink")[0]&&(t=t.querySelector(".e-hyperlink")),this.hlOpenHandler(t)},n.prototype.hlOpenHandler=function(r,n,i){var s=this;if(r.classList.contains("e-hyperlink")){var o=(0,e.closest)(r,".e-cell");if(!o)return;var l=["",""],d=void 0,h=!0,p=this.parent.getActiveSheet(),c=parseInt(o.getAttribute("aria-colindex"),10)-1,u=parseInt(o.parentElement.getAttribute("aria-rowindex"),10)-1,f=Ln(u,c,p,!1,!0);f.style&&"#00e"===f.style.color&&(Hr(this.parent,p,{rowIdx:u,colIdx:c,preventEvt:!0,cell:{style:{color:"#551a8b"}}}),o.style.color="#551a8b");var g=f.hyperlink,m=void 0,v={hyperlink:g,address:p.activeCell,target:"_blank",cancel:!1};if(this.parent.trigger(Be,v),v.cancel)return void(i&&i.preventDefault());var y={hyperlink:g=v.hyperlink,address:p.activeCell};"string"==typeof g&&(m=g),"object"==typeof g&&(m=g.address);var C=m;if(-1===m.indexOf("http://")&&-1===m.indexOf("https://")&&-1===m.indexOf("ftp://")){if(!(0,e.isNullOrUndefined)(m)){if(this.parent.definedNames)for(var b=0;b<this.parent.definedNames.length;b++)if(this.parent.definedNames[b].name===m){m=(m=this.parent.definedNames[b].refersTo).slice(1);break}var x;-1!==m.lastIndexOf("!")?(l[0]=m.substring(0,m.lastIndexOf("!")),l[0].startsWith("'")&&l[0].endsWith("'")&&(l[0]=l[0].slice(1,l[0].length-1)),l[1]=m.substring(m.lastIndexOf("!")+1)):(l[0]=this.parent.getActiveSheet().name,l[1]=m);for(b=0;b<this.parent.sheets.length;b++)this.parent.sheets[b].name===l[0]&&(x=b);if(p=this.parent.sheets[x],-1!==l[1].indexOf(":")){var S=l[1].indexOf(":"),w=l[1].substr(0,S),I=l[1].substr(S+1,l[1].length);w=w.replace("$",""),(I=I.replace("$","")).match(/\D/g)&&!I.match(/[0-9]/g)&&w.match(/\D/g)&&!w.match(/[0-9]/g)?(w+="1",I+=p.rowCount,l[1]=w+":"+I):!I.match(/\D/g)&&I.match(/[0-9]/g)&&!w.match(/\D/g)&&w.match(/[0-9]/g)&&(d=[parseInt(w,10)-1,0,parseInt(I,10)-1,p.colCount-1],h=!1)}var E=void 0,N=this.parent.definedNames;if(!(0,e.isNullOrUndefined)(N))for(b=0;b<N.length;b++)if(N[b].name===C){E=!0;break}if(Sr(l[1])||E){if(d=h?t(l[1]):d,!(0,e.isNullOrUndefined)(p)){var R=a(d);if(p===this.parent.getActiveSheet())Bl((function(){s.parent.goTo(R)}));else{if(R.indexOf(":")>=0){var O=R.split(":");R=O[0]===O[1]?O[0]:R}Bl((function(){s.parent.goTo(s.parent.sheets[x].name+"!"+R)}))}}}else this.showInvalidHyperlinkDialog()}}else n||(this.isValidUrl(m)?window.open(m,v.target):this.showInvalidHyperlinkDialog());this.parent.trigger(He,y)}},n.prototype.isValidUrl=function(e){return/(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/.test(e)},n.prototype.showInvalidHyperlinkDialog=function(){var e=this.parent.serviceLocator.getService(Al),t=this.parent.serviceLocator.getService(kl);e.show({width:323,isModal:!0,showCloseIcon:!0,header:t.getConstant("Hyperlink"),content:t.getConstant("InvalidHyperlinkAlert"),buttons:[{buttonModel:{content:t.getConstant("Ok"),isPrimary:!0},click:function(){e.hide()}}]},!1)},n.prototype.hyperlinkClickHandler=function(t){var r=t.target;if((0,e.closest)(r,".e-link-dialog")&&(0,e.closest)(r,".e-toolbar-item")){var n=(p=(0,e.closest)(r,".e-hyperlink-dlg")||(0,e.closest)(r,".e-edithyperlink-dlg")).getElementsByClassName("e-footer-content")[0].firstChild,i=p.querySelector(".e-document"),a=p.querySelector(".e-webpage"),s=a?a.querySelectorAll(".e-cont")[0].querySelector(".e-text").value:i.querySelectorAll(".e-cont")[0].querySelector(".e-text").value,o=i?i.querySelectorAll(".e-cont")[0].querySelector(".e-text").value:s;if((0,e.closest)(r,".e-toolbar-items").getElementsByClassName("e-toolbar-item")[1].classList.contains("e-active")){var l=i.querySelectorAll(".e-cont")[2].querySelector(".e-active");i.querySelectorAll(".e-cont")[0].querySelector(".e-text").value=s,(0,e.closest)(l,".e-list-item").classList.contains("e-level-2")&&n.hasAttribute("disabled")?n.removeAttribute("disabled"):(0,e.closest)(l,".e-list-item").classList.contains("e-level-1")&&!n.hasAttribute("disabled")&&n.setAttribute("disabled","true")}else{var d=!a.querySelectorAll(".e-cont")[1].querySelector(".e-text").value;a.querySelectorAll(".e-cont")[0].querySelector(".e-text").value=o,d&&!n.hasAttribute("disabled")?n.setAttribute("disabled","true"):!d&&n.hasAttribute("disabled")&&n.removeAttribute("disabled")}}if((0,e.closest)(r,".e-list-item")&&r.classList.contains("e-fullrow")){var h=this.parent.element.getElementsByClassName("e-link-dialog")[0];if(!h)return;var p,c=(h=h.getElementsByClassName("e-content")[0].getElementsByClassName("e-active")[0]).getElementsByClassName("e-cont")[1].getElementsByClassName("e-text")[0];n=(p=(0,e.closest)(r,".e-hyperlink-dlg")||(0,e.closest)(r,".e-edithyperlink-dlg")).getElementsByClassName("e-footer-content")[0].firstChild;(0,e.closest)(r,".e-list-item").classList.contains("e-level-2")?"defName"===(0,e.closest)(r,".e-list-item").getAttribute("data-uid")?(c.classList.contains("e-disabled")||c.hasAttribute("readonly")||(c.setAttribute("readonly","true"),c.classList.add("e-disabled"),c.setAttribute("disabled","true")),n.hasAttribute("disabled")&&n.removeAttribute("disabled")):"sheet"===(0,e.closest)(r,".e-list-item").getAttribute("data-uid")&&(c.classList.contains("e-disabled")&&c.hasAttribute("readonly")&&(c.removeAttribute("readonly"),c.classList.remove("e-disabled"),c.removeAttribute("disabled")),Sr(c.value.toUpperCase())&&n.hasAttribute("disabled")&&n.removeAttribute("disabled")):(0,e.closest)(r,".e-list-item").classList.contains("e-level-1")&&n.setAttribute("disabled","true")}else this.hlOpenHandler(r,!0,t)},n.prototype.createHyperlinkEle=function(t){var r=t.cell;if(!(0,e.isNullOrUndefined)(r.hyperlink)){var n=t.td,i=this.parent.createElement("a",{className:"e-hyperlink e-hyperlink-style"}),a=void 0;if("string"==typeof r.hyperlink?(0===r.hyperlink.toLowerCase().indexOf("www.")&&(r.hyperlink="http://"+r.hyperlink),a=r.hyperlink):0===(a=r.hyperlink.address).toLowerCase().indexOf("www.")&&(r.hyperlink.address=a="http://"+a),0===a.indexOf("http://")||0===a.indexOf("https://")||0===a.indexOf("ftp://")?(i.setAttribute("href",a),i.setAttribute("target","_blank")):(a.includes("=")||a.includes("!"))&&i.setAttribute("ref",a),"Accounting"===Bo(r.format)?i.innerHTML=n.innerHTML:i.innerText=""!==n.innerText?n.innerText:a,n.textContent="",n.innerText="","FillWithoutFormatting"!==this.parent.autoFillSettings.fillType&&"FillWithoutFormatting"!==t.fillType||(i.style.textDecoration="none"),n.appendChild(i),!t.style.color||!t.style.textDecoration){var s={};t.style.color||(t.style.color=s.color="#00e"),t.style.textDecoration||(t.style.textDecoration=s.textDecoration="underline"),Hr(this.parent,this.parent.getActiveSheet(),{rowIdx:t.rowIdx,colIdx:t.colIdx,preventEvt:!0,cell:{style:s}})}}},n.prototype.hyperEditContent=function(){var e=!0,r=this.hyperlinkContent(),n=t(this.parent.getActiveSheet().activeCell),i=this.parent.sheets[this.parent.getActiveSheet().id-1].rows[n[0]].cells[n[1]];this.parent.scrollSettings.enableVirtualization&&(n[0]=n[0]-this.parent.viewport.topIndex,n[1]=n[1]-this.parent.viewport.leftIndex);var a,s=this.parent.getDisplayText(i),o=i.hyperlink;"string"==typeof o?(a=o,s=s||a,-1===a.indexOf("http://")&&-1===a.indexOf("https://")&&-1===a.indexOf("ftp://")&&(e=!1)):"object"==typeof o&&(a=o.address,s=s||a,-1===a.indexOf("http://")&&-1===a.indexOf("https://")&&-1===a.indexOf("ftp://")&&(e=!1));for(var l=0,d=0,h=this.parent.definedNames,p=this.parent.sheets,c=0,u=h.length;c<u;c++)h[c].name===a&&l++;for(c=0,u=p.length;c<u;c++)a.includes(p[c].name)&&d++;0===l&&0===d&&(e=!0);var f=r.querySelector(".e-content");if(e){var g=f.querySelector(".e-webpage");if(g.getElementsByClassName("e-cont")[0].getElementsByClassName("e-text")[0].setAttribute("value",s),"string"==typeof o)g.getElementsByClassName("e-cont")[1].querySelector(".e-text").setAttribute("value",o);else g.getElementsByClassName("e-cont")[1].querySelector(".e-text").setAttribute("value",o.address)}else{var m=void 0,v=f.querySelector(".e-document");v.getElementsByClassName("e-cont")[0].getElementsByClassName("e-text")[0].setAttribute("value",s);var y=void 0,C=void 0;if(this.parent.definedNames)for(c=0;c<this.parent.definedNames.length;c++)if(this.parent.definedNames[c].name===a){m=!0;break}if(m){var b=v.getElementsByClassName("e-cont")[1].getElementsByClassName("e-text")[0];b.setAttribute("readonly","true"),b.classList.add("e-disabled"),b.setAttribute("disabled","true");var x=v.getElementsByClassName("e-cont")[2].querySelectorAll(".e-list-item.e-level-1")[1];for(c=0;c<x.getElementsByTagName("li").length;c++)x.getElementsByTagName("li")[c].innerText===a&&x.getElementsByTagName("li")[c].classList.add("e-active")}else{if(a&&-1!==a.lastIndexOf("!")){var S=a.lastIndexOf("!");y=a.substring(0,S),C=a.substring(S+1)}v.getElementsByClassName("e-cont")[1].querySelector(".e-text").setAttribute("value",C);for(x=v.getElementsByClassName("e-cont")[2].querySelectorAll(".e-list-item.e-level-1")[0],c=0;c<x.getElementsByTagName("li").length;c++)if(x.getElementsByTagName("li")[c].innerText===y){if(x.getElementsByTagName("li")[c].classList.contains("e-active"))break;x.getElementsByTagName("li")[c].classList.add("e-active")}else x.getElementsByTagName("li")[c].classList.contains("e-active")&&x.getElementsByTagName("li")[c].classList.remove("e-active")}}return r},n.prototype.hyperlinkContent=function(){var r,n,i=this.parent.serviceLocator.getService(kl),a=0,s=0,o=!0,l=!0,d=t(this.parent.getActiveSheet().activeCell),h=this.parent.getActiveSheet(),p=Ln(d[0],d[1],h),c=!0;if(p){c=!!(p.value&&"string"==typeof p.value&&null!==p.value.match("[A-Za-z]+")||""===p.value||(0,e.isNullOrUndefined)(p.value));var u=p.hyperlink;if("string"==typeof u)-1===(f=u).indexOf("http://")&&-1===f.indexOf("https://")&&-1===f.indexOf("ftp://")&&(n=u,o=!1);else if("object"==typeof u){var f;-1===(f=u.address).indexOf("http://")&&-1===f.indexOf("https://")&&-1===f.indexOf("ftp://")&&(n=u.address,o=!1)}if(n){for(var g=0,m=0,v=this.parent.definedNames,y=this.parent.sheets,C=0,b=y.length;C<b;C++)n.includes(y[C].name)&&m++;var x=0;for(b=v.length;x<b;x++)v[x].name===n&&g++;0===g&&0===m&&(o=!0)}if(s=o?0:1,this.parent.definedNames)for(var S=0;S<this.parent.definedNames.length;S++)if(this.parent.definedNames[S].name===n){r=!0,l=!1;break}}var w=this.parent.createElement("div",{className:"e-link-dialog"}),I=this.parent.createElement("div",{className:"e-webpage"}),E=this.parent.createElement("div",{className:"e-document"});this.headerTabs=new ch.Tab({selectedItem:s,items:[{header:{text:i.getConstant("WebPage")},content:I},{header:{text:i.getConstant("ThisDocument")},content:E}]}),this.headerTabs.appendTo(w),o?w.querySelector(".e-toolbar-items").querySelector(".e-indicator").setAttribute("style","left: 0; right: 136px"):w.querySelector(".e-toolbar-items").querySelector(".e-indicator").setAttribute("style","left: 136px; right: 0");var N=this.parent.createElement("div",{className:"e-cont"}),R=this.parent.createElement("div",{className:"e-cont"}),O=this.parent.createElement("div",{className:"e-header"});O.innerText=i.getConstant("DisplayText");var k=this.parent.createElement("div",{className:"e-header"});k.innerText=i.getConstant("Url");var A=this.parent.createElement("input",{className:"e-input e-text",attrs:{type:"Text"}});this.inputElements.push(A),c||(A.classList.add("e-disabled"),A.setAttribute("readonly","true"),A.setAttribute("disabled","true")),p&&(0,e.isNullOrUndefined)(p.hyperlink)&&A.setAttribute("value",this.parent.getDisplayText(p));var F=this.parent.createElement("input",{className:"e-input e-text",attrs:{type:"Text"}});this.inputElements.push(F),A.setAttribute("placeholder",i.getConstant("EnterTheTextToDisplay")),F.setAttribute("placeholder",i.getConstant("EnterTheUrl")),N.appendChild(A),N.insertBefore(O,A),R.appendChild(F),R.insertBefore(k,F),I.appendChild(R),I.insertBefore(N,R);for(var T=[],D=[],L=this.parent.sheets;a<this.parent.sheets.length;a++){var P=this.parent.sheets[a].name;"Visible"===this.parent.sheets[a].state&&(L[a]===this.parent.getActiveSheet()?T.push({nodeId:"sheet",nodeText:-1!==P.indexOf(" ")?"'"+P+"'":P,selected:!0}):T.push({nodeId:"sheet",nodeText:-1!==P.indexOf(" ")?"'"+P+"'":P}))}for(a=0;a<this.parent.definedNames.length;a++)D.push({nodeId:"defName",nodeText:this.parent.definedNames[a].name});var M=[{nodeId:"01",nodeText:i.getConstant("CellReference"),expanded:l,nodeChild:T},{nodeId:"02",nodeText:i.getConstant("DefinedNames"),expanded:r,nodeChild:D}],B=new ch.TreeView({fields:{dataSource:M,id:"nodeId",text:"nodeText",child:"nodeChild"}}),H=this.parent.createElement("div",{className:"e-cont"}),U=this.parent.createElement("div",{className:"e-header"});U.innerText=i.getConstant("CellReference");var V=this.parent.createElement("input",{className:"e-input e-text e-hyp-text",attrs:{type:"Text"}});V.setAttribute("value","A1"),this.inputElements.push(V),H.appendChild(V),H.insertBefore(U,V);var z=this.parent.createElement("div",{className:"e-cont"}),_=this.parent.createElement("div",{className:"e-header"});_.innerText=i.getConstant("DisplayText");var j=this.parent.createElement("input",{className:"e-input e-text",attrs:{type:"Text"}});this.inputElements.push(j),c||(j.classList.add("e-disabled"),j.setAttribute("readonly","true"),j.setAttribute("disabled","true")),p&&(0,e.isNullOrUndefined)(p.hyperlink)&&j.setAttribute("value",this.parent.getDisplayText(p)),j.setAttribute("placeholder",i.getConstant("EnterTheTextToDisplay")),z.appendChild(j),z.insertBefore(_,j);var q=this.parent.createElement("div",{className:"e-cont"}),W=this.parent.createElement("div",{className:"e-header"});W.innerText=i.getConstant("Sheet");var G=this.parent.createElement("div",{className:"e-refcont"});return this.divElements.push(N),this.divElements.push(R),this.divElements.push(O),this.divElements.push(k),this.divElements.push(H),this.divElements.push(U),this.divElements.push(z),this.divElements.push(_),this.divElements.push(q),this.divElements.push(W),this.divElements.push(G),this.divElements.push(E),this.divElements.push(I),this.divElements.push(w),q.appendChild(G),q.insertBefore(W,G),E.appendChild(H),E.insertBefore(z,H),B.appendTo(G),E.appendChild(q),w},n.prototype.removeHyperlink=function(e){var t=Ln(e.rowIdx,e.colIdx,e.sheet);t&&t.hyperlink&&("string"==typeof t.hyperlink?t.value=t.value||0===t.value?t.value:t.hyperlink:t.value=t.value||0===t.value?t.value:t.hyperlink.address,delete t.hyperlink,t.style&&(delete t.style.textDecoration,delete t.style.color),t.validation&&t.validation.isHighlighted&&t.style.backgroundColor&&(t.style.color="#ff0000"),e.sheet===this.parent.getActiveSheet()&&(t.style&&this.parent.notify(Mt,null),e.preventRefresh||this.parent.serviceLocator.getService("cell").refresh(e.rowIdx,e.colIdx,!1,null,!0,!1,Yr(this.parent))))},n.prototype.removeHyperlinkHandler=function(e){var r,n,i=e.range,a=this.parent.getActiveSheet();if(!e.preventEventTrigger){var s={address:-1===i.indexOf("!")?a.name+"!"+i:i,cancel:!1};if(this.parent.notify(K,{action:"removeHyperlink",eventArgs:s}),s.cancel)return}if(i&&-1!==i.indexOf("!")){var o=i.lastIndexOf("!");r=i.substring(0,o);for(var l=this.parent.sheets,d=0;d<l.length;d++)l[d].name===r&&(n=d);a=this.parent.sheets[n],i=i.substring(o+1)}for(var h,p,c=t(i||a.activeCell),u=c[0];u<=c[2];u++)for(var f=c[1];f<=c[3];f++)if(a&&a.rows[u]&&a.rows[u].cells[f]){if(p=[],h=this.parent.getCell(u,f))for(var g=0;g<h.classList.length;g++)p.push(h.classList[g]);this.parent.notify(Gt,{sheet:a,rowIdx:u,colIdx:f});for(g=0;g<p.length;g++)h.classList.contains(p[g])||h.classList.add(p[g])}e.preventEventTrigger||this.parent.notify(ka,{action:"removeHyperlink",eventArgs:{address:-1===i.indexOf("!")?a.name+"!"+i:i}})},n}(),fh=function(){return fh=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},fh.apply(this,arguments)},gh=function(){function r(e){this.undoCollection=[],this.redoCollection=[],this.isUndo=!1,this.undoRedoStep=100,this.parent=e,this.addEventListener()}return r.prototype.setActionData=function(e){var r,i=this.parent.getActiveSheet(),a=[],s=[],o=e.args,d=o.eventArgs,h={};switch(o.action){case"format":r=t(o.eventArgs.range);break;case"clipboard":h=d.copiedInfo,r=t(l(d.pastedRange)),h&&h.isCut&&(s=this.getCellDetails(h.range,In(this.parent,yn(this.parent,h.sId)),"clipboard"));break;case"beforeSort":(r=t(o.eventArgs.range))[0]===r[2]&&r[2]-r[0]==0&&(r[0]=0,r[1]=0,r[2]=i.usedRange.rowIndex,r[3]=i.usedRange.colIndex);break;case"beforeCellSave":case"cellDelete":case"cellSave":case"addNote":case"editNote":case"deleteNote":case"deleteImage":case"hyperlink":case"removeHyperlink":r=t(d.address);break;case"beforeWrap":case"beforeReplace":case"chartDesign":r=this.parent.getAddressInfo(d.address).indices;break;case"beforeClear":case"beforeInsertImage":case"beforeInsertChart":case"filter":r=t(d.range);break;case"autofill":r=t(d.fillRange);break;case"removeValidation":if(d.isColSelected){this.beforeActionData={cellDetails:[]};for(var p=d.range.substring(d.range.lastIndexOf("!")+1).split(":"),c=n(p[0]),u=n(p[1]);c<=u;c++)i.columns[c]&&i.columns[c].validation&&this.beforeActionData.cellDetails.push({colIndex:c,validation:i.columns[c].validation})}else r=t(d.range)}"beforeSort"===o.action?(this.beforeActionData={cellDetails:d.cellDetails},this.beforeActionData.sortedCellDetails=d.sortedCellDetails):r&&(a=this.getCellDetails(r,i,o.action),this.beforeActionData={cellDetails:a,cutCellDetails:s})},r.prototype.getBeforeActionData=function(e){e.beforeDetails=this.beforeActionData},r.prototype.performUndoRedo=function(t){var r,n;if(t.isFromUpdateAction?r=t:(r=t.isUndo?this.undoCollection.pop():this.redoCollection.pop(),t.setCollection&&(t.undoArgs=r)),this.isUndo=t.isUndo,r){var i=void 0,a=r.action,s={},o=[],l=void 0;if("autofill"===r.action||"autofillWithCF"===r.action?o=r.eventArgs.fillRange.split("!"):"cellSave"===r.action||"cellDelete"===r.action?o=r.eventArgs.address.split("!"):"clipboard"===r.action&&(o=r.eventArgs.pastedRange.split("!")),o.length>0?l=In(this.parent,vn(this.parent,o[0])):"clear"===r.action&&(l=In(this.parent,r.eventArgs.sheetIndex)),"autofillWithCF"===r.action){r.action="autofill";var d=l.conditionalFormats;"autofillWithCF"===d[d.length-1].action&&t.isUndo&&(d[d.length-1].value?d.pop():this.parent.notify(At,{range:d[d.length-1].range,isAction:!0}))}if(!t.isPublic){var h=r.eventArgs.beforeActionData;if(delete r.eventArgs.beforeActionData,i={action:r.action,eventArgs:{}},(0,e.extend)(i.eventArgs,r.eventArgs,null,!0),"Manual"===this.parent.calculationMode&&("clipboard"===r.action||"cellDelete"===r.action||"autofill"===r.action||"clear"===r.action))if(!t.isUndo&&l.isSheetCalculated&&"autofill"!==r.action||t.isUndo&&"CopyCells"===r.eventArgs.fillType)for(var p=0,c=h.cutCellDetails.length>0?h.cutCellDetails:h.cellDetails;p<c.length;p++){m=(m=l.rows[c[p].rowIndex].cells[c[p].colIndex])?m.value:"",(0,e.isNullOrUndefined)(c[p].autoFillText)?c[p].value!==m&&"autofill"!==r.action&&(c[p].value=m):c[p].autoFillText=m}else if(t.isUndo&&"paste"===r.eventArgs.requestType&&"clipboard"===r.action){var u=void 0;if(0===h.cutCellDetails.length?u="Copy":l.isSheetCalculated&&(u="Cut"),u){p=0;for(var f=h.cellDetails,g=h.cutCellDetails;p<f.length;p++){var m;m=(m=l.rows[f[p].rowIndex].cells[f[p].colIndex])?m.value:"","Copy"===u?f[p].copyCellValue=m:"Cut"===u&&g[p].value!==m&&(g[p].value=m)}}}if(r.eventArgs.beforeActionData=h,i.eventArgs.cancel=!1,r.preventAction=i.preventAction=!0,t.isUndo){if(i.isUndo=!0,"cellSave"===r.action&&"Manual"===this.parent.calculationMode&&l.isSheetCalculated&&1===h.cellDetails.length){var v=Ln(h.cellDetails[0].rowIndex,h.cellDetails[0].colIndex,l);v&&r.eventArgs.displayText!==v.value&&(r.eventArgs.displayText=v.value)}}else i.isRedo=!0;if(t.isFromUpdateAction||this.parent.notify(K,i),i.eventArgs.cancel)return void this.updateUndoRedoIcons();delete i.eventArgs.cancel}switch(r.action){case"cellSave":case"format":case"wrap":case"cellDelete":case"autofill":case"removeValidation":case"hyperlink":case"addNote":case"editNote":case"deleteNote":case"removeHyperlink":(r=this.performOperation(r,t.preventEvt,t.preventReSelect,t.isFromAutoFillOption)).action=a;break;case"sorting":this.undoForSorting(r,t.isUndo);break;case"clipboard":r=this.undoForClipboard(r,t.isUndo,i),n=!0;break;case"resize":case"resizeToFit":r=this.undoForResize(r);break;case"hideShow":case"delete":case"validation":case"addHighlight":case"removeHighlight":case"clearCF":case"insertImage":case"deleteImage":case"imageRefresh":case"insertChart":case"deleteChart":case"chartRefresh":case"addDefinedName":Cd(r,this.parent,!t.isUndo);break;case"replace":r=this.performOperation(r);break;case"replaceAll":r.eventArgs.isAction=!1,t.isUndo&&(s.value=r.eventArgs.replaceValue,s.replaceValue=r.eventArgs.value,s.skipFormatCheck=Yr(this.parent)),this.parent.notify(st,fh({},r.eventArgs,s));break;case"insert":case"filter":Cd(r,this.parent,!t.isUndo,null,i),n="filter"===r.action;break;case"merge":r.eventArgs.merge=r.isFromUpdateAction?r.eventArgs.merge:!r.eventArgs.merge,Cd(r,this.parent,!t.isUndo);break;case"clear":r=this.performOperation(r),t.isUndo&&r.eventArgs.cfClearActionArgs&&Cd({action:"clearCF",eventArgs:r.eventArgs.cfClearActionArgs},this.parent,!t.isUndo);break;case"conditionalFormat":Cd(r,this.parent,!t.isUndo,this.undoCollection);break;case"chartDesign":r.eventArgs.isUndo=t.isUndo,this.parent.notify(Ps,r.eventArgs)}t.isFromUpdateAction||(t.isUndo?this.redoCollection.push(r):this.undoCollection.push(r),this.undoCollection.length>this.undoRedoStep&&this.undoCollection.splice(0,1),this.redoCollection.length>this.undoRedoStep&&this.redoCollection.splice(0,1),this.updateUndoRedoIcons(),t.isPublic||n||this.parent.notify(ka,(0,e.extend)({isUndoRedo:!0,isUndo:t.isUndo},r))),this.parent.notify(Mt,null)}},r.prototype.undoForSorting=function(r,i){var a=this,s=p(this.parent,r.eventArgs.range),o=t(r.eventArgs.range),l=function(t,r){if(s===a.parent.activeSheetIndex){var n=a.parent.getCell(o[0]-1,a.parent.sortCollection[t].columnIndex);if(n&&(n=(0,e.select)(".e-filter-icon",n))){var i="e-sort"+("Ascending"===a.parent.sortCollection[t].order?"asc":"desc")+"-filter";r?n.classList.add(i):n.classList.remove(i)}}};if(i){if(this.parent.notify(Fe,{result:r.eventArgs.beforeActionData.cellDetails,range:o,sheet:In(this.parent,s),jsonData:r.eventArgs.beforeActionData.sortedCellDetails,isUndo:!0}),this.parent.notify(Te,{range:r.eventArgs.range}),this.parent.sortCollection&&r.eventArgs.previousSort)for(var d=this.parent.sortCollection.length-1;d>=0;d--)if(this.parent.sortCollection[d].sheetIndex===s){l(d,!1),this.parent.sortCollection.splice(d,1);var h=r.eventArgs.previousSort;if(Array.isArray(h))for(var c=0;c<h.length;c++)this.parent.sortCollection.splice(c,0,h[c]),l(c,!0);this.parent.sortCollection.length||(this.parent.sortCollection=void 0);break}}else if(Cd(r,this.parent,!0),r.eventArgs.previousSort){var u=0;if(this.parent.sortCollection)for(d=this.parent.sortCollection.length-1;d>=0;d--)this.parent.sortCollection[d].sheetIndex===s&&(l(d,!1),u=d,this.parent.sortCollection.splice(d,1));else this.parent.sortCollection=[];this.parent.sortCollection.splice(u,0,{sortRange:r.eventArgs.range.substring(r.eventArgs.range.lastIndexOf("!")+1),sheetIndex:s,columnIndex:n(r.eventArgs.sortOptions.sortDescriptors.field),order:r.eventArgs.sortOptions.sortDescriptors.order}),l(u,!0)}},r.prototype.updateUndoRedoCollection=function(e){var t=["clipboard","format","sorting","cellSave","resize","resizeToFit","wrap","hideShow","replace","validation","merge","clear","conditionalFormat","clearCF","insertImage","imageRefresh","insertChart","deleteChart","chartRefresh","filter","cellDelete","autofill","autofillWithCF","addDefinedName","removeValidation","removeHighlight","addHighlight","hyperlink","removeHyperlink","deleteImage","chartDesign","replaceAll","addNote","editNote","deleteNote"];"insert"!==e.args.action&&"delete"!==e.args.action||"Sheet"===e.args.eventArgs.modelType||t.push(e.args.action);var r=e.args.action;if(-1!==t.indexOf(r)||e.isPublic){var n=e.args.eventArgs;if("clipboard"===r||"sorting"===r||"format"===r||"cellSave"===r||"wrap"===r||"replace"===r||"validation"===r||"clear"===r||"conditionalFormat"===r||"clearCF"===r||"insertImage"===r||"imageRefresh"===r||"insertChart"===r||"chartRefresh"===r||"filter"===r||"cellDelete"===r||"autofill"===r||"autofillWithCF"===r||"removeValidation"===r||"addDefinedName"===r||"hyperlink"===r||"removeHyperlink"===r||"deleteImage"===r||"chartDesign"===r||"addNote"===r||"editNote"===r||"deleteNote"===r){var i={beforeDetails:{cellDetails:[]}};this.parent.notify(Ca,i),n.beforeActionData=i.beforeDetails}if("clipboard"===r&&n.copiedInfo&&n.copiedInfo.isExternal){var a=this.parent.getAddressInfo(n.pastedRange);n.copiedInfo.cellDetails=this.getCellDetails(a.indices,In(this.parent,a.sheetIndex),r)}this.redoCollection.length>0&&"autofillWithCF"===this.redoCollection[this.redoCollection.length-1].action&&"autofill"===e.args.action&&(e.args.action="autofillWithCF"),this.undoCollection.push(e.args),this.redoCollection=[],this.undoCollection.length>this.undoRedoStep&&this.undoCollection.splice(0,1),this.updateUndoRedoIcons()}},r.prototype.clearUndoRedoCollection=function(){this.undoCollection=[],this.redoCollection=[],this.updateUndoRedoIcons()},r.prototype.updateUndoRedoIcons=function(){var e=this.parent.serviceLocator.getService(kl);this.parent.notify(wi,[{tab:e.getConstant("Home"),items:[this.parent.element.id+"_undo"],enable:this.undoCollection.length>0}]),this.parent.notify(wi,[{tab:e.getConstant("Home"),items:[this.parent.element.id+"_redo"],enable:this.redoCollection.length>0}])},r.prototype.undoForClipboard=function(e,r,n){var i=this,a=e.eventArgs,s=[];s[0]=a.pastedRange.substring(0,a.pastedRange.lastIndexOf("!")),s[1]=a.pastedRange.substring(a.pastedRange.lastIndexOf("!")+1);var l,d=t(s[1]),h=vn(this.parent,s[0]),p=In(this.parent,h),u=a.copiedInfo,f=a.beforeActionData,g=e.isFromUpdateAction,m=h===this.parent.activeSheetIndex;if(n&&(n.isUndoRedo=!0,n.eventArgs.beforeActionData=f),"imagePaste"===e.eventArgs.requestType){var v=a.copiedShapeInfo;r?(l=v.pictureElem,v.isCut?(this.parent.notify(xs,{id:l.id,sheetIdx:a.pasteSheetIndex+1,isUndoRedo:!0}),this.parent.notify(bs,{options:{src:l.style.backgroundImage.replace(/url\((['"])?(.*?)\1\)/gi,"$2"),height:v.height,width:v.width,id:l.id},range:v.copiedRange,isPublic:!1,isUndoRedo:!0})):this.parent.notify(xs,{id:a.pastedPictureElement.id,sheetIdx:a.pasteSheetIndex+1,isUndoRedo:!0})):v.isCut?(l=v.pictureElem,this.parent.notify(xs,{id:l.id,sheetIdx:v.sId,isUndoRedo:!0}),this.parent.notify(bs,{options:{src:l.style.backgroundImage.replace(/url\((['"])?(.*?)\1\)/gi,"$2"),height:v.height,width:v.width,id:l.id},range:v.pastedRange,isPublic:!1,isUndoRedo:!0})):(l=a.pastedPictureElement,this.parent.notify(bs,{options:{src:l.style.backgroundImage.replace(/url\((['"])?(.*?)\1\)/gi,"$2"),height:l.offsetHeight,width:l.offsetWidth,id:l.id},range:v.pastedRange,isPublic:!1,isUndoRedo:!0}))}else{if(r){if(u.isCut){var y=f.cutCellDetails;this.updateCellDetails(y,In(this.parent,yn(this.parent,u.sId)),c(u.range),m,e),a.cfClearActionArgs&&Cd({action:"clearCF",eventArgs:a.cfClearActionArgs},this.parent,!1)}f&&this.updateCellDetails(f.cellDetails,p,d,m,e,null,null,n?n.isUndoRedo:null),a.cfActionArgs&&a.cfActionArgs.cfModel.forEach((function(e){Cd({eventArgs:{range:e.range,type:e.type,cFColor:e.cFColor,value:e.value,sheetIdx:a.cfActionArgs.sheetIdx,cancel:!0},action:"conditionalFormat"},i.parent,!1)})),kd(p,d[0],d[1],fl(p,d[0]));var C=Ad(p,d[0]);xd(this.parent,p,C,d[0]),a.mergeCollection.forEach((function(e){e.merge=!e.merge,i.parent.notify(St,e),e.merge=!e.merge})),n&&!g&&this.parent.notify(ka,n)}else if(u.isExternal){var b=this.parent.getAddressInfo(a.pastedRange);this.updateCellDetails(u.cellDetails,In(this.parent,b.sheetIndex),b.indices,!0,e,null,null,n?n.isUndoRedo:null),n&&!g&&this.parent.notify(ka,n)}else{var x=new Promise((function(e){e(void 0)}));b=this.parent.getAddressInfo(a.copiedRange);this.parent.notify(a.copiedInfo.isCut?Ri:Oi,{range:b.indices,sId:In(this.parent,b.sheetIndex).id,promise:x,invokeCopy:!0,isPublic:!0,isFromUpdateAction:g}),x.then((function(){i.parent.notify(ki,{range:s?o(a.pastedRange):s,sIdx:s?vn(i.parent,Cn(a.pastedRange)):s,type:a.type,isAction:!1,isInternal:!0,isFromUpdateAction:g,beforeActionData:a.beforeActionData,isUndo:r}),n&&!g&&i.parent.notify(ka,n)}))}m&&!g?(this.parent.notify(Ei,{address:a.selectedRange}),this.parent.notify(Gs,{})):this.checkRefreshNeeded(h,g)}return e},r.prototype.undoForResize=function(e){var r=e.eventArgs;if(void 0===r.hide)if(r.isCol){var n=r.oldWidth;r.oldWidth=r.width,r.width=n}else{n=r.oldHeight;r.oldHeight=r.height,r.height=n}else r.hide=!r.hide;Cd(e,this.parent,!1);var i=this.parent.getActiveSheet(),a=t(i.activeCell),s=Ln(a[0],a[1],i);if(s&&s.rowSpan){var o=this.parent.getCell(a[0],a[1]);this.parent.element.querySelector(".e-active-cell").style.height=o.offsetHeight+"px"}else if(s&&s.colSpan){o=this.parent.getCell(a[0],a[1]);this.parent.element.querySelector(".e-active-cell").style.width=o.offsetWidth+"px"}return e},r.prototype.performOperation=function(r,s,o,l){var d=r.eventArgs,h=[],p="cellSave"===r.action||"wrap"===r.action||"replace"===r.action||"cellDelete"===r.action||"hyperlink"===r.action||"addNote"===r.action||"editNote"===r.action||"deleteNote"===r.action||"removeHyperlink"===r.action?d.address:d.range;"autofill"===r.action?(h[0]=d.fillRange.substring(0,d.fillRange.lastIndexOf("!")),h[1]=d.fillRange.substring(d.fillRange.lastIndexOf("!")+1)):(h[0]=p.substring(0,p.lastIndexOf("!")),h[1]=p.substring(p.lastIndexOf("!")+1));var u,f=vn(this.parent,h[0]),g=In(this.parent,f);if(d.isColSelected){var m=h[1].split(":");u=[0,n(m[0]),g.rowCount-1,n(m[1])]}else u=c(t(h[1]));var v=u,y=d.beforeActionData,C=r.isFromUpdateAction,b=this.checkRefreshNeeded(f,C),x={cellIdx:[u[0],u[1]],isUnique:!1,uniqueRange:""};if(d.isColSelected||this.parent.notify(Ee,x),this.isUndo){if(x.isUnique&&d.formula&&d.formula.indexOf("UNIQUE")>-1)if("#SPILL!"!==Ln((I=t(x.uniqueRange))[0],I[1],this.parent.getActiveSheet()).value)for(var S=I[0];S<=I[2];S++)for(var w=I[1];w<=I[3];w++)S===I[0]&&w===I[1]&&(w+=1),this.parent.updateCell({value:""},a([S,w]));if(this.updateCellDetails(y.cellDetails,g,u,b,r,s,d.isColSelected,null,l),x.isUnique&&"cellDelete"===r.action&&d.isSpill){for(var I,E=Ln((I=t(x.uniqueRange))[0],I[1],this.parent.getActiveSheet()),N=I[0];N<=I[2];N++)for(S=I[1];S<=I[3];S++)for(w=u[0];w<=u[2];w++)for(var R=u[1];R<=u[3];R++)N===w&&S===R||this.parent.updateCell({value:""},i(N,S));E.value="#SPILL!",this.parent.updateCell(E,i(I[0],I[1]))}if(!d.isSpill&&""!==x.uniqueRange){var O=t(x.uniqueRange);for(S=O[0];S<=O[2];S++)for(w=O[1];w<=O[3];w++)S===O[0]&&w===O[1]&&(w+=1),this.parent.updateCell({value:""},a([S,w]));this.parent.notify(Ne,null)}}else{var k=r.eventArgs,A=t(g.activeCell),F=this.parent.getCellStyleValue(["textDecoration"],A).textDecoration;if(k&&k.style&&k.style.textDecoration){var T=k.style.textDecoration,D=T,L=void 0,P=!1;"underline"===F?D="underline"===T?"none":"underline line-through":"line-through"===F?D="line-through"===T?"none":"underline line-through":"underline line-through"===F&&(D="underline"===T?"line-through":"underline",P=!0),"none"===D&&(P=!0),k.style.textDecoration=D,r.eventArgs=k;for(N=v[0];N<=v[2];N++)for(S=v[1];S<=v[3];S++){if(L={},"none"===(F=this.parent.getCellStyleValue(["textDecoration"],[N,S]).textDecoration)){if(P)continue;L.textDecoration=T}else if("underline"===F||"line-through"===F)if(P){if(T!==F)continue;L.textDecoration="none"}else L.textDecoration=T!==F?"underline line-through":T;else if("underline line-through"===F){if(!P)continue;L.textDecoration="underline"===T?"line-through":"underline"}this.parent.notify(ae,{style:{textDecoration:L.textDecoration},range:[N,S,N,S],refreshRibbon:!0,onActionUpdate:!0})}k.style.textDecoration=T,r.eventArgs=k}else{if(!(0,e.isNullOrUndefined)(d.oldValue)&&d.oldValue!==d.value&&x.isUnique){var M=t(x.uniqueRange);if("#SPILL!"!==Ln(M[0],M[1],this.parent.getActiveSheet()).value)for(S=M[0];S<=M[2];S++)for(w=M[1];w<=M[3];w++)S===M[0]&&w===M[1]&&(this.parent.updateCell({value:"#SPILL!"},a([M[0],M[1]])),w+=1),this.parent.updateCell({value:""},a([S,w]))}if(Cd(r,this.parent,!0),x.isUnique&&"cellDelete"===r.action&&d.isSpill){var B=t(x.uniqueRange),H=!1;for(N=B[0];N<=B[1];N++)for(S=B[1];S<=B[3];S++)N===B[0]&&S===B[1]&&S++,Ln(N,S,g)&&!(0,e.isNullOrUndefined)(Ln(N,S,g).value)&&""!==Ln(N,S,g).value&&(H=!0);if(!H)(E=Ln(B[0],B[1],this.parent.getActiveSheet())).value="",this.parent.updateCell(E,i(B[0],B[1])),this.parent.notify(Ne,null)}}}return"autofill"===r.action&&(h[1]=this.isUndo?r.eventArgs.dataRange:r.eventArgs.selectedRange),!b||o||C||(d.isColSelected&&(h[1]=g.selectedRange),this.parent.notify(Ei,{address:h[1]})),this.parent.showAggregate&&this.parent.notify(ns,{}),r},r.prototype.getCellDetails=function(t,r,n){for(var i,a=[],s="cellDelete"===n,o=(t=c(t))[0];o<=t[2];o++)if(!s||!ul(r,o))for(var l=t[1];l<=t[3];l++){var d={rowIndex:o,colIndex:l,value:(i=Ln(o,l,r))?i.value:"",formula:i?i.formula:""};if(i){i.format&&(d.format=i.format),i.isLocked&&(d.isLocked=i.isLocked),i.style&&(d.style=Object.assign({},i.style)),i.wrap&&(d.wrap=i.wrap),i.rowSpan&&(d.rowSpan=i.rowSpan),i.colSpan&&(d.colSpan=i.colSpan),i.image&&(d.image=i.image),i.chart&&(d.chart=JSON.parse(JSON.stringify(i.chart))),i.validation&&(d.validation=i.validation),i.notes&&(d.notes=i.notes),i.isReadOnly&&(d.isReadOnly=i.isReadOnly),i.formattedText&&(d.formattedText=i.formattedText),i.hyperlink&&(d.hyperlink=(0,e.isObject)(i.hyperlink)?(0,e.extend)({},i.hyperlink):i.hyperlink);var h=this.parent.editModule;d.value=i&&h&&i.formula===h.editCellData.value&&!(0,e.isNullOrUndefined)(h.editCellData.prevFormulaValue)?h.editCellData.prevFormulaValue:d.value}else"autofill"===n&&(d.autoFillText="");a.push(d)}return a},r.prototype.updateCellDetails=function(t,r,n,s,o,l,d,h,p){var c,u,f,g,m,v,y,C=this,b=t.length,x=o&&!l&&("cellSave"===o.action||"cellDelete"===o.action||"autofill"===o.action||"clipboard"===o.action),S=o&&!o.eventArgs.cfClearActionArgs&&r.conditionalFormats&&r.conditionalFormats.length&&[].slice.call(r.conditionalFormats),w=[];"cellDelete"===o.action&&(v=!1,y=n);for(var I=function(n){if(d)return xl(r,t[n].colIndex,{validation:t[n].validation}),"continue";(u=Ln(t[n].rowIndex,t[n].colIndex,r,!1,!0)).style&&o&&("format"===o.action||"clipboard"===o.action)&&(!u.style.borderTop||t[n].style&&t[n].style.borderTop||E.parent.setBorder({borderTop:""},r.name+"!"+i(t[n].rowIndex,t[n].colIndex),null,h),!u.style.borderLeft||t[n].style&&t[n].style.borderLeft||E.parent.setBorder({borderLeft:""},r.name+"!"+i(t[n].rowIndex,t[n].colIndex),null,h),!u.style.borderRight||t[n].style&&t[n].style.borderRight||E.parent.setBorder({borderRight:""},r.name+"!"+i(t[n].rowIndex,t[n].colIndex),null,h),!u.style.fontSize||t[n].style&&t[n].style.fontSize||(u.style.fontSize="11pt",f=!0,E.parent.notify(le,{style:{fontSize:"11pt"},rowIdx:t[n].rowIndex,colIdx:t[n].colIndex,lastCell:!0,isHeightCheckNeeded:!0,manualUpdate:!0,onActionUpdate:!0})),!u.style.fontFamily||t[n].style&&t[n].style.fontFamily||(f=!0,u.style.fontFamily="Calibri",E.parent.notify(le,{style:{fontFamily:"Calibri"},rowIdx:t[n].rowIndex,colIdx:t[n].colIndex,lastCell:!0,isHeightCheckNeeded:!0,manualUpdate:!0,onActionUpdate:!0}))),u.image&&o&&"clipboard"===o.action&&u.image.forEach((function(e){C.parent.notify(xs,{id:e.id,sheet:r,preventEventTrigger:!0,rowIdx:t[n].rowIndex,colIdx:t[n].colIndex})}));var s={value:t[n].formula&&t[n].formula.toUpperCase().includes("UNIQUE")?null:t[n].value,formula:t[n].formula};t[n].format&&(s.format=t[n].format),t[n].isLocked&&(s.isLocked=t[n].isLocked),t[n].style&&(s.style=Object.assign({},t[n].style)),t[n].wrap&&(s.wrap=t[n].wrap),t[n].rowSpan&&(s.rowSpan=t[n].rowSpan),t[n].colSpan&&(s.colSpan=t[n].colSpan),t[n].hyperlink&&(s.hyperlink=t[n].hyperlink),t[n].image&&(s.image=t[n].image),t[n].notes&&(s.notes=t[n].notes),t[n].isReadOnly&&(s.isReadOnly=t[n].isReadOnly),t[n].formattedText&&(s.formattedText=t[n].formattedText),Pn(t[n].rowIndex,t[n].colIndex,r,s),m={action:"updateCellValue",address:[t[n].rowIndex,t[n].colIndex,t[n].rowIndex,t[n].colIndex],notes:t[n].notes,value:t[n].formula?t[n].formula:t[n].value,sheetIndex:vn(E.parent,r.name),skipFormatCheck:Yr(E.parent),isDelete:v,deletedRange:y,actionName:o.action},E.parent.notify(ce,m),S&&!g&&(g=m.isFormulaDependent),(o&&"wrap"===o.action&&o.eventArgs.wrap||u.wrap&&!t[n].wrap)&&E.parent.notify(Ge,{range:[t[n].rowIndex,t[n].colIndex,t[n].rowIndex,t[n].colIndex],wrap:!1,sheet:r,initial:!0}),o&&t[n].hyperlink&&"clear"===o.action&&(o.eventArgs.range=r.name+"!"+a([t[n].rowIndex,t[n].colIndex,t[n].rowIndex,t[n].colIndex]),c=E.parent.getCell(t[n].rowIndex,t[n].colIndex),"Clear All"===o.eventArgs.type||"Clear Hyperlinks"===o.eventArgs.type?E.parent.addHyperlink(t[n].hyperlink,o.eventArgs.range,t[n].value):"Clear Formats"===o.eventArgs.type&&c&&(0,e.addClass)(c.querySelectorAll(".e-hyperlink"),"e-hyperlink-style")),t[n].validation&&E.parent.notify(Qe,{rules:t[n].validation,range:r.name+"!"+i(t[n].rowIndex,t[n].colIndex)}),x&&t[n].value!==u.value&&E.parent.trigger("cellSave",{element:null,value:t[n].value,oldValue:u.value,formula:t[n].formula,cancel:!1,address:r.name+"!"+i(t[n].rowIndex,t[n].colIndex),displayText:E.parent.getDisplayText(t[n])}),S&&!g&&_r(S,w,t[n].rowIndex,t[n].colIndex)},E=this,N=0;N<b;N++)I(N);if(s){if(n[0]===n[2]&&n[1]===n[3]){var R=Ln(n[0],n[1],r);R.rowSpan>1&&(n[2]=n[0]+R.rowSpan-1),R.colSpan>1&&(n[3]=n[1]+R.colSpan-1)}var O=!1;"autofill"===o.action||"clipboard"===o.action?O=!0:"format"===o.action&&"CellFormat"===o.eventArgs.requestType&&(O=Lr(o.eventArgs.style,!0)),this.parent.serviceLocator.getService("cell").refreshRange(n,!1,!1,!0,!1,Yr(this.parent),null,p,O),(w.length||g)&&this.parent.notify(kt,{cfModel:!g&&w,refreshAll:g,isAction:!0}),f&&Bl((function(){return C.parent.selectRange(r.selectedRange)}))}},r.prototype.checkRefreshNeeded=function(e,t){var r=!0;return e!==this.parent.activeSheetIndex&&(t||(this.parent.activeSheetIndex=e,this.parent.dataBind()),r=!1),r},r.prototype.addEventListener=function(){this.parent.on(ma,this.performUndoRedo,this),this.parent.on(va,this.updateUndoRedoCollection,this),this.parent.on(ya,this.setActionData,this),this.parent.on(Ca,this.getBeforeActionData,this),this.parent.on(ba,this.clearUndoRedoCollection,this),this.parent.on($a,this.updateUndoRedoIcons,this)},r.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(ma,this.performUndoRedo),this.parent.off(va,this.updateUndoRedoCollection),this.parent.off(ya,this.setActionData),this.parent.off(Ca,this.getBeforeActionData),this.parent.off(ba,this.clearUndoRedoCollection),this.parent.off($a,this.updateUndoRedoIcons))},r.prototype.destroy=function(){this.removeEventListener(),this.undoCollection.length>0&&(this.undoCollection=[]),this.redoCollection.length>0&&(this.redoCollection=[]),this.beforeActionData&&this.beforeActionData.cellDetails&&(this.beforeActionData.cellDetails=[]),this.parent=null},r.prototype.getModuleName=function(){return"undoredo"},r}(),mh=function(){function t(e){this.parent=e,this.wrapCell=this.parent.createElement("span",{className:"e-wrap-content"}),this.addEventListener()}return t.prototype.addEventListener=function(){this.parent.on(xi,this.ribbonClickHandler,this),this.parent.on(Ge,this.wrapTextHandler,this),this.parent.on(Wi,this.rowHeightChangedHandler,this),this.parent.on(Gi,this.colWidthChanged,this),this.parent.on(oo,this.updateWrapCell,this)},t.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(xi,this.ribbonClickHandler),this.parent.off(Ge,this.wrapTextHandler),this.parent.off(Wi,this.rowHeightChangedHandler),this.parent.off(Gi,this.colWidthChanged),this.parent.off(oo,this.updateWrapCell))},t.prototype.wrapTextHandler=function(t){if(t.initial||Wl(this.parent,t.range,!0)){if(t.isPublic&&zd(this.parent,t.range))return;t.initial&&!t.td&&!t.outsideViewport&&Wl(this.parent,t.range,!0)&&(t.initial=!1);var r=void 0,n=void 0,i=void 0,a=void 0,s=void 0,o=void 0,l=void 0,d=void 0,h=void 0,p=void 0,c=this.parent.frozenRowCount(t.sheet),u=void 0,f=void 0;!(0,e.isNullOrUndefined)(t.sheet.standardHeight)&&t.sheet.standardHeight<20?u=!0:f=this.parent.allowFiltering&&this.parent.filterModule.filterRange.has(this.parent.activeSheetIndex)&&this.parent.filterModule.filterRange.get(this.parent.activeSheetIndex).range;for(var g=t.range[0];g<=t.range[2];g++){a=0,o=(l=(h=hl(t.sheet,g)).customHeight)||t.isCustomHgt,p=!cl(t.sheet,g);for(var m=t.range[1];m<=t.range[3];m++)if(!((n=Ln(g,m,t.sheet,null,!0)).rowSpan<0||n.colSpan<0)){var v=n.rowSpan>1||n.colSpan>1;if((r=t.initial?t.td:p&&!Il(t.sheet,m)&&this.parent.getCell(g,m))?(t.wrap?(d=wd(n.style&&n.style.fontFamily?n.style:this.parent.cellStyle),r.classList.add(Ol)):(r.classList.remove(Ol),d=null),(o||v||h.height<20||u||f&&g===f[0]&&m>=f[1]&&m<=f[3])&&this.updateWrapCell({rowIdx:g,colIdx:m,sheet:t.sheet,ele:r}),e.Browser.isIE&&r.classList.add("e-ie-wrap")):d=null,!o&&!v){i=Rd(t.sheet,g,m,n.colSpan>1?m+n.colSpan-1:m);var y=this.parent.getDisplayText(n).toString();if(r&&y.indexOf("\n")<0){var C=this.parent.element.querySelector(".e-spreadsheet-edit");C&&C.textContent.indexOf("\n")>-1&&(y=C.textContent)}if(y)if(t.wrap){r&&r.classList.contains("e-alt-unwrap")&&r.classList.remove("e-alt-unwrap");var b=void 0,x=0,S=void 0;if(y.indexOf("\n")>-1){var w=y.split("\n"),I=w.length;for(S=0;S<I;S++)0===(b=Ed(w[S],i,n.style,this.parent.cellStyle))&&(b=1),x+=b;b=x}else b=Ed(y,i,n.style,this.parent.cellStyle);if(s=Od(this.parent,g,m,t.sheet,n.style||this.parent.cellStyle,b,d),a=Math.max(a,s),n.rowSpan>1){var E=ml(t.sheet,g,g+(n.rowSpan-1));if(E>=a)return;s=a=fl(t.sheet,g)+(a-E)}kd(t.sheet,g,m,s)}else r&&y.indexOf("\n")>-1&&r.classList.add("e-alt-unwrap"),s=Od(this.parent,g,m,t.sheet,n.style||this.parent.cellStyle,1,d),kd(t.sheet,g,m,s),a=Math.max(Ad(t.sheet,g),20);else t.wrap&&y||(kd(t.sheet,g,m,20),a=Math.max(Ad(t.sheet,g),20));if(m===t.range[3]){var N=fl(t.sheet,g);(t.wrap&&a>20&&Ad(t.sheet,g)<=a||(!t.wrap||!y)&&Ad(t.sheet,g)<N&&N>20)&&N!==a&&(r?(xd(this.parent,t.sheet,a,g,t.row,t.hRow,p),r&&t.sheet.conditionalFormats&&t.sheet.conditionalFormats.length&&this.parent.notify(kt,{indexes:[g,m],isAction:!0})):xd(this.parent,t.sheet,a,g,null,null,p,!p||g>this.parent.viewport.bottomIndex||g>=c&&g<this.parent.viewport.topIndex+c))}}if(r){if(o&&!v){y=this.parent.getDisplayText(n);t.wrap?r.classList.contains("e-alt-unwrap")&&r.classList.remove("e-alt-unwrap"):y.indexOf("\n")>-1&&r.classList.add("e-alt-unwrap")}t.wrap?l?r.style.lineHeight&&(r.style.lineHeight=""):r.style.lineHeight=parseFloat(n.style&&n.style.fontSize||this.parent.cellStyle.fontSize)*d+"pt":r.style.lineHeight=""}}}t.initial||this.parent.notify(Gs,null)}},t.prototype.ribbonClickHandler=function(t){var r=(0,e.closest)(t.originalEvent.target,".e-btn");if(r&&r.id===this.parent.element.id+"_wrap"){var n=r.classList.contains("e-active"),i=d(this.parent.getActiveSheet()),a={address:i,wrap:n,cancel:!1};if(zd(this.parent))return void this.parent.notify(Ka,null);this.parent.notify(K,{action:"beforeWrap",eventArgs:a}),a.cancel||(Bn(this.parent.getActiveSheet().selectedRange,n,this.parent),this.parent.notify(ka,{action:"wrap",eventArgs:{address:i,wrap:n}}))}},t.prototype.rowHeightChangedHandler=function(e){if(e.isCustomHgt){e.sheet=this.parent.getActiveSheet();for(var t=this.parent.viewport.leftIndex,r=this.parent.viewport.rightIndex;t<=r;t++)Ln(e.rowIdx,t,e.sheet,!1,!0).wrap&&(e.colIdx=t,e.ele=this.parent.getCell(e.rowIdx,t),this.updateWrapCell(e),e.ele.style.lineHeight&&(e.ele.style.lineHeight=""))}},t.prototype.colWidthChanged=function(e){if(e.checkWrapCell){e.sheet=this.parent.getActiveSheet();for(var t=this.parent.viewport.topIndex,r=this.parent.viewport.bottomIndex;t<=r;t++)Ln(t,e.colIdx,e.sheet,!1,!0).wrap&&(e.rowIdx=t,e.ele=this.parent.getCell(t,e.colIdx),this.updateWrapCell(e))}},t.prototype.updateWrapCell=function(t){if(t.ele&&!t.ele.querySelector(".e-wrap-content")){for(var r=this.wrapCell.cloneNode(),n=t.ele.querySelector(".e-filter-btn");t.ele.childElementCount&&!(0,e.isNullOrUndefined)(t.ele.firstElementChild)&&-1===t.ele.firstElementChild.className.indexOf("e-addNoteIndicator");)r.appendChild(t.ele.firstElementChild);var i=void 0;if(!(0,e.isNullOrUndefined)(t.ele.firstElementChild)&&t.ele.firstElementChild.className.indexOf("e-addNoteIndicator")>-1&&(i=t.ele.firstElementChild),n&&(t.ele.firstChild?t.ele.insertBefore(n,t.ele.firstChild):t.ele.appendChild(n)),!Ln(t.rowIdx,t.colIdx,t.sheet,!1,!0).hyperlink){var a=t.ele.lastChild;a&&3===a.nodeType?(r.appendChild(document.createTextNode(a.textContent)),a.textContent=""):(r.appendChild(document.createTextNode(t.ele.textContent)),t.ele.textContent="")}t.ele.appendChild(r),(0,e.isNullOrUndefined)(i)||t.ele.appendChild(i)}},t.prototype.getModuleName=function(){return"wrapText"},t.prototype.destroy=function(){this.removeEventListener(),this.wrapCell&&(this.wrapCell.remove(),this.wrapCell=null),this.parent=null},t}(),vh=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.insert=function(e){var t=e.eventArgs;this.parent.notify(qt,t);var n=In(this.parent,t.activeSheetIndex);switch(t.modelType){case"Sheet":this.parent.notify(yi,{startIdx:t.index,endIdx:t.index+(t.model.length-1),preventUpdate:!t.isAction}),this.parent.renderModule.refreshSheet();break;case"Row":if(t.activeSheetIndex===this.parent.activeSheetIndex){var a=this.parent.frozenRowCount(n);if(!this.parent.scrollSettings.enableVirtualization||t.index<=this.parent.viewport.bottomIndex)if(t.freezePane)this.parent.renderModule.refreshSheet(!1,!1,!0);else if(this.parent.scrollSettings.enableVirtualization){var s=this.parent.frozenColCount(n);if(t.index>=this.parent.viewport.topIndex+a){var o=[],l=void 0;s?(l=r(n.topLeftCell)[1],o.push(a),o.push(this.parent.viewport.leftIndex+s)):l=this.parent.viewport.leftIndex;var d=this.parent.viewport.leftIndex;this.parent.renderModule.refreshUI({rowIndex:this.parent.viewport.topIndex,colIndex:l,refresh:"Row",frozenIndexes:o,skipUpdateOnFirst:this.parent.viewport.topIndex+a===Dr(n,a,!0)}),s&&(this.parent.viewport.leftIndex=d)}var h=r(n.paneTopLeftCell)[0];t.index<h&&(this.parent.notify(to,{scrollTop:ml(n,a,h-1,!0)}),this.parent.goTo(i(t.index,Dr(n,s,!0,"columns")))),this.parent.selectRange(n.selectedRange)}else this.parent.renderModule.refreshSheet(!1,!1,!0);else!this.parent.scrollSettings.isFinite||this.parent.viewport.topIndex+a!==Dr(n,0,!0)&&this.parent.viewport.bottomIndex!==Dr(n,n.rowCount-t.model.length-1,!1)||this.parent.renderModule.refreshSheet(!1,!1,!0)}break;case"Column":if(t.activeSheetIndex===this.parent.activeSheetIndex){s=this.parent.frozenColCount(n);if(!this.parent.scrollSettings.enableVirtualization||t.index<=this.parent.viewport.rightIndex)if(t.freezePane)this.parent.renderModule.refreshSheet(!1,!1,!0);else if(this.parent.scrollSettings.enableVirtualization){a=this.parent.frozenRowCount(n);if(t.index>=this.parent.viewport.leftIndex+s){o=[];a&&(o=[a+this.parent.viewport.topIndex,s]);var p=a?r(n.topLeftCell)[0]:this.parent.viewport.topIndex,c=this.parent.viewport.topIndex;this.parent.renderModule.refreshUI({skipUpdateOnFirst:this.parent.viewport.leftIndex+s===Dr(n,s,!0,"columns"),rowIndex:p,colIndex:this.parent.viewport.leftIndex,refresh:"Column",frozenIndexes:o}),a&&(this.parent.viewport.topIndex=c)}var u=r(n.paneTopLeftCell)[1];t.index<u&&(this.parent.notify(to,{scrollLeft:wl(n,0,u-1,!0)}),this.parent.goTo(i(Dr(n,a,!0),t.index))),this.parent.selectRange(n.selectedRange)}else this.parent.renderModule.refreshSheet(!1,!1,!0);else!this.parent.scrollSettings.isFinite||this.parent.viewport.leftIndex+s!==Dr(n,0,!0,"columns")&&this.parent.viewport.rightIndex!==Dr(n,n.colCount-t.model.length-1,!1,"columns")||this.parent.renderModule.refreshSheet(!1,!1,!0)}}this.refreshImgElement(t.model.length,this.parent.activeSheetIndex,t.modelType,t.index),t.isAction?(delete t.isAction,this.parent.notify(ka,e),Fd(this.parent.element)):t.isUndoRedo||(t.isMethod=!0,this.parent.notify(G,e))},e.prototype.refreshImgElement=function(e,t,r,n){for(var i,a=this.parent.sheets[t],s=[0,0,a.usedRange.rowIndex,a.usedRange.colIndex],o=0;o<=s[2];o++)for(var l=s[1];l<=s[3];l++)(i=Ln(o,l,a))&&i.image&&i.image.length>0&&("Row"===r&&o>=n||"Column"===r&&l>=n)&&this.parent.notify(Es,{rowIdx:o,colIdx:l,sheetIdx:t,type:r,count:e,status:"insert"})},e.prototype.addEventListener=function(){this.parent.on(Xe,this.insert,this)},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off(Xe,this.insert)},e.prototype.getModuleName=function(){return"insert"},e}(),yh=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.delete=function(e){var t=e.eventArgs;if("Sheet"===t.modelType){var n=t.activeSheetIndex>=t.startIndex&&t.activeSheetIndex<=t.endIndex;n&&this.parent.setProperties({activeSheetIndex:this.parent.skipHiddenSheets(t.startIndex<this.parent.sheets.length?t.startIndex:t.startIndex?t.startIndex-1:0)},!0),t.endIndex<t.activeSheetIndex&&this.parent.setProperties({activeSheetIndex:t.activeSheetIndex-(t.endIndex+1-t.startIndex)},!0),this.parent.notify(Kn,null),n&&this.parent.renderModule.refreshSheet(!1,!1,!0)}else if(t.activeSheetIndex===this.parent.activeSheetIndex){var i=this.parent.getActiveSheet(),a=this.parent.frozenRowCount(i),s=this.parent.frozenColCount(i);if("Row"===t.modelType){if(!this.parent.scrollSettings.enableVirtualization||t.startIndex<=this.parent.viewport.bottomIndex)if(this.parent.scrollSettings.enableVirtualization)if(t.startIndex<r(i.paneTopLeftCell)[0])this.parent.updateTopLeftCell(Dr(i,t.startIndex-1<a?a:t.startIndex-1,!0)-a,null,"col"),this.parent.renderModule.refreshSheet(!1,!1,!0);else if(t.freezePane||this.parent.scrollSettings.isFinite&&this.parent.viewport.bottomIndex>=Dr(i,i.rowCount-1,!1))this.parent.renderModule.refreshSheet(!1,!1,!0);else{var o=[],l=this.parent.frozenColCount(i),d=void 0,h=this.parent.viewport.leftIndex;l?(o.push(a),o.push(h+l),d=r(i.topLeftCell)[1]):d=h,this.parent.renderModule.refreshUI({rowIndex:this.parent.viewport.topIndex,refresh:"Row",colIndex:d,skipUpdateOnFirst:this.parent.viewport.topIndex+a===Dr(i,a,!0),frozenIndexes:o}),l&&(this.parent.viewport.leftIndex=h),this.parent.selectRange(i.selectedRange)}else this.parent.renderModule.refreshSheet(!1,!1,!0)}else{if(!1!==t.refreshSheet&&(!this.parent.scrollSettings.enableVirtualization||t.startIndex<=this.parent.viewport.rightIndex))if(this.parent.scrollSettings.enableVirtualization)if(t.startIndex<r(i.paneTopLeftCell)[1])this.parent.updateTopLeftCell(null,Dr(i,t.startIndex-1<s?s:t.startIndex-1,!0,"columns")-s,"row"),this.parent.renderModule.refreshSheet(!1,!1,!0);else if(t.freezePane||!0===t.refreshSheet)this.parent.renderModule.refreshSheet(!1,!1,!0);else{var p=this.parent.frozenRowCount(i),c=(o=[],this.parent.viewport.topIndex),u=p?r(i.topLeftCell)[0]:c;p&&(o=[p+c,s]),this.parent.renderModule.refreshUI({rowIndex:u,refresh:"Column",colIndex:this.parent.viewport.leftIndex,insertDelete:!0,skipUpdateOnFirst:this.parent.viewport.leftIndex+s===Dr(i,s,!0,"columns"),frozenIndexes:o}),p&&(this.parent.viewport.topIndex=c),this.parent.selectRange(i.selectedRange)}else this.parent.renderModule.refreshSheet(!1,!1,!0);delete t.refreshSheet}}this.refreshImgElement(t.deletedModel.length,this.parent.activeSheetIndex,t.modelType,t.startIndex),t.isAction?(delete t.isAction,this.parent.notify(ka,e),Fd(this.parent.element)):t.isUndoRedo||(t.isMethod=!0,this.parent.notify(G,e))},e.prototype.addEventListener=function(){this.parent.on(Ke,this.delete,this)},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off(Ke,this.delete)},e.prototype.getModuleName=function(){return"delete"},e.prototype.refreshImgElement=function(e,t,r,n){for(var i,a=this.parent.sheets[t],s=[0,0,a.usedRange.rowIndex,a.usedRange.colIndex],o=0;o<=s[2];o++)for(var l=s[1];l<=s[3];l++)(i=Ln(o,l,a))&&i.image&&i.image.length>0&&("Row"===r&&o>=n||"Column"===r&&l>=n)&&this.parent.notify(Es,{rowIdx:o,colIdx:l,sheetIdx:t,type:r,count:e,status:"delete"})},e}(),Ch=u(323),bh=u(741),xh=u(778),Sh=function(){function n(e){this.divElements=[],this.spanElements=[],this.inputElements=[],this.checkBoxElements=[],this.numericTextBoxElements=[],this.dropDownListElements=[],this.parent=e,this.addEventListener()}return n.prototype.destroy=function(){this.removeEventListener();var t={};if(!this.parent.isDestroyed&&!this.parent.refreshing){var n=r(this.parent.getActiveSheet().activeCell),i=this.parent.getCell(n[0],n[1]);i&&(t={rowIdx:n[0],colIdx:n[1],td:i,isRefresh:!0})}this.removeListDropdownHandler(this.parent.element.querySelector(".e-validation-list"),t);var a=(0,e.select)("#"+this.parent.element.id+"_datavalidation-popup");a&&a.remove(),this.typeData=[],this.operatorData=[],this.dataList&&(this.dataList=null),this.formObj&&(this.formObj.destroy(),this.formObj=null),this.parent=null},n.prototype.addEventListener=function(){e.Browser.isDevice&&"safari"===e.Browser.info.name&&(e.Browser.isIos||e.Browser.isIos7)?e.EventHandler.add(this.parent.element,"touchend",this.listOpen,this):e.EventHandler.add(this.parent.element,"dblclick",this.listOpen,this),this.parent.on(La,this.initiateDataValidationHandler,this),this.parent.on(Ba,this.invalidDataHandler,this),this.parent.on(Je,this.checkDataValidation,this),this.parent.on(ve,this.listHandler,this),this.parent.on(ii,this.keyUpHandler,this),this.parent.on(rs,this.removeValidationHandler,this),this.parent.on(jt,this.invalidElementHandler,this),this.parent.on(Wi,this.listValidationHeightHandler,this),this.parent.on(vr,this.addListValidationDropdownHandler,this)},n.prototype.removeEventListener=function(){e.Browser.isDevice&&"safari"===e.Browser.info.name&&(e.Browser.isIos||e.Browser.isIos7)?e.EventHandler.remove(this.parent.element,"touchend",this.listOpen):e.EventHandler.remove(this.parent.element,"dblclick",this.listOpen),this.parent.isDestroyed||(this.parent.off(La,this.initiateDataValidationHandler),this.parent.off(Ba,this.invalidDataHandler),this.parent.off(Je,this.checkDataValidation),this.parent.off(ve,this.listHandler),this.parent.off(ii,this.keyUpHandler),this.parent.off(rs,this.removeValidationHandler),this.parent.off(jt,this.invalidElementHandler),this.parent.off(Wi,this.listValidationHeightHandler),this.parent.off(vr,this.addListValidationDropdownHandler))},n.prototype.removeValidationHandler=function(e){var t,r,n={cancel:!1,isColSelected:e.isCol};if(e.range&&e.range.includes("!")){if(r=e.range,!(t=In(this.parent,vn(this.parent,r.substring(0,r.lastIndexOf("!"))))))return}else if(r=(t=this.parent.getActiveSheet()).name+"!",e.range)r+=e.range;else{var i=this.getRange(t.selectedRange);r+=i.range,n.isColSelected=i.isColSelected}n.range=r,e.isAction&&this.parent.notify(K,{eventArgs:n,action:"removeValidation"}),n.cancel||(this.parent.notify(Qe,{range:r,isRemoveValidation:!0,viewport:this.parent.viewport}),e.isAction&&(delete n.cancel,this.parent.notify(ka,{eventArgs:n,action:"removeValidation"})))},n.prototype.updateNoteIndicator=function(t,r,n){var i=t.querySelector(".e-addNoteIndicator");i&&((0,e.remove)(i),this.parent.notify(da,{targetElement:t,rowIndex:r,columnIndex:n,skipEvent:!0}))},n.prototype.keyUpHandler=function(t){var r=t.target,n=this.parent.element.querySelector(".e-datavalidation-dlg");if((0,e.closest)(r,".e-values")&&n&&13!==t.keyCode){var i=n.querySelector(".e-values"),a=i.querySelector(".e-dlg-error"),s=n.querySelector(".e-footer-content").querySelector(".e-primary");s.hasAttribute("disabled")&&s.removeAttribute("disabled"),a&&i.removeChild(a)}},n.prototype.listOpen=function(e){var t=e.target;this.listObj&&t.classList.contains("e-cell")&&t.querySelector(".e-validation-list")&&this.parent.isEdit&&this.listObj.showPopup()},n.prototype.invalidDataHandler=function(e){var t,r={range:e.range||this.parent.dataValidationRange,cancel:!1};r.range&&(!e.isPublic&&(t={eventArgs:r,action:e.isRemoveHighlight?"removeHighlight":"addHighlight"},this.parent.notify(K,t),r.cancel)||(e.isRemoveHighlight?this.parent.removeInvalidHighlight(r.range):this.parent.addInvalidHighlight(r.range),e.isPublic||this.parent.notify(ka,t)))},n.prototype.listHandler=function(){var e=this.parent.getActiveSheet(),t=r(e.activeCell),n=Ln(t[0],t[1],e),i=this.parent.getCell(t[0],t[1]);if(i){this.removeListDropdownHandler(this.parent.element.getElementsByClassName("e-validation-list")[0]);var a=n&&n.validation||e.columns&&e.columns[t[1]]&&e.columns[t[1]].validation;if(a&&"List"===a.type){if(a.address&&!Rr(a.address,t[0],t[1]))return;this.addListValidationDropdownHandler({cell:n,validation:a,td:i,rowIdx:t[0],colIdx:t[1]})}n&&n.validation&&(n.validation=a)}},n.prototype.removeListDropdownHandler=function(t,n){if(t)if(this.listObj&&this.listObj.destroy(),(0,e.remove)(t),n)n.isRefresh&&this.updateNoteIndicator(n.td,n.rowIdx,n.colIdx);else if(!(0,e.isNullOrUndefined)(this.parent.selectionModule.previousActiveCell)){var i=r(this.parent.selectionModule.previousActiveCell),a=this.parent.getCell(i[0],i[1]);a&&this.updateNoteIndicator(a,i[0],i[1])}},n.prototype.addListValidationDropdownHandler=function(t){var r=this,n=t.validation.inCellDropDown;if(t.isRefresh){if(!t.td&&(t.td=this.parent.getCell(t.rowIdx,t.colIdx),!t.td))return;if(this.removeListDropdownHandler(t.td.querySelector(".e-validation-list"),t),"List"!==t.validation.type)return;(0,e.isNullOrUndefined)(n)&&(n=!0)}else(0,e.isNullOrUndefined)(t.validation.ignoreBlank)&&(t.validation.ignoreBlank=!0),(0,e.isNullOrUndefined)(n)&&(n=t.validation.inCellDropDown=!0);if(n){var i,a=this.parent.createElement("div",{className:"e-validation-list"}),s=this.parent.createElement("input",{id:this.parent.element.id+"listValid"});a.appendChild(s);var o=t.td,l=o.getElementsByClassName("e-wrap-content")[0]||o;this.listValidationHeightHandler({ddlCont:a}),l.insertBefore(a,l.firstChild);var d=this.getListDataSource(t.validation);this.listObj=new xh.DropDownList({index:this.setDropDownListIndex(d,t.cell),dataSource:d,fields:{text:"text",value:"id"},width:"0px",popupHeight:"200px",change:function(){return r.listValueChange(r.listObj.text)},beforeOpen:function(){(i=window.browserDetails.isDevice)&&(window.browserDetails.isDevice=!1)},open:function(e){e.popup.offsetX=r.listObj.enableRtl?3:-o.offsetWidth+(r.parent.enableRtl?4:24),e.popup.offsetY=-(o.querySelector(".e-control-wrapper.e-ddl").offsetHeight-18),e.popup.element.style.width=o.offsetWidth-1+"px",i&&(window.browserDetails.isDevice=!0)},close:function(e){e.event&&(13===e.event.keyCode||e.event.altKey&&38===e.event.keyCode)&&(e.event.preventDefault(),e.event.stopPropagation()),Fd(r.parent.element)}}),this.listObj.appendTo(s),this.updateNoteIndicator(o,t.rowIdx,t.colIdx)}},n.prototype.listValidationHeightHandler=function(e){var t=this.parent.getActiveSheet(),n=r(t.activeCell),i=Ln(n[0],n[1],t),a=i&&i.validation||t.columns&&t.columns[n[1]]&&t.columns[n[1]].validation;if(a&&"List"===a.type&&a.inCellDropDown){var s=fl(t,n[0],!0)-Nd(n[0],n[1],t);if(s<=18)(o=e.ddlCont||this.parent.element.querySelector(".e-validation-list"))&&(o.style.height=s+"px");else if(!e.ddlCont){var o;(o=this.parent.element.querySelector(".e-validation-list"))&&o.style.removeProperty("height")}}},n.prototype.setDropDownListIndex=function(t,r){if(r&&!(0,e.isNullOrUndefined)(r.value))for(var n=r.value.toString(),i=rn(n),a=i&&(0,e.getNumericObject)(this.parent.locale),s=0,o=t.length;s<o;s++)if(t[s].text===n||i&&this.parseValidationValue(t[s].text,a).toString()===n)return s;return null},n.prototype.getListDataSource=function(e){var r=this,n=[],i=0,a=this.parent.definedNames,s=e.value1,o=s.startsWith("=");if(a.length>0&&o)for(var l=s.split("=")[1],d=0,h=a.length;d<h;d++)if(a[d].name===l){for(var p=a[d].refersTo;p.includes("'");)p=p.replace("'","");s=p}if(o){var c=void 0,u=void 0,f=void 0,g=s.lastIndexOf("!");g>-1?(f=s.substring(1,g),u=s.substring(g+1),f.startsWith("'")&&f.endsWith("'")&&(f=f.substring(1,f.length-1)),c=In(this.parent,vn(this.parent,f))):(c=this.parent.getActiveSheet(),u=s.substring(1));var m=this.parent.getActiveSheet();if(c){if(c.name!==m.name){var v,y=t(m.selectedRange);c.ranges.forEach((function(e){e.info&&e.info.loadedRange&&e.info.loadedRange.length||(v=!0)})),v&&(this.parent.showSpinner(),ln(this.parent,c.name+"!"+u).then((function(){if(r.parent.hideSpinner(),m.name===r.parent.getActiveSheet().name){var n=t(r.parent.getActiveSheet().selectedRange);if(n[0]===y[0]&&n[1]===y[1]){var i=r.getListDataSource(e);r.listObj.dataSource=i;var a=Ln(n[0],n[1],m);r.listObj.index=r.setDropDownListIndex(i,a),r.listObj.dataBind()}}})))}var C=void 0,b=u.split(":");if(b[0]&&b[1]&&(b[0].match(/[a-z]+$/gi)&&b[1].match(/[a-z]+$/gi)||b[0].match(/^[0-9]/g)&&b[1].match(/^[0-9]/g))){var x=this.parent.getIndexes(u);C=x.isCol?[0,x.startIdx,c.usedRange.rowIndex,x.startIdx]:[x.startIdx,0,x.startIdx,c.usedRange.colIndex]}else C=t(u);for(var S=void 0,w=C[0];w<=C[2];w++){c.rows[w]||pl(c,w,{});for(var I=C[1];I<=C[3];I++){c.rows[w].cells||Pn(w,I,c,{}),i+=1,S=c.rows[w].cells[I];var E=this.parent.getDisplayText(S)||"";n.push({text:E,id:"list-"+i})}}}}else{var N=this.getListOfValues(s);for(d=0;d<N.length;d++)i+=1,n.push({text:N[d],id:"list-"+i})}return n},n.prototype.listValueChange=function(e){var t=this.parent.getActiveSheet(),r=o(t.activeCell),n=Object.assign({},Ln(r[0],r[1],t));if(t.isProtected&&Ar(n,bl(t,r[1])))this.parent.notify(Xa,null);else if($r(n,bl(t,r[1]),hl(t,r[0])))this.parent.notify(Ka,null);else{this.parent.isEdit&&this.parent.closeEdit();var i={value:e,oldValue:n.value,address:t.name+"!"+t.activeCell,cancel:!1};if(this.parent.notify(K,{action:"cellSave",eventArgs:i}),i.cancel)return;if(!Hr(this.parent,t,{cell:{value:e,formula:""},rowIdx:r[0],colIdx:r[1],valChange:!0,lastCell:!0,uiRefresh:!0,checkCF:!0})){var a=Ln(r[0],r[1],t,!1,!0);delete a.formula,this.parent.notify(ri,{action:"refreshFormulabar",cell:a}),this.parent.notify(ka,{action:"cellSave",eventArgs:{value:e,oldValue:n.value,address:t.name+"!"+t.activeCell}})}}},n.prototype.getRange=function(e){var r,n=t(e),i=this.parent.getActiveSheet().rowCount;return n[2]===i-1&&0===n[0]&&(e=e.replace(/[0-9]/g,""),r=!0),{range:e,isColSelected:r}},n.prototype.initiateDataValidationHandler=function(r,n){var i,a,s,o,l=this,d=this.parent.serviceLocator.getService(kl),h=!0,p=!0,u=!0,f=!1,g=this.parent.getActiveSheet(),m=g.selectedRange,v=c(t(m));m=this.getRange(m).range;var y=this.validateRange(v,g);if(!y.extendValidation&&!y.moreValidation||r){for(var C=v[0];C<=v[2]&&!f;C++)if(g.rows[C])for(var b=v[1];b<=v[3];b++){if(g.rows[C].cells&&g.rows[C].cells[b])if((w=g.rows[C].cells[b].validation)&&(u=!1,i=w.type,a=w.operator,s=w.value1,o=w.value2,h=(0,e.isNullOrUndefined)(w.ignoreBlank)?h:w.ignoreBlank,p=(0,e.isNullOrUndefined)(w.inCellDropDown)?p:w.inCellDropDown,"Custom"===i)){f=!0;break}}if(u)for(var x=v[1];x<=v[3];x++){var S=bl(g,x),w=S&&S.validation;if(El(S,v[0],x)&&w){u=!1,i=w.type,a=w.operator,s=w.value1,o=w.value2,h=(0,e.isNullOrUndefined)(w.ignoreBlank)?h:w.ignoreBlank,p=(0,e.isNullOrUndefined)(w.inCellDropDown)?p:w.inCellDropDown;var I=t(g.selectedRange),E=[0,x,0,x],N=Ln(I[0],I[1],g,null,!0);w&&!N.validation&&(s=Pr(I,E,g,this.parent,{formula:s}),""!==o&&(o=Pr(I,E,g,this.parent,{formula:o})))}}if(!this.parent.element.querySelector(".e-datavalidation-dlg")){var R=this.parent.serviceLocator.getService(Al);R.show({width:375,showCloseIcon:!0,isModal:!0,cssClass:"e-datavalidation-dlg",header:d.getConstant("DataValidation"),beforeOpen:function(e){var t={dialogName:"ValidationDialog",element:e.element,target:e.target,cancel:e.cancel};l.parent.trigger("dialogBeforeOpen",t),t.cancel&&(e.cancel=!0),n&&(u=!0),R.dialogInstance.content=l.dataValidationContent(u,i,a,s,o,h,p,m),R.dialogInstance.dataBind(),Fd(l.parent.element)},beforeClose:this.dialogBeforeClose.bind(this),buttons:[{buttonModel:{content:d.getConstant("ClearAll"),cssClass:"e-btn e-clearall-btn e-flat"},click:function(){R.dialogInstance.content=l.dataValidationContent(!0,i,a,s,o,h,p,m),R.dialogInstance.dataBind()}},{buttonModel:{content:d.getConstant("Apply"),isPrimary:!0},click:function(){l.dlgClickHandler(R)}}]}),R.dialogInstance.refresh()}}else y.moreValidation&&this.moreValidationDlg(),y.extendValidation&&this.extendValidationDlg()},n.prototype.dataValidationContent=function(t,r,n,i,a,s,o,l){var d,h,p=this,c=this.parent.serviceLocator.getService(kl);if(t)d=h="0";else if("Date"===r||"Time"===r){var u=function(e){if(rn(e)){var t={cell:{value:e},type:r.toLowerCase(),value:e};return p.parent.notify(me,t),t.value}return e};d=u(i),h=u(a)}else{var f=function(t){if(rn(t)){t=t.toString();var r=(0,e.getNumericObject)(p.parent.locale);"."!==r.decimal&&t.includes(".")&&(t=t.replace(".",r.decimal))}return t};d=f(i),h=f(a)}var g=this.parent.createElement("div",{className:"e-validation-dlg"}),m=this.parent.createElement("div",{className:"e-cellrange"}),v=this.parent.createElement("div",{className:"e-allowdata"}),y=this.parent.createElement("div",{className:"e-values"}),C=this.parent.createElement("div",{className:"e-ignoreblank"});this.divElements.push(g),this.divElements.push(m),this.divElements.push(v),this.divElements.push(y),this.divElements.push(C),g.appendChild(m),g.appendChild(v),g.appendChild(y),g.appendChild(C);var b=this.parent.createElement("span",{className:"e-header"});b.innerText=c.getConstant("CellRange");var x=this.parent.createElement("input",{className:"e-input",attrs:{value:l,"aria-label":c.getConstant("CellRange")}});m.appendChild(b),m.appendChild(x);var S=this.parent.createElement("div",{className:"e-allow"}),w=this.parent.createElement("div",{className:"e-data"});v.appendChild(S),v.appendChild(w);var I=this.parent.createElement("span",{className:"e-header"});I.innerText=c.getConstant("Allow"),this.typeData=[{text:c.getConstant("WholeNumber"),id:"type-1"},{text:c.getConstant("Decimal"),id:"type-2"},{text:c.getConstant("Date"),id:"type-3"},{text:c.getConstant("Time"),id:"type-4"},{text:c.getConstant("TextLength"),id:"type-5"},{text:c.getConstant("List"),id:"type-6"},{text:c.getConstant("Custom"),id:"type-7"}],this.operatorData=[{text:c.getConstant("Between"),id:"operator-1"},{text:c.getConstant("NotBetween"),id:"operator-2"},{text:c.getConstant("EqualTo"),id:"operator-3"},{text:c.getConstant("NotEqualTo"),id:"operator-4"},{text:c.getConstant("GreaterThan"),id:"operator-5"},{text:c.getConstant("LessThan"),id:"operator-6"},{text:c.getConstant("GreaterThanOrEqualTo"),id:"operator-7"},{text:c.getConstant("LessThanOrEqualTo"),id:"operator-8"}];var E=this.parent.createElement("input",{className:"e-select"});this.spanElements.push(b),this.inputElements.push(x),this.divElements.push(S),this.divElements.push(w),this.spanElements.push(I),this.inputElements.push(E),r&&(r=this.formattedType(r));var N=0;if(!t)for(var R=0;R<this.typeData.length;R++)if(r===this.formattedType(this.typeData[R].text)){N=R;break}if(t||"List"!==r&&"Custom"!==r){var O=0,k=this.parent.createElement("span",{className:"e-header"});k.innerText=c.getConstant("Data");var A=this.parent.createElement("input",{className:"e-select"});if(!t)for(R=0;R<this.operatorData.length;R++)if(n===this.formattedValue(this.operatorData[R].text)){O=R;break}w.appendChild(k),w.appendChild(A),this.spanElements.push(k),this.inputElements.push(A),this.dataList=new xh.DropDownList({dataSource:this.operatorData,index:O,popupHeight:"200px",change:this.userInput.bind(this)}),this.dropDownListElements.push(this.dataList),this.dataList.appendTo(A)}else if("Custom"!==r){var F=this.parent.createElement("input",{className:"e-checkbox"});w.appendChild(F);var T=new bh.CheckBox({label:c.getConstant("InCellDropDown"),checked:o});this.checkBoxElements.push(T),T.appendTo(F),this.inputElements.push(F)}S.appendChild(I),S.appendChild(E),this.typeList=new xh.DropDownList({dataSource:this.typeData,index:N,popupHeight:"200px",change:this.userInput.bind(this)}),this.dropDownListElements.push(this.typeList),this.typeList.appendTo(E);var D=function(e,t){var r=p.parent.createElement("span",{className:"e-header"});r.innerText=e;var n=p.parent.createElement("input",{className:"e-input",attrs:{value:t}});y.appendChild(r),y.appendChild(n),p.spanElements.push(r),p.inputElements.push(n)};if(t||this.typeList.value!==c.getConstant("List")&&this.typeList.value!==c.getConstant("Custom")&&(this.dataList.value===c.getConstant("Between")||this.dataList.value===c.getConstant("NotBetween"))){var L=this.parent.createElement("div",{className:"e-minimum"}),P=this.parent.createElement("div",{className:"e-maximum"});y.appendChild(L),y.appendChild(P);var M=this.parent.createElement("span",{className:"e-header"});M.innerText=c.getConstant("Minimum");var B=this.parent.createElement("span",{className:"e-header"});B.innerText=c.getConstant("Maximum");var H=this.parent.createElement("input",{id:"minvalue",className:"e-input",attrs:{value:d,"aria-label":c.getConstant("Minimum")}}),U=this.parent.createElement("input",{id:"maxvalue",className:"e-input",attrs:{value:h,"aria-label":c.getConstant("Maximum")}});L.appendChild(M),L.appendChild(H),P.appendChild(B),P.appendChild(U),this.divElements.push(L),this.divElements.push(P),this.spanElements.push(M),this.spanElements.push(B),this.inputElements.push(H),this.inputElements.push(U);var V=new Ch.NumericTextBox({value:0});this.numericTextBoxElements.push(V),V.appendTo("#minvalue");var z=new Ch.NumericTextBox({value:0});this.numericTextBoxElements.push(z),z.appendTo("#maxvalue")}else D(t||"List"!==r?t||"Custom"!==r?c.getConstant("Value"):c.getConstant("Formula"):c.getConstant("Sources"),d);var _=s,j=this.parent.createElement("input",{className:"e-checkbox"});C.appendChild(j);var q=new bh.CheckBox({label:c.getConstant("IgnoreBlank"),checked:_});return this.checkBoxElements.push(q),q.appendTo(j),this.inputElements.push(j),g},n.prototype.dialogBeforeClose=function(){this.checkBoxElements.forEach((function(e){e&&e.element&&(e.destroy(),e.element.remove())})),this.checkBoxElements=[],this.numericTextBoxElements.forEach((function(e){e&&e.element&&(e.destroy(),e.element.remove())})),this.numericTextBoxElements=[],this.dropDownListElements.forEach((function(e){e&&e.element&&(e.destroy(),e.element.remove())})),this.dropDownListElements=[],qd(this.spanElements),this.spanElements=[],qd(this.inputElements),this.inputElements=[],qd(this.divElements),this.divElements=[]},n.prototype.validateRange=function(e,t){for(var r=!1,n=!1,i=0,a=[],s=[],o=[],l=[],d=e[0];d<=e[2];d++)if(t.rows[d])for(var h=e[1];h<=e[3];h++){if(t.rows[d].cells&&t.rows[d].cells[h])(C=t.rows[d].cells[h]).validation&&(a.push(C.validation.type),s.push(C.validation.operator),o.push(C.validation.value1),l.push(C.validation.value2))}for(var p=e[1];p<=e[3];p++){(b=bl(t,p))&&b.validation&&(b.validation.address||i++,a.push(b.validation.type),s.push(b.validation.operator),o.push(b.validation.value1),l.push(b.validation.value2))}var c=[];for(p=0;p<a.length;p++)-1===c.indexOf(a[p])&&c.push(a[p]);c.length>1&&(r=!0);var u=[];if(!r){u=[];for(var f=0;f<s.length;f++)-1===u.indexOf(s[f])&&u.push(s[f]);u.length>1&&(r=!0)}if(!r){u=[];for(f=0;f<o.length;f++)-1===u.indexOf(o[f])&&u.push(o[f]);u.length>1&&c&&"Custom"!==c[0]&&(r=!0)}if(!r){u=[];for(f=0;f<l.length;f++)-1===u.indexOf(l[f])&&u.push(l[f]);u.length>1&&(r=!0)}if(!r){for(var g=0,m=0,v=0===e[0]&&e[2]===t.rowCount-1&&e[1]===e[3],y=e[0];y<=e[2];y++)if(t.rows[y])for(h=e[1];h<=e[3];h++){var C;if(t.rows[y].cells&&t.rows[y].cells[h])m++,(C=t.rows[y].cells[h]).validation&&g++}if(0===g)for(p=e[1];p<=e[3];p++){var b;(b=bl(t,p))&&b.validation&&g++}v&&i?n=!1:g>0&&m>1&&g!==m&&(n=!0)}return{moreValidation:r,extendValidation:n}},n.prototype.moreValidationDlg=function(){var e=this,t=this.parent.serviceLocator.getService(kl),r=this.parent.serviceLocator.getService(Al),n=!1,i={width:350,isModal:!0,showCloseIcon:!0,cssClass:"e-goto-dlg",header:t.getConstant("Spreadsheet"),beforeOpen:function(n){var i={dialogName:"MoreValidation",element:n.element,target:n.target,cancel:n.cancel};e.parent.trigger("dialogBeforeOpen",i),i.cancel&&(n.cancel=!0),r.dialogInstance.content=t.getConstant("MoreValidation"),r.dialogInstance.dataBind(),Fd(e.parent.element)},buttons:[{buttonModel:{content:t.getConstant("Ok"),isPrimary:!0,cssClass:"e-btn-goto-ok"},click:function(){r.hide(),n=!0}}],close:function(){n?(e.initiateDataValidationHandler(!0),n=!1):r.hide()}};r.show(i)},n.prototype.extendValidationDlg=function(){var e=this,t=this.parent.serviceLocator.getService(kl),r=this.parent.serviceLocator.getService(Al),n=!1,i=!1,a={width:550,isModal:!0,showCloseIcon:!0,cssClass:"e-goto-dlg",header:t.getConstant("Spreadsheet"),beforeOpen:function(n){var i={dialogName:"ExtendValidation",element:n.element,target:n.target,cancel:n.cancel};e.parent.trigger("dialogBeforeOpen",i),i.cancel&&(n.cancel=!0),r.dialogInstance.content=t.getConstant("ExtendValidation"),r.dialogInstance.dataBind(),Fd(e.parent.element)},buttons:[{buttonModel:{content:t.getConstant("Yes"),isPrimary:!0,cssClass:"e-btn-goto-ok"},click:function(){r.hide(),n=!0}},{buttonModel:{content:t.getConstant("No"),isPrimary:!0,cssClass:"e-btn-goto-ok"},click:function(){r.hide(),n=!0,i=!0}}],close:function(){n?(e.initiateDataValidationHandler(!0,i),n=!1):r.hide()}};r.show(a)},n.prototype.userInput=function(){var e=this.typeList,t=this.dataList,r=this.parent.element.querySelector(".e-datavalidation-dlg").querySelector(".e-validation-dlg"),n=r.querySelector(".e-allowdata"),i=r.querySelector(".e-values"),a=(r.querySelector(".e-ignoreblank"),this.parent.serviceLocator.getService(kl)),s=n.querySelector(".e-data"),o=function(e){for(;e.lastChild;)e.removeChild(e.lastChild)};if(o(i),e.value===a.getConstant("List")){o(s);var l=this.parent.createElement("input",{className:"e-checkbox"});this.inputElements.push(l),s.appendChild(l);var d=new bh.CheckBox({label:a.getConstant("InCellDropDown"),checked:!0});this.checkBoxElements.push(d),d.appendTo(l)}else if(e.value===a.getConstant("Custom"))o(s);else if(!s.childElementCount||s.getElementsByClassName("e-checkbox-wrapper")[0]){o(s);var h=this.parent.createElement("span",{className:"e-header"});h.innerText=a.getConstant("Data");var p=this.parent.createElement("input",{className:"e-select"});this.spanElements.push(h),this.inputElements.push(p),s.appendChild(h),s.appendChild(p),t.appendTo(p)}if(e.value===a.getConstant("List")||e.value===a.getConstant("Custom")||t.value!==a.getConstant("Between")&&t.value!==a.getConstant("NotBetween")){var c=this.parent.createElement("span",{className:"e-header"});c.innerText=e.value===a.getConstant("List")?a.getConstant("Sources"):e.value===a.getConstant("Custom")?a.getConstant("Formula"):a.getConstant("Value");var u=e.value===a.getConstant("List")?this.parent.createElement("input",{className:"e-input",attrs:{placeholder:"Enter value"}}):this.parent.createElement("input",{className:"e-input",attrs:{value:"0"}});this.spanElements.push(c),this.inputElements.push(u),i.appendChild(c),i.appendChild(u)}else{var f=this.parent.createElement("div",{className:"e-minimum"}),g=this.parent.createElement("div",{className:"e-maximum"});this.divElements.push(f),this.divElements.push(g),i.appendChild(f),i.appendChild(g);var m=this.parent.createElement("span",{className:"e-header"});m.innerText=a.getConstant("Minimum");var v=this.parent.createElement("span",{className:"e-header"});v.innerText=a.getConstant("Maximum");var y=this.parent.createElement("input",{id:"min",className:"e-input",attrs:{value:"0"}}),C=this.parent.createElement("input",{id:"max",className:"e-input",attrs:{value:"0"}});this.spanElements.push(m),this.spanElements.push(v),this.inputElements.push(y),this.inputElements.push(C);var b=new Ch.NumericTextBox({value:0});this.numericTextBoxElements.push(b),b.appendTo("min");var x=new Ch.NumericTextBox({value:0});this.numericTextBoxElements.push(x),x.appendTo("max"),f.appendChild(m),f.appendChild(y),g.appendChild(v),g.appendChild(C)}},n.prototype.dlgClickHandler=function(t){var r,n=this,i=this.parent.serviceLocator.getService(kl),a=this.parent.element.querySelector(".e-datavalidation-dlg"),s=a.querySelector(".e-footer-content"),o=a.getElementsByClassName("e-dlg-content")[0].getElementsByClassName("e-validation-dlg")[0],l=o.getElementsByClassName("e-allowdata")[0],d=l.getElementsByClassName("e-allow")[0].getElementsByTagName("input")[0],h=l.getElementsByClassName("e-data")[0].getElementsByTagName("input")[0],p=o.getElementsByClassName("e-values")[0],c=[];c[0]=p.getElementsByTagName("input")[0].value,c[1]=p.getElementsByTagName("input")[1]?p.getElementsByTagName("input")[1].value:"";var u,f=this.formattedType(d.value),g=!0,m=o.querySelector(".e-ignoreblank .e-checkbox").checked,v=l.querySelector(".e-data").querySelector(".e-checkbox-wrapper")?!!l.querySelector(".e-data").querySelector(".e-checkbox-wrapper").querySelector(".e-check"):null,y=o.querySelector(".e-cellrange").getElementsByTagName("input")[0].value;h&&(u=this.formattedValue(h.value));var C=[];if("List"===f)if(""!==c[0]&&C.push(c[0]),c[0].startsWith("=")){var b=c[0].substring(1);if(b.includes(":")){var x=void 0;if(c[0].includes("!")){var S=b.substring(0,b.lastIndexOf("!"));b=b.substring(b.lastIndexOf("!")+1),S.startsWith("'")&&S.endsWith("'")&&(S=S.substring(1,S.length-1)),x=vn(this.parent,S)>-1,C[0]="="+S+"!"+b}else x=!0;var w=b.split(":"),I=b.match(/[a-z]/gi)&&w[0].replace(/[0-9]/g,"")===w[1].replace(/[0-9]/g,""),E=b.match(/\d/g)&&w[0].replace(/\D/g,"")===w[1].replace(/\D/g,"");(g=x&&(I||E))||(r=i.getConstant("DialogError"))}}else c[0].length>256&&(g=!1,r=i.getConstant("ListLengthError"));else{var N=(0,e.getNumericObject)(this.parent.locale);if("Decimal"===f&&"."!==N.decimal){var R=function(e){return rn(e)&&e.includes(".")&&("."!==N.group||!Cr(e,n.parent.locale,N.group,N.decimal))};(R(c[0])||R(c[1]))&&(g=!1,r=i.getConstant("InvalidNumberError"))}qr(c,this.parent,N),""!==c[0]&&C.push(c[0]),""!==c[1]&&C.push(c[1])}if(g){var O=this.parent.getActiveSheet(),k=this.isDialogValidator(C,f,u);if("Between"===u&&k.isValidate&&!isNaN(parseFloat(C[0]))&&!isNaN(parseFloat(C[1]))&&parseFloat(C[0])>parseFloat(C[1])&&(k.isValidate=!1,k.errorMsg=i.getConstant("MinMaxError")),"Custom"===f&&xr(C[0])){var A={value:C[0]};this.parent.notify(pr,A),["#N/A","#VALUE!","#REF!","#DIV/0!","#NUM!","#NAME?","#NULL!","#CALC!"].indexOf(A.value)>-1&&(k.isValidate=!1,k.errorMsg=i.getConstant("InvalidFormula"))}if(r=k.errorMsg,g=k.isValidate){var F={range:O.name+"!"+y,value1:C[0],value2:C[1]||"",ignoreBlank:m,type:f,operator:u,inCellDropDown:v,cancel:!1};this.parent.notify(K,{eventArgs:F,action:"validation"}),F.cancel||(this.parent.notify(Qe,{rules:{type:F.type,operator:F.operator,value1:F.value1,value2:F.value2,ignoreBlank:F.ignoreBlank,inCellDropDown:F.inCellDropDown},range:F.range}),delete F.cancel,this.parent.element.getElementsByClassName("e-validation-error-dlg")[0]||(t.dialogInstance?t.dialogInstance.hide():t.hide()),this.parent.notify(ka,{eventArgs:F,action:"validation"}))}}if(!g){var T=this.parent.createElement("div",{className:"e-dlg-error",id:"e-invalid"});T.innerText=r,p.appendChild(T),s.querySelector(".e-primary").setAttribute("disabled","true")}},n.prototype.formattedValue=function(e){var t=this.parent.serviceLocator.getService(kl);switch(e){case t.getConstant("Between"):e="Between";break;case t.getConstant("NotBetween"):e="NotBetween";break;case t.getConstant("EqualTo"):e="EqualTo";break;case t.getConstant("NotEqualTo"):e="NotEqualTo";break;case t.getConstant("GreaterThan"):e="GreaterThan";break;case t.getConstant("LessThan"):e="LessThan";break;case t.getConstant("GreaterThanOrEqualTo"):e="GreaterThanOrEqualTo";break;case t.getConstant("LessThanOrEqualTo"):e="LessThanOrEqualTo";break;default:e="Between"}return e},n.prototype.formattedType=function(e){var t=this.parent.serviceLocator.getService(kl);switch(e){case t.getConstant("WholeNumber"):e="WholeNumber";break;case t.getConstant("Decimal"):e="Decimal";break;case t.getConstant("Date"):e="Date";break;case t.getConstant("TextLength"):e="TextLength";break;case t.getConstant("List"):e="List";break;case t.getConstant("Time"):e="Time";break;case t.getConstant("Custom"):e="Custom"}return e},n.prototype.isDialogValidator=function(e,t,r){var n,i=this.parent.serviceLocator.getService(kl),a=0;if("List"===t?!(e.length>0):"Between"===r||"NotBetween"===r?2!==e.length:!(e.length>0))return{isValidate:!1,errorMsg:i.getConstant("EmptyError")};for(var s=void 0,o=0;o<e.length;o++){if(xr(e[o])){var l={value:e[o]};this.parent.notify(pr,l),s=l.value}else s="Date"===t||"Time"===t?e[o]=this.getDateAsNumber({range:[],cell:{value:e[o]}},e[o]):e[o];if(!(n=this.formatValidation(s,t,!0)).isValidate)break;a+=1}return n.isValidate=a===e.length,n},n.prototype.getDateAsNumber=function(e,t){var r={value:t,rowIndex:e.range[0],cell:e.cell,colIndex:e.range[1],sheetIndex:e.sheetIdx,updatedVal:""};return this.parent.notify(ue,r),r.updatedVal||t},n.prototype.getListOfValues=function(e){return","!==this.parent.listSeparator&&e.includes(this.parent.listSeparator)?e.split(this.parent.listSeparator):e.split(",")},n.prototype.isValidationHandler=function(t){var r,n,i=this.parent.serviceLocator.getService(kl);t.value=(0,e.isNullOrUndefined)(t.value)?"":t.value;var a,s=t.value.toString(),o=this.parent.sheets[t.sheetIdx],l=Ln(t.range[0],t.range[1],o,null,!0),d=bl(o,t.range[1]);if(l.validation?a=l.validation:El(d,t.range[0],t.range[1])&&(a=d.validation),a){var h=a.value1,p=a.value2;if(!l.validation){var c=t.range,u=[0,t.range[1],0,t.range[3]],f=Pr(c,u,o,this.parent,{formula:h});h=f,(0,e.isNullOrUndefined)(p)||""===p||(p=f=Pr(c,u,o,this.parent,{formula:p}))}if("List"!==a.type){if(xr(h)){var g={value:h};this.parent.notify(pr,g),h=g.value}if(xr(p)){var m={value:p};this.parent.notify(pr,m),p=m.value}if(xr(t.value)){var v={value:t.value};this.parent.notify(pr,v),t.value=v.value}}var y=t.value,C=a.operator||"Between",b=a.type||"WholeNumber",x=!!(0,e.isNullOrUndefined)(a.ignoreBlank)||a.ignoreBlank;if(x&&""===s)r=!0;else{var S="Date"===b||"Time"===b;if(t.value)if(S||"TextLength"===a.type)rn(t.value)||(y=t.value=this.getDateAsNumber(t,t.value));else{var w=t.isEdit&&(0,e.getNumericObject)(this.parent.locale);(F=this.parseValidationValue(t.value,w))!==t.value&&rn(F)&&(y=t.value=F.toString())}var I=this.formatValidation(t.value,b);if(r=I.isValidate,n=I.errorMsg,r)if(r=!1,S?(h&&!rn(h)&&(h=this.getDateAsNumber(t,h)),p&&!rn(p)&&(p=this.getDateAsNumber(t,p))):"TextLength"===a.type&&(y=t.value.toString().length.toString()),"List"===b){var E=t.value.toString(),N=rn(E);w=N&&(0,e.getNumericObject)(this.parent.locale);if(h.startsWith("=")){for(var R=void 0,O=this.getListDataSource(a),k=0;k<O.length;k++)if(s===(R=O[k].text.toString())||E===R||N&&E===this.parseValidationValue(R,w).toString()){r=!0;break}}else{var A=this.getListOfValues(h);for(k=0;k<A.length;k++)if(s===A[k]||E===A[k]||N&&E===this.parseValidationValue(A[k],w).toString()){r=!0;break}}!r&&x&&""===E&&(r=!0)}else if("Custom"===b){var F;if(rn(F=parseFloat(h.toString())))if(0===F){var T={value:a.value1};this.parent.notify(hr,T),r=""===T.value}else r=!0;else r="TRUE"===h.toUpperCase();!r&&x&&""===h&&(r=!0)}else switch("Decimal"===b||"Time"===b?(y=parseFloat(y.toString()),h=parseFloat(h.toString()),p=p?parseFloat(p.toString()):null):(y=parseInt(y.toString(),10),h=parseInt(h.toString(),10),p=p?parseInt(p.toString(),10):null),C){case"EqualTo":r=y===h||!(!x||""!==s);break;case"NotEqualTo":r=y!==h||!(!x||""!==s);break;case"Between":r=y>=h&&y<=p||!(!x||""!==s);break;case"NotBetween":r=!(y>=h&&y<=p);break;case"GreaterThan":r=y>h||!(!x||""!==s);break;case"LessThan":r=y<h||!(!x||""!==s);break;case"GreaterThanOrEqualTo":r=y>=h||!(!x||""!==s);break;case"LessThanOrEqualTo":r=y<=h||!(!x||""!==s)}}}if(n=i.getConstant("ValidationError"),r&&(l&&l.validation&&l.validation.isHighlighted||d&&d.validation&&d.validation.isHighlighted)){var D=this.parent.getCellStyleValue(["backgroundColor","color"],[t.range[0],t.range[1]]);cl(o,t.range[0])||this.parent.notify(le,{style:D,rowIdx:t.range[0],colIdx:t.range[1],isHeightCheckNeeded:!0,manualUpdate:!0,onActionUpdate:!0,td:t.td})}return{isValidate:r,errorMsg:n}},n.prototype.parseValidationValue=function(e,t){if(rn(e))return t&&"."===t.group&&(e=e.toString()).indexOf(".")&&Cr(e,this.parent.locale,t.group,t.decimal)&&(e=e.split(t.group).join("")),e;var r={formattedText:e,value:e,format:"General",cell:{value:e,format:"General"},isEdit:!!t};return this.parent.notify(re,r),r.value},n.prototype.checkDataValidation=function(e){var t=Ln(e.range[0],e.range[1],this.parent.getActiveSheet());e.td=e.td||this.parent.getCell(e.range[0],e.range[1]),e.sheetIdx=e.sheetIdx||this.parent.activeSheetIndex;var r={skip:!1,value:""};if(t&&t.validation){if(xr(t.validation.value1)&&!Sr(t.validation.value1.substring(1,t.validation.value1.length))&&t.validation.value1.indexOf("(")>-1){var n=t.validation.value1;n=n.substring(n.indexOf("=")+1,n.indexOf("(")),r.value=n.toUpperCase(),this.parent.notify(Oe,r)}if(!r.skip&&xr(t.validation.value2)&&!Sr(t.validation.value2.substring(1,t.validation.value2.length))&&t.validation.value1.indexOf("(")>-1){var i=t.validation.value2;i=i.substring(i.indexOf("=")+1,i.indexOf("(")),r.value=i.toUpperCase(),this.parent.notify(Oe,r)}}if(!r.skip){var a=this.isValidationHandler(e);!a.isValidate&&e.isEdit&&this.validationErrorHandler(a.errorMsg),e.isValid=a.isValidate}},n.prototype.formatValidation=function(e,t,r){var n,i,a=this.parent.element.getElementsByClassName("e-sheet-panel")[0],s=this.parent.createElement("form",{id:"formId",className:"form-horizontal"}),o=this.parent.createElement("input",{id:"e-validation"});if(o.setAttribute("name","validation"),o.setAttribute("type","text"),"Date"===t&&rn(e)){var l=e.toString().split(".");2===l.length&&(e=l[0])}switch(o.setAttribute("value",e),s.appendChild(o),a.appendChild(s),t){case"Date":i={rules:{validation:{date:!0}},customPlacement:function(e,t){n=t.innerText}};break;case"Decimal":i={rules:{validation:{number:!0}},customPlacement:function(e,t){n=t.innerText}};break;case"WholeNumber":i={rules:{validation:{regex:/^-?\d*\.?[0]*$/}},customPlacement:function(e,t){n=t.innerText}};break;case"TextLength":r&&(i={rules:{validation:{regex:/^\d*\.?[0]*$/}},customPlacement:function(e,t){n=t.innerText}})}this.formObj=new Ch.FormValidator("#formId",i);var d=this.formObj.validate();return a.removeChild(a.getElementsByClassName("form-horizontal")[0]),{isValidate:d,errorMsg:n}},n.prototype.invalidElementHandler=function(e){var t=e.rowIdx,r=e.colIdx,n=e.isRemoveHighlightedData;if(n){if(n){var i=this.parent.getCellStyleValue(["backgroundColor","color"],[t,r]);this.parent.notify(le,{style:i,rowIdx:t,colIdx:r,td:e.td})}}else this.parent.notify(le,{style:{backgroundColor:"#ffff00",color:"#ff0000"},rowIdx:t,colIdx:r,td:e.td})},n.prototype.validationErrorHandler=function(e){var t=this,r=this.parent.element.getElementsByClassName("e-spreadsheet-edit")[0],n=this.parent.serviceLocator.getService(kl);if(!this.parent.element.querySelector(".e-validation-error-dlg")){var i=this.parent.serviceLocator.getService(Al),a={width:400,height:200,isModal:!0,showCloseIcon:!0,cssClass:"e-validation-error-dlg",target:document.getElementById(this.parent.element.id)||this.parent.element,beforeOpen:function(n){var a={dialogName:"ValidationErrorDialog",element:n.element,target:n.target,cancel:n.cancel,content:e};t.parent.trigger("dialogBeforeOpen",a),a.cancel&&(t.errorDlgHandler(i,"Cancel"),n.cancel=!0),r.focus(),i.dialogInstance.content=a.content,i.dialogInstance.dataBind()},buttons:[{buttonModel:{content:n.getConstant("Retry"),isPrimary:!0},click:function(){t.errorDlgHandler(i,"Retry")}},{buttonModel:{content:n.getConstant("Cancel")},click:function(){t.errorDlgHandler(i,"Cancel")}}]};i.show(a,!1)}},n.prototype.errorDlgHandler=function(e,t){if("Retry"===t){var n=this.parent.element.getElementsByClassName("e-spreadsheet-edit")[0];e.hide(),n.innerText&&(window.getSelection().selectAllChildren(n),this.listObj&&!this.listObj.isDestroyed&&this.listObj.showPopup())}else{var i=r(this.parent.getActiveSheet().activeCell),a=Ln(i[0],i[1],this.parent.getActiveSheet()),s=a?this.parent.getDisplayText(a):"";this.parent.notify(ei,{action:"cancelEdit",value:s,refreshFormulaBar:!0,refreshEditorElem:!0,isAppend:!1,trigEvent:!0}),e.hide()}},n.prototype.getModuleName=function(){return"dataValidation"},n}(),wh=u(90),Ih=function(){function r(e){this.password="",this.parent=e,this.init()}return r.prototype.init=function(){this.addEventListener()},r.prototype.destroy=function(){this.removeEventListener(),this.parent=null},r.prototype.addEventListener=function(){this.parent.on(Va,this.protect,this),this.parent.on(Ua,this.protectSheetHandler,this),this.parent.on(Xa,this.editProtectedAlert,this),this.parent.on(Ms,this.protectWorkbook,this),this.parent.on(ii,this.KeyUpHandler,this),this.parent.on(Bs,this.unProtectWorkbook,this),this.parent.on(Js,this.unProtectSheetPassword,this),this.parent.on(Hs,this.getPassWord,this),this.parent.on(zs,this.importProtectWorkbook,this),this.parent.on(Us,this.protectWorkbookHandler,this),this.parent.on(Vs,this.removeWorkbookProtection,this),this.parent.on(ao,this.toggleProtect,this)},r.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(Va,this.protect),this.parent.off(Ua,this.protectSheetHandler),this.parent.off(Xa,this.editProtectedAlert),this.parent.off(Ms,this.protectWorkbook),this.parent.off(ii,this.KeyUpHandler),this.parent.off(Bs,this.unProtectWorkbook),this.parent.off(Js,this.unProtectSheetPassword),this.parent.off(Hs,this.getPassWord),this.parent.off(zs,this.importProtectWorkbook),this.parent.off(Us,this.protectWorkbookHandler),this.parent.off(Vs,this.removeWorkbookProtection),this.parent.off(ao,this.toggleProtect))},r.prototype.protect=function(e){if(e.isActive){var t=this.parent.getActiveSheet();t.isImportProtected&&(t.isImportProtected=!1)}this.parent.notify(Ai,null),e.isActive?(this.parent.setSheetPropertyOnMute(In(this.parent,e.sheetIndex),"isProtected",!1),this.parent.notify(ta,{props:"Protect"}),this.parent.notify(Ua,e),this.parent.notify(Ja,null)):this.createDialogue()},r.prototype.createDialogue=function(){var t=this,r=this.parent.serviceLocator.getService(kl),n=[{text:r.getConstant("SelectCells"),id:"1"},{text:r.getConstant("SelectUnlockedCells"),id:"6"},{text:r.getConstant("FormatCells"),id:"2"},{text:r.getConstant("FormatRows"),id:"3"},{text:r.getConstant("FormatColumns"),id:"4"},{text:r.getConstant("InsertLinks"),id:"5"}];this.optionList=new wh.ListView({width:"250px",dataSource:n,showCheckBox:!0,select:this.dialogOpen.bind(this)});var i=this.parent.createElement("div",{className:"e-sheet-password-dialog"}),a=this.parent.createElement("div",{className:"e-sheet-password-content"}),s=this.parent.createElement("div",{className:"e-header"});s.innerText=r.getConstant("SheetPassword");var o=this.parent.createElement("input",{className:"e-input e-text",attrs:{type:"password"}});o.setAttribute("placeholder",r.getConstant("EnterThePassword")),a.appendChild(o),a.insertBefore(s,o),i.appendChild(a);var l=this.parent.createElement("div",{className:"e-protect-content"});l.innerText=r.getConstant("ProtectAllowUser"),this.parent.setSheetPropertyOnMute(this.parent.getActiveSheet(),"isProtected",!1);var d=new bh.CheckBox({checked:!0,label:r.getConstant("ProtectContent"),cssClass:"e-protect-checkbox"}),h=this.parent.createElement("div",{className:"e-protect-option-list",id:this.parent.element.id+"_option_list"}),p=this.parent.createElement("div",{className:"e-header-content"});p.innerText=r.getConstant("ProtectSheet");var c=this.parent.createElement("input",{id:this.parent.element.id+"_protect_check",attrs:{type:"checkbox"}});this.dialog=this.parent.serviceLocator.getService("dialog"),this.dialog.show({header:p.outerHTML,content:i.outerHTML+c.outerHTML+l.outerHTML+h.outerHTML,showCloseIcon:!0,isModal:!0,cssClass:"e-protect-dlg",beforeOpen:function(e){var r={dialogName:"ProtectSheetDialog",element:e.element,target:e.target,cancel:e.cancel};t.parent.trigger("dialogBeforeOpen",r),r.cancel&&(e.cancel=!0),Fd(t.parent.element)},beforeClose:function(){e.EventHandler.remove(d.element,"click",t.checkBoxClickHandler)},buttons:[{click:this.selectOption.bind(this,this.dialog,this),buttonModel:{content:r.getConstant("Ok"),isPrimary:!0}},{click:function(){return t.dialog.hide()},buttonModel:{content:r.getConstant("Cancel")}}]},!1),this.protectSheetDialog=this.dialog.dialogInstance,d.appendTo("#"+this.parent.element.id+"_protect_check"),this.optionList.appendTo("#"+this.parent.element.id+"_option_list"),this.optionList.selectMultipleItems([{id:"1"},{id:"6"}]),e.EventHandler.add(d.element,"click",this.checkBoxClickHandler,this)},r.prototype.checkBoxClickHandler=function(){var t=(0,e.getInstance)(document.getElementById(this.parent.element.id+"_protect_check"),bh.CheckBox);this.dialog.dialogInstance.element.getElementsByClassName("e-footer-content")[0].querySelector("button").disabled=!t.checked},r.prototype.dialogOpen=function(e){var t=this.parent.serviceLocator.getService(kl);e.text===t.getConstant("SelectCells")&&e.isChecked&&e.isInteracted&&this.optionList.checkItem({id:"6"}),e.text===t.getConstant("SelectUnlockedCells")&&!e.isChecked&&e.isInteracted&&this.optionList.uncheckItem({id:"1"})},r.prototype.selectOption=function(){var e=this.parent.getActiveSheet(),r=this.parent.element.querySelector(".e-sheet-password-dialog").getElementsByClassName("e-sheet-password-content")[0].querySelector(".e-input");0===r.value.length?(this.parent.setSheetPropertyOnMute(e,"isProtected",!0),this.parent.setSheetPropertyOnMute(e,"password",r.value),this.updateProtectSheet(r.value),this.dialog.hide(),e.protectSettings.selectCells||e.protectSettings.selectUnLockedCells?e.protectSettings.selectUnLockedCells&&Td(this.parent,t(e.selectedRange))&&this.parent.notify(Zs,null):this.parent.notify(Zs,null)):this.reEnterSheetPassword()},r.prototype.selectSheetPassword=function(){var t=this.parent.serviceLocator.getService(kl),r=this.parent.getActiveSheet(),n=this.parent.element.querySelector(".e-sheet-password-dialog").getElementsByClassName("e-sheet-password-content")[0].querySelector(".e-input"),i=this.parent.element.querySelector(".e-reenterpwd-dialog").getElementsByClassName("e-reenterpwd-content")[0].querySelector(".e-input"),a=this.parent.createElement("span",{className:"e-reenterpwd-alert-span"});if(n.value===i.value){this.parent.setSheetPropertyOnMute(r,"isProtected",!0),this.parent.setSheetPropertyOnMute(r,"password",n.value),this.updateProtectSheet(n.value),this.dialog.hide(),this.protectSheetDialog&&(this.protectSheetDialog=null);var s=document.querySelector(".e-protect-dlg.e-dialog");(0,e.getComponent)(s,"dialog").destroy(),r.protectSettings.selectCells||r.protectSettings.selectUnLockedCells||this.parent.notify(Zs,null)}else""===n.value?a.textContent=t.getConstant("PasswordAlertMsg"):""===i.value?a.textContent=t.getConstant("ConfirmPasswordAlertMsg"):n.value!==i.value&&(a.textContent=t.getConstant("PasswordAlert")),this.parent.element.querySelector(".e-reenterpwd-dlg").querySelector(".e-reenterpwd-dialog").appendChild(a)},r.prototype.updateProtectSheet=function(e){var t=this.parent.serviceLocator.getService(kl),r=this.optionList.getSelectedItems(),n={selectCells:r.text.indexOf(t.getConstant("SelectCells"))>-1,formatCells:r.text.indexOf(t.getConstant("FormatCells"))>-1,formatRows:r.text.indexOf(t.getConstant("FormatRows"))>-1,formatColumns:r.text.indexOf(t.getConstant("FormatColumns"))>-1,insertLink:r.text.indexOf(t.getConstant("InsertLinks"))>-1,selectUnLockedCells:r.text.indexOf(t.getConstant("SelectUnlockedCells"))>-1};this.parent.notify(gt,{protectSettings:n,password:e,triggerEvent:!0}),this.parent.notify(Ja,null),this.parent.notify(ba,null)},r.prototype.protectSheetHandler=function(r){var n=(0,e.isNullOrUndefined)(r&&r.sheetIndex)?this.parent.activeSheetIndex:r.sheetIndex,i=In(this.parent,n),a=this.parent.element.id,s=[a+"_undo",a+"_redo",a+"_cut",a+"_copy",a+"_paste",a+"_number_format",a+"_font_name",a+"_font_size",a+"_bold",a+"_italic",a+"_line-through",a+"_underline",a+"_font_color_picker",a+"_fill_color_picker",a+"_borders",a+"_merge_cells",a+"_text_align",a+"_vertical_align",a+"_wrap",a+"_sorting",a+"_clear",a+"_conditionalformatting"],o=[a+"_cut",a+"_copy",a+"_number_format",a+"_font_name",a+"_font_size",a+"_bold",a+"_italic",a+"_line-through",a+"_underline",a+"_font_color_picker",a+"_fill_color_picker",a+"_borders",a+"_text_align",a+"_vertical_align",a+"_wrap",a+"_sorting",a+"_clear",a+"_conditionalformatting"],l=[a+"_insert_function"],d=[a+"_hyperlink",a+"_",a+"_chart"],h=[a+"_image"],p=[a+"_find"],c=[a+"_datavalidation"],u=[a+"_chart"],f=document.getElementById(this.parent.element.id+"_sheet_panel");f&&(i.isProtected&&(i.protectSettings.selectCells||i.protectSettings.selectUnLockedCells&&!Td(this.parent,t(i.selectedRange)))?f.classList.remove("e-protected"):f.classList.add("e-protected"),i.isProtected||f.classList.remove("e-protected")),this.parent.dataBind(),this.parent.notify(_a,{disableHomeBtnId:s,enableHomeBtnId:o,enableFrmlaBtnId:l,enableInsertBtnId:d,findBtnId:p,dataValidationBtnId:c,imageBtnId:h,chartBtnId:u}),this.parent.notify(Za,null),i.isProtected&&this.parent.notify(ta,{props:"Protect"}),r&&r.triggerEvent&&this.parent.notify(ka,{action:"protectSheet",eventArgs:{sheetIndex:n,isProtected:i.isProtected,password:i.password,protectSettings:i.protectSettings.properties||i.protectSettings}})},r.prototype.editProtectedAlert=function(){var e=this,t=this.parent.serviceLocator.getService(kl);this.dialog=this.parent.serviceLocator.getService("dialog"),this.dialog.show({content:t.getConstant("EditAlert"),isModal:!0,closeOnEscape:!0,showCloseIcon:!0,width:"400px",cssClass:"e-editAlert-dlg",beforeOpen:function(r){var n={dialogName:"EditAlertDialog",content:t.getConstant("EditAlert"),element:r.element,target:r.target,cancel:r.cancel};e.parent.trigger("dialogBeforeOpen",n),n.cancel&&(r.cancel=!0,Bl((function(){return e.dialog.destroyDialog()}))),e.dialog.dialogInstance.content=n.content,Fd(e.parent.element)},close:function(){return Fd(e.parent.element)}})},r.prototype.protectWorkbook=function(){var e=this,t=this.parent.serviceLocator.getService(kl),r=this.parent.serviceLocator.getService(Al);r.show({width:323,isModal:!0,showCloseIcon:!0,cssClass:"e-protectworkbook-dlg",header:t.getConstant("ProtectWorkbook"),beforeOpen:function(t){var n={dialogName:"ProtectWorkbook",element:t.element,target:t.target,cancel:t.cancel};e.parent.trigger("dialogBeforeOpen",n),n.cancel&&(t.cancel=!0),r.dialogInstance.content=e.passwordProtectContent(),r.dialogInstance.dataBind(),e.parent.element.focus()},buttons:[{buttonModel:{content:t.getConstant("Ok"),isPrimary:!0},click:function(){e.alertMessage(),e.dlgClickHandler(r)}}]})},r.prototype.passwordProtectContent=function(){var e=this.parent.serviceLocator.getService(kl),t=this.parent.createElement("div",{className:"e-password-dialog"}),r=this.parent.createElement("div",{className:"e-password-content"}),n=this.parent.createElement("div",{className:"e-password-content"}),i=this.parent.createElement("div",{className:"e-header"});i.innerText=e.getConstant("Password");var a=this.parent.createElement("div",{className:"e-header"});a.innerText=e.getConstant("ConfirmPassword");var s=this.parent.createElement("input",{className:"e-input e-text",attrs:{type:"password"}}),o=this.parent.createElement("input",{className:"e-input e-text",attrs:{type:"password"}});return s.setAttribute("placeholder",e.getConstant("EnterThePassword")),o.setAttribute("placeholder",e.getConstant("EnterTheConfirmPassword")),r.appendChild(s),r.insertBefore(i,s),n.appendChild(o),n.insertBefore(a,o),t.appendChild(n),t.insertBefore(r,n),t},r.prototype.KeyUpHandler=function(t){var r=t.target;if(r.classList.contains("e-text")&&(0,e.closest)(r,".e-password-content")&&(0,e.closest)(r,".e-password-dialog")&&(0,e.closest)(r,".e-password-dialog").getElementsByClassName("e-password-content")[1]===r.parentElement){var n=(0,e.closest)(r,".e-protectworkbook-dlg").getElementsByClassName("e-footer-content")[0].firstChild;""!==r.value?n.removeAttribute("disabled"):n.setAttribute("disabled","true")}if(r.classList.contains("e-text")&&(0,e.closest)(r,".e-unprotectpwd-content")&&(0,e.closest)(r,".e-unprotectpwd-dialog")&&(0,e.closest)(r,".e-unprotectpwd-dialog").getElementsByClassName("e-unprotectpwd-content")[0]===r.parentElement){var i=(0,e.closest)(r,".e-unprotectworkbook-dlg").getElementsByClassName("e-footer-content")[0].firstChild;""!==r.value?i.removeAttribute("disabled"):i.setAttribute("disabled","true")}if(r.classList.contains("e-text")&&(0,e.closest)(r,".e-reenterpwd-content")&&(0,e.closest)(r,".e-reenterpwd-dialog")&&(0,e.closest)(r,".e-reenterpwd-dialog").getElementsByClassName("e-reenterpwd-content")[0]===r.parentElement){var a=(0,e.closest)(r,".e-reenterpwd-dlg").getElementsByClassName("e-footer-content")[0].firstChild;""!==r.value?a.removeAttribute("disabled"):a.setAttribute("disabled","true")}if(r.classList.contains("e-text")&&(0,e.closest)(r,".e-unprotectsheetpwd-content")&&(0,e.closest)(r,".e-unprotectsheetpwd-dialog")&&(0,e.closest)(r,".e-unprotectsheetpwd-dialog").getElementsByClassName("e-unprotectsheetpwd-content")[0]===r.parentElement){var s=(0,e.closest)(r,".e-unprotectworksheet-dlg").getElementsByClassName("e-footer-content")[0].firstChild;""!==r.value?s.removeAttribute("disabled"):s.setAttribute("disabled","true")}if(r.classList.contains("e-text")&&(0,e.closest)(r,".e-importprotectpwd-content")&&(0,e.closest)(r,".e-importprotectpwd-dialog")&&(0,e.closest)(r,".e-importprotectpwd-dialog").getElementsByClassName("e-importprotectpwd-content")[0]===r.parentElement){s=(0,e.closest)(r,".e-importprotectworkbook-dlg").getElementsByClassName("e-footer-content")[0].firstChild;""!==r.value?s.removeAttribute("disabled"):s.setAttribute("disabled","true")}},r.prototype.alertMessage=function(){var e=this.parent.element.querySelector(".e-pwd-alert-span"),t=this.parent.element.querySelector(".e-unprotectpwd-alert-span"),r=this.parent.element.querySelector(".e-importprotectpwd-alert-span"),n=this.parent.element.querySelector(".e-reenterpwd-alert-span"),i=this.parent.element.querySelector(".e-unprotectsheetpwd-alert-span");e&&e.remove(),t&&t.remove(),r&&r.remove(),n&&n.remove(),i&&i.remove()},r.prototype.dlgClickHandler=function(e){var t=this.parent.serviceLocator.getService(kl),r=this.parent.element.querySelector(".e-password-dialog").getElementsByClassName("e-password-content")[0].querySelector(".e-input"),n=this.parent.element.querySelector(".e-password-dialog").getElementsByClassName("e-password-content")[1].querySelector(".e-input"),i=this.parent.createElement("span",{className:"e-pwd-alert-span"});r.value===n.value?(e.hide(),this.parent.notify(ta,{props:"Protectworkbook"}),this.protectWorkbookHandler({password:r.value}),this.parent.notify(ka,{action:"protectWorkbook",eventArgs:{isProtected:!0,password:r.value}})):""===r.value?i.textContent=t.getConstant("PasswordAlertMsg"):""===n.value?i.textContent=t.getConstant("ConfirmPasswordAlertMsg"):r.value!==n.value&&(i.textContent=t.getConstant("PasswordAlert")),e.dialogInstance&&this.parent.element.querySelector(".e-protectworkbook-dlg").querySelector(".e-dlg-content").appendChild(i)},r.prototype.protectWorkbookHandler=function(e){this.parent.password=e.password,this.parent.isProtected=!0,this.parent.showSheetTabs&&(this.parent.element.querySelector(".e-add-sheet-tab").setAttribute("disabled","true"),this.parent.element.querySelector(".e-add-sheet-tab").classList.add("e-disabled")),this.parent.notify(ta,{props:"Protectworkbook"})},r.prototype.unProtectWorkbook=function(){var e=this,t=this.parent.serviceLocator.getService(kl),r=this.parent.serviceLocator.getService(Al);r.show({width:323,isModal:!0,showCloseIcon:!0,cssClass:"e-unprotectworkbook-dlg",header:t.getConstant("UnprotectWorkbook"),beforeOpen:function(t){var n={dialogName:"UnprotectWorkbook",element:t.element,target:t.target,cancel:t.cancel};e.parent.trigger("dialogBeforeOpen",n),n.cancel&&(t.cancel=!0),r.dialogInstance.content=e.unProtectPasswordContent(),r.dialogInstance.dataBind(),e.parent.element.focus()},buttons:[{buttonModel:{content:t.getConstant("Ok"),isPrimary:!0,disabled:!0},click:function(){e.alertMessage(),e.unprotectdlgOkClick(r)}}]})},r.prototype.unProtectsheet=function(e){var t=this,r=this.parent.serviceLocator.getService(kl),n=this.parent.serviceLocator.getService(Al);n.show({width:323,isModal:!0,showCloseIcon:!0,cssClass:"e-unprotectworksheet-dlg",header:r.getConstant("UnprotectWorksheet"),beforeOpen:function(e){var r={dialogName:"UnProtectSheet",element:e.element,target:e.target,cancel:e.cancel};t.parent.trigger("dialogBeforeOpen",r),r.cancel&&(e.cancel=!0),n.dialogInstance.content=t.unProtectSheetPasswordContent(),n.dialogInstance.dataBind(),t.parent.element.focus()},buttons:[{buttonModel:{content:r.getConstant("Ok"),isPrimary:!0,disabled:!this.parent.allowOpen||!this.parent.openModule.isImportedFile||-1!==this.parent.openModule.unProtectSheetIdx.indexOf(this.parent.activeSheetIndex)},click:function(){t.alertMessage(),t.unprotectSheetdlgOkClick(n,e)}}]})},r.prototype.reEnterSheetPassword=function(){var e=this,t=this.parent.serviceLocator.getService(kl),r=this.parent.serviceLocator.getService(Al);r.show({width:323,isModal:!0,showCloseIcon:!0,cssClass:"e-reenterpwd-dlg",header:t.getConstant("ConfirmPassword"),beforeOpen:function(t){var n={dialogName:"Re-enterPassword",element:t.element,target:t.target,cancel:t.cancel};e.parent.trigger("dialogBeforeOpen",n),n.cancel&&(t.cancel=!0),r.dialogInstance.content=e.reEnterSheetPasswordContent(),r.dialogInstance.dataBind(),Fd(e.parent.element.querySelector(".e-protect-dlg.e-dialog .e-footer-content .e-btn")||e.parent.element)},close:function(){e.dialog.dialogInstance=e.protectSheetDialog},buttons:[{buttonModel:{content:t.getConstant("Ok"),isPrimary:!0,disabled:!0},click:function(){e.alertMessage(),e.selectSheetPassword()}}]})},r.prototype.unProtectPasswordContent=function(){var e=this.parent.serviceLocator.getService(kl),t=this.parent.createElement("div",{className:"e-unprotectpwd-dialog"}),r=this.parent.createElement("div",{className:"e-unprotectpwd-content"}),n=this.parent.createElement("div",{className:"e-header"});n.innerText=e.getConstant("EnterThePassword");var i=this.parent.createElement("input",{className:"e-input e-text",attrs:{type:"password"}});return r.appendChild(i),r.insertBefore(n,i),t.appendChild(r),t},r.prototype.reEnterSheetPasswordContent=function(){var e=this.parent.serviceLocator.getService(kl),t=this.parent.createElement("div",{className:"e-reenterpwd-dialog"}),r=this.parent.createElement("div",{className:"e-reenterpwd-content"}),n=this.parent.createElement("div",{className:"e-header"});n.innerText=e.getConstant("ReEnterPassword");var i=this.parent.createElement("input",{className:"e-input e-text",attrs:{type:"password"}});return r.appendChild(i),r.insertBefore(n,i),t.appendChild(r),t},r.prototype.unProtectSheetPasswordContent=function(){var e=this.parent.serviceLocator.getService(kl),t=this.parent.createElement("div",{className:"e-unprotectsheetpwd-dialog"}),r=this.parent.createElement("div",{className:"e-unprotectsheetpwd-content"}),n=this.parent.createElement("div",{className:"e-header"});n.innerText=e.getConstant("EnterThePassword");var i=this.parent.createElement("input",{className:"e-input e-text",attrs:{type:"password"}});return r.appendChild(i),r.insertBefore(n,i),t.appendChild(r),t},r.prototype.unprotectdlgOkClick=function(e){var t=this.parent.serviceLocator.getService(kl),r=this.parent.element.querySelector(".e-unprotectpwd-dialog").getElementsByClassName("e-unprotectpwd-content")[0].querySelector(".e-input");if(this.parent.password===r.value)e.hide(),this.removeWorkbookProtection(),this.parent.notify(ka,{action:"protectWorkbook",eventArgs:{isProtected:!1}});else{var n=this.parent.createElement("span",{className:"e-unprotectpwd-alert-span"});n.innerText=t.getConstant("UnprotectPasswordAlert"),this.parent.element.querySelector(".e-unprotectworkbook-dlg").querySelector(".e-dlg-content").appendChild(n)}},r.prototype.removeWorkbookProtection=function(){this.parent.password="",this.parent.isProtected=!1,this.parent.showSheetTabs&&(this.parent.element.querySelector(".e-add-sheet-tab").removeAttribute("disabled"),this.parent.element.querySelector(".e-add-sheet-tab").classList.remove("e-disabled"));var e=document.getElementById(this.parent.element.id+"_protectworkbook");e&&e.classList.remove("e-active"),this.parent.notify(ta,{props:"Protectworkbook"})},r.prototype.unprotectSheetdlgOkClick=function(e,t){var r=this.parent.serviceLocator.getService(kl),n=this.parent.getActiveSheet(),i=this.parent.element.querySelector(".e-unprotectsheetpwd-dialog").getElementsByClassName("e-unprotectsheetpwd-content")[0].querySelector(".e-input");if(t&&0===n.password.length){var a={sheetPassword:i.value,sheetIndex:this.parent.activeSheetIndex};this.parent.open(a)}else if(n.password===i.value)e.hide(),this.unProtectSheetPassword();else{var s=this.parent.createElement("span",{className:"e-unprotectsheetpwd-alert-span"});s.innerText=r.getConstant("UnprotectPasswordAlert"),this.parent.element.querySelector(".e-unprotectworksheet-dlg").querySelector(".e-dlg-content").appendChild(s)}},r.prototype.unProtectSheetPassword=function(){var e=this.parent.getActiveSheet(),t=this.parent.activeSheetIndex;this.parent.setSheetPropertyOnMute(e,"isProtected",!e.isProtected),this.parent.setSheetPropertyOnMute(e,"password","");var r=!e.isProtected;this.parent.notify(Va,{isActive:r,id:this.parent.element.id+"_protect",sheetIndex:t,triggerEvent:!0}),this.parent.allowOpen&&this.parent.openModule.isImportedFile&&-1===this.parent.openModule.unProtectSheetIdx.indexOf(t)&&this.parent.openModule.unProtectSheetIdx.push(t)},r.prototype.getPassWord=function(e){e.passWord=this.password},r.prototype.importProtectWorkbook=function(e){var t=this,r=this.parent.serviceLocator.getService(kl),n=this.parent.serviceLocator.getService(Al);n.show({width:323,isModal:!0,showCloseIcon:!0,cssClass:"e-importprotectworkbook-dlg",header:r.getConstant("UnprotectWorkbook"),beforeOpen:function(r){var i={dialogName:"ImportProtectWorkbook",element:r.element,target:r.target,cancel:r.cancel};t.parent.trigger("dialogBeforeOpen",i),i.cancel&&(r.cancel=!0),n.dialogInstance.content=t.importProtectPasswordContent(e),n.dialogInstance.dataBind(),t.parent.element.focus()},buttons:[{buttonModel:{content:r.getConstant("Ok"),isPrimary:!0,disabled:!0},click:function(){t.alertMessage(),t.importOkClick(e)}}]})},r.prototype.importProtectPasswordContent=function(e){var t=this.parent.serviceLocator.getService(kl),r=this.parent.createElement("div",{className:"e-importprotectpwd-dialog"}),n=this.parent.createElement("div",{className:"e-importprotectpwd-content"}),i=this.parent.createElement("span",{className:"e-header"});i.innerText='"'+e.file.name+'" '+t.getConstant("IsProtected");var a=this.parent.createElement("input",{className:"e-input e-text",attrs:{type:"password"}});return a.setAttribute("placeholder",t.getConstant("EnterThePassword")),n.appendChild(i),n.appendChild(a),r.appendChild(n),r},r.prototype.importOkClick=function(e){var t=this.parent.element.querySelector(".e-importprotectpwd-dialog").getElementsByClassName("e-importprotectpwd-content")[0].querySelector(".e-input");this.parent.password=t.value;var r={file:e.file,password:t.value};this.parent.open(r)},r.prototype.toggleProtect=function(){var e,t=this.parent.element.id,r=this.parent.getActiveSheet();r.isProtected&&this.parent.allowOpen&&r.isImportProtected&&this.parent.openModule.isImportedFile&&-1===this.parent.openModule.unProtectSheetIdx.indexOf(this.parent.activeSheetIndex)?this.unProtectsheet(!0):r.password&&r.password.length>0?this.unProtectsheet():(this.parent.setSheetPropertyOnMute(r,"isProtected",!r.isProtected),e=!r.isProtected,this.parent.notify(Va,{isActive:e,id:t+"_protect",sheetIndex:this.parent.activeSheetIndex,triggerEvent:!0}))},r.prototype.getModuleName=function(){return"protectSheet"},r}(),Eh=function(){function r(e){this.shortValue="",this.divElements=[],this.paraElements=[],this.inputElements=[],this.textBoxElements=[],this.dropDownListElements=[],this.parent=e,this.addEventListener()}return r.prototype.addEventListener=function(){this.parent.on(qa,this.renderFindDlg,this),this.parent.on(ja,this.renderGotoDlg,this),this.parent.on(nt,this.gotoHandler,this),this.parent.on(Wa,this.findHandler,this),this.parent.on(ot,this.showFindAlert,this),this.parent.on(mt,this.replaceAllDialog,this),this.parent.on(lt,this.findKeyUp,this),this.parent.on(Z,this.findToolDlg,this),this.parent.on(Ki,this.refreshFindDlg,this)},r.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(qa,this.renderFindDlg),this.parent.off(ja,this.renderGotoDlg),this.parent.off(nt,this.gotoHandler),this.parent.off(Wa,this.findHandler),this.parent.off(ot,this.showFindAlert),this.parent.off(mt,this.replaceAllDialog),this.parent.off(lt,this.findKeyUp),this.parent.off(Z,this.findToolDlg),this.parent.off(Ki,this.refreshFindDlg))},r.prototype.findToolDlg=function(t){var r=this,n=function(n){var i=r.parent.showRibbon&&r.parent.element.querySelector(".e-ribbon");if(i){var a=t.event&&t.event.target?(0,e.closest)(t.event.target,"#"+r.parent.element.id+"_findbtn"):(0,e.select)("#"+r.parent.element.id+"_findbtn",i);a&&(n?a.classList.add("e-disabled"):a.classList.remove("e-disabled"),a.disabled=n)}},i=t.dialogEle||this.parent.element.getElementsByClassName("e-findtool-dlg")[0];t.isPublic&&(this.findValue=t.findValue);var a,s,o,l=this.parent.getActiveSheet(),d=function(e){if(s&&(!l.isProtected||l.protectSettings.selectCells||l.protectSettings.selectUnLockedCells)){var t=s.value;if(e&&13===e.keyCode)s.value&&"0 of 0"!==o.textContent&&(r.parent.notify(Wa,{findOption:e.shiftKey?"prev":"next"}),r.updateCount(o,e.shiftKey));else{var n=void 0;if(""===t)o.textContent="0 of 0",n=!1;else{var i={value:t,mode:"Sheet",isCSen:!1,sheetIndex:r.parent.activeSheetIndex,isEMatch:!1,searchBy:"By Row"};r.parent.notify(pt,i),o.textContent=i.findCount,n="0 of 0"!==i.findCount}a.enableItems(1,n),a.enableItems(2,n)}}};if(i)if(t.isPublic||t.refreshPosition){if(t.isPublic&&((s=i.querySelector(".e-text-findNext-short")).value=this.findValue,o=i.querySelector(".e-input-group-icon"),a=(0,e.getComponent)(i.querySelector(".e-find-toolbar"),"toolbar"),d()),t.refreshPosition){var h=void 0;if(this.parent.getActiveSheet().showHeaders){var p=this.parent.getColumnHeaderContent().parentElement;h=(p&&p.offsetHeight||30)+1}else h=1;i.style.top=h+"px"}}else n(!0),this.findDialog.hide();else{var c=this.parent.createElement("div",{className:"e-input-group"});s=this.parent.createElement("input",{className:"e-input e-text-findNext-short",attrs:{type:"Text"}}),this.findValue&&(s.value=this.findValue);var u,f=this.parent.serviceLocator.getService(kl);s.setAttribute("placeholder",f.getConstant("FindValue")),o=this.parent.createElement("span",{className:"e-input-group-icon"});var g=l.usedRange.rowIndex*l.usedRange.colIndex>100;s.onkeyup=function(e){g?(u&&clearTimeout(u),u=setTimeout(d.bind(r,e),500)):d(e)},c.appendChild(s),c.appendChild(o);var m=[{type:"Input",template:c},{prefixIcon:"e-icons e-prev-icon",tooltipText:f.getConstant("FindPreviousBtn"),type:"Button",cssClass:"e-findRib-prev",disabled:!0},{prefixIcon:"e-icons e-next-icon",tooltipText:f.getConstant("FindNextBtn"),type:"Button",cssClass:"e-findRib-next",disabled:!0},{type:"Separator"},{prefixIcon:"e-icons e-option-icon",tooltipText:f.getConstant("MoreOptions"),type:"Button",cssClass:"e-findRib-more"},{prefixIcon:"e-icons e-close",tooltipText:f.getConstant("Close"),type:"Button",cssClass:"e-findRib-close"}];a=new ch.Toolbar({clicked:function(e){"e-findRib-next"===e.item.cssClass?(r.parent.notify(Wa,{findOption:"next"}),r.updateCount(o)):"e-findRib-prev"===e.item.cssClass?(r.parent.notify(Wa,{findOption:"prev"}),r.updateCount(o,!0)):"e-findRib-more"===e.item.cssClass&&(r.findDialog.animationSettings.effect="None",r.findDialog.setProperties({animationSettings:r.findDialog.animationSettings},!0),r.renderFindDlg(),r.findDialog.hide())},width:"auto",height:"auto",items:m,cssClass:"e-find-toolObj",created:function(){a.element.querySelectorAll(".e-toolbar-item .e-tbar-btn").forEach((function(e){return e.removeAttribute("tabindex")}))}});var v=this.parent.createElement("div",{className:"e-find-toolbar",attrs:{tabindex:"-1"}});a.createElement=this.parent.createElement,a.appendTo(v),i=this.parent.createElement("div",{className:"e-dlg-div",attrs:{"aria-label":f.getConstant("FindValue")}});var y,C=this.parent.element.getElementsByClassName("e-sheet-panel")[0],b={cssClass:"e-findtool-dlg",visible:!1,enableRtl:this.parent.enableRtl,target:C,open:function(){if(e.EventHandler.add(document,"click",r.closeDialog,r),r.findValue&&(!l.isProtected||l.protectSettings.selectCells||l.protectSettings.selectUnLockedCells)){var t={value:r.findValue,mode:"Sheet",isCSen:!1,sheetIndex:r.parent.activeSheetIndex,isEMatch:!1,searchBy:"By Row"};r.parent.notify(pt,t),o.textContent=t.findCount;var i="0 of 0"!==t.findCount;a.enableItems(1,i),a.enableItems(2,i)}else o.textContent="0 of 0";n(!1);var s=a.element.querySelector(".e-input-group");s&&s.addEventListener("focus",(function(){var e=a.element.querySelector(".e-text-findNext-short");Fd(e),e.classList.add("e-input-focus"),e.setSelectionRange(0,e.value.length)})),y&&r.findDialog.setProperties({animationSettings:y},!0)},beforeOpen:function(){return Fd(r.parent.element)},beforeClose:function(){r.findValue=s.value||null,a.destroy(),e.EventHandler.remove(document,"click",r.closeDialog)},close:function(){r.findDialog.destroy(),r.findDialog=null,(0,e.detach)(i),C.style.position="",Fd(r.parent.element),n(!1)},created:function(){C.style.position="relative",i.style.width=r.parent.getMainContent().offsetWidth+"px",i.style.visibility="hidden",i.style.display="block",r.findDialog.width=2*parseInt(getComputedStyle(i).borderLeftWidth,10)+i.querySelector(".e-toolbar-items").getBoundingClientRect().width+"px",i.style.display="",i.style.width="",i.style.visibility="",i.style.top=(t&&t.headerHgt||r.parent.getColumnHeaderContent().parentElement.offsetHeight+1)+"px",i.style.left="",i.style[r.parent.enableRtl?"left":"right"]=r.parent.sheetModule.getScrollSize()+"px",r.findDialog.show()}};e.Browser.isDevice?(b.header=v,b.allowDragging=!0):b.content=v,this.findDialog=new dh.Dialog(b),this.findDialog.createElement=this.parent.createElement,t&&t.isPublic&&(y={effect:this.findDialog.animationSettings.effect},this.findDialog.setProperties({animationSettings:{effect:"None"}},!0)),this.findDialog.appendTo(i)}},r.prototype.refreshFindDlg=function(){var e=this.findDialog&&this.parent.element.getElementsByClassName("e-findtool-dlg")[0];if(e){var t=e.querySelector(".e-text-findNext-short");this.findToolDlg({findValue:t.value,isPublic:!0,refreshPosition:!0,dialogEle:e})}},r.prototype.updateCount=function(e,t){var r,n=e.textContent.split(" ");t?(r=Number(n[0])-1)<1&&(r=Number(n[2])):(r=Number(n[0])+1)>Number(n[2])&&(r=1),n[0]=r.toString(),e.textContent=n.join(" ")},r.prototype.closeDialog=function(t){!(0,e.closest)(t.target,".e-findRib-close")&&(0,e.closest)(t.target,".e-spreadsheet")||!this.findDialog||this.findToolDlg({})},r.prototype.renderFindDlg=function(){var t=this,r=this.parent.serviceLocator.getService(Al);if(this.parent.element.querySelector(".e-find-dlg"))r.hide();else{var n=this.parent.serviceLocator.getService(kl),i={isModal:!1,showCloseIcon:!0,cssClass:"e-find-dlg",header:n.getConstant("FindAndReplace"),beforeOpen:function(e){var n={dialogName:"FindAndReplaceDialog",element:e.element,target:e.target,cancel:e.cancel};t.parent.trigger("dialogBeforeOpen",n),n.cancel?e.cancel=!0:(r.dialogInstance.content=t.findandreplaceContent(),r.dialogInstance.dataBind()),Fd(t.parent.element)},buttons:[{buttonModel:{content:n.getConstant("FindPreviousBtn"),isPrimary:!0,cssClass:"e-btn-findPrevious",disabled:!0},click:function(e){t.dialogMessage(),t.findHandler({findOption:e&&13===e.keyCode?"next":"prev"})}},{buttonModel:{content:n.getConstant("FindNextBtn"),isPrimary:!0,cssClass:"e-btn-findNext",disabled:!0},click:function(){t.dialogMessage(),t.findHandler({findOption:"next"})}},{buttonModel:{content:n.getConstant("ReplaceBtn"),isPrimary:!0,cssClass:"e-btn-replace",disabled:!0},click:function(){t.dialogMessage(),t.replaceHandler(at)}},{buttonModel:{content:n.getConstant("ReplaceAllBtn"),isPrimary:!0,cssClass:"e-btn-replaceAll",disabled:!0},click:function(){t.dialogMessage(),t.replaceHandler(st)}}],open:function(){var r=t.parent.element.querySelector(".e-text-findNext");if(r.value){var n=t.parent.element.querySelector(".e-btn-findPrevious");(0,e.getComponent)(n,"btn").disabled=!1,(0,e.getComponent)(t.parent.element.querySelector(".e-btn-findNext"),"btn").disabled=!1}Bl((function(){Fd(r)}))},beforeClose:this.dialogBeforeClose.bind(this),close:function(){return r.hide()}};r.show(i)}},r.prototype.dialogBeforeClose=function(){var e=this.checkBoxElements;e&&e.element&&(e.destroy(),e.element.remove()),this.checkBoxElements=null,this.textBoxElements.forEach((function(e){e&&e.element&&(e.destroy(),e.element.remove())})),this.textBoxElements=[],this.dropDownListElements.forEach((function(e){e&&e.element&&(e.destroy(),e.element.remove())})),this.dropDownListElements=[],qd(this.paraElements),this.paraElements=[],qd(this.inputElements),this.inputElements=[],qd(this.divElements),this.divElements=[]},r.prototype.dialogMessage=function(){this.parent.element.querySelector(".e-replace-alert-span")?this.parent.element.querySelector(".e-replace-alert-span").remove():this.parent.element.querySelector(".e-find-alert-span")&&this.parent.element.querySelector(".e-find-alert-span").remove()},r.prototype.renderGotoDlg=function(){var t=this,r=this.parent.serviceLocator.getService(kl),n=this.parent.serviceLocator.getService(Al);if((0,e.isNullOrUndefined)(this.parent.element.querySelector(".e-goto-dlg"))){var i={width:300,isModal:!1,showCloseIcon:!0,cssClass:"e-goto-dlg",header:r.getConstant("GotoHeader"),beforeOpen:function(e){var r={dialogName:"GoToDialog",element:e.element,target:e.target,cancel:e.cancel};t.parent.trigger("dialogBeforeOpen",r),r.cancel?e.cancel=!0:(n.dialogInstance.content=t.GotoContent(),n.dialogInstance.dataBind()),Fd(t.parent.element)},buttons:[{buttonModel:{content:r.getConstant("Ok"),isPrimary:!0,cssClass:"e-btn-goto-ok"},click:function(){t.gotoHandler()&&n.hide()}}],open:function(){t.textFocus()}};n.show(i,!1)}else n.hide()},r.prototype.textFocus=function(){var e=this;this.parent.element.querySelector(".e-text-goto").addEventListener("focus",(function(){e.parent.element.querySelector(".e-goto-alert-span")&&e.parent.element.querySelector(".e-goto-alert-span").remove()}))},r.prototype.findHandler=function(t){var r=this.parent.element.querySelector(".e-text-findNext");r||(r=this.parent.element.querySelector(".e-text-findNext-short"))||this.gotoAlert();var n=r.value;if(""!==r.value){var i=this.parent.getActiveSheet();if(i.isProtected&&!i.protectSettings.selectCells&&!i.protectSettings.selectUnLockedCells)return;var a=this.parent.activeSheetIndex,s=this.parent.element.querySelector(".e-findnreplace-checkcase"),o=void 0;if(s)o=(0,e.getComponent)(s,"checkbox").checked;else o=!1;var l=this.parent.element.querySelector(".e-findnreplace-checkmatch"),d=void 0;if(l)d=(0,e.getComponent)(l,"checkbox").checked;else d=!1;var h=this.parent.element.querySelector(".e-findnreplace-searchby"),p=void 0;if(h)p=(0,e.getComponent)(h,"dropdownlist").value.toString();else p="By Row";var c=this.parent.element.querySelector(".e-findnreplace-searchwithin"),u=void 0;if(c)u=(0,e.getComponent)(c,"dropdownlist").value.toString();else u="Sheet";var f={value:n,sheetIndex:a,findOpt:t.findOption,mode:u,isCSen:o,isEMatch:d,searchBy:p,isAction:!0};this.parent.find(f)}},r.prototype.replaceHandler=function(e){var t=this.parent.element.querySelector(".e-find-dlg").querySelector(".e-text-findNext").value,r=this.parent.element.querySelector(".e-text-replaceInp").value,n=this.parent.element.querySelector(".e-findnreplace-checkcase").checked,i=this.parent.element.querySelector(".e-findnreplace-checkmatch").checked,a=this.parent.element.querySelector(".e-search-within .e-ddl-hidden").value,s=this.parent.element.querySelector(".e-searchby .e-ddl-hidden").value;this.parent.notify(e,{value:t,mode:a,isCSen:n,isEMatch:i,searchBy:s,findOpt:"next",replaceValue:r,replaceBy:e,sheetIndex:this.parent.activeSheetIndex,isAction:!0})},r.prototype.gotoHandler=function(e){var r=!0;if(e)this.parent.goTo(e.address);else{for(var n=this.parent.element.querySelector(".e-text-goto").value,i=0;i<this.parent.definedNames.length;i++)if(this.parent.definedNames[i].name===n){n=this.parent.definedNames[i].refersTo.slice(1);break}var a=n;n.includes("!")&&(a=n.substring(n.lastIndexOf("!")+1)),(a=a.split("$").join("")).includes(":")&&(a=a.split(":")[0]);var s=a.match(/\d+/),o=a.match(/[A-Z]+/i);if(s&&o&&0===o.index){var l=c(t(a));l[2]>=1048576||l[3]>=16384?(this.gotoAlert(),r=!1):this.parent.goTo(n)}else this.gotoAlert(),r=!1}return r},r.prototype.gotoAlert=function(){var e=this.parent.serviceLocator.getService(kl),t=this.parent.createElement("span",{className:"e-goto-alert-span"});t.innerText=e.getConstant("InsertingEmptyValue"),this.parent.element.querySelector(".e-goto-alert-span")&&this.parent.element.querySelector(".e-goto-alert-span").remove(),this.parent.element.querySelector(".e-goto-dlg").querySelector(".e-dlg-content").appendChild(t)},r.prototype.showFindAlert=function(){this.parent.element.querySelector(".e-replace-alert-span")&&this.parent.element.querySelector(".e-replace-alert-span").remove();var e=this.parent.element.querySelector(".e-find-dlg .e-dlg-content");if(e){var t=this.parent.createElement("span",{className:"e-find-alert-span"});t.innerText=this.parent.serviceLocator.getService(kl).getConstant("NoElements"),e.appendChild(t)}},r.prototype.replaceAllDialog=function(e){this.parent.element.querySelector(".e-find-alert-span")&&this.parent.element.querySelector(".e-find-alert-span").remove();var t=this.parent.serviceLocator.getService(kl),r=this.parent.createElement("span",{className:"e-replace-alert-span"});r.innerText=e.count+t.getConstant("ReplaceAllEnd")+e.replaceValue,this.parent.element.querySelector(".e-find-dlg")&&this.parent.element.querySelector(".e-find-dlg").querySelector(".e-dlg-content").appendChild(r)},r.prototype.findKeyUp=function(t){if(t.target.classList.contains("e-text-findNext")){var r=this.parent.element.querySelector(".e-text-findNext").value;if((0,e.isNullOrUndefined)(r)||""===r)(0,e.getComponent)(this.parent.element.querySelector(".e-btn-findPrevious"),"btn").disabled=!0,(0,e.getComponent)(this.parent.element.querySelector(".e-btn-findNext"),"btn").disabled=!0,this.dialogMessage();else{var n=this.parent.element.querySelector(".e-btn-findPrevious");(0,e.getComponent)(n,"btn").disabled=!1,(0,e.getComponent)(this.parent.element.querySelector(".e-btn-findNext"),"btn").disabled=!1}}var i=this.parent.element.querySelector(".e-text-findNext").value,a=this.parent.element.querySelector(".e-text-replaceInp").value;(0,e.isNullOrUndefined)(i)||(0,e.isNullOrUndefined)(a)||""===i||""===a?((0,e.getComponent)(this.parent.element.querySelector(".e-btn-replace"),"btn").disabled=!0,(0,e.getComponent)(this.parent.element.querySelector(".e-btn-replaceAll"),"btn").disabled=!0):this.parent.getActiveSheet().isProtected||((0,e.getComponent)(this.parent.element.querySelector(".e-btn-replace"),"btn").disabled=!1,(0,e.getComponent)(this.parent.element.querySelector(".e-btn-replaceAll"),"btn").disabled=!1)},r.prototype.findandreplaceContent=function(){this.parent.element.querySelector(".e-text-findNext-short")&&(this.shortValue=this.parent.element.querySelector(".e-text-findNext-short").value);var e=this.parent.createElement("div",{className:"e-link-dialog"}),t=this.parent.createElement("div",{className:"e-find"}),r=this.parent.createElement("div",{className:"e-findCheck"});this.divElements.push(e),this.divElements.push(t),this.divElements.push(r);var n=this.parent.serviceLocator.getService(kl);e.appendChild(t);var i=this.parent.createElement("div",{className:"e-cont"}),a=this.parent.createElement("p",{className:"e-header"});a.innerText=n.getConstant("FindWhat");var s=this.parent.createElement("input",{className:"e-input e-text-findNext",attrs:{type:"Text",placeholder:n.getConstant("FindValue"),value:this.shortValue}});this.divElements.push(i),this.paraElements.push(a),this.inputElements.push(s),i.appendChild(s),i.insertBefore(a,s),t.appendChild(i);var o=new Ch.TextBox({width:"70%"});this.textBoxElements.push(o),o.createElement=this.parent.createElement,o.appendTo(s);var l=this.parent.createElement("div",{className:"e-cont"}),d=this.parent.createElement("p",{className:"e-header"});d.innerText=n.getConstant("ReplaceWith");var h=this.parent.createElement("input",{className:"e-input e-text-replaceInp",attrs:{type:"Text",placeholder:n.getConstant("ReplaceValue")}});this.divElements.push(l),this.paraElements.push(d),this.inputElements.push(h),l.appendChild(h),l.insertBefore(d,h),t.appendChild(l);var p=new Ch.TextBox({width:"70%"});this.textBoxElements.push(p),p.createElement=this.parent.createElement,p.appendTo(h);var c=[{Id:"Sheet",Within:n.getConstant("Sheet")},{Id:"Workbook",Within:n.getConstant("Workbook")}],u=new xh.DropDownList({dataSource:c,cssClass:"e-search-within",fields:{value:"Id",text:"Within"},width:"50%",index:0});this.dropDownListElements.push(u);var f=n.getConstant("SearchWithin"),g=this.parent.createElement("input",{className:"e-findnreplace-searchwithin",attrs:{type:"select",label:f}}),m=this.parent.createElement("p",{className:"e-header"});m.innerText=f,this.inputElements.push(g),this.paraElements.push(m),t.appendChild(m),t.appendChild(g),u.createElement=this.parent.createElement,u.appendTo(g);var v=[{Id:"By Row",Search:n.getConstant("ByRow")},{Id:"By Column",Search:n.getConstant("ByColumn")}],y=new xh.DropDownList({dataSource:v,cssClass:"e-searchby",fields:{value:"Id",text:"Search"},width:"50%",index:0});this.dropDownListElements.push(y),f=n.getConstant("SearchBy");var C=this.parent.createElement("input",{className:"e-findnreplace-searchby",attrs:{type:"select",label:f}}),b=this.parent.createElement("p",{className:"e-header"});b.innerText=f,this.inputElements.push(C),this.paraElements.push(b),t.appendChild(b),t.appendChild(C),y.createElement=this.parent.createElement,y.appendTo(C);var x=new bh.CheckBox({label:n.getConstant("MatchCase"),checked:!1,cssClass:"e-findnreplace-casecheckbox"}),S=this.parent.createElement("input",{className:"e-findnreplace-checkcase",attrs:{type:"checkbox"}});this.inputElements.push(S),r.appendChild(S),x.createElement=this.parent.createElement,x.appendTo(S);var w=new bh.CheckBox({label:n.getConstant("MatchExactCellElements"),checked:!1,cssClass:"e-findnreplace-exactmatchcheckbox"});this.checkBoxElements=w;var I=this.parent.createElement("input",{className:"e-findnreplace-checkmatch",attrs:{type:"checkbox"}});return this.inputElements.push(I),r.appendChild(I),w.createElement=this.parent.createElement,w.appendTo(I),t.appendChild(r),e},r.prototype.GotoContent=function(){var e=this.parent.serviceLocator.getService(kl),t=this.parent.createElement("div",{className:"e-link-dialog"}),r=this.parent.createElement("div",{className:"e-goto"});t.appendChild(r);var n=this.parent.createElement("div",{className:"e-cont"}),i=this.parent.createElement("p",{className:"e-header"});i.innerText=e.getConstant("Reference");var a=new Ch.TextBox({placeholder:e.getConstant("EnterCellAddress")}),s=this.parent.createElement("input",{className:"e-text-goto",attrs:{type:"Text"}});return n.appendChild(s),n.insertBefore(i,s),r.appendChild(n),a.createElement=this.parent.createElement,a.appendTo(s),t},r.prototype.destroy=function(){this.removeEventListener(),this.findDialog&&this.findDialog.hide(),this.parent=null},r.prototype.getModuleName=function(){return"findAndReplace"},r}(),Nh=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.merge=function(e){this.parent.serviceLocator.getService("cell").refresh(e.rowIdx,e.colIdx,e.lastCell,e.element,!1,!1,Yr(this.parent))},e.prototype.hideHandler=function(e){var t=this.parent.getActiveSheet(),r={range:[e.rowIdx,e.colIdx,e.rowIdx,e.colIdx]};this.parent.notify(Et,r),r.range=r.range;var n=Ln(r.range[0],r.range[1],t)||{},i="row"===e.model?r.range[0]:r.range[1],a=i+((n[e.model+"Span"]||1)-1);if(!(!e.isEnd&&(e.start===i||Il(t,i))||e.isEnd&&e.start>i&&!Il(t,i))&&n[e.model+"Span"]>1&&a>=e.start)if("row"===e.model?cl(t,i):Il(t,i)){if(e.colIdx<=a){var s=Dr(t,r.range[1],!0,"columns");if(s<=a){var o=r.range[0];n.rowSpan>1&&(o=(o=Dr(t,r.range[0],!0))<=r.range[2]?o:r.range[0]);var l=this.parent.getCell(o,s);l&&(l.style.display="",this.parent.serviceLocator.getService("cell").refresh(r.range[0],r.range[1],!0,l,!0,!0))}}}else{o=n.rowSpan>1?Dr(t,r.range[0],!0):r.range[0];this.merge({rowIdx:r.range[0],colIdx:r.range[1],element:this.parent.getCell(o,r.range[1])})}},e.prototype.checkPrevMerge=function(e){var t,r,n,i,a,s=this,o=this.parent.getActiveSheet(),l=function(){var t=s.parent.getContentTable(),n=t&&t.rows[0];if(n){var i=parseInt(n.getAttribute("aria-rowindex"),10)-1;if(r.range=r.range,i>s.parent.viewport.topIndex+s.parent.frozenRowCount(o)&&i>r.range[0]&&i<=r.range[2]){var a=void 0,l=s.parent.getRowHeaderTable(),d=l&&l.rows[0],h=s.parent.frozenColCount(o);if(h&&!d)return;for(var p=e.colIdx;p<=r.range[3];p++)(a=s.parent.getCell(i,p,p<h?d:n))&&(a.colSpan>1||a.rowSpan>1)&&(a.style.display="none",a.removeAttribute("colSpan"),a.removeAttribute("rowSpan"))}}},d=function(d){if(r.range=r.range,cl(o,r.range[0])&&e.rowIdx>=r.range[0]&&e.rowIdx<=r.range[2]){i=!1;for(var h=r.range[0];h<e.rowIdx;h++)if(!cl(o,h)){i=!0;break}if(t.rowSpan>1&&!i){var p=t.rowSpan-s.parent.hiddenCount(r.range[0],r.range[2]);p>0&&(l(),e.td.style.display="",e.colSpan=n,e.rowSpan=p,e.cell=t,e.isMerged=!1)}}else if(d){for(h=r.range[0];a&&h<e.rowIdx;h++)if(!cl(o,h)){i=!0;break}i||(l(),e.td.style.display="",e.colSpan=n,e.cell=t,e.isMerged=!1)}};if(e.cell.colSpan<0){if(e.colIdx-1>-1&&Il(o,e.colIdx-1)&&(t=Ln(e.rowIdx,e.colIdx-1,o,!1,!0),a=e.rowIdx-1>-1&&cl(o,e.rowIdx-1),(void 0!==t.colSpan||void 0!==t.rowSpan)&&(void 0===t.rowSpan||t.rowSpan>1||a)&&(r={range:[e.rowIdx,e.colIdx-1,e.rowIdx,e.colIdx-1]},this.parent.notify(Et,r),r.range=r.range,t=Ln(r.range[0],r.range[1],o,!1,!0),Il(o,r.range[1])&&e.colIdx>=r.range[1]&&e.colIdx<=r.range[3]))){for(var h=r.range[1];h<e.colIdx;h++)if(!Il(o,h)){i=!0;break}t.colSpan>1&&!i&&(n=t.colSpan-this.parent.hiddenCount(r.range[1],r.range[3],"columns"))>0&&d(!0)}}else e.rowIdx-1>-1&&cl(o,e.rowIdx-1)&&void 0!==(t=Ln(e.rowIdx-1,e.colIdx,o,!1,!0)).rowSpan&&(r={range:[e.rowIdx-1,e.colIdx,e.rowIdx-1,e.colIdx]},this.parent.notify(Et,r),r.range=r.range,t=Ln(r.range[0],r.range[1],o,!1,!0),d())},e.prototype.checkMerge=function(e){var t,r=this.parent.getActiveSheet(),n=Ln(e.rowIdx,e.colIdx,r)||{};if(e.isRow){if(void 0===n.colSpan||Il(r,e.colIdx-1)){if((t={range:[e.rowIdx,e.colIdx,e.rowIdx,e.colIdx]}).range=t.range,this.parent.notify(Et,t),Il(r,e.colIdx-1)&&!Il(r,t.range[1])||e.isFreezePane&&t.range[0]<this.parent.frozenRowCount(r))return void(e.insideFreezePane=t.range[0]<this.parent.frozenRowCount(r));if(e.colIdx!==this.parent.viewport.leftIndex+this.parent.frozenColCount(r)&&Il(r,e.colIdx-1))for(var i=t.range[1];void 0!==n.colSpan&&i<e.colIdx;i++)if(!Il(r,i))return;n=Ln(t.range[0],t.range[1],r),(s=t.range[2]-e.rowIdx+1-this.parent.hiddenCount(e.rowIdx,t.range[2]))>=1&&(this.merge({rowIdx:t.range[0],colIdx:t.range[1],element:e.td}),1===s?e.td.removeAttribute("rowspan"):e.td.rowSpan=s,e.td.style.display="")}}else if(void 0===n.rowSpan||cl(r,e.rowIdx-1)){if((t={range:[e.rowIdx,e.colIdx,e.rowIdx,e.colIdx]}).range=t.range,this.parent.notify(Et,t),cl(r,e.rowIdx-1)&&!cl(r,t.range[0])||e.isFreezePane&&t.range[1]<this.parent.frozenColCount(r))return void(e.insideFreezePane=t.range[1]<this.parent.frozenColCount(r));if(e.rowIdx!==this.parent.viewport.topIndex+this.parent.frozenRowCount(r)&&cl(r,e.rowIdx-1))for(var a=t.range[0];void 0!==n.rowSpan&&a<e.rowIdx;a++)if(!cl(r,a))return;var s;n=Ln(t.range[0],t.range[1],r),(s=t.range[3]-e.colIdx+1-this.parent.hiddenCount(e.colIdx,t.range[3],"columns"))>=1&&(this.merge({rowIdx:t.range[0],colIdx:t.range[1],element:e.td}),1===s?e.td.removeAttribute("colspan"):e.td.colSpan=s,e.td.style.display="")}},e.prototype.addEventListener=function(){this.parent.on(wt,this.merge,this),this.parent.on(Qa,this.hideHandler,this),this.parent.on(es,this.checkPrevMerge,this),this.parent.on(ts,this.checkMerge,this)},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(wt,this.merge),this.parent.off(Qa,this.hideHandler),this.parent.off(es,this.checkPrevMerge),this.parent.off(ts,this.checkMerge))},e.prototype.getModuleName=function(){return"merge"},e}(),Rh=function(){function n(e){this.divElements=[],this.spanElements=[],this.inputElements=[],this.dropDownListElements=[],this.parent=e,this.addEventListener()}return n.prototype.destroy=function(){this.removeEventListener(),this.dupData&&(this.dupData=[]),this.colorData&&(this.colorData=[]),this.parent=null},n.prototype.addEventListener=function(){this.parent.on(kt,this.applyCF,this),this.parent.on(ss,this.renderCFDlg,this),this.parent.on(Tt,this.clearCF,this)},n.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(kt,this.applyCF),this.parent.off(ss,this.renderCFDlg),this.parent.off(Tt,this.clearCF))},n.prototype.clearCF=function(t){var n=this,i=this.parent.getActiveSheet();this.updateRange(i,t.indexes,this.parent.frozenRowCount(i),this.parent.frozenColCount(i),r(i.topLeftCell),(function(t,r,i,a){var s,o,l;(0,e.removeClass)([a],["e-redft","e-yellowft","e-greenft","e-redf","e-redt","e-iconset"]),["backgroundColor","color"].forEach((function(e){a.style[""+e]&&(a.style[""+e]="",(s=i&&i.style&&i.style[""+e]||n.parent.commonCellStyle[""+e])&&((o={})[""+e]=s,n.parent.notify(le,{style:o,rowIdx:t,colIdx:r,td:a})))})),[".e-cf-databar",".e-iconsetspan"].forEach((function(e){l=a.querySelector(e);var t=a.querySelector(".e-wrap-content");l&&(t?t.removeChild(l):a.removeChild(l),a.textContent=n.parent.getDisplayText(i))}))}))},n.prototype.renderCFDlg=function(e){var r,n=this,i=this.parent.serviceLocator.getService(kl),a=this.parent.serviceLocator.getService(Al);a.show({width:375,showCloseIcon:!0,isModal:!0,cssClass:"e-conditionalformatting-dlg",header:e.action.replace("...",""),beforeOpen:function(t){var r={dialogName:"ConditionalFormatDialog",element:t.element,target:t.target,cancel:t.cancel};n.parent.trigger("dialogBeforeOpen",r),r.cancel?(t.cancel=!0,Bl((function(){a.hide(!0),Fd(n.parent.element)}))):(a.dialogInstance.content=n.cfDlgContent(e.action),a.dialogInstance.dataBind(),Fd(n.parent.element))},beforeClose:this.dialogBeforeClose.bind(this),close:function(){r&&(n.parent.notify(Ka,null),r=!1)},buttons:[{buttonModel:{content:i.getConstant("Ok"),isPrimary:!0},click:function(){var i=n.parent.getActiveSheet();zd(n.parent,c(t(i.selectedRange)))?r=!0:n.dlgClickHandler(e.action),a.hide()}}]})},n.prototype.dialogBeforeClose=function(){var e=this.numericTBElements;e&&e.element&&(e.destroy(),e.element.remove()),this.numericTBElements=null,this.dropDownListElements.forEach((function(e){e&&e.element&&(e.destroy(),e.element.remove())})),this.dropDownListElements=[],this.value1Inp&&(this.value1Inp.removeEventListener("input",this.validateCFInput.bind(this)),this.value1Inp.parentNode&&this.value1Inp.parentNode.removeChild(this.value1Inp),this.value1Inp=null),this.value2Inp&&(this.value2Inp.removeEventListener("input",this.validateCFInput.bind(this)),this.value2Inp.parentNode&&this.value2Inp.parentNode.removeChild(this.value2Inp),this.value2Inp=null),qd(this.spanElements),this.spanElements=[],qd(this.inputElements),this.inputElements=[],qd(this.divElements),this.divElements=[]},n.prototype.dlgClickHandler=function(e){var t=this.parent.serviceLocator.getService(kl),r=this.parent.element.querySelector(".e-conditionalformatting-dlg .e-dlg-content .e-cf-dlg"),n={cFColor:this.getCFColor(r.querySelector(".e-cfsub .e-input").value),range:this.parent.getActiveSheet().selectedRange},i=r.querySelectorAll(".e-cfmain .e-input");if(e===t.getConstant("DuplicateValues")+"...")n.type=i[0].value===t.getConstant("Duplicate")?"Duplicate":"Unique";else{n.type=this.getType(e);var a=[];i[0]&&a.push(i[0].value),i[1]&&a.push(i[1].value),qr(a,this.parent),n.value=a.join(",")}this.parent.notify(Ot,{cfModel:n,isAction:!0})},n.prototype.getType=function(e){var t,r=this.parent.serviceLocator.getService(kl);switch(e){case r.getConstant("GreaterThan")+"...":t="GreaterThan";break;case r.getConstant("LessThan")+"...":t="LessThan";break;case r.getConstant("Between")+"...":t="Between";break;case r.getConstant("CFEqualTo")+"...":t="EqualTo";break;case r.getConstant("TextThatContains")+"...":t="ContainsText";break;case r.getConstant("ADateOccuring")+"...":t="DateOccur";break;case r.getConstant("Top10Items")+"...":t="Top10Items";break;case r.getConstant("Bottom10Items")+"...":t="Bottom10Items";break;case r.getConstant("Top10")+" %...":t="Top10Percentage";break;case r.getConstant("Bottom10")+" %...":t="Bottom10Percentage";break;case r.getConstant("AboveAverage")+"...":t="AboveAverage";break;case r.getConstant("BelowAverage")+"...":t="BelowAverage"}return t},n.prototype.getCFColor=function(e){var t=this.parent.serviceLocator.getService(kl),r="RedFT";switch(e){case t.getConstant("LightRedFillWithDarkRedText"):r="RedFT";break;case t.getConstant("YellowFillWithDarkYellowText"):r="YellowFT";break;case t.getConstant("GreenFillWithDarkGreenText"):r="GreenFT";break;case t.getConstant("RedFill"):r="RedF";break;case t.getConstant("RedText"):r="RedT"}return r},n.prototype.cfDlgContent=function(e){var t=this.getDlgText(e),r=this.parent.serviceLocator.getService(kl),n=this.parent.createElement("div",{className:"e-cf-dlg"}),i=this.parent.createElement("div",{className:"e-cfmain"}),a=this.parent.createElement("div",{className:"e-cfsub"});this.divElements.push(n),this.divElements.push(i),this.divElements.push(a);var s=this.parent.createElement("span",{className:"e-header e-top-header"});s.innerText=t,this.value1Inp=this.parent.createElement("input",{className:"e-input",id:"valueInput",attrs:{type:"text","aria-label":t}});var o=this.parent.createElement("input",{className:"e-select"}),l=this.parent.createElement("span",{className:"e-header"});l.innerText=r.getConstant("With");var d,h=this.parent.createElement("input",{className:"e-select"});if(this.spanElements.push(s),this.inputElements.push(o),this.spanElements.push(l),this.inputElements.push(h),n.appendChild(i),n.appendChild(a),i.appendChild(s),e!==r.getConstant("DuplicateValues")+"..."){if(e!==r.getConstant("AboveAverage")+"..."&&e!==r.getConstant("BelowAverage")+"..."){i.appendChild(this.value1Inp),d=!0;var p=e===r.getConstant("Top10")+" %..."||e===r.getConstant("Bottom10")+" %...";if(e===r.getConstant("Top10Items")+"..."||e===r.getConstant("Bottom10Items")+"..."||p){this.value1Inp.maxLength=p?3:4;var c=new Ch.NumericTextBox({value:10,min:1,max:p?100:1e3,format:"###"});this.numericTBElements=c,c.appendTo(this.value1Inp)}}}else{i.appendChild(o),this.dupData=[{text:r.getConstant("Duplicate"),id:"duplicate"},{text:r.getConstant("Unique"),id:"unique"}];var u=new xh.DropDownList({dataSource:this.dupData,index:0,popupHeight:"200px"});this.dropDownListElements.push(u),u.appendTo(o)}if(e===r.getConstant("Between")+"..."){var f=this.parent.createElement("span",{className:"e-header e-header-2"});f.innerText=r.getConstant("And"),this.value2Inp=this.parent.createElement("input",{className:"e-input e-between"}),this.spanElements.push(f),i.appendChild(f),i.appendChild(this.value2Inp),this.value2Inp.addEventListener("input",this.validateCFInput.bind(this))}d&&(this.validateCFInput({target:this.value1Inp}),this.value1Inp.addEventListener("input",this.validateCFInput.bind(this))),a.appendChild(l),a.appendChild(h),this.colorData=[{text:r.getConstant("LightRedFillWithDarkRedText"),value:"redft",id:"redft"},{text:r.getConstant("YellowFillWithDarkYellowText"),id:"yellowft"},{text:r.getConstant("GreenFillWithDarkGreenText"),id:"greenft"},{text:r.getConstant("RedFill"),id:"redf"},{text:r.getConstant("RedText"),id:"redt"}];var g=new xh.DropDownList({dataSource:this.colorData,index:0,popupHeight:"200px"});return this.dropDownListElements.push(g),g.appendTo(h),n},n.prototype.validateCFInput=function(e){var t=this.parent.serviceLocator.getService(Al),r=e.target.value,n=t.dialogInstance.element.getElementsByClassName("e-primary")[0];r&&(e.target.classList.contains("e-between")||e.target.parentElement.querySelector(".e-between"))&&(r=e.target.parentElement.querySelector(e.target.classList.contains("e-between")?".e-input":".e-between").value),n.disabled=!r.trim()},n.prototype.checkCellHandler=function(e,r,n){return n.range.trim().split(",").some((function(n){var i=t(n.includes(":")?n:n+":"+n);return e>=i[0]&&e<=i[2]&&r>=i[1]&&r<=i[3]}))},n.prototype.getDlgText=function(e){var t=this.parent.serviceLocator.getService(kl),r="";switch(e){case t.getConstant("GreaterThan")+"...":r=t.getConstant("FormatCellsGreaterThan");break;case t.getConstant("LessThan")+"...":r=t.getConstant("FormatCellsLessThan");break;case t.getConstant("Between")+"...":r=t.getConstant("FormatCellsBetween");break;case t.getConstant("CFEqualTo")+"...":r=t.getConstant("FormatCellsEqualTo");break;case t.getConstant("TextThatContains")+"...":r=t.getConstant("FormatCellsThatContainTheText");break;case t.getConstant("ADateOccuring")+"...":r=t.getConstant("FormatCellsThatContainADateOccurring");break;case t.getConstant("DuplicateValues")+"...":r=t.getConstant("FormatCellsDuplicate");break;case t.getConstant("Top10Items")+"...":case t.getConstant("Top10")+" %...":r=t.getConstant("FormatCellsTop");break;case t.getConstant("Bottom10Items")+"...":case t.getConstant("Bottom10")+" %...":r=t.getConstant("FormatCellsBottom");break;case t.getConstant("AboveAverage")+"...":r=t.getConstant("FormatCellsAbove");break;case t.getConstant("BelowAverage")+"...":r=t.getConstant("FormatCellsBelow")}return r},n.prototype.updateResult=function(r,n,i,a,s,o,l,d){var h,p,c,u,f,g={},m={},v=r.range.split(","),y=[];i?f=function(){if(rn(p)&&"Text"!==u){var e=parseFloat(p);e>=0?(void 0===y[0]||e>y[0])&&(y[0]=e):(void 0===y[1]||e<y[1])&&(y[1]=e)}}:a?f=function(){if(rn(p)&&"Text"!==u){var e=parseFloat(p);y.push(Number(e))}}:s?(y=[0,0],f=function(){rn(p)&&"Text"!==u&&(y[0]+=parseFloat(p),y[1]++)}):f=o?function(){rn(p)&&"Text"!==u&&y.push(parseFloat(p))}:l?function(){if(rn(p)&&"Text"!==u){var e=parseFloat(p);(void 0===y[0]||e<y[0])&&(y[0]=e),(void 0===y[1]||e>y[1])&&(y[1]=e)}}:function(){g[""+p]?""!==p&&(m[""+p]||(m[""+p]=!0,y.push(p))):g[""+p]=!0};for(var C=0;C<v.length;C++)for(var b=(h=t(v[C]))[0];b<=h[2];b++)for(var x=h[1];x<=h[3];x++)c=Ln(b,x,n,!1,!0),u="",(0,e.isNullOrUndefined)(c.value)?c.formula&&(this.parent.notify(ne,{cell:c,rowIdx:b,colIdx:x,sheetIndex:this.parent.activeSheetIndex}),p=c.value.toString().toLowerCase(),u=Bo(c.format),f()):(p=c.value.toString().toLowerCase(),u=Bo(c.format),f());if(a||o){if(y=y.sort((function(e,t){return e-t})),r.type.includes("Bottom")||(y=y.reverse()),o){var S=parseFloat(d);r.type.includes("Percentage")&&(S=(S/=100/y.length)<1?1:S),y=y.slice(0,S)}}else s&&((y=[y[0]/y[1]])[0]||(y=[]));r.result=y},n.prototype.applyCF=function(e){var t=!e.cfModel,r=this.parent.getActiveSheet(),n=e.cfModel||r.conditionalFormats,i=[e.indexes];e.refreshAll&&(i=Wr(this.parent,this.parent.viewport));for(var a={},s=n.length-1;s>=0;s--)t&&!(2===i[0].length?this.checkCellHandler(e.indexes[0],e.indexes[1],n[s]):jr(i,n[s].range))||this.updateCF(e,r,n[s],a)},n.prototype.updateCF=function(n,a,s,o){var l,d,h,p,c=this;if(s.value){var u=s.value.split(",").filter((function(e){return!!e.trim()}));if(u.length>1)if(u[0].split("(").length>1){for(var f="",g=0;g<u.length;g++)(f+=u[g]+",").split("(").length===f.split(")").length&&void 0===l&&(l=f.substring(0,f.length-1),f="");d=f.substring(0,f.length-1)}else{l=u[0];for(g=1;g<u.length;g++)d+=g+1===u.length?u[g]:u[g]+","}else l=u[0]||s.value}s.type||(s.type="GreaterThan"),s.format&&s.format.style?(h=Mn(s.format.style,!0),Object.keys(h).length||(p=s.cFColor)||(p=s.cFColor="RedFT")):(h={},(p=s.cFColor)||(p=s.cFColor="RedFT"));var m=s.type.includes("Average"),v=s.type.includes("10")&&rn(l),y=s.type.includes("Three")||s.type.includes("Four")||s.type.includes("Five"),C=s.type.includes("DataBar"),b=s.type.includes("ColorScale");n.isRender&&s.result||!("Duplicate"===s.type||"Unique"===s.type||C||b||m||v||y)||this.updateResult(s,a,C,b,m,v,y,l);var x=function(t,r,a,u,f){var g,m,v,y=a&&!(0,e.isNullOrUndefined)(a.value)?a.value.toString():"",x=!0,S=a?Bo(a.format):"";switch(s.type){case"GreaterThan":case"LessThan":g=c.isGreaterThanLessThan(s,y,l,S);break;case"Between":g=rn(y)&&"Text"!==S&&c.isBetWeen(s,y,l,d);break;case"EqualTo":g=rn(y)&&"Text"!==S&&c.isEqualTo(s,y,l);break;case"ContainsText":g=y&&l&&c.isContainsText(y,l);break;case"DateOccur":m={value:l,cell:{},updatedVal:l},rn(l)||c.parent.notify(ue,m),g=y===m.updatedVal;break;case"Unique":g=-1===s.result.indexOf(y.toLowerCase());break;case"Duplicate":g=s.result.indexOf(y.toLowerCase())>-1;break;case"Top10Items":case"Bottom10Items":case"Top10Percentage":case"Bottom10Percentage":if(s.result){var w=parseFloat(y);tn(y)&&(w=en(y)),g=s.result.indexOf(w)>-1}break;case"AboveAverage":g=s.result.length&&rn(y)&&"Text"!==S&&parseFloat(y)>s.result[0];break;case"BelowAverage":g=s.result.length&&rn(y)&&"Text"!==S&&parseFloat(y)<s.result[0];break;default:if(x=!1,C)o[t+"_"+r+"_bars"]||(o[t+"_"+r+"_bars"]=!0,c.applyDataBars(y,s,u,t,S,f));else if(b){if(!o[t+"_"+r]){w=rn(y)?parseFloat(y):NaN;if(isNaN(w)){if(u.style.backgroundColor&&!u.classList.contains("e-yellowft")&&!u.classList.contains("e-greenft")&&!u.classList.value.includes("e-redf")){u.style.backgroundColor="";var I=(0,e.extend)({},c.parent.commonCellStyle,a&&a.style);I.backgroundColor&&c.parent.notify(le,{style:{backgroundColor:I.backgroundColor},td:u,rowIdx:t,colIdx:r})}}else{var E=s.result,N=E.indexOf(w);if(-1===N){if(u.style.backgroundColor){u.style.backgroundColor="";var R=(0,e.extend)({},c.parent.commonCellStyle,a&&a.style);R.backgroundColor&&c.parent.notify(le,{style:{backgroundColor:R.backgroundColor},td:u,rowIdx:t,colIdx:r})}}else{var O=c.getColor(s.type);u.style.backgroundColor=0===N?O[0]:N===E.length-1?O[O.length-1]:3===E.length&&1===N?O[1]:c.getGradient(N,O[0],O[1],O[2],E.length),o[t+"_"+r]=!0}}}}else if(!o[t+"_"+r+"_icons"]){o[t+"_"+r+"_icons"]=!0;var k=c.parent.createElement("span",{className:"e-icon e-iconsetspan"});c.applyIconSet(y,s,u,k,S)&&a&&a.format&&a.format.includes("*")&&"Accounting"!==Bo(a.format)&&c.parent.notify(Jt,{cell:a,cellEle:u,rowIdx:t,colIdx:r,updateFillSize:!0,iconSetSpan:k})}}n.isAction&&x&&(c.parent.trigger("beforeConditionalFormat",{conditionalFormat:s,cell:a,element:u,apply:g,address:i(t,r)}),g||!n.isEdit||o[t+"_"+r]||(p?u.className.includes("e-"+p.toLowerCase())&&(u.classList.remove("e-"+p.toLowerCase()),u.style.backgroundColor="",u.style.color="",((v=(0,e.extend)({},c.parent.commonCellStyle,a&&a.style)).backgroundColor||v.color)&&c.parent.notify(le,{rowIdx:t,colIdx:r,td:u,style:{backgroundColor:v.backgroundColor,color:v.color}})):(u.removeAttribute("style"),v=(0,e.extend)({},c.parent.commonCellStyle,a&&a.style),Object.keys(v).length&&c.parent.notify(le,{style:v,rowIdx:t,colIdx:r,td:u}))));g&&!o[t+"_"+r]&&(o[t+"_"+r]=!0,(0,e.removeClass)([u],["e-redft","e-yellowft","e-greenft","e-redf","e-redt"]),p&&(u.classList.add("e-"+p.toLowerCase()),c.setCFStyle(h,s)),Object.assign(u.style,h))};if(n.ele)x(n.indexes[0],n.indexes[1],n.cell,n.ele,n.resizedRowHeight);else for(var S=s.range.split(","),w=this.parent.frozenRowCount(a),I=this.parent.frozenColCount(a),E=r(a.topLeftCell),N=0;N<S.length;N++)this.updateRange(a,t(S[N]),w,I,E,x)},n.prototype.updateRange=function(e,t,r,n,i,a){var s;t[0]=t[0]<r?t[0]<i[0]?i[0]:t[0]:t[0]<this.parent.viewport.topIndex+r?this.parent.viewport.topIndex+r:t[0],t[1]=t[1]<n?t[1]<i[1]?i[1]:t[1]:t[1]<this.parent.viewport.leftIndex+n?this.parent.viewport.leftIndex+n:t[1],t[2]=t[2]<r?t[2]<i[0]?i[0]-1:t[2]:t[2]>this.parent.viewport.bottomIndex?this.parent.viewport.bottomIndex:t[2],t[3]=t[3]<n?t[3]<i[1]?i[1]-1:t[3]:t[3]>this.parent.viewport.rightIndex?this.parent.viewport.rightIndex:t[3];for(var o=t[0];o<=t[2];o++)if(r&&o===r&&(o=this.parent.viewport.topIndex+r),!cl(e,o))for(var l=t[1];l<=t[3];l++)n&&l===n&&(l=this.parent.viewport.leftIndex+n),Il(e,l)||(s=this.parent.getCell(o,l))&&a(o,l,Ln(o,l,e),s)},n.prototype.applyIconSet=function(e,t,r,n,i){var a=r.classList.contains("e-iconset");if(a){r.classList.remove("e-iconset");var s=r.querySelector(".e-iconsetspan");s&&r.removeChild(s)}var o=rn(e)?parseFloat(e):NaN,l=t.result;if(isNaN(o)||void 0===l[0]&&void 0===l[1]||rn(e)&&"Text"===i)return a;var d,h=l[0],p=l[1],c=this.getIconList(t.type).split(",");if(3===c.length){var u=h+.33*(p-h);d="e-"+(o>=h+.67*(p-h)?c[0].trim():o>=u?c[1].trim():c[2].trim())}else if(4===c.length){var f=h+.25*(p-h),g=h+.5*(p-h);d="e-"+(o>=(m=h+.75*(p-h))?c[0].trim():o>=g?c[1].trim():o>=f?c[2].trim():c[3].trim())}else if(5===c.length){f=h+.2*(p-h),g=h+.4*(p-h);var m=h+.6*(p-h);d="e-"+(o>=h+.8*(p-h)?c[0].trim():o>=m?c[1].trim():o>=g?c[2].trim():o>=f?c[3].trim():c[4].trim())}return n.classList.add(d),r.insertBefore(n,r.childNodes[0]),r.classList.add("e-iconset"),!0},n.prototype.getIconList=function(e){switch(e){case"ThreeArrows":return"3arrows-1,3arrows-2,3arrows-3";case"ThreeArrowsGray":return"3arrowsgray-1,3arrowsgray-2,3arrowsgray-3";case"FourArrowsGray":return"4arrowsgray-1,4arrowsgray-2,4arrowsgray-3,4arrowsgray-4";case"FourArrows":return"4arrows-1,4arrows-2,4arrows-3,4arrows-4";case"FiveArrowsGray":return"5arrowsgray-1,5arrowsgray-2,5arrowsgray-3,5arrowsgray-4,5arrowsgray-5";case"FiveArrows":return"5arrows-1,5arrows-2,5arrows-3,5arrows-4,5arrows-5";case"ThreeTrafficLights1":return"3trafficlights-1,3trafficlights-2,3trafficlights-3";case"ThreeTrafficLights2":return"3rafficlights2-1,3rafficlights2-2,3rafficlights2-3";case"ThreeSigns":return"3signs-1,3signs-2,3signs-3";case"FourTrafficLights":return"4trafficlights-1,4trafficlights-2,4trafficlights-3,4trafficlights-4";case"FourRedToBlack":return"4redtoblack-1,4redtoblack-2,4redtoblack-3,4redtoblack-4";case"ThreeSymbols":return"3symbols-1,3symbols-2,3symbols-3";case"ThreeSymbols2":return"3symbols2-1,3symbols2-2,3symbols2-3";case"ThreeFlags":return"3flags-1,3flags-2,3flags-3";case"FourRating":return"4rating-4,4rating-3,4rating-2,4rating-1";case"FiveQuarters":return"5quarters-1,5quarters-2,5quarters-3,5quarters-4,5quarters-5";case"FiveRating":return"5rating-5,5rating-4,5rating-3,5rating-2,5rating-1";case"ThreeTriangles":return"3triangles-1,3triangles-2,3triangles-3";case"ThreeStars":return"3stars-1,3stars-2,3stars-3";case"FiveBoxes":return"5boxes-1,5boxes-2,5boxes-3,5boxes-4,5boxes-5"}return"3arrows-1,3arrows-2,3arrows-3"},n.prototype.applyDataBars=function(e,t,r,n,i,a){var s,o,l=this.parent.getActiveSheet(),d=t.result,h=0;if(rn(e)&&(o=parseFloat(e)),void 0===d[0]&&void 0===d[1]||isNaN(o)||rn(e)&&"Text"===i){var p=r.getElementsByClassName("e-cf-databar")[0];if(p){var c=p.getElementsByClassName("e-databar-value")[0].textContent;r.removeChild(p),r.innerText=c}}else{void 0!==d[0]&&void 0!==d[1]?(s=d[0]+Math.abs(d[1]),h=Math.abs(d[1]/s*100)):s=void 0!==d[0]?d[0]:d[1];var u=this.parent.createElement("div",{id:"spreadsheet-databar",className:"e-cf-databar"}),f=this.parent.createElement("span",{id:"spreadsheet-leftspan",className:"e-databar"}),g=this.parent.createElement("span",{id:"spreadsheet-rightspan",className:"e-databar"}),m=this.parent.createElement("span",{id:"spreadsheet-dataspan",className:"e-databar-value"}),v=r.querySelector(".e-iconsetspan"),y=a||fl(l,n,!0);u.style.height=y-1+"px";var C=t.type[0];"L"===C&&(C+="B"),void 0===d[1]?(g.style.width=Math.ceil(Math.abs(o/s*100))+"%",g.style.height=y-3+"px",g.style.backgroundColor=this.getColor(C)[0],g.style.left="0px"):void 0===d[0]?(g.style.width=Math.ceil(Math.abs(o/s*100))+"%",g.style.height=y-3+"px",g.style.backgroundColor=this.getColor("R")[0],g.style.left="0px"):o>=0?(f.style.width=h+"%",f.style.height=y-3+"px",f.style.backgroundColor="transparent",f.style.left="0px",g.style.width=Math.ceil(Math.abs(o/s*100))+"%",g.style.height=y-3+"px",g.style.backgroundColor=this.getColor(C)[0],g.style.left=h+"%"):(f.style.width=Math.ceil(Math.abs(o/s*100))+"%",f.style.height=y-3+"px",f.style.backgroundColor=this.getColor("R")[0],f.style.width===h+"%"?f.style.left="0px":f.style.right=100-h+"%"),m.style.fontSize=r.style.fontSize||"11pt",m.style.alignItems="top"===r.style.verticalAlign?"start":"middle"===r.style.verticalAlign?"center":"end";var b=r.querySelector("#"+this.parent.element.id+"_currency");b&&u.appendChild(b);var x=r.querySelector(".e-hyperlink");x?m.appendChild(x):(m.innerText=r.textContent,""===r.textContent&&m.appendChild(document.createTextNode(r.textContent))),u.appendChild(f),u.appendChild(g),u.appendChild(m),r.textContent="",v&&r.insertBefore(v,r.firstElementChild),r.appendChild(u)}},n.prototype.getColor=function(e){if("LB"===e)return["#008aef"];for(var t=e.split(""),r=[],n=0;n<t.length;n++)switch(t[n]){case"G":r.push("#63be7b");break;case"Y":r.push("#ffeb84");break;case"R":r.push("#f8696b");break;case"W":r.push("#ffffff");break;case"B":r.push("#5a8ac6");break;case"O":r.push("#ffb628");break;case"LB":r.push("#008aef");break;case"P":r.push("#d6007b")}return r},n.prototype.getGradient=function(t,r,n,i,a){if((0,e.isNullOrUndefined)(i))return this.getLinear(r,n,t/a);var s=a/2;return t>=s?this.getLinear(n,i,Math.abs((t-s)/s)):this.getLinear(r,n,t/s)},n.prototype.getLinear=function(e,t,r){return"#"+this.byteLinear(e[1]+e[2],t[1]+t[2],r)+this.byteLinear(e[3]+e[4],t[3]+t[4],r)+this.byteLinear(e[5]+e[6],t[5]+t[6],r)},n.prototype.byteLinear=function(e,t,r){var n=parseInt(e,16)*(1-r)+parseInt(t,16)*r|0;return Math.abs(n).toString(16)},n.prototype.isGreaterThanLessThan=function(e,t,r,n){if(rn(t)&&"Text"!==n){if(rn(r)){var i=new RegExp(/[^.-a-zA-Z 0-9]+/g);return"GreaterThan"===e.type?parseFloat(t)>parseFloat(r.replace(i,"")):parseFloat(t)<parseFloat(r.replace(i,""))}var a={value:r,rowIndex:0,colIndex:0,sheetIndex:0,isDate:!1,updatedVal:"",isTime:!1};return this.parent.notify(ue,a),a.isDate||a.isTime?(e.value=a.updatedVal.toString(),"GreaterThan"===e.type?Number(t)>Number(a.updatedVal):Number(t)<Number(a.updatedVal)):"GreaterThan"===e.type?t.toLowerCase()>r.toLowerCase():t.toLowerCase()<r.toLowerCase()}return""===t&&Number(r)>0&&"LessThan"===e.type},n.prototype.isBetWeen=function(e,t,r,n){var i,a,s=new RegExp(/[^.-a-zA-Z 0-9]+/g);if(r=r.replace(s,""),n=n.replace(s,""),rn(r)){var o=parseFloat(r),l=parseFloat(n);return o>l&&(o=(i=[l,o])[0],l=i[1]),parseFloat(t)>=o&&parseFloat(t)<=l}if(r&&n){var d={value:r,cell:{},updatedVal:""},h={value:n,cell:{},updatedVal:""};return this.parent.notify(ue,d),this.parent.notify(ue,h),(d.isDate||d.isTime)&&(h.isDate||h.isTime)?(e.value=d.updatedVal+","+h.updatedVal,d.updatedVal>h.updatedVal&&(a=[h.updatedVal,d.updatedVal],d.updatedVal=a[0],h.updatedVal=a[1]),t>=d.updatedVal&&t<=h.updatedVal):t.toLowerCase()>=r.toLowerCase()&&t.toLowerCase()<=n.toLowerCase()}return!1},n.prototype.isEqualTo=function(e,t,r){if(rn(r)){var n=new RegExp(/[^.-a-zA-Z 0-9]+/g);return parseFloat(t)===parseFloat(r.replace(n,""))}var i={value:r,cell:{},updatedVal:""};return this.parent.notify(ue,i),i.isTime||i.isDate?(e.value=i.updatedVal,t===i.updatedVal):t.toLowerCase()===r.toLowerCase()},n.prototype.isContainsText=function(e,t){var r=new RegExp(/[^.-a-zA-Z 0-9]+/g);return rn(t.replace(r,""))?(t=t.replace(r,""),tn(e)&&(e=en(e).toString()),e.indexOf(t)>-1):tn(t)?(tn(e)&&(e=en(e).toString()),e.indexOf(en(t).toString())>-1):e.toLowerCase().indexOf(t.toLowerCase())>-1},n.prototype.setCFStyle=function(e,t){switch(t.cFColor){case"RedFT":e.backgroundColor="#ffc7ce",e.color="#9c0055";break;case"YellowFT":e.backgroundColor="#ffeb9c",e.color="#9c6500";break;case"GreenFT":e.backgroundColor="#c6efce",e.color="#006100";break;case"RedF":e.backgroundColor="#ffc7ce";break;case"RedT":e.color="#9c0055"}return e},n.prototype.getModuleName=function(){return"conditionalFormatting"},n}(),Oh=u(295),kh=function(){function r(e){this.fillOptionIndex=0,this.parent=e,this.addEventListener()}return r.prototype.getfillItems=function(){var e=this.parent.serviceLocator.getService(kl);return[{text:e.getConstant("CopyCells")},{text:e.getConstant("FillSeries")},{text:e.getConstant("FillFormattingOnly")},{text:e.getConstant("FillWithoutFormatting")}]},r.prototype.createAutoFillElement=function(){if(this.parent.allowAutoFill){var e=this.parent.getMainContent(),t=this.parent.createElement("div",{className:"e-autofill"});e.lastElementChild&&e.lastElementChild.classList.contains("e-ss-overlay")?e.insertBefore(t,e.getElementsByClassName("e-ss-overlay")[0]):e.appendChild(t),this.autoFillElement=t,this.autoFillDropDown&&(this.autoFillDropDown.destroy(),this.autoFillDropDown=null),this.getautofillDDB({id:this.parent.element.id+"_autofilloptionbtn",appendElem:e})}},r.prototype.getautofillDDB=function(e){var t=this;return this.splitBtnElem=this.parent.createElement("button",{id:e.id,className:"e-filloption",attrs:{type:"button"}}),this.splitBtnElem.appendChild(this.parent.createElement("span",{className:"e-tbar-btn-text"})),this.autoFillDropDown=new Oh.DropDownButton({cssClass:"e-dragfill-ddb",iconCss:"e-icons e-dragfill-icon",items:this.getfillItems(),createPopupOnClick:!0,enableRtl:this.parent.enableRtl,select:function(e){t.autoFillOptionClick({type:t.getFillType(e.item.text)})},beforeOpen:function(){return t.autoFillClick()}}),this.autoFillDropDown.createElement=this.parent.createElement,this.autoFillDropDown.appendTo(this.splitBtnElem),e.appendElem.appendChild(this.splitBtnElem),this.autoFillDropDown},r.prototype.getFillType=function(e){var t=this.parent.serviceLocator.getService(kl);return e===t.getConstant("CopyCells")?"CopyCells":e===t.getConstant("FillSeries")?"FillSeries":e===t.getConstant("FillFormattingOnly")?"FillFormattingOnly":"FillWithoutFormatting"},r.prototype.autoFillClick=function(){var e=this.parent.serviceLocator.getService(kl),t={fillType:"FillSeries",disableItems:[""]};this.parent.notify($t,t),this.autoFillDropDown.setProperties({items:this.getfillItems()},!0),this.autoFillDropDown.removeItems(t.disableItems),this.refreshAutoFillOption(e.getConstant(t.fillType))},r.prototype.getFillRange=function(e,t,r,n){switch(n){case"Up":return[r.rowIndex,e.colIndex,e.rowIndex-1,t.colIndex];case"Right":return[e.rowIndex,t.colIndex+1,t.rowIndex,r.colIndex];case"Down":return[t.rowIndex+1,e.colIndex,r.rowIndex,t.colIndex];case"Left":return[e.rowIndex,r.colIndex,t.rowIndex,e.colIndex-1]}},r.prototype.autoFillOptionClick=function(e){var r=this.parent.serviceLocator.getService(kl),n=this.parent.getActiveSheet(),i=c(t(this.parent.selectionModule.dAutoFillCell)),s=t(n.selectedRange),o=i[0],l=i[1],d=i[2],h=i[3],p=this.getDirection({rowIndex:d,colIndex:h},{rowIndex:s[2],colIndex:s[3]}),u=[o,l,d,h],f=this.getFillRange({rowIndex:o,colIndex:l},{rowIndex:d,colIndex:h},{rowIndex:s[2],colIndex:s[3]},p);this.refreshAutoFillOption(r.getConstant(e.type));var g={isUndo:!0,isPublic:!0,preventReSelect:!0,preventEvt:"FillWithoutFormatting"===e.type,setCollection:"FillFormattingOnly"===e.type||"FillWithoutFormatting"===e.type,isFromAutoFillOption:!0};this.parent.notify(ma,g);var m={dataRange:n.name+"!"+a(u),fillRange:n.name+"!"+a(f),direction:p,fillType:e.type,isFillOptClick:!0};this.isVerticalFill="Down"===m.direction||"Up"===m.direction,this.parent.notify(Xt,m),this.positionAutoFillElement({isautofill:!0});var v={dataRange:m.dataRange,fillRange:m.fillRange,fillType:m.fillType,direction:m.direction,selectedRange:n.name+"!"+a(s),undoArgs:g.undoArgs};this.parent.notify(ka,{eventArgs:v,action:"autofill"}),this.parent.showAggregate&&this.parent.notify(ns,{}),this.autoFillClick()},r.prototype.refreshAutoFillOption=function(e){for(var t=0;t<this.autoFillDropDown.items.length;t++)this.autoFillDropDown.items[t].iconCss="";for(t=0;t<this.autoFillDropDown.items.length;t++)this.autoFillDropDown.items[t].text===e&&(this.autoFillDropDown.items[t].iconCss="e-icons e-selected-icon");["Copy Cells","Fill Series","Fill Formatting Only","Fill Without Formatting"].indexOf(e)<0&&(this.autoFillDropDown.items[this.fillOptionIndex].iconCss=""),this.autoFillDropDown.dataBind()},r.prototype.positionAutoFillElement=function(r){var n,i,a,s=0,o=0,l=this.parent.getActiveSheet(),d=c(t(l.selectedRange)),h=-5,p=-5,u=6,f=6,g=0===d[1]&&d[3]===l.colCount-1,m=0===d[0]&&d[2]===l.rowCount-1,v=d[2],y=d[3],C=this.parent.enableRtl,b=this.parent.getCell(v,y);if(Il(l,d[3])||cl(l,d[2])||b&&b.classList.contains("e-formularef-selection")||l.isProtected&&l.protectSettings.selectUnLockedCells&&Td(this.parent,d))this.hideAutoFillElement();else if(l.isProtected&&(l.protectSettings.selectCells||l.protectSettings.selectUnLockedCells)||!l.isProtected)if(g?(h=-5,p=-1,u=6,f=2,v=d[2],y=d[1]):m&&(p=-5,h=0,u=1,f=6,v=d[0],y=d[3]),l.frozenColumns||l.frozenRows){if(m||g?(Yl(this.parent,this.autoFillElement,d,"e-autofill",r&&r.preventAnimation),this.parent.autoFillSettings.showFillOptions&&r&&r.isautofill&&Yl(this.parent,this.autoFillDropDown.element,d,"e-filloption")):(Yl(this.parent,this.autoFillElement,[v,y,v,y],"e-autofill",r&&r.preventAnimation),this.parent.autoFillSettings.showFillOptions&&r&&r.isautofill&&Yl(this.parent,this.autoFillDropDown.element,[v,y,v,y],"e-filloption")),this.autoFillElement){this.autoFillCell={rowIndex:v,colIndex:y};var x=this.parent.element.querySelectorAll(".e-autofill");if(x.length){var S=x[0].getBoundingClientRect();this.autoFillElementPosition={left:S.left,top:S.top},[].slice.call(x).forEach((function(t){(0,e.removeClass)([t],"e-hide")}))}}}else if(a=Gl(l,[v,y,v,y],this.parent.frozenRowCount(l),this.parent.frozenColCount(l),this.parent.viewport.beforeFreezeHeight,this.parent.viewport.beforeFreezeWidth,this.parent.sheetModule.colGroupWidth),n=ml(l,v,v,!0),i=wl(l,y,y,!0),m||(s+=n),g||(o+=i),s+=Math.round(a.top)+h,o+=Math.round(a.left)+p,this.autoFillElement){(0,e.removeClass)([this.autoFillElement],"e-hide"),this.autoFillElement.style.top=s+"px",C?this.autoFillElement.style.right=o+"px":this.autoFillElement.style.left=o+"px",this.autoFillCell={rowIndex:v,colIndex:y};S=this.autoFillElement.getBoundingClientRect();this.autoFillElementPosition={left:S.left,top:S.top},this.parent.autoFillSettings.showFillOptions&&r&&r.isautofill&&((0,e.removeClass)([this.autoFillDropDown.element],"e-hide"),this.autoFillDropDown.element.style.top=s+u+"px",C?this.autoFillDropDown.element.style.right=o+f+"px":this.autoFillDropDown.element.style.left=o+f+"px")}},r.prototype.hideAutoFillElement=function(){var t=this.parent.element;[].slice.call(t.querySelectorAll(".e-autofill")).forEach((function(r){t&&(0,e.addClass)([r],"e-hide")}))},r.prototype.hideAutoFillOptions=function(){var t=this.parent.element;[].slice.call(t.querySelectorAll(".e-filloption")).forEach((function(r){t&&(0,e.addClass)([r],"e-hide")}))},r.prototype.selectAutoFillRange=function(e){var r,n={clientY:ld(e.e),target:e.e.target},i={clientX:od(e.e),target:e.e.target},a=this.parent.getActiveSheet();this.parent.notify(ys,n),this.parent.notify(Cs,i);var s=this.getAutoFillRange({rowIndex:n.clientY,colIndex:i.clientX});return r=s&&s.fillRange?[s.startCell.rowIndex,s.startCell.colIndex,s.endCell.rowIndex,s.endCell.colIndex]:t(a.selectedRange),e.indexes=r,r},r.prototype.getAutoFillRange=function(e){var r=this.parent.getActiveSheet(),n=this.autoFillCell,i=c(t(r.selectedRange)),a=i[0],s=i[1],o=i[2],l=i[3],d=Or(i,[e.rowIndex,e.colIndex,e.rowIndex,e.colIndex],!0),h={rowIndex:a,colIndex:s},p={rowIndex:i[0],colIndex:i[1]},u={rowIndex:i[2],colIndex:i[3]},f={rowIndex:o,colIndex:l},g=this.modifyRangeForMerge(e.rowIndex,e.colIndex,n.rowIndex,n.colIndex,i);return e.rowIndex<n.rowIndex?a-e.rowIndex>e.colIndex-l&&a-e.rowIndex>s-e.colIndex?d?{startCell:h,endCell:{rowIndex:e.rowIndex,colIndex:l}}:{startCell:f,endCell:{rowIndex:g.rowIndex,colIndex:s},fillRange:[g.rowIndex,s,a-1,l],direction:"Up"}:e.colIndex>n.colIndex?{startCell:h,endCell:{rowIndex:o,colIndex:e.colIndex},fillRange:[a,l+1,o,e.colIndex],direction:"Right"}:e.colIndex<n.colIndex?d?{startCell:h,endCell:f}:{startCell:f,endCell:{rowIndex:a,colIndex:e.colIndex},fillRange:[a,e.colIndex,o,s-1],direction:"Left"}:{startCell:p,endCell:u}:e.colIndex>n.colIndex?e.rowIndex-o>e.colIndex-l?{startCell:h,endCell:{rowIndex:e.rowIndex,colIndex:l},fillRange:[o+1,s,e.rowIndex,l],direction:"Down"}:{startCell:h,endCell:{rowIndex:o,colIndex:g.colIndex},fillRange:[a,l+1,o,g.colIndex],direction:"Right"}:e.colIndex<n.colIndex?e.rowIndex-o>l-e.colIndex||e.rowIndex-a>l-e.colIndex&&e.rowIndex!==o?{startCell:h,endCell:{rowIndex:e.rowIndex,colIndex:l},fillRange:[o+1,s,e.rowIndex,l],direction:"Down"}:d?{startCell:h,endCell:f}:{startCell:f,endCell:{rowIndex:a,colIndex:g.colIndex},fillRange:[a,g.colIndex,o,s-1],direction:"Left"}:e.rowIndex>n.rowIndex?{startCell:h,endCell:{rowIndex:g.rowIndex,colIndex:l},fillRange:[o+1,s,g.rowIndex,l],direction:"Down"}:(e.rowIndex===n.rowIndex&&(e.colIndex,n.colIndex),{startCell:p,endCell:u})},r.prototype.modifyRangeForMerge=function(e,t,r,n,i){var a={rowIndex:e,colIndex:t};if(this.isMergedRange(i)){var s=i[2]-i[0]+1,o=i[3]-i[1]+1,l=void 0;e<r?(l=(i[2]-e+1)%s)&&e-(s-l)>=0&&(a.rowIndex=e-(s-l)):t>n?(l=(t-i[1]+1)%o)&&(a.colIndex=t+(o-l)):t<n?(l=(i[3]-t+1)%o)&&t-(o-l)>=0&&(a.colIndex=t-(o-l)):e>r&&(l=(e-i[0]+1)%s)&&(a.rowIndex=e+(s-l))}return a},r.prototype.performAutoFill=function(e){if(!e.rangeInfo&&(e.event.clientX>this.autoFillElementPosition.left&&e.event.clientX<this.autoFillElementPosition.left+10)&&(e.event.clientY>this.autoFillElementPosition.top&&e.event.clientY<this.autoFillElementPosition.top+10))this.positionAutoFillElement({isautofill:!1});else{var r=void 0;if(e.rangeInfo)r=e.rangeInfo;else{var n={clientY:ld(e.event),target:e.event.target},i={clientX:od(e.event),target:e.event.target};this.parent.notify(ys,n),this.parent.notify(Cs,i),r=this.getAutoFillRange({rowIndex:n.clientY,colIndex:i.clientX})}var s=this.parent.getActiveSheet();if(r&&r.fillRange){var o={dataRange:s.name+"!"+e.dAutoFillCell,fillRange:s.name+"!"+a(r.fillRange),direction:r.direction,fillType:e.fillType||this.parent.autoFillSettings.fillType,cancel:!1};if(zd(this.parent,t(e.dAutoFillCell))||zd(this.parent,r.fillRange))return void this.parent.notify(Ka,null);if(this.parent.notify(K,{eventArgs:o,action:"autofill"}),o.cancel)return;var l=Td(this.parent,r.fillRange);if(s.isProtected&&l)return void this.parent.notify(Xa,null);e.rangeInfo?this.performAutoFillAction(o,null,l):(this.performAutoFillAction(o,r,l),this.positionAutoFillElement({isautofill:!0}))}}},r.prototype.refreshCell=function(e){this.parent.serviceLocator.getService("cell").refreshRange([e.rowIndex,e.colIndex,e.rowIndex,e.colIndex])},r.prototype.getDirection=function(t,r,n){if(n=(0,e.isNullOrUndefined)(n)?this.isVerticalFill:n){if(r.rowIndex<t.rowIndex)return"Up";if(r.rowIndex>t.rowIndex)return"Down";if(r.colIndex>t.colIndex)return"Right";if(r.colIndex<t.colIndex)return"Left"}else{if(r.colIndex>t.colIndex)return"Right";if(r.colIndex<t.colIndex)return"Left";if(r.rowIndex<t.rowIndex)return"Up";if(r.rowIndex>t.rowIndex)return"Down"}return null},r.prototype.performAutoFillAction=function(e,r,n){var i=this,s=this.parent.getActiveSheet(),o=this.parent.serviceLocator.getService(kl);if(this.isMergedRange(t(e.fillRange))){var l=this.parent.serviceLocator.getService(Al);l.show({isModal:!0,showCloseIcon:!0,height:180,width:400,content:o.getConstant("AutoFillMergeAlertMsg"),buttons:[{buttonModel:{content:this.parent.serviceLocator.getService(kl).getConstant("Ok"),isPrimary:!0},click:function(){l.hide(),i.parent.selectRange(e.dataRange)}}],close:function(){l.hide(),i.parent.selectRange(e.dataRange)}},!1)}else{this.isVerticalFill="Down"===e.direction||"Up"===e.direction,this.parent.notify(Xt,{dataRange:e.dataRange,fillRange:e.fillRange,direction:e.direction,fillType:e.fillType,isLockedCell:n});var d=r?a([r.startCell.rowIndex,r.startCell.colIndex,r.endCell.rowIndex,r.endCell.colIndex]):s.selectedRange;xn(this.parent,d,s);var h={dataRange:e.dataRange,fillRange:e.fillRange,fillType:e.fillType,direction:e.direction,selectedRange:d};this.parent.notify(ka,{eventArgs:h,action:s.conditionalFormats&&s.conditionalFormats.length>0&&"autofillWithCF"===s.conditionalFormats[s.conditionalFormats.length-1].action?"autofillWithCF":"autofill"}),this.parent.trigger("select",{range:this.parent.getActiveSheet().selectedRange}),this.parent.showAggregate&&this.parent.notify(ns,{}),this.parent.notify(Mt,null)}},r.prototype.getRangeData=function(e){for(var t,r=[],n=this.parent.getActiveSheet(),i=e.range[0],a=e.range[1],s=e.range[2],o=e.range[3],l=a;i<=s;)if(cl(n,i))i++;else{for(a=l;a<=o;)Il(n,a)||(t=Ln(i,a,n),r.push(t)),a++;i++}return r},r.prototype.isMergedRange=function(e){var t=0,r=this.getRangeData({range:e,sheetIdx:this.parent.activeSheetIndex});for(t=0;t<r.length;t++)if(r[t]&&(r[t].rowSpan||r[t].colSpan))return!0;return!1},r.prototype.addEventListener=function(){this.parent.on(Zn,this.createAutoFillElement,this),this.parent.on(Gs,this.positionAutoFillElement,this),this.parent.on(Ys,this.hideAutoFillOptions,this),this.parent.on(Zs,this.hideAutoFillElement,this),this.parent.on(Xs,this.performAutoFill,this),this.parent.on(Ks,this.selectAutoFillRange,this),this.parent.on(Kt,this.refreshCell,this),this.parent.on(Zt,this.getautofillDDB,this)},r.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(Zn,this.createAutoFillElement),this.parent.off(Gs,this.positionAutoFillElement),this.parent.off(Ys,this.hideAutoFillOptions),this.parent.off(Zs,this.hideAutoFillElement),this.parent.off(Xs,this.performAutoFill),this.parent.off(Ks,this.selectAutoFillRange),this.parent.off(Kt,this.refreshCell),this.parent.off(Zt,this.getautofillDDB))},r.prototype.destroy=function(){this.removeEventListener(),this.autoFillElement&&this.autoFillElement.remove(),this.autoFillElement=null,this.autoFillElementPosition=null,this.autoFillCell=null,this.autoFillDropDown&&this.autoFillDropDown.destroy(),this.autoFillDropDown=null,this.isVerticalFill=null,this.fillOptionIndex=null,this.splitBtnElem&&(Hl(this.splitBtnElem),this.splitBtnElem.remove()),this.splitBtnElem=null,this.parent=null},r.prototype.getModuleName=function(){return"autofill"},r}(),Ah=function(){function t(e){this.isNoteVisible=!1,this.isNoteVisibleOnTouch=!1,this.parent=e,this.addEventListener()}return t.prototype.destroy=function(){if(this.removeEventListener(),!this.parent.isDestroyed&&!this.parent.refreshing)for(var t=this.parent.element.getElementsByClassName("e-addNoteIndicator");t.length;){var r=(0,e.closest)(t[0],".e-cell");r&&(e.EventHandler.remove(r,"mouseover",this.mouseOver),e.EventHandler.remove(r,"mouseout",this.mouseOut)),(0,e.detach)(t[0])}this.parent=null,this.isNoteVisible=null},t.prototype.addEventListener=function(){this.parent.on(aa,this.addNote,this),this.parent.on(sa,this.editNote,this),this.parent.on(oa,this.deleteNote,this),this.parent.on(da,this.createNoteIndicator,this),this.parent.on(la,this.showNote,this),this.parent.on(pa,this.removeNoteContainer,this),this.parent.on(ha,this.updateNoteContainer,this)},t.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(aa,this.addNote),this.parent.off(sa,this.editNote),this.parent.off(la,this.showNote),this.parent.off(oa,this.deleteNote),this.parent.off(da,this.createNoteIndicator),this.parent.off(pa,this.removeNoteContainer),this.parent.off(ha,this.updateNoteContainer))},t.prototype.getModuleName=function(){return"spreadsheetNote"},t.prototype.addNote=function(){var t=(0,e.isNullOrUndefined)(this.noteCellIndexes)?r(this.parent.getActiveSheet().activeCell):this.noteCellIndexes,n=this.parent.getCell(t[0],t[1]);!(0,e.isNullOrUndefined)(n)&&(0===n.children.length||n.children.length>0&&-1===n.children[n.childElementCount-1].className.indexOf("e-addNoteIndicator"))&&(this.createNoteIndicator({targetElement:n,rowIndex:t[0],columnIndex:t[1]}),this.createNoteContainer(n,t[0],t[1],!1,!0))},t.prototype.deleteNote=function(t){var n=r(this.parent.getActiveSheet().activeCell),i=(0,e.isNullOrUndefined)(t)||(0,e.isNullOrUndefined)(t.rowIndex)?n[0]:t.rowIndex,a=(0,e.isNullOrUndefined)(t)||(0,e.isNullOrUndefined)(t.columnIndex)?n[1]:t.columnIndex,s=this.parent.getCell(i,a);if(s.children.length>0&&s.children[s.children.length-1].className.indexOf("e-addNoteIndicator")>-1){s.removeChild(s.children[s.children.length-1]),e.EventHandler.remove(s,"mouseover",this.mouseOver),e.EventHandler.remove(s,"mouseout",this.mouseOut);var o=On(this.parent,this.parent.activeSheetIndex)+"!"+this.parent.getActiveSheet().activeCell,l=Ln(i,a,this.parent.getActiveSheet());if(!(0,e.isNullOrUndefined)(t)&&t.isDeleteFromMenu&&this.parent.notify(ya,{args:{action:"beforeCellSave",eventArgs:{address:o}}}),!(0,e.isNullOrUndefined)(l)&&l.notes&&delete l.notes,!(0,e.isNullOrUndefined)(t)&&t.isDeleteFromMenu){var d={notes:l.notes,address:o};this.parent.notify(ka,{eventArgs:d,action:"deleteNote"}),this.isShowNote=null}}},t.prototype.editNote=function(){var t=(0,e.isNullOrUndefined)(this.noteCellIndexes)?r(this.parent.getActiveSheet().activeCell):this.noteCellIndexes;this.showNote({rowIndex:t[0],columnIndex:t[1],isNoteEditable:!0});var n=document.getElementsByClassName("e-addNoteContainer")[0];Hr(this.parent,this.parent.getActiveSheet(),{rowIdx:t[0],colIdx:t[1],preventEvt:!0,cell:{isNoteEditable:!0}}),n&&this.getNoteFocus(n)},t.prototype.createNoteIndicator=function(t){var r=this.parent.createElement("div",{className:"e-addNoteIndicator",styles:"position: absolute;top: 0;right: 0;width: 0;height: 0;border-left: 8px solid transparent;border-top: 8px solid red;cursor: pointer;"});if(t.targetElement.children.length>0)for(var n=fl(this.parent.getActiveSheet(),t.rowIndex),i=0;i<t.targetElement.childElementCount;i++)t.targetElement.children[i].className.indexOf("e-filter-btn")>-1&&(r.style.right=(n<30?t.targetElement.children[i].getBoundingClientRect().width<=0?20:t.targetElement.children[i].getBoundingClientRect().width:2)+"px"),t.targetElement.children[i].className.indexOf("e-validation-list")>-1&&(r.style.right=(t.targetElement.children[i].getBoundingClientRect().width||20)+2+"px");(!(0,e.isNullOrUndefined)(t.targetElement)&&0===t.targetElement.children.length||t.targetElement.children.length>0&&-1===t.targetElement.children[t.targetElement.childElementCount-1].className.indexOf("e-addNoteIndicator"))&&(t.skipEvent||(e.EventHandler.add(t.targetElement,"mouseover",this.mouseOver,[this,t.rowIndex,t.columnIndex]),e.EventHandler.add(t.targetElement,"mouseout",this.mouseOut,this)),t.targetElement.appendChild(r))},t.prototype.mouseOver=function(){var t=this,r=t[0];(r.isNoteVisibleOnTouch&&!(0,e.isNullOrUndefined)(document.getElementsByClassName("e-addNoteContainer")[0])||(0,e.isNullOrUndefined)(document.getElementsByClassName("e-addNoteContainer")[0]))&&((0,e.isNullOrUndefined)(document.getElementsByClassName("e-addNoteContainer")[0])||r.removeNoteContainer(),r.showNote({rowIndex:t[1],columnIndex:t[2],isNoteEditable:!1}),r.isNoteVisible=!0)},t.prototype.mouseOut=function(t){!this.isNoteVisible||this.isNoteVisibleOnTouch||(0,e.isNullOrUndefined)(document.getElementsByClassName("e-addNoteContainer")[0])||-1!==document.activeElement.className.indexOf("e-addNoteContainer")||(0,e.isNullOrUndefined)(t.relatedTarget)||-1!==t.relatedTarget.className.indexOf("e-connectorLine")||-1!==t.relatedTarget.className.indexOf("e-addNoteContainer")||(this.removeNoteContainer(),this.isNoteVisible=!1)},t.prototype.createNoteContainer=function(t,r,n,i,a){var s=Ln(r,n,this.parent.getActiveSheet()),o=t.getBoundingClientRect(),l=this.parent.createElement("textarea",{className:"e-addNoteContainer"});this.createContainer(l,s,o,i),this.createConnectorLine(l,o),a&&this.getNoteFocus(l),e.EventHandler.add(l,"mouseout",this.mouseOut,this),e.EventHandler.add(document.getElementsByClassName("e-connectorLine")[0],"mouseout",this.mouseOut,this)},t.prototype.getNoteFocus=function(e){e.selectionStart=e.value.length,e.focus()},t.prototype.createContainer=function(t,r,n,i){var a=5;!(0,e.isNullOrUndefined)(document.getElementsByClassName("e-select-all-cell")[0])&&!(0,e.isNullOrUndefined)(document.getElementsByClassName("e-scroller")[0])&&n.top>=document.getElementsByClassName("e-select-all-cell")[0].getBoundingClientRect().bottom&&n.right>=document.getElementsByClassName("e-select-all-cell")[0].getBoundingClientRect().right&&n.bottom<=document.getElementsByClassName("e-scroller")[0].getBoundingClientRect().top&&n.right<=document.getElementsByClassName("e-scroller")[0].getBoundingClientRect().width?(t.style.display="block",a=n.top===document.getElementsByClassName("e-select-all-cell")[0].getBoundingClientRect().bottom?0:a):t.style.display="none";var s=this.parent.element.getBoundingClientRect(),o=this.parent.element.style.getPropertyValue("position");t.style.position="absolute",t.style.top=n.top-(s.top-("absolute"===o?0:this.parent.element.offsetTop))-a+"px",t.style.left=n.left+n.width-(s.left-("absolute"===o?0:this.parent.element.offsetLeft))+10+"px",t.style.width="120px",t.style.height="120px",t.style.zIndex="5",t.style.color="black",t.style.backgroundColor="lightyellow",!i||(0,e.isNullOrUndefined)(r)||(0,e.isNullOrUndefined)(r.notes)?t.innerHTML="":t.innerHTML=r.notes,this.parent.element.appendChild(t)},t.prototype.createConnectorLine=function(e,t){var r=this.parent.createElement("canvas",{className:"e-connectorLine",styles:"width: 100px; position: absolute; z-index: 1;"}),n=r.getContext("2d"),i=this.parent.element.getBoundingClientRect(),a=this.parent.element.style.getPropertyValue("position");r.style.left=t.left+t.width-(i.left-("absolute"===a?0:this.parent.element.offsetLeft))+"px",r.style.top=e.getBoundingClientRect().top-(i.top-("absolute"===a?0:this.parent.element.offsetTop))-5+"px",n.clearRect(0,0,r.width,r.height),n.beginPath(),e.getBoundingClientRect().top===t.top?(n.moveTo(0,16),n.lineTo(30,15)):(n.moveTo(0,30),n.lineTo(30,15)),n.strokeStyle="black",n.lineWidth=5,n.stroke(),this.parent.element.appendChild(r),e.getBoundingClientRect().top>0?(r.style.display="block",r.style.zIndex="4"):r.style.display="none"},t.prototype.showNote=function(t){var r=(0,e.isNullOrUndefined)(this.parent.getCell(t.rowIndex,t.columnIndex))?t.cellElement:this.parent.getCell(t.rowIndex,t.columnIndex),n=document.getElementById(this.parent.element.id+"_contextmenu"),i=(0,e.isNullOrUndefined)(n)?"none":n.style.getPropertyValue("display"),a=!!t.isNoteEditable||"block"!==i;!(0,e.isNullOrUndefined)(r)&&(0,e.isNullOrUndefined)(document.getElementsByClassName("e-addNoteContainer")[0])&&a&&(t.isScrollWithNote||null!==r.children&&r.children.length>0&&r.children[r.children.length-1].classList.contains("e-addNoteIndicator"))&&(this.createNoteContainer(r,t.rowIndex,t.columnIndex,!0,t.isNoteEditable),this.noteCellIndexes=[t.rowIndex,t.columnIndex])},t.prototype.removeNoteContainer=function(){e.EventHandler.remove(document.getElementsByClassName("e-addNoteContainer")[0],"mouseout",this.mouseOut),e.EventHandler.remove(document.getElementsByClassName("e-connectorLine")[0],"mouseout",this.mouseOut),this.parent.element.removeChild(document.getElementsByClassName("e-addNoteContainer")[0]),this.parent.element.removeChild(document.getElementsByClassName("e-connectorLine")[0]),this.noteCellIndexes=null,this.isNoteVisible=!1,this.isNoteVisibleOnTouch=!1},t.prototype.updateNoteContainer=function(){this.parent.selectionModule.isNoteActiveElement=document.activeElement.className.indexOf("e-addNoteContainer")>-1||this.parent.selectionModule.isNoteActiveElement;var t=(0,e.isNullOrUndefined)(this.noteCellIndexes)?r(this.parent.getActiveSheet().activeCell):this.noteCellIndexes,n=Ln(t[0],t[1],this.parent.getActiveSheet()),i=document.getElementsByClassName("e-addNoteContainer")[0];if(((0,e.isNullOrUndefined)(n)||(0,e.isNullOrUndefined)(n.notes)||n.notes!==i.value)&&this.parent.selectionModule.isNoteActiveElement){var s=On(this.parent,this.parent.activeSheetIndex)+"!"+a(t);this.parent.notify(ya,{args:{action:"beforeCellSave",eventArgs:{address:s}}});var o=!(0,e.isNullOrUndefined)(n)&&n.notes?"editNote":"addNote";Hr(this.parent,this.parent.getActiveSheet(),{rowIdx:t[0],colIdx:t[1],preventEvt:!0,cell:{notes:i.value,isNoteEditable:!0}});var l={notes:i.value,address:s};this.parent.notify(ka,{eventArgs:l,action:o}),this.isShowNote=null}if(this.isShowNote=(0,e.isNullOrUndefined)(this.isShowNote)?this.parent.selectionModule.isNoteActiveElement:this.isShowNote,this.isShowNote){var d=!(0,e.isNullOrUndefined)(n)&&!(0,e.isNullOrUndefined)(n.isNoteEditable)&&n.isNoteEditable;this.parent.notify(pa,""),this.parent.notify(la,{rowIndex:t[0],columnIndex:t[1],isNoteEditable:!0,isScrollWithNote:d})}else this.parent.notify(pa,""),this.isShowNote=null},t}(),Fh=function(){function t(e){this.parent=e}return t.prototype.show=function(t,r){var n,i=this;r=!!(0,e.isNullOrUndefined)(r);var a=t.close||null,s={header:"Spreadsheet",cssClass:this.parent.cssClass,target:this.parent.element,buttons:[],allowDragging:!0};t.close=function(){i.destroyDialog(),a&&a()},(0,e.extend)(s,t),r&&(n=this.parent.serviceLocator.getService(kl).getConstant(s.buttons.length?"Cancel":"Ok"),s.buttons.push({buttonModel:{content:n,isPrimary:0===s.buttons.length},click:this.hide.bind(this)}));var o=this.parent.createElement("div");document.body.appendChild(o),this.dialogInstance=new dh.Dialog(s),this.dialogInstance.createElement=this.parent.createElement,this.dialogInstance.appendTo(o),this.dialogInstance&&this.dialogInstance.refreshPosition()},t.prototype.destroyDialog=function(){this.dialogInstance.destroy(),(0,e.remove)(this.dialogInstance.element),this.dialogInstance=null},t.prototype.hide=function(e){this.dialogInstance&&(e&&(this.dialogInstance.animationSettings.effect="None",this.dialogInstance.dataBind()),this.dialogInstance.hide())},t.prototype.destroy=function(){this.parent=null},t}(),Th=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.initializeActionBegin=function(){var e=this,t=this.parent.beforeCellFormat;this.parent.beforeCellFormat=function(r){e.actionEventHandler({evtArgs:r,evtFunc:t,actionType:"begin",eventType:"format"})};var r=this.parent.beforeOpen;this.parent.beforeOpen=function(t){e.actionEventHandler({evtArgs:t,evtFunc:r,actionType:"begin",eventType:"beforeOpen"})};var n=this.parent.beforeSave;this.parent.beforeSave=function(t){e.actionEventHandler({evtArgs:t,evtFunc:n,actionType:"begin",eventType:"beforeSave"})};var i=this.parent.beforeSort;this.parent.beforeSort=function(t){e.actionEventHandler({evtArgs:t,evtFunc:i,actionType:"begin",eventType:"beforeSort"})}},e.prototype.initializeActionComplete=function(){var e=this,t=this.parent.sortComplete;this.parent.sortComplete=function(r){e.actionEventHandler({evtArgs:r,evtFunc:t,actionType:"complete",eventType:"sorting"})};var r=this.parent.cellSave;this.parent.cellSave=function(t){e.actionEventHandler({evtArgs:t,evtFunc:r,actionType:"complete",eventType:"cellSave"})}},e.prototype.actionEventHandler=function(e){e.evtFunc&&e.evtFunc.apply(this,[e]),"begin"===e.actionType?this.actionBeginHandler({eventArgs:e.evtArgs,action:e.eventType}):this.actionCompleteHandler({eventArgs:e.evtArgs,action:e.eventType})},e.prototype.actionBeginHandler=function(e){var t=e.preventAction;delete e.preventAction;var r={action:e.action};e.isUndo&&(r.isUndo=!0,delete e.isUndo),e.isRedo&&(r.isUndo=!1,delete e.isRedo),r.args=e,this.parent.trigger("actionBegin",r),t||this.parent.isPrintingProcessing||"clipboard"!==e.action&&"format"!==e.action&&"cellSave"!==e.action&&"addNote"!==e.action&&"editNote"!==e.action&&"deleteNote"!==e.action&&"beforeWrap"!==e.action&&"beforeReplace"!==e.action&&"filter"!==e.action&&"beforeClear"!==e.action&&"beforeInsertImage"!==e.action&&"beforeInsertChart"!==e.action&&"chartDesign"!==e.action&&"cellDelete"!==e.action&&"autofill"!==e.action&&"removeValidation"!==e.action&&"hyperlink"!==e.action&&"removeHyperlink"!==e.action&&"deleteImage"!==e.action||this.parent.notify(ya,{args:e}),t&&(e.preventAction=!0),r.isUndo&&(e.isUndo=!0),!1===r.isUndo&&(e.isRedo=!0)},e.prototype.actionCompleteHandler=function(e){var t=e.preventAction;delete e.preventAction,this.parent.notify(G,e),e.preventEventTrigger||this.parent.trigger("actionComplete",e),t||"undoRedo"===e.action||"gotoSheet"===e.action||this.parent.notify(va,{args:e}),this.parent.notify(Gs,null)},e.prototype.addEventListener=function(){this.parent.on(ka,this.actionCompleteHandler,this),this.parent.on(K,this.actionBeginHandler,this),this.parent.on(Qn,this.removeEventListener,this)},e.prototype.removeEventListener=function(){this.parent.off(ka,this.actionCompleteHandler),this.parent.off(K,this.actionBeginHandler),this.parent.off(Qn,this.removeEventListener)},e}(),Dh=function(){function n(e){this.minHeight="300px",this.minWidth="400px",this.isOverlayClicked=!1,this.isResizerClicked=!1,this.currentWidth=400,this.currenHeight=300,this.parent=e,this.parent.on(_s,this.isOverlaySelected,this),this.parent.on(ms,this.refreshOverlayElem,this),this.parent.on(Qn,this.destroy,this)}return n.prototype.insertOverlayElement=function(n,i,a){var s=this.parent.createElement("div",{id:n,attrs:{class:"e-ss-overlay"},styles:"width: "+this.minWidth+"; height: "+this.minHeight});if(this.parent.allowEditing){var o=this.parent.element.getElementsByClassName("e-ss-overlay-active")[0];o&&((0,e.removeClass)([o],"e-ss-overlay-active"),this.parent.notify(Ts,{})),s.classList.add("e-ss-overlay-active")}var l,d=t(i),h=this.parent.sheets[a],p=this.parent.frozenRowCount(h),c=this.parent.frozenColCount(h),u=Gl(h,d,p,c,this.parent.viewport.beforeFreezeHeight,this.parent.viewport.beforeFreezeWidth,this.parent.sheetModule.colGroupWidth,!0);if(d[0]>=p&&d[1]<c){var f=this.parent.sheetModule.contentPanel;f.scrollTop&&(u.top-=f.scrollTop,u.top+=this.parent.getColumnHeaderContent().parentElement.getBoundingClientRect().height)}if(d[1]>=c&&d[0]<p){var g=this.parent.getScrollElement();g.scrollLeft&&(u.left-=g.scrollLeft,u.left+=this.parent.sheetModule.getRowHeaderWidth(h))}return d[0]<p||d[1]<c?(l=this.parent.element.querySelector("#"+this.parent.element.id+"_sheet"),p&&(d[0]>=p?u.top+=(h.showHeaders?31:0)+ml(h,r(h.topLeftCell)[0],p-1):c||(u.left+=this.parent.sheetModule.getRowHeaderWidth(h,!0))),c&&(d[1]>=c?u.left+=this.parent.sheetModule.getRowHeaderWidth(h):p||(u.left+=h.showHeaders?31:0))):l=this.parent.getMainContent(),s.style.top=Number(Hd(u.top).toFixed(2))+"px",s.style.left=Number(Hd(u.left).toFixed(2))+"px",a===this.parent.activeSheetIndex?(l.appendChild(s),this.renderResizeHandler(s),this.addEventListener(s)):this.parent.isPrintingProcessing&&(s.style.visibility="hidden",document.body.append(s)),this.originalWidth=parseFloat(getComputedStyle(s,null).getPropertyValue("width").replace("px","")),this.originalHeight=parseFloat(getComputedStyle(s,null).getPropertyValue("height").replace("px","")),{element:s,top:u.top,left:u.left}},n.prototype.adjustFreezePaneSize=function(n,i,a){var s=t(a),o=this.parent.getActiveSheet(),l=this.parent.frozenRowCount(o),d=this.parent.frozenColCount(o);if(s[0]<l||s[1]<d?((0,e.isNullOrUndefined)(n.top)||(i.style.top=n.top+(o.showHeaders?31:0)-this.parent.viewport.beforeFreezeHeight+"px"),(0,e.isNullOrUndefined)(n.left)||(i.style.left=n.left+this.parent.sheetModule.getRowHeaderWidth(o,!0)-this.parent.viewport.beforeFreezeWidth+"px")):((0,e.isNullOrUndefined)(n.top)||(i.style.top=n.top-this.parent.viewport.beforeFreezeHeight-(l?ml(o,r(o.topLeftCell)[0],l-1):0)+"px"),(0,e.isNullOrUndefined)(n.left)||(i.style.left=n.left-this.parent.viewport.beforeFreezeWidth-(d?wl(o,r(o.topLeftCell)[1],d-1):0)+"px")),(0,e.isNullOrUndefined)(n.top)){var h=r(o.topLeftCell)[0];n.top=this.parent.viewport.beforeFreezeHeight+(l&&h===s[0]?0:ml(o,l?h:0,s[0]-1))}if((0,e.isNullOrUndefined)(n.left)){var p=r(o.topLeftCell)[1];n.left=this.parent.viewport.beforeFreezeWidth+(d&&p===s[1]?0:wl(o,d?p:0,s[1]-1))}},n.prototype.addEventListener=function(t){var r=t;e.EventHandler.add(r,Zl(),this.overlayClickHandler,this),e.EventHandler.add(r,Jl(),this.overlayMouseMoveHandler,this),e.EventHandler.add(this.parent.element.querySelector("#"+this.parent.element.id+"_sheet"),Jl(),this.overlayMouseMoveHandler,this),e.EventHandler.add(document,Ql(),this.overlayMouseUpHandler,this),this.parent.on(qs,this.setOriginalSize,this)},n.prototype.setOriginalSize=function(e){this.originalHeight=e.height,this.originalWidth=e.width},n.prototype.overlayMouseMoveHandler=function(t){var r,n,i,a,s,o,l=t.target,d=document.getElementsByClassName("e-ss-overlay-active")[0],h=this.parent.getActiveSheet(),p=h.frozenRows||h.frozenColumns?[29,this.parent.sheetModule.getRowHeaderWidth(h,!0)]:[-1,-1];if(this.isOverlayClicked&&this.isResizerClicked)switch(td(t)&&t.preventDefault(),this.resizer){case"e-ss-overlay-t":r=Math.max(this.originalMouseY-ld(t)+this.originalHeight,20),n=ld(t)-(this.originalMouseY-this.originalResizeTop),r>20&&n>p[0]&&(d.style.height=r+"px",d.style.top=n+"px",this.resizedReorderTop=n,this.currenHeight=r,this.parent.notify(Ht,{height:d.style.height,width:d.style.width,overlayEle:d}));break;case"e-ss-overlay-r":(i=this.originalWidth+(dd(t)-this.originalMouseX))>20&&(d.style.width=i+"px",this.currentWidth=i,this.parent.notify(Ht,{height:d.style.height,width:d.style.width,overlayEle:d}));break;case"e-ss-overlay-b":(a=this.originalHeight+(hd(t)-this.originalMouseY))>20&&(d.style.height=a+"px",this.currenHeight=a,this.parent.notify(Ht,{height:d.style.height,width:d.style.width,overlayEle:d}));break;case"e-ss-overlay-l":s=Math.max(this.originalMouseX-od(t)+this.originalWidth,20),o=od(t)-(this.originalMouseX-this.originalResizeLeft),s>20&&o>p[1]&&(d.style.width=s+"px",d.style.left=o+"px",this.resizedReorderLeft=o,this.currentWidth=s,this.parent.notify(Ht,{height:d.style.height,width:d.style.width,overlayEle:d}))}else if(this.isOverlayClicked)if(td(t)&&t.preventDefault(),(0,e.closest)(l,".e-sheet")&&!l.classList.contains("e-sheet-content")||l.classList.contains("e-cell")){if(!d)return;var c=od(t)-this.diffX,u=ld(t)-this.diffY;c>p[1]&&(d.style.left=c+"px"),u>p[0]&&(d.style.top=u+"px"),this.resizedReorderLeft=c<0?0:c,this.resizedReorderTop=u<0?0:u}else this.overlayMouseUpHandler(t,!0)},n.prototype.overlayMouseUpHandler=function(t,r){if(this.parent&&!this.parent.getActiveSheet().isProtected&&this.parent.allowEditing){this.isResizerClicked=!1;var n=t.target,i=document.getElementsByClassName("e-datavisualization-chart e-ss-overlay-active");n.classList.contains("e-ss-overlay")||(n=(0,e.closest)(t.target,".e-datavisualization-chart")?(0,e.closest)(t.target,".e-datavisualization-chart"):n);var a=this.parent.getActiveSheet(),s={prevTop:a.frozenRows||a.frozenColumns?this.prevY:this.originalReorderTop,prevLeft:a.frozenRows||a.frozenColumns?this.prevX:this.originalReorderLeft,currentTop:this.resizedReorderTop>=0?parseInt(this.resizedReorderTop.toString(),10):this.originalReorderTop,currentLeft:this.resizedReorderLeft>=0?parseInt(this.resizedReorderLeft.toString(),10):this.originalReorderLeft,id:n.id,currentHeight:this.currenHeight,currentWidth:this.currentWidth,requestType:"imageRefresh",prevHeight:this.originalHeight,prevWidth:this.originalWidth};if(this.isOverlayClicked||r){var o=void 0,l=void 0,d={clientY:s.prevTop,isImage:!0},h={clientX:s.prevLeft,isImage:!0},p=this.parent.element.getElementsByClassName("e-ss-overlay-active")[0];if(a.frozenRows||a.frozenColumns){if(!p)return;d.isImage=!1,h.isImage=!1,d.target=p,h.target=p,s.prevTop<this.parent.getColumnHeaderContent().getBoundingClientRect().bottom&&(d.target=this.parent.getColumnHeaderContent()),s.prevLeft<this.parent.getRowHeaderContent().getBoundingClientRect().right&&(h.target=this.parent.getRowHeaderTable());var c=p.getBoundingClientRect();o={clientY:c.top},l={clientX:c.left},c.top<this.parent.getColumnHeaderContent().getBoundingClientRect().bottom&&(o.target=this.parent.getColumnHeaderContent()),c.left<this.parent.getRowHeaderContent().getBoundingClientRect().right&&(l.target=this.parent.getRowHeaderTable())}else o={clientY:s.currentTop,isImage:!0},l={clientX:s.currentLeft,isImage:!0};if(this.parent.notify(ys,d),this.parent.notify(ys,o),this.parent.notify(Cs,h),this.parent.notify(Cs,l),o.size&&(s.currentTop=o.size),l.size&&(s.currentLeft=l.size),s.prevRowIdx=d.clientY,s.prevColIdx=h.clientX,s.currentRowIdx=o.clientY,s.currentColIdx=l.clientX,(a.frozenColumns||a.frozenRows)&&!(0,e.closest)(p,".e-sheet-content")){var u=this.parent.frozenColCount(a),f=this.parent.frozenRowCount(a);if(s.currentRowIdx>=f&&s.currentColIdx>=u){var g=parseInt(p.style.top,10),m=parseInt(p.style.left,10);g+=this.parent.sheetModule.contentPanel.scrollTop,g-=this.parent.getColumnHeaderContent().parentElement.getBoundingClientRect().height,m+=this.parent.getScrollElement().scrollLeft,m-=this.parent.sheetModule.getRowHeaderWidth(a),p.style.top=g+"px",p.style.left=m+"px",this.parent.getMainContent().appendChild(p)}}i&&i[0]&&i[0].querySelector(".e-control")&&(s.id=i[0].id),this.originalReorderTop!==this.resizedReorderTop||this.originalReorderLeft!==this.resizedReorderLeft?(s.id=p.id,i&&i[0]?(s.requestType="chartRefresh",this.parent.notify(ws,s)):this.parent.notify(vs,s),this.resizedReorderTop=this.originalReorderTop,this.resizedReorderLeft=this.originalReorderLeft):this.currenHeight===this.originalHeight&&this.originalWidth===this.currentWidth||(s.id=n.id.indexOf("overlay")>0?n.id:n.parentElement&&n.parentElement.classList.contains("e-ss-overlay")?n.parentElement.id:p.id,i&&i[0]?(s.requestType="chartRefresh",this.parent.notify(ws,s)):this.parent.notify(vs,s),this.originalHeight=this.currenHeight,this.originalWidth=this.currentWidth)}this.isOverlayClicked=!1}},n.prototype.isOverlaySelected=function(e){e.isOverlayClicked=this.isOverlayClicked},n.prototype.refreshOverlayElem=function(t){if(t){var r=".e-ss-overlay-active"+(t&&t.selector||""),n=this.parent.element.querySelector(r);n&&((0,e.removeClass)([n],"e-ss-overlay-active"),this.parent.notify(Ts,{}))}else{r="e-ss-overlay-active";for(var i=Array.from(this.parent.element.getElementsByClassName(r)),a=0;a<i.length;a++){var s=i[a];s&&((0,e.removeClass)([s],"e-ss-overlay-active"),this.parent.notify(Ts,{}))}}this.parent.notify(Os,null)},n.prototype.overlayClickHandler=function(t){if(!this.parent.getActiveSheet().isProtected&&this.parent.allowEditing){this.isOverlayClicked=!0;var r=t.target,n=t.target;r.classList.contains("e-ss-overlay")||(n=r.parentElement,(0,e.closest)(t.target,".e-datavisualization-chart")&&(n=(0,e.closest)(t.target,".e-datavisualization-chart")));var i=this.parent.getActiveSheet();if((i.frozenColumns||i.frozenRows)&&(0,e.closest)(n,".e-sheet-content")){var a=parseInt(n.style.top,10),s=parseInt(n.style.left,10);a-=this.parent.sheetModule.contentPanel.scrollTop,a+=this.parent.getColumnHeaderContent().parentElement.getBoundingClientRect().height,s-=this.parent.getScrollElement().scrollLeft,s+=this.parent.sheetModule.getRowHeaderWidth(i),n.style.top=a+"px",n.style.left=s+"px",this.parent.element.querySelector("#"+this.parent.element.id+"_sheet").appendChild(n)}this.originalWidth=this.currentWidth=parseFloat(n.style.width),this.originalHeight=this.currenHeight=parseFloat(n.style.height),this.originalReorderLeft=parseFloat(n.style.left),this.originalReorderTop=parseFloat(n.style.top),this.resizedReorderLeft=parseFloat(n.style.left),this.resizedReorderTop=parseFloat(n.style.top),this.originalResizeTop=this.originalReorderTop,this.originalResizeLeft=this.originalReorderLeft,this.originalMouseX=od(t),this.originalMouseY=ld(t),this.diffX=this.originalMouseX-this.originalReorderLeft,this.diffY=this.originalMouseY-this.originalReorderTop;var o=document.getElementsByClassName("e-ss-overlay-active")[0];o&&(0,e.removeClass)([o],"e-ss-overlay-active"),this.parent.element.querySelector("#"+n.id).classList.add("e-ss-overlay-active"),r.classList.contains("e-ss-resizer")&&(this.resizer=r.classList[0],this.isResizerClicked=!0),n.classList.contains("e-datavisualization-chart")&&(this.parent.notify(zt,{id:n.id}),o||this.parent.notify(Fs,{id:n.id}));var l=n.getBoundingClientRect();this.prevX=l.left,this.prevY=l.top}},n.prototype.renderResizeHandler=function(t){for(var r,n=["e-ss-overlay-t","e-ss-overlay-r","e-ss-overlay-b","e-ss-overlay-l"],i=0;i<n.length;)r=this.parent.createElement("div",{className:n[i]+" e-ss-resizer"+(e.Browser.isDevice?" e-ss-resizer-touch":""),styles:"width: 8px; height: 8px; border-radius: 4px;"}),t.appendChild(r),i++},n.prototype.removeEventListener=function(){var t=this.parent.element.querySelectorAll(".e-ss-overlay");if(t.length)for(var r=0;r<t.length;r++)e.EventHandler.remove(t[r],Zl(),this.overlayClickHandler),e.EventHandler.remove(t[r],Jl(),this.overlayMouseMoveHandler);var n=this.parent.element.querySelector("#"+this.parent.element.id+"_sheet");n&&e.EventHandler.remove(n,Jl(),this.overlayMouseMoveHandler),document&&e.EventHandler.remove(document,Ql(),this.overlayMouseUpHandler),this.parent.isDestroyed||(this.parent.off(qs,this.setOriginalSize),this.parent.off(_s,this.isOverlaySelected),this.parent.off(ms,this.refreshOverlayElem),this.parent.off(Qn,this.destroy))},n.prototype.destroy=function(){this.removeEventListener(),this.currentWidth&&(this.currentWidth=null),this.currenHeight&&(this.currenHeight=null),this.minHeight&&(this.minHeight=null),this.minWidth&&(this.minWidth=null),this.isOverlayClicked&&(this.isOverlayClicked=null),this.isResizerClicked&&(this.isResizerClicked=null),this.parent=null},n}(),Lh=function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},e(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Ph=function(){return Ph=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Ph.apply(this,arguments)},Mh=function(e,t,r,n){var i,a=arguments.length,s=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,n);else for(var o=e.length-1;o>=0;o--)(i=e[o])&&(s=(a<3?i(s):a>3?i(t,r,s):i(t,r))||s);return a>3&&s&&Object.defineProperty(t,r,s),s},Bh=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return Lh(r,t),Mh([(0,e.Property)("")],r.prototype,"text",void 0),Mh([(0,e.Property)("")],r.prototype,"iconCss",void 0),Mh([(0,e.Property)("left")],r.prototype,"iconPosition",void 0),r}(e.ChildProperty),Hh=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return Lh(r,t),Mh([(0,e.Complex)({},Bh)],r.prototype,"header",void 0),Mh([(0,e.Collection)([],ch.Item)],r.prototype,"content",void 0),Mh([(0,e.Property)("")],r.prototype,"cssClass",void 0),Mh([(0,e.Property)(!1)],r.prototype,"disabled",void 0),r}(e.ChildProperty),Uh=function(t){function r(e,r){return t.call(this,e)||this}return Lh(r,t),r.prototype.preRender=function(){},r.prototype.render=function(){this.element.id||(this.element.id=(0,e.getUniqueID)("ribbon")),this.renderRibbon()},r.prototype.destroy=function(){var r=this.element.querySelector(".e-drop-icon");if(r&&r.removeEventListener("click",this.ribbonExpandCollapse.bind(this)),this.menuItems.length){var n=document.getElementById(this.element.id+"_menu");n&&(0,e.getComponent)(n,"menu").destroy()}this.toolbarObj&&this.toolbarObj.destroy(),this.tabObj&&this.tabObj.destroy(),this.element.innerHTML="",this.toolbarObj=null,this.tabObj=null,t.prototype.destroy.call(this)},r.prototype.getTabItems=function(){var e=this,t=[];return this.menuItems.length&&t.push({header:{text:this.initMenu(this.menuItems)},content:this.toolbarObj.element,cssClass:"e-menu-tab"}),this.items.forEach((function(r){t.push({header:r.header,content:e.toolbarObj.element})})),t},r.prototype.initMenu=function(t){var r=this,n=this.createElement("ul",{id:this.element.id+"_menu"});this.element.appendChild(n);var i=new ch.Menu({cssClass:"e-file-menu",items:t,showItemOnClick:!0,beforeOpen:function(e){e.parentItem.text===t[0].text&&(i.showItemOnClick=!1),r.trigger("beforeOpen",e)},select:function(e){r.trigger("fileMenuItemSelect",e)},beforeClose:function(n){"mouseover"!==n.event.type||(0,e.closest)(n.event.target,".e-menu-popup")?(r.trigger("beforeClose",n),n.parentItem&&n.parentItem.text!==t[0].text||i.setProperties({showItemOnClick:!0},!0)):n.cancel=!0},beforeItemRender:function(e){r.trigger("beforeFileMenuItemRender",e)},created:function(){i.element.removeAttribute("tabindex");var e=i.element.querySelector(".e-menu-item");e&&e.removeAttribute("tabindex")}});return i.createElement=this.createElement,i.appendTo(n),n.parentElement},r.prototype.renderRibbon=function(){var t,r=this,n=this.createElement("div"),i=this.createElement("div");this.toolbarObj=new ch.Toolbar({items:this.items[this.selectedTab].content,clicked:function(e){return r.trigger("clicked",e)}}),this.toolbarObj.createElement=this.createElement,this.toolbarObj.appendTo(i),this.tabObj=new ch.Tab({selectedItem:this.getIndex(this.selectedTab),animation:{next:{duration:0},previous:{duration:0}},items:this.getTabItems(),selecting:function(n){if(n.isSwiped)n.cancel=!0;else if(t=n.event&&n.event.isShortcut,r.menuItems.length&&0===n.selectingIndex){if(n.cancel=!0,(!n.event||t||"keydown"===n.event.type)&&n.selectingItem){var i=n.selectingItem.querySelector(".e-file-menu .e-menu-item");i&&i.click()}}else{if(n.selectingIndex===r.getIndex(r.selectedTab))return;r.updateToolbar(r.getIndex(n.selectingIndex,!0)),r.toolbarObj.dataBind(),r.refreshTemplateItems(r.toolbarObj),r.element.classList.contains("e-collapsed")&&e.EventHandler.remove(n.selectedItem,"click",r.ribbonExpandCollapse);var a=void 0;r.menuItems.length?((a=Ph({},n)).selectingIndex-=1,a.selectedIndex-=1):a=n,r.trigger("selecting",a)}},selected:function(e){e.isInteracted||t||(e.preventFocus=!0),e.selectedIndex!==r.getIndex(r.selectedTab)&&(r.setProperties({selectedTab:r.getIndex(e.selectedIndex,!0)},!0),r.element.classList.contains("e-collapsed")&&(r.element.classList.remove("e-collapsed"),r.trigger("expandCollapse",{element:r.toolbarObj.element,expanded:!0})))},created:function(){r.toolbarObj.refreshOverflow()}}),this.element.appendChild(n),this.tabObj.createElement=this.createElement,this.tabObj.appendTo(n);var a=this.createElement("span",{className:"e-drop-icon e-icons"});a.addEventListener("click",this.ribbonExpandCollapse.bind(this)),this.element.appendChild(a)},r.prototype.ribbonExpandCollapse=function(t){var r,n={element:this.toolbarObj.element,expanded:!0};this.element.classList.contains("e-collapsed")?(r=this.tabObj.element.querySelector(".e-tab-header").getElementsByClassName("e-toolbar-item")[this.tabObj.selectedItem],this.element.classList.remove("e-collapsed"),r.classList.add("e-active"),e.EventHandler.remove(r,"click",this.ribbonExpandCollapse),this.trigger("expandCollapse",n)):(r=this.tabObj.element.querySelector(".e-tab-header .e-toolbar-item.e-active"),this.element.classList.add("e-collapsed"),n.expanded=!1,r.classList.remove("e-active"),e.EventHandler.add(r,"click",this.ribbonExpandCollapse,this),this.trigger("expandCollapse",n))},r.prototype.getIndex=function(e,t){return this.menuItems.length?t?e-1:e+1:e},r.prototype.updateToolbar=function(e){this.toolbarObj.items=this.items[e].content,this.toolbarObj.dataBind()},r.prototype.refreshTemplateItems=function(e){this.spreadInstance&&this.spreadInstance.isReact&&this.spreadInstance.portals&&e&&e.portals&&(this.spreadInstance.portals=this.spreadInstance.portals.concat(e.portals),this.spreadInstance.renderReactTemplates())},r.prototype.enableMenuItems=function(t,r,n){void 0===r&&(r=!0),this.menuItems.length&&(0,e.getComponent)(document.getElementById(this.element.id+"_menu"),"menu").enableItems(t,r,n)},r.prototype.hideMenuItems=function(t,r,n){if(void 0===r&&(r=!0),this.menuItems.length){var i=(0,e.getComponent)(document.getElementById(this.element.id+"_menu"),"menu");r?i.hideItems(t,n):i.showItems(t,n)}},r.prototype.addMenuItems=function(t,r,n,i){if(void 0===n&&(n=!0),this.menuItems.length){var a=(0,e.getComponent)(document.getElementById(this.element.id+"_menu"),"menu");n?a.insertAfter(t.reverse(),r,i):a.insertBefore(t,r,i)}},r.prototype.hideTabs=function(e,t){var r,n,i,a,s=this;if(void 0===t&&(t=!0),t||(a=this.isAllHidden()),e.forEach((function(e){(r=s.getTabIndex(e,-1))>-1&&(t?s.items[r].cssClass.includes(" e-hide")||(s.items[r].cssClass=s.items[r].cssClass+" e-hide",s.tabObj.items[s.getIndex(r)].cssClass=s.items[r].cssClass,void 0===n&&r===s.selectedTab&&(n=!0),i=!0):s.items[r].cssClass.includes(" e-hide")&&(s.items[r].cssClass=s.items[r].cssClass.replace(" e-hide",""),s.tabObj.items[s.getIndex(r)].cssClass=s.items[r].cssClass,void 0===n&&r===s.selectedTab&&(n=!0),i=!0))})),this.setProperties({items:this.items},!0),this.tabObj.items=this.tabObj.items,this.tabObj.dataBind(),t&&(a=this.isAllHidden())&&(n=!1),!t&&a&&(n=!n),i&&a&&(this.element.classList.contains("e-collapsed")?(this.element.classList.remove("e-collapsed"),this.element.querySelector(".e-drop-icon").classList.remove("e-hide")):(this.element.classList.add("e-collapsed"),this.element.querySelector(".e-drop-icon").classList.add("e-hide"))),n)for(var o=0;o<this.items.length;o++)if(!this.items[o].cssClass.includes(" e-hide")){this.tabObj.selectedItem=this.getIndex(o),this.tabObj.dataBind();break}},r.prototype.isAllHidden=function(){for(var e=!0,t=0;t<this.items.length;t++)if(!this.items[t].cssClass.includes(" e-hide")){e=!1;break}return e},r.prototype.enableTabs=function(e,t){var r=this;void 0===t&&(t=!0),e.forEach((function(e){var n=r.getTabIndex(e,-1);n>-1&&(r.items[n].disabled=!t,n=r.getIndex(n),r.tabObj.enableTab(n,t))})),this.setProperties({items:this.items},!0)},r.prototype.addTabs=function(e,t){var r=this,n=this.getTabIndex(t);e.forEach((function(e){e=new Hh(r.items[0],"items",e,!0),r.items.splice(n,0,e),r.tabObj.addTab([{header:e.header,content:r.toolbarObj.element}],r.getIndex(n)),n++})),this.setProperties({items:this.items},!0),this.setProperties({selectedTab:this.getIndex(this.tabObj.selectedItem,!0)},!0)},r.prototype.getTabIndex=function(e,t){if(void 0===t&&(t=this.items.length),e)for(var r=0;r<this.items.length;r++)if(this.items[r].header.text===e){t=r;break}return t},r.prototype.addToolbarItems=function(t,r,n){var i=this,a=this.getTabIndex(t);(0,e.isNullOrUndefined)(n)&&(n=this.items[a].content.length),r.forEach((function(e){e=new ch.Item(i.items[a].content[0],"content",e,!0),i.items[a].content.splice(n,0,e),n++})),this.setProperties({items:this.items},!0),a===this.selectedTab&&r.length&&this.updateToolbar(a)},r.prototype.enableItems=function(e,t,r){if(void 0===r&&(r=!0),t){var n=this.getTabIndex(e,-1);if(n<0)return;for(var i=0;i<t.length;i++){if("string"==typeof t[i])for(var a=0;a<this.items[n].content.length;a++)if(this.items[n].content[a].id===t[i]){t[i]=a;break}if("string"==typeof t[i]){if(t.length-1>i)continue;return}this.items[n].content[t[i]].disabled=!r,this.setProperties({items:this.items},!0),n===this.selectedTab&&this.toolbarObj.enableItems(t[i],r)}}else this.toolbarObj.disable(!r)},r.prototype.hideToolbarItems=function(e,t,r){var n,i,a=this;void 0===r&&(r=!0);for(var s=0;s<this.items.length;s++)if(this.items[s].header.text===e){n=s,t.forEach((function(e){(i=a.items[n].content[e])&&(r?i.cssClass.includes(" e-hide")||(i.cssClass=i.cssClass+" e-hide"):i.cssClass.includes(" e-hide")&&(i.cssClass=i.cssClass.replace(" e-hide","")))}));break}this.setProperties({items:this.items},!0),void 0!==n&&n===this.selectedTab&&this.updateToolbar(n)},r.prototype.getModuleName=function(){return"ribbon"},r.prototype.getPersistData=function(){return this.addOnPersist([])},r.prototype.onPropertyChanged=function(e,t){for(var r=0,n=Object.keys(e);r<n.length;r++){if("selectedTab"===n[r])this.tabObj.selectedItem=this.getIndex(e.selectedTab),this.tabObj.dataBind()}},Mh([(0,e.Property)("")],r.prototype,"cssClass",void 0),Mh([(0,e.Property)(!0)],r.prototype,"menuType",void 0),Mh([(0,e.Collection)([],ch.MenuItem)],r.prototype,"menuItems",void 0),Mh([(0,e.Property)(0)],r.prototype,"selectedTab",void 0),Mh([(0,e.Collection)([],Hh)],r.prototype,"items",void 0),Mh([(0,e.Property)(null)],r.prototype,"spreadInstance",void 0),Mh([(0,e.Event)()],r.prototype,"selecting",void 0),Mh([(0,e.Event)()],r.prototype,"fileMenuItemSelect",void 0),Mh([(0,e.Event)()],r.prototype,"beforeFileMenuItemRender",void 0),Mh([(0,e.Event)()],r.prototype,"beforeOpen",void 0),Mh([(0,e.Event)()],r.prototype,"beforeClose",void 0),Mh([(0,e.Event)()],r.prototype,"selectFormat",void 0),Mh([(0,e.Event)()],r.prototype,"clicked",void 0),Mh([(0,e.Event)()],r.prototype,"created",void 0),Mh([(0,e.Event)()],r.prototype,"expandCollapse",void 0),r=Mh([e.NotifyPropertyChanges],r)}(e.Component),Vh=function(){function t(e){this.parent=e,this.addEventListener()}return t.prototype.render=function(){var t=this,r=this.parent.element.id,n=this.parent.createElement("input",{attrs:{type:"color"}}),i=function(e){e.element.tabIndex=-1};this.fontColorPicker=new Ch.ColorPicker({value:"#000000ff",mode:"Palette",showButtons:!1,presetColors:Dl,enableOpacity:!1,cssClass:"e-spreadsheet-color-popup",beforeTileRender:i,beforeClose:function(){return t.beforeCloseHandler(t.fontColorPicker)},open:this.openHandler.bind(this),beforeModeSwitch:function(e){return t.beforeModeSwitch(t.fontColorPicker,e)},change:function(e){var r={style:{color:t.fontColorPicker.getValue(e.currentValue.rgba)},onActionUpdate:!0};t.parent.notify(ae,r),r.cancel?t.fontColorPicker.setProperties({value:t.fontColorPicker.getValue(e.previousValue.rgba,"HEXA")},!0):t.updateSelectedColor(r.style.color,t.fontColorPicker.element,"TextColor")},created:function(){return t.updateSelectedColor("#000000",t.fontColorPicker.element,"TextColor",!0)}}),this.fontColorPicker.createElement=this.parent.createElement,this.parent.element.appendChild(n),this.fontColorPicker.appendTo(n),n.parentElement.id=r+"_font_color_picker",(0,e.addClass)([n.nextElementSibling.getElementsByClassName("e-selected-color")[0]],["e-icons","e-font-color"]),n=this.parent.createElement("input",{attrs:{type:"color"}}),this.filColorPicker=new Ch.ColorPicker({value:"#ffff00ff",mode:"Palette",presetColors:Ll,showButtons:!1,enableOpacity:!1,cssClass:"e-spreadsheet-color-popup",open:this.openHandler.bind(this),beforeTileRender:i,beforeClose:function(){return t.beforeCloseHandler(t.filColorPicker)},beforeModeSwitch:function(e){return t.beforeModeSwitch(t.filColorPicker,e)},change:function(e){var r={style:{backgroundColor:t.filColorPicker.getValue(e.currentValue.rgba)},onActionUpdate:!0};t.parent.notify(ae,r),r.cancel?t.filColorPicker.setProperties({value:t.filColorPicker.getValue(e.previousValue.rgba,"HEXA")},!0):t.updateSelectedColor(r.style.backgroundColor,t.filColorPicker.element,"FillColor")},created:function(){return t.updateSelectedColor("#ffff00",t.filColorPicker.element,"FillColor",!0)}}),this.filColorPicker.createElement=this.parent.createElement,this.parent.element.appendChild(n),this.filColorPicker.appendTo(n),n.parentElement.id=r+"_fill_color_picker",(0,e.addClass)([n.nextElementSibling.getElementsByClassName("e-selected-color")[0]],["e-icons","e-fill-color"])},t.prototype.updateSelectedColor=function(e,t,r,n){var i=this.parent.serviceLocator.getService(kl).getConstant(r);n&&t.parentElement.querySelector(".e-dropdown-btn").setAttribute("aria-label",i);var a=t.parentElement.querySelector(".e-split-colorpicker");a.setAttribute("aria-label",i+" "+e),a.firstElementChild.style.borderBottomColor=e},t.prototype.openHandler=function(e){e.element.querySelector(".e-mode-switch-btn").title=this.parent.serviceLocator.getService(kl).getConstant("MoreColors")},t.prototype.beforeCloseHandler=function(e){e.modeSwitcher||e.setProperties({modeSwitcher:!0},!0),e.showButtons&&e.setProperties({showButtons:!1},!0),Fd(e.element.parentElement.querySelector(".e-split-colorpicker"))},t.prototype.beforeModeSwitch=function(e,t){var r=this.parent.serviceLocator.getService(kl);"Picker"===t.mode?(e.showButtons=!0,e.dataBind(),t.element.querySelector(".e-apply").title=r.getConstant("Apply"),t.element.querySelector(".e-cancel").title=r.getConstant("Cancel"),t.element.querySelector(".e-mode-switch-btn").title=r.getConstant("StandardColors")):(e.showButtons=!1,e.dataBind(),t.element.querySelector(".e-mode-switch-btn").title=r.getConstant("MoreColors"))},t.prototype.destroy=function(){this.parent&&(this.removeEventListener(),this.fontColorPicker&&this.fontColorPicker.destroy(),this.fontColorPicker=null,this.filColorPicker&&this.filColorPicker.destroy(),this.filColorPicker=null,this.parent=null)},t.prototype.addEventListener=function(){this.parent.on(qi,this.render,this),this.parent.on("destroyRibbonComponents",this.destroy,this),this.parent.on(Qn,this.destroy,this)},t.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(qi,this.render),this.parent.off("destroyRibbonComponents",this.destroy),this.parent.off(Qn,this.destroy))},t}(),zh=function(){function n(e){this.border="1px solid #000000",this.fontNameIndex=5,this.numPopupWidth=0,this.preTabIdx=1,this.spanElements=[],this.iconSetGroupElement=[],this.iconSetElements=[],this.iconWrapElements=[],this.parent=e,this.addEventListener(),new Vh(e)}return n.prototype.getModuleName=function(){return"ribbon"},n.prototype.ribbonOperation=function(e){e&&e.onPropertyChange?this.onPropertyChanged(e.prop):this.initialize()},n.prototype.initialize=function(e){if(this.parent.notify(qi,{}),this.parent.isMobileView())this.createMobileView();else{var t=e&&(this.parent.element.querySelector(".e-formula-bar-panel")||document.getElementById(this.parent.element.id+"_sheet_panel"));this.createRibbon(t)}},n.prototype.getRibbonMenuItems=function(){var e=this.parent.serviceLocator.getService(kl),t=this.parent.element.id;return[{text:this.parent.isMobileView()?"":e.getConstant("File"),iconCss:this.parent.isMobileView()?"e-icons e-file-menu-icon":null,id:t+"_File",items:[{text:e.getConstant("New"),id:t+"_New",iconCss:"e-new e-icons"},{text:e.getConstant("Open"),id:t+"_Open",iconCss:"e-open e-icons"},{text:e.getConstant("SaveAs"),iconCss:"e-save e-icons",id:t+"_Save_As",items:[{text:e.getConstant("ExcelXlsx"),id:t+"_Xlsx",iconCss:"e-xlsx e-icons"},{text:e.getConstant("ExcelXls"),id:t+"_Xls",iconCss:"e-xls e-icons"},{text:e.getConstant("CSV"),id:t+"_Csv",iconCss:"e-csv e-icons"},{text:e.getConstant("PDF"),id:t+"_Pdf",iconCss:"e-pdf e-icons"}]},{text:e.getConstant("Print"),id:t+"_Print",iconCss:"e-print e-icons"}]}]},n.prototype.getRibbonItems=function(){var t=this,r=this.parent.element.id,n=this.parent.serviceLocator.getService(kl),i=[{header:{text:n.getConstant("Home")},content:[{prefixIcon:"e-undo-icon",tooltipText:n.getConstant("Undo")+" (Ctrl+Z)",htmlAttributes:{"aria-label":n.getConstant("Undo")},id:r+"_undo",disabled:!0},{prefixIcon:"e-redo-icon",tooltipText:n.getConstant("Redo")+" (Ctrl+Y)",htmlAttributes:{"aria-label":n.getConstant("Redo")},id:r+"_redo",disabled:!0},{type:"Separator",id:r+"_separator_1"},{prefixIcon:"e-cut-icon",tooltipText:n.getConstant("Cut")+" (Ctrl+X)",htmlAttributes:{"aria-label":n.getConstant("Cut")},id:r+"_cut"},{prefixIcon:"e-copy-icon",tooltipText:n.getConstant("Copy")+" (Ctrl+C)",htmlAttributes:{"aria-label":n.getConstant("Copy")},id:r+"_copy"},{tooltipText:n.getConstant("Paste")+" (Ctrl+V)",template:this.getPasteBtn(r,n),id:r+"_paste",disabled:!0},{type:"Separator",id:r+"_separator_2"},{template:this.getNumFormatDDB(r,n),tooltipText:n.getConstant("NumberFormat"),id:r+"_number_format"},{type:"Separator",id:r+"_separator_3"},{template:this.getFontNameDDB(r),tooltipText:n.getConstant("Font"),id:r+"_font_name"},{type:"Separator",id:r+"_separator_4"},{template:this.getFontSizeDDB(r),tooltipText:n.getConstant("FontSize"),id:r+"_font_size"},{type:"Separator",id:r+"_separator_5"},{template:this.getBtn(r,"bold",n.getConstant("Bold")),tooltipText:n.getConstant("Bold")+" (Ctrl+B)",id:r+"_bold"},{template:this.getBtn(r,"italic",n.getConstant("Italic")),tooltipText:n.getConstant("Italic")+" (Ctrl+I)",id:r+"_italic"},{template:this.getBtn(r,"line-through",n.getConstant("Strikethrough")),tooltipText:n.getConstant("Strikethrough")+" (Ctrl+5)",id:r+"_line-through"},{template:this.getBtn(r,"underline",n.getConstant("Underline")),tooltipText:n.getConstant("Underline")+" (Ctrl+U)",id:r+"_underline"},{template:document.getElementById(r+"_font_color_picker"),tooltipText:n.getConstant("TextColor"),id:r+"_font_color_picker"},{type:"Separator",id:r+"_separator_6"},{template:document.getElementById(r+"_fill_color_picker"),tooltipText:n.getConstant("FillColor"),id:r+"_fill_color_picker"},{template:this.getBordersDBB(r),tooltipText:n.getConstant("Borders"),id:r+"_borders"},{template:this.getMergeSplitBtn(r),tooltipText:n.getConstant("MergeCells"),id:r+"_merge_cells",disabled:!0},{type:"Separator",id:r+"_separator_7"},{template:this.getTextAlignDDB(r),tooltipText:n.getConstant("HorizontalAlignment"),id:r+"_text_align"},{template:this.getVerticalAlignDDB(r),tooltipText:n.getConstant("VerticalAlignment"),id:r+"_vertical_align"},{template:this.getBtn(r,"wrap",n.getConstant("WrapText"),!1),tooltipText:""+n.getConstant("WrapText"),id:r+"_wrap"}]},{header:{text:n.getConstant("Insert")},content:[{prefixIcon:"e-hyperlink-icon",text:n.getConstant("Link"),id:r+"_hyperlink",tooltipText:n.getConstant("Link"),click:function(){t.getHyperlinkDlg()}},{prefixIcon:"e-image-icon",text:n.getConstant("Image"),id:r+"_image",tooltipText:n.getConstant("Image"),click:function(){(0,e.select)("#"+r+"_imageUpload",t.parent.element).click()}}]},{header:{text:n.getConstant("Formulas")},content:[{prefixIcon:"e-insert-function",tooltipText:n.getConstant("InsertFunction"),text:n.getConstant("InsertFunction"),id:r+"_insert_function"},{type:"Separator",id:r+"_separator_14"},{template:this.createCalcOptions(r,n),tooltipText:n.getConstant("CalcOptionsTip"),id:r+"_calc_types"},{type:"Separator",id:r+"_separator_15"},{prefixIcon:"e-calculate-sheet",tooltipText:n.getConstant("CalcSheetTip"),text:n.getConstant("CalcActiveSheet"),id:r+"_calc_current_sheet",click:function(){t.parent.notify(pe,{action:"ClearDependentCellCollection"}),t.parent.calculateNow("Sheet")},disabled:"Automatic"===this.parent.calculationMode},{prefixIcon:"e-calculation",tooltipText:n.getConstant("CalcWorkbookTip"),text:n.getConstant("CalcWorkbook"),id:r+"_calc_entire_sheets",click:function(){t.parent.notify(pe,{action:"ClearDependentCellCollection"}),t.parent.calculateNow("Workbook")},disabled:"Automatic"===this.parent.calculationMode}]},{header:{text:n.getConstant("Data")},content:[{prefixIcon:"e-protect-icon",text:n.getConstant("ProtectSheet"),id:r+"_protect",tooltipText:n.getConstant("ProtectSheet")},{prefixIcon:"e-password-protect-icon",text:n.getConstant("ProtectWorkbook"),id:r+"_protectworkbook",tooltipText:n.getConstant("ProtectWorkbook")},{type:"Separator",id:r+"_separator_8"},{template:this.datavalidationDDB(r),tooltipText:n.getConstant("DataValidation"),id:r+"_datavalidation"}]},{header:{text:n.getConstant("View")},content:[{prefixIcon:"e-hide-headers",text:this.getLocaleText("Headers"),id:r+"_headers",tooltipText:this.getLocaleText("Headers")},{type:"Separator",id:r+"_separator_9"},{prefixIcon:"e-hide-gridlines",text:this.getLocaleText("GridLines"),id:r+"_gridlines",tooltipText:this.getLocaleText("GridLines")},{type:"Separator",id:r+"_separator_13"},{prefixIcon:"e-freeze-pane",text:n.getConstant("FreezePanes"),id:r+"_freezepanes",tooltipText:n.getConstant("FreezePanes"),disabled:!this.parent.allowFreezePane},{prefixIcon:"e-freeze-row",text:n.getConstant("FreezeRows"),id:r+"_freezerows",tooltipText:n.getConstant("FreezeRows"),disabled:!this.parent.allowFreezePane},{prefixIcon:"e-freeze-column",text:n.getConstant("FreezeColumns"),id:r+"_freezecolumns",tooltipText:n.getConstant("FreezeColumns"),disabled:!this.parent.allowFreezePane}]}];return this.parent.allowConditionalFormat&&i.find((function(e){return e.header&&e.header.text===n.getConstant("Home")})).content.push({type:"Separator",id:r+"_separator_10"},{template:this.getCFDBB(r),tooltipText:n.getConstant("ConditionalFormatting"),id:r+"_conditionalformatting"}),this.parent.allowChart&&i.find((function(e){return e.header&&e.header.text===n.getConstant("Insert")})).content.push({type:"Separator",id:r+"_separator_11"},{template:this.getChartDDB(r,!0),text:n.getConstant("Chart"),tooltipText:n.getConstant("Chart"),id:r+"_chart"}),this.parent.allowCellFormatting&&i.find((function(e){return e.header&&e.header.text===n.getConstant("Home")})).content.push({type:"Separator",id:r+"_separator_12"},{template:this.getClearDDB(r),tooltipText:n.getConstant("Clear"),id:r+"_clear"}),(this.parent.allowSorting||this.parent.allowFiltering)&&i.find((function(e){return e.header&&e.header.text===n.getConstant("Home")})).content.push({template:this.getSortFilterDDB(r),tooltipText:n.getConstant("SortAndFilter"),id:r+"_sorting"}),this.parent.allowFindAndReplace&&i.find((function(e){return e.header&&e.header.text===n.getConstant("Home")})).content.push({template:this.getFindBtn(r),prefixIcon:"e-tbar-search-icon tb-icons",tooltipText:n.getConstant("FindReplaceTooltip"),id:r+"_find"}),i},n.prototype.createCalcOptions=function(t,r){var n=(0,e.createElement)("button",{id:t+"_calc_types",attrs:{type:"button"},className:"e-calc-types"}),i=(0,e.createElement)("span",{className:"e-calc-types-text"});return i.innerText=r.getConstant("CalcOptions"),n.appendChild(i),this.calcTypeOptions=new Oh.DropDownButton({items:[{id:t+"_Automatic",text:r.getConstant("Automatic"),iconCss:"Automatic"===this.parent.calculationMode?"e-icons e-selected-icon":""},{id:t+"_Manual",text:r.getConstant("Manual"),iconCss:"Manual"===this.parent.calculationMode?"e-icons e-selected-icon":""}],createPopupOnClick:!0,iconCss:"e-calculation e-icons",cssClass:"e-flat e-calc-types"}),this.calcTypeOptions.select=this.selectCalcOptions.bind(this),this.calcTypeOptions.appendTo(n),n},n.prototype.selectCalcOptions=function(e){e.item.id===this.parent.element.id+"_Automatic"?(this.calcTypeOptions.items[0].iconCss="e-icons e-selected-icon",this.calcTypeOptions.items[1].iconCss="","Manual"===this.parent.calculationMode&&this.parent.notify(pe,{action:"ClearDependentCellCollection"}),this.parent.setProperties({calculationMode:"Automatic"},!0),this.updateFormulaButtons(),this.parent.calculateNow("Workbook")):(this.calcTypeOptions.items[0].iconCss="",this.calcTypeOptions.items[1].iconCss="e-icons e-selected-icon",this.parent.setProperties({calculationMode:"Manual"},!0),this.updateFormulaButtons())},n.prototype.updateFormulaButtons=function(){var e=this.parent.serviceLocator.getService(kl);this.parent.notify(wi,[{tab:e.getConstant("Formulas"),items:[this.parent.element.id+"_calc_current_sheet"],enable:"Manual"===this.parent.calculationMode}]),this.parent.notify(wi,[{tab:e.getConstant("Formulas"),items:[this.parent.element.id+"_calc_entire_sheets"],enable:"Manual"===this.parent.calculationMode}])},n.prototype.getPasteBtn=function(e,t){var r=this,n=this.parent.element.appendChild(this.parent.createElement("button",{id:e+"_paste",attrs:{type:"button"}}));return this.pasteSplitBtn=new Oh.SplitButton({iconCss:"e-icons e-paste-icon",items:[{text:t.getConstant("All"),id:"All"},{text:t.getConstant("Values"),id:"Values"},{text:t.getConstant("Formats"),id:"Formats"}],createPopupOnClick:!0,select:function(e){r.pasteSplitBtn.element.setAttribute("aria-label",t.getConstant("Paste")+" "+e.item.text),r.parent.notify(ki,{type:e.item.id,isAction:!0,isInternal:!0})},click:function(){n.setAttribute("aria-label",t.getConstant("Paste")),r.parent.notify(ki,{isAction:!0,isInternal:!0})},beforeOpen:function(e){e.element.setAttribute("aria-label",t.getConstant("Paste"))}}),this.pasteSplitBtn.createElement=this.parent.createElement,this.pasteSplitBtn.appendTo(n),n.parentElement},n.prototype.getHyperlinkDlg=function(){var e=this.parent.getActiveSheet(),r=t(e.activeCell),n=Ln(r[0],r[1],e);n&&n.hyperlink?this.parent.notify(na,null):this.parent.notify(ra,null)},n.prototype.passwordProtectDlg=function(){this.parent.password.length>0?this.parent.notify(Bs,null):document.getElementById(this.parent.element.id+"_protectworkbook").classList.contains("e-active")?(document.getElementById(this.parent.element.id+"_protectworkbook").classList.remove("e-active"),this.parent.showSheetTabs&&this.parent.element.querySelector(".e-add-sheet-tab").removeAttribute("disabled")):this.parent.notify(Ms,null)},n.prototype.getLocaleText=function(e){var t=this.parent.serviceLocator.getService(kl);return this.parent.getActiveSheet()["show"+e]?t.getConstant("Hide"+e):t.getConstant("Show"+e)},n.prototype.getLocaleProtectText=function(e,t){var r,n=this.parent.serviceLocator.getService(kl);return this.parent.getActiveSheet().isProtected?(t&&this.parent.getMainContent().classList.remove("e-hide-"+e.toLowerCase()),r=n.getConstant("Unprotect"+e)):(t&&this.parent.getMainContent().classList.add("e-hide-"+e.toLowerCase()),r=n.getConstant("Protect"+e)),r},n.prototype.getLocaleProtectWorkbook=function(e,t){var r,n=this.parent.serviceLocator.getService(kl);return this.parent.isProtected?(t&&this.parent.getMainContent().classList.remove("e-hide-"+e.toLowerCase()),r=n.getConstant(e)):(t&&this.parent.getMainContent().classList.add("e-hide-"+e.toLowerCase()),r=n.getConstant(e)),r},n.prototype.insertDesignChart=function(){var e=this,t=this.parent.serviceLocator.getService(kl),r=this.ribbon.items.length-1,n=t.getConstant("ChartDesign");if(this.parent.allowChart&&this.ribbon.items[r]&&this.ribbon.items[r].header.text!==n){this.preTabIdx=this.ribbon.selectedTab;var i=this.parent.element.id,a=[{header:{text:n},content:[{template:this.getAddChartEleDBB(i),tooltipText:t.getConstant("AddChartElement"),id:i+"add_chart_ element_chart"},{type:"Separator"},{prefixIcon:"e-switch-row-column-icon",text:t.getConstant("SwitchRowColumn"),tooltipText:t.getConstant("SwitchRowColumn"),id:i+"switch_row_column_chart",click:function(){e.parent.notify(Ds,{switchRowColumn:!0,triggerEvent:!0})}},{type:"Separator"},{template:this.getChartThemeDDB(i),tooltipText:t.getConstant("ChartTheme"),id:i+"_chart_theme"},{type:"Separator"},{template:this.getChartDDB(i,!1),tooltipText:t.getConstant("ChartType"),id:i+"_chart_type"}]}];this.addRibbonTabs({items:a}),this.ribbon.tabObj.select(this.ribbon.items.length)}},n.prototype.removeDesignChart=function(){var e=this.parent.serviceLocator.getService(kl),t=this.ribbon.items.length-1;this.ribbon.items[t]&&this.ribbon.items[t].header.text===e.getConstant("ChartDesign")&&(this.ribbon.tabObj.select(this.preTabIdx+1),this.parent.hideRibbonTabs([e.getConstant("ChartDesign")],!0),document.getElementsByClassName("e-addchart-ddb").length>0&&document.getElementsByClassName("e-addchart-ddb")[0].remove(),document.getElementsByClassName("e-chart-type-ddb").length>0&&document.getElementsByClassName("e-chart-type-ddb")[0].remove(),document.getElementsByClassName("e-charttheme-ddb").length>0&&document.getElementsByClassName("e-charttheme-ddb")[0].remove(),delete this.ribbon.items[t].content[0],this.ribbon.items.length=this.ribbon.items.length-1)},n.prototype.createRibbon=function(e){var t=this.parent.createElement("div",{id:this.parent.element.id+"_ribbon"});this.ribbon=new Uh({selectedTab:0,menuItems:this.getRibbonMenuItems(),items:this.getRibbonItems(),fileMenuItemSelect:this.fileMenuItemSelect.bind(this),beforeOpen:this.fileMenuBeforeOpen.bind(this),beforeClose:this.fileMenuBeforeClose.bind(this),clicked:this.toolbarClicked.bind(this),created:this.ribbonCreated.bind(this),selecting:this.tabSelecting.bind(this),expandCollapse:this.expandCollapseHandler.bind(this),beforeFileMenuItemRender:this.beforeRenderHandler.bind(this),spreadInstance:this.parent&&this.parent.isReact?this.parent:null}),this.ribbon.createElement=this.parent.createElement,e?this.parent.element.insertBefore(t,e):this.parent.element.appendChild(t),this.ribbon.appendTo(t)},n.prototype.tabSelecting=function(e){if(e.selectingIndex!==this.ribbon.selectedTab){var t=this.parent.serviceLocator.getService(kl);if(this.ribbon.items[e.selectingIndex]&&this.ribbon.items[e.selectingIndex].header.text===t.getConstant("Insert"))for(var r=(n=this.ribbon.items[e.selectingIndex].content).length-1;r>=0;r--)if(n[r].id===this.parent.element.id+"_chart"){(i=n[r].template)&&!i.classList.contains("e-dropdown-btn")&&this.createChartDdb(document.getElementById(this.parent.element.id+"_chart-btn"),!0);break}if(this.ribbon.items[e.selectedIndex]&&this.ribbon.items[e.selectedIndex].header.text===t.getConstant("Insert")){var n;for(r=(n=this.ribbon.items[e.selectedIndex].content).length-1;r>=0;r--)if(n[r].id===this.parent.element.id+"_chart"){var i;(i=n[r].template)&&i.classList.contains("e-dropdown-btn")&&this.destroyComponent(i,"dropdown-btn");break}}this.refreshRibbonContent(e.selectingIndex),this.parent.notify(Ii,{activeTab:e.selectingIndex})}},n.prototype.beforeRenderHandler=function(e){var t=this.parent.serviceLocator.getService(kl);e.item.text!==t.getConstant("Open")||this.parent.openUrl&&this.parent.allowOpen||e.element.classList.add("e-disabled"),e.item.text!==t.getConstant("SaveAs")||this.parent.saveUrl&&this.parent.allowSave||e.element.classList.add("e-disabled"),e.item.text!==t.getConstant("Print")||this.parent.allowPrint||e.element.classList.add("e-disabled")},n.prototype.getChartThemeDDB=function(t){var r=this,n=this.parent.serviceLocator.getService(kl),i=this.parent.createElement("button",{id:t+"_chart_theme",attrs:{type:"button"},className:"e-ss-ddb"});i.appendChild(this.parent.createElement("span",{className:"e-tbar-btn-text"}));var a="Material",s=this.parent.element.querySelector(".e-ss-overlay-active");if(s){var o=s.querySelector(".e-chart");o?a=(0,e.getComponent)(o,"chart").theme:(o=s.querySelector(".e-accumulationchart"))&&(a=(0,e.getComponent)(o,"accumulationchart").theme)}var l=new Oh.DropDownButton({items:this.getChartThemeDdbItems(a),content:n.getConstant(a),createPopupOnClick:!0,select:function(e){r.parent.notify(rr,{type:"mousedown"}),e.element&&e.element.querySelector(".e-selected-icon")||(l.content=e.item.text,l.dataBind(),r.parent.notify(Ds,{chartTheme:e.item.id,triggerEvent:!0}),l.setProperties({items:r.getChartThemeDdbItems(e.item.id)},!0))},cssClass:"e-flat e-charttheme-ddb",beforeOpen:function(e){r.tBarDdbBeforeOpen(e.element,e.items,r.parent.serviceLocator.getService(kl).getConstant("Chart"))}});return l.createElement=this.parent.createElement,l.appendTo(i),i},n.prototype.getNumFormatDDB=function(e,t){var n=this,i=this.parent.createElement("button",{id:e+"_number_format",attrs:{type:"button"},className:"e-ss-ddb"}),a=this.parent.createElement("span",{className:"e-tbar-btn-text"});a.innerText=t.getConstant("General"),i.appendChild(a);var s={action:"getLocalizedFormats"};this.parent.notify(gr,s);var o=s.defaultFormats,l=s.localizedFormats;return this.numFormatDDB=new Oh.DropDownButton({items:this.getNumFormatDdbItems(e),createPopupOnClick:!0,select:function(e){var t=n.parent.serviceLocator.getService(kl);if(e.item.text===t.getConstant("Custom"))n.renderCustomFormatDialog(o,l);else{var i=e.item.id.split(n.parent.element.id+"_")[1],a=Mo(i);n.applyNumFormat(a);var s=n.parent.getActiveSheet();n.refreshNumFormatSelection(Bo(a,!0),s,t,a);var d=r(s.activeCell);n.refreshTextAlign(s,Ln(d[0],d[1],s,!1,!0),i,d),n.numFormatDDB.element.setAttribute("aria-label",i)}},open:function(e){return n.numDDBOpen(e)},beforeItemRender:function(e){return n.previewNumFormat(e)},cssClass:"e-flat e-numformat-ddb",beforeOpen:function(e){n.tBarDdbBeforeOpen(e.element,e.items,n.parent.serviceLocator.getService(kl).getConstant("NumberFormat"))}}),this.numFormatDDB.createElement=this.parent.createElement,this.numFormatDDB.appendTo(i),i},n.prototype.getFontSizeDDB=function(e){var t=this;return this.fontSizeDdb=new Oh.DropDownButton({cssClass:"e-font-size-ddb",content:"11",createPopupOnClick:!0,items:[{text:"8"},{text:"9"},{text:"10"},{text:"11"},{text:"12"},{text:"14"},{text:"16"},{text:"18"},{text:"20"},{text:"22"},{text:"24"},{text:"26"},{text:"28"},{text:"36"},{text:"48"},{text:"72"}],beforeOpen:function(e){t.tBarDdbBeforeOpen(e.element,e.items,t.parent.serviceLocator.getService(kl).getConstant("FontSize")),t.refreshSelected(t.fontSizeDdb,e.element,"content","text")},select:function(e){var r={style:{fontSize:e.item.text+"pt"},onActionUpdate:!0};t.parent.notify(ae,r),r.cancel||(t.fontSizeDdb.content=r.style.fontSize.split("pt")[0],t.fontSizeDdb.dataBind()),t.fontSizeDdb.element.setAttribute("aria-label",e.item.text)}}),this.fontSizeDdb.createElement=this.parent.createElement,this.fontSizeDdb.appendTo(this.parent.createElement("button",{id:e+"_font_size",attrs:{type:"button"},className:"e-ss-ddb"})),this.fontSizeDdb.element},n.prototype.getChartDDB=function(e,t){var r,n,i=this.parent.serviceLocator.getService(kl);t?(r=this.parent.createElement("button",{id:e+"_chart-btn",attrs:{type:"button"}}),(n=this.parent.createElement("span",{id:e+"_chart"})).innerText=i.getConstant("Chart"),r.appendChild(n)):(r=this.parent.createElement("button",{id:e+"_chart-type-btn",attrs:{type:"button"}}),(n=this.parent.createElement("span",{id:e+"_chart_type"})).innerText=i.getConstant("ChartType"),r.appendChild(n),this.createChartDdb(r,!1));return r},n.prototype.closeDropdownPopup=function(e){if(e.altKey&&38===e.keyCode||27===e.keyCode){var t=this[1];t&&(t.toggle(),Fd(t.element))}},n.prototype.createChartDdb=function(t,r){var n,i=this,a=this.parent.serviceLocator.getService(kl),s=r?"e-chart-menu":"e-chart-type-menu",o=this.parent.createElement("ul",{id:this.parent.element.id+(r?"_chart_menu":"_chart_type_menu")}),l=new Oh.DropDownButton({iconCss:"e-icons "+(r?"e-chart-icon":"e-chart-type-icon"),cssClass:r?"e-chart-ddb":"e-chart-type-ddb",target:o,createPopupOnClick:!0,beforeOpen:function(t){n=i.createChartMenu(o,s,a,l),i.tBarDdbBeforeOpen(t.element,n.items,i.parent.serviceLocator.getService(kl).getConstant("Chart")),e.EventHandler.add(o,"keydown",i.closeDropdownPopup,[i,l])},open:function(){return Fd(o)},beforeClose:function(t){t.event&&(0,e.closest)(t.event.target,"."+s)?t.cancel=!0:(e.EventHandler.remove(o,"keydown",i.closeDropdownPopup),n.destroy())}});l.createElement=this.parent.createElement,l.appendTo(t)},n.prototype.createChartMenu=function(t,r,n,i){var a=this,s=new ch.Menu({cssClass:r,items:[{iconCss:"e-icons e-column",text:n.getConstant("Column"),items:[{id:"column_chart"}]},{iconCss:"e-icons e-bar",text:n.getConstant("Bar"),items:[{id:"bar_chart"}]},{iconCss:"e-icons e-area",text:n.getConstant("Area"),items:[{id:"area_chart"}]},{iconCss:"e-icons e-pie-doughnut",text:n.getConstant("PieAndDoughnut"),items:[{id:"pie_doughnut_chart"}]},{iconCss:"e-icons e-line",text:n.getConstant("Line"),items:[{id:"line_chart"}]},{iconCss:"e-icons e-scatter",text:n.getConstant("Scatter"),items:[{id:"scatter_chart"}]}],orientation:"Vertical",beforeOpen:function(t){var r;t.parentItem.text===n.getConstant("Column")?(t.element.firstChild.appendChild(o),r="e-column-chart"):t.parentItem.text===n.getConstant("Bar")?(t.element.firstChild.appendChild(y),r="e-bar-chart"):t.parentItem.text===n.getConstant("Area")?(t.element.firstChild.appendChild(O),r="e-area-chart"):t.parentItem.text===n.getConstant("Line")?(t.element.firstChild.appendChild(L),r="e-line-chart"):t.parentItem.text===n.getConstant("PieAndDoughnut")?(t.element.firstChild.appendChild(q),r="e-pie-doughnut-chart"):t.parentItem.text===n.getConstant("Radar")?(t.element.firstChild.appendChild(K),r="e-radar-chart"):t.parentItem.text===n.getConstant("Scatter")&&(t.element.firstChild.appendChild(ee),r="e-scatter-chart"),r&&(t.element.parentElement.classList.add(r),e.EventHandler.add(t.element,"keydown",a.menuIconKeyDown.bind(a,r+" .e-menu-icon",0)))},select:function(e){return a.chartSelected(e,i)},beforeItemRender:function(e){e.item.text||e.element.removeAttribute("tabindex")},beforeClose:function(t){t.event&&37===t.event.keyCode?t.cancel=!0:e.EventHandler.remove(t.element,"keydown",a.menuIconKeyDown)}}),o=this.parent.createElement("div",{id:"column_main",className:"e-column-main"}),l=this.parent.createElement("div",{id:"column1_text",className:"e-column1-text"});l.innerText=n.getConstant("Column");var d=this.parent.createElement("div",{id:"column1_cont",className:"e-column1-cont"}),h=this.parent.createElement("div",{id:"column2_cont",className:"e-column2-cont"});o.appendChild(l),o.appendChild(d);var p=n.getConstant("ClusteredColumn"),c=this.parent.createElement("span",{id:"clusteredColumn",className:"e-clusteredcolumn e-column-icon e-menu-icon e-icons",attrs:{title:p,"aria-label":p,tabindex:"-1"}});p=n.getConstant("StackedColumn");var u=this.parent.createElement("span",{id:"stackedColumn",className:"e-stackedcolumn e-column-icon e-menu-icon e-icons",attrs:{title:p,"aria-label":p,tabindex:"-1"}});p=n.getConstant("StackedColumn100");var f=this.parent.createElement("span",{id:"stackedColumn100",className:"e-stackedcolumn100 e-column-icon e-menu-icon e-icons",attrs:{title:p,"aria-label":p,tabindex:"-1"}}),g=this.parent.createElement("span",{id:"clusteredColumn3D",className:"e-clusteredColumn3D e-column-icon"}),m=this.parent.createElement("span",{id:"stackedColumn3D",className:"e-stackedColumn3D e-column-icon"}),v=this.parent.createElement("span",{id:"stackedColumn1003D",className:"e-stackedColumn1003D e-column-icon"});d.appendChild(c),d.appendChild(u),d.appendChild(f),h.appendChild(g),h.appendChild(m),h.appendChild(v);var y=this.parent.createElement("div",{id:"bar_main",className:"e-bar-main"}),C=this.parent.createElement("div",{id:"bar1_text",className:"e-bar1-text"});C.innerText=n.getConstant("Bar");var b=this.parent.createElement("div",{id:"bar1_cont",className:"e-bar1-cont"}),x=this.parent.createElement("div",{id:"bar2_cont",className:"e-bar2-cont"});y.appendChild(C),y.appendChild(b),p=n.getConstant("ClusteredBar");var S=this.parent.createElement("span",{id:"clusteredBar",className:"e-clusteredbar e-bar-icon e-menu-icon e-icons",attrs:{title:p,"aria-label":p,tabindex:"-1"}});p=n.getConstant("StackedBar");var w=this.parent.createElement("span",{id:"stackedBar",className:"e-stackedbar e-bar-icon e-menu-icon e-icons",attrs:{title:p,"aria-label":p,tabindex:"-1"}});p=n.getConstant("StackedBar100");var I=this.parent.createElement("span",{id:"stackedBar100",className:"e-stackedbar100 e-bar-icon e-menu-icon e-icons",attrs:{title:p,"aria-label":p,tabindex:"-1"}}),E=this.parent.createElement("span",{id:"clusteredBar3D",className:"e-clusteredBar3D e-bar-icon"}),N=this.parent.createElement("span",{id:"stackedBar3D",className:"e-stackedBar3D e-bar-icon"}),R=this.parent.createElement("span",{id:"stackedBar1003D",className:"e-stackedBar1003D e-bar-icon"});b.appendChild(S),b.appendChild(w),b.appendChild(I),x.appendChild(E),x.appendChild(N),x.appendChild(R);var O=this.parent.createElement("div",{id:"area_main",className:"e-area-main"}),k=this.parent.createElement("div",{id:"area_text",className:"e-area-text"});k.innerText=n.getConstant("Area");var A=this.parent.createElement("div",{id:"area_cont",className:"e-area-cont"});O.appendChild(k),O.appendChild(A),p=n.getConstant("Area");var F=this.parent.createElement("span",{id:"area",className:"e-area e-area-icon e-menu-icon e-icons",attrs:{title:p,"aria-label":p,tabindex:"-1"}});p=n.getConstant("StackedArea");var T=this.parent.createElement("span",{id:"stackedArea",className:"e-stackedarea e-area-icon e-menu-icon e-icons",attrs:{title:p,"aria-label":p,tabindex:"-1"}});p=n.getConstant("StackedArea100");var D=this.parent.createElement("span",{id:"stackedArea100",className:"e-stackedarea100 e-area-icon e-menu-icon e-icons",attrs:{title:p,"aria-label":p,tabindex:"-1"}});A.appendChild(F),A.appendChild(T),A.appendChild(D);var L=this.parent.createElement("div",{id:"line_main",className:"e-line-main"}),P=this.parent.createElement("div",{id:"line_text",className:"e-line-text"});P.innerText=n.getConstant("Line");var M=this.parent.createElement("div",{id:"line_cont",className:"e-line-cont"}),B=this.parent.createElement("div",{id:"line_cont_marker",className:"e-line-cont"});L.appendChild(P),L.appendChild(M),L.appendChild(B),p=n.getConstant("Line");var H=this.parent.createElement("span",{id:"line",className:"e-line e-line-icon e-menu-icon e-icons",attrs:{title:p,"aria-label":p,tabindex:"-1"}});p=n.getConstant("StackedLine");var U=this.parent.createElement("span",{id:"stackedLine",className:"e-stackedline e-line-icon e-menu-icon e-icons",attrs:{title:p,"aria-label":p,tabindex:"-1"}});p=n.getConstant("StackedLine100");var V=this.parent.createElement("span",{id:"stackedLine100",className:"e-stackedline100 e-line-icon e-menu-icon e-icons",attrs:{title:p,"aria-label":p,tabindex:"-1"}});p=n.getConstant("LineMarker");var z=this.parent.createElement("span",{id:"lineMarker",className:"e-line-marker e-line-icon e-menu-icon e-icons",attrs:{title:p,"aria-label":p,tabindex:"-1"}});p=n.getConstant("StackedLineMarker");var _=this.parent.createElement("span",{id:"stackedLineMarker",className:"e-stackedline-marker e-line-icon e-menu-icon e-icons",attrs:{title:p,"aria-label":p,tabindex:"-1"}});p=n.getConstant("StackedLine100Marker");var j=this.parent.createElement("span",{id:"stackedLine100Marker",className:"e-stackedline100-marker e-line-icon e-menu-icon e-icons",attrs:{title:p,"aria-label":p,tabindex:"-1"}});M.appendChild(H),M.appendChild(U),M.appendChild(V),B.appendChild(z),B.appendChild(_),B.appendChild(j);var q=this.parent.createElement("div",{id:"pie_main",className:"e-pie-main"}),W=this.parent.createElement("div",{id:"pie_text",className:"e-pie-text"});W.innerText=n.getConstant("Pie");var G=this.parent.createElement("div",{id:"pie_cont",className:"e-pie-cont"});q.appendChild(W),q.appendChild(G),p=n.getConstant("Pie");var Y=this.parent.createElement("span",{id:"pie",className:"e-pie e-pie-icon e-menu-icon e-icons",attrs:{title:p,"aria-label":p,tabindex:"-1"}});p=n.getConstant("Doughnut");var X=this.parent.createElement("span",{id:"doughnut",className:"e-doughnut e-pie-icon e-menu-icon e-icons",attrs:{title:p,"aria-label":p,tabindex:"-1"}});G.appendChild(Y),G.appendChild(X);var K=this.parent.createElement("div",{id:"radar_main",className:"e-radar-main"}),$=this.parent.createElement("div",{id:"radar_text",className:"e-radar-text"});$.innerText=n.getConstant("Radar");var Z=this.parent.createElement("div",{id:"radar_cont",className:"e-radar-cont"});K.appendChild($),K.appendChild(Z);var J=this.parent.createElement("span",{id:"radar",className:"e-radar e-radar-icon e-menu-icon e-icons",attrs:{tabindex:"-1"}}),Q=this.parent.createElement("span",{id:"radar_markers",className:"e-radar-markers e-radar-icon e-menu-icon e-icons",attrs:{tabindex:"-1"}});J.title=n.getConstant("BlueDataBar"),Q.title=n.getConstant("GreenDataBar"),Z.appendChild(J),Z.appendChild(Q);var ee=this.parent.createElement("div",{id:"scatter_main",className:"e-scatter-main"}),te=this.parent.createElement("div",{id:"scatter_text",className:"e-scatter-text"});p=n.getConstant("Scatter"),te.innerText=p;var re=this.parent.createElement("div",{id:"scatter_cont",className:"e-scatter-cont"});ee.appendChild(te),ee.appendChild(re);var ne=this.parent.createElement("span",{id:"scatter",className:"e-scatter e-scatter-icon e-menu-icon e-icons",attrs:{title:p,"aria-label":p,tabindex:"-1"}});return re.appendChild(ne),s.createElement=this.parent.createElement,s.appendTo(t),t.classList.add("e-ul"),s},n.prototype.getAddChartEleDBB=function(t){var r,n=this,i=this.parent.serviceLocator.getService(kl),a=this.parent.createElement("ul",{id:t+"_add_chart_menu"});this.addChartDdb=new Oh.DropDownButton({iconCss:"e-icons e-addchart-icon",cssClass:"e-addchart-ddb",target:a,createPopupOnClick:!0,close:function(){return Fd(n.parent.element)},beforeOpen:function(t){r=n.createAddChartMenu(a,i),n.tBarDdbBeforeOpen(t.element,r.items),e.EventHandler.add(a,"keydown",n.closeDropdownPopup,[n,n.addChartDdb])},open:function(){return Fd(a)},beforeClose:function(t){t.event&&(0,e.closest)(t.event.target,".e-addchart-menu")?t.cancel=!0:(e.EventHandler.remove(a,"keydown",n.closeDropdownPopup),r.destroy())}}),this.addChartDdb.createElement=this.parent.createElement;var s=this.parent.createElement("button",{id:t+"_addchart",attrs:{type:"button"}}),o=this.parent.createElement("span",{id:t+"_chart"});return o.innerText=i.getConstant("AddChartElement"),s.appendChild(o),this.addChartDdb.appendTo(s),this.addChartDdb.element},n.prototype.createAddChartMenu=function(t,r){var n=this,i=new ch.Menu({cssClass:"e-addchart-menu",title:r.getConstant("AddChartElement"),items:[{iconCss:"e-icons e-axes",text:r.getConstant("Axes"),items:[{iconCss:"e-icons e-ph-axes",id:"PHAxes",text:r.getConstant("PrimaryHorizontal")},{iconCss:"e-icons e-pv-axes",id:"PVAxes",text:r.getConstant("PrimaryVertical")}]},{iconCss:"e-icons e-axis-title",text:r.getConstant("AxisTitle"),items:[{iconCss:"e-icons e-ph-axistitle",id:"PHAxisTitle",text:r.getConstant("PrimaryHorizontal")},{iconCss:"e-icons e-pv-axistitle",id:"PVAxisTitle",text:r.getConstant("PrimaryVertical")}]},{iconCss:"e-icons e-chart-title",text:r.getConstant("ChartTitle"),items:[{iconCss:"e-icons e-ct-none",id:"ChartTitleNone",text:r.getConstant("None")},{iconCss:"e-icons e-ct-abovechart",id:"ChartTitleAbove",text:r.getConstant("AboveChart")}]},{iconCss:"e-icons e-data-labels",id:this.parent.element.id+"data-labels",text:r.getConstant("DataLabels"),items:[{iconCss:"e-icons e-dl-none",id:"DLNone",text:r.getConstant("None")},{iconCss:"e-icons e-dl-center",id:"DLCenter",text:r.getConstant("Center")},{iconCss:"e-icons e-dl-insideend",id:"DLInsideend",text:r.getConstant("InsideEnd")},{iconCss:"e-icons e-dl-insidebase",id:"DLInsidebase",text:r.getConstant("InsideBase")},{iconCss:"e-icons e-dl-outsideend",id:"DLOutsideend",text:r.getConstant("OutsideEnd")}]},{iconCss:"e-icons e-gridlines",text:r.getConstant("Gridlines"),items:[{iconCss:"e-icons e-gl-major-horizontal",id:"GLMajorHorizontal",text:r.getConstant("PrimaryMajorHorizontal")},{iconCss:"e-icons e-gl-major-vertical",id:"GLMajorVertical",text:r.getConstant("PrimaryMajorVertical")},{iconCss:"e-icons e-gl-minor-horizontal",id:"GLMinorHorizontal",text:r.getConstant("PrimaryMinorHorizontal")},{iconCss:"e-icons e-gl-minor-vertical",id:"GLMinorVertical",text:r.getConstant("PrimaryMinorVertical")}]},{iconCss:"e-icons e-legends",text:r.getConstant("Legends"),items:[{iconCss:"e-icons e-legends-none",id:"LegendNone",text:r.getConstant("None")},{iconCss:"e-icons e-legends-right",id:"LegendsRight",text:r.getConstant("Right")},{iconCss:"e-icons e-legends-left",id:"LegendsLeft",text:r.getConstant("Left")},{iconCss:"e-icons e-legends-bottom",id:"LegendsBottom",text:r.getConstant("Bottom")},{iconCss:"e-icons e-legends-top",id:"LegendsTop",text:r.getConstant("Top")}]}],orientation:"Vertical",select:this.addChartEleSelected.bind(this),beforeOpen:function(t){if(t.parentItem.id===n.parent.element.id+"data-labels"){var i=n.parent.element.querySelector(".e-ss-overlay-active");if(i){var a=i.querySelector(".e-chart");if(a)if((0,e.getComponent)(a,"chart").series[0].type.includes("Line")){var s=function(e,t){if(e){var n=e.parentElement;n.innerHTML="",n.appendChild(e),n.appendChild(document.createTextNode(r.getConstant(t)))}};s(t.element.querySelector(".e-dl-insideend"),"Above"),s(t.element.querySelector(".e-dl-insidebase"),"Below");var o=t.element.querySelector(".e-dl-outsideend");o&&(o.parentElement.style.display="none")}}}}});return i.createElement=this.parent.createElement,i.appendTo(t),t.classList.add("e-ul"),i},n.prototype.getCFDBB=function(t){var r,n=this,i=this.parent.createElement("ul",{id:t+"_cf_menu"});return this.cfDdb=new Oh.DropDownButton({iconCss:"e-icons e-conditionalformatting-icon",cssClass:"e-cf-ddb",target:i,createPopupOnClick:!0,close:function(){return Fd(n.parent.element)},beforeOpen:function(t){r=n.createCFMenu(i),n.tBarDdbBeforeOpen(t.element,r.items,n.parent.serviceLocator.getService(kl).getConstant("ConditionalFormatting")),e.EventHandler.add(i,"keydown",n.closeDropdownPopup,[n,n.cfDdb])},open:function(){return Fd(i)},beforeClose:function(t){t.event&&(0,e.closest)(t.event.target,".e-cf-menu")?t.cancel=!0:(e.EventHandler.remove(i,"keydown",n.closeDropdownPopup),r&&r.element&&(qd(n.spanElements),n.spanElements=[],qd(n.iconWrapElements),n.iconWrapElements=[],qd(n.iconSetElements),n.iconSetElements=[],qd(n.iconSetGroupElement),n.iconSetGroupElement=[],r.destroy(),r.element.remove()))}}),this.cfDdb.createElement=this.parent.createElement,this.cfDdb.appendTo(this.parent.createElement("button",{id:t+"_conditionalformatting",attrs:{type:"button"}})),this.cfDdb.element},n.prototype.createCFMenu=function(t){var r=this,n=this.parent.serviceLocator.getService(kl),i=function(e,t,i){var a;e.forEach((function(e){a=n.getConstant(e+t);var s=r.parent.createElement("span",{id:e+t,className:"e-"+e.toLowerCase()+" e-cf-icon",attrs:{title:a,"aria-label":a,tabindex:"-1"}});r.spanElements.push(s),i.appendChild(s)}))},a=new ch.Menu({cssClass:"e-cf-menu",items:[{iconCss:"e-icons e-hlcellrules",text:n.getConstant("HighlightCellsRules"),items:[{iconCss:"e-icons e-greaterthan",id:"cf_greaterthan_dlg",text:n.getConstant("GreaterThan")+"..."},{iconCss:"e-icons e-lessthan",id:"cf_lessthan_dlg",text:n.getConstant("LessThan")+"..."},{iconCss:"e-icons e-between",id:"cf_between_dlg",text:n.getConstant("Between")+"..."},{iconCss:"e-icons e-equalto",id:"cf_eqaulto_dlg",text:n.getConstant("CFEqualTo")+"..."},{iconCss:"e-icons e-textcontains",id:"cf_textcontains_dlg",text:n.getConstant("TextThatContains")+"..."},{iconCss:"e-icons e-adateoccuring",id:"cf_adateoccuring_dlg",text:n.getConstant("ADateOccuring")+"..."},{iconCss:"e-icons e-duplicate",id:"cf_duplicatevalues_dlg",text:n.getConstant("DuplicateValues")+"..."}]},{iconCss:"e-icons e-topbottomrules",text:n.getConstant("TopBottomRules"),items:[{iconCss:"e-icons e-top10items",id:"cf_top10items_dlg",text:n.getConstant("Top10Items")+"..."},{iconCss:"e-icons e-top10",id:"cf_top10_dlg",text:n.getConstant("Top10")+" %..."},{iconCss:"e-icons e-bottom10items",id:"cf_bottom10items_dlg",text:n.getConstant("Bottom10Items")+"..."},{iconCss:"e-icons e-bottom10",id:"cf_bottom10_dlg",text:n.getConstant("Bottom10")+" %..."},{iconCss:"e-icons e-aboveaverage",id:"cf_aboveaverage_dlg",text:n.getConstant("AboveAverage")+"..."},{iconCss:"e-icons e-belowaverage",id:"cf_belowaverage_dlg",text:n.getConstant("BelowAverage")+"..."}]},{iconCss:"e-icons e-databars",text:n.getConstant("DataBars"),items:[{id:"db_icons1"},{id:"db_icons2"}]},{iconCss:"e-icons e-colorscales",text:n.getConstant("ColorScales"),items:[{id:"cs_icons1"},{id:"cs_icons2"},{id:"cs_icons3"}]},{iconCss:"e-icons e-iconsets",text:n.getConstant("IconSets"),items:[{id:"is_icons"}]},{iconCss:"e-icons e-clearrules",text:n.getConstant("ClearRules"),items:[{id:"cf_cr_cells",text:n.getConstant("SelectedCells")},{id:"cf_cr_sheet",text:n.getConstant("EntireSheet")}]}],orientation:"Vertical",beforeOpen:function(t){if("e-icons e-databars"===t.parentItem.iconCss)t.element.parentElement.classList.add("e-databars"),i(["Blue","Green","Red"],"DataBar",t.element.firstChild),i(["Orange","LightBlue","Purple"],"DataBar",t.element.lastChild),e.EventHandler.add(t.element,"keydown",r.menuIconKeyDown.bind(r,"e-cf-icon",3));else if("e-icons e-colorscales"===t.parentItem.iconCss)t.element.parentElement.classList.add("e-colorscales"),i(["GYR","RYG","GWR","RWG"],"ColorScale",t.element.firstChild),i(["BWR","RWB","WR","RW"],"ColorScale",t.element.querySelector("#cs_icons2")),i(["GW","WG","GY","YG"],"ColorScale",t.element.lastChild),e.EventHandler.add(t.element,"keydown",r.menuIconKeyDown.bind(r,"e-cf-icon",4));else if("e-icons e-iconsets"===t.parentItem.iconCss){t.element.parentElement.classList.add("e-iconsets");var a=r.parent.createElement("div",{id:"is",className:"e-is"});r.iconSetGroupElement.push(a);var s,o,l,d;[{hdr:"Directional"},{cont:[{cls:"3arrows",key:"ThreeArrowsColor",id:"ThreeArrows",count:3},{cls:"3arrowsgray",key:"ThreeArrowsGray",count:3},{cls:"3triangles",key:"ThreeTriangles",count:3},{cls:"4arrowsgray",key:"FourArrowsGray",count:4},{cls:"4arrows",key:"FourArrowsColor",id:"FourArrows",count:4},{cls:"5arrowsgray",key:"FiveArrowsGray",count:5},{cls:"5arrows",key:"FiveArrowsColor",id:"FiveArrows",count:5}]},{hdr:"Shapes"},{cont:[{cls:"3trafficlights",key:"ThreeTrafficLights1",count:3},{cls:"3rafficlights2",key:"ThreeTrafficLights2",count:3},{cls:"3signs",key:"ThreeSigns",count:3},{cls:"4trafficlights",key:"FourTrafficLights",count:4},{cls:"4redtoblack",key:"RedToBlack",id:"FourRedToBlack",count:4}]},{hdr:"Indicators"},{cont:[{cls:"3symbols",key:"ThreeSymbols1",id:"ThreeSymbols",count:3},{cls:"3symbols2",key:"ThreeSymbols2",count:3},{cls:"3flags",key:"ThreeFlags",count:3}]},{hdr:"Ratings"},{cont:[{cls:"3stars",key:"ThreeStars",count:3},{cls:"4rating",key:"FourRatings",id:"FourRating",count:4},{cls:"5quarters",key:"FiveQuarters",count:5},{cls:"5rating",key:"FiveRatings",id:"FiveRating",count:5},{cls:"5boxes",key:"FiveBoxes",count:5}]}].forEach((function(e,t){s=r.parent.createElement("div",{id:"is"+(t+1),className:"e-is"+(t+1)}),r.iconSetElements.push(s),e.hdr?s.innerText=n.getConstant(e.hdr):e.cont.forEach((function(e){for(l=n.getConstant(e.key),o=r.parent.createElement("div",{id:e.id||e.key,className:"e-"+e.cls+" e-is-wrapper",attrs:{title:l,"aria-label":l,tabindex:"-1"}}),r.iconWrapElements.push(o),d=0;d<e.count;d++){var t=r.createElement("span","e-"+e.cls+"-"+(d+1)+" e-iconsetspan");r.spanElements.push(t),o.appendChild(t)}s.appendChild(o)})),a.appendChild(s)})),t.element.firstChild.appendChild(a),e.EventHandler.add(t.element,"keydown",r.menuIconKeyDown.bind(r,"e-is-wrapper",0))}},select:this.cfSelected.bind(this),beforeItemRender:function(e){(e.item.id.includes("db_icons")||e.item.id.includes("cs_icons")||"is_icons"===e.item.id)&&e.element.removeAttribute("tabindex")},beforeClose:function(t){var n=["e-icons e-databars","e-icons e-colorscales","e-icons e-iconsets"].indexOf(t.parentItem.iconCss)>-1;t.cancel=t.event&&37===t.event.keyCode&&n,n&&!t.cancel&&e.EventHandler.remove(t.element,"keydown",r.menuIconKeyDown)}});return a.createElement=this.parent.createElement,a.appendTo(t),t.classList.add("e-ul"),a},n.prototype.menuIconKeyDown=function(e,t,r){var n,i=[];if(r){if(40===r.keyCode||39===r.keyCode||38===r.keyCode||37===r.keyCode)if(r.preventDefault(),-1===(n=(i=[].slice.call(document.querySelectorAll("."+e))).indexOf(r.target)))n=0;else if(39===r.keyCode)++n===i.length&&(n=0);else if(37===r.keyCode)-1===--n&&(n=i.length-1);else if(!e.includes("e-menu-icon")){var a=i.length,s=void 0,o=void 0;t||(t=2,40===r.keyCode?(s=[6,11,14,19],o=[5,10,13]):(s=[7,12,15],o=[8,13,16]),a--),40===r.keyCode?n===a-1?n=0:(n+=s&&s.indexOf(n)>-1?1:o&&o.indexOf(n)>-1?3:t,s&&a++,n>=a&&(n=n-a+1)):0===n?n=a-1:(n-=s&&s.indexOf(n)>-1?1:o&&o.indexOf(n)>-1?3:t)<0&&(n=s?a:a+n-1)}}else n=0,i=[].slice.call(document.querySelectorAll("."+e));i[n]&&Fd(i[n])},n.prototype.createElement=function(e,t){return this.parent.createElement(e,{className:t})},n.prototype.getBordersDBB=function(t){var r,n=this,i=this.parent.createElement("ul",{id:t+"_borders_menu"});return this.cPickerEle=this.parent.createElement("input",{id:t+"_cell_border_color",attrs:{type:"color"}}),this.parent.element.appendChild(this.cPickerEle),this.colorPicker=new Ch.ColorPicker({cssClass:"e-border-colorpicker",mode:"Palette",inline:!0,beforeTileRender:function(e){e.element.tabIndex=-1},change:function(e){var t=n.border.split(" ");t[2]=e.currentValue.hex,n.border=t.join(" ")}}),this.colorPicker.createElement=this.parent.createElement,this.colorPicker.appendTo(this.cPickerEle),this.bordersDdb=new Oh.DropDownButton({iconCss:"e-icons e-bottom-borders",cssClass:"e-borders-ddb",target:i,createPopupOnClick:!0,beforeOpen:function(t){r=n.createBorderMenu(i),n.tBarDdbBeforeOpen(t.element,r.items,n.parent.serviceLocator.getService(kl).getConstant("Borders"),1),e.EventHandler.add(i,"keydown",n.closeDropdownPopup,[n,n.bordersDdb])},open:function(){return Fd(i)},beforeClose:function(t){t.event&&(0,e.closest)(t.event.target,".e-borders-menu")?t.cancel=!0:(e.EventHandler.remove(i,"keydown",n.closeDropdownPopup),r.destroy())},close:function(){return Fd(n.bordersDdb.element)}}),this.bordersDdb.createElement=this.parent.createElement,this.bordersDdb.appendTo(this.parent.createElement("button",{id:t+"_borders",attrs:{type:"button"}})),this.bordersDdb.element},n.prototype.createBorderMenu=function(t){var r=this,n=this.parent.serviceLocator.getService(kl),i=this.parent.element.id,a=new ch.Menu({cssClass:"e-borders-menu",items:[{iconCss:"e-icons e-top-borders",text:n.getConstant("TopBorders"),id:i+"_border_topborders"},{iconCss:"e-icons e-left-borders",text:n.getConstant("LeftBorders"),id:i+"_border_leftborders"},{iconCss:"e-icons e-right-borders",text:n.getConstant("RightBorders"),id:i+"_border_rightborders"},{iconCss:"e-icons e-bottom-borders",text:n.getConstant("BottomBorders"),id:i+"_border_bottomborders"},{iconCss:"e-icons e-all-borders",text:n.getConstant("AllBorders"),id:i+"_border_allborders"},{iconCss:"e-icons e-horizontal-borders",text:n.getConstant("HorizontalBorders"),id:i+"_border_horizontalborders"},{iconCss:"e-icons e-vertical-borders",text:n.getConstant("VerticalBorders"),id:i+"_border_verticalborders"},{iconCss:"e-icons e-outside-borders",text:n.getConstant("OutsideBorders"),id:i+"_border_outsideborders"},{iconCss:"e-icons e-inside-borders",text:n.getConstant("InsideBorders"),id:i+"_border_insideborders"},{iconCss:"e-icons e-no-borders",text:n.getConstant("NoBorders"),id:i+"_border_noborders"},{separator:!0},{text:n.getConstant("BorderColor"),items:[{id:i+"_border_colors"}],id:i+"_border_bordercolor"},{text:n.getConstant("BorderStyle"),items:[{iconCss:"e-icons e-selected-icon",id:i+"_1px"},{id:i+"_2px"},{id:i+"_3px"},{id:i+"_dashed"},{id:i+"_dotted"},{id:i+"_double"}]}],orientation:"Vertical",beforeOpen:function(e){if(e.parentItem.id===i+"_border_bordercolor"){r.colorPicker.refresh();var t=r.colorPicker.element.parentElement;e.element.firstElementChild.appendChild(t),t.style.display="inline-block",e.element.parentElement.classList.add("e-border-color"),e.element.firstElementChild.removeAttribute("tabindex")}else e.element.classList.add("e-border-style")},beforeClose:function(t){if(t.event&&t.parentItem.id===i+"_border_bordercolor")if(!(0,e.closest)(t.event.target,".e-border-colorpicker")||(0,e.closest)(t.event.target,".e-apply")||(0,e.closest)(t.event.target,".e-cancel")){r.colorPicker=(0,e.getComponent)(r.cPickerEle,"colorpicker"),"Picker"===r.colorPicker.mode&&(r.colorPicker.mode="Palette",r.colorPicker.dataBind());var n=r.colorPicker.element.parentElement;n.style.display="",r.parent.element.appendChild(n)}else t.cancel=!0},onOpen:function(e){if(e.parentItem.id===i+"_border_bordercolor"){e.element.parentElement.style.overflow="visible";var t=e.element.querySelector(".e-color-palette .e-palette");t&&Fd(t)}},onClose:function(){return Fd(a.element)},select:function(e){r.borderSelected(e,a)}});return a.createElement=this.parent.createElement,a.appendTo(t),t.classList.add("e-ul"),a},n.prototype.chartSelected=function(t,r){var n=!(0,e.isNullOrUndefined)((0,e.closest)(t.element,".e-chart-menu")),i=t.element.id;if("column_chartbar_chartarea_chartpie_doughnut_chartline_chartradar_chartscatter_chart".includes(i)){!t.item||t.item.items&&t.item.items.length||r.toggle();var a=t.event.target.id;this.parent.notify(ks,{action:i,id:a,isChart:n})}},n.prototype.addChartEleSelected=function(e){var t=e.element.id;this.parent.notify(Ds,{addChartEle:t,triggerEvent:!0}),!e.item||e.item.items&&e.item.items.length||this.addChartDdb.toggle()},n.prototype.cfSelected=function(e){var r=this.parent.getActiveSheet();if(e.item.id.includes("_dlg"))this.parent.notify(ss,{action:e.item.text});else{var n=e.item.id.includes("icons");if(n||"cf_cr_cells"===e.item.id||"cf_cr_sheet"===e.item.id)if(zd(this.parent,c(t(r.selectedRange))))this.parent.notify(Ka,null);else if(n){var i=e.event.target;this.parent.notify(Ot,{cfModel:{type:i.id||i.parentElement.id,range:r.selectedRange},isAction:!0})}else"cf_cr_cells"===e.item.id?this.parent.notify(At,{range:r.selectedRange,isAction:!0}):"cf_cr_sheet"===e.item.id&&(this.parent.conditionalFormat=null,this.parent.notify(At,{isAction:!0}))}!e.item||e.item.items&&e.item.items.length||this.cfDdb.toggle()},n.prototype.borderSelected=function(e,t){this.bordersDdb.element.setAttribute("aria-label",e.item.text);var r=this.parent.element.id;if(!e.item.items.length&&e.item.id!==r+"_border_colors"){if(!e.item.text){var n=this.border.split(" "),i="solid"===n[1]?r+"_"+n[0]:r+"_"+n[1];if(i===e.item.id)return;return e.item.id===r+"_1px"||e.item.id===r+"_2px"||e.item.id===r+"_3px"?(n[0]=e.item.id.split(r+"_")[1],n[1]="solid"):(n[1]=e.item.id.split(r+"_")[1],n[0]="double"===n[1]?"3px":"1px"),this.border=n.join(" "),t.items[12].items.forEach((function(t){t.id===i&&(t.iconCss=null),t.id===e.item.id&&(t.iconCss="e-icons e-selected-icon")})),void t.setProperties({items:t.items},!0)}switch(this.bordersDdb.toggle(),this.parent.showSpinner(),e.item.id){case r+"_border_topborders":this.parent.notify(ae,{style:{borderTop:this.border},onActionUpdate:!0});break;case r+"_border_leftborders":this.parent.notify(ae,{style:{borderLeft:this.border},onActionUpdate:!0});break;case r+"_border_rightborders":this.parent.notify(ae,{style:{borderRight:this.border},onActionUpdate:!0});break;case r+"_border_bottomborders":this.parent.notify(ae,{style:{borderBottom:this.border},onActionUpdate:!0});break;case r+"_border_allborders":this.parent.notify(ae,{style:{border:this.border},onActionUpdate:!0});break;case r+"_border_horizontalborders":this.parent.notify(ae,{style:{border:this.border},onActionUpdate:!0,borderType:"Horizontal"});break;case r+"_border_verticalborders":this.parent.notify(ae,{style:{border:this.border},onActionUpdate:!0,borderType:"Vertical"});break;case r+"_border_outsideborders":this.parent.notify(ae,{style:{border:this.border},onActionUpdate:!0,borderType:"Outer"});break;case r+"_border_insideborders":this.parent.notify(ae,{style:{border:this.border},onActionUpdate:!0,borderType:"Inner"});break;case r+"_border_noborders":this.parent.notify(ae,{style:{border:""},onActionUpdate:!0})}this.parent.hideSpinner()}},n.prototype.getFontNameDDB=function(e){var t=this,r=this.parent.createElement("button",{id:e+"_font_name",attrs:{type:"button"},className:"e-ss-ddb"}),n=this.parent.createElement("span",{className:"e-tbar-btn-text"});return n.innerText="Calibri",r.appendChild(n),this.fontNameDdb=new Oh.DropDownButton({cssClass:"e-font-family",items:this.getFontFamilyItems(),createPopupOnClick:!0,select:function(e){var n={style:{fontFamily:e.item.text},onActionUpdate:!0};t.parent.notify(ae,n),r.setAttribute("aria-label",e.item.text),n.cancel||t.refreshFontNameSelection(n.style.fontFamily)},beforeOpen:function(e){t.tBarDdbBeforeOpen(e.element,e.items,t.parent.serviceLocator.getService(kl).getConstant("Font"))}}),this.fontNameDdb.createElement=this.parent.createElement,this.fontNameDdb.appendTo(r),r},n.prototype.getBtn=function(e,t,r,n){void 0===n&&(n=!0);var i=new bh.Button({iconCss:"e-icons e-"+t+"-icon",cssClass:"e-flat",isToggle:!0});return i.createElement=this.parent.createElement,i.appendTo(this.parent.createElement("button",{id:e+"_"+t,attrs:{"aria-label":r,type:"button"}})),n&&i.element.addEventListener("click",this.toggleBtnClicked.bind(this)),i.element},n.prototype.datavalidationDDB=function(e){var t,r=this,n=this.parent.serviceLocator.getService(kl);return this.datavalidationDdb=new Oh.DropDownButton({cssClass:"e-datavalidation-ddb",iconCss:"e-datavalidation-icon e-icons",content:n.getConstant("DataValidation"),items:[{text:n.getConstant("DataValidation")},{text:n.getConstant("HighlightInvalidData")},{text:n.getConstant("ClearHighlight")},{text:n.getConstant("ClearValidation")}],createPopupOnClick:!0,beforeOpen:function(e){r.refreshSelected(r.datavalidationDdb,e.element,"iconCss"),e.element.setAttribute("aria-label",n.getConstant("DataValidation"))},select:function(e){switch(e.item.text){case n.getConstant("DataValidation"):r.parent.notify(La,null);break;case n.getConstant("HighlightInvalidData"):r.parent.notify(Ba,{isRemoveHighlight:!1});break;case n.getConstant("ClearHighlight"):r.parent.notify(Ba,{isRemoveHighlight:!0});break;case n.getConstant("ClearValidation"):r.parent.notify(rs,{isAction:!0});break;default:t=e.item.text===n.getConstant("SortAscending")?"Ascending":"Descending",r.parent.notify(Zi,{sortOptions:{sortDescriptors:{order:t}}})}r.datavalidationDdb.element.setAttribute("aria-label",e.item.text)}}),this.datavalidationDdb.createElement=this.parent.createElement,this.datavalidationDdb.appendTo(this.parent.createElement("button",{id:e+"_datavalidation",attrs:{type:"button"},className:"e-ss-ddb"})),this.datavalidationDdb.element},n.prototype.getTextAlignDDB=function(e){var t=this,r=this.parent.serviceLocator.getService(kl);return this.textAlignDdb=new Oh.DropDownButton({cssClass:"e-align-ddb",iconCss:"e-icons e-left-icon",items:[{iconCss:"e-icons e-left-icon"},{iconCss:"e-icons e-center-icon"},{iconCss:"e-icons e-right-icon"}],beforeItemRender:this.alignItemRender.bind(this),createPopupOnClick:!0,beforeOpen:function(e){t.refreshSelected(t.textAlignDdb,e.element,"iconCss"),e.element.setAttribute("aria-label",r.getConstant("HorizontalAlignment"))},select:function(e){var n={style:{textAlign:e.item.iconCss.split(" e-")[1].split("-icon")[0]},onActionUpdate:!0};t.parent.notify(ae,n),n.cancel||(t.textAlignDdb.iconCss="e-icons e-"+n.style.textAlign+"-icon",t.textAlignDdb.dataBind()),t.textAlignDdb.element.setAttribute("aria-label",r.getConstant("HorizontalAlignment")+" "+r.getConstant("Align"+t.getAlignText(e)))}}),this.textAlignDdb.createElement=this.parent.createElement,this.textAlignDdb.appendTo(this.parent.createElement("button",{id:e+"_text_align",attrs:{type:"button"},className:"e-ss-ddb"})),this.textAlignDdb.element},n.prototype.getVerticalAlignDDB=function(e){var t=this,r=this.parent.serviceLocator.getService(kl);return this.verticalAlignDdb=new Oh.DropDownButton({cssClass:"e-align-ddb",iconCss:"e-icons e-bottom-icon",items:[{iconCss:"e-icons e-top-icon"},{iconCss:"e-icons e-middle-icon"},{iconCss:"e-icons e-bottom-icon"}],beforeItemRender:this.alignItemRender.bind(this),createPopupOnClick:!0,beforeOpen:function(e){t.refreshSelected(t.verticalAlignDdb,e.element,"iconCss"),e.element.setAttribute("aria-label",r.getConstant("VerticalAlignment"))},select:function(e){var n={style:{verticalAlign:e.item.iconCss.split(" e-")[1].split("-icon")[0]},onActionUpdate:!0};t.parent.notify(ae,n),n.cancel||(t.verticalAlignDdb.iconCss="e-icons e-"+n.style.verticalAlign+"-icon",t.verticalAlignDdb.dataBind()),t.verticalAlignDdb.element.setAttribute("aria-label",r.getConstant("VerticalAlignment")+" "+r.getConstant("Align"+t.getAlignText(e)))}}),this.verticalAlignDdb.createElement=this.parent.createElement,this.verticalAlignDdb.appendTo(this.parent.createElement("button",{id:e+"_vertical_align",attrs:{type:"button"},className:"e-ss-ddb"})),this.verticalAlignDdb.element},n.prototype.getMergeSplitBtn=function(e){var t=this;this.parent.element.appendChild(this.parent.createElement("button",{id:e+"_merge",attrs:{type:"button"}}));var r=this.parent.serviceLocator.getService(kl);return this.mergeSplitBtn=new Oh.SplitButton({cssClass:"e-merge-ddb",iconCss:"e-icons e-merge-icon",createPopupOnClick:!0,items:[{text:r.getConstant("MergeAll"),id:e+"_merge_all"},{text:r.getConstant("MergeHorizontally"),id:e+"_merge_horizontally"},{text:r.getConstant("MergeVertically"),id:e+"_merge_vertically"},{separator:!0,id:e+"_merge_separator"},{text:r.getConstant("Unmerge"),id:e+"_unmerge"}],select:this.mergeSelectHandler.bind(this),click:function(e){e.element.setAttribute("aria-label",r.getConstant("MergeCells")),e.element.classList.contains("e-active")?t.unMerge():t.merge(t.parent.element.id+"_merge_all")},created:function(){var e=r.getConstant("MergeCells");t.mergeSplitBtn.element.title=e,t.mergeSplitBtn.element.setAttribute("aria-label",e),t.mergeSplitBtn.element.nextElementSibling.title=r.getConstant("SelectMergeType")},beforeOpen:function(e){return e.element.setAttribute("aria-label",r.getConstant("MergeCells"))}}),this.mergeSplitBtn.createElement=this.parent.createElement,this.mergeSplitBtn.appendTo("#"+e+"_merge"),this.mergeSplitBtn.element.parentElement},n.prototype.mergeSelectHandler=function(e){e.item.id===this.parent.element.id+"_unmerge"?this.unMerge():this.merge(e.item.id),this.mergeSplitBtn.element.setAttribute("aria-label",e.item.text)},n.prototype.unMerge=function(e){var r=this.parent.getActiveSheet(),n=t(r.selectedRange);if(zd(this.parent,c(n)))this.parent.notify(Ka,null);else{this.parent.showSpinner();var i=r.selectedRange;this.parent.notify(St,{merge:!1,range:e&&e.range||i,isAction:!0,refreshRibbon:!0,type:"All"}),this.toggleActiveState(!1),this.parent.hideSpinner()}},n.prototype.merge=function(e){var r,n=this,i=this.parent.getActiveSheet(),a=t(i.selectedRange);if(zd(this.parent,c(a)))this.parent.notify(Ka,null);else{for(var s,o=e.includes("merge_all"),l=a[0];l<=a[2];l++)for(var d=a[1];d<=a[3];d++)l===a[0]&&d===a[1]&&o||l===a[0]&&e.includes("merge_vertically")||d===a[1]&&e.includes("_merge_horizontally")||((r=Ln(l,d,i)||{}).value||r.formula)&&(s=!0);if(!s)return this.performMerge(e),void(o&&this.toggleActiveState(!0));var h=this.parent.serviceLocator.getService(Al);h.show({height:200,width:400,isModal:!0,showCloseIcon:!0,cssClass:"e-merge-alert-dlg",content:this.parent.serviceLocator.getService(kl).getConstant("MergeCellsAlert"),beforeOpen:function(e){var t={dialogName:"MergeAlertDialog",element:e.element,target:e.target,cancel:e.cancel};n.parent.trigger("dialogBeforeOpen",t),t.cancel?e.cancel=!0:Fd(n.parent.element)},buttons:[{buttonModel:{content:this.parent.serviceLocator.getService(kl).getConstant("Ok"),isPrimary:!0},click:function(){h.hide(),n.performMerge(e),o&&n.toggleActiveState(!0)}}]})}},n.prototype.performMerge=function(e){var t=this.parent.element.id;switch(this.parent.showSpinner(),e){case t+"_merge_all":this.parent.notify(St,{merge:!0,range:this.parent.getActiveSheet().selectedRange,type:"All",isAction:!0,refreshRibbon:!0});break;case t+"_merge_horizontally":this.parent.notify(St,{merge:!0,range:this.parent.getActiveSheet().selectedRange,type:"Horizontally",isAction:!0});break;case t+"_merge_vertically":this.parent.notify(St,{merge:!0,range:this.parent.getActiveSheet().selectedRange,type:"Vertically",isAction:!0})}this.parent.hideSpinner()},n.prototype.getSortFilterDDB=function(e){var r,n=this,i=this.parent.serviceLocator.getService(kl);return this.sortingDdb=new Oh.DropDownButton({cssClass:"e-sort-filter-ddb",iconCss:"e-icons e-sort-filter-icon",items:[{text:i.getConstant("SortAscending"),iconCss:"e-icons e-sort-asc"},{text:i.getConstant("SortDescending"),iconCss:"e-icons e-sort-desc"},{text:i.getConstant("CustomSort")+"...",iconCss:"e-icons e-sort-custom"},{separator:!0},{text:i.getConstant("Filter"),iconCss:"e-icons e-filter-apply",id:e+"_applyfilter"},{text:i.getConstant("ClearAllFilter"),iconCss:"e-icons e-filter-clear",id:e+"_clearfilter"},{text:i.getConstant("ReapplyFilter"),iconCss:"e-icons e-filter-reapply",id:e+"_reapplyfilter"}],createPopupOnClick:!0,beforeItemRender:function(t){var r={isFiltered:!1,isClearAll:!0};n.parent.notify(Oa,r),n.parent.allowSorting||t.item.text!==i.getConstant("SortAscending")&&t.item.text!==i.getConstant("SortDescending")&&t.item.text!==i.getConstant("CustomSort")+"..."||t.element.classList.add("e-disabled"),n.parent.allowFiltering||t.item.text!==i.getConstant("Filter")||t.element.classList.add("e-disabled"),t.item.id!==e+"_clearfilter"&&t.item.id!==e+"_reapplyfilter"||(r.isFiltered?t.element.classList.remove("e-disabled"):t.element.classList.add("e-disabled"))},beforeOpen:function(e){n.refreshSelected(n.sortingDdb,e.element,"iconCss"),e.element.setAttribute("aria-label",n.parent.serviceLocator.getService(kl).getConstant("SortAndFilter"))},select:function(e){var a=[];if(e.item.text===i.getConstant("SortAscending")||e.item.text===i.getConstant("SortDescending")||e.item.text===i.getConstant("CustomSort")+"..."){var s=t(n.parent.getActiveSheet().selectedRange),o=Ur(s[0],s[1],n.parent.getActiveSheet());if(zd(n.parent,o))return void n.parent.notify(Ka,null)}switch(e.item.text){case i.getConstant("Filter"):n.parent.notify(xa,{});break;case i.getConstant("ClearAllFilter"):n.parent.notify(Ra,{isAction:!0});break;case i.getConstant("ReapplyFilter"):n.parent.notify(Ea,null);break;case i.getConstant("CustomSort")+"...":n.parent.notify($i,null);break;default:if(r=e.item.text===i.getConstant("SortAscending")?"Ascending":"Descending",n.parent.sortCollection)for(var l=n.parent.sortCollection.length-1;l>=0;l--)n.parent.sortCollection[l]&&n.parent.sortCollection[l].sheetIndex===n.parent.activeSheetIndex&&(a.push(n.parent.sortCollection[l]),n.parent.sortCollection.splice(l,1));n.parent.notify(Ia,{sortOptions:{sortDescriptors:{order:r}}}),n.parent.notify(Zi,{sortOptions:{sortDescriptors:{order:r}},previousSort:a})}n.sortingDdb.element.setAttribute("aria-label",e.item.text)}}),this.sortingDdb.createElement=this.parent.createElement,this.sortingDdb.appendTo(this.parent.createElement("button",{id:e+"_sorting",attrs:{type:"button"},className:"e-ss-ddb"})),this.sortingDdb.element},n.prototype.getFindBtn=function(e){var t=this,r=this.parent.createElement("button",{id:e+"_findbtn",attrs:{type:"button","aria-label":this.parent.serviceLocator.getService(kl).getConstant("FindReplaceTooltip")}});return this.findDdb=new bh.Button({cssClass:"e-spreadsheet-find-ddb e-flat",iconCss:"e-icons e-search-icon"}),this.findDdb.createElement=this.parent.createElement,this.findDdb.appendTo(r),r.onclick=function(e){t.parent.notify(Z,{event:e})},this.findDdb.element},n.prototype.getClearDDB=function(e){var t=this,r=this.parent.serviceLocator.getService(kl);return this.clearDdb=new Oh.DropDownButton({cssClass:"e-clear-ddb",iconCss:"e-icons e-clear-icon",items:[{text:r.getConstant("ClearAll"),id:e+"_Clear All"},{text:r.getConstant("ClearFormats"),id:e+"_Clear Formats"},{text:r.getConstant("ClearContents"),id:e+"_Clear Contents"},{text:r.getConstant("ClearHyperlinks"),id:e+"_Clear Hyperlinks"}],createPopupOnClick:!0,beforeOpen:function(e){e.element.setAttribute("aria-label",t.parent.serviceLocator.getService(kl).getConstant("Clear"))},beforeItemRender:function(r){var n=t.parent.getActiveSheet();n.isProtected&&n.protectSettings.formatCells&&r.item.id!==e+"_Clear Formats"&&(r.element.classList.add("e-disabled"),r.element.setAttribute("aria-disabled","true"))},select:function(r){t.parent.notify(os,{options:{type:r.item.id.replace(e+"_","")},isAction:!0}),t.clearDdb.element.setAttribute("aria-label",r.item.text)}}),this.clearDdb.createElement=this.parent.createElement,this.clearDdb.appendTo(this.parent.createElement("button",{id:e+"_clear",attrs:{type:"button"},className:"e-ss-ddb"})),this.clearDdb.element},n.prototype.ribbonCreated=function(){var t=this.parent.serviceLocator.getService(kl).getConstant("CollapseToolbar");(0,e.attributes)(this.ribbon.element.querySelector(".e-drop-icon"),{role:"button",tabindex:"-1",title:t,"aria-label":t}),this.ribbon.toolbarObj&&(this.ribbon.toolbarObj.allowKeyboard=this.parent.enableKeyboardNavigation,this.ribbon.toolbarObj.dataBind())},n.prototype.alignItemRender=function(e){e.element.title=this.parent.serviceLocator.getService(kl).getConstant("Align"+this.getAlignText(e))},n.prototype.getAlignText=function(e){var t=e.item.iconCss.split(" e-")[1].split("-icon")[0];return t[0].toUpperCase()+t.slice(1,t.length)},n.prototype.toggleBtnClicked=function(t){var n,i,a,s,o,l=(0,e.closest)(t.target,".e-btn"),d=this.parent.element.id,h=l.id,p=ae;switch(h){case d+"_bold":i={fontWeight:"normal"},a={fontWeight:"bold"},o="fontWeight";break;case d+"_italic":i={fontStyle:"normal"},a={fontStyle:"italic"},o="fontStyle";break;case d+"_line-through":p=oe,a=i={textDecoration:"line-through"},o="textDecoration";break;case d+"_underline":p=oe,a=i={textDecoration:"underline"},o="textDecoration"}l.classList.contains("e-active")?(n=a[""+o],s={style:a,onActionUpdate:!0},this.parent.notify(p,s),s.cancel&&l.classList.remove("e-active")):(n=i[""+o],s={style:i,onActionUpdate:!0},this.parent.notify(p,s),s.cancel&&l.classList.add("e-active")),s.cancel||n===s.style[""+o]||this.refreshToggleBtn(r(this.parent.getActiveSheet().activeCell))},n.prototype.getCellStyleValue=function(e,t){var r=Ln(t[0],t[1],this.parent.getActiveSheet()),n=this.parent.cellStyle[""+e];return r&&r.style&&r.style[""+e]&&(n=r.style[""+e]),n},n.prototype.refreshSelected=function(e,t,r,n){void 0===n&&(n=r);for(var i=0;i<e.items.length;i++)if(e.items[i][""+n]===e[""+r]){t.children[i].classList.add("e-selected");break}},n.prototype.expandCollapseHandler=function(e){var t=this.ribbon.element.querySelector(".e-drop-icon"),r=this.parent.serviceLocator.getService(kl);e.expanded?(t.title=r.getConstant("CollapseToolbar"),t.setAttribute("aria-label",r.getConstant("ExpandToolbar"))):(t.title=r.getConstant("ExpandToolbar"),t.setAttribute("aria-label",r.getConstant("CollapseToolbar"))),this.parent.setPanelSize()},n.prototype.getChartThemeDdbItems=function(e){var t=this.parent.serviceLocator.getService(kl),r=[];return["Material","Fabric","Bootstrap","HighContrastLight","MaterialDark","FabricDark","HighContrast","BootstrapDark","Bootstrap4","Bootstrap5Dark","Bootstrap5","TailwindDark","Tailwind","Tailwind3","Tailwind3Dark","FluentDark","Fluent","Fluent2","Fluent2Dark","Material3","Material3Dark"].forEach((function(n){r.push({id:n,text:t.getConstant(n),iconCss:n===e?"e-icons e-selected-icon":""})})),r},n.prototype.getNumFormatDdbItems=function(e){var t=this.parent.serviceLocator.getService(kl);return[{id:e+"_General",text:t.getConstant("General")},{id:e+"_Number",text:t.getConstant("Number")},{id:e+"_Currency",text:t.getConstant("Currency")},{id:e+"_Accounting",text:t.getConstant("Accounting")},{id:e+"_ShortDate",text:t.getConstant("ShortDate")},{id:e+"_LongDate",text:t.getConstant("LongDate")},{id:e+"_Time",text:t.getConstant("Time")},{id:e+"_Percentage",text:t.getConstant("Percentage")},{id:e+"_Fraction",text:t.getConstant("Fraction")},{id:e+"_Scientific",text:t.getConstant("Scientific")},{id:e+"_Text",text:t.getConstant("Text")},{id:e+"_Custom",text:t.getConstant("Custom")}]},n.prototype.getFontFamilyItems=function(){return[{text:"Arial"},{text:"Arial Black"},{text:"Axettac Demo"},{text:"Batang"},{text:"Book Antiqua"},{text:"Calibri",iconCss:"e-icons e-selected-icon"},{text:"Comic Sans MS"},{text:"Courier"},{text:"Courier New"},{text:"Din Condensed"},{text:"Georgia"},{text:"Helvetica"},{text:"Helvetica New"},{text:"Roboto"},{text:"Tahoma"},{text:"Times New Roman"},{text:"Verdana"}]},n.prototype.applyNumFormat=function(e){var r=this.parent.getActiveSheet(),n={format:e,range:r.selectedRange,cancel:!1,requestType:"NumberFormat"},i={range:r.name+"!"+n.range,format:n.format,requestType:"NumberFormat"},a=zd(this.parent,c(t(n.range)));return!a&&(this.parent.trigger("beforeCellFormat",n),this.parent.notify(K,{eventArgs:n,action:"format"}),n.cancel)||(this.parent.notify(te,n),this.parent.notify(rr,{type:"mousedown"}),a||this.parent.notify(ka,{eventArgs:i,action:"format"})),n.format},n.prototype.renderCustomFormatDialog=function(e,t){var n=this,i=this.parent.serviceLocator.getService(kl),a=this.parent.createElement("div"),s=this.parent.createElement("div",{className:"e-custom-dialog"}),o=this.parent.createElement("button",{className:"e-btn",attrs:{type:"button"}});o.innerText=i.getConstant("Apply");var l=this.parent.createElement("div",{className:"e-custom-sample"});l.innerText=i.getConstant("CustomFormatTypeList")+":";var d=this.parent.createElement("input",{className:"e-input e-dialog-input",attrs:{type:"text",name:"input",spellcheck:"false",placeholder:i.getConstant("CustomFormatPlaceholder")}}),h=this.parent.createElement("div",{className:"e-custom-listview"}),p=this.parent.serviceLocator.getService(Al),c=new wh.ListView({dataSource:t,select:function(e){d.value=e.item.textContent,e.event&&"keydown"===e.event.type&&e.item&&e.item.focus()}});s.appendChild(d),s.appendChild(o),s.appendChild(l),s.appendChild(h),c.appendTo(h);o.addEventListener("click",(function(){var r,a=d.value,s=t.indexOf(a);r=s>-1?e[s]:Ho(n.parent,a),(r=n.applyNumFormat(r))&&(n.refreshNumFormatSelection(Bo(r,!0),n.parent.getActiveSheet(),i,r),n.parent.notify(gr,{action:"addToCustomFormats",format:a,defaultFormat:r})),p.hide()}));d.addEventListener("input",(function(){c.getSelectedItems()&&c.unselectItem()})),p.show({header:i.getConstant("CustomFormat"),cssClass:"e-custom-format-dlg",height:this.parent.cssClass.indexOf("e-bigger")>-1?502:480,width:440,isModal:!0,showCloseIcon:!0,content:s,footerTemplate:a,beforeOpen:function(e){var t={dialogName:"CustomNumberFormatDlg",element:e.element,target:e.target,cancel:e.cancel};n.parent.trigger("dialogBeforeOpen",t),t.cancel?(e.cancel=!0,Bl((function(){p.hide(!0),Fd(n.parent.element)}))):Fd(n.parent.element)}});var u=this.parent.getActiveSheet(),f=r(u.activeCell),g=Ln(f[0],f[1],u);if(g&&g.format){var m=e.indexOf(g.format);c.selectItem(c.element.getElementsByClassName("e-list-item")[m])}},n.prototype.tBarDdbBeforeOpen=function(e,t,r,n){void 0===n&&(n=0);var i=this.parent.viewport.height,a=parseInt(getComputedStyle(e.firstElementChild).height,10)*(t.length-n)+2*parseInt(getComputedStyle(e).paddingTop,10);if(n){var s=getComputedStyle(e.querySelector(".e-separator"));a+=n*(parseInt(s.borderBottomWidth,10)+2*parseInt(s.marginTop,10))}a>i?(e.style.height=i+"px",e.style.overflowY="auto"):e.style.height&&(e.style.height="",e.style.overflowY=""),e.setAttribute("aria-label",r)},n.prototype.numDDBOpen=function(e){this.numPopupWidth=0;for(var t=e.element.querySelectorAll("span.e-numformat-preview-text"),r=0,n=t.length;r<n;r++)this.numPopupWidth<t[r].offsetWidth&&(this.numPopupWidth=t[r].offsetWidth);var i=this.numPopupWidth+160;document.querySelector(".e-numformat-ddb.e-dropdown-popup").style.width=i+"px"},n.prototype.previewNumFormat=function(t){if(!t.item.id.includes("_Custom")){var n=this.parent.createElement("div",{className:"e-numformat-text",styles:"width:100%",innerHTML:t.element.innerHTML});t.element.innerHTML="";var i=this.parent.getActiveSheet(),a=r(i.activeCell),s=Ln(a[0],a[1],i,!1,!0);if(!(0,e.isNullOrUndefined)(s.value)||""!==s.value){var o=Mo(t.item.id.split(this.parent.element.id+"_")[1]),l={type:t.item.text,formattedText:"",value:s.value,format:o,cell:{value:s.value,format:o},skipFormatCheck:Yr(this.parent)};this.parent.notify(re,l);var d=this.parent.createElement("span",{className:"e-numformat-preview-text",styles:"float:right;"});d.innerText=l.formattedText,n.appendChild(d)}t.element.appendChild(n)}},n.prototype.refreshRibbonContent=function(t){if(this.ribbon){(0,e.isNullOrUndefined)(t)&&(t=this.ribbon.selectedTab);var n=this.parent.serviceLocator.getService(kl),i=this.parent.getActiveSheet();switch(this.ribbon.items[t].header.text){case n.getConstant("Home"):this.refreshHomeTabContent(r(i.activeCell));break;case n.getConstant("Insert"):if(i.isProtected){var a=r(i.activeCell);i.protectSettings.insertLink&&!Ar(Ln(a[0],a[1],i),bl(i,a[1]))?this.enableToolbarItems([{tab:n.getConstant("Insert"),items:[this.parent.element.id+"_hyperlink"],enable:!0}]):this.enableToolbarItems([{tab:n.getConstant("Insert"),items:[this.parent.element.id+"_hyperlink"],enable:!1}])}break;case n.getConstant("Formulas"):break;case n.getConstant("Data"):this.refreshDataTabContent(t);break;case n.getConstant("View"):this.refreshViewTabContent(t)}}},n.prototype.refreshHomeTabContent=function(n){(0,e.isNullOrUndefined)(document.getElementById(this.parent.element.id+"_number_format"))||(this.numFormatDDB=(0,e.getComponent)(document.getElementById(this.parent.element.id+"_number_format"),Oh.DropDownButton));var i=this.parent.getActiveSheet(),a=r(i.activeCell),s=this.parent.serviceLocator.getService(kl),o=Ln(a[0],a[1],i,!1,!0),l=Bo(o.format||"General",!0);if(this.refreshNumFormatSelection(l,i,s,o.format),i.isProtected&&this.parent.enableClipboard&&this.parent.clipboardModule.copiedInfo&&this.parent.notify(wi,[{items:[this.parent.element.id+"_paste"],enable:!Ar(o,bl(i,a[1]))}]),this.fontNameDdb&&(i.isProtected&&!i.protectSettings.formatCells?this.refreshFontNameSelection("Calibri"):this.refreshFontNameSelection(this.getCellStyleValue("fontFamily",n))),this.fontSizeDdb){var d=this.getCellStyleValue("fontSize",n);i.isProtected&&!i.protectSettings.formatCells?this.fontSizeDdb.content="11":(d=d.includes("pt")?d.split("pt")[0]:"11")!==this.fontSizeDdb.content&&(this.fontSizeDdb.content=d,this.fontSizeDdb.dataBind())}if(this.refreshTextAlign(i,o,l,n),this.verticalAlignDdb){d="e-icons e-"+this.getCellStyleValue("verticalAlign",n).toLowerCase()+"-icon";i.isProtected&&!i.protectSettings.formatCells?this.verticalAlignDdb.iconCss="e-icons e-bottom-icon":d!==this.verticalAlignDdb.iconCss&&(this.verticalAlignDdb.iconCss=d,this.verticalAlignDdb.dataBind())}if(this.refreshToggleBtn(n),!i.isProtected&&(o.rowSpan>1||o.colSpan>1))this.enableToolbarItems([{tab:s.getConstant("Home"),items:[this.parent.element.id+"_merge_cells"],enable:!0}]),this.toggleActiveState(!0);else{var h=t(i.selectedRange);this.enableToolbarItems([{tab:s.getConstant("Home"),items:[this.parent.element.id+"_merge_cells"],enable:h[0]!==h[2]||h[1]!==h[3]}]),this.toggleActiveState(!1)}},n.prototype.refreshTextAlign=function(e,t,r,n){if(this.textAlignDdb){var i=this.getCellStyleValue("textAlign",n);if(e.isProtected&&!e.protectSettings.formatCells)this.textAlignDdb.iconCss="e-icons e-left-icon";else{void 0!==t.value&&"left"===i&&("Accounting"===r||rn(t.value)&&"Text"!==r)&&(i="right");var a="e-icons e-"+i.toLowerCase()+"-icon";a!==this.textAlignDdb.iconCss&&(this.textAlignDdb.iconCss=a,this.textAlignDdb.dataBind())}}},n.prototype.toggleActiveState=function(e){var t=this.parent.serviceLocator.getService(kl);this.parent.getActiveSheet().isProtected||(e?this.mergeSplitBtn.element.classList.contains("e-active")||(this.mergeSplitBtn.element.classList.add("e-active"),this.mergeSplitBtn.element.title=t.getConstant("UnmergeCells")):this.mergeSplitBtn.element.classList.contains("e-active")&&(this.mergeSplitBtn.element.classList.remove("e-active"),this.mergeSplitBtn.element.title=t.getConstant("MergeCells")))},n.prototype.refreshToggleBtn=function(e){var t,r,n,i=this,a=this.parent.getActiveSheet(),s=this.parent.element.id,o=Ln(e[0],e[1],a),l=["fontWeight","fontStyle","textDecoration","textDecoration"];["bold","italic","line-through","underline","wrap"].forEach((function(d,h){(t=document.getElementById(s+"_"+d))&&(n=!1,a.isProtected&&!a.protectSettings.formatCells||("wrap"===d?n=i.parent.allowWrap&&o&&o.wrap:i.parent.allowCellFormatting&&(r=i.getCellStyleValue(l[h],e).toLowerCase(),n=r.indexOf(d)>-1)),n?t.classList.add("e-active"):t.classList.contains("e-active")&&t.classList.remove("e-active"))}))},n.prototype.refreshFontNameSelection=function(e){e=e.split('"').join(""),this.fontNameDdb.element.firstElementChild.textContent=e;for(var t=0;t<this.fontNameDdb.items.length;t++)if(this.fontNameDdb.items[t].text===e){this.fontNameDdb.items[t].iconCss="e-icons e-selected-icon",t!==this.fontNameIndex&&(this.fontNameDdb.items[this.fontNameIndex].iconCss=""),this.fontNameDdb.setProperties({items:this.fontNameDdb.items},!0),this.fontNameIndex=t;break}["Arial","Arial Black","Axettac Demo","Batang","Book Antiqua","Calibri","Comic Sans MS","Courier","Courier New","Din Condensed","Georgia","Helvetica","Helvetica New","Roboto","Tahoma","Times New Roman","Verdana"].indexOf(e)<0&&(this.fontNameDdb.items[this.fontNameIndex].iconCss=""),this.fontNameDdb.element.setAttribute("aria-label",e)},n.prototype.refreshNumFormatSelection=function(e,t,r,n){if(this.numFormatDDB){t.isProtected&&!t.protectSettings.formatCells?e="General":(n&&"General"===e&&"General"!==n&&(e="Custom"),e=r.getConstant(e));for(var i=0;i<this.numFormatDDB.items.length;i++)""!==this.numFormatDDB.items[i].iconCss&&(this.numFormatDDB.items[i].iconCss=""),this.numFormatDDB.items[i].text===e&&(this.numFormatDDB.items[i].iconCss="e-icons e-selected-icon");this.numFormatDDB.element.firstElementChild.textContent=e,this.numFormatDDB.setProperties({items:this.numFormatDDB.items},!0),this.numFormatDDB.element.setAttribute("aria-label",e)}},n.prototype.fileMenuItemSelect=function(t){var r=this,n=(0,e.extend)({cancel:!1},t);this.parent.trigger("fileMenuItemSelect",n);var i,a=this.parent.element.id;if(!n.cancel)switch(t.item.id){case a+"_Print":this.parent.print();break;case a+"_Open":(0,e.select)("#"+a+"_fileUpload",this.parent.element).click(),Fd(this.parent.element);break;case a+"_Xlsx":case a+"_Xls":case a+"_Csv":case a+"_Pdf":this.parent.notify(J,t);break;case a+"_New":(i=this.parent.serviceLocator.getService(Al)).show({height:200,width:400,isModal:!0,showCloseIcon:!0,content:this.parent.serviceLocator.getService(kl).getConstant("DestroyAlert"),beforeOpen:function(e){var t={dialogName:"DestroySheetDialog",element:e.element,target:e.target,cancel:e.cancel};r.parent.trigger("dialogBeforeOpen",t),t.cancel?e.cancel=!0:Fd(r.parent.element)},buttons:[{buttonModel:{content:this.parent.serviceLocator.getService(kl).getConstant("Ok"),isPrimary:!0},click:function(){i.hide(),r.parent.refresh(!0)}}]})}},n.prototype.toolbarClicked=function(e){if(e.item&&"spreadsheet_find"!==e.item.id){var t=this.parent.element.id,n=this.parent.getActiveSheet(),i=void 0,a=void 0,s=void 0,o=void 0;switch(e.item.id){case t+"_headers":if(i={isShow:!n.showHeaders,sheetIdx:this.parent.activeSheetIndex,cancel:!1},this.parent.notify(ka,{eventArgs:i,action:"headers"}),i.cancel)return;this.parent.setSheetPropertyOnMute(n,"showHeaders",!n.showHeaders),this.parent.serviceLocator.getService("sheet").showHideHeaders(),this.toggleRibbonItems({props:"Headers",activeTab:this.ribbon.selectedTab});break;case t+"_gridlines":if(a={isShow:!n.showGridLines,sheetIdx:this.parent.activeSheetIndex,cancel:!1},this.parent.notify(ka,{eventArgs:a,action:"gridLines"}),a.cancel)return;this.parent.setSheetPropertyOnMute(n,"showGridLines",!n.showGridLines),this.toggleRibbonItems({props:"GridLines",activeTab:this.ribbon.selectedTab});break;case t+"_protect":this.parent.notify(ao,{});break;case t+"_undo":this.parent.notify(ma,{isUndo:!0});break;case t+"_redo":this.parent.notify(ma,{isUndo:!1});break;case t+"_freezepanes":s=r(n.topLeftCell),o=n.frozenRows||n.frozenColumns?s:r(n.activeCell),this.parent.notify(js,{row:o[0]-s[0],column:o[1]-s[1],triggerEvent:!0});break;case t+"_freezerows":this.parent.notify(js,{row:n.frozenRows?0:r(n.activeCell)[0]-r(n.topLeftCell)[0],column:n.frozenColumns,triggerEvent:!0});break;case t+"_freezecolumns":this.parent.notify(js,{row:n.frozenRows,column:n.frozenColumns?0:r(n.activeCell)[1]-r(n.topLeftCell)[1],triggerEvent:!0});break;case t+"_protectworkbook":this.parent.password.length>0?this.parent.notify(Bs,null):this.parent.isProtected?(this.parent.isProtected=!1,this.parent.showSheetTabs&&(this.parent.element.querySelector(".e-add-sheet-tab").removeAttribute("disabled"),this.parent.element.querySelector(".e-add-sheet-tab").classList.remove("e-disabled")),this.toggleRibbonItems({props:"Protectworkbook",activeTab:this.ribbon.selectedTab}),this.parent.notify(ka,{action:"protectWorkbook",eventArgs:{isProtected:!1}})):this.parent.element.querySelector(".e-add-sheet-tab").classList.contains("e-disabled")?this.toggleRibbonItems({props:"Protectworkbook",activeTab:this.ribbon.selectedTab}):this.parent.notify(Ms,null)}this.parent.notify(xi,e)}},n.prototype.toggleRibbonItems=function(t){var r="",n=this.parent.serviceLocator.getService(kl).getConstant("View"),i=this.parent.serviceLocator.getService(kl).getConstant("Data");if(this.ribbon.items[this.ribbon.selectedTab].header.text===n){if((0,e.isNullOrUndefined)(t.activeTab))for(var a=0,s=this.ribbon.items.length;a<s;a++)if(this.ribbon.items[a].header.text===n){t.activeTab=a;break}var o=this.getLocaleText(t.props);"GridLines"===t.props&&this.parent.serviceLocator.getService("sheet").toggleGridlines();var l=this.parent.element.id+"_"+t.props.toLowerCase(),d=this.ribbon.items[t.activeTab].content.length;for(a=void 0;a<d;a++)"Separator"!==this.ribbon.items[t.activeTab].content[a].type&&this.ribbon.items[t.activeTab].content[a].id===l&&(this.ribbon.items[t.activeTab].content[a].text=o,this.ribbon.setProperties({items:this.ribbon.items},!0));this.ribbon.items[this.ribbon.selectedTab].header.text===n&&"Protect"!==t.props&&this.updateToggleText(t.props.toLowerCase(),o)}if(this.ribbon.items[this.ribbon.selectedTab].header.text===i){if((0,e.isNullOrUndefined)(t.activeTab)){a=0;for(var h=this.ribbon.items.length;a<h;a++)if(this.ribbon.items[a].header.text===i){t.activeTab=a;break}}if((l=this.parent.element.id+"_"+t.props.toLowerCase())===this.parent.element.id+"_protect"){var p=this.ribbon.items[this.ribbon.selectedTab].content.length,c=void 0;for(c=0;c<p&&this.ribbon.items[this.ribbon.selectedTab].content[c].id!==this.parent.element.id+"_protect";c++);r=this.getLocaleProtectText("Sheet",!0)}else if(l===this.parent.element.id+"_protectworkbook"){var u=this.ribbon.items[this.ribbon.selectedTab].content.length;c=void 0;for(c=0;c<u&&this.ribbon.items[this.ribbon.selectedTab].content[c].id!==this.parent.element.id+"_protectworkbook";c++);this.parent.isProtected||this.parent.password.length>0?r=this.getLocaleProtectWorkbook("UnprotectWorkbook"):this.parent.isProtected||(r=this.getLocaleProtectWorkbook("ProtectWorkbook"))}for(d=this.ribbon.items[t.activeTab].content.length,a=void 0;a<d;a++)"Separator"!==this.ribbon.items[t.activeTab].content[a].type&&this.ribbon.items[t.activeTab].content[a].id===l&&(this.ribbon.items[t.activeTab].content[a].text=r,this.ribbon.setProperties({items:this.ribbon.items},!0));this.ribbon.items[this.ribbon.selectedTab].header.text===i&&this.updateToggleText(t.props.toLowerCase(),r)}},n.prototype.enableFileMenuItems=function(e){this.ribbon.enableMenuItems(e.items,e.enable,e.isUniqueId)},n.prototype.hideRibbonTabs=function(e){this.ribbon.hideTabs(e.tabs,e.hide)},n.prototype.addRibbonTabs=function(t){this.ribbon.addTabs(t.items,t.insertBefore),(0,e.select)(".e-ribbon .e-tab-header .e-toolbar-item:not(.e-menu-tab).e-hide",this.parent.element)&&this.parent.updateActiveBorder((0,e.selectAll)(".e-ribbon .e-tab-header .e-toolbar-item:not(.e-menu-tab)",this.parent.element)[this.ribbon.selectedTab])},n.prototype.updateToggleText=function(t,r){var n=(0,e.select)("#"+this.parent.element.id+"_"+t+" .e-tbar-btn-text",this.ribbon.element);if("protect"===t||"protectworkbook"===t?n.parentElement.setAttribute("aria-label",r):n.parentElement.setAttribute("aria-label",n.textContent),Bl((function(){n&&(n.textContent=r)})),"headers"===t){var i=this.parent.element.getElementsByClassName("e-findtool-dlg")[0];i&&i.classList.contains("e-popup-open")&&this.parent.notify(Z,{refreshPosition:!0,dialogEle:i})}},n.prototype.refreshViewTabContent=function(e){for(var t,r=this.parent.element.id,n=this.parent.getActiveSheet(),i=this.parent.serviceLocator.getService(kl),a=0;a<this.ribbon.items[e].content.length;a++)"Separator"!==(t=this.ribbon.items[e].content[a]).type&&(t.id===r+"_headers"&&this.updateViewTabContent(e,"Headers",a),t.id===r+"_gridlines"&&this.updateViewTabContent(e,"GridLines",a),t.id===r+"_freezepanes"&&(n.frozenRows||n.frozenColumns?t.text===i.getConstant("FreezePanes")&&this.updateToggleText("freezepanes",this.updateRibbonItemText("Unfreeze","Panes",a,e)):t.text===i.getConstant("UnfreezePanes")&&this.updateToggleText("freezepanes",this.updateRibbonItemText("Freeze","Panes",a,e))),t.id===r+"_freezerows"&&(n.frozenRows?t.text===i.getConstant("FreezeRows")&&this.updateToggleText("freezerows",this.updateRibbonItemText("Unfreeze","Rows",a,e)):t.text===i.getConstant("UnfreezeRows")&&this.updateToggleText("freezerows",this.updateRibbonItemText("Freeze","Rows",a,e))),t.id===r+"_freezecolumns"&&(n.frozenColumns?t.text===i.getConstant("FreezeColumns")&&this.updateToggleText("freezecolumns",this.updateRibbonItemText("Unfreeze","Columns",a,e)):t.text===i.getConstant("UnfreezeColumns")&&this.updateToggleText("freezecolumns",this.updateRibbonItemText("Freeze","Columns",a,e))))},n.prototype.updateViewTabContent=function(e,t,r){var n=this.parent.getActiveSheet(),i=this.parent.serviceLocator.getService(kl);n["show"+t]?this.ribbon.items[e].content[r].text===i.getConstant("Show"+t)&&this.updateToggleText(t.toLowerCase(),this.updateRibbonItemText("Hide",t,r,e)):this.ribbon.items[e].content[r].text===i.getConstant("Hide"+t)&&this.updateToggleText(t.toLowerCase(),this.updateRibbonItemText("Show",t,r,e))},n.prototype.updateRibbonItemText=function(e,t,r,n){var i=this.parent.serviceLocator.getService(kl).getConstant(e+t);return this.ribbon.items[n].content[r].text=i,this.ribbon.setProperties({items:this.ribbon.items},!0),i},n.prototype.refreshDataTabContent=function(e){for(var t,r=this.parent.element.id,n=0;n<this.ribbon.items[e].content.length;n++)if("Separator"!==this.ribbon.items[e].content[n].type){if(this.ribbon.items[e].content[n].id===r+"_protect"){if(this.updateDataTabContent(e,"Sheet",n),t)break;t=!0}this.ribbon.items[e].content[n].id===r+"_protectworkbook"&&this.updateDataTabContent(e,"Workbook",n)}},n.prototype.updateDataTabContent=function(e,t,r){var n=this.parent.getActiveSheet(),i=this.parent.serviceLocator.getService(kl);if("Sheet"===t)n.isProtected?this.ribbon.items[e].content[r].text===i.getConstant("Protect"+t)&&(this.ribbon.items[e].content[r].cssClass="e-active",this.updateProtectBtn("Unprotect",t,r,e)):this.updateProtectBtn("Protect",t,r,e);else if("Workbook"===t){var a=this.parent.serviceLocator.getService(kl);this.parent.isProtected?this.ribbon.items[e].content[r].text===a.getConstant("Protect"+t)&&this.updateToggleText("protectworkbook",this.updateRibbonItemText("Unprotect",t,r,e)):this.ribbon.items[e].content[r].text===a.getConstant("Unprotect"+t)&&this.updateToggleText("protectworkbook",this.updateRibbonItemText("Protect",t,r,e))}},n.prototype.updateProtectBtn=function(e,t,r,n){var i=this.parent.serviceLocator.getService(kl).getConstant(e+t);this.ribbon.items[n].content[r].text=i,this.ribbon.setProperties({items:this.ribbon.items},!0),this.updateToggleText("protect",i)},n.prototype.updateProtectWorkbookBtn=function(e,t,r,n){var i=this.parent.serviceLocator.getService(kl).getConstant(e);this.ribbon.items[n].content[r].text=i,this.ribbon.setProperties({items:this.ribbon.items},!0),this.updateToggleText("protectworkbook",i)},n.prototype.addToolbarItems=function(e){var t=this.parent.serviceLocator.getService(kl);this.ribbon.addToolbarItems(t.getConstant(e.tab),e.items,e.index),this.parent&&this.parent.isReact&&this.parent.portals&&this.ribbon.toolbarObj&&this.ribbon.toolbarObj.portals&&(this.parent.portals=this.parent.portals.concat(this.ribbon.toolbarObj.portals),this.parent.renderReactTemplates())},n.prototype.enableToolbarItems=function(e){var t=this;e.forEach((function(e){t.ribbon.enableItems(e.tab||t.ribbon.items[t.ribbon.selectedTab].header.text,e.items,e.enable)}))},n.prototype.createMobileView=function(){var e=this,t=this.parent.element.id,r=this.parent.createElement("div",{className:"e-header-toolbar"}),n=this.parent.createElement("ul");r.appendChild(n);var i=new ch.Toolbar({items:[{prefixIcon:"e-tick-icon",align:"Left",id:t+"focused_tick",cssClass:"e-focused-tick"},{template:n,align:"Right",id:t+"file_menu"}],clicked:function(r){if(r.item.id===t+"focused_tick")e.parent.element.classList.remove("e-mobile-focused"),e.parent.renderModule.setSheetPanelSize()},created:function(){var t=new ch.Menu({cssClass:"e-mobile e-file-menu",enableRtl:!0,showItemOnClick:!0,items:e.getRibbonMenuItems(),select:e.fileMenuItemSelect.bind(e),beforeOpen:function(t){t.element.parentElement.classList.remove("e-rtl"),e.fileMenuBeforeOpen(t)},beforeClose:e.fileMenuBeforeClose.bind(e)});t.createElement=e.parent.createElement,t.appendTo(n)}});i.createElement=this.parent.createElement,i.appendTo(r),this.parent.element.insertBefore(r,this.parent.element.firstElementChild),this.renderMobileToolbar()},n.prototype.renderMobileToolbar=function(){var e=this,t=this.parent.createElement("div",{className:"e-toolbar-panel e-ribbon"}),r=this.parent.createElement("div"),n=this.parent.createElement("button",{attrs:{type:"button"}});t.appendChild(r),t.appendChild(n),t.style.display="block",this.parent.element.appendChild(t);var i=new Oh.DropDownButton({cssClass:"e-caret-hide",content:this.ribbon.items[0].header.text,items:[{text:this.ribbon.items[0].header.text},{text:this.ribbon.items[1].header.text},{text:this.ribbon.items[2].header.text},{text:this.ribbon.items[3].header.text}],createPopupOnClick:!0,select:function(t){t.item.text!==i.content&&(a.element.style.display="none",i.content=t.item.text,i.dataBind(),a.items=e.ribbon.items[i.items.indexOf(t.item)+1].content,a.width="calc(100% - "+n.getBoundingClientRect().width+"px)",a.element.style.display="",a.dataBind(),a.items[0].text=t.item.text,a.dataBind())},open:function(e){var t=e.element.parentElement,r=t.getBoundingClientRect(),n=(0,dh.calculatePosition)(i.element,"right","bottom");t.style.left=n.left-r.width+"px",t.style.top=n.top-r.height+"px";for(var a=0;a<i.items.length;a++)if(i.content===i.items[a].text){e.element.children[a].classList.add("e-selected");break}},close:function(){return Fd(e.parent.element)}});i.createElement=this.parent.createElement,i.appendTo(n);var a=new ch.Toolbar({width:"calc(100% - "+n.getBoundingClientRect().width+"px)",items:this.ribbon.items[0].content,clicked:this.toolbarClicked.bind(this)});a.createElement=this.parent.createElement,a.appendTo(r),t.style.display=""},n.prototype.fileMenuBeforeOpen=function(e){var t,r=this,n=this.parent.serviceLocator.getService(kl),i=[".xlsx",".xls",".csv",".pdf"];e.parentItem.text===n.getConstant("SaveAs")&&[].slice.call(e.element.children).forEach((function(e,n){t=r.parent.createElement("div",{innerHTML:e.innerHTML}),e.innerHTML="";var a=r.parent.createElement("span",{className:"e-extension"});a.innerText=i[n],t.appendChild(a),e.appendChild(t)})),this.parent.trigger("fileMenuBeforeOpen",e),e.element.setAttribute("aria-label",n.getConstant("File"))},n.prototype.enableRibbonTabs=function(e){this.ribbon.enableTabs(e.tabs,e.enable)},n.prototype.fileMenuBeforeClose=function(e){var t=this;this.parent.trigger("fileMenuBeforeClose",e),e.parentItem&&e.event&&37===e.event.keyCode&&e.parentItem.id===this.parent.element.id+"_File"&&Bl((function(){var e=t.ribbon.element.querySelector(".e-tab-header .e-toolbar-item .e-tab-wrap");if(e){Fd(e);var r=e.querySelector(".e-menu-item.e-focused");r&&r.classList.remove("e-focused")}}))},n.prototype.hideFileMenuItems=function(e){this.ribbon.hideMenuItems(e.items,e.hide,e.isUniqueId)},n.prototype.addFileMenuItems=function(e){this.ribbon.addMenuItems(e.items,e.text,e.insertAfter,e.isUniqueId)},n.prototype.hideToolbarItems=function(e){this.ribbon.hideToolbarItems(e.tab,e.indexes,e.hide)},n.prototype.protectSheetHandler=function(e){var t=this.parent.getActiveSheet(),r=this.parent.serviceLocator.getService(kl);t.isProtected&&t.protectSettings.formatCells||!t.isProtected?(this.parent.allowCellFormatting?(this.enableToolbarItems([{tab:r.getConstant("Home"),items:e.enableHomeBtnId,enable:!0}]),t.isProtected&&t.protectSettings.formatCells&&this.enableToolbarItems([{tab:r.getConstant("Home"),items:e.enableHomeBtnId.slice(15,16),enable:!1}])):this.enableToolbarItems([{tab:r.getConstant("Home"),items:e.enableHomeBtnId.slice(3,14),enable:!1}]),this.parent.allowWrap||this.enableToolbarItems([{tab:r.getConstant("Home"),items:e.enableHomeBtnId.slice(14,15),enable:!1}]),this.parent.allowNumberFormatting||this.enableToolbarItems([{tab:r.getConstant("Home"),items:e.enableHomeBtnId.slice(2,3),enable:!1}]),this.parent.notify($a,null)):this.enableToolbarItems([{tab:r.getConstant("Home"),items:e.disableHomeBtnId,enable:!1}]),t.isProtected&&t.protectSettings.insertLink||!t.isProtected?!this.parent.allowHyperlink||t.isProtected&&t.protectSettings.insertLink?this.enableToolbarItems([{tab:r.getConstant("Insert"),items:e.enableInsertBtnId.slice(0,1),enable:!1}]):this.enableToolbarItems([{tab:r.getConstant("Insert"),items:e.enableInsertBtnId,enable:!0}]):this.enableToolbarItems([{tab:r.getConstant("Insert"),items:e.enableInsertBtnId,enable:!1}]),this.enableToolbarItems([{tab:r.getConstant("Home"),items:e.findBtnId,enable:!t.isProtected||t.protectSettings.selectCells||t.protectSettings.selectUnLockedCells}]);var n,i=this.ribbon.items[this.ribbon.selectedTab].content.length;for(n=0;n<i&&this.ribbon.items[this.ribbon.selectedTab].content[n].id!==this.parent.element.id+"_protectworkbook";n++);t.isProtected?(this.parent.isProtected&&this.parent.element.querySelector("#"+this.parent.element.id+"_protectworkbook")&&this.parent.element.querySelector("#"+this.parent.element.id+"_protectworkbook").querySelector(".e-tbar-btn-text").textContent===r.getConstant("UnprotectWorkbook")?this.ribbon.items[this.ribbon.selectedTab].header.text===r.getConstant("Data")&&(this.ribbon.items[this.ribbon.selectedTab].content[n].text=r.getConstant("UnprotectWorkbook")):this.ribbon.items[this.ribbon.selectedTab].header.text===r.getConstant("Data")&&(this.ribbon.items[this.ribbon.selectedTab].content[n].text=r.getConstant("ProtectWorkbook")),this.enableToolbarItems([{tab:r.getConstant("Insert"),items:e.imageBtnId,enable:!1}]),this.enableToolbarItems([{tab:r.getConstant("Data"),items:e.dataValidationBtnId,enable:!1}]),this.enableToolbarItems([{tab:r.getConstant("Formulas"),items:e.enableFrmlaBtnId,enable:!1}]),this.enableToolbarItems([{tab:r.getConstant("Insert"),items:e.chartBtnId,enable:!1}])):(this.parent.isProtected&&this.parent.element.querySelector("#"+this.parent.element.id+"_protectworkbook")&&this.parent.element.querySelector("#"+this.parent.element.id+"_protectworkbook").querySelector(".e-tbar-btn-text").textContent===r.getConstant("UnprotectWorkbook")?this.ribbon.items[this.ribbon.selectedTab].header.text===r.getConstant("Data")&&(this.ribbon.items[this.ribbon.selectedTab].content[n].text=r.getConstant("UnprotectWorkbook")):this.ribbon.items[this.ribbon.selectedTab].header.text===r.getConstant("Data")&&(this.ribbon.items[this.ribbon.selectedTab].content[n].text=r.getConstant("ProtectWorkbook")),this.enableToolbarItems([{tab:r.getConstant("Insert"),items:e.imageBtnId,enable:this.parent.allowImage}]),this.enableToolbarItems([{tab:r.getConstant("Data"),items:e.dataValidationBtnId,enable:this.parent.allowDataValidation}]),this.enableToolbarItems([{tab:r.getConstant("Formulas"),items:e.enableFrmlaBtnId,enable:!0}]),this.enableToolbarItems([{tab:r.getConstant("Insert"),items:e.chartBtnId,enable:this.parent.allowChart}]))},n.prototype.updateMergeItem=function(e){if(this.parent.allowMerge&&(id(e)||"touchmove"===e.type||e.shiftKey&&("mousedown"===e.type||"touchend"===e.type))){var r=this.parent.getActiveSheet();if(!r.isProtected){var n=t(r.selectedRange);if(n[1]===n[3]&&n[0]===n[2])this.enableToolbarItems([{tab:this.parent.serviceLocator.getService(kl).getConstant("Home"),items:[this.parent.element.id+"_merge_cells"],enable:!1}]),this.toggleActiveState(!1);else{this.enableToolbarItems([{tab:this.parent.serviceLocator.getService(kl).getConstant("Home"),items:[this.parent.element.id+"_merge_cells"],enable:!0}]);var i=Ln((n=c(n))[0],n[1],r,!1,!0);i.rowSpan>1||i.colSpan>1?this.toggleActiveState(!(i.rowSpan>1&&n[0]+i.rowSpan-1!==n[2]||i.colSpan>1&&n[1]+i.colSpan-1!==n[3])):this.toggleActiveState(!1)}}}},n.prototype.onPropertyChanged=function(e){var t=this.parent.serviceLocator.getService(kl),n=this.parent.element.id,i=this.parent.getActiveSheet();switch(e){case"allowFreezePane":this.ribbon.enableItems(t.getConstant("View"),[n+"_freezepanes",n+"_freezerows",n+"_freezecolumns"],this.parent.allowFreezePane);break;case"showRibbon":this.parent.showRibbon?this.initialize(!0):this.ribbon&&this.destroy();break;case"allowImage":this.ribbon.enableItems(t.getConstant("Insert"),[n+"_image"],this.parent.allowImage);break;case"allowChart":this.ribbon.enableItems(t.getConstant("Insert"),[n+"_chart"],this.parent.allowChart),this.parent.allowChart||this.removeDesignChart();break;case"allowWrap":case"allowCellFormatting":if(this.refreshToggleBtn(r(i.activeCell)),!i.isProtected||i.protectSettings.formatCells)if("allowWrap"===e)this.ribbon.enableItems(t.getConstant("Home"),[n+"_wrap"],this.parent.allowWrap);else{var a=[n+"_font_name",n+"_font_size",n+"_bold",n+"_italic",n+"_line-through",n+"_underline",n+"_font_color_picker",n+"_fill_color_picker",n+"_borders",n+"_merge_cells",n+"_text_align",n+"_vertical_align"];this.enableToolbarItems([{tab:t.getConstant("Home"),items:a,enable:this.parent.allowCellFormatting}])}break;case"allowNumberFormatting":i.isProtected&&!i.protectSettings.formatCells||this.ribbon.enableItems(t.getConstant("Home"),[n+"_number_format"],this.parent.allowNumberFormatting);break;case"calculationMode":this.parent.notify(wi,[{tab:t.getConstant("Formulas"),items:[this.parent.element.id+"_calc_current_sheet",this.parent.element.id+"_calc_entire_sheets"],enable:"Manual"===this.parent.calculationMode}]),this.calcTypeOptions&&(this.calcTypeOptions.items[0].iconCss="Automatic"===this.parent.calculationMode?"e-icons e-selected-icon":"",this.calcTypeOptions.items[1].iconCss="Manual"===this.parent.calculationMode?"e-icons e-selected-icon":""),"Automatic"===this.parent.calculationMode&&this.parent.calculateNow("Workbook")}},n.prototype.addEventListener=function(){this.parent.on(Gn,this.ribbonOperation,this),this.parent.on(wi,this.enableToolbarItems,this),this.parent.on(ve,this.refreshRibbonContent,this),this.parent.on(ta,this.toggleRibbonItems,this),this.parent.on(Mi,this.enableFileMenuItems,this),this.parent.on(Ui,this.hideRibbonTabs,this),this.parent.on(zi,this.addRibbonTabs,this),this.parent.on(_i,this.addToolbarItems,this),this.parent.on(Bi,this.hideFileMenuItems,this),this.parent.on(Hi,this.addFileMenuItems,this),this.parent.on(ji,this.hideToolbarItems,this),this.parent.on(Vi,this.enableRibbonTabs,this),this.parent.on(_a,this.protectSheetHandler,this),this.parent.on(rr,this.updateMergeItem,this),this.parent.on(Mt,this.refreshRibbonContent,this),this.parent.on(Fs,this.insertDesignChart,this),this.parent.on(Ts,this.removeDesignChart,this),this.parent.on(or,this.unMerge,this)},n.prototype.destroy=function(){var t,r=this.parent.element,n=this.ribbon?this.ribbon.element:null,i=this.cPickerEle,a=r.id,s=this.parent.serviceLocator.getService(kl),o=(0,e.getComponent)(r.querySelector(".e-tab"),"tab");o&&(t=o.selectedItem),this.switchRibbonTab(s.getConstant("Home")),["bold","italic","line-through","underline","cut","copy","undo","redo","wrap"].forEach((function(t){fd((0,e.select)("#"+a+"_"+t,r),bh.Button)})),this.pasteSplitBtn&&this.pasteSplitBtn.destroy(),this.pasteSplitBtn=null,this.mergeSplitBtn&&this.mergeSplitBtn.destroy(),this.mergeSplitBtn=null,this.numFormatDDB&&this.numFormatDDB.destroy(),this.numFormatDDB=null,this.fontSizeDdb&&this.fontSizeDdb.destroy(),this.fontSizeDdb=null,this.fontNameDdb&&this.fontNameDdb.destroy(),this.fontNameDdb=null,this.textAlignDdb&&this.textAlignDdb.destroy(),this.textAlignDdb=null,this.verticalAlignDdb&&this.verticalAlignDdb.destroy(),this.verticalAlignDdb=null,this.sortingDdb&&this.sortingDdb.destroy(),this.sortingDdb=null,this.clearDdb&&this.clearDdb.destroy(),this.clearDdb=null,this.colorPicker&&this.colorPicker.destroy(),this.colorPicker=null,this.destroyComponent(a+"_borders_menu","menu"),this.bordersDdb&&this.bordersDdb.destroy(),this.bordersDdb=null,this.findDdb&&this.findDdb.destroy(),this.findDdb=null,this.destroyComponent(a+"_chart_menu","menu"),this.destroyComponent(a+"_chart_type_menu","menu"),this.destroyComponent(a+"_chart-btn","dropdown-btn"),this.destroyComponent(a+"_chart-type-btn","dropdown-btn"),this.destroyComponent(a+"_cf_menu","menu"),this.cfDdb&&(this.cfDdb.destroy(),this.cfDdb.element&&this.cfDdb.element.remove()),this.cfDdb=null,this.detachPopupElement(a),this.parent.notify("destroyRibbonComponents",null),t&&(o.selectedItem=t,o.dataBind()),this.addChartDdb&&(this.addChartDdb.destroy(),this.addChartDdb=null),this.destroyComponent(a+"_chart_theme","menu"),this.destroyComponent(a+"_chart_theme","dropdown-btn"),this.destroyComponent(a+"_chart-type-btn","menu"),this.destroyComponent(a+"_chart-type-btn","dropdown-btn"),this.datavalidationDdb&&this.datavalidationDdb.destroy(),this.datavalidationDdb=null,i&&(0,e.detach)(i);var l=this.parent.serviceLocator.getService(Al);l.dialogInstance&&l.dialogInstance.element.classList.contains("e-custom-format-dlg")&&l.hide(!0),this.cPickerEle=null,this.border&&(this.border=""),this.fontNameIndex&&(this.fontNameIndex=null),this.preTabIdx&&(this.preTabIdx=null),this.numPopupWidth&&(this.numPopupWidth=null),this.ribbon&&this.ribbon.destroy(),n&&(0,e.detach)(n),this.ribbon=null,this.removeEventListener(),this.parent=null},n.prototype.destroyComponent=function(t,r){var n="string"==typeof t?document.getElementById(t):t;if(n){if("menu"!==r||n.childElementCount){var i=(0,e.getComponent)(n,r);if(i&&(i.destroy(),"dropdown-btn"===r)){var a=document.getElementById(n.id+"-popup");a&&(0,e.detach)(a)}}"menu"===r&&(0,e.detach)(n)}},n.prototype.detachPopupElement=function(t){["_conditionalformatting","_chart-type-btn","_chart-btn","_borders"].forEach((function(r){var n=document.getElementById(""+t+r+"-popup");n&&(0,e.detach)(n)}))},n.prototype.switchRibbonTab=function(t){for(var r,n=this.parent.element.querySelectorAll(".e-tab-text"),i=0;i<n.length;i++){var a=n[i];if(a.textContent.toLowerCase()===t.toLowerCase()){var s=a.closest(".e-toolbar-item");if(s){r=s.getAttribute("data-id");break}}}var o=(0,e.getComponent)(this.parent.element.querySelector(".e-tab"),"tab");o&&!(0,e.isNullOrUndefined)(r)&&(o.selectedItem=o.getItemIndex(r),o.dataBind())},n.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(Gn,this.ribbonOperation),this.parent.off(wi,this.enableToolbarItems),this.parent.off(ve,this.refreshRibbonContent),this.parent.off(ta,this.toggleRibbonItems),this.parent.off(Mi,this.enableFileMenuItems),this.parent.off(Ui,this.hideRibbonTabs),this.parent.off(zi,this.addRibbonTabs),this.parent.off(_i,this.addToolbarItems),this.parent.off(Bi,this.hideFileMenuItems),this.parent.off(Hi,this.addFileMenuItems),this.parent.off(ji,this.hideToolbarItems),this.parent.off(Vi,this.enableRibbonTabs),this.parent.off(_a,this.protectSheetHandler),this.parent.off(rr,this.updateMergeItem),this.parent.off(Mt,this.refreshRibbonContent),this.parent.off(Fs,this.insertDesignChart),this.parent.off(Ts,this.removeDesignChart),this.parent.off(or,this.unMerge))},n}(),_h=function(){function n(e){this.categoryCollection=[],this.formulaCollection=[],this.isGoto=!1,this.parent=e,this.addEventListener()}return n.prototype.getModuleName=function(){return"formulaBar"},n.prototype.createFormulaBar=function(t){var r=this;if(this.parent.showFormulaBar||!this.insertFnRipple){var n=this.parent.serviceLocator.getService(kl),i=this.parent.element.id,a=this.parent.createElement("div",{className:"e-formula-bar-panel"});if(!this.parent.isMobileView()){var s=this.parent.createElement("input",{id:i+"_name_box",attrs:{type:"text"}});a.appendChild(s),this.comboBoxInstance=new xh.ComboBox({value:"A1",cssClass:"e-name-box",width:"",noRecordsTemplate:(0,e.initializeCSPTemplate)((function(){return""})),fields:{text:"name",value:"refersTo"},beforeOpen:this.nameBoxBeforeOpen.bind(this),blur:this.nameBoxBlur.bind(this),select:this.nameBoxSelect.bind(this),open:function(){r.isDevice&&(window.browserDetails.isDevice=!0)},change:function(){}}),this.comboBoxInstance.createElement=this.parent.createElement,this.comboBoxInstance.appendTo(s),this.comboBoxInstance.element.parentElement.title=n.getConstant("NameBox")}a.appendChild(this.parent.createElement("button",{className:"e-btn e-css e-flat e-icon-btn e-insert-function",attrs:{title:n.getConstant("InsertFunction"),type:"button"}})).appendChild(this.parent.createElement("span",{className:"e-btn-icon e-icons"})),this.insertFnRipple=(0,e.rippleEffect)(a,{selector:".e-insert-function"}),a.appendChild(this.parent.createElement("div",{className:"e-separator"}));var o=n.getConstant("FormulaBar"),l=a.appendChild(this.parent.createElement("textarea",{className:"e-formula-bar e-css",id:i+"_formula_input",attrs:{title:o,"aria-label":o,spellcheck:"false"}}));if(l.rows=1,this.parent.isMobileView())l.placeholder=n.getConstant("MobileFormulaBarPlaceHolder"),e.EventHandler.add(l,"focus",this.textAreaFocusIn,this),e.EventHandler.add(l,"blur",this.textAreaFocusOut,this);else{var d=n.getConstant("ExpandFormulaBar");a.appendChild(this.parent.createElement("span",{className:"e-drop-icon e-icons",attrs:{title:d,role:"button",tabindex:"-1","aria-label":d}}))}t&&t.uiUpdate?this.parent.element.insertBefore(a,document.getElementById(i+"_sheet_panel")):this.parent.element.appendChild(a)}else this.destroy()},n.prototype.textAreaFocusIn=function(){var e=this.parent.element.querySelector(".e-formula-bar-panel"),t=this.parent.createElement("button",{className:"e-btn e-css e-flat e-icon-btn e-formula-submit",attrs:{type:"button"}});t.appendChild(this.parent.createElement("span",{className:"e-btn-icon e-icons e-tick-icon"})),e.classList.add("e-focused"),e.appendChild(t)},n.prototype.textAreaFocusOut=function(){var t=this.parent.element.querySelector(".e-formula-bar-panel");t.classList.remove("e-focused"),(0,e.detach)(t.querySelector(".e-formula-submit"))},n.prototype.keyDownHandler=function(e){var t=e.target;if(this.parent.isEdit&&(!this.parent.getActiveSheet().isProtected||t.classList.contains("e-formula-bar")&&!t.disabled)){if((xr(t.value)||t.validity&&0===t.value.toString().indexOf("="))&&(16===e.keyCode||17===e.keyCode))return;t.classList.contains("e-formula-bar")&&(!e.shiftKey||e.shiftKey&&!sd(e.keyCode))&&this.parent.notify(ei,{action:"refreshEditor",value:t.value,refreshEditorElem:!0})}},n.prototype.keyUpHandler=function(e){if(this.parent.isEdit){var t=e.target;if(t.classList.contains("e-formula-bar")){var r={action:"getCurrentEditValue",editedValue:""};this.parent.notify(ei,r),r.editedValue===t.value||16===e.keyCode||17===e.keyCode||e.shiftKey&&(!e.shiftKey||sd(e.keyCode))||this.parent.notify(ei,{action:"refreshEditor",value:t.value,refreshEditorElem:!0})}}},n.prototype.nameBoxBeforeOpen=function(e){this.comboBoxInstance.element.classList.contains("e-name-editing")?e.cancel=!0:(this.comboBoxInstance.element.select(),this.isDevice=window.browserDetails.isDevice,this.isDevice&&(window.browserDetails.isDevice=!1))},n.prototype.nameBoxBlur=function(){this.comboBoxInstance.element.classList.contains("e-name-editing")&&(this.comboBoxInstance.element.classList.remove("e-name-editing"),this.updateValueAfterMouseUp())},n.prototype.nameBoxSelect=function(e){if(e.isInteracted&&(!e.e||"keydown"!==e.e.type||40!==e.e.keyCode&&38!==e.e.keyCode)){var t=e.itemData.refersTo.substr(1),r=vn(this.parent,Cn(t));if(void 0===r)return;var n=l(t),a=In(this.parent,r),s=void 0,o=void 0;if(-1===n.indexOf(":"))s=o=n.replace("$","");else{var d=n.indexOf(":");s=n.substr(0,d).replace("$",""),o=n.substr(d+1,n.length).replace("$","")}o.match(/\D/g)&&!o.match(/[0-9]/g)&&s.match(/\D/g)&&!s.match(/[0-9]/g)?n=(s+="1")+":"+(o+=a.rowCount):!o.match(/\D/g)&&o.match(/[0-9]/g)&&!s.match(/\D/g)&&s.match(/[0-9]/g)&&(n=(s=i(parseInt(s,10)-1,0))+":"+(o=i(parseInt(o,10)-1,a.colCount-1))),r===this.parent.activeSheetIndex?(this.parent.selectRange(n),Fd(this.parent.element)):(xn(this.parent,n,a),this.parent.activeSheetIndex=r)}},n.prototype.formulaBarUpdateHandler=function(e){var r,n=this,i=this.parent.getActiveSheet().selectedRange.split(":"),a={action:"getElement",element:null};this.parent.notify(ei,a);var s=this.parent.element.querySelector(".e-formula-bar");if("mousemove"===e.type||"pointermove"===e.type){var o=t(i[0]),l=t(i[1]);r=Math.abs(o[0]-l[0])+1+"R x "+(Math.abs(o[1]-l[1])+1)+"C",this.parent.isEdit&&(e.target&&!e.target.classList.contains("e-spreadsheet-edit")?this.parent.notify(ps,{}):a.element&&(s.value=a.element.textContent))}else{r=i[0];var d=On(this.parent)+"!"+r;ln(this.parent,d,!1,!0).then((function(t){n.parent&&t.forEach((function(t){var r=n.getFormulaBarValue(t),i={action:"getCurrentEditValue",editedValue:""};n.parent.notify(ei,i);var o=document.getElementById(n.parent.element.id+"_formula_input"),l=o.value;o.value=r,i.editedValue&&xr(i.editedValue.toString(),!0)||n.parent.notify(ei,{action:"refreshEditor",value:r,refreshEditorElem:!0}),n.parent.isEdit&&(e.target&&!e.target.classList.contains("e-spreadsheet-edit")?n.parent.notify(ps,{isMouseDown:nd(e),formulaBarVal:l}):a.element&&(s.value=a.element.textContent))}))}))}this.updateComboBoxValue(r)},n.prototype.getFormulaBarValue=function(t){var r="";if(t)if(t.formula)r=t.formula;else if((0,e.isNullOrUndefined)(t.value)||""===t.value)t.hyperlink&&(r="string"==typeof t.hyperlink?t.hyperlink:t.hyperlink.address||"");else{var n={},i=t.format&&Vn(t.format,!0,n,!0)&&n.type;if("date"===i||"time"===i||"datetime"===i){var a=Qr(Number(t.value));if(a&&"Invalid Date"!==a.toString()&&a.getFullYear()>=1900){var s=new e.Internationalization,o=Mo("Time");"h:mm:ss AM/PM"===o&&(o="h:mm:ss a");var l=t.format.toLowerCase();"time"!==i||!l.includes("m")||l.includes(":m")||l.includes("m:")||l.includes("[m")||l.includes("am")||(i="date");var d=t.value.toString().split("."),h=2===d.length,p=h?Qr(parseFloat(d[0]+1+"."+d[1])||Number(t.value)):a;if("date"===i){var c={type:"date",skeleton:"yMd"};r=s.formatDate(a,c),h&&(r+=" "+s.formatDate(p,{type:"time",skeleton:"medium",format:o}))}else(Number(t.value)>=1||"datetime"===i)&&(r=s.formatDate(a,{type:"date",skeleton:"yMd"})+" "),r+=s.formatDate(p,{type:"time",skeleton:"medium",format:o})}}else t.format&&t.format.includes("%")&&rn(t.value)&&((r=this.parent.getDisplayText(t)).includes("%")||(r=""));if(!r)if("true"===(r=t.value.toString()).toLowerCase()||"false"===r.toLowerCase())r=r.toUpperCase();else if("en-US"!==this.parent.locale){var u=(0,e.getNumericObject)(this.parent.locale).decimal;"."!==u&&rn(r)&&r.includes(".")&&(r=r.replace(".",u))}}return r},n.prototype.updateValueAfterMouseUp=function(){this.updateComboBoxValue(this.parent.getActiveSheet().selectedRange.split(":")[0])},n.prototype.updateComboBoxValue=function(e){var t=this.parent.getActiveSheet(),r={action:"getNameFromRange",range:On(this.parent)+"!"+t.selectedRange,definedName:null};if(this.parent.notify(ti,r),r.definedName&&(e=r.definedName.name),!this.parent.isMobileView()){if(this.comboBoxInstance.text===e)return;this.comboBoxInstance.text=e,this.comboBoxInstance.dataBind()}},n.prototype.disabletextarea=function(){var e=this.getFormulaBar();this.parent.getActiveSheet().isProtected&&!this.parent.isEdit?e.disabled=!0:e.disabled=!1},n.prototype.formulaBarScrollEdit=function(){var e=t(this.parent.getActiveSheet().selectedRange),n=r(this.parent.getActiveSheet().topLeftCell);e[0]<n[0]&&(this.parent.goTo(this.parent.getActiveSheet().selectedRange),this.isGoto=!0),this.parent.notify(ei,{action:"startEdit",refreshCurPos:!1})},n.prototype.formulaBarClickHandler=function(t){var n=t.target,i=this.parent.getActiveSheet(),a=i.isProtected,s=r(i.activeCell),o=Ln(s[0],s[1],i),l=Ar(o,bl(i,s[1]));if(n.classList.contains("e-drop-icon")&&n.parentElement.classList.contains("e-formula-bar-panel"))this.toggleFormulaBar(n);else if(n.classList.contains("e-formula-bar")){if($r(o,bl(i,s[1]),hl(i,s[0])))return void this.parent.notify(Ka,null);!this.parent.isEdit&&(!a||a&&!l)||this.parent.isEdit&&a&&!n.disabled?this.formulaBarScrollEdit():a&&l&&this.parent.notify(Xa,null)}else if(n.parentElement&&n.parentElement.classList.contains("e-name-box"))if(n.classList.contains("e-ddl-icon")){var d={action:"getNames",names:[]};if(this.parent.notify(ti,d),this.comboBoxInstance.dataSource.length!==d.names.length||this.comboBoxInstance.value===this.comboBoxInstance.text){var h=this.comboBoxInstance.text;this.comboBoxInstance.dataSource=d.names;var p=d.names.find((function(e){return e.name===h}));this.comboBoxInstance.value=p?p.refersTo:this.comboBoxInstance.value,this.comboBoxInstance.dataBind()}}else this.comboBoxInstance.element.classList.add("e-name-editing"),this.comboBoxInstance.element.select();!(0,e.isNullOrUndefined)(n.offsetParent)&&(n.offsetParent.classList.contains("e-insert-function")||n.classList.contains("e-insert-function")||this.parent.element.id+"_insert_function"===n.offsetParent.id||this.parent.element.id+"_insert_function"===n.id||n.parentElement.classList.contains("e-insert-function")||this.parent.element.id+"_insert_function"===n.parentElement.id)&&this.renderInsertDlg()},n.prototype.renderInsertDlg=function(){var t=this,n=this.parent.getActiveSheet(),i=r(n.activeCell);if(n.isProtected&&Ar(Ln(i[0],i[1],n),bl(n,i[1]))&&!this.parent.isEdit)this.parent.notify(Xa,null);else if($r(Ln(i[0],i[1],n),bl(n,i[1]),hl(n,i[0])))this.parent.notify(Ka,null);else{var a=this.parent.serviceLocator.getService(kl),s=!this.parent.isEdit,o={action:"getCurrentEditValue",editedValue:""};if(!s){var l={action:"isFormulaEditing",isFormulaEdit:!1};this.parent.notify(ti,l),s=l.isFormulaEdit,this.parent.notify(ei,o)}if((s||""===o.editedValue)&&!this.parent.element.querySelector(".e-spreadsheet-function-dlg")){""===o.editedValue&&this.parent.notify(ei,{action:"refreshEditor",value:"="});var d=this.parent.createElement("div",{className:"e-formula-description",id:this.parent.element.id+"_description_content"}),h=this.parent.createElement("div",{className:"e-category-content",id:this.parent.element.id+"_category_content"});h.innerText=a.getConstant("PickACategory");var p=this.parent.createElement("input",{className:"e-formula-category",id:this.parent.element.id+"_formula_category"}),c=this.parent.createElement("div",{className:"e-formula-list",id:this.parent.element.id+"_formula_list"}),u=this.parent.createElement("div",{className:"e-description-content"});u.innerText=a.getConstant("Description");var f=this.parent.createElement("div",{className:"e-header-content"});f.innerText=a.getConstant("InsertFunction");var g,m={action:"getFormulaCategory",categoryCollection:[]};this.parent.notify(pe,m),this.categoryCollection=m.categoryCollection,this.categoryList=new xh.DropDownList({dataSource:this.categoryCollection,cssClass:"e-ss-formula-category",index:0,width:"285px",popupHeight:"210px",select:this.dropDownSelect.bind(this),open:function(){return g=!0},close:function(){return g=!1}});var v={action:"getLibraryFormulas",formulaCollection:[]};this.parent.notify(pe,v),this.formulaCollection=v.formulaCollection,this.formulaList=new wh.ListView({dataSource:this.formulaCollection.sort(),actionComplete:this.updateFormulaList.bind(this),select:this.listSelected.bind(this),width:"285px",height:"200px"}),this.dialog=this.parent.serviceLocator.getService(Al),this.dialog.show({header:f.outerHTML,content:h.outerHTML+p.outerHTML+c.outerHTML+u.outerHTML+d.outerHTML,width:"320px",height:"485px",cssClass:"e-spreadsheet-function-dlg",showCloseIcon:!0,isModal:!0,beforeOpen:function(e){var r={dialogName:"InsertFunctionDialog",element:e.element,target:e.target,cancel:e.cancel};t.parent.trigger("dialogBeforeOpen",r),r.cancel&&(e.cancel=!0),Fd(t.parent.element)},open:this.dialogOpen.bind(this),beforeClose:this.dialogBeforeClose.bind(this),close:this.dialogClose.bind(this),buttons:[{click:function(e){e&&13===e.keyCode&&!g||t.selectFormula()},buttonModel:{content:a.getConstant("Ok"),isPrimary:!0}}]}),this.categoryList.appendTo("#"+this.parent.element.id+"_formula_category"),this.formulaList.appendTo("#"+this.parent.element.id+"_formula_list"),e.EventHandler.add(this.formulaList.element,"dblclick",this.formulaClickHandler,this)}}},n.prototype.toggleFormulaBar=function(e){var t=e.parentElement,r=this.parent.serviceLocator.getService(kl);t.classList.contains("e-expanded")?(t.classList.remove("e-expanded"),document.getElementById(this.parent.element.id+"_formula_input").rows=1,e.title=r.getConstant("ExpandFormulaBar"),e.setAttribute("aria-label",r.getConstant("CollapseFormulaBar"))):(t.classList.add("e-expanded"),document.getElementById(this.parent.element.id+"_formula_input").rows=3,e.title=r.getConstant("CollapseFormulaBar"),e.setAttribute("aria-label",r.getConstant("ExpandFormulaBar"))),this.parent.setPanelSize()},n.prototype.dialogOpen=function(){var e=this;Bl((function(){var t=e.dialog.dialogInstance.element.querySelector(".e-footer-content .e-primary"),r=e.parent.serviceLocator.getService(kl);t.setAttribute("aria-label",r.getConstant("InsertFunction")+" "+r.getConstant("Ok")),e.categoryList&&Fd(e.categoryList.element)}))},n.prototype.dialogClose=function(){var e={action:"getCurrentEditValue",editedValue:""};this.parent.notify(ei,e),"="===e.editedValue.toString().trim()&&this.parent.notify(ei,{action:"refreshEditor",value:""})},n.prototype.dialogBeforeClose=function(){e.EventHandler.remove(this.formulaList.element,"dblclick",this.formulaClickHandler);var t=document.getElementsByClassName("e-spreadsheet-function-dlg")[0].querySelector(".e-dlg-content");t.parentNode.removeChild(t),this.categoryList.destroy(),this.categoryList=null,this.formulaList.destroy(),this.formulaList=null},n.prototype.selectFormula=function(){var e=this.formulaList.getSelectedItems().text,t=In(this.parent,this.parent.activeSheetIndex);this.parent.isEdit?this.parent.notify(ei,{action:"refreshEditor",value:e+"(",refreshFormulaBar:!0,refreshEditorElem:!0,isAppend:!0}):(this.parent.notify(ei,{action:"startEdit",value:"="+e+"(",address:t.activeCell}),this.parent.notify(ri,{action:"refreshFormulabar",value:"="+e+"("})),this.dialog.dialogInstance.storeActiveElement=document.getElementById(this.parent.element.id+"_edit"),this.dialog.hide()},n.prototype.listSelected=function(e){this.updateFormulaDescription(),e.isInteracted&&e.item&&e.item.focus()},n.prototype.updateFormulaList=function(){this.activeListFormula(),this.updateFormulaDescription()},n.prototype.dropDownSelect=function(e){this.formulaCollection=[];var t={action:"getLibraryFormulas",formulaCollection:[]};if("All"===e.item.textContent)this.parent.notify(pe,t),this.formulaCollection=t.formulaCollection;else{var r={action:"dropDownSelectFormulas",formulaCollection:[],selectCategory:e.item.textContent};this.parent.notify(pe,r),this.formulaCollection=r.formulaCollection}this.formulaList.dataSource=this.formulaCollection.sort()},n.prototype.activeListFormula=function(){var e=document.getElementById(this.parent.element.id+"_formula_list").children[0].children[0].firstElementChild;this.formulaList.selectItem(e)},n.prototype.updateFormulaDescription=function(){var e=this.formulaList.getSelectedItems().text,t={action:"getFormulaDescription",description:"",selectedList:e,isCustom:!1};this.parent.notify(pe,t);var r=this.dialog.dialogInstance.element.querySelector(".e-footer-content .e-primary");r.hasAttribute("aria-label")&&r.removeAttribute("aria-label"),e="AND"===e?"CalculateAND":"OR"===e?"CalculateOR":e,document.getElementById(this.parent.element.id+"_description_content").textContent=t.isCustom?t.description:this.parent.serviceLocator.getService(kl).getConstant(e)},n.prototype.formulaClickHandler=function(e){var t=e.target,r=In(this.parent,this.parent.activeSheetIndex);(t.offsetParent.classList.contains("e-text-content")||t.classList.contains("e-list-item"))&&(this.parent.isEdit?this.parent.notify(ei,{action:"refreshEditor",value:t.innerText+"(",refreshFormulaBar:!0,refreshEditorElem:!0,isAppend:!0}):(this.parent.notify(ei,{action:"startEdit",value:"="+t.innerText+"(",address:r.activeCell}),this.parent.notify(ri,{action:"refreshFormulabar",value:"="+t.innerText+"("})),this.dialog.hide())},n.prototype.addEventListener=function(){this.parent.on(Yn,this.createFormulaBar,this),this.parent.on(ni,this.formulaBarClickHandler,this),this.parent.on(ai,this.keyDownHandler,this),this.parent.on(io,this.renderInsertDlg,this),this.parent.on(ii,this.keyUpHandler,this),this.parent.on(rr,this.formulaBarUpdateHandler,this),this.parent.on(mi,this.updateValueAfterMouseUp,this),this.parent.on(ri,this.editOperationHandler,this),this.parent.on(Za,this.disabletextarea,this),this.parent.on($n,this.isFormulaBarEdit,this)},n.prototype.destroy=function(){this.removeEventListener(),this.comboBoxInstance&&this.comboBoxInstance.destroy(),this.comboBoxInstance=null,this.categoryCollection=null,this.formulaCollection=null,this.dialog=null,this.isGoto=null,this.insertFnRipple&&this.insertFnRipple(),this.insertFnRipple=null;var t=this.parent.element.querySelector(".e-formula-bar-panel");t&&(Hl(t),(0,e.detach)(t)),this.parent=null},n.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(Yn,this.createFormulaBar),this.parent.off(ni,this.formulaBarClickHandler),this.parent.off(io,this.renderInsertDlg),this.parent.off(ai,this.keyDownHandler),this.parent.off(ii,this.keyUpHandler),this.parent.off(rr,this.formulaBarUpdateHandler),this.parent.off(mi,this.updateValueAfterMouseUp),this.parent.off(ri,this.editOperationHandler),this.parent.off(Za,this.disabletextarea),this.parent.off($n,this.isFormulaBarEdit))},n.prototype.editOperationHandler=function(t){switch(t.action){case"refreshFormulabar":t.cell?this.getFormulaBar().value=this.getFormulaBarValue(t.cell):this.getFormulaBar().value=(0,e.isUndefined)(t.value)?"":t.value;break;case"getElement":t.element=this.getFormulaBar()}},n.prototype.isFormulaBarEdit=function(e){this.parent.isEdit&&this.isGoto?e.isEdit=!0:e.isEdit=!1},n.prototype.getFormulaBar=function(){return(0,e.select)("#"+this.parent.element.id+"_formula_input",this.parent.element)},n}(),jh=function(){function t(e){this.isFormulaBar=!1,this.isFormula=!1,this.isPopupOpened=!1,this.isPreventClose=!1,this.isSubFormula=!1,this.parent=e,this.addEventListener()}return t.prototype.getModuleName=function(){return"formula"},t.prototype.destroy=function(){this.removeEventListener(),this.autocompleteInstance&&(this.autocompleteInstance.destroy(),this.autocompleteInstance.element&&(this.autocompleteInstance.element.remove(),this.autocompleteInstance.element=null)),this.autocompleteInstance=null,this.acInputElement&&(this.acInputElement.remove(),this.acInputElement=null),this.parent=null},t.prototype.addEventListener=function(){this.parent.on(ti,this.performFormulaOperation,this),this.parent.on(ii,this.keyUpHandler,this),this.parent.on(ai,this.keyDownHandler,this),this.parent.on(ni,this.formulaClick,this),this.parent.on(Da,this.refreshFormulaDatasource,this)},t.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(ti,this.performFormulaOperation),this.parent.off(ii,this.keyUpHandler),this.parent.off(ai,this.keyDownHandler),this.parent.off(ni,this.formulaClick),this.parent.off(Da,this.refreshFormulaDatasource))},t.prototype.performFormulaOperation=function(e){var t=this,r=e.action,n=this.parent.serviceLocator.getService(kl);switch(r){case"renderAutoComplete":this.renderAutoComplete();break;case"endEdit":this.endEdit();break;case"addDefinedName":e.isAdded=this.addDefinedName(e.definedName);break;case"getNames":e.sheetName||(e.sheetName=On(this.parent)),e.names=this.getNames(e.sheetName);break;case"getNameFromRange":e.definedName=this.getNameFromRange(e.range);break;case"isFormulaEditing":e.isFormulaEdit=this.isFormula;break;case"isCircularReference":var i=this.parent.serviceLocator.getService(Al),a=n.getConstant("CircularReference"),s=function(e){t.parent.trigger("dialogBeforeOpen",e),e.content!==a&&(i.dialogInstance.content=e.content,i.dialogInstance.dataBind())},o=i.dialogInstance;if(o&&o.visible&&o.element.classList.contains("e-circularref-dlg"))s({dialogName:"CircularReferenceDialog",element:o.element,target:this.parent.element,cancel:!1,cellAddress:e.address,content:a});else{var l=e.address;i.show({height:180,width:400,isModal:!0,showCloseIcon:!0,cssClass:"e-circularref-dlg",content:a,beforeOpen:function(e){var t={dialogName:"CircularReferenceDialog",element:e.element,target:e.target,cancel:e.cancel,cellAddress:l,content:a};s(t),t.cancel&&(e.cancel=!0,i.hide(!0))}})}e.argValue="0"}},t.prototype.renderAutoComplete=function(){if(!(0,e.select)("#"+this.parent.element.id+"_ac",this.parent.element)){var t=this.parent.createElement("input",{id:this.parent.element.id+"_ac",className:"e-ss-ac"});this.parent.element.appendChild(t);var r={action:"getLibraryFormulas",formulaCollection:[]};this.parent.notify(pe,r);var n={dataSource:r.formulaCollection,cssClass:"e-ss-atc",popupWidth:"130px",allowFiltering:!0,filterType:"StartsWith",sortOrder:"Ascending",open:this.onSuggestionOpen.bind(this),close:this.onSuggestionClose.bind(this),select:this.onSelect.bind(this),actionComplete:this.onSuggestionComplete.bind(this)};this.autocompleteInstance=new xh.AutoComplete(n,t),this.autocompleteInstance.createElement=this.parent.createElement,this.acInputElement=t}},t.prototype.onSuggestionOpen=function(e){var t=this;this.isPopupOpened=!0,e.popup.relateTo=this.getRelateToElem(),e.popup.element.firstChild.style.maxHeight="180px",new Promise((function(e){setTimeout((function(){e()}),100)})).then((function(){t.triggerKeyDownEvent(Pl.DOWN)}))},t.prototype.onSuggestionClose=function(e){this.isPreventClose?e.cancel=!0:this.isPopupOpened=!1},t.prototype.onSelect=function(t){var r="="+t.itemData.value+"(";if(this.isSubFormula){var n=this.getEditingValue(),i=n.lastIndexOf(this.parent.listSeparator);(i>-1||(i=n.lastIndexOf("("))>-1)&&(r=n.slice(0,i+1)),r+=t.itemData.value+"("}if(this.parent.notify(ei,{action:"refreshEditor",value:r,refreshFormulaBar:!0,refreshEditorElem:!0,refreshCurPos:!this.isFormulaBar}),this.isPopupOpened){this.hidePopUp();var a=(0,e.select)("#"+this.parent.element.id+"_ac_popup");a&&(0,e.detach)(a),this.isPopupOpened=!1}},t.prototype.onSuggestionComplete=function(e){this.isPreventClose=e.result.length>0,this.isPreventClose||(e.cancel=!0,this.hidePopUp())},t.prototype.refreshFormulaDatasource=function(){var e={action:"getLibraryFormulas",formulaCollection:[]};this.parent.notify(pe,e),this.autocompleteInstance&&(this.autocompleteInstance.dataSource=e.formulaCollection)},t.prototype.keyUpHandler=function(e){if(this.parent.isEdit){var t=this.getEditingValue();this.isFormula=xr(t),(this.isFormula||this.isPopupOpened)&&(e.keyCode!==Pl.TAB&&this.isFormula&&(t=this.getSuggestionKeyFromFormula(t)),this.refreshFormulaSuggestion(e,t))}else this.isPopupOpened&&this.hidePopUp()},t.prototype.keyDownHandler=function(e){var t=e.keyCode;if(this.isFormula){if(this.isPopupOpened)switch(t){case Pl.UP:case Pl.DOWN:e.preventDefault(),this.triggerKeyDownEvent(t);break;case Pl.TAB:e.preventDefault(),this.triggerKeyDownEvent(Pl.ENTER)}}else{var r=e.target;if(r.id===this.parent.element.id+"_name_box")switch(t){case Pl.ENTER:document.querySelector(".e-name-box.e-popup-open")||(this.addDefinedName({name:r.value}),Fd(this.parent.element));break;case Pl.ESC:Fd(this.parent.element)}}},t.prototype.formulaClick=function(e){if(this.parent.isEdit){var t=e.target;this.isFormulaBar=t.classList.contains("e-formula-bar")}},t.prototype.refreshFormulaSuggestion=function(e,t){if(t.length>0){var r=this.autocompleteInstance.element,n=e.keyCode,i=this.isPopupOpened;sd(n)||(r.value=t,r.dispatchEvent(new Event("input")),r.dispatchEvent(new Event("keyup")),i&&this.triggerKeyDownEvent(Pl.DOWN))}else this.isPopupOpened&&(this.isPreventClose=!1,this.hidePopUp())},t.prototype.endEdit=function(){if(this.isSubFormula=!1,this.isPreventClose=!1,this.isFormula=!1,this.isFormulaBar=!1,this.isPopupOpened){this.hidePopUp();var t=(0,e.select)("#"+this.parent.element.id+"_ac_popup");t&&(0,e.detach)(t),this.isPopupOpened=!1}},t.prototype.hidePopUp=function(){this.autocompleteInstance.hidePopup()},t.prototype.getSuggestionKeyFromFormula=function(e){var t="";if(e=e.substr(1)){var r=e.lastIndexOf("("),n=(e=e.substr(r+1)).split(this.parent.listSeparator);1===n.length?(t=n[0],this.isSubFormula=r>-1):(t=n[n.length-1],this.isSubFormula=!0);var i=t.match(/\w/);(!i||i&&0!==i.index)&&(t="")}return t},t.prototype.getRelateToElem=function(){var e={action:"getElement"};return this.isFormulaBar?this.parent.notify(ri,e):this.parent.notify(ei,e),e.element},t.prototype.getEditingValue=function(){var e={action:"getCurrentEditValue",editedValue:""};return this.parent.notify(ei,e),e.editedValue},t.prototype.triggerKeyDownEvent=function(e){var t=this.autocompleteInstance.element;t.dispatchEvent(new Event("input"));var r=new Event("keydown");r.keyCode=e,r.which=e,r.altKey=!1,r.shiftKey=!1,r.ctrlKey=!1,t.dispatchEvent(r)},t.prototype.getNames=function(e){return this.parent.definedNames.filter((function(t){return"Workbook"===t.scope||""===t.scope||t.scope===e}))},t.prototype.getNameFromRange=function(e){var t,r,n=e.slice(0,e.indexOf(":")),i=e.substring(e.lastIndexOf("!")+1).split(":"),a=i.length>1&&i[0]===i[1],s=this.parent.definedNames.filter((function(i){t=i.refersTo.substring(0,i.refersTo.lastIndexOf("!")),r=i.refersTo.substring(i.refersTo.lastIndexOf("!")+1),t.includes("'")&&t.match(/^='.*'$/)&&(t="="+t.slice(2,-1));var s=t+"!"+r.split("$").join("");return!(!a||s!=="="+n)||s==="="+e}));return s&&s[0]},t.prototype.addDefinedName=function(t){var n=this,i=t.name,a=!1;if(i&&Sr(i.toUpperCase()))return this.parent.goTo(i),a;if(!t.refersTo){var s=In(this.parent,this.parent.activeSheetIndex),o=On(this.parent);o=-1!==o.indexOf(" ")?"'"+o+"'":o;var l=s.selectedRange;if(!(0,e.isNullOrUndefined)(l)){var d=l.indexOf(":"),h=l.substr(0,d),p=l.substr(d+1,l.length);parseInt(p.replace(/\D/g,""),10)===s.rowCount&&1===parseInt(h.replace(/\D/g,""),10)?(p=p.replace(/[0-9]/g,""),l="$"+(h=h.replace(/[0-9]/g,""))+":$"+p):r(p)[1]===s.colCount-1&&0===r(h)[1]?(p=p.replace(/\D/g,""),l="$"+(h=h.replace(/\D/g,""))+":$"+p):l=h===p?h:l}t.refersTo=o+"!"+l,t.scope="Workbook"}if(i.length>0&&/^([a-zA-Z_0-9.]){0,255}$/.test(i)){var c={action:"addDefinedName",definedName:t,isAdded:!1};this.parent.notify(pe,c),a=c.isAdded,c.isAdded||this.parent.serviceLocator.getService(Al).show({content:this.parent.serviceLocator.getService(kl).getConstant("DefineNameExists"),width:"300",beforeOpen:function(e){var t={dialogName:"DefineNameExistsDialog",element:e.element,target:e.target,cancel:e.cancel};n.parent.trigger("dialogBeforeOpen",t),t.cancel&&(e.cancel=!0)}})}else this.parent.serviceLocator.getService(Al).show({content:this.parent.serviceLocator.getService(kl).getConstant("DefineNameInValid"),width:"300",beforeOpen:function(e){var t={dialogName:"DefineNameInValidDialog",element:e.element,target:e.target,cancel:e.cancel};n.parent.trigger("dialogBeforeOpen",t),t.cancel&&(e.cancel=!0)}});return a},t}(),qh=function(){function r(e){this.aggregateContent="",this.selaggregateCnt="Sum",this.parent=e,this.addEventListener()}return r.prototype.getModuleName=function(){return"sheetTabs"},r.prototype.createSheetTabs=function(){var t=this;if(this.parent.showSheetTabs||!this.tabInstance){var r=this.parent.serviceLocator.getService(kl),n=this.parent.createElement("div",{className:"e-sheet-tab-panel",id:this.parent.element.id+"_sheet_tab_panel"}),i=this.parent.createElement("button",{className:"e-add-sheet-tab e-btn e-css e-flat e-icon-btn"+(this.parent.allowInsert?"":" e-disabled"),attrs:{title:r.getConstant("AddSheet"),type:"button"}});i.appendChild(this.parent.createElement("span",{className:"e-btn-icon e-icons e-add-icon"})),i.addEventListener("click",this.addSheetTab.bind(this)),i.disabled=!this.parent.allowInsert,n.appendChild(i),this.addBtnRipple=(0,e.rippleEffect)(n,{selector:".e-add-sheet-tab"});var a=this.parent.createElement("button",{attrs:{title:r.getConstant("ListAllSheets"),type:"button"}});n.appendChild(a),this.parent.element.appendChild(n);var s=this.getSheetTabItems();this.dropDownInstance=new Oh.DropDownButton({iconCss:"e-icons",items:s.ddbItems,createPopupOnClick:!0,beforeItemRender:function(e){var r=t.parent.sheets[t.dropDownInstance.items.indexOf(e.item)];"Hidden"===r.state?e.element.classList.add("e-hide"):"VeryHidden"===r.state&&(e.element.style.display="none")},select:function(e){return t.updateSheetTab({idx:t.dropDownInstance.items.indexOf(e.item)})},beforeOpen:function(e){return t.beforeOpenHandler(t.dropDownInstance,e.element,r.getConstant("ListAllSheets"))},open:function(e){return t.openHandler(t.dropDownInstance,e.element,"left")},cssClass:"e-sheets-list e-flat e-caret-hide",close:function(){return t.focusTab(t.tabInstance.element)}}),this.dropDownInstance.createElement=this.parent.createElement,this.dropDownInstance.appendTo(a);var o,l=this.parent.createElement("div",{className:"e-sheet-tab"});this.tabInstance=new ch.Tab({selectedItem:this.parent.activeSheetIndex,overflowMode:"Scrollable",items:s.tabItems,scrollStep:250,selecting:function(e){if(e.selectingIndex!==e.selectedIndex)if(o)o=!1;else{var r={currentSheetIndex:e.selectingIndex,previousSheetIndex:e.selectedIndex,cancel:!1};t.parent.notify(K,{eventArgs:r,action:"gotoSheet"}),o=r.cancel}},selected:function(e){e.isInteracted||(e.preventFocus=!0),t.goToSheet(e,o,!0)},created:function(){var r=t.tabInstance.element.querySelector(".e-toolbar-items");r.classList.add("e-sheet-tabs-items"),e.EventHandler.add(r,"dblclick",t.renameSheetTab,t)}}),n.appendChild(l),this.tabInstance.createElement=this.parent.createElement,this.tabInstance.appendTo(l),e.EventHandler.remove(this.tabInstance.element,"keydown",this.tabInstance.spaceKeyDown);for(var d,h=s.tabItems.length,p=0;p<h;p++){var c={action:"addSheet",sheetName:"Sheet"+(d=In(this.parent,p)).id,sheetId:d.id,visibleName:d.name};this.parent.notify(pe,c)}this.parent.notify(pe,{action:"initiateDefinedNames"}),this.parent.notify(Ua,null)}else this.destroy()},r.prototype.goToSheet=function(e,t,r){var n=this;if(e.selectedIndex!==e.previousIndex){if(t)return this.tabInstance.selectedItem=e.previousIndex,this.tabInstance.dataBind(),void Fd(this.parent.element);if(this.parent.notify(Ts,{}),this.parent.isEdit){var i=window.getSelection(),a={action:"getCurrentEditValue",editedValue:""};this.parent.notify(ei,a);var s=!!a.editedValue&&xr(a.editedValue,!0);!s&&i&&i.focusNode&&i.focusNode.classList&&i.focusNode.classList.contains("e-formula-bar-panel")&&(s=xr(this.parent.element.querySelector(".e-formula-bar").value,!0)),s||this.parent.endEdit()}this.parent.activeSheetIndex=e.selectedIndex,this.parent.dataBind(),this.updateDropDownItems(e.selectedIndex,e.previousIndex);var o={action:"registerGridInCalc",sheetID:(e.selectedIndex+1).toString()};this.parent.notify(pe,o),r&&(this.parent.notify(ka,{eventArgs:{previousSheetIndex:e.previousIndex,currentSheetIndex:e.selectedIndex},action:"gotoSheet"}),Bl((function(){return Fd(n.parent.element)})))}},r.prototype.updateDropDownItems=function(e,t){t>-1&&(this.dropDownInstance.items[t].iconCss=""),this.dropDownInstance.items[e].iconCss="e-selected-icon e-icons",this.dropDownInstance.setProperties({items:this.dropDownInstance.items},!0)},r.prototype.beforeOpenHandler=function(e,t,r){var n=this.parent.viewport.height;parseInt(getComputedStyle(t.firstElementChild).height,10)*e.items.length+2*parseInt(getComputedStyle(t).paddingTop,10)>n&&(t.style.height=n+"px",t.style.overflowY="auto"),t.parentElement.style.visibility="hidden",r&&t.setAttribute("aria-label",r)},r.prototype.openHandler=function(e,t,r){var n,i=t.parentElement;if(-1===(0,dh.isCollide)(i).indexOf("bottom")){n="auto"===t.style.overflowY?this.parent.viewport.height:i.getBoundingClientRect().height;var a=(0,dh.calculatePosition)(e.element,r,"top");"right"===r&&(a.left-=i.getBoundingClientRect().width),i.style.left=a.left+"px",i.style.top=a.top-n+"px"}i.style.visibility="",Fd(t)},r.prototype.getSheetTabItems=function(){var e,t=this,r=[],n=[];return this.parent.sheets.forEach((function(i,a){e=On(t.parent,a).replace(/</g,"<").replace(/>/g,">"),r.push({header:{text:e},visible:"Visible"===i.state}),n.push({text:e,iconCss:a===t.parent.activeSheetIndex?"e-selected-icon e-icons":""})})),{tabItems:r,ddbItems:n}},r.prototype.refreshSheetTab=function(){var e=this.getSheetTabItems();this.dropDownInstance.items=e.ddbItems,this.dropDownInstance.setProperties({items:this.dropDownInstance.items},!0),this.tabInstance.items=e.tabItems,this.tabInstance.selectedItem=this.parent.activeSheetIndex,this.tabInstance.dataBind()},r.prototype.addSheetTab=function(){this.parent.notify($e,{model:this.parent,start:this.parent.activeSheetIndex+1,end:this.parent.activeSheetIndex+1,modelType:"Sheet",isAction:!0,activeSheetIndex:this.parent.activeSheetIndex+1})},r.prototype.insertSheetTab=function(e){this.parent.notify(Ts,{}),e.preventUpdate&&e.startIdx!==this.tabInstance.selectedItem||(this.dropDownInstance.items[this.tabInstance.selectedItem].iconCss="");for(var t=e.startIdx;t<=e.endIdx;t++){var r=this.parent.sheets[t].name.replace(/</g,"<").replace(/>/g,">");this.dropDownInstance.items.splice(t,0,{text:r}),this.tabInstance.addTab([{header:{text:r},content:""}],t)}e.preventUpdate&&e.startIdx!==this.tabInstance.selectedItem||(this.dropDownInstance.items[e.startIdx].iconCss="e-selected-icon e-icons"),this.dropDownInstance.setProperties({items:this.dropDownInstance.items},!0),e.preventUpdate?e.startIdx!==this.tabInstance.selectedItem&&this.refreshSheetTab():this.updateSheetTab({idx:e.startIdx,preventDataBind:!0})},r.prototype.updateSheetTab=function(e){if("activeSheetChanged"===e.name)e.idx=this.parent.skipHiddenSheets(e.idx);else if("Hidden"===this.parent.sheets[e.idx].state){if(this.parent.isProtected)return;this.showSheet({sheetIndex:e.idx,triggerEvent:!0})}this.tabInstance.selectedItem=e.idx,e.preventDataBind||this.tabInstance.dataBind(),this.parent.notify(Ua,null)},r.prototype.showSheet=function(e){this.parent.setSheetPropertyOnMute(this.parent.sheets[e.sheetIndex],"state","Visible"),this.tabInstance.hideTab(e.sheetIndex,!1),e.triggerEvent&&this.parent.notify(ka,{action:"showSheet",eventArgs:{sheetIndex:e.sheetIndex}})},r.prototype.switchSheetTab=function(t){var r=(0,e.closest)(t.event.target,".e-toolbar-item");if(r){for(var n=r.querySelector(".e-tab-text").textContent,i=[],a=this.parent.element.id+"_cmenu",s=0,o=this.parent.sheets.length;s<o;s++)if(this.parent.sheets[s].name===n){this.parent.activeSheetIndex!==s&&this.updateSheetTab({idx:s});break}t.element.classList.contains("e-contextmenu")&&t.items[0]&&t.items[0].id===this.parent.element.id+"_cmenu_insert_sheet"&&(1===this.skipHiddenSheets()&&i.push(a+"_hide_sheet",a+"_delete_sheet"),this.parent.allowInsert&&!this.parent.isProtected||i.push(a+"_insert_sheet"),!this.parent.allowDelete&&i.indexOf(a+"_delete_sheet")>-1&&i.push(a+"_delete_sheet")),(this.parent.password.length>0||this.parent.isProtected)&&(i.indexOf(a+"_insert_sheet")>-1&&i.push(a+"_insert_sheet"),i.indexOf(a+"_delete_sheet")>-1&&i.push(a+"_delete_sheet"),i.push(a+"_duplicate",a+"_rename",a+"_hide_sheet",a+"_delete_sheet",a+"_insert_sheet",a+"_move_left",a+"_move_right")),this.parent.enableContextMenuItems(i,!1,!0)}},r.prototype.skipHiddenSheets=function(){var e=this.parent.sheets.length;return this.parent.sheets.forEach((function(t){"Visible"!==t.state&&--e})),e},r.prototype.renameSheetTab=function(){var t=this.tabInstance.element.querySelector(".e-toolbar-item.e-active");if(t){var r=(t=t.querySelector(".e-text-wrap")).querySelector(".e-tab-text").textContent,n={eventArgs:{name:r,index:this.parent.getActiveSheet().id},action:"renameSheet",cancel:!1};if(this.parent.trigger("actionBegin",n),n.cancel||this.parent.isProtected)return;var i=this.parent.createElement("input",{id:this.parent.element.id+"_rename_input",className:"e-input e-sheet-rename",styles:"width: "+t.getBoundingClientRect().width+"px",attrs:{type:"text",name:"Rename",required:"",value:r,spellcheck:"false",maxlength:"31"}});t.firstElementChild.style.display="none",t.appendChild(i),e.EventHandler.add(document,"mousedown touchstart",this.renameInputFocusOut,this),e.EventHandler.add(i,"keydown",this.renameKeyDown,this),e.EventHandler.add(i,"input",this.updateWidth,this),i.focus(),i.setSelectionRange(0,r.length),e.EventHandler.remove((0,e.closest)(t,".e-toolbar-items"),"dblclick",this.renameSheetTab)}},r.prototype.updateWidth=function(e){var t=e.target,r=t.value.length,n=t.value.split(" ");if(n.length){var i=n.length-1;r-=i,r+=.5*i}t.style.width=r+"ch"},r.prototype.renameKeyDown=function(e){32===e.keyCode?e.stopPropagation():27===e.keyCode?(this.removeRenameInput(e.target),this.focusTab(this.tabInstance.element)):13===e.keyCode&&this.renameInputFocusOut(e)},r.prototype.renameInputFocusOut=function(t){var r=t.target;if("mousedown"!==t.type&&"touchstart"!==t.type||!r.classList.contains("e-sheet-rename")&&!(0,e.closest)(r,".e-dlg-container")){var n=(r=document.getElementById(this.parent.element.id+"_rename_input")).value,i=this.parent.serviceLocator.getService(kl);if(n){var a=this.tabInstance.selectedItem;if(n.match(new RegExp(".*[\\[\\]\\*\\\\/\\?].*")))this.showRenameDialog(r,i.getConstant("SheetRenameInvalidAlert"));else{if(this.parent.sheets[a].name!==n)for(var s=0,o=this.parent.sheets.length;s<o;s++)if(s!==this.parent.activeSheetIndex&&this.parent.sheets[s].name.toLowerCase()===n.toLowerCase())return void this.showRenameDialog(r,i.getConstant("SheetRenameAlreadyExistsAlert"));var l=this.removeRenameInput(r);this.parent.sheets[a].name!==n&&(this.parent.setSheetPropertyOnMute(this.parent.sheets[a],"name",n),this.updateSheetName({value:n,idx:a,items:l})),"keydown"===t.type?this.focusTab(l):(0,e.closest)(t.target,".e-spreadsheet")&&Fd(this.parent.element)}}else this.showRenameDialog(r,i.getConstant("SheetRenameEmptyAlert"));this.parent.notify(ka,{eventArgs:{index:this.parent.getActiveSheet().id,value:n},action:"renameSheet"})}},r.prototype.focusTab=function(t){Fd((0,e.select)(".e-toolbar-item.e-active .e-tab-wrap",t))},r.prototype.updateSheetName=function(e){var t=this.tabInstance.items[e.idx].header.text.replace(/</g,"<").replace(/>/g,">"),r=e.value.replace(/</g,"<").replace(/>/g,">");this.tabInstance.items[e.idx].header.text=r,this.dropDownInstance.items[e.idx].text=r,this.dropDownInstance.setProperties({items:this.dropDownInstance.items},!0);var n=e.items.querySelectorAll(".e-toolbar-item")[e.idx].querySelector(".e-tab-text");if(n.textContent="",n.appendChild(document.createTextNode(e.value)),e.value.indexOf(" ")>-1?this.tabInstance.setProperties({items:this.tabInstance.items},!0):this.tabInstance.dataBind(),this.parent.notify(pe,{action:"renameUpdation",value:e.value,pName:t}),this.parent.allowChart){var i,a=[];this.parent.chartColl.forEach((function(r){r.range.includes("!")&&(i=r.range.lastIndexOf("!"),a[0]=r.range.substring(0,i),a[1]=r.range.substring(i+1),a[0].toLowerCase()===t.toLowerCase()&&(a[0]=e.value,r.range=a.join("!")))}))}},r.prototype.hideSheet=function(e){var t={action:"hideSheet",eventArgs:{sheetIndex:e.sheetIndex,cancel:!1}};e.triggerEvent&&(this.parent.notify(K,t),t.eventArgs.cancel)||(this.parent.setSheetPropertyOnMute(In(this.parent,e.sheetIndex),"state","Hidden"),this.tabInstance.hideTab(e.sheetIndex),e.triggerEvent&&(delete t.eventArgs.cancel,this.parent.notify(ka,t)))},r.prototype.removeRenameInput=function(t){var r=t.parentElement.querySelector(".e-tab-text"),n=(0,e.closest)(t,".e-toolbar-items");return e.EventHandler.add(n,"dblclick",this.renameSheetTab,this),e.EventHandler.remove(document,"mousedown touchstart",this.renameInputFocusOut),e.EventHandler.remove(t,"keydown",this.renameKeyDown),e.EventHandler.remove(t,"input",this.updateWidth),(0,e.remove)(t),r.style.display="",n},r.prototype.showRenameDialog=function(e,t){var r=this;this.parent.serviceLocator.getService(Al).show({height:180,width:400,isModal:!0,showCloseIcon:!0,content:t,beforeOpen:function(n){var i={dialogName:"SheetRenameDialog",element:n.element,target:n.target,cancel:n.cancel};r.parent.trigger("dialogBeforeOpen",i),i.cancel&&(n.cancel=!0),n.element.querySelector(".e-footer-content .e-primary").setAttribute("aria-label",t+" "+r.parent.serviceLocator.getService(kl).getConstant("Ok")),e.focus()},close:function(){return e.setSelectionRange(0,e.value.length)}})},r.prototype.focusRenameInput=function(){var e=document.getElementById(this.parent.element.id+"_rename_input");e&&e.focus()},r.prototype.removeSheetTab=function(t){var r=this;if(!t.count||t.count!==this.parent.sheets.length){var n=this.parent.serviceLocator.getService(kl);if(this.skipHiddenSheets()>1){var i=t.sheetName?In(this.parent,vn(this.parent,t.sheetName)):this.parent.getActiveSheet(),a=(0,e.isNullOrUndefined)(t.index)?vn(this.parent,i.name):t.index,s={index:a,sheetCount:this.parent.sheets.length,sheetName:i.name};if(!(!i.rows||!i.rows.length)&&(1!==i.rows.length||!(!i.rows[0].cells||!i.rows[0].cells.length))){var o=this.parent.serviceLocator.getService(Al);t.clicked?this.forceDelete(a):o.show({height:200,width:400,isModal:!0,showCloseIcon:!0,cssClass:"e-delete-sheet-dlg",content:n.getConstant("DeleteSheetAlert"),beforeOpen:function(e){var t={dialogName:"DeleteSheetDialog",element:e.element,target:e.target,cancel:e.cancel};r.parent.trigger("dialogBeforeOpen",t),t.cancel&&(e.cancel=!0),e.element.querySelector(".e-footer-content .e-primary").setAttribute("aria-label",n.getConstant("DeleteSheetAlert")+" "+n.getConstant("Ok")),Fd(r.parent.element)},buttons:[{buttonModel:{content:n.getConstant("Ok"),isPrimary:!0},click:function(){o.hide(),r.forceDelete(a),r.parent.notify(ba,null),t&&!t.isAction&&(s.sheetCount=r.parent.sheets.length,r.parent.notify(ka,{eventArgs:s,action:"removeSheet"}))}}]})}else this.parent.notify(nr,{startIndex:a,endIndex:a,modelType:"Sheet",isDelete:!0}),this.parent.notify(pe,{action:"deleteSheetTab",sheetId:In(this.parent,a).id}),this.destroySheet(a),this.parent.notify(ba,null),t&&!t.isAction&&(s.sheetCount=this.parent.sheets.length,this.parent.notify(ka,{eventArgs:s,action:"removeSheet"}))}else this.parent.serviceLocator.getService(Al).show({height:180,width:400,isModal:!0,showCloseIcon:!0,content:n.getConstant("DeleteSingleLastSheetAlert"),beforeOpen:function(e){var t={dialogName:"DeleteSingleSheetDialog",element:e.element,target:e.target,cancel:e.cancel};r.parent.trigger("dialogBeforeOpen",t),t.cancel&&(e.cancel=!0)}})}},r.prototype.forceDelete=function(e){this.parent.notify(Ts,{}),this.parent.notify(nr,{startIndex:e,endIndex:e,modelType:"Sheet",isDelete:!0}),this.parent.notify(pe,{action:"deleteSheetTab",sheetId:In(this.parent,e).id}),this.destroySheet(e)},r.prototype.destroySheet=function(t){var r=(0,e.isNullOrUndefined)(t)?this.parent.activeSheetIndex:t;this.parent.removeSheet(r),this.parent.notify(xe,{sheetIndex:r}),this.dropDownInstance.items.splice(r,1),this.dropDownInstance.setProperties({items:this.dropDownInstance.items},!0),this.tabInstance.removeTab(r);var n=this.parent.skipHiddenSheets(this.tabInstance.selectedItem);this.parent.activeSheetIndex=n,this.parent.setProperties({activeSheetIndex:n},!0),this.parent.renderModule.refreshSheet(),this.tabInstance.selectedItem=n,this.tabInstance.dataBind(),this.updateDropDownItems(n),this.parent.notify(Ua,null)},r.prototype.showAggregate=function(e){var r=this;if(m(t(this.parent.getActiveSheet().selectedRange))||e&&e.remove)this.removeAggregate();else{var n={Count:0,Sum:"0",Avg:"0",Min:"0",Max:"0",countOnly:!0};if(this.parent.notify(Se,n),n.Count>1){this.aggregateContent=n.countOnly?"Count":this.selaggregateCnt,n.countOnly&&(this.aggregateContent="Count",delete n.Sum,delete n.Avg,delete n.Min,delete n.Max);var i=n.countOnly?"e-aggregate-list e-flat e-aggregate-list-countonly e-caret-hide":"e-aggregate-list e-flat";delete n.countOnly;var a=this.aggregateContent,s=a+": "+n[a.toString()];if(this.aggregateDropDown)this.updateAggregateContent(s,n);else{var o=this.parent.createElement("button",{id:this.parent.element.id+"_aggregate",attrs:{type:"button"}});document.getElementById(this.parent.element.id+"_sheet_tab_panel").appendChild(o),this.aggregateDropDown=new Oh.DropDownButton({content:s,items:this.getAggregateItems(n),createPopupOnClick:!0,select:function(e){r.parent.notify(Se,n),r.updateAggregateContent(e.item.text,{Count:n.Count,Sum:n.Sum,Avg:n.Avg,Min:n.Min,Max:n.Max},!0)},beforeOpen:function(e){return r.beforeOpenHandler(r.aggregateDropDown,e.element)},open:function(e){return r.openHandler(r.aggregateDropDown,e.element,"right")},close:function(){return Fd(r.parent.element)},cssClass:i}),this.aggregateDropDown.createElement=this.parent.createElement,this.aggregateDropDown.appendTo(o)}}else this.removeAggregate()}},r.prototype.getAggregateItems=function(e){var t,r,n,i=this,a=[];return Object.keys(e).forEach((function(s){(n=e[""+s])!==Se&&(t=s+": "+n,r=s===i.aggregateContent?"e-selected-icon e-icons":"",a.push({text:t,iconCss:r}))})),a},r.prototype.updateAggregateContent=function(e,t,r){this.aggregateContent=e.split(": ")[0],r&&(this.selaggregateCnt=e.split(": ")[0]),this.aggregateDropDown.content=e,this.aggregateDropDown.dataBind(),this.aggregateDropDown.setProperties({items:this.getAggregateItems(t)},!0)},r.prototype.removeAggregate=function(){(0,e.isNullOrUndefined)(this.aggregateDropDown)||(this.aggregateDropDown.destroy(),(0,e.remove)(this.aggregateDropDown.element),this.aggregateDropDown=null)},r.prototype.addEventListener=function(){this.parent.on(Xn,this.createSheetTabs,this),this.parent.on(Kn,this.refreshSheetTab,this),this.parent.on(yi,this.insertSheetTab,this),this.parent.on(Ci,this.removeSheetTab,this),this.parent.on(bi,this.renameSheetTab,this),this.parent.on(vi,this.switchSheetTab,this),this.parent.on(Ki,this.updateSheetTab,this),this.parent.on(ve,this.removeAggregate,this),this.parent.on(hi,this.focusRenameInput,this),this.parent.on(fa,this.updateSheetName,this),this.parent.on(ga,this.hideSheet,this),this.parent.on(ns,this.showAggregate,this),this.parent.on(is,this.goToSheet,this),this.parent.on(as,this.showSheet,this)},r.prototype.destroy=function(){this.removeEventListener(),this.dropDownInstance&&this.dropDownInstance.destroy(),this.dropDownInstance=null,this.tabInstance&&this.tabInstance.destroy(),this.tabInstance=null,this.removeAggregate(),this.aggregateContent=null,this.addBtnRipple&&this.addBtnRipple(),this.addBtnRipple=null,e.EventHandler.remove(document,"mousedown touchstart",this.renameInputFocusOut);var t=document.getElementById(this.parent.element.id+"_sheet_tab_panel");t&&(0,e.remove)(t),this.selaggregateCnt&&(this.selaggregateCnt=null),this.parent=null},r.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(Xn,this.createSheetTabs),this.parent.off(Kn,this.refreshSheetTab),this.parent.off(yi,this.insertSheetTab),this.parent.off(Ci,this.removeSheetTab),this.parent.off(bi,this.renameSheetTab),this.parent.off(vi,this.switchSheetTab),this.parent.off(Ki,this.updateSheetTab),this.parent.off(ve,this.removeAggregate),this.parent.off(hi,this.focusRenameInput),this.parent.off(fa,this.updateSheetName),this.parent.off(ga,this.hideSheet),this.parent.off(ns,this.showAggregate),this.parent.off(is,this.goToSheet),this.parent.off(as,this.showSheet))},r}(),Wh=function(){function t(e){this.isImportedFile=!1,this.unProtectSheetIdx=[],this.parent=e,this.addEventListener(),this.renderFileUpload()}return t.prototype.addEventListener=function(){this.parent.on(ye,this.openSuccess,this),this.parent.on(Ce,this.openFailed,this),this.parent.on(xe,this.sheetsDestroyHandler,this)},t.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(ye,this.openSuccess),this.parent.off(Ce,this.openFailed),this.parent.off(xe,this.sheetsDestroyHandler))},t.prototype.renderFileUpload=function(){var e=this.parent.element.appendChild(this.parent.createElement("input",{id:this.parent.element.id+"_fileUpload",attrs:{type:"file",accept:".xls, .xlsx, .csv, .xlsm, .xlsb",name:"fileUpload"}}));e.onchange=this.fileSelect.bind(this),e.onerror=this.openFailed.bind(this),e.style.display="none"},t.prototype.fileSelect=function(t){var r=t.target.files[0];if(!(r&&r.length<1)){var n={file:r};this.parent.open(n),(0,e.select)("#"+this.parent.element.id+"_fileUpload",this.parent.element).value=""}},t.prototype.openSuccess=function(e){var t=this,r=["UnsupportedFile","InvalidUrl","NeedPassword","InCorrectPassword","InCorrectSheetPassword","CorrectSheetPassword","DataLimitExceeded","FileSizeLimitExceeded","ExternalWorkbook"],n=function(r){t.parent.serviceLocator.getService(Al).hide(!0);var n=new File([],e.guid,{type:r.toLowerCase()});t.parent.open({file:n,guid:e.guid,password:e.eventArgs.password,orginalFile:e.eventArgs.file})};if(r.indexOf(e.data)>-1){var i=this.parent.serviceLocator.getService(kl);if(r[2]===e.data)this.parent.element.querySelector(".e-importprotectworkbook-dlg")||this.parent.notify(zs,e.eventArgs);else if(r[3]===e.data){(a=this.parent.createElement("span",{className:"e-importprotectpwd-alert-span"})).innerText=i.getConstant("IncorrectPassword"),this.parent.element.querySelector(".e-importprotectworkbook-dlg").querySelector(".e-dlg-content").appendChild(a)}else if(r[4]===e.data){var a;(a=this.parent.createElement("span",{className:"e-unprotectsheetpwd-alert-span"})).innerText=i.getConstant("IncorrectPassword"),this.parent.element.querySelector(".e-unprotectworksheet-dlg").querySelector(".e-dlg-content").appendChild(a)}else{if(r[5]!==e.data){if(r[8]===e.data){this.parent.serviceLocator.getService(Al).hide(!0);var s=e.data.includes("ExternalWorkbook");return this.parent.serviceLocator.getService(Al).show({content:this.parent.serviceLocator.getService("spreadsheetLocale").getConstant("ExternalWorkbook"),width:"350",buttons:s?[{click:n.bind(this,e.data+"Yes"),buttonModel:{content:i.getConstant("Yes"),isPrimary:!0}},{click:n.bind(this,e.data+"No"),buttonModel:{content:i.getConstant("No")}}]:[],beforeOpen:function(e){var r={dialogName:"OpenDialog",element:e.element,target:e.target,cancel:e.cancel};t.parent.trigger("dialogBeforeOpen",r),r.cancel&&(e.cancel=!0)}},!!s||null),void this.parent.hideSpinner()}this.parent.serviceLocator.getService(Al).hide(!0);var o=e.data.includes("LimitExceeded");return this.parent.serviceLocator.getService(Al).show({content:this.parent.serviceLocator.getService("spreadsheetLocale").getConstant(e.data),width:"300",buttons:o?[{click:n.bind(this,e.data+"Open"),buttonModel:{content:i.getConstant("Ok"),isPrimary:!0}},{click:n.bind(this,e.data+"Cancel"),buttonModel:{content:i.getConstant("Cancel")}}]:[],beforeOpen:function(e){var r={dialogName:"OpenDialog",element:e.element,target:e.target,cancel:e.cancel};t.parent.trigger("dialogBeforeOpen",r),r.cancel&&(e.cancel=!0)}},!!o||null),void this.parent.hideSpinner()}this.parent.isOpen=!1,this.parent.notify(Js,null),this.parent.serviceLocator.getService(Al).hide(),this.parent.hideSpinner()}}else{this.parent.serviceLocator.getService(Al).hide(),this.parent.showSpinner()}this.parent.element&&r[5]!==e.data&&(this.parent.notify(Re,{cellRef:null,isOpen:!0}),e.isOpenFromJson||(this.parent.trigger("openComplete",{response:e}),this.parent.notify(ka,{response:e,action:"import"})),this.parent.isProtected&&this.parent.showSheetTabs&&e.isOpenFromJson&&(this.parent.element.querySelector(".e-add-sheet-tab").setAttribute("disabled","true"),this.parent.element.querySelector(".e-add-sheet-tab").classList.add("e-disabled")),this.parent.renderModule.refreshSheet(e.isOpenFromJson,!1,!1,!1,e),this.parent.notify(Kn,null),this.isImportedFile=!0,e.context.preventFormatCheck=e.eventArgs&&e.eventArgs.file&&e.eventArgs.file.name&&!e.eventArgs.file.name.includes(".csv"),this.unProtectSheetIdx=[],this.parent.hideSpinner())},t.prototype.openFailed=function(e){this.parent.trigger("openFailure",e),this.parent.hideSpinner()},t.prototype.sheetsDestroyHandler=function(t){(0,e.isNullOrUndefined)(t.sheetIndex)&&(this.isImportedFile=!1,this.unProtectSheetIdx=[])},t.prototype.destroy=function(){this.removeEventListener();var t=(0,e.select)("#"+this.parent.element.id+"_fileUpload",this.parent.element);t&&(0,e.detach)(t),this.isImportedFile=null,this.unProtectSheetIdx=null,this.parent=null},t.prototype.getModuleName=function(){return"open"},t}(),Gh=function(){function t(e){this.parent=e,this.addEventListener()}return t.prototype.destroy=function(){this.removeEventListener(),this.parent=null},t.prototype.addEventListener=function(){this.parent.on(X,this.initiateSave,this),this.parent.on(ee,this.saveCompleted,this),this.parent.on(_t,this.showErrorDialog,this),this.parent.on(J,this.exportDialog,this)},t.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(X,this.initiateSave),this.parent.off(ee,this.saveCompleted),this.parent.off(_t,this.showErrorDialog),this.parent.off(J,this.exportDialog))},t.prototype.getModuleName=function(){return"save"},t.prototype.initiateSave=function(){this.parent.showSpinner()},t.prototype.saveCompleted=function(){this.parent.hideSpinner()},t.prototype.showErrorDialog=function(e){var t=this;this.parent.serviceLocator.getService(Al).show({isModal:!0,showCloseIcon:!0,height:180,width:400,content:e.content,beforeOpen:function(){return Fd(t.parent.element)}})},t.prototype.exportDialog=function(t){var r=this,n=this.parent.serviceLocator.getService(kl),i=this.parent.serviceLocator.getService(Al),a=t?t.item.id.split(this.parent.element.id+"_")[1]:"xlsx";if((0,e.isNullOrUndefined)(this.parent.element.querySelector(".e-open-dlg"))){var s={isModal:!0,showCloseIcon:!0,cssClass:"e-open-dlg",header:n.getConstant("SaveAs"),beforeOpen:function(e){var t={dialogName:n.getConstant("SaveAs"),element:e.element,target:e.target,cancel:e.cancel};r.parent.trigger("dialogBeforeOpen",t),t.cancel&&(e.cancel=!0),i.dialogInstance.content=r.OpenContent(a),i.dialogInstance.dataBind(),r.parent.element.querySelector(".e-text-open").setSelectionRange(0,r.parent.element.querySelector(".e-text-open").value.length),Fd(r.parent.element)},buttons:[{buttonModel:{content:n.getConstant("Save"),isPrimary:!0,cssClass:"e-btn-open-ok"},click:function(){var n=r.parent.element.querySelector(".e-text-open").value;if(r.checkValidName(n)){i.hide();var a=t?t.item.id.split(r.parent.element.id+"_")[1]:"Xlsx";r.parent.save({saveType:a,fileName:n})}else{var s=r.parent.element.querySelector(".e-btn-open-ok");(0,e.getComponent)(s,"btn").disabled=!0;var o=r.parent.serviceLocator.getService(kl),l=0===n.length?o.getConstant("EmptyFileName"):n.length>218?o.getConstant("LargeName"):o.getConstant("FileNameError"),d=r.parent.createElement("span",{className:"e-file-alert-span"});d.innerText=l,r.parent.element.querySelector(".e-file-alert-span")&&r.parent.element.querySelector(".e-file-alert-span").remove(),r.parent.element.querySelector(".e-open-dlg").querySelector(".e-dlg-content").appendChild(d)}}}],close:function(){i.hide()}};i.show(s)}else i.hide()},t.prototype.checkValidName=function(e){var t=!0;return(e.match(new RegExp('.*[\\[\\]\\*\\\\/\\?\\:\\<\\>\\|\\"].*'))||e.length<1||e.length>218)&&(t=!1),t},t.prototype.OpenContent=function(t){var r=this,n=this.parent.serviceLocator.getService(kl),i=this.parent.createElement("div",{className:"e-open-dialog"}),a=this.parent.createElement("div",{className:"e-open-head"}),s=this.parent.createElement("div",{className:"e-input-group"});i.appendChild(a),i.appendChild(s);var o=n.getConstant("FileName"),l=this.parent.element.id+"_filename",d=this.parent.createElement("p",{className:"e-header",id:l,attrs:{"aria-label":n.getConstant("SaveAs")+" "+o}});d.innerText=o;var h=this.parent.createElement("input",{className:"e-input e-text-open",attrs:{type:"Text","aria-labelledby":l}}),p=this.parent.createElement("span",{className:"e-input-group-icon"});return h.onkeyup=function(t){if(r.parent.element.querySelector(".e-file-alert-span")&&13!==t.keyCode){var n=r.parent.element.querySelector(".e-btn-open-ok");(0,e.getComponent)(n,"btn").disabled=!1,r.parent.element.querySelector(".e-file-alert-span").remove()}},a.appendChild(d),p.textContent="."+t.toLowerCase(),s.appendChild(h),h.setAttribute("value","Sample"),s.appendChild(p),i},t}(),Yh=function(){function n(e){this.parent=e,this.init()}return n.prototype.init=function(){this.initContextMenu(),this.addEventListener()},n.prototype.initContextMenu=function(){var e=document.createElement("ul");e.id=this.parent.element.id+"_contextmenu",this.parent.element.appendChild(e),this.contextMenuInstance=new ch.ContextMenu({cssClass:"e-spreadsheet-contextmenu",target:"#"+this.parent.element.id,select:this.selectHandler.bind(this),beforeOpen:this.beforeOpenHandler.bind(this),beforeClose:this.beforeCloseHandler.bind(this),beforeItemRender:function(e){e.element.setAttribute("aria-label",e.item.text)}},e),e.setAttribute("role","menu")},n.prototype.beforeCloseHandler=function(e){var t=this;this.parent.trigger("contextMenuBeforeClose",e),this.parent.enableKeyboardShortcut&&e.event&&27===e.event.keyCode&&Bl((function(){return Fd(t.parent.element)}))},n.prototype.selectHandler=function(n){var i=(0,e.extend)({cancel:!1},n);this.parent.trigger("contextMenuItemSelect",i);var a,o=this.parent.element.id+"_cmenu",l=t(this.parent.getActiveSheet().selectedRange),d=[];if(this.parent.sortCollection)for(var h=this.parent.sortCollection.length-1;h>=0;h--)this.parent.sortCollection[h]&&this.parent.sortCollection[h].sheetIndex===this.parent.activeSheetIndex&&(d.push(this.parent.sortCollection[h]),this.parent.sortCollection.splice(h,1));if(n.item.id===o+"_delete_row"||n.item.id===o+"_delete_column"||n.item.id===o+"_insert_column_before"||n.item.id===o+"_insert_column_after"||n.item.id===o+"_insert_row_above"||n.item.id===o+"_insert_row_below"){var p=hl(this.parent.getActiveSheet(),l[0]),u=bl(this.parent.getActiveSheet(),l[1]);if(p&&!p.isReadOnly&&u&&!u.isReadOnly&&zd(this.parent,l))return void this.parent.notify(Ka,null)}if(n.item.id===o+"_ascending"||n.item.id===o+"_descending"||n.item.id===o+"_customsort"){var f=Ur(l[0],l[1],this.parent.getActiveSheet());if(zd(this.parent,f))return void this.parent.notify(Ka,null)}if(!i.cancel){var g=void 0;switch(n.item.id){case o+"_cut":this.parent.notify(Ri,{invokeCopy:!0,promise:Promise});break;case o+"_copy":this.parent.notify(Oi,{invokeCopy:!0,promise:Promise});break;case o+"_paste":this.parent.notify(ki,{isAction:!0,isInternal:!0,focus:!0});break;case o+"_pastevalues":this.parent.notify(ki,{type:"Values",isAction:!0,isInternal:!0,focus:!0});break;case o+"_pasteformats":this.parent.notify(ki,{type:"Formats",isAction:!0,isInternal:!0,focus:!0});break;case o+"_rename":this.parent.notify(bi,{});break;case o+"_delete_sheet":this.parent.notify(Ci,{}),Fd(this.parent.element);break;case o+"_insert_sheet":this.parent.notify($e,{model:this.parent,start:this.parent.activeSheetIndex,end:this.parent.activeSheetIndex,modelType:"Sheet",isAction:!0,activeSheetIndex:this.parent.activeSheetIndex});break;case o+"_hide_sheet":this.parent.notify(ga,{sheetIndex:this.parent.activeSheetIndex,triggerEvent:!0});break;case o+"_duplicate":An(this.parent,void 0,!0),Fd(this.parent.element);break;case o+"_move_right":kn(this.parent,this.parent.activeSheetIndex+1,null,!0),Fd(this.parent.element);break;case o+"_move_left":kn(this.parent,this.parent.activeSheetIndex-1,null,!0),Fd(this.parent.element);break;case o+"_ascending":this.parent.notify(Ia,{sortOptions:{sortDescriptors:{order:"Ascending"}}}),this.parent.notify(Zi,{sortOptions:{sortDescriptors:{order:"Ascending"}},previousSort:d});break;case o+"_descending":this.parent.notify(Ia,{sortOptions:{sortDescriptors:{order:"Descending"}}}),this.parent.notify(Zi,{sortOptions:{sortDescriptors:{order:"Descending"}},previousSort:d});break;case o+"_customsort":this.parent.notify($i,null);break;case o+"_filtercellvalue":this.parent.notify(Na,null);break;case o+"_clearfilter":a=s(r(this.parent.getActiveSheet().activeCell)[1]+1),this.parent.notify(Ra,{field:a});break;case o+"_reapplyfilter":this.parent.notify(Ea,null);break;case o+"_hide_row":g=t(this.parent.getActiveSheet().selectedRange),this.parent.notify(Rt,{startIndex:g[0],endIndex:g[2],hide:!0,isCol:!1,actionUpdate:!0});break;case o+"_unhide_row":g=t(this.parent.getActiveSheet().selectedRange),this.parent.notify(Rt,{startIndex:g[0],endIndex:g[2],hide:!1,isCol:!1,actionUpdate:!0});break;case o+"_hide_column":g=t(this.parent.getActiveSheet().selectedRange),this.parent.notify(Rt,{startIndex:g[1],endIndex:g[3],hide:!0,isCol:!0,actionUpdate:!0});break;case o+"_unhide_column":g=t(this.parent.getActiveSheet().selectedRange),this.parent.notify(Rt,{startIndex:g[1],endIndex:g[3],hide:!1,isCol:!0,actionUpdate:!0});break;case o+"_insert_row_above":case o+"_delete_row":g=t(this.parent.getActiveSheet().selectedRange),this.parent.notify(n.item.id.substr(o.length+1,6)+"Model",{model:this.parent.getActiveSheet(),start:g[0],end:g[2],modelType:"Row",isAction:!0,insertType:"above"});break;case o+"_insert_row_below":g=c(t(this.parent.getActiveSheet().selectedRange)),this.parent.notify($e,{model:this.parent.getActiveSheet(),start:g[2]+1,end:g[2]+1+(g[2]-g[0]),modelType:"Row",isAction:!0,insertType:"below"});break;case o+"_insert_column_before":case o+"_delete_column":g=t(this.parent.getActiveSheet().selectedRange),this.parent.notify(n.item.id.substr(o.length+1,6)+"Model",{model:this.parent.getActiveSheet(),start:g[1],end:g[3],modelType:"Column",isAction:!0,insertType:"before"});break;case o+"_insert_column_after":g=c(t(this.parent.getActiveSheet().selectedRange)),this.parent.notify($e,{model:this.parent.getActiveSheet(),start:g[3]+1,end:g[3]+1+(g[3]-g[1]),modelType:"Column",isAction:!0,insertType:"after"});break;case o+"_addNote":this.parent.notify(aa,null);break;case o+"_editNote":this.parent.notify(sa,null);break;case o+"_deleteNote":this.parent.notify(oa,{rowIndex:null,columnIndex:null,isDeleteFromMenu:!0});break;case o+"_hyperlink":this.parent.notify(ra,null);break;case o+"_editHyperlink":this.parent.notify(na,null);break;case o+"_openHyperlink":this.parent.notify(ia,null);break;case o+"_removeHyperlink":this.parent.notify(ca,{range:this.parent.getActiveSheet().selectedRange});break;case o+"_protect":this.parent.notify(ao,{})}}},n.prototype.getInsertModel=function(e,t){for(var r=[],n=e;n<=t;n++)n===e?r.push({index:n}):r.push({});return r},n.prototype.beforeOpenHandler=function(r){for(var n,i,a,s=r.event.target,o=["e-numericcontainer","e-active-cell","e-selection","e-row","e-header-row","e-select-all-cell","e-sheet-tabs-items","e-spreadsheet-contextmenu"],l=0,d=o.length;l<d;l++)if((0,e.closest)(s,"."+o[l])){n=!0;break}if(n)i=this.getTarget(s);else{if((n=["e-header-cell","e-rowhdr-table","e-selectall-table","e-main-panel"].some((function(e){return s.classList.contains(e)})))&&(parseInt(s.parentElement.style.zIndex,10)>1||parseInt(s.parentElement.parentElement.style.zIndex,10)>1)){var h=r.event,p={clientY:h.clientY,isImage:!1,target:s},c={clientX:h.clientX,isImage:!1,target:s};this.parent.notify(ys,p),this.parent.notify(Cs,c),i=p.size<=0?"ColumnHeader":c.size<=0?"RowHeader":"Content"}else n=!1}if(n){if(r.element.classList.contains("e-contextmenu")){var u=this.parent.getActiveSheet();if(r.event.target&&(s.classList.contains("e-rowresize")||s.classList.contains("e-colresize"))){var f=t(u.selectedRange);if(!(s.classList.contains("e-rowresize")?0===f[1]&&f[3]===u.colCount-1:0===f[0]&&f[2]===u.rowCount-1))return void(r.cancel=!0);a=(s.classList.contains("e-rowresize")?this.parent.hiddenCount(f[0],f[2])!==Math.abs(f[2]-f[0])+1:this.parent.hiddenCount(f[1],f[3],"columns")!==Math.abs(f[3]-f[1])+1)?this.getDataSource(i):this.getDataSource(i,s)}else{if("Content"===i){var g=0===(f=t(u.selectedRange))[1]&&f[3]===u.colCount-1,m=0===f[0]&&f[2]===u.rowCount-1;i=g&&m?"SelectAll":g?"RowHeader":m?"ColumnHeader":"Content"}a=this.getDataSource(i,"Footer"===i?s:void 0)}this.contextMenuInstance.items=a,this.contextMenuInstance.dataBind()}else a=r.items;if("None"===this.parent.selectionSettings.mode&&"Content"===i&&this.parent.enableContextMenuItems(["Filter"],!1,!1),"ColumnHeader"===i||"RowHeader"===i){if(r.element&&r.element.childElementCount>0){var v="ColumnHeader"===i?r.element.querySelector("#"+this.parent.element.id+"_cmenu_insert_column"):r.element.querySelector("#"+this.parent.element.id+"_cmenu_insert_row"),y="ColumnHeader"===i?r.element.querySelector("#"+this.parent.element.id+"_cmenu_delete_column"):r.element.querySelector("#"+this.parent.element.id+"_cmenu_delete_row");this.parent.allowInsert&&v.classList.contains("e-disabled")?v.classList.remove("e-disabled"):this.parent.allowInsert&&!this.parent.element.querySelector(".e-selectall.e-highlight")||v.classList.contains("e-disabled")||v.classList.add("e-disabled"),this.parent.allowDelete&&y.classList.contains("e-disabled")?y.classList.remove("e-disabled"):this.parent.allowDelete||y.classList.contains("e-disabled")||y.classList.add("e-disabled"),"None"===this.parent.selectionSettings.mode&&("ColumnHeader"===i&&this.parent.enableContextMenuItems(["Insert Column","Delete Column","Hide Column"],!1,!1),"RowHeader"===i&&this.parent.enableContextMenuItems(["Insert Row","Delete Row","Hide Row"],!1,!1))}}else if("Footer"===i){var C=vn(this.parent,s.textContent);0===C&&r.element.querySelector("#"+this.parent.element.id+"_cmenu_move_left").classList.add("e-disabled"),C===this.parent.sheets.length-1&&r.element.querySelector("#"+this.parent.element.id+"_cmenu_move_right").classList.add("e-disabled"),"None"===this.parent.selectionSettings.mode&&this.parent.enableContextMenuItems(["Insert"],!1,!1)}this.parent.trigger("contextMenuBeforeOpen",r),this.parent.notify(vi,(0,e.extend)(r,{target:i,items:a}))}else r.cancel=!0},n.prototype.getTarget=function(t){return(0,e.closest)(t,".e-sheet-content")?"Content":(0,e.closest)(t,".e-column-header")?t.classList.contains("e-header-cell")?"ColumnHeader":"Content":(0,e.closest)(t,".e-row-header")?t.classList.contains("e-header-cell")?"RowHeader":"Content":(0,e.closest)(t,".e-sheet-tabs-items")?"Footer":(0,e.closest)(t,".e-selectall-container")?t.classList.contains("e-header-cell")?(0,e.closest)(t,".e-header-row")?"ColumnHeader":"RowHeader":(0,e.closest)(t,".e-select-all-cell")?"SelectAll":"Content":""},n.prototype.getDataSource=function(e,r){var n=this.parent.serviceLocator.getService(kl),i=[],a=this.parent.element.id+"_cmenu";if("Content"===e)this.setClipboardData(i,n,a),i.push({separator:!0}),this.setFilterItems(i,a),this.setSortItems(i,a),i.push({separator:!0}),this.parent.enableNotes&&(this.setNotesMenu(i,a),i.push({separator:!0})),this.setHyperLink(i,a);else if("RowHeader"===e){this.setClipboardData(i,n,a);var s=t(this.parent.getActiveSheet().selectedRange);this.setInsertDeleteItems(i,n,"Row",a,[s[0],s[2]],["Above","Below"]),r&&!r.classList.contains("e-rowresize")&&r.parentElement&&r.parentElement.classList.value.includes("e-hide")||this.setHideShowItems(i,n,"Row",a,[s[0],s[2]])}else if("ColumnHeader"===e){this.setClipboardData(i,n,a);s=t(this.parent.getActiveSheet().selectedRange);this.setInsertDeleteItems(i,n,"Column",a,[s[1],s[3]],["Before","After"]),r&&r.classList.value.includes("e-hide")||this.setHideShowItems(i,n,"Column",a,[s[1],s[3]])}else"SelectAll"===e?(this.setClipboardData(i,n,a),this.setFilterItems(i,a),this.setSortItems(i,a)):"Footer"===e&&(i.push({text:n.getConstant("Insert"),id:a+"_insert_sheet"}),i.push({text:n.getConstant("Delete"),iconCss:"e-icons e-delete",id:a+"_delete_sheet"}),i.push({text:n.getConstant("DuplicateSheet"),id:a+"_duplicate"}),i.push({text:n.getConstant("Rename"),id:a+"_rename"}),i.push({text:n.getConstant("Hide"),id:a+"_hide_sheet"}),this.setProtectSheetItems(i,a,r),i.push({text:n.getConstant("MoveRight"),id:a+"_move_right"}),i.push({text:n.getConstant("MoveLeft"),id:a+"_move_left"}));return i},n.prototype.setProtectSheetItems=function(e,t,r){var n=this.parent.serviceLocator.getService(kl);In(this.parent,vn(this.parent,r.textContent)).isProtected?e.push({text:n.getConstant("UnprotectSheet"),id:t+"_protect",iconCss:"e-icons e-protect-icon"}):e.push({text:n.getConstant("ProtectSheet"),id:t+"_protect",iconCss:"e-icons e-protect-icon"})},n.prototype.setFilterItems=function(e,t){if(this.parent.allowFiltering){var r=this.parent.serviceLocator.getService(kl),n={clearFilterText:null,isFiltered:!1};this.parent.notify(Oa,n),e.push({text:r.getConstant("Filter"),id:t+"_filter",iconCss:"",items:[{text:n.clearFilterText,iconCss:"e-icons e-filter-clear",id:t+"_clearfilter"},{text:r.getConstant("ReapplyFilter"),iconCss:"e-icons e-filter-reapply",id:t+"_reapplyfilter"},{separator:!0},{text:r.getConstant("FilterCellValue"),iconCss:"",id:t+"_filtercellvalue"}]})}},n.prototype.setSortItems=function(e,t){var r=this.parent.serviceLocator.getService(kl);this.parent.allowSorting&&e.push({text:r.getConstant("Sort"),id:t+"_sort",iconCss:"e-icons e-sort-icon",items:[{text:r.getConstant("SortAscending"),iconCss:"e-icons e-sort-asc",id:t+"_ascending"},{text:r.getConstant("SortDescending"),iconCss:"e-icons e-sort-desc",id:t+"_descending"},{text:r.getConstant("CustomSort")+"...",iconCss:"e-icons e-sort-custom",id:t+"_customsort"}]})},n.prototype.setHyperLink=function(t,n){if(this.parent.allowHyperlink){var i=this.parent.serviceLocator.getService(kl),a=r(this.parent.getActiveSheet().activeCell),s=this.parent.getCell(a[0],a[1]);(0,e.isNullOrUndefined)(s)?t.push({text:i.getConstant("Hyperlink"),iconCss:"e-icons e-hyperlink-icon",id:n+"_hyperlink"}):s.getElementsByClassName("e-hyperlink")[0]||s.classList.contains("e-hyperlink")?t.push({text:i.getConstant("EditHyperlink"),iconCss:"e-icons e-edithyperlink-icon",id:n+"_editHyperlink"},{text:i.getConstant("OpenHyperlink"),iconCss:"e-icons e-openhyperlink-icon",id:n+"_openHyperlink"},{text:i.getConstant("RemoveHyperlink"),iconCss:"e-icons e-removehyperlink-icon",id:n+"_removeHyperlink"}):t.push({text:i.getConstant("Hyperlink"),iconCss:"e-icons e-hyperlink-icon",id:n+"_hyperlink"})}},n.prototype.setNotesMenu=function(t,n){if(this.parent.enableNotes){var i=this.parent.serviceLocator.getService(kl),a=r(this.parent.getActiveSheet().activeCell),s=this.parent.getCell(a[0],a[1]);!(0,e.isNullOrUndefined)(s)&&s.children.length>0&&s.children[s.children.length-1].className.indexOf("addNoteIndicator")>-1?t.push({text:i.getConstant("EditNote"),iconCss:"e-icons e-edit-notes",id:n+"_editNote"},{text:i.getConstant("DeleteNote"),iconCss:"e-icons e-delete-notes",id:n+"_deleteNote"}):t.push({text:i.getConstant("AddNote"),iconCss:"e-icons e-add-notes",id:n+"_addNote"})}},n.prototype.setClipboardData=function(e,t,r){this.parent.enableClipboard&&(e.push({text:t.getConstant("Cut"),iconCss:"e-icons e-cut-icon",id:r+"_cut"}),e.push({text:t.getConstant("Copy"),iconCss:"e-icons e-copy-icon",id:r+"_copy"}),e.push({text:t.getConstant("Paste"),iconCss:"e-icons e-paste-icon",id:r+"_paste"}),e.push({text:t.getConstant("PasteSpecial"),id:r+"_pastespecial",items:[{text:t.getConstant("Values"),id:r+"_pastevalues"},{text:t.getConstant("Formats"),id:r+"_pasteformats"}]}))},n.prototype.setInsertDeleteItems=function(e,t,r,n,i,a){e.push({separator:!0}),["Insert","Delete"].forEach((function(s){i[0]===i[1]?e.push({text:t.getConstant(""+s+r),id:n+"_"+s.toLowerCase()+"_"+r.toLowerCase()}):e.push({text:t.getConstant(""+s+r+"s"),id:n+"_"+s.toLowerCase()+"_"+r.toLowerCase()}),"Insert"===s&&(e[e.length-1].items=[],a.forEach((function(r){e[e.length-1].items.push({text:t.getConstant(r),id:e[e.length-1].id+"_"+r.toLowerCase()})})))}))},n.prototype.setHideShowItems=function(e,t,r,n,i){if(i[0]===i[1])e.push({text:t.getConstant("Hide"+r),id:n+"_hide_"+r.toLowerCase()});else{var a=i[0];i[0]=i[0]>i[1]?i[1]:i[0],i[1]=i[1]>a?i[1]:a,e.push({text:t.getConstant("Hide"+r+"s"),id:n+"_hide_"+r.toLowerCase()})}this.parent.hiddenCount(i[0],i[1],r.toLowerCase()+"s")&&e.push({text:t.getConstant("Unhide"+r+"s"),id:n+"_unhide_"+r.toLowerCase()})},n.prototype.addEventListener=function(){this.parent.on(Di,this.addItemsHandler,this),this.parent.on(Li,this.removeItemsHandler,this),this.parent.on(Pi,this.enableItemsHandler,this)},n.prototype.addItemsHandler=function(e){e.insertAfter?this.contextMenuInstance.insertAfter(e.items,e.text,e.isUniqueId):this.contextMenuInstance.insertBefore(e.items,e.text,e.isUniqueId)},n.prototype.removeItemsHandler=function(e){this.contextMenuInstance.removeItems(e.items,e.isUniqueId)},n.prototype.enableItemsHandler=function(e){this.contextMenuInstance.enableItems(e.items,e.enable,e.isUniqueId)},n.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(Di,this.addItemsHandler),this.parent.off(Li,this.removeItemsHandler),this.parent.off(Pi,this.enableItemsHandler))},n.prototype.getModuleName=function(){return"contextMenu"},n.prototype.destroy=function(){this.removeEventListener(),this.contextMenuInstance.destroy();var t=document.getElementById(this.parent.element.id+"_contextmenu");t&&(0,e.detach)(t),this.contextMenuInstance=null,this.parent=null},n}(),Xh=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.refreshCellElement=function(e){this.parent.refreshNode(e.td,e)},e.prototype.getTextSpace=function(e){e.width=Id(e.char,e.cell.style,this.parent.cellStyle)},e.prototype.rowFillHandler=function(e){var t=e.cellEle;if(t){var r=void 0,n=e.colIdx;if(e.cell.colSpan>1){var i={range:[e.rowIdx,e.colIdx,e.rowIdx,e.colIdx]};this.parent.notify(Et,i),n=i.range[3]}var a=Rd(this.parent.getActiveSheet(),e.rowIdx,e.colIdx,n),s=e.iconSetSpan||t.querySelector(".e-iconsetspan");if(s&&(a-=s.getBoundingClientRect().width),e.updateFillSize){if(!(r=t.querySelector(".e-fill"))||!r.textContent)return;e.repeatChar=r.textContent[0],(o=t.querySelector(".e-fill-before"))&&(a-=Id(o.textContent,e.cell.style,this.parent.cellStyle)),(l=t.querySelector(".e-fill-sec"))&&(a-=Id(l.textContent,e.cell.style,this.parent.cellStyle))}else{var o,l,d=t.querySelector(".e-addNoteIndicator");if(t.innerText="",e.beforeFillText)(o=this.parent.createElement("span",{className:"e-fill-before",styles:"float: "+(this.parent.enableRtl?"right":"left")})).innerText=e.beforeFillText,t.appendChild(o),a-=Id(e.beforeFillText,e.cell.style,this.parent.cellStyle);if(r=this.parent.createElement("span",{className:"e-fill"}),t.appendChild(r),e.afterFillText)(l=this.parent.createElement("span",{className:"e-fill-sec"})).innerText=e.afterFillText,t.appendChild(l),a-=Id(e.afterFillText,e.cell.style,this.parent.cellStyle);s&&t.insertBefore(s,t.childNodes[0]),d&&t.appendChild(d)}var h=Id(e.repeatChar,e.cell.style,this.parent.cellStyle),p=parseInt((a/h).toString(),10);e.formattedText=p>0?e.repeatChar.repeat(p):"",r.textContent=e.formattedText}},e.prototype.addEventListener=function(){this.parent.on(ie,this.refreshCellElement,this),this.parent.on(Jt,this.rowFillHandler,this),this.parent.on(Qt,this.getTextSpace,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(ie,this.refreshCellElement),this.parent.off(Jt,this.rowFillHandler),this.parent.off(Qt,this.getTextSpace))},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.getModuleName=function(){return"numberFormat"},e}(),Kh=function(){function r(e){this.parent=e,this.addEventListener()}return r.prototype.destroy=function(){this.removeEventListener(),this.parent=null},r.prototype.addEventListener=function(){this.parent.on(Zi,this.applySortHandler,this),this.parent.on(Te,this.sortCompleteHandler,this),this.parent.on($i,this.initiateCustomSortHandler,this),this.parent.on($,this.sortImport,this)},r.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(Zi,this.applySortHandler),this.parent.off(Te,this.sortCompleteHandler),this.parent.off($i,this.initiateCustomSortHandler),this.parent.off($,this.sortImport))},r.prototype.getModuleName=function(){return"sort"},r.prototype.isValidSortRange=function(){var e=this.parent.getActiveSheet(),t=c(o(e.selectedRange));return!(t[0]>e.usedRange.rowIndex||t[1]>e.usedRange.colIndex)},r.prototype.sortImport=function(e){for(var t,r=this.parent.sortCollection,n=this.parent.getActiveSheet().usedRange.rowIndex-1,i=e?e.sheetIdx:this.parent.activeSheetIndex,a=0;a<r.length;a++)if(r[a].sheetIndex===i)for(var s=0;s<n;s++)if((t=this.parent.getCell(s,r[a].columnIndex))&&t.querySelector(".e-filter-icon"))return void("Ascending"===r[a].order||"OnTop"===r[a].order?t.querySelector(".e-filter-icon").classList.contains("e-sortasc-filter")||t.querySelector(".e-filter-icon").classList.add("e-sortasc-filter"):t.querySelector(".e-filter-icon").classList.contains("e-sortdesc-filter")||t.querySelector(".e-filter-icon").classList.add("e-sortdesc-filter"))},r.prototype.sortRangeAlertHandler=function(e){var t=this,r=this.parent.serviceLocator.getService(Al),n=this.parent.serviceLocator.getService(kl);r.show({height:180,width:400,isModal:!0,showCloseIcon:!0,content:e.error,beforeOpen:function(i){var a={dialogName:e.error===n.getConstant("MultiRangeSortError")?"MultiRangeSortDialog":"SortRangeDialog",content:e.error,element:i.element,target:i.target,cancel:i.cancel};t.parent.trigger("dialogBeforeOpen",a),a.cancel?i.cancel=!0:Fd(t.parent.element),r.dialogInstance.content=a.content}}),this.parent.hideSpinner()},r.prototype.initiateCustomSortHandler=function(){var t=this,r=this.parent.serviceLocator.getService(kl),n=this.parent.getActiveSheet();if(this.isValidSortRange()&&0!==n.rows.length)if(Dd(n.selectedRange))this.sortRangeAlertHandler({error:r.getConstant("MultiRangeSortError")});else{var i,a=this.parent.serviceLocator.getService(Al);a.show({height:400,width:560,isModal:!0,showCloseIcon:!0,cssClass:"e-customsort-dlg",header:r.getConstant("CustomSort"),beforeOpen:function(e){var r={dialogName:"CustomSortDialog",element:e.element,target:e.target,cancel:e.cancel};t.parent.trigger("dialogBeforeOpen",r),r.cancel&&(e.cancel=!0),a.dialogInstance.content=t.customSortContent(),a.dialogInstance.dataBind(),Fd(t.parent.element)},buttons:[{buttonModel:{content:r.getConstant("Ok"),isPrimary:!0},click:function(){var r=a.dialogInstance.content,n=(0,e.getComponent)(r.getElementsByClassName("e-list-sort e-listview e-lib")[0],"listview").dataSource;t.clearError();var s=r.getElementsByClassName("e-sort-error")[0];s.style.display="block",t.validateError(n,r,s)||(i={sortDescriptors:n,containsHeader:r.getElementsByClassName("e-sort-checkheader")[0].checked,caseSensitive:r.getElementsByClassName("e-sort-checkcase")[0].checked},a.hide())}}],close:function(){i&&Bl((function(){return t.applySortHandler({sortOptions:i})}))}})}else this.sortRangeAlertHandler({error:r.getConstant("SortOutOfRangeError")})},r.prototype.validateError=function(t,r,n){var i=this.parent.serviceLocator.getService(kl);if(t.some((function(e){return""===e.field.toString()})))return Array.prototype.some.call(r.getElementsByClassName("e-sort-field"),(function(t){var r=!(0,e.getComponent)(t,"dropdownlist").value;return r&&t.parentElement.classList.add("e-error"),r})),n.innerText=i.getConstant("SortEmptyFieldError"),!0;var a=new Set,s="",o=t.some((function(e){return s=e.field.toString(),a.size===a.add(e.field).size})),l="";if(o){var d=0;Array.prototype.some.call(r.getElementsByClassName("e-sort-field"),(function(t){var r=(0,e.getComponent)(t,"dropdownlist");return r.value===s&&(t.parentElement.classList.add("e-error"),l=r.text,d++),2===d})),n.innerText="";var h=this.parent.createElement("strong");return h.innerText=l,n.appendChild(h),n.appendChild(document.createTextNode(i.getConstant("SortDuplicateFieldError"))),!0}return!1},r.prototype.customSortContent=function(){var t=this.parent.createElement("div",{className:"e-sort-dialog"}),r=this.getFields(),n=(0,e.getUniqueID)("customSort"),i=this.getCustomListview(n);this.setHeaderTab(t,i,r);var a=this.parent.createElement("div",{className:"e-sort-listsection",styles:""});t.appendChild(a);var s=this.parent.createElement("div",{className:"e-list-sort",styles:""});a.appendChild(s),i.createElement=this.parent.createElement,i.appendTo(s),s.removeAttribute("tabindex"),this.renderListItem(n,i,!0,r);var o=this.parent.createElement("div",{className:"e-sort-error"});return t.appendChild(o),t},r.prototype.getFields=function(){var e=this.parent.getActiveSheet(),t=c(o(e.selectedRange));if(t[0]===t[2]&&t[2]-t[0]==0){t[0]=0,t[1]=0,t[3]=e.usedRange.colIndex;var r={filterRange:[],hasFilter:!1};this.parent.notify(Fa,r),r.hasFilter&&r.filterRange&&(t[0]=r.filterRange[0])}var n,i,a=[];for(t[1];t[1]<=t[3];t[1]++){var l=Ln(t[0],t[1],e);if(i="Column "+s(t[1]+1),l&&l.value){if(n=l.value,l.format){var d={formattedText:n,value:n,format:l.format,rowIndex:t[0],colIndex:t[1]};this.parent.notify(re,d),n=d.formattedText}}else n=i;a.push({text:n,value:i})}return a},r.prototype.setHeaderTab=function(t,r,n){var i=this,a=this.parent.serviceLocator.getService(kl),s=this.parent.createElement("div",{className:"e-sort-header"});t.appendChild(s);var o=this.parent.createElement("button",{className:"e-btn e-sort-addbtn e-flat",attrs:{type:"button"}});o.innerText=a.getConstant("AddColumn");var l=this.parent.element.querySelector(".e-customsort-dlg .e-footer-content");l.insertBefore(o,l.firstElementChild),o.addEventListener("click",(function(){if(r){var t=(0,e.getUniqueID)("customSort");r.addItem([{id:t,text:a.getConstant("ThenBy"),field:"",order:"ascending"}]),i.renderListItem(t,r,d.checked,n,!0)}}));var d=new bh.CheckBox({label:a.getConstant("ContainsHeader"),checked:!0,change:function(r){var i=r.checked?{text:"text",value:"value"}:{text:"value"};Array.prototype.forEach.call(t.getElementsByClassName("e-sort-field e-dropdownlist e-lib"),(function(t){var r=(0,e.getComponent)(t,"dropdownlist");r.dataSource=null,r.dataSource=n,r.fields=i,r.dataBind()}))},cssClass:"e-sort-headercheckbox"}),h=this.parent.createElement("input",{className:"e-sort-checkheader",attrs:{type:"checkbox"}});s.appendChild(h),d.createElement=this.parent.createElement,d.appendTo(h);var p=new bh.CheckBox({label:a.getConstant("CaseSensitive"),checked:!1,cssClass:"e-sort-casecheckbox"}),c=this.parent.createElement("input",{className:"e-sort-checkcase",attrs:{type:"checkbox"}});s.appendChild(c),p.createElement=this.parent.createElement,p.appendTo(c)},r.prototype.getCustomListview=function(t){var r=[{id:t,text:this.parent.serviceLocator.getService(kl).getConstant("SortBy"),field:"",order:"ascending"}];(0,e.enableRipple)(!1);var n=new wh.ListView({dataSource:r,fields:{id:"id"},height:"100%",template:(0,e.initializeCSPTemplate)((function(e){return'<div class="e-sort-listwrapper"><span class="text">'+e.text+'</span><div class="e-sort-row"><div class="e-sort-field"></div><div class="e-sort-order"><span class="e-sort-ordertxt" style="display:none;">'+e.order+'</span></div><span class="e-icons e-sort-delete" tabindex="0"></span></div>'})),cssClass:"e-sort-template"});return n},r.prototype.deleteHandler=function(e,t){e.getElementsByClassName("e-sort-delete")[0].addEventListener("click",(function(){e&&t.removeItem(e)}))},r.prototype.renderListItem=function(e,t,r,n,i){var a=this,s=this.parent.serviceLocator.getService(kl),o=t.element.querySelector("li[data-uid="+e+"]"),l=r?{text:"text",value:"value"}:{text:"value"},d=o.getElementsByClassName("e-sort-field")[0],h=new xh.DropDownList({dataSource:n,width:"auto",cssClass:"e-sort-field-ddl",fields:l,placeholder:s.getConstant("SelectAColumn"),change:function(r){r.value&&(Array.prototype.some.call(t.dataSource,(function(t){return t.id===e&&(t.field=r.value.toString().replace("Column ","")),t.id===e})),a.clearError())}});h.createElement=this.parent.createElement,h.appendTo(d),i||(h.index=0);var p=o.getElementsByClassName("e-sort-order")[0],c="ascending"===p.getElementsByClassName("e-sort-ordertxt")[0].innerText.toLocaleLowerCase(),u=new bh.RadioButton({label:s.getConstant("SortAscending"),name:"sortAZ_"+e,value:"ascending",checked:c,cssClass:"e-sort-radiobutton",change:function(r){a.setRadioBtnValue(t,e,r.value)}}),f=this.parent.createElement("input",{id:"orderAsc_"+e,className:"e-sort-radioasc",styles:"",attrs:{type:"radio"}});p.appendChild(f),u.createElement=this.parent.createElement,u.appendTo(f);var g=new bh.RadioButton({label:s.getConstant("SortDescending"),name:"sortAZ_"+e,value:"descending",checked:!c,cssClass:"e-sort-radiobutton",change:function(r){a.setRadioBtnValue(t,e,r.value)}}),m=this.parent.createElement("input",{id:"orderDesc_"+e,className:"e-sort-radiodesc",styles:"",attrs:{type:"radio"}});p.appendChild(m),g.createElement=this.parent.createElement,g.appendTo(m),this.deleteHandler(o,t)},r.prototype.setRadioBtnValue=function(e,t,r){r&&Array.prototype.some.call(e.dataSource,(function(e){return e.id===t&&(e.order=r),e.id===t}))},r.prototype.clearError=function(){var e=document.getElementsByClassName("e-sort-dialog")[0],t=e.getElementsByClassName("e-sort-error")[0];"none"!==t.style.display&&""!==t.innerHTML&&(t.style.display="none",Array.prototype.forEach.call(e.getElementsByClassName("e-error"),(function(e){e.classList.remove("e-error")})))},r.prototype.applySortHandler=function(e){var t=this,r=this.parent.getActiveSheet(),n=e&&e.range||r.selectedRange,i=c(o(n)),s=e&&e.sortOptions||{sortDescriptors:{}},l=i[0]===i[2],d={filterRange:[],hasFilter:!1,sheetIdx:this.parent.activeSheetIndex};this.parent.notify(Fa,d),d.hasFilter&&(l?Nr(d.filterRange,i[0],i[1]):d.filterRange[0]===i[0]&&(this.parent.element.querySelector(".e-selectall.e-highlight")||i[1]>=d.filterRange[1]&&i[1]<=d.filterRange[3]||i[3]>=d.filterRange[1]&&i[3]<=d.filterRange[3]))&&(i[0]=d.filterRange[0],i[1]=d.filterRange[1],i[2]=r.usedRange.rowIndex,i[3]=r.usedRange.colIndex,s.containsHeader=!d.allowHeaderFilter,l=!1);var h={range:n=a(i),sortOptions:s,cancel:!1};if(this.parent.trigger(ke,h),!h.cancel){this.parent.notify(K,{eventArgs:h,action:"beforeSort"}),this.parent.showSpinner();var p=new Promise((function(e){e(void 0)})),u={args:{range:h.range,sortOptions:h.sortOptions,checkForHeader:l&&n!==h.range},promise:p,previousSort:e&&e.previousSort};this.parent.notify(Ae,u),u.promise.then((function(e){return t.sortCompleteHandler(e),t.parent.trigger(Te,e),t.parent.notify(ka,{eventArgs:e,action:"sorting"}),"BODY"===document.activeElement.tagName&&Fd(t.parent.element),Promise.resolve(e)})).catch((function(e){return t.sortRangeAlertHandler({error:e}),Promise.reject(e)}))}},r.prototype.sortCompleteHandler=function(e){var r,n,i=this.parent.activeSheetIndex;if(e.range.includes("!")){var a=e.range.lastIndexOf("!");i=vn(this.parent,e.range.substring(0,a)),r=In(this.parent,i),n=t(e.range.substring(a+1))}else r=this.parent.getActiveSheet(),n=t(e.range);for(var s=n[0];s<=n[2];s++)for(var o=n[1];o<=n[3];o++)this.parent.notify(pe,{action:"refreshCalculate",rowIndex:s,colIndex:o});this.parent.serviceLocator.getService("cell").refreshRange(n,!0,!0,!1,!1,Yr(this.parent),void 0,void 0,void 0,!0),i===this.parent.activeSheetIndex&&r.conditionalFormats&&r.conditionalFormats.length&&this.parent.notify(kt,{indexes:n}),this.parent.hideSpinner(),this.parent.notify(wa,null)},r}(),$h=u(707),Zh=function(){function i(e){this.parent=e,this.filterCollection=new Map,this.filterRange=new Map,this.filterBtn=e.createElement("div",{className:"e-filter-btn e-control e-btn e-lib e-filter-iconbtn e-icon-btn"}),this.filterBtn.appendChild(e.createElement("span",{className:"e-btn-icon e-icons e-filter-icon"})),this.addEventListener()}return i.prototype.destroy=function(){var e=this;this.removeEventListener(),this.parent.refreshing&&this.filterRange.size&&(this.parent.filterCollection=[],this.filterRange.forEach((function(t,r){e.setFilteredCollection({sheetIdx:r,saveJson:{filterCollection:e.parent.filterCollection}})}))),this.filterRange=null,this.filterCollection=null,this.filterBtn&&this.filterBtn.remove(),this.filterBtn=null,this.treeViewObj&&this.treeViewObj.destroy(),this.treeViewObj=null,this.treeViewEle&&this.treeViewEle.remove(),this.treeViewEle=null,this.cBox&&(this.cBox.remove(),this.cBox=null);var t=document.querySelectorAll(".e-filter-popup");t&&t.forEach((function(e){e.remove()})),this.parent=null},i.prototype.addEventListener=function(){this.parent.on(qe,this.filterRangeAlertHandler,this),this.parent.on(xa,this.initiateFilterUIHandler,this),this.parent.on(Jn,this.filterMouseDownHandler,this),this.parent.on(Sa,this.renderFilterCellHandler,this),this.parent.on(wa,this.refreshFilterRange,this),this.parent.on(Ia,this.updateSortCollectionHandler,this),this.parent.on($h.beforeFltrcMenuOpen,this.beforeFilterMenuOpenHandler,this),this.parent.on($h.filterCmenuSelect,this.closeDialog,this),this.parent.on(Ea,this.reapplyFilterHandler,this),this.parent.on(Na,this.filterByCellValueHandler,this),this.parent.on(Ra,this.clearFilterHandler,this),this.parent.on(Oa,this.getFilteredColumnHandler,this),this.parent.on(vi,this.cMenuBeforeOpenHandler,this),this.parent.on($h.filterCboxValue,this.filterCboxValueHandler,this),this.parent.on(Fa,this.getFilterRangeHandler,this),this.parent.on(Aa,this.filterCellKeyDownHandler,this),this.parent.on(Q,this.setFilteredCollection,this),this.parent.on(Zn,this.updateFilter,this),this.parent.on(qt,this.beforeInsertHandler,this),this.parent.on(Wt,this.beforeDeleteHandler,this),this.parent.on(xe,this.deleteSheetHandler,this),this.parent.on(Ft,this.clearHandler,this),this.parent.on($h.filterDialogCreated,this.filterDialogCreatedHandler,this),this.parent.on($h.filterDialogClose,this.removeFilterClass,this),this.parent.on(sr,this.duplicateSheetFilterHandler,this),this.parent.on($h.fltrPrevent,this.beforeFilteringHandler,this),this.parent.on($h.beforeCustomFilterOpen,this.customFilterOpen,this),this.parent.on(mr,this.moveSheetHandler,this),this.parent.on(ea,this.refreshFilterCellsOnResize,this)},i.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(qe,this.filterRangeAlertHandler),this.parent.off(xa,this.initiateFilterUIHandler),this.parent.off(Jn,this.filterMouseDownHandler),this.parent.off(Sa,this.renderFilterCellHandler),this.parent.off(wa,this.refreshFilterRange),this.parent.off(Ia,this.updateSortCollectionHandler),this.parent.off($h.beforeFltrcMenuOpen,this.beforeFilterMenuOpenHandler),this.parent.off($h.filterCmenuSelect,this.closeDialog),this.parent.off(Ea,this.reapplyFilterHandler),this.parent.off(Na,this.filterByCellValueHandler),this.parent.off(Ra,this.clearFilterHandler),this.parent.off(Oa,this.getFilteredColumnHandler),this.parent.off(vi,this.cMenuBeforeOpenHandler),this.parent.off($h.filterCboxValue,this.filterCboxValueHandler),this.parent.off(Fa,this.getFilterRangeHandler),this.parent.off(Aa,this.filterCellKeyDownHandler),this.parent.off(Q,this.setFilteredCollection),this.parent.off(Zn,this.updateFilter),this.parent.off(qt,this.beforeInsertHandler),this.parent.off(Wt,this.beforeDeleteHandler),this.parent.off(xe,this.deleteSheetHandler),this.parent.off(Ft,this.clearHandler),this.parent.off($h.filterDialogCreated,this.filterDialogCreatedHandler),this.parent.off($h.filterDialogClose,this.removeFilterClass),this.parent.off(sr,this.duplicateSheetFilterHandler),this.parent.off($h.fltrPrevent,this.beforeFilteringHandler),this.parent.off($h.beforeCustomFilterOpen,this.customFilterOpen),this.parent.off(mr,this.moveSheetHandler),this.parent.off(ea,this.refreshFilterCellsOnResize))},i.prototype.getModuleName=function(){return"filter"},i.prototype.isInValidFilterRange=function(t,r){var n=c(o(r||t.selectedRange)),i=!1;return 0===t.usedRange.colIndex&&0===t.usedRange.rowIndex&&(0,e.isNullOrUndefined)(t.rows[t.usedRange.rowIndex])&&(i=!0),n[0]>t.usedRange.rowIndex||n[1]>t.usedRange.colIndex||i},i.prototype.filterRangeAlertHandler=function(e){var t=this;this.parent.serviceLocator.getService(Al).show({content:e.error,isModal:!0,height:180,width:400,showCloseIcon:!0,beforeOpen:function(e){var r={dialogName:"FilterRangeDialog",element:e.element,target:e.target,cancel:e.cancel};t.parent.trigger("dialogBeforeOpen",r),r.cancel?e.cancel=!0:Fd(t.parent.element)}}),this.parent.hideSpinner()},i.prototype.beforeFilterMenuOpenHandler=function(e){var t=this.parent.serviceLocator.getService(kl);e.element.classList.add("e-spreadsheet-contextmenu");var r=e.element.querySelector("ul");this.addMenuItem(r,t.getConstant("SortDescending"),"e-filter-sortdesc","e-sort-desc"),this.addMenuItem(r,t.getConstant("SortAscending"),"e-filter-sortasc","e-sort-asc"),e.element.appendChild(r)},i.prototype.addMenuItem=function(e,t,r,n){var i=this.parent.createElement("li",{className:r+" e-menu-item"});this.parent.allowSorting||i.classList.add("e-disabled"),i.innerText=t,i.insertBefore(this.parent.createElement("span",{className:"e-menu-icon e-icons "+n}),i.firstChild),e.insertBefore(i,e.firstChild)},i.prototype.initiateFilterUIHandler=function(e){var r,i=this,s=e?e.predicates:null,o=e.sIdx;o||0===o||(o=e.isOpen?0:this.parent.activeSheetIndex),e.promise&&(r=new br.Deferred,e.promise=r.promise);var l=function(){r&&r.resolve()},d=e.isInternal||e.isCut;if(this.filterRange.size>0&&this.filterRange.has(o)&&!this.parent.isOpen&&!s)return this.removeFilter(o,d,!1),void l();var h=In(this.parent,o);if(this.isInValidFilterRange(h,e.range)){var p=this.parent.serviceLocator.getService(kl);return this.filterRangeAlertHandler({error:p.getConstant("FilterOutOfRangeError")}),void l()}var c,u,f=e.range||h.selectedRange;if(!d){if(c={range:f,sheetIndex:o,cancel:!1,allowHeaderFilter:!1},e.predicates?(c.predicates=e.predicates,c.previousPredicates=this.filterCollection.get(o)&&[].slice.call(this.filterCollection.get(o))):c.filterOptions={predicates:e.predicates},c.useFilterRange=!1,u={action:"filter",eventArgs:c},this.parent.notify(K,u),c.cancel)return void l();delete c.cancel,e.useFilterRange=c.useFilterRange,e.allowHeaderFilter=c.allowHeaderFilter}if(e.range||!d&&f!==c.range)d||(f=c.range);else{var g=t(f);g[0]===g[2]&&g[1]===g[3]&&(f=a(g=Ur(g[0],g[1],h)),d||(c.range=f))}if(s){if(s.length){var m=this.filterRange.get(o);m&&(e.useFilterRange=m.useFilterRange,e.allowHeaderFilter=m.allowHeaderFilter),this.processRange(h,o,f,!0,e.useFilterRange,e.allowHeaderFilter);var v=this.filterRange.get(o).range.slice();e.allowHeaderFilter||(v[0]=v[0]+1),e.useFilterRange||(v[2]=h.usedRange.rowIndex),v[1]=v[3]=n(s[0].field);var y=h.name+"!"+this.getPredicateRange(v,s.slice(1,s.length)),C=a(v);return void ln(this.parent,y,!0,!0,null,!0,null,null,!1,C).then((function(t){i.filterSuccessHandler(new br.DataManager(t),{action:"filtering",filterCollection:s,field:s[0].field,sIdx:e.sIdx,isInternal:d,isOpen:e.isOpen,prevPredicates:c&&c.previousPredicates}),l()}))}this.clearFilterHandler({sheetIndex:o}),l()}else this.processRange(h,o,f,!1,e.useFilterRange,e.allowHeaderFilter),l();d||(this.parent.notify(ka,u),Fd(this.parent.element))},i.prototype.processRange=function(e,t,r,n,i,a){var s=c(o(r||e.selectedRange));s[0]===s[2]&&s[1]===s[3]?(s[0]=0,s[1]=0,s[2]=e.usedRange.rowIndex,s[3]=e.usedRange.colIndex):s[3]>e.usedRange.colIndex&&(s[3]=e.usedRange.colIndex);var l={useFilterRange:i,range:s};a&&(l.allowHeaderFilter=a),this.filterRange.set(t,l),this.filterCollection.set(t,[]),n||this.refreshFilterRange(s,!1,t)},i.prototype.removeFilter=function(e,t,r){var n,i=this.filterRange.get(e),s=i.range.slice(),o=i.allowHeaderFilter,l=a(s);if(!t){if(n={action:"filter",eventArgs:{range:l,sheetIndex:e,cancel:!1}},this.parent.notify(K,n),n.eventArgs.cancel)return;delete n.eventArgs.cancel}(this.filterCollection.get(e).length||r)&&this.clearFilterHandler({preventRefresh:r,sheetIndex:e}),this.filterRange.delete(e),this.filterCollection.delete(e),this.refreshFilterRange(s,!0,e,o),t||this.parent.notify(ka,n)},i.prototype.filterByCellValueHandler=function(){var e=this,r=this.parent.activeSheetIndex,n=this.parent.getActiveSheet();if(this.isInValidFilterRange(n)){var i=this.parent.serviceLocator.getService(kl);this.filterRangeAlertHandler({error:i.getConstant("FilterOutOfRangeError")})}else{var o,l=t(n.activeCell);this.isFilterRange(r,l[0],l[1])||(o=!0,this.processRange(n,r));var d=this.filterRange.get(r),h=d.range.slice(),p=a(h);h[0]=h[0]+1,h[2]=n.usedRange.rowIndex,h[1]=h[3]=l[1];var c=s(l[1]+1),u=Ln(l[0],l[1],n),f=dn(this.parent,u,l[0],l[1]),g=[{field:c,operator:"equal",type:this.getColumnType(n,l[1],l).type,matchCase:!1,value:f}],m=[].slice.call(this.filterCollection.get(r));m.length||(m=void 0);var v={range:p,predicates:g,previousPredicates:m,sheetIndex:r,cancel:!1,allowHeaderFilter:!1};if(this.parent.notify(K,{action:"filter",eventArgs:v}),v.cancel)o&&this.removeFilter(r,!0);else{v.allowHeaderFilter&&(d.allowHeaderFilter=v.allowHeaderFilter,h[0]--);var y=n.name+"!"+this.getPredicateRange(h,this.filterCollection.get(r)),C=a(h);ln(this.parent,y,!0,!0,null,!0,null,null,!1,C).then((function(t){e.filterSuccessHandler(new br.DataManager(t),{action:"filtering",filterCollection:g,field:c,isFilterByValue:!0})}))}}},i.prototype.renderFilterCellHandler=function(t){var r=(0,e.isNullOrUndefined)(t.sIdx)?this.parent.activeSheetIndex:t.sIdx;if(r===this.parent.activeSheetIndex){var n=this.filterRange.get(r)&&this.filterRange.get(r),i=n&&n.range;if(i&&(i[0]===t.rowIndex||n.allowHeaderFilter)&&i[1]<=t.colIndex&&i[3]>=t.colIndex){if(!t.td||t.td.classList.contains(n.allowHeaderFilter?"e-cell":"e-header-cell"))return;for(var a=t.td.querySelector(".e-filter-icon"),o="",l=this.parent.sortCollection,d=s(t.colIndex+1),h=this.filterCollection.get(r),p=0;p<h.length;p++)if(h[p].field===d){o=" e-filtered";break}if(l)for(p=0;p<l.length;p++)if(l[p].sheetIndex===r&&l[p].columnIndex===t.colIndex){o+="Ascending"===l[p].order?" e-sortasc-filter":" e-sortdesc-filter";break}if(a)a.className="e-btn-icon e-icons e-filter-icon"+o;else{var c=!1;if(a=this.filterBtn.cloneNode(!0),t.td.children.length>0&&t.td.children[t.td.childElementCount-1].className.indexOf("e-addNoteIndicator")>-1&&(t.td.removeChild(t.td.children[t.td.childElementCount-1]),c=!0),a.firstElementChild.className="e-btn-icon e-icons e-filter-icon"+o,t.td.insertBefore(a,t.td.firstChild),t.isAction){var u=In(this.parent,r);Ln(t.rowIndex,t.colIndex,u,!1,!0).wrap&&this.parent.notify(oo,{rowIdx:t.rowIndex,colIdx:t.colIndex,sheet:u,ele:t.td})}c&&this.parent.notify(da,{targetElement:t.td,rowIndex:t.rowIndex,columnIndex:t.colIndex})}}}},i.prototype.refreshFilterRange=function(e,t,r,n){var i=r;i||0===i||(i=this.parent.activeSheetIndex);var a=this.filterRange&&this.filterRange.get(i);a?(e=e||a.range.slice(),n=a.allowHeaderFilter):e||(e=[0,0,0,0]);for(var s,o=e,l=In(this.parent,i),d=this.parent.frozenColCount(l),h=o[1];h<=o[3];h++){if(n){var p=h<d?this.parent.sheetModule.getSelectAllTable():this.parent.getColHeaderTable(),c=p&&this.parent.getRow(0,p);s=c&&this.parent.getCell(0,h,c)}else s=cl(l,o[0])?null:this.parent.getCell(o[0],h);if(t){if(s){var u=s.querySelector(".e-filter-btn");if(u){var f=!1;s.children.length>0&&s.children[s.childElementCount-1].className.indexOf("e-addNoteIndicator")>-1&&(s.removeChild(s.children[s.childElementCount-1]),f=!0),u.parentElement.removeChild(u),f&&this.parent.notify(da,{targetElement:s,rowIndex:o[0],columnIndex:h})}}}else this.renderFilterCellHandler({td:s,rowIndex:o[0],colIndex:h,sIdx:i,isAction:!0})}this.parent.sortCollection&&this.parent.notify($,null)},i.prototype.isFilterCell=function(e,t,r){var n=this.filterRange.has(e)&&this.filterRange.get(e).range;return n&&n[0]===t&&n[1]<=r&&n[3]>=r},i.prototype.isFilterRange=function(e,t,r){var n=this.filterRange.get(e)&&this.filterRange.get(e).range;return n&&n[0]<=t&&n[2]>=t&&n[1]<=r&&n[3]>=r},i.prototype.getFilteredColumnHandler=function(t){var n=(0,e.isUndefined)(t.sheetIndex)?this.parent.activeSheetIndex:t.sheetIndex,i=this.parent.serviceLocator.getService(kl);if(t.clearFilterText=i.getConstant("ClearFilter"),this.filterRange.has(n)){var a=this.filterCollection.get(n);if(t.isClearAll)return void(t.isFiltered=a&&a.length>0);var o=this.filterRange.get(n).range.slice(),l=In(this.parent,n),d=r(l.activeCell);if(this.isFilterRange(n,d[0],d[1])){t.field=s(d[1]+1);var h=Ln(o[0],d[1],l),p=this.parent.getDisplayText(h);t.clearFilterText=i.getConstant("ClearFilterFrom")+'"'+(p?p.toString():"Column "+t.field)+'"',a.some((function(e){return t.isFiltered=e.field===t.field,t.isFiltered}))}}},i.prototype.cMenuBeforeOpenHandler=function(e){var t=this.parent.element.id+"_cmenu";if(e.parentItem&&e.parentItem.id===t+"_filter"&&""===e.target){var r={isFiltered:!1};this.getFilteredColumnHandler(r),this.parent.enableContextMenuItems([t+"_clearfilter",t+"_reapplyfilter"],!!r.isFiltered,!0)}},i.prototype.closeDialog=function(){var t=document.querySelector(".e-filter-popup");if(t&&t.id.includes(this.parent.element.id)){var r=(0,e.getComponent)(t,"dialog");e.EventHandler.remove(t,Zl(),this.filterMouseDownHandler),r&&r.hide(),this.parent.notify($h.filterDialogClose,null)}},i.prototype.removeFilterClass=function(){"relative"===this.parent.element.style.position&&(this.parent.element.style.position=""),this.parent.element.classList.contains("e-filter-open")&&this.parent.element.classList.remove("e-filter-open")},i.prototype.isPopupOpened=function(){var e=document.getElementsByClassName("e-filter-popup")[0];return e&&e.id.includes(this.parent.element.id)&&"none"!==e.style.display},i.prototype.filterCellKeyDownHandler=function(e){var t=r(this.parent.getActiveSheet().activeCell);if(this.isFilterCell(this.parent.activeSheetIndex,t[0],t[1]))if(e.closePopup)this.closeDialog();else if(e.isFilterCell=!0,!this.isPopupOpened()){var n=this.parent.getCell(t[0],t[1]);n&&this.openDialog(n)}},i.prototype.filterMouseDownHandler=function(t){if(!(e.Browser.isDevice&&"mousedown"===t.type||this.parent.getActiveSheet().isProtected)){var r=t.target;if(r.classList.contains("e-filter-icon")||r.classList.contains("e-filter-btn"))this.isPopupOpened()&&this.closeDialog(),this.openDialog((0,$h.parentsUntil)(r,"e-cell")||(0,$h.parentsUntil)(r,"e-header-cell"));else if(this.isPopupOpened()){var n=r.offsetParent;r.classList.contains("e-searchinput")||r.classList.contains("e-searchclear")||!n||n.classList.contains("e-filter-popup")||n.classList.contains("e-text-content")||n.classList.contains("e-checkboxtree")||n.classList.contains("e-checkbox-wrapper")?this.selectSortItemHandler(r):this.closeDialog()}}},i.prototype.cboxListSelected=function(t,r,n,i,a){var s=(0,$h.parentsUntil)(i.target,"e-ftrchk");if(s){var o=a&&s.querySelector(".e-add-current");if(o)return o.classList.contains("e-check")?((0,e.classList)(o,["e-uncheck"],["e-check"]),r.length||(t.btnObj.element.disabled=!0),!1):((0,e.classList)(o,["e-check"],["e-uncheck"]),t.btnObj.element.disabled=!1,!0);var l=s.querySelector(".e-selectall");if(l){s.querySelector(".e-chk-hidden").indeterminate=!1;for(var d=s.querySelector(".e-frame").classList.contains("e-check"),h=void 0,p=void 0,c=a?2:1,u=t.element.childElementCount;c<u;c++)h=t.element.children[c].querySelector(".e-frame"),(0,e.removeClass)([h],["e-check","e-stop","e-uncheck"]),d?(t.element.children[c].querySelector(".e-chk-hidden").checked=!1,h.classList.add("e-uncheck"),r.splice(0,1)):(t.element.children[c].querySelector(".e-chk-hidden").checked=!0,h.classList.add("e-check"),p=t.element.children[c].querySelector(".e-checkboxfiltertext").textContent,-1===r.indexOf(p)&&r.push(p))}else{p=s.querySelector(".e-checkboxfiltertext").textContent;s.querySelector(".e-frame").classList.contains("e-check")?r.splice(r.indexOf(p),1):r.push(p),(0,$h.toogleCheckbox)(s),l=t.element.querySelector(".e-selectall")}this.updateState(t,l,l.parentElement.querySelector(".e-chk-hidden"),r.length!==n,r.length)}return null},i.prototype.initCboxList=function(t,r,n){var i=this,a=t.column.field,s=new br.DataManager(t.dataSource).executeLocal((new br.Query).sortBy(a+"_value","ascending")),o=[],l=this.parent.getActiveSheet(),d=this.parent.serviceLocator.getService(kl),h=document.createDocumentFragment(),p=this.createSelectAll(t,r);h.appendChild(p);var c,u,f={},g=[],m=[];s.forEach((function(e){if(""===e[a]){if(!f.isBlank){f.isBlank=!0;var t={};t[a]=d.getConstant("Blanks"),c=ul(l,Number(e.__rowIndex)-1);var n=(0,$h.createCboxWithWrap)((0,$h.getUid)("cbox"),r.createCheckbox(t[a],!c,t),"e-ftrchk");1===h.childElementCount?h.appendChild(n):h.insertBefore(n,h.children[1]),o.splice(0,0,t[a]),c||(g.push(t[a]),m.push(t[a]))}}else f[e[a]]||(f[e[a]]=!0,c=ul(l,Number(e.__rowIndex)-1),u=e[a],h.appendChild((0,$h.createCboxWithWrap)((0,$h.getUid)("cbox"),r.createCheckbox(u,!c,e),"e-ftrchk")),o.push(u),c||(g.push(u),m.push(u)))})),t.element.appendChild(h);var v=p.querySelector(".e-frame");v.classList.add("e-selectall");var y=p.querySelector(".e-chk-hidden");this.updateState(t,v,y,m.length!==o.length,m.length);var C,b,x,S,w,I=[].slice.call(t.element.childNodes);t.element.addEventListener("click",(function(e){if(C){var r=i.cboxListSelected(t,C,t.element.childElementCount-2,e,!0);null!==r&&(x=r)}else i.cboxListSelected(t,m,o.length,e)}));var E,N=function(e){if(e.toLowerCase().includes(w)){var n={};n[t.column.field]=e,h.appendChild((0,$h.createCboxWithWrap)((0,$h.getUid)("cbox"),r.createCheckbox(e,!0,n),"e-ftrchk")),b.push(e),C.push(e)}},R=t.dataSource.length>1e3?t.dataSource.length:1e3,O=o;E=n.length<=R?function(){o.forEach((function(e){N(e)}))}:function(){S||(O=[],g=[],m=[],S=new br.DataManager(n).executeLocal((new br.Query).sortBy(a+"_value","ascending")),f={},S.forEach((function(e){""===e[a]?f.isBlank||(f.isBlank=!0,u=d.getConstant("Blanks"),O.splice(0,0,u),ul(l,Number(e.__rowIndex)-1)||(g.push(u),m.push(u))):f[e[a]]||(u=e[a],f[u]=!0,O.push(e[a]),ul(l,Number(e.__rowIndex)-1)||(m.push(u),g.push(u)))})));for(var e=0,t=O.length;e<t&&b.length<R;e++)N(O[e])};this.wireFilterEvents(t,(function(){if(b)if(x){var s=void 0,l=void 0;m=g;for(var h=0,p=b.length;h<p;h++)s=b[h],b.length===C.length||C.indexOf(s)>-1?-1===m.indexOf(s)&&m.push(s):(l=m.indexOf(s))>-1&&m.splice(l,1)}else m=C;var c=m.length;if(c===o.length&&(!C||n.length<=R))i.filterSuccessHandler(new br.DataManager(t.dataSource),{action:"clear-filter",field:t.column.field});else{var u=[],f={field:a,ignoreAccent:!1,matchCase:!1,isFilterByMenu:!0},v=(0,e.getNumericObject)(i.parent.locale),y=function(e){var r=t.type;"number"===r&&(e===d.getConstant("Blanks")?(e="",r="string"):rn(qr([e],i.parent,v)[0])||(r="string")),u.push(Object.assign({value:e,type:r},f))};if(c>O.length/2){f.operator="notequal",f.predicate="and";for(h=0,p=O.length;h<p;h++)-1===m.indexOf(O[h])&&y(O[h])}else{f.operator="equal",f.predicate="or";for(h=0,p=c;h<p;h++)y(m[h])}r.initiateFilter(u)}}),function(e){if("keyup"===e.event.type)w=e.event.target.value.toLowerCase();else if(e.event.target.classList.contains("e-search-icon"))return;if((h=document.createDocumentFragment()).appendChild(p),w)if(b=[],C=[],E(),C.length){i.updateState(t,v,y,!1,0),p.classList.remove("e-hide");var n={};n[a]=d.getConstant("AddCurrentSelection");var s=(0,$h.createCboxWithWrap)((0,$h.getUid)("cbox"),r.createCheckbox(n[a],!1,n),"e-ftrchk");h.insertBefore(s,h.children[1]),s.querySelector(".e-frame").classList.add("e-add-current")}else{p.classList.add("e-hide");var l=i.parent.createElement("div",{className:"e-checkfltrnmdiv"}),c=i.parent.createElement("span");c.innerText=d.getConstant("NoResult"),l.appendChild(c),h.appendChild(l),t.btnObj.element.disabled=!0}else I&&(C=null,b=null,i.updateState(t,v,y,m.length!==o.length,m.length),p.classList.remove("e-hide"),I.forEach((function(e){h.appendChild(e)})));t.element.innerHTML="",t.element.appendChild(h)}.bind(this))},i.prototype.createSelectAll=function(e,t){var r={};return r[e.column.field]=this.parent.serviceLocator.getService(kl).getConstant("SelectAll"),(0,$h.createCboxWithWrap)((0,$h.getUid)("cbox"),t.createCheckbox(r[e.column.field],!1,r),"e-ftrchk")},i.prototype.updateState=function(t,r,n,i,a){if((0,e.removeClass)([r],["e-check","e-stop","e-uncheck"]),t.btnObj.element.disabled&&(t.btnObj.element.disabled=!1),i)if(a)r.classList.add("e-stop");else{r.classList.add("e-uncheck");var s=t.element.querySelector(".e-add-current");t.btnObj.element.disabled=!s||!s.classList.contains("e-check")}else r.classList.add("e-check");n.indeterminate=i,n.checked=!i},i.prototype.beforeFilteringHandler=function(t){var r=this;if(t.instance&&t.instance.options){if(t.isOpen&&"string"===t.instance.options.type){var n=(0,e.getNumericObject)(this.parent.locale);if("."!==n.decimal){var i=t.arg3.toString().split(".");if(2===i.length){var a=i.join(n.decimal);rn(new e.Internationalization(this.parent.locale).parseNumber(a,{format:"n"}))&&(t.arg3=a)}}}var s=function(t,n){if(n&&("notequal"===n||r.isCustomNumFilter(n)))if(t){if(rn(t))t=parseFloat(t.toString());else if("string"==typeof t){var i=(0,e.getNumericObject)(r.parent.locale),a=new e.Internationalization(r.parent.locale),o={};if(t.includes(i.percentSign)){var l=t.trim().split("%");""===l[0]||l[1]||(o=yr({value:l[0]},r.parent.locale,i.group,i.decimal))}if(o.isNumber)t=Number(o.value)/100;else{var d=a.parseNumber(t.trim(),{format:"n"});if(rn(d))t=d;else{var h=t.trim(),p={value:h,cell:{value:h}};r.parent.notify(ue,p),(p.isTime||p.isDate)&&(t=parseFloat(p.updatedVal))}}}}else"notequal"===n&&null===t&&(t="");else"equal"===n&&(rn(t)?t=t.toString():"string"==typeof t&&rn(s(t,"notequal"))?t=t.trim():null===t&&(t=""));return t};if("date"!==t.instance.options.type)t.arg3=s(t.arg3,t.arg2),t.arg8=s(t.arg8,t.arg7);else if("yMd"===t.instance.options.format){var o=function(e,n){if(e)if("string"==typeof e){var i=e.trim(),a={value:i,cell:{value:i}};if(r.parent.notify(ue,a),a.isDate)e="equal"===n?a.dateObj:parseFloat(a.updatedVal);else if("equal"===n||"notequal"===n){var o=s(e,"notequal");rn(o)?(t.instance.options.type="number","notequal"===n&&(e=o)):t.instance.options.type="string"}}else tn(e)&&"equal"!==n&&(e=en(e,!0));return e},l=document.querySelectorAll(".e-xlfl-valuediv input.e-datepicker");2===l.length?(t.arg3=o(t.arg3||l[0].value,t.arg2),t.arg8=o(t.arg8||l[1].value,t.arg7)):t.arg3&&(t.arg3=o(t.arg3,t.arg2))}}},i.prototype.customFilterOpen=function(t){for(var r=document.querySelectorAll(".e-xlfl-optrdiv input.e-dropdownlist"),n=[],i=0;i<r.length;i++){var a=(0,e.getComponent)(r[i],"dropdownlist");a&&n.push(a.value)}var s=[];if(2===n.length){var o=this.filterCollection.get(this.parent.activeSheetIndex),l=void 0;for(i=0;i<o.length;i++)o[i].field===t.column&&null!==o[i].value&&(l=n.indexOf(o[i].operator))>-1&&("equal"===o[i].operator&&tn(o[i].value)?s[l]=en(o[i].value,!0).toString():s[l]=o[i].value.toString(),n[l]="")}var d=(0,e.getNumericObject)(this.parent.locale),h=function(e){if("."!==d.decimal&&rn(e)){var t=e.toString();if(t.includes("."))return t.replace(".",d.decimal)}return e},p=document.querySelectorAll(".e-xlfl-valuediv input.e-ss-filter-input");if(p.length)for(i=0;i<p.length;i++){var c=new Ch.TextBox({placeholder:this.parent.serviceLocator.getService(kl).getConstant("CustomFilterPlaceHolder")});s[i]&&(c.value=h(s[i])),c.appendTo(p[i])}else{var u=document.querySelectorAll(".e-xlfl-valuediv input.e-datepicker"),f=void 0,g=void 0;for(i=0;i<u.length;i++)g=rn(s[i])?this.parent.getDisplayText({value:s[i],format:Mo("ShortDate")+(s[i].includes(".")?" "+Mo("Time"):"")}):h(s[i]),(f=(0,e.getComponent)(u[i],"datepicker"))&&(f.value=g,u[i].value=g)}},i.prototype.wireFilterEvents=function(e,t,r){var n=this;e.btnObj.element.addEventListener("click",t.bind(this)),e.searchBox.addEventListener("keydown",(function(e){13===e.keyCode&&t()}));var i=function(){n.parent.off(no,r),n.parent.off($h.filterDialogClose,i),Fd(n.parent.element)};this.parent.on($h.filterDialogClose,i,this),this.parent.on(no,r,this)},i.prototype.initTreeView=function(e,t){var r,n,i,a,s,o,l,d,h=this,p=[],c=[],u={},f=[],g=[],m=[],v=[],y=["January","February","March","April","May","June","July","August","September","October","November","December"],C=!1,b=this.parent.getActiveSheet(),x=function(e){u[""+o]=!0,ul(b,Number(e.__rowIndex)-1)?C=!0:p.push(o),c.push(o)};e.dataSource.forEach((function(t){"object"==typeof(a=t[e.column.field])&&Date.parse(a.toString())?(r=a.getFullYear().toString(),u[""+r]||((d={__rowIndex:r,hasChild:!0})[e.column.field]=r,f.push(d),u[""+r]=!0),l=a.getMonth(),u[""+(s=r+" "+(n=y[l]))]||((d={__rowIndex:s,pId:r,hasChild:!0,month:l})[e.column.field]=n,g.push(d),u[""+s]=!0),i=a.getDate(),o=s+" "+i.toString(),u[""+o]||((d={__rowIndex:o,pId:s})[e.column.field]=i,m.push(d),x(t))):(t[e.column.field]||0===t[e.column.field]?(o="text "+t[e.column.field].toString().toLowerCase(),r=t[e.column.field]):(o="blanks",r=h.parent.serviceLocator.getService(kl).getConstant("Blanks")),u[""+o]||((d={__rowIndex:o})[e.column.field]=r,v.push(d),x(t)))})),f=new br.DataManager(f).executeLocal((new br.Query).sortBy(e.column.field,"decending")),g=new br.DataManager(g).executeLocal((new br.Query).sortBy("month","ascending")),m=new br.DataManager(m).executeLocal((new br.Query).sortBy(e.column.field,"ascending")),m=f.concat(g.concat(m)),v.length&&(v=new br.DataManager(v).executeLocal((new br.Query).sortBy(e.column.field,"ascending")),m=m.concat(v));var S=function(e){var t=[e.node];(e.event.target.classList.contains("e-fullrow")||"Enter"===e.event.key)&&("true"===R.getNode(e.node).isChecked?R.uncheckAll(t):R.checkAll(t))},w=this.createSelectAll(e,t);w.addEventListener("click",function(){E.indeterminate=!1,I.classList.contains("e-check")?(R.uncheckAll(),I.classList.add("e-uncheck"),E.checked=!1):(R.checkAll(),I.classList.add("e-check"),E.checked=!0)}.bind(this)),w.classList.add("e-spreadsheet-ftrchk");var I=w.querySelector(".e-frame");I.classList.add("e-selectall"),e.element.appendChild(w);var E=w.querySelector(".e-chk-hidden"),N=this.parent.createElement("div"),R=new ch.TreeView({fields:{dataSource:m,id:"__rowIndex",parentID:"pId",text:e.column.field,hasChildren:"hasChild"},enableRtl:this.parent.enableRtl,showCheckBox:!0,cssClass:"e-checkboxtree",checkedNodes:p,nodeClicked:S.bind(this),keyPress:S.bind(this),nodeChecked:function(t){"indeterminate"!==t.action&&(C=R.checkedNodes.length!==R.fields.dataSource.length,h.updateState(e,I,E,C,R.checkedNodes.length))}});R.createElement=this.parent.createElement,R.appendTo(N),e.element.appendChild(N),p=R.checkedNodes,this.updateState(e,I,E,C,R.checkedNodes.length);this.treeViewObj=R,this.treeViewEle=N,this.cBox=E,this.wireFilterEvents(e,(function(){R.checkedNodes.length===m.length?h.filterSuccessHandler(new br.DataManager(e.dataSource),{action:"clear-filter",field:e.column.field}):h.generatePredicate(R.checkedNodes,v.length?"string":e.type,e.column.field,t,c,R.checkedNodes.length>m.length/2)}),this.refreshCheckbox.bind(this,m,R,p))},i.prototype.generatePredicate=function(e,t,r,n,i,a){var s,o,l,d,h,p=[],c={January:0,February:1,March:2,April:3,May:4,June:5,July:6,August:7,September:8,October:9,November:10,December:11},u=function(){"blanks"===o[0]?p.push(Object.assign({value:"",type:t},s)):"text"===o[0]&&(o.splice(0,1),d=o.join(" "),isNaN(Number(d))?h="string":(d=Number(d),h="number"),p.push(Object.assign({value:d,type:h},s)))},f=function(){(l=new Date(Number(o[0]),c[o[1]],Number(o[2]))).getDate()?p.push(Object.assign({value:l,type:t},s)):u()};if(a){s={field:r,ignoreAccent:!1,matchCase:!1,predicate:"and",operator:"notequal",isFilterByMenu:!0};for(var g=0,m=i.length;g<m;g++)-1===e.indexOf(i[g])&&(o=i[g].split(" "),f())}else{s={field:r,ignoreAccent:!1,matchCase:!1,predicate:"or",operator:"equal",isFilterByMenu:!0};for(g=0,m=e.length;g<m;g++)3===(o=e[g].split(" ")).length?f():u()}n.initiateFilter(p)},i.prototype.refreshCheckbox=function(t,r,n,i){var a,s;if("keyup"===i.event.type)a=i.event.target.value;else if(i.event.target.classList.contains("e-search-icon"))return;var o=function(){if(s.length&&!r.fields.dataSource.length){var t=r.element.parentElement;t.getElementsByClassName("e-spreadsheet-ftrchk")[0].classList.remove("e-hide"),(0,e.detach)(t.getElementsByClassName("e-checkfltrnmdiv")[0])}r.fields.dataSource=s,r.dataBind()};if(a){s=new br.DataManager(t).executeLocal((new br.Query).where(new br.Predicate(r.fields.text,"contains",a,!0)));var l={},d=[],h=void 0,p=void 0,c=void 0,u=void 0;if(isNaN(Number(a))){for(var f=0;f<s.length;f++)s[f].hasChild&&(d.push(new br.Predicate("pId","equal",s[f].__rowIndex,!1)),l[""+(h=s[f].pId)]||(d.push(new br.Predicate("__rowIndex","equal",h,!1)),l[""+h]=!0));p=s,u=1}else{var g=void 0,m={};c=[];for(f=0;f<s.length;f++)(h=s[f].pId)?(g=h.split(" ")[0],l[""+h]||(d.push(new br.Predicate("__rowIndex","equal",h,!1)),l[""+h]=!0,c.push(g),c.push(h)),m[""+g]||(l[""+g]||(d.push(new br.Predicate("__rowIndex","equal",g,!1)),l[""+g]=!0),d.push(new br.Predicate("__rowIndex","equal",s[f].__rowIndex,!1)))):m[""+(h=s[f].__rowIndex)]||(d.push(new br.Predicate("__rowIndex","contains",h,!1)),m[""+h]=!0);p=[]}if(s.length){d.length&&(s=p.concat(new br.DataManager(t).executeLocal((new br.Query).where(br.Predicate.or(d))))),o(),r.checkAll();var v=r.animation.expand.duration;r.animation.expand.duration=0,r.expandAll(c,u),r.animation.expand.duration=v}else if(r.fields.dataSource.length){o();var y=r.element.parentElement;y.getElementsByClassName("e-spreadsheet-ftrchk")[0].classList.add("e-hide");var C=this.parent.createElement("div",{className:"e-checkfltrnmdiv"}),b=this.parent.createElement("span");b.innerText=this.parent.serviceLocator.getService(kl).getConstant("NoResult"),C.appendChild(b),y.appendChild(C)}}else s=t,o(),r.checkedNodes=n,r.refresh()},i.prototype.openDialog=function(t){var r=this,n=parseInt(t.getAttribute("aria-colindex"),10),i=s(n);this.parent.showSpinner();var o=this.parent.activeSheetIndex,l=this.filterRange.get(o),d=l.range.slice(),h=this.parent.getActiveSheet(),p=Ln(d[0],n-1,h),c=this.parent.getDisplayText(p);l.allowHeaderFilter||(d[0]=d[0]+1),l.useFilterRange||(d[2]=h.usedRange.rowIndex);var u,f=[d[0],n-1,d[2],n-1],g=this.getPredicateRange(f,this.filterCollection.get(o),n-1),m=g.otherColPredicate,v=g.curPredicate;v.length&&((u={})[i]=v);var y,C=h.name+"!"+g.address,b=a(f),x=this.getColumnType(h,n-1,d),S=x.type,w="date"===S||x.isDateAvail,I="number"===S,E=w||I,N=x.isMultiFormattedCol;E&&!g.filteredCol&&(y=[]),ln(this.parent,C,!0,!0,null,!0,null,null,!0,b,null,y).then((function(n){var a,s;if(r.parent.element.style.position="relative",r.parent.element.classList.add("e-filter-open"),E){if(y||!m.length)a=new br.DataManager(y||n);else{var o=r.getPredicates(m),l=Kr(new br.DataManager(n),o.predicates,o.equalOrPredicates);a=new br.DataManager(l)}var d=function(e){r.parent.off(ro,d),e.isCheckboxFilterTemplate=!0,w?r.initTreeView(e,b):r.initCboxList(e,b,n)};r.parent.on(ro,d,r),s=[]}else{if(m.length){var h=r.getPredicates(m);l=Kr(new br.DataManager(n),h.predicates,h.equalOrPredicates);a=new br.DataManager(l)}else a=new br.DataManager(n);s=r.getClonedPredicates(v)}var p=t.querySelector(".e-filter-btn"),f={field:i,filter:{}};if(I){var g=r.parent;f.filterTemplate=function(e){if(!g.isReact||!e)return[g.createElement("input",{className:"e-ss-filter-input"})];e.appendChild(g.createElement("input",{className:"e-ss-filter-input"}))};f.getFilterTemplate=function(){return e=f.filterTemplate,function(t,r,n,i,a,s,o){return e(o)};var e},g.isReact&&!g.renderTemplates&&(g.renderTemplates=function(e){return e()})}var C={type:S,field:i,format:"date"===S?"yMd":null,displayName:c||"Column "+i,dataSource:a||[],height:r.parent.element.classList.contains("e-bigger")?800:500,columns:[],hideSearchbox:!1,filteredColumns:s,column:f,handler:r.filterSuccessHandler.bind(r,new br.DataManager(n)),target:p,position:{X:0,Y:0},localeObj:r.parent.serviceLocator.getService(kl),actualPredicate:u,isFormatted:E&&!w,isMultiFormattedCol:N},b=new $h.ExcelFilterBase(r.parent,r.getLocalizedCustomOperators());b.openDialog(C);var x=document.querySelector(".e-filter-popup");if(x&&x.id.includes(r.parent.element.id)){e.EventHandler.add(x,Zl(),r.filterMouseDownHandler,r);var R=r.parent.element.getBoundingClientRect(),O=p.getBoundingClientRect(),k=x.getBoundingClientRect(),A=O.right-R.left-k.width;A<0&&(A=O.left-R.left),x.style.left=A*r.parent.viewport.scaleX+"px",x.style.top="0px",x.style.visibility="hidden",x.classList.contains("e-hide")&&x.classList.remove("e-hide");var F=O.bottom-R.top;k.height-(R.bottom-O.bottom)>0&&(F-=k.height-(R.bottom-O.bottom))<0&&(F=0),x.style.top=F*r.parent.viewport.scaleY+"px",x.style.visibility=""}r.parent.hideSpinner()}))},i.prototype.getPredicateRange=function(e,t,r){var i,s,o,l=a(e),d=[],h=[];t&&t.length?t.forEach((function(t){t.field&&(s=""+t.field+(e[0]+1)+":"+t.field+(e[2]+1),o=n(t.field),l.includes(s)||(l+=","+s,o<e[1]&&(e[1]=o),o>e[3]&&(e[3]=o)),void 0!==r&&(o===r?(i=!0,h.push(t)):d.push(t)))})):i=!0;return void 0===r?l:{address:l,filteredCol:i,otherColPredicate:d,curPredicate:h}},i.prototype.filterDialogCreatedHandler=function(){var e=document.querySelector(".e-filter-popup");e&&e.id.includes(this.parent.element.id)&&e.classList.contains("e-popup-close")&&e.classList.add("e-hide")},i.prototype.filterCboxValueHandler=function(e){if(e.column&&e.data){var t=e.column.field;if(e.value){var n=r(t+e.data.dataObj.__rowIndex),i=Ln(n[0],n[1],this.parent.getActiveSheet());i&&i.format&&(e.value=this.parent.getDisplayText(i))}}},i.prototype.selectSortItemHandler=function(e){var t=this.parent.serviceLocator.getService(kl),r=e.classList.contains("e-filter-sortasc")?"Ascending":e.classList.contains("e-filter-sortdesc")?"Descending":null;if("Ascending"===r?e.setAttribute("aria-label",t.getConstant("SortAscending")):e.setAttribute("aria-label",t.getConstant("SortDescending")),r){var n=this.parent.getActiveSheet(),i=this.parent.activeSheetIndex,s=this.filterRange.get(i),l=s.range.slice();if(s.allowHeaderFilter||(l[0]=l[0]+1),s.useFilterRange||(l[2]=n.usedRange.rowIndex),zd(this.parent,l))return this.closeDialog(),void this.parent.notify(Ka,null);this.parent.sortCollection=this.parent.sortCollection?this.parent.sortCollection:[];for(var d=[],h=this.parent.sortCollection.length-1;h>=0;h--)this.parent.sortCollection[h]&&this.parent.sortCollection[h].sheetIndex===i&&(d.push(this.parent.sortCollection[h]),this.parent.sortCollection.splice(h,1));this.parent.sortCollection.push({sortRange:a(l),columnIndex:o(n.activeCell)[1],order:r,sheetIndex:i}),this.parent.notify(Zi,{sortOptions:{sortDescriptors:{order:r},containsHeader:!1},previousSort:d,range:a(l)}),this.refreshFilterRange(),this.closeDialog()}},i.prototype.filterSuccessHandler=function(e,t){var r=t.sIdx;r||0===r||(r=t.isOpen?0:this.parent.activeSheetIndex);var n=t.prevPredicates||[].slice.call(this.filterCollection.get(r));t.isFilterByValue&&!n.length&&(n=void 0);var i=this.filterCollection.get(r);if(this.updatePredicate(i,t.field),"clear-filter"!==t.action||i.length!==n.length){"filtering"===t.action&&(i=i.concat(t.filterCollection)),this.filterCollection.set(r,i);var s=this.getPredicates(i),o={datasource:e,predicates:s.predicates,equalOrPredicates:s.equalOrPredicates},l=this.filterRange.get(r);l.useFilterRange||(l.range[2]=In(this.parent,r).usedRange.rowIndex),this.applyFilter(o,a(l.range),r,n,!1,t.isInternal,t.isFilterByValue)}},i.prototype.isCustomNumFilter=function(e){return e.includes("greaterthan")||e.includes("lessthan")||"between"===e},i.prototype.getClonedPredicates=function(e,t){void 0===t&&(t=[]);for(var r,n,i=[],a=0;a<e.length;a++)r=e[a],(this.isCustomNumFilter(r.operator)||!r.isFilterByMenu&&"notequal"===r.operator)&&rn(r.value)?(i.push(Object.assign({},r,{field:r.field+"_value",type:"number"})),n=!0):(r.isFilterByMenu||"equal"!==r.operator||"or"!==r.predicate||t.push(r.field),i.push(r));return!n&&t.length&&t.splice(0),i},i.prototype.updatePredicate=function(e,t){for(var r=new br.DataManager(e),n=new br.Query,i=r.executeLocal(n.where("field","equal",t)),a=0;a<i.length;a++){for(var s=-1,o=0;o<e.length;o++)if(e[o].field===i[a].field){s=o;break}-1!==s&&e.splice(s,1)}},i.prototype.applyFilter=function(e,t,r,n,i,a,s){var o=this,l={range:t,predicates:[].slice.call(this.filterCollection.get(r)),previousPredicates:n,sheetIndex:r,cancel:!1};if(a||s||(this.parent.notify(K,{action:"filter",eventArgs:l}),!l.cancel)){t.indexOf("!")<0&&(t=this.parent.sheets[r].name+"!"+t),this.parent.showSpinner();var d={args:{range:t,filterOptions:e},promise:new Promise((function(e){e(void 0)})),refresh:i},h=Vd(this.parent);this.parent.notify(_e,d);var p=Vd(this.parent);this.parent.notify(Is,{prevChartIndexes:h,currentChartIndexes:p}),d.promise.then((function(e){return o.refreshFilterRange(),o.parent.hideSpinner(),a||(delete l.cancel,o.parent.notify(ka,{action:"filter",eventArgs:l}),document.activeElement.id!==o.parent.element.id+"_SearchBox"&&Fd(o.parent.element)),Promise.resolve(e)})).catch((function(e){return o.filterRangeAlertHandler({error:e}),Promise.reject(e)}))}},i.prototype.getPredicates=function(e){var t,r=[],n=this.getClonedPredicates(e,r);if(r.length){for(var i,a=void 0,s=void 0,o=new Map,l=0;l<n.length;l++)a=n[l].field.replace("_value",""),r.indexOf(a)>-1&&(s=n.splice(l,1)[0],l--,o.has(a)?o.get(a).push(s):o.set(a,[s]));t=[],o.forEach((function(e){i=[];for(var r=$h.CheckBoxFilterBase.getPredicate(e),n=0,a=Object.keys(r);n<a.length;n++){var s=a[n];i.push(r[""+s])}t.push(i)}))}for(var d=[],h=$h.CheckBoxFilterBase.getPredicate(n),p=0,c=Object.keys(h);p<c.length;p++){var u=c[p];d.push(h[""+u])}return{predicates:d,equalOrPredicates:t}},i.prototype.getColumnType=function(e,t,r){for(var n,i,a,s,o=0,l=0,d=0,h=r[0];h<=r[2];h++)if(n=Ln(h,t,e)){if(n.format&&"General"!==n.format){switch(Bo(n.format).toLowerCase()){case"number":case"currency":case"accounting":case"percentage":case"time":o++;break;case"shortdate":case"longdate":d++;break;case"text":l++;break;default:i={},Vn(n.format,!0,i)?"date"===i.type?d++:o++:rn(n.value)?o++:n.value&&l++}a||(a=n.format)}else rn(n.value)?o++:n.value&&l++;a&&a!==n.format&&(s=!0)}return{type:o>l&&o>d&&o>0?"number":l>=o&&l>=d&&l>=0?"string":d>o&&d>l&&d>0?"date":"datetime",isDateAvail:!!d,isMultiFormattedCol:s}},i.prototype.clearFilterHandler=function(t){var r=t&&!(0,e.isNullOrUndefined)(t.sheetIndex)?t.sheetIndex:this.parent.activeSheetIndex;if(t&&t.field){var n=[].slice.call(this.filterCollection.get(r));n&&n.length&&(this.updatePredicate(n,t.field),this.initiateFilterUIHandler({predicates:n,range:a(this.filterRange.get(r).range),sIdx:r}))}else{var i=t&&t.isAction,s={isFiltered:!1,isClearAll:!0,sheetIndex:r};if(this.getFilteredColumnHandler(s),s.isFiltered||t&&t.preventRefresh){var o=void 0,l=In(this.parent,r),d=this.filterRange.get(r),h=d.range;if(i&&(o={range:a(h),predicates:[],previousPredicates:this.filterCollection.get(r),sheetIndex:r,cancel:!1},this.parent.notify(K,{action:"filter",eventArgs:o}),o.cancel))return;this.filterCollection.set(r,[]);var p=d.useFilterRange?h[2]:l.usedRange.rowIndex;if(this.parent.scrollSettings.enableVirtualization&&p-h[0]+1>this.parent.viewport.rowCount+2*this.parent.getThreshold("row")){for(var c=0;c<=p;c++)pl(l,c,{hidden:!1,isFiltered:!1});t&&t.preventRefresh||this.parent.renderModule.refreshSheet(!1,!1,!0)}else{this.refreshFilterRange(null,null,r);var u={startIndex:h[0],hide:!1,isFiltering:!0,refreshUI:!1,endIndex:d.useFilterRange?h[2]:l.usedRange.rowIndex,sheetIndex:r};this.parent.notify(Rt,u),!u.refreshUI||t&&t.preventRefresh||this.parent.renderModule.refreshSheet(!1,!1,!0)}i&&(delete o.cancel,this.parent.notify(ka,{action:"filter",eventArgs:o}),Fd(this.parent.element))}}},i.prototype.reapplyFilterHandler=function(e,t){var r=this,i=this.parent.activeSheetIndex;if(this.filterRange.has(i)){var s=this.filterCollection.get(i);if(s&&s.length){var o=In(this.parent,i),l=this.filterRange.get(i),d=l.range.slice();l.allowHeaderFilter||(d[0]=d[0]+1),l.useFilterRange||(d[2]=o.usedRange.rowIndex),d[1]=d[3]=n(s[0].field);var h=o.name+"!"+this.getPredicateRange(d,s.slice(1,s.length));ln(this.parent,h,!0,!0,null,!0,null,null,!1,a(d)).then((function(n){var o=r.getPredicates(r.filterCollection.get(i));r.applyFilter({predicates:o.predicates,datasource:new br.DataManager(n),equalOrPredicates:o.equalOrPredicates},a(l.range),i,[].slice.call(s),t,e)}))}}},i.prototype.getFilterRangeHandler=function(t){var r=(0,e.isNullOrUndefined)(t.sheetIdx)?this.parent.activeSheetIndex:t.sheetIdx,n=this.filterRange&&this.filterRange.get(r);n?(t.hasFilter=!0,t.filterRange=n.range,t.allowHeaderFilter=n.allowHeaderFilter,t.isFiltered=this.filterCollection&&this.filterCollection.get(r)&&this.filterCollection.get(r).length>0):(t.hasFilter=!1,t.filterRange=null)},i.prototype.getLocalizedCustomOperators=function(){var e=this.parent.serviceLocator.getService(kl),t=[{value:"equal",text:e.getConstant("Equal")},{value:"greaterthan",text:e.getConstant("GreaterThan")},{value:"greaterthanorequal",text:e.getConstant("GreaterThanOrEqual")},{value:"lessthan",text:e.getConstant("LessThan")},{value:"lessthanorequal",text:e.getConstant("LessThanOrEqual")},{value:"notequal",text:e.getConstant("NotEqual")}];return{stringOperator:[{value:"startswith",text:e.getConstant("StartsWith")},{value:"endswith",text:e.getConstant("EndsWith")},{value:"contains",text:e.getConstant("Contains")},{value:"equal",text:e.getConstant("Equal")},{value:"isempty",text:e.getConstant("IsEmpty")},{value:"doesnotstartwith",text:e.getConstant("NotStartsWith")},{value:"doesnotendwith",text:e.getConstant("NotEndsWith")},{value:"doesnotcontain",text:e.getConstant("NotContains")},{value:"notequal",text:e.getConstant("NotEqual")},{value:"isnotempty",text:e.getConstant("IsNotEmpty")}],numberOperator:t,dateOperator:t,datetimeOperator:t,booleanOperator:[{value:"equal",text:e.getConstant("Equal")},{value:"notequal",text:e.getConstant("NotEqual")}]}},i.prototype.setFilteredCollection=function(t){var r=this,i={sheetIdx:t.sheetIdx};if(this.getFilterRangeHandler(i),i.hasFilter){var s={sheetIndex:t.sheetIdx,filterRange:a(i.filterRange),hasFilter:!0,column:[],criteria:[],value:[],dataType:[],predicates:[]};t.saveJson.filterCollection.push(s);for(var o,l=this.filterCollection.get(t.sheetIdx),d=new Map,h=void 0,p=function(r){if((0,e.isNullOrUndefined)(r))return"";if(t.isSaveAction&&"date"===o){var n=r;r=n.getMonth()+1+"/"+n.getDate()+"/"+n.getFullYear()+" "+n.getHours()+":"+n.getMinutes()+":"+n.getSeconds()}return r},c=0;c<l.length;c++)h=l[c],t.isSaveAction&&"notequal"===h.operator&&h.isFilterByMenu?d.has(h.field)?d.get(h.field).push(h):d.set(h.field,[h]):(s.column.push(n(h.field)),s.criteria.push(h.operator),t.isSaveAction?"equal"===h.operator?(o=tn(h.value)?"date":"string",s.value.push(p(h.value)),s.dataType.push(o)):(s.value.push(h.value),s.dataType.push("custom")):(s.value.push(h.value),s.dataType.push(h.type)),s.predicates.push(h.predicate));var u,f=new Map;d.forEach((function(e,i){u=n(i),f.has(i)||f.set(i,r.getColData(u,i,t.sheetIdx));for(var a=f.get(i),l=r.getPredicates(e).predicates,d=new br.DataManager(a).executeLocal((new br.Query).where(br.Predicate.and(l))),h=0;h<d.length;h++)s.column.push(u),s.criteria.push("equal"),o=tn(d[h][i])?"date":"string",s.value.push(p(d[h][i])),s.dataType.push(o),s.predicates.push("or")}))}},i.prototype.updateFilter=function(e){if(this.parent.filterCollection&&(e.initLoad||e.isOpen)){for(var t=void 0,r=void 0,n=void 0,i={},a=void 0,o=void 0,l=void 0,d=0;d<this.parent.filterCollection.length;d++){var h=(n=this.parent.filterCollection[d]).sheetIndex;if(0!==d||this.parent.isOpen||e.isOpen||(h=0),r=[],n.column)for(var p=0;p<n.column.length;p++)if(o={field:s(n.column[p]+1),operator:this.getFilterOperator(n.criteria[p]),value:"string"==typeof n.value[p]?n.value[p].split("*").join(""):n.value[p],predicate:n.predicates&&n.predicates[p],type:n.dataType&&n.dataType[p]},["year","month","day"].indexOf(o.type)>-1){var c={value:o.value,cell:{value:o.value}};if(this.parent.notify(ue,c),c.isDate){var u=c.dateObj;if(o.value=u,"day"===o.type)o.type="date",o.predicate="or",r.push(o);else{o.operator="greaterthanorequal",o.predicate="and";var f=o.type;o.type="date",t=this.getPredicates([o,{field:o.field,operator:"lessthanorequal",predicate:"and",type:"date",value:new Date(u.getFullYear(),"year"===f?12:u.getMonth()+1,0,0,0,0)}]).predicates,i[o.field]||(i[o.field]=this.getColData(n.column[p],o.field,d)),a=new br.DataManager(i[o.field]).executeLocal((new br.Query).where(br.Predicate.and(t)));for(var g=0;g<a.length;g++)r.push({field:o.field,operator:"equal",predicate:"or",type:"date",value:a[g][o.field]})}}}else{if(l={isOpen:!0,instance:{options:{type:o.type}},arg3:o.value,arg2:o.operator},this.beforeFilteringHandler(l),o.value=l.arg3,"string"===o.type||"custom"===o.type)this.isCustomNumFilter(o.operator)&&rn(o.value)&&(o.type="number");else if("date"===o.type&&"equal"===o.operator&&"string"==typeof o.value&&o.value.includes("/")&&o.value.includes(":")){var m=o.value.split(" ");if(2===m.length){var v=m[0].split("/"),y=m[1].split(":");3===v.length&&3===y.length&&(o.value=new Date(Number(v[2]),Number(v[0])-1,Number(v[1]),Number(y[0]),Number(y[1]),Number(y[2])))}}r.push(o)}if(!e.isOpen)for(var C=0;C<r.length-1;C++)r[C].field===r[C+1].field&&(r[C].predicate||(r[C].predicate="or"),r[C+1].predicate||(r[C+1].predicate="or"));this.parent.notify(xa,{predicates:r.length?r:void 0,range:n.filterRange,sIdx:h,isInternal:!0,isOpen:e.isOpen})}this.parent.sortCollection&&this.parent.notify($,null),this.parent.setProperties({filterCollection:null},!0)}},i.prototype.getColData=function(e,t,r){var n=In(this.parent,r);if(!n.rows||!n.rows.length)return[];for(var i,a,s=[],o=1,l=n.rows.length;o<l;o++)n.rows[o]&&(a=Ln(o,e,n,!1,!0))&&a.value&&((i={})[t]=dn(this.parent,a,o,e),s.push(i));return s},i.prototype.getFilterOperator=function(e){switch(e){case"BeginsWith":e="startswith";break;case"Less":e="lessthan";break;case"EndsWith":e="endswith";break;case"Equal":e="equal";break;case"Notequal":e="notEqual";break;case"Greater":e="greaterthan";break;case"Contains":e="contains";break;case"LessOrEqual":e="lessthanorequal";break;case"GreaterOrEqual":e="greaterthanorequal";break;case"NotContains":e="doesnotcontain";break;case"NotBeginsWith":e="doesnotstartwith";break;case"NotEndsWith":e="doesnotendwith";break;case"Empty":e="isempty";break;case"NotEmpty":e="isnotempty"}return e},i.prototype.beforeInsertHandler=function(t){if("Column"===t.modelType){var r=(0,e.isUndefined)(t.activeSheetIndex)?this.parent.activeSheetIndex:t.activeSheetIndex;if(this.filterRange.size&&this.filterRange.has(r)){var i=this.filterRange.get(r).range;(this.isFilterCell(r,i[0],t.index)||t.index<i[1])&&(i[3]+=t.model.length,t.index<=i[1]&&(i[1]+=t.model.length),this.filterCollection.get(r).forEach((function(e){var r=n(e.field);t.index<=r&&(e.field=s(r+t.model.length+1))})),this.parent.sortCollection&&this.parent.sortCollection.forEach((function(e){e.sheetIndex===r&&t.index<=e.columnIndex&&(e.columnIndex+=t.model.length)})))}}else if("Sheet"===t.modelType){for(var a=0,o=Array.from(this.filterRange.keys()).sort().reverse();a<o.length;a++){var l=o[a];t.index<=l&&(this.filterRange.set(l+t.model.length,this.filterRange.get(l)),this.filterRange.delete(l),this.filterCollection.set(l+t.model.length,this.filterCollection.get(l)),this.filterCollection.delete(l))}this.parent.sortCollection&&this.parent.sortCollection.forEach((function(e){t.index<=e.sheetIndex&&(e.sheetIndex+=t.model.length)}))}},i.prototype.beforeDeleteHandler=function(e){if("Column"===e.modelType){var t=this.parent.activeSheetIndex;if(this.filterRange.size&&this.filterRange.has(t)){var r=!0,i=this.filterRange.get(t).range;if(e.start>=i[1]&&e.end<=i[3]?i[3]-=e.end-e.start+1:e.start<i[1]&&e.end<i[1]?(i[1]-=e.end-e.start+1,i[3]-=e.end-e.start+1):e.start<i[1]&&e.end>i[1]&&e.end<i[3]?(i[1]=e.start,i[3]-=e.end-e.start+1):r=!1,r){for(var a=this.filterCollection.get(t),o=void 0,l=a.length-1;l>=0;l--){var d=n(a[l].field);e.end<d?a[l].field=s(d-(e.end-e.start+1)+1):e.start<=d&&e.end>=d&&(o=!0,a.splice(l,1))}var h=this.parent.sortCollection;if(h)for(l=0;l<h.length;l++)if(h[l].sheetIndex===t){if(e.end<h[l].columnIndex){h[l].columnIndex=h[l].columnIndex-(e.end-e.start+1);break}if(e.start<=h[l].columnIndex&&e.end>=h[l].columnIndex){h.splice(l,1);break}}i.some((function(e){return e<0}))?(this.removeFilter(t,!0,!0),e.refreshSheet=!0):o&&(a&&a.length?(this.reapplyFilterHandler(!0,!0),e.refreshSheet=!1):(this.clearFilterHandler({preventRefresh:!0}),e.refreshSheet=!0))}}}},i.prototype.deleteSheetHandler=function(t){if((0,e.isUndefined)(t.sheetIndex))this.filterRange.get(this.parent.activeSheetIndex)&&(this.filterRange.delete(this.parent.activeSheetIndex),this.filterCollection.delete(this.parent.activeSheetIndex));else{for(var r=0,n=Array.from(this.filterRange.keys()).sort().reverse();r<n.length;r++){var i=n[r];t.sheetIndex===i?(this.filterRange.delete(i),this.filterCollection.delete(i)):t.sheetIndex<i&&(this.filterRange.set(i-1,this.filterRange.get(i)),this.filterRange.delete(i),this.filterCollection.set(i-1,this.filterCollection.get(i)),this.filterCollection.delete(i))}var a=this.parent.sortCollection;if(a)for(var s=a.length-1;s>=0;s--)t.sheetIndex===a[s].sheetIndex?a.splice(s,1):t.sheetIndex<a[s].sheetIndex&&(a[s].sheetIndex-=1)}},i.prototype.clearHandler=function(e){var t=this.parent.getAddressInfo(e.range);if(this.filterRange.has(t.sheetIndex)){var r=this.filterRange.get(t.sheetIndex).range.slice();Nr(t.indices,r[0],r[1])&&Nr(t.indices,r[0],r[3])&&this.removeFilter(t.sheetIndex)}},i.prototype.duplicateSheetFilterHandler=function(e){for(var t=0,r=Array.from(this.filterRange.keys()).sort().reverse();t<r.length;t++){var n=r[t];if(!(e.newSheetIndex<=n))break;this.filterRange.set(n+1,this.filterRange.get(n)),this.filterRange.delete(n),this.filterCollection.set(n+1,this.filterCollection.get(n)),this.filterCollection.delete(n)}if(this.filterCollection.has(e.sheetIndex)&&this.filterCollection.set(e.newSheetIndex,this.filterCollection.get(e.sheetIndex).slice()),this.filterRange.has(e.sheetIndex)){var i=this.filterRange.get(e.sheetIndex);this.filterRange.set(e.newSheetIndex,{useFilterRange:i.useFilterRange,range:i.range.slice(),allowHeaderFilter:i.allowHeaderFilter})}},i.prototype.updateSortCollectionHandler=function(e){var t=this.parent.getActiveSheet(),r=this.parent.activeSheetIndex,i=this.filterRange.get(r);if(i){var s=i.range.slice();i.allowHeaderFilter||(s[0]=s[0]+1),i.useFilterRange||(s[2]=t.usedRange.rowIndex);var l=e.sortOptions.sortDescriptors;if(this.parent.sortCollection=this.parent.sortCollection?this.parent.sortCollection:[],Array.isArray(l))for(var d=0;d<l.length;d++)this.parent.sortCollection.push({sortRange:a(s),columnIndex:n(l[d].field),order:l[d].order,sheetIndex:r});else this.parent.sortCollection.push({sortRange:a(s),columnIndex:o(t.activeCell)[1],order:l.order,sheetIndex:r})}},i.prototype.moveSheetHandler=function(e){var t,r,n,i;this.filterRange.has(e.prevIndex)&&(t=this.filterRange.get(e.prevIndex),n=this.filterCollection.get(e.prevIndex)),this.filterRange.has(e.currentIndex)&&(r=this.filterRange.get(e.currentIndex),i=this.filterCollection.get(e.currentIndex)),t&&r?(this.filterRange.set(e.currentIndex,t),this.filterRange.set(e.prevIndex,r),this.filterCollection.set(e.currentIndex,n),this.filterCollection.set(e.prevIndex,i)):t?(this.filterRange.set(e.currentIndex,t),this.filterRange.delete(e.prevIndex),this.filterCollection.set(e.currentIndex,n),this.filterCollection.delete(e.prevIndex)):r&&(this.filterRange.set(e.prevIndex,r),this.filterRange.delete(e.currentIndex),this.filterCollection.set(e.prevIndex,i),this.filterCollection.delete(e.currentIndex))},i.prototype.refreshFilterCellsOnResize=function(e){var t=this.filterRange.has(this.parent.activeSheetIndex)&&this.filterRange.get(this.parent.activeSheetIndex).range;if(t&&t[0]===e.rowIndex)for(var r=this.parent.getActiveSheet(),n=t[1];n<=t[3];n++)if(Ln(e.rowIndex,n,r,!1,!0).notes){var i=this.parent.getCell(e.rowIndex,n);i&&this.parent.serviceLocator.getService("cell").refresh(e.rowIndex,n,!1,i,!1,!1,!0)}},i}(),Jh=function(){function r(e){this.parent=e,this.addEventListener(),this.renderImageUpload()}return r.prototype.addEventListener=function(){this.parent.on(gs,this.insertImage,this),this.parent.on(vs,this.refreshImgCellObj,this),this.parent.on(bs,this.createImageElement,this),this.parent.on(xs,this.deleteImage,this),this.parent.on(Es,this.refreshInsDelImagePosition,this)},r.prototype.renderImageUpload=function(){this.parent.element.appendChild(this.parent.createElement("input",{id:this.parent.element.id+"_imageUpload",styles:"display: none;",attrs:{type:"file",accept:".image, .jpg, .png, .gif ,jpeg",name:"fileUpload"}})).onchange=this.imageSelect.bind(this)},r.prototype.imageSelect=function(e){var t=e.target.files[0];t&&(t.type.includes("image")?this.insertImage({file:t}):this.parent.serviceLocator.getService(Al).show({content:this.parent.serviceLocator.getService("spreadsheetLocale").getConstant("UnsupportedFile"),width:"300"}),e.target.value="")},r.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(gs,this.insertImage),this.parent.off(vs,this.refreshImgCellObj),this.parent.off(bs,this.createImageElement),this.parent.off(xs,this.deleteImage),this.parent.off(Es,this.refreshInsDelImagePosition))},r.prototype.insertImage=function(e,t){var r=this;this.binaryStringVal(e).then((function(e){return r.createImageElement({options:{src:e},range:t,isPublic:!0})}))},r.prototype.binaryStringVal=function(e){return new Promise((function(t,r){var n=new FileReader;n.readAsDataURL(e.file),n.onload=function(){return t(n.result)},n.onerror=function(e){return r(e)}}))},r.prototype.createImageElement=function(r){var n=r.range?r.range.lastIndexOf("!"):0,i=r.range?n>0?r.range.substring(n+1):r.range:this.parent.getActiveSheet().selectedRange,a=r.range&&n>0?vn(this.parent,r.range.substring(0,n)):this.parent.activeSheetIndex,s=this.parent.serviceLocator.getService(Tl),o=r.options.id?r.options.id:(0,e.getUniqueID)(this.parent.element.id+"_overlay_picture_"),l=t(i),d=(0,e.isUndefined)(a)?this.parent.getActiveSheet():this.parent.sheets[a];if(!this.parent.element.querySelector("#"+o)){var h={requestType:"beforeInsertImage",range:d.name+"!"+i,imageData:r.options.src,sheetIndex:a};if(r.isPublic&&this.parent.notify("actionBegin",{eventArgs:h,action:"beforeInsertImage"}),!h.cancel){var p=s.insertOverlayElement(o,i,a);p.element.style.backgroundImage="url('"+r.options.src+"')",(r.options.height||r.options.left)&&(p.element.style.height=r.options.height+"px",p.element.style.width=r.options.width+"px",(0,e.isNullOrUndefined)(r.options.top)||(p.element.style.top=Number(Hd(r.options.top).toFixed(2))+"px"),(0,e.isNullOrUndefined)(r.options.left)||(p.element.style.left=Number(Hd(r.options.left).toFixed(2))+"px")),(d.frozenRows||d.frozenColumns)&&s.adjustFreezePaneSize(r.options,p.element,i);var c={src:r.options.src,id:o,height:parseFloat(p.element.style.height.replace("px","")),width:parseFloat(p.element.style.width.replace("px","")),top:d.frozenRows||d.frozenColumns?l[0]?ml(d,0,l[0]-1):0:(0,e.isNullOrUndefined)(r.options.top)?p.top:r.options.top,left:d.frozenRows||d.frozenColumns?l[1]?wl(d,0,l[1]-1):0:(0,e.isNullOrUndefined)(r.options.left)?p.left:r.options.left};this.parent.setUsedRange(l[0],l[1]),(r.isPublic||r.isUndoRedo)&&this.parent.notify(Dt,{options:[c],range:d.name+"!"+i});var u=Ln(l[0],l[1],d);u.image[u.image.length-1].id||(u.image[u.image.length-1].id=c.id),!r.isUndoRedo&&r.isPublic&&(h={requestType:"insertImage",range:d.name+"!"+i,imageHeight:r.options.height?r.options.height:300,imageWidth:r.options.width?r.options.width:400,imageData:r.options.src,id:o,sheetIndex:a},this.parent.notify("actionComplete",{eventArgs:h,action:"insertImage"}))}}},r.prototype.refreshInsDelImagePosition=function(e){for(var t,r,n,i=e.count,a=e.sheetIdx,s=this.parent.sheets[a],o=Ln(e.rowIdx,e.colIdx,s),l=o.image.length,d=0;d<l;d++)t=document.getElementById(o.image[d].id),r="Row"===e.type?"insert"===e.status?o.image[d].top+20*i:o.image[d].top-20*i:o.image[d].top,n="Column"===e.type?"insert"===e.status?o.image[d].left+64*i:o.image[d].left-64*i:o.image[d].left,o.image[d].top=r,o.image[d].left=n,t&&(t.style.top=r+"px",t.style.left=n+"px")},r.prototype.refreshImgCellObj=function(t){var r,n,i=(0,e.isUndefined)(t.sheetIdx)?this.parent.activeSheetIndex:t.sheetIdx,a=In(this.parent,i),s=Ln(t.prevRowIdx,t.prevColIdx,a),o=Ln(t.currentRowIdx,t.currentColIdx,a),l=s?s.image:[],d=l&&l.length?l.length:0;if(s&&s.image&&l.length>0){for(var h=0;h<d;h++)l[h]&&l[h].id===t.id&&((r=l[h]).height=t.currentHeight,r.width=t.currentWidth,r.top=t.currentTop,r.left=t.currentLeft,l.splice(h,1));if(o&&o.image&&(n=o.image,r&&n.push(r)),Pn(t.currentRowIdx,t.currentColIdx,a,n?{image:n}:{image:[r]},!0),"imageRefresh"===t.requestType&&!t.isUndoRedo){var p={requestType:"imageRefresh",currentRowIdx:t.currentRowIdx,currentColIdx:t.currentColIdx,prevRowIdx:t.prevRowIdx,prevColIdx:t.prevColIdx,prevTop:t.prevTop,prevLeft:t.prevLeft,currentTop:t.currentTop,currentLeft:t.currentLeft,currentHeight:t.currentHeight,currentWidth:t.currentWidth,prevHeight:t.prevHeight,prevWidth:t.prevWidth,id:t.id,sheetIdx:this.parent.activeSheetIndex};this.parent.notify("actionComplete",{eventArgs:p,action:"imageRefresh"})}}},r.prototype.deleteImage=function(e){var r,n=e.sheet||this.parent.getActiveSheet(),a=document.getElementById(e.id),s=e.rowIdx,o=e.colIdx;if(a){if(void 0===e.rowIdx&&void 0===e.colIdx){var l=void 0,d=void 0;if(n.frozenRows||n.frozenColumns){var h=a.getBoundingClientRect();l={clientY:h.top},d={clientX:h.left},h.top<this.parent.getColumnHeaderContent().getBoundingClientRect().bottom&&(l.target=this.parent.getColumnHeaderContent()),h.left<this.parent.getRowHeaderContent().getBoundingClientRect().right&&(d.target=this.parent.getRowHeaderTable())}else l={clientY:parseFloat(a.style.top),isImage:!0},d={clientX:parseFloat(a.style.left),isImage:!0};this.parent.notify(ys,l),this.parent.notify(Cs,d),s=l.clientY,o=d.clientX}if(r=n.name+"!"+i(s,o),!e.preventEventTrigger){var p={address:r,cancel:!1};if(this.parent.notify(K,{action:"deleteImage",eventArgs:p}),p.cancel)return}document.getElementById(e.id).remove()}else if(!e.sheet){var c=e.range?e.range.lastIndexOf("!")>0?e.range.substring(e.range.lastIndexOf("!")+1):e.range:this.parent.getActiveSheet().selectedRange,u=e.range&&e.range.lastIndexOf("!")>0?vn(this.parent,e.range.substring(0,e.range.lastIndexOf("!"))):this.parent.activeSheetIndex,f=t(c);s=f[0],o=f[1],n=this.parent.sheets[u]}for(var g=Ln(s,o,n),m=g&&g.image?g.image:[],v={},y=m.length-1;y>=0;y--)m[y].id===e.id&&(v=m.splice(y,1)[0]);Pn(s,o,n,{image:m},!0),e.preventEventTrigger||this.parent.notify(ka,{action:"deleteImage",eventArgs:{address:r,id:v.id,imageData:v.src,imageWidth:v.width,imageHeight:v.height,cancel:!1},preventAction:e.isUndoRedo})},r.prototype.destroy=function(){this.removeEventListener(),this.parent=null},r.prototype.getModuleName=function(){return"spreadsheetImage"},r}(),Qh=u(60);Qh.Chart.Inject(Qh.ColumnSeries,Qh.LineSeries,Qh.BarSeries,Qh.AreaSeries,Qh.StackingColumnSeries,Qh.StackingLineSeries,Qh.StackingBarSeries,Qh.ScatterSeries),Qh.Chart.Inject(Qh.StackingAreaSeries,Qh.Category,Qh.Legend,Qh.Tooltip,Qh.DataLabel),Qh.AccumulationChart.Inject(Qh.PieSeries,Qh.AccumulationTooltip,Qh.AccumulationDataLabel,Qh.AccumulationLegend);var ep=function(){function r(e){this.parent=e,this.addEventListener()}return r.prototype.addEventListener=function(){this.parent.on(Pt,this.initiateChartHandler,this),this.parent.on(ws,this.refreshChartCellObj,this),this.parent.on(Is,this.refreshChartCellModel,this),this.parent.on(fr,this.refreshChartCellObj,this),this.parent.on(Ss,this.deleteChart,this),this.parent.on(Os,this.clearBorder,this),this.parent.on(ks,this.insertChartHandler,this),this.parent.on(As,this.chartRangeHandler,this),this.parent.on(Ds,this.chartDesignTabHandler,this),this.parent.on(Ls,this.updateChartElement,this),this.parent.on(Ps,this.undoRedoForChartDesign,this),this.parent.on(Bt,this.refreshChartData,this)},r.prototype.insertChartHandler=function(e){var t=this,r="Column",n=!1;switch(e.id){case"clusteredColumn":r="Column";break;case"stackedColumn":r="StackingColumn";break;case"stackedColumn100":r="StackingColumn100";break;case"clusteredBar":r="Bar";break;case"stackedBar":r="StackingBar";break;case"stackedBar100":r="StackingBar100";break;case"area":r="Area";break;case"stackedArea":r="StackingArea";break;case"stackedArea100":r="StackingArea100";break;case"line":r="Line";break;case"lineMarker":r="Line",n=!0;break;case"stackedLine":r="StackingLine";break;case"stackedLineMarker":r="StackingLine",n=!0;break;case"stackedLine100":r="StackingLine100";break;case"stackedLine100Marker":r="StackingLine100",n=!0;break;case"pie":r="Pie";break;case"doughnut":r="Doughnut";break;case"scatter":r="Scatter"}var i=[{type:r,markerSettings:{visible:n,isFilled:!0}}];e.isChart?(this.parent.notify(Lt,{chart:i}),Bl((function(){return Fd(t.parent.element)}))):this.parent.notify(Ds,{chartType:r,triggerEvent:!0,markerVisible:n})},r.prototype.chartRangeHandler=function(){var e=document.querySelector(".e-datavisualization-chart.e-ss-overlay-active");if(e)for(var t=e.getElementsByClassName("e-control")[0].id,r=this.parent.chartColl,n=r.length,i=0;i<n;i++){var a=document.getElementById(r[i].id);e&&a&&r[i].id===t&&this.initiateChartHandler({option:r[i],isRefresh:!0})}},r.prototype.refreshChartData=function(r){if(this.parent.chartColl&&this.parent.chartColl.length)for(var n,i,a,s,o,l,d=0,h=this.parent.chartColl.length;d<h;d++){if((n=this.parent.chartColl[d]).range.includes("!")){if(i=n.range.substring(0,n.range.lastIndexOf("!")),this.parent.activeSheetIndex!==vn(this.parent,i))continue;a=n.range.substring(n.range.lastIndexOf("!")+1)}else a=n.range;if(r.viewportIndexes){for(var p=0;p<r.viewportIndexes.length;p++)if(jr([r.viewportIndexes[p]],a)){s=!0;break}}else s=r.range?jr([r.range],a):r.showHide?this.inRowColumnRange(t(a),r.rIdx,r.showHide):Nr(t(a),r.rIdx,r.cIdx);s&&(o=this.parent.element.querySelector("."+n.id))&&(l=(0,e.getComponent)(o,"chart")||(0,e.getComponent)(o,"accumulationchart"))&&(l.series=this.initiateChartHandler({option:n,isRefresh:!0}),l.refresh())}},r.prototype.inRowColumnRange=function(e,t,r){return"rows"===r?t>=e[0]&&t<=e[2]:t>=e[1]&&t<=e[3]},r.prototype.refreshChartCellModel=function(e){for(var t=0,r=e.prevChartIndexes.length;t<r;t++){var n=e.prevChartIndexes[t].chart,i=e.prevChartIndexes[t].chartRowIdx,a=e.prevChartIndexes[t].chartColIdx,s=e.currentChartIndexes[t].chartRowIdx,o=e.currentChartIndexes[t].chartColIdx,l={prevTop:n.top,prevLeft:n.left,prevRowIdx:i,prevColIdx:a,prevHeight:n.height,prevWidth:n.width,currentTop:n.top,currentLeft:n.left,currentRowIdx:s,currentColIdx:o,currentHeight:n.height,currentWidth:n.width,id:n.id,requestType:"chartRefreshOnFilter"};this.parent.notify(ws,l)}},r.prototype.refreshChartCellObj=function(t){var r,n,i=(0,e.isUndefined)(t.sheetIdx)?this.parent.activeSheetIndex:t.sheetIdx,a=In(this.parent,i),s=Ln(t.prevRowIdx,t.prevColIdx,a),o=Ln(t.currentRowIdx,t.currentColIdx,a),l=s?s.chart:[],d=l&&l.length?l.length:0;if(d){for(var h=0;h<d;h++)if(l[h].id===t.id.split("_overlay")[0]){(r=l[h]).height=t.currentHeight,r.width=t.currentWidth,r.top=t.currentTop,r.left=t.currentLeft,l.splice(h,1),h--,d--;for(var p=0,c=this.parent.chartColl.length;p<c;p++)r.id===this.parent.chartColl[p].id&&(r.height=t.currentHeight,this.parent.chartColl[p].width=t.currentWidth,this.parent.chartColl[p].top=t.currentTop,this.parent.chartColl[p].left=t.currentLeft)}if(o&&o.chart&&(n=o.chart,r&&n.push(r)),Pn(t.currentRowIdx,t.currentColIdx,a,n?{chart:n}:{chart:[r]},!0),"chartRefresh"===t.requestType&&!t.isUndoRedo){var u={requestType:"chartRefresh",currentRowIdx:t.currentRowIdx,currentColIdx:t.currentColIdx,currentWidth:t.currentWidth,prevHeight:t.prevHeight,prevWidth:t.prevWidth,prevRowIdx:t.prevRowIdx,prevColIdx:t.prevColIdx,prevTop:t.prevTop,prevLeft:t.prevLeft,currentTop:t.currentTop,currentLeft:t.currentLeft,currentHeight:t.currentHeight,id:t.id,sheetIdx:i};this.parent.notify("actionComplete",{eventArgs:u,action:"chartRefresh"})}}},r.prototype.processChartRange=function(t,r,n){var i,a,s,o,l,d=this,h=t[0],p=t[1],c=!1,u=t[2],f=t[3],g=h===u,m=p===f,v=In(this.parent,r),y=Xr(this.parent),C=function(t,n,i,a){var s=Ln(t,n,v);if(s){s.formula&&(0,e.isNullOrUndefined)(s.value)&&d.parent.notify(ne,{cell:s,rowIdx:t,colIdx:n,sheetIndex:r});var h=void 0;if(s.format){var p={value:s.value,format:s.format,formattedText:s.value,cell:s,rowIndex:t,colIndex:n};d.parent.notify(re,p);var c=rn(s.value);c&&!Vn(s.format,!0,null,!0)?h=Number(s.value):(a&&c?o=!0:i&&c&&(l=!0),h=p.formattedText&&p.formattedText.toString())}else y(s),h=s.value;return(0,e.isNullOrUndefined)(h)?"":h}return""},b=C(h,f,!1,!0),x=C(u,p,!0),S=C(h,p,!0);return rn(x)&&S||(c=!0),!(0,e.isNullOrUndefined)(S)&&("Scatter"!==n.type||n.isSeriesInRows)||g||m?(0,e.isNullOrUndefined)(x)||!c||g||m||o?(a=[h,p,u,f],(0,e.isNullOrUndefined)(b)||rn(b)||o?(g||m)&&(0,e.isNullOrUndefined)(S)&&(s=[h,p,h,f],g?(a[1]=a[1]+1,s[3]=s[1]):a[0]=a[0]+1):(s=[h,p,h,f],a[0]=a[0]+1)):(0,e.isNullOrUndefined)(b)||rn(b)&&S?(i=[h,p,u,p],a=[h,p+1,u,f]):(i=[h+1,p,u,p],a=[h+1,p+1,u,f],s=[h,p+1,h,f]):(i=[h+1,p,u,p],a=[h+1,p+1,u,f],s=[h,p+1,h,f]),{xRange:i,yRange:a,lRange:s,isStringSeries:c,isDateTime:l}},r.prototype.getRangeData=function(r){var n=r.sheet;r.range?"string"==typeof r.range&&(r.range=t(r.range)):r.range=t(n.selectedRange);for(var i,a,s,o=[],l=r.range[0],d=r.isYvalue&&Xr(this.parent);l<=r.range[2];)if(cl(n,l))l++;else{for(a=r.range[1];a<=r.range[3];)if(Il(n,a))a++;else{var h=Ln(l,a,n,!1,!0);h.formula&&(0,e.isNullOrUndefined)(h.value)&&this.parent.notify(ne,{cell:h,rowIdx:l,colIdx:a,sheetIndex:r.sheetIdx}),r.isYvalue&&d(h),i={value:h.value||(0===h.value?0:null)},h.format?(s={formattedText:h.value,value:h.value,format:h.format,cell:h,skipFormatCheck:!0},this.parent.notify(re,s),r.isYvalue?rn(h.value)?(i.value=Number(h.value),i.displayText=s.formattedText?s.formattedText.toString():""):(i.displayText=null===i.value?"":this.parent.getDisplayText({format:h.format,value:"0"}),i.value=0):i.value=s.formattedText?s.formattedText.toString():null):r.isYvalue&&(rn(i.value)?(i.displayText=i.value.toString(),i.value=Number(i.value)):(i.displayText=null===i.value?"":"0",i.value=0)),o.push(i),a++}l++}return o},r.prototype.toArrayData=function(e){for(var t,r="value",n=0,i=[],a=e.length;n<a;)t=e[n],Object.keys(t).length?r in t&&i.push(t[""+r]):i.push(""),n++;return i},r.prototype.getVirtualXValues=function(e){for(var t=1,r=[];t<e;)r.push(t.toString()),t++;return r},r.prototype.processChartSeries=function(t,r,n,i,a){var s;t=t||{};var o,l,d,h,p,c={name:"displayText"},u={},f=0,g=0,m=this.parent.isPrintingProcessing,v=[];r=(0,e.isNullOrUndefined)(r)?this.parent.activeSheetIndex:r;var y=In(this.parent,r),C=this.getRangeData({range:i,sheet:y,isYvalue:!0,sheetIdx:r}),b=i[2]-i[0]+1-this.parent.hiddenCount(i[0],i[2],"rows",y),x=i[3]-i[1]+1-this.parent.hiddenCount(i[1],i[3],"columns",y);t.isSeriesInRows?(o=a?this.toArrayData(this.getRangeData({range:a,sheet:y})):this.getVirtualXValues(x+1),n&&(l=this.toArrayData(this.getRangeData({range:n,sheet:y}))),d=b):(o=n?this.toArrayData(this.getRangeData({range:n,sheet:y})):this.getVirtualXValues(b+1),a&&(l=this.toArrayData(this.getRangeData({range:a,sheet:y}))),d=x);var S,w=o.length,I=t.isSeriesInRows?1:d;for((0,e.isNullOrUndefined)(t.dataLabelSettings)||(c.visible=t.dataLabelSettings.visible,c.position=t.dataLabelSettings.position);f<d;){for(p=0,h=[],g=t.isSeriesInRows?g:f;p<w;)(0,e.isNullOrUndefined)(o[p])&&(o[p]=(0,e.getUniqueID)("spread-chart-empty-label-")),h.push({x:o[p],y:C[g].value,displayText:C[g].displayText}),g+=I,p++;if(s=l&&l.length>0?l[f]:"Scatter"===t.type?"series"+(f+1):"series"+f,s=(0,e.isNullOrUndefined)(s)?"":s.toString(),t.type){var E=t.type;u="Line"===E||"StackingLine"===E||"StackingLine100"===E?{dataSource:h,type:t.type,xName:"x",yName:"y",name:s,animation:{enable:!m},tooltipMappingName:"displayText",marker:t.markerSettings?{visible:t.markerSettings.visible,width:t.markerSettings.size,height:t.markerSettings.size,shape:t.markerSettings.shape,dataLabel:c,isFilled:t.markerSettings.isFilled,border:t.markerSettings.border,fill:t.markerSettings.isFilled?t.markerSettings.fill:null}:{dataLabel:c}}:"Scatter"===E?{dataSource:h,type:t.type,xName:"x",yName:"y",name:s,tooltipMappingName:"displayText",animation:{enable:!m},marker:{visible:!1,width:12,height:12,shape:"Circle",dataLabel:c}}:"Pie"===E||"Doughnut"===E?{dataSource:h,radius:"100%",xName:"x",yName:"y",innerRadius:"Pie"===t.type?"0%":"40%",dataLabel:{visible:!!c.visible,position:"Outer"===c.position?"Outside":"Inside",name:"displayText",font:{fontWeight:"600"}},animation:{enable:!m},tooltipMappingName:"displayText"}:{dataSource:h,type:t.type,xName:"x",yName:"y",animation:{enable:!m},name:s,marker:{dataLabel:c},tooltipMappingName:"displayText"}}v.push(u),f++}return t.type&&(S={series:v,xRange:t.isSeriesInRows?a:n,yRange:i,lRange:t.isSeriesInRows?n:a}),S},r.prototype.primaryYAxisFormat=function(t){var r="";if(!(0,e.isNullOrUndefined)(t)){var n=Ln(t[0],t[1],this.parent.getActiveSheet());n&&n.format&&(r=n.format)}return r},r.prototype.focusChartRange=function(e,t,r){var n,i=["e-rcborderright","e-rcborderbottom","e-vcborderright","e-vcborderbottom","e-bcborderright","e-bcborderbottom"];this.clearBorder();var a=this.parent.getActiveSheet(),s=!(!a.frozenRows&&!a.frozenColumns);r&&(s?n=r:this.parent.notify(Rs,{startcell:{rowIndex:r[0],colIndex:r[1]},endcell:{rowIndex:r[2],colIndex:r[3]},classes:[i[0],i[1]]})),e&&(s?n?(n[0]=Math.min(r[0],e[0]),n[1]=Math.min(r[1],e[1]),n[2]=Math.max(r[2],e[2]),n[3]=Math.max(r[3],e[3])):n=e:this.parent.notify(Rs,{startcell:{rowIndex:e[0],colIndex:e[1]},endcell:{rowIndex:e[2],colIndex:e[3]},classes:[i[2],i[3]]})),s&&n?this.parent.notify(Rs,{startcell:{rowIndex:Math.min(n[0],t[0]),colIndex:Math.min(n[1],t[1])},endcell:{rowIndex:Math.max(n[2],t[2]),colIndex:Math.max(n[3],t[3])},classes:[i[4],i[5]]}):this.parent.notify(Rs,{startcell:{rowIndex:t[0],colIndex:t[1]},endcell:{rowIndex:t[2],colIndex:t[3]},classes:[i[4],i[5]]})},r.prototype.clearBorder=function(){var t=this.parent.getActiveSheet();if(t.frozenColumns||t.frozenRows)[].slice.call(this.parent.element.getElementsByClassName("e-chart-range")).forEach((function(t){(0,e.detach)(t)}));else for(var r=this.parent.getMainContent(),n=["e-rcborderright","e-rcborderbottom","e-vcborderright","e-vcborderbottom","e-bcborderright","e-bcborderbottom"],i=0,a=n.length;i<a;i++)for(var s=r.querySelectorAll("."+n[i]),o=0,l=s.length;o<l;o++){s[o].classList.remove(n[i])}},r.prototype.initiateChartHandler=function(r){var n,i,a=this,s=r.option;n=!!(0,e.isNullOrUndefined)(r.isInitCell)||!r.isInitCell,r.triggerEvent=!!(0,e.isNullOrUndefined)(r.triggerEvent)||r.triggerEvent,r.isRefresh=!(0,e.isNullOrUndefined)(r.isRefresh)&&r.isRefresh;var o,l,d=s.range&&s.range.lastIndexOf("!")>0?vn(this.parent,s.range.substring(0,s.range.lastIndexOf("!"))):this.parent.activeSheetIndex,h=In(this.parent,d),c=s.range?s.range:this.parent.getActiveSheet().selectedRange,u=t(c),f={};if(!this.parent.allowChart&&h.isProtected)return i;var g={sheetIndex:d,reqType:"shape",type:"actionBegin",shapeType:"chart",action:"create",options:s,range:c,operation:"create"};(c=g.range,f=(f=g.options)||{},u.length>0&&!r.isRefresh&&n)&&(u[2]-u[0]<u[3]-u[1]&&(o=!0));f.isSeriesInRows=!!o||!!f.isSeriesInRows&&f.isSeriesInRows,r.dataSheetIdx=(0,e.isNullOrUndefined)(r.dataSheetIdx)?d:r.dataSheetIdx;var m=this.processChartRange(u,r.dataSheetIdx,f),v=m.xRange,y=m.yRange,C=m.lRange;if(d===this.parent.activeSheetIndex&&n&&this.focusChartRange(v,y,C),r.triggerEvent&&!r.isRefresh){if(l={type:s.type,theme:s.theme,isSeriesInRows:s.isSeriesInRows,range:s.range,markerSettings:f.markerSettings,id:s.id,height:s.height,width:s.width,posRange:r.range,isInitCell:r.isInitCell,cancel:!1,top:s.top,left:s.left},this.parent.notify(K,{eventArgs:l,action:"beforeInsertChart"}),l.cancel)return[];s.type=l.type,s.theme=l.theme,s.isSeriesInRows=l.isSeriesInRows,s.markerSettings=l.markerSettings,s.range=l.range,s.id=l.id,s.height=l.height,s.width=l.width}var b=this.processChartSeries(f,r.dataSheetIdx,v,y,C),x={majorGridLines:s.primaryXAxis&&s.primaryXAxis.majorGridLines&&!(0,e.isNullOrUndefined)(s.primaryXAxis.majorGridLines.width)?{width:s.primaryXAxis.majorGridLines.width}:{width:0},minorGridLines:s.primaryXAxis&&s.primaryXAxis.minorGridLines&&!(0,e.isNullOrUndefined)(s.primaryXAxis.minorGridLines.width)?{width:s.primaryXAxis.minorGridLines.width}:{width:0},minorTicksPerInterval:s.primaryXAxis&&s.primaryXAxis.minorGridLines&&s.primaryXAxis.minorGridLines.width>0?5:0,lineStyle:{width:0},valueType:"Scatter"!==s.type||m.isStringSeries||s.isSeriesInRows?"Category":"Double",rangePadding:"Scatter"!==s.type||m.isStringSeries||s.isSeriesInRows?"Auto":"Round",visible:!s.primaryXAxis||s.primaryXAxis.visible,title:s.primaryXAxis?s.primaryXAxis.title:"",edgeLabelPlacement:"Shift"},S={lineStyle:{width:0},majorGridLines:s.primaryYAxis&&s.primaryYAxis.majorGridLines&&!(0,e.isNullOrUndefined)(s.primaryYAxis.majorGridLines.width)?{width:s.primaryYAxis.majorGridLines.width}:{width:1},minorGridLines:s.primaryYAxis&&s.primaryYAxis.minorGridLines&&!(0,e.isNullOrUndefined)(s.primaryYAxis.minorGridLines.width)?{width:s.primaryYAxis.minorGridLines.width}:{width:0},minorTicksPerInterval:s.primaryYAxis&&s.primaryYAxis.minorGridLines&&s.primaryYAxis.minorGridLines.width>0?5:0,visible:!s.primaryYAxis||s.primaryYAxis.visible,title:s.primaryYAxis?s.primaryYAxis.title:"",edgeLabelPlacement:"Shift"};if(r.isRefresh){if(r.isSwitchRowColumn&&"Scatter"===s.type){var w=this.parent.element.querySelector("."+s.id);if(w)(0,e.getComponent)(w,"chart").primaryXAxis.valueType=m.isStringSeries||s.isSeriesInRows?"Category":"Double"}return b.series}var I=s.id+"_overlay",E=this.parent.serviceLocator.getService(Tl),N=!(0,e.isNullOrUndefined)(r.isInitCell)&&r.isInitCell?r.range:c,R=E.insertOverlayElement(I,N,p(this.parent,N));R.element.classList.add("e-datavisualization-chart"),R.element.style.width=s.width+"px",R.element.style.height=s.height+"px",h.frozenRows||h.frozenColumns?E.adjustFreezePaneSize(s,R.element,N):((0,e.isNullOrUndefined)(s.top)?s.top=R.top:R.element.style.top=Number(Hd(s.top).toFixed(2))+"px",(0,e.isNullOrUndefined)(s.left)?s.left=R.left:R.element.style.left=Number(Hd(s.left).toFixed(2))+"px"),this.parent.notify(qs,{height:s.height,width:s.width});var O="Pie"===s.type||"Doughnut"===s.type?{position:"Bottom",visible:!0}:{};(0,e.isNullOrUndefined)(s.legendSettings)||(O.visible=s.legendSettings.visible,O.position=s.legendSettings.position);var k=this.parent.createElement("div",{id:s.id,className:s.id}),A=s.theme||"Material",F=this.primaryYAxisFormat(y),T=2*Math.round(parseFloat(getComputedStyle(R.element).borderWidth)),D=parseFloat(R.element.style.height)-(isNaN(T)?0:T)+"px";return"Pie"!==s.type&&"Doughnut"!==s.type?(this.chart=new Qh.Chart({primaryXAxis:x,primaryYAxis:S,background:this.getThemeBgColor(A),chartArea:{border:{width:0}},title:s.title,legendSettings:O,theme:A,series:b.series,tooltip:{enable:!0,format:"${point.x} : <b>${point.tooltip}</b>"},width:R.element.style.width,height:D,enableRtl:this.parent.enableRtl,load:function(e){e.chart.theme=s.theme||"Material"},beforeResize:function(e){e.cancelResizedEvent=!0},axisLabelRender:function(t){"primaryYAxis"===t.axis.name&&F&&!s.type.includes("100")&&!(0,e.isNullOrUndefined)(t.value)&&a.parent?t.text=a.parent.getDisplayText({format:F,value:t.value.toString()}):"primaryXAxis"===t.axis.name&&t.text.startsWith("spread-chart-empty-label-")&&(t.text=""),"primaryXAxis"===t.axis.name&&"Scatter"===s.type&&t.axis.labels.length>0&&!rn(t.text)&&!m.isDateTime&&(t.text=(t.axis.labels.indexOf(t.text)+1).toString())}}),this.chart.appendTo(k)):(this.chart=new Qh.AccumulationChart({title:s.title,legendSettings:O,theme:A,background:this.getThemeBgColor(A),series:b.series,width:R.element.style.width,height:D,center:{x:"50%",y:"50%"},tooltip:{enable:!0,format:"${point.x} : <b>${point.tooltip}</b>"},enableSmartLabels:!0,enableAnimation:!0,enableRtl:this.parent.enableRtl,load:function(e){e.chart.theme=s.theme||"Material"},beforeResize:function(e){e.cancelResizedEvent=!0}}),this.chart.appendTo(k)),R.element.appendChild(k),R.element.classList.contains("e-ss-overlay-active")&&!this.parent.isPrintingProcessing&&this.parent.notify(Fs,{id:R.element.id}),r.triggerEvent&&this.parent.notify(ka,{eventArgs:l,action:"insertChart"}),i},r.prototype.deleteChart=function(r){this.clearBorder();var n=null,a=this.parent.getActiveSheet();if((0,e.isNullOrUndefined)(r.id)?(n=document.querySelector(".e-datavisualization-chart.e-ss-overlay-active"),r.id=n?n.getElementsByClassName("e-control")[0].id:null):(r.id=r.id.includes("overlay")?r.id:r.id+"_overlay",n=document.getElementById(r.id)),!(0,e.isNullOrUndefined)(r.id)){var s,o,l;r.id=r.id.includes("overlay")?r.id:r.id+"_overlay";for(var d,h=!1,p=0,c=this.parent.chartColl.length;p<c;p++)if(this.parent.chartColl[p].id===r.id.split("_overlay")[0]){d=this.parent.chartColl[p];break}var u={id:d.id,range:d.range,type:d.type,markerSettings:d.markerSettings,theme:d.theme,height:d.height,width:d.width,isSeriesInRows:d.isSeriesInRows,isInitCell:!0,posRange:null,top:d.top,left:d.left,cancel:!1};if(n){var f=void 0,g=void 0;if(a.frozenRows||a.frozenColumns){var m=n.getBoundingClientRect();f={clientY:m.top},g={clientX:m.left},m.top<this.parent.getColumnHeaderContent().getBoundingClientRect().bottom&&(f.target=this.parent.getColumnHeaderContent()),m.left<this.parent.getRowHeaderContent().getBoundingClientRect().right&&(g.target=this.parent.getRowHeaderTable())}else f={clientY:parseFloat(n.style.top),isImage:!0},g={clientX:parseFloat(n.style.left),isImage:!0};this.parent.notify(Ut,{id:r.id}),this.parent.notify(ys,f),this.parent.notify(Cs,g),h=!0,s=f.clientY,o=g.clientX,a=this.parent.sheets[this.parent.activeSheetIndex]}else{this.parent.notify(Ut,{id:r.id});var v=r.range?r.range.lastIndexOf("!"):0,y=r.range&&v>0?vn(this.parent,r.range.substring(0,v)):this.parent.activeSheetIndex,C=t(r.range?v>0?r.range.substring(v+1):r.range:this.parent.getActiveSheet().selectedRange);s=C[0],o=C[1],a=this.parent.sheets[y]}var b=Ln(s,o,a);b&&(l=b.chart);var x=l?l.length:null;for(p=0;p<x;p++)r.id===l[p].id+"_overlay"&&(l.splice(p,1),x=l.length);h&&(document.getElementById(r.id).remove(),this.parent.notify(Ts,{})),Pn(s,o,a,{chart:l},!0),u.posRange=i(s,o),r.isUndoRedo||this.parent.notify(ka,{eventArgs:u,action:"deleteChart"})}},r.prototype.updateChartModel=function(t,r,n,i,a){var s=r,o=this.parent.chartColl[i].id;if(!(a&&["PHAxes","PVAxes","PHAxisTitle","PVAxisTitle","GLMajorHorizontal","GLMajorVertical","GLMinorHorizontal","GLMinorVertical"].indexOf(t)>-1))for(var l=0,d=n.chart.length;l<d;l++)if(n.chart[l].id===o)switch(t){case"PHAxes":case"PHAxisTitle":(0,e.isNullOrUndefined)(n.chart[l].primaryXAxis)&&(n.chart[l].primaryXAxis={},this.parent.chartColl[i].primaryXAxis={}),"PHAxes"===t?(n.chart[l].primaryXAxis.visible=r.primaryXAxis.visible,this.parent.chartColl[i].primaryXAxis.visible=r.primaryXAxis.visible):"PHAxisTitle"===t&&(n.chart[l].primaryXAxis.title=r.primaryXAxis.title,this.parent.chartColl[i].primaryXAxis.title=r.primaryXAxis.title);break;case"PVAxes":case"PVAxisTitle":(0,e.isNullOrUndefined)(n.chart[l].primaryYAxis)&&(n.chart[l].primaryYAxis={},this.parent.chartColl[i].primaryYAxis={}),"PVAxes"===t?(n.chart[l].primaryYAxis.visible=r.primaryYAxis.visible,this.parent.chartColl[i].primaryYAxis.visible=r.primaryYAxis.visible):"PVAxisTitle"===t&&(n.chart[l].primaryYAxis.title=r.primaryYAxis.title,this.parent.chartColl[i].primaryYAxis.title=r.primaryYAxis.title);break;case"ChartTitleNone":case"ChartTitleAbove":n.chart[l].title=r.title,this.parent.chartColl[i].title=r.title;break;case"DLNone":case"DLCenter":case"DLInsideend":case"DLInsidebase":case"DLOutsideend":if((0,e.isNullOrUndefined)(n.chart[l].dataLabelSettings)&&(n.chart[l].dataLabelSettings={},this.parent.chartColl[i].dataLabelSettings={}),"DLNone"===t)n.chart[l].dataLabelSettings.visible=!1,this.parent.chartColl[i].dataLabelSettings.visible=!1;else{n.chart[l].dataLabelSettings.visible=!0,this.parent.chartColl[i].dataLabelSettings.visible=!0;var h=void 0;h=a?"Outside"===s.series[0].dataLabel.position?"Outer":"Middle":r.series[0].marker.dataLabel.position,n.chart[l].dataLabelSettings.position=h,this.parent.chartColl[i].dataLabelSettings.position=h}break;case"GLMajorHorizontal":(0,e.isNullOrUndefined)(n.chart[l].primaryYAxis)&&(n.chart[l].primaryYAxis={},this.parent.chartColl[i].primaryYAxis={}),(0,e.isNullOrUndefined)(n.chart[l].primaryYAxis.majorGridLines)&&(n.chart[l].primaryYAxis.majorGridLines={},this.parent.chartColl[i].primaryYAxis.majorGridLines={}),n.chart[l].primaryYAxis.majorGridLines.width=r.primaryYAxis.majorGridLines.width,this.parent.chartColl[i].primaryYAxis.majorGridLines.width=r.primaryYAxis.majorGridLines.width;break;case"GLMajorVertical":(0,e.isNullOrUndefined)(n.chart[l].primaryXAxis)&&(n.chart[l].primaryXAxis={},this.parent.chartColl[i].primaryXAxis={}),(0,e.isNullOrUndefined)(n.chart[l].primaryXAxis.majorGridLines)&&(n.chart[l].primaryXAxis.majorGridLines={},this.parent.chartColl[i].primaryXAxis.majorGridLines={}),n.chart[l].primaryXAxis.majorGridLines.width=r.primaryXAxis.majorGridLines.width,this.parent.chartColl[i].primaryXAxis.majorGridLines.width=r.primaryXAxis.majorGridLines.width;break;case"GLMinorHorizontal":(0,e.isNullOrUndefined)(n.chart[l].primaryYAxis)&&(n.chart[l].primaryYAxis={},this.parent.chartColl[i].primaryYAxis={}),(0,e.isNullOrUndefined)(n.chart[l].primaryYAxis.minorGridLines)&&(n.chart[l].primaryYAxis.minorGridLines={},this.parent.chartColl[i].primaryYAxis.minorGridLines={}),n.chart[l].primaryYAxis.minorGridLines.width=r.primaryYAxis.minorGridLines.width,this.parent.chartColl[i].primaryYAxis.minorGridLines.width=r.primaryYAxis.minorGridLines.width;break;case"GLMinorVertical":(0,e.isNullOrUndefined)(n.chart[l].primaryXAxis)&&(n.chart[l].primaryXAxis={},this.parent.chartColl[i].primaryXAxis={}),(0,e.isNullOrUndefined)(n.chart[l].primaryXAxis.minorGridLines)&&(n.chart[l].primaryXAxis.minorGridLines={},this.parent.chartColl[i].primaryXAxis.minorGridLines={}),n.chart[l].primaryXAxis.minorGridLines.width=r.primaryXAxis.minorGridLines.width,this.parent.chartColl[i].primaryXAxis.minorGridLines.width=r.primaryXAxis.minorGridLines.width;break;case"LegendNone":case"LegendsRight":case"LegendsLeft":case"LegendsBottom":case"LegendsTop":if((0,e.isNullOrUndefined)(n.chart[l].legendSettings)&&(n.chart[l].legendSettings={},this.parent.chartColl[i].legendSettings={}),n.chart[l].legendSettings.visible=r.legendSettings.visible,this.parent.chartColl[i].legendSettings.visible=r.legendSettings.visible,"LegendNone"!==t){n.chart[l].legendSettings.position=r.legendSettings.position,this.parent.chartColl[i].legendSettings.position=r.legendSettings.position;break}}},r.prototype.updateChartElement=function(e,t,r,n,i,a,s,o){if(!(a&&["PHAxes","PVAxes","PHAxisTitle","PVAxisTitle","GLMajorHorizontal","GLMajorVertical","GLMinorHorizontal","GLMinorVertical"].indexOf(e)>-1)){var l;switch(e){case"PHAxes":t.primaryXAxis.visible=!t.primaryXAxis.visible;break;case"PVAxes":t.primaryYAxis.visible=!t.primaryYAxis.visible;break;case"PHAxisTitle":t.primaryXAxis.title=i;break;case"PVAxisTitle":t.primaryYAxis.title=i;break;case"ChartTitleNone":t.title="";break;case"ChartTitleAbove":t.title=i;break;case"DLNone":case"DLCenter":case"DLInsideend":case"DLInsidebase":case"DLOutsideend":if(l=t.series,"DLNone"===e)for(var d=0,h=l.length;d<h;d++)a?l[d].dataLabel.visible=!1:l[d].marker.dataLabel.visible=!1;else for(d=0,h=l.length;d<h;d++)if(a){var p="DLOutsideend"===e?"Outside":"Inside";l[d].dataLabel.visible=!0,l[d].dataLabel.position=p}else{p="DLCenter"===e?"Middle":"DLInsideend"===e?"Top":"DLInsidebase"===e?"Bottom":"DLOutsideend"===e?"Outer":l[0].marker.dataLabel.position;l[d].marker.dataLabel.visible=!0,l[d].marker.dataLabel.position=p}t.series=l,a&&t.refresh();break;case"GLMajorHorizontal":t.primaryYAxis.majorGridLines.width=0===t.primaryYAxis.majorGridLines.width?1:0;break;case"GLMajorVertical":t.primaryXAxis.majorGridLines.width=0===t.primaryXAxis.majorGridLines.width?1:0;break;case"GLMinorHorizontal":t.primaryYAxis.minorTicksPerInterval=0===t.primaryYAxis.minorGridLines.width?5:0,t.primaryYAxis.minorGridLines.width=0===t.primaryYAxis.minorGridLines.width?1:0;break;case"GLMinorVertical":t.primaryXAxis.minorTicksPerInterval=0===t.primaryXAxis.minorGridLines.width?5:0,t.primaryXAxis.minorGridLines.width=0===t.primaryXAxis.minorGridLines.width?1:0;break;case"LegendNone":t.legendSettings.visible=!1;break;case"LegendsRight":case"LegendsLeft":case"LegendsBottom":case"LegendsTop":t.legendSettings.visible=!0,t.legendSettings.position="LegendsRight"===e?"Right":"LegendsLeft"===e?"Left":"LegendsBottom"===e?"Bottom":"LegendsTop"===e?"Top":t.legendSettings.position}if(this.updateChartModel(e,t,r,n,a),o){var c={addChartEle:e,id:t.element.id+"_overlay",title:i,address:s};this.parent.notify(ka,{action:"chartDesign",eventArgs:c})}}},r.prototype.undoRedoForChartDesign=function(t){var r=document.getElementById(t.id);if(r){var n=this.getChartElement(r),i=(0,e.getComponent)(n,"chart");(0,e.isNullOrUndefined)(i)&&(i=(0,e.getComponent)(n,"accumulationchart"));for(var a,s=this.parent.getAddressInfo(t.address),o=Ln(s.indices[0],s.indices[1],In(this.parent,s.sheetIndex)),l=this.getChartCollectionId(n.id),d=t.addChartEle,h=t.title,p=0;p<t.beforeActionData.cellDetails[0].chart.length;p++)if(n.id===t.beforeActionData.cellDetails[0].chart[p].id){a=t.beforeActionData.cellDetails[0].chart[p];break}var c=!(0,e.isNullOrUndefined)(a.markerSettings)&&a.markerSettings.visible;if(t.switchRowColumn)this.switchRowColumn(l,n.id,i,o);else if(t.chartTheme)this.switchChartTheme(l,n.id,t.isUndo?a.theme:t.chartTheme,i,o);else if(t.chartType)this.switchChartType(l,n.id,t.isUndo?a.type:t.chartType,i,o,!1,t.isUndo?c:t.chartMarker,"undoRedo");else if(t.addChartEle){if(t.isUndo){var u=void 0;switch(d){case"DLNone":case"DLCenter":case"DLInsideend":case"DLInsidebase":case"DLOutsideend":d="Middle"===(u=a.dataLabelSettings&&a.dataLabelSettings.position)?"DLCenter":"Top"===u?"DLInsideend":"Bottom"===u?"DLInsidebase":"Outer"===u?"DLOutsideend":"DLNone";break;case"LegendNone":case"LegendsRight":case"LegendsLeft":case"LegendsBottom":case"LegendsTop":a.legendSettings&&!a.legendSettings.visible?u="LegendNone":d="Right"===(u=a.legendSettings&&a.legendSettings.position)?"LegendsRight":"Left"===u?"LegendsLeft":"Bottom"===u?"LegendsBottom":"Top"===u?"LegendsTop":"LegendsBottom";break;case"PVAxisTitle":h=a.primaryYAxis&&a.primaryYAxis.title;break;case"PHAxisTitle":h=a.primaryXAxis&&a.primaryXAxis.title;break;case"ChartTitleNone":case"ChartTitleAbove":h=a.title}}this.updateChartElement(d,i,o,l,h,null,t.address)}}},r.prototype.chartDesignTabHandler=function(t){var r=!1,n=this.parent.sheets[this.parent.activeSheetIndex],a=t.switchRowColumn,s=t.chartType,o=t.chartTheme,l=t.addChartEle,d=null,h=t.id?document.getElementById(t.id):document.querySelector(".e-datavisualization-chart.e-ss-overlay-active");if(h){var p,c,u="ChartTitleAbove"===l||"PHAxisTitle"===l||"PVAxisTitle"===l;if(n.frozenRows||n.frozenColumns){var f=h.getBoundingClientRect();p={clientY:f.top},c={clientX:f.left},f.top<this.parent.getColumnHeaderContent().getBoundingClientRect().bottom&&(p.target=this.parent.getColumnHeaderContent()),f.left<this.parent.getRowHeaderContent().getBoundingClientRect().right&&(c.target=this.parent.getRowHeaderTable())}else p={clientY:h.offsetTop,isImage:!0},c={clientX:h.offsetLeft,isImage:!0};this.parent.notify(ys,p),this.parent.notify(Cs,c);var g=Ln(p.clientY,c.clientX,n),m=n.name+"!"+i(p.clientY,c.clientX);if(t.triggerEvent){var v={switchRowColumn:t.switchRowColumn,chartType:t.chartType,chartTheme:t.chartTheme,addChartEle:t.addChartEle,id:h.id,address:m,cancel:!1};if(this.parent.notify(K,{action:"chartDesign",eventArgs:v}),v.cancel)return}var y=this.getChartElement(h),C=y.getAttribute("id"),b=this.getChartCollectionId(C);if(y&&(d=(0,e.getComponent)(y,"chart"),(0,e.isNullOrUndefined)(d)&&(d=(0,e.getComponent)(y,"accumulationchart"),r=!0)),a&&this.switchRowColumn(b,C,d,g),s&&this.switchChartType(b,C,s,d,g,t.markerVisible),o&&this.switchChartTheme(b,C,o,d,g),l)if(u&&!t.title){if(this.parent.element.getElementsByClassName("e-title-dlg").length>0)return;this.titleDlgHandler(l,d,g,b,r,m,t.triggerEvent)}else this.updateChartElement(l,d,g,b,t.title,r);if(t.triggerEvent&&!u){v={switchRowColumn:t.switchRowColumn,chartType:t.chartType,chartMarker:t.markerVisible,chartTheme:t.chartTheme,addChartEle:t.addChartEle,id:h.id,address:m};this.parent.notify(ka,{action:"chartDesign",eventArgs:v})}}},r.prototype.switchRowColumn=function(t,r,n,i){var a=this.parent.chartColl[t];a.isSeriesInRows=!!(0,e.isNullOrUndefined)(a.isSeriesInRows)||!a.isSeriesInRows;for(var s=0,o=i.chart.length;s<o;s++)i.chart[s].id===r&&(i.chart[s].isSeriesInRows=a.isSeriesInRows);var l=this.initiateChartHandler({option:a,isRefresh:!0,isSwitchRowColumn:!0});n.series=l},r.prototype.switchChartTheme=function(e,t,r,n,i){this.parent.chartColl[e].theme=r;for(var a=0,s=i.chart.length;a<s;a++)i.chart[a].id===t&&(i.chart[a].theme=r);n.setProperties({theme:r,background:this.getThemeBgColor(r)},!0),n.refresh()},r.prototype.getThemeBgColor=function(e){var t;if(e.includes("Dark"))switch(e){case"MaterialDark":t="#383838";break;case"FabricDark":t="#242424";break;case"BootstrapDark":t="#1b1b1b";break;case"Bootstrap5Dark":t="#212529";break;case"TailwindDark":t="#1f2937";break;case"Tailwind3Dark":t="#111827";break;case"FluentDark":t="#1b1a19";break;case"Fluent2Dark":t="#292929";break;case"Material3Dark":t="#1C1B1F"}else t=e.includes("HighContrast")?"#000000":"#FFFFFF";return t},r.prototype.switchChartType=function(t,r,n,i,a,s,o,l){var d=this.parent.chartColl[t].type;this.parent.chartColl[t].type=n;for(var h=0,p=a.chart.length;h<p;h++)a.chart[h].id===r&&(a.chart[h].type=n,(0,e.isNullOrUndefined)(a.chart[h].markerSettings)||(a.chart[h].markerSettings.visible=s));if("Pie"!==n&&"Doughnut"!==n)if("Pie"===d||"Doughnut"===d)this.changeCharType(t);else{if(d!==n)if("Scatter"===n){var c=i.primaryXAxis.labels;c&&c.length>0&&rn(c[c.length-1])&&(i.primaryXAxis.valueType="Double")}else"Double"===i.primaryXAxis.valueType&&(i.primaryXAxis.valueType="Category");for(var u="Line"===n||"StackingLine"===n||"StackingLine100"===n,f=(h=0,(g=i.series).length);h<f;h++)g[h].type=n,u?(g[h].marker.visible=s,g[h].marker.shape=(0,e.isNullOrUndefined)(g[h].marker.shape)?"Circle":g[h].marker.shape,"undoRedo"===l&&(g[h].marker.visible=o)):g[h].marker.visible=!1;i.series=g,i.refresh()}else if("Pie"===d||"Doughnut"===d){var g;for(h=0,f=(g=i.series).length;h<f;h++)g[h].innerRadius="Pie"===n?"0%":"40%";i.series=g,i.refresh()}else this.changeCharType(t)},r.prototype.getChartElement=function(t){var r=t.querySelector(".e-chart");return(0,e.isNullOrUndefined)(r)&&(r=t.querySelector(".e-accumulationchart")),r},r.prototype.getChartCollectionId=function(e){for(var t,r=0,n=this.parent.chartColl.length;r<n;r++)e===this.parent.chartColl[r].id&&(t=r);return t},r.prototype.changeCharType=function(t){var r=document.getElementById(this.parent.chartColl[t].id),n=(0,e.closest)(r,".e-datavisualization-chart");n.remove(),this.initiateChartHandler({option:this.parent.chartColl[t],isInitCell:!1,triggerEvent:!1,isPaste:!1}),r=document.getElementById(this.parent.chartColl[t].id),(n=(0,e.closest)(r,".e-datavisualization-chart")).classList.contains("e-ss-overlay-active")||n.classList.add("e-ss-overlay-active")},r.prototype.titleDlgHandler=function(e,t,r,n,i,a,s){var o=this,l="";if(!i||"PHAxisTitle"!==e&&"PVAxisTitle"!==e){var d=this.parent.serviceLocator.getService(kl),h=this.parent.serviceLocator.getService(Al);h.show({width:375,showCloseIcon:!0,isModal:!0,cssClass:"e-title-dlg",header:"chart_abovechart"===e?d.getConstant("ChartTitle"):"PHAxisTitle"===e?d.getConstant("HorizontalAxisTitle"):d.getConstant("VerticalAxisTitle"),beforeOpen:function(){h.dialogInstance.content=o.titleDlgContent(e,t),h.dialogInstance.dataBind(),o.parent.element.focus()},buttons:[{buttonModel:{content:d.getConstant("Ok"),isPrimary:!0,cssClass:"e-btn e-clearall-btn e-flat"},click:function(){var i=o.parent.element.querySelector(".e-title-dlg").getElementsByClassName("e-title-dlg-content")[0];l=i.getElementsByTagName("input")[0].value,h.hide(),o.updateChartElement(e,t,r,n,l,null,a,s)}}]}),h.dialogInstance.refresh()}},r.prototype.titleDlgContent=function(e,t){var r=this.parent.serviceLocator.getService(kl),n=this.parent.createElement("div",{className:"e-title-dlg-content"}),i=this.parent.createElement("span",{className:"e-header e-top-header"});i.innerText=r.getConstant("EnterTitle");var a=this.parent.createElement("input",{className:"e-input",id:"titleInput",attrs:{type:"text"}});return n.appendChild(i),n.appendChild(a),t&&(a.value="PHAxisTitle"===e?t.primaryXAxis.title?t.primaryXAxis.title:a.value:"PVAxisTitle"===e?t.primaryYAxis.title?t.primaryYAxis.title:a.value:t.title?t.title:a.value),n},r.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(Pt,this.initiateChartHandler),this.parent.off(ws,this.refreshChartCellObj),this.parent.off(fr,this.refreshChartCellModel),this.parent.off(Is,this.refreshChartCellModel),this.parent.off(Ss,this.deleteChart),this.parent.off(Os,this.clearBorder),this.parent.off(ks,this.insertChartHandler),this.parent.off(As,this.chartRangeHandler),this.parent.off(Ds,this.chartDesignTabHandler),this.parent.off(Ls,this.updateChartElement),this.parent.off(Ps,this.undoRedoForChartDesign),this.parent.off(Bt,this.refreshChartData))},r.prototype.destroy=function(){this.removeEventListener(),this.parent=null;var t=null;this.chart&&(t=this.chart.element,this.chart.destroy()),t&&(0,e.detach)(t),this.chart=null},r.prototype.getModuleName=function(){return"spreadsheetChart"},r}(),tp=function(){function t(e){this.totalSheetCount=[],this.workbookActiveSheetCount=0,this.defaultCellWidth=64,this.defaultCellHeight=19,this.pageCounts=[],this.initialRowCount=0,this.chartHeight=0,this.columnIndex=0,this.rowIndex=0,this.multipleCanvasDataURL=[],this.chartElements=[],this.totalCharts=0,this.isChartLoaded=!1,this.chartLoadedCount=0,this.isImageLoaded=!1,this.totalImages=0,this.imageLoadedCount=0,this.endRow=0,this.isColumn=!0,this.startNewPageCount=0,this.allowTimer=!1,this.parent=e}return t.prototype.print=function(t,r){var n=this;if(t.isPrintingProcessing=!0,this.multipleCanvasDataURL=[],this.chartElements=[],"ActiveSheet"===r.type){var a=t.sheets[t.activeSheetIndex];this.activeSheetPrint(t,a,r,t.activeSheetIndex)}else{this.totalSheetCount=[],this.workbookActiveSheetCount=1;for(var s=0;s<t.sheets.length;s++){if("Visible"===t.sheets[s].state)if(this.totalSheetCount.push(s),this.totalSheetCount.length>1&&this.parent.sheets[s].ranges.length>0)if(this.parent.sheets[s].ranges.some((function(t){return!(0,e.isNullOrUndefined)(t.dataSource)}))){this.allowTimer=!0;a=t.sheets[s];var l=o(i(0,0)+":"+i(a.rowCount-1,a.colCount-1));this.parent.notify(j,{sheet:a,indexes:l})}}this.allowTimer?(this.allowTimer=!1,setTimeout((function(){n.activeSheetPrint(t,t.sheets[n.totalSheetCount[0]],r,n.totalSheetCount[0])}),2e3)):this.activeSheetPrint(t,t.sheets[this.totalSheetCount[0]],r,this.totalSheetCount[0])}},t.prototype.updateChartRowAndColumnIndices=function(e,t){var r=e.sheets[t];if(this.rowIndex=r.usedRange.rowIndex,this.columnIndex=r.usedRange.colIndex,e.chartColl.length>0)for(var n=0;n<e.chartColl.length;n++){var i=e.chartColl[n];if(t===vn(e,i.range.substring(0,i.range.lastIndexOf("!")))){var a={clientX:i.left,isImage:!0},s={clientY:i.top,isImage:!0};e.notify(ys,s),e.notify(Cs,a),s.clientY>r.usedRange.rowIndex&&(this.rowIndex=Math.max(this.rowIndex,s.clientY)),a.clientX>r.usedRange.colIndex&&(this.columnIndex=Math.max(this.columnIndex,a.clientX))}}},t.prototype.activeSheetPrint=function(e,t,r,n){this.updateChartRowAndColumnIndices(e,n),this.pageCounts=this.calculatePageCount(t,1e3,r.allowRowColumnHeader),this.initialRowCount=0,this.parent.currentPrintSheetIndex=n,this.endRow=this.rowIndex+1,this.processCell(0,0,this.endRow,2,[],undefined,undefined,t,this,0,0,!0,n,r)},t.prototype.processCell=function(t,r,n,i,a,o,l,d,h,p,c,u,f,g){var m=this;void 0===p&&(p=0),void 0===c&&(c=0),void 0===u&&(u=!0);var v=g.allowRowColumnHeader,y=37,C=0;this.chartHeight=0;for(var b=!1,x=t;x<this.pageCounts.length;x++){this.chartLoadedCount=0,this.totalCharts=0,this.imageLoadedCount=0,this.totalImages=0,p+=0===x?0:1100,l=document.createElement("canvas"),o=l.getContext("2d"),l.width=1e3,l.height=1100,o.font="11pt Calibri",o.textBaseline="bottom",o.index=x,o.width=1e3,(u||!this.isImageLoaded&&!this.isChartLoaded)&&(a=[],i=0,c=0);for(var S=r;S<this.endRow;S++){u=!0;var w=!1;this.isColumn=this.isColumn?this.isColumn:0===S;var I={borderBottom:"1px solid black"},E=d.rows[S]&&d.rows[S].height||this.defaultCellHeight;this.initialRowCount=S,i=0;var N=0===x?0:this.pageCounts[x-1]+1,R=this.pageCounts[x];c+=(0,e.isNullOrUndefined)(d.rows[S])?this.defaultCellHeight:E+(0===S&&v?this.defaultCellHeight:0);var O=(0,e.isNullOrUndefined)(d.rows[S])?this.defaultCellHeight:d.rows[S]&&d.rows[S].height||this.defaultCellHeight;if(c>1080){if(this.startNewPageCount=S,C=v?E+(0===S&&v?this.defaultCellHeight:0):0,w=!1,this.isColumn=!0,this.isImageLoaded||this.isChartLoaded)break;p+=1100,u&&this.multipleCanvasDataURL.push(l.toDataURL()),u=!0,l=document.createElement("canvas"),o=l.getContext("2d"),l.width=1e3,l.height=1100,o.font="11pt Calibri",o.textBaseline="bottom",o.index=x,o.width=1e3;for(var k=0;k<a.length;k++)void 0!==a[k]&&(a[k]-=c-O);c=v||g.allowGridLines?E+(v?this.defaultCellHeight:0):E}var A={borderBottom:"1px solid black",borderTop:"1px solid black",borderLeft:"1px solid black",borderRight:"1px solid black"},F={borderRight:"1px solid black"};if(v&&this.isColumn)for(var T=N;T<=R;T++){var D=s(T+1),L=T===N?2:1;o.font="11pt Calibri";for(k=0;k<L;k++){var P=0===k&&2===L?y:d.columns[T]&&d.columns[T].hidden?0:d.columns[T]&&d.columns[T].width||this.defaultCellWidth;if(0!==(P=i+P>1e3?P-1-(i+P-1e3):P)){var M=o.measureText(D).width,B=h.calculateTextPosition(M,P,i,"Center"),H=this.defaultCellHeight;o.fillText(T===N&&0===k?"":D,B,H),h.drawBorder(o,A,i,0,P,this.defaultCellHeight),i+=P,a[T]=this.defaultCellHeight,T===R&&(2===L?1===k:0===k)&&(this.isColumn=!(T===R),i=0)}else T===R&&(this.isColumn=!1,i=0)}}if((0,e.isNullOrUndefined)(d.rows[S])||!(0,e.isNullOrUndefined)(d.rows[S].hidden)&&d.rows[S].hidden){if(b||(0,e.isNullOrUndefined)(d.rows[S])){var U={borderBottom:"1px solid black",borderTop:"1px solid black",borderLeft:"1px solid black",borderRight:"1px solid black"};w=c+O+(0===S&&v?this.defaultCellHeight:0)>1080||S===d.rows.length-1||S===this.endRow-1;for(T=N;T<=R;T++){var V=d.rows[S]&&!(0,e.isNullOrUndefined)(d.rows[S].cells)&&d.rows[S].cells[T];(0,e.isNullOrUndefined)(V)||(0,e.isNullOrUndefined)(V.style)||(U=this.setBorderStyle(V,U)),v&&T===N&&(h.rowHeaderText((S+1).toString(),o,h,y,i,U,a[T],this.defaultCellHeight),i+=y);var z=d.columns[T]&&d.columns[T].width||this.defaultCellWidth;z=i+z>1e3?z-1-(i+z-1e3):z,a[T]=isNaN(a[T])?0:a[T],g.allowGridLines?h.drawBorder(o,U,i,a[T],z,O):v&&!g.allowGridLines&&T===R&&h.drawBorder(o,{borderRight:"1px solid black"},i,a[T],z,O),i+=z,T===R&&v&&w&&(h.drawBorder(o,I,0,a[T],i,O),w=!1),a[T]+=O}}}else{if(b){var _=d.rows.slice(S,S+d.rows.length-S).map((function(e){return e&&e.height||m.defaultCellHeight})).reduce((function(e,t){return e+(t||m.defaultCellHeight)}),0);l.height>c+(this.chartHeight-_)?this.endRow+=Math.ceil((this.chartHeight-_)/19):this.endRow+=Math.ceil((l.height-(c+_))/19),b=!1}w=this.endRow===d.rows.length&&(c+(d.rows[S+1]&&d.rows[S+1].height||this.defaultCellHeight)+(0===S&&v?this.defaultCellHeight:0)>1080||S===d.rows.length-1);for(var j,q=function(t){var r=d.rows[S]&&!(0,e.isNullOrUndefined)(d.rows[S].cells)&&d.rows[S].cells[t];if((0,e.isNullOrUndefined)(r)||(0,e.isNullOrUndefined)(r.style)||(A=W.setBorderStyle(r,A)),(0,e.isNullOrUndefined)(d.columns[t])||(0,e.isNullOrUndefined)(d.columns[t].hidden)||!d.columns[t].hidden){var n,u,k=!(0,e.isNullOrUndefined)(d.rows[S].cells)&&!(0,e.isNullOrUndefined)(d.rows[S].cells[t])&&!isNaN(d.rows[S].cells[t].colSpan)&&N>t+d.rows[S].cells[t].colSpan,T=!((0,e.isNullOrUndefined)(d.rows[S].cells)||(0,e.isNullOrUndefined)(d.rows[S].cells[t])||isNaN(d.rows[S].cells[t].rowSpan)||S+d.rows[S].cells[t].rowSpan>W.startNewPageCount||0===W.startNewPageCount),D="",L=(0,e.isNullOrUndefined)(r)||isNaN(r.rowSpan)||k||T?1:Math.max(r.rowSpan,0);if(a[t]=isNaN(a[t])?0:a[t],v&&t===N){o.font="11pt Calibri";var P=a[t];if(L>0)for(var M=0;M<(0===L?1:L);M++)i=0,P+=0===M?0:d.rows[S+M]&&d.rows[S+M-1].height||W.defaultCellHeight,h.rowHeaderText((S+1+M).toString(),o,h,y,i,A,P,d.rows[S+M].height||W.defaultCellHeight),i+=y;else i=0,i+=y}if(!(0,e.isNullOrUndefined)(r)&&r){var B=r.style&&r.style.fontSize||"11pt",H=r.style&&r.style.color||"#000000";if(!isNaN(d.rows[S].cells[t].rowSpan)&&d.rows[S].cells[t].rowSpan>1&&isNaN(d.rows[S+1].cells[t].rowSpan)&&W.parent.merge(""+s(t+1)+(S+1)+":"+s(t+1)+(S+d.rows[S].cells[t].rowSpan-1)),!isNaN(d.rows[S].cells[t].colSpan)&&d.rows[S].cells[t].colSpan>1)if(!(0,e.isNullOrUndefined)(d.rows[S+1])&&!(0,e.isNullOrUndefined)(d.rows[S+1].cells)&&d.rows[S+1].cells.length>0&&!(0,e.isNullOrUndefined)(d.rows[S+1].cells[t])&&isNaN(d.rows[S+1].cells[t].colSpan))W.parent.merge(""+s(t+1)+(S+1)+":"+s(t+1+d.rows[S].cells[t].colSpan-1)+(S+1));else if((0,e.isNullOrUndefined)(d.rows[S].cells[t+1].colSpan))for(var U=1;U<d.rows[S].cells[t].colSpan;U++)d.rows[S].cells[t+U].colSpan=-U;if(n=isNaN(d.rows[S].cells[t].colSpan)||k?1:Math.max(d.rows[S].cells[t].colSpan,0),d.rows[S].cells[t].rowSpan&&!k&&d.rows[S].cells[t].rowSpan<0){var V=d.rows[S+d.rows[S].cells[t].rowSpan].cells[t].colSpan;n=V||n}(t===N||t>0&&d.columns&&d.columns[t-1]&&d.columns[t-1].hidden&&d.rows[S].cells[t-1]&&d.rows[S].cells[t-1].colSpan>1)&&n<=0&&(n=1);var z=r.style&&r.style.backgroundColor||"#ffffff",_=r.style?r.style.textAlign:"";o.font=B,o.fillStyle=H;var q=[];if(n>1){var G=d.columns.slice(t,t+n);for(M=0;M<G.length;M++)q.push(G.hidden?0:G[M]&&G[M].width||W.defaultCellWidth);0===q.length?q.push(W.defaultCellWidth*n):q.length!==n&&(q=q.map((function(e){return e+m.defaultCellWidth*(n-1-q.length)})))}u=n>1?q.reduce((function(e,t){return e+t}),0):1===n?d.columns[t]&&d.columns[t].width||W.defaultCellWidth:0,u=i+u>1e3?u-1-(i+u-1e3):u,O=L>1?d.rows.slice(S,S+L).map((function(e){return e.height||m.defaultCellHeight})).reduce((function(e,t){return e+(t||m.defaultCellHeight)}),0):1===L?E:0;var Y=(r.style&&r.style.verticalAlign||"Bottom").toLowerCase();if(!(0,e.isNullOrUndefined)(r.image)&&r.image.length>0&&W.processImages(x,S,r,l,o,c,W.endRow,E,C,v,g,d,h,i,a,p,f),!(0,e.isNullOrUndefined)(r.chart)&&r.chart.length>0&&W.handleCharts(x,S,r,o,l,c,W.endRow,W.initialRowCount,C,E,v,g,d,h,W.multipleCanvasDataURL,i,a,p,f),(0,e.isNullOrUndefined)(r.value)&&(0,e.isNullOrUndefined)(r.formula)&&(0,e.isNullOrUndefined)(r.hyperlink))h.rowHeaderRect(o,i,a[t],u,O,z);else{var X;if(r.formula&&r.format){"Automatic"===W.parent.calculationMode&&W.parent.notify(pe,{action:"refreshCalculate",rowIndex:S,colIndex:t,value:r.formula,isFormula:xr(r.formula),sheetIndex:f});var K={value:r.value,format:r.format,rowIndex:S,colIndex:t,sheetIndex:W.parent.activeSheetIndex,cell:r,refresh:!0};D=W.parent.workbookNumberFormatModule.getFormattedCell(K),X=""+(_||(K.isRightAlign?"Right":"Left"))}else if(r.format){K={value:r.value,format:r.format,rowIndex:S,colIndex:t,sheetIndex:W.parent.activeSheetIndex,cell:r,refresh:!0};D=W.parent.workbookNumberFormatModule.getFormattedCell(K),X=""+(_||(K.isRightAlign?"Right":"Left"))}else if(r.formula)"Automatic"===W.parent.calculationMode&&W.parent.notify(pe,{action:"refreshCalculate",rowIndex:S,colIndex:t,value:r.formula,isFormula:xr(r.formula),sheetIndex:f}),D=r.value,X=""+(_||"Left");else{(0,e.isNullOrUndefined)(r.hyperlink)||((0,e.isNullOrUndefined)(r.value)?r.value=((0,e.isNullOrUndefined)(r.hyperlink)||"object"!=typeof r.hyperlink)&&r.hyperlink||r.hyperlink.address:((0,e.isNullOrUndefined)(r.value)||""===r.value)&&(r.value="object"==typeof r.hyperlink?r.hyperlink.address:r.hyperlink),H=r.style&&r.style.color||"#00e"),D=r.value;var $=!(0,e.isNullOrUndefined)(r.value)&&""!==r.value&&new RegExp("^[^\\p{L}]*$","u").test(r.value);X=""+(_||($?"Right":"Left"))}var Z=r.style&&r.style.fontSize||"11pt",J=r.style&&r.style.fontFamily||"Calibri",Q=r.style&&r.style.fontStyle||"",ee=r.style&&r.style.fontWeight||"normal";o.font=Q+" "+ee+" "+Z+" "+J;var te=o.measureText(D),re=te.width,ne=te.actualBoundingBoxAscent+te.actualBoundingBoxDescent;if(r.wrap){var ie=W.defaultCellHeight<O?parseInt(Z.replace("pt",""),10)/72*96:O,ae=h.wrapText(o,D,u),se=1===ae.length?O:ae.length*ie===O?ie:ae.length*ie<O?O-(ae.length-1)*ie:ie,oe=a[t]+("top"===Y?ie:"middle"===Y&&se>ie+se/4?ie+se/4:se);o.save(),o.beginPath(),o.rect(i,a[t],u,O),o.clip(),o.fillStyle=z,o.fillRect(i,a[t],u,O+("top"===Y?ie:0)),ae.forEach((function(e,t){o.fillStyle=H,te=o.measureText(e),re=te.width;var n=h.calculateTextPosition(re,u,i,X);o.fillText(e,n,oe+t*ie),h.textDecoration(r,o,n,oe+t*ie,H,te,D,u)})),o.restore()}else{o.save(),o.beginPath(),o.rect(i,a[t],u,O),o.clip(),o.fillStyle=z,o.fillRect(i,a[t],u,O),o.fillStyle=H;var le=h.calculateTextPosition(re,u,i,X),de=a[t],he=O/2+ne/2;"top"===Y?o.textBaseline="top":de+="middle"===Y&&O>he?he:O,(0,e.isNullOrUndefined)(r.style)||(de=!(0,e.isNullOrUndefined)(r.style.borderBottom)&&r.style.borderBottom.indexOf("double")>-1||!(0,e.isNullOrUndefined)(r.style.borderTop)&&r.style.borderTop.indexOf("double")>-1?de-2:de,le=!(0,e.isNullOrUndefined)(r.style.borderLeft)&&r.style.borderLeft.indexOf("double")>-1||!(0,e.isNullOrUndefined)(r.style.borderRight)&&r.style.borderRight.indexOf("double")>-1?le+("Left"===X?2:-3):le),o.fillText(D,le,de),o.restore(),h.textDecoration(r,o,le,de,H,te,D,u)}}r.style&&(u>0||O>0)&&(r.style.borderBottom||r.style.borderTop||r.style.borderLeft||r.style.borderRight&&((0,e.isNullOrUndefined)(r.rowSpan)&&(0,e.isNullOrUndefined)(r.colSpan)||!(0,e.isNullOrUndefined)(r.rowSpan)&&r.rowSpan>0||!(0,e.isNullOrUndefined)(r.colSpan)&&r.colSpan>0))&&h.drawBorder(o,r.style,i,a[t]<=0?2:a[t],u,O)}var ce=n<=0?u:u||d.columns[t]&&d.columns[t].width||W.defaultCellWidth;g.allowGridLines&&(A.borderRight=t===R&&v?void 0:"1px solid black",h.drawBorder(o,A,i,a[t],ce,O)),i+=ce;var ue=0;if(L>1){ue=a[t];for(U=t;U<t+n;U++){var fe=d.rows[S]&&!(0,e.isNullOrUndefined)(d.rows[S].cells)&&d.rows[S].cells[U];fe&&!(0,e.isNullOrUndefined)(fe.image)?W.processImages(x,S,fe,l,o,c,W.endRow,E,C,v,g,d,h,i,a,p,f):fe&&!(0,e.isNullOrUndefined)(fe.chart)&&W.handleCharts(x,S,fe,o,l,c,W.endRow,W.initialRowCount,C,E,v,g,d,h,W.multipleCanvasDataURL,i,a,p,f),fe.style&&U===t&&O>0&&(fe.style.borderBottom||fe.style.borderTop||fe.style.borderLeft||fe.style.borderRight)&&h.drawBorder(o,fe.style,i,a[t],2,O),a[U]=(isNaN(a[U])?0:a[U])+O}t+=n-1}t===R&&v&&h.drawBorder(o,F,i-2,a[t]-ue,2,O),t===R&&v&&w&&!b&&(h.drawBorder(o,I,0,a[t]-ue,i,O),w=!1),L<=1&&(a[t]+=O)}else if(v&&t===N){L=(0,e.isNullOrUndefined)(r)||isNaN(d.rows[S].cells[t].rowSpan)?1:Math.max(d.rows[S].cells[t].rowSpan,0);a[t]=isNaN(a[t])?0:a[t];P=a[t];o.font="11pt Calibri";for(M=0;M<L;M++)i=0,P+=0===M?0:d.rows[S+M]&&d.rows[S+M-1].height||W.defaultCellHeight,h.rowHeaderText((S+1+M).toString(),o,h,y,i,A,P,d.rows[S+M].height||W.defaultCellHeight),i+=y;a[t]+=O}j=t},W=this,T=N;T<=R;T++)q(T),T=j}}if(this.isImageLoaded||this.isChartLoaded){if(this.isImageLoaded||this.isChartLoaded)break}else u&&this.endRow>0&&this.multipleCanvasDataURL.push(l.toDataURL()),r=0,this.pageCounts.length-1===x&&h.canvasPrint(this.parent,f,g)}},t.prototype.setBorderStyle=function(t,r){return r.borderBottom=(0,e.isNullOrUndefined)(t.style.borderBottom)?r.borderBottom:t.style.borderBottom,r.borderTop=(0,e.isNullOrUndefined)(t.style.borderTop)?r.borderTop:t.style.borderTop,r.borderRight=(0,e.isNullOrUndefined)(t.style.borderRight)?r.borderRight:t.style.borderRight,r.borderLeft=(0,e.isNullOrUndefined)(t.style.borderLeft)?r.borderLeft:t.style.borderLeft,r},t.prototype.setToDefault=function(){this.parent.currentPrintSheetIndex=0,this.initialRowCount=0,this.chartHeight=0,this.totalCharts=0,this.totalImages=0,this.chartLoadedCount=0,this.imageLoadedCount=0,this.endRow=0,this.pageCounts=[],this.multipleCanvasDataURL=[],this.chartElements=[],this.isChartLoaded=!1,this.isImageLoaded=!1,this.startNewPageCount=0},t.prototype.handleCharts=function(t,r,n,i,a,s,o,l,d,h,p,c,u,f,g,m,v,y,C){var b=this;if(!(0,e.isNullOrUndefined)(n.chart))for(var x=function(n){S.totalCharts+=1;var o=new Image;n.left=(0,e.isNullOrUndefined)(n.left)?0:n.left,n.top=(0,e.isNullOrUndefined)(n.top)?0:n.top;var l=document.getElementById(n.id);if((0,e.isNullOrUndefined)(l)&&(S.parent.insertChart([n]),l=document.getElementById(n.id),S.chartElements.push(n.id+"_overlay")),!(0,e.isNullOrUndefined)(l)){if(S.chartHeight=n.height,S.initialRowCount+Math.ceil(n.height/19)>S.endRow&&(c.allowRowColumnHeader||c.allowGridLines)&&u.rows.length-1===r){var x=h+(p?S.defaultCellHeight:0);a.height>s+(S.chartHeight-x)?S.endRow+=Math.ceil((S.chartHeight-x)/19):S.endRow+=Math.ceil((a.height-(s+x))/19)}var w=l.cloneNode(!0),I=window.URL.createObjectURL(new Blob([(new XMLSerializer).serializeToString(w.childNodes[1])],{type:"image/svg+xml"}));o.onload=function(){var e=Math.ceil(n.left/1e3)-1,r=Math.ceil(n.top/1080)-1,l=n.left+(p?37:0),h=n.top+(p?19:0)+(r>0?d:0);if(i.drawImage(o,e<=0?l:l-1e3*e,r<=0?h:h-1160*r,n.width,n.height),b.chartLoadedCount++,b.chartLoadedCount===b.totalCharts&&(m+=n.width,b.isChartLoaded=!1,!b.isImageLoaded)){g.push(a.toDataURL());var x=b.initialRowCount===u.rows.length-1&&s<1080?u.rows.length:b.initialRowCount,S=b.endRow;b.processCell(t,x+1===S?S:x,S,m,v,i,a,u,f,y,s,!1,C,c)}},o.src=I,S.isChartLoaded=!0}},S=this,w=0,I=n.chart;w<I.length;w++){x(I[w])}},t.prototype.processImages=function(t,r,n,i,a,s,o,l,d,h,p,c,u,f,g,m,v){var y=this;if(!(0,e.isNullOrUndefined)(n.image)){for(var C=function(n){b.totalImages+=1;var o=new Image;if(o.src=n.src,n.left=(0,e.isNullOrUndefined)(n.left)?0:n.left,n.top=(0,e.isNullOrUndefined)(n.top)?0:n.top,b.chartHeight=n.height,b.initialRowCount+Math.ceil(n.height/19)>b.endRow&&(p.allowRowColumnHeader||p.allowGridLines)&&r===c.rows.length-1){var C=l+(h?b.defaultCellHeight:0);i.height>s+(b.chartHeight-C)?b.endRow+=Math.ceil((b.chartHeight-C)/19):b.endRow+=Math.ceil((i.height-(s+C))/19)}o.onload=function(){var e=Math.ceil(n.left/1e3)-1,r=Math.ceil(n.top/1080)-1,l=n.left+(h?37:0),C=n.top+(h?19:0)+(r>0?d:0);if(a.drawImage(o,e<=0?l:l-1e3*e,r<=0?C:C-1160*r,n.width,n.height),y.imageLoadedCount++,y.imageLoadedCount===y.totalImages&&(y.isImageLoaded=!1,f+=n.width,!y.isChartLoaded)){y.multipleCanvasDataURL.push(i.toDataURL());var b=y.initialRowCount===c.rows.length-1&&s<1080?c.rows.length:y.initialRowCount,x=y.endRow;y.processCell(t,b+1===x?x:b,x,f,g,a,i,c,u,m,s,!1,v,p)}},o.onerror=function(){if(y.imageLoadedCount++,y.imageLoadedCount===y.totalImages&&(y.isImageLoaded=!1,!y.isChartLoaded)){y.multipleCanvasDataURL.push(i.toDataURL());var e=y.initialRowCount===c.rows.length-1&&s<1080?c.rows.length:y.initialRowCount,r=y.endRow;y.processCell(t,e+1===r?r:e,r,f,g,a,i,c,u,m,s,!1,v,p)}}},b=this,x=0,S=n.image;x<S.length;x++){C(S[x])}this.isImageLoaded=!0}},t.prototype.textDecoration=function(t,r,n,i,a,s,o,l){""!==o&&(!(0,e.isNullOrUndefined)(t.style)&&!(0,e.isNullOrUndefined)(t.style.textDecoration)&&t.style.textDecoration.toLowerCase().indexOf("underline")>-1||!(0,e.isNullOrUndefined)(t.hyperlink))&&(r.beginPath(),r.moveTo(n,i-3),r.lineTo(n+(s.width>l?l:s.width),i-3),r.strokeStyle=a,r.lineWidth=1,r.stroke())},t.prototype.rowHeaderRect=function(e,t,r,n,i,a){void 0===a&&(a="#ffffff"),e.save(),e.beginPath(),e.rect(t,r,n,i),e.clip(),e.fillStyle=a,e.fillRect(t,r,n,i),e.restore()},t.prototype.rowHeaderText=function(e,t,r,n,i,a,s,o){var l=t.measureText(e).width,d=r.calculateTextPosition(l,n,i,"Center"),h=s;t.save(),t.beginPath(),t.rect(i,s,n,o),t.clip(),t.fillStyle="#000000",t.fillText(e,d,h+o),r.drawBorder(t,a,i,s||0,n,o),t.restore()},t.prototype.canvasPrint=function(t,r,n){var i=this;if("Workbook"===n.type&&this.totalSheetCount.length-1>=this.workbookActiveSheetCount){var a=this.totalSheetCount[this.workbookActiveSheetCount],s=t.sheets[a];this.workbookActiveSheetCount++,this.activeSheetPrint(t,s,n,a)}else{for(var o=0;o<this.chartElements.length;o++){var l=document.getElementById(this.chartElements[o]);(0,e.isNullOrUndefined)(l)||l.remove()}if(this.multipleCanvasDataURL.length>0){var d=navigator.userAgent,h=window.open(" ","_blank","height="+window.outerHeight+",width="+window.outerWidth+",tabbar=no");h.document.write("<html><head><title></title></head><body>");var p=1e3,c=1400;-1!==d.indexOf("Chrome")||-1!==d.indexOf("Safari")||-1!==d.indexOf("Firefox")?(h.document.write("<!DOCTYPE html>"),h.document.write("<html><head><style>html, body { } img { height: 100%; width: 100%; display: block; }@media print { body { } img { width:100%; width:100%; box-sizing: border-box; }br, button { display: none; } div{ page-break-inside: avoid; }} @page{ size:"+p.toString()+"px "+c.toString()+"px; }</style></head><body>")):(h.document.write("<!DOCTYPE html>"),h.document.write("<html><head><style>html, body { } img { height: 100%; width: 100%; }@media print { body { }img { width:100%; width:100%; box-sizing: border-box; }br, button { display: none; } div{ page-break-inside: avoid; }} @page{ size:"+p.toString()+"px "+c.toString()+"px; }</style></head><body>")),this.multipleCanvasDataURL.forEach((function(e,r){var n=h.document.createElement("canvas");n.width=p,n.height=c;var a=n.getContext("2d"),s=new Image;s.onload=function(){a.drawImage(s,0,0,p,c),r===i.multipleCanvasDataURL.length-1&&(t.isPrintingProcessing=!1,h.print(),h.document.close(),h.close(),t.printModule.setToDefault())},s.src=e,h.document.body.appendChild(n)}))}}},t.prototype.drawBorder=function(t,r,n,i,a,s){var o=r.borderBottom,l=r.borderLeft,d=r.borderRight,h=r.borderTop,p=r.borderColor;t.strokeStyle=p||"black",(0,e.isNullOrUndefined)(o)||-1!==o.indexOf("#FFFFFF")||(t.strokeStyle=o.split(" ")[2],this.drawPath(n,(2===i?-2:i)+s,n+a,(2===i?-2:i)+s,t,o,!1,r,"bottom")),(0,e.isNullOrUndefined)(l)||-1!==l.indexOf("#FFFFFF")||(t.strokeStyle=l.split(" ")[2],this.drawPath(n,i,n,(2===i?-2:i)+s,t,l,!0,r,"left")),(0,e.isNullOrUndefined)(d)||-1!==d.indexOf("#FFFFFF")||(t.strokeStyle=d.split(" ")[2],this.drawPath(n+a,i,n+a,(2===i?-2:i)+s,t,d,!1,r,"right")),(0,e.isNullOrUndefined)(h)||-1!==h.indexOf("#FFFFFF")||(t.strokeStyle=h.split(" ")[2],this.drawPath(n,i,n+a,i,t,h,!0,r,"top"))},t.prototype.drawPath=function(t,r,n,i,a,s,o,l,d){if(a.beginPath(),s.indexOf("dashed")>-1)a.setLineDash([3,2]),a.lineWidth=s.split(" ")[0].split("")[0];else if(s.indexOf("dotted")>-1)a.setLineDash([1,1]),a.lineWidth=s.split(" ")[0].split("")[0];else{if(s.indexOf("double")>-1){a.setLineDash([]);var h=!((0,e.isNullOrUndefined)(l.borderBottom)||(0,e.isNullOrUndefined)(l.borderLeft)||(0,e.isNullOrUndefined)(l.borderRight)||(0,e.isNullOrUndefined)(l.borderTop)),p=!(0,e.isNullOrUndefined)(l.borderBottom)&&!(0,e.isNullOrUndefined)(l.borderLeft)&&(0,e.isNullOrUndefined)(l.borderRight)&&(0,e.isNullOrUndefined)(l.borderTop),c=(0,e.isNullOrUndefined)(l.borderBottom)&&!(0,e.isNullOrUndefined)(l.borderLeft)&&(0,e.isNullOrUndefined)(l.borderRight)&&!(0,e.isNullOrUndefined)(l.borderTop),u=!(0,e.isNullOrUndefined)(l.borderBottom)&&!(0,e.isNullOrUndefined)(l.borderLeft)&&(0,e.isNullOrUndefined)(l.borderRight)&&!(0,e.isNullOrUndefined)(l.borderTop),f=!(0,e.isNullOrUndefined)(l.borderBottom)&&(0,e.isNullOrUndefined)(l.borderLeft)&&!(0,e.isNullOrUndefined)(l.borderRight)&&(0,e.isNullOrUndefined)(l.borderTop),g=(0,e.isNullOrUndefined)(l.borderBottom)&&(0,e.isNullOrUndefined)(l.borderLeft)&&!(0,e.isNullOrUndefined)(l.borderRight)&&!(0,e.isNullOrUndefined)(l.borderTop),m=!(0,e.isNullOrUndefined)(l.borderBottom)&&(0,e.isNullOrUndefined)(l.borderLeft)&&!(0,e.isNullOrUndefined)(l.borderRight)&&!(0,e.isNullOrUndefined)(l.borderTop),v=(0,e.isNullOrUndefined)(l.borderBottom)&&!(0,e.isNullOrUndefined)(l.borderLeft)&&!(0,e.isNullOrUndefined)(l.borderRight)&&!(0,e.isNullOrUndefined)(l.borderTop),y=!(0,e.isNullOrUndefined)(l.borderBottom)&&!(0,e.isNullOrUndefined)(l.borderLeft)&&!(0,e.isNullOrUndefined)(l.borderRight)&&(0,e.isNullOrUndefined)(l.borderTop);a.lineWidth=1;return h?t===n?o?this.drawDoubleBorder(a,t,r,n,i,t+3,r+3,n+3,i-2):this.drawDoubleBorder(a,t,r,n,i,t-3,r+3,n-3,i-2):r===i&&(o?this.drawDoubleBorder(a,t,r,n,i,t+2,r+3,n-2,i+3):this.drawDoubleBorder(a,t,r,n,i,t+2,r-3,n-2,i-3)):p?"left"===d?this.drawDoubleBorder(a,t,r,n,i,t+3,r,n+3,i-2):this.drawDoubleBorder(a,t,r,n,i,t+2,r-3,n,i-3):c?"left"===d?this.drawDoubleBorder(a,t,r,n,i,t+3,r+2,n+3,i):this.drawDoubleBorder(a,t,r,n,i,t+2,r+3,n,i+3):u?"left"===d?this.drawDoubleBorder(a,t,r,n,i,t+3,r+3,n+3,i-2):"top"===d?this.drawDoubleBorder(a,t,r,n,i,t+2,r+3,n,i+3):this.drawDoubleBorder(a,t,r,n,i,t+2,r-3,n,i-3):f?"right"===d?this.drawDoubleBorder(a,t,r,n,i,t-3,r,n-3,i-2):this.drawDoubleBorder(a,t,r,n,i,t,r-3,n-2,i-3):g?"right"===d?this.drawDoubleBorder(a,t,r,n,i,t-3,r+3,n-3,i):this.drawDoubleBorder(a,t,r,n,i,t,r+3,n-2,i+3):m?"right"===d?this.drawDoubleBorder(a,t,r,n,i,t-3,r+3,n-3,i-2):"top"===d?this.drawDoubleBorder(a,t,r,n,i,t,r+3,n-2,i+3):this.drawDoubleBorder(a,t,r,n,i,t,r-3,n-2,i-3):v?"right"===d?this.drawDoubleBorder(a,t,r,n,i,t-3,r+3,n-3,i):"top"===d?this.drawDoubleBorder(a,t,r,n,i,t+3,r+3,n-2,i+3):this.drawDoubleBorder(a,t,r,n,i,t+3,r+3,n+3,i):y?"right"===d?this.drawDoubleBorder(a,t,r,n,i,t-3,r,n-3,i-2):"bottom"===d?this.drawDoubleBorder(a,t,r,n,i,t+2,r-3,n-2,i-3):this.drawDoubleBorder(a,t,r,n,i,t+3,r,n+3,i-2):t===n?this.drawDoubleBorder(a,t,r,n,i,t+("left"===d?3:-3),r,n+("left"===d?3:-3),i):r===i&&this.drawDoubleBorder(a,t,r,n,i,t,r+("top"===d?3:-3),n,i+("top"===d?3:-3)),void a.stroke()}a.setLineDash([]),a.lineWidth=s.split(" ")[0].split("")[0]}a.moveTo(t,r),a.lineTo(n,i),a.stroke()},t.prototype.drawDoubleBorder=function(e,t,r,n,i,a,s,o,l){e.moveTo(t,r),e.lineTo(n,i),e.moveTo(a,s),e.lineTo(o,l)},t.prototype.calculateTextPosition=function(e,t,r,n){var i,a=t;if(a>=e)switch(n.toLowerCase()){case"left":i=r+3;break;case"center":i=r+(a-e)/2;break;case"right":i=r+a-e}else i=e<t?"left"===n.toLowerCase()?r+3:"center"===n.toLowerCase()?r+(t-e)/2:r+t-e:r+3;return i},t.prototype.calculatePageCount=function(t,r,n){var i=n,a=this.columnIndex;if(0===t.columns.length){var s=Math.floor(r/this.defaultCellWidth)-(i?1:0);return Array(Math.max(1,Math.ceil(a/s))).fill(s)}for(var o=0,l=[],d=0;d<=a;d++){var h=t.columns&&t.columns[d],p=(i?27:0)+(h&&h.hidden?0:h&&!(0,e.isNullOrUndefined)(h.width)?h.width:this.defaultCellWidth);i=!1,(o+=p)>r&&(l.push(d-1),i=!0,o=p)}return(0===l.length||a>l[l.length-1])&&l.push(a),l},t.prototype.wrapText=function(t,r,n){if((0,e.isNullOrUndefined)(r))return[""];for(var i=(r="number"==typeof r?r+"":r).split(" "),a=[],s="",o=0;o<i.length;o++){var l=s+i[o]+" ";t.measureText(l).width>n&&o>0?(a.push(s),s=i[o]+" "):s=l}return a.push(s),a},t.prototype.getModuleName=function(){return"print"},t.prototype.destroy=function(){this.setToDefault(),this.totalSheetCount=[],this.parent=null},t}(),rp=function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},e(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),np=function(e,t,r,n){var i,a=arguments.length,s=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,n);else for(var o=e.length-1;o>=0;o--)(i=e[o])&&(s=(a<3?i(s):a>3?i(t,r,s):i(t,r))||s);return a>3&&s&&Object.defineProperty(t,r,s),s},ip=function(l){function d(e,t){var r=l.call(this,e)||this;return r.viewport={rowCount:0,colCount:0,height:0,topIndex:0,leftIndex:0,width:0,bottomIndex:0,rightIndex:0,beforeFreezeHeight:0,beforeFreezeWidth:0,scaleX:1,scaleY:1},r.needsID=!0,h.Inject(zh,_h,qh,nh,rh,sh,oh,th,Wn,Wh,Yh,Gh,Xh,lh,jh,mh,Wo,lo,uo,qo,Po,Lo,Kh,Vo,hh,gh,zo,Zh,uh,Go,vh,yh,Yo,Xo,Sh,Ko,tp,Ih,Jo,Eh,Zo,Nh,Qo,Jh,Rh,_o,el,ep,jo,kh,tl,Ah),t&&r.appendTo(t),r}var h;return rp(d,l),h=d,d.prototype.getCell=function(e,t,r){var n;return this.insideViewport(e,t)&&(r||(r=this.getRow(e,null,t)),t=this.getViewportIndex(t,!0),n=r?r.cells[t]:r),n},d.prototype.getRow=function(t,r,n){if(!r){var i=this.getActiveSheet(),a=this.frozenRowCount(i),s=this.frozenColCount(i);r=(0,e.isNullOrUndefined)(n)||t>a-1&&n>s-1?this.getContentTable():t<a&&n<s?this.sheetModule.getSelectAllTable():t<a?this.getColHeaderTable():this.getRowHeaderTable()}return t=this.getViewportIndex(t),r?r.rows[t]:null},d.prototype.hiddenCount=function(e,t,r,n){void 0===r&&(r="rows"),void 0===n&&(n=this.getActiveSheet());for(var i,a=0,s=e;s<=t;s++)(i=n[""+r][s])&&i.hidden&&a++;return a},d.prototype.getViewportIndex=function(e,t){var n=this.getActiveSheet(),i=this.frozenColCount(n),a=this.frozenRowCount(n);if(t){if(i){var s=r(n.topLeftCell)[1];return e<i?(e-=this.hiddenCount(s,e,"columns"),(e-=s)+1):(e-=this.hiddenCount(this.viewport.leftIndex+i,e,"columns"),e-=this.viewport.leftIndex+i)}e-=this.hiddenCount(this.viewport.leftIndex,e,"columns"),e-=this.viewport.leftIndex}else{if(a){var o=r(n.topLeftCell)[0];return e<a?(e-=this.hiddenCount(o,e),(e-=o)+1):(e-=this.hiddenCount(this.viewport.topIndex+a,e),e-=this.viewport.topIndex+a)}e-=this.hiddenCount(this.viewport.topIndex,e),e-=this.viewport.topIndex}return e},d.prototype.preRender=function(){l.prototype.preRender.call(this),this.serviceLocator=new rl,this.initServices()},d.prototype.initServices=function(){this.serviceLocator.register(kl,new e.L10n(this.getModuleName(),Ml,this.locale)),this.serviceLocator.register(Al,new Fh(this)),this.serviceLocator.register(Fl,new Th(this)),this.serviceLocator.register(Tl,new Dh(this))},d.prototype.render=function(){if(l.prototype.render.call(this),this.element.setAttribute("tabindex","0"),this.renderModule=new Jd(this),this.renderSpreadsheet(),this.wireEvents(),this.created&&!this.refreshing)if(this.created.observers){if(this.created.observers.length>0){var e={observers:this.created.observers};this.isAngular&&(e={observers:this.created.observers,currentObservers:this.created.observers},this.created.currentObservers=[]),this.createdHandler=e,this.created.observers=[]}}else this.createdHandler=this.created,this.setProperties({created:void 0},!0)},d.prototype.renderSpreadsheet=function(){this.cssClass&&(0,e.addClass)([this.element],this.cssClass.split(" ")),this.setHeight(),this.setWidth(),(0,dh.createSpinner)({target:this.element},this.createElement),this.cssClass&&-1===this.cssClass.indexOf("e-mobile-view")&&this.isMobileView()&&this.element.classList.add("e-mobile-view"),e.Browser.isDevice&&this.element.classList.add("e-device"),this.sheetModule=this.serviceLocator.getService("sheet"),this.allowScrolling&&(this.scrollModule=new ih(this)),this.scrollSettings.enableVirtualization&&new ah(this),this.renderModule.render(),new ph(this)},d.prototype.showSpinner=function(){(0,dh.showSpinner)(this.element)},d.prototype.hideSpinner=function(){(0,dh.hideSpinner)(this.element)},d.prototype.protectSheet=function(e,t,r){l.prototype.protectSheet.call(this,e,t,r)},d.prototype.unprotectSheet=function(e){l.prototype.unprotectSheet.call(this,e)},d.prototype.find=function(e){var t=this.getActiveSheet().activeCell;if(l.prototype.findHandler.call(this,e),!e.isAction)return t!==this.getActiveSheet().activeCell?this.getActiveSheet().name+"!"+this.getActiveSheet().activeCell:null},d.prototype.replace=function(t){t={value:t.value,mode:t.mode?t.mode:"Sheet",isCSen:!!t.isCSen&&t.isCSen,isEMatch:!!t.isEMatch&&t.isEMatch,searchBy:t.searchBy?t.searchBy:"By Row",replaceValue:t.replaceValue,replaceBy:t.replaceBy,sheetIndex:(0,e.isUndefined)(t.sheetIndex)?this.activeSheetIndex:t.sheetIndex,findOpt:t.findOpt?t.findOpt:""},l.prototype.replaceHandler.call(this,t)},d.prototype.findAll=function(e,t,r,n,i){var a=[],s={value:e,mode:t=t||"Sheet",sheetIndex:i=i<this.sheets.length?i:this.activeSheetIndex,isCSen:r=r||!1,isEMatch:n=n||!1,findCollection:a};return this.notify(se,s),a},d.prototype.goTo=function(e){if(e.includes("!")){var n=vn(this,Cn(e));if(void 0===n)return;if(n!==this.activeSheetIndex){var a=e.substring(e.lastIndexOf("!")+1),s=a.split(":")[0],o=this.sheets[n];this.setSheetPropertyOnMute(o,"activeCell",s),this.setSheetPropertyOnMute(o,"selectedRange",a);var l=r(s);if(o.frozenColumns||o.frozenRows){var d=r(o.topLeftCell);if(!(o.frozenRows&&l[0]<d[0]||o.frozenColumns&&l[1]<d[1])){var h=this.frozenRowCount(o),p=this.frozenColCount(o),c=[],u=[],f=r(o.paneTopLeftCell);h?(c.push(d[0]),l[0]>=h?u.push(l[0]):u.push(f[0])):(c.push(l[0]),u.push(l[0])),p?(c.push(d[1]),l[1]>=p?u.push(l[1]):u.push(f[1])):(c.push(l[1]),u.push(l[1])),this.setSheetPropertyOnMute(o,"topLeftCell",i(c[0],c[1])),this.setSheetPropertyOnMute(o,"paneTopLeftCell",i(u[0],u[1]))}}else l[0]<this.viewport.rowCount&&(l[0]=0),l[1]<this.viewport.colCount&&(l[1]=0),this.updateTopLeftCell(l[0],l[1],null,o);return this.activeSheetIndex=n,void this.dataBind()}}var g=t(e),m=this.getActiveSheet(),v=this.frozenRowCount(m),y=this.frozenColCount(m),C=this.insideViewport(g[0],g[1]);if(C){this.selectRange(e);var b=r(m.paneTopLeftCell),x=this.viewport.height;this.allowScrolling&&(x-=this.getScrollElement().parentElement.getBoundingClientRect().height);var S=0,w=0;if(v)for(var I=r(m.topLeftCell)[0];I<v;I++)if((S+=fl(m,I))>x){w=I;break}if(0===w)for(I=b[0];I<=this.viewport.bottomIndex;I++){if((S+=fl(m,I))>x){w=I;break}I===this.viewport.bottomIndex&&(w=this.viewport.bottomIndex)}b[2]=w;var E=0;if(S=0,x=this.viewport.width-this.sheetModule.getScrollSize(),y)for(I=r(m.topLeftCell)[1];I<y;I++)if((S+=Sl(m,I))>x){E=I;break}if(0===E)for(I=b[1];I<=this.viewport.rightIndex;I++){if((S+=Sl(m,I))>x){E=I;break}I===this.viewport.rightIndex&&(E=this.viewport.rightIndex)}if(b[3]=E,g[0]>=b[0]&&g[0]<b[2]&&g[1]>=b[1]&&g[1]<b[3])return;if(v||y){if(b=[].concat(r(m.topLeftCell),[v,b[3]]),g[0]>=b[0]&&g[0]<b[2]&&g[1]>=b[1]&&g[1]<b[3])return;if(b[2]=w,b[3]=y,g[0]>=b[0]&&g[0]<b[2]&&g[1]>=b[1]&&g[1]<b[3])return}}var N,R,O,k,A,F,T=this.getMainContent().parentElement;g[0]===v?O=0:(O=ml(m,v,g[0]-1,!0),this.scrollSettings.enableVirtualization&&(F=O+this.getContentTable().getBoundingClientRect().height)>(A=parseFloat(T.querySelector(".e-virtualtrack").style.height))&&(F+=10,(N=T.querySelector(".e-virtualtrack")).style.height=F+"px",Bl((function(){N.style.height=A+"px"})))),T.scrollTop=O,T=this.element.getElementsByClassName("e-scroller")[0],g[1]===y?O=0:(O=wl(m,y,g[1]-1,!0),this.scrollSettings.enableVirtualization&&(F=O+this.getContentTable().getBoundingClientRect().width)>(k=parseFloat(T.querySelector(".e-virtualtrack").style.width))&&(F+=10,(N=T.querySelector(".e-virtualtrack")).style.width=F+"px",(R=this.getColumnHeaderContent().querySelector(".e-virtualtrack")).style.width=F+"px",(N=this.getMainContent().querySelector(".e-virtualtrack")).style.width=F+"px",Bl((function(){N.style.width=k+"px",R.style.width=k+"px"})))),T.scrollLeft=O,C||this.selectRange(e)},d.prototype.insideViewport=function(e,t){var n=this.getActiveSheet();if(n.frozenRows||n.frozenColumns){var i=this.frozenRowCount(n),a=this.frozenColCount(n),s=r(n.topLeftCell);return(e>=s[0]&&e<i||e>=this.viewport.topIndex+i&&e<=this.viewport.bottomIndex)&&(t>=s[1]&&t<a||t>=this.viewport.leftIndex+a&&t<=this.viewport.rightIndex)}return e>=this.viewport.topIndex&&e<=this.viewport.bottomIndex&&t>=this.viewport.leftIndex&&t<=this.viewport.rightIndex},d.prototype.resize=function(){this.renderModule.setSheetPanelSize(),this.scrollSettings.enableVirtualization&&this.renderModule.refreshSheet(!1,!0)},d.prototype.cut=function(e){var t=new Promise((function(e){e(void 0)}));return this.notify(Ri,e?{range:o(e),sId:this.sheets[vn(this,Cn(e))]?this.sheets[vn(this,Cn(e))].id:this.getActiveSheet().id,promise:t,invokeCopy:!0,isPublic:!0}:{promise:t,invokeCopy:!0,isPublic:!0}),t},d.prototype.copy=function(e){var t=new Promise((function(e){e(void 0)}));return this.notify(Oi,e?{range:o(e),sId:this.sheets[vn(this,Cn(e))]?this.sheets[vn(this,Cn(e))].id:this.getActiveSheet().id,promise:t,invokeCopy:!0,isPublic:!0}:{promise:t,invokeCopy:!0,isPublic:!0}),t},d.prototype.paste=function(e,t){this.notify(ki,{range:e?o(e):e,sIdx:e?vn(this,Cn(e)):e,type:t,isAction:!0,isInternal:!0})},d.prototype.updateAction=function(e){Cd(e,this)},d.prototype.setHeight=function(){this.height&&(this.height.toString().indexOf("%")>-1&&(this.element.style.minHeight="400px"),this.element.style.height=(0,e.formatUnit)(this.height))},d.prototype.setWidth=function(){this.width&&((this.width.toString().indexOf("%")>-1||"auto"===this.width)&&(this.element.style.minWidth="300px"),this.element.style.width=(0,e.formatUnit)(this.width))},d.prototype.setColWidth=function(t,n,i){void 0===t&&(t=64),void 0===n&&(n=0);var a=(0,e.isNullOrUndefined)(i)?this.getActiveSheet():this.sheets[i];if(a){var s=n,o="number"==typeof t?t+"px":t;n=(0,e.isNullOrUndefined)(n)?r(a.activeCell)[1]:n;var l=function(){bl(a,s).width=parseInt(o,10)>0?parseInt(o,10):0,a.columns[s].customWidth=!0},d=this.frozenColCount(a);if(a.id===this.getActiveSheet().id){if(n>=this.viewport.leftIndex+d&&n<=this.viewport.rightIndex||d&&n<d){n=this.getViewportIndex(n,!0);var h=Sl(a,s,null,!0);(c=pd(parseInt(o,10))-h)<0&&h<-c&&(c=-h),l(),this.notify(Gi,{threshold:c,colIdx:s,checkWrapCell:!0}),gd(s,n,o,!0,this)}else{var p=Sl(a,n),c=void 0;c=parseInt(o,10)>0?-(p-parseInt(o,10)):-p,l(),this.notify(Gi,{threshold:c,colIdx:n})}this.notify(Gs,null)}else l()}},d.prototype.setRowHeight=function(t,n,i,a,s){void 0===t&&(t=20),void 0===n&&(n=0);var o=(0,e.isNullOrUndefined)(i)?this.getActiveSheet():this.sheets[i];if(o){var l=n;if(n=(0,e.isNullOrUndefined)(n)?r(o.activeCell)[0]:n,s&&o.rows[n]&&o.rows[n].customHeight)return;var d="number"==typeof t?t+"px":t,h=function(){gl(o,l,parseInt(d,10)>0?parseInt(d,10):0),o.rows[l].customHeight=!0};if(o.id===this.getActiveSheet().id){var p=this.frozenRowCount(o);if(n>=this.viewport.topIndex+p&&n<=this.viewport.bottomIndex||p&&n<p){n=this.getViewportIndex(l);var c=fl(o,l,!0);(f=pd(parseInt(d,10))-c)<0&&c<-f&&(f=-c),h(),this.notify(Wi,{threshold:f,rowIdx:l,isCustomHgt:!0}),(0,e.isNullOrUndefined)(a)&&(a=!1),a||(gd(l,n,d,!1,this),a=!1)}else{var u=fl(o,n),f=void 0;f=parseInt(d,10)>0?-(u-parseInt(d,10)):-u,h(),this.notify(Wi,{threshold:f,rowIdx:l})}this.notify(Gs,null)}else h()}},d.prototype.setRowsHeight=function(e,t,r){void 0===e&&(e=20),t||(t=["1:"+(this.getActiveSheet().usedRange.rowIndex+1)]),this.setSize(e,t,(function(e){return Number(e)-1}),this.setRowHeight.bind(this),r)},d.prototype.setColumnsWidth=function(e,t){void 0===e&&(e=64),t||(t=["A:"+s(this.getActiveSheet().usedRange.colIndex+1)]),this.setSize(e,t,(function(e){return n(e)}),this.setColWidth.bind(this))},d.prototype.setSize=function(e,t,r,n,i){var a,s,o,l,d,h=this;t.forEach((function(t){t.includes("!")?(o=t.substring(0,t.lastIndexOf("!")),a=vn(h,o),t=t.substring(t.lastIndexOf("!")+1)):a=h.activeSheetIndex,t.includes(":")?(s=t.split(":"),l=r(s[0]),d=r(s[1])):l=d=r(t);for(var p=l;p<=d;p++)n(e,p,a,!1,i)}))},d.prototype.autoFit=function(e){var t;-1!==e.indexOf("!")&&(t=vn(this,e.substring(0,e.lastIndexOf("!"))),e=e.substring(e.lastIndexOf("!")+1));var r=this.getIndexes(e),i=r.startIdx,a=r.endIdx,s=r.isCol,o=s?n("XFD"):1048576;if(i<=o)for(a>o&&(a=o);i<=a;i++)this.notify(Ta,{idx:i,isCol:s,sheetIdx:t})},d.prototype.getIndexes=function(t){var r,i,a,s;if(-1!==t.indexOf(":")){var o=t.split(":");a=o[0],s=o[1]}else a=t,s=t;if(!(0,e.isNullOrUndefined)(a)){var l=this.getAddress(a);a=l.address,r=l.isCol}if(!(0,e.isNullOrUndefined)(s)){var d=this.getAddress(s);s=d.address,i=d.isCol}var h=!0===r&&!0===i;return{startIdx:h?n(a.toUpperCase()):parseInt(a,10),endIdx:h?n(s.toUpperCase()):parseInt(s,10),isCol:h}},d.prototype.getAddress=function(e){var t;return e.substring(0,1).match(/\D/g)?(t=!0,{address:e=e.replace(/[0-9]/g,""),isCol:t}):e.substring(0,1).match(/[0-9]/g)&&e.match(/\D/g)?{address:"",isCol:!1}:{address:e=(parseInt(e,10)-1).toString(),isCol:t}},d.prototype.addHyperlink=function(e,t,r){this.insertHyperlink(e,t,r,!0)},d.prototype.removeHyperlink=function(e){this.notify(ca,{range:e,preventEventTrigger:!0})},d.prototype.insertHyperlink=function(e,r,n,i){if(this.allowHyperlink){var a=void 0,s=void 0,o=void 0,l=this.getActiveSheet();if(zd(this,o=t(r=r||l.name+"!"+l.activeCell)))return void this.notify(Ka,null);for(var d=this.getCell(o[0],o[1]),h=[],p=0;d&&p<d.classList.length;p++)h.push(d.classList[p]);var c={hyperlink:e,address:r,displayText:n,cancel:!1},u={hyperlink:e,address:r,displayText:n};if(i||(this.trigger(Pe,c),this.notify(K,{action:"hyperlink",eventArgs:c})),!c.cancel){var f={hyperlink:e=c.hyperlink,cell:r=c.address,displayText:n,triggerEvt:!i};if(this.notify(Ve,f),r&&-1!==r.lastIndexOf("!")){var g=r.lastIndexOf("!");a=r.substring(0,g);for(var m=this.sheets,v=0;v<m.length;v++)m[v].name===a&&(s=v);l=this.sheets[s],r=r.substring(g+1)}if(!l)return;if(o=t(r=r||this.getActiveSheet().activeCell),i||(this.trigger(Me,u),this.notify(ka,{action:"hyperlink",eventArgs:c})),l===this.getActiveSheet()){this.serviceLocator.getService("cell").refreshRange(o,!1,!1,!1,!0,Yr(this));for(p=0;p<h.length;p++)this.getCell(o[0],o[1]).classList.contains(h[p])||this.getCell(o[0],o[1]).classList.add(h[p]);this.notify(Mt,null)}}}},d.prototype.addDataValidation=function(e,t){l.prototype.addDataValidation.call(this,e,t)},d.prototype.removeDataValidation=function(e){this.notify(Qe,{range:e,isRemoveValidation:!0,viewport:this.viewport})},d.prototype.addInvalidHighlight=function(e){var t=e||this.dataValidationRange;if(t.indexOf(",")>-1){var r="";t.includes("!")&&(r=t.substring(0,t.lastIndexOf("!"))+"!",t=t.substring(t.lastIndexOf("!")+1));for(var n=t.split(","),i=0;i<n.length-1;i++)l.prototype.addInvalidHighlight.call(this,r+n[i])}else l.prototype.addInvalidHighlight.call(this,t)},d.prototype.removeInvalidHighlight=function(e){var t=e||this.dataValidationRange;if(t.indexOf(",")>-1){var r="";t.includes("!")&&(r=t.substring(0,t.lastIndexOf("!"))+"!",t=t.substring(t.lastIndexOf("!")+1));for(var n=t.split(","),i=0;i<n.length-1;i++)l.prototype.removeInvalidHighlight.call(this,r+n[i])}else l.prototype.removeInvalidHighlight.call(this,t)},d.prototype.conditionalFormat=function(e){l.prototype.conditionalFormat.call(this,e)},d.prototype.clearConditionalFormat=function(e){e=e||this.getActiveSheet().selectedRange,l.prototype.clearConditionalFormat.call(this,e)},d.prototype.setPanelSize=function(){if("auto"!==this.height){var e=document.getElementById(this.element.id+"_sheet_panel");e.style.height=this.element.getBoundingClientRect().height*this.viewport.scaleY-jl(e,null,this.viewport.scaleY)+"px"}},d.prototype.open=function(e){this.isOpen=!0,l.prototype.open.call(this,e),this.isOpen&&this.showSpinner()},d.prototype.hideRow=function(e,t,r){void 0===t&&(t=e),void 0===r&&(r=!0),this.renderModule?this.notify(Rt,{startIndex:e,endIndex:t,hide:r}):l.prototype.hideRow.call(this,e,t,r)},d.prototype.hideColumn=function(e,t,r){void 0===t&&(t=e),void 0===r&&(r=!0),this.renderModule?this.notify(Rt,{startIndex:e,endIndex:t,hide:r,isCol:!0}):l.prototype.hideColumn.call(this,e,t,r)},d.prototype.clear=function(e){this.notify(os,{options:e})},d.prototype.refresh=function(e){var t=this;if(this.isReact&&this.clearTemplate(),e)this.notify(Ai,null),this.sheets.length=0,this.sheetNameCount=1,this.notify(xe,{}),this.notify(ba,null),this.createSheet(),this.activeSheetIndex=this.sheets.length-1,this.notify(Kn,null),this.notify(pe,{action:"initSheetInfo"}),this.renderModule.refreshSheet();else if(this.createdHandler){var r=function(){t.off(Ya,r),t.refresh()};this.on(Ya,r,this)}else this.notify(Xi,{}),l.prototype.refresh.call(this)},d.prototype.insertImage=function(e,t){var r;for(r=0;r<e.length;r++)this.notify(bs,{options:e[r],range:t||this.getActiveSheet().selectedRange,isPublic:!0})},d.prototype.deleteImage=function(e,t){this.notify(xs,{id:e,range:t||this.getActiveSheet().selectedRange})},d.prototype.getRowHeaderContent=function(){return this.sheetModule.getRowHeaderPanel()},d.prototype.getColumnHeaderContent=function(){return this.sheetModule.getColHeaderPanel()},d.prototype.getMainContent=function(){return this.sheetModule.getContentPanel()},d.prototype.getSelectAllContent=function(){return this.sheetModule.getSelectAllContent()},d.prototype.getScrollElement=function(){return this.sheetModule.getScrollElement()},d.prototype.getContentTable=function(){return this.sheetModule.getContentTable()},d.prototype.getRowHeaderTable=function(){return this.sheetModule.getRowHeaderTable()},d.prototype.getColHeaderTable=function(){return this.sheetModule.getColHeaderTable()},d.prototype.getThreshold=function(e){var t=Math.round((this.viewport[e+"Count"]+1)/2);return t<15?15:t},d.prototype.isMobileView=function(){return!(0,e.isNullOrUndefined)(this.cssClass)&&(this.cssClass.indexOf("e-mobile-view")>-1||e.Browser.isDevice)&&-1===this.cssClass.indexOf("e-desktop-view")&&!1},d.prototype.getValueRowCol=function(e,t,r,n,i,a,s){return l.prototype.getValueRowCol.call(this,e,t,r,n,i,a,s)},d.prototype.updateCell=function(t,r,n){(0,e.isNullOrUndefined)(n)&&(n=!0),this.updateCellInfo(t,r,n)},d.prototype.updateCellInfo=function(e,r,n,i,a){zd(this,t(r=r||this.getActiveSheet().activeCell))||l.prototype.updateCellDetails.call(this,e,r,i,a,n)},d.prototype.getRowData=function(e,t){return l.prototype.getRowData.call(this,e,t)},d.prototype.sort=function(e,t){var r=this;if(!this.allowSorting)return Promise.reject();var n=[];if(this.sortCollection)for(var i=this.sortCollection.length-1;i>=0;i--)this.sortCollection[i]&&this.sortCollection[i].sheetIndex===this.activeSheetIndex&&(n.push(this.sortCollection[i]),this.sortCollection.splice(i,1));return this.notify(Ia,{sortOptions:e}),l.prototype.sort.call(this,e,t,n).then((function(e){return r.notify(Te,e),Promise.resolve(e)}))},d.prototype.setValueRowCol=function(e,t,r,n,i,a){if(!this.isEdit&&"#CIRCULARREF!"===t){var o={action:"isCircularReference",argValue:t,address:(h=In(this,yn(this,e))).name+"!"+s(n)+r};this.notify(ti,o),t=o.argValue}if(l.prototype.setValueRowCol.call(this,e,t,r,n,i,a),this.allowEditing)this.notify(ei,{action:"refreshDependentCellValue",rowIdx:r,colIdx:n,sheetIdx:yn(this,e)});else{var d=yn(this,e);if(r--,n--,this.activeSheetIndex===d){var h,p=void 0;if(cl(h=In(this,d),r)||Il(h,n)||(p=this.getCell(r,n)),p){if(p.parentElement){var c=p.parentElement.getAttribute("aria-rowindex");if(c&&Number(c)-1!==r)return}var u=Ln(r,n,h),f={value:u.value,format:u.format,onLoad:!0,formattedText:u.value,isRightAlign:!1,type:"General",cell:u,rowIndex:r,colIndex:n,isRowFill:!1};this.notify(re,f),this.refreshNode(p,f)}}}},d.prototype.getModuleName=function(){return"spreadsheet"},d.prototype.calculateNow=function(e,t){return l.prototype.calculateNow.call(this,e,t)},d.prototype.refreshNode=function(t,r){var n;if(t){if(r){if(r.result=(0,e.isNullOrUndefined)(r.formattedText)?(0,e.isNullOrUndefined)(r.result)?"":r.result:r.formattedText.toString(),!r.isRowFill){var a=t.querySelector(".e-fill-before");a&&(0,e.detach)(a);var s=(0,e.select)(".e-fill",t);s&&((0,e.detach)(s),t.style.display="table-cell");var o=(0,e.select)(".e-fill-sec",t);o&&(0,e.detach)(o)}var l=(0,e.select)("#"+this.element.id+"_currency",t);if(l&&(0,e.detach)(l),"Accounting"===r.type&&rn(r.value)&&r.result.includes(r.curSymbol)){var d=void 0,h=void 0,p=void 0;r.result.trim().endsWith(r.curSymbol)?h=r.result:(d=r.result.includes(" "+r.curSymbol)?" "+r.curSymbol:r.curSymbol,h=r.result.split(d).join(""));var c=t.querySelector(".e-databar-value"),u=t.querySelector(".e-iconsetspan"),f=t,g=void 0;if(t.children.length>0&&t.children[t.childElementCount-1].className.indexOf("e-addNoteIndicator")>-1&&(g=document.getElementsByClassName("e-addNoteIndicator")[0]),c?(this.refreshNode(c,{result:h}),f=t.querySelector(".e-cf-databar")||t):t.querySelector("a")?t.querySelector("a").textContent=h:(p=!0,t.innerText=""),u&&t.insertBefore(u,t.firstElementChild),d){var m=this.createElement("span",{id:this.element.id+"_currency",styles:"float: left"});m.innerText=d,f.appendChild(m),(0,e.isNullOrUndefined)(g)||f.appendChild(g)}return p&&(t.innerHTML+=h),void t.classList.add("e-right-align")}var v=void 0;!r.result||"true"!==r.result.toLowerCase()&&"false"!==r.result.toLowerCase()?v="e-right-align":(r.result=r.result.toUpperCase(),v="e-center-align",r.isRightAlign=!0),n=r.result,this.allowWrap||n.toString().includes("\n")&&(n=n.replace(/\n/g,"")),r.isRightAlign?t.classList.add(v):t.classList.remove(v)}n=(0,e.isNullOrUndefined)(n)?"":n,(0,e.isNullOrUndefined)(r.rowIndex)||(0,e.isNullOrUndefined)(r.colIndex)||(0,e.attributes)(t,{"aria-label":(n?n+" ":"")+i(r.rowIndex,r.colIndex)});var y=t.lastChild;y&&"SPAN"===y.nodeName&&y.classList.contains("e-iconsetspan")&&(y=null),t.querySelector(".e-databar-value")&&(y=t.querySelector(".e-databar-value").lastChild),t.querySelector(".e-hyperlink")&&(y=t.querySelector(".e-hyperlink").lastChild),t.querySelector(".e-addNoteIndicator")&&(y=t.firstChild);var C=t.querySelector(".e-wrap-content");if(C&&(C.lastChild||C.appendChild(document.createTextNode("")),y=C.lastChild),(this.isAngular||this.isVue)&&t.classList.contains("e-cell-template")&&y&&(8===y.nodeType||3===y.nodeType)){if(3===y.nodeType||""!==n){var b=function(){t.childElementCount||(3===y.nodeType?r.isRowFill||(y.nodeValue=n):t.appendChild(document.createTextNode(n)))};this.isAngular?Bl(b):b()}}else!y||3!==y.nodeType&&1!==y.nodeType?t.appendChild(document.createTextNode(n)):r.isRowFill||(!(0,e.isNullOrUndefined)(y.className)&&y.className.indexOf("e-addNoteIndicator")>-1?(y=t.lastChild).nodeValue=n:y.nodeValue=n)}},d.prototype.calculateHeight=function(e,t,r){void 0===t&&(t=1),void 0===r&&(r=1);var n=e&&e.fontSize||this.cellStyle.fontSize,i="Arial Black"===e.fontFamily?1.44:1.24;return(n.indexOf("pt")>-1?1.33*parseInt(n,10):parseInt(n,10))*i*t+r*i},d.prototype.skipHidden=function(e,t,r,n){void 0===r&&(r="rows"),void 0===n&&(n=this.scrollSettings.isFinite);var i,a=this.getActiveSheet();this.scrollSettings.isFinite&&(i=("rows"===r?a.rowCount:a.colCount)-1);for(var s=e;s<=t;s++)if(a[""+r][s]&&a[""+r][s].hidden){if(e===s&&e++,t++,n&&t>i){t=i;break}}else if(!n&&this.scrollSettings.isFinite&&t>i&&a[""+r][s-1]&&a[""+r][s-1].hidden){t--;break}return[e,t]},d.prototype.updateActiveBorder=function(t,r){void 0===r&&(r=".e-ribbon");var n=(0,e.select)(r+" .e-tab-header .e-indicator",this.element);n.style.display="none",(0,e.setStyleAttribute)(n,{left:"",right:""}),(0,e.setStyleAttribute)(n,{left:t.offsetLeft+"px",right:t.parentElement.offsetWidth-(t.offsetLeft+t.offsetWidth)+"px"}),n.style.display=""},d.prototype.undo=function(){this.notify(ma,{isUndo:!0,isPublic:!0})},d.prototype.redo=function(){this.notify(ma,{isUndo:!1,isPublic:!0})},d.prototype.updateUndoRedoCollection=function(e){this.notify(va,{args:e,isPublic:!0})},d.prototype.addDefinedName=function(e){var t={action:"addDefinedName",isAdded:!1,definedName:e};return this.notify(ti,t),t.isAdded},d.prototype.removeDefinedName=function(e,t){return l.prototype.removeDefinedName.call(this,e,t)},d.prototype.mouseClickHandler=function(e){this.notify(ni,e)},d.prototype.mouseDownHandler=function(e){this.notify(Jn,e)},d.prototype.keyUpHandler=function(t){(0,e.closest)(t.target,".e-find-dlg")?this.notify(lt,t):this.notify(ii,t)},d.prototype.keyDownHandler=function(t){var r=(0,e.closest)(t.target,".e-findtool-dlg");if(r){if(9===t.keyCode){var n=t.target;if(t.shiftKey){if(n.classList.contains("e-text-findNext-short")){var i=r.querySelector(".e-findRib-close .e-tbar-btn");i&&(t.preventDefault(),i.focus())}}else n.classList.contains("e-tbar-btn")&&n.parentElement.classList.contains("e-findRib-close")&&Fd(r)}}else{this.notify(ai,t);var a=(0,e.closest)(t.target,".e-dialog");this.enableKeyboardNavigation||!document.activeElement.classList.contains("e-cell")&&!a||[38,40,33,34,35,36,9].indexOf(t.keyCode)>-1&&t.preventDefault()}},d.prototype.freeze=function(e){if(!(!this.allowFreezePane||e.row<0||e.column<0)){if(e.triggerEvent){var t={row:e.row,column:e.column,cancel:!1,sheetIndex:this.activeSheetIndex};if(this.notify(K,{eventArgs:t,action:"freezePanes"}),t.cancel)return}this.on(Zn,this.freezePaneUpdated,this),this.freezePanes(e.row,e.column),this.notify(Mt,null)}},d.prototype.freezePaneUpdated=function(){this.off(Zn,this.freezePaneUpdated);var e=this.getActiveSheet();Fd(this.element),this.notify(ka,{eventArgs:{row:e.frozenRows,column:e.frozenColumns,sheetIndex:this.activeSheetIndex},action:"freezePanes"})},d.prototype.wireEvents=function(){e.EventHandler.add(this.element,"click",this.mouseClickHandler,this),e.EventHandler.add(this.element,Zl(),this.mouseDownHandler,this),e.EventHandler.add(this.element,"keyup",this.keyUpHandler,this),e.EventHandler.add(this.element,"keydown",this.keyDownHandler,this),this.on(js,this.freeze,this),this.on(nr,this.refreshInsertDelete,this)},d.prototype.destroy=function(){this.isReact&&this.clearTemplate(),this.unwireEvents(),this.notify(Qn,null),l.prototype.destroy.call(this),this.element.innerHTML="",this.element.removeAttribute("tabindex"),this.element.removeAttribute("role"),this.element.style.removeProperty("height"),this.element.style.removeProperty("width"),this.element.style.removeProperty("min-height"),this.element.style.removeProperty("min-width"),this.sheetModule&&this.sheetModule.destroy()},d.prototype.unwireEvents=function(){e.EventHandler.remove(this.element,"click",this.mouseClickHandler),e.EventHandler.remove(this.element,Zl(),this.mouseDownHandler),e.EventHandler.remove(this.element,"keyup",this.keyUpHandler),e.EventHandler.remove(this.element,"keydown",this.keyDownHandler),this.off(js,this.freeze),this.off(nr,this.refreshInsertDelete)},d.prototype.refreshInsertDelete=function(e){var r,n=this;"Sheet"!==e.modelType&&(e.sheet.ranges.forEach((function(i){i.template&&i.address&&(r=t(i.address),n.updateRangeOnInsertDelete(e,r)&&(i.address=a(r)))})),this.setSheetPropertyOnMute(e.sheet,"ranges",e.sheet.ranges))},d.prototype.addContextMenuItems=function(e,t,r,n){void 0===r&&(r=!0),this.notify(Di,{items:e,text:t,insertAfter:r,isUniqueId:n})},d.prototype.removeContextMenuItems=function(e,t){this.notify(Li,{items:e,isUniqueId:t})},d.prototype.enableContextMenuItems=function(e,t,r){void 0===t&&(t=!0),this.notify(Pi,{items:e,enable:t,isUniqueId:r})},d.prototype.enableFileMenuItems=function(e,t,r){void 0===t&&(t=!0),this.notify(Mi,{items:e,enable:t,isUniqueId:r})},d.prototype.hideFileMenuItems=function(e,t,r){void 0===t&&(t=!0),this.notify(Bi,{items:e,hide:t,isUniqueId:r})},d.prototype.addFileMenuItems=function(e,t,r,n){void 0===r&&(r=!0),this.notify(Hi,{items:e,text:t,insertAfter:r,isUniqueId:n})},d.prototype.hideRibbonTabs=function(e,t){void 0===t&&(t=!0),this.notify(Ui,{tabs:e,hide:t})},d.prototype.enableRibbonTabs=function(e,t){void 0===t&&(t=!0),this.notify(Vi,{tabs:e,enable:t})},d.prototype.addRibbonTabs=function(e,t){this.notify(zi,{items:e,insertBefore:t})},d.prototype.enableToolbarItems=function(e,t,r){this.notify(wi,[{tab:e,items:t,enable:void 0===r||r}])},d.prototype.hideToolbarItems=function(e,t,r){void 0===r&&(r=!0),this.notify(ji,{tab:e,indexes:t,hide:r})},d.prototype.addToolbarItems=function(e,t,r){this.notify(_i,{tab:e,items:t,index:r})},d.prototype.selectRange=function(e){this.isEdit&&this.notify(ei,{action:"endEdit"}),this.notify(Ei,{address:e})},d.prototype.selectChart=function(e){this.selectOverlay(e,!0)},d.prototype.selectImage=function(e){this.selectOverlay(e)},d.prototype.selectOverlay=function(e,t){var n=this.getActiveSheet();if(!n.isProtected&&this.allowEditing){if(!e){var i=r(n.activeCell),a=Ln(i[0],i[1],n,!1,!0);t?a.chart&&a.chart.length&&(e=a.chart[a.chart.length-1].id):a.image&&a.image.length&&(e=a.image[a.image.length-1].id)}var s;if(e?(s=this.element.querySelector("#"+e)).classList.contains("e-ss-overlay")||(s=s.parentElement):s=this.element.querySelector(".e-ss-overlay"+(t?".e-datavisualization-chart":":not(.e-datavisualization-chart)")),s){var o=void 0,l=this.element.getElementsByClassName("e-ss-overlay-active")[0];l&&(l.classList.remove("e-ss-overlay-active"),(o=l.classList.contains("e-datavisualization-chart"))&&this.notify(Os,null)),s.classList.add("e-ss-overlay-active"),s.classList.contains("e-datavisualization-chart")?(this.notify(zt,{id:s.id}),o||this.notify(Fs,{id:s.id})):o&&this.notify(Ts,null)}}},d.prototype.deselectChart=function(){this.notify(ms,{selector:".e-datavisualization-chart"})},d.prototype.deselectImage=function(){this.notify(ms,{selector:":not(.e-datavisualization-chart)"})},d.prototype.startEdit=function(){this.notify(ei,{action:"startEdit",isNewValueEdit:!1})},d.prototype.closeEdit=function(){this.notify(ei,{action:"cancelEdit"})},d.prototype.endEdit=function(){this.notify(ei,{action:"endEdit",isPublic:!0})},d.prototype.print=function(t){void 0===t&&(t={type:"ActiveSheet",allowRowColumnHeader:!1,allowGridLines:!1}),this.allowPrint&&!(0,e.isNullOrUndefined)(this.printModule)&&this.printModule.print(this,t)},d.prototype.onPropertyChanged=function(t,n){var i,a=this;l.prototype.onPropertyChanged.call(this,t,n);for(var s=0,o=Object.keys(t);s<o.length;s++){var d=o[s],h=void 0,p=void 0,c=this.getActiveSheet(),u=this.getScrollElement();switch(d){case"enableRtl":if(t.locale||t.currencyCode)break;if((h=this.getColumnHeaderContent())&&(h=h.parentElement),!h)break;if(t.enableRtl?(h.style.marginRight="",document.getElementById(this.element.id+"_sheet_panel").classList.add("e-rtl")):(h.style.marginLeft="",document.getElementById(this.element.id+"_sheet_panel").classList.remove("e-rtl")),this.allowScrolling&&this.scrollModule.setPadding(!0),this.allowAutoFill){var f=this.element.querySelector(".e-dragfill-ddb");if(f){var g=(0,e.getComponent)(f,"dropdown-btn");g&&(g.enableRtl=t.enableRtl,g.dataBind())}}if(this.sheetModule.setPanelWidth(c,this.getRowHeaderContent(),!0),this.allowImage||this.allowChart)for(var m=this.element.getElementsByClassName("e-ss-overlay"),v=void 0,y=void 0,C=void 0,b=0,x=m.length-1;b<=x;b++)(y=m[0]).classList.contains("e-datavisualization-chart")&&(v=(C=y.querySelector(".e-accumulationchart"))?(0,e.getComponent)(C,"accumulationchart"):(C=y.querySelector(".e-chart"))&&(0,e.getComponent)(C,"chart"))&&v.destroy(),(0,e.detach)(y),b===x&&this.notify(tr,{});u&&(u.scrollLeft=0),this.selectRange(c.selectedRange);break;case"cssClass":n.cssClass&&(0,e.removeClass)([this.element],n.cssClass.split(" ")),t.cssClass&&(0,e.addClass)([this.element],t.cssClass.split(" "));break;case"activeSheetIndex":this.renderModule.refreshSheet(),this.notify(Ki,{idx:t.activeSheetIndex});break;case"width":this.setWidth(),this.resize();break;case"height":this.setHeight(),this.resize();break;case"showRibbon":this.notify(Gn,{prop:"showRibbon",onPropertyChange:!0});break;case"showFormulaBar":this.notify(Yn,{uiUpdate:!0});break;case"showSheetTabs":this.notify(Xn,null);break;case"cellStyle":this.renderModule.refreshSheet();break;case"allowEditing":if(this.allowEditing){if(this.notify(ei,{action:"renderEditor"}),this.enableKeyboardNavigation){this.enableKeyboardNavigation=!1,this.dataBind(),this.enableKeyboardNavigation=!0,this.dataBind();var S=this.selectionSettings.mode;"None"!==S&&(this.selectionSettings.mode="None",this.dataBind(),this.selectionSettings.mode=S,this.dataBind())}}else this.notify(ms,null);break;case"allowInsert":(p=this.element.getElementsByClassName("e-add-sheet-tab")[0])&&(p.disabled=!this.allowInsert,this.allowInsert?p.classList.contains("e-disabled")&&p.classList.remove("e-disabled"):p.classList.contains("e-disabled")||p.classList.add("e-disabled"));break;case"sheets":if(t.sheets===this.sheets){this.renderModule.refreshSheet(),this.notify(Kn,null),this.notify(pe,{action:"initSheetInfo"});break}Object.keys(t.sheets).forEach((function(s,o){var l=Number(s),d=t.sheets[l],h=In(a,l);if(d.ranges&&Object.keys(d.ranges).length){var p,c,u,f,g,m=Object.keys(d.ranges);m.forEach((function(e,t){d.ranges[Number(e)].info||(p=t)})),m.forEach((function(t,r){((0,e.isUndefined)(p)||p===r)&&(c=Number(t),u=d.ranges[c],f=h.ranges[c],g=u.dataSource,u.fieldsOrder&&f.info&&!g&&f.dataSource&&(g=f.dataSource),g&&a.notify(q,{sheetIdx:l,rangeIdx:c,changedData:g}))}))}else if(d.paneTopLeftCell&&n.sheets&&n.sheets[""+l]&&n.sheets[""+l].paneTopLeftCell){if(a.activeSheetIndex!==Number(l))return;var v=r(d.paneTopLeftCell),y=r(n.sheets[""+l].paneTopLeftCell);if(v[0]!==y[0]){var C=a.frozenRowCount(a.getActiveSheet()),b=v[0]>C?ml(a.getActiveSheet(),C,v[0]-1):0;a.notify(Ws,{top:b})}if(v[1]!==y[1]){var x=a.frozenColCount(a.getActiveSheet()),S=v[1]>x?wl(a.getActiveSheet(),x,v[1]-1):0;a.notify(Ws,{left:S})}}else if(0===o&&a.renderModule.refreshSheet(),a.showSheetTabs&&d.name&&!i){var w=(0,e.select)(".e-sheet-tabs-items",a.element),I=Number(l);w.children[I+1]?a.notify(fa,{items:w,value:d.name,idx:I}):(a.notify(Kn,null),i=!0)}}));break;case"locale":this.refresh();break;case"currencyCode":t.locale||this.refresh();break;case"password":this.password.length>0&&this.showSheetTabs&&(this.element.querySelector(".e-add-sheet-tab").setAttribute("disabled","true"),this.element.querySelector(".e-add-sheet-tab").classList.add("e-disabled"));break;case"isProtected":if(this.isProtected){var w=this.element.getElementsByClassName("e-add-sheet-tab")[0];w&&(w.disabled=this.isProtected,this.isProtected?w.classList.contains("e-disabled")&&w.classList.add("e-disabled"):w.classList.contains("e-disabled")||w.classList.remove("e-disabled"))}break;case"allowFreezePane":this.notify(Gn,{prop:"allowFreezePane",onPropertyChange:!0});break;case"allowImage":case"allowChart":this.renderModule.refreshSheet(),this.notify(Gn,{prop:d,onPropertyChange:!0});break;case"calculationMode":"Manual"===n.calculationMode&&this.notify(pe,{action:"ClearDependentCellCollection"}),this.notify(Gn,{prop:d,onPropertyChange:!0});break;case"allowResizing":t.allowResizing&&this.notify(so,{propertyName:d});break;case"enableNotes":t.enableNotes&&this.notify(tr,{});break;case"allowNumberFormatting":case"allowWrap":case"allowCellFormatting":this.notify(Gn,{prop:d,onPropertyChange:!0}),this.notify(tr,{});break;case"showAggregate":this.notify(ns,{remove:!this.showAggregate})}}},d.prototype.requiredModules=function(){return Nl(this)},d.prototype.appendTo=function(e){l.prototype.appendTo.call(this,e)},d.prototype.filter=function(e,t){return this.allowFiltering?(t=t||this.getActiveSheet().selectedRange,l.prototype.filter.call(this,e,t)):Promise.reject()},d.prototype.clearFilter=function(e,t){this.notify(Ra,{field:e,sheetIndex:t})},d.prototype.applyFilter=function(e,t){var r=this;if(!this.allowFiltering)return Promise.reject();var n,i=new Promise((function(e){e(void 0)}));e&&e.length&&e.forEach((function(e){n={instance:{options:{type:e.type,format:"date"===e.type&&"yMd"}},arg3:e.value,arg2:e.operator},r.notify($h.fltrPrevent,n),e.value=n.arg3}));var a={predicates:e,range:t,isInternal:!0,promise:i,sIdx:t?p(this,t):this.activeSheetIndex};return this.notify(xa,a),a.promise},d.prototype.addCustomFunction=function(e,t,r){l.prototype.addCustomFunction.call(this,e,t,r),this.notify(Da,null)},d.prototype.setRangeReadOnly=function(r,n,i){n=n||this.getActiveSheet().selectedRange;var a=i||this.activeSheetIndex,s=c(t(n)),o=In(this,a);if(!(0,e.isNullOrUndefined)(o)){if(this.notify("actionBegin",{action:"readonly",eventArgs:{readOnly:r,range:n,sheetIdx:a}}),this.isColumnRange(n)||0===s[0]&&s[2]===o.rowCount-1)for(var l=s[1];l<=s[3];l++)if(r)xl(o,l,{isReadOnly:r});else{var d=bl(o,l);d&&d.isReadOnly&&delete d.isReadOnly}else if(this.isRowRange(n)||0===s[1]&&s[3]===o.colCount-1)for(var h=s[0];h<=s[2];h++)if(r)pl(o,h,{isReadOnly:r});else{var p=hl(o,h);p&&p.isReadOnly&&delete p.isReadOnly}else for(var u=s[1];u<=s[3];u++)for(var f=s[0];f<=s[2];f++){if(r)Pn(f,u,o,{isReadOnly:r},!0);else(v=Ln(f,u,o))&&v.isReadOnly&&delete v.isReadOnly}for(var g=s[1];g<=s[3];g++)for(var m=s[0];m<=s[2];m++){var v=this.getCell(m,g);!r&&v&&v.classList.contains("e-readonly")?v.classList.remove("e-readonly"):v&&!v.classList.contains("e-readonly")&&(v.className+=" e-readonly")}this.notify("actionComplete",{action:"readonly",eventArgs:{readOnly:r,range:n,sheetIdx:a}})}},d.prototype.isColumnRange=function(e){var t=!0;return Array.from(e).forEach((function(e){e>="A"&&e<="Z"||e>="a"&&e<="z"||":"===e||(t=!1)})),t},d.prototype.isRowRange=function(e){var t=!0;return Array.from(e).forEach((function(e){e>="0"&&e<="9"||":"===e||(t=!1)})),t},np([(0,e.Property)("")],d.prototype,"cssClass",void 0),np([(0,e.Property)(!0)],d.prototype,"allowScrolling",void 0),np([(0,e.Property)(!0)],d.prototype,"allowResizing",void 0),np([(0,e.Property)(!0)],d.prototype,"showAggregate",void 0),np([(0,e.Property)(!0)],d.prototype,"enableClipboard",void 0),np([(0,e.Property)(!0)],d.prototype,"enableContextMenu",void 0),np([(0,e.Property)(!0)],d.prototype,"enableKeyboardNavigation",void 0),np([(0,e.Property)(!0)],d.prototype,"enableKeyboardShortcut",void 0),np([(0,e.Property)(!0)],d.prototype,"allowUndoRedo",void 0),np([(0,e.Property)(!0)],d.prototype,"allowWrap",void 0),np([(0,e.Complex)({},Xd)],d.prototype,"selectionSettings",void 0),np([(0,e.Complex)({},Yd)],d.prototype,"scrollSettings",void 0),np([(0,e.Event)()],d.prototype,"beforeCellRender",void 0),np([(0,e.Event)()],d.prototype,"beforeSelect",void 0),np([(0,e.Event)()],d.prototype,"select",void 0),np([(0,e.Event)()],d.prototype,"contextMenuBeforeOpen",void 0),np([(0,e.Event)()],d.prototype,"fileMenuBeforeOpen",void 0),np([(0,e.Event)()],d.prototype,"contextMenuBeforeClose",void 0),np([(0,e.Event)()],d.prototype,"dialogBeforeOpen",void 0),np([(0,e.Event)()],d.prototype,"fileMenuBeforeClose",void 0),np([(0,e.Event)()],d.prototype,"contextMenuItemSelect",void 0),np([(0,e.Event)()],d.prototype,"fileMenuItemSelect",void 0),np([(0,e.Event)()],d.prototype,"beforeDataBound",void 0),np([(0,e.Event)()],d.prototype,"dataBound",void 0),np([(0,e.Event)()],d.prototype,"dataSourceChanged",void 0),np([(0,e.Event)()],d.prototype,"cellEdit",void 0),np([(0,e.Event)()],d.prototype,"cellEditing",void 0),np([(0,e.Event)()],d.prototype,"cellEdited",void 0),np([(0,e.Event)()],d.prototype,"cellSave",void 0),np([(0,e.Event)()],d.prototype,"beforeCellSave",void 0),np([(0,e.Event)()],d.prototype,"created",void 0),np([(0,e.Event)()],d.prototype,"beforeSort",void 0),np([(0,e.Event)()],d.prototype,"beforeHyperlinkCreate",void 0),np([(0,e.Event)()],d.prototype,"afterHyperlinkCreate",void 0),np([(0,e.Event)()],d.prototype,"beforeHyperlinkClick",void 0),np([(0,e.Event)()],d.prototype,"afterHyperlinkClick",void 0),np([(0,e.Event)()],d.prototype,"beforeConditionalFormat",void 0),np([(0,e.Event)()],d.prototype,"actionBegin",void 0),np([(0,e.Event)()],d.prototype,"actionComplete",void 0),np([(0,e.Event)()],d.prototype,"openComplete",void 0),np([(0,e.Event)()],d.prototype,"sortComplete",void 0),np([(0,e.Property)("USD")],d.prototype,"currencyCode",void 0),d=h=np([e.NotifyPropertyChanges],d)}(sl)})(),f})()));
|