@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.
@@ -1,2 +1,11 @@
1
+ /*!
2
+ * filename: ej2-spreadsheet.umd.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&&"undefined"!=typeof module?t(exports,require("@syncfusion/ej2-base"),require("@syncfusion/ej2-data"),require("@syncfusion/ej2-popups"),require("@syncfusion/ej2-navigations"),require("@syncfusion/ej2-inputs"),require("@syncfusion/ej2-buttons"),require("@syncfusion/ej2-dropdowns"),require("@syncfusion/ej2-lists"),require("@syncfusion/ej2-splitbuttons"),require("@syncfusion/ej2-grids"),require("@syncfusion/ej2-charts")):"function"==typeof define&&define.amd?define(["exports","@syncfusion/ej2-base","@syncfusion/ej2-data","@syncfusion/ej2-popups","@syncfusion/ej2-navigations","@syncfusion/ej2-inputs","@syncfusion/ej2-buttons","@syncfusion/ej2-dropdowns","@syncfusion/ej2-lists","@syncfusion/ej2-splitbuttons","@syncfusion/ej2-grids","@syncfusion/ej2-charts"],t):t((e=e||self).ej={},e.ej2Base,e.ej2Data,e.ej2Popups,e.ej2Navigations,e.ej2Inputs,e.ej2Buttons,e.ej2Dropdowns,e.ej2Lists,e.ej2Splitbuttons,e.ej2Grids,e.ej2Charts)}(this,function(z,ee,H,g,D,S,w,I,f,m,k,v){"use strict";function te(e){var t,r,n=[];return e&&(e=-1===(e=-1<e.lastIndexOf("!")?e.substring(e.lastIndexOf("!")+1):e).indexOf(":")?e+":"+e:e,new RegExp(/^(?=.*[a-zA-Z])(?=.*\d)/g).test(e)||(r=e.split(":"),e=ee.isNullOrUndefined(e.match(/[0-9]/))?r[0]+"1:"+r[1]+"1":"A"+r[0]+":A"+r[1]),e.split(":").forEach(function(e){t=W(e),n.push(t[0]),n.push(t[1])})),n}function W(e){return[parseInt(e.match(/\d+/)[0],10)-1,R(e.match(/[A-Z]+/i)[0].toUpperCase())]}function R(e){for(var t=0,r=(e=e.split("").reverse().join("")).length-1;0<=r;r--)t+=(e[r].charCodeAt(0)-64)*Math.pow(26,r);return t-1}function G(e,t){return ue(t+1)+(e+1)}function re(e){return G(e[0],e[1])+":"+(ee.isNullOrUndefined(e[2])?G(e[0],e[1]):G(e[2],e[3]))}function ue(e){return 1<e/26?ue(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 P(e){return te(y(e))}function y(e){var t=e.lastIndexOf("!");return-1<t?e.substring(t+1):e}function C(e){return e.name+"!"+e.selectedRange}function E(e,t){return{sheetIndex:N(e,t),indices:P(t)}}function N(e,t){t=-1<t.indexOf("!")?B(e,Ei(t)):e.activeSheetIndex;return t}function ne(e){var t=e.slice();return e[0]>e[2]&&b(t,0,2),e[1]>e[3]&&b(t,1,3),t}function b(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function fe(e){return e[0]===e[2]&&e[1]===e[3]}function x(e,t,r,n,i,o){return new F(e,t,r,n,i,o)}A.prototype.terminate=function(){this.worker.terminate(),URL.revokeObjectURL(this.workerUrl)},A.prototype.initWorker=function(){var e=new Blob([this.getFnCode()],{type:"text/javascript"});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?(e=JSON.parse(JSON.stringify(this.workerData)),this.worker.postMessage(e)):this.worker.postMessage(this.workerData)},A.prototype.messageFromWorker=function(e){this.terminate(),this.defaultListener.apply(this.context,[e.data])},A.prototype.onError=function(e){if(this.terminate(),!e.message||!e.message.includes("FormData"))throw e.message||e;this.defaultListener.apply(this.context,[{isFormDataError:!0}])},A.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:this.getCallbackMessageFn).toString()+"; \n"},A.prototype.getCallbackMessageFn=function(e){postMessage(this.workerTask.apply(this,e.data))},A.prototype.getMessageFn=function(e){this.workerTask.apply(this,e.data)};var F=A;function A(e,t,r,n,i,o){this.preventCallback=!1,this.context=e,this.workerTask=t,this.defaultListener=r,this.workerData=n,this.parent=o,i&&(this.preventCallback=!0),this.initWorker()}function L(e,t){return(t=void 0===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}M=function(e,t){return(M=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)};var M,U,V=function(e,t){function r(){this.constructor=e}M(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},e=function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;0<=s;s--)(i=e[s])&&(a=(o<3?i(a):3<o?i(t,r,a):i(t,r))||a);return 3<o&&a&&Object.defineProperty(t,r,a),a},j=(U=ee.ChildProperty,V(_,U),e([ee.Property("Calibri")],_.prototype,"fontFamily",void 0),e([ee.Property("bottom")],_.prototype,"verticalAlign",void 0),e([ee.Property("left")],_.prototype,"textAlign",void 0),e([ee.Property("0pt")],_.prototype,"textIndent",void 0),e([ee.Property("#000000")],_.prototype,"color",void 0),e([ee.Property("#ffffff")],_.prototype,"backgroundColor",void 0),e([ee.Property("normal")],_.prototype,"fontWeight",void 0),e([ee.Property("normal")],_.prototype,"fontStyle",void 0),e([ee.Property("11pt")],_.prototype,"fontSize",void 0),e([ee.Property("none")],_.prototype,"textDecoration",void 0),e([ee.Property("")],_.prototype,"border",void 0),e([ee.Property("")],_.prototype,"borderTop",void 0),e([ee.Property("")],_.prototype,"borderBottom",void 0),e([ee.Property("")],_.prototype,"borderLeft",void 0),e([ee.Property("")],_.prototype,"borderRight",void 0),_);function _(){return null!==U&&U.apply(this,arguments)||this}q=ee.ChildProperty,V(K,q),e([ee.Property()],K.prototype,"sheetIndex",void 0),e([ee.Property()],K.prototype,"filterRange",void 0),e([ee.Property(!1)],K.prototype,"hasFilter",void 0),e([ee.Property()],K.prototype,"column",void 0),e([ee.Property()],K.prototype,"criteria",void 0),e([ee.Property()],K.prototype,"value",void 0),e([ee.Property()],K.prototype,"dataType",void 0),e([ee.Property()],K.prototype,"predicates",void 0);var q,X=K;function K(){return null!==q&&q.apply(this,arguments)||this}$=ee.ChildProperty,V(J,$),e([ee.Property()],J.prototype,"sortRange",void 0),e([ee.Property()],J.prototype,"columnIndex",void 0),e([ee.Property()],J.prototype,"order",void 0),e([ee.Property()],J.prototype,"sheetIndex",void 0);var $,Z=J;function J(){return null!==$&&$.apply(this,arguments)||this}ge=ee.ChildProperty,V(ve,ge),e([ee.Property("")],ve.prototype,"name",void 0),e([ee.Property("")],ve.prototype,"scope",void 0),e([ee.Property("")],ve.prototype,"comment",void 0),e([ee.Property("")],ve.prototype,"refersTo",void 0);var ge,me=ve;function ve(){return null!==ge&&ge.apply(this,arguments)||this}ye=ee.ChildProperty,V(be,ye),e([ee.Property(!1)],be.prototype,"selectCells",void 0),e([ee.Property(!1)],be.prototype,"selectUnLockedCells",void 0),e([ee.Property(!1)],be.prototype,"formatCells",void 0),e([ee.Property(!1)],be.prototype,"formatRows",void 0),e([ee.Property(!1)],be.prototype,"formatColumns",void 0),e([ee.Property(!1)],be.prototype,"insertLink",void 0);var ye,Ce=be;function be(){return null!==ye&&ye.apply(this,arguments)||this}xe=ee.ChildProperty,V(we,xe),e([ee.Property("")],we.prototype,"address",void 0);var xe,Se=we;function we(){return null!==xe&&xe.apply(this,arguments)||this}Ie=ee.ChildProperty,V(Ne,Ie),e([ee.Property("WholeNumber")],Ne.prototype,"type",void 0),e([ee.Property("Between")],Ne.prototype,"operator",void 0),e([ee.Property("0")],Ne.prototype,"value1",void 0),e([ee.Property("0")],Ne.prototype,"value2",void 0),e([ee.Property(!0)],Ne.prototype,"ignoreBlank",void 0),e([ee.Property(!0)],Ne.prototype,"inCellDropDown",void 0),e([ee.Property(!1)],Ne.prototype,"isHighlighted",void 0),e([ee.Property("")],Ne.prototype,"address",void 0);var Ie,Ee=Ne;function Ne(){return null!==Ie&&Ie.apply(this,arguments)||this}Re=ee.ChildProperty,V(ke,Re),e([ee.Property("General")],ke.prototype,"format",void 0),e([ee.Complex({},j)],ke.prototype,"style",void 0),e([ee.Property(!0)],ke.prototype,"isLocked",void 0);var Re,Fe=ke;function ke(){return null!==Re&&Re.apply(this,arguments)||this}Oe=ee.ChildProperty,V(Te,Oe),e([ee.Property("GreaterThan")],Te.prototype,"type",void 0),e([ee.Complex({},Fe)],Te.prototype,"format",void 0),e([ee.Property("RedFT")],Te.prototype,"cFColor",void 0),e([ee.Property("")],Te.prototype,"value",void 0),e([ee.Property("")],Te.prototype,"range",void 0),e([ee.Property("")],Te.prototype,"action",void 0);var Oe,Ae=Te;function Te(){return null!==Oe&&Oe.apply(this,arguments)||this}De=ee.ChildProperty,V(Pe,De),e([ee.Property(!0)],Pe.prototype,"visible",void 0),e([ee.Property("Auto")],Pe.prototype,"position",void 0);var De,Le=Pe;function Pe(){return null!==De&&De.apply(this,arguments)||this}Me=ee.ChildProperty,V(Ue,Me),e([ee.Property(!1)],Ue.prototype,"visible",void 0),e([ee.Property("Auto")],Ue.prototype,"position",void 0);var Me,Be=Ue;function Ue(){return null!==Me&&Me.apply(this,arguments)||this}He=ee.ChildProperty,V(je,He),e([ee.Property("")],je.prototype,"color",void 0),e([ee.Property(1)],je.prototype,"width",void 0);var He,Ve=je;function je(){return null!==He&&He.apply(this,arguments)||this}ze=ee.ChildProperty,V(qe,ze),e([ee.Property(!1)],qe.prototype,"visible",void 0),e([ee.Property("Circle")],qe.prototype,"shape",void 0),e([ee.Property(5)],qe.prototype,"size",void 0),e([ee.Property(null)],qe.prototype,"fill",void 0),e([ee.Property(!0)],qe.prototype,"isFilled",void 0),e([ee.Complex({},Ve)],qe.prototype,"border",void 0);var ze,_e=qe;function qe(){return null!==ze&&ze.apply(this,arguments)||this}We=ee.ChildProperty,V(Ye,We),e([ee.Property(0)],Ye.prototype,"width",void 0);var We,Ge=Ye;function Ye(){return null!==We&&We.apply(this,arguments)||this}Xe=ee.ChildProperty,V($e,Xe),e([ee.Property(0)],$e.prototype,"width",void 0);var Xe,Ke=$e;function $e(){return null!==Xe&&Xe.apply(this,arguments)||this}Ze=ee.ChildProperty,V(Qe,Ze),e([ee.Property("")],Qe.prototype,"title",void 0),e([ee.Complex({},Ge)],Qe.prototype,"majorGridLines",void 0),e([ee.Complex({},Ke)],Qe.prototype,"minorGridLines",void 0),e([ee.Property(!0)],Qe.prototype,"visible",void 0);var Ze,Je=Qe;function Qe(){return null!==Ze&&Ze.apply(this,arguments)||this}et=ee.ChildProperty,V(rt,et),e([ee.Property("Line")],rt.prototype,"type",void 0),e([ee.Property("Material")],rt.prototype,"theme",void 0),e([ee.Property(!1)],rt.prototype,"isSeriesInRows",void 0),e([ee.Complex({},_e)],rt.prototype,"markerSettings",void 0),e([ee.Property("")],rt.prototype,"range",void 0),e([ee.Property("")],rt.prototype,"id",void 0),e([ee.Property("")],rt.prototype,"title",void 0),e([ee.Property(290)],rt.prototype,"height",void 0),e([ee.Property(480)],rt.prototype,"width",void 0),e([ee.Property(0)],rt.prototype,"top",void 0),e([ee.Property(0)],rt.prototype,"left",void 0),e([ee.Complex({},Le)],rt.prototype,"legendSettings",void 0),e([ee.Complex({},Je)],rt.prototype,"primaryXAxis",void 0),e([ee.Complex({},Je)],rt.prototype,"primaryYAxis",void 0),e([ee.Complex({},Be)],rt.prototype,"dataLabelSettings",void 0);var et,tt=rt;function rt(){return null!==et&&et.apply(this,arguments)||this}nt=ee.ChildProperty,V(ot,nt),e([ee.Property("")],ot.prototype,"src",void 0),e([ee.Property("")],ot.prototype,"id",void 0),e([ee.Property(300)],ot.prototype,"height",void 0),e([ee.Property(400)],ot.prototype,"width",void 0),e([ee.Property(0)],ot.prototype,"top",void 0),e([ee.Property(0)],ot.prototype,"left",void 0);var nt,it=ot;function ot(){return null!==nt&&nt.apply(this,arguments)||this}at=ee.ChildProperty,V(st,at),e([ee.Property("FillSeries")],st.prototype,"fillType",void 0),e([ee.Property(!0)],st.prototype,"showFillOptions",void 0);var at,V=st;function st(){return null!==at&&at.apply(this,arguments)||this}var lt="workbookDestroyed",ht="updateSheetFromDataSource",dt="dataSourceChanged",pt="dataChanged",ct="triggerDataChange",ut="workbookOpen",ft="beginSave",gt="actionBegin",mt="sortImport",vt="findToolDlg",yt="exportDialog",Ct="setFilteredCollection",bt="saveCompleted",xt="applyNumber",St="getFormattedCell",wt="calculateFormula",It="refreshCellElem",Et="setCellFormat",Nt="findAllValues",Rt="textDecorationUpdate",Ft="applyCellFormat",kt="updateRowColCount",ie="workbookFormulaOperation",Ot="workbookEditOperation",At="checkDateFormat",Tt="checkNumberFormat",Dt="parseDecimalNumber",Lt="getFormattedBarText",Pt="activeCellChanged",Mt="openSuccess",Bt="openFailure",Ut="sheetCreated",Ht="sheetsDestroyed",Vt="aggregateComputation",jt="getUniqueRange",zt="removeUniquecol",_t="checkUniqueRange",qt="reApplyFormula",Wt="clearFormulaDependentCells",Gt="formulaInValidation",Yt="beforeSort",Xt="initiateSort",Kt="updateSortedDataOnCell",$t="sortComplete",Zt="beforeHyperlinkCreate",Jt="afterHyperlinkCreate",Qt="beforeHyperlinkClick",er="afterHyperlinkClick",tr="setLinkModel",rr="initiateFilter",nr="filterRangeAlert",ir="wrapText",or="onSave",ar="insert",sr="delete",lr="insertModel",hr="deleteModel",dr="isValidation",pr="cellValidation",cr="addHighlight",ur="find",fr="gotoHandler",gr="replace",mr="replaceAll",vr="showFindAlert",yr="findKeyUp",Cr="removeHighlight",br="queryCellInfo",xr="count",Sr="protectSheet",wr="updateToggleItem",Ir="protectsheetHandler",Er="replaceAllDialog",Nr="unprotectsheetHandler",Rr="editAlert",Fr="readonlyAlert",kr="setLockCells",Or="setMerge",Ar="applyMerge",Tr="mergedRange",Dr="activeCellMergedRange",Lr="insertMerge",Pr="hideShow",Mr="setCFRule",Br="applyCF",Ur="clearCFRule",Hr="clear",Vr="clearCF",jr="setImage",zr="setChart",_r="initiateChart",qr="refreshRibbonIcons",Wr="refreshChart",Gr="refreshChartSize",Yr="deleteChartColl",Xr="focusChartBorder",Kr="saveError",$r="validationHighlight",Zr="beforeInsert",Jr="beforeDelete",Qr="deleteHyperlink",en="moveOrDuplicateSheet",tn="setAutoFill",rn="refreshCell",nn="getFillInfo",on="getautofillDDB",an="rowFillHandler",sn="getTextSpace",ln="refreshClipboard",hn="updateView",dn="selectionComplete",pn="refreshInsertDelete",cn="getUpdatedFormulaOnInsertDelete",un="beforeCellUpdate",fn="duplicateSheetFilterHandler",gn="unMerge",mn="checkFormulaRef",vn="parseFormulaArgument",yn="getCellRefValue",Cn="commputeFormulaValue",bn="getChartRowIdxFromClientY",xn="getChartColIdxFromClientX",Sn="refreshChartCellOnInit",wn="localizedFormatAction",In="moveSheetHandler",En="addListValidationDropdown";function Nn(e,t,r,n,i){var o=e.value;return oe(o)||o&&"string"==typeof o&&(i&&o.includes(i)&&(e.format.includes(i)||e.format.includes("$"))&&(o=o.replace(i,"").trim()),r&&o.includes(r)&&Rn(o,t,r,n)&&(o=o.split(r).join("").trim()),oe(o="."!==(n=n||ee.getNumericObject(t).decimal)&&o.includes(n)?o.replace(n,".").trim():o))?{isNumber:!0,value:o}:{isNumber:!1,value:o}}function Rn(e,t,r,n){for(var i=!1,o=123456..toLocaleString(t).split(r).reverse(),a=e.split(n)[0].split(r),s=0;s<a.length&&(i=s===a.length-1?a[s].length===o[0].length:!ee.isUndefined(o[1])&&(0===s?a[s].length<=o[1].length:a[s].length===o[1].length));s++);return i}function Q(e,t){return e&&"="===e[0]&&(1<e.length||t)}function Fn(e){if(-1<(e=e.split("$").join("")).indexOf(":")){var t=e.split(":");if(Bn(t[0])&&Bn(t[1]))return!0}else if(e.indexOf(":")<0&&Bn(e))return!0;return!1}function kn(e){return 65<=e.charCodeAt(0)&&e.charCodeAt(0)<=90||97<=e.charCodeAt(0)&&e.charCodeAt(0)<=122}function On(e,t){return 0===t[1]&&t[3]===e.colCount-1}function An(e,t){return 0===t[0]&&t[2]===e.rowCount-1}function Tn(e,t,r){return e&&t>=e[0]&&t<=e[2]&&r>=e[1]&&r<=e[3]}function Dn(e,t,r){for(var n,i=e.split(" "),o=0,a=i.length;o<a&&!(n=Tn(te(i[o]),t,r));o++);return n}function Ln(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 Pn(n,i,e){var o=ue(e+1);return n?n.split(" ").forEach(function(e){var t,r=te(e);Ln(r,i)?n=n.split(e).join(o+(r[0]+1)+":"+o+i[0]+" "+o+(i[2]+2)+":"+o+(r[2]+1)):Ln(r,i,!0)&&(t=void 0,t=i[0]>r[0]?o+(r[0]+1)+":"+o+i[0]:o+(i[2]+2)+":"+o+(r[2]+1),n=n.split(e).join(t))}):n=o+"1:"+o+i[0]+" "+o+(i[2]+2)+":"+o+"1048576",n}function Mn(e,t){return!!(e=e||{}).isLocked||!(!1===e.isLocked||(!t||!t.isLocked)&&(e.isLocked||!t||!1===t.isLocked))}function Bn(e){for(var t=e,r=0,n=t.length,i=0;i<n;i++)kn(t[i])&&r++;var o=(e=t.substring(0,r)).length;if(o!==n&&o<4&&1!==n&&isNaN(parseInt(t,10))){if(16384<Un(e))return!1;o=parseFloat(t.substring(r,n));if(0<o&&o<1048577)return!0}return!1}function Un(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&&kn(e[t]);){r=26*r+e[t].charCodeAt(0)-64;t++}return 0===r?-1:r}function Y(e,t,r,n,i){var o;if(void 0===n&&(n="rows"),r)for(var a=t;a<1/0;a++){if(!(o=e[""+n])[t]||!o[t].hidden){if(!i)break;i--}t++}else for(a=t;-1<a&&((o=e[""+n])[t]&&o[t].hidden);a--)t--;return t}function Hn(e,t){var r=Object.keys(e);return(t?-1<r.indexOf("fontSize"):-1<r.indexOf("fontSize")&&12<Number(e.fontSize.split("pt")[0]))||-1<r.indexOf("fontFamily")||-1<r.indexOf("borderTop")||-1<r.indexOf("borderBottom")}function Vn(e,t,r,n,i,o){var a;if(s=t?(a=i||se(t[0],t[1],r,!1,!0)).formula||"":s){o&&n.notify(Wt,{cellRef:G(t[0],t[1])});for(var s,l=["+","-","*","/",">=","<=","<>",">","<","=","%","&"],h=void 0,d=s=(s=0===s.indexOf("=")?s.slice(1):s).split("(").join(n.listSeparator).split(")").join(n.listSeparator),p=0;p<l.length;p++)d=(h=d.split(l[p])).join(n.listSeparator);for(var c,u,f,g,h=d.split(n.listSeparator),m=[],v=void 0,y=void 0,C=void 0,b=void 0,x=0;x<h.length;x++)Fn((b=((g=h[x].includes("!"))?(c=h[x].lastIndexOf("!"),C=h[x].substring(0,c),h[x].substring(c+1)):h[x]).toUpperCase()).trim())&&!b.includes("$")&&(c=jn(b),u=zn(b),f=te(b),v=!((f=[e[0]-(t[0]-f[0]),e[1]-(t[1]-f[1]),e[0]-(t[0]-f[2]),e[1]-(t[1]-f[3])])[1]<0||f[2]<0||f[3]<0||!o&&f[0]<0)&&(o&&f[0]<0&&(f[0]=f[2]),v=G(f[0],f[1]),b.includes(":")&&(v+=":"+G(f[2],f[3])),Fn(v))?v:"#REF!",(y={})[h[x]]=""+c+(v=g?C+"!"+v:v)+u,h[x].includes(":")?m.splice(0,0,y):m.push(y));for(var S=s=a.formula,x=0;x<m.length;x++){for(var w=Object.keys(m[x])[0],I=m[x][""+w],E=w.length,w=S.indexOf(w),N="",R=0;R<I.length;R++)N+=" ";s=s.slice(0,w)+I+s.slice(w+E),S=S.slice(0,w)+N+S.slice(w+E)}return s}return null}function jn(e){for(var t="",r=0;r<e.length&&" "===e[r];r++)t+=" ";return t}function zn(e){for(var t="",r=e.length-1;0<=r&&" "===e[r];r--)t=" "+t;return t}function _n(e,t,r,n,i){var o,a,s,l={cell:r.cell,rowIndex:r.rowIdx,colIndex:r.colIdx,cancel:!1,sheet:t.name};return r.preventEvt||e.trigger(un,l),r.eventOnly||l.cancel||(r.valChange?(s=se(l.rowIndex,l.colIndex,t),o=!r.preventEvt&&e.getDisplayText(s),s=!(!s||!s.formula),Vi(l.rowIndex,l.colIndex,t,l.cell,!r.pvtExtend),a=se(l.rowIndex,l.colIndex,t,!1,!0),r.mergedCells&&(delete a.value,delete a.formula),a.formattedText&&delete a.formattedText,s={action:"updateCellValue",address:[l.rowIndex,l.colIndex],sheetIndex:B(e,t.name),value:s&&!a.formula?a.value||(0===a.value?"0":""):a.formula||a.value||(0===a.value?"0":""),skipFormatCheck:r.skipFormatCheck,isRandomFormula:r.isRandomFormula,isDelete:r.isDelete,deletedRange:r.deletedRange,fillType:r.fillType,cellInformation:n,isRedo:!i,actionName:r.fillType,isPaste:"paste"===r.requestType},e.notify(Ot,s),r.isFormulaDependent=s.isFormulaDependent,r.requestType&&null===l.cell&&Vi(l.rowIndex,l.colIndex,t,l.cell,!r.pvtExtend),r.cellDelete&&(delete a.value,delete a.formula,delete a.hyperlink),r.uiRefresh&&e.serviceLocator.getService("cell").refresh(l.rowIndex,l.colIndex,r.lastCell,r.td,r.checkCF,r.checkWrap,r.skipFormatCheck,r.isRandomFormula,r.fillType),r.preventEvt||(n=e.getDisplayText(a))!==o&&(s={value:i=(i=se(l.rowIndex,l.colIndex,t,!1,!0).value)||(0===i?"0":""),oldValue:o,formula:a.formula||"",address:t.name+"!"+G(l.rowIndex,l.colIndex),displayText:n},r.requestType&&(s.requestType=r.requestType),e.trigger("cellSave",s))):Vi(l.rowIndex,l.colIndex,t,l.cell,!r.pvtExtend)),l.cancel}function qn(e,t,r){for(var n=e,i=e,o=t,a=t,s=r.usedRange.rowIndex,l=r.usedRange.colIndex,h=function(e){for(var t=0;t<=l;t++)if(!ee.isUndefined(se(e,t,r,null,!0).value))return!1;return!0},d=function(e){for(var t=n;t<=i;t++)if(!ee.isUndefined(se(t,e,r,null,!0).value))return!1;return!0},p=n;p<=s&&(!ee.isUndefined(se(p,t,r,null,!0).value)||!h(p));p++)i=p;for(p=n;0<=p&&(!ee.isUndefined(se(p,t,r,null,!0).value)||!h(p));p--)n=p;for(p=o;p<=l&&(!ee.isUndefined(se(e,p,r,null,!0).value)||!d(p));p++)a=p;for(p=o;0<=p&&(!ee.isUndefined(se(e,p,r,null,!0).value)||!d(p));p--)o=p;return[n,o,i,a]}function Wn(e,t,r){var n,i=te(e.model.selectedRange),o=0,a=0;return"Column"===e.modelType?((r||"before"===e.insertType&&e.isUndoRedo)&&(i=[0,e.start,0,e.end]),"before"===e.insertType?t[1]<=i[1]&&t[3]>=i[1]?(o=0,a=i[3]-i[1]+1):i[1]<t[1]&&(o=a=i[3]-i[1]+1):(e.isUndoRedo&&(n=e.end-e.start+1,i=[0,e.start-n,0,e.end-n]),t[1]<=i[3]&&t[3]>=i[3]?(o=0,a=i[3]-i[1]+1):i[3]<t[3]&&(o=a=i[3]-i[1]+1)),[t[0],t[1]+o,t[2],t[3]+a]):((r||"above"===e.insertType&&e.isUndoRedo)&&(i=[e.start,0,e.end,0]),"above"===e.insertType?t[0]<=i[0]&&t[2]>=i[0]?a=i[2]-i[o=0]+1:i[0]<t[0]&&(o=a=i[2]-i[0]+1):(e.isUndoRedo&&(n=e.end-e.start+1,i=[e.start-n,0,e.end-n,0]),t[0]<=i[2]&&t[2]>=i[2]?a=i[2]-i[o=0]+1:i[2]<t[2]&&(o=a=i[2]-i[0]+1)),[t[0]+o,t[1],t[2]+a,t[3]])}function Gn(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 Yn(e,t,r,n,i,o,a){for(var s,l=e.length-1;0<=l;l--)for(var h=e[l].range.trim().split(","),d=0;d<h.length;d++){if(r>=(s=te(h[d].includes(":")?h[d]:h[d]+":"+h[d]))[0]&&n>=s[1]&&r<=s[2]&&n<=s[3]){t.push(e[l]),e.splice(l,1);break}if(i&&i[0]>=s[0]&&i[1]>=s[1]&&i[0]<=s[2]&&i[1]<=s[3]){var p={action:"autofillWithCF",cFColor:e[l].cFColor,range:re(o),type:e[l].type,value:e[l].value};e.splice(l,1);for(var c=0,u=a.conditionalFormats;c<u.length&&("autofillWithCF"!==u[c].action||u[c].range!==p.range);c++)c===u.length-1&&(t.push(p),a.conditionalFormats.push(p));break}}}function Xn(e,t){for(var r,n,i,o,a,s=t.trim().split(","),l=0;l<e.length;l++)if(function(e){for(var t=0;t<s.length;t++){if(a=te(s[t].includes(":")?s[t]:s[t]+":"+s[t]),e[0]<=a[0]&&e[1]<=a[1]&&e[2]>=a[2]&&e[3]>=a[3])return!0;if(i=e[0]>=a[0]&&e[0]<=a[2],o=e[2]>=a[0]&&e[2]<=a[2],r=e[1]>=a[1]&&e[1]<=a[3],n=e[3]>=a[1]&&e[3]<=a[3],i&&o){if(r||n||e[1]<a[1]&&e[3]>a[3]){if(0<e[0]-a[0])return!0;if(0<a[2]-e[2])return!0}if(r&&e[1]!==a[1])return!0;if(n&&e[3]!==a[3])return!0}else if(r&&n){if(i||o||e[0]<a[0]&&e[2]>a[2]){if(0<e[1]-a[1])return!0;if(0<a[3]-e[3])return!0}if(i){if(e[0]!==a[0])return!0}else if(o&&e[2]!==a[2])return!0}else if(i||o){if(r){if(e[1]!==a[1])return!0;if(0<e[0]-a[0])return!0;if(0<a[2]-e[2])return!0}else if(n){if(e[3]!==a[3])return!0;if(0<e[0]-a[0])return!0;if(0<a[2]-e[2])return!0}else if(e[1]<a[1]&&e[3]>a[3])return!0}else if((r||n)&&e[0]<a[0]&&e[2]>a[2])return!0}return!1}(e[l]))return!0;return!1}function Kn(e,t,r){var n;r=r||ee.getNumericObject(t.locale);for(var i=0;i<e.length;i++)oe(e[i])?"."===r.group&&(e[i]=e[i].toString(),e[i].indexOf("."))&&Rn(e[i],t.locale,r.group,r.decimal)&&(e[i]=e[i].split(r.group).join("")):(n={formattedText:e[i],value:e[i],format:"General",cell:{value:e[i],format:"General"},isEdit:!0},t.notify(St,n),oe(n.value)&&(e[i]=n.value.toString()));return e}function $n(e,t){var r,n,i=e.getActiveSheet(),o=[[t.topIndex+e.frozenRowCount(i),t.leftIndex+e.frozenColCount(i),t.bottomIndex,t.rightIndex]];return(i.frozenRows||i.frozenColumns)&&(r=e.frozenRowCount(i),e=e.frozenColCount(i),n=W(i.topLeftCell),r&&e&&(o.push([n[0],n[1],r-1,e-1]),i=W(i.paneTopLeftCell),o.push([i[0],n[1],t.bottomIndex,e-1])),r&&o.push([n[0],t.leftIndex+e,r-1,t.rightIndex]),e)&&o.push([t.topIndex+r,n[1],t.bottomIndex,e-1]),o}function Zn(e){var t;he(e.sheet,e.rowIdx)&&(t=Y(e.sheet,e.rowIdx,!0))<e.rowIdx+e.cell.rowSpan&&(e.rowIdx=t,e.isMergedHiddenCell=!0),pe(e.sheet,e.colIdx)&&(t=Y(e.sheet,e.colIdx,!0,"columns"))<e.colIdx+e.cell.colSpan&&(e.colIdx=t,e.isMergedHiddenCell=!0)}function Jn(e){return e.workbookOpenModule&&e.workbookOpenModule.preventFormatCheck}function Qn(r){var e=new ee.Internationalization,n={intl:e,updateValue:!0,value:"",curSymbol:ee.getNumberDependable(r.locale,ee.defaultCurrencyCode)},i={args:n,intl:e},o=ee.getNumericObject(r.locale);return function(e){var t;e.format||!e.value||oe(e.value)||(n.cell=e,n.value=e.value,r.notify(At,n),e.format)||((t=e.value.toString()).includes(i.args.curSymbol)||t.includes(o.group)||t.includes("%")?(i.fResult=t,r.notify(Tt,i)):"."===o.decimal||oe(t)||t.includes(o.decimal)&&oe(t=t.replace(o.decimal,"."))&&(e.value=t))}}function ei(e,t,r){var n=new H.Query,i=(t.length&&n.where(H.Predicate.and(t)),e.executeLocal(n));if(r)for(var o=0,a=r.length;o<a&&i.length;o++)n=new H.Query,r[o].length&&n.where(H.Predicate.or(r[o])),i=new H.DataManager(i).executeLocal(n);return i}function ti(e,t,r){return e&&e.isReadOnly||r&&r.isReadOnly||t&&t.isReadOnly}function ri(e){var t=e.toString();return e===parseInt(t,10)?parseInt(t,10)+" ":(e=-1<t.indexOf(".")?t.split(".")[1]:0,t=Math.pow(10,e.toString().replace("-","").length),e/(e=Math.abs(ni(e,t)))+"/"+t/e)}function ni(e,t){return e=Number(e),(t=Number(t))?ni(t,e%t):e}function ii(e){60<(e=0<(e=Number(e))&&e<1?1+e:0===e?1:e)&&--e;var t=new Date("01/01/1900"),t=Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds());return new Date(new Date(864e5*(e-1)+t).toUTCString().replace(" GMT",""))}function oi(e,t,r){var n=new Date("01/01/1900"),e=ai(e)?e:new Date(e),n=Date.UTC(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds()),e=(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())-n)/864e5;return(t?e:parseInt(e.toString(),10))+(r?0:60<e?2:1)}function ai(e){return"[object Date]"===Object.prototype.toString.call(e)&&!isNaN(e.valueOf())}function oe(e){return 0<=e-parseFloat(e)}function si(e,h,t,r,n,i){function d(){"time"===u.type&&(u.dateObj=new Date((o?o.toDateString():"01/01/1900")+" "+u.dateObj.toLocaleTimeString()))}var o,p=ee.IntlBase.getDependables(ee.cldrData,t,null).dateObject,c=p.dateTimeFormats.availableFormats,u={dateObj:null,isCustom:!1,type:""};if(r&&(u.dateObj=h.parseDate(e,{format:r}),u.dateObj)&&(u.type=-1<e.toString().indexOf(":")?"time":"datetime",d(),u.isCustom=!0),ee.isNullOrUndefined(u.dateObj)){if((e=e.toString())&&-1<e.indexOf("/")||0<e.indexOf("-")){t=n&&n.format||r;if(t){n=t.toLowerCase().includes("dd-mm-yy");if((n||t.toLowerCase().includes("dd/mm/yy"))&&(u.dateObj=h.parseDate(e,{format:t=n?"d-M-y":"d/M/y",skeleton:"yMd"}),u.dateObj))return u.type="date",u}}r=function(e){if(e.indexOf(":")<0)for(var t=0,r=Object.keys(p.dateFormats);t<r.length;t++){var n=r[t];if(u.dateObj=h.parseDate(e,{format:p.dateFormats[""+n],skeleton:n}),u.dateObj){u.type="date",u.isCustom=!1;break}}if(ee.isNullOrUndefined(u.dateObj))for(var i=void 0,o=0,a=Object.keys(c);o<a.length;o++){n=a[o],i=c[""+n];if(u.dateObj=h.parseDate(e,{format:i,skeleton:n}),!u.dateObj&&-1<e.indexOf(":")&&-1<i.indexOf(":")&&(u.dateObj=h.parseDate(e,{format:i.split(" ")[0]})),u.dateObj){u.type=-1<e.toString().indexOf(":")?"time":"datetime",d(),u.isCustom=!0;break}}if(ee.isNullOrUndefined(u.dateObj))for(var s=0,l=Object.keys(p.timeFormats);s<l.length;s++){n=l[s];if(u.dateObj=h.parseDate(e,{format:p.timeFormats[""+n],skeleton:n}),u.dateObj){u.type="time",d(),u.isCustom=!1;break}}};i?2<=(n=e.split(" ")).length&&(r(n.shift()),u.dateObj)&&(o=u.dateObj,u.dateObj=null,r(n.join(" ")),u.dateObj)&&(u.type="datetime"):r(e)}return"#DIV/0!"===e||u.dateObj||"Invalid Date"===new Date(e).toString()||(u.dateObj=new Date(e),u.type="date"),u}function li(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 hi="spreadsheetLocale",di={SortOutOfRangeError:"Select a cell or range inside the used range and try again."};function pi(N,R,F,k,O,A,r,n,T,i,D,L){return void 0===T&&(T=!0),new Promise(function(e){var t,I,E;e((-1<(e=R.lastIndexOf("!"))?(t=B(N,R.substring(0,e)),R=R.substring(e+1)):t=N.activeSheetIndex,I=ae(N,t),E=P(i||R),e={sheet:I,indexes:E,formulaCellRef:r,sheetIndex:n,promise:new Promise(function(e){e(void 0)})},N.notify(ht,e),e.promise.then(function(){var n,i,o=E[0],e=N.frozenRowCount(I),t=N.frozenColCount(I),a=!!L;if(F){var s,l,h,d,p,c,u,f,g=[];k?(c=ee.getNumericObject(N.locale),u=new ee.Internationalization(N.locale)):f=Qn(N),R.split(",").forEach(function(e,t){for(E=te(e),o=E[s=0];o<=E[2];){for(l=g[s]||{},i=Nh(I,o),n=E[1];n<=E[3];){var r;!T||!he(I,o)||A&&Fh(I,o)?(d=ue(n+1),r=i?se(o,n,I):null,k?(r&&(r.value||0===r.value)?(r.formattedText&&r.format&&!r.format.includes("*")?Wi(r.format,!1)?l[d]=ii(r.value):l[d]=r.formattedText.toString().trim():l[d]=ci(N,r,o,n,!1,u),"string"==typeof(p=r.value)&&("."!==c.decimal&&p.includes(c.decimal)?oe(h=p.replace(c.decimal,"."))&&(p=parseFloat(h)):oe(p)&&(p=parseFloat(p)))):(l[d]="",p=null),l[d+"_value"]=p):(r&&(r.formula||!ee.isNullOrUndefined(r.value))||Object.keys(l).length)&&(n===D?((p={value:ci(N,r,o,n,!0)}).value&&"string"==typeof p.value&&(oe(p.value)?r.format&&"@"===r.format||(p.value=parseFloat(p.value)):r.format||(f(r),oe(r.value)&&(p.value=parseFloat(r.value)))),l[d]=ee.extend({},r,p)):l[d]=r),n===E[3]&&Object.keys(l).length&&(l.__rowIndex=(o+1).toString(),g[s]=l,a&&0===t&&!Fh(I,o)&&L.push(l),s++),n++):o++}o++}})}else{g=new Map;for(var r=!(k||!O||!O.length);o<=E[2];)if(r&&e<=o&&o<O[0])o=O[0];else{if(k||!he(I,o))for(i=Nh(I,o),n=E[1];n<=E[3];){var m,v={cell:se(o,n,I),address:G(o,n),rowIndex:o,colIndex:n},y=(N.trigger(br,v),se(o,n,I,!1,!0));if(y.formula&&y.formula.toUpperCase().includes("UNIQUE")&&N.notify(wt,{cell:y,rowIdx:o,colIdx:n,sheetIndex:N.activeSheetIndex,address:v.address}),1<y.colSpan&&1<y.rowSpan)for(var C=void 0,b=o,x=o+y.rowSpan;b<x;b++)for(var S=n,w=n+y.colSpan;S<w;S++)b===o&&S===n||(C=new Object,b!==o&&(C.rowSpan=o-b),S!==n&&(C.colSpan=n-S),I.rows[b]&&I.rows[b].cells&&I.rows[b].cells[S]&&(delete I.rows[b].cells[S].value,delete I.rows[b].cells[S].formula),Vi(b,S,I,C,!0));else if(1<y.colSpan)for(b=n+1,x=n+y.colSpan;b<x;b++)Vi(o,b,I,{colSpan:n-b},!0),I.rows[o]&&I.rows[o].cells&&I.rows[o].cells[b]&&(delete I.rows[o].cells[b].value,delete I.rows[o].cells[b].formula);else if(1<y.rowSpan)for(b=o+1,x=o+y.rowSpan;b<x;b++)Vi(b,n,I,{rowSpan:o-b},!0),I.rows[b]&&I.rows[b].cells&&I.rows[b].cells[n]&&(delete I.rows[b].cells[n].value,delete I.rows[b].cells[n].formula);!k&&pe(I,n)?n++:r&&t<=n&&n<O[1]?n=O[1]:(y.style&&(m={},Object.assign(m,y.style),y.style=m),g.set(v.address,y),n++)}o++}}return g})))})}function ci(e,t,r,n,i,o){return!t||ee.isNullOrUndefined(t.value)?"":t.format?(r={value:t.value,formattedText:t.value,cell:t,format:t.format,checkDate:!i,rowIndex:r,colIndex:n,dataUpdate:!0},e.notify(St,r),r.dateObj&&"Invalid Date"!==r.dateObj.toString()?r.dateObj:i?r.value:r.formattedText.toString().trim()):i?t.value:(oe(n=t.value)&&((n=Number(t.value).toString()).includes(".")||11<n.length)&&(e.notify(Dt,r={args:{value:n,updateValue:!0},fResult:n,cellVal:n,intl:o}),n=r.fResult),n)}function ui(r,n,i,e){for(var o,a,s,l=0,h=r.length,t=(e&&0<r.length&&r.sort(function(e,t){return ee.isNullOrUndefined(e)||ee.isUndefined(e.index)||ee.isNullOrUndefined(t)||ee.isUndefined(t.index)?0:e.index-t.index}),0);t<h;t++)!function(e){if(ee.isNullOrUndefined(r[e])||ee.isUndefined(r[e].index)||(a=l=r[e].index-e,delete r[e].index),0<l){for(o=0;l--;)n?(i.createSheet(e+o),o++):r.splice(e,0,null);e+=a,h+=a}var t;n&&(r[e].id<1&&(r[e].id=Ai(i.sheets),r[e].properties)&&(r[e].properties.id=r[e].id),r[e].name||i.setSheetPropertyOnMute(r[e],"name","Sheet"+Oi(i)),t=0,r[e].rows.forEach(function(e){t=Math.max(t,e&&e.cells&&e.cells.length-1||0)}),i.setSheetPropertyOnMute(r[e],"usedRange",{rowIndex:r[e].rows.length?r[e].rows.length-1:0,colIndex:t})),s=e}(t),t=s}fi=function(e,t){return(fi=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)};var fi,gi,e=function(e,t){function r(){this.constructor=e}fi(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},t=function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;0<=s;s--)(i=e[s])&&(a=(o<3?i(a):3<o?i(t,r,a):i(t,r))||a);return 3<o&&a&&Object.defineProperty(t,r,a),a},mi=(gi=ee.ChildProperty,e(vi,gi),vi.prototype.setProperties=function(e,t){var r=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 n=this.parentObj.ranges[this.parentObj.currRangeIdx];n&&n.info&&(this.info=n.info),setTimeout(function(){void 0!==r.parentObj.currRangeIdx&&delete r.parentObj.currRangeIdx})}else if(this.controlParent.tagObjects[0].instance&&this.controlParent.tagObjects[0].instance.hasChanges&&!this.controlParent.tagObjects[0].instance.isInitChanges){n=this.controlParent.sheets.indexOf(this.parentObj);if(void 0===this.parentObj.changedRangeIdx){for(var i,o=this.controlParent.tagObjects[0].instance.list[n].tagObjects,a=0;a<o.length;a++)if("ranges"===o[a].name){o[a].instance.list.forEach(function(e,t){e.hasChanges&&(i=t)});break}this.parentObj.changedRangeIdx=i}}gi.prototype.setProperties.call(this,e,t)},t([ee.Property(null)],vi.prototype,"dataSource",void 0),t([ee.Property("A1")],vi.prototype,"startCell",void 0),t([ee.Property(null)],vi.prototype,"query",void 0),t([ee.Property(null)],vi.prototype,"fieldsOrder",void 0),t([ee.Property(!0)],vi.prototype,"showFieldAsHeader",void 0),t([ee.Property("")],vi.prototype,"template",void 0),t([ee.Property("A1")],vi.prototype,"address",void 0),vi);function vi(){return null!==gi&&gi.apply(this,arguments)||this}yi=ee.ChildProperty,e(bi,yi),t([ee.Property(0)],bi.prototype,"rowIndex",void 0),t([ee.Property(0)],bi.prototype,"colIndex",void 0);var yi,Ci=bi;function bi(){return null!==yi&&yi.apply(this,arguments)||this}xi=ee.ChildProperty,e(wi,xi),t([ee.Property(null)],wi.prototype,"rows",void 0),t([ee.Property(null)],wi.prototype,"columns",void 0),t([ee.Complex({},Ce)],wi.prototype,"protectSettings",void 0),t([ee.Collection([],mi)],wi.prototype,"ranges",void 0),t([ee.Collection([],Ae)],wi.prototype,"conditionalFormats",void 0),t([ee.Property(0)],wi.prototype,"index",void 0),t([ee.Property("")],wi.prototype,"name",void 0),t([ee.Property(100)],wi.prototype,"rowCount",void 0),t([ee.Property(100)],wi.prototype,"colCount",void 0),t([ee.Property("A1:A1")],wi.prototype,"selectedRange",void 0),t([ee.Property("A1")],wi.prototype,"activeCell",void 0),t([ee.Complex({},Ci)],wi.prototype,"usedRange",void 0),t([ee.Property("A1")],wi.prototype,"topLeftCell",void 0),t([ee.Property(!0)],wi.prototype,"showHeaders",void 0),t([ee.Property(!0)],wi.prototype,"showGridLines",void 0),t([ee.Property(!1)],wi.prototype,"isProtected",void 0),t([ee.Property("Visible")],wi.prototype,"state",void 0),t([ee.Property(0)],wi.prototype,"frozenRows",void 0),t([ee.Property(0)],wi.prototype,"frozenColumns",void 0),t([ee.Property("A1")],wi.prototype,"paneTopLeftCell",void 0),t([ee.Property("")],wi.prototype,"password",void 0),t([ee.Property(null)],wi.prototype,"standardHeight",void 0),t([ee.Property(!1)],wi.prototype,"isSheetCalculated",void 0);var xi,Si=wi;function wi(){return null!==xi&&xi.apply(this,arguments)||this}function B(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 Ii(e,t){for(var r,n=0;n<e.sheets.length;n++)if(e.sheets[n].id===t){r=n;break}return r}function Ei(e){var t=e.lastIndexOf("!");return(-1<t?e.substring(0,t):e).replace(/'/gi,"")}function Ni(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 Ri(e,t,r,n){e.setSheetPropertyOnMute(r=void 0===r?{}:r,"selectedRange",n?r.selectedRange+" "+t:t)}function Fi(e){return e&&e.selectedRange||"A1"}function ki(e){return e.selectedRange.split(" ")[0]}function ae(e,t){return e.sheets[t]}function Oi(e){var t=[];e.sheets.forEach(function(e){t.push(e.name.toLowerCase())});for(var r=0;r<t.length;r++){if(!(-1<t.indexOf("sheet"+e.sheetNameCount)))return e.sheetNameCount++;e.sheetNameCount++}return e.sheetNameCount++}function Ai(e){var t=0;return e.forEach(function(e){t=Math.max(e.id,t)}),t+1}function Ti(n,e,i){e=e||n.sheets;e.forEach(function(e){var t,r;e.id=e.id||0,e.name=e.name||"",n.setSheetPropertyOnMute(e,"rowCount",e.rowCount||100),n.setSheetPropertyOnMute(e,"colCount",e.colCount||100),n.setSheetPropertyOnMute(e,"topLeftCell",e.topLeftCell||"A1"),n.setSheetPropertyOnMute(e,"activeCell",e.activeCell||"A1"),n.setSheetPropertyOnMute(e,"selectedRange",e.selectedRange||e.activeCell+":"+e.activeCell),n.setSheetPropertyOnMute(e,"usedRange",e.usedRange||{rowIndex:0,colIndex:0}),n.setSheetPropertyOnMute(e,"ranges",e.ranges||[]),n.setSheetPropertyOnMute(e,"rows",e.rows&&ee.extend([],e.rows,null,!0)||[]),n.setSheetPropertyOnMute(e,"columns",e.columns||[]),n.setSheetPropertyOnMute(e,"showHeaders",!!ee.isUndefined(e.showHeaders)||e.showHeaders),n.setSheetPropertyOnMute(e,"showGridLines",!!ee.isUndefined(e.showGridLines)||e.showGridLines),n.setSheetPropertyOnMute(e,"state",e.state||"Visible"),e.maxHgts=e.maxHgts||[],e.isImportProtected=e.isProtected&&i,e.protectSettings=e.protectSettings||{selectCells:!1,formatCells:!1,formatRows:!1,formatColumns:!1,insertLink:!1},e.isProtected=e.isProtected||!1,e.paneTopLeftCell&&"A1"!==e.paneTopLeftCell||(e.frozenRows=e.frozenRows||0,e.frozenColumns=e.frozenColumns||0,t=W(e.topLeftCell),n.setSheetPropertyOnMute(e,"paneTopLeftCell",G(e.frozenRows?t[0]+e.frozenRows:t[0],e.frozenColumns?t[1]+e.frozenColumns:t[1]))),ui(e.columns),t=e.rows,r=i,t.forEach(function(e){e&&e.cells&&ui(e.cells,null,void 0,r)}),ui(t,null,void 0,r)}),ui(e,!0,n)}function Di(e,t){return ae(e,t=void 0===t?e.activeSheetIndex:t).name}function Li(r,n,e,t,i){var o=!!e,a=(e=e||[r.activeSheetIndex],Di(r)),s={action:"moveSheet",eventArgs:{position:n=function(e,t,r){for(var n=t;r?0<=n:n<e.length;r?n--:n++)if("Hidden"!==e[n].state&&"VeryHidden"!==e[n].state){t=n;break}return t}(r.sheets,n,r.activeSheetIndex>n),sheetIndexes:e,cancel:!1}};t&&r.trigger("actionBegin",s),s.eventArgs.cancel||(r.notify(In,{prevIndex:r.activeSheetIndex,currentIndex:n}),e.forEach(function(e,t){r.sheets.splice(n+t,0,r.sheets.splice(e+(e<n?-1*t:0),1)[0])}),r.setProperties({activeSheetIndex:i?B(r,a):n>e[0]?n-(e.length-1):n},!0),r.notify(en,{refresh:o}),t&&(delete s.eventArgs.cancel,r.trigger("actionComplete",s)))}function Pi(e,t,r,n){var i={action:"duplicateSheet",eventArgs:{sheetIndex:t=ee.isUndefined(t)?e.activeSheetIndex:t,cancel:!1}};if(r&&e.trigger("actionBegin",i),!i.eventArgs.cancel){var o=ae(e,t),a=ee.extend({},o.properties||o,{},!0),s=(a.id=Ai(e.sheets),a.name),l=(/^\(\d+\)$/.test("("+s.split(" (")[1])&&(s=s.split(" (")[0]),[]);e.sheets.forEach(function(e){l.push(e.name)});for(var h=2;;h++)if(-1===l.indexOf(s+" ("+h+")")){a.name=s+" ("+h+")";break}e.notify(fn,{sheetIndex:t,newSheetIndex:t+1}),e.createSheet(t+1,[a]),e.notify(ie,{action:"addSheet",sheetName:"Sheet"+a.id,visibleName:a.name,sheetId:a.id}),n||e.setProperties({activeSheetIndex:t+1},!0),e.notify(en,{refresh:!0,isDuplicate:!0}),r&&(delete i.eventArgs.cancel,e.trigger("actionComplete",i))}}Mi=function(e,t){return(Mi=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)};var Mi,Bi,e=function(e,t){function r(){this.constructor=e}Mi(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},t=function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;0<=s;s--)(i=e[s])&&(a=(o<3?i(a):3<o?i(t,r,a):i(t,r))||a);return 3<o&&a&&Object.defineProperty(t,r,a),a},Ui=(Bi=ee.ChildProperty,e(Hi,Bi),t([ee.Property("")],Hi.prototype,"notes",void 0),t([ee.Collection([],it)],Hi.prototype,"image",void 0),t([ee.Collection([],tt)],Hi.prototype,"chart",void 0),t([ee.Property("")],Hi.prototype,"value",void 0),t([ee.Property("")],Hi.prototype,"formula",void 0),t([ee.Property(0)],Hi.prototype,"index",void 0),t([ee.Property("General")],Hi.prototype,"format",void 0),t([ee.Complex({},j)],Hi.prototype,"style",void 0),t([ee.Property("")],Hi.prototype,"hyperlink",void 0),t([ee.Property(!1)],Hi.prototype,"wrap",void 0),t([ee.Property(!0)],Hi.prototype,"isLocked",void 0),t([ee.Property("")],Hi.prototype,"validation",void 0),t([ee.Property(1)],Hi.prototype,"colSpan",void 0),t([ee.Property(1)],Hi.prototype,"rowSpan",void 0),t([ee.Property(!1)],Hi.prototype,"isReadOnly",void 0),Hi);function Hi(){return null!==Bi&&Bi.apply(this,arguments)||this}function se(e,t,r,n,i){var o=Nh(r,e);if(!o||!o.cells){if(!n)return i?{}:null;o?r.rows[e].cells=[]:r.rows[e]={cells:[]}}return r.rows[e].cells[t]||(i?{}:null)}function Vi(e,t,r,n,i){r.rows[e]?r.rows[e].cells||(r.rows[e].cells=[]):r.rows[e]={cells:[]},i&&r.rows[e].cells[t]?ee.extend(r.rows[e].cells[t],n,null,!0):r.rows[e].cells[t]=n}function ji(t,e){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(e?n:t).forEach(function(e){(r=t[""+e])!==n[""+e]&&(i[""+e]=r)}),i}function zi(e,t,r,n,i){void 0===t&&(t=!0);for(var e=r.getAddressInfo(e),o=e.indices,a=ae(r,e.sheetIndex),s=e.sheetIndex===r.activeSheetIndex,l=o[0];l<=o[2];l++)for(var h=o[1];h<=o[3];h++)!_n(r,a,{cell:{wrap:t},rowIdx:l,colIdx:h,preventEvt:n})&&s&&r.notify(ir,{range:[l,h,l,h],wrap:t,sheet:a,initial:!0,isPublic:i});r.setProperties({sheets:r.sheets},!0)}function _i(e){var t;return t=-1<e.indexOf("[")&&(e=e.split("[")[1].split("]")[0],-1<qi().indexOf(e))?e:t}function qi(){return["Black","Blue","Cyan","Green","Magenta","Red","White","Yellow"]}function Wi(e,t,r,n){var i,o,a,s;return e.includes('"')&&((o=e.split(";")).forEach(function(e,t){for(var r=0;r<e.length;r++)if('"'===e[r]&&"\\"!==e[r-1]){for(a=r;a=e.indexOf('"',a+1),"\\"===(s=e[a-1])||"_"===s||"*"===s;);if(-1===a)break;e=e.substring(0,r)+e.substring(a+1),r--}o[t]=e}),e=o.join(";")),!e.includes("d")&&!e.includes("y")||e.includes("#")||_i(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("#")&&!_i(e)&&(r&&(r.type=r.type||"",r.type+="time"),i=!0),i}Gi=ee.ChildProperty,e(Yi,Gi),t([ee.Property(0)],Yi.prototype,"chunkSize",void 0),t([ee.Property(3)],Yi.prototype,"retryCount",void 0),t([ee.Property(500)],Yi.prototype,"retryAfterDelay",void 0);var Gi,e=Yi;function Yi(){return null!==Gi&&Gi.apply(this,arguments)||this}Ki.prototype.addEventListener=function(){this.parent.on(ht,this.updateSheetFromDataSourceHandler,this),this.parent.on(dt,this.dataSourceChangedHandler,this),this.parent.on(pt,this.dataChangedHandler,this),this.parent.on(ct,this.triggerDataChangeHandler,this)},Ki.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(ht,this.updateSheetFromDataSourceHandler),this.parent.off(dt,this.dataSourceChangedHandler),this.parent.off(pt,this.dataChangedHandler),this.parent.off(ct,this.triggerDataChangeHandler))},Ki.prototype.updateSheetFromDataSourceHandler=function(p){var c,u,f,g,t,m,v,y,C,b,r,x=this,S=[],w=[],n=new H.Deferred,I=(p.promise=n.promise,p.autoDetectFormat),E=I&&Qn(this.parent);if(p.sheet&&p.sheet.ranges.length)for(var N,R=this,e=p.sheet.ranges.length-1;0<=e;e--)!function(i){var o,a=p.sheet.ranges[i],s=(r=te(a.startCell),p.loadFromStartCell&&(p.indexes=r),p.indexes[0]),l=p.indexes[2],e=(y=r[0],r=a.dataSource instanceof H.DataManager?a.dataSource:a.dataSource?new H.DataManager(a.dataSource):new H.DataManager,t=t||r.dataSource.url,p.sheet.isLocalData=!r.dataSource.url,y<=s?s-=y:s=y<=l?(l-=y,0):-1,a.showFieldAsHeader&&0!==s&&--s,!1),h=0,d=(R.initRangeInfo(a),R.getMaxCount(a));b=R.getLoadedInfo(s,l,a),s=b.unloadedRange[0],l=b.unloadedRange[1],a.info.insertRowRange&&(a.info.insertRowRange.forEach(function(e){h+=e[1]-e[0]+1}),s-=h,l-=h),d<=s?e=!0:d<l&&(l=d),p.loadComplete||R.requestedInfo.push({deferred:n,indexes:p.indexes,isNotLoaded:b.isNotLoaded}),0<=s&&b.isNotLoaded&&!e?(w[i]=s,S[i]=!1,a.fieldsOrder&&(o=[].slice.call(a.fieldsOrder)),e=(a.query||new H.Query).clone(),p.loadFullData||(e=e.range(s,d<=l?l:l+1)),r.executeQuery(e.requiresCount()).then(function(e){var r,t,n;x.parent&&!x.parent.isDestroyed&&(g=(e.result&&e.result.result?e.result:e).result,f=te(a.startCell),y=f[0],C=f[1],g&&g.length?(a.info.count||(d=e.count,a.info.count=e.count),u=a.info.flds||o||Object.keys(g[0]),a.info.fldLen||(a.info.fldLen=u.length,a.info.flds=u),a.info.insertColumnRange&&(r=0,a.info.insertColumnRange.forEach(function(e){for(var t=e[0];t<=e[1];t++)t<=C?u.splice(0,0,"emptyCell"+r):u.splice(t-C,0,"emptyCell"+r),r++})),0===w[i]&&a.showFieldAsHeader&&(m=y+w[i]+h,u.forEach(function(e,t){(c=se(m,C+t,p.sheet,!0))?e.includes("emptyCell")||(c.value=e):p.sheet.rows[y+w[i]].cells[C+t]=e.includes("emptyCell")?{}:{value:e}})),g.forEach(function(r,e){m=y+w[i]+e+(a.showFieldAsHeader?1:0)+h,u.forEach(function(e,t){(c=se(m,v=C+t,p.sheet,!0))?(N=c.value,e.includes("emptyCell")||Vi(m,v,p.sheet,x.getCellDataFromProp(r[e]),!0)):(N=void 0,c=p.sheet.rows[m].cells[v]=e.includes("emptyCell")?{}:x.getCellDataFromProp(r[e])),I&&E(c),p.updateDependentCellsCallback&&N!==c.value&&p.updateDependentCellsCallback(m,v)})})):u=[],e=0<y+(d||e.count)?y+(d||e.count)+(a.showFieldAsHeader?1:0)+h-1:p.sheet.usedRange.rowIndex,t=C+u.length-1<0?p.sheet.usedRange.colIndex:C+u.length-1,p.loadFullData&&(l=e),n={rowIndex:e,colIndex:t},x.parent.scrollSettings&&x.parent.scrollSettings.isFinite&&(n.rowIndex=e<p.sheet.rowCount?e:p.sheet.rowCount-1,n.colIndex=t<p.sheet.colCount?t:p.sheet.colCount-1),p.sheet.usedRange.rowIndex<n.rowIndex&&x.parent.setSheetPropertyOnMute(p.sheet,"usedRange",{rowIndex:n.rowIndex,colIndex:p.sheet.usedRange.colIndex}),p.sheet.usedRange.colIndex<n.colIndex&&x.parent.setSheetPropertyOnMute(p.sheet,"usedRange",{rowIndex:p.sheet.usedRange.rowIndex,colIndex:n.colIndex}),h?(b=x.getLoadedInfo(s,l,a),s=b.unloadedRange[0],l=b.unloadedRange[1],d<s&&(b.isNotLoaded=!1),b.isNotLoaded&&(d<l&&(l=d),a.info.loadedRange.push([s,l]))):a.info.loadedRange.push([s,l]),S[i]=!0,-1===S.indexOf(!1))&&(n=void 0,l+y<y+a.info.count?(p.rangeSettingCount||(p.rangeSettingCount=[]),p.rangeSettingCount.push(i),n=!0,e={sheet:p.sheet,indexes:[0,0,e,t],promise:new Promise(function(e){e(void 0)}),rangeSettingCount:p.rangeSettingCount,loadComplete:p.loadComplete,autoDetectFormat:p.autoDetectFormat,resolveAfterFullDataLoaded:p.resolveAfterFullDataLoaded},x.updateSheetFromDataSourceHandler(e),e.promise.then(function(){"workbook"!==x.parent.getModuleName()&&(p.rangeSettingCount.pop(),p.rangeSettingCount.length||x.parent.notify("created",null),p.formulaCellRef?x.notfyFormulaCellRefresh(p.formulaCellRef,p.sheetIndex):p.loadComplete&&p.loadComplete())})):p.formulaCellRef?x.notfyFormulaCellRefresh(p.formulaCellRef,p.sheetIndex):p.loadComplete&&p.loadComplete(),n&&p.resolveAfterFullDataLoaded||(x.checkResolve(p.indexes),p.resolveAfterFullDataLoaded&&x.checkResolve([0,0,0,0])))})):0===i&&-1===S.indexOf(!1)&&(p.loadComplete&&p.loadComplete(),R.checkResolve(p.indexes))}(e);else n.resolve()},Ki.prototype.notfyFormulaCellRefresh=function(e,t){this.parent.formulaRefCell=null,this.parent.notify(hn,{indexes:te(e),sheetIndex:t,refreshing:!0})},Ki.prototype.checkResolve=function(r){var n,i,o=0;this.requestedInfo.forEach(function(e,t){((i=JSON.stringify(e.indexes)===JSON.stringify(r))||n)&&(0===t?(e.deferred.resolve(),o++,n=!0):n&&(e.isLoaded||!e.isNotLoaded)||i&&n?(e.deferred.resolve(),o++):i?e.isLoaded=!0:n=!1)}),this.requestedInfo.splice(0,o)},Ki.prototype.getCellDataFromProp=function(e){var t={};return"[object Object]"===Object.prototype.toString.call(e)?e.formula?t.formula=e.formula:ee.isNullOrUndefined(e.value)||("string"==typeof e.value&&(0===e.value.indexOf("http://")||0===e.value.indexOf("https://")||0===e.value.indexOf("ftp://")||0===e.value.indexOf("www."))?(t.hyperlink=e.value,t.style={textDecoration:"underline",color:"#00e"}):t.value=e.value):Q(e)?t.formula=e:"string"==typeof e&&(0===e.indexOf("http://")||0===e.indexOf("https://")||0===e.indexOf("ftp://")||0===e.indexOf("www."))?(t.hyperlink=e,t.style={textDecoration:"underline",color:"#00e"}):t.value=e,t},Ki.prototype.getLoadedInfo=function(t,r,e){var n=!0;return e.info.loadedRange.forEach(function(e){e[0]<=t&&t<=e[1]?e[0]<=r&&r<=e[1]?n=!1:t=e[1]+1:e[0]<=r&&r<=e[1]&&(r=e[0]-1)}),{isNotLoaded:n,unloadedRange:[t,r]}},Ki.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},Ki.prototype.initRangeInfo=function(e){e.info||(e.info={loadedRange:[]})},Ki.prototype.dataSourceChangedHandler=function(e){var n,i,o,t,r=this,a=this.parent.sheets[e.sheetIdx],s=a.ranges[e.rangeIdx];!s||!this.checkRangeHasChanges(a,e.rangeIdx)&&s.info||(i=s.showFieldAsHeader,o=W(s.startCell),s.info&&(s.info.loadedRange.forEach(function(e){for(var t=e[0];t<=e[1]&&t<s.info.count+(i?1:0);t++)if(n=a.rows[t+o[0]])for(var r=o[1];r<o[1]+s.info.fldLen;r++)n.cells&&n.cells[r]&&delete n.cells[r]}),s.info=null),t={sheet:a,indexes:[0,0,a.rowCount-1,a.colCount-1],loadFullData:!0,promise:new Promise(function(e){e(void 0)})},this.updateSheetFromDataSourceHandler(t),t.promise.then(function(){r.parent.trigger("dataSourceChanged",{data:e.changedData,action:"dataSourceChanged",rangeIndex:e.rangeIdx,sheetIndex:e.sheetIdx}),r.parent.notify(hn,{sheetIndex:e.sheetIdx,checkWrap:!0,checkCF:!0})}))},Ki.prototype.checkRangeHasChanges=function(e,t){return!this.parent.isAngular||e.changedRangeIdx===t&&(delete e.changedRangeIdx,!0)},Ki.prototype.dataChangedHandler=function(d){var p,c,u,f,g,m,v,y,C,b=this,x=[{}],S=void 0===d.sheetIdx?this.parent.activeSheetIndex:d.sheetIdx,w=this.parent.sheets[S];w.ranges.forEach(function(e,t){if(e.dataSource){var r=void 0;if(f=W(e.startCell),u=f.concat([f[0]+e.info.count+(e.showFieldAsHeader?0:-1),f[1]+e.info.fldLen-1]),"Row"===d.modelType||"Column"===d.modelType){if("Column"===d.modelType){if(d.insertType)g=u[1]<d.index&&u[3]>=d.index,y=[d.index],g||u[3]+1===d.index&&"after"===d.insertType?(d.model.forEach(function(){e.info.flds.splice(d.index-f[1],0,"")}),e.info.fldLen+=d.model.length):u[1]>=d.index&&(e.startCell=G(f[0],f[1]+d.model.length));else if(g=u[1]<=d.startIndex&&u[3]>=d.startIndex)for(var n=d.startIndex;n<=d.endIndex;n++)n<=u[3]&&(e.info.flds.splice(d.startIndex,1),--e.info.fldLen);return}if(d.insertType){if(g=(e.showFieldAsHeader||"above"!==d.insertType&&!d.isMethod?u[0]<d.index:u[0]<=d.index)&&u[2]>=d.index,y=[d.index],g||u[2]+1===d.index&&"below"===d.insertType?(r=!0,e.info.count+=d.model.length):u[0]>=d.index&&(e.startCell=G(f[0]+d.model.length,f[1])),d.isMethod)return}else g=u[0]<=d.startIndex&&u[2]>=d.startIndex,d.isDataRequest?y=[d.startIndex,u[1],d.startIndex,u[1]]:p="delete"}else{var i=d.address||d.range||d.fillRange,o=(y=te(d.requestType&&d.requestType.toLowerCase().includes("paste")?d.pastedRange.substring(d.pastedRange.lastIndexOf("!")+1):-1<d.sheetIdx?d.address:i.substring(i.lastIndexOf("!")+1)),[e.showFieldAsHeader?u[0]+1:u[0]].concat(u.slice(1,4)));if(e.showFieldAsHeader&&y[0]===f[0])for(n=y[1];n<=y[3];n++)n>=o[1]&&n<=o[3]&&(e.info.flds[n-f[1]]=se(f[0],n,w,!1,!0).value||"");if(g=Ln(o,y,!0),"paste"===d.requestType&&d.copiedInfo.isCut){if(C=[].slice.call(d.copiedInfo.range),e.showFieldAsHeader&&C[0]===f[0]){for(n=C[1];n<=C[3];n++)n>=o[1]&&n<=o[3]&&(e.info.flds[n-f[1]]="");g=!1}m=Ln(o,C,!0)}}if(g||r||m){if("Row"!==d.modelType||d.insertType||d.isDataRequest){p=r?"add":"edit";var a=0;if(m)for(a=C[2]-C[0]+1,n=0;n<a;n++)!function(r){x[r]={},e.info.flds.forEach(function(e,t){e&&(c=se(C[0]+r,f[1]+t,w),x[r][""+e]=b.getFormattedValue(c))})}(n);if(g||r)for(var s,l=!(d.isDataRequest||m||r||d.skipFilterCheck),n=0,h=0;n<(r?d.model.length:y[2]-y[0]+1||1);n++)!function(r,n){if(l&&Fh(w,y[0]+r))return s=n;x[n+a]={},e.info.flds.forEach(function(e,t){e&&(c=se(y[0]+r,f[1]+t,w),x[n+a][""+e]=b.getFormattedValue(c))}),s=++n}(n,h),h=s}else{if(d.deletedModel.forEach(function(r,n){x[n]={},e.info.flds.forEach(function(e,t){r.cells?(c=r.cells[f[1]+t],x[n][""+e]=b.getFormattedValue(c)):x[n][""+e]=null}),--e.info.count}),d.isMethod)return;v={count:d.deletedModel.length,index:d.endIndex}}d.isDataRequest?d.data=x:b.parent.trigger("dataSourceChanged",{data:x,action:p,rangeIndex:t,sheetIndex:S})}else v&&v.count&&u[0]>v.index&&(e.startCell=G(f[0]-v.count,f[1]))}})},Ki.prototype.getFormattedValue=function(e){var t=this.parent.getDisplayText(e);return""===t?null:e&&!e.format&&"number"==typeof e.value?e.value:t},Ki.prototype.triggerDataChangeHandler=function(e){var t=!0;(t=("delete"===e.action||"insert"===e.action)&&-1<["Sheet"].indexOf(e.eventArgs.modelType)||"clear"===e.action&&-1<["Clear Formats","Clear Hyperlinks"].indexOf(e.eventArgs.type)||"clipboard"===e.action&&"Formats"===e.eventArgs.requestType?!1:t)&&-1<["insert","delete","edit","cellDelete","cellSave","autofill","clipboard","clear"].indexOf(e.action)&&(t=void 0,!e.isUndo||"delete"!==e.action&&"insert"!==e.action?t=e.eventArgs:(t=ee.extend({},e.eventArgs),"delete"===e.action?(t.index=t.startIndex,t.model=t.deletedModel,t.insertType="below"):(t.startIndex=t.index,t.endIndex=e.eventArgs.index+e.eventArgs.model.length-1,t.deletedModel=t.model,delete t.insertType)),this.parent.notify(pt,t))},Ki.prototype.getModuleName=function(){return"dataBind"},Ki.prototype.destroy=function(){this.removeEventListener(),this.parent=null,this.requestedInfo=[]};var Xi=Ki;function Ki(e){this.parent=e,this.requestedInfo=[],this.addEventListener()}var $i="ribbon",Zi="formulaBar",Ji="sheetTabs",Qi="refreshSheetTabs",eo="isFormulaBarEdit",to="contentLoaded",ro="mouseDown",no="spreadsheetDestroyed",io="editOperation",oo="formulaOperation",ao="formulaBarOperation",so="click",lo="keyUp",ho="keyDown",po="verticalScroll",co="horizontalScroll",uo="focusRenameInput",fo="beforeContentLoaded",go="beforeVirtualContentLoaded",mo="virtualContentLoaded",vo="cellNavigate",yo="mouseUpAfterSelection",Co="contextmenuBeforeOpen",bo="insertSheetTab",xo="removeSheetTab",So="renameSheetTab",wo="ribboClick",Io="enableToolbarItems",Eo="tabSwitch",No="selectRange",Ro="rangeSelectionByKeydown",Fo="cut",ko="copy",Oo="paste",Ao="clearCopy",To="dataBound",Do="beforeDataBound",Lo="addContextMenuItems",Po="removeContextMenuItems",Mo="enableContextMenuItems",Bo="enableFileMenuItems",Uo="hideFileMenuItems",Ho="addFileMenuItems",Vo="hideRibbonTabs",jo="enableRibbonTabs",zo="addRibbonTabs",_o="addToolbarItems",qo="hideToolbarItems",Wo="beforeRibbonCreate",Go="rowHeightChanged",Yo="colWidthChanged",Xo="onContentScroll",Ko="deInitProperties",$o="activeSheetChanged",Zo="initiateCustomSort",Jo="applySort",Qo="autoFitRowsColumns",ea="refreshFilterCellsOnResize",ta="updateToggleItem",ra="initiateHyperlink",na="editHyperlink",ia="openHyperlink",oa="addNote",aa="editNote",sa="deleteNote",la="showNote",ha="createNoteIndicator",da="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",Fa="getFilteredColumn",le="actionComplete",ka="filterCellKeyDown",Oa="getFilterRange",Aa="setAutoFit",Ta="refreshFormulaDatasource",Da="initiatedatavalidation",La="invalidData",Pa="protectSheet",Ma="applyProtect",Ba="protectCellFormat",Ua="renderGotoDlgt",Ha="renderFindDlg",Va="findHandler",ja="created",za="spreadsheetCreated",_a="editAlert",qa="readonlyAlert",Wa="setUndoRedo",Ga="enableFormulaInput",Ya="protectSelection",Xa="hiddenMerge",Ka="checkPrevMerge",$a="checkMerge",Za="removeDataValidation",Ja="showAggregate",Qa="goToSheet",es="showSheet",ts="renderCFDlg",rs="clearViewer",ns="initiateFormulaReference",is="initiateCur",os="clearCellRef",as="editValue",ss="addressHandle",ls="initiateEdit",hs="forRefSelRender",ds="insertImage",ps="refreshOverlayElem",cs="refreshImgCellObj",us="getRowIdxFromClientY",fs="getColIdxFromClientX",gs="createImageElement",ms="deleteImage",vs="deleteChart",ys="refreshChartCellObj",Cs="refreshChartCellModel",bs="refreshImagePosition",xs="updateTableWidth",Ss="focusBorder",ws="clearChartBorder",Is="insertChart",Es="chartRangeSelection",Ns="insertDesignChart",Rs="removeDesignChart",Fs="chartDesignTab",ks="addChartEle",Os="undoRedoForChartDesign",As="protectWorkbook",Ts="unProtectWorkbook",Ds="getPassWord",Ls="setProtectWorkbook",Ps="removeWorkbookProtection",Ms="importProtectWorkbook",Bs="selectionStatus",Us="freeze",Hs="overlayEleSize",Vs="updateScroll",js="positionAutoFillElement",zs="hideAutoFillOptions",_s="performAutoFill",qs="selectAutoFillRange",Ws="hideAutoFillElement",Gs="unProtectSheetPassword",Ys="updateTranslate",Xs="getUpdatedScrollPosition",Ks="updateScrollValue",$s="beforeCheckboxfilterRenderer",Zs="refreshCheckbox",Js="renderInsertDlg",Qs="toggleProtect",el="propertyChange",tl="updateWrapCell",rl=(nl.prototype.open=function(e){this.load(e)},nl.prototype.load=function(t,e){var r=this;if(this.parent.allowOpen)if(t.jsonObject)this.fetchSuccess(t.jsonObject,t,null,!0,!0);else{var n=new FormData;if(t.file)n.append("file",t.file);else{if(!(0<=t.sheetIndex))return void(this.parent.isOpen=!1);n.append("sheetPassword",t.sheetPassword),n.append("sheetIndex",t.sheetIndex.toString())}var i={passWord:""},o=(t.password&&t.password.length&&(i.passWord=t.password),i.passWord&&i.passWord.length&&(t.password=i.passWord),t.password&&n.append("password",t.password),n.append("IsManualCalculationEnabled",("Manual"===this.parent.calculationMode).toString()),{file:t.file||null,cancel:!1,requestData:{method:"POST",body:n},password:i.passWord}),i=t.guid;ee.isNullOrUndefined(t.sheetPassword)&&!i&&ee.isNullOrUndefined(e)?(this.parent.trigger("beforeOpen",o),this.parent.notify(gt,{eventArgs:o,action:"beforeOpen"})):i&&n.append("guid",i),o.cancel?this.parent.isOpen=!1:(i={chunkSize:null,documentId:null},0<this.parent.openSettings.chunkSize&&ee.isNullOrUndefined(t.sheetPassword)&&(this.setToDefaults(e),ee.isNullOrUndefined(this.parent.openSettings.chunkSize)||0===this.parent.openSettings.chunkSize||(i.chunkSize=this.parent.openSettings.chunkSize.toString()),ee.isNullOrUndefined(this.currentDocumentId)||(i.documentId=this.currentDocumentId),ee.isNullOrUndefined(i)||n.append("chunkPayload",JSON.stringify(i))),fetch(this.parent.openUrl,o.requestData).then(function(e){return e.ok?e.json():Promise.reject({status:e.status,statusText:e.statusText,url:e.url})}).then(function(e){return r.fetchSuccess(e,o,t.orginalFile,void 0,!0)}).catch(function(e){-1===e.toString().indexOf("Unexpected end of JSON input")&&0<r.parent.openSettings.chunkSize&&r.retryCount<r.parent.openSettings.retryCount?setTimeout(function(){r.retryCount++,r.load(t,!0)},r.parent.openSettings.retryAfterDelay):(r.retryCount>=r.parent.openSettings.retryCount&&(r.retryCount=0),r.fetchFailure(e))}))}},nl.prototype.fetchFailure=function(e){ee.isUndefined(e.status)&&ee.isUndefined(e.statusText)&&(e.statusText="Improper response"),this.parent.notify(Bt,e),this.parent.isOpen=!1},nl.prototype.fetchSuccess=function(e,t,r,n,i){var e="string"==typeof e?JSON.parse(e):e,o=e.Workbook;if(ee.isNullOrUndefined(o)){var a=e.chunkTotalCount,s=(this.currentDocumentId=e.documentId,this.chunkList=new Array(a),0),l=a>this.parent.openSettings.chunkSize?this.parent.openSettings.chunkSize:a,h=0,d=(this.processedLoopIndex=0,this);if(!ee.isNullOrUndefined(a))for(;s<a;)d.processChunk(s,l,h,"",t,r,n,i),l=(s+=d.parent.openSettings.chunkSize)+d.parent.openSettings.chunkSize<a?d.parent.openSettings.chunkSize:a-s,h++,d.processedLoopIndex++}else-1<["UnsupportedFile","InvalidUrl","NeedPassword","InCorrectPassword","InCorrectSheetPassword","CorrectSheetPassword","DataLimitExceeded","FileSizeLimitExceeded","ExternalWorkbook"].indexOf(o)?(r&&(t.file=r),this.parent.notify(Mt,{context:this,data:o,guid:e.Guid,eventArgs:t,isOpenFromJson:n})):(this.updateModel(o,n,i),this.parent.notify(Mt,{context:this,data:o,isOpenFromJson:n,eventArgs:t}),this.parent.isOpen=!1,t&&t.password&&0<t.password.length&&(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=""))},nl.prototype.processChunk=function(t,r,n,a,s,l,h,d){var p=this,e={currentChunk:t.toString(),chunkSize:r.toString(),loopIndex:n.toString(),documentId:this.currentDocumentId},i=new FormData,e=(i.append("chunkPayload",JSON.stringify(e)),{file:l||null,cancel:!1,requestData:{method:"POST",body:i},password:s.password});fetch(this.parent.openUrl,e.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),p.chunkList[e.loopIndex]=t,p.loopIndex++,p.loopIndex===p.processedLoopIndex){for(var i=p.chunkList.splice(0,p.loopIndex),o=0;o<i.length;o++)a+=i.slice(o,o+1).join("");e=JSON.parse(a),p.setToDefaults(),p.fetchSuccess(e,s,l,h,d)}}}).catch(function(e){if(ee.isNullOrUndefined(p.currentFailedChunkIndex)||p.currentFailedChunkIndex===t){if(p.currentFailedChunkIndex=t,!(p.retryCount<p.parent.openSettings.retryCount))return p.retryCount=0,p.fetchFailure(e);setTimeout(function(){p.processedLoopIndex=n,p.processChunk(t,r,n,a,s,l,h,d),p.retryCount++},p.parent.openSettings.retryAfterDelay)}})},nl.prototype.setToDefaults=function(e){this.currentFailedChunkIndex=null,e||(this.retryCount=0),this.loopIndex=0,this.processedLoopIndex=0,this.chunkList=[]},nl.prototype.updateModel=function(e,t,r){this.parent.notify(ie,{action:"unRegisterSheet"}),this.setSelectAllRange(e.sheets,t),this.parent.sheetNameCount=1,this.parent.sheets=[],this.parent.notify(Ht,{}),this.parent.notify(ba,null),e.activeSheetIndex=e.activeSheetIndex||e.sheets.findIndex(function(e){return"Hidden"!==e.state}),this.parent.setProperties({isProtected:e.isProtected||!1,password:e.password||"",sheets:e.sheets,activeSheetIndex:e.activeSheetIndex,definedNames:e.definedNames||[],filterCollection:e.filterCollection||[],sortCollection:e.sortCollection||[],listSeparator:e.listSeparator||this.parent.listSeparator},!0),ee.isNullOrUndefined(e.showSheetTabs)||(this.parent.showSheetTabs=e.showSheetTabs),Ti(this.parent,void 0,r),this.parent.notify(Ut,null),this.parent.notify(ie,{action:"registerSheet",isImport:!0}),this.parent.notify(ie,{action:"initiateDefinedNames"}),this.parent.notify(Sr,null)},nl.prototype.setSelectAllRange=function(e,o){var a,s,l=this;e.forEach(function(e){var t,r,n;if(e.selectedRange&&(t=te(e.selectedRange),r=(ee.isUndefined(e.rowCount)?100:e.rowCount)-1,n=(ee.isUndefined(e.colCount)?100:e.colCount)-1,65535===t[2]&&(t[2]=r),255===t[3]&&(t[3]=n),65535===t[0]&&(t[0]=r),255===t[1]&&(t[1]=n),e.selectedRange=re(t)),o&&l.parent.isAngular)for(var i=0;i<l.parent.sheets.length;i++)if(a=ae(l.parent,i),e.name===a.name){e.ranges&&e.ranges.forEach(function(e,t){(s=a.ranges[t])&&s.template&&(e.template=s.template)});break}})},nl.prototype.sheetsDestroyHandler=function(e){ee.isNullOrUndefined(e.sheetIndex)&&(this.preventFormatCheck=null)},nl.prototype.addEventListener=function(){this.parent.on(ut,this.open.bind(this)),this.parent.on(Ht,this.sheetsDestroyHandler,this)},nl.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(ut,this.open.bind(this)),this.parent.off(Ht,this.sheetsDestroyHandler))},nl.prototype.destroy=function(){this.removeEventListener(),this.parent.refreshing||(this.preventFormatCheck=null),this.parent=null},nl.prototype.getModuleName=function(){return"workbookOpen"},nl);function nl(e){this.loopIndex=0,this.processedLoopIndex=0,this.retryCount=0,this.currentDocumentId=null,this.parent=e,this.addEventListener()}function il(e){this.parent=e}il.prototype.processSheet=function(e,t){return[t,JSON.parse(e,function(e,t){if(!Array.isArray(t)&&"string"!=typeof t||t.length)return t})]},il.prototype.processSave=function(e,t,o,r,a){var n,s=this,i=new FormData,l=Object.keys(t);for(i.append("JSONData",JSON.stringify(e)),n=0;n<l.length;n++)i.append(l[n],t[l[n]]);for(l=Object.keys(o),n=0;n<l.length;n++)i.append(l[n],o[l[n]]);i.append("pdfLayoutSettings",JSON.stringify(r)),fetch(t.url,{method:"POST",body:i}).then(function(e){return e.ok?e.blob():Promise.reject({message:e.statusText})}).then(function(i){new Promise(function(r){var n=new FileReader;n.onload=function(){var e=n.result.toString(),t=o.customParams&&"string"==typeof o.customParams&&"saveashtml"===o.customParams.toLowerCase();-1<e.indexOf("data:text/plain;base64,")||!t&&-1<e.indexOf("data:text/html;base64,")||-1<e.indexOf("data:application/json;base64,")?(t=void 0,(t=-1<(e=(e=e.replace("data:text/plain;base64,","")).replace("data:text/html;base64,","")).indexOf("data:application/json;base64,")?(e=e.replace("data:application/json;base64,",""),atob(e).split(".")):atob(e).split(/(\r\n|\n|\r)/gm)).length&&(e=1<t[0].length&&'"'===t[0][0]?t[0].split('"')[1]+".":t[0],a?a.apply(s,[{dialog:e}]):postMessage({dialog:e}))):a?a.apply(s,[i]):postMessage(i),r(n.result)},n.readAsDataURL(i)})}).catch(function(e){a?a.apply(s,[{error:e.message}]):postMessage({error:e.message})})},ol=function(e,t){return(ol=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)};var ol,al,sl=function(){return(sl=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}).apply(this,arguments)},ll=(function(e,t){function r(){this.constructor=e}ol(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}(hl,al=il),hl.prototype.getModuleName=function(){return"workbookSave"},hl.prototype.destroy=function(){this.removeEventListener(),this.parent=null},hl.prototype.addEventListener=function(){this.parent.on(ft,this.initiateSave,this),this.parent.on("getStringifyObject",this.performStringifyAction,this)},hl.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(ft,this.initiateSave),this.parent.off("getStringifyObject",this.performStringifyAction))},hl.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)},hl.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"]),e=JSON.parse(e);this.parent.sheets.length&&(e.sheets=[]),this.saveJSON=e,this.saveJSON.filterCollection=[]},hl.prototype.processSheets=function(e,t){var r,n=this,i=["dataSource","startCell","query","showFieldAsHeader","result"];if(this.parent.isAngular&&i.push("template"),t)if(t.onlyValues)i.push.apply(i,["style","formula","format","conditionalFormats","validation","hyperlink","wrap","chart","image","notes"]);else{var o,a={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(o in t.ignoreFreezePane&&i.push.apply(i,["frozenColumns","frozenRows"]),a)a[o]&&i.push(o)}for(var s=0,l=this.parent.sheets.length;s<l;s++){for(var h,d=!1,p=!1,c=0,u=(h=this.parent.sheets[s]).ranges.length;c<u;c++)if((r=h.ranges[c]).dataSource&&(p=!0,!r.info||!r.info.loadedRange||!r.info.loadedRange.length)){d=!0;break}d?this.parent.notify(ht,{sheet:h,sheetIndex:s,loadComplete:function(e){x(n,n.processSheet,n.updateSheet,[n.getStringifyObject(n.parent.sheets[e],i,e,!1,!0),e],null,n.parent)}.bind(this,s),loadFromStartCell:!0,autoDetectFormat:e}):x(this,this.processSheet,this.updateSheet,[this.getStringifyObject(h,i,s,e&&p,!0),s],null,this.parent)}},hl.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)},hl.prototype.getSheetLength=function(e){var t=0;return e.forEach(function(e){e&&t++}),t},hl.prototype.save=function(e){var t={cancel:!1,jsonObject:this.saveJSON};this.parent.notify(or,t),t.cancel||(this.isFullPost?(this.initiateFullPostSave(),this.saveJSON={}):x(this,{workerTask:this.processSave},this.updateSaveResult,[this.saveJSON,e,this.customParams,this.pdfLayoutSettings],!0,this.parent))},hl.prototype.updateSaveResult=function(e){var t;e.isFormDataError?this.processSave(this.saveJSON,this.saveSettings,this.customParams,this.pdfLayoutSettings,this.updateSaveResult):(this.saveJSON={},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(Kr,{content:e.dialog}):this.needBlobData?t.blobData=e:this.ClientFileDownload(e),this.parent.trigger("saveComplete",t),this.parent.notify(bt,t))},hl.prototype.ClientFileDownload=function(e){var t=this.parent.createElement("a",{attrs:{download:this.getFileNameWithExtension()}}),e=URL.createObjectURL(e);t.href=e,document.body.appendChild(t),t.click(),URL.revokeObjectURL(e),document.body.removeChild(t)},hl.prototype.initiateFullPostSave=function(){var e,t=Object.keys(this.saveSettings),r=this.parent.createElement("form",{attrs:{method:"POST",action:this.saveSettings.url}}),n=this.parent.createElement("input",{attrs:{type:"hidden",name:"JSONData"}});for(n.value=JSON.stringify(this.saveJSON),r.appendChild(n),e=0;e<t.length;e++)(n=this.parent.createElement("input",{attrs:{type:"hidden",name:t[e]}})).value=this.saveSettings[t[e]],r.appendChild(n);for(t=Object.keys(this.customParams),e=0;e<t.length;e++)(n=this.parent.createElement("input",{attrs:{type:"hidden",name:t[e]}})).value=this.customParams[t[e]],r.appendChild(n);(n=this.parent.createElement("input",{attrs:{type:"hidden",name:"pdfLayoutSettings"}})).value=JSON.stringify(this.pdfLayoutSettings),r.appendChild(n),document.body.appendChild(r),r.submit(),ee.detach(r),this.parent.notify(bt,{})},hl.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?",":"]}}}")},hl.prototype.getStringifyObject=function(p,c,u,f,e){var g,m=this,v=(void 0===c&&(c=[]),0===u&&this.parent.notify(zt,{clearAll:!0}),e&&this.parent.notify(Ct,{sheetIdx:u,isSaveAction:!0,saveJson:this.saveJSON}),[]),y=f&&Qn(this.parent),e=JSON.stringify(p,function(e,r){if(!(-1<c.indexOf(e))){if("cellStyle"===e)return m.parent.commonCellStyle;if(r&&r.cells)for(var t=0,n=r.cells.length;t<n;t++){var i=r.cells[t],o=[Number(e),t];if(i&&(i.value?f&&!i.formula&&y(i):i.formula&&i.formula.indexOf("=UNIQUE(")<0&&("Automatic"===m.parent.calculationMode&&m.parent.notify(ie,{action:"refreshCalculate",value:i.formula,rowIndex:o[0],colIndex:t,isFormula:Q(i.formula),sheetIndex:u,isRefreshing:!0}),i.value=se(o[0],t,p).value),i.chart)){v.push({index:o,chart:i.chart}),g=[];for(var a=0,s=i.chart.length;a<s;a++){var l=Object.assign({},i.chart[a]);delete l.id,g.push(l)}i.chart=g}}var h,d;return"validation"===e&&r&&"string"==typeof r.type&&"Time"===r.type&&["value1","value2"].forEach(function(e){var t=r[e]&&r[e].toString();t&&!oe(Number(t))&&(r[e]=m.getDateAsNumber({range:[],cell:{value:t}},t))}),r&&r.properties&&r.maxHgts&&(r.properties=sl({},r.properties,{maxHgts:r.maxHgts})),r&&"object"==typeof r&&r.hasOwnProperty("properties")?(r.propName&&"conditionalFormats"===r.propName.toString()&&(h=r.properties).format&&h.format.style&&(d=h.format.style)&&"#ffffff"===d.backgroundColor&&"#000000"===d.color&&"bold"!==d.fontWeight&&"italic"!==d.fontStyle&&"underline"!==d.textDecoration&&delete h.format,r.properties):null!==r?r:void 0}}),t=ae(this.parent,u);return v.forEach(function(e){Vi(e.index[0],e.index[1],t,{chart:e.chart},!0)}),e},hl.prototype.getDateAsNumber=function(e,t){e={value:t,rowIndex:e.range[0],cell:e.cell,colIndex:e.range[1],sheetIndex:e.sheetIdx,updatedVal:""};return this.parent.notify(At,e),e.updatedVal||t},hl.prototype.getFileNameWithExtension=function(e){e=e||this.saveSettings.fileName;var t=this.getFileExtension(),r=e.lastIndexOf(".");return(e=-1<r?e.substr(0,r):e)+t},hl.prototype.getFileExtension=function(){return"."+this.saveSettings.saveType.toLowerCase()},hl);function hl(e){e=al.call(this,e)||this;return e.isProcessCompleted=!1,e.saveJSON={},e.isFullPost=!1,e.needBlobData=!1,e.customParams=null,e.pdfLayoutSettings={fitSheetOnOnePage:!1},e.addEventListener(),e}(t=z.CommonErrors||(z.CommonErrors={}))[t.NA=0]="NA",t[t.Value=1]="Value",t[t.Ref=2]="Ref",t[t.DivZero=3]="DivZero",t[t.Num=4]="Num",t[t.Name=5]="Name",t[t.Null=6]="Null",t[t.Calc=7]="Calc",(t=z.FormulasErrorsStrings||(z.FormulasErrorsStrings={}))[t.OperatorsCannotStartWithExpression=0]="OperatorsCannotStartWithExpression",t[t.ReservedWordAND=1]="ReservedWordAND",t[t.ReservedWordXOR=2]="ReservedWordXOR",t[t.ReservedWordIf=3]="ReservedWordIf",t[t.NumberContains2DecimalPoints=4]="NumberContains2DecimalPoints",t[t.ReservedWordElse=5]="ReservedWordElse",t[t.ReservedWordNOT=6]="ReservedWordNOT",t[t.InvalidCharInNumber=7]="InvalidCharInNumber",t[t.InvalidCharactersFollowingWithOperator=6]="InvalidCharactersFollowingWithOperator",t[t.MismatchedParentheses=8]="MismatchedParentheses",t[t.UnknownFormulaName=9]="UnknownFormulaName",t[t.RequiresASingleArgument=10]="RequiresASingleArgument",t[t.Requires3Args=11]="Requires3Args",t[t.InvalidMathArgument=12]="InvalidMathArgument",t[t.Requires2Args=13]="Requires2Args",t[t.BadIndex=14]="BadIndex",t[t.TooComplex=15]="TooComplex",t[t.CircularReference=16]="CircularReference",t[t.MissingFormula=17]="MissingFormula",t[t.ImproperFormula=18]="ImproperFormula",t[t.InvalidExpression=19]="InvalidExpression",t[t.CellEmpty=20]="CellEmpty",t[t.BadFormula=21]="BadFormula",t[t.EmptyExpression=22]="EmptyExpression",t[t.VirtualModeRequired=23]="VirtualModeRequired",t[t.MismatchedTics=24]="MismatchedTics",t[t.WrongNumberArguments=25]="WrongNumberArguments",t[t.InvalidArguments=26]="InvalidArguments",t[t.IterationsDoNotConverge=27]="IterationsDoNotConverge",t[t.CalculationOverflow=29]="CalculationOverflow",t[t.AlreadyRegistered=28]="AlreadyRegistered",t[t.MissingSheet=30]="MissingSheet",t[t.CannotParse=31]="CannotParse",t[t.ExpressionCannotEndWithAnOperator=32]="ExpressionCannotEndWithAnOperator",t[t.Spill=33]="Spill",t[t.Div=34]="Div",(t=z.ExcelFileFormats||(z.ExcelFileFormats={})).xlsx="xlsx",t.xlsm="xlsm",t.xlsb="xlsb",t.xltx="xltx",t.xltm="xltm",t.xls="xls",t.xml="xml",t.xlam="xlam",t.xla="xla",t.xlw="xlw",t.xlr="xlr",t.prn="prn",t.txt="txt",t.csv="csv",t.dif="dif",t.slk="slk";dl.prototype.getModuleName=function(){return"calc-common"};t=dl;function dl(e){this.parent=e}function pl(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":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;case"ddd":e="E";break;default:e=""}return e}function cl(e){var t,r=!1;for(t in z.ExcelFileFormats)if(-1<e.indexOf("."+t+"]")){r=!0;break}return r}function ul(e){var t=[];return e.includeBasicFormulas&&t.push({member:"basic-formulas",args:[e]}),t}function fl(e,t){for(var r=t,n=e.replace(/\[/g,".").replace(/\]/g,"").split("."),i=0;i<n.length&&!ee.isUndefined(r);i++)r=r[n[i]];return r}function gl(e,t,r){for(var n,i=e.replace(/\[/g,".").replace(/\]/g,"").split("."),e=r||{},o=e,a=i.length,s=0;s<a;s++)n=i[s],s+1===a?o[""+n]=void 0===t?{}:t:ee.isNullOrUndefined(o[""+n])&&(o[""+n]={}),o=o[""+n];return e}vl.prototype.inject=function(e,t){var r=e.length;if(0===r)this.clean();else{this.loadedModules.length&&this.clearUnusedModule(e);for(var n=0;n<r;n++)for(var i=e[n],o=0,a=t;o<a.length;o++){var s,l=a[o],h=i.member;l.prototype.getModuleName()!==i.member||this.isModuleLoaded(h)||(s=this.createInstance(l,i.args),h=this.getMemberName(h),i.isProperty?gl(h,l,this.parent):gl(h,s,this.parent),(l=i).member=h,this.loadedModules.push(l))}}},vl.prototype.createInstance=function(e,t){return t.unshift(void 0),new(Function.prototype.bind.apply(e,t))},vl.prototype.clean=function(){for(var e=0,t=this.loadedModules;e<t.length;e++){var r=t[e];r.isProperty||fl(r.member,this.parent).destroy()}this.loadedModules=[]},vl.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 o=i[n];o.isProperty||fl(o.member,this.parent).destroy(),this.loadedModules.splice(this.loadedModules.indexOf(o),1),this.deleteObject(this.parent,o.member)}},vl.prototype.getMemberName=function(e){return e[0].toLowerCase()+e.substring(1)+"Module"},vl.prototype.deleteObject=function(e,t){delete e[""+t]},vl.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};var ml=vl;function vl(e){this.loadedModules=[],this.parent=e}r.prototype.init=function(){for(var e,t=0;t<this.formulas.length;t++)e=ee.getValue("Compute"+this.formulas[t].formulaName,this).bind(this),this.addFormulaCollection(this.formulas[t].formulaName.toUpperCase(),e,this.formulas[t].category,this.formulas[t].description)},r.prototype.addFormulaCollection=function(e,t,r,n){this.parent.libraryFormulas={fName:e,handler:t,category:r,description:n}},r.prototype.ComputeSUM=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=!1;if(e.length&&"isSubtotal"===e[e.length-1]&&(r=!0,e.pop()),ee.isNullOrUndefined(e)||1===e.length&&""===e[0])return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.InvalidArguments];var n,i=0,o=0;if(!ee.isNullOrUndefined(e))for(var a=e,s=function(e){-1<e.toString().indexOf(".")&&(o=Math.max(o,e.split(".")[1].length))},l=0;l<a.length;l++){var h=a[l].toString();if(-1<h.indexOf(":")&&this.parent.isCellReference(h)){for(var d=this.parent.getCellCollection(h.split(this.parent.tic).join("")),p=0;p<d.length;p++)if(n=r?this.parent.getValueFromArg(d[p],null,null,!0):this.parent.getValueFromArg(d[p]),!r||!n.includes("SUBTOTAL(")){if(-1<this.parent.getErrorStrings().indexOf(n))return n;ee.isNullOrUndefined(n[0])||isNaN(this.parent.parseFloat(n))||(s(n),i+=this.parent.parseFloat(n))}}else{if(-1<a[l].indexOf(this.parent.tic)&&(isNaN(this.parent.parseFloat(a[l].split(this.parent.tic).join("")))||""===a[l].split(this.parent.tic).join("").trim()))return this.parent.getErrorStrings()[z.CommonErrors.Value];if(a[l].split(this.parent.tic).join("")===this.parent.trueValue&&(a[l]="1"),a[l].split(this.parent.tic).join("")===this.parent.falseValue&&(a[l]="0"),h=r?this.parent.getValueFromArg(a[l].split(this.parent.tic).join(""),null,null,!0):this.parent.getValueFromArg(a[l].split(this.parent.tic).join("")),!r||!h.includes("SUBTOTAL(")){if(-1<this.parent.getErrorStrings().indexOf(h))return h;ee.isNullOrUndefined(h)||isNaN(this.parent.parseFloat(h))||0<h.length&&(s(h),i+=this.parent.parseFloat(h+""))}}}return-1<i.toString().indexOf(".")?i.toFixed(o):i},r.prototype.ComputeINT=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[z.FormulasErrorsStrings.InvalidArguments];if(1<t.length)return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.WrongNumberArguments];if(e=this.parent.getValueFromArg(t[0]),!(-1<n.indexOf(e))){if(e.toUpperCase()===this.parent.trueValue?e="1":e.toUpperCase()===this.parent.falseValue&&(e="0"),!this.parent.isCellReference(t[0])&&""===(e=-1===t[0].indexOf(this.parent.tic+this.parent.tic)?e.split(this.parent.tic).join(""):e).trim())return n[z.CommonErrors.Value];if(-1<e.indexOf("%")&&(e=(.01*Number(e.split("%")[0])).toString()),isNaN(this.parent.parseFloat(e)))return n[z.CommonErrors.Value];e=this.parent.parseFloat(e),e=Math.floor(e)}return e},r.prototype.ComputeTODAY=function(){for(var e,t,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return 1!==r.length||""!==r[0]?e=this.parent.formulaErrorStrings[z.FormulasErrorsStrings.InvalidArguments]:(t=new Date(Date.now()),"spreadsheet"===this.parent.parentObject.getModuleName()?(e=this.parent.parentObject.dateToInt(t),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=t.getFullYear()+"/"+this.parent.calculateDate((t.getMonth()+1).toString())+"/"+this.parent.calculateDate(t.getDate().toString())),e},r.prototype.ComputeWEEKDAY=function(){for(var e,t,r,n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];if(""===n[0]&&ee.isNullOrUndefined(n[1])||2<n.length)return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.InvalidArguments];if(""===n[0]&&""===n[1]||""===n[1])return this.parent.getErrorStrings()[z.CommonErrors.Num].toString();if(1===n.length&&n.push("1"),-1<n[0].indexOf(this.parent.tic)&&""===n[0].split(this.parent.tic).join("").trim()||""===n[1].split(this.parent.tic).join("").trim()||-1<n[1].indexOf(this.parent.tic)&&isNaN(this.parent.parseFloat(n[1].split(this.parent.tic).join(""))))return this.parent.getErrorStrings()[z.CommonErrors.Value];if(this.parent.isCellReference(n[0])){if(-1<(e=this.parent.getValueFromArg(n[0].split(this.parent.tic).join(""))||"0").indexOf(this.parent.tic))return this.parent.getErrorStrings()[z.CommonErrors.Value]}else e=-1<n[0].indexOf(this.parent.tic)&&isNaN(this.parent.parseFloat(n[0].split(this.parent.tic).join("")))?this.parent.getValueFromArg(n[0]):this.parent.getValueFromArg(n[0].split(this.parent.tic).join(""))||"0";if(t=this.parent.isCellReference(n[1])?this.parent.getValueFromArg(n[1].split(this.parent.tic).join(""))||"0":this.parent.getValueFromArg(n[1].split(this.parent.tic).join("")),-1<this.parent.getErrorStrings().indexOf(e))return e;if(-1<this.parent.getErrorStrings().indexOf(t))return t;if(e=e===this.parent.trueValue?"1":e===this.parent.falseValue?"0":e,t=t===this.parent.trueValue?"1":t===this.parent.falseValue?"0":t,r=this.parent.parseFloat(e),t=this.parent.parseFloat(t),isNaN(t)||isNaN(r))return this.parent.getErrorStrings()[z.CommonErrors.Value];if(r<0||2958465<r)return this.parent.getErrorStrings()[z.CommonErrors.Num].toString();switch(t=parseInt(t.toString(),10),r=r<1?0:Math.floor(r)%7,t){case 1:case 17:r=r<=0?r+7:r;break;case 2:case 11:r=(r-=1)<=0?r+7:r;break;case 3:r=(r-=2)<0?r+7:r;break;case 12:r=7<(r+=5)?r-7:r;break;case 13:r=7<(r+=4)?r-7:r;break;case 14:r=7<(r+=3)?r-7:r;break;case 15:r=7<(r+=2)?r-7:r;break;case 16:r=7<(r+=1)?r-7:r;break;default:r=this.parent.getErrorStrings()[z.CommonErrors.Num].toString()}return r},r.prototype.ComputePROPER=function(){for(var e,t,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var i=this.parent.getErrorStrings();return r.length&&"nestedFormulaTrue"===r[r.length-1]&&(t=!0,r.pop()),ee.isNullOrUndefined(r)||""===r[0].trim()&&1===r.length?this.parent.formulaErrorStrings[z.FormulasErrorsStrings.InvalidArguments]:1<r.length?this.parent.formulaErrorStrings[z.FormulasErrorsStrings.WrongNumberArguments]:(e=this.parent.getValueFromArg(r[0]).trim(),-1<i.indexOf(e)||(-1<r[0].indexOf(this.parent.tic)?r[0]!==e&&r[0].startsWith("n")?e=this.parent.removeTics(e.trim()):-1<(e=this.parent.removeTics(r[0].trim())).indexOf(this.parent.tic+this.parent.tic)&&(e=e.replace(/""/g,this.parent.tic)):!r[0].startsWith("n")&&2===e.split("%").length&&this.parent.isNumber(e.split("%")[0])&&(e=(Number(e.split("%")[0])/100).toString()),e=e.toLowerCase().replace(/\b\w/g,function(e){return e.toUpperCase()}).replace(/(\d)([a-z])/g,function(e,t,r){return t+r.toUpperCase()}),t&&(e=this.parent.tic+e+this.parent.tic)),e)},r.prototype.ComputeSUMPRODUCT=function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];if(ee.isNullOrUndefined(t)||1===t.length&&""===t[0])return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.InvalidArguments];for(var n=0,i=0,o=null,a=t,s=[],l=0;l<a.length;l++)s.push(this.parent.getCellCollection(a[l]).length);for(var h=0;h<s.length;h++)if(s[h]&&s[h+1]&&s[h]!==s[h+1])return this.parent.getErrorStrings()[z.CommonErrors.Value];for(var d=0;d<a.length;++d){var p,c=a[d];if(c.startsWith(this.parent.tic)||!this.parent.isCellReference(c))return p=(u=this.parent.getValueFromArg(c)).indexOf('"'),-1<this.parent.getErrorStrings().indexOf(u)?u:-1<p?0:this.parent.getErrorStrings()[z.CommonErrors.Value];var l=c.indexOf(":"),u=this.parent.rowIndex(c.substr(0,l)),f=this.parent.rowIndex(c.substr(l+1));if(!(-1!==u||-1===f)==(-1===u||-1!==f))return this.parent.getErrorStrings()[z.CommonErrors.Name];f<u&&(u=(p=[f,u])[0],f=p[1]);var g=this.parent.colIndex(c.substr(0,l)),m=this.parent.colIndex(c.substr(l+1));if(m<g&&(g=(e=[m,g])[0],m=e[1]),null===o)for(i=(f-u+1)*(m-g+1),o=[],l=0;l<i;++l)o[l]=1;l=0;for(var v=u;v<=f;++v)for(var y=g;y<=m;++y){var C=this.getSheetReference(c)+this.parent.convertAlpha(y)+v,C=this.parent.getValueFromArg(C);if(-1<this.parent.getErrorStrings().indexOf(C))return C;if(isNaN(this.parent.parseFloat(C)))o[l]=0;else{if(isNaN(o[l]))return this.parent.getErrorStrings()[z.CommonErrors.Name];o[l]=o[l]*this.parent.parseFloat(C)}l++}}for(l=0;l<i;++l)n+=o[l];return n},r.prototype.ComputeROUNDUP=function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=t.length;if(!ee.isNullOrUndefined(t)&&2<n&&(l=this.parent.formulaErrorStrings[z.FormulasErrorsStrings.InvalidArguments]),1===n&&""!==t[0])e=t[0].indexOf('"'),i="TRUE"===(i=-1<(i=-1<t[0].indexOf('"')?t[0].replace('"',""):t[0]).indexOf('"')?i.replace('"',""):i).toUpperCase()?"1":"FALSE"===i?"0":i,i=this.parent.getValueFromArg(i),0<(s=this.parent.parseFloat(i))?s+=.4999999999:s<0&&(s-=.4999999999),l=(s=this.parent.parseFloat(s.toFixed(0))).toString();else if(2===n){if(e=-1<t[0].indexOf('"')?t[0].indexOf('"'):-1<t[1].indexOf('"')?t[1].indexOf('"'):-1,this.parent.isCellReference(t[0]))i=this.parent.getValueFromArg(t[0])||"0";else{if(-1<t[0].indexOf(this.parent.tic)&&(t[0].split(this.parent.tic).join("")===this.parent.trueValue||t[0].split(this.parent.tic).join("")===this.parent.falseValue))return this.parent.getErrorStrings()[z.CommonErrors.Value];i=this.parent.getValueFromArg(t[0]).split(this.parent.tic).join("")}if(-1<this.parent.getErrorStrings().indexOf(i))return i;if(this.parent.isCellReference(t[1]))o=this.parent.getValueFromArg(t[1])||"0";else{if(-1<t[1].indexOf(this.parent.tic)&&(t[1].split(this.parent.tic).join("")===this.parent.trueValue||t[1].split(this.parent.tic).join("")===this.parent.falseValue))return this.parent.getErrorStrings()[z.CommonErrors.Value];o=this.parent.getValueFromArg(t[1]).split(this.parent.tic).join("")}if(-1<this.parent.getErrorStrings().indexOf(o))return o;var i="TRUE"===i.toUpperCase()?"1":"FALSE"===i?"0":i,o="TRUE"===o.toUpperCase()?"1":"FALSE"===o?"0":o,n=isNaN(Number(i))||""===i.trim(),a=isNaN(Number(o))||""===o.trim();if((-1<t[0].indexOf('"')||this.parent.isCellReference(t[0]))&&n||(-1<t[1].indexOf('"')||this.parent.isCellReference(t[1]))&&a)return this.parent.getErrorStrings()[z.CommonErrors.Value];var s,l,n=Math.ceil(this.parent.parseFloat(o));s=this.parent.parseFloat(i),l=(s=0<n?(o=2===(a=i.split(".")).length?a[1].length>=n?n:a[1].length:0,this.parent.parseFloat(this.preciseRound(s,o,"ROUNDUP"))):(0<s?s=s/Math.pow(10,-n)+.49999:s<0&&(s=s/Math.pow(10,-n)-.49999),0<s&&n<-9?+Math.pow(10,-n):this.parent.parseFloat(s.toFixed(0))*Math.pow(10,-n))).toString(),isNaN(s)&&(l=-1<n.toString().indexOf('"')?this.parent.getErrorStrings()[z.CommonErrors.Value]:this.parent.getErrorStrings()[z.CommonErrors.Name])}else l=-1<e?this.parent.getErrorStrings()[z.CommonErrors.Value]:this.parent.formulaErrorStrings[z.FormulasErrorsStrings.InvalidArguments];return l},r.prototype.ComputeROUNDDOWN=function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=t.length;if(!ee.isNullOrUndefined(t)&&2<n&&(l=this.parent.formulaErrorStrings[z.FormulasErrorsStrings.InvalidArguments]),1===n&&""!==t[0])e=t[0].indexOf('"'),i="TRUE"===(i=-1<(i=-1<t[0].indexOf('"')?t[0].replace('"',""):t[0]).indexOf('"')?i.replace('"',""):i).toUpperCase()?"1":"FALSE"===i?"0":i,i=this.parent.getValueFromArg(i),0<(s=this.parent.parseFloat(i))?s-=.4999999999:s<0&&(s+=.4999999999),l=(s=this.parent.parseFloat(s.toFixed(0))).toString();else if(2===n){if(e=-1<t[0].indexOf('"')?t[0].indexOf('"'):-1<t[1].indexOf('"')?t[1].indexOf('"'):-1,this.parent.isCellReference(t[0]))i=this.parent.getValueFromArg(t[0])||"0";else{if(-1<t[0].indexOf(this.parent.tic)&&(t[0].split(this.parent.tic).join("")===this.parent.trueValue||t[0].split(this.parent.tic).join("")===this.parent.falseValue))return this.parent.getErrorStrings()[z.CommonErrors.Value];i=this.parent.getValueFromArg(t[0]).split(this.parent.tic).join("")}if(-1<this.parent.getErrorStrings().indexOf(i))return i;if(this.parent.isCellReference(t[1]))o=this.parent.getValueFromArg(t[1])||"0";else{if(-1<t[1].indexOf(this.parent.tic)&&(t[1].split(this.parent.tic).join("")===this.parent.trueValue||t[1].split(this.parent.tic).join("")===this.parent.falseValue))return this.parent.getErrorStrings()[z.CommonErrors.Value];o=this.parent.getValueFromArg(t[1]).split(this.parent.tic).join("")}if(-1<this.parent.getErrorStrings().indexOf(o))return o;var i="TRUE"===i.toUpperCase()?"1":"FALSE"===i?"0":i,o="TRUE"===o.toUpperCase()?"1":"FALSE"===o?"0":o,n=isNaN(Number(i))||""===i.trim(),a=isNaN(Number(o))||""===o.trim();if((-1<t[0].indexOf('"')||this.parent.isCellReference(t[0]))&&n||(-1<t[1].indexOf('"')||this.parent.isCellReference(t[1]))&&a)return this.parent.getErrorStrings()[z.CommonErrors.Value];var n=Math.ceil(this.parent.parseFloat(o)),s=this.parent.parseFloat(i),l=(s=0<n?(a=0,-1!==(o=i.indexOf("."))&&(a=n<=(a=i.length-o-1)?n:a),this.parent.parseFloat(this.preciseRound(s,a,"ROUNDDOWN"))):(0<s?s=s/Math.pow(10,-n)-.49999:s<0&&(s=s/Math.pow(10,-n)+.49999),0<s&&n<-9?+Math.pow(10,-n):this.parent.parseFloat(s.toFixed(0))*Math.pow(10,-n))).toString();isNaN(s)&&(l=-1<n.toString().indexOf('"')?this.parent.getErrorStrings()[z.CommonErrors.Value]:this.parent.getErrorStrings()[z.CommonErrors.Name])}else l=-1<e?this.parent.getErrorStrings()[z.CommonErrors.Value]:this.parent.formulaErrorStrings[z.FormulasErrorsStrings.InvalidArguments];return l},r.prototype.ComputeCOUNT=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=!1;if(e.length&&"isSubtotal"===e[e.length-1]&&(r=!0,e.pop()),ee.isNullOrUndefined(e)||1===e.length&&""===e[0])return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.WrongNumberArguments];for(var n,i,o,a=e,s=0,l=0;l<a.length;l++)if(this.parent.isCellReference(n=a[l]))if(-1<n.indexOf(":"))for(var h=this.parent.getCellCollection(n.split(this.parent.tic).join("")),d=0;d<h.length;d++)i=r?this.parent.getValueFromArg(h[d],null,null,!0):this.parent.getValueFromArg(h[d]),r&&i.includes("SUBTOTAL(")||isNaN(this.parent.parseFloat(i))||0<n.length&&""!==i.trim()&&s++;else i=r?this.parent.getValueFromArg(n,null,null,!0):this.parent.getValueFromArg(n),r&&i.includes("SUBTOTAL(")||isNaN(this.parent.parseFloat(i))||0<n.length&&""!==i.trim()&&s++;else o=this.parent.getValueFromArg(n).split(this.parent.tic).join(""),0===n.length&&""===o.trim()?s++:isNaN(this.parent.parseFloat(o))&&n!==this.parent.trueValue&&n!==this.parent.falseValue||0<n.length&&""!==n.trim()&&""!==o.trim()&&s++;return s},r.prototype.ComputeDATE=function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];if(t.length&&"nestedFormulaTrue"===t[t.length-1]&&(e=!0,t.pop()),ee.isNullOrUndefined(t)||1===t.length&&""===t[0])return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.WrongNumberArguments];if(3!==t.length)return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.WrongNumberArguments];for(var n=[],i=0;i<t.length;++i)n[i]=this.parent.getValueFromArg(t[i]);n[0]=n[0]===this.parent.trueValue?"1":n[0]===this.parent.falseValue?"0":n[0],n[1]=n[1]===this.parent.trueValue?"1":n[1]===this.parent.falseValue?"0":n[1],n[2]=n[2]===this.parent.trueValue?"1":n[2]===this.parent.falseValue?"0":n[2];for(var o=0;o<n.length;o++){var a=n[o];if(-1<this.parent.getErrorStrings().indexOf(a))return a;if('""'===a||'"0"'===a&&'"0"'!==t[o]||'"TRUE"'===a||'"FALSE"'===a)return this.parent.getErrorStrings()[z.CommonErrors.Value].toString()}var s=Math.floor(this.parent.parseFloat(n[0].split(this.parent.tic).join(""))),l=Math.floor(this.parent.parseFloat(n[1].split(this.parent.tic).join(""))),h=Math.floor(this.parent.parseFloat(n[2].split(this.parent.tic).join(""))),d=0;if(isNaN(s)||isNaN(l)||isNaN(h))return this.parent.getErrorStrings()[z.CommonErrors.Value].toString();if(s<0&&l<=12||1e4<=s&&0<l)return this.parent.getErrorStrings()[z.CommonErrors.Num].toString();for(;12<l;)l-=12,s++;if(0===(d=this.parent.getSerialDateFromDate(s,l,h)))return this.parent.getErrorStrings()[z.CommonErrors.Num].toString();h=this.parent.fromOADate(d);if("Invalid Date"!==h.toString()){if(h.getFullYear()<1900||1e4<=h.getFullYear())return this.parent.getErrorStrings()[z.CommonErrors.Num].toString();if(!e)return new ee.Internationalization(this.parent.parentObject.locale||"en-US").formatDate(h,{type:"date",skeleton:"yMd"})}return d.toString()},r.prototype.ComputeFLOOR=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(ee.isNullOrUndefined(e)||1===e.length&&""===e[0])return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.InvalidArguments];var r,n=e;if(2!==n.length)return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.WrongNumberArguments];if(""===n[0]&&""===n[1]||""===n[0]&&!n[1].includes('"'))return 0;""!==n[1]||n[0].includes('"')||(n[1]="0");for(var i=0;i<n.length;i++){var o=n[i].split(this.parent.tic).join("").trim();if(""===o||-1<n[i].indexOf(this.parent.tic)&&isNaN(this.parent.parseFloat(o)))return this.parent.getErrorStrings()[z.CommonErrors.Value];if(Fn(n[i])){if((r=(r=this.parent.getValueFromArg(n[i])||"0")===this.parent.trueValue?"1":r===this.parent.falseValue?"0":r).toUpperCase().match(/[A-Z]/)||r.includes('"')||!this.parent.isNumber(r))return this.parent.getErrorStrings()[z.CommonErrors.Value]}else if((r=(r=this.parent.getValueFromArg(n[i].split(this.parent.tic).join("")))===this.parent.trueValue?"1":r===this.parent.falseValue?"0":r).toUpperCase().match(/[A-Z]/)||r.includes('"')||!this.parent.isNumber(r))return this.parent.getErrorStrings()[z.CommonErrors.Value];n[i]=r}var a=this.parent.parseFloat(n[0]),s=this.parent.parseFloat(n[1]);return 0<a&&s<0?this.parent.getErrorStrings()[z.CommonErrors.Num]:(0<a||a<0)&&0===s?this.parent.getErrorStrings()[z.CommonErrors.DivZero]:isNaN(a)?this.parent.getErrorStrings()[z.CommonErrors.Name]:0===a&&0===s?0:Math.floor(a/s)*s},r.prototype.ComputeCEILING=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(ee.isNullOrUndefined(e)||1===e.length&&""===e[0])return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.InvalidArguments];var r,n=e;if(2!==n.length)return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.WrongNumberArguments];if(""===n[0]&&""===n[1]||""===n[0]&&!n[1].includes('"'))return 0;""!==n[1]||n[0].includes('"')||(n[1]="0");for(var i=0;i<n.length;i++){var o=n[i].split(this.parent.tic).join("").trim();if(""===o||-1<n[i].indexOf(this.parent.tic)&&isNaN(this.parent.parseFloat(o)))return this.parent.getErrorStrings()[z.CommonErrors.Value];if(Fn(n[i])){if((r=(r=this.parent.getValueFromArg(n[i])||"0")===this.parent.trueValue?"1":r===this.parent.falseValue?"0":r).toUpperCase().match(/[A-Z]/)||r.includes('"')||!this.parent.isNumber(r))return this.parent.getErrorStrings()[z.CommonErrors.Value]}else if((r=(r=this.parent.getValueFromArg(n[i].split(this.parent.tic).join("")))===this.parent.trueValue?"1":r===this.parent.falseValue?"0":r).toUpperCase().match(/[A-Z]/)||r.includes('"')||!this.parent.isNumber(r))return this.parent.getErrorStrings()[z.CommonErrors.Value];n[i]=r}var a=this.parent.parseFloat(n[0]),s=this.parent.parseFloat(n[1]);return 0<a&&s<0?this.parent.getErrorStrings()[z.CommonErrors.Num]:isNaN(a)?this.parent.getErrorStrings()[z.CommonErrors.Name]:(0<a||0===a)&&0===s?0:Math.ceil(a/s)*s},r.prototype.ComputeDAY=function(){for(var e,t,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var i=this.parent.getErrorStrings();if(ee.isNullOrUndefined(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.InvalidArguments];if(1<r.length)return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.WrongNumberArguments];if(r[0].startsWith(this.parent.tic)){if(""===(t=r[0].split(this.parent.tic).join(""))||t===this.parent.trueValue||t===this.parent.falseValue)return i[z.CommonErrors.Value]}else if(t=this.parent.getValueFromArg(r[0].split(this.parent.tic).join("")),this.parent.isCellReference(r[0])&&-1<t.indexOf(this.parent.tic))return i[z.CommonErrors.Value];return-1<i.indexOf(t)?t:Number(t)<0?i[z.CommonErrors.Num]:0===Math.floor(Number(t))||t===this.parent.falseValue?0:t===this.parent.trueValue?1:(e=this.parent.isNaN(Number(t))?this.parent.parseDate(t):this.parent.intToDate(t),"NaN"===(e="[object Date]"===Object.prototype.toString.call(e)?new Date(e).getFullYear()<1900||9999<new Date(e).getFullYear()?this.parent.isNumber(t)?"Num":"NaN":e.getDate():e).toString()?i[z.CommonErrors.Value]:"Num"===e.toString()?i[z.CommonErrors.Num]:e)},r.prototype.ComputeIF=function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];if(t.length&&"nestedFormulaTrue"===t[t.length-1]&&(e=!0,t.pop()),ee.isNullOrUndefined(t)||1===t.length&&""===t[0])return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.InvalidArguments];if(0<this.parent.getErrorStrings().indexOf(t[0]))return t[0];var n,i,o=t;if(4===o.length&&"nestedFormulaTrue"===o[3]&&(n=!0,o.pop()),3<o.length||1===o.length)return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.WrongNumberArguments];if(o.length<=3){var a=void 0,s=void 0,l="",h=this.parent.getValueFromArg(o[0]);if(-1<this.parent.getErrorStrings().indexOf(h))return h;var d=h.toUpperCase(),h=this.parent.parseFloat(h);if(d===this.parent.trueValue||h<0||0<h){if(e&&o[1].includes(":")){for(var a=this.parent.getCellCollection(o[1]),p=0;p<a.length;p++)s=this.parent.getValueFromArg(a[p]),isNaN(this.parent.parseFloat(s))||(l+=s+",");return l.slice(0,l.length-1)}i=""===o[1]?"0":this.parent.getValueFromArg(o[1])}else{if(d!==this.parent.falseValue&&0!==h)return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.Requires3Args];if(ee.isNullOrUndefined(o[2]))return this.parent.falseValue;if(e&&o[2].includes(":")){a=this.parent.getCellCollection(o[2]);for(p=0;p<a.length;p++)s=this.parent.getValueFromArg(a[p]),isNaN(this.parent.parseFloat(s))||(l+=s+",");return l.slice(0,l.length-1)}i=""===o[2]?"0":this.parent.getValueFromArg(o[2])}}return!n&&-1<i.indexOf(this.parent.tic)?i.split(this.parent.tic).join(""):""===i?"0":i},r.prototype.ComputeIFERROR=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(ee.isNullOrUndefined(e)||1===e.length&&""===e[0])return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.InvalidArguments];var r,n=e;if(2!==n.length)return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.WrongNumberArguments];if(this.parent.isCellReference(n[0])){if(r=this.parent.getValueFromArg(n[0])||"0",-1===this.parent.getErrorStrings().indexOf(r)&&"NaN"!==r)return r}else if(r=this.parent.getValueFromArg(n[0],null,!0)||"0",-1===this.parent.getErrorStrings().indexOf(r)&&"NaN"!==r)return r=r.split(this.parent.tic).join("").trim();return r=this.parent.isCellReference(n[1])?this.parent.getValueFromArg(n[1])||"0":(r=this.parent.getValueFromArg(n[1])||"0").split(this.parent.tic).join("").trim()},r.prototype.ComputePRODUCT=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=!1;if(e.length&&"isSubtotal"===e[e.length-1]&&(r=!0,e.pop()),ee.isNullOrUndefined(e)||1===e.length&&""===e[0])return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.InvalidArguments];var n,i,o=1,a=!0;if(!ee.isNullOrUndefined(e))for(var s=e,l=0;l<s.length;l++){var h,d=s[l];if(-1<d.indexOf(":")&&this.parent.isCellReference(d)){for(var p=this.parent.getCellCollection(d),c=0;c<p.length;c++)if(n=r?this.parent.getValueFromArg(p[c],null,null,!0):this.parent.getValueFromArg(p[c]),(!r||!n.includes("SUBTOTAL("))&&oe(n)){if(-1<this.parent.getErrorStrings().indexOf(n))return n;i=this.parent.parseFloat(n),isNaN(i)||0<n.length&&(o*=i,a=!1)}}else if(-1===d.indexOf(":")&&this.parent.isCellReference(d)){if(h=r?this.parent.getValueFromArg(s[l],null,null,!0):this.parent.getValueFromArg(s[l]),r&&h.includes("SUBTOTAL("))continue;if(!oe(h))continue;if(-1<this.parent.getErrorStrings().indexOf(h))return h}else{if(-1<(h=s[l]).indexOf(this.parent.tic)&&""===h.split(this.parent.tic).join("").trim()||-1<s[l].indexOf(this.parent.tic)&&isNaN(this.parent.parseFloat(h.split(this.parent.tic).join(""))))return this.parent.getErrorStrings()[z.CommonErrors.Value];if(h=(h=this.parent.getValueFromArg(s[l].split(this.parent.tic).join("")))===this.parent.trueValue?"1":h===this.parent.falseValue?"0":h.split(this.parent.tic).join(""),-1<this.parent.getErrorStrings().indexOf(h))return h}i=this.parent.parseFloat(h),isNaN(i)||0<h.length&&(o*=i,a=!1)}return a?"0":o.toString()},r.prototype.ComputeDAYS=function(){for(var r=this,e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n,i,o=this.parent.getErrorStrings();return ee.isNullOrUndefined(e)&&1===e.length&&""===e[0]?this.parent.formulaErrorStrings[z.FormulasErrorsStrings.InvalidArguments]:2!==e.length?this.parent.formulaErrorStrings[z.FormulasErrorsStrings.WrongNumberArguments]:(i=(n=function(e){var t=r.parent.getValueFromArg(e).trim();if(-1<t.indexOf(r.parent.tic)&&(""===(t=t.split(r.parent.tic).join("").trim())||r.parent.isCellReference(e)||t.toUpperCase()===r.parent.trueValue||t.toUpperCase()===r.parent.falseValue))return o[z.CommonErrors.Value];if((t=t.split(r.parent.tic).join("")).toUpperCase()===r.parent.trueValue)t="1";else if(""===t||t.toUpperCase()===r.parent.falseValue)t="0";else if(Number(t)<0)return o[z.CommonErrors.Num];e={value:t.toString()};return r.parent.parentObject.notify(At,e),t=e.isDate||e.isTime?(r.parent.parseDate(t).getTime()/864e5).toString():t})(e[0]),-1<o.indexOf(i)?i:(n=n(e[1]),-1<o.indexOf(n)?n:(i=Math.floor(Number(i))-Math.floor(Number(n)),isNaN(i)?o[z.CommonErrors.Value]:i)))},r.prototype.ComputeUNIQUE=function(){for(var e,r=this,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var i=this.parent.getErrorStrings();if("isComputeExp"===t[t.length-1]&&(e=!0,t.pop()),ee.isNullOrUndefined(t)||""===t[0]&&1===t.length)return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.InvalidArguments];if(3<t.length)return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.WrongNumberArguments];function P(e){var t;return ee.isNullOrUndefined(e)?r.parent.falseValue:(t=r.parent.getValueFromArg(e),-1<i.indexOf(t)?t:0===Number(t)?r.parent.falseValue:Number(t)<0||0<Number(t)?r.parent.trueValue:(t=r.parent.isCellReference(e)?t:r.parent.removeTics(t)).toUpperCase()===r.parent.trueValue||t.toUpperCase()===r.parent.falseValue?t.toUpperCase():-1<t.indexOf(r.parent.tic)||-1<e.indexOf(r.parent.tic)?i[z.CommonErrors.Value]:i[z.CommonErrors.Name])}var o=P(t[1]);if(-1<i.indexOf(o))return o;var a=P(t[2]);if(-1<i.indexOf(a))return a;var s=[];if(-1<t[0].indexOf(":")){ee.isNullOrUndefined(t[0].match(/[0-9]/))?(l=t[0].split(":"),t[0]=l[0]+"1:"+l[1]+(this.parent.spreadSheetUsedRange[0]+1)):ee.isNullOrUndefined(t[0].toUpperCase().match(/[A-Z]/))&&(l=t[0].split(":"),t[0]="A"+l[0]+":"+Ol(this.parent.spreadSheetUsedRange[1]+1)+l[1]);var l=t[0].split(":");if(this.parent.isCellReference(l[0])&&this.parent.isCellReference(l[1])){for(var h=this.parent.dependencyCollection,d=0;d<h.length&&!e;d++)h[d].split(":")[0]===t[0].split(":")[0]&&this.clearDependency(h[d]);-1===this.parent.dependencyCollection.indexOf(t[0])?e||this.parent.dependencyCollection.push(t[0]):this.clearDependency(t[0]);var p,l=t[0].indexOf(":"),c=void 0,u=this.parent.rowIndex(this.parent.substring(t[0],0,l)),f=this.parent.colIndex(this.parent.substring(t[0],0,l)),g=this.parent.rowIndex(this.parent.substring(t[0],l+1,l+t[0].length-l-1)),l=this.parent.colIndex(this.parent.substring(t[0],l+1,l+t[0].length-l-1)),c=(g<u&&(c=g,g=u,u=c),l<f&&(c=l,l=f,f=c),""),m=(0===t[0].indexOf("!")&&(c=t[0].substring(0,t[0].replace("!","").indexOf("!")+2)),t[0]=c+Ol(f)+u+":"+Ol(l)+g,l-f),v=this.parent.getCellCollection(t[0]),y=void 0,y=p=this.parent.actCell;if(o===this.parent.falseValue)if(0==m)for(d=0;d<v.length;d++){var C=this.parent.getValueFromArg(v[d]);s.push(C=""===C?"0":C)}else for(var b="",x=m,d=0;d<v.length;d++)d===v.length-1&&(C=this.parent.getValueFromArg(v[d]),s.push((b=b+(C=""===C?"0":C)+"++").substring(0,b.length-2))),b=d<=x?b+(C=""===(C=this.parent.getValueFromArg(v[d]))?"0":C)+"++":(s.push(b.substring(0,b.length-2)),x=m+d,(C=""===(C=this.parent.getValueFromArg(v[d]))?"0":C)+"++");else for(var b="",x=1+m,M=g-u,d=0;d<x;d++){for(var S=0;S<=M;S++)b=b+(C=""===(C=this.parent.getValueFromArg(v[S*x+d]))?"0":C)+"++";s.push(b.substring(0,b.length-2)),b=""}for(var w,B=[],I=[],E=[],U=[],d=0;d<s.length;d++)(-1===B.indexOf(s[d].toLowerCase())?(B.push(s[d].toLowerCase()),E):(-1===I.indexOf(s[d].toLowerCase())&&I.push(s[d].toLowerCase()),U)).push(s[d]);if(a===this.parent.trueValue){for(var H=[],d=0;d<E.length;d++)-1===I.indexOf(E[d].toLowerCase())&&H.push(E[d]);if(0===(E=H).length)return i[z.CommonErrors.Calc]}if(e)return 0!=m?(w=[],E.forEach(function(e){w=w.concat(e.split("++"))})):w=o===this.parent.falseValue?E:E[0].split("++"),w;-1<y.indexOf("!")&&(y=y.substring(y.lastIndexOf("!")+1));var N=this.parent.rowIndex(y),R=this.parent.colIndex(y);if(0===this.parent.dependencyLevel){var F=!1;if(o===this.parent.falseValue)for(d=N,x=E.length+N;d<x;d++)for(var k=R,O=(T=E[0].split("++")).length+R;k<O;k++)d===x-1&&k===O-1&&-1===this.parent.uniqueRange.indexOf(p+":"+Ol(k)+d)&&this.parent.uniqueRange.push(p+":"+Ol(k)+d),this.checkSpill(k,d)&&(F=!0);else for(d=R,x=E.length+R;d<x;d++)for(var A=N,O=(T=E[0].split("++")).length+N;A<O;A++)d===x-1&&A===O-1&&-1===this.parent.uniqueRange.indexOf(this.parent.actCell+":"+Ol(d)+A)&&this.parent.uniqueRange.push(this.parent.actCell+":"+Ol(d)+A),this.checkSpill(d,A)&&(F=!0);if(F)return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.Spill]}else if(0<this.parent.dependencyLevel&&-1<this.parent.getValueFromArg(Ol(R)+N,!0).indexOf("#SPILL!"))return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.Spill];if(o===this.parent.falseValue){var c=this.parent.getSheetFamilyItem(this.parent.grid),V="",j=void 0;null!==c.sheetNameToParentObject&&0<c.sheetNameToParentObject.size&&(j=(V=c.parentObjectToToken.get(this.parent.grid))+y);for(d=0;d<E.length;d++){var T=E[d].split("++");0<d&&(N++,R=this.parent.colIndex(y));for(var D=0;D<T.length;D++)this.setValueRefresh(T[D],N,R),(0<d||0<D)&&this.parent.refresh(V+Ol(R)+N.toString(),j),T[D+1]&&R++}}else for(d=0;d<E.length;d++)for(var T=E[d].split("++"),L=0;L<T.length;L++)this.setValueRefresh(T[L],N,R),T[L+1]?N++:(R++,N=this.parent.rowIndex(y));f=E[0].split("++")[0]}}else if(this.parent.isCellReference(t[0]))-1===this.parent.dependencyCollection.indexOf(t[0])?e||this.parent.dependencyCollection.push(t[0]):this.clearDependency(t[0]),f=this.parent.getValueFromArg(t[0]);else{if(f=this.parent.getValueFromArg(t[0].trim()),-1<i.indexOf(f))return f;f=this.parent.removeTics(f)}return f},r.prototype.setValueRefresh=function(e,t,r){this.parent.parentObject.setValueRowCol(this.parent.getSheetId(this.parent.grid),e,t,r)},r.prototype.checkSpill=function(e,t){var r,n=!1,i=this.parent.getValueFromArg(Ol(e)+t,!0),e="!"+this.parent.getSheetID(this.parent.grid)+"!"+Ol(e)+t;return this.parent.getFormulaInfoTable().get(e)&&(r=this.parent.getFormulaInfoTable().get(e).formulaText),n=i&&(i.toUpperCase().indexOf("UNIQUE")<0||r&&!r.toUpperCase().includes("UNIQUE"))&&i!==this.parent.formulaErrorStrings[z.FormulasErrorsStrings.WrongNumberArguments]?!0:n},r.prototype.clearDependency=function(e){for(var t=this.parent.actCell,r="",n=(-1<t.lastIndexOf("!")&&(t=(o=t).substring(o.lastIndexOf("!")+1),r=o.substring(0,o.lastIndexOf("!"))+"!"),this.parent.rowIndex(t)),i=this.parent.colIndex(t),o=e.indexOf(":"),a=this.parent.rowIndex(this.parent.substring(e,0,o)),s=this.parent.colIndex(this.parent.substring(e,0,o)),l=this.parent.rowIndex(this.parent.substring(e,o+1,o+e.length-o-1))-a+n,h=this.parent.colIndex(this.parent.substring(e,o+1,o+e.length-o-1))-s+i,d=this.parent.getFormulaInfoTable().get("!"+this.parent.getSheetID(this.parent.grid)+"!"+t)?this.parent.getFormulaInfoTable().get("!"+this.parent.getSheetID(this.parent.grid)+"!"+t).getFormulaText():"",p=n;p<=l;p++)for(var c=i;c<=h;c++)if(0<this.parent.dependencyLevel||-1<d.indexOf("UNIQUE")){if(-1<this.parent.getValueFromArg("!"+this.parent.getSheetID(this.parent.grid)+"!"+Ol(i)+n,!0).indexOf("#SPILL!"))return;this.parent.parentObject.setValueRowCol(this.parent.getSheetID(this.parent.grid)+1,"",p,c),this.parent.refresh("!"+this.parent.getSheetID(this.parent.grid)+"!"+Ol(c)+p,t),this.parent.actCell=r+t}},r.prototype.ComputeT=function(){for(var e,t,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var i=this.parent.getErrorStrings();if(r.length&&"nestedFormulaTrue"===r[r.length-1]&&(t=!0,r.pop()),ee.isNullOrUndefined(r)||1===r.length&&""===r[0].trim())return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.InvalidArguments];if(1<r.length)return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.WrongNumberArguments];if(e=this.parent.getValueFromArg(r[0]).trim(),!(-1<i.indexOf(e))){if(-1<r[0].indexOf(this.parent.tic))-1<(e=this.parent.removeTics(r[0].trim())).indexOf(this.parent.tic+this.parent.tic)&&(e=e.replace(/""/g,this.parent.tic));else if(2===e.split("%").length&&this.parent.isNumber(e.split("%")[0])&&(e=(Number(e.split("%")[0])/100).toString()),this.parent.isNumber(e)||e.toUpperCase()===this.parent.trueValue||e.toUpperCase()===this.parent.falseValue)return"";t&&(e=this.parent.tic+e+this.parent.tic)}return e},r.prototype.ComputeHOUR=function(){for(var e,t,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];if(1!==r.length||ee.isNullOrUndefined(r)||""===r[0])return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.InvalidArguments];if(""===r[0].split(this.parent.tic).join("").trim())return this.parent.getErrorStrings()[z.CommonErrors.Value];if(this.parent.isCellReference(r[0])){if(-1<(e=this.parent.getValueFromArg(r[0].split(this.parent.tic).join(""))||"0").indexOf(this.parent.tic))return this.parent.getErrorStrings()[z.CommonErrors.Value]}else{if(-1<r[0].indexOf(this.parent.tic)&&(r[0].split(this.parent.tic).join("")===this.parent.trueValue||r[0].split(this.parent.tic).join("")===this.parent.falseValue))return this.parent.getErrorStrings()[z.CommonErrors.Value];e=this.parent.getValueFromArg(r[0]).split(this.parent.tic).join("")}if(-1<this.parent.getErrorStrings().indexOf(e))return e;if(e=e===this.parent.trueValue?"1":e===this.parent.falseValue?"0":e,this.parent.isNumber(e)){if(this.parent.parseFloat(e)<0||2958465<this.parent.parseFloat(e))return this.parent.getErrorStrings()[z.CommonErrors.Num];t=this.parent.intToTime(e)}else{var i={value:e.toString()};if(this.parent.parentObject.notify(At,i),!i.isDate&&!i.isTime)return this.parent.getErrorStrings()[z.CommonErrors.Value];t=i.dateObj}return"Invalid Date"===(t="Invalid Date"===t.toString()?new Date(Date.parse(e)):t).toString()&&(i=new Date(Date.now()).toLocaleDateString()+" "+e,t=new Date(Date.parse(i))),"Invalid Date"===(t="Invalid Date"===t.toString()?this.parent.fromOADate(this.parent.parseFloat(e)):t).toString()||t.getFullYear()<1900||9999<t.getFullYear()?this.parent.getErrorStrings()[z.CommonErrors.Value]:t.getHours()},r.prototype.ComputeMINUTE=function(){for(var e,t,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];if(1!==r.length||ee.isNullOrUndefined(r)||""===r[0])return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.InvalidArguments];if(""===r[0].split(this.parent.tic).join("").trim())return this.parent.getErrorStrings()[z.CommonErrors.Value];if(this.parent.isCellReference(r[0])){if(-1<(e=this.parent.getValueFromArg(r[0].split(this.parent.tic).join(""))||"0").indexOf(this.parent.tic))return this.parent.getErrorStrings()[z.CommonErrors.Value]}else{if(-1<r[0].indexOf(this.parent.tic)&&(r[0].split(this.parent.tic).join("")===this.parent.trueValue||r[0].split(this.parent.tic).join("")===this.parent.falseValue))return this.parent.getErrorStrings()[z.CommonErrors.Value];e=this.parent.getValueFromArg(r[0]).split(this.parent.tic).join("")}if(-1<this.parent.getErrorStrings().indexOf(e))return e;if(e=e===this.parent.trueValue?"1":e===this.parent.falseValue?"0":e,this.parent.isNumber(e)){if(this.parent.parseFloat(e)<0||2958465<this.parent.parseFloat(e))return this.parent.getErrorStrings()[z.CommonErrors.Num];t=this.parent.intToTime(e)}else{var i={value:e.toString()};if(this.parent.parentObject.notify(At,i),!i.isDate&&!i.isTime)return this.parent.getErrorStrings()[z.CommonErrors.Value];t=i.dateObj}return"Invalid Date"===(t="Invalid Date"===t.toString()?new Date(Date.parse(e)):t).toString()&&(i=new Date(Date.now()).toLocaleDateString()+" "+e,t=new Date(Date.parse(i))),"Invalid Date"===(t="Invalid Date"===t.toString()?this.parent.fromOADate(this.parent.parseFloat(e)):t).toString()||t.getFullYear()<1900||9999<t.getFullYear()?this.parent.getErrorStrings()[z.CommonErrors.Value]:t.getMinutes()},r.prototype.ComputeSECOND=function(){for(var e,t,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];if(1!==r.length||ee.isNullOrUndefined(r)||""===r[0])return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.InvalidArguments];if(""===r[0].split(this.parent.tic).join("").trim())return this.parent.getErrorStrings()[z.CommonErrors.Value];if(this.parent.isCellReference(r[0])){if(-1<(e=this.parent.getValueFromArg(r[0].split(this.parent.tic).join(""))||"0").indexOf(this.parent.tic))return this.parent.getErrorStrings()[z.CommonErrors.Value]}else{if(-1<r[0].indexOf(this.parent.tic)&&(r[0].split(this.parent.tic).join("")===this.parent.trueValue||r[0].split(this.parent.tic).join("")===this.parent.falseValue))return this.parent.getErrorStrings()[z.CommonErrors.Value];e=this.parent.getValueFromArg(r[0]).split(this.parent.tic).join("")}if(-1<this.parent.getErrorStrings().indexOf(e))return e;if(e=e===this.parent.trueValue?"1":e===this.parent.falseValue?"0":e,this.parent.isNumber(e)){if(this.parent.parseFloat(e)<0||2958465<this.parent.parseFloat(e))return this.parent.getErrorStrings()[z.CommonErrors.Num];t=this.parent.intToTime(e)}else{var i={value:e.toString()};if(this.parent.parentObject.notify(At,i),!i.isDate&&!i.isTime)return this.parent.getErrorStrings()[z.CommonErrors.Value];t=i.dateObj}return"Invalid Date"===(t="Invalid Date"===t.toString()?new Date(Date.parse(e)):t).toString()&&(i=new Date(Date.now()).toLocaleDateString()+" "+e,t=new Date(Date.parse(i))),"Invalid Date"===(t="Invalid Date"===t.toString()?this.parent.fromOADate(this.parent.parseFloat(e)):t).toString()||t.getFullYear()<1900||9999<t.getFullYear()?this.parent.getErrorStrings()[z.CommonErrors.Value]:t.getSeconds()},r.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[z.FormulasErrorsStrings.InvalidArguments];if(1!==e.length)return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.WrongNumberArguments];var n=this.parent.getValueFromArg(e[0]).trim();if(-1<r.indexOf(n))return n;if(this.parent.isCellReference(e[0])){if(-1<n.indexOf(this.parent.tic))return r[z.CommonErrors.Value];if(""===n)return 1}else{if('"TRUE"'===n.toUpperCase()||'"FALSE"'===n.toUpperCase())return r[z.CommonErrors.Value];n=n.split(this.parent.tic).join("")}if(""===n)return r[z.CommonErrors.Value];if(n===this.parent.trueValue||n===this.parent.falseValue||-1<Number(n)&&Number(n)<32)return 1;if(Number(n)<0)return r[z.CommonErrors.Num];-1<n.indexOf("%")&&(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[z.CommonErrors.Num]:r[z.CommonErrors.Value]:i.getFullYear()<1900||1e4<=i.getFullYear()?r[z.CommonErrors.Num]:(i.getMonth()+1).toString()},r.prototype.ComputeNOW=function(){for(var e,t,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return 1!==r.length||""!==r[0]?this.parent.formulaErrorStrings[z.FormulasErrorsStrings.InvalidArguments]:(e=new Date(Date.now()),t=(new ee.Internationalization).getDateFormat({format:"M/d/yyyy h:mm:ss a"}),this.parent.parentObject.dateToInt(t(e),!0).toString())},r.prototype.ComputeEXACT=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r,n,i,o=!1,a=e.length&&"nestedFormulaTrue"===e[e.length-1],s=this.parent.getErrorStrings();if(a&&e.pop(),!e||!e[0]&&1===e.length)return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.InvalidArguments];if(2!==e.length)return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.WrongNumberArguments];if(e[0]){if(r=this.parent.getValueFromArg(e[0]),-1<s.indexOf(r))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]),-1<s.indexOf(n))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||(o=!1):(n=n.split(this.parent.tic).join(""),i&&0===r.trim().length&&0===n.trim().length&&(o=!1))}return o=r===n&&(o=!0,a)?this.parent.tic+o+this.parent.tic:o},r.prototype.ComputeLEN=function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=this.parent.getErrorStrings();return ee.isNullOrUndefined(t)||""===t[0].trim()&&1===t.length?this.parent.formulaErrorStrings[z.FormulasErrorsStrings.InvalidArguments]:1<t.length?this.parent.formulaErrorStrings[z.FormulasErrorsStrings.WrongNumberArguments]:(e=this.parent.getValueFromArg(t[0]).trim(),-1<n.indexOf(e)?e:(-1<t[0].indexOf(this.parent.tic)?t[0]!==e&&t[0].startsWith("n")?e=this.parent.removeTics(e.trim()):-1<(e=this.parent.removeTics(t[0].trim())).indexOf(this.parent.tic+this.parent.tic)&&(e=e.replace(/""/g,this.parent.tic)):!t[0].startsWith("n")&&2===e.split("%").length&&this.parent.isNumber(e.split("%")[0])&&(e=(Number(e.split("%")[0])/100).toString()),e.length))},r.prototype.ComputeMOD=function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];if(ee.isNullOrUndefined(t)||2!==t.length)return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.InvalidArguments];if(""===t[1]&&!t[0].includes('"'))return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.Div];if(""===t[0]&&!t[1].includes('"'))return 0;for(var n=0;n<t.length;n++){var i=t[n].split(this.parent.tic).join("").trim();if(""===i||-1<t[n].indexOf(this.parent.tic)&&isNaN(this.parent.parseFloat(i)))return this.parent.getErrorStrings()[z.CommonErrors.Value];if(Fn(t[n])){if((e=(e=this.parent.getValueFromArg(t[n])||"0")===this.parent.trueValue?"1":e===this.parent.falseValue?"0":e).toUpperCase().match(/[A-Z]/)||e.includes('"')||!this.parent.isNumber(e))return this.parent.getErrorStrings()[z.CommonErrors.Value]}else if(e=(e=this.parent.getValueFromArg(t[n].split(this.parent.tic).join("")))===this.parent.trueValue?"1":e===this.parent.falseValue?"0":e,-1<this.parent.getErrorStrings().indexOf(e))return e;t[n]=e}var o=t[0],a=t[1];return"0"===a||""===a?this.parent.formulaErrorStrings[z.FormulasErrorsStrings.Div]:"0"===o||""===o?0:(o=(parseFloat(o)%(a=parseFloat(a))+a)%a,isNaN(o)?this.parent.getErrorStrings()[z.CommonErrors.Name]:o)},r.prototype.ComputeODD=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(ee.isNullOrUndefined(e)||1!==e.length||""===e[0])return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.InvalidArguments];var r,n=e[0].split(this.parent.tic).join("").trim();if(""===n||-1<e[0].indexOf(this.parent.tic)&&isNaN(this.parent.parseFloat(n)))return this.parent.getErrorStrings()[z.CommonErrors.Value];if(Fn(e[0])){if((r=this.parent.getValueFromArg(e[0]))===this.parent.trueValue)r="1";else if(""===r||r===this.parent.falseValue)r="0";else if(r.toUpperCase().match(/[A-Z]/)||r.includes('"')||!this.parent.isNumber(r))return this.parent.getErrorStrings()[z.CommonErrors.Value]}else{if("#NAME?"===(r=this.parent.getValueFromArg(e[0].split(this.parent.tic).join(""))))return this.parent.getErrorStrings()[z.CommonErrors.Name];if(r===this.parent.trueValue)r="1";else if(""===r||r===this.parent.falseValue)r="0";else if(r.toUpperCase().match(/[A-Z]/)||!this.parent.isNumber(r))return this.parent.getErrorStrings()[z.CommonErrors.Value]}var i=0===(n=Math.ceil(parseInt(r,10))),n=n%2==0?0<n?n+1:n-1:n;return Math.ceil(parseInt(r,10))%2!=0&&(0<parseInt(r,10)&&parseFloat(r)>parseInt(r,10)?n+=2:parseInt(r,10)<0&&parseFloat(r)<parseInt(r,10)&&(n-=2)),isNaN(n)?this.parent.getErrorStrings()[z.CommonErrors.Name]:i?1:n},r.prototype.ComputeEVEN=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(ee.isNullOrUndefined(e)||1!==e.length||""===e[0])return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.InvalidArguments];var r,n=e[0].split(this.parent.tic).join("").trim();if(""===n||-1<e[0].indexOf(this.parent.tic)&&isNaN(this.parent.parseFloat(n)))return this.parent.getErrorStrings()[z.CommonErrors.Value];if(Fn(e[0])){if((r=this.parent.getValueFromArg(e[0]))===this.parent.trueValue)r="1";else if(""===r||r===this.parent.falseValue)r="0";else if(r.toUpperCase().match(/[A-Z]/)||r.includes('"')||!this.parent.isNumber(r))return this.parent.getErrorStrings()[z.CommonErrors.Value]}else{if("#NAME?"===(r=this.parent.getValueFromArg(e[0].split(this.parent.tic).join(""))))return this.parent.getErrorStrings()[z.CommonErrors.Name];if(r===this.parent.trueValue)r="1";else if(""===r||r===this.parent.falseValue)r="0";else if(r.toUpperCase().match(/[A-Z]/)||!this.parent.isNumber(r))return this.parent.getErrorStrings()[z.CommonErrors.Value]}n=(n=Math.ceil(parseInt(r,10)))%2==0?n:0<n?n+1:n-1;return Math.ceil(parseInt(r,10))%2==0&&(0<parseInt(r,10)&&parseFloat(r)>parseInt(r,10)?n+=2:parseInt(r,10)<0&&parseFloat(r)<parseInt(r,10)&&(n-=2)),isNaN(n)?this.parent.getErrorStrings()[z.CommonErrors.Name]:n},r.prototype.ComputePI=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e&&""!==e[0]?this.parent.formulaErrorStrings[z.FormulasErrorsStrings.InvalidArguments]:Math.PI},r.prototype.ComputeMEDIAN=function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=[];if(ee.isNullOrUndefined(t)||""===t[0]&&1===t.length)return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.InvalidArguments];for(var i=0;i<t.length;i++)if(this.parent.isCellReference(t[i]))if(-1<t[i].indexOf(":"))for(var o=this.parent.getCellCollection(t[i]),a=0;a<o.length;a++){var s=this.parent.getValueFromArg(o[a]);if(-1<this.parent.getErrorStrings().indexOf(s))return s;""!==s.trim()&&n.push(this.parent.parseFloat(s))}else{var l=this.parent.getValueFromArg(t[i]);if(-1<this.parent.getErrorStrings().indexOf(l))return l;""!==l.trim()&&n.push(this.parent.parseFloat(l))}else if(""===t[i]||t[i]===this.parent.falseValue&&!this.parent.isCellReference(t[i]))n.push(0);else if(t[i]!==this.parent.trueValue||this.parent.isCellReference(t[i])){if(-1<t[i].indexOf(this.parent.tic)&&isNaN(parseFloat(t[i].split(this.parent.tic).join(""))))return this.parent.getErrorStrings()[z.CommonErrors.Value];l=this.parent.getValueFromArg(t[i]).split(this.parent.tic).join("");if(-1<this.parent.getErrorStrings().indexOf(l))return l;n.push(this.parent.parseFloat(l))}else n.push(1);for(var h=(n=n.sort(function(e,t){return e-t})).length,d=0;d<h&&(!isNaN(n[d])||(n.splice(d,1),h=n.length,d--,0!==n.length));d++);if(n.length%2==0||isNaN(n[parseInt((n.length/2).toString(),10)])){if(isNaN(n[n.length/2])||isNaN(n[n.length/2-1]))return this.parent.getErrorStrings()[z.CommonErrors.Num];e=(n[n.length/2]+n[n.length/2-1])/2}else e=n[parseInt((n.length/2).toString(),10)];return e},r.prototype.ComputeEDATE=function(){for(var e,t,r,n,i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];if(2!==i.length||ee.isNullOrUndefined(i))return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.InvalidArguments];if(""===i[0]||""===i[1])return this.parent.getErrorStrings()[z.CommonErrors.NA];if(""===i[0].split(this.parent.tic).join("")||""===i[1].split(this.parent.tic).join("")||-1<i[1].indexOf(this.parent.tic)&&isNaN(this.parent.parseFloat(i[1].split(this.parent.tic).join(""))))return this.parent.getErrorStrings()[z.CommonErrors.Value];if(this.parent.isCellReference(i[0])){if(-1<i[0].indexOf(":"))return this.parent.getErrorStrings()[z.CommonErrors.Value];if(-1<(e=this.parent.getValueFromArg(i[0].split(this.parent.tic).join(""))||"0").indexOf(this.parent.tic))return this.parent.getErrorStrings()[z.CommonErrors.Value]}else e=this.parent.getValueFromArg(i[0].split(this.parent.tic).join(""));if(this.parent.isCellReference(i[1])){if(-1<i[1].indexOf(":"))return this.parent.getErrorStrings()[z.CommonErrors.Value];n=this.parent.getValueFromArg(i[1].split(this.parent.tic).join(""))||"0"}else n=this.parent.getValueFromArg(i[1].split(this.parent.tic).join(""));if(-1<this.parent.getErrorStrings().indexOf(n))return n;if(n=parseInt(n,10),this.parent.isNumber(e)){if((e=parseInt(e,10))<0||2958465<e)return this.parent.getErrorStrings()[z.CommonErrors.Num];t=this.parent.fromOADate(e)}else t=this.parent.checkDateFormat(e);return isNaN(n)||ee.isNullOrUndefined(this.parent.isDate(t))||9999<t.getFullYear()?this.parent.getErrorStrings()[z.CommonErrors.Value]:(r=t.getDate(),t.setMonth(t.getMonth()+n),r!==t.getDate()&&t.setDate(0),n=this.parent.parentObject.dateToInt(t),"0"===e.toString()&&--n,n<0||2958465<n?this.parent.getErrorStrings()[z.CommonErrors.Num]:n.toString())},r.prototype.ComputeEOMONTH=function(){for(var e,t,r,n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];if(2!==n.length||ee.isNullOrUndefined(n))return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.InvalidArguments];if(""===n[0]||""===n[1])return this.parent.getErrorStrings()[z.CommonErrors.NA];if(""===n[0].split(this.parent.tic).join("")||""===n[1].split(this.parent.tic).join("")||-1<n[1].indexOf(this.parent.tic)&&isNaN(this.parent.parseFloat(n[1].split(this.parent.tic).join(""))))return this.parent.getErrorStrings()[z.CommonErrors.Value];if(this.parent.isCellReference(n[0])){if(-1<n[0].indexOf(":"))return this.parent.getErrorStrings()[z.CommonErrors.Value];if(-1<(r=this.parent.getValueFromArg(n[0].split(this.parent.tic).join(""))||"0").indexOf(this.parent.tic))return this.parent.getErrorStrings()[z.CommonErrors.Value]}else r=this.parent.getValueFromArg(n[0]).split(this.parent.tic).join("");if(-1<this.parent.getErrorStrings().indexOf(r))return r;if(this.parent.isCellReference(n[1])){if(-1<n[1].indexOf(":"))return this.parent.getErrorStrings()[z.CommonErrors.Value];e=this.parent.getValueFromArg(n[1].split(this.parent.tic).join(""))||"0"}else e=this.parent.getValueFromArg(n[1].split(this.parent.tic).join(""));if(-1<this.parent.getErrorStrings().indexOf(e))return e;if(e=parseInt(e,10),this.parent.isNumber(r)){if((r=parseInt(r,10))<0||2958465<r)return this.parent.getErrorStrings()[z.CommonErrors.Num];t=this.parent.fromOADate(r)}else t=this.parent.checkDateFormat(r);return isNaN(e)||ee.isNullOrUndefined(this.parent.isDate(t))||9999<t.getFullYear()?this.parent.getErrorStrings()[z.CommonErrors.Value]:(t=new Date(t.getFullYear(),t.getMonth()+(e+1),0),(r=this.parent.parentObject.dateToInt(t))<0||2958465<r||t.getFullYear()<1900?this.parent.getErrorStrings()[z.CommonErrors.Num]:r.toString())},r.prototype.ComputeDATEVALUE=function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n,i=this.parent.getErrorStrings();if(""===t[0])return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.InvalidArguments];if(1<t.length)return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.WrongNumberArguments];if(e=this.parent.getValueFromArg(t[0])||"0",-1<i.indexOf(e))return e;if(this.parent.isCellReference(t[0])){if(-1<t[0].indexOf(":")||e.startsWith(this.parent.tic))return i[z.CommonErrors.Value]}else e=t[0].split(this.parent.tic).join("")||"0";return this.parent.isNumber(e)||ee.isNullOrUndefined(this.parent.isDate(e))?i[z.CommonErrors.Value]:(n=this.parent.parseDate(e),-1<i.indexOf(e)?e:ee.isNullOrUndefined(n)||"Invalid Date"===n.toString()||n.getFullYear()<1900||9999<n.getFullYear()?this.parent.getErrorStrings()[z.CommonErrors.Value]:(e=this.parent.toOADate(n).toString(),parseFloat(e).toFixed(0).toString()))},r.prototype.ComputeCOUNTBLANK=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=0;if(1!==e.length||ee.isNullOrUndefined(e)||!this.parent.isCellReference(e[0]))return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.InvalidArguments];if(""===e[0])return this.parent.getErrorStrings()[z.CommonErrors.Value];for(var n=this.parent.getCellCollection(e[0]),i=0;i<n.length;i++)""===this.parent.getValueFromArg(n[i])&&r++;return r},r.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[z.FormulasErrorsStrings.InvalidArguments];if(1!==e.length)return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.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]),-1<n.indexOf(i))return i;if(i.startsWith(this.parent.tic)||i.match(/^(\d*\.\d+|\d+)\s*[+\-*/]\s*(\d*\.\d+|\d+)$/))return n[z.CommonErrors.Value];if(""===i)return 1}if(i=i.split(this.parent.tic).join("").trim(),-1<n.indexOf(i))return i;if(i.toUpperCase()===this.parent.trueValue||i.toUpperCase()===this.parent.falseValue)return 1;-1<i.indexOf("%")&&(i=(Number(i.split("%")[0])/100).toString());var o=parseInt(i,10);if(o<0||170<o)return n[z.CommonErrors.Num];if(i.toUpperCase().match(/[A-Z]/)||""===i)return n[z.CommonErrors.Value];if(-1<i.indexOf(":"))return 0;for(var a=1;a<=o;a++)r*=a;return r},r.prototype.ComputeDECIMAL=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r,n,i,o;return ee.isNullOrUndefined(e)||2!==e.length?this.parent.formulaErrorStrings[z.FormulasErrorsStrings.InvalidArguments]:e[0].match(/[@#$%^&*()?:{}|<>+-]/g)?this.parent.getErrorStrings()[z.CommonErrors.Num]:-1<e[1].indexOf(this.parent.tic)&&isNaN(this.parent.parseFloat(e[1].split(this.parent.tic).join("")))?this.parent.getErrorStrings()[z.CommonErrors.Value]:(n=r=void 0,r=this.parent.isCellReference(e[0].toString())?this.parent.getValueFromArg(e[0]):this.parent.getValueFromArg(e[0]).split(this.parent.tic).join(""),n=this.parent.isCellReference(e[1].toString())?this.parent.getValueFromArg(e[1]):this.parent.getValueFromArg(e[1]).split(this.parent.tic).join(""),i=parseInt(r,10),o=parseInt(n,10),-1<this.parent.getErrorStrings().indexOf(r)?r:-1<this.parent.getErrorStrings().indexOf(n)?n:""===r&&""!==n?0:""===r||i<0||!isNaN(i)&&!Number.isInteger(parseFloat(r))||""===n||o<2||36<o||isNaN(o)||isNaN(this.parent.parseFloat(r))&&this.parent.parseFloat(n)<=10||(i=parseInt(r,parseInt(n,10)),isNaN(i))?this.parent.getErrorStrings()[z.CommonErrors.Num]:i)},r.prototype.ComputeDEGREES=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=this.parent.getErrorStrings();if(ee.isNullOrUndefined(e)||""===e[0]&&1===e.length)return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.InvalidArguments];if(1!==e.length)return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.WrongNumberArguments];var n=this.parent.getValueFromArg(e[0]).trim();if(-1<r.indexOf(n))return n;if(this.parent.isCellReference(e[0])){if(""===n||-1<n.indexOf(":"))return 0;if(-1<n.indexOf(this.parent.tic)||isNaN(Number(n))&&!isNaN(parseInt(n,10)))return r[z.CommonErrors.Value]}else if(-1<n.indexOf('"TRUE"'))return r[z.CommonErrors.Value];if((n=n.split(this.parent.tic).join("")).toUpperCase()===this.parent.trueValue)n="1";else if(n.toUpperCase()===this.parent.falseValue)n="0";else if(-1<n.indexOf("%"))n=(Number(n.split("%")[0])/100).toString();else if(n.toUpperCase().match(/[A-Z]/)||isNaN(parseInt(n,10)))return r[z.CommonErrors.Value];return parseFloat(n)*(180/Math.PI)},r.prototype.ComputeADDRESS=function(){for(var e,r=this,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var i=this.parent.getErrorStrings();if(ee.isNullOrUndefined(t)||1===t.length&&""===t[0].trim())return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.InvalidArguments];if(t.length<2||5<t.length)return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.WrongNumberArguments];if(""===t[0].split(this.parent.tic).join("").trim()||""===t[1].split(this.parent.tic).join("").trim())return i[z.CommonErrors.Value];function o(e){var t=r.parent.getValueFromArg(e).trim();if(!(0<i.indexOf(t))){if(t.toUpperCase()===r.parent.trueValue?t="1":t.toUpperCase()===r.parent.falseValue&&(t="0"),r.parent.isCellReference(e)&&-1<t.indexOf(r.parent.tic))return i[z.CommonErrors.Value];2===(t=r.parent.removeTics(t)).split("%").length&&r.parent.isNumber(t.split("%")[0])&&(t=(Number(t.split("%")[0])/100).toString())}return t}var a=o(t[0]);if(0<i.indexOf(a))return a;if(a=Number(a),isNaN(a)||a<1)return i[z.CommonErrors.Value];var s,l,h,a=a.toString(),d=o(t[1]);if(0<i.indexOf(d))return d;if(d=Number(d),isNaN(d)||d<1)return i[z.CommonErrors.Value];if(d=d.toString(),ee.isNullOrUndefined(t[2])||""===t[2].trim())s="1";else{if(s=o(t[2]),0<i.indexOf(s))return s;if(s=Number(s),isNaN(s)||s<1||4<s)return i[z.CommonErrors.Value];s=s.toString()}if(ee.isNullOrUndefined(t[3])||""===t[3].trim())l="1";else{if(l=o(t[3]),0<i.indexOf(l))return l;l.toUpperCase()===this.parent.trueValue||1<Number(l)?l="1":""!==l&&l.toUpperCase()!==this.parent.falseValue||(l="0")}if("1"===l)"1"===s?e="$"+Ol(parseInt(d,10))+"$"+parseInt(a,10):"2"===s?e=Ol(parseInt(d,10))+"$"+parseInt(a,10):"3"===s?e="$"+Ol(parseInt(d,10))+parseInt(a,10):"4"===s&&(e=Ol(parseInt(d,10))+parseInt(a,10));else{if("0"!==l)return i[z.CommonErrors.Name];"1"===s?e="R"+parseInt(a,10)+"C"+parseInt(d,10):"2"===s?e="R"+parseInt(a,10)+"C["+parseInt(d,10)+"]":"3"===s?e="R["+parseInt(a,10)+"]C"+parseInt(d,10):"4"===s&&(e="R["+parseInt(a,10)+"]C["+parseInt(d,10)+"]")}return!ee.isNullOrUndefined(t[4])&&""!==t[4]&&(h=this.parent.getValueFromArg(t[4]).split(this.parent.tic).join(""),0<i.indexOf(h))?h:ee.isNullOrUndefined(h)?e:h+"!"+e},r.prototype.ComputeTIME=function(){for(var e,t,r,n,i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];if(ee.isNullOrUndefined(i)||3!==i.length)return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.InvalidArguments];if(-1<i[0].indexOf(this.parent.tic)&&""===i[0].split(this.parent.tic).join("").trim())return this.parent.getErrorStrings()[z.CommonErrors.Value];if(-1<i[1].indexOf(this.parent.tic)&&""===i[1].split(this.parent.tic).join("").trim())return this.parent.getErrorStrings()[z.CommonErrors.Value];if(-1<i[2].indexOf(this.parent.tic)&&""===i[2].split(this.parent.tic).join("").trim())return this.parent.getErrorStrings()[z.CommonErrors.Value];if(this.parent.isCellReference(i[0])){if(-1<(n=this.parent.getValueFromArg(i[0].split(this.parent.tic).join(""))||"0").indexOf(this.parent.tic))return this.parent.getErrorStrings()[z.CommonErrors.Value]}else{if(-1<i[0].indexOf(this.parent.tic)&&(i[0].split(this.parent.tic).join("")===this.parent.trueValue||i[0].split(this.parent.tic).join("")===this.parent.falseValue))return this.parent.getErrorStrings()[z.CommonErrors.Value];n=this.parent.getValueFromArg(i[0]).split(this.parent.tic).join("")||"0"}if(-1<this.parent.getErrorStrings().indexOf(n))return n;if(isNaN(this.parent.parseFloat(n))&&n!==this.parent.trueValue&&n!==this.parent.falseValue)return this.parent.getErrorStrings()[z.CommonErrors.Value];if(this.parent.isCellReference(i[1])){if(-1<(t=this.parent.getValueFromArg(i[1].split(this.parent.tic).join(""))||"0").indexOf(this.parent.tic))return this.parent.getErrorStrings()[z.CommonErrors.Value]}else{if(-1<i[1].indexOf(this.parent.tic)&&(i[1].split(this.parent.tic).join("")===this.parent.trueValue||i[1].split(this.parent.tic).join("")===this.parent.falseValue))return this.parent.getErrorStrings()[z.CommonErrors.Value];t=this.parent.getValueFromArg(i[1]).split(this.parent.tic).join("")||"0"}if(-1<this.parent.getErrorStrings().indexOf(t))return t;if(isNaN(this.parent.parseFloat(t))&&t!==this.parent.trueValue&&t!==this.parent.falseValue)return this.parent.getErrorStrings()[z.CommonErrors.Value];if(this.parent.isCellReference(i[2])){if(-1<(e=this.parent.getValueFromArg(i[2].split(this.parent.tic).join(""))||"0").indexOf(this.parent.tic))return this.parent.getErrorStrings()[z.CommonErrors.Value]}else{if(-1<i[2].indexOf(this.parent.tic)&&(i[2].split(this.parent.tic).join("")===this.parent.trueValue||i[2].split(this.parent.tic).join("")===this.parent.falseValue))return this.parent.getErrorStrings()[z.CommonErrors.Value];e=this.parent.getValueFromArg(i[2]).split(this.parent.tic).join("")||"0"}return-1<this.parent.getErrorStrings().indexOf(e)?e:isNaN(this.parent.parseFloat(e))&&e!==this.parent.trueValue&&e!==this.parent.falseValue||(n=n===this.parent.trueValue?"1":n===this.parent.falseValue?"0":n,t=t===this.parent.trueValue?"1":t===this.parent.falseValue?"0":t,e=e===this.parent.trueValue?"1":e===this.parent.falseValue?"0":e,n=parseInt(this.parent.parseFloat(n).toString(),10),t=parseInt(this.parent.parseFloat(t).toString(),10),e=parseInt(this.parent.parseFloat(e).toString(),10),isNaN(n))||isNaN(t)||isNaN(e)?this.parent.getErrorStrings()[z.CommonErrors.Value]:32767<n||32767<t||32767<e||(n=new Date(1900,0,1,n,t,e)).getFullYear()<1900?this.parent.getErrorStrings()[z.CommonErrors.Num]:(t="AM",12<=(r=e=n.getHours())&&(r=e-12,t="PM"),n={value:(e=(r=(r=0===r?12:r)<10?"0"+r:r)+":"+(e=(e=n.getMinutes())<10?"0"+e:e)+":"+(r=(r=n.getSeconds())<10?"0"+r:r)+" "+t).toString()},this.parent.parentObject.notify(At,n),n.isTime?n.updatedVal:e)},r.prototype.ComputeCHAR=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r,n=this.parent.getErrorStrings();return ee.isNullOrUndefined(e)||""===e[0]?this.parent.formulaErrorStrings[z.FormulasErrorsStrings.InvalidArguments]:1!==e.length?this.parent.formulaErrorStrings[z.FormulasErrorsStrings.WrongNumberArguments]:(r=this.parent.getValueFromArg(e[0]).trim(),-1<n.indexOf(r)?r:-1<r.indexOf('"TRUE"')||this.parent.isCellReference(e[0])&&r.startsWith(this.parent.tic)||(r=r.split(this.parent.tic).join(""),this.parent.isNumber(r)?r=Math.floor(Number(r)).toString():-1<r.indexOf("%")?r=Math.floor(Number(r.split("%")[0])/100).toString():r===this.parent.trueValue&&(r="1"),!r.toUpperCase().match(/^[0-9]+$/))||255<(r=parseInt(r,10))||r<=0?n[z.CommonErrors.Value]:String.fromCharCode(r))},r.prototype.ComputeCODE=function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=this.parent.getErrorStrings();if(ee.isNullOrUndefined(t)||1===t.length&&""===t[0].trim())return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.InvalidArguments];if(1<t.length)return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.WrongNumberArguments];if(e=this.parent.getValueFromArg(t[0]).trim(),!(-1<n.indexOf(e))){if(-1<t[0].indexOf(this.parent.tic)?e=t[0]!==e&&t[0].startsWith("n")?this.parent.removeTics(e.trim()):this.parent.removeTics(t[0].trim()):!t[0].startsWith("n")&&2===e.split("%").length&&this.parent.isNumber(e.split("%")[0])&&(e=(Number(e.split("%")[0])/100).toString()),""===e)return n[z.CommonErrors.Value];e=e.charCodeAt(0)}return e},r.prototype.ComputeDOLLAR=function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];if(t.length&&"nestedFormulaTrue"===t[t.length-1]&&(e=!0,t.pop()),1===t.length&&(""===t[0]&&(i=!0),t.push("2")),ee.isNullOrUndefined(t)||2!==t.length||i)return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.InvalidArguments];for(var n=0;n<t.length;n++)if(-1<t[n].indexOf(this.parent.tic)&&isNaN(this.parent.parseFloat(t[n])))return this.parent.getErrorStrings()[z.CommonErrors.Value];var i=this.parent.getValueFromArg(t[0]).split(this.parent.tic).join(""),o=this.parent.getValueFromArg(t[1]).split(this.parent.tic).join(""),i=""===i||i===this.parent.falseValue?"0":i===this.parent.trueValue?"1":i,o=""===o||o===this.parent.falseValue?"0":o===this.parent.trueValue?"1":o;if("#NAME?"===i||"#NAME?"===o)return this.parent.getErrorStrings()[z.CommonErrors.Name];if(!i.toUpperCase().match(/^[-]?[0-9.]+$/)||!o.toUpperCase().match(/^[-]?[0-9.]+$/))return this.parent.getErrorStrings()[z.CommonErrors.Value];for(var a=new ee.Internationalization,s=parseInt(o,10),o=Math.pow(10,-1*s),l="",h=1;h<=s;h++)l+="0";i=Math.round(this.parent.parseFloat(i)/o)*o,o=isNaN(i)?this.parent.getErrorStrings()[z.CommonErrors.Value]:a.formatNumber(i,{format:"$#,##0."+l+";($#,##0."+l+");$0."+l});return o=e?this.parent.tic+o+this.parent.tic:o},r.prototype.ComputeSMALL=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=this.parent.getErrorStrings();if(ee.isNullOrUndefined(e)||1===e.length||""===e[0])return""===e[0]&&""===e[1]?r[z.CommonErrors.Num]:this.parent.formulaErrorStrings[z.FormulasErrorsStrings.InvalidArguments];if(2<e.length)return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.WrongNumberArguments];var n=[],i=[];if(!ee.isNullOrUndefined(e[0])){var o=void 0;if(this.parent.isCellReference(e[0]))for(var a=this.parent.getCellCollection(e[0]),s=0;s<a.length;s++){if(o=this.parent.getValueFromArg(a[s]),-1<r.indexOf(o))return o;n.push(o)}else{if(o=this.parent.getValueFromArg(e[0]).split(this.parent.tic).join(""),-1<r.indexOf(o))return o;n.push(o)}for(s=0;s<n.length;s++)""===n[s]||isNaN(this.parent.parseFloat(n[s]))||i.push(this.parent.parseFloat(n[s]));if(0===i.length&&(ee.isNullOrUndefined(n[0])||-1<e[0].indexOf(this.parent.tic)))return r[z.CommonErrors.Value]}if(i=i.sort(function(e,t){return e-t}),!ee.isNullOrUndefined(e[1])){if(this.parent.isCellReference(e[1])){if(""===(l=this.parent.getValueFromArg(e[1])))return r[z.CommonErrors.Num];if(""===l.trim())return r[z.CommonErrors.Value];l.toUpperCase()===this.parent.trueValue?l="1":l.toUpperCase()===this.parent.falseValue&&(l="0")}else l=this.parent.getValueFromArg(e[1]).split(this.parent.tic).join("");if(-1<r.indexOf(l))return l;if(""===l.trim())return 0<e[1].length?r[z.CommonErrors.Value]:r[z.CommonErrors.Num];if(isNaN(this.parent.parseFloat(l)))if(e[1].toUpperCase()===this.parent.trueValue)l="1";else{if(e[1].toUpperCase()!==this.parent.falseValue)return r[z.CommonErrors.Value];l="0"}}var l=Number(l)<1?0:Math.floor(Number(l));return ee.isNullOrUndefined(i[l-1])&&!isNaN(Number(l))?r[z.CommonErrors.Num]:i[l-1]},r.prototype.ComputeLARGE=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=this.parent.getErrorStrings();if(ee.isNullOrUndefined(e)||1===e.length||""===e[0])return""===e[0]&&""===e[1]?r[z.CommonErrors.Num]:this.parent.formulaErrorStrings[z.FormulasErrorsStrings.InvalidArguments];if(2<e.length)return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.WrongNumberArguments];var n=[],i=[];if(!ee.isNullOrUndefined(e[0])){var o=void 0;if(this.parent.isCellReference(e[0]))for(var a=this.parent.getCellCollection(e[0]),s=0;s<a.length;s++){if(o=this.parent.getValueFromArg(a[s]),-1<r.indexOf(o))return o;n.push(o)}else{if(o=this.parent.getValueFromArg(e[0]).split(this.parent.tic).join(""),-1<r.indexOf(o))return o;n.push(o)}for(s=0;s<n.length;s++)""===n[s]||isNaN(this.parent.parseFloat(n[s]))||i.push(this.parent.parseFloat(n[s]));if(0===i.length&&(ee.isNullOrUndefined(n[0])||-1<e[0].indexOf(this.parent.tic)))return r[z.CommonErrors.Value]}if(i=i.sort(function(e,t){return t-e}),!ee.isNullOrUndefined(e[1])){if(this.parent.isCellReference(e[1])){if(""===(l=this.parent.getValueFromArg(e[1])))return r[z.CommonErrors.Num];if(""===l.trim())return r[z.CommonErrors.Value];l.toUpperCase()===this.parent.trueValue?l="1":l.toUpperCase()===this.parent.falseValue&&(l="0")}else l=this.parent.getValueFromArg(e[1]).split(this.parent.tic).join("");if(-1<r.indexOf(l))return l;if(""===l.trim())return 0<e[1].length?r[z.CommonErrors.Value]:r[z.CommonErrors.Num];if(isNaN(this.parent.parseFloat(l)))if(e[1].toUpperCase()===this.parent.trueValue)l="1";else{if(e[1].toUpperCase()!==this.parent.falseValue)return r[z.CommonErrors.Value];l="0"}}var l=Number(l)<1?0:Math.ceil(Number(l));return ee.isNullOrUndefined(i[l-1])&&!isNaN(Number(l))?r[z.CommonErrors.Num]:i[l-1]},r.prototype.ComputeCHOOSE=function(){for(var e=this,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];if(ee.isNullOrUndefined(t)||""===t[0]&&1===t.length)return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.InvalidArguments];if(t.length<2)return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.WrongNumberArguments];var n,i=this.parent.getErrorStrings();if(n=t[0],(n=e.parent.getValueFromArg(n)).toUpperCase()===e.parent.trueValue?n="1":n.toUpperCase()===e.parent.falseValue&&(n="0"),e=n,-1<i.indexOf(e))return e;if(this.parent.isCellReference(t[0])){if(-1<t[0].indexOf(":"))return i[z.CommonErrors.Value]}else 2===(e=this.parent.removeTics(e)).split("%").length&&this.parent.isNumber(e.split("%")[0])&&(e=(.01*Number(e.split("%")[0])).toString());return(e=Math.floor(this.parent.parseFloat(e)))<1||isNaN(e)||ee.isNullOrUndefined(t[e])?i[z.CommonErrors.Value]:this.parent.isCellReference(e=""===(e=t[e])?"0":e)?-1<e.indexOf(":")?i[z.CommonErrors.Value]:this.parent.getValueFromArg(e):(-1<e.indexOf(this.parent.tic)&&(-1<i.indexOf(e.split(this.parent.tic).join(""))||this.parent.removeTics(e).match(/^(\d*\.\d+|\d+)\s*[-*/]\s*(\d*\.\d+|\d+)$/))&&(e=this.parent.removeTics(e)),-1<(e=this.parent.removeTics(this.parent.getValueFromArg(e))).indexOf(this.parent.tic+this.parent.tic)?e.replace(/""/g,this.parent.tic):2===e.split("%").length&&this.parent.isNumber(e.split("%")[0])?(.01*Number(e.split("%")[0])).toString():e)},r.prototype.ComputeSUMIF=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=e;return r[0].indexOf(":")<0&&!this.parent.isCellReference(r[0])||r[2]&&r[2].indexOf(":")<0&&!this.parent.isCellReference(r[2])?this.parent.formulaErrorStrings[z.FormulasErrorsStrings.ImproperFormula]:3<r.length||r.length<2?this.parent.formulaErrorStrings[z.FormulasErrorsStrings.WrongNumberArguments]:"string"==typeof(r=this.parent.computeSumIfAndAvgIf(e,!1))&&(this.parent.formulaErrorStrings.indexOf(r)||this.parent.getErrorStrings().indexOf(r))?r:r[0]},r.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||1<e.length)return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.WrongNumberArguments];if(""===n[0])return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.InvalidArguments];var o=n[0].split(this.parent.tic).join("").trim();if(""===o||-1<n[0].indexOf(this.parent.tic)&&isNaN(this.parent.parseFloat(o)))return this.parent.getErrorStrings()[z.CommonErrors.Value];if(this.parent.isCellReference(n[0])){if(i=this.parent.getValueFromArg(n[0]),-1<this.parent.getErrorStrings().indexOf(i))return this.parent.getErrorStrings()[z.CommonErrors.Value];if(""!==(i=i===this.parent.trueValue?"1":i)&&i!==this.parent.falseValue||(i="0"),r=this.parent.parseFloat(i),isNaN(r)&&!this.parent.isNumber(i))return this.parent.getErrorStrings()[z.CommonErrors.Value]}else{if((i=(i=this.parent.getValueFromArg(n[0]).split(this.parent.tic).join())===this.parent.trueValue?"1":i)===this.parent.falseValue&&(i="0"),-1<this.parent.getErrorStrings().indexOf(i))return i;if(r=this.parent.parseFloat(i),isNaN(r)&&!this.parent.isNumber(i))return this.parent.getErrorStrings()[z.CommonErrors.Value]}return Math.abs(r)},r.prototype.ComputeAVERAGE=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=!1;if(e.length&&"isSubtotal"===e[e.length-1]&&(r=!0,e.pop()),ee.isNullOrUndefined(e)||1===e.length&&""===e[0])return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.InvalidArguments];for(var n=e,i=0;i<n.length;i++)if(-1<n[i].indexOf(":")&&-1<n[i].indexOf(this.parent.tic))return this.parent.getErrorStrings()[z.CommonErrors.Value];return this.parent.calculateAvg(n,r)},r.prototype.ComputeAVERAGEIF=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=e;return r[0].indexOf(":")<0&&!this.parent.isCellReference(r[0])?this.parent.formulaErrorStrings[z.FormulasErrorsStrings.ImproperFormula]:0===(r=this.parent.computeSumIfAndAvgIf(e,!0))[1]||"NaN"===r[0].toString()?this.parent.formulaErrorStrings[z.FormulasErrorsStrings.Div]:"string"==typeof r&&(this.parent.formulaErrorStrings.indexOf(r)||this.parent.getErrorStrings().indexOf(r))?r:this.parent.parseFloat(r[0])/this.parent.parseFloat(r[1])},r.prototype.ComputeCONCATENATE=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=this.parent.getErrorStrings();if(ee.isNullOrUndefined(e)||1===e.length&&""===e[0])return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.InvalidArguments];for(var n=e,i="",o="",a=0;a<n.length;a++){var s=n[a];if(this.parent.isCellReference(s)){if(-1<s.indexOf(":")){if(!this.isConcat)return r[z.CommonErrors.Value];for(var l=this.parent.getCellCollection(s),h=0;h<l.length;h++)i+=this.parent.getValueFromArg(l[h])}else{if(1===n.length&&n[0].indexOf(this.parent.tic)<0&&!Bn(n[0]))return r[z.CommonErrors.Name];o=this.parent.getValueFromArg(s)}if(-1<r.indexOf(o))return o}else if(s.startsWith(this.parent.tic)&&s.endsWith(this.parent.tic)&&-1<s.indexOf('""')?o=(o=s.substring(1,s.length-1)).replace(/""/g,'"'):(o=s.split(this.parent.tic).join(""),(this.parent.isNumber(o)||ee.isNullOrUndefined(this.parent.isDate(o))||s.startsWith(" n"))&&(o=this.parent.getValueFromArg(s).split(this.parent.tic).join(""))),-1<r.indexOf(o))return o;i+=o}return this.isConcat=!1,i},r.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)},r.prototype.ComputeMAX=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this.parent.computeMinMax(e,"max")},r.prototype.ComputeMIN=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this.parent.computeMinMax(e,"min")},r.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),0<e.length?this.parent.formulaErrorStrings[z.FormulasErrorsStrings.WrongNumberArguments]:Math.random().toString()},r.prototype.ComputeAND=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=e;return ee.isNullOrUndefined(e)||1===r.length&&""===r[0]?this.parent.formulaErrorStrings[z.FormulasErrorsStrings.InvalidArguments]:this.parent.computeAndOrNot(r,"and")},r.prototype.ComputeOR=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=e;return ee.isNullOrUndefined(e)||1===r.length&&""===r[0]?this.parent.formulaErrorStrings[z.FormulasErrorsStrings.InvalidArguments]:this.parent.computeAndOrNot(r,"or")},r.prototype.ComputeNOT=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=e;return ee.isNullOrUndefined(e)||1<e.length||""===e[0]?this.parent.formulaErrorStrings[z.FormulasErrorsStrings.WrongNumberArguments]:this.parent.computeAndOrNot(r,"not")},r.prototype.ComputeFIND=function(){for(var r=this,e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=this.parent.getErrorStrings();if(ee.isNullOrUndefined(e)||1===e.length)return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.InvalidArguments];if(3<e.length)return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.WrongNumberArguments];function i(e){var t=r.parent.getValueFromArg(e);return-1<n.indexOf(t)||r.parent.isCellReference(e)||(2===t.split("%").length&&r.parent.isNumber(t.split("%")[0])?t=(.01*Number(t.split("%")[0])).toString():-1<e.indexOf(r.parent.tic)&&(r.parent.removeTics(e).match(/^(\d*\.\d+|\d+)\s*[-*/]\s*(\d*\.\d+|\d+)$/)?t=r.parent.getValueFromArg(r.parent.removeTics(e)):-1<t.indexOf(r.parent.tic+r.parent.tic)&&(t=t.replace(/""/g,r.parent.tic)))),t}var o,a;if(!ee.isNullOrUndefined(e[0])){if(o=i(e[0]),-1<n.indexOf(o))return o;this.parent.isCellReference(e[0])||(o=this.parent.removeTics(o))}if(!ee.isNullOrUndefined(e[1])){if(a=i(e[1]),-1<n.indexOf(a))return a;this.parent.isCellReference(e[1])||(a=this.parent.removeTics(a))}var s=1;if(!ee.isNullOrUndefined(e[2])){if(s=i(e[2]),-1<n.indexOf(s))return s;if(s.toUpperCase()===this.parent.trueValue?s="1":s.toUpperCase()===this.parent.falseValue&&(s="0"),this.parent.isCellReference(e[2])||(s=this.parent.removeTics(s)),s=this.parent.parseFloat(s),isNaN(s)||s<=0)return n[z.CommonErrors.Value]}return(s=a.indexOf(o,s-1))<0?n[z.CommonErrors.Value]:(Number(s)+Number(1)).toString()},r.prototype.ComputeINDEX=function(){for(var e,r=this,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var i,o,a,s,l,h,d,p=this.parent.getErrorStrings();return t.length&&"nestedFormulaTrue"===t[t.length-1]&&(e=!0,t.pop()),ee.isNullOrUndefined(t)||1===t.length&&""===t[0]?this.parent.formulaErrorStrings[z.FormulasErrorsStrings.InvalidArguments]:t.length<2||4<t.length?this.parent.formulaErrorStrings[z.FormulasErrorsStrings.WrongNumberArguments]:""===t[0]?p[z.CommonErrors.Value]:-1===t[0].indexOf(":")?p[z.CommonErrors.Ref]:(o=t[0],a=(i=function(e){if(ee.isNullOrUndefined(e)||""===e)return 1;var t=r.parent.getValueFromArg(e);if(!(-1<p.indexOf(t))){if(t.toUpperCase()===r.parent.trueValue?t="1":t.toUpperCase()===r.parent.falseValue&&(t="0"),-1<t.indexOf(r.parent.tic)&&(t=r.parent.removeTics(t),-1===e.indexOf(r.parent.tic)||""===t.trim()))return p[z.CommonErrors.Value];if(2===t.split("%").length&&r.parent.isNumber(t.split("%")[0])&&(t=(Number(t.split("%")[0])/100).toString()),t=parseInt(Number(t).toString(),10),isNaN(t)||t<0)return p[z.CommonErrors.Value];0===t&&(t=1)}return t})(t[1]),-1<p.indexOf(a.toString())?a.toString():(i=i(t[2]),-1<p.indexOf(i.toString())?i.toString():(d=o.indexOf(":"),s=this.parent.rowIndex(o.substring(0,d)),l=this.parent.rowIndex(o.substring(d+1)),h=this.parent.colIndex(o.substring(0,d)),d=this.parent.colIndex(o.substring(d+1)),l-s+1<a||d-h+1<i?p[z.CommonErrors.Ref]:(a=s+a-1,i=h+i-1,""===(o=this.parent.getValueFromArg(this.getSheetReference(o)+this.parent.convertAlpha(i)+a))?0:e&&-1===p.indexOf(o)&&!this.parent.isNumber(o)&&o!==this.parent.trueValue&&o!==this.parent.falseValue?this.parent.tic+o+this.parent.tic:o))))},r.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):""},r.prototype.ComputeIFS=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=e;if(ee.isNullOrUndefined(e)||1===r.length&&""===r[0]||r.length%2!=0)return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.WrongNumberArguments];for(var n,i="",o=0;o<r.length;o++){if(n=this.parent.getValueFromArg(r[o]),""===r[o])return this.parent.getErrorStrings()[z.CommonErrors.NA];if(-1<this.parent.getErrorStrings().indexOf(n))return n;if(n!==this.parent.trueValue&&n!==this.parent.falseValue)return this.parent.getErrorStrings()[z.CommonErrors.Value];if(n===this.parent.trueValue)return this.parent.isCellReference(r[o+1].split(this.parent.tic).join(""))||r[o+1].includes(this.parent.arithMarker)?i=""===(i=this.parent.getValueFromArg(r[o+1]))?"0":i:-1<(i=""===r[o+1]?"0":this.parent.getValueFromArg(r[o+1])).indexOf(this.parent.tic)&&(i=i.split(this.parent.tic).join("")),o+=1,i;n===this.parent.falseValue&&(o+=1)}return this.parent.getErrorStrings()[z.CommonErrors.NA]},r.prototype.ComputeCOUNTA=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=!1;if(e.length&&"isSubtotal"===e[e.length-1]&&(r=!0,e.pop()),ee.isNullOrUndefined(e)||1===e.length&&""===e[0])return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.WrongNumberArguments];for(var n,i,o=e,a=0,s=0;s<o.length;s++)if(this.parent.isCellReference(o[s]))if(-1<o[s].indexOf(":"))for(var l=this.parent.getCellCollection(o[s].split(this.parent.tic).join("")),h=0;h<l.length;h++)n=r?this.parent.getValueFromArg(l[h],null,null,!0):this.parent.getValueFromArg(l[h]),r&&n.includes("SUBTOTAL(")||0<n.length&&a++;else n=r?this.parent.getValueFromArg(o[s],null,null,!0):this.parent.getValueFromArg(o[s]),r&&n.includes("SUBTOTAL(")||0<n.length&&a++;else(0<(i=this.parent.getValueFromArg(o[s]).split(this.parent.tic).join("")).length||0===i.length&&""===i.trim())&&a++;return a},r.prototype.ComputeAVERAGEA=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(ee.isNullOrUndefined(e)||1===e.length&&""===e[0])return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.WrongNumberArguments];for(var r,n,i,o=e,a=0,s=0,l=0;l<o.length;l++)if(this.parent.isCellReference(o[l]))if(-1<o[l].indexOf(":"))for(var h=this.parent.getCellCollection(o[l].split(this.parent.tic).join("")),d=0;d<h.length;d++){if(r=this.parent.getValueFromArg(h[d]),r=this.processLogicalCellValue(r),-1<this.parent.getErrorStrings().indexOf(r))return r;ee.isNullOrUndefined(r)||""===r||(i=this.parent.parseFloat(r),a+=r=isNaN(i)?0:i,s+=1)}else{if(r=this.parent.getValueFromArg(o[l]),r=this.processLogicalCellValue(r),-1<this.parent.getErrorStrings().indexOf(r))return r;ee.isNullOrUndefined(r)||""===r||(i=this.parent.parseFloat(r),a+=r=isNaN(i)?0:i,s+=1)}else{if(-1<o[l].indexOf(this.parent.tic)&&(isNaN(this.parent.parseFloat(o[l].split(this.parent.tic).join("")))||""===o[l].split(this.parent.tic).join("").trim()))return this.parent.getErrorStrings()[z.CommonErrors.Value];if(o[l]=this.processLogicalCellValue(o[l]),n=this.parent.getValueFromArg(o[l].split(this.parent.tic).join("")),-1<this.parent.getErrorStrings().indexOf(n))return n;a+=this.parent.parseFloat(n),s+=1}return 0===s?this.parent.getErrorStrings()[z.CommonErrors.DivZero]:a/s},r.prototype.processLogicalCellValue=function(e){return e.toUpperCase()===this.parent.trueValue?e="1":e.toUpperCase()===this.parent.falseValue&&(e="0"),e},r.prototype.ComputeSORT=function(){for(var e,t=this,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];r.length&&"nestedFormulaTrue"===r[r.length-1]&&(e=!0,r.pop());var i,o=r,a=[];if(ee.isNullOrUndefined(r)||""===r[0]||4<o.length)return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.WrongNumberArguments];o[1]=o[1]||"1",o[2]=o[2]||"1",o[3]=o[3]||"FALSE",o[0]=o[0].split("$").join("");var s=[];if(-1<o[0].indexOf(":")){var l=o[0].split(":");if(this.parent.isCellReference(l[0])&&this.parent.isCellReference(l[1])){var l=o[0].indexOf(":"),h=void 0,d=this.parent.rowIndex(this.parent.substring(o[0],0,l)),p=this.parent.colIndex(this.parent.substring(o[0],0,l)),c=this.parent.rowIndex(this.parent.substring(o[0],l+1,l+o[0].length-l-1)),u=this.parent.colIndex(this.parent.substring(o[0],l+1,l+o[0].length-l-1));if(c<d&&(h=c,c=d,d=h),u<p&&(h=u,u=p,p=h),this.parent.isCellReference(o[3])){if(o[3]=this.parent.getValueFromArg(o[3]).toUpperCase(),o[3]!==this.parent.trueValue&&o[3]!==this.parent.falseValue)if(oe(o[3]))o[3]=0===Number(o[3])?this.parent.falseValue:this.parent.trueValue;else{if(""!==o[3])return this.parent.getErrorStrings()[z.CommonErrors.Value];o[3]=this.parent.falseValue}}else if(S=o[3].startsWith(this.parent.tic)&&o[3].endsWith(this.parent.tic),o[3]=this.parent.getValueFromArg(o[3]),o[3]=oe(o[3])?0===Number(o[3])?this.parent.falseValue:this.parent.trueValue:o[3].split(this.parent.tic).join("").toUpperCase(),o[3]!==this.parent.trueValue&&o[3]!==this.parent.falseValue)return this.parent.getErrorStrings()[S?z.CommonErrors.Value:z.CommonErrors.Name];if(this.parent.isCellReference(o[2])?(o[2]=this.parent.getValueFromArg(o[2]),o[2]=o[2]===this.parent.trueValue?"1":o[2]):(o[2]=this.parent.getValueFromArg(o[2]),o[2]=o[2]===this.parent.trueValue?"1":o[2].split(this.parent.tic).join("")),o[2]=oe(o[2])?Math.floor(Number(o[2])).toString():o[2],"1"!==o[2]&&"-1"!==o[2])return-1<this.parent.getErrorStrings().indexOf(o[2])?this.parent.getErrorStrings()[z.CommonErrors.Name]:this.parent.getErrorStrings()[z.CommonErrors.Value];l="1"===o[2]?"Ascending":"Descending";if(this.parent.isCellReference(o[1])){if(o[1]=this.parent.getValueFromArg(o[1]),o[1]=oe(o[1])?Math.floor(Number(o[1])).toString():o[1]===this.parent.trueValue?"1":o[1]===this.parent.falseValue?"0":o[1],isNaN(this.parseDouble(o[1]))||this.parseDouble(o[1])<1||(o[3]===this.parent.trueValue?c-d+1<this.parseDouble(o[1]):u-p+1<this.parseDouble(o[1])))return this.parent.getErrorStrings()[z.CommonErrors.Value]}else if(S=o[1].startsWith(this.parent.tic)&&o[1].endsWith(this.parent.tic),o[1]=this.parent.getValueFromArg(o[1]),o[1]=oe(o[1])?Math.floor(Number(o[1])).toString():o[1]===this.parent.trueValue?"1":o[1]===this.parent.falseValue?"0":o[1].split(this.parent.tic).join(""),isNaN(this.parseDouble(o[1]))?S:this.parseDouble(o[1])<1||(o[3]===this.parent.trueValue?c-d+1<this.parseDouble(o[1]):u-p+1<this.parseDouble(o[1])))return this.parent.getErrorStrings()[z.CommonErrors.Value];var f="";0===o[0].indexOf("!")&&(f=(f=(f=o[0]).replace("!","")).indexOf("!"),f=o[0].substring(0,f+2)),o[0]=f+Ol(p)+d+":"+Ol(u)+c;for(var P=this.parent.getCellCollection(o[0]),g=0;g<P.length;g++)s.push(this.parent.getValueFromArg(P[g]));var m=[],v=[],y=[],C=[],b=[],x=u-p+1,M=function(e){e?"TRUE"===e.toUpperCase()||"FALSE"===e.toUpperCase()?(C.push(e),m.push(e)):isNaN(t.parseDouble(e))?(y.push(e),m.push(e)):(v.push(t.parseDouble(e)),m.push(t.parseDouble(e))):""===e&&(b.push(t.parseDouble(e).toString()),m.push(t.parseDouble(e).toString()))};if("TRUE"===o[3])for(g=0;g<x;g++)M(s[g+(this.parseDouble(o[1])-1)*x]);if("FALSE"===o[3])for(g=0;g<s.length;g++)M(s[g*x+this.parseDouble(o[1])-1]);for(var h=0<v.length?H.DataUtil.sort(v,null,H.DataUtil.fnSort(l)):[],S=0<y.length?H.DataUtil.sort(y,null,H.DataUtil.fnSort(l)):[],B=0<C.length?H.DataUtil.sort(C,null,H.DataUtil.fnSort(l)):[],U="Ascending"==l?h.concat(S,B,b):B.concat(S,h,b),w=[],I=0;I<U.length;I++)for(var E=0;E<m.length;E++)JSON.stringify(U[I])===JSON.stringify(m[E])&&-1===w.indexOf(E)&&w.push(E);if("TRUE"===o[3]){for(var N=d,R=0;N<=c;N++,R++)for(var I=0,F=0;I<w.length;I++,F++){var k=this.parent.getValueFromArg(f+Ol(w[I]+p)+N);e&&""!==k?a.push(k):(k=""===k?"0":k,D=(A=-1<(A=this.parent.actCell).indexOf("!")?A.substring(A.lastIndexOf("!")+1):A,this.parent.rowIndex(A)),T=this.parent.colIndex(A),this.parent.parentObject.setValueRowCol(this.parent.getSheetID(this.parent.grid)+1,k,D+R,T+F))}i=this.parent.getValueFromArg(f+Ol(w[0]+p)+d)}if("FALSE"===o[3]){for(I=0,R=0;I<w.length;I++,R++)for(var O=p,F=0;O<=u;O++,F++){var A,T,D,L=this.parent.getValueFromArg(f+Ol(O)+(w[I]+d));e&&""!==L?a.push(L):(L=""===L?"0":L,T=(A=-1<(A=this.parent.actCell).indexOf("!")?A.substring(A.lastIndexOf("!")+1):A,this.parent.colIndex(A)),D=this.parent.rowIndex(A),this.parent.parentObject.setValueRowCol(this.parent.getSheetID(this.parent.grid)+1,L,D+R,T+F))}i=this.parent.getValueFromArg(f+Ol(p)+(w[0]+d))}}}return e?a.join(","):""===i?"0":i},r.prototype.ComputeCOUNTIF=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=e;if(ee.isNullOrUndefined(e)||""===e[0]||2!==r.length)return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.WrongNumberArguments];if(r[0].indexOf(":")<0&&!this.parent.isCellReference(r[0]))return this.parent.getErrorStrings()[z.CommonErrors.Name];var n,i=0,o=[],a="equal";if(""===r[1])return 0;var s=r[1].startsWith(this.parent.tic)&&r[1].endsWith(this.parent.tic),l=r[1].split(this.parent.tic).join(""),h=l.includes("*"),d="*"===l||"<>*"===l,p=h&&!d?l.replace(/\*/g,"").trim():l,c=!1,u=(!s&&this.parent.isCellReference(p)&&(p=this.parent.getValueFromArg(p),c=!0),(l=p=h&&!d&&(h=l.indexOf("*"),"*"===l[0]&&(p="*"+p),"*"===l[l.length-1]&&(p+="*"),0<h)&&h<l.length-1?l.substring(0,h)+"*"+l.substring(h+1):p).startsWith("<=")?(a="lessEq",l=l.substring(2)):l.startsWith(">=")?(a="greaterEq",l=l.substring(2)):l.startsWith("<>")?(a="notEq",l=l.substring(2)):l.startsWith("<")?(a="less",l=l.substring(1)):l.startsWith(">")?(a="greater",l=l.substring(1)):l.startsWith("=")&&(a="equal",l=l.substring(1)),-1<l.indexOf("*")||-1<l.indexOf("?"));if((!s&&this.parent.isCellReference(l)&&!c||l.includes(this.parent.arithMarker)||l.includes(this.parent.getParseDecimalSeparator())&&!u)&&(l=this.parent.getValueFromArg(l)),-1<r[0].indexOf(":")&&this.parent.isCellReference(r[0]))for(var f=this.parent.getCellCollection(r[0].split(this.parent.tic).join("")),g=0;g<f.length;g++)n=this.parent.getValueFromArg(f[g]),u&&(n=this.parent.findWildCardValue(l.toLowerCase(),n.toLowerCase())),o.push(n),o.push(l),this.parent.processLogical(o,a)===this.parent.trueValue&&i++;return i},r.prototype.ComputeSUMIFS=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this.calculateIFS(e)},r.prototype.calculateIFS=function(t,r){var n,i,o,a=this;if(ee.isNullOrUndefined(t)||""===t[0]||t.length<2||127<t.length)return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.WrongNumberArguments];if(3===t.length&&t[2].includes(this.parent.tic+this.parent.tic))return n="",o=this.parent.getParseArgumentSeparator(),t[2].split(this.parent.tic+this.parent.tic).forEach(function(e){(e=e.trim().split(a.parent.tic).join(""))&&(i=a.parent.computeIfsFormulas([t[0],t[1],e],a.parent.falseValue,r).toString(),n+=(n?o:"")+i)}),n;return this.parent.computeIfsFormulas(t,this.parent.falseValue,r)},r.prototype.ComputeTEXT=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=e[1];if(2!==e.length)return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.WrongNumberArguments];var n=e[0],i=r;if(""===r)return this.parent.getValueFromArg(n);var o=new Date(1900,0,1,0,0,0),a=n+","+i,s=new ee.Internationalization;if(-1<this.parent.getErrorStrings().indexOf(a))return a;if(oe((n=this.parent.getValueFromArg(n)).split(this.parent.tic).join(""))&&(n=n.split(this.parent.tic).join("")),""===(i=r.startsWith('"')&&r.endsWith('"')?i.split(this.parent.tic).join(""):this.parent.getValueFromArg(i)))return"";""===n&&(0<i.length&&(-1<i.toUpperCase().indexOf("M")||-1<i.toUpperCase().indexOf("D")||-1<i.toUpperCase().indexOf("Y")||-1<i.toUpperCase().indexOf("S")||-1<i.toUpperCase().indexOf("T"))||-1<i.toUpperCase().indexOf("H"))&&(n=o.toString());a=this.parseDouble(n);if(isNaN(a)&&null!==this.parent.isDate(new Date(n))&&(a=this.parent.toOADate(new Date(n))),o=Date.parse(n.split(this.parent.tic).join("")),!isNaN(a)||!isNaN(o))if(0<i.length&&-1===i.indexOf("#")&&(-1<i.toUpperCase().indexOf("M")||-1<i.toUpperCase().indexOf("D")||-1<i.toUpperCase().indexOf("Y")||-1<i.toUpperCase().indexOf("S")||-1<i.toUpperCase().indexOf("T"))||-1<i.toUpperCase().indexOf("H")){for(var l=(i=(i=i.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(""),h=!1,d=!1,p=0,c=0,p=0;p<l.length;){var u=l[p];"s"===u&&"M"===l[c]&&(l[c]="m","M"===l[c-1])&&(l[c-1]="m"),this.parent.isChar(u)&&(c=p),"M"===u&&h&&(l[p]="m",d=!0),"h"===u?h=!0:this.parent.isChar(u)&&"M"!==u&&"h"!==u&&!d&&(d=h=!1),p++}i=(i=String(l)).split(",").join("").split("\n").join(" ");var f,r=this.parent.fromOADate(a),o=(0===a&&(r=o),pl(i));if(""===o)return f=oi(r),this.parent.parentObject.getDisplayText({format:i,value:f});n=s.getDateFormat({skeleton:o,type:"date"})(new Date(r.toString()))}else n=this.parent.parentObject.getDisplayText({format:i,value:a});return n},r.prototype.ComputeCOUNTIFS=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this.parent.computeIfsFormulas(e,this.parent.trueValue)},r.prototype.ComputeAVERAGEIFS=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this.calculateIFS(e,this.parent.trueValue)},r.prototype.ComputeMATCH=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=e.slice(),n=this.parent.getErrorStrings();if(ee.isNullOrUndefined(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.InvalidArguments];if(r.length<2||3<r.length)return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.WrongNumberArguments];r[0]=this.parent.getValueFromArg(e[0]);var i,o=-1<r[0].indexOf(this.parent.tic);if(r[0]=r[0].split(this.parent.tic).join(""),-1<n.indexOf(r[0]))return r[0];if(""===r[0])return n[z.CommonErrors.NA];if(isNaN(Number(r[0]))&&(o=!0),ee.isNullOrUndefined(e[2]))r[2]="1";else{if(r[2]=this.parent.getValueFromArg(r[2]),-1<r[2].indexOf(this.parent.tic)&&isNaN(Number(r[2].split(this.parent.tic).join(""))))return n[z.CommonErrors.Value];r[2].toUpperCase()===this.parent.trueValue?r[2]="1":r[2].toUpperCase()===this.parent.falseValue&&(r[2]="0")}i=parseFloat(r[2]),-1===[-1,0,1].indexOf(i)&&(i=0);var a=[],s=!1;if(-1<r[1].indexOf(":")||this.parent.isCellReference(r[1])){for(var l=this.parent.getCellCollection(r[1]),h=0;h<l.length;h++){var d=this.parent.getValueFromArg(l[h]);(-1<d.indexOf(this.parent.tic)||isNaN(Number(d)))&&(s=!0),a[h]=d.split(this.parent.tic).join("")}if(o&&!s||!o&&s)return n[z.CommonErrors.NA]}for(var p=0,c="",u=!1,f=isNaN(Number(r[0]))?r[0]:Number(r[0]),g=0;g<a.length;g++)if(""===a[g])g===a.length-1&&a.pop();else{if(-1===i&&(o||s))break;var m=isNaN(Number(a[g]))?a[g]:Number(a[g]);if(1===i)f===m?(p=g+1,u=!0,isNaN(Number(r[0]))&&(o=!1)):m<f&&!o&&!u&&(!c||m>(isNaN(Number(c))?c:Number(c)))&&(p=g+1,c=a[g]);else if(0===i){if((-1<r[0].indexOf("*")||-1<r[0].indexOf("?"))&&(a[g]=this.parent.findWildCardValue(r[0],a[g])),r[0]===a[g])return g+1}else if(-1===i){if(!(Number(a[g])>Number(a[g+1])||g===a.length-1))return n[z.CommonErrors.NA];f===m?(p=g+1,f=void 0):f<m&&(!c||m<(isNaN(Number(c))?c:Number(c)))&&(p=g+1,c=a[g])}}return o&&s&&1===i?a.length:p||n[z.CommonErrors.NA]},r.prototype.ComputeLOOKUP=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=e;return ee.isNullOrUndefined(r)||1===r.length&&""===r[0]?this.parent.formulaErrorStrings[z.FormulasErrorsStrings.WrongNumberArguments]:this.parent.computeLookup(r)},r.prototype.ComputeVLOOKUP=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this.parent.computeVHLookup(e,!0)},r.prototype.ComputeHLOOKUP=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this.parent.computeVHLookup(e)},r.prototype.ComputeSUBTOTAL=function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=this.parent.getErrorStrings();if(ee.isNullOrUndefined(t)||1===t.length&&""===t[0])return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.InvalidArguments];if(t.length<2)return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.WrongNumberArguments];if(e=this.parent.getValueFromArg(t[0]).trim(),!(-1<n.indexOf(e))){if(""===e.split(this.parent.tic).join("").trim())return n[z.CommonErrors.Value];if((e=this.parent.isCellReference(t[0])?e:this.parent.removeTics(e)).toUpperCase()===this.parent.trueValue?e="1":e.toUpperCase()===this.parent.falseValue?e="0":2===e.split("%").length&&this.parent.isNumber(e.split("%")[0])&&(e=(Number(e.split("%")[0])/100).toString()),e=this.parent.parseFloat(e),isNaN(e)||(e<1||11<e)&&(e<101||111<e))return n[z.CommonErrors.Value];var i=t.slice(1,t.length);switch(e){case 1:case 101:e=this.ComputeAVERAGE.apply(this,i.concat(["isSubtotal"]));break;case 2:case 102:e=this.ComputeCOUNT.apply(this,i.concat(["isSubtotal"]));break;case 3:case 103:e=this.ComputeCOUNTA.apply(this,i.concat(["isSubtotal"]));break;case 4:case 104:e=this.ComputeMAX.apply(this,i.concat(["isSubtotal"]));break;case 5:case 105:e=this.ComputeMIN.apply(this,i.concat(["isSubtotal"]));break;case 6:case 106:e=this.ComputePRODUCT.apply(this,i.concat(["isSubtotal"]));break;case 7:case 107:e=this.ComputeDAY.apply(this,i);break;case 8:case 108:e=this.ComputeCONCAT.apply(this,i);break;case 9:case 109:e=this.ComputeSUM.apply(this,i.concat(["isSubtotal"]));break;case 10:case 110:e=this.ComputeAVERAGEA.apply(this,i);break;case 11:case 111:e=this.ComputeABS.apply(this,i);break;default:e=n[z.CommonErrors.Value]}}return e},r.prototype.ComputeRADIANS=function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=this.parent.getErrorStrings();if(ee.isNullOrUndefined(t)||""===t[0]&&1===t.length||2===t[0].split("!").length&&-1===t[0].indexOf(this.parent.tic))return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.InvalidArguments];if(1<t.length)return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.WrongNumberArguments];if(-1<t[0].indexOf(":")||""===t[0].split(this.parent.tic).join("").trim()||"!"===t[0].split(this.parent.tic).join("").trim()||2===t[0].split("!").length)return n[z.CommonErrors.Value];if(e=this.parent.getValueFromArg(t[0]).trim(),!(-1<n.indexOf(e))){if(-1<e.indexOf(this.parent.tic)&&-1===t[0].indexOf(this.parent.tic)||3<e.split(this.parent.tic).length)return n[z.CommonErrors.Value];if(e.toUpperCase()===this.parent.trueValue?e="1":e.toUpperCase()===this.parent.falseValue?e="0":2===e.split("%").length&&this.parent.isNumber(e.split("%")[0])&&(e=(Number(e.split("%")[0])/100).toString()),e=this.parent.parseFloat(e.split(this.parent.tic).join("")),isNaN(e))return this.parent.isCellReference(t[0])||-1<t[0].indexOf(this.parent.tic)?n[z.CommonErrors.Value]:n[z.CommonErrors.Name];e=Math.PI*e/180}return e},r.prototype.ComputeRANDBETWEEN=function(){for(var n,e,t,i=this,r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];return 1===r.length&&""===r[0]?this.parent.formulaErrorStrings[z.FormulasErrorsStrings.InvalidArguments]:2!==r.length?this.parent.formulaErrorStrings[z.FormulasErrorsStrings.WrongNumberArguments]:(n=this.parent.getErrorStrings(),t=(e=function(e){var t=i.parent.getValueFromArg(e);if(-1<n.indexOf(t))return t;if(i.parent.isCellReference(e)){if(""===t)t="0";else if(-1<e.indexOf(":")||t.match(/^(\d*\.\d+|\d+)\s*[+\-*/]\s*(\d*\.\d+|\d+)$/))return n[z.CommonErrors.Value]}else{if(""===t)return n[z.CommonErrors.NA];if(-1<e.indexOf(i.parent.tic)&&i.parent.removeTics(e).match(/^(\d*\.\d+|\d+)\s*[+*]\s*(\d*\.\d+|\d+)$/))return n[z.CommonErrors.Value];if(-1<t.indexOf(i.parent.tic)&&-1<(t=i.parent.removeTics(t)).indexOf(":")){e=t.split(":");if(!(e.length<=3))return n[z.CommonErrors.Value];if(!i.parent.isNumber(e[0])||!i.parent.isNumber(e[1]))return n[z.CommonErrors.Value];var r=Number(e[0])+Number(Number(e[1])/60);if(3===e.length){if(!i.parent.isNumber(e[2]))return n[z.CommonErrors.Value];r+=Number(Number(e[2])/3600)}t=(r/24).toString()}2===t.split("%").length&&i.parent.isNumber(t.split("%")[0])&&(t=(.01*Number(t.split("%")[0])).toString())}return t=parseFloat(t),isNaN(t)?n[z.CommonErrors.Value]:t})(r[1]),-1<n.indexOf(t)?t:(e=e(r[0]),-1<n.indexOf(e)?e:0===e&&0===t?"0":t<e?n[z.CommonErrors.Num]:(e=Math.ceil(e),t=Math.floor(t),Math.floor(Math.random()*(t-e+1)+e))))},r.prototype.ComputeSLOPE=function(){for(var r=this,e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=this.parent.getErrorStrings();if(ee.isNullOrUndefined(e)||1===e.length&&""===e[0].trim())return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.InvalidArguments];if(2!==e.length)return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.WrongNumberArguments];if(""===e[0]||""===e[1])return n[z.CommonErrors.Value];function i(e){return e=-1===e.indexOf(r.parent.tic)?r.parent.getCellCollection(e.split(r.parent.tic).join("")):void 0}var o=i(e[0].trim()),a=i(e[1].trim());if(ee.isNullOrUndefined(o)||ee.isNullOrUndefined(a)||o.length<2&&a.length<2)return n[z.CommonErrors.DivZero];if(o.length!==a.length)return n[z.CommonErrors.NA];function s(e){e=r.getDataCollection(e);for(var t=0;t<e.length;t++)if(-1<n.indexOf(e[t]))return e[t].toString();return e}o=s(o);if(-1<n.indexOf(o.toString()))return o.toString();if(a=s(a),-1<n.indexOf(a.toString()))return a.toString();for(var l=0,h=0,d=0,p=0,c=0,u=0,f=a.length;u<f;++u)""!==a[u]&&"NaN"!==Number(a[u]).toString()&&""!==o[u]&&"NaN"!==Number(o[u]).toString()&&(l+=Number(a[u])*Number(o[u]),d+=Number(a[u]),p+=Number(o[u]),h+=Number(a[u])*Number(a[u]),c++);var g=((l-d*p/c)/(h-d*d/c)).toString();return"NaN"===g?n[z.CommonErrors.DivZero]:g},r.prototype.ComputeINTERCEPT=function(){for(var r=this,e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n,i,o,a,s,l,h,d,p,c=this.parent.getErrorStrings();return ee.isNullOrUndefined(e)||1===e.length&&""===e[0].trim()?this.parent.formulaErrorStrings[z.FormulasErrorsStrings.InvalidArguments]:2!==e.length?this.parent.formulaErrorStrings[z.FormulasErrorsStrings.WrongNumberArguments]:""===e[0]||""===e[1]?c[z.CommonErrors.Value]:(i=(p=function(e){return e=-1===e.indexOf(r.parent.tic)?r.parent.getCellCollection(e.split(r.parent.tic).join("")):void 0})(e[0].trim()),n=p(e[1].trim()),ee.isNullOrUndefined(i)||ee.isNullOrUndefined(n)||i.length<2&&n.length<2?c[z.CommonErrors.DivZero]:i.length!==n.length?c[z.CommonErrors.NA]:(i=(p=function(e){e=r.getDataCollection(e);for(var t=0;t<e.length;t++)if(-1<c.indexOf(e[t]))return e[t];return e})(i),-1<c.indexOf(i.toString())?i.toString():(n=p(n),-1<c.indexOf(n.toString())?n.toString():((p=function(e){for(var t=0,r=n.length;t<r;++t)""!==i[t]&&"NaN"!==Number(i[t]).toString()&&""!==n[t]&&"NaN"!==Number(n[t]).toString()&&(e?(o+=Number(i[t]),a+=Number(n[t]),s++):(d=Number(n[t])-a,l+=d*(Number(i[t])-o),h+=d*d))})(!(h=l=s=a=o=0)),o/=s,a/=s,p(!1),"NaN"===(p=(o-l/h*a).toString())?c[z.CommonErrors.DivZero]:p))))},r.prototype.ComputeLN=function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=this.parent.getErrorStrings();return ee.isNullOrUndefined(t)||""===t[0]&&1===t.length?this.parent.formulaErrorStrings[z.FormulasErrorsStrings.InvalidArguments]:0===t.length||1<t.length?this.parent.formulaErrorStrings[z.FormulasErrorsStrings.WrongNumberArguments]:(e=this.parent.getValueFromArg(t[0]),-1<n.indexOf(e)?e:(e.toUpperCase()===this.parent.trueValue?e="1":e.toUpperCase()===this.parent.falseValue&&(e="0"),this.parent.isCellReference(t[0])||""!==(e=this.parent.removeTics(e)).trim()?(2===e.split("%").length&&this.parent.isNumber(e.split("%")[0])&&(e=(.01*Number(e.split("%")[0])).toString()),(e=this.parent.parseFloat(e))<=0?n[z.CommonErrors.Num]:isNaN(e)?n[z.CommonErrors.Value]:Math.log(e)):n[z.CommonErrors.Value]))},r.prototype.ComputeISNUMBER=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=e;return 1===e.length&&""===e[0]?this.parent.formulaErrorStrings[z.FormulasErrorsStrings.InvalidArguments]:1!==e.length?this.parent.formulaErrorStrings[z.FormulasErrorsStrings.WrongNumberArguments]:""!==(r=this.parent.isCellReference(r[0])?this.parent.getValueFromArg(r[0]):this.parent.getValueFromArg(r[0].split(this.parent.tic).join(""))).toString()&&!e.toString().startsWith(this.parent.tic)&&(r=this.parent.parseFloat(r),!isNaN(r))},r.prototype.ComputeROUND=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(!e.length||1===e.length||2<e.length)return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.WrongNumberArguments];var r=e;if(1===e.length)return n="TRUE"===r[0].split(this.parent.tic).join("")?"1":"FALSE"===r[0].split(this.parent.tic).join("")?"0":r[0],isNaN(this.parent.parseFloat(n))?this.parent.formulaErrorStrings[z.FormulasErrorsStrings.InvalidArguments]:Math.round(this.parent.parseFloat(n)).toString();var n=this.parent.getValueFromArg(r[0]);if(-1<this.parent.getErrorStrings().indexOf(n))return n;var i=this.parent.getValueFromArg(r[1]);if(-1<this.parent.getErrorStrings().indexOf(i))return i;i="TRUE"===i?"1":"FALSE"===i?"0":i;var n=(n="TRUE"===n?"1":"FALSE"===n?"0":n).split(this.parent.tic).join(""),i=i.split(this.parent.tic).join(""),o=isNaN(Number(n))||""===n.trim(),a=isNaN(Number(i))||""===i.trim();return(-1<r[0].indexOf('"')||this.parent.isCellReference(r[0]))&&o||(-1<r[1].indexOf('"')||this.parent.isCellReference(r[1]))&&a?this.parent.getErrorStrings()[z.CommonErrors.Value]:""===n&&""===i||""===n?0:(o=this.parent.parseFloat(n),r=this.parent.parseFloat(i),(!isNaN(r)&&!isNaN(o)&&0<r?this.parent.parseFloat(this.preciseRound(o,r,"ROUND")):(a=Math.pow(10,-r),Math.round(o/a)*a)).toString())},r.prototype.preciseRound=function(e,t,r){var n=Math.pow(10,t),i=Math.abs(e)*n,e=0<=e?1:-1;return(("ROUND"===r?Math.round(i):"ROUNDDOWN"===r?Math.floor(i):Math.ceil(i))/n*e).toFixed(t)},r.prototype.ComputePOWER=function(){for(var r=this,e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n,i,o=this.parent.getErrorStrings();return ee.isNullOrUndefined(e)||1===e.length&&""===e[0].trim()?this.parent.formulaErrorStrings[z.FormulasErrorsStrings.InvalidArguments]:2<e.length?this.parent.formulaErrorStrings[z.FormulasErrorsStrings.WrongNumberArguments]:""===e[0].trim()&&""===e[1].trim()?o[z.CommonErrors.Num]:(n=(i=function(e){var t=r.parent.getValueFromArg(e);if(-1<o.indexOf(t))return t;if(t.toUpperCase()===r.parent.trueValue?t="1":t.toUpperCase()===r.parent.falseValue&&(t="0"),-1<t.indexOf(r.parent.tic)&&(t=r.parent.removeTics(t),-1===e.indexOf(r.parent.tic)||""===t.trim()))return o[z.CommonErrors.Value];if(2===t.split("%").length&&r.parent.isNumber(t.split("%")[0]))t=(Number(t.split("%")[0])/100).toString();else if(-1<t.indexOf("/")&&r.parent.isNumber(t.split("/").join("")))return o[z.CommonErrors.Num];return t=r.parent.parseFloat(t),isNaN(t)?o[z.CommonErrors.Value]:t})(e[0]),-1<o.indexOf(n)?n:(i=i(e[1]),-1<o.indexOf(i)?i:isNaN(n)||isNaN(i)?o[z.CommonErrors.Value]:0===n&&i<0?o[z.CommonErrors.DivZero]:0===n&&0===i||(n=Math.pow(n,i),isNaN(n))||n===1/0?o[z.CommonErrors.Num]:n.toString()))},r.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||1<t.length||""===n)return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.WrongNumberArguments];if(""===n.split(this.parent.tic).join("").trim())return this.parent.getErrorStrings()[z.CommonErrors.Value];if(this.parent.isCellReference(n)){if(-1<(e=this.parent.getValueFromArg(n)||"0").indexOf(this.parent.tic))return this.parent.getErrorStrings()[z.CommonErrors.Value]}else{if(-1<n.indexOf(this.parent.tic)&&(n.split(this.parent.tic).join("")===this.parent.trueValue||n.split(this.parent.tic).join("")===this.parent.falseValue))return this.parent.getErrorStrings()[z.CommonErrors.Value];e=this.parent.getValueFromArg(n).split(this.parent.tic).join("")}if(-1<this.parent.getErrorStrings().indexOf(e))return e;if(e=e===this.parent.trueValue?"1":e===this.parent.falseValue?"0":e,this.parent.parseFloat(e)<0)return this.parent.getErrorStrings()[z.CommonErrors.Num];if(isNaN(this.parent.parseFloat(e))){n={value:e};if(this.parent.parentObject.notify(At,n),!n.isDate&&!n.isTime)return this.parent.getErrorStrings()[z.CommonErrors.Value];e=n.updatedVal}return Math.sqrt(this.parent.parseFloat(e))},r.prototype.ComputeLOG=function(){for(var e,t,n=this,r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];var o=this.parent.getErrorStrings();if(ee.isNullOrUndefined(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.InvalidArguments];if(2<r.length)return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.WrongNumberArguments];function a(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(-1<t.indexOf(n.parent.tic)&&-1===o.indexOf(t.split(n.parent.tic).join(""))){if(""===(t=n.parent.removeTics(t)).trim())return o[z.CommonErrors.Value];if(-1<t.indexOf(":")){e=t.split(":");if(!(e.length<=3))return o[z.CommonErrors.Value];if(!n.parent.isNumber(e[0])||!n.parent.isNumber(e[1]))return o[z.CommonErrors.Value];var r=Number(e[0])+Number(Number(e[1])/60);if(3===e.length){if(!n.parent.isNumber(e[2]))return o[z.CommonErrors.Value];r+=Number(Number(e[2])/3600)}t=(r/24).toString()}}2===t.split("%").length&&n.parent.isNumber(t.split("%")[0])&&(t=(.01*Number(t.split("%")[0])).toString())}return t}if(!ee.isNullOrUndefined(r[0])){if(e=a(r[0]),-1<o.indexOf(e))return e;e=this.parent.parseFloat(e)}if(t=10,!ee.isNullOrUndefined(r[1])){if(t=a(r[1]),-1<o.indexOf(t))return t;t=this.parent.parseFloat(t)}return e=Number(e),isNaN(e)||isNaN(t)?o[z.CommonErrors.Value]:e<=0||t<=0?o[z.CommonErrors.Num]:1===t?o[z.CommonErrors.DivZero]:(Math.log(e)/Math.LN10/(Math.log(t)/Math.LN10)).toString()},r.prototype.ComputeTRUNC=function(){for(var e,n=this,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var i=0,o=this.parent.getErrorStrings();if(ee.isNullOrUndefined(t)||""===t[0]&&1===t.length)return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.InvalidArguments];if(0===t.length||2<t.length)return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.WrongNumberArguments];function a(e){var t=n.parent.getValueFromArg(e);if(!(-1<o.indexOf(t)))if(t===n.parent.trueValue)t="1";else if(t===n.parent.falseValue)t="0";else if(!n.parent.isCellReference(e)){if(-1<e.indexOf(n.parent.tic)&&n.parent.removeTics(e).match(/^(\d*\.\d+|\d+)\s*[*]\s*(\d*\.\d+|\d+)$/))t=n.parent.getValueFromArg(n.parent.removeTics(e));else if(-1<t.indexOf(n.parent.tic)){if(""===(t=n.parent.removeTics(t)).trim())return o[z.CommonErrors.Value];if(-1<t.indexOf(":")){e=t.split(":");if(!(e.length<=3))return o[z.CommonErrors.Value];if(!n.parent.isNumber(e[0])||!n.parent.isNumber(e[1]))return o[z.CommonErrors.Value];var r=Number(e[0])+Number(Number(e[1])/60);if(3===e.length){if(!n.parent.isNumber(e[2]))return o[z.CommonErrors.Value];r+=Number(Number(e[2])/3600)}t=(r/24).toString()}}2===t.split("%").length&&n.parent.isNumber(t.split("%")[0])&&(t=(.01*Number(t.split("%")[0])).toString())}return t}if(!ee.isNullOrUndefined(t[0])){if(e=a(t[0]),-1<o.indexOf(e))return e;if(e=this.parent.parseFloat(e),isNaN(e))return o[z.CommonErrors.Value]}if(!ee.isNullOrUndefined(t[1])){if(i=a(t[1]),-1<o.indexOf(i))return i;if(i=this.parent.parseFloat(i),isNaN(i))return o[z.CommonErrors.Value]}return i=Math.pow(10,Math.floor(i)),(((e=Number(e))<0?-1:1)*Math.floor(i*Math.abs(e))/i).toString()},r.prototype.ComputeEXP=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=this.parent.getErrorStrings();if(""===e[0]&&1===e.length)return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.InvalidArguments];if(1!==e.length)return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.WrongNumberArguments];if(""===e[0].split(this.parent.tic).join("").trim())return r[z.CommonErrors.Value];if(n=this.parent.getValueFromArg(e[0]),-1<r.indexOf(n))return n;if(-1<n.indexOf(this.parent.tic)&&(this.parent.isCellReference(e[0])||isNaN(Number(n.split(this.parent.tic).join("")))))return r[z.CommonErrors.Value];if((n=n.split(this.parent.tic).join(""))===this.parent.trueValue)n="1";else if(n===this.parent.falseValue||""===n)n="0";else if(-1<n.indexOf("%"))n=(Number(n.split("%")[0])/100).toString();else if(-1<n.indexOf(":"))return"0";var n=this.parent.parseFloat(n);return isNaN(n)?r[z.CommonErrors.Value]:709<n?r[z.CommonErrors.Num]:Math.exp(n).toString()},r.prototype.ComputeGEOMEAN=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r,n,i,o=e,a=1,s=0,l=0;if(0===e.length)return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.WrongNumberArguments];if(1!==o.length||""!==o[0]){for(var h,d=0;d<o.length;d++)if(-1<o[d].indexOf(":")){if(o[0]===this.parent.tic)return this.parent.getErrorStrings()[z.CommonErrors.Value];for(i=this.parent.getCellCollection(o[d].split(this.parent.tic).join("")),n=0;n<i.length;n++){if(h=(h=(l=this.parent.getValueFromArg(i[n])).split(this.parent.tic).join(""))===this.parent.trueValue||h===this.parent.falseValue,(r=this.parent.parseFloat(l))<=0)return this.parent.getErrorStrings()[z.CommonErrors.Num];h||-1<this.parent.getErrorStrings().indexOf(l)||isNaN(r)||(s++,a*=r)}}else{if(l=this.parent.getValueFromArg(o[d]),-1<this.parent.getErrorStrings().indexOf(l))return l;var p=l.split(this.parent.tic).join("");if(-1<l.indexOf('"')&&isNaN(this.parent.parseFloat(p)))return this.parent.getErrorStrings()[z.CommonErrors.Value];if(o[d]=o[d].startsWith("n")?o[d].slice(1):o[d],""===l&&""===o[d])return this.parent.getErrorStrings()[z.CommonErrors.Num];if(("TRUE"!==p&&"FALSE"!==p||!this.parent.isCellReference(o[d]))&&0<l.length){if(l="TRUE"===(l=-1<l.indexOf('"')?p:l).split(this.parent.tic).join("")?"1":"FALSE"===l.split(this.parent.tic).join("")?"0":l,!this.parent.isCellReference(o[d])&&isNaN(this.parent.parseFloat(l)))return this.parent.getErrorStrings()[z.CommonErrors.Value];if((r=this.parent.parseFloat(l))<=0)return this.parent.getErrorStrings()[z.CommonErrors.Num];isNaN(r)||(s++,a*=r)}}0<s&&(a=Math.pow(a,1/s))}return a.toString()},r.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[z.FormulasErrorsStrings.WrongNumberArguments];if(""===n[0]||""===n[1])return this.parent.getErrorStrings()[z.CommonErrors.Value];if(n[0].includes('"')||n[1].includes('"'))return this.parent.getErrorStrings()[z.CommonErrors.NA];if(-1===n[0].indexOf(":")&&Fn(n[0])&&-1===n[1].indexOf(":")&&Fn(n[1]))return this.parent.getErrorStrings()[z.CommonErrors.DivZero];var i=this.parent.getCellCollection(n[0]),n=this.parent.getCellCollection(n[1]);if(i.length!==n.length)return this.parent.getErrorStrings()[z.CommonErrors.NA];for(var o=this.getDataCollection(n),a=0;a<o.length;a++)if(-1<this.parent.getErrorStrings().indexOf(o[a]))return o[a];for(var s,l,h=this.getDataCollection(i),d=0;d<h.length;d++)if(-1<this.parent.getErrorStrings().indexOf(h[d]))return h[d];for(var p=0;p<o.length;p++)s=Number(o[p]),l=Number(h[p]),oe(s)&&oe(l)&&r++;return r<=1?this.parent.getErrorStrings()[z.CommonErrors.DivZero]:2===r?1:(i=(n=this.getMeanArray(o,h))[0],n=n[1],i=this.getCorrelation(o,h,i,n),Math.pow(i,2))},r.prototype.getCorrelation=function(e,t,r,n){for(var i,o,a=0,s=0,l=0,h=0;h<e.length;h++)oe(e[h])&&oe(t[h])&&(a+=(o=Number(e[h])-r)*(i=Number(t[h])-n),s+=Math.pow(o,2),l+=Math.pow(i,2));return a/Math.sqrt(s*l)},r.prototype.getMeanArray=function(e,t){for(var r=0,n=0,i=0,o=0;o<e.length;o++)oe(e[o])&&oe(t[o])&&(n+=Number(e[o]),i+=Number(t[o]),r++);return[n/r,i/r]},r.prototype.getDataCollection=function(e){for(var t=[],r=0,n=e.length;r<n;r++)t.push(this.parent.getValueFromArg(e[r]));return t},r.prototype.parseDouble=function(e){e=this.parent.parseFloat(e.toString());return isNaN(e)?NaN:e},r.prototype.spreadsheetDisplayText=function(e){var t;return this.parent.parentObject&&this.parent.parentObject.element&&this.parent.parentObject.element.classList.contains("e-spreadsheet")&&this.parent.isCellReference(e)&&(t=this.parent.parentObject.getIndexes(e),e=this.parent.parentObject.getDisplayText(this.parent.parentObject.getActiveSheet().rows[t.startIdx].cells[t.endIdx])),e},r.prototype.spreadsheetFormat=function(e){var t;return this.parent.parentObject&&this.parent.parentObject.element&&this.parent.parentObject.element.classList.contains("e-spreadsheet")&&this.parent.isCellReference(e)&&(t=this.parent.parentObject.getIndexes(e),e=this.parent.parentObject.getActiveSheet().rows[t.startIdx].cells[t.endIdx].format),e},r.prototype.getModuleName=function(){return"basic-formulas"};var yl=r;function r(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()}bl.prototype.parse=function(t,r){var n=this;if(!this.parent.isTextEmpty(t)){if(cl(t))return this.parent.getErrorStrings()[z.CommonErrors.Ref];this.parent.getFormulaCharacter()!==String.fromCharCode(0)&&this.parent.getFormulaCharacter()===t[0]&&(t=t.substring(1)),(0<this.parent.namedRanges.size||0<this.parent.storedData.size)&&(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 Nl(n.parent.formulaErrorStrings[z.FormulasErrorsStrings.InvalidExpression],!0)}return t+e})).split("-(-").join("(");var e,i,o=this.storeStrings(t),a=(t=this.storedStringText,0);-1<(t=(t=(t=(t=ee.isNullOrUndefined(o)?t.split(" ").join(""):t).split("=>").join(">=")).split("=<").join("<="))[t.length-1]===this.parent.arithMarker&&this.indexOfAny(t,this.tokens)===t.length-2?t:t.toUpperCase()).indexOf(this.sheetToken)&&null!=(e=this.parent.getSheetFamilyItem(this.parent.grid)).sheetNameToParentObject&&0<e.sheetNameToParentObject.size&&(t[0]!==this.sheetToken.toString()&&(t=this.parent.setTokensForSheets(t)),e=this.parent.getSheetToken(t.split(this.parent.tic).join(this.emptyStr)),i=this.checkScopedRange(t.split('"').join(this.emptyStr).split(this.sheetToken).join("")),ee.isNullOrUndefined(e))&&""!==e&&0<this.parent.namedRanges.size&&""!==i&&(t=i),t=this.markLibraryFormulas(t);try{t=this.formulaAutoCorrection(t)}catch(e){if(!(h={message:e.message,exception:e,isForceCalculable:e.formulaCorrection,computeForceCalculate:!1}).isForceCalculable)throw this.parent.formulaErrorStrings[z.FormulasErrorsStrings.InvalidExpression];if(this.isFailureTriggered||(this.parent.trigger("onFailure",h),this.isFailureTriggered=!0),!h.isForceCalculable||!h.computeForceCalculate)throw this.parent.formulaErrorStrings[z.FormulasErrorsStrings.InvalidExpression];t=this.formulaAutoCorrection(t,h),this.parent.storedData.get(r).formulaText="="+t}if(!this.ignoreBracet)for(a=t.indexOf(")");-1<a;){var s=t.substring(0,a).lastIndexOf("(");if(-1===s)throw new Nl(this.parent.formulaErrorStrings[z.FormulasErrorsStrings.MismatchedParentheses]);if(s===a-1)throw new Nl(this.parent.formulaErrorStrings[z.FormulasErrorsStrings.EmptyExpression]);var l=this.emptyStr,l=this.ignoreBracet?this.parent.substring(t,s,a-s+1):this.parent.substring(t,s+1,a-s-1);try{t=t.substring(0,s)+this.parseSimple(l)+t.substring(a+1)}catch(e){if(e===this.parent.formulaErrorStrings[z.FormulasErrorsStrings.CircularReference])throw e;var h=this.exceptionArgs(e),s=(this.isFailureTriggered||(this.parent.trigger("onFailure",h),this.isFailureTriggered=!0),"string"==typeof h.exception?h.exception:h.message);return(this.parent.getErrorLine(e)?"":"#"+this.parent.getErrorLine(e)+": ")+s}a=t.indexOf(")")}if(!this.ignoreBracet&&-1<t.indexOf("("))throw new Nl(this.parent.formulaErrorStrings[z.FormulasErrorsStrings.MismatchedParentheses]);t=this.parseSimple(t),null!==o&&0<o.size&&(t=this.setStrings(t,o))}return t},bl.prototype.exceptionArgs=function(e){return{message:e.message,exception:e,isForceCalculable:e.formulaCorrection,computeForceCalculate:!1}},bl.prototype.formulaAutoCorrection=function(e,t){var r,n,i=["*","+","-","/","^","&"],o=[">","=","<"],a=0,s="",l="",h="",d=0;if(-1<this.parent.formulaErrorStrings.indexOf(e))return e;if(-1<this.indexOfAny(e,this.specialSym))throw new Nl(this.parent.formulaErrorStrings[z.FormulasErrorsStrings.InvalidExpression],!1);for(;a<e.length;)if(e=e.split("-*").join("-").split("/*").join("/").split("*/").join("*").split("-/").join("-").split("*+").join("*").split("+*").join("+"),this.parent.isDigit(e[a])&&e.length>a+1&&-1<this.indexOfAny(e[a+1],i)&&e.length>a+2&&!ee.isNullOrUndefined(e[a+2])&&-1<this.indexOfAny(e[a+2],i)&&("-"!==e[a+2]||"*"!==e[a+1]&&"/"!==e[a+1]&&"^"!==e[a+1]&&"&"!==e[a+1])){if(!t||!t.computeForceCalculate)throw this.parent.formulaErrorStrings[z.FormulasErrorsStrings.ImproperFormula];this.parent.isDigit(e[a])?(d<1?(n=e[a],l=e[a+1],d+=1,s=s+n+(l="&"===(l=ee.isNullOrUndefined(l)?this.emptyStr:l)?"":l)):d<2&&(n=e[a],r=e[a-1],h=e[a+1],d=0,s="-"===r?s+r+n+(h="&"===(h=ee.isNullOrUndefined(h)?this.emptyStr:h)?"":h):s+n+(h=ee.isNullOrUndefined(h)?this.emptyStr:h)),a+=2):(s="-"===e[a]?s+e[a]:s,a+=1)}else if((this.parent.isDigit(e[a])||e[a]===this.parent.rightBracket||this.parent.storedData.has(e[a].toUpperCase()))&&(ee.isNullOrUndefined(e[a+1])||-1<this.indexOfAny(e[a+1],i)))r="&"===(r=ee.isNullOrUndefined(e[a+1])?this.emptyStr:e[a+1])&&"-"!==e[a+2]?"":r,s="-"===e[a-1]?s+e[a-1]+e[a]+r:s+e[a]+r,a+=2;else if(-1<this.indexOfAny(e[a],o)&&!ee.isNullOrUndefined(e[a-1])&&!ee.isNullOrUndefined(e[a+1]))s+=e[a],a+=1;else if("q"===e[a])for(;e[a]!==this.parent.leftBracket;)s+=e[a],a+=1;else(e[a]===this.parent.leftBracket||e[a]===this.parent.rightBracket||"{"===e[a]||"}"===e[a]||"("===e[a]||")"===e[a]||this.parent.isUpperChar(e[a])||-1<e[a].indexOf(":")||e[a]===this.parent.getParseArgumentSeparator()||"%"===e[a]&&this.parent.isDigit(e[a-1])||e[a]===this.parent.tic||" "===e[a]||e[a]===this.parent.getParseDecimalSeparator()||e[a]===this.sheetToken||"$"===e[a]||"_"===e[a]||(this.parent.isDigit(e[a])&&(s="-"===e[a-1]?s+e[a-1]+e[a]:s+e[a]),"-"!==e[a]&&"+"!==e[a]||(s=(s+=e[a]).split("++").join("+").split("+-").join("-").split("-+").join("-")),"/"===e[a])||"*"===e[a]||"^"===e[a])&&(s+=e[a]),a+=1;return s=s===this.emptyStr?e:s,s=(s=-1<this.indexOfAny(s[s.length-1],i)?s.substring(0,s.length-1):s).split("--").join("-").split("-+").join("-").split("+-").join("-")},bl.prototype.checkScopedRange=function(n){var i,e,t,o=this,a=(this.emptyStr,"NaN"),r=this.parent.getSheetID(this.parent.grid),s=this.parent.getSheetFamilyItem(this.parent.grid),l=(n[0]===this.sheetToken.toString()&&(e=n.indexOf(this.sheetToken,1),t=parseInt(n.substr(1,e-1),10),1<e)&&!this.parent.isNaN(t)&&(n=n.substring(e+1),r=t),"!"+r.toString());return null!==s&&null!=s.sheetNameToToken&&s.sheetNameToToken.forEach(function(e,t){var r;s.sheetNameToToken.get(t).toString()===l+"!"&&(r=o.emptyStr,o.parent.namedRanges.forEach(function(e,t){r=ee.isNullOrUndefined(o.parent.parentObject)?s.sheetNameToToken.get(t).toUpperCase():o.parent.parentObject.getActiveSheet().name+o.sheetToken+n.toUpperCase(),o.parent.getNamedRanges().has(r)&&(i=o.parent.getNamedRanges().get(r).toUpperCase(),a=i)}))}),a},bl.prototype.storeStrings=function(e){var t,r,n,i=0,o=0,a=null;if(-1<e.indexOf(this.parent.tic))for(i=e.indexOf(this.parent.tic);-1<i&&0<e.length;){if(null===a&&(a=this.stringsColl),-1===(t=i+1<e.length?e.indexOf(this.parent.tic,i+1):-1))throw new Nl(this.parent.formulaErrorStrings[z.FormulasErrorsStrings.MismatchedTics]);n=this.parent.substring(e,i,t-i+1),r=this.parent.tic+this.spaceString+o.toString()+this.parent.tic,a=a.set(r,n),e=e.substring(0,i)+r+e.substring(t+1),(i+=r.length)<=e.length&&(i=e.indexOf(this.parent.tic,i)),o++}return this.storedStringText=e,a},bl.prototype.setStrings=function(r,e){for(var t=0;t<e.size;t++)e.forEach(function(e,t){r=r.split(t).join(e)});return r},bl.prototype.parseSimple=function(e){var t,r,n,i,o,a,s,l,h,d,p,c;return"#DIV/0!"===(e=0<e.length&&"+"===e[0]?e.substring(1):e)?"#DIV/0!":"#NAME?"===e?"#NAME?":(""===e||-1<this.parent.formulaErrorStrings.indexOf(e)||(e=(e=(e=(e=(e=(e=e.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),t=[this.tokenEp,this.tokenEm],r=[this.tokenMultiply,this.tokenDivide],n=[this.tokenAdd,this.tokenSubtract],i=[this.charMultiply,this.charDivide],o=[this.charAdd,this.charSubtract],a=[this.tokenLess,this.tokenGreater,this.tokenEqual,this.tokenLessEq,this.tokenGreaterEq,this.tokenNotEqual],s=[this.charLess,this.charGreater,this.charEqual,this.charLessEq,this.charGreaterEq,this.charNoEqual],l=[this.charEp,this.charEm],h=[this.tokenAnd],d=[this.charAnd],p=[this.charOr],c=[this.tokenOr],e=this.parseSimpleOperators(e,t,l),e=this.parseSimpleOperators(e,c,p),e=this.parseSimpleOperators(e,r,i),e=this.parseSimpleOperators(e,n,o),e=this.parseSimpleOperators(e,a,s),e=this.parseSimpleOperators(e,h,d)),e)},bl.prototype.parseSimpleOperators=function(e,t,r){if(-1<this.parent.getErrorStrings().indexOf(e))return e;for(var n=e,i=0,o="",a=0;a<r.length;a++)o+=r[a];if(0<(n=(n=(n=n.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&&"-"===n[0])n=n.substring(1).split("-").join(this.tokenOr),n=(n=this.parseSimpleOperators(n="0-"+n,[this.tokenSubtract],[this.charSubtract])).split(this.tokenOr).join("-");else if(0<n.length&&-1<n.indexOf("u")){for(var s,l=n.split(this.parent.getParseArgumentSeparator()),h=0;h<l.length;h++)l[h].startsWith("u")&&(s=l[h].split("u").join("0-"),s=this.parseSimpleOperators(s,[this.tokenSubtract],[this.charSubtract]),l[h]=s);n=l.join(this.parent.getParseArgumentSeparator())}else 0<n.length&&"+"===n[0]?n=n.substring(1):0<n.length&&"+"===n[n.length-1]&&(n=n.substring(0,n.length-1));try{if(-1<this.indexOfAny(n,r)){if(n.includes(" ")){for(var d="",p=0;p<n.length;p++){var c=n[p];0<=r.indexOf(c)?d=d.trim()+c:" "===c&&0<=r.indexOf(d[d.length-1])||(d+=c)}n=d}for(var i=this.indexOfAny(n,r),u=this.parent.getParseDecimalSeparator();-1<i;){var f="",g="",m=0,v=0,y=!1,C=["*","+","-","/","w","=","<",">"],b=n[i]===this.charNOTop,x=0;if(b)m=i;else if(n[x=i-1]===this.parent.arithMarker){if((w=this.findLeftMarker(n.substring(0,x-1)))<0)throw new Nl(this.parent.formulaErrorStrings[z.FormulasErrorsStrings.CannotParse]);f=this.parent.substring(n,w+1,x-w-1),m=w+1}else if(n[x]===this.parent.rightBracket){for(var S=0,w=x-1;0<w&&("q"!==n[w]||0!==S);)"q"===n[w]?S--:n[w]===this.parent.rightBracket&&S++,w--;if(w<0)throw new Nl(this.parent.formulaErrorStrings[z.FormulasErrorsStrings.CannotParse]);f=this.parent.substring(n,w,x-w+1),m=w}else if(n[x]===this.parent.tic[0]){var I=n.substring(0,x-1).lastIndexOf(this.parent.tic);if(I<0)throw new Nl(this.parent.formulaErrorStrings[z.FormulasErrorsStrings.CannotParse]);f=this.parent.substring(n,I,x-I+1),m=I}else{for(var E=!1;-1<x&&(this.parent.isDigit(n[x])||!E&&(n[x]===u||"%"===n[x]));)this.parent.isDigit(n[x])||"%"===n[x]||(E=!0),x-=1;if(-1<x&&E&&n[x]===u)throw new Nl(this.parent.formulaErrorStrings[z.FormulasErrorsStrings.NumberContains2DecimalPoints]);if(0===(x+=1)||0<x&&!this.parent.isUpperChar(n[x-1]))f="n"+this.parent.substring(n,x,i-x),m=x;else if(0<x&&"E"===n[x-1]&&("TRUE"===n.substring(x-4,x)&&(ee.isNullOrUndefined(n[x-5])||-1<C.indexOf(n[x-5]))||"FALSE"===n.substring(x-5,x)&&(ee.isNullOrUndefined(n[x-6])||-1<C.indexOf(n[x-6])))&&("TRUE"===n.substring(x+1,x+5)||"FALSE"===n.substring(x+1,x+6)))x="TRUE"===n.substring(x-4,x)?x-4:x-5,f="TRUE"===n.substring(x,i)?"n1":"FALSE"===n.substring(x,i)?"n0":f,m=x,y=!0;else{for(x-=1;-1<x&&(this.parent.isUpperChar(n[x])||this.parent.isDigit(n[x]));)x-=1;if(-1<x&&n[x]===this.sheetToken){for(x-=1;-1<x&&n[x]!==this.sheetToken;)x-=1;-1<x&&n[x]===this.sheetToken&&(x-=1)}if(-1<x&&":"===n[x]){for(x-=1;-1<x&&this.parent.isDigit(n[x]);)x-=1;for(;-1<x&&this.parent.isUpperChar(n[x]);)x-=1;if(-1<x&&n[x]===this.sheetToken){for(x--;-1<x&&n[x]!==this.sheetToken;)x--;-1<x&&n[x]===this.sheetToken&&x--}x+=1,f=this.parent.substring(n,x,i-x),f=this.parent.getCellFrom(f)}else{var N=!1;(N=0<x&&!this.parent.isUpperChar(n[x])?"u"===n[x]&&n[x-1]===this.parent.getParseArgumentSeparator():N)||(x+=1),f=this.parent.substring(n,x,i-x)}this.parent.updateDependentCell(f),m=x}(0<this.parent.namedRanges.size&&this.parent.namedRanges.has(f.toUpperCase())||this.parent.storedData.has(f.toUpperCase()))&&(f="n"+this.checkForNamedRangeAndKeyValue(f))}if(i===n.length-1)throw new Nl(this.parent.formulaErrorStrings[z.FormulasErrorsStrings.ExpressionCannotEndWithAnOperator]);if((N="u"===n[x=i+1])&&(x+=1),n[x]===this.parent.tic[0]){if((w=n.substring(x+1).indexOf(this.parent.tic))<0)throw this.parent.formulaErrorStrings[z.FormulasErrorsStrings.CannotParse];g=this.parent.substring(n,x,w+2),v=w+x+2}else if(n[x]===this.parent.arithMarker){if((w=this.findRightMarker(n.substring(x+1)))<0)throw new Nl(this.parent.formulaErrorStrings[z.FormulasErrorsStrings.CannotParse]);g=this.parent.substring(n,x+1,w),v=w+x+2}else if("q"===n[x]){for(S=0,w=x+1;w<n.length&&(n[w]!==this.parent.rightBracket||0!==S);)n[w]===this.parent.rightBracket?S++:"q"===n[w]&&S--,w++;if(w===n.length)throw this.parent.formulaErrorStrings[z.FormulasErrorsStrings.CannotParse];g=this.parent.substring(n,x,w-x+1),N&&(g="u"+g),v=w+1}else if(this.parent.isDigit(n[x])||n[x]===u){E=n[x]===u;for(x+=1;x<n.length&&(this.parent.isDigit(n[x])||!E&&n[x]===u);)n[x]===u&&(E=!0),x+=1;if(x<n.length&&"%"===n[x]&&(x+=1),E&&x<n.length&&n[x]===u)throw this.parent.formulaErrorStrings[z.FormulasErrorsStrings.NumberContains2DecimalPoints];g="n"+this.parent.substring(n,i+1,x-i-1),v=x}else if(this.parent.isUpperChar(n[x])||n[x]===this.sheetToken||"u"===n[x]){if(n[x]===this.sheetToken)for(x+=1;x<n.length&&n[x]!==this.sheetToken;)x+=1;x+=1;for(var R=0,F=!1;x<n.length&&(this.parent.isUpperChar(n[x])||"_"===n[x]||n[x]===u||"["===n[x]||"]"===n[x]||"#"===n[x]||" "===n[x]||"%"===n[x]||n[x]===u&&F);)x!==n.length-1&&"["===n[x]&&"["===n[x+1]&&(F=!0),x!==n.length-1&&"]"===n[x]&&"]"===n[x+1]&&(F=!1),x++,R++;var k=x===n.length||!this.parent.isDigit(n[x]);if(1<R){for(;x<n.length&&(this.parent.isUpperChar(n[x])||this.parent.isDigit(n[x])||" "===n[x]||"_"===n[x]);)x++;k=!0}for(;x<n.length&&this.parent.isDigit(n[x]);)x+=1;if(x<n.length&&":"===n[x]){if((x+=1)<n.length&&n[x]===this.sheetToken){for(x++;x<n.length&&n[x]!==this.sheetToken;)x+=1;x<n.length&&n[x]===this.sheetToken&&x++}for(;x<n.length&&this.parent.isUpperChar(n[x]);)x+=1;for(;x<n.length&&this.parent.isDigit(n[x]);)x+=1;x-=1,g=this.parent.substring(n,i+1,x-i),g=this.parent.getCellFrom(g)}else x-=1,g=this.parent.substring(n,i+1,x-i),(N="u"===n[x])&&(g="u"+g);(k=k&&g.startsWith(this.sheetToken)?!this.parent.isCellReference(g):k)||this.parent.updateDependentCell(g),(0<this.parent.namedRanges.size&&this.parent.namedRanges.has(g.toUpperCase())||this.parent.storedData.has(g.toUpperCase()))&&(g="n"+this.checkForNamedRangeAndKeyValue(g));var O=-1<["*","+","-","/","w"].indexOf(n[x-g.length]),g="TRUE"===g&&(y||O)?"n1":"FALSE"===g&&(y||O)?"n0":g,v=x+1}var M=o.indexOf(n[i]),A=this.parent.arithMarker+f+g+t[M]+this.parent.arithMarker;0<m&&(A=n.substring(0,m)+A),v<n.length&&(A+=n.substring(v)),n=A=A.split(this.parent.arithMarker2).join(this.parent.arithMarker.toString()),i=this.indexOfAny(n,r)}}else if(0<n.length&&(this.parent.isUpperChar(n[0])||n[0]===this.sheetToken)){for(var T=!0,D=!0,L=!1,P=n.length,w=0;w<P;++w)if(n[w]===this.sheetToken){if(0<w&&!L)throw this.parent.getErrorStrings()[z.CommonErrors.Ref];for(L=!0,w++;w<P&&this.parent.isDigit(n[w]);)w++;if(w===P||n[w]!==this.sheetToken){T=!1;break}}else{if(!D&&this.parent.isChar(n[w])){T=!1;break}if(!this.parent.isChar(n[w])&&!this.parent.isDigit(n[w])&&n[w]!==this.sheetToken){T=!1;break}D=this.parent.isUpperChar(n[w])}T&&this.parent.updateDependentCell(n)}return n}catch(e){if(e===this.parent.formulaErrorStrings[z.FormulasErrorsStrings.CircularReference])throw e;return e}},bl.prototype.indexOfAny=function(e,t){for(var r=0;r<e.length;r++)if(-1<t.indexOf(e[r]))return r;return-1},bl.prototype.findLeftMarker=function(e){var t=-1;if(-1<e.indexOf(this.parent.arithMarker))for(var r=0,n=e.length-1;0<=n;--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},bl.prototype.findRightMarker=function(e){var t=-1;if(-1<e.indexOf(this.parent.arithMarker))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},bl.prototype.parseFormula=function(t,r){if(-1<(t=0<t.length&&t[0]===this.parent.getFormulaCharacter()?t.substring(1):t).indexOf("#REF!"))return this.parent.getErrorStrings()[z.CommonErrors.Ref];0<t.length&&"+"===t[0]&&(t=t.substring(1));try{this.isFailureTriggered=!1,this.isError=!1,t=this.parse(t.trim(),r),this.isFormulaParsed=!0}catch(e){r=this.exceptionArgs(e),r=(this.isFailureTriggered||(this.parent.trigger("onFailure",r),this.isFailureTriggered=!0),"string"==typeof r.exception?r.exception:r.message);t=(ee.isNullOrUndefined(this.parent.getErrorLine(e))?"":"#"+this.parent.getErrorLine(e)+": ")+r,this.isError=!0}return t},bl.prototype.markLibraryFormulas=function(e){var t=0,r=e.indexOf(")");if(-1===r)e=this.markNamedRanges(e);else for(;-1<r;){for(var n=0,i=r-1;-1<i&&("("!==e[i]||0!==n);)")"===e[i]&&n++,i--;if(-1===i)throw new Nl(this.parent.formulaErrorStrings[z.FormulasErrorsStrings.MismatchedParentheses]);for(var o=i-1;-1<o&&this.parent.isChar(e[o]);)o--;var a=i-o-1,s=this.parent.substring(e,o+1,a);if(0<a&&!ee.isNullOrUndefined(this.parent.getFunction(s))){var l=this.parent.substring(e,i,r-i+1),h=this.parent.getParseArgumentSeparator();"AREAS"===s?this.ignoreBracet=!0:(this.ignoreBracet=!1,s.includes("IFS")&&"COUNTIFS"!==s&&l.includes("{")&&(s=l.indexOf("{"),s=this.parent.substring(l,s,l.indexOf("}")-s+1),l=l.split(s).join(s.split(h).join(this.parent.tic+this.parent.tic))));try{var d=void 0;l=l.split("(").join("").split(")").join(""),l="("+this.formulaAutoCorrection(l,d)+")"}catch(e){if(!(d={message:e.message,exception:e,isForceCalculable:e.formulaCorrection,computeForceCalculate:!1}).isForceCalculable)throw this.parent.formulaErrorStrings[z.FormulasErrorsStrings.ImproperFormula];if(this.isFailureTriggered||(this.parent.trigger("onFailure",d),this.isFailureTriggered=!0,t+=1),d.computeForceCalculate=0<t||d.computeForceCalculate,!d.isForceCalculable)throw this.parent.formulaErrorStrings[z.FormulasErrorsStrings.ImproperFormula];if(!d.computeForceCalculate)throw this.parent.formulaErrorStrings[z.FormulasErrorsStrings.ImproperFormula];l=l.split("(").join("").split(")").join(""),l="("+this.formulaAutoCorrection(l,d)+")"}l=this.markNamedRanges(l),l=this.swapInnerParens(l),-1===(l=this.addParensToArgs(l)).lastIndexOf(h)&&2<l.length&&"("===l[0]&&")"===l[l.length-1]&&"{"!==l[1]&&"("!==l[1]&&(l=(l=l.substring(0,l.length-1)+"}"+l.substring(l.length-1))[0]+"{"+l.substring(1)),e=e.substring(0,o+1)+"q"+this.parent.substring(e,o+1,a)+l.split("(").join(this.parent.leftBracket).split(")").join(this.parent.rightBracket)+e.substring(r+1)}else{if(0<a)return this.parent.getErrorStrings()[z.CommonErrors.Name];s=this.emptyStr,s=(s=0<i?e.substring(0,i):s)+"{"+this.parent.substring(e,i+1,r-i-1)+"}";r<e.length&&(s+=e.substring(r+1)),e=s=this.markNamedRanges(s)}r=e.indexOf(")")}return e=e.split("{").join("(").split("}").join(")")},bl.prototype.swapInnerParens=function(e){return e=2<e.length?e[0]+e.substr(1,e.length-2).split("(").join("{").split(")").join("}")+e[e.length-1]:e},bl.prototype.addParensToArgs=function(e){if(0===e.length)return this.emptyStr;var t=[],r=(t.push(this.parent.getParseArgumentSeparator()),t.push(this.parent.rightBracket),e.lastIndexOf(this.parent.getParseArgumentSeparator())),n=0;if(-1===r)2<e.length&&"("===e[0]&&")"===e[e.length-1]&&("{"!==e[1]&&"("!==e[1]?e=(e=e.substring(0,e.length-1)+"}"+e.substring(e.length-1))[0]+"{"+e.substring(1):(r=this.lastIndexOfAny(e,["+","-","*","/"]),0<(n=0===n&&")"===e[e.length-1]?e.length-1:n)&&"{"!==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;-1<r;){var o=this.indexOfAny(e.substring(r+1,e.length),t);0<=o?o=r+o+1:-1===o&&")"===e[e.length-1]&&(o=e.length-1),r=(e=0<o&&"{"!==e[r+1]&&"}"!==e[o-1]&&"¢"!==e[o-1]?(e=e.substr(0,o).trim()+"}"+e.substr(o)).substr(0,r+1)+"{"+e.substr(r+1).trim():e).substr(0,r).lastIndexOf(this.parent.getParseArgumentSeparator()),i&&-1===r&&"("===e[0]&&(r=0,i=!1)}return e=e.split("{}").join(this.emptyStr)},bl.prototype.lastIndexOfAny=function(e,t){for(var r=e.length-1;-1<r;r--)if(-1<t.indexOf(e[r]))return r;return-1},bl.prototype.markNamedRanges=function(e){for(var t=[")",this.parent.getParseArgumentSeparator(),"}","+","-","*","/","<",">","=","&",":"],r=0<e.length&&("("===e[0]||"{"===e[0])?1:0,n=(-1<(e=-1<e.indexOf("#N/A")?e.split("#N/A").join("#N~A"):e).indexOf("#DIV/0!")&&(e=e.split("#DIV/0!").join("#DIV~0!")),this.indexOfAny(e.substring(r),t));-1<n&&n+r<e.length;){var i=this.emptyStr,o=null;if(-1<this.parent.substring(e,r,n).indexOf("[")?o=this.getTableRange(this.parent.substring(e,r,n)):(this.parent.storedData.has(this.parent.substring(e,r,n))||this.parent.namedRanges.has(this.parent.substring(e,r,n)))&&(o=this.checkForNamedRangeAndKeyValue(this.parent.substring(e,r,n))),ee.isNullOrUndefined(o)&&("NaN"!==(i=this.checkScopedRange(this.parent.substring(e,r,n)))?(this.findNamedRange=!0,o=i):this.parent.substring(e,r,n).startsWith(this.sheetToken.toString()),!ee.isNullOrUndefined(o))&&this.findNamedRange&&-1<o.indexOf(this.fixedReference)&&(o=o.split(this.fixedReference).join(this.emptyStr)),ee.isNullOrUndefined(o)||(o=o.toUpperCase(),o=this.parent.setTokensForSheets(o),o=this.markLibraryFormulas(o)),ee.isNullOrUndefined(o)||o===this.emptyStr)for(r+=n+1;r<e.length&&!this.parent.isUpperChar(e[r])&&e[r]!==this.sheetToken;)r++;else e=e.substring(0,r)+o+e.substring(r+n),r+=o.length+1;for((n=r)<e.length-1&&"{"===e[r]&&(r+=1),n=this.indexOfAny(e.substring(r),t);0===n&&r<e.length-1;)r++,n=this.indexOfAny(e.substring(r),t);(-1===n||-1<e.substring(r).indexOf("["))&&r<e.length&&(o=-1<e.substring(r).indexOf("[")?this.getTableRange(e.substring(r)):this.parent.storedData.has(e.substring(r))?0<this.parent.storedData.size?this.checkForNamedRangeAndKeyValue(e.substring(r)):o:0<this.parent.namedRanges.size?this.checkForNamedRangeAndKeyValue(e.substring(r)):o,ee.isNullOrUndefined(o)&&"NaN"!==(i=this.checkScopedRange(e.substring(r)))&&(o=i),ee.isNullOrUndefined(o)||o===this.emptyStr||(o=o.toUpperCase(),o=this.parent.setTokensForSheets(o),null!=(o=this.markLibraryFormulas(o))&&(e=")"===(i=e.substring(r))[i.length-1]?e.substring(0,r)+o+")":e.substring(0,r)+o,r+=o.toString().length+1)),n=r<e.length?this.indexOfAny(e.substring(r),t):-1)}return e=-1<(e=-1<e.indexOf("#N~A")?e.split("#N~A").join("#N/A"):e).indexOf("#DIV~0!")?e.split("#DIV~0!").join("#DIV/0!"):e},bl.prototype.checkForNamedRangeAndKeyValue=function(e){var t,r;this.emptyStr;return-1<e.indexOf("[")&&(t=this.getTableRange(e),ee.isNullOrUndefined(t)||(this.findNamedRange=!0,e=t)),"NaN"!==(t=this.checkScopedRange(e))?(this.findNamedRange=!0,e=t):(-1<e.indexOf(this.sheetToken)&&(t=this.parent.getSheetFamilyItem(this.parent.grid),r=(r=e.split('"').join(this.emptyStr)).substr(0,r.indexOf(this.sheetToken)),t.sheetNameToToken.has(r.toUpperCase()))&&parseInt(t.sheetNameToToken.get(r.toUpperCase()).split(this.sheetToken).join(this.emptyStr)),0<this.parent.storedData.size&&this.parent.storedData.has(e)&&(e="A"+this.parent.colIndex(e)),0<this.parent.namedRanges.size&&this.parent.namedRanges.has(e.toUpperCase())&&(ee.isNullOrUndefined(this.parent.parentObject)?(e=this.parse(this.parent.namedRanges.get(e.toUpperCase())),-1<(e=this.parent.setTokensForSheets(e)).indexOf(this.fixedReference)&&e.split(this.fixedReference).join(this.emptyStr),this.findNamedRange=!0):e=this.parse(this.parent.namedRanges.get(e.toUpperCase()))),this.findNamedRange&&"!"!==e[0]&&"q"!==e[0]&&"bq"!==e[0]&&-1<(e=this.parent.setTokensForSheets(e)).indexOf(this.fixedReference)&&(e=e.split(this.fixedReference).join(this.emptyStr))),e},bl.prototype.getTableRange=function(e){e=(e=e.replace(" ",this.emptyStr).toUpperCase()).replace("]",this.emptyStr).replace("#DATA",this.emptyStr);-1<e.indexOf(this.parent.getParseArgumentSeparator())&&(e.substring(0,e.indexOf(this.parent.getParseArgumentSeparator())).replace("[",this.emptyStr),e=e.replace("[",this.emptyStr).replace(this.parent.getParseArgumentSeparator(),"_")),this.emptyStr;return e.toUpperCase()},bl.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};var Cl=bl;function bl(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}xl=function(e,t){return(xl=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)};var xl,Sl,wl,Il=function(e,t){function r(){this.constructor=e}xl(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},n=function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;0<=s;s--)(i=e[s])&&(a=(o<3?i(a):3<o?i(t,r,a):i(t,r))||a);return 3<o&&a&&Object.defineProperty(t,r,a),a},El=(Sl=ee.Base,Il(i,Sl),wl=i,Object.defineProperty(i.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}),i.prototype.getParseArgumentSeparator=function(){return this.isArgumentSeparatorChanged||","===this.parseArgumentSeparator||(this.parseArgumentSeparator=","),this.parseArgumentSeparator},i.prototype.setParseArgumentSeparator=function(e){this.parseArgumentSeparator=e,this.isArgumentSeparatorChanged=!0},i.prototype.getParseDateTimeSeparator=function(){return this.parseDateTimeSeparator},i.prototype.setTreatEmptyStringAsZero=function(e){this.treatEmptyStringAsZero=e},i.prototype.getTreatEmptyStringAsZero=function(){return this.treatEmptyStringAsZero},i.prototype.setParseDateTimeSeparator=function(e){this.parseDateTimeSeparator=e},i.prototype.requiredModules=function(){return ul(this)},i.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])},i.prototype.getInjectedModules=function(){return this.injectedModules},i.prototype.onPropertyChanged=function(e,t){},i.prototype.getModuleName=function(){return"calculate"},i.prototype.getFormulaCharacter=function(){return"="},i.prototype.isUpperChar=function(e){e=e.charCodeAt(0);return 64<e&&e<91},i.prototype.resetKeys=function(){this.storedData.clear(),this.keyToRowsMap.clear(),this.rowsToKeyMap.clear()},i.prototype.updateDependentCell=function(e){var t,r,n,i,o=this,a=this.cell;a!==this.emptyString&&((t=this.getSheetFamilyItem(this.grid)).sheetNameToParentObject&&(a.includes(this.sheetToken)||(a=t.parentObjectToToken.get(this.grid)+a),e.includes(this.sheetToken)||(e=t.parentObjectToToken.get(this.grid)+e)),a!==e)&&((t=this.getDependentCells()).has(e)||t.set(e,[]),-1===(t=t.get(e)).indexOf(a))&&(r=this.getDependentFormulaCells(),n={},(i=function(e){if(r.has(e)){var t=r.get(e);if(t.has(a))throw o.formulaErrorStrings[z.FormulasErrorsStrings.CircularReference];n[e]||(n[e]=!0,t.forEach(function(e){i(e)}))}})(e),t.push(a),r.has(a)?r.get(a).has(e)||r.get(a).set(e,e):(r.set(a,new Map),r.get(a).set(e,e)))},i.prototype.getDependentCells=function(){return null==this.dependentCells&&(this.dependentCells=new Map),this.dependentCells},i.prototype.getDependentFormulaCells=function(){var e;return this.isSheetMember()?(null==(e=this.getSheetFamilyItem(this.grid)).sheetDependentFormulaCells&&(e.sheetDependentFormulaCells=new Map),e.sheetDependentFormulaCells):(null==this.dependentFormulaCells&&(this.dependentFormulaCells=new Map),this.dependentFormulaCells)},i.prototype.getLibraryFormulas=function(){return this.lFormulas},i.prototype.getFunction=function(e){return this.getLibraryFormulas().has(e.toUpperCase())?this.getLibraryFormulas().get(e.toUpperCase()).handler:null},i.prototype.intToDate=function(e){var e=Number(e),t=(60<(e=0<e&&e<1?1+e:0===e?1:e)&&--e,new Date("01/01/1900")),t=Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds());return new Date(new Date(864e5*(e-1)+t).toUTCString().replace(" GMT",""))},i.prototype.getFormulaInfoTable=function(){var e;return this.isSheetMember()?(null===(e=this.getSheetFamilyItem(this.grid)).sheetFormulaInfotable&&(e.sheetFormulaInfotable=new Map),e.sheetFormulaInfotable):(null===this.formulaInfoTable&&(this.formulaInfoTable=new Map),this.formulaInfoTable)},i.prototype.getFormula=function(e){return e=e.toUpperCase(),this.storedData.has(e)?this.storedData.get(e).getFormulaText():""},i.prototype.getParseDecimalSeparator=function(){return this.isParseDecimalSeparatorChanged||"."===this.parseDecimalSeparator||(this.parseDecimalSeparator="."),this.parseDecimalSeparator},i.prototype.setParseDecimalSeparator=function(e){this.parseDecimalSeparator=e,this.isParseDecimalSeparatorChanged=!0},i.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[z.FormulasErrorsStrings.BadIndex]},i.prototype.getSheetID=function(e){var t=this.getSheetFamilyItem(e);if(null!=t.sheetNameToParentObject&&0<t.sheetNameToParentObject.size&&(t=t.parentObjectToToken.get(e))){t=t.split(this.sheetToken).join(this.emptyString),e=this.parseFloat(t);if(!this.isNaN(e))return e}return-1},i.prototype.parseFloat=function(e){var t=Number(e);return t=isNaN(t)&&"string"==typeof e&&e.includes(",")?Number(e.split(",").join("")):t},i.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[z.FormulasErrorsStrings.BadIndex]},i.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},i.prototype.getErrorStrings=function(){return null===this.errorStrings&&(this.errorStrings=["#N/A","#VALUE!","#REF!","#DIV/0!","#NUM!","#NAME?","#NULL!","#CALC!"]),this.errorStrings},i.prototype.substring=function(e,t,r){return e.substring(t,r+t)},i.prototype.isChar=function(e){return 65<=e.charCodeAt(0)&&e.charCodeAt(0)<=90||97<=e.charCodeAt(0)&&e.charCodeAt(0)<=122},i.prototype.getSheetFamilyItem=function(e,t){return 0===this.sheetFamilyID?(null==this.defaultFamilyItem&&(this.defaultFamilyItem=new kl),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 kl),this.sheetFamiliesList.get(t))},i.prototype.setKeyValue=function(e,t){e=e.toUpperCase();var t=t.toString().trim(),r=(this.storedData.get(e)&&0!==t.indexOf(this.leftBrace)||(this.storedData.set(e,new Rl),this.keyToRowsMap.set(e,this.keyToRowsMap.size+1),this.rowsToKeyMap.set(this.rowsToKeyMap.size+1,e)),this.storedData.get(e));null!=r.getFormulaText()&&0<r.getFormulaText().length&&r.getFormulaText()!==t&&(e=this.cellPrefix+this.keyToRowsMap.get(e).toString(),null!=this.getDependentFormulaCells().get(e))&&this.clearFormulaDependentCells(e),0<t.length&&t[0]===this.getFormulaCharacter()?r.setFormulaText(t):r.getFormulaValue()!==t&&(r.setFormulaText(""),r.setParsedFormula(""),r.setFormulaValue(t))},i.prototype.clearFormulaDependentCells=function(n){var i=this,e=this.getDependentFormulaCells().get(n);e&&(e.forEach(function(e,t){var r=i.getDependentCells().get(t);i.arrayRemove(r,n),0===r.length&&i.getDependentCells().delete(t)}),this.getDependentFormulaCells().delete(n))},i.prototype.arrayRemove=function(e,t){t=e.indexOf(t);return-1!==t&&e.splice(t,1),e},i.prototype.getKeyValue=function(t){if(t=t.toUpperCase(),null===this.storedData.has(t))return this.emptyString;var r=this.storedData.get(t),n=r.getFormulaText();if(0<n.length&&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(e){i={message:e.message,exception:e,isForceCalculable:!1,computeForceCalculate:!1},n=(this.trigger("onFailure",i),"string"==typeof i.exception?i.exception:i.message);return(ee.isNullOrUndefined(this.getErrorLine(e))?"":"#"+this.getErrorLine(e)+": ")+n}}return this.storedData.get(t).getFormulaValue()},i.prototype.getNamedRanges=function(){return this.namedRanges},i.prototype.addNamedRange=function(e,t){var r=e.split(this.sheetToken);if(1<r.length){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},i.prototype.updateNamedRange=function(n,i){var o=new Map;this.namedRanges.forEach(function(e,t){var r=t;t.includes(n)&&((t=t.split("!"))[0]=i,r=t.join("!")),o.set(r,e)}),this.namedRanges=o},i.prototype.removeNamedRange=function(e){return e=e.toUpperCase(),null!=this.namedRanges.get(e)&&(this.namedRanges.delete(e),!0)},i.prototype.convertAlpha=function(e){for(var t=[],r=0;0<e;){e--;var n="A".charCodeAt(0);t[r]=String.fromCharCode(e%26+n),e=parseInt((e/26).toString(),10),r++}for(var i=[],o=0;o<r;o++)i[r-o-1]=t[o];return i.join("")},i.prototype.getCellCollection=function(e){if(e.indexOf(":")<0){if(!this.isCellReference(e))return e.split(this.getParseArgumentSeparator());e=e+":"+e}var t,r,n,i=this.emptyString,o=e.indexOf(this.sheetToken);if(-1<o)for(var a=o+1;a<e.length;){if(e[a]===this.sheetToken){i=e.substr(0,a+1);break}a++}if(0<(p=e.indexOf(":"))&&this.isChar(e[p-1]))for(var s=p-2;0<=s&&this.isDigit(e[s]);)s--;o=this.rowIndex(this.substring(e,0,p)),t=this.rowIndex(this.substring(e,p+1,p+e.length-p-1)),r=this.colIndex(this.substring(e,0,p)),n=this.colIndex(this.substring(e,p+1,p+e.length-p-1)),t<o&&(p=t,t=o,o=p),n<r&&(p=n,n=r,r=p);for(var l,h=[],d=0,p=o;p<=t;p++)for(l=r;l<=n;l++)h[d]=i+this.emptyString+this.convertAlpha(l)+p.toString(),d++;return h},i.prototype.computeFormula=function(e,t){return this.calculateFormula(e,!1,t)},i.prototype.calculateFormula=function(t,c,u){var f,g,m,v=this,y=!1;if(this.parser.isError)return t;f=this.parser.isFormulaParsed?t:this.parser.parseFormula(t),this.parser.isFormulaParsed=!1;try{if(0<(g=this.findLastIndexOfq(f))&&(y=!0),f!==this.emptyString&&-1<g){for(var C=g+1,b=this;-1<C;)if("break"===function(){if(f[C]!==b.rightBracket)return C++,"continue";var e=f.substring(g,C+1),t=e.split(b.leftBracket)[0].split("q").join(b.emptyString),r=void 0;if(b.getLibraryFormulas().get(t.toUpperCase()).isCustom){for(var r=e.substring(e.indexOf(b.leftBracket)+1,e.indexOf(b.rightBracket)).split(b.getParseArgumentSeparator()),n=0,i=[],o=void 0,n=0;n<r.length;n++)r[n].includes(":")&&b.isCellReference(r[n])&&1<(o=b.getCellCollection(r[n])).length?(i.push(r[n]),o.forEach(function(e){v.updateDependentCell(e)})):i.push(b.getValueFromArg(r[n]));r=i}else{for(var a=e.substring(e.indexOf(b.leftBracket)+1,e.indexOf(b.rightBracket)),s=(r=[],b.getParseArgumentSeparator()),l="",h=void 0,d=0,p=a.length-1;d<=p;d++)'"'===a[d]&&(h=!h),a[d]!==s||h?l+=a[d]:(r.push(l),l=""),d===p&&r.push(l);r.length||(r=[""]),y&&t&&(["IF","INDEX","SORT","T","EXACT","PROPER","DOLLAR","DATE"].some(function(e){return e===t})&&r.push("nestedFormulaTrue"),"IF"===t)&&r.push("nestedFormulaTrue"),u&&"UNIQUE"===t&&r.push("isComputeExp")}return x=ee.isNullOrUndefined(b.getFunction(t))?b.getErrorStrings()[z.CommonErrors.Name]:b.getFunction(t).apply(void 0,r),y?(m=b.processNestedFormula(f,e,x),0===(e=b.findLastIndexOfq(m))&&(y=!1),-1===e&&(x=b.computeValue(m,c)),g=C=e,f=m,"continue"):"break"}())break}else-1<this.formulaErrorStrings.indexOf(f)?x=f:f!==this.emptyString&&-1===g&&(x=this.computeValue(f,c))}catch(e){var t={message:e.message,exception:e,isForceCalculable:!1,computeForceCalculate:!1},t=(this.trigger("onFailure",t),"string"==typeof t.exception?t.exception:t.message),x=(ee.isNullOrUndefined(this.getErrorLine(e))?"":"#"+this.getErrorLine(e)+": ")+t}return x},i.prototype.computeSumIfAndAvgIf=function(e,t){if(ee.isNullOrUndefined(e)||e[0]===this.emptyString||0===e.length)return this.formulaErrorStrings[z.FormulasErrorsStrings.WrongNumberArguments];for(var r,n=e,i=0;i<n.length;i++)this.isCellReference(n[i])&&ee.isNullOrUndefined(n[i].match(/[0-9]/))&&n[i].indexOf("!")<0&&(r=n[i].split(":"),n[i]=r[0]+"1:"+r[1]+this.spreadSheetUsedRange[0]);var o,a,s,l,h,d,p,e=n.length;return 2!==e&&3!==e&&0===e?this.formulaErrorStrings[z.FormulasErrorsStrings.WrongNumberArguments]:""===n[1]?t?this.getErrorStrings()[z.CommonErrors.DivZero]:"0":(t=n[0],p=n[1].startsWith(this.tic)&&n[1].endsWith(this.tic),255<(o=n[1].split(this.tic).join(this.emptyString)).length?this.getErrorStrings()[z.CommonErrors.Value]:(a=o.includes("*"),s=o.includes("?"),h=a?o.replace(/\*/g,"").trim():o,d=!1,!p&&this.isCellReference(h)&&(h=this.getValueFromArg(h),d=!0),o=h=a&&(l=o.indexOf("*"),"*"===o[0]&&(h="*"+h),"*"===o[o.length-1]&&(h+="*"),0<l)&&l<o.length-1?o.substring(0,l)+"*"+o.substring(l+1):h,l=this.parser.tokenEqual,o.startsWith("<=")?(l=this.parser.tokenLessEq,o=o.substring(2)):o.startsWith(">=")?(l=this.parser.tokenGreaterEq,o=o.substring(2)):o.startsWith("<>")?(l=this.parser.tokenNotEqual,o=o.substring(2)):o.startsWith("<")?(l=this.parser.tokenLess,o=o.substring(1)):o.startsWith(">")?(l=this.parser.tokenGreater,o=o.substring(1)):o.startsWith("=")&&(l=this.parser.tokenEqual,o=o.substring(1)),(!p&&this.isCellReference(o)&&!d||o.includes(this.arithMarker)||o.includes(this.getParseDecimalSeparator())&&!a&&!s)&&(o=this.getValueFromArg(o)),h=this.parseFloat(o),p=n[0],d=this.getCellCollection(2<e?n[2]:t),(e=this.getCellCollection(p)).length>d.length&&(t=this.colIndex(d[d.length-1])+this.colIndex(e[e.length-1])-this.colIndex(e[0]),(p=n[2].split(":"))[1]=(this.convertAlpha(t)+this.rowIndex(e[e.length-1])).toString(),d=this.getCellCollection(p.join(":"))),[(t=this.getComputeSumIfValue(e,d,o.toLowerCase(),h,l,a,s))[0],t[1]]))},i.prototype.computeLookup=function(e){var t,r,n,i=[],o=[],a=[],s=[],l=[],h=e.length;if(1===h||3<h)return this.formulaErrorStrings[z.FormulasErrorsStrings.WrongNumberArguments];if(""===e[1]||""===e[2])return this.getErrorStrings()[z.CommonErrors.Value];if(n=this.getValueFromArg(e[0]),-1<e[0].indexOf(this.tic)&&e[0].toUpperCase().split(this.tic).join("")!==this.trueValue&&e[0].toUpperCase().split(this.tic).join("")!==this.falseValue&&this.isNaN(this.parseFloat(e[0].split(this.tic).join("")))&&(n=n.split(this.tic).join("")),-1<this.getErrorStrings().indexOf(n))return n;var d=e[1].split(":");if(2===d.length&&this.isCellReference(d[0])&&this.isCellReference(d[1])&&2===h&&(E=e[1].indexOf(":"),d=this.rowIndex(this.substring(e[1],0,E)),v=this.colIndex(this.substring(e[1],0,E)),f=this.rowIndex(this.substring(e[1],E+1,E+e[1].length-E-1)),y=this.colIndex(this.substring(e[1],E+1,E+e[1].length-E-1)),f<d&&(d=(u=[f,d])[0],f=u[1]),y<v&&(v=(u=[y,v])[0],y=u[1]),u="",0===e[1].indexOf("!")&&(u=(u=(u=e[1]).replace("!","")).indexOf("!"),u=e[1].substring(0,u+2)),(c=y-v+1)<(p=f-d+1)||p==c?(t=u+Ol(v)+d+":"+Ol(v)+f,r=u+Ol(y)+d+":"+Ol(y)+f):p<c&&(t=u+Ol(v)+d+":"+Ol(y)+d,r=u+Ol(v)+f+":"+Ol(y)+f),d===f&&v===y||(I=!0)),I)i=this.getCellCollection(t),o=this.getCellCollection(r);else{var i=this.getCellCollection(e[1]),p=2===h?e[1]:e[2],o=this.getCellCollection(p),c=te(e[1]),u=te(p),d=c[1]===c[3]||c[0]===c[2],f=u[1]===u[3]||u[0]===u[2];if(!d||!f)return this.getErrorStrings()[z.CommonErrors.NA]}for(var g=0;g<i.length;g++)s.push(this.getValueFromArg(i[g]).split(this.tic).join(""));var m=s.map(function(e){return""===e?NaN:Number(e)}).sort(function(e,t){return e-t}),v=m[m.length-1],y=m[0],C=this.parseFloat(n);if(this.isNaN(C))for(var b,x,S=0;S<i.length;S++)a[S]=this.getValueFromArg(i[S]).split(this.tic).join(""),ee.isNullOrUndefined(o[S])||""===n||""===a[S]||(n.toUpperCase()===a[S].toUpperCase()||(-1<n.indexOf("*")||-1<n.indexOf("?"))&&(-1<(x=n).indexOf("*")&&(x=x.replace(/\*/g,"").trim(),this.isCellReference(x)&&(x=this.getValueFromArg(x)),b=n.indexOf("*"),"*"===n[0]&&(x="*"+x),"*"===n[n.length-1]&&(x+="*"),0<b)&&b<n.length-1&&(x=n.substring(0,b)+"*"+n.substring(b+1)),b=[],x=this.findWildCardValue(x.toLowerCase(),a[S].toLowerCase()),b.push(x),b.push(n),this.processLogical(b,"equal")===this.trueValue))&&l.push(this.getValueFromArg(o[S]).split(this.tic).join("")||"0");else for(var w=0;w<m.length;w++)a[w]=m[w].toString().split(this.tic).join(""),ee.isNullOrUndefined(o[w])||""===a[w]||C!==this.parseFloat(a[w])||l.push(this.getValueFromArg(o[w]).split(this.tic).join("")||"0");if(0<l.length)return l[l.length-1];if(v<C&&!ee.isNullOrUndefined(o[i.length-1]))return this.getValueFromArg(o[i.length-1]).split(this.tic).join("")||"0";if(!(C<y)&&s.indexOf(n.split(this.tic).join(""))<0&&n!==this.trueValue&&n!==this.falseValue)if(this.isNaN(C)||this.isNaN(v)||this.isNaN(y)){if(this.isNaN(C)&&""!==n&&/^[a-zA-Z!@#$%^&*()_+{}[\]:;<>,.?~\\/-]/.test(n)){var I=s.sort(),E=this.findClosestMatch(n.split(this.tic).join(""),I);if(!ee.isNullOrUndefined(o[E])&&0<=E)return this.getValueFromArg(o[E]).split(this.tic).join("")||"0"}}else{for(var N=[],R=0;R<m.length;R++)C>m[R]&&N.push(m[R]);var E=N.length-1;if(!ee.isNullOrUndefined(o[E])&&0<=E)return this.getValueFromArg(o[E]).split(this.tic).join("")||"0"}return this.getErrorStrings()[z.CommonErrors.NA]},i.prototype.computeVHLookup=function(e,t){var r=this;if(ee.isNullOrUndefined(e)||e.length<3||4<e.length)return this.formulaErrorStrings[z.FormulasErrorsStrings.WrongNumberArguments];if(""===e[1])return this.getErrorStrings()[z.CommonErrors.NA];var n=this.getValueFromArg(e[0]),i=(n?n.includes(this.tic)&&(a=n.split(this.tic).join(""))&&!this.isNumber(a)&&(i=a.toUpperCase())!==this.trueValue&&i!==this.falseValue&&(n=a):n="0",this.getErrorStrings());if(-1<i.indexOf(n))return n;var o,a=(this.getValueFromArg(e[2])||"0").split(this.tic).join("").toUpperCase(),a=this.parseFloat(a===this.trueValue?"1":a);if(a<1)return i[z.CommonErrors.Value];if(e[3]){if(e[3]=this.getValueFromArg(e[3]).split(this.tic).join(""),-1<i.indexOf(e[3]))return e[3];var s=e[3].toUpperCase();if(s===this.falseValue||"0"===e[3])o=!0;else if(s!==this.trueValue&&"1"!==e[3])return i[z.CommonErrors.Value]}s=e[1].split(":");if(!this.isCellReference(s[0])||!this.isCellReference(s[1]))return i[z.CommonErrors.Value];var l=this.rowIndex(s[0]),h=this.colIndex(s[0]),d=this.rowIndex(s[1]),s=this.colIndex(s[1]);if(d<l&&(l=(p=[d,l])[0],d=p[1]),s<h&&(h=(p=[s,h])[0],s=p[1]),!(0<l&&d<=1048576&&0<h&&s<=16384))return this.getErrorStrings()[z.CommonErrors.Name];var p=this.grid,c="",u=this.getSheetFamilyItem(p),e=(e[1].startsWith("!")?(c=e[1].substring(0,e[1].replace("!","").indexOf("!")+2),null!==u.tokenToParentObject&&(this.grid=u.tokenToParentObject.get(c))):null!==u.parentObjectToToken&&(c=u.parentObjectToToken.get(p)),this.getSheetId(this.grid)),u={action:"getSheetInfo",sheetInfo:[]};if(this.parentObject.notify(ie,u),-1===Ni(this.parentObject,"Sheet"+e,u.sheetInfo))return this.grid=p,i[z.CommonErrors.Ref];var f,g,m=this.getCellValueFn(p,this.cell,e,!0);if(t){var v=h+a-1;if(s<v)return i[z.CommonErrors.Ref];var y=l,C=d,M=c+Ol(h),b=function(e){return m(e,h,M+e)},B=c+Ol(v),x=function(){return m(P,v,B+P)||"0"}}else{var S,w=l+a-1;if(d<w)return i[z.CommonErrors.Ref];y=h,C=s,b=function(e){return S=c+Ol(e),m(l,e,S+l)},x=function(){return m(w,P,S+w)||"0"}}var I=[];if(o){var E,N,R,F=void 0;for(F=this.isNumber(n)?(E=this.parseFloat(n),function(){return E===r.parseFloat(g)}):n.includes("*")||n.includes("?")?(-1<(u=(N=n).indexOf("*"))&&(N=N.replace(/\*/g,"").trim(),this.isCellReference(N)&&(N=this.getValueFromArg(N)),0===u?N="*"+N:u===n.length-1?N+="*":N=n.substring(0,u)+"*"+n.substring(u+1)),N=N.toLowerCase(),function(){return r.processLogical([r.findWildCardValue(N,g.toLowerCase()),n],"equal")===r.trueValue}):(R=n.toUpperCase(),function(){return R===g.toUpperCase()}),P=y;P<=C;P++)(g=b(P))&&F()&&I.push(x());f=I.length?I[0]:i[z.CommonErrors.NA]}else if(-1<n.indexOf("*")||-1<n.indexOf("?"))f=i[z.CommonErrors.NA];else{for(var k,O,A,T,D=void 0,L=(D=this.isNumber(n)?(O=this.parseFloat(n),A=H.DataUtil.fnSort(""),function(){k=A(r.isNumber(g)?r.parseFloat(g):g||null,O)}):(T=new Intl.Collator(this.parentObject.locale||"en-US",{sensitivity:"base"}),function(){k=!g||r.isNumber(g)?null:T.compare(g,n)}),void 0),P=y;P<=C;P++)g=b(P),L||(D(),0===k||k<0?I.push(x()):0<k&&I.length&&(L=!0));f=I.length?I[I.length-1]:i[z.CommonErrors.NA]}return this.grid=p,f},i.prototype.findClosestMatch=function(e,t){for(var r=0,n=t.length-1;r<=n;){var i=Math.floor((r+n)/2),o=t[i],o=this.compareStrings(e.toLowerCase(),o.toLowerCase());if(0===o)return i;1===o?r=i+1:n=i-1}for(var a=r-1;0<=a;a--)if(-1!==this.compareStrings(e.toLowerCase(),t[a].toLowerCase()))return a;return-1},i.prototype.compareStrings=function(e,t){for(var r=Math.min(e.length,t.length),n=0;n<r;n++){var i=e.charCodeAt(n),o=t.charCodeAt(n);if(i<o)return-1;if(o<i)return 1}return e.length<t.length?-1:e.length>t.length?1:0},i.prototype.findWildCardValue=function(e,t){var r="";if(-1<e.indexOf("?"))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(-1<e.indexOf("*")){for(var n=e.indexOf("*"),i="",o="",a=this.falseValue,s=this.falseValue,l=n-1;0<=l;l--)i+=e[l],s=this.trueValue;for(l=n+1;l<e.length;l++)o+=e[l],a=this.trueValue;var n=""===i?-1:t.indexOf(i.split("").reverse().join("")),h=""===o?-1:t.indexOf(o);-1<n||-1<h?(n=i.split("").reverse().join("")===t.substr(0,i.length),h=o===t.substring(t.length-o.length,t.length),s===this.trueValue&&a===this.trueValue&&this.isNaN(this.parseFloat(i))&&this.isNaN(this.parseFloat(o))?r=n&&h?e:t:s===this.trueValue&&this.isNaN(this.parseFloat(i))?r=n?e:t:a===this.trueValue&&this.isNaN(this.parseFloat(o))&&(r=h?e:t)):r=t}return r},i.prototype.getComputeSumIfValue=function(e,t,r,n,i,o,a){var s=0,l=0;switch(i){case this.parser.tokenEqual:for(var h=o?r.replace(/\*/g,""):r,d=0;d<e.length;d++){var p=this.getValueFromRange(t,d),c=this.getValueFromArg(e[d].split(this.tic).join("")).toLowerCase(),u=this.parseFloat(c);c===r&&u===n?(m=this.getValueFromArg(t[d].split(this.tic).join("")),v=this.parseFloat(m),this.isNaN(v)||(s+=v,l+=1)):c===r?this.isNaN(p)||(s+=p,l+=1):o&&h&&c&&this.isNaN(this.parseFloat(c))?(f=r.indexOf("*"),"*"===r[0]&&h.length<=c.length&&h===c.slice(c.length-h.length,c.length)?this.isNaN(p)||(s+=p,l+=1):("*"===r[r.length-1]&&h.length<=c.length&&h===c.slice(0,h.length)||-1<f&&c.startsWith(r.substr(0,f))&&c.endsWith(r.substr(f+1)))&&!this.isNaN(p)&&(s+=p,l+=1)):o&&!h&&c&&this.isNaN(this.parseFloat(c))?this.isNaN(p)||(s+=p,l+=1):a&&h&&c&&this.isNaN(this.parseFloat(c))&&(g=RegExp(h.replace(/\?/g,"[\\s\\S]")),c.length===r.length)&&c.match(g)&&!this.isNaN(p)&&(s+=p,l+=1)}break;case this.parser.tokenLess:for(d=0;d<e.length;d++){c=this.getValueFromArg(e[d].split(this.tic).join(""));(u=this.parseFloat(c))<n&&(m=this.getValueFromArg(t[d].split(this.tic).join("")),v=this.parseFloat(m),this.isNaN(v)||(s+=v,l+=1))}break;case this.parser.tokenGreater:for(d=0;d<e.length;d++){c=this.getValueFromArg(e[d].split(this.tic).join(""));n<(u=this.parseFloat(c))&&(m=this.getValueFromArg(t[d].split(this.tic).join("")),v=this.parseFloat(m),this.isNaN(v)||(s+=v,l+=1))}break;case this.parser.tokenLessEq:for(d=0;d<e.length;d++){c=this.getValueFromArg(e[d].split(this.tic).join(""));(u=this.parseFloat(c))<=n&&(m=this.getValueFromArg(t[d].split(this.tic).join("")),v=this.parseFloat(m),this.isNaN(v)||(s+=v,l+=1))}break;case this.parser.tokenGreaterEq:for(d=0;d<e.length;d++){c=this.getValueFromArg(e[d].split(this.tic).join(""));n<=(u=this.parseFloat(c))&&(m=this.getValueFromArg(t[d].split(this.tic).join("")),v=this.parseFloat(m),this.isNaN(v)||(s+=v,l+=1))}break;case this.parser.tokenNotEqual:for(h=o?r.replace(/\*/g,""):r,d=0;d<e.length;d++){var f,g,m,v,p=this.getValueFromRange(t,d),c=this.getValueFromArg(e[d].split(this.tic).join("")).toLowerCase(),u=this.parseFloat(c);c===r||u===n||o||a?o&&h&&c&&this.isNaN(this.parseFloat(c))?(f=r.indexOf("*"),"*"===r[0]&&h.length<=c.length&&h!==c.slice(c.length-h.length,c.length)||"*"===r[r.length-1]&&h.length<=c.length&&h!==c.slice(0,h.length)?this.isNaN(p)||(s+=p,l+=1):(-1<f&&!c.startsWith(r.substr(0,f))||!c.endsWith(r.substr(f+1)))&&!this.isNaN(p)&&(s+=p,l+=1)):!o||h||this.isNaN(this.parseFloat(c))?a&&h&&c&&this.isNaN(this.parseFloat(c))&&(g=RegExp(h.replace(/\?/g,"[\\s\\S]")),c.length===r.length&&c.match(g)||this.isNaN(p)||(s+=p,l+=1)):this.isNaN(p)||(s+=p,l+=1):(m=this.getValueFromArg(t[d].split(this.tic).join("")),v=this.parseFloat(m),this.isNaN(v)||(s+=v,l+=1))}}return[s,l]},i.prototype.getValueFromRange=function(e,t){e=e[t],e=this.getValueFromArg(e);return this.parseFloat(e.toString())},i.prototype.computeAndOrNot=function(e,t){for(var r,n,i=this,o="and"===t,a="or"===t,s="not"===t,l=o||s,h=[],d=e,p=0;p<d.length;p++){if(d[p]===this.tic)return this.getErrorStrings()[z.CommonErrors.Value];if(this.isCellReference(d[p]))for(var c=this.getCellCollection(d[p]),u=0;u<c.length;u++){if(-1<this.getErrorStrings().indexOf(c[u]))return c[u];if(c[u][0]===this.tic)return this.getErrorStrings()[z.CommonErrors.Name];if(r=this.getValueFromArg(c[u]),-1<this.getErrorStrings().indexOf(r))return r;n=this.parseFloat(r),r===this.falseValue||""!==r&&0===n||s&&""===r?h.push(this.falseValue):r===this.trueValue||!isNaN(n)&&""!==r?h.push(this.trueValue):""!==r&&!isNaN(n)||h.push(this.getErrorStrings()[z.CommonErrors.Value])}else{if(r=this.getValueFromArg(d[p]).split(this.tic).join("").toUpperCase(),-1<this.getErrorStrings().indexOf(r))return r;n=this.parseFloat(r),r===this.falseValue||""===d[p]||""!==r&&0===n?h.push(this.falseValue):r===this.trueValue||!isNaN(n)&&""!==r?h.push(this.trueValue):""!==r&&!isNaN(n)||h.push(this.getErrorStrings()[z.CommonErrors.Value])}}if(h.every(function(e){return e===i.getErrorStrings()[z.CommonErrors.Value]}))return this.getErrorStrings()[z.CommonErrors.Value];for(u=0;u<h.length;u++){if((o||s)&&h[u]===this.falseValue){l=!1;break}if(a&&h[u]===this.trueValue){l=!0;break}}return(l=s?!l:l)?this.trueValue:this.falseValue},i.prototype.removeTics=function(e){return e=1<e.length&&e[0]===this.tic[0]&&e[e.length-1]===this.tic[0]?this.substring(e,1,e.length-2):e},i.prototype.getCellFrom=function(e){var t,r,n="",e=-1<e.indexOf(":")?e.split(":"):[e],i=e.length-1,o=this.rowIndex(e[0]);return o===this.rowIndex(e[i])?(r=this.colIndex(e[0]),t=this.colIndex(e[i]),r<=(r=this.colIndex(this.cell))&&r<=t&&(n=Ol(r).toString()+o.toString())):this.colIndex(e[0])===this.colIndex(e[i])&&(t=this.colIndex(e[0]),r=this.rowIndex(e[i]),o<=(e=this.rowIndex(this.cell)))&&e<=r&&(n=Ol(t).toString()+e.toString()),n},i.prototype.computeValue=function(e,t,r){try{for(var n=[],i=0,o="",a=(n.length=0,this.getParseDecimalSeparator());i<e.length;){var s="u"===e[i];if(s&&(i+=1),e[i]===this.arithMarker)i+=1;else{if(this.isDigit(e[i])){for(var l=this.emptyString;i<e.length&&(this.isDigit(e[i])||e[i]===a);)l+=e[i]===a?".":e[i],i+=1;if(n.push(l),!e[i])return n.toString()}if(e[i]===this.sheetToken){for(o=e[i],i+=1;i<e.length&&e[i]!==this.sheetToken;)o+=e[i],i+=1;i<e.length&&(o+=e[i],i+=1)}else if(this.isUpperChar(e[i])){for(var l=this.emptyString,h="";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=o+this.getCellFrom(l)}else l=o+l;if(h=this.getParentObjectCellValue(l,t).toString(),o="","string"==typeof h&&-1<this.getErrorStrings().indexOf(h))return h;s&&(h=this.isNaN(this.parseFloat(h))?"-"+h:(-this.parseFloat(h)).toString()),n.push(h)}else if("q"===e[i]){var d=e.substring(i+1).indexOf(this.leftBracket),p=e.substring(i+d+1).indexOf(this.rightBracket);e=this.substring(e,i+d+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;(h=l.split(this.tic).join(this.emptyString))===this.trueValue||h===this.falseValue||!this.isNaN(this.parseFloat(h))&&""!==h?n.push(this.tic+h+this.tic):n.push(h),i+=1}else if("%"===e[i]&&0<n.length){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;else switch(e[i]){case"#":var f=0,f=-1<this.getErrorStrings().indexOf(e.substring(i))?-1===e.indexOf("!")||-1===e.substring(i).indexOf("!")?-1<e.indexOf("#N/A")?e.indexOf("#N/A")+4+i:e.indexOf("?")+1+i:e.indexOf("!")+1+i:i+1;n.push(this.substring(e,i,f-i)),i=f;break;case"n":l="";if("n"!==e[i+=1]){if(0===e.substring(i).indexOf("Infinity"))i+=(l="Infinity").length;else{for("u"!==e[i]&&!s&&"-"!==e[i]||(l="-",s)||(i+=1);i<e.length&&(this.isDigit(e[i])||e[i]===a||"."===e[i]);)l+=e[i]===a?".":e[i],i+=1;i<e.length&&"%"===e[i]&&(i+=1,""===l?0<n.length&&(c=n[0],u=this.parseFloat(c),this.isNaN(u)||(n.pop(),n.push((u/100).toString()))):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()[z.CommonErrors.Value]}}}if(0===n.length)return this.emptyString;for(var l=this.emptyString,g=n.length;0<g;){var m=n.pop();if(-1<this.getErrorStrings().indexOf(m))return m;if((l=m+l)===this.emptyString&&this.isCellReference(e)&&this.getTreatEmptyStringAsZero())return"0";g--}return l}catch(e){if(-1<this.getErrorStrings().indexOf(e)||-1<this.formulaErrorStrings.indexOf(e))throw e;throw new Nl(this.formulaErrorStrings[z.FormulasErrorsStrings.InvalidExpression])}},i.prototype.getValArithmetic=function(e,t,r){var n=!1,i=e.pop(),o=-1!==i.indexOf(".")?i.split(".")[1].length:0,o=Math.pow(10,o),a=e.pop(),s=-1!==a.indexOf(".")?a.split(".")[1].length:0,s=Math.pow(10,s),l=s<=o?o:s,h=o*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,Number(i));isNaN(d)&&!r&&(n=!0,i===this.getErrorStrings()[z.CommonErrors.DivZero]?e.push(this.getErrorStrings()[z.CommonErrors.DivZero]):e.push(this.getErrorStrings()[z.CommonErrors.Value])),a=(a=a===this.trueValue?"1":a===this.falseValue?"0":a)===this.emptyString?"0":this.getErrorStrings().indexOf(a.toString())<0?this.parseFloat(a+"").toString():a,d=Number(a),isNaN(d)&&!r&&(n=!0,a===this.getErrorStrings()[z.CommonErrors.DivZero]?e.push(this.getErrorStrings()[z.CommonErrors.DivZero]):e.push(this.getErrorStrings()[z.CommonErrors.Value])),"add"!==t||n||e.push(((Number(a)*l+Number(i)*l)/l).toString()),"sub"!==t||n||e.push(((Number(a)*l-Number(i)*l)/l).toString()),"mul"!==t||n||e.push((Number(a)*s*(Number(i)*o)/h).toString()),"div"!==t||n||(this.isNaN(this.parseFloat(i))||this.isNaN(this.parseFloat(a))?e.push(this.getErrorStrings()[z.CommonErrors.Value]):0===this.parseFloat(i)?e.push(this.getErrorStrings()[z.CommonErrors.DivZero]):e.push((Number(a)*h/(Number(i)*h)).toString()))},i.prototype.processLogical=function(e,t){var r,n,i,o,a,s,l=!1;return"and"!==t&&"equal"!==t&&(r=e.pop(),n=e.pop(),-1<this.getErrorStrings().indexOf(r)?(s=r,l=!0):-1<this.getErrorStrings().indexOf(n)&&(s=n,l=!0),this.isNaN(this.parseFloat(r))&&this.isNaN(this.parseFloat(n))&&(r=r.toString().toLowerCase(),n=n.toString().toLowerCase()),ee.isNullOrUndefined(r)||(i=-1<r.indexOf(this.tic)?r:this.parseFloat(r)),ee.isNullOrUndefined(n)||(o=-1<n.indexOf(this.tic)?n:this.parseFloat(n)),"*"===r)&&this.isNaN(this.parseFloat(n))&&""!==n&&(a=!0),"less"!==t||l||(s=this.isNaN(i)||this.isNaN(o)?n.toUpperCase().split(this.tic).join("").localeCompare(r.toUpperCase().split(this.tic).join(""))<0?this.trueValue:this.falseValue:o<i?this.trueValue:this.falseValue),"greater"!==t||l||(s=this.isNaN(i)||this.isNaN(o)?0<n.toUpperCase().split(this.tic).join("").localeCompare(r.toUpperCase().split(this.tic).join(""))?this.trueValue:this.falseValue:i<o?this.trueValue:this.falseValue),"lessEq"!==t||l||(s=this.isNaN(i)||this.isNaN(o)?n.toUpperCase().split(this.tic).join("").localeCompare(r.toUpperCase().split(this.tic).join(""))<=0?this.trueValue:this.falseValue:o<=i?this.trueValue:this.falseValue),"greaterEq"!==t||l||(s=this.isNaN(i)||this.isNaN(o)?0<=n.toUpperCase().split(this.tic).join("").localeCompare(r.toUpperCase().split(this.tic).join(""))?this.trueValue:this.falseValue:i<=o?this.trueValue:this.falseValue),"notEq"!==t||l||(s=n!==r?this.trueValue:this.falseValue,a&&(s=this.falseValue)),"and"!==t||l||(r=e.pop().toString(),n="",0<e.length&&(n=e.pop().toString()),s=-1<this.getErrorStrings().indexOf(r)?r:-1<this.getErrorStrings().indexOf(n)?n:(s=this.emptyString+n+r+this.emptyString).split(this.tic).join("")),"equal"!==t||l||(r=e.pop(),n=e.pop(),s=-1<this.getErrorStrings().indexOf(r)?r:-1<this.getErrorStrings().indexOf(n)?n:(this.isNaN(this.parseFloat(r))&&this.isNaN(this.parseFloat(n))&&(r=r.toString().toLowerCase(),n=n.toString().toLowerCase()),"*"===r&&this.isNaN(this.parseFloat(n))&&""!==n&&(a=!0),r===n||a?this.trueValue:this.falseValue)),"or"!==t||l||(s=Math.pow(this.parseFloat(o),this.parseFloat(i)).toString(),s=this.isNaN(this.parseFloat(s))?this.getErrorStrings()[z.CommonErrors.Value]:s),e.push(s),s},i.prototype.computeStoreCells=function(e){for(var t=e.cellValue,r=e.cellRange,n=e.criteria,i=e.argArray,o=e.isCriteria,a=e.storedCells,s=e.isCountIfS===this.trueValue,l=e.countVal||0,h=o===this.trueValue?a:t,d=[],p=0;p<h.length;p++){var c=[],u=this.getValueFromArg(t[p]),f=i[s?1+2*l:2+l],g=f.startsWith(this.tic)&&f.endsWith(this.tic),m=(f=f.trim().split(this.tic).join(this.emptyString)).includes("*"),v="*"===f||"<>*"===f,y=m&&!v?f.replace(/\*/g,"").trim():f,C=!1,b=(!g&&this.isCellReference(y)&&(y=this.getValueFromArg(y),C=!0),f=y=m&&!v&&(m=f.indexOf("*"),"*"===f[0]&&(y="*"+y),"*"===f[f.length-1]&&(y+="*"),0<m)&&m<f.length-1?f.substring(0,m)+"*"+f.substring(m+1):y,"");if((o=s?this.trueValue:o)===this.trueValue){var x="",S=0,w=0,v=void 0,m=void 0,y=void 0,I=void 0,v=(a[p]=(s&&!l?t:a)[p],x=a[p],l&&(m=-1<(v=r[l-1]).indexOf("!")?te(v.substring(v.lastIndexOf("!")+1)):te(v),y=-1<x.indexOf("!")?W(x.substring(x.lastIndexOf("!")+1)):W(x),I=-1<r[l].indexOf("!")?te(r[l].substring(r[l].lastIndexOf("!")+1)):te(r[l])),-1<x.indexOf("!")),E=void 0,N="",R="";for(v&&(R=x.substring(0,x.lastIndexOf("!")+1),x=x.substring(x.lastIndexOf("!")+1));!this.isDigit(x[S]);)S+=1;if(this.isCellReference(r[l])&&-1<r[l].indexOf(":"))for(b=s&&!l?-1<h[p].indexOf("!")?h[p].substring(h[p].lastIndexOf("!")+1):h[p]:G(I[0]+(y[0]-m[0]),I[1]+(y[1]-m[1])),(E=-1<r[l].indexOf("!"))&&(N=r[l].substring(0,r[l].lastIndexOf("!")+1));!this.isDigit(b[w]);)w+=1;var I=this.substring(x,S),y=this.substring(b,w),m=this.substring(x,S,x.length-S),F=this.substring(b,w,b.length-S);v&&(I=R+I,y=R+y),m!==F&&(a[p]=this.substring(a[p],v?R.length+S:S)+F),b=a[p].split(I).join(y),b=E?N+(b=-1<b.indexOf("!")?b.substring(b.lastIndexOf("!")+1):b):b.substring(b.lastIndexOf("!")+1),u=this.getValueFromArg(b),f=s?f:n[l-1].split(this.tic).join(this.emptyString)}m="equal";f.startsWith("<=")?(m="lessEq",f=f.substring(2)):f.startsWith(">=")?(m="greaterEq",f=f.substring(2)):f.startsWith("<>")?(m="notEq",f=f.substring(2)):f.startsWith("<")?(m="less",f=f.substring(1)):f.startsWith(">")?(m="greater",f=f.substring(1)):f.startsWith("=")&&(m="equal",f=f.substring(1)),(-1<(f=(g||!this.isCellReference(f)||C&&(""===b||s))&&!f.includes(this.arithMarker)?f:this.getValueFromArg(f)).indexOf("*")||-1<f.indexOf("?"))&&(u=this.findWildCardValue(f.toLowerCase(),u.toLowerCase())),c.push(u.toLowerCase()),c.push(f.toLowerCase()),this.processLogical(c,m)===this.trueValue&&(o===this.falseValue?d.push(t[p]):d.push(b))}return a=d,d=[],a},i.prototype.computeIfsFormulas=function(e,t,r){if(t===this.trueValue&&(ee.isNullOrUndefined(e)||""===e[0]||e.length<2||127<e.length||e.length%2!=0))return this.formulaErrorStrings[z.FormulasErrorsStrings.WrongNumberArguments];for(var n=e,i=[],o=[],a=[],s=0,l=0;l<n.length;l++)(-1<n[l].indexOf(":")&&this.isCellReference(n[l])?i:o).push(n[l].trim());for(var h=[],l=0;l<i.length;l++)h.push(this.getCellCollection(i[l]).length);for(var d=0;d<h.length;d++)if(h[d]&&h[d+1]&&h[d]!==h[d+1])return this.getErrorStrings()[z.CommonErrors.Value];for(var p=0;p<o.length;p++)if(""===o[p])return r===this.trueValue?this.getErrorStrings()[z.CommonErrors.DivZero]:0;if(t===this.falseValue){var c,u=this.falseValue,f={cellValue:c=this.getCellCollection(i[1]),cellRange:i,criteria:o,argArray:n,isCriteria:u,storedCells:a,isCountIfS:t};if(0===(a=this.computeStoreCells(f)).length)return r===this.trueValue?this.getErrorStrings()[z.CommonErrors.DivZero]:0}for(l=t===this.trueValue?0:2;l<i.length;l++){u=this.trueValue,u=t===this.trueValue&&0===l?this.falseValue:this.trueValue;f={cellValue:c=this.getCellCollection(i[l]),cellRange:i,criteria:o,argArray:n,isCriteria:u,storedCells:a,isCountIfS:t,countVal:l};if(0===(a=this.computeStoreCells(f)).length)return r===this.trueValue?this.getErrorStrings()[z.CommonErrors.DivZero]:0}for(var g=0,m=-1<i[0].indexOf("!")?te(i[0].substring(i[0].lastIndexOf("!")+1)):te(i[0]),e=i[i.length-1],v=-1<e.indexOf("!")?te(e.substring(e.lastIndexOf("!")+1)):te(e),d=0;d<a.length;d++){var y="",C="",b=0,x=0,S=-1<(y=a[d]).indexOf("!"),w=void 0,I="",E="";for(S&&(E=y.substring(0,y.lastIndexOf("!")+1),y=y.substring(y.lastIndexOf("!")+1));!this.isDigit(y[b]);)b+=1;if(this.isCellReference(i[0])&&-1<i[0].indexOf(":"))for(C=G(m[0]+(W(y)[0]-v[0]),m[1]+(W(y)[1]-v[1])),(w=-1<i[0].indexOf("!"))&&(I=i[0].substring(0,i[0].lastIndexOf("!")+1));!this.isDigit(C[x]);)x+=1;var N=this.substring(y,b),R=this.substring(C,x),F=this.substring(y,b,y.length-b),k=this.substring(C,x,C.length-b);S&&(N=E+N,R=E+R),F!==k&&(a[d]=this.substring(a[d],S?E.length+b:b)+k),c=a[d].split(N).join(R),c=w?I+(c=-1<c.indexOf("!")?c.substring(c.lastIndexOf("!")+1):c):c.substring(c.lastIndexOf("!")+1),t===this.trueValue?s+=1:(F=this.getValueFromArg(c),S=parseFloat(""===F&&r!==this.trueValue?"0":F),this.isNumber(S)&&(g++,s+=S))}return r===this.trueValue&&(s/=g),s},i.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)},i.prototype.isNaN=function(e){return"NaN"===e.toString()||"string"==typeof e},i.prototype.isNumber=function(e){return 0<=e-parseFloat(e)},i.prototype.fromOADate=function(e){60<(e=0<e&&e<1?1+e:0===e?1:e)&&--e;var t=new Date("01/01/1900"),t=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+t).toUTCString().replace(" GMT",""))},i.prototype.getSerialDateFromDate=function(e,t,r){for(var n=0,i=(e<1900&&(e+=1900),!1);!i;){for(;12<t;)e++,t-=12;for(;t<1;)t+=12,e--;for(var i=!0,o=new Date(e,t,1,-1).getDate();o<r;)o=new Date(e,t,1,-1).getDate(),t++,r-=o,i=!1;r<1&&(--t<1&&(t=12,e--),r=(o=new Date(e,t,1,-1).getDate())+r,i=!1)}var a=Date.parse(e+"/"+t+"/"+r);return n=this.isNaN(a)?n:this.toOADate(new Date(a))},i.prototype.intToTime=function(e){var t=e.toString().split(".");return ee.isNullOrUndefined(t[1])||(e=parseFloat(t[0]+1+"."+t[1])||e),this.intToDate(e.toString())},i.prototype.toOADate=function(e,t,r){var n=new Date("01/01/1900"),e=ai(e)?e:new Date(e),n=Date.UTC(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds()),e=(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())-n)/864e5;return(t?e:parseInt(e.toString(),10))+(r?0:60<e?2:1)},i.prototype.calculateDate=function(e){return this.parseFloat(e)<10?"0"+e:e},i.prototype.isTextEmpty=function(e){return null===e||""===e},i.prototype.isDigit=function(e){e=e.charCodeAt(0);return 47<e&&e<58},i.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},i.prototype.getValueFromArg=function(t,e,r,n){if(!(t=t.trim())||-1<this.getErrorStrings().indexOf(t))return t;var i=t[0];if(i===this.tic||i===this.singleTic){var o=t.split(this.tic).join("");if(this.isNaN(this.parseFloat(o))){var a=this.isDate(o);if(a&&!this.isNaN(a.getDate()))return this.toOADate(a,!0).toString()}return t=t.endsWith(this.tic)&&"."!==(s=this.getParseDecimalSeparator())&&o.includes(s)&&(o=o.replace(s,"."),this.isNumber(o))?o:t}if(!this.isUpperChar(i)){var s=this.getParseDecimalSeparator();if(this.isDigit(i)||i===s||"-"===i||"n"===i)return"n"===i&&-1<(t=t.substring(1)).indexOf('"n')&&(t=t.replace('"n','"')),t="."!==s&&t.includes(s)&&(o=t.replace(s,"."),this.isNumber(o))?o:t}a=i===this.sheetToken;if(a||this.isUpperChar(i)&&!["+","-","/","*",")",")","{"].some(function(e){return t.includes(e)})){s=this.isCellReference(t);if((t=s&&!a&&null!==(o=this.getSheetFamilyItem(this.grid)).sheetNameToParentObject&&o.parentObjectToToken.has(this.grid)?o.parentObjectToToken.get(this.grid)+t:t)===this.cell){i=this.getDependentCells().get(t);if(null!=i&&-1<i.indexOf(t)&&this.arrayRemove(i,t),this.getDependentFormulaCells().has(this.cell)||this.clearFormulaDependentCells(this.cell),!e)throw new Nl(this.formulaErrorStrings[z.FormulasErrorsStrings.CircularReference])}a=this.getParentObjectCellValue(t,!1,e,n).toString();return s&&this.updateDependentCell(t),a}return this.computeValue(t,!1,r)},i.prototype.isDate=function(e){var t;return("object"==typeof e||null!==Date.parse(e))&&(t=void 0,(t="string"==typeof e?this.checkDateFormat(e):new Date(Date.parse(e)))>=this.dateTime1900)?t:null},i.prototype.isValidCellReference=function(e){var t=0,r=0,n=[89,71,69],i=this.emptyString;if(!this.namedRanges.has(e)){for(var o=0;o<e.length;o++)this.isChar(e[o])&&t++;if((i=e.substring(0,t)).length<4){for(;r<i.length;){if(ee.isNullOrUndefined(i[r])||!(i[r].charCodeAt(0)<n[r])){if(ee.isNullOrUndefined(i[r])&&0<r)break;return!1}r++}if(this.parseFloat(e.substring(t,e.length))<1048576)return!0}}return!1},i.prototype.parseDate=function(e){return this.isNaN(e)?"string"!=typeof e||(e=this.checkDateFormat(e,!0),this.isNaN(e))?this.getErrorStrings()[z.CommonErrors.Value]:e:e instanceof Date?new Date(e):(e=parseInt(e,10))<0?this.getErrorStrings()[z.CommonErrors.Num]:e<=60?new Date(this.dateTime1900.getTime()+864e5*(e-1)):new Date(this.dateTime1900.getTime()+864e5*(e-2))},i.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))},i.prototype.isCellReference=function(e){if((e=e.trim())===this.emptyString)return!1;e=this.setTokensForSheets(e);var t=this.getSheetToken(e),r=!1,n=!1,i=!1;if((e=""!==t?e.split(t).join(this.emptyString):e).indexOf(":")!==e.lastIndexOf(":"))return!1;for(var o=e.split("").join(this.getParseArgumentSeparator()).split(this.getParseArgumentSeparator()),a=0;a<o.length;a++)if(this.isChar(o[a]))n=!0;else if(this.isDigit(o[a]))i=!0;else{if(":"!==o[a])return!1;n&&i&&(r=!0),i=n=!1}return-1<e.indexOf(":")&&-1===e.indexOf(this.tic)?!!(r&&n&&i)||!(!(n&&!i||!n&&i)||r):!!(n&&i&&-1===e.indexOf(this.tic)&&this.isValidCell(e))},i.prototype.setTokensForSheets=function(e){var t,r=this.getSheetFamilyItem(this.grid),n=this.getSortedSheetNames();if(null!=n)for(var i=0;i<n.length;i++){var o=(o=r.sheetNameToToken.get(n[i])).split(this.sheetToken).join(this.tempSheetPlaceHolder),a=this.singleTic+"SHEET"+n[i]+this.singleTic+this.sheetToken;-1===e.indexOf(a)&&(a="SHEET"+n[i]+this.sheetToken),e=e.split(a).join(o),a=n[i]+this.sheetToken,e=e.split(a).join(o)}return-1<(e=e.split(this.tempSheetPlaceHolder).join(this.sheetToken)).indexOf("!!")&&((t=(e=e.replace("!!","!")).split("!"))[1]=(parseInt(t[1],10)+1).toString(),e=t.join("!")),e},i.prototype.getParentObjectCellValue=function(e,t,r,n){if(e===this.trueValue||e===this.falseValue)return e;var i=e.lastIndexOf(this.sheetToken),o=this.grid;if(-1<i){if(null===(l=this.getSheetFamilyItem(o)).tokenToParentObject)return this.getErrorStrings()[z.CommonErrors.Value];this.grid=l.tokenToParentObject.get(e.substring(0,i+1)),s=e.substring(i+1)}else{for(var a=0;a<e.length&&this.isChar(e[a]);)a++;if(a===e.length)return""===e?this.getErrorStrings()[z.CommonErrors.Value]:this.getErrorStrings()[z.CommonErrors.Name];var s=e;(l=this.getSheetFamilyItem(o)).isSheetMember&&null!=l.parentObjectToToken&&(e=l.parentObjectToToken.get(this.grid)+e)}this.isDigit(s[0])&&0<(i=s.search(/[a-zA-Z]/))&&(s=s.substring(i,s.length)+s.substring(0,i));var l=this.rowIndex(s),i=this.colIndex(s);if(0<l&&l<=1048576&&0<i&&i<=16384){s=this.getSheetId(this.grid);if(this.parentObject.notify){var h={action:"getSheetInfo",sheetInfo:[]};if(this.parentObject.notify(ie,h),-1===Ni(this.parentObject,"Sheet"+s,h.sheetInfo))return this.grid=o,this.getErrorStrings()[z.CommonErrors.Ref]}h=this.getCellValueFn(o,this.cell,s,!1,t,r,n)(l,i,e)}else h=this.getErrorStrings()[z.CommonErrors.Name];return this.grid=o,h},i.prototype.getCellValueFn=function(e,n,i,o,a,s,l){var h=this,d=(d=n)&&(e===this.grid?"":d+","+("string"==typeof e&&-1<Number(e)?e:this.getSheetID(e))),p=this.parentObject.getValueRowCol.bind(this.parentObject)||this.getValueRowCol.bind(this);return function(e,t,r){if(n===r&&!s)throw h.formulaErrorStrings[z.FormulasErrorsStrings.CircularReference];h.cell=r;e=p(i,e,t,d,a,s,l);return ee.isNullOrUndefined(e)?e=h.emptyString:(e=e.toString(),"."!==(t=h.getParseDecimalSeparator())&&e.includes(t)&&(t=e.replace(t,"."),h.isNumber(t))&&(e=t)),h.cell=n,o&&h.updateDependentCell(r),e}},i.prototype.isValidCell=function(e){0===e.search(/\d/)&&(t=e.search(/[a-zA-Z]/),e=e.substring(t,e.length)+e.substring(0,t));var t=this.rowIndex(e),e=this.colIndex(e);return 0<t&&t<=1048576&&0<e&&e<=16384},i.prototype.getSheetId=function(e){return e&&"string"==typeof e&&-1<Number(e)?Number(e):this.getSheetID(e)+1},i.prototype.getValueRowCol=function(e,t,r){var n,t=this.rowsToKeyMap.get(t).toString(),t=this.getKeyValue(t).toString();return t=null!=t&&"%"===t[t.length-1]&&1<t.length&&(n=this.parseFloat(t.substring(0,t.length-1)),this.isNaN(n))?(Number(n)/100).toString():t},i.prototype.defineFunction=function(e,t,r){"string"==typeof t&&(t=ee.getValue(t,window)),e=e.toUpperCase(),this.libraryFormulas.set(e,{handler:t,isCustom:!0,description:r})},i.prototype.valueChanged=function(t,e,r,n,i,o,a,s,l,h,d,p){var c=t,n=(this.spreadSheetUsedRange=n,this.grid=t,!0),t=!0,u=this.getSheetFamilyItem(c),f=Ol(e.getColIndex())+e.getRowIndex().toString(),o=(this.actCell=o+"!"+f,null!==u.sheetNameToParentObject&&0<u.sheetNameToParentObject.size&&(f=u.parentObjectToToken.get(c)+f),e.getValue().toUpperCase());if((-1<o.indexOf("=RAND()")||-1<o.indexOf("=NOW()")||-1<o.indexOf("NOW()")||-1<o.indexOf("RAND()")||-1<o.indexOf("=RANDBETWEEN(")||-1<o.indexOf("RANDBETWEEN(")||this.randomValues.has(f))&&(u=this.randCollection.toString(),this.randomValues.has(f)?this.randomValues.has(f)&&(-1<o.indexOf("=RAND()")||-1<o.indexOf("=NOW()")||-1<o.indexOf("NOW()")||-1<o.indexOf("RAND()")||-1<o.indexOf("=RANDBETWEEN(")||-1<o.indexOf("RANDBETWEEN(")?this.randomValues.set(f,e.getValue()):e.getValue().toUpperCase()!==this.randomValues.get(f.toUpperCase())&&(this.randomValues.delete(f),u=u.split(f+this.parseArgumentSeparator).join("").split(this.parseArgumentSeparator+f).join("").split(f).join(""),this.randCollection=u.split(this.parseArgumentSeparator)),0===this.randomValues.size)&&this.randCollection.length&&(this.isRandomVal=!1,this.randomValues.clear(),this.randCollection=[]):(this.randomValues.set(f,e.getValue()),this.randCollection.push(f),this.isRandomVal=!0)),e.getValue()&&e.getValue()[0]===this.getFormulaCharacter()){this.cell=f;var g,o=void 0;if(ee.isNullOrUndefined(t)||(t=r),this.getFormulaInfoTable().has(f)){if(o=this.getFormulaInfoTable().get(f),e.getValue()!==o.getFormulaText()||null==o.getParsedFormula()){o.setFormulaText(e.getValue()),this.getDependentFormulaCells().has(this.cell)&&this.clearFormulaDependentCells(this.cell);try{o.setParsedFormula(this.parser.parseFormula(e.getValue()))}catch(e){o.setFormulaValue(e),t=!1}}else this.parser.isError=!1;t&&(this.parser.isFormulaParsed=!0,n=(g=this.calculateFormula(o.getParsedFormula(),i))!==o.getFormulaValue()&&(!this.parentObject.isEdit||g!==this.formulaErrorStrings[z.FormulasErrorsStrings.CircularReference]),o.setFormulaValue(g))}else{(o=new Rl).setFormulaText(e.getValue()),this.getDependentFormulaCells().has(f)||this.getDependentFormulaCells().set(f,new Map),this.getFormulaInfoTable().set(f,o);try{o.setParsedFormula(this.parser.parseFormula(e.getValue()))}catch(e){o.setFormulaValue(e),t=!1}t&&(n=(g=this.calculateFormula(o.getParsedFormula(),i))!==this.formulaErrorStrings[z.FormulasErrorsStrings.CircularReference],o.setFormulaValue(g))}t&&(void 0===this.parentObject.setValueRowCol?this.setValueRowCol(this.getSheetID(c)+1,o.getFormulaValue(),e.getRowIndex(),e.getColIndex()):this.parentObject.setValueRowCol(this.getSheetId(c),o.getFormulaValue(),e.getRowIndex(),e.getColIndex(),o.getFormulaText(),a))}else this.getFormulaInfoTable().has(f)&&(this.getFormulaInfoTable().delete(f),this.getDependentFormulaCells().has(f))&&this.clearFormulaDependentCells(f);t&&n&&this.getDependentCells().has(f)&&("Automatic"===this.parentObject.calculationMode||!this.parentObject.isEdit||d)&&this.getDependentCells().get(f).toString()!==f&&this.refresh(f,void 0,void 0,s,l,h,d,p)},i.prototype.setValueRowCol=function(e,t,r,n){},i.prototype.getSortedSheetNames=function(){var r,e=this.getSheetFamilyItem(this.grid);return null!=e&&null!=e.sheetNameToToken&&(r=[],e.sheetNameToToken.forEach(function(e,t){r.push(t),r.sort()}),this.sortedSheetNames=r,this.sortedSheetNames.sort(),9<this.sortedSheetNames.length)&&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)),this.sortedSheetNames},i.prototype.getErrorLine=function(e){e=e.stack?e.stack.split("\n")[1].split(":"):null;return e?e[e.length-2]:null},i.prototype.createSheetFamilyID=function(){return this.sheetFamilyID===Number.MAX_SAFE_INTEGER&&(this.sheetFamilyID=Number.MIN_SAFE_INTEGER),this.sheetFamilyID++},i.prototype.computeMinMax=function(e,t){var r=!1;if(e.length&&"isSubtotal"===e[e.length-1]&&(r=!0,e.pop()),ee.isNullOrUndefined(e)||0===e.length)return this.formulaErrorStrings[z.FormulasErrorsStrings.WrongNumberArguments];for(var n="max"===t?this.minValue:this.maxValue,i=0,o=e.length;i<o;i++)e[i].split(this.tic).join("").trim()===this.emptyString&&(n=0);var a=e;if(255<a.length)return this.getErrorStrings()[z.CommonErrors.Value];for(var s=0;s<a.length;s++)if(-1<a[s].indexOf(":")&&this.isCellReference(a[s]))for(var l=this.getCellCollection(a[s]),h=0;h<l.length;h++){var d=r?this.getValueFromArg(l[h],null,null,!0):this.getValueFromArg(l[h]);r&&d.includes("SUBTOTAL(")||(c=this.parseFloat(d),""===d)||this.isNaN(this.parseFloat(c))||-1<this.getErrorStrings().indexOf(d)||(n="max"===t?Math.max(n,c):Math.min(n,c))}else{var p=r?this.getValueFromArg(a[s],null,null,!0):this.getValueFromArg(a[s]);if(!r||!p.includes("SUBTOTAL(")){var c=0,u=this.isCellReference(a[s]),f=""===p&&u,g=this.isNaN(this.parseFloat(p))&&u,u=p===(this.trueValue||this.falseValue)&&u;if(a[s]=a[s].startsWith("n")?a[s].slice(1):a[s],-1<this.getErrorStrings().indexOf(p))return p;if(p===this.trueValue&&a[s]===this.trueValue)p="1";else if(p===this.falseValue&&a[s]===this.falseValue)p="0";else if(f||g||u)continue;if(-1<p.indexOf('"')&&(p=p.split(this.tic).join("")),this.isNaN(this.parseFloat(p)))return this.getErrorStrings()[z.CommonErrors.Value];c=this.parseFloat(p),n="max"===t?Math.max(n,c):Math.min(n,c)}}return(n=n!==this.minValue&&n!==this.maxValue?n:0).toString()},i.prototype.calculateAvg=function(e,t){for(var r,n,i=e,o=0,a=0,s=0;s<i.length;s++)if(this.isCellReference(i[s])){if(-1<i[s].indexOf(":")){for(var l=this.getCellCollection(i[s]),h=0;h<l.length;h++)if(r=t?this.getValueFromArg(l[h],null,null,!0):this.getValueFromArg(l[h]),!t||!r.includes("SUBTOTAL(")){if(-1<this.getErrorStrings().indexOf(r))return r;ee.isNullOrUndefined(r)||isNaN(this.parseFloat(r))||""===r||(o+=this.parseFloat(r),a+=1)}}else if(r=t?this.getValueFromArg(i[s],null,null,!0):this.getValueFromArg(i[s]),!t||!r.includes("SUBTOTAL(")){if(-1<this.getErrorStrings().indexOf(r))return r;ee.isNullOrUndefined(r)||isNaN(this.parseFloat(r))||""===r||(o+=this.parseFloat(r),a+=1)}}else{if(-1<i[s].indexOf(this.tic)&&(isNaN(this.parseFloat(i[s].split(this.tic).join("")))||""===i[s].split(this.tic).join("").trim()))return this.getErrorStrings()[z.CommonErrors.Value];if(0!==i[s].length&&e[s]!==this.falseValue||(i[s]="0"),e[s]===this.trueValue&&(i[s]="1"),n=this.getValueFromArg(i[s].split(this.tic).join("")),-1<this.getErrorStrings().indexOf(n))return n;o+=this.parseFloat(n),a+=1}return 0===a?this.getErrorStrings()[z.CommonErrors.DivZero]:(o/a).toString()},i.prototype.registerGridAsSheet=function(e,t,r){ee.isNullOrUndefined(this.modelToSheetID)&&(this.modelToSheetID=new Map),ee.isNullOrUndefined(this.modelToSheetID.get(t))&&this.modelToSheetID.set(t,r);var n,r=this.getSheetFamilyItem(t),i=(r.isSheetMember=!0,e.toUpperCase());return 0===r.parentObjectToToken.size&&(r.parentObjectToToken=new Map),0===r.sheetNameToParentObject.size&&(r.sheetNameToParentObject=new Map),0===r.sheetNameToToken.size&&(r.sheetNameToToken=new Map),0===r.tokenToParentObject.size&&(r.tokenToParentObject=new Map),ee.isUndefined(r.sheetNameToParentObject.get(i))?(n=this.sheetToken+this.tokenCount.toString()+this.sheetToken,this.tokenCount++,r.tokenToParentObject.set(n,t),r.parentObjectToToken.set(t,n),r.sheetNameToToken.set(i,n),r.sheetNameToParentObject.set(i,t)):(n=r.sheetNameToToken.get(i),r.tokenToParentObject.set(n,t),r.parentObjectToToken.set(t,n)),e},i.prototype.unregisterGridAsSheet=function(i,e,o){var a=this,r=[e];o&&(r=[],ee.isNullOrUndefined(this.modelToSheetID)||this.modelToSheetID.forEach(function(e,t){r.push(t)})),r.forEach(function(e){var t,r=a.getSheetFamilyItem(e),n=(o?e:i).toUpperCase();null!=r.sheetNameToParentObject&&r.sheetNameToParentObject.has(n)&&(r.sheetNameToParentObject.delete(n),t=r.sheetNameToToken.get(n),r.sheetNameToToken.delete(n),r.tokenToParentObject.delete(t),r.parentObjectToToken.delete(e))})},i.prototype.computeExpression=function(e,t){e=this.parser.parseFormula(e);return this.computeFormula(e,t)},i.prototype.isSheetMember=function(){var e=this.getSheetFamilyItem(this.grid);return!ee.isNullOrUndefined(e)&&e.isSheetMember},i.prototype.dispose=function(){this.resetKeys(),this.namedRanges.clear(),this.lFormulas.clear()},i.prototype.refreshRandValues=function(e){var t,r,n,i;this.randomValues.has(e)&&(this.randomValues.delete(e),-1<(e=this.randCollection.indexOf(e))&&this.randCollection.splice(e,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]),n=(parseFloat(this.getSheetToken(this.randCollection[o]).split(this.sheetToken).join(""))+1).toString(),i=this.getSheetFamilyItem(n),this.grid=i.sheetNameToParentObject.get(n),i=this.randomValues.get(this.randCollection[o]),i=this.computeFormula(i),void 0===this.parentObject.setValueRowCol?this.setValueRowCol(this.getSheetID(this.grid)+1,i,t,r):this.parentObject.setValueRowCol(this.getSheetId(this.grid),i,t,r)},i.prototype.refresh=function(e,t,r,a,n,i,o,s){var l,h=this,d=(r||(l=!0,r=[]),this.getSheetFamilyItem(this.grid));try{var p=this.getDependentCells().get(e);if(p&&0!==p.length&&("Automatic"===this.parentObject.calculationMode||o||"calculate"===s))for(var c=void 0,c=0;c<p.length;c++){var u=p[c];if(!(t&&-1<u.indexOf(t)||u===e||-1<r.indexOf(u))){var f=this.getSheetToken(u),g=this.parentObject.sheets,m=this.parentObject.activeSheetIndex;if(f.length){this.grid=d.tokenToParentObject.get(f);var v=Number(this.grid),y="";if(!this.isNaN(v)&&g)for(var C=0;C<g.length;C++)g[C].id===v&&(y=g[C].name,m=C);this.actCell=y+"!"+u.split(f)[1]}else this.actCell=u.split(f)[1];try{var b=function(e,t){t&&(h.cell=e,h.parser.isFormulaParsed=!0,t.setFormulaValue(h.calculateFormula(t.getParsedFormula(),!0)))},x=this.rowIndex(u),S=this.colIndex(u),w=this.getFormulaInfoTable().get(u);if(void 0===this.parentObject.setValueRowCol)b(u,w),this.setValueRowCol(this.getSheetID(this.grid)+1,w.getFormulaValue(),x,S);else{var I=g&&g[m].rows&&g[m].rows[x-1]&&g[m].rows[x-1].cells&&g[m].rows[x-1].cells[S-1],E=void 0;if(I&&I.formula&&I.formula.toLowerCase().includes("unique")){if(this.uniqueCells&&-1!==this.uniqueCells.indexOf(u))continue;this.uniqueCells||(this.uniqueCells=[]),this.uniqueCells.push(u),b(u,w),E=w.getFormulaValue(),this.uniqueCells.splice(this.uniqueCells.indexOf(u),1),this.uniqueCells.length||(this.uniqueCells=null)}else-1===r.indexOf(u)&&r.push(u),E=null;this.parentObject.setValueRowCol(this.getSheetId(this.grid),E,x,S,w.getFormulaText())}this.refresh(u,null,r,null,n)}catch(e){continue}}}if(l){if(!n&&i&&4===i.length){for(var f=this.getSheetToken(e),N=[],R=i[0],F=i[2];R<=F;R++)for(var k=i[1],O=i[3];k<=O&&(R!==F||k!==O);k++){I=f+G(R,k);this.refresh(I,null,r,null,n),N.push(I)}var A=new Set(N);r=r&&r.filter(function(e){return!A.has(e)})}var T=this.parentObject.sheets;(r=T?r:[]).forEach(function(e){for(var t,r=h.getSheetId(d.tokenToParentObject.get(h.getSheetToken(e))),n=0;n<T.length;n++)if(T[n].id===r){t=n;break}var i=h.rowIndex(e)-1,e=h.colIndex(e)-1,o=T[t].rows[i]&&T[t].rows[i].cells[e];o&&h.parentObject.notify("calculateFormula",{cell:o,rowIdx:i,colIdx:e,sheetIndex:t,isDependentRefresh:!0,isRandomFormula:a,action:s})})}}finally{this.getDependentCells().has(e)&&(this.grid=d.tokenToParentObject.get(this.getSheetToken(e)))}},n([ee.Property(!0)],i.prototype,"includeBasicFormulas",void 0),n([ee.Event()],i.prototype,"onFailure",void 0),wl=n([ee.NotifyPropertyChanges],i));function i(e){var t=Sl.call(this,null,null)||this,r=(t.lFormulas=new Map,t.storedData=new Map,t.keyToRowsMap=new Map,t.rowsToKeyMap=new Map,t.rightBracket=String.fromCharCode(161),t.leftBracket=String.fromCharCode(162),t.sheetToken="!",t.emptyString="",t.leftBrace="{",t.rightBrace="}",t.cell=t.emptyString,t.cellPrefix="!0!A",t.treatEmptyStringAsZero=!1,t.tic='"',t.singleTic="'",t.trueValue="TRUE",t.falseValue="FALSE",t.parseDecimalSeparator=".",t.arithMarker=String.fromCharCode(180),t.arithMarker2=t.arithMarker+t.arithMarker,t.dependentCells=null,t.dependentFormulaCells=null,t.minValue=Number.MIN_SAFE_INTEGER,t.maxValue=Number.MAX_SAFE_INTEGER,t.categoryCollection=["All"],t.dependencyLevel=0,t.randomValues=new Map,t.isRandomVal=!1,t.randCollection=[],t.dependencyCollection=[],t.uniqueRange=[],t.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!"],t.errorStrings=null,t.parseArgumentSeparator=",",t.dateTime1900=new Date(1900,0,1,0,0,0),t.isParseDecimalSeparatorChanged=!1,t.isArgumentSeparatorChanged=!1,t.sheetFamilyID=0,t.defaultFamilyItem=null,t.sheetFamiliesList=null,t.modelToSheetID=null,t.tokenCount=0,t.sortedSheetNames=null,t.tempSheetPlaceHolder=String.fromCharCode(133),t.namedRanges=new Map,t.formulaInfoTable=null,t.oaDate=new Date(1899,11,30),t.millisecondsOfaDay=864e5,t.parseDateTimeSeparator="/",new ml(t));return t.includeBasicFormulas&&wl.Inject(yl),t.injectedModules&&t.injectedModules.length&&r.inject(t.requiredModules(),t.injectedModules),t.parentObject=ee.isNullOrUndefined(e)?t:e,t.grid=t.parentObject,t.parser=new Cl(t),t}var Nl=function(e,t){this.formulaCorrection=!1,this.message=e,this.formulaCorrection=t},Rl=(Fl.prototype.getFormulaText=function(){return this.formulaText},Fl.prototype.setFormulaText=function(e){this.formulaText=e},Fl.prototype.getFormulaValue=function(){return this.formulaValue},Fl.prototype.setFormulaValue=function(e){this.formulaValue=e},Fl.prototype.getParsedFormula=function(){return this.parsedFormula},Fl.prototype.setParsedFormula=function(e){this.parsedFormula=e},Fl);function Fl(){this.calcID=Number.MIN_VALUE+1,this.calcID1=Number.MIN_VALUE+1}var kl=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 Ol(e){for(var t=[],r=0;0<e&&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=[],o=0;o<r;o++)i[r-o-1]=t[o];return i.join("")}var Al=function(t,r,e){return this.row=t,this.col=r,this.value=e,this.getRowIndex=function(){return t},this.setRowIndex=function(e){t=e},this.getColIndex=function(){return r},this.setColIndex=function(e){r=e},this.getValue=function(){return e},this},Tl=(o.prototype.init=function(){var r=this;this.addEventListener(),this.initCalculate(),this.registerSheet(),this.parent.customFormulaCollection.forEach(function(e,t){r.addCustomFunction(e.handler,t,e.description)})},o.prototype.destroy=function(){var r=this;this.removeEventListener(),this.parent.refreshing&&(this.clearAllUniqueFormulaValue(),this.calculateInstance.getLibraryFormulas().forEach(function(e,t){e.isCustom&&r.parent.customFormulaCollection.set(t,{handler:e.handler,description:e.description})})),this.calculateInstance.dispose(),this.calculateInstance=null,this.sheetInfo&&(this.sheetInfo=[]),this.parent=null},o.prototype.addEventListener=function(){this.parent.on(ie,this.performFormulaOperation,this),this.parent.on(Vt,this.aggregateComputation,this),this.parent.on(jt,this.getUniqueRange,this),this.parent.on(zt,this.removeUniquecol,this),this.parent.on(Wt,this.clearFormulaDependentCells,this),this.parent.on(Gt,this.formulaInValidation,this),this.parent.on(pn,this.refreshInsertDelete,this),this.parent.on(cn,this.getUpdatedFormulaOnInsertDelete,this),this.parent.on(mn,this.autoCorrectCellRef,this),this.parent.on(vn,this.parseFormulaArgument,this),this.parent.on(yn,this.getCellRefValue,this),this.parent.on(Cn,this.commputeFormulaValue,this)},o.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(ie,this.performFormulaOperation),this.parent.off(Vt,this.aggregateComputation),this.parent.off(jt,this.getUniqueRange),this.parent.off(zt,this.removeUniquecol),this.parent.off(Wt,this.clearFormulaDependentCells),this.parent.off(Gt,this.formulaInValidation),this.parent.off(pn,this.refreshInsertDelete),this.parent.off(cn,this.getUpdatedFormulaOnInsertDelete),this.parent.off(mn,this.autoCorrectCellRef),this.parent.off(vn,this.parseFormulaArgument),this.parent.off(yn,this.getCellRefValue),this.parent.off(Cn,this.commputeFormulaValue))},o.prototype.getModuleName=function(){return"workbookFormula"},o.prototype.initCalculate=function(){this.calculateInstance=new El(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 e=ee.getNumericObject(this.parent.locale).decimal;"."!==e&&this.parent.listSeparator!==e&&this.calculateInstance.setParseDecimalSeparator(e)},o.prototype.clearFormulaDependentCells=function(e){var t,r,n;e.isOpen?(this.calculateInstance.getDependentCells().clear(),this.calculateInstance.getFormulaInfoTable().clear(),this.calculateInstance.getDependentFormulaCells().clear()):(t=e.cellRef.split(":")[0],r=this.parent.getActiveSheet().id.toString(),(n=this.calculateInstance.getSheetFamilyItem(r)).isSheetMember&&!ee.isNullOrUndefined(n.parentObjectToToken)&&(t=n.parentObjectToToken.get(r)+t),e.clearFormulaInfo&&this.calculateInstance.getFormulaInfoTable().has(t)&&this.calculateInstance.getFormulaInfoTable().delete(t),this.calculateInstance.clearFormulaDependentCells(t))},o.prototype.formulaInValidation=function(e){var t=this.calculateInstance.getLibraryFormulas().get(e.value);e.skip=ee.isNullOrUndefined(t)},o.prototype.performFormulaOperation=function(e){var t,r,n=e.action,i=("refreshCalculate"!==n&&(t=this.calculateInstance.getLibraryFormulas(),r=Array.from(t.values())),this.calculateInstance.getSheetFamilyItem(e.sheetId));switch(n){case"getLibraryFormulas":e.formulaCollection=Array.from(t.keys());break;case"getFormulaCategory":for(var o=["All"],a=1;a<Array.from(t.values()).length;a++)o.indexOf(r[a].category)<0&&o.push(r[a].category);e.categoryCollection=o;break;case"dropDownSelectFormulas":for(a=0;a<Array.from(t.values()).length;a++)e.selectCategory===r[a].category&&(e.formulaCollection[a]=Array.from(t.keys())[a]);break;case"getFormulaDescription":for(a=0;a<Array.from(t.values()).length;a++)e.selectedList===Array.from(t.keys())[a]&&(e.description=r[a].description,e.isCustom=r[a].isCustom);break;case"registerSheet":this.registerSheet(e.sheetIndex,e.sheetCount),e.isImport&&(this.calculateInstance.setParseArgumentSeparator(this.parent.listSeparator),this.updateSheetInfo());break;case"unRegisterSheet":this.unRegisterSheet(e.sheetIndex,e.sheetCount,e.propertyChange);break;case"initSheetInfo":this.updateSheetInfo();break;case"refreshCalculate":this.refreshCalculate(e);break;case"refreshRandomFormula":this.refreshRandomFormula(),this.calculateInstance.cell="";break;case"setArgumentSeparator":this.calculateInstance.setParseArgumentSeparator(this.parent.listSeparator);break;case"addDefinedName":e.isAdded=this.addDefinedName(e.definedName,!1,e.index,e.isEventTrigger);break;case"removeDefinedName":e.isRemoved=this.removeDefinedName(e.definedName,e.scope,e.isEventTrigger);break;case"initiateDefinedNames":this.initiateDefinedNames();break;case"renameUpdation":this.renameUpdation(e.value,e.pName);break;case"addSheet":this.sheetInfo.push({visibleName:e.visibleName,sheet:e.sheetName,index:e.sheetId});break;case"getSheetInfo":e.sheetInfo=this.sheetInfo;break;case"deleteSheetTab":for(a=0;a<this.sheetInfo.length;a++)if(this.sheetInfo[a].index===e.sheetId){var s=this.sheetInfo[a].visibleName,l=this.sheetInfo[a].sheet,h=(this.sheetInfo.splice(a,1),e.sheetId.toString());this.sheetDeletion(l,h),this.calculateInstance.unregisterGridAsSheet(h,h),this.definedNamesDeletion(s);break}break;case"getReferenceError":e.refError=this.referenceError();break;case"getAlpha":e.col=Ol(e.col);break;case"addCustomFunction":this.addCustomFunction(e.functionHandler,e.functionName,e.formulaDescription);break;case"computeExpression":e.calcValue=this.calculateInstance.computeExpression(e.formula,e.isFromComputeExpression);break;case"registerGridInCalc":this.calculateInstance.grid=e.sheetID;break;case"dependentCellsAvailable":case"checkFormulaAdded":i.isSheetMember&&!ee.isNullOrUndefined(i.parentObjectToToken)&&(e.address=i.parentObjectToToken.get(e.sheetId)+e.address),"checkFormulaAdded"===n?e.added=this.calculateInstance.getFormulaInfoTable().has(e.address):e.isAvailable=this.calculateInstance.getDependentCells().has(e.address);break;case"calculateNow":this.calculateNow(e);break;case"ClearDependentCellCollection":this.calculateInstance.getDependentFormulaCells().clear(),this.calculateInstance.getDependentCells().clear(),this.calculateInstance.getFormulaInfoTable().clear()}},o.prototype.definedNamesDeletion=function(e){var t=this.parent.definedNames;if(t&&0<t.length)for(var r=t.length-1;0<=r;r--)t[r].refersTo.substring(1,t[r].refersTo.lastIndexOf("!")).split("'").join("")===e&&this.removeDefinedName(t[r].name,t[r].scope)},o.prototype.referenceError=function(){return this.calculateInstance.getErrorStrings()[z.CommonErrors.Ref]},o.prototype.getSheetInfo=function(){return this.sheetInfo},o.prototype.addCustomFunction=function(e,t,r){this.calculateInstance.defineFunction(t,e,r)},o.prototype.updateSheetInfo=function(){var t=this;this.sheetInfo=[],this.parent.sheets.forEach(function(e){t.sheetInfo.push({visibleName:e.name,sheet:"Sheet"+e.id,index:e.id})})},o.prototype.getSheetRefUpdateOnDelete=function(){var o,a,s,l=this,e=this.calculateInstance.namedRanges;return e&&e.size&&(s=!0,o=Array.from(e.keys()),a=Array.from(e.values())),function(e,t){s&&!t.includes(e)&&(t=t.replace(/\w+/g,function(e){var t=o.indexOf(e);return-1!==t?(r=!0,a[t]):e}));for(var r,n=e.toUpperCase(),i=(t=t.toUpperCase()).indexOf(n);-1<i;)i=(t=t.split(("'"===t[i-1]&&"'"===t[i+n.length]?"'"+n+"'":n)+l.calculateInstance.sheetToken).join(l.referenceError())).indexOf(n);return{value:t,isNamedRange:r}}},o.prototype.sheetDeletion=function(r,n){var i,o,a,s=this,e=this.calculateInstance.getDependentCells(),l=this.calculateInstance.getSheetFamilyItem(n),h=this.getSheetRefUpdateOnDelete();e.forEach(function(e,t){e.forEach(function(e){i=s.calculateInstance.getFormulaInfoTable().get(e),ee.isNullOrUndefined(i)||(a=h(r,i.formulaText)).value!==i.formulaText&&(o=e.slice(0,e.lastIndexOf(s.calculateInstance.sheetToken)+1),a.sheetId=l.tokenToParentObject.has(o)?Number(l.tokenToParentObject.get(o)):parseInt(e.split("!")[1],10)+1,s.updateDataContainer([s.calculateInstance.rowIndex(e)-1,s.calculateInstance.colIndex(e)-1],a),s.calculateInstance.refresh(i.getParsedFormula())),o=t.slice(0,t.lastIndexOf(s.calculateInstance.sheetToken)+1),n===(l.tokenToParentObject.has(o)?l.tokenToParentObject.get(o):t.split("!")[1])&&(s.calculateInstance.getFormulaInfoTable().delete(t),s.calculateInstance.clearFormulaDependentCells(t))})})},o.prototype.renameUpdation=function(h,d){function p(e){Q(e.value1)&&e.value1.toUpperCase().includes(g)&&e.value1.match(m)&&(e.value1=e.value1.replace(m,h)),Q(e.value2)&&e.value2.toUpperCase().includes(g)&&e.value2.match(m)&&(e.value2=e.value2.replace(m,h))}var c,u,f=this,g=d.toUpperCase(),e=new RegExp("[!@#$%^&()+=';,.{}|\\\":<>~_-]","g"),m=new RegExp(d.replace(e,"\\$&")+'(?=[\'!])(?=[^"]*(?:"[^"]*"[^"]*)*$)',"gi");this.sheetInfo.forEach(function(e,t){if((c=ae(f.parent,t))&&c.rows&&c.rows.length)for(var r=0,n=c.rows.length;r<n;r++)if(c.rows[r]&&c.rows[r].cells)for(var i=0,o=c.rows[r].cells.length;i<o;i++)(u=se(r,i,c,!1,!0)).formula&&Q(u.formula)&&u.formula.toUpperCase().includes(g)&&u.formula.match(m)&&(u.formula=u.formula.replace(m,h)),u.validation&&p(u.validation);if(c&&c.columns&&c.columns.length)for(var a,r=0,s=c.columns.length;r<s;r++)(a=c.columns[r])&&a.validation&&p(a.validation);for(var l=f.parent.definedNames,r=0;r<l.length;r++)Q(l[r].refersTo)&&l[r].refersTo.includes(d)&&l[r].refersTo.match(m)&&(l[r].refersTo=l[r].refersTo.replace(m,h),l[r].scope.includes(d))&&(l[r].scope=h);f.calculateInstance.updateNamedRange(d,h),e.visibleName===d&&(e.visibleName=h)})},o.prototype.updateDataContainer=function(e,t){for(var r,n,i,o=0,a=this.parent.sheets.length;o<a;o++)if((r=ae(this.parent,o)).id===t.sheetId){e[0]in r.rows?(n=r.rows[e[0]],e[1]in n.cells?((i=n.cells[e[1]]).formula=t.isNamedRange?i.formula:t.value,t.visible?o===this.parent.activeSheetIndex&&r.activeCell===G(e[0],e[1])&&this.parent.notify(dn,{}):i.value=this.referenceError()):n.cells[e[1]]=i={}):(n=r.rows[e[0]]={})[e[1]]=i={};break}},o.prototype.parseSheetRef=function(e,t){for(var r,n,i,o,a,s,l=new RegExp("[!@#$%^&()+=';,.{}|\":<>~_-]","g"),h=0,d=this.getSheetInfo(),p=d.length,c=[],u=(c.length=0,'(?=[\'!])(?=[^"]*(?:"[^"]*"[^"]*)*$)'),f=RegExp,h=0;h<p;h++)if(d[h].sheet!==d[h].visibleName&&(r=new f(d[h].visibleName.replace(l,"\\$&")+u,"gi"),i=h,e.match(r))){for(var g=h+1;g<p;g++)d[g].visibleName.includes(d[h].visibleName)&&(n=new f(d[g].visibleName.replace(l,"\\$&")+u,"gi"),a=e.search(n),o=e.search(r),-1<a)&&(a<o||a===o&&d[g].visibleName.length>d[h].visibleName.length)&&(a=new RegExp("Sheet","gi"),0!==d[g].visibleName.search(a))&&(r=n,i=g);e=e.replace(r,i+"/"),c.push(i)}for(h=0;h<c.length;)r=new f(c[h]+"/"+u,"gi"),s=t?"`"+d[c[h]].sheet+"`":d[c[h]].sheet,e=e.replace(r,s),h++;return e},o.prototype.registerSheet=function(e,t){var r;for(void 0===e&&(e=0),void 0===t&&(t=this.parent.sheets.length);e<t;)r=ae(this.parent,e).id+"",this.calculateInstance.registerGridAsSheet(r,r,this.calcID),e++},o.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=ae(this.parent,e).id+"",this.calculateInstance.unregisterGridAsSheet(n,n),e++},o.prototype.getUniqueRange=function(e){e.range=this.calculateInstance.uniqueRange},o.prototype.removeUniquecol=function(e){if(e&&e.clearAll)this.clearAllUniqueFormulaValue();else for(var t=this.parent.getActiveSheet(),r=0;r<this.calculateInstance.uniqueRange.length;r++){var n=this.calculateInstance.uniqueRange[r].split(":")[0].split("!");if(n[0]===t.name&&n[1]===t.activeCell){var i=te(this.calculateInstance.uniqueRange[r]);this.calculateInstance.uniqueRange.splice(r,1);for(var o=i[0];o<=i[2];o++)for(var a=i[1];a<=i[3];a++)se(o,a,this.parent.getActiveSheet()).formula="",this.parent.updateCell({value:"",formula:""},re([o,a]))}}},o.prototype.refreshCalculate=function(e){e.sheet=ee.isNullOrUndefined(e.sheetIndex)?this.parent.getActiveSheet():ae(this.parent,e.sheetIndex);var t=e.sheet.id+"",r=this.calculateInstance.getSheetFamilyItem(t),n=ue(e.colIndex+1)+(e.rowIndex+1);r.isSheetMember&&!ee.isNullOrUndefined(r.parentObjectToToken)&&(n=r.parentObjectToToken.get(t)+n),e.isFormula?this.calculateFormula(e,n):(this.calculateInstance.getFormulaInfoTable().has(n)&&(this.calculateInstance.getFormulaInfoTable().delete(n),this.calculateInstance.clearFormulaDependentCells(n)),this.calculateInstance.refresh(n,null,null,null,e.isDelete,e.deletedRange),"Automatic"===this.parent.calculationMode&&this.calculateInstance.refreshRandValues(n)),this.calculateInstance.cell="",e.isFormulaDependent=this.calculateInstance.getDependentCells().has(n),e.value&&(e.value=e.value.toString().split("^+").join("^").split("&+").join("&"))},o.prototype.calculateFormula=function(e,t){var r=this,n=e.sheet,i=(this.autoCorrectFormula(e,n),e.value),o=(e.isClipboard&&i.toUpperCase().includes("UNIQUE")&&Vi(e.rowIndex,e.colIndex,n,{value:""},!0),i),i=this.parseSheetRef(i),i=new Al(e.rowIndex+1,e.colIndex+1,i),a=[n.usedRange.rowIndex,n.usedRange.colIndex],s=(this.calculateInstance.valueChanged(n.id.toString(),i,!0,a,e.isRefreshing,n.name,e.isRandomFormula,null,e.isDelete,e.deletedRange,e.isDependentRefresh,e.action),!0!==this.calculateInstance.isRandomVal||e.isRandomFormula||"Automatic"!==this.parent.calculationMode||this.refreshRandomFormula(),se(e.rowIndex,e.colIndex,n));if(s&&o&&!e.isDependentRefresh){i=void 0;if(0===(o=o.toUpperCase()).indexOf("=SUM(")?i="=SUM(":0===o.indexOf("=AVERAGE(")?i="=AVERAGE(":0===o.indexOf("=ROUNDDOWN(")?i="=ROUNDDOWN(":0===o.indexOf("=ROUNDUP(")?i="=ROUNDUP(":0===o.indexOf("=MOD(")&&(i="=MOD("),i){if((o=o.replace(i,"")).includes(")"))for(var o=o.slice(0,o.lastIndexOf(")")),l=void 0,h=void 0;o.includes("(")&&o.includes(")");)h=o.indexOf("("),l=o.slice(h+1),o=o.slice(0,h)+(l.includes(")")?l.slice(l.indexOf(")")+1):l);for(var d,p,c,u=o.split(this.calculateInstance.getParseArgumentSeparator()),f=void 0,g=void 0,h=0;h<u.length;h++)if((d=u[h].split(":")[0]).includes("!")?(g=d.substring(0,d.lastIndexOf("!")).split("'").join(""),d=d.substring(d.lastIndexOf("!")+1)):g="",Fn(d)&&(f=g&&void 0!==(c=B(this.parent,g))?ae(this.parent,c):n,p=se((c=te(d))[0],c[1],f))&&p.format&&(!e.fillType||!s.format)){s.format=p.format;break}}else{var m,v,y,C,a=this.calculateInstance.getDependentFormulaCells().get(t);a&&a.size&&this.calculateInstance.getFormulaInfoTable().has(t)&&-1===this.calculateInstance.getFormulaInfoTable().get(t).getParsedFormula().lastIndexOf("q")&&!s.format&&(C=this.calculateInstance.getSheetFamilyItem(null,this.calcID),a.forEach(function(e){m||(v=e.slice(0,e.lastIndexOf("!")+1),Fn(e=e.replace(v,""))&&(y=te(e),v=C.tokenToParentObject.has(v)&&void 0!==(v=Ii(r.parent,Number(C.tokenToParentObject.get(v))))?ae(r.parent,v):n,y=se(y[0],y[1],v))&&y.format&&(m=y.format))}),m)&&(s.format=m)}}},o.prototype.refreshRandomFormula=function(){var e=this.calculateInstance.randCollection;if(1<this.calculateInstance.randomValues.size&&this.calculateInstance.randomValues.size===e.length)for(var t=0;t<this.calculateInstance.randomValues.size;t++){var r=this.calculateInstance.rowIndex(e[t]),n=this.calculateInstance.colIndex(e[t]),i=this.calculateInstance.randomValues.get(e[t]),o=(parseFloat(this.calculateInstance.getSheetToken(e[t]).split(this.calculateInstance.sheetToken).join(""))+1).toString(),a=ae(this.parent,Ii(this.parent,Number(o)));a&&se(r-1,n-1,a).formula&&(a=new Al(r,n,i),this.calculateInstance.valueChanged(o,a,!0,void 0,void 0,void 0,!1,!0))}},o.prototype.autoCorrectFormula=function(e,t){if(!ee.isNullOrUndefined(e.value)){var r=e.value,n=(2===(r=(r=this.autoCorrectCellRef({formula:e.value})).toString()).split("(").length&&r.indexOf(")")<0&&(r+=")"),void 0),i=(0===r.indexOf("=")&&(r=r.slice(1),n=!0),r.match(/</g)),o=r.match(/>/g),a=r.match(/=/g);if(i){for(var s="",l=0;l<i.length;l++)s+=i[l];r=r.replace(s,"<")}if(o){for(var h="",d=0;d<o.length;d++)h+=o[d];r=r.replace(h,">")}if(a){for(var p="",c=0;c<a.length;c++)p+=a[c];r=r.split(p).join("=")}r=n?"="+r:r,(i||o||a)&&(se(e.rowIndex,e.colIndex,t).formula=r),e.value=r}},o.prototype.correctCellReference=function(n){var i,o,a,s,l,h=this,d=n.split(":");return d.forEach(function(e,t){if(o=e.split("!"),n=o[1]||e,l=null,n.includes("&"))i=n.split("&"),h.calculateInstance.isCellReference(i[1].split("$").join(""))&&(i[1]=h.getUpdatedCellRef(i[1]),l=i.join("&"));else if(h.calculateInstance.isCellReference(n.split("$").join("")))l=h.getUpdatedCellRef(n),1<o.length&&(l=o[0]+"!"+l);else if(a=e.match(/[/+\-*^><>=<=<>]+/g)){i=e.split(a[0]);for(var r=0;r<i.length;r++)o=i[r].split("!"),n=o[1]||o[0],h.calculateInstance.isCellReference(n.split("$").join(""))&&(i[r]=h.getUpdatedCellRef(n),1<o.length)&&(i[r]=o[0]+"!"+i[r]);l=i.join(a[0])}l&&l!==e&&(s=!0,d[t]=l)}),{isInvalid:s,ref:d.join(":")}},o.prototype.autoCorrectCellRef=function(e){var t,r=e.formula.lastIndexOf(")");if(-1<r&&2===e.formula.split(")").length){for(var n=r-1;-1<n&&"("!==e.formula[n];){if(")"===e.formula[n])return e.formula;n--}if(-1<n){for(var r=e.formula.substring(n+1,r),i=this.calculateInstance.getParseArgumentSeparator(),o=r.split(i),a=void 0,s=0;s<o.length;s++)(t=this.correctCellReference(o[s])).isInvalid&&(a=!0,o[s]=t.ref);a&&(e.formula=e.formula.split(r).join(o.join(i)),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},o.prototype.getUpdatedCellRef=function(e){var t=e,r=0===(e=e.trim()).indexOf("$"),n=e.search(/[a-zA-Z]/),i=e.search(/\d/),n=r?n-1:n;return(r?1<i:0<i)&&oe(e.substring(i,e.length))?t:e.substring(n,e.length)+e.substring(0,n)},o.prototype.initiateDefinedNames=function(){for(var e=this.parent.definedNames,t=0;t<e.length;){var r,n=e[t],i=this.parseSheetRef(n.refersTo),o=y(i),a=!1,i=-1<i.indexOf("http:")||-1<i.indexOf("https:");-1<(o=(o=o.split("$").join("")).split("=").join("")).indexOf(":")?(Fn((r=o.split(":"))[0])&&Fn(r[1])||r[0].match(/[0-9]/)&&r[1].match(/[0-9]/)||r[0].toUpperCase().match(/[A-Z]/)&&r[1].toUpperCase().match(/[A-Z]/))&&(a=!0):o.indexOf(":")<0&&Fn(o)&&(a=!0),(a=i?!1:a)?this.addDefinedName(n,!0,void 0,!0):(this.removeDefinedName(n.name,n.scope,!0),t--),t++}},o.prototype.addDefinedName=function(e,t,r,n){(void 0===r||r<-1)&&(r=this.parent.definedNames.length);var i=!0,o=e.name,a=(e.refersTo.indexOf("!")<0&&(a=-1!==(a=Di(this.parent)).indexOf(" ")?"'"+a+"'":a,e.refersTo=a+"!"+(e.refersTo.indexOf("=")<0?e.refersTo:e.refersTo.split("=")[1])),e.refersTo),s=this.parseSheetRef(e.refersTo),l=(e.scope?-1<(l=B(this.parent,e.scope))&&(o=Di(this.parent,l)+"!"+o):e.scope="",e.comment||(e.comment=""),!t&&this.checkIsNameExist(e.name,e.scope)?i=!1:(this.calculateInstance.addNamedRange(o,"="===s[0]?s.substr(1):s),"="!==s[0]&&(e.refersTo="="+a),this.parent.definedNames.indexOf(e)<0&&this.parent.definedNames.splice(r,0,e)),{name:e.name,scope:e.scope,comment:e.comment,refersTo:e.refersTo,cancel:!1});return n||this.parent.notify("actionComplete",{eventArgs:l,action:"addDefinedName"}),i},o.prototype.removeDefinedName=function(e,t,r){var n,i,o=!1,a=this.getIndexFromNameColl(e,t);return-1<a&&(n=e,t&&-1<(i=B(this.parent,t))&&(n=Di(this.parent,i)+"!"+e),this.calculateInstance.removeNamedRange(n),this.parent.definedNames.splice(a,1),r||this.parent.notify("actionComplete",{eventArgs:{name:e,scope:t,cancel:!1},action:"removeDefinedName"}),o=!0),o},o.prototype.checkIsNameExist=function(t,r){return this.parent.definedNames.some(function(e){return e.name===t&&(r?e.scope===r:""===e.scope)})},o.prototype.getIndexFromNameColl=function(r,n){void 0===n&&(n="");var i=-1;return this.parent.definedNames.filter(function(e,t){e.name===r&&e.scope===n&&(i=t)}),i},o.prototype.calculateNow=function(s){function i(){var e;--r||(t(),"Automatic"===h.parent.calculationMode&&"CalculateWorkbook"===s.scope&&h.parent.setProperties({calculationMode:"Manual"},!0),(e=h.parent.getActiveSheet()).conditionalFormats&&e.conditionalFormats.length&&h.parent.notify(Br,{indexes:[],isAction:!0,refreshAll:!0,isEdit:!0}))}var l,h=this,e=new H.Deferred,t=(s.promise=e.promise,function(){var t,n,r,i,o={isRefreshing:!0,action:"calculate"},a=h.calculateInstance.getFormulaInfoTable();s.sheets.forEach(function(e){r=e.id.toString(),t=h.calculateInstance.getSheetFamilyItem(r),n=t.isSheetMember?t.parentObjectToToken.get(r):"",h.parent.setSheetPropertyOnMute(e,"isSheetCalculated",!0),(o.sheet=e).rows.forEach(function(e,r){o.rowIndex=r,e&&e.cells&&e.cells.forEach(function(e,t){e&&Q(e.formula)&&(i=n+ue(t+1)+(r+1),void 0===e.value||null===e.value||!a.has(i)||l&&l[i])&&(o.colIndex=t,o.value=e.formula,h.calculateFormula(o,i))})})}),e.resolve(),h.calculateInstance.cell=""}),r=s.sheets.length;s.sheets.forEach(function(e){var t,r,n;e.ranges.some(function(e){return e.dataSource&&(!e.info||!e.info.loadedRange||!e.info.loadedRange.length)})?h.parent.notify(ht,{sheet:e,autoDetectFormat:!0,loadFromStartCell:!0,updateDependentCellsCallback:(e=(e=e).id.toString(),t=h.calculateInstance.getSheetFamilyItem(e),r=t.isSheetMember?t.parentObjectToToken.get(e):"",l={},n=h.calculateInstance.getDependentCells(),function(e,t){e=r+G(e,t);n.has(e)&&n.get(e).forEach(function(e){l[e]||(l[e]=!0)})}),loadComplete:i}):i()})},o.prototype.toFixed=function(e){var t=Number(e);return e=Math.round(t)!==t?t.toFixed(2):e},o.prototype.commputeFormulaValue=function(e){var t=this.parseSheetRef(e.value);e.value=this.calculateInstance.computeExpression(t).toString()},o.prototype.getCellRefValue=function(e){var t,r,n=this.getSheetInfo(),i=n.length,o=this.calculateInstance.sheetToken,a=e.value,s=a.lastIndexOf(o);if(-1!==s){var l=a.substring(0,s);0<l.length&&l[0]===this.calculateInstance.getFormulaCharacter()&&(l=l.substring(1,e.value.length));for(var h=0;h<i;h++)if(l.toUpperCase()===n[h].visibleName.toUpperCase()){t=h;break}r=o+t+o+a.substring(s+1).toUpperCase()}else 0<a.length&&a[0]===this.calculateInstance.getFormulaCharacter()&&(r=a.substring(1,e.value.length).toUpperCase());e.value=this.calculateInstance.getValueFromArg(r)},o.prototype.aggregateComputation=function(e){var t=this.parent.getActiveSheet(),r=ki(t),n=te(r.split(":")[1]),i=(n[0]+1===t.rowCount&&n[1]+1===t.colCount&&(r="A1:"+G(t.usedRange.rowIndex,t.usedRange.colIndex)),this.calculateInstance.getCellCollection(r));for(l=0;l<i.length;l++)if(oe(d=this.calculateInstance.getValueFromArg(i[l]))){e.countOnly=!1;break}if(e.Count=this.calculateInstance.getFunction("COUNTA")(r),e.Count&&!e.countOnly){for(var o=["SUM","AVERAGE","MIN","MAX"],a=[],n=te(t.activeCell),s=se(n[0],n[1],t,!1,!0),l=0;l<4;l++){var h,d=this.toFixed(this.calculateInstance.getFunction(o[l])(r));s.format&&(h={formattedText:d,value:d,format:s.format,cell:{value:d,format:s.format}},this.parent.notify(St,h),d=h.formattedText),a.push(d)}e.Sum=a[0],e.Avg=a[1],e.Min=a[2],e.Max=a[3]}},o.prototype.refreshInsertDelete=function(a){var e,s,l,h=this;"Sheet"!==a.modelType&&(e=this.calculateInstance.getDependentFormulaCells(),l=Ii(this.parent,a.sheet.id),this.parent.sheets.forEach(function(e,t){for(var r=0,n=e.usedRange.rowIndex;r<=n;r++)for(var i=0,o=e.usedRange.colIndex;i<=o;i++)(s=se(r,i,e,!1,!0)).formula&&Q(s.formula)&&(t===l?!a.isInsert&&("Row"===a.modelType?r>=a.startIndex&&r<=a.endIndex:i>=a.startIndex&&i<=a.endIndex)||h.updateFormula(a,s,r,i,l):s.formula.includes(a.sheet.name)&&h.updateFormula(a,s,r,i,l,!0,e))}),e.clear(),this.calculateInstance.getDependentCells().clear(),this.calculateInstance.getFormulaInfoTable().clear(),this.refreshNamedRange(a))},o.prototype.getUpdatedFormulaOnInsertDelete=function(t){var e,r;t.sheetNames?(t.updateSheetRef||(t.updateSheetRef=this.getSheetRefUpdateOnDelete()),e=this.parseSheetRef(t.cell.formula,!1),r=e,t.sheetNames.forEach(function(e){r=t.updateSheetRef(e,r).value}),r!==e&&(t.cell.formula=r)):this.updateFormula(t.insertDeleteArgs,t.cell,t.row,t.col,t.sheetIdx,t.otherSheet,t.formulaSheet)},o.prototype.updateFormula=function(e,t,r,n,i,o,a){for(var s,l,h,d,p,c,u,f=new RegExp(/^(?=.*[a-zA-Z])(?=.*\d)/g),g=(t.formula&&t.formula.includes("UNIQUE")&&void 0!==r&&this.clearUniqueRange(r,n,a||e.sheet),this.parseFormulaArgument({formula:this.parseSheetRef(t.formula,!0),rangeRef:!0})),m=this.getSheetInfo(),v=!t.formula.includes(this.parent.listSeparator),y=0;y<g.length;y++)if(u=g[y].trim(),(c=u.includes("$"))&&(u=u.replace(/[$]/g,"")),h=!0,this.calculateInstance.isCellReference(u)){if(l=u.includes(":"),(s=y&&g[y-1].trim())&&"!"===s[s.length-1]){if((s=s.replace(/['!]/g,""))!==(m[i].sheet===m[i].visibleName?e.sheet.name:"`"+m[i].sheet+"`"))continue}else if(o)continue;!f.test(u)&&-1<u.indexOf(":")&&(h=!1,d=!!ee.isNullOrUndefined(u.match(/[0-9]/))),s=ne(te(u)),this.parent.updateRangeOnInsertDelete(e,s,l,r,n,c,v)&&(g[y]=s[2]<s[0]||s[3]<s[1]?this.calculateInstance.getErrorStrings()[z.CommonErrors.Ref]:h?(u=void 0,u=(c?"$":"")+ue(s[1]+1)+(c?"$":"")+(s[0]+1),s[0]===s[2]&&s[1]===s[3]||(u+=":"+(c?"$":"")+ue(s[3]+1)+(c?"$":"")+(s[2]+1)),u):d?re(s).replace(/\d/g,""):re(s).replace(/[a-zA-Z]/g,""),p=!0)}var C,b,x="="+g.join("");p&&(b=RegExp,m.forEach(function(e){x.includes("`"+e.sheet+"`")&&(C=new b("`"+e.sheet+"`","gi"),x=x.replace(C,e.visibleName))}),t.formula!==x)&&(t.formula=x,"Manual"===this.parent.calculationMode&&(e.isInsert||e.isDelete)||(t.value=null))},o.prototype.clearUniqueRange=function(e,t,r){for(var e={cellIdx:[e,t,e,t],isUnique:!1,uniqueRange:"",sheetName:r.name},n=(this.parent.notify(_t,e),te(e.uniqueRange)),i=n[0];i<=n[2];i++)for(var o=n[1];o<=n[3];o++)delete se(i,o,r,!1,!0).value},o.prototype.clearAllUniqueFormulaValue=function(){for(var e=this.calculateInstance.uniqueRange,t=0;t<e.length;t++){var r,n=e[t].lastIndexOf("!"),i=ae(this.parent,B(this.parent,e[t].substring(0,n))),o=se((r=te(e[t].substring(n+1)))[0],r[1],i);if(!o||"#SPILL!"!==o.value)for(var a=r[0];a<=r[2];a++)for(var s=r[1];s<=r[3];s++)(o=se(a,s,i))&&o.value&&delete o.value}},o.prototype.parseFormulaArgument=function(e){for(var t,r,n=0,i=[],o=this.markSpecialChar(e.formula.replace("=",""),e.rangeRef),a=RegExp,s=new a(e.rangeRef?/\(|\)|=|\^|>|<|\+|-|\*|\/|%|&/g:/\(|\)|=|\^|>|<|:|\+|-|\*|\/|%|&/g),l=new a(this.parent.listSeparator,"g"),h=(o=o.split(new a(s.source+"|"+l.source,"g"))).length;n<h;)(t=o[n])&&(1===t.length?i.push(this.isUniqueChar(t)?this.getUniqueCharVal(t):t):(r=t[0],0<t.indexOf("!")?(this.isUniqueChar(r)&&(i.push(this.getUniqueCharVal(r)),t=t.substr(1)),r=t.indexOf("!")+1,i.push(t.substring(0,r)),-1<(r=(t=t.substring(r)).indexOf(":"))&&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++;return e.formulaArr=i},o.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""},o.prototype.isUniqueChar=function(e){e=e.charCodeAt(e);return 129<=e&&e<=142},o.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)},o.prototype.refreshNamedRange=function(e){var t=this;if(e.definedNames&&e.definedNames.length)e.definedNames.forEach(function(e){t.parent.removeDefinedName(e.name,e.scope),t.parent.addDefinedName(e)});else{var r=this.parent.definedNames.length;if(r)for(var n,i=Object.assign({},this.parent.definedNames),o=new RegExp(/^(?=.*[a-zA-Z])(?=.*\d)/g),a=0;a<r;a++){var s,l,h=!0,d=(s=i[a]).refersTo.lastIndexOf("!"),p=s.refersTo.substring(d+1);(l=(l=d=s.refersTo.substring(1,d)).match(/'/g)?l.slice(1,-1):l)===e.sheet.name&&(!o.test(p)&&-1<p.indexOf(":")&&(h=!1,n=!!ee.isNullOrUndefined(p.match(/[0-9]/))),l=te(p),p=this.parent.updateRangeOnInsertDelete(e,l),h=h?re(l):n?re(l).replace(/\d/g,""):re(l).replace(/[a-zA-Z]/g,""),e.isInsert?this.updateDefinedNames(s,d,h,p):"Row"===e.modelType?this.updateDefinedNames(s,d,h,p,[l[0],l[2]],e):"Column"===e.modelType&&this.updateDefinedNames(s,d,h,p,[l[1],l[3]],e))}}},o.prototype.updateDefinedNames=function(e,t,r,n,i,o){if(n){var n=this.parent.definedNames.indexOf(e),a={action:"removeDefinedName",isRemoved:!1,definedName:e.name,scope:e.scope,isEventTrigger:!0};if(this.parent.notify(ie,a),i){a={name:e.name,comment:e.comment,refersTo:e.refersTo,scope:e.scope},a=new me(this.parent,"definedNames",a,!0);if(o.definedNames?o.definedNames.push(a):o.definedNames=[a],i[1]<i[0])return}e.refersTo=t+"!"+r,this.parent.notify(ie,{action:"addDefinedName",definedName:e,isAdded:!1,index:n,isEventTrigger:!0});o={name:e.name,scope:e.scope,comment:e.comment,refersTo:e.refersTo,cancel:!1};this.parent.notify("actionComplete",{eventArgs:o,action:"refreshNamedRange"})}},o);function o(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()}a.prototype.numberFormatting=function(e){var t,r,n,i=this.parent.activeSheetIndex,o=!0,a=(e.range&&-1<e.range.indexOf("!")&&(o=(i=B(this.parent,e.range.substring(0,e.range.lastIndexOf("!"))))===this.parent.activeSheetIndex),ae(this.parent,i)),s=ne(te(e.range?-1<e.range.lastIndexOf("!")?e.range.substring(e.range.lastIndexOf("!")+1):e.range:a.selectedRange));e.curSym=ee.getNumberDependable(this.parent.locale,ee.defaultCurrencyCode);for(var l=s[0];l<=s[2];l++)for(var h=Nh(a,l),d=o&&!he(a,l),p=s[1];p<=s[3];p++)n=(r=se(l,p,a,!1,!0)).format,ti(r,a.columns[p],h)||_n(this.parent,a,{cell:{format:e.format},rowIdx:l,colIdx:p})||((r=se(l,p,a)).rowSpan<0||r.colSpan<0||(t={value:r.value,format:r.format,rowIndex:l,colIndex:p,sheetIndex:i,cell:r,refresh:o,curSymbol:e.curSym},this.getFormattedCell(t),d&&(this.setCell(t),t.td&&this.parent.notify(It,t),n)&&n!==e.format&&n.includes("[")&&-1===qi().indexOf(_i(e.format))&&this.removeFormatColor(t,{format:n,style:r.style})),this.parent.setUsedRange(l,p));a.conditionalFormats&&a.conditionalFormats.length&&this.parent.notify(Br,{indexes:s,isAction:!0,isEdit:!0}),this.parent.chartColl&&this.parent.chartColl.length&&this.parent.notify(Wr,{range:s})},a.prototype.isDigitPlaceHolder=function(e){return"#"===e||"0"===e||"?"===e||"."===e},a.prototype.parseToLocalizedFormat=function(e){if(e.decimalGroupSepsChanged&&(e.format.includes(".")||e.format.includes(","))){for(var t,r,n=void 0,i=e.format.split(""),o=0;o<i.length;o++)'"'===(t=i[o])?-1<(n=e.format.indexOf('"',o+1))&&(o=n):"_"===t||"*"===t||"\\"===t?o++:"["===t?-1<(n=e.format.indexOf("]",o+1))&&(o=n):","===t?this.isDigitPlaceHolder(i[o-1])&&(i[o]=this.localeObj.group):"."!==t||i[o-1]&&(r=i[o-1].toLowerCase(),["d","m","y","h"].some(function(e){return r===e}))||(i[o]=this.localeObj.decimal);e.format=i.join("")}e.curChanged&&e.format.includes('"'+e.curSym+'"')&&(e.format=e.format.split('"'+e.curSym+'"').join(e.curSym))},a.prototype.updateLocalizedFormats=function(e,t){for(var o,r,n,i=this,a=(Dl={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:e.timeFormats&&"HH:mm:ss"===e.timeFormats.medium?"HH:mm:ss":"h:mm:ss AM/PM"},ee.getNumberDependable(this.parent.locale,ee.defaultCurrencyCode)),s={curChanged:"$"!==a,curSym:a,decimalGroupSepsChanged:"."!==this.localeObj.decimal&&","!==this.localeObj.group},e=(s.curChanged&&((e=new ee.Internationalization(this.parent.locale).getNumberPattern({currency:"$",useGrouping:!0,format:"c0"},!0))&&e.endsWith("$")?(o=e[e.indexOf("$")-1].trim().length?"":" ",Dl.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++;Dl.currency[t]=e.split("$#,##0"+(r=r&&"."+r)).join("#,##0"+r+o+'"'+a+'"')}}),Dl.accounting.forEach(function(e,t){var r,n;e.slice(0,e.indexOf("#")).includes("$")&&((r=e.split(";")).forEach(function(e,t){e.includes("$")&&(e=e.replace("$",""),0<(n=e.includes("0)")?e.indexOf("0)")+2:e.lastIndexOf(e.includes("0")?"0":e.includes("?")?"?":e.includes('"-"')?'"':"#")+1))&&(r[t]=e.slice(0,n)+o+'"'+a+'"'+e.slice(n))}),Dl.accounting[t]=r.join(";"))})):(Dl.currency.forEach(e=function(e,t,r){return r[t]=e.split("$").join('"'+a+'"')}),Dl.accounting.forEach(e))),["General","0","0.00","#,##0","#,##0.00","#,##0_);(#,##0)","#,##0_);[Red](#,##0)","#,##0.00_);(#,##0.00)","#,##0.00_);[Red](#,##0.00)",Dl.currency[2],Dl.currency[3],Dl.currency[4],Dl.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(Dl.accounting)),l=(t?(t=this.customFormats).splice.apply(t,[0,e.length].concat(e)):(this.customFormats=e,this.localizedFormats=[]),[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]),h=(l.forEach(function(e,t){u&&u.has(e)&&(i.customFormats[t]=u.get(e),-1<(r=[5,6,7,8].indexOf(e))?Dl.currency[r+2]=i.customFormats[t]:-1<(r=[42,41,44,43].indexOf(e))&&(Dl.accounting[r]=i.customFormats[t])),s.format=i.customFormats[t],i.parseToLocalizedFormat(s),i.localizedFormats[t]=s.format}),this),d=l.length;d<this.localizedFormats.length;d++)!function(r){-1<h.localizedFormats.findIndex(function(e,t){return e===i.localizedFormats[r]&&t<l.length})&&(h.localizedFormats.splice(r,1),h.customFormats.splice(r,1),r--),n=r}(d),d=n},a.prototype.localizedFormatAction=function(e){"getLocalizedFormats"===e.action?(e.defaultFormats=this.customFormats,e.localizedFormats=this.localizedFormats):"mapNumberFormatId"===e.action?this.updateLocalizedFormats(ee.IntlBase.getDependables(ee.cldrData,this.parent.locale,null).dateObject,!0):(e.curSym=ee.getNumberDependable(this.parent.locale,ee.defaultCurrencyCode),"parseToDefaultFormat"===e.action?this.parseToDefaultFormat(e):(e.decimalGroupSepsChanged="."!==this.localeObj.decimal&&","!==this.localeObj.group,e.curChanged="$"!==e.curSym,e.defaultFormat||(e.defaultFormat=e.format,this.parseToLocalizedFormat(e)),-1===this.localizedFormats.indexOf(e.format)&&(this.localizedFormats.push(e.format),this.customFormats.push(e.defaultFormat))))},a.prototype.parseToDefaultFormat=function(i){var o,a,s,l,h=this,d="."!==this.localeObj.decimal&&i.format.includes(this.localeObj.decimal),p=","!==this.localeObj.group&&i.format.includes(this.localeObj.group),c="$"!==i.curSym&&i.format.includes(i.curSym);(d||p||c)&&((l=i.format.split(";")).forEach(function(e,t){for(var r=e.split(""),n=0;n<r.length;n++)'"'===(s=r[n])?n=e.indexOf('"',n+1):"_"===s||"*"===s||"\\"===s?n++:"["===s?-1<(o=e.indexOf("]",n+1))&&(n=o):d&&s===h.localeObj.decimal?(a=r[n-1])&&(a=a.toLowerCase(),["d","m","y","h"].some(function(e){return a===e}))||(r[n]="."):p&&s===h.localeObj.group?h.isDigitPlaceHolder(r[n-1])&&(r[n]=","):c&&(s===i.curSym?r[n]='"'+i.curSym+'"':i.curSym.startsWith(s)&&e.substring(n,n+i.curSym.length)===i.curSym&&r.splice(n,i.curSym.length,'"'+i.curSym+'"'));l[t]=r.join("")}),i.format=l.join(";"))},a.prototype.getFormattedCell=function(e){var t,r,n,i,o,a,s=void 0===e.value||null===e.value?"":e.value,l=(e.sheetIndex=void 0===e.sheetIndex?this.parent.activeSheetIndex:e.sheetIndex,ae(this.parent,e.sheetIndex)),h=e.cell||se(e.rowIndex,e.colIndex,l,!1,!0),d=!1,p=new ee.Internationalization;return e.curSymbol||(e.curSymbol=ee.getNumberDependable(this.parent.locale,ee.defaultCurrencyCode)),e.format&&"General"!==e.format||e.skipFormatCheck||h.formula&&h.formula.toLowerCase().startsWith("=text(")?(e.type=Ml(e.format),e.skipFormatCheck&&!e.format&&"General"===e.type&&(e.format="General")):(e.type=e.format="General",(!h.formula||h.formula&&-1===h.formula.indexOf("&-"))&&(t={value:s,updatedVal:s,cell:h,isEdit:e.isEdit,intl:p},this.checkDateFormat(t),t.isDate||t.isTime)&&(d=!0,h.value=e.value=t.updatedVal,h.format&&"General"!==h.format?(e.format=h.format,e.type=Ml(e.format)):h.format=e.format=Pl(t.isDate?"ShortDate":"Time"))),h.format&&this.isCustomType(h)?(e.type="Custom",t=-1<h.format.indexOf("@"),r=void(""!==s&&!t&&this.isPercentageValue(s.toString(),e,h)&&(s=e.value.toString())),i={},u&&Jn(this.parent)&&(h.format=e.format=this.getMatchingCustomFormat(h.format)),a=h.format,h.format=h.format.split("\\").join(""),Wi((o=h.format.split(";"))[0],!0,i,!0)?(""!==s&&(e.result=this.processCustomDateTime(e,h,"time"!==i.type,o),r=!e.formatApplied),e.result=e.result||h.value):1<o.length?(-1<h.format.indexOf("<")||-1<h.format.indexOf(">")?e.result=this.processCustomConditions(h,e):r=(n=Nn(h,this.parent.locale,this.localeObj.group,this.localeObj.decimal,e.curSymbol)).isNumber?(h.value=n.value,this.processCustomAccounting(h,e,o,o[0]),!1):(e.result=this.processCustomText(h,e,o),!0),h.format=a):t?(r=!0,e.result=this.processCustomText(h,e)):(n=Nn({value:s},this.parent.locale,this.localeObj.group,this.localeObj.decimal)).isNumber?(h.value=e.value=n.value,h.format.includes("E+0")?(e.format!==h.format&&(e.format=h.format),this.checkAndSetColor(e),o=(i=e.format.split("E")[0]).split("."),"."!==this.localeObj.decimal&&1===o.length&&(o=i.split(this.localeObj.decimal)),e.result=1<o[0].length?this.scientificHashFormat(e,o):this.scientificFormat(e)):(e.result=this.processCustomNumberFormat(h,e),r=!oe(h.value))):(h.format&&h.format.includes("[")&&this.removeFormatColor(e,{format:h.format,style:h.style}),r=e.dataUpdate=!0),e.dataUpdate?e.formattedText=e.result||(ee.isNullOrUndefined(e.value)?"":e.value.toString()):(e.value=e.result,e.formattedText=ee.isNullOrUndefined(e.value)?"":e.value.toString()),e.isRightAlign=!r&&!ee.isNullOrUndefined(e.value)):(a=this.processFormats(e,s,d,h,p,l),e.formattedText=a.fResult||(void 0===e.value||null===e.value?"":e.value.toString()),e.isRightAlign=a.rightAlign),void 0!==e.rowIndex&&(h.format&&e.formattedText&&e.formattedText!==h.value&&"General"!==h.format?h.formattedText=e.formattedText:h.formattedText&&delete h.formattedText),e.formattedText},a.prototype.isCustomType=function(e){var t=Ml(e.format);return"General"===t&&"General"!==e.format||"Time"===t&&this.parent.isEdit},a.prototype.processCustomFill=function(e,t,r,n){var i,o,a=e[e.indexOf("*")+1],e=e.split("*"+a);return n=void 0===r.rowIndex||r.dataUpdate?n||this.processCustomNumberFormat({format:e.join(""),value:t.value},r):(i=void 0,e[1]?(n=(o=parseFloat(t.value))<0?(i=this.processCustomNumberFormat({format:e[1],value:Math.abs(o).toString()},r),"-"+e[0].split("'").join("")):(i=this.processCustomNumberFormat({format:e[1],value:t.value},r),e[0].split("'").join("")),0===o&&(i=i.split("0").join(""))):n=n||this.processCustomNumberFormat({format:e[0],value:t.value},r),r.isRowFill=!0,this.setCell(r),this.parent.notify(an,{cell:t,cellEle:r.td,rowIdx:r.rowIndex,colIdx:r.colIndex,beforeFillText:n,repeatChar:a,afterFillText:i}),this.parent.isPrintingProcessing?n+i:n)},a.prototype.processCustomDateTime=function(o,a,s,e){var l,t,r,h=this;"."!==this.localeObj.decimal&&a.value&&a.value.toString().includes(this.localeObj.decimal)&&oe(i=a.value.replace(this.localeObj.decimal,"."))&&(a.value=o.value=i);if(oe(a.value)){if(1<e.length&&parseFloat(a.value)<=0&&(o.formatApplied=this.processCustomAccounting(a,o,e),o.formatApplied))return o.result}else if(r=a.value.toString(),!(l=!!(r.includes(h.localeObj.dateSeparator)||0<r.indexOf("-")||r.includes(h.localeObj.timeSeparator))||(i=ee.IntlBase.getDependables(ee.cldrData,h.parent.locale,null).dateObject,(t=i.months["stand-alone"]&&i.months["stand-alone"].abbreviated)&&!!Object.keys(t).find(function(e){return r.includes(t[""+e])}))))return this.processCustomText(a,o,e);function n(e){var t;if(l){var r,n=void 0;if(a.format.includes("[h]")&&1<(r=a.value.toString().split(":")).length&&24<=Number(r[0])&&(n=Number(r[0])/24,r[0]="24",a.value=r.join(":")),t=(r=si(a.value,new ee.Internationalization,h.parent.locale,d,a)).dateObj&&"Invalid Date"!==r.dateObj.toString()){if(r.dateObj.getFullYear()<1900)return"";var i=oi(r.dateObj,a.value.toString().includes(":"),"time"===r.type);1<=n&&(r.dateObj=ii(i+=n)),a.value=i.toString()}}else{if(h.checkAndProcessNegativeValue(o,a.value))return o.formatApplied=!0,o.formattedText;t=(r={dateObj:ii(parseFloat(a.value))}).dateObj&&"Invalid Date"!==r.dateObj.toString()}return t?(e&&s&&(o.dateObj=r.dateObj),o.formatApplied=!0,n=void 0,d.startsWith("MM-dd-yyyy ")?(d=d.split(" ").splice(1).join(" "),n=p.formatDate(r.dateObj,{type:"date",skeleton:"yMd"})+(d?" "+p.formatDate(r.dateObj,{type:f,format:d}):"")):(n=p.formatDate(r.dateObj,{type:f,format:d}),(d=d.toLowerCase()).startsWith("[h]")?n=(24*Number(a.value.toString().split(".")[0])+r.dateObj.getHours()).toString()+n.slice(n.indexOf("]")+1):d.startsWith("[m")?n=(1440*Number(a.value.toString().split(".")[0])+60*r.dateObj.getHours()+r.dateObj.getMinutes()).toString()+n.slice(n.indexOf("]")+1):d.startsWith("[s")&&(n=(86400*Number(a.value.toString().split(".")[0])+60*(60*r.dateObj.getHours()+r.dateObj.getMinutes())+r.dateObj.getSeconds()).toString())),c?n.replace(h.localeObj.am,"A").replace(h.localeObj.pm,"P"):n):""}var i,d=e[0],p=new ee.Internationalization,c=(d=d.split("_(").join(" ").split("_)").join(" "),-1<a.format.indexOf("h")&&(d=d.split("h").join("H"),f="time"),-1<a.format.indexOf("s")&&(f="time"),-1<a.format.indexOf("A/P"));if((-1<a.format.indexOf("AM/PM")||c)&&(d=(d=d.split("H").join("h")).split("A/P").join("AM/PM").split("AM/PM").join("a"),f="time"),-1<a.format.indexOf("d")){for(var u,f="date",g=d.split(" "),m=void 0,v=void 0,y=0;y<g.length;y++){for(var C=g[y].includes(this.localeObj.dateSeparator)?this.localeObj.dateSeparator:"-",m=g[y].split(C),b=0;b<m.length;b++)(u=(v=m[b]).match(/d/g))&&2<u.length&&(m[b]=v.split("d").join("E"));g[y]=m.join(C)}d=g.join(" ")}if(-1<a.format.indexOf("m"))if(-1<a.format.indexOf("s")||-1<a.format.indexOf("h"))f="time",a.format.includes(" ")&&((g=d.split(" "))[0].includes("d")||g[0].includes("y"))&&(g[0]=g[0].split("m").join("M"),d=g.join(" "));else if(f="date",(d=d.split("m").join("M")).includes("MMMMM"))return i=d,d="MMMM",e=n()[0],d=i.split("MMMMM").join("p"),n(o.checkDate).split("p").join(e);return n(o.checkDate)},a.prototype.processCustomConditions=function(e,t){if(oe(e.value)){for(var r=e.format.split(";"),n=Number(e.value),i=void 0,o=void 0,a=0;a<r.length;a++){if(e.format=r[a],(s=_i(e.format))&&(e.format=e.format.split("["+s+"]").join("")),!e.format.includes("[")){e.format=r[a],o=!1;break}var s=(i=e.format.split("[")[1].split("]")[0]).split("<="),l=i.split(">="),h=i.split("<"),d=i.split(">");if(2===s.length&&n<=Number(s[1])||2===l.length&&n>=Number(l[1])||2===h.length&&n<Number(h[1])||2===d.length&&n>Number(d[1])){e.format=r[a].split("["+i+"]").join(""),o=!1;break}o=2===i.split(/<=|>=|<|>/).length}return o?(this.removeFormatColor(t,{format:r.join(""),style:e.style}),this.processCustomFill("*#",e,t,"#####")):this.processCustomNumberFormat(e,t)}return e.value},a.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)},a.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;r=this.processCustomNumberFormat({format:n.split("@").join("#"),value:i.split(i).join("1")},t);return r=r&&(r=r.split("1").join(i),"."!==this.localeObj.decimal)&&oe(r)&&r.includes(".")?r.replace(".",this.localeObj.decimal):r},a.prototype.thousandSeparator=function(e,t){for(;e;)t/=1e3,e--;return t},a.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]||-1<r.indexOf(e.format[n+1])||t++;return t},a.prototype.processDigits=function(e,t){t=t.split("?").join("0");var r=e.value.toString();return(r=(r=this.getFormattedNumber(t,parseFloat(r)))&&r.includes(this.localeObj.decimal)?(t=r.split(this.localeObj.decimal))[0]+this.localeObj.decimal+t[1].split("0").join(" "):r)||e.value},a.prototype.processFormatWithSpace=function(e,t,r){for(var n,i={cell:t,char:" ",width:0},o=(this.parent.notify(sn,i),i.width),t={format:e,formattedText:""},a=0;a<e.length;a++)"_"===e[a]&&(i.char=e[a+1],this.parent.notify(sn,i),n=i.width,n=Math.round(n/o),e=e.replace(e[a]+e[a+1]," ".repeat(n)));var s=e.length-e.trim().length;if(0<s){if(t.formattedText=this.getFormattedNumber(e.trim(),r)," "===e[0]){for(var l=1,h=1;" "===e[h];)l++,h++;s-=l,t.formattedText=" ".repeat(l)+t.formattedText}t.formattedText+=" ".repeat(s)}else t.formattedText=this.getFormattedNumber(e,r);return t.format=e,t},a.prototype.removeFormatColor=function(e,t){-1<qi().indexOf(_i(t.format))&&(e.color=t.style&&t.style.color?t.style.color:"",this.applyColor(e))},a.prototype.processCustomNumberFormat=function(e,t,r){var n,i,o,a,s,l;return e.format?(a=e.value,(i=Nn(e,this.parent.locale,this.localeObj.group,this.localeObj.decimal)).isNumber&&(n=o=void 0,e.value=i.value,i=parseFloat(e.value.toString()),r=r||e.format,-1<e.format.indexOf("[")&&((s=_i(r))?(r=r.split("["+s+"]").join(""),t.color=s.toLowerCase(),this.applyColor(t)):this.removeFormatColor(t,e)),(-1<r.indexOf('"')||-1<r.indexOf("\\"))&&(r=this.processText(r),n=0===i&&!r.includes("#")&&!r.includes("0"))&&(r+="#"),(s=this.getSeparatorCount(e))&&(o=!0,l=this.thousandSeparator(s,i),-1===r.indexOf(".")&&(l=Math.round(l)),a=this.getFormattedNumber(r.split(",").join(""),l),0===l)&&(a=a.replace("0","")),-1<r.indexOf("?")&&(o=!0,a=this.processDigits(e,r),r=r.split("?").join("")),-1<r.indexOf("_")&&(o=!0,r=(l=this.processFormatWithSpace(r,e,i)).format,a=l.formattedText),a&&-1<r.indexOf("?")&&(a=a.replace("?"," ")),-1<r.indexOf("*")&&(o=!0,a=this.processCustomFill(r,e,t)),"General"===r&&(o=!0,a=i.toString()),o||(a=this.getFormattedNumber(r,i)),n&&(a=a&&a.replace("0","")),"#"===r[0]&&0<=i&&i<1&&((s=r.split("#").join("").split("."))[0].includes("0")||((l=(a=0!==i||!r.includes(".")||s[1]&&s[1].includes("0")?a:(a=this.getFormattedNumber(r,.1)).replace("1","")).split(this.localeObj.decimal))[0]=l[0].toString().replace(/^0+/,""),a=l.join(this.localeObj.decimal))),"-0"===a)?"0":a):""},a.prototype.processText=function(e){return-1<e.indexOf('"')?e=e.split('"').join("'"):-1<e.indexOf("\\")&&(e=e.split("\\").join("")),e},a.prototype.processFormats=function(e,t,r,n,i,o){var a;if(""!==t){var s=void 0;switch("General"!==e.type&&"Text"!==e.type&&this.isPercentageValue(t.toString(),e,n)&&(t=e.value.toString()),e.type){case"General":(a={args:e,fResult:t,intl:i,isRightAlign:r,cell:n,rowIdx:Number(e.rowIndex),colIdx:Number(e.colIndex),sheet:o}).fResult.toString().startsWith("\n")||a.fResult.toString().endsWith("\n ")||this.autoDetectGeneralFormat(a),t=a.fResult,r=a.isRightAlign;break;case"Number":(s=Nn({value:t},this.parent.locale,this.localeObj.group,this.localeObj.decimal)).isNumber&&(n.value=e.value=s.value,t=this.applyNumberFormat(e,i),r=!0);break;case"Currency":(s=Nn({value:t,format:e.format},this.parent.locale,this.localeObj.group,this.localeObj.decimal,e.curSymbol)).isNumber&&(n.value=e.value=s.value,t=this.currencyFormat(e,i,n),r=!0);break;case"Percentage":(s=Nn({value:t},this.parent.locale,this.localeObj.group,this.localeObj.decimal)).isNumber&&(n.value=e.value=s.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":(s=Nn({value:t},this.parent.locale,this.localeObj.group,this.localeObj.decimal)).isNumber&&(n.value=e.value=s.value,t=this.fractionFormat(e),r=!0);break;case"Scientific":(s=Nn({value:t},this.parent.locale,this.localeObj.group,this.localeObj.decimal)).isNumber&&(n.value=e.value=s.value,t=this.scientificFormat(e),r=!0);break;case"Text":"."!==this.localeObj.decimal&&oe(t)&&t.toString().includes(".")&&(t=t.toString().replace(".",this.localeObj.decimal)),r=!1}}return{fResult:t,rightAlign:r}},a.prototype.autoDetectGeneralFormat=function(e){var t,r,n=e.fResult,i=e.args.cell&&e.args.cell.formula&&0<e.args.cell.formula.indexOf("ADDRESS("),o=e.args.cell&&e.args.cell.formula&&0<e.args.cell.formula.indexOf("DOLLAR("),a=e.args.cell&&e.args.cell.formula&&0<e.args.cell.formula.indexOf("TEXT(");o&&e.fResult&&e.fResult.toString().includes(e.args.curSymbol)||a||(e.fResult&&"."!==this.localeObj.decimal&&(t=r=e.fResult.toString(),r.includes(this.localeObj.decimal))&&oe(r=r.replace(this.localeObj.decimal,"."))&&(r.includes("E")?e.fResult=r:(e.fResult=e.args.value=r=Number(r).toString(),Vi(e.rowIdx,e.colIdx,e.sheet,{value:r},!0)),t=r.replace(".",this.localeObj.decimal)),oe(e.fResult)&&(r=Number(e.fResult).toString(),e.fResult.toString().includes("E")?(e.args.format=Pl("Scientific"),Vi(e.rowIdx,e.colIdx,e.sheet,{value:r,format:e.args.format},!0),e.args.value=r,e.fResult=this.scientificFormat(e.args)):e.args.format&&(-1<e.args.format.indexOf("%")?e.fResult=this.percentageFormat(e.args,e.intl):-1<e.args.format.indexOf(e.args.curSymbol)?e.fResult=this.currencyFormat(e.args,e.intl,e.args.cell):e.fResult=this.applyNumberFormat(e.args,e.intl)),"General"===e.args.format&&(e.args.cell&&e.args.cell.formula&&r.includes(".")&&11<r.length&&(o=r.indexOf(".")+1,t=null,e.args.cell.formula.includes("RANDBETWEEN"))&&(e.fResult=r=o<7?r:parseFloat(r).toFixed(0)),e.cellVal=r,e.prevVal=t,this.parseDecimalNumber(e),ee.isNullOrUndefined(e.fResult))&&!ee.isNullOrUndefined(e.cellVal)&&(e.fResult=e.cellVal),e.isRightAlign=!0),e.fResult&&this.updateAutoDetectNumberFormat(e),i&&(e.isRightAlign=!1,e.fResult=n))},a.prototype.parseDecimalNumber=function(e){var t,r=e.cellVal.split(".");11<r[0].length?(e.cellVal=Math.abs(Number(r[0])).toString().substring(0,6).replace(/0+$/,""),-1<(t=e.cellVal.length-1)&&(e.fResult=this.scientificFormat(e.args,5<t?5:t))):r[1]&&(11<e.cellVal.length?(r=10-(r[0].length-(Math.sign(Number(e.cellVal))<0?1:0)),e.fResult=Number(Number(e.cellVal).toFixed(0<r?r:0)).toString()):e.cellVal.includes("e-")?(r=e.cellVal.split("e-"),t=Number(r[1])+(r[0].includes(".")?r[0].split(".")[1].length:0),r[0]=r[0].replace(".",this.localeObj.decimal),1===r[1].length&&(r[1]="0"+r[1]),e.args.updateValue||Vi(e.rowIdx,e.colIdx,e.sheet,{value:Number(e.cellVal).toFixed(t)},!0),e.fResult=r.join("E-")):e.prevVal?e.fResult=e.prevVal:e.args.updateValue&&"."!==this.localeObj.decimal&&(e.fResult=e.cellVal.replace(".",this.localeObj.decimal)))},a.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)?Pl("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("/")&&oe(n[0])&&Number(n[0])%1==0){var i=n[1].split("/");if(oe(i[0])&&Number(i[0])%1==0&&oe(i[1])&&Number(i[1])%1==0)return r.format="# "+(1<i[0].length||1<i[1].length?"??/??":"?/?"),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))}}n="";t.includes(e.args.curSymbol)&&(n=t.includes(this.localeObj.decimal)?Dl.currency[0]:Dl.currency[1],t=t.replace(e.args.curSymbol,"")),("."===this.localeObj.decimal||e.args.isEdit&&!r.formula)&&t.includes(this.localeObj.group)&&Rn(t,this.parent.locale,this.localeObj.group,this.localeObj.decimal)&&(t=t.split(this.localeObj.group).join(""),n=n||(t.includes(this.localeObj.decimal)?"#,##0.00":"#,##0")),n?oe(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=n):(Vi(e.rowIdx,e.colIdx,e.sheet,{value:e.args.value,format:n},!0),n.includes('"')&&(n=this.processText(n)),e.fResult=this.getFormattedNumber(n,Number(e.args.value)),e.isRightAlign=!0)):"."!==this.localeObj.decimal&&"General"===e.args.format&&oe(t)&&t.includes(".")&&(e.fResult=Number(t).toString().replace(".",this.localeObj.decimal))}},a.prototype.isPercentageValue=function(e,t,r){if(e.includes("%")){e=e.split("%");if(""!==e[0]&&""===e[1].trim()){e=Nn({value:e[0]},this.parent.locale,this.localeObj.group,this.localeObj.decimal);if(e.isNumber)return t.value=Number(e.value)/100,r.value=t.value.toString(),!0}}return!1},a.prototype.findSuffix=function(e,t){var r=e.length-t.length;return e.substr(0,r<0?0:r)+t},a.prototype.applyNumberFormat=function(e,t){e.format=this.isCustomFormat(e.format);var r,n=e.format.split(";");if(0<Number(e.value))e.format=n[0];else if(0===Number(e.value)){if(e.format=n[2]||n[0],-1<e.format.indexOf('"')&&-1===e.format.indexOf("#"))return e.format=e.format.split("_").join(" ").split("*").join(" ").split("?").join(" ").split('"').join(""),e.format}else if(Number(e.value)<0)e.format=ee.isNullOrUndefined(n[1])?n[0]:n[1].split("*").join(" "),-1<e.format.indexOf("-")&&(e.value=e.value.toString().split("-").join(""));else if(e.format=n[3]||n[0],e.format=e.format.split("_").join(" ").split("*").join(" ").split("?").join(" "),-1<e.format.indexOf("@"))return e.format.split("@").join(e.value.toString());return e.format=e.format.split("_").join(" ").split("*").join(" ").split('"').join(""),-1<e.format.indexOf("?")&&-1<e.format.indexOf(this.localeObj.decimal)?(n=e.format.split(this.localeObj.decimal)[1].length,r="",Number(e.value)%1&&(r=e.value.toString().split(".")[1].length<n?" ":"0"),e.format=e.format.split("?").join(r)):e.format=e.format.split("?").join(" "),Number(e.value)<0&&e.cell&&e.cell.format&&(e.format=e.cell.format),t.formatNumber(Number(e.value),{format:e.format})},a.prototype.isCustomFormat=function(e){return e=(e=""===(e='_-* #,##0.00_-;-* #,##0.00_-;_-* "-"_-;_-@_-'!==e&&'_-* #,##0_-;-* #,##0_-;_-* "-"_-;_-@_-'!==e?e:"")?Pl("Number"):e).toString().split("_)").join(" ").split("_(").join(" ").split("[Red]").join("")},a.prototype.currencyFormat=function(e,t,r){e.format=e.format||Pl("Currency"),e.format=e.format.split("_(").join(" ").split("_)").join(" ");var n=e.format.split(";"),i=_i(e.format),o=Number(e.value);return 0<=o||ee.isNullOrUndefined(n[1])?(i&&(e.color=r.style&&r.style.color?r.style.color:"",this.applyColor(e)),e.format=n[0]):(o=Math.abs(o),e.format=n[1].split("["+i+"]").join("").split("*").join(" "),i&&(e.color=i.toLowerCase(),this.applyColor(e))),e.format=this.getFormatForOtherCurrency(e.format),e.format.includes('"')&&(e.format=this.processText(e.format)),t.formatNumber(o,{format:e.format,currency:ee.defaultCurrencyCode})},a.prototype.applyColor=function(e){e.refresh&&(this.setCell(e),e.td)&&e.td.style.color!==e.color&&this.parent.notify(Ft,{style:{color:e.color},rowIdx:e.rowIndex,colIdx:e.colIndex,td:e.td})},a.prototype.setCell=function(e){var t;e.td||(t={sheet:ae(this.parent,e.sheetIndex),cell:e.cell,rowIdx:e.rowIndex,colIdx:e.colIndex},(1<e.cell.rowSpan||1<e.cell.colSpan)&&Zn(t),e.td=this.parent.getCell(t.rowIdx,t.colIdx))},a.prototype.percentageFormat=function(e,t){return e.format=""===e.format?Pl("Percentage"):e.format,t.formatNumber(Number(e.value),{format:e.format})},a.prototype.accountingFormat=function(e,t,r,n){e.format=e.format||Pl("Accounting"),e.format=e.format.split("_(").join(" ").split("_)").join(" ").split("[Red]").join("").split("_").join("");var i=e.format.split(";"),o=Nn({value:t},this.parent.locale,this.localeObj.group,this.localeObj.decimal);return o.isNumber?(n.value=e.value=o.value,0<=(o=Number(e.value))?e.format=0===o&&i[2]?i[2]:i[0]:(e.format=i[1].split("*").join(" "),o=Math.abs(o)),e.format.includes(e.curSymbol)&&e.format.includes('"')&&(e.format=this.processText(e.format)),e.format=this.getFormatForOtherCurrency(e.format),e.formatApplied=!0,0!==o||(e.format=this.processText(e.format.split("*").join(" ").split("?").join(" ")),e.format.includes("#"))||e.format.includes("0")?r.formatNumber(o,{format:e.format,currency:ee.defaultCurrencyCode}):(e.format+="#",(r=r.formatNumber(o,{format:e.format,currency:ee.defaultCurrencyCode})).includes("0")?r.replace("0",""):r)):i[3]?this.processCustomText(n,e,i):t},a.prototype.getFormatForOtherCurrency=function(e){var t;return-1<e.indexOf("[$")&&(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),e},a.prototype.checkAndProcessNegativeValue=function(e,t){return!!(t&&oe(t)&&Number(t)<0)&&(void 0===e.rowIndex||e.dataUpdate?e.formattedText="#".repeat(e.dataUpdate?7:10):(e.isRowFill=!0,this.setCell(e),t={cell:e.cell,cellEle:e.td,rowIdx:e.rowIndex,colIdx:e.colIndex,repeatChar:"#"},this.parent.notify(an,t),e.formattedText=t.formattedText),!0)},a.prototype.shortDateFormat=function(e,t,r){var n,i;if(u&&Jn(this.parent)&&r&&"m/d/yyyy"===r.format&&u.has(14)&&(r.format=e.format=u.get(14)),n=""===e.format||"General"===e.format||"mm-dd-yyyy"===e.format||"m/d/yyyy"===e.format?(o="MM-dd-yyyy",{type:"date",skeleton:"yMd"}):(o=e.format,e.format===Pl("ShortDate")?{type:"date",skeleton:"yMd"}:{type:"date",format:e.format}),!oe(e.value)&&e.value&&r){e.value=e.value.toString();var o={value:e.value,updatedVal:e.value,cell:r,isEdit:e.isEdit,intl:t,skipCellFormat:!0,format:o};if(this.checkDateFormat(o),!o.isDate&&!o.isTime)return"";r.value=e.value=o.updatedVal,i=o.dateObj}else{if(!(i=ii(e.value))||"Invalid Date"===i.toString())return"";if(i.getFullYear()<1900||9999<i.getFullYear())return oe(e.value)?e.value.toString():""}return e.checkDate&&(e.dateObj=i),t.formatDate(i,n)},a.prototype.longDateFormat=function(e,t){var r;if(e.value=e.value.toString(),(e.value.includes(this.localeObj.dateSeparator)||0<e.value.indexOf("-"))&&!oe(e.value)){if(!((r=si(e.value,t,this.parent.locale,"",e.cell).dateObj)&&"Invalid Date"!==r.toString()&&1900<=r.getFullYear()))return oe(e.value)?e.value:"";e.value=oi(r).toString(),e.cell&&(e.cell.value=e.value)}else if((r=ii(e.value))&&"Invalid Date"!==r.toString()&&r.getFullYear()<1900)return oe(e.value)?e.value:"";return e.checkDate&&(e.dateObj=r),t.formatDate(r,{type:"date",skeleton:"full"})},a.prototype.timeFormat=function(e,t,r){if(ee.isNullOrUndefined(e.value))return"";var n,i=Pl("Time"),i=(""!==e.format&&"General"!==e.format||(n=i),n="h:mm:ss AM/PM"===e.format?"h:mm:ss a":e.format,e.value.toString());if(!oe(i)&&r){e={value:i,updatedVal:i,cell:r,isEdit:e.isEdit,intl:t,skipCellFormat:!0};if(this.checkDateFormat(e),!e.isDate&&!e.isTime)return"";r.value=i=e.updatedVal}r=i.split(".");return ee.isNullOrUndefined(r[1])||(i=parseFloat(r[0]+1+"."+r[1])||i),t.formatDate(ii(i),{type:"time",skeleton:"medium",format:n})},a.prototype.scientificHashFormat=function(e,t){var r,n=this.findDecimalPlaces(e.format),i=t[0].split("0").length-1+(t[0].split("#").length-1),o=Number(e.value).toExponential(n+i);if(o.includes("e+"))r="e+";else{if(!o.includes("e-"))return o;r="e-"}var a,o=o.split(r),s=o[0].split("."),l=Number(o[1]),h=("e-"===r?(a=(h=l+Math.abs(l-i*(i<l?2:1)))-l,o[1]=h.toString()):o[1]=(l-(a=l%i)).toString(),0<a&&(s[0]+=s[1].substring(0,a),s[1]=s[1].slice(a),o[0]=s.join(".")),Number("1"+"0".repeat(n)));return this.getFormattedNumber(t.join("."),Number((Math.round(Number(o[0])*h)/h).toFixed(n)))+r.toUpperCase()+this.findSuffix(e.format.split("+")[1],o[1])},a.prototype.scientificFormat=function(e,t){e.format||(e.format=Pl("Scientific"));var r=e.format.split("+")[1]||"00",e=(void 0===t&&(t=this.findDecimalPlaces(e.format)),Number(e.value).toExponential(t));return-1<e.indexOf("e+")?e=e.split("e+")[0]+"E+"+this.findSuffix(r,e.split("e+")[1]):-1<e.indexOf("e-")&&(e=e.split("e-")[0]+"E-"+this.findSuffix(r,e.split("e-")[1])),e.replace(".",this.localeObj.decimal)},a.prototype.fractionFormat=function(e){e.format=e.format||Pl("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))){t=ri(Number(e.value));if(t)return r+" "+t}return r+" "+" ".repeat(2*n)},a.prototype.checkAndSetColor=function(e){var t=_i(e.format);t&&(e.format=e.format.split("["+t+"]").join(""),e.color=t.toLowerCase(),this.applyColor(e))},a.prototype.findDecimalPlaces=function(e){var t,r=e.toUpperCase().indexOf("E");return-1<r?0<(t=-1===(t=e.indexOf(this.localeObj.decimal))&&"."!==this.localeObj.decimal?e.indexOf("."):t)?e.substring(t+1,r).length:0:2},a.prototype.checkDateFormat=function(e){if(!ee.isNullOrUndefined(e.value)){var t=e.cell||se(e.rowIndex,e.colIndex,ae(this.parent,ee.isNullOrUndefined(e.sheetIndex)?this.parent.activeSheetIndex:e.sheetIndex),!1,!0),r=this.checkCustomDateFormat(e.value.toString(),t,e.isEdit);if("Invalid"!==r.val){var n=void 0,i=(r.format.startsWith("[h]")&&1<(i=r.val.split(":")).length&&24<=Number(i[0])&&(n=Number(i[0])/24,i[0]="24",r.val=i.join(":")),si(r.val,e.intl||new ee.Internationalization(this.parent.locale),this.parent.locale,r.format||e.format,e.skipCellFormat&&t,r.isDateTime));if(i.dateObj&&"Invalid Date"!==i.dateObj.toString()){var o=i.dateObj.getFullYear();if(1900<=o&&o<=9999){e.isTime="time"===i.type;o=oi(i.dateObj,r.val.includes(":"),e.isTime);if(1<=n&&(i.dateObj=ii(o+=n)),r.val=o.toString(),(!t.format||"General"===t.format)&&(e.isTime?t.format=Pl("Time"):t.format=Pl("ShortDate"),e.updateValue))return void(t.value=r.val);e.isDate="date"===i.type||"datetime"===i.type,e.dateObj=i.dateObj}e.updatedVal=r.val}}}},a.prototype.checkCustomTimeFormat=function(r,e){var n,i,o,a,s=this,l=[],h=" "+this.localeObj.am,d=" "+this.localeObj.pm,t=r.includes(h)||r.includes(d),p=(t||(r.includes(h.toLowerCase())||r.includes(d.toLowerCase()))&&(r=r.replace(h.toLowerCase(),h).replace(d.toLowerCase(),d),t=!0),r.split(this.localeObj.timeSeparator)),c=3===p.length&&t;if(p.length<=3?(a=t?12:23,p.forEach(function(e,t){e=e.trim(),(p[t]=e).includes(h)||e.includes(d)?(n=" AM/PM",e=e.replace(h,"").replace(d,"")):n="",oe(i=Number(e))&&0<=i?24<=i&&0===t&&1<p.length?l.push("[h]"):i<=a&&0===t?(l.push("h"+n),1===p.length&&(n?((o=r.split(" "))[0]+=s.localeObj.timeSeparator+"00",p[0]=o.join(" ")):(l=[],r="Invalid"))):i<=60&&(1===l.length||2===l.length)?(1===l.length&&(l.push("mm"+n),2!==p.length||"[h]"!==l[0])||l.push("ss"),1===e.length&&(p[t]="0"+p[t])):(l=[],r="Invalid"):(l=[],r="Invalid")})):r="Invalid",l.length){r=p.join(this.localeObj.timeSeparator);t=void 0;if(c?t=this.customFormats[24]:(t=l.join(":"),u&&(t=this.getMatchingCustomFormat(t))),!e.format||"General"===e.format)return e.format=t,{val:r,format:t}}return{val:r,format:""}},a.prototype.checkCustomDateFormat=function(r,t,e){var n,i=this,o=t.format;if(r.includes(this.localeObj.dateSeparator)&&(!r.includes(" "+this.localeObj.am)&&!r.includes(" "+this.localeObj.pm)||r.replace(" "+this.localeObj.am,"").replace(" "+this.localeObj.pm,"").includes(this.localeObj.dateSeparator)))n=this.localeObj.dateSeparator;else{if(!(0<r.indexOf("-")))return r.includes(this.localeObj.timeSeparator)||r.includes(" "+this.localeObj.am)||r.includes(" "+this.localeObj.pm)?this.checkCustomTimeFormat(r,t):{val:"Invalid",format:""};n="-"}if(r.includes(this.localeObj.timeSeparator)&&r.includes(" ")){var a=r.split(" ");if(r=a.shift(),"Invalid"===(a=this.checkCustomTimeFormat(a.join(" "),t)).val)return{val:"Invalid",format:""}}var s,l,h=r.split(n),d="",p=[],c=function(e){d=p.join(n),o&&"General"!==o||(t.format=e)},u=ee.IntlBase.getDependables(ee.cldrData,this.parent.locale,null).dateObject,f=u.months["stand-alone"]?u.months["stand-alone"].wide:{},g=u.months["stand-alone"]?u.months["stand-alone"].abbreviated:{1:""},m=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],v=function(e,t,r,n){(g[""+t]&&g[""+t].toLowerCase()===r||e.substring(0,n)===r)&&(s=m[Number(t)-1])};if(2===h.length){u=function(e){r=s,p[0]="MMM",Number(e)<=31&&0<Number(e)?(r=e+n+r,"/"!==i.localeObj.dateSeparator&&"-"!==n&&(r+=n+(new Date).getFullYear()),p.splice(0,0,"dd"),c(i.customFormats[21])):(2===e.length&&oe(e)&&-1<Number(e)&&(e=(Number(e)<30?(new Date).getFullYear().toString().slice(0,2):"19")+e),1900<=Number(e)&&Number(e)<=9999?(r="1"+n+r+n+e,p[1]="yyyy",c(i.customFormats[22])):r="Invalid")};h[0]=h[0].toLowerCase().trim(),h[1]=h[1].toLowerCase().trim(),!Number(h[0])&&h[0].length>=g[1].length?(Object.keys(f).find(function(e){return v(f[""+e].toLowerCase(),e,h[0],h[0].length)}),ee.isNullOrUndefined(s)||h[0].includes(",")||u(h[1])):!Number(h[1])&&h[1].length>=g[1].length?(Object.keys(f).find(function(e){return v(f[""+e].toLowerCase(),e,h[1],h[1].length)}),ee.isNullOrUndefined(s)||u(h[0])):Number(h[0])&&Number(h[0])<=12&&Number(h[1])&&("/"===this.localeObj.dateSeparator||"-"===n||e&&!t.formula)&&(s=m[Number(h[0])-1],u(h[1])),p.length||(r="Invalid")}else if(2<h.length)for(var y=this,C=0;C<h.length;C++)!function(t){oe(h[t])?4!==h[t].length&&2!==h[t].length&&1!==h[t].length&&(r="Invalid"):(h[t]=h[t].trim(),Object.keys(f).find(function(e){return v(f[""+e].toLowerCase(),e,h[t].trim().toLowerCase(),h[t].length)}),ee.isNullOrUndefined(s)?r="Invalid":1===t&&(p[1]="MMM",h[2]=h[2].trim(),2===h[2].length&&oe(h[2])&&-1<Number(h[2])&&(h[2]=(Number(h[2])<30?(new Date).getFullYear().toString().slice(0,2):"19")+h[2]),Number(h[0])<=31)&&1900<=Number(h[2])&&Number(h[2])<=9999&&(r=h[0]+n+s,r+=n+h[2],p[0]="d",p[2]="yy",c(y.customFormats[20]),p[2]="yyyy",d=p.join(n)))}(C);return a&&"Invalid"!==r&&(o&&"General"!==o||(t.format=this.customFormats[27]),d&&a.format&&(d+=" "+a.format),r+=" "+a.val,l=!0),{val:r,format:d,isDateTime:l}},a.prototype.formattedBarText=function(e){var t,r,n,i,o,a,s,l=this;""!==e.value&&!ee.isNullOrUndefined(e.value)&&(t={},s=e.cell&&e.cell.format||"",t=e.type||(s&&Wi(s,!0,t,!0)?t.type:""),r=new ee.Internationalization,n=e.value,i=!e.showFormattedText||"dd-MM-yyyy"!==s&&"dd/MM/yyyy"!==s?Pl("ShortDate"):s,"h:mm:ss AM/PM"===(o=Pl("Time"))&&(o="h:mm:ss a"),s=s.toLowerCase(),a=function(){"."!==l.localeObj.decimal&&e.value&&(e.value=e.value.toString(),oe(e.value))&&e.value.includes(".")&&(e.value=e.value.replace(".",l.localeObj.decimal))},"date"===(t="time"!==t||!s.includes("m")||s.includes(":m")||s.includes("m:")||s.includes("[m")||s.includes("am")?t:"date")?(s=e.value.toString(),e.value=this.shortDateFormat({type:t,value:e.value,format:i},r,e.cell),e.value&&s.includes(".")&&(e.value+=" "+this.timeFormat({type:t,value:s,format:o},r))):t.includes("time")?n&&1<=Number(n)||"datetime"===t?e.value=this.shortDateFormat({type:t,value:e.value,format:i},r)+" "+this.timeFormat({type:t,value:e.value,format:o},r):e.value=this.timeFormat({type:t,value:e.value,format:o},r):e.cell.format&&e.cell.format.includes("%")&&oe(e.cell.value)?(e.value=this.parent.getDisplayText(e.cell),e.value.includes("%")||(e.value=n,a())):a(),!e.value||e.value&&-1<e.value.toString().indexOf("null"))&&(e.value=n)},a.prototype.getFormattedNumber=function(e,t){return(new ee.Internationalization).formatNumber(Number(t),{format:e})||""},a.prototype.getMatchingCustomFormat=function(e){return"#,##0_);(#,##0)"===e&&u.has(37)?u.get(37):"#,##0_);[Red](#,##0)"===e&&u.has(38)?u.get(38):"#,##0.00_);(#,##0.00)"===e&&u.has(39)?u.get(39):"#,##0.00_);[Red](#,##0.00)"===e&&u.has(40)?u.get(40):"d-mmm-yy"===e&&u.has(15)?u.get(15):"d-mmm"===e&&u.has(16)?u.get(16):"mmm-yy"===e&&u.has(17)?u.get(17):"h:mm AM/PM"===e&&u.has(18)?u.get(18):"h:mm:ss AM/PM"===e&&u.has(19)?u.get(19):"h:mm"===e&&u.has(20)?u.get(20):"h:mm:ss"===e&&u.has(21)?u.get(21):"m/d/yyyy h:mm"===e&&u.has(22)?u.get(22):"mm:ss"===e&&u.has(45)?u.get(45):e},a.prototype.addEventListener=function(){this.parent.on(xt,this.numberFormatting,this),this.parent.on(St,this.getFormattedCell,this),this.parent.on(At,this.checkDateFormat,this),this.parent.on(Lt,this.formattedBarText,this),this.parent.on(Tt,this.updateAutoDetectNumberFormat,this),this.parent.on(Dt,this.parseDecimalNumber,this),this.parent.on(wn,this.localizedFormatAction,this)},a.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(xt,this.numberFormatting),this.parent.off(St,this.getFormattedCell),this.parent.off(At,this.checkDateFormat),this.parent.off(Lt,this.formattedBarText),this.parent.off(Tt,this.updateAutoDetectNumberFormat),this.parent.off(Dt,this.parseDecimalNumber),this.parent.off(wn,this.localizedFormatAction))},a.prototype.destroy=function(){this.removeEventListener(),u&&!this.parent.refreshing&&(u.clear(),u=null),Dl=this.parent=this.localeObj=this.customFormats=this.localizedFormats=null},a.prototype.getModuleName=function(){return"workbookNumberFormat"};var u,Dl,Ll=a;function a(e){this.parent=e,this.localeObj=ee.getNumericObject(this.parent.locale);e=ee.IntlBase.getDependables(ee.cldrData,this.parent.locale,null).dateObject;e.dayPeriods&&e.dayPeriods&&e.dayPeriods.format&&e.dayPeriods.format.wide?(this.localeObj.am=e.dayPeriods.format.wide.am||"AM",this.localeObj.pm=e.dayPeriods.format.wide.pm||"PM"):(this.localeObj.am="AM",this.localeObj.pm="PM"),this.updateLocalizedFormats(e),this.addEventListener()}function Pl(e){e=e.split(" ").join("");if(!Dl)switch(e){case"Currency":return"$#,##0.00";case"Accounting":return'_($* #,##0.00_);_($* (#,##0.00);_($* "-"??_);_(@_)';case"Time":return"h:mm:ss AM/PM";default:return"General"}function t(e,t){return u&&u.has(t)?u.get(t):e}var r="General";switch(e){case"Number":r=t("0.00",2);break;case"Currency":r=Dl.currency[0];break;case"Accounting":r=Dl.accounting[2];break;case"ShortDate":r=t("m/d/yyyy",14);break;case"LongDate":r="dddd, mmmm dd, yyyy";break;case"Time":r=Dl.time;break;case"Percentage":r=t("0.00%",10);break;case"Fraction":r=t("# ?/?",12);break;case"Scientific":r=t("0.00E+00",11);break;case"Text":r=t("@",49);break;case"CurrencyWithColorCode":r=Dl.currency[5]}return r}function Ml(t,e){var r,n="General";switch(t){case"0":case"0.00":case"#,##0":case"#,##0.00":n="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)":n="Currency";break;case'_($* #,##0.00_);_($* (#,##0.00);_($* "-"??_);_(@_)':case'_ $ * #,##0.00_ ;_ $ * -#,##0.00_ ;_ $ * "-"??_ ;_ @_ ':case'_($* #,##0_);_($* (#,##0);_($* "-"_);_(@_)':n="Accounting";break;case"mm-dd-yyyy":case"m/d/yyyy":case"dd/MM/yyyy":n="ShortDate";break;case"dddd, mmmm dd, yyyy":n="LongDate";break;case"h:mm:ss AM/PM":n="Time";break;case"0.00%":case"0%":n="Percentage";break;case"0.00E+00":n="Scientific";break;case"@":n="Text";break;default:if(t){if(!Dl)break;t===Dl.time?n="Time":-1<Dl.currency.indexOf(t)?n="Currency":-1<Dl.accounting.indexOf(t)?e&&(n="Accounting"):t.includes("?/?")&&(n="Fraction"),u&&"General"===n&&e&&((r=function(e){return e.some(function(e){return u.has(e)&&u.get(e)===t})})([1,2,3,4])?n="Number":r([14])?n="ShortDate":r([9,10])?n="Percentage":r([11])?n="Scientific":r([49])&&(n="Text")),e=!1}}return n=e&&Dl&&("Currency"===n&&"$#,##0.00"!==Dl.currency[0]||"Accounting"===n&&'_($* #,##0.00_);_($* (#,##0.00);_($* "-"??_);_(@_)'!==Dl.accounting[2])?"General":n}function Bl(e,t){t={action:"parseToDefaultFormat",format:t};return e.notify(wn,t),t.format}Hl.prototype.destroy=function(){this.removeEventListener(),this.parent=null},Hl.prototype.addEventListener=function(){this.parent.on(Xt,this.initiateSortHandler,this),this.parent.on(Kt,this.updateSortedDataOnCell,this)},Hl.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(Xt,this.initiateSortHandler),this.parent.off(Kt,this.updateSortedDataOnCell))},Hl.prototype.initiateSortHandler=function(r){var n=this,i=r.args,o=new H.Deferred,e=this.parent.getAddressInfo(i.range),a=ae(this.parent,e.sheetIndex),s=ne(e.indices),t=i.sortOptions||{sortDescriptors:{},containsHeader:!0},e=!1;if(r.promise=o.promise,s[0]>a.usedRange.rowIndex||s[1]>a.usedRange.colIndex)o.reject(this.parent.serviceLocator.getService(hi).getConstant("SortOutOfRangeError"));else{var l=t.containsHeader,h=i.checkForHeader;(s[0]===s[2]||h)&&(h||(s=qn(s[0],s[1],a)),e=!0,ee.isNullOrUndefined(t.containsHeader))&&(l=typeof se(s[0],s[1],a,null,!0).value!=typeof se(s[0]+1,s[1],a,null,!0).value||!this.isSameStyle(se(s[0],s[1],a,null,!0).style,se(s[0]+1,s[1],a,null,!0).style)),!ee.isNullOrUndefined(i.sortOptions)&&!ee.isNullOrUndefined(i.sortOptions.containsHeader)||e||(h=se(s[0],s[1],a),e=se(s[0]+1,s[1],a),h&&e&&(l=typeof h.value!=typeof e.value||!this.isSameStyle(h.style,e.style))),s[0]=l?s[0]+1:s[0];var d=ue(W(a.activeCell)[1]+1),p=(delete t.containsHeader,t.sortDescriptors),c=new H.Query;if(Array.isArray(p))for(var u=(p=p&&0!==p.length?p:[{field:d}]).length,f=u-1;-1<f;f--)p[u-1].field||(p[u-1].field=d),p[f].field&&(g=p[f].sortComparer||this.sortComparer.bind(this,p[f],t.caseSensitive),c.sortBy(p[f].field,g),d=p[f].field);else{(p=p||{field:d}).field||(p.field=d);var g=p.sortComparer||this.sortComparer.bind(this,p,t.caseSensitive);c.sortBy(p.field,g),d=p.field}var m=re(s);pi(this.parent,a.name+"!"+m,!0,null,null,null,null,null,void 0,null,R(d)).then(function(t){new H.DataManager(t).executeQuery(c).then(function(e){n.parent.notify("setActionData",{args:{action:"beforeSort",eventArgs:{range:m,cellDetails:t,sortedCellDetails:e.result}}}),n.updateSortedDataOnCell({result:e.result,range:s,sheet:a,jsonData:t});e={range:a.name+"!"+m,sortOptions:i.sortOptions};r.previousSort&&(e.previousSort=r.previousSort),o.resolve(e)})})}},Hl.prototype.updateSortedDataOnCell=function(o){for(var a,e,t,s=this,l=[],r=function(e,t){for(var r=o.range[1],n=0;r<=o.range[3];r++,n++){if(l[n]||(l[n]=ue(r+1)),t[l[n]])a=ee.extend({},t[l[n]],null,!0);else{if(!se(e,r,o.sheet))continue;a=null}(a=s.skipBorderOnSorting(e,r,o.sheet,a))&&a.validation&&delete a.validation;var i=se(e,r,o.sheet);(a=i&&i.validation?Object.assign({},a,{validation:i.validation}):a)&&a.formula&&(a.formula=Vn([e,r],[parseInt(t.__rowIndex,10)-1,r],o.sheet,s.parent,a,!0)),Vi(e,r,o.sheet,a)}},n=o.isUndo&&{},i=o.range[0],h=0;i<=o.range[2];i++,h++)he(o.sheet,i)?h--:(t=o.result[h],o.isUndo?t&&(n[e=parseInt(t.__rowIndex,10)-1]=!0,r(e,t),i===e)||!n[i]&&o.sheet.rows[i]&&r(i,{}):r(i,t||{}))},Hl.prototype.skipBorderOnSorting=function(e,t,r,n){var i=se(e,t,r),e=["borderBottom","borderTop","borderRight","borderLeft","border"];if(n&&n.style)for(var o=0,a=e;o<a.length;o++){var s=a[o];delete n.style[""+s]}if(i&&i.style)for(var l=0,h=e;l<h.length;l++){s=h[l];i.style[""+s]&&((n=n||{}).style||(n.style={}),n.style[""+s]=i.style[""+s])}return n},Hl.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},Hl.prototype.sortComparer=function(e,t,r,n){var e=e.order||"",i=H.DataUtil.fnSort(e),o=!1;if(r&&n&&("string"==typeof r.value||"string"==typeof n.value)&&""!==r.value&&""!==n.value&&(oe(r.value)&&(r.value=li(r.value)),oe(n.value)&&(n.value=li(n.value),o=!0),!o))return o=new Intl.Collator(this.parent.locale,{sensitivity:t?"case":"base"}),e&&"ascending"!==e.toLowerCase()?-1*o.compare(r.value,n.value):o.compare(r.value,n.value);t=ee.isNullOrUndefined(r)||r&&(ee.isNullOrUndefined(r.value)||""===r.value),e=ee.isNullOrUndefined(n)||n&&(ee.isNullOrUndefined(n.value)||""===n.value);return t&&e?-1:t?1:e?-1:i(r&&r.value,n&&n.value)},Hl.prototype.getModuleName=function(){return"workbookSort"};var Ul=Hl;function Hl(e){this.parent=e,this.addEventListener()}jl.prototype.destroy=function(){this.removeEventListener(),this.parent=null},jl.prototype.addEventListener=function(){this.parent.on(rr,this.initiateFilterHandler,this)},jl.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off(rr,this.initiateFilterHandler)},jl.prototype.initiateFilterHandler=function(t){var e,r,n=this,i=t.args,o=new H.Deferred,a=ae(this.parent,N(this.parent,i.range)),s=i.filterOptions||{};t.promise=o.promise,s.datasource?(this.setFilter(s.datasource,s.predicates,i.range,t.refresh,s.equalOrPredicates),e={range:i.range,filterOptions:s},o.resolve(e)):(e=ne(P(i.range)))[0]>a.usedRange.rowIndex||e[1]>a.usedRange.colIndex?o.reject("Select a cell or range inside the used range and try again."):(e[0]===e[2]&&e[2]-e[0]==0&&(e[0]=0,e[1]=0,e[3]=a.usedRange.colIndex),e[2]=a.usedRange.rowIndex,e[0]=e[0]+1,r=re(e),pi(this.parent,a.name+"!"+r,!0,!0,null,null,null,null,!1).then(function(e){e=new H.DataManager(e);n.setFilter(e,s.predicates,i.range,t.refresh),o.resolve({range:r,filterOptions:s})}))},jl.prototype.setFilter=function(e,t,r,n,i){var o,a,s,l,h,d,p,c,u=this;e&&t&&(o=e.dataSource.json,a=ei(e,t,i),s="__rowIndex",-1<r.indexOf("!")?(h=B(this.parent,r.substring(0,r.lastIndexOf("!"))),l=ae(this.parent,h)):(l=this.parent.getActiveSheet(),h=B(this.parent,l.name)),"spreadsheet"===this.parent.getModuleName()?((e=this.parent).scrollSettings.enableVirtualization&&(l.rows||o).length>e.viewport.rowCount+2*e.getThreshold("row")||l.frozenRows||l.frozenColumns||n?(o.forEach(function(e){d=a.indexOf(e)<0,Rh(l,Number(e[s])-1,{hidden:d,isFiltered:d})}),p=h===e.activeSheetIndex,t=te(l.paneTopLeftCell),this.parent.updateTopLeftCell(Y(l,t[0],!0)-this.parent.frozenRowCount(l),null,"col")):o.forEach(function(e){d=a.indexOf(e)<0,p?Rh(l,Number(e[s])-1,{hidden:d,isFiltered:d}):((e={startIndex:Number(e[s])-1,hide:d,isFiltering:!0,sheetIndex:h}).endIndex=e.startIndex,u.parent.notify(Pr,e),p=e.refreshUI)}),p&&e.renderModule.refreshSheet(!1,!1,document.activeElement.id!==this.parent.element.id+"_SearchBox")):o.forEach(function(e){c=a.indexOf(e)<0,Rh(l,Number(e[s])-1,{hidden:c,isFiltered:c})}))},jl.prototype.getModuleName=function(){return"workbookFilter"};var Vl=jl;function jl(e){this.parent=e,this.addEventListener()}_l.prototype.setImage=function(e){var t=e.range?e.range.lastIndexOf("!"):-1,r=e.range?-1<t?e.range.substring(t+1):e.range:this.parent.getActiveSheet().selectedRange,t=e.range&&-1<t?B(this.parent,e.range.substring(0,t)):this.parent.activeSheetIndex,r=te(r),t=ee.isUndefined(t)?this.parent.getActiveSheet():ae(this.parent,t),n=se(r[0],r[1],t),i=e.options;if(n&&n.image)for(var o=n.image,a=0;a<i.length;a++)o.push(i[a]);Vi(r[0],r[1],t,{image:n&&n.image?o:i},!0)},_l.prototype.addEventListener=function(){this.parent.on(jr,this.setImage,this)},_l.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off(jr,this.setImage)},_l.prototype.destroy=function(){this.removeEventListener(),this.parent=null},_l.prototype.getModuleName=function(){return"workbookImage"};var zl=_l;function _l(e){this.parent=e,this.addEventListener()}Wl.prototype.addEventListener=function(){this.parent.on(zr,this.setChartHandler,this),this.parent.on(Yr,this.deleteChartColl,this),this.parent.on(Gr,this.refreshChartSize,this),this.parent.on(Xr,this.focusChartBorder,this)},Wl.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(zr,this.setChartHandler),this.parent.off(Yr,this.deleteChartColl),this.parent.off(Gr,this.refreshChartSize),this.parent.off(Xr,this.focusChartBorder))},Wl.prototype.setChartHandler=function(e){var t=0,r=[],n=(e.isInitCell=!ee.isNullOrUndefined(e.isInitCell)&&e.isInitCell,e.isUndoRedo=!!ee.isNullOrUndefined(e.isUndoRedo)||e.isUndoRedo,e.isPaste=!ee.isNullOrUndefined(e.isPaste)&&e.isPaste,e.chart);if(0<n.length)for(;t<n.length;){if(!1===e.isCut&&document.getElementById(e.chart[t].id)&&(n[t]={range:n[t].range,id:ee.getUniqueID("e_spreadsheet_chart"),theme:n[t].theme,isSeriesInRows:n[t].isSeriesInRows,type:n[t].type,markerSettings:n[t].markerSettings}),document.getElementById(e.chart[t].id))return;(s=n[t]).theme=s.theme||"Material",s.type=s.type||"Line",s.isSeriesInRows=s.isSeriesInRows||!1,ee.isNullOrUndefined(s.range)?(i=this.parent.getActiveSheet(),s.range=i.selectedRange,0===(r=ne(te(s.range)))[0]&&r[2]===i.rowCount-1&&r[2]>i.usedRange.rowIndex&&(r[2]=i.usedRange.rowIndex),0===r[1]&&r[3]===i.colCount-1&&r[3]>i.usedRange.colIndex&&(r[3]=i.usedRange.colIndex)):r=ne(te(s.range));var i,o,a,s,l=re(r);0<s.range.indexOf("!")?s.range=s.range.substring(0,s.range.lastIndexOf("!"))+"!"+l:s.range=this.parent.getActiveSheet().name+"!"+l,ee.isNullOrUndefined(s.id)&&(s.id=ee.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(_r,{option:s,isInitCell:e.isInitCell,triggerEvent:e.isUndoRedo,dataSheetIdx:e.dataSheetIdx,range:e.range,isPaste:e.isPaste}),this.parent.chartColl.push(s),!e.isInitCell||e.isPaste?(l=void 0===e.sheetId?s.range&&0<s.range.lastIndexOf("!")?B(this.parent,s.range.substring(0,s.range.lastIndexOf("!"))):this.parent.activeSheetIndex:Ii(this.parent,e.sheetId),o={clientY:s.top,isImage:!0},a={clientX:s.left,isImage:!0},this.parent.notify(bn,o),this.parent.notify(xn,a),i=ee.isUndefined(l)?this.parent.getActiveSheet():this.parent.sheets[l],l=se(o.clientY,a.clientX,i),this.parent.isPrintingProcessing||(l&&l.chart?l.chart.push(s):Vi(o.clientY,a.clientX,i,{chart:[s]},!0))):(l=te(e.range),o={clientY:s.top,isImage:!0},a={clientX:s.left,isImage:!0},this.parent.notify(bn,o),this.parent.notify(xn,a),s={prevTop:s.top,prevLeft:s.left,prevRowIdx:l[0],prevColIdx:l[1],prevHeight:s.height,prevWidth:s.width,currentTop:s.top,currentLeft:s.left,currentRowIdx:o.clientY,currentColIdx:a.clientX,currentHeight:s.height,currentWidth:s.width,id:s.id,requestType:"chartRefreshOnInit"},l[0]===o.clientY&&l[1]===a.clientX||(l=n.length,this.parent.notify(Sn,s),t-=l-n.length)),t++}},Wl.prototype.refreshChartSize=function(e){for(var t=1,r=this.parent.sheets.length+1;t<r;){var n,i=this.parent.chartColl;if(n=i?i.length:0)for(;n--;){var o=this.parent.chartColl[n];!ee.isNullOrUndefined(e.overlayEle.querySelector("#"+o.id))&&(o=this.parent.element.querySelector("."+o.id),o=ee.getComponent(o,"chart")||ee.getComponent(o,"accumulationchart"))&&(o.height=e.height,o.width=e.width)}t++}},Wl.prototype.focusChartBorder=function(e){for(var t=0;t<this.parent.chartColl.length;t++){var r=document.getElementById(e.id),n=document.getElementById(this.parent.chartColl[t].id);r&&n&&ee.closest(n,"."+r.classList[1])===r&&this.parent.notify(_r,{option:this.parent.chartColl[t],isRefresh:!0})}},Wl.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)},Wl.prototype.destroy=function(){this.removeEventListener(),this.parent=null},Wl.prototype.getModuleName=function(){return"workbookChart"};var ql=Wl;function Wl(e){this.parent=e,this.addEventListener()}Yl.prototype.format=function(e){var t,r=this,n=e.range,i=(t=n&&"string"==typeof n&&-1<n.indexOf("!")?(i=n.lastIndexOf("!"),n=n.substring(i+1),this.parent.sheets[B(this.parent,e.range.substring(0,i))]):this.parent.getActiveSheet(),"object"!=typeof(n=void 0===n?t.selectedRange:n)&&e.onActionUpdate),o={range:n,style:Object.assign({},e.style),requestType:"CellFormat"},a=(e.borderType&&(o.borderType=e.borderType),{}),s="object"==typeof o.range?o.range:ne(te(o.range)),l=ti(se(s[0],s[1],t),de(t,s[1]),Nh(t,s[0])),h=!!de(t,s[1])&&de(t,s[1]).isReadOnly,d=!!Nh(t,s[0])&&Nh(t,s[0]).isReadOnly;if(Object.assign(a,o.style,null,!0),!i||l||h||d||(this.parent.trigger("beforeCellFormat",o),this.parent.notify("actionBegin",{eventArgs:o,action:"format"}),!o.cancel)){e.borderType&&(this.setTypedBorder(t,e.style.border,s,e.borderType,e.onActionUpdate),delete e.style.border,delete o.style.border);var p,c,u={cell:null,rowIdx:0,colIdx:0,eventOnly:!0,preventEvt:!i},f=function(e){return u.cell={style:e},u.rowIdx=k,u.colIdx=v,_n(r.parent,t,u)};if(void 0!==o.style.borderTop){for(v=s[1];v<=s[3];v++)k=s[0],f({borderTop:o.style.borderTop})||(e.isUndoRedo||(this.checkAdjacentBorder(t,"borderBottom",k-1,v),this.checkFullBorder(t,"borderBottom",k-1,v)),this.checkFullBorder(t,"borderTop",k,v),this.setCellBorder(t,u.cell.style,k,v,e.onActionUpdate,v===s[3],null,null,e.isUndoRedo));delete o.style.borderTop}if(void 0!==o.style.borderBottom){for(var g,m=void 0,v=s[1];v<=s[3];v++)m=0<(g=se(k=s[0],v,t,!1,!0)).rowSpan?se(s[2],s[1],t,!1,!0):se(s[2],s[3],t,!1,!0),1<g.rowSpan&&m.rowSpan<0||(k=s[2]),f({borderBottom:o.style.borderBottom})||(e.isUndoRedo||(this.checkAdjacentBorder(t,"borderTop",s[2]+1,v),this.checkFullBorder(t,"borderTop",s[2]+1,v)),this.checkFullBorder(t,"borderBottom",s[2],v),this.setCellBorder(t,u.cell.style,k,v,e.onActionUpdate,v===s[3],null,null,e.isUndoRedo),this.setBottomBorderPriority(t,s[2],v));delete o.style.borderBottom}if(void 0!==o.style.borderLeft){for(var y=s[0];y<=s[2];y++)v=s[1],f({borderLeft:o.style.borderLeft})||(e.isUndoRedo||(this.checkAdjacentBorder(t,"borderRight",y,v-1),this.checkFullBorder(t,"borderRight",y,v-1)),this.checkFullBorder(t,"borderLeft",y,v),this.setCellBorder(t,u.cell.style,y,v,e.onActionUpdate,null,null,null,e.isUndoRedo));delete o.style.borderLeft}if(void 0!==o.style.borderRight){for(var C=s[0];C<=s[2];C++)v=s[3],f({borderRight:o.style.borderRight})||(e.isUndoRedo||(this.checkAdjacentBorder(t,"borderLeft",C,v+1),this.checkFullBorder(t,"borderLeft",C,v+1)),this.checkFullBorder(t,"borderRight",C,v),this.setCellBorder(t,u.cell.style,C,v,e.onActionUpdate,null,null,null,e.isUndoRedo));delete o.style.borderRight}if(Object.keys(o.style).length)for(var b,x,S=this.parent,w=S.viewport&&this.parent.getActiveSheet().id===t.id,I=this.parent.frozenRowCount(t),E=this.parent.frozenColCount(t),N=[I+S.viewport.topIndex,E+S.viewport.leftIndex,S.viewport.bottomIndex,S.viewport.rightIndex],R=void 0,F=void 0,k=s[0];k<=s[2];k++)if(!(x=Nh(t,k)||{}).isFiltered)for(b=N[0]<=k&&k<=N[2]||k<I,R=!1,v=s[1];v<=s[3];v++)if(!f(o.style)){void 0===c&&(c=void 0!==o.style.border&&(p=o.style.border,delete o.style.border,!0));var O=se(k,v,t,!1,!0),A=de(t,v),T=Nh(t,k);if(!(O&&O.isReadOnly||A&&A.isReadOnly||T&&T.isReadOnly)){if(1<O.rowSpan||1<O.colSpan)for(var D=k,L=1<O.rowSpan?k+(O.rowSpan-1):k;D<=L;D++)for(var P=v,M=1<O.colSpan?v+(O.colSpan-1):v;P<=M;P++)c&&this.setFullBorder(t,p,s,D,P,e.onActionUpdate,!0),this.setCellStyle(t,D,P,o.style);c&&this.setFullBorder(t,p,s,k,v,e.onActionUpdate),this.setCellStyle(t,k,v,o.style),w&&(b&&(N[1]<=v&&v<=N[3]||v<E)?(F=null,o.style.color&&O.format&&O.format.includes("[")&&(A=_i(O.format))&&(F=A.toLowerCase()),this.parent.notify(Ft,{style:o.style,rowIdx:k,colIdx:v,lastCell:v===s[3],isHeightCheckNeeded:!0,manualUpdate:!0,onActionUpdate:e.onActionUpdate,formatColor:F})):x.customHeight||(R=R||Hn(o.style,e.onActionUpdate))&&this.parent.notify(Ft,{rowIdx:k,colIdx:v,lastCell:v===s[3],checkHeight:!0,outsideViewport:!b,onActionUpdate:e.onActionUpdate}))}}c&&(o.style.border=p),this.parent.setUsedRange(s[2],s[3]),e.refreshRibbon&&this.parent.notify(Pt,null),t.conditionalFormats&&t.conditionalFormats.length&&this.parent.notify(Br,{indexes:s}),!i||l||h||d||(o.style=a,o.range=t.name+"!"+n,this.parent.notify("actionComplete",{eventArgs:o,action:"format"}))}else e.cancel=!0},Yl.prototype.setBottomBorderPriority=function(e,t,r){var n;he(e,t+1)&&(n=this.skipHiddenRows(e,t+1),""!==this.parent.getCellStyleValue(["borderTop"],[n,r]).borderTop)&&(e.rows[t].cells[r].style.bottomPriority=!0)},Yl.prototype.setFullBorder=function(e,t,r,n,i,o,a){var s={};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),s.borderRight=t,s.borderTop=t,s.borderLeft=t,s.borderBottom=t,this.setCellBorder(e,s,n,i,o,i===r[3],null,a),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)},Yl.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))},Yl.prototype.checkFullBorder=function(e,t,r,n){var i,o=this.parent.getCellStyleValue(["border"],[r,n]).border;""!==o&&(i={border:void 0},["borderBottom","borderTop","borderLeft","borderRight"].forEach(function(e){e!==t&&(i[""+e]=o)}),this.setCellStyle(e,r,n,i))},Yl.prototype.textDecorationActionUpdate=function(e){var t=this.parent.getActiveSheet(),r={range:t.selectedRange,style:e.style,requestType:"CellFormat"},n=ne(te(t.selectedRange)),i=ti(se(n[0],n[1],t),de(t,n[1]),Nh(t,n[0])),o=!!de(t,n[1])&&de(t,n[1]).isReadOnly,a=!!Nh(t,n[0])&&Nh(t,n[0]).isReadOnly;if(i||o||a||(this.parent.trigger("beforeCellFormat",r),this.parent.notify("actionBegin",{eventArgs:r,action:"format"}),!r.cancel)){var s=e.style.textDecoration.toLowerCase(),l=s,h=te(t.activeCell),d=this.parent.getCellStyleValue(["textDecoration"],h).textDecoration.toLowerCase(),p=!1,c=("underline"===d?l="underline"===s?"none":"underline line-through":"line-through"===d?l="line-through"===s?"none":"underline line-through":"underline line-through"===d&&(l="underline"===s?"line-through":"underline",p=!0),"none"===l&&(p=!0),{textDecoration:l});this.format({style:c,range:h,refreshRibbon:e.refreshRibbon,onActionUpdate:!0});for(var u=n[0];u<=n[2];u++)for(var f=n[1];f<=n[3];f++)if(u!==h[0]||f!==h[1]){if(c={},"none"===(d=this.parent.getCellStyleValue(["textDecoration"],[u,f]).textDecoration.toLowerCase())){if(p)continue;c.textDecoration=s}else if("underline"===d||"line-through"===d)if(p){if(s!==d)continue;c.textDecoration="none"}else c.textDecoration=s!==d?"underline line-through":s;else if("underline line-through"===d){if(!p)continue;c.textDecoration="underline"===s?"line-through":"underline"}this.format({style:c,range:[u,f,u,f],refreshRibbon:e.refreshRibbon,onActionUpdate:!0})}i||o||a||(r.range=t.name+"!"+r.range,r.style.textDecoration=l,this.parent.notify("actionComplete",{eventArgs:r,action:"format"}))}else e.cancel=!0},Yl.prototype.setTypedBorder=function(e,t,r,n,i){if("Outer"===n){for(var o=r[1];o<=r[3];o++)this.checkAdjacentBorder(e,"borderBottom",r[0]-1,o),this.checkFullBorder(e,"borderBottom",r[0]-1,o),this.setCellBorder(e,{borderTop:t},r[0],o,i,o===r[3]),this.checkAdjacentBorder(e,"borderTop",r[2]+1,o),this.checkFullBorder(e,"borderTop",r[2]+1,o),this.setCellBorder(e,{borderBottom:t},r[2],o,i,o===r[3],n),this.setBottomBorderPriority(e,r[2],o);for(var a=r[0];a<=r[2];a++)this.checkAdjacentBorder(e,"borderRight",a,r[1]-1),this.checkFullBorder(e,"borderRight",a,r[1]-1),this.setCellBorder(e,{borderLeft:t},a,r[1],i),this.checkAdjacentBorder(e,"borderLeft",a,r[3]+1),this.checkFullBorder(e,"borderLeft",a,r[3]+1),this.setCellBorder(e,{borderRight:t},a,r[3],i,null,n)}else if("Inner"===n)for(var s=r[0];s<=r[2];s++)for(var l=r[1];l<=r[3];l++){var h,d={};""!==(h=this.parent.getCellStyleValue(["border"],[s,l]).border)&&(d.border=void 0,l!==r[3]&&l!==r[1]&&s!==r[0]&&s!==r[2]||(s===r[0]&&(d.borderTop=h),s===r[2]&&(d.borderBottom=h),l===r[3]&&(d.borderRight=h),l===r[1]&&(d.borderLeft=h))),l!==r[3]&&(d.borderRight=t),s!==r[0]&&(d.borderTop=t),s!==r[2]&&(d.borderBottom=t),l!==r[1]&&(d.borderLeft=t),this.setCellBorder(e,d,s,l,i,l===r[3])}else if("Vertical"===n)for(s=r[0];s<=r[2];s++)for(l=r[1];l<=r[3];l++){d={borderRight:t,borderLeft:t};l===r[1]&&(this.checkAdjacentBorder(e,"borderRight",s,l-1),this.checkFullBorder(e,"borderRight",s,l-1)),l===r[3]&&(this.checkAdjacentBorder(e,"borderLeft",s,l+1),this.checkFullBorder(e,"borderLeft",s,l+1)),this.setCellBorder(e,d,s,l,i)}else for(s=r[0];s<=r[2];s++)for(l=r[1];l<=r[3];l++){d={borderTop:t,borderBottom:t};s===r[0]&&(this.checkAdjacentBorder(e,"borderBottom",s-1,l),this.checkFullBorder(e,"borderBottom",s-1,l)),this.setCellBorder(e,d,s,l,i,l===r[3]),s===r[2]&&(this.checkAdjacentBorder(e,"borderTop",s+1,l),this.checkFullBorder(e,"borderTop",s+1,l),this.setBottomBorderPriority(e,s,l))}},Yl.prototype.setCellBorder=function(e,t,r,n,i,o,a,s,l){var h=se(r,n,e),d=de(e,n),p=Nh(e,r);h&&h.isReadOnly||d&&d.isReadOnly||p&&p.isReadOnly||(this.setCellStyle(e,r,n,t),s)||this.parent.getActiveSheet().id!==e.id||("Outer"===a&&(t.borderBottom||t.borderRight)&&(this.parent.notify(Dr,h={range:[r,n,r,n]}),r=h.range[0],n=h.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(Ft,{style:t,rowIdx:r,colIdx:n,onActionUpdate:i,first:"",lastCell:o,isHeightCheckNeeded:!0,manualUpdate:!0}))},Yl.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)},Yl.prototype.skipHiddenRows=function(e,t){return t=he(e,++t)?this.skipHiddenRows(e,t):t},Yl.prototype.addEventListener=function(){this.parent.on(Et,this.format,this),this.parent.on(Rt,this.textDecorationActionUpdate,this),this.parent.on(Hr,this.clearCellObj,this)},Yl.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(Et,this.format),this.parent.off(Rt,this.textDecorationActionUpdate),this.parent.off(Hr,this.clearCellObj))},Yl.prototype.clearCellObj=function(e){for(var t,r,n,i,o,a=e.range?e.range.lastIndexOf("!"):0,s=e.range?0<a?e.range.substring(a+1):e.range:this.parent.getActiveSheet().selectedRange,l=e.range&&0<a?B(this.parent,e.range.substring(0,a)):this.parent.activeSheetIndex,h=ae(this.parent,l),d=ne(P(s)),p=d[0],c=d[2],u=h.conditionalFormats&&h.conditionalFormats.length&&[].slice.call(h.conditionalFormats),f=[];p<=c;p++)for(n=d[1],i=d[3];n<=i;n++){var g=se(p,n,h),m=ti(g,de(h,n),Nh(h,p));if(g&&!m)switch(e.type){case"Clear Formats":delete g.format,delete g.rowSpan,delete g.style,delete g.wrap,delete g.colSpan,delete g.formattedText;break;case"Clear Contents":g.hyperlink&&this.parent.notify(Qr,{sheet:h,rowIdx:p,colIdx:n,preventRefresh:!0}),o=!(!g.value&&!g.formula),delete g.value,delete g.formula,delete g.formattedText,o&&(this.parent.notify(ie,r={action:"refreshCalculate",rowIndex:p,colIndex:n,sheetIndex:l}),u)&&!(t=t||r.isFormulaDependent)&&Yn(u,f,p,n);break;case"Clear Hyperlinks":delete g.hyperlink;break;case"Clear All":o=!(!g.value&&!g.formula),Vi(p,n,h,{},!1),o&&(this.parent.notify(ie,r={action:"refreshCalculate",rowIndex:p,colIndex:n,sheetIndex:l}),u)&&!t&&(t=r.isFormulaDependent)}}(f.length||t)&&l===this.parent.activeSheetIndex&&this.parent.notify(Br,{cfModel:!t&&f,refreshAll:t,isAction:!0})},Yl.prototype.destroy=function(){this.removeEventListener(),this.parent=null},Yl.prototype.getModuleName=function(){return"workbookcellformat"};var Gl=Yl;function Yl(e){this.parent=e,this.addEventListener()}Kl.prototype.destroy=function(){this.removeEventListener(),this.parent=null},Kl.prototype.addEventListener=function(){this.parent.on(Ot,this.performEditOperation,this)},Kl.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off(Ot,this.performEditOperation)},Kl.prototype.getModuleName=function(){return"workbookEdit"},Kl.prototype.performEditOperation=function(e){"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))},Kl.prototype.updateCellValue=function(e,t,r,n,i,o,a,s,l,h,d,p,c,u,f){void 0===r&&(r=this.parent.activeSheetIndex),g="string"==typeof e?te(e):e;var g,m,v=ae(this.parent,r),y=(y=se(g[0],g[1],v,!0))||(v.rows[g[0]].cells[g[1]]={});if(n)y.value=t,y.formattedText&&delete y.formattedText;else{var n=Q(t),n="#SPILL!"===t||n,C=!1,b=(y.formula&&-1<y.formula.indexOf("UNIQUE")&&""===t&&(C=!0),!("Text"===Ml(y.format)||n&&t.toLowerCase().startsWith("=text("))),f=((n="Text"!==Ml(y.format)&&n)||C||(y.formula&&(y.formula=""),y.value=b?li(t,f):t),{action:"refreshCalculate",value:t,rowIndex:g[0],colIndex:g[1],sheetIndex:r,isFormula:n,isRandomFormula:o,isDelete:s,deletedRange:l,fillType:h,isDependentRefresh:c});if(b&&!i&&(l={value:t,rowIndex:g[0],colIndex:g[1],sheetIndex:r,updatedVal:"",skipCellFormat:a},n?!ee.isNullOrUndefined(t)&&t.toLowerCase().includes("unique(")&&0<t.length&&(y.value=t):(this.parent.notify(At,l),!ee.isNullOrUndefined(l.updatedVal)&&0<l.updatedVal.length?y.value=l.updatedVal:this.parent.isEdit&&t&&!oe(t)&&(y.format?(h={value:y.value,format:y.format,formattedText:y.value,type:"General",cell:y,rowIndex:g[0],colIndex:g[1]},this.parent.notify(St,h)):(b=ee.getNumberDependable(this.parent.locale,ee.defaultCurrencyCode),(t.includes(b)||t.includes("%")||t.includes(ee.getNumericObject(this.parent.locale).group))&&(i=new ee.Internationalization,this.parent.notify(Tt,{args:{intl:i,updateValue:!0,value:"",curSymbol:b,cell:y},intl:i,fResult:t,cell:y})))))),"#SPILL!"===t)y.value=t;else if(this.parent.notify(_t,{cellIdx:g,isUnique:!1}),"Manual"===this.parent.calculationMode&&n&&ee.isNullOrUndefined(c)&&("autofill"!==u&&"FillSeries"!==u||"autofill"===u&&""!==y.formula)&&!this.parent.isEdit&&ee.isNullOrUndefined(this.parent.element.querySelector(".e-text-replaceInp"))&&(C=!0,p||void 0!==y.value||(C=!1)),C||s?t=y.value:(this.parent.notify(ie,f),m=f.isFormulaDependent),n){if(y.formula=f.value,!("Manual"===this.parent.calculationMode&&C&&p&&!this.parent.isEdit&&d&&d.cellDetails&&0<d.cellDetails.length&&0===d.cutCellDetails.length)||ee.isNullOrUndefined(d.cellDetails[0].autoFillText)&&ee.isNullOrUndefined(d.cellDetails[0].copyCellValue))t=y.value,"Manual"===this.parent.calculationMode&&d&&p&&d.displayText&&(t=y.value=d.displayText);else for(var x=0;x<d.cellDetails.length;x++)if(d.cellDetails[x].rowIndex===e[0]&&d.cellDetails[x].colIndex===e[1]){t=d.cellDetails[x].copyCellValue?y.value=d.cellDetails[x].copyCellValue:y.value=d.cellDetails[x].autoFillText;break}a=y.formula.toLowerCase();"=now()"!==a||y.format&&"General"!==y.format?a.includes("=time(")&&!y.format&&(y.format="h:mm AM/PM"):y.format=Pl("ShortDate")+" h:mm"}else!y.value||"string"!=typeof y.value||0!==y.value.indexOf("www.")&&0!==y.value.indexOf("https://")&&0!==y.value.indexOf("http://")&&0!==y.value.indexOf("ftp://")||this.parent.notify(tr,{hyperlink:y.value,cell:v.name+"!"+G(g[0],g[1])})}return this.parent.setUsedRange(g[0],g[1],v),!this.parent.chartColl.length||this.parent.isEdit||o||this.parent.notify(Wr,{cell:y,rIdx:g[0],cIdx:g[1],sheetIdx:r}),m};var Xl=Kl;function Kl(e){this.parent=e,this.addEventListener()}Zl.prototype.destroy=function(){this.removeEventListener(),this.parent=null},Zl.prototype.addEventListener=function(){this.parent.on(tr,this.setLinkHandler,this)},Zl.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off(tr,this.setLinkHandler)},Zl.prototype.setLinkHandler=function(e){var t=e.hyperlink;if((i=e.cell)&&-1!==i.indexOf("!")){var r=i.lastIndexOf("!"),n=ae(this.parent,B(this.parent,i.substring(0,r))),i=i.substring(r+1);if(!n)return}else n=this.parent.getActiveSheet(),i=i||n.selectedRange;var o=!e.triggerEvt&&n.isProtected;if(!o||n.protectSettings.insertLink)for(var a,s=ne(te(i)),l=("string"==typeof t?0===t.toLowerCase().indexOf("www.")&&(t="http://"+t):0===t.address.toLowerCase().indexOf("www.")&&(t.address="http://"+t.address),te(n.activeCell)),h=s[0];h<=s[2];h++)for(var d=s[1];d<=s[3];d++)o&&Mn(se(h,d,n),de(n,d))||(a={hyperlink:t},ee.isNullOrUndefined(e.displayText)||(!e.triggerEvt&&!e.isUndoRedo||h===l[0]&&d===l[1])&&(a.value=e.displayText,delete a.formattedText),a.style={textDecoration:"underline",color:"#00e"},_n(this.parent,n,{cell:a,rowIdx:h,colIdx:d,preventEvt:!e.triggerEvt}))},Zl.prototype.getModuleName=function(){return"workbookHyperlink"};var $l=Zl;function Zl(e){this.parent=e,this.addEventListener()}Ql.prototype.insertModel=function(e){var t,r=this;if(e.model){var n,i,o,a=[];if("number"==typeof e.start){n=e.start,e.end=e.end||n,n>e.end&&(n=e.end,e.end=e.start),"Row"===e.modelType&&n<e.model.maxHgts.length&&(o=[]);for(var s=n;s<=e.end;s++)a.push({}),o&&o.push(null)}else e.start?(n=e.start[0].index||0,a=e.start,i=!0):(n=0,a.push({})),"Row"===e.modelType&&n<e.model.maxHgts.length&&(o=[],a.forEach(function(){o.push(null)}));var l={model:a,index:n,modelType:e.modelType,insertType:e.insertType,cancel:!1,isUndoRedo:e.isUndoRedo},h={eventArgs:l,action:"insert"};if(e.isAction){if(this.parent.notify(gt,h),l.cancel)return;delete l.cancel,l.isAction=e.isAction}var d={startIndex:n,endIndex:n+a.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(pn,d),e.model=e.model,e.model.rows||(e.model.rows=[]),i&&-1<e.model.usedRange.rowIndex&&n>e.model.usedRange.rowIndex)for(s=e.model.usedRange.rowIndex;s<n-1;s++)a.splice(0,0,{});for(var p,c,u=this.parent.frozenRowCount(e.model),f=(n<u&&(this.parent.setSheetPropertyOnMute(e.model,"frozenRows",e.model.frozenRows+a.length),l.freezePane=!0),(u=e.model.rows).splice.apply(u,[n,0].concat(a)),o&&(u=e.model.maxHgts).splice.apply(u,[n,0].concat(o)),this.setRowColCount(d.startIndex,d.endIndex,e.model,"row"),n>e.model.usedRange.rowIndex?this.parent.setUsedRange(n+(a.length-1),e.model.usedRange.colIndex,e.model,!0):this.parent.setUsedRange(e.model.usedRange.rowIndex+a.length,e.model.usedRange.colIndex,e.model,!0),n+a.length),g=void 0,m=this,s=0;s<=e.model.usedRange.colIndex;s++)!function(t){e.model.rows[f]&&e.model.rows[f].cells&&e.model.rows[f].cells[t]&&void 0!==(g=e.model.rows[f].cells[t]).rowSpan&&g.rowSpan<0&&void 0===g.colSpan&&m.parent.notify(Lr,{range:[f,t,f,t],insertCount:a.length,insertModel:"Row"}),p=se(n-1,t,e.model,!1,!0).style,g=se(n+1,t,e.model,!1,!0),p&&(c={},Object.keys(p).forEach(function(e){"borderLeft"!==e&&"borderRight"!==e&&"borderTop"!==e&&"borderBottom"!==e&&(c[e]=p[e])}),g.style&&m.checkBorder(g.style,e.model.rows[n-1].cells[t].style,c),e.isUndoRedo||a.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,c)}))}(s);l.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(pn,d),e.model=e.model,e.model.columns||(e.model.columns=[]),n&&!e.model.columns[n-1]&&(e.model.columns[n-1]={}),(u=e.model.columns).splice.apply(u,[n,0].concat(a));var u=this.parent.frozenColCount(e.model),v=(n<u&&(this.parent.setSheetPropertyOnMute(e.model,"frozenColumns",e.model.frozenColumns+a.length),l.freezePane=!0),this.setRowColCount(d.startIndex,d.endIndex,e.model,"col"),n>e.model.usedRange.colIndex?this.parent.setUsedRange(e.model.usedRange.rowIndex,n+(a.length-1),e.model,!0):this.parent.setUsedRange(e.model.usedRange.rowIndex,e.model.usedRange.colIndex+a.length,e.model,!0),e.model.rows||(e.model.rows=[]),[]);e.columnCellsModel||(e.columnCellsModel=[]);for(s=0;s<a.length;s++)v.push(null);for(var y,C,b=[],g=void 0,s=0;s<=e.model.usedRange.rowIndex;s++){e.model.rows[s]?e.model.rows[s].cells||(e.model.rows[s].cells=[]):e.model.rows[s]={cells:[]},n&&!e.model.rows[s].cells[n-1]&&(e.model.rows[s].cells[n-1]={}),(t=e.model.rows[s].cells).splice.apply(t,[n,0].concat(e.columnCellsModel[s]&&e.columnCellsModel[s].cells?e.columnCellsModel[s].cells:v));f=n+a.length;if(e.model.rows[s].cells[f]&&void 0!==(g=e.model.rows[s].cells[f]).colSpan&&g.colSpan<0&&void 0===g.rowSpan&&b.push({range:[s,f,s,f],insertCount:v.length,insertModel:"Column"}),y=se(s,n-1,e.model,!1,!0).style,g=se(s,n+1,e.model,!1,!0),y&&(C={},Object.keys(y).forEach(function(e){"borderLeft"!==e&&"borderRight"!==e&&"borderTop"!==e&&"borderBottom"!==e&&(C[e]=y[e])}),g.style&&this.checkBorder(g.style,e.model.rows[s].cells[n-1].style,C),!e.isUndoRedo))for(var x=n;x<f;x++)e.model.rows[s].cells[x]||(e.model.rows[s].cells[x]={}),e.model.rows[s].cells[x].style||(e.model.rows[s].cells[x].style={}),Object.assign(e.model.rows[s].cells[x].style,C)}b.forEach(function(e){r.parent.notify(Lr,e)}),l.sheetCount=e.model.columns.length}else{if(void 0!==e.checkCount&&e.checkCount===this.parent.sheets.length)return;for(var S,w=a,u=Di(this.parent),d=e.isFromUpdateAction,s=0;s<w.length;s++)if(w[s].name)for(x=0;x<this.parent.sheets.length;x++)if(w[s].name===this.parent.sheets[x].name){w.splice(s,1),s--;break}if(!w.length)return;delete a[0].index,this.parent.createSheet(n,a),e.activeSheetIndex?(l.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),d&&this.parent.setProperties({activeSheetIndex:B(this.parent,u)},!0),a.forEach(function(e){i&&r.updateRangeModel(e.ranges);var t=r.parent.viewport,t={sheet:e,resolveAfterFullDataLoaded:!0,indexes:[t.topIndex,t.leftIndex,t.bottomIndex,t.rightIndex],promise:new Promise(function(e){e(void 0)})};r.parent.notify(ht,t),S=e.id,r.parent.notify(ie,{action:"addSheet",visibleName:e.name,sheetName:"Sheet"+S,sheetId:S})}),l.activeSheetIndex=e.activeSheetIndex,l.sheetCount=this.parent.sheets.length}"Sheet"!==e.modelType&&(this.insertConditionalFormats(e),this.parent.notify(ln,{start:n,end:n+a.length-1,modelType:e.modelType,model:e.model,isInsert:!0}),l.activeSheetIndex=B(this.parent,e.model.name)),this.parent.notify(ar,h)}},Ql.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(kt,{index:r[i]-1,update:n,isInsert:!0,start:e,end:t})},Ql.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")})},Ql.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)},Ql.prototype.setInsertInfo=function(e,t,r,n,i){void 0===i&&(i="Row");var o=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,o]):e.info["insert"+i+"Range"]=[[t,o]],e.info[""+n]+=o-t+1)})},Ql.prototype.insertConditionalFormats=function(e){var t=e.model.conditionalFormats;if("delete"===e.prevAction)this.parent.setSheetPropertyOnMute(e.model,"conditionalFormats",e.conditionalFormats);else if(t)for(var r=0,n=t.length;r<n;r++)t[r].range=re(Wn(e,te(t[r].range),!e.isAction&&!e.isUndoRedo))},Ql.prototype.addEventListener=function(){this.parent.on(lr,this.insertModel,this)},Ql.prototype.destroy=function(){this.removeEventListener(),this.parent=null},Ql.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off(lr,this.insertModel)},Ql.prototype.getModuleName=function(){return"workbookinsert"};var Jl=Ql;function Ql(e){this.parent=e,this.addEventListener()}th.prototype.deleteModel=function(e){var t=this,r=this.parent.sheets.length;if("Sheet"!==e.modelType||1!==r){var r=e.modelType.toLowerCase()+"s",n=(e.start=e.start,e.start>e.end&&(n=e.start,e.start=e.end,e.end=n),{startIndex:e.start,endIndex:e.end,modelType:e.modelType,cancel:!1,isUndoRedo:e.isUndoRedo}),i={eventArgs:n,action:"delete"};if(!e.isAction||(this.parent.notify(gt,i),!n.cancel)){var o,a,s=[],l=e.end-e.start+1,h={startIndex:e.start,endIndex:e.end,modelType:e.modelType,sheet:e.model,isDelete:!0},d=this.parent.scrollSettings.isFinite;if("Row"===e.modelType){if(void 0!==e.checkCount&&e.checkCount===e.model.usedRange.rowIndex)return;if(this.parent.notify(pn,h),e.model=e.model,d){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 p=this.parent.frozenRowCount(e.model),c=(e.start<p&&(p=e.end<p?e.end-e.start+1:p-e.start,p=e.model.frozenRows-p,this.parent.setSheetPropertyOnMute(e.model,"frozenRows",p),n.freezePane=!0),e.end+1),u=void 0,f=void 0;if(e.model.rows[e.start]&&e.model.rows[e.start].cells)for(var g=0;g<=e.model.usedRange.colIndex;g++)e.model.rows[e.start].cells[g]&&void 0!==e.model.rows[e.start].cells[g].rowSpan&&e.model.rows[e.start].cells[g].rowSpan<0&&void 0===e.model.rows[e.start].cells[g].colSpan&&(f={range:[e.start,g,e.start,g]},this.parent.notify(Dr,f),f.range,f.range[2]<=e.end)&&((a=se(f.range[0],g,e.model))&&1<a.rowSpan&&(1<a.rowSpan-(f.range[2]-e.start+1)?Vi(f.range[0],g,e.model,{colSpan:a.rowSpan-(f.range[2]-e.start+1)},!0):delete e.model.rows[f.range[0]].cells[g].rowSpan),f=null),e.model.rows[c]&&e.model.rows[c].cells&&e.model.rows[c].cells[g]&&void 0!==e.model.rows[c].cells[g].rowSpan&&e.model.rows[c].cells[g].rowSpan<0&&void 0===e.model.rows[c].cells[g].colSpan&&(f||this.parent.notify(Dr,f={range:[c,g,c,g]}),u=new Object,f.range=f.range,Object.assign(u,se(f.range[0],f.range[1],e.model)),u)&&u.rowSpan&&(1<u.rowSpan||1<u.colSpan)&&((v=[])[1]=g,v[3]=1<u.colSpan?g+(u.colSpan-1):g,f.range=f.range,f.range[0]<e.start?(v[0]=v[2]=f.range[0],1<u.rowSpan-l&&(v[2]+=u.rowSpan-l-1)):(v[0]=v[2]=e.start,1<u.rowSpan-(e.end-f.range[0]+1)&&(v[2]+=u.rowSpan-(e.end-f.range[0]+1)-1)),s.push({range:v,isAction:!1,preventRefresh:!0,merge:!0,type:"All",skipChecking:!0})),f=null;n.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(pn,h),e.model=e.model,d){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-l}),e.model.usedRange.colIndex<0)&&this.parent.setSheetPropertyOnMute(e.model,"usedRange",{rowIndex:e.model.usedRange.rowIndex,colIndex:0});for(var m,v,p=this.parent.frozenColCount(e.model),c=(e.start<p&&(p=e.end<p?e.end-e.start+1:p-e.start,p=e.model.frozenColumns-p,this.parent.setSheetPropertyOnMute(e.model,"frozenColumns",p),this.parent.updateTopLeftCell(),n.freezePane=!0),o=[],e.end+1),u=void 0,f=void 0,g=0;g<=e.model.usedRange.rowIndex;g++)o.push({}),e.model.rows[g]&&e.model.rows[g].cells&&(e.model.rows[g].cells[e.start]&&void 0!==e.model.rows[g].cells[e.start].colSpan&&e.model.rows[g].cells[e.start].colSpan<0&&void 0===e.model.rows[g].cells[e.start].rowSpan&&(f={range:[g,e.start,g,e.start]},this.parent.notify(Dr,f),f.range=f.range,f.range[3]<=e.end)&&((m=se(g,f.range[1],e.model))&&1<m.colSpan&&(1<m.colSpan-(f.range[3]-e.start+1)?Vi(g,f.range[1],e.model,{colSpan:m.colSpan-(f.range[3]-e.start+1)},!0):delete e.model.rows[g].cells[f.range[1]].colSpan),f=null),e.model.rows[g].cells[c]&&void 0!==e.model.rows[g].cells[c].colSpan&&e.model.rows[g].cells[c].colSpan<0&&void 0===e.model.rows[g].cells[c].rowSpan&&(f||this.parent.notify(Dr,f={range:[g,c,g,c]}),u=new Object,f.range=f.range,Object.assign(u,se(f.range[0],f.range[1],e.model)),u)&&u.colSpan&&(1<u.colSpan||1<u.rowSpan)&&((v=[])[0]=g,v[2]=1<u.rowSpan?g+(u.rowSpan-1):g,f.range=f.range,f.range[1]<e.start?(v[1]=v[3]=f.range[1],1<u.colSpan-l&&(v[3]+=u.colSpan-l-1)):(v[1]=v[3]=e.start,1<u.colSpan-(e.end-f.range[1]+1)&&(v[3]+=u.colSpan-(e.end-f.range[1]+1)-1)),s.push({range:v,isAction:!1,preventRefresh:!0,merge:!0,type:"All",skipChecking:!0})),o[g].cells=e.model.rows[g].cells.splice(e.start,l),f=null);n.sheetCount=e.model.usedRange.colIndex,n.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(pn,h),n.sheetCount=this.parent.sheets.length,n.activeSheetIndex=this.parent.activeSheetIndex}for(var y=[],C="Row"===e.modelType&&e.start<e.model.maxHgts.length,b=e.model[r],g=e.start;g<=e.end;g++)"Sheet"===e.modelType&&b[g]&&this.parent.notify(ie,{action:"deleteSheetTab",sheetId:b[g].id}),b[e.start]||e.start<b.length?(y.push(b[e.start]||{}),b.splice(e.start,1)):y.push({}),g===e.start&&(y[0].index=e.start),C&&e.model.maxHgts.splice(e.start,1);s.forEach(function(e){return t.parent.notify(Or,e)}),this.parent.notify(Jr,e),"Sheet"!==e.modelType&&(this.parent.notify(ln,e),n.refreshSheet=e.refreshSheet,n.activeSheetIndex=B(this.parent,e.model.name),n.conditionalFormats=[],this.deleteConditionalFormats(e,n)),n.definedNames=h.definedNames,n.isAction=e.isAction,n.deletedModel=y,delete n.cancel,this.parent.notify(sr,i)}}},th.prototype.setRowColCount=function(e,t,r,n){var i=n+"Count",o=r[i];(t=o<=t?o-1:t)<e||(this.parent.setSheetPropertyOnMute(r,i,o-(t-e+1)),r.id===this.parent.getActiveSheet().id&&this.parent.notify(kt,{index:o-1,update:n,isDelete:!0,start:e,end:t}))},th.prototype.deleteConditionalFormats=function(e,t){var r=e.model.conditionalFormats;if(r)for(var n=0;n<r.length;n++){t.conditionalFormats.push(ee.extend({},r[n],null,!0));var i=te(r[n].range),o=te(e.model.selectedRange);"Column"===e.modelType&&o[1]<=i[1]&&o[3]>=i[3]||"Row"===e.modelType&&o[0]<=i[0]&&o[2]>=i[2]?(r.splice(r.indexOf(r[n]),1),n--):r[n].range=re(Gn(e,i))}},th.prototype.addEventListener=function(){this.parent.on(hr,this.deleteModel,this)},th.prototype.destroy=function(){this.removeEventListener(),this.parent=null},th.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off(hr,this.deleteModel)},th.prototype.getModuleName=function(){return"workbookdelete"};var eh=th;function th(e){this.parent=e,this.addEventListener()}nh.prototype.destroy=function(){this.removeEventListener(),this.parent=null},nh.prototype.addEventListener=function(){this.parent.on(pr,this.validationHandler,this),this.parent.on(cr,this.addHighlightHandler,this),this.parent.on(Cr,this.removeHighlightHandler,this),this.parent.on(Zr,this.beforeInsertDeleteHandler,this),this.parent.on(Jr,this.beforeInsertDeleteHandler,this),this.parent.on(pn,this.beforeInsertDeleteHandler,this)},nh.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(pr,this.validationHandler),this.parent.off(cr,this.addHighlightHandler),this.parent.off(Cr,this.removeHighlightHandler),this.parent.off(Zr,this.beforeInsertDeleteHandler),this.parent.off(Jr,this.beforeInsertDeleteHandler),this.parent.off(pn,this.beforeInsertDeleteHandler))},nh.prototype.validationHandler=function(l){var h,d=this,e=l.range,t="",r=l.range.lastIndexOf("!"),p=(-1<r&&(e=l.range.substring(r+1),t=l.range.substring(0,r)),r=t?(r=B(this.parent,t),h=ae(this.parent,r),r===this.parent.activeSheetIndex):(h=this.parent.getActiveSheet(),!0),this.parent.dataValidationRange=(-1<this.parent.dataValidationRange.indexOf("!")?"":h.name+"!")+this.parent.dataValidationRange+e+",",this.getRangeWhenColumnSelected(e,h)),e=p.range;ee.isNullOrUndefined(t)||(l.range=t+"!"+e),l.range=l.range||h.selectedRange;for(var c,u,f,g,m=ne(te(l.range)),v=(l.viewport&&p.isFullCol&&(f=$n(this.parent,l.viewport)),!l.isRemoveValidation&&"List"===l.rules.type&&l.rules.value1&&(l.rules.value1=l.rules.value1.trim(),l.rules.value1[l.rules.value1.length-1]===this.parent.listSeparator)&&(l.rules.value1=l.rules.value1.substring(0,l.rules.value1.length-1)),ne(te(h.activeCell))),y=this,n=m[1];n<=m[3];n++)!function(r){if(p.isFullCol){var e;if(u=de(h,r),!l.isRemoveValidation)return t=Object.assign({},l.rules),e=Vn(n=[0,r,0,r],i=m,h,y.parent,{formula:l.rules.value1}),t.value1=e,ee.isNullOrUndefined(l.rules.value2)||""===l.rules.value2?"Custom"===l.rules.type&&delete t.value2:(a=Vn(n,i,h,y.parent,{formula:l.rules.value2}),t.value2=a),u.validation=t,r===v[1]&&(g="List"===u.validation.type);u&&u.validation&&(r===v[1]&&(g="List"===u.validation.type),delete u.validation,f)&&f.forEach(function(e){for(var t=e[0];t<=e[2];t++)c=se(t,r,h),d.parent.notify(Ft,{rowIdx:t,colIdx:r,style:d.parent.getCellStyleValue(["backgroundColor","color"],[t,r])})})}for(var t,n,i,o,a,s=m[0];s<=m[2];s++)l.isRemoveValidation?((u=de(h,r))&&u.validation&&(s===m[2]&&(u.validation.address=Pn(u.validation.address,[m[0],r,m[2],r],r)),y.parent.notify(Ft,{rowIdx:s,colIdx:r,style:y.parent.getCellStyleValue(["backgroundColor","color"],[s,r])})),(c=se(s,r,h))&&c.validation&&(s===v[0]&&r===v[1]&&(g="List"===c.validation.type),_n(y.parent,h,{cell:{validation:{}},rowIdx:s,colIdx:r})?g=!1:(delete c.validation,y.parent.notify(Ft,{rowIdx:s,colIdx:r,style:y.parent.getCellStyleValue(["backgroundColor","color"],[s,r])})))):(t=Object.assign({},l.rules),o=Vn(n=[s,r,s,r],i=m,h,y.parent,{formula:l.rules.value1}),t.value1=o,ee.isNullOrUndefined(l.rules.value2)||""===l.rules.value2?"Custom"===l.rules.type&&delete t.value2:(a=Vn(n,i,h,y.parent,{formula:l.rules.value2}),t.value2=a),c={validation:Object.assign({},t)},_n(y.parent,h,{cell:c,rowIdx:s,colIdx:r}),s===v[0]&&r===v[1]&&(g="List"===c.validation.type),s===m[2]&&(u=de(h,r))&&u.validation&&(u.validation.address=Pn(u.validation.address,[m[0],r,m[2],r],r)))}(n);r&&g&&(e=se(v[0],v[1],h,!1,!(t=void 0)),t=!l.isRemoveValidation&&((t=e.validation)||(u=de(h,v[1]))&&u.validation)||{},this.parent.notify(En,{validation:t,cell:e,rowIdx:v[0],colIdx:v[1],isRefresh:!0}))},nh.prototype.addHighlightHandler=function(e){this.invalidDataHandler(e.range,!1,e.td,e.isclearFormat)},nh.prototype.removeHighlightHandler=function(e){this.invalidDataHandler(e.range,!0)},nh.prototype.getRange=function(e){var t=te(e),r=this.parent.getActiveSheet(),n=r.colCount,r=r.rowCount;return t[2]===r-1&&0===t[0]?e=e.replace(/[0-9]/g,""):t[3]===n-1&&0===t[2]&&(e=e.replace(/\D/g,"")),e},nh.prototype.invalidDataHandler=function(e,t,r,n){for(var i=e?N(this.parent,e):this.parent.activeSheetIndex,o=ae(this.parent,i),a=(e=e||o.selectedRange).includes("!")?Ei(e):o.name,s=this.getRangeWhenColumnSelected(y(e),o),l=s.isFullCol,h=(e=a+"!"+s.range)?ne(te(e)):[],d=(e=this.getRange(e))?h[0]:0,p=e?h[2]:o.rows.length;d<=p;d++)if(o&&o.rows[d])for(var c=e?h[1]:0,u=e?h[3]:o.rows[d].cells.length;c<=u;c++){var f=void 0;if(o.rows[d].cells&&o.rows[d].cells[c]){var g=de(o,c),m=o.rows[d].cells[c];if(m&&m.validation){if(f=m.validation,n&&!f.isHighlighted)return;t?f.isHighlighted&&(m.validation.isHighlighted=!1):m.validation.isHighlighted=!0}else if(g&&g.validation){if(f=g.validation,n&&!f.isHighlighted)return;if(f.address&&!Hh(g,d,c))continue;t&&l?f.isHighlighted&&(g.validation.isHighlighted=!1):l&&(g.validation.isHighlighted=!0)}f&&this.parent.allowDataValidation&&(g={value:m.value||"",range:[d,c],sheetIdx:i,td:r,isValid:!0},this.parent.notify(dr,g),g.isValid||he(o,d)||i!==this.parent.activeSheetIndex||this.parent.notify($r,{isRemoveHighlightedData:t,rowIdx:d,colIdx:c,td:r}))}}},nh.prototype.beforeInsertDeleteHandler=function(n){var r,t=this;if("Sheet"===n.modelType){if(n.name!==pn)return;r=!0}else if(n.name===pn)return;var i,o,a,s,l=n.name===Zr;if(l)a=ae(this.parent,n.activeSheetIndex),o=n.index+(n.model.length-1),i={insertDeleteArgs:{startIndex:n.index,endIndex:o,modelType:n.modelType,isInsert:!0,sheet:a},sheetIdx:n.activeSheetIndex},s=n.index-1;else if(r){var e=[],h={action:"getSheetInfo",sheetInfo:[]};this.parent.notify(ie,h);for(var d=n.startIndex;d<=n.endIndex;d++)for(var p=this.parent.sheets[d].id,c=0;c<h.sheetInfo.length;c++)if(h.sheetInfo[c].index===p){e.push(h.sheetInfo[c].sheet);break}i={sheetNames:e}}else a=n.model,i={insertDeleteArgs:{startIndex:n.start,modelType:n.modelType,endIndex:n.end,sheet:a},sheetIdx:Ii(this.parent,a.id)};function u(e,t){if(e){i.insertDeleteArgs.forceUpdate=!0;for(var r=n.index;r<=o;r++)e=ee.extend({},e),x(e),t?Mh(a,r,{validation:e}):S?Vi(y,r,a,{validation:e},!0):Vi(r,C,a,{validation:e},!0);delete i.insertDeleteArgs.forceUpdate}}var f,g,m,v,y,C,b,x=function(e){!Q(e.value1)||i.otherSheet&&!e.value1.includes(a.name)||(i.cell={formula:e.value1},t.parent.notify(cn,i),e.value1=i.cell.formula),!Q(e.value2)||i.otherSheet&&!e.value2.includes(a.name)||(i.cell={formula:e.value2},t.parent.notify(cn,i),e.value2=i.cell.formula)},S="Column"===n.modelType;this.parent.sheets.forEach(function(e,t){if(r){if(t>=n.startIndex&&t<=n.endIndex)return}else t===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>=n.index&&C<=o))for((g=e.columns&&e.columns[C])&&g.validation&&(x(g.validation),b)&&S&&s===C&&u(g.validation,!0),y=0;y<m;y++)(f=se(y,C,e,!1,!0)).validation&&(!b||S||y<n.index||o<y)&&(x(f.validation),b)&&s===(S?C:y)&&u(f.validation)})},nh.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]=G(0,t.colCount-1).replace(/[0-9]/g,"")+n[1],e=n[0]+":"+n[1]),{range:e,isFullCol:r}},nh.prototype.getModuleName=function(){return"workbookDataValidation"};var rh=nh;function nh(e){this.parent=e,this.addEventListener()}var ih=function(){return(ih=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}).apply(this,arguments)},oh=(ah.prototype.destroy=function(){this.removeEventListener(),this.parent=null},ah.prototype.addEventListener=function(){this.parent.on(ur,this.find,this),this.parent.on(gr,this.replace,this),this.parent.on(mr,this.replaceAll,this),this.parent.on(xr,this.totalCount,this),this.parent.on(Nt,this.findAllValues,this)},ah.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(ur,this.find),this.parent.off(gr,this.replace),this.parent.off(mr,this.replaceAll),this.parent.off(xr,this.totalCount),this.parent.off(Nt,this.findAllValues))},ah.prototype.find=function(e){e.sheetIndex=ee.isUndefined(e.sheetIndex)?this.parent.activeSheetIndex:e.sheetIndex;var t,r=this.parent.sheets[e.sheetIndex],n=te(r.activeCell),n={startRow:n[0],startCol:n[1],findVal:e.isCSen?e.value:e.value.toLowerCase(),activeCell:n},i=(("By Row"===e.searchBy?n.startRow>r.usedRange.rowIndex:n.startCol>r.usedRange.colIndex)?"next"===e.findOpt?n.startRow=n.startCol=0:(n.startRow=r.usedRange.rowIndex,n.startCol=r.usedRange.colIndex):"By Row"===e.searchBy?n.startCol>r.usedRange.colIndex&&("next"===e.findOpt?(n.startRow++,n.startRow>r.usedRange.rowIndex&&(n.startRow=0),n.startCol=0):(n.startRow--,n.startRow<0&&(n.startRow=r.usedRange.rowIndex),n.startCol=r.usedRange.colIndex)):n.startRow>r.usedRange.rowIndex&&("next"===e.findOpt?(n.startCol++,n.startCol>r.usedRange.colIndex&&(n.startRow=0),n.startRow=0):(n.startCol--,n.startCol<0&&(n.startCol=r.usedRange.colIndex),n.startRow=r.usedRange.colIndex)),"Workbook"===e.mode?(n.sheets=this.parent.sheets,n.sheetIdx=e.sheetIndex):(n.sheets=[r],n.sheetIdx=0),e.showDialog&&this.parent.element&&this.parent.element.querySelector(".e-header-panel"));i&&(t=(i.offsetHeight||(r.showHeaders?30:0))+1),e.localeObj=ee.getNumericObject(this.parent.locale),"next"===e.findOpt?this.findNext(e,n):this.findPrevious(e,n),e.showDialog&&this.parent.notify(vt,{findValue:e.value,isPublic:!0,headerHgt:t})},ah.prototype.findNext=function(a,s){function e(e,t,r){for(var n,i,o=e;o<=t&&(n=s.sheets[o],!(i=o===s.sheetIdx?r?l.findNextOnSheet(a,s.startRow,s.startCol,s.findVal,n,void 0,s.activeCell):l.findNextOnSheet(a,0,0,s.findVal,n,"By Row"===a.searchBy?s.startRow:s.startCol):l.findNextOnSheet(a,0,0,s.findVal,n)));o++);return i}var l=this,t=e(s.sheetIdx,s.sheets.length-1,!0);(t=t||e(0,s.sheetIdx))?this.parent.notify(fr,{address:t}):this.parent.notify(vr,null)},ah.prototype.findNextOnSheet=function(e,t,r,n,i,o,a){var s;if("By Row"===e.searchBy){void 0===o&&(o=i.rows.length-1);for(var l,h=t;h<=o;h++)if(!he(i,h))for(p=a&&h===t?r:0,l=i.rows[h]&&i.rows[h].cells&&i.rows[h].cells.length;p<l;p++)if(!pe(i,p)&&(s=this.checkMatch(e,n,h,p,i,a)))return s}else{void 0===o&&(o=i.usedRange.colIndex);for(var d=i.rows&&i.rows.length-1,p=r;p<=o;p++)if(!pe(i,p))for(h=a&&p===r?t:0;h<=d;h++)if(!he(i,h)&&(s=this.checkMatch(e,n,h,p,i,a)))return s}return s},ah.prototype.findPrevious=function(a,s){function e(e,t,r){for(var n,i,o=e;t<=o&&(n=s.sheets[o],!(i=o===s.sheetIdx?r?l.findPrevOnSheet(a,s.startRow,s.startCol,0,0,s.findVal,n,s.activeCell):"By Row"===a.searchBy?l.findPrevOnSheet(a,n.usedRange.rowIndex,n.usedRange.colIndex,s.startRow,0,s.findVal,n):l.findPrevOnSheet(a,n.usedRange.rowIndex,n.usedRange.colIndex,0,s.startCol,s.findVal,n):l.findPrevOnSheet(a,n.usedRange.rowIndex,n.usedRange.colIndex,0,0,s.findVal,n)));o--);return i}var l=this,t=e(s.sheetIdx,0,!0);(t=t||e(s.sheets.length-1,s.sheetIdx))?this.parent.notify(fr,{address:t}):this.parent.notify(vr,null)},ah.prototype.findPrevOnSheet=function(e,t,r,n,i,o,a,s){var l,h,d;if("By Row"===e.searchBy){for(d=t;n<=d;d--)if(!he(a,d))for(h=s&&d===t?r:a.rows[d]&&a.rows[d].cells&&a.rows[d].cells.length-1;i<=h;h--)if(!pe(a,h)&&(l=this.checkMatch(e,o,d,h,a,s)))return l}else for(h=r;i<=h;h--)if(!pe(a,h))for(d=s&&h===r?t:a.rows&&a.rows.length-1;n<=d;d--)if(!he(a,d)&&(l=this.checkMatch(e,o,d,h,a,s)))return l;return l},ah.prototype.checkMatch=function(t,r,n,i,o,e){var a,s,l;return e&&n===e[0]&&i===e[1]||(e=se(n,i,o,!1,!0),o.isProtected&&!o.protectSettings.selectCells&&o.protectSettings.selectUnLockedCells&&Mn(e,de(o,i)))?null:(l=(a=function(e){if(e)if(t.isCSen||(e=e.toLowerCase()),t.isEMatch){if(e===r)return o.name+"!"+G(n,i)}else if(e.includes(r))return o.name+"!"+G(n,i);return null})(s=this.getDisplayText(e,n,i,t.localeObj)))||!(e=se(n,i,o,!1,!0)).format||Wi(e.format,!0)||s.includes("%")?l:a(this.getCellVal(e,t.localeObj))},ah.prototype.replace=function(r){var n=this,e=ee.isUndefined(r.sheetIndex)?this.parent.activeSheetIndex:r.sheetIndex,t=ae(this.parent,r.sheetIndex);if(t.isProtected)this.parent.notify(Rr,null);else{var i,o=te(r.address||t.activeCell),a=se(o[0],o[1],t,!1,!0),s=this.parent.getDisplayText(a).toString(),l=(r.value=r.value.toString(),r.isCSen||(i=r.value.toLowerCase()),ee.getNumericObject(this.parent.locale)),h=function(e){var t;return t=r.isCSen?r.isEMatch?s===r.value&&r.replaceValue:-1<s.indexOf(r.value)&&s.replace(r.value,r.replaceValue):r.isEMatch?s.toLowerCase()===i&&r.replaceValue:(t=RegExp,s.toLowerCase().includes(i)&&s.replace(new t(r.value.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"ig"),r.replaceValue)),e||d||!a.format||Wi(a.format,!0)||s.includes("%")||(s=n.getCellVal(a,l))&&(t=h(!0)),t},d=h();if(d||(r.findOpt="next",this.find(r),o=W(t.activeCell),a=se(o[0],o[1],t,!1,!0),s=this.parent.getDisplayText(a).toString(),d=h()))if(ti(se(o[0],o[1],t),de(t,o[1]),Nh(t,o[0])))this.parent.notify(Fr,null);else{e={address:t.name+"!"+G(o[0],o[1]),cancel:!1,compareValue:r.value,replaceValue:r.replaceValue,sheetIndex:e};if(r.isAction){if(this.parent.notify(gt,{action:"beforeReplace",eventArgs:e}),e.cancel)return;delete e.cancel}_n(this.parent,t,{cell:{value:d},rowIdx:o[0],colIdx:o[1],uiRefresh:!0,checkCF:!0,valChange:!0}),r.isAction&&this.parent.notify("actionComplete",{action:"replace",eventArgs:e})}}},ah.prototype.replaceAll=function(i){for(var e,t,n,r,o=this,a="Sheet"===i.mode?i.sheetIndex:0,s=this.parent.sheets[a],l=s.usedRange.rowIndex,h=0,d=s.usedRange.colIndex,p=0,c=[],u=i.isAction,f=ih({addressCollection:c,cancel:!1},i),g=function(r,n){requestAnimationFrame?requestAnimationFrame(function(){var e,t;!f.cancel&&f.addressCollection[n]&&(e=W(f.addressCollection[n].substring(f.addressCollection[n].lastIndexOf("!")+1)),t=N(o.parent,f.addressCollection[n]),_n(o.parent,o.parent.sheets[t],{cell:{value:r},rowIdx:e[0],uiRefresh:!0,checkCF:!0,colIdx:e[1],valChange:!0,skipFormatCheck:i.skipFormatCheck}),n===f.addressCollection.length-1)&&u&&o.parent.notify("actionComplete",{action:"replaceAll",eventArgs:f})}):o.parent.updateCell({value:r},f.addressCollection[n])},m=function(e){var t,r;return e&&(i.isCSen?i.isEMatch?e===i.value&&(g(i.replaceValue,c.length),c.push(s.name+"!"+G(h,p)),t=!0):-1<e.indexOf(i.value)&&(g(e.replace(i.value,i.replaceValue),c.length),c.push(s.name+"!"+G(h,p)),t=!0):i.isEMatch?e.toLowerCase()===i.value&&(g(i.replaceValue,c.length),c.push(s.name+"!"+G(h,p)),t=!0):(r=e.toLowerCase(),(e===i.value||-1<r.indexOf(i.value.toString().toLowerCase())||r===i.value||e===i.value||-1<r.indexOf(i.value))&&(r=RegExp,n=new r(i.value.toString().replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"ig"),g(e.replace(n,i.replaceValue),c.length),c.push(s.name+"!"+G(h,p)),t=!0))),t},v=ee.getNumericObject(this.parent.locale);h<=l+1;h++){if(d<p&&l<h&&"Workbook"===i.mode){if(a++,!(s=this.parent.sheets[a]))break;h=p=0,d=s.usedRange.colIndex,l=s.usedRange.rowIndex}if(t=s.rows[h])for(p===d+1&&(p=0);p<=d;p++)!t||!(r=t.cells&&t.cells[p])||ti(r,de(s,p),t)||m(e=this.getDisplayText(r,h,p,v).toString())||!r.format||Wi(r.format,!0)||e.includes("%")||m(this.getCellVal(t.cells[p],v))}c.length&&u&&(this.parent.notify("actionBegin",{action:"beforeReplaceAll",eventArgs:f}),f.cancel)||this.parent.notify(Er,{count:f.addressCollection.length,replaceValue:f.replaceValue})},ah.prototype.getDisplayText=function(e,t,r,n){var i;return e?e.value||0===e.value?(i=e.value.toString(),e.format||i.includes(n.dateSeparator)?(n={value:e.value,format:e.format,formattedText:e.value,cell:e,rowIndex:t,colIndex:r},this.parent.notify(St,n),n.formattedText):i):e.hyperlink?"string"==typeof e.hyperlink?e.hyperlink:e.hyperlink.address||"":"":""},ah.prototype.getCellVal=function(e,t){return oe(e.value)?"."!==t.decimal?e.value.toString().split(".").join(t.decimal):e.value.toString():e.value?e.value.toString().toLowerCase():""},ah.prototype.totalCount=function(e){var n,i=this,o=this.parent.sheets[e.sheetIndex],a=W(o.activeCell),s=0,l=0,h=e.value.toLowerCase(),d=ee.getNumericObject(this.parent.locale),t=(o.rows.filter(function(e,r){return e&&e.cells&&!e.isFiltered&&!e.hidden&&e.cells.filter(function(e,t){!e||!e.value&&0!==e.value||pe(o,t)||o.isProtected&&!o.protectSettings.selectCells&&Mn(e,de(o,t))||((n=i.getDisplayText(e,r,t,d).toLowerCase()).includes(h)||e.format&&!Wi(e.format,!0)&&!n.includes("%")&&i.getCellVal(e,d).includes(h))&&(s++,r===a[0]&&t>=a[1]||r>a[0])&&l++})}),s);0===(s=t<(s=t- --l)?t:s)||this.parent.getDisplayText(se(a[0],a[1],o)).toLowerCase().includes(h)||--s,e.findCount=s+" of "+t},ah.prototype.findAllValues=function(e){for(var t,r=e.sheetIndex,n=this.parent.sheets[r],i=n.usedRange.rowIndex,o=0,a=n.usedRange.colIndex,s=0,l=this.parent.sheets.length,h=e.sheetIndex;o<=i+1;o++){if(1!==h&&e.sheetIndex===l&&(r=1),i<o&&a<s&&"Workbook"===e.mode){if(h===(r=l-1<++r?0:r))return void 0;(n=this.parent.sheets[r])&&(s=o=0,a=n.usedRange.colIndex,i=n.usedRange.rowIndex)}if(!ee.isNullOrUndefined(n)&&n.rows[o]){var d,p,c,u,f=n.rows[o];for(s===a+2&&(s=0);s<=a+1;s++)f&&f.cells&&f.cells[s]&&(d=n.rows[o].cells[s])&&!ee.isNullOrUndefined(d.value)&&""!==d.value&&(!n.isProtected||n.protectSettings.selectCells||n.protectSettings.selectUnLockedCells&&!Mn(d,de(n,s)))&&(p=void 0,p=(d.format?this.parent.getDisplayText(n.rows[o].cells[s]):d.value).toString(),e.isCSen&&e.isEMatch?p===e.value&&(t=n.name+"!"+G(o,s),e.findCollection.push(t),0):e.isCSen&&!e.isEMatch?(u=-1<p.indexOf(e.value),p!==e.value&&!u||(t=n.name+"!"+G(o,s),e.findCollection.push(t),0)):!e.isCSen&&e.isEMatch?(c=p.toString().toLowerCase())===e.value.toLowerCase()&&(t=n.name+"!"+G(o,s),e.findCollection.push(t),0):e.isCSen||e.isEMatch||(u=-1<(c=p.toString().toLowerCase()).indexOf(e.value.toLowerCase()),c!==e.value&&p!==e.value&&!u&&p!==e.value)||(t=n.name+"!"+G(o,s),e.findCollection.push(t),0))}}},ah.prototype.getModuleName=function(){return"workbookfindAndReplace"},ah);function ah(e){this.parent=e,this.addEventListener()}lh.prototype.protectsheetHandler=function(e){var t=ee.isNullOrUndefined(e.sheetIndex)?this.parent.activeSheetIndex:e.sheetIndex,r=ae(this.parent,t);this.parent.setSheetPropertyOnMute(r,"isProtected",!0),this.parent.setSheetPropertyOnMute(r,"protectSettings",{selectCells:e.protectSettings.selectCells,formatCells:e.protectSettings.formatCells,formatColumns:e.protectSettings.formatColumns,formatRows:e.protectSettings.formatRows,insertLink:e.protectSettings.insertLink,selectUnLockedCells:e.protectSettings.selectUnLockedCells}),this.parent.notify(Sr,{sheetIndex:t,triggerEvent:e.triggerEvent}),this.parent.notify(wr,{props:"Protect"}),r.password=e.password||"",r.columns.forEach(function(e){e&&ee.isUndefined(e.isLocked)&&(e.isLocked=!0)})},lh.prototype.unprotectsheetHandler=function(e){var t=this.parent.getActiveSheet();(t=ee.isNullOrUndefined(e.sheet)?t:this.parent.sheets[e.sheet]).isImportProtected&&(t.isImportProtected=!1),t.protectSettings.formatCells=t.protectSettings.formatColumns=!1,t.protectSettings.formatRows=t.protectSettings.selectCells=!1,this.parent.setSheetPropertyOnMute(t,"isProtected",!1),this.parent.notify(Sr,t.protectSettings),this.parent.notify(wr,{props:"Protect"})},lh.prototype.destroy=function(){this.removeEventListener(),this.parent=null},lh.prototype.addEventListener=function(){this.parent.on(Ir,this.protectsheetHandler,this),this.parent.on(Nr,this.unprotectsheetHandler,this),this.parent.on(kr,this.lockCells,this)},lh.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(Ir,this.protectsheetHandler),this.parent.off(kr,this.lockCells),this.parent.off(Ir,this.unprotectsheetHandler))},lh.prototype.lockCells=function(e){var t=this.parent.getAddressInfo(e.range),r=ne(t.indices),n=ae(this.parent,t.sheetIndex),i=e.isLocked||!1;if(0===r[0]&&r[2]===n.rowCount-1)for(var o=r[1];o<=r[3];o++)Mh(n,o,{isLocked:e.isLocked});for(o=r[0];o<=r[2];o++)for(var a=r[1];a<=r[3];a++)Vi(o,a,n,{isLocked:i},!0);e.triggerEvent&&this.parent.notify("actionComplete",{action:"lockCells",eventArgs:e})},lh.prototype.getModuleName=function(){return"workbookProtectSheet"};var sh=lh;function lh(e){this.parent=e,this.addEventListener()}dh.prototype.merge=function(e){e.sheetIndex=ee.isUndefined(e.sheetIndex)?this.parent.activeSheetIndex:e.sheetIndex,e.isAction&&(this.parent.notify("actionBegin",{eventArgs:e,action:"merge"}),e.model||(e.model=[])),"string"==typeof e.range&&(e.range=te(e.range));var t=e.range=ne(e.range);if(e.skipChecking||this.mergedRange(e),e.merge&&"All"!==e.type){if("Horizontally"===e.type)for(var r=e.range[0],n=e.range[2];r<=n;r++)e.range=[r,t[1],r,t[3]],this.mergeAll(e,r-t[0]);else if("Vertically"===e.type)for(var i=e.range[1],n=e.range[3];i<=n;i++)e.range=[t[0],i,t[2],i],this.mergeAll(e,0,i-t[1])}else this.mergeAll(e),e.refreshRibbon&&this.parent.notify(Pt,null);e.range=t,this.parent.setUsedRange(e.range[2],e.range[3]),e.isAction&&this.parent.notify("actionComplete",{eventArgs:e,action:"merge"}),e.sheetIndex===this.parent.activeSheetIndex&&(this.parent.notify("selectRange",{address:ae(this.parent,e.sheetIndex).selectedRange,skipChecking:!0}),this.parent.chartColl)&&this.parent.chartColl.length&&this.parent.notify(Wr,{range:e.range})},dh.prototype.mergeAll=function(e,t,r){void 0===t&&(t=0),void 0===r&&(r=0);for(var n,i,o,a,s=0,l=(e.range=e.range,ee.isUndefined(e.sheetIndex)?this.parent.getActiveSheet():ae(this.parent,e.sheetIndex)),h={cell:new Object,rowIdx:e.range[0],colIdx:e.range[1],valChange:!e.merge,preventEvt:!0,uiRefresh:!e.preventRefresh,skipFormatCheck:!0},d=e.range[0],p=t;d<=e.range[2];d++,p++){n=0,e.isAction&&!e.model[p]&&e.model.push({cells:[]});for(var c,u,f,g=e.range[1],m=r;g<=e.range[3];g++,m++){if((f=se(d,g,l))&&(f.value||0===f.value||f.formula)&&!i&&(i=f.formula||f.value,a=f.format),e.isAction&&e.merge&&(c=e.model[p].cells[m]={},ee.extend(c,f,null,!0)),f&&(delete f.rowSpan,delete f.colSpan,c=!e.merge&&!e.isAction&&e.model&&e.model[p]&&e.model[p].cells[m],u="Manual"===this.parent.calculationMode&&this.parent.getActiveSheet().isSheetCalculated&&!ee.isNullOrUndefined(f.value)&&""!==f.value,c?(u&&(c.value=f.value),Vi(d,g,l,c)):e.model&&e.model[p].cells[m]&&u&&(e.model[p].cells[m].value=f.value)),d===e.range[0]&&g===e.range[1]){if(e.merge){0<e.range[3]-e.range[1]&&(h.cell.colSpan=e.range[3]-e.range[1]+1),0<e.range[2]-e.range[0]&&(h.cell.rowSpan=e.range[2]-e.range[0]+1),_n(this.parent,l,h),h.valChange=h.mergedCells=!0;continue}}else h.rowIdx=d,h.colIdx=g,h.cell={},e.merge&&(d!==e.range[0]&&(h.cell.rowSpan=-s),g!==e.range[1])&&(n++,h.cell.colSpan=-n);_n(this.parent,l,h),o=o||h.isFormulaDependent}s++}e.merge&&(i||0===i?(delete h.mergedCells,h.cell={},(t=se(e.range[0],e.range[1],l))&&(t.value||t.formula)||(Q(i)?h.cell.formula=i:h.cell.value=i,a&&(h.cell.format=a)),h.rowIdx=e.range[0],h.colIdx=e.range[1],_n(this.parent,l,h)):e.preventRefresh||this.parent.notify(Ar,{rowIdx:e.range[0],colIdx:e.range[1]})),e.preventRefresh||this.refreshCF(l,e.range[0],e.range[1],o)},dh.prototype.refreshCF=function(e,t,r,n){e.conditionalFormats&&e.conditionalFormats.length&&this.parent.notify(Br,{indexes:[t,r],refreshAll:n,isAction:!0})},dh.prototype.activeCellRange=function(e){e.range=e.range;var t=this.parent.getActiveSheet(),r=se(e.range[0],e.range[1],t);r&&(!ee.isNullOrUndefined(r.rowSpan)&&r.rowSpan<0&&(e.range[0]+=r.rowSpan,e.insertCount)&&(e.range[0]-=e.insertCount),!ee.isNullOrUndefined(r.colSpan)&&r.colSpan<0&&(e.range[1]+=r.colSpan,e.insertCount)&&(e.range[1]-=e.insertCount),r=se(e.range[0],e.range[1],t))&&(1<r.rowSpan&&(e.range[0]+(r.rowSpan-1)>=e.range[2]||e.insertCount)&&(e.range[2]=e.range[0]+(r.rowSpan-1)),1<r.colSpan)&&(e.range[1]+(r.colSpan-1)>=e.range[3]||e.insertCount)&&(e.range[3]=e.range[1]+(r.colSpan-1))},dh.prototype.mergedRange=function(e){"string"==typeof e.range&&(e.range=te(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)},dh.prototype.forward=function(e){e.range=e.range;var t,r,n=ee.isUndefined(e.sheetIndex)?this.parent.getActiveSheet():ae(this.parent,e.sheetIndex),i=se(e.range[0],e.range[1],n),o=t=e.range[0],a=r=e.range[1];if((i=i&&se(o=!ee.isNullOrUndefined(i.rowSpan)&&i.rowSpan<0?t=e.range[0]+i.rowSpan:o,a=!ee.isNullOrUndefined(i.colSpan)&&i.colSpan<0?r=e.range[1]+i.colSpan:a,n))&&(1<i.rowSpan&&(t+=i.rowSpan-1,o+(i.rowSpan-1)>=e.range[2])&&(e.range[2]=e.range[0],e.range[2]=o+(i.rowSpan-1)),1<i.colSpan)&&(r+=i.colSpan-1,a+(i.colSpan-1)>=e.range[3])&&(e.range[3]=e.range[1],e.range[3]=a+(i.colSpan-1)),e.range[0]=o,e.range[1]=a,e.range[0]===o&&e.range[1]===a&&e.range[2]===t&&e.range[3]===r&&(e.isActiveCell=!0),!e.skipChecking){for(var s,l,h=e.range[1];h<=e.range[3];h++)(i=se(e.range[2],h,n))&&(o=e.range[2],a=h,!ee.isNullOrUndefined(i.colSpan)&&i.colSpan<0&&(a+=i.colSpan)<e.range[1]&&(e.range[1]=a),!ee.isNullOrUndefined(i.rowSpan)&&i.rowSpan<0&&(o+=i.rowSpan)<e.range[0]&&(e.range[0]=o),i=se(o,a,n))&&(1<i.colSpan&&a+(i.colSpan-1)>e.range[3]&&(e.range[3]=a,e.range[3]=a+(i.colSpan-1)),1<i.rowSpan)&&o+(i.rowSpan-1)>e.range[2]&&(e.range[2]=o,e.range[2]=o+(i.rowSpan-1));for(h=e.range[1];h<=e.range[3];h++)(i=se(e.range[0],h,n))&&(l=h,s=e.range[0],!ee.isNullOrUndefined(i.colSpan)&&i.colSpan<0&&(l+=i.colSpan)<e.range[1]&&(e.range[1]=l),!ee.isNullOrUndefined(i.rowSpan))&&i.rowSpan<0&&(s+=i.rowSpan)<e.range[0]&&(e.range[0]=s);for(h=e.range[0];h<=e.range[2];h++)(i=se(h,e.range[3],n))&&(o=h,a=e.range[3],!ee.isNullOrUndefined(i.rowSpan)&&i.rowSpan<0&&(o+=i.rowSpan)<e.range[0]&&(e.range[0]=o),!ee.isNullOrUndefined(i.colSpan)&&i.colSpan<0&&(a+=i.colSpan)<e.range[1]&&(e.range[1]=a),i=se(o,a,n))&&(1<i.rowSpan&&o+(i.rowSpan-1)>e.range[2]&&(e.range[2]=o,e.range[2]=o+(i.rowSpan-1)),1<i.colSpan)&&a+(i.colSpan-1)>e.range[3]&&(e.range[3]=a,e.range[3]=a+(i.colSpan-1))}},dh.prototype.forwardReverse=function(e){var t=this.parent.getActiveSheet(),r=(e.range=e.range,e.range[1]),n=se(e.range[0],e.range[1],t),i=e.range[0];if(n&&(!ee.isNullOrUndefined(n.colSpan)&&n.colSpan<0&&(r+=n.colSpan,e.range[3]>=r)&&(e.range[3]=r),!ee.isNullOrUndefined(n.rowSpan)&&n.rowSpan<0&&(i+=n.rowSpan)<e.range[0]&&(e.range[0]=i),n=se(i,r,t))&&(1<n.rowSpan&&i+(n.rowSpan-1)>=e.range[2]&&(e.range[2]=i+(n.rowSpan-1)),1<n.colSpan)&&r+(n.colSpan-1)>=e.range[1]&&(e.range[1]=r+(n.colSpan-1)),e.range[0]=i,!e.skipChecking){for(var o,a,s,l=e.range[3];l<=e.range[1];l++)(n=se(e.range[2],l,t))&&(a=l,o=e.range[2],!ee.isNullOrUndefined(n.rowSpan)&&n.rowSpan<0&&(o+=n.rowSpan)<e.range[0]&&(e.range[0]=o),!ee.isNullOrUndefined(n.colSpan)&&n.colSpan<0&&(a+=n.colSpan)<e.range[3]&&(e.range[3]=a),n=se(o,a,t))&&(1<n.rowSpan&&o+(n.rowSpan-1)>e.range[2]&&(e.range[2]=o+(n.rowSpan-1)),1<n.colSpan)&&a+(n.colSpan-1)>e.range[1]&&(e.range[1]=a+(n.colSpan-1));for(var h,l=e.range[3];l<=e.range[1];l++)(n=se(e.range[0],l,t))&&(a=l,s=e.range[0],!ee.isNullOrUndefined(n.rowSpan)&&n.rowSpan<0&&(s+=n.rowSpan)<e.range[0]&&(e.range[0]=s),!ee.isNullOrUndefined(n.colSpan)&&n.colSpan<0&&(a+=n.colSpan),n=se(s,a,t))&&(1<n.rowSpan&&s+(n.rowSpan-1)>e.range[2]&&(e.range[2]=s+(n.rowSpan-1)),1<n.colSpan)&&a+(n.colSpan-1)>e.range[1]&&(e.range[1]=a,e.range[1]=a+(n.colSpan-1));for(l=e.range[0];l<=e.range[2];l++)(n=se(l,e.range[3],t))&&(s=l,h=e.range[3],!ee.isNullOrUndefined(n.rowSpan)&&n.rowSpan<0&&(s+=n.rowSpan)<e.range[0]&&(e.range[0]=s),!ee.isNullOrUndefined(n.colSpan)&&n.colSpan<0&&(h+=n.colSpan)<e.range[3]&&(e.range[3]=h),n=se(s,h,t))&&(1<n.rowSpan&&s+(n.rowSpan-1)>e.range[2]&&(e.range[2]=s,e.range[2]=s+(n.rowSpan-1)),1<n.colSpan)&&h+(n.colSpan-1)>e.range[1]&&(e.range[1]=h,e.range[1]=h+(n.colSpan-1))}},dh.prototype.reverse=function(e){e.range=e.range;var t=e.range[1],r=ee.isUndefined(e.sheetIndex)?this.parent.getActiveSheet():ae(this.parent,e.sheetIndex),n=se(e.range[0],e.range[1],r),i=e.range[0],o=(n&&(!ee.isNullOrUndefined(n.colSpan)&&n.colSpan<0&&(t+=n.colSpan),!ee.isNullOrUndefined(n.rowSpan)&&n.rowSpan<0&&(i+=n.rowSpan),e.range[2]>=i&&(e.range[2]=i,e.isActiveCell=!0),e.range[3]>=t?(e.range[3]=t,e.range[2]===i&&(e.isActiveCell=!0)):e.isActiveCell&&(e.isActiveCell=!1),n=se(i,t,r))&&(1<n.rowSpan&&i+(n.rowSpan-1)>=e.range[0]&&(e.range[0]=i,e.range[0]=i+(n.rowSpan-1)),1<n.colSpan)&&t+(n.colSpan-1)>=e.range[1]&&(e.range[1]=t,e.range[1]=t+(n.colSpan-1)),e.range[3]);if(!e.skipChecking){for(var a=e.range[3];a<=e.range[1];a++)(n=se(e.range[2],a,r))&&(o=a,i=e.range[2],!ee.isNullOrUndefined(n.rowSpan)&&n.rowSpan<0&&(i+=n.rowSpan)<e.range[2]&&(e.range[2]=i),!ee.isNullOrUndefined(n.colSpan)&&n.colSpan<0&&(o+=n.colSpan)<e.range[3]&&(e.range[3]=o),n=se(i,o,r))&&(1<n.rowSpan&&i+(n.rowSpan-1)>e.range[0]&&(e.range[0]=i,e.range[0]=i+(n.rowSpan-1)),1<n.colSpan)&&o+(n.colSpan-1)>e.range[1]&&(e.range[1]=o,e.range[1]=o+(n.colSpan-1));for(var s,l,o=e.range[3],a=e.range[3];a<=e.range[1];a++)(n=se(e.range[0],a,r))&&(o=a,i=e.range[0],!ee.isNullOrUndefined(n.colSpan)&&n.colSpan<0&&(o+=n.colSpan),!ee.isNullOrUndefined(n.rowSpan)&&n.rowSpan<0&&(i+=n.rowSpan),n=se(i,o,r))&&(1<n.colSpan&&o+(n.colSpan-1)>e.range[1]&&(e.range[1]=o,e.range[1]=o+(n.colSpan-1)),1<n.rowSpan)&&i+(n.rowSpan-1)>e.range[0]&&(e.range[0]=i,e.range[0]=i+(n.rowSpan-1));for(a=e.range[2];a<=e.range[0];a++)(n=se(a,e.range[3],r))&&(l=a,s=e.range[3],!ee.isNullOrUndefined(n.rowSpan)&&n.rowSpan<0&&(l+=n.rowSpan)<e.range[2]&&(e.range[2]=l),!ee.isNullOrUndefined(n.colSpan)&&n.colSpan<0&&(s+=n.colSpan)<e.range[3]&&(e.range[3]=s),n=se(l,s,r))&&(1<n.rowSpan&&l+(n.rowSpan-1)>e.range[0]&&(e.range[0]=l,e.range[0]=l+(n.rowSpan-1)),1<n.colSpan)&&s+(n.colSpan-1)>e.range[1]&&(e.range[1]=s,e.range[1]=s+(n.colSpan-1))}},dh.prototype.reverseForward=function(e){e.range=e.range;var t=ee.isUndefined(e.sheetIndex)?this.parent.getActiveSheet():ae(this.parent,e.sheetIndex),r=e.range[0],n=e.range[1],i=se(e.range[0],e.range[1],t);if(i&&(!ee.isNullOrUndefined(i.rowSpan)&&i.rowSpan<0&&(r+=i.rowSpan,e.range[2]>=r)&&(e.range[2]=r),!ee.isNullOrUndefined(i.colSpan)&&i.colSpan<0&&(n+=i.colSpan),i=se(r,n,t))&&(1<i.rowSpan&&r+(i.rowSpan-1)>=e.range[0]&&(e.range[0]=r,e.range[0]=r+(i.rowSpan-1)),1<i.colSpan)&&n+(i.colSpan-1)>=e.range[3]&&(e.range[3]=e.range[1],e.range[3]=n+(i.colSpan-1)),!e.skipChecking){for(var o,a,s,l=e.range[3],h=e.range[1];h<=e.range[3];h++)(i=se(e.range[2],h,t))&&(o=e.range[2],l=h,!ee.isNullOrUndefined(i.rowSpan)&&i.rowSpan<0&&(o+=i.rowSpan)<e.range[2]&&(e.range[2]=o),!ee.isNullOrUndefined(i.colSpan)&&i.colSpan<0&&(l+=i.colSpan)<e.range[1]&&(e.range[1]=l),i=se(o,l,t))&&(1<i.colSpan&&l+(i.colSpan-1)>e.range[3]&&(e.range[3]=l+(i.colSpan-1)),1<i.rowSpan)&&i.rowSpan-1+o>e.range[0]&&(e.range[0]=i.rowSpan-1+o);for(var d,h=e.range[1];h<=e.range[3];h++)(i=se(e.range[0],h,t))&&(s=h,a=e.range[0],!ee.isNullOrUndefined(i.colSpan)&&i.colSpan<0&&(s+=i.colSpan)<e.range[1]&&(e.range[1]=s),!ee.isNullOrUndefined(i.rowSpan)&&i.rowSpan<0&&(a+=i.rowSpan),i=se(a,s,t))&&1<i.rowSpan&&a+(i.rowSpan-1)>e.range[0]&&(e.range[0]=a+(i.rowSpan-1));for(h=e.range[2];h<=e.range[0];h++)(i=se(h,e.range[3],t))&&(o=h,d=e.range[3],!ee.isNullOrUndefined(i.rowSpan)&&i.rowSpan<0&&(o+=i.rowSpan)<e.range[2]&&(e.range[2]=o),!ee.isNullOrUndefined(i.colSpan)&&i.colSpan<0&&(d+=i.colSpan)<e.range[1]&&(e.range[1]=d),i=se(o,d,t))&&(1<i.rowSpan&&i.rowSpan-1+o>e.range[0]&&(e.range[0]=i.rowSpan-1+o),1<i.colSpan)&&i.colSpan-1+d>e.range[3]&&(e.range[3]=d,e.range[3]=i.colSpan-1+d)}},dh.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)},dh.prototype.addEventListener=function(){this.parent.on(Or,this.merge,this),this.parent.on(Tr,this.mergedRange,this),this.parent.on(Dr,this.activeCellRange,this),this.parent.on(Lr,this.insertHandler,this)},dh.prototype.destroy=function(){this.removeEventListener(),this.parent=null},dh.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(Or,this.merge),this.parent.off(Tr,this.mergedRange),this.parent.off(Dr,this.activeCellRange),this.parent.off(Lr,this.insertHandler))},dh.prototype.getModuleName=function(){return"workbookmerge"};var hh=dh;function dh(e){this.parent=e,this.addEventListener()}ch.prototype.destroy=function(){this.removeEventListener(),this.parent=null},ch.prototype.addEventListener=function(){this.parent.on(Mr,this.setCFRule,this),this.parent.on(Ur,this.clearCFRule,this)},ch.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(Mr,this.setCFRule),this.parent.off(Ur,this.clearCFRule))},ch.prototype.setCFRule=function(e){var t=e.cfModel,r=void 0===e.sheetIdx?N(this.parent,t.range):e.sheetIdx,n=ae(this.parent,r),i=ne(te(t.range||n.selectedRange));if(t.range=re(i),e.isAction){var o={range:t.range,type:t.type,cancel:!1,cFColor:t.cFColor,value:t.value,sheetIdx:r};if(this.parent.notify(gt,{eventArgs:o,action:"conditionalFormat"}),o.cancel)return;t.type=o.type,t.cFColor=o.cFColor,t.value=o.value,o.range!==t.range&&(t.range=o.range,i=ne(te(o.range))),delete o.cancel}n.conditionalFormats||this.parent.setSheetPropertyOnMute(n,"conditionalFormats",[]),n.conditionalFormats.push(t),r!==this.parent.activeSheetIndex?e.isUndoRedo&&!e.isFromUpdateAction&&this.parent.notify(fr,{address:n.name+"!"+t.range}):this.parent.notify(Br,{cfModel:[t],isAction:!0}),this.parent.setUsedRange(i[2],i[3]),e.isAction&&this.parent.notify("actionComplete",{eventArgs:{range:t.range,type:t.type,cFColor:t.cFColor,value:t.value,sheetIdx:r},action:"conditionalFormat"})},ch.prototype.clearCFRule=function(e){void 0===e.sheetIdx&&(e.sheetIdx=this.parent.activeSheetIndex);var t,r=ae(this.parent,e.sheetIdx),n=r.conditionalFormats,i=n&&n[n.length-1]&&"autofillWithCF"!==n[n.length-1].action;if(e.isUndo)e.updatedCFModel&&e.updatedCFModel.forEach(function(e){-1<(t=n.indexOf(e))&&n.splice(t,1)}),n.splice.apply(n,[n.length,0].concat(e.oldCFModel)),this.parent.notify(Br,{cfModel:e.oldCFModel,isAction:!0}),e.sheetIdx!==this.parent.activeSheetIndex&&this.parent.notify(fr,{address:r.name+"!"+e.range});else if(n&&n.length){for(var o,a,s,l,h,d,p,c=e.range&&("string"==typeof e.range?te(e.range):e.range),u=(e.oldCFModel=[],e.updatedCFModel=[],[]),f=[],g=[],m=0;m<n.length;m++){for(var v,y=(v=n[m]).range.split(","),C=0;C<y.length;C++){if(o=te(y[C]),e.range)if(c[0]<=o[0]&&c[1]<=o[1]&&c[2]>=o[2]&&c[3]>=o[3])y.splice(C,1),C--;else{if(h=c[0]>=o[0]&&c[0]<=o[2],d=c[2]>=o[0]&&c[2]<=o[2],s=c[1]>=o[1]&&c[1]<=o[3],l=c[3]>=o[1]&&c[3]<=o[3],a=[],h&&d?((s||l||c[1]<o[1]&&c[3]>o[3])&&(0<c[0]-o[0]&&a.push(re([o[0],o[1],c[0]-1,o[3]])),0<o[2]-c[2])&&a.push(re([c[2]+1,o[1],o[2],o[3]])),s&&c[1]!==o[1]&&a.push(re([c[0],o[1],c[2],c[1]-1])),l&&c[3]!==o[3]&&a.push(re([c[0],c[3]+1,c[2],o[3]]))):s&&l?((h||d||c[0]<o[0]&&c[2]>o[2])&&(0<c[1]-o[1]&&a.push(re([o[0],o[1],o[2],c[1]-1])),0<o[3]-c[3])&&a.push(re([o[0],c[3]+1,o[2],o[3]])),h?c[0]!==o[0]&&a.push(re([o[0],c[1],c[0]-1,c[3]])):d&&c[2]!==o[2]&&a.push(re([c[2]+1,c[1],o[2],c[3]]))):(h||d)&&(s?(c[1]!==o[1]&&a.push(re([o[0],o[1],o[2],c[1]-1])),0<c[0]-o[0]?a.push(re([o[0],c[1],c[0]-1,o[3]])):0<o[2]-c[2]&&a.push(re([c[2]+1,c[1],o[2],o[3]]))):l&&(c[3]!==o[3]&&a.push(re([o[0],c[3]+1,o[2],o[3]])),0<c[0]-o[0]?a.push(re([o[0],o[1],c[0]-1,c[3]])):0<o[2]-c[2]&&a.push(re([c[2]+1,o[1],o[2],c[3]])))),!a.length)continue;y[C]=a.join(",")}else c=o,y.splice(C,1),C--;e.sheetIdx===this.parent.activeSheetIndex&&this.parent.notify(Vr,{indexes:c.slice()})}(p=y.join(","))!==v.range&&(!e.cfModel||e.cfModel.cFColor===v.cFColor&&e.cfModel.type===v.type&&e.cfModel.value===v.value?(f.push(v.range),p?(e.oldCFModel.push({type:v.type,cFColor:v.cFColor,format:v.format,range:v.range,value:v.value}),v.range=p,v.result&&(delete v.result,this.parent.notify(Br,{cfModel:[v],isAction:!0})),e.updatedCFModel.push(v),u.push(v)):(e.oldCFModel.push(v),u.concat(n.splice(m,1)),m--)):g.push(v))}e.sheetIdx!==this.parent.activeSheetIndex?e.isUndoRedo&&!e.isFromUpdateAction&&this.parent.notify(fr,{address:r.name+"!"+e.range}):g.length&&this.parent.notify(Br,{cfModel:g,isAction:!0}),(e.isAction||e.isClear)&&e.oldCFModel.length&&(r={cFormats:u,oldRange:f,previousConditionalFormats:e.oldCFModel,sheetIdx:e.sheetIdx,selectedRange:e.range},e.updatedCFModel.length&&(r.conditionalFormats=e.updatedCFModel),e.isClear?e.cfClearActionArgs=r:i&&this.parent.notify("actionComplete",{eventArgs:r,action:"clearCF"}))}},ch.prototype.getModuleName=function(){return"workbookConditionalFormatting"};var ph=ch;function ch(e){this.parent=e,this.addEventListener()}fh.prototype.getFillInfo=function(e){for(var t,r=this.parent.serviceLocator.getService(hi),n=!0,i="CopyCells",o=[],a=-1<["Down","Up"].indexOf(e.direction),s=this.getRangeData({range:e.dataRange,sheetIdx:this.parent.activeSheetIndex}),l=s.join().replace(/,/g,"").length,h=this.isRange(e.dataRange)&&l?s.length:1;h--;)if(oe(t=s[h]&&!ee.isNullOrUndefined(s[h].value)?s[h].value:"")||Q(t)||oe(t[t.length-1])){n=!1,i=this.parent.autoFillSettings.fillType;break}return l&&!n||(o.push(r.getConstant("FillSeries")),i="FillSeries"===e.fillType?i:e.fillType),a&&e.dataRange[1]===e.dataRange[3]||o.push("Flash Fill"),{fillType:i,disableItems:o}},fh.prototype.isRange=function(e){return e&&(e[0]!==e[2]||e[1]!==e[3])},fh.prototype.autoFill=function(e){if(e.dataRange&&e.fillRange&&e.direction&&this.parent.allowEditing&&(!this.parent.getActiveSheet().isProtected||!e.isLockedCell)){var t=ne(te(e.dataRange)),r=ne(te(e.fillRange)),n={dataRange:t,fillRange:r,direction:e.direction,fillType:e.fillType||this.fillInfo.fillType,dataSheetIndex:N(this.parent,e.dataRange),fillSheetIndex:N(this.parent,e.fillRange),cells:e.cells};switch(this.fillInfo=this.getFillInfo({dataRange:t,fillRange:r,fillType:e.fillType,direction:e.direction}),this.fillInfo.fillType=(e.isFillOptClick?e:this.fillInfo).fillType,e.fillType){case"FillSeries":case"FillWithoutFormatting":this.fillSeries(n);break;case"CopyCells":case"FillFormattingOnly":this.copyCells(n)}}},fh.prototype.fillSeries=function(e){for(var M,t,B,r,n,i,o,a,s,l,h,d,U,p,c,u,f,g={},m=0,v=ee.isUndefined(e.dataSheetIndex)?this.parent.activeSheetIndex:e.dataSheetIndex,y=ae(this.parent,v),C=ee.isUndefined(e.fillSheetIndex)?(u=this.parent.activeSheetIndex,!0):(u=e.fillSheetIndex)===this.parent.activeSheetIndex,b=ae(this.parent,u),H=e.dataRange[0],V=e.dataRange[1],j=e.dataRange[2],z=e.dataRange[3],_=e.fillRange[0],q=e.fillRange[1],W=e.fillRange[2],G=e.fillRange[3],x=-1<["Down","Up"].indexOf(e.direction),S=-1<["Up","Left"].indexOf(e.direction),Y=x?z-V:j-H,X="FillSeries"===e.fillType,K=y.conditionalFormats&&y.conditionalFormats.length&&[].slice.call(y.conditionalFormats),w=[],$=C&&this.applyWrapToOuterCells(b);m<=Y;){var I=(E=this.updateFillValues(x,H,V,j,z,_,q,W,G,m)).patternRange,E=E.fillRange,N=this.getPattern(I,{isReverseFill:S,isVFill:x},v),R=this.getRangeData({range:I,sheetIdx:v}),Z=!1;(R=x?R:this.getRangeData({range:I,sheetIdx:v},!0))[0]&&R[0].formula&&R[0].formula.match(/=[A-Za-z]+\(([^:]+):([^:]+)\)/)&&(Z=!0);for(var F=R.length,k=0;k<F;k++)if(R[k]&&R[k].isReadOnly)return void this.parent.notify(Fr,null);if(!N||!N.length)return;for(M=N.length,U=(d=this.getSelectedRange(b,{rowIndex:E[0],colIndex:E[1]},{rowIndex:E[2],colIndex:E[3]})).length,S&&(d=d.reverse(),N=N.reverse(),N=this.ensurePattern(N),R=R.reverse()),i=0;i<U;){switch(p=d[i],a=i%F,(t=oe(t=N[i%M])?N[t]:t).type){case"number":case"date":if(t.isStartWithMonth&&1===F?(c=ii(t.regVal.a),A=new Date(c),c.setMonth(c.getMonth()+t.regVal.b*t.i),28<A.getDate()&&A.getDate()!==c.getDate()&&(A.setDate(1),A.setMonth(A.getMonth()+t.regVal.b*t.i),A.setDate(new Date(A.getFullYear(),A.getMonth()+1,0).getDate()),c=A),T=oi(c).toString()):(T=this.round(t.regVal.a+t.regVal.b*t.i,5).toString(),t.val&&(r="string"==typeof t.val[0]&&t.val[0].match(/^0+/))&&(B=this.getNextFormattedValue(t.val[0],Number(T)))),t.dataVal){if(void 0===t.copy&&!r&&(t.copy=2<t.val.length,t.copy))for(var O=2;O<t.val.length&&(t.copy=Math.abs(this.round(t.regVal.a+t.regVal.b*O,5))!==t.val[O],!t.copy);O++);T=t.copy?R[a]&&!ee.isNullOrUndefined(R[a].value)?R[a].value:"":t.start?Math.abs(Number(T))+t.dataVal:r?t.dataVal+B:t.dataVal+Math.abs(Number(T))}S?t.i--:t.i++;break;case"string":var A=t.i%t.val.length,T=t.val[A];t.i++;break;case"formula":for(h=!1,T="=",o=0,s=t.val.length;o<s;)"object"==typeof(n=t.val[o])?(h=!0,(l=this.round(n.a+n.b*t.i,5))<1?(T+="#REF!",Z&&(T+=t.val[o=s-1])):T+=x?n.c+(n.b?l:"$"+l):(n.b?ue(l):n.c.substring(0,n.c.search(/\d/))+"$"+ue(l))+n.c.trim()):T+=n,o++;h&&S?t.i--:t.i++;break;case"time":T=(t.regVal.a+t.regVal.b*t.i).toString(),S?t.i--:t.i++}if((P=se(p.rowIndex,p.colIndex,b,!1,!0))&&P.isReadOnly)return void this.parent.notify(Fr,null);X?Object.assign(g,R[a],null,!0):("FillWithoutFormatting"===e.fillType&&R[a]&&R[a].hyperlink?(g.hyperlink=R[a].hyperlink,g.style={textDecoration:"none",color:"inherit"}):g.style=P.style,g.format=P.format,g.wrap=P.wrap,g.rowSpan=P.rowSpan,g.colSpan=P.colSpan),R[a]&&R[a].validation&&(g.validation=Object.assign({},R[a].validation),L=Vn(P=[p.rowIndex,p.colIndex,p.rowIndex,p.colIndex],D=[e.dataRange[0],e.dataRange[1],e.dataRange[2],e.dataRange[3]],J=this.parent.sheets[this.parent.activeSheetIndex],this.parent,{formula:g.validation.value1}),g.validation.value1=L,""!==g.validation.value2)&&(L=Vn(P,D,J,this.parent,{formula:g.validation.value2}),g.validation.value2=L);var D,J,L,P=Q(T);P&&(g.formula=T),("0"!==T||"0"===T&&"FillWithoutFormatting"!==e.fillType)&&(g.value=P&&"Manual"===this.parent.calculationMode&&"FillWithoutFormatting"===e.fillType?ee.isNullOrUndefined(R[a])?"0":R[a].value:T),ee.isNullOrUndefined(g.notes)||delete g.notes,D={cell:g,rowIdx:p.rowIndex,colIdx:p.colIndex,valChange:!0,uiRefresh:C,pvtExtend:!0,skipFormatCheck:!0,fillType:e.fillType},!C||he(b,p.rowIndex)||pe(b,p.colIndex)||(D.td=this.parent.getCell(p.rowIndex,p.colIndex),D.td&&(D.uiRefresh=!0)),_n(this.parent,b,D)||(C&&$(D),!K)||(f=f||D.isFormulaDependent)||Yn(K,w,p.rowIndex,p.colIndex,e.dataRange,e.fillRange,y),g={},i++}m++}(w.length||f)&&this.parent.notify(Br,{cfModel:!f&&w,refreshAll:f,isAction:!0,isEdit:!0})},fh.prototype.copyCells=function(e){for(var t,r,n,i,o,a,s,l,h=0,d={},p=e.dataRange[0],c=e.dataRange[1],u=e.dataRange[2],f=e.dataRange[3],g=e.fillRange[0],m=e.fillRange[1],v=e.fillRange[2],y=e.fillRange[3],C=-1<["Down","Up"].indexOf(e.direction),b=-1<["Up","Left"].indexOf(e.direction),x=C?f-c:u-p,S=ee.isUndefined(e.dataSheetIndex)?this.parent.activeSheetIndex:e.dataSheetIndex,w=ae(this.parent,S),I=ee.isUndefined(e.fillSheetIndex)?(o=!0,this.parent.activeSheetIndex):(o=e.fillSheetIndex===this.parent.activeSheetIndex,e.fillSheetIndex),E=ae(this.parent,I),N="FillFormattingOnly"===e.fillType,R=w.conditionalFormats&&w.conditionalFormats.length&&[].slice.call(w.conditionalFormats),F=o&&this.applyWrapToOuterCells(E),k=[];h<=x;){for(var O,A=(T=this.updateFillValues(C,p,c,u,f,g,m,v,y,h)).patternRange,T=T.fillRange,D=(O=this.getRangeData({range:A,sheetIdx:S})).length,L=0;L<D;L++)if(O[L]&&O[L].isReadOnly)return void this.parent.notify(Fr,null);for(n=(r=this.getSelectedRange(E,{rowIndex:T[0],colIndex:T[1]},{rowIndex:T[2],colIndex:T[3]})).length,t=0,b&&(r=r.reverse());t<n;){if(l=t%D,i=r[t],N&&(a=se(i.rowIndex,i.colIndex,E)),Object.assign(d,O[l],null,!0),N&&(d.value=a.value,d.formula=a.formula),d&&d.isReadOnly)return void this.parent.notify(Fr,null);l={cell:d,rowIdx:i.rowIndex,colIdx:i.colIndex,valChange:!0,pvtExtend:!0,fillType:e.fillType},!o||he(E,i.rowIndex)||pe(E,i.colIndex)||(l.td=this.parent.getCell(i.rowIndex,i.colIndex),l.uiRefresh=!!l.td),_n(this.parent,E,l,e.cells)||(o&&F(l),!R)||(s=s||l.isFormulaDependent)||Yn(R,k,i.rowIndex,i.colIndex,e.dataRange,e.fillRange,w),d={},t++}h++}(k.length||s)&&this.parent.notify(Br,{cfModel:!s&&k,refreshAll:s,isAction:!0,isEdit:!0})},fh.prototype.applyWrapToOuterCells=function(t){var r,n,i,o=this,a=this.parent.frozenRowCount(t),s=this.parent.frozenColCount(t),e=this.parent.viewport;return e&&(r=e.topIndex+a,n=e.leftIndex+s),function(e){!e.td&&se(e.rowIdx,e.colIdx,t,!1,!0).wrap&&(e.rowIdx>=a&&e.rowIdx<r||e.colIdx>=s&&e.colIdx<n)&&((i=i||{range:null,wrap:!0,sheet:t,initial:!0,outsideViewport:!0}).range=[e.rowIdx,e.colIdx,e.rowIdx,e.colIdx],o.parent.notify(ir,i))}},fh.prototype.updateFillValues=function(e,t,r,n,i,o,a,s,l,h){var d,p,c,e=e?(d={rowIndex:t,colIndex:r+h},p={rowIndex:n,colIndex:r+h},c={rowIndex:o,colIndex:a+h},{rowIndex:s,colIndex:a+h}):(d={rowIndex:t+h,colIndex:r},p={rowIndex:t+h,colIndex:i},c={rowIndex:o+h,colIndex:a},{rowIndex:o+h,colIndex:l});return{patternRange:[d.rowIndex,d.colIndex,p.rowIndex,p.colIndex],fillRange:[c.rowIndex,c.colIndex,e.rowIndex,e.colIndex]}},fh.prototype.getDataPattern=function(e,t){var r,n=0,i={val:null,type:null},o=[],a=this.getRangeData({range:e,sheetIdx:ee.isUndefined(t)?this.parent.activeSheetIndex:t}),s=a.length;if(s){for(var l=void 0,h=void 0,d=void 0,p=void 0,c=function(e){return!r&&e&&"-"===e[e.length-1]?e.slice(0,e.length-1):e};n<s;){var u,f,g,m=!1;if(a[n]?a[n].formula&&Q(a[n].formula)?(u=a[n].formula,g="formula"):(u=ee.isNullOrUndefined(a[n].value)?"":a[n].value,f={},d=a[n].format,p=oe(u),d&&Wi(d,!0,f)?(g=f.type,u&&!p&&(f={value:u,updatedVal:u,cell:a[n]},this.parent.notify(At,f),f.isDate||f.isTime?a[n].value=u=f.updatedVal:g="string"),m="date"===g&&d.toLowerCase().startsWith("mmm")):g=p?"number":"string"):(u="",g="string"),h="","string"===g){if(r=!1,oe(u[0])){for(l=0;oe(u[++l]););" "===u[l]&&(r=!0,g="number",h=u.slice(l,u.length),u=Number(u.slice(0,l)))}if(!r&&oe(u[u.length-1])){for(l=1;l++,oe(u[u.length-l]););g="number",--l,h=u.slice(0,u.length-l),u=(f=u.slice(u.length-l,u.length)).match(/^0+/)?f:Number(f),i.dataVal&&i.dataVal!==h&&i.dataVal===c(h)&&(h=i.dataVal)}}0===n?(i={val:[u],type:g,isStartWithMonth:m},h&&(i.dataVal=h,i.start=r)):g!==i.type||i.dataVal&&c(i.dataVal)!==c(h)?(o.push(i),i={val:[u],type:g},h&&(i.dataVal=h,i.start=r)):i.val.push(u),n++}return o.push(i),o}return[{val:null,type:null}]},fh.prototype.getPredictionValue=function(e,t){for(var r=0,n=0,i=0,o=0,a=0,s=0,l=0,h=e.length;r<h;)n+=r,i+=Number(e[r]),o+=r*Number(e[r]),a+=r*r,r++;return l=t?(s=(i*a-n*o)/(h*a-n*n),(h*o-n*i)/(h*a-n*n)):(s=this.round((i*a-n*o)/(h*a-n*n),5),this.round((h*o-n*i)/(h*a-n*n),5)),{a:s,b:l}},fh.prototype.getPattern=function(e,t,r){var n,i,o,a,s=0,l=[],h=this.getDataPattern(e,r),d=h.length;if(h){for(;s<d;){switch((i=h[s]).type){case"number":case"date":var p,c=l.length,u=i.val.length,f=t.isReverseFill?-1:u;for(1===u&&(p=parseFloat(i.val[0])+1,"string"==typeof i.val[0]&&i.val[0].match(/^0+/)?i.val.push(this.getNextFormattedValue(i.val[0],p)):i.val.push(p)),p={regVal:this.getPredictionValue(i.dataVal?i.val.slice(0,2):i.val),type:i.type,i:f,isStartWithMonth:i.isStartWithMonth},i.dataVal&&(p.dataVal=i.dataVal,p.val=i.val,p.start=i.start),l.push(p),n=1;n<u;)l.push(c),n++;break;case"string":for(c=l.length,p={val:i.val,type:i.type,i:0},l.push(p),n=1,u=i.val.length;n<u;)l.push(c),n++;break;case"formula":if(u=i.val.length,i=this.getFormulaPattern(i.val,t),f=t.isReverseFill?-1:u,i.isInPattern)for(c=l.length,p={val:i.val,type:"formula",i:f},l.push(p),n=1;n<u;)l.push(c),n++;else for(n=0,f=t.isReverseFill?-1:1;n<u;)l.push({val:i.val[n],type:"formula",i:f}),n++;break;case"time":for(c=l.length,u=i.val.length,f=t.isReverseFill?-1:u,1===u&&(a=ii(i.val[0]),o=0<(o=Number(i.val[0]))&&o<1,a=oi(new Date(a.getTime()+36e5),!0,o),i.val.push(a)),p={regVal:this.getPredictionValue(i.val,!0),type:i.type,i:f},l.push(p),n=1;n<u;)l.push(c),n++}s++}return l}return[{regVal:null}]},fh.prototype.getNextFormattedValue=function(e,t){t=(new ee.Internationalization).formatNumber(Math.abs(t),{minimumIntegerDigits:e.length,useGrouping:!1}),e=Nn({value:t},this.parent.locale);return e.isNumber?e.value:t},fh.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"},fh.prototype.round=function(e,t){return Number(Math.round(parseFloat(e+"e"+t))+"e-"+t)||Number(e)},fh.prototype.getRangeData=function(e,t){for(var r,n,i,o,a,s=[],l=ee.isUndefined(e.sheetIdx)?this.parent.getActiveSheet():ae(this.parent,e.sheetIdx),h=e.range[0],d=e.range[1],p=e.range[2],c=e.range[3],u=d;h<=p;){if(he(l,h));else for(d=u;d<=c;)pe(l,d)?d++:(o=se(h,d,l),t&&(o=Object.assign({},se(h,d,l)),a=Object.assign({},de(l,d)),o)&&!o.validation&&a&&a.validation&&(o.validation=Object.assign({},de(l,d).validation),i=Vn(r=[h,d,h,d],n=[0,d,0,d],l,this.parent,{formula:a.validation.value1}),o.validation.value1=i,""!==o.validation.value2)&&(i=Vn(r,n,l,this.parent,{formula:a.validation.value2}),o.validation.value2=i),s.push(o),d++);h++}return s},fh.prototype.getFormulaPattern=function(e,t){for(var r,n,i,o,a=[],s=0,l=e.length,h={};s<l;)h.formula=e[s],this.parent.notify(vn,h),a.push(h.formulaArr),s++;var d=this.isInPattern(a,t.isVFill);if(d){for(s=(i=a[0]).length;s--;)n=i[s],(o=this.isCellReference(n))&&"absolute"!==o&&(i[s]=this.getCellRefPrediction(n,t,null,o));return{isInPattern:d,val:i}}for(s=0;s<l;){for(r=(i=a[s]).length;r--;)n=i[r],(o=this.isCellReference(n.trim()))&&"absolute"!==o&&(a[s][r]=this.getCellRefPrediction(n,t,l,o));s++}return{isInPattern:d,val:a}},fh.prototype.generateColCount=function(e){for(var t=0,r=0;r<e.length;r++)t=26*t+(e.charCodeAt(r)-64);return t},fh.prototype.getCellRefPrediction=function(e,t,r,n){e=e.toUpperCase();var i=new RegExp("[a-z$]","gi"),o=new RegExp("[0-9$]","g"),a=t.isVFill?e.replace(o,""):e.replace(i,""),i=t.isVFill?Number(e.replace(i,"")):this.generateColCount(e.replace(o,"").trim()),s=null,o=[i],l="$"===e[0];if(!l&&e.includes("$")&&"$"===e.trim()[0])for(var h=1;h<e.length;h++)if("$"===e[h]){s=h,l=!0;break}return o.push(r&&1!==r?i+r:i+1),i=this.getPredictionValue(o),n&&"mixed"===n&&(l===t.isVFill?a=s?a.substring(0,s)+"$"+a.substring(s):"$"+a:i.b=0),i.c=a,i},fh.prototype.isInPattern=function(e,t){var r,n,i,o,a,s,l,h=0,d=1,p=e.length,c=new RegExp("[0-9$]","g"),u=new RegExp("[a-z$]","gi");if(1===p)return!1;for(;d<p;){if(r=e[h],i=e[d],(n=r.length)!==i.length)return!1;for(;n--;)if(o=r[n],a=i[n],this.isCellReference(o)===this.isCellReference(a)){if(l=t?(s=Number(o.replace(u,"")),Number(a.replace(u,""))):(s=this.generateColCount(o.replace(c,"")),this.generateColCount(a.replace(c,""))),s!==l-1)return!1}else if(o!==a)return!1;h++,d++}return!0},fh.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},fh.prototype.getSelectedRange=function(e,t,r){for(var n,i,o=[],a=ne([t.rowIndex,t.colIndex,r.rowIndex,r.colIndex]),s=a[0],l=a[2];s<=l;){if(Fh(e,s));else for(n=a[1],i=a[3];n<=i;)o.push({rowIndex:s,colIndex:n}),n++;s++}return o},fh.prototype.getFillType=function(e){return e.fillType=this.fillInfo.fillType,e.disableItems=this.fillInfo.disableItems,e},fh.prototype.addEventListener=function(){this.parent.on(tn,this.autoFill,this),this.parent.on(nn,this.getFillType,this)},fh.prototype.destroy=function(){this.removeEventListener(),this.parent=null},fh.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(tn,this.autoFill),this.parent.off(nn,this.getFillType))},fh.prototype.getModuleName=function(){return"workbookautofill"};var uh=fh;function fh(e){this.parent=e,this.addEventListener()}mh.prototype.getService=function(e){if(ee.isNullOrUndefined(this.services[""+e]))throw"The service "+e+" is not registered";return this.services[""+e]},mh.prototype.register=function(e,t){ee.isNullOrUndefined(this.services[""+e])&&(this.services[""+e]=t)};var gh=mh;function mh(){this.services={}}vh=function(e,t){return(vh=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)};var vh,yh,Ch,Il=function(e,t){function r(){this.constructor=e}vh(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},bh=function(){return(bh=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}).apply(this,arguments)},n=function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;0<=s;s--)(i=e[s])&&(a=(o<3?i(a):3<o?i(t,r,a):i(t,r))||a);return 3<o&&a&&Object.defineProperty(t,r,a),a},Il=(yh=ee.Component,Il(s,yh),(Ch=s).prototype.preRender=function(){Object.keys(this.commonCellStyle).length||(this.commonCellStyle=ji(this.cellStyle,!0)),"spreadsheet"!==this.getModuleName()||this.refreshing||this.initEmptySheet()},s.prototype.initWorkbookServices=function(){this.serviceLocator.register(hi,new ee.L10n(this.getModuleName(),di,this.locale))},s.prototype.render=function(){},s.prototype.requiredModules=function(){return L(this)},s.prototype.getPersistData=function(){return this.addOnPersist([])},s.prototype.cellFormat=function(e,t){var r=this.getActiveSheet();t=t||r.selectedRange,this.notify(Et,{style:e,range:t,refreshRibbon:-1<t.indexOf(r.activeCell)})},s.prototype.lockCells=function(e,t){var r=this.getActiveSheet();e=e||r.selectedRange,this.notify(kr,{range:e,isLocked:t,triggerEvent:!0})},s.prototype.getCellStyleValue=function(e,t){var r=this,n=se(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},s.prototype.numberFormat=function(e,t){this.notify(xt,{format:e,range:t}),this.notify(wn,{action:"addToCustomFormats",format:e})},s.prototype.createSheet=function(e,t){var r;void 0===e&&(e=this.sheets.length),(r=this.sheets).splice.apply(r,[e,0].concat(t=void 0===t?[{}]:t)),Ti(this,t),this.notify(Ut,{sheetIndex:e||0,sheets:t}),this.notify(ie,{action:"registerSheet",sheetIndex:e||0,sheetCount:e+t.length})},s.prototype.removeSheet=function(e){this.sheets.splice(e,1)},s.prototype.destroy=function(){this.notify(lt,null),yh.prototype.destroy.call(this)},s.prototype.onPropertyChanged=function(e,t){for(var r=0,n=Object.keys(e);r<n.length;r++)switch(n[r]){case"cellStyle":ee.merge(this.commonCellStyle,e.cellStyle);break;case"sheets":e.sheets===this.sheets?(this.notify(ie,{action:"unRegisterSheet",propertyChange:!0}),this.sheetNameCount=1,this.notify(Ht,{}),Ti(this),this.notify(Ut,null),this.notify(ie,{action:"registerSheet"})):Ti(this);break;case"listSeparator":this.notify(ie,{action:"setArgumentSeparator"})}},s.prototype.appendTo=function(e){yh.prototype.appendTo.call(this,e)},s.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++)Rh(n,i,{hidden:r})},s.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++)Mh(n,i,{hidden:r})},s.prototype.setBorder=function(e,t,r,n){this.notify(Et,{style:e,borderType:r,range:t||this.getActiveSheet().selectedRange,isUndoRedo:n})},s.prototype.insertRow=function(e,t,r){this.notify(lr,{model:this.getSheetModel(r),start:e,end:t,modelType:"Row",insertType:"below"})},s.prototype.insertColumn=function(e,t,r){this.notify(lr,{model:this.getSheetModel(r),start:e,end:t,modelType:"Column",insertType:"after"})},s.prototype.insertSheet=function(e,t){this.notify(lr,{model:this,start:e,end:t,modelType:"Sheet"})},s.prototype.delete=function(e,t,r,n){var i;if(e=e||0,t=ee.isNullOrUndefined(t)?e:t,r&&"Sheet"!==r){if(!(i=this.getSheetModel(n)))return}else if(i=this,Math.abs(t-e)>=this.sheets.length)return;this.notify(hr,{model:i,start:e,end:t,modelType:r||"Sheet"})},s.prototype.moveSheet=function(e,t){Li(this,e,t)},s.prototype.duplicateSheet=function(e){Pi(this,e)},s.prototype.getSheetModel=function(e){return ee.isNullOrUndefined(e)?this.getActiveSheet():(e="string"==typeof e?B(this,e):e,ee.isNullOrUndefined(e)||e>=this.sheets.length?null:this.sheets[e])},s.prototype.merge=function(e,t){var r,n;e?n=ae(this,r=this.isPrintingProcessing?this.currentPrintSheetIndex:N(this,e)):(e=(n=this.getActiveSheet()).selectedRange,r=this.activeSheetIndex),this.notify(Or,{merge:!0,range:e,type:t||"All",sheetIndex:r,refreshRibbon:-1<e.indexOf(n.activeCell),preventRefresh:this.activeSheetIndex!==r})},s.prototype.unMerge=function(e){var t,r;e?r=ae(this,t=N(this,e)):(e=(r=this.getActiveSheet()).selectedRange,t=this.activeSheetIndex),this.notify(Or,{merge:!1,range:e,sheetIndex:t,type:"All",refreshRibbon:-1<e.indexOf(r.activeCell),preventRefresh:this.activeSheetIndex!==t})},s.prototype.computeExpression=function(e){e={action:"computeExpression",formula:e,isFromComputeExpression:!0};return this.notify(ie,e),e.calcValue},s.prototype.initEmptySheet=function(){this.sheets.length?Ti(this):this.createSheet()},s.prototype.getActiveSheet=function(){return this.sheets[this.activeSheetIndex]},s.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},s.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(kt,{index:e,update:"row"})),t>r.usedRange.colIndex&&(this.setSheetPropertyOnMute(r,"usedRange",{rowIndex:r.usedRange.rowIndex,colIndex:t}),r!==this.getActiveSheet()||n||this.notify(kt,{index:t,update:"col"})))},s.prototype.getData=function(e){return pi(this,e)},s.prototype.getModuleName=function(){return"workbook"},s.prototype.goTo=function(e){},s.prototype.getValueRowCol=function(e,t,r,n,i,o,a){var s,e=Ii(this,e),l=ae(this,e),h=se(t-1,r-1,l);if(n&&n.includes("!")&&!h&&l.ranges&&l.ranges.length){if(this.formulaRefCell&&this.formulaRefCell===n)return h&&h.value;if(l.ranges.forEach(function(e){e.info&&e.info.loadedRange&&e.info.loadedRange.length||(s=!0)}),s){if(this.formulaRefCell=n,e=Ii(this,Number(n.substring(n.lastIndexOf(",")+1,n.length))),ee.isNullOrUndefined(e))return h&&h.value;n=n.substring(n.lastIndexOf("!")+1,n.lastIndexOf(",")),pi(this,l.name+"!A1:"+G(t-1,r-1),null,null,null,null,n,e)}}else h&&h.formula&&(i||ee.isNullOrUndefined(h.value))&&!o&&"Automatic"===this.calculationMode&&this.notify(wt,{cell:h,rowIdx:t-1,colIdx:r-1,sheetIndex:e,formulaRefresh:!0});return!h||oe(h.value)||this.isEdit||(l={formattedText:h.value,value:h.value,format:h.format,cell:h,skipFormatCheck:!1},this.notify(St,l),h=l.cell),a&&h&&h.formula&&h.formula.includes("SUBTOTAL(")?h.formula:h&&h.value},s.prototype.setValueRowCol=function(e,t,r,n,i,o){this.notify(Ot,{action:"updateCellValue",address:[r-1,n-1],value:t,sheetIndex:Ii(this,e),isValueOnly:!0,formula:i,isRandomFormula:o})},s.prototype.open=function(e){this.notify(ut,e)},s.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,o={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(i in t.ignoreFreezePane&&n.push.apply(n,["frozenColumns","frozenRows"]),o)o[i]&&n.push(i)}r=JSON.stringify(JSON.parse(r),function(e,t){if(!(-1<n.indexOf(e)))return t})}this.notify(ut,{jsonObject:r,triggerEvent:e.triggerEvent})},s.prototype.save=function(e,t){var r;void 0===e&&(e={}),this.allowSave&&(r={url:this.saveUrl,fileName:e.fileName||"Sample",saveType:"Xlsx"},r=bh({},r,e,{customParams:{},isFullPost:!0,needBlobData:!1,cancel:!1,autoDetectFormat:!1,pdfLayoutSettings:{fitSheetOnOnePage:!1,orientation:"Portrait"}}),this.trigger("beforeSave",r),this.notify(gt,{eventArgs:r,action:"beforeSave"}),r.cancel||this.notify(ft,{saveSettings:r,isFullPost:r.isFullPost,needBlobData:r.needBlobData,customParams:r.customParams,pdfLayoutSettings:r.pdfLayoutSettings,jsonConfig:t}))},s.prototype.saveAsJson=function(e){var r=this;return new Promise(function(t){r.on(or,function(e){e.cancel=!0,r.off(or),t({jsonObject:{Workbook:e.jsonObject}}),r.notify(bt,e)}),r.save({},e)})},s.prototype.addHyperlink=function(e,t){this.notify(tr,{hyperlink:e,cell:t})},s.prototype.findHandler=function(e){this.notify(ur,e)},s.prototype.replaceHandler=function(e){"replace"===e.replaceBy?this.notify(gr,e):this.notify(mr,e)},s.prototype.protectSheet=function(e,t,r){ee.isNullOrUndefined(e)?e=this.activeSheetIndex:"string"==typeof e&&(e=B(this,e));var n=this.sheets[e];n&&(this.setSheetPropertyOnMute(n,"isProtected",!0),this.setSheetPropertyOnMute(n,"password",r||""),this.setSheetPropertyOnMute(n,"protectSettings",t||{}),this.notify(Ir,{protectSettings:n.protectSettings,password:n.password,sheetIndex:e}))},s.prototype.unprotectSheet=function(e){ee.isNullOrUndefined(e)?e=this.activeSheetIndex:"string"==typeof e&&(e=B(this,e)),this.sheets[e]&&this.notify(Nr,{sheet:e})},s.prototype.sort=function(e,t,r){return this.allowSorting?(t={args:{range:t||this.getActiveSheet().selectedRange,sortOptions:e||{sortDescriptors:{}},cancel:!1},promise:new Promise(function(e){e(void 0)}),previousSort:r},this.notify(Xt,t),t.promise):Promise.reject()},s.prototype.addDataValidation=function(e,t){ee.isNullOrUndefined(e.value1)||("List"===e.type?256<e.value1.length&&(e.value1=e.value1.substring(0,255)):(e.value1=Kn([e.value1],this)[0],e.value2&&(e.value2=Kn([e.value2],this)[0])),this.notify(pr,{rules:e,range:t||this.getActiveSheet().selectedRange}))},s.prototype.removeDataValidation=function(e){this.notify(pr,{range:e,isRemoveValidation:!0})},s.prototype.addInvalidHighlight=function(e){this.notify(cr,{range:e})},s.prototype.removeInvalidHighlight=function(e){this.notify(Cr,{range:e})},s.prototype.isValidCell=function(e){var t=this.getActiveSheet(),e=W(e||t.activeCell),r=se(e[0],e[1],t);return!(r&&r.validation||t.columns&&t.columns[e[1]]&&t.columns[e[1]].validation)||(t={value:r.value||"",range:e,sheetIdx:this.activeSheetIndex,td:null,isValid:!0},this.notify(dr,t),t.isValid)},s.prototype.conditionalFormat=function(e){var t;e.range?","!==this.listSeparator&&e.range.includes(this.listSeparator)&&(e.range=e.range.split(this.listSeparator).join(",")):e.range=this.getActiveSheet().selectedRange,e.value&&(t=void 0,Kn(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(Mr,{cfModel:e})},s.prototype.clearConditionalFormat=function(e){var t,r={};e&&e.includes("!")?(t=e.lastIndexOf("!"),r.range=e.substring(t+1),r.sheetIdx=B(this,e.substring(0,t))):(r.range=e||this.getActiveSheet().selectedRange,r.sheetIdx=this.activeSheetIndex),this.notify(Ur,r)},s.prototype.updateCell=function(e,t,r){ee.isNullOrUndefined(r)&&(r=!0),this.updateCellDetails(e,t,void 0,void 0,r)},s.prototype.updateCellDetails=function(e,t,r,n,i){var o,a;if((t=t||this.getActiveSheet().activeCell).includes("!")){if(o=P(t),void 0===(a=B(this,t.substring(0,t.lastIndexOf("!")))))return}else o=te(t),a=this.activeSheetIndex;var t=ae(this,a),s=(_n(this,t,{cell:e,rowIdx:o[0],colIdx:o[1],preventEvt:!0}),ee.isNullOrUndefined(e.value)?e.formula||null:e.value),l=null!==s,h=se(o[0],o[1],t,!1,!0);l?(delete h.formattedText,this.notify(Ot,{action:"updateCellValue",address:o,value:s,sheetIndex:a,cellInformation:r,isRedo:n,isDependentUpdate:i}),this.isEdit&&"#CIRCULARREF!"===h.value&&(h.value="0")):!ee.isNullOrUndefined(e.format)&&h.formattedText&&delete h.formattedText,a===this.activeSheetIndex&&(s={sheet:t,cell:h,rowIdx:o[0],colIdx:o[1]},(1<h.rowSpan||1<h.colSpan)&&Zn(s),(r=!he(t,s.rowIdx)&&!pe(t,s.colIdx)&&this.getCell(s.rowIdx,s.colIdx))&&this.serviceLocator.getService("cell").refresh(s.rowIdx,s.colIdx,!0,r,l,l),n=W(t.activeCell),o[0]===n[0])&&o[1]===n[1]&&(this.notify(qr,null),this.notify(ao,{action:"refreshFormulabar",cell:h}),r)&&e.validation&&(s.validation=h.validation,s.td=r,s.isRefresh=!0,this.notify(En,s))},s.prototype.getRowData=function(e,t){ee.isNullOrUndefined(e)&&(e=0);t={sheetIdx:t=ee.isNullOrUndefined(t)?this.activeSheetIndex:t,startIndex:e,modelType:"Row",isDataRequest:!0};return this.notify(pt,t),t.data},s.prototype.updateRange=function(e,t){var r=ae(this,t=void 0===t?this.activeSheetIndex: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(dt,{sheetIdx:t,rangeIdx:r.ranges.length-1,changedData:e.dataSource})},s.prototype.wrap=function(e,t){zi(e,t=void 0===t?!0:t,this,null,!0)},s.prototype.addDefinedName=function(e){e={action:"addDefinedName",isAdded:!1,definedName:e};return this.notify(ie,e),e.isAdded},s.prototype.removeDefinedName=function(e,t){e={action:"removeDefinedName",isRemoved:!1,definedName:e,scope:t=void 0===t?"":t};return this.notify(ie,e),e.isRemoved},s.prototype.insertImage=function(e,t){this.notify(jr,{options:e,range:t||this.getActiveSheet().selectedRange})},s.prototype.autoFill=function(e,t,r,n){t={dataRange:t||this.getActiveSheet().selectedRange,fillRange:e,direction:r||"Down",fillType:n||"FillSeries"};this.notify(tn,t)},s.prototype.insertChart=function(e){this.notify(zr,{chart:e})},s.prototype.deleteChart=function(e){this.notify(vs,{id:e})},s.prototype.filter=function(e,t){return this.allowFiltering?(t={args:{range:t||this.getActiveSheet().selectedRange,filterOptions:e,cancel:!1},promise:new Promise(function(e){e(void 0)})},this.notify(rr,t),t.promise):Promise.reject()},s.prototype.addCustomFunction=function(e,t,r){t=t||("string"==typeof e?e:e.name.replace("bound ","")),this.notify(ie,{action:"addCustomFunction",functionHandler:e,functionName:t,formulaDescription:r})},s.prototype.clear=function(e){this.notify(Hr,e)},s.prototype.getDisplayText=function(e){var t;return e?e.format&&!ee.isNullOrUndefined(e.value)?(t={formattedText:e.value,value:e.value,format:e.format,cell:e,skipFormatCheck:!0},this.notify(St,t),t.formattedText):!e.value&&e.hyperlink?"string"==typeof e.hyperlink?e.hyperlink:e.hyperlink.address:e.value||"number"==typeof e.value?e.value.toString():"":""},s.prototype.freezePanes=function(e,t,r){void 0===e&&(e=1),void 0===t&&(t=1);r=this.getSheetModel(r);!this.allowFreezePane||r.frozenRows===e&&r.frozenColumns===t||(this.setSheetPropertyOnMute(r,"frozenRows",e),this.setSheetPropertyOnMute(r,"frozenColumns",t),this.updateTopLeftCell(),r.id===this.getActiveSheet().id&&"spreadsheet"===this.getModuleName()&&this.renderModule.refreshSheet())},s.prototype.Unfreeze=function(e){this.freezePanes(0,0,e)},s.prototype.unfreezePanes=function(e){this.freezePanes(0,0,e)},s.prototype.calculateNow=function(e,t){"Workbook"===e&&"Manual"===this.calculationMode&&(e="CalculateWorkbook",this.setProperties({calculationMode:"Automatic"},!0));e={action:"calculateNow",scope:e,sheets:"Workbook"===e||"CalculateWorkbook"===e?this.sheets:[ae(this,t="string"==typeof t?B(this,t):ee.isNullOrUndefined(t)?this.activeSheetIndex:t)],promise:new Promise(function(e){e(void 0)})};return this.notify(ie,e),e.promise},s.prototype.updateTopLeftCell=function(e,t,r,n){var i=W((n=n||this.getActiveSheet()).topLeftCell);n.frozenRows||n.frozenColumns?((ee.isNullOrUndefined(e)||e<0)&&(e=n.frozenRows?0:i[0]),(ee.isNullOrUndefined(t)||t<0)&&(t=n.frozenColumns?0:i[1]),e+=this.frozenRowCount(n),t+=this.frozenColCount(n),r&&("row"===r?e=W(n.paneTopLeftCell)[0]:t=W(n.paneTopLeftCell)[1]),this.setSheetPropertyOnMute(n,"paneTopLeftCell",G(e,t)),n.frozenRows&&(e=i[0]),n.frozenColumns&&(t=i[1])):(ee.isNullOrUndefined(e)&&(e=i[0]),ee.isNullOrUndefined(t)&&(t=i[1]),this.setSheetPropertyOnMute(n,"paneTopLeftCell",G(e,t))),this.setSheetPropertyOnMute(n,"topLeftCell",G(e,t))},s.prototype.getAddressInfo=function(e){return E(this,e)},s.prototype.setSheetPropertyOnMute=function(e,t,r){this.isProtectedOnChange=!0,e[""+t]=r,this.isProtectedOnChange=!1},s.prototype.frozenRowCount=function(e){return e.frozenRows?"A1"===e.topLeftCell?e.frozenRows:W(e.topLeftCell)[0]+e.frozenRows:0},s.prototype.frozenColCount=function(e){return e.frozenColumns?"A1"===e.topLeftCell?e.frozenColumns:W(e.topLeftCell)[1]+e.frozenColumns:0},s.prototype.updateRangeOnInsertDelete=function(e,t,r,n,i,o,a){var s,l,h=!1;return e.isInsert?(l=e.endIndex-e.startIndex+1,"Row"===e.modelType?e.forceUpdate?(t[0]+=1,t[2]+=1,h=!0):(s=!o&&a&&t[2]===e.startIndex-1&&n===e.startIndex&&t[1]===t[3],e.startIndex<=t[0]&&(t[0]+=l,h=!0),(e.startIndex<=t[2]||r&&e.startIndex===t[2]+1&&s)&&(t[2]+=l,h=!0)):e.forceUpdate?(t[1]+=1,t[3]+=1,h=!0):(s=!o&&a&&t[3]===e.startIndex-1&&i===e.startIndex&&t[0]===t[2],e.startIndex<=t[1]&&(t[1]+=l,h=!0),(e.startIndex<=t[3]||r&&e.startIndex===t[3]+1&&s)&&(t[3]+=l,h=!0))):"Row"===e.modelType?(0<(l=t[0]-e.startIndex)&&(!(t[0]>e.endIndex)||0<(l=e.endIndex-e.startIndex+1))&&(t[0]-=l,h=!0),e.startIndex<=t[2]&&(e.endIndex<=t[2]?t[2]-=e.endIndex-e.startIndex+1:t[2]-=t[2]-e.startIndex+1,h=!0)):(0<(l=t[1]-e.startIndex)&&(!(t[1]>e.endIndex)||0<(l=e.endIndex-e.startIndex+1))&&(t[1]-=l,h=!0),e.startIndex<=t[3]&&(e.endIndex<=t[3]?t[3]-=e.endIndex-e.startIndex+1:t[3]-=t[3]-e.startIndex+1,h=!0)),h},s.prototype.getCell=function(e,t,r){return null},s.prototype.dateToInt=function(e,t){return oi(e,t)},s.prototype.setDateFormat=function(e,t,r){var e=ae(this,Ii(this,e)),n=se(t,r,e,null,!0).format;n&&"General"!==n||Vi(t,r,e,{format:Pl("ShortDate")},!0)},n([ee.Collection([],Si)],s.prototype,"sheets",void 0),n([ee.Property(0)],s.prototype,"activeSheetIndex",void 0),n([ee.Property("100%")],s.prototype,"height",void 0),n([ee.Property(!0)],s.prototype,"allowFindAndReplace",void 0),n([ee.Property()],s.prototype,"filterCollection",void 0),n([ee.Property()],s.prototype,"sortCollection",void 0),n([ee.Property("100%")],s.prototype,"width",void 0),n([ee.Property(!0)],s.prototype,"showRibbon",void 0),n([ee.Property(!0)],s.prototype,"showFormulaBar",void 0),n([ee.Property(!0)],s.prototype,"showSheetTabs",void 0),n([ee.Property(!0)],s.prototype,"allowEditing",void 0),n([ee.Property(!0)],s.prototype,"allowOpen",void 0),n([ee.Property(!0)],s.prototype,"allowSave",void 0),n([ee.Property(!0)],s.prototype,"allowSorting",void 0),n([ee.Property(!0)],s.prototype,"allowFiltering",void 0),n([ee.Property(!0)],s.prototype,"allowNumberFormatting",void 0),n([ee.Property(!0)],s.prototype,"allowCellFormatting",void 0),n([ee.Property(!0)],s.prototype,"allowHyperlink",void 0),n([ee.Property(!0)],s.prototype,"enableNotes",void 0),n([ee.Property(!0)],s.prototype,"allowInsert",void 0),n([ee.Property(!0)],s.prototype,"allowDelete",void 0),n([ee.Property(!0)],s.prototype,"allowMerge",void 0),n([ee.Property(!0)],s.prototype,"allowDataValidation",void 0),n([ee.Property(!0)],s.prototype,"allowImage",void 0),n([ee.Property(!0)],s.prototype,"allowChart",void 0),n([ee.Property(!0)],s.prototype,"allowAutoFill",void 0),n([ee.Property(!0)],s.prototype,"allowPrint",void 0),n([ee.Property("Automatic")],s.prototype,"calculationMode",void 0),n([ee.Complex({},V)],s.prototype,"autoFillSettings",void 0),n([ee.Property(!0)],s.prototype,"allowConditionalFormat",void 0),n([ee.Complex({},j)],s.prototype,"cellStyle",void 0),n([ee.Property("")],s.prototype,"openUrl",void 0),n([ee.Complex({},e)],s.prototype,"openSettings",void 0),n([ee.Property("")],s.prototype,"saveUrl",void 0),n([ee.Property("")],s.prototype,"password",void 0),n([ee.Property(!1)],s.prototype,"isProtected",void 0),n([ee.Collection([],me)],s.prototype,"definedNames",void 0),n([ee.Event()],s.prototype,"beforeOpen",void 0),n([ee.Event()],s.prototype,"openFailure",void 0),n([ee.Event()],s.prototype,"beforeSave",void 0),n([ee.Event()],s.prototype,"saveComplete",void 0),n([ee.Event()],s.prototype,"beforeCellFormat",void 0),n([ee.Event()],s.prototype,"queryCellInfo",void 0),n([ee.Event()],s.prototype,"beforeCellUpdate",void 0),n([ee.Property(!0)],s.prototype,"allowFreezePane",void 0),n([ee.Property(",")],s.prototype,"listSeparator",void 0),Ch=n([ee.NotifyPropertyChanges],s));function s(e){var t=yh.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,Ch.Inject(Xi,ll,rl,Ll,Gl,Xl,Tl,Ul,$l,Vl,Jl,oh,rh,sh,hh,ph,zl,ql,uh),t.commonCellStyle={},e&&e.cellStyle&&(t.commonCellStyle=e.cellStyle),"workbook"===t.getModuleName()&&(t.serviceLocator=new gh,t.initWorkbookServices(),t.dataBind(),t.initEmptySheet()),t}xh=function(e,t){return(xh=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)};var xh,Sh,n=function(e,t){function r(){this.constructor=e}xh(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},wh=function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;0<=s;s--)(i=e[s])&&(a=(o<3?i(a):3<o?i(t,r,a):i(t,r))||a);return 3<o&&a&&Object.defineProperty(t,r,a),a},Ih=(Sh=ee.ChildProperty,n(Eh,Sh),wh([ee.Collection([],Ui)],Eh.prototype,"cells",void 0),wh([ee.Property(0)],Eh.prototype,"index",void 0),wh([ee.Property(20)],Eh.prototype,"height",void 0),wh([ee.Property(!1)],Eh.prototype,"customHeight",void 0),wh([ee.Property(!1)],Eh.prototype,"hidden",void 0),wh([ee.Complex({},Fe)],Eh.prototype,"format",void 0),wh([ee.Property(!1)],Eh.prototype,"isReadOnly",void 0),Eh);function Eh(){return null!==Sh&&Sh.apply(this,arguments)||this}function Nh(e,t){return e.rows[t]}function Rh(t,r,n){t.rows[r]||(t.rows[r]={}),Object.keys(n).forEach(function(e){t.rows[r][""+e]=n[""+e]})}function he(e,t){return e.rows[t]&&e.rows[t].hidden}function Fh(e,t){return e.rows[t]&&e.rows[t].isFiltered}function kh(e,t,r,n){var i,o;if(e&&e.standardHeight&&(o=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===o?20:o:e.rows[t].height}else i=void 0===o?20:o;return r&&0<window.devicePixelRatio%1?i+((n=i*window.devicePixelRatio%1)?(.5<n?1-n:-1*n)/window.devicePixelRatio:0):i}function Oh(e,t,r){e&&e.rows&&(e.rows[t]||(e.rows[t]={}),e.rows[t].height=r)}function Ah(e,t,r,n,i){var o,a=0;(r=void 0===r?t:r)<t&&(o=t,t=r,r=o);for(var s=t;s<=r;s++)a+=kh(e,s,n,i);return a}Th=function(e,t){return(Th=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)};var Th,Dh,n=function(e,t){function r(){this.constructor=e}Th(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},wh=function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;0<=s;s--)(i=e[s])&&(a=(o<3?i(a):3<o?i(t,r,a):i(t,r))||a);return 3<o&&a&&Object.defineProperty(t,r,a),a},Lh=(Dh=ee.ChildProperty,n(Ph,Dh),wh([ee.Property(0)],Ph.prototype,"index",void 0),wh([ee.Property(64)],Ph.prototype,"width",void 0),wh([ee.Property(!1)],Ph.prototype,"customWidth",void 0),wh([ee.Property(!1)],Ph.prototype,"hidden",void 0),wh([ee.Complex({},Fe)],Ph.prototype,"format",void 0),wh([ee.Property(!0)],Ph.prototype,"isLocked",void 0),wh([ee.Property("")],Ph.prototype,"validation",void 0),wh([ee.Property(!1)],Ph.prototype,"isReadOnly",void 0),Ph);function Ph(){return null!==Dh&&Dh.apply(this,arguments)||this}function de(e,t){return e.columns?e.columns[t]||(e.columns[t]={}):(e.columns=[],e.columns[t]={}),e.columns[t]}function Mh(e,t,r){var n=de(e,t);Object.keys(r).forEach(function(e){n[""+e]=r[""+e]})}function Bh(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;return n&&0<window.devicePixelRatio%1?i+((r=i*window.devicePixelRatio%1)?(.5<r?1-r:-1*r)/window.devicePixelRatio:0):i}function Uh(e,t,r,n){var i,o=0;(r=void 0===r?t:r)<t&&(i=t,t=r,r=i);for(var a=t;a<=r;a++)o+=Bh(e,a,null,n);return o}function pe(e,t){return e.columns[t]&&e.columns[t].hidden}function Hh(e,t,r){return!!(e&&e.validation&&(!e.validation.address||e.validation.address&&Dn(e.validation.address,t,r)))}function Vh(e){var t=[],r=e,n=t;return r.showRibbon&&n.push({member:"ribbon",args:[r]}),r.showFormulaBar&&n.push({member:"formulaBar",args:[r]}),r.showSheetTabs&&n.push({member:"sheetTabs",args:[r]}),r.allowEditing&&(n.push({member:"edit",args:[r]}),n.push({member:"formula",args:[r]})),r.allowOpen&&n.push({member:"open",args:[r]}),r.allowSave&&n.push({member:"save",args:[r]}),r.enableContextMenu&&n.push({member:"contextMenu",args:[r]}),r.allowAutoFill&&n.push({member:"autofill",args:[r]}),"None"!==r.selectionSettings.mode&&n.push({member:"selection",args:[r]}),r.enableKeyboardNavigation&&n.push({member:"keyboardNavigation",args:[r]}),r.allowNumberFormatting&&n.push({member:"numberFormat",args:[r]}),r.enableKeyboardShortcut&&n.push({member:"keyboardShortcut",args:[r]}),r.enableClipboard&&n.push({member:"clipboard",args:[r]}),r.allowCellFormatting&&n.push({member:"cellformat",args:[r]}),r.allowSorting&&n.push({member:"sort",args:[r]}),r.allowResizing&&n.push({member:"resize",args:[r]}),n.push({member:"protectSheet",args:[r]}),n.push({member:"workbookFormula",args:[r]}),n.push({member:"workbookEdit",args:[r]}),r.allowHyperlink&&n.push({member:"spreadsheetHyperlink",args:[r]}),r.enableNotes&&n.push({member:"spreadsheetNote",args:[r]}),r.allowUndoRedo&&n.push({member:"undoredo",args:[r]}),r.allowFiltering&&n.push({member:"filter",args:[r]}),r.allowWrap&&n.push({member:"wrapText",args:[r]}),r.allowInsert&&n.push({member:"insert",args:[r]}),r.allowDelete&&n.push({member:"delete",args:[r]}),r.allowDataValidation&&n.push({member:"dataValidation",args:[r]}),r.allowFindAndReplace&&n.push({member:"findAndReplace",args:[r]}),r.allowMerge&&n.push({member:"merge",args:[r]}),r.allowConditionalFormat&&n.push({member:"conditionalFormatting",args:[r]}),r.allowImage&&n.push({member:"spreadsheetImage",args:[r]}),r.allowChart&&n.push({member:"spreadsheetChart",args:[r]}),L(e,t),t}var jh="e-wraptext",T="spreadsheetLocale",O="dialog",zh="actionEvents",_h="shape",qh={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"]},Wh={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"]},Gh={UP:38,DOWN:40,LEFT:37,RIGHT:39,FIRSTALPHABET:65,LASTALPHABET:90,SPACE:32,BACKSPACE:8,TAB:9,DELETE:46,ENTER:13,ESC:27},Yh={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 Xh(e){requestAnimationFrame(function(){e()})}function Kh(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function $h(e){var t=30;return t=3<e.toString().length?10*e.toString().length:t}var Zh=null,Jh=1.24;function Qh(){var e,t;return null!==Zh?Zh:(t=0,(e=document.createElement("div")).style.cssText="width:100px;height: 100px;overflow: scroll;position: absolute;top: -9999px;",document.body.appendChild(e),t=e.offsetWidth-e.clientWidth|0,document.body.removeChild(e),Zh=t)}function ed(e,t,r){return td(e,"previous",t=t||["e-ribbon","e-formula-bar-panel","e-sheet-tab-panel","e-header-toolbar"],r=void 0===r?1:r)+td(e,"next",t,r)}function td(e,t,r,n){for(var i=e[t+"ElementSibling"],o=0;i;)r.some(function(e){return i.classList.contains(e)})&&(o+=i.getBoundingClientRect().height*n),i=i[t+"ElementSibling"];return o}function rd(e,t,r){if(e.scrollSettings.enableVirtualization){var n=e.getActiveSheet(),i=e.frozenRowCount(n),o=e.frozenColCount(n),a=e.viewport.topIndex+i,s=e.viewport.leftIndex+o,l=e.viewport.bottomIndex,h=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(a<=t[0]&&l>=t[2]&&s<=t[1]&&h>=t[3])return!0;n=!1;if(r){if(t[0]<a&&t[2]<a||t[0]>l&&t[2]>l)return!1;if(t[0]<a&&t[2]>a&&t[0]>=i&&(t[0]=a,n=!0),t[2]>l&&(t[2]=l,n=!0),t[1]<s&&t[3]<s||t[1]>h&&t[3]>h)return!1;t[1]<s&&t[3]>s&&t[1]>=o&&(t[1]=s,n=!0),t[3]>h&&(t[3]=h,n=!0)}return n}return!0}function nd(e,t,r,n,i,o,a,s){for(var l={idx:0,size:0},h={idx:0,size:0},d=h.size,p=l.size,c=h.idx;c<t[0];c++)r&&r-1<t[0]&&c<r||(d+=kh(e,c,!s));for(c=l.idx;c<t[1];c++)n&&n-1<t[1]&&c<n||(p+=Bh(e,c,null,!s));return r&&t[0]<r&&(e.showHeaders&&(d+=30),i)&&(d-=i),n&&t[1]<n&&(e.showHeaders&&(p+=a||30),o)&&(p-=o),{top:d,left:p}}function id(e,n,t,i,o,a,s){void 0===i&&(i="e-selection");var l,h,d,r,p,c,u,f,g,m,v=e.getActiveSheet();if(!v.frozenRows&&!v.frozenColumns)return m=ad(e,n,t,v,e.enableRtl,0,0,o),n&&!e.getMainContent().querySelector("."+i)&&e.getMainContent().appendChild(n),m;l=e.frozenRowCount(v),h=e.frozenColCount(v),"e-active-cell"===i?(t[0]<l||t[1]<h?(n.style.display="none",(u=(d=t[0]<l&&t[1]<h?e.getSelectAllContent():t[0]<l?e.getColumnHeaderContent():e.getRowHeaderContent()).querySelector("."+i))||(u=n.cloneNode(!0),d.appendChild(u)),ad(e,n=u,t,v,e.enableRtl,l,h,o,!0,e.viewport.beforeFreezeHeight,e.viewport.beforeFreezeWidth,e.sheetModule.colGroupWidth)):ad(e,n,t,v,e.enableRtl,l,h,o),n.style.display&&(n.style.display=""),od(e.getSelectAllContent(),d,"e-active-cell"),od(e.getColumnHeaderContent(),d,"e-active-cell"),od(e.getRowHeaderContent(),d,"e-active-cell")):"e-autofill"===i?(r=void 0,p=e.frozenRowCount(v),c=e.frozenColCount(v),t[0]<p||t[1]<c?(n.style.display="none",(u=(r=t[0]<p&&t[1]<c?e.getSelectAllContent():t[0]<p?e.getColumnHeaderContent():e.getRowHeaderContent()).querySelector("."+i))||(u=n.cloneNode(!0),r.appendChild(u)),ad(e,n=u,t,v,e.enableRtl,p,c,o,!0,e.viewport.beforeFreezeHeight,e.viewport.beforeFreezeWidth,e.sheetModule.colGroupWidth,"e-autofill")):ad(e,n,t,v,e.enableRtl,p,c,o,!1,0,0,0,"e-autofill"),n.style.display&&(n.style.display=""),od(e.getSelectAllContent(),r,"e-autofill"),od(e.getColumnHeaderContent(),r,"e-autofill"),od(e.getRowHeaderContent(),r,"e-autofill")):"e-filloption"===i?(r=void 0,p=e.frozenRowCount(v),c=e.frozenColCount(v),t[0]<p||t[1]<c?t[3]+1===c&&t[2]+1>p?ad(e,e.getMainContent().querySelector(".e-filloption"),t,v,e.enableRtl,p,c,o,!1,0,0,0,"e-filloption",!0,{left:-4}):t[2]+1===p&&t[3]+1>c?ad(e,e.getMainContent().querySelector(".e-filloption"),t,v,e.enableRtl,p,c,o,!1,0,0,0,"e-filloption",!0,{top:-4}):t[3]+1===c&&t[2]+1<p?((r=e.getColumnHeaderContent()).querySelector("."+i)||e.notify(on,{id:e.element.id+"_autofilloptionbtn",appendElem:r}),n=e.autofillModule.autoFillDropDown.element,ad(e,n,t,v,e.enableRtl,p,c,o,!1,0,0,0,"e-filloption",!0,{left:-4})):t[2]+1===p&&t[3]+1===c?ad(e,e.getMainContent().querySelector(".e-filloption"),t,v,e.enableRtl,p,c,o,!1,0,0,0,"e-filloption",!0,{top:-4,left:-4}):((u=(r=t[0]<p&&t[1]<c?e.getSelectAllContent():t[0]<p?e.getColumnHeaderContent():e.getRowHeaderContent()).querySelector("."+i))||e.notify(on,{id:e.element.id+"_autofilloptionbtn",appendElem:r}),n=e.autofillModule.autoFillDropDown.element,ad(e,n,t,v,e.enableRtl,p,c,o,!0,e.viewport.beforeFreezeHeight,e.viewport.beforeFreezeWidth,e.sheetModule.colGroupWidth,"e-filloption",!0)):ad(e,e.getMainContent().querySelector(".e-filloption"),t,v,e.enableRtl,p,c,o,!1,0,0,0,"e-filloption",!0),n.style.display&&(n.style.display=""),od(e.getSelectAllContent(),r,"e-filloption"),od(e.getColumnHeaderContent(),r,"e-filloption"),od(e.getRowHeaderContent(),r,"e-filloption")):(m=ne(t))[0]<l||m[1]<h?(n&&!n.classList.contains("e-multi-range")&&n.classList.add("e-hide"),f=[],m[0]<l&&m[1]<h?m[2]<l&&m[3]<h?(f.push(t),a||(od(e.getColumnHeaderContent(),d,i,!0),od(e.getRowHeaderContent(),d,i,!0))):m[2]>l-1?m[3]<h?(a||od(e.getColumnHeaderContent(),d,i,!0),f.push([m[0],m[1],l-1,m[3]]),f.push([l,m[1],m[2],m[3]])):(f.push([m[0],m[1],l-1,h-1]),f.push([l,m[1],m[2],h-1]),f.push([m[0],h,l-1,m[3]]),f.push([l,h,m[2],m[3]])):m[2]<l?(f.push([m[0],m[1],m[2],h-1]),f.push([m[0],h,m[2],m[3]]),a||od(e.getRowHeaderContent(),d,i,!0)):(f.push([l,m[1],m[2],h-1]),f.push([m[0],m[1],l-1,h-1]),f.push([l,h,m[2],m[3]]),f.push([m[0],h,l-1,m[3]])):m[0]<l?m[2]<l?(f.push(t),a||od(e.getRowHeaderContent(),d,i,!0)):(f.push([m[0],m[1],l-1,m[3]]),f.push([l,m[1],m[2],m[3]]),a||(od(e.getSelectAllContent(),d,i,!0),od(e.getRowHeaderContent(),d,i,!0))):m[3]<h?(f.push(t),a||od(e.getSelectAllContent(),d,i,!0)):(f.push([m[0],m[1],m[2],h-1]),f.push([m[0],h,m[2],m[3]]),a||(od(e.getSelectAllContent(),d,i,!0),od(e.getColumnHeaderContent(),d,i,!0))),f.forEach(function(t){var r;d=t[2]<l&&t[3]<h?e.getSelectAllContent():t[2]<l?e.getColumnHeaderContent():t[3]<h?e.getRowHeaderContent():e.getMainContent(),"e-copy-indicator"===i||"e-range-indicator"===i?(r=n.cloneNode(!0),d.appendChild(r),l&&(t[2]+1===l&&f.forEach(function(e){e!==t&&(g=r.getElementsByClassName("e-bottom")[0])&&e[0]===l&&ee.detach(g)}),t[0]===l)&&d.parentElement.classList.contains("e-main-panel")&&f.forEach(function(e){e!==t&&(g=r.getElementsByClassName("e-top")[0])&&e[2]+1===l&&ee.detach(g)}),h&&(t[3]+1===h&&f.forEach(function(e){e!==t&&(g=r.getElementsByClassName("e-right")[0])&&e[1]===h&&ee.detach(g)}),t[1]===h)&&(d.classList.contains("e-sheet-content")||d.classList.contains("e-column-header"))&&f.forEach(function(e){e!==t&&(g=r.getElementsByClassName("e-left")[0])&&e[3]+1===h&&ee.detach(g)})):((r=d.querySelector("."+i))||(r=n.cloneNode(!0),a&&!r.classList.contains("e-multi-range")&&r.classList.add("e-multi-range"),d.appendChild(r)),s&&r.classList.remove(i)),ad(e,r,t,v,e.enableRtl,l,h,o,!1,e.viewport.beforeFreezeHeight,e.viewport.beforeFreezeWidth,e.sheetModule.colGroupWidth),r.classList.contains("e-hide")&&r.classList.remove("e-hide")})):(a||(od(e.getSelectAllContent(),null,i,!0),od(e.getColumnHeaderContent(),null,i,!0),od(e.getRowHeaderContent(),null,i,!0)),ad(e,n,t,v,e.enableRtl,l,h,o),"e-range-indicator"!==i&&e.getMainContent().querySelector("."+i)||e.getMainContent().appendChild(n),n.classList.contains("e-hide")&&n.classList.remove("e-hide"),s&&n.classList.remove(i))}function od(e,t,r,n,i){if(n||e!==t)if(i)for(var o=e.querySelectorAll("."+r),a=0;a<o.length;)o[a].classList.remove(r),a++;else{n=e.querySelector("."+r);n&&!n.classList.contains("e-multi-range")&&ee.detach(n)}}function ad(e,t,r,n,i,o,a,s,l,h,d,p,c,u,f){var g,r=ne(r),o=nd(n,r,o,a,h,d,p),h=[Y(n,0,!0),Y(n,0,!0,"columns")],d=e.scrollSettings.isFinite?(g=r[0]>=n.rowCount?0:Ah(n,r[0],r[2]<n.rowCount?r[2]:n.rowCount-1,!0),r[1]>=n.colCount?0:Uh(n,r[1],r[3]<n.colCount?r[3]:n.colCount-1,!0)):(g=Ah(n,r[0],r[2],!0),Uh(n,r[1],r[3],!0)),p=0===r[1]&&r[3]===n.colCount-1,e=0===r[0]&&r[2]===n.rowCount-1,n=0,m=-5,v=-5,y=0,C=6,b=6;if(ee.isNullOrUndefined(c)){if((x={top:(r[0]===h[0]?o.top:o.top-Sd(1))+"px",height:g&&g+(r[0]===h[0]?0:Sd(1))+"px",width:d&&d+(r[1]===h[1]?0:Sd(1))+(l&&a&&r[1]<a&&r[3]>=a?1:0)+"px"})[i?"right":"left"]=(r[1]===h[1]?o.left:o.left-1)+"px",t)return sd([{element:t,attrs:x}],s)}else{p&&(m=-5,v=-2,C=6,b=3),e&&(v=-5,m=0,C=1,b=6),e||(n+=g),p||(y+=d),n+=Math.round(o.top)+m,y+=Math.round(o.left)+v;var x={};u?(ee.removeClass([t],"e-hide"),n=f&&f.top?f.top:n,y=f&&f.left?f.left:y,(x={top:n+C+"px"})[i?"right":"left"]=y+b+"px"):(x={top:n+"px"})[i?"right":"left"]=y+"px",t&&sd([{element:t,attrs:x}],s)}}function sd(r,n){return new Promise(function(t){function e(){r.forEach(function(e){ee.setStyleAttribute(e.element,e.attrs),t()})}n?e():requestAnimationFrame(e)})}function ld(){return ee.Browser.isPointer?"pointerdown":"mousedown touchstart"}function hd(){return ee.Browser.isPointer?"pointermove":"mousemove touchmove"}function dd(){return ee.Browser.isPointer?"pointerup":"mouseup touchend"}function pd(e){return"touchstart"===e.type||"pointerdown"===e.type&&"touch"===e.pointerType}function cd(e){return"touchmove"===e.type||"pointermove"===e.type&&"touch"===e.pointerType}function ud(e){return"touchend"===e.type||"pointerup"===e.type&&"touch"===e.pointerType}function fd(e){return e&&("mousedown"===e.type||"pointerdown"===e.type)}function gd(e){return e&&("mousemove"===e.type||"pointermove"===e.type)}function md(e){return e&&("mouseup"===e.type||"pointerup"===e.type)}function vd(e){return e===Gh.UP||e===Gh.DOWN||e===Gh.LEFT||e===Gh.RIGHT}function yd(e){return(e.changedTouches?e.changedTouches[0]:e).clientX}function Cd(e){return(e.changedTouches?e.changedTouches[0]:e).clientY}function bd(e){return(e.changedTouches?e.changedTouches[0]:e).pageX}function xd(e){return(e.changedTouches?e.changedTouches[0]:e).pageY}function Sd(e,t){var r;return 0<window.devicePixelRatio%1?e+((r=e*window.devicePixelRatio%1)?(.5<r||t?1-r:-1*r)/window.devicePixelRatio:0):e}var wd={role:"role",selected:"aria-selected",multiselectable:"aria-multiselectable",busy:"aria-busy",colcount:"aria-colcount"};function Id(t,r){Object.keys(r).forEach(function(e){t&&t.setAttribute(wd[""+e],r[""+e])})}function Ed(e,t){e&&(e=ee.getComponent(e,t))&&e.destroy()}function Nd(e,t,r,n,i){var o,a,s,l,h=i.getActiveSheet(),d=i.frozenRowCount(h),p=i.frozenColCount(h);if(n)var c=e<p?i.getSelectAllContent():i.getColumnHeaderContent(),u=c.getElementsByTagName("th")[t],f=c.getElementsByTagName("col")[t],g=(e<p?i.getRowHeaderContent():i.getMainContent()).getElementsByTagName("col")[t];else{u=f=d||p?i.getRow(e,null,p-1):i.getRow(e,i.getRowHeaderTable()),f.style.height=0<parseInt(r,10)?Sd(parseInt(r,10))+"px":"2px",(g=i.getRow(e,null,p)).style.height=0<parseInt(r,10)?Sd(parseInt(r,10))+"px":"0px";for(var c=void 0,m=(h.showHeaders&&(d=i.getRowHeaderContent().getElementsByClassName("e-row"),(p=[])[0]=d[t].getElementsByTagName("td")[0].cloneNode(!0),c=Fd(i.getRowHeaderTable(),p,!1,i)+1),i.getMainContent().getElementsByClassName("e-row")),v=0,y=0,C=e,b=0;b<m[t].getElementsByTagName("td").length;b++){var x,S=m[t].getElementsByTagName("td")[b],w=(b,S.cloneNode(!0),se(C,b,h,!1,!0)),y=y<(v=w.value?Td(i,w.style):v)?v:y;S.getElementsByClassName("e-cf-databar")[0]&&(x=Number(g.style.height.split("px")[0]),i.notify(Br,{indexes:[C,b],cell:w,ele:S,isRender:!0,resizedRowHeight:x}))}var d=y+1,p=d<=c?c:d;parseInt(g.style.height,10)<p||u&&u.classList.contains("e-reach-fntsize")&&parseInt(g.style.height,10)===p?(h.showHeaders&&(u.classList.add("e-reach-fntsize"),f.style.lineHeight=4<=parseInt(r,10)?parseInt(r,10)-4+"px":0<parseInt(r,10)?parseInt(r,10)-1+"px":"0px"),g.style.lineHeight=0<parseInt(r,10)?parseInt(r,10)-1+"px":"0px"):(f&&f.style.removeProperty("line-height"),g.style.removeProperty("line-height"),u&&u.classList.contains("e-reach-fntsize")&&u.classList.remove("e-reach-fntsize"))}if(e=g.previousElementSibling,c=g.nextElementSibling,e&&(h.showHeaders&&(o=u.previousElementSibling,a=f.previousElementSibling),e=g.previousElementSibling),c&&(h.showHeaders&&(s=u.nextElementSibling,l=f.nextElementSibling),c=g.nextElementSibling),parseInt(r,10)<=0&&!g.classList.contains("e-zero")&&!g.classList.contains("e-zero-start")){if(e&&c)if(n?(h.showHeaders&&(f.style.width="2px"),g.style.width="0px"):(h.showHeaders&&(f.style.height="2px"),g.style.height="0px"),e.classList.contains("e-zero-start")?(h.showHeaders&&u.classList.add("e-zero-start"),g.classList.add("e-zero-start")):(h.showHeaders&&u.classList.add("e-zero"),g.classList.add("e-zero")),!s||s.classList.contains("e-zero")||s.classList.contains("e-zero-last")||(h.showHeaders&&u.classList.add("e-zero-last"),g.classList.add("e-zero-last")),e.classList.contains("e-zero-last")&&(h.showHeaders&&o.classList.remove("e-zero-last"),e.classList.remove("e-zero-last")),h.showHeaders&&o.classList.contains("e-zero")?(u.classList.contains("e-zero-end"),Rd(a,-2,n)):h.showHeaders&&Rd(a,-1,n),h.showHeaders&&o.classList.contains("e-zero-start")&&Rd(f,-1,n),h.showHeaders&&s.classList.contains("e-zero"))if(u.classList.contains("e-zero-start"))for(;s;){if(s.classList.contains("e-zero")&&0!==parseInt(l.style.height,10)&&!n||0!==parseInt(l.style.width,10)&&n){n?(f.style.width=parseInt(f.style.width,10)-1+"px",l.style.width=parseInt(l.style.width,10)-1+"px"):(f.style.height=parseInt(f.style.height,10)-1+"px",l.style.height=parseInt(l.style.height,10)-1+"px"),s.classList.remove("e-zero"),s.classList.add("e-zero-start");break}var I=void 0;s.classList.remove("e-zero"),s.classList.add("e-zero-start"),l=(n?(I=parseInt(s.getAttribute("aria-colindex"),10)-1,s=i.getColHeaderTable().getElementsByTagName("th")[I+1],i.getColHeaderTable().getElementsByTagName("col")):(I=parseInt(s.getAttribute("aria-rowindex"),10)-1,s=i.getRowHeaderTable().getElementsByTagName("tr")[I+1],i.getRowHeaderTable().getElementsByTagName("tr")))[I+1]}else Rd(f,-2,n);else h.showHeaders&&(s.classList.contains("e-zero-end")?n?f.style.width="0px":f.style.height="0px":Rd(l,-1,n));else if(e)n?(h.showHeaders&&(f.style.width="1px"),g.style.width="0px"):(h.showHeaders&&(f.style.height="1px"),g.style.height="0px"),h.showHeaders&&u.classList.add("e-zero-end"),g.classList.add("e-zero-end"),h.showHeaders&&u.classList.add("e-zero-last"),g.classList.add("e-zero-last"),h.showHeaders&&o.classList.contains("e-zero")?Rd(a,-2,n):Rd(a,-1,n);else if(s)if(u.classList.add("e-zero-start"),g.classList.add("e-zero-start"),s.classList.contains("e-zero")||(u.classList.add("e-zero-last"),g.classList.add("e-zero-last")),n?(f.style.width="1px",g.style.width="0px"):(f.style.height="1px",g.style.height="0px"),h.showHeaders&&s.classList.contains("e-zero"))for(;s;){if(s.classList.contains("e-zero")&&0!==parseInt(l.style.width,10)&&n||0!==parseInt(l.style.height,10)&&!n){n?(l.style.width=parseInt(l.style.width,10)-1+"px",f.style.width=parseInt(f.style.width,10)-1+"px"):(l.style.height=parseInt(l.style.height,10)-1+"px",f.style.height=parseInt(f.style.height,10)-1+"px"),s.classList.add("e-zero-start"),s.classList.remove("e-zero");break}I=void 0;s.classList.add("e-zero-start"),s.classList.remove("e-zero"),s=(n?(I=parseInt(s.getAttribute("aria-colindex"),10)-1,l=i.getColHeaderTable().getElementsByTagName("col")[I+1],i.getColHeaderTable().getElementsByTagName("th")):(I=parseInt(s.getAttribute("aria-rowindex"),10)-1,l=i.getRowHeaderTable().getElementsByTagName("tr")[I+1],i.getRowHeaderTable().getElementsByTagName("tr")))[I+1]}else h.showHeaders&&Rd(l,-1,n)}else 0<parseInt(r,10)&&(d=Sd(parseInt(r,10))+"px",n?(f.style.width=d,g.style.width=d):(f.style.height=d,g.style.height=d),h.showHeaders&&o&&s?(o.classList.contains("e-zero")?u.classList.contains("e-zero")?n?(a.style.width=parseInt(a.style.width,10)+2+"px",f.style.width=parseInt(f.style.width,10)-1+"px"):(a.style.height=parseInt(a.style.height,10)+2+"px",f.style.height=parseInt(f.style.height,10)-1+"px"):Rd(f,-1,n):u.classList.contains("e-zero")?Rd(a,1,n):u.classList.contains("e-zero-start")&&(n?(a.style.width=parseInt(a.style.width,10)+1+"px",f.style.width=parseInt(f.style.width,10)-1+"px"):(a.style.height=parseInt(a.style.height,10)+1+"px",f.style.height=parseInt(f.style.height,10)-1+"px")),s.classList.contains("e-zero")?Rd(f,-1,n):(u.classList.contains("e-zero")||u.classList.contains("e-zero-start"))&&Rd(l,1,n),u.classList.contains("e-zero")&&u.classList.remove("e-zero"),u.classList.contains("e-zero-start")&&u.classList.remove("e-zero-start"),g.classList.contains("e-zero")&&g.classList.remove("e-zero"),g.classList.contains("e-zero-start")&&g.classList.remove("e-zero-start"),u.classList.contains("e-zero-last")&&u.classList.remove("e-zero-last"),g.classList.contains("e-zero-last")&&g.classList.remove("e-zero-last"),(o.classList.contains("e-zero")||o.classList.contains("e-zero-start"))&&(o.classList.add("e-zero-last"),e.classList.add("e-zero-last"))):h.showHeaders&&o?(o.classList.contains("e-zero")?u.classList.contains("e-zero")?n?(f.style.width=parseInt(f.style.width,10)-1+"px",a.style.width=parseInt(a.style.width,10)+2+"px"):(f.style.height=parseInt(f.style.height,10)-1+"px",a.style.height=parseInt(a.style.height,10)+2+"px"):Rd(f,-1,n):u.classList.contains("e-zero")?Rd(a,1,n):Rd(f,-1,n),u.classList.contains("e-zero")&&u.classList.remove("e-zero"),u.classList.contains("e-zero-end")&&u.classList.remove("e-zero-end"),g.classList.contains("e-zero")&&g.classList.remove("e-zero"),g.classList.contains("e-zero-end")&&g.classList.remove("e-zero-end")):h.showHeaders&&s&&(s.classList.contains("e-zero")?Rd(f,-1,n):u.classList.contains("e-zero-start")&&(Rd(l,1,n),u.classList.remove("e-zero-start")),u.classList.contains("e-zero")&&u.classList.remove("e-zero"),g.classList.contains("e-zero")&&g.classList.remove("e-zero"),u.classList.contains("e-zero-start")&&u.classList.remove("e-zero-start"),g.classList.contains("e-zero-start"))&&g.classList.remove("e-zero-start"))}function Rd(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 Fd(e,t,r,n,i,o){var a,s,l=n.createElement("div",{className:n.element.className,styles:"display: block"}),h=n.createElement("table",{className:e.className+"e-resizetable",styles:"width: auto;height: auto"}),d=n.createElement("tr"),e=(r?t.forEach(function(e){var t=d.cloneNode();t.appendChild(e),h.appendChild(t)}):(t.forEach(function(e){d.appendChild(e.cloneNode(!0))}),h.appendChild(d)),l.appendChild(h),document.body.appendChild(l),h.getBoundingClientRect().width),n=h.getBoundingClientRect().height;return o?(a=r&&parseInt(i,10)>e?e:parseInt(i,10),s=!r&&parseInt(i,10)>n?n:parseInt(i,10)):(s=n,a=e),document.body.removeChild(l),r?Math.ceil(a):Math.ceil(s)}function kd(e,t,r,n,i,o){var a=e.eventArgs,s=e.isFromUpdateAction||ee.isUndefined(r);if(e.isUndoRedo)s=e.isFromUpdateAction=!0,delete e.isUndoRedo,t.notify(ma,e);else{if(s&&!o){var o=a.address||a.range||a.pastedRange||a.addressCollection&&a.addressCollection[0]||a.dataRange,o=ee.isUndefined(a.sheetIndex)?ee.isUndefined(a.sheetIdx)?ee.isUndefined(a.activeSheetIndex)?o?N(t,o):t.activeSheetIndex:a.activeSheetIndex:a.sheetIdx:a.sheetIndex;if(o!==t.activeSheetIndex)return o={sheet:ae(t,o),resolveAfterFullDataLoaded:!0,indexes:[0,0,0,0],promise:new Promise(function(e){e(void 0)})},t.notify(ht,o),void o.promise.then(function(){kd(e,t,r,n,i,!0)})}var l,h,d,p,c=Ii(t,a.index);switch(e.action){case"sorting":l={range:e.eventArgs.range,sortOptions:e.eventArgs.sortOptions,cancel:!1},p=new Promise(function(e){e(void 0)}),t.notify(Xt,l={args:l,promise:p}),l.promise.then(function(e){t.serviceLocator.getService("cell").refreshRange(P(e.range))});break;case"cellSave":l={element:(l=e.eventArgs).element,value:l.value,oldValue:l.oldValue,address:l.address,displayText:l.displayText,formula:l.formula,originalEvent:l.originalEvent},t.updateCellInfo(l.formula?{formula:l.formula}:{value:l.value},l.address,!1,e.eventArgs,r),!0===r&&t.trigger("cellSave",l);break;case"addNote":case"editNote":case"deleteNote":l=P(e.eventArgs.address),r&&(_n(t,t.getActiveSheet(),{rowIdx:l[0],colIdx:l[1],preventEvt:!0,cell:{notes:e.eventArgs.notes}}),t.serviceLocator.getService("cell").refreshRange(P(a.address),!1,!1,!0,!1,Jn(t)));break;case"cellDelete":l=E(t,e.eventArgs.address),_d(t,l.indices,l.sheetIndex);break;case"format":"CellFormat"===a.requestType?(a.style&&a.style.border&&!ee.isNullOrUndefined(a.borderType)?(l={},Object.assign(l,a.style,null,!0),a.style.border=void 0,t.notify(Et,{style:a.style,refreshRibbon:!0,range:a.range}),a.style.border=l.border,t.setBorder(a.style,a.range,a.borderType),a.style=l):t.notify(Et,{style:a.style,refreshRibbon:!0,range:a.range}),Xh(function(){t.selectRange(t.getActiveSheet().selectedRange)})):t.numberFormat(a.format,a.range);break;case"clipboard":l=new Promise(function(e){e(void 0)}),d=t.getAddressInfo(a.copiedRange),t.notify(a.copiedInfo.isCut?Fo:ko,{range:d.indices,sId:ae(t,d.sheetIndex).id,promise:p,invokeCopy:!0,isPublic:!0,isFromUpdateAction:!0}),l.then(function(){return t.notify(Oo,{range:P(a.pastedRange),sIdx:B(t,Ei(a.pastedRange)),type:a.type,isAction:!1,isInternal:!0,isFromUpdateAction:!0})});break;case"gridLines":t.setSheetPropertyOnMute(t.sheets[a.sheetIdx],"showGridLines",a.isShow),t.serviceLocator.getService("sheet").toggleGridlines(),t.notify(qr,null);break;case"headers":t.setSheetPropertyOnMute(t.sheets[a.sheetIdx],"showHeaders",a.isShow),t.serviceLocator.getService("sheet").showHideHeaders(),t.notify(qr,null);break;case"resize":case"resizeToFit":s&&(d=de(h=t.sheets[a.sheetIndex],a.index),l=Nh(h,a.index),a.isCol&&d&&d.hidden||l&&l.hidden)&&t.notify(Pr,{startIndex:a.index,endIndex:a.index,hide:!1,isCol:a.isCol,sheetIndex:a.sheetIndex}),a.isCol?void 0===a.hide?t.setColWidth(s&&!ee.isUndefined(r)?a.oldWidth:a.width,a.index,a.sheetIndex):t.hideColumn(a.index,a.index,a.hide):(void 0===a.hide?t.setRowHeight(s&&!ee.isUndefined(r)?a.oldHeight:a.height,a.index,a.sheetIndex):t.hideRow(a.index,a.index,a.hide),t.notify(ea,{rowIndex:a.index}));break;case"renameSheet":t.setSheetPropertyOnMute(t.sheets[c],"name",a.value),t.notify(fa,{items:t.element.querySelector(".e-sheet-tabs-items"),value:a.value,idx:c});break;case"hideSheet":t.notify(ga,{sheetIndex:a.sheetIndex});break;case"showSheet":t.notify(es,a);break;case"removeSheet":t.notify(xo,{index:a.index,isAction:!0,count:a.sheetCount,clicked:!0});break;case"gotoSheet":t.notify(Qa,{selectedIndex:a.currentSheetIndex,previousIndex:a.previousSheetIndex});break;case"moveSheet":Li(t,a.position,a.sheetIndexes,null,s);break;case"wrap":zi(e.eventArgs.address,e.eventArgs.wrap,t);break;case"hideShow":a.isCol?t.notify(Pr,{startIndex:a.startIndex,endIndex:a.endIndex,isCol:!0,hide:!1===r?!a.hide:a.hide,sheetIndex:a.sheetIndex,hiddenIndexes:a.hiddenIndexes}):t.notify(Pr,{startIndex:a.startIndex,endIndex:a.endIndex,hide:!1===r?!a.hide:a.hide,sheetIndex:a.sheetIndex});break;case"replace":t.notify(gr,{value:a.compareValue,replaceValue:a.replaceValue,sheetIndex:a.sheetIndex,address:a.address});break;case"replaceAll":t.notify(mr,a);break;case"filter":p=new Promise(function(e){e(void 0)}),!1===r?t.notify(xa,{predicates:a.previousPredicates,range:a.range,sIdx:a.sheetIndex,promise:p,isInternal:!0}):t.notify(xa,{predicates:a.predicates,range:a.range,sIdx:a.sheetIndex,promise:p,isInternal:!0,useFilterRange:a.useFilterRange,allowHeaderFilter:a.allowHeaderFilter}),i&&!s&&p.then(function(){t.notify(le,ee.extend({isUndo:!r,isUndoRedo:!s},i))});break;case"insert":if("Sheet"===e.eventArgs.modelType)h=t;else if(!(h=ae(t,e.eventArgs.activeSheetIndex)))break;!1===r?t.notify(hr,{model:h,start:e.eventArgs.index,isUndoRedo:!0,end:e.eventArgs.index+(e.eventArgs.model.length-1),modelType:e.eventArgs.modelType}):t.notify(lr,{model:h,start:e.eventArgs.index,end:e.eventArgs.index+(e.eventArgs.model.length-1),modelType:e.eventArgs.modelType,checkCount:void 0===r?e.eventArgs.sheetCount:null,activeSheetIndex:e.eventArgs.activeSheetIndex,isUndoRedo:!0,insertType:e.eventArgs.insertType,isFromUpdateAction:s});break;case"delete":if("Sheet"===e.eventArgs.modelType)h=t;else if(!(h=ae(t,e.eventArgs.activeSheetIndex)))break;!1===r?t.notify(lr,{model:h,start:e.eventArgs.deletedModel,modelType:e.eventArgs.modelType,columnCellsModel:e.eventArgs.deletedCellsModel,definedNames:e.eventArgs.definedNames,activeSheetIndex:e.eventArgs.activeSheetIndex,isUndoRedo:!0,insertType:"Row"===e.eventArgs.modelType?"above":"before",conditionalFormats:e.eventArgs.conditionalFormats,prevAction:e.action}):t.notify(hr,{model:h,start:e.eventArgs.startIndex,checkCount:e.eventArgs.sheetCount,end:e.eventArgs.endIndex,modelType:e.eventArgs.modelType,isUndoRedo:!0,insertType:"Row"===e.eventArgs.modelType?"above":"before"});break;case"validation":!1===r?t.notify(Za,{range:a.range}):t.notify(pr,{rules:{type:a.type,operator:a.operator,value1:a.value1,value2:a.value2,ignoreBlank:a.ignoreBlank,inCellDropDown:a.inCellDropDown},range:a.range});break;case"removeHighlight":case"addHighlight":t.notify(La,{isRemoveHighlight:"removeHighlight"===e.action?!1!==r:!1===r,range:a.range,isPublic:!0});break;case"merge":e.eventArgs.isAction=!1;for(var u=[],f=0,g=a.model.length;f<g;f++){u.push({cells:[]});for(var m=0,v=a.model[f].cells.length;m<v;m++)u[f].cells[m]={},Object.assign(u[f].cells[m],a.model[f].cells[m])}if(t.notify(Or,e.eventArgs),"Manual"===t.calculationMode&&r&&t.getActiveSheet().isSheetCalculated)for(var y=0;y<a.model.length;y++)for(var C=a.model[y].cells,b=0;b<C.length;b++){var x=a.model[y].cells[b].value;u[y].cells[b].value=ee.isNullOrUndefined(x)||""===x?u[y].cells[b].value:x}a.model=u;break;case"clear":d={options:e.eventArgs,isFromUpdateAction:s},t.notify(rs,d),!s&&d.cfClearActionArgs&&(a.cfClearActionArgs.previousConditionalFormats=d.cfClearActionArgs.previousConditionalFormats,a.cfClearActionArgs.conditionalFormats=d.cfClearActionArgs.conditionalFormats);break;case"conditionalFormat":!1===r?t.notify(Ur,{range:a.range,cfModel:{type:a.type,cFColor:a.cFColor,value:a.value},sheetIdx:a.sheetIdx,isUndoRedo:!a.cancel,isFromUpdateAction:s}):t.notify(Mr,{cfModel:{type:a.type,cFColor:a.cFColor,value:a.value,range:a.range},sheetIdx:a.sheetIdx,isUndoRedo:!0,isFromUpdateAction:s});break;case"clearCF":!1===r?t.notify(Ur,{oldCFModel:a.previousConditionalFormats,updatedCFModel:a.conditionalFormats,range:a.selectedRange,isUndo:!0,sheetIdx:a.sheetIdx}):(l={range:a.selectedRange,sheetIdx:a.sheetIdx,isUndoRedo:!0,isFromUpdateAction:s},t.notify(Ur,l),s||(a.previousConditionalFormats=l.oldCFModel,l.updatedCFModel.length?a.conditionalFormats=l.updatedCFModel:delete a.conditionalFormats));break;case"insertImage":!1===r?t.notify(ms,{id:e.eventArgs.id,sheetIdx:e.eventArgs.sheetIndex+1,range:e.eventArgs.range,preventEventTrigger:!0}):t.notify(gs,{options:{src:e.eventArgs.imageData,height:e.eventArgs.imageHeight,width:e.eventArgs.imageWidth,id:e.eventArgs.id},range:e.eventArgs.range,isPublic:!1,isUndoRedo:!0});break;case"deleteImage":!1===r?t.notify(gs,{options:{src:e.eventArgs.imageData,height:e.eventArgs.imageHeight,width:e.eventArgs.imageWidth,id:e.eventArgs.id},range:e.eventArgs.address,isPublic:!1,isUndoRedo:!0}):t.notify(ms,{id:e.eventArgs.id,range:e.eventArgs.address,preventEventTrigger:!0});break;case"imageRefresh":p=document.getElementById(e.eventArgs.id),!1===r?t.notify(cs,{prevTop:e.eventArgs.currentTop,prevLeft:e.eventArgs.currentLeft,currentTop:e.eventArgs.prevTop,currentLeft:e.eventArgs.prevLeft,id:e.eventArgs.id,currentHeight:e.eventArgs.prevHeight,currentWidth:e.eventArgs.prevWidth,requestType:"imageRefresh",prevHeight:e.eventArgs.currentHeight,prevWidth:e.eventArgs.currentWidth,isUndoRedo:!0}):(e.eventArgs.isUndoRedo=!0,t.notify(cs,e.eventArgs)),p&&(p.style.height=!1===r?e.eventArgs.prevHeight+"px":e.eventArgs.currentHeight+"px",p.style.width=!1===r?e.eventArgs.prevWidth+"px":e.eventArgs.currentWidth+"px",p.style.top=!1===r?e.eventArgs.prevTop+"px":e.eventArgs.currentTop+"px",p.style.left=!1===r?e.eventArgs.prevLeft+"px":e.eventArgs.currentLeft+"px");break;case"insertChart":!1===r?t.notify(vs,{id:a.id,range:a.range,isUndoRedo:!0}):(h=[{type:a.type,theme:a.theme,markerSettings:a.markerSettings,isSeriesInRows:a.isSeriesInRows,range:a.range,id:a.id,height:a.height,width:a.width,top:a.top,left:a.left}],t.notify(zr,{chart:h,isUndoRedo:!1,range:a.posRange}));break;case"deleteChart":!1===r?(d=[{type:a.type,theme:a.theme,markerSettings:a.markerSettings,isSeriesInRows:a.isSeriesInRows,range:a.range,id:a.id,height:a.height,width:a.width,top:a.top,left:a.left}],t.notify(zr,{chart:d,isUndoRedo:!1,range:a.posRange})):t.notify(vs,{id:a.id,range:a.range,isUndoRedo:!0});break;case"chartRefresh":(l=document.getElementById(e.eventArgs.id))&&(l.style.height=!1===r?e.eventArgs.prevHeight+"px":e.eventArgs.currentHeight+"px",l.style.width=!1===r?e.eventArgs.prevWidth+"px":e.eventArgs.currentWidth+"px",l.style.top=!1===r?e.eventArgs.prevTop+"px":e.eventArgs.currentTop+"px",l.style.left=!1===r?e.eventArgs.prevLeft+"px":e.eventArgs.currentLeft+"px"),!1===r?(t.notify(ys,ee.extend({},e.eventArgs,{currentColIdx:e.eventArgs.prevColIdx,currentHeight:e.eventArgs.prevHeight,currentLeft:e.eventArgs.prevLeft,currentRowIdx:e.eventArgs.prevRowIdx,currentTop:e.eventArgs.prevTop,currentWidth:e.eventArgs.prevWidth,prevColIdx:e.eventArgs.currentColIdx,prevHeight:e.eventArgs.currentHeight,prevLeft:e.eventArgs.currentLeft,prevRowIdx:e.eventArgs.currentRowIdx,prevTop:e.eventArgs.currentTop,prevWidth:e.eventArgs.currentWidth,isUndoRedo:!0})),t.notify(Gr,{height:e.eventArgs.prevHeight.toString(),width:e.eventArgs.prevWidth.toString(),overlayEle:l})):(e.eventArgs.isUndoRedo=!0,t.notify(ys,e.eventArgs),t.notify(Gr,{height:e.eventArgs.currentHeight.toString(),width:e.eventArgs.currentWidth.toString(),overlayEle:l}));break;case"chartDesign":t.notify(Fs,e.eventArgs);break;case"autofill":s&&a.undoArgs&&(a.undoArgs.isFromUpdateAction=a.undoArgs.isUndo=a.undoArgs.preventEvt=!0,a.undoArgs.isPublic=!0,t.notify(ma,a.undoArgs)),t.notify(tn,{fillRange:e.eventArgs.fillRange,dataRange:e.eventArgs.dataRange,fillType:e.eventArgs.fillType,direction:e.eventArgs.direction,cells:e.eventArgs.beforeActionData});break;case"removeValidation":!1!==r&&t.notify(Za,{range:a.range,isCol:a.isColSelected});break;case"addDefinedName":!1===r?t.notify(ie,{action:"removeDefinedName",isRemoved:!1,definedName:a.name,scope:a.scope,isEventTrigger:!0}):(p={name:a.name,refersTo:a.refersTo,scope:a.scope,comment:a.comment},t.notify(ie,{action:"addDefinedName",isAdded:!1,definedName:p,isEventTrigger:!0}));break;case"hyperlink":t.notify(tr,{hyperlink:a.hyperlink,cell:a.address,displayText:a.displayText,isUndoRedo:!0}),t.serviceLocator.getService("cell").refreshRange(P(a.address),!1,!1,!1,!0,Jn(t));break;case"removeHyperlink":t.notify(ca,{range:a.address,preventEventTrigger:!0});break;case"freezePanes":t.freezePanes(a.row,a.column,a.sheetIndex);break;case"duplicateSheet":Pi(t,a.sheetIndex,null,s);break;case"protectSheet":a.isProtected?t.notify(Ir,a):(t.setSheetPropertyOnMute(ae(t,a.sheetIndex),"password",""),t.notify(Ma,{isActive:!0,sheetIndex:a.sheetIndex}));break;case"protectWorkbook":a.isProtected?t.notify(Ls,a):t.notify(Ps,null);break;case"lockCells":t.notify(kr,a)}}}function Od(e,t,r,n){for(var i,o=e.sheets[n].ranges,a=0,s=o.length;a<s;a++)if(o[a].template&&(i=te(o[a].address.length?o[a].address:o[a].startCell))[0]<=t&&i[1]<=r&&i[2]>=t&&i[3]>=r)return!0;return!1}function Ad(e,t,r,n,i,o,a,s){void 0===a&&(a=!0);var l=kh(t,n,!0),h=Sd(r);!s&&(s=e.frozenColCount(t),(i=i||(t.frozenRows?e.getRow(n,null,s):e.getRow(n)))&&(i.style.height=h+"px"),o=t.frozenColumns?o||e.getRow(n,null,s-1):(i=e.frozenRowCount(t),o||e.getRow(n,n<i?e.sheetModule.getSelectAllTable():e.getRowHeaderTable())))&&(o.style.height=h+"px"),Oh(t,n,r),e.setProperties({sheets:e.sheets},!0),a&&e.notify(Go,{rowIdx:n,threshold:h-l})}function Td(e,t,r,n){void 0===r&&(r=1);var i=t&&t.fontSize||e.cellStyle.fontSize,i=(-1<i.indexOf("pt")?parseInt(i,10)/.75:parseInt(i,10))*(n||Dd(t&&t.fontFamily?t:e.cellStyle))*r;return Math.ceil(.9<i%1?1+i:i)}function Dd(e){var t=Jh;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 Ld(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:Sd(i.measureText(e).width,!0)}function Pd(e,r,n,i){function o(e,t){c&&g++,1<=s/r&&(e.split("").forEach(function(e){d=Ld(e,n,i,!0),r<(h+=d)&&(g++,h=d)}),s=Sd(h,!0)),t||a(s),c=s}function a(e){s+=1<=(e+f)/r?0:f}var s,l,h,d,p,t,c=0,u=e.toString().split(" "),f=Ld(" ",n,i),g=0,e=0;return u.forEach(function(t){d=h=0,s=Ld(t,n,i),1<(c+s)/r?1<(l=t.split("-")).length?l.forEach(function(e){d=h=0,p=p||Ld("-",n,i),s=Ld(e,n,i),l[l.length-1]!==e&&(s+=p),1<=(c+s)/r?o(e,l[l.length-1]!==e):(l[l.length-1]===e&&u[u.length-1]!==t&&a(c+s),c+=s)}):o(t,!1):(a(c+s),c+=s)}),c&&(e=(c-f)/r,t=parseFloat(e.toString().split(".")[0]),g+=t+1<=e+.05?Math.ceil(e)+1:Math.ceil(e)),g}function Md(e,t,r){var n=0,i=se(e,t,r,null,!0),e=(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])))),se(e+1,t,r,null,!0));return i.style&&(i.style.border||i.style.borderBottom)||!e.style||!e.style.borderTop||(n+=parseFloat(e.style.borderTop.split("px")[0])),Math.ceil(n)||1}function Bd(e,t,r,n){return Uh(e,r,n=void 0===n?r:n,!0)-Sd(4+(i=se(n=t,t=r,r=e,null,!(e=0)),n=se(n,t+1,r,null,!0),i.style&&(i.style.border?e=(0===t?2:1)*parseFloat(i.style.border.split("px")[0]):(0===t&&i.style.borderLeft&&(e=parseFloat(i.style.borderLeft.split("px")[0])),i.style.borderRight&&(e+=parseFloat(i.style.borderRight.split("px")[0])))),i.style&&(i.style.border||i.style.borderRight)||!n.style||!n.style.borderLeft||(e+=parseFloat(n.style.borderLeft.split("px")[0])),(0<e&&e<1?1:e)||1));var i}function Ud(e,t,r,n,i,o,a){return Td(e,i,o,a)+Md(t,r,n)}function Hd(e,t,r,n){e.maxHgts[t]||(e.maxHgts[t]={}),e.maxHgts[t][r]=n}function Vd(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 ce(e){var t,r;document.activeElement.classList.contains("e-text-findNext-short")||(ee.Browser.isIE?(r=window.scrollX,t=window.scrollY,e.focus(),window.scrollTo(r,t)):(e.classList.contains("e-input")&&(r=e.value.length,e.setSelectionRange(r,r)),e.focus({preventScroll:!0})))}function jd(e,t){for(var r,n=e.getActiveSheet(),i=ee.isNullOrUndefined(t)?ne(te(n.selectedRange)):t,o=i[0];o<=i[2];o++)for(var a=i[1];a<=i[3];a++)if(Mn(se(o,a,n),de(n,a))){r=!0;break}return r}function zd(e){return e.includes(" ")}function _d(e,t,r){for(var n,i,o,a=ae(e,r),s=r===e.activeSheetIndex,l=a.conditionalFormats&&a.conditionalFormats.length&&[].slice.call(a.conditionalFormats),h=[],d=!1,p=t[0],c=t[2];p<=c;p++)if(!Fh(a,p))for(var u=t[1],f=t[3];u<=f;u++){var g,m={cellIdx:[p,u],isUnique:!1,uniqueRange:""},v=(e.notify(_t,m),g=!1,""!==m.uniqueRange&&(g="#SPILL!"===se((v=P(m.uniqueRange))[0],v[1],a).value),p===c&&u===f);m.isUnique&&!g||((m=se(p,u,a))&&0===m.value||m&&m.value&&(ee.isNullOrUndefined(m.value)||""!==m.value)?(d=!1,n={},m.formula&&(n.formula=""),!m.value&&0!==m.value||(n.value=""),m.hyperlink&&(n.hyperlink=""),g={sheet:a,cell:m,rowIdx:p,colIdx:u},(1<m.colSpan||1<m.rowSpan)&&Zn(g),i={cell:n,rowIdx:p,colIdx:u,valChange:!0,uiRefresh:s,td:m=e.getCell(g.rowIdx,g.colIdx),cellDelete:!0,isDelete:!v,deletedRange:t},Object.keys(n).length&&!_n(e,a,i)&&(l&&!(o=o||i.isFormulaDependent)&&Yn(l,h,p,u),m)&&(m.querySelector(".e-cf-databar")&&m.removeChild(m.querySelector(".e-cf-databar")),m.querySelector(".e-iconsetspan"))&&m.removeChild(m.querySelector(".e-iconsetspan"))):!d&&i&&(i.isDelete=!(d=v),Object.keys(n).length)&&_n(e,a,i))}(h.length||o)&&s&&e.notify(Br,{cfModel:!o&&h,refreshAll:o,isAction:!0,isEdit:!0})}function qd(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,o=t;;o++)if(i<=(r+=kh(n,o,!0)))return{index:o,height:r}}function Wd(e,t){for(var r=0,n=e.getActiveSheet(),i=e.getMainContent().parentElement.offsetWidth-e.sheetModule.getRowHeaderWidth(n)-e.sheetModule.getScrollSize(),o=t;;o++)if(i<=(r+=Bh(n,o,null,!0)))return o}function Gd(e){var t;return 0<window.devicePixelRatio%1?e+((t=e*window.devicePixelRatio%1)?(.5<t?1-t:-1*t)/window.devicePixelRatio:0):e}function Yd(e){for(var t,r,n,i=[],o=e.getActiveSheet().name,a=0,s=e.chartColl.length;a<s;a++)o===Ei((n=e.chartColl[a]).range)&&(t={clientY:n.top,isImage:!0},r={clientX:n.left,isImage:!0},e.notify(us,t),e.notify(fs,r),i.push({chart:n,chartRowIdx:t.clientY,chartColIdx:r.clientX}));return i}function Xd(e,t){for(var r,n=e.getActiveSheet(),i=ee.isNullOrUndefined(t)?ne(te(n.selectedRange)):t,o=i[0];o<=i[2];o++)for(var a=i[1];a<=i[3];a++)if(ti(se(o,a,n),de(n,a),Nh(n,o))){r=!0;break}return r}function Kd(e){e.forEach(function(e){e&&e.parentNode&&e.parentNode.removeChild(e)})}$d=function(e,t){return($d=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)};var $d,Zd,n=function(e,t){function r(){this.constructor=e}$d(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},wh=function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;0<=s;s--)(i=e[s])&&(a=(o<3?i(a):3<o?i(t,r,a):i(t,r))||a);return 3<o&&a&&Object.defineProperty(t,r,a),a},Jd=(Zd=ee.ChildProperty,n(Qd,Zd),wh([ee.Property(!1)],Qd.prototype,"isFinite",void 0),wh([ee.Property(!0)],Qd.prototype,"enableVirtualization",void 0),Qd);function Qd(){return null!==Zd&&Zd.apply(this,arguments)||this}ep=ee.ChildProperty,n(tp,ep),wh([ee.Property("Multiple")],tp.prototype,"mode",void 0);var ep,n=tp;function tp(){return null!==ep&&ep.apply(this,arguments)||this}np.prototype.refreshSelectALLContent=function(){var e,t,r=this.parent.getActiveSheet();r.frozenColumns||r.frozenRows?(r=this.getSelectAllTable().querySelector("thead"),t=this.rowRenderer.render(),r.appendChild(t),e=this.parent.createElement("th",{className:"e-select-all-cell"}),t.appendChild(e)):(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(T).getConstant("SelectAll"),type:"button"}}))},np.prototype.updateLeftColGroup=function(e,t){e&&(this.colGroupWidth=e);var r,n,i=(t=t||this.getRowHeaderPanel()).querySelector("table"),o=this.parent.getActiveSheet(),a=document.createDocumentFragment();e?i.querySelector("colgroup").firstElementChild.style.width=this.colGroupWidth+"px":(r=this.parent.createElement("colgroup"),(n=this.col.cloneNode()).style.width=this.colGroupWidth+"px",a.appendChild(n),r.appendChild(a),i.insertBefore(r,i.querySelector("tbody"))),(o.frozenRows||o.frozenColumns)&&(i=this.getSelectAllTable(),e?i.querySelector("colgroup").firstElementChild.style.width=this.colGroupWidth+"px":i.insertBefore(r.cloneNode(!0),i.querySelector("thead"))),this.setPanelWidth(o,t),this.setPanelHeight(o)},np.prototype.setPanelWidth=function(e,t,r){var n,i=this.getScrollSize(!0),o=this.getRowHeaderWidth(e),a=this.parent.enableRtl,s=a?"right":"left",l=this.getColHeaderPanel(),h=this.getContentPanel(),e=(r&&(h.style[""+(n=a?"left":"right")]=l.style[""+n]=""),e.frozenColumns&&((a=document.getElementById(this.parent.element.id+"_sheet").getElementsByClassName("e-frozen-column")[0]).style.height="calc(100% - "+i+"px)",r&&(a.style[""+n]=""),a.style[s]=o-Sd(1)+"Px",a.style.display=""),"calc(100% - "+o+"px)"),a=(this.setHeaderPanelWidth(this.getSelectAllContent(),o),l.style.width=e,l.style[s]=o+"px",this.setHeaderPanelWidth(t,o),h.style.width=e,h.style[s]=o+"px",this.contentPanel.nextElementSibling||null);a&&(i?a.style.height=i+1+"px":(a.style.height="1px",a.style.borderTopWidth="0px"),a=a.firstElementChild,r&&(a.style[""+n]=""),a.style[s]=o+"px",a.style.width=e,-1<ee.Browser.userAgent.indexOf("Mac OS"))&&"safari"===ee.Browser.info.name&&(a.style.height="7px",a.style.top="-7px")},np.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},np.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"},np.prototype.setPanelHeight=function(e){var t,r=this.getScrollSize(!0),n=this.contentPanel,i=this.headerPanel;e.frozenRows?(t=this.getColHeaderHeight(e),e.showHeaders||e.frozenColumns?i.style.height="":i.style.height=t+"px",n.style.height="calc(100% - "+(t+r)+"px)",(i=document.getElementById(this.parent.element.id+"_sheet").getElementsByClassName("e-frozen-row")[0]).style.width=ee.Browser.isDevice?"100%":"calc(100% - "+r+"px)",i.style.top=t-1-(e.showHeaders?1:0)+"px",i.style.display=""):n.style.height="calc(100% - "+((e.showHeaders?Sd(31):0)+r)+"px)"},np.prototype.renderPanel=function(){this.contentPanel=this.parent.createElement("div",{className:"e-main-panel",attrs:{tabindex:"0"}});var e=this.parent.getActiveSheet(),t=this.parent.element.id,r=document.createDocumentFragment(),n=this.parent.createElement("div",{className:"e-row-header",id:t+"_row_header"}),n=(r.appendChild(n),this.initHeaderPanel(),this.parent.allowScrolling&&this.parent.scrollModule.setPadding(),document.getElementById(this.parent.element.id+"_sheet")),t=(e.frozenColumns&&n.classList.add("e-frozen-columns"),e.frozenRows&&n.classList.add("e-frozen-rows"),this.updateHideHeaders(e,n),e.showGridLines||n.classList.add("e-hide-gridlines"),this.parent.createElement("div",{className:"e-sheet-content",id:t+"_main_content"}));r.appendChild(t),this.parent.allowScrolling||(t.style.overflow="hidden"),e.frozenRows&&n.appendChild(this.parent.createElement("div",{className:"e-frozen-row",styles:"display: none"})),e.frozenColumns&&n.appendChild(this.parent.createElement("div",{className:"e-frozen-column",styles:"display: none"})),-1<ee.Browser.userAgent.indexOf("Mac OS")&&"safari"===ee.Browser.info.name&&n.classList.add("e-mac-safari"),this.contentPanel.appendChild(r)},np.prototype.initHeaderPanel=function(){var e=this.parent.element.id,t=document.createDocumentFragment(),r=(this.headerPanel=this.parent.createElement("div",{className:"e-header-panel"}),this.parent.createElement("div",{className:"e-selectall-container",id:e+"_selectall"})),r=(t.appendChild(r),this.parent.createElement("div",{className:"e-column-header",id:e+"_col_header"}));t.appendChild(r),this.headerPanel.appendChild(t)},np.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)},np.prototype.updateTable=function(e,t,r){var n=this,i=document.createDocumentFragment(),t=this.parent.createElement("table",{className:"e-table e-"+t+"-table",attrs:{role:"grid"}});e.forEach(function(e){i.appendChild(n.parent.createElement(e))}),t.appendChild(i),r.appendChild(t)},np.prototype.renderTable=function(o){var n,i,a,s,l,h=this,d=this.parent.getActiveSheet(),p=document.createDocumentFragment(),c=(p.appendChild(this.headerPanel),p.appendChild(this.contentPanel),this.parent.allowScrolling&&((e=this.parent.createElement("div",{className:"e-scrollbar"})).appendChild(this.parent.createElement("div",{className:"e-scroller"})),p.appendChild(e)),this.createHeaderTable(),this.updateTable(["tbody"],"content",this.contentPanel.lastElementChild),this.parent.createElement("colgroup")),u=this.contentPanel.querySelector(".e-sheet-content tbody"),f=(this.refreshSelectALLContent(),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"),e=this.headerPanel.querySelector(".e-column-header thead"),C=this.headerPanel.querySelector(".e-column-header tbody"),b=this.rowRenderer.render(),x=(e.appendChild(b),this.getColHeaderTable().insertBefore(c,e),this.parent.frozenRowCount(d)),S=this.parent.frozenColCount(d),w=Y(d,S-1,!1,"columns"),e=(this.parent.notify(fo,{top:o.top,left:o.left}),d.colCount.toString()),t=d.colCount.toString(),I=o.top&&o.left?"RowColumn":o.top?"Row":o.left?"Column":"";this.parent.getColHeaderTable().setAttribute("aria-colcount",e),this.parent.getRowHeaderTable().setAttribute("aria-rowcount",t),ee.attributes(this.parent.getContentTable(),{"aria-rowcount":t,"aria-colcount":e}),o.cells.forEach(function(e,t){(n=te(t))[1]!==o.indexes[1]&&i||(n[1]===o.indexes[1]&&(a=h.rowRenderer.render(n[0],!0)),S&&x&&n[1]<S&&n[0]<x?((l=y.querySelector(".e-empty"))?y.insertBefore(a,l):y.appendChild(a),i=a):S&&n[1]<S?(v.appendChild(a),i=a):(i=h.rowRenderer.render(n[0]),x&&n[0]<x?(l=C.querySelector(".e-empty"))?C.insertBefore(i,l):C.appendChild(i):u.appendChild(i),n[1]===o.indexes[1]&&(x&&n[0]<x?y:v).appendChild(a)),n[1]===o.indexes[1]&&h.cellRenderer.renderRowHeader(n[0],a)),s=h.cellRenderer.render({colIdx:n[1],rowIdx:n[0],cell:e,address:t,lastCell:n[1]===o.indexes[3],isHeightCheckNeeded:!0,row:i,hRow:a,pRow:i.previousSibling,pHRow:a.previousSibling,isRefreshing:o.isRefreshing,first:I?I.includes("Row")?n[0]===o.indexes[0]?"Row":I.includes("Column")&&n[1]===o.indexes[1]?"Column":"":n[1]===o.indexes[1]?"Column":"":""});var t=h.parent.scrollSettings.enableVirtualization&&h.parent.viewport.topIndex!==Y(d,0,!0),r=h.parent.scrollSettings.enableVirtualization&&h.parent.viewport.leftIndex!==Y(d,0,!0,"columns");t&&h.checkRowMerge(n,o.indexes,s,e,d),r&&h.checkColMerge(n,o.indexes,s,e,d),S&&n[1]===w&&(i=null),n[0]===o.indexes[0]&&(S&&n[1]<S?(s=h.updateCol(d,n[1],f),(t=g.querySelector(".e-empty"))?g.insertBefore(s.cloneNode(!0),t):g.appendChild(s.cloneNode(!0)),h.cellRenderer.renderColHeader(n[1],m)):(h.updateCol(d,n[1],c),h.cellRenderer.renderColHeader(n[1],b)))}),this.parent.isReact&&this.parent.renderReactTemplates(),u.parentElement.insertBefore(c.cloneNode(!0),u),Xh(function(){if(h.parent){var e=h.parent.getMainContent(),t=document.getElementById(h.parent.element.id+"_sheet");if(t.childElementCount&&t.querySelector(".e-header-panel")!==h.headerPanel)for(var r=t.children,n=0;n<r.length;n++)r[n].classList.contains("e-frozen-row")||r[n].classList.contains("e-frozen-column")||r[n].classList.contains("e-ss-overlay")||t.removeChild(r[n]);if(t.appendChild(p),t.style.backgroundColor="",d.conditionalFormats&&d.conditionalFormats.length&&h.parent.notify(Br,{indexes:o.indexes}),h.checkRowHeightChanged(o,d),o.top&&(e.parentElement.scrollTop=o.top),o.left&&(e.scrollLeft=o.left,h.parent.getColumnHeaderContent().scrollLeft=o.left),h.parent.notify(to,o),h.checkTableWidth(d),h.parent.notify(io,{action:"renderEditor",initLoad:o.initLoad&&!h.parent.isOpen}),o.initLoad||h.parent.isOpen||h.parent.hideSpinner(),Id(e,{busy:!1}),h.parent.trigger(To,{}),h.parent.isEdit&&h.parent.notify(ls,null),o.openOptions&&o.openOptions.eventArgs&&o.openOptions.eventArgs.triggerEvent&&h.parent.trigger("openComplete",{response:o.openOptions}),o.initLoad){var i=!0;if(h.parent.scrollSettings.enableVirtualization)for(n=0;n<d.ranges.length;n++)if(d.ranges[n].info.count-1>h.parent.viewport.bottomIndex){i=!1;break}i?h.parent.isReact?setTimeout(function(){h.parent&&h.triggerCreatedEvent()}):h.triggerCreatedEvent():h.parent.isOpen||h.parent.hideSpinner()}}})},np.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(ja,null),this.parent)&&this.parent.notify(ba,null),this.parent&&this.parent.notify(za,null)},np.prototype.checkRowHeightChanged=function(e,t){var r={top:e.top,left:e.left,sheet:t};this.parent.notify(Xs,r),e.top!==r.top&&(this.parent.scrollModule&&this.parent.scrollModule.offset.top.idx&&r.top-e.top<kh(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<Bh(t,this.parent.scrollModule.offset.left.idx)&&(this.parent.scrollModule.offset.left.size=r.left),e.left=r.left)},np.prototype.checkTableWidth=function(e){var t,r;this.parent.scrollSettings.isFinite&&!this.parent.scrollSettings.enableVirtualization&&e.colCount-1===this.parent.viewport.rightIndex&&(t=Uh(e,this.parent.viewport.leftIndex+this.parent.frozenColCount(e),this.parent.viewport.rightIndex),e=this.getRowHeaderWidth(e),r=this.getScrollSize(),t<this.contentPanel.getBoundingClientRect().width-e-r?(this.getContentPanel().style.width=t+"px",this.getColHeaderPanel().style.width=t+"px"):this.getContentPanel().style.width.includes("calc")||(this.getContentPanel().style.width="calc(100% - "+e+"px)",this.getColHeaderPanel().style.width="calc(100% - "+e+"px)"))},np.prototype.clearCFResult=function(e){e.conditionalFormats&&e.conditionalFormats.length&&e.conditionalFormats.forEach(function(e){delete e.result})},np.prototype.refreshColumnContent=function(i){function e(){var e=a.getColHeaderTable();Kh(e),e.appendChild(r),Kh(e=a.getContentTable()),e.appendChild(t),a.parent.notify(mo,{refresh:"Column",prevRowColCnt:i.prevRowColCnt}),l.conditionalFormats&&l.conditionalFormats.length&&a.parent.notify(Br,{indexes:i.indexes,isRender:!0}),a.parent.isEdit&&a.parent.notify(hs,{}),a.parent.allowChart&&a.parent.notify(Es,null),a.parent.isOpen||a.parent.hideSpinner(),Id(a.parent.getMainContent(),{busy:!1})}var o,a=this,s=0,l=this.parent.getActiveSheet(),t=document.createDocumentFragment(),r=document.createDocumentFragment(),h=this.parent.element.querySelector(".e-sheet-content tbody"),d=this.parent.element.querySelector(".e-column-header tbody"),p=(p=this.parent.element.querySelector(".e-sheet-content colgroup")).cloneNode(),h=(t.appendChild(p),t.appendChild(h.cloneNode(!0))),c=p.cloneNode(),n=(r.appendChild(c),this.parent.element.querySelector(".e-column-header thead")),u=(n=r.appendChild(n.cloneNode(!0))).querySelector("tr"),f=(u.innerText="",this.parent.frozenRowCount(l)),g=this.parent.frozenColCount(l),m=(f&&(d=r.appendChild(d.cloneNode(!0))),Y(l,f-1,!1)),v=this.parent.scrollSettings.enableVirtualization&&this.parent.viewport.topIndex!==Y(l,0,!0);this.clearCFResult(l),i.cells.forEach(function(e,t){var r,n=te(t);if(n[0]===i.indexes[0]&&(r=a.updateCol(l,n[1],c),p.appendChild(r.cloneNode()),a.cellRenderer.renderColHeader(n[1],u)),n[1]-g===i.indexes[1]){if(!(o=(n[0]<f?d:h).children[s]))return;o.innerText="",s++}o&&(r=a.cellRenderer.render({colIdx:n[1],rowIdx:n[0],cell:e,address:t,row:o,pRow:o.previousSibling,first:i.skipUpdateOnFirst||n[1]!==i.indexes[1]?v&&n[0]===i.indexes[0]?"Row":"":"Column",isRefreshing:!0}),a.checkColMerge(n,i.indexes,r,e,l),f)&&n[0]===m&&(s=0)});i.insertDelete?e():Xh(function(){e()})},np.prototype.refreshRowContent=function(n){var i,o,a,s=this,l=this.colGroupWidth,h=this.parent.getActiveSheet(),e=document.createDocumentFragment(),t=document.createDocumentFragment(),d=this.parent.createElement("tbody"),p=d.cloneNode(),c=(t.appendChild(p),e.appendChild(d),this.parent.frozenColCount(h)),u=Y(h,c-1,!1,"columns"),f=this.parent.scrollSettings.enableVirtualization&&this.parent.viewport.leftIndex!==Y(h,0,!0,"columns"),r=(this.clearCFResult(h),n.cells.forEach(function(e,t){var r=te(t);r[1]!==n.indexes[1]&&i||(r[1]===n.indexes[1]&&(o=s.rowRenderer.render(r[0],!0)),c&&r[1]<c?(p.appendChild(o),i=o):(r[1]===n.indexes[1]&&p.appendChild(o),i=s.rowRenderer.render(r[0]),d.appendChild(i)),r[1]===n.indexes[1]&&(s.cellRenderer.renderRowHeader(r[0],o),l=$h(r[0]+1))),c&&(o=p.lastElementChild||o),a=s.cellRenderer.render({rowIdx:r[0],colIdx:r[1],cell:e,address:t,lastCell:r[1]===n.indexes[3],row:i,hRow:o,pRow:i.previousSibling,pHRow:o.previousSibling,isHeightCheckNeeded:!0,first:n.skipUpdateOnFirst||r[0]!==n.indexes[0]?f&&r[1]===n.indexes[1]?"Column":"":"Row",isRefreshing:!0}),s.checkRowMerge(r,n.indexes,a,e,h),c&&r[1]===u&&(i=null)}),this.colGroupWidth!==l&&this.updateLeftColGroup(l),this.contentPanel.querySelector(".e-row-header tbody")),r=(r&&(ee.detach(r),this.getRowHeaderTable().appendChild(t)),this.contentPanel.querySelector(".e-sheet-content tbody"));r&&(ee.detach(r),this.getContentTable().appendChild(e)),this.parent.notify(mo,{refresh:"Row",prevRowColCnt:n.prevRowColCnt}),h.conditionalFormats&&h.conditionalFormats.length&&this.parent.notify(Br,{indexes:n.indexes,isRender:!0}),this.parent.allowChart&&this.parent.notify(Es,{}),this.parent.isEdit&&this.parent.notify(hs,null),this.parent.isOpen||this.parent.hideSpinner(),Id(this.parent.getMainContent(),{busy:!1})},np.prototype.updateCol=function(e,t,r){var n=this.col.cloneNode();return n.style.width=ee.formatUnit(Bh(e,t,null,!0)),r?(e=r.querySelector(".e-empty"))?r.insertBefore(n,e):r.appendChild(n):n},np.prototype.updateColContent=function(w){var I=this;Xh(function(){var n,i,o,a,s,l,h=0,d=I.parent.getActiveSheet(),p=I.parent.element.querySelector(".e-column-header .e-header-row"),c=I.parent.element.querySelector(".e-sheet-content colgroup"),u=I.parent.element.querySelector(".e-column-header colgroup"),f=p.firstElementChild,g=c.firstElementChild,m=u.firstElementChild,v=I.parent.element.querySelector(".e-sheet-content tbody"),y=I.parent.element.querySelector(".e-column-header tbody"),C=I.parent.frozenRowCount(d),b=I.parent.frozenColCount(d),x=Y(d,C-1,!1),S=Y(d,w.indexes[0],!0);I.clearCFResult(d),w.cells.forEach(function(e,t){if(!s){var r=te(t);if("first"===w.direction&&r[1]===w.indexes[1]&&I.checkColMerge([r[0],I.parent.viewport.leftIndex+b],w.indexes,((r[0]<C?y:v).rows[h]||{cells:[]}).cells[w.indexes[3]-w.indexes[1]+1],se(r[0],I.parent.viewport.leftIndex+b,d)||{},d),r[0]===S&&("last"===w.direction?((a=I.col.cloneNode()).style.width=ee.formatUnit(Bh(d,r[1],null,!0)),c.insertBefore(a,g),u.insertBefore(a.cloneNode(),m),I.cellRenderer.renderColHeader(r[1],p,f)):(a=I.updateCol(d,r[1],c),u.appendChild(a.cloneNode()),I.cellRenderer.renderColHeader(r[1],p)),I.parent.scrollSettings.enableVirtualization)&&w.direction&&(ee.detach(c[w.direction+"ElementChild"]),ee.detach(u[w.direction+"ElementChild"]),ee.detach(p[w.direction+"ElementChild"])),r[1]===w.indexes[1]){if(r[0]<C)n=y.children[h];else if(!(n=v.children[h]))return void(s=!0);h++,i=n.firstElementChild}l={colIdx:r[1],rowIdx:r[0],cell:e,address:t,row:n,lastCell:r[1]===w.indexes[3],isHeightCheckNeeded:"first"===w.direction,first:"last"!==w.direction||w.skipUpdateOnFirst||r[1]!==w.indexes[1]?"":"Column",checkNextBorder:"last"===w.direction&&r[3]===w.indexes[3]?"Column":"",isRefreshing:"first"===w.direction},"last"===w.direction?(l.refChild=i,o=I.cellRenderer.render(l),I.checkColMerge(r,w.indexes,o,e,d,((r[0]<C?y:v).rows[h-1]||{cells:[]}).cells[1])):o=I.cellRenderer.render(l),I.parent.scrollSettings.enableVirtualization&&w.direction&&ee.detach(n[w.direction+"ElementChild"]),C&&r[0]===x&&(h=0)}}),I.parent.notify(mo,{refresh:"Column",prevRowColCnt:w.prevRowColCnt}),d.conditionalFormats&&d.conditionalFormats.length&&I.parent.notify(Br,{indexes:w.indexes,isRender:!0}),I.parent.allowChart&&I.parent.notify(Es,null),I.parent.isEdit&&I.parent.notify(hs,{}),I.parent.isOpen||I.parent.hideSpinner(),Id(I.parent.getMainContent(),{busy:!1})})},np.prototype.updateRowContent=function(n){var i,o,a,s,l,h,d,p,c,u,f,g,m,v,y,C=this,e=this.parent.getMainContent();""===n.direction&&!e.children.length||(l=0,h=this.colGroupWidth,d=this.parent.getActiveSheet(),p=e.querySelector("tbody"),c=this.parent.getRowHeaderContent().querySelector("tbody"),u=document.createDocumentFragment(),f=document.createDocumentFragment(),this.parent.showSpinner(),g=this.parent.frozenColCount(d),m=this.parent.frozenRowCount(d),v=Y(d,n.indexes[1],!0,"columns"),y=Y(d,g-1,!1,"columns"),this.clearCFResult(d),n.cells.forEach(function(e,t){var r=te(t);"first"===n.direction&&r[0]===n.indexes[0]&&(void 0===s&&(s=(r[1]<g?c:p).rows[n.indexes[2]-n.indexes[0]+1]||null),C.checkRowMerge([C.parent.viewport.topIndex+m,r[1]],n.indexes,(s||{cells:[]}).cells[r[1]<g?l+1:l],se(C.parent.viewport.topIndex+m,r[1],d)||{},d)),r[1]!==v&&i||(r[1]===v&&(o=C.rowRenderer.render(r[0],!0)),g&&r[1]<g?(u.appendChild(o),i=o):(i=C.rowRenderer.render(r[0]),f.appendChild(i),r[1]===v&&u.appendChild(o),C.parent.scrollSettings.enableVirtualization&&n.direction&&ee.detach(p[n.direction+"ElementChild"])),r[1]===v&&(C.cellRenderer.renderRowHeader(r[0],o),h=$h(r[0]+1),C.parent.scrollSettings.enableVirtualization)&&n.direction&&ee.detach(c[n.direction+"ElementChild"])),g&&(o=u.lastElementChild||o),a=C.cellRenderer.render({colIdx:r[1],rowIdx:r[2],cell:e,address:t,row:i,lastCell:r[1]===n.indexes[3],pHRow:o.previousSibling,checkNextBorder:"last"===n.direction&&r[2]===n.indexes[2]?"Row":"",pRow:i.previousSibling,isHeightCheckNeeded:"first"===n.direction||""===n.direction,hRow:o,first:"last"!==n.direction||n.skipUpdateOnFirst||r[0]!==n.indexes[0]?"":"Row",isRefreshing:"first"===n.direction}),"last"===n.direction&&p.rows.length&&C.checkRowMerge(r,n.indexes,a,e,d,(r[1]<g?c:p).rows[0].cells[r[1]<g?l+1:l]),l++,g&&r[1]===y&&(i=null,s=void 0,l=0)}),this.colGroupWidth!==h&&this.updateLeftColGroup(h),"last"===n.direction?(c.insertBefore(u,c.firstElementChild),p.insertBefore(f,p.firstElementChild)):(c.appendChild(u),p.appendChild(f)),this.parent.scrollSettings.enableVirtualization&&this.parent.notify(mo,{refresh:"Row",prevRowColCnt:n.prevRowColCnt}),d.conditionalFormats&&d.conditionalFormats.length&&this.parent.notify(Br,{indexes:n.indexes,isRender:!0}),this.parent.isEdit&&this.parent.notify(hs,null),this.parent.allowChart&&this.parent.notify(Es,{}),this.parent.isOpen||this.parent.hideSpinner(),Id(this.parent.getMainContent(),{busy:!1}))},np.prototype.checkRowMerge=function(e,t,r,n,i,o){if(this.parent.scrollSettings.enableVirtualization&&r&&(!ee.isNullOrUndefined(n.rowSpan)||!ee.isNullOrUndefined(n.colSpan))){var a=this.parent.frozenRowCount(i),a=this.parent.viewport.topIndex+a;if(e[0]===a){if(n.rowSpan<0){var r={td:r,rowIdx:e[0],colIdx:e[1],isRow:!0,isFreezePane:!0};if(this.parent.notify($a,r),r.insideFreezePane)return;a>=t[2]&&this.refreshPrevMerge(t[2]+1,e[1])}o&&this.refreshFirstCell(e[0]+(t[2]-t[0])+1,e[1],i,o)}else 1<n.rowSpan&&(r=t[2]+1,e[0]+n.rowSpan-1>=r)&&e[0]<r&&this.refreshPrevMerge(r,e[1],a)}},np.prototype.refreshPrevMerge=function(e,t,r){r=this.parent.getCell(e,t,this.parent.getRow(r||0,null,t));r&&this.cellRenderer.refresh(e,t,null,r)},np.prototype.refreshFirstCell=function(e,t,r,n){r=se(e,t,r,!1,!0);(r.rowSpan<0||r.colSpan<0)&&this.cellRenderer.refresh(e,t,null,n)},np.prototype.checkColMerge=function(e,t,r,n,i,o){if(this.parent.scrollSettings.enableVirtualization&&r&&(!ee.isNullOrUndefined(n.rowSpan)||!ee.isNullOrUndefined(n.colSpan))){var a=this.parent.frozenColCount(i),a=this.parent.viewport.leftIndex+a;if(e[1]===a){if(n.colSpan<0){var s,r={td:r,colIdx:e[1],rowIdx:e[0],isFreezePane:!0};if(this.parent.notify($a,r),r.insideFreezePane)return;a>=t[3]&&(s=this.parent.getCell(e[0],e[3]+1,this.parent.getRow(e[0],null,e[3]+1)))&&this.cellRenderer.refresh(e[0],t[3]+1,null,s)}o&&this.refreshFirstCell(e[0],e[1]+(t[3]-t[1])+1,i,o)}else 1<n.colSpan&&e[1]+n.colSpan-1>=t[3]+1&&e[1]<t[3]+1&&(s=this.parent.getCell(e[0],e[3]+1,this.parent.getRow(e[0],null,e[3]+1)))&&this.cellRenderer.refresh(e[0],t[3]+1,null,s)}},np.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")},np.prototype.showHideHeaders=function(){var t=this,r=this.parent.getActiveSheet();Xh(function(){var e;r.showHeaders?(e=t.getContentPanel(),t.setPanelWidth(r,t.getRowHeaderPanel()),t.setPanelHeight(r),document.getElementById(t.parent.element.id+"_sheet").classList.remove("e-hide-headers"),t.getColHeaderPanel().scrollLeft=e.scrollLeft,t.parent.selectRange(r.selectedRange)):(t.updateHideHeaders(r,document.getElementById(t.parent.element.id+"_sheet")),t.setPanelHeight(r),t.parent.frozenColCount(r)||t.parent.frozenRowCount(r)?(t.setPanelWidth(r,t.getRowHeaderPanel()),t.parent.selectRange(r.selectedRange)):(t.getContentPanel().style.width="",t.getContentPanel().style[t.parent.enableRtl?"right":"left"]=""),t.getScrollElement().style.left=t.getRowHeaderWidth(r)+"px")})},np.prototype.updateHideHeaders=function(e,t){e.showHeaders||t.classList.add("e-hide-headers")},np.prototype.rowHeightChanged=function(e){var t;(e.threshold||e.isHideShow)&&(t=this.parent.getActiveSheet(),e.rowIdx<this.parent.frozenRowCount(t))&&this.setPanelHeight(t)},np.prototype.colWidthChanged=function(e){var t;(e.threshold||e.isHideShow)&&(t=this.parent.getActiveSheet(),e.colIdx<this.parent.frozenColCount(t)&&this.setPanelWidth(t,this.getRowHeaderPanel()),this.checkTableWidth(t))},np.prototype.getRowHeaderWidth=function(e,t,r){var n=0,r=r?this.parent.viewport.scaleX:1;return!t&&e.frozenColumns&&(n=Uh(e,t=W(e.topLeftCell)[1],t+e.frozenColumns-1,!0)/r),n+=e.showHeaders?Sd(this.colGroupWidth)/r:0},np.prototype.getColHeaderHeight=function(e,t){var r=W(e.topLeftCell)[0];return(e.showHeaders&&!t?Sd(31):0)+Ah(e,r,r+e.frozenRows-1,!0)},np.prototype.getSelectAllContent=function(){return this.headerPanel.getElementsByClassName("e-selectall-container")[0]},np.prototype.getScrollElement=function(){var e;return(e=this.contentPanel?this.contentPanel.parentElement||this.contentPanel.nextElementSibling:e)&&e.querySelector(".e-scroller")},np.prototype.getSelectAllTable=function(){return this.headerPanel.getElementsByClassName("e-selectall-table")[0]},np.prototype.getColHeaderTable=function(){return this.headerPanel.getElementsByClassName("e-colhdr-table")[0]},np.prototype.getRowHeaderTable=function(){return this.contentPanel.getElementsByClassName("e-rowhdr-table")[0]},np.prototype.getContentTable=function(){return this.contentPanel.getElementsByClassName("e-content-table")[0]},np.prototype.getRowHeaderPanel=function(){return this.contentPanel.getElementsByClassName("e-row-header")[0]},np.prototype.getColHeaderPanel=function(){return this.headerPanel.getElementsByClassName("e-column-header")[0]},np.prototype.getContentPanel=function(){return this.contentPanel.getElementsByClassName("e-sheet-content")[0]},np.prototype.addEventListener=function(){this.parent.on(ja,this.triggerCreatedEvent,this),this.parent.on(Go,this.rowHeightChanged,this),this.parent.on(Yo,this.colWidthChanged,this),this.parent.on(no,this.removeEventListener,this)},np.prototype.destroy=function(){this.headerPanel&&(Kh(this.headerPanel),this.headerPanel.remove()),this.headerPanel=null,this.contentPanel&&(Kh(this.contentPanel),this.contentPanel.remove()),this.contentPanel=null,this.col&&(Kh(this.col),this.col.remove()),this.col=null,this.rowRenderer=null,this.cellRenderer=null,this.colGroupWidth=null,this.parent=null},np.prototype.removeEventListener=function(){this.parent.off(ja,this.triggerCreatedEvent),this.parent.off(Go,this.rowHeightChanged),this.parent.off(Yo,this.colWidthChanged),this.parent.off(no,this.removeEventListener)};var rp=np;function np(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()}op.prototype.render=function(e,t,r){var n,i,o,a,s=this.element.cloneNode(),l=this.parent.getActiveSheet();return void 0===e?s.classList.add("e-header-row"):(s.classList.add("e-row"),this.bottomBorderWidth||(a=1,0<window.devicePixelRatio%1&&(a=1+((n=+window.devicePixelRatio%1)?(.5<n?1-n:-1*n)/window.devicePixelRatio:0)),this.bottomBorderWidth=a),o={height:(n=kh(l,e,!0))+"px",lineHeight:(i=kh(l,e))<20?n>this.bottomBorderWidth?n-this.bottomBorderWidth+"px":"0px":""},Object.assign(s.style,o),ee.attributes(s,{"aria-rowindex":(e+1).toString()}),t&&!r&&(i<20&&(a=this.bottomBorderWidth-1+4,s.style.lineHeight=a<=n?n-a+"px":n>this.bottomBorderWidth?n-this.bottomBorderWidth+"px":"0px",s.classList.contains("e-reach-fntsize")||s.classList.add("e-reach-fntsize")),he(l,e+1)&&!he(l,e-1)&&s.classList.add("e-hide-start"),0!==e)&&he(l,e-1)&&!he(l,e+1)&&s.classList.add("e-hide-end")),s},op.prototype.refresh=function(e,t,r,n,i){var o,a,s,l,h,d=this,p=this.parent.getActiveSheet();return n?(o=this.render(e,n,i),this.cellRenderer.renderRowHeader(e,o)):(l=function(){for(;a<=s;)pe(p,a)||d.cellRenderer.render({colIdx:a,rowIdx:e,cell:se(e,a,p),address:G(e,a),lastCell:a===s,row:o,hRow:r,isHeightCheckNeeded:!0,pRow:t,first:e===d.parent.viewport.topIndex&&Y(p,e,!0)!==Y(p,0,!0)?"Row":"",skipFormatCheck:Jn(d.parent),checkCF:!0}),a++},(h=this.parent.frozenColCount(p))&&(o=r,a=W(p.topLeftCell)[0],s=h-1,l()),o=this.render(e,n,i),a=this.parent.viewport.leftIndex+h,s=this.parent.viewport.rightIndex,l()),o},op.prototype.initProps=function(){this.bottomBorderWidth=null},op.prototype.destroy=function(){this.parent.off(Ko,this.initProps),this.element&&this.element.remove(),this.bottomBorderWidth&&(this.bottomBorderWidth=null),this.parent=null,this.element=null};var ip=op;function op(e){this.parent=e,this.element=this.parent.createElement("tr"),this.cellRenderer=e.serviceLocator.getService("cell"),this.parent.on(Ko,this.initProps,this)}sp.prototype.renderColHeader=function(e,t,r){var n=this.th.cloneNode(),i=ue(e+1),o=(n.innerText=i,this.parent.getActiveSheet());pe(o,e+1)&&n.classList.add("e-hide-start"),0!==e&&pe(o,e-1)&&n.classList.add("e-hide-end"),r?t.insertBefore(n,r):t.appendChild(n),this.parent.trigger("beforeCellRender",{cell:null,element:n,address:i,colIndex:e}),this.parent.notify(Sa,{td:n,rowIndex:0,colIndex:e}),ee.attributes(n,{"aria-colindex":(e+1).toString(),tabindex:"-1"})},sp.prototype.renderRowHeader=function(e,t,r){var n=this.element.cloneNode();ee.addClass([n],"e-header-cell"),ee.attributes(n,{role:"rowheader",tabindex:"-1"}),n.innerText=(e+1).toString(),r?t.insertBefore(n,r):t.appendChild(n),this.parent.trigger("beforeCellRender",{cell:null,element:n,address:""+(e+1),rowIndex:e})},sp.prototype.render=function(e){var t=this.parent.getActiveSheet();if(e.td=this.element.cloneNode(),e.td.className="e-cell",ee.attributes(e.td,{"aria-colindex":(e.colIdx+1).toString(),tabindex:"-1"}),this.checkMerged(e))return this.createImageAndChart(e),e.refChild?e.row.insertBefore(e.td,e.refChild):e.row.appendChild(e.td),e.td;e.isRefresh=!1,e.skipFormatCheck=Jn(this.parent);var r=this.update(e),n=(e.checkCF&&e.cell&&t.conditionalFormats&&t.conditionalFormats.length&&this.parent.notify(Br,{indexes:[e.rowIdx,e.colIdx],cell:e.cell,ele:e.td,isRender:!0}),e.td.classList.contains("e-cell-template")||this.parent.notify(Sa,{td:e.td,rowIndex:e.rowIdx,colIndex:e.colIdx}),e.refChild?e.row.insertBefore(e.td,e.refChild):e.row.appendChild(e.td),{cell:e.cell,element:e.td,address:e.address,rowIndex:e.rowIdx,colIndex:e.colIdx,needHeightCheck:!1,row:e.row});return this.parent.trigger("beforeCellRender",n),t.rows[e.rowIdx]&&t.rows[e.rowIdx].customHeight||((n.needHeightCheck||r&&n.element&&n.element.children.length)&&((r=n.element.cloneNode(!0)).style.width=Bh(t,e.colIdx,!0)+"px",this.tableRow.appendChild(r)),e.lastCell&&this.tableRow.childElementCount&&((r=this.getRowHeightOnInit())>kh(t,e.rowIdx)&&Ad(this.parent,t,r,e.rowIdx,e.row,e.hRow),this.tableRow.innerText="")),this.setWrapByValue(t,e),n.element},sp.prototype.setWrapByValue=function(e,t){t.cell&&ee.isNullOrUndefined(t.cell.wrap)&&t.cell.value&&t.cell.value.toString().includes("\n")&&(Vi(t.rowIdx,t.colIdx,e,{wrap:!0},!0),this.parent.notify(ir,{range:[t.rowIdx,t.colIdx,t.rowIdx,t.colIdx],wrap:!0,initial:!0,sheet:e,td:t.td,row:t.row,hRow:t.hRow}))},sp.prototype.update=function(e){var t,r=this.parent.getActiveSheet();if((!e.isRefresh||e.cell&&e.cell.template)&&(i=this.processTemplates(e.cell,e.rowIdx,e.colIdx))&&("string"==typeof i?e.td.innerHTML=i:(Kh(e.td),ee.append(i,e.td)),e.td.classList.add("e-cell-template"),t=!0),e.isRefresh){if(e.td.rowSpan&&(this.mergeFreezeRow(r,e.rowIdx,e.colIdx,e.td.rowSpan,e.row,!0),e.td.removeAttribute("rowSpan")),e.td.colSpan&&(this.mergeFreezeCol(r,e.rowIdx,e.colIdx,e.td.colSpan,!0),e.td.removeAttribute("colSpan")),this.checkMerged(e))return!1;e.cell&&!e.cell.hyperlink&&(i=e.td.querySelector(".e-hyperlink"))&&ee.detach(i),e.cell&&0<e.td.children.length&&-1<e.td.children[e.td.childElementCount-1].className.indexOf("e-addNoteIndicator")&&(i=e.td.querySelector(".e-addNoteIndicator"))&&ee.detach(i),e.cell&&this.parent.allowWrap||!e.td.classList.contains("e-wraptext")||e.td.classList.remove("e-wraptext")}e.cell&&e.cell.formula&&!e.isRandomFormula&&"Automatic"===this.parent.calculationMode&&(this.calculateFormula(e),e.fillType)&&"FillWithoutFormatting"===e.fillType&&delete e.cell.format;var n,i={value:e.cell&&e.cell.value,type:e.cell&&Ml(e.cell.format),format:e.cell&&e.cell.format,formattedText:e.cell&&e.cell.value,isRightAlign:!1,cell:e.cell,rowIndex:e.rowIdx,colIndex:e.colIdx,td:e.td,skipFormatCheck:e.skipFormatCheck,refresh:!0},o=("Manual"===this.parent.calculationMode&&e.cell&&!e.cell.value&&""!==e.cell.value&&e.cell.formula&&(i.value=0,e.cell.value="0"),e.cell&&this.parent.notify(St,i),this.parent.refreshNode(e.td,i),{}),i=(e.cell&&(e.cell.style&&(o=e.cell.style.properties?ji(e.cell.style,!0):e.cell.style),void 0!==i.color&&(o.color=i.color),this.createImageAndChart(e),e.cell.hyperlink&&("FillFormattingOnly"===e.fillType?(e.td.style.textDecoration="underline",e.td.style.color="#00e"):this.parent.notify(ua,{cell:e.cell,style:o,td:e.td,rowIdx:e.rowIdx,colIdx:e.colIdx,fillType:e.fillType})),1<e.cell.rowSpan&&1<(i=e.rowSpan||e.cell.rowSpan-this.parent.hiddenCount(e.rowIdx,e.rowIdx+(e.cell.rowSpan-1)))&&(e.td.rowSpan=i,this.mergeFreezeRow(r,e.rowIdx,e.colIdx,i,e.row)),1<e.cell.colSpan&&1<(i=e.colSpan||e.cell.colSpan-this.parent.hiddenCount(e.colIdx,e.colIdx+(e.cell.colSpan-1),"columns"))&&(e.td.colSpan=i,this.mergeFreezeCol(r,e.rowIdx,e.colIdx,i)),ee.isNullOrUndefined(e.cell.notes)?!ee.isNullOrUndefined(e.td)&&0<e.td.children.length&&-1<e.td.children[e.td.childElementCount-1].className.indexOf("e-addNoteIndicator")&&this.parent.notify(sa,{rowIndex:e.rowIdx,columnIndex:e.colIdx}):this.parent.notify(ha,{targetElement:e.td,rowIndex:e.rowIdx,columnIndex:e.colIdx}),e.cell.isNoteEditable)&&this.parent.notify(la,{rowIndex:e.rowIdx,columnIndex:e.colIdx,isNoteEditable:!0,isScrollWithNote:!0,cellElement:e.td}),e.isRefresh&&ee.isNullOrUndefined(e.cell)&&!ee.isNullOrUndefined(e.td)&&0<e.td.children.length&&-1<e.td.children[e.td.childElementCount-1].className.indexOf("e-addNoteIndicator")&&this.parent.notify(sa,{rowIndex:e.rowIdx,columnIndex:e.colIdx}),e.isRefresh&&this.removeStyle(e.td,e.rowIdx,e.colIdx),e.lastCell&&this.parent.chartColl&&this.parent.chartColl.length&&this.parent.notify(Wr,{cell:e.cell,rIdx:e.rowIdx,cIdx:e.colIdx,sheetIdx:this.parent.activeSheetIndex}),this.applyStyle(e,o),"Row"!==e.checkNextBorder||""===(i=this.parent.getCellStyleValue(["borderTop"],[Number(this.parent.getContentTable().rows[0].getAttribute("aria-rowindex"))-1,e.colIdx]).borderTop)||e.cell&&e.cell.style&&e.cell.style.bottomPriority||(e.style={borderBottom:i},this.parent.notify(Ft,e)),"Column"!==e.checkNextBorder||""===(o=this.parent.getCellStyleValue(["borderLeft"],[e.rowIdx,e.colIdx+1]).borderLeft)||e.cell&&e.cell.style&&(e.cell.style.borderRight||e.cell.style.border)||(e.style={borderRight:o},this.parent.notify(Ft,e)),e.cell&&!ee.isNullOrUndefined(e.cell.wrap)&&this.parent.notify(ir,{range:[e.rowIdx,e.colIdx,e.rowIdx,e.colIdx],wrap:e.cell.wrap,sheet:r,initial:!0,td:e.td,row:e.row,hRow:e.hRow,isCustomHgt:!e.isRefresh&&kh(r,e.rowIdx)>(r&&r.standardHeight?r.standardHeight:20)}),e.cell&&e.cell.validation||r.columns&&r.columns[e.colIdx]&&r.columns[e.colIdx].validation);return!i||i.address&&!Dn(i.address,e.rowIdx,e.colIdx)||(i.isHighlighted&&(o=this.parent.activeSheetIndex,i)&&this.parent.allowDataValidation&&(n={value:e.cell&&(e.cell.value||0===e.cell.value)?e.cell.value:"",range:[e.rowIdx,e.colIdx],sheetIdx:o,td:e.td,isValid:!0},this.parent.notify(dr,n),n.isValid||he(r,e.rowIdx)||o!==this.parent.activeSheetIndex||this.parent.notify($r,{isRemoveHighlightedData:!1,rowIdx:e.rowIdx,colIdx:e.colIdx,td:e.td})),"List"!==i.type)||e.isRefresh||e.address!==r.activeCell||(e.validation=i,this.parent.notify(En,e)),t},sp.prototype.applyStyle=function(e,t){(Object.keys(t).length||Object.keys(this.parent.commonCellStyle).length||e.lastCell)&&(e.style=ee.extend({},this.parent.commonCellStyle,t),this.parent.notify(Ft,e))},sp.prototype.createImageAndChart=function(e){if(e.cell.chart&&0<e.cell.chart.length&&this.parent.notify(zr,{chart:e.cell.chart,isInitCell:!0,range:G(e.rowIdx,e.colIdx),isUndoRedo:!1}),e.cell.image&&0<e.cell.image.length)for(var t=0;t<e.cell.image.length;t++)e.cell.image[t]&&this.parent.notify(gs,{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:re([e.rowIdx,e.colIdx,e.rowIdx,e.colIdx]),isPublic:!1})},sp.prototype.calculateFormula=function(e){if(void 0!==e.cell.value&&null!==e.cell.value){var t={action:"checkFormulaAdded",added:!0,address:e.address,sheetId:(void 0===e.sheetIndex?this.parent.getActiveSheet():ae(this.parent,e.sheetIndex)).id.toString()};if(this.parent.notify(ie,t),t.added)return}else e.formulaRefresh&&(e.cell.value="");var t=Q(e.cell.formula),r={action:"refreshCalculate",value:e.cell.formula,rowIndex:e.rowIdx,colIndex:e.colIdx,isFormula:t,sheetIndex:e.sheetIndex,isRefreshing:e.isRefreshing,isDependentRefresh:e.isDependentRefresh,isRandomFormula:e.isRandomFormula,fillType:e.fillType};("Automatic"===this.parent.calculationMode||e.isSortAction||"calculate"===e.action||e.isDependentRefresh)&&this.parent.notify(ie,r),(void 0===e.cell.value&&"Manual"===this.parent.calculationMode&&!this.parent.getActiveSheet().isSheetCalculated||this.parent.isEdit&&"#CIRCULARREF!"===e.cell.value)&&(e.cell.value="0"),e.cell.value=se(e.rowIdx,e.colIdx,ee.isNullOrUndefined(e.sheetIndex)?this.parent.getActiveSheet():ae(this.parent,e.sheetIndex)).value,t&&(-1<e.cell.formula.indexOf("^+")||-1<e.cell.formula.indexOf("&+"))&&(e.cell.formula=r.value)},sp.prototype.checkMerged=function(e){var t,r,n,i;return!(!e.cell||!(e.cell.colSpan<0||e.cell.rowSpan<0))&&((!(n=this.parent.getActiveSheet()).frozenRows&&!n.frozenColumns||(t={range:[e.rowIdx,e.colIdx,e.rowIdx,e.colIdx]},this.parent.notify(Dr,t),i=this.parent.frozenRowCount(n),r=this.parent.frozenColCount(n),n.frozenRows&&n.frozenColumns?t.range[0]<i&&t.range[1]<r?e.rowIdx<i&&e.colIdx<r:t.range[0]<i?e.rowIdx<i:!(t.range[1]<r)||e.colIdx<r:i?t.range[0]>=i||e.rowIdx<i:t.range[1]>=r||e.colIdx<r))&&(e.td.style.display="none"),e.isMerged=!0,n=e.cell.rowSpan,((i=e.cell.colSpan)<0||n<0)&&(this.parent.notify(Ka,e),i<0&&e.cell.style&&e.cell.style.borderTop&&this.applyStyle(e,{borderTop:e.cell.style.borderTop}),n<0)&&e.cell.style&&e.cell.style.borderLeft&&this.applyStyle(e,{borderLeft:e.cell.style.borderLeft}),e.isMerged)},sp.prototype.mergeFreezeRow=function(e,t,r,n,i,o){var a=this.parent.frozenRowCount(e);if(a&&t<a&&a<=t+(n-1)){var s,l=void 0,h=0,d=this.parent.frozenColCount(e),p=i||this.parent.getRow(t,null,r),c=[].slice.call(p.parentElement.querySelectorAll(".e-empty"));if(o){i=t+n-a;if(!(i<c.length)){var u=0;if(i===c.length){var f,g=void 0,m=void 0;for(m=d&&r<d?(g=W(e.topLeftCell)[1],d):(g=this.parent.viewport.leftIndex+d,this.parent.viewport.rightIndex);g<m;g++)g!==r&&(f=se(t,g,e,!1,!0)).rowSpan&&t+f.rowSpan-a>u&&(u=t+f.rowSpan-a);if(u===i)return}else u=i;for(var v=t+(n-1),g=u,m=c.length;g<m;g++)h+=kh(e,v),v--,ee.detach(c.pop());this.updateSpanTop(r,d,h,!0),c.length||this.updateColZIndex(r,d,!0)}}else{this.updateColZIndex(r,d);for(g=a,m=t+(n-1);g<=m;g++)h+=-(s=kh(e,Y(e,g,!0),!0)),a+c.length>g||((l=p.cloneNode()).classList.add("e-empty"),l.style.visibility="hidden",l.style.height=s+"px",p.parentElement.appendChild(l));this.updateSpanTop(r,d,h)}}},sp.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}t&&e<t&&(n||!parseInt(i.style.top,10)||r<parseInt(i.style.top,10))&&(i.style.top=r+"px",e=i.nextElementSibling)&&(e.style.top=r+"px")},sp.prototype.mergeFreezeCol=function(e,t,r,n,i){var o=this.parent.frozenColCount(e);if(o&&r<o&&o<=r+(n-1)){var a,s=void 0,l=this.parent.frozenRowCount(e),h=(t<l?this.parent.getSelectAllContent():this.parent.getRowHeaderContent()).querySelector("colgroup"),d=[].slice.call(h.querySelectorAll(".e-empty"));if(i){i=r+n-o;if(!(i<d.length)){var p=0;if(i===d.length){var c,u=void 0,f=void 0;for(f=l&&t<o?(u=l,W(e.topLeftCell)[0]):(u=this.parent.viewport.bottomIndex,this.parent.viewport.topIndex+l);f<u;f++)f!==t&&(c=se(f,r,e,!1,!0)).colSpan&&r+c.colSpan-o>p&&(p=r+c.colSpan-o);if(p===i)return}else p=i;for(f=p,u=d.length;f<u;f++)ee.detach(d.pop());this.parent.serviceLocator.getService("sheet").setPanelWidth(e,this.parent.getRowHeaderContent()),d.length||this.updateRowZIndex(t,l,!0)}}else{this.updateRowZIndex(t,l);for(f=o,u=r+(n-1);f<=u;f++)o+d.length>f||((s=h.childNodes[0].cloneNode()).classList.add("e-empty"),s.style.visibility="hidden",a=Bh(e,Y(e,f,!0,"columns"),null,!0),s.style.width=a+"px",h.appendChild(s),f===u&&this.parent.serviceLocator.getService("sheet").setPanelWidth(e,this.parent.getRowHeaderContent()))}}},sp.prototype.updateColZIndex=function(e,t,r){e<t?this.updateSelectAllZIndex(r):(this.parent.getColumnHeaderContent().style.zIndex=r?"":"2",this.updatedHeaderZIndex(r))},sp.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"},sp.prototype.updatedHeaderZIndex=function(e){var t;e||"2"!==this.parent.getSelectAllContent().style.zIndex||(this.parent.getSelectAllContent().style.zIndex="3",e=this.parent.element.querySelector(".e-frozen-row"),(t=this.parent.element.querySelector(".e-frozen-column"))&&(t.style.zIndex="4"),e&&(e.style.zIndex="4"))},sp.prototype.updateRowZIndex=function(e,t,r){e<t?this.updateSelectAllZIndex(r):(this.parent.getRowHeaderContent().style.zIndex=r?"":"2",this.updatedHeaderZIndex(r))},sp.prototype.processTemplates=function(e,t,r){for(var n,i=this.parent.getActiveSheet(),o=i.ranges,a=0,s=o.length;a<s;a++)if(o[a].template&&(n=te(o[a].address.length?o[a].address:o[a].startCell))[0]<=t&&n[1]<=r&&n[2]>=t&&n[3]>=r){if(e)return this.compileCellTemplate(o[a].template,Object.assign({rowIndex:t,colIndex:r},e));if(!se(t,r,i,!0))return this.compileCellTemplate(o[a].template,Object.assign({rowIndex:t,colIndex:r},se(t,r,i,null,!0)))}return""},sp.prototype.compileCellTemplate=function(e,t){var r;return"string"==typeof e?(r=void 0,r=0===e.trim().indexOf("#")?document.querySelector(e).innerHTML.trim():e,r=ee.compile(r),!this.parent.isVue||this.isSelector(e)?r(t,this.parent,"ranges","",!0)[0].outerHTML:r(t,this.parent,"ranges","")):(e=(r=ee.compile(e))(t,this.parent,"ranges",""))[0]?e:[e]},sp.prototype.isSelector=function(e){try{return!!document.querySelector(e)}catch(e){return!1}},sp.prototype.getRowHeightOnInit=function(){var e=this.parent.createElement("table",{className:"e-table e-test-table"}),t=(e.appendChild(this.parent.createElement("tbody")).appendChild(this.tableRow),this.parent.element.appendChild(e),this.tableRow.getBoundingClientRect().height);return this.parent.element.removeChild(e),t<20?20:t},sp.prototype.removeStyle=function(t,e,r){t.style.length&&(i=(n=this.parent.getCellStyleValue(["borderLeft","border"],[e,r+1])).borderLeft||n.border,o=(n=this.parent.getCellStyleValue(["borderTop","border"],[e+1,r])).borderTop||n.border,i||o?[].slice.call(t.style).forEach(function(e){i&&o?e.includes("border-right")||e.includes("border-bottom")||t.style.removeProperty(e):(!i||-1<e.indexOf("border-right")||o&&"none"!==o)&&(!o||-1<e.indexOf("border-bottom")||i&&"none"!==i)||t.style.removeProperty(e)}):t.removeAttribute("style"));var n,i,o,a=this.parent.getCell(e-1,r),s=(a&&a.style.borderBottom&&(s=Number(a.parentElement.getAttribute("aria-rowindex"))-1,(n=this.parent.getCellStyleValue(["borderBottom","border"],[s,r])).borderBottom||n.border||(a.style.borderBottom="")),t.previousElementSibling);s&&s.style.borderRight&&(r=Number(s.getAttribute("aria-colindex"))-1,(n=this.parent.getCellStyleValue(["borderRight","border"],[e,r])).borderRight||n.border||(s.style.borderRight=""))},sp.prototype.refreshRange=function(e,t,r,n,i,o,a,s,l,h){void 0===l&&(l=!0);var d,p,c=this.parent.getActiveSheet(),u=e.slice();if(rd(this.parent,u,!0))for(var f=u[0];f<=u[2];f++)if(!he(c,f))for(var g=u[1];g<=u[3];g++)pe(c,g)||((p=this.parent.getCell(f,g))&&(d={rowIdx:f,colIdx:g,td:p,cell:se(f,g,c),isRefreshing:t,lastCell:g===u[3],isRefresh:!0,isHeightCheckNeeded:l,manualUpdate:!0,first:"",onActionUpdate:n,skipFormatCheck:o,isFromAutoFillOption:s},a&&(d.address=G(f,g)),this.update(d),i&&c.conditionalFormats&&c.conditionalFormats.length&&this.parent.notify(Br,{indexes:[f,g],isAction:!0}),this.parent.notify(Sa,{td:p,rowIndex:f,colIndex:g}),r)&&this.setWrapByValue(c,d),"Manual"===this.parent.calculationMode&&h&&(p?d.isSortAction=h:d={rowIdx:f,colIdx:g,td:p,cell:se(f,g,c),isRefreshing:t,lastCell:g===u[3],isRefresh:!0,isHeightCheckNeeded:l,manualUpdate:!0,first:"",onActionUpdate:n,skipFormatCheck:o,isFromAutoFillOption:s,isSortAction:h},d.cell)&&d.cell.formula&&c.isSheetCalculated&&this.calculateFormula(d))},sp.prototype.refresh=function(e,t,r,n,i,o,a,s,l){var h=this.parent.getActiveSheet();(n||!he(h,e)&&!pe(h,t))&&(n||!this.parent.scrollSettings.enableVirtualization||this.parent.insideViewport(e,t))&&(n=n||this.parent.getCell(e,t))&&(r={rowIdx:e,colIdx:t,td:n,cell:se(e,t,h),isRefresh:!0,lastCell:r,isHeightCheckNeeded:!0,manualUpdate:!0,first:"",skipFormatCheck:a,isRandomFormula:s,fillType:l},this.update(r),i&&h.conditionalFormats&&h.conditionalFormats.length&&this.parent.notify(Br,{indexes:[e,t],isAction:!0}),this.parent.notify(Sa,{td:n,rowIndex:e,colIndex:t}),o)&&this.setWrapByValue(h,r)},sp.prototype.updateView=function(e){var t,r,n;ee.isNullOrUndefined(e.sheetIndex)||e.sheetIndex===this.parent.activeSheetIndex?(e.indexes||(n=this.parent.getActiveSheet(),t=this.parent.frozenRowCount(n),r=this.parent.frozenColCount(n),n=te(n.topLeftCell),t&&r&&this.refreshRange([n[0],n[1],t-1,r-1],e.refreshing,e.checkWrap,!1,e.checkCF),t&&this.refreshRange([n[0],this.parent.viewport.leftIndex+r,t-1,this.parent.viewport.rightIndex],e.refreshing,e.checkWrap,!1,e.checkCF),r&&this.refreshRange([this.parent.viewport.topIndex+t,n[1],this.parent.viewport.bottomIndex,r-1],e.refreshing,e.checkWrap,!1,e.checkCF),e.indexes=[this.parent.viewport.topIndex+t,this.parent.viewport.leftIndex+r,this.parent.viewport.bottomIndex,this.parent.viewport.rightIndex]),this.refreshRange(e.indexes,e.refreshing,e.checkWrap,!1,e.checkCF)):e.refreshing&&this.calculateFormula({cell:se(e.indexes[0],e.indexes[1],ae(this.parent,e.sheetIndex),!0,!0),rowIdx:e.indexes[0],colIdx:e.indexes[1],sheetIndex:e.sheetIndex})},sp.prototype.destroy=function(){this.parent.off(hn,this.updateView),this.parent.off(wt,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};var ap=sp;function sp(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(hn,this.updateView,this),this.parent.on(wt,this.calculateFormula,this)}hp.prototype.render=function(){this.parent.setProperties({activeSheetIndex:this.parent.skipHiddenSheets(this.parent.activeSheetIndex)},!0),this.parent.isMobileView()||(this.parent.notify($i,null),this.parent.notify(Zi,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(Ji,null):(this.parent.notify(ie,{action:"initSheetInfo"}),this.parent.notify(ie,{action:"initiateDefinedNames"})),this.parent.isMobileView()&&(this.parent.notify(Zi,null),this.parent.notify($i,null)),this.parent.password&&(0<this.parent.password.length||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)},hp.prototype.checkTopLeftCell=function(e,t,r,n,i,o){var a,s,l,h=this.parent.getActiveSheet(),d=(this.parent.showSpinner(),"A1"===h.topLeftCell),p=W(h.topLeftCell),c=(h.topLeftCell!==h.paneTopLeftCell&&(h.frozenRows||h.frozenColumns)?(c=W(h.paneTopLeftCell),a=this.parent.scrollSettings.enableVirtualization,d=h.frozenRows&&h.frozenColumns?p[0]+h.frozenRows===c[0]&&p[1]+h.frozenColumns===c[1]:h.frozenRows?p[0]+h.frozenRows===c[0]&&0===p[1]:p[1]+h.frozenColumns===c[1]&&0===p[0],p[0]&&c[0]>p[0]?this.parent.viewport.beforeFreezeHeight=Ah(h,0,p[0]-1,!0):this.parent.viewport.beforeFreezeHeight=0,p[1]&&c[1]>p[1]?this.parent.viewport.beforeFreezeWidth=Uh(h,0,p[1]-1,!0):this.parent.viewport.beforeFreezeWidth=0):this.parent.viewport.beforeFreezeHeight=this.parent.viewport.beforeFreezeWidth=0,this.parent.frozenRowCount(h)),u=this.parent.frozenColCount(h);!this.parent.scrollSettings.enableVirtualization||d?(this.refreshUI({rowIndex:p[0],colIndex:p[1],refresh:"All"},null,e,t,i,o),a&&(this.parent.viewport.topIndex=Y(h,c,!0)-c,this.parent.viewport.leftIndex=Y(h,u,!0,"columns")-u)):(d=h.paneTopLeftCell===h.topLeftCell?p:W(h.paneTopLeftCell),(s={preventScroll:!0}).scrollTop=r||(d[0]>c?Ah(h,c,d[0]-1,!0):0),s.scrollLeft=n||(d[1]>u?Uh(h,u,d[1]-1,!0):0),this.parent.notify(Xo,s),r=this.parent.getThreshold("row"),n=h.frozenRows?p[0]:p[0]>r?Y(h,p[0]-r,!0):0,l=[],h.frozenRows&&l.push(d[0]-r>c?d[0]-r:c),r=this.parent.getThreshold("col"),p=h.frozenColumns?p[1]:p[1]>r?Y(h,p[1]-r,!0,"columns"):0,h.frozenColumns?(l.length||l.push(c),l.push(d[1]-r>u?d[1]-r:u)):l.length&&l.push(u),this.refreshUI({rowIndex:n,colIndex:p,refresh:"All",top:s.scrollTop,left:s.scrollLeft,frozenIndexes:l},null,e,t,i,o),a&&(c&&c<=l[0]&&(this.parent.viewport.topIndex=Y(h,l[0],!0)-c),u)&&u<=l[1]&&(this.parent.viewport.leftIndex=Y(h,l[1],!0,"columns")-u))},hp.prototype.renderSheet=function(e){(e=void 0===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()},hp.prototype.refreshUI=function(i,o,a,s,l,h){var e,t,r,n,d,p,c,u,f,g,m,v=this,y=("All"!==i.refresh&&this.parent.showSpinner(),this.parent.serviceLocator.getService("sheet")),C=this.parent.getActiveSheet(),b=Di(this.parent),x={rowCount:C.rowCount,colCount:C.colCount},S=(i.frozenIndexes=i.frozenIndexes||[],o=o||(this.parent.scrollSettings.enableVirtualization?(p=i.rowIndex+this.parent.viewport.rowCount+2*this.parent.getThreshold("row"),f=i.colIndex+this.parent.viewport.colCount+2*this.parent.getThreshold("col"),e=this.parent.frozenRowCount(C),t=this.parent.frozenColCount(C),i.frozenIndexes.length&&(p+=i.frozenIndexes[0]-e,f+=i.frozenIndexes[1]-t),"Row"===i.refresh?p+=e:p+=C.frozenRows,"Column"===i.refresh?f+=t:f+=C.frozenColumns,r=i.frozenIndexes[0]>e?i.frozenIndexes[0]:i.rowIndex+("Row"===i.refresh?e:C.frozenRows),p=(u=this.parent.skipHidden(r,p,"rows",!1))[1],r!==u[0]&&(c=W(C.paneTopLeftCell))[0]===r&&this.parent.updateTopLeftCell(u[0]-e,c[1],"col"),u[0]-=e,r=C.rowCount-1,d=0,n=i.rowIndex,this.parent.scrollSettings.isFinite&&r<p&&(d=p-r,p=Y(C,r,!1),u[0]+e>Y(C,e,!0))&&(m=i.rowIndex-d,m=this.decreaseHidden(m=m<0?0:m,i.rowIndex-1,e),i.top&&m<i.rowIndex&&this.parent.notify(Ys,{height:Ah(C,m+e,i.rowIndex-1+e,!0),isRender:!0}),this.parent.viewport.topIndex=u[0]=m,n="Row"===i.refresh?m:n),"Row"===i.refresh?i.rowIndex=Y(C,n+e,!0)-e:n=i.rowIndex=e?Y(C,n,!0):u[0],g=i.frozenIndexes[1]>t?i.frozenIndexes[1]:i.colIndex+("Column"===i.refresh?t:C.frozenColumns),f=(u=this.parent.skipHidden(g,f,"columns",!1))[1],g!==u[0]&&(c=W(C.paneTopLeftCell))[1]===g&&this.parent.updateTopLeftCell(c[0],u[0]-t,"row"),u[0]-=t,r=C.colCount-1,d=0,g=i.colIndex,this.parent.scrollSettings.isFinite&&r<f&&(d=f-r,f=Y(C,r,!1,"columns"),u[0]+t>Y(C,t,!0,"columns"))&&(m=i.colIndex-d,m=this.decreaseHidden(m=-1<m?m:0,i.colIndex-1,t,"columns"),i.left&&m<i.colIndex&&this.parent.notify(Ys,{width:Uh(C,m+t,i.colIndex-1+t,!0),isRender:!0}),this.parent.viewport.leftIndex=u[0]=m,g="Column"===i.refresh?m:g),"Column"===i.refresh?i.colIndex=Y(C,g+t,!0,"columns")-t:g=i.colIndex=t?Y(C,g,!0,"columns"):u[0],"Row"===i.refresh&&(n+=e,e&&(p+=W(C.topLeftCell)[0]),f=this.parent.viewport.rightIndex),"Column"===i.refresh&&(g+=t,t&&(f+=W(C.topLeftCell)[1]),p=this.parent.viewport.bottomIndex),this.parent.viewport.topIndex=i.rowIndex,this.parent.viewport.bottomIndex=p,this.parent.viewport.leftIndex=i.colIndex,this.parent.viewport.rightIndex=f,G(n,g)+":"+G(p,f)):("All"===i.refresh&&this.updateTopLeftScrollPosition(ee.extend(i,{sheet:C})),this.parent.viewport.bottomIndex=C.rowCount-1,this.parent.viewport.rightIndex=C.colCount-1,G(i.rowIndex,i.colIndex)+":"+G(this.parent.viewport.bottomIndex,this.parent.viewport.rightIndex))),"All"===i.refresh&&this.parent.trigger(Do,{}),this.parent.isOpen||this.parent.refreshing),w=(Id(this.parent.getMainContent(),{busy:!0}),this.parent.sheets.length);pi(this.parent,b+"!"+o,null,null,i.frozenIndexes).then(function(e){if(v.parent&&!(w<v.parent.sheets.length)){var t=Ii(v.parent,C.id);if(l||void 0!==t&&t===v.parent.activeSheetIndex){var r,n=[i.rowIndex,i.colIndex].concat(W(o.split(":")[1]));switch(i.refresh){case"All":y.renderTable({cells:e,indexes:n,top:i.top,left:i.left,initLoad:a,isRefreshing:s,isOpen:S,openOptions:h});break;case"Row":y.refreshRowContent({cells:e,indexes:n,skipUpdateOnFirst:i.skipUpdateOnFirst,prevRowColCnt:x}),v.parent.notify(eo,r={isEdit:!1}),r.isEdit&&v.parent.notify(io,{action:"startEdit",refreshCurPos:!1});break;case"Column":y.refreshColumnContent({cells:e,indexes:n,skipUpdateOnFirst:i.skipUpdateOnFirst,prevRowColCnt:x,insertDelete:i.insertDelete});break;case"RowPart":y.updateRowContent({cells:e,indexes:n,direction:i.direction,skipUpdateOnFirst:i.skipUpdateOnFirst,prevRowColCnt:x});break;case"ColumnPart":y.updateColContent({cells:e,indexes:n,direction:i.direction,skipUpdateOnFirst:i.skipUpdateOnFirst,prevRowColCnt:x})}v.parent&&v.parent.isReact&&v.parent.renderReactTemplates()}else-1<t&&v.checkTopLeftCell()}}),this.parent.notify(go,{refresh:i.refresh,skipTranslate:i.skipTranslate})},hp.prototype.updateTopLeftScrollPosition=function(e){var t,r=W(e.sheet.topLeftCell),n=W(e.sheet.paneTopLeftCell);e.sheet.frozenRows?(t=this.parent.frozenRowCount(e.sheet),n[0]>t&&(e.top=Ah(e.sheet,t,n[0]-1,!0))):(e.rowIndex&&(e.rowIndex=0),0!==r[0]&&(e.top=Ah(e.sheet,0,r[0]-1,!0))),e.sheet.frozenColumns?(t=this.parent.frozenColCount(e.sheet),n[1]>t&&(e.left=Uh(e.sheet,t,n[1]-1,!0))):(e.colIndex&&(e.colIndex=0),0!==r[1]&&(e.left=Uh(e.sheet,0,r[1]-1,!0)))},hp.prototype.removeSheet=function(){document.getElementById(this.parent.element.id+"_sheet")&&ee.remove(document.getElementById(this.parent.element.id+"_sheet"))},hp.prototype.refreshSheet=function(e,t,r,n,i){var o=0,a=0;t&&((t=this.parent.element.getElementsByClassName("e-main-panel")[0])&&(o=t.scrollTop),t=this.parent.getMainContent())&&(a=t.scrollLeft),this.removeSheet(),this.renderSheet(),this.parent.notify(Ko,{}),this.checkTopLeftCell(!1,e,o,a,n,i),r&&ce(this.parent.element)},hp.prototype.setSheetPanelSize=function(e){var t,r,n=document.getElementById(this.parent.element.id+"_sheet_panel"),i=this.parent.element.getBoundingClientRect(),o=(this.parent.viewport.scaleY=this.parent.viewport.scaleX=1,this.parent.enableScaling&&(1!=(r=(o=this.parent.element.offsetHeight)/i.height)&&Math.abs(o-i.height)>=.1*o&&(this.parent.viewport.scaleY=r),1!=(r=(o=this.parent.element.offsetWidth)/i.width))&&Math.abs(o-i.width)>=.1*o&&(this.parent.viewport.scaleX=r),"auto"===this.parent.height?(n.style.height="260px",t=230):(t=i.height*this.parent.viewport.scaleY-ed(n,null,this.parent.viewport.scaleY),n.style.height=t+"px",t-=32/this.parent.viewport.scaleY),void 0!==e&&(this.colMinWidth=e),this.parent.viewport.height=t,i.width*this.parent.viewport.scaleX);this.parent.viewport.width=o-32/this.parent.viewport.scaleX,this.parent.viewport.rowCount=this.roundValue(t,20),this.parent.viewport.colCount=this.roundValue(o,this.colMinWidth||64)},hp.prototype.roundValue=function(e,t){e/=t,t=Math.round(e);return Math.abs(e-t)<.5?t:t-1},hp.prototype.moveOrDuplicateSheetHandler=function(e){this.parent.notify(Qi,null),e.refresh&&this.refreshSheet(e.isDuplicate)},hp.prototype.decreaseHidden=function(e,t,r,n){void 0===n&&(n="rows"),e+=r,t+=r;for(var i=this.parent.getActiveSheet(),o=t;e<=o;o--)if(i[""+n][o]&&i[""+n][o].hidden&&--e<r){e=Y(i,r,!0,n);break}return e-r},hp.prototype.instantiateRenderer=function(){this.parent.serviceLocator.register("cell",new ap(this.parent)),this.parent.serviceLocator.register("row",new ip(this.parent)),this.parent.serviceLocator.register("sheet",new rp(this.parent))},hp.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},hp.prototype.addEventListener=function(){this.parent.on(no,this.destroy,this),this.parent.on(en,this.moveOrDuplicateSheetHandler,this),this.parent.on(Xs,this.updateTopLeftScrollPosition,this)},hp.prototype.removeEventListener=function(){this.parent.off(no,this.destroy),this.parent.off(en,this.moveOrDuplicateSheetHandler),this.parent.off(Xs,this.updateTopLeftScrollPosition)};var lp=hp;function hp(e){this.parent=e,this.addEventListener(),this.instantiateRenderer()}var dp=function(o,a,s,l){return new(s=s||Promise)(function(e,t){function r(e){try{i(l.next(e))}catch(e){t(e)}}function n(e){try{i(l.throw(e))}catch(e){t(e)}}function i(t){t.done?e(t.value):new s(function(e){e(t.value)}).then(r,n)}i((l=l.apply(o,a||[])).next())})},pp=function(n,i){var o,a,s,l={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},e={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(r){return function(e){var t=[r,e];if(o)throw new TypeError("Generator is already executing.");for(;l;)try{if(o=1,a&&(s=2&t[0]?a.return:t[0]?a.throw||((s=a.return)&&s.call(a),0):a.next)&&!(s=s.call(a,t[1])).done)return s;switch(a=0,(t=s?[2&t[0],s.value]:t)[0]){case 0:case 1:s=t;break;case 4:return l.label++,{value:t[1],done:!1};case 5:l.label++,a=t[1],t=[0];continue;case 7:t=l.ops.pop(),l.trys.pop();continue;default:if(!(s=0<(s=l.trys).length&&s[s.length-1])&&(6===t[0]||2===t[0])){l=0;continue}if(3===t[0]&&(!s||t[1]>s[0]&&t[1]<s[3]))l.label=t[1];else if(6===t[0]&&l.label<s[1])l.label=s[1],s=t;else{if(!(s&&l.label<s[2])){s[2]&&l.ops.pop(),l.trys.pop();continue}l.label=s[2],l.ops.push(t)}}t=i.call(n,l)}catch(e){t=[6,e],a=0}finally{o=s=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}}},cp=(up.prototype.init=function(){this.parent.element.appendChild(this.parent.createElement("input",{className:"e-clipboard",attrs:{contenteditable:"true",tabindex:"-1","aria-hidden":"true"}}))},up.prototype.addEventListener=function(){var e=this.getClipboardEle();this.parent.on(Fo,this.cut,this),this.parent.on(ko,this.copy,this),this.parent.on(Oo,this.paste,this),this.parent.on(Ao,this.clearCopiedInfo,this),this.parent.on(Eo,this.tabSwitchHandler,this),this.parent.on(Co,this.cMenuBeforeOpenHandler,this),this.parent.on(wo,this.ribbonClickHandler,this),this.parent.on(to,this.initCopyIndicator,this),this.parent.on(Go,this.rowHeightChanged,this),this.parent.on(Yo,this.colWidthChanged,this),this.parent.on(ln,this.refreshOnInsertDelete,this),ee.EventHandler.add(e,"cut",this.cut,this),ee.EventHandler.add(e,"copy",this.copy,this),ee.EventHandler.add(e,"paste",this.paste,this)},up.prototype.removeEventListener=function(){var e=this.getClipboardEle();this.parent.isDestroyed||(this.parent.off(Fo,this.cut),this.parent.off(ko,this.copy),this.parent.off(Oo,this.paste),this.parent.off(Ao,this.clearCopiedInfo),this.parent.off(Eo,this.tabSwitchHandler),this.parent.off(Co,this.cMenuBeforeOpenHandler),this.parent.off(wo,this.ribbonClickHandler),this.parent.off(to,this.initCopyIndicator),this.parent.off(Go,this.rowHeightChanged),this.parent.off(Yo,this.colWidthChanged),this.parent.off(ln,this.refreshOnInsertDelete)),ee.EventHandler.remove(e,"cut",this.cut),ee.EventHandler.remove(e,"copy",this.copy),ee.EventHandler.remove(e,"paste",this.paste)},up.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})}},up.prototype.tabSwitchHandler=function(e){0!==e.activeTab||this.copiedInfo||this.copiedShapeInfo||this.hidePaste()},up.prototype.cMenuBeforeOpenHandler=function(e){var t=this.parent.getActiveSheet(),r=this.parent.serviceLocator.getService(T),n=W(t.activeCell),i=se(n[0],n[1],t),o=t.isProtected&&Mn(i,de(t,n[1])),i=ti(i,de(t,n[1]),Nh(t,n[0]));"Content"!==e.target&&"RowHeader"!==e.target&&"ColumnHeader"!==e.target&&"SelectAll"!==e.target||(this.parent.enableContextMenuItems([r.getConstant("Paste"),r.getConstant("PasteSpecial")],!!(this.copiedInfo||this.copiedShapeInfo&&!o)),this.parent.enableContextMenuItems([r.getConstant("Cut")],!o)),"Content"===e.target&&(t.isProtected&&this.parent.enableContextMenuItems([r.getConstant("Filter"),r.getConstant("Sort"),r.getConstant("AddNote")],!1),o?this.parent.enableContextMenuItems([r.getConstant("Cut"),r.getConstant("Hyperlink"),r.getConstant("EditNote"),r.getConstant("DeleteNote")],!1):i?this.parent.enableContextMenuItems([r.getConstant("Cut"),r.getConstant("Paste"),r.getConstant("PasteSpecial"),r.getConstant("Filter"),r.getConstant("Sort"),r.getConstant("Hyperlink"),r.getConstant("EditHyperlink"),r.getConstant("OpenHyperlink"),r.getConstant("RemoveHyperlink")],!1):t.isProtected&&!t.protectSettings.insertLink&&this.parent.enableContextMenuItems([r.getConstant("Hyperlink")],!1)),t.isProtected&&("ColumnHeader"===e.target&&(n=[r.getConstant("DeleteColumn"),r.getConstant("DeleteColumns"),r.getConstant("InsertColumn"),r.getConstant("InsertColumns")],o=[r.getConstant("HideColumn"),r.getConstant("HideColumns"),r.getConstant("UnhideColumns")],this.parent.enableContextMenuItems(n,!1),this.parent.enableContextMenuItems(o,t.protectSettings.formatColumns)),"RowHeader"===e.target)&&(i=[r.getConstant("DeleteRow"),r.getConstant("DeleteRows"),r.getConstant("InsertRow"),r.getConstant("InsertRows")],n=[r.getConstant("HideRow"),r.getConstant("HideRows"),r.getConstant("UnhideRows")],this.parent.enableContextMenuItems(i,!1),this.parent.enableContextMenuItems(n,t.protectSettings.formatRows))},up.prototype.rowHeightChanged=function(e){var t;this.copiedInfo&&(t=this.getCopyIndicator())&&(this.copiedInfo.range[0]>e.rowIdx?t.style.top=parseFloat(t.style.top)+e.threshold+"px":Tn(this.copiedInfo.range,e.rowIdx,this.copiedInfo.range[1])&&(t.style.height=parseFloat(t.style.height)+e.threshold+"px"))},up.prototype.colWidthChanged=function(e){var t;this.copiedInfo&&(t=this.getCopyIndicator())&&(this.copiedInfo.range[1]>e.colIdx?t.style.left=parseFloat(t.style.left)+e.threshold+"px":Tn(this.copiedInfo.range,this.copiedInfo.range[0],e.colIdx)&&(t.style.width=parseFloat(t.style.width)+e.threshold+"px"))},up.prototype.cut=function(e){this.setCopiedInfo(e,!0)},up.prototype.copy=function(e){this.setCopiedInfo(e,!1)},up.prototype.paste=function(e){if(this.parent.isEdit||0<this.parent.element.getElementsByClassName("e-dlg-overlay").length)this.parent.element.getElementsByClassName("e-spreadsheet-edit")[0].style.height="auto";else{var t,r=e&&e.clipboardData||window.clipboardData;if(!(r&&e.clipboardData&&e.clipboardData.getData("isInternalCut").length)||this.copiedInfo)if(r||this.copiedShapeInfo||e.isInternal&&this.copiedInfo){e.isInternal=!r;var M=void 0,n=this.getCopiedIdx(),i=(e.isAction=!!r||e.isAction,e&&-1<e.sIdx?e.sIdx:this.parent.activeSheetIndex),o=ae(this.parent,i),a=ne(e&&e.range||te(o.selectedRange)),s=void 0,l=void 0;if(r){if(l=(s=this.getExternalCells(e)).model,!e.isInternal&&s.internal&&(r=!1,!this.copiedInfo))return;if(!l||!l.length){if(s.file)return void this.parent.notify(ds,{file:s.file});if(!this.copiedInfo)return;r=!1}}var h=Object.assign({isExternal:r},this.copiedInfo),d=void 0,p=void 0,c=void 0,B=void 0,u=void 0,f=void 0,g=void 0,m=void 0,v=void 0,y=(r?(g=ae(this.parent,p=i),c={},u="Sheet"!==(f=s.selection)&&(a[2]-a[0]+1)%s.rowCount==0&&(a[3]-a[1]+1)%s.colCount==0,d=[0,0,s.usedRowIndex,s.usedColIndex]):(p=n,c=de(o,(d=ne(this.copiedShapeInfo?te(o.selectedRange):this.copiedInfo.range))[1]),B=fe(d)&&this.isRangeMerged(a,o),g=ae(this.parent,p),u=!B&&(a[2]-a[0]+1)%(d[2]-d[0]+1)==0&&(a[3]-a[1]+1)%(d[3]-d[1]+1)==0,g&&(m=0===d[1]&&d[3]===g.colCount-1,v=0===d[0]&&d[2]===g.rowCount-1,m?(v?(f="Sheet",d[2]=g.usedRange.rowIndex):f="Row",d[3]=g.usedRange.colIndex):v&&(f="Column",d[2]=g.usedRange.rowIndex))),t=u?a:[a[0],a[1]].concat([a[0]+d[2]-d[0],a[1]+d[3]-d[1]||a[1]]),f&&(("Sheet"===f||"Column"===f)&&t[2]<o.usedRange.rowIndex&&(t[2]=o.usedRange.rowIndex),"Sheet"===f||"Row"===f)&&t[3]<o.usedRange.colIndex&&(t[3]=o.usedRange.colIndex),e&&e.type||"All");if(Xd(this.parent,t))this.parent.notify(qa,null);else{if(e.isAction&&!this.copiedShapeInfo){var C={requestType:"paste",copiedInfo:this.copiedInfo,copiedRange:re(d),pastedRange:re(t),type:y,cancel:!1};if(this.parent.notify(gt,{eventArgs:C,action:"clipboard"}),C.cancel)return;a=te(C.pastedRange),t=(u=r?"Sheet"!==s.selection&&(a[2]-a[0]+1)%s.rowCount==0&&(a[3]-a[1]+1)%s.colCount==0:!B&&!m&&(a[2]-a[0]+1)%(d[2]-d[0]+1)==0&&!v&&(a[3]-a[1]+1)%(d[3]-d[1]+1)==0)?a:[a[0],a[1]].concat([a[0]+d[2]-d[0],a[1]+d[3]-d[1]||a[1]]),y=C.type}var s=void 0,b=(f?(s=[].concat(t),"Sheet"!==f&&"Column"!==f||(t[2]<o.usedRange.rowIndex&&(t[2]=o.usedRange.rowIndex),d[2]<o.usedRange.rowIndex&&(d[2]+=o.usedRange.rowIndex-d[2]),s[2]<o.rowCount&&(s[2]=o.rowCount-1)),"Sheet"!==f&&"Row"!==f||(t[3]<o.usedRange.colIndex&&(d[3]+=o.usedRange.colIndex-t[3],t[3]=o.usedRange.colIndex),d[3]<o.usedRange.colIndex&&(d[3]+=o.usedRange.colIndex-d[3]),s[3]<o.colCount&&(s[3]=o.colCount-1))):s=t,void 0),U=void 0,x=void 0,S=a[0],H=[];if(o.isProtected&&jd(this.parent,t))this.parent.notify(_a,null);else if(this.copiedShapeInfo&&!this.copiedInfo){C=this.copiedShapeInfo.pictureElem,C=(C.classList.contains("e-datavisualization-chart")?(this.copiedShapeInfo.chartInfo.top=null,this.copiedShapeInfo.chartInfo.left=null,this.parent.notify(zr,{chart:[this.copiedShapeInfo.chartInfo],isInitCell:!0,isUndoRedo:!0,isPaste:!0,dataSheetIdx:this.copiedShapeInfo.sheetIdx,isCut:this.copiedShapeInfo.isCut,range:e.range||o.selectedRange,sheetId:o.id})):this.parent.notify(gs,{options:{src:C.style.backgroundImage.replace(/url\((['"])?(.*?)\1\)/gi,"$2"),height:this.copiedShapeInfo.height,width:this.copiedShapeInfo.width,id:this.copiedShapeInfo.isCut?C.id:""},range:re([S,a[1],S,a[1]]),isPublic:!1,isUndoRedo:!0}),se(S,a[1],o));C&&!ee.isNullOrUndefined(C.image)&&0<C.image.length&&(P={requestType:"imagePaste",copiedShapeInfo:this.copiedShapeInfo,pasteSheetIndex:this.parent.activeSheetIndex,pastedRange:Di(this.parent)+"!"+re([S,a[1],S,a[1]]),pastedPictureElement:document.getElementById(C.image[C.image.length-1].id)},this.parent.notify(le,{eventArgs:P,action:"clipboard"}))}else{for(var w=[],I=this.isInRange(d,a,n),V=!1,j=!1,z=0,E=[],N=(u||"Values"===y||this.setCF(d,t,g,o,E),void 0),_=!1,q=[],C={sheet:o,isExternal:!!r},W=this.setCell(C),G=!r&&this.copiedInfo.isCut&&this.setCell({sheet:g}),R=d[0],F=0;R<=d[2];R++,F++)if(r||h.isCut||!Fh(g,R)){I&&(w[a[0]+F]={cells:[]});for(var Y,k=d[1],O=0;k<=d[3];k++,O++){if(I&&(w[a[0]+F].cells[a[1]+O]=se(a[0]+F,a[1]+O,g,!1,!0)),b=r?l[R]&&l[R].cells[k]||{}:ee.extend({},I&&w[R]&&w[R].cells[k]?w[R].cells[k]:se(R,k,g),null,!0),c=de(g,k),!b.validation&&c.validation&&(b.validation=c.validation),b&&b.isReadOnly&&delete b.isReadOnly,(m||v)&&(b&&b.rowSpan&&(0<b.rowSpan?b.rowSpan+R-1<=d[2]?V=!0:b={}:(!V||b.rowSpan<0&&(Y=b.rowSpan,L=b.colSpan||0,Y=se(S+Y,a[1]+O+L,o))&&!Y.rowSpan)&&(b={})),b)&&b.colSpan&&(0<b.colSpan?b.colSpan+k-1<=d[3]?j=!0:b={}:j||(b={})),b&&y){var X=void 0;switch(y){case"Formats":X={format:b.format,style:b.style},this.copiedInfo&&!this.copiedInfo.isCut&&(b.rowSpan&&(X.rowSpan=b.rowSpan),b.colSpan)&&(X.colSpan=b.colSpan),b=X;break;case"Values":(b={value:b.value}).value&&-1<b.value.toString().indexOf("\n")&&this.parent.getCell(a[0],a[1]).classList.add("e-alt-unwrap")}U=-1<["Formats","Values"].indexOf(y)}if(!this.parent.scrollSettings.isFinite&&(d[2]-d[0]>1048575-a[0]||d[3]-d[1]>16383-a[1])||this.parent.scrollSettings.isFinite&&(d[2]-d[0]>o.rowCount-1-a[0]||d[3]-d[1]>o.colCount-1-a[1]))return void this.showDialog();if(u){for(var A=a[0];A<=a[2];A+=d[2]-d[0]+1)if(h.isCut||z||!Fh(o,A+F))for(var T=a[1];T<=a[3];T+=d[3]-d[1]+1){if(R!==d[0]||k!==d[1]||void 0!==N&&!N.length||"Values"===y||(N=this.setCF(d,[A,T,A+(d[2]-d[0]),T+(d[3]-d[1])],g,o,E,N)),x=se(A+F,T+O,o,!1,!0),!(r||ee.isNullOrUndefined(x.colSpan)&&ee.isNullOrUndefined(x.rowSpan))){if(m||v)continue;var D={range:[A+F,T+O,A+F,T+O],merge:!1,isAction:!1,type:"All",sheetIndex:i,preventRefresh:i!==this.parent.activeSheetIndex};H.push(D),this.parent.notify(Or,D)}var K,$,D=T+O,Z=(b=ee.extend({},b||{},null,!0),!U&&this.copiedInfo&&!this.copiedInfo.isCut&&b.formula&&(K=Vn([A+F,D],[R,k],g,this.parent,I?b:null),ee.isNullOrUndefined(K)||(b.formula=K)),this.copiedInfo&&!this.copiedInfo.isCut&&b.validation&&($=Vn(K=a,Z=d,g,this.parent,{formula:b.validation.value1}),b.validation.value1=$,""!==b.validation.value2)&&($=Vn(K,Z,g,this.parent,{formula:b.validation.value2}),b.validation.value2=$),o.isProtected&&b&&!1!==b.isLocked&&(b.isLocked=x.isLocked),x&&x.formula&&-1<x.formula.indexOf("=UNIQUE(")&&this.parent.notify(zt,null),{cellIdx:[R,k],isUnique:!1,uniqueRange:"",sheetName:g.name});this.parent.notify(_t,Z),Z.isUnique&&(b.value=null),_=!1,b&&b.formula&&-1<b.formula.indexOf("=UNIQUE(")&&(_=!0,q.push([A,D]),b.value=null),W(A+F,D,b,D===a[3],U,_,e.beforeActionData,e.isUndo)||b.formula&&this.copiedInfo&&this.copiedInfo.isCut&&this.parent.notify(Wt,{cellRef:re([R,k,R,k])})}}else!r&&Od(this.parent,R,k,n)||(B?W(S,a[1]+O,{value:b.value},k===d[3],!0):W(S,a[1]+O,b,k===d[3],U));if(!r&&this.copiedInfo.isCut&&(!Tn(a,R,k)||n!==this.parent.activeSheetIndex)){var L=se(R,k,g);if(L){if(L.isReadOnly)continue;if(L.isLocked||ee.isNullOrUndefined(L.isLocked)){if((m||v)&&(void 0!==L.rowSpan||void 0!==L.colSpan)){if(!(1<L.rowSpan||1<L.colSpan))continue;this.parent.notify(Or,{merge:!1,range:[R,k,R,k],type:"All"})}L=null}else!1===L.isLocked&&(L=g.isProtected?{isLocked:!1}:null)}G(R,k,L,k===d[3])}}S++}else F--,z++;if(q.length)for(R=0;R<q.length;R++)this.parent.serviceLocator.getService("cell").refresh(q[R][0],q[R][1]);C.isRandFormula&&"Automatic"===this.parent.calculationMode&&this.parent.notify(ie,{action:"refreshRandomFormula"}),this.parent.notify(qr,null);var P,C=t[2]-z,J=s[2]-z,C=(t[2]=C,s[2]=J,this.parent.setUsedRange(t[2],t[3]),re(s)),J=(i!==this.parent.activeSheetIndex||e.isFromUpdateAction||this.parent.notify(No,{address:C}),!r&&this.copiedInfo.isCut&&(M=this.copiedInfo.isCut,n===this.parent.activeSheetIndex&&this.parent.serviceLocator.getService("cell").refreshRange(d),this.clearCopiedInfo()),(r||I)&&this.copiedInfo&&this.clearCopiedInfo(),void 0),s=(M&&(N&&N.length&&"Values"!==y&&this.parent.notify(Ur,J={range:d,sheetIdx:p,isClear:!0}),Hd(g,d[0],d[1],(this.parent.getRow(d[0],null,this.parent.frozenColCount(g))||{offsetHeight:20}).offsetHeight),Q=Vd(g,d[0]),Ad(this.parent,g,Q,d[0])),E.length&&i===this.parent.activeSheetIndex&&this.parent.notify(Br,{cfModel:E,isAction:!0}),ae(this.parent,n));if(!r&&d[0]===d[2]&&"Row"===f){for(var Q=s.rows[d[0]].height,R=a[0];R<=a[2];R++)Ad(this.parent,this.parent.getActiveSheet(),Q,R);M&&(p=s&&s.standardHeight?s.standardHeight:20,Ad(this.parent,s,p,d[0]))}e.isAction&&(P={requestType:"paste",copiedInfo:h,mergeCollection:H,pasteSheetIndex:this.parent.activeSheetIndex,copiedRange:g.name+"!"+(h.range?re(h.range):g.selectedRange),pastedRange:o.name+"!"+re(t),type:y||"All",selectedRange:C},z&&(P.skipFilterCheck=!0),J&&J.cfClearActionArgs&&(P.cfClearActionArgs=J.cfClearActionArgs),E.length&&(P.cfActionArgs={cfModel:E,sheetIdx:i}),this.parent.notify(le,{eventArgs:P,action:"clipboard"})),e.focus&&ce(this.parent.element)}}}else this.getClipboardEle().select()}},up.prototype.setCF=function(t,r,e,n,i,o){function a(e){s=[r[0]+(l[0]<=t[0]?0:l[0]-t[0]),r[1]+(l[1]<=t[1]?0:l[1]-t[1]),r[2]-(l[2]>=t[2]?0:t[2]-l[2]),r[3]-(l[3]>=t[3]?0:t[3]-l[3])],n.conditionalFormats||h.parent.setSheetPropertyOnMute(n,"conditionalFormats",[]),e={range:re(s),type:e.type,cFColor:e.cFColor,value:e.value,format:e.format},n.conditionalFormats.push(e),i.push(e)}var s,l,h=this;if(o)for(var d=0,p=o.length;d<p;d++)l=te(o[d].range),a(o[d]);else if(o=[],e.conditionalFormats)for(d=0,p=e.conditionalFormats.length;d<p;d++)l=te(e.conditionalFormats[d].range),Xn([t],e.conditionalFormats[d].range)&&(o.push(e.conditionalFormats[d]),a(e.conditionalFormats[d]));return o},up.prototype.isRangeMerged=function(e,t){var t=se(e[0],e[1],t);return!(!t||!(1<t.colSpan||1<t.rowSpan))&&(t={range:e.slice(2,4).concat(e.slice(2,4))},this.parent.notify(Dr,t),t.range[0]===e[0])&&t.range[1]===e[1]&&t.range[2]===e[2]&&t.range[3]===e[3]},up.prototype.updateFilter=function(e,t){var r;this.parent.notify(Ct,null);for(var n,i,o=0;o<this.parent.sheets.length;o++)this.parent.filterCollection&&this.parent.filterCollection[o]&&this.parent.filterCollection[o].sheetIndex===Ii(this.parent,e.sId)&&(i=e.range,n=te(this.parent.filterCollection[o].filterRange),i=ne(i),n[0]===i[0])&&n[2]===i[2]&&n[1]===i[1]&&n[3]===i[3]&&(r=!0,d=[Math.abs(i[0]-n[0]),Math.abs(i[1]-n[1]),Math.abs(i[2]-n[2]),Math.abs(i[3]-n[3])]);var a=this.parent.getCell(e.range[0],e.range[1]),s=(a=a&&(a.querySelector(".e-filter-icon")?a:this.parent.getCell(e.range[2],e.range[3])))&&a.querySelector(".e-sortasc-filter"),l=a&&a.querySelector(".e-sortdesc-filter");if(r)for(var h=0;h<this.parent.filterCollection.length;h++){var d,p=this.parent.filterCollection[h],c=e&&e.sId?Ii(this.parent,e.sId):this.parent.activeSheetIndex;p.sheetIndex===c&&this.parent.notify(xa,{predicates:null,range:p.filterRange,sIdx:c,isCut:!0}),p.sheetIndex===c&&c===this.parent.activeSheetIndex&&(d=[t[0]+d[0],t[1]+d[1],Math.abs(t[2]-d[2]),Math.abs(t[3]-d[3])],this.parent.notify(xa,{predicates:null,range:re(d),sIdx:null,isCut:!0}),e.range[3]===e.range[1])&&(p=this.parent.getCell(t[0],t[1]),s&&p&&p.querySelector(".e-filter-icon").classList.add("e-sortasc-filter"),l)&&p&&p.querySelector(".e-filter-icon").classList.add("e-sortdesc-filter")}},up.prototype.isInRange=function(e,t,r){var n=this.parent.activeSheetIndex;return Tn(e,t[0],t[1])&&r===n||Tn(e,t[2],t[3])&&r===n},up.prototype.setCell=function(l){var h=this,d=l.sheet,p=d.name===this.parent.getActiveSheet().name;return function(e,t,r,n,i,o,a,s){r&&r.formula&&(-1<r.formula.indexOf("RANDBETWEEN(")||-1<r.formula.indexOf("RAND(")||-1<r.formula.indexOf("NOW("))&&(l.isRandFormula=!0);i=_n(h.parent,d,{cell:r,rowIdx:e,colIdx:t,pvtExtend:!i,valChange:!o,lastCell:n,uiRefresh:p,requestType:"paste",skipFormatCheck:!l.isExternal,isRandomFormula:l.isRandFormula},a,s);return!i&&r&&(r.validation&&(o=G(e,t),h.parent.dataValidationRange+=o+":"+o+","),r.style)&&l.isExternal&&(n=Ud(h.parent,e,t,d,r.style||h.parent.cellStyle,r.wrap?Pd(h.parent.getDisplayText(r),Bd(d,e,t,1<r.colSpan?t+r.colSpan-1:t),r.style,h.parent.cellStyle):1),n=Math.round(n),Hd(d,e,t,n=n<20?20:n),Ah(d,e)<(a=Vd(d,e)))&&Ad(h.parent,d,a,e),i}},up.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},up.prototype.setCopiedInfo=function(r,n){var i=this;if(!this.parent.isEdit){var e,o=new H.Deferred,a=(r.promise=o.promise,this.parent.getActiveSheet()),s=r&&r.range?(t=0===r.range[1]&&r.range[3]===a.colCount-1,l=0===r.range[0]&&r.range[2]===a.rowCount-1,e={range:r.range},t||l||this.parent.notify(Tr,e),e.range):te(a.selectedRange);if(n&&Xd(this.parent,s))this.parent.notify(qa,null);else{if(r&&!r.isPublic&&!r.clipboardData){var t={copiedRange:a.name+"!"+re(s),cancel:!1,action:n?"cut":"copy"};if(this.parent.notify(gt,t),t.cancel)return}var l={sheet:a,indexes:[0,0,a.rowCount-1,a.colCount-1],isFinite:this.parent.scrollSettings.isFinite,promise:new Promise(function(e){e(void 0)})},h=document.getElementsByClassName("e-ss-overlay-active"),d=h.length;!a.isLocalData||r&&r.clipboardData||0!==s[0]||s[2]!==a.rowCount-1||d||(this.parent.showSpinner(),this.parent.notify("updateSheetFromDataSource",l)),this.checkForUncalculatedFormula(s,r&&r.sId?r.sId:a.id),l.promise.then(function(){var e,t;0<d?(t={clientY:h[0].offsetTop,isImage:!0},i.parent.notify(us,t),e={clientX:h[0].offsetLeft,isImage:!0},i.parent.notify(fs,e),i.copiedShapeInfo={sId:r&&r.sId?r.sId:a.id,sheetIdx:a.index,isCut:n,pictureElem:h[0],copiedRange:re([t.clientY,e.clientX,t.clientY,e.clientX]),height:h[0].offsetHeight,width:h[0].offsetWidth,chartInfo:i.getChartElemInfo(h[0])},h[0].classList.contains("e-datavisualization-chart")||(t=window.getComputedStyle(h[0]).backgroundImage.slice(5,-2),i.addImgToClipboard(t,i.copiedShapeInfo.height,i.copiedShapeInfo.width)),i.hidePaste(!0),n&&(h[0].classList.contains("e-datavisualization-chart")?i.parent.deleteChart(i.copiedShapeInfo.chartInfo.id):i.parent.notify(ms,{id:i.copiedShapeInfo.pictureElem.id,sheetIdx:i.copiedShapeInfo.sId,range:i.copiedShapeInfo.copiedRange}))):r&&r.clipboardData||(i.copiedInfo&&i.clearCopiedInfo(),i.copiedInfo={range:s,sId:r&&r.sId?r.sId:a.id,isCut:n},i.hidePaste(!0),r.isFromUpdateAction||i.initCopyIndicator(),ee.Browser.isIE||i.getClipboardEle().select(),r&&r.invokeCopy&&document.execCommand(n?"cut":"copy"),i.parent.hideSpinner()),ee.Browser.isIE&&i.setExternalCells(r,n),o.resolve()}),r&&r.clipboardData&&(this.setExternalCells(r,n),this.getClipboardEle().setAttribute("aria-label",a.selectedRange+" "+this.parent.serviceLocator.getService(T).getConstant(n?"Cut":"Copy")))}}},up.prototype.imageToCanvas=function(i,o,a){return new Promise(function(t){var e=document.createElement("canvas"),r=e.getContext("2d"),n=new Image;n.src=i,n.crossOrigin="anonymous",n.onload=function(){e.width=a,e.height=o,r.drawImage(n,0,0,a,o),e.toBlob(function(e){t(e)},"image/png")}})},up.prototype.addImgToClipboard=function(i,o,a){return dp(this,void 0,void 0,function(){var t,r,n;return pp(this,function(e){switch(e.label){case 0:return r=window.navigator,[4,this.imageToCanvas(i,o,a)];case 1:return n=e.sent(),[4,r.clipboard.write([new ClipboardItem(((t={})[n.type]=n,t))])];case 2:return e.sent(),[2]}})})},up.prototype.checkForUncalculatedFormula=function(e,t){for(var r,n=Ii(this.parent,t),i=ae(this.parent,n),o=e[0];o<=e[2];o++)for(var a=e[1];a<=e[3];a++)(r=se(o,a,i,null,!0)).formula&&ee.isUndefined(r.value)&&this.parent.notify(ie,{action:"refreshCalculate",value:r.formula,rowIndex:o,colIndex:a,isFormula:Q(r.formula),sheetIndex:n})},up.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},up.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())},up.prototype.removeIndicator=function(e){e&&(e=e.getElementsByClassName("e-copy-indicator")[0])&&ee.detach(e)},up.prototype.initCopyIndicator=function(){var e;this.copiedInfo&&this.parent.getActiveSheet().id===this.copiedInfo.sId&&((e=this.parent.createElement("div",{className:"e-copy-indicator"})).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"})),id(this.parent,e,this.copiedInfo.range,"e-copy-indicator"))},up.prototype.showDialog=function(){var r=this;this.parent.serviceLocator.getService(O).show({header:"Spreadsheet",height:205,width:340,isModal:!0,showCloseIcon:!0,content:this.parent.serviceLocator.getService(T).getConstant("PasteAlert"),beforeOpen:function(e){var t={dialogName:"PasteDialog",element:e.element,target:e.target,cancel:e.cancel};r.parent.trigger("dialogBeforeOpen",t),t.cancel&&(e.cancel=!0)}})},up.prototype.hidePaste=function(e){this.parent.getActiveSheet().isProtected&&(e=!1),this.parent.notify(Io,[{items:[this.parent.element.id+"_paste"],enable:e||!1}])},up.prototype.setExternalCells=function(e,t){var n,r="",i=this.parent.getActiveSheet(),o=ne(this.copiedInfo.range),a=0===o[1]&&o[3]===i.colCount-1,s=0===o[0]&&o[2]===i.rowCount-1,l='<html><body><table class="e-spreadsheet" xmlns="http://www.w3.org/1999/xhtml" style="border-collapse:collapse;"';(a||s)&&(l=l+(' aria-rowcount="'+i.usedRange.rowIndex+'" aria-colcount="'+i.usedRange.colIndex)+'" aria-label="'+(a&&s?"Sheet":a?"Row":"Column")+'"'),l+="><tbody>";for(var h=o[0];h<=o[2];h++)if(t||!Fh(i,h)){l+="<tr>";for(var d,p,c,u=o[1];u<=o[3];u++)(c=se(h,u,i,!1,!0)).colSpan<0||c.rowSpan<0||(l+="<td",c.colSpan&&(l+=' colspan="'+c.colSpan+'"'),c.rowSpan&&(l+=' rowspan="'+c.rowSpan+'"'),c.style?(n="",c.style.whiteSpace||(n+="white-space:"+(c.wrap?"normal":"nowrap")+";"),c.style.verticalAlign||(n+="vertical-align:bottom;"),Object.keys(c.style).forEach(function(e){var t=c.style[""+e],r=(e.includes("border")&&t.includes("dashed")&&t.includes("1px")&&(t=t.replace("1px","thin")),e.match(/[A-Z]/));n+=("backgroundColor"===e?"background":r?e.replace(r[0],"-"+r[0].toLowerCase()):e)+":"+("backgroundColor"===e||"color"===e?c.style[""+e].slice(0,7):t)+";"}),l+=n.includes('"')?" style='"+n+"'":' style="'+n+'"'):l+=' style="white-space:'+(c.wrap?"normal":"nowrap")+';vertical-align:bottom;"',ee.isNullOrUndefined(c.value)?l+="></td>":(p=c.value,c.format&&"General"!==c.format&&(l=(l+=c.value.toString().includes('"')?" cell-value='"+p+"'":' cell-value="'+c.value+'"')+(c.format.includes('"')?" num-format='"+c.format+"'":' num-format="'+c.format+'"'),d={formattedText:p,value:p,format:c.format,cell:c,rowIndex:h,colIndex:u,dataUpdate:!0},this.parent.notify(St,d),p=d.formattedText),r+=p,l=(l+=">")+p+"</td>"),r+=u===o[3]?"":"\t");l+="</tr>",r+=h===o[2]?"":"\n"}l+="</tbody></table></body></html>",ee.Browser.isIE?(window.clipboardData.setData("text",r),t&&window.clipboardData.setData("isInternalCut",r)):(e.clipboardData.setData("text/html",l),e.clipboardData.setData("text/plain",r),t&&e.clipboardData.setData("isInternalCut",r),e.preventDefault())},up.prototype.getExternalCells=function(e){function t(){setTimeout(function(){i.getClipboardEle().innerHTML=""},0)}var r,n,i=this,o=[],a={model:o},s=this.parent.createElement("span");if(ee.Browser.isIE)n=window.clipboardData.getData("text");else{if(r=e.clipboardData.getData("text/html"),n=e.clipboardData.getData("text/plain"),this.copiedInfo&&r.includes('<table class="e-spreadsheet"')){var l,h=!1;if(this.copiedInfo.isCut||(d={sheetIdx:Ii(this.parent,this.copiedInfo.sId)},this.parent.notify(Oa,d),d.isFiltered&&(l=this.copiedInfo.range,h=(d=d.filterRange)[0]===l[0]&&d[1]===l[1]&&d[2]===l[2]&&d[3]===l[3])),!h)return t(),{internal:!0}}s.innerHTML=r}if(s.querySelector("table"))this.generateCells(s,a);else if(s.querySelector("img")){var d=s.querySelector("img");this.parent.notify(gs,{options:{src:d.src,height:d.height,width:d.width},isPublic:!0})}else if(n){var p,c,u,f=[],g=(r&&(c=[].slice.call(s.children)),this.cellStyle(s));a.colCount=1,n.split("\n").forEach(function(t){p=null,r&&(u=c.filter(function(e){return e.textContent&&e.textContent.replace(/(\r\n|\n|\r|\s)/gm," ").trim()===t.trim()})[0])&&(p=g(u),c.splice(c.indexOf(u),1)),t.split("\t").forEach(function(e,t){(e||p)&&(f[t]={},!p||p.whiteSpace&&"nowrap"!==p.whiteSpace&&(f[t].wrap=!0,delete p.whiteSpace,!Object.keys(p).length)||(f[t].style=p),e)&&(Q(e)?f[t].formula=e:f[t].value=li(e.trim(),!0))}),o.push({cells:f}),a.colCount=Math.max(a.colCount,f.length),f=[]}),a.rowCount=o.length,a.usedRowIndex=o.length-1,a.usedColIndex=a.colCount-1}else if(e.clipboardData.files&&e.clipboardData.files[0]&&e.clipboardData.files[0].type.includes("image"))return t(),{file:e.clipboardData.files[0]};return t(),a},up.prototype.generateCells=function(e,t){for(var r,n,i,o,a,s,l=t.model,h=e.querySelector("table"),d=h.classList.contains("e-spreadsheet"),p={},c={},u=(t.usedRowIndex=h.rows.length-1,t.rowCount=h.rows.length,d&&(t.selection=h.getAttribute("aria-label"),t.selection)&&("Sheet"===t.selection?(t.usedRowIndex=Number(h.getAttribute("aria-rowcount")),t.usedColIndex=Number(h.getAttribute("aria-colcount"))):"Row"===t.selection?t.usedColIndex=Number(h.getAttribute("aria-colcount")):t.usedRowIndex=Number(h.getAttribute("aria-rowcount"))),[]),f=(ee.isNullOrUndefined(h)||ee.isNullOrUndefined(h.getAttribute("style"))||(u.push(h.getAttribute("style")),this.generateStyles(u,p)),this.cellStyle(e,d)),g=1,m=(t.colCount=1,[]),v=0,y=t.usedRowIndex;v<=y;v++){r=h.rows[v],ee.isNullOrUndefined(r.getAttribute("style"))||(m.push(r.getAttribute("style")),this.generateStyles(m,c)),l[v]||(l[v]={cells:[]}),n=l[v].cells,t.colCount=Math.max(t.colCount,r.cells.length);for(var C=t.usedColIndex<r.cells.length?t.usedColIndex:r.cells.length-1,b=0;b<=C;b++){if(o=r.cells[b],n[b=n[s=b]?this.getNewIndex(n,b):b]={},i=f(o,c,p),o.textContent=o.textContent.replace(/(\r\n|\n|\r)/gm,""),o.textContent=o.textContent.replace(/\s+/g," "),i.whiteSpace&&"nowrap"!==i.whiteSpace&&(n[b].wrap=!0,delete i.whiteSpace),Object.keys(i).length&&(i.border&&(["borderBottom","borderTop","borderLeft","borderRight"].forEach(function(e){i[""+e]=i.border}),delete i.border),n[b].style=i),o.textContent&&(n[b].value=li(o.textContent.trim(),!0)),o.getAttribute(a=d?"num-format":"number-format")&&(n[b].format=o.getAttribute(a),n[b].value)&&o.getAttribute("cell-value")&&(n[b].value=li(o.getAttribute("cell-value").trim(),!0)),o.getAttribute("colspan")&&1<parseInt(o.getAttribute("colspan"),10)&&(n[b].colSpan=parseInt(o.getAttribute("colspan"),10)),o.getAttribute("rowspan")&&1<parseInt(o.getAttribute("rowspan"),10)&&(n[b].rowSpan=parseInt(o.getAttribute("rowspan"),10)),1<n[b].colSpan&&1<n[b].rowSpan)for(var x=void 0,S=v,w=v+n[b].rowSpan;S<w;S++)for(var I=b,E=b+n[b].colSpan;I<E;I++)S===v&&I===b||(x=n[b].style?{style:ee.extend({},n[b].style)}:{},S!==v&&(x.rowSpan=v-S),I!==b&&(x.colSpan=b-I),l[S]||(l[S]={cells:[]}),l[S].cells[I]=x);else if(1<n[b].colSpan)for(S=b+1,w=b+n[b].colSpan;S<w;S++)n[S]={colSpan:b-S,style:ee.extend({},i)};else if(1<n[b].rowSpan)for(S=v+1,w=v+n[b].rowSpan;S<w;S++)l[S]||(l[S]={cells:[]}),l[S].cells[b]={rowSpan:v-S,style:ee.extend({},i)};b=s}g=Math.max(g,n.length)}t.usedColIndex=g-1},up.prototype.getNewIndex=function(e,t){return t=e[t]?this.getNewIndex(e,++t):t},up.prototype.cellStyle=function(e,a){var s=this;if(!a){var l=e.querySelector("style")&&e.querySelector("style").innerHTML,t=Object.keys(this.parent.commonCellStyle);if(t&&t.length&&l)for(var r=((r=l.includes("td")?l.split("td")[1]:l).includes("{")?r.split("{")[1]:r).split("}")[0],h={},n=0;n<t.length;n++){var i=t[n],o=i.match(/[A-Z]/);o&&(i=i.replace(o[0],"-"+o[0].toLowerCase())),-1<r.indexOf(i)&&(h[t[n]]=r.split(i+":")[1].split(";")[0].trim())}}return function(e,t,r){var n={};if(a){if(!e.getAttribute("style"))return n;i=e.getAttribute("style").split(";")}else{var i=[],o=(l&&e.className&&l.includes(e.classList[0])&&(o=l.split(e.classList[0]),i.push(o[o.length-1].split("{")[1].split("}")[0])),[].slice.call(e.querySelectorAll("*")));o.unshift(e),o.forEach(function(e){e.getAttribute("style")&&i.push(e.getAttribute("style")),"B"===e.tagName&&i.push("font-weight:bold"),"I"===e.tagName&&i.push("font-style:italic"),"U"===e.tagName&&i.push("text-decoration:underline")}),Object.assign(n,r,t,h)}return i.length&&s.generateStyles(i,n),e.querySelector("S")&&(n.textDecoration=n.textDecoration?"underline line-through":"line-through"),n.textDecoration&&-1===["underline","line-through","underline line-through","none"].indexOf(n.textDecoration)&&(n.textDecoration="none"),n.textAlign&&-1===["left","center","right"].indexOf(n.textAlign)&&(n.textAlign="left"),n.verticalAlign&&-1===["bottom","middle","top"].indexOf(n.verticalAlign)&&(n.verticalAlign="bottom"),n.fontSize&&(n.fontSize=Math.round(parseFloat(-1<n.fontSize.indexOf("px")?(.75*parseFloat(n.fontSize)).toString():-1<n.fontSize.indexOf("em")?(16*parseFloat(n.fontSize)/1.3333).toString():n.fontSize))+"pt"),n.fontWeight&&-1===["bold","normal"].indexOf(n.fontWeight)&&(n.fontWeight="599"<n.fontWeight?"bold":"normal"),n}},up.prototype.generateStyles=function(e,r){var n,i,o,a,s,l=["font-family","vertical-align","text-align","text-indent","color","white-space","font-weight","font-style","font-size","text-decoration","background","background-color"],h=["fontFamily","verticalAlign","textAlign","textIndent","color","whiteSpace","fontWeight","fontStyle","fontSize","textDecoration","backgroundColor","backgroundColor"],d=["border-bottom","border-top","border-right","border-left","border"],p=["borderBottom","borderTop","borderRight","borderLeft","border"];e&&e.length&&e.forEach(function(e){e.split(";").forEach(function(e){if(i=e.split(":")[0].trim(),-1<(n=l.indexOf(i)))i=e.split(":")[1].trim(),r[h[n]]=i;else if(-1<(n=d.indexOf(i))){if("none"===(i=e.split(":")[1].trim()))i=void 0;else if(i.includes("pt")){o=i.split("pt"),a=o[0].split(" ");for(var t=0;t<a.length;t++)if(s=parseFloat(a[t])){a.splice(t,1),a.unshift((s/.75).toFixed(2)+"px"),o[0]=a.join(" ");break}i=o.join("")}r[p[n]]=i}})})},up.prototype.refreshOnInsertDelete=function(e){var t,r;this.copiedInfo&&e.model.id===this.copiedInfo.sId&&(t=this.copiedInfo.range,e.isInsert?"Column"===e.modelType?e.start<=t[3]&&(e.start<=t[1]?(r=e.end-e.start+1,t[1]+=r,t[3]+=r):t[3]=t[1]+(e.start-t[1]-1),this.performAction()):e.start<=t[2]&&(e.start<=t[0]?(r=e.end-e.start+1,t[0]+=r,t[2]+=r):t[2]=t[1]+(e.start-t[1]-1),this.performAction()):this.clearCopiedInfo())},up.prototype.performAction=function(){var e=this.getCopyIndicator();e&&id(this.parent,e,this.copiedInfo.range,"e-copy-indicator")},up.prototype.getClipboardEle=function(){return this.parent.element.getElementsByClassName("e-clipboard")[0]},up.prototype.getCopyIndicator=function(){return this.parent.element.getElementsByClassName("e-copy-indicator")[0]},up.prototype.getModuleName=function(){return"clipboard"},up.prototype.destroy=function(){this.removeEventListener();var e=this.getClipboardEle();ee.detach(e),this.parent=null},up);function up(e){this.parent=e,this.init(),this.addEventListener()}l.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},l.prototype.addEventListener=function(){ee.Browser.isDevice&&"safari"===ee.Browser.info.name&&(ee.Browser.isIos||ee.Browser.isIos7)?ee.EventHandler.add(this.parent.element,"touchend",this.tapHandler,this):ee.EventHandler.add(this.parent.element,"dblclick",this.dblClickHandler,this),this.parent.on(ro,this.mouseDownHandler,this),this.parent.on(lo,this.keyUpHandler,this),this.parent.on(ho,this.keyDownHandler,this),this.parent.on(io,this.performEditOperation,this),this.parent.on(is,this.initiateCurPosition,this),this.parent.on(as,this.updateFormulaBarValue,this),this.parent.on(ss,this.addressHandler,this),this.parent.on(ls,this.initiateRefSelection,this),this.parent.on(hs,this.refSelectionRender,this),this.parent.on(_t,this.checkUniqueRange,this),this.parent.on(qt,this.reApplyFormula,this),this.parent.on($o,this.sheetChangeHandler,this),this.parent.on(qa,this.readOnlyAlertHandler,this)},l.prototype.removeEventListener=function(){ee.Browser.isDevice&&"safari"===ee.Browser.info.name&&(ee.Browser.isIos||ee.Browser.isIos7)?ee.EventHandler.remove(this.parent.element,"touchend",this.tapHandler):ee.EventHandler.remove(this.parent.element,"dblclick",this.dblClickHandler),this.parent.isDestroyed||(this.parent.off(ro,this.mouseDownHandler),this.parent.off(lo,this.keyUpHandler),this.parent.off(ho,this.keyDownHandler),this.parent.off(io,this.performEditOperation),this.parent.off(is,this.initiateCurPosition),this.parent.off(as,this.updateFormulaBarValue),this.parent.off(ss,this.addressHandler),this.parent.off(ls,this.initiateRefSelection),this.parent.off(hs,this.refSelectionRender),this.parent.off(_t,this.checkUniqueRange),this.parent.off(qt,this.reApplyFormula),this.parent.off($o,this.sheetChangeHandler),this.parent.off(qa,this.readOnlyAlertHandler))},l.prototype.getModuleName=function(){return"edit"},l.prototype.performEditOperation=function(e){var t,r;switch(e.action){case"renderEditor":this.renderEditor(),e.initLoad&&ee.Browser.isDevice&&"safari"===ee.Browser.info.name&&(ee.Browser.isIos||ee.Browser.isIos7)&&(t=this.parent.createElement("div",{className:"e-ss-focus-edit",attrs:{contentEditable:"true",inputmode:"none",tabindex:"-1"}}),(r=this.parent.element.querySelector(".e-sheet-panel"))&&(r.style.position="relative",r.appendChild(t)),this.parent.element.onfocus=function(){ce(t)});break;case"refreshEditor":this.refreshEditor(e.value,e.refreshFormulaBar,e.refreshEditorElem,e.isAppend,e.trigEvent),e.refreshCurPos&&this.setCursorPosition();break;case"startEdit":this.isEdit&&(this.parent.notify(eo,r={isEdit:!1}),!r.isEdit)||(this.isNewValueEdit=e.isNewValueEdit,this.startEdit(e.address,e.value,e.refreshCurPos));break;case"endEdit":this.isEdit&&this.endEdit(e.refreshFormulaBar,null,e.isPublic);break;case"cancelEdit":this.isEdit&&this.cancelEdit(e.refreshFormulaBar);break;case"getCurrentEditValue":e.editedValue=this.editCellData.value,void 0!==e.endFormulaRef&&(e.endFormulaRef=this.endFormulaRef);break;case"refreshDependentCellValue":this.refreshDependentCellValue(e.rowIdx,e.colIdx,e.sheetIdx);break;case"getElement":e.element=this.getEditElement(this.parent.getActiveSheet());break;case"focusEditorElem":this.editorElem.focus();break;case"getCurrentEditSheetIdx":e.sheetIndex=this.editCellData.sheetIndex}},l.prototype.keyUpHandler=function(e){var t;this.isEdit&&(t=this.getEditElement(this.parent.getActiveSheet()),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&&!vd(e.keyCode))&&this.refreshEditor(t.textContent,this.isCellEdit),!Q(this.editCellData.value,!0)||e&&(16===e.keyCode||17===e.keyCode||e.shiftKey&&vd(e.keyCode))||(this.updateFormulaReference(t),this.endFormulaRef&&(e=this.getCurPosition(),t=["+","-","*","/",this.parent.listSeparator,"(","=","&",":"],e.end)&&-1<t.indexOf(this.editCellData.value[e.end-1])&&(this.endFormulaRef=!1)))},l.prototype.updateFormulaReference=function(e){var t=this.parent.element.querySelector(".e-formularef-indicator"),t=(t&&t.parentElement.removeChild(t),this.editCellData.value!==e.textContent&&this.refreshEditor(e.textContent,!0),this.editCellData.sheetIndex),e=this.editCellData.value;this.parent.notify(ns,{range:e,formulaSheetIdx:t})},l.prototype.keyDownHandler=function(e){var t,r,n,i,o,a,s,l,h=e.target,d=e.keyCode,p=this.parent.getActiveSheet(),c=W(p.activeCell),u=se(c[0],c[1],p,!1,!0);if(!ee.closest(h,".e-spreadsheet .e-dialog"))if(!p.isProtected||h.classList.contains("e-sheet-rename")||!Mn(u,de(p,c[1]))||h.classList.contains("e-formula-bar")&&!h.disabled)if(this.isEdit){var f,g=this.getEditElement(p),m=Q(this.editCellData.value,!0);if((this.isCellEdit||m&&this.editCellData.value!==g.textContent&&16!==e.keyCode&&17!==e.keyCode)&&(c[1]<this.parent.frozenColCount(p)&&(!p.frozenRows||c[0]>=this.parent.frozenRowCount(p))&&g&&"auto"!==g.style.height&&Ld(g.textContent,u.style,this.parent.cellStyle)>parseInt(g.style.maxWidth,10)&&(g.style.height="auto"),Ld(g.textContent,u.style,this.parent.cellStyle)>parseInt(g.style.maxWidth,10)-5&&(g.style.height="auto"),c[0]<this.parent.frozenRowCount(p)&&g&&!g.style.overflow&&Ld(g.textContent,u.style,this.parent.cellStyle)>parseInt(g.style.maxWidth,10)&&(g.style.overflow="auto"),e.shiftKey&&(!e.shiftKey||vd(e.keyCode))||this.refreshEditor(g.textContent,this.isCellEdit,!1,!1,!1)),!e.altKey)switch(d){case this.keyCodes.ENTER:ee.Browser.isWindows&&e.preventDefault(),this.isAltEnter&&(f=g.textContent)&&-1<f.indexOf("\n")&&(zi(this.parent.getActiveSheet().selectedRange,!0,this.parent,!0),this.refreshEditor(g.textContent,this.isCellEdit,!1,!1,!1),this.isAltEnter=!1),m&&((f=this.parent.element.querySelector(".e-formularef-indicator"))&&f.parentElement.removeChild(f),ae(this.parent,this.editCellData.sheetIndex).id!==p.id)&&this.parent.goTo(this.editCellData.fullAddr),this.endEdit(!1,e);break;case this.keyCodes.TAB:this.hasFormulaSuggSelected()||this.endEdit(!1,e);break;case this.keyCodes.ESC:this.cancelEdit(!0,!0,e)}}else(h.classList.contains("e-spreadsheet")||ee.closest(h,".e-sheet-panel"))&&(13===d&&"true"===h.contentEditable&&e.preventDefault(),c=String.fromCharCode(d),u=d>=this.keyCodes.FIRSTALPHABET&&d<=this.keyCodes.LASTALPHABET||c.toLowerCase()!==c.toUpperCase()&&!(112<=d&&d<=123),c=d>=this.keyCodes.FIRSTNUMBER&&d<=this.keyCodes.LASTNUMBER,t=d>=this.keyCodes.FIRSTNUMPAD&&d<=this.keyCodes.LASTNUMPAD,r=(r=d>=this.keyCodes.SYMBOLSETONESTART&&d<=this.keyCodes.SYMBOLSETONEEND)||d>=this.keyCodes.SYMBOLSETTWOSTART&&d<=this.keyCodes.SYMBOLSETTWOEND,n=d===this.keyCodes.FIREFOXEQUALPLUS||d===this.keyCodes.FIREFOXMINUS,i=!e.shiftKey&&!e.ctrlKey&&!e.metaKey&&d===this.keyCodes.F2,o=d===this.keyCodes.BACKSPACE,a=/(Macintosh|MacIntel|MacPPC|Mac68K|Mac|Mac OS|iPod|iPad)/i.test(navigator.userAgent)&&o,s=this.parent.element.querySelector(".e-readonly-alert-dlg"),l=this.parent.element.getElementsByClassName("e-ss-overlay-active"),(!e.ctrlKey&&!e.metaKey&&!e.altKey&&(!e.shiftKey&&d===this.keyCodes.SPACE||u||c||t||r||"mozilla"===ee.Browser.info.name&&n)||i||o)&&(i&&(this.isNewValueEdit=!1),s||(Xd(this.parent)&&0===l.length?this.parent.notify(qa,null):l.length?o&&!a&&this.editingHandler("delete"):(this.startEdit(null,null,!0,!0),ce(this.getEditElement(p))))),d!==this.keyCodes.DELETE&&!a||(u=p.isProtected&&jd(this.parent),s)||(u?this.parent.notify(_a,null):Xd(this.parent)&&0===l.length?this.parent.notify(qa,null):(this.editingHandler("delete"),this.parent.notify(Pt,null))));else!(d>=this.keyCodes.FIRSTALPHABET&&d<=this.keyCodes.LASTALPHABET||d>=this.keyCodes.FIRSTNUMBER&&d<=this.keyCodes.LASTNUMBER||d===this.keyCodes.DELETE||d===this.keyCodes.BACKSPACE||d===this.keyCodes.SPACE||d>=this.keyCodes.FIRSTNUMPAD&&d<=this.keyCodes.LASTNUMPAD||d>=this.keyCodes.SYMBOLSETONESTART&&d<=this.keyCodes.SYMBOLSETONEEND||219<=d&&d<=222)&&(e.shiftKey||e.ctrlKey||e.metaKey||d!==this.keyCodes.F2)||67===d||89===d||90===d||p.protectSettings.insertLink&&75===d||e.altKey&&(65===d||70===d||72===d||77===d||78===d||87===d)||e.ctrlKey||70===e.keyCode||this.parent.element.querySelector(".e-editAlert-dlg")||h.parentElement.classList.contains("e-unprotectpwd-content")||h.parentElement.classList.contains("e-password-content")||h.parentElement.classList.contains("e-sheet-password-content")||h.parentElement.classList.contains("e-unprotectsheetpwd-content")||h.parentElement.classList.contains("e-reenterpwd-content")||this.parent.notify(_a,null)},l.prototype.renderEditor=function(){if(!this.editorElem||!ee.select("#"+this.parent.element.id+"_edit",this.parent.element)){var e=this.parent.createElement("div",{id:this.parent.element.id+"_edit",className:"e-spreadsheet-edit",attrs:{contentEditable:"true",role:"textbox",spellcheck:"false","aria-multiline":"true"}}),t=(this.parent.element.getElementsByClassName("e-spreadsheet-edit")[0]&&this.parent.element.getElementsByClassName("e-spreadsheet-edit")[0].remove(),this.parent.element.querySelector(".e-sheet-content"));if(!t)return;t.appendChild(e),this.editorElem=e}this.parent.notify(oo,{action:"renderAutoComplete"})},l.prototype.refreshEditor=function(e,t,r,n,i,o){void 0===i&&(i=!0),n?e=this.editCellData.value=this.editCellData.value+e:this.editCellData.value=o||e;n=this.getEditElement(this.parent.getActiveSheet());r&&n&&(n.textContent=e),t&&this.parent.notify(ao,{action:"refreshFormulabar",value:e}),this.parent.isEdit&&n&&i&&this.editCellData.value===n.textContent&&this.triggerEvent("cellEditing").cancel&&this.cancelEdit(!1,!1,null,!0)},l.prototype.startEdit=function(e,t,r,n){void 0===r&&(r=!0),this.parent.showSheetTabs&&this.parent.element.querySelector(".e-add-sheet-tab").setAttribute("disabled","true");var i=this.parent.getActiveSheet(),o=W(i.activeCell),i=se(o[0],o[1],i,!1,!0);if("Manual"===this.parent.calculationMode&&Q(i.formula)&&(this.editCellData.prevFormulaValue=i.value),Od(this.parent,o[0],o[1],this.parent.activeSheetIndex)){var o=this.parent.getCell(o[0],o[1]),a=!1,s=o.innerHTML;if(a=o&&-1<s.indexOf("<")&&-1<s.indexOf(">")&&-1<s.indexOf("input")?!0:a)return}o=this.updateEditCellDetail(e,t);this.initiateEditor(r,o),this.positionEditor(),this.parent.isEdit=this.isEdit=!0,this.parent.notify(Ao,null),this.parent.notify(Io,[{enable:!1}]),i.formula&&!n&&this.parent.notify(ns,{range:i.formula,formulaSheetIdx:this.editCellData.sheetIndex})},l.prototype.setCursorPosition=function(){var e,t,r=this.getEditElement(this.parent.getActiveSheet()),n=r.textContent.length;n&&(e=document.getSelection(),(t=document.createRange()).setStart(r.firstChild,n),t.collapse(!0),e.removeAllRanges(),e.addRange(t)),r.focus()},l.prototype.hasFormulaSuggSelected=function(){var e=document.getElementById(this.parent.element.id+"_ac_popup");return e&&"visible"===e.style.visibility&&0<e.querySelectorAll(".e-item-focus").length},l.prototype.editingHandler=function(e){var t,r=document.getElementsByClassName("e-ss-overlay-active"),n=r.length;if("delete"===e)if(0<n)r[0].classList.contains("e-datavisualization-chart")?this.parent.notify(vs,{id:r[0].id,sheetIdx:this.parent.activeSheetIndex+1}):this.parent.notify(ms,{id:r[0].id,sheetIdx:this.parent.activeSheetIndex+1});else{var i=this.parent.getActiveSheet(),n=P(e=i.selectedRange),e=re(n[0]>n[2]||n[1]>n[3]?ne(n):n),r={address:i.name+"!"+e,cancel:!1};if(this.parent.notify(gt,{action:"cellDelete",eventArgs:r}),r.cancel)return;n=te(e=y(r.address)),_d(this.parent,n,this.parent.activeSheetIndex),this.parent.notify(dn,{}),0===n[0]&&0===n[1]&&n[2]>=i.usedRange.rowIndex&&n[3]>=i.usedRange.colIndex&&this.parent.setUsedRange(0,0,i,!1,!0);r={cellIdx:n,isUnique:!1};if(this.checkUniqueRange(r),r.isUnique&&(p=se((n=te(this.uniqueColl))[0],n[1],this.parent.getActiveSheet()))&&p.value&&(t=-1<p.value.toString().indexOf("#SPILL!")),r.isUnique&&this.uniqueColl.split(":")[0]===e.split(":")[0]){for(var o=te(this.uniqueColl),a=o[0];a<=o[2];a++)for(var s=o[1];s<=o[3];s++)this.parent.updateCell({value:"",formula:""},re([a,s]));this.parent.notify(zt,null),this.uniqueColl=""}else if(r.isUnique){var l=te(this.uniqueColl);if("#SPILL!"===se(l[0],l[1],i).value){for(var h=!1,s=l[0];s<=l[2];s++)for(var d=l[1];d<=l[3];d++){var p=se(s,d,i);s===l[0]&&d===l[1]?h=!1:p&&!ee.isNullOrUndefined(p.value)&&""!==p.value&&(h=!0)}h||this.reApplyFormula()}}r.isUnique?this.parent.notify(le,{action:"cellDelete",eventArgs:{address:i.name+"!"+e,isSpill:t}}):this.parent.notify(le,{action:"cellDelete",eventArgs:{address:i.name+"!"+e}})}},l.prototype.getCurPosition=function(){var e,t={},r=window.getSelection();return r&&r.focusNode&&r.focusNode.classList&&r.focusNode.classList.contains("e-formula-bar-panel")?(e=r.focusNode.getElementsByClassName("e-formula-bar e-css")[0]).value===this.editCellData.value&&(t.start=e.selectionStart,t.end=e.selectionEnd):this.getEditElement(this.parent.getActiveSheet()).textContent===this.editCellData.value&&(t.start=r.anchorOffset,t.end=r.focusOffset,t.end<t.start)&&(e=t.start,t.start=t.end,t.end=e),t},l.prototype.mouseDownHandler=function(e){if(!ee.closest(e.target,".e-findtool-dlg")&&!ee.closest(e.target,".e-validation-error-dlg")&&this.isEdit){var t=this.getCurPosition(),r=void 0,n=void 0,t=(t.start&&(this.curStartPos=r=t.start),t.end&&(this.curEndPos=n=t.end),e.target),i=this.parent.getActiveSheet(),o=this.parent.element.querySelector(".e-formularef-indicator"),a=(this.isCellEdit=t.classList.contains("e-spreadsheet-edit"),Q(this.editCellData.value,!0)),s=this.getEditElement(i),l=["+","-","*","/",this.parent.listSeparator,"(","=","&",":"];if(t.classList.contains("e-cell")||t.classList.contains("e-header-cell")||t.classList.contains("e-selectall")||ee.closest(t,".e-toolbar-item.e-active")||ee.closest(t,".e-table"))if(this.isAltEnter&&(d=s.textContent)&&-1<d.indexOf("\n")&&(this.isAltEnter=!1,zi(this.parent.getActiveSheet().selectedRange,!0,this.parent),this.refreshEditor(s.textContent,this.isCellEdit)),!a||this.endFormulaRef)this.endFormulaRef=!1,this.endEdit(!1,e);else{var h,d=W(i.activeCell),d=se(d[0],d[1],i),p=document.activeElement.classList.contains("e-formula-bar")?document.activeElement.value:s.textContent;if(this.editCellData.value===p)if(r===n){if(this.editCellData.sheetIndex!==B(this.parent,i.name)){if(-1===l.indexOf(p.substring(r-1,r)))return o&&o.parentElement.removeChild(o),this.parent.goTo(this.editCellData.fullAddr),void this.endEdit(!1,e)}else if(-1===l.indexOf(s.textContent.substring(r-1,r)))return o&&o.parentElement.removeChild(o),void this.endEdit(!1,e)}else-1!==l.indexOf(p.substring(r-1,r))&&Fn(p.substring(r,n))&&p.indexOf(":")!==n&&(this.editCellData.value=p.substring(0,r)+p.substring(n,p.length));d&&(a=d.formula&&(Q(d.formula)||this.editCellData.value&&0===this.editCellData.value.toString().indexOf("=")))&&this.parent.isEdit&&(h=n,this.editCellData.value.length===h?")"!==this.editCellData.value.substring(this.editCellData.value.length-1)&&!oe(this.editCellData.value.substring(this.editCellData.value.length-1))||(o&&o.parentElement.removeChild(o),this.endEdit(!1,e)):this.editCellData.value===p&&-1===l.indexOf(p.substring(h-1,h))&&(o&&o.parentElement.removeChild(o),this.endEdit(!1,e)))}else!a||this.editCellData.value!==s.textContent||s.textContent.indexOf("(")===s.textContent.length-1||this.isCellEdit||t.classList.contains("e-formula-bar")||-1!==l.indexOf(this.editCellData.value.substring(r-1,r))||ae(this.parent,this.editCellData.sheetIndex).id===i.id&&(h=window.getSelection().focusOffset,-1===l.indexOf(s.textContent.substring(h-1,h)))&&(o&&o.parentElement.removeChild(o),this.parent.goTo(this.editCellData.fullAddr),this.isEdit)&&this.endEdit(!1,e)}},l.prototype.tapHandler=function(t){var r=this;this.tapedTwice?(t.preventDefault(),this.dblClickHandler(t)):(this.tapedTwice=!0,setTimeout(function(){var e;r.tapedTwice=!1,!r.parent.isEdit&&t.target.classList.contains("e-cell")&&(e=r.parent.element.querySelector(".e-ss-focus-edit"))&&ce(e)},300))},l.prototype.dblClickHandler=function(e){var t,r,n,e=e.target;ee.closest(e,".e-datavisualization-chart")||e.classList.contains("e-ss-overlay")||!(e.classList.contains("e-active-cell")||e.classList.contains("e-cell")||e.classList.contains("e-wrap-content")||ee.closest(e,".e-sheet-content")||e.classList.contains("e-table"))||(ti(n=se((r=W((t=this.parent.getActiveSheet()).activeCell))[0],r[1],t,!1,!0),de(t,r[1]),Nh(t,r[0]))?this.parent.notify(qa,null):t.isProtected&&Mn(n,de(t,r[1]))?this.parent.notify(_a,null):this.isEdit?e.classList.contains("e-spreadsheet-edit")||Q(this.editCellData.value)&&(n=this.editCellData.fullAddr.substring(0,this.editCellData.fullAddr.lastIndexOf("!")),this.parent.getActiveSheet().name!==n)||this.endEdit():(this.isNewValueEdit=!1,this.startEdit(),ce(this.getEditElement(t))))},l.prototype.updateEditCellDetail=function(e,t){var r,n,i,o,a,s,l=ee.isNullOrUndefined(this.editCellData.sheetIndex)?e&&-1<e.lastIndexOf("!")?B(this.parent,Ei(e)):this.parent.activeSheetIndex:this.editCellData.sheetIndex;return this.editCellData.addr?Q(this.editCellData.value,!0)&&(r=ae(this.parent,l),this.isNewValueEdit=!1):(r=ae(this.parent,l),e=e?y(e):r.activeCell),e&&((1<(a=se(i=(s=te(e))[0],o=s[1],r,!1,!0)).colSpan||1<a.rowSpan)&&(Zn(a={sheet:r,cell:a,rowIdx:i,colIdx:o}),i=a.rowIdx,o=a.colIdx,n=a.isMergedHiddenCell),a=this.parent.getCell(i,o),s=nd(r,s,this.parent.frozenRowCount(r),this.parent.frozenColCount(r),this.parent.viewport.beforeFreezeHeight,this.parent.viewport.beforeFreezeWidth,this.parent.sheetModule.colGroupWidth),this.editCellData={addr:e,fullAddr:Di(this.parent,l)+"!"+e,rowIndex:i,colIndex:o,sheetIndex:l,element:a,value:t||"",position:s,prevFormulaValue:this.editCellData.prevFormulaValue}),n},l.prototype.initiateEditor=function(o,e){var a=this;pi(this.parent,this.editCellData.fullAddr,!1,e).then(function(e){a.parent&&e.forEach(function(t){function e(){var e={cell:t,value:t?t.value:"",showFormattedText:a.editCellData.showFormattedText};a.parent.notify(Lt,e),r=t?t.formula||e.value:"",a.editCellData.oldValue=r}e();var r,n,i=a.triggerEvent("cellEdit",null,r);i.cancel?a.cancelEdit(!0,!1,null,!0):(i.showFormattedText&&(a.editCellData.showFormattedText=!0,e()),a.editCellData.value?r=a.editCellData.value:a.editCellData.value=r,a.isNewValueEdit?(n=r,r=""):a.isNewValueEdit=!0,ee.isUndefined(r)||a.refreshEditor(r,!1,!0,!1,!1,n),o&&a.setCursorPosition())})})},l.prototype.positionEditor=function(e){var t,r,n,i,o,a,s,l,h,d,p,c,u,f,g,m,v=this.editCellData.element,y={isEdit:!1};this.parent.notify(eo,y),y.isEdit&&ee.isNullOrUndefined(v)&&(y=this.parent.getCell(this.editCellData.rowIndex,this.editCellData.colIndex),this.editCellData.element=v=y),v&&(v.classList.add("e-ss-edited"),y=this.parent.getActiveSheet(),t=se(this.editCellData.rowIndex,this.editCellData.colIndex,y,!1,!0),r=this.editCellData.position.left+1,n=this.editCellData.position.top+1,o={range:[this.editCellData.rowIndex,this.editCellData.colIndex,this.editCellData.rowIndex,this.editCellData.colIndex]},this.parent.notify(Dr,o),i=Ah(y,o.range[0],o.range[2])-3,o=Uh(y,o.range[1],o.range[3])-3,m=(u=this.parent.getMainContent()).parentElement,d=void 0,p=this.parent.frozenColCount(y),s=a=void 0,l=this.parent.frozenRowCount(y),h=void 0,this.editCellData.colIndex<p?(d=Math.abs(this.parent.getRowHeaderContent().getBoundingClientRect()[this.parent.enableRtl?"left":"right"]-v.getBoundingClientRect()[this.parent.enableRtl?"right":"left"])-1,this.editCellData.rowIndex<l?"2"===this.parent.getRowHeaderContent().style.zIndex&&(a="3"):Ld(t.value,t.style,this.parent.cellStyle)>d&&(h=!0)):(d=m.offsetWidth-(r-u.scrollLeft)-28-this.parent.sheetModule.getRowHeaderWidth(y),p=v.getBoundingClientRect(),u=m.getBoundingClientRect(),m=this.parent.enableRtl?p.left:p.right,u=this.parent.enableRtl?u.left:u.right,c=this.parent.getScrollElement(),g=this.parent.sheetModule.getScrollSize(),this.parent.enableRtl?m<u+g&&(c.scrollLeft-=p.width):u-g<m&&(c.scrollLeft+=p.width)),u=!(s=this.editCellData.rowIndex<l?!0:s)&&(t&&t.wrap||v&&e||h)?"auto;":i+"px;",f="display:block;top:"+n+"px;"+(this.parent.enableRtl?"right:":"left:")+r+"px;min-width:"+o+"px;max-width:"+(t&&t.wrap?o:d)+"px;height:"+u+(t&&t.wrap?"width:"+o+"px;":"")+"min-height:"+i+"px;"+(a?"z-index: "+a+";":"")+(s&&(t&&!t.wrap||v&&e)&&(Ld(t.value,t.style,this.parent.cellStyle)>d||v&&e)?"overflow: auto;":""),v.style.cssText.split(";").forEach(function(e){e.includes("border")||(f+=e+";")}),(g=this.getEditElement(y,!0)).setAttribute("style",f),Ld(g.textContent,t.style,this.parent.cellStyle)>d&&(g.style.height="auto"),(m=this.parent.element.querySelector(".e-active-cell"))&&(m.style.height=4+i+"px"),v.classList.contains("e-right-align")?g.classList.add("e-right-align"):v.classList.contains("e-center-align")&&g.classList.add("e-center-align"))},l.prototype.updateEditedValue=function(t,r,n,e){var i,o,a,s,l,h,d,p,c,u=this,f=this.editCellData.oldValue,g=(r&&(this.editCellData.value=r),this.editCellData.value),m=(this.parent.notify(ya,{args:{action:"beforeCellSave",eventArgs:{address:this.editCellData.addr}}}),!0);this.parent.allowDataValidation&&(a=se((o=te((i=this.parent.getActiveSheet()).activeCell))[0],o[1],i,!1,!0),s=de(i,o[1]),a.validation||Hh(s,o[0],o[1]))&&(s=this.editCellData.value||this.getEditElement(i).innerText,l=this.parent.activeSheetIndex,l={value:s,range:"string"==typeof this.editCellData.addr?te(this.editCellData.addr):this.editCellData.addr,sheetIdx:l,isEdit:!0,td:null,isValid:!0},p=Object.assign({},a,{value:s}),Vi(o[0],o[1],i,p),this.parent.notify(dr,l),Vi(o[0],o[1],i,a),(m=l.isValid)?Q(s)||!a.format?this.editCellData.value||(this.editCellData.value=s):(s!==l.value||!this.editCellData.value&&l.value)&&(this.editCellData.value=l.value):this.isCellEdit=!0),!e&&Q(this.editCellData.value)&&(h={formula:this.editCellData.value},this.parent.notify(mn,h),h.isInvalid)&&(m=!(this.isCellEdit=!0),p=this.parent.serviceLocator.getService(T),(c=this.parent.serviceLocator.getService(O)).show({width:400,isModal:!0,showCloseIcon:!0,target:this.parent.element,cssClass:"e-validation-error-dlg",content:p.getConstant("CellReferenceTypoError")+"<br>"+h.formula,beforeOpen:function(){return u.editCellData.element.focus()},buttons:[{buttonModel:{content:p.getConstant("Yes"),isPrimary:!0},click:function(){d=!0,c.hide()}},{buttonModel:{content:p.getConstant("No")},click:function(){return c.hide()}}],close:function(){var e;d?(r=u.editCellData.value=h.formula,u.updateCell(f,t,r,g,n),u.parent.notify(ao,{action:"refreshFormulabar",value:h.formula})):(e=u.getEditElement(u.parent.getActiveSheet())).innerText&&window.getSelection().selectAllChildren(e)}},!1)),m?this.updateCell(f,t,r,g,n):n&&n.preventDefault()},l.prototype.updateCell=function(e,t,r,n,i){var o=e?e.toString().toUpperCase():"",a=this.parent.getActiveSheet(),s=(!e&&0!==e||(e=e.toString()),this.editCellData.value),s=e!==(s=s&&s.toString())||"Manual"===this.parent.calculationMode&&Q(o);if(s||-1<o.indexOf("=NOW()")||-1<o.indexOf("NOW()")||-1<o.indexOf("=RAND()")||-1<o.indexOf("RAND()")||-1<o.indexOf("=RANDBETWEEN(")||-1<o.indexOf("RANDBETWEEN(")){var l=te(a.activeCell),h=(e&&-1<e.indexOf("=UNIQUE(")&&""===this.editCellData.value&&this.parent.notify(zt,null),{cellIdx:l,isUnique:!1}),h=(this.checkUniqueRange(h),h.isUnique);if(h&&""!==e&&""===this.editCellData.value)if(-1===se((m=te(this.uniqueColl))[0],m[1],a).value.toString().indexOf("#SPILL!"))return;e&&-1<e.indexOf("UNIQUE")&&this.editCellData.value&&-1<this.editCellData.value.toString().indexOf("UNIQUE")&&h&&this.updateUniqueRange("");var d={action:"updateCellValue",address:this.editCellData.addr,value:this.editCellData.value,skipCellFormat:this.editCellData.showFormattedText},p=(this.parent.notify(Ot,d),se(l[0],l[1],a,!0)),c=void 0,u="#CIRCULARREF!"===(c=ee.isNullOrUndefined(p)?c:p.value.toString());if(-1<this.formulaErrorStrings.indexOf(c)||u){var f,g=void 0;if(!i||(f=i.target,g=["e-toolbar-item","e-tab-wrap","e-text-wrap","e-tab-text","e-caret"].some(function(e){return f.classList.contains(e)})&&ee.closest(f,".e-ribbon")||["e-scroller","e-main-panel","e-autofill"].some(function(e){return f.classList.contains(e)})?g:this.showFormulaAlertDlg(c,u))||i.preventDefault(),!g)return delete p.value,delete p.formula,this.parent.notify(Wt,{cellRef:a.activeCell,clearFormulaInfo:!0}),void(Q(o)?this.parent.updateCellInfo({formula:o},a.activeCell):e&&this.parent.updateCellInfo({value:e},a.activeCell));p.value="0"}var m,c=void 0,u=(d.isFormulaDependent&&(c=$n(this.parent,this.parent.viewport)),se(l[0],l[1],a,!0)),g=this.getRefreshNodeArgs(u,this.editCellData.element,this.editCellData.rowIndex,this.editCellData.colIndex);if(this.editCellData.value=g.value,this.parent.notify(Wr,{cell:null,rIdx:this.editCellData.rowIndex,cIdx:this.editCellData.colIndex,viewportIndexes:c}),a.conditionalFormats&&a.conditionalFormats.length&&this.parent.notify(Br,{indexes:[this.editCellData.rowIndex,this.editCellData.colIndex],isAction:!0,refreshAll:d.isFormulaDependent,isEdit:!0}),u&&u.formula&&(this.editCellData.formula=u.formula),u&&u.wrap&&this.parent.notify(ir,{range:l,wrap:!0,sheet:a}),t&&this.parent.refreshNode(this.editCellData.element,g),u&&u.hyperlink&&this.parent.serviceLocator.getService("cell").refreshRange(l),h)if(-1<se((m=te(this.uniqueColl))[0],m[1],a).value.toString().indexOf("#SPILL!")&&(this.isSpill=!0),""!==e&&""===this.editCellData.value||this.editCellData.formula&&1<this.editCellData.formula.length&&e!==this.editCellData.formula){for(var v=!1,y=m[0];y<=m[2];y++)for(var C=m[1];C<=m[3];C++){var b=se(y,C,a);y===m[0]&&C===m[1]?v=!1:b&&!ee.isNullOrUndefined(b.value)&&""!==b.value&&(v=!0)}v||this.reApplyFormula()}else this.updateUniqueRange(n)}this.triggerEvent("cellSave",i,r,!s),this.resetEditState(),this.focusElement(i)},l.prototype.checkUniqueRange=function(e){var t={range:[]},r=(this.parent.notify(jt,t),t.range);e.sheetName||(e.sheetName=this.parent.getActiveSheet().name);for(var n=0;n<r.length;n++)if(r[n].substring(0,r[n].lastIndexOf("!"))===e.sheetName)for(var i=te(r[n]),o=i[0];o<=i[2];o++)for(var a,s,l,h=i[1];h<=i[3];h++)e.cellIdx[0]===o&&e.cellIdx[1]===h&&(e.isUnique=!0,this.uniqueCell=!0,a=""!==this.uniqueColl?te(this.uniqueColl):[0,0,0,0],s=te(r[n]),a[0]===s[0]&&a[1]===s[1]?((l=[a[0],s[1],a[0],s[1]])[2]=(a[2]>s[2]?a:s)[2],l[3]=(a[3]>s[3]?a:s)[3],this.uniqueColl=re(l),e.uniqueRange=re(l)):(this.uniqueColl=r[n],e.uniqueRange=r[n]))},l.prototype.updateUniqueRange=function(e){var t=te(this.uniqueColl),r=!1;"#SPILL!"!==se(t[0],t[1],this.parent.getActiveSheet()).value&&(r=!0);for(var n=t[0];n<=t[2];n++)for(var i=t[1];i<=t[3];i++)r&&(n===t[0]&&i===t[1]?this.parent.updateCell({value:"#SPILL!"},re([n,i])):re([n,i]).split(":")[0]===this.editCellData.addr?this.parent.updateCell({value:e},re([n,i])):this.parent.updateCell({value:""},re([n,i])))},l.prototype.reApplyFormula=function(){for(var e=te(this.uniqueColl),t=se(e[0],e[1],this.parent.getActiveSheet()),r=(this.parent.updateCell({value:""},re([e[0],e[1]])),this.parent.sheets),n=t.formula,i=0;i<r.length;i++)-1<n.indexOf(r[i].name)&&(n=n.replace(r[i].name,"!"+i));this.parent.notify(ie,{action:"computeExpression",formula:n}),this.uniqueCell=!1,""!==this.uniqueActCell&&(this.editCellData.value=this.uniqueActCell,this.uniqueActCell="")},l.prototype.refreshDependentCellValue=function(e,t,r){if(e&&t&&(t--,(this.editCellData.rowIndex!==--e||this.editCellData.colIndex!==t)&&this.parent.activeSheetIndex===r||this.uniqueCell&&this.parent.activeSheetIndex===r)){var r=ae(this.parent,r),n=void 0;if(n=he(r,e)||pe(r,t)?n:this.parent.getCell(e,t)){if(n.parentElement){var i=n.parentElement.getAttribute("aria-rowindex");if(i&&Number(i)-1!==e)return}i=se(e,t,r),r=te(r.activeCell),r=(r[0]===e&&r[1]===t&&(this.uniqueActCell=i.value),this.getRefreshNodeArgs(i,n,e,t));this.parent.refreshNode(n,r)}}},l.prototype.getRefreshNodeArgs=function(e,t,r,n){e={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(St,e),e},l.prototype.endEdit=function(e,t,r){(e=void 0===e?!1:e)&&this.refreshEditor(this.editCellData.oldValue,!1,!0,!1,!1);var n,e=this.triggerEvent("beforeCellSave");e.cancel?this.parent.isEdit&&t&&t.preventDefault():(e.value&&-1<e.value.toString().indexOf("\n")&&(n=se(this.editCellData.rowIndex,this.editCellData.colIndex,this.parent.getActiveSheet()),zi(this.parent.getActiveSheet().selectedRange,!n||!1!==n.wrap,this.parent),this.refreshEditor(e.value,this.isCellEdit,!1,!1,!1)),this.updateEditedValue(!0,e.value,t,r))},l.prototype.cancelEdit=function(e,t,r,n){void 0===t&&(t=!0),this.refreshEditor(this.editCellData.oldValue,e=void 0===e?!0:e,!1,!1,!1),n||(t?this.triggerEvent("cellSave",r,void 0,!0):this.triggerEvent("cellEdited")),this.resetEditState(),this.focusElement()},l.prototype.focusElement=function(e){e&&9===e.keyCode&&document.activeElement.classList.contains("e-formula-bar")?(e=this.parent.element.querySelector(".e-formula-bar-panel "+(e.shiftKey?".e-insert-function":".e-combobox")))&&ce(e):ce(this.parent.element),this.parent.notify(Io,[{enable:!0}])},l.prototype.triggerEvent=function(e,t,r,n){var i=this.parent.getActiveSheet(),o=se(this.editCellData.rowIndex,this.editCellData.colIndex,i),r={element:this.editCellData.element,value:r||this.editCellData.value,oldValue:this.editCellData.oldValue,address:this.editCellData.fullAddr,displayText:this.parent.getDisplayText(o),previousFormulaValue:this.editCellData.prevFormulaValue},a=(r.address&&(a={cellIdx:te(r.address),isUnique:!1},this.checkUniqueRange(a),a.isUnique)&&(r.isSpill=this.isSpill),(r.value&&r.value.toString())!==(r.oldValue||0===r.oldValue?r.oldValue.toString():r.oldValue));if(a||"Manual"===this.parent.calculationMode&&!n&&Q(r.value)){if("cellSave"!==e&&(r.cancel=!1),"beforeCellSave"===e){this.parent.notify(gt,{eventArgs:r,action:"cellSave",preventAction:!0});o=Q(r.value)?{formula:r.value}:{value:r.value};if(_n(this.parent,i,{cell:o,rowIdx:this.editCellData.rowIndex,colIdx:this.editCellData.colIndex,eventOnly:!0}))return this.cancelEdit(!1,!1,null,!0),r.cancel=!0,r}this.parent.trigger(e,r),"cellSave"===e&&(this.parent.trigger("cellEdited",r),this.editCellData.formula?r.formula=this.editCellData.formula:a||(r.formula=r.value),r.originalEvent=t,this.parent.notify(le,{eventArgs:r,action:"cellSave"}))}else"beforeCellSave"!==e&&("cellSave"===e?this.parent.trigger("cellEdited",r):this.parent.trigger(e,r));return r},l.prototype.altEnter=function(){this.positionEditor(!0);var e=window.getSelection(),t=e.anchorNode,r=document.createRange(),n=3===t.nodeType?e.anchorOffset:t.textContent.length,i=(0===n&&0<t.textContent.length&&(n=t.textContent.length),t.textContent),o=i.slice(0,n),i=i.slice(n)||" ";t.textContent=o+"\n"+i,r=document.createRange(),3===t.nodeType?(r.setStart(t,n+1),r.setEnd(t,n+1)):1===t.nodeType&&(r.setStart(t.firstChild,n+1),r.setEnd(t.firstChild,n+1)),e.removeAllRanges(),e.addRange(r)},l.prototype.resetEditState=function(e){(e=void 0===e?!0:e)&&(!Q((e=this.getEditElement(this.parent.getActiveSheet())).textContent)&&""!==e.textContent||this.parent.notify(os,null),this.editCellData.element)&&(this.editCellData.element.classList.remove("e-ss-edited"),this.editorElem.textContent="",e===this.editorElem?(this.editorElem.removeAttribute("style"),this.editorElem.classList.remove("e-right-align")):ee.detach(e)),this.editCellData={},this.parent.isEdit=this.isEdit=!1,this.isCellEdit=!0,this.parent.notify(oo,{action:"endEdit"}),this.parent.showSheetTabs&&!this.parent.isProtected&&(e=this.parent.element.querySelector(".e-add-sheet-tab"))&&e.removeAttribute("disabled")},l.prototype.refSelectionRender=function(){var e=this.getEditElement(this.parent.getActiveSheet());e&&Q(e.textContent)&&this.parent.notify(ns,{range:e.textContent,formulaSheetIdx:this.editCellData.sheetIndex})},l.prototype.initiateRefSelection=function(){var e=this.editCellData.fullAddr.substring(0,this.editCellData.fullAddr.lastIndexOf("!")),t=this.editCellData.value;this.parent.getActiveSheet().name===e&&Q(this.editCellData.value,!0)&&(this.startEdit(this.editCellData.addr,t,!1),this.parent.notify(ns,{range:this.editCellData.value,formulaSheetIdx:this.editCellData.sheetIndex}),this.getEditElement(this.parent.getActiveSheet()).textContent=t),this.initiateCurPosition()},l.prototype.addressHandler=function(e){var t,r,n,i,o,a,s=this.parent.serviceLocator.getService(O).dialogInstance;s&&s.element&&s.element.classList.contains("e-validation-error-dlg")?e.isAlertDlgOpen=!0:(this.curStartPos||((s=this.getCurPosition()).start&&(this.curStartPos=s.start),s.end&&(this.curEndPos=s.end)),s=e.range,t=this.editCellData.sheetIndex,r=this.getEditElement(this.parent.getActiveSheet()),this.parent.activeSheetIndex!==t&&(s="'"+this.parent.getActiveSheet().name+"'!"+s),n=this.editCellData.value,e.isSelect?this.parent.notify(ns,{range:n+s,formulaSheetIdx:t}):this.parent.activeSheetIndex===t&&(o=i=void 0,a=document.activeElement.classList.contains("e-formula-bar")?document.activeElement.value:r.textContent,e.isMouseDown&&a!==n?(i=a.substring(0,this.curEndPos)+this.parent.listSeparator,o=a.substring(this.curEndPos),this.refreshEditor(i+o,!1,!0),this.parent.notify(ns,{range:r.textContent,formulaSheetIdx:t}),this.curEndPos+=this.parent.listSeparator.length,this.curStartPos=this.curEndPos,i+=s):(i=n.substring(0,this.curStartPos)+s,o=n.substring(this.curStartPos)),r.textContent=i+o,this.curEndPos=i.length))},l.prototype.updateFormulaBarValue=function(e){var t,r,n,i=this.editCellData.value,o=this.parent.getActiveSheet().selectedRange.split(" "),a=fe(P(a=o[o.length-1]))?a.split(":")[0]:a,s=this.parent.element.querySelector(".e-formula-bar");i&&Q(i,!0)&&(t=this.editCellData.fullAddr.substring(0,this.editCellData.fullAddr.lastIndexOf("!")),r=void((t=this.parent.getActiveSheet().name!==t)&&(a="'"+this.parent.getActiveSheet().name+"'!"+a)),n=void 0,t&&e.isMouseDown&&1<o.length&&e.formulaBarVal&&e.formulaBarVal!==i?(r=e.formulaBarVal.substring(0,this.curEndPos)+this.parent.listSeparator,n=e.formulaBarVal.substring(this.curEndPos),this.refreshEditor(r+n,!0),this.curEndPos+=this.parent.listSeparator.length,this.curStartPos=this.curEndPos,r+=a):(r=i.substring(0,this.curStartPos)+a,n=i.substring(this.curStartPos)),s.value=r+n,this.curEndPos=r.length)},l.prototype.setFormulaBarCurPosition=function(e,t,r){e.setSelectionRange&&(e.focus(),e.selectionStart=t,e.selectionEnd=t,e.setSelectionRange(t,r))},l.prototype.initiateCurPosition=function(e){void 0===e&&(e={isCellEdit:!1});var t,r,n=this.getEditElement(this.parent.getActiveSheet(),!0);e.isCellEdit?(e=this.getCurPosition(),this.endFormulaRef||e.start!==e.end||(this.updateFormulaReference(n),r=["+","-","*","/",this.parent.listSeparator,"(","=","&",":"],e.end&&-1===r.indexOf(this.editCellData.value[e.end-1])&&(this.endFormulaRef=!0))):(r=n.innerText,(e=window.getSelection())&&e.focusNode&&e.focusNode.classList&&e.focusNode.classList.contains("e-formula-bar-panel")?(t=this.parent.element.querySelector(".e-formula-bar"),this.setFormulaBarCurPosition(t,this.curEndPos,this.curEndPos)):(r&&(t=document.createRange(),r.indexOf(")"),r.length,t.setStart(n.childNodes[0],this.curEndPos),t.setEnd(n.childNodes[0],this.curEndPos),e.removeAllRanges(),e.addRange(t)),this.editCellData.sheetIndex!==this.parent.activeSheetIndex&&(r=this.parent.element.querySelector(".e-formula-bar")).value&&(r.value.indexOf(")")===this.curEndPos-1?this.setFormulaBarCurPosition(r,this.curEndPos-1,this.curEndPos-1):this.setFormulaBarCurPosition(r,this.curEndPos,this.curEndPos))))},l.prototype.getEditElement=function(e,t){if(!this.isEdit&&!t||!e.frozenRows&&!e.frozenColumns)return this.editorElem;var r=this.parent.frozenRowCount(e),n=this.parent.frozenColCount(e),e=W(e.activeCell),i=void 0;if(e[0]<r&&e[1]<n)i=this.parent.getSelectAllContent();else if(e[0]<r)i=this.parent.getColumnHeaderContent();else{if(!(e[1]<n))return this.editorElem;i=this.parent.getRowHeaderContent()}r=i.getElementsByClassName("e-spreadsheet-edit")[0];return r=!r&&t?i.appendChild(this.editorElem.cloneNode()):r},l.prototype.sheetChangeHandler=function(){this.isEdit||(this.editCellData.value=null)},l.prototype.showFormulaAlertDlg=function(e,r){var n,i,o=this,t=this.parent.serviceLocator.getService(T),a=this.parent.serviceLocator.getService("dialog"),e=this.getFormulaErrorKey(e),s=t.getConstant(e),e=a.dialogInstance;return e&&e.visible&&e.element.classList.contains("e-circularref-dlg")||a.show({width:400,isModal:!0,showCloseIcon:!0,target:this.parent.element,cssClass:"e-validation-error-dlg e-circularref-dlg",content:s,beforeOpen:function(e){if(r){var t=o.parent.getActiveSheet(),t={dialogName:"CircularReferenceDialog",element:e.element,target:e.target,cancel:e.cancel,cellAddress:t.name+"!"+t.activeCell,content:s};if(o.parent.trigger("dialogBeforeOpen",t),t.cancel)return e.cancel=i=!0,void a.hide(!0);t.content!==s&&(a.dialogInstance.content=t.content,a.dialogInstance.dataBind())}0<window.getSelection().rangeCount&&(e=window.getSelection().getRangeAt(0),n=e.endOffset)},buttons:[{buttonModel:{content:t.getConstant("Ok"),isPrimary:!0},click:function(){return a.hide()}}],close:function(){var e,t,r;i||((e=o.getEditElement(o.parent.getActiveSheet())).childElementCount&&(t=e.textContent,n=t.length,e.textContent=t),t=document.getSelection(),(r=document.createRange()).setStart(e.firstChild,n),r.collapse(!0),t.removeAllRanges(),t.addRange(r),e.focus())}},!1),i},l.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},l.prototype.readOnlyAlertHandler=function(){var e,r=this,n=this.parent.serviceLocator.getService(T),i=this.parent.serviceLocator.getService("dialog"),t=this.parent.element.querySelector(".e-find-dlg");ee.isNullOrUndefined(t)||(e=ee.getComponent(t,"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,Xh(function(){i.destroyDialog()})),i.dialogInstance.content=t.content,ce(r.parent.element)},close:function(){ee.isNullOrUndefined(t)||(i.dialogInstance=e),ce(r.parent.element)}})};var fp=l;function l(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()}h.prototype.addEventListener=function(){this.parent.on(to,this.init,this),this.parent.on(ro,this.mouseDownHandler,this),this.parent.on(mo,this.virtualContentLoadedHandler,this),this.parent.on(vo,this.cellNavigateHandler,this),this.parent.on(No,this.selectRange,this),this.parent.on(Go,this.rowHeightChanged,this),this.parent.on(Yo,this.colWidthChanged,this),this.parent.on(Ya,this.protectHandler,this),this.parent.on(ns,this.initiateFormulaSelection,this),this.parent.on(os,this.clearBorder,this),this.parent.on(us,this.getRowIdxFromClientY,this),this.parent.on(fs,this.getColIdxFromClientX,this),this.parent.on(bn,this.getRowIdxFromClientY,this),this.parent.on(xn,this.getColIdxFromClientX,this),this.parent.on(Ss,this.chartBorderHandler,this),this.parent.on(Bs,this.isTouchSelectionStarted,this),this.parent.on(Ro,this.selectionByKeydown,this)},h.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(to,this.init),this.parent.off(ro,this.mouseDownHandler),this.parent.off(mo,this.virtualContentLoadedHandler),this.parent.off(vo,this.cellNavigateHandler),this.parent.off(No,this.selectRange),this.parent.off(Go,this.rowHeightChanged),this.parent.off(Yo,this.colWidthChanged),this.parent.off(Ya,this.protectHandler),this.parent.off(ns,this.initiateFormulaSelection),this.parent.off(os,this.clearBorder),this.parent.off(us,this.getRowIdxFromClientY),this.parent.off(fs,this.getColIdxFromClientX),this.parent.off(bn,this.getRowIdxFromClientY),this.parent.off(xn,this.getColIdxFromClientX),this.parent.off(Ss,this.chartBorderHandler),this.parent.off(Bs,this.isTouchSelectionStarted),this.parent.off(Ro,this.selectionByKeydown))},h.prototype.isTouchSelectionStarted=function(e){e.touchSelectionStarted=this.touchSelectionStarted},h.prototype.selectionByKeydown=function(e){this.selectRangeByIdx(e.range,e.e,!1,!1,!1,!1,void 0,!1)},h.prototype.rowHeightChanged=function(a){var s=this;a.threshold&&Xh(function(){var e,t,r,n,i,o;s.parent&&(o=s.parent.getActiveSheet(),(e=s.getActiveCell())&&(o.frozenRows||o.frozenColumns||o.selectedRange.includes(" "))?s.selectRange({address:o.selectedRange}):(i={range:t=ne(te(o.selectedRange)),isActiveCell:!1,skipChecking:!0},e&&(r=W(o.activeCell)[0],s.parent.notify(Tr,i),i.isActiveCell&&(n=1<se(t[0],t[1],o,!1,!0).rowSpan&&t[0]<=a.rowIdx&&t[2]>=a.rowIdx),r===a.rowIdx||n?e.style.height=parseFloat(e.style.height)+a.threshold+"px":r>a.rowIdx&&(e.style.top=parseFloat(e.style.top)+a.threshold+"px")),!(e=s.getSelectionElement())||n||t[0]===t[2]&&t[1]===t[3]||(i=t[0],o=t[2],i<=a.rowIdx&&o>=a.rowIdx&&e?e.style.height=parseFloat(e.style.height)+a.threshold+"px":i>a.rowIdx&&e&&(e.style.top=parseFloat(e.style.top)+a.threshold+"px"))))})},h.prototype.colWidthChanged=function(s){var l=this;s.threshold&&Xh(function(){var e,t,r,n,i,o,a;l.parent&&(o=l.parent.getActiveSheet(),e=l.getActiveCell(),t=l.parent.enableRtl,e&&(o.frozenRows||o.frozenColumns||o.selectedRange.includes(" "))?l.selectRange({address:o.selectedRange}):(a={range:r=ne(te(o.selectedRange)),isActiveCell:!1,skipChecking:!0},e&&(l.parent.notify(Tr,a),n=W(o.activeCell)[1],a.isActiveCell&&(i=1<(a=se(r[0],r[1],o,!1,!0)).rowSpan||1<a.colSpan),n===s.colIdx||i?e.style.width=parseFloat(e.style.width)+s.threshold+"px":n>s.colIdx&&(t?e.style.right=parseFloat(e.style.right)+s.threshold+"px":e.style.left=parseFloat(e.style.left)+s.threshold+"px")),!(e=l.getSelectionElement())||i||r[0]===r[2]&&r[1]===r[3]||(o=r[1],a=r[3],o<=s.colIdx&&a>=s.colIdx&&e?e.style.width=parseFloat(e.style.width)+s.threshold+"px":o>s.colIdx&&e&&(t?e.style.right=parseFloat(e.style.right)+s.threshold+"px":e.style.left=parseFloat(e.style.left)+s.threshold+"px"))))})},h.prototype.selectRange=function(e){e.address="Single"===this.parent.selectionSettings.mode?re(W(e.address)):e.address,this.selectMultiRange(e.address,null,null,e.skipChecking)},h.prototype.init=function(){this.createSelectionElement();var e=this.parent.getActiveSheet(),t=ne(te(e.selectedRange)),r=W(e.activeCell),t=t[0]<=r[0]&&t[2]>=r[0]&&t[1]<=r[1]&&t[3]>=r[1];this.selectMultiRange(e.selectedRange,!0,t)},h.prototype.selectMultiRange=function(e,r,n,i){var o=this,t=this.parent.activeSheetIndex;-1<e.indexOf("!")&&(t=B(this.parent,Ei(e)),e=e.substring(e.lastIndexOf("!")+1)),this.parent.activeSheetIndex===t?e.split(" ").forEach(function(e,t){o.selectRangeByIdx(te(e),{type:"mousedown",ctrlKey:0!==t},null,n,r,i)}):Ri(this.parent,e,this.parent.sheets[t])},h.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)},h.prototype.mouseDownHandler=function(e){var t=this;if(this.isNoteActiveElement=!ee.isNullOrUndefined(document)&&!ee.isNullOrUndefined(document.activeElement)&&"string"==typeof document.activeElement.className&&-1<document.activeElement.className.indexOf("e-addNoteContainer"),!(ee.closest(e.target,".e-scrollbar")||e.target.classList.contains("e-main-panel")||e.target.classList.contains("e-sheet"))){var r={action:"getCurrentEditValue",editedValue:""},n=this.parent.getActiveSheet(),r=(this.parent.notify(io,r),Q(r.editedValue,!0)),i=this.parent.enableNotes&&!ee.isNullOrUndefined(this.parent.spreadsheetNoteModule.noteCellIndexes)?this.parent.spreadsheetNoteModule.noteCellIndexes:W(this.parent.getActiveSheet().activeCell),o=this.parent.getCell(i[0],i[1]);if(!ee.isNullOrUndefined(o)&&null!==o.children&&0<o.children.length&&this.isNoteActiveElement&&o.children[o.children.length-1].classList.contains("e-addNoteIndicator")&&(o=se(i[0],i[1],n),l=!ee.isNullOrUndefined(o)&&o.notes?"editNote":"addNote",a=document.getElementsByClassName("e-addNoteContainer")[0],s=Di(this.parent,this.parent.activeSheetIndex)+"!"+re(i),ee.isNullOrUndefined(a)||ee.isNullOrUndefined(a.value)||"e-addNoteContainer"===e.target.className||!ee.isNullOrUndefined(o)&&!ee.isNullOrUndefined(o.notes)&&o.notes===a.value?"e-addNoteContainer"!==e.target.className&&_n(this.parent,this.parent.getActiveSheet(),{rowIdx:i[0],colIdx:i[1],preventEvt:!0,cell:{isNoteEditable:!1}}):(this.parent.notify(ya,{args:{action:"beforeCellSave",eventArgs:{address:s}}}),_n(this.parent,this.parent.getActiveSheet(),{rowIdx:i[0],colIdx:i[1],preventEvt:!0,cell:{notes:a.value,isNoteEditable:!1}}),o={notes:a.value,address:s},this.parent.notify(le,{eventArgs:o,action:l})),this.parent.spreadsheetNoteModule.isShowNote=null),!this.isNoteTouch&&"e-addNoteContainer"!==e.target.className&&document.getElementsByClassName("e-addNoteContainer")&&0<document.getElementsByClassName("e-addNoteContainer").length&&this.parent.notify(pa,""),this.isNoteTouch&&-1<e.type.indexOf("mouse")&&(this.isNoteTouch=!1),!this.parent.isEdit||r){var i=document.getElementById(this.parent.element.id+"_overlay");if("string"==typeof e.target.className){if(-1<e.target.className.indexOf("e-ss-overlay"))return}else i&&i.classList.remove("e-ss-overlay-active");if(ee.closest(e.target,".e-datavisualization-chart"))return;if(n.isProtected&&!n.protectSettings.selectCells&&!n.protectSettings.selectUnLockedCells)return;if(!ee.closest(e.target,".e-findtool-dlg")&&!ee.closest(e.target,".e-dragfill-ddb")&&this.getSheetElement().contains(e.target)&&!e.target.classList.contains("e-colresize")&&!e.target.classList.contains("e-rowresize")){var a=this.parent.getActiveSheet(),s=this.parent.selectionSettings.mode,o=this.getRowIdxFromClientY({clientY:Cd(e),target:e.target}),l=this.getColIdxFromClientX({clientX:yd(e),target:e.target}),i=W(a.activeCell),n=void 0,h=void 0;if(a.showHeaders&&(p=e.target,a.frozenColumns||a.frozenRows?(h=(c=this.parent.getSelectAllContent().querySelector("thead"))?(this.parent.getColumnHeaderContent().contains(p)||c.contains(p))&&p.classList.contains("e-header-cell"):this.parent.getColumnHeaderContent().contains(p)&&p.classList.contains("e-header-cell"),n=(c=this.parent.getSelectAllContent().querySelector("tbody"))?(this.parent.getRowHeaderContent().contains(p)||c.contains(p))&&p.classList.contains("e-header-cell"):this.parent.getRowHeaderContent().contains(p)&&p.classList.contains("e-header-cell")):(n=this.parent.getRowHeaderContent().contains(e.target),h=this.parent.getColumnHeaderContent().contains(e.target))),3===e.which&&this.isSelected(o,l))return;e.target.classList.contains("e-autofill")&&(this.isautoFillClicked=!0,(c=e.target.parentElement&&e.target.parentElement.querySelector(".e-dragfill-ddb"))&&!c.classList.contains("e-hide")||(this.dAutoFillCell=a.selectedRange));var d,p=te(a.topLeftCell),c=void 0,p=(n?(this.isRowSelected=!0,e.shiftKey&&"Single"!==s||(this.startCell=[o,0]),c=[this.startCell[0],a.frozenColumns?p[1]:0,o,a.colCount-1]):h?(this.isColSelected=!0,e.shiftKey&&"Single"!==s||(this.startCell=[0,l]),c=[a.frozenRows?p[0]:0,this.startCell[1],a.rowCount-1,l]):ee.closest(e.target,".e-select-all-cell")?(this.startCell=[a.frozenRows?p[0]:0,a.frozenColumns?p[1]:0],c=[].concat(this.startCell,[a.rowCount-1,a.colCount-1])):e.target.classList.contains("e-sheet-content")||(e.shiftKey&&"Single"!==s||(this.startCell=[o,l]),this.isautoFillClicked)||ee.closest(e.target,".e-filloption")||(c=[].concat(this.startCell||W(a.activeCell),[o,l])),pd(e)&&!n&&!h&&c&&(p=this.isRowColSelected(c),this.isRowSelected=p.isRowSelected,this.isColSelected=p.isColSelected),e.ctrlKey&&c&&a.selectedRange.includes(re(c))),a=(!p&&"Multiple"===s&&(!ud(e)&&(!pd(e)||pd(e)&&i[0]===o&&i[1]===l)||h||n)?(document.addEventListener(hd().split(" ")[0],this.mouseMoveEvt),ee.Browser.isPointer||(ee.Browser.isIos&&pd(e)&&e.target&&e.target.classList.contains("e-cell")&&e.preventDefault(),document.addEventListener(hd().split(" ")[1],this.mouseMoveEvt,{passive:!1})),this.touchSelectionStarted=!0):this.touchSelectionStarted=!1,ud(e)||(p?this.parent.isEdit&&(d=function(e){ee.EventHandler.remove(document,dd(),d),t.updateFormulaCursorPosition(e)},ee.EventHandler.add(document,dd(),d,this)):ee.EventHandler.add(document,dd(),this.mouseUpHandler,this)),"e-addNoteIndicator"===e.target.className||0<e.target.children.length&&-1<e.target.children[e.target.childElementCount-1].className.indexOf("e-addNoteIndicator"));if(pd(e)&&a&&(s=W(re(c).split(":")[0]),this.parent.notify(la,{rowIndex:s[0],columnIndex:s[1],isNoteEditable:!1}),this.isNoteTouch=!0,this.parent.spreadsheetNoteModule.isNoteVisibleOnTouch=!0),pd(e)&&!h&&!n)return void(this.touchEvt=e);c&&this.selectRangeByIdx(c,e),!this.isNoteTouch&&-1<e.type.indexOf("mouse")&&a&&(o=W(re(c).split(":")[0]),this.parent.notify(la,{rowIndex:o[0],columnIndex:o[1],isNoteEditable:!1}),this.parent.spreadsheetNoteModule.isNoteVisible=!0),this.parent.isMobileView()&&(this.parent.element.classList.add("e-mobile-focused"),this.parent.renderModule.setSheetPanelSize())}}r&&(e.target.classList.contains("e-cell")||e.target.classList.contains("e-wrap-content")||e.target.classList.contains("e-header-cell"))&&this.parent.isEdit&&(c=fe(P((i=(c=this.parent.getActiveSheet().selectedRange).split(" "))[i.length-1]))?i[i.length-1].split(":")[0]:i[i.length-1],this.parent.notify(ss,{range:c,isSelect:!1,isMouseDown:e.ctrlKey}))}},h.prototype.mouseMoveHandler=function(e){var t,r,n,i,o,a,s,l,h,d=this,p=this.parent.getActiveSheet(),c=(cd(e)&&e.preventDefault(),{action:"getCurrentEditValue",editedValue:""}),c=(this.parent.notify(io,c),Q(c.editedValue,!0)),u=this.parent.getMainContent().parentElement,f=this.parent.element.getElementsByClassName("e-scroller")[0],g=u.getBoundingClientRect(),m=this.parent.frozenColCount(p),v=g.left+this.parent.sheetModule.getRowHeaderWidth(p,!1,!0),y=g.right-Qh(),C=g.top,b=g.bottom,g=yd(e),x=Cd(e),S=this.isRowSelected?p.colCount-1:this.getColIdxFromClientX({clientX:g,target:e.target}),w=this.isColSelected?p.rowCount-1:this.getRowIdxFromClientY({clientY:x,target:e.target}),I=(r=e.ctrlKey?te((I=p.selectedRange.split(" "))[I.length-1]):te(p.selectedRange),ee.Browser.isDevice&&((I=screen.availWidth)-40<=y&&(y-=40-(I-y)),!p.showHeaders)&&v<40&&(v+=40-v),{range:[w,S,w,S]});this.parent.notify(Dr,I),I.range[2]===r[2]&&I.range[3]===r[3]&&x<=b&&C<=x&&g<=y&&v<=g||(I=this.parent.frozenRowCount(p),c||(r=W(p.activeCell)),n=b<x&&!this.isColSelected&&w<p.rowCount,i=x<C&&0<=w&&!this.isColSelected&&!!u.scrollTop&&(!I||r[0]>=I),o=y<g&&!this.isRowSelected&&S<p.colCount,a=g<v&&0<=S&&!this.isRowSelected&&!!f.scrollLeft&&(!m||r[1]>=m),this.clearInterval(),n||i||o||a?((i||a)&&(s=w,l=S),(h=function(){if(n||i){if((w=d.getRowIdxFromClientY({clientY:n?b:C}))>=p.rowCount)return void d.clearInterval();u.scrollTop+=(n?1:-1)*kh(p,w)}if(o||a){if((S=d.getColIdxFromClientX({clientX:o?y:v,isFScroll:!0}))>=p.colCount)return void d.clearInterval();f.scrollLeft+=(o?1:-1)*Bh(p,S)}i&&p.frozenRows&&!u.scrollTop||a&&p.frozenColumns&&!f.scrollLeft?(d.selectRangeByIdx([].concat(r[0],r[1],[s,l]),e),d.clearInterval()):d.selectRangeByIdx([].concat(r[0],r[1],[w,S]),e)})(),this.scrollInterval=setInterval(function(){h(),d.clearInterval(),d.scrollInterval=setInterval(h,100)})):(x=[].concat(r[0],r[1],[w,S]),I&&x[0]<I&&x[2]>=I&&u.scrollTop&&(u.scrollTop=0,x[2]=I),m&&x[1]<m&&x[3]>=m&&f.scrollLeft&&(f.scrollLeft=0,x[3]=m),this.isautoFillClicked&&(e.target.classList.contains("e-autofill")&&(this.dAutoFillCell=p.selectedRange),this.parent.notify(qs,g={e:e,indexes:null}),t=x=g.indexes),this.selectRangeByIdx(x,e)),c&&this.parent.isEdit&&!ee.closest(e.target,"#"+this.parent.element.id+"_edit")&&(I=(this.isautoFillClicked?re(t):this.parent.getActiveSheet().selectedRange).split(" "),this.parent.notify(ss,{range:I[I.length-1],isSelect:!1})))},h.prototype.mouseUpHandler=function(e){var t,r=this.getRowIdxFromClientY({clientY:Cd(e),target:e.target}),n=this.getColIdxFromClientX({clientX:yd(e),target:e.target}),i=(this.clearInterval(),!ud(e)||this.isColSelected||this.isRowSelected||this.getRowIdxFromClientY({clientY:Cd(this.touchEvt),target:e.target})!==r||this.getColIdxFromClientX({clientX:yd(this.touchEvt),target:e.target})!==n||this.mouseDownHandler(e),document.removeEventListener(hd().split(" ")[0],this.mouseMoveEvt),ee.Browser.isPointer||document.removeEventListener(hd().split(" ")[1],this.mouseMoveEvt),ee.EventHandler.remove(document,dd(),this.mouseUpHandler),this.parent.getActiveSheet());(i.frozenRows||i.frozenColumns)&&od(this.parent.element,null,"e-cur-selection",!0,!0),this.parent.notify(yo,e),this.isautoFillClicked?(t=te((i=this.parent.getActiveSheet()).selectedRange),this.isColSelected&&t[1]===n||this.isRowSelected&&t[0]===r||((n=e.target.parentElement&&e.target.parentElement.querySelector(".e-dragfill-ddb"))&&!n.classList.contains("e-hide")||(this.dAutoFillCell=i.selectedRange),this.parent.notify(_s,{event:e,dAutoFillCell:this.dAutoFillCell})),this.isautoFillClicked=!1):e.ctrlKey||zd(Fi(this.parent.getActiveSheet()))?this.parent.notify(Ws,null):this.parent.notify(js,null),this.updateFormulaCursorPosition(e)},h.prototype.updateFormulaCursorPosition=function(e){var t;this.parent.isEdit&&(this.parent.notify(io,t={action:"getCurrentEditValue",editedValue:""}),Q(t.editedValue,!0))&&this.parent.notify(is,{isCellEdit:e.target.classList.contains("e-spreadsheet-edit")})},h.prototype.isSelected=function(e,t){for(var r,n=!1,i=this.parent.getActiveSheet().selectedRange.split(" "),o=0;o<i.length;o++)if((r=ne(te(i[o])))[0]<=e&&e<=r[2]&&r[1]<=t&&t<=r[3]){n=!0;break}return n},h.prototype.virtualContentLoadedHandler=function(n){var i,o,a,s=this,l=this.parent.getActiveSheet();l.selectedRange.split(" ").forEach(function(e,t){var r;i=te(e),a=0===i[1]&&i[3]===n.prevRowColCnt.colCount-1,o=0===i[0]&&i[2]===n.prevRowColCnt.rowCount-1,a||o?(i=o&&a?[0,0,l.rowCount-1,l.colCount-1]:o?[0,i[1],l.rowCount-1,i[3]]:[i[0],0,i[2],l.colCount-1],l.frozenRows||l.frozenColumns?s.selectRangeByIdx(i,{type:"mousedown",ctrlKey:0!==t},!1,!1,!1,!1,void 0,!0):s.selectRangeByIdx(i,null,!0,null,null,null,t)):(i=te(e),e=s.parent.viewport.topIndex+s.parent.frozenRowCount(l),r=s.parent.viewport.leftIndex+s.parent.frozenColCount(l),s.highlightHdr(i,0!==t,i[0]>=e||i[2]>=e,i[1]>=r||i[3]>=r))})},h.prototype.clearInterval=function(){this.scrollInterval&&(clearInterval(this.scrollInterval),this.scrollInterval=null)},h.prototype.getScrollLeft=function(){return this.parent.scrollModule?this.parent.scrollModule.prevScroll.scrollLeft:0},h.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))},h.prototype.getColIdxFromClientX=function(e){var t,r,n=this,i=0,o=this.parent.getActiveSheet(),a=0;e.isImage?a=e.clientX:(t=document.getElementById(this.parent.element.id+"_sheet").getBoundingClientRect(),a=this.parent.enableRtl?t.right-this.parent.sheetModule.getRowHeaderWidth(o,!0,!0)-1-e.clientX:e.clientX-(t.left+this.parent.sheetModule.getRowHeaderWidth(o,!0,!0)+1),a+=this.parent.viewport.beforeFreezeWidth,e.target&&(ee.closest(e.target,".e-row-header")||ee.closest(e.target,".e-selectall-container"))&&!this.isScrollableArea(e.clientX,e.target,!0)||!(!this.parent.frozenColCount(o)||a>(t=n.parent.element.querySelector(".e-frozen-column"),parseInt(t.style[n.parent.enableRtl?"right":"left"],10)/n.parent.viewport.scaleX)||e.isFScroll)||(a+=this.getScrollLeft()/this.parent.viewport.scaleX));for(var s=0;;s++)if(r=i+=Bh(o,s,null,!e.isImage)/this.parent.viewport.scaleX,a<(e.isImage?Number(Gd(r).toFixed(2)):r)||this.parent.scrollSettings.isFinite&&s===o.colCount-1)return e.isImage||(e.size=a),e.clientX=s},h.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)},h.prototype.getRowIdxFromClientY=function(e){var t,r,n=0,i=this.parent.getActiveSheet(),o=0;e.isImage?o=e.clientY:(t=document.getElementById(this.parent.element.id+"_sheet"),o=e.clientY+this.parent.viewport.beforeFreezeHeight-(t.getBoundingClientRect().top+(i.showHeaders?31/this.parent.viewport.scaleY:0)),e.target&&ee.closest(e.target,".e-header-panel")&&!this.isScrollableArea(e.clientY,e.target)||(o+=this.parent.getMainContent().parentElement.scrollTop/this.parent.viewport.scaleY));for(var a=0;;a++)if(r=n+=kh(i,a,!e.isImage)/this.parent.viewport.scaleY,o<(e.isImage?Number(Gd(r).toFixed(2)):r)||this.parent.scrollSettings.isFinite&&a===i.rowCount-1)return e.isImage||(e.size=o),e.clientY=a},h.prototype.initFormulaReferenceIndicator=function(e){var t;this.parent.isEdit&&((t=this.parent.createElement("div",{className:"e-formularef-indicator"})).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),id(this.parent,t,e,"e-formularef-indicator"))},h.prototype.isMouseEvent=function(e){return fd(e)||md(e)||gd(e)},h.prototype.selectRangeByIdx=function(e,t,r,n,i,o,a,s){var l=this,h=t&&this.isMouseEvent(t);if(!(t&&t.target&&h&&ee.closest(t.target,"#"+this.parent.element.id+"_edit"))){var d,p,c={action:"getCurrentEditValue",editedValue:"",endFormulaRef:!1},c=(this.parent.notify(io,c),!!this.parent.isEdit&&Q(c.editedValue,!0)&&!c.endFormulaRef),u=t&&t.ctrlKey&&fd(t),f=(u||(d=this.getSelectionElement(t,a)),this.parent.getActiveSheet()),g=te(f.topLeftCell),m=this.parent.element.querySelector(".e-formularef-indicator"),o={range:[].slice.call(e),isActiveCell:!1,skipChecking:o},v=this.isRowColSelected(e),y=(v.isColSelected||v.isRowSelected||this.parent.notify(Tr,o),e!==o.range&&(p=!0),e=o.range,new Promise(function(e){e(void 0)})),C={range:re(e),cancel:!1};if(f.isProtected){var b=se(e[2],e[3],f);if(f.protectSettings.selectUnLockedCells&&!f.protectSettings.selectCells)if(ee.isNullOrUndefined(b)){if(!f.protectSettings.selectCells)return}else{if(!0===b.isLocked||ee.isNullOrUndefined(b.isLocked))return;b=this.parent.element.getElementsByClassName("e-sheet-panel")[0];b&&b.classList.contains("e-protected")&&b.classList.remove("e-protected")}}if(this.parent.trigger("beforeSelect",C),!C.cancel){if(c&&m&&m.parentElement.removeChild(m),this.parent.notify(zs,null),!fe(e)&&!o.isActiveCell||u){if(u){if(void 0===a){b=re(e);if(f.selectedRange.includes(b)&&!c)return b=1<(w=f.selectedRange.split(" ")).length?(w.splice(w.indexOf(b),1),w.join(" ")):f.activeCell+":"+f.activeCell,void this.selectRange({address:b})}d=this.getSelectionElement(t,a)}if(c&&this.parent.isEdit){if(t&&t.target&&(!h||!t.target.classList.contains("e-spreadsheet-edit"))&&this.parent.isEdit){S={range:re(e),isSelect:!0};if(this.parent.notify(ss,S),S.isAlertDlgOpen)return;this.initFormulaReferenceIndicator(e)}}else{var x=void 0,C=(d&&(d.classList.remove("e-hide"),f.frozenRows||f.frozenColumns)&&((t&&t.target||u)&&(x="e-cur-selection",gd(t)&&d.classList.contains("e-cur-selection")?d.classList.add("e-hide"):d.classList.add(x)),!u)&&(this.isColSelected||this.isRowSelected)&&fd(t)&&(od(this.parent.getSelectAllContent(),null,"e-selection"),od(this.parent.getColumnHeaderContent(),null,"e-selection"),od(this.parent.getRowHeaderContent(),null,"e-selection")),this.isColSelected&&this.isRowSelected?void 0:this.getOffset(e[2],e[3]));p&&C&&(C.left={idx:0,size:0}),y=id(this.parent,d,e,x,s,u,u&&!t.target)||y}}else if(d&&(d.classList.contains("e-multi-range")||d.classList.add("e-hide"),f.frozenRows||f.frozenColumns)&&(x=gd(t)?"e-cur-selection":"e-selection",od(this.parent.getSelectAllContent(),null,x,!0),od(this.parent.getColumnHeaderContent(),null,x,!0),od(this.parent.getRowHeaderContent(),null,x,!0)),f.frozenColumns||f.frozenRows||!d||id(this.parent,d,e),c&&t&&t.target&&(!h||!t.target.classList.contains("e-spreadsheet-edit"))&&this.parent.isEdit){var S={range:re(e).split(":")[0],isSelect:!0};if(this.parent.notify(ss,S),S.isAlertDlgOpen)return;this.initFormulaReferenceIndicator(e)}var w,m={action:"getCurrentEditSheetIdx",sheetIndex:null},o=(this.parent.notify(io,m),f.frozenColumns&&0<e[1]&&e[1]===g[1]&&e[3]===f.colCount-1&&(e[1]=0),f.frozenRows&&0<e[0]&&e[0]===g[0]&&e[2]===f.rowCount-1&&(e[0]=0),re(e));t&&t.ctrlKey&&(gd(t)||md(t))&&!c?o=f.selectedRange.slice(0,f.selectedRange.lastIndexOf(" "))+" "+o:-1<a&&((w=f.selectedRange.split(" "))[a]=o,o=w.join(" ")),c||this.isautoFillClicked?i||this.isautoFillClicked||Ri(this.parent,o,f,u):(b=!1,f.selectedRange!==o&&(b=!0),Ri(this.parent,o,f,u),b&&y.then(function(){l.parent&&l.parent.trigger("select",{range:l.parent.getActiveSheet().selectedRange})})),v=this.isRowColSelected(e),this.isRowSelected=v.isRowSelected,this.isColSelected=v.isColSelected,this.highlightHdr(e,t&&t.ctrlKey),r||t&&("mousemove"===t.type||cd(t))||(c?m.sheetIndex===this.parent.getActiveSheet().id-1&&i?this.updateActiveCell((n=!0)?te(f.activeCell):e,i,s):this.parent.isEdit||this.updateActiveCell(n?te(f.activeCell):e,i,s):this.updateActiveCell(n?te(f.activeCell):e,i,s)),ee.isNullOrUndefined(t)&&(t={type:"mousedown"}),c&&i||this.parent.notify(dn,t),u||zd(Fi(this.parent.getActiveSheet()))?this.parent.notify(Ws,null):this.parent.notify(js,{preventAnimation:s}),this.parent.showAggregate&&this.parent.notify(Ja,{}),this.parent.notify(ps,null)}}},h.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}},h.prototype.updateActiveCell=function(e,t,r){var n,i,o=this.parent.getActiveSheet(),a=te(o.topLeftCell),s=(i=(this.isColSelected?a:e)[0],e[1]),a={range:[i,s=this.isRowSelected?a[1]:s].concat([i,s])};this.parent.notify(Dr,a),e!==a.range&&(n=!0),o.activeCell!==G((e=a.range)[0],e[1])||t?(this.previousActiveCell=-1<o.activeCell.indexOf(":")?this.previousActiveCell:o.activeCell,this.parent.setSheetPropertyOnMute(o,"activeCell",G(e[0],e[1])),o.isProtected&&(i=this.parent.element.querySelector(".e-formula-bar"),(s=Mn(se(e[0],e[1],o),de(o,e[1])))&&i&&!i.disabled?i.disabled=!0:!s&&i&&i.disabled&&(i.disabled=!1)),this.getActiveCell()&&(a=this.getOffset(e[2],e[3]),n&&(a.left={idx:0,size:0}),id(this.parent,this.getActiveCell(),e,"e-active-cell",r)),this.parent.notify(Pt,null)):id(this.parent,this.getActiveCell(),e,"e-active-cell",r)},h.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},h.prototype.getSelectionElement=function(e,t){var r,n=this.parent.getActiveSheet();return e&&e.ctrlKey&&!this.parent.isEdit?md(e)||gd(e)?n.frozenColumns||n.frozenRows?(r=this.parent.getMainContent().querySelector(".e-cur-selection"))||(r=this.parent.element.querySelector(".e-multi-range"))&&r.cloneNode():this.parent.getMainContent().querySelector(".e-selection:last-child"):((r=(e=this.parent.getMainContent().getElementsByClassName("e-selection")[0]).cloneNode()).classList.add("e-multi-range"),n.frozenColumns||n.frozenRows?(n.selectedRange.includes(" ")||(e.classList.remove("e-hide"),id(this.parent,e,ne(te(n.selectedRange)),void 0,!1,!0)),!this.parent.getMainContent().querySelector(".e-multi-range")&&e.classList.contains("e-hide")?e:r):(e.classList.remove("e-hide"),this.parent.getMainContent().appendChild(r))):-1<t?(n.frozenRows||n.frozenColumns?this.parent.element.querySelector(".e-sheet"):this.parent.getMainContent()).getElementsByClassName("e-selection")[t]:([].slice.call(this.parent.element.getElementsByClassName("e-multi-range")).forEach(function(e){ee.remove(e)}),this.parent.getMainContent().getElementsByClassName("e-selection")[0])},h.prototype.getActiveCell=function(){return this.parent.getMainContent().getElementsByClassName("e-active-cell")[0]},h.prototype.getSheetElement=function(){return document.getElementById(this.parent.element.id+"_sheet")},h.prototype.highlightHdr=function(e,t,r,n){var i,o,a,s,l,h,d,p,c,u=this,f=(void 0===r&&(r=!0),void 0===n&&(n=!0),this.parent.getActiveSheet());f.showHeaders&&(t||(ee.removeClass(this.getSheetElement().querySelectorAll(".e-highlight"),"e-highlight"),ee.removeClass(this.getSheetElement().querySelectorAll(".e-prev-highlight"),"e-prev-highlight")),(t=this.parent.element.getElementsByClassName("e-select-all-cell")[0])&&ee.removeClass([t],["e-prev-highlight-right","e-prev-highlight-bottom"]),i=[],o=[],a=ne(e),this.isRowSelected&&(a[1]=Y(f,a[1],!0,"columns")),this.isColSelected&&(a[0]=Y(f,a[0],!0)),s=[0,0,0,0],l=[0,0,0,0],h=W(f.topLeftCell),e=function(e,t,r){var n,i,o;e&&a[p]<e?(h[p]=Y(f,h[p],!0,t),(o=Y(f,a[p],!0,t))===h[p]&&(a[p]=o),n=u.parent.hiddenCount(h[p],a[p]-1,t,f),s[p]=a[p]-n-h[p],i=a[c]<e?a[c]:e-1,s[c]=i-u.parent.hiddenCount(a[p],i,t,f)-n-h[p]+1,i=u.parent.viewport[""+r]+e,a[c]>=i&&(l[p]=0,l[p]-=u.parent.hiddenCount(i,i,t,f),l[c]=a[c]-u.parent.hiddenCount(i,a[c],t,f)-i+1)):((i=Y(f,u.parent.viewport[""+r]+e,!0,t))===(o=Y(f,a[p],!0,t))&&(a[p]=i),n=u.parent.hiddenCount(i,a[p]-1,t,f),l[p]=a[p]-n-i,l[c]=a[c]-u.parent.hiddenCount(a[p],a[c],t,f)-n-i+1)},d=function(e,t,r){for(var n=[].slice.call(t.getElementsByClassName("e-header-cell")),i=e[p];i<e[c];i++)n[i]&&r.push(n[i])},r&&(p=0,c=2,e(this.parent.frozenRowCount(f),"rows","topIndex"),f.frozenRows&&(r=this.parent.getSelectAllContent().querySelector("tbody"))&&d(s,r,i),d(l,this.parent.getRowHeaderContent(),i)),n&&(p=1,c=3,e(this.parent.frozenColCount(f),"columns","leftIndex"),f.frozenColumns&&(r=this.parent.getSelectAllContent().querySelector("thead"))&&d(s,r,o),d(l,this.parent.getColumnHeaderContent(),o)),f.isProtected&&!f.protectSettings.selectCells?ee.removeClass([].concat(i,o),"e-highlight"):ee.addClass([].concat(i,o),"e-highlight"),i.length&&i[0].parentElement.previousElementSibling&&i[0].parentElement.previousElementSibling.classList.add("e-prev-highlight"),o.length&&o[0].previousElementSibling&&o[0].previousElementSibling.classList.add("e-prev-highlight"),this.isRowSelected&&this.isColSelected&&(f.isProtected&&!f.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")),t)&&(Y(f,a[0],!0)===Y(f,0,!0)&&t.classList.add("e-prev-highlight-bottom"),Y(f,a[1],!0,"columns")===Y(f,0,!0,"columns"))&&t.classList.add("e-prev-highlight-right")},h.prototype.protectHandler=function(){var e=te(this.parent.getActiveSheet().selectedRange),t=ne(e),r=W(this.parent.getActiveSheet().activeCell),t=t[0]<=r[0]&&t[2]>=r[0]&&t[1]<=r[1]&&t[3]>=r[1];this.selectRangeByIdx(e,null,null,t)},h.prototype.initiateFormulaSelection=function(e){this.processFormulaEditRange(e.range,e.formulaSheetIdx)},h.prototype.processFormulaEditRange=function(e,t){for(var r,n,i=t,o=0,e={formula:e},a=(this.parent.notify(vn,e),e.formulaArr),s=a.length,l=0,h=[["e-vborderright","e-vborderbottom"],["e-pborderright","e-pborderbottom"],["e-cborderright","e-cborderbottom"],["e-gborderright","e-gborderbottom"],["e-oborderright","e-oborderbottom"],["e-bborderright","e-bborderbottom"]],d=(this.clearBorder(),this.parent.getActiveSheet().id-1);o<s&&(n=a[o],!(-1<this.invalidOperators.indexOf(n)));)Fn(n.toUpperCase())&&(n=n.replace(/\$/g,""),0<o&&a[o-1].lastIndexOf("!")===a[o-1].length-1&&(r=a[o-1].substring(1,a[o-1].lastIndexOf("!")-1),i=B(this.parent,r)),":"===a[o+1]&&a[++o+1]&&Fn(a[o+1].toUpperCase())&&(n=n+":"+a[o+1],o++),d===i&&this.updateFormulaEditRange(n,l,h),i=t,l++),o++},h.prototype.updateFormulaEditRange=function(e,t,r){var n=te(e);this.formulaRange[t]=e,this.dStartCell={rowIndex:n[0],colIndex:n[1]},this.dEndCell={rowIndex:n[2],colIndex:n[3]},this.focusBorder(this.dStartCell,this.dEndCell,r[t%6])},h.prototype.chartBorderHandler=function(e){this.focusBorder(e.startcell,e.endcell,e.classes,!0)},h.prototype.focusBorder=function(e,t,r,n){n=!ee.isNullOrUndefined(n)&&n;var i,o=this.parent.getActiveSheet(),e=ne([e.rowIndex,e.colIndex,t.rowIndex,t.colIndex]),t=te(o.topLeftCell),t=this.parent.hiddenCount(t[1],e[3]-1,"columns",o);n&&0<t&&(e[1]-=t,e[3]-=t),o.frozenRows||o.frozenColumns?((t=this.parent.createElement("div",{className:n?"e-range-indicator e-chart-range":"e-range-indicator e-formuala-range"})).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"})),id(this.parent,t,e,"e-range-indicator")):(o=e[0],t=e[1],i=e[2],e=e[3],o&&this.getEleFromRange([o-1,t,o-1,e]).forEach(function(e){e&&(e.classList.add(r[1]),n||e.classList.add("e-formularef-selection"))}),this.getEleFromRange([o,e,i,e]).forEach(function(e){e&&(e.classList.add(r[0]),n||e.classList.add("e-formularef-selection"))}),this.getEleFromRange([i,t,i,e]).forEach(function(e){e&&(e.classList.add(r[1]),n||e.classList.add("e-formularef-selection"))}),t&&this.getEleFromRange([o,t-1,i,t-1]).forEach(function(e){e&&(e.classList.add(r[0]),n||e.classList.add("e-formularef-selection"))}))},h.prototype.getEleFromRange=function(e){var t,r,n,i=e[0],o=e[1],a=e[2],s=e[3],l=[];if(a<i&&(r=i,i=a,a=r),s<o&&(r=o,o=s,s=r),this.parent.scrollSettings.enableVirtualization)for(t=i;t<=a;t++)-1<(n=t)&&(n=this.parent.getRow(n,null))&&(n=n.getElementsByClassName("e-cell"),n=s===o?[n[s]]:this.getRowCells(n,o,s+1),this.merge(l,n));return l},h.prototype.getRowCells=function(e,t,r){for(var n=[];t<r;t++)e[t]&&n.push(e[t]);return n},h.prototype.merge=function(e,t){e&&t&&Array.prototype.push.apply(e,t)},h.prototype.clearBorder=function(){var e=this.parent.getActiveSheet();if(e.frozenColumns||e.frozenRows)[].slice.call(this.parent.element.getElementsByClassName("e-formuala-range")).forEach(function(e){ee.detach(e)});else for(var t=this.parent.element.getElementsByClassName("e-formularef-selection"),r=t.length-1;0<=r;r--)for(var n=t[r],i=["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"],o=0;o<i.length;o++)n.classList.remove(i[o])},h.prototype.getModuleName=function(){return"selection"},h.prototype.destroy=function(){this.removeEventListener(),this.parent=null};var gp=h;function h(e){this.invalidOperators=["%"],this.formulaRange=[],this.isNoteActiveElement=!1,this.isNoteTouch=!1,this.parent=e,this.addEventListener(),this.mouseMoveEvt=this.mouseMoveHandler.bind(this)}vp.prototype.onContentScroll=function(e){var t,r,n,i,o,a,s;this.parent&&(t=this.parent.getMainContent().parentElement,s=e.scrollLeft,t=e.scrollTop||t.scrollTop,r=s&&this.parent.enableRtl?this.initScrollValue-s:s,this.parent.allowAutoFill&&(i=document.querySelector("#"+this.parent.element.id+"_autofilloptionbtn-popup"),a=document.querySelector("#"+this.parent.element.id+"_autofilloptionbtn"),i)&&ee.getComponent(a,"dropdown-btn").toggle(),ee.isNullOrUndefined(s)||this.prevScroll.scrollLeft===r||(i=r>this.prevScroll.scrollLeft,o=this.offset.left.size,this.offset.left=this.getColOffset(r,i,e.skipHidden),e.preventScroll||(this.parent.getColumnHeaderContent().scrollLeft=s,this.parent.getMainContent().scrollLeft=s,e.scrollLeft=s),n={cur:this.offset.left,prev:{idx:this.leftIndex,size:o},increase:i,preventScroll:e.preventScroll},this.updateTopLeftCell(i,!0),this.parent.notify(uo,null),this.parent.notify(co,n),this.updateNoteContainer(),this.parent.scrollSettings.enableVirtualization||!i||this.parent.scrollSettings.isFinite||this.updateNonVirtualCols(),this.leftIndex=n.prev.idx,this.prevScroll.scrollLeft=r),Math.round(this.prevScroll.scrollTop)!==Math.round(t)&&(e.skipRowVirualScroll&&(this.prevScroll.scrollTop=0,this.offset.top={idx:0,size:0}),a=t>this.prevScroll.scrollTop,o=this.offset.top.size,this.offset.top=this.getRowOffset(t,a),n={cur:this.offset.top,prev:{idx:this.topIndex,size:o},increase:a,preventScroll:e.preventScroll},this.updateTopLeftCell(a),e.preventScroll&&this.offset.top.idx<=this.parent.getThreshold("row")?this.offset.top={idx:0,size:0}:e.skipRowVirualScroll?n.prev.idx=n.cur.idx:(this.parent.notify(uo,null),this.parent.notify(po,n),this.updateNoteContainer()),this.parent.scrollSettings.enableVirtualization||!a||this.parent.scrollSettings.isFinite||this.updateNonVirtualRows(),this.topIndex=n.prev.idx,this.prevScroll.scrollTop=t),this.parent.notify(eo,s={isEdit:!1}),s.isEdit&&this.parent.element.querySelector(".e-formula-bar").focus(),this.isKeyScroll=!0)},vp.prototype.updateNoteContainer=function(){document.getElementsByClassName("e-addNoteContainer")&&0<document.getElementsByClassName("e-addNoteContainer").length&&this.parent.notify(da,null)},vp.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)},vp.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"},G(e.rowCount,0)+":"+G(e.rowCount+t-1,e.colCount-1)),this.parent.setSheetPropertyOnMute(e,"rowCount",e.rowCount+t),this.parent.viewport.bottomIndex=e.rowCount-1)},vp.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"},G(0,e.colCount)+":"+G(e.rowCount-1,e.colCount+t-1)),this.parent.setSheetPropertyOnMute(e,"colCount",e.colCount+t),this.parent.viewport.rightIndex=e.colCount-1)},vp.prototype.updateTopLeftCell=function(e,t){var r=this.parent.getActiveSheet(),n=this.offset.top.idx,i=this.offset.left.idx;e||(n=Y(r,n+(e=this.parent.frozenRowCount(r)),!0)-e,i=Y(r,i+(e=this.parent.frozenColCount(r)),!0,"columns")-e),t?this.parent.updateTopLeftCell(null,i,"row"):this.parent.updateTopLeftCell(n,null,"col")},vp.prototype.getRowOffset=function(e,t){var r,n=this.offset.top.size,i=this.parent.getActiveSheet(),o=t?this.offset.top.idx+1:this.offset.top.idx?this.offset.top.idx-1:0,a=this.parent.frozenRowCount(i),s=this.parent.scrollSettings.isFinite?i.rowCount:1/0;for(e=Math.round(e);o<s;)if(t){if(n+=r=kh(i,o-1+a,!0),Math.abs(Math.round(n)-e)<=1)return{idx:Y(i,o+a,!0)-a,size:n};if(Math.round(n)>e)return{idx:o-1,size:n-r};o++}else{if((n-=r=kh(i,o+a,!0))<=0)return{idx:0,size:0};if(Math.abs(Math.round(n)-e)<=1)return{idx:o,size:n};if(Math.round(n)<e)return n+=r,Math.round(n)>e?{idx:o,size:n-r<0?0:n-r}:{idx:Y(i,o+1+a,!0)-a,size:n};o--}return{idx:this.offset.top.idx,size:this.offset.top.size}},vp.prototype.getColOffset=function(e,t,r){for(var n,i=this.offset.left.size,o=this.parent.getActiveSheet(),a=t?this.offset.left.idx+1:this.offset.left.idx?this.offset.left.idx-1:0,s=this.parent.frozenColCount(o),l=this.parent.scrollSettings.isFinite?o.colCount:1/0;a<l;)if(t){if(i+=n=Bh(o,a-1+s,r,!0),Math.abs(Math.round(i)-e)<=1)return{idx:Y(o,a+s,!0,"columns")-s,size:i};if(Math.round(i)>e)return{idx:a-1,size:i-n};a++}else{if((i-=n=Bh(o,a+s,r,!0))<=0)return{idx:0,size:0};if(Math.abs(Math.round(i)-e)<=1)return{idx:a,size:i};if(Math.round(i)<e)return i+=n,Math.round(i)>e?{idx:a,size:(i-=n)<0?0:i}:{idx:Y(o,a+1+s,!0,"columns")-s,size:i};a--}return{idx:this.offset.left.idx,size:this.offset.left.size}},vp.prototype.contentLoaded=function(e){var t;this.parent.scrollSettings.enableVirtualization||(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)},vp.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"},vp.prototype.onHeaderWheel=function(e){e.preventDefault(),this.parent.getMainContent().parentElement.scrollTop+=e.deltaY,this.parent.getScrollElement().scrollLeft+=e.deltaX},vp.prototype.onContentWheel=function(e){0!==e.deltaX&&(e.preventDefault(),this.parent.getScrollElement().scrollLeft+=e.deltaX)},vp.prototype.scrollHandler=function(e){this.onContentScroll({scrollLeft:e.target.scrollLeft})},vp.prototype.updateScroll=function(e){ee.isNullOrUndefined(e.left)?this.parent.sheetModule.contentPanel.scrollTop=e.top:this.parent.getScrollElement().scrollLeft=e.left},vp.prototype.setScrollEvent=function(){ee.EventHandler.add(this.parent.sheetModule.contentPanel,"scroll",this.onContentScroll,this),ee.EventHandler.add(this.parent.getColumnHeaderContent(),"wheel",this.onHeaderWheel,this),ee.EventHandler.add(this.parent.getSelectAllContent(),"wheel",this.onHeaderWheel,this),ee.EventHandler.add(this.parent.getMainContent(),"wheel",this.onContentWheel,this),ee.EventHandler.add(this.parent.getRowHeaderContent(),"wheel",this.onContentWheel,this),ee.EventHandler.add(this.parent.getScrollElement(),"scroll",this.scrollHandler,this)},vp.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}}},vp.prototype.setPadding=function(e){this.parent.sheetModule.contentPanel.style.overflowY="scroll";var t,r,n=Qh();0<n&&(t=this.parent.getColumnHeaderContent(),r=this.parent.enableRtl?{margin:"marginLeft",border:"borderLeftWidth"}:{margin:"marginRight",border:"borderRightWidth"},t.parentElement.style[r.margin]=n+"px",t.style[r.border]="1px"),e&&(this.initScrollValue=0)},vp.prototype.setClientX=function(e){var t;"mousedown"===e.type||"mouse"===e.pointerType||(this.parent.notify(Bs,t={touchSelectionStarted:!1}),t.touchSelectionStarted)||t.isOverlayClicked||(this.clientX=this.getPointX(e),t=document.getElementById(this.parent.element.id+"_sheet"),ee.EventHandler.add(t,ee.Browser.isPointer?"pointermove":"touchmove",this.onTouchScroll,this),ee.EventHandler.add(t,ee.Browser.isPointer?"pointerup":"touchend",this.pointerUpHandler,this))},vp.prototype.getPointX=function(e){return(e.touches&&e.touches.length?e.touches[0]:e).clientX},vp.prototype.onTouchScroll=function(e){var t,r,n;"mouse"!==e.pointerType&&(t=this.getPointX(e),r=this.clientX-t,n=this.parent.element.getElementsByClassName("e-scroller")[0],10<r||r<-10)&&0<=n.scrollLeft+r&&(e.preventDefault(),this.clientX=t,Xh(function(){n.scrollLeft+=r}))},vp.prototype.pointerUpHandler=function(){var e=document.getElementById(this.parent.element.id+"_sheet");ee.EventHandler.remove(e,ee.Browser.isPointer?"pointermove":"touchmove",this.onTouchScroll),ee.EventHandler.remove(e,ee.Browser.isPointer?"pointerup":"touchend",this.pointerUpHandler)},vp.prototype.addEventListener=function(){this.parent.on(to,this.contentLoaded,this),this.parent.on(Xo,this.onContentScroll,this),this.parent.on(Vs,this.updateScroll,this),this.parent.on(Ko,this.initProps,this),this.parent.on(no,this.destroy,this),this.parent.on(ro,this.setClientX,this),this.parent.on(Ks,this.updateScrollValue,this),this.parent.scrollSettings.enableVirtualization||(this.parent.on(mo,this.updateNonVirualScrollWidth,this),this.parent.on(Yo,this.updateNonVirualScrollWidth,this))},vp.prototype.destroy=function(){this.removeEventListener();var e=document.querySelector("#"+this.parent.element.id+"_autofilloptionbtn");e&&(e=ee.getComponent(e,"dropdown-btn"))&&e.destroy(),this.parent=null},vp.prototype.removeEventListener=function(){this.parent.off(to,this.contentLoaded),this.parent.off(Xo,this.onContentScroll),this.parent.off(Vs,this.updateScroll),this.parent.off(Ko,this.initProps),this.parent.off(no,this.destroy),this.parent.off(ro,this.setClientX),this.parent.off(Ks,this.updateScrollValue),this.parent.scrollSettings.enableVirtualization||(this.parent.off(mo,this.updateNonVirualScrollWidth),this.parent.off(Yo,this.updateNonVirualScrollWidth))};var mp=vp;function vp(e){this.clientX=0,this.isKeyScroll=!0,this.parent=e,this.addEventListener(),this.initProps()}Cp.prototype.createVirtualElement=function(e){var t=this.parent.getActiveSheet(),r=this.parent.getMainContent(),n=(this.content=this.parent.createElement("div",{className:"e-virtualable"}),this.content.appendChild(r.querySelector(".e-table")),r.appendChild(this.content),r.appendChild(this.parent.createElement("div",{className:"e-virtualtrack"}))),i=0,o=(this.parent.sheets.length>this.scroll.length&&this.initScroll(),this.parent.viewport.bottomIndex),a=(t.rowCount>o+1||t.usedRange.rowIndex>o?(!this.parent.scrollSettings.isFinite&&t.rowCount<=t.usedRange.rowIndex&&this.parent.setSheetPropertyOnMute(t,"rowCount",t.usedRange.rowIndex+1),this.setScrollCount(t.rowCount,"row")):(this.parent.scrollSettings.isFinite||this.parent.setSheetPropertyOnMute(t,"rowCount",o+1),this.scroll[this.parent.activeSheetIndex].rowCount=t.rowCount),this.parent.frozenRowCount(t)),s=W(t.topLeftCell),l=(e.top&&(i=e.top,t.frozenRows&&(i+=Ah(t,s[0],a-1,!0)),a=W(t.paneTopLeftCell)[0]),i+=Ah(t,a,this.scroll[this.parent.activeSheetIndex].rowCount-1,!0),o=this.parent.viewport.rightIndex,0),h=this.parent.frozenColCount(t),a=e.left?(l=e.left,h&&(l+=Uh(t,s[1],h-1,!0)),W(t.paneTopLeftCell)[1]):h,s=t.colCount>o+1||t.usedRange.colIndex>o?(!this.parent.scrollSettings.isFinite&&t.colCount<=t.usedRange.colIndex&&this.parent.setSheetPropertyOnMute(t,"colCount",t.usedRange.colIndex+1),l+=Uh(t,a,o,!0),this.setScrollCount(t.colCount,"col"),l+Uh(t,o+1,this.scroll[this.parent.activeSheetIndex].colCount-1,!0)):(this.parent.scrollSettings.isFinite||this.parent.setSheetPropertyOnMute(t,"colCount",o+1),l+=Uh(t,a,t.colCount-1,!0),this.scroll[this.parent.activeSheetIndex].colCount=t.colCount,l),a=(ee.isNullOrUndefined(this.parent.viewport.leftIndex)&&(this.parent.viewport.leftIndex=0),ee.isNullOrUndefined(this.parent.viewport.topIndex)&&(this.parent.viewport.topIndex=0),e.left&&(l=Uh(t,this.parent.viewport.leftIndex+h,o,!0)),ee.isNullOrUndefined(this.translateX)&&(this.translateX=0),ee.isNullOrUndefined(this.translateY)&&(this.translateY=0),r=this.parent.getRowHeaderContent(),this.rowHeader=this.content.cloneNode(),this.rowHeader.appendChild(r.querySelector(".e-table")),r.appendChild(this.rowHeader),r.appendChild(n.cloneNode())),e=(this.rowHeader.style.transform="translate(0px, "+this.translateY+"px)",r=this.parent.getColumnHeaderContent(),this.colHeader=this.content.cloneNode(),this.colHeader.appendChild(r.querySelector(".e-table")),r.appendChild(this.colHeader),r.appendChild(n.cloneNode()));this.colHeader.style.width=l+"px",a.style.height=i+"px",e.style.width=s+"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=l+"px",n.style.height=i+"px",n.style.width=s+"px",this.parent.allowScrolling&&((t=e.cloneNode(!0)).style.width=s+(this.parent.scrollSettings.isFinite?this.parent.sheetModule.getScrollSize():0)+"px",this.parent.getScrollElement().appendChild(t))},Cp.prototype.initScroll=function(){for(var e=0;e<this.parent.sheets.length;)this.scroll[e]||this.scroll.push({rowCount:0,colCount:0}),e++},Cp.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)},Cp.prototype.getRowAddress=function(e){var t=this.parent.getActiveSheet();return re([e[0],t.frozenColumns?W(t.topLeftCell)[1]:this.parent.viewport.leftIndex,e[1],this.parent.viewport.rightIndex])},Cp.prototype.getColAddress=function(e){var t=this.parent.getActiveSheet();return re([t.frozenRows?W(t.topLeftCell)[0]:this.parent.viewport.topIndex,e[0],this.parent.viewport.bottomIndex,e[1]])},Cp.prototype.updateScrollCount=function(e,t,r){void 0===r&&(r=e);var n=this.parent.getActiveSheet(),e=e+this.parent.viewport[t+"Count"]+1+r,r=this.scroll[this.parent.activeSheetIndex][t+"Count"];if(e<r){if(n[t+"Count"]===r)return;e=r}this.parent.scrollSettings.isFinite||this.parent.setSheetPropertyOnMute(n,t+"Count",e)},Cp.prototype.onVerticalScroll=function(e){var t=e.cur.idx,r=e.cur.size,n=e.prev.idx,i=Math.abs(t-n),o=this.parent.getThreshold("row");if(i>Math.round(o/2)){var a,s=void 0,l=void 0,h=this.parent.getActiveSheet();if(t<=o&&(e.increase||(this.translateY&&o<n&&(this.translateY=0,c=this.parent.frozenColCount(h),d=this.parent.frozenRowCount(h),e.preventScroll?this.parent.viewport.topIndex=n-(o-d):(u=c?W(h.topLeftCell)[1]:this.parent.viewport.leftIndex,p=c?[d,this.parent.viewport.leftIndex+c]:[],i<this.parent.viewport.rowCount+o?(s=Y(h,d,!0),l=Y(h,this.parent.viewport.topIndex+d-1,!1),this.parent.viewport.topIndex=s-d,f=this.skipHiddenLastIdx(this.parent.viewport.bottomIndex-(l-s+1-this.hiddenCount(s,l)),this.parent.viewport.bottomIndex),this.parent.viewport.bottomIndex=Y(h,f,!1),this.parent.renderModule.refreshUI({colIndex:u,rowIndex:s,direction:"last",refresh:"RowPart",skipUpdateOnFirst:!0,frozenIndexes:p},this.getRowAddress([s,Y(h,l,!1)]))):(a=this.parent.viewport.leftIndex,this.parent.renderModule.refreshUI({rowIndex:0,colIndex:u,refresh:"Row",skipUpdateOnFirst:!0,frozenIndexes:p,skipTranslate:!0}),c&&(this.parent.viewport.leftIndex=a),this.translate({refresh:"Row"})),ce(this.parent.element),t=0)),this.updateScrollCount(o,"row"))),n<o&&(i=Math.abs(t-o)),!e.increase&&this.parent.scrollSettings.isFinite&&this.parent.viewport.bottomIndex===Y(h,h.rowCount-1,!1)){var d=this.parent.frozenRowCount(h),p=this.parent.viewport.topIndex+d+te(h.paneTopLeftCell)[0]-1;if(p<t+d)return void(e.prev.idx=t);i=p-(t+d)}if(o<t){if(a=this.parent.viewport.topIndex,this.parent.viewport.topIndex=t-o,e.increase&&a>this.parent.viewport.topIndex)return void(this.parent.viewport.topIndex=a);d=this.parent.frozenRowCount(h);if(e.preventScroll)this.setThresholdHeight(r,o,d),this.translate({refresh:"Row"});else{var c,u=void 0,n=[];if((c=this.parent.frozenColCount(h))?(u=W(h.topLeftCell)[1],n.push(d),n.push(this.parent.viewport.leftIndex+c)):u=this.parent.viewport.leftIndex,i<this.parent.viewport.rowCount+o)if(e.increase){if(s=this.parent.viewport.bottomIndex+1,l=this.parent.viewport.bottomIndex+(this.parent.viewport.topIndex-a),(l-=this.hiddenCount(a+d,this.parent.viewport.topIndex-1+d))<=this.parent.viewport.bottomIndex||this.parent.scrollSettings.isFinite&&s>Y(h,h.rowCount-1,!1,"rows"))return void(this.parent.viewport.topIndex=a);p=this.parent.skipHidden(s,l,"rows",!1),i=this.checkLastIdx(p[1],"row"),s=p[0],l=i.index,p=this.parent.viewport.topIndex+d;i.diff&&(p=Y(h,a,!0,"rows",l-s+1-this.hiddenCount(s,l))+d),this.parent.viewport.topIndex=Y(h,p,!i.diff)-d,this.setThresholdHeight(r,t-this.parent.viewport.topIndex,d,!!i.diff,a===Y(h,d,!0)),this.parent.viewport.bottomIndex=l,this.parent.renderModule.refreshUI({colIndex:u,rowIndex:s,direction:"first",refresh:"RowPart",frozenIndexes:n},this.getRowAddress([s,l]))}else{if((s=Y(h,this.parent.viewport.topIndex+d,!1))<d&&(s=Y(h,s=d,!0)),this.parent.viewport.topIndex=s-d,(l=Y(h,a+d-1,!1))<d||l<s)return void(this.parent.viewport.topIndex=a);var f=this.skipHiddenLastIdx(this.parent.viewport.bottomIndex-(l-s+1-this.hiddenCount(s,l)),this.parent.viewport.bottomIndex);this.parent.viewport.bottomIndex=Y(h,f,!1),this.setThresholdHeight(r,t-this.parent.viewport.topIndex,d),this.parent.renderModule.refreshUI({colIndex:u,rowIndex:s,direction:"last",refresh:"RowPart",frozenIndexes:n},this.getRowAddress([s,l]))}else a=this.parent.viewport.leftIndex,this.parent.viewport.topIndex=Y(h,this.parent.viewport.topIndex+d,!1)-d,this.parent.viewport.topIndex<0&&(this.parent.viewport.topIndex=Y(h,d,!0)-d),this.parent.renderModule.refreshUI({rowIndex:this.parent.viewport.topIndex,colIndex:u,refresh:"Row",frozenIndexes:n,skipTranslate:!0}),c&&(this.parent.viewport.leftIndex=a),this.setThresholdHeight(r,t-this.parent.viewport.topIndex,d,this.parent.scrollSettings.isFinite&&this.parent.viewport.bottomIndex===Y(h,h.rowCount-1,!1)),this.translate({refresh:"Row"});this.updateScrollCount(t,"row",o),this.focusSheet()}}e.prev.idx=t}},Cp.prototype.skipHiddenLastIdx=function(e,t,r){void 0===r&&(r="rows");for(var n=this.parent.getActiveSheet(),i=0,o=e;o<=t;o++)n[""+r][o]&&n[""+r][o].hidden&&i++;return e=i?this.skipHiddenLastIdx(e-i,e-1,r):e},Cp.prototype.hiddenCount=function(e,t,r){void 0===r&&(r="rows");for(var n=0,i=this.parent.getActiveSheet(),o=e;o<=t;o++)i[""+r][o]&&i[""+r][o].hidden&&n++;return n},Cp.prototype.checkLastIdx=function(e,t){var r,n=0;return this.parent.scrollSettings.isFinite&&(r=Y(r=this.parent.getActiveSheet(),r[t+"Count"]-1,!1))<e&&(n=e-r,e=r),{index:e,diff:n}},Cp.prototype.onHorizontalScroll=function(e){var t=e.cur.idx,r=e.cur.size,n=e.prev.idx,i=Math.abs(t-n),o=this.parent.getThreshold("col");if(i>Math.round(o/2)){var a,s=void 0,l=void 0,h=this.parent.getActiveSheet();if(t<=o&&(e.increase||(this.translateX&&o<n&&(this.translateX=0,d=this.parent.frozenColCount(h),c=this.parent.frozenRowCount(h),e.preventScroll?this.parent.viewport.leftIndex=n-(o-d):(u=c?W(h.topLeftCell)[0]:this.parent.viewport.topIndex,p=c?[this.parent.viewport.topIndex+c,d]:[],i<this.parent.viewport.colCount+o?(s=Y(h,d,!0,"columns"),l=Y(h,this.parent.viewport.leftIndex+d-1,!1,"columns"),this.parent.viewport.leftIndex=s-d,f=this.skipHiddenLastIdx(this.parent.viewport.rightIndex-(l-s+1-this.hiddenCount(s,l,"columns")),this.parent.viewport.rightIndex,"columns"),this.parent.viewport.rightIndex=Y(h,f,!1,"columns"),this.parent.renderModule.refreshUI({rowIndex:u,colIndex:s,direction:"last",refresh:"ColumnPart",skipUpdateOnFirst:!0,frozenIndexes:p},this.getColAddress([s,Y(h,l,!1,"columns")]))):(a=this.parent.viewport.topIndex,this.parent.renderModule.refreshUI({rowIndex:u,colIndex:0,refresh:"Column",skipUpdateOnFirst:!0,frozenIndexes:p,skipTranslate:!0}),c&&(this.parent.viewport.topIndex=a),this.translate({refresh:"Column"})),ce(this.parent.element),t=0)),this.updateScrollCount(o,"col"))),n<o&&(i=Math.abs(t-o)),!e.increase&&this.parent.scrollSettings.isFinite&&this.parent.viewport.rightIndex===Y(h,h.colCount-1,!1,"columns")){var d=this.parent.frozenColCount(h),p=this.parent.viewport.leftIndex+d+te(h.paneTopLeftCell)[1]-1;if((p+=this.hiddenCount(this.parent.viewport.leftIndex+d,p))<t+d)return void(e.prev.idx=t);i=p-(t+d)}if(o<t){if(a=this.parent.viewport.leftIndex,this.parent.viewport.leftIndex=t-o,e.increase&&a>this.parent.viewport.leftIndex)return void(this.parent.viewport.leftIndex=a);d=this.parent.frozenColCount(h);if(e.preventScroll)this.setThresholdWidth(r,o,d),this.translate({refresh:"Column"});else{var c,u=(c=this.parent.frozenRowCount(h))?W(h.topLeftCell)[0]:this.parent.viewport.topIndex,n=[];if(c&&(n=[c+this.parent.viewport.topIndex,d]),i<this.parent.viewport.colCount+o)if(e.increase){if(s=this.parent.viewport.rightIndex+1,l=this.parent.viewport.rightIndex+(this.parent.viewport.leftIndex-a),(l-=this.hiddenCount(a+d,this.parent.viewport.leftIndex-1+d,"columns"))<=this.parent.viewport.rightIndex||this.parent.scrollSettings.isFinite&&s>Y(h,h.colCount-1,!1,"columns"))return void(this.parent.viewport.leftIndex=a);p=this.parent.skipHidden(s,l,"columns",!1),i=this.checkLastIdx(p[1],"col"),s=p[0],l=i.index;this.parent.viewport.leftIndex=Y(h,this.parent.viewport.leftIndex-i.diff+d,!i.diff,"columns")-d,this.setThresholdWidth(r,t-this.parent.viewport.leftIndex,d,!!i.diff,a===Y(h,d,!0,"columns")),this.parent.viewport.rightIndex=l,this.parent.renderModule.refreshUI({rowIndex:u,colIndex:s,direction:"first",refresh:"ColumnPart",frozenIndexes:n},this.getColAddress([s,l]))}else{if((s=Y(h,this.parent.viewport.leftIndex+d,!1,"columns"))<d&&(s=Y(h,s=d,!0,"columns")),this.parent.viewport.leftIndex=s-d,(l=Y(h,a+d-1,!1,"columns"))<d||l<s)return void(this.parent.viewport.leftIndex=a);var f=this.skipHiddenLastIdx(this.parent.viewport.rightIndex-(l-s+1-this.hiddenCount(s,l,"columns")),this.parent.viewport.rightIndex,"columns");this.parent.viewport.rightIndex=Y(h,f,!1,"columns"),this.setThresholdWidth(r,t-this.parent.viewport.leftIndex,d),this.parent.renderModule.refreshUI({rowIndex:u,colIndex:s,direction:"last",refresh:"ColumnPart",frozenIndexes:n},this.getColAddress([s,l]))}else a=this.parent.viewport.topIndex,this.parent.viewport.leftIndex=Y(h,this.parent.viewport.leftIndex+d,!1,"columns")-d,this.parent.viewport.leftIndex<0&&(this.parent.viewport.leftIndex=Y(h,d,!0,"columns")-d),this.parent.renderModule.refreshUI({rowIndex:u,colIndex:this.parent.viewport.leftIndex,refresh:"Column",frozenIndexes:n,skipTranslate:!0}),c&&(this.parent.viewport.topIndex=a),this.setThresholdWidth(r,t-this.parent.viewport.leftIndex,d,this.parent.scrollSettings.isFinite&&this.parent.viewport.rightIndex===Y(h,h.colCount-1,!1,"columns")),this.translate({refresh:"Column"});this.updateScrollCount(t,"col",o),this.focusSheet()}}e.prev.idx=t}},Cp.prototype.focusSheet=function(){document.activeElement.classList.contains("e-text-findNext-short")&&ee.closest(document.activeElement,"#"+this.parent.element.id)||ce(this.parent.element)},Cp.prototype.setThresholdHeight=function(e,t,r,n,i){var o=this.parent.getActiveSheet(),a=this.parent.viewport.topIndex+r,t=a+t-1;this.translateY=n||i||t<a?a<=r?0:Ah(o,r,a-1,!0):e-Ah(o,a,t,!0)},Cp.prototype.setThresholdWidth=function(e,t,r,n,i){var o=this.parent.getActiveSheet(),a=this.parent.viewport.leftIndex+r,t=a+t-1;this.translateX=n||i||t<a?a<=r?0:Uh(o,r,a-1,!0):e-Uh(o,a,t,!0)},Cp.prototype.translate=function(e){var t;!e.skipTranslate&&this.content&&(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)")},Cp.prototype.updateColumnWidth=function(e){var t,r,n,i;"Column"===e.refresh?(this.content.style.width="",r=Uh(r=this.parent.getActiveSheet(),this.parent.viewport.leftIndex+this.parent.frozenColCount(r),this.parent.viewport.rightIndex,!0),this.colHeader.style.width=r+"px",this.content.style.width=r+"px",this.parent.scrollSettings.isFinite&&!e.isUpdate||(e=this.parent.element.querySelector(".e-scroller .e-virtualtrack"))&&((n=parseInt(e.style.width,10))<(r=r+this.translateX+this.parent.viewport.beforeFreezeWidth)?e.style.width=n+(i=r-n)+"px":(i=n-r,t=this.parent.getMainContent().getElementsByClassName("e-virtualtrack")[0],n-i<parseInt(t.style.width,10)&&(e.style.width=t.style.width)))):this.parent.scrollSettings.isFinite||(t=this.parent.getMainContent().getElementsByClassName("e-virtualtrack")[0],(r=parseInt(t.style.height,10))<(n=this.content.getBoundingClientRect().height+this.translateY+this.parent.viewport.beforeFreezeHeight)?t.style.height=r+(i=n-r)+"px":(i=r-n,e=this.parent.getRowHeaderContent().getElementsByClassName("e-virtualtrack")[0],r-i<parseInt(e.style.height,10)&&(t.style.height=e.style.height)))},Cp.prototype.updateRowColCount=function(e){var t,r,n;this.scroll.length&&(t=this.parent.getActiveSheet(),"row"===e.update?e.index!==this.scroll[this.parent.activeSheetIndex].rowCount-1&&(n=r=this.getVTrackHeight("height"),e.index>=this.scroll[this.parent.activeSheetIndex].rowCount?void 0===e.start?n+=Ah(t,this.scroll[this.parent.activeSheetIndex].rowCount,e.index,!0):n+=Ah(t,e.start,e.end,!0):void 0===e.start?n-=Ah(t,e.index+1,this.scroll[this.parent.activeSheetIndex].rowCount-1,!0):n-=Ah(t,e.start,e.end,!0),!e.isDelete&&n<r||(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))):e.index!==this.scroll[this.parent.activeSheetIndex].colCount-1&&(n=r=this.getVTrackHeight("width"),e.index>=this.scroll[this.parent.activeSheetIndex].colCount?void 0===e.start?n+=Uh(t,this.scroll[this.parent.activeSheetIndex].colCount,e.index,!0):n+=Uh(t,e.start,e.end,!0):void 0===e.start?n-=Uh(t,e.index+1,this.scroll[this.parent.activeSheetIndex].colCount-1,!0):n-=Uh(t,e.start,e.end,!0),!e.isDelete&&n<r||(this.scroll[this.parent.activeSheetIndex].colCount=e.index+1,this.updateVTrack(this.colHeader,n,"width"),this.scroll[this.parent.activeSheetIndex].colCount>t.colCount&&this.parent.setSheetPropertyOnMute(t,"colCount",this.scroll[this.parent.activeSheetIndex].colCount))))},Cp.prototype.getVTrackHeight=function(e){var t,e=this.content.nextElementSibling.style[""+e];return e.includes("e+")?(t=(e=e.split("px")[0]).split("e+"),Number(t[0])*Math.pow(10,Number(t[1]))):parseFloat(e)},Cp.prototype.updateVTrackHeight=function(e){var t,r=this.parent.frozenRowCount(this.parent.getActiveSheet());e.rowIdx<this.scroll[this.parent.activeSheetIndex].rowCount&&this.updateVTrack(this.rowHeader,this.getVTrackHeight("height")+e.threshold,"height"),e.rowIdx>=r&&e.rowIdx<this.parent.scrollModule.offset.top.idx+r&&((t=this.parent.element.getElementsByClassName("e-main-panel")[0])&&(this.parent.scrollModule.prevScroll.scrollTop=t.scrollTop+e.threshold,t.scrollTop+=e.threshold),this.parent.scrollModule.offset.top.size+=e.threshold,e.rowIdx<this.parent.viewport.topIndex+r)&&(this.translateY+=e.threshold,this.translate({refresh:"Row"}))},Cp.prototype.updateVTrackWidth=function(e){var t,r;pe(this.parent.getActiveSheet(),e.colIdx)||(t=this.parent.frozenColCount(this.parent.getActiveSheet()),e.colIdx>=this.parent.viewport.leftIndex+t&&e.colIdx<=this.parent.viewport.rightIndex?((r=this.parent.getColumnHeaderContent().getElementsByClassName("e-virtualtrack")[0]).style.width=parseFloat(r.style.width)+e.threshold+"px",(r=this.parent.getMainContent().getElementsByClassName("e-virtualtrack")[0]).style.width=parseFloat(r.style.width)+e.threshold+"px",(r=this.parent.getScrollElement().getElementsByClassName("e-virtualtrack")[0]).style.width=parseFloat(r.style.width)+e.threshold+"px",(r=this.parent.getColumnHeaderContent().getElementsByClassName("e-virtualable")[0]).style.width=parseFloat(r.style.width)+e.threshold+"px",(r=this.parent.getMainContent().getElementsByClassName("e-virtualable")[0]).style.width=parseFloat(r.style.width)+e.threshold+"px"):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"})))},Cp.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")},Cp.prototype.deInitProps=function(){this.parent.viewport.leftIndex=null,this.parent.viewport.topIndex=null,this.parent.viewport.bottomIndex=null,this.translateX=null,this.translateY=null},Cp.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})})},Cp.prototype.sliceScrollProps=function(e){ee.isNullOrUndefined(e.sheetIndex)?this.scroll.length=0:this.scroll.splice(e.sheetIndex,1)},Cp.prototype.updateTranslate=function(e){var t;e.height&&(e.isRender?this.translateY-=e.height:(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"}))},Cp.prototype.addEventListener=function(){this.parent.on(fo,this.createVirtualElement,this),this.parent.on(go,this.translate,this),this.parent.on(mo,this.updateColumnWidth,this),this.parent.on(xs,this.updateColumnWidth,this),this.parent.on(po,this.onVerticalScroll,this),this.parent.on(co,this.onHorizontalScroll,this),this.parent.on(kt,this.updateRowColCount,this),this.parent.on(Go,this.updateVTrackHeight,this),this.parent.on(Yo,this.updateVTrackWidth,this),this.parent.on(Ko,this.deInitProps,this),this.parent.on(Ht,this.sliceScrollProps,this),this.parent.on(Ut,this.updateScrollProps,this),this.parent.on(Ys,this.updateTranslate,this),this.parent.on(no,this.destroy,this)},Cp.prototype.destroy=function(){this.removeEventListener();var e=document.querySelectorAll(".e-addNoteIndicator");e&&e.forEach(function(e){e.remove()}),this.rowHeader&&(Kh(this.rowHeader),this.rowHeader.remove()),this.colHeader&&(Kh(this.colHeader),this.colHeader.remove()),this.content&&(Kh(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},Cp.prototype.removeEventListener=function(){this.parent.off(fo,this.createVirtualElement),this.parent.off(go,this.translate),this.parent.off(mo,this.updateColumnWidth),this.parent.off(xs,this.updateColumnWidth),this.parent.off(po,this.onVerticalScroll),this.parent.off(co,this.onHorizontalScroll),this.parent.off(kt,this.updateRowColCount),this.parent.off(Go,this.updateVTrackHeight),this.parent.off(Yo,this.updateVTrackWidth),this.parent.off(Ht,this.sliceScrollProps),this.parent.off(Ut,this.updateScrollProps),this.parent.off(Ys,this.updateTranslate),this.parent.off(no,this.destroy)};var yp=Cp;function Cp(e){this.scroll=[],this.parent=e,this.addEventListener()}xp.prototype.addEventListener=function(){this.parent.on(ho,this.keyDownHandler,this)},xp.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off(ho,this.keyDownHandler)},xp.prototype.keyDownHandler=function(t){var r=this,e=t.target,n=this.parent.enableRtl;if(t.altKey&&38===t.keyCode&&this.parent.element.lastElementChild.classList.contains("e-filter-popup"))this.parent.notify(ka,{closePopup:!0});else if(this.parent.allowPrint&&t.ctrlKey&&80===t.keyCode&&this.parent.enableKeyboardShortcut)t.preventDefault(),this.parent.print();else{var i=t.target;if(!ee.isNullOrUndefined(i)&&i.classList.contains("e-addNoteContainer"))"Escape"!==t.key&&27!==t.keyCode||(k=se((o=!ee.isNullOrUndefined(this.parent.spreadsheetNoteModule.noteCellIndexes)?this.parent.spreadsheetNoteModule.noteCellIndexes:W(this.parent.getActiveSheet().activeCell))[0],o[1],this.parent.getActiveSheet()),p=this.parent.getCell(o[0],o[1]),a=Di(this.parent,this.parent.activeSheetIndex)+"!"+re(o),!ee.isNullOrUndefined(i)&&!ee.isNullOrUndefined(i.value)&&(ee.isNullOrUndefined(k)||ee.isNullOrUndefined(k.notes)||k.notes!==i.value)&&-1<document.activeElement.className.indexOf("e-addNoteContainer")&&(s=!ee.isNullOrUndefined(k)&&k.notes?"editNote":"addNote",this.parent.notify(ya,{args:{action:"beforeCellSave",eventArgs:{address:a}}}),_n(this.parent,this.parent.getActiveSheet(),{rowIdx:o[0],colIdx:o[1],preventEvt:!0,cell:{notes:i.value,isNoteEditable:!1}}),d={notes:i.value,address:a},this.parent.notify(le,{eventArgs:d,action:s})),this.parent.spreadsheetNoteModule.isShowNote=null,this.parent.notify(pa,""),ce(p));else{var o=this.parent.serviceLocator.getService(O).dialogInstance,i=e.id===this.parent.element.id+"_name_box";if("None"===this.parent.selectionSettings.mode||o||this.parent.isEdit||e.classList.contains("e-ss-ddb")&&117!==t.keyCode&&9!==t.keyCode||i&&117!==t.keyCode||e.classList.contains("e-sheet-rename")||e.id===this.parent.element.id+"_SearchBox"||e.classList.contains("e-chk-hidden")||e.classList.contains("e-ddl")&&e.classList.contains("e-input-focus")){if(o){if(13===t.keyCode)o.element.classList.contains("e-spreadsheet-function-dlg")&&(e.classList.contains("e-formula-list")||e.classList.contains("e-list-item"))&&ce(o.element.querySelector(".e-footer-content .e-primary"));else if(9===t.keyCode)if(o.element.classList.contains("e-find-dlg")){var a=o.element.querySelectorAll(".e-footer-content .e-btn:not(:disabled)"),s=a.length?a[a.length-1].className:"e-findnreplace-checkmatch";t.shiftKey?document.activeElement.classList.contains("e-dlg-closeicon-btn")&&(t.preventDefault(),a.length?ce(a[a.length-1]):(p=o.element.querySelector(".e-findnreplace-exactmatchcheckbox"))&&(ce(p.querySelector(".e-findnreplace-checkmatch")),p.classList.add("e-focus"))):document.activeElement.className.includes(s)&&ce(o.element)}else if(o.element.classList.contains("e-protect-dlg"))(t.shiftKey?document.activeElement.classList.contains("e-primary"):document.activeElement.id===this.parent.element.id+"_protect_check")&&(l=o.element.querySelector(".e-protect-option-list"))&&!l.querySelector(".e-list-item.e-focused")&&(f=l.querySelector(".e-list-item"))&&f.classList.add("e-focused");else if(o.element.classList.contains("e-custom-format-dlg"))if(t.shiftKey)document.activeElement.className.includes("e-list-item e-active")&&(l=ee.closest(document.activeElement,".e-custom-listview"))&&ce(l);else if(document.activeElement.classList.contains("e-btn")&&document.activeElement.parentElement.classList.contains("e-custom-dialog")){var l=o.element.querySelector(".e-custom-listview"),h=ee.getComponent(l,"listview");if(l){if(!(f=l.querySelector(".e-list-item.e-active"))){if(!(f=l.querySelector(".e-list-item")))return;h.selectItem(f)}t.preventDefault(),f.focus()}}else document.activeElement.classList.contains("e-list-item")&&ce(o.element);else o.element.classList.contains("e-spreadsheet-function-dlg")?t.shiftKey&&document.activeElement.className.includes("e-list-item e-active")&&(l=ee.closest(document.activeElement,".e-formula-list"))&&ce(l):o.element.classList.contains("e-goto-dlg")&&!o.element.classList.contains("e-dlg-modal")&&(t.shiftKey?document.activeElement.className.includes("e-dlg-closeicon-btn")&&(a=o.element.querySelector(".e-footer-content .e-btn"))&&(t.preventDefault(),ce(a)):document.activeElement.className.includes("e-btn-goto-ok")&&ce(o.element))}else i&&9===t.keyCode&&t.shiftKey&&this.focusEle(t,".e-formula-bar",!1,!0);var d={action:"getCurrentEditValue",editedValue:""},p=(this.parent.notify(io,d),Q(d.editedValue,!0));this.parent.isEdit&&p&&t.shiftKey&&!t.ctrlKey&&vd(t.keyCode)&&this.shiftSelection(t)}else{var c=this.parent.getActiveSheet(),u=W(c.activeCell);if(t.altKey){if(40===t.keyCode){if(e.classList.contains("e-dropdown-btn")||e.classList.contains("e-split-btn"))return;s={e:t,isFilterCell:!1};if(this.parent.notify(ka,s),s.isFilterCell)return}if(40===t.keyCode&&!document.getElementById(this.parent.element.id+"listValid_popup"))if(k=this.parent.getCell(u[0],u[1])){var f=k.querySelector(".e-validation-list .e-ddl");if(f)return ce(f),l=f.querySelector(".e-dropdownlist")||f,void((h=ee.getComponent(l,"dropdownlist"))&&h.showPopup())}}e.id===this.parent.element.id+"_File"&&ce(this.parent.element);var g,m,v,a=e.classList.contains("e-add-sheet-tab")||e.classList.contains("e-sheets-list")||e.classList.contains("e-tab-wrap")&&!!ee.closest(e,".e-sheet-tabs-items")||e.classList.contains("e-aggregate-list")||e.classList.contains("e-scroll-nav"),y=(-1<[9,37,38,39,40,33,34,35,36].indexOf(t.keyCode)&&!a&&t.preventDefault(),te(c.selectedRange));if(36===t.keyCode){var C,o=this.parent.frozenColCount(c),d=void 0;t.ctrlKey||t.metaKey?(p=Y(c,this.parent.frozenRowCount(c),!0),t.shiftKey?d=[u[0],u[1],p,Y(c,o,!0,"columns")]:(d=[p,Y(c,o,!0,"columns"),p])[3]=d[1],(x=this.parent.element.querySelector(".e-main-panel")).scrollTop&&(x.scrollTop=0),(s=this.parent.getScrollElement()).scrollLeft&&(s.scrollLeft=0)):t.shiftKey?(C=Y(c,o,!0,"columns"),d=c.frozenColumns&&Y(c,u[1],!0,"columns")===C?[y[0],u[1],y[2],Y(c,0,!0,"columns")]:[y[0],u[1],y[2],C],this.scrollNavigation([d[2],d[3]],!0)):(C=Y(c,o,!0,"columns"),!c.frozenColumns||C!==u[1]&&o!==u[1]||(C=Y(c,0,!0,"columns")),d=[u[0],C,u[0],C],this.scrollNavigation([d[0],d[1]],!0)),this.updateSelection(c,d,t)}else if(t.ctrlKey||t.metaKey)35===t.keyCode?(t.preventDefault(),f=-1<(f=Y(c,c.usedRange.rowIndex,!1))?f:c.usedRange.rowIndex,l=-1<(l=Y(c,c.usedRange.colIndex,!1,"columns"))?l:c.usedRange.colIndex,t.shiftKey||(u[0]=f,u[1]=l),u[2]=f,u[3]=l,this.updateSelection(c,u.concat(u),t),this.scrollNavigation([f,l],!0)):32!==t.keyCode||t.shiftKey||(y[0]=0,y[2]=c.rowCount-1,this.updateSelection(c,y,{shiftKey:!0})),40===t.keyCode||39===t.keyCode||38===t.keyCode||37===t.keyCode?t.shiftKey?(40===t.keyCode?y[2]=this.getNextNonEmptyCell(y[2],u[1],"down"):39===t.keyCode&&!n||37===t.keyCode&&n?y[3]=this.getNextNonEmptyCell(u[0],y[3],"right"):38===t.keyCode?y[2]=this.getNextNonEmptyCell(y[2],u[1],"top"):y[3]=this.getNextNonEmptyCell(u[0],y[3],"left"),this.updateSelection(c,y,t),this.scrollNavigation([y[2],y[3]],!0)):(37===t.keyCode&&!n||39===t.keyCode&&n?u[1]=this.getNextNonEmptyCell(u[0],u[1],"left"):38===t.keyCode?u[0]=this.getNextNonEmptyCell(u[0],u[1],"top"):39===t.keyCode&&!n||37===t.keyCode&&n?u[1]=this.getNextNonEmptyCell(u[0],u[1],"right"):u[0]=this.getNextNonEmptyCell(u[0],u[1],"down"),this.parent.selectRange(re(u)),this.scrollNavigation([u[0],u[1]],!0)):117===t.keyCode&&((h=document.activeElement).classList.contains("e-spreadsheet")||ee.closest(h,".e-sheet")?this.setFocus("Sheet",t,!0):a?this.setFocus("SheetTabs",t):ee.closest(h,".e-ribbon")?this.setFocus("Ribbon",t):(i||h.classList.contains("e-insert-function"))&&this.setFocus("FormulaBar",t));else{if(t.shiftKey){if(32===t.keyCode&&(t.preventDefault(),y[1]=0,y[3]=c.colCount-1,this.updateSelection(c,y,t)),this.shiftSelection(t),(34===t.keyCode||33===t.keyCode)&&this.parent.scrollModule&&this.parent.scrollModule.isKeyScroll){var b=0,x=this.parent.element.querySelector(".e-main-panel"),p=Y(c,W(c.paneTopLeftCell)[0],!0),S=qd(this.parent,p).height;if(34===t.keyCode)b=S+this.parent.scrollModule.offset.top.size,this.parent.scrollSettings.isFinite||(I=this.parent.getMainContent().querySelector(".e-virtualtrack"))&&parseFloat(I.style.height)<b+S&&(I.style.height=b+S+"px");else if(b=this.parent.scrollModule.offset.top.size-S,Math.round(b)<0){if(!x.scrollTop)return void this.parent.selectRange(re([y[0],y[1],p,y[3]]));b=0}var s=Y(c,te(c.selectedRange)[2],!0),w=s<p?0:s-p;this.parent.scrollModule&&x.scrollTop&&(this.parent.scrollModule.isKeyScroll=!1),x.scrollTop=b,Xh(function(){34===t.keyCode?(y[2]=Y(c,W(c.paneTopLeftCell)[0]+w,!0),r.parent.scrollSettings.isFinite&&y[2]>c.rowCount-1&&(y[2]=Y(c,c.rowCount-1,!1),y[2]=y[2]<0?0:y[2])):(y[2]=Y(c,W(c.paneTopLeftCell)[0]+w,!1),y[2]=y[2]<0?0:y[2]),r.updateSelection(c,y,t)})}}else if(9===t.keyCode||(this.parent.enableRtl?37===t.keyCode:39===t.keyCode))(k=se(u[0],u[1],c))&&1<k.colSpan&&(u[1]+=k.colSpan-1),u[1]<c.colCount-1&&(!c.isProtected||c.protectSettings.selectCells)?(u[1]+=1,g=!0):c.protectSettings.selectUnLockedCells&&(m=this.getNextUnlockedCell("right",u),g=u[1]!==m[1]||u[0]!==m[0],u[1]=m[1],u[0]=m[0]);else if(13===t.keyCode||40===t.keyCode)(k=se(u[0],u[1],c))&&1<k.rowSpan&&(u[0]+=k.rowSpan-1),u[0]<c.rowCount-1&&(!c.isProtected||c.protectSettings.selectCells)?(g=!0,u[0]+=1):c.protectSettings.selectUnLockedCells&&(m=this.getNextUnlockedCell("down",u),g=u[0]!==m[0]||u[1]!==m[1],u[1]=m[1],u[0]=m[0]);else if((34===t.keyCode||33===t.keyCode)&&this.parent.scrollModule&&this.parent.scrollModule.isKeyScroll){var I,x=this.parent.element.querySelector(".e-main-panel"),b=0,E=Y(c,W(c.paneTopLeftCell)[0],!0),N=Y(c,W(c.activeCell)[0],!0),S=qd(this.parent,E).height;if(34===t.keyCode)b=this.parent.scrollModule.offset.top.size+S,this.parent.scrollSettings.isFinite||(I=this.parent.getMainContent().querySelector(".e-virtualtrack"))&&parseFloat(I.style.height)<b+S&&(I.style.height=b+S+"px");else{if(b=this.parent.scrollModule.offset.top.size-S,c.frozenRows&&u[0]<this.parent.frozenRowCount(c))return void this.parent.selectRange(re([E,y[1],E,y[1]]));if(Math.round(b)<0){if(!x.scrollTop)return;b=0}}var R=N<E?0:N-E;this.parent.scrollModule&&x.scrollTop&&(this.parent.scrollModule.isKeyScroll=!1),x.scrollTop=b,Xh(function(){var e;34===t.keyCode?(e=Y(c,W(c.paneTopLeftCell)[0]+R,!0),r.parent.scrollSettings.isFinite&&e>c.rowCount-1&&(e=(e=Y(c,c.rowCount-1,!1))<0?0:e)):(e=W(c.paneTopLeftCell)[0]+R,e-=r.parent.hiddenCount(E,N),e=(e=Y(c,e,!1))<0?0:e),r.parent.notify(vo,{range:[e,u[1],e,u[1]],preventAnimation:!0})})}(t.shiftKey?9===t.keyCode:this.parent.enableRtl?39===t.keyCode:37===t.keyCode)?(0<u[1]&&(!c.isProtected||c.protectSettings.selectCells)?(--u[1],g=!0):c.protectSettings.selectUnLockedCells&&(m=this.getNextUnlockedCell("left",u),g=u[1]!==m[1]||u[0]!==m[0],u[1]=m[1],u[0]=m[0]),u[1]<=0&&(o=this.parent.getMainContent(),0===u[1])&&o.scrollLeft&&!this.parent.enableRtl&&(o.scrollLeft=0)):(t.shiftKey?13!==t.keyCode:38!==t.keyCode)||this.parent.element.querySelector(".e-find-toolbar")||(0<u[0]&&(!c.isProtected||c.protectSettings.selectCells)?(--u[0],g=!0):c.protectSettings.selectUnLockedCells&&(C=this.getNextUnlockedCell("up",u),g=u[0]!==C[0]||u[1]!==C[1],u[1]=C[1],u[0]=C[0]),u[0]<=0&&(d=this.parent.getMainContent().parentElement,0===u[0])&&d.scrollTop&&(d.scrollTop=0))}if(!g||this.parent.scrollModule&&!this.parent.scrollModule.isKeyScroll||a||ee.closest(document.activeElement,".e-ribbon")||e.classList.contains("e-insert-function")||e.classList.contains("e-formula-bar")&&(!e.classList.contains("e-formula-bar")||"TEXTAREA"!==e.nodeName||13!==t.keyCode))9===t.keyCode&&((f=this.parent.showRibbon&&ee.closest(document.activeElement,".e-ribbon"))?ee.closest(document.activeElement,".e-tab-header")?t.shiftKey||f.classList.contains("e-collapsed")?this.focusEle(t,".e-ribbon .e-drop-icon"):this.focusEle(t,".e-ribbon .e-content .e-toolbar-item:not(.e-separator):not(.e-overlay) .e-btn"):ee.closest(document.activeElement,".e-content")?t.shiftKey?this.focusEle(t,".e-ribbon .e-toolbar-items .e-toolbar-item.e-active .e-tab-wrap",!0):this.focusEle(t,".e-ribbon .e-drop-icon"):document.activeElement.classList.contains("e-drop-icon")&&(t.shiftKey&&!f.classList.contains("e-collapsed")?this.focusEle(t,".e-ribbon .e-content .e-toolbar-item:not(.e-separator):not(.e-overlay) .e-btn"):this.focusEle(t,".e-ribbon .e-toolbar-items .e-toolbar-item.e-active .e-tab-wrap",!0)):e.classList.contains("e-insert-function")?t.shiftKey?this.focusEle(t,".e-formula-bar-panel .e-combobox"):this.focusEle(t,".e-formula-bar",!1,!0):a&&(t.shiftKey?(l=e.classList.contains("e-aggregate-list")||e.classList.contains("e-scroll-left-nav"),e.classList.contains("e-add-sheet-tab")||l||e.classList.contains("e-sheets-list")&&e.previousElementSibling&&e.previousElementSibling.disabled?(n=!l&&this.parent.element.querySelector(".e-aggregate-list"))?this.focusEle(t,null,!1,!1,n):!e.classList.contains("e-scroll-left-nav")&&this.parent.element.querySelector(".e-sheet-tab-panel .e-scroll-nav")?this.focusEle(t,".e-sheet-tab-panel .e-scroll-right-nav",!0):(v=[].slice.call(this.parent.element.querySelectorAll(".e-sheet-tab-panel .e-toolbar-item")))[v.length-1]&&this.focusEle(t,null,!0,!1,v[v.length-1].querySelector(".e-tab-wrap")):e.classList.contains("e-scroll-right-nav")?this.focusEle(t,".e-sheet-tab-panel .e-scroll-left-nav",!0):e.classList.contains("e-tab-wrap")&&(0===(m=(v=[].slice.call(this.parent.element.querySelectorAll(".e-sheet-tab-panel .e-toolbar-item"))).indexOf(e.parentElement))?this.focusEle(t,".e-sheet-tab-panel .e-sheets-list"):this.focusEle(t,null,!0,!1,v[m-1].querySelector(".e-tab-wrap")))):(i=!!this.parent.element.querySelector(".e-aggregate-list"),e.classList.contains("e-aggregate-list")||!i&&e.classList.contains("e-scroll-right-nav")?this.focusEle(t,".e-sheet-tab-panel .e-icon-btn:not(:disabled)"):e.classList.contains("e-sheets-list")?this.focusEle(t,".e-sheet-tab-panel .e-toolbar-item .e-tab-wrap",!0):e.classList.contains("e-scroll-left-nav")?this.focusEle(t,".e-sheet-tab-panel .e-scroll-right-nav",!0):e.classList.contains("e-tab-wrap")&&((h=(v=[].slice.call(this.parent.element.querySelectorAll(".e-sheet-tab-panel .e-toolbar-item"))).indexOf(e.parentElement))===v.length-1?!(s=!!this.parent.element.querySelector(".e-sheet-tab-panel .e-scroll-nav"))&&i||this.focusEle(t,".e-sheet-tab-panel ."+(s?"e-scroll-nav":"e-icon-btn:not(:disabled)"),s):this.focusEle(t,null,!0,!1,v[h+1].querySelector(".e-tab-wrap"))))));else{if(40===t.keyCode||38===t.keyCode||13===t.keyCode)for(;he(c,u[0]);)if(40!==t.keyCode&&(t.shiftKey||13!==t.keyCode)||(u[0]=u[0]+1),(38===t.keyCode||t.shiftKey&&13===t.keyCode)&&(u[0]=u[0]-1,u[0]<0))return;if(37===t.keyCode||39===t.keyCode||9===t.keyCode)for(;pe(c,u[1]);)if(39!==t.keyCode&&(t.shiftKey||9!==t.keyCode)||(u[1]=u[1]+1),(37===t.keyCode||t.shiftKey&&9===t.keyCode)&&(u[1]=u[1]-1,u[1]<0))return;var p=te(c.topLeftCell),F=(c.frozenRows&&u[0]<p[0]&&(u[0]=Y(c,p[0],!0)),c.frozenColumns&&u[1]<p[1]&&(u[1]=Y(c,p[1],!0,"columns")),this.scrollNavigation(u),re(u)),k=function(e){var t;F!==c.selectedRange&&(r.parent.selectionModule.previousActiveCell=c.activeCell,document.getElementsByClassName("e-addNoteContainer")&&0<document.getElementsByClassName("e-addNoteContainer").length&&r.parent.notify(pa,""),r.parent.setSheetPropertyOnMute(c,"activeCell",F),r.parent.notify(vo,{range:u.concat(u),preventAnimation:e}),t=(t=ee.Browser.isDevice&&"safari"===ee.Browser.info.name&&(ee.Browser.isIos||ee.Browser.isIos7)?r.parent.element.querySelector(".e-ss-focus-edit"):t)||r.parent.getCell(u[0],u[1]))&&ce(t)};this.parent.scrollModule&&this.parent.scrollModule.isKeyScroll?F!==c.selectedRange&&Xh(k.bind(this,!0)):k()}}}}},xp.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"))},xp.prototype.focusEle=function(e,t,r,n,i){var o;i=i||this.parent.element.querySelector(t),r&&!i&&(t=(o=this.parent.element.querySelector(".e-ribbon .e-tab"))&&ee.getComponent(o,"tab").selectedItem||0,i=(i=this.parent.element.querySelector(".e-tab-header").getElementsByClassName("e-toolbar-item")[t])&&i.querySelector(".e-tab-wrap")),i&&(e.preventDefault(),n?(i.click(),ce(i),i.setSelectionRange(i.value.length,i.value.length)):r?(i.setAttribute("tabindex","0"),i.parentElement.classList.contains("e-active")&&i.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"),i.focus()):ce(i))},xp.prototype.updateSelection=function(e,t,r){e.isProtected&&!e.protectSettings.selectCells&&e.protectSettings.selectUnLockedCells&&jd(this.parent,ne(t))||this.parent.notify(vo,{range:t,shiftKey:r.shiftKey})},xp.prototype.getNextNonEmptyCell=function(e,t,r){function n(e,t){return e=se(e,t,o,null,!0).value,!ee.isNullOrUndefined(e)&&""!==e}var i,o=this.parent.getActiveSheet();if("down"===r){for(var a=n(h=Y(o,e+1,!0),t),s=Y(o,o.rowCount-1,!1),l=h;l<o.rowCount;l++){if(l===s)return l;if(a){if(!n(Y(o,l,!0),t))return Y(o,l-1,!1)}else if(n(i=Y(o,l+1,!0),t))return i}return e}if("top"===r){a=n(h=Y(o,e-1,!1),t);for(var h,d=this.parent.frozenRowCount(o)?te(o.topLeftCell)[0]:0,p=Y(o,d,!0),c=h;0<=c;c--){if(c===p)return c;if(a){if(!n(Y(o,c,!1),t))return Y(o,c+1,!0)}else if(n(i=Y(o,c-1,!1),t))return i}return e}if("right"===r){a=n(e,g=Y(o,t+1,!0,"columns"));for(var u=Y(o,o.colCount-1,!1,"columns"),f=g;f<o.colCount;f++){if(f===u)return f;if(a){if(!n(e,Y(o,f,!0,"columns")))return Y(o,f-1,!1,"columns")}else if(n(e,i=Y(o,f+1,!0,"columns")))return i}}else{a=n(e,g=Y(o,t-1,!1,"columns"));for(var g,d=this.parent.frozenColCount(o)?te(o.topLeftCell)[1]:0,p=Y(o,d,!0,"columns"),m=g;0<=m;m--){if(m===p)return m;if(a){if(!n(e,Y(o,m,!1,"columns")))return Y(o,m+1,!0,"columns")}else if(n(e,i=Y(o,m-1,!1,"columns")))return i}}return t},xp.prototype.getNextUnlockedCell=function(e,t){var r,n=this.parent.getActiveSheet();if("right"===e)for(var i=t[0],o=void 0,a=void 0,s=n.usedRange.rowIndex,l=n.usedRange.colIndex;i<=s;){for(o=void 0===o?t[1]+1:0,a&&i===t[0]&&(l=t[1]-1);o<=l;o++)if(!Mn(se(i,o,n),r=de(n,o)||{})&&!r.hidden&&!he(n,i))return[i,o];i!==n.usedRange.rowIndex||a?i++:(s=t[i=0],a=!0)}else if("left"===e)for(i=t[0],o=void 0,a=void 0,s=0,l=0;s<=i;){for(o=void 0===o?t[1]-1:n.usedRange.colIndex,a&&i===t[0]&&(l=t[1]+1);l<=o;o--)if(!Mn(se(i,o,n),r=de(n,o)||{})&&!r.hidden&&!he(n,i))return[i,o];0!==i||a?i--:(i=n.usedRange.rowIndex,s=t[0],a=!0)}else if("down"===e)for(o=t[1],i=void 0,a=void 0,l=n.usedRange.colIndex,s=n.usedRange.rowIndex;o<=l;){for(i=void 0===i?t[0]+1:0,a&&o===t[1]&&(s=t[0]-1);i<=s;i++)if(!Mn(se(i,o,n),r=de(n,o)||{})&&!r.hidden&&!he(n,i))return[i,o];o!==n.usedRange.colIndex||a?o++:(l=t[1],a=!(o=0))}else for(o=t[1],i=void 0,a=void 0,l=0,s=0;l<=o;){for(i=void 0===i?t[0]-1:n.usedRange.rowIndex,a&&o===t[1]&&(s=t[0]+1);s<=i;i--)if(!Mn(se(i,o,n),r=de(n,o)||{})&&!r.hidden&&!he(n,i))return[i,o];0!==o||a?o--:(o=n.usedRange.colIndex,l=t[1],a=!0)}return t},xp.prototype.shiftSelection=function(e){var t=this.parent.getActiveSheet(),r=te(t.selectedRange),n=ne(r),i=!0,o=this.parent.enableRtl;if(38===e.keyCode){for(var a=n[1];a<=n[3];a++){var s=se(r[2],a,t);if(!ee.isNullOrUndefined(s)&&s.rowSpan&&s.rowSpan<0){r[2]=Y(t,r[2]-(Math.abs(s.rowSpan)+1),!1),i=!1;break}}i&&(r[2]=Y(t,r[2]-1,!1));var l=this.parent.frozenRowCount(t)?te(t.topLeftCell)[0]:0;if(r[2]<l)return}if(40===e.keyCode){for(a=n[1];a<=n[3];a++){s=se(r[2],a,t);if(!ee.isNullOrUndefined(s)&&s.rowSpan&&0<s.rowSpan){r[2]=Y(t,r[2]+Math.abs(s.rowSpan),!0),i=!1;break}}if(i&&(r[2]=Y(t,r[2]+1,!0)),r[2]>=t.rowCount&&(r[2]=Y(t,t.rowCount-1,!1),r[2]<0))return}if(39===e.keyCode&&!o||37===e.keyCode&&o){for(a=n[0];a<=n[2];a++){s=se(a,r[3],t);if(!ee.isNullOrUndefined(s)&&s.colSpan&&0<s.colSpan){r[3]=Y(t,r[3]+Math.abs(s.colSpan),!0,"columns"),i=!1;break}}if(i&&(r[3]=Y(t,r[3]+1,!0,"columns")),r[3]>=t.colCount&&(r[3]=Y(t,t.colCount-1,!1,"columns"),r[3]<0))return}if(37===e.keyCode&&!o||39===e.keyCode&&o){for(a=n[0];a<=n[2];a++){s=se(a,r[3],t);if(!ee.isNullOrUndefined(s)&&s.colSpan&&s.colSpan<0){r[3]=Y(t,r[3]-(Math.abs(s.colSpan)+1),!1,"columns"),i=!1;break}}i&&(r[3]=Y(t,r[3]-1,!1,"columns"));l=this.parent.frozenColCount(t)?te(t.topLeftCell)[1]:0;if(r[3]<l)return}if(!this.parent.scrollSettings.enableVirtualization&&e.shiftKey&&e.ctrlKey){o=[t.usedRange.rowIndex,t.usedRange.colIndex];if(37===e.keyCode&&(r[3]<=o[1]?r[3]=Y(t,0,!0,"columns"):r[3]=Y(t,o[1],!0,"columns")),38===e.keyCode&&(r[2]<=o[0]?r[2]=Y(t,0,!0):r[2]=Y(t,o[0],!0)),39===e.keyCode&&(r[3]<=o[1]?r[3]=Y(t,o[1],!1,"columns"):r[3]=Y(t,t.colCount,!1,"columns"),r[3]<0))return;if(40===e.keyCode&&(r[2]<=o[0]?r[2]=Y(t,o[0],!1):r[2]=Y(t,t.rowCount,!1),r[2]<0))return}37!==e.keyCode&&39!==e.keyCode&&38!==e.keyCode&&40!==e.keyCode||(l=W(t.activeCell),this.parent.isEdit&&e.shiftKey?(e.preventDefault(),this.parent.notify(Ro,{range:r,e:e}),this.parent.notify(ss,{range:re(ne(r)),isSelect:!1}),this.parent.notify(is,{})):this.parent.notify(vo,{range:r,shiftKey:e.shiftKey}),this.scrollNavigation([An(t,r)?l[0]:r[2],On(t,r)?l[1]:r[3]]))},xp.prototype.scrollNavigation=function(e,t){if(this.parent.allowScrolling){var r=this.parent.enableRtl?-1:1,n=this.parent.getMainContent().parentElement,i=this.parent.getScrollElement(),o=this.parent.getActiveSheet(),a=ne(te(o.selectedRange)),s=W(o.topLeftCell),l=this.parent.frozenRowCount(o),h=this.parent.frozenColCount(o),d=W(o.paneTopLeftCell),s=Y(o,(e[0]<l?s:d)[0],!0),p=this.parent.scrollModule.offset.top.size;if(n.scrollTop)if(l&&e[0]!==a[2]){if(e[0]===l)return void(n.scrollTop=0);e[0]===l-1&&(n.scrollTop=0)}else if(e[0]===Y(o,0,!0))return void(n.scrollTop=0);if(i&&i.scrollLeft)if(h&&e[1]!==a[3]){if(e[1]===h)return void(i.scrollLeft=0);e[1]===h-1&&(i.scrollLeft=0)}else if(e[1]===Y(o,0,!0,"columns"))return void(i.scrollLeft=0);var c,a=qd(this.parent,s).index,l=(a<=e[0]?e[0]>=l&&(t?(l=n.getBoundingClientRect().height,c=Ah(o,d[0],e[0],!0),n.scrollTop=2*l<c?p+c-l:p+c-kh(o,e[0],!0),ce(this.parent.element)):n.scrollTop=p+Ah(o,a,e[0],!0)):s>e[0]&&(n.scrollTop&&(this.parent.scrollModule.isKeyScroll=!1),n.scrollTop=p-Math.ceil(Ah(o,e[0],s-1,!0)),t)&&ce(this.parent.element),Wd(this.parent,d[1]));l<=e[1]&&i?e[1]>=h&&(t?(c=i.getBoundingClientRect().width,a=Uh(o,d[1],e[1],!0),i.scrollLeft=2*c<a?(this.parent.scrollModule.offset.left.size+a-c)*r:(this.parent.scrollModule.offset.left.size+(a-Bh(o,e[0],null,!0)))*r,ce(this.parent.element)):i.scrollLeft=(this.parent.scrollModule.offset.left.size+Uh(o,l,e[1],!0))*r):d[1]>e[1]&&i&&(i.scrollLeft&&(this.parent.scrollModule.isKeyScroll=!1),i.scrollLeft=(this.parent.scrollModule.offset.left.size-Uh(o,e[1],d[1]-1,!0))*r,t)&&ce(this.parent.element)}},xp.prototype.getModuleName=function(){return"keyboardNavigation"},xp.prototype.destroy=function(){this.removeEventListener(),this.parent=null};var bp=xp;function xp(e){this.parent=e,this.addEventListener()}wp.prototype.addEventListener=function(){this.parent.on(ho,this.keyDownHandler,this),this.parent.on(lo,this.keyUpHandler,this)},wp.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(ho,this.keyDownHandler),this.parent.off(lo,this.keyUpHandler))},wp.prototype.isTrgtNotInput=function(e){e=e.target;return!(ee.closest(e,".e-filter-popup")||ee.closest(e,".e-find-dlg")||ee.closest(e,".e-hyperlink-dlg")||ee.closest(e,".e-sheet-tab")||ee.closest(e,".e-name-box")||ee.closest(e,".e-link-dialog"))},wp.prototype.ribbonShortCuts=function(e){if(this.parent.showRibbon&&e.altKey&&!e.ctrlKey&&!e.shiftKey){var t=ee.getComponent(this.parent.element.querySelector(".e-ribbon .e-tab"),"tab"),r=void 0;if(72===e.keyCode)r=1;else if(78===e.keyCode)r=2;else if(65===e.keyCode)r=4;else if(87===e.keyCode)r=5;else if(77===e.keyCode)r=3;else if(70===e.keyCode)e.preventDefault(),ee.select("#"+this.parent.element.id+"_File",this.parent.element).click();else if(18===e.keyCode){e.preventDefault();var n=W(this.parent.getActiveSheet().activeCell),i={sheetIdx:this.parent.activeSheetIndex};if(this.parent.notify(Oa,i),!(i.hasFilter&&i.filterRange&&i.filterRange[0]===n[0]&&i.filterRange[1]<=n[1]&&i.filterRange[3]>=n[1])){i=document.activeElement;if(!(i.classList.contains("e-spreadsheet-edit")||i.classList.contains("e-sheet-rename")||i.id===this.parent.element.id+"_name_box"||ee.closest(i,".e-dropdown-btn")||ee.closest(i,".e-split-btn")||ee.closest(i,".e-popup-open"))){n=this.parent.getCell(n[0],n[1]);if(n&&n.querySelector(".e-validation-list"))return;if(ee.closest(i,".e-ribbon"))return void ce(this.parent.element);for(var o,a=0;a<=this.parent.ribbonModule.ribbon.items.length;a++)if(a===this.parent.ribbonModule.ribbon.selectedTab)return(o=this.parent.element.querySelector(".e-toolbar-items").children[a+2].children[0]).setAttribute("tabindex","0"),void ce(o)}}}r&&(t.items[r].disabled||t.items[r].cssClass.includes("e-hide")?ce(this.parent.element):(e.preventDefault(),t.select(r,Object.assign(e,{isShortcut:!0}))))}},wp.prototype.keyUpHandler=function(e){var t,r,n;37===e.keyCode||39===e.keyCode?((t=document.activeElement).classList.contains("e-colorpicker-wrapper")||t.classList.contains("e-split-btn-wrapper"))&&(t=t.querySelector(".e-split-btn"))&&ce(t):13===e.keyCode&&(r=e.target).classList.contains("e-scroll-nav")&&(n=function(){r.getAttribute("tabindex")||(r.setAttribute("tabindex","0"),ce(r)),ee.EventHandler.remove(r,"blur",n)},ee.EventHandler.add(r,"blur",n,this))},wp.prototype.keyDownHandler=function(e){var t,r="None"===this.parent.selectionSettings.mode,n=(this.ribbonShortCuts(e),this.parent.getActiveSheet()),i=e.target,o=e.target;if(ee.isNullOrUndefined(o)||!o.classList.contains("e-addNoteContainer")){if((e.ctrlKey||e.metaKey)&&this.isTrgtNotInput(e)){!ee.closest(i,".e-find-dlg")&&!r&&(-1<[79,83].indexOf(e.keyCode)||65===e.keyCode&&!this.parent.isEdit)&&e.preventDefault();var a=W(n.activeCell);if(79===e.keyCode)this.parent.allowOpen&&this.parent.openUrl&&ee.select("#"+this.parent.element.id+"_fileUpload",this.parent.element).click();else if(83===e.keyCode)this.parent.saveUrl&&this.parent.allowSave&&this.parent.notify(yt,null);else if(67!==e.keyCode||r)if(75!==e.keyCode||r)if(90!==e.keyCode||r)if(89!==e.keyCode||r){if((82===e.keyCode||68===e.keyCode)&&!r){e.preventDefault();var o=ne(te(n.selectedRange)),s={colIndex:o[1],rowIndex:o[0]},l=void 0,h=void 0;if(68===e.keyCode?(o[0]===o[2]?s.rowIndex=o[0]-1:o[0]+=1,h=re([s.rowIndex,s.colIndex,s.rowIndex,o[3]]),l="Down"):(o[1]===o[3]?s.colIndex=o[1]-1:o[1]+=1,l="Right",h=re([s.rowIndex,s.colIndex,o[2],s.colIndex])),s.rowIndex<0||s.colIndex<0)return;this.parent.notify(_s,{fillType:se(s.rowIndex,s.colIndex,n,!1,!0).formula?"FillSeries":"CopyCells",dAutoFillCell:h,rangeInfo:{direction:l,startCell:s,endCell:{rowIndex:o[2],colIndex:o[3]},fillRange:o}}),this.parent.notify(dn,{type:"mousedown"}),this.parent.notify(qr,null)}}else this.parent.isEdit||(e.preventDefault(),this.parent.notify(ma,{isUndo:!1}));else this.parent.isEdit||(e.preventDefault(),this.parent.notify(ma,{isUndo:!0}));else{var h=n.rows[a[0]],l=void 0;e.preventDefault(),ee.isNullOrUndefined(h)||(l=h.cells[a[1]]),ee.isNullOrUndefined(l)&&Vi(a[0],a[1],n,l,!1),l&&l.hyperlink?this.parent.notify(na,null):this.parent.notify(ra,null)}else this.parent.notify(ko,{promise:Promise});var d,s=n.isProtected&&Mn(se(a[0],a[1],n),de(n,a[1]));70===e.keyCode&&!r&&this.parent.allowFindAndReplace&&(e.preventDefault(),this.parent.notify(vt,{})),s&&n.isProtected&&86!==e.keyCode||70===e.keyCode||r||(71===e.keyCode?(e.preventDefault(),this.parent.notify(Ua,null)):72===e.keyCode?(e.preventDefault(),this.parent.notify(Ha,null)):88===e.keyCode?this.parent.notify(Fo,{promise:Promise}):86===e.keyCode&&this.parent.notify(Oo,{isAction:!0}),!e.shiftKey)||76!==e.keyCode||this.parent.isEdit||n.isProtected||(e.preventDefault(),this.parent.notify(xa,{})),r||n.isProtected&&!n.protectSettings.formatCells||(66===e.keyCode?(e.preventDefault(),d=this.parent.getCellStyleValue(["fontWeight"],a).fontWeight,this.parent.notify(Et,{style:{fontWeight:d="bold"===d?"normal":"bold"},onActionUpdate:!0,refreshRibbon:!0})):73===e.keyCode?(e.preventDefault(),d=this.parent.getCellStyleValue(["fontStyle"],a).fontStyle,this.parent.notify(Et,{style:{fontStyle:d="italic"===d?"normal":"italic"},onActionUpdate:!0,refreshRibbon:!0})):e.ctrlKey&&85===e.keyCode&&!e.shiftKey?(e.preventDefault(),this.parent.notify(Rt,{style:{textDecoration:"underline"},refreshRibbon:!0})):e.ctrlKey&&53===e.keyCode&&!e.shiftKey&&(e.preventDefault(),this.parent.notify(Rt,{style:{textDecoration:"line-through"},refreshRibbon:!0})))}27===e.keyCode&&this.parent.notify(Ao,null),((e.ctrlKey||e.metaKey)&&119===e.keyCode||13===e.keyCode&&i.classList.contains("e-drop-icon"))&&this.parent.showRibbon&&(e.preventDefault(),o=this.parent.element.querySelector(".e-drop-icon"))&&o.click(),!e.ctrlKey&&!e.metaKey||r||(57===e.keyCode?n.isProtected&&!n.protectSettings.formatRows||(e.preventDefault(),a=te(n.selectedRange),this.parent.notify(Pr,{startIndex:a[0],endIndex:a[2],hide:!e.shiftKey,isCol:!1,actionUpdate:!0})):48!==e.keyCode||n.isProtected&&!n.protectSettings.formatColumns||(a=te(n.selectedRange),this.parent.notify(Pr,{startIndex:a[1],endIndex:a[3],hide:!e.shiftKey,isCol:!0,actionUpdate:!0}))),e.shiftKey&&!r&&(113!==e.keyCode||n.isProtected?114===e.keyCode?(e.preventDefault(),this.parent.notify(Js,null)):116===e.keyCode&&this.parent.allowFindAndReplace?(e.preventDefault(),this.parent.notify(vt,{})):121===e.keyCode&&(t=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 t.includes(e)}))&&this.focusTarget(n):(e.preventDefault(),0<e.target.children.length&&"string"==typeof e.target.children[e.target.children.length-1].className&&-1<e.target.children[e.target.children.length-1].className.indexOf("e-addNoteIndicator")?this.parent.notify(aa,null):this.parent.notify(oa,null))),e.altKey&&!r&&((e.ctrlKey||e.metaKey)&&78===e.keyCode?(e.preventDefault(),this.parent.refresh(!0)):113===e.keyCode&&this.parent.saveUrl&&(e.preventDefault(),this.parent.notify(yt,null))),(e.ctrlKey||e.metaKey)&&e.shiftKey&&!r&&(n.isProtected&&!n.protectSettings.formatCells||(h=n.selectedRange,l=void 0,192===e.keyCode?l="General":52===e.keyCode?l=Pl("CurrencyWithColorCode"):53===e.keyCode?l="0%":54===e.keyCode?l=Pl("Scientific"):51===e.keyCode?l="dd-mmm-yy":50===e.keyCode?l="h:mm AM/PM":49===e.keyCode?l=Pl("Number"):55===e.keyCode&&(e.preventDefault(),this.parent.notify(Et,{style:{border:"1px solid #000000"},onActionUpdate:!0,borderType:"Outer"})),!l)||Xd(this.parent,ne(te(h)))||(d={range:n.name+"!"+(s={format:l,range:h,cancel:!1,requestType:"NumberFormat"}).range,format:s.format,requestType:"NumberFormat"},this.parent.trigger("beforeCellFormat",s),this.parent.notify(gt,{eventArgs:s,action:"format"}),s.cancel)||(this.parent.notify(xt,s),this.parent.notify(dn,{type:"mousedown"}),this.parent.notify(le,{eventArgs:d,action:"format"}),this.parent.notify(qr,null)),85===e.keyCode)&&(e.preventDefault(),i=this.parent.element.querySelector(".e-formula-bar-panel .e-drop-icon"))&&i.click(),122!==e.keyCode||!e.shiftKey||e.ctrlKey||this.parent.isProtected||this.parent.notify(lr,{model:this.parent,start:this.parent.activeSheetIndex+1,end:this.parent.activeSheetIndex+1,modelType:"Sheet",isAction:!0,activeSheetIndex:this.parent.activeSheetIndex+1}),e.shiftKey&&e.altKey&&75===e.keyCode&&this.parent.showSheetTabs&&this.parent.element.querySelector(".e-sheets-list").click()}},wp.prototype.focusTarget=function(e){var t,r,n,i,o,a,s,l,h,d=ne(te(e.selectedRange)),p=0===d[1]&&d[3]===e.colCount-1,c=0===d[0]&&d[2]===e.rowCount-1;(t=p&&c?this.parent.element.querySelector(".e-selectall"):p?(i=this.parent.frozenRowCount(e),d[0]<i?(r=this.parent.getRow(d[0],this.parent.sheetModule.getSelectAllTable()))&&r.cells[0]:(d[0]=Y(e,d[0],!0),a=Y(e,te(e.paneTopLeftCell)[0],!0),s=qd(this.parent,a).index,n=void 0,(n=d[0]>a&&d[0]<s?this.parent.getRow(d[0],this.parent.getRowHeaderTable()):d[0]>=s?this.parent.getRow(s-1,this.parent.getRowHeaderTable()):this.parent.getRow(a+1,this.parent.getRowHeaderTable()))&&n.cells[0])):c?(o=this.parent.frozenColCount(e),d[1]<o?(r=this.parent.element.querySelector(".e-selectall-container .e-header-row"))&&this.parent.getCell(0,d[1],r):(d[1]=Y(e,d[1],!0,"columns"),l=Y(e,te(e.paneTopLeftCell)[1],!0,"columns"),h=Wd(this.parent,l),n=this.parent.element.querySelector(".e-column-header .e-header-row"),d[1]>l&&d[1]<h?n&&this.parent.getCell(0,d[1],n):d[1]>=h?n&&this.parent.getCell(0,h-1,n):n&&this.parent.getCell(0,l+1,n))):(p=te(e.paneTopLeftCell),t=this.parent.getCell(d[0],d[1]),i=this.parent.frozenRowCount(e),o=this.parent.frozenColCount(e),(t=d[0]<i&&d[1]<o?this.parent.getCell(d[0],d[1]):d[0]<i?(l=te(e.paneTopLeftCell)[1],h=Wd(this.parent,l),d[1]>l&&d[1]<h?this.parent.getCell(d[0],d[1]):d[1]>=h?this.parent.getCell(d[0],h-1):this.parent.getCell(d[0],l+1)):d[1]<o?(a=te(e.paneTopLeftCell)[0],s=qd(this.parent,a).index,d[0]>a&&d[0]<s?this.parent.getCell(d[0],d[1]):d[0]>=s?this.parent.getCell(s-1,d[1]):this.parent.getCell(a+1,d[1])):(a=te(e.paneTopLeftCell)[0],s=qd(this.parent,a).index,l=te(e.paneTopLeftCell)[1],h=Wd(this.parent,l),d[0]>a&&d[0]<s?d[1]>l&&d[1]<h?this.parent.getCell(d[0],d[1]):d[1]>=h?this.parent.getCell(d[0],h-1):this.parent.getCell(d[0],l+1):d[0]>=s?d[1]>l&&d[1]<h?this.parent.getCell(s-1,d[1]):d[1]>=h?this.parent.getCell(s-1,h-1):this.parent.getCell(s-1,l+1):d[1]>l&&d[1]<h?this.parent.getCell(a+1,d[1]):d[1]>=h?this.parent.getCell(a+1,h-1):this.parent.getCell(a+1,l+1)))||this.parent.getCell(p[0]+1,p[1]+1)))&&ce(t)},wp.prototype.getModuleName=function(){return"keyboardShortcut"},wp.prototype.destroy=function(){this.removeEventListener(),this.parent=null};var Sp=wp;function wp(e){this.parent=e,this.addEventListener()}Ep.prototype.applyCellFormat=function(t){var e,r,n,i,o,a,s;t.checkHeight?(this.checkHeight||(this.checkHeight=!0),this.updateRowHeight(t.rowIdx,t.colIdx,t.lastCell,t.onActionUpdate,t.outsideViewport)):(r=Object.keys(t.style),e=this.parent.getActiveSheet(),t.lastCell&&!r.length&&Vd(e,t.rowIdx)<=(e.standardHeight||20)||((r=t.td||this.parent.getCell(t.rowIdx,t.colIdx))?(this.updateMergeBorder(t,e),n=void 0,t.formatColor&&r.style.color===t.formatColor&&(n=t.style.color,delete t.style.color),void 0!==t.style.border||void 0!==t.style.borderTop||void 0!==t.style.borderLeft?(i={},Object.keys(t.style).forEach(function(e){i[""+e]=t.style[""+e]}),void 0!==i.border&&(Object.assign(r.style,{borderRight:t.style.border,borderBottom:t.style.border}),this.setLeftBorder(t.style.border,r,t.rowIdx,t.colIdx,t.row,t.onActionUpdate,t.first,e),this.setTopBorder(t.style.border,r,t.rowIdx,t.colIdx,t.pRow,t.pHRow,t.onActionUpdate,t.first,t.lastCell,t.manualUpdate,e),delete i.border),void 0!==i.borderTop&&(this.setTopBorder(t.style.borderTop,r,t.rowIdx,t.colIdx,t.pRow,t.pHRow,t.onActionUpdate,t.first,t.lastCell,t.manualUpdate,e),delete i.borderTop),void 0!==i.borderLeft&&(this.setLeftBorder(t.style.borderLeft,r,t.rowIdx,t.colIdx,t.row,t.onActionUpdate,t.first,e),delete i.borderLeft),Object.keys(i).length&&(void 0!==i.borderBottom&&this.setThickBorderHeight(i.borderBottom,t.rowIdx,t.colIdx,r,t.row,t.hRow,t.onActionUpdate,t.lastCell,t.manualUpdate),Object.assign(r.style,i))):(void 0!==t.style.borderBottom&&this.setThickBorderHeight(t.style.borderBottom,t.rowIdx,t.colIdx,r,t.row,t.hRow,t.onActionUpdate,t.lastCell,t.manualUpdate),Object.assign(r.style,t.style),r&&r.querySelector(".e-cf-databar")&&t.style.verticalAlign&&(r.querySelector(".e-databar-value").style.alignItems="top"===t.style.verticalAlign?"start":"middle"===t.style.verticalAlign?"center":"end"),(o=se(t.rowIdx,t.colIdx,e))&&(o.rowSpan||o.colSpan)&&0<r.offsetHeight&&(s=Td(this.parent,o.style||this.parent.cellStyle))>r.offsetHeight&&Ad(this.parent,e,r.offsetHeight,t.rowIdx)),o=se(t.rowIdx,t.colIdx,e,null,!0),e.rows[t.rowIdx]&&e.rows[t.rowIdx].customHeight?o.wrap||!t.style.fontSize&&!t.style.fontFamily||((a=kh(e,t.rowIdx,!0)-Md(t.rowIdx,t.colIdx,e))<Td(this.parent,o.style)?r.style.lineHeight=a+"px":r.style.lineHeight&&(r.style.lineHeight="")):t.isHeightCheckNeeded&&(t.manualUpdate?(this.checkHeight||(this.checkHeight=Hn(t.style,t.onActionUpdate)),r&&r.children[0]&&"e-cf-databar"===r.children[0].className&&t.style.fontSize&&(r.children[0].querySelector(".e-databar-value").style.fontSize=t.style.fontSize),t.isFromAutoFillOption||this.updateRowHeight(t.rowIdx,t.colIdx,t.lastCell,t.onActionUpdate),o.wrap&&(t.style.fontSize||t.style.fontFamily)&&(r.style.lineHeight=parseFloat(o.style&&o.style.fontSize||this.parent.cellStyle.fontSize)*Dd(o.style&&o.style.fontFamily?o.style:this.parent.cellStyle)+"pt")):(!o.wrap&&Hn(t.style)&&Hd(e,t.rowIdx,t.colIdx,Ud(this.parent,t.rowIdx,t.colIdx,e,t.style)),t.lastCell&&(s=Vd(e,t.rowIdx),(e.standardHeight||20)<s)&&s>kh(e,t.rowIdx)&&Ad(this.parent,e,s,t.rowIdx,t.row,t.hRow))),void 0!==n&&(t.style.color=n)):this.updateRowHeight(t.rowIdx,t.colIdx,!0,t.onActionUpdate)))},Ep.prototype.updateRowHeight=function(e,t,r,n,i){if(this.checkHeight){var o=this.parent.getActiveSheet(),a=se(e,t,o,null,!0);if(!a.rowSpan){var s=0,s=Ud(this.parent,e,t,o,a.style||this.parent.cellStyle,a.wrap&&!a.colSpan?Pd(this.parent.getDisplayText(a),Bd(o,e,t),a.style,this.parent.cellStyle):1),l=a.value&&a.value.toString();if(l&&-1<l.indexOf("\n")){for(var h=void 0,d=l.split("\n"),p=0,c=d.length,h=0;h<c;h++){var u=Pd(d[h],Bd(o,e,t),a.style,this.parent.cellStyle);p+=u=0===u?1:u}s=Ud(this.parent,e,t,o,a.style||this.parent.cellStyle,p)}var l=o&&o.standardHeight?o.standardHeight:20;Hd(o,e,t,s=s<l?l:s),i||(l=this.parent.getCell(e,t))&&l.children[0]&&"e-cf-databar"===l.children[0].className&&(l.children[0].style.height="100%",l.children[0].firstElementChild.nextElementSibling.style.height="100%"),r&&(this.checkHeight=!1,s=Vd(o,e),l=kh(o,e),n?s!==l:l<s)&&Ad(this.parent,o,s,e,null,null,!0,i)}}},Ep.prototype.updateMergeBorder=function(e,t){var r,n=se(e.rowIdx,e.colIdx,t,null,!0),i={range:[e.rowIdx,e.colIdx,e.rowIdx,e.colIdx]};this.parent.notify(Dr,i),1<n.rowSpan&&!e.style.borderBottom&&(r=se(i.range[2],i.range[1],t,null,!0)).style&&r.style.borderBottom&&(e.style.borderBottom=r.style.borderBottom),1<n.colSpan&&!e.style.borderRight&&(r=se(i.range[0],i.range[3],t,null,!0)).style&&r.style.borderRight&&(e.style.borderRight=r.style.borderRight)},Ep.prototype.setLeftBorder=function(e,t,r,n,i,o,a,s){a&&a.includes("Column")||((a=this.parent.enableRtl?this.parent.getCell(r,n+1,i):this.parent.getCell(r,n-1,i))?(i=se(r,n-1,s,!1,!0)).rowSpan&&1!==i.rowSpan||i.colSpan&&1!==i.colSpan?(this.parent.notify(Dr,r={range:[r,n-1,r,n-1]}),(i=se(r.range[0],r.range[1],s,!1,!0)).style&&i.style.borderRight&&"none"!==i.style.borderRight||(i=se(r.range[0],r.range[3],s,null,!0)).style&&i.style.borderRight&&"none"!==i.style.borderRight||(t.style.borderLeft=e)):(o&&""!==e&&n===this.parent.viewport.leftIndex&&(this.parent.getMainContent().scrollLeft-=this.getBorderSize(e)),a.style.borderRight="none"===e?a.style.borderRight:e):t.style.borderLeft=e)},Ep.prototype.setTopBorder=function(e,t,r,n,i,o,a,s,l,h,d){if(!s||!s.includes("Row")){var s=n,p=se(r,n,d,!1,!0),s=(1<p.colSpan&&pe(d,n)&&(s=Y(d,n,!0,"columns"))>n+p.colSpan-1&&(s=n),this.parent.getCell(r-1,s,i));if(s)if((p=se(r-1,n,d,!1,!0)).rowSpan&&1!==p.rowSpan||p.colSpan&&1!==p.colSpan){var c={range:[r-1,n,r-1,n]};this.parent.notify(Dr,c),(p=se(c.range[0],c.range[1],d,!1,!0)).style&&p.style.borderBottom&&"none"!==p.style.borderBottom||(p=se(c.range[2],c.range[1],d,null,!0)).style&&p.style.borderBottom&&"none"!==p.style.borderBottom||(t.style.borderTop=e)}else{if(he(d,r-1)){c=[Number(s.parentElement.getAttribute("aria-rowindex"))-1,n];if(this.parent.getCellStyleValue(["bottomPriority"],c).bottomPriority)return}a&&""!==e&&d.topLeftCell.includes(""+(r+1))&&(this.parent.getMainContent().parentElement.scrollTop-=this.getBorderSize(e)),this.setThickBorderHeight(e,r-1,n,s,i,o,a,l,h),s.style.borderBottom="none"===e?s.style.borderBottom:e}else t.style.borderTop=e}},Ep.prototype.setThickBorderHeight=function(e,t,r,n,i,o,a,s,l){var e=e?this.getBorderSize(e):1,h=this.parent.getActiveSheet();!(2<e)||h.rows[t]&&h.rows[t].customHeight||(l?(this.checkHeight||(this.checkHeight=!0),this.updateRowHeight(t,r,s,a)):kh(h,t)<(l=Math.ceil(this.parent.calculateHeight(this.parent.getCellStyleValue(["fontFamily","fontSize"],[t,r]),1,3)))&&Ad(this.parent,h,l,t,i,o)),!a||!s&&this.checkHeight||!(e<3)||h.rows[t]&&h.rows[t].customHeight||(this.checkHeight||(this.checkHeight=!0),this.updateRowHeight(t,r,s,a))},Ep.prototype.getBorderSize=function(e){e=e.split(" ")[0];return"thin"===e?1:"medium"===e?2:"thick"===e?3:parseInt(e,10)||1},Ep.prototype.clearObj=function(e){function t(){e.isAction&&a.parent.notify(gt,{action:"beforeClear",eventArgs:m})}function r(){e.isAction&&(m={range:p.name+"!"+l,type:s.type,sheetIndex:h},o&&(m.cfClearActionArgs=o.cfClearActionArgs),a.parent.notify(le,{eventArgs:m,action:"clear"}))}var n,i,o,a=this,s=e.options,l=s.range?0<s.range.indexOf("!")?s.range.substring(s.range.lastIndexOf("!")+1):s.range:this.parent.getActiveSheet().selectedRange,h=s.range&&0<s.range.indexOf("!")?B(this.parent,s.range.substring(0,s.range.lastIndexOf("!"))):this.parent.activeSheetIndex,d=ne(te(l)),p=this.parent.sheets[h],c=d[0],u=d[2],f=this.parent.element.getElementsByClassName("e-ss-overlay-active"),g=0<f.length,m={range:l,type:s.type,requestType:"clear",sheetIndex:h},v="Clear All"===s.type;if(g)f[0].classList.contains("e-datavisualization-chart")?"Clear Contents"!==s.type&&!v||(t(),this.parent.notify(vs,{id:f[0].id,sheetIdx:this.parent.activeSheetIndex+1}),r()):v&&(t(),this.parent.notify(ms,{id:f[0].id,sheetIdx:this.parent.activeSheetIndex+1}),r());else{if(t(),"Clear Formats"===s.type||v)for(o={range:l,sheetIdx:h,isClear:!0},this.parent.notify(Ur,o),e.cfClearActionArgs=o.cfClearActionArgs,v&&(this.parent.notify(pr,{range:l,isRemoveValidation:!0,viewport:this.parent.viewport}),0===c)&&0===d[1]&&u>=p.usedRange.rowIndex&&d[3]>=p.usedRange.colIndex&&this.parent.setUsedRange(c,d[1],p,!1,!0);c<=u;c++)for(n=d[1],i=d[3];n<=i;n++){var y=se(c,n,p),C=this.parent.getCell(c,n);y&&(v&&y.formula&&this.parent.notify(Wt,{cellRef:re([c,n,c,n])}),y.wrap&&this.parent.notify(ir,{range:[c,n,c,n],wrap:!1,sheet:p}),y.hyperlink)&&(C&&ee.removeClass(C.querySelectorAll(".e-hyperlink"),"e-hyperlink-style"),v)&&this.parent.removeHyperlink(p.name+"!"+re([c,n,c,n]))}"Clear Hyperlinks"===s.type&&this.parent.removeHyperlink(p.name+"!"+l),this.parent.notify(Hr,{range:p.name+"!"+l,type:s.type}),this.parent.serviceLocator.getService("cell").refreshRange(ne(te(l)),!1,!1,!1,!1,Jn(this.parent),!v),this.parent.notify(cr,{range:l,isclearFormat:!0}),e.isFromUpdateAction||this.parent.notify(No,{address:l}),this.parent.notify(Pt,null),r()}},Ep.prototype.addEventListener=function(){this.parent.on(Ft,this.applyCellFormat,this),this.parent.on(rs,this.clearObj,this)},Ep.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(Ft,this.applyCellFormat),this.parent.off(rs,this.clearObj))},Ep.prototype.destroy=function(){this.removeEventListener(),this.parent=null,this.checkHeight=null},Ep.prototype.getModuleName=function(){return"cellformat"};var Ip=Ep;function Ep(e){this.checkHeight=!1,this.parent=e,this.addEventListener()}Rp.prototype.addEventListener=function(){this.parent.on(to,this.wireEvents,this),this.parent.on(Qo,this.autoFit,this),this.parent.on(Aa,this.setAutoFitHandler,this),this.parent.on(el,this.propertyChange,this)},Rp.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)},Rp.prototype.wireEvents=function(){var e=this.parent.getRowHeaderContent(),t=this.parent.element.getElementsByClassName("e-header-panel")[0];t&&(ee.EventHandler.add(t,"dblclick",this.dblClickHandler,this),ee.EventHandler.add(e,"dblclick",this.dblClickHandler,this),ee.EventHandler.add(t,"mousedown",this.mouseDownHandler,this),ee.EventHandler.add(e,"mousedown",this.mouseDownHandler,this),this.wireResizeCursorEvent(e,t))},Rp.prototype.wireResizeCursorEvent=function(e,t){ee.EventHandler.add(e,"mousemove",this.setTarget,this),ee.EventHandler.add(t,"mousemove",this.setTarget,this)},Rp.prototype.unWireResizeCursorEvent=function(){ee.EventHandler.remove(this.parent.getRowHeaderContent(),"mousemove",this.setTarget);var e=this.parent.element.getElementsByClassName("e-header-panel")[0];e&&ee.EventHandler.remove(e,"mousemove",this.setTarget)},Rp.prototype.unwireEvents=function(){var e=this.parent.getRowHeaderContent(),t=this.parent.element.getElementsByClassName("e-header-panel")[0];t&&(ee.EventHandler.remove(t,"dblclick",this.dblClickHandler),ee.EventHandler.remove(e,"dblclick",this.dblClickHandler),ee.EventHandler.remove(t,"mousedown",this.mouseDownHandler),ee.EventHandler.remove(e,"mousedown",this.mouseDownHandler),this.unWireResizeCursorEvent())},Rp.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(to,this.wireEvents),this.parent.off(Qo,this.autoFit),this.parent.off(Aa,this.setAutoFitHandler),this.parent.off(el,this.propertyChange))},Rp.prototype.mouseMoveHandler=function(e){var t,r=this.parent.element.getElementsByClassName("e-colresize-handler")[0],n=this.parent.element.getElementsByClassName("e-rowresize-handler")[0];this.resizeTooltip(null,!0,e),(r||n)&&(this.isMouseMoved=!0,t=this.parent.enableRtl,r?(t?e.x<this.trgtEle.parentElement.firstChild.getBoundingClientRect().right:e.x>this.trgtEle.parentElement.firstChild.getBoundingClientRect().left)&&(r.style.left=e.clientX-document.getElementById(this.parent.element.id+"_sheet").getBoundingClientRect().left+"px"):n&&e.y>=this.trgtEle.parentElement.parentElement.firstChild.getBoundingClientRect().top&&(n.style.top=e.clientY-document.getElementById(this.parent.element.id+"_sheet").getBoundingClientRect().top+"px"))},Rp.prototype.mouseDownHandler=function(e){var t,r;ee.closest(e.target,".e-header-cell")&&!e.target.className.includes("e-filter-icon")&&(this.event=e,this.trgtEle=e.target,(this.trgtEle.parentElement.classList.contains("e-hide-end")||this.trgtEle.classList.contains("e-hide-end"))&&(t=this.trgtEle.offsetHeight,r=e.offsetY,10<=t&&r<5||t-2<8&&r<Math.ceil((r-2)/2))&&this.trgtEle.classList.add("e-skip-resize"),this.updateTarget(e,this.trgtEle),r=(t=this.trgtEle).classList.contains("e-colresize")?"e-colresize-handler":t.classList.contains("e-rowresize")?"e-rowresize-handler":"",this.createResizeHandler(t,r),this.unWireResizeCursorEvent(),ee.EventHandler.add(this.parent.element,"mousemove",this.mouseMoveHandler,this),ee.EventHandler.add(document,"mouseup",this.mouseUpHandler,this))},Rp.prototype.mouseUpHandler=function(e){var t=this.parent.element.getElementsByClassName("e-resize-handle")[0],e=(this.resizeOn(e),this.isMouseMoved=null,document.querySelector(".e-header-tooltip")),t=(t&&(ee.detach(t),this.updateCursor()),e&&e.remove(),ee.EventHandler.remove(document,"mouseup",this.mouseUpHandler),ee.EventHandler.remove(this.parent.element,"mousemove",this.mouseMoveHandler),this.parent.element.getElementsByClassName("e-header-panel")[0]);t&&this.wireResizeCursorEvent(this.parent.getRowHeaderContent(),t),this.parent.notify(js,null),this.parent.notify(zs,null)},Rp.prototype.dblClickHandler=function(e){var t;ee.closest(e.target,".e-header-cell")&&!e.target.className.includes("e-filter-icon")&&(this.trgtEle=e.target,this.updateTarget(e,this.trgtEle),this.trgtEle.classList.contains("e-colresize")?(e=parseInt(this.trgtEle.getAttribute("aria-colindex"),10)-1,t=Bh(this.parent.getActiveSheet(),e)+"px",this.trgtEle.classList.contains("e-unhide-column")?this.showHiddenColumns(e-1):this.setAutofit(e,!0,t,this.trgtEle)):this.trgtEle.classList.contains("e-rowresize")&&(e=parseInt(this.trgtEle.parentElement.getAttribute("aria-rowindex"),10)-1,t=kh(this.parent.getActiveSheet(),e)+"px",this.setAutofit(e,!1,t)),this.parent.notify(js,null))},Rp.prototype.setTarget=function(e){if(ee.closest(e.target,".e-header-cell")&&!e.target.className.includes("e-filter-icon")){var t,r,n,i,o,a=e.target,s=this.parent.getActiveSheet();if(s.isProtected&&(!s.protectSettings.formatColumns||!s.protectSettings.formatRows)){if(!s.protectSettings.formatRows&&!s.protectSettings.formatColumns)return;if(s.protectSettings.formatRows&&ee.closest(a,".e-colhdr-table"))return;if(s.protectSettings.formatColumns&&ee.closest(a,".e-rowhdr-table"))return}if(ee.closest(a,".e-header-row")?(r=a.offsetWidth,n="e-colresize",i=this.parent.enableRtl?r-e.offsetX:e.offsetX,(o=this.getColPrevSibling(a))&&!o.classList.contains("e-select-all-cell")?t=o:1<Number(a.getAttribute("aria-colindex"))&&(t=a)):ee.closest(a,".e-row")&&(i=e.offsetY,r=a.offsetHeight,n="e-rowresize",(o=this.getRowPrevSibling(a))?t=o.firstElementChild:1<Number(a.parentElement.getAttribute("aria-rowindex"))&&(t=a)),r-2<8&&i!==Math.ceil((r-2)/2))i<Math.ceil((r-2)/2)?(a.classList.add(n),t&&t.classList.add(n)):i>Math.ceil((r-2)/2)&&a.classList.add(n);else if(r-5<i&&i<=r&&10<=r)a.classList.add(n);else if(i<5&&t&&10<=r)a.classList.add(n),t.classList.add(n);else for(var l=this.parent.element.getElementsByClassName(n),h=0;h<l.length;h++)l[h].classList.remove(n)}},Rp.prototype.getColPrevSibling=function(e){var t=this.parent.frozenColCount(this.parent.getActiveSheet());return e.previousElementSibling||(t&&ee.closest(e,".e-column-header")?this.parent.getSelectAllContent().querySelector(".e-header-row").lastElementChild:null)},Rp.prototype.getRowPrevSibling=function(e){var t=this.parent.frozenRowCount(this.parent.getActiveSheet());return e.parentElement.previousElementSibling||(t&&ee.closest(e,".e-row-header")?this.parent.getSelectAllContent().querySelector("tbody").lastElementChild:null)},Rp.prototype.updateTarget=function(e,t){var r,n,i,o;ee.closest(t,".e-header-row")?(o=this.parent.enableRtl?t.offsetWidth-e.offsetX:e.offsetX,(t.offsetWidth<10&&o<Math.ceil((t.offsetWidth-2)/2)||o<5&&10<=t.offsetWidth&&t.classList.contains("e-colresize"))&&(r=this.parent.getActiveSheet(),n=Number(this.trgtEle.getAttribute("aria-colindex"))-2,(i=this.getColPrevSibling(t))&&!pe(r,n)?this.trgtEle=i:-1<n&&this.trgtEle.classList.add("e-unhide-column"))):(t.offsetHeight<10&&e.offsetY<Math.ceil((t.offsetHeight-2)/2)||e.offsetY<5&&10<=t.offsetHeight&&t.classList.contains("e-rowresize"))&&(r=this.parent.getActiveSheet(),n=Number(t.parentElement.getAttribute("aria-rowindex"))-2,(i=this.getRowPrevSibling(t))||he(r,n))&&("dblclick"===e.type&&he(r,n)?(o=void 0,o=n<=(t=ne(te(r.selectedRange)))[2]&&n>t[0]&&On(r,t)?{startIndex:t[0],endIndex:t[2],hide:!1,autoFit:!0}:{startIndex:n,endIndex:n,hide:!1,autoFit:!0},this.parent.notify(Pr,o)):he(r,n)||(this.trgtEle=i.getElementsByClassName("e-header-cell")[0]))},Rp.prototype.setAutoFitHandler=function(e){e.isCol&&pe(this.parent.getActiveSheet(),e.idx)?this.showHiddenColumns(e.idx):this.setAutofit(e.idx,e.isCol,null,null,e.sheetIdx)},Rp.prototype.getWrapText=function(e,r,n){function i(){var e=parseInt(h.toString(),10);(t<e||e===t&&Ld(p.trim(),n,a.parent.cellStyle)>Ld(d,n,a.parent.cellStyle))&&(d=p.trim(),t=e)}var o,a=this,s=e.toString().split(" "),l=Ld(" ",n,this.parent.cellStyle),t=0,h=0,d=e,p="";return s.forEach(function(e,t){o=Ld(e,n,a.parent.cellStyle),1<(h+o)/r?(i(),p="",h=o):h+=o+=1<=(h+o+l)/r?0:l,p+=e+" ",t===s.length-1&&i()}),d},Rp.prototype.setAutofit=function(e,t,r,n,i){var o,a=this,s=ee.isNullOrUndefined(i)?this.parent.getActiveSheet():ae(this.parent,i),i=!!ee.isNullOrUndefined(i)||i===this.parent.activeSheetIndex;if(n){var l={cancel:!1,index:e,isCol:t,sheetIndex:this.parent.activeSheetIndex};if(t?(l.oldWidth=r,l.autoFitWithHeader=!1):l.oldHeight=r,this.parent.notify(gt,{eventArgs:l,action:"resizeToFit"}),l.cancel)return;l=l.autoFitWithHeader}var h,d,p,c={},u=this.parent.createElement("table",{className:this.parent.getContentTable().className+" e-resizetable",styles:"height: auto"}),f=this.parent.createElement("tbody"),g=this.parent.createElement("tr",{className:"e-row"}),m=this.parent.createElement("td",{className:"e-cell"}),v=0;if(t){u.style.width="auto";var y,C=function(e){(h=m.cloneNode()).textContent=e,h.style.fontFamily=c.style&&c.style.fontFamily||a.parent.cellStyle.fontFamily,h.style.fontSize=c.style&&c.style.fontSize||a.parent.cellStyle.fontSize,h.style.fontWeight=c.style&&c.style.fontWeight||a.parent.cellStyle.fontWeight,(y=g.cloneNode()).appendChild(h),f.appendChild(y)};l&&C(n.textContent);for(var b=0,x=s.rows.length;b<x;b++)(c=se(b,e,s))&&c.value&&(c.wrap?(d=!0,C(this.getWrapText(this.parent.getDisplayText(c),Bd(s,e,e,1<c.colSpan?e+c.colSpan-1:e),c.style))):C(this.parent.getDisplayText(c)));o=Bh(s,e)}else{for(var S=s.rows[e]&&s.rows[e].cells?s.rows[e].cells.length:0,w=this.parent.createElement("colgroup"),I=0;I<S;I++)(c=se(e,I,s))&&(h=m.cloneNode(),c.wrap&&h.classList.add("e-wraptext"),h.textContent=this.parent.getDisplayText(c),h.style.fontFamily=c.style&&c.style.fontFamily||this.parent.cellStyle.fontFamily,h.style.fontSize=c.style&&c.style.fontSize||this.parent.cellStyle.fontSize,g.appendChild(h),v+=p=c.colSpan&&1<=c.colSpan?this.getMergedColumnsWidth(c.colSpan,I,s):c.colSpan&&c.colSpan<1?0:Bh(s,I,!1,!0),w.appendChild(this.parent.createElement("col",{styles:"width:"+p+"px"})));u.appendChild(w),f.appendChild(g),o=kh(s,e)}u.appendChild(f),v&&(u.style.width=v+"px");var E,l=this.parent.createElement("div",{className:this.parent.element.className,styles:"display: block"}),n=(l.appendChild(u),document.body.appendChild(l),u.getBoundingClientRect()),u=(document.body.removeChild(l),Math.ceil(t?n.width:n.height)),l=(t?this.getFloatingElementWidth(u+(d?1:0),e):u)||o;t?(E=0<l?-(o-l):-o,(n=this.parent.frozenColCount(s))&&e>=te(s.topLeftCell)[1]&&e<n||e>=this.parent.viewport.leftIndex+n&&e<=this.parent.viewport.rightIndex?(de(s,e).width=0<l?l:0,i&&(this.resizeStart(e,this.parent.getViewportIndex(e,!0),l+"px",t,!0,r),this.parent.notify(Yo,{threshold:E,colIdx:e}))):(i&&this.parent.notify(Yo,{threshold:E,colIdx:e}),de(s,e).width=0<l?l:0)):(E=-(o-(l=20<l?l:20)),(u=this.parent.frozenRowCount(s))&&e>=te(s.topLeftCell)[0]&&e<u||e>=this.parent.viewport.topIndex+u&&e<=this.parent.viewport.bottomIndex?(Oh(s,e,l),Rh(s,e,{customHeight:!1}),i&&(this.resizeStart(e,this.parent.getViewportIndex(e),l+"px",t,!0,r),this.parent.notify(Go,{threshold:E,rowIdx:e}))):(i&&this.parent.notify(Go,{threshold:E,rowIdx:e}),Oh(s,e,l))),i&&this.parent.selectRange(s.selectedRange)},Rp.prototype.getMergedColumnsWidth=function(e,t,r){for(var n=0,i=0;i<e;i++)n+=Bh(r,t,!1,!0),t++;return n},Rp.prototype.createResizeHandler=function(e,t){var t=this.parent.createElement("div",{className:t}),r=(t.classList.add("e-resize-handle"),document.getElementById(this.parent.element.id+"_sheet"));e.classList.contains("e-colresize")?(t.style.height=this.parent.getMainContent().parentElement.clientHeight+this.parent.getColumnHeaderContent().offsetHeight+"px",t.style.left=this.event.clientX-r.getBoundingClientRect().left+"px",t.style.top="0px"):e.classList.contains("e-rowresize")&&(t.style.width=this.parent.getMainContent().parentElement.clientWidth+"px",t.style.left="0px",t.style.top=this.event.clientY-r.getBoundingClientRect().top+"px"),r.appendChild(t),this.resizeTooltip(e,!1),this.updateCursor()},Rp.prototype.resizeTooltip=function(e,t,r){var n,i,o;t?(t=this.parent.enableRtl,o=document.querySelector(".e-header-tooltip"),n=this.parent.element.getElementsByClassName("e-colresize-handler")[0],i=this.parent.element.getElementsByClassName("e-rowresize-handler")[0],n?(n=t?Math.round(this.trgtEle.getBoundingClientRect().right)-r.clientX:r.clientX-Math.round(this.trgtEle.getBoundingClientRect().left),o&&(o.firstChild.textContent=0<n?"Width:("+n.toString()+" pixels)":"Width: 0.00")):i&&(t=r.clientY-Math.round(this.trgtEle.getBoundingClientRect().top),o)&&(o.firstChild.textContent=0<t?"Height:("+t.toString()+" pixels)":"Height: 0.00")):(n=e.classList.contains("e-colresize"),i=e.classList.contains("e-rowresize"),(n||i)&&(r=n?"e-colresize-handler":"e-rowresize-handler",o=new g.Tooltip({cssClass:"e-header-tooltip",showTipPointer:!1}),n?o.content=ee.initializeCSPTemplate(function(){return"Width:("+Math.round(e.getBoundingClientRect().width).toString()+" pixels)"}):i&&(o.content=ee.initializeCSPTemplate(function(){return"Height:("+Math.round(e.getBoundingClientRect().height).toString()+" pixels)"}),o.offsetX=-(this.parent.getMainContent().parentElement.clientWidth/2-Math.round(e.getBoundingClientRect().width))),o.appendTo("."+r),o.open(),o.refresh()))},Rp.prototype.setColWidth=function(e,t,r,n){var i=this.parent.getActiveSheet(),o=Sd(r)-n;o<0&&n<-o&&(o=-n),0<r?this.isMouseMoved&&this.trgtEle.classList.contains("e-unhide-column")?(this.showHiddenColumns(e,r),this.parent.notify(le,{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"),Mh(i,e,{width:r,customWidth:!0}),this.parent.notify(Yo,{threshold:o,colIdx:e,checkWrapCell:!0})):this.isMouseMoved&&(this.parent.hideColumn(e),this.showHideCopyIndicator(),this.parent.notify(le,{eventArgs:{index:e,width:"0px",isCol:!0,sheetIndex:this.parent.activeSheetIndex,oldWidth:n+"px",hide:!0},action:"resize"}))},Rp.prototype.showHideCopyIndicator=function(){var e=this.parent.element.getElementsByClassName("e-copy-indicator")[0],t=!1;e&&(ee.detach(e),this.parent.notify(Ws,null),t=!0),t&&this.parent.notify(to,{})},Rp.prototype.showHiddenColumns=function(e,t){var r,n,i,o=this,a=this.parent.getActiveSheet(),s=te(a.selectedRange);if(e>=s[1]&&e<=s[3]&&s[2]===a.rowCount-1&&W(a.activeCell)[0]===W(a.topLeftCell)[0]?(r=s[1],n=s[3],i=this.parent.getMainContent().querySelector("colgroup")):r=n=e,void 0!==t)for(var l=r;l<=n;l++)Mh(a,l,{width:t,customWidth:!0}),l>=this.parent.viewport.leftIndex&&l<=this.parent.viewport.rightIndex&&!pe(a,l)&&(i.children[this.parent.getViewportIndex(l,!0)].style.width=t+"px");this.trgtEle&&this.trgtEle.classList.remove("e-unhide-column");var h,s={startIndex:r,endIndex:n,hide:!1,isCol:!0,autoFit:!0};this.parent.notify(Pr,s),this.showHideCopyIndicator(),void 0===t&&(s.autoFit?this.autoFit({isRow:!1,startIndex:r,endIndex:n}):(h=function(){o.parent.off(to,h),o.autoFit({isRow:!1,startIndex:r,endIndex:n})},this.parent.on(to,h,this)))},Rp.prototype.setRowHeight=function(e,t,r,n){var i=this.parent.getActiveSheet(),o=this.parent.frozenColCount(i),o=parseInt(this.parent.getRow(e,null,o).style.height,10),a=Sd(parseInt(r,10))-o;a<0&&o<-a&&(a=-o),this.resizeStart(e,t,r,!1,!1,n),Rh(i,e,{height:0<parseInt(r,10)?parseInt(r,10):0,customHeight:!0}),this.parent.notify(Go,{threshold:a,rowIdx:e,isCustomHgt:!0})},Rp.prototype.resizeOn=function(e){var t=this,r=this.parent.getActiveSheet(),n=te(r.activeCell),i=se(n[0],n[1],r);if(this.trgtEle.classList.contains("e-rowresize")){var o=Number(this.trgtEle.parentElement.getAttribute("aria-rowindex"))-2;if(this.isMouseMoved&&he(r,o)&&this.trgtEle.classList.contains("e-skip-resize")&&e.clientY>this.trgtEle.getBoundingClientRect().top){this.trgtEle.classList.remove("e-skip-resize");var a={startIndex:o,endIndex:o,hide:!1,skipAppend:!0},s=(this.parent.notify(Pr,a),this.parent.getRowHeaderTable().tBodies[0]),l=this.parent.getContentTable().tBodies[0];a.hdrRow.style.display="none",a.row.style.display="none",s.insertBefore(a.hdrRow,s.children[a.insertIdx]),l.insertBefore(a.row,l.children[a.insertIdx]),this.trgtEle=a.hdrRow.firstElementChild,a.hdrRow.nextElementSibling.classList.remove("e-hide-end"),a.mergeCollection.forEach(function(e){t.parent.notify(Or,e)})}else if(this.trgtEle.classList.contains("e-skip-resize")){if(this.trgtEle.classList.remove("e-skip-resize"),!this.isMouseMoved&&he(r,o)||!this.trgtEle.parentElement.previousElementSibling)return;this.trgtEle=this.trgtEle.parentElement.previousElementSibling.getElementsByClassName("e-header-cell")[0]}var h=s=parseInt(this.trgtEle.parentElement.getAttribute("aria-rowindex"),10)-1,s=this.parent.getViewportIndex(h),l=this.parent.frozenColCount(r),d=this.parent.getRow(h,null,l).style.height;if((u=e.clientY-this.event.clientY+parseInt(d,10))<=0)return this.parent.hideRow(h),this.showHideCopyIndicator(),Rh(r,h,{height:0,customHeight:!0}),void this.parent.notify(le,{eventArgs:{index:h,height:"0px",isCol:!1,sheetIndex:this.parent.activeSheetIndex,oldHeight:d},action:"resize"});if(this.setRowHeight(h,s,u+"px",d),this.parent.notify(ea,{rowIndex:h}),"none"===this.trgtEle.parentElement.style.display){var p=this.parent.getActiveSheet(),c=ne(te(p.selectedRange));if(h<=c[2]&&h>c[0]){for(var u=kh(p,h),f=void 0,g=c[0];g<=c[2];g++)g!==h&&(d=kh(p,g)+"px",Rh(p,g,{customHeight:!0,height:u}),he(p,g)?f=f||g:(this.parent.getRow(g).style.height=u+"px",p.showHeaders&&(this.parent.getRow(g,this.parent.getRowHeaderTable()).style.height=u+"px")),this.parent.notify(le,{eventArgs:{index:g,height:u+"px",isCol:!1,sheetIndex:this.parent.activeSheetIndex,oldHeight:d},action:"resize"}));this.parent.hideRow(c[0],h-1,!1),this.showHideCopyIndicator(),s+=Math.abs(h-f)}else 0===s||he(p,h-1)?0!==s&&this.trgtEle.parentElement.classList.add("e-hide-end"):this.trgtEle.parentElement.previousElementSibling.classList.remove("e-hide-start"),this.parent.selectRange(p.selectedRange);this.trgtEle.parentElement.style.display="",this.parent.getContentTable().rows[s].style.display=""}}else 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),s=parseInt(this.trgtEle.getAttribute("aria-colindex"),10)-1,a=void 0,a=this.trgtEle.classList.contains("e-unhide-column")?(--s,0):Bh(this.parent.getActiveSheet(),s),this.setColWidth(s,this.parent.getViewportIndex(s,!0),(this.parent.enableRtl?this.event.clientX-e.clientX:e.clientX-this.event.clientX)+a,a));i&&i.format&&i.format.includes("*")&&this.parent.notify(St,{value:i.value,format:i.format,cell:i,formattedText:i.value,rowIndex:n[0],colIndex:n[1]})},Rp.prototype.resizeStart=function(e,t,r,n,i,o){Nd(e,t,r,n,this.parent);t=n?{index:e,width:r,isCol:n,sheetIndex:this.parent.activeSheetIndex,oldWidth:o}:{index:e,height:r,isCol:n,sheetIndex:this.parent.activeSheetIndex,oldHeight:o};e=o!==r;e&&this.parent.notify(le,{eventArgs:t,action:i?"resizeToFit":"resize"})},Rp.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")},Rp.prototype.getFloatingElementWidth=function(e,t){var r=e,n={filterRange:[],hasFilter:!1};return this.parent.notify(Oa,n),r=n.hasFilter&&n.filterRange&&n.filterRange[1]<=t&&n.filterRange[3]>=t?e+22:r},Rp.prototype.destroy=function(){this.unwireEvents(),this.removeEventListener(),this.trgtEle&&this.trgtEle.remove(),this.trgtEle=null,this.event=null,this.parent=null},Rp.prototype.getModuleName=function(){return"resize"},Rp.prototype.propertyChange=function(e){"allowResizing"===e.propertyName&&this.wireEvents()};var Np=Rp;function Rp(e){this.parent=e,this.addEventListener()}kp.prototype.hideShow=function(t){var e,r=this,n=ee.isUndefined(t.sheetIndex)?this.parent.activeSheetIndex:t.sheetIndex,i=ae(this.parent,n);if(Xd(this.parent,te(this.parent.getActiveSheet().selectedRange)))this.parent.notify(qa,null);else{if(t.startIndex>t.endIndex&&(s=t.startIndex,t.startIndex=t.endIndex,t.endIndex=s),t.actionUpdate){if(t.sheetIndex=n,this.parent.notify(gt,e={eventArgs:t,action:"hideShow"}),t.cancel)return;delete t.cancel}t.hide&&(t.hiddenIndexes=[]);var o,a,s=function(e){t.isCol?(r.hideCol(t),e&&r.parent.sheetModule.colWidthChanged({colIdx:t.startIndex,isHideShow:!0})):(r.hideRow(t),e&&r.parent.sheetModule.rowHeightChanged({rowIdx:t.startIndex,isHideShow:!0}))},n=t.isCol?this.parent.frozenColCount(i):this.parent.frozenRowCount(i);n&&t.startIndex<n?(t.freezePane=!(o=void 0),t.endIndex>=n&&(o=t.endIndex,t.endIndex=n-1),s(!0),delete t.freezePane,void 0!==o&&(a=t.startIndex,t.endIndex=o,t.startIndex=n,s(!this.parent.scrollSettings.enableVirtualization),t.startIndex=a)):s(!this.parent.scrollSettings.enableVirtualization),t.actionUpdate&&(this.updateIndexOnlyForHiddenColumnsAndRows(t,i),this.parent.notify(le,e),ce(this.parent.element))}},kp.prototype.updateIndexOnlyForHiddenColumnsAndRows=function(e,t){for(var r=e.startIndex,n=e.endIndex,i=e.startIndex;i<=n;i++)if(!1===(e.isCol?de(t,i):Nh(t,i)||{}).hidden){e.startIndex=i;break}for(var o=e.endIndex;r<=o;o--)if(!1===(e.isCol?de(t,o):Nh(t,o)||{}).hidden){e.endIndex=o;break}},kp.prototype.hideRow=function(e){var t,r,n,i,M=this,o=ee.isUndefined(e.sheetIndex)?this.parent.activeSheetIndex:e.sheetIndex,a=ae(this.parent,o),s=0,l=Object.assign({},e),h=this.parent.scrollSettings.isFinite&&!l.freezePane;if(h){if(l.startIndex>=a.rowCount)return;l.endIndex>=a.rowCount&&(l.endIndex=a.rowCount-1),i=0}var d=this.parent.frozenRowCount(a);if(l.hide){for(var p,c=void 0,u=void 0,B=[],f=[],g=h&&l.endIndex===Y(a,a.rowCount-1,!1),m=l.startIndex;m<=l.endIndex;m++)if(he(a,m))l.isFiltering&&!Fh(a,m)&&Rh(a,m,{isFiltered:!0});else if(void 0===t&&(c=l.freezePane?(p=this.parent.sheetModule.getSelectAllTable(),this.parent.getColHeaderTable()):(p=this.parent.getRowHeaderTable(),this.parent.getContentTable()),t=this.parent.getViewportIndex(m),s=0),n={hidden:!0},l.isFiltering&&(n.isFiltered=!0),l.isFiltering||(B=Yd(this.parent)),Rh(a,m,n),l.isFiltering||(f=Yd(this.parent)),o===this.parent.activeSheetIndex)if(h&&(i+=kh(a,m,!0,!0)),this.refreshChart(m,"rows"),l.isFiltering||this.refreshChartCellModel(B,f),u=c&&c.rows[t]){if(!r)for(var v=0;v<=a.usedRange.colIndex;v++)if(((L=se(m,v,a)||{}).colSpan||L.rowSpan)&&(l.startIndex>=this.parent.viewport.topIndex||this.parent.scrollSettings.enableVirtualization)){r=!0;break}if(!r&&(p.rows[t]&&ee.detach(p.rows[t]),ee.detach(u),s++,(u=c.rows[t])&&m===l.endIndex))for(var U,y,H=(y=Y(a,m+1,!0))!==Y(a,0,!0)&&y===(this.parent.viewport.topIndex>=l.startIndex?l.endIndex+1:this.parent.viewport.topIndex)?"Row":"",v=this.parent.viewport.leftIndex;v<=this.parent.viewport.rightIndex;v++)""!==(P=this.parent.getCellStyleValue(["borderTop"],[y,v]).borderTop)&&(U=u.cells[v],this.parent.notify(Ft,{onActionUpdate:!1,rowIdx:y,colIdx:v,style:{borderTop:P},row:u,pRow:u.previousElementSibling,first:H,td:U}))}else m<=this.parent.viewport.bottomIndex?s++:s--;if(!l.refreshUI)if(r&&(l.startIndex>=this.parent.viewport.topIndex||!this.parent.scrollSettings.enableVirtualization))l.isFiltering?e.refreshUI=!0:(this.parent.selectRange(a.selectedRange),a.frozenRows||a.frozenColumns?(this.parent.renderModule.refreshSheet(!1,!1,!0),e.refreshUI=!0):this.parent.renderModule.refreshUI({rowIndex:this.parent.viewport.topIndex,colIndex:this.parent.viewport.leftIndex,refresh:"Row"}));else if(s){this.parent.selectRange(a.selectedRange);var C=function(){var e;a.showHeaders&&(e=l.freezePane?1:0,t===e?p.rows[e]&&p.rows[e].classList.add("e-hide-end"):(p&&p.rows[t-1]&&p.rows[t-1].classList.add("e-hide-start"),p&&p.rows[t]&&p.rows[t].classList.add("e-hide-end")))};if(!l.freezePane&&this.parent.scrollSettings.enableVirtualization){l.startIndex,l.startIndex;if(l.startIndex<W(a.paneTopLeftCell)[0]||s>this.parent.viewport.rowCount){if(l.isFiltering)return void(e.refreshUI=!0);this.parent.updateTopLeftCell(Y(a,l.startIndex-1<d?d:l.startIndex-1,!0)-d,null,"col"),this.parent.renderModule.refreshSheet(!1,!1,!0)}else{var b=this.parent.viewport.bottomIndex+1,x=this.parent.skipHidden(b,b+s-1,"rows",!1);if(b=x[0],x=x[1],h){if(b>=a.rowCount)return void(this.parent.viewport.topIndex+d===Y(a,d,!0)?(C(),this.parent.notify(Ys,{isHide:!0,height:i}),g&&(this.parent.viewport.bottomIndex=Y(a,a.rowCount-1,!1))):this.parent.renderModule.refreshSheet(!1,!1,!0));if(x>=a.rowCount)return void this.parent.renderModule.refreshSheet(!1,!1,!0);this.parent.notify(Ys,{isHide:!0,height:i})}this.parent.viewport.bottomIndex=x;var g=void 0,S=this.parent.frozenColCount(a),w=[],g=S?(w.push(d),w.push(this.parent.viewport.leftIndex+S),W(a.topLeftCell)[1]):this.parent.viewport.leftIndex;this.parent.renderModule.refreshUI({colIndex:g,rowIndex:b,direction:"",refresh:"RowPart",frozenIndexes:w},G(b,g)+":"+G(x,this.parent.viewport.rightIndex))}}C()}}else{for(var V,I=void 0,E=void 0,u=void 0,N=void 0,j=void 0,c=void 0,R=void 0,F=void 0,k=l.startIndex-1,O=[],A=l.freezePane,T="lastElementChild",z=0,S=this.parent.viewport.topIndex+d,B=(h&&(w=Y(a,a.rowCount-1,!1),this.parent.viewport.bottomIndex===w)&&(S===Y(a,d,!0)?A=!0:(b=te(a.paneTopLeftCell)[0],a.rowCount-1-b+1-this.parent.hiddenCount(b,a.rowCount-1)<this.parent.viewport.rowCount+Math.round(this.parent.getThreshold("row")/2)&&(T="firstElementChild"))),Yd(this.parent)),m=l.startIndex,_=l.endIndex;m<=_;m++)if(he(a,m)){if(void 0!==N)_=m;else if(n={hidden:!1},l.isFiltering&&(n.isFiltered=!1),!A&&m>this.parent.viewport.bottomIndex){if(Rh(a,m,n),void 0===F)return}else if(void 0===F&&(F=m),Rh(a,m,n),o===this.parent.activeSheetIndex){h&&(i+=kh(a,m,!0,!0)),this.refreshChart(m,"rows"),void 0===t&&(I=document.createDocumentFragment(),E=document.createDocumentFragment(),j=this.parent.serviceLocator.getService("row"),l.freezePane?(R=this.parent.sheetModule.getSelectAllTable(),c=this.parent.getColHeaderTable()):(R=this.parent.getRowHeaderTable(),c=this.parent.getContentTable(),m<this.parent.viewport.topIndex+d&&(this.parent.viewport.topIndex=m-d)),t=this.parent.getViewportIndex(m)),k++,V=j.refresh(m,null,null,!0,!0),I.appendChild(V),R&&R.rows.length&&!A&&ee.detach(R.tBodies[0][""+T]),u=E.appendChild(j.refresh(m,u,V)),c&&c.rows.length&&!A&&(ee.detach(c.tBodies[0][""+T]),"firstElementChild"===T)&&(void 0!==t&&-1<t-1&&--t,z+=kh(a,this.parent.viewport.topIndex,!0),this.parent.viewport.topIndex=Y(a,this.parent.viewport.topIndex+1,!0));for(var D,L,v=this.parent.viewport.leftIndex;v<=this.parent.viewport.rightIndex;v++)void 0===(L=se(m,v,a)||{}).rowSpan&&void 0===L.colSpan||(this.parent.notify(Dr,D={range:[m,v,m,v],isAction:!1,merge:!0,type:"All",skipChecking:!0}),O.length&&D.range[1]===O[O.length-1].range[1]&&D.range[0]===O[O.length-1].range[0])||O.push(D)}}else{if(l.startIndex===l.endIndex)return;void 0===t?k++:N=m}f=Yd(this.parent);if(this.refreshChartCellModel(B,f),void 0!==t){g=void 0;if(!l.freezePane){if(l.isFiltering&&l.startIndex<W(a.paneTopLeftCell)[0]&&(e.refreshUI=!0,void 0===N||N===l.endIndex))return;x=this.parent.viewport.bottomIndex,C=(this.parent.viewport.bottomIndex=this.parent.viewport.topIndex+d+this.parent.viewport.rowCount+2*this.parent.getThreshold("row"),this.parent.hiddenCount(l.endIndex+1,this.parent.viewport.bottomIndex)),s=this.parent.hiddenCount(this.parent.viewport.topIndex+d,l.startIndex)+C;this.parent.viewport.bottomIndex+=s,h&&this.parent.viewport.bottomIndex>=a.rowCount&&(this.parent.viewport.bottomIndex=Y(a,a.rowCount-1,!1)),!l.isFiltering&&S<=F&&F<=x&&F>this.parent.viewport.bottomIndex-C-Math.abs(k-F)&&(g=!0)}if(l.insertIdx=e.insertIdx=t,l.row=e.row=E.querySelector(".e-row"),l.mergeCollection=e.mergeCollection=O,a.showHeaders&&(e.hdrRow=l.hdrRow=I.querySelector(".e-row"),0!==t&&!he(a,k-1)&&R.rows[t-1]&&R.rows[t-1].classList.remove("e-hide-start"),0!==l.startIndex&&he(a,l.startIndex-1)&&l.hdrRow.classList.add("e-hide-end"),he(a,k+1)?I.lastElementChild.classList.add("e-hide-start"):R.rows[t]&&R.rows[t].classList.remove("e-hide-end")),u&&c&&c.rows[t]){y=Y(a,k+1,!0);for(var P,q,m=this.parent.viewport.leftIndex;m<=this.parent.viewport.rightIndex;m++)""!==(P=this.parent.getCellStyleValue(["borderTop"],[y,m]).borderTop)&&(this.parent.notify(Ft,{onActionUpdate:!1,rowIdx:y,colIdx:m,style:{borderTop:P},pRow:u,td:c.rows[t].cells[m],first:""}),-1<(q=Y(a,F-1,!1))?!c.rows[t-1]||this.parent.getCellStyleValue(["borderBottom"],[q,m]).borderBottom||this.parent.getCellStyleValue(["borderTop"],[F,m]).borderTop||(c.rows[t-1].cells[m].style.borderBottom=""):c.rows[t].cells[m].style.borderTop="")}l.skipAppend||(h&&this.parent.notify(Ys,{height:i,size:z}),g||Math.abs(k-F)>this.parent.viewport.rowCount+2*this.parent.getThreshold("row")?this.parent.renderModule.refreshSheet(!1,!1,!0):(R&&(R.tBodies[0].rows.length?R.tBodies[0].insertBefore(I,R.rows[t]):R.tBodies[0].appendChild(I)),c&&c.tBodies[0]&&(c.tBodies[0].rows.length?c.tBodies[0].insertBefore(E,c.rows[t]):c.tBodies[0].appendChild(E)),this.parent.selectRange(a.selectedRange),l.autoFit&&a.showHeaders&&this.parent.notify(Qo,{startIndex:l.startIndex,endIndex:l.endIndex,isRow:!0}),O.forEach(function(e){M.parent.notify(Or,e)}),void 0!==N&&N!==l.endIndex&&(l.startIndex=N,this.hideRow(l))))}}},kp.prototype.hideCol=function(t){for(var e,r=this,n=ee.isUndefined(t.sheetIndex)?this.parent.activeSheetIndex:t.sheetIndex,i=ae(this.parent,n),o=[],a=[],s=W(i.paneTopLeftCell),l=this.parent.frozenColCount(i),h=this.parent.frozenRowCount(i),d=this.parent.viewport.leftIndex+l,p=Y(i,i.colCount-1,!1,"columns"),c=t.startIndex;c<=t.endIndex;c++){if(t.hide){if(pe(i,c))continue}else if(!pe(i,c)||t.hiddenIndexes&&-1===t.hiddenIndexes.indexOf(c))continue;var u=Yd(this.parent),f=(Mh(i,c,{hidden:t.hide}),Yd(this.parent));this.refreshChart(c,"columns"),this.refreshChartCellModel(u,f),this.parent.scrollSettings.enableVirtualization&&!t.freezePane&&(c<d||c>this.parent.viewport.rightIndex&&(!this.parent.scrollSettings.isFinite||!(p===this.parent.viewport.rightIndex&&p<=c&&c<i.colCount)))?c<d&&a.push(c):(o.push(c),t.hide&&(t.hiddenIndexes.push(c),c<=s[1])&&(e=!0))}if((a.length||o.length)&&n===this.parent.activeSheetIndex){var g,m,v=W(i.topLeftCell),n=function(){var e=r.parent.scrollSettings.enableVirtualization?[h?v[0]:r.parent.viewport.topIndex,r.parent.viewport.bottomIndex]:[0,i.rowCount-1];return m=t.freezePane?(g=r.parent.getRowHeaderTable(),r.parent.sheetModule.getSelectAllTable()):(g=r.parent.getContentTable(),r.parent.getColHeaderTable()),e};if(t.hide){if(o.length){if((o.length<=this.parent.getThreshold("col")||!this.parent.scrollSettings.enableVirtualization||t.freezePane)&&this.removeCell(i,o,n(),g,m),!t.freezePane&&this.parent.scrollSettings.enableVirtualization){if(e)return this.parent.updateTopLeftCell(null,Y(i,o[0]-1<l?l:o[0]-1,!0,"columns")-l,"row"),void this.parent.renderModule.refreshSheet(!1,!1,!0);var y=[],C=this.parent.viewport.topIndex,b=h?v[0]:C;if(h&&(y=[h+C,l]),this.parent.scrollSettings.isFinite){var x,S=Y(i,i.colCount-1,!1,"columns"),w=this.parent.viewport.leftIndex+l,I=this.parent.viewport.rightIndex;if(S<=I+o.length)return l<=(x=Y(i,w-(I+o.length-S),!1,"columns"))&&(this.parent.viewport.leftIndex=x,this.parent.viewport.leftIndex-=this.parent.hiddenCount(I,S)),this.parent.viewport.rightIndex=S,w!==this.parent.viewport.leftIndex+l||I!==this.parent.viewport.rightIndex?(this.parent.renderModule.refreshUI({colIndex:this.parent.viewport.leftIndex,refresh:"Column",frozenIndexes:y,rowIndex:b,skipUpdateOnFirst:this.parent.viewport.leftIndex+l===Y(i,l,!0,"columns")}),h&&(this.parent.viewport.topIndex=C)):this.parent.notify(xs,{refresh:"Column",isUpdate:!0}),void this.parent.selectRange(i.selectedRange)}o.length<=this.parent.getThreshold("col")?(x=this.parent.skipHidden(this.parent.viewport.rightIndex+1,this.parent.viewport.rightIndex+o.length,"columns"),this.parent.viewport.rightIndex=x[1],this.parent.renderModule.refreshUI({rowIndex:b,colIndex:x[0],direction:"",refresh:"ColumnPart",frozenIndexes:y},""+re([b,x[0],this.parent.viewport.bottomIndex,x[1]]))):(this.parent.renderModule.refreshUI({skipUpdateOnFirst:this.parent.viewport.leftIndex+l===Y(i,l,!0,"columns"),rowIndex:b,colIndex:this.parent.viewport.leftIndex,refresh:"Column",frozenIndexes:y}),h&&(this.parent.viewport.topIndex=C))}this.parent.selectRange(i.selectedRange)}}else a.length&&this.parent.scrollSettings.enableVirtualization?(a.sort(function(e,t){return e-t}),this.parent.updateTopLeftCell(null,Y(i,a[0]-1<l?l:a[0]-1,!0,"columns")-l,"row"),this.parent.renderModule.refreshSheet(!1,!1,!0),t.autoFit&&(t.autoFit=!1)):(!this.parent.scrollSettings.isFinite||this.parent.viewport.rightIndex<p)&&(o.length<=this.parent.getThreshold("col")||!this.parent.scrollSettings.enableVirtualization||t.freezePane)?(this.appendCell(i,o,n(),g,m,t.freezePane),this.parent.scrollSettings.enableVirtualization&&!t.freezePane&&this.parent.notify(mo,{refresh:"Column",prevRowColCnt:{rowCount:i.rowCount,colCount:i.colCount}}),this.parent.selectRange(i.selectedRange)):this.parent.renderModule.refreshSheet(!1,!1,!0)}},kp.prototype.removeCell=function(r,n,e,t,i){var o,a,s,l,h,d=this,p=e[0],c=e[1],u=0,f=n.length-1,g=this.parent.frozenRowCount(r),m=t.getElementsByTagName("colgroup")[0],v=this.parent.getViewportIndex(n[0],!0)+1,y=Y(r,g-1,!1);for(r.showHeaders&&(s=i.getElementsByTagName("colgroup")[0],o=i.rows[0]);p<=c;)he(r,p)?p++:(a=g&&p<g?i.rows[u+1]:t.rows[u],n.forEach(function(e,t){0===u&&g<=p&&(r.showHeaders&&(ee.detach(s.children[v]),ee.detach(o.cells[v])),ee.detach(m.children[v])),ee.detach(a.cells[v]),0===t&&(void 0!==(l=se(p,e,r,!1,!0)).colSpan&&(void 0===l.rowSpan||1<l.colSpan)||l.rowSpan<0&&-1<p-1&&he(r,p-1)&&Math.abs(l.rowSpan)===d.parent.hiddenCount(p+l.rowSpan,p,"rows",r))&&d.parent.notify(Xa,{rowIdx:p,colIdx:e,model:"col",start:n[0],end:n[f]}),t===f&&(h=Y(r,e+1,!0,"columns"),""!==(t=d.parent.getCellStyleValue(["borderLeft"],[u,h]).borderLeft)&&d.parent.notify(Ft,{onActionUpdate:!1,rowIdx:u,colIdx:h,style:{borderLeft:t},row:a,first:""}),void 0!==(l=se(p,e,r)||{}).colSpan&&(void 0===l.rowSpan||1<l.colSpan)||l.rowSpan<0&&-1<p-1&&he(r,p-1)&&Math.abs(l.rowSpan)===d.parent.hiddenCount(p+l.rowSpan,p,"rows",r))&&d.parent.notify(Xa,{rowIdx:p,colIdx:e,model:"col",start:n[0],end:n[f],isEnd:!0})}),g&&p===y?(u=0,p=this.parent.viewport.topIndex+g):(u++,p++));-1<v-1&&r.showHeaders&&o.cells[v-1]&&o.cells[v-1].classList.add("e-hide-start"),r.showHeaders&&o.cells[v]&&o.cells[v].classList.add("e-hide-end")},kp.prototype.appendCell=function(r,n,e,t,i,o){for(var a,s,l,h,d,p,c=this,u=e[0],f=e[1],g=0,m=n.length-1,v=this.parent.frozenRowCount(r),y=t.getElementsByTagName("colgroup")[0],C=(r.showHeaders&&(l=i.getElementsByTagName("colgroup")[0],a=i.rows[0]),this.parent.serviceLocator.getService("cell")),b=(n.sort(function(e,t){return e-t}),[]),x=[],S=Y(r,v-1,!1);u<=f;)he(r,u)?u++:(s=v&&u<v?i.rows[g+1]:t.rows[g],n.forEach(function(e,t){0===g&&(x[t]=c.parent.getViewportIndex(e,!0),r.showHeaders&&(h=a.cells[x[t]])&&(0===t&&n[t]&&!pe(r,n[t]-1)&&h.previousSibling&&h.previousElementSibling.classList.remove("e-hide-start"),t===m)&&h.classList.remove("e-hide-end"),v<=u)&&(y.children[x[t]]?(y.insertBefore(c.parent.sheetModule.updateCol(r,e),y.children[x[t]]),r.showHeaders&&C.renderColHeader(e,a,h)):(y.appendChild(c.parent.sheetModule.updateCol(r,e)),r.showHeaders&&C.renderColHeader(e,a)),o||(ee.detach(y.lastChild),r.showHeaders&&ee.detach(a.lastChild)),r.showHeaders)&&t===m&&(ee.detach(l),i.insertBefore(y.cloneNode(!0),i.tHead)),o||ee.detach(s.lastChild),h=s.cells[x[t]],p={rowIdx:u,colIdx:e,cell:se(u,e,r),row:s,address:G(u,e),lastCell:e===m,isHeightCheckNeeded:!0,first:e!==Y(r,0,!0,"columns")&&e===c.parent.viewport.leftIndex?"Column":"",checkNextBorder:t===m?"Column":"",checkCF:!0},h&&(p.refChild=h),p=C.render(p),0===t&&p.previousSibling&&""!==c.parent.getCellStyleValue(["borderLeft"],[g,Y(r,n[n.length-1]+1,!0,"columns")]).borderLeft&&-1<(d=Y(r,n[0]-1,!1,"columns"))&&!c.parent.getCellStyleValue(["borderRight"],[g,d]).borderRight&&!c.parent.getCellStyleValue(["borderLeft"],[g,n[0]]).borderLeft&&(p.previousSibling.style.borderRight=""),(void 0!==(d=se(u,e,r)||{}).colSpan&&(void 0===d.rowSpan||1<d.colSpan)||d.rowSpan<0&&-1<u-1&&he(r,u-1)&&Math.abs(d.rowSpan)===c.parent.hiddenCount(u+d.rowSpan,u,"rows",r))&&(t={range:[u,e,u,e],isAction:!1,merge:!0,type:"All",skipChecking:!0},c.parent.notify(Dr,t),b.length&&t.range[1]===b[b.length-1].range[1]&&t.range[0]===b[b.length-1].range[0]||b.push(t))}),v&&u===S?(u=this.parent.viewport.topIndex+v,g=0):(u++,g++));b.forEach(function(e){c.parent.notify(Or,e)}),this.parent.viewport.rightIndex=Y(r,this.parent.viewport.rightIndex-n.length,!1,"columns")},kp.prototype.refreshChart=function(e,t){this.parent.notify(Wr,{rIdx:e,showHide:t})},kp.prototype.refreshChartCellModel=function(e,t){this.parent.notify(Cs,{prevChartIndexes:e,currentChartIndexes:t})},kp.prototype.addEventListener=function(){this.parent.on(Pr,this.hideShow,this),this.parent.on(no,this.destroy,this)},kp.prototype.destroy=function(){this.removeEventListener(),this.parent=null},kp.prototype.removeEventListener=function(){this.parent.off(Pr,this.hideShow),this.parent.off(no,this.destroy)};var Fp=kp;function kp(e){this.parent=e,this.addEventListener()}Ap.prototype.destroy=function(){this.removeEventListener(),this.parent=null},Ap.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(so,this.hyperlinkClickHandler,this),this.parent.on(ua,this.createHyperlinkEle,this),this.parent.on(lo,this.keyUpHandler,this),this.parent.on(Qr,this.removeHyperlink,this),this.parent.on(ca,this.removeHyperlinkHandler,this)},Ap.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(so,this.hyperlinkClickHandler),this.parent.off(ua,this.createHyperlinkEle),this.parent.off(lo,this.keyUpHandler),this.parent.off(Qr,this.removeHyperlink),this.parent.off(ca,this.removeHyperlinkHandler))},Ap.prototype.getModuleName=function(){return"spreadsheetHyperlink"},Ap.prototype.keyUpHandler=function(e){var t,r,n,e=e.target;ee.closest(e,".e-document")&&(t=document.querySelector(".e-hyp-text"),r=this.parent.element.querySelector(".e-hyperlink-alert-span"),n=(ee.closest(e,".e-hyperlink-dlg")||ee.closest(e,".e-edithyperlink-dlg")).getElementsByClassName("e-footer-content")[0].firstChild,t)&&!ee.isNullOrUndefined(t.value)&&(Fn(t.value.toUpperCase())?r&&(r.remove(),n.removeAttribute("disabled")):(this.showDialog(),n.setAttribute("disabled","true"))),e.classList.contains("e-text")&&ee.closest(e,".e-cont")&&ee.closest(e,".e-webpage")&&ee.closest(e,".e-webpage").getElementsByClassName("e-cont")[1]===e.parentElement&&(n=(ee.closest(e,".e-hyperlink-dlg")||ee.closest(e,".e-edithyperlink-dlg")).getElementsByClassName("e-footer-content")[0].firstChild,""!==e.value?n.removeAttribute("disabled"):ee.closest(e,".e-link-dialog").querySelector(".e-webpage").querySelectorAll(".e-cont")[1].querySelector(".e-text").value||n.setAttribute("disabled","true"))},Ap.prototype.initiateHyperlinkHandler=function(){var r,n,i=this,e=this.parent.getActiveSheet();!e.isProtected||e.protectSettings.insertLink&&!jd(this.parent)?Xd(this.parent)?this.parent.notify(qa,null):(e=this.parent.serviceLocator.getService(T),this.parent.element.querySelector(".e-hyperlink-dlg")||(r=this.parent.serviceLocator.getService(O)).show({width:323,isModal:!0,showCloseIcon:!0,cssClass:"e-hyperlink-dlg",header:e.getConstant("InsertLink"),beforeOpen:function(e){var t={dialogName:"InsertLinkDialog",element:e.element,target:e.target,cancel:e.cancel};i.parent.trigger("dialogBeforeOpen",t),t.cancel?e.cancel=!0:(r.dialogInstance.content=i.hyperlinkContent(),n=r.dialogInstance.content.querySelector(".e-text").value,r.dialogInstance.dataBind(),ce(i.parent.element))},open:function(){setTimeout(function(){ce(r.dialogInstance.element.querySelectorAll(".e-webpage input")[1])})},beforeClose:this.dialogBeforeClose.bind(this),buttons:[{buttonModel:{content:e.getConstant("Insert"),isPrimary:!0,disabled:!0},click:function(){i.dlgClickHandler(n),r.hide()}}]})):this.parent.notify(_a,null)},Ap.prototype.dialogBeforeClose=function(){var e=this.headerTabs;e&&e.element&&(e.destroy(),e.element.remove()),this.headerTabs=null,Kd(this.inputElements),this.inputElements=[],Kd(this.divElements),this.divElements=[]},Ap.prototype.dlgClickHandler=function(e){var t,r=this.parent.getActiveSheet(),n=r.name+"!"+r.selectedRange,r=this.parent.element.querySelector(".e-link-dialog").getElementsByClassName("e-content")[0].querySelector(".e-item.e-active");if(r)if((t=r.getElementsByClassName("e-cont")[0].querySelector(".e-text").value)===e&&(t=null),r.querySelector(".e-webpage")){var i,o={address:i=r.getElementsByClassName("e-cont")[1].querySelector(".e-text").value};this.parent.insertHyperlink(o,n,t,!1)}else{i=r.getElementsByClassName("e-cont")[1].querySelector(".e-text").value;e=r.getElementsByClassName("e-cont")[2];if(e.getElementsByClassName("e-list-item")[0].querySelector(".e-active")){o={address:i=r.getElementsByClassName("e-cont")[2].querySelector(".e-active").textContent+"!"+i.toUpperCase()};this.parent.insertHyperlink(o,n,t,!1)}else if(e.querySelector(".e-active"))for(var a=r.getElementsByClassName("e-cont")[2].querySelector(".e-active").textContent,s=0;s<this.parent.definedNames.length;s++)this.parent.definedNames[s].name===a&&(o={address:this.parent.definedNames[s].name},this.parent.insertHyperlink(o,n,t,!1))}},Ap.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(T),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)},Ap.prototype.editHyperlinkHandler=function(){var r,n=this,e=this.parent.serviceLocator.getService(T),i=this.parent.serviceLocator.getService(O);i.show({width:323,isModal:!0,showCloseIcon:!0,cssClass:"e-edithyperlink-dlg",header:e.getConstant("EditLink"),beforeOpen:function(e){var t={dialogName:"EditLinkDialog",element:e.element,target:e.target,cancel:e.cancel};n.parent.trigger("dialogBeforeOpen",t),t.cancel&&(e.cancel=!0),i.dialogInstance.content=n.hyperEditContent(),r=i.dialogInstance.content.querySelector(".e-text").value,i.dialogInstance.dataBind(),ce(n.parent.element)},open:function(){setTimeout(function(){i.dialogInstance.element.querySelector(".e-webpage")?ce(i.dialogInstance.element.querySelectorAll(".e-webpage input")[1]):ce(i.dialogInstance.element.querySelectorAll(".e-document input")[1])})},buttons:[{buttonModel:{content:e.getConstant("Update"),isPrimary:!0},click:function(){n.dlgClickHandler(r),i.hide()}}]})},Ap.prototype.openHyperlinkHandler=function(){var e=W(this.parent.getActiveSheet().activeCell),e=this.parent.getCell(e[0],e[1]);e.getElementsByClassName("e-hyperlink")[0]&&(e=e.querySelector(".e-hyperlink")),this.hlOpenHandler(e)},Ap.prototype.hlOpenHandler=function(e,t,r){var n=this;if(e.classList.contains("e-hyperlink")){e=ee.closest(e,".e-cell");if(e){var i=["",""],o=void 0,a=!0,s=this.parent.getActiveSheet(),l=parseInt(e.getAttribute("aria-colindex"),10)-1,h=parseInt(e.parentElement.getAttribute("aria-rowindex"),10)-1,d=se(h,l,s,!1,!0);d.style&&"#00e"===d.style.color&&(_n(this.parent,s,{rowIdx:h,colIdx:l,preventEvt:!0,cell:{style:{color:"#551a8b"}}}),e.style.color="#551a8b");var p=void 0,h={hyperlink:d.hyperlink,address:s.activeCell,target:"_blank",cancel:!1};if(this.parent.trigger(Qt,h),h.cancel)r&&r.preventDefault();else{var c,e={hyperlink:l=h.hyperlink,address:s.activeCell},u=("string"==typeof l&&(p=l),p="object"==typeof l?l.address:p);if(-1===p.indexOf("http://")&&-1===p.indexOf("https://")&&-1===p.indexOf("ftp://")){if(!ee.isNullOrUndefined(p)){if(this.parent.definedNames)for(var f=0;f<this.parent.definedNames.length;f++)if(this.parent.definedNames[f].name===p){p=(p=this.parent.definedNames[f].refersTo).slice(1);break}-1!==p.lastIndexOf("!")?(i[0]=p.substring(0,p.lastIndexOf("!")),i[0].startsWith("'")&&i[0].endsWith("'")&&(i[0]=i[0].slice(1,i[0].length-1)),i[1]=p.substring(p.lastIndexOf("!")+1)):(i[0]=this.parent.getActiveSheet().name,i[1]=p);for(var f=0;f<this.parent.sheets.length;f++)this.parent.sheets[f].name===i[0]&&(c=f);s=this.parent.sheets[c],-1!==i[1].indexOf(":")&&(d=i[1].indexOf(":"),r=i[1].substr(0,d),l=i[1].substr(d+1,i[1].length),r=r.replace("$",""),(l=l.replace("$","")).match(/\D/g)&&!l.match(/[0-9]/g)&&r.match(/\D/g)&&!r.match(/[0-9]/g)?(l+=s.rowCount,i[1]=(r+="1")+":"+l):!l.match(/\D/g)&&l.match(/[0-9]/g)&&!r.match(/\D/g)&&r.match(/[0-9]/g)&&(a=!(o=[parseInt(r,10)-1,0,parseInt(l,10)-1,s.colCount-1])));var g,m=void 0,v=this.parent.definedNames;if(!ee.isNullOrUndefined(v))for(f=0;f<v.length;f++)if(v[f].name===u){m=!0;break}Fn(i[1])||m?(o=a?te(i[1]):o,ee.isNullOrUndefined(s)||(g=re(o),s===this.parent.getActiveSheet()?Xh(function(){n.parent.goTo(g)}):(0<=g.indexOf(":")&&(g=(d=g.split(":"))[0]===d[1]?d[0]:g),Xh(function(){n.parent.goTo(n.parent.sheets[c].name+"!"+g)})))):this.showInvalidHyperlinkDialog()}}else t||(this.isValidUrl(p)?window.open(p,h.target):this.showInvalidHyperlinkDialog());this.parent.trigger(er,e)}}}},Ap.prototype.isValidUrl=function(e){return/(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/.test(e)},Ap.prototype.showInvalidHyperlinkDialog=function(){var e=this.parent.serviceLocator.getService(O),t=this.parent.serviceLocator.getService(T);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)},Ap.prototype.hyperlinkClickHandler=function(e){var t,r,n,i,o,a,s,l=e.target;ee.closest(l,".e-link-dialog")&&ee.closest(l,".e-toolbar-item")&&(s=(a=ee.closest(l,".e-hyperlink-dlg")||ee.closest(l,".e-edithyperlink-dlg")).getElementsByClassName("e-footer-content")[0].firstChild,n=a.querySelector(".e-document"),i=((t=a.querySelector(".e-webpage"))||n).querySelectorAll(".e-cont")[0].querySelector(".e-text").value,r=n?n.querySelectorAll(".e-cont")[0].querySelector(".e-text").value:i,ee.closest(l,".e-toolbar-items").getElementsByClassName("e-toolbar-item")[1].classList.contains("e-active")?(o=n.querySelectorAll(".e-cont")[2].querySelector(".e-active"),n.querySelectorAll(".e-cont")[0].querySelector(".e-text").value=i,ee.closest(o,".e-list-item").classList.contains("e-level-2")&&s.hasAttribute("disabled")?s.removeAttribute("disabled"):ee.closest(o,".e-list-item").classList.contains("e-level-1")&&!s.hasAttribute("disabled")&&s.setAttribute("disabled","true")):(n=!t.querySelectorAll(".e-cont")[1].querySelector(".e-text").value,t.querySelectorAll(".e-cont")[0].querySelector(".e-text").value=r,n&&!s.hasAttribute("disabled")?s.setAttribute("disabled","true"):!n&&s.hasAttribute("disabled")&&s.removeAttribute("disabled"))),ee.closest(l,".e-list-item")&&l.classList.contains("e-fullrow")?(i=this.parent.element.getElementsByClassName("e-link-dialog")[0])&&(o=(i=i.getElementsByClassName("e-content")[0].getElementsByClassName("e-active")[0]).getElementsByClassName("e-cont")[1].getElementsByClassName("e-text")[0],s=(a=ee.closest(l,".e-hyperlink-dlg")||ee.closest(l,".e-edithyperlink-dlg")).getElementsByClassName("e-footer-content")[0].firstChild,ee.closest(l,".e-list-item").classList.contains("e-level-2")?"defName"===ee.closest(l,".e-list-item").getAttribute("data-uid")?(o.classList.contains("e-disabled")||o.hasAttribute("readonly")||(o.setAttribute("readonly","true"),o.classList.add("e-disabled"),o.setAttribute("disabled","true")),s.hasAttribute("disabled")&&s.removeAttribute("disabled")):"sheet"===ee.closest(l,".e-list-item").getAttribute("data-uid")&&(o.classList.contains("e-disabled")&&o.hasAttribute("readonly")&&(o.removeAttribute("readonly"),o.classList.remove("e-disabled"),o.removeAttribute("disabled")),Fn(o.value.toUpperCase()))&&s.hasAttribute("disabled")&&s.removeAttribute("disabled"):ee.closest(l,".e-list-item").classList.contains("e-level-1")&&s.setAttribute("disabled","true")):this.hlOpenHandler(l,!0,e)},Ap.prototype.createHyperlinkEle=function(e){var t,r,n,i=e.cell;ee.isNullOrUndefined(i.hyperlink)||(t=e.td,r=this.parent.createElement("a",{className:"e-hyperlink e-hyperlink-style"}),n=void 0,"string"==typeof i.hyperlink?(0===i.hyperlink.toLowerCase().indexOf("www.")&&(i.hyperlink="http://"+i.hyperlink),n=i.hyperlink):0===(n=i.hyperlink.address).toLowerCase().indexOf("www.")&&(i.hyperlink.address=n="http://"+n),0===n.indexOf("http://")||0===n.indexOf("https://")||0===n.indexOf("ftp://")?(r.setAttribute("href",n),r.setAttribute("target","_blank")):(n.includes("=")||n.includes("!"))&&r.setAttribute("ref",n),"Accounting"===Ml(i.format)?r.innerHTML=t.innerHTML:r.innerText=""!==t.innerText?t.innerText:n,t.textContent="",t.innerText="","FillWithoutFormatting"!==this.parent.autoFillSettings.fillType&&"FillWithoutFormatting"!==e.fillType||(r.style.textDecoration="none"),t.appendChild(r),e.style.color&&e.style.textDecoration)||(i={},e.style.color||(e.style.color=i.color="#00e"),e.style.textDecoration||(e.style.textDecoration=i.textDecoration="underline"),_n(this.parent,this.parent.getActiveSheet(),{rowIdx:e.rowIdx,colIdx:e.colIdx,preventEvt:!0,cell:{style:i}}))},Ap.prototype.hyperEditContent=function(){for(var e,t=!0,r=this.hyperlinkContent(),n=te(this.parent.getActiveSheet().activeCell),i=this.parent.sheets[this.parent.getActiveSheet().id-1].rows[n[0]].cells[n[1]],n=(this.parent.scrollSettings.enableVirtualization&&(n[0]=n[0]-this.parent.viewport.topIndex,n[1]=n[1]-this.parent.viewport.leftIndex),this.parent.getDisplayText(i)),i=i.hyperlink,o=("string"==typeof i?(e=i,n=n||e,-1===e.indexOf("http://")&&-1===e.indexOf("https://")&&-1===e.indexOf("ftp://")&&(t=!1)):"object"==typeof i&&(e=i.address,n=n||e,-1===e.indexOf("http://"))&&-1===e.indexOf("https://")&&-1===e.indexOf("ftp://")&&(t=!1),0),a=0,s=this.parent.definedNames,l=this.parent.sheets,h=0,d=s.length;h<d;h++)s[h].name===e&&o++;for(h=0,d=l.length;h<d;h++)e.includes(l[h].name)&&a++;0===o&&0===a&&(t=!0);var p=r.querySelector(".e-content");if(t){t=p.querySelector(".e-webpage");t.getElementsByClassName("e-cont")[0].getElementsByClassName("e-text")[0].setAttribute("value",n),"string"==typeof i?t.getElementsByClassName("e-cont")[1].querySelector(".e-text").setAttribute("value",i):t.getElementsByClassName("e-cont")[1].querySelector(".e-text").setAttribute("value",i.address)}else{var c=void 0,t=p.querySelector(".e-document"),u=(t.getElementsByClassName("e-cont")[0].getElementsByClassName("e-text")[0].setAttribute("value",n),void 0),i=void 0;if(this.parent.definedNames)for(h=0;h<this.parent.definedNames.length;h++)if(this.parent.definedNames[h].name===e){c=!0;break}if(c){p=t.getElementsByClassName("e-cont")[1].getElementsByClassName("e-text")[0];p.setAttribute("readonly","true"),p.classList.add("e-disabled"),p.setAttribute("disabled","true");for(var f=t.getElementsByClassName("e-cont")[2].querySelectorAll(".e-list-item.e-level-1")[1],h=0;h<f.getElementsByTagName("li").length;h++)f.getElementsByTagName("li")[h].innerText===e&&f.getElementsByTagName("li")[h].classList.add("e-active")}else{e&&-1!==e.lastIndexOf("!")&&(n=e.lastIndexOf("!"),u=e.substring(0,n),i=e.substring(n+1)),t.getElementsByClassName("e-cont")[1].querySelector(".e-text").setAttribute("value",i);for(f=t.getElementsByClassName("e-cont")[2].querySelectorAll(".e-list-item.e-level-1")[0],h=0;h<f.getElementsByTagName("li").length;h++)if(f.getElementsByTagName("li")[h].innerText===u){if(f.getElementsByTagName("li")[h].classList.contains("e-active"))break;f.getElementsByTagName("li")[h].classList.add("e-active")}else f.getElementsByTagName("li")[h].classList.contains("e-active")&&f.getElementsByTagName("li")[h].classList.remove("e-active")}}return r},Ap.prototype.hyperlinkContent=function(){var e,t,r=this.parent.serviceLocator.getService(T),n=0,i=0,o=!0,a=!0,s=te(this.parent.getActiveSheet().activeCell),l=this.parent.getActiveSheet(),s=se(s[0],s[1],l),l=!0;if(s){var l=!!(s.value&&"string"==typeof s.value&&null!==s.value.match("[A-Za-z]+")||""===s.value||ee.isNullOrUndefined(s.value)),h=s.hyperlink;if("string"==typeof h?-1===(y=h).indexOf("http://")&&-1===y.indexOf("https://")&&-1===y.indexOf("ftp://")&&(t=h,o=!1):"object"==typeof h&&-1===(y=h.address).indexOf("http://")&&-1===y.indexOf("https://")&&-1===y.indexOf("ftp://")&&(t=h.address,o=!1),t){for(var d=0,p=0,c=this.parent.definedNames,u=this.parent.sheets,f=0,g=u.length;f<g;f++)t.includes(u[f].name)&&p++;for(var m=0,g=c.length;m<g;m++)c[m].name===t&&d++;0===d&&0===p&&(o=!0)}if(i=o?0:1,this.parent.definedNames)for(var v=0;v<this.parent.definedNames.length;v++)if(this.parent.definedNames[v].name===t){a=!(e=!0);break}}for(var y=this.parent.createElement("div",{className:"e-link-dialog"}),h=this.parent.createElement("div",{className:"e-webpage"}),C=this.parent.createElement("div",{className:"e-document"}),i=(this.headerTabs=new D.Tab({selectedItem:i,items:[{header:{text:r.getConstant("WebPage")},content:h},{header:{text:r.getConstant("ThisDocument")},content:C}]}),this.headerTabs.appendTo(y),o?y.querySelector(".e-toolbar-items").querySelector(".e-indicator").setAttribute("style","left: 0; right: 136px"):y.querySelector(".e-toolbar-items").querySelector(".e-indicator").setAttribute("style","left: 136px; right: 0"),this.parent.createElement("div",{className:"e-cont"})),o=this.parent.createElement("div",{className:"e-cont"}),b=this.parent.createElement("div",{className:"e-header"}),x=(b.innerText=r.getConstant("DisplayText"),this.parent.createElement("div",{className:"e-header"})),S=(x.innerText=r.getConstant("Url"),this.parent.createElement("input",{className:"e-input e-text",attrs:{type:"Text"}})),w=(this.inputElements.push(S),l||(S.classList.add("e-disabled"),S.setAttribute("readonly","true"),S.setAttribute("disabled","true")),s&&ee.isNullOrUndefined(s.hyperlink)&&S.setAttribute("value",this.parent.getDisplayText(s)),this.parent.createElement("input",{className:"e-input e-text",attrs:{type:"Text"}})),I=(this.inputElements.push(w),S.setAttribute("placeholder",r.getConstant("EnterTheTextToDisplay")),w.setAttribute("placeholder",r.getConstant("EnterTheUrl")),i.appendChild(S),i.insertBefore(b,S),o.appendChild(w),o.insertBefore(x,w),h.appendChild(o),h.insertBefore(i,o),[]),E=[],N=this.parent.sheets;n<this.parent.sheets.length;n++){var R=this.parent.sheets[n].name;"Visible"===this.parent.sheets[n].state&&(N[n]===this.parent.getActiveSheet()?I.push({nodeId:"sheet",nodeText:-1!==R.indexOf(" ")?"'"+R+"'":R,selected:!0}):I.push({nodeId:"sheet",nodeText:-1!==R.indexOf(" ")?"'"+R+"'":R}))}for(n=0;n<this.parent.definedNames.length;n++)E.push({nodeId:"defName",nodeText:this.parent.definedNames[n].name});var S=[{nodeId:"01",nodeText:r.getConstant("CellReference"),expanded:a,nodeChild:I},{nodeId:"02",nodeText:r.getConstant("DefinedNames"),expanded:e,nodeChild:E}],w=new D.TreeView({fields:{dataSource:S,id:"nodeId",text:"nodeText",child:"nodeChild"}}),S=this.parent.createElement("div",{className:"e-cont"}),F=this.parent.createElement("div",{className:"e-header"}),k=(F.innerText=r.getConstant("CellReference"),this.parent.createElement("input",{className:"e-input e-text e-hyp-text",attrs:{type:"Text"}})),k=(k.setAttribute("value","A1"),this.inputElements.push(k),S.appendChild(k),S.insertBefore(F,k),this.parent.createElement("div",{className:"e-cont"})),O=this.parent.createElement("div",{className:"e-header"}),A=(O.innerText=r.getConstant("DisplayText"),this.parent.createElement("input",{className:"e-input e-text",attrs:{type:"Text"}})),l=(this.inputElements.push(A),l||(A.classList.add("e-disabled"),A.setAttribute("readonly","true"),A.setAttribute("disabled","true")),s&&ee.isNullOrUndefined(s.hyperlink)&&A.setAttribute("value",this.parent.getDisplayText(s)),A.setAttribute("placeholder",r.getConstant("EnterTheTextToDisplay")),k.appendChild(A),k.insertBefore(O,A),this.parent.createElement("div",{className:"e-cont"})),s=this.parent.createElement("div",{className:"e-header"}),A=(s.innerText=r.getConstant("Sheet"),this.parent.createElement("div",{className:"e-refcont"}));return this.divElements.push(i),this.divElements.push(o),this.divElements.push(b),this.divElements.push(x),this.divElements.push(S),this.divElements.push(F),this.divElements.push(k),this.divElements.push(O),this.divElements.push(l),this.divElements.push(s),this.divElements.push(A),this.divElements.push(C),this.divElements.push(h),this.divElements.push(y),l.appendChild(A),l.insertBefore(s,A),C.appendChild(S),C.insertBefore(k,S),w.appendTo(A),C.appendChild(l),y},Ap.prototype.removeHyperlink=function(e){var t=se(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(qr,null),e.preventRefresh||this.parent.serviceLocator.getService("cell").refresh(e.rowIdx,e.colIdx,!1,null,!0,!1,Jn(this.parent)))},Ap.prototype.removeHyperlinkHandler=function(e){var t,r=e.range,n=this.parent.getActiveSheet();if(!e.preventEventTrigger){var i={address:-1===r.indexOf("!")?n.name+"!"+r:r,cancel:!1};if(this.parent.notify(gt,{action:"removeHyperlink",eventArgs:i}),i.cancel)return}if(r&&-1!==r.indexOf("!")){for(var i=r.lastIndexOf("!"),o=r.substring(0,i),a=this.parent.sheets,s=0;s<a.length;s++)a[s].name===o&&(t=s);n=this.parent.sheets[t],r=r.substring(i+1)}for(var l,h,d=te(r||n.activeCell),p=d[0];p<=d[2];p++)for(var c=d[1];c<=d[3];c++)if(n&&n.rows[p]&&n.rows[p].cells[c]){if(h=[],l=this.parent.getCell(p,c))for(var u=0;u<l.classList.length;u++)h.push(l.classList[u]);this.parent.notify(Qr,{sheet:n,rowIdx:p,colIdx:c});for(u=0;u<h.length;u++)l.classList.contains(h[u])||l.classList.add(h[u])}e.preventEventTrigger||this.parent.notify(le,{action:"removeHyperlink",eventArgs:{address:-1===r.indexOf("!")?n.name+"!"+r:r}})};var Op=Ap;function Ap(e){this.divElements=[],this.inputElements=[],this.parent=e,this.addEventListener()}var Tp=function(){return(Tp=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}).apply(this,arguments)},Dp=(Lp.prototype.setActionData=function(e){var t,r=this.parent.getActiveSheet(),n=[],i=e.args,o=i.eventArgs;switch(i.action){case"format":t=te(i.eventArgs.range);break;case"clipboard":a=o.copiedInfo,t=te(y(o.pastedRange)),a&&a.isCut&&(n=this.getCellDetails(a.range,ae(this.parent,Ii(this.parent,a.sId)),"clipboard"));break;case"beforeSort":(t=te(i.eventArgs.range))[0]===t[2]&&t[2]-t[0]==0&&(t[0]=0,t[1]=0,t[2]=r.usedRange.rowIndex,t[3]=r.usedRange.colIndex);break;case"beforeCellSave":case"cellDelete":case"cellSave":case"addNote":case"editNote":case"deleteNote":t=te(o.address);break;case"beforeWrap":case"beforeReplace":case"chartDesign":t=this.parent.getAddressInfo(o.address).indices;break;case"beforeClear":case"beforeInsertImage":t=te(o.range);break;case"deleteImage":t=te(o.address);break;case"beforeInsertChart":case"filter":t=te(o.range);break;case"autofill":t=te(o.fillRange);break;case"removeValidation":if(o.isColSelected){this.beforeActionData={cellDetails:[]};for(var a=o.range.substring(o.range.lastIndexOf("!")+1).split(":"),s=R(a[0]),l=R(a[1]);s<=l;s++)r.columns[s]&&r.columns[s].validation&&this.beforeActionData.cellDetails.push({colIndex:s,validation:r.columns[s].validation})}else t=te(o.range);break;case"hyperlink":case"removeHyperlink":t=te(o.address)}"beforeSort"===i.action?(this.beforeActionData={cellDetails:o.cellDetails},this.beforeActionData.sortedCellDetails=o.sortedCellDetails):t&&(e=this.getCellDetails(t,r,i.action),this.beforeActionData={cellDetails:e,cutCellDetails:n})},Lp.prototype.getBeforeActionData=function(e){e.beforeDetails=this.beforeActionData},Lp.prototype.performUndoRedo=function(e){var t,r;if(e.isFromUpdateAction?t=e:(t=(e.isUndo?this.undoCollection:this.redoCollection).pop(),e.setCollection&&(e.undoArgs=t)),this.isUndo=e.isUndo,t){var n=void 0,i=t.action,o={},a=[],s=void 0;if("autofill"===t.action||"autofillWithCF"===t.action?a=t.eventArgs.fillRange.split("!"):"cellSave"===t.action||"cellDelete"===t.action?a=t.eventArgs.address.split("!"):"clipboard"===t.action&&(a=t.eventArgs.pastedRange.split("!")),0<a.length?s=ae(this.parent,B(this.parent,a[0])):"clear"===t.action&&(s=ae(this.parent,t.eventArgs.sheetIndex)),"autofillWithCF"===t.action&&(t.action="autofill","autofillWithCF"===(a=s.conditionalFormats)[a.length-1].action)&&e.isUndo&&(a[a.length-1].value?a.pop():this.parent.notify(Ur,{range:a[a.length-1].range,isAction:!0})),!e.isPublic){var a=t.eventArgs.beforeActionData;if(delete t.eventArgs.beforeActionData,n={action:t.action,eventArgs:{}},ee.extend(n.eventArgs,t.eventArgs,null,!0),"Manual"===this.parent.calculationMode&&("clipboard"===t.action||"cellDelete"===t.action||"autofill"===t.action||"clear"===t.action))if(!e.isUndo&&s.isSheetCalculated&&"autofill"!==t.action||e.isUndo&&"CopyCells"===t.eventArgs.fillType)for(var l=0,h=0<a.cutCellDetails.length?a.cutCellDetails:a.cellDetails;l<h.length;l++)p=(p=s.rows[h[l].rowIndex].cells[h[l].colIndex])?p.value:"",ee.isNullOrUndefined(h[l].autoFillText)?h[l].value!==p&&"autofill"!==t.action&&(h[l].value=p):h[l].autoFillText=p;else if(e.isUndo&&"paste"===t.eventArgs.requestType&&"clipboard"===t.action){var d=void 0;if(0===a.cutCellDetails.length?d="Copy":s.isSheetCalculated&&(d="Cut"),d)for(var p,l=0,c=a.cellDetails,u=a.cutCellDetails;l<c.length;l++)p=(p=s.rows[c[l].rowIndex].cells[c[l].colIndex])?p.value:"","Copy"===d?c[l].copyCellValue=p:"Cut"===d&&u[l].value!==p&&(u[l].value=p)}if(t.eventArgs.beforeActionData=a,n.eventArgs.cancel=!1,t.preventAction=n.preventAction=!0,e.isUndo?(n.isUndo=!0,"cellSave"===t.action&&"Manual"===this.parent.calculationMode&&s.isSheetCalculated&&1===a.cellDetails.length&&(a=se(a.cellDetails[0].rowIndex,a.cellDetails[0].colIndex,s))&&t.eventArgs.displayText!==a.value&&(t.eventArgs.displayText=a.value)):n.isRedo=!0,e.isFromUpdateAction||this.parent.notify(gt,n),n.eventArgs.cancel)return void this.updateUndoRedoIcons();delete n.eventArgs.cancel}switch(t.action){case"cellSave":case"format":case"wrap":case"cellDelete":case"autofill":case"removeValidation":case"hyperlink":case"addNote":case"editNote":case"deleteNote":case"removeHyperlink":(t=this.performOperation(t,e.preventEvt,e.preventReSelect,e.isFromAutoFillOption)).action=i;break;case"sorting":this.undoForSorting(t,e.isUndo);break;case"clipboard":t=this.undoForClipboard(t,e.isUndo,n),r=!0;break;case"resize":case"resizeToFit":t=this.undoForResize(t);break;case"hideShow":kd(t,this.parent,!e.isUndo);break;case"replace":t=this.performOperation(t);break;case"replaceAll":t.eventArgs.isAction=!1,e.isUndo&&(o.value=t.eventArgs.replaceValue,o.replaceValue=t.eventArgs.value,o.skipFormatCheck=Jn(this.parent)),this.parent.notify(mr,Tp({},t.eventArgs,o));break;case"insert":case"filter":kd(t,this.parent,!e.isUndo,null,n),r="filter"===t.action;break;case"delete":kd(t,this.parent,!e.isUndo);break;case"validation":case"addHighlight":case"removeHighlight":kd(t,this.parent,!e.isUndo);break;case"merge":t.eventArgs.merge=t.isFromUpdateAction?t.eventArgs.merge:!t.eventArgs.merge,kd(t,this.parent,!e.isUndo);break;case"clear":t=this.performOperation(t),e.isUndo&&t.eventArgs.cfClearActionArgs&&kd({action:"clearCF",eventArgs:t.eventArgs.cfClearActionArgs},this.parent,!e.isUndo);break;case"conditionalFormat":kd(t,this.parent,!e.isUndo,this.undoCollection);break;case"clearCF":kd(t,this.parent,!e.isUndo);break;case"insertImage":case"deleteImage":case"imageRefresh":kd(t,this.parent,!e.isUndo);break;case"insertChart":case"deleteChart":case"chartRefresh":kd(t,this.parent,!e.isUndo);break;case"chartDesign":t.eventArgs.isUndo=e.isUndo,this.parent.notify(Os,t.eventArgs);break;case"addDefinedName":kd(t,this.parent,!e.isUndo)}e.isFromUpdateAction||((e.isUndo?this.redoCollection:this.undoCollection).push(t),this.undoCollection.length>this.undoRedoStep&&this.undoCollection.splice(0,1),this.redoCollection.length>this.undoRedoStep&&this.redoCollection.splice(0,1),this.updateUndoRedoIcons(),e.isPublic)||r||this.parent.notify(le,ee.extend({isUndoRedo:!0,isUndo:e.isUndo},t)),this.parent.notify(qr,null)}},Lp.prototype.undoForSorting=function(e,t){function r(e,t){var r;i===n.parent.activeSheetIndex&&(r=(r=n.parent.getCell(o[0]-1,n.parent.sortCollection[e].columnIndex))&&ee.select(".e-filter-icon",r))&&(e="e-sort"+("Ascending"===n.parent.sortCollection[e].order?"asc":"desc")+"-filter",t?r.classList.add(e):r.classList.remove(e))}var n=this,i=N(this.parent,e.eventArgs.range),o=te(e.eventArgs.range);if(t){if(this.parent.notify(Kt,{result:e.eventArgs.beforeActionData.cellDetails,range:o,sheet:ae(this.parent,i),jsonData:e.eventArgs.beforeActionData.sortedCellDetails,isUndo:!0}),this.parent.notify($t,{range:e.eventArgs.range}),this.parent.sortCollection&&e.eventArgs.previousSort)for(var a=this.parent.sortCollection.length-1;0<=a;a--)if(this.parent.sortCollection[a].sheetIndex===i){r(a,!1),this.parent.sortCollection.splice(a,1);var s=e.eventArgs.previousSort;if(Array.isArray(s))for(var l=0;l<s.length;l++)this.parent.sortCollection.splice(l,0,s[l]),r(l,!0);this.parent.sortCollection.length||(this.parent.sortCollection=void 0);break}}else if(kd(e,this.parent,!0),e.eventArgs.previousSort){var h=0;if(this.parent.sortCollection)for(a=this.parent.sortCollection.length-1;0<=a;a--)this.parent.sortCollection[a].sheetIndex===i&&(r(a,!1),h=a,this.parent.sortCollection.splice(a,1));else this.parent.sortCollection=[];this.parent.sortCollection.splice(h,0,{sortRange:e.eventArgs.range.substring(e.eventArgs.range.lastIndexOf("!")+1),sheetIndex:i,columnIndex:R(e.eventArgs.sortOptions.sortDescriptors.field),order:e.eventArgs.sortOptions.sortDescriptors.order}),r(h,!0)}},Lp.prototype.updateUndoRedoCollection=function(e){var t,r=["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"],n=("insert"!==e.args.action&&"delete"!==e.args.action||"Sheet"===e.args.eventArgs.modelType||r.push(e.args.action),e.args.action);-1===r.indexOf(n)&&!e.isPublic||(r=e.args.eventArgs,"clipboard"!==n&&"sorting"!==n&&"format"!==n&&"cellSave"!==n&&"wrap"!==n&&"replace"!==n&&"validation"!==n&&"clear"!==n&&"conditionalFormat"!==n&&"clearCF"!==n&&"insertImage"!==n&&"imageRefresh"!==n&&"insertChart"!==n&&"chartRefresh"!==n&&"filter"!==n&&"cellDelete"!==n&&"autofill"!==n&&"autofillWithCF"!==n&&"removeValidation"!==n&&"addDefinedName"!==n&&"hyperlink"!==n&&"removeHyperlink"!==n&&"deleteImage"!==n&&"chartDesign"!==n&&"addNote"!==n&&"editNote"!==n&&"deleteNote"!==n||(this.parent.notify(Ca,t={beforeDetails:{cellDetails:[]}}),r.beforeActionData=t.beforeDetails),"clipboard"===n&&r.copiedInfo&&r.copiedInfo.isExternal&&(t=this.parent.getAddressInfo(r.pastedRange),r.copiedInfo.cellDetails=this.getCellDetails(t.indices,ae(this.parent,t.sheetIndex),n)),0<this.redoCollection.length&&"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())},Lp.prototype.clearUndoRedoCollection=function(){this.undoCollection=[],this.redoCollection=[],this.updateUndoRedoIcons()},Lp.prototype.updateUndoRedoIcons=function(){var e=this.parent.serviceLocator.getService(T);this.parent.notify(Io,[{tab:e.getConstant("Home"),items:[this.parent.element.id+"_undo"],enable:0<this.undoCollection.length}]),this.parent.notify(Io,[{tab:e.getConstant("Home"),items:[this.parent.element.id+"_redo"],enable:0<this.redoCollection.length}])},Lp.prototype.undoForClipboard=function(e,t,r){var n,i,o,a=this,s=e.eventArgs,l=[],h=(l[0]=s.pastedRange.substring(0,s.pastedRange.lastIndexOf("!")),l[1]=s.pastedRange.substring(s.pastedRange.lastIndexOf("!")+1),te(l[1])),d=B(this.parent,l[0]),p=ae(this.parent,d),c=s.copiedInfo,u=s.beforeActionData,f=e.isFromUpdateAction,g=d===this.parent.activeSheetIndex;return r&&(r.isUndoRedo=!0,r.eventArgs.beforeActionData=u),"imagePaste"===e.eventArgs.requestType?(n=s.copiedShapeInfo,t?(i=n.pictureElem,n.isCut?(this.parent.notify(ms,{id:i.id,sheetIdx:s.pasteSheetIndex+1,isUndoRedo:!0}),this.parent.notify(gs,{options:{src:i.style.backgroundImage.replace(/url\((['"])?(.*?)\1\)/gi,"$2"),height:n.height,width:n.width,id:i.id},range:n.copiedRange,isPublic:!1,isUndoRedo:!0})):this.parent.notify(ms,{id:s.pastedPictureElement.id,sheetIdx:s.pasteSheetIndex+1,isUndoRedo:!0})):n.isCut?(i=n.pictureElem,this.parent.notify(ms,{id:i.id,sheetIdx:n.sId,isUndoRedo:!0}),this.parent.notify(gs,{options:{src:i.style.backgroundImage.replace(/url\((['"])?(.*?)\1\)/gi,"$2"),height:n.height,width:n.width,id:i.id},range:n.pastedRange,isPublic:!1,isUndoRedo:!0})):(i=s.pastedPictureElement,this.parent.notify(gs,{options:{src:i.style.backgroundImage.replace(/url\((['"])?(.*?)\1\)/gi,"$2"),height:i.offsetHeight,width:i.offsetWidth,id:i.id},range:n.pastedRange,isPublic:!1,isUndoRedo:!0}))):(t?(c.isCut&&(i=u.cutCellDetails,this.updateCellDetails(i,ae(this.parent,Ii(this.parent,c.sId)),ne(c.range),g,e),s.cfClearActionArgs)&&kd({action:"clearCF",eventArgs:s.cfClearActionArgs},this.parent,!1),u&&this.updateCellDetails(u.cellDetails,p,h,g,e,null,null,r?r.isUndoRedo:null),s.cfActionArgs&&s.cfActionArgs.cfModel.forEach(function(e){kd({eventArgs:{range:e.range,type:e.type,cFColor:e.cFColor,value:e.value,sheetIdx:s.cfActionArgs.sheetIdx,cancel:!0},action:"conditionalFormat"},a.parent,!1)}),Hd(p,h[0],h[1],kh(p,h[0])),n=Vd(p,h[0]),Ad(this.parent,p,n,h[0]),s.mergeCollection.forEach(function(e){e.merge=!e.merge,a.parent.notify(Or,e),e.merge=!e.merge}),r&&!f&&this.parent.notify(le,r)):c.isExternal?(o=this.parent.getAddressInfo(s.pastedRange),this.updateCellDetails(c.cellDetails,ae(this.parent,o.sheetIndex),o.indices,!0,e,null,null,r?r.isUndoRedo:null),r&&!f&&this.parent.notify(le,r)):(i=new Promise(function(e){e(void 0)}),o=this.parent.getAddressInfo(s.copiedRange),this.parent.notify(s.copiedInfo.isCut?Fo:ko,{range:o.indices,sId:ae(this.parent,o.sheetIndex).id,promise:i,invokeCopy:!0,isPublic:!0,isFromUpdateAction:f}),i.then(function(){a.parent.notify(Oo,{range:l&&P(s.pastedRange),sIdx:l&&B(a.parent,Ei(s.pastedRange)),type:s.type,isAction:!1,isInternal:!0,isFromUpdateAction:f,beforeActionData:s.beforeActionData,isUndo:t}),r&&!f&&a.parent.notify(le,r)})),g&&!f?(this.parent.notify(No,{address:s.selectedRange}),this.parent.notify(js,{})):this.checkRefreshNeeded(d,f)),e},Lp.prototype.undoForResize=function(e){var t,r=e.eventArgs,n=(void 0===r.hide?r.isCol?(n=r.oldWidth,r.oldWidth=r.width,r.width=n):(n=r.oldHeight,r.oldHeight=r.height,r.height=n):r.hide=!r.hide,kd(e,this.parent,!1),this.parent.getActiveSheet()),r=te(n.activeCell),n=se(r[0],r[1],n);return n&&n.rowSpan?(t=this.parent.getCell(r[0],r[1]),this.parent.element.querySelector(".e-active-cell").style.height=t.offsetHeight+"px"):n&&n.colSpan&&(t=this.parent.getCell(r[0],r[1]),this.parent.element.querySelector(".e-active-cell").style.width=t.offsetWidth+"px"),e},Lp.prototype.performOperation=function(e,t,r,n){var i,o=e.eventArgs,a=[],s="cellSave"===e.action||"wrap"===e.action||"replace"===e.action||"cellDelete"===e.action||"hyperlink"===e.action||"addNote"===e.action||"editNote"===e.action||"deleteNote"===e.action||"removeHyperlink"===e.action?o.address:o.range,s=("autofill"===e.action?(a[0]=o.fillRange.substring(0,o.fillRange.lastIndexOf("!")),a[1]=o.fillRange.substring(o.fillRange.lastIndexOf("!")+1)):(a[0]=s.substring(0,s.lastIndexOf("!")),a[1]=s.substring(s.lastIndexOf("!")+1)),B(this.parent,a[0])),l=ae(this.parent,s),h=i=o.isColSelected?[0,R((d=a[1].split(":"))[0]),l.rowCount-1,R(d[1])]:ne(te(a[1])),d=o.beforeActionData,p=e.isFromUpdateAction,s=this.checkRefreshNeeded(s,p),c={cellIdx:[i[0],i[1]],isUnique:!1,uniqueRange:""};if(o.isColSelected||this.parent.notify(_t,c),this.isUndo){if(c.isUnique&&o.formula&&-1<o.formula.indexOf("UNIQUE"))if("#SPILL!"!==se((g=te(c.uniqueRange))[0],g[1],this.parent.getActiveSheet()).value)for(var u=g[0];u<=g[2];u++)for(var f=g[1];f<=g[3];f++)u===g[0]&&f===g[1]&&(f+=1),this.parent.updateCell({value:""},re([u,f]));if(this.updateCellDetails(d.cellDetails,l,i,s,e,t,o.isColSelected,null,n),c.isUnique&&"cellDelete"===e.action&&o.isSpill){for(var g,m=se((g=te(c.uniqueRange))[0],g[1],this.parent.getActiveSheet()),v=g[0];v<=g[2];v++)for(u=g[1];u<=g[3];u++)for(f=i[0];f<=i[2];f++)for(var y=i[1];y<=i[3];y++)v===f&&u===y||this.parent.updateCell({value:""},G(v,u));m.value="#SPILL!",this.parent.updateCell(m,G(g[0],g[1]))}if(!o.isSpill&&""!==c.uniqueRange){for(var C=te(c.uniqueRange),u=C[0];u<=C[2];u++)for(f=C[1];f<=C[3];f++)u===C[0]&&f===C[1]&&(f+=1),this.parent.updateCell({value:""},re([u,f]));this.parent.notify(qt,null)}}else{var d=e.eventArgs,t=te(l.activeCell),b=this.parent.getCellStyleValue(["textDecoration"],t).textDecoration;if(d&&d.style&&d.style.textDecoration){var x=d.style.textDecoration,n=x,S=void 0,w=!1;"underline"===b?n="underline"===x?"none":"underline line-through":"line-through"===b?n="line-through"===x?"none":"underline line-through":"underline line-through"===b&&(n="underline"===x?"line-through":"underline",w=!0),"none"===n&&(w=!0),d.style.textDecoration=n,e.eventArgs=d;for(v=h[0];v<=h[2];v++)for(u=h[1];u<=h[3];u++){if(S={},"none"===(b=this.parent.getCellStyleValue(["textDecoration"],[v,u]).textDecoration)){if(w)continue;S.textDecoration=x}else if("underline"===b||"line-through"===b)if(w){if(x!==b)continue;S.textDecoration="none"}else S.textDecoration=x!==b?"underline line-through":x;else if("underline line-through"===b){if(!w)continue;S.textDecoration="underline"===x?"line-through":"underline"}this.parent.notify(Et,{style:{textDecoration:S.textDecoration},range:[v,u,v,u],refreshRibbon:!0,onActionUpdate:!0})}d.style.textDecoration=x,e.eventArgs=d}else{if(!ee.isNullOrUndefined(o.oldValue)&&o.oldValue!==o.value&&c.isUnique){var I=te(c.uniqueRange);if("#SPILL!"!==se(I[0],I[1],this.parent.getActiveSheet()).value)for(u=I[0];u<=I[2];u++)for(f=I[1];f<=I[3];f++)u===I[0]&&f===I[1]&&(this.parent.updateCell({value:"#SPILL!"},re([I[0],I[1]])),f+=1),this.parent.updateCell({value:""},re([u,f]))}if(kd(e,this.parent,!0),c.isUnique&&"cellDelete"===e.action&&o.isSpill){for(var E=te(c.uniqueRange),N=!1,v=E[0];v<=E[1];v++)for(u=E[1];u<=E[3];u++)v===E[0]&&u===E[1]&&u++,se(v,u,l)&&!ee.isNullOrUndefined(se(v,u,l).value)&&""!==se(v,u,l).value&&(N=!0);N||((m=se(E[0],E[1],this.parent.getActiveSheet())).value="",this.parent.updateCell(m,G(E[0],E[1])),this.parent.notify(qt,null))}}}return"autofill"===e.action&&(a[1]=this.isUndo?e.eventArgs.dataRange:e.eventArgs.selectedRange),!s||r||p||(o.isColSelected&&(a[1]=l.selectedRange),this.parent.notify(No,{address:a[1]})),this.parent.showAggregate&&this.parent.notify(Ja,{}),e},Lp.prototype.getCellDetails=function(e,t,r){for(var n=[],i="cellDelete"===r,o=(e=ne(e))[0];o<=e[2];o++)if(!i||!Fh(t,o))for(var a=e[1];a<=e[3];a++){var s,l,h={rowIndex:o,colIndex:a,value:(s=se(o,a,t))?s.value:"",formula:s?s.formula:""};s?(s.format&&(h.format=s.format),s.isLocked&&(h.isLocked=s.isLocked),s.style&&(h.style=Object.assign({},s.style)),s.wrap&&(h.wrap=s.wrap),s.rowSpan&&(h.rowSpan=s.rowSpan),s.colSpan&&(h.colSpan=s.colSpan),s.image&&(h.image=s.image),s.chart&&(h.chart=JSON.parse(JSON.stringify(s.chart))),s.validation&&(h.validation=s.validation),s.notes&&(h.notes=s.notes),s.isReadOnly&&(h.isReadOnly=s.isReadOnly),s.formattedText&&(h.formattedText=s.formattedText),s.hyperlink&&(h.hyperlink=ee.isObject(s.hyperlink)?ee.extend({},s.hyperlink):s.hyperlink),l=this.parent.editModule,h.value=s&&l&&s.formula===l.editCellData.value&&!ee.isNullOrUndefined(l.editCellData.prevFormulaValue)?l.editCellData.prevFormulaValue:h.value):"autofill"===r&&(h.autoFillText=""),n.push(h)}return n},Lp.prototype.updateCellDetails=function(r,n,e,t,i,o,a,s,l){for(var h,d,p,c,u,f,g=this,m=r.length,v=i&&!o&&("cellSave"===i.action||"cellDelete"===i.action||"autofill"===i.action||"clipboard"===i.action),y=i&&!i.eventArgs.cfClearActionArgs&&n.conditionalFormats&&n.conditionalFormats.length&&[].slice.call(n.conditionalFormats),C=[],b=("cellDelete"===i.action&&(u=!1,f=e),this),x=0;x<m;x++)!function(t){if(a)return Mh(n,r[t].colIndex,{validation:r[t].validation});(h=se(r[t].rowIndex,r[t].colIndex,n,!1,!0)).style&&i&&("format"===i.action||"clipboard"===i.action)&&(!h.style.borderTop||r[t].style&&r[t].style.borderTop||b.parent.setBorder({borderTop:""},n.name+"!"+G(r[t].rowIndex,r[t].colIndex),null,s),!h.style.borderLeft||r[t].style&&r[t].style.borderLeft||b.parent.setBorder({borderLeft:""},n.name+"!"+G(r[t].rowIndex,r[t].colIndex),null,s),!h.style.borderRight||r[t].style&&r[t].style.borderRight||b.parent.setBorder({borderRight:""},n.name+"!"+G(r[t].rowIndex,r[t].colIndex),null,s),!h.style.fontSize||r[t].style&&r[t].style.fontSize||(h.style.fontSize="11pt",d=!0,b.parent.notify(Ft,{style:{fontSize:"11pt"},rowIdx:r[t].rowIndex,colIdx:r[t].colIndex,lastCell:!0,isHeightCheckNeeded:!0,manualUpdate:!0,onActionUpdate:!0})),!h.style.fontFamily||r[t].style&&r[t].style.fontFamily||(d=!0,h.style.fontFamily="Calibri",b.parent.notify(Ft,{style:{fontFamily:"Calibri"},rowIdx:r[t].rowIndex,colIdx:r[t].colIndex,lastCell:!0,isHeightCheckNeeded:!0,manualUpdate:!0,onActionUpdate:!0}))),h.image&&i&&"clipboard"===i.action&&h.image.forEach(function(e){g.parent.notify(ms,{id:e.id,sheet:n,preventEventTrigger:!0,rowIdx:r[t].rowIndex,colIdx:r[t].colIndex})});var e={value:r[t].formula&&r[t].formula.toUpperCase().includes("UNIQUE")?null:r[t].value,formula:r[t].formula};r[t].format&&(e.format=r[t].format),r[t].isLocked&&(e.isLocked=r[t].isLocked),r[t].style&&(e.style=Object.assign({},r[t].style)),r[t].wrap&&(e.wrap=r[t].wrap),r[t].rowSpan&&(e.rowSpan=r[t].rowSpan),r[t].colSpan&&(e.colSpan=r[t].colSpan),r[t].hyperlink&&(e.hyperlink=r[t].hyperlink),r[t].image&&(e.image=r[t].image),r[t].notes&&(e.notes=r[t].notes),r[t].isReadOnly&&(e.isReadOnly=r[t].isReadOnly),r[t].formattedText&&(e.formattedText=r[t].formattedText),Vi(r[t].rowIndex,r[t].colIndex,n,e),c={action:"updateCellValue",address:[r[t].rowIndex,r[t].colIndex,r[t].rowIndex,r[t].colIndex],notes:r[t].notes,value:r[t].formula||r[t].value,sheetIndex:B(b.parent,n.name),skipFormatCheck:Jn(b.parent),isDelete:u,deletedRange:f,actionName:i.action},b.parent.notify(Ot,c),y&&!p&&(p=c.isFormulaDependent),(i&&"wrap"===i.action&&i.eventArgs.wrap||h.wrap&&!r[t].wrap)&&b.parent.notify(ir,{range:[r[t].rowIndex,r[t].colIndex,r[t].rowIndex,r[t].colIndex],wrap:!1,sheet:n,initial:!0}),i&&r[t].hyperlink&&"clear"===i.action&&(i.eventArgs.range=n.name+"!"+re([r[t].rowIndex,r[t].colIndex,r[t].rowIndex,r[t].colIndex]),c=b.parent.getCell(r[t].rowIndex,r[t].colIndex),"Clear All"===i.eventArgs.type||"Clear Hyperlinks"===i.eventArgs.type?b.parent.addHyperlink(r[t].hyperlink,i.eventArgs.range,r[t].value):"Clear Formats"===i.eventArgs.type&&c&&ee.addClass(c.querySelectorAll(".e-hyperlink"),"e-hyperlink-style")),r[t].validation&&b.parent.notify(pr,{rules:r[t].validation,range:n.name+"!"+G(r[t].rowIndex,r[t].colIndex)}),v&&r[t].value!==h.value&&b.parent.trigger("cellSave",{element:null,value:r[t].value,oldValue:h.value,formula:r[t].formula,cancel:!1,address:n.name+"!"+G(r[t].rowIndex,r[t].colIndex),displayText:b.parent.getDisplayText(r[t])}),y&&!p&&Yn(y,C,r[t].rowIndex,r[t].colIndex)}(x);t&&(e[0]===e[2]&&e[1]===e[3]&&(1<(o=se(e[0],e[1],n)).rowSpan&&(e[2]=e[0]+o.rowSpan-1),1<o.colSpan)&&(e[3]=e[1]+o.colSpan-1),t=!1,"autofill"===i.action||"clipboard"===i.action?t=!0:"format"===i.action&&"CellFormat"===i.eventArgs.requestType&&(t=Hn(i.eventArgs.style,!0)),this.parent.serviceLocator.getService("cell").refreshRange(e,!1,!1,!0,!1,Jn(this.parent),null,l,t),(C.length||p)&&this.parent.notify(Br,{cfModel:!p&&C,refreshAll:p,isAction:!0}),d)&&Xh(function(){g.parent.selectRange(n.selectedRange)})},Lp.prototype.checkRefreshNeeded=function(e,t){var r=!0;return e!==this.parent.activeSheetIndex&&(t||(this.parent.activeSheetIndex=e,this.parent.dataBind()),r=!1),r},Lp.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(Wa,this.updateUndoRedoIcons,this)},Lp.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(Wa,this.updateUndoRedoIcons))},Lp.prototype.destroy=function(){this.removeEventListener(),0<this.undoCollection.length&&(this.undoCollection=[]),0<this.redoCollection.length&&(this.redoCollection=[]),this.beforeActionData&&this.beforeActionData.cellDetails&&(this.beforeActionData.cellDetails=[]),this.parent=null},Lp.prototype.getModuleName=function(){return"undoredo"},Lp);function Lp(e){this.undoCollection=[],this.redoCollection=[],this.isUndo=!1,this.undoRedoStep=100,this.parent=e,this.addEventListener()}Mp.prototype.addEventListener=function(){this.parent.on(wo,this.ribbonClickHandler,this),this.parent.on(ir,this.wrapTextHandler,this),this.parent.on(Go,this.rowHeightChangedHandler,this),this.parent.on(Yo,this.colWidthChanged,this),this.parent.on(tl,this.updateWrapCell,this)},Mp.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(wo,this.ribbonClickHandler),this.parent.off(ir,this.wrapTextHandler),this.parent.off(Go,this.rowHeightChangedHandler),this.parent.off(Yo,this.colWidthChanged),this.parent.off(tl,this.updateWrapCell))},Mp.prototype.wrapTextHandler=function(e){if((e.initial||rd(this.parent,e.range,!0))&&(!e.isPublic||!Xd(this.parent,e.range))){e.initial&&!e.td&&!e.outsideViewport&&rd(this.parent,e.range,!0)&&(e.initial=!1);var t,r=void 0,n=void 0,i=void 0,o=void 0,a=this.parent.frozenRowCount(e.sheet),s=void 0,l=void 0;!ee.isNullOrUndefined(e.sheet.standardHeight)&&e.sheet.standardHeight<20?s=!0:l=this.parent.allowFiltering&&this.parent.filterModule.filterRange.has(this.parent.activeSheetIndex)&&this.parent.filterModule.filterRange.get(this.parent.activeSheetIndex).range;for(var h=e.range[0];h<=e.range[2];h++)for(var d,p,n=0,c=(p=(d=Nh(e.sheet,h)).customHeight)||e.isCustomHgt,u=!he(e.sheet,h),f=e.range[1];f<=e.range[3];f++)if(!((t=se(h,f,e.sheet,null,!0)).rowSpan<0||t.colSpan<0)){var g=1<t.rowSpan||1<t.colSpan;if((r=e.initial?e.td:u&&!pe(e.sheet,f)&&this.parent.getCell(h,f))?(e.wrap?(o=Dd(t.style&&t.style.fontFamily?t.style:this.parent.cellStyle),r.classList.add(jh)):(r.classList.remove(jh),o=null),(c||g||d.height<20||s||l&&h===l[0]&&f>=l[1]&&f<=l[3])&&this.updateWrapCell({rowIdx:h,colIdx:f,sheet:e.sheet,ele:r}),ee.Browser.isIE&&r.classList.add("e-ie-wrap")):o=null,!c&&!g){var m,v=Bd(e.sheet,h,f,1<t.colSpan?f+t.colSpan-1:f),y=this.parent.getDisplayText(t).toString();if(y=r&&y.indexOf("\n")<0&&(I=this.parent.element.querySelector(".e-spreadsheet-edit"))&&-1<I.textContent.indexOf("\n")?I.textContent:y)if(e.wrap){r&&r.classList.contains("e-alt-unwrap")&&r.classList.remove("e-alt-unwrap");var C=void 0,b=0,x=void 0;if(-1<y.indexOf("\n")){for(var S=y.split("\n"),w=S.length,x=0;x<w;x++)b+=C=0===(C=Pd(S[x],v,t.style,this.parent.cellStyle))?1:C;C=b}else C=Pd(y,v,t.style,this.parent.cellStyle);if(i=Ud(this.parent,h,f,e.sheet,t.style||this.parent.cellStyle,C,o),n=Math.max(n,i),1<t.rowSpan){var I=Ah(e.sheet,h,h+(t.rowSpan-1));if(n<=I)return;i=n=kh(e.sheet,h)+(n-I)}Hd(e.sheet,h,f,i)}else r&&-1<y.indexOf("\n")&&r.classList.add("e-alt-unwrap"),i=Ud(this.parent,h,f,e.sheet,t.style||this.parent.cellStyle,1,o),Hd(e.sheet,h,f,i),n=Math.max(Vd(e.sheet,h),20);else e.wrap&&y||(Hd(e.sheet,h,f,20),n=Math.max(Vd(e.sheet,h),20));f===e.range[3]&&(m=kh(e.sheet,h),e.wrap&&20<n&&Vd(e.sheet,h)<=n||(!e.wrap||!y)&&Vd(e.sheet,h)<m&&20<m)&&m!==n&&(r?(Ad(this.parent,e.sheet,n,h,e.row,e.hRow,u),r&&e.sheet.conditionalFormats&&e.sheet.conditionalFormats.length&&this.parent.notify(Br,{indexes:[h,f],isAction:!0})):Ad(this.parent,e.sheet,n,h,null,null,u,!u||h>this.parent.viewport.bottomIndex||a<=h&&h<this.parent.viewport.topIndex+a))}r&&(c&&!g&&(y=this.parent.getDisplayText(t),e.wrap?r.classList.contains("e-alt-unwrap")&&r.classList.remove("e-alt-unwrap"):-1<y.indexOf("\n")&&r.classList.add("e-alt-unwrap")),e.wrap?p?r.style.lineHeight&&(r.style.lineHeight=""):r.style.lineHeight=parseFloat(t.style&&t.style.fontSize||this.parent.cellStyle.fontSize)*o+"pt":r.style.lineHeight="")}e.initial||this.parent.notify(js,null)}},Mp.prototype.ribbonClickHandler=function(e){var t,r,e=ee.closest(e.originalEvent.target,".e-btn");e&&e.id===this.parent.element.id+"_wrap"&&(e=e.classList.contains("e-active"),r={address:t=C(this.parent.getActiveSheet()),wrap:e,cancel:!1},Xd(this.parent)?this.parent.notify(qa,null):(this.parent.notify(gt,{action:"beforeWrap",eventArgs:r}),r.cancel||(zi(this.parent.getActiveSheet().selectedRange,e,this.parent),this.parent.notify(le,{action:"wrap",eventArgs:{address:t,wrap:e}}))))},Mp.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++)se(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="")}},Mp.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++)se(t,e.colIdx,e.sheet,!1,!0).wrap&&(e.rowIdx=t,e.ele=this.parent.getCell(t,e.colIdx),this.updateWrapCell(e))}},Mp.prototype.updateWrapCell=function(e){if(e.ele&&!e.ele.querySelector(".e-wrap-content")){for(var t=this.wrapCell.cloneNode(),r=e.ele.querySelector(".e-filter-btn");e.ele.childElementCount&&!ee.isNullOrUndefined(e.ele.firstElementChild)&&-1===e.ele.firstElementChild.className.indexOf("e-addNoteIndicator");)t.appendChild(e.ele.firstElementChild);var n=void 0;!ee.isNullOrUndefined(e.ele.firstElementChild)&&-1<e.ele.firstElementChild.className.indexOf("e-addNoteIndicator")&&(n=e.ele.firstElementChild),r&&(e.ele.firstChild?e.ele.insertBefore(r,e.ele.firstChild):e.ele.appendChild(r)),se(e.rowIdx,e.colIdx,e.sheet,!1,!0).hyperlink||((r=e.ele.lastChild)&&3===r.nodeType?(t.appendChild(document.createTextNode(r.textContent)),r.textContent=""):(t.appendChild(document.createTextNode(e.ele.textContent)),e.ele.textContent="")),e.ele.appendChild(t),ee.isNullOrUndefined(n)||e.ele.appendChild(n)}},Mp.prototype.getModuleName=function(){return"wrapText"},Mp.prototype.destroy=function(){this.removeEventListener(),this.wrapCell&&(this.wrapCell.remove(),this.wrapCell=null),this.parent=null};var Pp=Mp;function Mp(e){this.parent=e,this.wrapCell=this.parent.createElement("span",{className:"e-wrap-content"}),this.addEventListener()}Up.prototype.insert=function(e){var t,r,n,i,o,a=e.eventArgs,s=(this.parent.notify(Zr,a),ae(this.parent,a.activeSheetIndex));switch(a.modelType){case"Sheet":this.parent.notify(bo,{startIdx:a.index,endIdx:a.index+(a.model.length-1),preventUpdate:!a.isAction}),this.parent.renderModule.refreshSheet();break;case"Row":a.activeSheetIndex===this.parent.activeSheetIndex&&(r=this.parent.frozenRowCount(s),!this.parent.scrollSettings.enableVirtualization||a.index<=this.parent.viewport.bottomIndex?!a.freezePane&&this.parent.scrollSettings.enableVirtualization?(t=this.parent.frozenColCount(s),a.index>=this.parent.viewport.topIndex+r&&(n=[],i=void 0,t?(i=W(s.topLeftCell)[1],n.push(r),n.push(this.parent.viewport.leftIndex+t)):i=this.parent.viewport.leftIndex,o=this.parent.viewport.leftIndex,this.parent.renderModule.refreshUI({rowIndex:this.parent.viewport.topIndex,colIndex:i,refresh:"Row",frozenIndexes:n,skipUpdateOnFirst:this.parent.viewport.topIndex+r===Y(s,r,!0)}),t)&&(this.parent.viewport.leftIndex=o),i=W(s.paneTopLeftCell)[0],a.index<i&&(this.parent.notify(Ks,{scrollTop:Ah(s,r,i-1,!0)}),this.parent.goTo(G(a.index,Y(s,t,!0,"columns")))),this.parent.selectRange(s.selectedRange)):this.parent.renderModule.refreshSheet(!1,!1,!0):!this.parent.scrollSettings.isFinite||this.parent.viewport.topIndex+r!==Y(s,0,!0)&&this.parent.viewport.bottomIndex!==Y(s,s.rowCount-a.model.length-1,!1)||this.parent.renderModule.refreshSheet(!1,!1,!0));break;case"Column":a.activeSheetIndex===this.parent.activeSheetIndex&&(t=this.parent.frozenColCount(s),!this.parent.scrollSettings.enableVirtualization||a.index<=this.parent.viewport.rightIndex?!a.freezePane&&this.parent.scrollSettings.enableVirtualization?(r=this.parent.frozenRowCount(s),a.index>=this.parent.viewport.leftIndex+t&&(n=[],r&&(n=[r+this.parent.viewport.topIndex,t]),o=r?W(s.topLeftCell)[0]:this.parent.viewport.topIndex,i=this.parent.viewport.topIndex,this.parent.renderModule.refreshUI({skipUpdateOnFirst:this.parent.viewport.leftIndex+t===Y(s,t,!0,"columns"),rowIndex:o,colIndex:this.parent.viewport.leftIndex,refresh:"Column",frozenIndexes:n}),r)&&(this.parent.viewport.topIndex=i),o=W(s.paneTopLeftCell)[1],a.index<o&&(this.parent.notify(Ks,{scrollLeft:Uh(s,0,o-1,!0)}),this.parent.goTo(G(Y(s,r,!0),a.index))),this.parent.selectRange(s.selectedRange)):this.parent.renderModule.refreshSheet(!1,!1,!0):!this.parent.scrollSettings.isFinite||this.parent.viewport.leftIndex+t!==Y(s,0,!0,"columns")&&this.parent.viewport.rightIndex!==Y(s,s.colCount-a.model.length-1,!1,"columns")||this.parent.renderModule.refreshSheet(!1,!1,!0))}this.refreshImgElement(a.model.length,this.parent.activeSheetIndex,a.modelType,a.index),a.isAction?(delete a.isAction,this.parent.notify(le,e),ce(this.parent.element)):a.isUndoRedo||(a.isMethod=!0,this.parent.notify(ct,e))},Up.prototype.refreshImgElement=function(e,t,r,n){for(var i,o=this.parent.sheets[t],a=[0,0,o.usedRange.rowIndex,o.usedRange.colIndex],s=0;s<=a[2];s++)for(var l=a[1];l<=a[3];l++)(i=se(s,l,o))&&i.image&&0<i.image.length&&("Row"===r&&n<=s||"Column"===r&&n<=l)&&this.parent.notify(bs,{rowIdx:s,colIdx:l,sheetIdx:t,type:r,count:e,status:"insert"})},Up.prototype.addEventListener=function(){this.parent.on(ar,this.insert,this)},Up.prototype.destroy=function(){this.removeEventListener(),this.parent=null},Up.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off(ar,this.insert)},Up.prototype.getModuleName=function(){return"insert"};var Bp=Up;function Up(e){this.parent=e,this.addEventListener()}Vp.prototype.delete=function(e){var t,r,n,i,o,a,s,l=e.eventArgs;"Sheet"===l.modelType?((t=l.activeSheetIndex>=l.startIndex&&l.activeSheetIndex<=l.endIndex)&&this.parent.setProperties({activeSheetIndex:this.parent.skipHiddenSheets(l.startIndex<this.parent.sheets.length?l.startIndex:l.startIndex?l.startIndex-1:0)},!0),l.endIndex<l.activeSheetIndex&&this.parent.setProperties({activeSheetIndex:l.activeSheetIndex-(l.endIndex+1-l.startIndex)},!0),this.parent.notify(Qi,null),t&&this.parent.renderModule.refreshSheet(!1,!1,!0)):l.activeSheetIndex===this.parent.activeSheetIndex&&(t=this.parent.getActiveSheet(),a=this.parent.frozenRowCount(t),r=this.parent.frozenColCount(t),"Row"===l.modelType?(!this.parent.scrollSettings.enableVirtualization||l.startIndex<=this.parent.viewport.bottomIndex)&&(this.parent.scrollSettings.enableVirtualization?l.startIndex<W(t.paneTopLeftCell)[0]?(this.parent.updateTopLeftCell(Y(t,l.startIndex-1<a?a:l.startIndex-1,!0)-a,null,"col"),this.parent.renderModule.refreshSheet(!1,!1,!0)):l.freezePane||this.parent.scrollSettings.isFinite&&this.parent.viewport.bottomIndex>=Y(t,t.rowCount-1,!1)?this.parent.renderModule.refreshSheet(!1,!1,!0):(o=[],s=this.parent.frozenColCount(t),i=void 0,n=this.parent.viewport.leftIndex,i=s?(o.push(a),o.push(n+s),W(t.topLeftCell)[1]):n,this.parent.renderModule.refreshUI({rowIndex:this.parent.viewport.topIndex,refresh:"Row",colIndex:i,skipUpdateOnFirst:this.parent.viewport.topIndex+a===Y(t,a,!0),frozenIndexes:o}),s&&(this.parent.viewport.leftIndex=n),this.parent.selectRange(t.selectedRange)):this.parent.renderModule.refreshSheet(!1,!1,!0)):(!1!==l.refreshSheet&&(!this.parent.scrollSettings.enableVirtualization||l.startIndex<=this.parent.viewport.rightIndex)&&(this.parent.scrollSettings.enableVirtualization?l.startIndex<W(t.paneTopLeftCell)[1]?(this.parent.updateTopLeftCell(null,Y(t,l.startIndex-1<r?r:l.startIndex-1,!0,"columns")-r,"row"),this.parent.renderModule.refreshSheet(!1,!1,!0)):l.freezePane||!0===l.refreshSheet?this.parent.renderModule.refreshSheet(!1,!1,!0):(i=this.parent.frozenRowCount(t),o=[],a=this.parent.viewport.topIndex,s=i?W(t.topLeftCell)[0]:a,i&&(o=[i+a,r]),this.parent.renderModule.refreshUI({rowIndex:s,refresh:"Column",colIndex:this.parent.viewport.leftIndex,insertDelete:!0,skipUpdateOnFirst:this.parent.viewport.leftIndex+r===Y(t,r,!0,"columns"),frozenIndexes:o}),i&&(this.parent.viewport.topIndex=a),this.parent.selectRange(t.selectedRange)):this.parent.renderModule.refreshSheet(!1,!1,!0)),delete l.refreshSheet)),this.refreshImgElement(l.deletedModel.length,this.parent.activeSheetIndex,l.modelType,l.startIndex),l.isAction?(delete l.isAction,this.parent.notify(le,e),ce(this.parent.element)):l.isUndoRedo||(l.isMethod=!0,this.parent.notify(ct,e))},Vp.prototype.addEventListener=function(){this.parent.on(sr,this.delete,this)},Vp.prototype.destroy=function(){this.removeEventListener(),this.parent=null},Vp.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off(sr,this.delete)},Vp.prototype.getModuleName=function(){return"delete"},Vp.prototype.refreshImgElement=function(e,t,r,n){for(var i,o=this.parent.sheets[t],a=[0,0,o.usedRange.rowIndex,o.usedRange.colIndex],s=0;s<=a[2];s++)for(var l=a[1];l<=a[3];l++)(i=se(s,l,o))&&i.image&&0<i.image.length&&("Row"===r&&n<=s||"Column"===r&&n<=l)&&this.parent.notify(bs,{rowIdx:s,colIdx:l,sheetIdx:t,type:r,count:e,status:"delete"})};var Hp=Vp;function Vp(e){this.parent=e,this.addEventListener()}zp.prototype.destroy=function(){this.removeEventListener();var e,t={},r=(!this.parent.isDestroyed&&!this.parent.refreshing&&(r=W(this.parent.getActiveSheet().activeCell),e=this.parent.getCell(r[0],r[1]))&&(t={rowIdx:r[0],colIdx:r[1],td:e,isRefresh:!0}),this.removeListDropdownHandler(this.parent.element.querySelector(".e-validation-list"),t),ee.select("#"+this.parent.element.id+"_datavalidation-popup"));r&&r.remove(),this.typeData=[],this.operatorData=[],this.dataList&&(this.dataList=null),this.formObj&&(this.formObj.destroy(),this.formObj=null),this.parent=null},zp.prototype.addEventListener=function(){ee.Browser.isDevice&&"safari"===ee.Browser.info.name&&(ee.Browser.isIos||ee.Browser.isIos7)?ee.EventHandler.add(this.parent.element,"touchend",this.listOpen,this):ee.EventHandler.add(this.parent.element,"dblclick",this.listOpen,this),this.parent.on(Da,this.initiateDataValidationHandler,this),this.parent.on(La,this.invalidDataHandler,this),this.parent.on(dr,this.checkDataValidation,this),this.parent.on(Pt,this.listHandler,this),this.parent.on(lo,this.keyUpHandler,this),this.parent.on(Za,this.removeValidationHandler,this),this.parent.on($r,this.invalidElementHandler,this),this.parent.on(Go,this.listValidationHeightHandler,this),this.parent.on(En,this.addListValidationDropdownHandler,this)},zp.prototype.removeEventListener=function(){ee.Browser.isDevice&&"safari"===ee.Browser.info.name&&(ee.Browser.isIos||ee.Browser.isIos7)?ee.EventHandler.remove(this.parent.element,"touchend",this.listOpen):ee.EventHandler.remove(this.parent.element,"dblclick",this.listOpen),this.parent.isDestroyed||(this.parent.off(Da,this.initiateDataValidationHandler),this.parent.off(La,this.invalidDataHandler),this.parent.off(dr,this.checkDataValidation),this.parent.off(Pt,this.listHandler),this.parent.off(lo,this.keyUpHandler),this.parent.off(Za,this.removeValidationHandler),this.parent.off($r,this.invalidElementHandler),this.parent.off(Go,this.listValidationHeightHandler),this.parent.off(En,this.addListValidationDropdownHandler))},zp.prototype.removeValidationHandler=function(e){var t={cancel:!1,isColSelected:e.isCol};if(e.range&&e.range.includes("!")){if(n=e.range,!(r=ae(this.parent,B(this.parent,n.substring(0,n.lastIndexOf("!"))))))return}else{var r,n=(r=this.parent.getActiveSheet()).name+"!";e.range?n+=e.range:(n+=(r=this.getRange(r.selectedRange)).range,t.isColSelected=r.isColSelected)}t.range=n,e.isAction&&this.parent.notify(gt,{eventArgs:t,action:"removeValidation"}),t.cancel||(this.parent.notify(pr,{range:n,isRemoveValidation:!0,viewport:this.parent.viewport}),e.isAction&&(delete t.cancel,this.parent.notify(le,{eventArgs:t,action:"removeValidation"})))},zp.prototype.updateNoteIndicator=function(e,t,r){var n=e.querySelector(".e-addNoteIndicator");n&&(ee.remove(n),this.parent.notify(ha,{targetElement:e,rowIndex:t,columnIndex:r,skipEvent:!0}))},zp.prototype.keyUpHandler=function(e){var t=e.target,r=this.parent.element.querySelector(".e-datavalidation-dlg");ee.closest(t,".e-values")&&r&&13!==e.keyCode&&(e=(t=r.querySelector(".e-values")).querySelector(".e-dlg-error"),(r=r.querySelector(".e-footer-content").querySelector(".e-primary")).hasAttribute("disabled")&&r.removeAttribute("disabled"),e)&&t.removeChild(e)},zp.prototype.listOpen=function(e){e=e.target;this.listObj&&e.classList.contains("e-cell")&&e.querySelector(".e-validation-list")&&this.parent.isEdit&&this.listObj.showPopup()},zp.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(gt,t),r.cancel)||(e.isRemoveHighlight?this.parent.removeInvalidHighlight(r.range):this.parent.addInvalidHighlight(r.range),e.isPublic)||this.parent.notify(le,t)},zp.prototype.listHandler=function(){var e=this.parent.getActiveSheet(),t=W(e.activeCell),r=se(t[0],t[1],e),n=this.parent.getCell(t[0],t[1]);if(n){this.removeListDropdownHandler(this.parent.element.getElementsByClassName("e-validation-list")[0]);e=r&&r.validation||e.columns&&e.columns[t[1]]&&e.columns[t[1]].validation;if(e&&"List"===e.type){if(e.address&&!Dn(e.address,t[0],t[1]))return;this.addListValidationDropdownHandler({cell:r,validation:e,td:n,rowIdx:t[0],colIdx:t[1]})}r&&r.validation&&(r.validation=e)}},zp.prototype.removeListDropdownHandler=function(e,t){e&&(this.listObj&&this.listObj.destroy(),ee.remove(e),t?t.isRefresh&&this.updateNoteIndicator(t.td,t.rowIdx,t.colIdx):!ee.isNullOrUndefined(this.parent.selectionModule.previousActiveCell)&&(e=W(this.parent.selectionModule.previousActiveCell),t=this.parent.getCell(e[0],e[1]))&&this.updateNoteIndicator(t,e[0],e[1]))},zp.prototype.addListValidationDropdownHandler=function(e){var t,r,n,i,o=this,a=e.validation.inCellDropDown;if(e.isRefresh){if(!e.td&&(e.td=this.parent.getCell(e.rowIdx,e.colIdx),!e.td))return;if(this.removeListDropdownHandler(e.td.querySelector(".e-validation-list"),e),"List"!==e.validation.type)return;ee.isNullOrUndefined(a)&&(a=!0)}else ee.isNullOrUndefined(e.validation.ignoreBlank)&&(e.validation.ignoreBlank=!0),ee.isNullOrUndefined(a)&&(a=e.validation.inCellDropDown=!0);a&&(a=this.parent.createElement("div",{className:"e-validation-list"}),t=this.parent.createElement("input",{id:this.parent.element.id+"listValid"}),a.appendChild(t),i=(n=e.td).getElementsByClassName("e-wrap-content")[0]||n,this.listValidationHeightHandler({ddlCont:a}),i.insertBefore(a,i.firstChild),a=this.getListDataSource(e.validation),this.listObj=new I.DropDownList({index:this.setDropDownListIndex(a,e.cell),dataSource:a,fields:{text:"text",value:"id"},width:"0px",popupHeight:"200px",change:function(){return o.listValueChange(o.listObj.text)},beforeOpen:function(){(r=window.browserDetails.isDevice)&&(window.browserDetails.isDevice=!1)},open:function(e){e.popup.offsetX=o.listObj.enableRtl?3:-n.offsetWidth+(o.parent.enableRtl?4:24),e.popup.offsetY=-(n.querySelector(".e-control-wrapper.e-ddl").offsetHeight-18),e.popup.element.style.width=n.offsetWidth-1+"px",r&&(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()),ce(o.parent.element)}}),this.listObj.appendTo(t),this.updateNoteIndicator(n,e.rowIdx,e.colIdx))},zp.prototype.listValidationHeightHandler=function(e){var t,r=this.parent.getActiveSheet(),n=W(r.activeCell),i=se(n[0],n[1],r),i=i&&i.validation||r.columns&&r.columns[n[1]]&&r.columns[n[1]].validation;i&&"List"===i.type&&i.inCellDropDown&&((i=kh(r,n[0],!0)-Md(n[0],n[1],r))<=18?(t=e.ddlCont||this.parent.element.querySelector(".e-validation-list"))&&(t.style.height=i+"px"):e.ddlCont||(t=this.parent.element.querySelector(".e-validation-list"))&&t.style.removeProperty("height"))},zp.prototype.setDropDownListIndex=function(e,t){if(t&&!ee.isNullOrUndefined(t.value))for(var r=t.value.toString(),n=oe(r),i=n&&ee.getNumericObject(this.parent.locale),o=0,a=e.length;o<a;o++)if(e[o].text===r||n&&this.parseValidationValue(e[o].text,i).toString()===r)return o;return null},zp.prototype.getListDataSource=function(r){var n=this,e=[],t=0,i=this.parent.definedNames,o=r.value1,a=o.startsWith("=");if(0<i.length&&a)for(var s=o.split("=")[1],l=0,h=i.length;l<h;l++)if(i[l].name===s){for(var d=i[l].refersTo;d.includes("'");)d=d.replace("'","");o=d}if(a){var p=void 0,a=void 0,c=void 0,u=o.lastIndexOf("!"),f=(-1<u?(c=o.substring(1,u),a=o.substring(u+1),c.startsWith("'")&&c.endsWith("'")&&(c=c.substring(1,c.length-1)),p=ae(this.parent,B(this.parent,c))):(p=this.parent.getActiveSheet(),a=o.substring(1)),this.parent.getActiveSheet());if(p){p.name!==f.name&&(m=te(f.selectedRange),p.ranges.forEach(function(e){e.info&&e.info.loadedRange&&e.info.loadedRange.length||(g=!0)}),g)&&(this.parent.showSpinner(),pi(this.parent,p.name+"!"+a).then(function(){var e,t;n.parent.hideSpinner(),f.name===n.parent.getActiveSheet().name&&(t=te(n.parent.getActiveSheet().selectedRange))[0]===m[0]&&t[1]===m[1]&&(e=n.getListDataSource(r),n.listObj.dataSource=e,t=se(t[0],t[1],f),n.listObj.index=n.setDropDownListIndex(e,t),n.listObj.dataBind())}));for(var g,m,v=void 0,u=a.split(":"),y=(v=u[0]&&u[1]&&(u[0].match(/[a-z]+$/gi)&&u[1].match(/[a-z]+$/gi)||u[0].match(/^[0-9]/g)&&u[1].match(/^[0-9]/g))?(c=this.parent.getIndexes(a)).isCol?[0,c.startIdx,p.usedRange.rowIndex,c.startIdx]:[c.startIdx,0,c.startIdx,p.usedRange.colIndex]:te(a))[0];y<=v[2];y++){p.rows[y]||Rh(p,y,{});for(var C=v[1];C<=v[3];C++){p.rows[y].cells||Vi(y,C,p,{}),t+=1;var b=p.rows[y].cells[C],b=this.parent.getDisplayText(b)||"";e.push({text:b,id:"list-"+t})}}}}else for(var x=this.getListOfValues(o),l=0;l<x.length;l++)e.push({text:x[l],id:"list-"+(t+=1)});return e},zp.prototype.listValueChange=function(e){var t,r=this.parent.getActiveSheet(),n=P(r.activeCell),i=Object.assign({},se(n[0],n[1],r));r.isProtected&&Mn(i,de(r,n[1]))?this.parent.notify(_a,null):ti(i,de(r,n[1]),Nh(r,n[0]))?this.parent.notify(qa,null):(this.parent.isEdit&&this.parent.closeEdit(),t={value:e,oldValue:i.value,address:r.name+"!"+r.activeCell,cancel:!1},this.parent.notify(gt,{action:"cellSave",eventArgs:t}),t.cancel||_n(this.parent,r,{cell:{value:e,formula:""},rowIdx:n[0],colIdx:n[1],valChange:!0,lastCell:!0,uiRefresh:!0,checkCF:!0})||(delete(t=se(n[0],n[1],r,!1,!0)).formula,this.parent.notify(ao,{action:"refreshFormulabar",cell:t}),this.parent.notify(le,{action:"cellSave",eventArgs:{value:e,oldValue:i.value,address:r.name+"!"+r.activeCell}})))},zp.prototype.getRange=function(e){var t,r=te(e),n=this.parent.getActiveSheet().rowCount;return r[2]===n-1&&0===r[0]&&(e=e.replace(/[0-9]/g,""),t=!0),{range:e,isColSelected:t}},zp.prototype.initiateDataValidationHandler=function(e,r){var n=this,t=this.parent.serviceLocator.getService(T),i=!0,o=!0,a=!0,s=!1,l=this.parent.getActiveSheet(),h=ne(te(d=l.selectedRange)),d=this.getRange(d).range,p=this.validateRange(h,l);if(!p.extendValidation&&!p.moreValidation||e){for(var c,u=h[0];u<=h[2]&&!s;u++)if(l.rows[u])for(var f=h[1];f<=h[3];f++)if(l.rows[u].cells&&l.rows[u].cells[f]){var g=l.rows[u].cells[f].validation;if(g&&(a=!1,v=g.type,y=g.operator,C=g.value1,b=g.value2,i=ee.isNullOrUndefined(g.ignoreBlank)?i:g.ignoreBlank,o=ee.isNullOrUndefined(g.inCellDropDown)?o:g.inCellDropDown,"Custom"===v)){s=!0;break}}if(a)for(var m=h[1];m<=h[3];m++){var v,y,C,b,x,S,w=de(l,m),g=w&&w.validation;Hh(w,h[0],m)&&g&&(a=!1,v=g.type,y=g.operator,C=g.value1,b=g.value2,i=ee.isNullOrUndefined(g.ignoreBlank)?i:g.ignoreBlank,o=ee.isNullOrUndefined(g.inCellDropDown)?o:g.inCellDropDown,w=[0,m,0,m],S=se((x=te(l.selectedRange))[0],x[1],l,null,!0),g)&&!S.validation&&(C=Vn(x,w,l,this.parent,{formula:C}),""!==b)&&(b=Vn(x,w,l,this.parent,{formula:b}))}this.parent.element.querySelector(".e-datavalidation-dlg")||((c=this.parent.serviceLocator.getService(O)).show({width:375,showCloseIcon:!0,isModal:!0,cssClass:"e-datavalidation-dlg",header:t.getConstant("DataValidation"),beforeOpen:function(e){var t={dialogName:"ValidationDialog",element:e.element,target:e.target,cancel:e.cancel};n.parent.trigger("dialogBeforeOpen",t),t.cancel&&(e.cancel=!0),r&&(a=!0),c.dialogInstance.content=n.dataValidationContent(a,v,y,C,b,i,o,d),c.dialogInstance.dataBind(),ce(n.parent.element)},beforeClose:this.dialogBeforeClose.bind(this),buttons:[{buttonModel:{content:t.getConstant("ClearAll"),cssClass:"e-btn e-clearall-btn e-flat"},click:function(){c.dialogInstance.content=n.dataValidationContent(!0,v,y,C,b,i,o,d),c.dialogInstance.dataBind()}},{buttonModel:{content:t.getConstant("Apply"),isPrimary:!0},click:function(){n.dlgClickHandler(c)}}]}),c.dialogInstance.refresh())}else p.moreValidation&&this.moreValidationDlg(),p.extendValidation&&this.extendValidationDlg()},zp.prototype.dataValidationContent=function(e,r,t,n,i,o,a,s){var l,h=this,d=this.parent.serviceLocator.getService(T),n=(e?l=x="0":x=("Date"===r||"Time"===r?(l=(p=function(e){var t;return oe(e)?(t={cell:{value:e},type:r.toLowerCase(),value:e},h.parent.notify(Lt,t),t.value):e})(n),p):(l=(p=function(e){var t;return e=oe(e)&&(e=e.toString(),"."!==(t=ee.getNumericObject(h.parent.locale)).decimal)&&e.includes(".")?e.replace(".",t.decimal):e})(n),p))(i),this.parent.createElement("div",{className:"e-validation-dlg"})),p=this.parent.createElement("div",{className:"e-cellrange"}),i=this.parent.createElement("div",{className:"e-allowdata"}),c=this.parent.createElement("div",{className:"e-values"}),u=this.parent.createElement("div",{className:"e-ignoreblank"}),f=(this.divElements.push(n),this.divElements.push(p),this.divElements.push(i),this.divElements.push(c),this.divElements.push(u),n.appendChild(p),n.appendChild(i),n.appendChild(c),n.appendChild(u),this.parent.createElement("span",{className:"e-header"})),s=(f.innerText=d.getConstant("CellRange"),this.parent.createElement("input",{className:"e-input",attrs:{value:s,"aria-label":d.getConstant("CellRange")}})),p=(p.appendChild(f),p.appendChild(s),this.parent.createElement("div",{className:"e-allow"})),g=this.parent.createElement("div",{className:"e-data"}),i=(i.appendChild(p),i.appendChild(g),this.parent.createElement("span",{className:"e-header"})),m=(i.innerText=d.getConstant("Allow"),this.typeData=[{text:d.getConstant("WholeNumber"),id:"type-1"},{text:d.getConstant("Decimal"),id:"type-2"},{text:d.getConstant("Date"),id:"type-3"},{text:d.getConstant("Time"),id:"type-4"},{text:d.getConstant("TextLength"),id:"type-5"},{text:d.getConstant("List"),id:"type-6"},{text:d.getConstant("Custom"),id:"type-7"}],this.operatorData=[{text:d.getConstant("Between"),id:"operator-1"},{text:d.getConstant("NotBetween"),id:"operator-2"},{text:d.getConstant("EqualTo"),id:"operator-3"},{text:d.getConstant("NotEqualTo"),id:"operator-4"},{text:d.getConstant("GreaterThan"),id:"operator-5"},{text:d.getConstant("LessThan"),id:"operator-6"},{text:d.getConstant("GreaterThanOrEqualTo"),id:"operator-7"},{text:d.getConstant("LessThanOrEqualTo"),id:"operator-8"}],this.parent.createElement("input",{className:"e-select"})),v=(this.spanElements.push(f),this.inputElements.push(s),this.divElements.push(p),this.divElements.push(g),this.spanElements.push(i),this.inputElements.push(m),r=r&&this.formattedType(r),0);if(!e)for(var y=0;y<this.typeData.length;y++)if(r===this.formattedType(this.typeData[y].text)){v=y;break}if(e||"List"!==r&&"Custom"!==r){var C=0,f=this.parent.createElement("span",{className:"e-header"}),s=(f.innerText=d.getConstant("Data"),this.parent.createElement("input",{className:"e-select"}));if(!e)for(y=0;y<this.operatorData.length;y++)if(t===this.formattedValue(this.operatorData[y].text)){C=y;break}g.appendChild(f),g.appendChild(s),this.spanElements.push(f),this.inputElements.push(s),this.dataList=new I.DropDownList({dataSource:this.operatorData,index:C,popupHeight:"200px",change:this.userInput.bind(this)}),this.dropDownListElements.push(this.dataList),this.dataList.appendTo(s)}else"Custom"!==r&&(f=this.parent.createElement("input",{className:"e-checkbox"}),g.appendChild(f),s=new w.CheckBox({label:d.getConstant("InCellDropDown"),checked:a}),this.checkBoxElements.push(s),s.appendTo(f),this.inputElements.push(f));p.appendChild(i),p.appendChild(m),this.typeList=new I.DropDownList({dataSource:this.typeData,index:v,popupHeight:"200px",change:this.userInput.bind(this)}),this.dropDownListElements.push(this.typeList),this.typeList.appendTo(m);function b(e,t){var r=h.parent.createElement("span",{className:"e-header"}),e=(r.innerText=e,h.parent.createElement("input",{className:"e-input",attrs:{value:t}}));c.appendChild(r),c.appendChild(e),h.spanElements.push(r),h.inputElements.push(e)}e||this.typeList.value!==d.getConstant("List")&&this.typeList.value!==d.getConstant("Custom")&&(this.dataList.value===d.getConstant("Between")||this.dataList.value===d.getConstant("NotBetween"))?(g=this.parent.createElement("div",{className:"e-minimum"}),a=this.parent.createElement("div",{className:"e-maximum"}),c.appendChild(g),c.appendChild(a),(s=this.parent.createElement("span",{className:"e-header"})).innerText=d.getConstant("Minimum"),(f=this.parent.createElement("span",{className:"e-header"})).innerText=d.getConstant("Maximum"),i=this.parent.createElement("input",{id:"minvalue",className:"e-input",attrs:{value:l,"aria-label":d.getConstant("Minimum")}}),p=this.parent.createElement("input",{id:"maxvalue",className:"e-input",attrs:{value:x,"aria-label":d.getConstant("Maximum")}}),g.appendChild(s),g.appendChild(i),a.appendChild(f),a.appendChild(p),this.divElements.push(g),this.divElements.push(a),this.spanElements.push(s),this.spanElements.push(f),this.inputElements.push(i),this.inputElements.push(p),m=new S.NumericTextBox({value:0}),this.numericTextBoxElements.push(m),m.appendTo("#minvalue"),x=new S.NumericTextBox({value:0}),this.numericTextBoxElements.push(x),x.appendTo("#maxvalue")):b(e||"List"!==r?e||"Custom"!==r?d.getConstant("Value"):d.getConstant("Formula"):d.getConstant("Sources"),l);var x,g=o,a=this.parent.createElement("input",{className:"e-checkbox"}),s=(u.appendChild(a),new w.CheckBox({label:d.getConstant("IgnoreBlank"),checked:g}));return this.checkBoxElements.push(s),s.appendTo(a),this.inputElements.push(a),n},zp.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=[],Kd(this.spanElements),this.spanElements=[],Kd(this.inputElements),this.inputElements=[],Kd(this.divElements),this.divElements=[]},zp.prototype.validateRange=function(e,t){for(var r=!1,n=!1,i=0,o=[],a=[],s=[],l=[],h=e[0];h<=e[2];h++)if(t.rows[h])for(var d=e[1];d<=e[3];d++)t.rows[h].cells&&t.rows[h].cells[d]&&(C=t.rows[h].cells[d]).validation&&(o.push(C.validation.type),a.push(C.validation.operator),s.push(C.validation.value1),l.push(C.validation.value2));for(var p=e[1];p<=e[3];p++)(b=de(t,p))&&b.validation&&(b.validation.address||i++,o.push(b.validation.type),a.push(b.validation.operator),s.push(b.validation.value1),l.push(b.validation.value2));for(var c=[],p=0;p<o.length;p++)-1===c.indexOf(o[p])&&c.push(o[p]);var u=[];if(!(r=1<c.length?!0:r)){for(var u=[],f=0;f<a.length;f++)-1===u.indexOf(a[f])&&u.push(a[f]);1<u.length&&(r=!0)}if(!r){u=[];for(f=0;f<s.length;f++)-1===u.indexOf(s[f])&&u.push(s[f]);1<u.length&&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]);1<u.length&&(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(var C,d=e[1];d<=e[3];d++)t.rows[y].cells&&t.rows[y].cells[d]&&(m++,(C=t.rows[y].cells[d]).validation)&&g++;if(0===g)for(var b,p=e[1];p<=e[3];p++)(b=de(t,p))&&b.validation&&g++;v&&i?n=!1:0<g&&1<m&&g!==m&&(n=!0)}return{moreValidation:r,extendValidation:n}},zp.prototype.moreValidationDlg=function(){var r=this,n=this.parent.serviceLocator.getService(T),i=this.parent.serviceLocator.getService(O),e=!1,t={width:350,isModal:!0,showCloseIcon:!0,cssClass:"e-goto-dlg",header:n.getConstant("Spreadsheet"),beforeOpen:function(e){var t={dialogName:"MoreValidation",element:e.element,target:e.target,cancel:e.cancel};r.parent.trigger("dialogBeforeOpen",t),t.cancel&&(e.cancel=!0),i.dialogInstance.content=n.getConstant("MoreValidation"),i.dialogInstance.dataBind(),ce(r.parent.element)},buttons:[{buttonModel:{content:n.getConstant("Ok"),isPrimary:!0,cssClass:"e-btn-goto-ok"},click:function(){i.hide(),e=!0}}],close:function(){e?(r.initiateDataValidationHandler(!0),e=!1):i.hide()}};i.show(t)},zp.prototype.extendValidationDlg=function(){var r=this,n=this.parent.serviceLocator.getService(T),i=this.parent.serviceLocator.getService(O),e=!1,t=!1,o={width:550,isModal:!0,showCloseIcon:!0,cssClass:"e-goto-dlg",header:n.getConstant("Spreadsheet"),beforeOpen:function(e){var t={dialogName:"ExtendValidation",element:e.element,target:e.target,cancel:e.cancel};r.parent.trigger("dialogBeforeOpen",t),t.cancel&&(e.cancel=!0),i.dialogInstance.content=n.getConstant("ExtendValidation"),i.dialogInstance.dataBind(),ce(r.parent.element)},buttons:[{buttonModel:{content:n.getConstant("Yes"),isPrimary:!0,cssClass:"e-btn-goto-ok"},click:function(){i.hide(),e=!0}},{buttonModel:{content:n.getConstant("No"),isPrimary:!0,cssClass:"e-btn-goto-ok"},click:function(){i.hide(),t=e=!0}}],close:function(){e?(r.initiateDataValidationHandler(!0,t),e=!1):i.hide()}};i.show(o)},zp.prototype.userInput=function(){function e(e){for(;e.lastChild;)e.removeChild(e.lastChild)}var t,r,n=this.typeList,i=this.dataList,o=this.parent.element.querySelector(".e-datavalidation-dlg").querySelector(".e-validation-dlg"),a=o.querySelector(".e-allowdata"),s=o.querySelector(".e-values"),o=(o.querySelector(".e-ignoreblank"),this.parent.serviceLocator.getService(T)),a=a.querySelector(".e-data");e(s),n.value===o.getConstant("List")?(e(a),t=this.parent.createElement("input",{className:"e-checkbox"}),this.inputElements.push(t),a.appendChild(t),r=new w.CheckBox({label:o.getConstant("InCellDropDown"),checked:!0}),this.checkBoxElements.push(r),r.appendTo(t)):n.value===o.getConstant("Custom")?e(a):a.childElementCount&&!a.getElementsByClassName("e-checkbox-wrapper")[0]||(e(a),(r=this.parent.createElement("span",{className:"e-header"})).innerText=o.getConstant("Data"),t=this.parent.createElement("input",{className:"e-select"}),this.spanElements.push(r),this.inputElements.push(t),a.appendChild(r),a.appendChild(t),i.appendTo(t)),n.value===o.getConstant("List")||n.value===o.getConstant("Custom")||i.value!==o.getConstant("Between")&&i.value!==o.getConstant("NotBetween")?((r=this.parent.createElement("span",{className:"e-header"})).innerText=n.value===o.getConstant("List")?o.getConstant("Sources"):n.value===o.getConstant("Custom")?o.getConstant("Formula"):o.getConstant("Value"),a=n.value===o.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(r),this.inputElements.push(a),s.appendChild(r),s.appendChild(a)):(t=this.parent.createElement("div",{className:"e-minimum"}),i=this.parent.createElement("div",{className:"e-maximum"}),this.divElements.push(t),this.divElements.push(i),s.appendChild(t),s.appendChild(i),(n=this.parent.createElement("span",{className:"e-header"})).innerText=o.getConstant("Minimum"),(r=this.parent.createElement("span",{className:"e-header"})).innerText=o.getConstant("Maximum"),a=this.parent.createElement("input",{id:"min",className:"e-input",attrs:{value:"0"}}),s=this.parent.createElement("input",{id:"max",className:"e-input",attrs:{value:"0"}}),this.spanElements.push(n),this.spanElements.push(r),this.inputElements.push(a),this.inputElements.push(s),o=new S.NumericTextBox({value:0}),this.numericTextBoxElements.push(o),o.appendTo("min"),o=new S.NumericTextBox({value:0}),this.numericTextBoxElements.push(o),o.appendTo("max"),t.appendChild(n),t.appendChild(a),i.appendChild(r),i.appendChild(s))},zp.prototype.dlgClickHandler=function(e){var t,r,n,i,o,a,s,l=this,h=this.parent.serviceLocator.getService(T),d=this.parent.element.querySelector(".e-datavalidation-dlg"),p=d.querySelector(".e-footer-content"),d=d.getElementsByClassName("e-dlg-content")[0].getElementsByClassName("e-validation-dlg")[0],c=d.getElementsByClassName("e-allowdata")[0],u=c.getElementsByClassName("e-allow")[0].getElementsByTagName("input")[0],f=c.getElementsByClassName("e-data")[0].getElementsByTagName("input")[0],g=d.getElementsByClassName("e-values")[0],m=[],u=(m[0]=g.getElementsByTagName("input")[0].value,m[1]=g.getElementsByTagName("input")[1]?g.getElementsByTagName("input")[1].value:"",this.formattedType(u.value)),v=!0,y=d.querySelector(".e-ignoreblank .e-checkbox").checked,c=c.querySelector(".e-data").querySelector(".e-checkbox-wrapper")?!!c.querySelector(".e-data").querySelector(".e-checkbox-wrapper").querySelector(".e-check"):null,d=d.querySelector(".e-cellrange").getElementsByTagName("input")[0].value,f=(f&&(r=this.formattedValue(f.value)),[]);"List"===u?(""!==m[0]&&f.push(m[0]),m[0].startsWith("=")?!(a=m[0].substring(1)).includes(":")||(i=void 0,m[0].includes("!")?(s=a.substring(0,a.lastIndexOf("!")),a=a.substring(a.lastIndexOf("!")+1),s.startsWith("'")&&s.endsWith("'")&&(s=s.substring(1,s.length-1)),i=-1<B(this.parent,s),f[0]="="+s+"!"+a):i=!0,s=a.split(":"),o=a.match(/[a-z]/gi)&&s[0].replace(/[0-9]/g,"")===s[1].replace(/[0-9]/g,""),a=a.match(/\d/g)&&s[0].replace(/\D/g,"")===s[1].replace(/\D/g,""),v=i&&(o||a))||(t=h.getConstant("DialogError")):256<m[0].length&&(v=!1,t=h.getConstant("ListLengthError"))):(n=ee.getNumericObject(this.parent.locale),"Decimal"===u&&"."!==n.decimal&&((s=function(e){return oe(e)&&e.includes(".")&&("."!==n.group||!Rn(e,l.parent.locale,n.group,n.decimal))})(m[0])||s(m[1]))&&(v=!1,t=h.getConstant("InvalidNumberError")),Kn(m,this.parent,n),""!==m[0]&&f.push(m[0]),""!==m[1]&&f.push(m[1])),v&&(i=this.parent.getActiveSheet(),o=this.isDialogValidator(f,u,r),"Between"===r&&o.isValidate&&!isNaN(parseFloat(f[0]))&&!isNaN(parseFloat(f[1]))&&parseFloat(f[0])>parseFloat(f[1])&&(o.isValidate=!1,o.errorMsg=h.getConstant("MinMaxError")),"Custom"===u&&Q(f[0])&&(this.parent.notify(Cn,a={value:f[0]}),-1<["#N/A","#VALUE!","#REF!","#DIV/0!","#NUM!","#NAME?","#NULL!","#CALC!"].indexOf(a.value))&&(o.isValidate=!1,o.errorMsg=h.getConstant("InvalidFormula")),t=o.errorMsg,v=o.isValidate)&&(s={range:i.name+"!"+d,value1:f[0],value2:f[1]||"",ignoreBlank:y,type:u,operator:r,inCellDropDown:c,cancel:!1},this.parent.notify(gt,{eventArgs:s,action:"validation"}),s.cancel||(this.parent.notify(pr,{rules:{type:s.type,operator:s.operator,value1:s.value1,value2:s.value2,ignoreBlank:s.ignoreBlank,inCellDropDown:s.inCellDropDown},range:s.range}),delete s.cancel,this.parent.element.getElementsByClassName("e-validation-error-dlg")[0]||(e.dialogInstance||e).hide(),this.parent.notify(le,{eventArgs:s,action:"validation"}))),v||((m=this.parent.createElement("div",{className:"e-dlg-error",id:"e-invalid"})).innerText=t,g.appendChild(m),p.querySelector(".e-primary").setAttribute("disabled","true"))},zp.prototype.formattedValue=function(e){var t=this.parent.serviceLocator.getService(T);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},zp.prototype.formattedType=function(e){var t=this.parent.serviceLocator.getService(T);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},zp.prototype.isDialogValidator=function(e,t,r){var n=this.parent.serviceLocator.getService(T),i=0;if("List"!==t&&("Between"===r||"NotBetween"===r)?2!==e.length:!(0<e.length))return{isValidate:!1,errorMsg:n.getConstant("EmptyError")};for(var o=void 0,a=0;a<e.length;a++){var s,l,o=Q(e[a])?(s={value:e[a]},this.parent.notify(Cn,s),s.value):"Date"===t||"Time"===t?e[a]=this.getDateAsNumber({range:[],cell:{value:e[a]}},e[a]):e[a];if(!(l=this.formatValidation(o,t,!0)).isValidate)break;i+=1}return l.isValidate=i===e.length,l},zp.prototype.getDateAsNumber=function(e,t){e={value:t,rowIndex:e.range[0],cell:e.cell,colIndex:e.range[1],sheetIndex:e.sheetIdx,updatedVal:""};return this.parent.notify(At,e),e.updatedVal||t},zp.prototype.getListOfValues=function(e){e=","!==this.parent.listSeparator&&e.includes(this.parent.listSeparator)?e.split(this.parent.listSeparator):e.split(",");return e},zp.prototype.isValidationHandler=function(e){var t,r=this.parent.serviceLocator.getService(T),n=(e.value=ee.isNullOrUndefined(e.value)?"":e.value,e.value.toString()),i=this.parent.sheets[e.sheetIdx],o=se(e.range[0],e.range[1],i,null,!0),a=de(i,e.range[1]);if(o.validation?t=o.validation:Hh(a,e.range[0],e.range[1])&&(t=a.validation),t){var s=t.value1,l=t.value2,h=(o.validation||(s=Vn(p=e.range,d=[0,e.range[1],0,e.range[3]],i,this.parent,{formula:s}),ee.isNullOrUndefined(l))||""===l||(l=Vn(p,d,i,this.parent,{formula:l})),"List"!==t.type&&(Q(s)&&(this.parent.notify(Cn,p={value:s}),s=p.value),Q(l)&&(this.parent.notify(Cn,d={value:l}),l=d.value),Q(e.value))&&(p={value:e.value},this.parent.notify(Cn,p),e.value=p.value),e.value),d=t.operator||"Between",p=t.type||"WholeNumber",c=!!ee.isNullOrUndefined(t.ignoreBlank)||t.ignoreBlank;if(c&&""===n)f=!0;else{var u,f,g="Date"===p||"Time"===p,m=(e.value&&(g||"TextLength"===t.type?oe(e.value)||(h=e.value=this.getDateAsNumber(e,e.value)):(C=e.isEdit&&ee.getNumericObject(this.parent.locale),(u=this.parseValidationValue(e.value,C))!==e.value&&oe(u)&&(h=e.value=u.toString()))),this.formatValidation(e.value,p));if(f=m.isValidate,m=m.errorMsg,f)if(f=!1,g?(s&&!oe(s)&&(s=this.getDateAsNumber(e,s)),l&&!oe(l)&&(l=this.getDateAsNumber(e,l))):"TextLength"===t.type&&(h=e.value.toString().length.toString()),"List"===p){var v=e.value.toString(),y=oe(v),C=y&&ee.getNumericObject(this.parent.locale);if(s.startsWith("=")){for(var b,x=this.getListDataSource(t),S=0;S<x.length;S++)if(n===(b=x[S].text.toString())||v===b||y&&v===this.parseValidationValue(b,C).toString()){f=!0;break}}else for(var w=this.getListOfValues(s),S=0;S<w.length;S++)if(n===w[S]||v===w[S]||y&&v===this.parseValidationValue(w[S],C).toString()){f=!0;break}!f&&c&&""===v&&(f=!0)}else if("Custom"===p)!(f=oe(u=parseFloat(s.toString()))?0!==u||(g={value:t.value1},this.parent.notify(yn,g),""===g.value):"TRUE"===s.toUpperCase())&&c&&""===s&&(f=!0);else switch(l="Decimal"===p||"Time"===p?(h=parseFloat(h.toString()),s=parseFloat(s.toString()),l?parseFloat(l.toString()):null):(h=parseInt(h.toString(),10),s=parseInt(s.toString(),10),l?parseInt(l.toString(),10):null),d){case"EqualTo":f=h===s||!(!c||""!==n);break;case"NotEqualTo":f=h!==s||!(!c||""!==n);break;case"Between":f=s<=h&&h<=l||!(!c||""!==n);break;case"NotBetween":f=!(s<=h&&h<=l);break;case"GreaterThan":f=s<h||!(!c||""!==n);break;case"LessThan":f=h<s||!(!c||""!==n);break;case"GreaterThanOrEqualTo":f=s<=h||!(!c||""!==n);break;case"LessThanOrEqualTo":f=h<=s||!(!c||""!==n)}}}return m=r.getConstant("ValidationError"),f&&(o&&o.validation&&o.validation.isHighlighted||a&&a.validation&&a.validation.isHighlighted)&&(u=this.parent.getCellStyleValue(["backgroundColor","color"],[e.range[0],e.range[1]]),he(i,e.range[0])||this.parent.notify(Ft,{style:u,rowIdx:e.range[0],colIdx:e.range[1],isHeightCheckNeeded:!0,manualUpdate:!0,onActionUpdate:!0,td:e.td})),{isValidate:f,errorMsg:m}},zp.prototype.parseValidationValue=function(e,t){return oe(e)?t&&"."===t.group&&(e=e.toString()).indexOf(".")&&Rn(e,this.parent.locale,t.group,t.decimal)?e.split(t.group).join(""):e:(this.parent.notify(St,e={formattedText:e,value:e,format:"General",cell:{value:e,format:"General"},isEdit:!!t}),e.value)},zp.prototype.checkDataValidation=function(e){var t,r=se(e.range[0],e.range[1],this.parent.getActiveSheet()),n=(e.td=e.td||this.parent.getCell(e.range[0],e.range[1]),e.sheetIdx=e.sheetIdx||this.parent.activeSheetIndex,{skip:!1,value:""});r&&r.validation&&(Q(r.validation.value1)&&!Fn(r.validation.value1.substring(1,r.validation.value1.length))&&-1<r.validation.value1.indexOf("(")&&(t=(t=r.validation.value1).substring(t.indexOf("=")+1,t.indexOf("(")),n.value=t.toUpperCase(),this.parent.notify(Gt,n)),!n.skip)&&Q(r.validation.value2)&&!Fn(r.validation.value2.substring(1,r.validation.value2.length))&&-1<r.validation.value1.indexOf("(")&&(t=(t=r.validation.value2).substring(t.indexOf("=")+1,t.indexOf("(")),n.value=t.toUpperCase(),this.parent.notify(Gt,n)),n.skip||(!(r=this.isValidationHandler(e)).isValidate&&e.isEdit&&this.validationErrorHandler(r.errorMsg),e.isValid=r.isValidate)},zp.prototype.formatValidation=function(e,t,r){var n,i,o=this.parent.element.getElementsByClassName("e-sheet-panel")[0],a=this.parent.createElement("form",{id:"formId",className:"form-horizontal"}),s=this.parent.createElement("input",{id:"e-validation"});switch(s.setAttribute("name","validation"),s.setAttribute("type","text"),"Date"===t&&oe(e)&&2===(l=e.toString().split(".")).length&&(e=l[0]),s.setAttribute("value",e),a.appendChild(s),o.appendChild(a),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 S.FormValidator("#formId",i);var l=this.formObj.validate();return o.removeChild(o.getElementsByClassName("form-horizontal")[0]),{isValidate:l,errorMsg:n}},zp.prototype.invalidElementHandler=function(e){var t=e.rowIdx,r=e.colIdx,n=e.isRemoveHighlightedData;n?(n=this.parent.getCellStyleValue(["backgroundColor","color"],[t,r]),this.parent.notify(Ft,{style:n,rowIdx:t,colIdx:r,td:e.td})):this.parent.notify(Ft,{style:{backgroundColor:"#ffff00",color:"#ff0000"},rowIdx:t,colIdx:r,td:e.td})},zp.prototype.validationErrorHandler=function(r){var n,i=this,o=this.parent.element.getElementsByClassName("e-spreadsheet-edit")[0],e=this.parent.serviceLocator.getService(T);this.parent.element.querySelector(".e-validation-error-dlg")||(n=this.parent.serviceLocator.getService(O),e={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(e){var t={dialogName:"ValidationErrorDialog",element:e.element,target:e.target,cancel:e.cancel,content:r};i.parent.trigger("dialogBeforeOpen",t),t.cancel&&(i.errorDlgHandler(n,"Cancel"),e.cancel=!0),o.focus(),n.dialogInstance.content=t.content,n.dialogInstance.dataBind()},buttons:[{buttonModel:{content:e.getConstant("Retry"),isPrimary:!0},click:function(){i.errorDlgHandler(n,"Retry")}},{buttonModel:{content:e.getConstant("Cancel")},click:function(){i.errorDlgHandler(n,"Cancel")}}]},n.show(e,!1))},zp.prototype.errorDlgHandler=function(e,t){"Retry"===t?(t=this.parent.element.getElementsByClassName("e-spreadsheet-edit")[0],e.hide(),t.innerText&&(window.getSelection().selectAllChildren(t),this.listObj)&&!this.listObj.isDestroyed&&this.listObj.showPopup()):(t=(t=se((t=W(this.parent.getActiveSheet().activeCell))[0],t[1],this.parent.getActiveSheet()))?this.parent.getDisplayText(t):"",this.parent.notify(io,{action:"cancelEdit",value:t,refreshFormulaBar:!0,refreshEditorElem:!0,isAppend:!1,trigEvent:!0}),e.hide())},zp.prototype.getModuleName=function(){return"dataValidation"};var jp=zp;function zp(e){this.divElements=[],this.spanElements=[],this.inputElements=[],this.checkBoxElements=[],this.numericTextBoxElements=[],this.dropDownListElements=[],this.parent=e,this.addEventListener()}qp.prototype.init=function(){this.addEventListener()},qp.prototype.destroy=function(){this.removeEventListener(),this.parent=null},qp.prototype.addEventListener=function(){this.parent.on(Ma,this.protect,this),this.parent.on(Pa,this.protectSheetHandler,this),this.parent.on(_a,this.editProtectedAlert,this),this.parent.on(As,this.protectWorkbook,this),this.parent.on(lo,this.KeyUpHandler,this),this.parent.on(Ts,this.unProtectWorkbook,this),this.parent.on(Gs,this.unProtectSheetPassword,this),this.parent.on(Ds,this.getPassWord,this),this.parent.on(Ms,this.importProtectWorkbook,this),this.parent.on(Ls,this.protectWorkbookHandler,this),this.parent.on(Ps,this.removeWorkbookProtection,this),this.parent.on(Qs,this.toggleProtect,this)},qp.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(Ma,this.protect),this.parent.off(Pa,this.protectSheetHandler),this.parent.off(_a,this.editProtectedAlert),this.parent.off(As,this.protectWorkbook),this.parent.off(lo,this.KeyUpHandler),this.parent.off(Ts,this.unProtectWorkbook),this.parent.off(Gs,this.unProtectSheetPassword),this.parent.off(Ds,this.getPassWord),this.parent.off(Ms,this.importProtectWorkbook),this.parent.off(Ls,this.protectWorkbookHandler),this.parent.off(Ps,this.removeWorkbookProtection),this.parent.off(Qs,this.toggleProtect))},qp.prototype.protect=function(e){var t;e.isActive&&(t=this.parent.getActiveSheet()).isImportProtected&&(t.isImportProtected=!1),this.parent.notify(Ao,null),e.isActive?(this.parent.setSheetPropertyOnMute(ae(this.parent,e.sheetIndex),"isProtected",!1),this.parent.notify(ta,{props:"Protect"}),this.parent.notify(Pa,e),this.parent.notify(Ya,null)):this.createDialogue()},qp.prototype.createDialogue=function(){var r=this,e=this.parent.serviceLocator.getService(T),t=[{text:e.getConstant("SelectCells"),id:"1"},{text:e.getConstant("SelectUnlockedCells"),id:"6"},{text:e.getConstant("FormatCells"),id:"2"},{text:e.getConstant("FormatRows"),id:"3"},{text:e.getConstant("FormatColumns"),id:"4"},{text:e.getConstant("InsertLinks"),id:"5"}],t=(this.optionList=new f.ListView({width:"250px",dataSource:t,showCheckBox:!0,select:this.dialogOpen.bind(this)}),this.parent.createElement("div",{className:"e-sheet-password-dialog"})),n=this.parent.createElement("div",{className:"e-sheet-password-content"}),i=this.parent.createElement("div",{className:"e-header"}),o=(i.innerText=e.getConstant("SheetPassword"),this.parent.createElement("input",{className:"e-input e-text",attrs:{type:"password"}})),i=(o.setAttribute("placeholder",e.getConstant("EnterThePassword")),n.appendChild(o),n.insertBefore(i,o),t.appendChild(n),this.parent.createElement("div",{className:"e-protect-content"})),a=(i.innerText=e.getConstant("ProtectAllowUser"),this.parent.setSheetPropertyOnMute(this.parent.getActiveSheet(),"isProtected",!1),new w.CheckBox({checked:!0,label:e.getConstant("ProtectContent"),cssClass:"e-protect-checkbox"})),o=this.parent.createElement("div",{className:"e-protect-option-list",id:this.parent.element.id+"_option_list"}),n=this.parent.createElement("div",{className:"e-header-content"}),s=(n.innerText=e.getConstant("ProtectSheet"),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:n.outerHTML,content:t.outerHTML+s.outerHTML+i.outerHTML+o.outerHTML,showCloseIcon:!0,isModal:!0,cssClass:"e-protect-dlg",beforeOpen:function(e){var t={dialogName:"ProtectSheetDialog",element:e.element,target:e.target,cancel:e.cancel};r.parent.trigger("dialogBeforeOpen",t),t.cancel&&(e.cancel=!0),ce(r.parent.element)},beforeClose:function(){ee.EventHandler.remove(a.element,"click",r.checkBoxClickHandler)},buttons:[{click:this.selectOption.bind(this,this.dialog,this),buttonModel:{content:e.getConstant("Ok"),isPrimary:!0}},{click:function(){return r.dialog.hide()},buttonModel:{content:e.getConstant("Cancel")}}]},!1),this.protectSheetDialog=this.dialog.dialogInstance,a.appendTo("#"+this.parent.element.id+"_protect_check"),this.optionList.appendTo("#"+this.parent.element.id+"_option_list"),this.optionList.selectMultipleItems([{id:"1"},{id:"6"}]),ee.EventHandler.add(a.element,"click",this.checkBoxClickHandler,this)},qp.prototype.checkBoxClickHandler=function(){var e=ee.getInstance(document.getElementById(this.parent.element.id+"_protect_check"),w.CheckBox);this.dialog.dialogInstance.element.getElementsByClassName("e-footer-content")[0].querySelector("button").disabled=!e.checked},qp.prototype.dialogOpen=function(e){var t=this.parent.serviceLocator.getService(T);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"})},qp.prototype.selectOption=function(){var e=this.parent.getActiveSheet(),t=this.parent.element.querySelector(".e-sheet-password-dialog").getElementsByClassName("e-sheet-password-content")[0].querySelector(".e-input");0===t.value.length?(this.parent.setSheetPropertyOnMute(e,"isProtected",!0),this.parent.setSheetPropertyOnMute(e,"password",t.value),this.updateProtectSheet(t.value),this.dialog.hide(),(!e.protectSettings.selectCells&&!e.protectSettings.selectUnLockedCells||e.protectSettings.selectUnLockedCells&&jd(this.parent,te(e.selectedRange)))&&this.parent.notify(Ws,null)):this.reEnterSheetPassword()},qp.prototype.selectSheetPassword=function(){var e,t=this.parent.serviceLocator.getService(T),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"),o=this.parent.createElement("span",{className:"e-reenterpwd-alert-span"});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),e=document.querySelector(".e-protect-dlg.e-dialog"),ee.getComponent(e,"dialog").destroy(),r.protectSettings.selectCells||r.protectSettings.selectUnLockedCells||this.parent.notify(Ws,null)):(""===n.value?o.textContent=t.getConstant("PasswordAlertMsg"):""===i.value?o.textContent=t.getConstant("ConfirmPasswordAlertMsg"):n.value!==i.value&&(o.textContent=t.getConstant("PasswordAlert")),this.parent.element.querySelector(".e-reenterpwd-dlg").querySelector(".e-reenterpwd-dialog").appendChild(o))},qp.prototype.updateProtectSheet=function(e){var t=this.parent.serviceLocator.getService(T),r=this.optionList.getSelectedItems(),r={selectCells:-1<r.text.indexOf(t.getConstant("SelectCells")),formatCells:-1<r.text.indexOf(t.getConstant("FormatCells")),formatRows:-1<r.text.indexOf(t.getConstant("FormatRows")),formatColumns:-1<r.text.indexOf(t.getConstant("FormatColumns")),insertLink:-1<r.text.indexOf(t.getConstant("InsertLinks")),selectUnLockedCells:-1<r.text.indexOf(t.getConstant("SelectUnlockedCells"))};this.parent.notify(Ir,{protectSettings:r,password:e,triggerEvent:!0}),this.parent.notify(Ya,null),this.parent.notify(ba,null)},qp.prototype.protectSheetHandler=function(e){var t=ee.isNullOrUndefined(e&&e.sheetIndex)?this.parent.activeSheetIndex:e.sheetIndex,r=ae(this.parent,t),n=this.parent.element.id,i=[n+"_undo",n+"_redo",n+"_cut",n+"_copy",n+"_paste",n+"_number_format",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",n+"_wrap",n+"_sorting",n+"_clear",n+"_conditionalformatting"],o=[n+"_cut",n+"_copy",n+"_number_format",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+"_text_align",n+"_vertical_align",n+"_wrap",n+"_sorting",n+"_clear",n+"_conditionalformatting"],a=[n+"_insert_function"],s=[n+"_hyperlink",n+"_",n+"_chart"],l=[n+"_image"],h=[n+"_find"],d=[n+"_datavalidation"],n=[n+"_chart"],p=document.getElementById(this.parent.element.id+"_sheet_panel");p&&(r.isProtected&&(r.protectSettings.selectCells||r.protectSettings.selectUnLockedCells&&!jd(this.parent,te(r.selectedRange)))?p.classList.remove("e-protected"):p.classList.add("e-protected"),r.isProtected||p.classList.remove("e-protected")),this.parent.dataBind(),this.parent.notify(Ba,{disableHomeBtnId:i,enableHomeBtnId:o,enableFrmlaBtnId:a,enableInsertBtnId:s,findBtnId:h,dataValidationBtnId:d,imageBtnId:l,chartBtnId:n}),this.parent.notify(Ga,null),r.isProtected&&this.parent.notify(ta,{props:"Protect"}),e&&e.triggerEvent&&this.parent.notify(le,{action:"protectSheet",eventArgs:{sheetIndex:t,isProtected:r.isProtected,password:r.password,protectSettings:r.protectSettings.properties||r.protectSettings}})},qp.prototype.editProtectedAlert=function(){var r=this,n=this.parent.serviceLocator.getService(T);this.dialog=this.parent.serviceLocator.getService("dialog"),this.dialog.show({content:n.getConstant("EditAlert"),isModal:!0,closeOnEscape:!0,showCloseIcon:!0,width:"400px",cssClass:"e-editAlert-dlg",beforeOpen:function(e){var t={dialogName:"EditAlertDialog",content:n.getConstant("EditAlert"),element:e.element,target:e.target,cancel:e.cancel};r.parent.trigger("dialogBeforeOpen",t),t.cancel&&(e.cancel=!0,Xh(function(){r.dialog.destroyDialog()})),r.dialog.dialogInstance.content=t.content,ce(r.parent.element)},close:function(){return ce(r.parent.element)}})},qp.prototype.protectWorkbook=function(){var r=this,e=this.parent.serviceLocator.getService(T),n=this.parent.serviceLocator.getService(O);n.show({width:323,isModal:!0,showCloseIcon:!0,cssClass:"e-protectworkbook-dlg",header:e.getConstant("ProtectWorkbook"),beforeOpen:function(e){var t={dialogName:"ProtectWorkbook",element:e.element,target:e.target,cancel:e.cancel};r.parent.trigger("dialogBeforeOpen",t),t.cancel&&(e.cancel=!0),n.dialogInstance.content=r.passwordProtectContent(),n.dialogInstance.dataBind(),r.parent.element.focus()},buttons:[{buttonModel:{content:e.getConstant("Ok"),isPrimary:!0},click:function(){r.alertMessage(),r.dlgClickHandler(n)}}]})},qp.prototype.passwordProtectContent=function(){var e=this.parent.serviceLocator.getService(T),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"}),o=(i.innerText=e.getConstant("Password"),this.parent.createElement("div",{className:"e-header"})),a=(o.innerText=e.getConstant("ConfirmPassword"),this.parent.createElement("input",{className:"e-input e-text",attrs:{type:"password"}})),s=this.parent.createElement("input",{className:"e-input e-text",attrs:{type:"password"}});return a.setAttribute("placeholder",e.getConstant("EnterThePassword")),s.setAttribute("placeholder",e.getConstant("EnterTheConfirmPassword")),r.appendChild(a),r.insertBefore(i,a),n.appendChild(s),n.insertBefore(o,s),t.appendChild(n),t.insertBefore(r,n),t},qp.prototype.KeyUpHandler=function(e){var t,r,e=e.target;e.classList.contains("e-text")&&ee.closest(e,".e-password-content")&&ee.closest(e,".e-password-dialog")&&ee.closest(e,".e-password-dialog").getElementsByClassName("e-password-content")[1]===e.parentElement&&(t=ee.closest(e,".e-protectworkbook-dlg").getElementsByClassName("e-footer-content")[0].firstChild,""!==e.value?t.removeAttribute("disabled"):t.setAttribute("disabled","true")),e.classList.contains("e-text")&&ee.closest(e,".e-unprotectpwd-content")&&ee.closest(e,".e-unprotectpwd-dialog")&&ee.closest(e,".e-unprotectpwd-dialog").getElementsByClassName("e-unprotectpwd-content")[0]===e.parentElement&&(t=ee.closest(e,".e-unprotectworkbook-dlg").getElementsByClassName("e-footer-content")[0].firstChild,""!==e.value?t.removeAttribute("disabled"):t.setAttribute("disabled","true")),e.classList.contains("e-text")&&ee.closest(e,".e-reenterpwd-content")&&ee.closest(e,".e-reenterpwd-dialog")&&ee.closest(e,".e-reenterpwd-dialog").getElementsByClassName("e-reenterpwd-content")[0]===e.parentElement&&(t=ee.closest(e,".e-reenterpwd-dlg").getElementsByClassName("e-footer-content")[0].firstChild,""!==e.value?t.removeAttribute("disabled"):t.setAttribute("disabled","true")),e.classList.contains("e-text")&&ee.closest(e,".e-unprotectsheetpwd-content")&&ee.closest(e,".e-unprotectsheetpwd-dialog")&&ee.closest(e,".e-unprotectsheetpwd-dialog").getElementsByClassName("e-unprotectsheetpwd-content")[0]===e.parentElement&&(r=ee.closest(e,".e-unprotectworksheet-dlg").getElementsByClassName("e-footer-content")[0].firstChild,""!==e.value?r.removeAttribute("disabled"):r.setAttribute("disabled","true")),e.classList.contains("e-text")&&ee.closest(e,".e-importprotectpwd-content")&&ee.closest(e,".e-importprotectpwd-dialog")&&ee.closest(e,".e-importprotectpwd-dialog").getElementsByClassName("e-importprotectpwd-content")[0]===e.parentElement&&(r=ee.closest(e,".e-importprotectworkbook-dlg").getElementsByClassName("e-footer-content")[0].firstChild,""!==e.value?r.removeAttribute("disabled"):r.setAttribute("disabled","true"))},qp.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()},qp.prototype.dlgClickHandler=function(e){var t=this.parent.serviceLocator.getService(T),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(le,{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)},qp.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"})},qp.prototype.unProtectWorkbook=function(){var r=this,e=this.parent.serviceLocator.getService(T),n=this.parent.serviceLocator.getService(O);n.show({width:323,isModal:!0,showCloseIcon:!0,cssClass:"e-unprotectworkbook-dlg",header:e.getConstant("UnprotectWorkbook"),beforeOpen:function(e){var t={dialogName:"UnprotectWorkbook",element:e.element,target:e.target,cancel:e.cancel};r.parent.trigger("dialogBeforeOpen",t),t.cancel&&(e.cancel=!0),n.dialogInstance.content=r.unProtectPasswordContent(),n.dialogInstance.dataBind(),r.parent.element.focus()},buttons:[{buttonModel:{content:e.getConstant("Ok"),isPrimary:!0,disabled:!0},click:function(){r.alertMessage(),r.unprotectdlgOkClick(n)}}]})},qp.prototype.unProtectsheet=function(e){var r=this,t=this.parent.serviceLocator.getService(T),n=this.parent.serviceLocator.getService(O);n.show({width:323,isModal:!0,showCloseIcon:!0,cssClass:"e-unprotectworksheet-dlg",header:t.getConstant("UnprotectWorksheet"),beforeOpen:function(e){var t={dialogName:"UnProtectSheet",element:e.element,target:e.target,cancel:e.cancel};r.parent.trigger("dialogBeforeOpen",t),t.cancel&&(e.cancel=!0),n.dialogInstance.content=r.unProtectSheetPasswordContent(),n.dialogInstance.dataBind(),r.parent.element.focus()},buttons:[{buttonModel:{content:t.getConstant("Ok"),isPrimary:!0,disabled:!this.parent.allowOpen||!this.parent.openModule.isImportedFile||-1!==this.parent.openModule.unProtectSheetIdx.indexOf(this.parent.activeSheetIndex)},click:function(){r.alertMessage(),r.unprotectSheetdlgOkClick(n,e)}}]})},qp.prototype.reEnterSheetPassword=function(){var r=this,e=this.parent.serviceLocator.getService(T),n=this.parent.serviceLocator.getService(O);n.show({width:323,isModal:!0,showCloseIcon:!0,cssClass:"e-reenterpwd-dlg",header:e.getConstant("ConfirmPassword"),beforeOpen:function(e){var t={dialogName:"Re-enterPassword",element:e.element,target:e.target,cancel:e.cancel};r.parent.trigger("dialogBeforeOpen",t),t.cancel&&(e.cancel=!0),n.dialogInstance.content=r.reEnterSheetPasswordContent(),n.dialogInstance.dataBind(),ce(r.parent.element.querySelector(".e-protect-dlg.e-dialog .e-footer-content .e-btn")||r.parent.element)},close:function(){r.dialog.dialogInstance=r.protectSheetDialog},buttons:[{buttonModel:{content:e.getConstant("Ok"),isPrimary:!0,disabled:!0},click:function(){r.alertMessage(),r.selectSheetPassword()}}]})},qp.prototype.unProtectPasswordContent=function(){var e=this.parent.serviceLocator.getService(T),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"}),e=(n.innerText=e.getConstant("EnterThePassword"),this.parent.createElement("input",{className:"e-input e-text",attrs:{type:"password"}}));return r.appendChild(e),r.insertBefore(n,e),t.appendChild(r),t},qp.prototype.reEnterSheetPasswordContent=function(){var e=this.parent.serviceLocator.getService(T),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"}),e=(n.innerText=e.getConstant("ReEnterPassword"),this.parent.createElement("input",{className:"e-input e-text",attrs:{type:"password"}}));return r.appendChild(e),r.insertBefore(n,e),t.appendChild(r),t},qp.prototype.unProtectSheetPasswordContent=function(){var e=this.parent.serviceLocator.getService(T),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"}),e=(n.innerText=e.getConstant("EnterThePassword"),this.parent.createElement("input",{className:"e-input e-text",attrs:{type:"password"}}));return r.appendChild(e),r.insertBefore(n,e),t.appendChild(r),t},qp.prototype.unprotectdlgOkClick=function(e){var t=this.parent.serviceLocator.getService(T),r=this.parent.element.querySelector(".e-unprotectpwd-dialog").getElementsByClassName("e-unprotectpwd-content")[0].querySelector(".e-input");this.parent.password===r.value?(e.hide(),this.removeWorkbookProtection(),this.parent.notify(le,{action:"protectWorkbook",eventArgs:{isProtected:!1}})):((r=this.parent.createElement("span",{className:"e-unprotectpwd-alert-span"})).innerText=t.getConstant("UnprotectPasswordAlert"),this.parent.element.querySelector(".e-unprotectworkbook-dlg").querySelector(".e-dlg-content").appendChild(r))},qp.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"})},qp.prototype.unprotectSheetdlgOkClick=function(e,t){var r=this.parent.serviceLocator.getService(T),n=this.parent.getActiveSheet(),i=this.parent.element.querySelector(".e-unprotectsheetpwd-dialog").getElementsByClassName("e-unprotectsheetpwd-content")[0].querySelector(".e-input");t&&0===n.password.length?(t={sheetPassword:i.value,sheetIndex:this.parent.activeSheetIndex},this.parent.open(t)):n.password===i.value?(e.hide(),this.unProtectSheetPassword()):((t=this.parent.createElement("span",{className:"e-unprotectsheetpwd-alert-span"})).innerText=r.getConstant("UnprotectPasswordAlert"),this.parent.element.querySelector(".e-unprotectworksheet-dlg").querySelector(".e-dlg-content").appendChild(t))},qp.prototype.unProtectSheetPassword=function(){var e=this.parent.getActiveSheet(),t=this.parent.activeSheetIndex,e=(this.parent.setSheetPropertyOnMute(e,"isProtected",!e.isProtected),this.parent.setSheetPropertyOnMute(e,"password",""),!e.isProtected);this.parent.notify(Ma,{isActive:e,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)},qp.prototype.getPassWord=function(e){e.passWord=this.password},qp.prototype.importProtectWorkbook=function(r){var n=this,e=this.parent.serviceLocator.getService(T),i=this.parent.serviceLocator.getService(O);i.show({width:323,isModal:!0,showCloseIcon:!0,cssClass:"e-importprotectworkbook-dlg",header:e.getConstant("UnprotectWorkbook"),beforeOpen:function(e){var t={dialogName:"ImportProtectWorkbook",element:e.element,target:e.target,cancel:e.cancel};n.parent.trigger("dialogBeforeOpen",t),t.cancel&&(e.cancel=!0),i.dialogInstance.content=n.importProtectPasswordContent(r),i.dialogInstance.dataBind(),n.parent.element.focus()},buttons:[{buttonModel:{content:e.getConstant("Ok"),isPrimary:!0,disabled:!0},click:function(){n.alertMessage(),n.importOkClick(r)}}]})},qp.prototype.importProtectPasswordContent=function(e){var t=this.parent.serviceLocator.getService(T),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"}),e=(i.innerText='"'+e.file.name+'" '+t.getConstant("IsProtected"),this.parent.createElement("input",{className:"e-input e-text",attrs:{type:"password"}}));return e.setAttribute("placeholder",t.getConstant("EnterThePassword")),n.appendChild(i),n.appendChild(e),r.appendChild(n),r},qp.prototype.importOkClick=function(e){var t=this.parent.element.querySelector(".e-importprotectpwd-dialog").getElementsByClassName("e-importprotectpwd-content")[0].querySelector(".e-input"),e=(this.parent.password=t.value,{file:e.file,password:t.value});this.parent.open(e)},qp.prototype.toggleProtect=function(){var e=this.parent.element.id,t=this.parent.getActiveSheet();t.isProtected&&this.parent.allowOpen&&t.isImportProtected&&this.parent.openModule.isImportedFile&&-1===this.parent.openModule.unProtectSheetIdx.indexOf(this.parent.activeSheetIndex)?this.unProtectsheet(!0):t.password&&0<t.password.length?this.unProtectsheet():(this.parent.setSheetPropertyOnMute(t,"isProtected",!t.isProtected),t=!t.isProtected,this.parent.notify(Ma,{isActive:t,id:e+"_protect",sheetIndex:this.parent.activeSheetIndex,triggerEvent:!0}))},qp.prototype.getModuleName=function(){return"protectSheet"};var _p=qp;function qp(e){this.password="",this.parent=e,this.init()}Gp.prototype.addEventListener=function(){this.parent.on(Ha,this.renderFindDlg,this),this.parent.on(Ua,this.renderGotoDlg,this),this.parent.on(fr,this.gotoHandler,this),this.parent.on(Va,this.findHandler,this),this.parent.on(vr,this.showFindAlert,this),this.parent.on(Er,this.replaceAllDialog,this),this.parent.on(yr,this.findKeyUp,this),this.parent.on(vt,this.findToolDlg,this),this.parent.on($o,this.refreshFindDlg,this)},Gp.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(Ha,this.renderFindDlg),this.parent.off(Ua,this.renderGotoDlg),this.parent.off(fr,this.gotoHandler),this.parent.off(Va,this.findHandler),this.parent.off(vr,this.showFindAlert),this.parent.off(Er,this.replaceAllDialog),this.parent.off(yr,this.findKeyUp),this.parent.off(vt,this.findToolDlg),this.parent.off($o,this.refreshFindDlg))},Gp.prototype.findToolDlg=function(r){function t(e){var t=c.parent.showRibbon&&c.parent.element.querySelector(".e-ribbon");t&&(t=r.event&&r.event.target?ee.closest(r.event.target,"#"+c.parent.element.id+"_findbtn"):ee.select("#"+c.parent.element.id+"_findbtn",t))&&(e?t.classList.add("e-disabled"):t.classList.remove("e-disabled"),t.disabled=e)}function n(e){var t;o&&(!f.isProtected||f.protectSettings.selectCells||f.protectSettings.selectUnLockedCells)&&(t=o.value,e&&13===e.keyCode?o.value&&"0 of 0"!==i.textContent&&(c.parent.notify(Va,{findOption:e.shiftKey?"prev":"next"}),c.updateCount(i,e.shiftKey)):(e=void 0,e=""===t?!(i.textContent="0 of 0"):(t={value:t,mode:"Sheet",isCSen:!1,sheetIndex:c.parent.activeSheetIndex,isEMatch:!1,searchBy:"By Row"},c.parent.notify(xr,t),i.textContent=t.findCount,"0 of 0"!==t.findCount),l.enableItems(1,e),l.enableItems(2,e)))}var i,o,a,s,l,e,h,d,p,c=this,u=r.dialogEle||this.parent.element.getElementsByClassName("e-findtool-dlg")[0],f=(r.isPublic&&(this.findValue=r.findValue),this.parent.getActiveSheet());u?r.isPublic||r.refreshPosition?(r.isPublic&&((o=u.querySelector(".e-text-findNext-short")).value=this.findValue,i=u.querySelector(".e-input-group-icon"),l=ee.getComponent(u.querySelector(".e-find-toolbar"),"toolbar"),n()),r.refreshPosition&&(d=void 0,d=this.parent.getActiveSheet().showHeaders?((e=this.parent.getColumnHeaderContent().parentElement)&&e.offsetHeight||30)+1:1,u.style.top=d+"px")):(t(!0),this.findDialog.hide()):(e=this.parent.createElement("div",{className:"e-input-group"}),o=this.parent.createElement("input",{className:"e-input e-text-findNext-short",attrs:{type:"Text"}}),this.findValue&&(o.value=this.findValue),d=this.parent.serviceLocator.getService(T),o.setAttribute("placeholder",d.getConstant("FindValue")),i=this.parent.createElement("span",{className:"e-input-group-icon"}),s=100<f.usedRange.rowIndex*f.usedRange.colIndex,o.onkeyup=function(e){s?(a&&clearTimeout(a),a=setTimeout(n.bind(c,e),500)):n(e)},e.appendChild(o),e.appendChild(i),e=[{type:"Input",template:e},{prefixIcon:"e-icons e-prev-icon",tooltipText:d.getConstant("FindPreviousBtn"),type:"Button",cssClass:"e-findRib-prev",disabled:!0},{prefixIcon:"e-icons e-next-icon",tooltipText:d.getConstant("FindNextBtn"),type:"Button",cssClass:"e-findRib-next",disabled:!0},{type:"Separator"},{prefixIcon:"e-icons e-option-icon",tooltipText:d.getConstant("MoreOptions"),type:"Button",cssClass:"e-findRib-more"},{prefixIcon:"e-icons e-close",tooltipText:d.getConstant("Close"),type:"Button",cssClass:"e-findRib-close"}],l=new D.Toolbar({clicked:function(e){"e-findRib-next"===e.item.cssClass?(c.parent.notify(Va,{findOption:"next"}),c.updateCount(i)):"e-findRib-prev"===e.item.cssClass?(c.parent.notify(Va,{findOption:"prev"}),c.updateCount(i,!0)):"e-findRib-more"===e.item.cssClass&&(c.findDialog.animationSettings.effect="None",c.findDialog.setProperties({animationSettings:c.findDialog.animationSettings},!0),c.renderFindDlg(),c.findDialog.hide())},width:"auto",height:"auto",items:e,cssClass:"e-find-toolObj",created:function(){l.element.querySelectorAll(".e-toolbar-item .e-tbar-btn").forEach(function(e){return e.removeAttribute("tabindex")})}}),e=this.parent.createElement("div",{className:"e-find-toolbar",attrs:{tabindex:"-1"}}),l.createElement=this.parent.createElement,l.appendTo(e),u=this.parent.createElement("div",{className:"e-dlg-div",attrs:{"aria-label":d.getConstant("FindValue")}}),h=this.parent.element.getElementsByClassName("e-sheet-panel")[0],d={cssClass:"e-findtool-dlg",visible:!1,enableRtl:this.parent.enableRtl,target:h,open:function(){ee.EventHandler.add(document,"click",c.closeDialog,c),c.findValue&&(!f.isProtected||f.protectSettings.selectCells||f.protectSettings.selectUnLockedCells)?(e={value:c.findValue,mode:"Sheet",isCSen:!1,sheetIndex:c.parent.activeSheetIndex,isEMatch:!1,searchBy:"By Row"},c.parent.notify(xr,e),i.textContent=e.findCount,l.enableItems(1,e="0 of 0"!==e.findCount),l.enableItems(2,e)):i.textContent="0 of 0",t(!1);var e=l.element.querySelector(".e-input-group");e&&e.addEventListener("focus",function(){var e=l.element.querySelector(".e-text-findNext-short");ce(e),e.classList.add("e-input-focus"),e.setSelectionRange(0,e.value.length)}),p&&c.findDialog.setProperties({animationSettings:p},!0)},beforeOpen:function(){return ce(c.parent.element)},beforeClose:function(){c.findValue=o.value||null,l.destroy(),ee.EventHandler.remove(document,"click",c.closeDialog)},close:function(){c.findDialog.destroy(),c.findDialog=null,ee.detach(u),h.style.position="",ce(c.parent.element),t(!1)},created:function(){h.style.position="relative",u.style.width=c.parent.getMainContent().offsetWidth+"px",u.style.visibility="hidden",u.style.display="block",c.findDialog.width=2*parseInt(getComputedStyle(u).borderLeftWidth,10)+u.querySelector(".e-toolbar-items").getBoundingClientRect().width+"px",u.style.display="",u.style.width="",u.style.visibility="",u.style.top=(r&&r.headerHgt||c.parent.getColumnHeaderContent().parentElement.offsetHeight+1)+"px",u.style.left="",u.style[c.parent.enableRtl?"left":"right"]=c.parent.sheetModule.getScrollSize()+"px",c.findDialog.show()}},ee.Browser.isDevice?(d.header=e,d.allowDragging=!0):d.content=e,this.findDialog=new g.Dialog(d),this.findDialog.createElement=this.parent.createElement,r&&r.isPublic&&(p={effect:this.findDialog.animationSettings.effect},this.findDialog.setProperties({animationSettings:{effect:"None"}},!0)),this.findDialog.appendTo(u))},Gp.prototype.refreshFindDlg=function(){var e,t=this.findDialog&&this.parent.element.getElementsByClassName("e-findtool-dlg")[0];t&&(e=t.querySelector(".e-text-findNext-short"),this.findToolDlg({findValue:e.value,isPublic:!0,refreshPosition:!0,dialogEle:t}))},Gp.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(" ")},Gp.prototype.closeDialog=function(e){!ee.closest(e.target,".e-findRib-close")&&ee.closest(e.target,".e-spreadsheet")||!this.findDialog||this.findToolDlg({})},Gp.prototype.renderFindDlg=function(){var e,r=this,n=this.parent.serviceLocator.getService(O);this.parent.element.querySelector(".e-find-dlg")?n.hide():(e={isModal:!1,showCloseIcon:!0,cssClass:"e-find-dlg",header:(e=this.parent.serviceLocator.getService(T)).getConstant("FindAndReplace"),beforeOpen:function(e){var t={dialogName:"FindAndReplaceDialog",element:e.element,target:e.target,cancel:e.cancel};r.parent.trigger("dialogBeforeOpen",t),t.cancel?e.cancel=!0:(n.dialogInstance.content=r.findandreplaceContent(),n.dialogInstance.dataBind()),ce(r.parent.element)},buttons:[{buttonModel:{content:e.getConstant("FindPreviousBtn"),isPrimary:!0,cssClass:"e-btn-findPrevious",disabled:!0},click:function(e){r.dialogMessage(),r.findHandler({findOption:e&&13===e.keyCode?"next":"prev"})}},{buttonModel:{content:e.getConstant("FindNextBtn"),isPrimary:!0,cssClass:"e-btn-findNext",disabled:!0},click:function(){r.dialogMessage(),r.findHandler({findOption:"next"})}},{buttonModel:{content:e.getConstant("ReplaceBtn"),isPrimary:!0,cssClass:"e-btn-replace",disabled:!0},click:function(){r.dialogMessage(),r.replaceHandler(gr)}},{buttonModel:{content:e.getConstant("ReplaceAllBtn"),isPrimary:!0,cssClass:"e-btn-replaceAll",disabled:!0},click:function(){r.dialogMessage(),r.replaceHandler(mr)}}],open:function(){var e,t=r.parent.element.querySelector(".e-text-findNext");t.value&&(e=r.parent.element.querySelector(".e-btn-findPrevious"),ee.getComponent(e,"btn").disabled=!1,ee.getComponent(r.parent.element.querySelector(".e-btn-findNext"),"btn").disabled=!1),Xh(function(){ce(t)})},beforeClose:this.dialogBeforeClose.bind(this),close:function(){return n.hide()}},n.show(e))},Gp.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=[],Kd(this.paraElements),this.paraElements=[],Kd(this.inputElements),this.inputElements=[],Kd(this.divElements),this.divElements=[]},Gp.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()},Gp.prototype.renderGotoDlg=function(){var r=this,e=this.parent.serviceLocator.getService(T),n=this.parent.serviceLocator.getService(O);ee.isNullOrUndefined(this.parent.element.querySelector(".e-goto-dlg"))?(e={width:300,isModal:!1,showCloseIcon:!0,cssClass:"e-goto-dlg",header:e.getConstant("GotoHeader"),beforeOpen:function(e){var t={dialogName:"GoToDialog",element:e.element,target:e.target,cancel:e.cancel};r.parent.trigger("dialogBeforeOpen",t),t.cancel?e.cancel=!0:(n.dialogInstance.content=r.GotoContent(),n.dialogInstance.dataBind()),ce(r.parent.element)},buttons:[{buttonModel:{content:e.getConstant("Ok"),isPrimary:!0,cssClass:"e-btn-goto-ok"},click:function(){r.gotoHandler()&&n.hide()}}],open:function(){r.textFocus()}},n.show(e,!1)):n.hide()},Gp.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()})},Gp.prototype.findHandler=function(e){var t,r,n,i,o,a=this.parent.element.querySelector(".e-text-findNext"),s=((a=a||this.parent.element.querySelector(".e-text-findNext-short"))||this.gotoAlert(),a.value);""===a.value||(a=this.parent.getActiveSheet()).isProtected&&!a.protectSettings.selectCells&&!a.protectSettings.selectUnLockedCells||(a=this.parent.activeSheetIndex,t=void 0,t=!!(r=this.parent.element.querySelector(".e-findnreplace-checkcase"))&&ee.getComponent(r,"checkbox").checked,r=void 0,r=!!(n=this.parent.element.querySelector(".e-findnreplace-checkmatch"))&&ee.getComponent(n,"checkbox").checked,n=void 0,n=(i=this.parent.element.querySelector(".e-findnreplace-searchby"))?ee.getComponent(i,"dropdownlist").value.toString():"By Row",i=void 0,i=(o=this.parent.element.querySelector(".e-findnreplace-searchwithin"))?ee.getComponent(o,"dropdownlist").value.toString():"Sheet",o={value:s,sheetIndex:a,findOpt:e.findOption,mode:i,isCSen:t,isEMatch:r,searchBy:n,isAction:!0},this.parent.find(o))},Gp.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,o=this.parent.element.querySelector(".e-search-within .e-ddl-hidden").value,a=this.parent.element.querySelector(".e-searchby .e-ddl-hidden").value;this.parent.notify(e,{value:t,mode:o,isCSen:n,isEMatch:i,searchBy:a,findOpt:"next",replaceValue:r,replaceBy:e,sheetIndex:this.parent.activeSheetIndex,isAction:!0})},Gp.prototype.gotoHandler=function(e){var t=!0;if(e)this.parent.goTo(e.address);else{for(var r=this.parent.element.querySelector(".e-text-goto").value,n=0;n<this.parent.definedNames.length;n++)if(this.parent.definedNames[n].name===r){r=this.parent.definedNames[n].refersTo.slice(1);break}var e=r,i=(e=(e=(e=r.includes("!")?r.substring(r.lastIndexOf("!")+1):e).split("$").join("")).includes(":")?e.split(":")[0]:e).match(/\d+/),o=e.match(/[A-Z]+/i);!i||!o||0!==o.index||1048576<=(i=ne(te(e)))[2]||16384<=i[3]?(this.gotoAlert(),t=!1):this.parent.goTo(r)}return t},Gp.prototype.gotoAlert=function(){var e=this.parent.serviceLocator.getService(T),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)},Gp.prototype.showFindAlert=function(){this.parent.element.querySelector(".e-replace-alert-span")&&this.parent.element.querySelector(".e-replace-alert-span").remove();var e,t=this.parent.element.querySelector(".e-find-dlg .e-dlg-content");t&&((e=this.parent.createElement("span",{className:"e-find-alert-span"})).innerText=this.parent.serviceLocator.getService(T).getConstant("NoElements"),t.appendChild(e))},Gp.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(T),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)},Gp.prototype.findKeyUp=function(e){e.target.classList.contains("e-text-findNext")&&(e=this.parent.element.querySelector(".e-text-findNext").value,ee.isNullOrUndefined(e)||""===e?(ee.getComponent(this.parent.element.querySelector(".e-btn-findPrevious"),"btn").disabled=!0,ee.getComponent(this.parent.element.querySelector(".e-btn-findNext"),"btn").disabled=!0,this.dialogMessage()):(e=this.parent.element.querySelector(".e-btn-findPrevious"),ee.getComponent(e,"btn").disabled=!1,ee.getComponent(this.parent.element.querySelector(".e-btn-findNext"),"btn").disabled=!1));var e=this.parent.element.querySelector(".e-text-findNext").value,t=this.parent.element.querySelector(".e-text-replaceInp").value;ee.isNullOrUndefined(e)||ee.isNullOrUndefined(t)||""===e||""===t?(ee.getComponent(this.parent.element.querySelector(".e-btn-replace"),"btn").disabled=!0,ee.getComponent(this.parent.element.querySelector(".e-btn-replaceAll"),"btn").disabled=!0):this.parent.getActiveSheet().isProtected||(ee.getComponent(this.parent.element.querySelector(".e-btn-replace"),"btn").disabled=!1,ee.getComponent(this.parent.element.querySelector(".e-btn-replaceAll"),"btn").disabled=!1)},Gp.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"}),n=(this.divElements.push(e),this.divElements.push(t),this.divElements.push(r),this.parent.serviceLocator.getService(T)),i=(e.appendChild(t),this.parent.createElement("div",{className:"e-cont"})),o=this.parent.createElement("p",{className:"e-header"}),a=(o.innerText=n.getConstant("FindWhat"),this.parent.createElement("input",{className:"e-input e-text-findNext",attrs:{type:"Text",placeholder:n.getConstant("FindValue"),value:this.shortValue}})),o=(this.divElements.push(i),this.paraElements.push(o),this.inputElements.push(a),i.appendChild(a),i.insertBefore(o,a),t.appendChild(i),new S.TextBox({width:"70%"})),i=(this.textBoxElements.push(o),o.createElement=this.parent.createElement,o.appendTo(a),this.parent.createElement("div",{className:"e-cont"})),o=this.parent.createElement("p",{className:"e-header"}),a=(o.innerText=n.getConstant("ReplaceWith"),this.parent.createElement("input",{className:"e-input e-text-replaceInp",attrs:{type:"Text",placeholder:n.getConstant("ReplaceValue")}})),o=(this.divElements.push(i),this.paraElements.push(o),this.inputElements.push(a),i.appendChild(a),i.insertBefore(o,a),t.appendChild(i),new S.TextBox({width:"70%"})),i=(this.textBoxElements.push(o),o.createElement=this.parent.createElement,o.appendTo(a),[{Id:"Sheet",Within:n.getConstant("Sheet")},{Id:"Workbook",Within:n.getConstant("Workbook")}]),o=new I.DropDownList({dataSource:i,cssClass:"e-search-within",fields:{value:"Id",text:"Within"},width:"50%",index:0}),a=(this.dropDownListElements.push(o),n.getConstant("SearchWithin")),i=this.parent.createElement("input",{className:"e-findnreplace-searchwithin",attrs:{type:"select",label:a}}),s=this.parent.createElement("p",{className:"e-header"}),s=(s.innerText=a,this.inputElements.push(i),this.paraElements.push(s),t.appendChild(s),t.appendChild(i),o.createElement=this.parent.createElement,o.appendTo(i),[{Id:"By Row",Search:n.getConstant("ByRow")},{Id:"By Column",Search:n.getConstant("ByColumn")}]),o=new I.DropDownList({dataSource:s,cssClass:"e-searchby",fields:{value:"Id",text:"Search"},width:"50%",index:0}),i=(this.dropDownListElements.push(o),a=n.getConstant("SearchBy"),this.parent.createElement("input",{className:"e-findnreplace-searchby",attrs:{type:"select",label:a}})),s=this.parent.createElement("p",{className:"e-header"}),a=(s.innerText=a,this.inputElements.push(i),this.paraElements.push(s),t.appendChild(s),t.appendChild(i),o.createElement=this.parent.createElement,o.appendTo(i),new w.CheckBox({label:n.getConstant("MatchCase"),checked:!1,cssClass:"e-findnreplace-casecheckbox"})),s=this.parent.createElement("input",{className:"e-findnreplace-checkcase",attrs:{type:"checkbox"}}),o=(this.inputElements.push(s),r.appendChild(s),a.createElement=this.parent.createElement,a.appendTo(s),new w.CheckBox({label:n.getConstant("MatchExactCellElements"),checked:!1,cssClass:"e-findnreplace-exactmatchcheckbox"})),i=(this.checkBoxElements=o,this.parent.createElement("input",{className:"e-findnreplace-checkmatch",attrs:{type:"checkbox"}}));return this.inputElements.push(i),r.appendChild(i),o.createElement=this.parent.createElement,o.appendTo(i),t.appendChild(r),e},Gp.prototype.GotoContent=function(){var e=this.parent.serviceLocator.getService(T),t=this.parent.createElement("div",{className:"e-link-dialog"}),r=this.parent.createElement("div",{className:"e-goto"}),n=(t.appendChild(r),this.parent.createElement("div",{className:"e-cont"})),i=this.parent.createElement("p",{className:"e-header"}),e=(i.innerText=e.getConstant("Reference"),new S.TextBox({placeholder:e.getConstant("EnterCellAddress")})),o=this.parent.createElement("input",{className:"e-text-goto",attrs:{type:"Text"}});return n.appendChild(o),n.insertBefore(i,o),r.appendChild(n),e.createElement=this.parent.createElement,e.appendTo(o),t},Gp.prototype.destroy=function(){this.removeEventListener(),this.findDialog&&this.findDialog.hide(),this.parent=null},Gp.prototype.getModuleName=function(){return"findAndReplace"};var Wp=Gp;function Gp(e){this.shortValue="",this.divElements=[],this.paraElements=[],this.inputElements=[],this.textBoxElements=[],this.dropDownListElements=[],this.parent=e,this.addEventListener()}Xp.prototype.merge=function(e){this.parent.serviceLocator.getService("cell").refresh(e.rowIdx,e.colIdx,e.lastCell,e.element,!1,!1,Jn(this.parent))},Xp.prototype.hideHandler=function(e){var t,r=this.parent.getActiveSheet(),n={range:[e.rowIdx,e.colIdx,e.rowIdx,e.colIdx]},i=(this.parent.notify(Dr,n),se(n.range[0],n.range[1],r)||{}),o="row"===e.model?n.range[0]:n.range[1],a=o+((i[e.model+"Span"]||1)-1);!e.isEnd&&(e.start===o||pe(r,o))||e.isEnd&&e.start>o&&!pe(r,o)||1<i[e.model+"Span"]&&a>=e.start&&(("row"===e.model?he:pe)(r,o)?e.colIdx<=a&&(o=Y(r,n.range[1],!0,"columns"))<=a&&(t=n.range[0],1<i.rowSpan&&(t=(t=Y(r,n.range[0],!0))<=n.range[2]?t:n.range[0]),e=this.parent.getCell(t,o))&&(e.style.display="",this.parent.serviceLocator.getService("cell").refresh(n.range[0],n.range[1],!0,e,!0,!0)):(t=1<i.rowSpan?Y(r,n.range[0],!0):n.range[0],this.merge({rowIdx:n.range[0],colIdx:n.range[1],element:this.parent.getCell(t,n.range[1])})))},Xp.prototype.checkPrevMerge=function(s){function e(e){if(l.range=l.range,he(d,l.range[0])&&s.rowIdx>=l.range[0]&&s.rowIdx<=l.range[2]){o=!1;for(var t,r=l.range[0];r<s.rowIdx;r++)if(!he(d,r)){o=!0;break}1<n.rowSpan&&!o&&0<(t=n.rowSpan-h.parent.hiddenCount(l.range[0],l.range[2]))&&(p(),s.td.style.display="",s.colSpan=i,s.rowSpan=t,s.cell=n,s.isMerged=!1)}else if(e){for(r=l.range[0];a&&r<s.rowIdx;r++)if(!he(d,r)){o=!0;break}o||(p(),s.td.style.display="",s.colSpan=i,s.cell=n,s.isMerged=!1)}}var n,l,i,o,a,h=this,d=this.parent.getActiveSheet(),p=function(){var e=h.parent.getContentTable(),t=e&&e.rows[0];if(t){var r=parseInt(t.getAttribute("aria-rowindex"),10)-1;if(l.range=l.range,r>h.parent.viewport.topIndex+h.parent.frozenRowCount(d)&&r>l.range[0]&&r<=l.range[2]){var n=void 0,e=h.parent.getRowHeaderTable(),i=e&&e.rows[0],o=h.parent.frozenColCount(d);if(!o||i)for(var a=s.colIdx;a<=l.range[3];a++)(n=h.parent.getCell(r,a,a<o?i:t))&&(1<n.colSpan||1<n.rowSpan)&&(n.style.display="none",n.removeAttribute("colSpan"),n.removeAttribute("rowSpan"))}}};if(s.cell.colSpan<0){if(-1<s.colIdx-1&&pe(d,s.colIdx-1)&&(n=se(s.rowIdx,s.colIdx-1,d,!1,!0),a=-1<s.rowIdx-1&&he(d,s.rowIdx-1),void 0!==n.colSpan||void 0!==n.rowSpan)&&(void 0===n.rowSpan||1<n.rowSpan||a)&&(l={range:[s.rowIdx,s.colIdx-1,s.rowIdx,s.colIdx-1]},this.parent.notify(Dr,l),l.range,n=se(l.range[0],l.range[1],d,!1,!0),pe(d,l.range[1]))&&s.colIdx>=l.range[1]&&s.colIdx<=l.range[3]){for(var t=l.range[1];t<s.colIdx;t++)if(!pe(d,t)){o=!0;break}1<n.colSpan&&!o&&0<(i=n.colSpan-this.parent.hiddenCount(l.range[1],l.range[3],"columns"))&&e(!0)}}else-1<s.rowIdx-1&&he(d,s.rowIdx-1)&&void 0!==(n=se(s.rowIdx-1,s.colIdx,d,!1,!0)).rowSpan&&(l={range:[s.rowIdx-1,s.colIdx,s.rowIdx-1,s.colIdx]},this.parent.notify(Dr,l),l.range=l.range,n=se(l.range[0],l.range[1],d,!1,!0),e())},Xp.prototype.checkMerge=function(e){var t,r=this.parent.getActiveSheet(),n=se(e.rowIdx,e.colIdx,r)||{};if(e.isRow){if(void 0===n.colSpan||pe(r,e.colIdx-1))if((t={range:[e.rowIdx,e.colIdx,e.rowIdx,e.colIdx]}).range,this.parent.notify(Dr,t),pe(r,e.colIdx-1)&&!pe(r,t.range[1])||e.isFreezePane&&t.range[0]<this.parent.frozenRowCount(r))e.insideFreezePane=t.range[0]<this.parent.frozenRowCount(r);else{if(e.colIdx!==this.parent.viewport.leftIndex+this.parent.frozenColCount(r)&&pe(r,e.colIdx-1))for(var i=t.range[1];void 0!==n.colSpan&&i<e.colIdx;i++)if(!pe(r,i))return;var o,n=se(t.range[0],t.range[1],r);1<=(o=t.range[2]-e.rowIdx+1-this.parent.hiddenCount(e.rowIdx,t.range[2]))&&(this.merge({rowIdx:t.range[0],colIdx:t.range[1],element:e.td}),1===o?e.td.removeAttribute("rowspan"):e.td.rowSpan=o,e.td.style.display="")}}else if(void 0===n.rowSpan||he(r,e.rowIdx-1))if((t={range:[e.rowIdx,e.colIdx,e.rowIdx,e.colIdx]}).range=t.range,this.parent.notify(Dr,t),he(r,e.rowIdx-1)&&!he(r,t.range[0])||e.isFreezePane&&t.range[1]<this.parent.frozenColCount(r))e.insideFreezePane=t.range[1]<this.parent.frozenColCount(r);else{if(e.rowIdx!==this.parent.viewport.topIndex+this.parent.frozenRowCount(r)&&he(r,e.rowIdx-1))for(var a=t.range[0];void 0!==n.rowSpan&&a<e.rowIdx;a++)if(!he(r,a))return;n=se(t.range[0],t.range[1],r),1<=(o=t.range[3]-e.colIdx+1-this.parent.hiddenCount(e.colIdx,t.range[3],"columns"))&&(this.merge({rowIdx:t.range[0],colIdx:t.range[1],element:e.td}),1===o?e.td.removeAttribute("colspan"):e.td.colSpan=o,e.td.style.display="")}},Xp.prototype.addEventListener=function(){this.parent.on(Ar,this.merge,this),this.parent.on(Xa,this.hideHandler,this),this.parent.on(Ka,this.checkPrevMerge,this),this.parent.on($a,this.checkMerge,this)},Xp.prototype.destroy=function(){this.removeEventListener(),this.parent=null},Xp.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(Ar,this.merge),this.parent.off(Xa,this.hideHandler),this.parent.off(Ka,this.checkPrevMerge),this.parent.off($a,this.checkMerge))},Xp.prototype.getModuleName=function(){return"merge"};var Yp=Xp;function Xp(e){this.parent=e,this.addEventListener()}$p.prototype.destroy=function(){this.removeEventListener(),this.dupData&&(this.dupData=[]),this.colorData&&(this.colorData=[]),this.parent=null},$p.prototype.addEventListener=function(){this.parent.on(Br,this.applyCF,this),this.parent.on(ts,this.renderCFDlg,this),this.parent.on(Vr,this.clearCF,this)},$p.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(Br,this.applyCF),this.parent.off(ts,this.renderCFDlg),this.parent.off(Vr,this.clearCF))},$p.prototype.clearCF=function(e){var l=this,t=this.parent.getActiveSheet();this.updateRange(t,e.indexes,this.parent.frozenRowCount(t),this.parent.frozenColCount(t),W(t.topLeftCell),function(t,r,n,i){var o,a,s;ee.removeClass([i],["e-redft","e-yellowft","e-greenft","e-redf","e-redt","e-iconset"]),["backgroundColor","color"].forEach(function(e){i.style[""+e]&&(i.style[""+e]="",o=n&&n.style&&n.style[""+e]||l.parent.commonCellStyle[""+e])&&((a={})[""+e]=o,l.parent.notify(Ft,{style:a,rowIdx:t,colIdx:r,td:i}))}),[".e-cf-databar",".e-iconsetspan"].forEach(function(e){s=i.querySelector(e);e=i.querySelector(".e-wrap-content");s&&((e||i).removeChild(s),i.textContent=l.parent.getDisplayText(n))})})},$p.prototype.renderCFDlg=function(r){var t,n=this,e=this.parent.serviceLocator.getService(T),i=this.parent.serviceLocator.getService(O);i.show({width:375,showCloseIcon:!0,isModal:!0,cssClass:"e-conditionalformatting-dlg",header:r.action.replace("...",""),beforeOpen:function(e){var t={dialogName:"ConditionalFormatDialog",element:e.element,target:e.target,cancel:e.cancel};n.parent.trigger("dialogBeforeOpen",t),t.cancel?(e.cancel=!0,Xh(function(){i.hide(!0),ce(n.parent.element)})):(i.dialogInstance.content=n.cfDlgContent(r.action),i.dialogInstance.dataBind(),ce(n.parent.element))},beforeClose:this.dialogBeforeClose.bind(this),close:function(){t&&(n.parent.notify(qa,null),t=!1)},buttons:[{buttonModel:{content:e.getConstant("Ok"),isPrimary:!0},click:function(){var e=n.parent.getActiveSheet();Xd(n.parent,ne(te(e.selectedRange)))?t=!0:n.dlgClickHandler(r.action),i.hide()}}]})},$p.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),Kd(this.spanElements),this.spanElements=[],Kd(this.inputElements),this.inputElements=[],Kd(this.divElements),this.divElements=[]},$p.prototype.dlgClickHandler=function(e){var t=this.parent.serviceLocator.getService(T),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},r=r.querySelectorAll(".e-cfmain .e-input");e===t.getConstant("DuplicateValues")+"..."?n.type=r[0].value===t.getConstant("Duplicate")?"Duplicate":"Unique":(n.type=this.getType(e),t=[],r[0]&&t.push(r[0].value),r[1]&&t.push(r[1].value),Kn(t,this.parent),n.value=t.join(",")),this.parent.notify(Mr,{cfModel:n,isAction:!0})},$p.prototype.getType=function(e){var t,r=this.parent.serviceLocator.getService(T);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},$p.prototype.getCFColor=function(e){var t=this.parent.serviceLocator.getService(T),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},$p.prototype.cfDlgContent=function(e){var t,r=this.getDlgText(e),n=this.parent.serviceLocator.getService(T),i=this.parent.createElement("div",{className:"e-cf-dlg"}),o=this.parent.createElement("div",{className:"e-cfmain"}),a=this.parent.createElement("div",{className:"e-cfsub"}),s=(this.divElements.push(i),this.divElements.push(o),this.divElements.push(a),this.parent.createElement("span",{className:"e-header e-top-header"})),r=(s.innerText=r,this.value1Inp=this.parent.createElement("input",{className:"e-input",id:"valueInput",attrs:{type:"text","aria-label":r}}),this.parent.createElement("input",{className:"e-select"})),l=this.parent.createElement("span",{className:"e-header"}),h=(l.innerText=n.getConstant("With"),this.parent.createElement("input",{className:"e-select"})),r=(this.spanElements.push(s),this.inputElements.push(r),this.spanElements.push(l),this.inputElements.push(h),i.appendChild(o),i.appendChild(a),o.appendChild(s),e!==n.getConstant("DuplicateValues")+"..."?e!==n.getConstant("AboveAverage")+"..."&&e!==n.getConstant("BelowAverage")+"..."&&(o.appendChild(this.value1Inp),t=!0,s=e===n.getConstant("Top10")+" %..."||e===n.getConstant("Bottom10")+" %...",e!==n.getConstant("Top10Items")+"..."&&e!==n.getConstant("Bottom10Items")+"..."&&!s||(this.value1Inp.maxLength=s?3:4,s=new S.NumericTextBox({value:10,min:1,max:s?100:1e3,format:"###"}),(this.numericTBElements=s).appendTo(this.value1Inp))):(o.appendChild(r),this.dupData=[{text:n.getConstant("Duplicate"),id:"duplicate"},{text:n.getConstant("Unique"),id:"unique"}],s=new I.DropDownList({dataSource:this.dupData,index:0,popupHeight:"200px"}),this.dropDownListElements.push(s),s.appendTo(r)),e===n.getConstant("Between")+"..."&&((s=this.parent.createElement("span",{className:"e-header e-header-2"})).innerText=n.getConstant("And"),this.value2Inp=this.parent.createElement("input",{className:"e-input e-between"}),this.spanElements.push(s),o.appendChild(s),o.appendChild(this.value2Inp),this.value2Inp.addEventListener("input",this.validateCFInput.bind(this))),t&&(this.validateCFInput({target:this.value1Inp}),this.value1Inp.addEventListener("input",this.validateCFInput.bind(this))),a.appendChild(l),a.appendChild(h),this.colorData=[{text:n.getConstant("LightRedFillWithDarkRedText"),value:"redft",id:"redft"},{text:n.getConstant("YellowFillWithDarkYellowText"),id:"yellowft"},{text:n.getConstant("GreenFillWithDarkGreenText"),id:"greenft"},{text:n.getConstant("RedFill"),id:"redf"},{text:n.getConstant("RedText"),id:"redt"}],new I.DropDownList({dataSource:this.colorData,index:0,popupHeight:"200px"}));return this.dropDownListElements.push(r),r.appendTo(h),i},$p.prototype.validateCFInput=function(e){var t=this.parent.serviceLocator.getService(O),r=e.target.value,t=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),t.disabled=!r.trim()},$p.prototype.checkCellHandler=function(t,r,e){return e.range.trim().split(",").some(function(e){e=te(e.includes(":")?e:e+":"+e);return t>=e[0]&&t<=e[2]&&r>=e[1]&&r<=e[3]})},$p.prototype.getDlgText=function(e){var t=this.parent.serviceLocator.getService(T),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},$p.prototype.updateResult=function(e,t,r,n,i,o,a,s){for(var l,h,d,p={},c={},u=e.range.split(","),f=[],g=r?function(){var e;oe(l)&&"Text"!==d&&(0<=(e=parseFloat(l))?(void 0===f[0]||e>f[0])&&(f[0]=e):(void 0===f[1]||e<f[1])&&(f[1]=e))}:n?function(){var e;oe(l)&&"Text"!==d&&(e=parseFloat(l),f.push(Number(e)))}:i?(f=[0,0],function(){oe(l)&&"Text"!==d&&(f[0]+=parseFloat(l),f[1]++)}):o?function(){oe(l)&&"Text"!==d&&f.push(parseFloat(l))}:a?function(){var e;oe(l)&&"Text"!==d&&(e=parseFloat(l),(void 0===f[0]||e<f[0])&&(f[0]=e),void 0===f[1]||e>f[1])&&(f[1]=e)}:function(){p[""+l]?""===l||c[""+l]||(c[""+l]=!0,f.push(l)):p[""+l]=!0},m=0;m<u.length;m++)for(var v,y=(v=te(u[m]))[0];y<=v[2];y++)for(var C=v[1];C<=v[3];C++)h=se(y,C,t,!1,!0),d="",ee.isNullOrUndefined(h.value)?h.formula&&(this.parent.notify(wt,{cell:h,rowIdx:y,colIdx:C,sheetIndex:this.parent.activeSheetIndex}),l=h.value.toString().toLowerCase(),d=Ml(h.format),g()):(l=h.value.toString().toLowerCase(),d=Ml(h.format),g());n||o?(f=f.sort(function(e,t){return e-t}),e.type.includes("Bottom")||(f=f.reverse()),o&&(r=parseFloat(s),e.type.includes("Percentage")&&(r=(r/=100/f.length)<1?1:r),f=f.slice(0,r))):i&&!(f=[f[0]/f[1]])[0]&&(f=[]),e.result=f},$p.prototype.applyCF=function(e){for(var t=!e.cfModel,r=this.parent.getActiveSheet(),n=e.cfModel||r.conditionalFormats,i=[e.indexes],o=(e.refreshAll&&(i=$n(this.parent,this.parent.viewport)),{}),a=n.length-1;0<=a;a--)t&&(2===i[0].length?!this.checkCellHandler(e.indexes[0],e.indexes[1],n[a]):!Xn(i,n[a].range))||this.updateCF(e,r,n[a],o)},$p.prototype.updateCF=function(u,e,f,g){var m,v,y,C=this;if(f.value){var t=f.value.split(",").filter(function(e){return!!e.trim()});if(1<t.length)if(1<t[0].split("(").length){for(var r="",n=0;n<t.length;n++)(r+=t[n]+",").split("(").length===r.split(")").length&&void 0===b&&(b=r.substring(0,r.length-1),r="");m=r.substring(0,r.length-1)}else for(var b=t[0],n=1;n<t.length;n++)m+=n+1===t.length?t[n]:t[n]+",";else b=t[0]||f.value}f.type||(f.type="GreaterThan"),f.format&&f.format.style?(v=ji(f.format.style,!0),Object.keys(v).length||(y=(y=f.cFColor)||(f.cFColor="RedFT"))):(v={},y=(y=f.cFColor)||(f.cFColor="RedFT"));function i(e,t,r,n,i){var o,a,s=r&&!ee.isNullOrUndefined(r.value)?r.value.toString():"",l=!0,h=r?Ml(r.format):"";switch(f.type){case"GreaterThan":case"LessThan":o=C.isGreaterThanLessThan(f,s,b,h);break;case"Between":o=oe(s)&&"Text"!==h&&C.isBetWeen(f,s,b,m);break;case"EqualTo":o=oe(s)&&"Text"!==h&&C.isEqualTo(f,s,b);break;case"ContainsText":o=s&&b&&C.isContainsText(s,b);break;case"DateOccur":d={value:b,cell:{},updatedVal:b},oe(b)||C.parent.notify(At,d),o=s===d.updatedVal;break;case"Unique":o=-1===f.result.indexOf(s.toLowerCase());break;case"Duplicate":o=-1<f.result.indexOf(s.toLowerCase());break;case"Top10Items":case"Bottom10Items":case"Top10Percentage":case"Bottom10Percentage":f.result&&(c=parseFloat(s),ai(s)&&(c=oi(s)),o=-1<f.result.indexOf(c));break;case"AboveAverage":o=f.result.length&&oe(s)&&"Text"!==h&&parseFloat(s)>f.result[0];break;case"BelowAverage":o=f.result.length&&oe(s)&&"Text"!==h&&parseFloat(s)<f.result[0];break;default:var d,p,c,l=!1;x?g[e+"_"+t+"_bars"]||(g[e+"_"+t+"_bars"]=!0,C.applyDataBars(s,f,n,e,h,i)):S?g[e+"_"+t]||(c=oe(s)?parseFloat(s):NaN,isNaN(c)?!n.style.backgroundColor||n.classList.contains("e-yellowft")||n.classList.contains("e-greenft")||n.classList.value.includes("e-redf")||(n.style.backgroundColor="",(d=ee.extend({},C.parent.commonCellStyle,r&&r.style)).backgroundColor&&C.parent.notify(Ft,{style:{backgroundColor:d.backgroundColor},td:n,rowIdx:e,colIdx:t})):-1===(c=(d=f.result).indexOf(c))?n.style.backgroundColor&&(n.style.backgroundColor="",(p=ee.extend({},C.parent.commonCellStyle,r&&r.style)).backgroundColor)&&C.parent.notify(Ft,{style:{backgroundColor:p.backgroundColor},td:n,rowIdx:e,colIdx:t}):(p=C.getColor(f.type),n.style.backgroundColor=0===c?p[0]:c===d.length-1?p[p.length-1]:3===d.length&&1===c?p[1]:C.getGradient(c,p[0],p[1],p[2],d.length),g[e+"_"+t]=!0)):g[e+"_"+t+"_icons"]||(g[e+"_"+t+"_icons"]=!0,c=C.parent.createElement("span",{className:"e-icon e-iconsetspan"}),C.applyIconSet(s,f,n,c,h)&&r&&r.format&&r.format.includes("*")&&"Accounting"!==Ml(r.format)&&C.parent.notify(an,{cell:r,cellEle:n,rowIdx:e,colIdx:t,updateFillSize:!0,iconSetSpan:c}))}u.isAction&&l&&(C.parent.trigger("beforeConditionalFormat",{conditionalFormat:f,cell:r,element:n,apply:o,address:G(e,t)}),o||!u.isEdit||g[e+"_"+t]||(y?n.className.includes("e-"+y.toLowerCase())&&(n.classList.remove("e-"+y.toLowerCase()),n.style.backgroundColor="",n.style.color="",(a=ee.extend({},C.parent.commonCellStyle,r&&r.style)).backgroundColor||a.color)&&C.parent.notify(Ft,{rowIdx:e,colIdx:t,td:n,style:{backgroundColor:a.backgroundColor,color:a.color}}):(n.removeAttribute("style"),a=ee.extend({},C.parent.commonCellStyle,r&&r.style),Object.keys(a).length&&C.parent.notify(Ft,{style:a,rowIdx:e,colIdx:t,td:n})))),o&&!g[e+"_"+t]&&(g[e+"_"+t]=!0,ee.removeClass([n],["e-redft","e-yellowft","e-greenft","e-redf","e-redt"]),y&&(n.classList.add("e-"+y.toLowerCase()),C.setCFStyle(v,f)),Object.assign(n.style,v))}var o=f.type.includes("Average"),a=f.type.includes("10")&&oe(b),s=f.type.includes("Three")||f.type.includes("Four")||f.type.includes("Five"),x=f.type.includes("DataBar"),S=f.type.includes("ColorScale");u.isRender&&f.result||!("Duplicate"===f.type||"Unique"===f.type||x||S||o||a||s)||this.updateResult(f,e,x,S,o,a,s,b);if(u.ele)i(u.indexes[0],u.indexes[1],u.cell,u.ele,u.resizedRowHeight);else for(var l=f.range.split(","),h=this.parent.frozenRowCount(e),d=this.parent.frozenColCount(e),p=W(e.topLeftCell),c=0;c<l.length;c++)this.updateRange(e,te(l[c]),h,d,p,i)},$p.prototype.updateRange=function(e,t,r,n,i,o){var a;t[0]=t[0]<r?(t[0]<i[0]?i: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: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 s=t[0];s<=t[2];s++)if(!he(e,s=r&&s===r?this.parent.viewport.topIndex+r:s))for(var l=t[1];l<=t[3];l++)pe(e,l=n&&l===n?this.parent.viewport.leftIndex+n:l)||(a=this.parent.getCell(s,l))&&o(s,l,se(s,l,e),a)},$p.prototype.applyIconSet=function(e,t,r,n,i){var o,a,s,l,h=r.classList.contains("e-iconset"),d=(h&&(r.classList.remove("e-iconset"),d=r.querySelector(".e-iconsetspan"))&&r.removeChild(d),oe(e)?parseFloat(e):NaN),p=t.result;return isNaN(d)||void 0===p[0]&&void 0===p[1]||oe(e)&&"Text"===i?h:(e=p[0],i=p[1],3===(h=this.getIconList(t.type).split(",")).length?o="e-"+(e+.67*(i-e)<=d?h[0]:e+.33*(i-e)<=d?h[1]:h[2]).trim():4===h.length?(a=e+.25*(i-e),s=e+.5*(i-e),o="e-"+((l=e+.75*(i-e))<=d?h[0]:s<=d?h[1]:a<=d?h[2]:h[3]).trim()):5===h.length&&(a=e+.2*(i-e),s=e+.4*(i-e),l=e+.6*(i-e),o="e-"+(e+.8*(i-e)<=d?h[0]:l<=d?h[1]:s<=d?h[2]:a<=d?h[3]:h[4]).trim()),n.classList.add(o),r.insertBefore(n,r.childNodes[0]),r.classList.add("e-iconset"),!0)},$p.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"},$p.prototype.applyDataBars=function(e,t,r,n,i,o){var a,s,l,h,d,p=this.parent.getActiveSheet(),c=t.result,u=0;oe(e)&&(s=parseFloat(e)),void 0===c[0]&&void 0===c[1]||isNaN(s)||oe(e)&&"Text"===i?(e=r.getElementsByClassName("e-cf-databar")[0])&&(i=e.getElementsByClassName("e-databar-value")[0].textContent,r.removeChild(e),r.innerText=i):(void 0!==c[0]&&void 0!==c[1]?(a=c[0]+Math.abs(c[1]),u=Math.abs(c[1]/a*100)):a=void 0!==c[0]?c[0]:c[1],e=this.parent.createElement("div",{id:"spreadsheet-databar",className:"e-cf-databar"}),i=this.parent.createElement("span",{id:"spreadsheet-leftspan",className:"e-databar"}),l=this.parent.createElement("span",{id:"spreadsheet-rightspan",className:"e-databar"}),h=this.parent.createElement("span",{id:"spreadsheet-dataspan",className:"e-databar-value"}),d=r.querySelector(".e-iconsetspan"),o=o||kh(p,n,!0),e.style.height=o-1+"px","L"===(p=t.type[0])&&(p+="B"),void 0===c[1]?(l.style.width=Math.ceil(Math.abs(s/a*100))+"%",l.style.height=o-3+"px",l.style.backgroundColor=this.getColor(p)[0],l.style.left="0px"):void 0===c[0]?(l.style.width=Math.ceil(Math.abs(s/a*100))+"%",l.style.height=o-3+"px",l.style.backgroundColor=this.getColor("R")[0],l.style.left="0px"):0<=s?(i.style.width=u+"%",i.style.height=o-3+"px",i.style.backgroundColor="transparent",i.style.left="0px",l.style.width=Math.ceil(Math.abs(s/a*100))+"%",l.style.height=o-3+"px",l.style.backgroundColor=this.getColor(p)[0],l.style.left=u+"%"):(i.style.width=Math.ceil(Math.abs(s/a*100))+"%",i.style.height=o-3+"px",i.style.backgroundColor=this.getColor("R")[0],i.style.width===u+"%"?i.style.left="0px":i.style.right=100-u+"%"),h.style.fontSize=r.style.fontSize||"11pt",h.style.alignItems="top"===r.style.verticalAlign?"start":"middle"===r.style.verticalAlign?"center":"end",(n=r.querySelector("#"+this.parent.element.id+"_currency"))&&e.appendChild(n),(t=r.querySelector(".e-hyperlink"))?h.appendChild(t):(h.innerText=r.textContent,""===r.textContent&&h.appendChild(document.createTextNode(r.textContent))),e.appendChild(i),e.appendChild(l),e.appendChild(h),r.textContent="",d&&r.insertBefore(d,r.firstElementChild),r.appendChild(e))},$p.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},$p.prototype.getGradient=function(e,t,r,n,i){return ee.isNullOrUndefined(n)?this.getLinear(t,r,e/i):(i=i/2)<=e?this.getLinear(r,n,Math.abs((e-i)/i)):this.getLinear(t,r,e/i)},$p.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)},$p.prototype.byteLinear=function(e,t,r){e=parseInt(e,16)*(1-r)+parseInt(t,16)*r|0;return Math.abs(e).toString(16)},$p.prototype.isGreaterThanLessThan=function(e,t,r,n){return oe(t)&&"Text"!==n?oe(r)?(n=new RegExp(/[^.-a-zA-Z 0-9]+/g),"GreaterThan"===e.type?parseFloat(t)>parseFloat(r.replace(n,"")):parseFloat(t)<parseFloat(r.replace(n,""))):(this.parent.notify(At,n={value:r,rowIndex:0,colIndex:0,sheetIndex:0,isDate:!1,updatedVal:"",isTime:!1}),n.isDate||n.isTime?(e.value=n.updatedVal.toString(),"GreaterThan"===e.type?Number(t)>Number(n.updatedVal):Number(t)<Number(n.updatedVal)):"GreaterThan"===e.type?t.toLowerCase()>r.toLowerCase():t.toLowerCase()<r.toLowerCase()):""===t&&0<Number(r)&&"LessThan"===e.type},$p.prototype.isBetWeen=function(e,t,r,n){var i,o,a=new RegExp(/[^.-a-zA-Z 0-9]+/g);return r=r.replace(a,""),n=n.replace(a,""),oe(r)?(a=parseFloat(r),(i=parseFloat(n))<a&&(a=(o=[i,a])[0],i=o[1]),parseFloat(t)>=a&&parseFloat(t)<=i):!(!r||!n)&&(o={value:n,cell:{},updatedVal:""},this.parent.notify(At,a={value:r,cell:{},updatedVal:""}),this.parent.notify(At,o),(a.isDate||a.isTime)&&(o.isDate||o.isTime)?(e.value=a.updatedVal+","+o.updatedVal,a.updatedVal>o.updatedVal&&(i=[o.updatedVal,a.updatedVal],a.updatedVal=i[0],o.updatedVal=i[1]),t>=a.updatedVal&&t<=o.updatedVal):t.toLowerCase()>=r.toLowerCase()&&t.toLowerCase()<=n.toLowerCase())},$p.prototype.isEqualTo=function(e,t,r){var n;return oe(r)?(n=new RegExp(/[^.-a-zA-Z 0-9]+/g),parseFloat(t)===parseFloat(r.replace(n,""))):(this.parent.notify(At,n={value:r,cell:{},updatedVal:""}),n.isTime||n.isDate?(e.value=n.updatedVal,t===n.updatedVal):t.toLowerCase()===r.toLowerCase())},$p.prototype.isContainsText=function(e,t){var r=new RegExp(/[^.-a-zA-Z 0-9]+/g);return oe(t.replace(r,""))?(t=t.replace(r,""),-1<(e=ai(e)?oi(e).toString():e).indexOf(t)):ai(t)?-1<(e=ai(e)?oi(e).toString():e).indexOf(oi(t).toString()):-1<e.toLowerCase().indexOf(t.toLowerCase())},$p.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},$p.prototype.getModuleName=function(){return"conditionalFormatting"};var Kp=$p;function $p(e){this.divElements=[],this.spanElements=[],this.inputElements=[],this.dropDownListElements=[],this.parent=e,this.addEventListener()}Jp.prototype.getfillItems=function(){var e=this.parent.serviceLocator.getService(T);return[{text:e.getConstant("CopyCells")},{text:e.getConstant("FillSeries")},{text:e.getConstant("FillFormattingOnly")},{text:e.getConstant("FillWithoutFormatting")}]},Jp.prototype.createAutoFillElement=function(){var e,t;this.parent.allowAutoFill&&(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}))},Jp.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 m.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},Jp.prototype.getFillType=function(e){var t=this.parent.serviceLocator.getService(T),e=e===t.getConstant("CopyCells")?"CopyCells":e===t.getConstant("FillSeries")?"FillSeries":e===t.getConstant("FillFormattingOnly")?"FillFormattingOnly":"FillWithoutFormatting";return e},Jp.prototype.autoFillClick=function(){var e=this.parent.serviceLocator.getService(T),t={fillType:"FillSeries",disableItems:[""]};this.parent.notify(nn,t),this.autoFillDropDown.setProperties({items:this.getfillItems()},!0),this.autoFillDropDown.removeItems(t.disableItems),this.refreshAutoFillOption(e.getConstant(t.fillType))},Jp.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]}},Jp.prototype.autoFillOptionClick=function(e){var t=this.parent.serviceLocator.getService(T),r=this.parent.getActiveSheet(),n=ne(te(this.parent.selectionModule.dAutoFillCell)),i=te(r.selectedRange),o=n[0],a=n[1],s=n[2],n=n[3],l=this.getDirection({rowIndex:s,colIndex:n},{rowIndex:i[2],colIndex:i[3]}),h=[o,a,s,n],o=this.getFillRange({rowIndex:o,colIndex:a},{rowIndex:s,colIndex:n},{rowIndex:i[2],colIndex:i[3]},l),a=(this.refreshAutoFillOption(t.getConstant(e.type)),{isUndo:!0,isPublic:!0,preventReSelect:!0,preventEvt:"FillWithoutFormatting"===e.type,setCollection:"FillFormattingOnly"===e.type||"FillWithoutFormatting"===e.type,isFromAutoFillOption:!0}),s=(this.parent.notify(ma,a),{dataRange:r.name+"!"+re(h),fillRange:r.name+"!"+re(o),direction:l,fillType:e.type,isFillOptClick:!0}),n=(this.isVerticalFill="Down"===s.direction||"Up"===s.direction,this.parent.notify(tn,s),this.positionAutoFillElement({isautofill:!0}),{dataRange:s.dataRange,fillRange:s.fillRange,fillType:s.fillType,direction:s.direction,selectedRange:r.name+"!"+re(i),undoArgs:a.undoArgs});this.parent.notify(le,{eventArgs:n,action:"autofill"}),this.parent.showAggregate&&this.parent.notify(Ja,{}),this.autoFillClick()},Jp.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()},Jp.prototype.positionAutoFillElement=function(e){var t,r=0,n=0,i=this.parent.getActiveSheet(),o=ne(te(i.selectedRange)),a=-5,s=-5,l=6,h=6,d=0===o[1]&&o[3]===i.colCount-1,p=0===o[0]&&o[2]===i.rowCount-1,c=o[2],u=o[3],f=this.parent.enableRtl,g=this.parent.getCell(c,u);pe(i,o[3])||he(i,o[2])||g&&g.classList.contains("e-formularef-selection")||i.isProtected&&i.protectSettings.selectUnLockedCells&&jd(this.parent,o)?this.hideAutoFillElement():(i.isProtected&&(i.protectSettings.selectCells||i.protectSettings.selectUnLockedCells)||!i.isProtected)&&(d?(a=-5,s=-1,l=6,c=o[h=2],u=o[1]):p&&(s=-5,l=1,h=6,c=o[a=0],u=o[3]),i.frozenColumns||i.frozenRows?(p||d?(id(this.parent,this.autoFillElement,o,"e-autofill",e&&e.preventAnimation),this.parent.autoFillSettings.showFillOptions&&e&&e.isautofill&&id(this.parent,this.autoFillDropDown.element,o,"e-filloption")):(id(this.parent,this.autoFillElement,[c,u,c,u],"e-autofill",e&&e.preventAnimation),this.parent.autoFillSettings.showFillOptions&&e&&e.isautofill&&id(this.parent,this.autoFillDropDown.element,[c,u,c,u],"e-filloption")),this.autoFillElement&&(this.autoFillCell={rowIndex:c,colIndex:u},(g=this.parent.element.querySelectorAll(".e-autofill")).length)&&(t=g[0].getBoundingClientRect(),this.autoFillElementPosition={left:t.left,top:t.top},[].slice.call(g).forEach(function(e){ee.removeClass([e],"e-hide")}))):(o=nd(i,[c,u,c,u],this.parent.frozenRowCount(i),this.parent.frozenColCount(i),this.parent.viewport.beforeFreezeHeight,this.parent.viewport.beforeFreezeWidth,this.parent.sheetModule.colGroupWidth),g=Ah(i,c,c,!0),i=Uh(i,u,u,!0),p||(r+=g),d||(n+=i),r+=Math.round(o.top)+a,n+=Math.round(o.left)+s,this.autoFillElement&&(ee.removeClass([this.autoFillElement],"e-hide"),this.autoFillElement.style.top=r+"px",f?this.autoFillElement.style.right=n+"px":this.autoFillElement.style.left=n+"px",this.autoFillCell={rowIndex:c,colIndex:u},t=this.autoFillElement.getBoundingClientRect(),this.autoFillElementPosition={left:t.left,top:t.top},this.parent.autoFillSettings.showFillOptions)&&e&&e.isautofill&&(ee.removeClass([this.autoFillDropDown.element],"e-hide"),this.autoFillDropDown.element.style.top=r+l+"px",f?this.autoFillDropDown.element.style.right=n+h+"px":this.autoFillDropDown.element.style.left=n+h+"px")))},Jp.prototype.hideAutoFillElement=function(){var t=this.parent.element;[].slice.call(t.querySelectorAll(".e-autofill")).forEach(function(e){t&&ee.addClass([e],"e-hide")})},Jp.prototype.hideAutoFillOptions=function(){var t=this.parent.element;[].slice.call(t.querySelectorAll(".e-filloption")).forEach(function(e){t&&ee.addClass([e],"e-hide")})},Jp.prototype.selectAutoFillRange=function(e){var t={clientY:Cd(e.e),target:e.e.target},r={clientX:yd(e.e),target:e.e.target},n=this.parent.getActiveSheet(),t=(this.parent.notify(us,t),this.parent.notify(fs,r),this.getAutoFillRange({rowIndex:t.clientY,colIndex:r.clientX})),r=t&&t.fillRange?[t.startCell.rowIndex,t.startCell.colIndex,t.endCell.rowIndex,t.endCell.colIndex]:te(n.selectedRange);return e.indexes=r},Jp.prototype.getAutoFillRange=function(e){var t=this.parent.getActiveSheet(),r=this.autoFillCell,t=ne(te(t.selectedRange)),n=t[0],i=t[1],o=t[2],a=t[3],s=Ln(t,[e.rowIndex,e.colIndex,e.rowIndex,e.colIndex],!0),l={rowIndex:n,colIndex:i},h={rowIndex:t[0],colIndex:t[1]},d={rowIndex:t[2],colIndex:t[3]},p={rowIndex:o,colIndex:a},t=this.modifyRangeForMerge(e.rowIndex,e.colIndex,r.rowIndex,r.colIndex,t);return e.rowIndex<r.rowIndex?n-e.rowIndex>e.colIndex-a&&n-e.rowIndex>i-e.colIndex?s?{startCell:l,endCell:{rowIndex:e.rowIndex,colIndex:a}}:{startCell:p,endCell:{rowIndex:t.rowIndex,colIndex:i},fillRange:[t.rowIndex,i,n-1,a],direction:"Up"}:e.colIndex>r.colIndex?{startCell:l,endCell:{rowIndex:o,colIndex:e.colIndex},fillRange:[n,a+1,o,e.colIndex],direction:"Right"}:e.colIndex<r.colIndex?s?{startCell:l,endCell:p}:{startCell:p,endCell:{rowIndex:n,colIndex:e.colIndex},fillRange:[n,e.colIndex,o,i-1],direction:"Left"}:{startCell:h,endCell:d}:e.colIndex>r.colIndex?e.rowIndex-o>e.colIndex-a?{startCell:l,endCell:{rowIndex:e.rowIndex,colIndex:a},fillRange:[o+1,i,e.rowIndex,a],direction:"Down"}:{startCell:l,endCell:{rowIndex:o,colIndex:t.colIndex},fillRange:[n,a+1,o,t.colIndex],direction:"Right"}:e.colIndex<r.colIndex?e.rowIndex-o>a-e.colIndex||e.rowIndex-n>a-e.colIndex&&e.rowIndex!==o?{startCell:l,endCell:{rowIndex:e.rowIndex,colIndex:a},fillRange:[o+1,i,e.rowIndex,a],direction:"Down"}:s?{startCell:l,endCell:p}:{startCell:p,endCell:{rowIndex:n,colIndex:t.colIndex},fillRange:[n,t.colIndex,o,i-1],direction:"Left"}:e.rowIndex>r.rowIndex?{startCell:l,endCell:{rowIndex:t.rowIndex,colIndex:a},fillRange:[o+1,i,t.rowIndex,a],direction:"Down"}:(e.rowIndex===r.rowIndex&&(e.colIndex,r.colIndex),{startCell:h,endCell:d})},Jp.prototype.modifyRangeForMerge=function(e,t,r,n,i){var o,a,s,l={rowIndex:e,colIndex:t};return this.isMergedRange(i)&&(o=i[2]-i[0]+1,a=i[3]-i[1]+1,s=void 0,e<r?(s=(i[2]-e+1)%o)&&0<=e-(o-s)&&(l.rowIndex=e-(o-s)):n<t?(s=(t-i[1]+1)%a)&&(l.colIndex=t+(a-s)):t<n?(s=(i[3]-t+1)%a)&&0<=t-(a-s)&&(l.colIndex=t-(a-s)):r<e&&(s=(e-i[0]+1)%o)&&(l.rowIndex=e+(o-s))),l},Jp.prototype.performAutoFill=function(e){var t,r,n,i;!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}):(t=void 0,t=e.rangeInfo||(r={clientY:Cd(e.event),target:e.event.target},n={clientX:yd(e.event),target:e.event.target},this.parent.notify(us,r),this.parent.notify(fs,n),this.getAutoFillRange({rowIndex:r.clientY,colIndex:n.clientX})),r=this.parent.getActiveSheet(),t&&t.fillRange&&(n={dataRange:r.name+"!"+e.dAutoFillCell,fillRange:r.name+"!"+re(t.fillRange),direction:t.direction,fillType:e.fillType||this.parent.autoFillSettings.fillType,cancel:!1},Xd(this.parent,te(e.dAutoFillCell))||Xd(this.parent,t.fillRange)?this.parent.notify(qa,null):(this.parent.notify(gt,{eventArgs:n,action:"autofill"}),n.cancel||(i=jd(this.parent,t.fillRange),r.isProtected&&i?this.parent.notify(_a,null):e.rangeInfo?this.performAutoFillAction(n,null,i):(this.performAutoFillAction(n,t,i),this.positionAutoFillElement({isautofill:!0}))))))},Jp.prototype.refreshCell=function(e){this.parent.serviceLocator.getService("cell").refreshRange([e.rowIndex,e.colIndex,e.rowIndex,e.colIndex])},Jp.prototype.getDirection=function(e,t,r){if(r=ee.isNullOrUndefined(r)?this.isVerticalFill:r){if(t.rowIndex<e.rowIndex)return"Up";if(t.rowIndex>e.rowIndex)return"Down";if(t.colIndex>e.colIndex)return"Right";if(t.colIndex<e.colIndex)return"Left"}else{if(t.colIndex>e.colIndex)return"Right";if(t.colIndex<e.colIndex)return"Left";if(t.rowIndex<e.rowIndex)return"Up";if(t.rowIndex>e.rowIndex)return"Down"}return null},Jp.prototype.performAutoFillAction=function(e,t,r){var n,i=this,o=this.parent.getActiveSheet(),a=this.parent.serviceLocator.getService(T);this.isMergedRange(te(e.fillRange))?(n=this.parent.serviceLocator.getService(O)).show({isModal:!0,showCloseIcon:!0,height:180,width:400,content:a.getConstant("AutoFillMergeAlertMsg"),buttons:[{buttonModel:{content:this.parent.serviceLocator.getService(T).getConstant("Ok"),isPrimary:!0},click:function(){n.hide(),i.parent.selectRange(e.dataRange)}}],close:function(){n.hide(),i.parent.selectRange(e.dataRange)}},!1):(this.isVerticalFill="Down"===e.direction||"Up"===e.direction,this.parent.notify(tn,{dataRange:e.dataRange,fillRange:e.fillRange,direction:e.direction,fillType:e.fillType,isLockedCell:r}),a=t?re([t.startCell.rowIndex,t.startCell.colIndex,t.endCell.rowIndex,t.endCell.colIndex]):o.selectedRange,Ri(this.parent,a,o),r={dataRange:e.dataRange,fillRange:e.fillRange,fillType:e.fillType,direction:e.direction,selectedRange:a},this.parent.notify(le,{eventArgs:r,action:o.conditionalFormats&&0<o.conditionalFormats.length&&"autofillWithCF"===o.conditionalFormats[o.conditionalFormats.length-1].action?"autofillWithCF":"autofill"}),this.parent.trigger("select",{range:this.parent.getActiveSheet().selectedRange}),this.parent.showAggregate&&this.parent.notify(Ja,{}),this.parent.notify(qr,null))},Jp.prototype.getRangeData=function(e){for(var t,r=[],n=this.parent.getActiveSheet(),i=e.range[0],o=e.range[1],a=e.range[2],s=e.range[3],l=o;i<=a;){if(he(n,i));else for(o=l;o<=s;)pe(n,o)||(t=se(i,o,n),r.push(t)),o++;i++}return r},Jp.prototype.isMergedRange=function(e){for(var t=0,r=this.getRangeData({range:e,sheetIdx:this.parent.activeSheetIndex}),t=0;t<r.length;t++)if(r[t]&&(r[t].rowSpan||r[t].colSpan))return!0;return!1},Jp.prototype.addEventListener=function(){this.parent.on(to,this.createAutoFillElement,this),this.parent.on(js,this.positionAutoFillElement,this),this.parent.on(zs,this.hideAutoFillOptions,this),this.parent.on(Ws,this.hideAutoFillElement,this),this.parent.on(_s,this.performAutoFill,this),this.parent.on(qs,this.selectAutoFillRange,this),this.parent.on(rn,this.refreshCell,this),this.parent.on(on,this.getautofillDDB,this)},Jp.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(to,this.createAutoFillElement),this.parent.off(js,this.positionAutoFillElement),this.parent.off(zs,this.hideAutoFillOptions),this.parent.off(Ws,this.hideAutoFillElement),this.parent.off(_s,this.performAutoFill),this.parent.off(qs,this.selectAutoFillRange),this.parent.off(rn,this.refreshCell),this.parent.off(on,this.getautofillDDB))},Jp.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&&(Kh(this.splitBtnElem),this.splitBtnElem.remove()),this.splitBtnElem=null,this.parent=null},Jp.prototype.getModuleName=function(){return"autofill"};var Zp=Jp;function Jp(e){this.fillOptionIndex=0,this.parent=e,this.addEventListener()}ec.prototype.destroy=function(){if(this.removeEventListener(),!this.parent.isDestroyed&&!this.parent.refreshing)for(var e=this.parent.element.getElementsByClassName("e-addNoteIndicator");e.length;){var t=ee.closest(e[0],".e-cell");t&&(ee.EventHandler.remove(t,"mouseover",this.mouseOver),ee.EventHandler.remove(t,"mouseout",this.mouseOut)),ee.detach(e[0])}this.parent=null,this.isNoteVisible=null},ec.prototype.addEventListener=function(){this.parent.on(oa,this.addNote,this),this.parent.on(aa,this.editNote,this),this.parent.on(sa,this.deleteNote,this),this.parent.on(ha,this.createNoteIndicator,this),this.parent.on(la,this.showNote,this),this.parent.on(pa,this.removeNoteContainer,this),this.parent.on(da,this.updateNoteContainer,this)},ec.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(oa,this.addNote),this.parent.off(aa,this.editNote),this.parent.off(la,this.showNote),this.parent.off(sa,this.deleteNote),this.parent.off(ha,this.createNoteIndicator),this.parent.off(pa,this.removeNoteContainer),this.parent.off(da,this.updateNoteContainer))},ec.prototype.getModuleName=function(){return"spreadsheetNote"},ec.prototype.addNote=function(){var e=ee.isNullOrUndefined(this.noteCellIndexes)?W(this.parent.getActiveSheet().activeCell):this.noteCellIndexes,t=this.parent.getCell(e[0],e[1]);!ee.isNullOrUndefined(t)&&(0===t.children.length||0<t.children.length&&-1===t.children[t.childElementCount-1].className.indexOf("e-addNoteIndicator"))&&(this.createNoteIndicator({targetElement:t,rowIndex:e[0],columnIndex:e[1]}),this.createNoteContainer(t,e[0],e[1],!1,!0))},ec.prototype.deleteNote=function(e){var t=W(this.parent.getActiveSheet().activeCell),r=ee.isNullOrUndefined(e)||ee.isNullOrUndefined(e.rowIndex)?t[0]:e.rowIndex,t=ee.isNullOrUndefined(e)||ee.isNullOrUndefined(e.columnIndex)?t[1]:e.columnIndex,n=this.parent.getCell(r,t);0<n.children.length&&-1<n.children[n.children.length-1].className.indexOf("e-addNoteIndicator")&&(n.removeChild(n.children[n.children.length-1]),ee.EventHandler.remove(n,"mouseover",this.mouseOver),ee.EventHandler.remove(n,"mouseout",this.mouseOut),n=Di(this.parent,this.parent.activeSheetIndex)+"!"+this.parent.getActiveSheet().activeCell,r=se(r,t,this.parent.getActiveSheet()),!ee.isNullOrUndefined(e)&&e.isDeleteFromMenu&&this.parent.notify(ya,{args:{action:"beforeCellSave",eventArgs:{address:n}}}),!ee.isNullOrUndefined(r)&&r.notes&&delete r.notes,!ee.isNullOrUndefined(e))&&e.isDeleteFromMenu&&(t={notes:r.notes,address:n},this.parent.notify(le,{eventArgs:t,action:"deleteNote"}),this.isShowNote=null)},ec.prototype.editNote=function(){var e=ee.isNullOrUndefined(this.noteCellIndexes)?W(this.parent.getActiveSheet().activeCell):this.noteCellIndexes,t=(this.showNote({rowIndex:e[0],columnIndex:e[1],isNoteEditable:!0}),document.getElementsByClassName("e-addNoteContainer")[0]);_n(this.parent,this.parent.getActiveSheet(),{rowIdx:e[0],colIdx:e[1],preventEvt:!0,cell:{isNoteEditable:!0}}),t&&this.getNoteFocus(t)},ec.prototype.createNoteIndicator=function(e){var t=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(0<e.targetElement.children.length)for(var r=kh(this.parent.getActiveSheet(),e.rowIndex),n=0;n<e.targetElement.childElementCount;n++)-1<e.targetElement.children[n].className.indexOf("e-filter-btn")&&(t.style.right=(r<30?e.targetElement.children[n].getBoundingClientRect().width<=0?20:e.targetElement.children[n].getBoundingClientRect().width:2)+"px"),-1<e.targetElement.children[n].className.indexOf("e-validation-list")&&(t.style.right=(e.targetElement.children[n].getBoundingClientRect().width||20)+2+"px");(!ee.isNullOrUndefined(e.targetElement)&&0===e.targetElement.children.length||0<e.targetElement.children.length&&-1===e.targetElement.children[e.targetElement.childElementCount-1].className.indexOf("e-addNoteIndicator"))&&(e.skipEvent||(ee.EventHandler.add(e.targetElement,"mouseover",this.mouseOver,[this,e.rowIndex,e.columnIndex]),ee.EventHandler.add(e.targetElement,"mouseout",this.mouseOut,this)),e.targetElement.appendChild(t))},ec.prototype.mouseOver=function(){var e=this[0];(e.isNoteVisibleOnTouch&&!ee.isNullOrUndefined(document.getElementsByClassName("e-addNoteContainer")[0])||ee.isNullOrUndefined(document.getElementsByClassName("e-addNoteContainer")[0]))&&(ee.isNullOrUndefined(document.getElementsByClassName("e-addNoteContainer")[0])||e.removeNoteContainer(),e.showNote({rowIndex:this[1],columnIndex:this[2],isNoteEditable:!1}),e.isNoteVisible=!0)},ec.prototype.mouseOut=function(e){!this.isNoteVisible||this.isNoteVisibleOnTouch||ee.isNullOrUndefined(document.getElementsByClassName("e-addNoteContainer")[0])||-1!==document.activeElement.className.indexOf("e-addNoteContainer")||ee.isNullOrUndefined(e.relatedTarget)||-1!==e.relatedTarget.className.indexOf("e-connectorLine")||-1!==e.relatedTarget.className.indexOf("e-addNoteContainer")||(this.removeNoteContainer(),this.isNoteVisible=!1)},ec.prototype.createNoteContainer=function(e,t,r,n,i){t=se(t,r,this.parent.getActiveSheet()),r=e.getBoundingClientRect(),e=this.parent.createElement("textarea",{className:"e-addNoteContainer"});this.createContainer(e,t,r,n),this.createConnectorLine(e,r),i&&this.getNoteFocus(e),ee.EventHandler.add(e,"mouseout",this.mouseOut,this),ee.EventHandler.add(document.getElementsByClassName("e-connectorLine")[0],"mouseout",this.mouseOut,this)},ec.prototype.getNoteFocus=function(e){e.selectionStart=e.value.length,e.focus()},ec.prototype.createContainer=function(e,t,r,n){var i=5,o=(!ee.isNullOrUndefined(document.getElementsByClassName("e-select-all-cell")[0])&&!ee.isNullOrUndefined(document.getElementsByClassName("e-scroller")[0])&&r.top>=document.getElementsByClassName("e-select-all-cell")[0].getBoundingClientRect().bottom&&r.right>=document.getElementsByClassName("e-select-all-cell")[0].getBoundingClientRect().right&&r.bottom<=document.getElementsByClassName("e-scroller")[0].getBoundingClientRect().top&&r.right<=document.getElementsByClassName("e-scroller")[0].getBoundingClientRect().width?(e.style.display="block",i=r.top===document.getElementsByClassName("e-select-all-cell")[0].getBoundingClientRect().bottom?0:i):e.style.display="none",this.parent.element.getBoundingClientRect()),a=this.parent.element.style.getPropertyValue("position");e.style.position="absolute",e.style.top=r.top-(o.top-("absolute"===a?0:this.parent.element.offsetTop))-i+"px",e.style.left=r.left+r.width-(o.left-("absolute"===a?0:this.parent.element.offsetLeft))+10+"px",e.style.width="120px",e.style.height="120px",e.style.zIndex="5",e.style.color="black",e.style.backgroundColor="lightyellow",!n||ee.isNullOrUndefined(t)||ee.isNullOrUndefined(t.notes)?e.innerHTML="":e.innerHTML=t.notes,this.parent.element.appendChild(e)},ec.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(),o=this.parent.element.style.getPropertyValue("position");r.style.left=t.left+t.width-(i.left-("absolute"===o?0:this.parent.element.offsetLeft))+"px",r.style.top=e.getBoundingClientRect().top-(i.top-("absolute"===o?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.moveTo(0,30),n.lineTo(30,15),n.strokeStyle="black",n.lineWidth=5,n.stroke(),this.parent.element.appendChild(r),0<e.getBoundingClientRect().top?(r.style.display="block",r.style.zIndex="4"):r.style.display="none"},ec.prototype.showNote=function(e){var t=ee.isNullOrUndefined(this.parent.getCell(e.rowIndex,e.columnIndex))?e.cellElement:this.parent.getCell(e.rowIndex,e.columnIndex),r=document.getElementById(this.parent.element.id+"_contextmenu"),r=ee.isNullOrUndefined(r)?"none":r.style.getPropertyValue("display"),r=!!e.isNoteEditable||"block"!==r;!ee.isNullOrUndefined(t)&&ee.isNullOrUndefined(document.getElementsByClassName("e-addNoteContainer")[0])&&r&&(e.isScrollWithNote||null!==t.children&&0<t.children.length&&t.children[t.children.length-1].classList.contains("e-addNoteIndicator"))&&(this.createNoteContainer(t,e.rowIndex,e.columnIndex,!0,e.isNoteEditable),this.noteCellIndexes=[e.rowIndex,e.columnIndex])},ec.prototype.removeNoteContainer=function(){ee.EventHandler.remove(document.getElementsByClassName("e-addNoteContainer")[0],"mouseout",this.mouseOut),ee.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},ec.prototype.updateNoteContainer=function(){this.parent.selectionModule.isNoteActiveElement=-1<document.activeElement.className.indexOf("e-addNoteContainer")||this.parent.selectionModule.isNoteActiveElement;var e,t,r=ee.isNullOrUndefined(this.noteCellIndexes)?W(this.parent.getActiveSheet().activeCell):this.noteCellIndexes,n=se(r[0],r[1],this.parent.getActiveSheet()),i=document.getElementsByClassName("e-addNoteContainer")[0];(ee.isNullOrUndefined(n)||ee.isNullOrUndefined(n.notes)||n.notes!==i.value)&&this.parent.selectionModule.isNoteActiveElement&&(t=Di(this.parent,this.parent.activeSheetIndex)+"!"+re(r),this.parent.notify(ya,{args:{action:"beforeCellSave",eventArgs:{address:t}}}),e=!ee.isNullOrUndefined(n)&&n.notes?"editNote":"addNote",_n(this.parent,this.parent.getActiveSheet(),{rowIdx:r[0],colIdx:r[1],preventEvt:!0,cell:{notes:i.value,isNoteEditable:!0}}),i={notes:i.value,address:t},this.parent.notify(le,{eventArgs:i,action:e}),this.isShowNote=null),this.isShowNote=ee.isNullOrUndefined(this.isShowNote)?this.parent.selectionModule.isNoteActiveElement:this.isShowNote,this.isShowNote?(t=!ee.isNullOrUndefined(n)&&!ee.isNullOrUndefined(n.isNoteEditable)&&n.isNoteEditable,this.parent.notify(pa,""),this.parent.notify(la,{rowIndex:r[0],columnIndex:r[1],isNoteEditable:!0,isScrollWithNote:t})):(this.parent.notify(pa,""),this.isShowNote=null)};var Qp=ec;function ec(e){this.isNoteVisible=!1,this.isNoteVisibleOnTouch=!1,this.parent=e,this.addEventListener()}rc.prototype.show=function(e,t){var r=this,n=(t=!!ee.isNullOrUndefined(t),e.close||null),i={header:"Spreadsheet",cssClass:this.parent.cssClass,target:this.parent.element,buttons:[],allowDragging:!0},t=(e.close=function(){r.destroyDialog(),n&&n()},ee.extend(i,e),t&&(e=this.parent.serviceLocator.getService(T).getConstant(i.buttons.length?"Cancel":"Ok"),i.buttons.push({buttonModel:{content:e,isPrimary:0===i.buttons.length},click:this.hide.bind(this)})),this.parent.createElement("div"));document.body.appendChild(t),this.dialogInstance=new g.Dialog(i),this.dialogInstance.createElement=this.parent.createElement,this.dialogInstance.appendTo(t),this.dialogInstance&&this.dialogInstance.refreshPosition()},rc.prototype.destroyDialog=function(){this.dialogInstance.destroy(),ee.remove(this.dialogInstance.element),this.dialogInstance=null},rc.prototype.hide=function(e){this.dialogInstance&&(e&&(this.dialogInstance.animationSettings.effect="None",this.dialogInstance.dataBind()),this.dialogInstance.hide())},rc.prototype.destroy=function(){this.parent=null};var tc=rc;function rc(e){this.parent=e}ic.prototype.initializeActionBegin=function(){var t=this,r=this.parent.beforeCellFormat,n=(this.parent.beforeCellFormat=function(e){t.actionEventHandler({evtArgs:e,evtFunc:r,actionType:"begin",eventType:"format"})},this.parent.beforeOpen),i=(this.parent.beforeOpen=function(e){t.actionEventHandler({evtArgs:e,evtFunc:n,actionType:"begin",eventType:"beforeOpen"})},this.parent.beforeSave),o=(this.parent.beforeSave=function(e){t.actionEventHandler({evtArgs:e,evtFunc:i,actionType:"begin",eventType:"beforeSave"})},this.parent.beforeSort);this.parent.beforeSort=function(e){t.actionEventHandler({evtArgs:e,evtFunc:o,actionType:"begin",eventType:"beforeSort"})}},ic.prototype.initializeActionComplete=function(){var t=this,r=this.parent.sortComplete,n=(this.parent.sortComplete=function(e){t.actionEventHandler({evtArgs:e,evtFunc:r,actionType:"complete",eventType:"sorting"})},this.parent.cellSave);this.parent.cellSave=function(e){t.actionEventHandler({evtArgs:e,evtFunc:n,actionType:"complete",eventType:"cellSave"})}},ic.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})},ic.prototype.actionBeginHandler=function(e){var t=e.preventAction,r=(delete e.preventAction,{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)},ic.prototype.actionCompleteHandler=function(e){var t=e.preventAction;delete e.preventAction,this.parent.notify(ct,e),e.preventEventTrigger||this.parent.trigger("actionComplete",e),t||"undoRedo"===e.action||"gotoSheet"===e.action||this.parent.notify(va,{args:e}),this.parent.notify(js,null)},ic.prototype.addEventListener=function(){this.parent.on(le,this.actionCompleteHandler,this),this.parent.on(gt,this.actionBeginHandler,this),this.parent.on(no,this.removeEventListener,this)},ic.prototype.removeEventListener=function(){this.parent.off(le,this.actionCompleteHandler),this.parent.off(gt,this.actionBeginHandler),this.parent.off(no,this.removeEventListener)};var nc=ic;function ic(e){this.parent=e,this.addEventListener()}ac.prototype.insertOverlayElement=function(e,t,r){var n,i,e=this.parent.createElement("div",{id:e,attrs:{class:"e-ss-overlay"},styles:"width: "+this.minWidth+"; height: "+this.minHeight}),o=(this.parent.allowEditing&&((o=this.parent.element.getElementsByClassName("e-ss-overlay-active")[0])&&(ee.removeClass([o],"e-ss-overlay-active"),this.parent.notify(Rs,{})),e.classList.add("e-ss-overlay-active")),te(t)),t=this.parent.sheets[r],a=this.parent.frozenRowCount(t),s=this.parent.frozenColCount(t),l=nd(t,o,a,s,this.parent.viewport.beforeFreezeHeight,this.parent.viewport.beforeFreezeWidth,this.parent.sheetModule.colGroupWidth,!0);return o[0]>=a&&o[1]<s&&(n=this.parent.sheetModule.contentPanel).scrollTop&&(l.top-=n.scrollTop,l.top+=this.parent.getColumnHeaderContent().parentElement.getBoundingClientRect().height),o[1]>=s&&o[0]<a&&(n=this.parent.getScrollElement()).scrollLeft&&(l.left-=n.scrollLeft,l.left+=this.parent.sheetModule.getRowHeaderWidth(t)),o[0]<a||o[1]<s?(i=this.parent.element.querySelector("#"+this.parent.element.id+"_sheet"),a&&(o[0]>=a?l.top+=(t.showHeaders?31:0)+Ah(t,W(t.topLeftCell)[0],a-1):s||(l.left+=this.parent.sheetModule.getRowHeaderWidth(t,!0))),s&&(o[1]>=s?l.left+=this.parent.sheetModule.getRowHeaderWidth(t):a||(l.left+=t.showHeaders?31:0))):i=this.parent.getMainContent(),e.style.top=Number(Gd(l.top).toFixed(2))+"px",e.style.left=Number(Gd(l.left).toFixed(2))+"px",r===this.parent.activeSheetIndex?(i.appendChild(e),this.renderResizeHandler(e),this.addEventListener(e)):this.parent.isPrintingProcessing&&(e.style.visibility="hidden",document.body.append(e)),this.originalWidth=parseFloat(getComputedStyle(e,null).getPropertyValue("width").replace("px","")),this.originalHeight=parseFloat(getComputedStyle(e,null).getPropertyValue("height").replace("px","")),{element:e,top:l.top,left:l.left}},ac.prototype.adjustFreezePaneSize=function(e,t,r){var r=te(r),n=this.parent.getActiveSheet(),i=this.parent.frozenRowCount(n),o=this.parent.frozenColCount(n);r[0]<i||r[1]<o?(ee.isNullOrUndefined(e.top)||(t.style.top=e.top+(n.showHeaders?31:0)-this.parent.viewport.beforeFreezeHeight+"px"),ee.isNullOrUndefined(e.left)||(t.style.left=e.left+this.parent.sheetModule.getRowHeaderWidth(n,!0)-this.parent.viewport.beforeFreezeWidth+"px")):(ee.isNullOrUndefined(e.top)||(t.style.top=e.top-this.parent.viewport.beforeFreezeHeight-(i?Ah(n,W(n.topLeftCell)[0],i-1):0)+"px"),ee.isNullOrUndefined(e.left)||(t.style.left=e.left-this.parent.viewport.beforeFreezeWidth-(o?Uh(n,W(n.topLeftCell)[1],o-1):0)+"px")),ee.isNullOrUndefined(e.top)&&(t=W(n.topLeftCell)[0],e.top=this.parent.viewport.beforeFreezeHeight+(i&&t===r[0]?0:Ah(n,i?t:0,r[0]-1))),ee.isNullOrUndefined(e.left)&&(i=W(n.topLeftCell)[1],e.left=this.parent.viewport.beforeFreezeWidth+(o&&i===r[1]?0:Uh(n,o?i:0,r[1]-1)))},ac.prototype.addEventListener=function(e){ee.EventHandler.add(e,ld(),this.overlayClickHandler,this),ee.EventHandler.add(e,hd(),this.overlayMouseMoveHandler,this),ee.EventHandler.add(this.parent.element.querySelector("#"+this.parent.element.id+"_sheet"),hd(),this.overlayMouseMoveHandler,this),ee.EventHandler.add(document,dd(),this.overlayMouseUpHandler,this),this.parent.on(Hs,this.setOriginalSize,this)},ac.prototype.setOriginalSize=function(e){this.originalHeight=e.height,this.originalWidth=e.width},ac.prototype.overlayMouseMoveHandler=function(e){var t,r,n=e.target,i=document.getElementsByClassName("e-ss-overlay-active")[0],o=this.parent.getActiveSheet(),a=o.frozenRows||o.frozenColumns?[29,this.parent.sheetModule.getRowHeaderWidth(o,!0)]:[-1,-1];if(this.isOverlayClicked&&this.isResizerClicked)switch(cd(e)&&e.preventDefault(),this.resizer){case"e-ss-overlay-t":r=Math.max(this.originalMouseY-Cd(e)+this.originalHeight,20),t=Cd(e)-(this.originalMouseY-this.originalResizeTop),20<r&&a[0]<t&&(i.style.height=r+"px",i.style.top=t+"px",this.resizedReorderTop=t,this.currenHeight=r,this.parent.notify(Gr,{height:i.style.height,width:i.style.width,overlayEle:i}));break;case"e-ss-overlay-r":20<(t=this.originalWidth+(bd(e)-this.originalMouseX))&&(i.style.width=t+"px",this.currentWidth=t,this.parent.notify(Gr,{height:i.style.height,width:i.style.width,overlayEle:i}));break;case"e-ss-overlay-b":20<(r=this.originalHeight+(xd(e)-this.originalMouseY))&&(i.style.height=r+"px",this.currenHeight=r,this.parent.notify(Gr,{height:i.style.height,width:i.style.width,overlayEle:i}));break;case"e-ss-overlay-l":t=Math.max(this.originalMouseX-yd(e)+this.originalWidth,20),r=yd(e)-(this.originalMouseX-this.originalResizeLeft),20<t&&a[1]<r&&(i.style.width=t+"px",i.style.left=r+"px",this.resizedReorderLeft=r,this.currentWidth=t,this.parent.notify(Gr,{height:i.style.height,width:i.style.width,overlayEle:i}))}else this.isOverlayClicked&&(cd(e)&&e.preventDefault(),ee.closest(n,".e-sheet")&&!n.classList.contains("e-sheet-content")||n.classList.contains("e-cell")?i&&(o=yd(e)-this.diffX,n=Cd(e)-this.diffY,a[1]<o&&(i.style.left=o+"px"),a[0]<n&&(i.style.top=n+"px"),this.resizedReorderLeft=o<0?0:o,this.resizedReorderTop=n<0?0:n):this.overlayMouseUpHandler(e,!0))},ac.prototype.overlayMouseUpHandler=function(e,t){if(this.parent&&!this.parent.getActiveSheet().isProtected&&this.parent.allowEditing){this.isResizerClicked=!1;var r=e.target,n=document.getElementsByClassName("e-datavisualization-chart e-ss-overlay-active"),e=(r.classList.contains("e-ss-overlay")||(r=ee.closest(e.target,".e-datavisualization-chart")?ee.closest(e.target,".e-datavisualization-chart"):r),this.parent.getActiveSheet()),i={prevTop:e.frozenRows||e.frozenColumns?this.prevY:this.originalReorderTop,prevLeft:e.frozenRows||e.frozenColumns?this.prevX:this.originalReorderLeft,currentTop:0<=this.resizedReorderTop?parseInt(this.resizedReorderTop.toString(),10):this.originalReorderTop,currentLeft:0<=this.resizedReorderLeft?parseInt(this.resizedReorderLeft.toString(),10):this.originalReorderLeft,id:r.id,currentHeight:this.currenHeight,currentWidth:this.currentWidth,requestType:"imageRefresh",prevHeight:this.originalHeight,prevWidth:this.originalWidth};if(this.isOverlayClicked||t){var t=void 0,o=void 0,a={clientY:i.prevTop,isImage:!0},s={clientX:i.prevLeft,isImage:!0},l=this.parent.element.getElementsByClassName("e-ss-overlay-active")[0];if(e.frozenRows||e.frozenColumns){if(!l)return;s.isImage=a.isImage=!1,s.target=a.target=l,i.prevTop<this.parent.getColumnHeaderContent().getBoundingClientRect().bottom&&(a.target=this.parent.getColumnHeaderContent()),i.prevLeft<this.parent.getRowHeaderContent().getBoundingClientRect().right&&(s.target=this.parent.getRowHeaderTable());var h=l.getBoundingClientRect(),t={clientY:h.top},o={clientX:h.left};h.top<this.parent.getColumnHeaderContent().getBoundingClientRect().bottom&&(t.target=this.parent.getColumnHeaderContent()),h.left<this.parent.getRowHeaderContent().getBoundingClientRect().right&&(o.target=this.parent.getRowHeaderTable())}else t={clientY:i.currentTop,isImage:!0},o={clientX:i.currentLeft,isImage:!0};this.parent.notify(us,a),this.parent.notify(us,t),this.parent.notify(fs,s),this.parent.notify(fs,o),t.size&&(i.currentTop=t.size),o.size&&(i.currentLeft=o.size),i.prevRowIdx=a.clientY,i.prevColIdx=s.clientX,i.currentRowIdx=t.clientY,i.currentColIdx=o.clientX,!e.frozenColumns&&!e.frozenRows||ee.closest(l,".e-sheet-content")||(h=this.parent.frozenColCount(e),a=this.parent.frozenRowCount(e),i.currentRowIdx>=a&&i.currentColIdx>=h&&(s=parseInt(l.style.top,10),t=parseInt(l.style.left,10),s=(s+=this.parent.sheetModule.contentPanel.scrollTop)-this.parent.getColumnHeaderContent().parentElement.getBoundingClientRect().height,t=(t+=this.parent.getScrollElement().scrollLeft)-this.parent.sheetModule.getRowHeaderWidth(e),l.style.top=s+"px",l.style.left=t+"px",this.parent.getMainContent().appendChild(l))),n&&n[0]&&n[0].querySelector(".e-control")&&(i.id=n[0].id),this.originalReorderTop!==this.resizedReorderTop||this.originalReorderLeft!==this.resizedReorderLeft?(i.id=l.id,n&&n[0]?(i.requestType="chartRefresh",this.parent.notify(ys,i)):this.parent.notify(cs,i),this.resizedReorderTop=this.originalReorderTop,this.resizedReorderLeft=this.originalReorderLeft):this.currenHeight===this.originalHeight&&this.originalWidth===this.currentWidth||(i.id=(0<r.id.indexOf("overlay")?r:r.parentElement&&r.parentElement.classList.contains("e-ss-overlay")?r.parentElement:l).id,n&&n[0]?(i.requestType="chartRefresh",this.parent.notify(ys,i)):this.parent.notify(cs,i),this.originalHeight=this.currenHeight,this.originalWidth=this.currentWidth)}this.isOverlayClicked=!1}},ac.prototype.isOverlaySelected=function(e){e.isOverlayClicked=this.isOverlayClicked},ac.prototype.refreshOverlayElem=function(e){if(e){var t=".e-ss-overlay-active"+(e&&e.selector||""),e=this.parent.element.querySelector(t);e&&(ee.removeClass([e],"e-ss-overlay-active"),this.parent.notify(Rs,{}))}else for(var t="e-ss-overlay-active",r=Array.from(this.parent.element.getElementsByClassName(t)),n=0;n<r.length;n++){var i=r[n];i&&(ee.removeClass([i],"e-ss-overlay-active"),this.parent.notify(Rs,{}))}this.parent.notify(ws,null)},ac.prototype.overlayClickHandler=function(e){var t,r,n,i,o;!this.parent.getActiveSheet().isProtected&&this.parent.allowEditing&&(this.isOverlayClicked=!0,t=e.target,r=e.target,t.classList.contains("e-ss-overlay")||(r=t.parentElement,ee.closest(e.target,".e-datavisualization-chart")&&(r=ee.closest(e.target,".e-datavisualization-chart"))),((i=this.parent.getActiveSheet()).frozenColumns||i.frozenRows)&&ee.closest(r,".e-sheet-content")&&(o=parseInt(r.style.top,10),n=parseInt(r.style.left,10),o=(o-=this.parent.sheetModule.contentPanel.scrollTop)+this.parent.getColumnHeaderContent().parentElement.getBoundingClientRect().height,n=(n-=this.parent.getScrollElement().scrollLeft)+this.parent.sheetModule.getRowHeaderWidth(i),r.style.top=o+"px",r.style.left=n+"px",this.parent.element.querySelector("#"+this.parent.element.id+"_sheet").appendChild(r)),this.originalWidth=this.currentWidth=parseFloat(r.style.width),this.originalHeight=this.currenHeight=parseFloat(r.style.height),this.originalReorderLeft=parseFloat(r.style.left),this.originalReorderTop=parseFloat(r.style.top),this.resizedReorderLeft=parseFloat(r.style.left),this.resizedReorderTop=parseFloat(r.style.top),this.originalResizeTop=this.originalReorderTop,this.originalResizeLeft=this.originalReorderLeft,this.originalMouseX=yd(e),this.originalMouseY=Cd(e),this.diffX=this.originalMouseX-this.originalReorderLeft,this.diffY=this.originalMouseY-this.originalReorderTop,(i=document.getElementsByClassName("e-ss-overlay-active")[0])&&ee.removeClass([i],"e-ss-overlay-active"),this.parent.element.querySelector("#"+r.id).classList.add("e-ss-overlay-active"),t.classList.contains("e-ss-resizer")&&(this.resizer=t.classList[0],this.isResizerClicked=!0),r.classList.contains("e-datavisualization-chart")&&(this.parent.notify(Xr,{id:r.id}),i||this.parent.notify(Ns,{id:r.id})),o=r.getBoundingClientRect(),this.prevX=o.left,this.prevY=o.top)},ac.prototype.renderResizeHandler=function(e){for(var t,r=["e-ss-overlay-t","e-ss-overlay-r","e-ss-overlay-b","e-ss-overlay-l"],n=0;n<r.length;)t=this.parent.createElement("div",{className:r[n]+" e-ss-resizer"+(ee.Browser.isDevice?" e-ss-resizer-touch":""),styles:"width: 8px; height: 8px; border-radius: 4px;"}),e.appendChild(t),n++},ac.prototype.removeEventListener=function(){var e=this.parent.element.querySelectorAll(".e-ss-overlay");if(e.length)for(var t=0;t<e.length;t++)ee.EventHandler.remove(e[t],ld(),this.overlayClickHandler),ee.EventHandler.remove(e[t],hd(),this.overlayMouseMoveHandler);var r=this.parent.element.querySelector("#"+this.parent.element.id+"_sheet");r&&ee.EventHandler.remove(r,hd(),this.overlayMouseMoveHandler),document&&ee.EventHandler.remove(document,dd(),this.overlayMouseUpHandler),this.parent.isDestroyed||(this.parent.off(Hs,this.setOriginalSize),this.parent.off(Bs,this.isOverlaySelected),this.parent.off(ps,this.refreshOverlayElem),this.parent.off(no,this.destroy))},ac.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};var oc=ac;function ac(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(Bs,this.isOverlaySelected,this),this.parent.on(ps,this.refreshOverlayElem,this),this.parent.on(no,this.destroy,this)}sc=function(e,t){return(sc=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)};var sc,lc,wh=function(e,t){function r(){this.constructor=e}sc(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},hc=function(){return(hc=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}).apply(this,arguments)},dc=function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;0<=s;s--)(i=e[s])&&(a=(o<3?i(a):3<o?i(t,r,a):i(t,r))||a);return 3<o&&a&&Object.defineProperty(t,r,a),a},pc=(lc=ee.ChildProperty,wh(cc,lc),dc([ee.Property("")],cc.prototype,"text",void 0),dc([ee.Property("")],cc.prototype,"iconCss",void 0),dc([ee.Property("left")],cc.prototype,"iconPosition",void 0),cc);function cc(){return null!==lc&&lc.apply(this,arguments)||this}uc=ee.ChildProperty,wh(gc,uc),dc([ee.Complex({},pc)],gc.prototype,"header",void 0),dc([ee.Collection([],D.Item)],gc.prototype,"content",void 0),dc([ee.Property("")],gc.prototype,"cssClass",void 0),dc([ee.Property(!1)],gc.prototype,"disabled",void 0);var uc,fc=gc;function gc(){return null!==uc&&uc.apply(this,arguments)||this}mc=ee.Component,wh(yc,mc),yc.prototype.preRender=function(){},yc.prototype.render=function(){this.element.id||(this.element.id=ee.getUniqueID("ribbon")),this.renderRibbon()},yc.prototype.destroy=function(){var e=this.element.querySelector(".e-drop-icon");e&&e.removeEventListener("click",this.ribbonExpandCollapse.bind(this)),this.menuItems.length&&(e=document.getElementById(this.element.id+"_menu"))&&ee.getComponent(e,"menu").destroy(),this.toolbarObj&&this.toolbarObj.destroy(),this.tabObj&&this.tabObj.destroy(),this.element.innerHTML="",this.toolbarObj=null,this.tabObj=null,mc.prototype.destroy.call(this)},yc.prototype.getTabItems=function(){var t=this,r=[];return this.menuItems.length&&r.push({header:{text:this.initMenu(this.menuItems)},content:this.toolbarObj.element,cssClass:"e-menu-tab"}),this.items.forEach(function(e){r.push({header:e.header,content:t.toolbarObj.element})}),r},yc.prototype.initMenu=function(t){var r=this,e=this.createElement("ul",{id:this.element.id+"_menu"}),n=(this.element.appendChild(e),new D.Menu({cssClass:"e-file-menu",items:t,showItemOnClick:!0,beforeOpen:function(e){e.parentItem.text===t[0].text&&(n.showItemOnClick=!1),r.trigger("beforeOpen",e)},select:function(e){r.trigger("fileMenuItemSelect",e)},beforeClose:function(e){"mouseover"!==e.event.type||ee.closest(e.event.target,".e-menu-popup")?(r.trigger("beforeClose",e),e.parentItem&&e.parentItem.text!==t[0].text||n.setProperties({showItemOnClick:!0},!0)):e.cancel=!0},beforeItemRender:function(e){r.trigger("beforeFileMenuItemRender",e)},created:function(){n.element.removeAttribute("tabindex");var e=n.element.querySelector(".e-menu-item");e&&e.removeAttribute("tabindex")}}));return n.createElement=this.createElement,n.appendTo(e),e.parentElement},yc.prototype.renderRibbon=function(){var r,n=this,e=this.createElement("div"),t=this.createElement("div"),t=(this.toolbarObj=new D.Toolbar({items:this.items[this.selectedTab].content,clicked:function(e){return n.trigger("clicked",e)}}),this.toolbarObj.createElement=this.createElement,this.toolbarObj.appendTo(t),this.tabObj=new D.Tab({selectedItem:this.getIndex(this.selectedTab),animation:{next:{duration:0},previous:{duration:0}},items:this.getTabItems(),selecting:function(e){var t;e.isSwiped?e.cancel=!0:(r=e.event&&e.event.isShortcut,n.menuItems.length&&0===e.selectingIndex?(e.cancel=!0,e.event&&!r&&"keydown"!==e.event.type||!e.selectingItem||(t=e.selectingItem.querySelector(".e-file-menu .e-menu-item"))&&t.click()):e.selectingIndex!==n.getIndex(n.selectedTab)&&(n.updateToolbar(n.getIndex(e.selectingIndex,!0)),n.toolbarObj.dataBind(),n.refreshTemplateItems(n.toolbarObj),n.element.classList.contains("e-collapsed")&&ee.EventHandler.remove(e.selectedItem,"click",n.ribbonExpandCollapse),t=void 0,n.menuItems.length?(--(t=hc({},e)).selectingIndex,--t.selectedIndex):t=e,n.trigger("selecting",t)))},selected:function(e){e.isInteracted||r||(e.preventFocus=!0),e.selectedIndex!==n.getIndex(n.selectedTab)&&(n.setProperties({selectedTab:n.getIndex(e.selectedIndex,!0)},!0),n.element.classList.contains("e-collapsed"))&&(n.element.classList.remove("e-collapsed"),n.trigger("expandCollapse",{element:n.toolbarObj.element,expanded:!0}))},created:function(){n.toolbarObj.refreshOverflow()}}),this.element.appendChild(e),this.tabObj.createElement=this.createElement,this.tabObj.appendTo(e),this.createElement("span",{className:"e-drop-icon e-icons"}));t.addEventListener("click",this.ribbonExpandCollapse.bind(this)),this.element.appendChild(t)},yc.prototype.ribbonExpandCollapse=function(e){var t,r={element:this.toolbarObj.element,expanded:!0};this.element.classList.contains("e-collapsed")?(t=this.tabObj.element.querySelector(".e-tab-header").getElementsByClassName("e-toolbar-item")[this.tabObj.selectedItem],this.element.classList.remove("e-collapsed"),t.classList.add("e-active"),ee.EventHandler.remove(t,"click",this.ribbonExpandCollapse)):(t=this.tabObj.element.querySelector(".e-tab-header .e-toolbar-item.e-active"),this.element.classList.add("e-collapsed"),r.expanded=!1,t.classList.remove("e-active"),ee.EventHandler.add(t,"click",this.ribbonExpandCollapse,this)),this.trigger("expandCollapse",r)},yc.prototype.getIndex=function(e,t){return this.menuItems.length?t?e-1:e+1:e},yc.prototype.updateToolbar=function(e){this.toolbarObj.items=this.items[e].content,this.toolbarObj.dataBind()},yc.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())},yc.prototype.enableMenuItems=function(e,t,r){void 0===t&&(t=!0),this.menuItems.length&&ee.getComponent(document.getElementById(this.element.id+"_menu"),"menu").enableItems(e,t,r)},yc.prototype.hideMenuItems=function(e,t,r){var n;void 0===t&&(t=!0),this.menuItems.length&&(n=ee.getComponent(document.getElementById(this.element.id+"_menu"),"menu"),t?n.hideItems(e,r):n.showItems(e,r))},yc.prototype.addMenuItems=function(e,t,r,n){var i;void 0===r&&(r=!0),this.menuItems.length&&(i=ee.getComponent(document.getElementById(this.element.id+"_menu"),"menu"),r?i.insertAfter(e.reverse(),t,n):i.insertBefore(e,t,n))},yc.prototype.hideTabs=function(e,t){var r,n,i,o,a=this;if((t=void 0===t?!0:t)||(o=this.isAllHidden()),e.forEach(function(e){-1<(r=a.getTabIndex(e,-1))&&(t?a.items[r].cssClass.includes(" e-hide")||(a.items[r].cssClass=a.items[r].cssClass+" e-hide",a.tabObj.items[a.getIndex(r)].cssClass=a.items[r].cssClass,void 0===n&&r===a.selectedTab&&(n=!0),i=!0):a.items[r].cssClass.includes(" e-hide")&&(a.items[r].cssClass=a.items[r].cssClass.replace(" e-hide",""),a.tabObj.items[a.getIndex(r)].cssClass=a.items[r].cssClass,void 0===n&&r===a.selectedTab&&(n=!0),i=!0))}),this.setProperties({items:this.items},!0),this.tabObj.items=this.tabObj.items,this.tabObj.dataBind(),t&&(o=this.isAllHidden())&&(n=!1),!t&&o&&(n=!n),i&&o&&(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 s=0;s<this.items.length;s++)if(!this.items[s].cssClass.includes(" e-hide")){this.tabObj.selectedItem=this.getIndex(s),this.tabObj.dataBind();break}},yc.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},yc.prototype.enableTabs=function(e,t){var r=this;void 0===t&&(t=!0),e.forEach(function(e){e=r.getTabIndex(e,-1);-1<e&&(r.items[e].disabled=!t,e=r.getIndex(e),r.tabObj.enableTab(e,t))}),this.setProperties({items:this.items},!0)},yc.prototype.addTabs=function(e,t){var r=this,n=this.getTabIndex(t);e.forEach(function(e){e=new fc(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)},yc.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},yc.prototype.addToolbarItems=function(e,t,r){var n=this,i=this.getTabIndex(e);ee.isNullOrUndefined(r)&&(r=this.items[i].content.length),t.forEach(function(e){e=new D.Item(n.items[i].content[0],"content",e,!0),n.items[i].content.splice(r,0,e),r++}),this.setProperties({items:this.items},!0),i===this.selectedTab&&t.length&&this.updateToolbar(i)},yc.prototype.enableItems=function(e,t,r){if(void 0===r&&(r=!0),t){var n=this.getTabIndex(e,-1);if(!(n<0))for(var i=0;i<t.length;i++){if("string"==typeof t[i])for(var o=0;o<this.items[n].content.length;o++)if(this.items[n].content[o].id===t[i]){t[i]=o;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)},yc.prototype.hideToolbarItems=function(e,t,r){var n,i,o=this;void 0===r&&(r=!0);for(var a=0;a<this.items.length;a++)if(this.items[a].header.text===e){n=a,t.forEach(function(e){(i=o.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)},yc.prototype.getModuleName=function(){return"ribbon"},yc.prototype.getPersistData=function(){return this.addOnPersist([])},yc.prototype.onPropertyChanged=function(e,t){for(var r=0,n=Object.keys(e);r<n.length;r++)"selectedTab"===n[r]&&(this.tabObj.selectedItem=this.getIndex(e.selectedTab),this.tabObj.dataBind())},dc([ee.Property("")],yc.prototype,"cssClass",void 0),dc([ee.Property(!0)],yc.prototype,"menuType",void 0),dc([ee.Collection([],D.MenuItem)],yc.prototype,"menuItems",void 0),dc([ee.Property(0)],yc.prototype,"selectedTab",void 0),dc([ee.Collection([],fc)],yc.prototype,"items",void 0),dc([ee.Property(null)],yc.prototype,"spreadInstance",void 0),dc([ee.Event()],yc.prototype,"selecting",void 0),dc([ee.Event()],yc.prototype,"fileMenuItemSelect",void 0),dc([ee.Event()],yc.prototype,"beforeFileMenuItemRender",void 0),dc([ee.Event()],yc.prototype,"beforeOpen",void 0),dc([ee.Event()],yc.prototype,"beforeClose",void 0),dc([ee.Event()],yc.prototype,"selectFormat",void 0),dc([ee.Event()],yc.prototype,"clicked",void 0),dc([ee.Event()],yc.prototype,"created",void 0),dc([ee.Event()],yc.prototype,"expandCollapse",void 0);var mc,vc=dc([ee.NotifyPropertyChanges],yc);function yc(e,t){return mc.call(this,e)||this}bc.prototype.render=function(){function e(e){e.element.tabIndex=-1}var r=this,t=this.parent.element.id,n=this.parent.createElement("input",{attrs:{type:"color"}});this.fontColorPicker=new S.ColorPicker({value:"#000000ff",mode:"Palette",showButtons:!1,presetColors:qh,enableOpacity:!1,cssClass:"e-spreadsheet-color-popup",beforeTileRender:e,beforeClose:function(){return r.beforeCloseHandler(r.fontColorPicker)},open:this.openHandler.bind(this),beforeModeSwitch:function(e){return r.beforeModeSwitch(r.fontColorPicker,e)},change:function(e){var t={style:{color:r.fontColorPicker.getValue(e.currentValue.rgba)},onActionUpdate:!0};r.parent.notify(Et,t),t.cancel?r.fontColorPicker.setProperties({value:r.fontColorPicker.getValue(e.previousValue.rgba,"HEXA")},!0):r.updateSelectedColor(t.style.color,r.fontColorPicker.element,"TextColor")},created:function(){return r.updateSelectedColor("#000000",r.fontColorPicker.element,"TextColor",!0)}}),this.fontColorPicker.createElement=this.parent.createElement,this.parent.element.appendChild(n),this.fontColorPicker.appendTo(n),n.parentElement.id=t+"_font_color_picker",ee.addClass([n.nextElementSibling.getElementsByClassName("e-selected-color")[0]],["e-icons","e-font-color"]),n=this.parent.createElement("input",{attrs:{type:"color"}}),this.filColorPicker=new S.ColorPicker({value:"#ffff00ff",mode:"Palette",presetColors:Wh,showButtons:!1,enableOpacity:!1,cssClass:"e-spreadsheet-color-popup",open:this.openHandler.bind(this),beforeTileRender:e,beforeClose:function(){return r.beforeCloseHandler(r.filColorPicker)},beforeModeSwitch:function(e){return r.beforeModeSwitch(r.filColorPicker,e)},change:function(e){var t={style:{backgroundColor:r.filColorPicker.getValue(e.currentValue.rgba)},onActionUpdate:!0};r.parent.notify(Et,t),t.cancel?r.filColorPicker.setProperties({value:r.filColorPicker.getValue(e.previousValue.rgba,"HEXA")},!0):r.updateSelectedColor(t.style.backgroundColor,r.filColorPicker.element,"FillColor")},created:function(){return r.updateSelectedColor("#ffff00",r.filColorPicker.element,"FillColor",!0)}}),this.filColorPicker.createElement=this.parent.createElement,this.parent.element.appendChild(n),this.filColorPicker.appendTo(n),n.parentElement.id=t+"_fill_color_picker",ee.addClass([n.nextElementSibling.getElementsByClassName("e-selected-color")[0]],["e-icons","e-fill-color"])},bc.prototype.updateSelectedColor=function(e,t,r,n){r=this.parent.serviceLocator.getService(T).getConstant(r),n&&t.parentElement.querySelector(".e-dropdown-btn").setAttribute("aria-label",r),n=t.parentElement.querySelector(".e-split-colorpicker");n.setAttribute("aria-label",r+" "+e),n.firstElementChild.style.borderBottomColor=e},bc.prototype.openHandler=function(e){e.element.querySelector(".e-mode-switch-btn").title=this.parent.serviceLocator.getService(T).getConstant("MoreColors")},bc.prototype.beforeCloseHandler=function(e){e.modeSwitcher||e.setProperties({modeSwitcher:!0},!0),e.showButtons&&e.setProperties({showButtons:!1},!0),ce(e.element.parentElement.querySelector(".e-split-colorpicker"))},bc.prototype.beforeModeSwitch=function(e,t){var r=this.parent.serviceLocator.getService(T);"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"))},bc.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)},bc.prototype.addEventListener=function(){this.parent.on(Wo,this.render,this),this.parent.on("destroyRibbonComponents",this.destroy,this),this.parent.on(no,this.destroy,this)},bc.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(Wo,this.render),this.parent.off("destroyRibbonComponents",this.destroy),this.parent.off(no,this.destroy))};var Cc=bc;function bc(e){this.parent=e,this.addEventListener()}d.prototype.getModuleName=function(){return"ribbon"},d.prototype.ribbonOperation=function(e){e&&e.onPropertyChange?this.onPropertyChanged(e.prop):this.initialize()},d.prototype.initialize=function(e){this.parent.notify(Wo,{}),this.parent.isMobileView()?this.createMobileView():(e=e&&(this.parent.element.querySelector(".e-formula-bar-panel")||document.getElementById(this.parent.element.id+"_sheet_panel")),this.createRibbon(e))},d.prototype.getRibbonMenuItems=function(){var e=this.parent.serviceLocator.getService(T),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"}]}]},d.prototype.getRibbonItems=function(){var e=this,t=this.parent.element.id,r=this.parent.serviceLocator.getService(T),n=[{header:{text:r.getConstant("Home")},content:[{prefixIcon:"e-undo-icon",tooltipText:r.getConstant("Undo")+" (Ctrl+Z)",htmlAttributes:{"aria-label":r.getConstant("Undo")},id:t+"_undo",disabled:!0},{prefixIcon:"e-redo-icon",tooltipText:r.getConstant("Redo")+" (Ctrl+Y)",htmlAttributes:{"aria-label":r.getConstant("Redo")},id:t+"_redo",disabled:!0},{type:"Separator",id:t+"_separator_1"},{prefixIcon:"e-cut-icon",tooltipText:r.getConstant("Cut")+" (Ctrl+X)",htmlAttributes:{"aria-label":r.getConstant("Cut")},id:t+"_cut"},{prefixIcon:"e-copy-icon",tooltipText:r.getConstant("Copy")+" (Ctrl+C)",htmlAttributes:{"aria-label":r.getConstant("Copy")},id:t+"_copy"},{tooltipText:r.getConstant("Paste")+" (Ctrl+V)",template:this.getPasteBtn(t,r),id:t+"_paste",disabled:!0},{type:"Separator",id:t+"_separator_2"},{template:this.getNumFormatDDB(t,r),tooltipText:r.getConstant("NumberFormat"),id:t+"_number_format"},{type:"Separator",id:t+"_separator_3"},{template:this.getFontNameDDB(t),tooltipText:r.getConstant("Font"),id:t+"_font_name"},{type:"Separator",id:t+"_separator_4"},{template:this.getFontSizeDDB(t),tooltipText:r.getConstant("FontSize"),id:t+"_font_size"},{type:"Separator",id:t+"_separator_5"},{template:this.getBtn(t,"bold",r.getConstant("Bold")),tooltipText:r.getConstant("Bold")+" (Ctrl+B)",id:t+"_bold"},{template:this.getBtn(t,"italic",r.getConstant("Italic")),tooltipText:r.getConstant("Italic")+" (Ctrl+I)",id:t+"_italic"},{template:this.getBtn(t,"line-through",r.getConstant("Strikethrough")),tooltipText:r.getConstant("Strikethrough")+" (Ctrl+5)",id:t+"_line-through"},{template:this.getBtn(t,"underline",r.getConstant("Underline")),tooltipText:r.getConstant("Underline")+" (Ctrl+U)",id:t+"_underline"},{template:document.getElementById(t+"_font_color_picker"),tooltipText:r.getConstant("TextColor"),id:t+"_font_color_picker"},{type:"Separator",id:t+"_separator_6"},{template:document.getElementById(t+"_fill_color_picker"),tooltipText:r.getConstant("FillColor"),id:t+"_fill_color_picker"},{template:this.getBordersDBB(t),tooltipText:r.getConstant("Borders"),id:t+"_borders"},{template:this.getMergeSplitBtn(t),tooltipText:r.getConstant("MergeCells"),id:t+"_merge_cells",disabled:!0},{type:"Separator",id:t+"_separator_7"},{template:this.getTextAlignDDB(t),tooltipText:r.getConstant("HorizontalAlignment"),id:t+"_text_align"},{template:this.getVerticalAlignDDB(t),tooltipText:r.getConstant("VerticalAlignment"),id:t+"_vertical_align"},{template:this.getBtn(t,"wrap",r.getConstant("WrapText"),!1),tooltipText:""+r.getConstant("WrapText"),id:t+"_wrap"}]},{header:{text:r.getConstant("Insert")},content:[{prefixIcon:"e-hyperlink-icon",text:r.getConstant("Link"),id:t+"_hyperlink",tooltipText:r.getConstant("Link"),click:function(){e.getHyperlinkDlg()}},{prefixIcon:"e-image-icon",text:r.getConstant("Image"),id:t+"_image",tooltipText:r.getConstant("Image"),click:function(){ee.select("#"+t+"_imageUpload",e.parent.element).click()}}]},{header:{text:r.getConstant("Formulas")},content:[{prefixIcon:"e-insert-function",tooltipText:r.getConstant("InsertFunction"),text:r.getConstant("InsertFunction"),id:t+"_insert_function"},{type:"Separator",id:t+"_separator_14"},{template:this.createCalcOptions(t,r),tooltipText:r.getConstant("CalcOptionsTip"),id:t+"_calc_types"},{type:"Separator",id:t+"_separator_15"},{prefixIcon:"e-calculate-sheet",tooltipText:r.getConstant("CalcSheetTip"),text:r.getConstant("CalcActiveSheet"),id:t+"_calc_current_sheet",click:function(){e.parent.notify(ie,{action:"ClearDependentCellCollection"}),e.parent.calculateNow("Sheet")},disabled:"Automatic"===this.parent.calculationMode},{prefixIcon:"e-calculation",tooltipText:r.getConstant("CalcWorkbookTip"),text:r.getConstant("CalcWorkbook"),id:t+"_calc_entire_sheets",click:function(){e.parent.notify(ie,{action:"ClearDependentCellCollection"}),e.parent.calculateNow("Workbook")},disabled:"Automatic"===this.parent.calculationMode}]},{header:{text:r.getConstant("Data")},content:[{prefixIcon:"e-protect-icon",text:r.getConstant("ProtectSheet"),id:t+"_protect",tooltipText:r.getConstant("ProtectSheet")},{prefixIcon:"e-password-protect-icon",text:r.getConstant("ProtectWorkbook"),id:t+"_protectworkbook",tooltipText:r.getConstant("ProtectWorkbook")},{type:"Separator",id:t+"_separator_8"},{template:this.datavalidationDDB(t),tooltipText:r.getConstant("DataValidation"),id:t+"_datavalidation"}]},{header:{text:r.getConstant("View")},content:[{prefixIcon:"e-hide-headers",text:this.getLocaleText("Headers"),id:t+"_headers",tooltipText:this.getLocaleText("Headers")},{type:"Separator",id:t+"_separator_9"},{prefixIcon:"e-hide-gridlines",text:this.getLocaleText("GridLines"),id:t+"_gridlines",tooltipText:this.getLocaleText("GridLines")},{type:"Separator",id:t+"_separator_13"},{prefixIcon:"e-freeze-pane",text:r.getConstant("FreezePanes"),id:t+"_freezepanes",tooltipText:r.getConstant("FreezePanes"),disabled:!this.parent.allowFreezePane},{prefixIcon:"e-freeze-row",text:r.getConstant("FreezeRows"),id:t+"_freezerows",tooltipText:r.getConstant("FreezeRows"),disabled:!this.parent.allowFreezePane},{prefixIcon:"e-freeze-column",text:r.getConstant("FreezeColumns"),id:t+"_freezecolumns",tooltipText:r.getConstant("FreezeColumns"),disabled:!this.parent.allowFreezePane}]}];return this.parent.allowConditionalFormat&&n.find(function(e){return e.header&&e.header.text===r.getConstant("Home")}).content.push({type:"Separator",id:t+"_separator_10"},{template:this.getCFDBB(t),tooltipText:r.getConstant("ConditionalFormatting"),id:t+"_conditionalformatting"}),this.parent.allowChart&&n.find(function(e){return e.header&&e.header.text===r.getConstant("Insert")}).content.push({type:"Separator",id:t+"_separator_11"},{template:this.getChartDDB(t,!0),text:r.getConstant("Chart"),tooltipText:r.getConstant("Chart"),id:t+"_chart"}),this.parent.allowCellFormatting&&n.find(function(e){return e.header&&e.header.text===r.getConstant("Home")}).content.push({type:"Separator",id:t+"_separator_12"},{template:this.getClearDDB(t),tooltipText:r.getConstant("Clear"),id:t+"_clear"}),(this.parent.allowSorting||this.parent.allowFiltering)&&n.find(function(e){return e.header&&e.header.text===r.getConstant("Home")}).content.push({template:this.getSortFilterDDB(t),tooltipText:r.getConstant("SortAndFilter"),id:t+"_sorting"}),this.parent.allowFindAndReplace&&n.find(function(e){return e.header&&e.header.text===r.getConstant("Home")}).content.push({template:this.getFindBtn(t),prefixIcon:"e-tbar-search-icon tb-icons",tooltipText:r.getConstant("FindReplaceTooltip"),id:t+"_find"}),n},d.prototype.createCalcOptions=function(e,t){var r=ee.createElement("button",{id:e+"_calc_types",attrs:{type:"button"},className:"e-calc-types"}),n=ee.createElement("span",{className:"e-calc-types-text"});return n.innerText=t.getConstant("CalcOptions"),r.appendChild(n),this.calcTypeOptions=new m.DropDownButton({items:[{id:e+"_Automatic",text:t.getConstant("Automatic"),iconCss:"Automatic"===this.parent.calculationMode?"e-icons e-selected-icon":""},{id:e+"_Manual",text:t.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(r),r},d.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(ie,{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())},d.prototype.updateFormulaButtons=function(){var e=this.parent.serviceLocator.getService(T);this.parent.notify(Io,[{tab:e.getConstant("Formulas"),items:[this.parent.element.id+"_calc_current_sheet"],enable:"Manual"===this.parent.calculationMode}]),this.parent.notify(Io,[{tab:e.getConstant("Formulas"),items:[this.parent.element.id+"_calc_entire_sheets"],enable:"Manual"===this.parent.calculationMode}])},d.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 m.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(Oo,{type:e.item.id,isAction:!0,isInternal:!0})},click:function(){n.setAttribute("aria-label",t.getConstant("Paste")),r.parent.notify(Oo,{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},d.prototype.getHyperlinkDlg=function(){var e=this.parent.getActiveSheet(),t=te(e.activeCell),t=se(t[0],t[1],e);t&&t.hyperlink?this.parent.notify(na,null):this.parent.notify(ra,null)},d.prototype.passwordProtectDlg=function(){0<this.parent.password.length?this.parent.notify(Ts,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(As,null)},d.prototype.getLocaleText=function(e){var t=this.parent.serviceLocator.getService(T),t=this.parent.getActiveSheet()["show"+e]?t.getConstant("Hide"+e):t.getConstant("Show"+e);return t},d.prototype.getLocaleProtectText=function(e,t){var r=this.parent.serviceLocator.getService(T),t=this.parent.getActiveSheet().isProtected?(t&&this.parent.getMainContent().classList.remove("e-hide-"+e.toLowerCase()),r.getConstant("Unprotect"+e)):(t&&this.parent.getMainContent().classList.add("e-hide-"+e.toLowerCase()),r.getConstant("Protect"+e));return t},d.prototype.getLocaleProtectWorkbook=function(e,t){var r=this.parent.serviceLocator.getService(T),t=(this.parent.isProtected?t&&this.parent.getMainContent().classList.remove("e-hide-"+e.toLowerCase()):t&&this.parent.getMainContent().classList.add("e-hide-"+e.toLowerCase()),r.getConstant(e));return t},d.prototype.insertDesignChart=function(){var e=this,t=this.parent.serviceLocator.getService(T),r=this.ribbon.items.length-1,n=t.getConstant("ChartDesign");this.parent.allowChart&&this.ribbon.items[r]&&this.ribbon.items[r].header.text!==n&&(this.preTabIdx=this.ribbon.selectedTab,r=this.parent.element.id,n=[{header:{text:n},content:[{template:this.getAddChartEleDBB(r),tooltipText:t.getConstant("AddChartElement"),id:r+"add_chart_ element_chart"},{type:"Separator"},{prefixIcon:"e-switch-row-column-icon",text:t.getConstant("SwitchRowColumn"),tooltipText:t.getConstant("SwitchRowColumn"),id:r+"switch_row_column_chart",click:function(){e.parent.notify(Fs,{switchRowColumn:!0,triggerEvent:!0})}},{type:"Separator"},{template:this.getChartThemeDDB(r),tooltipText:t.getConstant("ChartTheme"),id:r+"_chart_theme"},{type:"Separator"},{template:this.getChartDDB(r,!1),tooltipText:t.getConstant("ChartType"),id:r+"_chart_type"}]}],this.addRibbonTabs({items:n}),this.ribbon.tabObj.select(this.ribbon.items.length))},d.prototype.removeDesignChart=function(){var e=this.parent.serviceLocator.getService(T),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),0<document.getElementsByClassName("e-addchart-ddb").length&&document.getElementsByClassName("e-addchart-ddb")[0].remove(),0<document.getElementsByClassName("e-chart-type-ddb").length&&document.getElementsByClassName("e-chart-type-ddb")[0].remove(),0<document.getElementsByClassName("e-charttheme-ddb").length&&document.getElementsByClassName("e-charttheme-ddb")[0].remove(),delete this.ribbon.items[t].content[0],this.ribbon.items.length=this.ribbon.items.length-1)},d.prototype.createRibbon=function(e){var t=this.parent.createElement("div",{id:this.parent.element.id+"_ribbon"});this.ribbon=new vc({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)},d.prototype.tabSelecting=function(e){if(e.selectingIndex!==this.ribbon.selectedTab){var t=this.parent.serviceLocator.getService(T);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;0<=r;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"))for(var n,i,r=(n=this.ribbon.items[e.selectedIndex].content).length-1;0<=r;r--)if(n[r].id===this.parent.element.id+"_chart"){(i=n[r].template)&&i.classList.contains("e-dropdown-btn")&&this.destroyComponent(i,"dropdown-btn");break}this.refreshRibbonContent(e.selectingIndex),this.parent.notify(Eo,{activeTab:e.selectingIndex})}},d.prototype.beforeRenderHandler=function(e){var t=this.parent.serviceLocator.getService(T);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")},d.prototype.getChartThemeDDB=function(e){var t,r=this,n=this.parent.serviceLocator.getService(T),e=this.parent.createElement("button",{id:e+"_chart_theme",attrs:{type:"button"},className:"e-ss-ddb"}),i=(e.appendChild(this.parent.createElement("span",{className:"e-tbar-btn-text"})),"Material"),o=this.parent.element.querySelector(".e-ss-overlay-active"),a=(o&&((t=o.querySelector(".e-chart"))?i=ee.getComponent(t,"chart").theme:(t=o.querySelector(".e-accumulationchart"))&&(i=ee.getComponent(t,"accumulationchart").theme)),new m.DropDownButton({items:this.getChartThemeDdbItems(i),content:n.getConstant(i),createPopupOnClick:!0,select:function(e){r.parent.notify(dn,{type:"mousedown"}),e.element&&e.element.querySelector(".e-selected-icon")||(a.content=e.item.text,a.dataBind(),r.parent.notify(Fs,{chartTheme:e.item.id,triggerEvent:!0}),a.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(T).getConstant("Chart"))}}));return a.createElement=this.parent.createElement,a.appendTo(e),e},d.prototype.getNumFormatDDB=function(e,t){var i=this,r=this.parent.createElement("button",{id:e+"_number_format",attrs:{type:"button"},className:"e-ss-ddb"}),n=this.parent.createElement("span",{className:"e-tbar-btn-text"}),t=(n.innerText=t.getConstant("General"),r.appendChild(n),{action:"getLocalizedFormats"}),o=(this.parent.notify(wn,t),t.defaultFormats),a=t.localizedFormats;return this.numFormatDDB=new m.DropDownButton({items:this.getNumFormatDdbItems(e),createPopupOnClick:!0,select:function(e){var t,r,n=i.parent.serviceLocator.getService(T);e.item.text===n.getConstant("Custom")?i.renderCustomFormatDialog(o,a):(t=Pl(e=e.item.id.split(i.parent.element.id+"_")[1]),i.applyNumFormat(t),r=i.parent.getActiveSheet(),i.refreshNumFormatSelection(Ml(t,!0),r,n,t),n=W(r.activeCell),i.refreshTextAlign(r,se(n[0],n[1],r,!1,!0),e,n),i.numFormatDDB.element.setAttribute("aria-label",e))},open:function(e){return i.numDDBOpen(e)},beforeItemRender:function(e){return i.previewNumFormat(e)},cssClass:"e-flat e-numformat-ddb",beforeOpen:function(e){i.tBarDdbBeforeOpen(e.element,e.items,i.parent.serviceLocator.getService(T).getConstant("NumberFormat"))}}),this.numFormatDDB.createElement=this.parent.createElement,this.numFormatDDB.appendTo(r),r},d.prototype.getFontSizeDDB=function(e){var r=this;return this.fontSizeDdb=new m.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){r.tBarDdbBeforeOpen(e.element,e.items,r.parent.serviceLocator.getService(T).getConstant("FontSize")),r.refreshSelected(r.fontSizeDdb,e.element,"content","text")},select:function(e){var t={style:{fontSize:e.item.text+"pt"},onActionUpdate:!0};r.parent.notify(Et,t),t.cancel||(r.fontSizeDdb.content=t.style.fontSize.split("pt")[0],r.fontSizeDdb.dataBind()),r.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},d.prototype.getChartDDB=function(e,t){var r,n,i=this.parent.serviceLocator.getService(T);return 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)),r},d.prototype.closeDropdownPopup=function(e){(e.altKey&&38===e.keyCode||27===e.keyCode)&&(e=this[1])&&(e.toggle(),ce(e.element))},d.prototype.createChartDdb=function(e,t){var r,n=this,i=this.parent.serviceLocator.getService(T),o=t?"e-chart-menu":"e-chart-type-menu",a=this.parent.createElement("ul",{id:this.parent.element.id+(t?"_chart_menu":"_chart_type_menu")}),s=new m.DropDownButton({iconCss:"e-icons "+(t?"e-chart-icon":"e-chart-type-icon"),cssClass:t?"e-chart-ddb":"e-chart-type-ddb",target:a,createPopupOnClick:!0,beforeOpen:function(e){r=n.createChartMenu(a,o,i,s),n.tBarDdbBeforeOpen(e.element,r.items,n.parent.serviceLocator.getService(T).getConstant("Chart")),ee.EventHandler.add(a,"keydown",n.closeDropdownPopup,[n,s])},open:function(){return ce(a)},beforeClose:function(e){e.event&&ee.closest(e.event.target,"."+o)?e.cancel=!0:(ee.EventHandler.remove(a,"keydown",n.closeDropdownPopup),r.destroy())}});s.createElement=this.parent.createElement,s.appendTo(e)},d.prototype.createChartMenu=function(e,t,r,n){var i=this,t=new D.Menu({cssClass:t,items:[{iconCss:"e-icons e-column",text:r.getConstant("Column"),items:[{id:"column_chart"}]},{iconCss:"e-icons e-bar",text:r.getConstant("Bar"),items:[{id:"bar_chart"}]},{iconCss:"e-icons e-area",text:r.getConstant("Area"),items:[{id:"area_chart"}]},{iconCss:"e-icons e-pie-doughnut",text:r.getConstant("PieAndDoughnut"),items:[{id:"pie_doughnut_chart"}]},{iconCss:"e-icons e-line",text:r.getConstant("Line"),items:[{id:"line_chart"}]},{iconCss:"e-icons e-scatter",text:r.getConstant("Scatter"),items:[{id:"scatter_chart"}]}],orientation:"Vertical",beforeOpen:function(e){var t;e.parentItem.text===r.getConstant("Column")?(e.element.firstChild.appendChild(o),t="e-column-chart"):e.parentItem.text===r.getConstant("Bar")?(e.element.firstChild.appendChild(g),t="e-bar-chart"):e.parentItem.text===r.getConstant("Area")?(e.element.firstChild.appendChild(m),t="e-area-chart"):e.parentItem.text===r.getConstant("Line")?(e.element.firstChild.appendChild(v),t="e-line-chart"):e.parentItem.text===r.getConstant("PieAndDoughnut")?(e.element.firstChild.appendChild(y),t="e-pie-doughnut-chart"):e.parentItem.text===r.getConstant("Radar")?(e.element.firstChild.appendChild(C),t="e-radar-chart"):e.parentItem.text===r.getConstant("Scatter")&&(e.element.firstChild.appendChild(b),t="e-scatter-chart"),t&&(e.element.parentElement.classList.add(t),ee.EventHandler.add(e.element,"keydown",i.menuIconKeyDown.bind(i,t+" .e-menu-icon",0)))},select:function(e){return i.chartSelected(e,n)},beforeItemRender:function(e){e.item.text||e.element.removeAttribute("tabindex")},beforeClose:function(e){e.event&&37===e.event.keyCode?e.cancel=!0:ee.EventHandler.remove(e.element,"keydown",i.menuIconKeyDown)}}),o=this.parent.createElement("div",{id:"column_main",className:"e-column-main"}),a=this.parent.createElement("div",{id:"column1_text",className:"e-column1-text"}),s=(a.innerText=r.getConstant("Column"),this.parent.createElement("div",{id:"column1_cont",className:"e-column1-cont"})),l=this.parent.createElement("div",{id:"column2_cont",className:"e-column2-cont"}),a=(o.appendChild(a),o.appendChild(s),r.getConstant("ClusteredColumn")),h=this.parent.createElement("span",{id:"clusteredColumn",className:"e-clusteredcolumn e-column-icon e-menu-icon e-icons",attrs:{title:a,"aria-label":a,tabindex:"-1"}}),a=r.getConstant("StackedColumn"),d=this.parent.createElement("span",{id:"stackedColumn",className:"e-stackedcolumn e-column-icon e-menu-icon e-icons",attrs:{title:a,"aria-label":a,tabindex:"-1"}}),p=(a=r.getConstant("StackedColumn100"),this.parent.createElement("span",{id:"stackedColumn100",className:"e-stackedcolumn100 e-column-icon e-menu-icon e-icons",attrs:{title:a,"aria-label":a,tabindex:"-1"}})),c=this.parent.createElement("span",{id:"clusteredColumn3D",className:"e-clusteredColumn3D e-column-icon"}),u=this.parent.createElement("span",{id:"stackedColumn3D",className:"e-stackedColumn3D e-column-icon"}),f=this.parent.createElement("span",{id:"stackedColumn1003D",className:"e-stackedColumn1003D e-column-icon"}),g=(s.appendChild(h),s.appendChild(d),s.appendChild(p),l.appendChild(c),l.appendChild(u),l.appendChild(f),this.parent.createElement("div",{id:"bar_main",className:"e-bar-main"})),h=this.parent.createElement("div",{id:"bar1_text",className:"e-bar1-text"}),d=(h.innerText=r.getConstant("Bar"),this.parent.createElement("div",{id:"bar1_cont",className:"e-bar1-cont"})),s=this.parent.createElement("div",{id:"bar2_cont",className:"e-bar2-cont"}),p=(g.appendChild(h),g.appendChild(d),a=r.getConstant("ClusteredBar"),this.parent.createElement("span",{id:"clusteredBar",className:"e-clusteredbar e-bar-icon e-menu-icon e-icons",attrs:{title:a,"aria-label":a,tabindex:"-1"}})),c=(a=r.getConstant("StackedBar"),this.parent.createElement("span",{id:"stackedBar",className:"e-stackedbar e-bar-icon e-menu-icon e-icons",attrs:{title:a,"aria-label":a,tabindex:"-1"}})),u=(a=r.getConstant("StackedBar100"),this.parent.createElement("span",{id:"stackedBar100",className:"e-stackedbar100 e-bar-icon e-menu-icon e-icons",attrs:{title:a,"aria-label":a,tabindex:"-1"}})),l=this.parent.createElement("span",{id:"clusteredBar3D",className:"e-clusteredBar3D e-bar-icon"}),f=this.parent.createElement("span",{id:"stackedBar3D",className:"e-stackedBar3D e-bar-icon"}),h=this.parent.createElement("span",{id:"stackedBar1003D",className:"e-stackedBar1003D e-bar-icon"}),m=(d.appendChild(p),d.appendChild(c),d.appendChild(u),s.appendChild(l),s.appendChild(f),s.appendChild(h),this.parent.createElement("div",{id:"area_main",className:"e-area-main"})),p=this.parent.createElement("div",{id:"area_text",className:"e-area-text"}),c=(p.innerText=r.getConstant("Area"),this.parent.createElement("div",{id:"area_cont",className:"e-area-cont"})),d=(m.appendChild(p),m.appendChild(c),a=r.getConstant("Area"),this.parent.createElement("span",{id:"area",className:"e-area e-area-icon e-menu-icon e-icons",attrs:{title:a,"aria-label":a,tabindex:"-1"}})),u=(a=r.getConstant("StackedArea"),this.parent.createElement("span",{id:"stackedArea",className:"e-stackedarea e-area-icon e-menu-icon e-icons",attrs:{title:a,"aria-label":a,tabindex:"-1"}})),l=(a=r.getConstant("StackedArea100"),this.parent.createElement("span",{id:"stackedArea100",className:"e-stackedarea100 e-area-icon e-menu-icon e-icons",attrs:{title:a,"aria-label":a,tabindex:"-1"}})),v=(c.appendChild(d),c.appendChild(u),c.appendChild(l),this.parent.createElement("div",{id:"line_main",className:"e-line-main"})),f=this.parent.createElement("div",{id:"line_text",className:"e-line-text"}),s=(f.innerText=r.getConstant("Line"),this.parent.createElement("div",{id:"line_cont",className:"e-line-cont"})),h=this.parent.createElement("div",{id:"line_cont_marker",className:"e-line-cont"}),p=(v.appendChild(f),v.appendChild(s),v.appendChild(h),a=r.getConstant("Line"),this.parent.createElement("span",{id:"line",className:"e-line e-line-icon e-menu-icon e-icons",attrs:{title:a,"aria-label":a,tabindex:"-1"}})),d=(a=r.getConstant("StackedLine"),this.parent.createElement("span",{id:"stackedLine",className:"e-stackedline e-line-icon e-menu-icon e-icons",attrs:{title:a,"aria-label":a,tabindex:"-1"}})),u=(a=r.getConstant("StackedLine100"),this.parent.createElement("span",{id:"stackedLine100",className:"e-stackedline100 e-line-icon e-menu-icon e-icons",attrs:{title:a,"aria-label":a,tabindex:"-1"}})),c=(a=r.getConstant("LineMarker"),this.parent.createElement("span",{id:"lineMarker",className:"e-line-marker e-line-icon e-menu-icon e-icons",attrs:{title:a,"aria-label":a,tabindex:"-1"}})),l=(a=r.getConstant("StackedLineMarker"),this.parent.createElement("span",{id:"stackedLineMarker",className:"e-stackedline-marker e-line-icon e-menu-icon e-icons",attrs:{title:a,"aria-label":a,tabindex:"-1"}})),f=(a=r.getConstant("StackedLine100Marker"),this.parent.createElement("span",{id:"stackedLine100Marker",className:"e-stackedline100-marker e-line-icon e-menu-icon e-icons",attrs:{title:a,"aria-label":a,tabindex:"-1"}})),y=(s.appendChild(p),s.appendChild(d),s.appendChild(u),h.appendChild(c),h.appendChild(l),h.appendChild(f),this.parent.createElement("div",{id:"pie_main",className:"e-pie-main"})),p=this.parent.createElement("div",{id:"pie_text",className:"e-pie-text"}),d=(p.innerText=r.getConstant("Pie"),this.parent.createElement("div",{id:"pie_cont",className:"e-pie-cont"})),s=(y.appendChild(p),y.appendChild(d),a=r.getConstant("Pie"),this.parent.createElement("span",{id:"pie",className:"e-pie e-pie-icon e-menu-icon e-icons",attrs:{title:a,"aria-label":a,tabindex:"-1"}})),u=(a=r.getConstant("Doughnut"),this.parent.createElement("span",{id:"doughnut",className:"e-doughnut e-pie-icon e-menu-icon e-icons",attrs:{title:a,"aria-label":a,tabindex:"-1"}})),C=(d.appendChild(s),d.appendChild(u),this.parent.createElement("div",{id:"radar_main",className:"e-radar-main"})),c=this.parent.createElement("div",{id:"radar_text",className:"e-radar-text"}),l=(c.innerText=r.getConstant("Radar"),this.parent.createElement("div",{id:"radar_cont",className:"e-radar-cont"})),h=(C.appendChild(c),C.appendChild(l),this.parent.createElement("span",{id:"radar",className:"e-radar e-radar-icon e-menu-icon e-icons",attrs:{tabindex:"-1"}})),f=this.parent.createElement("span",{id:"radar_markers",className:"e-radar-markers e-radar-icon e-menu-icon e-icons",attrs:{tabindex:"-1"}}),b=(h.title=r.getConstant("BlueDataBar"),f.title=r.getConstant("GreenDataBar"),l.appendChild(h),l.appendChild(f),this.parent.createElement("div",{id:"scatter_main",className:"e-scatter-main"})),p=this.parent.createElement("div",{id:"scatter_text",className:"e-scatter-text"}),s=(a=r.getConstant("Scatter"),p.innerText=a,this.parent.createElement("div",{id:"scatter_cont",className:"e-scatter-cont"})),d=(b.appendChild(p),b.appendChild(s),this.parent.createElement("span",{id:"scatter",className:"e-scatter e-scatter-icon e-menu-icon e-icons",attrs:{title:a,"aria-label":a,tabindex:"-1"}}));return s.appendChild(d),t.createElement=this.parent.createElement,t.appendTo(e),e.classList.add("e-ul"),t},d.prototype.getAddChartEleDBB=function(e){var t,r=this,n=this.parent.serviceLocator.getService(T),i=this.parent.createElement("ul",{id:e+"_add_chart_menu"}),o=(this.addChartDdb=new m.DropDownButton({iconCss:"e-icons e-addchart-icon",cssClass:"e-addchart-ddb",target:i,createPopupOnClick:!0,close:function(){return ce(r.parent.element)},beforeOpen:function(e){t=r.createAddChartMenu(i,n),r.tBarDdbBeforeOpen(e.element,t.items),ee.EventHandler.add(i,"keydown",r.closeDropdownPopup,[r,r.addChartDdb])},open:function(){return ce(i)},beforeClose:function(e){e.event&&ee.closest(e.event.target,".e-addchart-menu")?e.cancel=!0:(ee.EventHandler.remove(i,"keydown",r.closeDropdownPopup),t.destroy())}}),this.addChartDdb.createElement=this.parent.createElement,this.parent.createElement("button",{id:e+"_addchart",attrs:{type:"button"}})),e=this.parent.createElement("span",{id:e+"_chart"});return e.innerText=n.getConstant("AddChartElement"),o.appendChild(e),this.addChartDdb.appendTo(o),this.addChartDdb.element},d.prototype.createAddChartMenu=function(e,n){var r=this,t=new D.Menu({cssClass:"e-addchart-menu",title:n.getConstant("AddChartElement"),items:[{iconCss:"e-icons e-axes",text:n.getConstant("Axes"),items:[{iconCss:"e-icons e-ph-axes",id:"PHAxes",text:n.getConstant("PrimaryHorizontal")},{iconCss:"e-icons e-pv-axes",id:"PVAxes",text:n.getConstant("PrimaryVertical")}]},{iconCss:"e-icons e-axis-title",text:n.getConstant("AxisTitle"),items:[{iconCss:"e-icons e-ph-axistitle",id:"PHAxisTitle",text:n.getConstant("PrimaryHorizontal")},{iconCss:"e-icons e-pv-axistitle",id:"PVAxisTitle",text:n.getConstant("PrimaryVertical")}]},{iconCss:"e-icons e-chart-title",text:n.getConstant("ChartTitle"),items:[{iconCss:"e-icons e-ct-none",id:"ChartTitleNone",text:n.getConstant("None")},{iconCss:"e-icons e-ct-abovechart",id:"ChartTitleAbove",text:n.getConstant("AboveChart")}]},{iconCss:"e-icons e-data-labels",id:this.parent.element.id+"data-labels",text:n.getConstant("DataLabels"),items:[{iconCss:"e-icons e-dl-none",id:"DLNone",text:n.getConstant("None")},{iconCss:"e-icons e-dl-center",id:"DLCenter",text:n.getConstant("Center")},{iconCss:"e-icons e-dl-insideend",id:"DLInsideend",text:n.getConstant("InsideEnd")},{iconCss:"e-icons e-dl-insidebase",id:"DLInsidebase",text:n.getConstant("InsideBase")},{iconCss:"e-icons e-dl-outsideend",id:"DLOutsideend",text:n.getConstant("OutsideEnd")}]},{iconCss:"e-icons e-gridlines",text:n.getConstant("Gridlines"),items:[{iconCss:"e-icons e-gl-major-horizontal",id:"GLMajorHorizontal",text:n.getConstant("PrimaryMajorHorizontal")},{iconCss:"e-icons e-gl-major-vertical",id:"GLMajorVertical",text:n.getConstant("PrimaryMajorVertical")},{iconCss:"e-icons e-gl-minor-horizontal",id:"GLMinorHorizontal",text:n.getConstant("PrimaryMinorHorizontal")},{iconCss:"e-icons e-gl-minor-vertical",id:"GLMinorVertical",text:n.getConstant("PrimaryMinorVertical")}]},{iconCss:"e-icons e-legends",text:n.getConstant("Legends"),items:[{iconCss:"e-icons e-legends-none",id:"LegendNone",text:n.getConstant("None")},{iconCss:"e-icons e-legends-right",id:"LegendsRight",text:n.getConstant("Right")},{iconCss:"e-icons e-legends-left",id:"LegendsLeft",text:n.getConstant("Left")},{iconCss:"e-icons e-legends-bottom",id:"LegendsBottom",text:n.getConstant("Bottom")},{iconCss:"e-icons e-legends-top",id:"LegendsTop",text:n.getConstant("Top")}]}],orientation:"Vertical",select:this.addChartEleSelected.bind(this),beforeOpen:function(e){var t;e.parentItem.id===r.parent.element.id+"data-labels"&&(t=r.parent.element.querySelector(".e-ss-overlay-active"))&&(t=t.querySelector(".e-chart"))&&ee.getComponent(t,"chart").series[0].type.includes("Line")&&((t=function(e,t){var r;e&&((r=e.parentElement).innerHTML="",r.appendChild(e),r.appendChild(document.createTextNode(n.getConstant(t))))})(e.element.querySelector(".e-dl-insideend"),"Above"),t(e.element.querySelector(".e-dl-insidebase"),"Below"),t=e.element.querySelector(".e-dl-outsideend"))&&(t.parentElement.style.display="none")}});return t.createElement=this.parent.createElement,t.appendTo(e),e.classList.add("e-ul"),t},d.prototype.getCFDBB=function(e){var t,r=this,n=this.parent.createElement("ul",{id:e+"_cf_menu"});return this.cfDdb=new m.DropDownButton({iconCss:"e-icons e-conditionalformatting-icon",cssClass:"e-cf-ddb",target:n,createPopupOnClick:!0,close:function(){return ce(r.parent.element)},beforeOpen:function(e){t=r.createCFMenu(n),r.tBarDdbBeforeOpen(e.element,t.items,r.parent.serviceLocator.getService(T).getConstant("ConditionalFormatting")),ee.EventHandler.add(n,"keydown",r.closeDropdownPopup,[r,r.cfDdb])},open:function(){return ce(n)},beforeClose:function(e){e.event&&ee.closest(e.event.target,".e-cf-menu")?e.cancel=!0:(ee.EventHandler.remove(n,"keydown",r.closeDropdownPopup),t&&t.element&&(Kd(r.spanElements),r.spanElements=[],Kd(r.iconWrapElements),r.iconWrapElements=[],Kd(r.iconSetElements),r.iconSetElements=[],Kd(r.iconSetGroupElement),r.iconSetGroupElement=[],t.destroy(),t.element.remove()))}}),this.cfDdb.createElement=this.parent.createElement,this.cfDdb.appendTo(this.parent.createElement("button",{id:e+"_conditionalformatting",attrs:{type:"button"}})),this.cfDdb.element},d.prototype.createCFMenu=function(e){function t(e,t,r){var n;e.forEach(function(e){n=l.getConstant(e+t);e=s.parent.createElement("span",{id:e+t,className:"e-"+e.toLowerCase()+" e-cf-icon",attrs:{title:n,"aria-label":n,tabindex:"-1"}});s.spanElements.push(e),r.appendChild(e)})}var s=this,l=this.parent.serviceLocator.getService(T),r=new D.Menu({cssClass:"e-cf-menu",items:[{iconCss:"e-icons e-hlcellrules",text:l.getConstant("HighlightCellsRules"),items:[{iconCss:"e-icons e-greaterthan",id:"cf_greaterthan_dlg",text:l.getConstant("GreaterThan")+"..."},{iconCss:"e-icons e-lessthan",id:"cf_lessthan_dlg",text:l.getConstant("LessThan")+"..."},{iconCss:"e-icons e-between",id:"cf_between_dlg",text:l.getConstant("Between")+"..."},{iconCss:"e-icons e-equalto",id:"cf_eqaulto_dlg",text:l.getConstant("CFEqualTo")+"..."},{iconCss:"e-icons e-textcontains",id:"cf_textcontains_dlg",text:l.getConstant("TextThatContains")+"..."},{iconCss:"e-icons e-adateoccuring",id:"cf_adateoccuring_dlg",text:l.getConstant("ADateOccuring")+"..."},{iconCss:"e-icons e-duplicate",id:"cf_duplicatevalues_dlg",text:l.getConstant("DuplicateValues")+"..."}]},{iconCss:"e-icons e-topbottomrules",text:l.getConstant("TopBottomRules"),items:[{iconCss:"e-icons e-top10items",id:"cf_top10items_dlg",text:l.getConstant("Top10Items")+"..."},{iconCss:"e-icons e-top10",id:"cf_top10_dlg",text:l.getConstant("Top10")+" %..."},{iconCss:"e-icons e-bottom10items",id:"cf_bottom10items_dlg",text:l.getConstant("Bottom10Items")+"..."},{iconCss:"e-icons e-bottom10",id:"cf_bottom10_dlg",text:l.getConstant("Bottom10")+" %..."},{iconCss:"e-icons e-aboveaverage",id:"cf_aboveaverage_dlg",text:l.getConstant("AboveAverage")+"..."},{iconCss:"e-icons e-belowaverage",id:"cf_belowaverage_dlg",text:l.getConstant("BelowAverage")+"..."}]},{iconCss:"e-icons e-databars",text:l.getConstant("DataBars"),items:[{id:"db_icons1"},{id:"db_icons2"}]},{iconCss:"e-icons e-colorscales",text:l.getConstant("ColorScales"),items:[{id:"cs_icons1"},{id:"cs_icons2"},{id:"cs_icons3"}]},{iconCss:"e-icons e-iconsets",text:l.getConstant("IconSets"),items:[{id:"is_icons"}]},{iconCss:"e-icons e-clearrules",text:l.getConstant("ClearRules"),items:[{id:"cf_cr_cells",text:l.getConstant("SelectedCells")},{id:"cf_cr_sheet",text:l.getConstant("EntireSheet")}]}],orientation:"Vertical",beforeOpen:function(e){var r,n,i,o,a;"e-icons e-databars"===e.parentItem.iconCss?(e.element.parentElement.classList.add("e-databars"),t(["Blue","Green","Red"],"DataBar",e.element.firstChild),t(["Orange","LightBlue","Purple"],"DataBar",e.element.lastChild),ee.EventHandler.add(e.element,"keydown",s.menuIconKeyDown.bind(s,"e-cf-icon",3))):"e-icons e-colorscales"===e.parentItem.iconCss?(e.element.parentElement.classList.add("e-colorscales"),t(["GYR","RYG","GWR","RWG"],"ColorScale",e.element.firstChild),t(["BWR","RWB","WR","RW"],"ColorScale",e.element.querySelector("#cs_icons2")),t(["GW","WG","GY","YG"],"ColorScale",e.element.lastChild),ee.EventHandler.add(e.element,"keydown",s.menuIconKeyDown.bind(s,"e-cf-icon",4))):"e-icons e-iconsets"===e.parentItem.iconCss&&(e.element.parentElement.classList.add("e-iconsets"),r=s.parent.createElement("div",{id:"is",className:"e-is"}),s.iconSetGroupElement.push(r),[{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){n=s.parent.createElement("div",{id:"is"+(t+1),className:"e-is"+(t+1)}),s.iconSetElements.push(n),e.hdr?n.innerText=l.getConstant(e.hdr):e.cont.forEach(function(e){for(o=l.getConstant(e.key),i=s.parent.createElement("div",{id:e.id||e.key,className:"e-"+e.cls+" e-is-wrapper",attrs:{title:o,"aria-label":o,tabindex:"-1"}}),s.iconWrapElements.push(i),a=0;a<e.count;a++){var t=s.createElement("span","e-"+e.cls+"-"+(a+1)+" e-iconsetspan");s.spanElements.push(t),i.appendChild(t)}n.appendChild(i)}),r.appendChild(n)}),e.element.firstChild.appendChild(r),ee.EventHandler.add(e.element,"keydown",s.menuIconKeyDown.bind(s,"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(e){var t=-1<["e-icons e-databars","e-icons e-colorscales","e-icons e-iconsets"].indexOf(e.parentItem.iconCss);e.cancel=e.event&&37===e.event.keyCode&&t,t&&!e.cancel&&ee.EventHandler.remove(e.element,"keydown",s.menuIconKeyDown)}});return r.createElement=this.parent.createElement,r.appendTo(e),e.classList.add("e-ul"),r},d.prototype.menuIconKeyDown=function(e,t,r){var n,i,o,a,s=[];r?40!==r.keyCode&&39!==r.keyCode&&38!==r.keyCode&&37!==r.keyCode||(r.preventDefault(),-1===(n=(s=[].slice.call(document.querySelectorAll("."+e))).indexOf(r.target))?n=0:39===r.keyCode?++n===s.length&&(n=0):37===r.keyCode?-1===--n&&(n=s.length-1):e.includes("e-menu-icon")||(i=s.length,a=o=void 0,t||(t=2,a=40===r.keyCode?(o=[6,11,14,19],[5,10,13]):(o=[7,12,15],[8,13,16]),i--),40===r.keyCode?n===i-1?n=0:(n+=o&&-1<o.indexOf(n)?1:a&&-1<a.indexOf(n)?3:t,o&&i++,i<=n&&(n=n-i+1)):0===n?n=i-1:(n-=o&&-1<o.indexOf(n)?1:a&&-1<a.indexOf(n)?3:t)<0&&(n=o?i:i+n-1))):(n=0,s=[].slice.call(document.querySelectorAll("."+e))),s[n]&&ce(s[n])},d.prototype.createElement=function(e,t){return this.parent.createElement(e,{className:t})},d.prototype.getBordersDBB=function(e){var t,r=this,n=this.parent.createElement("ul",{id:e+"_borders_menu"});return this.cPickerEle=this.parent.createElement("input",{id:e+"_cell_border_color",attrs:{type:"color"}}),this.parent.element.appendChild(this.cPickerEle),this.colorPicker=new S.ColorPicker({cssClass:"e-border-colorpicker",mode:"Palette",inline:!0,beforeTileRender:function(e){e.element.tabIndex=-1},change:function(e){var t=r.border.split(" ");t[2]=e.currentValue.hex,r.border=t.join(" ")}}),this.colorPicker.createElement=this.parent.createElement,this.colorPicker.appendTo(this.cPickerEle),this.bordersDdb=new m.DropDownButton({iconCss:"e-icons e-bottom-borders",cssClass:"e-borders-ddb",target:n,createPopupOnClick:!0,beforeOpen:function(e){t=r.createBorderMenu(n),r.tBarDdbBeforeOpen(e.element,t.items,r.parent.serviceLocator.getService(T).getConstant("Borders"),1),ee.EventHandler.add(n,"keydown",r.closeDropdownPopup,[r,r.bordersDdb])},open:function(){return ce(n)},beforeClose:function(e){e.event&&ee.closest(e.event.target,".e-borders-menu")?e.cancel=!0:(ee.EventHandler.remove(n,"keydown",r.closeDropdownPopup),t.destroy())},close:function(){return ce(r.bordersDdb.element)}}),this.bordersDdb.createElement=this.parent.createElement,this.bordersDdb.appendTo(this.parent.createElement("button",{id:e+"_borders",attrs:{type:"button"}})),this.bordersDdb.element},d.prototype.createBorderMenu=function(e){var r=this,t=this.parent.serviceLocator.getService(T),n=this.parent.element.id,i=new D.Menu({cssClass:"e-borders-menu",items:[{iconCss:"e-icons e-top-borders",text:t.getConstant("TopBorders"),id:n+"_border_topborders"},{iconCss:"e-icons e-left-borders",text:t.getConstant("LeftBorders"),id:n+"_border_leftborders"},{iconCss:"e-icons e-right-borders",text:t.getConstant("RightBorders"),id:n+"_border_rightborders"},{iconCss:"e-icons e-bottom-borders",text:t.getConstant("BottomBorders"),id:n+"_border_bottomborders"},{iconCss:"e-icons e-all-borders",text:t.getConstant("AllBorders"),id:n+"_border_allborders"},{iconCss:"e-icons e-horizontal-borders",text:t.getConstant("HorizontalBorders"),id:n+"_border_horizontalborders"},{iconCss:"e-icons e-vertical-borders",text:t.getConstant("VerticalBorders"),id:n+"_border_verticalborders"},{iconCss:"e-icons e-outside-borders",text:t.getConstant("OutsideBorders"),id:n+"_border_outsideborders"},{iconCss:"e-icons e-inside-borders",text:t.getConstant("InsideBorders"),id:n+"_border_insideborders"},{iconCss:"e-icons e-no-borders",text:t.getConstant("NoBorders"),id:n+"_border_noborders"},{separator:!0},{text:t.getConstant("BorderColor"),items:[{id:n+"_border_colors"}],id:n+"_border_bordercolor"},{text:t.getConstant("BorderStyle"),items:[{iconCss:"e-icons e-selected-icon",id:n+"_1px"},{id:n+"_2px"},{id:n+"_3px"},{id:n+"_dashed"},{id:n+"_dotted"},{id:n+"_double"}]}],orientation:"Vertical",beforeOpen:function(e){var t;e.parentItem.id===n+"_border_bordercolor"?(r.colorPicker.refresh(),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")):e.element.classList.add("e-border-style")},beforeClose:function(e){var t;e.event&&e.parentItem.id===n+"_border_bordercolor"&&(!ee.closest(e.event.target,".e-border-colorpicker")||ee.closest(e.event.target,".e-apply")||ee.closest(e.event.target,".e-cancel")?(r.colorPicker=ee.getComponent(r.cPickerEle,"colorpicker"),"Picker"===r.colorPicker.mode&&(r.colorPicker.mode="Palette",r.colorPicker.dataBind()),(t=r.colorPicker.element.parentElement).style.display="",r.parent.element.appendChild(t)):e.cancel=!0)},onOpen:function(e){e.parentItem.id===n+"_border_bordercolor"&&(e.element.parentElement.style.overflow="visible",e=e.element.querySelector(".e-color-palette .e-palette"))&&ce(e)},onClose:function(){return ce(i.element)},select:function(e){r.borderSelected(e,i)}});return i.createElement=this.parent.createElement,i.appendTo(e),e.classList.add("e-ul"),i},d.prototype.chartSelected=function(e,t){var r=!ee.isNullOrUndefined(ee.closest(e.element,".e-chart-menu")),n=e.element.id;"column_chartbar_chartarea_chartpie_doughnut_chartline_chartradar_chartscatter_chart".includes(n)&&(!e.item||e.item.items&&e.item.items.length||t.toggle(),t=e.event.target.id,this.parent.notify(Is,{action:n,id:t,isChart:r}))},d.prototype.addChartEleSelected=function(e){var t=e.element.id;this.parent.notify(Fs,{addChartEle:t,triggerEvent:!0}),!e.item||e.item.items&&e.item.items.length||this.addChartDdb.toggle()},d.prototype.cfSelected=function(e){var t,r=this.parent.getActiveSheet();e.item.id.includes("_dlg")?this.parent.notify(ts,{action:e.item.text}):!(t=e.item.id.includes("icons"))&&"cf_cr_cells"!==e.item.id&&"cf_cr_sheet"!==e.item.id||(Xd(this.parent,ne(te(r.selectedRange)))?this.parent.notify(qa,null):t?(t=e.event.target,this.parent.notify(Mr,{cfModel:{type:t.id||t.parentElement.id,range:r.selectedRange},isAction:!0})):"cf_cr_cells"===e.item.id?this.parent.notify(Ur,{range:r.selectedRange,isAction:!0}):"cf_cr_sheet"===e.item.id&&(this.parent.conditionalFormat=null,this.parent.notify(Ur,{isAction:!0}))),!e.item||e.item.items&&e.item.items.length||this.cfDdb.toggle()},d.prototype.borderSelected=function(t,e){this.bordersDdb.element.setAttribute("aria-label",t.item.text);var r,n,i=this.parent.element.id;if(!t.item.items.length&&t.item.id!==i+"_border_colors"){if(!t.item.text)return r=this.border.split(" "),(n="solid"===r[1]?i+"_"+r[0]:i+"_"+r[1])===t.item.id?void 0:(t.item.id===i+"_1px"||t.item.id===i+"_2px"||t.item.id===i+"_3px"?(r[0]=t.item.id.split(i+"_")[1],r[1]="solid"):(r[1]=t.item.id.split(i+"_")[1],r[0]="double"===r[1]?"3px":"1px"),this.border=r.join(" "),e.items[12].items.forEach(function(e){e.id===n&&(e.iconCss=null),e.id===t.item.id&&(e.iconCss="e-icons e-selected-icon")}),void e.setProperties({items:e.items},!0));switch(this.bordersDdb.toggle(),this.parent.showSpinner(),t.item.id){case i+"_border_topborders":this.parent.notify(Et,{style:{borderTop:this.border},onActionUpdate:!0});break;case i+"_border_leftborders":this.parent.notify(Et,{style:{borderLeft:this.border},onActionUpdate:!0});break;case i+"_border_rightborders":this.parent.notify(Et,{style:{borderRight:this.border},onActionUpdate:!0});break;case i+"_border_bottomborders":this.parent.notify(Et,{style:{borderBottom:this.border},onActionUpdate:!0});break;case i+"_border_allborders":this.parent.notify(Et,{style:{border:this.border},onActionUpdate:!0});break;case i+"_border_horizontalborders":this.parent.notify(Et,{style:{border:this.border},onActionUpdate:!0,borderType:"Horizontal"});break;case i+"_border_verticalborders":this.parent.notify(Et,{style:{border:this.border},onActionUpdate:!0,borderType:"Vertical"});break;case i+"_border_outsideborders":this.parent.notify(Et,{style:{border:this.border},onActionUpdate:!0,borderType:"Outer"});break;case i+"_border_insideborders":this.parent.notify(Et,{style:{border:this.border},onActionUpdate:!0,borderType:"Inner"});break;case i+"_border_noborders":this.parent.notify(Et,{style:{border:""},onActionUpdate:!0})}this.parent.hideSpinner()}},d.prototype.getFontNameDDB=function(e){var r=this,n=this.parent.createElement("button",{id:e+"_font_name",attrs:{type:"button"},className:"e-ss-ddb"}),e=this.parent.createElement("span",{className:"e-tbar-btn-text"});return e.innerText="Calibri",n.appendChild(e),this.fontNameDdb=new m.DropDownButton({cssClass:"e-font-family",items:this.getFontFamilyItems(),createPopupOnClick:!0,select:function(e){var t={style:{fontFamily:e.item.text},onActionUpdate:!0};r.parent.notify(Et,t),n.setAttribute("aria-label",e.item.text),t.cancel||r.refreshFontNameSelection(t.style.fontFamily)},beforeOpen:function(e){r.tBarDdbBeforeOpen(e.element,e.items,r.parent.serviceLocator.getService(T).getConstant("Font"))}}),this.fontNameDdb.createElement=this.parent.createElement,this.fontNameDdb.appendTo(n),n},d.prototype.getBtn=function(e,t,r,n){void 0===n&&(n=!0);var i=new w.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},d.prototype.datavalidationDDB=function(e){var t,r=this,n=this.parent.serviceLocator.getService(T);return this.datavalidationDdb=new m.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(Da,null);break;case n.getConstant("HighlightInvalidData"):r.parent.notify(La,{isRemoveHighlight:!1});break;case n.getConstant("ClearHighlight"):r.parent.notify(La,{isRemoveHighlight:!0});break;case n.getConstant("ClearValidation"):r.parent.notify(Za,{isAction:!0});break;default:t=e.item.text===n.getConstant("SortAscending")?"Ascending":"Descending",r.parent.notify(Jo,{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},d.prototype.getTextAlignDDB=function(e){var r=this,n=this.parent.serviceLocator.getService(T);return this.textAlignDdb=new m.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){r.refreshSelected(r.textAlignDdb,e.element,"iconCss"),e.element.setAttribute("aria-label",n.getConstant("HorizontalAlignment"))},select:function(e){var t={style:{textAlign:e.item.iconCss.split(" e-")[1].split("-icon")[0]},onActionUpdate:!0};r.parent.notify(Et,t),t.cancel||(r.textAlignDdb.iconCss="e-icons e-"+t.style.textAlign+"-icon",r.textAlignDdb.dataBind()),r.textAlignDdb.element.setAttribute("aria-label",n.getConstant("HorizontalAlignment")+" "+n.getConstant("Align"+r.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},d.prototype.getVerticalAlignDDB=function(e){var r=this,n=this.parent.serviceLocator.getService(T);return this.verticalAlignDdb=new m.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){r.refreshSelected(r.verticalAlignDdb,e.element,"iconCss"),e.element.setAttribute("aria-label",n.getConstant("VerticalAlignment"))},select:function(e){var t={style:{verticalAlign:e.item.iconCss.split(" e-")[1].split("-icon")[0]},onActionUpdate:!0};r.parent.notify(Et,t),t.cancel||(r.verticalAlignDdb.iconCss="e-icons e-"+t.style.verticalAlign+"-icon",r.verticalAlignDdb.dataBind()),r.verticalAlignDdb.element.setAttribute("aria-label",n.getConstant("VerticalAlignment")+" "+n.getConstant("Align"+r.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},d.prototype.getMergeSplitBtn=function(e){var t=this,r=(this.parent.element.appendChild(this.parent.createElement("button",{id:e+"_merge",attrs:{type:"button"}})),this.parent.serviceLocator.getService(T));return this.mergeSplitBtn=new m.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},d.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)},d.prototype.unMerge=function(e){var t=this.parent.getActiveSheet(),r=te(t.selectedRange);Xd(this.parent,ne(r))?this.parent.notify(qa,null):(this.parent.showSpinner(),r=t.selectedRange,this.parent.notify(Or,{merge:!1,range:e&&e.range||r,isAction:!0,refreshRibbon:!0,type:"All"}),this.toggleActiveState(!1),this.parent.hideSpinner())},d.prototype.merge=function(e){var t,r=this,n=this.parent.getActiveSheet(),i=te(n.selectedRange);if(Xd(this.parent,ne(i)))this.parent.notify(qa,null);else{for(var o,a,s=e.includes("merge_all"),l=i[0];l<=i[2];l++)for(var h=i[1];h<=i[3];h++)l===i[0]&&h===i[1]&&s||l===i[0]&&e.includes("merge_vertically")||h===i[1]&&e.includes("_merge_horizontally")||((t=se(l,h,n)||{}).value||t.formula)&&(o=!0);o?(a=this.parent.serviceLocator.getService(O)).show({height:200,width:400,isModal:!0,showCloseIcon:!0,cssClass:"e-merge-alert-dlg",content:this.parent.serviceLocator.getService(T).getConstant("MergeCellsAlert"),beforeOpen:function(e){var t={dialogName:"MergeAlertDialog",element:e.element,target:e.target,cancel:e.cancel};r.parent.trigger("dialogBeforeOpen",t),t.cancel?e.cancel=!0:ce(r.parent.element)},buttons:[{buttonModel:{content:this.parent.serviceLocator.getService(T).getConstant("Ok"),isPrimary:!0},click:function(){a.hide(),r.performMerge(e),s&&r.toggleActiveState(!0)}}]}):(this.performMerge(e),s&&this.toggleActiveState(!0))}},d.prototype.performMerge=function(e){var t=this.parent.element.id;switch(this.parent.showSpinner(),e){case t+"_merge_all":this.parent.notify(Or,{merge:!0,range:this.parent.getActiveSheet().selectedRange,type:"All",isAction:!0,refreshRibbon:!0});break;case t+"_merge_horizontally":this.parent.notify(Or,{merge:!0,range:this.parent.getActiveSheet().selectedRange,type:"Horizontally",isAction:!0});break;case t+"_merge_vertically":this.parent.notify(Or,{merge:!0,range:this.parent.getActiveSheet().selectedRange,type:"Vertically",isAction:!0})}this.parent.hideSpinner()},d.prototype.getSortFilterDDB=function(r){var i,o=this,a=this.parent.serviceLocator.getService(T);return this.sortingDdb=new m.DropDownButton({cssClass:"e-sort-filter-ddb",iconCss:"e-icons e-sort-filter-icon",items:[{text:a.getConstant("SortAscending"),iconCss:"e-icons e-sort-asc"},{text:a.getConstant("SortDescending"),iconCss:"e-icons e-sort-desc"},{text:a.getConstant("CustomSort")+"...",iconCss:"e-icons e-sort-custom"},{separator:!0},{text:a.getConstant("Filter"),iconCss:"e-icons e-filter-apply",id:r+"_applyfilter"},{text:a.getConstant("ClearAllFilter"),iconCss:"e-icons e-filter-clear",id:r+"_clearfilter"},{text:a.getConstant("ReapplyFilter"),iconCss:"e-icons e-filter-reapply",id:r+"_reapplyfilter"}],createPopupOnClick:!0,beforeItemRender:function(e){var t={isFiltered:!1,isClearAll:!0};o.parent.notify(Fa,t),o.parent.allowSorting||e.item.text!==a.getConstant("SortAscending")&&e.item.text!==a.getConstant("SortDescending")&&e.item.text!==a.getConstant("CustomSort")+"..."||e.element.classList.add("e-disabled"),o.parent.allowFiltering||e.item.text!==a.getConstant("Filter")||e.element.classList.add("e-disabled"),e.item.id!==r+"_clearfilter"&&e.item.id!==r+"_reapplyfilter"||(t.isFiltered?e.element.classList.remove("e-disabled"):e.element.classList.add("e-disabled"))},beforeOpen:function(e){o.refreshSelected(o.sortingDdb,e.element,"iconCss"),e.element.setAttribute("aria-label",o.parent.serviceLocator.getService(T).getConstant("SortAndFilter"))},select:function(e){var t=[];if(e.item.text===a.getConstant("SortAscending")||e.item.text===a.getConstant("SortDescending")||e.item.text===a.getConstant("CustomSort")+"..."){var r=te(o.parent.getActiveSheet().selectedRange),r=qn(r[0],r[1],o.parent.getActiveSheet());if(Xd(o.parent,r))return void o.parent.notify(qa,null)}switch(e.item.text){case a.getConstant("Filter"):o.parent.notify(xa,{});break;case a.getConstant("ClearAllFilter"):o.parent.notify(Ra,{isAction:!0});break;case a.getConstant("ReapplyFilter"):o.parent.notify(Ea,null);break;case a.getConstant("CustomSort")+"...":o.parent.notify(Zo,null);break;default:if(i=e.item.text===a.getConstant("SortAscending")?"Ascending":"Descending",o.parent.sortCollection)for(var n=o.parent.sortCollection.length-1;0<=n;n--)o.parent.sortCollection[n]&&o.parent.sortCollection[n].sheetIndex===o.parent.activeSheetIndex&&(t.push(o.parent.sortCollection[n]),o.parent.sortCollection.splice(n,1));o.parent.notify(Ia,{sortOptions:{sortDescriptors:{order:i}}}),o.parent.notify(Jo,{sortOptions:{sortDescriptors:{order:i}},previousSort:t})}o.sortingDdb.element.setAttribute("aria-label",e.item.text)}}),this.sortingDdb.createElement=this.parent.createElement,this.sortingDdb.appendTo(this.parent.createElement("button",{id:r+"_sorting",attrs:{type:"button"},className:"e-ss-ddb"})),this.sortingDdb.element},d.prototype.getFindBtn=function(e){var t=this,e=this.parent.createElement("button",{id:e+"_findbtn",attrs:{type:"button","aria-label":this.parent.serviceLocator.getService(T).getConstant("FindReplaceTooltip")}});return this.findDdb=new w.Button({cssClass:"e-spreadsheet-find-ddb e-flat",iconCss:"e-icons e-search-icon"}),this.findDdb.createElement=this.parent.createElement,this.findDdb.appendTo(e),e.onclick=function(e){t.parent.notify(vt,{event:e})},this.findDdb.element},d.prototype.getClearDDB=function(r){var n=this,e=this.parent.serviceLocator.getService(T);return this.clearDdb=new m.DropDownButton({cssClass:"e-clear-ddb",iconCss:"e-icons e-clear-icon",items:[{text:e.getConstant("ClearAll"),id:r+"_Clear All"},{text:e.getConstant("ClearFormats"),id:r+"_Clear Formats"},{text:e.getConstant("ClearContents"),id:r+"_Clear Contents"},{text:e.getConstant("ClearHyperlinks"),id:r+"_Clear Hyperlinks"}],createPopupOnClick:!0,beforeOpen:function(e){e.element.setAttribute("aria-label",n.parent.serviceLocator.getService(T).getConstant("Clear"))},beforeItemRender:function(e){var t=n.parent.getActiveSheet();t.isProtected&&t.protectSettings.formatCells&&e.item.id!==r+"_Clear Formats"&&(e.element.classList.add("e-disabled"),e.element.setAttribute("aria-disabled","true"))},select:function(e){n.parent.notify(rs,{options:{type:e.item.id.replace(r+"_","")},isAction:!0}),n.clearDdb.element.setAttribute("aria-label",e.item.text)}}),this.clearDdb.createElement=this.parent.createElement,this.clearDdb.appendTo(this.parent.createElement("button",{id:r+"_clear",attrs:{type:"button"},className:"e-ss-ddb"})),this.clearDdb.element},d.prototype.ribbonCreated=function(){var e=this.parent.serviceLocator.getService(T).getConstant("CollapseToolbar");ee.attributes(this.ribbon.element.querySelector(".e-drop-icon"),{role:"button",tabindex:"-1",title:e,"aria-label":e}),this.ribbon.toolbarObj&&(this.ribbon.toolbarObj.allowKeyboard=this.parent.enableKeyboardNavigation,this.ribbon.toolbarObj.dataBind())},d.prototype.alignItemRender=function(e){e.element.title=this.parent.serviceLocator.getService(T).getConstant("Align"+this.getAlignText(e))},d.prototype.getAlignText=function(e){e=e.item.iconCss.split(" e-")[1].split("-icon")[0];return e[0].toUpperCase()+e.slice(1,e.length)},d.prototype.toggleBtnClicked=function(e){var t,r,n,i,o,e=ee.closest(e.target,".e-btn"),a=this.parent.element.id,s=e.id,l=Et;switch(s){case a+"_bold":r={fontWeight:"normal"},n={fontWeight:"bold"},o="fontWeight";break;case a+"_italic":r={fontStyle:"normal"},n={fontStyle:"italic"},o="fontStyle";break;case a+"_line-through":l=Rt,n=r={textDecoration:"line-through"},o="textDecoration";break;case a+"_underline":l=Rt,n=r={textDecoration:"underline"},o="textDecoration"}e.classList.contains("e-active")?(t=n[""+o],this.parent.notify(l,i={style:n,onActionUpdate:!0}),i.cancel&&e.classList.remove("e-active")):(t=r[""+o],this.parent.notify(l,i={style:r,onActionUpdate:!0}),i.cancel&&e.classList.add("e-active")),i.cancel||t===i.style[""+o]||this.refreshToggleBtn(W(this.parent.getActiveSheet().activeCell))},d.prototype.getCellStyleValue=function(e,t){var t=se(t[0],t[1],this.parent.getActiveSheet()),r=this.parent.cellStyle[""+e];return r=t&&t.style&&t.style[""+e]?t.style[""+e]:r},d.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}},d.prototype.expandCollapseHandler=function(e){var t=this.ribbon.element.querySelector(".e-drop-icon"),r=this.parent.serviceLocator.getService(T);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()},d.prototype.getChartThemeDdbItems=function(t){var r=this.parent.serviceLocator.getService(T),n=[];return["Material","Fabric","Bootstrap","HighContrastLight","MaterialDark","FabricDark","HighContrast","BootstrapDark","Bootstrap4","Bootstrap5Dark","Bootstrap5","TailwindDark","Tailwind","Tailwind3","Tailwind3Dark","FluentDark","Fluent","Fluent2","Fluent2Dark","Material3","Material3Dark"].forEach(function(e){n.push({id:e,text:r.getConstant(e),iconCss:e===t?"e-icons e-selected-icon":""})}),n},d.prototype.getNumFormatDdbItems=function(e){var t=this.parent.serviceLocator.getService(T);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")}]},d.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"}]},d.prototype.applyNumFormat=function(e){var t=this.parent.getActiveSheet(),e={format:e,range:t.selectedRange,cancel:!1,requestType:"NumberFormat"},t={range:t.name+"!"+e.range,format:e.format,requestType:"NumberFormat"},r=Xd(this.parent,ne(te(e.range)));return!r&&(this.parent.trigger("beforeCellFormat",e),this.parent.notify(gt,{eventArgs:e,action:"format"}),e.cancel)||(this.parent.notify(xt,e),this.parent.notify(dn,{type:"mousedown"}),r)||this.parent.notify(le,{eventArgs:t,action:"format"}),e.format},d.prototype.renderCustomFormatDialog=function(r,n){var i=this,o=this.parent.serviceLocator.getService(T),e=this.parent.createElement("div"),t=this.parent.createElement("div",{className:"e-custom-dialog"}),a=this.parent.createElement("button",{className:"e-btn",attrs:{type:"button"}}),s=(a.innerText=o.getConstant("Apply"),this.parent.createElement("div",{className:"e-custom-sample"})),l=(s.innerText=o.getConstant("CustomFormatTypeList")+":",this.parent.createElement("input",{className:"e-input e-dialog-input",attrs:{type:"text",name:"input",spellcheck:"false",placeholder:o.getConstant("CustomFormatPlaceholder")}})),h=this.parent.createElement("div",{className:"e-custom-listview"}),d=this.parent.serviceLocator.getService(O),p=new f.ListView({dataSource:n,select:function(e){l.value=e.item.textContent,e.event&&"keydown"===e.event.type&&e.item&&e.item.focus()}}),s=(t.appendChild(l),t.appendChild(a),t.appendChild(s),t.appendChild(h),p.appendTo(h),a.addEventListener("click",function(){var e=l.value,t=n.indexOf(e),t=-1<t?r[t]:Bl(i.parent,e);(t=i.applyNumFormat(t))&&(i.refreshNumFormatSelection(Ml(t,!0),i.parent.getActiveSheet(),o,t),i.parent.notify(wn,{action:"addToCustomFormats",format:e,defaultFormat:t})),d.hide()}),l.addEventListener("input",function(){p.getSelectedItems()&&p.unselectItem()}),d.show({header:o.getConstant("CustomFormat"),cssClass:"e-custom-format-dlg",height:-1<this.parent.cssClass.indexOf("e-bigger")?502:480,width:440,isModal:!0,showCloseIcon:!0,content:t,footerTemplate:e,beforeOpen:function(e){var t={dialogName:"CustomNumberFormatDlg",element:e.element,target:e.target,cancel:e.cancel};i.parent.trigger("dialogBeforeOpen",t),t.cancel?(e.cancel=!0,Xh(function(){d.hide(!0),ce(i.parent.element)})):ce(i.parent.element)}}),this.parent.getActiveSheet()),h=W(s.activeCell),a=se(h[0],h[1],s);a&&a.format&&(t=r.indexOf(a.format),p.selectItem(p.element.getElementsByClassName("e-list-item")[t]))},d.prototype.tBarDdbBeforeOpen=function(e,t,r,n){void 0===n&&(n=0);var i,o=this.parent.viewport.height,t=parseInt(getComputedStyle(e.firstElementChild).height,10)*(t.length-n)+2*parseInt(getComputedStyle(e).paddingTop,10);n&&(i=getComputedStyle(e.querySelector(".e-separator")),t+=n*(parseInt(i.borderBottomWidth,10)+2*parseInt(i.marginTop,10))),o<t?(e.style.height=o+"px",e.style.overflowY="auto"):e.style.height&&(e.style.height="",e.style.overflowY=""),e.setAttribute("aria-label",r)},d.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);e=this.numPopupWidth+160;document.querySelector(".e-numformat-ddb.e-dropdown-popup").style.width=e+"px"},d.prototype.previewNumFormat=function(e){var t,r,n;e.item.id.includes("_Custom")||(t=this.parent.createElement("div",{className:"e-numformat-text",styles:"width:100%",innerHTML:e.element.innerHTML}),e.element.innerHTML="",r=se((r=W((n=this.parent.getActiveSheet()).activeCell))[0],r[1],n,!1,!0),ee.isNullOrUndefined(r.value)&&""===r.value||(n=Pl(e.item.id.split(this.parent.element.id+"_")[1]),r={type:e.item.text,formattedText:"",value:r.value,format:n,cell:{value:r.value,format:n},skipFormatCheck:Jn(this.parent)},this.parent.notify(St,r),(n=this.parent.createElement("span",{className:"e-numformat-preview-text",styles:"float:right;"})).innerText=r.formattedText,t.appendChild(n)),e.element.appendChild(t))},d.prototype.refreshRibbonContent=function(e){if(this.ribbon){ee.isNullOrUndefined(e)&&(e=this.ribbon.selectedTab);var t,r=this.parent.serviceLocator.getService(T),n=this.parent.getActiveSheet();switch(this.ribbon.items[e].header.text){case r.getConstant("Home"):this.refreshHomeTabContent(W(n.activeCell));break;case r.getConstant("Insert"):n.isProtected&&(t=W(n.activeCell),n.protectSettings.insertLink&&!Mn(se(t[0],t[1],n),de(n,t[1]))?this.enableToolbarItems([{tab:r.getConstant("Insert"),items:[this.parent.element.id+"_hyperlink"],enable:!0}]):this.enableToolbarItems([{tab:r.getConstant("Insert"),items:[this.parent.element.id+"_hyperlink"],enable:!1}]));break;case r.getConstant("Formulas"):break;case r.getConstant("Data"):this.refreshDataTabContent(e);break;case r.getConstant("View"):this.refreshViewTabContent(e)}}},d.prototype.refreshHomeTabContent=function(e){ee.isNullOrUndefined(document.getElementById(this.parent.element.id+"_number_format"))||(this.numFormatDDB=ee.getComponent(document.getElementById(this.parent.element.id+"_number_format"),m.DropDownButton));var t,r=this.parent.getActiveSheet(),n=W(r.activeCell),i=this.parent.serviceLocator.getService(T),o=se(n[0],n[1],r,!1,!0),a=Ml(o.format||"General",!0);this.refreshNumFormatSelection(a,r,i,o.format),r.isProtected&&this.parent.enableClipboard&&this.parent.clipboardModule.copiedInfo&&this.parent.notify(Io,[{items:[this.parent.element.id+"_paste"],enable:!Mn(o,de(r,n[1]))}]),this.fontNameDdb&&(r.isProtected&&!r.protectSettings.formatCells?this.refreshFontNameSelection("Calibri"):this.refreshFontNameSelection(this.getCellStyleValue("fontFamily",e))),this.fontSizeDdb&&(t=this.getCellStyleValue("fontSize",e),r.isProtected&&!r.protectSettings.formatCells?this.fontSizeDdb.content="11":(t=t.includes("pt")?t.split("pt")[0]:"11")!==this.fontSizeDdb.content&&(this.fontSizeDdb.content=t,this.fontSizeDdb.dataBind())),this.refreshTextAlign(r,o,a,e),this.verticalAlignDdb&&(t="e-icons e-"+this.getCellStyleValue("verticalAlign",e).toLowerCase()+"-icon",r.isProtected&&!r.protectSettings.formatCells?this.verticalAlignDdb.iconCss="e-icons e-bottom-icon":t!==this.verticalAlignDdb.iconCss&&(this.verticalAlignDdb.iconCss=t,this.verticalAlignDdb.dataBind())),this.refreshToggleBtn(e),!r.isProtected&&(1<o.rowSpan||1<o.colSpan)?(this.enableToolbarItems([{tab:i.getConstant("Home"),items:[this.parent.element.id+"_merge_cells"],enable:!0}]),this.toggleActiveState(!0)):(n=te(r.selectedRange),this.enableToolbarItems([{tab:i.getConstant("Home"),items:[this.parent.element.id+"_merge_cells"],enable:n[0]!==n[2]||n[1]!==n[3]}]),this.toggleActiveState(!1))},d.prototype.refreshTextAlign=function(e,t,r,n){this.textAlignDdb&&(n=this.getCellStyleValue("textAlign",n),e.isProtected&&!e.protectSettings.formatCells?this.textAlignDdb.iconCss="e-icons e-left-icon":(e="e-icons e-"+(n=void 0!==t.value&&"left"===n&&("Accounting"===r||oe(t.value)&&"Text"!==r)?"right":n).toLowerCase()+"-icon")!==this.textAlignDdb.iconCss&&(this.textAlignDdb.iconCss=e,this.textAlignDdb.dataBind()))},d.prototype.toggleActiveState=function(e){var t=this.parent.serviceLocator.getService(T);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")))},d.prototype.refreshToggleBtn=function(r){var n,i,o,a=this,s=this.parent.getActiveSheet(),l=this.parent.element.id,h=se(r[0],r[1],s),d=["fontWeight","fontStyle","textDecoration","textDecoration"];["bold","italic","line-through","underline","wrap"].forEach(function(e,t){(n=document.getElementById(l+"_"+e))&&(o=!1,s.isProtected&&!s.protectSettings.formatCells||("wrap"===e?o=a.parent.allowWrap&&h&&h.wrap:a.parent.allowCellFormatting&&(i=a.getCellStyleValue(d[t],r).toLowerCase(),o=-1<i.indexOf(e))),o?n.classList.add("e-active"):n.classList.contains("e-active")&&n.classList.remove("e-active"))})},d.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)},d.prototype.refreshNumFormatSelection=function(e,t,r,n){if(this.numFormatDDB){e=t.isProtected&&!t.protectSettings.formatCells?"General":r.getConstant(e=n&&"General"===e&&"General"!==n?"Custom":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)}},d.prototype.fileMenuItemSelect=function(e){var t,r=this,n=ee.extend({cancel:!1},e),i=(this.parent.trigger("fileMenuItemSelect",n),this.parent.element.id);if(!n.cancel)switch(e.item.id){case i+"_Print":this.parent.print();break;case i+"_Open":ee.select("#"+i+"_fileUpload",this.parent.element).click(),ce(this.parent.element);break;case i+"_Xlsx":case i+"_Xls":case i+"_Csv":case i+"_Pdf":this.parent.notify(yt,e);break;case i+"_New":(t=this.parent.serviceLocator.getService(O)).show({height:200,width:400,isModal:!0,showCloseIcon:!0,content:this.parent.serviceLocator.getService(T).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:ce(r.parent.element)},buttons:[{buttonModel:{content:this.parent.serviceLocator.getService(T).getConstant("Ok"),isPrimary:!0},click:function(){t.hide(),r.parent.refresh(!0)}}]})}},d.prototype.toolbarClicked=function(e){if(e.item&&"spreadsheet_find"!==e.item.id){var t,r,n=this.parent.element.id,i=this.parent.getActiveSheet();switch(e.item.id){case n+"_headers":if(t={isShow:!i.showHeaders,sheetIdx:this.parent.activeSheetIndex,cancel:!1},this.parent.notify(le,{eventArgs:t,action:"headers"}),t.cancel)return;this.parent.setSheetPropertyOnMute(i,"showHeaders",!i.showHeaders),this.parent.serviceLocator.getService("sheet").showHideHeaders(),this.toggleRibbonItems({props:"Headers",activeTab:this.ribbon.selectedTab});break;case n+"_gridlines":if(t={isShow:!i.showGridLines,sheetIdx:this.parent.activeSheetIndex,cancel:!1},this.parent.notify(le,{eventArgs:t,action:"gridLines"}),t.cancel)return;this.parent.setSheetPropertyOnMute(i,"showGridLines",!i.showGridLines),this.toggleRibbonItems({props:"GridLines",activeTab:this.ribbon.selectedTab});break;case n+"_protect":this.parent.notify(Qs,{});break;case n+"_undo":this.parent.notify(ma,{isUndo:!0});break;case n+"_redo":this.parent.notify(ma,{isUndo:!1});break;case n+"_freezepanes":t=W(i.topLeftCell),r=i.frozenRows||i.frozenColumns?t:W(i.activeCell),this.parent.notify(Us,{row:r[0]-t[0],column:r[1]-t[1],triggerEvent:!0});break;case n+"_freezerows":this.parent.notify(Us,{row:i.frozenRows?0:W(i.activeCell)[0]-W(i.topLeftCell)[0],column:i.frozenColumns,triggerEvent:!0});break;case n+"_freezecolumns":this.parent.notify(Us,{row:i.frozenRows,column:i.frozenColumns?0:W(i.activeCell)[1]-W(i.topLeftCell)[1],triggerEvent:!0});break;case n+"_protectworkbook":0<this.parent.password.length?this.parent.notify(Ts,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(le,{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(As,null)}this.parent.notify(wo,e)}},d.prototype.toggleRibbonItems=function(e){var t="",r=this.parent.serviceLocator.getService(T).getConstant("View"),n=this.parent.serviceLocator.getService(T).getConstant("Data");if(this.ribbon.items[this.ribbon.selectedTab].header.text===r){if(ee.isNullOrUndefined(e.activeTab))for(var i=0,o=this.ribbon.items.length;i<o;i++)if(this.ribbon.items[i].header.text===r){e.activeTab=i;break}for(var a=this.getLocaleText(e.props),s=("GridLines"===e.props&&this.parent.serviceLocator.getService("sheet").toggleGridlines(),this.parent.element.id+"_"+e.props.toLowerCase()),l=this.ribbon.items[e.activeTab].content.length,i=void 0;i<l;i++)"Separator"!==this.ribbon.items[e.activeTab].content[i].type&&this.ribbon.items[e.activeTab].content[i].id===s&&(this.ribbon.items[e.activeTab].content[i].text=a,this.ribbon.setProperties({items:this.ribbon.items},!0));this.ribbon.items[this.ribbon.selectedTab].header.text===r&&"Protect"!==e.props&&this.updateToggleText(e.props.toLowerCase(),a)}if(this.ribbon.items[this.ribbon.selectedTab].header.text===n){if(ee.isNullOrUndefined(e.activeTab))for(var i=0,h=this.ribbon.items.length;i<h;i++)if(this.ribbon.items[i].header.text===n){e.activeTab=i;break}if((s=this.parent.element.id+"_"+e.props.toLowerCase())===this.parent.element.id+"_protect"){var d=this.ribbon.items[this.ribbon.selectedTab].content.length,p=void 0;for(p=0;p<d&&this.ribbon.items[this.ribbon.selectedTab].content[p].id!==this.parent.element.id+"_protect";p++);t=this.getLocaleProtectText("Sheet",!0)}else if(s===this.parent.element.id+"_protectworkbook"){var c=this.ribbon.items[this.ribbon.selectedTab].content.length,p=void 0;for(p=0;p<c&&this.ribbon.items[this.ribbon.selectedTab].content[p].id!==this.parent.element.id+"_protectworkbook";p++);this.parent.isProtected||0<this.parent.password.length?t=this.getLocaleProtectWorkbook("UnprotectWorkbook"):this.parent.isProtected||(t=this.getLocaleProtectWorkbook("ProtectWorkbook"))}for(l=this.ribbon.items[e.activeTab].content.length,i=void 0;i<l;i++)"Separator"!==this.ribbon.items[e.activeTab].content[i].type&&this.ribbon.items[e.activeTab].content[i].id===s&&(this.ribbon.items[e.activeTab].content[i].text=t,this.ribbon.setProperties({items:this.ribbon.items},!0));this.ribbon.items[this.ribbon.selectedTab].header.text===n&&this.updateToggleText(e.props.toLowerCase(),t)}},d.prototype.enableFileMenuItems=function(e){this.ribbon.enableMenuItems(e.items,e.enable,e.isUniqueId)},d.prototype.hideRibbonTabs=function(e){this.ribbon.hideTabs(e.tabs,e.hide)},d.prototype.addRibbonTabs=function(e){this.ribbon.addTabs(e.items,e.insertBefore),ee.select(".e-ribbon .e-tab-header .e-toolbar-item:not(.e-menu-tab).e-hide",this.parent.element)&&this.parent.updateActiveBorder(ee.selectAll(".e-ribbon .e-tab-header .e-toolbar-item:not(.e-menu-tab)",this.parent.element)[this.ribbon.selectedTab])},d.prototype.updateToggleText=function(e,t){var r=ee.select("#"+this.parent.element.id+"_"+e+" .e-tbar-btn-text",this.ribbon.element);"protect"===e||"protectworkbook"===e?r.parentElement.setAttribute("aria-label",t):r.parentElement.setAttribute("aria-label",r.textContent),Xh(function(){r&&(r.textContent=t)}),"headers"===e&&(e=this.parent.element.getElementsByClassName("e-findtool-dlg")[0])&&e.classList.contains("e-popup-open")&&this.parent.notify(vt,{refreshPosition:!0,dialogEle:e})},d.prototype.refreshViewTabContent=function(e){for(var t,r=this.parent.element.id,n=this.parent.getActiveSheet(),i=this.parent.serviceLocator.getService(T),o=0;o<this.ribbon.items[e].content.length;o++)"Separator"!==(t=this.ribbon.items[e].content[o]).type&&(t.id===r+"_headers"&&this.updateViewTabContent(e,"Headers",o),t.id===r+"_gridlines"&&this.updateViewTabContent(e,"GridLines",o),t.id===r+"_freezepanes"&&(n.frozenRows||n.frozenColumns?t.text===i.getConstant("FreezePanes")&&this.updateToggleText("freezepanes",this.updateRibbonItemText("Unfreeze","Panes",o,e)):t.text===i.getConstant("UnfreezePanes")&&this.updateToggleText("freezepanes",this.updateRibbonItemText("Freeze","Panes",o,e))),t.id===r+"_freezerows"&&(n.frozenRows?t.text===i.getConstant("FreezeRows")&&this.updateToggleText("freezerows",this.updateRibbonItemText("Unfreeze","Rows",o,e)):t.text===i.getConstant("UnfreezeRows")&&this.updateToggleText("freezerows",this.updateRibbonItemText("Freeze","Rows",o,e))),t.id===r+"_freezecolumns")&&(n.frozenColumns?t.text===i.getConstant("FreezeColumns")&&this.updateToggleText("freezecolumns",this.updateRibbonItemText("Unfreeze","Columns",o,e)):t.text===i.getConstant("UnfreezeColumns")&&this.updateToggleText("freezecolumns",this.updateRibbonItemText("Freeze","Columns",o,e)))},d.prototype.updateViewTabContent=function(e,t,r){var n=this.parent.getActiveSheet(),i=this.parent.serviceLocator.getService(T);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))},d.prototype.updateRibbonItemText=function(e,t,r,n){e=this.parent.serviceLocator.getService(T).getConstant(e+t);return this.ribbon.items[n].content[r].text=e,this.ribbon.setProperties({items:this.ribbon.items},!0),e},d.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)}},d.prototype.updateDataTabContent=function(e,t,r){var n=this.parent.getActiveSheet(),i=this.parent.serviceLocator.getService(T);"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):"Workbook"===t&&(n=this.parent.serviceLocator.getService(T),this.parent.isProtected?this.ribbon.items[e].content[r].text===n.getConstant("Protect"+t)&&this.updateToggleText("protectworkbook",this.updateRibbonItemText("Unprotect",t,r,e)):this.ribbon.items[e].content[r].text===n.getConstant("Unprotect"+t)&&this.updateToggleText("protectworkbook",this.updateRibbonItemText("Protect",t,r,e)))},d.prototype.updateProtectBtn=function(e,t,r,n){e=this.parent.serviceLocator.getService(T).getConstant(e+t);this.ribbon.items[n].content[r].text=e,this.ribbon.setProperties({items:this.ribbon.items},!0),this.updateToggleText("protect",e)},d.prototype.updateProtectWorkbookBtn=function(e,t,r,n){e=this.parent.serviceLocator.getService(T).getConstant(e);this.ribbon.items[n].content[r].text=e,this.ribbon.setProperties({items:this.ribbon.items},!0),this.updateToggleText("protectworkbook",e)},d.prototype.addToolbarItems=function(e){var t=this.parent.serviceLocator.getService(T);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())},d.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)})},d.prototype.createMobileView=function(){var t=this,r=this.parent.element.id,e=this.parent.createElement("div",{className:"e-header-toolbar"}),n=this.parent.createElement("ul"),i=(e.appendChild(n),new D.Toolbar({items:[{prefixIcon:"e-tick-icon",align:"Left",id:r+"focused_tick",cssClass:"e-focused-tick"},{template:n,align:"Right",id:r+"file_menu"}],clicked:function(e){e.item.id===r+"focused_tick"&&(t.parent.element.classList.remove("e-mobile-focused"),t.parent.renderModule.setSheetPanelSize())},created:function(){var e=new D.Menu({cssClass:"e-mobile e-file-menu",enableRtl:!0,showItemOnClick:!0,items:t.getRibbonMenuItems(),select:t.fileMenuItemSelect.bind(t),beforeOpen:function(e){e.element.parentElement.classList.remove("e-rtl"),t.fileMenuBeforeOpen(e)},beforeClose:t.fileMenuBeforeClose.bind(t)});e.createElement=t.parent.createElement,e.appendTo(n)}}));i.createElement=this.parent.createElement,i.appendTo(e),this.parent.element.insertBefore(e,this.parent.element.firstElementChild),this.renderMobileToolbar()},d.prototype.renderMobileToolbar=function(){var t=this,e=this.parent.createElement("div",{className:"e-toolbar-panel e-ribbon"}),r=this.parent.createElement("div"),n=this.parent.createElement("button",{attrs:{type:"button"}}),o=(e.appendChild(r),e.appendChild(n),e.style.display="block",this.parent.element.appendChild(e),new m.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(e){e.item.text!==o.content&&(i.element.style.display="none",o.content=e.item.text,o.dataBind(),i.items=t.ribbon.items[o.items.indexOf(e.item)+1].content,i.width="calc(100% - "+n.getBoundingClientRect().width+"px)",i.element.style.display="",i.dataBind(),i.items[0].text=e.item.text,i.dataBind())},open:function(e){var t=e.element.parentElement,r=t.getBoundingClientRect(),n=g.calculatePosition(o.element,"right","bottom");t.style.left=n.left-r.width+"px",t.style.top=n.top-r.height+"px";for(var i=0;i<o.items.length;i++)if(o.content===o.items[i].text){e.element.children[i].classList.add("e-selected");break}},close:function(){return ce(t.parent.element)}})),i=(o.createElement=this.parent.createElement,o.appendTo(n),new D.Toolbar({width:"calc(100% - "+n.getBoundingClientRect().width+"px)",items:this.ribbon.items[0].content,clicked:this.toolbarClicked.bind(this)}));i.createElement=this.parent.createElement,i.appendTo(r),e.style.display=""},d.prototype.fileMenuBeforeOpen=function(e){var n,i=this,t=this.parent.serviceLocator.getService(T),o=[".xlsx",".xls",".csv",".pdf"];e.parentItem.text===t.getConstant("SaveAs")&&[].slice.call(e.element.children).forEach(function(e,t){n=i.parent.createElement("div",{innerHTML:e.innerHTML}),e.innerHTML="";var r=i.parent.createElement("span",{className:"e-extension"});r.innerText=o[t],n.appendChild(r),e.appendChild(n)}),this.parent.trigger("fileMenuBeforeOpen",e),e.element.setAttribute("aria-label",t.getConstant("File"))},d.prototype.enableRibbonTabs=function(e){this.ribbon.enableTabs(e.tabs,e.enable)},d.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"&&Xh(function(){var e=t.ribbon.element.querySelector(".e-tab-header .e-toolbar-item .e-tab-wrap");e&&(ce(e),e=e.querySelector(".e-menu-item.e-focused"))&&e.classList.remove("e-focused")})},d.prototype.hideFileMenuItems=function(e){this.ribbon.hideMenuItems(e.items,e.hide,e.isUniqueId)},d.prototype.addFileMenuItems=function(e){this.ribbon.addMenuItems(e.items,e.text,e.insertAfter,e.isUniqueId)},d.prototype.hideToolbarItems=function(e){this.ribbon.hideToolbarItems(e.tab,e.indexes,e.hide)},d.prototype.protectSheetHandler=function(e){for(var t=this.parent.getActiveSheet(),r=this.parent.serviceLocator.getService(T),n=(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(Wa,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}]),this.ribbon.items[this.ribbon.selectedTab].content.length),i=0;i<n&&this.ribbon.items[this.ribbon.selectedTab].content[i].id!==this.parent.element.id+"_protectworkbook";i++);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[i].text=r.getConstant("UnprotectWorkbook")):this.ribbon.items[this.ribbon.selectedTab].header.text===r.getConstant("Data")&&(this.ribbon.items[this.ribbon.selectedTab].content[i].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[i].text=r.getConstant("UnprotectWorkbook")):this.ribbon.items[this.ribbon.selectedTab].header.text===r.getConstant("Data")&&(this.ribbon.items[this.ribbon.selectedTab].content[i].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}]))},d.prototype.updateMergeItem=function(e){var t;this.parent.allowMerge&&(gd(e)||"touchmove"===e.type||e.shiftKey&&("mousedown"===e.type||"touchend"===e.type))&&!(e=this.parent.getActiveSheet()).isProtected&&((t=te(e.selectedRange))[1]===t[3]&&t[0]===t[2]?(this.enableToolbarItems([{tab:this.parent.serviceLocator.getService(T).getConstant("Home"),items:[this.parent.element.id+"_merge_cells"],enable:!1}]),this.toggleActiveState(!1)):(this.enableToolbarItems([{tab:this.parent.serviceLocator.getService(T).getConstant("Home"),items:[this.parent.element.id+"_merge_cells"],enable:!0}]),1<(e=se((t=ne(t))[0],t[1],e,!1,!0)).rowSpan||1<e.colSpan?this.toggleActiveState(!(1<e.rowSpan&&t[0]+e.rowSpan-1!==t[2]||1<e.colSpan&&t[1]+e.colSpan-1!==t[3])):this.toggleActiveState(!1)))},d.prototype.onPropertyChanged=function(e){var t,r=this.parent.serviceLocator.getService(T),n=this.parent.element.id,i=this.parent.getActiveSheet();switch(e){case"allowFreezePane":this.ribbon.enableItems(r.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(r.getConstant("Insert"),[n+"_image"],this.parent.allowImage);break;case"allowChart":this.ribbon.enableItems(r.getConstant("Insert"),[n+"_chart"],this.parent.allowChart),this.parent.allowChart||this.removeDesignChart();break;case"allowWrap":case"allowCellFormatting":this.refreshToggleBtn(W(i.activeCell)),i.isProtected&&!i.protectSettings.formatCells||("allowWrap"===e?this.ribbon.enableItems(r.getConstant("Home"),[n+"_wrap"],this.parent.allowWrap):(t=[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:r.getConstant("Home"),items:t,enable:this.parent.allowCellFormatting}])));break;case"allowNumberFormatting":i.isProtected&&!i.protectSettings.formatCells||this.ribbon.enableItems(r.getConstant("Home"),[n+"_number_format"],this.parent.allowNumberFormatting);break;case"calculationMode":this.parent.notify(Io,[{tab:r.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")}},d.prototype.addEventListener=function(){this.parent.on($i,this.ribbonOperation,this),this.parent.on(Io,this.enableToolbarItems,this),this.parent.on(Pt,this.refreshRibbonContent,this),this.parent.on(ta,this.toggleRibbonItems,this),this.parent.on(Bo,this.enableFileMenuItems,this),this.parent.on(Vo,this.hideRibbonTabs,this),this.parent.on(zo,this.addRibbonTabs,this),this.parent.on(_o,this.addToolbarItems,this),this.parent.on(Uo,this.hideFileMenuItems,this),this.parent.on(Ho,this.addFileMenuItems,this),this.parent.on(qo,this.hideToolbarItems,this),this.parent.on(jo,this.enableRibbonTabs,this),this.parent.on(Ba,this.protectSheetHandler,this),this.parent.on(dn,this.updateMergeItem,this),this.parent.on(qr,this.refreshRibbonContent,this),this.parent.on(Ns,this.insertDesignChart,this),this.parent.on(Rs,this.removeDesignChart,this),this.parent.on(gn,this.unMerge,this)},d.prototype.destroy=function(){var e,t=this.parent.element,r=this.ribbon?this.ribbon.element:null,n=this.cPickerEle,i=t.id,o=this.parent.serviceLocator.getService(T),a=ee.getComponent(t.querySelector(".e-tab"),"tab"),o=(a&&(e=a.selectedItem),this.switchRibbonTab(o.getConstant("Home")),["bold","italic","line-through","underline","cut","copy","undo","redo","wrap"].forEach(function(e){Ed(ee.select("#"+i+"_"+e,t),w.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(i+"_borders_menu","menu"),this.bordersDdb&&this.bordersDdb.destroy(),this.bordersDdb=null,this.findDdb&&this.findDdb.destroy(),this.findDdb=null,this.destroyComponent(i+"_chart_menu","menu"),this.destroyComponent(i+"_chart_type_menu","menu"),this.destroyComponent(i+"_chart-btn","dropdown-btn"),this.destroyComponent(i+"_chart-type-btn","dropdown-btn"),this.destroyComponent(i+"_cf_menu","menu"),this.cfDdb&&(this.cfDdb.destroy(),this.cfDdb.element)&&this.cfDdb.element.remove(),this.cfDdb=null,this.detachPopupElement(i),this.parent.notify("destroyRibbonComponents",null),e&&(a.selectedItem=e,a.dataBind()),this.addChartDdb&&(this.addChartDdb.destroy(),this.addChartDdb=null),this.destroyComponent(i+"_chart_theme","menu"),this.destroyComponent(i+"_chart_theme","dropdown-btn"),this.destroyComponent(i+"_chart-type-btn","menu"),this.destroyComponent(i+"_chart-type-btn","dropdown-btn"),this.datavalidationDdb&&this.datavalidationDdb.destroy(),this.datavalidationDdb=null,n&&ee.detach(n),this.parent.serviceLocator.getService(O));o.dialogInstance&&o.dialogInstance.element.classList.contains("e-custom-format-dlg")&&o.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(),r&&ee.detach(r),this.ribbon=null,this.removeEventListener(),this.parent=null},d.prototype.destroyComponent=function(e,t){var r,e="string"==typeof e?document.getElementById(e):e;e&&(("menu"!==t||e.childElementCount)&&(r=ee.getComponent(e,t))&&(r.destroy(),"dropdown-btn"===t)&&(r=document.getElementById(e.id+"-popup"))&&ee.detach(r),"menu"===t)&&ee.detach(e)},d.prototype.detachPopupElement=function(t){["_conditionalformatting","_chart-type-btn","_chart-btn","_borders"].forEach(function(e){e=document.getElementById(""+t+e+"-popup");e&&ee.detach(e)})},d.prototype.switchRibbonTab=function(e){for(var t,r=this.parent.element.querySelectorAll(".e-tab-text"),n=0;n<r.length;n++){var i=r[n];if(i.textContent.toLowerCase()===e.toLowerCase()){i=i.closest(".e-toolbar-item");if(i){t=i.getAttribute("data-id");break}}}var o=ee.getComponent(this.parent.element.querySelector(".e-tab"),"tab");o&&!ee.isNullOrUndefined(t)&&(o.selectedItem=o.getItemIndex(t),o.dataBind())},d.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off($i,this.ribbonOperation),this.parent.off(Io,this.enableToolbarItems),this.parent.off(Pt,this.refreshRibbonContent),this.parent.off(ta,this.toggleRibbonItems),this.parent.off(Bo,this.enableFileMenuItems),this.parent.off(Vo,this.hideRibbonTabs),this.parent.off(zo,this.addRibbonTabs),this.parent.off(_o,this.addToolbarItems),this.parent.off(Uo,this.hideFileMenuItems),this.parent.off(Ho,this.addFileMenuItems),this.parent.off(qo,this.hideToolbarItems),this.parent.off(jo,this.enableRibbonTabs),this.parent.off(Ba,this.protectSheetHandler),this.parent.off(dn,this.updateMergeItem),this.parent.off(qr,this.refreshRibbonContent),this.parent.off(Ns,this.insertDesignChart),this.parent.off(Rs,this.removeDesignChart),this.parent.off(gn,this.unMerge))};var xc=d;function d(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 Cc(e)}wc.prototype.getModuleName=function(){return"formulaBar"},wc.prototype.createFormulaBar=function(e){var t,r,n,i,o=this;!this.parent.showFormulaBar&&this.insertFnRipple?this.destroy():(t=this.parent.serviceLocator.getService(T),r=this.parent.element.id,n=this.parent.createElement("div",{className:"e-formula-bar-panel"}),this.parent.isMobileView()||(i=this.parent.createElement("input",{id:r+"_name_box",attrs:{type:"text"}}),n.appendChild(i),this.comboBoxInstance=new I.ComboBox({value:"A1",cssClass:"e-name-box",width:"",noRecordsTemplate:ee.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(){o.isDevice&&(window.browserDetails.isDevice=!0)},change:function(){}}),this.comboBoxInstance.createElement=this.parent.createElement,this.comboBoxInstance.appendTo(i),this.comboBoxInstance.element.parentElement.title=t.getConstant("NameBox")),n.appendChild(this.parent.createElement("button",{className:"e-btn e-css e-flat e-icon-btn e-insert-function",attrs:{title:t.getConstant("InsertFunction"),type:"button"}})).appendChild(this.parent.createElement("span",{className:"e-btn-icon e-icons"})),this.insertFnRipple=ee.rippleEffect(n,{selector:".e-insert-function"}),n.appendChild(this.parent.createElement("div",{className:"e-separator"})),i=t.getConstant("FormulaBar"),(i=n.appendChild(this.parent.createElement("textarea",{className:"e-formula-bar e-css",id:r+"_formula_input",attrs:{title:i,"aria-label":i,spellcheck:"false"}}))).rows=1,this.parent.isMobileView()?(i.placeholder=t.getConstant("MobileFormulaBarPlaceHolder"),ee.EventHandler.add(i,"focus",this.textAreaFocusIn,this),ee.EventHandler.add(i,"blur",this.textAreaFocusOut,this)):(i=t.getConstant("ExpandFormulaBar"),n.appendChild(this.parent.createElement("span",{className:"e-drop-icon e-icons",attrs:{title:i,role:"button",tabindex:"-1","aria-label":i}}))),e&&e.uiUpdate?this.parent.element.insertBefore(n,document.getElementById(r+"_sheet_panel")):this.parent.element.appendChild(n))},wc.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)},wc.prototype.textAreaFocusOut=function(){var e=this.parent.element.querySelector(".e-formula-bar-panel");e.classList.remove("e-focused"),ee.detach(e.querySelector(".e-formula-submit"))},wc.prototype.keyDownHandler=function(e){var t=e.target;!this.parent.isEdit||this.parent.getActiveSheet().isProtected&&(!t.classList.contains("e-formula-bar")||t.disabled)||(Q(t.value)||t.validity&&0===t.value.toString().indexOf("="))&&(16===e.keyCode||17===e.keyCode)||!t.classList.contains("e-formula-bar")||e.shiftKey&&(!e.shiftKey||vd(e.keyCode))||this.parent.notify(io,{action:"refreshEditor",value:t.value,refreshEditorElem:!0})},wc.prototype.keyUpHandler=function(e){var t,r;this.parent.isEdit&&(t=e.target).classList.contains("e-formula-bar")&&(this.parent.notify(io,r={action:"getCurrentEditValue",editedValue:""}),r.editedValue===t.value||16===e.keyCode||17===e.keyCode||e.shiftKey&&(!e.shiftKey||vd(e.keyCode))||this.parent.notify(io,{action:"refreshEditor",value:t.value,refreshEditorElem:!0}))},wc.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))},wc.prototype.nameBoxBlur=function(){this.comboBoxInstance.element.classList.contains("e-name-editing")&&(this.comboBoxInstance.element.classList.remove("e-name-editing"),this.updateValueAfterMouseUp())},wc.prototype.nameBoxSelect=function(e){var t,r,n,i,o;e.isInteracted&&(!e.e||"keydown"!==e.e.type||40!==e.e.keyCode&&38!==e.e.keyCode)&&(e=e.itemData.refersTo.substr(1),void 0!==(t=B(this.parent,Ei(e))))&&(e=y(e),r=ae(this.parent,t),o=i=void 0,-1===e.indexOf(":")?i=o=e.replace("$",""):(n=e.indexOf(":"),i=e.substr(0,n).replace("$",""),o=e.substr(n+1,e.length).replace("$","")),o.match(/\D/g)&&!o.match(/[0-9]/g)&&i.match(/\D/g)&&!i.match(/[0-9]/g)?e=(i+="1")+":"+(o+=r.rowCount):!o.match(/\D/g)&&o.match(/[0-9]/g)&&!i.match(/\D/g)&&i.match(/[0-9]/g)&&(e=(i=G(parseInt(i,10)-1,0))+":"+(o=G(parseInt(o,10)-1,r.colCount-1))),t===this.parent.activeSheetIndex?(this.parent.selectRange(e),ce(this.parent.element)):(Ri(this.parent,e,r),this.parent.activeSheetIndex=t))},wc.prototype.formulaBarUpdateHandler=function(i){var e,t,o=this,r=this.parent.getActiveSheet().selectedRange.split(":"),a={action:"getElement",element:null},s=(this.parent.notify(io,a),this.parent.element.querySelector(".e-formula-bar"));"mousemove"===i.type||"pointermove"===i.type?(e=te(r[0]),t=te(r[1]),e=Math.abs(e[0]-t[0])+1+"R x "+(Math.abs(e[1]-t[1])+1)+"C",this.parent.isEdit&&(i.target&&!i.target.classList.contains("e-spreadsheet-edit")?this.parent.notify(as,{}):a.element&&(s.value=a.element.textContent))):(e=r[0],t=Di(this.parent)+"!"+e,pi(this.parent,t,!1,!0).then(function(e){o.parent&&e.forEach(function(e){var e=o.getFormulaBarValue(e),t={action:"getCurrentEditValue",editedValue:""},r=(o.parent.notify(io,t),document.getElementById(o.parent.element.id+"_formula_input")),n=r.value;r.value=e,t.editedValue&&Q(t.editedValue.toString(),!0)||o.parent.notify(io,{action:"refreshEditor",value:e,refreshEditorElem:!0}),o.parent.isEdit&&(i.target&&!i.target.classList.contains("e-spreadsheet-edit")?o.parent.notify(as,{isMouseDown:fd(i),formulaBarVal:n}):a.element&&(s.value=a.element.textContent))})})),this.updateComboBoxValue(e)},wc.prototype.getFormulaBarValue=function(e){var t,r,n,i,o,a,s="";return e&&(e.formula?s=e.formula:ee.isNullOrUndefined(e.value)||""===e.value?e.hyperlink&&(s="string"==typeof e.hyperlink?e.hyperlink:e.hyperlink.address||""):(t={},"date"===(t=e.format&&Wi(e.format,!0,t,!0)&&t.type)||"time"===t||"datetime"===t?(r=ii(Number(e.value)))&&"Invalid Date"!==r.toString()&&1900<=r.getFullYear()&&(n=new ee.Internationalization,"h:mm:ss AM/PM"===(i=Pl("Time"))&&(i="h:mm:ss a"),o=e.format.toLowerCase(),"time"!==t||!o.includes("m")||o.includes(":m")||o.includes("m:")||o.includes("[m")||o.includes("am")||(t="date"),o=(a=2===(o=e.value.toString().split(".")).length)?ii(parseFloat(o[0]+1+"."+o[1])||Number(e.value)):r,"date"===t?(s=n.formatDate(r,{type:"date",skeleton:"yMd"}),a&&(s+=" "+n.formatDate(o,{type:"time",skeleton:"medium",format:i}))):((1<=Number(e.value)||"datetime"===t)&&(s=n.formatDate(r,{type:"date",skeleton:"yMd"})+" "),s+=n.formatDate(o,{type:"time",skeleton:"medium",format:i}))):e.format&&e.format.includes("%")&&oe(e.value)&&((s=this.parent.getDisplayText(e)).includes("%")||(s="")),s||("true"===(s=e.value.toString()).toLowerCase()||"false"===s.toLowerCase()?s=s.toUpperCase():"en-US"!==this.parent.locale&&"."!==(a=ee.getNumericObject(this.parent.locale).decimal)&&oe(s)&&s.includes(".")&&(s=s.replace(".",a))))),s},wc.prototype.updateValueAfterMouseUp=function(){this.updateComboBoxValue(this.parent.getActiveSheet().selectedRange.split(":")[0])},wc.prototype.updateComboBoxValue=function(e){var t=this.parent.getActiveSheet(),t={action:"getNameFromRange",range:Di(this.parent)+"!"+t.selectedRange,definedName:null};this.parent.notify(oo,t),t.definedName&&(e=t.definedName.name),this.parent.isMobileView()||this.comboBoxInstance.text!==e&&(this.comboBoxInstance.text=e,this.comboBoxInstance.dataBind())},wc.prototype.disabletextarea=function(){var e=this.getFormulaBar();this.parent.getActiveSheet().isProtected&&!this.parent.isEdit?e.disabled=!0:e.disabled=!1},wc.prototype.formulaBarScrollEdit=function(){var e=te(this.parent.getActiveSheet().selectedRange),t=W(this.parent.getActiveSheet().topLeftCell);e[0]<t[0]&&(this.parent.goTo(this.parent.getActiveSheet().selectedRange),this.isGoto=!0),this.parent.notify(io,{action:"startEdit",refreshCurPos:!1})},wc.prototype.formulaBarClickHandler=function(e){var t,e=e.target,r=this.parent.getActiveSheet(),n=r.isProtected,i=W(r.activeCell),o=se(i[0],i[1],r),a=Mn(o,de(r,i[1]));if(e.classList.contains("e-drop-icon")&&e.parentElement.classList.contains("e-formula-bar-panel"))this.toggleFormulaBar(e);else if(e.classList.contains("e-formula-bar")){if(ti(o,de(r,i[1]),Nh(r,i[0])))return void this.parent.notify(qa,null);!this.parent.isEdit&&(!n||!a)||this.parent.isEdit&&n&&!e.disabled?this.formulaBarScrollEdit():n&&a&&this.parent.notify(_a,null)}else e.parentElement&&e.parentElement.classList.contains("e-name-box")&&(e.classList.contains("e-ddl-icon")?(this.parent.notify(oo,o={action:"getNames",names:[]}),this.comboBoxInstance.dataSource.length===o.names.length&&this.comboBoxInstance.value!==this.comboBoxInstance.text||(t=this.comboBoxInstance.text,this.comboBoxInstance.dataSource=o.names,r=o.names.find(function(e){return e.name===t}),this.comboBoxInstance.value=r?r.refersTo:this.comboBoxInstance.value,this.comboBoxInstance.dataBind())):(this.comboBoxInstance.element.classList.add("e-name-editing"),this.comboBoxInstance.element.select()));!ee.isNullOrUndefined(e.offsetParent)&&(e.offsetParent.classList.contains("e-insert-function")||e.classList.contains("e-insert-function")||this.parent.element.id+"_insert_function"===e.offsetParent.id||this.parent.element.id+"_insert_function"===e.id||e.parentElement.classList.contains("e-insert-function")||this.parent.element.id+"_insert_function"===e.parentElement.id)&&this.renderInsertDlg()},wc.prototype.renderInsertDlg=function(){var e,t,r,n,i,o,a,s=this,l=this.parent.getActiveSheet(),h=W(l.activeCell);l.isProtected&&Mn(se(h[0],h[1],l),de(l,h[1]))&&!this.parent.isEdit?this.parent.notify(_a,null):ti(se(h[0],h[1],l),de(l,h[1]),Nh(l,h[0]))?this.parent.notify(qa,null):(l=this.parent.serviceLocator.getService(T),h={action:"getCurrentEditValue",editedValue:""},(t=!this.parent.isEdit)||(this.parent.notify(oo,e={action:"isFormulaEditing",isFormulaEdit:!1}),t=e.isFormulaEdit,this.parent.notify(io,h)),!t&&""!==h.editedValue||this.parent.element.querySelector(".e-spreadsheet-function-dlg")||(""===h.editedValue&&this.parent.notify(io,{action:"refreshEditor",value:"="}),e=this.parent.createElement("div",{className:"e-formula-description",id:this.parent.element.id+"_description_content"}),(t=this.parent.createElement("div",{className:"e-category-content",id:this.parent.element.id+"_category_content"})).innerText=l.getConstant("PickACategory"),h=this.parent.createElement("input",{className:"e-formula-category",id:this.parent.element.id+"_formula_category"}),r=this.parent.createElement("div",{className:"e-formula-list",id:this.parent.element.id+"_formula_list"}),(n=this.parent.createElement("div",{className:"e-description-content"})).innerText=l.getConstant("Description"),(i=this.parent.createElement("div",{className:"e-header-content"})).innerText=l.getConstant("InsertFunction"),this.parent.notify(ie,a={action:"getFormulaCategory",categoryCollection:[]}),this.categoryCollection=a.categoryCollection,this.categoryList=new I.DropDownList({dataSource:this.categoryCollection,cssClass:"e-ss-formula-category",index:0,width:"285px",popupHeight:"210px",select:this.dropDownSelect.bind(this),open:function(){return o=!0},close:function(){return o=!1}}),this.parent.notify(ie,a={action:"getLibraryFormulas",formulaCollection:[]}),this.formulaCollection=a.formulaCollection,this.formulaList=new f.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(O),this.dialog.show({header:i.outerHTML,content:t.outerHTML+h.outerHTML+r.outerHTML+n.outerHTML+e.outerHTML,width:"320px",height:"485px",cssClass:"e-spreadsheet-function-dlg",showCloseIcon:!0,isModal:!0,beforeOpen:function(e){var t={dialogName:"InsertFunctionDialog",element:e.element,target:e.target,cancel:e.cancel};s.parent.trigger("dialogBeforeOpen",t),t.cancel&&(e.cancel=!0),ce(s.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&&!o||s.selectFormula()},buttonModel:{content:l.getConstant("Ok"),isPrimary:!0}}]}),this.categoryList.appendTo("#"+this.parent.element.id+"_formula_category"),this.formulaList.appendTo("#"+this.parent.element.id+"_formula_list"),ee.EventHandler.add(this.formulaList.element,"dblclick",this.formulaClickHandler,this)))},wc.prototype.toggleFormulaBar=function(e){var t=e.parentElement,r=this.parent.serviceLocator.getService(T);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()},wc.prototype.dialogOpen=function(){var r=this;Xh(function(){var e=r.dialog.dialogInstance.element.querySelector(".e-footer-content .e-primary"),t=r.parent.serviceLocator.getService(T);e.setAttribute("aria-label",t.getConstant("InsertFunction")+" "+t.getConstant("Ok")),r.categoryList&&ce(r.categoryList.element)})},wc.prototype.dialogClose=function(){var e={action:"getCurrentEditValue",editedValue:""};this.parent.notify(io,e),"="===e.editedValue.toString().trim()&&this.parent.notify(io,{action:"refreshEditor",value:""})},wc.prototype.dialogBeforeClose=function(){ee.EventHandler.remove(this.formulaList.element,"dblclick",this.formulaClickHandler);var e=document.getElementsByClassName("e-spreadsheet-function-dlg")[0].querySelector(".e-dlg-content");e.parentNode.removeChild(e),this.categoryList.destroy(),this.categoryList=null,this.formulaList.destroy(),this.formulaList=null},wc.prototype.selectFormula=function(){var e=this.formulaList.getSelectedItems().text,t=ae(this.parent,this.parent.activeSheetIndex);this.parent.isEdit?this.parent.notify(io,{action:"refreshEditor",value:e+"(",refreshFormulaBar:!0,refreshEditorElem:!0,isAppend:!0}):(this.parent.notify(io,{action:"startEdit",value:"="+e+"(",address:t.activeCell}),this.parent.notify(ao,{action:"refreshFormulabar",value:"="+e+"("})),this.dialog.dialogInstance.storeActiveElement=document.getElementById(this.parent.element.id+"_edit"),this.dialog.hide()},wc.prototype.listSelected=function(e){this.updateFormulaDescription(),e.isInteracted&&e.item&&e.item.focus()},wc.prototype.updateFormulaList=function(){this.activeListFormula(),this.updateFormulaDescription()},wc.prototype.dropDownSelect=function(e){this.formulaCollection=[];var t={action:"getLibraryFormulas",formulaCollection:[]};"All"===e.item.textContent?(this.parent.notify(ie,t),this.formulaCollection=t.formulaCollection):(t={action:"dropDownSelectFormulas",formulaCollection:[],selectCategory:e.item.textContent},this.parent.notify(ie,t),this.formulaCollection=t.formulaCollection),this.formulaList.dataSource=this.formulaCollection.sort()},wc.prototype.activeListFormula=function(){var e=document.getElementById(this.parent.element.id+"_formula_list").children[0].children[0].firstElementChild;this.formulaList.selectItem(e)},wc.prototype.updateFormulaDescription=function(){var e={action:"getFormulaDescription",description:"",selectedList:r=this.formulaList.getSelectedItems().text,isCustom:!1},t=(this.parent.notify(ie,e),this.dialog.dialogInstance.element.querySelector(".e-footer-content .e-primary"));t.hasAttribute("aria-label")&&t.removeAttribute("aria-label");var r="AND"===r?"CalculateAND":"OR"===r?"CalculateOR":r;document.getElementById(this.parent.element.id+"_description_content").textContent=e.isCustom?e.description:this.parent.serviceLocator.getService(T).getConstant(r)},wc.prototype.formulaClickHandler=function(e){var e=e.target,t=ae(this.parent,this.parent.activeSheetIndex);(e.offsetParent.classList.contains("e-text-content")||e.classList.contains("e-list-item"))&&(this.parent.isEdit?this.parent.notify(io,{action:"refreshEditor",value:e.innerText+"(",refreshFormulaBar:!0,refreshEditorElem:!0,isAppend:!0}):(this.parent.notify(io,{action:"startEdit",value:"="+e.innerText+"(",address:t.activeCell}),this.parent.notify(ao,{action:"refreshFormulabar",value:"="+e.innerText+"("})),this.dialog.hide())},wc.prototype.addEventListener=function(){this.parent.on(Zi,this.createFormulaBar,this),this.parent.on(so,this.formulaBarClickHandler,this),this.parent.on(ho,this.keyDownHandler,this),this.parent.on(Js,this.renderInsertDlg,this),this.parent.on(lo,this.keyUpHandler,this),this.parent.on(dn,this.formulaBarUpdateHandler,this),this.parent.on(yo,this.updateValueAfterMouseUp,this),this.parent.on(ao,this.editOperationHandler,this),this.parent.on(Ga,this.disabletextarea,this),this.parent.on(eo,this.isFormulaBarEdit,this)},wc.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 e=this.parent.element.querySelector(".e-formula-bar-panel");e&&(Kh(e),ee.detach(e)),this.parent=null},wc.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(Zi,this.createFormulaBar),this.parent.off(so,this.formulaBarClickHandler),this.parent.off(Js,this.renderInsertDlg),this.parent.off(ho,this.keyDownHandler),this.parent.off(lo,this.keyUpHandler),this.parent.off(dn,this.formulaBarUpdateHandler),this.parent.off(yo,this.updateValueAfterMouseUp),this.parent.off(ao,this.editOperationHandler),this.parent.off(Ga,this.disabletextarea),this.parent.off(eo,this.isFormulaBarEdit))},wc.prototype.editOperationHandler=function(e){switch(e.action){case"refreshFormulabar":e.cell?this.getFormulaBar().value=this.getFormulaBarValue(e.cell):this.getFormulaBar().value=ee.isUndefined(e.value)?"":e.value;break;case"getElement":e.element=this.getFormulaBar()}},wc.prototype.isFormulaBarEdit=function(e){this.parent.isEdit&&this.isGoto?e.isEdit=!0:e.isEdit=!1},wc.prototype.getFormulaBar=function(){return ee.select("#"+this.parent.element.id+"_formula_input",this.parent.element)};var Sc=wc;function wc(e){this.categoryCollection=[],this.formulaCollection=[],this.isGoto=!1,this.parent=e,this.addEventListener()}Ec.prototype.getModuleName=function(){return"formula"},Ec.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},Ec.prototype.addEventListener=function(){this.parent.on(oo,this.performFormulaOperation,this),this.parent.on(lo,this.keyUpHandler,this),this.parent.on(ho,this.keyDownHandler,this),this.parent.on(so,this.formulaClick,this),this.parent.on(Ta,this.refreshFormulaDatasource,this)},Ec.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(oo,this.performFormulaOperation),this.parent.off(lo,this.keyUpHandler),this.parent.off(ho,this.keyDownHandler),this.parent.off(so,this.formulaClick),this.parent.off(Ta,this.refreshFormulaDatasource))},Ec.prototype.performFormulaOperation=function(e){var t=this,r=e.action,n=this.parent.serviceLocator.getService(T);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=Di(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,o=this.parent.serviceLocator.getService(O),a=n.getConstant("CircularReference"),s=function(e){t.parent.trigger("dialogBeforeOpen",e),e.content!==a&&(o.dialogInstance.content=e.content,o.dialogInstance.dataBind())},l=o.dialogInstance;l&&l.visible&&l.element.classList.contains("e-circularref-dlg")?s({dialogName:"CircularReferenceDialog",element:l.element,target:this.parent.element,cancel:!1,cellAddress:e.address,content:a}):(i=e.address,o.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:i,content:a};s(t),t.cancel&&(e.cancel=!0,o.hide(!0))}})),e.argValue="0"}},Ec.prototype.renderAutoComplete=function(){var e,t;ee.select("#"+this.parent.element.id+"_ac",this.parent.element)||(e=this.parent.createElement("input",{id:this.parent.element.id+"_ac",className:"e-ss-ac"}),this.parent.element.appendChild(e),this.parent.notify(ie,t={action:"getLibraryFormulas",formulaCollection:[]}),t={dataSource:t.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 I.AutoComplete(t,e),this.autocompleteInstance.createElement=this.parent.createElement,this.acInputElement=e)},Ec.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(Gh.DOWN)})},Ec.prototype.onSuggestionClose=function(e){this.isPreventClose?e.cancel=!0:this.isPopupOpened=!1},Ec.prototype.onSelect=function(e){var t,r,n="="+e.itemData.value+"(";this.isSubFormula&&((-1<(t=(r=this.getEditingValue()).lastIndexOf(this.parent.listSeparator))||-1<(t=r.lastIndexOf("(")))&&(n=r.slice(0,t+1)),n+=e.itemData.value+"("),this.parent.notify(io,{action:"refreshEditor",value:n,refreshFormulaBar:!0,refreshEditorElem:!0,refreshCurPos:!this.isFormulaBar}),this.isPopupOpened&&(this.hidePopUp(),(r=ee.select("#"+this.parent.element.id+"_ac_popup"))&&ee.detach(r),this.isPopupOpened=!1)},Ec.prototype.onSuggestionComplete=function(e){this.isPreventClose=0<e.result.length,this.isPreventClose||(e.cancel=!0,this.hidePopUp())},Ec.prototype.refreshFormulaDatasource=function(){var e={action:"getLibraryFormulas",formulaCollection:[]};this.parent.notify(ie,e),this.autocompleteInstance&&(this.autocompleteInstance.dataSource=e.formulaCollection)},Ec.prototype.keyUpHandler=function(e){var t;this.parent.isEdit?(t=this.getEditingValue(),this.isFormula=Q(t),(this.isFormula||this.isPopupOpened)&&(e.keyCode!==Gh.TAB&&this.isFormula&&(t=this.getSuggestionKeyFromFormula(t)),this.refreshFormulaSuggestion(e,t))):this.isPopupOpened&&this.hidePopUp()},Ec.prototype.keyDownHandler=function(e){var t=e.keyCode;if(this.isFormula){if(this.isPopupOpened)switch(t){case Gh.UP:case Gh.DOWN:e.preventDefault(),this.triggerKeyDownEvent(t);break;case Gh.TAB:e.preventDefault(),this.triggerKeyDownEvent(Gh.ENTER)}}else{var r=e.target;if(r.id===this.parent.element.id+"_name_box")switch(t){case Gh.ENTER:document.querySelector(".e-name-box.e-popup-open")||(this.addDefinedName({name:r.value}),ce(this.parent.element));break;case Gh.ESC:ce(this.parent.element)}}},Ec.prototype.formulaClick=function(e){this.parent.isEdit&&(e=e.target,this.isFormulaBar=e.classList.contains("e-formula-bar"))},Ec.prototype.refreshFormulaSuggestion=function(e,t){var r,n;0<t.length?(r=this.autocompleteInstance.element,e=e.keyCode,n=this.isPopupOpened,vd(e)||(r.value=t,r.dispatchEvent(new Event("input")),r.dispatchEvent(new Event("keyup")),n&&this.triggerKeyDownEvent(Gh.DOWN))):this.isPopupOpened&&(this.isPreventClose=!1,this.hidePopUp())},Ec.prototype.endEdit=function(){var e;this.isSubFormula=!1,this.isPreventClose=!1,this.isFormula=!1,this.isFormulaBar=!1,this.isPopupOpened&&(this.hidePopUp(),(e=ee.select("#"+this.parent.element.id+"_ac_popup"))&&ee.detach(e),this.isPopupOpened=!1)},Ec.prototype.hidePopUp=function(){this.autocompleteInstance.hidePopup()},Ec.prototype.getSuggestionKeyFromFormula=function(e){var t,r="";return(e=e.substr(1))&&(t=e.lastIndexOf("("),1===(e=(e=e.substr(t+1)).split(this.parent.listSeparator)).length?(r=e[0],this.isSubFormula=-1<t):(r=e[e.length-1],this.isSubFormula=!0),(t=r.match(/\w/))&&0===t.index||(r="")),r},Ec.prototype.getRelateToElem=function(){var e={action:"getElement"};return this.isFormulaBar?this.parent.notify(ao,e):this.parent.notify(io,e),e.element},Ec.prototype.getEditingValue=function(){var e={action:"getCurrentEditValue",editedValue:""};return this.parent.notify(io,e),e.editedValue},Ec.prototype.triggerKeyDownEvent=function(e){var t=this.autocompleteInstance.element,r=(t.dispatchEvent(new Event("input")),new Event("keydown"));r.keyCode=e,r.which=e,r.altKey=!1,r.shiftKey=!1,r.ctrlKey=!1,t.dispatchEvent(r)},Ec.prototype.getNames=function(t){return this.parent.definedNames.filter(function(e){return"Workbook"===e.scope||""===e.scope||e.scope===t})},Ec.prototype.getNameFromRange=function(t){var r,n,i=t.slice(0,t.indexOf(":")),e=t.substring(t.lastIndexOf("!")+1).split(":"),o=1<e.length&&e[0]===e[1],e=this.parent.definedNames.filter(function(e){r=e.refersTo.substring(0,e.refersTo.lastIndexOf("!")),n=e.refersTo.substring(e.refersTo.lastIndexOf("!")+1);e=(r=r.includes("'")&&r.match(/^='.*'$/)?"="+r.slice(2,-1):r)+"!"+n.split("$").join("");return o&&e=="="+i||e=="="+t});return e&&e[0]},Ec.prototype.addDefinedName=function(e){var t,r,n,i,o,a=this,s=e.name,l=!1;return s&&Fn(s.toUpperCase())?this.parent.goTo(s):(e.refersTo||(o=ae(this.parent,this.parent.activeSheetIndex),t=-1!==(t=Di(this.parent)).indexOf(" ")?"'"+t+"'":t,i=o.selectedRange,ee.isNullOrUndefined(i)||(n=i.indexOf(":"),r=i.substr(0,n),n=i.substr(n+1,i.length),i=parseInt(n.replace(/\D/g,""),10)===o.rowCount&&1===parseInt(r.replace(/\D/g,""),10)?(n=n.replace(/[0-9]/g,""),"$"+(r=r.replace(/[0-9]/g,""))+":$"+n):W(n)[1]===o.colCount-1&&0===W(r)[1]?(n=n.replace(/\D/g,""),"$"+(r=r.replace(/\D/g,""))+":$"+n):r===n?r:i),e.refersTo=t+"!"+i,e.scope="Workbook"),0<s.length&&/^([a-zA-Z_0-9.]){0,255}$/.test(s)?(this.parent.notify(ie,o={action:"addDefinedName",definedName:e,isAdded:!1}),(l=o.isAdded)||this.parent.serviceLocator.getService(O).show({content:this.parent.serviceLocator.getService(T).getConstant("DefineNameExists"),width:"300",beforeOpen:function(e){var t={dialogName:"DefineNameExistsDialog",element:e.element,target:e.target,cancel:e.cancel};a.parent.trigger("dialogBeforeOpen",t),t.cancel&&(e.cancel=!0)}})):this.parent.serviceLocator.getService(O).show({content:this.parent.serviceLocator.getService(T).getConstant("DefineNameInValid"),width:"300",beforeOpen:function(e){var t={dialogName:"DefineNameInValidDialog",element:e.element,target:e.target,cancel:e.cancel};a.parent.trigger("dialogBeforeOpen",t),t.cancel&&(e.cancel=!0)}})),l};var Ic=Ec;function Ec(e){this.isFormulaBar=!1,this.isFormula=!1,this.isPopupOpened=!1,this.isPreventClose=!1,this.isSubFormula=!1,this.parent=e,this.addEventListener()}Rc.prototype.getModuleName=function(){return"sheetTabs"},Rc.prototype.createSheetTabs=function(){var r=this;if(!this.parent.showSheetTabs&&this.tabInstance)this.destroy();else{for(var t,n=this.parent.serviceLocator.getService(T),e=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:n.getConstant("AddSheet"),type:"button"}}),i=(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,e.appendChild(i),this.addBtnRipple=ee.rippleEffect(e,{selector:".e-add-sheet-tab"}),this.parent.createElement("button",{attrs:{title:n.getConstant("ListAllSheets"),type:"button"}})),o=(e.appendChild(i),this.parent.element.appendChild(e),this.getSheetTabItems()),i=(this.dropDownInstance=new m.DropDownButton({iconCss:"e-icons",items:o.ddbItems,createPopupOnClick:!0,beforeItemRender:function(e){var t=r.parent.sheets[r.dropDownInstance.items.indexOf(e.item)];"Hidden"===t.state?e.element.classList.add("e-hide"):"VeryHidden"===t.state&&(e.element.style.display="none")},select:function(e){return r.updateSheetTab({idx:r.dropDownInstance.items.indexOf(e.item)})},beforeOpen:function(e){return r.beforeOpenHandler(r.dropDownInstance,e.element,n.getConstant("ListAllSheets"))},open:function(e){return r.openHandler(r.dropDownInstance,e.element,"left")},cssClass:"e-sheets-list e-flat e-caret-hide",close:function(){return r.focusTab(r.tabInstance.element)}}),this.dropDownInstance.createElement=this.parent.createElement,this.dropDownInstance.appendTo(i),this.parent.createElement("div",{className:"e-sheet-tab"})),a=(this.tabInstance=new D.Tab({selectedItem:this.parent.activeSheetIndex,overflowMode:"Scrollable",items:o.tabItems,scrollStep:250,selecting:function(e){e.selectingIndex!==e.selectedIndex&&(t=!t&&(e={currentSheetIndex:e.selectingIndex,previousSheetIndex:e.selectedIndex,cancel:!1},r.parent.notify(gt,{eventArgs:e,action:"gotoSheet"}),e.cancel))},selected:function(e){e.isInteracted||(e.preventFocus=!0),r.goToSheet(e,t,!0)},created:function(){var e=r.tabInstance.element.querySelector(".e-toolbar-items");e.classList.add("e-sheet-tabs-items"),ee.EventHandler.add(e,"dblclick",r.renameSheetTab,r)}}),e.appendChild(i),this.tabInstance.createElement=this.parent.createElement,this.tabInstance.appendTo(i),ee.EventHandler.remove(this.tabInstance.element,"keydown",this.tabInstance.spaceKeyDown),o.tabItems.length),s=0;s<a;s++){var l={action:"addSheet",sheetName:"Sheet"+(l=ae(this.parent,s)).id,sheetId:l.id,visibleName:l.name};this.parent.notify(ie,l)}this.parent.notify(ie,{action:"initiateDefinedNames"}),this.parent.notify(Pa,null)}},Rc.prototype.goToSheet=function(e,t,r){var n,i=this;e.selectedIndex!==e.previousIndex&&(t?(this.tabInstance.selectedItem=e.previousIndex,this.tabInstance.dataBind(),ce(this.parent.element)):(this.parent.notify(Rs,{}),!this.parent.isEdit||(t=window.getSelection(),this.parent.notify(io,n={action:"getCurrentEditValue",editedValue:""}),n=!(n=!!n.editedValue&&Q(n.editedValue,!0))&&t&&t.focusNode&&t.focusNode.classList&&t.focusNode.classList.contains("e-formula-bar-panel")?Q(this.parent.element.querySelector(".e-formula-bar").value,!0):n)||this.parent.endEdit(),this.parent.activeSheetIndex=e.selectedIndex,this.parent.dataBind(),this.updateDropDownItems(e.selectedIndex,e.previousIndex),t={action:"registerGridInCalc",sheetID:(e.selectedIndex+1).toString()},this.parent.notify(ie,t),r&&(this.parent.notify(le,{eventArgs:{previousSheetIndex:e.previousIndex,currentSheetIndex:e.selectedIndex},action:"gotoSheet"}),Xh(function(){ce(i.parent.element)}))))},Rc.prototype.updateDropDownItems=function(e,t){-1<t&&(this.dropDownInstance.items[t].iconCss=""),this.dropDownInstance.items[e].iconCss="e-selected-icon e-icons",this.dropDownInstance.setProperties({items:this.dropDownInstance.items},!0)},Rc.prototype.beforeOpenHandler=function(e,t,r){var n=this.parent.viewport.height;n<parseInt(getComputedStyle(t.firstElementChild).height,10)*e.items.length+2*parseInt(getComputedStyle(t).paddingTop,10)&&(t.style.height=n+"px",t.style.overflowY="auto"),t.parentElement.style.visibility="hidden",r&&t.setAttribute("aria-label",r)},Rc.prototype.openHandler=function(e,t,r){var n,i=t.parentElement;-1===g.isCollide(i).indexOf("bottom")&&(n=("auto"===t.style.overflowY?this.parent.viewport:i.getBoundingClientRect()).height,e=g.calculatePosition(e.element,r,"top"),"right"===r&&(e.left-=i.getBoundingClientRect().width),i.style.left=e.left+"px",i.style.top=e.top-n+"px"),i.style.visibility="",ce(t)},Rc.prototype.getSheetTabItems=function(){var r,n=this,i=[],o=[];return this.parent.sheets.forEach(function(e,t){r=Di(n.parent,t).replace(/</g,"&lt;").replace(/>/g,"&gt;"),i.push({header:{text:r},visible:"Visible"===e.state}),o.push({text:r,iconCss:t===n.parent.activeSheetIndex?"e-selected-icon e-icons":""})}),{tabItems:i,ddbItems:o}},Rc.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()},Rc.prototype.addSheetTab=function(){this.parent.notify(lr,{model:this.parent,start:this.parent.activeSheetIndex+1,end:this.parent.activeSheetIndex+1,modelType:"Sheet",isAction:!0,activeSheetIndex:this.parent.activeSheetIndex+1})},Rc.prototype.insertSheetTab=function(e){this.parent.notify(Rs,{}),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,"&lt;").replace(/>/g,"&gt;");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})},Rc.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(Pa,null)},Rc.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(le,{action:"showSheet",eventArgs:{sheetIndex:e.sheetIndex}})},Rc.prototype.switchSheetTab=function(e){var t=ee.closest(e.event.target,".e-toolbar-item");if(t){for(var r=t.querySelector(".e-tab-text").textContent,t=[],n=this.parent.element.id+"_cmenu",i=0,o=this.parent.sheets.length;i<o;i++)if(this.parent.sheets[i].name===r){this.parent.activeSheetIndex!==i&&this.updateSheetTab({idx:i});break}e.element.classList.contains("e-contextmenu")&&e.items[0]&&e.items[0].id===this.parent.element.id+"_cmenu_insert_sheet"&&(1===this.skipHiddenSheets()&&t.push(n+"_hide_sheet",n+"_delete_sheet"),this.parent.allowInsert&&!this.parent.isProtected||t.push(n+"_insert_sheet"),!this.parent.allowDelete)&&-1<t.indexOf(n+"_delete_sheet")&&t.push(n+"_delete_sheet"),(0<this.parent.password.length||this.parent.isProtected)&&(-1<t.indexOf(n+"_insert_sheet")&&t.push(n+"_insert_sheet"),-1<t.indexOf(n+"_delete_sheet")&&t.push(n+"_delete_sheet"),t.push(n+"_duplicate",n+"_rename",n+"_hide_sheet",n+"_delete_sheet",n+"_insert_sheet",n+"_move_left",n+"_move_right")),this.parent.enableContextMenuItems(t,!1,!0)}},Rc.prototype.skipHiddenSheets=function(){var t=this.parent.sheets.length;return this.parent.sheets.forEach(function(e){"Visible"!==e.state&&--t}),t},Rc.prototype.renameSheetTab=function(){var e,t,r=this.tabInstance.element.querySelector(".e-toolbar-item.e-active");r&&(t={eventArgs:{name:e=(r=r.querySelector(".e-text-wrap")).querySelector(".e-tab-text").textContent,index:this.parent.getActiveSheet().id},action:"renameSheet",cancel:!1},this.parent.trigger("actionBegin",t),t.cancel||this.parent.isProtected||(t=this.parent.createElement("input",{id:this.parent.element.id+"_rename_input",className:"e-input e-sheet-rename",styles:"width: "+r.getBoundingClientRect().width+"px",attrs:{type:"text",name:"Rename",required:"",value:e,spellcheck:"false",maxlength:"31"}}),r.firstElementChild.style.display="none",r.appendChild(t),ee.EventHandler.add(document,"mousedown touchstart",this.renameInputFocusOut,this),ee.EventHandler.add(t,"keydown",this.renameKeyDown,this),ee.EventHandler.add(t,"input",this.updateWidth,this),t.focus(),t.setSelectionRange(0,e.length),ee.EventHandler.remove(ee.closest(r,".e-toolbar-items"),"dblclick",this.renameSheetTab)))},Rc.prototype.updateWidth=function(e){var e=e.target,t=e.value.length,r=e.value.split(" ");r.length&&(t=t-(r=r.length-1)+.5*r),e.style.width=t+"ch"},Rc.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)},Rc.prototype.renameInputFocusOut=function(e){var t=e.target;if("mousedown"!==e.type&&"touchstart"!==e.type||!t.classList.contains("e-sheet-rename")&&!ee.closest(t,".e-dlg-container")){var r=(t=document.getElementById(this.parent.element.id+"_rename_input")).value,n=this.parent.serviceLocator.getService(T);if(r){var i=this.tabInstance.selectedItem;if(r.match(new RegExp(".*[\\[\\]\\*\\\\/\\?].*")))this.showRenameDialog(t,n.getConstant("SheetRenameInvalidAlert"));else{if(this.parent.sheets[i].name!==r)for(var o=0,a=this.parent.sheets.length;o<a;o++)if(o!==this.parent.activeSheetIndex&&this.parent.sheets[o].name.toLowerCase()===r.toLowerCase())return void this.showRenameDialog(t,n.getConstant("SheetRenameAlreadyExistsAlert"));var s=this.removeRenameInput(t);this.parent.sheets[i].name!==r&&(this.parent.setSheetPropertyOnMute(this.parent.sheets[i],"name",r),this.updateSheetName({value:r,idx:i,items:s})),"keydown"===e.type?this.focusTab(s):ee.closest(e.target,".e-spreadsheet")&&ce(this.parent.element)}}else this.showRenameDialog(t,n.getConstant("SheetRenameEmptyAlert"));this.parent.notify(le,{eventArgs:{index:this.parent.getActiveSheet().id,value:r},action:"renameSheet"})}},Rc.prototype.focusTab=function(e){ce(ee.select(".e-toolbar-item.e-active .e-tab-wrap",e))},Rc.prototype.updateSheetName=function(t){var r,n,i=this.tabInstance.items[t.idx].header.text.replace(/&lt;/g,"<").replace(/&gt;/g,">"),e=t.value.replace(/</g,"&lt;").replace(/>/g,"&gt;"),e=(this.tabInstance.items[t.idx].header.text=e,this.dropDownInstance.items[t.idx].text=e,this.dropDownInstance.setProperties({items:this.dropDownInstance.items},!0),t.items.querySelectorAll(".e-toolbar-item")[t.idx].querySelector(".e-tab-text"));e.textContent="",e.appendChild(document.createTextNode(t.value)),-1<t.value.indexOf(" ")?this.tabInstance.setProperties({items:this.tabInstance.items},!0):this.tabInstance.dataBind(),this.parent.notify(ie,{action:"renameUpdation",value:t.value,pName:i}),this.parent.allowChart&&(r=[],this.parent.chartColl.forEach(function(e){e.range.includes("!")&&(n=e.range.lastIndexOf("!"),r[0]=e.range.substring(0,n),r[1]=e.range.substring(n+1),r[0].toLowerCase()===i.toLowerCase())&&(r[0]=t.value,e.range=r.join("!"))}))},Rc.prototype.hideSheet=function(e){var t={action:"hideSheet",eventArgs:{sheetIndex:e.sheetIndex,cancel:!1}};e.triggerEvent&&(this.parent.notify(gt,t),t.eventArgs.cancel)||(this.parent.setSheetPropertyOnMute(ae(this.parent,e.sheetIndex),"state","Hidden"),this.tabInstance.hideTab(e.sheetIndex),e.triggerEvent&&(delete t.eventArgs.cancel,this.parent.notify(le,t)))},Rc.prototype.removeRenameInput=function(e){var t=e.parentElement.querySelector(".e-tab-text"),r=ee.closest(e,".e-toolbar-items");return ee.EventHandler.add(r,"dblclick",this.renameSheetTab,this),ee.EventHandler.remove(document,"mousedown touchstart",this.renameInputFocusOut),ee.EventHandler.remove(e,"keydown",this.renameKeyDown),ee.EventHandler.remove(e,"input",this.updateWidth),ee.remove(e),t.style.display="",r},Rc.prototype.showRenameDialog=function(r,n){var i=this;this.parent.serviceLocator.getService(O).show({height:180,width:400,isModal:!0,showCloseIcon:!0,content:n,beforeOpen:function(e){var t={dialogName:"SheetRenameDialog",element:e.element,target:e.target,cancel:e.cancel};i.parent.trigger("dialogBeforeOpen",t),t.cancel&&(e.cancel=!0),e.element.querySelector(".e-footer-content .e-primary").setAttribute("aria-label",n+" "+i.parent.serviceLocator.getService(T).getConstant("Ok")),r.focus()},close:function(){return r.setSelectionRange(0,r.value.length)}})},Rc.prototype.focusRenameInput=function(){var e=document.getElementById(this.parent.element.id+"_rename_input");e&&e.focus()},Rc.prototype.removeSheetTab=function(e){var r,t,n,i,o,a=this;e.count&&e.count===this.parent.sheets.length||(r=this.parent.serviceLocator.getService(T),1<this.skipHiddenSheets()?(t=e.sheetName?ae(this.parent,B(this.parent,e.sheetName)):this.parent.getActiveSheet(),n=ee.isNullOrUndefined(e.index)?B(this.parent,t.name):e.index,i={index:n,sheetCount:this.parent.sheets.length,sheetName:t.name},!!(t.rows&&t.rows.length&&(1!==t.rows.length||t.rows[0].cells&&t.rows[0].cells.length))?(o=this.parent.serviceLocator.getService(O),e.clicked?this.forceDelete(n):o.show({height:200,width:400,isModal:!0,showCloseIcon:!0,cssClass:"e-delete-sheet-dlg",content:r.getConstant("DeleteSheetAlert"),beforeOpen:function(e){var t={dialogName:"DeleteSheetDialog",element:e.element,target:e.target,cancel:e.cancel};a.parent.trigger("dialogBeforeOpen",t),t.cancel&&(e.cancel=!0),e.element.querySelector(".e-footer-content .e-primary").setAttribute("aria-label",r.getConstant("DeleteSheetAlert")+" "+r.getConstant("Ok")),ce(a.parent.element)},buttons:[{buttonModel:{content:r.getConstant("Ok"),isPrimary:!0},click:function(){o.hide(),a.forceDelete(n),a.parent.notify(ba,null),e&&!e.isAction&&(i.sheetCount=a.parent.sheets.length,a.parent.notify(le,{eventArgs:i,action:"removeSheet"}))}}]})):(this.parent.notify(pn,{startIndex:n,endIndex:n,modelType:"Sheet",isDelete:!0}),this.parent.notify(ie,{action:"deleteSheetTab",sheetId:ae(this.parent,n).id}),this.destroySheet(n),this.parent.notify(ba,null),e&&!e.isAction&&(i.sheetCount=this.parent.sheets.length,this.parent.notify(le,{eventArgs:i,action:"removeSheet"})))):this.parent.serviceLocator.getService(O).show({height:180,width:400,isModal:!0,showCloseIcon:!0,content:r.getConstant("DeleteSingleLastSheetAlert"),beforeOpen:function(e){var t={dialogName:"DeleteSingleSheetDialog",element:e.element,target:e.target,cancel:e.cancel};a.parent.trigger("dialogBeforeOpen",t),t.cancel&&(e.cancel=!0)}}))},Rc.prototype.forceDelete=function(e){this.parent.notify(Rs,{}),this.parent.notify(pn,{startIndex:e,endIndex:e,modelType:"Sheet",isDelete:!0}),this.parent.notify(ie,{action:"deleteSheetTab",sheetId:ae(this.parent,e).id}),this.destroySheet(e)},Rc.prototype.destroySheet=function(e){e=ee.isNullOrUndefined(e)?this.parent.activeSheetIndex:e,this.parent.removeSheet(e),this.parent.notify(Ht,{sheetIndex:e}),this.dropDownInstance.items.splice(e,1),this.dropDownInstance.setProperties({items:this.dropDownInstance.items},!0),this.tabInstance.removeTab(e),e=this.parent.skipHiddenSheets(this.tabInstance.selectedItem);this.parent.activeSheetIndex=e,this.parent.setProperties({activeSheetIndex:e},!0),this.parent.renderModule.refreshSheet(),this.tabInstance.selectedItem=e,this.tabInstance.dataBind(),this.updateDropDownItems(e),this.parent.notify(Pa,null)},Rc.prototype.showAggregate=function(e){var t,r,n,i=this;!(fe(te(this.parent.getActiveSheet().selectedRange))||e&&e.remove)&&(t={Count:0,Sum:"0",Avg:"0",Min:"0",Max:"0",countOnly:!0},this.parent.notify(Vt,t),1<t.Count)?(this.aggregateContent=t.countOnly?"Count":this.selaggregateCnt,t.countOnly&&(this.aggregateContent="Count",delete t.Sum,delete t.Avg,delete t.Min,delete t.Max),e=t.countOnly?"e-aggregate-list e-flat e-aggregate-list-countonly e-caret-hide":"e-aggregate-list e-flat",delete t.countOnly,r=(r=this.aggregateContent)+": "+t[r.toString()],this.aggregateDropDown?this.updateAggregateContent(r,t):(n=this.parent.createElement("button",{id:this.parent.element.id+"_aggregate",attrs:{type:"button"}}),document.getElementById(this.parent.element.id+"_sheet_tab_panel").appendChild(n),this.aggregateDropDown=new m.DropDownButton({content:r,items:this.getAggregateItems(t),createPopupOnClick:!0,select:function(e){i.parent.notify(Vt,t),i.updateAggregateContent(e.item.text,{Count:t.Count,Sum:t.Sum,Avg:t.Avg,Min:t.Min,Max:t.Max},!0)},beforeOpen:function(e){return i.beforeOpenHandler(i.aggregateDropDown,e.element)},open:function(e){return i.openHandler(i.aggregateDropDown,e.element,"right")},close:function(){return ce(i.parent.element)},cssClass:e}),this.aggregateDropDown.createElement=this.parent.createElement,this.aggregateDropDown.appendTo(n))):this.removeAggregate()},Rc.prototype.getAggregateItems=function(t){var r,n,i=this,o=[];return Object.keys(t).forEach(function(e){(n=t[""+e])!==Vt&&(n=e+": "+n,r=e===i.aggregateContent?"e-selected-icon e-icons":"",o.push({text:n,iconCss:r}))}),o},Rc.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)},Rc.prototype.removeAggregate=function(){ee.isNullOrUndefined(this.aggregateDropDown)||(this.aggregateDropDown.destroy(),ee.remove(this.aggregateDropDown.element),this.aggregateDropDown=null)},Rc.prototype.addEventListener=function(){this.parent.on(Ji,this.createSheetTabs,this),this.parent.on(Qi,this.refreshSheetTab,this),this.parent.on(bo,this.insertSheetTab,this),this.parent.on(xo,this.removeSheetTab,this),this.parent.on(So,this.renameSheetTab,this),this.parent.on(Co,this.switchSheetTab,this),this.parent.on($o,this.updateSheetTab,this),this.parent.on(Pt,this.removeAggregate,this),this.parent.on(uo,this.focusRenameInput,this),this.parent.on(fa,this.updateSheetName,this),this.parent.on(ga,this.hideSheet,this),this.parent.on(Ja,this.showAggregate,this),this.parent.on(Qa,this.goToSheet,this),this.parent.on(es,this.showSheet,this)},Rc.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,ee.EventHandler.remove(document,"mousedown touchstart",this.renameInputFocusOut);var e=document.getElementById(this.parent.element.id+"_sheet_tab_panel");e&&ee.remove(e),this.selaggregateCnt&&(this.selaggregateCnt=null),this.parent=null},Rc.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(Ji,this.createSheetTabs),this.parent.off(Qi,this.refreshSheetTab),this.parent.off(bo,this.insertSheetTab),this.parent.off(xo,this.removeSheetTab),this.parent.off(So,this.renameSheetTab),this.parent.off(Co,this.switchSheetTab),this.parent.off($o,this.updateSheetTab),this.parent.off(Pt,this.removeAggregate),this.parent.off(uo,this.focusRenameInput),this.parent.off(fa,this.updateSheetName),this.parent.off(ga,this.hideSheet),this.parent.off(Ja,this.showAggregate),this.parent.off(Qa,this.goToSheet),this.parent.off(es,this.showSheet))};var Nc=Rc;function Rc(e){this.aggregateContent="",this.selaggregateCnt="Sum",this.parent=e,this.addEventListener()}kc.prototype.addEventListener=function(){this.parent.on(Mt,this.openSuccess,this),this.parent.on(Bt,this.openFailed,this),this.parent.on(Ht,this.sheetsDestroyHandler,this)},kc.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(Mt,this.openSuccess),this.parent.off(Bt,this.openFailed),this.parent.off(Ht,this.sheetsDestroyHandler))},kc.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"},kc.prototype.fileSelect=function(e){e=e.target.files[0];e&&e.length<1||(this.parent.open({file:e}),ee.select("#"+this.parent.element.id+"_fileUpload",this.parent.element).value="")},kc.prototype.openSuccess=function(t){function e(e){r.parent.serviceLocator.getService(O).hide(!0),e=new File([],t.guid,{type:e.toLowerCase()}),r.parent.open({file:e,guid:t.guid,password:t.eventArgs.password,orginalFile:t.eventArgs.file})}var r=this,n=["UnsupportedFile","InvalidUrl","NeedPassword","InCorrectPassword","InCorrectSheetPassword","CorrectSheetPassword","DataLimitExceeded","FileSizeLimitExceeded","ExternalWorkbook"];if(-1<n.indexOf(t.data)){var i,o=this.parent.serviceLocator.getService(T);if(n[2]===t.data)this.parent.element.querySelector(".e-importprotectworkbook-dlg")||this.parent.notify(Ms,t.eventArgs);else if(n[3]===t.data)(i=this.parent.createElement("span",{className:"e-importprotectpwd-alert-span"})).innerText=o.getConstant("IncorrectPassword"),this.parent.element.querySelector(".e-importprotectworkbook-dlg").querySelector(".e-dlg-content").appendChild(i);else if(n[4]===t.data)(i=this.parent.createElement("span",{className:"e-unprotectsheetpwd-alert-span"})).innerText=o.getConstant("IncorrectPassword"),this.parent.element.querySelector(".e-unprotectworksheet-dlg").querySelector(".e-dlg-content").appendChild(i);else{if(n[5]!==t.data)return n[8]===t.data?(this.parent.serviceLocator.getService(O).hide(!0),i=t.data.includes("ExternalWorkbook"),this.parent.serviceLocator.getService(O).show({content:this.parent.serviceLocator.getService("spreadsheetLocale").getConstant("ExternalWorkbook"),width:"350",buttons:i?[{click:e.bind(this,t.data+"Yes"),buttonModel:{content:o.getConstant("Yes"),isPrimary:!0}},{click:e.bind(this,t.data+"No"),buttonModel:{content:o.getConstant("No")}}]:[],beforeOpen:function(e){var t={dialogName:"OpenDialog",element:e.element,target:e.target,cancel:e.cancel};r.parent.trigger("dialogBeforeOpen",t),t.cancel&&(e.cancel=!0)}},!!i||null)):(this.parent.serviceLocator.getService(O).hide(!0),i=t.data.includes("LimitExceeded"),this.parent.serviceLocator.getService(O).show({content:this.parent.serviceLocator.getService("spreadsheetLocale").getConstant(t.data),width:"300",buttons:i?[{click:e.bind(this,t.data+"Open"),buttonModel:{content:o.getConstant("Ok"),isPrimary:!0}},{click:e.bind(this,t.data+"Cancel"),buttonModel:{content:o.getConstant("Cancel")}}]:[],beforeOpen:function(e){var t={dialogName:"OpenDialog",element:e.element,target:e.target,cancel:e.cancel};r.parent.trigger("dialogBeforeOpen",t),t.cancel&&(e.cancel=!0)}},!!i||null)),void this.parent.hideSpinner();this.parent.isOpen=!1,this.parent.notify(Gs,null),this.parent.serviceLocator.getService(O).hide(),this.parent.hideSpinner()}}else this.parent.serviceLocator.getService(O).hide(),this.parent.showSpinner();this.parent.element&&n[5]!==t.data&&(this.parent.notify(Wt,{cellRef:null,isOpen:!0}),t.isOpenFromJson||(this.parent.trigger("openComplete",{response:t}),this.parent.notify(le,{response:t,action:"import"})),this.parent.isProtected&&this.parent.showSheetTabs&&t.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(t.isOpenFromJson,!1,!1,!1,t),this.parent.notify(Qi,null),this.isImportedFile=!0,t.context.preventFormatCheck=t.eventArgs&&t.eventArgs.file&&t.eventArgs.file.name&&!t.eventArgs.file.name.includes(".csv"),this.unProtectSheetIdx=[],this.parent.hideSpinner())},kc.prototype.openFailed=function(e){this.parent.trigger("openFailure",e),this.parent.hideSpinner()},kc.prototype.sheetsDestroyHandler=function(e){ee.isNullOrUndefined(e.sheetIndex)&&(this.isImportedFile=!1,this.unProtectSheetIdx=[])},kc.prototype.destroy=function(){this.removeEventListener();var e=ee.select("#"+this.parent.element.id+"_fileUpload",this.parent.element);e&&ee.detach(e),this.isImportedFile=null,this.unProtectSheetIdx=null,this.parent=null},kc.prototype.getModuleName=function(){return"open"};var Fc=kc;function kc(e){this.isImportedFile=!1,this.unProtectSheetIdx=[],this.parent=e,this.addEventListener(),this.renderFileUpload()}Ac.prototype.destroy=function(){this.removeEventListener(),this.parent=null},Ac.prototype.addEventListener=function(){this.parent.on(ft,this.initiateSave,this),this.parent.on(bt,this.saveCompleted,this),this.parent.on(Kr,this.showErrorDialog,this),this.parent.on(yt,this.exportDialog,this)},Ac.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(ft,this.initiateSave),this.parent.off(bt,this.saveCompleted),this.parent.off(Kr,this.showErrorDialog),this.parent.off(yt,this.exportDialog))},Ac.prototype.getModuleName=function(){return"save"},Ac.prototype.initiateSave=function(){this.parent.showSpinner()},Ac.prototype.saveCompleted=function(){this.parent.hideSpinner()},Ac.prototype.showErrorDialog=function(e){var t=this;this.parent.serviceLocator.getService(O).show({isModal:!0,showCloseIcon:!0,height:180,width:400,content:e.content,beforeOpen:function(){return ce(t.parent.element)}})},Ac.prototype.exportDialog=function(r){var e,n=this,i=this.parent.serviceLocator.getService(T),o=this.parent.serviceLocator.getService(O),a=r?r.item.id.split(this.parent.element.id+"_")[1]:"xlsx";ee.isNullOrUndefined(this.parent.element.querySelector(".e-open-dlg"))?(e={isModal:!0,showCloseIcon:!0,cssClass:"e-open-dlg",header:i.getConstant("SaveAs"),beforeOpen:function(e){var t={dialogName:i.getConstant("SaveAs"),element:e.element,target:e.target,cancel:e.cancel};n.parent.trigger("dialogBeforeOpen",t),t.cancel&&(e.cancel=!0),o.dialogInstance.content=n.OpenContent(a),o.dialogInstance.dataBind(),n.parent.element.querySelector(".e-text-open").setSelectionRange(0,n.parent.element.querySelector(".e-text-open").value.length),ce(n.parent.element)},buttons:[{buttonModel:{content:i.getConstant("Save"),isPrimary:!0,cssClass:"e-btn-open-ok"},click:function(){var e,t=n.parent.element.querySelector(".e-text-open").value;n.checkValidName(t)?(o.hide(),e=r?r.item.id.split(n.parent.element.id+"_")[1]:"Xlsx",n.parent.save({saveType:e,fileName:t})):(e=n.parent.element.querySelector(".e-btn-open-ok"),ee.getComponent(e,"btn").disabled=!0,e=n.parent.serviceLocator.getService(T),t=0===t.length?e.getConstant("EmptyFileName"):218<t.length?e.getConstant("LargeName"):e.getConstant("FileNameError"),(e=n.parent.createElement("span",{className:"e-file-alert-span"})).innerText=t,n.parent.element.querySelector(".e-file-alert-span")&&n.parent.element.querySelector(".e-file-alert-span").remove(),n.parent.element.querySelector(".e-open-dlg").querySelector(".e-dlg-content").appendChild(e))}}],close:function(){o.hide()}},o.show(e)):o.hide()},Ac.prototype.checkValidName=function(e){var t=!0;return t=e.match(new RegExp('.*[\\[\\]\\*\\\\/\\?\\:\\<\\>\\|\\"].*'))||e.length<1||218<e.length?!1:t},Ac.prototype.OpenContent=function(e){var t=this,r=this.parent.serviceLocator.getService(T),n=this.parent.createElement("div",{className:"e-open-dialog"}),i=this.parent.createElement("div",{className:"e-open-head"}),o=this.parent.createElement("div",{className:"e-input-group"}),a=(n.appendChild(i),n.appendChild(o),r.getConstant("FileName")),s=this.parent.element.id+"_filename",r=this.parent.createElement("p",{className:"e-header",id:s,attrs:{"aria-label":r.getConstant("SaveAs")+" "+a}}),a=(r.innerText=a,this.parent.createElement("input",{className:"e-input e-text-open",attrs:{type:"Text","aria-labelledby":s}})),s=this.parent.createElement("span",{className:"e-input-group-icon"});return a.onkeyup=function(e){t.parent.element.querySelector(".e-file-alert-span")&&13!==e.keyCode&&(e=t.parent.element.querySelector(".e-btn-open-ok"),ee.getComponent(e,"btn").disabled=!1,t.parent.element.querySelector(".e-file-alert-span").remove())},i.appendChild(r),s.textContent="."+e.toLowerCase(),o.appendChild(a),a.setAttribute("value","Sample"),o.appendChild(s),n};var Oc=Ac;function Ac(e){this.parent=e,this.addEventListener()}Dc.prototype.init=function(){this.initContextMenu(),this.addEventListener()},Dc.prototype.initContextMenu=function(){var e=document.createElement("ul");e.id=this.parent.element.id+"_contextmenu",this.parent.element.appendChild(e),this.contextMenuInstance=new D.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")},Dc.prototype.beforeCloseHandler=function(e){var t=this;this.parent.trigger("contextMenuBeforeClose",e),this.parent.enableKeyboardShortcut&&e.event&&27===e.event.keyCode&&Xh(function(){ce(t.parent.element)})},Dc.prototype.selectHandler=function(e){var t,r=ee.extend({cancel:!1},e),n=(this.parent.trigger("contextMenuItemSelect",r),this.parent.element.id+"_cmenu"),i=te(this.parent.getActiveSheet().selectedRange),o=[];if(this.parent.sortCollection)for(var a=this.parent.sortCollection.length-1;0<=a;a--)this.parent.sortCollection[a]&&this.parent.sortCollection[a].sheetIndex===this.parent.activeSheetIndex&&(o.push(this.parent.sortCollection[a]),this.parent.sortCollection.splice(a,1));if(e.item.id===n+"_delete_row"||e.item.id===n+"_delete_column"||e.item.id===n+"_insert_column_before"||e.item.id===n+"_insert_column_after"||e.item.id===n+"_insert_row_above"||e.item.id===n+"_insert_row_below"){var s=Nh(this.parent.getActiveSheet(),i[0]),l=de(this.parent.getActiveSheet(),i[1]);if(s&&!s.isReadOnly&&l&&!l.isReadOnly&&Xd(this.parent,i))return void this.parent.notify(qa,null)}if(e.item.id===n+"_ascending"||e.item.id===n+"_descending"||e.item.id===n+"_customsort"){s=qn(i[0],i[1],this.parent.getActiveSheet());if(Xd(this.parent,s))return void this.parent.notify(qa,null)}if(!r.cancel){var h=void 0;switch(e.item.id){case n+"_cut":this.parent.notify(Fo,{invokeCopy:!0,promise:Promise});break;case n+"_copy":this.parent.notify(ko,{invokeCopy:!0,promise:Promise});break;case n+"_paste":this.parent.notify(Oo,{isAction:!0,isInternal:!0,focus:!0});break;case n+"_pastevalues":this.parent.notify(Oo,{type:"Values",isAction:!0,isInternal:!0,focus:!0});break;case n+"_pasteformats":this.parent.notify(Oo,{type:"Formats",isAction:!0,isInternal:!0,focus:!0});break;case n+"_rename":this.parent.notify(So,{});break;case n+"_delete_sheet":this.parent.notify(xo,{}),ce(this.parent.element);break;case n+"_insert_sheet":this.parent.notify(lr,{model:this.parent,start:this.parent.activeSheetIndex,end:this.parent.activeSheetIndex,modelType:"Sheet",isAction:!0,activeSheetIndex:this.parent.activeSheetIndex});break;case n+"_hide_sheet":this.parent.notify(ga,{sheetIndex:this.parent.activeSheetIndex,triggerEvent:!0});break;case n+"_duplicate":Pi(this.parent,void 0,!0),ce(this.parent.element);break;case n+"_move_right":Li(this.parent,this.parent.activeSheetIndex+1,null,!0),ce(this.parent.element);break;case n+"_move_left":Li(this.parent,this.parent.activeSheetIndex-1,null,!0),ce(this.parent.element);break;case n+"_ascending":this.parent.notify(Ia,{sortOptions:{sortDescriptors:{order:"Ascending"}}}),this.parent.notify(Jo,{sortOptions:{sortDescriptors:{order:"Ascending"}},previousSort:o});break;case n+"_descending":this.parent.notify(Ia,{sortOptions:{sortDescriptors:{order:"Descending"}}}),this.parent.notify(Jo,{sortOptions:{sortDescriptors:{order:"Descending"}},previousSort:o});break;case n+"_customsort":this.parent.notify(Zo,null);break;case n+"_filtercellvalue":this.parent.notify(Na,null);break;case n+"_clearfilter":t=ue(W(this.parent.getActiveSheet().activeCell)[1]+1),this.parent.notify(Ra,{field:t});break;case n+"_reapplyfilter":this.parent.notify(Ea,null);break;case n+"_hide_row":h=te(this.parent.getActiveSheet().selectedRange),this.parent.notify(Pr,{startIndex:h[0],endIndex:h[2],hide:!0,isCol:!1,actionUpdate:!0});break;case n+"_unhide_row":h=te(this.parent.getActiveSheet().selectedRange),this.parent.notify(Pr,{startIndex:h[0],endIndex:h[2],hide:!1,isCol:!1,actionUpdate:!0});break;case n+"_hide_column":h=te(this.parent.getActiveSheet().selectedRange),this.parent.notify(Pr,{startIndex:h[1],endIndex:h[3],hide:!0,isCol:!0,actionUpdate:!0});break;case n+"_unhide_column":h=te(this.parent.getActiveSheet().selectedRange),this.parent.notify(Pr,{startIndex:h[1],endIndex:h[3],hide:!1,isCol:!0,actionUpdate:!0});break;case n+"_insert_row_above":case n+"_delete_row":h=te(this.parent.getActiveSheet().selectedRange),this.parent.notify(e.item.id.substr(n.length+1,6)+"Model",{model:this.parent.getActiveSheet(),start:h[0],end:h[2],modelType:"Row",isAction:!0,insertType:"above"});break;case n+"_insert_row_below":h=ne(te(this.parent.getActiveSheet().selectedRange)),this.parent.notify(lr,{model:this.parent.getActiveSheet(),start:h[2]+1,end:h[2]+1+(h[2]-h[0]),modelType:"Row",isAction:!0,insertType:"below"});break;case n+"_insert_column_before":case n+"_delete_column":h=te(this.parent.getActiveSheet().selectedRange),this.parent.notify(e.item.id.substr(n.length+1,6)+"Model",{model:this.parent.getActiveSheet(),start:h[1],end:h[3],modelType:"Column",isAction:!0,insertType:"before"});break;case n+"_insert_column_after":h=ne(te(this.parent.getActiveSheet().selectedRange)),this.parent.notify(lr,{model:this.parent.getActiveSheet(),start:h[3]+1,end:h[3]+1+(h[3]-h[1]),modelType:"Column",isAction:!0,insertType:"after"});break;case n+"_addNote":this.parent.notify(oa,null);break;case n+"_editNote":this.parent.notify(aa,null);break;case n+"_deleteNote":this.parent.notify(sa,{rowIndex:null,columnIndex:null,isDeleteFromMenu:!0});break;case n+"_hyperlink":this.parent.notify(ra,null);break;case n+"_editHyperlink":this.parent.notify(na,null);break;case n+"_openHyperlink":this.parent.notify(ia,null);break;case n+"_removeHyperlink":this.parent.notify(ca,{range:this.parent.getActiveSheet().selectedRange});break;case n+"_protect":this.parent.notify(Qs,{})}}},Dc.prototype.getInsertModel=function(e,t){for(var r=[],n=e;n<=t;n++)r.push(n===e?{index:n}:{});return r},Dc.prototype.beforeOpenHandler=function(e){for(var t,r,n=e.event.target,i=["e-numericcontainer","e-active-cell","e-selection","e-row","e-header-row","e-select-all-cell","e-sheet-tabs-items","e-spreadsheet-contextmenu"],o=0,a=i.length;o<a;o++)if(ee.closest(n,"."+i[o])){r=!0;break}if(r?l=this.getTarget(n):(r=["e-header-cell","e-rowhdr-table","e-selectall-table","e-main-panel"].some(function(e){return n.classList.contains(e)}))&&(1<parseInt(n.parentElement.style.zIndex,10)||1<parseInt(n.parentElement.parentElement.style.zIndex,10))?(h={clientY:(s=e.event).clientY,isImage:!1,target:n},s={clientX:s.clientX,isImage:!1,target:n},this.parent.notify(us,h),this.parent.notify(fs,s),l=h.size<=0?"ColumnHeader":s.size<=0?"RowHeader":"Content"):r=!1,r){if(e.element.classList.contains("e-contextmenu")){var s,l,h=this.parent.getActiveSheet();if(e.event.target&&(n.classList.contains("e-rowresize")||n.classList.contains("e-colresize"))){var d=te(h.selectedRange);if(!(n.classList.contains("e-rowresize")?0===d[1]&&d[3]===h.colCount-1:0===d[0]&&d[2]===h.rowCount-1))return void(e.cancel=!0);t=(n.classList.contains("e-rowresize")?this.parent.hiddenCount(d[0],d[2])!==Math.abs(d[2]-d[0])+1:this.parent.hiddenCount(d[1],d[3],"columns")!==Math.abs(d[3]-d[1])+1)?this.getDataSource(l):this.getDataSource(l,n)}else"Content"===l&&(s=0===(d=te(h.selectedRange))[1]&&d[3]===h.colCount-1,d=0===d[0]&&d[2]===h.rowCount-1,l=s&&d?"SelectAll":s?"RowHeader":d?"ColumnHeader":"Content"),t=this.getDataSource(l,"Footer"===l?n:void 0);this.contextMenuInstance.items=t,this.contextMenuInstance.dataBind()}else t=e.items;"None"===this.parent.selectionSettings.mode&&"Content"===l&&this.parent.enableContextMenuItems(["Filter"],!1,!1),"ColumnHeader"===l||"RowHeader"===l?e.element&&0<e.element.childElementCount&&(h="ColumnHeader"===l?e.element.querySelector("#"+this.parent.element.id+"_cmenu_insert_column"):e.element.querySelector("#"+this.parent.element.id+"_cmenu_insert_row"),s="ColumnHeader"===l?e.element.querySelector("#"+this.parent.element.id+"_cmenu_delete_column"):e.element.querySelector("#"+this.parent.element.id+"_cmenu_delete_row"),this.parent.allowInsert&&h.classList.contains("e-disabled")?h.classList.remove("e-disabled"):this.parent.allowInsert&&!this.parent.element.querySelector(".e-selectall.e-highlight")||h.classList.contains("e-disabled")||h.classList.add("e-disabled"),this.parent.allowDelete&&s.classList.contains("e-disabled")?s.classList.remove("e-disabled"):this.parent.allowDelete||s.classList.contains("e-disabled")||s.classList.add("e-disabled"),"None"===this.parent.selectionSettings.mode)&&("ColumnHeader"===l&&this.parent.enableContextMenuItems(["Insert Column","Delete Column","Hide Column"],!1,!1),"RowHeader"===l)&&this.parent.enableContextMenuItems(["Insert Row","Delete Row","Hide Row"],!1,!1):"Footer"===l&&(0===(d=B(this.parent,n.textContent))&&e.element.querySelector("#"+this.parent.element.id+"_cmenu_move_left").classList.add("e-disabled"),d===this.parent.sheets.length-1&&e.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",e),this.parent.notify(Co,ee.extend(e,{target:l,items:t}))}else e.cancel=!0},Dc.prototype.getTarget=function(e){return ee.closest(e,".e-sheet-content")?"Content":ee.closest(e,".e-column-header")?e.classList.contains("e-header-cell")?"ColumnHeader":"Content":ee.closest(e,".e-row-header")?e.classList.contains("e-header-cell")?"RowHeader":"Content":ee.closest(e,".e-sheet-tabs-items")?"Footer":ee.closest(e,".e-selectall-container")?e.classList.contains("e-header-cell")?ee.closest(e,".e-header-row")?"ColumnHeader":"RowHeader":ee.closest(e,".e-select-all-cell")?"SelectAll":"Content":""},Dc.prototype.getDataSource=function(e,t){var r,n=this.parent.serviceLocator.getService(T),i=[],o=this.parent.element.id+"_cmenu";return"Content"===e?(this.setClipboardData(i,n,o),i.push({separator:!0}),this.setFilterItems(i,o),this.setSortItems(i,o),i.push({separator:!0}),this.parent.enableNotes&&(this.setNotesMenu(i,o),i.push({separator:!0})),this.setHyperLink(i,o)):"RowHeader"===e?(this.setClipboardData(i,n,o),r=te(this.parent.getActiveSheet().selectedRange),this.setInsertDeleteItems(i,n,"Row",o,[r[0],r[2]],["Above","Below"]),t&&!t.classList.contains("e-rowresize")&&t.parentElement&&t.parentElement.classList.value.includes("e-hide")||this.setHideShowItems(i,n,"Row",o,[r[0],r[2]])):"ColumnHeader"===e?(this.setClipboardData(i,n,o),r=te(this.parent.getActiveSheet().selectedRange),this.setInsertDeleteItems(i,n,"Column",o,[r[1],r[3]],["Before","After"]),t&&t.classList.value.includes("e-hide")||this.setHideShowItems(i,n,"Column",o,[r[1],r[3]])):"SelectAll"===e?(this.setClipboardData(i,n,o),this.setFilterItems(i,o),this.setSortItems(i,o)):"Footer"===e&&(i.push({text:n.getConstant("Insert"),id:o+"_insert_sheet"}),i.push({text:n.getConstant("Delete"),iconCss:"e-icons e-delete",id:o+"_delete_sheet"}),i.push({text:n.getConstant("DuplicateSheet"),id:o+"_duplicate"}),i.push({text:n.getConstant("Rename"),id:o+"_rename"}),i.push({text:n.getConstant("Hide"),id:o+"_hide_sheet"}),this.setProtectSheetItems(i,o,t),i.push({text:n.getConstant("MoveRight"),id:o+"_move_right"}),i.push({text:n.getConstant("MoveLeft"),id:o+"_move_left"})),i},Dc.prototype.setProtectSheetItems=function(e,t,r){var n=this.parent.serviceLocator.getService(T);ae(this.parent,B(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"})},Dc.prototype.setFilterItems=function(e,t){var r,n;this.parent.allowFiltering&&(r=this.parent.serviceLocator.getService(T),this.parent.notify(Fa,n={clearFilterText:null,isFiltered:!1}),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"}]}))},Dc.prototype.setSortItems=function(e,t){var r=this.parent.serviceLocator.getService(T);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"}]})},Dc.prototype.setHyperLink=function(e,t){var r,n;this.parent.allowHyperlink&&(r=this.parent.serviceLocator.getService(T),n=W(this.parent.getActiveSheet().activeCell),n=this.parent.getCell(n[0],n[1]),!ee.isNullOrUndefined(n)&&(n.getElementsByClassName("e-hyperlink")[0]||n.classList.contains("e-hyperlink"))?e.push({text:r.getConstant("EditHyperlink"),iconCss:"e-icons e-edithyperlink-icon",id:t+"_editHyperlink"},{text:r.getConstant("OpenHyperlink"),iconCss:"e-icons e-openhyperlink-icon",id:t+"_openHyperlink"},{text:r.getConstant("RemoveHyperlink"),iconCss:"e-icons e-removehyperlink-icon",id:t+"_removeHyperlink"}):e.push({text:r.getConstant("Hyperlink"),iconCss:"e-icons e-hyperlink-icon",id:t+"_hyperlink"}))},Dc.prototype.setNotesMenu=function(e,t){var r,n;this.parent.enableNotes&&(r=this.parent.serviceLocator.getService(T),n=W(this.parent.getActiveSheet().activeCell),n=this.parent.getCell(n[0],n[1]),!ee.isNullOrUndefined(n)&&0<n.children.length&&-1<n.children[n.children.length-1].className.indexOf("addNoteIndicator")?e.push({text:r.getConstant("EditNote"),iconCss:"e-icons e-edit-notes",id:t+"_editNote"},{text:r.getConstant("DeleteNote"),iconCss:"e-icons e-delete-notes",id:t+"_deleteNote"}):e.push({text:r.getConstant("AddNote"),iconCss:"e-icons e-add-notes",id:t+"_addNote"}))},Dc.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"}]}))},Dc.prototype.setInsertDeleteItems=function(t,r,n,i,o,a){t.push({separator:!0}),["Insert","Delete"].forEach(function(e){o[0]===o[1]?t.push({text:r.getConstant(""+e+n),id:i+("_"+e.toLowerCase()+"_"+n.toLowerCase())}):t.push({text:r.getConstant(""+e+n+"s"),id:i+("_"+e.toLowerCase()+"_"+n.toLowerCase())}),"Insert"===e&&(t[t.length-1].items=[],a.forEach(function(e){t[t.length-1].items.push({text:r.getConstant(e),id:t[t.length-1].id+"_"+e.toLowerCase()})}))})},Dc.prototype.setHideShowItems=function(e,t,r,n,i){var o;i[0]===i[1]?e.push({text:t.getConstant("Hide"+r),id:n+("_hide_"+r.toLowerCase())}):(o=i[0],i[0]=i[0]>i[1]?i[1]:i[0],i[1]=i[1]>o?i[1]:o,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())})},Dc.prototype.addEventListener=function(){this.parent.on(Lo,this.addItemsHandler,this),this.parent.on(Po,this.removeItemsHandler,this),this.parent.on(Mo,this.enableItemsHandler,this)},Dc.prototype.addItemsHandler=function(e){e.insertAfter?this.contextMenuInstance.insertAfter(e.items,e.text,e.isUniqueId):this.contextMenuInstance.insertBefore(e.items,e.text,e.isUniqueId)},Dc.prototype.removeItemsHandler=function(e){this.contextMenuInstance.removeItems(e.items,e.isUniqueId)},Dc.prototype.enableItemsHandler=function(e){this.contextMenuInstance.enableItems(e.items,e.enable,e.isUniqueId)},Dc.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(Lo,this.addItemsHandler),this.parent.off(Po,this.removeItemsHandler),this.parent.off(Mo,this.enableItemsHandler))},Dc.prototype.getModuleName=function(){return"contextMenu"},Dc.prototype.destroy=function(){this.removeEventListener(),this.contextMenuInstance.destroy();var e=document.getElementById(this.parent.element.id+"_contextmenu");e&&ee.detach(e),this.contextMenuInstance=null,this.parent=null};var Tc=Dc;function Dc(e){this.parent=e,this.init()}Pc.prototype.refreshCellElement=function(e){this.parent.refreshNode(e.td,e)},Pc.prototype.getTextSpace=function(e){e.width=Ld(e.char,e.cell.style,this.parent.cellStyle)},Pc.prototype.rowFillHandler=function(e){var t=e.cellEle;if(t){var r=void 0,n=e.colIdx,i=(1<e.cell.colSpan&&(i={range:[e.rowIdx,e.colIdx,e.rowIdx,e.colIdx]},this.parent.notify(Dr,i),n=i.range[3]),Bd(this.parent.getActiveSheet(),e.rowIdx,e.colIdx,n)),n=e.iconSetSpan||t.querySelector(".e-iconsetspan");if(n&&(i-=n.getBoundingClientRect().width),e.updateFillSize){if(!(r=t.querySelector(".e-fill"))||!r.textContent)return;e.repeatChar=r.textContent[0],(a=t.querySelector(".e-fill-before"))&&(i-=Ld(a.textContent,e.cell.style,this.parent.cellStyle)),(s=t.querySelector(".e-fill-sec"))&&(i-=Ld(s.textContent,e.cell.style,this.parent.cellStyle))}else{var o=t.querySelector(".e-addNoteIndicator");t.innerText="",e.beforeFillText&&((a=this.parent.createElement("span",{className:"e-fill-before",styles:"float: "+(this.parent.enableRtl?"right":"left")})).innerText=e.beforeFillText,t.appendChild(a),i-=Ld(e.beforeFillText,e.cell.style,this.parent.cellStyle)),r=this.parent.createElement("span",{className:"e-fill"}),t.appendChild(r),e.afterFillText&&((s=this.parent.createElement("span",{className:"e-fill-sec"})).innerText=e.afterFillText,t.appendChild(s),i-=Ld(e.afterFillText,e.cell.style,this.parent.cellStyle)),n&&t.insertBefore(n,t.childNodes[0]),o&&t.appendChild(o)}var a=Ld(e.repeatChar,e.cell.style,this.parent.cellStyle),s=parseInt((i/a).toString(),10);e.formattedText=0<s?e.repeatChar.repeat(s):"",r.textContent=e.formattedText}},Pc.prototype.addEventListener=function(){this.parent.on(It,this.refreshCellElement,this),this.parent.on(an,this.rowFillHandler,this),this.parent.on(sn,this.getTextSpace,this)},Pc.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(It,this.refreshCellElement),this.parent.off(an,this.rowFillHandler),this.parent.off(sn,this.getTextSpace))},Pc.prototype.destroy=function(){this.removeEventListener(),this.parent=null},Pc.prototype.getModuleName=function(){return"numberFormat"};var Lc=Pc;function Pc(e){this.parent=e,this.addEventListener()}Bc.prototype.destroy=function(){this.removeEventListener(),this.parent=null},Bc.prototype.addEventListener=function(){this.parent.on(Jo,this.applySortHandler,this),this.parent.on($t,this.sortCompleteHandler,this),this.parent.on(Zo,this.initiateCustomSortHandler,this),this.parent.on(mt,this.sortImport,this)},Bc.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(Jo,this.applySortHandler),this.parent.off($t,this.sortCompleteHandler),this.parent.off(Zo,this.initiateCustomSortHandler),this.parent.off(mt,this.sortImport))},Bc.prototype.getModuleName=function(){return"sort"},Bc.prototype.isValidSortRange=function(){var e=this.parent.getActiveSheet(),t=ne(P(e.selectedRange));return!(t[0]>e.usedRange.rowIndex||t[1]>e.usedRange.colIndex)},Bc.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,o=0;o<r.length;o++)if(r[o].sheetIndex===i)for(var a=0;a<n;a++)if((t=this.parent.getCell(a,r[o].columnIndex))&&t.querySelector(".e-filter-icon"))return void("Ascending"===r[o].order||"OnTop"===r[o].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"))},Bc.prototype.sortRangeAlertHandler=function(r){var n=this,i=this.parent.serviceLocator.getService(O),o=this.parent.serviceLocator.getService(T);i.show({height:180,width:400,isModal:!0,showCloseIcon:!0,content:r.error,beforeOpen:function(e){var t={dialogName:r.error===o.getConstant("MultiRangeSortError")?"MultiRangeSortDialog":"SortRangeDialog",content:r.error,element:e.element,target:e.target,cancel:e.cancel};n.parent.trigger("dialogBeforeOpen",t),t.cancel?e.cancel=!0:ce(n.parent.element),i.dialogInstance.content=t.content}}),this.parent.hideSpinner()},Bc.prototype.initiateCustomSortHandler=function(){var n,i,o=this,e=this.parent.serviceLocator.getService(T),t=this.parent.getActiveSheet();this.isValidSortRange()&&0!==t.rows.length?zd(t.selectedRange)?this.sortRangeAlertHandler({error:e.getConstant("MultiRangeSortError")}):(n=this.parent.serviceLocator.getService(O)).show({height:400,width:560,isModal:!0,showCloseIcon:!0,cssClass:"e-customsort-dlg",header:e.getConstant("CustomSort"),beforeOpen:function(e){var t={dialogName:"CustomSortDialog",element:e.element,target:e.target,cancel:e.cancel};o.parent.trigger("dialogBeforeOpen",t),t.cancel&&(e.cancel=!0),n.dialogInstance.content=o.customSortContent(),n.dialogInstance.dataBind(),ce(o.parent.element)},buttons:[{buttonModel:{content:e.getConstant("Ok"),isPrimary:!0},click:function(){var e=n.dialogInstance.content,t=ee.getComponent(e.getElementsByClassName("e-list-sort e-listview e-lib")[0],"listview").dataSource,r=(o.clearError(),e.getElementsByClassName("e-sort-error")[0]);r.style.display="block",o.validateError(t,e,r)||(i={sortDescriptors:t,containsHeader:e.getElementsByClassName("e-sort-checkheader")[0].checked,caseSensitive:e.getElementsByClassName("e-sort-checkcase")[0].checked},n.hide())}}],close:function(){i&&Xh(function(){o.applySortHandler({sortOptions:i})})}}):this.sortRangeAlertHandler({error:e.getConstant("SortOutOfRangeError")})},Bc.prototype.validateError=function(e,t,r){var n,i,o,a,s=this.parent.serviceLocator.getService(T);return e.some(function(e){return""===e.field.toString()})?(Array.prototype.some.call(t.getElementsByClassName("e-sort-field"),function(e){var t=!ee.getComponent(e,"dropdownlist").value;return t&&e.parentElement.classList.add("e-error"),t}),r.innerText=s.getConstant("SortEmptyFieldError"),!0):(n=new Set,i="",e=e.some(function(e){return i=e.field.toString(),n.size===n.add(e.field).size}),o="",!!e&&(a=0,Array.prototype.some.call(t.getElementsByClassName("e-sort-field"),function(e){var t=ee.getComponent(e,"dropdownlist");return t.value===i&&(e.parentElement.classList.add("e-error"),o=t.text,a++),2===a}),r.innerText="",(e=this.parent.createElement("strong")).innerText=o,r.appendChild(e),r.appendChild(document.createTextNode(s.getConstant("SortDuplicateFieldError"))),!0))},Bc.prototype.customSortContent=function(){var e=this.parent.createElement("div",{className:"e-sort-dialog"}),t=this.getFields(),r=ee.getUniqueID("customSort"),n=this.getCustomListview(r),i=(this.setHeaderTab(e,n,t),this.parent.createElement("div",{className:"e-sort-listsection",styles:""})),o=(e.appendChild(i),this.parent.createElement("div",{className:"e-list-sort",styles:""})),i=(i.appendChild(o),n.createElement=this.parent.createElement,n.appendTo(o),o.removeAttribute("tabindex"),this.renderListItem(r,n,!0,t),this.parent.createElement("div",{className:"e-sort-error"}));return e.appendChild(i),e},Bc.prototype.getFields=function(){var e,t=this.parent.getActiveSheet(),r=ne(P(t.selectedRange)),n=(r[0]===r[2]&&r[2]-r[0]==0&&(r[0]=0,r[1]=0,r[3]=t.usedRange.colIndex,this.parent.notify(Oa,e={filterRange:[],hasFilter:!1}),e.hasFilter)&&e.filterRange&&(r[0]=e.filterRange[0]),[]);for(r[1];r[1]<=r[3];r[1]++){var i,o=se(r[0],r[1],t),a="Column "+ue(r[1]+1);o&&o.value?(i=o.value,o.format&&(o={formattedText:i,value:i,format:o.format,rowIndex:r[0],colIndex:r[1]},this.parent.notify(St,o),i=o.formattedText)):i=a,n.push({text:i,value:a})}return n},Bc.prototype.setHeaderTab=function(r,t,n){var i=this,o=this.parent.serviceLocator.getService(T),e=this.parent.createElement("div",{className:"e-sort-header"}),a=(r.appendChild(e),this.parent.createElement("button",{className:"e-btn e-sort-addbtn e-flat",attrs:{type:"button"}})),s=(a.innerText=o.getConstant("AddColumn"),this.parent.element.querySelector(".e-customsort-dlg .e-footer-content")),l=(s.insertBefore(a,s.firstElementChild),a.addEventListener("click",function(){var e;t&&(e=ee.getUniqueID("customSort"),t.addItem([{id:e,text:o.getConstant("ThenBy"),field:"",order:"ascending"}]),i.renderListItem(e,t,l.checked,n,!0))}),new w.CheckBox({label:o.getConstant("ContainsHeader"),checked:!0,change:function(e){var t=e.checked?{text:"text",value:"value"}:{text:"value"};Array.prototype.forEach.call(r.getElementsByClassName("e-sort-field e-dropdownlist e-lib"),function(e){e=ee.getComponent(e,"dropdownlist");e.dataSource=null,e.dataSource=n,e.fields=t,e.dataBind()})},cssClass:"e-sort-headercheckbox"})),s=this.parent.createElement("input",{className:"e-sort-checkheader",attrs:{type:"checkbox"}}),a=(e.appendChild(s),l.createElement=this.parent.createElement,l.appendTo(s),new w.CheckBox({label:o.getConstant("CaseSensitive"),checked:!1,cssClass:"e-sort-casecheckbox"})),s=this.parent.createElement("input",{className:"e-sort-checkcase",attrs:{type:"checkbox"}});e.appendChild(s),a.createElement=this.parent.createElement,a.appendTo(s)},Bc.prototype.getCustomListview=function(e){e=[{id:e,text:this.parent.serviceLocator.getService(T).getConstant("SortBy"),field:"",order:"ascending"}];return ee.enableRipple(!1),new f.ListView({dataSource:e,fields:{id:"id"},height:"100%",template:ee.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"})},Bc.prototype.deleteHandler=function(e,t){e.getElementsByClassName("e-sort-delete")[0].addEventListener("click",function(){e&&t.removeItem(e)})},Bc.prototype.renderListItem=function(r,n,e,t,i){var o=this,a=this.parent.serviceLocator.getService(T),s=n.element.querySelector("li[data-uid="+r+"]"),e=e?{text:"text",value:"value"}:{text:"value"},l=s.getElementsByClassName("e-sort-field")[0],t=new I.DropDownList({dataSource:t,width:"auto",cssClass:"e-sort-field-ddl",fields:e,placeholder:a.getConstant("SelectAColumn"),change:function(t){t.value&&(Array.prototype.some.call(n.dataSource,function(e){return e.id===r&&(e.field=t.value.toString().replace("Column ","")),e.id===r}),o.clearError())}}),e=(t.createElement=this.parent.createElement,t.appendTo(l),i||(t.index=0),s.getElementsByClassName("e-sort-order")[0]),l="ascending"===e.getElementsByClassName("e-sort-ordertxt")[0].innerText.toLocaleLowerCase(),i=new w.RadioButton({label:a.getConstant("SortAscending"),name:"sortAZ_"+r,value:"ascending",checked:l,cssClass:"e-sort-radiobutton",change:function(e){o.setRadioBtnValue(n,r,e.value)}}),t=this.parent.createElement("input",{id:"orderAsc_"+r,className:"e-sort-radioasc",styles:"",attrs:{type:"radio"}}),i=(e.appendChild(t),i.createElement=this.parent.createElement,i.appendTo(t),new w.RadioButton({label:a.getConstant("SortDescending"),name:"sortAZ_"+r,value:"descending",checked:!l,cssClass:"e-sort-radiobutton",change:function(e){o.setRadioBtnValue(n,r,e.value)}})),t=this.parent.createElement("input",{id:"orderDesc_"+r,className:"e-sort-radiodesc",styles:"",attrs:{type:"radio"}});e.appendChild(t),i.createElement=this.parent.createElement,i.appendTo(t),this.deleteHandler(s,n)},Bc.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})},Bc.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")}))},Bc.prototype.applySortHandler=function(e){var t=this,r=this.parent.getActiveSheet(),n=ne(P(e&&e.range||r.selectedRange)),i=e&&e.sortOptions||{sortDescriptors:{}},o=n[0]===n[2],a={filterRange:[],hasFilter:!1,sheetIdx:this.parent.activeSheetIndex},a=(this.parent.notify(Oa,a),a.hasFilter&&(o?Tn(a.filterRange,n[0],n[1]):a.filterRange[0]===n[0]&&(this.parent.element.querySelector(".e-selectall.e-highlight")||n[1]>=a.filterRange[1]&&n[1]<=a.filterRange[3]||n[3]>=a.filterRange[1]&&n[3]<=a.filterRange[3]))&&(n[0]=a.filterRange[0],n[1]=a.filterRange[1],n[2]=r.usedRange.rowIndex,n[3]=r.usedRange.colIndex,i.containsHeader=!a.allowHeaderFilter,o=!1),{range:r=re(n),sortOptions:i,cancel:!1});this.parent.trigger(Yt,a),a.cancel||(this.parent.notify(gt,{eventArgs:a,action:"beforeSort"}),this.parent.showSpinner(),n=new Promise(function(e){e(void 0)}),i={args:{range:a.range,sortOptions:a.sortOptions,checkForHeader:o&&r!==a.range},promise:n,previousSort:e&&e.previousSort},this.parent.notify(Xt,i),i.promise.then(function(e){return t.sortCompleteHandler(e),t.parent.trigger($t,e),t.parent.notify(le,{eventArgs:e,action:"sorting"}),"BODY"===document.activeElement.tagName&&ce(t.parent.element),Promise.resolve(e)}).catch(function(e){return t.sortRangeAlertHandler({error:e}),Promise.reject(e)}))},Bc.prototype.sortCompleteHandler=function(e){for(var t,r,n,i=this.parent.activeSheetIndex,o=(n=e.range.includes("!")?(t=e.range.lastIndexOf("!"),i=B(this.parent,e.range.substring(0,t)),r=ae(this.parent,i),te(e.range.substring(t+1))):(r=this.parent.getActiveSheet(),te(e.range)))[0];o<=n[2];o++)for(var a=n[1];a<=n[3];a++)this.parent.notify(ie,{action:"refreshCalculate",rowIndex:o,colIndex:a});this.parent.serviceLocator.getService("cell").refreshRange(n,!0,!0,!1,!1,Jn(this.parent),void 0,void 0,void 0,!0),i===this.parent.activeSheetIndex&&r.conditionalFormats&&r.conditionalFormats.length&&this.parent.notify(Br,{indexes:n}),this.parent.hideSpinner(),this.parent.notify(wa,null)};var Mc=Bc;function Bc(e){this.parent=e,this.addEventListener()}p.prototype.destroy=function(){var r=this,e=(this.removeEventListener(),this.parent.refreshing&&this.filterRange.size&&(this.parent.filterCollection=[],this.filterRange.forEach(function(e,t){r.setFilteredCollection({sheetIdx:t,saveJson:{filterCollection:r.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),document.querySelectorAll(".e-filter-popup"));e&&e.forEach(function(e){e.remove()}),this.parent=null},p.prototype.addEventListener=function(){this.parent.on(nr,this.filterRangeAlertHandler,this),this.parent.on(xa,this.initiateFilterUIHandler,this),this.parent.on(ro,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(k.beforeFltrcMenuOpen,this.beforeFilterMenuOpenHandler,this),this.parent.on(k.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(Fa,this.getFilteredColumnHandler,this),this.parent.on(Co,this.cMenuBeforeOpenHandler,this),this.parent.on(k.filterCboxValue,this.filterCboxValueHandler,this),this.parent.on(Oa,this.getFilterRangeHandler,this),this.parent.on(ka,this.filterCellKeyDownHandler,this),this.parent.on(Ct,this.setFilteredCollection,this),this.parent.on(to,this.updateFilter,this),this.parent.on(Zr,this.beforeInsertHandler,this),this.parent.on(Jr,this.beforeDeleteHandler,this),this.parent.on(Ht,this.deleteSheetHandler,this),this.parent.on(Hr,this.clearHandler,this),this.parent.on(k.filterDialogCreated,this.filterDialogCreatedHandler,this),this.parent.on(k.filterDialogClose,this.removeFilterClass,this),this.parent.on(fn,this.duplicateSheetFilterHandler,this),this.parent.on(k.fltrPrevent,this.beforeFilteringHandler,this),this.parent.on(k.beforeCustomFilterOpen,this.customFilterOpen,this),this.parent.on(In,this.moveSheetHandler,this),this.parent.on(ea,this.refreshFilterCellsOnResize,this)},p.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(nr,this.filterRangeAlertHandler),this.parent.off(xa,this.initiateFilterUIHandler),this.parent.off(ro,this.filterMouseDownHandler),this.parent.off(Sa,this.renderFilterCellHandler),this.parent.off(wa,this.refreshFilterRange),this.parent.off(Ia,this.updateSortCollectionHandler),this.parent.off(k.beforeFltrcMenuOpen,this.beforeFilterMenuOpenHandler),this.parent.off(k.filterCmenuSelect,this.closeDialog),this.parent.off(Ea,this.reapplyFilterHandler),this.parent.off(Na,this.filterByCellValueHandler),this.parent.off(Ra,this.clearFilterHandler),this.parent.off(Fa,this.getFilteredColumnHandler),this.parent.off(Co,this.cMenuBeforeOpenHandler),this.parent.off(k.filterCboxValue,this.filterCboxValueHandler),this.parent.off(Oa,this.getFilterRangeHandler),this.parent.off(ka,this.filterCellKeyDownHandler),this.parent.off(Ct,this.setFilteredCollection),this.parent.off(to,this.updateFilter),this.parent.off(Zr,this.beforeInsertHandler),this.parent.off(Jr,this.beforeDeleteHandler),this.parent.off(Ht,this.deleteSheetHandler),this.parent.off(Hr,this.clearHandler),this.parent.off(k.filterDialogCreated,this.filterDialogCreatedHandler),this.parent.off(k.filterDialogClose,this.removeFilterClass),this.parent.off(fn,this.duplicateSheetFilterHandler),this.parent.off(k.fltrPrevent,this.beforeFilteringHandler),this.parent.off(k.beforeCustomFilterOpen,this.customFilterOpen),this.parent.off(In,this.moveSheetHandler),this.parent.off(ea,this.refreshFilterCellsOnResize))},p.prototype.getModuleName=function(){return"filter"},p.prototype.isInValidFilterRange=function(e,t){var t=ne(P(t||e.selectedRange)),r=!1;return 0===e.usedRange.colIndex&&0===e.usedRange.rowIndex&&ee.isNullOrUndefined(e.rows[e.usedRange.rowIndex])&&(r=!0),t[0]>e.usedRange.rowIndex||t[1]>e.usedRange.colIndex||r},p.prototype.filterRangeAlertHandler=function(e){var r=this;this.parent.serviceLocator.getService(O).show({content:e.error,isModal:!0,height:180,width:400,showCloseIcon:!0,beforeOpen:function(e){var t={dialogName:"FilterRangeDialog",element:e.element,target:e.target,cancel:e.cancel};r.parent.trigger("dialogBeforeOpen",t),t.cancel?e.cancel=!0:ce(r.parent.element)}}),this.parent.hideSpinner()},p.prototype.beforeFilterMenuOpenHandler=function(e){var t=this.parent.serviceLocator.getService(T),r=(e.element.classList.add("e-spreadsheet-contextmenu"),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)},p.prototype.addMenuItem=function(e,t,r,n){r=this.parent.createElement("li",{className:r+" e-menu-item"});this.parent.allowSorting||r.classList.add("e-disabled"),r.innerText=t,r.insertBefore(this.parent.createElement("span",{className:"e-menu-icon e-icons "+n}),r.firstChild),e.insertBefore(r,e.firstChild)},p.prototype.initiateFilterUIHandler=function(t){function r(){e&&e.resolve()}var e,n=this,i=t?t.predicates:null,o=t.sIdx,a=(o||0===o||(o=t.isOpen?0:this.parent.activeSheetIndex),t.promise&&(e=new H.Deferred,t.promise=e.promise),t.isInternal||t.isCut);if(0<this.filterRange.size&&this.filterRange.has(o)&&!this.parent.isOpen&&!i)this.removeFilter(o,a,!1),r();else{var s=ae(this.parent,o);if(this.isInValidFilterRange(s,t.range))c=this.parent.serviceLocator.getService(T),this.filterRangeAlertHandler({error:c.getConstant("FilterOutOfRangeError")}),r();else{var l,h,d,p,c=t.range||s.selectedRange;if(!a){if(l={range:c,sheetIndex:o,cancel:!1,allowHeaderFilter:!1},t.predicates?(l.predicates=t.predicates,l.previousPredicates=this.filterCollection.get(o)&&[].slice.call(this.filterCollection.get(o))):l.filterOptions={predicates:t.predicates},l.useFilterRange=!1,h={action:"filter",eventArgs:l},this.parent.notify(gt,h),l.cancel)return void r();delete l.cancel,t.useFilterRange=l.useFilterRange,t.allowHeaderFilter=l.allowHeaderFilter}if(t.range||!a&&c!==l.range?a||(c=l.range):(p=te(c))[0]===p[2]&&p[1]===p[3]&&(c=re(p=qn(p[0],p[1],s)),a||(l.range=c)),i){if(i.length)return(p=this.filterRange.get(o))&&(t.useFilterRange=p.useFilterRange,t.allowHeaderFilter=p.allowHeaderFilter),this.processRange(s,o,c,!0,t.useFilterRange,t.allowHeaderFilter),p=this.filterRange.get(o).range.slice(),t.allowHeaderFilter||(p[0]=p[0]+1),t.useFilterRange||(p[2]=s.usedRange.rowIndex),p[1]=p[3]=R(i[0].field),d=s.name+"!"+this.getPredicateRange(p,i.slice(1,i.length)),p=re(p),void pi(this.parent,d,!0,!0,null,!0,null,null,!1,p).then(function(e){n.filterSuccessHandler(new H.DataManager(e),{action:"filtering",filterCollection:i,field:i[0].field,sIdx:t.sIdx,isInternal:a,isOpen:t.isOpen,prevPredicates:l&&l.previousPredicates}),r()});this.clearFilterHandler({sheetIndex:o})}else this.processRange(s,o,c,!1,t.useFilterRange,t.allowHeaderFilter);r(),a||(this.parent.notify(le,h),ce(this.parent.element))}}},p.prototype.processRange=function(e,t,r,n,i,o){r=ne(P(r||e.selectedRange)),r[0]===r[2]&&r[1]===r[3]?(r[0]=0,r[1]=0,r[2]=e.usedRange.rowIndex,r[3]=e.usedRange.colIndex):r[3]>e.usedRange.colIndex&&(r[3]=e.usedRange.colIndex),e={useFilterRange:i,range:r};o&&(e.allowHeaderFilter=o),this.filterRange.set(t,e),this.filterCollection.set(t,[]),n||this.refreshFilterRange(r,!1,t)},p.prototype.removeFilter=function(e,t,r){var n,i=this.filterRange.get(e),o=i.range.slice(),i=i.allowHeaderFilter,a=re(o);if(!t){if(this.parent.notify(gt,n={action:"filter",eventArgs:{range:a,sheetIndex:e,cancel:!1}}),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(o,!0,e,i),t||this.parent.notify(le,n)},p.prototype.filterByCellValueHandler=function(){var e,t,r,n,i,o,a,s,l=this,h=this.parent.activeSheetIndex,d=this.parent.getActiveSheet();this.isInValidFilterRange(d)?(s=this.parent.serviceLocator.getService(T),this.filterRangeAlertHandler({error:s.getConstant("FilterOutOfRangeError")})):(s=te(d.activeCell),this.isFilterRange(h,s[0],s[1])||(e=!0,this.processRange(d,h)),a=re(r=(t=this.filterRange.get(h)).range.slice()),r[0]=r[0]+1,r[2]=d.usedRange.rowIndex,r[1]=r[3]=s[1],n=ue(s[1]+1),o=se(s[0],s[1],d),o=ci(this.parent,o,s[0],s[1]),i=[{field:n,operator:"equal",type:this.getColumnType(d,s[1],s).type,matchCase:!1,value:o}],(s=[].slice.call(this.filterCollection.get(h))).length||(s=void 0),this.parent.notify(gt,{action:"filter",eventArgs:o={range:a,predicates:i,previousPredicates:s,sheetIndex:h,cancel:!1,allowHeaderFilter:!1}}),o.cancel?e&&this.removeFilter(h,!0):(o.allowHeaderFilter&&(t.allowHeaderFilter=o.allowHeaderFilter,r[0]--),a=d.name+"!"+this.getPredicateRange(r,this.filterCollection.get(h)),s=re(r),pi(this.parent,a,!0,!0,null,!0,null,null,!1,s).then(function(e){l.filterSuccessHandler(new H.DataManager(e),{action:"filtering",filterCollection:i,field:n,isFilterByValue:!0})})))},p.prototype.renderFilterCellHandler=function(e){var t=ee.isNullOrUndefined(e.sIdx)?this.parent.activeSheetIndex:e.sIdx;if(t===this.parent.activeSheetIndex){var r=this.filterRange.get(t)&&this.filterRange.get(t),n=r&&r.range;if(n&&(n[0]===e.rowIndex||r.allowHeaderFilter)&&n[1]<=e.colIndex&&n[3]>=e.colIndex&&e.td&&!e.td.classList.contains(r.allowHeaderFilter?"e-cell":"e-header-cell")){for(var n=e.td.querySelector(".e-filter-icon"),i="",o=this.parent.sortCollection,a=ue(e.colIndex+1),s=this.filterCollection.get(t),l=0;l<s.length;l++)if(s[l].field===a){i=" e-filtered";break}if(o)for(l=0;l<o.length;l++)if(o[l].sheetIndex===t&&o[l].columnIndex===e.colIndex){i+="Ascending"===o[l].order?" e-sortasc-filter":" e-sortdesc-filter";break}n?n.className="e-btn-icon e-icons e-filter-icon"+i:(n=this.filterBtn.cloneNode(!(r=!1)),0<e.td.children.length&&-1<e.td.children[e.td.childElementCount-1].className.indexOf("e-addNoteIndicator")&&(e.td.removeChild(e.td.children[e.td.childElementCount-1]),r=!0),n.firstElementChild.className="e-btn-icon e-icons e-filter-icon"+i,e.td.insertBefore(n,e.td.firstChild),e.isAction&&(n=ae(this.parent,t),se(e.rowIndex,e.colIndex,n,!1,!0).wrap)&&this.parent.notify(tl,{rowIdx:e.rowIndex,colIdx:e.colIndex,sheet:n,ele:e.td}),r&&this.parent.notify(ha,{targetElement:e.td,rowIndex:e.rowIndex,columnIndex:e.colIndex}))}}},p.prototype.refreshFilterRange=function(e,t,r,n){for(var i,o,a,s=r,r=(s||0===s||(s=this.parent.activeSheetIndex),this.filterRange&&this.filterRange.get(s)),l=(r?(e=e||r.range.slice(),n=r.allowHeaderFilter):e=e||[0,0,0,0],e),h=ae(this.parent,s),d=this.parent.frozenColCount(h),p=l[1];p<=l[3];p++)i=n?(i=(i=p<d?this.parent.sheetModule.getSelectAllTable():this.parent.getColHeaderTable())&&this.parent.getRow(0,i))&&this.parent.getCell(0,p,i):he(h,l[0])?null:this.parent.getCell(l[0],p),t?i&&(o=i.querySelector(".e-filter-btn"))&&(a=!1,0<i.children.length&&-1<i.children[i.childElementCount-1].className.indexOf("e-addNoteIndicator")&&(i.removeChild(i.children[i.childElementCount-1]),a=!0),o.parentElement.removeChild(o),a)&&this.parent.notify(ha,{targetElement:i,rowIndex:l[0],columnIndex:p}):this.renderFilterCellHandler({td:i,rowIndex:l[0],colIndex:p,sIdx:s,isAction:!0});this.parent.sortCollection&&this.parent.notify(mt,null)},p.prototype.isFilterCell=function(e,t,r){e=this.filterRange.has(e)&&this.filterRange.get(e).range;return e&&e[0]===t&&e[1]<=r&&e[3]>=r},p.prototype.isFilterRange=function(e,t,r){e=this.filterRange.get(e)&&this.filterRange.get(e).range;return e&&e[0]<=t&&e[2]>=t&&e[1]<=r&&e[3]>=r},p.prototype.getFilteredColumnHandler=function(t){var e,r,n,i,o=ee.isUndefined(t.sheetIndex)?this.parent.activeSheetIndex:t.sheetIndex,a=this.parent.serviceLocator.getService(T);t.clearFilterText=a.getConstant("ClearFilter"),this.filterRange.has(o)&&(e=this.filterCollection.get(o),t.isClearAll?t.isFiltered=e&&0<e.length:(i=this.filterRange.get(o).range.slice(),n=W((r=ae(this.parent,o)).activeCell),this.isFilterRange(o,n[0],n[1])&&(t.field=ue(n[1]+1),o=se(i[0],n[1],r),i=this.parent.getDisplayText(o),t.clearFilterText=a.getConstant("ClearFilterFrom")+'"'+(i?i.toString():"Column "+t.field)+'"',e.some(function(e){return t.isFiltered=e.field===t.field,t.isFiltered}))))},p.prototype.cMenuBeforeOpenHandler=function(e){var t=this.parent.element.id+"_cmenu";e.parentItem&&e.parentItem.id===t+"_filter"&&""===e.target&&(this.getFilteredColumnHandler(e={isFiltered:!1}),this.parent.enableContextMenuItems([t+"_clearfilter",t+"_reapplyfilter"],!!e.isFiltered,!0))},p.prototype.closeDialog=function(){var e,t=document.querySelector(".e-filter-popup");t&&t.id.includes(this.parent.element.id)&&(e=ee.getComponent(t,"dialog"),ee.EventHandler.remove(t,ld(),this.filterMouseDownHandler),e&&e.hide(),this.parent.notify(k.filterDialogClose,null))},p.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")},p.prototype.isPopupOpened=function(){var e=document.getElementsByClassName("e-filter-popup")[0];return e&&e.id.includes(this.parent.element.id)&&"none"!==e.style.display},p.prototype.filterCellKeyDownHandler=function(e){var t=W(this.parent.getActiveSheet().activeCell);this.isFilterCell(this.parent.activeSheetIndex,t[0],t[1])&&(e.closePopup?this.closeDialog():(e.isFilterCell=!0,this.isPopupOpened()||(e=this.parent.getCell(t[0],t[1]))&&this.openDialog(e)))},p.prototype.filterMouseDownHandler=function(e){var t;ee.Browser.isDevice&&"mousedown"===e.type||this.parent.getActiveSheet().isProtected||((e=e.target).classList.contains("e-filter-icon")||e.classList.contains("e-filter-btn")?(this.isPopupOpened()&&this.closeDialog(),this.openDialog(k.parentsUntil(e,"e-cell")||k.parentsUntil(e,"e-header-cell"))):this.isPopupOpened()&&(t=e.offsetParent,e.classList.contains("e-searchinput")||e.classList.contains("e-searchclear")||!t||t.classList.contains("e-filter-popup")||t.classList.contains("e-text-content")||t.classList.contains("e-checkboxtree")||t.classList.contains("e-checkbox-wrapper")?this.selectSortItemHandler(e):this.closeDialog()))},p.prototype.cboxListSelected=function(e,t,r,n,i){n=k.parentsUntil(n.target,"e-ftrchk");if(n){var o=i&&n.querySelector(".e-add-current");if(o)return o.classList.contains("e-check")?(ee.classList(o,["e-uncheck"],["e-check"]),t.length||(e.btnObj.element.disabled=!0),!1):(ee.classList(o,["e-check"],["e-uncheck"]),!(e.btnObj.element.disabled=!1));o=n.querySelector(".e-selectall");if(o){n.querySelector(".e-chk-hidden").indeterminate=!1;for(var a=n.querySelector(".e-frame").classList.contains("e-check"),s=void 0,l=void 0,h=i?2:1,d=e.element.childElementCount;h<d;h++)s=e.element.children[h].querySelector(".e-frame"),ee.removeClass([s],["e-check","e-stop","e-uncheck"]),a?(e.element.children[h].querySelector(".e-chk-hidden").checked=!1,s.classList.add("e-uncheck"),t.splice(0,1)):(e.element.children[h].querySelector(".e-chk-hidden").checked=!0,s.classList.add("e-check"),l=e.element.children[h].querySelector(".e-checkboxfiltertext").textContent,-1===t.indexOf(l)&&t.push(l))}else{l=n.querySelector(".e-checkboxfiltertext").textContent;n.querySelector(".e-frame").classList.contains("e-check")?t.splice(t.indexOf(l),1):t.push(l),k.toogleCheckbox(n),o=e.element.querySelector(".e-selectall")}this.updateState(e,o,o.parentElement.querySelector(".e-chk-hidden"),t.length!==r,t.length)}return null},p.prototype.initCboxList=function(l,h,d){var n,i,p,c,u,r,o,f=this,g=l.column.field,e=new H.DataManager(l.dataSource).executeLocal((new H.Query).sortBy(g+"_value","ascending")),m=[],a=this.parent.getActiveSheet(),v=this.parent.serviceLocator.getService(T),s=document.createDocumentFragment(),y=this.createSelectAll(l,h),C=(s.appendChild(y),{}),b=[],x=[],S=(e.forEach(function(e){var t,r;""===e[g]?C.isBlank||(C.isBlank=!0,(t={})[g]=v.getConstant("Blanks"),n=Fh(a,Number(e.__rowIndex)-1),r=k.createCboxWithWrap(k.getUid("cbox"),h.createCheckbox(t[g],!n,t),"e-ftrchk"),1===s.childElementCount?s.appendChild(r):s.insertBefore(r,s.children[1]),m.splice(0,0,t[g]),n)||(b.push(t[g]),x.push(t[g])):C[e[g]]||(C[e[g]]=!0,n=Fh(a,Number(e.__rowIndex)-1),i=e[g],s.appendChild(k.createCboxWithWrap(k.getUid("cbox"),h.createCheckbox(i,!n,e),"e-ftrchk")),m.push(i),n)||(b.push(i),x.push(i))}),l.element.appendChild(s),y.querySelector(".e-frame")),w=(S.classList.add("e-selectall"),y.querySelector(".e-chk-hidden")),I=(this.updateState(l,S,w,x.length!==m.length,x.length),[].slice.call(l.element.childNodes)),E=(l.element.addEventListener("click",function(e){var t;p?null!==(t=f.cboxListSelected(l,p,l.element.childElementCount-2,e,!0))&&(u=t):f.cboxListSelected(l,x,m.length,e)}),function(e){var t;e.toLowerCase().includes(o)&&((t={})[l.column.field]=e,s.appendChild(k.createCboxWithWrap(k.getUid("cbox"),h.createCheckbox(e,!0,t),"e-ftrchk")),c.push(e),p.push(e))}),N=1e3<l.dataSource.length?l.dataSource.length:1e3,R=m,F=d.length<=N?function(){m.forEach(function(e){E(e)})}:function(){r||(R=[],b=[],x=[],r=new H.DataManager(d).executeLocal((new H.Query).sortBy(g+"_value","ascending")),C={},r.forEach(function(e){""===e[g]?C.isBlank||(C.isBlank=!0,i=v.getConstant("Blanks"),R.splice(0,0,i),Fh(a,Number(e.__rowIndex)-1))||(b.push(i),x.push(i)):C[e[g]]||(i=e[g],C[i]=!0,R.push(e[g]),Fh(a,Number(e.__rowIndex)-1))||(x.push(i),b.push(i))}));for(var e=0,t=R.length;e<t&&c.length<N;e++)E(R[e])};this.wireFilterEvents(l,function(){if(c)if(u){var e;x=b;for(var t=0,r=c.length;t<r;t++)e=c[t],c.length===p.length||-1<p.indexOf(e)?-1===x.indexOf(e)&&x.push(e):-1<(e=x.indexOf(e))&&x.splice(e,1)}else x=p;var n=x.length;if(n===m.length&&(!p||d.length<=N))f.filterSuccessHandler(new H.DataManager(l.dataSource),{action:"clear-filter",field:l.column.field});else{var i=[],o={field:g,ignoreAccent:!1,matchCase:!1,isFilterByMenu:!0},a=ee.getNumericObject(f.parent.locale),s=function(e){var t=l.type;"number"===t&&(e===v.getConstant("Blanks")?(e="",t="string"):oe(Kn([e],f.parent,a)[0])||(t="string")),i.push(Object.assign({value:e,type:t},o))};if(n>R.length/2){o.operator="notequal",o.predicate="and";for(t=0,r=R.length;t<r;t++)-1===x.indexOf(R[t])&&s(R[t])}else{o.operator="equal",o.predicate="or";for(t=0,r=n;t<r;t++)s(x[t])}h.initiateFilter(i)}},function(e){if("keyup"===e.event.type)o=e.event.target.value.toLowerCase();else if(e.event.target.classList.contains("e-search-icon"))return;var t;(s=document.createDocumentFragment()).appendChild(y),o?(c=[],p=[],F(),p.length?(f.updateState(l,S,w,!1,0),y.classList.remove("e-hide"),(e={})[g]=v.getConstant("AddCurrentSelection"),e=k.createCboxWithWrap(k.getUid("cbox"),h.createCheckbox(e[g],!1,e),"e-ftrchk"),s.insertBefore(e,s.children[1]),e.querySelector(".e-frame").classList.add("e-add-current")):(y.classList.add("e-hide"),e=f.parent.createElement("div",{className:"e-checkfltrnmdiv"}),(t=f.parent.createElement("span")).innerText=v.getConstant("NoResult"),e.appendChild(t),s.appendChild(e),l.btnObj.element.disabled=!0)):I&&(c=p=null,f.updateState(l,S,w,x.length!==m.length,x.length),y.classList.remove("e-hide"),I.forEach(function(e){s.appendChild(e)})),l.element.innerHTML="",l.element.appendChild(s)}.bind(this))},p.prototype.createSelectAll=function(e,t){var r={};return r[e.column.field]=this.parent.serviceLocator.getService(T).getConstant("SelectAll"),k.createCboxWithWrap(k.getUid("cbox"),t.createCheckbox(r[e.column.field],!1,r),"e-ftrchk")},p.prototype.updateState=function(e,t,r,n,i){ee.removeClass([t],["e-check","e-stop","e-uncheck"]),e.btnObj.element.disabled&&(e.btnObj.element.disabled=!1),n?i?t.classList.add("e-stop"):(t.classList.add("e-uncheck"),i=e.element.querySelector(".e-add-current"),e.btnObj.element.disabled=!i||!i.classList.contains("e-check")):t.classList.add("e-check"),r.indeterminate=n,r.checked=!n},p.prototype.beforeFilteringHandler=function(n){var a,e,t,s=this;n.instance&&n.instance.options&&(n.isOpen&&"string"===n.instance.options.type&&"."!==(e=ee.getNumericObject(this.parent.locale)).decimal&&2===(t=n.arg3.toString().split(".")).length&&(t=t.join(e.decimal),oe(new ee.Internationalization(this.parent.locale).parseNumber(t,{format:"n"})))&&(n.arg3=t),a=function(e,t){var r,n,i,o;return t&&("notequal"===t||s.isCustomNumFilter(t))?e?oe(e)?e=parseFloat(e.toString()):"string"==typeof e&&(i=ee.getNumericObject(s.parent.locale),r=new ee.Internationalization(s.parent.locale),o={},(o=!e.includes(i.percentSign)||""===(n=e.trim().split("%"))[0]||n[1]?o:Nn({value:n[0]},s.parent.locale,i.group,i.decimal)).isNumber?e=Number(o.value)/100:oe(n=r.parseNumber(e.trim(),{format:"n"}))?e=n:(i=e.trim(),s.parent.notify(At,o={value:i,cell:{value:i}}),(o.isTime||o.isDate)&&(e=parseFloat(o.updatedVal)))):"notequal"===t&&null===e&&(e=""):"equal"===t&&(oe(e)?e=e.toString():"string"==typeof e&&oe(a(e,"notequal"))?e=e.trim():null===e&&(e="")),e},"date"!==n.instance.options.type?(n.arg3=a(n.arg3,n.arg2),n.arg8=a(n.arg8,n.arg7)):"yMd"===n.instance.options.format&&(e=function(e,t){var r;return e&&("string"==typeof e?(r=e.trim(),s.parent.notify(At,r={value:r,cell:{value:r}}),r.isDate?e="equal"===t?r.dateObj:parseFloat(r.updatedVal):"equal"!==t&&"notequal"!==t||(oe(r=a(e,"notequal"))?(n.instance.options.type="number","notequal"===t&&(e=r)):n.instance.options.type="string")):ai(e)&&"equal"!==t&&(e=oi(e,!0))),e},2===(t=document.querySelectorAll(".e-xlfl-valuediv input.e-datepicker")).length?(n.arg3=e(n.arg3||t[0].value,n.arg2),n.arg8=e(n.arg8||t[1].value,n.arg7)):n.arg3&&(n.arg3=e(n.arg3,n.arg2))))},p.prototype.customFilterOpen=function(e){for(var t=document.querySelectorAll(".e-xlfl-optrdiv input.e-dropdownlist"),r=[],n=0;n<t.length;n++){var i=ee.getComponent(t[n],"dropdownlist");i&&r.push(i.value)}var o=[];if(2===r.length)for(var a,s=this.filterCollection.get(this.parent.activeSheetIndex),n=0;n<s.length;n++)s[n].field===e.column&&null!==s[n].value&&-1<(a=r.indexOf(s[n].operator))&&("equal"===s[n].operator&&ai(s[n].value)?o[a]=oi(s[n].value,!0).toString():o[a]=s[n].value.toString(),r[a]="");function l(e){if("."!==h.decimal&&oe(e)){var t=e.toString();if(t.includes("."))return t.replace(".",h.decimal)}return e}var h=ee.getNumericObject(this.parent.locale),d=document.querySelectorAll(".e-xlfl-valuediv input.e-ss-filter-input");if(d.length)for(n=0;n<d.length;n++){var p=new S.TextBox({placeholder:this.parent.serviceLocator.getService(T).getConstant("CustomFilterPlaceHolder")});o[n]&&(p.value=l(o[n])),p.appendTo(d[n])}else for(var c=document.querySelectorAll(".e-xlfl-valuediv input.e-datepicker"),u=void 0,f=void 0,n=0;n<c.length;n++)f=oe(o[n])?this.parent.getDisplayText({value:o[n],format:Pl("ShortDate")+(o[n].includes(".")?" "+Pl("Time"):"")}):l(o[n]),(u=ee.getComponent(c[n],"datepicker"))&&(u.value=f,c[n].value=f)},p.prototype.wireFilterEvents=function(e,t,r){var n=this,i=(e.btnObj.element.addEventListener("click",t.bind(this)),e.searchBox.addEventListener("keydown",function(e){13===e.keyCode&&t()}),function(){n.parent.off(Zs,r),n.parent.off(k.filterDialogClose,i),ce(n.parent.element)});this.parent.on(k.filterDialogClose,i,this),this.parent.on(Zs,r,this)},p.prototype.initTreeView=function(t,e){function r(e){f[""+l]=!0,Fh(x,Number(e.__rowIndex)-1)?b=!0:c.push(l),u.push(l)}function n(e){var t=[e.node];!e.event.target.classList.contains("e-fullrow")&&"Enter"!==e.event.key||("true"===E.getNode(e.node).isChecked?E.uncheckAll(t):E.checkAll(t))}var i,o,a,s,l,h,d,p=this,c=[],u=[],f={},g=[],m=[],v=[],y=[],C=["January","February","March","April","May","June","July","August","September","October","November","December"],b=!1,x=this.parent.getActiveSheet(),S=(t.dataSource.forEach(function(e){"object"==typeof(a=e[t.column.field])&&Date.parse(a.toString())?(i=a.getFullYear().toString(),f[""+i]||((d={__rowIndex:i,hasChild:!0})[t.column.field]=i,g.push(d),f[""+i]=!0),h=a.getMonth(),f[s=i+" "+(o=C[h])]||((d={__rowIndex:s,pId:i,hasChild:!0,month:h})[t.column.field]=o,m.push(d),f[s]=!0),h=a.getDate(),l=s+" "+h.toString(),f[""+l]||((d={__rowIndex:l,pId:s})[t.column.field]=h,v.push(d),r(e))):(i=e[t.column.field]||0===e[t.column.field]?(l="text "+e[t.column.field].toString().toLowerCase(),e[t.column.field]):(l="blanks",p.parent.serviceLocator.getService(T).getConstant("Blanks")),f[""+l]||((d={__rowIndex:l})[t.column.field]=i,y.push(d),r(e)))}),g=new H.DataManager(g).executeLocal((new H.Query).sortBy(t.column.field,"decending")),m=new H.DataManager(m).executeLocal((new H.Query).sortBy("month","ascending")),v=new H.DataManager(v).executeLocal((new H.Query).sortBy(t.column.field,"ascending")),v=g.concat(m.concat(v)),y.length&&(y=new H.DataManager(y).executeLocal((new H.Query).sortBy(t.column.field,"ascending")),v=v.concat(y)),this.createSelectAll(t,e)),w=(S.addEventListener("click",function(){I.indeterminate=!1,w.classList.contains("e-check")?(E.uncheckAll(),w.classList.add("e-uncheck"),I.checked=!1):(E.checkAll(),w.classList.add("e-check"),I.checked=!0)}.bind(this)),S.classList.add("e-spreadsheet-ftrchk"),S.querySelector(".e-frame")),I=(w.classList.add("e-selectall"),t.element.appendChild(S),S.querySelector(".e-chk-hidden")),S=this.parent.createElement("div"),E=new D.TreeView({fields:{dataSource:v,id:"__rowIndex",parentID:"pId",text:t.column.field,hasChildren:"hasChild"},enableRtl:this.parent.enableRtl,showCheckBox:!0,cssClass:"e-checkboxtree",checkedNodes:c,nodeClicked:n.bind(this),keyPress:n.bind(this),nodeChecked:function(e){"indeterminate"!==e.action&&(b=E.checkedNodes.length!==E.fields.dataSource.length,p.updateState(t,w,I,b,E.checkedNodes.length))}});E.createElement=this.parent.createElement,E.appendTo(S),t.element.appendChild(S),c=E.checkedNodes,this.updateState(t,w,I,b,E.checkedNodes.length);this.treeViewObj=E,this.treeViewEle=S,this.cBox=I,this.wireFilterEvents(t,function(){E.checkedNodes.length===v.length?p.filterSuccessHandler(new H.DataManager(t.dataSource),{action:"clear-filter",field:t.column.field}):p.generatePredicate(E.checkedNodes,y.length?"string":t.type,t.column.field,e,u,E.checkedNodes.length>v.length/2)},this.refreshCheckbox.bind(this,v,E,c))},p.prototype.generatePredicate=function(e,t,r,n,i,o){function a(){"blanks"===l[0]?c.push(Object.assign({value:"",type:t},f)):"text"===l[0]&&(l.splice(0,1),d=l.join(" "),p=isNaN(Number(d))?"string":(d=Number(d),"number"),c.push(Object.assign({value:d,type:p},f)))}function s(){(h=new Date(Number(l[0]),u[l[1]],Number(l[2]))).getDate()?c.push(Object.assign({value:h,type:t},f)):a()}var l,h,d,p,c=[],u={January:0,February:1,March:2,April:3,May:4,June:5,July:6,August:7,September:8,October:9,November:10,December:11};if(o)for(var f={field:r,ignoreAccent:!1,matchCase:!1,predicate:"and",operator:"notequal",isFilterByMenu:!0},g=0,m=i.length;g<m;g++)-1===e.indexOf(i[g])&&(l=i[g].split(" "),s());else{f={field:r,ignoreAccent:!1,matchCase:!1,predicate:"or",operator:"equal",isFilterByMenu:!0};for(g=0,m=e.length;g<m;g++)(3===(l=e[g].split(" ")).length?s:a)()}n.initiateFilter(c)},p.prototype.refreshCheckbox=function(e,t,r,n){if("keyup"===n.event.type)o=n.event.target.value;else if(n.event.target.classList.contains("e-search-icon"))return;function i(){var e;a.length&&!t.fields.dataSource.length&&((e=t.element.parentElement).getElementsByClassName("e-spreadsheet-ftrchk")[0].classList.remove("e-hide"),ee.detach(e.getElementsByClassName("e-checkfltrnmdiv")[0])),t.fields.dataSource=a,t.dataBind()}if(o){var o,a=new H.DataManager(e).executeLocal((new H.Query).where(new H.Predicate(t.fields.text,"contains",o,!0))),s={},l=[],h=void 0,n=void 0,d=void 0,p=void 0;if(isNaN(Number(o))){for(var c=0;c<a.length;c++)a[c].hasChild&&(l.push(new H.Predicate("pId","equal",a[c].__rowIndex,!1)),s[""+(h=a[c].pId)]||(l.push(new H.Predicate("__rowIndex","equal",h,!1)),s[""+h]=!0));n=a,p=1}else{for(var u,f={},d=[],c=0;c<a.length;c++)(h=a[c].pId)?(u=h.split(" ")[0],s[""+h]||(l.push(new H.Predicate("__rowIndex","equal",h,!1)),s[""+h]=!0,d.push(u),d.push(h)),f[""+u]||(s[""+u]||(l.push(new H.Predicate("__rowIndex","equal",u,!1)),s[""+u]=!0),l.push(new H.Predicate("__rowIndex","equal",a[c].__rowIndex,!1)))):f[""+(h=a[c].__rowIndex)]||(l.push(new H.Predicate("__rowIndex","contains",h,!1)),f[""+h]=!0);n=[]}a.length?(l.length&&(a=n.concat(new H.DataManager(e).executeLocal((new H.Query).where(H.Predicate.or(l))))),i(),t.checkAll(),o=t.animation.expand.duration,t.animation.expand.duration=0,t.expandAll(d,p),t.animation.expand.duration=o):t.fields.dataSource.length&&(i(),(n=t.element.parentElement).getElementsByClassName("e-spreadsheet-ftrchk")[0].classList.add("e-hide"),p=this.parent.createElement("div",{className:"e-checkfltrnmdiv"}),(o=this.parent.createElement("span")).innerText=this.parent.serviceLocator.getService(T).getConstant("NoResult"),p.appendChild(o),n.appendChild(p))}else a=e,i(),t.checkedNodes=r,t.refresh()},p.prototype.openDialog=function(d){var p,c,u=this,e=parseInt(d.getAttribute("aria-colindex"),10),f=ue(e),t=(this.parent.showSpinner(),this.parent.activeSheetIndex),r=this.filterRange.get(t),n=r.range.slice(),i=this.parent.getActiveSheet(),o=se(n[0],e-1,i),g=this.parent.getDisplayText(o),o=(r.allowHeaderFilter||(n[0]=n[0]+1),r.useFilterRange||(n[2]=i.usedRange.rowIndex),[n[0],e-1,n[2],e-1]),r=this.getPredicateRange(o,this.filterCollection.get(t),e-1),m=r.otherColPredicate,v=r.curPredicate,t=(v.length&&((p={})[f]=v),i.name+"!"+r.address),o=re(o),i=this.getColumnType(i,e-1,n),y=i.type,C="date"===y||i.isDateAvail,b="number"===y,x=C||b,S=i.isMultiFormattedCol;x&&!r.filteredCol&&(c=[]),pi(this.parent,t,!0,!0,null,!0,null,null,!0,o,null,c).then(function(t){u.parent.element.style.position="relative",u.parent.element.classList.add("e-filter-open"),h=x?(s=c||!m.length?new H.DataManager(c||t):(o=u.getPredicates(m),o=ei(new H.DataManager(t),o.predicates,o.equalOrPredicates),new H.DataManager(o)),u.parent.on($s,r=function(e){u.parent.off($s,r),e.isCheckboxFilterTemplate=!0,C?u.initTreeView(e,l):u.initCboxList(e,l,t)},u),[]):(s=m.length?(h=u.getPredicates(m),o=ei(new H.DataManager(t),h.predicates,h.equalOrPredicates),new H.DataManager(o)):new H.DataManager(t),u.getClonedPredicates(v));var r,n,e,i,o=d.querySelector(".e-filter-btn"),a={field:f,filter:{}},s=(b&&(n=u.parent,a.filterTemplate=function(e){if(!n.isReact||!e)return[n.createElement("input",{className:"e-ss-filter-input"})];e.appendChild(n.createElement("input",{className:"e-ss-filter-input"}))},a.getFilterTemplate=function(){return s=a.filterTemplate,function(e,t,r,n,i,o,a){return s(a)};var s},n.isReact)&&!n.renderTemplates&&(n.renderTemplates=function(e){return e()}),{type:y,field:f,format:"date"===y?"yMd":null,displayName:g||"Column "+f,dataSource:s||[],height:u.parent.element.classList.contains("e-bigger")?800:500,columns:[],hideSearchbox:!1,filteredColumns:h,column:a,handler:u.filterSuccessHandler.bind(u,new H.DataManager(t)),target:o,position:{X:0,Y:0},localeObj:u.parent.serviceLocator.getService(T),actualPredicate:p,isFormatted:x&&!C,isMultiFormattedCol:S}),l=new k.ExcelFilterBase(u.parent,u.getLocalizedCustomOperators()),h=(l.openDialog(s),document.querySelector(".e-filter-popup"));h&&h.id.includes(u.parent.element.id)&&(ee.EventHandler.add(h,ld(),u.filterMouseDownHandler,u),s=u.parent.element.getBoundingClientRect(),o=o.getBoundingClientRect(),e=h.getBoundingClientRect(),(i=o.right-s.left-e.width)<0&&(i=o.left-s.left),h.style.left=i*u.parent.viewport.scaleX+"px",h.style.top="0px",h.style.visibility="hidden",h.classList.contains("e-hide")&&h.classList.remove("e-hide"),i=o.bottom-s.top,0<e.height-(s.bottom-o.bottom)&&(i-=e.height-(s.bottom-o.bottom))<0&&(i=0),h.style.top=i*u.parent.viewport.scaleY+"px",h.style.visibility=""),u.parent.hideSpinner()})},p.prototype.getPredicateRange=function(t,e,r){var n,i,o,a=re(t),s=[],l=[];return e&&e.length?e.forEach(function(e){e.field&&(i=""+e.field+(t[0]+1)+":"+e.field+(t[2]+1),o=R(e.field),a.includes(i)||(a+=","+i,o<t[1]&&(t[1]=o),o>t[3]&&(t[3]=o)),void 0!==r)&&(o===r?(n=!0,l):s).push(e)}):n=!0,void 0===r?a:{address:a,filteredCol:n,otherColPredicate:s,curPredicate:l}},p.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")},p.prototype.filterCboxValueHandler=function(e){var t;e.column&&e.data&&(t=e.column.field,e.value)&&(t=se((t=W(t+e.data.dataObj.__rowIndex))[0],t[1],this.parent.getActiveSheet()))&&t.format&&(e.value=this.parent.getDisplayText(t))},p.prototype.selectSortItemHandler=function(e){var t=this.parent.serviceLocator.getService(T),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 e=this.parent.getActiveSheet(),n=this.parent.activeSheetIndex,t=this.filterRange.get(n),i=t.range.slice();if(t.allowHeaderFilter||(i[0]=i[0]+1),t.useFilterRange||(i[2]=e.usedRange.rowIndex),Xd(this.parent,i))this.closeDialog(),this.parent.notify(qa,null);else{this.parent.sortCollection=this.parent.sortCollection||[];for(var o=[],a=this.parent.sortCollection.length-1;0<=a;a--)this.parent.sortCollection[a]&&this.parent.sortCollection[a].sheetIndex===n&&(o.push(this.parent.sortCollection[a]),this.parent.sortCollection.splice(a,1));this.parent.sortCollection.push({sortRange:re(i),columnIndex:P(e.activeCell)[1],order:r,sheetIndex:n}),this.parent.notify(Jo,{sortOptions:{sortDescriptors:{order:r},containsHeader:!1},previousSort:o,range:re(i)}),this.refreshFilterRange(),this.closeDialog()}}},p.prototype.filterSuccessHandler=function(e,t){var r=t.sIdx,n=(r||0===r||(r=t.isOpen?0:this.parent.activeSheetIndex),t.prevPredicates||[].slice.call(this.filterCollection.get(r))),i=(t.isFilterByValue&&!n.length&&(n=void 0),this.filterCollection.get(r));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),i={datasource:e,predicates:(e=this.getPredicates(i)).predicates,equalOrPredicates:e.equalOrPredicates},(e=this.filterRange.get(r)).useFilterRange||(e.range[2]=ae(this.parent,r).usedRange.rowIndex),this.applyFilter(i,re(e.range),r,n,!1,t.isInternal,t.isFilterByValue))},p.prototype.isCustomNumFilter=function(e){return e.includes("greaterthan")||e.includes("lessthan")||"between"===e},p.prototype.getClonedPredicates=function(e,t){void 0===t&&(t=[]);for(var r,n,i=[],o=0;o<e.length;o++)r=e[o],(this.isCustomNumFilter(r.operator)||!r.isFilterByMenu&&"notequal"===r.operator)&&oe(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},p.prototype.updatePredicate=function(e,t){for(var r=new H.DataManager(e),n=new H.Query,i=r.executeLocal(n.where("field","equal",t)),o=0;o<i.length;o++){for(var a=-1,s=0;s<e.length;s++)if(e[s].field===i[o].field){a=s;break}-1!==a&&e.splice(a,1)}},p.prototype.applyFilter=function(e,t,r,n,i,o,a){var s=this,l={range:t,predicates:[].slice.call(this.filterCollection.get(r)),previousPredicates:n,sheetIndex:r,cancel:!1};!o&&!a&&(this.parent.notify(gt,{action:"filter",eventArgs:l}),l.cancel)||(t.indexOf("!")<0&&(t=this.parent.sheets[r].name+"!"+t),this.parent.showSpinner(),n={args:{range:t,filterOptions:e},promise:new Promise(function(e){e(void 0)}),refresh:i},a=Yd(this.parent),this.parent.notify(rr,n),r=Yd(this.parent),this.parent.notify(Cs,{prevChartIndexes:a,currentChartIndexes:r}),n.promise.then(function(e){return s.refreshFilterRange(),s.parent.hideSpinner(),o||(delete l.cancel,s.parent.notify(le,{action:"filter",eventArgs:l}),document.activeElement.id!==s.parent.element.id+"_SearchBox"&&ce(s.parent.element)),Promise.resolve(e)}).catch(function(e){return s.filterRangeAlertHandler({error:e}),Promise.reject(e)}))},p.prototype.getPredicates=function(e){var o,t=[],r=this.getClonedPredicates(e,t);if(t.length){for(var n,i,a,s=new Map,l=0;l<r.length;l++)n=r[l].field.replace("_value",""),-1<t.indexOf(n)&&(i=r.splice(l,1)[0],l--,s.has(n)?s.get(n).push(i):s.set(n,[i]));o=[],s.forEach(function(e){a=[];for(var t=k.CheckBoxFilterBase.getPredicate(e),r=0,n=Object.keys(t);r<n.length;r++){var i=n[r];a.push(t[""+i])}o.push(a)})}for(var h=[],d=k.CheckBoxFilterBase.getPredicate(r),p=0,c=Object.keys(d);p<c.length;p++){var u=c[p];h.push(d[""+u])}return{predicates:h,equalOrPredicates:o}},p.prototype.getColumnType=function(e,t,r){for(var n,i,o,a,s=0,l=0,h=0,d=r[0];d<=r[2];d++)if(n=se(d,t,e)){if(n.format&&"General"!==n.format){switch(Ml(n.format).toLowerCase()){case"number":case"currency":case"accounting":case"percentage":s++;break;case"shortdate":case"longdate":h++;break;case"time":s++;break;case"text":l++;break;default:Wi(n.format,!0,i={})?"date"===i.type?h++:s++:oe(n.value)?s++:n.value&&l++}o=o||n.format}else oe(n.value)?s++:n.value&&l++;o&&o!==n.format&&(a=!0)}return{type:l<s&&h<s&&0<s?"number":s<=l&&h<=l&&0<=l?"string":s<h&&l<h&&0<h?"date":"datetime",isDateAvail:!!h,isMultiFormattedCol:a}},p.prototype.clearFilterHandler=function(e){var t=e&&!ee.isNullOrUndefined(e.sheetIndex)?e.sheetIndex:this.parent.activeSheetIndex;if(e&&e.field){var r=[].slice.call(this.filterCollection.get(t));r&&r.length&&(this.updatePredicate(r,e.field),this.initiateFilterUIHandler({predicates:r,range:re(this.filterRange.get(t).range),sIdx:t}))}else{var r=e&&e.isAction,n={isFiltered:!1,isClearAll:!0,sheetIndex:t};if(this.getFilteredColumnHandler(n),n.isFiltered||e&&e.preventRefresh){var n=void 0,i=ae(this.parent,t),o=this.filterRange.get(t),a=o.range;if(!r||(n={range:re(a),predicates:[],previousPredicates:this.filterCollection.get(t),sheetIndex:t,cancel:!1},this.parent.notify(gt,{action:"filter",eventArgs:n}),!n.cancel)){this.filterCollection.set(t,[]);var s=o.useFilterRange?a[2]:i.usedRange.rowIndex;if(this.parent.scrollSettings.enableVirtualization&&s-a[0]+1>this.parent.viewport.rowCount+2*this.parent.getThreshold("row")){for(var l=0;l<=s;l++)Rh(i,l,{hidden:!1,isFiltered:!1});e&&e.preventRefresh||this.parent.renderModule.refreshSheet(!1,!1,!0)}else{this.refreshFilterRange(null,null,t);o={startIndex:a[0],hide:!1,isFiltering:!0,refreshUI:!1,endIndex:o.useFilterRange?a[2]:i.usedRange.rowIndex,sheetIndex:t};this.parent.notify(Pr,o),!o.refreshUI||e&&e.preventRefresh||this.parent.renderModule.refreshSheet(!1,!1,!0)}r&&(delete n.cancel,this.parent.notify(le,{action:"filter",eventArgs:n}),ce(this.parent.element))}}}},p.prototype.reapplyFilterHandler=function(r,n){var i,o,e,t,a=this,s=this.parent.activeSheetIndex;this.filterRange.has(s)&&(i=this.filterCollection.get(s))&&i.length&&(t=ae(this.parent,s),e=(o=this.filterRange.get(s)).range.slice(),o.allowHeaderFilter||(e[0]=e[0]+1),o.useFilterRange||(e[2]=t.usedRange.rowIndex),e[1]=e[3]=R(i[0].field),t=t.name+"!"+this.getPredicateRange(e,i.slice(1,i.length)),pi(this.parent,t,!0,!0,null,!0,null,null,!1,re(e)).then(function(e){var t=a.getPredicates(a.filterCollection.get(s));a.applyFilter({predicates:t.predicates,datasource:new H.DataManager(e),equalOrPredicates:t.equalOrPredicates},re(o.range),s,[].slice.call(i),n,r)}))},p.prototype.getFilterRangeHandler=function(e){var t=ee.isNullOrUndefined(e.sheetIdx)?this.parent.activeSheetIndex:e.sheetIdx,r=this.filterRange&&this.filterRange.get(t);r?(e.hasFilter=!0,e.filterRange=r.range,e.allowHeaderFilter=r.allowHeaderFilter,e.isFiltered=this.filterCollection&&this.filterCollection.get(t)&&0<this.filterCollection.get(t).length):(e.hasFilter=!1,e.filterRange=null)},p.prototype.getLocalizedCustomOperators=function(){var e=this.parent.serviceLocator.getService(T),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")}]}},p.prototype.setFilteredCollection=function(o){var a=this,e={sheetIdx:o.sheetIdx};if(this.getFilterRangeHandler(e),e.hasFilter){for(var t,s,l={sheetIndex:o.sheetIdx,filterRange:re(e.filterRange),hasFilter:!0,column:[],criteria:[],value:[],dataType:[],predicates:[]},r=(o.saveJson.filterCollection.push(l),this.filterCollection.get(o.sheetIdx)),n=new Map,h=function(e){var t;return ee.isNullOrUndefined(e)?"":o.isSaveAction&&"date"===s?(t=e).getMonth()+1+"/"+t.getDate()+"/"+t.getFullYear()+" "+t.getHours()+":"+t.getMinutes()+":"+t.getSeconds():e},i=0;i<r.length;i++)t=r[i],o.isSaveAction&&"notequal"===t.operator&&t.isFilterByMenu?n.has(t.field)?n.get(t.field).push(t):n.set(t.field,[t]):(l.column.push(R(t.field)),l.criteria.push(t.operator),o.isSaveAction?"equal"===t.operator?(s=ai(t.value)?"date":"string",l.value.push(h(t.value)),l.dataType.push(s)):(l.value.push(t.value),l.dataType.push("custom")):(l.value.push(t.value),l.dataType.push(t.type)),l.predicates.push(t.predicate));var d,p=new Map;n.forEach(function(e,t){d=R(t),p.has(t)||p.set(t,a.getColData(d,t,o.sheetIdx));for(var r=p.get(t),e=a.getPredicates(e).predicates,n=new H.DataManager(r).executeLocal((new H.Query).where(H.Predicate.and(e))),i=0;i<n.length;i++)l.column.push(d),l.criteria.push("equal"),s=ai(n[i][t])?"date":"string",l.value.push(h(n[i][t])),l.dataType.push(s),l.predicates.push("or")})}},p.prototype.updateFilter=function(e){if(this.parent.filterCollection&&(e.initLoad||e.isOpen)){for(var t=void 0,r=void 0,n={},i=void 0,o=0;o<this.parent.filterCollection.length;o++){var a=(r=this.parent.filterCollection[o]).sheetIndex;if(0!==o||this.parent.isOpen||e.isOpen||(a=0),t=[],r.column)for(var s=0;s<r.column.length;s++)if(i={field:ue(r.column[s]+1),operator:this.getFilterOperator(r.criteria[s]),value:"string"==typeof r.value[s]?r.value[s].split("*").join(""):r.value[s],predicate:r.predicates&&r.predicates[s],type:r.dataType&&r.dataType[s]},-1<["year","month","day"].indexOf(i.type)){var l={value:i.value,cell:{value:i.value}};if(this.parent.notify(At,l),l.isDate){l=l.dateObj;if(i.value=l,"day"===i.type)i.type="date",i.predicate="or",t.push(i);else{i.operator="greaterthanorequal",i.predicate="and";var h=i.type;i.type="date",h=this.getPredicates([i,{field:i.field,operator:"lessthanorequal",predicate:"and",type:"date",value:new Date(l.getFullYear(),"year"===h?12:l.getMonth()+1,0,0,0,0)}]).predicates,n[i.field]||(n[i.field]=this.getColData(r.column[s],i.field,o));for(var d=new H.DataManager(n[i.field]).executeLocal((new H.Query).where(H.Predicate.and(h))),p=0;p<d.length;p++)t.push({field:i.field,operator:"equal",predicate:"or",type:"date",value:d[p][i.field]})}}}else{var c,u,l={isOpen:!0,instance:{options:{type:i.type}},arg3:i.value,arg2:i.operator};this.beforeFilteringHandler(l),i.value=l.arg3,"string"===i.type||"custom"===i.type?this.isCustomNumFilter(i.operator)&&oe(i.value)&&(i.type="number"):"date"===i.type&&"equal"===i.operator&&"string"==typeof i.value&&i.value.includes("/")&&i.value.includes(":")&&2===(h=i.value.split(" ")).length&&(c=h[0].split("/"),u=h[1].split(":"),3===c.length)&&3===u.length&&(i.value=new Date(Number(c[2]),Number(c[0])-1,Number(c[1]),Number(u[0]),Number(u[1]),Number(u[2]))),t.push(i)}if(!e.isOpen)for(var f=0;f<t.length-1;f++)t[f].field===t[f+1].field&&(t[f].predicate||(t[f].predicate="or"),t[f+1].predicate||(t[f+1].predicate="or"));this.parent.notify(xa,{predicates:t.length?t:void 0,range:r.filterRange,sIdx:a,isInternal:!0,isOpen:e.isOpen})}this.parent.sortCollection&&this.parent.notify(mt,null),this.parent.setProperties({filterCollection:null},!0)}},p.prototype.getColData=function(e,t,r){var n=ae(this.parent,r);if(!n.rows||!n.rows.length)return[];for(var i,o,a=[],s=1,l=n.rows.length;s<l;s++)n.rows[s]&&(o=se(s,e,n,!1,!0))&&o.value&&((i={})[t]=ci(this.parent,o,s,e),a.push(i));return a},p.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},p.prototype.beforeInsertHandler=function(r){if("Column"===r.modelType){var e,t=(ee.isUndefined(r.activeSheetIndex)?this.parent:r).activeSheetIndex;this.filterRange.size&&this.filterRange.has(t)&&(e=this.filterRange.get(t).range,this.isFilterCell(t,e[0],r.index)||r.index<e[1])&&(e[3]+=r.model.length,r.index<=e[1]&&(e[1]+=r.model.length),this.filterCollection.get(t).forEach(function(e){var t=R(e.field);r.index<=t&&(e.field=ue(t+r.model.length+1))}),this.parent.sortCollection)&&this.parent.sortCollection.forEach(function(e){e.sheetIndex===t&&r.index<=e.columnIndex&&(e.columnIndex+=r.model.length)})}else if("Sheet"===r.modelType){for(var n=0,i=Array.from(this.filterRange.keys()).sort().reverse();n<i.length;n++){var o=i[n];r.index<=o&&(this.filterRange.set(o+r.model.length,this.filterRange.get(o)),this.filterRange.delete(o),this.filterCollection.set(o+r.model.length,this.filterCollection.get(o)),this.filterCollection.delete(o))}this.parent.sortCollection&&this.parent.sortCollection.forEach(function(e){r.index<=e.sheetIndex&&(e.sheetIndex+=r.model.length)})}},p.prototype.beforeDeleteHandler=function(e){if("Column"===e.modelType){var t=this.parent.activeSheetIndex;if(this.filterRange.size&&this.filterRange.has(t)){var r=!0,n=this.filterRange.get(t).range;if(e.start>=n[1]&&e.end<=n[3]?n[3]-=e.end-e.start+1:e.start<n[1]&&e.end<n[1]?(n[1]-=e.end-e.start+1,n[3]-=e.end-e.start+1):e.start<n[1]&&e.end>n[1]&&e.end<n[3]?(n[1]=e.start,n[3]-=e.end-e.start+1):r=!1,r){for(var i=this.filterCollection.get(t),o=void 0,a=i.length-1;0<=a;a--){var s=R(i[a].field);e.end<s?i[a].field=ue(s-(e.end-e.start+1)+1):e.start<=s&&e.end>=s&&(o=!0,i.splice(a,1))}var l=this.parent.sortCollection;if(l)for(a=0;a<l.length;a++)if(l[a].sheetIndex===t){if(e.end<l[a].columnIndex){l[a].columnIndex=l[a].columnIndex-(e.end-e.start+1);break}if(e.start<=l[a].columnIndex&&e.end>=l[a].columnIndex){l.splice(a,1);break}}n.some(function(e){return e<0})?(this.removeFilter(t,!0,!0),e.refreshSheet=!0):o&&(i&&i.length?(this.reapplyFilterHandler(!0,!0),e.refreshSheet=!1):(this.clearFilterHandler({preventRefresh:!0}),e.refreshSheet=!0))}}}},p.prototype.deleteSheetHandler=function(e){if(ee.isUndefined(e.sheetIndex))this.filterRange.get(this.parent.activeSheetIndex)&&(this.filterRange.delete(this.parent.activeSheetIndex),this.filterCollection.delete(this.parent.activeSheetIndex));else{for(var t=0,r=Array.from(this.filterRange.keys()).sort().reverse();t<r.length;t++){var n=r[t];e.sheetIndex===n?(this.filterRange.delete(n),this.filterCollection.delete(n)):e.sheetIndex<n&&(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))}var i=this.parent.sortCollection;if(i)for(var o=i.length-1;0<=o;o--)e.sheetIndex===i[o].sheetIndex?i.splice(o,1):e.sheetIndex<i[o].sheetIndex&&--i[o].sheetIndex}},p.prototype.clearHandler=function(e){var t,e=this.parent.getAddressInfo(e.range);this.filterRange.has(e.sheetIndex)&&(t=this.filterRange.get(e.sheetIndex).range.slice(),Tn(e.indices,t[0],t[1]))&&Tn(e.indices,t[0],t[3])&&this.removeFilter(e.sheetIndex)},p.prototype.duplicateSheetFilterHandler=function(e){for(var t,r=0,n=Array.from(this.filterRange.keys()).sort().reverse();r<n.length;r++){var i=n[r];if(!(e.newSheetIndex<=i))break;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)}this.filterCollection.has(e.sheetIndex)&&this.filterCollection.set(e.newSheetIndex,this.filterCollection.get(e.sheetIndex).slice()),this.filterRange.has(e.sheetIndex)&&(t=this.filterRange.get(e.sheetIndex),this.filterRange.set(e.newSheetIndex,{useFilterRange:t.useFilterRange,range:t.range.slice(),allowHeaderFilter:t.allowHeaderFilter}))},p.prototype.updateSortCollectionHandler=function(e){var t=this.parent.getActiveSheet(),r=this.parent.activeSheetIndex,n=this.filterRange.get(r);if(n){var i=n.range.slice(),o=(n.allowHeaderFilter||(i[0]=i[0]+1),n.useFilterRange||(i[2]=t.usedRange.rowIndex),e.sortOptions.sortDescriptors);if(this.parent.sortCollection=this.parent.sortCollection||[],Array.isArray(o))for(var a=0;a<o.length;a++)this.parent.sortCollection.push({sortRange:re(i),columnIndex:R(o[a].field),order:o[a].order,sheetIndex:r});else this.parent.sortCollection.push({sortRange:re(i),columnIndex:P(t.activeCell)[1],order:o.order,sheetIndex:r})}},p.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))},p.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,n=this.parent.getActiveSheet(),i=t[1];i<=t[3];i++)se(e.rowIndex,i,n,!1,!0).notes&&(r=this.parent.getCell(e.rowIndex,i))&&this.parent.serviceLocator.getService("cell").refresh(e.rowIndex,i,!1,r,!1,!1,!0)};var Uc=p;function p(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()}Vc.prototype.addEventListener=function(){this.parent.on(ds,this.insertImage,this),this.parent.on(cs,this.refreshImgCellObj,this),this.parent.on(gs,this.createImageElement,this),this.parent.on(ms,this.deleteImage,this),this.parent.on(bs,this.refreshInsDelImagePosition,this)},Vc.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)},Vc.prototype.imageSelect=function(e){var t=e.target.files[0];t&&(t.type.includes("image")?this.insertImage({file:t}):this.parent.serviceLocator.getService(O).show({content:this.parent.serviceLocator.getService("spreadsheetLocale").getConstant("UnsupportedFile"),width:"300"}),e.target.value="")},Vc.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(ds,this.insertImage),this.parent.off(cs,this.refreshImgCellObj),this.parent.off(gs,this.createImageElement),this.parent.off(ms,this.deleteImage),this.parent.off(bs,this.refreshInsDelImagePosition))},Vc.prototype.insertImage=function(e,t){var r=this;this.binaryStringVal(e).then(function(e){return r.createImageElement({options:{src:e},range:t,isPublic:!0})})},Vc.prototype.binaryStringVal=function(n){return new Promise(function(e,t){var r=new FileReader;r.readAsDataURL(n.file),r.onload=function(){return e(r.result)},r.onerror=function(e){return t(e)}})},Vc.prototype.createImageElement=function(e){var t,r,n=e.range?e.range.lastIndexOf("!"):0,i=e.range?0<n?e.range.substring(n+1):e.range:this.parent.getActiveSheet().selectedRange,n=e.range&&0<n?B(this.parent,e.range.substring(0,n)):this.parent.activeSheetIndex,o=this.parent.serviceLocator.getService(_h),a=e.options.id||ee.getUniqueID(this.parent.element.id+"_overlay_picture_"),s=te(i),l=ee.isUndefined(n)?this.parent.getActiveSheet():this.parent.sheets[n];this.parent.element.querySelector("#"+a)||(t={requestType:"beforeInsertImage",range:l.name+"!"+i,imageData:e.options.src,sheetIndex:n},e.isPublic&&this.parent.notify("actionBegin",{eventArgs:t,action:"beforeInsertImage"}),t.cancel)||((r=o.insertOverlayElement(a,i,n)).element.style.backgroundImage="url('"+e.options.src+"')",(e.options.height||e.options.left)&&(r.element.style.height=e.options.height+"px",r.element.style.width=e.options.width+"px",ee.isNullOrUndefined(e.options.top)||(r.element.style.top=Number(Gd(e.options.top).toFixed(2))+"px"),ee.isNullOrUndefined(e.options.left)||(r.element.style.left=Number(Gd(e.options.left).toFixed(2))+"px")),(l.frozenRows||l.frozenColumns)&&o.adjustFreezePaneSize(e.options,r.element,i),o={src:e.options.src,id:a,height:parseFloat(r.element.style.height.replace("px","")),width:parseFloat(r.element.style.width.replace("px","")),top:l.frozenRows||l.frozenColumns?s[0]?Ah(l,0,s[0]-1):0:(ee.isNullOrUndefined(e.options.top)?r:e.options).top,left:l.frozenRows||l.frozenColumns?s[1]?Uh(l,0,s[1]-1):0:(ee.isNullOrUndefined(e.options.left)?r:e.options).left},this.parent.setUsedRange(s[0],s[1]),(e.isPublic||e.isUndoRedo)&&this.parent.notify(jr,{options:[o],range:l.name+"!"+i}),(r=se(s[0],s[1],l)).image[r.image.length-1].id||(r.image[r.image.length-1].id=o.id),!e.isUndoRedo&&e.isPublic&&(t={requestType:"insertImage",range:l.name+"!"+i,imageHeight:e.options.height||300,imageWidth:e.options.width||400,imageData:e.options.src,id:a,sheetIndex:n},this.parent.notify("actionComplete",{eventArgs:t,action:"insertImage"})))},Vc.prototype.refreshInsDelImagePosition=function(e){for(var t,r,n,i=e.count,o=e.sheetIdx,o=this.parent.sheets[o],a=se(e.rowIdx,e.colIdx,o),s=a.image.length,l=0;l<s;l++)t=document.getElementById(a.image[l].id),r="Row"===e.type?"insert"===e.status?a.image[l].top+20*i:a.image[l].top-20*i:a.image[l].top,n="Column"===e.type?"insert"===e.status?a.image[l].left+64*i:a.image[l].left-64*i:a.image[l].left,a.image[l].top=r,a.image[l].left=n,t&&(t.style.top=r+"px",t.style.left=n+"px")},Vc.prototype.refreshImgCellObj=function(e){var t,r,n=ee.isUndefined(e.sheetIdx)?this.parent.activeSheetIndex:e.sheetIdx,n=ae(this.parent,n),i=se(e.prevRowIdx,e.prevColIdx,n),o=se(e.currentRowIdx,e.currentColIdx,n),a=i?i.image:[],s=a&&a.length?a.length:0;if(i&&i.image&&0<a.length){for(var l=0;l<s;l++)a[l]&&a[l].id===e.id&&((t=a[l]).height=e.currentHeight,t.width=e.currentWidth,t.top=e.currentTop,t.left=e.currentLeft,a.splice(l,1));o&&o.image&&(r=o.image,t)&&r.push(t),Vi(e.currentRowIdx,e.currentColIdx,n,r?{image:r}:{image:[t]},!0),"imageRefresh"!==e.requestType||e.isUndoRedo||(i={requestType:"imageRefresh",currentRowIdx:e.currentRowIdx,currentColIdx:e.currentColIdx,prevRowIdx:e.prevRowIdx,prevColIdx:e.prevColIdx,prevTop:e.prevTop,prevLeft:e.prevLeft,currentTop:e.currentTop,currentLeft:e.currentLeft,currentHeight:e.currentHeight,currentWidth:e.currentWidth,prevHeight:e.prevHeight,prevWidth:e.prevWidth,id:e.id,sheetIdx:this.parent.activeSheetIndex},this.parent.notify("actionComplete",{eventArgs:i,action:"imageRefresh"}))}},Vc.prototype.deleteImage=function(e){var t,r,n=e.sheet||this.parent.getActiveSheet(),i=document.getElementById(e.id),o=e.rowIdx,a=e.colIdx;if(i){if(void 0===e.rowIdx&&void 0===e.colIdx&&(r=s=void 0,n.frozenRows||n.frozenColumns?(s={clientY:(t=i.getBoundingClientRect()).top},r={clientX:t.left},t.top<this.parent.getColumnHeaderContent().getBoundingClientRect().bottom&&(s.target=this.parent.getColumnHeaderContent()),t.left<this.parent.getRowHeaderContent().getBoundingClientRect().right&&(r.target=this.parent.getRowHeaderTable())):(s={clientY:parseFloat(i.style.top),isImage:!0},r={clientX:parseFloat(i.style.left),isImage:!0}),this.parent.notify(us,s),this.parent.notify(fs,r),o=s.clientY,a=r.clientX),t=n.name+"!"+G(o,a),!e.preventEventTrigger){var i={address:t,cancel:!1};if(this.parent.notify(gt,{action:"deleteImage",eventArgs:i}),i.cancel)return}document.getElementById(e.id).remove()}else e.sheet||(s=e.range?0<e.range.lastIndexOf("!")?e.range.substring(e.range.lastIndexOf("!")+1):e.range:this.parent.getActiveSheet().selectedRange,r=e.range&&0<e.range.lastIndexOf("!")?B(this.parent,e.range.substring(0,e.range.lastIndexOf("!"))):this.parent.activeSheetIndex,o=(i=te(s))[0],a=i[1],n=this.parent.sheets[r]);for(var s=se(o,a,n),l=s&&s.image?s.image:[],h={},d=l.length-1;0<=d;d--)l[d].id===e.id&&(h=l.splice(d,1)[0]);Vi(o,a,n,{image:l},!0),e.preventEventTrigger||this.parent.notify(le,{action:"deleteImage",eventArgs:{address:t,id:h.id,imageData:h.src,imageWidth:h.width,imageHeight:h.height,cancel:!1},preventAction:e.isUndoRedo})},Vc.prototype.destroy=function(){this.removeEventListener(),this.parent=null},Vc.prototype.getModuleName=function(){return"spreadsheetImage"};var Hc=Vc;function Vc(e){this.parent=e,this.addEventListener(),this.renderImageUpload()}v.Chart.Inject(v.ColumnSeries,v.LineSeries,v.BarSeries,v.AreaSeries,v.StackingColumnSeries,v.StackingLineSeries,v.StackingBarSeries,v.ScatterSeries),v.Chart.Inject(v.StackingAreaSeries,v.Category,v.Legend,v.Tooltip,v.DataLabel),v.AccumulationChart.Inject(v.PieSeries,v.AccumulationTooltip,v.AccumulationDataLabel,v.AccumulationLegend);zc.prototype.addEventListener=function(){this.parent.on(_r,this.initiateChartHandler,this),this.parent.on(ys,this.refreshChartCellObj,this),this.parent.on(Cs,this.refreshChartCellModel,this),this.parent.on(Sn,this.refreshChartCellObj,this),this.parent.on(vs,this.deleteChart,this),this.parent.on(ws,this.clearBorder,this),this.parent.on(Is,this.insertChartHandler,this),this.parent.on(Es,this.chartRangeHandler,this),this.parent.on(Fs,this.chartDesignTabHandler,this),this.parent.on(ks,this.updateChartElement,this),this.parent.on(Os,this.undoRedoForChartDesign,this),this.parent.on(Wr,this.refreshChartData,this)},zc.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"}e.isChart?(this.parent.notify(zr,{chart:[{type:r,markerSettings:{visible:n,isFilled:!0}}]}),Xh(function(){ce(t.parent.element)})):this.parent.notify(Fs,{chartType:r,triggerEvent:!0,markerVisible:n})},zc.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 o=document.getElementById(r[i].id);e&&o&&r[i].id===t&&this.initiateChartHandler({option:r[i],isRefresh:!0})}},zc.prototype.refreshChartData=function(e){if(this.parent.chartColl&&this.parent.chartColl.length)for(var t,r,n,i,o,a=0,s=this.parent.chartColl.length;a<s;a++){if((t=this.parent.chartColl[a]).range.includes("!")){if(i=t.range.substring(0,t.range.lastIndexOf("!")),this.parent.activeSheetIndex!==B(this.parent,i))continue;r=t.range.substring(t.range.lastIndexOf("!")+1)}else r=t.range;if(e.viewportIndexes){for(var l=0;l<e.viewportIndexes.length;l++)if(Xn([e.viewportIndexes[l]],r)){n=!0;break}}else n=e.range?Xn([e.range],r):e.showHide?this.inRowColumnRange(te(r),e.rIdx,e.showHide):Tn(te(r),e.rIdx,e.cIdx);n&&(i=this.parent.element.querySelector("."+t.id))&&(o=ee.getComponent(i,"chart")||ee.getComponent(i,"accumulationchart"))&&(o.series=this.initiateChartHandler({option:t,isRefresh:!0}),o.refresh())}},zc.prototype.inRowColumnRange=function(e,t,r){return"rows"===r?t>=e[0]&&t<=e[2]:t>=e[1]&&t<=e[3]},zc.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,o=e.prevChartIndexes[t].chartColIdx,a=e.currentChartIndexes[t].chartRowIdx,s=e.currentChartIndexes[t].chartColIdx,i={prevTop:n.top,prevLeft:n.left,prevRowIdx:i,prevColIdx:o,prevHeight:n.height,prevWidth:n.width,currentTop:n.top,currentLeft:n.left,currentRowIdx:a,currentColIdx:s,currentHeight:n.height,currentWidth:n.width,id:n.id,requestType:"chartRefreshOnFilter"};this.parent.notify(ys,i)}},zc.prototype.refreshChartCellObj=function(e){var t,r,n=ee.isUndefined(e.sheetIdx)?this.parent.activeSheetIndex:e.sheetIdx,i=ae(this.parent,n),o=se(e.prevRowIdx,e.prevColIdx,i),a=se(e.currentRowIdx,e.currentColIdx,i),s=o?o.chart:[],l=s&&s.length?s.length:0;if(l){for(var h=0;h<l;h++)if(s[h].id===e.id.split("_overlay")[0]){(t=s[h]).height=e.currentHeight,t.width=e.currentWidth,t.top=e.currentTop,t.left=e.currentLeft,s.splice(h,1),h--,l--;for(var d=0,p=this.parent.chartColl.length;d<p;d++)t.id===this.parent.chartColl[d].id&&(t.height=e.currentHeight,this.parent.chartColl[d].width=e.currentWidth,this.parent.chartColl[d].top=e.currentTop,this.parent.chartColl[d].left=e.currentLeft)}a&&a.chart&&(r=a.chart,t)&&r.push(t),Vi(e.currentRowIdx,e.currentColIdx,i,r?{chart:r}:{chart:[t]},!0),"chartRefresh"!==e.requestType||e.isUndoRedo||(o={requestType:"chartRefresh",currentRowIdx:e.currentRowIdx,currentColIdx:e.currentColIdx,currentWidth:e.currentWidth,prevHeight:e.prevHeight,prevWidth:e.prevWidth,prevRowIdx:e.prevRowIdx,prevColIdx:e.prevColIdx,prevTop:e.prevTop,prevLeft:e.prevLeft,currentTop:e.currentTop,currentLeft:e.currentLeft,currentHeight:e.currentHeight,id:e.id,sheetIdx:n},this.parent.notify("actionComplete",{eventArgs:o,action:"chartRefresh"}))}},zc.prototype.processChartRange=function(e,a,t){function r(e,t,r,n){var i,o=se(e,t,m);return!o||(o.formula&&ee.isNullOrUndefined(o.value)&&h.parent.notify(wt,{cell:o,rowIdx:e,colIdx:t,sheetIndex:a}),i=void 0,i=o.format?(e={value:o.value,format:o.format,formattedText:o.value,cell:o,rowIndex:e,colIndex:t},h.parent.notify(St,e),(t=oe(o.value))&&!Wi(o.format,!0,null,!0)?Number(o.value):(n&&t?s=!0:r&&t&&(l=!0),e.formattedText&&e.formattedText.toString())):(v(o),o.value),ee.isNullOrUndefined(i))?"":i}var n,i,o,s,l,h=this,d=e[0],p=e[1],c=!1,u=e[2],e=e[3],f=d===u,g=p===e,m=ae(this.parent,a),v=Qn(this.parent),y=r(d,e,!1,!0),C=r(u,p,!0),b=r(d,p,!0);return oe(C)&&b||(c=!0),!ee.isNullOrUndefined(b)&&("Scatter"!==t.type||t.isSeriesInRows)||f||g?ee.isNullOrUndefined(C)||!c||f||g||s?(i=[d,p,u,e],ee.isNullOrUndefined(y)||oe(y)||s?(f||g)&&ee.isNullOrUndefined(b)&&(o=[d,p,d,e],f?(i[1]=i[1]+1,o[3]=o[1]):i[0]=i[0]+1):(o=[d,p,d,e],i[0]=i[0]+1)):ee.isNullOrUndefined(y)||oe(y)&&b?(n=[d,p,u,p],i=[d,p+1,u,e]):(n=[d+1,p,u,p],i=[d+1,p+1,u,e],o=[d,p+1,d,e]):(n=[d+1,p,u,p],i=[d+1,p+1,u,e],o=[d,p+1,d,e]),{xRange:n,yRange:i,lRange:o,isStringSeries:c,isDateTime:l}},zc.prototype.getRangeData=function(e){for(var t,r,n,i,o=e.sheet,a=(e.range?"string"==typeof e.range&&(e.range=te(e.range)):e.range=te(o.selectedRange),[]),s=e.range[0],l=e.isYvalue&&Qn(this.parent);s<=e.range[2];){if(he(o,s));else for(r=e.range[1];r<=e.range[3];)pe(o,r)?r++:((i=se(s,r,o,!1,!0)).formula&&ee.isNullOrUndefined(i.value)&&this.parent.notify(wt,{cell:i,rowIdx:s,colIdx:r,sheetIndex:e.sheetIdx}),e.isYvalue&&l(i),t={value:i.value||(0===i.value?0:null)},i.format?(n={formattedText:i.value,value:i.value,format:i.format,cell:i,skipFormatCheck:!0},this.parent.notify(St,n),e.isYvalue?oe(i.value)?(t.value=Number(i.value),t.displayText=n.formattedText?n.formattedText.toString():""):(t.displayText=null===t.value?"":this.parent.getDisplayText({format:i.format,value:"0"}),t.value=0):t.value=n.formattedText?n.formattedText.toString():null):e.isYvalue&&(oe(t.value)?(t.displayText=t.value.toString(),t.value=Number(t.value)):(t.displayText=null===t.value?"":"0",t.value=0)),a.push(t),r++);s++}return a},zc.prototype.toArrayData=function(e){for(var t,r=0,n=[],i=e.length;r<i;)t=e[r],Object.keys(t).length?"value"in t&&n.push(t.value):n.push(""),r++;return n},zc.prototype.getVirtualXValues=function(e){for(var t=1,r=[];t<e;)r.push(t.toString()),t++;return r},zc.prototype.processChartSeries=function(e,t,r,n,i){e=e||{};var o,a,s,l,h,d={name:"displayText"},p={},c=0,u=0,f=this.parent.isPrintingProcessing,g=[],m=(t=ee.isNullOrUndefined(t)?this.parent.activeSheetIndex:t,ae(this.parent,t)),v=this.getRangeData({range:n,sheet:m,isYvalue:!0,sheetIdx:t}),t=n[2]-n[0]+1-this.parent.hiddenCount(n[0],n[2],"rows",m),y=n[3]-n[1]+1-this.parent.hiddenCount(n[1],n[3],"columns",m),C=e.isSeriesInRows?(o=i?this.toArrayData(this.getRangeData({range:i,sheet:m})):this.getVirtualXValues(1+y),r&&(a=this.toArrayData(this.getRangeData({range:r,sheet:m}))),t):(o=r?this.toArrayData(this.getRangeData({range:r,sheet:m})):this.getVirtualXValues(1+t),i&&(a=this.toArrayData(this.getRangeData({range:i,sheet:m}))),y),b=o.length,x=e.isSeriesInRows?1:C;for(ee.isNullOrUndefined(e.dataLabelSettings)||(d.visible=e.dataLabelSettings.visible,d.position=e.dataLabelSettings.position);c<C;){for(l=0,s=[],u=e.isSeriesInRows?u:c;l<b;)ee.isNullOrUndefined(o[l])&&(o[l]=ee.getUniqueID("spread-chart-empty-label-")),s.push({x:o[l],y:v[u].value,displayText:v[u].displayText}),u+=x,l++;var S,w=a&&0<a.length?a[c]:"Scatter"===e.type?"series"+(c+1):"series"+c;w=ee.isNullOrUndefined(w)?"":w.toString(),e.type&&(p="Line"===(S=e.type)||"StackingLine"===S||"StackingLine100"===S?{dataSource:s,type:e.type,xName:"x",yName:"y",name:w,animation:{enable:!f},tooltipMappingName:"displayText",marker:e.markerSettings?{visible:e.markerSettings.visible,width:e.markerSettings.size,height:e.markerSettings.size,shape:e.markerSettings.shape,dataLabel:d,isFilled:e.markerSettings.isFilled,border:e.markerSettings.border,fill:e.markerSettings.isFilled?e.markerSettings.fill:null}:{dataLabel:d}}:"Scatter"===S?{dataSource:s,type:e.type,xName:"x",yName:"y",name:w,tooltipMappingName:"displayText",animation:{enable:!f},marker:{visible:!1,width:12,height:12,shape:"Circle",dataLabel:d}}:"Pie"===S||"Doughnut"===S?{dataSource:s,radius:"100%",xName:"x",yName:"y",innerRadius:"Pie"===e.type?"0%":"40%",dataLabel:{visible:!!d.visible,position:"Outer"===d.position?"Outside":"Inside",name:"displayText",font:{fontWeight:"600"}},animation:{enable:!f},tooltipMappingName:"displayText"}:{dataSource:s,type:e.type,xName:"x",yName:"y",animation:{enable:!f},name:w,marker:{dataLabel:d},tooltipMappingName:"displayText"}),g.push(p),c++}return h=e.type?{series:g,xRange:e.isSeriesInRows?i:r,yRange:n,lRange:e.isSeriesInRows?r:i}:h},zc.prototype.primaryYAxisFormat=function(e){var t="";return ee.isNullOrUndefined(e)||(e=se(e[0],e[1],this.parent.getActiveSheet()))&&e.format&&(t=e.format),t},zc.prototype.focusChartRange=function(e,t,r){var n,i=["e-rcborderright","e-rcborderbottom","e-vcborderright","e-vcborderbottom","e-bcborderright","e-bcborderbottom"],o=(this.clearBorder(),this.parent.getActiveSheet()),o=!(!o.frozenRows&&!o.frozenColumns);r&&(o?n=r:this.parent.notify(Ss,{startcell:{rowIndex:r[0],colIndex:r[1]},endcell:{rowIndex:r[2],colIndex:r[3]},classes:[i[0],i[1]]})),e&&(o?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(Ss,{startcell:{rowIndex:e[0],colIndex:e[1]},endcell:{rowIndex:e[2],colIndex:e[3]},classes:[i[2],i[3]]})),o&&n?this.parent.notify(Ss,{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(Ss,{startcell:{rowIndex:t[0],colIndex:t[1]},endcell:{rowIndex:t[2],colIndex:t[3]},classes:[i[4],i[5]]})},zc.prototype.clearBorder=function(){var e=this.parent.getActiveSheet();if(e.frozenColumns||e.frozenRows)[].slice.call(this.parent.element.getElementsByClassName("e-chart-range")).forEach(function(e){ee.detach(e)});else for(var t=this.parent.getMainContent(),r=["e-rcborderright","e-rcborderbottom","e-vcborderright","e-vcborderbottom","e-bcborderright","e-bcborderbottom"],n=0,i=r.length;n<i;n++)for(var o=t.querySelectorAll("."+r[n]),a=0,s=o.length;a<s;a++)o[a].classList.remove(r[n])},zc.prototype.initiateChartHandler=function(e){var t,r=this,n=e.option,i=!!ee.isNullOrUndefined(e.isInitCell)||!e.isInitCell,o=(e.triggerEvent=!!ee.isNullOrUndefined(e.triggerEvent)||e.triggerEvent,e.isRefresh=!ee.isNullOrUndefined(e.isRefresh)&&e.isRefresh,n.range&&0<n.range.lastIndexOf("!")?B(this.parent,n.range.substring(0,n.range.lastIndexOf("!"))):this.parent.activeSheetIndex),a=ae(this.parent,o),s=te(d=n.range||this.parent.getActiveSheet().selectedRange),l={};if(this.parent.allowChart||!a.isProtected){var h={sheetIndex:o,reqType:"shape",type:"actionBegin",shapeType:"chart",action:"create",options:n,range:d,operation:"create"},l=h.options,d=h.range,p=(0<s.length&&!e.isRefresh&&i&&s[2]-s[0]<s[3]-s[1]&&(c=!0),(l=l||{}).isSeriesInRows=!!c||l.isSeriesInRows||!1,e.dataSheetIdx=ee.isNullOrUndefined(e.dataSheetIdx)?o:e.dataSheetIdx,this.processChartRange(s,e.dataSheetIdx,l)),h=p.xRange,c=p.yRange,s=p.lRange;if(o===this.parent.activeSheetIndex&&i&&this.focusChartRange(h,c,s),e.triggerEvent&&!e.isRefresh){if(t={type:n.type,theme:n.theme,isSeriesInRows:n.isSeriesInRows,range:n.range,markerSettings:l.markerSettings,id:n.id,height:n.height,width:n.width,posRange:e.range,isInitCell:e.isInitCell,cancel:!1,top:n.top,left:n.left},this.parent.notify(gt,{eventArgs:t,action:"beforeInsertChart"}),t.cancel)return[];n.type=t.type,n.theme=t.theme,n.isSeriesInRows=t.isSeriesInRows,n.markerSettings=t.markerSettings,n.range=t.range,n.id=t.id,n.height=t.height,n.width=t.width}o=this.processChartSeries(l,e.dataSheetIdx,h,c,s),i={majorGridLines:n.primaryXAxis&&n.primaryXAxis.majorGridLines&&!ee.isNullOrUndefined(n.primaryXAxis.majorGridLines.width)?{width:n.primaryXAxis.majorGridLines.width}:{width:0},minorGridLines:n.primaryXAxis&&n.primaryXAxis.minorGridLines&&!ee.isNullOrUndefined(n.primaryXAxis.minorGridLines.width)?{width:n.primaryXAxis.minorGridLines.width}:{width:0},minorTicksPerInterval:n.primaryXAxis&&n.primaryXAxis.minorGridLines&&0<n.primaryXAxis.minorGridLines.width?5:0,lineStyle:{width:0},valueType:"Scatter"!==n.type||p.isStringSeries||n.isSeriesInRows?"Category":"Double",rangePadding:"Scatter"!==n.type||p.isStringSeries||n.isSeriesInRows?"Auto":"Round",visible:!n.primaryXAxis||n.primaryXAxis.visible,title:n.primaryXAxis?n.primaryXAxis.title:"",edgeLabelPlacement:"Shift"},l={lineStyle:{width:0},majorGridLines:n.primaryYAxis&&n.primaryYAxis.majorGridLines&&!ee.isNullOrUndefined(n.primaryYAxis.majorGridLines.width)?{width:n.primaryYAxis.majorGridLines.width}:{width:1},minorGridLines:n.primaryYAxis&&n.primaryYAxis.minorGridLines&&!ee.isNullOrUndefined(n.primaryYAxis.minorGridLines.width)?{width:n.primaryYAxis.minorGridLines.width}:{width:0},minorTicksPerInterval:n.primaryYAxis&&n.primaryYAxis.minorGridLines&&0<n.primaryYAxis.minorGridLines.width?5:0,visible:!n.primaryYAxis||n.primaryYAxis.visible,title:n.primaryYAxis?n.primaryYAxis.title:"",edgeLabelPlacement:"Shift"};if(e.isRefresh)return e.isSwitchRowColumn&&"Scatter"===n.type&&(h=this.parent.element.querySelector("."+n.id))&&(ee.getComponent(h,"chart").primaryXAxis.valueType=p.isStringSeries||n.isSeriesInRows?"Category":"Double"),o.series;var s=n.id+"_overlay",h=this.parent.serviceLocator.getService(_h),d=!ee.isNullOrUndefined(e.isInitCell)&&e.isInitCell?e.range:d,s=h.insertOverlayElement(s,d,N(this.parent,d)),a=(s.element.classList.add("e-datavisualization-chart"),s.element.style.width=n.width+"px",s.element.style.height=n.height+"px",a.frozenRows||a.frozenColumns?h.adjustFreezePaneSize(n,s.element,d):(ee.isNullOrUndefined(n.top)?n.top=s.top:s.element.style.top=Number(Gd(n.top).toFixed(2))+"px",ee.isNullOrUndefined(n.left)?n.left=s.left:s.element.style.left=Number(Gd(n.left).toFixed(2))+"px"),this.parent.notify(Hs,{height:n.height,width:n.width}),"Pie"===n.type||"Doughnut"===n.type?{position:"Bottom",visible:!0}:{}),h=(ee.isNullOrUndefined(n.legendSettings)||(a.visible=n.legendSettings.visible,a.position=n.legendSettings.position),this.parent.createElement("div",{id:n.id,className:n.id})),d=n.theme||"Material",u=this.primaryYAxisFormat(c),c=2*Math.round(parseFloat(getComputedStyle(s.element).borderWidth)),c=parseFloat(s.element.style.height)-(isNaN(c)?0:c)+"px";"Pie"!==n.type&&"Doughnut"!==n.type?this.chart=new v.Chart({primaryXAxis:i,primaryYAxis:l,background:this.getThemeBgColor(d),chartArea:{border:{width:0}},title:n.title,legendSettings:a,theme:d,series:o.series,tooltip:{enable:!0,format:"${point.x} : <b>${point.tooltip}</b>"},width:s.element.style.width,height:c,enableRtl:this.parent.enableRtl,load:function(e){e.chart.theme=n.theme||"Material"},beforeResize:function(e){e.cancelResizedEvent=!0},axisLabelRender:function(e){"primaryYAxis"===e.axis.name&&u&&!n.type.includes("100")&&!ee.isNullOrUndefined(e.value)&&r.parent?e.text=r.parent.getDisplayText({format:u,value:e.value.toString()}):"primaryXAxis"===e.axis.name&&e.text.startsWith("spread-chart-empty-label-")&&(e.text=""),"primaryXAxis"===e.axis.name&&"Scatter"===n.type&&0<e.axis.labels.length&&!oe(e.text)&&!p.isDateTime&&(e.text=(e.axis.labels.indexOf(e.text)+1).toString())}}):this.chart=new v.AccumulationChart({title:n.title,legendSettings:a,theme:d,background:this.getThemeBgColor(d),series:o.series,width:s.element.style.width,height:c,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=n.theme||"Material"},beforeResize:function(e){e.cancelResizedEvent=!0}}),this.chart.appendTo(h),s.element.appendChild(h),s.element.classList.contains("e-ss-overlay-active")&&!this.parent.isPrintingProcessing&&this.parent.notify(Ns,{id:s.element.id}),e.triggerEvent&&this.parent.notify(le,{eventArgs:t,action:"insertChart"})}},zc.prototype.deleteChart=function(e){this.clearBorder();var t=null,r=this.parent.getActiveSheet();if(ee.isNullOrUndefined(e.id)?(t=document.querySelector(".e-datavisualization-chart.e-ss-overlay-active"),e.id=t?t.getElementsByClassName("e-control")[0].id:null):(e.id=e.id.includes("overlay")?e.id:e.id+"_overlay",t=document.getElementById(e.id)),!ee.isNullOrUndefined(e.id)){e.id=e.id.includes("overlay")?e.id:e.id+"_overlay";for(var n,i,o=!1,a=0,s=this.parent.chartColl.length;a<s;a++)if(this.parent.chartColl[a].id===e.id.split("_overlay")[0]){i=this.parent.chartColl[a];break}for(var l,h,d,p={id:i.id,range:i.range,type:i.type,markerSettings:i.markerSettings,theme:i.theme,height:i.height,width:i.width,isSeriesInRows:i.isSeriesInRows,isInitCell:!0,posRange:null,top:i.top,left:i.left,cancel:!1},t=(r=t?(l=d=void 0,r.frozenRows||r.frozenColumns?(d={clientY:(h=t.getBoundingClientRect()).top},l={clientX:h.left},h.top<this.parent.getColumnHeaderContent().getBoundingClientRect().bottom&&(d.target=this.parent.getColumnHeaderContent()),h.left<this.parent.getRowHeaderContent().getBoundingClientRect().right&&(l.target=this.parent.getRowHeaderTable())):(d={clientY:parseFloat(t.style.top),isImage:!0},l={clientX:parseFloat(t.style.left),isImage:!0}),this.parent.notify(Yr,{id:e.id}),this.parent.notify(us,d),this.parent.notify(fs,l),o=!0,h=d.clientY,d=l.clientX,this.parent.sheets[this.parent.activeSheetIndex]):(this.parent.notify(Yr,{id:e.id}),t=e.range?e.range.lastIndexOf("!"):0,l=e.range&&0<t?B(this.parent,e.range.substring(0,t)):this.parent.activeSheetIndex,h=(t=te(e.range?0<t?e.range.substring(t+1):e.range:this.parent.getActiveSheet().selectedRange))[0],d=t[1],this.parent.sheets[l]),se(h,d,r)),c=(n=t?t.chart:n)?n.length:null,a=0;a<c;a++)e.id===n[a].id+"_overlay"&&(n.splice(a,1),c=n.length);o&&(document.getElementById(e.id).remove(),this.parent.notify(Rs,{})),Vi(h,d,r,{chart:n},!0),p.posRange=G(h,d),e.isUndoRedo||this.parent.notify(le,{eventArgs:p,action:"deleteChart"})}},zc.prototype.updateChartModel=function(e,t,r,n,i){var o=t,a=this.parent.chartColl[n].id;if(!(i&&-1<["PHAxes","PVAxes","PHAxisTitle","PVAxisTitle","GLMajorHorizontal","GLMajorVertical","GLMinorHorizontal","GLMinorVertical"].indexOf(e)))for(var s,l=0,h=r.chart.length;l<h;l++)if(r.chart[l].id===a)switch(e){case"PHAxes":case"PHAxisTitle":ee.isNullOrUndefined(r.chart[l].primaryXAxis)&&(r.chart[l].primaryXAxis={},this.parent.chartColl[n].primaryXAxis={}),"PHAxes"===e?(r.chart[l].primaryXAxis.visible=t.primaryXAxis.visible,this.parent.chartColl[n].primaryXAxis.visible=t.primaryXAxis.visible):"PHAxisTitle"===e&&(r.chart[l].primaryXAxis.title=t.primaryXAxis.title,this.parent.chartColl[n].primaryXAxis.title=t.primaryXAxis.title);break;case"PVAxes":case"PVAxisTitle":ee.isNullOrUndefined(r.chart[l].primaryYAxis)&&(r.chart[l].primaryYAxis={},this.parent.chartColl[n].primaryYAxis={}),"PVAxes"===e?(r.chart[l].primaryYAxis.visible=t.primaryYAxis.visible,this.parent.chartColl[n].primaryYAxis.visible=t.primaryYAxis.visible):"PVAxisTitle"===e&&(r.chart[l].primaryYAxis.title=t.primaryYAxis.title,this.parent.chartColl[n].primaryYAxis.title=t.primaryYAxis.title);break;case"ChartTitleNone":case"ChartTitleAbove":r.chart[l].title=t.title,this.parent.chartColl[n].title=t.title;break;case"DLNone":case"DLCenter":case"DLInsideend":case"DLInsidebase":case"DLOutsideend":ee.isNullOrUndefined(r.chart[l].dataLabelSettings)&&(r.chart[l].dataLabelSettings={},this.parent.chartColl[n].dataLabelSettings={}),"DLNone"===e?(r.chart[l].dataLabelSettings.visible=!1,this.parent.chartColl[n].dataLabelSettings.visible=!1):(r.chart[l].dataLabelSettings.visible=!0,this.parent.chartColl[n].dataLabelSettings.visible=!0,s=void 0,s=i?"Outside"===o.series[0].dataLabel.position?"Outer":"Middle":t.series[0].marker.dataLabel.position,r.chart[l].dataLabelSettings.position=s,this.parent.chartColl[n].dataLabelSettings.position=s);break;case"GLMajorHorizontal":ee.isNullOrUndefined(r.chart[l].primaryYAxis)&&(r.chart[l].primaryYAxis={},this.parent.chartColl[n].primaryYAxis={}),ee.isNullOrUndefined(r.chart[l].primaryYAxis.majorGridLines)&&(r.chart[l].primaryYAxis.majorGridLines={},this.parent.chartColl[n].primaryYAxis.majorGridLines={}),r.chart[l].primaryYAxis.majorGridLines.width=t.primaryYAxis.majorGridLines.width,this.parent.chartColl[n].primaryYAxis.majorGridLines.width=t.primaryYAxis.majorGridLines.width;break;case"GLMajorVertical":ee.isNullOrUndefined(r.chart[l].primaryXAxis)&&(r.chart[l].primaryXAxis={},this.parent.chartColl[n].primaryXAxis={}),ee.isNullOrUndefined(r.chart[l].primaryXAxis.majorGridLines)&&(r.chart[l].primaryXAxis.majorGridLines={},this.parent.chartColl[n].primaryXAxis.majorGridLines={}),r.chart[l].primaryXAxis.majorGridLines.width=t.primaryXAxis.majorGridLines.width,this.parent.chartColl[n].primaryXAxis.majorGridLines.width=t.primaryXAxis.majorGridLines.width;break;case"GLMinorHorizontal":ee.isNullOrUndefined(r.chart[l].primaryYAxis)&&(r.chart[l].primaryYAxis={},this.parent.chartColl[n].primaryYAxis={}),ee.isNullOrUndefined(r.chart[l].primaryYAxis.minorGridLines)&&(r.chart[l].primaryYAxis.minorGridLines={},this.parent.chartColl[n].primaryYAxis.minorGridLines={}),r.chart[l].primaryYAxis.minorGridLines.width=t.primaryYAxis.minorGridLines.width,this.parent.chartColl[n].primaryYAxis.minorGridLines.width=t.primaryYAxis.minorGridLines.width;break;case"GLMinorVertical":ee.isNullOrUndefined(r.chart[l].primaryXAxis)&&(r.chart[l].primaryXAxis={},this.parent.chartColl[n].primaryXAxis={}),ee.isNullOrUndefined(r.chart[l].primaryXAxis.minorGridLines)&&(r.chart[l].primaryXAxis.minorGridLines={},this.parent.chartColl[n].primaryXAxis.minorGridLines={}),r.chart[l].primaryXAxis.minorGridLines.width=t.primaryXAxis.minorGridLines.width,this.parent.chartColl[n].primaryXAxis.minorGridLines.width=t.primaryXAxis.minorGridLines.width;break;case"LegendNone":case"LegendsRight":case"LegendsLeft":case"LegendsBottom":case"LegendsTop":ee.isNullOrUndefined(r.chart[l].legendSettings)&&(r.chart[l].legendSettings={},this.parent.chartColl[n].legendSettings={}),r.chart[l].legendSettings.visible=t.legendSettings.visible,this.parent.chartColl[n].legendSettings.visible=t.legendSettings.visible,"LegendNone"!==e&&(r.chart[l].legendSettings.position=t.legendSettings.position,this.parent.chartColl[n].legendSettings.position=t.legendSettings.position)}},zc.prototype.updateChartElement=function(e,t,r,n,i,o,a,s){if(!(o&&-1<["PHAxes","PVAxes","PHAxisTitle","PVAxisTitle","GLMajorHorizontal","GLMajorVertical","GLMinorHorizontal","GLMinorVertical"].indexOf(e))){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 h=0,d=l.length;h<d;h++)o?l[h].dataLabel.visible=!1:l[h].marker.dataLabel.visible=!1;else for(var p,h=0,d=l.length;h<d;h++)o?(p="DLOutsideend"===e?"Outside":"Inside",l[h].dataLabel.visible=!0,l[h].dataLabel.position=p):(p="DLCenter"===e?"Middle":"DLInsideend"===e?"Top":"DLInsidebase"===e?"Bottom":"DLOutsideend"===e?"Outer":l[0].marker.dataLabel.position,l[h].marker.dataLabel.visible=!0,l[h].marker.dataLabel.position=p);t.series=l,o&&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}this.updateChartModel(e,t,r,n,o),s&&(r={addChartEle:e,id:t.element.id+"_overlay",title:i,address:a},this.parent.notify(le,{action:"chartDesign",eventArgs:r}))}},zc.prototype.undoRedoForChartDesign=function(e){var t=document.getElementById(e.id);if(t){for(var r,n=this.getChartElement(t),t=ee.getComponent(n,"chart"),i=(ee.isNullOrUndefined(t)&&(t=ee.getComponent(n,"accumulationchart")),this.parent.getAddressInfo(e.address)),i=se(i.indices[0],i.indices[1],ae(this.parent,i.sheetIndex)),o=this.getChartCollectionId(n.id),a=e.addChartEle,s=e.title,l=0;l<e.beforeActionData.cellDetails[0].chart.length;l++)if(n.id===e.beforeActionData.cellDetails[0].chart[l].id){r=e.beforeActionData.cellDetails[0].chart[l];break}var h=!ee.isNullOrUndefined(r.markerSettings)&&r.markerSettings.visible;if(e.switchRowColumn)this.switchRowColumn(o,n.id,t,i);else if(e.chartTheme)this.switchChartTheme(o,n.id,e.isUndo?r.theme:e.chartTheme,t,i);else if(e.chartType)this.switchChartType(o,n.id,e.isUndo?r.type:e.chartType,t,i,!1,e.isUndo?h:e.chartMarker,"undoRedo");else if(e.addChartEle){if(e.isUndo){var d=void 0;switch(a){case"DLNone":case"DLCenter":case"DLInsideend":case"DLInsidebase":case"DLOutsideend":a="Middle"===(d=r.dataLabelSettings&&r.dataLabelSettings.position)?"DLCenter":"Top"===d?"DLInsideend":"Bottom"===d?"DLInsidebase":"Outer"===d?"DLOutsideend":"DLNone";break;case"LegendNone":case"LegendsRight":case"LegendsLeft":case"LegendsBottom":case"LegendsTop":r.legendSettings&&!r.legendSettings.visible?d="LegendNone":a="Right"===(d=r.legendSettings&&r.legendSettings.position)?"LegendsRight":"Left"===d?"LegendsLeft":"Bottom"!==d&&"Top"===d?"LegendsTop":"LegendsBottom";break;case"PVAxisTitle":s=r.primaryYAxis&&r.primaryYAxis.title;break;case"PHAxisTitle":s=r.primaryXAxis&&r.primaryXAxis.title;break;case"ChartTitleNone":case"ChartTitleAbove":s=r.title}}this.updateChartElement(a,t,i,o,s,null,e.address)}}},zc.prototype.chartDesignTabHandler=function(e){var t=!1,r=this.parent.sheets[this.parent.activeSheetIndex],n=e.switchRowColumn,i=e.chartType,o=e.chartTheme,a=e.addChartEle,s=null,l=e.id?document.getElementById(e.id):document.querySelector(".e-datavisualization-chart.e-ss-overlay-active");if(l){var h="ChartTitleAbove"===a||"PHAxisTitle"===a||"PVAxisTitle"===a,d=(r.frozenRows||r.frozenColumns?(c={clientY:(d=l.getBoundingClientRect()).top},u={clientX:d.left},d.top<this.parent.getColumnHeaderContent().getBoundingClientRect().bottom&&(c.target=this.parent.getColumnHeaderContent()),d.left<this.parent.getRowHeaderContent().getBoundingClientRect().right&&(u.target=this.parent.getRowHeaderTable())):(c={clientY:l.offsetTop,isImage:!0},u={clientX:l.offsetLeft,isImage:!0}),this.parent.notify(us,c),this.parent.notify(fs,u),se(c.clientY,u.clientX,r)),r=r.name+"!"+G(c.clientY,u.clientX);if(e.triggerEvent){var p={switchRowColumn:e.switchRowColumn,chartType:e.chartType,chartTheme:e.chartTheme,addChartEle:e.addChartEle,id:l.id,address:r,cancel:!1};if(this.parent.notify(gt,{action:"chartDesign",eventArgs:p}),p.cancel)return}var c=this.getChartElement(l),u=c.getAttribute("id"),f=this.getChartCollectionId(u);if(c&&(s=ee.getComponent(c,"chart"),ee.isNullOrUndefined(s))&&(s=ee.getComponent(c,"accumulationchart"),t=!0),n&&this.switchRowColumn(f,u,s,d),i&&this.switchChartType(f,u,i,s,d,e.markerVisible),o&&this.switchChartTheme(f,u,o,s,d),a)if(h&&!e.title){if(0<this.parent.element.getElementsByClassName("e-title-dlg").length)return;this.titleDlgHandler(a,s,d,f,t,r,e.triggerEvent)}else this.updateChartElement(a,s,d,f,e.title,t);e.triggerEvent&&!h&&(p={switchRowColumn:e.switchRowColumn,chartType:e.chartType,chartMarker:e.markerVisible,chartTheme:e.chartTheme,addChartEle:e.addChartEle,id:l.id,address:r},this.parent.notify(le,{action:"chartDesign",eventArgs:p}))}},zc.prototype.switchRowColumn=function(e,t,r,n){var i=this.parent.chartColl[e];i.isSeriesInRows=!!ee.isNullOrUndefined(i.isSeriesInRows)||!i.isSeriesInRows;for(var o=0,a=n.chart.length;o<a;o++)n.chart[o].id===t&&(n.chart[o].isSeriesInRows=i.isSeriesInRows);e=this.initiateChartHandler({option:i,isRefresh:!0,isSwitchRowColumn:!0});r.series=e},zc.prototype.switchChartTheme=function(e,t,r,n,i){this.parent.chartColl[e].theme=r;for(var o=0,a=i.chart.length;o<a;o++)i.chart[o].id===t&&(i.chart[o].theme=r);n.setProperties({theme:r,background:this.getThemeBgColor(r)},!0),n.refresh()},zc.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},zc.prototype.switchChartType=function(e,t,r,n,i,o,a,s){var l=this.parent.chartColl[e].type;this.parent.chartColl[e].type=r;for(var h,d=0,p=i.chart.length;d<p;d++)i.chart[d].id===t&&(i.chart[d].type=r,ee.isNullOrUndefined(i.chart[d].markerSettings)||(i.chart[d].markerSettings.visible=o));if("Pie"!==r&&"Doughnut"!==r)if("Pie"===l||"Doughnut"===l)this.changeCharType(e);else{l!==r&&("Scatter"===r?(h=n.primaryXAxis.labels)&&0<h.length&&oe(h[h.length-1])&&(n.primaryXAxis.valueType="Double"):"Double"===n.primaryXAxis.valueType&&(n.primaryXAxis.valueType="Category"));for(var c="Line"===r||"StackingLine"===r||"StackingLine100"===r,d=0,u=(f=n.series).length;d<u;d++)f[d].type=r,c?(f[d].marker.visible=o,f[d].marker.shape=ee.isNullOrUndefined(f[d].marker.shape)?"Circle":f[d].marker.shape,"undoRedo"===s&&(f[d].marker.visible=a)):f[d].marker.visible=!1;n.series=f,n.refresh()}else if("Pie"===l||"Doughnut"===l){for(var f,d=0,u=(f=n.series).length;d<u;d++)f[d].innerRadius="Pie"===r?"0%":"40%";n.series=f,n.refresh()}else this.changeCharType(e)},zc.prototype.getChartElement=function(e){var t=e.querySelector(".e-chart");return t=ee.isNullOrUndefined(t)?e.querySelector(".e-accumulationchart"):t},zc.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},zc.prototype.changeCharType=function(e){var t=document.getElementById(this.parent.chartColl[e].id),r=ee.closest(t,".e-datavisualization-chart");r.remove(),this.initiateChartHandler({option:this.parent.chartColl[e],isInitCell:!1,triggerEvent:!1,isPaste:!1}),t=document.getElementById(this.parent.chartColl[e].id),(r=ee.closest(t,".e-datavisualization-chart")).classList.contains("e-ss-overlay-active")||r.classList.add("e-ss-overlay-active")},zc.prototype.titleDlgHandler=function(t,r,n,i,e,o,a){var s,l,h=this;e&&("PHAxisTitle"===t||"PVAxisTitle"===t)||(e=this.parent.serviceLocator.getService(T),(l=this.parent.serviceLocator.getService(O)).show({width:375,showCloseIcon:!0,isModal:!0,cssClass:"e-title-dlg",header:"chart_abovechart"===t?e.getConstant("ChartTitle"):"PHAxisTitle"===t?e.getConstant("HorizontalAxisTitle"):e.getConstant("VerticalAxisTitle"),beforeOpen:function(){l.dialogInstance.content=h.titleDlgContent(t,r),l.dialogInstance.dataBind(),h.parent.element.focus()},buttons:[{buttonModel:{content:e.getConstant("Ok"),isPrimary:!0,cssClass:"e-btn e-clearall-btn e-flat"},click:function(){var e=h.parent.element.querySelector(".e-title-dlg").getElementsByClassName("e-title-dlg-content")[0];s=e.getElementsByTagName("input")[0].value,l.hide(),h.updateChartElement(t,r,n,i,s,null,o,a)}}]}),l.dialogInstance.refresh())},zc.prototype.titleDlgContent=function(e,t){var r=this.parent.serviceLocator.getService(T),n=this.parent.createElement("div",{className:"e-title-dlg-content"}),i=this.parent.createElement("span",{className:"e-header e-top-header"}),r=(i.innerText=r.getConstant("EnterTitle"),this.parent.createElement("input",{className:"e-input",id:"titleInput",attrs:{type:"text"}}));return n.appendChild(i),n.appendChild(r),t&&(r.value="PHAxisTitle"===e?t.primaryXAxis.title||r.value:"PVAxisTitle"===e?t.primaryYAxis.title||r.value:t.title||r.value),n},zc.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(_r,this.initiateChartHandler),this.parent.off(ys,this.refreshChartCellObj),this.parent.off(Sn,this.refreshChartCellModel),this.parent.off(Cs,this.refreshChartCellModel),this.parent.off(vs,this.deleteChart),this.parent.off(ws,this.clearBorder),this.parent.off(Is,this.insertChartHandler),this.parent.off(Es,this.chartRangeHandler),this.parent.off(Fs,this.chartDesignTabHandler),this.parent.off(ks,this.updateChartElement),this.parent.off(Os,this.undoRedoForChartDesign),this.parent.off(Wr,this.refreshChartData))},zc.prototype.destroy=function(){this.removeEventListener();var e=this.parent=null;this.chart&&(e=this.chart.element,this.chart.destroy()),e&&ee.detach(e),this.chart=null},zc.prototype.getModuleName=function(){return"spreadsheetChart"};var jc=zc;function zc(e){this.parent=e,this.addEventListener()}qc.prototype.print=function(e,t){var r=this;if(e.isPrintingProcessing=!0,this.multipleCanvasDataURL=[],this.chartElements=[],"ActiveSheet"===t.type){var n=e.sheets[e.activeSheetIndex];this.activeSheetPrint(e,n,t,e.activeSheetIndex)}else{this.totalSheetCount=[],this.workbookActiveSheetCount=1;for(var i,o=0;o<e.sheets.length;o++)"Visible"===e.sheets[o].state&&(this.totalSheetCount.push(o),1<this.totalSheetCount.length)&&0<this.parent.sheets[o].ranges.length&&this.parent.sheets[o].ranges.some(function(e){return!ee.isNullOrUndefined(e.dataSource)})&&(this.allowTimer=!0,n=e.sheets[o],i=P(G(0,0)+":"+G(n.rowCount-1,n.colCount-1)),this.parent.notify(ht,{sheet:n,indexes:i}));this.allowTimer?(this.allowTimer=!1,setTimeout(function(){r.activeSheetPrint(e,e.sheets[r.totalSheetCount[0]],t,r.totalSheetCount[0])},2e3)):this.activeSheetPrint(e,e.sheets[this.totalSheetCount[0]],t,this.totalSheetCount[0])}},qc.prototype.updateChartRowAndColumnIndices=function(e,t){var r=e.sheets[t];if(this.rowIndex=r.usedRange.rowIndex,this.columnIndex=r.usedRange.colIndex,0<e.chartColl.length)for(var n=0;n<e.chartColl.length;n++){var i,o=e.chartColl[n];t===B(e,o.range.substring(0,o.range.lastIndexOf("!")))&&(i={clientX:o.left,isImage:!0},o={clientY:o.top,isImage:!0},e.notify(us,o),e.notify(fs,i),o.clientY>r.usedRange.rowIndex&&(this.rowIndex=Math.max(this.rowIndex,o.clientY)),i.clientX>r.usedRange.colIndex)&&(this.columnIndex=Math.max(this.columnIndex,i.clientX))}},qc.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,[],void 0,void 0,t,this,0,0,!0,n,r)},qc.prototype.processCell=function(p,e,c,I,E,N,R,F,k,O,A,t,T,D){for(var L=this,P=(void 0===O&&(O=0),void 0===A&&(A=0),void 0===t&&(t=!0),0),M=D.allowRowColumnHeader,B=37,U=0,K=(this.chartHeight=0,!1),H=p;H<this.pageCounts.length;H++){this.chartLoadedCount=0,this.totalCharts=0,this.imageLoadedCount=0,this.totalImages=0,O+=0===H?0:1100,R=document.createElement("canvas"),N=R.getContext("2d"),R.width=1e3,R.height=1100,N.font="11pt Calibri",N.textBaseline="bottom",N.index=H,N.width=1e3,!t&&(this.isImageLoaded||this.isChartLoaded)||(E=[],A=I=0);for(var V=e;V<this.endRow;V++){var j=!(t=!0),z=(this.isColumn=this.isColumn||0===V,{borderBottom:"1px solid black"}),_=F.rows[V]&&F.rows[V].height||this.defaultCellHeight,q=(this.initialRowCount=V,I=P,0===H?0:this.pageCounts[H-1]+1),W=this.pageCounts[H],G=(A+=ee.isNullOrUndefined(F.rows[V])?this.defaultCellHeight:_+(0===V&&M?this.defaultCellHeight:0),!ee.isNullOrUndefined(F.rows[V])&&F.rows[V]&&F.rows[V].height||this.defaultCellHeight);if(1080<A){if(this.startNewPageCount=V,U=M?_+(0===V&&M?this.defaultCellHeight:0):0,j=!1,this.isColumn=!0,this.isImageLoaded||this.isChartLoaded)break;O+=1100,t&&this.multipleCanvasDataURL.push(R.toDataURL()),t=!0,R=document.createElement("canvas"),N=R.getContext("2d"),R.width=1e3,R.height=1100,N.font="11pt Calibri",N.textBaseline="bottom",N.index=H,N.width=1e3;for(var r=0;r<E.length;r++)void 0!==E[r]&&(E[r]-=A-G);A=M||D.allowGridLines?_+(M?this.defaultCellHeight:0):_}var Y={borderBottom:"1px solid black",borderTop:"1px solid black",borderLeft:"1px solid black",borderRight:"1px solid black"},$={borderRight:"1px solid black"};if(M&&this.isColumn)for(var n=q;n<=W;n++){var i=ue(n+1),o=n===q?2:1;N.font="11pt Calibri";for(r=0;r<o;r++){var a,s,l=0===r&&2==o?B:F.columns[n]&&F.columns[n].hidden?0:F.columns[n]&&F.columns[n].width||this.defaultCellWidth;0!==(l=1e3<I+l?l-1-(I+l-1e3):l)?(a=N.measureText(i).width,a=k.calculateTextPosition(a,l,I,"Center"),s=this.defaultCellHeight,N.fillText(n===q&&0===r?"":i,a,s),k.drawBorder(N,Y,I,0,l,this.defaultCellHeight),I+=l,E[n]=this.defaultCellHeight,n===W&&(2==o?1===r:0===r)&&(this.isColumn=!(n===W),I=0)):n===W&&(this.isColumn=!1,I=0)}}if(ee.isNullOrUndefined(F.rows[V])||!ee.isNullOrUndefined(F.rows[V].hidden)&&F.rows[V].hidden){if(ee.isNullOrUndefined(F.rows[V])){var h={borderBottom:"1px solid black",borderTop:"1px solid black",borderLeft:"1px solid black",borderRight:"1px solid black"};j=1080<A+G+(0===V&&M?this.defaultCellHeight:0)||V===F.rows.length-1||V===this.endRow-1;for(n=q;n<=W;n++){var d=F.rows[V]&&!ee.isNullOrUndefined(F.rows[V].cells)&&F.rows[V].cells[n],d=(ee.isNullOrUndefined(d)||ee.isNullOrUndefined(d.style)||(h=this.setBorderStyle(d,h)),M&&n===q&&(k.rowHeaderText((V+1).toString(),N,k,B,I,h,E[n],this.defaultCellHeight),I+=B),F.columns[n]&&F.columns[n].width||this.defaultCellWidth),d=1e3<I+d?d-1-(I+d-1e3):d;E[n]=isNaN(E[n])?P:E[n],D.allowGridLines?k.drawBorder(N,h,I,E[n],d,G):M&&!D.allowGridLines&&n===W&&k.drawBorder(N,{borderRight:"1px solid black"},I,E[n],d,G),I+=d,n===W&&M&&j&&(k.drawBorder(N,z,0,E[n],I,G),j=!1),E[n]+=G}}}else for(var Z,j=this.endRow===F.rows.length&&(1080<A+(F.rows[V+1]&&F.rows[V+1].height||this.defaultCellHeight)+(0===V&&M?this.defaultCellHeight:0)||V===F.rows.length-1),X=this,n=q;n<=W;n++)!function(e){var n=F.rows[V]&&!ee.isNullOrUndefined(F.rows[V].cells)&&F.rows[V].cells[e];if(ee.isNullOrUndefined(n)||ee.isNullOrUndefined(n.style)||(Y=X.setBorderStyle(n,Y)),ee.isNullOrUndefined(F.columns[e])||ee.isNullOrUndefined(F.columns[e].hidden)||!F.columns[e].hidden){var i,t=!ee.isNullOrUndefined(F.rows[V].cells)&&!ee.isNullOrUndefined(F.rows[V].cells[e])&&!isNaN(F.rows[V].cells[e].colSpan)&&q>e+F.rows[V].cells[e].colSpan,r=!(ee.isNullOrUndefined(F.rows[V].cells)||ee.isNullOrUndefined(F.rows[V].cells[e])||isNaN(F.rows[V].cells[e].rowSpan)||V+F.rows[V].cells[e].rowSpan>X.startNewPageCount||0===X.startNewPageCount),o="",a=ee.isNullOrUndefined(n)||isNaN(n.rowSpan)||t||r?1:Math.max(n.rowSpan,0);if(E[e]=isNaN(E[e])?P:E[e],M&&e===q){N.font="11pt Calibri";var s=E[e];if(0<a)for(var l=0;l<(0===a?1:a);l++)s+=(I=0)===l?0:F.rows[V+l]&&F.rows[V+l-1].height||X.defaultCellHeight,k.rowHeaderText((V+1+l).toString(),N,k,B,I,Y,s,F.rows[V+l].height||X.defaultCellHeight),I+=B;else I=0,I+=B}if(!ee.isNullOrUndefined(n)&&n){var h,r=n.style&&n.style.fontSize||"11pt",d=n.style&&n.style.color||"#000000";if(!isNaN(F.rows[V].cells[e].rowSpan)&&1<F.rows[V].cells[e].rowSpan&&isNaN(F.rows[V+1].cells[e].rowSpan)&&X.parent.merge(""+ue(e+1)+(V+1)+":"+ue(e+1)+(V+F.rows[V].cells[e].rowSpan-1)),!isNaN(F.rows[V].cells[e].colSpan)&&1<F.rows[V].cells[e].colSpan)if(!ee.isNullOrUndefined(F.rows[V+1])&&!ee.isNullOrUndefined(F.rows[V+1].cells)&&0<F.rows[V+1].cells.length&&!ee.isNullOrUndefined(F.rows[V+1].cells[e])&&isNaN(F.rows[V+1].cells[e].colSpan))X.parent.merge(""+ue(e+1)+(V+1)+":"+ue(e+1+F.rows[V].cells[e].colSpan-1)+(V+1));else if(ee.isNullOrUndefined(F.rows[V].cells[e+1].colSpan))for(var p=1;p<F.rows[V].cells[e].colSpan;p++)F.rows[V].cells[e+p].colSpan=-p;h=isNaN(F.rows[V].cells[e].colSpan)||t?1:Math.max(F.rows[V].cells[e].colSpan,0),F.rows[V].cells[e].rowSpan&&!t&&F.rows[V].cells[e].rowSpan<0&&(t=F.rows[V+F.rows[V].cells[e].rowSpan].cells[e].colSpan,h=t||h),(e===q||0<e&&F.columns&&F.columns[e-1]&&F.columns[e-1].hidden&&F.rows[V].cells[e-1]&&1<F.rows[V].cells[e-1].colSpan)&&h<=0&&(h=1);var t=n.style&&n.style.backgroundColor||"#ffffff",c=n.style?n.style.textAlign:"",u=(N.font=r,N.fillStyle=d,[]);if(1<h){for(var f=F.columns.slice(e,e+h),l=0;l<f.length;l++)u.push(f.hidden?0:f[l]&&f[l].width||X.defaultCellWidth);0===u.length?u.push(X.defaultCellWidth*h):u.length!==h&&(u=u.map(function(e){return e+L.defaultCellWidth*(h-1-u.length)}))}i=1<h?u.reduce(function(e,t){return e+t},0):1===h?F.columns[e]&&F.columns[e].width||X.defaultCellWidth:0,i=1e3<I+i?i-1-(I+i-1e3):i,G=1<a?F.rows.slice(V,V+a).map(function(e){return e.height||L.defaultCellHeight}).reduce(function(e,t){return e+(t||L.defaultCellHeight)},0):1===a?_:0;var g,m,v,y,C,b,x,r=(n.style&&n.style.verticalAlign||"Bottom").toLowerCase();!ee.isNullOrUndefined(n.image)&&0<n.image.length&&X.processImages(H,V,n,R,N,A,X.endRow,_,U,M,D,F,k,I,E,O,T),!ee.isNullOrUndefined(n.chart)&&0<n.chart.length&&X.handleCharts(H,V,n,N,R,A,X.endRow,X.initialRowCount,U,_,M,D,F,k,X.multipleCanvasDataURL,I,E,O,T),ee.isNullOrUndefined(n.value)&&ee.isNullOrUndefined(n.formula)&&ee.isNullOrUndefined(n.hyperlink)?k.rowHeaderRect(N,I,E[e],i,G,t):(g=n.formula&&n.format?("Automatic"===X.parent.calculationMode&&X.parent.notify(ie,{action:"refreshCalculate",rowIndex:V,colIndex:e,value:n.formula,isFormula:Q(n.formula),sheetIndex:T}),b={value:n.value,format:n.format,rowIndex:V,colIndex:e,sheetIndex:X.parent.activeSheetIndex,cell:n,refresh:!0},o=X.parent.workbookNumberFormatModule.getFormattedCell(b),""+(c||(b.isRightAlign?"Right":"Left"))):n.format?(b={value:n.value,format:n.format,rowIndex:V,colIndex:e,sheetIndex:X.parent.activeSheetIndex,cell:n,refresh:!0},o=X.parent.workbookNumberFormatModule.getFormattedCell(b),""+(c||(b.isRightAlign?"Right":"Left"))):n.formula?("Automatic"===X.parent.calculationMode&&X.parent.notify(ie,{action:"refreshCalculate",rowIndex:V,colIndex:e,value:n.formula,isFormula:Q(n.formula),sheetIndex:T}),o=n.value,""+(c||"Left")):(ee.isNullOrUndefined(n.hyperlink)||(ee.isNullOrUndefined(n.value)?n.value=(ee.isNullOrUndefined(n.hyperlink)||"object"!=typeof n.hyperlink)&&n.hyperlink||n.hyperlink.address:!ee.isNullOrUndefined(n.value)&&""!==n.value||(n.value="object"==typeof n.hyperlink?n.hyperlink.address:n.hyperlink),d=n.style&&n.style.color||"#00e"),o=n.value,b=!ee.isNullOrUndefined(n.value)&&""!==n.value&&new RegExp("^[^\\p{L}]*$","u").test(n.value),""+(c||(b?"Right":"Left"))),c=n.style&&n.style.fontSize||"11pt",b=n.style&&n.style.fontFamily||"Calibri",S=n.style&&n.style.fontStyle||"",x=n.style&&n.style.fontWeight||"normal",N.font=S+" "+x+" "+c+" "+b,m=N.measureText(o),v=m.width,S=m.actualBoundingBoxAscent+m.actualBoundingBoxDescent,n.wrap?(y=X.defaultCellHeight<G?parseInt(c.replace("pt",""),10)/72*96:G,b=1===(x=k.wrapText(N,o,i)).length?G:x.length*y!==G&&x.length*y<G?G-(x.length-1)*y:y,C=E[e]+("top"===r?y:"middle"===r&&y+b/4<b?y+b/4:b),N.save(),N.beginPath(),N.rect(I,E[e],i,G),N.clip(),N.fillStyle=t,N.fillRect(I,E[e],i,G+("top"===r?y:0)),x.forEach(function(e,t){N.fillStyle=d,m=N.measureText(e),v=m.width;var r=k.calculateTextPosition(v,i,I,g);N.fillText(e,r,C+t*y),k.textDecoration(n,N,r,C+t*y,d,m,o,i)}),N.restore()):(N.save(),N.beginPath(),N.rect(I,E[e],i,G),N.clip(),N.fillStyle=t,N.fillRect(I,E[e],i,G),N.fillStyle=d,c=k.calculateTextPosition(v,i,I,g),b=E[e],x=G/2+S/2,"top"===r?N.textBaseline="top":b+="middle"===r&&x<G?x:G,ee.isNullOrUndefined(n.style)||(b=!ee.isNullOrUndefined(n.style.borderBottom)&&-1<n.style.borderBottom.indexOf("double")||!ee.isNullOrUndefined(n.style.borderTop)&&-1<n.style.borderTop.indexOf("double")?b-2:b,c=!ee.isNullOrUndefined(n.style.borderLeft)&&-1<n.style.borderLeft.indexOf("double")||!ee.isNullOrUndefined(n.style.borderRight)&&-1<n.style.borderRight.indexOf("double")?c+("Left"===g?2:-3):c),N.fillText(o,c,b),N.restore(),k.textDecoration(n,N,c,b,d,m,o,i))),n.style&&(0<i||0<G)&&(n.style.borderBottom||n.style.borderTop||n.style.borderLeft||n.style.borderRight&&(ee.isNullOrUndefined(n.rowSpan)&&ee.isNullOrUndefined(n.colSpan)||!ee.isNullOrUndefined(n.rowSpan)&&0<n.rowSpan||!ee.isNullOrUndefined(n.colSpan)&&0<n.colSpan))&&k.drawBorder(N,n.style,I,E[e]<=0?2:E[e],i,G)}var t=h<=0?i:i||F.columns[e]&&F.columns[e].width||X.defaultCellWidth,S=(D.allowGridLines&&(Y.borderRight=e===W&&M?void 0:"1px solid black",k.drawBorder(N,Y,I,E[e],t,G)),I+=t,0);if(1<a){for(S=E[e],p=e;p<e+h;p++){var w=F.rows[V]&&!ee.isNullOrUndefined(F.rows[V].cells)&&F.rows[V].cells[p];w&&!ee.isNullOrUndefined(w.image)?X.processImages(H,V,w,R,N,A,X.endRow,_,U,M,D,F,k,I,E,O,T):w&&!ee.isNullOrUndefined(w.chart)&&X.handleCharts(H,V,w,N,R,A,X.endRow,X.initialRowCount,U,_,M,D,F,k,X.multipleCanvasDataURL,I,E,O,T),w.style&&p===e&&0<G&&(w.style.borderBottom||w.style.borderTop||w.style.borderLeft||w.style.borderRight)&&k.drawBorder(N,w.style,I,E[e],2,G),E[p]=(isNaN(E[p])?P:E[p])+G}e+=h-1}e===W&&M&&k.drawBorder(N,$,I-2,E[e]-S,2,G),e===W&&M&&j&&!K&&(k.drawBorder(N,z,0,E[e]-S,I,G),j=!1),a<=1&&(E[e]+=G)}else if(M&&e===q){a=ee.isNullOrUndefined(n)||isNaN(F.rows[V].cells[e].rowSpan)?1:Math.max(F.rows[V].cells[e].rowSpan,0),s=(E[e]=isNaN(E[e])?P:E[e],E[e]);N.font="11pt Calibri";for(l=0;l<a;l++)s+=(I=0)===l?0:F.rows[V+l]&&F.rows[V+l-1].height||X.defaultCellHeight,k.rowHeaderText((V+1+l).toString(),N,k,B,I,Y,s,F.rows[V+l].height||X.defaultCellHeight),I+=B;E[e]+=G}Z=e}(n),n=Z}if(this.isImageLoaded||this.isChartLoaded){if(this.isImageLoaded||this.isChartLoaded)break}else t&&0<this.endRow&&this.multipleCanvasDataURL.push(R.toDataURL()),e=0,this.pageCounts.length-1===H&&k.canvasPrint(this.parent,T,D)}},qc.prototype.setBorderStyle=function(e,t){return t.borderBottom=(ee.isNullOrUndefined(e.style.borderBottom)?t:e.style).borderBottom,t.borderTop=(ee.isNullOrUndefined(e.style.borderTop)?t:e.style).borderTop,t.borderRight=(ee.isNullOrUndefined(e.style.borderRight)?t:e.style).borderRight,t.borderLeft=(ee.isNullOrUndefined(e.style.borderLeft)?t:e.style).borderLeft,t},qc.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},qc.prototype.handleCharts=function(a,r,e,s,l,h,t,n,d,p,c,u,f,g,m,v,y,C,b){var x=this;if(!ee.isNullOrUndefined(e.chart))for(var S=this,i=0,o=e.chart;i<o.length;i++)!function(i){S.totalCharts+=1;var e,o=new Image,t=(i.left=ee.isNullOrUndefined(i.left)?0:i.left,i.top=ee.isNullOrUndefined(i.top)?0:i.top,document.getElementById(i.id));ee.isNullOrUndefined(t)&&(S.parent.insertChart([i]),t=document.getElementById(i.id),S.chartElements.push(i.id+"_overlay")),ee.isNullOrUndefined(t)||(S.chartHeight=i.height,S.initialRowCount+Math.ceil(i.height/19)>S.endRow&&(u.allowRowColumnHeader||u.allowGridLines)&&f.rows.length-1===r&&(e=p+(c?S.defaultCellHeight:0),l.height>h+(S.chartHeight-e)?S.endRow+=Math.ceil((S.chartHeight-e)/19):S.endRow+=Math.ceil((l.height-(h+e))/19)),e=t.cloneNode(!0),t=window.URL.createObjectURL(new Blob([(new XMLSerializer).serializeToString(e.childNodes[1])],{type:"image/svg+xml"})),o.onload=function(){var e=Math.ceil(i.left/1e3)-1,t=Math.ceil(i.top/1080)-1,r=i.left+(c?37:0),n=i.top+(c?19:0)+(0<t?d:0);s.drawImage(o,e<=0?r:r-1e3*e,t<=0?n:n-1160*t,i.width,i.height),x.chartLoadedCount++,x.chartLoadedCount===x.totalCharts&&(v+=i.width,x.isChartLoaded=!1,x.isImageLoaded||(m.push(l.toDataURL()),r=x.initialRowCount===f.rows.length-1&&h<1080?f.rows.length:x.initialRowCount,e=x.endRow,x.processCell(a,r+1===e?e:r,e,v,y,s,l,f,g,C,h,!1,b,u)))},o.src=t,S.isChartLoaded=!0)}(o[i])},qc.prototype.processImages=function(a,t,e,s,l,h,r,n,d,p,c,u,f,g,m,v,y){var C=this;if(!ee.isNullOrUndefined(e.image)){for(var b=this,i=0,o=e.image;i<o.length;i++)!function(i){b.totalImages+=1;var e,o=new Image;o.src=i.src,i.left=ee.isNullOrUndefined(i.left)?0:i.left,i.top=ee.isNullOrUndefined(i.top)?0:i.top,b.chartHeight=i.height,b.initialRowCount+Math.ceil(i.height/19)>b.endRow&&(c.allowRowColumnHeader||c.allowGridLines)&&t===u.rows.length-1&&(e=n+(p?b.defaultCellHeight:0),s.height>h+(b.chartHeight-e)?b.endRow+=Math.ceil((b.chartHeight-e)/19):b.endRow+=Math.ceil((s.height-(h+e))/19)),o.onload=function(){var e=Math.ceil(i.left/1e3)-1,t=Math.ceil(i.top/1080)-1,r=i.left+(p?37:0),n=i.top+(p?19:0)+(0<t?d:0);l.drawImage(o,e<=0?r:r-1e3*e,t<=0?n:n-1160*t,i.width,i.height),C.imageLoadedCount++,C.imageLoadedCount===C.totalImages&&(C.isImageLoaded=!1,g+=i.width,C.isChartLoaded||(C.multipleCanvasDataURL.push(s.toDataURL()),r=C.initialRowCount===u.rows.length-1&&h<1080?u.rows.length:C.initialRowCount,e=C.endRow,C.processCell(a,r+1===e?e:r,e,g,m,l,s,u,f,v,h,!1,y,c)))},o.onerror=function(){var e,t;C.imageLoadedCount++,C.imageLoadedCount===C.totalImages&&(C.isImageLoaded=!1,C.isChartLoaded||(C.multipleCanvasDataURL.push(s.toDataURL()),e=C.initialRowCount===u.rows.length-1&&h<1080?u.rows.length:C.initialRowCount,t=C.endRow,C.processCell(a,e+1===t?t:e,t,g,m,l,s,u,f,v,h,!1,y,c)))}}(o[i]);this.isImageLoaded=!0}},qc.prototype.textDecoration=function(e,t,r,n,i,o,a,s){""!==a&&(!ee.isNullOrUndefined(e.style)&&!ee.isNullOrUndefined(e.style.textDecoration)&&-1<e.style.textDecoration.toLowerCase().indexOf("underline")||!ee.isNullOrUndefined(e.hyperlink))&&(t.beginPath(),t.moveTo(r,n-3),t.lineTo(r+(o.width>s?s:o.width),n-3),t.strokeStyle=i,t.lineWidth=1,t.stroke())},qc.prototype.rowHeaderRect=function(e,t,r,n,i,o){void 0===o&&(o="#ffffff"),e.save(),e.beginPath(),e.rect(t,r,n,i),e.clip(),e.fillStyle=o,e.fillRect(t,r,n,i),e.restore()},qc.prototype.rowHeaderText=function(e,t,r,n,i,o,a,s){var l=t.measureText(e).width,l=r.calculateTextPosition(l,n,i,"Center"),h=a;t.save(),t.beginPath(),t.rect(i,a,n,s),t.clip(),t.fillStyle="#000000",t.fillText(e,l,h+s),r.drawBorder(t,o,i,a||0,n,s),t.restore()},qc.prototype.canvasPrint=function(o,e,t){var a=this;if("Workbook"===t.type&&this.totalSheetCount.length-1>=this.workbookActiveSheetCount){var r=this.totalSheetCount[this.workbookActiveSheetCount],n=o.sheets[r];this.workbookActiveSheetCount++,this.activeSheetPrint(o,n,t,r)}else{for(var s,i=0;i<this.chartElements.length;i++){var l=document.getElementById(this.chartElements[i]);ee.isNullOrUndefined(l)||l.remove()}0<this.multipleCanvasDataURL.length&&(n=navigator.userAgent,(s=window.open(" ","_blank","height="+window.outerHeight+",width="+window.outerWidth+",tabbar=no")).document.write("<html><head><title></title></head><body>"),-1!==n.indexOf("Chrome")||-1!==n.indexOf("Safari")||-1!==n.indexOf("Firefox")?(s.document.write("<!DOCTYPE html>"),s.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:"+1e3.toString()+"px "+1400..toString()+"px; }</style></head><body>")):(s.document.write("<!DOCTYPE html>"),s.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:"+1e3.toString()+"px "+1400..toString()+"px; }</style></head><body>")),this.multipleCanvasDataURL.forEach(function(e,t){var r=s.document.createElement("canvas"),n=(r.width=1e3,r.height=1400,r.getContext("2d")),i=new Image;i.onload=function(){n.drawImage(i,0,0,1e3,1400),t===a.multipleCanvasDataURL.length-1&&(o.isPrintingProcessing=!1,s.print(),s.document.close(),s.close(),o.printModule.setToDefault())},i.src=e,s.document.body.appendChild(r)}))}},qc.prototype.drawBorder=function(e,t,r,n,i,o){var a=t.borderBottom,s=t.borderLeft,l=t.borderRight,h=t.borderTop,d=t.borderColor;e.strokeStyle=d||"black",ee.isNullOrUndefined(a)||-1!==a.indexOf("#FFFFFF")||(e.strokeStyle=a.split(" ")[2],this.drawPath(r,(2===n?-2:n)+o,r+i,(2===n?-2:n)+o,e,a,!1,t,"bottom")),ee.isNullOrUndefined(s)||-1!==s.indexOf("#FFFFFF")||(e.strokeStyle=s.split(" ")[2],this.drawPath(r,n,r,(2===n?-2:n)+o,e,s,!0,t,"left")),ee.isNullOrUndefined(l)||-1!==l.indexOf("#FFFFFF")||(e.strokeStyle=l.split(" ")[2],this.drawPath(r+i,n,r+i,(2===n?-2:n)+o,e,l,!1,t,"right")),ee.isNullOrUndefined(h)||-1!==h.indexOf("#FFFFFF")||(e.strokeStyle=h.split(" ")[2],this.drawPath(r,n,r+i,n,e,h,!0,t,"top"))},qc.prototype.drawPath=function(e,t,r,n,i,o,a,s,l){if(i.beginPath(),-1<o.indexOf("dashed"))i.setLineDash([3,2]);else if(-1<o.indexOf("dotted"))i.setLineDash([1,1]);else{var h,d,p,c,u,f,g,m;if(-1<o.indexOf("double"))return i.setLineDash([]),h=!(ee.isNullOrUndefined(s.borderBottom)||ee.isNullOrUndefined(s.borderLeft)||ee.isNullOrUndefined(s.borderRight)||ee.isNullOrUndefined(s.borderTop)),d=!ee.isNullOrUndefined(s.borderBottom)&&!ee.isNullOrUndefined(s.borderLeft)&&ee.isNullOrUndefined(s.borderRight)&&ee.isNullOrUndefined(s.borderTop),p=ee.isNullOrUndefined(s.borderBottom)&&!ee.isNullOrUndefined(s.borderLeft)&&ee.isNullOrUndefined(s.borderRight)&&!ee.isNullOrUndefined(s.borderTop),c=!ee.isNullOrUndefined(s.borderBottom)&&!ee.isNullOrUndefined(s.borderLeft)&&ee.isNullOrUndefined(s.borderRight)&&!ee.isNullOrUndefined(s.borderTop),u=!ee.isNullOrUndefined(s.borderBottom)&&ee.isNullOrUndefined(s.borderLeft)&&!ee.isNullOrUndefined(s.borderRight)&&ee.isNullOrUndefined(s.borderTop),f=ee.isNullOrUndefined(s.borderBottom)&&ee.isNullOrUndefined(s.borderLeft)&&!ee.isNullOrUndefined(s.borderRight)&&!ee.isNullOrUndefined(s.borderTop),g=!ee.isNullOrUndefined(s.borderBottom)&&ee.isNullOrUndefined(s.borderLeft)&&!ee.isNullOrUndefined(s.borderRight)&&!ee.isNullOrUndefined(s.borderTop),m=ee.isNullOrUndefined(s.borderBottom)&&!ee.isNullOrUndefined(s.borderLeft)&&!ee.isNullOrUndefined(s.borderRight)&&!ee.isNullOrUndefined(s.borderTop),s=!ee.isNullOrUndefined(s.borderBottom)&&!ee.isNullOrUndefined(s.borderLeft)&&!ee.isNullOrUndefined(s.borderRight)&&ee.isNullOrUndefined(s.borderTop),i.lineWidth=1,h?e===r?a?this.drawDoubleBorder(i,e,t,r,n,e+3,t+3,r+3,n-2):this.drawDoubleBorder(i,e,t,r,n,e-3,t+3,r-3,n-2):t===n&&(a?this.drawDoubleBorder(i,e,t,r,n,e+2,t+3,r-2,n+3):this.drawDoubleBorder(i,e,t,r,n,e+2,t-3,r-2,n-3)):d?"left"===l?this.drawDoubleBorder(i,e,t,r,n,e+3,t,r+3,n-2):this.drawDoubleBorder(i,e,t,r,n,e+2,t-3,r,n-3):p?"left"===l?this.drawDoubleBorder(i,e,t,r,n,e+3,t+2,r+3,n):this.drawDoubleBorder(i,e,t,r,n,e+2,t+3,r,n+3):c?"left"===l?this.drawDoubleBorder(i,e,t,r,n,e+3,t+3,r+3,n-2):"top"===l?this.drawDoubleBorder(i,e,t,r,n,e+2,t+3,r,n+3):this.drawDoubleBorder(i,e,t,r,n,e+2,t-3,r,n-3):u?"right"===l?this.drawDoubleBorder(i,e,t,r,n,e-3,t,r-3,n-2):this.drawDoubleBorder(i,e,t,r,n,e,t-3,r-2,n-3):f?"right"===l?this.drawDoubleBorder(i,e,t,r,n,e-3,t+3,r-3,n):this.drawDoubleBorder(i,e,t,r,n,e,t+3,r-2,n+3):g?"right"===l?this.drawDoubleBorder(i,e,t,r,n,e-3,t+3,r-3,n-2):"top"===l?this.drawDoubleBorder(i,e,t,r,n,e,t+3,r-2,n+3):this.drawDoubleBorder(i,e,t,r,n,e,t-3,r-2,n-3):m?"right"===l?this.drawDoubleBorder(i,e,t,r,n,e-3,t+3,r-3,n):"top"===l?this.drawDoubleBorder(i,e,t,r,n,e+3,t+3,r-2,n+3):this.drawDoubleBorder(i,e,t,r,n,e+3,t+3,r+3,n):s?"right"===l?this.drawDoubleBorder(i,e,t,r,n,e-3,t,r-3,n-2):"bottom"===l?this.drawDoubleBorder(i,e,t,r,n,e+2,t-3,r-2,n-3):this.drawDoubleBorder(i,e,t,r,n,e+3,t,r+3,n-2):e===r?this.drawDoubleBorder(i,e,t,r,n,e+("left"===l?3:-3),t,r+("left"===l?3:-3),n):t===n&&this.drawDoubleBorder(i,e,t,r,n,e,t+("top"===l?3:-3),r,n+("top"===l?3:-3)),void i.stroke();i.setLineDash([])}i.lineWidth=o.split(" ")[0].split("")[0],i.moveTo(e,t),i.lineTo(r,n),i.stroke()},qc.prototype.drawDoubleBorder=function(e,t,r,n,i,o,a,s,l){e.moveTo(t,r),e.lineTo(n,i),e.moveTo(o,a),e.lineTo(s,l)},qc.prototype.calculateTextPosition=function(e,t,r,n){var i,o=t;if(e<=o)switch(n.toLowerCase()){case"left":i=r+3;break;case"center":i=r+(o-e)/2;break;case"right":i=r+o-e}else i=!(e<t)||"left"===n.toLowerCase()?r+3:"center"===n.toLowerCase()?r+(t-e)/2:r+t-e;return i},qc.prototype.calculatePageCount=function(e,t,r){var n=r,i=this.columnIndex;if(0===e.columns.length)return r=Math.floor(t/this.defaultCellWidth)-(n?1:0),Array(Math.max(1,Math.ceil(i/r))).fill(r);for(var o=0,a=[],s=0;s<=i;s++){var l=e.columns&&e.columns[s],l=(n?27:0)+(l&&l.hidden?0:l&&!ee.isNullOrUndefined(l.width)?l.width:this.defaultCellWidth),n=!1;t<(o+=l)&&(a.push(s-1),n=!0,o=l)}return(0===a.length||a[a.length-1]<i)&&a.push(i),a},qc.prototype.wrapText=function(e,t,r){if(ee.isNullOrUndefined(t))return[""];for(var n=(t="number"==typeof t?t+"":t).split(" "),i=[],o="",a=0;a<n.length;a++)var s=o+n[a]+" ",o=r<e.measureText(s).width&&0<a?(i.push(o),n[a]+" "):s;return i.push(o),i},qc.prototype.getModuleName=function(){return"print"},qc.prototype.destroy=function(){this.setToDefault(),this.totalSheetCount=[],this.parent=null};var _c=qc;function qc(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}Wc=function(e,t){return(Wc=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)};var Wc,Gc,Yc,pc=function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;0<=s;s--)(i=e[s])&&(a=(o<3?i(a):3<o?i(t,r,a):i(t,r))||a);return 3<o&&a&&Object.defineProperty(t,r,a),a},wh=(function(e,t){function r(){this.constructor=e}Wc(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}(c,Gc=Il),(Yc=c).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]),n},c.prototype.getRow=function(e,t,r){var n,i;return t||(i=this.getActiveSheet(),n=this.frozenRowCount(i),i=this.frozenColCount(i),t=ee.isNullOrUndefined(r)||n-1<e&&i-1<r?this.getContentTable():e<n&&r<i?this.sheetModule.getSelectAllTable():e<n?this.getColHeaderTable():this.getRowHeaderTable()),e=this.getViewportIndex(e),t?t.rows[e]:null},c.prototype.hiddenCount=function(e,t,r,n){void 0===r&&(r="rows"),void 0===n&&(n=this.getActiveSheet());for(var i,o=0,a=e;a<=t;a++)(i=n[""+r][a])&&i.hidden&&o++;return o},c.prototype.getViewportIndex=function(e,t){var r=this.getActiveSheet(),n=this.frozenColCount(r),i=this.frozenRowCount(r);if(t){if(n)return t=W(r.topLeftCell)[1],e<n?(e=e-this.hiddenCount(t,e,"columns")-t)+1:(e-=this.hiddenCount(this.viewport.leftIndex+n,e,"columns"))-(this.viewport.leftIndex+n);e=(e-=this.hiddenCount(this.viewport.leftIndex,e,"columns"))-this.viewport.leftIndex}else{if(i)return t=W(r.topLeftCell)[0],e<i?(e=e-this.hiddenCount(t,e)-t)+1:(e-=this.hiddenCount(this.viewport.topIndex+i,e))-(this.viewport.topIndex+i);e=(e-=this.hiddenCount(this.viewport.topIndex,e))-this.viewport.topIndex}return e},c.prototype.preRender=function(){Gc.prototype.preRender.call(this),this.serviceLocator=new gh,this.initServices()},c.prototype.initServices=function(){this.serviceLocator.register(T,new ee.L10n(this.getModuleName(),Yh,this.locale)),this.serviceLocator.register(O,new tc(this)),this.serviceLocator.register(zh,new nc(this)),this.serviceLocator.register(_h,new oc(this))},c.prototype.render=function(){var e;Gc.prototype.render.call(this),this.element.setAttribute("tabindex","0"),this.renderModule=new lp(this),this.renderSpreadsheet(),this.wireEvents(),this.created&&!this.refreshing&&(this.created.observers?0<this.created.observers.length&&(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=[]):(this.createdHandler=this.created,this.setProperties({created:void 0},!0)))},c.prototype.renderSpreadsheet=function(){this.cssClass&&ee.addClass([this.element],this.cssClass.split(" ")),this.setHeight(),this.setWidth(),g.createSpinner({target:this.element},this.createElement),this.cssClass&&-1===this.cssClass.indexOf("e-mobile-view")&&this.isMobileView()&&this.element.classList.add("e-mobile-view"),ee.Browser.isDevice&&this.element.classList.add("e-device"),this.sheetModule=this.serviceLocator.getService("sheet"),this.allowScrolling&&(this.scrollModule=new mp(this)),this.scrollSettings.enableVirtualization&&new yp(this),this.renderModule.render(),new Fp(this)},c.prototype.showSpinner=function(){g.showSpinner(this.element)},c.prototype.hideSpinner=function(){g.hideSpinner(this.element)},c.prototype.protectSheet=function(e,t,r){Gc.prototype.protectSheet.call(this,e,t,r)},c.prototype.unprotectSheet=function(e){Gc.prototype.unprotectSheet.call(this,e)},c.prototype.find=function(e){var t=this.getActiveSheet().activeCell;if(Gc.prototype.findHandler.call(this,e),!e.isAction)return t!==this.getActiveSheet().activeCell?this.getActiveSheet().name+"!"+this.getActiveSheet().activeCell:null},c.prototype.replace=function(e){e={value:e.value,mode:e.mode||"Sheet",isCSen:e.isCSen||!1,isEMatch:e.isEMatch||!1,searchBy:e.searchBy||"By Row",replaceValue:e.replaceValue,replaceBy:e.replaceBy,sheetIndex:ee.isUndefined(e.sheetIndex)?this.activeSheetIndex:e.sheetIndex,findOpt:e.findOpt||""},Gc.prototype.replaceHandler.call(this,e)},c.prototype.findAll=function(e,t,r,n,i){i=i<this.sheets.length?i:this.activeSheetIndex;var o=[];return this.notify(Nt,{value:e,mode:t=t||"Sheet",sheetIndex:i,isCSen:r=r||!1,isEMatch:n=n||!1,findCollection:o}),o},c.prototype.goTo=function(e){if(e.includes("!")){var t,r,n,i,o=B(this,Ei(e));if(void 0===o)return;if(o!==this.activeSheetIndex)return d=(r=e.substring(e.lastIndexOf("!")+1)).split(":")[0],t=this.sheets[o],this.setSheetPropertyOnMute(t,"activeCell",d),this.setSheetPropertyOnMute(t,"selectedRange",r),r=W(d),t.frozenColumns||t.frozenRows?(d=W(t.topLeftCell),t.frozenRows&&r[0]<d[0]||t.frozenColumns&&r[1]<d[1]||(a=this.frozenRowCount(t),p=this.frozenColCount(t),n=[],i=[],w=W(t.paneTopLeftCell),a?(n.push(d[0]),r[0]>=a?i.push(r[0]):i.push(w[0])):(n.push(r[0]),i.push(r[0])),p?(n.push(d[1]),r[1]>=p?i.push(r[1]):i.push(w[1])):(n.push(r[1]),i.push(r[1])),this.setSheetPropertyOnMute(t,"topLeftCell",G(n[0],n[1])),this.setSheetPropertyOnMute(t,"paneTopLeftCell",G(i[0],i[1])))):(r[0]<this.viewport.rowCount&&(r[0]=0),r[1]<this.viewport.colCount&&(r[1]=0),this.updateTopLeftCell(r[0],r[1],null,t)),this.activeSheetIndex=o,void this.dataBind()}var a=te(e),s=this.getActiveSheet(),l=this.frozenRowCount(s),h=this.frozenColCount(s),d=this.insideViewport(a[0],a[1]);if(d){this.selectRange(e);var p=W(s.paneTopLeftCell),c=this.viewport.height,u=(this.allowScrolling&&(c-=this.getScrollElement().parentElement.getBoundingClientRect().height),0),f=0;if(l)for(var g=W(s.topLeftCell)[0];g<l;g++)if(c<(u+=kh(s,g))){f=g;break}if(0===f)for(g=p[0];g<=this.viewport.bottomIndex;g++){if(c<(u+=kh(s,g))){f=g;break}g===this.viewport.bottomIndex&&(f=this.viewport.bottomIndex)}p[2]=f;var m=0,u=0,c=this.viewport.width-this.sheetModule.getScrollSize();if(h)for(g=W(s.topLeftCell)[1];g<h;g++)if(c<(u+=Bh(s,g))){m=g;break}if(0===m)for(g=p[1];g<=this.viewport.rightIndex;g++){if(c<(u+=Bh(s,g))){m=g;break}g===this.viewport.rightIndex&&(m=this.viewport.rightIndex)}if(p[3]=m,a[0]>=p[0]&&a[0]<p[2]&&a[1]>=p[1]&&a[1]<p[3])return;if(l||h){if(p=[].concat(W(s.topLeftCell),[l,p[3]]),a[0]>=p[0]&&a[0]<p[2]&&a[1]>=p[1]&&a[1]<p[3])return;if(p[2]=f,p[3]=h,a[0]>=p[0]&&a[0]<p[2]&&a[1]>=p[1]&&a[1]<p[3])return}}var v,y,C,b,x,S,w=this.getMainContent().parentElement;a[0]===l?C=0:(C=Ah(s,l,a[0]-1,!0),this.scrollSettings.enableVirtualization&&(S=C+this.getContentTable().getBoundingClientRect().height,(x=parseFloat(w.querySelector(".e-virtualtrack").style.height))<S)&&(S+=10,(v=w.querySelector(".e-virtualtrack")).style.height=S+"px",Xh(function(){v.style.height=x+"px"}))),w.scrollTop=C,w=this.element.getElementsByClassName("e-scroller")[0],a[1]===h?C=0:(C=Uh(s,h,a[1]-1,!0),this.scrollSettings.enableVirtualization&&(S=C+this.getContentTable().getBoundingClientRect().width,(b=parseFloat(w.querySelector(".e-virtualtrack").style.width))<S)&&(S+=10,(v=w.querySelector(".e-virtualtrack")).style.width=S+"px",(y=this.getColumnHeaderContent().querySelector(".e-virtualtrack")).style.width=S+"px",(v=this.getMainContent().querySelector(".e-virtualtrack")).style.width=S+"px",Xh(function(){v.style.width=b+"px",y.style.width=b+"px"}))),w.scrollLeft=C,d||this.selectRange(e)},c.prototype.insideViewport=function(e,t){var r,n,i=this.getActiveSheet();return i.frozenRows||i.frozenColumns?(r=this.frozenRowCount(i),n=this.frozenColCount(i),(e>=(i=W(i.topLeftCell))[0]&&e<r||e>=this.viewport.topIndex+r&&e<=this.viewport.bottomIndex)&&(t>=i[1]&&t<n||t>=this.viewport.leftIndex+n&&t<=this.viewport.rightIndex)):e>=this.viewport.topIndex&&e<=this.viewport.bottomIndex&&t>=this.viewport.leftIndex&&t<=this.viewport.rightIndex},c.prototype.resize=function(){this.renderModule.setSheetPanelSize(),this.scrollSettings.enableVirtualization&&this.renderModule.refreshSheet(!1,!0)},c.prototype.cut=function(e){var t=new Promise(function(e){e(void 0)});return this.notify(Fo,e?{range:P(e),sId:(this.sheets[B(this,Ei(e))]?this.sheets[B(this,Ei(e))]:this.getActiveSheet()).id,promise:t,invokeCopy:!0,isPublic:!0}:{promise:t,invokeCopy:!0,isPublic:!0}),t},c.prototype.copy=function(e){var t=new Promise(function(e){e(void 0)});return this.notify(ko,e?{range:P(e),sId:(this.sheets[B(this,Ei(e))]?this.sheets[B(this,Ei(e))]:this.getActiveSheet()).id,promise:t,invokeCopy:!0,isPublic:!0}:{promise:t,invokeCopy:!0,isPublic:!0}),t},c.prototype.paste=function(e,t){this.notify(Oo,{range:e&&P(e),sIdx:e&&B(this,Ei(e)),type:t,isAction:!0,isInternal:!0})},c.prototype.updateAction=function(e){kd(e,this)},c.prototype.setHeight=function(){this.height&&(-1<this.height.toString().indexOf("%")&&(this.element.style.minHeight="400px"),this.element.style.height=ee.formatUnit(this.height))},c.prototype.setWidth=function(){this.width&&((-1<this.width.toString().indexOf("%")||"auto"===this.width)&&(this.element.style.minWidth="300px"),this.element.style.width=ee.formatUnit(this.width))},c.prototype.setColWidth=function(e,t,r){void 0===e&&(e=64),void 0===t&&(t=0);var n,i,o,a=ee.isNullOrUndefined(r)?this.getActiveSheet():this.sheets[r];a&&(n=t,i="number"==typeof e?e+"px":e,t=ee.isNullOrUndefined(t)?W(a.activeCell)[1]:t,r=function(){de(a,n).width=0<parseInt(i,10)?parseInt(i,10):0,a.columns[n].customWidth=!0},e=this.frozenColCount(a),a.id===this.getActiveSheet().id?(t>=this.viewport.leftIndex+e&&t<=this.viewport.rightIndex||e&&t<e?(t=this.getViewportIndex(t,!0),e=Bh(a,n,null,!0),(o=Sd(parseInt(i,10))-e)<0&&e<-o&&(o=-e),r(),this.notify(Yo,{threshold:o,colIdx:n,checkWrapCell:!0}),Nd(n,t,i,!0,this)):(e=Bh(a,t),o=void 0,o=0<parseInt(i,10)?-(e-parseInt(i,10)):-e,r(),this.notify(Yo,{threshold:o,colIdx:t})),this.notify(js,null)):r())},c.prototype.setRowHeight=function(e,t,r,n,i){void 0===e&&(e=20),void 0===t&&(t=0);var o,a,s,l=ee.isNullOrUndefined(r)?this.getActiveSheet():this.sheets[r];l&&(o=t,t=ee.isNullOrUndefined(t)?W(l.activeCell)[0]:t,i&&l.rows[t]&&l.rows[t].customHeight||(a="number"==typeof e?e+"px":e,r=function(){Oh(l,o,0<parseInt(a,10)?parseInt(a,10):0),l.rows[o].customHeight=!0},l.id===this.getActiveSheet().id?(i=this.frozenRowCount(l),t>=this.viewport.topIndex+i&&t<=this.viewport.bottomIndex||i&&t<i?(t=this.getViewportIndex(o),e=kh(l,o,!0),(s=Sd(parseInt(a,10))-e)<0&&e<-s&&(s=-e),r(),this.notify(Go,{threshold:s,rowIdx:o,isCustomHgt:!0}),(n=ee.isNullOrUndefined(n)?!1:n)||(Nd(o,t,a,!1,this),n=!1)):(i=kh(l,t),s=void 0,s=0<parseInt(a,10)?-(i-parseInt(a,10)):-i,r(),this.notify(Go,{threshold:s,rowIdx:o})),this.notify(js,null)):r()))},c.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)},c.prototype.setColumnsWidth=function(e,t){void 0===e&&(e=64),t=t||["A:"+ue(this.getActiveSheet().usedRange.colIndex+1)],this.setSize(e,t,R,this.setColWidth.bind(this))},c.prototype.setSize=function(r,e,n,i,o){var a,s,l,h,d=this;e.forEach(function(e){e.includes("!")?(s=e.substring(0,e.lastIndexOf("!")),a=B(d,s),e=e.substring(e.lastIndexOf("!")+1)):a=d.activeSheetIndex,e.includes(":")?(s=e.split(":"),l=n(s[0]),h=n(s[1])):l=h=n(e);for(var t=l;t<=h;t++)i(r,t,a,!1,o)})},c.prototype.autoFit=function(e){-1!==e.indexOf("!")&&(t=B(this,e.substring(0,e.lastIndexOf("!"))),e=e.substring(e.lastIndexOf("!")+1));var t,e=this.getIndexes(e),r=e.startIdx,n=e.endIdx,i=e.isCol,e=i?R("XFD"):1048576;if(r<=e)for(e<n&&(n=e);r<=n;r++)this.notify(Aa,{idx:r,isCol:i,sheetIdx:t})},c.prototype.getIndexes=function(e){i=-1!==e.indexOf(":")?(n=(i=e.split(":"))[0],i[1]):n=e,ee.isNullOrUndefined(n)||(n=(e=this.getAddress(n)).address,t=e.isCol),ee.isNullOrUndefined(i)||(i=(e=this.getAddress(i)).address,r=e.isCol);var t,r,n,i,e=!0===t&&!0===r;return{startIdx:e?R(n.toUpperCase()):parseInt(n,10),endIdx:e?R(i.toUpperCase()):parseInt(i,10),isCol:e}},c.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}},c.prototype.addHyperlink=function(e,t,r){this.insertHyperlink(e,t,r,!0)},c.prototype.removeHyperlink=function(e){this.notify(ca,{range:e,preventEventTrigger:!0})},c.prototype.insertHyperlink=function(e,t,r,n){if(this.allowHyperlink){var i,o=void 0,a=this.getActiveSheet();if(Xd(this,i=te(t=t||a.name+"!"+a.activeCell)))this.notify(qa,null);else{for(var s=this.getCell(i[0],i[1]),l=[],h=0;s&&h<s.classList.length;h++)l.push(s.classList[h]);var d={hyperlink:e,address:t,displayText:r,cancel:!1},p={hyperlink:e,address:t,displayText:r};if(n||(this.trigger(Zt,d),this.notify(gt,{action:"hyperlink",eventArgs:d})),!d.cancel){if(this.notify(tr,{hyperlink:e=d.hyperlink,cell:t=d.address,displayText:r,triggerEvt:!n}),t&&-1!==t.lastIndexOf("!")){for(var e=t.lastIndexOf("!"),c=t.substring(0,e),u=this.sheets,f=0;f<u.length;f++)u[f].name===c&&(o=f);a=this.sheets[o],t=t.substring(e+1)}if(a&&(i=te(t=t||this.getActiveSheet().activeCell),n||(this.trigger(Jt,p),this.notify(le,{action:"hyperlink",eventArgs:d})),a===this.getActiveSheet())){this.serviceLocator.getService("cell").refreshRange(i,!1,!1,!1,!0,Jn(this));for(h=0;h<l.length;h++)this.getCell(i[0],i[1]).classList.contains(l[h])||this.getCell(i[0],i[1]).classList.add(l[h]);this.notify(qr,null)}}}}},c.prototype.addDataValidation=function(e,t){Gc.prototype.addDataValidation.call(this,e,t)},c.prototype.removeDataValidation=function(e){this.notify(pr,{range:e,isRemoveValidation:!0,viewport:this.viewport})},c.prototype.addInvalidHighlight=function(e){e=e||this.dataValidationRange;if(-1<e.indexOf(","))for(var t="",r=(e.includes("!")&&(t=e.substring(0,e.lastIndexOf("!"))+"!",e=e.substring(e.lastIndexOf("!")+1)),e.split(",")),n=0;n<r.length-1;n++)Gc.prototype.addInvalidHighlight.call(this,t+r[n]);else Gc.prototype.addInvalidHighlight.call(this,e)},c.prototype.removeInvalidHighlight=function(e){e=e||this.dataValidationRange;if(-1<e.indexOf(","))for(var t="",r=(e.includes("!")&&(t=e.substring(0,e.lastIndexOf("!"))+"!",e=e.substring(e.lastIndexOf("!")+1)),e.split(",")),n=0;n<r.length-1;n++)Gc.prototype.removeInvalidHighlight.call(this,t+r[n]);else Gc.prototype.removeInvalidHighlight.call(this,e)},c.prototype.conditionalFormat=function(e){Gc.prototype.conditionalFormat.call(this,e)},c.prototype.clearConditionalFormat=function(e){e=e||this.getActiveSheet().selectedRange,Gc.prototype.clearConditionalFormat.call(this,e)},c.prototype.setPanelSize=function(){var e;"auto"!==this.height&&((e=document.getElementById(this.element.id+"_sheet_panel")).style.height=this.element.getBoundingClientRect().height*this.viewport.scaleY-ed(e,null,this.viewport.scaleY)+"px")},c.prototype.open=function(e){this.isOpen=!0,Gc.prototype.open.call(this,e),this.isOpen&&this.showSpinner()},c.prototype.hideRow=function(e,t,r){void 0===t&&(t=e),void 0===r&&(r=!0),this.renderModule?this.notify(Pr,{startIndex:e,endIndex:t,hide:r}):Gc.prototype.hideRow.call(this,e,t,r)},c.prototype.hideColumn=function(e,t,r){void 0===t&&(t=e),void 0===r&&(r=!0),this.renderModule?this.notify(Pr,{startIndex:e,endIndex:t,hide:r,isCol:!0}):Gc.prototype.hideColumn.call(this,e,t,r)},c.prototype.clear=function(e){this.notify(rs,{options:e})},c.prototype.refresh=function(e){var t,r=this;this.isReact&&this.clearTemplate(),e?(this.notify(Ao,null),this.sheets.length=0,this.sheetNameCount=1,this.notify(Ht,{}),this.notify(ba,null),this.createSheet(),this.activeSheetIndex=this.sheets.length-1,this.notify(Qi,null),this.notify(ie,{action:"initSheetInfo"}),this.renderModule.refreshSheet()):this.createdHandler?(t=function(){r.off(za,t),r.refresh()},this.on(za,t,this)):(this.notify(Ko,{}),Gc.prototype.refresh.call(this))},c.prototype.insertImage=function(e,t){for(var r=0;r<e.length;r++)this.notify(gs,{options:e[r],range:t||this.getActiveSheet().selectedRange,isPublic:!0})},c.prototype.deleteImage=function(e,t){this.notify(ms,{id:e,range:t||this.getActiveSheet().selectedRange})},c.prototype.getRowHeaderContent=function(){return this.sheetModule.getRowHeaderPanel()},c.prototype.getColumnHeaderContent=function(){return this.sheetModule.getColHeaderPanel()},c.prototype.getMainContent=function(){return this.sheetModule.getContentPanel()},c.prototype.getSelectAllContent=function(){return this.sheetModule.getSelectAllContent()},c.prototype.getScrollElement=function(){return this.sheetModule.getScrollElement()},c.prototype.getContentTable=function(){return this.sheetModule.getContentTable()},c.prototype.getRowHeaderTable=function(){return this.sheetModule.getRowHeaderTable()},c.prototype.getColHeaderTable=function(){return this.sheetModule.getColHeaderTable()},c.prototype.getThreshold=function(e){e=Math.round((this.viewport[e+"Count"]+1)/2);return e<15?15:e},c.prototype.isMobileView=function(){return!ee.isNullOrUndefined(this.cssClass)&&(-1<this.cssClass.indexOf("e-mobile-view")||ee.Browser.isDevice)&&-1===this.cssClass.indexOf("e-desktop-view")&&!1},c.prototype.getValueRowCol=function(e,t,r,n,i,o,a){return Gc.prototype.getValueRowCol.call(this,e,t,r,n,i,o,a)},c.prototype.updateCell=function(e,t,r){ee.isNullOrUndefined(r)&&(r=!0),this.updateCellInfo(e,t,r)},c.prototype.updateCellInfo=function(e,t,r,n,i){t=t||this.getActiveSheet().activeCell,Xd(this,te(t))||Gc.prototype.updateCellDetails.call(this,e,t,n,i,r)},c.prototype.getRowData=function(e,t){return Gc.prototype.getRowData.call(this,e,t)},c.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;0<=i;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}),Gc.prototype.sort.call(this,e,t,n).then(function(e){return r.notify($t,e),Promise.resolve(e)})},c.prototype.setValueRowCol=function(e,t,r,n,i,o){if(this.isEdit||"#CIRCULARREF!"!==t||(a={action:"isCircularReference",argValue:t,address:(s=ae(this,Ii(this,e))).name+"!"+ue(n)+r},this.notify(oo,a),t=a.argValue),Gc.prototype.setValueRowCol.call(this,e,t,r,n,i,o),this.allowEditing)this.notify(io,{action:"refreshDependentCellValue",rowIdx:r,colIdx:n,sheetIdx:Ii(this,e)});else{var a=Ii(this,e);if(r--,n--,this.activeSheetIndex===a){var s,t=void 0;if(t=he(s=ae(this,a),r)||pe(s,n)?t:this.getCell(r,n)){if(t.parentElement){i=t.parentElement.getAttribute("aria-rowindex");if(i&&Number(i)-1!==r)return}o=se(r,n,s),e={value:o.value,format:o.format,onLoad:!0,formattedText:o.value,isRightAlign:!1,type:"General",cell:o,rowIndex:r,colIndex:n,isRowFill:!1};this.notify(St,e),this.refreshNode(t,e)}}}},c.prototype.getModuleName=function(){return"spreadsheet"},c.prototype.calculateNow=function(e,t){return Gc.prototype.calculateNow.call(this,e,t)},c.prototype.refreshNode=function(e,t){var r;if(e){if(t){t.result=ee.isNullOrUndefined(t.formattedText)?ee.isNullOrUndefined(t.result)?"":t.result:t.formattedText.toString(),!t.isRowFill&&((l=e.querySelector(".e-fill-before"))&&ee.detach(l),(l=ee.select(".e-fill",e))&&(ee.detach(l),e.style.display="table-cell"),l=ee.select(".e-fill-sec",e))&&ee.detach(l);var n,i,o,a,s,l=ee.select("#"+this.element.id+"_currency",e);if(l&&ee.detach(l),"Accounting"===t.type&&oe(t.value)&&t.result.includes(t.curSymbol))return n=i=l=void 0,i=t.result.trim().endsWith(t.curSymbol)?t.result:(l=t.result.includes(" "+t.curSymbol)?" "+t.curSymbol:t.curSymbol,t.result.split(l).join("")),h=e.querySelector(".e-databar-value"),s=e.querySelector(".e-iconsetspan"),a=void 0,0<(o=e).children.length&&-1<e.children[e.childElementCount-1].className.indexOf("e-addNoteIndicator")&&(a=document.getElementsByClassName("e-addNoteIndicator")[0]),h?(this.refreshNode(h,{result:i}),o=e.querySelector(".e-cf-databar")||e):e.querySelector("a")?e.querySelector("a").textContent=i:(n=!0,e.innerText=""),s&&e.insertBefore(s,e.firstElementChild),l&&((h=this.createElement("span",{id:this.element.id+"_currency",styles:"float: left"})).innerText=l,o.appendChild(h),ee.isNullOrUndefined(a)||o.appendChild(a)),n&&(e.innerHTML+=i),void e.classList.add("e-right-align");s=void 0,!t.result||"true"!==t.result.toLowerCase()&&"false"!==t.result.toLowerCase()?s="e-right-align":(t.result=t.result.toUpperCase(),s="e-center-align",t.isRightAlign=!0),r=t.result,this.allowWrap||r.toString().includes("\n")&&(r=r.replace(/\n/g,"")),t.isRightAlign?e.classList.add(s):e.classList.remove(s)}r=ee.isNullOrUndefined(r)?"":r,ee.isNullOrUndefined(t.rowIndex)||ee.isNullOrUndefined(t.colIndex)||ee.attributes(e,{"aria-label":(r?r+" ":"")+G(t.rowIndex,t.colIndex)});var h,d=e.lastChild,l=(d&&"SPAN"===d.nodeName&&d.classList.contains("e-iconsetspan")&&(d=null),e.querySelector(".e-databar-value")&&(d=e.querySelector(".e-databar-value").lastChild),e.querySelector(".e-hyperlink")&&(d=e.querySelector(".e-hyperlink").lastChild),e.querySelector(".e-addNoteIndicator")&&(d=e.firstChild),e.querySelector(".e-wrap-content"));l&&(l.lastChild||l.appendChild(document.createTextNode("")),d=l.lastChild),(this.isAngular||this.isVue)&&e.classList.contains("e-cell-template")&&d&&(8===d.nodeType||3===d.nodeType)?3!==d.nodeType&&""===r||(h=function(){e.childElementCount||(3===d.nodeType?t.isRowFill||(d.nodeValue=r):e.appendChild(document.createTextNode(r)))},this.isAngular?Xh(h):h()):!d||3!==d.nodeType&&1!==d.nodeType?e.appendChild(document.createTextNode(r)):t.isRowFill||(!ee.isNullOrUndefined(d.className)&&-1<d.className.indexOf("e-addNoteIndicator")?(d=e.lastChild).nodeValue=r:d.nodeValue=r)}},c.prototype.calculateHeight=function(e,t,r){void 0===t&&(t=1),void 0===r&&(r=1);var n=e&&e.fontSize||this.cellStyle.fontSize,e="Arial Black"===e.fontFamily?1.44:1.24;return(-1<n.indexOf("pt")?1.33*parseInt(n,10):parseInt(n,10))*e*t+r*e},c.prototype.skipHidden=function(e,t,r,n){void 0===r&&(r="rows"),void 0===n&&(n=this.scrollSettings.isFinite);var i,o=this.getActiveSheet();this.scrollSettings.isFinite&&(i=("rows"===r?o.rowCount:o.colCount)-1);for(var a=e;a<=t;a++)if(o[""+r][a]&&o[""+r][a].hidden){if(e===a&&e++,t++,n&&i<t){t=i;break}}else if(!n&&this.scrollSettings.isFinite&&i<t&&o[""+r][a-1]&&o[""+r][a-1].hidden){t--;break}return[e,t]},c.prototype.updateActiveBorder=function(e,t){t=ee.select((t=void 0===t?".e-ribbon":t)+" .e-tab-header .e-indicator",this.element);t.style.display="none",ee.setStyleAttribute(t,{left:"",right:""}),ee.setStyleAttribute(t,{left:e.offsetLeft+"px",right:e.parentElement.offsetWidth-(e.offsetLeft+e.offsetWidth)+"px"}),t.style.display=""},c.prototype.undo=function(){this.notify(ma,{isUndo:!0,isPublic:!0})},c.prototype.redo=function(){this.notify(ma,{isUndo:!1,isPublic:!0})},c.prototype.updateUndoRedoCollection=function(e){this.notify(va,{args:e,isPublic:!0})},c.prototype.addDefinedName=function(e){e={action:"addDefinedName",isAdded:!1,definedName:e};return this.notify(oo,e),e.isAdded},c.prototype.removeDefinedName=function(e,t){return Gc.prototype.removeDefinedName.call(this,e,t)},c.prototype.mouseClickHandler=function(e){this.notify(so,e)},c.prototype.mouseDownHandler=function(e){this.notify(ro,e)},c.prototype.keyUpHandler=function(e){ee.closest(e.target,".e-find-dlg")?this.notify(yr,e):this.notify(lo,e)},c.prototype.keyDownHandler=function(e){var t,r,n=ee.closest(e.target,".e-findtool-dlg");n?9===e.keyCode&&(t=e.target,e.shiftKey?t.classList.contains("e-text-findNext-short")&&(r=n.querySelector(".e-findRib-close .e-tbar-btn"))&&(e.preventDefault(),r.focus()):t.classList.contains("e-tbar-btn")&&t.parentElement.classList.contains("e-findRib-close")&&ce(n)):(this.notify(ho,e),r=ee.closest(e.target,".e-dialog"),this.enableKeyboardNavigation||!document.activeElement.classList.contains("e-cell")&&!r||-1<[38,40,33,34,35,36,9].indexOf(e.keyCode)&&e.preventDefault())},c.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(gt,{eventArgs:t,action:"freezePanes"}),t.cancel)return}this.on(to,this.freezePaneUpdated,this),this.freezePanes(e.row,e.column),this.notify(qr,null)}},c.prototype.freezePaneUpdated=function(){this.off(to,this.freezePaneUpdated);var e=this.getActiveSheet();ce(this.element),this.notify(le,{eventArgs:{row:e.frozenRows,column:e.frozenColumns,sheetIndex:this.activeSheetIndex},action:"freezePanes"})},c.prototype.wireEvents=function(){ee.EventHandler.add(this.element,"click",this.mouseClickHandler,this),ee.EventHandler.add(this.element,ld(),this.mouseDownHandler,this),ee.EventHandler.add(this.element,"keyup",this.keyUpHandler,this),ee.EventHandler.add(this.element,"keydown",this.keyDownHandler,this),this.on(Us,this.freeze,this),this.on(pn,this.refreshInsertDelete,this)},c.prototype.destroy=function(){this.isReact&&this.clearTemplate(),this.unwireEvents(),this.notify(no,null),Gc.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()},c.prototype.unwireEvents=function(){ee.EventHandler.remove(this.element,"click",this.mouseClickHandler),ee.EventHandler.remove(this.element,ld(),this.mouseDownHandler),ee.EventHandler.remove(this.element,"keyup",this.keyUpHandler),ee.EventHandler.remove(this.element,"keydown",this.keyDownHandler),this.off(Us,this.freeze),this.off(pn,this.refreshInsertDelete)},c.prototype.refreshInsertDelete=function(t){var r,n=this;"Sheet"!==t.modelType&&(t.sheet.ranges.forEach(function(e){e.template&&e.address&&(r=te(e.address),n.updateRangeOnInsertDelete(t,r))&&(e.address=re(r))}),this.setSheetPropertyOnMute(t.sheet,"ranges",t.sheet.ranges))},c.prototype.addContextMenuItems=function(e,t,r,n){this.notify(Lo,{items:e,text:t,insertAfter:r=void 0===r?!0:r,isUniqueId:n})},c.prototype.removeContextMenuItems=function(e,t){this.notify(Po,{items:e,isUniqueId:t})},c.prototype.enableContextMenuItems=function(e,t,r){this.notify(Mo,{items:e,enable:t=void 0===t?!0:t,isUniqueId:r})},c.prototype.enableFileMenuItems=function(e,t,r){this.notify(Bo,{items:e,enable:t=void 0===t?!0:t,isUniqueId:r})},c.prototype.hideFileMenuItems=function(e,t,r){this.notify(Uo,{items:e,hide:t=void 0===t?!0:t,isUniqueId:r})},c.prototype.addFileMenuItems=function(e,t,r,n){this.notify(Ho,{items:e,text:t,insertAfter:r=void 0===r?!0:r,isUniqueId:n})},c.prototype.hideRibbonTabs=function(e,t){this.notify(Vo,{tabs:e,hide:t=void 0===t?!0:t})},c.prototype.enableRibbonTabs=function(e,t){this.notify(jo,{tabs:e,enable:t=void 0===t?!0:t})},c.prototype.addRibbonTabs=function(e,t){this.notify(zo,{items:e,insertBefore:t})},c.prototype.enableToolbarItems=function(e,t,r){this.notify(Io,[{tab:e,items:t,enable:void 0===r||r}])},c.prototype.hideToolbarItems=function(e,t,r){this.notify(qo,{tab:e,indexes:t,hide:r=void 0===r?!0:r})},c.prototype.addToolbarItems=function(e,t,r){this.notify(_o,{tab:e,items:t,index:r})},c.prototype.selectRange=function(e){this.isEdit&&this.notify(io,{action:"endEdit"}),this.notify(No,{address:e})},c.prototype.selectChart=function(e){this.selectOverlay(e,!0)},c.prototype.selectImage=function(e){this.selectOverlay(e)},c.prototype.selectOverlay=function(e,t){var r,n,i=this.getActiveSheet();!i.isProtected&&this.allowEditing&&(e||(n=se((n=W(i.activeCell))[0],n[1],i,!1,!0),t?n.chart&&n.chart.length&&(e=n.chart[n.chart.length-1].id):n.image&&n.image.length&&(e=n.image[n.image.length-1].id)),e?(r=this.element.querySelector("#"+e)).classList.contains("e-ss-overlay")||(r=r.parentElement):r=this.element.querySelector(".e-ss-overlay"+(t?".e-datavisualization-chart":":not(.e-datavisualization-chart)")),r)&&(i=void 0,(n=this.element.getElementsByClassName("e-ss-overlay-active")[0])&&(n.classList.remove("e-ss-overlay-active"),i=n.classList.contains("e-datavisualization-chart"))&&this.notify(ws,null),r.classList.add("e-ss-overlay-active"),r.classList.contains("e-datavisualization-chart")?(this.notify(Xr,{id:r.id}),i||this.notify(Ns,{id:r.id})):i&&this.notify(Rs,null))},c.prototype.deselectChart=function(){this.notify(ps,{selector:".e-datavisualization-chart"})},c.prototype.deselectImage=function(){this.notify(ps,{selector:":not(.e-datavisualization-chart)"})},c.prototype.startEdit=function(){this.notify(io,{action:"startEdit",isNewValueEdit:!1})},c.prototype.closeEdit=function(){this.notify(io,{action:"cancelEdit"})},c.prototype.endEdit=function(){this.notify(io,{action:"endEdit",isPublic:!0})},c.prototype.print=function(e){void 0===e&&(e={type:"ActiveSheet",allowRowColumnHeader:!1,allowGridLines:!1}),this.allowPrint&&!ee.isNullOrUndefined(this.printModule)&&this.printModule.print(this,e)},c.prototype.onPropertyChanged=function(c,u){var f,g=this;Gc.prototype.onPropertyChanged.call(this,c,u);for(var e=0,t=Object.keys(c);e<t.length;e++){var r,n,i=t[e],o=void 0,a=void 0,s=this.getActiveSheet(),l=this.getScrollElement();switch(i){case"enableRtl":if(!c.locale&&!c.currencyCode&&(o=(o=this.getColumnHeaderContent())&&o.parentElement)){if(c.enableRtl?(o.style.marginRight="",document.getElementById(this.element.id+"_sheet_panel").classList.add("e-rtl")):(o.style.marginLeft="",document.getElementById(this.element.id+"_sheet_panel").classList.remove("e-rtl")),this.allowScrolling&&this.scrollModule.setPadding(!0),this.allowAutoFill&&(r=this.element.querySelector(".e-dragfill-ddb"))&&(r=ee.getComponent(r,"dropdown-btn"))&&(r.enableRtl=c.enableRtl,r.dataBind()),this.sheetModule.setPanelWidth(s,this.getRowHeaderContent(),!0),this.allowImage||this.allowChart)for(var h,d=this.element.getElementsByClassName("e-ss-overlay"),p=void 0,m=void 0,v=0,y=d.length-1;v<=y;v++)(m=d[0]).classList.contains("e-datavisualization-chart")&&(p=(h=m.querySelector(".e-accumulationchart"))?ee.getComponent(h,"accumulationchart"):(h=m.querySelector(".e-chart"))&&ee.getComponent(h,"chart"))&&p.destroy(),ee.detach(m),v===y&&this.notify(hn,{});l&&(l.scrollLeft=0),this.selectRange(s.selectedRange)}break;case"cssClass":u.cssClass&&ee.removeClass([this.element],u.cssClass.split(" ")),c.cssClass&&ee.addClass([this.element],c.cssClass.split(" "));break;case"activeSheetIndex":this.renderModule.refreshSheet(),this.notify($o,{idx:c.activeSheetIndex});break;case"width":this.setWidth(),this.resize();break;case"height":this.setHeight(),this.resize();break;case"showRibbon":this.notify($i,{prop:"showRibbon",onPropertyChange:!0});break;case"showFormulaBar":this.notify(Zi,{uiUpdate:!0});break;case"showSheetTabs":this.notify(Ji,null);break;case"cellStyle":this.renderModule.refreshSheet();break;case"allowEditing":this.allowEditing?(this.notify(io,{action:"renderEditor"}),this.enableKeyboardNavigation&&(this.enableKeyboardNavigation=!1,this.dataBind(),this.enableKeyboardNavigation=!0,this.dataBind(),"None"!==(r=this.selectionSettings.mode))&&(this.selectionSettings.mode="None",this.dataBind(),this.selectionSettings.mode=r,this.dataBind())):this.notify(ps,null);break;case"allowInsert":(a=this.element.getElementsByClassName("e-add-sheet-tab")[0])&&(a.disabled=!this.allowInsert,this.allowInsert?a.classList.contains("e-disabled")&&a.classList.remove("e-disabled"):a.classList.contains("e-disabled")||a.classList.add("e-disabled"));break;case"sheets":c.sheets===this.sheets?(this.renderModule.refreshSheet(),this.notify(Qi,null),this.notify(ie,{action:"initSheetInfo"})):Object.keys(c.sheets).forEach(function(e,t){var r,n,i,o,a,s,l,h=Number(e),d=c.sheets[h],p=ae(g,h);d.ranges&&Object.keys(d.ranges).length?((e=Object.keys(d.ranges)).forEach(function(e,t){d.ranges[Number(e)].info||(r=t)}),e.forEach(function(e,t){(ee.isUndefined(r)||r===t)&&(n=Number(e),i=d.ranges[n],o=p.ranges[n],a=i.dataSource,a=i.fieldsOrder&&o.info&&!a&&o.dataSource?o.dataSource:a)&&g.notify(dt,{sheetIdx:h,rangeIdx:n,changedData:a})})):d.paneTopLeftCell&&u.sheets&&u.sheets[""+h]&&u.sheets[""+h].paneTopLeftCell?g.activeSheetIndex===Number(h)&&(e=W(d.paneTopLeftCell),s=W(u.sheets[""+h].paneTopLeftCell),e[0]!==s[0]&&(l=g.frozenRowCount(g.getActiveSheet()),l=e[0]>l?Ah(g.getActiveSheet(),l,e[0]-1):0,g.notify(Vs,{top:l})),e[1]!==s[1])&&(l=g.frozenColCount(g.getActiveSheet()),s=e[1]>l?Uh(g.getActiveSheet(),l,e[1]-1):0,g.notify(Vs,{left:s})):(0===t&&g.renderModule.refreshSheet(),g.showSheetTabs&&d.name&&!f&&(l=ee.select(".e-sheet-tabs-items",g.element),e=Number(h),l.children[e+1]?g.notify(fa,{items:l,value:d.name,idx:e}):(g.notify(Qi,null),f=!0)))});break;case"locale":this.refresh();break;case"currencyCode":c.locale||this.refresh();break;case"password":0<this.password.length&&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":this.isProtected&&(n=this.element.getElementsByClassName("e-add-sheet-tab")[0])&&(n.disabled=this.isProtected,this.isProtected?n.classList.contains("e-disabled")&&n.classList.add("e-disabled"):n.classList.contains("e-disabled")||n.classList.remove("e-disabled"));break;case"allowFreezePane":this.notify($i,{prop:"allowFreezePane",onPropertyChange:!0});break;case"allowImage":case"allowChart":this.renderModule.refreshSheet(),this.notify($i,{prop:i,onPropertyChange:!0});break;case"calculationMode":"Manual"===u.calculationMode&&this.notify(ie,{action:"ClearDependentCellCollection"}),this.notify($i,{prop:i,onPropertyChange:!0});break;case"allowResizing":c.allowResizing&&this.notify(el,{propertyName:i});break;case"enableNotes":c.enableNotes&&this.notify(hn,{});break;case"allowNumberFormatting":case"allowWrap":case"allowCellFormatting":this.notify($i,{prop:i,onPropertyChange:!0}),this.notify(hn,{});break;case"showAggregate":this.notify(Ja,{remove:!this.showAggregate})}}},c.prototype.requiredModules=function(){return Vh(this)},c.prototype.appendTo=function(e){Gc.prototype.appendTo.call(this,e)},c.prototype.filter=function(e,t){return this.allowFiltering?(t=t||this.getActiveSheet().selectedRange,Gc.prototype.filter.call(this,e,t)):Promise.reject()},c.prototype.clearFilter=function(e,t){this.notify(Ra,{field:e,sheetIndex:t})},c.prototype.applyFilter=function(e,t){var r,n,i,o=this;return this.allowFiltering?(r=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},o.notify(k.fltrPrevent,n),e.value=n.arg3}),i=t?N(this,t):this.activeSheetIndex,this.notify(xa,e={predicates:e,range:t,isInternal:!0,promise:r,sIdx:i}),e.promise):Promise.reject()},c.prototype.addCustomFunction=function(e,t,r){Gc.prototype.addCustomFunction.call(this,e,t,r),this.notify(Ta,null)},c.prototype.setRangeReadOnly=function(e,t,r){t=t||this.getActiveSheet().selectedRange;var r=r||this.activeSheetIndex,n=ne(te(t)),i=ae(this,r);if(!ee.isNullOrUndefined(i)){if(this.notify("actionBegin",{action:"readonly",eventArgs:{readOnly:e,range:t,sheetIdx:r}}),this.isColumnRange(t)||0===n[0]&&n[2]===i.rowCount-1)for(var o,a=n[1];a<=n[3];a++)e?Mh(i,a,{isReadOnly:e}):(o=de(i,a))&&o.isReadOnly&&delete o.isReadOnly;else if(this.isRowRange(t)||0===n[1]&&n[3]===i.colCount-1)for(var s,l=n[0];l<=n[2];l++)e?Rh(i,l,{isReadOnly:e}):(s=Nh(i,l))&&s.isReadOnly&&delete s.isReadOnly;else for(var h=n[1];h<=n[3];h++)for(var d=n[0];d<=n[2];d++)e?Vi(d,h,i,{isReadOnly:e},!0):(u=se(d,h,i))&&u.isReadOnly&&delete u.isReadOnly;for(var p=n[1];p<=n[3];p++)for(var c=n[0];c<=n[2];c++){var u=this.getCell(c,p);!e&&u&&u.classList.contains("e-readonly")?u.classList.remove("e-readonly"):u&&!u.classList.contains("e-readonly")&&(u.className+=" e-readonly")}this.notify("actionComplete",{action:"readonly",eventArgs:{readOnly:e,range:t,sheetIdx:r}})}},c.prototype.isColumnRange=function(e){var t=!0;return Array.from(e).forEach(function(e){"A"<=e&&e<="Z"||"a"<=e&&e<="z"||":"===e||(t=!1)}),t},c.prototype.isRowRange=function(e){var t=!0;return Array.from(e).forEach(function(e){"0"<=e&&e<="9"||":"===e||(t=!1)}),t},pc([ee.Property("")],c.prototype,"cssClass",void 0),pc([ee.Property(!0)],c.prototype,"allowScrolling",void 0),pc([ee.Property(!0)],c.prototype,"allowResizing",void 0),pc([ee.Property(!0)],c.prototype,"showAggregate",void 0),pc([ee.Property(!0)],c.prototype,"enableClipboard",void 0),pc([ee.Property(!0)],c.prototype,"enableContextMenu",void 0),pc([ee.Property(!0)],c.prototype,"enableKeyboardNavigation",void 0),pc([ee.Property(!0)],c.prototype,"enableKeyboardShortcut",void 0),pc([ee.Property(!0)],c.prototype,"allowUndoRedo",void 0),pc([ee.Property(!0)],c.prototype,"allowWrap",void 0),pc([ee.Complex({},n)],c.prototype,"selectionSettings",void 0),pc([ee.Complex({},Jd)],c.prototype,"scrollSettings",void 0),pc([ee.Event()],c.prototype,"beforeCellRender",void 0),pc([ee.Event()],c.prototype,"beforeSelect",void 0),pc([ee.Event()],c.prototype,"select",void 0),pc([ee.Event()],c.prototype,"contextMenuBeforeOpen",void 0),pc([ee.Event()],c.prototype,"fileMenuBeforeOpen",void 0),pc([ee.Event()],c.prototype,"contextMenuBeforeClose",void 0),pc([ee.Event()],c.prototype,"dialogBeforeOpen",void 0),pc([ee.Event()],c.prototype,"fileMenuBeforeClose",void 0),pc([ee.Event()],c.prototype,"contextMenuItemSelect",void 0),pc([ee.Event()],c.prototype,"fileMenuItemSelect",void 0),pc([ee.Event()],c.prototype,"beforeDataBound",void 0),pc([ee.Event()],c.prototype,"dataBound",void 0),pc([ee.Event()],c.prototype,"dataSourceChanged",void 0),pc([ee.Event()],c.prototype,"cellEdit",void 0),pc([ee.Event()],c.prototype,"cellEditing",void 0),pc([ee.Event()],c.prototype,"cellEdited",void 0),pc([ee.Event()],c.prototype,"cellSave",void 0),pc([ee.Event()],c.prototype,"beforeCellSave",void 0),pc([ee.Event()],c.prototype,"created",void 0),pc([ee.Event()],c.prototype,"beforeSort",void 0),pc([ee.Event()],c.prototype,"beforeHyperlinkCreate",void 0),pc([ee.Event()],c.prototype,"afterHyperlinkCreate",void 0),pc([ee.Event()],c.prototype,"beforeHyperlinkClick",void 0),pc([ee.Event()],c.prototype,"afterHyperlinkClick",void 0),pc([ee.Event()],c.prototype,"beforeConditionalFormat",void 0),pc([ee.Event()],c.prototype,"actionBegin",void 0),pc([ee.Event()],c.prototype,"actionComplete",void 0),pc([ee.Event()],c.prototype,"openComplete",void 0),pc([ee.Event()],c.prototype,"sortComplete",void 0),pc([ee.Property("USD")],c.prototype,"currencyCode",void 0),Yc=pc([ee.NotifyPropertyChanges],c));function c(e,t){e=Gc.call(this,e)||this;return e.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},e.needsID=!0,Yc.Inject(xc,Sc,Nc,gp,fp,bp,Sp,cp,Xi,Fc,Tc,Oc,Lc,Ip,Ic,Pp,Xl,rl,ll,Gl,Ll,Tl,Mc,Ul,Np,Dp,Vl,Uc,Op,$l,Bp,Hp,Jl,eh,jp,rh,_c,_p,sh,Wp,oh,Yp,hh,Hc,Kp,zl,ph,jc,ql,Zp,uh,Qp),t&&e.appendTo(t),e}z.AutoFill=Zp,z.AutoFillSettings=V,z.Axis=Je,z.BasicFormulas=yl,z.Border=Ve,z.CalcSheetFamilyItem=kl,z.Calculate=El,z.CalculateCommon=t,z.Cell=Ui,z.CellFormat=Ip,z.CellRenderer=ap,z.CellStyle=j,z.Chart=tt,z.Clipboard=cp,z.Column=Lh,z.ConditionalFormat=Ae,z.ConditionalFormatting=Kp,z.ContextMenu=Tc,z.DISABLED="e-disabled",z.DataBind=Xi,z.DataLabelSettings=Be,z.DataValidation=jp,z.DefineName=me,z.Delete=Hp,z.Edit=fp,z.Filter=Uc,z.FilterCollection=X,z.FindAndReplace=Wp,z.Format=Fe,z.Formula=Ic,z.FormulaBar=Sc,z.FormulaError=Nl,z.FormulaInfo=Rl,z.Hyperlink=Se,z.Image=it,z.Insert=Bp,z.KeyboardNavigation=bp,z.KeyboardShortcut=Sp,z.LegendSettings=Le,z.MajorGridLines=Ge,z.MarkerSettings=_e,z.Merge=Yp,z.MinorGridLines=Ke,z.ModuleLoader=ml,z.NumberFormat=Lc,z.Open=Fc,z.OpenSettings=e,z.Parser=Cl,z.ProtectSettings=Ce,z.ProtectSheet=_p,z.Range=mi,z.Render=lp,z.Resize=Np,z.Ribbon=xc,z.Row=Ih,z.RowRenderer=ip,z.Save=Oc,z.Scroll=mp,z.ScrollSettings=Jd,z.Selection=gp,z.SelectionSettings=n,z.Sheet=Si,z.SheetRender=rp,z.SheetTabs=Nc,z.ShowHide=Fp,z.Sort=Mc,z.SortCollection=Z,z.Spreadsheet=wh,z.SpreadsheetChart=jc,z.SpreadsheetHyperlink=Op,z.SpreadsheetImage=Hc,z.SpreadsheetNote=Qp,z.UndoRedo=Dp,z.UsedRange=Ci,z.Validation=Ee,z.ValueChangedArgs=Al,z.VirtualScroll=yp,z.WRAPTEXT=jh,z.Workbook=Il,z.WorkbookAutoFill=uh,z.WorkbookCellFormat=Gl,z.WorkbookChart=ql,z.WorkbookConditionalFormat=ph,z.WorkbookDataValidation=rh,z.WorkbookDelete=eh,z.WorkbookEdit=Xl,z.WorkbookFilter=Vl,z.WorkbookFindAndReplace=oh,z.WorkbookFormula=Tl,z.WorkbookHyperlink=$l,z.WorkbookImage=zl,z.WorkbookInsert=Jl,z.WorkbookMerge=hh,z.WorkbookNumberFormat=Ll,z.WorkbookOpen=rl,z.WorkbookProtectSheet=sh,z.WorkbookSave=ll,z.WorkbookSort=Ul,z.WrapText=Pp,z.actionEvents=zh,z.activeCellChanged=Pt,z.activeCellMergedRange=Dr,z.activeSheetChanged=$o,z.addChartEle=ks,z.addContextMenuItems=Lo,z.addDPRValue=Gd,z.addFileMenuItems=Ho,z.addHighlight=cr,z.addHyperlink="addHyperlink",z.addListValidationDropdown=En,z.addNote=oa,z.addRibbonTabs=zo,z.addToolbarItems=_o,z.addressHandle=ss,z.afterHyperlinkClick=er,z.afterHyperlinkCreate=Jt,z.aggregateComputation=Vt,z.applyCF=Br,z.applyCellFormat=Ft,z.applyLockCells="applyLockCells",z.applyMerge=Ar,z.applyNumberFormatting=xt,z.applyPredicates=ei,z.applyProtect=Ma,z.applySort=Jo,z.autoFill="autoFill",z.autoFit=Qo,z.beforeCellUpdate=un,z.beforeCheckboxRender=$s,z.beforeContentLoaded=fo,z.beforeDataBound=Do,z.beforeDelete=Jr,z.beforeFilter="beforeFilter",z.beforeHyperlinkClick=Qt,z.beforeHyperlinkCreate=Zt,z.beforeInsert=Zr,z.beforeRibbonCreate=Wo,z.beforeSort=Yt,z.beforeVirtualContentLoaded=go,z.beginAction=gt,z.beginSave=ft,z.cMenuBeforeOpen=Co,z.calculateFormula=wt,z.cellNavigate=vo,z.cellValidation=pr,z.chartDesignTab=Fs,z.chartRangeSelection=Es,z.checkColumnValidation=Hh,z.checkDateFormat=At,z.checkFormulaRef=mn,z.checkIsFormula=Q,z.checkMerge=$a,z.checkNumberFormat=Tt,z.checkPrevMerge=Ka,z.checkRange=Xn,z.checkUniqueRange=_t,z.clear=Hr,z.clearAllFilter="clearAllFilter",z.clearCF=Vr,z.clearCFRule=Ur,z.clearCellRef=os,z.clearChartBorder=ws,z.clearCopy=Ao,z.clearFilter=Ra,z.clearFormulaDependentCells=Wt,z.clearInvalid="clearInvalid",z.clearRange=_d,z.clearUndoRedoCollection=ba,z.clearViewer=rs,z.click=so,z.colWidthChanged=Yo,z.collaborativeUpdate="collaborativeUpdate",z.columnIndex=Un,z.commputeFormulaValue=Cn,z.completeAction=le,z.configureLocalizedFormat=function(e,t,r){(r=void 0===r?!0:r)&&u&&(u.clear(),u=null),t&&t.length&&(u=u||new Map,t.forEach(function(e){u.set(e.id,e.code)})),e&&e.notify(wn,{action:"mapNumberFormatId"})},z.contentLoaded=to,z.contextMenuOpen="contextMenuOpen",z.convertToDefaultFormat=Bl,z.copy=ko,z.count=xr,z.createHyperlinkElement=ua,z.createImageElement=gs,z.createNoteIndicator=ha,z.created=ja,z.cut=Fo,z.dataBound=To,z.dataChanged=pt,z.dataSourceChanged=dt,z.dataValidate="dataValidate",z.dateToInt=oi,z.deInitProperties=Ko,z.defaultLocale=Yh,z.deleteAction=sr,z.deleteChart=vs,z.deleteChartColl=Yr,z.deleteFormatRange=Gn,z.deleteHyperlink=Qr,z.deleteImage=ms,z.deleteModel=hr,z.deleteNote=sa,z.destroyComponent=Ed,z.dialog=O,z.duplicateSheet=Pi,z.duplicateSheetFilterHandler=fn,z.editAlert=_a,z.editHyperlink=na,z.editNote=aa,z.editOperation=io,z.editValue=as,z.enableContextMenuItems=Mo,z.enableFileMenuItems=Bo,z.enableFormulaInput=Ga,z.enableRibbonTabs=jo,z.enableToolbarItems=Io,z.executeTaskAsync=x,z.exportDialog=yt,z.fillColor=Wh,z.filterByCellValue=Na,z.filterCellKeyDown=ka,z.filterComplete="filterComplete",z.filterRangeAlert=nr,z.find=ur,z.findAllValues=Nt,z.findCount="findCount",z.findDlg=Ha,z.findHandler=Va,z.findKeyUp=yr,z.findMaxValue=Fd,z.findToolDlg=vt,z.findWorkbookHandler="findHandler",z.focus=ce,z.focusBorder=Ss,z.focusChartBorder=Xr,z.focusRenameInput=uo,z.fontColor=qh,z.forRefSelRender=hs,z.formulaBar=Zi,z.formulaBarOperation=ao,z.formulaBarUpdate="formulaBarUpdate",z.formulaInValidation=Gt,z.formulaKeyUp="formulaKeyUp",z.formulaOperation=oo,z.freeze=Us,z.getAddressFromSelectedRange=C,z.getAddressInfo=E,z.getAlphalabel=Ol,z.getAutoDetectFormatParser=Qn,z.getBeforeActionData=Ca,z.getBorderHeight=Md,z.getBottomOffset=qd,z.getCell=se,z.getCellAddress=G,z.getCellIndexes=W,z.getCellPosition=nd,z.getCellRefValue=yn,z.getChartColIdxFromClientX=xn,z.getChartRowIdxFromClientY=bn,z.getChartsIndexes=Yd,z.getClientX=yd,z.getClientY=Cd,z.getColGroupWidth=$h,z.getColIdxFromClientX=fs,z.getColIndex=R,z.getColorCode=_i,z.getColumn=de,z.getColumnHeaderText=ue,z.getColumnWidth=Bh,z.getColumnsWidth=Uh,z.getCustomColors=qi,z.getDPRValue=Sd,z.getData=pi,z.getDataRange=qn,z.getEndEvent=dd,z.getExcludedColumnWidth=Bd,z.getFillInfo=nn,z.getFilterRange=Oa,z.getFilteredColumn=Fa,z.getFormatFromType=Pl,z.getFormattedBarText=Lt,z.getFormattedCellObject=St,z.getGcd=ni,z.getIndexesFromAddress=P,z.getLeadingSpaces=jn,z.getLineHeight=Dd,z.getLines=Pd,z.getMaxHgt=Vd,z.getMaxSheetId=Ai,z.getModel=function(e,t){var r,n,i;if(ee.isUndefined(e[t])||!e[t]||e[t].index!==t)for(var o=0;o<=t;o++)if(e&&e[o]){if(0<(r=e[o].index-o)){for(e.forEach(function(e,t){e&&e.index&&(i=e.index,n=1),e&&!e.index&&0!==t&&(e.index=i+n),n++});r--;)e.splice(o,0,null);o+=r}}else e?e[o]=null:e=[];return e[t]},z.getModules=ul,z.getMoveEvent=hd,z.getPageX=bd,z.getPageY=xd,z.getPassWord=Ds,z.getRangeAddress=re,z.getRangeFromAddress=y,z.getRangeIndexes=te,z.getRequiredModules=Vh,z.getRightIdx=Wd,z.getRow=Nh,z.getRowHeight=kh,z.getRowIdxFromClientY=us,z.getRowsHeight=Ah,z.getScrollBarWidth=Qh,z.getSelectedRange=Fi,z.getSheet=ae,z.getSheetIndex=B,z.getSheetIndexByName=Ni,z.getSheetIndexFromAddress=N,z.getSheetIndexFromId=Ii,z.getSheetName=Di,z.getSheetNameCount=Oi,z.getSheetNameFromAddress=Ei,z.getSheetProperties=function(e,t){var r,n,i,o,a=[],s=(t?((r=(s=Object.getPrototypeOf(new Ui(e,"cells",{},!0)).constructor.prototype.propList).colPropNames.concat(s.complexPropNames).concat(s.propNames)).push("formattedText"),n=(s=Object.getPrototypeOf(new Ih(e,"rows",{},!0)).constructor.prototype.propList).colPropNames.concat(s.complexPropNames).concat(s.propNames),i=(s=Object.getPrototypeOf(new Lh(e,"columns",{},!0)).constructor.prototype.propList).colPropNames.concat(s.complexPropNames).concat(s.propNames),(s=(s=Object.getPrototypeOf(new Si(e,"sheets",{},!0)).constructor.prototype.propList).colPropNames.concat(s.complexPropNames).concat(s.propNames)).splice(s.indexOf("rows"),1),s.splice(s.indexOf("columns"),1),s.splice(s.indexOf("cells"),1),n.splice(n.indexOf("cells"),1),a.push.apply(a,s),-1===t.indexOf("rows")&&a.push.apply(a,n),-1===t.indexOf("columns")&&a.push.apply(a,i),-1===t.indexOf("cells")&&a.push.apply(a,r),t.forEach(function(e){o=a.indexOf(e),-1<a.indexOf(e)&&a.splice(o,1)})):a.push("ranges"),{skipProps:a});return e.notify("getStringifyObject",s),s.model},z.getSiblingsHeight=ed,z.getSingleSelectedRange=ki,z.getSkeletonVal=pl,z.getSplittedAddressForColumn=Pn,z.getStandardHeight=function(e,t){return e.sheets[t].standardHeight},z.getStartEvent=ld,z.getSwapRange=ne,z.getTextHeight=Td,z.getTextHeightWithBorder=Ud,z.getTextSpace=sn,z.getTextWidth=Ld,z.getTrailingSpaces=zn,z.getTypeFromFormat=Ml,z.getUniqueRange=jt,z.getUpdateUsingRaf=Xh,z.getUpdatedFormula=Vn,z.getUpdatedFormulaOnInsertDelete=cn,z.getUpdatedScrollPosition=Xs,z.getValue=fl,z.getValueFromFormat=ci,z.getViewportIndexes=$n,z.getWorkbookRequiredModules=L,z.getautofillDDB=on,z.goToSheet=Qa,z.goto=fr,z.gotoDlg=Ua,z.hasTemplate=Od,z.hiddenMerge=Xa,z.hideAutoFillElement=Ws,z.hideAutoFillOptions=zs,z.hideFileMenuItems=Uo,z.hideRibbonTabs=Vo,z.hideSheet=ga,z.hideShow=Pr,z.hideToolbarItems=qo,z.importProtectWorkbook=Ms,z.inRange=Tn,z.inView=rd,z.initSheet=Ti,z.initiateChart=_r,z.initiateChartModel="initiateChartModel",z.initiateCur=is,z.initiateCustomSort=Zo,z.initiateDataValidation=Da,z.initiateEdit=ls,z.initiateFilter=rr,z.initiateFilterUI=xa,z.initiateFormulaReference=ns,z.initiateHyperlink=ra,z.initiateSort=Xt,z.initiatelink="initiatelink",z.insert=ar,z.insertChart=Is,z.insertDesignChart=Ns,z.insertFormatRange=Wn,z.insertImage=ds,z.insertMerge=Lr,z.insertModel=lr,z.insertSheetTab=bo,z.intToDate=ii,z.invalidData=La,z.isCellReference=Fn,z.isChar=kn,z.isColumnSelected=An,z.isCustomDateTime=Wi,z.isDateTime=ai,z.isDiscontinuousRange=zd,z.isExternalFileLink=cl,z.isFilterHidden=Fh,z.isFormulaBarEdit=eo,z.isHeightCheckNeeded=Hn,z.isHiddenCol=pe,z.isHiddenRow=he,z.isImported=Jn,z.isInMultipleRange=Dn,z.isInRange=Ln,z.isLocked=Mn,z.isLockedCells=jd,z.isMouseDown=fd,z.isMouseMove=gd,z.isMouseUp=md,z.isNavigationKey=vd,z.isNumber=oe,z.isReadOnly=ti,z.isReadOnlyCells=Xd,z.isRowSelected=On,z.isSingleCell=fe,z.isTouchEnd=ud,z.isTouchMove=cd,z.isTouchStart=pd,z.isUndefined=function(e){return void 0===e},z.isValidCellReference=Bn,z.isValidation=dr,z.keyCodes=Gh,z.keyDown=ho,z.keyUp=lo,z.locale=T,z.localeData=di,z.localizedFormatAction=wn,z.locateElem=ad,z.mergedRange=Tr,z.mouseDown=ro,z.mouseUpAfterSelection=yo,z.moveOrDuplicateSheet=en,z.moveSheet=Li,z.moveSheetHandler=In,z.onContentScroll=Xo,z.onHorizontalScroll=co,z.onSave=or,z.onVerticalScroll=po,z.openFailure=Bt,z.openHyperlink=ia,z.openSuccess=Mt,z.overlay=_h,z.overlayEleSize=Hs,z.parseDecimalNumber=Dt,z.parseFormulaArgument=vn,z.parseIntValue=li,z.parseLocaleNumber=Kn,z.paste=Oo,z.performAutoFill=_s,z.performUndoRedo=ma,z.positionAutoFillElement=js,z.processIdx=ui,z.propertyChange=el,z.protectCellFormat=Ba,z.protectSelection=Ya,z.protectSheet=Pa,z.protectSheetWorkBook=Sr,z.protectWorkbook=As,z.protectsheetHandler=Ir,z.queryCellInfo=br,z.rangeSelectionByKeydown=Ro,z.reApplyFormula=qt,z.readonlyAlert=qa,z.reapplyFilter=Ea,z.refreshCell=rn,z.refreshCellElement=It,z.refreshChart=Wr,z.refreshChartCellModel=Cs,z.refreshChartCellObj=ys,z.refreshChartCellOnInit=Sn,z.refreshChartSize=Gr,z.refreshCheckbox=Zs,z.refreshClipboard=ln,z.refreshFilterCellsOnResize=ea,z.refreshFilterRange=wa,z.refreshFormulaDatasource=Ta,z.refreshImagePosition=bs,z.refreshImgCellObj=cs,z.refreshInsertDelete=pn,z.refreshOverlayElem=ps,z.refreshRibbon="ribbonRefresh",z.refreshRibbonIcons=qr,z.refreshSheetTabs=Qi,z.removeAllChildren=Kh,z.removeContextMenuItems=Po,z.removeDataValidation=Za,z.removeDesignChart=Rs,z.removeElements=Kd,z.removeHighlight=Cr,z.removeHyperlink=ca,z.removeNoteContainer=pa,z.removeRangeEle=od,z.removeSheetTab=xo,z.removeUniquecol=zt,z.removeWorkbookProtection=Ps,z.renameSheetTab=So,z.renderCFDlg=ts,z.renderFilterCell=Sa,z.renderInsertDlg=Js,z.replace=gr,z.replaceAll=mr,z.replaceAllDialog=Er,z.ribbon=$i,z.ribbonClick=wo,z.rowFillHandler=an,z.rowHeightChanged=Go,z.saveCompleted=bt,z.saveError=Kr,z.selectAutoFillRange=qs,z.selectRange=No,z.selectionComplete=dn,z.selectionStatus=Bs,z.setActionData=ya,z.setAriaOptions=Id,z.setAutoFill=tn,z.setAutoFit=Aa,z.setCFRule=Mr,z.setCell=Vi,z.setCellFormat=Et,z.setChart=zr,z.setColMinWidth=function(e,t){e.renderModule.setSheetPanelSize(t)},z.setColumn=Mh,z.setFilteredCollection=Ct,z.setImage=jr,z.setLinkModel=tr,z.setLockCells=kr,z.setMaxHgt=Hd,z.setMerge=Or,z.setPosition=id,z.setProtectWorkbook=Ls,z.setResize=Nd,z.setRow=Rh,z.setRowEleHeight=Ad,z.setRowHeight=Oh,z.setStandardHeight=function(e,t,r){(t=e.sheets[t])&&(t.standardHeight=r,e.dataBind())},z.setStyleAttribute=sd,z.setTextLineHeight=function(e){Jh=e},z.setUndoRedo=Wa,z.setValue=gl,z.setVisibleMergeIndex=Zn,z.setWidthAndHeight=Rd,z.sheetCreated=Ut,z.sheetNameUpdate=fa,z.sheetTabs=Ji,z.sheetsDestroyed=Ht,z.showAggregate=Ja,z.showFindAlert=vr,z.showNote=la,z.showSheet=es,z.skipDefaultValue=ji,z.skipHiddenIdx=Y,z.sortComplete=$t,z.sortImport=mt,z.sortRangeAlert="sortRangeAlert",z.spreadsheetCreated=za,z.spreadsheetDestroyed=no,z.startEdit="startEdit",z.tabSwitch=Eo,z.textDecorationUpdate=Rt,z.toDate=si,z.toFraction=ri,z.toggleProtect=Qs,z.triggerDataChange=ct,z.unMerge=gn,z.unProtectSheetPassword=Gs,z.unProtectWorkbook=Ts,z.undoRedoForChartDesign=Os,z.unprotectSheet="unprotectSheet",z.unprotectsheetHandler=Nr,z.updateAction=kd,z.updateCFModel=Yn,z.updateCell=_n,z.updateNoteContainer=da,z.updateRowColCount=kt,z.updateScroll=Vs,z.updateScrollValue=Ks,z.updateSelectedRange=Ri,z.updateSheetFromDataSource=ht,z.updateSortCollection=Ia,z.updateSortedDataOnCell=Kt,z.updateTableWidth=xs,z.updateToggle=wr,z.updateToggleItem=ta,z.updateTranslate=Ys,z.updateUndoRedoCollection=va,z.updateUsedRange="updateUsedRange",z.updateView=hn,z.updateWrapCell=tl,z.validationError="validationError",z.validationHighlight=$r,z.virtualContentLoaded=mo,z.workBookeditAlert=Rr,z.workbookDestroyed=lt,z.workbookEditOperation=Ot,z.workbookFormulaOperation=ie,z.workbookLocale=hi,z.workbookOpen=ut,z.workbookReadonlyAlert=Fr,z.wrap=zi,z.wrapEvent=ir,Object.defineProperty(z,"__esModule",{value:!0})});
2
11
  //# sourceMappingURL=ej2-spreadsheet.umd.min.js.map