@syncfusion/ej2-spreadsheet 26.1.39-72217 → 26.1.40

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 : 26.1.40
4
+ * Copyright Syncfusion Inc. 2001 - 2023. 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,J,V,g,F,S,w,I,f,m,E,v){"use strict";function Q(e){var t,r,n=[];return e&&(e=-1===(e=-1<e.indexOf("!")?e.split("!")[1]:e).indexOf(":")?e+":"+e:e,new RegExp(/^(?=.*[a-zA-Z])(?=.*\d)/g).test(e)||(r=e.split(":"),e=J.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 le(t+1)+(e+1)}function ee(e){return G(e[0],e[1])+":"+(J.isNullOrUndefined(e[2])?G(e[0],e[1]):G(e[2],e[3]))}function le(e){return 1<e/26?le(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 y(e){return Q(C(e))}function C(e){return e.split("!")[1]||e}function b(e){return e.name+"!"+e.selectedRange}function x(e,t){return{sheetIndex:N(e,t),indices:y(t)}}function N(e,t){t=-1<t.indexOf("!")?B(e,xi(t)):e.activeSheetIndex;return t}function te(e){var t=e.slice();return e[0]>e[2]&&O(t,0,2),e[1]>e[3]&&O(t,1,3),t}function O(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function he(e){return e[0]===e[2]&&e[1]===e[3]}function T(e,t,r,n,i){return new D(e,t,r,n,i)}L.prototype.terminate=function(){this.worker.terminate(),URL.revokeObjectURL(this.workerUrl)},L.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.worker.postMessage(this.workerData)},L.prototype.messageFromWorker=function(e){this.terminate(),this.defaultListener.apply(this.context,[e.data])},L.prototype.onError=function(e){if(this.terminate(),!e.message||!e.message.includes("FormData"))throw e.message||e;this.defaultListener.apply(this.context,[{isFormDataError:!0}])},L.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"},L.prototype.getCallbackMessageFn=function(e){postMessage(this.workerTask.apply(this,e.data))},L.prototype.getMessageFn=function(e){this.workerTask.apply(this,e.data)};var D=L;function L(e,t,r,n,i){this.preventCallback=!1,this.context=e,this.workerTask=t,this.defaultListener=r,this.workerData=n,i&&(this.preventCallback=!0),this.initWorker()}function P(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,H,U=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,s=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;0<=a;a--)(i=e[a])&&(s=(o<3?i(s):3<o?i(t,r,s):i(t,r))||s);return 3<o&&s&&Object.defineProperty(t,r,s),s},_=(H=J.ChildProperty,U(q,H),e([J.Property("Calibri")],q.prototype,"fontFamily",void 0),e([J.Property("bottom")],q.prototype,"verticalAlign",void 0),e([J.Property("left")],q.prototype,"textAlign",void 0),e([J.Property("0pt")],q.prototype,"textIndent",void 0),e([J.Property("#000000")],q.prototype,"color",void 0),e([J.Property("#ffffff")],q.prototype,"backgroundColor",void 0),e([J.Property("normal")],q.prototype,"fontWeight",void 0),e([J.Property("normal")],q.prototype,"fontStyle",void 0),e([J.Property("11pt")],q.prototype,"fontSize",void 0),e([J.Property("none")],q.prototype,"textDecoration",void 0),e([J.Property("")],q.prototype,"border",void 0),e([J.Property("")],q.prototype,"borderTop",void 0),e([J.Property("")],q.prototype,"borderBottom",void 0),e([J.Property("")],q.prototype,"borderLeft",void 0),e([J.Property("")],q.prototype,"borderRight",void 0),q);function q(){return null!==H&&H.apply(this,arguments)||this}Z=J.ChildProperty,U(pe,Z),e([J.Property()],pe.prototype,"sheetIndex",void 0),e([J.Property()],pe.prototype,"filterRange",void 0),e([J.Property(!1)],pe.prototype,"hasFilter",void 0),e([J.Property()],pe.prototype,"column",void 0),e([J.Property()],pe.prototype,"criteria",void 0),e([J.Property()],pe.prototype,"value",void 0),e([J.Property()],pe.prototype,"dataType",void 0),e([J.Property()],pe.prototype,"predicates",void 0);var Z,de=pe;function pe(){return null!==Z&&Z.apply(this,arguments)||this}ce=J.ChildProperty,U(fe,ce),e([J.Property()],fe.prototype,"sortRange",void 0),e([J.Property()],fe.prototype,"columnIndex",void 0),e([J.Property()],fe.prototype,"order",void 0),e([J.Property()],fe.prototype,"sheetIndex",void 0);var ce,ue=fe;function fe(){return null!==ce&&ce.apply(this,arguments)||this}ge=J.ChildProperty,U(ve,ge),e([J.Property("")],ve.prototype,"name",void 0),e([J.Property("")],ve.prototype,"scope",void 0),e([J.Property("")],ve.prototype,"comment",void 0),e([J.Property("")],ve.prototype,"refersTo",void 0);var ge,me=ve;function ve(){return null!==ge&&ge.apply(this,arguments)||this}ye=J.ChildProperty,U(be,ye),e([J.Property(!1)],be.prototype,"selectCells",void 0),e([J.Property(!1)],be.prototype,"selectUnLockedCells",void 0),e([J.Property(!1)],be.prototype,"formatCells",void 0),e([J.Property(!1)],be.prototype,"formatRows",void 0),e([J.Property(!1)],be.prototype,"formatColumns",void 0),e([J.Property(!1)],be.prototype,"insertLink",void 0);var ye,Ce=be;function be(){return null!==ye&&ye.apply(this,arguments)||this}xe=J.ChildProperty,U(we,xe),e([J.Property("")],we.prototype,"address",void 0);var xe,Se=we;function we(){return null!==xe&&xe.apply(this,arguments)||this}Ie=J.ChildProperty,U(Re,Ie),e([J.Property("WholeNumber")],Re.prototype,"type",void 0),e([J.Property("Between")],Re.prototype,"operator",void 0),e([J.Property("0")],Re.prototype,"value1",void 0),e([J.Property("0")],Re.prototype,"value2",void 0),e([J.Property(!0)],Re.prototype,"ignoreBlank",void 0),e([J.Property(!0)],Re.prototype,"inCellDropDown",void 0),e([J.Property(!1)],Re.prototype,"isHighlighted",void 0),e([J.Property("")],Re.prototype,"address",void 0);var Ie,Ee=Re;function Re(){return null!==Ie&&Ie.apply(this,arguments)||this}Ne=J.ChildProperty,U(ke,Ne),e([J.Property("General")],ke.prototype,"format",void 0),e([J.Complex({},_)],ke.prototype,"style",void 0),e([J.Property(!0)],ke.prototype,"isLocked",void 0);var Ne,Ae=ke;function ke(){return null!==Ne&&Ne.apply(this,arguments)||this}Fe=J.ChildProperty,U(Te,Fe),e([J.Property("GreaterThan")],Te.prototype,"type",void 0),e([J.Complex({},Ae)],Te.prototype,"format",void 0),e([J.Property("RedFT")],Te.prototype,"cFColor",void 0),e([J.Property("")],Te.prototype,"value",void 0),e([J.Property("")],Te.prototype,"range",void 0);var Fe,Oe=Te;function Te(){return null!==Fe&&Fe.apply(this,arguments)||this}De=J.ChildProperty,U(Pe,De),e([J.Property(!0)],Pe.prototype,"visible",void 0),e([J.Property("Auto")],Pe.prototype,"position",void 0);var De,Le=Pe;function Pe(){return null!==De&&De.apply(this,arguments)||this}Me=J.ChildProperty,U(He,Me),e([J.Property(!1)],He.prototype,"visible",void 0),e([J.Property("Auto")],He.prototype,"position",void 0);var Me,Be=He;function He(){return null!==Me&&Me.apply(this,arguments)||this}Ve=J.ChildProperty,U(_e,Ve),e([J.Property("")],_e.prototype,"color",void 0),e([J.Property(1)],_e.prototype,"width",void 0);var Ve,Ue=_e;function _e(){return null!==Ve&&Ve.apply(this,arguments)||this}ze=J.ChildProperty,U(qe,ze),e([J.Property(!1)],qe.prototype,"visible",void 0),e([J.Property("Circle")],qe.prototype,"shape",void 0),e([J.Property(5)],qe.prototype,"size",void 0),e([J.Property(null)],qe.prototype,"fill",void 0),e([J.Property(!0)],qe.prototype,"isFilled",void 0),e([J.Complex({},Ue)],qe.prototype,"border",void 0);var ze,je=qe;function qe(){return null!==ze&&ze.apply(this,arguments)||this}We=J.ChildProperty,U(Ye,We),e([J.Property(0)],Ye.prototype,"width",void 0);var We,Ge=Ye;function Ye(){return null!==We&&We.apply(this,arguments)||this}Xe=J.ChildProperty,U($e,Xe),e([J.Property(0)],$e.prototype,"width",void 0);var Xe,Ke=$e;function $e(){return null!==Xe&&Xe.apply(this,arguments)||this}Ze=J.ChildProperty,U(Qe,Ze),e([J.Property("")],Qe.prototype,"title",void 0),e([J.Complex({},Ge)],Qe.prototype,"majorGridLines",void 0),e([J.Complex({},Ke)],Qe.prototype,"minorGridLines",void 0),e([J.Property(!0)],Qe.prototype,"visible",void 0);var Ze,Je=Qe;function Qe(){return null!==Ze&&Ze.apply(this,arguments)||this}et=J.ChildProperty,U(rt,et),e([J.Property("Line")],rt.prototype,"type",void 0),e([J.Property("Material")],rt.prototype,"theme",void 0),e([J.Property(!1)],rt.prototype,"isSeriesInRows",void 0),e([J.Complex({},je)],rt.prototype,"markerSettings",void 0),e([J.Property("")],rt.prototype,"range",void 0),e([J.Property("")],rt.prototype,"id",void 0),e([J.Property("")],rt.prototype,"title",void 0),e([J.Property(290)],rt.prototype,"height",void 0),e([J.Property(480)],rt.prototype,"width",void 0),e([J.Property(0)],rt.prototype,"top",void 0),e([J.Property(0)],rt.prototype,"left",void 0),e([J.Complex({},Le)],rt.prototype,"legendSettings",void 0),e([J.Complex({},Je)],rt.prototype,"primaryXAxis",void 0),e([J.Complex({},Je)],rt.prototype,"primaryYAxis",void 0),e([J.Complex({},Be)],rt.prototype,"dataLabelSettings",void 0);var et,tt=rt;function rt(){return null!==et&&et.apply(this,arguments)||this}nt=J.ChildProperty,U(ot,nt),e([J.Property("")],ot.prototype,"src",void 0),e([J.Property("")],ot.prototype,"id",void 0),e([J.Property(300)],ot.prototype,"height",void 0),e([J.Property(400)],ot.prototype,"width",void 0),e([J.Property(0)],ot.prototype,"top",void 0),e([J.Property(0)],ot.prototype,"left",void 0);var nt,it=ot;function ot(){return null!==nt&&nt.apply(this,arguments)||this}st=J.ChildProperty,U(at,st),e([J.Property("FillSeries")],at.prototype,"fillType",void 0),e([J.Property(!0)],at.prototype,"showFillOptions",void 0);var st,U=at;function at(){return null!==st&&st.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="refreshCellElem",It="setCellFormat",Et="findAllValues",Rt="textDecorationUpdate",Nt="applyCellFormat",At="updateRowColCount",re="workbookFormulaOperation",kt="workbookEditOperation",Ft="checkDateFormat",Ot="checkNumberFormat",Tt="parseDecimalNumber",Dt="getFormattedBarText",Lt="activeCellChanged",Pt="openSuccess",Mt="openFailure",Bt="sheetCreated",Ht="sheetsDestroyed",Vt="aggregateComputation",Ut="getUniqueRange",_t="removeUniquecol",zt="checkUniqueRange",jt="reApplyFormula",qt="clearFormulaDependentCells",Wt="formulaInValidation",Gt="beforeSort",Yt="initiateSort",Xt="updateSortedDataOnCell",Kt="sortComplete",$t="beforeHyperlinkCreate",Zt="afterHyperlinkCreate",Jt="beforeHyperlinkClick",Qt="afterHyperlinkClick",er="setLinkModel",tr="initiateFilter",rr="filterRangeAlert",nr="wrapText",ir="onSave",or="insert",sr="delete",ar="insertModel",lr="deleteModel",hr="isValidation",dr="cellValidation",pr="addHighlight",cr="find",ur="gotoHandler",fr="replace",gr="replaceAll",mr="showFindAlert",vr="findKeyUp",yr="removeHighlight",Cr="queryCellInfo",br="count",xr="protectSheet",Sr="updateToggleItem",wr="protectsheetHandler",Ir="replaceAllDialog",Er="unprotectsheetHandler",Rr="editAlert",Nr="readonlyAlert",Ar="setLockCells",kr="setMerge",Fr="applyMerge",Or="mergedRange",Tr="activeCellMergedRange",Dr="insertMerge",Lr="hideShow",Pr="setCFRule",Mr="applyCF",Br="clearCFRule",Hr="clear",Vr="clearCF",Ur="setImage",_r="setChart",zr="initiateChart",jr="refreshRibbonIcons",qr="refreshChart",Wr="refreshChartSize",Gr="updateChart",Yr="deleteChartColl",Xr="focusChartBorder",Kr="saveError",$r="validationHighlight",Zr="beforeInsert",Jr="beforeDelete",Qr="deleteHyperlink",en="moveOrDuplicateSheet",tn="setAutoFill",rn="refreshCell",nn="getFillInfo",on="getautofillDDB",sn="rowFillHandler",an="getTextSpace",ln="refreshClipboard",hn="updateView",dn="selectionComplete",pn="refreshInsertDelete",cn="getUpdatedFormulaOnInsertDelete",un="beforeCellUpdate",fn="duplicateSheetFilterHandler",gn="unMerge",mn="addFormatToCustomFormatDlg",vn="checkFormulaRef",yn="parseFormulaArgument",Cn="getChartRowIdxFromClientY",bn="getChartColIdxFromClientX",xn="refreshChartCellOnInit";function Sn(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(wn(e,t)))+"/"+t/e)}function wn(e,t){return e=Number(e),(t=Number(t))?wn(t,e%t):e}function In(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 En(e,t,r){var n=new Date("01/01/1900"),e=Rn(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 Rn(e){return"[object Date]"===Object.prototype.toString.call(e)&&!isNaN(e.valueOf())}function Y(e){return 0<=e-parseFloat(e)}function Nn(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=J.IntlBase.getDependables(J.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),J.isNullOrUndefined(u.dateObj)){if((e=e.toString())&&-1<e.indexOf("/")||0<e.indexOf("-")){t=n&&n.format||r,n=t.includes("dd-MM-yy");if((n||t.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(J.isNullOrUndefined(u.dateObj))for(var i=void 0,o=0,s=Object.keys(c);o<s.length;o++){n=s[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(J.isNullOrUndefined(u.dateObj))for(var a=0,l=Object.keys(p.timeFormats);a<l.length;a++){n=l[a];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 An(e){if(e&&"."!==e&&"-"!==e){var t=e.toString();if(t.startsWith("-")&&(t=(t=t.slice(1)).includes("-")?e:t),/^\d*\.?\d*$/.test(t))return parseFloat(e)}return e}function kn(e,t,r,n,i){var o=e.value;return Y(o)?{isNumber:!0,value:o}:{isNumber:Y(o=o&&((o=i&&o.includes(i)&&(e.format.includes(i)||e.format.includes("$"))?o.replace(i,""):o).includes(r)&&Fn(o,t,r,n)&&(o=o.split(r).join("")),"."!==n)&&o.includes(n)?o.replace(n,"."):o),value:o}}function Fn(e,t,r,n){for(var i=!1,o=123456..toLocaleString(t).split(r).reverse(),s=e.split(n)[0].split(r),a=0;a<s.length&&(i=a===s.length-1?s[a].length===o[0].length:!J.isUndefined(o[1])&&(0===a?s[a].length<=o[1].length:s[a].length===o[1].length));a++);return i}function X(e,t){return e&&"="===e[0]&&(1<e.length||t)}function On(e){if(-1<(e=e.split("$").join("")).indexOf(":")){var t=e.split(":");if(Un(t[0])&&Un(t[1]))return!0}else if(e.indexOf(":")<0&&Un(e))return!0;return!1}function Tn(e){return 65<=e.charCodeAt(0)&&e.charCodeAt(0)<=90||97<=e.charCodeAt(0)&&e.charCodeAt(0)<=122}function Dn(e,t){return 0===t[1]&&t[3]===e.colCount-1}function Ln(e,t){return 0===t[0]&&t[2]===e.rowCount-1}function Pn(e,t,r){return e&&t>=e[0]&&t<=e[2]&&r>=e[1]&&r<=e[3]}function Mn(e,t,r){for(var n,i=e.split(" "),o=0,s=i.length;o<s&&!(n=Pn(Q(i[o]),t,r));o++);return n}function Bn(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 Hn(n,i,e){var o=le(e+1);return n?n.split(" ").forEach(function(e){var t,r=Q(e);Bn(r,i)?n=n.split(e).join(o+(r[0]+1)+":"+o+i[0]+" "+o+(i[2]+2)+":"+o+(r[2]+1)):Bn(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 Vn(e,t){return!!(e=e||{}).isLocked||!(!1===e.isLocked||(!t||!t.isLocked)&&(e.isLocked||!t||!1===t.isLocked))}function Un(e){for(var t=e,r=0,n=t.length,i=0;i<n;i++)Tn(t[i])&&r++;var o=(e=t.substring(0,r)).length;if(o!==n&&o<4&&1!==n&&isNaN(parseInt(t,10))){if(16384<_n(e))return!1;o=parseFloat(t.substring(r,n));if(0<o&&o<1048577)return!0}return!1}function _n(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&&Tn(e[t]);){r=26*r+e[t].charCodeAt(0)-64;t++}return 0===r?-1:r}function K(e,t,r,n,i){var o;if(void 0===n&&(n="rows"),r)for(var s=t;s<1/0;s++){if(!(o=e[""+n])[t]||!o[t].hidden){if(!i)break;i--}t++}else for(s=t;-1<s&&((o=e[""+n])[t]&&o[t].hidden);s--)t--;return t}function zn(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 jn(e,t,r,n,i,o){var s;if(a=t?(s=i||ie(t[0],t[1],r,!1,!0)).formula||"":a){o&&n.notify(qt,{cellRef:G(t[0],t[1])});for(var a,l=["+","-","*","/",">=","<=","<>",">","<","=","%","&"],h=void 0,d=a=(a=0===a.indexOf("=")?a.slice(1):a).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++)On((b=((g=h[x].includes("!"))?(C=h[x].split("!"))[1]:h[x]).toUpperCase()).trim())&&!b.includes("$")&&(c=qn(b),u=Wn(b),f=Q(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])),On(v))?v:"#REF!",g&&(v=C[0]+"!"+v),(y={})[h[x]]=""+c+v+u,h[x].includes(":")?m.splice(0,0,y):m.push(y));for(var S=a=s.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),R="",N=0;N<I.length;N++)R+=" ";a=a.slice(0,w)+I+a.slice(w+E),S=S.slice(0,w)+R+S.slice(w+E)}return a}return null}function qn(e){for(var t="",r=0;r<e.length&&" "===e[r];r++)t+=" ";return t}function Wn(e){for(var t="",r=e.length-1;0<=r&&" "===e[r];r--)t=" "+t;return t}function Gn(e,t,r){var n,i,o,s,a={cell:r.cell,rowIndex:r.rowIdx,colIndex:r.colIdx,cancel:!1,sheet:t.name};return r.preventEvt||e.trigger(un,a),r.eventOnly||a.cancel||(r.valChange?(o=ie(a.rowIndex,a.colIndex,t),n=!r.preventEvt&&e.getDisplayText(o),o=!(!o||!o.formula),Mi(a.rowIndex,a.colIndex,t,a.cell,!r.pvtExtend),i=ie(a.rowIndex,a.colIndex,t,!1,!0),r.mergedCells&&(delete i.value,delete i.formula),o={action:"updateCellValue",address:[a.rowIndex,a.colIndex],sheetIndex:B(e,t.name),value:o&&!i.formula?i.value||(0===i.value?"0":""):i.formula||i.value||(0===i.value?"0":""),skipFormatCheck:r.skipFormatCheck,isRandomFormula:r.isRandomFormula},e.notify(kt,o),r.isFormulaDependent=o.isFormulaDependent,r.requestType&&null===a.cell&&Mi(a.rowIndex,a.colIndex,t,a.cell,!r.pvtExtend),r.cellDelete&&(delete i.value,delete i.formula,delete i.hyperlink),r.uiRefresh&&e.serviceLocator.getService("cell").refresh(a.rowIndex,a.colIndex,r.lastCell,r.td,r.checkCF,r.checkWrap,r.skipFormatCheck,r.isRandomFormula),r.preventEvt||(o=e.getDisplayText(i))!==n&&(s={value:s=(s=ie(a.rowIndex,a.colIndex,t,!1,!0).value)||(0===s?"0":""),oldValue:n,formula:i.formula||"",address:t.name+"!"+G(a.rowIndex,a.colIndex),displayText:o},r.requestType&&(s.requestType=r.requestType),e.trigger("cellSave",s))):Mi(a.rowIndex,a.colIndex,t,a.cell,!r.pvtExtend)),a.cancel}function Yn(e,t,r){for(var n=e,i=e,o=t,s=t,a=r.usedRange.rowIndex,l=r.usedRange.colIndex,h=function(e){for(var t=0;t<=l;t++)if(!J.isUndefined(ie(e,t,r,null,!0).value))return!1;return!0},d=function(e){for(var t=n;t<=i;t++)if(!J.isUndefined(ie(t,e,r,null,!0).value))return!1;return!0},p=n;p<=a&&(!J.isUndefined(ie(p,t,r,null,!0).value)||!h(p));p++)i=p;for(p=n;0<=p&&(!J.isUndefined(ie(p,t,r,null,!0).value)||!h(p));p--)n=p;for(p=o;p<=l&&(!J.isUndefined(ie(e,p,r,null,!0).value)||!d(p));p++)s=p;for(p=o;0<=p&&(!J.isUndefined(ie(e,p,r,null,!0).value)||!d(p));p--)o=p;return[n,o,i,s]}function Xn(e,t,r){var n=Q(e.model.selectedRange),i=0,o=0;return"Column"===e.modelType?(r&&(n=[0,e.start,0,e.end]),"before"===e.insertType?t[1]<=n[1]&&t[3]>=n[1]?(i=0,o=n[3]-n[1]+1):n[1]<t[1]&&(i=o=n[3]-n[1]+1):t[1]<=n[3]&&t[3]>=n[3]?(i=0,o=n[3]-n[1]+1):n[3]<t[3]&&(i=o=n[3]-n[1]+1),[t[0],t[1]+i,t[2],t[3]+o]):(r&&(n=[e.start,0,e.end,0]),"above"===e.insertType?t[0]<=n[0]&&t[2]>=n[0]?o=n[2]-n[i=0]+1:n[0]<t[0]&&(i=o=n[2]-n[0]+1):t[0]<=n[2]&&t[2]>=n[2]?o=n[2]-n[i=0]+1:n[2]<t[2]&&(i=o=n[2]-n[0]+1),[t[0]+i,t[1],t[2]+o,t[3]])}function Kn(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 $n(e,t,r,n){for(var i,o=e.length-1;0<=o;o--)for(var s=e[o].range.trim().split(","),a=0;a<s.length;a++)if(r>=(i=Q(s[a].includes(":")?s[a]:s[a]+":"+s[a]))[0]&&n>=i[1]&&r<=i[2]&&n<=i[3]){t.push(e[o]),e.splice(o,1);break}}function Zn(e,t){for(var r,n,i,o,s,a=t.trim().split(","),l=0;l<e.length;l++)if(function(e){for(var t=0;t<a.length;t++){if(s=Q(a[t].includes(":")?a[t]:a[t]+":"+a[t]),e[0]<=s[0]&&e[1]<=s[1]&&e[2]>=s[2]&&e[3]>=s[3])return!0;if(i=e[0]>=s[0]&&e[0]<=s[2],o=e[2]>=s[0]&&e[2]<=s[2],r=e[1]>=s[1]&&e[1]<=s[3],n=e[3]>=s[1]&&e[3]<=s[3],i&&o){if(r||n||e[1]<s[1]&&e[3]>s[3]){if(0<e[0]-s[0])return!0;if(0<s[2]-e[2])return!0}if(r&&e[1]!==s[1])return!0;if(n&&e[3]!==s[3])return!0}else if(r&&n){if(i||o||e[0]<s[0]&&e[2]>s[2]){if(0<e[1]-s[1])return!0;if(0<s[3]-e[3])return!0}if(i){if(e[0]!==s[0])return!0}else if(o&&e[2]!==s[2])return!0}else if(i||o){if(r){if(e[1]!==s[1])return!0;if(0<e[0]-s[0])return!0;if(0<s[2]-e[2])return!0}else if(n){if(e[3]!==s[3])return!0;if(0<e[0]-s[0])return!0;if(0<s[2]-e[2])return!0}else if(e[1]<s[1]&&e[3]>s[3])return!0}else if((r||n)&&e[0]<s[0]&&e[2]>s[2])return!0}return!1}(e[l]))return!0;return!1}function Jn(e,t,r,n){var i,o;r=r||J.getNumberDependable(t,J.defaultCurrencyCode),n=n||J.getNumericObject(t);for(var s=0;s<e.length;s++)2===(o=(i=e[s].toString().split(r).join("")).split(n.group)).length&&Fn(i,t,n.group,n.decimal)&&(i=o.join("")),Y(i="."!==n.decimal&&i.includes(n.decimal)?i.replace(n.decimal,"."):i)&&(e[s]=i);return e}function Qn(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 ei(e){var t;$(e.sheet,e.rowIdx)&&(t=K(e.sheet,e.rowIdx,!0))<e.rowIdx+e.cell.rowSpan&&(e.rowIdx=t,e.isMergedHiddenCell=!0),Eh(e.sheet,e.colIdx)&&(t=K(e.sheet,e.colIdx,!0,"columns"))<e.colIdx+e.cell.colSpan&&(e.colIdx=t,e.isMergedHiddenCell=!0)}function ti(t){var e=new J.Internationalization,r={},n=(e.getNumberFormat(r),{intl:e,updateValue:!0,value:""}),i={args:n,intl:e,currencySymbol:J.getNumberDependable(t.locale,r.currency)};return function(e){e.format||!e.value||Y(e.value)||(n.cell=e,n.value=e.value,t.notify(Ft,n),e.format)||!e.value.includes(i.currencySymbol)&&!e.value.includes("%")||(i.fResult=e.value,t.notify(Ot,i))}}function ri(e,t,r){var n=new V.Query,i=(t.length&&n.where(V.Predicate.and(t)),e.executeLocal(n));if(r)for(var o=0,s=r.length;o<s&&i.length;o++)n=new V.Query,r[o].length&&n.where(V.Predicate.or(r[o])),i=new V.DataManager(i).executeLocal(n);return i}function ni(e,t,r){return!0===(e=e||{}).isReadOnly||!(!r||!0!==r.isReadOnly)||!(!t||!0!==t.isReadOnly)}var ii="spreadsheetLocale",oi={SortOutOfRangeError:"Select a cell or range inside the used range and try again."},si={currency:["$#,##0.00","$#,##0","$#,##0_);[Red]($#,##0)","$#,##0.00_);($#,##0.00)","$#,##0_);($#,##0)","$#,##0.00_);[Red]($#,##0.00)"],accounting:['_($* #,##0.00_);_($* (#,##0.00);_($* "-"??_);_(@_)','_($* #,##0_);_($* (#,##0);_($* "-"_);_(@_)']};function ai(E,R,N,A,k,F,r,n,O,i,T,D){return void 0===O&&(O=!0),new Promise(function(e){var w,I,t;e((-1<R.indexOf("!")?(t=B(E,R.split("!")[0]),R=R.slice(R.indexOf("!")+1,R.length)):t=E.activeSheetIndex,w=ne(E,t),I=y(i||R),t={sheet:w,indexes:I,formulaCellRef:r,sheetIndex:n,isFinite:E.scrollSettings&&E.scrollSettings.isFinite,promise:new Promise(function(e){e(void 0)})},E.notify(ht,t),t.promise.then(function(){var n,i,o=I[0],e=E.frozenRowCount(w),t=E.frozenColCount(w),s=!!D;if(N){var a,l,h,d,p,c,u,f=[];A&&(c=J.getNumericObject(E.locale),u=new J.Internationalization(E.locale)),R.split(",").forEach(function(e,t){for(I=Q(e),o=I[a=0];o<=I[2];){for(l=f[a]||{},i=ch(w,o),n=I[1];n<=I[3];){var r;O&&$(w,o)&&!F?o++:(h=le(n+1),r=i?ie(o,n,w):null,A?(l[h]=li(E,r,o,n,!1,u),"string"==typeof(d=r&&(r.value||0===r.value)?r.value:null)&&("."!==c.decimal&&d.includes(c.decimal)?Y(p=d.replace(c.decimal,"."))&&(d=parseFloat(p)):Y(d)&&(d=parseFloat(d))),l[h+"_value"]=d):(r&&(r.formula||!J.isNullOrUndefined(r.value))||Object.keys(l).length)&&(n===T?("string"!=typeof(d=J.extend({},r,{value:li(E,r,o,n,!0)})).value||!Y(d.value)||r.format&&"@"===r.format||(d.value=parseFloat(d.value)),l[h]=d):l[h]=r),n===I[3]&&Object.keys(l).length&&(l.__rowIndex=(o+1).toString(),f[a]=l,s&&0===t&&!fh(w,o)&&D.push(l),a++),n++)}o++}})}else{f=new Map;for(var r=!(A||!k||!k.length);o<=I[2];)if(r&&e<=o&&o<k[0])o=k[0];else{if(A||!$(w,o))for(i=ch(w,o),n=I[1];n<=I[3];){var g,m={cell:ie(o,n,w),address:G(o,n),rowIndex:o,colIndex:n},v=(E.trigger(Cr,m),ie(o,n,w,!1,!0));if(v.formula&&v.formula.toUpperCase().includes("UNIQUE")&&E.notify("calculateFormula",{cell:v,rowIdx:o,colIdx:n,sheetIndex:E.activeSheetIndex,address:m.address}),1<v.colSpan&&1<v.rowSpan)for(var y=void 0,C=o,b=o+v.rowSpan;C<b;C++)for(var x=n,S=n+v.colSpan;x<S;x++)C===o&&x===n||(y=new Object,C!==o&&(y.rowSpan=o-C),x!==n&&(y.colSpan=n-x),w.rows[C]&&w.rows[C].cells&&w.rows[C].cells[x]&&(delete w.rows[C].cells[x].value,delete w.rows[C].cells[x].formula),Mi(C,x,w,y,!0));else if(1<v.colSpan)for(C=n+1,b=n+v.colSpan;C<b;C++)Mi(o,C,w,{colSpan:n-C},!0),w.rows[o]&&w.rows[o].cells&&w.rows[o].cells[C]&&(delete w.rows[o].cells[C].value,delete w.rows[o].cells[C].formula);else if(1<v.rowSpan)for(C=o+1,b=o+v.rowSpan;C<b;C++)Mi(C,n,w,{rowSpan:o-C},!0),w.rows[C]&&w.rows[C].cells&&w.rows[C].cells[n]&&(delete w.rows[C].cells[n].value,delete w.rows[C].cells[n].formula);!A&&Eh(w,n)?n++:r&&t<=n&&n<k[1]?n=k[1]:(v.style&&(g={},Object.assign(g,v.style),v.style=g),f.set(m.address,v),n++)}o++}}return f})))})}function li(e,t,r,n,i,o){return!t||J.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.trim()):i?t.value:(Y(n=t.value)&&((n=Number(t.value).toString()).includes(".")||11<n.length)&&(e.notify(Tt,r={args:{value:n,updateValue:!0},fResult:n,cellVal:n,intl:o}),n=r.fResult),n)}function hi(r,n,i){for(var o,s,a,l=0,h=r.length,e=0;e<h;e++)!function(e){if(J.isNullOrUndefined(r[e])||J.isUndefined(r[e].index)||(s=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+=s,h+=s}var t;n&&(r[e].id<1&&(r[e].id=Ni(i.sheets),r[e].properties)&&(r[e].properties.id=r[e].id),r[e].name||i.setSheetPropertyOnMute(r[e],"name","Sheet"+Ri(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})),a=e}(e),e=a}di=function(e,t){return(di=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 di,pi,e=function(e,t){function r(){this.constructor=e}di(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,s=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;0<=a;a--)(i=e[a])&&(s=(o<3?i(s):3<o?i(t,r,s):i(t,r))||s);return 3<o&&s&&Object.defineProperty(t,r,s),s},ci=(pi=J.ChildProperty,e(ui,pi),ui.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,s=0;s<o.length;s++)if("ranges"===o[s].name){o[s].instance.list.forEach(function(e,t){e.hasChanges&&(i=t)});break}this.parentObj.changedRangeIdx=i}}pi.prototype.setProperties.call(this,e,t)},t([J.Property(null)],ui.prototype,"dataSource",void 0),t([J.Property("A1")],ui.prototype,"startCell",void 0),t([J.Property(null)],ui.prototype,"query",void 0),t([J.Property(null)],ui.prototype,"fieldsOrder",void 0),t([J.Property(!0)],ui.prototype,"showFieldAsHeader",void 0),t([J.Property("")],ui.prototype,"template",void 0),t([J.Property("A1")],ui.prototype,"address",void 0),ui);function ui(){return null!==pi&&pi.apply(this,arguments)||this}fi=J.ChildProperty,e(mi,fi),t([J.Property(0)],mi.prototype,"rowIndex",void 0),t([J.Property(0)],mi.prototype,"colIndex",void 0);var fi,gi=mi;function mi(){return null!==fi&&fi.apply(this,arguments)||this}vi=J.ChildProperty,e(Ci,vi),t([J.Property(null)],Ci.prototype,"rows",void 0),t([J.Property(null)],Ci.prototype,"columns",void 0),t([J.Complex({},Ce)],Ci.prototype,"protectSettings",void 0),t([J.Collection([],ci)],Ci.prototype,"ranges",void 0),t([J.Collection([],Oe)],Ci.prototype,"conditionalFormats",void 0),t([J.Property(0)],Ci.prototype,"index",void 0),t([J.Property("")],Ci.prototype,"name",void 0),t([J.Property(100)],Ci.prototype,"rowCount",void 0),t([J.Property(100)],Ci.prototype,"colCount",void 0),t([J.Property("A1:A1")],Ci.prototype,"selectedRange",void 0),t([J.Property("A1")],Ci.prototype,"activeCell",void 0),t([J.Property({})],Ci.prototype,"usedRange",void 0),t([J.Property("A1")],Ci.prototype,"topLeftCell",void 0),t([J.Property(!0)],Ci.prototype,"showHeaders",void 0),t([J.Property(!0)],Ci.prototype,"showGridLines",void 0),t([J.Property(!1)],Ci.prototype,"isProtected",void 0),t([J.Property("Visible")],Ci.prototype,"state",void 0),t([J.Property(0)],Ci.prototype,"frozenRows",void 0),t([J.Property(0)],Ci.prototype,"frozenColumns",void 0),t([J.Property("A1")],Ci.prototype,"paneTopLeftCell",void 0),t([J.Property("")],Ci.prototype,"password",void 0);var vi,yi=Ci;function Ci(){return null!==vi&&vi.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 bi(e,t){for(var r,n=0;n<e.sheets.length;n++)if(e.sheets[n].id===t){r=n;break}return r}function xi(e){return e.split("!")[0].replace(/'/gi,"")}function Si(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 wi(e,t,r,n){e.setSheetPropertyOnMute(r=void 0===r?{}:r,"selectedRange",n?r.selectedRange+" "+t:t)}function Ii(e){return e&&e.selectedRange||"A1"}function Ei(e){return e.selectedRange.split(" ")[0]}function ne(e,t){return e.sheets[t]}function Ri(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 Ni(e){var t=0;return e.forEach(function(e){t=Math.max(e.id,t)}),t+1}function Ai(r,e,n){e=e||r.sheets;e.forEach(function(e){var t;e.id=e.id||0,e.name=e.name||"",e.rowCount=J.isUndefined(e.rowCount)?100:e.rowCount,e.colCount=J.isUndefined(e.colCount)?100:e.colCount,r.setSheetPropertyOnMute(e,"topLeftCell",e.topLeftCell||"A1"),r.setSheetPropertyOnMute(e,"activeCell",e.activeCell||"A1"),r.setSheetPropertyOnMute(e,"selectedRange",e.selectedRange||e.activeCell+":"+e.activeCell),e.usedRange=e.usedRange||{rowIndex:0,colIndex:0},r.setSheetPropertyOnMute(e,"ranges",e.ranges||[]),r.setSheetPropertyOnMute(e,"rows",e.rows&&J.extend([],e.rows,null,!0)||[]),r.setSheetPropertyOnMute(e,"columns",e.columns||[]),e.showHeaders=!!J.isUndefined(e.showHeaders)||e.showHeaders,e.showGridLines=!!J.isUndefined(e.showGridLines)||e.showGridLines,r.setSheetPropertyOnMute(e,"state",e.state||"Visible"),e.maxHgts=e.maxHgts||[],e.isImportProtected=e.isProtected&&n,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),r.setSheetPropertyOnMute(e,"paneTopLeftCell",G(e.frozenRows?t[0]+e.frozenRows:t[0],e.frozenColumns?t[1]+e.frozenColumns:t[1]))),hi(e.columns),(t=e.rows).forEach(function(e){e&&e.cells&&hi(e.cells)}),hi(t)}),hi(e,!0,r)}function ki(e,t){return ne(e,t=void 0===t?e.activeSheetIndex:t).name}function Fi(r,n,e,t,i){var o=!!e,s=(e=e||[r.activeSheetIndex],ki(r)),a={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",a),a.eventArgs.cancel||(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,s):n>e[0]?n-(e.length-1):n},!0),r.notify(en,{refresh:o}),t&&(delete a.eventArgs.cancel,r.trigger("actionComplete",a)))}function Oi(e,t,r,n){var i={action:"duplicateSheet",eventArgs:{sheetIndex:t=J.isUndefined(t)?e.activeSheetIndex:t,cancel:!1}};if(r&&e.trigger("actionBegin",i),!i.eventArgs.cancel){var o=ne(e,t),s=J.extend({},o.properties||o,{},!0),a=(s.id=Ni(e.sheets),s.name),l=(/^\(\d+\)$/.test("("+a.split(" (")[1])&&(a=a.split(" (")[0]),[]);e.sheets.forEach(function(e){l.push(e.name)});for(var h=2;;h++)if(-1===l.indexOf(a+" ("+h+")")){s.name=a+" ("+h+")";break}e.notify(fn,{sheetIndex:t,newSheetIndex:t+1}),e.createSheet(t+1,[s]),e.notify(re,{action:"addSheet",sheetName:"Sheet"+s.id,visibleName:s.name,sheetId:s.id}),n||e.setProperties({activeSheetIndex:t+1},!0),e.notify(en,{refresh:!0,isDuplicate:!0}),r&&(delete i.eventArgs.cancel,e.trigger("actionComplete",i))}}Ti=function(e,t){return(Ti=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 Ti,Di,e=function(e,t){function r(){this.constructor=e}Ti(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,s=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;0<=a;a--)(i=e[a])&&(s=(o<3?i(s):3<o?i(t,r,s):i(t,r))||s);return 3<o&&s&&Object.defineProperty(t,r,s),s},Li=(Di=J.ChildProperty,e(Pi,Di),t([J.Property("")],Pi.prototype,"notes",void 0),t([J.Collection([],it)],Pi.prototype,"image",void 0),t([J.Collection([],tt)],Pi.prototype,"chart",void 0),t([J.Property("")],Pi.prototype,"value",void 0),t([J.Property("")],Pi.prototype,"formula",void 0),t([J.Property(0)],Pi.prototype,"index",void 0),t([J.Property("General")],Pi.prototype,"format",void 0),t([J.Complex({},_)],Pi.prototype,"style",void 0),t([J.Property("")],Pi.prototype,"hyperlink",void 0),t([J.Property(!1)],Pi.prototype,"wrap",void 0),t([J.Property(!0)],Pi.prototype,"isLocked",void 0),t([J.Property("")],Pi.prototype,"validation",void 0),t([J.Property(1)],Pi.prototype,"colSpan",void 0),t([J.Property(1)],Pi.prototype,"rowSpan",void 0),t([J.Property(!1)],Pi.prototype,"isReadOnly",void 0),Pi);function Pi(){return null!==Di&&Di.apply(this,arguments)||this}function ie(e,t,r,n,i){var o=ch(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 Mi(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]?J.extend(r.rows[e].cells[t],n,null,!0):r.rows[e].cells[t]=n}function Bi(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 Hi(e,t,r,n){void 0===t&&(t=!0);for(var e=r.getAddressInfo(e),i=e.indices,o=ne(r,e.sheetIndex),s=e.sheetIndex===r.activeSheetIndex,a=i[0];a<=i[2];a++)for(var l=i[1];l<=i[3];l++)!Gn(r,o,{cell:{wrap:t},rowIdx:a,colIdx:l,preventEvt:n})&&s&&r.notify(nr,{range:[a,l,a,l],wrap:t,sheet:o,initial:!0});r.setProperties({sheets:r.sheets},!0)}function Vi(e){var t;return t=-1<e.indexOf("[")&&(e=e.split("[")[1].split("]")[0],-1<Ui().indexOf(e))?e:t}function Ui(){return["Black","Blue","Cyan","Green","Magenta","Red","White","Yellow"]}function _i(e,t,r,n){var i;return!e.includes("d")&&!e.includes("y")||e.includes("#")||Vi(e)||!/^[dyMhHmsaAP0,:[\]\-. /]*$/.test(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("#")&&!Vi(e)&&/^[dyMhHmsaAP0,:[\]\-. /]*$/.test(e)&&(r&&(r.type=r.type||"",r.type+="time"),i=!0),i}ji.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)},ji.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))},ji.prototype.updateSheetFromDataSourceHandler=function(p){var c,u,f,g,t,m,v,y,C,b,r,x=this,S=[],w=[],n=new V.Deferred,I=(p.promise=n.promise,p.autoDetectFormat),E=I&&ti(this.parent);if(p.sheet&&p.sheet.ranges.length)for(var R=this,e=p.sheet.ranges.length-1;0<=e;e--)!function(i){var o,s=p.sheet.ranges[i],a=(r=Q(s.startCell),p.isSaveAction&&(p.indexes=r),p.indexes[0]),l=p.indexes[2],e=(y=r[0],r=s.dataSource instanceof V.DataManager?s.dataSource:s.dataSource?new V.DataManager(s.dataSource):new V.DataManager,t=t||r.dataSource.url,p.sheet.isLocalData=!r.dataSource.url,y<=a?a-=y:a=y<=l?(l-=y,0):-1,s.showFieldAsHeader&&0!==a&&--a,!1),h=0,d=(R.initRangeInfo(s),R.getMaxCount(s));b=R.getLoadedInfo(a,l,s),a=b.unloadedRange[0],l=b.unloadedRange[1],s.info.insertRowRange&&(s.info.insertRowRange.forEach(function(e){h+=e[1]-e[0]+1}),a-=h,l-=h),d<=a?e=!0:d<l&&(l=d),p.loadComplete||R.requestedInfo.push({deferred:n,indexes:p.indexes,isNotLoaded:b.isNotLoaded}),0<=a&&b.isNotLoaded&&!e?(w[i]=a,S[i]=!1,s.fieldsOrder&&(o=[].slice.call(s.fieldsOrder)),e=(s.query||new V.Query).clone(),r.executeQuery(e.range(a,d<=l?l:l+1).requiresCount()).then(function(e){var r,t,n;x.parent&&!x.parent.isDestroyed&&(g=(e.result&&e.result.result?e.result:e).result,f=Q(s.startCell),y=f[0],C=f[1],g&&g.length?(s.info.count||(d=e.count,s.info.count=e.count),u=s.info.flds||o||Object.keys(g[0]),s.info.fldLen||(s.info.fldLen=u.length,s.info.flds=u),s.info.insertColumnRange&&(r=0,s.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]&&s.showFieldAsHeader&&(m=y+w[i]+h,u.forEach(function(e,t){(c=ie(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+(s.showFieldAsHeader?1:0)+h,u.forEach(function(e,t){(c=ie(m,v=C+t,p.sheet,!0))?e.includes("emptyCell")||Mi(m,v,p.sheet,x.getCellDataFromProp(r[e]),!0):c=p.sheet.rows[m].cells[v]=e.includes("emptyCell")?{}:x.getCellDataFromProp(r[e]),I&&E(c)})})):u=[],n={rowIndex:e=0<y+(d||e.count)?y+(d||e.count)+(s.showFieldAsHeader?1:0)+h-1:p.sheet.usedRange.rowIndex,colIndex:t=C+u.length-1<0?p.sheet.usedRange.colIndex:C+u.length-1},p.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&&(p.sheet.usedRange.rowIndex=n.rowIndex),p.sheet.usedRange.colIndex<n.colIndex&&(p.sheet.usedRange.colIndex=n.colIndex),h?(b=x.getLoadedInfo(a,l,s),a=b.unloadedRange[0],l=b.unloadedRange[1],d<a&&(b.isNotLoaded=!1),b.isNotLoaded&&(d<l&&(l=d),s.info.loadedRange.push([a,l]))):s.info.loadedRange.push([a,l]),S[i]=!0,-1===S.indexOf(!1))&&(n=void 0,l+y<y+s.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,isFinite:p.isFinite,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)&&R.checkResolve(p.indexes)}(e);else n.resolve()},ji.prototype.notfyFormulaCellRefresh=function(e,t){this.parent.formulaRefCell=null,this.parent.notify("updateView",{indexes:Q(e),sheetIndex:t,refreshing:!0})},ji.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)},ji.prototype.getCellDataFromProp=function(e){var t={};return"[object Object]"===Object.prototype.toString.call(e)?e.formula?t.formula=e.formula:J.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):X(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},ji.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]}},ji.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},ji.prototype.initRangeInfo=function(e){e.info||(e.info={loadedRange:[]})},ji.prototype.dataSourceChangedHandler=function(e){var n,i,o,t,r,s=this,a=this.parent.sheets[e.sheetIdx],l=a.ranges[e.rangeIdx];!l||!this.checkRangeHasChanges(a,e.rangeIdx)&&l.info||(i=l.showFieldAsHeader,o=W(l.startCell),l.info&&(l.info.loadedRange.forEach(function(e){for(var t=e[0];t<=e[1]&&t<l.info.count+(i?1:0);t++)if(n=a.rows[t+o[0]])for(var r=o[1];r<o[1]+l.info.fldLen;r++)n.cells&&n.cells[r]&&delete n.cells[r]}),l.info=null),r=this.parent.viewport,t=[r.topIndex,r.leftIndex,r.bottomIndex,r.rightIndex],r={sheet:a,indexes:t,dataSourceChange:!0,promise:new Promise(function(e){e(void 0)})},this.updateSheetFromDataSourceHandler(r),r.promise.then(function(){s.parent.trigger("dataSourceChanged",{data:e.changedData,action:"dataSourceChanged",rangeIndex:e.rangeIdx,sheetIndex:e.sheetIdx}),s.parent.notify("updateView",{indexes:t,checkWrap:!0,checkCF:!0})}))},ji.prototype.checkRangeHasChanges=function(e,t){return!this.parent.isAngular||e.changedRangeIdx===t&&(delete e.changedRangeIdx,!0)},ji.prototype.dataChangedHandler=function(h){var d,p,c,u,f,g,m,v,y,C=this,b=[{}],x=void 0===h.sheetIdx?this.parent.activeSheetIndex:h.sheetIdx,S=this.parent.sheets[x];S.ranges.forEach(function(e,t){if(e.dataSource){var r=void 0;if(u=W(e.startCell),c=u.concat([u[0]+e.info.count+(e.showFieldAsHeader?0:-1),u[1]+e.info.fldLen-1]),"Row"===h.modelType||"Column"===h.modelType){if("Column"===h.modelType){if(h.insertType)f=c[1]<h.index&&c[3]>=h.index,v=[h.index],f||c[3]+1===h.index&&"after"===h.insertType?(h.model.forEach(function(){e.info.flds.splice(h.index-u[1],0,"")}),e.info.fldLen+=h.model.length):c[1]>=h.index&&(e.startCell=G(u[0],u[1]+h.model.length));else if(f=c[1]<=h.startIndex&&c[3]>=h.startIndex)for(var n=h.startIndex;n<=h.endIndex;n++)n<=c[3]&&(e.info.flds.splice(h.startIndex,1),--e.info.fldLen);return}if(h.insertType){if(f=(e.showFieldAsHeader||"above"!==h.insertType&&!h.isMethod?c[0]<h.index:c[0]<=h.index)&&c[2]>=h.index,v=[h.index],f||c[2]+1===h.index&&"below"===h.insertType?(r=!0,e.info.count+=h.model.length):c[0]>=h.index&&(e.startCell=G(u[0]+h.model.length,u[1])),h.isMethod)return}else f=c[0]<=h.startIndex&&c[2]>=h.startIndex,h.isDataRequest?v=[h.startIndex,c[1],h.startIndex,c[1]]:d="delete"}else{v=Q(h.requestType&&h.requestType.toLowerCase().includes("paste")?h.pastedRange.split("!")[1]:-1<h.sheetIdx?h.address:(h.address||h.range||h.fillRange).split("!")[1]);var i=[e.showFieldAsHeader?c[0]+1:c[0]].concat(c.slice(1,4));if(e.showFieldAsHeader&&v[0]===u[0])for(n=v[1];n<=v[3];n++)n>=i[1]&&n<=i[3]&&(e.info.flds[n-u[1]]=ie(u[0],n,S,!1,!0).value||"");if(f=Bn(i,v,!0),"paste"===h.requestType&&h.copiedInfo.isCut){if(y=[].slice.call(h.copiedInfo.range),e.showFieldAsHeader&&y[0]===u[0]){for(n=y[1];n<=y[3];n++)n>=i[1]&&n<=i[3]&&(e.info.flds[n-u[1]]="");f=!1}g=Bn(i,y,!0)}}if(f||r||g){if("Row"!==h.modelType||h.insertType||h.isDataRequest){d=r?"add":"edit";var o=0;if(g)for(o=y[2]-y[0]+1,n=0;n<o;n++)!function(r){b[r]={},e.info.flds.forEach(function(e,t){e&&(p=ie(y[0]+r,u[1]+t,S),b[r][""+e]=C.getFormattedValue(p))})}(n);if(f||r)for(var s,a=!(h.isDataRequest||g||r||h.skipFilterCheck),n=0,l=0;n<(r?h.model.length:v[2]-v[0]+1||1);n++)!function(r,n){if(a&&fh(S,v[0]+r))return s=n;b[n+o]={},e.info.flds.forEach(function(e,t){e&&(p=ie(v[0]+r,u[1]+t,S),b[n+o][""+e]=C.getFormattedValue(p))}),s=++n}(n,l),l=s}else{if(h.deletedModel.forEach(function(r,n){b[n]={},e.info.flds.forEach(function(e,t){r.cells?(p=r.cells[u[1]+t],b[n][""+e]=C.getFormattedValue(p)):b[n][""+e]=null}),--e.info.count}),h.isMethod)return;m={count:h.deletedModel.length,index:h.endIndex}}h.isDataRequest?h.data=b:C.parent.trigger("dataSourceChanged",{data:b,action:d,rangeIndex:t,sheetIndex:x})}else m&&m.count&&c[0]>m.index&&(e.startCell=G(u[0]-m.count,u[1]))}})},ji.prototype.getFormattedValue=function(e){var t=this.parent.getDisplayText(e);return""===t?null:e&&!e.format&&"number"==typeof e.value?e.value:t},ji.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=J.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))},ji.prototype.getModuleName=function(){return"dataBind"},ji.prototype.destroy=function(){this.removeEventListener(),this.parent=null,this.requestedInfo=[]};var zi=ji;function ji(e){this.parent=e,this.requestedInfo=[],this.addEventListener()}Wi.prototype.open=function(t){var r=this;if(this.parent.allowOpen)if(t.jsonObject)this.fetchSuccess(t.jsonObject,t,null,!0,!0);else{var e=new FormData;if(t.file)e.append("file",t.file);else{if(!(0<=t.sheetIndex))return void(this.parent.isOpen=!1);e.append("sheetPassword",t.sheetPassword),e.append("sheetIndex",t.sheetIndex.toString())}var n={passWord:""},i=(t.password&&t.password.length&&(n.passWord=t.password),n.passWord&&n.passWord.length&&(t.password=n.passWord),t.password&&e.append("password",t.password),{file:t.file||null,cancel:!1,requestData:{method:"POST",body:e},password:n.passWord}),n=t.guid;J.isNullOrUndefined(t.sheetPassword)&&!n?(this.parent.trigger("beforeOpen",i),this.parent.notify(gt,{eventArgs:i,action:"beforeOpen"})):n&&e.append("guid",n),i.cancel?this.parent.isOpen=!1:fetch(this.parent.openUrl,i.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,i,t.orginalFile,void 0,!0)}).catch(function(e){return r.fetchFailure(e)})}},Wi.prototype.fetchFailure=function(e){J.isUndefined(e.status)&&J.isUndefined(e.statusText)&&(e.statusText="Improper response"),this.parent.notify(Mt,e),this.parent.isOpen=!1},Wi.prototype.fetchSuccess=function(e,t,r,n,i){var e="string"==typeof e?JSON.parse(e):e,o=e.Workbook;-1<["UnsupportedFile","InvalidUrl","NeedPassword","InCorrectPassword","InCorrectSheetPassword","CorrectSheetPassword","DataLimitExceeded","FileSizeLimitExceeded","ExternalWorkbook"].indexOf(o)?(r&&(t.file=r),this.parent.notify(Pt,{context:this,data:o,guid:e.Guid,eventArgs:t,isOpenFromJson:n})):(this.updateModel(o,n,i),this.parent.notify(Pt,{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=""))},Wi.prototype.updateModel=function(e,t,r){this.parent.notify(re,{action:"unRegisterSheet"}),this.setSelectAllRange(e.sheets,t),this.parent.sheetNameCount=1,this.parent.sheets=[],this.parent.notify(Ht,{}),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),J.isNullOrUndefined(e.showSheetTabs)||(this.parent.showSheetTabs=e.showSheetTabs),Ai(this.parent,void 0,r),this.parent.notify(Bt,null),this.parent.notify(re,{action:"registerSheet",isImport:!0}),this.parent.notify(re,{action:"initiateDefinedNames"}),this.parent.notify(xr,null)},Wi.prototype.setSelectAllRange=function(e,o){var s,a,l=this;e.forEach(function(e){var t,r,n;if(e.selectedRange&&(t=Q(e.selectedRange),r=(J.isUndefined(e.rowCount)?100:e.rowCount)-1,n=(J.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=ee(t)),o&&l.parent.isAngular)for(var i=0;i<l.parent.sheets.length;i++)if(s=ne(l.parent,i),e.name===s.name){e.ranges&&e.ranges.forEach(function(e,t){(a=s.ranges[t])&&a.template&&(e.template=a.template)});break}})},Wi.prototype.addEventListener=function(){this.parent.on(ut,this.open.bind(this))},Wi.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off(ut,this.open.bind(this))},Wi.prototype.destroy=function(){this.removeEventListener(),this.parent=null},Wi.prototype.getModuleName=function(){return"workbookOpen"};var qi=Wi;function Wi(e){this.parent=e,this.addEventListener()}function Gi(e){this.parent=e}Gi.prototype.processSheet=function(e,t){return[t,JSON.parse(e,function(e,t){if(!Array.isArray(t)&&"string"!=typeof t||t.length)return t})]},Gi.prototype.processSave=function(e,t,o,r,s){var n,a=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],s?s.apply(a,[{dialog:e}]):postMessage({dialog:e}))):s?s.apply(a,[i]):postMessage(i),r(n.result)},n.readAsDataURL(i)})}).catch(function(e){s?s.apply(a,[{error:e.message}]):postMessage({error:e.message})})},Yi=function(e,t){return(Yi=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 Yi,Xi,Ki=function(){return(Ki=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)},$i=(function(e,t){function r(){this.constructor=e}Yi(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}(Zi,Xi=Gi),Zi.prototype.getModuleName=function(){return"workbookSave"},Zi.prototype.destroy=function(){this.removeEventListener(),this.parent=null},Zi.prototype.addEventListener=function(){this.parent.on(ft,this.initiateSave,this),this.parent.on("getStringifyObject",this.performStringifyAction,this)},Zi.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(ft,this.initiateSave),this.parent.off("getStringifyObject",this.performStringifyAction))},Zi.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)},Zi.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=[]},Zi.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,s={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"]),s)s[o]&&i.push(o)}for(var a=0,l=this.parent.sheets.length;a<l;a++){for(var h,d,p=!1,c=!1,u=0,f=(h=this.parent.sheets[a]).ranges.length;u<f;u++)if((r=h.ranges[u]).dataSource&&(c=!0,!r.info||!r.info.loadedRange||!r.info.loadedRange.length)){p=!0;break}p?(d=this.parent,this.parent.notify(ht,{sheet:h,sheetIndex:a,loadComplete:function(e){T(n,n.processSheet,n.updateSheet,[n.getStringifyObject(n.parent.sheets[e],i,e,!1,!0),e])}.bind(this,a),isFinite:d.scrollSettings&&d.scrollSettings.isFinite,isSaveAction:!0,autoDetectFormat:e})):T(this,this.processSheet,this.updateSheet,[this.getStringifyObject(h,i,a,e&&c,!0),a])}},Zi.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)},Zi.prototype.getSheetLength=function(e){var t=0;return e.forEach(function(e){e&&t++}),t},Zi.prototype.save=function(e){var t={cancel:!1,jsonObject:this.saveJSON};this.parent.notify(ir,t),t.cancel||(this.isFullPost?(this.initiateFullPostSave(),this.saveJSON={}):T(this,{workerTask:this.processSave},this.updateSaveResult,[this.saveJSON,e,this.customParams,this.pdfLayoutSettings],!0))},Zi.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))},Zi.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)},Zi.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(),J.detach(r),this.parent.notify(bt,{})},Zi.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?",":"]}}}")},Zi.prototype.getStringifyObject=function(h,d,p,c,e){var u,f=this,g=(void 0===d&&(d=[]),0===p&&this.parent.notify(_t,{clearAll:!0}),e&&this.parent.notify(Ct,{sheetIdx:p,isSaveAction:!0,saveJson:this.saveJSON}),[]),m=c&&ti(this.parent),e=JSON.stringify(h,function(e,t){if(!(-1<d.indexOf(e))){if("cellStyle"===e)return f.parent.commonCellStyle;if(t&&t.cells)for(var r=0,n=t.cells.length;r<n;r++){var i=t.cells[r],o=[Number(e),r];if(i&&(i.value?c&&!i.formula&&m(i):i.formula&&i.formula.indexOf("=UNIQUE(")<0&&(f.parent.notify(re,{action:"refreshCalculate",value:i.formula,rowIndex:o[0],colIndex:r,isFormula:X(i.formula),sheetIndex:p,isRefreshing:!0}),i.value=ie(o[0],r,h).value),i.chart)){g.push({index:o,chart:i.chart}),u=[];for(var s=0,a=i.chart.length;s<a;s++){var l=Object.assign({},i.chart[s]);delete l.id,u.push(l)}i.chart=u}}return t&&t.properties&&t.maxHgts&&(t.properties=Ki({},t.properties,{maxHgts:t.maxHgts})),t&&"object"==typeof t&&t.hasOwnProperty("properties")?t.properties:null!==t?t:void 0}}),t=ne(this.parent,p);return g.forEach(function(e){Mi(e.index[0],e.index[1],t,{chart:e.chart},!0)}),e},Zi.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},Zi.prototype.getFileExtension=function(){return"."+this.saveSettings.saveType.toLowerCase()},Zi);function Zi(e){e=Xi.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}(e=z.CommonErrors||(z.CommonErrors={}))[e.NA=0]="NA",e[e.Value=1]="Value",e[e.Ref=2]="Ref",e[e.DivZero=3]="DivZero",e[e.Num=4]="Num",e[e.Name=5]="Name",e[e.Null=6]="Null",e[e.Calc=7]="Calc",(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",(e=z.ExcelFileFormats||(z.ExcelFileFormats={})).xlsx="xlsx",e.xlsm="xlsm",e.xlsb="xlsb",e.xltx="xltx",e.xltm="xltm",e.xls="xls",e.xml="xml",e.xlam="xlam",e.xla="xla",e.xlw="xlw",e.xlr="xlr",e.prn="prn",e.txt="txt",e.csv="csv",e.dif="dif",e.slk="slk";Ji.prototype.getModuleName=function(){return"calc-common"};t=Ji;function Ji(e){this.parent=e}function Qi(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 eo(e){var t,r=!1;for(t in z.ExcelFileFormats)if(-1<e.indexOf("."+t+"]")){r=!0;break}return r}function to(e){var t=[];return e.includeBasicFormulas&&t.push({member:"basic-formulas",args:[e]}),t}function ro(e,t){for(var r=t,n=e.replace(/\[/g,".").replace(/\]/g,"").split("."),i=0;i<n.length&&!J.isUndefined(r);i++)r=r[n[i]];return r}function no(e,t,r){for(var n,i=e.replace(/\[/g,".").replace(/\]/g,"").split("."),e=r||{},o=e,s=i.length,a=0;a<s;a++)n=i[a],a+1===s?o[""+n]=void 0===t?{}:t:J.isNullOrUndefined(o[""+n])&&(o[""+n]={}),o=o[""+n];return e}oo.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,s=t;o<s.length;o++){var a,l=s[o],h=i.member;l.prototype.getModuleName()!==i.member||this.isModuleLoaded(h)||(a=this.createInstance(l,i.args),h=this.getMemberName(h),i.isProperty?no(h,l,this.parent):no(h,a,this.parent),(l=i).member=h,this.loadedModules.push(l))}}},oo.prototype.createInstance=function(e,t){return t.unshift(void 0),new(Function.prototype.bind.apply(e,t))},oo.prototype.clean=function(){for(var e=0,t=this.loadedModules;e<t.length;e++){var r=t[e];r.isProperty||ro(r.member,this.parent).destroy()}this.loadedModules=[]},oo.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||ro(o.member,this.parent).destroy(),this.loadedModules.splice(this.loadedModules.indexOf(o),1),this.deleteObject(this.parent,o.member)}},oo.prototype.getMemberName=function(e){return e[0].toLowerCase()+e.substring(1)+"Module"},oo.prototype.deleteObject=function(e,t){delete e[""+t]},oo.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 io=oo;function oo(e){this.loadedModules=[],this.parent=e}r.prototype.init=function(){for(var e,t=0;t<this.formulas.length;t++)e=J.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()),J.isNullOrUndefined(e)||1===e.length&&""===e[0])return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.InvalidArguments];var n,i=0,o=0;if(!J.isNullOrUndefined(e))for(var s=e,a=function(e){-1<e.toString().indexOf(".")&&(o=Math.max(o,e.split(".")[1].length))},l=0;l<s.length;l++){var h=s[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;J.isNullOrUndefined(n[0])||isNaN(this.parent.parseFloat(n))||(a(n),i+=this.parent.parseFloat(n))}}else{if(-1<s[l].indexOf(this.parent.tic)&&(isNaN(this.parent.parseFloat(s[l].split(this.parent.tic).join("")))||""===s[l].split(this.parent.tic).join("").trim()))return this.parent.getErrorStrings()[z.CommonErrors.Value];if(s[l].split(this.parent.tic).join("")===this.parent.trueValue&&(s[l]="1"),s[l].split(this.parent.tic).join("")===this.parent.falseValue&&(s[l]="0"),h=r?this.parent.getValueFromArg(s[l].split(this.parent.tic).join(""),null,null,!0):this.parent.getValueFromArg(s[l].split(this.parent.tic).join("")),!r||!h.includes("SUBTOTAL(")){if(-1<this.parent.getErrorStrings().indexOf(h))return h;J.isNullOrUndefined(h)||isNaN(this.parent.parseFloat(h))||0<h.length&&(a(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]&&J.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()),J.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(J.isNullOrUndefined(t)||1===t.length&&""===t[0])return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.InvalidArguments];for(var n=0,i=0,o=null,s=t,a=[],l=0;l<s.length;l++)a.push(this.parent.getCellCollection(s[l]).length);for(var h=0;h<a.length;h++)if(a[h]&&a[h+1]&&a[h]!==a[h+1])return this.parent.getErrorStrings()[z.CommonErrors.Value];for(var d=0;d<s.length;++d){var p,c=s[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(!J.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<(a=this.parent.parseFloat(i))?a+=.4999999999:a<0&&(a-=.4999999999),l=(a=this.parent.parseFloat(a.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(),s=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]))&&s)return this.parent.getErrorStrings()[z.CommonErrors.Value];var a,l,n=Math.ceil(this.parent.parseFloat(o));a=this.parent.parseFloat(i),l=(a=0<n?(0<a?a+=.4999999999/Math.pow(10,n):a<0&&(a-=.4999999999/Math.pow(10,n)),o=2===(s=i.split(".")).length?s[1].length>=n?n:s[1].length:0,this.parent.parseFloat(a.toFixed(o))):(0<a?a=a/Math.pow(10,-n)+.49999:a<0&&(a=a/Math.pow(10,-n)-.49999),0<a&&n<-9?+Math.pow(10,-n):this.parent.parseFloat(a.toFixed(0))*Math.pow(10,-n))).toString(),isNaN(a)&&(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(!J.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<(a=this.parent.parseFloat(i))?a-=.4999999999:a<0&&(a+=.4999999999),l=(a=this.parent.parseFloat(a.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(),s=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]))&&s)return this.parent.getErrorStrings()[z.CommonErrors.Value];var n=Math.ceil(this.parent.parseFloat(o)),a=this.parent.parseFloat(i),l=(a=0<n?(0<a?a-=.4999999999/Math.pow(10,n):a<0&&(a+=.4999999999/Math.pow(10,n)),s=0,-1!==(o=i.indexOf("."))&&(s=n<=(s=i.length-o-1)?n:s),this.parent.parseFloat(this.preciseRound(a,s))):(0<a?a=a/Math.pow(10,-n)-.49999:a<0&&(a=a/Math.pow(10,-n)+.49999),0<a&&n<-9?+Math.pow(10,-n):this.parent.parseFloat(a.toFixed(0))*Math.pow(10,-n))).toString();isNaN(a)&&(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()),J.isNullOrUndefined(e)||1===e.length&&""===e[0])return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.WrongNumberArguments];for(var n,i,o,s=e,a=0,l=0;l<s.length;l++)if(this.parent.isCellReference(n=s[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()&&a++;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()&&a++;else o=this.parent.getValueFromArg(n).split(this.parent.tic).join(""),0===n.length&&""===o.trim()?a++:isNaN(this.parent.parseFloat(o))&&n!==this.parent.trueValue&&n!==this.parent.falseValue||0<n.length&&""!==n.trim()&&""!==o.trim()&&a++;return a},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()),J.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 s=n[o];if(-1<this.parent.getErrorStrings().indexOf(s))return s;if('""'===s||'"0"'===s&&'"0"'!==t[o]||'"TRUE"'===s||'"FALSE"'===s)return this.parent.getErrorStrings()[z.CommonErrors.Value].toString()}var a=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(a)||isNaN(l)||isNaN(h))return this.parent.getErrorStrings()[z.CommonErrors.Value].toString();if(a<0&&l<=12||1e4<=a&&0<l)return this.parent.getErrorStrings()[z.CommonErrors.Num].toString();for(;12<l;)l-=12,a++;if(0===(d=this.parent.getSerialDateFromDate(a,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 J.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(J.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(On(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 s=this.parent.parseFloat(n[0]),a=this.parent.parseFloat(n[1]);return 0<s&&a<0?this.parent.getErrorStrings()[z.CommonErrors.Num]:(0<s||s<0)&&0===a?this.parent.getErrorStrings()[z.CommonErrors.DivZero]:isNaN(s)?this.parent.getErrorStrings()[z.CommonErrors.Name]:0===s&&0===a?0:Math.floor(s/a)*a},r.prototype.ComputeCEILING=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(J.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(On(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 s=this.parent.parseFloat(n[0]),a=this.parent.parseFloat(n[1]);return 0<s&&a<0?this.parent.getErrorStrings()[z.CommonErrors.Num]:isNaN(s)?this.parent.getErrorStrings()[z.CommonErrors.Name]:(0<s||0===s)&&0===a?0:Math.ceil(s/a)*a},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(J.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()),J.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 s=void 0,a=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 s=this.parent.getCellCollection(o[1]),p=0;p<s.length;p++)a=this.parent.getValueFromArg(s[p]),isNaN(this.parent.parseFloat(a))||(l+=a+",");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(J.isNullOrUndefined(o[2]))return this.parent.falseValue;if(e&&o[2].includes(":")){s=this.parent.getCellCollection(o[2]);for(p=0;p<s.length;p++)a=this.parent.getValueFromArg(s[p]),isNaN(this.parent.parseFloat(a))||(l+=a+",");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(J.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()),J.isNullOrUndefined(e)||1===e.length&&""===e[0])return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.InvalidArguments];var n,i,o=1,s=!0;if(!J.isNullOrUndefined(e))for(var a=e,l=0;l<a.length;l++){var h,d=a[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("))&&Y(n)){if(-1<this.parent.getErrorStrings().indexOf(n))return n;i=this.parent.parseFloat(n),isNaN(i)||0<n.length&&(o*=i,s=!1)}}else if(-1===d.indexOf(":")&&this.parent.isCellReference(d)){if(h=r?this.parent.getValueFromArg(a[l],null,null,!0):this.parent.getValueFromArg(a[l]),r&&h.includes("SUBTOTAL("))continue;if(!Y(h))continue;if(-1<this.parent.getErrorStrings().indexOf(h))return h}else{if(-1<(h=a[l]).indexOf(this.parent.tic)&&""===h.split(this.parent.tic).join("").trim()||-1<a[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(a[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,s=!1)}return s?"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 J.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(Ft,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()),J.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 J.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 s=P(t[2]);if(-1<i.indexOf(s))return s;var a=[];if(-1<t[0].indexOf(":")){J.isNullOrUndefined(t[0].match(/[0-9]/))?(l=t[0].split(":"),t[0]=l[0]+"1:"+l[1]+(this.parent.spreadSheetUsedRange[0]+1)):J.isNullOrUndefined(t[0].toUpperCase().match(/[A-Z]/))&&(l=t[0].split(":"),t[0]="A"+l[0]+":"+j(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+j(f)+u+":"+j(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]);a.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]),a.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)+"++":(a.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)+"++";a.push(b.substring(0,b.length-2)),b=""}for(var w,B=[],I=[],E=[],H=[],d=0;d<a.length;d++)(-1===B.indexOf(a[d].toLowerCase())?(B.push(a[d].toLowerCase()),E):(-1===I.indexOf(a[d].toLowerCase())&&I.push(a[d].toLowerCase()),H)).push(a[d]);if(s===this.parent.trueValue){for(var V=[],d=0;d<E.length;d++)-1===I.indexOf(E[d].toLowerCase())&&V.push(E[d]);if(0===(E=V).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.split("!")[1]);var R=this.parent.rowIndex(y),N=this.parent.colIndex(y);if(0===this.parent.dependencyLevel){var A=!1;if(o===this.parent.falseValue)for(d=R,x=E.length+R;d<x;d++)for(var k=N,F=(T=E[0].split("++")).length+N;k<F;k++)d===x-1&&k===F-1&&-1===this.parent.uniqueRange.indexOf(p+":"+j(k)+d)&&this.parent.uniqueRange.push(p+":"+j(k)+d),this.checkSpill(k,d)&&(A=!0);else for(d=N,x=E.length+N;d<x;d++)for(var O=R,F=(T=E[0].split("++")).length+R;O<F;O++)d===x-1&&O===F-1&&-1===this.parent.uniqueRange.indexOf(this.parent.actCell+":"+j(d)+O)&&this.parent.uniqueRange.push(this.parent.actCell+":"+j(d)+O),this.checkSpill(d,O)&&(A=!0);if(A)return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.Spill]}else if(0<this.parent.dependencyLevel&&-1<this.parent.getValueFromArg(j(N)+R,!0).indexOf("#SPILL!"))return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.Spill];if(o===this.parent.falseValue){var c=this.parent.getSheetFamilyItem(this.parent.grid),U="",_=void 0;null!==c.sheetNameToParentObject&&0<c.sheetNameToParentObject.size&&(_=(U=c.parentObjectToToken.get(this.parent.grid))+y);for(d=0;d<E.length;d++){var T=E[d].split("++");0<d&&(R++,N=this.parent.colIndex(y));for(var D=0;D<T.length;D++)this.setValueRefresh(T[D],R,N),(0<d||0<D)&&this.parent.refresh(U+j(N)+R.toString(),_),T[D+1]&&N++}}else for(d=0;d<E.length;d++)for(var T=E[d].split("++"),L=0;L<T.length;L++)this.setValueRefresh(T[L],R,N),T[L+1]?R++:(N++,R=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(j(e)+t,!0),e="!"+this.parent.getSheetID(this.parent.grid)+"!"+j(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.indexOf("!")&&(t=(o=t.split("!"))[1],r=o[0]+"!"),this.parent.rowIndex(t)),i=this.parent.colIndex(t),o=e.indexOf(":"),s=this.parent.rowIndex(this.parent.substring(e,0,o)),a=this.parent.colIndex(this.parent.substring(e,0,o)),l=this.parent.rowIndex(this.parent.substring(e,o+1,o+e.length-o-1))-s+n,h=this.parent.colIndex(this.parent.substring(e,o+1,o+e.length-o-1))-a+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)+"!"+j(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)+"!"+j(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()),J.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||J.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(Ft,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||J.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(Ft,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||J.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(Ft,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 J.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,s=e.length&&"nestedFormulaTrue"===e[e.length-1],a=this.parent.getErrorStrings();if(s&&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<a.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<a.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,s)?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 J.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(J.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(On(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],s=t[1];return"0"===s||""===s?this.parent.formulaErrorStrings[z.FormulasErrorsStrings.Div]:"0"===o||""===o?0:(o=(parseFloat(o)%(s=parseFloat(s))+s)%s,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(J.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(On(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(J.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(On(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(J.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]),s=0;s<o.length;s++){var a=this.parent.getValueFromArg(o[s]);if(-1<this.parent.getErrorStrings().indexOf(a))return a;""!==a.trim()&&n.push(this.parent.parseFloat(a))}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||J.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)||J.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||J.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)||J.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)||J.isNullOrUndefined(this.parent.isDate(e))?i[z.CommonErrors.Value]:(n=this.parent.parseDate(e),-1<i.indexOf(e)?e:J.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||J.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 s=1;s<=o;s++)r*=s;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 J.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(J.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(J.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 s=o(t[0]);if(0<i.indexOf(s))return s;if(s=Number(s),isNaN(s)||s<1)return i[z.CommonErrors.Value];var a,l,h,s=s.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(),J.isNullOrUndefined(t[2])||""===t[2].trim())a="1";else{if(a=o(t[2]),0<i.indexOf(a))return a;if(a=Number(a),isNaN(a)||a<1||4<a)return i[z.CommonErrors.Value];a=a.toString()}if(J.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"===a?e="$"+j(parseInt(d,10))+"$"+parseInt(s,10):"2"===a?e=j(parseInt(d,10))+"$"+parseInt(s,10):"3"===a?e="$"+j(parseInt(d,10))+parseInt(s,10):"4"===a&&(e=j(parseInt(d,10))+parseInt(s,10));else{if("0"!==l)return i[z.CommonErrors.Name];"1"===a?e="R"+parseInt(s,10)+"C"+parseInt(d,10):"2"===a?e="R"+parseInt(s,10)+"C["+parseInt(d,10)+"]":"3"===a?e="R["+parseInt(s,10)+"]C"+parseInt(d,10):"4"===a&&(e="R["+parseInt(s,10)+"]C["+parseInt(d,10)+"]")}return!J.isNullOrUndefined(t[4])&&""!==t[4]&&(h=this.parent.getValueFromArg(t[4]).split(this.parent.tic).join(""),0<i.indexOf(h))?h:J.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(J.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(Ft,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 J.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(J.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")),J.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 s=new J.Internationalization,a=parseInt(o,10),o=Math.pow(10,-1*a),l="",h=1;h<=a;h++)l+="0";i=Math.round(this.parent.parseFloat(i)/o)*o,o=isNaN(i)?this.parent.getErrorStrings()[z.CommonErrors.Value]:s.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(J.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(!J.isNullOrUndefined(e[0])){var o=void 0;if(this.parent.isCellReference(e[0]))for(var s=this.parent.getCellCollection(e[0]),a=0;a<s.length;a++){if(o=this.parent.getValueFromArg(s[a]),-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(a=0;a<n.length;a++)""===n[a]||isNaN(this.parent.parseFloat(n[a]))||i.push(this.parent.parseFloat(n[a]));if(0===i.length&&(J.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}),!J.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 J.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(J.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(!J.isNullOrUndefined(e[0])){var o=void 0;if(this.parent.isCellReference(e[0]))for(var s=this.parent.getCellCollection(e[0]),a=0;a<s.length;a++){if(o=this.parent.getValueFromArg(s[a]),-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(a=0;a<n.length;a++)""===n[a]||isNaN(this.parent.parseFloat(n[a]))||i.push(this.parent.parseFloat(n[a]));if(0===i.length&&(J.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}),!J.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 J.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(J.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)||J.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()),J.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(J.isNullOrUndefined(e)||1===e.length&&""===e[0])return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.InvalidArguments];for(var n=e,i="",o="",s=0;s<n.length;s++){var a=n[s];if(this.parent.isCellReference(a)){if(-1<a.indexOf(":")){if(!this.isConcat)return r[z.CommonErrors.Value];for(var l=this.parent.getCellCollection(a),h=0;h<l.length;h++)i+=this.parent.getValueFromArg(l[h])}else{if(1===n.length&&n[0].indexOf(this.parent.tic)<0&&!Un(n[0]))return r[z.CommonErrors.Name];o=this.parent.getValueFromArg(a)}if(-1<r.indexOf(o))return o}else if(a.startsWith(this.parent.tic)&&a.endsWith(this.parent.tic)&&-1<a.indexOf('""')?o=(o=a.substring(1,a.length-1)).replace(/""/g,'"'):(o=a.split(this.parent.tic).join(""),(this.parent.isNumber(o)||J.isNullOrUndefined(this.parent.isDate(o))||a.startsWith(" n"))&&(o=this.parent.getValueFromArg(a).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 J.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 J.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 J.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(J.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,s;if(!J.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(!J.isNullOrUndefined(e[1])){if(s=i(e[1]),-1<n.indexOf(s))return s;this.parent.isCellReference(e[1])||(s=this.parent.removeTics(s))}var a=1;if(!J.isNullOrUndefined(e[2])){if(a=i(e[2]),-1<n.indexOf(a))return a;if(a.toUpperCase()===this.parent.trueValue?a="1":a.toUpperCase()===this.parent.falseValue&&(a="0"),this.parent.isCellReference(e[2])||(a=this.parent.removeTics(a)),a=this.parent.parseFloat(a),isNaN(a)||a<=0)return n[z.CommonErrors.Value]}return(a=s.indexOf(o,a-1))<0?n[z.CommonErrors.Value]:(Number(a)+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,s,a,l,h,d,p=this.parent.getErrorStrings();return t.length&&"nestedFormulaTrue"===t[t.length-1]&&(e=!0,t.pop()),J.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],s=(i=function(e){if(J.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(s.toString())?s.toString():(i=i(t[2]),-1<p.indexOf(i.toString())?i.toString():(d=o.indexOf(":"),a=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-a+1<s||d-h+1<i?p[z.CommonErrors.Ref]:(s=a+s-1,i=h+i-1,""===(o=this.parent.getValueFromArg(this.getSheetReference(o)+this.parent.convertAlpha(i)+s))?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(J.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()),J.isNullOrUndefined(e)||1===e.length&&""===e[0])return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.WrongNumberArguments];for(var n,i,o=e,s=0,a=0;a<o.length;a++)if(this.parent.isCellReference(o[a]))if(-1<o[a].indexOf(":"))for(var l=this.parent.getCellCollection(o[a].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&&s++;else n=r?this.parent.getValueFromArg(o[a],null,null,!0):this.parent.getValueFromArg(o[a]),r&&n.includes("SUBTOTAL(")||0<n.length&&s++;else(0<(i=this.parent.getValueFromArg(o[a]).split(this.parent.tic).join("")).length||0===i.length&&""===i.trim())&&s++;return s},r.prototype.ComputeAVERAGEA=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(J.isNullOrUndefined(e)||1===e.length&&""===e[0])return this.parent.formulaErrorStrings[z.FormulasErrorsStrings.WrongNumberArguments];for(var r,n,i,o=e,s=0,a=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;J.isNullOrUndefined(r)||""===r||(i=this.parent.parseFloat(r),s+=r=isNaN(i)?0:i,a+=1)}else{if(r=this.parent.getValueFromArg(o[l]),r=this.processLogicalCellValue(r),-1<this.parent.getErrorStrings().indexOf(r))return r;J.isNullOrUndefined(r)||""===r||(i=this.parent.parseFloat(r),s+=r=isNaN(i)?0:i,a+=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;s+=this.parent.parseFloat(n),a+=1}return 0===a?this.parent.getErrorStrings()[z.CommonErrors.DivZero]:s/a},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,s=[];if(J.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 a=[];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(Y(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]=Y(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]=Y(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]=Y(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]=Y(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+j(p)+d+":"+j(u)+c;for(var P=this.parent.getCellCollection(o[0]),g=0;g<P.length;g++)a.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(a[g+(this.parseDouble(o[1])-1)*x]);if("FALSE"===o[3])for(g=0;g<a.length;g++)M(a[g*x+this.parseDouble(o[1])-1]);for(var h=0<v.length?V.DataUtil.sort(v,null,V.DataUtil.fnSort(l)):[],S=0<y.length?V.DataUtil.sort(y,null,V.DataUtil.fnSort(l)):[],B=0<C.length?V.DataUtil.sort(C,null,V.DataUtil.fnSort(l)):[],H="Ascending"==l?h.concat(S,B,b):B.concat(S,h,b),w=[],I=0;I<H.length;I++)for(var E=0;E<m.length;E++)JSON.stringify(H[I])===JSON.stringify(m[E])&&-1===w.indexOf(E)&&w.push(E);if("TRUE"===o[3]){for(var R=d,N=0;R<=c;R++,N++)for(var I=0,A=0;I<w.length;I++,A++){var k=this.parent.getValueFromArg(f+j(w[I]+p)+R);e&&""!==k?s.push(k):(k=""===k?"0":k,D=(O=-1<(O=this.parent.actCell).indexOf("!")?O.split("!")[1]:O,this.parent.rowIndex(O)),T=this.parent.colIndex(O),this.parent.parentObject.setValueRowCol(this.parent.getSheetID(this.parent.grid)+1,k,D+N,T+A))}i=this.parent.getValueFromArg(f+j(w[0]+p)+d)}if("FALSE"===o[3]){for(I=0,N=0;I<w.length;I++,N++)for(var F=p,A=0;F<=u;F++,A++){var O,T,D,L=this.parent.getValueFromArg(f+j(F)+(w[I]+d));e&&""!==L?s.push(L):(L=""===L?"0":L,T=(O=-1<(O=this.parent.actCell).indexOf("!")?O.split("!")[1]:O,this.parent.colIndex(O)),D=this.parent.rowIndex(O),this.parent.parentObject.setValueRowCol(this.parent.getSheetID(this.parent.grid)+1,L,D+N,T+A))}i=this.parent.getValueFromArg(f+j(p)+(w[0]+d))}}}return e?s.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(J.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=[],s="equal";if(""===r[1])return 0;var a=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=(!a&&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("<=")?(s="lessEq",l=l.substring(2)):l.startsWith(">=")?(s="greaterEq",l=l.substring(2)):l.startsWith("<>")?(s="notEq",l=l.substring(2)):l.startsWith("<")?(s="less",l=l.substring(1)):l.startsWith(">")?(s="greater",l=l.substring(1)):l.startsWith("=")&&(s="equal",l=l.substring(1)),-1<l.indexOf("*")||-1<l.indexOf("?"));if((!a&&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,s)===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,s=this;if(J.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(s.parent.tic).join(""))&&(i=s.parent.computeIfsFormulas([t[0],t[1],e],s.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),s=n+","+i,a=new J.Internationalization;if(-1<this.parent.getErrorStrings().indexOf(s))return s;if(Y((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());s=this.parseDouble(n);if(isNaN(s)&&null!==this.parent.isDate(new Date(n))&&(s=this.parent.toOADate(new Date(n))),o=Date.parse(n.split(this.parent.tic).join("")),!isNaN(s)||!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(s),o=(0===s&&(r=o),Qi(i));if(""===o)return f=En(r),this.parent.parentObject.getDisplayText({format:i,value:f});n=a.getDateFormat({skeleton:o,type:"date"})(new Date(r.toString()))}else n=this.parent.parentObject.getDisplayText({format:i,value:s});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(J.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),J.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 s=[],a=!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)))&&(a=!0),s[h]=d.split(this.parent.tic).join("")}if(o&&!a||!o&&a)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<s.length;g++)if(""===s[g])g===s.length-1&&s.pop();else{if(-1===i&&(o||a))break;var m=isNaN(Number(s[g]))?s[g]:Number(s[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=s[g]);else if(0===i){if((-1<r[0].indexOf("*")||-1<r[0].indexOf("?"))&&(s[g]=this.parent.findWildCardValue(r[0],s[g])),r[0]===s[g])return g+1}else if(-1===i){if(!(Number(s[g])>Number(s[g+1])||g===s.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=s[g])}}return o&&a&&1===i?s.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 J.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];var r=e;return J.isNullOrUndefined(r)||1===r.length&&""===r[0]||r.length<3||4<r.length?this.parent.formulaErrorStrings[z.FormulasErrorsStrings.WrongNumberArguments]:this.parent.computeVHLookup(r,!0)},r.prototype.ComputeHLOOKUP=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=e;return J.isNullOrUndefined(r)||1===r.length&&""===r[0]||r.length<3||4<r.length?this.parent.formulaErrorStrings[z.FormulasErrorsStrings.WrongNumberArguments]:this.parent.computeVHLookup(r)},r.prototype.ComputeSUBTOTAL=function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=this.parent.getErrorStrings();if(J.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(J.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(J.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()),s=i(e[1].trim());if(J.isNullOrUndefined(o)||J.isNullOrUndefined(s)||o.length<2&&s.length<2)return n[z.CommonErrors.DivZero];if(o.length!==s.length)return n[z.CommonErrors.NA];function a(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=a(o);if(-1<n.indexOf(o.toString()))return o.toString();if(s=a(s),-1<n.indexOf(s.toString()))return s.toString();for(var l=0,h=0,d=0,p=0,c=0,u=0,f=s.length;u<f;++u)""!==s[u]&&"NaN"!==Number(s[u]).toString()&&""!==o[u]&&"NaN"!==Number(o[u]).toString()&&(l+=Number(s[u])*Number(o[u]),d+=Number(s[u]),p+=Number(o[u]),h+=Number(s[u])*Number(s[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,s,a,l,h,d,p,c=this.parent.getErrorStrings();return J.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()),J.isNullOrUndefined(i)||J.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]),s+=Number(n[t]),a++):(d=Number(n[t])-s,l+=d*(Number(i[t])-o),h+=d*d))})(!(h=l=a=s=o=0)),o/=a,s/=a,p(!1),"NaN"===(p=(o-l/h*s).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 J.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(),s=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]))&&s?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)):(s=Math.pow(10,-r),Math.round(o/s)*s)).toString())},r.prototype.preciseRound=function(e,t){var r=0<=e?1:-1;return(Math.round(e*Math.pow(10,t)+.001*r)/Math.pow(10,t)).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 J.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(Ft,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(J.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 s(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(!J.isNullOrUndefined(r[0])){if(e=s(r[0]),-1<o.indexOf(e))return e;e=this.parent.parseFloat(e)}if(t=10,!J.isNullOrUndefined(r[1])){if(t=s(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(J.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 s(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(!J.isNullOrUndefined(t[0])){if(e=s(t[0]),-1<o.indexOf(e))return e;if(e=this.parent.parseFloat(e),isNaN(e))return o[z.CommonErrors.Value]}if(!J.isNullOrUndefined(t[1])){if(i=s(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,s=1,a=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)||(a++,s*=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)||(a++,s*=r)}}0<a&&(s=Math.pow(s,1/a))}return s.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(":")&&On(n[0])&&-1===n[1].indexOf(":")&&On(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),s=0;s<o.length;s++)if(-1<this.parent.getErrorStrings().indexOf(o[s]))return o[s];for(var a,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++)a=Number(o[p]),l=Number(h[p]),Y(a)&&Y(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,s=0,a=0,l=0,h=0;h<e.length;h++)Y(e[h])&&Y(t[h])&&(s+=(o=Number(e[h])-r)*(i=Number(t[h])-n),a+=Math.pow(o,2),l+=Math.pow(i,2));return s/Math.sqrt(a*l)},r.prototype.getMeanArray=function(e,t){for(var r=0,n=0,i=0,o=0;o<e.length;o++)Y(e[o])&&Y(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 so=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()}lo.prototype.parse=function(t,r){var n=this;if(!this.parent.isTextEmpty(t)){if(eo(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 fo(n.parent.formulaErrorStrings[z.FormulasErrorsStrings.InvalidExpression],!0)}return t+e})).split("-(-").join("(");var e,i,o=this.storeStrings(t),s=(t=this.storedStringText,0);-1<(t=(t=(t=(t=J.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("")),J.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(s=t.indexOf(")");-1<s;){var a=t.substring(0,s).lastIndexOf("(");if(-1===a)throw new fo(this.parent.formulaErrorStrings[z.FormulasErrorsStrings.MismatchedParentheses]);if(a===s-1)throw new fo(this.parent.formulaErrorStrings[z.FormulasErrorsStrings.EmptyExpression]);var l=this.emptyStr,l=this.ignoreBracet?this.parent.substring(t,a,s-a+1):this.parent.substring(t,a+1,s-a-1);try{t=t.substring(0,a)+this.parseSimple(l)+t.substring(s+1)}catch(e){var h=this.exceptionArgs(e),a=(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)+": ")+a}s=t.indexOf(")")}if(!this.ignoreBracet&&-1<t.indexOf("("))throw new fo(this.parent.formulaErrorStrings[z.FormulasErrorsStrings.MismatchedParentheses]);t=this.parseSimple(t),null!==o&&0<o.size&&(t=this.setStrings(t,o))}return t},lo.prototype.exceptionArgs=function(e){return{message:e.message,exception:e,isForceCalculable:e.formulaCorrection,computeForceCalculate:!1}},lo.prototype.formulaAutoCorrection=function(e,t){var r,n,i=["*","+","-","/","^","&"],o=[">","=","<"],s=0,a="",l="",h="",d=0;if(-1<this.parent.formulaErrorStrings.indexOf(e))return e;if(-1<this.indexOfAny(e,this.specialSym))throw new fo(this.parent.formulaErrorStrings[z.FormulasErrorsStrings.InvalidExpression],!1);for(;s<e.length;)if(e=e.split("-*").join("-").split("/*").join("/").split("*/").join("*").split("-/").join("-").split("*+").join("*").split("+*").join("+"),this.parent.isDigit(e[s])&&e.length>s+1&&-1<this.indexOfAny(e[s+1],i)&&e.length>s+2&&!J.isNullOrUndefined(e[s+2])&&-1<this.indexOfAny(e[s+2],i)&&("-"!==e[s+2]||"*"!==e[s+1]&&"/"!==e[s+1]&&"^"!==e[s+1]&&"&"!==e[s+1])){if(!t||!t.computeForceCalculate)throw this.parent.formulaErrorStrings[z.FormulasErrorsStrings.ImproperFormula];this.parent.isDigit(e[s])?(d<1?(n=e[s],l=e[s+1],d+=1,a=a+n+(l="&"===(l=J.isNullOrUndefined(l)?this.emptyStr:l)?"":l)):d<2&&(n=e[s],r=e[s-1],h=e[s+1],d=0,a="-"===r?a+r+n+(h="&"===(h=J.isNullOrUndefined(h)?this.emptyStr:h)?"":h):a+n+(h=J.isNullOrUndefined(h)?this.emptyStr:h)),s+=2):(a="-"===e[s]?a+e[s]:a,s+=1)}else if((this.parent.isDigit(e[s])||e[s]===this.parent.rightBracket||this.parent.storedData.has(e[s].toUpperCase()))&&(J.isNullOrUndefined(e[s+1])||-1<this.indexOfAny(e[s+1],i)))r="&"===(r=J.isNullOrUndefined(e[s+1])?this.emptyStr:e[s+1])&&"-"!==e[s+2]?"":r,a="-"===e[s-1]?a+e[s-1]+e[s]+r:a+e[s]+r,s+=2;else if(-1<this.indexOfAny(e[s],o)&&!J.isNullOrUndefined(e[s-1])&&!J.isNullOrUndefined(e[s+1]))a+=e[s],s+=1;else if("q"===e[s])for(;e[s]!==this.parent.leftBracket;)a+=e[s],s+=1;else(e[s]===this.parent.leftBracket||e[s]===this.parent.rightBracket||"{"===e[s]||"}"===e[s]||"("===e[s]||")"===e[s]||this.parent.isUpperChar(e[s])||-1<e[s].indexOf(":")||e[s]===this.parent.getParseArgumentSeparator()||"%"===e[s]&&this.parent.isDigit(e[s-1])||e[s]===this.parent.tic||" "===e[s]||e[s]===this.parent.getParseDecimalSeparator()||e[s]===this.sheetToken||"$"===e[s]||"_"===e[s]||(this.parent.isDigit(e[s])&&(a="-"===e[s-1]?a+e[s-1]+e[s]:a+e[s]),"-"!==e[s]&&"+"!==e[s]||(a=(a+=e[s]).split("++").join("+").split("+-").join("-").split("-+").join("-")),"/"===e[s])||"*"===e[s]||"^"===e[s])&&(a+=e[s]),s+=1;return a=a===this.emptyStr?e:a,a=(a=-1<this.indexOfAny(a[a.length-1],i)?a.substring(0,a.length-1):a).split("--").join("-").split("-+").join("-").split("+-").join("-")},lo.prototype.checkScopedRange=function(n){var i,e,t,o=this,s=(this.emptyStr,"NaN"),r=this.parent.getSheetID(this.parent.grid),a=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!==a&&null!=a.sheetNameToToken&&a.sheetNameToToken.forEach(function(e,t){var r;a.sheetNameToToken.get(t).toString()===l+"!"&&(r=o.emptyStr,o.parent.namedRanges.forEach(function(e,t){r=J.isNullOrUndefined(o.parent.parentObject)?a.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(),s=i)}))}),s},lo.prototype.storeStrings=function(e){var t,r,n,i=0,o=0,s=null;if(-1<e.indexOf(this.parent.tic))for(i=e.indexOf(this.parent.tic);-1<i&&0<e.length;){if(null===s&&(s=this.stringsColl),-1===(t=i+1<e.length?e.indexOf(this.parent.tic,i+1):-1))throw new fo(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,s=s.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,s},lo.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},lo.prototype.parseSimple=function(e){var t,r,n,i,o,s,a,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],s=[this.tokenLess,this.tokenGreater,this.tokenEqual,this.tokenLessEq,this.tokenGreaterEq,this.tokenNotEqual],a=[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,s,a),e=this.parseSimpleOperators(e,h,d)),e)},lo.prototype.parseSimpleOperators=function(e,t,r){if(-1<this.parent.getErrorStrings().indexOf(e))return e;for(var n=e,i=0,o="",s=0;s<r.length;s++)o+=r[s];if(0<(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()).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 a,l=n.split(this.parent.getParseArgumentSeparator()),h=0;h<l.length;h++)l[h].startsWith("u")&&(a=l[h].split("u").join("0-"),a=this.parseSimpleOperators(a,[this.tokenSubtract],[this.charSubtract]),l[h]=a);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 fo(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 fo(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 fo(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 fo(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)&&(J.isNullOrUndefined(n[x-5])||-1<C.indexOf(n[x-5]))||"FALSE"===n.substring(x-5,x)&&(J.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 R=!1;(R=0<x&&!this.parent.isUpperChar(n[x])?"u"===n[x]&&n[x-1]===this.parent.getParseArgumentSeparator():R)||(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 fo(this.parent.formulaErrorStrings[z.FormulasErrorsStrings.ExpressionCannotEndWithAnOperator]);if((R="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 fo(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),R&&(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 N=0,A=!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&&A);)x!==n.length-1&&"["===n[x]&&"["===n[x+1]&&(A=!0),x!==n.length-1&&"]"===n[x]&&"]"===n[x+1]&&(A=!1),x++,N++;var k=x===n.length||!this.parent.isDigit(n[x]);if(1<N){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),(R="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 F=-1<["*","+","-","/","w"].indexOf(n[x-g.length]),g="TRUE"===g&&(y||F)?"n1":"FALSE"===g&&(y||F)?"n0":g,v=x+1}var M=o.indexOf(n[i]),O=this.parent.arithMarker+f+g+t[M]+this.parent.arithMarker;0<m&&(O=n.substring(0,m)+O),v<n.length&&(O+=n.substring(v)),n=O=O.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){return e}},lo.prototype.indexOfAny=function(e,t){for(var r=0;r<e.length;r++)if(-1<t.indexOf(e[r]))return r;return-1},lo.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},lo.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},lo.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=(J.isNullOrUndefined(this.parent.getErrorLine(e))?"":"#"+this.parent.getErrorLine(e)+": ")+r,this.isError=!0}return t},lo.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 fo(this.parent.formulaErrorStrings[z.FormulasErrorsStrings.MismatchedParentheses]);for(var o=i-1;-1<o&&this.parent.isChar(e[o]);)o--;var s=i-o-1,a=this.parent.substring(e,o+1,s);if(0<s&&!J.isNullOrUndefined(this.parent.getFunction(a))){var l=this.parent.substring(e,i,r-i+1),h=this.parent.getParseArgumentSeparator();"AREAS"===a?this.ignoreBracet=!0:(this.ignoreBracet=!1,a.includes("IFS")&&"COUNTIFS"!==a&&l.includes("{")&&(a=l.indexOf("{"),a=this.parent.substring(l,a,l.indexOf("}")-a+1),l=l.split(a).join(a.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,s)+l.split("(").join(this.parent.leftBracket).split(")").join(this.parent.rightBracket)+e.substring(r+1)}else{if(0<s)return this.parent.getErrorStrings()[z.CommonErrors.Name];a=this.emptyStr,a=(a=0<i?e.substring(0,i):a)+"{"+this.parent.substring(e,i+1,r-i-1)+"}";r<e.length&&(a+=e.substring(r+1)),e=a=this.markNamedRanges(a)}r=e.indexOf(")")}return e=e.split("{").join("(").split("}").join(")")},lo.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},lo.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)},lo.prototype.lastIndexOfAny=function(e,t){for(var r=e.length-1;-1<r;r--)if(-1<t.indexOf(e[r]))return r;return-1},lo.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))),J.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()),!J.isNullOrUndefined(o))&&this.findNamedRange&&-1<o.indexOf(this.fixedReference)&&(o=o.split(this.fixedReference).join(this.emptyStr)),J.isNullOrUndefined(o)||(o=o.toUpperCase(),o=this.parent.setTokensForSheets(o),o=this.markLibraryFormulas(o)),J.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,J.isNullOrUndefined(o)&&"NaN"!==(i=this.checkScopedRange(e.substring(r)))&&(o=i),J.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},lo.prototype.checkForNamedRangeAndKeyValue=function(e){var t,r;this.emptyStr;return-1<e.indexOf("[")&&(t=this.getTableRange(e),J.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())&&(J.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},lo.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()},lo.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 ao=lo;function lo(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}ho=function(e,t){return(ho=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 ho,po,co,e=function(e,t){function r(){this.constructor=e}ho(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,s=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;0<=a;a--)(i=e[a])&&(s=(o<3?i(s):3<o?i(t,r,s):i(t,r))||s);return 3<o&&s&&Object.defineProperty(t,r,s),s},uo=(po=J.Base,e(i,po),co=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 to(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=this.getSheetFamilyItem(this.grid),r=this.cell;r!==this.emptyString&&(null!==t.sheetNameToParentObject&&(t=t.parentObjectToToken.get(this.grid),-1===r.indexOf(this.sheetToken)&&(r=t+r),-1===e.indexOf(this.sheetToken))&&(e=t+e),this.getDependentCells().has(e)?(t=this.getDependentCells().get(e)).indexOf(r)<0&&r!==e&&t.push(r):this.getDependentCells().set(e,[r]),this.addToFormulaDependentCells(e))},i.prototype.addToFormulaDependentCells=function(e){var t=this.cell,r=this.getSheetFamilyItem(this.grid);null!=r.sheetNameToParentObject&&-1===t.indexOf(this.sheetToken)&&(t=r.parentObjectToToken.get(this.grid)+t),this.getDependentFormulaCells().has(t)?this.getDependentFormulaCells().get(t).has(e)||this.getDependentFormulaCells().get(t).set(e,e):(this.getDependentFormulaCells().set(t,new Map),this.getDependentFormulaCells().get(t).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 vo),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 vo),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 go),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(J.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 s=o+1;s<e.length;){if(e[s]===this.sheetToken){i=e.substr(0,s+1);break}s++}if(0<(p=e.indexOf(":"))&&this.isChar(e[p-1]))for(var a=p-2;0<=a&&this.isDigit(e[a]);)a--;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 s=e.substring(e.indexOf(b.leftBracket)+1,e.indexOf(b.rightBracket)),a=(r=[],b.getParseArgumentSeparator()),l="",h=void 0,d=0,p=s.length-1;d<=p;d++)'"'===s[d]&&(h=!h),s[d]!==a||h?l+=s[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=J.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=(J.isNullOrUndefined(this.getErrorLine(e))?"":"#"+this.getErrorLine(e)+": ")+t}return x},i.prototype.computeSumIfAndAvgIf=function(e,t){if(J.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])&&J.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,s,a,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]:(s=o.includes("*"),a=o.includes("?"),h=s?o.replace(/\*/g,"").trim():o,d=!1,!p&&this.isCellReference(h)&&(h=this.getValueFromArg(h),d=!0),o=h=s&&(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())&&!s&&!a)&&(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,s,a))[0],t[1]]))},i.prototype.computeLookup=function(e){var t,r,n,i=[],o=[],s=[],a=[],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+j(v)+d+":"+j(v)+f,r=u+j(y)+d+":"+j(y)+f):p<c&&(t=u+j(v)+d+":"+j(y)+d,r=u+j(v)+f+":"+j(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=Q(e[1]),u=Q(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++)a.push(this.getValueFromArg(i[g]).split(this.tic).join(""));var m=a.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++)s[S]=this.getValueFromArg(i[S]).split(this.tic).join(""),J.isNullOrUndefined(o[S])||""===n||""===s[S]||(n.toUpperCase()===s[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(),s[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++)s[w]=m[w].toString().split(this.tic).join(""),J.isNullOrUndefined(o[w])||""===s[w]||C!==this.parseFloat(s[w])||l.push(this.getValueFromArg(o[w]).split(this.tic).join("")||"0");if(0<l.length)return l[l.length-1];if(v<C&&!J.isNullOrUndefined(o[i.length-1]))return this.getValueFromArg(o[i.length-1]).split(this.tic).join("")||"0";if(!(C<y)&&a.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=a.sort(),E=this.findClosestMatch(n.split(this.tic).join(""),I);if(!J.isNullOrUndefined(o[E])&&0<=E)return this.getValueFromArg(o[E]).split(this.tic).join("")||"0"}}else{for(var R=[],N=0;N<m.length;N++)C>m[N]&&R.push(m[N]);var E=R.length-1;if(!J.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,n,i,o=[],s=[],a=[],t=t?this.trueValue:this.falseValue;if(""!==e[0]&&""!==e[1]){if(r=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("")))&&(r=r.split(this.tic).join("")),-1<this.getErrorStrings().indexOf(r))return r;var l=(l=this.isCellReference(e[2])||e[2].includes(this.arithMarker)?this.getValueFromArg(e[2])||"0":this.getValueFromArg(e[2]).split(this.tic).join("")).toUpperCase()===this.trueValue?"1":l.toUpperCase()===this.falseValue?"0":l,l=this.parseFloat(l),h=e[1].split(":");if(this.isCellReference(h[0])&&this.isCellReference(h[1])){var d=e[1].indexOf(":"),h=this.rowIndex(this.substring(e[1],0,d)),p=this.colIndex(this.substring(e[1],0,d)),c=this.rowIndex(this.substring(e[1],d+1,d+e[1].length-d-1)),u=this.colIndex(this.substring(e[1],d+1,d+e[1].length-d-1)),f=(c<h&&(h=(f=[c,h])[0],c=f[1]),u<p&&(p=(f=[u,p])[0],u=f[1]),""),g=(0===e[1].indexOf("!")&&(f=(f=(f=e[1]).replace("!","")).indexOf("!"),f=e[1].substring(0,f+2)),n=t===this.trueValue?f+j(p)+h+":"+j(p)+c:f+j(p)+h+":"+j(u)+h,void 0);if(t===this.trueValue){if(u<(g=p+l-1))return this.getErrorStrings()[z.CommonErrors.Ref]}else if(c<(g=h+l-1))return this.getErrorStrings()[z.CommonErrors.Ref];if(l<1||this.isNaN(l))return this.getErrorStrings()[z.CommonErrors.Value];c=t===this.trueValue?f+j(g)+h+":"+j(g)+c:f+j(p)+g+":"+j(u)+g}if(e[3]=e[3]||this.trueValue,this.isCellReference(e[3])?e[3]=this.getValueFromArg(e[3]):e[3]=this.getValueFromArg(e[3]).split(this.tic).join(""),-1<this.getErrorStrings().indexOf(e[3]))return e[3];if(e[3].toUpperCase()===this.falseValue||"0"===e[3])i=this.falseValue;else{if(e[3].toUpperCase()!==this.trueValue&&"1"!==e[3])return this.getErrorStrings()[z.CommonErrors.Value];i=this.trueValue}for(var m=this.getCellCollection(n),v=this.getCellCollection(c),y=0;y<m.length;y++)s.push(this.getValueFromArg(m[y]).split(this.tic).join(""));var C=this.parseFloat(r);if("FALSE"===i){for(var b,x,S=0;S<m.length;S++)o[S]=this.getValueFromArg(m[S]).split(this.tic).join(""),J.isNullOrUndefined(v[S])||(!this.isNaN(C)&&""!==o[S]&&C===this.parseFloat(o[S])||""!==o[S]&&r.toUpperCase()===o[S].toUpperCase()||(-1<r.indexOf("*")||-1<r.indexOf("?"))&&(-1<(x=r).indexOf("*")&&(x=x.replace(/\*/g,"").trim(),this.isCellReference(x)&&(x=this.getValueFromArg(x)),b=r.indexOf("*"),"*"===r[0]&&(x="*"+x),"*"===r[r.length-1]&&(x+="*"),0<b)&&b<r.length-1&&(x=r.substring(0,b)+"*"+r.substring(b+1)),b=[],x=this.findWildCardValue(x.toLowerCase(),o[S].toLowerCase()),b.push(x),b.push(r),this.processLogical(b,"equal")===this.trueValue))&&a.push(this.getValueFromArg(v[S]).split(this.tic).join("")||"0");return 0<a.length?a[0]:this.getErrorStrings()[z.CommonErrors.NA]}if("TRUE"===i){for(var w=s.map(function(e){return""===e?NaN:Number(e)}).sort(function(e,t){return e-t}),l=w[w.length-1],t=w[0],I=r.toUpperCase(),E=0;E<m.length;E++)o[E]=this.getValueFromArg(m[E]).split(this.tic).join(""),(J.isNullOrUndefined(v[E])||""===r||""===o[E]||I!==this.trueValue&&I!==this.falseValue||I!==o[E].toUpperCase())&&(J.isNullOrUndefined(v[E])||""===r||""===o[E]||I!==o[E].toUpperCase())||a.push(this.getValueFromArg(v[E]).split(this.tic).join("")||"0");for(var R=0;R<w.length;R++)o[R]=w[R].toString().split(this.tic).join(""),J.isNullOrUndefined(v[R])||""===r||this.isNaN(C)||""===o[R]||C!==this.parseFloat(o[R])||a.push(this.getValueFromArg(v[R]).split(this.tic).join("")||"0");if(0<a.length)return a[a.length-1];if(-1<r.indexOf("*")||-1<r.indexOf("?")||I.split(this.tic).join("")===this.trueValue||I.split(this.tic).join("")===this.falseValue)return this.getErrorStrings()[z.CommonErrors.NA];if(l<C&&!J.isNullOrUndefined(v[m.length-1]))return this.getValueFromArg(v[m.length-1]).split(this.tic).join("");if(s.indexOf(r.split(this.tic).join(""))<0&&r!==this.trueValue&&r!==this.falseValue)if(this.isNaN(C)||""===r||this.isNaN(l)||this.isNaN(t)){if(this.isNaN(C)&&""!==r&&this.isNaN(l)&&this.isNaN(t)){h=s.sort(),d=this.findClosestMatch(r.split(this.tic).join(""),h);if(!J.isNullOrUndefined(v[d])&&0<=d)return this.getValueFromArg(v[d]).split(this.tic).join("")||"0"}}else{for(var N=[],A=0;A<w.length;A++)C>w[A]&&N.push(w[A]);d=N.length-1;if(!J.isNullOrUndefined(v[d])&&0<=d)return this.getValueFromArg(v[d]).split(this.tic).join("")||"0"}}}return this.getErrorStrings()[z.CommonErrors.NA]},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 s=r-1;0<=s;s--)if(-1!==this.compareStrings(e.toLowerCase(),t[s].toLowerCase()))return s;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="",s=this.falseValue,a=this.falseValue,l=n-1;0<=l;l--)i+=e[l],a=this.trueValue;for(l=n+1;l<e.length;l++)o+=e[l],s=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),a===this.trueValue&&s===this.trueValue&&this.isNaN(this.parseFloat(i))&&this.isNaN(this.parseFloat(o))?r=n&&h?e:t:a===this.trueValue&&this.isNaN(this.parseFloat(i))?r=n?e:t:s===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,s){var a=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)||(a+=v,l+=1)):c===r?this.isNaN(p)||(a+=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)||(a+=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)&&(a+=p,l+=1)):o&&!h&&c&&this.isNaN(this.parseFloat(c))?this.isNaN(p)||(a+=p,l+=1):s&&h&&c&&this.isNaN(this.parseFloat(c))&&(g=RegExp(h.replace(/\?/g,"[\\s\\S]")),c.length===r.length)&&c.match(g)&&!this.isNaN(p)&&(a+=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)||(a+=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)||(a+=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)||(a+=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)||(a+=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||s?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)||(a+=p,l+=1):(-1<f&&!c.startsWith(r.substr(0,f))||!c.endsWith(r.substr(f+1)))&&!this.isNaN(p)&&(a+=p,l+=1)):!o||h||this.isNaN(this.parseFloat(c))?s&&h&&c&&this.isNaN(this.parseFloat(c))&&(g=RegExp(h.replace(/\?/g,"[\\s\\S]")),c.length===r.length&&c.match(g)||this.isNaN(p)||(a+=p,l+=1)):this.isNaN(p)||(a+=p,l+=1):(m=this.getValueFromArg(t[d].split(this.tic).join("")),v=this.parseFloat(m),this.isNaN(v)||(a+=v,l+=1))}}return[a,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,s="or"===t,a="not"===t,l=o||a,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||a&&""===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||a)&&h[u]===this.falseValue){l=!1;break}if(s&&h[u]===this.trueValue){l=!0;break}}return(l=a?!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=j(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=j(t).toString()+e.toString()),n},i.prototype.computeValue=function(e,t,r){try{for(var n=[],i=0,o="",s=(n.length=0,this.getParseDecimalSeparator());i<e.length;){var a="u"===e[i];if(a&&(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]===s);)l+=e[i]===s?".":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;a&&(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]&&!a&&"-"!==e[i]||(l="-",a)||(i+=1);i<e.length&&(this.isDigit(e[i])||e[i]===s||"."===e[i]);)l+=e[i]===s?".":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 fo(this.formulaErrorStrings[z.FormulasErrorsStrings.InvalidExpression])}},i.prototype.getValArithmetic=function(e,t,r){var n=!1,i=e.pop(),o=e.pop(),s=(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(s)&&!r&&(n=!0,i===this.getErrorStrings()[z.CommonErrors.DivZero]?e.push(this.getErrorStrings()[z.CommonErrors.DivZero]):e.push(this.getErrorStrings()[z.CommonErrors.Value])),o=(o=o===this.trueValue?"1":o===this.falseValue?"0":o)===this.emptyString?"0":this.getErrorStrings().indexOf(o.toString())<0?this.parseFloat(o+"").toString():o,s=Number(o),isNaN(s)&&!r&&(n=!0,o===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(o)+Number(i)).toString()),"sub"!==t||n||e.push((Number(o)-Number(i)).toString()),"mul"!==t||n||e.push((Number(o)*Number(i)).toString()),"div"!==t||n||(this.isNaN(this.parseFloat(i))||this.isNaN(this.parseFloat(o))?e.push(this.getErrorStrings()[z.CommonErrors.Value]):0===this.parseFloat(i)?e.push(this.getErrorStrings()[z.CommonErrors.DivZero]):e.push((Number(o)/Number(i)).toString()))},i.prototype.processLogical=function(e,t){var r,n,i,o,s,a,l=!1;return"and"!==t&&"equal"!==t&&(r=e.pop(),n=e.pop(),-1<this.getErrorStrings().indexOf(r)?(a=r,l=!0):-1<this.getErrorStrings().indexOf(n)&&(a=n,l=!0),this.isNaN(this.parseFloat(r))&&this.isNaN(this.parseFloat(n))&&(r=r.toString().toLowerCase(),n=n.toString().toLowerCase()),J.isNullOrUndefined(r)||(i=-1<r.indexOf(this.tic)?r:this.parseFloat(r)),J.isNullOrUndefined(n)||(o=-1<n.indexOf(this.tic)?n:this.parseFloat(n)),"*"===r)&&this.isNaN(this.parseFloat(n))&&""!==n&&(s=!0),"less"!==t||l||(a=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||(a=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||(a=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||(a=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||(a=n!==r?this.trueValue:this.falseValue,s&&(a=this.falseValue)),"and"!==t||l||(r=e.pop().toString(),n="",0<e.length&&(n=e.pop().toString()),a=-1<this.getErrorStrings().indexOf(r)?r:-1<this.getErrorStrings().indexOf(n)?n:(a=this.emptyString+n+r+this.emptyString).split(this.tic).join("")),"equal"!==t||l||(r=e.pop(),n=e.pop(),a=-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&&(s=!0),r===n||s?this.trueValue:this.falseValue)),"or"!==t||l||(a=Math.pow(this.parseFloat(o),this.parseFloat(i)).toString(),a=this.isNaN(this.parseFloat(a))?this.getErrorStrings()[z.CommonErrors.Value]:a),e.push(a),a},i.prototype.computeStoreCells=function(e){for(var t=e.cellValue,r=e.cellRange,n=e.criteria,i=e.argArray,o=e.isCriteria,s=e.storedCells,a=e.isCountIfS===this.trueValue,l=e.countVal||0,h=o===this.trueValue?s:t,d=[],p=0;p<h.length;p++){var c=[],u=this.getValueFromArg(t[p]),f=i[a?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=a?this.trueValue:o)===this.trueValue){var x="",S=0,w=0,v=void 0,m=void 0,y=void 0,I=void 0,v=(s[p]=(a&&!l?t:s)[p],x=s[p],l&&(m=-1<(v=r[l-1]).indexOf("!")?Q(v.substring(v.lastIndexOf("!")+1)):Q(v),y=-1<x.indexOf("!")?W(x.substring(x.lastIndexOf("!")+1)):W(x),I=-1<r[l].indexOf("!")?Q(r[l].substring(r[l].lastIndexOf("!")+1)):Q(r[l])),-1<x.indexOf("!")),E=void 0,R="",N="";for(v&&(N=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=a&&!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("!"))&&(R=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),A=this.substring(b,w,b.length-S);v&&(I=N+I,y=N+y),m!==A&&(s[p]=this.substring(s[p],v?N.length+S:S)+A),b=s[p].split(I).join(y),b=E?R+(b=-1<b.indexOf("!")?b.substring(b.lastIndexOf("!")+1):b):b.substring(b.lastIndexOf("!")+1),u=this.getValueFromArg(b),f=a?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||a))&&!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 s=d,d=[],s},i.prototype.computeIfsFormulas=function(e,t,r){if(t===this.trueValue&&(J.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=[],s=[],a=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:s,isCountIfS:t};if(0===(s=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:s,isCountIfS:t,countVal:l};if(0===(s=this.computeStoreCells(f)).length)return r===this.trueValue?this.getErrorStrings()[z.CommonErrors.DivZero]:0}for(var g=0,m=-1<i[0].indexOf("!")?Q(i[0].substring(i[0].lastIndexOf("!")+1)):Q(i[0]),e=i[i.length-1],v=-1<e.indexOf("!")?Q(e.substring(e.lastIndexOf("!")+1)):Q(e),d=0;d<s.length;d++){var y="",C="",b=0,x=0,S=-1<(y=s[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 R=this.substring(y,b),N=this.substring(C,x),A=this.substring(y,b,y.length-b),k=this.substring(C,x,C.length-b);S&&(R=E+R,N=E+N),A!==k&&(s[d]=this.substring(s[d],S?E.length+b:b)+k),c=s[d].split(R).join(N),c=w?I+(c=-1<c.indexOf("!")?c.substring(c.lastIndexOf("!")+1):c):c.substring(c.lastIndexOf("!")+1),t===this.trueValue?a+=1:(A=this.getValueFromArg(c),S=parseFloat(""===A&&r!==this.trueValue?"0":A),this.isNumber(S)&&(g++,a+=S))}return r===this.trueValue&&(a/=g),a},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 s=Date.parse(e+"/"+t+"/"+r);return n=this.isNaN(s)?n:this.toOADate(new Date(s))},i.prototype.intToTime=function(e){var t=e.toString().split(".");return J.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=Rn(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(e,t,r,n){var i=e=e.trim(),o=this.dateTime1900,s=i;if(J.isNullOrUndefined(i)||this.isTextEmpty(i))return i;if(e[0]===this.tic||e[0]===this.singleTic)return a=e.split(this.tic).join(""),o=this.isDate(a),this.isNaN(this.parseFloat(a))&&!J.isNullOrUndefined(o)&&!this.isNaN(o.getDate())&&this.dateTime1900<=o?this.toOADate(o,!0).toString():e[e.length-1]===this.tic&&"."!==(l=this.getParseDecimalSeparator())&&a.includes(l)&&(a=a.replace(l,"."),this.isNumber(a))?a:e;e=e.split("u").join("-");var a,l=this.getParseDecimalSeparator();if(!this.isUpperChar(i[0])&&(this.isDigit(i[0])||i[0]===l||"-"===i[0]||"n"===i[0]))return"n"===i[0]&&-1<(i=i.substring(1)).indexOf('"n')&&(i=i.replace('"n','"')),i="."!==l&&i.includes(l)&&(a=i.replace(l,"."),this.isNumber(a))?a:i;if(-1===this.parser.indexOfAny(i,["+","-","/","*",")",")","{"])&&this.isUpperChar(i[0])||i[0]===this.sheetToken){if((i=i!==this.trueValue&&i!==this.falseValue&&this.isCellReference(i)&&null!==(o=this.getSheetFamilyItem(this.grid)).sheetNameToParentObject&&0<o.sheetNameToParentObject.size&&-1===i.indexOf(this.sheetToken)?o.parentObjectToToken.get(this.grid)+i:i)===this.cell){l=this.getDependentCells().get(i);if(null!=l&&-1<l.indexOf(i)&&this.arrayRemove(l,i),this.getDependentFormulaCells().has(this.cell)||this.clearFormulaDependentCells(this.cell),!t)throw new fo(this.formulaErrorStrings[z.FormulasErrorsStrings.CircularReference]+i)}return s=this.getParentObjectCellValue(i,!1,t,n),this.updateDependentCell(i),s.toString()}return-1<this.getErrorStrings().indexOf(e)?e:this.computeValue(s.toString(),!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(J.isNullOrUndefined(i[r])||!(i[r].charCodeAt(0)<n[r])){if(J.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()),s=0;s<o.length;s++)if(this.isChar(o[s]))n=!0;else if(this.isDigit(o[s]))i=!0;else{if(":"!==o[s])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),s=this.singleTic+"SHEET"+n[i]+this.singleTic+this.sheetToken;-1===e.indexOf(s)&&(s="SHEET"+n[i]+this.sheetToken),e=e.split(s).join(o),s=n[i]+this.sheetToken,e=e.split(s).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=0,s=0,a=this.grid,l=this.getSheetFamilyItem(a);if(-1<i&&null!==l.tokenToParentObject)this.grid=l.tokenToParentObject.get(e.substring(0,i+1)),o=this.rowIndex(e),s=this.colIndex(e);else if(-1===i){for(var h=0;h<e.length&&this.isChar(e[h]);)h++;if(h===e.length||!this.isValidCell(e))return""===(e=e.toLowerCase())?this.getErrorStrings()[z.CommonErrors.Value]:this.getErrorStrings()[z.CommonErrors.Name];o=this.rowIndex(e),s=this.colIndex(e),l.isSheetMember&&null!=l.parentObjectToToken&&(e=l.parentObjectToToken.get(this.grid)+e)}i=""===this.cell||null===this.cell?"":this.cell;if(this.cell=e,i!==this.cell||r)return l=this.getParentCellValue(o,s,this.grid,i,a,t,r,n),this.grid=a,this.cell=i,l;throw this.formulaErrorStrings[z.FormulasErrorsStrings.CircularReference]},i.prototype.getParentCellValue=function(e,t,r,n,i,o,s,a){var l=this.getSheetId(r);return r=void 0===this.parentObject.getValueRowCol?this.getValueRowCol(l,e,t):(n=n&&(i===r?"":n+","+(i&&"string"==typeof i&&-1<Number(i)?i:this.getSheetID(i))),this.parentObject.getValueRowCol(l,e,t,n,o,s,a)),J.isNullOrUndefined(r)?r=this.emptyString:(r=r.toString(),"."!==(i=this.getParseDecimalSeparator())&&r.includes(i)&&(l=r.replace(i,"."),this.isNumber(l))&&(r=l)),r},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=J.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,s,a){var l=t,n=(this.spreadSheetUsedRange=n,this.grid=t,!0),t=!0,h=this.getSheetFamilyItem(l),d=j(e.getColIndex())+e.getRowIndex().toString(),o=(this.actCell=o+"!"+d,null!==h.sheetNameToParentObject&&0<h.sheetNameToParentObject.size&&(d=h.parentObjectToToken.get(l)+d),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(d))&&(h=this.randCollection.toString(),this.randomValues.has(d)?this.randomValues.has(d)&&(-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(d,e.getValue()):e.getValue().toUpperCase()!==this.randomValues.get(d.toUpperCase())&&(this.randomValues.delete(d),h=h.split(d+this.parseArgumentSeparator).join("").split(this.parseArgumentSeparator+d).join("").split(d).join(""),this.randCollection=h.split(this.parseArgumentSeparator)),0===this.randomValues.size)&&this.randCollection.length&&(this.isRandomVal=!1,this.randomValues.clear(),this.randCollection=[]):(this.randomValues.set(d,e.getValue()),this.randCollection.push(d),this.isRandomVal=!0)),e.getValue()&&e.getValue()[0]===this.getFormulaCharacter()){this.cell=d;o=void 0;if(J.isNullOrUndefined(t)||(t=r),this.getFormulaInfoTable().has(d)){if(o=this.getFormulaInfoTable().get(d),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}}t&&(this.parser.isFormulaParsed=!0,n=(h=this.calculateFormula(o.getParsedFormula(),i))!==o.getFormulaValue(),o.setFormulaValue(h))}else{(o=new go).setFormulaText(e.getValue()),this.getDependentFormulaCells().has(d)||this.getDependentFormulaCells().set(d,new Map);try{o.setParsedFormula(this.parser.parseFormula(e.getValue()))}catch(e){o.setFormulaValue(e),t=!1}t&&o.setFormulaValue(this.calculateFormula(o.getParsedFormula(),i)),this.getFormulaInfoTable().has(d),this.getFormulaInfoTable().set(d,o)}t&&(void 0===this.parentObject.setValueRowCol?this.setValueRowCol(this.getSheetID(l)+1,o.getFormulaValue(),e.getRowIndex(),e.getColIndex()):this.parentObject.setValueRowCol(this.getSheetId(l),o.getFormulaValue(),e.getRowIndex(),e.getColIndex(),o.getFormulaText(),s))}else this.getFormulaInfoTable().has(d)&&(this.getFormulaInfoTable().delete(d),this.getDependentFormulaCells().has(d))&&this.clearFormulaDependentCells(d);t&&n&&this.getDependentCells().has(d)&&this.getDependentCells().get(d).toString()!==d&&this.refresh(d,void 0,void 0,a)},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()),J.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 s=e;if(255<s.length)return this.getErrorStrings()[z.CommonErrors.Value];for(var a=0;a<s.length;a++)if(-1<s[a].indexOf(":")&&this.isCellReference(s[a]))for(var l=this.getCellCollection(s[a]),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(s[a],null,null,!0):this.getValueFromArg(s[a]);if(!r||!p.includes("SUBTOTAL(")){var c=0,u=this.isCellReference(s[a]),f=""===p&&u,g=this.isNaN(this.parseFloat(p))&&u,u=p===(this.trueValue||this.falseValue)&&u;if(s[a]=s[a].startsWith("n")?s[a].slice(1):s[a],-1<this.getErrorStrings().indexOf(p))return p;if(p===this.trueValue&&s[a]===this.trueValue)p="1";else if(p===this.falseValue&&s[a]===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,s=0,a=0;a<i.length;a++)if(this.isCellReference(i[a])){if(-1<i[a].indexOf(":")){for(var l=this.getCellCollection(i[a]),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;J.isNullOrUndefined(r)||isNaN(this.parseFloat(r))||""===r||(o+=this.parseFloat(r),s+=1)}}else if(r=t?this.getValueFromArg(i[a],null,null,!0):this.getValueFromArg(i[a]),!t||!r.includes("SUBTOTAL(")){if(-1<this.getErrorStrings().indexOf(r))return r;J.isNullOrUndefined(r)||isNaN(this.parseFloat(r))||""===r||(o+=this.parseFloat(r),s+=1)}}else{if(-1<i[a].indexOf(this.tic)&&(isNaN(this.parseFloat(i[a].split(this.tic).join("")))||""===i[a].split(this.tic).join("").trim()))return this.getErrorStrings()[z.CommonErrors.Value];if(0!==i[a].length&&e[a]!==this.falseValue||(i[a]="0"),e[a]===this.trueValue&&(i[a]="1"),n=this.getValueFromArg(i[a].split(this.tic).join("")),-1<this.getErrorStrings().indexOf(n))return n;o+=this.parseFloat(n),s+=1}return 0===s?this.getErrorStrings()[z.CommonErrors.DivZero]:(o/s).toString()},i.prototype.registerGridAsSheet=function(e,t,r){J.isNullOrUndefined(this.modelToSheetID)&&(this.modelToSheetID=new Map),J.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),J.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 s=this,r=[e];o&&(r=[],J.isNullOrUndefined(this.modelToSheetID)||this.modelToSheetID.forEach(function(e,t){r.push(t)})),r.forEach(function(e){var t,r=s.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!J.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,n){var i,o=this;if(r||(i=!0,r=[]),this.getDependentCells().has(e)){var s=this.getSheetFamilyItem(this.grid);try{for(var a,l,h,d,p,c,u=this.getDependentCells().get(e),f=void 0,f=0;f<u.length;f++){var g=u[f];if(!(t&&-1<g.indexOf(t)||g===e||-1<r.indexOf(g))){var m=this.getSheetToken(g),v=this.parentObject.sheets,y=this.parentObject.activeSheetIndex;if(m.length){this.grid=s.tokenToParentObject.get(m);var C=Number(this.grid),b="";if(!this.isNaN(C)&&v)for(var x=0;x<v.length;x++)v[x].id===C&&(b=v[x].name,y=x);this.actCell=b+"!"+g.split(m)[1]}else this.actCell=g.split(m)[1];try{var S=function(e,t){t&&(o.cell=e,o.parser.isFormulaParsed=!0,t.setFormulaValue(o.calculateFormula(t.getParsedFormula(),!0)))},w=this.rowIndex(g),I=this.colIndex(g),E=this.getFormulaInfoTable().get(g);if(void 0===this.parentObject.setValueRowCol)S(g,E),this.setValueRowCol(this.getSheetID(this.grid)+1,E.getFormulaValue(),w,I);else{var R=v&&v[y].rows&&v[y].rows[w-1]&&v[y].rows[w-1].cells&&v[y].rows[w-1].cells[I-1],N=void 0;if(R&&R.formula&&R.formula.toLowerCase().includes("unique")){if(this.uniqueCells&&-1!==this.uniqueCells.indexOf(g))continue;this.uniqueCells||(this.uniqueCells=[]),this.uniqueCells.push(g),S(g,E),N=E.getFormulaValue(),this.uniqueCells.splice(this.uniqueCells.indexOf(g),1),this.uniqueCells.length||(this.uniqueCells=null)}else-1===r.indexOf(g)&&r.push(g),N=null;this.parentObject.setValueRowCol(this.getSheetId(this.grid),N,w,I,E.getFormulaText())}this.refresh(g,null,r)}catch(e){continue}}}i&&(r=(c=this.parentObject.sheets)?r:[]).forEach(function(e){a=o.getSheetId(s.tokenToParentObject.get(o.getSheetToken(e)));for(var t=0;t<c.length;t++)if(c[t].id===a){l=t;break}h=o.rowIndex(e)-1,d=o.colIndex(e)-1,(p=c[l].rows[h]&&c[l].rows[h].cells[d])&&o.parentObject.notify("calculateFormula",{cell:p,rowIdx:h,colIdx:d,sheetIndex:l,isDependentRefresh:!0,isRandomFormula:n})})}finally{this.grid=s.tokenToParentObject.get(this.getSheetToken(e))}}},n([J.Property(!0)],i.prototype,"includeBasicFormulas",void 0),n([J.Event()],i.prototype,"onFailure",void 0),co=n([J.NotifyPropertyChanges],i));function i(e){var t=po.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","circular reference: ","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 io(t));return t.includeBasicFormulas&&co.Inject(so),t.injectedModules&&t.injectedModules.length&&r.inject(t.requiredModules(),t.injectedModules),t.parentObject=J.isNullOrUndefined(e)?t:e,t.grid=t.parentObject,t.parser=new ao(t),t}var fo=function(e,t){this.formulaCorrection=!1,this.message=e,this.formulaCorrection=t},go=(mo.prototype.getFormulaText=function(){return this.formulaText},mo.prototype.setFormulaText=function(e){this.formulaText=e},mo.prototype.getFormulaValue=function(){return this.formulaValue},mo.prototype.setFormulaValue=function(e){this.formulaValue=e},mo.prototype.getParsedFormula=function(){return this.parsedFormula},mo.prototype.setParsedFormula=function(e){this.parsedFormula=e},mo);function mo(){this.calcID=Number.MIN_VALUE+1,this.calcID1=Number.MIN_VALUE+1}var vo=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 j(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 yo=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},Co=(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(re,this.performFormulaOperation,this),this.parent.on(Vt,this.aggregateComputation,this),this.parent.on(Ut,this.getUniqueRange,this),this.parent.on(_t,this.removeUniquecol,this),this.parent.on(qt,this.clearFormulaDependentCells,this),this.parent.on(Wt,this.formulaInValidation,this),this.parent.on(pn,this.refreshInsertDelete,this),this.parent.on(cn,this.getUpdatedFormulaOnInsertDelete,this),this.parent.on(vn,this.autoCorrectCellRef,this),this.parent.on(yn,this.parseFormulaArgument,this)},o.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(re,this.performFormulaOperation),this.parent.off(Vt,this.aggregateComputation),this.parent.off(Ut,this.getUniqueRange),this.parent.off(_t,this.removeUniquecol),this.parent.off(qt,this.clearFormulaDependentCells),this.parent.off(Wt,this.formulaInValidation),this.parent.off(pn,this.refreshInsertDelete),this.parent.off(cn,this.getUpdatedFormulaOnInsertDelete),this.parent.off(vn,this.autoCorrectCellRef),this.parent.off(yn,this.parseFormulaArgument))},o.prototype.getModuleName=function(){return"workbookFormula"},o.prototype.initCalculate=function(){this.calculateInstance=new uo(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=J.getNumericObject(this.parent.locale).decimal;"."!==e&&this.parent.listSeparator!==e&&this.calculateInstance.setParseDecimalSeparator(e)},o.prototype.clearFormulaDependentCells=function(e){var t,r;e.isOpen?(this.calculateInstance.getDependentCells().clear(),this.calculateInstance.getFormulaInfoTable().clear()):(e=e.cellRef.split(":")[0],t=this.parent.getActiveSheet().id.toString(),(r=this.calculateInstance.getSheetFamilyItem(t)).isSheetMember&&!J.isNullOrUndefined(r.parentObjectToToken)&&(e=r.parentObjectToToken.get(t)+e),this.calculateInstance.clearFormulaDependentCells(e))},o.prototype.formulaInValidation=function(e){var t=this.calculateInstance.getLibraryFormulas().get(e.value);e.skip=J.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"],s=1;s<Array.from(t.values()).length;s++)o.indexOf(r[s].category)<0&&o.push(r[s].category);e.categoryCollection=o;break;case"dropDownSelectFormulas":for(s=0;s<Array.from(t.values()).length;s++)e.selectCategory===r[s].category&&(e.formulaCollection[s]=Array.from(t.keys())[s]);break;case"getFormulaDescription":for(s=0;s<Array.from(t.values()).length;s++)e.selectedList===Array.from(t.keys())[s]&&(e.description=r[s].description,e.isCustom=r[s].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":e.isFormula&&(e.value=this.autoCorrectFormula(e.value,e.rowIndex,e.colIndex,e.sheetIndex),e.isClipboard)&&e.value.toString().toUpperCase().includes("UNIQUE")&&(this.parent.sheets[e.sheetIndex].rows[e.rowIndex].cells[e.colIndex].value=""),e.isFormulaDependent=this.refreshCalculate(e.rowIndex,e.colIndex,e.value,e.isFormula,e.sheetIndex,e.isRefreshing,e.isDependentRefresh,e.isRandomFormula),e.value=e.value&&e.value.toString().split("^+").join("^").split("&+").join("&");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(s=0;s<this.sheetInfo.length;s++)if(this.sheetInfo[s].index===e.sheetId){var a=this.sheetInfo[s].visibleName,l=this.sheetInfo[s].sheet,h=(this.sheetInfo.splice(s,1),e.sheetId.toString());this.sheetDeletion(l,h),this.calculateInstance.unregisterGridAsSheet(h,h),this.definedNamesDeletion(a);break}break;case"getReferenceError":e.refError=this.referenceError();break;case"getAlpha":e.col=j(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&&!J.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)}},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.split("=")[1].split("!")[0].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.sheetDeletion=function(n,i){var o,s,a,l,h,d,p,c=this,e=this.calculateInstance.getDependentCells(),u=this.calculateInstance.getSheetFamilyItem(i),f=this.calculateInstance.namedRanges;f&&f.size&&(l=Array.from(f.keys()),h=Array.from(f.values())),e.forEach(function(e,t){e.forEach(function(e){var r;o=c.calculateInstance.getFormulaInfoTable().get(e),J.isNullOrUndefined(o)||(s=o.formulaText,r=!1,!s.includes(n)&&f&&f.size&&(s=s.replace(/\w+/g,function(e){var t=l.indexOf(e);return-1!==t?(r=!0,h[t]):e})),d=n.toUpperCase(),s=s.toUpperCase(),-1<(p=s.indexOf(d))&&("'"===s[p-1]&&"'"===s[p+d.length]&&(d="'"+d+"'"),d+=c.calculateInstance.sheetToken,s=s.split(d).join(c.referenceError()),p=c.calculateInstance.rowIndex(e),d=c.calculateInstance.colIndex(e),a=e.slice(0,e.lastIndexOf(c.calculateInstance.sheetToken)+1),c.updateDataContainer([p-1,d-1],{value:s,visible:!1,isNamedRange:r,sheetId:u.tokenToParentObject.has(a)?Number(u.tokenToParentObject.get(a)):parseInt(e.split("!")[1],10)+1}),c.calculateInstance.refresh(o.getParsedFormula()))),a=t.slice(0,t.lastIndexOf(c.calculateInstance.sheetToken)+1),i===(u.tokenToParentObject.has(a)?u.tokenToParentObject.get(a):t.split("!")[1])&&(c.calculateInstance.getFormulaInfoTable().delete(t),c.calculateInstance.clearFormulaDependentCells(t))})})},o.prototype.renameUpdation=function(h,d){function p(e){X(e.value1)&&e.value1.toUpperCase().includes(g)&&e.value1.match(m)&&(e.value1=e.value1.replace(m,h)),X(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=ne(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=ie(r,i,c,!1,!0)).formula&&X(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 s,r=0,a=c.columns.length;r<a;r++)(s=c.columns[r])&&s.validation&&p(s.validation);for(var l=f.parent.definedNames,r=0;r<l.length;r++)X(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,s=this.parent.sheets.length;o<s;o++)if((r=ne(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,s,a,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"),s=e.search(n),o=e.search(r),-1<s)&&(s<o||s===o&&d[g].visibleName.length>d[h].visibleName.length)&&(s=new RegExp("Sheet","gi"),0!==d[g].visibleName.search(s))&&(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"),a=t?"`"+d[c[h]].sheet+"`":d[c[h]].sheet,e=e.replace(r,a),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=ne(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=ne(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=Q(this.calculateInstance.uniqueRange[r]);this.calculateInstance.uniqueRange.splice(r,1);for(var o=i[0];o<=i[2];o++)for(var s=i[1];s<=i[3];s++)ie(o,s,this.parent.getActiveSheet()).formula="",this.parent.updateCell({value:"",formula:""},ee([o,s]))}}},o.prototype.refreshCalculate=function(e,t,r,n,i,o,s,a){var l=this,h=J.isNullOrUndefined(i)?this.parent.getActiveSheet():ne(this.parent,i),i=h.id+"",d=h.name,p=this.calculateInstance.getSheetFamilyItem(i),c=le(t+1)+(e+1);if(p.isSheetMember&&!J.isNullOrUndefined(p.parentObjectToToken)&&(c=p.parentObjectToToken.get(i)+c),n){var u=r,p=(r=this.parseSheetRef(r),new yo(e+1,t+1,r)),n=[h.usedRange.rowIndex,h.usedRange.colIndex],f=(this.calculateInstance.valueChanged(i,p,!0,n,o,d,a),!0!==this.calculateInstance.isRandomVal||a||this.refreshRandomFormula(),ie(e,t,h));if(f&&u&&!s){r=void 0;if(0===(u=u.toString().toUpperCase()).indexOf("=SUM(")?r="=SUM(":0===u.indexOf("=AVERAGE(")?r="=AVERAGE(":0===u.indexOf("=ROUNDDOWN(")?r="=ROUNDDOWN(":0===u.indexOf("=ROUNDUP(")?r="=ROUNDUP(":0===u.indexOf("=MOD(")&&(r="=MOD("),r){if((u=u.replace(r,"")).includes(")"))for(var u=u.slice(0,u.lastIndexOf(")")),g=void 0,m=void 0;u.includes("(")&&u.includes(")");)m=u.indexOf("("),g=u.slice(m+1),u=u.slice(0,m)+(g.includes(")")?g.slice(g.indexOf(")")+1):g);for(var v,y,C,b,x=u.split(this.calculateInstance.getParseArgumentSeparator()),S=void 0,w=void 0,m=0;m<x.length;m++)if((v=x[m].split(":")[0]).includes("!")?(C=(w=v.split("!"))[0].split("'").join(""),v=w[1]):C="",On(v)&&(S=C&&void 0!==(b=B(this.parent,C))?ne(this.parent,b):h,y=ie((b=Q(v))[0],b[1],S))&&y.format){f.format=y.format;break}}else{var I,E,R,N,i=this.calculateInstance.getDependentFormulaCells().get(c);i&&i.size&&this.calculateInstance.getFormulaInfoTable().has(c)&&-1===this.calculateInstance.getFormulaInfoTable().get(c).getParsedFormula().lastIndexOf("q")&&!f.format&&(N=this.calculateInstance.getSheetFamilyItem(null,this.calcID),i.forEach(function(e){I||(E=e.slice(0,e.lastIndexOf("!")+1),On(e=e.replace(E,""))&&(R=Q(e),E=N.tokenToParentObject.has(E)&&void 0!==(E=bi(l.parent,Number(N.tokenToParentObject.get(E))))?ne(l.parent,E):h,R=ie(R[0],R[1],E))&&R.format&&(I=R.format))}),I)&&(f.format=I)}}}else this.calculateInstance.getFormulaInfoTable().has(c)&&(this.calculateInstance.getFormulaInfoTable().delete(c),this.calculateInstance.clearFormulaDependentCells(c)),this.calculateInstance.refresh(c),this.calculateInstance.refreshRandValues(c);return this.calculateInstance.cell="",this.calculateInstance.getDependentCells().has(c)},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(),r=new yo(r,n,i);this.calculateInstance.valueChanged(o,r,!0,void 0,void 0,void 0,!1,!0)}},o.prototype.autoCorrectFormula=function(e,t,r,n){if(!J.isNullOrUndefined(e)){2===(e=(e=this.autoCorrectCellRef({formula:e})).toString()).split("(").length&&e.indexOf(")")<0&&(e+=")");var i=void 0,o=(0===e.indexOf("=")&&(e=e.slice(1),i=!0),e.match(/</g)),s=e.match(/>/g),a=e.match(/=/g);if(o){for(var l="",h=0;h<o.length;h++)l+=o[h];e=e.replace(l,"<")}if(s){for(var d="",p=0;p<s.length;p++)d+=s[p];e=e.replace(d,">")}if(a){for(var c="",u=0;u<a.length;u++)c+=a[u];e=e.split(c).join("=")}e=i?"="+e:e,(o||s||a)&&(ie(t,r,J.isNullOrUndefined(n)?this.parent.getActiveSheet():ne(this.parent,n)).formula=e)}return e},o.prototype.correctCellReference=function(n){var i,o,s,a,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(s=e.match(/[/+\-*^><>=<=<>]+/g)){i=e.split(s[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(s[0])}l&&l!==e&&(a=!0,d[t]=l)}),{isInvalid:a,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),s=void 0,a=0;a<o.length;a++)(t=this.correctCellReference(o[a])).isInvalid&&(s=!0,o[a]=t.ref);s&&(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)&&Y(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=C(i),s=!1,i=-1<i.indexOf("http:")||-1<i.indexOf("https:");-1<(o=(o=o.split("$").join("")).split("=").join("")).indexOf(":")?(On((r=o.split(":"))[0])&&On(r[1])||r[0].match(/[0-9]/)&&r[1].match(/[0-9]/)||r[0].toUpperCase().match(/[A-Z]/)&&r[1].toUpperCase().match(/[A-Z]/))&&(s=!0):o.indexOf(":")<0&&On(o)&&(s=!0),(s=i?!1:s)?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,s=(e.refersTo.indexOf("!")<0&&(s=-1!==(s=ki(this.parent)).indexOf(" ")?"'"+s+"'":s,e.refersTo=s+"!"+(e.refersTo.indexOf("=")<0?e.refersTo:e.refersTo.split("=")[1])),e.refersTo),a=this.parseSheetRef(e.refersTo),l=(e.scope?-1<(l=B(this.parent,e.scope))&&(o=ki(this.parent,l)+"!"+o):e.scope="",e.comment||(e.comment=""),!t&&this.checkIsNameExist(e.name,e.scope)?i=!1:(this.calculateInstance.addNamedRange(o,"="===a[0]?a.substr(1):a),"="!==a[0]&&(e.refersTo="="+s),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,s=this.getIndexFromNameColl(e,t);return-1<s&&(n=e,t&&-1<(i=B(this.parent,t))&&(n=ki(this.parent,i)+"!"+e),this.calculateInstance.removeNamedRange(n),this.parent.definedNames.splice(s,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.toFixed=function(e){var t=Number(e);return e=Math.round(t)!==t?t.toFixed(2):e},o.prototype.aggregateComputation=function(e){var t=this.parent.getActiveSheet(),r=Ei(t),n=Q(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(Y(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"],s=[],n=Q(t.activeCell),a=ie(n[0],n[1],t,!1,!0),l=0;l<4;l++){var h,d=this.toFixed(this.calculateInstance.getFunction(o[l])(r));a.format&&(h={formattedText:d,value:d,format:a.format,cell:{value:d,format:a.format}},this.parent.notify(St,h),d=h.formattedText),s.push(d)}e.Sum=s[0],e.Avg=s[1],e.Min=s[2],e.Max=s[3]}},o.prototype.refreshInsertDelete=function(s){var a,l=this,e=this.calculateInstance.getDependentFormulaCells(),h=bi(this.parent,s.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++)(a=ie(r,i,e,!1,!0)).formula&&X(a.formula)&&(t===h?!s.isInsert&&("Row"===s.modelType?r>=s.startIndex&&r<=s.endIndex:i>=s.startIndex&&i<=s.endIndex)||l.updateFormula(s,a,r,i,h):a.formula.includes(s.sheet.name)&&l.updateFormula(s,a,r,i,h,!0,e))}),e.clear(),this.calculateInstance.getDependentCells().clear(),this.calculateInstance.getFormulaInfoTable().clear(),this.refreshNamedRange(s)},o.prototype.getUpdatedFormulaOnInsertDelete=function(e){this.updateFormula(e.insertDeleteArgs,e.cell,e.row,e.col,e.sheetIdx)},o.prototype.updateFormula=function(e,t,r,n,i,o,s){for(var a,l,h,d,p,c,u,f=new RegExp(/^(?=.*[a-zA-Z])(?=.*\d)/g),g=(t.formula&&t.formula.includes("UNIQUE")&&this.clearUniqueRange(r,n,s||e.sheet),this.parseFormulaArgument({formula:this.parseSheetRef(t.formula,!0),rangeRef:!0})),m=this.getSheetInfo(),v=0;v<g.length;v++)if(u=g[v].trim(),(c=u.includes("$"))&&(u=u.replace(/[$]/g,"")),h=!0,this.calculateInstance.isCellReference(u)){if(l=u.includes(":"),(a=v&&g[v-1].trim())&&"!"===a[a.length-1]){if((a=a.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=!!J.isNullOrUndefined(u.match(/[0-9]/))),a=Q(u),u=this.parent.updateRangeOnInsertDelete(e,a,l),l=te(a),u&&(g[v]=l[2]<l[0]||l[3]<l[1]?this.calculateInstance.getErrorStrings()[z.CommonErrors.Ref]:h?(u=void 0,u=(c?"$":"")+le(a[1]+1)+(c?"$":"")+(a[0]+1),a[0]===a[2]&&a[1]===a[3]||(u+=":"+(c?"$":"")+le(a[3]+1)+(c?"$":"")+(a[2]+1)),u):d?ee(a).replace(/\d/g,""):ee(a).replace(/[a-zA-Z]/g,""),p=!0)}var y,C,b="="+g.join("");p&&(C=RegExp,m.forEach(function(e){b.includes("`"+e.sheet+"`")&&(y=new C("`"+e.sheet+"`","gi"),b=b.replace(y,e.visibleName))}),t.formula!==b)&&(t.formula=b,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(zt,e),Q(e.uniqueRange)),i=n[0];i<=n[2];i++)for(var o=n[1];o<=n[3];o++)delete ie(i,o,r,!1,!0).value},o.prototype.clearAllUniqueFormulaValue=function(){for(var e,t,r,n,i=this.calculateInstance.uniqueRange,o=0;o<i.length;o++)if(e=i[o].split("!"),r=ne(this.parent,B(this.parent,e[0])),!(t=ie((n=Q(e[1]))[0],n[1],r))||"#SPILL!"!==t.value)for(var s=n[0];s<=n[2];s++)for(var a=n[1];a<=n[3];a++)(t=ie(s,a,r))&&t.value&&delete t.value},o.prototype.parseFormulaArgument=function(e){for(var t,r,n=0,i=[],o=this.markSpecialChar(e.formula.replace("=",""),e.rangeRef),s=RegExp,a=new s(e.rangeRef?/\(|\)|=|\^|>|<|\+|-|\*|\/|%|&/g:/\(|\)|=|\^|>|<|:|\+|-|\*|\/|%|&/g),l=new s(this.parent.listSeparator,"g"),h=(o=o.split(new s(a.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.substr(0,r)),i.push(t.substr(r))):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,o,s,a,l,h=Object.assign({},this.parent.definedNames),d=new RegExp(/^(?=.*[a-zA-Z])(?=.*\d)/g),p=0;p<r;p++)a=!0,(s=(s=n=(o=(i=h[p]).refersTo.split("!"))[0].split("=")[1]).match(/'/g)?s.slice(1,-1):s)===e.sheet.name&&(!d.test(o[1])&&-1<o[1].indexOf(":")&&(a=!1,l=!!J.isNullOrUndefined(o[1].match(/[0-9]/))),s=Q(o[1]),o=this.parent.updateRangeOnInsertDelete(e,s),a=a?ee(s):l?ee(s).replace(/\d/g,""):ee(s).replace(/[a-zA-Z]/g,""),e.isInsert?this.updateDefinedNames(i,n,a,o):"Row"===e.modelType?this.updateDefinedNames(i,n,a,o,[s[0],s[2]],e):"Column"===e.modelType&&this.updateDefinedNames(i,n,a,o,[s[1],s[3]],e))}},o.prototype.updateDefinedNames=function(e,t,r,n,i,o){if(n){var n=this.parent.definedNames.indexOf(e),s={action:"removeDefinedName",isRemoved:!1,definedName:e.name,scope:e.scope,isEventTrigger:!0};if(this.parent.notify(re,s),i){s={name:e.name,comment:e.comment,refersTo:e.refersTo,scope:e.scope},s=new me(this.parent,"definedNames",s,!0);if(o.definedNames?o.definedNames.push(s):o.definedNames=[s],i[1]<i[0])return}e.refersTo=t+"!"+r,this.parent.notify(re,{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()}s.prototype.numberFormatting=function(e){for(var t,r,n,i=this.parent.activeSheetIndex,o=!0,s=(e.range&&-1<e.range.indexOf("!")&&(o=(i=B(this.parent,e.range.split("!")[0]))===this.parent.activeSheetIndex),ne(this.parent,i)),a=Q(e.range?-1<e.range.indexOf("!")?e.range.split("!")[1]:e.range:s.selectedRange),l=a[0];l<=a[2];l++)for(var h=a[1];h<=a[3];h++)n=ie(l,h,s,!1,!0).format,ni(ie(l,h,s),se(s,h),ch(s,l))||Gn(this.parent,s,{cell:{format:e.format},rowIdx:l,colIdx:h})||((r=ie(l,h,s)).rowSpan<0||r.colSpan<0||(t={value:r.value,format:r.format,rowIndex:l,colIndex:h,sheetIndex:i,cell:r,refresh:o},this.getFormattedCell(t),o&&(this.setCell(t),this.parent.notify(wt,{isRightAlign:t.isRightAlign,result:t.formattedText,rowIndex:l,colIndex:h,sheetIndex:t.sheetIndex,type:t.type,curSymbol:t.curSymbol,value:t.value||0===t.value?t.value:"",isRowFill:t.isRowFill,cellEle:t.td}),n)&&n!==e.format&&n.includes("[")&&-1===Ui().indexOf(Vi(e.format))&&this.removeFormatColor(t,{format:n,style:r.style})),this.parent.setUsedRange(l,h))},s.prototype.getFormattedCell=function(e){var t,r,n,i,o=void 0===e.value||null===e.value?"":e.value,s=(e.sheetIndex=void 0===e.sheetIndex?this.parent.activeSheetIndex:e.sheetIndex,ne(this.parent,e.sheetIndex)),a=e.cell||ie(e.rowIndex,e.colIndex,s,!1,!0),l=!1,h={},d=new J.Internationalization,p=(d.getNumberFormat(h),J.getNumberDependable(this.parent.locale,h.currency));return e.format&&"General"!==e.format||e.skipFormatCheck||a.formula&&a.formula.toLowerCase().startsWith("=text(")?(e.type=So(e.format),e.skipFormatCheck&&!e.format&&"General"===e.type&&(e.format="General")):(e.type=e.format="General",(!a.formula||a.formula&&-1===a.formula.indexOf("&-"))&&(n={value:o,updatedVal:o,cell:a,isEdit:e.isEdit,intl:d},this.checkDateFormat(n),n.isDate||n.isTime)&&(l=!0,a.value=e.value=n.updatedVal,a.format&&"General"!==a.format?(e.format=a.format,e.type=So(e.format)):a.format=e.format=xo(n.isDate?"ShortDate":"Time"))),a.format&&this.isCustomType(a)?(e.type="Custom",n=-1<a.format.indexOf("@"),t=void(""!==o&&!n&&this.isPercentageValue(o.toString(),e,a)&&(o=e.value.toString())),r={},i=a.format,a.format=a.format.split("\\").join(""),-1<a.format.indexOf(";")?(-1<a.format.indexOf("<")||-1<a.format.indexOf(">")?e.result=this.processCustomConditions(a,e):(e.result=this.processCustomAccounting(a,e,p),t=!Y(a.value)||"@"===a.format),a.format=i):_i(a.format,!0,r,!0)?(""!==o&&(e.result=this.processCustomDateTime(e,a,"time"!==r.type),t=!e.formatApplied),e.result=e.result||a.value):n?(t=!0,e.result=this.processCustomText(a.format,o,e)):(i=kn({value:o},this.parent.locale,this.groupSep,this.decimalSep)).isNumber?(a.value=e.value=i.value,a.format.includes("E+0")?(e.format!==a.format&&(e.format=a.format),this.checkAndSetColor(e),n=(r=e.format.split("E")[0]).split("."),"."!==this.decimalSep&&1===n.length&&(n=r.split(this.decimalSep)),e.result=1<n[0].length?this.scientificHashFormat(e,n):this.scientificFormat(e)):(e.result=this.processCustomNumberFormat(a,e),t=!Y(a.value))):(a.format&&a.format.includes("[")&&this.removeFormatColor(e,{format:a.format,style:a.style}),t=e.dataUpdate=!0),e.dataUpdate?e.formattedText=e.result||(J.isNullOrUndefined(e.value)?"":e.value.toString()):(e.value=e.result,e.formattedText=J.isNullOrUndefined(e.value)?"":e.value.toString()),e.isRightAlign=!t&&!J.isNullOrUndefined(e.value)):(i=this.processFormats(e,o,l,a,d,p,h.currency,s),e.formattedText=i.fResult||(void 0===e.value||null===e.value?"":e.value.toString()),e.isRightAlign=i.rightAlign),e.curSymbol=p,e.formattedText},s.prototype.isCustomType=function(e){var t=So(e.format);return"General"===t&&"General"!==e.format||"Time"===t&&this.parent.isEdit},s.prototype.processCustomFill=function(e,t,r,n){var i,o,s=e[e.indexOf("*")+1],e=e.split("*"+s);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(sn,{cell:t,cellEle:r.td,rowIdx:r.rowIndex,colIdx:r.colIndex,beforeFillText:n,repeatChar:s,afterFillText:i}),this.parent.isPrintingProcessing?n+i:n)},s.prototype.processCustomDateTime=function(n,i,o){var s,t,r,a=this;if(!(Y(i.value)||(r=i.value.toString(),s=!!(r.includes(a.localeObj.dateSeparator)||0<r.indexOf("-")||r.includes(a.localeObj.timeSeparator))||(l=J.IntlBase.getDependables(J.cldrData,a.parent.locale,null).dateObject,(t=l.months["stand-alone"]&&l.months["stand-alone"].abbreviated)&&!!Object.keys(t).find(function(e){return r.includes(t[""+e])})))))return i.value||"";function e(e){var t,r;if(s){if(r=(t=Nn(i.value,new J.Internationalization,a.parent.locale,h,i)).dateObj&&"Invalid Date"!==t.dateObj.toString()){if(t.dateObj.getFullYear()<1900)return"";i.value=En(t.dateObj,i.value.toString().includes(":"),"time"===t.type).toString()}}else{if(a.checkAndProcessNegativeValue(n,i.value))return n.formatApplied=!0,n.formattedText;r=(t={dateObj:In(parseFloat(i.value))}).dateObj&&"Invalid Date"!==t.dateObj.toString()}return r?(e&&o&&(n.dateObj=t.dateObj),n.formatApplied=!0,r=void 0,h.startsWith("MM-dd-yyyy ")?(h=h.split(" ").splice(1).join(" "),r=d.formatDate(t.dateObj,{type:"date",skeleton:"yMd"})+(h?" "+d.formatDate(t.dateObj,{type:u,format:h}):"")):(r=d.formatDate(t.dateObj,{type:u,format:h}),(h=h.toLowerCase()).startsWith("[h]")?r=(24*Number(i.value.toString().split(".")[0])+t.dateObj.getHours()).toString()+r.slice(r.indexOf("]")+1):h.startsWith("[m")?r=(1440*Number(i.value.toString().split(".")[0])+60*t.dateObj.getHours()+t.dateObj.getMinutes()).toString()+r.slice(r.indexOf("]")+1):h.startsWith("[s")&&(r=(86400*Number(i.value.toString().split(".")[0])+60*(60*t.dateObj.getHours()+t.dateObj.getMinutes())+t.dateObj.getSeconds()).toString())),p?r.replace(a.localeObj.am,"A").replace(a.localeObj.pm,"P"):r):""}var l,h=i.format,d=new J.Internationalization,p=(h=h.split("_(").join(" ").split("_)").join(" "),-1<i.format.indexOf("h")&&(h=h.split("h").join("H"),u="time"),-1<i.format.indexOf("s")&&(u="time"),-1<i.format.indexOf("A/P"));if((-1<i.format.indexOf("AM/PM")||p)&&(h=(h=h.split("H").join("h")).split("A/P").join("AM/PM").split("AM/PM").join("a"),u="time"),-1<i.format.indexOf("d")){for(var c,u="date",f=h.split(" "),g=0;g<f.length;g++)(c=f[g].match(/d/g))&&2<c.length&&(f[g]=f[g].split("d").join("E"));h=f.join(" ")}if(-1<i.format.indexOf("m"))if(-1<i.format.indexOf("s")||-1<i.format.indexOf("h"))u="time",i.format.includes(" ")&&((f=h.split(" "))[0].includes("d")||f[0].includes("y"))&&(f[0]=f[0].split("m").join("M"),h=f.join(" "));else if(u="date",h=h.split("m").join("M"),-1<i.format.indexOf("mmmmm"))return h="MMMM",l=e()[0],h=i.format.split("mmmmm").join("p"),e(n.checkDate).split("p").join(l);return e(n.checkDate)},s.prototype.processCustomConditions=function(e,t){if(Y(e.value)){for(var r=e.format.split(";"),n=Number(e.value),i=void 0,o=void 0,s=0;s<r.length;s++){if(e.format=r[s],(a=Vi(e.format))&&(e.format=e.format.split("["+a+"]").join("")),!e.format.includes("[")){e.format=r[s],o=!1;break}var a=(i=e.format.split("[")[1].split("]")[0]).split("<="),l=i.split(">="),h=i.split("<"),d=i.split(">");if(2===a.length&&n<=Number(a[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[s].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},s.prototype.processCustomAccounting=function(e,t,r){var n,i,o=e.format.split(";"),s=kn(e,this.parent.locale,this.groupSep,this.decimalSep,r);if(s.isNumber&&(e.value=s.value,n=parseFloat(s.value)),0<n)i=o[0];else if(0===n)i=o[2]?o[2].includes(r+"0")?o[2].split("0").join("#"):o[2]:o[0];else{if(!Y(n))return s=e.value||0===e.value?e.value:"",e.format="@",o[3]?this.processCustomText(o[3],s,t):s.toString();i=o[1]}return this.processCustomNumberFormat({format:e.format,value:n<0?Math.abs(n).toString():e.value,style:e.style},t,i)},s.prototype.processCustomText=function(e,t,r){t=t.toString();e=this.processCustomNumberFormat({format:e.split("@").join("#"),value:t.split(t).join("1")},r);return e&&e.split("1").join(t)},s.prototype.thousandSeparator=function(e,t){for(;e;)t/=1e3,e--;return t},s.prototype.getSeparatorCount=function(e){for(var t=0,r=["#","0"],n=0;n<e.format.length;n++)","!==e.format[n]||-1<r.indexOf(e.format[n+1])||t++;return t},s.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.decimalSep)?(t=r.split(this.decimalSep))[0]+this.decimalSep+t[1].split("0").join(" "):r)||e.value},s.prototype.processFormatWithSpace=function(e,t,r){for(var n,i={cell:t,char:" ",width:0},o=(this.parent.notify(an,i),i.width),t={format:e,formattedText:""},s=0;s<e.length;s++)"_"===e[s]&&(i.char=e[s+1],this.parent.notify(an,i),n=i.width,n=Math.round(n/o),e=e.replace(e[s]+e[s+1]," ".repeat(n)));var a=e.length-e.trim().length;if(0<a){if(t.formattedText=this.getFormattedNumber(e.trim(),r)," "===e[0]){for(var l=1,h=1;" "===e[h];)l++,h++;a-=l,t.formattedText=" ".repeat(l)+t.formattedText}t.formattedText+=" ".repeat(a)}else t.formattedText=this.getFormattedNumber(e,r);return t.format=e,t},s.prototype.removeFormatColor=function(e,t){-1<Ui().indexOf(Vi(t.format))&&(e.color=t.style&&t.style.color?t.style.color:"",this.applyColor(e))},s.prototype.processCustomNumberFormat=function(e,t,r){var n,i,o,s,a,l;return e.format?(s=e.value,Y(i=e&&kn(e,this.parent.locale,this.groupSep,this.decimalSep).value)&&(e.value=i,i=parseFloat(i.toString()),r=r||e.format,-1<e.format.indexOf("[")&&((a=Vi(r))?(r=r.split("["+a+"]").join(""),t.color=a.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+="#"),(a=this.getSeparatorCount(e))&&(o=!0,l=this.thousandSeparator(a,i),-1===r.indexOf(".")&&(l=Math.round(l)),s=this.getFormattedNumber(r.split(",").join(""),l),0===l)&&(s=s.replace("0","")),-1<r.indexOf("?")&&(o=!0,s=this.processDigits(e,r),r=r.split("?").join("")),-1<r.indexOf("_")&&(o=!0,r=(l=this.processFormatWithSpace(r,e,i)).format,s=l.formattedText),s&&-1<r.indexOf("?")&&(s=s.replace("?"," ")),-1<r.indexOf("*")&&(o=!0,s=this.processCustomFill(r,e,t)),"General"===r&&(o=!0,s=i.toString()),o||(s=this.getFormattedNumber(r,i)),n&&(s=s&&s.replace("0","")),"#"===r[0]&&0<=i&&i<1&&((a=r.split("#").join("").split("."))[0].includes("0")||((l=(s=0!==i||!r.includes(".")||a[1]&&a[1].includes("0")?s:(s=this.getFormattedNumber(r,.1)).replace("1","")).split(this.decimalSep))[0]=l[0].toString().replace(/^0+/,""),s=l.join(this.decimalSep))),"-0"===s)?"0":s):""},s.prototype.processText=function(e){return-1<e.indexOf('"')?e=e.split('"').join("'"):-1<e.indexOf("\\")&&(e=e.split("\\").join("")),e},s.prototype.processFormats=function(e,t,r,n,i,o,s,a){var l;if(""!==t){var h=void 0;switch("General"!==e.type&&"Text"!==e.type&&this.isPercentageValue(t.toString(),e,n)&&(t=e.value.toString()),e.type){case"General":(l={args:e,currencySymbol:o,fResult:t,intl:i,isRightAlign:r,curCode:s,cell:n,rowIdx:Number(e.rowIndex),colIdx:Number(e.colIndex),sheet:a}).fResult.toString().startsWith("\n")||l.fResult.toString().endsWith("\n ")||this.autoDetectGeneralFormat(l),t=l.fResult,r=l.isRightAlign;break;case"Number":(h=kn({value:t},this.parent.locale,this.groupSep,this.decimalSep)).isNumber&&(n.value=e.value=h.value,t=this.applyNumberFormat(e,i),r=!0);break;case"Currency":(h=kn({value:t,format:e.format},this.parent.locale,this.groupSep,this.decimalSep,o)).isNumber&&(n.value=e.value=h.value,t=this.currencyFormat(e,i,s,n),r=!0);break;case"Percentage":(h=kn({value:t},this.parent.locale,this.groupSep,this.decimalSep)).isNumber&&(n.value=e.value=h.value,t=this.percentageFormat(e,i),r=!0);break;case"Accounting":t=this.accountingFormat(e,t,i,o,s,n),r=e.formatApplied;break;case"ShortDate":r=!!(t=this.checkAndProcessNegativeValue(e,e.value)?e.formattedText:this.shortDateFormat(e,i));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));break;case"Fraction":(h=kn({value:t},this.parent.locale,this.groupSep,this.decimalSep)).isNumber&&(n.value=e.value=h.value,t=this.fractionFormat(e),r=!0);break;case"Scientific":(h=kn({value:t},this.parent.locale,this.groupSep,this.decimalSep)).isNumber&&(n.value=e.value=h.value,t=this.scientificFormat(e),r=!0);break;case"Text":"."!==this.decimalSep&&Y(t)&&t.toString().includes(".")&&(t=t.toString().replace(".",this.decimalSep)),r=!1}}return{fResult:t,rightAlign:r}},s.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("),s=e.args.cell&&e.args.cell.formula&&0<e.args.cell.formula.indexOf("TEXT(");o&&e.fResult&&e.fResult.toString().includes(e.currencySymbol)||s||(e.fResult&&"."!==this.decimalSep&&(t=r=e.fResult.toString(),r.includes(this.decimalSep))&&Y(r=r.replace(this.decimalSep,"."))&&(r.includes("E")?e.fResult=r:(e.fResult=e.args.value=r=Number(r).toString(),Mi(e.rowIdx,e.colIdx,e.sheet,{value:r},!0)),t=r.replace(".",this.decimalSep)),Y(e.fResult)&&(r=Number(e.fResult).toString(),e.fResult.toString().includes("E")?(e.args.format=xo("Scientific"),Mi(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.currencySymbol)?e.fResult=this.currencyFormat(e.args,e.intl,e.curCode,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),J.isNullOrUndefined(e.fResult))&&!J.isNullOrUndefined(e.cellVal)&&(e.fResult=e.cellVal),e.isRightAlign=!0),e.fResult&&this.updateAutoDetectNumberFormat(e),i&&(e.isRightAlign=!1,e.fResult=n))},s.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=e.intl.formatNumber(Number(e.cellVal),{format:0<r?"0."+"0".repeat(r):"0"}),e.fResult&&("."===this.decimalSep?e.fResult=Number(e.fResult).toString():e.fResult=Number(e.fResult.replace(this.decimalSep,".")).toString().replace(".",this.decimalSep))):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.decimalSep),1===r[1].length&&(r[1]="0"+r[1]),e.args.updateValue||Mi(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.decimalSep&&(e.fResult=e.cellVal.replace(".",this.decimalSep)))},s.prototype.updateAutoDetectNumberFormat=function(e){var t,r=e.fResult.toString(),n=e.args.cell||e.cell;this.isPercentageValue(r,e.args,n)?(n.format=r.includes(this.decimalSep)?xo("Percentage"):"0%",e.args.updateValue||(e.args.format=n.format,e.fResult=this.percentageFormat(e.args,e.intl),e.isRightAlign=!0)):(t="",r.includes(e.currencySymbol)&&(t=r.includes(this.decimalSep)?si.currency[0]:si.currency[1],r=r.replace(e.currencySymbol,"")),("."===this.decimalSep||e.args.isEdit&&!n.formula)&&r.includes(this.groupSep)&&Fn(r,this.parent.locale,this.groupSep,this.decimalSep)&&(r=r.split(this.groupSep).join(""),t=t||(r.includes(this.decimalSep)?"#,##0.00":"#,##0")),t?Y(r=r.replace(this.decimalSep,"."))&&(e.args.value=Number(r).toString(),e.args.updateValue?(e.args.cell.value=e.args.value,e.args.cell.format=t):(Mi(e.rowIdx,e.colIdx,e.sheet,{value:e.args.value,format:t},!0),e.fResult=this.getFormattedNumber(t,Number(e.args.value)),e.isRightAlign=!0)):"."!==this.decimalSep&&"General"===e.args.format&&Y(r)&&r.includes(".")&&(e.fResult=Number(r).toString().replace(".",this.decimalSep)))},s.prototype.isPercentageValue=function(e,t,r){if(e.includes("%")){e=e.split("%");if(""!==e[0]&&""===e[1].trim()){e=kn({value:e[0]},this.parent.locale,this.groupSep,this.decimalSep);if(e.isNumber)return t.value=Number(e.value)/100,r.value=t.value.toString(),!0}}return!1},s.prototype.findSuffix=function(e,t){var r=e.length-t.length;return e.substr(0,r<0?0:r)+t},s.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=J.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.decimalSep)?(n=e.format.split(this.decimalSep)[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})},s.prototype.isCustomFormat=function(e){return e=(e=""===(e='_-* #,##0.00_-;-* #,##0.00_-;_-* "-"_-;_-@_-'!==e&&'_-* #,##0_-;-* #,##0_-;_-* "-"_-;_-@_-'!==e?e:"")?xo("Number"):e).toString().split("_)").join(" ").split("_(").join(" ").split("[Red]").join("")},s.prototype.currencyFormat=function(e,t,r,n){e.format=e.format||xo("Currency"),e.format=e.format.split("_(").join(" ").split("_)").join(" ");var i=e.format.split(";"),o=Vi(e.format),s=Number(e.value);return 0<=s||J.isNullOrUndefined(i[1])?(o&&(e.color=n.style&&n.style.color?n.style.color:"",this.applyColor(e)),e.format=i[0]):(s=Math.abs(s),e.format=i[1].split("["+o+"]").join("").split("*").join(" "),o&&(e.color=o.toLowerCase(),this.applyColor(e))),e.format=this.getFormatForOtherCurrency(e.format),t.formatNumber(s,{format:e.format,currency:r})},s.prototype.applyColor=function(e){e.refresh&&(this.setCell(e),e.td)&&e.td.style.color!==e.color&&this.parent.notify(Nt,{style:{color:e.color},rowIdx:e.rowIndex,colIdx:e.colIndex,td:e.td})},s.prototype.setCell=function(e){var t;e.td||(t={sheet:ne(this.parent,e.sheetIndex),cell:e.cell,rowIdx:e.rowIndex,colIdx:e.colIndex},(1<e.cell.rowSpan||1<e.cell.colSpan)&&ei(t),e.td=this.parent.getCell(t.rowIdx,t.colIdx))},s.prototype.percentageFormat=function(e,t){return e.format=""===e.format?xo("Percentage"):e.format,t.formatNumber(Number(e.value),{format:e.format})},s.prototype.accountingFormat=function(e,t,r,n,i,o){e.format=e.format||xo("Accounting"),e.format=e.format.split("_(").join(" ").split("_)").join(" ").split("[Red]").join("").split("_").join("");var s=e.format.split(";"),a=kn({value:t},this.parent.locale,this.groupSep,this.decimalSep);return a.isNumber?(o.value=e.value=a.value,0<=(o=Number(e.value))?e.format=0===o&&s[2]?s[2]:s[0]:(e.format=s[1].split("*").join(" "),o=Math.abs(o)),e.format.includes(n)||e.format.includes("$")||(i=n=""),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:i}):(e.format+="#",(a=r.formatNumber(o,{format:e.format,currency:i})).includes("0")?a.replace("0",""):a)):s[3]?this.processCustomText(s[3],t,e):t},s.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},s.prototype.checkAndProcessNegativeValue=function(e,t){return!!(t&&Y(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(sn,t),e.formattedText=t.formattedText),!0)},s.prototype.shortDateFormat=function(e,t){var r=""===e.format||"General"===e.format||e.format===xo("ShortDate")?(n="MM-dd-yyyy",{type:"date",skeleton:"yMd"}):{type:"date",format:n=e.format};if(e.value&&(e.value=e.value.toString(),!Y(e.value))&&(e.value.includes(this.localeObj.dateSeparator)||0<e.value.indexOf("-"))){var n=Nn(e.value,t,this.parent.locale,n="dd-MM-yyyy"!==n&&"dd/MM/yyyy"!==n?n:"",e.cell).dateObj;if(n&&"Invalid Date"!==n.toString())return n.getFullYear()<1900?Y(e.value)?e.value:"":(e.value=En(n).toString(),e.cell&&(e.cell.value=e.value),e.checkDate&&(e.dateObj=n),t.formatDate(n,r))}n=In(e.value);return n&&"Invalid Date"!==n.toString()&&n.getFullYear()<1900?Y(e.value)?e.value.toString():"":(e.checkDate&&(e.dateObj=n),t.formatDate(n,r))},s.prototype.longDateFormat=function(e,t){var r;if(e.value=e.value.toString(),(e.value.includes(this.localeObj.dateSeparator)||0<e.value.indexOf("-"))&&!Y(e.value)){if(!((r=Nn(e.value,t,this.parent.locale,"",e.cell).dateObj)&&"Invalid Date"!==r.toString()&&1900<=r.getFullYear()))return Y(e.value)?e.value:"";e.value=En(r).toString(),e.cell&&(e.cell.value=e.value)}else if((r=In(e.value))&&"Invalid Date"!==r.toString()&&r.getFullYear()<1900)return Y(e.value)?e.value:"";var n=""===e.format||"General"===e.format?xo("LongDate"):e.format.toString();return n===xo("LongDate")&&(n="EEEE, MMMM d, y"),e.checkDate&&(e.dateObj=r),t.formatDate(r,{type:"date",format:n})},s.prototype.timeFormat=function(e,t){if(J.isNullOrUndefined(e.value))return"";var r=""===e.format||"General"===e.format||e.format===xo("Time")?"h:mm:ss a":e.format,n=e.value.toString();if(!Y(n)&&n.includes(this.localeObj.timeSeparator)){var i=Nn(n,t,this.parent.locale,r,e.cell);if(!i.dateObj||"Invalid Date"===i.dateObj.toString())return"";n=e.value=En(i.dateObj,!0,i.type&&"time"===i.type).toString(),e.cell&&(e.cell.value=e.value)}i=n.split(".");return J.isNullOrUndefined(i[1])||(e.value=parseFloat(i[0]+1+"."+i[1])||e.value),t.formatDate(In(e.value),{type:"time",skeleton:"medium",format:r})},s.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 s,o=o.split(r),a=o[0].split("."),l=Number(o[1]),h=("e-"===r?(s=(h=l+Math.abs(l-i*(i<l?2:1)))-l,o[1]=h.toString()):o[1]=(l-(s=l%i)).toString(),0<s&&(a[0]+=a[1].substring(0,s),a[1]=a[1].slice(s),o[0]=a.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])},s.prototype.scientificFormat=function(e,t){e.format||(e.format=xo("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.decimalSep)},s.prototype.fractionFormat=function(e){e.format=e.format||xo("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=Sn(Number(e.value));if(t)return r+" "+t}return r+" "+" ".repeat(2*n)},s.prototype.checkAndSetColor=function(e){var t=Vi(e.format);t&&(e.format=e.format.split("["+t+"]").join(""),e.color=t.toLowerCase(),this.applyColor(e))},s.prototype.findDecimalPlaces=function(e){var t,r=e.toUpperCase().indexOf("E");return-1<r?0<(t=-1===(t=e.indexOf(this.decimalSep))&&"."!==this.decimalSep?e.indexOf("."):t)?e.substring(t+1,r).length:0:2},s.prototype.checkDateFormat=function(e){if(!J.isNullOrUndefined(e.value)){var t=e.cell||ie(e.rowIndex,e.colIndex,ne(this.parent,J.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=Nn(r.val,e.intl||new J.Internationalization(this.parent.locale),this.parent.locale,r.format,e.skipCellFormat&&t,r.isDateTime);if(!J.isNullOrUndefined(n.dateObj)&&"Invalid Date"!==n.dateObj.toString()&&1900<=n.dateObj.getFullYear()){if(r.val=En(n.dateObj,-1<r.val.indexOf(":"),n.type&&"time"===n.type).toString(),(!t.format||"General"===t.format)&&("time"===n.type?t.format=xo("Time"):t.format=xo("ShortDate"),e.updateValue))return void(t.value=r.val);e.isDate="date"===n.type||"datetime"===n.type,e.isTime="time"===n.type,e.dateObj=n.dateObj}e.updatedVal=r.val}}},s.prototype.checkCustomTimeFormat=function(r,e){var n,i,o,s,a=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;return p.length<=3?(s=t?12:24,p.forEach(function(e,t){e.includes(h)||e.includes(d)?(n=" AM/PM",e=e.replace(h,"").replace(d,"")):n="",Y(i=Number(e))&&0<=i?i<=s&&0===t?(l.push("h"+n),1===p.length&&(n?((o=r.split(" "))[0]+=a.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):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),e.format&&"General"!==e.format)||c?{val:r,format:""}:(e.format=l.join(":"),{val:r,format:e.format})},s.prototype.checkCustomDateFormat=function(r,e,t){var n,i=this,o=e.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))){if(n=this.localeObj.dateSeparator,r.includes(this.localeObj.timeSeparator)&&r.includes(" ")){var s=r.split(" ");if(r=s.shift(),"Invalid"===(s=this.checkCustomTimeFormat(s.join(" "),e)).val)return{val:"Invalid",format:""}}}else{if(!(0<r.indexOf("-")))return r.includes(this.localeObj.timeSeparator)||r.includes(" "+this.localeObj.am)||r.includes(" "+this.localeObj.pm)?this.checkCustomTimeFormat(r,e):{val:"Invalid",format:""};n="-"}var a,l,h=r.split(n),d="",p=[],c=function(){d=p.join(n),o&&"General"!==o||(e.format=d+(e.format&&"General"!==e.format?" "+e.format:""))},u=J.IntlBase.getDependables(J.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?a=g[""+t]:e.substring(0,n)===r&&(a=g[""+t]||m[Number(t)-1])};if(2===h.length){u=function(e){r=a,p[0]="MMM",Number(e)<=31?(r=e+n+r,"/"!==i.localeObj.dateSeparator&&"-"!==n&&(r+=n+(new Date).getFullYear()),p.splice(0,0,"dd"),c()):1900<=Number(e)&&Number(e)<=9999?(r="1"+n+r+n+e,p[1]="yy",c(),p[1]="yyyy",d=p.join(n)):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)}),J.isNullOrUndefined(a)||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)}),J.isNullOrUndefined(a)||u(h[0])):Number(h[0])&&Number(h[0])<=12&&Number(h[1])&&("/"===this.localeObj.dateSeparator||"-"===n||t&&!e.formula)&&(a=m[Number(h[0])-1],u(h[1])),p.length||(r="Invalid")}else if(2<h.length)for(var y=0;y<h.length;y++)!function(t){-1<Number(h[t])||(h[t]=h[t].trim(),Object.keys(f).find(function(e){return v(f[""+e].toLowerCase(),e,h[t].trim().toLowerCase(),h[t].length)}),J.isNullOrUndefined(a)?r="Invalid":1===t&&(p[1]="MMM",h[2]=h[2].trim(),Number(h[0])<31)&&1900<=Number(h[2])&&Number(h[2])<=9999&&(r=h[0]+n+a,r+=n+h[2],p[0]="d",p[2]="yy",c(),p[2]="yyyy",d=p.join(n)))}(y);return s&&"Invalid"!==r&&(d||o&&"General"!==o?s.format&&(d+=" "+s.format):e.format=xo("ShortDate")+" "+(s.format||xo("Time")),r+=" "+s.val,l=!0),{val:r,format:d,isDateTime:l}},s.prototype.formattedBarText=function(e){var t,r,n,i,o,s,a,l=this;""!==e.value&&!J.isNullOrUndefined(e.value)&&(t={},a=e.cell&&e.cell.format||"",t=e.type||(a&&_i(a,!0,t,!0)?t.type:""),r=new J.Internationalization,n=e.value,i=!e.showFormattedText||"dd-MM-yyyy"!==a&&"dd/MM/yyyy"!==a?xo("ShortDate"):a,o=xo("Time"),a=a.toLowerCase(),s=function(){"."!==l.decimalSep&&e.value&&(e.value=e.value.toString(),Y(e.value))&&e.value.includes(".")&&(e.value=e.value.replace(".",l.decimalSep))},"date"===(t="time"!==t||!a.includes("m")||a.includes(":m")||a.includes("m:")||a.includes("[m")||a.includes("am")?t:"date")?(a=e.value.toString(),e.value=this.shortDateFormat({type:t,value:e.value,format:i,cell:e.cell},r),e.value&&a.includes(".")&&(e.value+=" "+this.timeFormat({type:t,value:a,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("%")&&Y(e.cell.value)?(e.value=this.parent.getDisplayText(e.cell),e.value.includes("%")||(e.value=n,s())):s(),!e.value||e.value&&-1<e.value.toString().indexOf("null"))&&(e.value=n)},s.prototype.getFormattedNumber=function(e,t){return(new J.Internationalization).formatNumber(Number(t),{format:e})||""},s.prototype.addEventListener=function(){this.parent.on(xt,this.numberFormatting,this),this.parent.on(St,this.getFormattedCell,this),this.parent.on(Ft,this.checkDateFormat,this),this.parent.on(Dt,this.formattedBarText,this),this.parent.on(Ot,this.updateAutoDetectNumberFormat,this),this.parent.on(Tt,this.parseDecimalNumber,this)},s.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(xt,this.numberFormatting),this.parent.off(St,this.getFormattedCell),this.parent.off(Ft,this.checkDateFormat),this.parent.off(Dt,this.formattedBarText),this.parent.off(Ot,this.updateAutoDetectNumberFormat),this.parent.off(Tt,this.parseDecimalNumber))},s.prototype.destroy=function(){this.removeEventListener(),this.parent=null},s.prototype.getModuleName=function(){return"workbookNumberFormat"};var bo=s;function s(e){this.parent=e,this.localeObj&&(si.currency=["$#,##0.00","$#,##0","$#,##0_);[Red]($#,##0)","$#,##0.00_);($#,##0.00)","$#,##0_);($#,##0)","$#,##0.00_);[Red]($#,##0.00)"],si.accounting=['_($* #,##0.00_);_($* (#,##0.00);_($* "-"??_);_(@_)','_($* #,##0_);_($* (#,##0);_($* "-"_);_(@_)']),this.localeObj=J.getNumericObject(this.parent.locale),this.decimalSep=this.localeObj.decimal,this.groupSep=this.localeObj.group;var o,e=J.IntlBase.getDependables(J.cldrData,this.parent.locale,null).dateObject,e=(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"),{}),t=new J.Internationalization;t.getNumberFormat(e),"$"!==J.getNumberDependable(this.parent.locale,e.currency)&&(e=t.getNumberPattern({currency:"$",useGrouping:!0,format:"c0"},!0))&&e.endsWith("$")&&(o=e[e.indexOf("$")-1].trim().length?"":" ",si.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++;si.currency[t]=e.split("$#,##0"+(r=r&&"."+r)).join("#,##0"+r+o+"$")}}),si.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+"$"+e.slice(n))}),si.accounting[t]=r.join(";"))})),this.addEventListener()}function xo(e){var t="General";switch(e.split(" ").join("")){case"Number":t="0.00";break;case"Currency":t=si.currency[0];break;case"Accounting":t=si.accounting[0];break;case"ShortDate":t="mm-dd-yyyy";break;case"LongDate":t="dddd, mmmm dd, yyyy";break;case"Time":t="h:mm:ss AM/PM";break;case"Percentage":t="0.00%";break;case"Fraction":t="# ?/?";break;case"Scientific":t="0.00E+00";break;case"Text":t="@"}return t}function So(e,t){var r="General";switch(e){case'_-* #,##0.00_-;-* #,##0.00_-;_-* "-"_-;_-@_-':case'_-* #,##0_-;-* #,##0_-;_-* "-"_-;_-@_-':r="Number";break;case"$#,##0.00":case"$#,##0":case"$#,##0_);[Red]($#,##0)":case"$#,##0.00_);($#,##0.00)":case"$#,##0_);($#,##0)":case"$#,##0.00_);[Red]($#,##0.00)":r="Currency";break;case'_($*#,##0.00_);_($*(#,##0.00);_($*"-"??_);_(@_)':case'_($*#,##0.00_);_($* (#,##0.00);_($*"-"??_);_(@_)':case'_($* #,##0.00_);_($* (#,##0.00);_($* "-"??_);_(@_)':case'_ $ * #,##0.00_ ;_ $ * -#,##0.00_ ;_ $ * "-"??_ ;_ @_ ':case'_($* #,##0_);_($* (#,##0);_($* "-"_);_(@_)':r="Accounting";break;case"mm-dd-yyyy":case"dd/MM/yyyy":r="ShortDate";break;case"dddd, mmmm dd, yyyy":r="LongDate";break;case"h:mm:ss AM/PM":r="Time";break;case"0.00%":case"0%":r="Percentage";break;case"0.00E+00":r="Scientific";break;case"@":r="Text";break;default:e&&(-1<si.currency.indexOf(e)?r="Currency":-1<si.accounting.indexOf(e)||'_(* #,##0_);_(* (#,##0);_(* "-"_);_(@_)'===e||'_(* #,##0.00_);_(* (#,##0.00);_(* "-"??_);_(@_)'===e?r="Accounting":e.includes("?/?")?r="Fraction":e.includes("[$")&&(r=e.includes("* ")?"Accounting":"Currency"),t=!1)}return r=t&&("Currency"===r&&"$#,##0.00"!==si.currency[0]||"Accounting"===r&&'_($* #,##0.00_);_($* (#,##0.00);_($* "-"??_);_(@_)'!==si.accounting[0])?"General":r}Io.prototype.destroy=function(){this.removeEventListener(),this.parent=null},Io.prototype.addEventListener=function(){this.parent.on(Yt,this.initiateSortHandler,this),this.parent.on(Xt,this.updateSortedDataOnCell,this)},Io.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(Yt,this.initiateSortHandler),this.parent.off(Xt,this.updateSortedDataOnCell))},Io.prototype.initiateSortHandler=function(r){var n=this,i=r.args,o=new V.Deferred,e=this.parent.getAddressInfo(i.range),s=ne(this.parent,e.sheetIndex),a=te(e.indices),t=i.sortOptions||{sortDescriptors:{},containsHeader:!0},e=!1;if(r.promise=o.promise,a[0]>s.usedRange.rowIndex||a[1]>s.usedRange.colIndex)o.reject(this.parent.serviceLocator.getService(ii).getConstant("SortOutOfRangeError"));else{var l=t.containsHeader,h=i.checkForHeader;(a[0]===a[2]||h)&&(h||(a=Yn(a[0],a[1],s)),e=!0,J.isNullOrUndefined(t.containsHeader))&&(l=typeof ie(a[0],a[1],s,null,!0).value!=typeof ie(a[0]+1,a[1],s,null,!0).value||!this.isSameStyle(ie(a[0],a[1],s,null,!0).style,ie(a[0]+1,a[1],s,null,!0).style)),!J.isNullOrUndefined(i.sortOptions)&&!J.isNullOrUndefined(i.sortOptions.containsHeader)||e||(h=ie(a[0],a[1],s),e=ie(a[0]+1,a[1],s),h&&e&&(l=typeof h.value!=typeof e.value||!this.isSameStyle(h.style,e.style))),a[0]=l?a[0]+1:a[0];var d=le(W(s.activeCell)[1]+1),p=(delete t.containsHeader,t.sortDescriptors),c=new V.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=ee(a);ai(this.parent,s.name+"!"+m,!0,null,null,null,null,null,void 0,null,R(d)).then(function(t){new V.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:a,sheet:s,jsonData:t});e={range:s.name+"!"+m,sortOptions:i.sortOptions};r.previousSort&&(e.previousSort=r.previousSort),o.resolve(e)})})}},Io.prototype.updateSortedDataOnCell=function(i){for(var o,e,t,s=this,a=[],r=function(e,t){for(var r=i.range[1],n=0;r<=i.range[3];r++,n++){if(a[n]||(a[n]=le(r+1)),t[a[n]])o=J.extend({},t[a[n]],null,!0);else{if(!ie(e,r,i.sheet))continue;o=null}(o=s.skipBorderOnSorting(e,r,i.sheet,o))&&o.formula&&(o.formula=jn([e,r],[parseInt(t.__rowIndex,10)-1,r],i.sheet,s.parent,o,!0)),Mi(e,r,i.sheet,o)}},n=i.isUndo&&{},l=i.range[0],h=0;l<=i.range[2];l++,h++)$(i.sheet,l)?h--:(t=i.result[h],i.isUndo?t&&(n[e=parseInt(t.__rowIndex,10)-1]=!0,r(e,t),l===e)||!n[l]&&i.sheet.rows[l]&&r(l,{}):r(l,t||{}))},Io.prototype.skipBorderOnSorting=function(e,t,r,n){var i=ie(e,t,r),e=["borderBottom","borderTop","borderRight","borderLeft","border"];if(n&&n.style)for(var o=0,s=e;o<s.length;o++){var a=s[o];delete n.style[""+a]}if(i&&i.style)for(var l=0,h=e;l<h.length;l++){a=h[l];i.style[""+a]&&((n=n||{}).style||(n.style={}),n.style[""+a]=i.style[""+a])}return n},Io.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},Io.prototype.sortComparer=function(e,t,r,n){var e=e.order||"",i=V.DataUtil.fnSort(e),o=!1;if(r&&n&&("string"==typeof r.value||"string"==typeof n.value)&&""!==r.value&&""!==n.value&&(Y(r.value)&&(r.value=An(r.value)),Y(n.value)&&(n.value=An(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=J.isNullOrUndefined(r)||r&&(J.isNullOrUndefined(r.value)||""===r.value),e=J.isNullOrUndefined(n)||n&&(J.isNullOrUndefined(n.value)||""===n.value);return t&&e?-1:t?1:e?-1:i(r&&r.value,n&&n.value)},Io.prototype.getModuleName=function(){return"workbookSort"};var wo=Io;function Io(e){this.parent=e,this.addEventListener()}Ro.prototype.destroy=function(){this.removeEventListener(),this.parent=null},Ro.prototype.addEventListener=function(){this.parent.on(tr,this.initiateFilterHandler,this)},Ro.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off(tr,this.initiateFilterHandler)},Ro.prototype.initiateFilterHandler=function(t){var e,r,n=this,i=t.args,o=new V.Deferred,s=ne(this.parent,N(this.parent,i.range)),a=i.filterOptions||{};t.promise=o.promise,a.datasource?(this.setFilter(a.datasource,a.predicates,i.range,t.refresh,a.equalOrPredicates),e={range:i.range,filterOptions:a},o.resolve(e)):(e=te(y(i.range)))[0]>s.usedRange.rowIndex||e[1]>s.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]=s.usedRange.colIndex),e[2]=s.usedRange.rowIndex,e[0]=e[0]+1,r=ee(e),ai(this.parent,s.name+"!"+r,!0,!0,null,null,null,null,!1).then(function(e){e=new V.DataManager(e);n.setFilter(e,a.predicates,i.range,t.refresh),o.resolve({range:r,filterOptions:a})}))},Ro.prototype.setFilter=function(e,t,r,n,i){var o,s,a,l,h,d,p,c,u=this;e&&t&&(o=e.dataSource.json,s=ri(e,t,i),a="__rowIndex",-1<r.indexOf("!")?(h=B(this.parent,r.split("!")[0]),l=ne(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=s.indexOf(e)<0,uh(l,Number(e[a])-1,{hidden:d,isFiltered:d})}),p=h===e.activeSheetIndex,t=Q(l.paneTopLeftCell),this.parent.updateTopLeftCell(K(l,t[0],!0)-this.parent.frozenRowCount(l),null,"col")):o.forEach(function(e){d=s.indexOf(e)<0,p?uh(l,Number(e[a])-1,{hidden:d,isFiltered:d}):((e={startIndex:Number(e[a])-1,hide:d,isFiltering:!0,sheetIndex:h}).endIndex=e.startIndex,u.parent.notify(Lr,e),p=e.refreshUI)}),p&&e.renderModule.refreshSheet(!1,!1,document.activeElement.id!==this.parent.element.id+"_SearchBox")):o.forEach(function(e){c=s.indexOf(e)<0,uh(l,Number(e[a])-1,{hidden:c,isFiltered:c})}))},Ro.prototype.getModuleName=function(){return"workbookFilter"};var Eo=Ro;function Ro(e){this.parent=e,this.addEventListener()}Ao.prototype.setImage=function(e){var t=e.range?0<e.range.indexOf("!")?e.range.split("!")[1]:e.range.split("!")[0]:this.parent.getActiveSheet().selectedRange,r=e.range&&0<e.range.indexOf("!")?B(this.parent,e.range.split("!")[0]):this.parent.activeSheetIndex,t=Q(t),r=J.isUndefined(r)?this.parent.getActiveSheet():ne(this.parent,r),n=ie(t[0],t[1],r),i=e.options;if(n&&n.image)for(var o=n.image,s=0;s<i.length;s++)o.push(i[s]);Mi(t[0],t[1],r,{image:n&&n.image?o:i},!0)},Ao.prototype.addEventListener=function(){this.parent.on(Ur,this.setImage,this)},Ao.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off(Ur,this.setImage)},Ao.prototype.destroy=function(){this.removeEventListener(),this.parent=null},Ao.prototype.getModuleName=function(){return"workbookImage"};var No=Ao;function Ao(e){this.parent=e,this.addEventListener()}Fo.prototype.addEventListener=function(){this.parent.on(_r,this.setChartHandler,this),this.parent.on(qr,this.refreshChartData,this),this.parent.on(Yr,this.deleteChartColl,this),this.parent.on(Wr,this.refreshChartSize,this),this.parent.on(Xr,this.focusChartBorder,this)},Fo.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(_r,this.setChartHandler),this.parent.off(qr,this.refreshChartData),this.parent.off(Yr,this.deleteChartColl),this.parent.off(Wr,this.refreshChartSize),this.parent.off(Xr,this.focusChartBorder))},Fo.prototype.setChartHandler=function(e){var t,r=0,n=(e.isInitCell=!J.isNullOrUndefined(e.isInitCell)&&e.isInitCell,e.isUndoRedo=!!J.isNullOrUndefined(e.isUndoRedo)||e.isUndoRedo,e.isPaste=!J.isNullOrUndefined(e.isPaste)&&e.isPaste,e.chart);if(0<n.length)for(;r<n.length;){if(!1===e.isCut&&document.getElementById(e.chart[r].id)&&(n[r]={range:n[r].range,id:J.getUniqueID("e_spreadsheet_chart"),theme:n[r].theme,isSeriesInRows:n[r].isSeriesInRows,type:n[r].type,markerSettings:n[r].markerSettings}),document.getElementById(e.chart[r].id))return;(t=n[r]).theme=t.theme||"Material",t.type=t.type||"Line",t.isSeriesInRows=t.isSeriesInRows||!1,t.range=t.range||this.parent.getActiveSheet().selectedRange;var i,o,s,a=ee(te(Q(t.range)));0<t.range.indexOf("!")?t.range=t.range.split("!")[0]+"!"+a:t.range=this.parent.getActiveSheet().name+"!"+a,J.isNullOrUndefined(t.id)&&(t.id=J.getUniqueID("e_spreadsheet_chart")),t.markerSettings&&t.markerSettings.visible&&(void 0===t.markerSettings.isFilled&&(t.markerSettings.isFilled=!0),void 0===t.markerSettings.shape)&&(t.markerSettings.shape="Circle"),t.height=t.height||290,t.width=t.width||480,this.parent.notify(zr,{option:t,isInitCell:e.isInitCell,triggerEvent:e.isUndoRedo,dataSheetIdx:e.dataSheetIdx,range:e.range,isPaste:e.isPaste}),this.parent.chartColl.push(t),!e.isInitCell||e.isPaste?(a=void 0===e.sheetId?t.range&&0<t.range.indexOf("!")?B(this.parent,t.range.split("!")[0]):this.parent.activeSheetIndex:bi(this.parent,e.sheetId),o={clientY:t.top,isImage:!0},s={clientX:t.left,isImage:!0},this.parent.notify(Cn,o),this.parent.notify(bn,s),a=J.isUndefined(a)?this.parent.getActiveSheet():this.parent.sheets[a],i=ie(o.clientY,s.clientX,a),this.parent.isPrintingProcessing||(i&&i.chart?i.chart.push(t):Mi(o.clientY,s.clientX,a,{chart:[t]},!0))):(i=Q(e.range),o={clientY:t.top,isImage:!0},s={clientX:t.left,isImage:!0},this.parent.notify(Cn,o),this.parent.notify(bn,s),a={prevTop:t.top,prevLeft:t.left,prevRowIdx:i[0],prevColIdx:i[1],prevHeight:t.height,prevWidth:t.width,currentTop:t.top,currentLeft:t.left,currentRowIdx:o.clientY,currentColIdx:s.clientX,currentHeight:t.height,currentWidth:t.width,id:t.id,requestType:"chartRefreshOnInit"},i[0]===o.clientY&&i[1]===s.clientX||this.parent.notify(xn,a)),r++}},Fo.prototype.refreshChartData=function(e){if(this.parent.chartColl&&this.parent.chartColl.length)for(var t,r,n,i,o=0,s=this.parent.chartColl.length;o<s;o++){if((t=this.parent.chartColl[o]).range.includes("!")){if(r=t.range.split("!"),this.parent.activeSheetIndex!==B(this.parent,r[0]))continue;n=r[1]}else n=t.range;if(e.viewportIndexes){for(var a=0;a<e.viewportIndexes.length;a++)if(Zn([e.viewportIndexes[a]],n)){i=!0;break}}else i=e.range?Zn([e.range],n):e.showHide?this.inRowColumnRange(Q(n),e.rIdx,e.showHide):Pn(Q(n),e.rIdx,e.cIdx);i&&this.parent.notify(Gr,{chart:t})}},Fo.prototype.inRowColumnRange=function(e,t,r){return"rows"===r?t>=e[0]&&t<=e[2]:t>=e[1]&&t<=e[3]},Fo.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];!J.isNullOrUndefined(e.overlayEle.querySelector("#"+o.id))&&(o=this.parent.element.querySelector("."+o.id),o=J.getComponent(o,"chart"))&&(o.height=e.height,o.width=e.width)}t++}},Fo.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&&J.closest(n,"."+r.classList[1])===r&&this.parent.notify(zr,{option:this.parent.chartColl[t],isRefresh:!0})}},Fo.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)},Fo.prototype.destroy=function(){this.removeEventListener(),this.parent=null},Fo.prototype.getModuleName=function(){return"workbookChart"};var ko=Fo;function Fo(e){this.parent=e,this.addEventListener()}To.prototype.format=function(e){var t=this,r=e.range,n=r&&"string"==typeof r&&-1<r.indexOf("!")?(r=r.split("!")[1],this.parent.sheets[B(this.parent,e.range.split("!")[0])]):this.parent.getActiveSheet(),i="object"!=typeof(r=void 0===r?n.selectedRange:r)&&e.onActionUpdate,o={range:r,style:Object.assign({},e.style),requestType:"CellFormat"},s=(e.borderType&&(o.borderType=e.borderType),{}),a="object"==typeof o.range?o.range:te(Q(o.range)),l=ni(ie(a[0],a[1],n),se(n,a[1]),ch(n,a[0])),h=!!se(n,a[1])&&se(n,a[1]).isReadOnly,d=!!ch(n,a[0])&&ch(n,a[0]).isReadOnly;if(Object.assign(s,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(n,e.style.border,a,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,Gn(t.parent,n,u)};if(void 0!==o.style.borderTop){for(v=a[1];v<=a[3];v++)k=a[0],f({borderTop:o.style.borderTop})||(e.isUndoRedo||(this.checkAdjacentBorder(n,"borderBottom",k-1,v),this.checkFullBorder(n,"borderBottom",k-1,v)),this.checkFullBorder(n,"borderTop",k,v),this.setCellBorder(n,u.cell.style,k,v,e.onActionUpdate,v===a[3],null,null,e.isUndoRedo));delete o.style.borderTop}if(void 0!==o.style.borderBottom){for(var g,m=void 0,v=a[1];v<=a[3];v++)m=0<(g=ie(k=a[0],v,n,!1,!0)).rowSpan?ie(a[2],a[1],n,!1,!0):ie(a[2],a[3],n,!1,!0),1<g.rowSpan&&m.rowSpan<0||(k=a[2]),f({borderBottom:o.style.borderBottom})||(e.isUndoRedo||(this.checkAdjacentBorder(n,"borderTop",a[2]+1,v),this.checkFullBorder(n,"borderTop",a[2]+1,v)),this.checkFullBorder(n,"borderBottom",a[2],v),this.setCellBorder(n,u.cell.style,k,v,e.onActionUpdate,v===a[3],null,null,e.isUndoRedo),this.setBottomBorderPriority(n,a[2],v));delete o.style.borderBottom}if(void 0!==o.style.borderLeft){for(var y=a[0];y<=a[2];y++)v=a[1],f({borderLeft:o.style.borderLeft})||(e.isUndoRedo||(this.checkAdjacentBorder(n,"borderRight",y,v-1),this.checkFullBorder(n,"borderRight",y,v-1)),this.checkFullBorder(n,"borderLeft",y,v),this.setCellBorder(n,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=a[0];C<=a[2];C++)v=a[3],f({borderRight:o.style.borderRight})||(e.isUndoRedo||(this.checkAdjacentBorder(n,"borderLeft",C,v+1),this.checkFullBorder(n,"borderLeft",C,v+1)),this.checkFullBorder(n,"borderRight",C,v),this.setCellBorder(n,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===n.id,I=this.parent.frozenRowCount(n),E=this.parent.frozenColCount(n),R=[I+S.viewport.topIndex,E+S.viewport.leftIndex,S.viewport.bottomIndex,S.viewport.rightIndex],N=void 0,A=void 0,k=a[0];k<=a[2];k++)if(!(x=ch(n,k)||{}).isFiltered)for(b=R[0]<=k&&k<=R[2]||k<I,N=!1,v=a[1];v<=a[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 F=ie(k,v,n,!1,!0),O=se(n,v),T=ch(n,k);if(!(F&&F.isReadOnly||O&&O.isReadOnly||T&&T.isReadOnly)){if(1<F.rowSpan||1<F.colSpan)for(var D=k,L=1<F.rowSpan?k+(F.rowSpan-1):k;D<=L;D++)for(var P=v,M=1<F.colSpan?v+(F.colSpan-1):v;P<=M;P++)c&&this.setFullBorder(n,p,a,D,P,e.onActionUpdate,!0),this.setCellStyle(n,D,P,o.style);c&&this.setFullBorder(n,p,a,k,v,e.onActionUpdate),this.setCellStyle(n,k,v,o.style),w&&(b&&(R[1]<=v&&v<=R[3]||v<E)?(A=null,o.style.color&&F.format&&F.format.includes("[")&&(O=Vi(F.format))&&(A=O.toLowerCase()),this.parent.notify(Nt,{style:o.style,rowIdx:k,colIdx:v,lastCell:v===a[3],isHeightCheckNeeded:!0,manualUpdate:!0,onActionUpdate:e.onActionUpdate,formatColor:A})):x.customHeight||(N=N||zn(o.style,e.onActionUpdate))&&this.parent.notify(Nt,{rowIdx:k,colIdx:v,lastCell:v===a[3],checkHeight:!0,outsideViewport:!b,onActionUpdate:e.onActionUpdate}))}}c&&(o.style.border=p),this.parent.setUsedRange(a[2],a[3]),e.refreshRibbon&&this.parent.notify(Lt,null),!i||l||h||d||(o.style=s,o.range=n.name+"!"+r,this.parent.notify("actionComplete",{eventArgs:o,action:"format"}))}else e.cancel=!0},To.prototype.setBottomBorderPriority=function(e,t,r){var n;$(e,t+1)&&(n=this.skipHiddenRows(e,t+1),""!==this.parent.getCellStyleValue(["borderTop"],[n,r]).borderTop)&&(e.rows[t].cells[r].style.bottomPriority=!0)},To.prototype.setFullBorder=function(e,t,r,n,i,o,s){var a={};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),a.borderRight=t,a.borderTop=t,a.borderLeft=t,a.borderBottom=t,this.setCellBorder(e,a,n,i,o,i===r[3],null,s),n===r[2]?(this.checkAdjacentBorder(e,"borderTop",n+1,i),this.checkFullBorder(e,"borderTop",n+1,i),this.setBottomBorderPriority(e,n,i)):this.checkAdjacentBorder(e,"border",n+1,i)},To.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))},To.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))},To.prototype.textDecorationActionUpdate=function(e){var t=this.parent.getActiveSheet(),r={range:t.selectedRange,style:e.style,requestType:"CellFormat"},n=te(Q(t.selectedRange)),i=ni(ie(n[0],n[1],t),se(t,n[1]),ch(t,n[0])),o=!!se(t,n[1])&&se(t,n[1]).isReadOnly,s=!!ch(t,n[0])&&ch(t,n[0]).isReadOnly;if(i||o||s||(this.parent.trigger("beforeCellFormat",r),this.parent.notify("actionBegin",{eventArgs:r,action:"format"}),!r.cancel)){var a,l=e.style.textDecoration,h=l,d=Q(t.activeCell),p=this.parent.getCellStyleValue(["textDecoration"],d).textDecoration,c=!1;"underline"===p?h="underline"===l?"none":"underline line-through":"line-through"===p?h="line-through"===l?"none":"underline line-through":"underline line-through"===p&&(h="underline"===l?"line-through":"underline",c=!0),"none"===h&&(c=!0),this.format({style:{textDecoration:h},range:d,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!==d[0]||f!==d[1]){if(a={},"none"===(p=this.parent.getCellStyleValue(["textDecoration"],[u,f]).textDecoration)){if(c)continue;a.textDecoration=l}else if("underline"===p||"line-through"===p)if(c){if(l!==p)continue;a.textDecoration="none"}else a.textDecoration=l!==p?"underline line-through":l;else if("underline line-through"===p){if(!c)continue;a.textDecoration="underline"===l?"line-through":"underline"}this.format({style:a,range:[u,f,u,f],refreshRibbon:e.refreshRibbon,onActionUpdate:!0})}i||o||s||(r.range=t.name+"!"+r.range,r.style.textDecoration=h,this.parent.notify("actionComplete",{eventArgs:r,action:"format"}))}else e.cancel=!0},To.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 s=r[0];s<=r[2];s++)this.checkAdjacentBorder(e,"borderRight",s,r[1]-1),this.checkFullBorder(e,"borderRight",s,r[1]-1),this.setCellBorder(e,{borderLeft:t},s,r[1],i),this.checkAdjacentBorder(e,"borderLeft",s,r[3]+1),this.checkFullBorder(e,"borderLeft",s,r[3]+1),this.setCellBorder(e,{borderRight:t},s,r[3],i,null,n)}else if("Inner"===n)for(var a=r[0];a<=r[2];a++)for(var l=r[1];l<=r[3];l++){var h,d={};""!==(h=this.parent.getCellStyleValue(["border"],[a,l]).border)&&(d.border=void 0,l!==r[3]&&l!==r[1]&&a!==r[0]&&a!==r[2]||(a===r[0]&&(d.borderTop=h),a===r[2]&&(d.borderBottom=h),l===r[3]&&(d.borderRight=h),l===r[1]&&(d.borderLeft=h))),l!==r[3]&&(d.borderRight=t),a!==r[0]&&(d.borderTop=t),a!==r[2]&&(d.borderBottom=t),l!==r[1]&&(d.borderLeft=t),this.setCellBorder(e,d,a,l,i,l===r[3])}else if("Vertical"===n)for(a=r[0];a<=r[2];a++)for(l=r[1];l<=r[3];l++){d={borderRight:t,borderLeft:t};l===r[1]&&(this.checkAdjacentBorder(e,"borderRight",a,l-1),this.checkFullBorder(e,"borderRight",a,l-1)),l===r[3]&&(this.checkAdjacentBorder(e,"borderLeft",a,l+1),this.checkFullBorder(e,"borderLeft",a,l+1)),this.setCellBorder(e,d,a,l,i)}else for(a=r[0];a<=r[2];a++)for(l=r[1];l<=r[3];l++){d={borderTop:t,borderBottom:t};a===r[0]&&(this.checkAdjacentBorder(e,"borderBottom",a-1,l),this.checkFullBorder(e,"borderBottom",a-1,l)),this.setCellBorder(e,d,a,l,i,l===r[3]),a===r[2]&&(this.checkAdjacentBorder(e,"borderTop",a+1,l),this.checkFullBorder(e,"borderTop",a+1,l),this.setBottomBorderPriority(e,a,l))}},To.prototype.setCellBorder=function(e,t,r,n,i,o,s,a,l){var h=ie(r,n,e),d=se(e,n),p=ch(e,r);h&&h.isReadOnly||d&&d.isReadOnly||p&&p.isReadOnly||(this.setCellStyle(e,r,n,t),a)||this.parent.getActiveSheet().id!==e.id||("Outer"===s&&(t.borderBottom||t.borderRight)&&(this.parent.notify(Tr,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(Nt,{style:t,rowIdx:r,colIdx:n,onActionUpdate:i,first:"",lastCell:o,isHeightCheckNeeded:!0,manualUpdate:!0}))},To.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)},To.prototype.skipHiddenRows=function(e,t){return t=$(e,++t)?this.skipHiddenRows(e,t):t},To.prototype.addEventListener=function(){this.parent.on(It,this.format,this),this.parent.on(Rt,this.textDecorationActionUpdate,this),this.parent.on(Hr,this.clearCellObj,this)},To.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(It,this.format),this.parent.off(Rt,this.textDecorationActionUpdate),this.parent.off(Hr,this.clearCellObj))},To.prototype.clearCellObj=function(e){for(var t,r,n,i,o,s=e.range?0<e.range.indexOf("!")?e.range.split("!")[1]:e.range.split("!")[0]:this.parent.getActiveSheet().selectedRange,a=e.range&&0<e.range.indexOf("!")?B(this.parent,e.range.split("!")[0]):this.parent.activeSheetIndex,l=ne(this.parent,a),h=te(y(s)),d=h[0],p=h[2],c=l.conditionalFormats&&l.conditionalFormats.length&&[].slice.call(l.conditionalFormats),u=[];d<=p;d++)for(n=h[1],i=h[3];n<=i;n++){var f=ie(d,n,l),g=ni(f,se(l,n),ch(l,d));if(f&&!g)switch(e.type){case"Clear Formats":delete f.format,delete f.rowSpan,delete f.style,delete f.wrap,delete f.colSpan;break;case"Clear Contents":f.hyperlink&&this.parent.notify(Qr,{sheet:l,rowIdx:d,colIdx:n,preventRefresh:!0}),o=!(!f.value&&!f.formula),delete f.value,delete f.formula,o&&(this.parent.notify(re,r={action:"refreshCalculate",rowIndex:d,colIndex:n,sheetIndex:a}),c)&&!(t=t||r.isFormulaDependent)&&$n(c,u,d,n);break;case"Clear Hyperlinks":delete f.hyperlink;break;case"Clear All":o=!(!f.value&&!f.formula),Mi(d,n,l,{},!1),o&&(this.parent.notify(re,r={action:"refreshCalculate",rowIndex:d,colIndex:n,sheetIndex:a}),c)&&!t&&(t=r.isFormulaDependent)}}(u.length||t)&&a===this.parent.activeSheetIndex&&this.parent.notify(Mr,{cfModel:!t&&u,refreshAll:t,isAction:!0})},To.prototype.destroy=function(){this.removeEventListener(),this.parent=null},To.prototype.getModuleName=function(){return"workbookcellformat"};var Oo=To;function To(e){this.parent=e,this.addEventListener()}Lo.prototype.destroy=function(){this.removeEventListener(),this.parent=null},Lo.prototype.addEventListener=function(){this.parent.on(kt,this.performEditOperation,this)},Lo.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off(kt,this.performEditOperation)},Lo.prototype.getModuleName=function(){return"workbookEdit"},Lo.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))},Lo.prototype.updateCellValue=function(e,t,r,n,i,o,s){void 0===r&&(r=this.parent.activeSheetIndex),e="string"==typeof e?Q(e):e;var a,l,h,d,p=ne(this.parent,r),c=(c=ie(e[0],e[1],p,!0))||(p.rows[e[0]].cells[e[1]]={});return n||(n=X(t),n="#SPILL!"===t||n,l=!1,c.formula&&-1<c.formula.indexOf("UNIQUE")&&""===t&&(l=!0),d=!("Text"===So(c.format)||n&&t.toLowerCase().startsWith("=text(")),n||l||(c.formula&&(c.formula=""),c.value=d?An(t):t),h={action:"refreshCalculate",value:t,rowIndex:e[0],colIndex:e[1],sheetIndex:r,isFormula:n,isRandomFormula:o},d&&!i&&(d={value:t,rowIndex:e[0],colIndex:e[1],sheetIndex:r,updatedVal:"",skipCellFormat:s},n?t.toLowerCase().includes("unique(")&&(d.updatedVal=t):this.parent.notify(Ft,d),!J.isNullOrUndefined(d.updatedVal))&&0<d.updatedVal.length&&(c.value=d.updatedVal),"#SPILL!"===t)?c.value=t:(this.parent.notify(zt,{cellIdx:e,isUnique:!1}),l?t=c.value:(this.parent.notify(re,h),a=h.isFormulaDependent),n?(c.formula=h.value,t=c.value,"=now()"!==(i=c.formula.toLowerCase())||c.format&&"General"!==c.format?i.includes("=time(")&&!c.format&&(c.format="h:mm AM/PM"):c.format=xo("ShortDate")+" h:mm"):!c.value||"string"!=typeof c.value||0!==c.value.indexOf("www.")&&0!==c.value.indexOf("https://")&&0!==c.value.indexOf("http://")&&0!==c.value.indexOf("ftp://")||this.parent.notify(er,{hyperlink:c.value,cell:p.name+"!"+G(e[0],e[1])})),this.parent.setUsedRange(e[0],e[1],p),!this.parent.chartColl.length||this.parent.isEdit||o||this.parent.notify(qr,{cell:c,rIdx:e[0],cIdx:e[1],sheetIdx:r}),a};var Do=Lo;function Lo(e){this.parent=e,this.addEventListener()}Mo.prototype.destroy=function(){this.removeEventListener(),this.parent=null},Mo.prototype.addEventListener=function(){this.parent.on(er,this.setLinkHandler,this)},Mo.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off(er,this.setLinkHandler)},Mo.prototype.setLinkHandler=function(e){var t=e.hyperlink;if((i=e.cell)&&-1!==i.indexOf("!")){var r=i.split("!"),n=ne(this.parent,B(this.parent,r[0])),i=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 s,a=te(Q(i)),l=("string"==typeof t?0===t.toLowerCase().indexOf("www.")&&(t="http://"+t):0===t.address.toLowerCase().indexOf("www.")&&(t.address="http://"+t.address),Q(n.activeCell)),h=a[0];h<=a[2];h++)for(var d=a[1];d<=a[3];d++)o&&Vn(ie(h,d,n),se(n,d))||(s={hyperlink:t},J.isNullOrUndefined(e.displayText)||h!==l[0]||d!==l[1]||(e.triggerEvt?h===l[0]&&d===l[1]&&(s.value=e.displayText):J.isNullOrUndefined(ie(h,d,n,!1,!0).value)&&(s.value=e.displayText)),s.style={textDecoration:"underline",color:"#00e"},Gn(this.parent,n,{cell:s,rowIdx:h,colIdx:d,preventEvt:!e.triggerEvt}))},Mo.prototype.getModuleName=function(){return"workbookHyperlink"};var Po=Mo;function Mo(e){this.parent=e,this.addEventListener()}Ho.prototype.insertModel=function(e){var t,r=this;if(e.model){var n,i,o,s=[];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 a=n;a<=e.end;a++)s.push({}),o&&o.push(null)}else e.start?(n=e.start[0].index||0,s=e.start,i=!0):(n=0,s.push({})),"Row"===e.modelType&&n<e.model.maxHgts.length&&(o=[],s.forEach(function(){o.push(null)}));var l={model:s,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+s.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(a=e.model.usedRange.rowIndex;a<n-1;a++)s.splice(0,0,{});for(var p,c=this.parent.frozenRowCount(e.model),u=(n<c&&(this.parent.setSheetPropertyOnMute(e.model,"frozenRows",e.model.frozenRows+s.length),l.freezePane=!0),(c=e.model.rows).splice.apply(c,[n,0].concat(s)),o&&(c=e.model.maxHgts).splice.apply(c,[n,0].concat(o)),this.setRowColCount(d.startIndex,d.endIndex,e.model,"row"),n>e.model.usedRange.rowIndex?this.parent.setUsedRange(n+(s.length-1),e.model.usedRange.colIndex,e.model,!0):this.parent.setUsedRange(e.model.usedRange.rowIndex+s.length,e.model.usedRange.colIndex,e.model,!0),n+s.length),f=void 0,g=this,a=0;a<=e.model.usedRange.colIndex;a++)!function(t){e.model.rows[u]&&e.model.rows[u].cells&&e.model.rows[u].cells[t]&&(void 0!==(f=e.model.rows[u].cells[t]).rowSpan&&f.rowSpan<0&&void 0===f.colSpan&&g.parent.notify(Dr,{range:[u,t,u,t],insertCount:s.length,insertModel:"Row"}),f.style)&&ie(n-1,t,e.model,!1,!0).style&&(p=g.checkBorder(f.style,e.model.rows[n-1].cells[t].style))!=={}&&s.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,p)})}(a);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]={}),(c=e.model.columns).splice.apply(c,[n,0].concat(s));var c=this.parent.frozenColCount(e.model),m=(n<c&&(this.parent.setSheetPropertyOnMute(e.model,"frozenColumns",e.model.frozenColumns+s.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+(s.length-1),e.model,!0):this.parent.setUsedRange(e.model.usedRange.rowIndex,e.model.usedRange.colIndex+s.length,e.model,!0),e.model.rows||(e.model.rows=[]),[]);e.columnCellsModel||(e.columnCellsModel=[]);for(a=0;a<s.length;a++)m.push(null);for(var v,y=[],f=void 0,a=0;a<=e.model.usedRange.rowIndex;a++){e.model.rows[a]?e.model.rows[a].cells||(e.model.rows[a].cells=[]):e.model.rows[a]={cells:[]},n&&!e.model.rows[a].cells[n-1]&&(e.model.rows[a].cells[n-1]={}),(t=e.model.rows[a].cells).splice.apply(t,[n,0].concat(e.columnCellsModel[a]&&e.columnCellsModel[a].cells?e.columnCellsModel[a].cells:m));u=n+s.length;if(e.model.rows[a].cells[u]&&(void 0!==(f=e.model.rows[a].cells[u]).colSpan&&f.colSpan<0&&void 0===f.rowSpan&&y.push({range:[a,u,a,u],insertCount:m.length,insertModel:"Column"}),f.style)&&ie(a,n-1,e.model,!1,!0).style&&(v=this.checkBorder(f.style,e.model.rows[a].cells[n-1].style))!=={})for(var C=n;C<u;C++)e.model.rows[a].cells[C]||(e.model.rows[a].cells[C]={}),e.model.rows[a].cells[C].style||(e.model.rows[a].cells[C].style={}),Object.assign(e.model.rows[a].cells[C].style,v)}y.forEach(function(e){r.parent.notify(Dr,e)}),l.sheetCount=e.model.columns.length}else{if(void 0!==e.checkCount&&e.checkCount===this.parent.sheets.length)return;for(var b,x=s,c=ki(this.parent),d=e.isFromUpdateAction,a=0;a<x.length;a++)if(x[a].name)for(C=0;C<this.parent.sheets.length;C++)if(x[a].name===this.parent.sheets[C].name){x.splice(a,1),a--;break}if(!x.length)return;delete s[0].index,this.parent.createSheet(n,s),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,c)},!0),s.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),b=e.id,r.parent.notify(re,{action:"addSheet",visibleName:e.name,sheetName:"Sheet"+b,sheetId:b})}),l.activeSheetIndex=e.activeSheetIndex,l.sheetCount=this.parent.sheets.length}"Sheet"!==e.modelType&&(this.insertConditionalFormats(e),this.parent.notify(ln,{start:n,end:n+s.length-1,modelType:e.modelType,model:e.model,isInsert:!0}),l.activeSheetIndex=B(this.parent,e.model.name)),this.parent.notify(or,h)}},Ho.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(At,{index:r[i]-1,update:n,isInsert:!0,start:e,end:t})},Ho.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")})},Ho.prototype.checkBorder=function(e,t){var r={};return 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),r},Ho.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)})},Ho.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=ee(Xn(e,Q(t[r].range),!e.isAction&&!e.isUndoRedo))},Ho.prototype.addEventListener=function(){this.parent.on(ar,this.insertModel,this)},Ho.prototype.destroy=function(){this.removeEventListener(),this.parent=null},Ho.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off(ar,this.insertModel)},Ho.prototype.getModuleName=function(){return"workbookinsert"};var Bo=Ho;function Ho(e){this.parent=e,this.addEventListener()}Uo.prototype.deleteModel=function(e){var t=this,r=this.parent.sheets.length;if("Sheet"!==e.modelType||1!==r){var n=e.modelType.toLowerCase()+"s",r=(e.start=e.start,e.start>e.end&&(r=e.start,e.start=e.end,e.end=r),{startIndex:e.start,endIndex:e.end,modelType:e.modelType,cancel:!1,isUndoRedo:e.isUndoRedo}),i={eventArgs:r,action:"delete"};if(!e.isAction||(this.parent.notify(gt,i),!r.cancel)){var o,s,a=[],l=e.end-e.start+1,h={startIndex:e.start,endIndex:e.end,modelType:e.modelType,sheet:e.model},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&&(e.model.usedRange.rowIndex-=e.end-e.start+1,e.model.usedRange.rowIndex<0)&&(e.model.usedRange.rowIndex=0);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),r.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(Tr,f),f.range,f.range[2]<=e.end)&&((s=ie(f.range[0],g,e.model))&&1<s.rowSpan&&(1<s.rowSpan-(f.range[2]-e.start+1)?Mi(f.range[0],g,e.model,{colSpan:s.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(Tr,f={range:[c,g,c,g]}),u=new Object,f.range=f.range,Object.assign(u,ie(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)),a.push({range:v,isAction:!1,preventRefresh:!0,merge:!0,type:"All",skipChecking:!0})),f=null;r.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&&(e.model.usedRange.colIndex-=l,e.model.usedRange.colIndex<0)&&(e.model.usedRange.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(),r.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(Tr,f),f.range=f.range,f.range[3]<=e.end)&&((m=ie(g,f.range[1],e.model))&&1<m.colSpan&&(1<m.colSpan-(f.range[3]-e.start+1)?Mi(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(Tr,f={range:[g,c,g,c]}),u=new Object,f.range=f.range,Object.assign(u,ie(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)),a.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);r.sheetCount=e.model.usedRange.colIndex,r.deletedCellsModel=o}else{if(e.end-e.start==this.parent.sheets.length-1||void 0!==e.checkCount&&e.checkCount===this.parent.sheets.length)return;r.sheetCount=this.parent.sheets.length,r.activeSheetIndex=this.parent.activeSheetIndex}for(var y=[],C="Row"===e.modelType&&e.start<e.model.maxHgts.length,g=e.start;g<=e.end;g++){var b=e.model[n];"Sheet"===e.modelType&&b[g]&&this.parent.notify(re,{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)}a.forEach(function(e){return t.parent.notify(kr,e)}),this.parent.notify(Jr,e),"Sheet"!==e.modelType&&(this.parent.notify(ln,e),r.refreshSheet=e.refreshSheet,r.activeSheetIndex=B(this.parent,e.model.name),r.conditionalFormats=[],this.deleteConditionalFormats(e,r)),r.definedNames=h.definedNames,r.isAction=e.isAction,r.deletedModel=y,delete r.cancel,this.parent.notify(sr,i)}}},Uo.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(At,{index:o-1,update:n,isDelete:!0,start:e,end:t}))},Uo.prototype.setDeleteInfo=function(t,r,n,i){void 0===i&&(i="Row");var o=r-t+1,s=[];this.parent.getActiveSheet().ranges.forEach(function(e){e.info&&t<e.info[""+n]&&(e.info["delete"+i+"Range"]?e.info["delete"+i+"Range"].push([t,r]):e.info["delete"+i+"Range"]=[[t,r]],e.info[""+n]-=o,e.info["insert"+i+"Range"])&&(e.info["insert"+i+"Range"]=s)})},Uo.prototype.deleteConditionalFormats=function(e,t){var r=e.model.conditionalFormats;if(r)for(var n=0;n<r.length;n++){t.conditionalFormats.push(J.extend({},r[n],null,!0));var i=Q(r[n].range),o=Q(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=ee(Kn(e,i))}},Uo.prototype.addEventListener=function(){this.parent.on(lr,this.deleteModel,this)},Uo.prototype.destroy=function(){this.removeEventListener(),this.parent=null},Uo.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off(lr,this.deleteModel)},Uo.prototype.getModuleName=function(){return"workbookdelete"};var Vo=Uo;function Uo(e){this.parent=e,this.addEventListener()}zo.prototype.destroy=function(){this.removeEventListener(),this.parent=null},zo.prototype.addEventListener=function(){this.parent.on(dr,this.validationHandler,this),this.parent.on(pr,this.addHighlightHandler,this),this.parent.on(yr,this.removeHighlightHandler,this),this.parent.on(Zr,this.beforeInsertDeleteHandler,this),this.parent.on(Jr,this.beforeInsertDeleteHandler,this)},zo.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(dr,this.validationHandler),this.parent.off(pr,this.addHighlightHandler),this.parent.off(yr,this.removeHighlightHandler),this.parent.off(Zr,this.beforeInsertDeleteHandler),this.parent.off(Jr,this.beforeInsertDeleteHandler))},zo.prototype.validationHandler=function(t){var n=this,e=t.range,r="",i=(-1<t.range.indexOf("!")&&(e=t.range.split("!")[1],r=t.range.split("!")[0]),ne(this.parent,r?B(this.parent,r):this.parent.activeSheetIndex)),o=(this.parent.dataValidationRange=(-1<this.parent.dataValidationRange.indexOf("!")?"":i.name+"!")+this.parent.dataValidationRange+e+",",this.getRangeWhenColumnSelected(e,i)),e=o.range;J.isNullOrUndefined(r)||(t.range=r+"!"+e),t.range=t.range||i.selectedRange;for(var s,a,l,h=te(Q(t.range)),d=(t.viewport&&o.isFullCol&&(l=Qn(this.parent,t.viewport)),","!==this.parent.listSeparator&&!t.isRemoveValidation&&"List"===t.rules.type&&t.rules.value1.includes(this.parent.listSeparator)&&(t.rules.value1=t.rules.value1.split(this.parent.listSeparator).join(",")),this),p=h[1];p<=h[3];p++)!function(r){if(o.isFullCol){if(a=se(i,r),!t.isRemoveValidation)return(a=se(i,r)).validation={operator:t.rules.operator,type:t.rules.type,value1:t.rules.value1,value2:t.rules.value2,inCellDropDown:t.rules.inCellDropDown,ignoreBlank:t.rules.ignoreBlank};if(a&&a.validation)return delete a.validation,l&&l.forEach(function(e){for(var t=e[0];t<=e[2];t++)s=ie(t,r,i),n.parent.notify(Nt,{rowIdx:t,colIdx:r,style:n.parent.getCellStyleValue(["backgroundColor","color"],[t,r])})})}for(var e=h[0];e<=h[2];e++)t.isRemoveValidation?(e===h[2]&&(a=se(i,r))&&a.validation&&(a.validation.address=Hn(a.validation.address,[h[0],r,h[2],r],r)),(s=ie(e,r,i))&&s.validation&&!Gn(d.parent,i,{cell:{validation:{}},rowIdx:e,colIdx:r})&&(delete s.validation,d.parent.notify(Nt,{rowIdx:e,colIdx:r,style:d.parent.getCellStyleValue(["backgroundColor","color"],[e,r])}))):(s={validation:Object.assign({},t.rules)},Gn(d.parent,i,{cell:s,rowIdx:e,colIdx:r}))}(p)},zo.prototype.addHighlightHandler=function(e){this.InvalidDataHandler(e.range,!1,e.td,e.isclearFormat)},zo.prototype.removeHighlightHandler=function(e){this.InvalidDataHandler(e.range,!0)},zo.prototype.getRange=function(e){var t=Q(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},zo.prototype.InvalidDataHandler=function(e,t,r,n){for(var i=e?N(this.parent,e):this.parent.activeSheetIndex,o=ne(this.parent,i),s=(e=e||o.selectedRange).includes("!")?xi(e):o.name,a=this.getRangeWhenColumnSelected(C(e),o),l=a.isFullCol,h=(e=s+"!"+a.range)?te(Q(e)):[],d=(e=this.getRange(e))?h[0]:0,p=e?h[2]:o.rows.length;d<=p;d++)if(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=se(o,c);if((m=o.rows[d].cells[c])&&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;t&&l?f.isHighlighted&&(g.validation.isHighlighted=!1):l&&(g.validation.isHighlighted=!0)}var m,g=m.value||"";f&&this.parent.allowDataValidation&&(this.parent.notify(hr,m={value:g,range:[d,c],sheetIdx:i,isCell:!1,td:r,isValid:!0}),m.isValid||$(o,d)||i!==this.parent.activeSheetIndex||this.parent.notify($r,{isRemoveHighlightedData:t,rowIdx:d,colIdx:c,td:r}))}}},zo.prototype.beforeInsertDeleteHandler=function(e){if("Sheet"!==e.modelType)for(var t=0,r=this.parent.sheets.length;t<r;t++)for(var n,i=0,o=(n=this.parent.sheets[t]).rows.length;i<o;i++)if(n.rows[i]&&n.rows[i].cells)for(var s,a,l,h,d=0,p=n.rows[i].cells.length;d<p;d++)(h=n.rows[i].cells[d])&&h.validation&&(s="beforeInsert"===e.name,a=e.index+(e.model.length-1),a="Row"===e.modelType?i>=e.index&&i<=a:d>=e.index&&d<=a,l=void 0,l=s?{insertDeleteArgs:{startIndex:e.index,endIndex:e.index+e.model.length-1,modelType:e.modelType,isInsert:!0,sheet:ne(this.parent,e.activeSheetIndex)},row:i,col:d,sheetIdx:t}:{insertDeleteArgs:{startIndex:e.start,modelType:e.modelType,endIndex:e.end,sheet:e.model},row:i,col:d,sheetIdx:t},X(h.validation.value1)&&!a&&(l.cell={formula:h.validation.value1},this.parent.notify(cn,l),h.validation.value1=l.cell.formula),X(h.validation.value2)&&!a&&(l.cell={formula:h.validation.value2},this.parent.notify(cn,l),h.validation.value2=l.cell.formula),e.activeSheetIndex===t)&&s&&this.updateValidationForInsertedModel(e,n,i,d,h.validation)},zo.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}},zo.prototype.updateValidationForInsertedModel=function(e,t,r,n,i){var o=e.index+(e.model.length-1);if("Column"===e.modelType){if("before"===e.insertType&&o===n-1||"after"===e.insertType&&e.index-1===n)for(var s=e.index;s<=o;s++)Mi(r,s,t,{validation:J.extend({},i)},!0)}else if("Row"===e.modelType&&("above"===e.insertType&&o===r-1||"below"===e.insertType&&e.index-1===r))for(s=e.index;s<=o;s++)Mi(s,n,t,{validation:J.extend({},i)},!0)},zo.prototype.getModuleName=function(){return"workbookDataValidation"};var _o=zo;function zo(e){this.parent=e,this.addEventListener()}var jo=function(){return(jo=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)},qo=(Wo.prototype.destroy=function(){this.removeEventListener(),this.parent=null},Wo.prototype.addEventListener=function(){this.parent.on(cr,this.find,this),this.parent.on(fr,this.replace,this),this.parent.on(gr,this.replaceAll,this),this.parent.on(br,this.totalCount,this),this.parent.on(Et,this.findAllValues,this)},Wo.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(cr,this.find),this.parent.off(fr,this.replace),this.parent.off(gr,this.replaceAll),this.parent.off(br,this.totalCount),this.parent.off(Et,this.findAllValues))},Wo.prototype.find=function(e){e.sheetIndex=J.isUndefined(e.sheetIndex)?this.parent.activeSheetIndex:e.sheetIndex;var t,r=this.parent.sheets[e.sheetIndex],n=Q(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),"next"===e.findOpt?this.findNext(e,n):this.findPrevious(e,n),e.showDialog&&this.parent.notify(vt,{findValue:e.value,isPublic:!0,headerHgt:t})},Wo.prototype.findNext=function(s,a){function e(e,t,r){for(var n,i,o=e;o<=t&&(n=a.sheets[o],!(i=o===a.sheetIdx?r?l.findNextOnSheet(s,a.startRow,a.startCol,a.findVal,n,void 0,a.activeCell):l.findNextOnSheet(s,0,0,a.findVal,n,"By Row"===s.searchBy?a.startRow:a.startCol):l.findNextOnSheet(s,0,0,a.findVal,n)));o++);return i}var l=this,t=e(a.sheetIdx,a.sheets.length-1,!0);(t=t||e(0,a.sheetIdx))?this.parent.notify(ur,{address:t}):this.parent.notify(mr,null)},Wo.prototype.findNextOnSheet=function(e,t,r,n,i,o,s){var a;if("By Row"===e.searchBy){void 0===o&&(o=i.rows.length-1);for(var l,h=t;h<=o;h++)if(!$(i,h))for(p=s&&h===t?r:0,l=i.rows[h]&&i.rows[h].cells&&i.rows[h].cells.length;p<l;p++)if(!Eh(i,p)&&(a=this.checkMatch(e,n,h,p,i,s)))return a}else{void 0===o&&(o=i.usedRange.colIndex);for(var d=i.rows&&i.rows.length-1,p=r;p<=o;p++)if(!Eh(i,p))for(h=s&&p===r?t:0;h<=d;h++)if(!$(i,h)&&(a=this.checkMatch(e,n,h,p,i,s)))return a}return a},Wo.prototype.findPrevious=function(s,a){function e(e,t,r){for(var n,i,o=e;t<=o&&(n=a.sheets[o],!(i=o===a.sheetIdx?r?l.findPrevOnSheet(s,a.startRow,a.startCol,0,0,a.findVal,n,a.activeCell):"By Row"===s.searchBy?l.findPrevOnSheet(s,n.usedRange.rowIndex,n.usedRange.colIndex,a.startRow,0,a.findVal,n):l.findPrevOnSheet(s,n.usedRange.rowIndex,n.usedRange.colIndex,0,a.startCol,a.findVal,n):l.findPrevOnSheet(s,n.usedRange.rowIndex,n.usedRange.colIndex,0,0,a.findVal,n)));o--);return i}var l=this,t=e(a.sheetIdx,0,!0);(t=t||e(a.sheets.length-1,a.sheetIdx))?this.parent.notify(ur,{address:t}):this.parent.notify(mr,null)},Wo.prototype.findPrevOnSheet=function(e,t,r,n,i,o,s,a){var l,h,d;if("By Row"===e.searchBy){for(d=t;n<=d;d--)if(!$(s,d))for(h=a&&d===t?r:s.rows[d]&&s.rows[d].cells&&s.rows[d].cells.length-1;i<=h;h--)if(!Eh(s,h)&&(l=this.checkMatch(e,o,d,h,s,a)))return l}else for(h=r;i<=h;h--)if(!Eh(s,h))for(d=a&&h===r?t:s.rows&&s.rows.length-1;n<=d;d--)if(!$(s,d)&&(l=this.checkMatch(e,o,d,h,s,a)))return l;return l},Wo.prototype.checkMatch=function(e,t,r,n,i,o){if(!o||r!==o[0]||n!==o[1]){o=ie(r,n,i,!1,!0);if(!i.isProtected||i.protectSettings.selectCells||!i.protectSettings.selectUnLockedCells||!Vn(o,se(i,n))){o=this.parent.getDisplayText(o);if(o)if(e.isCSen||(o=o.toLowerCase()),e.isEMatch){if(o===t)return i.name+"!"+G(r,n)}else if(o.includes(t))return i.name+"!"+G(r,n)}}return null},Wo.prototype.replace=function(e){var t=J.isUndefined(e.sheetIndex)?this.parent.activeSheetIndex:e.sheetIndex,r=ne(this.parent,e.sheetIndex);if(r.isProtected)this.parent.notify(Rr,null);else{var n,i=Q(e.address||r.activeCell),o=this.parent.getDisplayText(ie(i[0],i[1],r,!1,!0)).toString(),s=(e.value=e.value.toString(),e.isCSen||(n=e.value.toLowerCase()),this.getReplaceValue(e,o,n));if(s||(e.findOpt="next",this.find(e),i=W(r.activeCell),o=this.parent.getDisplayText(ie(i[0],i[1],r)).toString(),s=this.getReplaceValue(e,o,n)))if(ni(ie(i[0],i[1],r),se(r,i[1]),ch(r,i[0])))this.parent.notify(Nr,null);else{o={address:r.name+"!"+G(i[0],i[1]),cancel:!1,compareValue:e.value,replaceValue:e.replaceValue,sheetIndex:t};if(e.isAction){if(this.parent.notify(gt,{action:"beforeReplace",eventArgs:o}),o.cancel)return;delete o.cancel}Gn(this.parent,r,{cell:{value:s},rowIdx:i[0],colIdx:i[1],uiRefresh:!0,valChange:!0}),e.isAction&&this.parent.notify("actionComplete",{action:"replace",eventArgs:o})}}},Wo.prototype.replaceAll=function(i){for(var e,t,r,o=this,n="Sheet"===i.mode?i.sheetIndex:0,s=this.parent.sheets[n],a=s.usedRange.rowIndex,l=0,h=s.usedRange.colIndex,d=0,p=[],c=i.isAction,u=jo({addressCollection:p,cancel:!1},i),f=function(r,n){requestAnimationFrame?requestAnimationFrame(function(){var e,t;!u.cancel&&u.addressCollection[n]&&(e=W(u.addressCollection[n].split("!")[1]),t=N(o.parent,u.addressCollection[n]),Gn(o.parent,o.parent.sheets[t],{cell:{value:r},rowIdx:e[0],uiRefresh:!0,colIdx:e[1],valChange:!0,skipFormatCheck:i.skipFormatCheck}),n===u.addressCollection.length-1)&&c&&o.parent.notify("actionComplete",{action:"replaceAll",eventArgs:u})}):o.parent.updateCell({value:r},u.addressCollection[n])};l<=a+1;l++){if(h<d&&a<l&&"Workbook"===i.mode){if(n++,!(s=this.parent.sheets[n]))break;l=d=0,h=s.usedRange.colIndex,a=s.usedRange.rowIndex}if(e=s.rows[l])for(d===h+1&&(d=0);d<=h;d++)e&&e.cells&&e.cells[d]&&(ni(ie(l,d,s),se(s,d),ch(s,l))||(r=this.parent.getDisplayText(s.rows[l].cells[d]).toString())&&(i.isCSen?i.isEMatch?r===i.value&&(f(i.replaceValue,p.length),p.push(s.name+"!"+G(l,d))):-1<r.indexOf(i.value)&&(f(r.replace(i.value,i.replaceValue),p.length),p.push(s.name+"!"+G(l,d))):i.isEMatch?r.toLowerCase()===i.value&&(f(i.replaceValue,p.length),p.push(s.name+"!"+G(l,d))):(t=r.toLowerCase(),(r===i.value||-1<t.indexOf(i.value.toString().toLowerCase())||t===i.value||r===i.value||-1<t.indexOf(i.value))&&(t=new RegExp(i.value.toString().replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"ig"),f(r.replace(t,i.replaceValue),p.length),p.push(s.name+"!"+G(l,d))))))}p.length&&c&&(this.parent.notify("actionBegin",{action:"beforeReplaceAll",eventArgs:u}),u.cancel)||this.parent.notify(Ir,{count:u.addressCollection.length,replaceValue:u.replaceValue})},Wo.prototype.getReplaceValue=function(e,t,r){var n;return e.isCSen?e.isEMatch?t===e.value&&e.replaceValue:-1<t.indexOf(e.value)&&t.replace(e.value,e.replaceValue):e.isEMatch?t.toLowerCase()===r&&e.replaceValue:(n=RegExp,t.toLowerCase().includes(r)&&t.replace(new n(e.value.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"ig"),e.replaceValue))},Wo.prototype.totalCount=function(e){var n=this,i=this.parent.sheets[e.sheetIndex],o=W(i.activeCell),s=0,a=0,l=e.value.toLowerCase(),t=(i.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||Eh(i,t)||i.isProtected&&!i.protectSettings.selectCells&&Vn(e,se(i,t))||(e.format?n.parent.getDisplayText(e):e.value.toString()).toLowerCase().includes(l)&&(s++,r===o[0]&&t>=o[1]||r>o[0])&&a++})}),s);0===(s=t<(s=t- --a)?t:s)||this.parent.getDisplayText(ie(o[0],o[1],i)).toLowerCase().includes(l)||--s,e.findCount=s+" of "+t},Wo.prototype.findAllValues=function(e){for(var t,r=e.sheetIndex,n=this.parent.sheets[r],i=n.usedRange.rowIndex,o=0,s=n.usedRange.colIndex,a=0,l=this.parent.sheets.length,h=e.sheetIndex;o<=i+1;o++){if(1!==h&&e.sheetIndex===l&&(r=1),i<o&&s<a&&"Workbook"===e.mode){if(h===(r=l-1<++r?0:r))return void 0;(n=this.parent.sheets[r])&&(a=o=0,s=n.usedRange.colIndex,i=n.usedRange.rowIndex)}if(!J.isNullOrUndefined(n)&&n.rows[o]){var d,p,c,u,f=n.rows[o];for(a===s+2&&(a=0);a<=s+1;a++)f&&f.cells&&f.cells[a]&&(d=n.rows[o].cells[a])&&!J.isNullOrUndefined(d.value)&&""!==d.value&&(!n.isProtected||n.protectSettings.selectCells||n.protectSettings.selectUnLockedCells&&!Vn(d,se(n,a)))&&(p=void 0,p=(d.format?this.parent.getDisplayText(n.rows[o].cells[a]):d.value).toString(),e.isCSen&&e.isEMatch?p===e.value&&(t=n.name+"!"+G(o,a),e.findCollection.push(t),0):e.isCSen&&!e.isEMatch?(u=-1<p.indexOf(e.value),p!==e.value&&!u||(t=n.name+"!"+G(o,a),e.findCollection.push(t),0)):!e.isCSen&&e.isEMatch?(c=p.toString().toLowerCase())===e.value.toLowerCase()&&(t=n.name+"!"+G(o,a),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,a),e.findCollection.push(t),0))}}},Wo.prototype.getModuleName=function(){return"workbookfindAndReplace"},Wo);function Wo(e){this.parent=e,this.addEventListener()}Yo.prototype.protectsheetHandler=function(e){var t=J.isNullOrUndefined(e.sheetIndex)?this.parent.activeSheetIndex:e.sheetIndex,r=ne(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(xr,{sheetIndex:t,triggerEvent:e.triggerEvent}),this.parent.notify(Sr,{props:"Protect"}),r.password=e.password||"",r.columns.forEach(function(e){e&&J.isUndefined(e.isLocked)&&(e.isLocked=!0)})},Yo.prototype.unprotectsheetHandler=function(e){var t=this.parent.getActiveSheet();t.isImportProtected&&(t.isImportProtected=!1),(t=e.sheet?this.parent.sheets[e.sheet]:t).protectSettings.formatCells=t.protectSettings.formatColumns=!1,t.protectSettings.formatRows=t.protectSettings.selectCells=!1,this.parent.setSheetPropertyOnMute(t,"isProtected",!1),this.parent.notify(xr,t.protectSettings),this.parent.notify(Sr,{props:"Protect"})},Yo.prototype.destroy=function(){this.removeEventListener(),this.parent=null},Yo.prototype.addEventListener=function(){this.parent.on(wr,this.protectsheetHandler,this),this.parent.on(Er,this.unprotectsheetHandler,this),this.parent.on(Ar,this.lockCells,this)},Yo.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(wr,this.protectsheetHandler),this.parent.off(Ar,this.lockCells),this.parent.off(wr,this.unprotectsheetHandler))},Yo.prototype.lockCells=function(e){var t=this.parent.getAddressInfo(e.range),r=te(t.indices),n=ne(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++)Sh(n,o,{isLocked:e.isLocked});for(o=r[0];o<=r[2];o++)for(var s=r[1];s<=r[3];s++)Mi(o,s,n,{isLocked:i},!0);e.triggerEvent&&this.parent.notify("actionComplete",{action:"lockCells",eventArgs:e})},Yo.prototype.getModuleName=function(){return"workbookProtectSheet"};var Go=Yo;function Yo(e){this.parent=e,this.addEventListener()}Ko.prototype.merge=function(e){e.sheetIndex=J.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=Q(e.range));var t=e.range=te(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(Lt,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:ne(this.parent,e.sheetIndex).selectedRange,skipChecking:!0}),this.parent.chartColl)&&this.parent.chartColl.length&&this.parent.notify(qr,{range:e.range})},Ko.prototype.mergeAll=function(e,t,r){void 0===t&&(t=0),void 0===r&&(r=0);for(var n,i,o,s,a,l,h=0,d=(e.range=e.range,J.isUndefined(e.sheetIndex)?this.parent.getActiveSheet():ne(this.parent,e.sheetIndex)),p={cell:new Object,rowIdx:e.range[0],colIdx:e.range[1],valChange:!e.merge,preventEvt:!0,uiRefresh:!e.preventRefresh,skipFormatCheck:!0},c=e.range[0],u=t;c<=e.range[2];c++,u++){i=0,e.isAction&&!e.model[u]&&e.model.push({cells:[]});for(var f=e.range[1],g=r;f<=e.range[3];f++,g++){if((n=ie(c,f,d))&&(n.value||0===n.value||n.formula)&&!o&&(o=n.formula||n.value,a=n.format),e.isAction&&e.merge&&(l=e.model[u].cells[g]={},J.extend(l,n,null,!0)),n&&(delete n.rowSpan,delete n.colSpan,l=!e.merge&&!e.isAction&&e.model&&e.model[u]&&e.model[u].cells[g])&&Mi(c,f,d,l),c===e.range[0]&&f===e.range[1]){if(e.merge){0<e.range[3]-e.range[1]&&(p.cell.colSpan=e.range[3]-e.range[1]+1),0<e.range[2]-e.range[0]&&(p.cell.rowSpan=e.range[2]-e.range[0]+1),Gn(this.parent,d,p),p.valChange=p.mergedCells=!0;continue}}else p.rowIdx=c,p.colIdx=f,p.cell={},e.merge&&(c!==e.range[0]&&(p.cell.rowSpan=-h),f!==e.range[1])&&(i++,p.cell.colSpan=-i);Gn(this.parent,d,p),s=s||p.isFormulaDependent}h++}e.merge&&(o||0===o?(delete p.mergedCells,p.cell={},(t=ie(e.range[0],e.range[1],d))&&(t.value||t.formula)||(X(o)?p.cell.formula=o:p.cell.value=o,a&&(p.cell.format=a)),p.rowIdx=e.range[0],p.colIdx=e.range[1],Gn(this.parent,d,p)):e.preventRefresh||this.parent.notify(Fr,{rowIdx:e.range[0],colIdx:e.range[1]})),e.preventRefresh||this.refreshCF(d,e.range[0],e.range[1],s)},Ko.prototype.refreshCF=function(e,t,r,n){e.conditionalFormats&&e.conditionalFormats.length&&this.parent.notify(Mr,{indexes:[t,r],refreshAll:n,isAction:!0})},Ko.prototype.activeCellRange=function(e){e.range=e.range;var t=this.parent.getActiveSheet(),r=ie(e.range[0],e.range[1],t);r&&(!J.isNullOrUndefined(r.rowSpan)&&r.rowSpan<0&&(e.range[0]+=r.rowSpan,e.insertCount)&&(e.range[0]-=e.insertCount),!J.isNullOrUndefined(r.colSpan)&&r.colSpan<0&&(e.range[1]+=r.colSpan,e.insertCount)&&(e.range[1]-=e.insertCount),r=ie(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))},Ko.prototype.mergedRange=function(e){"string"==typeof e.range&&(e.range=Q(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)},Ko.prototype.forward=function(e){e.range=e.range;var t,r,n=J.isUndefined(e.sheetIndex)?this.parent.getActiveSheet():ne(this.parent,e.sheetIndex),i=ie(e.range[0],e.range[1],n),o=t=e.range[0],s=r=e.range[1];if((i=i&&ie(o=!J.isNullOrUndefined(i.rowSpan)&&i.rowSpan<0?t=e.range[0]+i.rowSpan:o,s=!J.isNullOrUndefined(i.colSpan)&&i.colSpan<0?r=e.range[1]+i.colSpan:s,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,s+(i.colSpan-1)>=e.range[3])&&(e.range[3]=e.range[1],e.range[3]=s+(i.colSpan-1)),e.range[0]=o,e.range[1]=s,e.range[0]===o&&e.range[1]===s&&e.range[2]===t&&e.range[3]===r&&(e.isActiveCell=!0),!e.skipChecking){for(var a,l,h=e.range[1];h<=e.range[3];h++)(i=ie(e.range[2],h,n))&&(o=e.range[2],s=h,!J.isNullOrUndefined(i.colSpan)&&i.colSpan<0&&(s+=i.colSpan)<e.range[1]&&(e.range[1]=s),!J.isNullOrUndefined(i.rowSpan)&&i.rowSpan<0&&(o+=i.rowSpan)<e.range[0]&&(e.range[0]=o),i=ie(o,s,n))&&(1<i.colSpan&&s+(i.colSpan-1)>e.range[3]&&(e.range[3]=s,e.range[3]=s+(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=ie(e.range[0],h,n))&&(l=h,a=e.range[0],!J.isNullOrUndefined(i.colSpan)&&i.colSpan<0&&(l+=i.colSpan)<e.range[1]&&(e.range[1]=l),!J.isNullOrUndefined(i.rowSpan))&&i.rowSpan<0&&(a+=i.rowSpan)<e.range[0]&&(e.range[0]=a);for(h=e.range[0];h<=e.range[2];h++)(i=ie(h,e.range[3],n))&&(o=h,s=e.range[3],!J.isNullOrUndefined(i.rowSpan)&&i.rowSpan<0&&(o+=i.rowSpan)<e.range[0]&&(e.range[0]=o),!J.isNullOrUndefined(i.colSpan)&&i.colSpan<0&&(s+=i.colSpan)<e.range[1]&&(e.range[1]=s),i=ie(o,s,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)&&s+(i.colSpan-1)>e.range[3]&&(e.range[3]=s,e.range[3]=s+(i.colSpan-1))}},Ko.prototype.forwardReverse=function(e){var t=this.parent.getActiveSheet(),r=(e.range=e.range,e.range[1]),n=ie(e.range[0],e.range[1],t),i=e.range[0];if(n&&(!J.isNullOrUndefined(n.colSpan)&&n.colSpan<0&&(r+=n.colSpan,e.range[3]>=r)&&(e.range[3]=r),!J.isNullOrUndefined(n.rowSpan)&&n.rowSpan<0&&(i+=n.rowSpan)<e.range[0]&&(e.range[0]=i),n=ie(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,s,a,l=e.range[3];l<=e.range[1];l++)(n=ie(e.range[2],l,t))&&(s=l,o=e.range[2],!J.isNullOrUndefined(n.rowSpan)&&n.rowSpan<0&&(o+=n.rowSpan)<e.range[0]&&(e.range[0]=o),!J.isNullOrUndefined(n.colSpan)&&n.colSpan<0&&(s+=n.colSpan)<e.range[3]&&(e.range[3]=s),n=ie(o,s,t))&&(1<n.rowSpan&&o+(n.rowSpan-1)>e.range[2]&&(e.range[2]=o+(n.rowSpan-1)),1<n.colSpan)&&s+(n.colSpan-1)>e.range[1]&&(e.range[1]=s+(n.colSpan-1));for(var h,l=e.range[3];l<=e.range[1];l++)(n=ie(e.range[0],l,t))&&(s=l,a=e.range[0],!J.isNullOrUndefined(n.rowSpan)&&n.rowSpan<0&&(a+=n.rowSpan)<e.range[0]&&(e.range[0]=a),!J.isNullOrUndefined(n.colSpan)&&n.colSpan<0&&(s+=n.colSpan),n=ie(a,s,t))&&(1<n.rowSpan&&a+(n.rowSpan-1)>e.range[2]&&(e.range[2]=a+(n.rowSpan-1)),1<n.colSpan)&&s+(n.colSpan-1)>e.range[1]&&(e.range[1]=s,e.range[1]=s+(n.colSpan-1));for(l=e.range[0];l<=e.range[2];l++)(n=ie(l,e.range[3],t))&&(a=l,h=e.range[3],!J.isNullOrUndefined(n.rowSpan)&&n.rowSpan<0&&(a+=n.rowSpan)<e.range[0]&&(e.range[0]=a),!J.isNullOrUndefined(n.colSpan)&&n.colSpan<0&&(h+=n.colSpan)<e.range[3]&&(e.range[3]=h),n=ie(a,h,t))&&(1<n.rowSpan&&a+(n.rowSpan-1)>e.range[2]&&(e.range[2]=a,e.range[2]=a+(n.rowSpan-1)),1<n.colSpan)&&h+(n.colSpan-1)>e.range[1]&&(e.range[1]=h,e.range[1]=h+(n.colSpan-1))}},Ko.prototype.reverse=function(e){e.range=e.range;var t=e.range[1],r=J.isUndefined(e.sheetIndex)?this.parent.getActiveSheet():ne(this.parent,e.sheetIndex),n=ie(e.range[0],e.range[1],r),i=e.range[0],o=(n&&(!J.isNullOrUndefined(n.colSpan)&&n.colSpan<0&&(t+=n.colSpan),!J.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=ie(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 s=e.range[3];s<=e.range[1];s++)(n=ie(e.range[2],s,r))&&(o=s,i=e.range[2],!J.isNullOrUndefined(n.rowSpan)&&n.rowSpan<0&&(i+=n.rowSpan)<e.range[2]&&(e.range[2]=i),!J.isNullOrUndefined(n.colSpan)&&n.colSpan<0&&(o+=n.colSpan)<e.range[3]&&(e.range[3]=o),n=ie(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 a,l,o=e.range[3],s=e.range[3];s<=e.range[1];s++)(n=ie(e.range[0],s,r))&&(o=s,i=e.range[0],!J.isNullOrUndefined(n.colSpan)&&n.colSpan<0&&(o+=n.colSpan),!J.isNullOrUndefined(n.rowSpan)&&n.rowSpan<0&&(i+=n.rowSpan),n=ie(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(s=e.range[2];s<=e.range[0];s++)(n=ie(s,e.range[3],r))&&(l=s,a=e.range[3],!J.isNullOrUndefined(n.rowSpan)&&n.rowSpan<0&&(l+=n.rowSpan)<e.range[2]&&(e.range[2]=l),!J.isNullOrUndefined(n.colSpan)&&n.colSpan<0&&(a+=n.colSpan)<e.range[3]&&(e.range[3]=a),n=ie(l,a,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)&&a+(n.colSpan-1)>e.range[1]&&(e.range[1]=a,e.range[1]=a+(n.colSpan-1))}},Ko.prototype.reverseForward=function(e){e.range=e.range;var t=J.isUndefined(e.sheetIndex)?this.parent.getActiveSheet():ne(this.parent,e.sheetIndex),r=e.range[0],n=e.range[1],i=ie(e.range[0],e.range[1],t);if(i&&(!J.isNullOrUndefined(i.rowSpan)&&i.rowSpan<0&&(r+=i.rowSpan,e.range[2]>=r)&&(e.range[2]=r),!J.isNullOrUndefined(i.colSpan)&&i.colSpan<0&&(n+=i.colSpan),i=ie(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,s,a,l=e.range[3],h=e.range[1];h<=e.range[3];h++)(i=ie(e.range[2],h,t))&&(o=e.range[2],l=h,!J.isNullOrUndefined(i.rowSpan)&&i.rowSpan<0&&(o+=i.rowSpan)<e.range[2]&&(e.range[2]=o),!J.isNullOrUndefined(i.colSpan)&&i.colSpan<0&&(l+=i.colSpan)<e.range[1]&&(e.range[1]=l),i=ie(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=ie(e.range[0],h,t))&&(a=h,s=e.range[0],!J.isNullOrUndefined(i.colSpan)&&i.colSpan<0&&(a+=i.colSpan)<e.range[1]&&(e.range[1]=a),!J.isNullOrUndefined(i.rowSpan)&&i.rowSpan<0&&(s+=i.rowSpan),i=ie(s,a,t))&&1<i.rowSpan&&s+(i.rowSpan-1)>e.range[0]&&(e.range[0]=s+(i.rowSpan-1));for(h=e.range[2];h<=e.range[0];h++)(i=ie(h,e.range[3],t))&&(o=h,d=e.range[3],!J.isNullOrUndefined(i.rowSpan)&&i.rowSpan<0&&(o+=i.rowSpan)<e.range[2]&&(e.range[2]=o),!J.isNullOrUndefined(i.colSpan)&&i.colSpan<0&&(d+=i.colSpan)<e.range[1]&&(e.range[1]=d),i=ie(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)}},Ko.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)},Ko.prototype.addEventListener=function(){this.parent.on(kr,this.merge,this),this.parent.on(Or,this.mergedRange,this),this.parent.on(Tr,this.activeCellRange,this),this.parent.on(Dr,this.insertHandler,this)},Ko.prototype.destroy=function(){this.removeEventListener(),this.parent=null},Ko.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(kr,this.merge),this.parent.off(Or,this.mergedRange),this.parent.off(Tr,this.activeCellRange),this.parent.off(Dr,this.insertHandler))},Ko.prototype.getModuleName=function(){return"workbookmerge"};var Xo=Ko;function Ko(e){this.parent=e,this.addEventListener()}Zo.prototype.destroy=function(){this.removeEventListener(),this.parent=null},Zo.prototype.addEventListener=function(){this.parent.on(Pr,this.setCFRule,this),this.parent.on(Br,this.clearCFRule,this)},Zo.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(Pr,this.setCFRule),this.parent.off(Br,this.clearCFRule))},Zo.prototype.setCFRule=function(e){var t=e.cfModel,r=void 0===e.sheetIdx?N(this.parent,t.range):e.sheetIdx,n=ne(this.parent,r),i=(t.range=t.range||n.selectedRange,te(Q(t.range)));if(t.range=ee(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=te(Q(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(ur,{address:n.name+"!"+t.range}):this.parent.notify(Mr,{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"})},Zo.prototype.clearCFRule=function(e){void 0===e.sheetIdx&&(e.sheetIdx=this.parent.activeSheetIndex);var t,r=ne(this.parent,e.sheetIdx),n=r.conditionalFormats;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(Mr,{cfModel:e.oldCFModel,isAction:!0}),e.sheetIdx!==this.parent.activeSheetIndex&&this.parent.notify(ur,{address:r.name+"!"+e.range});else if(n&&n.length){for(var i,o,s,a,l,h,d,p=e.range&&("string"==typeof e.range?Q(e.range):e.range),c=(e.oldCFModel=[],e.updatedCFModel=[],[]),u=[],f=[],g=0;g<n.length;g++){for(var m,v=(m=n[g]).range.split(","),y=0;y<v.length;y++){if(i=Q(v[y]),e.range)if(p[0]<=i[0]&&p[1]<=i[1]&&p[2]>=i[2]&&p[3]>=i[3])v.splice(y,1),y--;else{if(l=p[0]>=i[0]&&p[0]<=i[2],h=p[2]>=i[0]&&p[2]<=i[2],s=p[1]>=i[1]&&p[1]<=i[3],a=p[3]>=i[1]&&p[3]<=i[3],o=[],l&&h?((s||a||p[1]<i[1]&&p[3]>i[3])&&(0<p[0]-i[0]&&o.push(ee([i[0],i[1],p[0]-1,i[3]])),0<i[2]-p[2])&&o.push(ee([p[2]+1,i[1],i[2],i[3]])),s&&p[1]!==i[1]&&o.push(ee([p[0],i[1],p[2],p[1]-1])),a&&p[3]!==i[3]&&o.push(ee([p[0],p[3]+1,p[2],i[3]]))):s&&a?((l||h||p[0]<i[0]&&p[2]>i[2])&&(0<p[1]-i[1]&&o.push(ee([i[0],i[1],i[2],p[1]-1])),0<i[3]-p[3])&&o.push(ee([i[0],p[3]+1,i[2],i[3]])),l?p[0]!==i[0]&&o.push(ee([i[0],p[1],p[0]-1,p[3]])):h&&p[2]!==i[2]&&o.push(ee([p[2]+1,p[1],i[2],p[3]]))):(l||h)&&(s?(p[1]!==i[1]&&o.push(ee([i[0],i[1],i[2],p[1]-1])),0<p[0]-i[0]?o.push(ee([i[0],p[1],p[0]-1,i[3]])):0<i[2]-p[2]&&o.push(ee([p[2]+1,p[1],i[2],i[3]]))):a&&(p[3]!==i[3]&&o.push(ee([i[0],p[3]+1,i[2],i[3]])),0<p[0]-i[0]?o.push(ee([i[0],i[1],p[0]-1,p[3]])):0<i[2]-p[2]&&o.push(ee([p[2]+1,i[1],i[2],p[3]])))),!o.length)continue;v[y]=o.join(",")}else p=i,v.splice(y,1),y--;e.sheetIdx===this.parent.activeSheetIndex&&this.parent.notify(Vr,{indexes:p})}(d=v.join(","))!==m.range&&(!e.cfModel||e.cfModel.cFColor===m.cFColor&&e.cfModel.type===m.type&&e.cfModel.value===m.value?(u.push(m.range),d?(e.oldCFModel.push({type:m.type,cFColor:m.cFColor,format:m.format,range:m.range,value:m.value}),m.range=d,m.result&&(delete m.result,this.parent.notify(Mr,{cfModel:[m],isAction:!0})),e.updatedCFModel.push(m),c.push(m)):(e.oldCFModel.push(m),c.concat(n.splice(g,1)),g--)):f.push(m))}e.sheetIdx!==this.parent.activeSheetIndex?e.isUndoRedo&&!e.isFromUpdateAction&&this.parent.notify(ur,{address:r.name+"!"+e.range}):f.length&&this.parent.notify(Mr,{cfModel:f,isAction:!0}),(e.isAction||e.isClear)&&e.oldCFModel.length&&(r={cFormats:c,oldRange:u,previousConditionalFormats:e.oldCFModel,sheetIdx:e.sheetIdx,selectedRange:e.range},e.updatedCFModel.length&&(r.conditionalFormats=e.updatedCFModel),e.isClear?e.cfClearActionArgs=r:this.parent.notify("actionComplete",{eventArgs:r,action:"clearCF"}))}},Zo.prototype.getModuleName=function(){return"workbookConditionalFormatting"};var $o=Zo;function Zo(e){this.parent=e,this.addEventListener()}Qo.prototype.getFillInfo=function(e){for(var t,r=this.parent.serviceLocator.getService(ii),n=!0,i="CopyCells",o=[],s=-1<["Down","Up"].indexOf(e.direction),a=this.getRangeData({range:e.dataRange,sheetIdx:this.parent.activeSheetIndex}),l=a.join().replace(/,/g,"").length,h=this.isRange(e.dataRange)&&l?a.length:1;h--;)if(Y(t=a[h]&&!J.isNullOrUndefined(a[h].value)?a[h].value:"")||X(t)||Y(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),s&&e.dataRange[1]===e.dataRange[3]||o.push("Flash Fill"),{fillType:i,disableItems:o}},Qo.prototype.isRange=function(e){return e&&(e[0]!==e[2]||e[1]!==e[3])},Qo.prototype.autoFill=function(e){if(e.dataRange&&e.fillRange&&e.direction&&this.parent.allowEditing&&(!this.parent.getActiveSheet().isProtected||!e.isLockedCell)){var t=te(Q(e.dataRange)),r=te(Q(e.fillRange)),n={dataRange:t,fillRange:r,direction:e.direction,fillType:e.fillType||this.fillInfo.fillType,sheetIndex:N(this.parent,e.dataRange)};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)}}},Qo.prototype.fillSeries=function(e){for(var t,r,n,i,o,s,a,l,h,d,p,c,u,f,g,m,v,y={},C=0,b=J.isUndefined(e.sheetIndex)?this.parent.activeSheetIndex:e.sheetIndex,x=ne(this.parent,b),S=e.dataRange[0],w=e.dataRange[1],I=e.dataRange[2],M=e.dataRange[3],B=e.fillRange[0],H=e.fillRange[1],V=e.fillRange[2],U=e.fillRange[3],E=-1<["Down","Up"].indexOf(e.direction),R=-1<["Up","Left"].indexOf(e.direction),_=E?M-w:I-S,z="FillSeries"===e.fillType,j=x.conditionalFormats&&x.conditionalFormats.length&&[].slice.call(x.conditionalFormats),N=[];C<=_;){for(var A,q=(k=this.updateFillValues(E,S,w,I,M,B,H,V,U,C)).patternRange,k=k.fillRange,F=this.getPattern(q,{isReverseFill:R,isVFill:E}),O=(A=this.getRangeData({range:q,sheetIdx:b})).length,T=0;T<O;T++)if(A[T]&&A[T].isReadOnly)return void this.parent.notify(Nr,null);if(!F||!F.length)return;for(t=F.length,u=(c=this.getSelectedRange(x,{rowIndex:k[0],colIndex:k[1]},{rowIndex:k[2],colIndex:k[3]})).length,R&&(c=c.reverse(),F=F.reverse(),F=this.ensurePattern(F),A=A.reverse()),s=0;s<u;){switch(f=c[s],l=s%O,(r=Y(r=F[s%t])?F[r]:r).type){case"number":case"date":if(r.isStartWithMonth&&1===O?(g=In(r.regVal.a),L=new Date(g),g.setMonth(g.getMonth()+r.regVal.b*r.i),28<L.getDate()&&L.getDate()!==g.getDate()&&(L.setDate(1),L.setMonth(L.getMonth()+r.regVal.b*r.i),L.setDate(new Date(L.getFullYear(),L.getMonth()+1,0).getDate()),g=L),P=En(g).toString()):(P=this.round(r.regVal.a+r.regVal.b*r.i,5).toString(),r.val&&(i="string"==typeof r.val[0]&&r.val[0].match(/^0+/))&&(n=this.getNextFormattedValue(r.val[0],Number(P)))),r.dataVal){if(void 0===r.copy&&!i&&(r.copy=2<r.val.length,r.copy))for(var D=2;D<r.val.length&&(r.copy=Math.abs(this.round(r.regVal.a+r.regVal.b*D,5))!==r.val[D],!r.copy);D++);P=r.copy?A[l]&&!J.isNullOrUndefined(A[l].value)?A[l].value:"":r.start?Math.abs(Number(P))+r.dataVal:i?r.dataVal+n:r.dataVal+Math.abs(Number(P))}R?r.i--:r.i++;break;case"string":var L=r.i%r.val.length,P=r.val[L];r.i++;break;case"formula":for(p=!1,P="=",a=0,h=r.val.length;a<h;)"object"==typeof(o=r.val[a])?(p=!0,P+=(d=this.round(o.a+o.b*r.i,5))<1?"#REF!":E?o.c+(o.b?d:"$"+d):(o.b?le(d):o.c.substring(0,o.c.search(/\d/))+"$"+le(d))+o.c.trim()):P+=o,a++;p&&R?r.i--:r.i++;break;case"time":P=(r.regVal.a+r.regVal.b*r.i).toString(),R?r.i--:r.i++}if((m=ie(f.rowIndex,f.colIndex,x,!1,!0))&&m.isReadOnly)return void this.parent.notify(Nr,null);z?Object.assign(y,A[l],null,!0):(y.style=m.style,y.format=m.format,y.wrap=m.wrap,y.rowSpan=m.rowSpan,y.colSpan=m.colSpan),X(y.value=P)&&(y.formula=P),J.isNullOrUndefined(y.notes)||delete y.notes,m={cell:y,rowIdx:f.rowIndex,colIdx:f.colIndex,valChange:!0,uiRefresh:!0,pvtExtend:!0,skipFormatCheck:!0},Gn(this.parent,x,m),!j||(v=v||m.isFormulaDependent)||$n(j,N,f.rowIndex,f.colIndex),y={},s++}C++}(N.length||v)&&this.parent.notify(Mr,{cfModel:!v&&N,refreshAll:v,isAction:!0,isEdit:!0})},Qo.prototype.copyCells=function(e){for(var t,r,n,i,o,s,a,l=0,h={},d=e.dataRange[0],p=e.dataRange[1],c=e.dataRange[2],u=e.dataRange[3],f=e.fillRange[0],g=e.fillRange[1],m=e.fillRange[2],v=e.fillRange[3],y=-1<["Down","Up"].indexOf(e.direction),C=-1<["Up","Left"].indexOf(e.direction),b=y?u-p:c-d,x=J.isUndefined(e.sheetIndex)?this.parent.activeSheetIndex:e.sheetIndex,S=ne(this.parent,x),w="FillFormattingOnly"===e.fillType,I=S.conditionalFormats&&S.conditionalFormats.length&&[].slice.call(S.conditionalFormats),E=[];l<=b;){for(var R,N=(A=this.updateFillValues(y,d,p,c,u,f,g,m,v,l)).patternRange,A=A.fillRange,k=(R=this.getRangeData({range:N,sheetIdx:x})).length,F=0;F<k;F++)if(R[F]&&R[F].isReadOnly)return void this.parent.notify(Nr,null);for(n=(r=this.getSelectedRange(S,{rowIndex:A[0],colIndex:A[1]},{rowIndex:A[2],colIndex:A[3]})).length,t=0,C&&(r=r.reverse());t<n;){if(a=t%k,i=r[t],w&&(o=ie(i.rowIndex,i.colIndex,S)),Object.assign(h,R[a],null,!0),w&&(h.value=o.value,h.formula=o.formula),h&&h.isReadOnly)return void this.parent.notify(Nr,null);a={cell:h,rowIdx:i.rowIndex,colIdx:i.colIndex,valChange:!0,uiRefresh:!0,pvtExtend:!0},Gn(this.parent,S,a),!I||(s=s||a.isFormulaDependent)||$n(I,E,i.rowIndex,i.colIndex),h={},t++}l++}(E.length||s)&&this.parent.notify(Mr,{cfModel:!s&&E,refreshAll:s,isAction:!0,isEdit:!0})},Qo.prototype.updateFillValues=function(e,t,r,n,i,o,s,a,l,h){var d,p,c,e=e?(d={rowIndex:t,colIndex:r+h},p={rowIndex:n,colIndex:r+h},c={rowIndex:o,colIndex:s+h},{rowIndex:a,colIndex:s+h}):(d={rowIndex:t+h,colIndex:r},p={rowIndex:t+h,colIndex:i},c={rowIndex:o+h,colIndex:s},{rowIndex:o+h,colIndex:l});return{patternRange:[d.rowIndex,d.colIndex,p.rowIndex,p.colIndex],fillRange:[c.rowIndex,c.colIndex,e.rowIndex,e.colIndex]}},Qo.prototype.getDataPattern=function(e){var t,r=0,n={val:null,type:null},i=[],o=this.getRangeData({range:e,sheetIdx:this.parent.activeSheetIndex}),s=o.length;if(s){for(var a=void 0,l=void 0,h=void 0,d=void 0,p=function(e){return!t&&e&&"-"===e[e.length-1]?e.slice(0,e.length-1):e};r<s;){var c,u,f,g=!1;if(o[r]?o[r].formula&&X(o[r].formula)?(c=o[r].formula,f="formula"):(c=J.isNullOrUndefined(o[r].value)?"":o[r].value,u={},h=o[r].format,d=Y(c),h&&_i(h,!0,u)?(f=u.type,c&&!d&&(u={value:c,updatedVal:c,cell:o[r]},this.parent.notify(Ft,u),u.isDate||u.isTime?o[r].value=c=u.updatedVal:f="string"),g="date"===f&&h.toLowerCase().startsWith("mmm")):f=d?"number":"string"):(c="",f="string"),l="","string"===f){if(t=!1,Y(c[0])){for(a=0;Y(c[++a]););" "===c[a]&&(t=!0,f="number",l=c.slice(a,c.length),c=Number(c.slice(0,a)))}if(!t&&Y(c[c.length-1])){for(a=1;a++,Y(c[c.length-a]););f="number",--a,l=c.slice(0,c.length-a),c=(u=c.slice(c.length-a,c.length)).match(/^0+/)?u:Number(u),n.dataVal&&n.dataVal!==l&&n.dataVal===p(l)&&(l=n.dataVal)}}0===r?(n={val:[c],type:f,isStartWithMonth:g},l&&(n.dataVal=l,n.start=t)):f!==n.type||n.dataVal&&p(n.dataVal)!==p(l)?(i.push(n),n={val:[c],type:f},l&&(n.dataVal=l,n.start=t)):n.val.push(c),r++}return i.push(n),i}return[{val:null,type:null}]},Qo.prototype.getPredictionValue=function(e,t){for(var r=0,n=0,i=0,o=0,s=0,a=0,l=0,h=e.length;r<h;)n+=r,i+=Number(e[r]),o+=r*Number(e[r]),s+=r*r,r++;return l=t?(a=(i*s-n*o)/(h*s-n*n),(h*o-n*i)/(h*s-n*n)):(a=this.round((i*s-n*o)/(h*s-n*n),5),this.round((h*o-n*i)/(h*s-n*n),5)),{a:a,b:l}},Qo.prototype.getPattern=function(e,t){var r,n,i,o,s=0,a=[],l=this.getDataPattern(e),h=l.length;if(l){for(;s<h;){switch((n=l[s]).type){case"number":case"date":var d,p=a.length,c=n.val.length,u=t.isReverseFill?-1:c;for(1===c&&(d=parseFloat(n.val[0])+1,"string"==typeof n.val[0]&&n.val[0].match(/^0+/)?n.val.push(this.getNextFormattedValue(n.val[0],d)):n.val.push(d)),d={regVal:this.getPredictionValue(n.dataVal?n.val.slice(0,2):n.val),type:n.type,i:u,isStartWithMonth:n.isStartWithMonth},n.dataVal&&(d.dataVal=n.dataVal,d.val=n.val,d.start=n.start),a.push(d),r=1;r<c;)a.push(p),r++;break;case"string":for(p=a.length,d={val:n.val,type:n.type,i:0},a.push(d),r=1,c=n.val.length;r<c;)a.push(p),r++;break;case"formula":if(c=n.val.length,n=this.getFormulaPattern(n.val,t),u=t.isReverseFill?-1:c,n.isInPattern)for(p=a.length,d={val:n.val,type:"formula",i:u},a.push(d),r=1;r<c;)a.push(p),r++;else for(r=0,u=t.isReverseFill?-1:1;r<c;)a.push({val:n.val[r],type:"formula",i:u}),r++;break;case"time":for(p=a.length,c=n.val.length,u=t.isReverseFill?-1:c,1===c&&(o=In(n.val[0]),i=0<(i=Number(n.val[0]))&&i<1,o=En(new Date(o.getTime()+36e5),!0,i),n.val.push(o)),d={regVal:this.getPredictionValue(n.val,!0),type:n.type,i:u},a.push(d),r=1;r<c;)a.push(p),r++}s++}return a}return[{regVal:null}]},Qo.prototype.getNextFormattedValue=function(e,t){return(new J.Internationalization).formatNumber(Math.abs(t),{minimumIntegerDigits:e.length,useGrouping:!1})},Qo.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"},Qo.prototype.round=function(e,t){return Number(Math.round(parseFloat(e+"e"+t))+"e-"+t)||Number(e)},Qo.prototype.getRangeData=function(e){for(var t,r=[],n=this.parent.getActiveSheet(),i=e.range[0],o=e.range[1],s=e.range[2],a=e.range[3],l=o;i<=s;){if($(n,i));else for(o=l;o<=a;)Eh(n,o)||(t=ie(i,o,n),r.push(t)),o++;i++}return r},Qo.prototype.getFormulaPattern=function(e,t){for(var r,n,i,o,s=[],a=0,l=e.length,h={};a<l;)h.formula=e[a],this.parent.notify(yn,h),s.push(h.formulaArr),a++;var d=this.isInPattern(s,t.isVFill);if(d){for(a=(i=s[0]).length;a--;)n=i[a],(o=this.isCellReference(n))&&"absolute"!==o&&(i[a]=this.getCellRefPrediction(n,t,null,o));return{isInPattern:d,val:i}}for(a=0;a<l;){for(r=(i=s[a]).length;r--;)n=i[r],(o=this.isCellReference(n.trim()))&&"absolute"!==o&&(s[a][r]=this.getCellRefPrediction(n,t,l,o));a++}return{isInPattern:d,val:s}},Qo.prototype.generateColCount=function(e){for(var t=0,r=e.split("").reverse().join(""),n=r.length-1;0<=n;n--)t+=(e[n].charCodeAt(parseInt(r[n],10))-64)*Math.pow(26,n);return t},Qo.prototype.getCellRefPrediction=function(e,t,r,n){e=e.toUpperCase();var i=new RegExp("[a-z$]","gi"),o=new RegExp("[0-9$]","g"),s=t.isVFill?e.replace(o,""):e.replace(i,""),i=t.isVFill?Number(e.replace(i,"")):this.generateColCount(e.replace(o,"").trim()),a=null,o=[i],l="$"===e[0];if(!l&&e.includes("$")&&"$"===e.trim()[0])for(var h=1;h<e.length;h++)if("$"===e[h]){a=h,l=!0;break}return o.push(r&&1!==r?i+r:i+1),i=this.getPredictionValue(o),n&&"mixed"===n&&(l===t.isVFill?s=a?s.substring(0,a)+"$"+s.substring(a):"$"+s:i.b=0),i.c=s,i},Qo.prototype.isInPattern=function(e,t){var r,n,i,o,s,a,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],s=i[n],this.isCellReference(o)===this.isCellReference(s)){if(l=t?(a=Number(o.replace(u,"")),Number(s.replace(u,""))):(a=this.generateColCount(o.replace(c,"")),this.generateColCount(s.replace(c,""))),a!==l-1)return!1}else if(o!==s)return!1;h++,d++}return!0},Qo.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},Qo.prototype.getSelectedRange=function(e,t,r){for(var n,i,o=[],s=te([t.rowIndex,t.colIndex,r.rowIndex,r.colIndex]),a=s[0],l=s[2];a<=l;){if(fh(e,a));else for(n=s[1],i=s[3];n<=i;)o.push({rowIndex:a,colIndex:n}),n++;a++}return o},Qo.prototype.getFillType=function(e){return e.fillType=this.fillInfo.fillType,e.disableItems=this.fillInfo.disableItems,e},Qo.prototype.addEventListener=function(){this.parent.on(tn,this.autoFill,this),this.parent.on(nn,this.getFillType,this)},Qo.prototype.destroy=function(){this.removeEventListener(),this.parent=null},Qo.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(tn,this.autoFill),this.parent.off(nn,this.getFillType))},Qo.prototype.getModuleName=function(){return"workbookautofill"};var Jo=Qo;function Qo(e){this.parent=e,this.addEventListener()}ts.prototype.getService=function(e){if(J.isNullOrUndefined(this.services[""+e]))throw"The service "+e+" is not registered";return this.services[""+e]},ts.prototype.register=function(e,t){J.isNullOrUndefined(this.services[""+e])&&(this.services[""+e]=t)};var es=ts;function ts(){this.services={}}var rs,ns,is,os="ribbon",ss="formulaBar",as="sheetTabs",ls="refreshSheetTabs",hs="isFormulaBarEdit",ds="contentLoaded",ps="mouseDown",cs="spreadsheetDestroyed",us="editOperation",fs="formulaOperation",gs="formulaBarOperation",ms="click",vs="keyUp",ys="keyDown",Cs="verticalScroll",bs="horizontalScroll",xs="beforeContentLoaded",Ss="beforeVirtualContentLoaded",ws="virtualContentLoaded",Is="cellNavigate",Es="mouseUpAfterSelection",Rs="contextmenuBeforeOpen",Ns="insertSheetTab",As="removeSheetTab",ks="renameSheetTab",Fs="ribboClick",Os="enableToolbarItems",Ts="tabSwitch",Ds="selectRange",Ls="rangeSelectionByKeydown",Ps="cut",Ms="copy",Bs="paste",Hs="clearCopy",Vs="dataBound",Us="beforeDataBound",_s="addContextMenuItems",zs="removeContextMenuItems",js="enableContextMenuItems",qs="enableFileMenuItems",Ws="hideFileMenuItems",Gs="addFileMenuItems",Ys="hideRibbonTabs",Xs="enableRibbonTabs",Ks="addRibbonTabs",$s="addToolbarItems",Zs="hideToolbarItems",Js="beforeRibbonCreate",Qs="rowHeightChanged",ea="colWidthChanged",ta="onContentScroll",ra="deInitProperties",na="activeSheetChanged",ia="initiateCustomSort",oa="applySort",sa="autoFitRowsColumns",aa="updateToggleItem",la="initiateHyperlink",ha="editHyperlink",da="openHyperlink",pa="addNote",ca="editNote",ua="deleteNote",fa="showNote",ga="createNoteIndicator",ma="updateNoteContainer",va="removeNoteContainer",ya="removeHyperlink",Ca="createHyperlinkElement",ba="sheetNameUpdate",xa="hideSheet",Sa="performUndoRedo",wa="updateUndoRedoCollection",Ia="setActionData",Ea="getBeforeActionData",Ra="clearUndoRedoCollection",Na="initiateFilterUI",Aa="renderFilterCell",ka="refreshFilterRange",Fa="updateSortCollection",Oa="reapplyFilter",Ta="filterByCellValue",Da="clearFilter",La="getFilteredColumn",oe="actionComplete",Pa="filterCellKeyDown",Ma="getFilterRange",Ba="setAutoFit",Ha="refreshFormulaDatasource",Va="setScrollEvent",Ua="initiatedatavalidation",_a="invalidData",za="protectSheet",ja="applyProtect",qa="protectCellFormat",Wa="renderGotoDlgt",Ga="renderFindDlg",Ya="findHandler",Xa="created",Ka="editAlert",$a="readonlyAlert",Za="setUndoRedo",Ja="enableFormulaInput",Qa="protectSelection",el="hiddenMerge",tl="checkPrevMerge",rl="checkMerge",nl="removeDataValidation",il="showAggregate",ol="goToSheet",sl="showSheet",al="renderCFDlg",ll="clearViewer",hl="initiateFormulaReference",dl="initiateCur",pl="clearCellRef",cl="editValue",ul="addressHandle",fl="initiateEdit",gl="forRefSelRender",ml="insertImage",vl="refreshOverlayElem",yl="refreshImgCellObj",Cl="getRowIdxFromClientY",bl="getColIdxFromClientX",xl="createImageElement",Sl="deleteImage",wl="deleteChart",Il="refreshChartCellObj",El="refreshChartCellModel",Rl="refreshImagePosition",Nl="updateTableWidth",Al="focusBorder",kl="clearChartBorder",Fl="insertChart",Ol="chartRangeSelection",Tl="insertDesignChart",Dl="removeDesignChart",Ll="chartDesignTab",Pl="addChartEle",Ml="undoRedoForChartDesign",Bl="protectWorkbook",Hl="unProtectWorkbook",Vl="getPassWord",Ul="setProtectWorkbook",_l="removeWorkbookProtection",zl="importProtectWorkbook",jl="selectionStatus",ql="freeze",Wl="overlayEleSize",Gl="updateScroll",Yl="positionAutoFillElement",Xl="hideAutoFillOptions",Kl="performAutoFill",$l="selectAutoFillRange",Zl="hideAutoFillElement",Jl="unProtectSheetPassword",Ql="updateTranslate",eh="getUpdatedScrollPosition",th="updateScrollValue",rh="beforeCheckboxfilterRenderer",nh="refreshCheckbox",ih="renderInsertDlg",oh="toggleProtect",e=(rs=function(e,t){return(rs=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)},function(e,t){function r(){this.constructor=e}rs(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),sh=function(){return(sh=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,s=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;0<=a;a--)(i=e[a])&&(s=(o<3?i(s):3<o?i(t,r,s):i(t,r))||s);return 3<o&&s&&Object.defineProperty(t,r,s),s},e=(ns=J.Component,e(a,ns),(is=a).prototype.preRender=function(){Object.keys(this.commonCellStyle).length||(this.commonCellStyle=Bi(this.cellStyle,!0)),"spreadsheet"!==this.getModuleName()||this.refreshing||this.initEmptySheet()},a.prototype.initWorkbookServices=function(){this.serviceLocator.register(ii,new J.L10n(this.getModuleName(),oi,this.locale))},a.prototype.render=function(){},a.prototype.requiredModules=function(){return P(this)},a.prototype.getPersistData=function(){return this.addOnPersist([])},a.prototype.cellFormat=function(e,t){var r=this.getActiveSheet();t=t||r.selectedRange,this.notify(It,{style:e,range:t,refreshRibbon:-1<t.indexOf(r.activeCell)})},a.prototype.lockCells=function(e,t){var r=this.getActiveSheet();e=e||r.selectedRange,this.notify(Ar,{range:e,isLocked:t,triggerEvent:!0})},a.prototype.getCellStyleValue=function(e,t){var r=this,n=ie(t[0],t[1],this.getActiveSheet()),i={};return e.forEach(function(e){i[""+e]=r.cellStyle[""+e],n&&n.style&&n.style[""+e]&&(i[""+e]=n.style[""+e])}),i},a.prototype.numberFormat=function(e,t){this.notify(xt,{format:e,range:t}),this.notify(mn,{format:e})},a.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)),Ai(this,t),this.notify(Bt,{sheetIndex:e||0,sheets:t}),this.notify(re,{action:"registerSheet",sheetIndex:e||0,sheetCount:e+t.length})},a.prototype.removeSheet=function(e){this.sheets.splice(e,1)},a.prototype.destroy=function(){this.notify(lt,null),ns.prototype.destroy.call(this)},a.prototype.onPropertyChanged=function(e,t){for(var r=0,n=Object.keys(e);r<n.length;r++)switch(n[r]){case"cellStyle":J.merge(this.commonCellStyle,e.cellStyle);break;case"sheets":e.sheets===this.sheets?(this.notify(re,{action:"unRegisterSheet",propertyChange:!0}),this.sheetNameCount=1,this.notify(Ht,{}),Ai(this),this.notify(Bt,null),this.notify(re,{action:"registerSheet"})):Ai(this);break;case"listSeparator":this.notify(re,{action:"setArgumentSeparator"})}},a.prototype.appendTo=function(e){ns.prototype.appendTo.call(this,e)},a.prototype.hideRow=function(e,t,r){void 0===t&&(t=e),void 0===r&&(r=!0);for(var n=this.getActiveSheet(),i=e;i<=t;i++)uh(n,i,{hidden:r})},a.prototype.hideColumn=function(e,t,r){void 0===t&&(t=e),void 0===r&&(r=!0);for(var n=this.getActiveSheet(),i=e;i<=t;i++)Sh(n,i,{hidden:r})},a.prototype.setBorder=function(e,t,r,n){this.notify(It,{style:e,borderType:r,range:t||this.getActiveSheet().selectedRange,isUndoRedo:n})},a.prototype.insertRow=function(e,t,r){this.notify(ar,{model:this.getSheetModel(r),start:e,end:t,modelType:"Row",insertType:"below"})},a.prototype.insertColumn=function(e,t,r){this.notify(ar,{model:this.getSheetModel(r),start:e,end:t,modelType:"Column",insertType:"after"})},a.prototype.insertSheet=function(e,t){this.notify(ar,{model:this,start:e,end:t,modelType:"Sheet"})},a.prototype.delete=function(e,t,r,n){var i;if(e=e||0,r&&"Sheet"!==r){if(!(i=this.getSheetModel(n)))return}else i=this;this.notify(lr,{model:i,start:e,end:J.isNullOrUndefined(t)?e:t,modelType:r||"Sheet"})},a.prototype.moveSheet=function(e,t){Fi(this,e,t)},a.prototype.duplicateSheet=function(e){Oi(this,e)},a.prototype.getSheetModel=function(e){return J.isNullOrUndefined(e)?this.getActiveSheet():(e="string"==typeof e?B(this,e):e,J.isNullOrUndefined(e)||e>=this.sheets.length?null:this.sheets[e])},a.prototype.merge=function(e,t){var r,n;e?n=ne(this,r=this.isPrintingProcessing?this.currentPrintSheetIndex:N(this,e)):e=(n=this.getActiveSheet()).selectedRange,this.notify(kr,{merge:!0,range:e,type:t||"All",sheetIndex:r,refreshRibbon:-1<e.indexOf(n.activeCell),preventRefresh:this.activeSheetIndex!==r})},a.prototype.unMerge=function(e){var t,r;e?r=ne(this,t=N(this,e)):e=(r=this.getActiveSheet()).selectedRange,this.notify(kr,{merge:!1,range:e,sheetIndex:t,type:"All",refreshRibbon:-1<e.indexOf(r.activeCell),preventRefresh:this.activeSheetIndex!==t})},a.prototype.computeExpression=function(e){e={action:"computeExpression",formula:e,isFromComputeExpression:!0};return this.notify(re,e),e.calcValue},a.prototype.initEmptySheet=function(){this.sheets.length?Ai(this):this.createSheet()},a.prototype.getActiveSheet=function(){return this.sheets[this.activeSheetIndex]},a.prototype.skipHiddenSheets=function(e,t,r){return void 0===r&&(r=0),this.sheets[e]&&"Visible"!==this.sheets[e].state&&(void 0===t&&(t=e),e=e&&e+1===this.sheets.length?t-1:e<t?--e:++e,e=this.skipHiddenSheets(e,t,++r)),r===this.sheets.length?(this.setSheetPropertyOnMute(this.sheets[0],"state","Visible"),0):e},a.prototype.setUsedRange=function(e,t,r,n,i){void 0===r&&(r=this.getActiveSheet()),i?(r.usedRange.rowIndex=e,r.usedRange.colIndex=t):(e>r.usedRange.rowIndex&&(r.usedRange.rowIndex=e,r!==this.getActiveSheet()||n||this.notify(At,{index:e,update:"row"})),t>r.usedRange.colIndex&&(r.usedRange.colIndex=t,r!==this.getActiveSheet()||n||this.notify(At,{index:t,update:"col"})))},a.prototype.getData=function(e){return ai(this,e)},a.prototype.getModuleName=function(){return"workbook"},a.prototype.goTo=function(e){},a.prototype.getValueRowCol=function(e,t,r,n,i,o,s){var a={action:"getSheetInfo",sheetInfo:[]};if(this.notify(re,a),-1===Si(0,"Sheet"+e,a.sheetInfo))return this.notify(re,a={action:"getReferenceError",refError:""}),a.refError;var l,a=bi(this,e),e=ne(this,a),h=ie(t-1,r-1,e);if(n&&n.includes("!")&&!h&&e.ranges&&e.ranges.length){if(this.formulaRefCell&&this.formulaRefCell===n)return h&&h.value;if(e.ranges.forEach(function(e){e.info&&e.info.loadedRange&&e.info.loadedRange.length||(l=!0)}),l){if(this.formulaRefCell=n,a=bi(this,Number(n.substring(n.lastIndexOf(",")+1,n.length))),J.isNullOrUndefined(a))return h&&h.value;n=n.substring(n.lastIndexOf("!")+1,n.lastIndexOf(",")),ai(this,e.name+"!A1:"+G(t-1,r-1),null,null,null,null,n,a)}}else h&&h.formula&&(i||J.isNullOrUndefined(h.value))&&!o&&this.notify("calculateFormula",{cell:h,rowIdx:t-1,colIdx:r-1,sheetIndex:a,formulaRefresh:!0});return!h||Y(h.value)||this.isEdit||(e={formattedText:h.value,value:h.value,format:h.format,cell:h,skipFormatCheck:!1},this.notify(St,e),h=e.cell),s&&h&&h.formula&&h.formula.includes("SUBTOTAL(")?h.formula:h&&h.value},a.prototype.setValueRowCol=function(e,t,r,n,i,o){this.notify(kt,{action:"updateCellValue",address:[r-1,n-1],value:t,sheetIndex:bi(this,e),isValueOnly:!0,formula:i,isRandomFormula:o})},a.prototype.open=function(e){this.notify(ut,e)},a.prototype.openFromJson=function(e,t){this.isOpen=!0;var r="object"==typeof e.file?JSON.stringify(e.file):e.file;if(""!==r&&t){var n=[];if(t.onlyValues)n.push.apply(n,["style","formula","format","conditionalFormats","validation","hyperlink","wrap","chart","image","notes"]);else{var i,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})},a.prototype.save=function(e,t){var r;void 0===e&&(e={}),this.allowSave&&(r={url:this.saveUrl,fileName:e.fileName||"Sample",saveType:"Xlsx"},r=sh({},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}))},a.prototype.saveAsJson=function(e){var r=this;return new Promise(function(t){r.on(ir,function(e){e.cancel=!0,r.off(ir),t({jsonObject:{Workbook:e.jsonObject}}),r.notify(bt,e)}),r.save({},e)})},a.prototype.addHyperlink=function(e,t){this.notify(er,{hyperlink:e,cell:t})},a.prototype.findHandler=function(e){this.notify(cr,e)},a.prototype.replaceHandler=function(e){"replace"===e.replaceBy?this.notify(fr,e):this.notify(gr,e)},a.prototype.protectSheet=function(e,t,r){J.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(wr,{protectSettings:n.protectSettings,password:n.password,sheetIndex:e}))},a.prototype.unprotectSheet=function(e){J.isNullOrUndefined(e)?e=this.activeSheetIndex:"string"==typeof e&&(e=B(this,e)),this.sheets[e]&&this.notify(Er,{sheet:e})},a.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(Yt,t),t.promise):Promise.reject()},a.prototype.addDataValidation=function(e,t){"List"===e.type&&256<e.value1.length&&(e.value1=e.value1.substring(0,255)),this.notify(dr,{rules:e,range:t||this.getActiveSheet().selectedRange})},a.prototype.removeDataValidation=function(e){this.notify(dr,{range:e,isRemoveValidation:!0})},a.prototype.addInvalidHighlight=function(e){this.notify(pr,{range:e})},a.prototype.removeInvalidHighlight=function(e){this.notify(yr,{range:e})},a.prototype.isValidCell=function(e){var e=W(e),t=ie(e[0],e[1],this.getActiveSheet());return!t||!t.validation||(t={value:t.value||"",range:e,sheetIdx:this.activeSheetIndex,isCell:!1,td:null,isValid:!0},this.notify(hr,t),t.isValid)},a.prototype.conditionalFormat=function(e){e.range?","!==this.listSeparator&&e.range.includes(this.listSeparator)&&(e.range=e.range.split(this.listSeparator).join(",")):e.range=this.getActiveSheet().selectedRange,this.notify(Pr,{cfModel:e})},a.prototype.clearConditionalFormat=function(e){var t,r={};e&&e.includes("!")?(t=e.split("!"),r.range=t[1],r.sheetIdx=B(this,t[0])):(r.range=e||this.getActiveSheet().selectedRange,r.sheetIdx=this.activeSheetIndex),this.notify(Br,r)},a.prototype.updateCell=function(e,t){var r;if((t=t||this.getActiveSheet().activeCell).includes("!")){if(r=y(t),void 0===(n=B(this,t.split("!")[0])))return}else r=Q(t),n=this.activeSheetIndex;var n,i,o,t=ne(this,n),s=(Gn(this,t,{cell:e,rowIdx:r[0],colIdx:r[1],preventEvt:!0}),J.isNullOrUndefined(e.value)?e.formula||null:e.value);null!==s&&this.notify(kt,{action:"updateCellValue",address:r,value:s,sheetIndex:n}),n===this.activeSheetIndex&&(o={sheet:t,cell:i=ie(r[0],r[1],t,!1,!(n=void 0)),rowIdx:r[0],colIdx:r[1]},(1<i.rowSpan||1<i.colSpan)&&(ei(o),n=this.getCell(o.rowIdx,o.colIdx)),this.serviceLocator.getService("cell").refresh(r[0],r[1],!0,n,null!==s),this.notify(Lt,null),Pn(Q(t.activeCell),o.rowIdx,o.colIdx))&&this.notify(gs,{action:"refreshFormulabar",value:this.getDisplayText(e)||e.formula})},a.prototype.getRowData=function(e,t){J.isNullOrUndefined(e)&&(e=0);t={sheetIdx:t=J.isNullOrUndefined(t)?this.activeSheetIndex:t,startIndex:e,modelType:"Row",isDataRequest:!0};return this.notify(pt,t),t.data},a.prototype.updateRange=function(e,t){var t=ne(this,t=t?t-1:this.activeSheetIndex),r=t.ranges;J.isNullOrUndefined(t)||(r.push(e),t.ranges=r)},a.prototype.wrap=function(e,t){Hi(e,t=void 0===t?!0:t,this)},a.prototype.addDefinedName=function(e){e={action:"addDefinedName",isAdded:!1,definedName:e};return this.notify(re,e),e.isAdded},a.prototype.removeDefinedName=function(e,t){e={action:"removeDefinedName",isRemoved:!1,definedName:e,scope:t=void 0===t?"":t};return this.notify(re,e),e.isRemoved},a.prototype.insertImage=function(e,t){this.notify(Ur,{options:e,range:t||this.getActiveSheet().selectedRange})},a.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)},a.prototype.insertChart=function(e){this.notify(_r,{chart:e})},a.prototype.deleteChart=function(e){this.notify(wl,{id:e})},a.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(tr,t),t.promise):Promise.reject()},a.prototype.addCustomFunction=function(e,t,r){t=t||("string"==typeof e?e:e.name.replace("bound ","")),this.notify(re,{action:"addCustomFunction",functionHandler:e,functionName:t,formulaDescription:r})},a.prototype.clear=function(e){this.notify(Hr,e)},a.prototype.getDisplayText=function(e){var t;return e?e.format&&!J.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():"":""},a.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())},a.prototype.Unfreeze=function(e){this.freezePanes(0,0,e)},a.prototype.unfreezePanes=function(e){this.freezePanes(0,0,e)},a.prototype.updateTopLeftCell=function(e,t,r,n){var i=W((n=n||this.getActiveSheet()).topLeftCell);n.frozenRows||n.frozenColumns?((J.isNullOrUndefined(e)||e<0)&&(e=n.frozenRows?0:i[0]),(J.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])):(J.isNullOrUndefined(e)&&(e=i[0]),J.isNullOrUndefined(t)&&(t=i[1]),this.setSheetPropertyOnMute(n,"paneTopLeftCell",G(e,t))),this.setSheetPropertyOnMute(n,"topLeftCell",G(e,t))},a.prototype.getAddressInfo=function(e){return x(this,e)},a.prototype.setSheetPropertyOnMute=function(e,t,r){this.isProtectedOnChange=!0,e[""+t]=r,this.isProtectedOnChange=!1},a.prototype.frozenRowCount=function(e){return e.frozenRows?"A1"===e.topLeftCell?e.frozenRows:W(e.topLeftCell)[0]+e.frozenRows:0},a.prototype.frozenColCount=function(e){return e.frozenColumns?"A1"===e.topLeftCell?e.frozenColumns:W(e.topLeftCell)[1]+e.frozenColumns:0},a.prototype.updateRangeOnInsertDelete=function(e,t,r){var n,i=!1;return e.isInsert?(n=e.endIndex-e.startIndex+1,"Row"===e.modelType?(e.startIndex<=t[0]&&(t[0]+=n,i=!0),(e.startIndex<=t[2]||r&&e.startIndex===t[2]+1)&&(t[2]+=n,i=!0)):(e.startIndex<=t[1]&&(t[1]+=n,i=!0),(e.startIndex<=t[3]||r&&e.startIndex===t[3]+1)&&(t[3]+=n,i=!0))):"Row"===e.modelType?(0<(n=t[0]-e.startIndex)&&(!(t[0]>e.endIndex)||0<(n=e.endIndex-e.startIndex+1))&&(t[0]-=n,i=!0),e.startIndex<=t[2]&&(e.endIndex<=t[2]?t[2]-=e.endIndex-e.startIndex+1:t[2]-=t[2]-e.startIndex+1,i=!0)):(0<(n=t[1]-e.startIndex)&&(!(t[1]>e.endIndex)||0<(n=e.endIndex-e.startIndex+1))&&(t[1]-=n,i=!0),e.startIndex<=t[3]&&(e.endIndex<=t[3]?t[3]-=e.endIndex-e.startIndex+1:t[3]-=t[3]-e.startIndex+1,i=!0)),i},a.prototype.getCell=function(e,t,r){return null},a.prototype.dateToInt=function(e,t){return En(e,t)},a.prototype.setDateFormat=function(e,t,r){var e=ne(this,bi(this,e)),n=ie(t,r,e,null,!0).format;n&&"General"!==n||Mi(t,r,e,{format:xo("ShortDate")},!0)},n([J.Collection([],yi)],a.prototype,"sheets",void 0),n([J.Property(0)],a.prototype,"activeSheetIndex",void 0),n([J.Property("100%")],a.prototype,"height",void 0),n([J.Property(!0)],a.prototype,"allowFindAndReplace",void 0),n([J.Property()],a.prototype,"filterCollection",void 0),n([J.Property()],a.prototype,"sortCollection",void 0),n([J.Property("100%")],a.prototype,"width",void 0),n([J.Property(!0)],a.prototype,"showRibbon",void 0),n([J.Property(!0)],a.prototype,"showFormulaBar",void 0),n([J.Property(!0)],a.prototype,"showSheetTabs",void 0),n([J.Property(!0)],a.prototype,"allowEditing",void 0),n([J.Property(!0)],a.prototype,"allowOpen",void 0),n([J.Property(!0)],a.prototype,"allowSave",void 0),n([J.Property(!0)],a.prototype,"allowSorting",void 0),n([J.Property(!0)],a.prototype,"allowFiltering",void 0),n([J.Property(!0)],a.prototype,"allowNumberFormatting",void 0),n([J.Property(!0)],a.prototype,"allowCellFormatting",void 0),n([J.Property(!0)],a.prototype,"allowHyperlink",void 0),n([J.Property(!0)],a.prototype,"enableNotes",void 0),n([J.Property(!0)],a.prototype,"allowInsert",void 0),n([J.Property(!0)],a.prototype,"allowDelete",void 0),n([J.Property(!0)],a.prototype,"allowMerge",void 0),n([J.Property(!0)],a.prototype,"allowDataValidation",void 0),n([J.Property(!0)],a.prototype,"allowImage",void 0),n([J.Property(!0)],a.prototype,"allowChart",void 0),n([J.Property(!0)],a.prototype,"allowAutoFill",void 0),n([J.Property(!0)],a.prototype,"allowPrint",void 0),n([J.Complex({},U)],a.prototype,"autoFillSettings",void 0),n([J.Property(!0)],a.prototype,"allowConditionalFormat",void 0),n([J.Complex({},_)],a.prototype,"cellStyle",void 0),n([J.Property("")],a.prototype,"openUrl",void 0),n([J.Property("")],a.prototype,"saveUrl",void 0),n([J.Property("")],a.prototype,"password",void 0),n([J.Property(!1)],a.prototype,"isProtected",void 0),n([J.Collection([],me)],a.prototype,"definedNames",void 0),n([J.Event()],a.prototype,"beforeOpen",void 0),n([J.Event()],a.prototype,"openFailure",void 0),n([J.Event()],a.prototype,"beforeSave",void 0),n([J.Event()],a.prototype,"saveComplete",void 0),n([J.Event()],a.prototype,"beforeCellFormat",void 0),n([J.Event()],a.prototype,"queryCellInfo",void 0),n([J.Event()],a.prototype,"beforeCellUpdate",void 0),n([J.Property(!0)],a.prototype,"allowFreezePane",void 0),n([J.Property(",")],a.prototype,"listSeparator",void 0),is=n([J.NotifyPropertyChanges],a));function a(e){var t=ns.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,is.Inject(zi,$i,qi,bo,Oo,Do,Co,wo,Po,Eo,Bo,qo,_o,Go,Xo,$o,No,ko,Jo),t.commonCellStyle={},e&&e.cellStyle&&(t.commonCellStyle=e.cellStyle),"workbook"===t.getModuleName()&&(t.serviceLocator=new es,t.initWorkbookServices(),t.dataBind(),t.initEmptySheet()),t}ah=function(e,t){return(ah=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 ah,lh,n=function(e,t){function r(){this.constructor=e}ah(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},hh=function(e,t,r,n){var i,o=arguments.length,s=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;0<=a;a--)(i=e[a])&&(s=(o<3?i(s):3<o?i(t,r,s):i(t,r))||s);return 3<o&&s&&Object.defineProperty(t,r,s),s},dh=(lh=J.ChildProperty,n(ph,lh),hh([J.Collection([],Li)],ph.prototype,"cells",void 0),hh([J.Property(0)],ph.prototype,"index",void 0),hh([J.Property(20)],ph.prototype,"height",void 0),hh([J.Property(!1)],ph.prototype,"customHeight",void 0),hh([J.Property(!1)],ph.prototype,"hidden",void 0),hh([J.Complex({},Ae)],ph.prototype,"format",void 0),hh([J.Property(!1)],ph.prototype,"isReadOnly",void 0),ph);function ph(){return null!==lh&&lh.apply(this,arguments)||this}function ch(e,t){return e.rows[t]}function uh(t,r,n){t.rows[r]||(t.rows[r]={}),Object.keys(n).forEach(function(e){t.rows[r][""+e]=n[""+e]})}function $(e,t){return e.rows[t]&&e.rows[t].hidden}function fh(e,t){return e.rows[t]&&e.rows[t].isFiltered}function gh(e,t,r,n){var i;if(e&&e.rows&&e.rows[t]){if(!n&&e.rows[t].hidden)return 0;i=void 0===e.rows[t].height?20:e.rows[t].height}else i=20;return r&&0<window.devicePixelRatio%1?i+((n=i*window.devicePixelRatio%1)?(.5<n?1-n:-1*n)/window.devicePixelRatio:0):i}function mh(e,t,r){e&&e.rows&&(e.rows[t]||(e.rows[t]={}),e.rows[t].height=r)}function vh(e,t,r,n,i){var o,s=0;(r=void 0===r?t:r)<t&&(o=t,t=r,r=o);for(var a=t;a<=r;a++)s+=gh(e,a,n,i);return s}yh=function(e,t){return(yh=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 yh,Ch,n=function(e,t){function r(){this.constructor=e}yh(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},hh=function(e,t,r,n){var i,o=arguments.length,s=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;0<=a;a--)(i=e[a])&&(s=(o<3?i(s):3<o?i(t,r,s):i(t,r))||s);return 3<o&&s&&Object.defineProperty(t,r,s),s},bh=(Ch=J.ChildProperty,n(xh,Ch),hh([J.Property(0)],xh.prototype,"index",void 0),hh([J.Property(64)],xh.prototype,"width",void 0),hh([J.Property(!1)],xh.prototype,"customWidth",void 0),hh([J.Property(!1)],xh.prototype,"hidden",void 0),hh([J.Complex({},Ae)],xh.prototype,"format",void 0),hh([J.Property(!0)],xh.prototype,"isLocked",void 0),hh([J.Property("")],xh.prototype,"validation",void 0),hh([J.Property(!1)],xh.prototype,"isReadOnly",void 0),xh);function xh(){return null!==Ch&&Ch.apply(this,arguments)||this}function se(e,t){return e.columns?e.columns[t]||(e.columns[t]={}):(e.columns=[],e.columns[t]={}),e.columns[t]}function Sh(e,t,r){var n=se(e,t);Object.keys(r).forEach(function(e){n[""+e]=r[""+e]})}function wh(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 Ih(e,t,r,n){var i,o=0;(r=void 0===r?t:r)<t&&(i=t,t=r,r=i);for(var s=t;s<=r;s++)o+=wh(e,s,null,n);return o}function Eh(e,t){return e.columns[t]&&e.columns[t].hidden}function Rh(e,t,r){return!!(e&&e.validation&&(!e.validation.address||e.validation.address&&Mn(e.validation.address,t,r)))}function Nh(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]}),P(e,t),t}var Ah="e-wraptext",A="spreadsheetLocale",k="dialog",kh="actionEvents",Fh="shape",Oh={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"]},Th={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"]},Dh={UP:38,DOWN:40,LEFT:37,RIGHT:39,FIRSTALPHABET:65,LASTALPHABET:90,SPACE:32,BACKSPACE:8,TAB:9,DELETE:46,ENTER:13,ESC:27},Lh={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",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",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.",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",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 Ph(e){requestAnimationFrame(function(){e()})}function Mh(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function Bh(e){var t=30;return t=3<e.toString().length?10*e.toString().length:t}var Hh=null,Vh=1.24;function Uh(){var e,t;return null!==Hh?Hh:(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),Hh=t)}var _h=["e-ribbon","e-formula-bar-panel","e-sheet-tab-panel","e-header-toolbar"];function zh(e,t){return jh(e,"previous",t=void 0===t?_h:t)+jh(e,"next",t)}function jh(e,t,r){for(var n=e[t+"ElementSibling"],i=0;n;)r.some(function(e){return n.classList.contains(e)})&&(i+=n.offsetHeight),n=n[t+"ElementSibling"];return i}function qh(e,t,r){if(e.scrollSettings.enableVirtualization){var n=e.getActiveSheet(),i=e.frozenRowCount(n),o=e.frozenColCount(n),s=e.viewport.topIndex+i,a=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(s<=t[0]&&l>=t[2]&&a<=t[1]&&h>=t[3])return!0;n=!1;if(r){if(t[0]<s&&t[2]<s||t[0]>l&&t[2]>l)return!1;if(t[0]<s&&t[2]>s&&t[0]>=i&&(t[0]=s,n=!0),t[2]>l&&(t[2]=l,n=!0),t[1]<a&&t[3]<a||t[1]>h&&t[3]>h)return!1;t[1]<a&&t[3]>a&&t[1]>=o&&(t[1]=a,n=!0),t[3]>h&&(t[3]=h,n=!0)}return n}return!0}function Wh(e,t,r,n,i,o,s,a){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+=gh(e,c,!a));for(c=l.idx;c<t[1];c++)n&&n-1<t[1]&&c<n||(p+=wh(e,c,null,!a));return r&&t[0]<r&&(e.showHeaders&&(d+=30),i)&&(d-=i),n&&t[1]<n&&(e.showHeaders&&(p+=s||30),o)&&(p-=o),{top:d,left:p}}function Gh(e,n,t,i,o,s,a){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=Xh(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)),Xh(e,n=u,t,v,e.enableRtl,l,h,o,!0,e.viewport.beforeFreezeHeight,e.viewport.beforeFreezeWidth,e.sheetModule.colGroupWidth)):Xh(e,n,t,v,e.enableRtl,l,h,o),n.style.display&&(n.style.display=""),Yh(e.getSelectAllContent(),d,"e-active-cell"),Yh(e.getColumnHeaderContent(),d,"e-active-cell"),Yh(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)),Xh(e,n=u,t,v,e.enableRtl,p,c,o,!0,e.viewport.beforeFreezeHeight,e.viewport.beforeFreezeWidth,e.sheetModule.colGroupWidth,"e-autofill")):Xh(e,n,t,v,e.enableRtl,p,c,o,!1,0,0,0,"e-autofill"),n.style.display&&(n.style.display=""),Yh(e.getSelectAllContent(),r,"e-autofill"),Yh(e.getColumnHeaderContent(),r,"e-autofill"),Yh(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?Xh(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?Xh(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,Xh(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?Xh(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,Xh(e,n,t,v,e.enableRtl,p,c,o,!0,e.viewport.beforeFreezeHeight,e.viewport.beforeFreezeWidth,e.sheetModule.colGroupWidth,"e-filloption",!0)):Xh(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=""),Yh(e.getSelectAllContent(),r,"e-filloption"),Yh(e.getColumnHeaderContent(),r,"e-filloption"),Yh(e.getRowHeaderContent(),r,"e-filloption")):(m=te(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),s||(Yh(e.getColumnHeaderContent(),d,i,!0),Yh(e.getRowHeaderContent(),d,i,!0))):m[2]>l-1?m[3]<h?(s||Yh(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]]),s||Yh(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),s||Yh(e.getRowHeaderContent(),d,i,!0)):(f.push([m[0],m[1],l-1,m[3]]),f.push([l,m[1],m[2],m[3]]),s||(Yh(e.getSelectAllContent(),d,i,!0),Yh(e.getRowHeaderContent(),d,i,!0))):m[3]<h?(f.push(t),s||Yh(e.getSelectAllContent(),d,i,!0)):(f.push([m[0],m[1],m[2],h-1]),f.push([m[0],h,m[2],m[3]]),s||(Yh(e.getSelectAllContent(),d,i,!0),Yh(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&&J.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&&J.detach(g)}),h&&(t[3]+1===h&&f.forEach(function(e){e!==t&&(g=r.getElementsByClassName("e-right")[0])&&e[1]===h&&J.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&&J.detach(g)})):((r=d.querySelector("."+i))||(r=n.cloneNode(!0),s&&!r.classList.contains("e-multi-range")&&r.classList.add("e-multi-range"),d.appendChild(r)),a&&r.classList.remove(i)),Xh(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")})):(s||(Yh(e.getSelectAllContent(),null,i,!0),Yh(e.getColumnHeaderContent(),null,i,!0),Yh(e.getRowHeaderContent(),null,i,!0)),Xh(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"),a&&n.classList.remove(i))}function Yh(e,t,r,n,i){if(n||e!==t)if(i)for(var o=e.querySelectorAll("."+r),s=0;s<o.length;)o[s].classList.remove(r),s++;else{n=e.querySelector("."+r);n&&!n.classList.contains("e-multi-range")&&J.detach(n)}}function Xh(e,t,r,n,i,o,s,a,l,h,d,p,c,u,f){var g,r=te(r),o=Wh(n,r,o,s,h,d,p),h=[K(n,0,!0),K(n,0,!0,"columns")],d=e.scrollSettings.isFinite?(g=r[0]>=n.rowCount?0:vh(n,r[0],r[2]<n.rowCount?r[2]:n.rowCount-1,!0),r[1]>=n.colCount?0:Ih(n,r[1],r[3]<n.colCount?r[3]:n.colCount-1,!0)):(g=vh(n,r[0],r[2],!0),Ih(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(J.isNullOrUndefined(c)){if((x={top:(r[0]===h[0]?o.top:o.top-dd(1))+"px",height:g&&g+(r[0]===h[0]?0:dd(1))+"px",width:d&&d+(r[1]===h[1]?0:dd(1))+(l&&s&&r[1]<s&&r[3]>=s?1:0)+"px"})[i?"right":"left"]=(r[1]===h[1]?o.left:o.left-1)+"px",t)return Kh([{element:t,attrs:x}],a)}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?(J.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&&Kh([{element:t,attrs:x}],a)}}function Kh(r,n){return new Promise(function(t){function e(){r.forEach(function(e){J.setStyleAttribute(e.element,e.attrs),t()})}n?e():requestAnimationFrame(e)})}function $h(){return J.Browser.isPointer?"pointerdown":"mousedown touchstart"}function Zh(){return J.Browser.isPointer?"pointermove":"mousemove touchmove"}function Jh(){return J.Browser.isPointer?"pointerup":"mouseup touchend"}function Qh(e){return"touchstart"===e.type||"pointerdown"===e.type&&"touch"===e.pointerType}function ed(e){return"touchmove"===e.type||"pointermove"===e.type&&"touch"===e.pointerType}function td(e){return"touchend"===e.type||"pointerup"===e.type&&"touch"===e.pointerType}function rd(e){return e&&("mousedown"===e.type||"pointerdown"===e.type)}function nd(e){return e&&("mousemove"===e.type||"pointermove"===e.type)}function id(e){return e&&("mouseup"===e.type||"pointerup"===e.type)}function od(e){return e===Dh.UP||e===Dh.DOWN||e===Dh.LEFT||e===Dh.RIGHT}function sd(e){return(e.changedTouches?e.changedTouches[0]:e).clientX}function ad(e){return(e.changedTouches?e.changedTouches[0]:e).clientY}function ld(e){return(e.changedTouches?e.changedTouches[0]:e).pageX}function hd(e){return(e.changedTouches?e.changedTouches[0]:e).pageY}function dd(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 pd={role:"role",selected:"aria-selected",multiselectable:"aria-multiselectable",busy:"aria-busy",colcount:"aria-colcount"};function cd(t,r){Object.keys(r).forEach(function(e){t&&t.setAttribute(pd[""+e],r[""+e])})}function ud(e,t){e&&(e=J.getComponent(e,t))&&e.destroy()}function fd(e,t,r,n,i){var o,s,a,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],c=(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)?dd(parseInt(r,10))+"px":"2px",(c=i.getRow(e,null,p)).style.height=0<parseInt(r,10)?dd(parseInt(r,10))+"px":"0px";for(var d=void 0,g=(h.showHeaders&&(e=i.getRowHeaderContent().getElementsByClassName("e-row"),(p=[])[0]=e[t].getElementsByTagName("td")[0].cloneNode(!0),d=md(i.getRowHeaderTable(),p,!1,i)+1),i.getMainContent().getElementsByClassName("e-row")),m=[],v=0;v<g[t].getElementsByTagName("td").length;v++)m[v]=g[t].getElementsByTagName("td")[v].cloneNode(!0);var e=md(i.getContentTable(),m,!1,i)+1,p=e<=d?d:e;parseInt(c.style.height,10)<p||u&&u.classList.contains("e-reach-fntsize")&&parseInt(c.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"),c.style.lineHeight=0<parseInt(r,10)?parseInt(r,10)-1+"px":"0px"):(f&&f.style.removeProperty("line-height"),c.style.removeProperty("line-height"),u&&u.classList.contains("e-reach-fntsize")&&u.classList.remove("e-reach-fntsize"))}if(d=c.previousElementSibling,e=c.nextElementSibling,d&&(h.showHeaders&&(o=u.previousElementSibling,s=f.previousElementSibling),d=c.previousElementSibling),e&&(h.showHeaders&&(a=u.nextElementSibling,l=f.nextElementSibling),e=c.nextElementSibling),parseInt(r,10)<=0&&!c.classList.contains("e-zero")&&!c.classList.contains("e-zero-start")){if(d&&e)if(n?(h.showHeaders&&(f.style.width="2px"),c.style.width="0px"):(h.showHeaders&&(f.style.height="2px"),c.style.height="0px"),d.classList.contains("e-zero-start")?(h.showHeaders&&u.classList.add("e-zero-start"),c.classList.add("e-zero-start")):(h.showHeaders&&u.classList.add("e-zero"),c.classList.add("e-zero")),!a||a.classList.contains("e-zero")||a.classList.contains("e-zero-last")||(h.showHeaders&&u.classList.add("e-zero-last"),c.classList.add("e-zero-last")),d.classList.contains("e-zero-last")&&(h.showHeaders&&o.classList.remove("e-zero-last"),d.classList.remove("e-zero-last")),h.showHeaders&&o.classList.contains("e-zero")?(u.classList.contains("e-zero-end"),gd(s,-2,n)):h.showHeaders&&gd(s,-1,n),h.showHeaders&&o.classList.contains("e-zero-start")&&gd(f,-1,n),h.showHeaders&&a.classList.contains("e-zero"))if(u.classList.contains("e-zero-start"))for(;a;){if(a.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"),a.classList.remove("e-zero"),a.classList.add("e-zero-start");break}var y=void 0;a.classList.remove("e-zero"),a.classList.add("e-zero-start"),l=(n?(y=parseInt(a.getAttribute("aria-colindex"),10)-1,a=i.getColHeaderTable().getElementsByTagName("th")[y+1],i.getColHeaderTable().getElementsByTagName("col")):(y=parseInt(a.getAttribute("aria-rowindex"),10)-1,a=i.getRowHeaderTable().getElementsByTagName("tr")[y+1],i.getRowHeaderTable().getElementsByTagName("tr")))[y+1]}else gd(f,-2,n);else h.showHeaders&&(a.classList.contains("e-zero-end")?n?f.style.width="0px":f.style.height="0px":gd(l,-1,n));else if(d)n?(h.showHeaders&&(f.style.width="1px"),c.style.width="0px"):(h.showHeaders&&(f.style.height="1px"),c.style.height="0px"),h.showHeaders&&u.classList.add("e-zero-end"),c.classList.add("e-zero-end"),h.showHeaders&&u.classList.add("e-zero-last"),c.classList.add("e-zero-last"),h.showHeaders&&o.classList.contains("e-zero")?gd(s,-2,n):gd(s,-1,n);else if(a)if(u.classList.add("e-zero-start"),c.classList.add("e-zero-start"),a.classList.contains("e-zero")||(u.classList.add("e-zero-last"),c.classList.add("e-zero-last")),n?(f.style.width="1px",c.style.width="0px"):(f.style.height="1px",c.style.height="0px"),h.showHeaders&&a.classList.contains("e-zero"))for(;a;){if(a.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"),a.classList.add("e-zero-start"),a.classList.remove("e-zero");break}y=void 0;a.classList.add("e-zero-start"),a.classList.remove("e-zero"),a=(n?(y=parseInt(a.getAttribute("aria-colindex"),10)-1,l=i.getColHeaderTable().getElementsByTagName("col")[y+1],i.getColHeaderTable().getElementsByTagName("th")):(y=parseInt(a.getAttribute("aria-rowindex"),10)-1,l=i.getRowHeaderTable().getElementsByTagName("tr")[y+1],i.getRowHeaderTable().getElementsByTagName("tr")))[y+1]}else h.showHeaders&&gd(l,-1,n)}else 0<parseInt(r,10)&&(p=dd(parseInt(r,10))+"px",n?(f.style.width=p,c.style.width=p):(f.style.height=p,c.style.height=p),h.showHeaders&&o&&a?(o.classList.contains("e-zero")?u.classList.contains("e-zero")?n?(s.style.width=parseInt(s.style.width,10)+2+"px",f.style.width=parseInt(f.style.width,10)-1+"px"):(s.style.height=parseInt(s.style.height,10)+2+"px",f.style.height=parseInt(f.style.height,10)-1+"px"):gd(f,-1,n):u.classList.contains("e-zero")?gd(s,1,n):u.classList.contains("e-zero-start")&&(n?(s.style.width=parseInt(s.style.width,10)+1+"px",f.style.width=parseInt(f.style.width,10)-1+"px"):(s.style.height=parseInt(s.style.height,10)+1+"px",f.style.height=parseInt(f.style.height,10)-1+"px")),a.classList.contains("e-zero")?gd(f,-1,n):(u.classList.contains("e-zero")||u.classList.contains("e-zero-start"))&&gd(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"),c.classList.contains("e-zero")&&c.classList.remove("e-zero"),c.classList.contains("e-zero-start")&&c.classList.remove("e-zero-start"),u.classList.contains("e-zero-last")&&u.classList.remove("e-zero-last"),c.classList.contains("e-zero-last")&&c.classList.remove("e-zero-last"),(o.classList.contains("e-zero")||o.classList.contains("e-zero-start"))&&(o.classList.add("e-zero-last"),d.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",s.style.width=parseInt(s.style.width,10)+2+"px"):(f.style.height=parseInt(f.style.height,10)-1+"px",s.style.height=parseInt(s.style.height,10)+2+"px"):gd(f,-1,n):u.classList.contains("e-zero")?gd(s,1,n):gd(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"),c.classList.contains("e-zero")&&c.classList.remove("e-zero"),c.classList.contains("e-zero-end")&&c.classList.remove("e-zero-end")):h.showHeaders&&a&&(a.classList.contains("e-zero")?gd(f,-1,n):u.classList.contains("e-zero-start")&&(gd(l,1,n),u.classList.remove("e-zero-start")),u.classList.contains("e-zero")&&u.classList.remove("e-zero"),c.classList.contains("e-zero")&&c.classList.remove("e-zero"),u.classList.contains("e-zero-start")&&u.classList.remove("e-zero-start"),c.classList.contains("e-zero-start"))&&c.classList.remove("e-zero-start"))}function gd(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 md(e,t,r,n,i,o){var s,a,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?(s=r&&parseInt(i,10)>e?e:parseInt(i,10),a=!r&&parseInt(i,10)>n?n:parseInt(i,10)):(a=n,s=e),document.body.removeChild(l),r?Math.ceil(s):Math.ceil(a)}function vd(e,t,r,n,i,o){var s=e.eventArgs,a=e.isFromUpdateAction||J.isUndefined(r);if(e.isUndoRedo)a=e.isFromUpdateAction=!0,delete e.isUndoRedo,t.notify(Sa,e);else{if(a&&!o){var o=s.address||s.range||s.pastedRange||s.addressCollection&&s.addressCollection[0]||s.dataRange,o=J.isUndefined(s.sheetIndex)?J.isUndefined(s.sheetIdx)?J.isUndefined(s.activeSheetIndex)?o?N(t,o):t.activeSheetIndex:s.activeSheetIndex:s.sheetIdx:s.sheetIndex;if(o!==t.activeSheetIndex)return o={sheet:ne(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(){vd(e,t,r,n,i,!0)})}var l,h,d,p,c=bi(t,s.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(Yt,l={args:l,promise:p}),l.promise.then(function(e){t.serviceLocator.getService("cell").refreshRange(y(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.updateCell(l.formula?{formula:l.formula}:{value:l.value},l.address),!0===r&&t.trigger("cellSave",l);break;case"addNote":l=y(e.eventArgs.address),r&&(Gn(t,t.getActiveSheet(),{rowIdx:l[0],colIdx:l[1],preventEvt:!0,cell:{notes:e.eventArgs.notes}}),t.serviceLocator.getService("cell").refreshRange(y(s.address),!1,!1,!0,!1,Td(t)));break;case"cellDelete":l=x(t,e.eventArgs.address),Od(t,l.indices,l.sheetIndex);break;case"format":"CellFormat"===s.requestType?(s.style&&s.style.border&&!J.isNullOrUndefined(s.borderType)?(l={},Object.assign(l,s.style,null,!0),s.style.border=void 0,t.notify(It,{style:s.style,refreshRibbon:!0,range:s.range}),s.style.border=l.border,t.setBorder(s.style,s.range,s.borderType),s.style=l):t.notify(It,{style:s.style,refreshRibbon:!0,range:s.range}),Ph(function(){t.selectRange(t.getActiveSheet().selectedRange)})):t.numberFormat(s.format,s.range);break;case"clipboard":l=new Promise(function(e){e(void 0)}),d=t.getAddressInfo(s.copiedRange),t.notify(s.copiedInfo.isCut?Ps:Ms,{range:d.indices,sId:ne(t,d.sheetIndex).id,promise:p,invokeCopy:!0,isPublic:!0,isFromUpdateAction:!0}),l.then(function(){return t.notify(Bs,{range:y(s.pastedRange),sIdx:B(t,xi(s.pastedRange)),type:s.type,isAction:!1,isInternal:!0,isFromUpdateAction:!0})});break;case"gridLines":t.setSheetPropertyOnMute(t.sheets[s.sheetIdx],"showGridLines",s.isShow),t.serviceLocator.getService("sheet").toggleGridlines(),t.notify(jr,null);break;case"headers":t.setSheetPropertyOnMute(t.sheets[s.sheetIdx],"showHeaders",s.isShow),t.serviceLocator.getService("sheet").showHideHeaders(),t.notify(jr,null);break;case"resize":case"resizeToFit":a&&(d=se(h=t.sheets[s.sheetIndex],s.index),l=ch(h,s.index),s.isCol&&d&&d.hidden||l&&l.hidden)&&t.notify(Lr,{startIndex:s.index,endIndex:s.index,hide:!1,isCol:s.isCol,sheetIndex:s.sheetIndex}),s.isCol?void 0===s.hide?t.setColWidth(a&&!J.isUndefined(r)?s.oldWidth:s.width,s.index,s.sheetIndex):t.hideColumn(s.index,s.index,s.hide):void 0===s.hide?t.setRowHeight(a&&!J.isUndefined(r)?s.oldHeight:s.height,s.index,s.sheetIndex):t.hideRow(s.index,s.index,s.hide);break;case"renameSheet":t.setSheetPropertyOnMute(t.sheets[c],"name",s.value),t.notify(ba,{items:t.element.querySelector(".e-sheet-tabs-items"),value:s.value,idx:c});break;case"hideSheet":t.notify(xa,{sheetIndex:s.sheetIndex});break;case"showSheet":t.notify(sl,s);break;case"removeSheet":t.notify(As,{index:s.index,isAction:!0,count:s.sheetCount,clicked:!0});break;case"gotoSheet":t.notify(ol,{selectedIndex:s.currentSheetIndex,previousIndex:s.previousSheetIndex});break;case"moveSheet":Fi(t,s.position,s.sheetIndexes,null,a);break;case"wrap":Hi(e.eventArgs.address,e.eventArgs.wrap,t);break;case"hideShow":s.isCol?t.notify(Lr,{startIndex:s.startIndex,endIndex:s.endIndex,isCol:!0,hide:!1===r?!s.hide:s.hide,sheetIndex:s.sheetIndex}):t.notify(Lr,{startIndex:s.startIndex,endIndex:s.endIndex,hide:!1===r?!s.hide:s.hide,sheetIndex:s.sheetIndex});break;case"replace":t.notify(fr,{value:s.compareValue,replaceValue:s.replaceValue,sheetIndex:s.sheetIndex,address:s.address});break;case"replaceAll":t.notify(gr,s);break;case"filter":p=new Promise(function(e){e(void 0)}),!1===r?t.notify(Na,{predicates:s.previousPredicates,range:s.range,sIdx:s.sheetIndex,promise:p,isInternal:!0}):t.notify(Na,{predicates:s.predicates,range:s.range,sIdx:s.sheetIndex,promise:p,isInternal:!0,useFilterRange:s.useFilterRange,allowHeaderFilter:s.allowHeaderFilter}),i&&!a&&p.then(function(){t.notify(oe,J.extend({isUndo:!r,isUndoRedo:!a},i))});break;case"insert":if("Sheet"===e.eventArgs.modelType)h=t;else if(!(h=ne(t,e.eventArgs.activeSheetIndex)))break;!1===r?t.notify(lr,{model:h,start:e.eventArgs.index,isUndoRedo:!0,end:e.eventArgs.index+(e.eventArgs.model.length-1),modelType:e.eventArgs.modelType}):t.notify(ar,{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:a});break;case"delete":if("Sheet"===e.eventArgs.modelType)h=t;else if(!(h=ne(t,e.eventArgs.activeSheetIndex)))break;!1===r?t.notify(ar,{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(lr,{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(nl,{range:s.range}):t.notify(dr,{rules:{type:s.type,operator:s.operator,value1:s.value1,value2:s.value2,ignoreBlank:s.ignoreBlank,inCellDropDown:s.inCellDropDown},range:s.range});break;case"removeHighlight":case"addHighlight":t.notify(_a,{isRemoveHighlight:"removeHighlight"===e.action?!1!==r:!1===r,range:s.range,isPublic:!0});break;case"merge":e.eventArgs.isAction=!1;for(var u=[],f=0,g=s.model.length;f<g;f++){u.push({cells:[]});for(var m=0,v=s.model[f].cells.length;m<v;m++)u[f].cells[m]={},Object.assign(u[f].cells[m],s.model[f].cells[m])}t.notify(kr,e.eventArgs),s.model=u;break;case"clear":d={options:e.eventArgs,isFromUpdateAction:a},t.notify(ll,d),!a&&d.cfClearActionArgs&&(s.cfClearActionArgs.previousConditionalFormats=d.cfClearActionArgs.previousConditionalFormats,s.cfClearActionArgs.conditionalFormats=d.cfClearActionArgs.conditionalFormats);break;case"conditionalFormat":!1===r?t.notify(Br,{range:s.range,cfModel:{type:s.type,cFColor:s.cFColor,value:s.value},sheetIdx:s.sheetIdx,isUndoRedo:!s.cancel,isFromUpdateAction:a}):t.notify(Pr,{cfModel:{type:s.type,cFColor:s.cFColor,value:s.value,range:s.range},sheetIdx:s.sheetIdx,isUndoRedo:!0,isFromUpdateAction:a});break;case"clearCF":!1===r?t.notify(Br,{oldCFModel:s.previousConditionalFormats,updatedCFModel:s.conditionalFormats,range:s.selectedRange,isUndo:!0,sheetIdx:s.sheetIdx}):(l={range:s.selectedRange,sheetIdx:s.sheetIdx,isUndoRedo:!0,isFromUpdateAction:a},t.notify(Br,l),a||(s.previousConditionalFormats=l.oldCFModel,l.updatedCFModel.length?s.conditionalFormats=l.updatedCFModel:delete s.conditionalFormats));break;case"insertImage":!1===r?t.notify(Sl,{id:e.eventArgs.id,sheetIdx:e.eventArgs.sheetIndex+1,range:e.eventArgs.range,preventEventTrigger:!0}):t.notify(xl,{options:{src:e.eventArgs.imageData,height:e.eventArgs.imageHeight,width:e.eventArgs.imageWidth,imageId:e.eventArgs.id},range:e.eventArgs.range,isPublic:!1,isUndoRedo:!0});break;case"deleteImage":!1===r?t.notify(xl,{options:{src:e.eventArgs.imageData,height:e.eventArgs.imageHeight,width:e.eventArgs.imageWidth,imageId:e.eventArgs.id},range:e.eventArgs.address,isPublic:!1,isUndoRedo:!0}):t.notify(Sl,{id:e.eventArgs.id,range:e.eventArgs.address,preventEventTrigger:!0});break;case"imageRefresh":p=document.getElementById(e.eventArgs.id),!1===r?t.notify(yl,{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(yl,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(wl,{id:s.id,range:s.range,isUndoRedo:!0}):(h=[{type:s.type,theme:s.theme,markerSettings:s.markerSettings,isSeriesInRows:s.isSeriesInRows,range:s.range,id:s.id,height:s.height,width:s.width,top:s.top,left:s.left}],t.notify(_r,{chart:h,isUndoRedo:!1,range:s.posRange}));break;case"deleteChart":!1===r?(d=[{type:s.type,theme:s.theme,markerSettings:s.markerSettings,isSeriesInRows:s.isSeriesInRows,range:s.range,id:s.id,height:s.height,width:s.width,top:s.top,left:s.left}],t.notify(_r,{chart:d,isUndoRedo:!1,range:s.posRange})):t.notify(wl,{id:s.id,range:s.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(Il,J.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(Wr,{height:e.eventArgs.prevHeight.toString(),width:e.eventArgs.prevWidth.toString(),overlayEle:l})):(e.eventArgs.isUndoRedo=!0,t.notify(Il,e.eventArgs),t.notify(Wr,{height:e.eventArgs.currentHeight.toString(),width:e.eventArgs.currentWidth.toString(),overlayEle:l}));break;case"chartDesign":t.notify(Ll,e.eventArgs);break;case"autofill":a&&s.undoArgs&&(s.undoArgs.isFromUpdateAction=s.undoArgs.isUndo=s.undoArgs.preventEvt=!0,s.undoArgs.isPublic=!0,t.notify(Sa,s.undoArgs)),t.notify(tn,{fillRange:e.eventArgs.fillRange,dataRange:e.eventArgs.dataRange,fillType:e.eventArgs.fillType,direction:e.eventArgs.direction});break;case"removeValidation":!1!==r&&t.notify(nl,{range:s.range,isCol:s.isColSelected});break;case"addDefinedName":!1===r?t.notify(re,{action:"removeDefinedName",isRemoved:!1,definedName:s.name,scope:s.scope,isEventTrigger:!0}):(p={name:s.name,refersTo:s.refersTo,scope:s.scope,comment:s.comment},t.notify(re,{action:"addDefinedName",isAdded:!1,definedName:p,isEventTrigger:!0}));break;case"hyperlink":t.notify(er,{hyperlink:s.hyperlink,cell:s.address,displayText:s.displayText,triggerEvt:!1}),t.serviceLocator.getService("cell").refreshRange(y(s.address),!1,!1,!1,!1,Td(t));break;case"removeHyperlink":t.notify(ya,{range:s.address,preventEventTrigger:!0});break;case"freezePanes":t.freezePanes(s.row,s.column,s.sheetIndex);break;case"duplicateSheet":Oi(t,s.sheetIndex,null,a);break;case"protectSheet":s.isProtected?t.notify(wr,s):(t.setSheetPropertyOnMute(ne(t,s.sheetIndex),"password",""),t.notify(ja,{isActive:!0,sheetIndex:s.sheetIndex}));break;case"protectWorkbook":s.isProtected?t.notify(Ul,s):t.notify(_l,null);break;case"lockCells":t.notify(Ar,s)}}}function yd(e,t,r,n){for(var i,o=e.sheets[n].ranges,s=0,a=o.length;s<a;s++)if(o[s].template&&(i=Q(o[s].address.length?o[s].address:o[s].startCell))[0]<=t&&i[1]<=r&&i[2]>=t&&i[3]>=r)return!0;return!1}function Cd(e,t,r,n,i,o,s){void 0===s&&(s=!0);var a=gh(t,n,!0),l=e.frozenColCount(t),h=dd(r);(i=i||(t.frozenRows?e.getRow(n,null,l):e.getRow(n)))&&(i.style.height=h+"px"),(o=t.frozenColumns?o||e.getRow(n,null,l-1):(i=e.frozenRowCount(t),o||e.getRow(n,n<i?e.sheetModule.getSelectAllTable():e.getRowHeaderTable())))&&(o.style.height=h+"px"),mh(t,n,r),e.setProperties({sheets:e.sheets},!0),s&&e.notify(Qs,{rowIdx:n,threshold:h-a})}function bd(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||xd(t&&t.fontFamily?t:e.cellStyle))*r;return Math.ceil(.9<i%1?1+i:i)}function xd(e){var t=Vh;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 Sd(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:dd(i.measureText(e).width,!0)}function wd(e,r,n,i){function o(e,t){c&&g++,1<=a/r&&(e.split("").forEach(function(e){d=Sd(e,n,i,!0),r<(h+=d)&&(g++,h=d)}),a=dd(h,!0)),t||s(a),c=a}function s(e){a+=1<=(e+f)/r?0:f}var a,l,h,d,p,t,c=0,u=e.toString().split(" "),f=Sd(" ",n,i),g=0,e=0;return u.forEach(function(t){d=h=0,a=Sd(t,n,i),1<(c+a)/r?1<(l=t.split("-")).length?l.forEach(function(e){d=h=0,p=p||Sd("-",n,i),a=Sd(e,n,i),l[l.length-1]!==e&&(a+=p),1<=(c+a)/r?o(e,l[l.length-1]!==e):(l[l.length-1]===e&&u[u.length-1]!==t&&s(c+a),c+=a)}):o(t,!1):(s(c+a),c+=a)}),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 Id(e,t,r){var n=0,i=ie(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])))),ie(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 Ed(e,t,r,n){return Ih(e,r,n=void 0===n?r:n,!0)-dd(4+(i=ie(n=t,t=r,r=e,null,!(e=0)),n=ie(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 Rd(e,t,r,n,i,o,s){return bd(e,i,o,s)+Id(t,r,n)}function Nd(e,t,r,n){e.maxHgts[t]||(e.maxHgts[t]={}),e.maxHgts[t][r]=n}function Ad(e,t){var r=0,n=e.maxHgts[t];return n&&Object.keys(n).forEach(function(e){n[""+e]>r&&(r=n[""+e])}),r}function ae(e){var t,r;document.activeElement.classList.contains("e-text-findNext-short")||(J.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 kd(e,t){for(var r,n=e.getActiveSheet(),i=J.isNullOrUndefined(t)?te(Q(n.selectedRange)):t,o=i[0];o<=i[2];o++)for(var s=i[1];s<=i[3];s++)if(Vn(ie(o,s,n),se(n,s))){r=!0;break}return r}function Fd(e){return e.includes(" ")}function Od(e,t,r){for(var n,i,o=ne(e,r),s=r===e.activeSheetIndex,a=o.conditionalFormats&&o.conditionalFormats.length&&[].slice.call(o.conditionalFormats),l=[],h=t[0],d=t[2];h<=d;h++)if(!fh(o,h))for(var p=t[1],c=t[3];p<=c;p++){var u,f,g={cellIdx:[h,p],isUnique:!1,uniqueRange:""};e.notify(zt,g),u=!1,""!==g.uniqueRange&&(u="#SPILL!"===ie((f=y(g.uniqueRange))[0],f[1],o).value),g.isUnique&&!u||(f=ie(h,p,o))&&(g={},f.formula&&(g.formula=""),!f.value&&0!==f.value||(g.value=""),f.hyperlink&&(g.hyperlink=""),u={sheet:o,cell:f,rowIdx:h,colIdx:p},(1<f.colSpan||1<f.rowSpan)&&ei(u),n={cell:g,rowIdx:h,colIdx:p,valChange:!0,uiRefresh:s,td:u=e.getCell(u.rowIdx,u.colIdx),cellDelete:!0},Object.keys(g).length)&&!Gn(e,o,n)&&(a&&!(i=i||n.isFormulaDependent)&&$n(a,l,h,p),u)&&(u.querySelector(".e-cf-databar")&&u.removeChild(u.querySelector(".e-cf-databar")),u.querySelector(".e-iconsetspan"))&&u.removeChild(u.querySelector(".e-iconsetspan"))}(l.length||i)&&s&&e.notify(Mr,{cfModel:!i&&l,refreshAll:i,isAction:!0,isEdit:!0})}function Td(e){return e.allowOpen&&e.openModule.preventFormatCheck}function Dd(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+=gh(n,o,!0)))return{index:o,height:r}}function Ld(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+=wh(n,o,null,!0)))return o}function Pd(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 Md(e){for(var t,r,n,i=[],o=e.getActiveSheet().name,s=0,a=e.chartColl.length;s<a;s++)o===xi((n=e.chartColl[s]).range)&&(t={clientY:n.top,isImage:!0},r={clientX:n.left,isImage:!0},e.notify(Cl,t),e.notify(bl,r),i.push({chart:n,chartRowIdx:t.clientY,chartColIdx:r.clientX}));return i}function Bd(e,t){for(var r,n=e.getActiveSheet(),i=J.isNullOrUndefined(t)?te(Q(n.selectedRange)):t,o=i[0];o<=i[2];o++)for(var s=i[1];s<=i[3];s++)if(ni(ie(o,s,n),se(n,s),ch(n,o))){r=!0;break}return r}Hd=function(e,t){return(Hd=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 Hd,Vd,n=function(e,t){function r(){this.constructor=e}Hd(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},hh=function(e,t,r,n){var i,o=arguments.length,s=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;0<=a;a--)(i=e[a])&&(s=(o<3?i(s):3<o?i(t,r,s):i(t,r))||s);return 3<o&&s&&Object.defineProperty(t,r,s),s},Ud=(Vd=J.ChildProperty,n(_d,Vd),hh([J.Property(!1)],_d.prototype,"isFinite",void 0),hh([J.Property(!0)],_d.prototype,"enableVirtualization",void 0),_d);function _d(){return null!==Vd&&Vd.apply(this,arguments)||this}zd=J.ChildProperty,n(jd,zd),hh([J.Property("Multiple")],jd.prototype,"mode",void 0);var zd,n=jd;function jd(){return null!==zd&&zd.apply(this,arguments)||this}l.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(A).getConstant("SelectAll"),type:"button"}}))},l.prototype.updateLeftColGroup=function(e,t){e&&(this.colGroupWidth=e);var r,n,i=(t=t||this.getRowHeaderPanel()).querySelector("table"),o=this.parent.getActiveSheet();e?i.querySelector("colgroup").firstElementChild.style.width=this.colGroupWidth+"px":(r=this.parent.createElement("colgroup"),(n=this.col.cloneNode()).style.width=this.colGroupWidth+"px",r.appendChild(n),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)},l.prototype.setPanelWidth=function(e,t,r){var n,i=this.getScrollSize(!0),o=this.getRowHeaderWidth(e),s=this.parent.enableRtl?"right":"left",e=(r&&(n=this.parent.enableRtl?"left":"right",this.getContentPanel().style[""+n]=this.getColHeaderPanel().style[""+n]=""),e.frozenColumns&&((e=document.getElementById(this.parent.element.id+"_sheet").getElementsByClassName("e-frozen-column")[0]).style.height="calc(100% - "+i+"px)",r&&(e.style[""+n]=""),e.style[s]=o-dd(1)+"Px",e.style.display=""),this.setHeaderPanelWidth(this.getSelectAllContent(),o),this.getColHeaderPanel().style.width="calc(100% - "+o+"px)",this.getColHeaderPanel().style[s]=o+"px",this.setHeaderPanelWidth(t,o),this.getContentPanel().style.width="calc(100% - "+o+"px)",this.getContentPanel().style[s]=o+"px",this.contentPanel.nextElementSibling||null);e&&(i?e.style.height=i+1+"px":(e.style.height="1px",e.style.borderTopWidth="0px"),e=e.firstElementChild,r&&(e.style[""+n]=""),e.style[s]=o+"px",e.style.width="calc(100% - "+o+"px)",-1<J.Browser.userAgent.indexOf("Mac OS"))&&"safari"===J.Browser.info.name&&(e.style.height="7px",e.style.top="-7px")},l.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},l.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"},l.prototype.setPanelHeight=function(e){var t,r,n=this.getScrollSize(!0);e.frozenRows?(t=this.getColHeaderHeight(e),e.showHeaders||e.frozenColumns?this.headerPanel.style.height="":this.headerPanel.style.height=t+"px",this.contentPanel.style.height="calc(100% - "+(t+n)+"px)",(r=document.getElementById(this.parent.element.id+"_sheet").getElementsByClassName("e-frozen-row")[0]).style.width=J.Browser.isDevice?"100%":"calc(100% - "+n+"px)",r.style.top=t-1-(e.showHeaders?1:0)+"px",r.style.display=""):this.contentPanel.style.height="calc(100% - "+((e.showHeaders?dd(31):0)+n)+"px)"},l.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=(this.contentPanel.appendChild(this.parent.createElement("div",{className:"e-row-header",id:t+"_row_header"})),this.initHeaderPanel(),this.parent.allowScrolling&&this.parent.scrollModule.setPadding(),document.getElementById(this.parent.element.id+"_sheet")),t=(e.frozenColumns&&r.classList.add("e-frozen-columns"),e.frozenRows&&r.classList.add("e-frozen-rows"),this.updateHideHeaders(e,r),e.showGridLines||r.classList.add("e-hide-gridlines"),this.contentPanel.appendChild(this.parent.createElement("div",{className:"e-sheet-content",id:t+"_main_content"})));this.parent.allowScrolling||(t.style.overflow="hidden"),e.frozenRows&&r.appendChild(this.parent.createElement("div",{className:"e-frozen-row",styles:"display: none"})),e.frozenColumns&&r.appendChild(this.parent.createElement("div",{className:"e-frozen-column",styles:"display: none"})),-1<J.Browser.userAgent.indexOf("Mac OS")&&"safari"===J.Browser.info.name&&r.classList.add("e-mac-safari")},l.prototype.initHeaderPanel=function(){var e=this.parent.element.id;this.headerPanel=this.parent.createElement("div",{className:"e-header-panel"}),this.headerPanel.appendChild(this.parent.createElement("div",{className:"e-selectall-container",id:e+"_selectall"})),this.headerPanel.appendChild(this.parent.createElement("div",{className:"e-column-header",id:e+"_col_header"}))},l.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)},l.prototype.updateTable=function(e,t,r){var n=this,i=this.parent.createElement("table",{className:"e-table",attrs:{role:"grid"}});i.classList.add("e-"+t+"-table"),r.appendChild(i),e.forEach(function(e){i.appendChild(n.parent.createElement(e))})},l.prototype.renderTable=function(o){var r,n,i,s,a,l=this,h=this.parent.getActiveSheet(),d=document.createDocumentFragment(),p=(d.appendChild(this.headerPanel),d.appendChild(this.contentPanel),this.parent.allowScrolling&&((e=this.parent.createElement("div",{className:"e-scrollbar"})).appendChild(this.parent.createElement("div",{className:"e-scroller"})),d.appendChild(e)),this.createHeaderTable(),this.updateTable(["tbody"],"content",this.contentPanel.lastElementChild),this.parent.createElement("colgroup")),c=this.contentPanel.querySelector(".e-sheet-content tbody"),u=(this.refreshSelectALLContent(),this.getSelectAllContent().querySelector("colgroup")),f=this.getRowHeaderPanel().querySelector("colgroup"),g=this.getSelectAllContent().querySelector("thead .e-header-row"),m=this.contentPanel.querySelector(".e-row-header tbody"),v=this.getSelectAllContent().querySelector("tbody"),e=this.headerPanel.querySelector(".e-column-header thead"),y=this.headerPanel.querySelector(".e-column-header tbody"),C=this.rowRenderer.render(),b=(e.appendChild(C),this.getColHeaderTable().insertBefore(p,e),this.parent.frozenRowCount(h)),x=this.parent.frozenColCount(h),S=K(h,x-1,!1,"columns"),e=(this.parent.notify(xs,{top:o.top,left:o.left}),h.colCount.toString()),t=h.colCount.toString(),w=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),J.attributes(this.parent.getContentTable(),{"aria-rowcount":t,"aria-colcount":e}),o.cells.forEach(function(e,t){(r=Q(t))[1]!==o.indexes[1]&&n||(r[1]===o.indexes[1]&&(i=l.rowRenderer.render(r[0],!0)),x&&b&&r[1]<x&&r[0]<b?((a=v.querySelector(".e-empty"))?v.insertBefore(i,a):v.appendChild(i),n=i):x&&r[1]<x?(m.appendChild(i),n=i):(n=l.rowRenderer.render(r[0]),b&&r[0]<b?(a=y.querySelector(".e-empty"))?y.insertBefore(n,a):y.appendChild(n):c.appendChild(n),r[1]===o.indexes[1]&&(b&&r[0]<b?v:m).appendChild(i)),r[1]===o.indexes[1]&&l.cellRenderer.renderRowHeader(r[0],i)),l.cellRenderer.render({colIdx:r[1],rowIdx:r[0],cell:e,address:t,lastCell:r[1]===o.indexes[3],isHeightCheckNeeded:!0,row:n,hRow:i,pRow:n.previousSibling,pHRow:i.previousSibling,isRefreshing:o.isRefreshing,first:w?w.includes("Row")?r[0]===o.indexes[0]?"Row":w.includes("Column")&&r[1]===o.indexes[1]?"Column":"":r[1]===o.indexes[1]?"Column":"":""}),x&&r[1]===S&&(n=null),r[0]===o.indexes[0]&&(x&&r[1]<x?(s=l.updateCol(h,r[1],u),(e=f.querySelector(".e-empty"))?f.insertBefore(s.cloneNode(!0),e):f.appendChild(s.cloneNode(!0)),l.cellRenderer.renderColHeader(r[1],g)):(l.updateCol(h,r[1],p),l.cellRenderer.renderColHeader(r[1],C)))}),this.parent.isReact&&this.parent.renderReactTemplates(),c.parentElement.insertBefore(p.cloneNode(!0),c),Ph(function(){if(l.parent){var e=l.parent.getMainContent(),t=document.getElementById(l.parent.element.id+"_sheet");if(t.childElementCount&&t.querySelector(".e-header-panel")!==l.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(d),t.style.backgroundColor="",h.conditionalFormats&&h.conditionalFormats.length&&l.parent.notify(Mr,{indexes:o.indexes}),l.checkRowHeightChanged(o,h),o.top&&(e.parentElement.scrollTop=o.top),o.left&&(e.scrollLeft=o.left,l.parent.getColumnHeaderContent().scrollLeft=o.left),l.parent.notify(ds,o),l.checkTableWidth(h),l.parent.notify(us,{action:"renderEditor",initLoad:o.initLoad&&!l.parent.isOpen}),o.initLoad||l.parent.isOpen||l.parent.hideSpinner(),cd(e,{busy:!1}),l.parent.trigger(Vs,{}),l.parent.isEdit&&l.parent.notify(fl,null),o.openOptions&&o.openOptions.eventArgs&&o.openOptions.eventArgs.triggerEvent&&l.parent.trigger("openComplete",{response:o.openOptions}),o.initLoad){var i=!0;if(l.parent.scrollSettings.enableVirtualization)for(n=0;n<h.ranges.length;n++)if(h.ranges[n].info.count-1>l.parent.viewport.bottomIndex){i=!1;break}i?l.parent.isReact?setTimeout(function(){l.parent&&l.triggerCreatedEvent()}):l.triggerCreatedEvent():l.parent.isOpen||l.parent.hideSpinner()}}})},l.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(Xa,null),this.parent.notify(Ra,null))},l.prototype.checkRowHeightChanged=function(e,t){var r={top:e.top,left:e.left,sheet:t};this.parent.notify(eh,r),e.top!==r.top&&(this.parent.scrollModule&&this.parent.scrollModule.offset.top.idx&&r.top-e.top<gh(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<wh(t,this.parent.scrollModule.offset.left.idx)&&(this.parent.scrollModule.offset.left.size=r.left),e.left=r.left)},l.prototype.checkTableWidth=function(e){var t,r;this.parent.scrollSettings.isFinite&&!this.parent.scrollSettings.enableVirtualization&&e.colCount-1===this.parent.viewport.rightIndex&&(t=Ih(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)"))},l.prototype.clearCFResult=function(e){if(e.conditionalFormats&&e.conditionalFormats.length)for(var t=e.conditionalFormats,r=0;r<t.length;r++)delete t[r].result},l.prototype.refreshColumnContent=function(r){function e(){Mh(t=a.getColHeaderTable()),t.appendChild(p),Mh(t=a.getContentTable()),t.appendChild(d),a.parent.notify(ws,{refresh:"Column",prevRowColCnt:r.prevRowColCnt}),h.conditionalFormats&&h.conditionalFormats.length&&a.parent.notify(Mr,{indexes:r.indexes,isRender:!0}),a.parent.isEdit&&a.parent.notify(gl,{}),a.parent.allowChart&&a.parent.notify(Ol,null),a.parent.isOpen||a.parent.hideSpinner(),cd(a.parent.getMainContent(),{busy:!1})}var n,i,t,o,s,a=this,l=0,h=this.parent.getActiveSheet(),d=document.createDocumentFragment(),p=document.createDocumentFragment(),c=this.parent.element.querySelector(".e-sheet-content tbody"),u=this.parent.element.querySelector(".e-column-header tbody"),f=(f=this.parent.element.querySelector(".e-sheet-content colgroup")).cloneNode(),c=(d.appendChild(f),d.appendChild(c.cloneNode(!0))),g=f.cloneNode(),m=(p.appendChild(g),s=this.parent.element.querySelector(".e-column-header thead"),(s=p.appendChild(s.cloneNode(!0))).querySelector("tr")),v=(m.innerText="",this.parent.frozenRowCount(h)),y=this.parent.frozenColCount(h),C=(v&&(u=p.appendChild(u.cloneNode(!0))),K(h,v-1,!1)),b=this.parent.scrollSettings.enableVirtualization&&this.parent.viewport.topIndex!==K(h,0,!0);this.clearCFResult(h),r.cells.forEach(function(e,t){if((n=Q(t))[0]===r.indexes[0]&&(o=a.updateCol(h,n[1],g),f.appendChild(o.cloneNode()),a.cellRenderer.renderColHeader(n[1],m)),n[1]-y===r.indexes[1]){if(!(i=(n[0]<v?u:c).children[l]))return;i.innerText="",l++}i&&(o=a.cellRenderer.render({colIdx:n[1],rowIdx:n[0],cell:e,address:t,row:i,pRow:i.previousSibling,first:r.skipUpdateOnFirst||n[1]!==r.indexes[1]?b&&n[0]===r.indexes[0]?"Row":"":"Column",isRefreshing:!0}),a.checkColMerge(n,r.indexes,o,e),v)&&n[0]===C&&(l=0)});r.insertDelete?e():Ph(function(){e()})},l.prototype.refreshRowContent=function(r){var n,i,o,s,a=this,l=this.colGroupWidth,e=this.parent.getActiveSheet(),t=document.createDocumentFragment(),h=this.parent.createElement("tbody"),d=document.createDocumentFragment(),p=h.cloneNode(),c=(d.appendChild(p),t.appendChild(h),this.parent.frozenColCount(e)),u=K(e,c-1,!1,"columns"),f=this.parent.scrollSettings.enableVirtualization&&this.parent.viewport.leftIndex!==K(e,0,!0,"columns");this.clearCFResult(e),r.cells.forEach(function(e,t){(n=Q(t))[1]!==r.indexes[1]&&i||(n[1]===r.indexes[1]&&(o=a.rowRenderer.render(n[0],!0)),c&&n[1]<c?(p.appendChild(o),i=o):(n[1]===r.indexes[1]&&p.appendChild(o),i=a.rowRenderer.render(n[0]),h.appendChild(i)),n[1]===r.indexes[1]&&(a.cellRenderer.renderRowHeader(n[0],o),l=Bh(n[0]+1))),c&&(o=p.lastElementChild||o),s=a.cellRenderer.render({rowIdx:n[0],colIdx:n[1],cell:e,address:t,lastCell:n[1]===r.indexes[3],row:i,hRow:o,pRow:i.previousSibling,pHRow:o.previousSibling,isHeightCheckNeeded:!0,first:r.skipUpdateOnFirst||n[0]!==r.indexes[0]?f&&n[1]===r.indexes[1]?"Column":"":"Row",isRefreshing:!0}),a.checkRowMerge(n,r.indexes,s,e),c&&n[1]===u&&(i=null)}),this.colGroupWidth!==l&&this.updateLeftColGroup(l),this.contentPanel.querySelector(".e-row-header tbody")&&(J.detach(this.contentPanel.querySelector(".e-row-header tbody")),this.getRowHeaderTable().appendChild(d)),this.contentPanel.querySelector(".e-sheet-content tbody")&&(J.detach(this.contentPanel.querySelector(".e-sheet-content tbody")),this.getContentTable().appendChild(t)),this.parent.notify(ws,{refresh:"Row",prevRowColCnt:r.prevRowColCnt}),e.conditionalFormats&&e.conditionalFormats.length&&this.parent.notify(Mr,{indexes:r.indexes,isRender:!0}),this.parent.allowChart&&this.parent.notify(Ol,{}),this.parent.isEdit&&this.parent.notify(gl,null),this.parent.isOpen||this.parent.hideSpinner(),cd(this.parent.getMainContent(),{busy:!1})},l.prototype.updateCol=function(e,t,r){var n=this.col.cloneNode();return n.style.width=J.formatUnit(wh(e,t,null,!0)),r?(e=r.querySelector(".e-empty"))?r.insertBefore(n,e):r.appendChild(n):n},l.prototype.updateColContent=function(w){var I=this;Ph(function(){var r,n,i,o,s,a,l,h=0,d=I.parent.getActiveSheet(),p=I.parent.element.querySelector(".e-column-header .e-header-row"),c=p.firstElementChild,u=I.parent.element.querySelector(".e-sheet-content colgroup"),f=I.parent.element.querySelector(".e-column-header colgroup"),g=u.firstElementChild,m=f.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=K(d,C-1,!1),S=K(d,w.indexes[0],!0);I.clearCFResult(d),w.cells.forEach(function(e,t){if(!a){if(r=Q(t),"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],ie(r[0],I.parent.viewport.leftIndex+b,d)||{}),r[0]===S&&("last"===w.direction?((s=I.col.cloneNode()).style.width=J.formatUnit(wh(d,r[1],null,!0)),u.insertBefore(s,g),f.insertBefore(s.cloneNode(),m),I.cellRenderer.renderColHeader(r[1],p,c)):(s=I.updateCol(d,r[1],u),f.appendChild(s.cloneNode()),I.cellRenderer.renderColHeader(r[1],p)),I.parent.scrollSettings.enableVirtualization)&&w.direction&&(J.detach(u[w.direction+"ElementChild"]),J.detach(f[w.direction+"ElementChild"]),J.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(a=!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,((r[0]<C?y:v).rows[h-1]||{cells:[]}).cells[1])):o=I.cellRenderer.render(l),I.parent.scrollSettings.enableVirtualization&&w.direction&&J.detach(n[w.direction+"ElementChild"]),C&&r[0]===x&&(h=0)}}),I.parent.notify(ws,{refresh:"Column",prevRowColCnt:w.prevRowColCnt}),d.conditionalFormats&&d.conditionalFormats.length&&I.parent.notify(Mr,{indexes:w.indexes,isRender:!0}),I.parent.allowChart&&I.parent.notify(Ol,null),I.parent.isEdit&&I.parent.notify(gl,{}),I.parent.isOpen||I.parent.hideSpinner(),cd(I.parent.getMainContent(),{busy:!1})})},l.prototype.updateRowContent=function(r){var n,i,o,s,a,l,h,d,p,c,u,f,g,m,v,y,C=this,e=this.parent.getMainContent();""===r.direction&&!e.children.length||(n=this.colGroupWidth,a=this.parent.getActiveSheet(),l=0,h=e.querySelector("tbody"),d=this.parent.getRowHeaderContent().querySelector("tbody"),p=document.createDocumentFragment(),u=document.createDocumentFragment(),this.parent.showSpinner(),f=this.parent.frozenColCount(a),g=this.parent.frozenRowCount(a),v=K(a,r.indexes[1],!0,"columns"),y=K(a,f-1,!1,"columns"),this.clearCFResult(a),r.cells.forEach(function(e,t){c=Q(t),"first"===r.direction&&c[0]===r.indexes[0]&&(void 0===m&&(m=(c[1]<f?d:h).rows[r.indexes[2]-r.indexes[0]+1]||null),C.checkRowMerge([C.parent.viewport.topIndex+g,c[1]],r.indexes,(m||{cells:[]}).cells[c[1]<f?l+1:l],ie(C.parent.viewport.topIndex+g,c[1],a)||{})),c[1]!==v&&i||(c[1]===v&&(o=C.rowRenderer.render(c[0],!0)),f&&c[1]<f?(p.appendChild(o),i=o):(i=C.rowRenderer.render(c[0]),u.appendChild(i),c[1]===v&&p.appendChild(o),C.parent.scrollSettings.enableVirtualization&&r.direction&&J.detach(h[r.direction+"ElementChild"])),c[1]===v&&(C.cellRenderer.renderRowHeader(c[0],o),n=Bh(c[0]+1),C.parent.scrollSettings.enableVirtualization)&&r.direction&&J.detach(d[r.direction+"ElementChild"])),f&&(o=p.lastElementChild||o),s=C.cellRenderer.render({colIdx:c[1],rowIdx:c[2],cell:e,address:t,row:i,lastCell:c[1]===r.indexes[3],pHRow:o.previousSibling,checkNextBorder:"last"===r.direction&&c[2]===r.indexes[2]?"Row":"",pRow:i.previousSibling,isHeightCheckNeeded:"first"===r.direction||""===r.direction,hRow:o,first:"last"!==r.direction||r.skipUpdateOnFirst||c[0]!==r.indexes[0]?"":"Row",isRefreshing:"first"===r.direction}),"last"===r.direction&&h.rows.length&&C.checkRowMerge(c,r.indexes,s,e,(c[1]<f?d:h).rows[0].cells[c[1]<f?l+1:l]),l++,f&&c[1]===y&&(i=null,m=void 0,l=0)}),this.colGroupWidth!==n&&this.updateLeftColGroup(n),"last"===r.direction?(d.insertBefore(p,d.firstElementChild),h.insertBefore(u,h.firstElementChild)):(d.appendChild(p),h.appendChild(u)),this.parent.scrollSettings.enableVirtualization&&this.parent.notify(ws,{refresh:"Row",prevRowColCnt:r.prevRowColCnt}),a.conditionalFormats&&a.conditionalFormats.length&&this.parent.notify(Mr,{indexes:r.indexes,isRender:!0}),this.parent.isEdit&&this.parent.notify(gl,null),this.parent.allowChart&&this.parent.notify(Ol,{}),this.parent.isOpen||this.parent.hideSpinner(),cd(this.parent.getMainContent(),{busy:!1}))},l.prototype.checkRowMerge=function(e,t,r,n,i){if(this.parent.scrollSettings.enableVirtualization&&r&&(!J.isNullOrUndefined(n.rowSpan)||!J.isNullOrUndefined(n.colSpan))){var o=this.parent.frozenRowCount(this.parent.getActiveSheet());if(e[0]===this.parent.viewport.topIndex+o){if(n.rowSpan<0){var r={td:r,rowIdx:e[0],colIdx:e[1],isRow:!0,isFreezePane:!0};if(this.parent.notify(rl,r),r.insideFreezePane)return;this.parent.viewport.topIndex+o>=t[2]&&this.refreshPrevMerge(t[2]+1,e[1])}i&&this.refreshFirstCell(e[0]+(t[2]-t[0])+1,e[1],i)}else 1<n.rowSpan&&(r=t[2]+1,e[0]+n.rowSpan-1>=r)&&e[0]<r&&this.refreshPrevMerge(r,e[1],this.parent.viewport.topIndex+o)}},l.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)},l.prototype.refreshFirstCell=function(e,t,r){var n=ie(e,t,this.parent.getActiveSheet(),!1,!0);(n.rowSpan<0||n.colSpan<0)&&this.cellRenderer.refresh(e,t,null,r)},l.prototype.checkColMerge=function(e,t,r,n,i){if(this.parent.scrollSettings.enableVirtualization&&r&&(!J.isNullOrUndefined(n.rowSpan)||!J.isNullOrUndefined(n.colSpan))){var o=this.parent.frozenColCount(this.parent.getActiveSheet());if(e[1]===this.parent.viewport.leftIndex+o){if(n.colSpan<0){var s,r={td:r,colIdx:e[1],rowIdx:e[0],isFreezePane:!0};if(this.parent.notify(rl,r),r.insideFreezePane)return;this.parent.viewport.leftIndex+o>=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)}i&&this.refreshFirstCell(e[0],e[1]+(t[3]-t[1])+1,i)}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)}},l.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")},l.prototype.showHideHeaders=function(){var t=this,r=this.parent.getActiveSheet();Ph(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")})},l.prototype.updateHideHeaders=function(e,t){e.showHeaders||t.classList.add("e-hide-headers")},l.prototype.rowHeightChanged=function(e){var t;(e.threshold||e.isHideShow)&&(t=this.parent.getActiveSheet(),e.rowIdx<this.parent.frozenRowCount(t))&&this.setPanelHeight(t)},l.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))},l.prototype.getRowHeaderWidth=function(e,t){var r=0;return!t&&e.frozenColumns&&(r=Ih(e,t=W(e.topLeftCell)[1],t+e.frozenColumns-1,!0)),r+=e.showHeaders?dd(this.colGroupWidth):0},l.prototype.getColHeaderHeight=function(e,t){var r=W(e.topLeftCell)[0];return(e.showHeaders&&!t?dd(31):0)+vh(e,r,r+e.frozenRows-1,!0)},l.prototype.getSelectAllContent=function(){return this.headerPanel.getElementsByClassName("e-selectall-container")[0]},l.prototype.getScrollElement=function(){var e;return(e=this.contentPanel?this.contentPanel.parentElement||this.contentPanel.nextElementSibling:e)&&e.querySelector(".e-scroller")},l.prototype.getSelectAllTable=function(){return this.headerPanel.getElementsByClassName("e-selectall-table")[0]},l.prototype.getColHeaderTable=function(){return this.headerPanel.getElementsByClassName("e-colhdr-table")[0]},l.prototype.getRowHeaderTable=function(){return this.contentPanel.getElementsByClassName("e-rowhdr-table")[0]},l.prototype.getContentTable=function(){return this.contentPanel.getElementsByClassName("e-content-table")[0]},l.prototype.getRowHeaderPanel=function(){return this.contentPanel.getElementsByClassName("e-row-header")[0]},l.prototype.getColHeaderPanel=function(){return this.headerPanel.getElementsByClassName("e-column-header")[0]},l.prototype.getContentPanel=function(){return this.contentPanel.getElementsByClassName("e-sheet-content")[0]},l.prototype.addEventListener=function(){this.parent.on(Xa,this.triggerCreatedEvent,this),this.parent.on(Qs,this.rowHeightChanged,this),this.parent.on(ea,this.colWidthChanged,this),this.parent.on(cs,this.removeEventListener,this)},l.prototype.destroy=function(){this.headerPanel&&(Mh(this.headerPanel),this.headerPanel.remove()),this.headerPanel=null,this.contentPanel&&(Mh(this.contentPanel),this.contentPanel.remove()),this.contentPanel=null,this.col&&(Mh(this.col),this.col.remove()),this.col=null,this.rowRenderer=null,this.cellRenderer=null,this.colGroupWidth=null,this.parent=null},l.prototype.removeEventListener=function(){this.parent.off(Xa,this.triggerCreatedEvent),this.parent.off(Qs,this.rowHeightChanged),this.parent.off(ea,this.colWidthChanged),this.parent.off(cs,this.removeEventListener)};var qd=l;function l(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()}Gd.prototype.render=function(e,t,r){var n,i,o,s,a,l=this.element.cloneNode();return void 0===e?l.classList.add("e-header-row"):(l.classList.add("e-row"),n=this.parent.getActiveSheet(),i=(J.attributes(l,{"aria-rowindex":(e+1).toString()}),gh(n,e,!0)),o=(l.style.height=i+"px",gh(n,e)),this.bottomBorderWidth||(a=1,0<window.devicePixelRatio%1&&(a=1+((s=+window.devicePixelRatio%1)?(.5<s?1-s:-1*s)/window.devicePixelRatio:0)),this.bottomBorderWidth=a),o<20&&(l.style.lineHeight=i>this.bottomBorderWidth?i-this.bottomBorderWidth+"px":"0px"),t&&!r&&(o<20&&(a=this.bottomBorderWidth-1+4,l.style.lineHeight=a<=i?i-a+"px":i>this.bottomBorderWidth?i-this.bottomBorderWidth+"px":"0px",l.classList.contains("e-reach-fntsize")||l.classList.add("e-reach-fntsize")),$(n,e+1)&&!$(n,e-1)&&l.classList.add("e-hide-start"),0!==e)&&$(n,e-1)&&!$(n,e+1)&&l.classList.add("e-hide-end")),l},Gd.prototype.refresh=function(e,t,r,n,i){var o,s,a,l,h,d=this,p=this.parent.getActiveSheet();return n?(o=this.render(e,n,i),this.cellRenderer.renderRowHeader(e,o)):(l=function(){for(;s<=a;)Eh(p,s)||d.cellRenderer.render({colIdx:s,rowIdx:e,cell:ie(e,s,p),address:G(e,s),lastCell:s===a,row:o,hRow:r,isHeightCheckNeeded:!0,pRow:t,first:e===d.parent.viewport.topIndex&&K(p,e,!0)!==K(p,0,!0)?"Row":"",skipFormatCheck:Td(d.parent),checkCF:!0}),s++},(h=this.parent.frozenColCount(p))&&(o=r,s=W(p.topLeftCell)[0],a=h-1,l()),o=this.render(e,n,i),s=this.parent.viewport.leftIndex+h,a=this.parent.viewport.rightIndex,l()),o},Gd.prototype.initProps=function(){this.bottomBorderWidth=null},Gd.prototype.destroy=function(){this.parent.off(ra,this.initProps),this.element&&this.element.remove(),this.bottomBorderWidth&&(this.bottomBorderWidth=null),this.parent=null,this.element=null};var Wd=Gd;function Gd(e){this.parent=e,this.element=this.parent.createElement("tr"),this.cellRenderer=e.serviceLocator.getService("cell"),this.parent.on(ra,this.initProps,this)}Xd.prototype.renderColHeader=function(e,t,r){var n=this.th.cloneNode(),i=le(e+1),o=(n.innerText=i,this.parent.getActiveSheet());Eh(o,e+1)&&n.classList.add("e-hide-start"),0!==e&&Eh(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(Aa,{td:n,rowIndex:0,colIndex:e}),J.attributes(n,{"aria-colindex":(e+1).toString(),tabindex:"-1"})},Xd.prototype.renderRowHeader=function(e,t,r){var n=this.element.cloneNode();J.addClass([n],"e-header-cell"),J.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})},Xd.prototype.render=function(e){var t=this.parent.getActiveSheet();if(e.td=this.element.cloneNode(),e.td.className="e-cell",J.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=Td(this.parent),this.update(e),e.checkCF&&e.cell&&t.conditionalFormats&&t.conditionalFormats.length&&this.parent.notify(Mr,{indexes:[e.rowIdx,e.colIdx],cell:e.cell,ele:e.td,isRender:!0}),e.td.classList.contains("e-cell-template")||this.parent.notify(Aa,{td:e.td,rowIndex:e.rowIdx,colIndex:e.colIdx}),e.refChild?e.row.insertBefore(e.td,e.refChild):e.row.appendChild(e.td);var r,n,i,o={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",o),t.rows[e.rowIdx]&&t.rows[e.rowIdx].customHeight||((o.needHeightCheck||o.element&&o.element.children.length)&&((r=o.element.cloneNode(!0)).style.width=wh(t,e.colIdx,!0)+"px",this.tableRow.appendChild(r)),e.lastCell&&this.tableRow.childElementCount&&(r=e.row||this.parent.getRow(e.rowIdx),gh(t,e.rowIdx)<(n=this.getRowHeightOnInit())&&(i=dd(n),r.style.height=i+"px",(e.hRow||this.parent.getRow(e.rowIdx,this.parent.getRowHeaderTable())).style.height=i+"px",mh(t,e.rowIdx,n)),this.tableRow.innerText="")),this.setWrapByValue(t,e),o.element},Xd.prototype.setWrapByValue=function(e,t){t.cell&&J.isNullOrUndefined(t.cell.wrap)&&t.cell.value&&t.cell.value.toString().includes("\n")&&(Mi(t.rowIdx,t.colIdx,e,{wrap:!0},!0),this.parent.notify(nr,{range:[t.rowIdx,t.colIdx,t.rowIdx,t.colIdx],wrap:!0,initial:!0,sheet:e,td:t.td,row:t.row,hRow:t.hRow}))},Xd.prototype.update=function(e){var t=this.parent.getActiveSheet();if((!e.isRefresh||e.cell&&e.cell.template)&&(r=this.processTemplates(e.cell,e.rowIdx,e.colIdx))&&("string"==typeof r?e.td.innerHTML=r:(Mh(e.td),J.append(r,e.td)),e.td.classList.add("e-cell-template")),e.isRefresh){if(e.td.rowSpan&&(this.mergeFreezeRow(t,e.rowIdx,e.colIdx,e.td.rowSpan,e.row,!0),e.td.removeAttribute("rowSpan")),e.td.colSpan&&(this.mergeFreezeCol(t,e.rowIdx,e.colIdx,e.td.colSpan,!0),e.td.removeAttribute("colSpan")),this.checkMerged(e))return;e.cell&&!e.cell.hyperlink&&(r=e.td.querySelector(".e-hyperlink"))&&J.detach(r),e.cell&&0<e.td.children.length&&-1<e.td.children[e.td.childElementCount-1].className.indexOf("e-addNoteIndicator")&&(r=e.td.querySelector(".e-addNoteIndicator"))&&J.detach(r),!e.cell&&e.td.classList.contains("e-wraptext")&&e.td.classList.remove("e-wraptext")}e.cell&&e.cell.formula&&!e.isRandomFormula&&this.calculateFormula(e);var r={value:e.cell&&e.cell.value,type:e.cell&&So(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},n=(e.cell&&this.parent.notify(St,r),this.parent.refreshNode(e.td,{type:r.type,result:r.formattedText,curSymbol:r.curSymbol,isRightAlign:r.isRightAlign,value:r.value||0===r.value?r.value:"",isRowFill:r.isRowFill,rowIndex:e.rowIdx,colIndex:e.colIdx}),{}),r=(e.cell&&(e.cell.style&&(n=e.cell.style.properties?Bi(e.cell.style,!0):e.cell.style),void 0!==r.color&&(n.color=r.color),this.createImageAndChart(e),e.cell.hyperlink&&this.parent.notify(Ca,{cell:e.cell,style:n,td:e.td,rowIdx:e.rowIdx,colIdx:e.colIdx}),1<e.cell.rowSpan&&1<(r=e.rowSpan||e.cell.rowSpan-this.parent.hiddenCount(e.rowIdx,e.rowIdx+(e.cell.rowSpan-1)))&&(e.td.rowSpan=r,this.mergeFreezeRow(t,e.rowIdx,e.colIdx,r,e.row)),1<e.cell.colSpan&&1<(r=e.colSpan||e.cell.colSpan-this.parent.hiddenCount(e.colIdx,e.colIdx+(e.cell.colSpan-1),"columns"))&&(e.td.colSpan=r,this.mergeFreezeCol(t,e.rowIdx,e.colIdx,r)),J.isNullOrUndefined(e.cell.notes)?!J.isNullOrUndefined(e.td)&&0<e.td.children.length&&-1<e.td.children[e.td.childElementCount-1].className.indexOf("e-addNoteIndicator")&&this.parent.notify(ua,{rowIndex:e.rowIdx,columnIndex:e.colIdx}):this.parent.notify(ga,{targetElement:e.td,rowIndex:e.rowIdx,columnIndex:e.colIdx}),e.cell.isNoteEditable)&&this.parent.notify(fa,{rowIndex:e.rowIdx,columnIndex:e.colIdx,isNoteEditable:!0,isScrollWithNote:!0}),e.isRefresh&&J.isNullOrUndefined(e.cell)&&!J.isNullOrUndefined(e.td)&&0<e.td.children.length&&-1<e.td.children[e.td.childElementCount-1].className.indexOf("e-addNoteIndicator")&&this.parent.notify(ua,{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(qr,{cell:e.cell,rIdx:e.rowIdx,cIdx:e.colIdx,sheetIdx:this.parent.activeSheetIndex}),this.applyStyle(e,n),"Row"!==e.checkNextBorder||""===(r=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:r},this.parent.notify(Nt,e)),"Column"!==e.checkNextBorder||""===(n=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:n},this.parent.notify(Nt,e)),e.cell&&!J.isNullOrUndefined(e.cell.wrap)&&this.parent.notify(nr,{range:[e.rowIdx,e.colIdx,e.rowIdx,e.colIdx],wrap:e.cell.wrap,sheet:t,initial:!0,td:e.td,row:e.row,hRow:e.hRow,isCustomHgt:!e.isRefresh&&20<gh(t,e.rowIdx)}),e.cell&&e.cell.validation||t.columns&&t.columns[e.colIdx]&&t.columns[e.colIdx].validation);r&&r.isHighlighted&&this.parent.notify(pr,{range:ee([e.rowIdx,e.colIdx]),td:e.td}),e.cell&&e.cell.validation&&e.cell.validation.isHighlighted&&this.parent.notify(pr,{range:ee([e.rowIdx,e.colIdx]),td:e.td})},Xd.prototype.applyStyle=function(e,t){(Object.keys(t).length||Object.keys(this.parent.commonCellStyle).length||e.lastCell)&&(e.style=J.extend({},this.parent.commonCellStyle,t),this.parent.notify(Nt,e))},Xd.prototype.createImageAndChart=function(e){if(e.cell.chart&&0<e.cell.chart.length&&this.parent.notify(_r,{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(xl,{options:{src:e.cell.image[t].src,imageId: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:ee([e.rowIdx,e.colIdx,e.rowIdx,e.colIdx]),isPublic:!1})},Xd.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():ne(this.parent,e.sheetIndex)).id.toString()};if(this.parent.notify(re,t),t.added)return}else e.formulaRefresh&&(e.cell.value="");t=X(e.cell.formula),t={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};this.parent.notify(re,t),e.cell.value=ie(e.rowIdx,e.colIdx,J.isNullOrUndefined(e.sheetIndex)?this.parent.getActiveSheet():ne(this.parent,e.sheetIndex)).value,e.cell.formula=-1<e.cell.formula.indexOf("^+")||-1<e.cell.formula.indexOf("&+")?t.value:e.cell.formula},Xd.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(Tr,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(tl,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)},Xd.prototype.mergeFreezeRow=function(e,t,r,n,i,o){var s=this.parent.frozenRowCount(e);if(s&&t<s&&s<=t+(n-1)){var a,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-s;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=ie(t,g,e,!1,!0)).rowSpan&&t+f.rowSpan-s>u&&(u=t+f.rowSpan-s);if(u===i)return}else u=i;for(var v=t+(n-1),g=u,m=c.length;g<m;g++)h+=gh(e,v),v--,J.detach(c.pop());this.updateSpanTop(r,d,h,!0),c.length||this.updateColZIndex(r,d,!0)}}else{this.updateColZIndex(r,d);for(g=s,m=t+(n-1);g<=m;g++)h+=-(a=gh(e,K(e,g,!0),!0)),s+c.length>g||((l=p.cloneNode()).classList.add("e-empty"),l.style.visibility="hidden",l.style.height=a+"px",p.parentElement.appendChild(l));this.updateSpanTop(r,d,h)}}},Xd.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")},Xd.prototype.mergeFreezeCol=function(e,t,r,n,i){var o=this.parent.frozenColCount(e);if(o&&r<o&&o<=r+(n-1)){var s,a=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=ie(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++)J.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||((a=h.childNodes[0].cloneNode()).classList.add("e-empty"),a.style.visibility="hidden",s=wh(e,K(e,f,!0,"columns"),null,!0),a.style.width=s+"px",h.appendChild(a),f===u&&this.parent.serviceLocator.getService("sheet").setPanelWidth(e,this.parent.getRowHeaderContent()))}}},Xd.prototype.updateColZIndex=function(e,t,r){e<t?this.updateSelectAllZIndex(r):(this.parent.getColumnHeaderContent().style.zIndex=r?"":"2",this.updatedHeaderZIndex(r))},Xd.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"},Xd.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"))},Xd.prototype.updateRowZIndex=function(e,t,r){e<t?this.updateSelectAllZIndex(r):(this.parent.getRowHeaderContent().style.zIndex=r?"":"2",this.updatedHeaderZIndex(r))},Xd.prototype.processTemplates=function(e,t,r){for(var n,i=this.parent.getActiveSheet(),o=i.ranges,s=0,a=o.length;s<a;s++)if(o[s].template&&(n=Q(o[s].address.length?o[s].address:o[s].startCell))[0]<=t&&n[1]<=r&&n[2]>=t&&n[3]>=r){if(e)return this.compileCellTemplate(o[s].template,Object.assign({rowIndex:t,colIndex:r},e));if(!ie(t,r,i,!0))return this.compileCellTemplate(o[s].template,Object.assign({rowIndex:t,colIndex:r},ie(t,r,i,null,!0)))}return""},Xd.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=J.compile(r),!this.parent.isVue||this.isSelector(e)?r(t,this.parent,"ranges","",!0)[0].outerHTML:r(t,this.parent,"ranges","")):(e=(r=J.compile(e))(t,this.parent,"ranges",""))[0]?e:[e]},Xd.prototype.isSelector=function(e){try{return!!document.querySelector(e)}catch(e){return!1}},Xd.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),Math.round(this.tableRow.getBoundingClientRect().height));return this.parent.element.removeChild(e),t<20?20:t},Xd.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,s=this.parent.getCell(e-1,r),a=(s&&s.style.borderBottom&&(a=Number(s.parentElement.getAttribute("aria-rowindex"))-1,(n=this.parent.getCellStyleValue(["borderBottom","border"],[a,r])).borderBottom||n.border||(s.style.borderBottom="")),t.previousElementSibling);a&&a.style.borderRight&&(r=Number(a.getAttribute("aria-colindex"))-1,(n=this.parent.getCellStyleValue(["borderRight","border"],[e,r])).borderRight||n.border||(a.style.borderRight=""))},Xd.prototype.refreshRange=function(e,t,r,n,i,o,s){var a,l,h=this.parent.getActiveSheet(),d=e.slice();if(qh(this.parent,d,!0))for(var p=d[0];p<=d[2];p++)if(!$(h,p))for(var c=d[1];c<=d[3];c++)Eh(h,c)||(l=this.parent.getCell(p,c))&&(a={rowIdx:p,colIdx:c,td:l,cell:ie(p,c,h),isRefreshing:t,lastCell:c===d[3],isRefresh:!0,isHeightCheckNeeded:!0,manualUpdate:!0,first:"",onActionUpdate:n,skipFormatCheck:o},s&&(a.address=G(p,c)),this.update(a),i&&h.conditionalFormats&&h.conditionalFormats.length&&this.parent.notify(Mr,{indexes:[p,c],isAction:!0}),this.parent.notify(Aa,{td:l,rowIndex:p,colIndex:c}),r)&&this.setWrapByValue(h,a)},Xd.prototype.refresh=function(e,t,r,n,i,o,s,a){var l=this.parent.getActiveSheet();(n||!$(l,e)&&!Eh(l,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:ie(e,t,l),isRefresh:!0,lastCell:r,isHeightCheckNeeded:!0,manualUpdate:!0,first:"",skipFormatCheck:s,isRandomFormula:a},this.update(r),i&&l.conditionalFormats&&l.conditionalFormats.length&&this.parent.notify(Mr,{indexes:[e,t],isAction:!0}),this.parent.notify(Aa,{td:n,rowIndex:e,colIndex:t}),o)&&this.setWrapByValue(l,r)},Xd.prototype.updateView=function(e){var t,r,n;J.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=Q(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:ie(e.indexes[0],e.indexes[1],ne(this.parent,e.sheetIndex),!0,!0),rowIdx:e.indexes[0],colIdx:e.indexes[1],sheetIndex:e.sheetIndex})},Xd.prototype.destroy=function(){this.parent.off(hn,this.updateView),this.parent.off("calculateFormula",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 Yd=Xd;function Xd(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("calculateFormula",this.calculateFormula,this)}$d.prototype.render=function(){this.parent.setProperties({activeSheetIndex:this.parent.skipHiddenSheets(this.parent.activeSheetIndex)},!0),this.parent.isMobileView()||(this.parent.notify(os,null),this.parent.notify(ss,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(as,null):(this.parent.notify(re,{action:"initSheetInfo"}),this.parent.notify(re,{action:"initiateDefinedNames"})),this.parent.isMobileView()&&(this.parent.notify(ss,null),this.parent.notify(os,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)},$d.prototype.checkTopLeftCell=function(e,t,r,n,i,o){var s,a,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),s=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=vh(h,0,p[0]-1,!0):this.parent.viewport.beforeFreezeHeight=0,p[1]&&c[1]>p[1]?this.parent.viewport.beforeFreezeWidth=Ih(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),s&&(this.parent.viewport.topIndex=K(h,c,!0)-c,this.parent.viewport.leftIndex=K(h,u,!0,"columns")-u)):(d=h.paneTopLeftCell===h.topLeftCell?p:W(h.paneTopLeftCell),(a={preventScroll:!0}).scrollTop=r||(d[0]>c?vh(h,c,d[0]-1,!0):0),a.scrollLeft=n||(d[1]>u?Ih(h,u,d[1]-1,!0):0),this.parent.notify(ta,a),r=this.parent.getThreshold("row"),n=h.frozenRows?p[0]:p[0]>r?K(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?K(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:a.scrollTop,left:a.scrollLeft,frozenIndexes:l},null,e,t,i,o),s&&(c&&c<=l[0]&&(this.parent.viewport.topIndex=K(h,l[0],!0)-c),u)&&u<=l[1]&&(this.parent.viewport.leftIndex=K(h,l[1],!0,"columns")-u))},$d.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()},$d.prototype.refreshUI=function(i,o,s,a,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=ki(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=K(C,r,!1),u[0]+e>K(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(Ql,{height:vh(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=K(C,n+e,!0)-e:n=i.rowIndex=e?K(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=K(C,r,!1,"columns"),u[0]+t>K(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(Ql,{width:Ih(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=K(C,g+t,!0,"columns")-t:g=i.colIndex=t?K(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(J.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(Us,{}),this.parent.isOpen||this.parent.refreshing),w=(cd(this.parent.getMainContent(),{busy:!0}),this.parent.sheets.length);ai(this.parent,b+"!"+o,null,null,i.frozenIndexes).then(function(e){if(v.parent&&!(w<v.parent.sheets.length)){var t=v.parent.sheets.indexOf(C);if(l||-1!==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:s,isRefreshing:a,isOpen:S,openOptions:h});break;case"Row":y.refreshRowContent({cells:e,indexes:n,skipUpdateOnFirst:i.skipUpdateOnFirst,prevRowColCnt:x}),v.parent.notify(hs,r={isEdit:!1}),r.isEdit&&v.parent.notify(us,{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(Ss,{refresh:i.refresh,skipTranslate:i.skipTranslate})},$d.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=vh(e.sheet,t,n[0]-1,!0))):(e.rowIndex&&(e.rowIndex=0),0!==r[0]&&(e.top=vh(e.sheet,0,r[0]-1,!0))),e.sheet.frozenColumns?(t=this.parent.frozenColCount(e.sheet),n[1]>t&&(e.left=Ih(e.sheet,t,n[1]-1,!0))):(e.colIndex&&(e.colIndex=0),0!==r[1]&&(e.left=Ih(e.sheet,0,r[1]-1,!0)))},$d.prototype.removeSheet=function(){document.getElementById(this.parent.element.id+"_sheet")&&J.remove(document.getElementById(this.parent.element.id+"_sheet"))},$d.prototype.refreshSheet=function(e,t,r,n,i){var o=0,s=0;t&&((t=this.parent.element.getElementsByClassName("e-main-panel")[0])&&(o=t.scrollTop),t=this.parent.getMainContent())&&(s=t.scrollLeft),this.removeSheet(),this.renderSheet(),this.parent.notify(ra,{}),this.checkTopLeftCell(!1,e,o,s,n,i),r&&ae(this.parent.element)},$d.prototype.setSheetPanelSize=function(e){var t,r=document.getElementById(this.parent.element.id+"_sheet_panel"),n=this.parent.element.getBoundingClientRect();"auto"===this.parent.height?(r.style.height="260px",t=230):(t=n.height-zh(r),r.style.height=t+"px",t-=32),void 0!==e&&(this.colMinWidth=e),this.parent.viewport.height=t,this.parent.viewport.width=n.width-32,this.parent.viewport.rowCount=this.roundValue(t,20),this.parent.viewport.colCount=this.roundValue(n.width,this.colMinWidth||64)},$d.prototype.roundValue=function(e,t){e/=t,t=Math.round(e);return Math.abs(e-t)<.5?t:t-1},$d.prototype.moveOrDuplicateSheetHandler=function(e){this.parent.notify(ls,null),e.refresh&&this.refreshSheet(e.isDuplicate)},$d.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=K(i,r,!0,n);break}return e-r},$d.prototype.instantiateRenderer=function(){this.parent.serviceLocator.register("cell",new Yd(this.parent)),this.parent.serviceLocator.register("row",new Wd(this.parent)),this.parent.serviceLocator.register("sheet",new qd(this.parent))},$d.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},$d.prototype.addEventListener=function(){this.parent.on(cs,this.destroy,this),this.parent.on(en,this.moveOrDuplicateSheetHandler,this),this.parent.on(eh,this.updateTopLeftScrollPosition,this)},$d.prototype.removeEventListener=function(){this.parent.off(cs,this.destroy),this.parent.off(en,this.moveOrDuplicateSheetHandler),this.parent.off(eh,this.updateTopLeftScrollPosition)};var Kd=$d;function $d(e){this.parent=e,this.addEventListener(),this.instantiateRenderer()}var Zd=function(o,s,a,l){return new(a=a||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 a(function(e){e(t.value)}).then(r,n)}i((l=l.apply(o,s||[])).next())})},Jd=function(n,i){var o,s,a,l={label:0,sent:function(){if(1&a[0])throw a[1];return a[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,s&&(a=2&t[0]?s.return:t[0]?s.throw||((a=s.return)&&a.call(s),0):s.next)&&!(a=a.call(s,t[1])).done)return a;switch(s=0,(t=a?[2&t[0],a.value]:t)[0]){case 0:case 1:a=t;break;case 4:return l.label++,{value:t[1],done:!1};case 5:l.label++,s=t[1],t=[0];continue;case 7:t=l.ops.pop(),l.trys.pop();continue;default:if(!(a=0<(a=l.trys).length&&a[a.length-1])&&(6===t[0]||2===t[0])){l=0;continue}if(3===t[0]&&(!a||t[1]>a[0]&&t[1]<a[3]))l.label=t[1];else if(6===t[0]&&l.label<a[1])l.label=a[1],a=t;else{if(!(a&&l.label<a[2])){a[2]&&l.ops.pop(),l.trys.pop();continue}l.label=a[2],l.ops.push(t)}}t=i.call(n,l)}catch(e){t=[6,e],s=0}finally{o=a=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}}},Qd=(ep.prototype.init=function(){this.parent.element.appendChild(this.parent.createElement("input",{className:"e-clipboard",attrs:{contenteditable:"true",tabindex:"-1","aria-hidden":"true"}}))},ep.prototype.addEventListener=function(){var e=this.getClipboardEle();this.parent.on(Ps,this.cut,this),this.parent.on(Ms,this.copy,this),this.parent.on(Bs,this.paste,this),this.parent.on(Hs,this.clearCopiedInfo,this),this.parent.on(Ts,this.tabSwitchHandler,this),this.parent.on(Rs,this.cMenuBeforeOpenHandler,this),this.parent.on(Fs,this.ribbonClickHandler,this),this.parent.on(ds,this.initCopyIndicator,this),this.parent.on(Qs,this.rowHeightChanged,this),this.parent.on(ea,this.colWidthChanged,this),this.parent.on(ln,this.refreshOnInsertDelete,this),J.EventHandler.add(e,"cut",this.cut,this),J.EventHandler.add(e,"copy",this.copy,this),J.EventHandler.add(e,"paste",this.paste,this)},ep.prototype.removeEventListener=function(){var e=this.getClipboardEle();this.parent.isDestroyed||(this.parent.off(Ps,this.cut),this.parent.off(Ms,this.copy),this.parent.off(Bs,this.paste),this.parent.off(Hs,this.clearCopiedInfo),this.parent.off(Ts,this.tabSwitchHandler),this.parent.off(Rs,this.cMenuBeforeOpenHandler),this.parent.off(Fs,this.ribbonClickHandler),this.parent.off(ds,this.initCopyIndicator),this.parent.off(Qs,this.rowHeightChanged),this.parent.off(ea,this.colWidthChanged),this.parent.off(ln,this.refreshOnInsertDelete)),J.EventHandler.remove(e,"cut",this.cut),J.EventHandler.remove(e,"copy",this.copy),J.EventHandler.remove(e,"paste",this.paste)},ep.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})}},ep.prototype.tabSwitchHandler=function(e){0!==e.activeTab||this.copiedInfo||this.copiedShapeInfo||this.hidePaste()},ep.prototype.cMenuBeforeOpenHandler=function(e){var t=this.parent.getActiveSheet(),r=this.parent.serviceLocator.getService(A),n=W(t.activeCell),i=ie(n[0],n[1],t),o=t.isProtected&&Vn(i,se(t,n[1])),i=ni(i,se(t,n[1]),ch(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&&(o?this.parent.enableContextMenuItems([r.getConstant("Cut"),r.getConstant("Filter"),r.getConstant("Sort"),r.getConstant("Hyperlink"),r.getConstant("AddNote"),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))},ep.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":Pn(this.copiedInfo.range,e.rowIdx,this.copiedInfo.range[1])&&(t.style.height=parseFloat(t.style.height)+e.threshold+"px"))},ep.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":Pn(this.copiedInfo.range,this.copiedInfo.range[0],e.colIdx)&&(t.style.width=parseFloat(t.style.width)+e.threshold+"px"))},ep.prototype.cut=function(e){this.setCopiedInfo(e,!0)},ep.prototype.copy=function(e){this.setCopiedInfo(e,!1)},ep.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=ne(this.parent,i),s=te(e&&e.range||Q(o.selectedRange)),a=void 0,l=void 0;if(r){if(l=(a=this.getExternalCells(e)).model,!e.isInternal&&a.internal&&(r=!1,!this.copiedInfo))return;if(!l||!l.length){if(a.file)return void this.parent.notify(ml,{file:a.file});if(!this.copiedInfo)return;r=!1}}var h=Object.assign({isExternal:r},this.copiedInfo),d=void 0,B=void 0,p=void 0,H=void 0,c=void 0,u=void 0,f=void 0,g=void 0,m=void 0,v=(r?(f=ne(this.parent,B=i),p={},c="Sheet"!==(u=a.selection)&&(s[2]-s[0]+1)%a.rowCount==0&&(s[3]-s[1]+1)%a.colCount==0,d=[0,0,a.usedRowIndex,a.usedColIndex]):(B=n,p=se(o,(d=te(this.copiedShapeInfo?Q(o.selectedRange):this.copiedInfo.range))[1]),H=he(d)&&this.isRangeMerged(s,o),f=ne(this.parent,B),c=!H&&(s[2]-s[0]+1)%(d[2]-d[0]+1)==0&&(s[3]-s[1]+1)%(d[3]-d[1]+1)==0,f&&(g=0===d[1]&&d[3]===f.colCount-1,m=0===d[0]&&d[2]===f.rowCount-1,g?(m?(u="Sheet",d[2]=f.usedRange.rowIndex):u="Row",d[3]=f.usedRange.colIndex):m&&(u="Column",d[2]=f.usedRange.rowIndex))),t=c?s:[s[0],s[1]].concat([s[0]+d[2]-d[0],s[1]+d[3]-d[1]||s[1]]),u&&(("Sheet"===u||"Column"===u)&&t[2]<o.usedRange.rowIndex&&(t[2]=o.usedRange.rowIndex),"Sheet"===u||"Row"===u)&&t[3]<o.usedRange.colIndex&&(t[3]=o.usedRange.colIndex),e&&e.type||"All");if(Bd(this.parent,t))this.parent.notify($a,null);else{if(e.isAction&&!this.copiedShapeInfo){var y={requestType:"paste",copiedInfo:this.copiedInfo,copiedRange:ee(d),pastedRange:ee(t),type:v,cancel:!1};if(this.parent.notify(gt,{eventArgs:y,action:"clipboard"}),y.cancel)return;s=Q(y.pastedRange),t=(c=r?"Sheet"!==a.selection&&(s[2]-s[0]+1)%a.rowCount==0&&(s[3]-s[1]+1)%a.colCount==0:!H&&!g&&(s[2]-s[0]+1)%(d[2]-d[0]+1)==0&&!m&&(s[3]-s[1]+1)%(d[3]-d[1]+1)==0)?s:[s[0],s[1]].concat([s[0]+d[2]-d[0],s[1]+d[3]-d[1]||s[1]]),v=y.type}var a=void 0,C=(u?(a=[].concat(t),"Sheet"!==u&&"Column"!==u||(t[2]<o.usedRange.rowIndex&&(t[2]=o.usedRange.rowIndex),d[2]<o.usedRange.rowIndex&&(d[2]+=o.usedRange.rowIndex-d[2]),a[2]<o.rowCount&&(a[2]=o.rowCount-1)),"Sheet"!==u&&"Row"!==u||(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]),a[3]<o.colCount&&(a[3]=o.colCount-1))):a=t,void 0),V=void 0,b=void 0,x=s[0],U=[];if(o.isProtected&&kd(this.parent,t))this.parent.notify(Ka,null);else if(this.copiedShapeInfo&&!this.copiedInfo){y=this.copiedShapeInfo.pictureElem,y=(y.classList.contains("e-datavisualization-chart")?(this.copiedShapeInfo.chartInfo.top=null,this.copiedShapeInfo.chartInfo.left=null,this.parent.notify(_r,{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(xl,{options:{src:y.style.backgroundImage.replace(/url\((['"])?(.*?)\1\)/gi,"$2"),height:this.copiedShapeInfo.height,width:this.copiedShapeInfo.width,imageId:this.copiedShapeInfo.isCut?y.id:""},range:ee([x,s[1],x,s[1]]),isPublic:!1,isUndoRedo:!0}),ie(x,s[1],o));y&&!J.isNullOrUndefined(y.image)&&0<y.image.length&&(P={requestType:"imagePaste",copiedShapeInfo:this.copiedShapeInfo,pasteSheetIndex:this.parent.activeSheetIndex,pastedRange:ki(this.parent)+"!"+ee([x,s[1],x,s[1]]),pastedPictureElement:document.getElementById(y.image[y.image.length-1].id)},this.parent.notify(oe,{eventArgs:P,action:"clipboard"}))}else{for(var S=[],w=this.isInRange(d,s,n),_=!1,z=!1,I=0,E=[],R=(c||"Values"===v||this.setCF(d,t,f,o,E),void 0),j=!1,q=[],y={sheet:o,isExternal:!!r},W=this.setCell(y),G=!r&&this.copiedInfo.isCut&&this.setCell({sheet:f}),N=d[0],A=0;N<=d[2];N++,A++)if(r||h.isCut||!fh(f,N)){w&&(S[s[0]+A]={cells:[]});for(var Y,k=d[1],F=0;k<=d[3];k++,F++){if(w&&(S[s[0]+A].cells[s[1]+F]=ie(s[0]+A,s[1]+F,f,!1,!0)),C=r?l[N]&&l[N].cells[k]||{}:J.extend({},w&&S[N]&&S[N].cells[k]?S[N].cells[k]:ie(N,k,f),null,!0),p=se(o,k),!C.validation&&p.validation&&(C.validation=p.validation),C&&C.isReadOnly&&delete C.isReadOnly,(g||m)&&(C&&C.rowSpan&&(0<C.rowSpan?C.rowSpan+N-1<=d[2]?_=!0:C={}:(!_||C.rowSpan<0&&(Y=C.rowSpan,L=C.colSpan||0,Y=ie(x+Y,s[1]+F+L,o))&&!Y.rowSpan)&&(C={})),C)&&C.colSpan&&(0<C.colSpan?C.colSpan+k-1<=d[3]?z=!0:C={}:z||(C={})),C&&v){var X=void 0;switch(v){case"Formats":X={format:C.format,style:C.style},this.copiedInfo&&!this.copiedInfo.isCut&&(C.rowSpan&&(X.rowSpan=C.rowSpan),C.colSpan)&&(X.colSpan=C.colSpan),C=X;break;case"Values":(C={value:C.value}).value&&-1<C.value.toString().indexOf("\n")&&this.parent.getCell(s[0],s[1]).classList.add("e-alt-unwrap")}V=-1<["Formats","Values"].indexOf(v)}if(!this.parent.scrollSettings.isFinite&&(d[2]-d[0]>1048575-s[0]||d[3]-d[1]>16383-s[1])||this.parent.scrollSettings.isFinite&&(d[2]-d[0]>o.rowCount-1-s[0]||d[3]-d[1]>o.colCount-1-s[1]))return void this.showDialog();if(c){for(var O=s[0];O<=s[2];O+=d[2]-d[0]+1)if(h.isCut||I||!fh(o,O+A))for(var T=s[1];T<=s[3];T+=d[3]-d[1]+1){if(N!==d[0]||k!==d[1]||void 0!==R&&!R.length||"Values"===v||(R=this.setCF(d,[O,T,O+(d[2]-d[0]),T+(d[3]-d[1])],f,o,E,R)),b=ie(O+A,T+F,o,!1,!0),!(r||J.isNullOrUndefined(b.colSpan)&&J.isNullOrUndefined(b.rowSpan))){if(g||m)continue;var D={range:[O+A,T+F,O+A,T+F],merge:!1,isAction:!1,type:"All",sheetIndex:i,preventRefresh:i!==this.parent.activeSheetIndex};U.push(D),this.parent.notify(kr,D)}var D=T+F,K=(C=J.extend({},C||{},null,!0),!V&&this.copiedInfo&&!this.copiedInfo.isCut&&C.formula&&(K=jn([O+A,D],[N,k],f,this.parent,w?C:null),J.isNullOrUndefined(K)||(C.formula=K)),o.isProtected&&C&&!1!==C.isLocked&&(C.isLocked=b.isLocked),b&&b.formula&&-1<b.formula.indexOf("=UNIQUE(")&&this.parent.notify(_t,null),{cellIdx:[N,k],isUnique:!1,uniqueRange:"",sheetName:f.name});this.parent.notify(zt,K),K.isUnique&&(C.value=null),j=!1,C&&C.formula&&-1<C.formula.indexOf("=UNIQUE(")&&(j=!0,q.push([O,D]),C.value=null),W(O+A,D,C,D===s[3],V,j)||C.formula&&this.copiedInfo&&this.copiedInfo.isCut&&this.parent.notify(qt,{cellRef:ee([N,k,N,k])})}}else!r&&yd(this.parent,N,k,n)||(H?W(x,s[1]+F,{value:C.value},k===d[3],!0):W(x,s[1]+F,C,k===d[3],V));if(!r&&this.copiedInfo.isCut&&(!Pn(s,N,k)||n!==this.parent.activeSheetIndex)){var L=ie(N,k,f);if(L){if(L.isReadOnly)continue;if(L.isLocked||J.isNullOrUndefined(L.isLocked)){if((g||m)&&(void 0!==L.rowSpan||void 0!==L.colSpan)){if(!(1<L.rowSpan||1<L.colSpan))continue;this.parent.notify(kr,{merge:!1,range:[N,k,N,k],type:"All"})}L=null}else!1===L.isLocked&&(L=f.isProtected?{isLocked:!1}:null)}G(N,k,L,k===d[3])}}x++}else A--,I++;if(q.length)for(N=0;N<q.length;N++)this.parent.serviceLocator.getService("cell").refresh(q[N][0],q[N][1]);y.isRandFormula&&this.parent.notify(re,{action:"refreshRandomFormula"}),this.parent.notify(jr,null);var P,y=t[2]-I,$=a[2]-I,y=(t[2]=y,a[2]=$,this.parent.setUsedRange(t[2],t[3]),ee(a)),$=(i!==this.parent.activeSheetIndex||e.isFromUpdateAction||this.parent.notify(Ds,{address:y}),!r&&this.copiedInfo.isCut&&(M=this.copiedInfo.isCut,n===this.parent.activeSheetIndex&&this.parent.serviceLocator.getService("cell").refreshRange(d),this.clearCopiedInfo()),(r||w)&&this.copiedInfo&&this.clearCopiedInfo(),void 0),a=(M&&(R&&R.length&&"Values"!==v&&this.parent.notify(Br,$={range:d,sheetIdx:B,isClear:!0}),Nd(f,d[0],d[1],(this.parent.getRow(d[0],null,this.parent.frozenColCount(f))||{offsetHeight:20}).offsetHeight),Z=Ad(f,d[0]),Cd(this.parent,f,Z,d[0])),E.length&&i===this.parent.activeSheetIndex&&this.parent.notify(Mr,{cfModel:E,isAction:!0}),ne(this.parent,n));if(!r&&d[0]===d[2]&&"Row"===u){for(var Z=a.rows[d[0]].height,N=s[0];N<=s[2];N++)Cd(this.parent,this.parent.getActiveSheet(),Z,N);M&&Cd(this.parent,a,20,d[0])}e.isAction&&(P={requestType:"paste",copiedInfo:h,mergeCollection:U,pasteSheetIndex:this.parent.activeSheetIndex,copiedRange:f.name+"!"+(h.range?ee(h.range):f.selectedRange),pastedRange:o.name+"!"+ee(t),type:v||"All",selectedRange:y},I&&(P.skipFilterCheck=!0),$&&$.cfClearActionArgs&&(P.cfClearActionArgs=$.cfClearActionArgs),E.length&&(P.cfActionArgs={cfModel:E,sheetIdx:i}),this.parent.notify(oe,{eventArgs:P,action:"clipboard"})),e.focus&&ae(this.parent.element)}}}else this.getClipboardEle().select()}},ep.prototype.setCF=function(t,r,e,n,i,o){function s(e){a=[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:ee(a),type:e.type,cFColor:e.cFColor,value:e.value,format:e.format},n.conditionalFormats.push(e),i.push(e)}var a,l,h=this;if(o)for(var d=0,p=o.length;d<p;d++)l=Q(o[d].range),s(o[d]);else if(o=[],e.conditionalFormats)for(d=0,p=e.conditionalFormats.length;d<p;d++)l=Q(e.conditionalFormats[d].range),Zn([t],e.conditionalFormats[d].range)&&(o.push(e.conditionalFormats[d]),s(e.conditionalFormats[d]));return o},ep.prototype.isRangeMerged=function(e,t){var t=ie(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(Tr,t),t.range[0]===e[0])&&t.range[1]===e[1]&&t.range[2]===e[2]&&t.range[3]===e[3]},ep.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===bi(this.parent,e.sId)&&(i=e.range,n=Q(this.parent.filterCollection[o].filterRange),i=te(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 s=this.parent.getCell(e.range[0],e.range[1]),a=(s=s&&(s.querySelector(".e-filter-icon")?s:this.parent.getCell(e.range[2],e.range[3])))&&s.querySelector(".e-sortasc-filter"),l=s&&s.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?bi(this.parent,e.sId):this.parent.activeSheetIndex;p.sheetIndex===c&&this.parent.notify(Na,{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(Na,{predicates:null,range:ee(d),sIdx:null,isCut:!0}),e.range[3]===e.range[1])&&(p=this.parent.getCell(t[0],t[1]),a&&p&&p.querySelector(".e-filter-icon").classList.add("e-sortasc-filter"),l)&&p&&p.querySelector(".e-filter-icon").classList.add("e-sortdesc-filter")}},ep.prototype.isInRange=function(e,t,r){var n=this.parent.activeSheetIndex;return Pn(e,t[0],t[1])&&r===n||Pn(e,t[2],t[3])&&r===n},ep.prototype.setCell=function(s){var a=this,l=s.sheet,h=l.name===this.parent.getActiveSheet().name;return function(e,t,r,n,i,o){r&&r.formula&&(-1<r.formula.indexOf("RANDBETWEEN(")||-1<r.formula.indexOf("RAND(")||-1<r.formula.indexOf("NOW("))&&(s.isRandFormula=!0);i=Gn(a.parent,l,{cell:r,rowIdx:e,colIdx:t,pvtExtend:!i,valChange:!o,lastCell:n,uiRefresh:h,requestType:"paste",skipFormatCheck:!s.isExternal,isRandomFormula:s.isRandFormula});return!i&&r&&(r.validation&&(o=G(e,t),a.parent.dataValidationRange+=o+":"+o+","),r.style)&&s.isExternal&&(n=Rd(a.parent,e,t,l,r.style||a.parent.cellStyle,r.wrap?wd(a.parent.getDisplayText(r),Ed(l,e,t),r.style,a.parent.cellStyle):1),n=Math.round(n),Nd(l,e,t,n=n<20?20:n),vh(l,e)<(o=Ad(l,e)))&&Cd(a.parent,l,o,e),i}},ep.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},ep.prototype.setCopiedInfo=function(r,n){var i=this;if(!this.parent.isEdit){var e,o=new V.Deferred,s=(r.promise=o.promise,this.parent.getActiveSheet()),a=r&&r.range?(t=0===r.range[1]&&r.range[3]===s.colCount-1,l=0===r.range[0]&&r.range[2]===s.rowCount-1,e={range:r.range},t||l||this.parent.notify(Or,e),e.range):Q(s.selectedRange);if(n&&Bd(this.parent,a))this.parent.notify($a,null);else{if(r&&!r.isPublic&&!r.clipboardData){var t={copiedRange:s.name+"!"+ee(a),cancel:!1,action:n?"cut":"copy"};if(this.parent.notify(gt,t),t.cancel)return}var l={sheet:s,indexes:[0,0,s.rowCount-1,s.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;!s.isLocalData||r&&r.clipboardData||0!==a[0]||a[2]!==s.rowCount-1||d||(this.parent.showSpinner(),this.parent.notify("updateSheetFromDataSource",l)),this.checkForUncalculatedFormula(a,r&&r.sId?r.sId:s.id),l.promise.then(function(){var e,t;0<d?(t={clientY:h[0].offsetTop,isImage:!0},i.parent.notify(Cl,t),e={clientX:h[0].offsetLeft,isImage:!0},i.parent.notify(bl,e),i.copiedShapeInfo={sId:r&&r.sId?r.sId:s.id,sheetIdx:s.index,isCut:n,pictureElem:h[0],copiedRange:ee([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(Sl,{id:i.copiedShapeInfo.pictureElem.id,sheetIdx:i.copiedShapeInfo.sId,range:i.copiedShapeInfo.copiedRange}))):r&&r.clipboardData||(i.copiedInfo&&i.clearCopiedInfo(),i.copiedInfo={range:a,sId:r&&r.sId?r.sId:s.id,isCut:n},i.hidePaste(!0),r.isFromUpdateAction||i.initCopyIndicator(),J.Browser.isIE||i.getClipboardEle().select(),r&&r.invokeCopy&&document.execCommand(n?"cut":"copy"),i.parent.hideSpinner()),J.Browser.isIE&&i.setExternalCells(r,n),o.resolve()}),r&&r.clipboardData&&(this.setExternalCells(r,n),this.getClipboardEle().setAttribute("aria-label",s.selectedRange+" "+this.parent.serviceLocator.getService(A).getConstant(n?"Cut":"Copy")))}}},ep.prototype.imageToCanvas=function(i,o,s){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=s,e.height=o,r.drawImage(n,0,0,s,o),e.toBlob(function(e){t(e)},"image/png")}})},ep.prototype.addImgToClipboard=function(i,o,s){return Zd(this,void 0,void 0,function(){var t,r,n;return Jd(this,function(e){switch(e.label){case 0:return r=window.navigator,[4,this.imageToCanvas(i,o,s)];case 1:return n=e.sent(),[4,r.clipboard.write([new ClipboardItem(((t={})[n.type]=n,t))])];case 2:return e.sent(),[2]}})})},ep.prototype.checkForUncalculatedFormula=function(e,t){for(var r,n=bi(this.parent,t),i=ne(this.parent,n),o=e[0];o<=e[2];o++)for(var s=e[1];s<=e[3];s++)(r=ie(o,s,i,null,!0)).formula&&J.isUndefined(r.value)&&this.parent.notify(re,{action:"refreshCalculate",value:r.formula,rowIndex:o,colIndex:s,isFormula:X(r.formula),sheetIndex:n})},ep.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},ep.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())},ep.prototype.removeIndicator=function(e){e&&(e=e.getElementsByClassName("e-copy-indicator")[0])&&J.detach(e)},ep.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"})),Gh(this.parent,e,this.copiedInfo.range,"e-copy-indicator"))},ep.prototype.showDialog=function(){var r=this;this.parent.serviceLocator.getService(k).show({header:"Spreadsheet",height:205,width:340,isModal:!0,showCloseIcon:!0,content:this.parent.serviceLocator.getService(A).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)}})},ep.prototype.hidePaste=function(e){this.parent.getActiveSheet().isProtected&&(e=!1),this.parent.notify(Os,[{items:[this.parent.element.id+"_paste"],enable:e||!1}])},ep.prototype.setExternalCells=function(e,t){var r,n="",i=this.parent.getActiveSheet(),o=te(this.copiedInfo.range),s=0===o[1]&&o[3]===i.colCount-1,a=0===o[0]&&o[2]===i.rowCount-1,l='<html><body><table class="e-spreadsheet" xmlns="http://www.w3.org/1999/xhtml"';(s||a)&&(l=l+(' aria-rowcount="'+i.usedRange.rowIndex+'" aria-colcount="'+i.usedRange.colIndex)+'" aria-label="'+(s&&a?"Sheet":s?"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=ie(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?(r="",c.style.whiteSpace||(r+="white-space:"+(c.wrap?"normal":"nowrap")+";"),c.style.verticalAlign||(r+="vertical-align:bottom;"),Object.keys(c.style).forEach(function(e){var t=e.match(/[A-Z]/);r+=("backgroundColor"===e?"background":t?e.replace(t[0],"-"+t[0].toLowerCase()):e)+":"+("backgroundColor"===e||"color"===e?c.style[""+e].slice(0,7):c.style[""+e])+";"}),l+=r.includes('"')?" style='"+r+"'":' style="'+r+'"'):l+=' style="white-space:'+(c.wrap?"normal":"nowrap")+';vertical-align:bottom;"',J.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},this.parent.notify(St,d),p=d.formattedText),n+=p,l=(l+=">")+p+"</td>"),n+=u===o[3]?"":"\t");l+="</tr>",n+=h===o[2]?"":"\n"}l+="</tbody></table></body></html>",J.Browser.isIE?(window.clipboardData.setData("text",n),t&&window.clipboardData.setData("isInternalCut",n)):(e.clipboardData.setData("text/html",l),e.clipboardData.setData("text/plain",n),t&&e.clipboardData.setData("isInternalCut",n),e.preventDefault())},ep.prototype.getExternalCells=function(e){function t(){setTimeout(function(){i.getClipboardEle().innerHTML=""},0)}var r,n,i=this,o=[],s={model:o},a=this.parent.createElement("span");if(J.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:bi(this.parent,this.copiedInfo.sId)},this.parent.notify(Ma,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}}a.innerHTML=r}if(a.querySelector("table"))this.generateCells(a,s);else if(a.querySelector("img")){var d=a.querySelector("img");this.parent.notify(xl,{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(a.children)),this.cellStyle(a));s.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)&&(X(e)?f[t].formula=e:f[t].value=An(e.trim()))}),o.push({cells:f}),s.colCount=Math.max(s.colCount,f.length),f=[]}),s.rowCount=o.length,s.usedRowIndex=o.length-1,s.usedColIndex=s.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(),s},ep.prototype.generateCells=function(e,t){for(var r,n,i,o,s,a,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=(J.isNullOrUndefined(h)||J.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],J.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[a=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=An(o.textContent.trim())),o.getAttribute(s=d?"num-format":"number-format")&&(n[b].format=o.getAttribute(s),n[b].value)&&o.getAttribute("cell-value")&&(n[b].value=An(o.getAttribute("cell-value").trim())),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:J.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:J.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:J.extend({},i)};b=a}g=Math.max(g,n.length)}t.usedColIndex=g-1},ep.prototype.getNewIndex=function(e,t){return t=e[t]?this.getNewIndex(e,++t):t},ep.prototype.cellStyle=function(e,s){var a=this;if(!s){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(s){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&&a.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}},ep.prototype.generateStyles=function(e,r){var n,i,o,s,a,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"),s=o[0].split(" ");for(var t=0;t<s.length;t++)if(a=parseFloat(s[t])){s.splice(t,1),s.unshift((a/.75).toFixed(2)+"px"),o[0]=s.join(" ");break}i=o.join("")}r[p[n]]=i}})})},ep.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())},ep.prototype.performAction=function(){var e=this.getCopyIndicator();e&&Gh(this.parent,e,this.copiedInfo.range,"e-copy-indicator")},ep.prototype.getClipboardEle=function(){return this.parent.element.getElementsByClassName("e-clipboard")[0]},ep.prototype.getCopyIndicator=function(){return this.parent.element.getElementsByClassName("e-copy-indicator")[0]},ep.prototype.getModuleName=function(){return"clipboard"},ep.prototype.destroy=function(){this.removeEventListener();var e=this.getClipboardEle();J.detach(e),this.parent=null},ep);function ep(e){this.parent=e,this.init(),this.addEventListener()}h.prototype.destroy=function(){this.isEdit&&this.cancelEdit(!0,!1),this.removeEventListener(),this.parent=null,this.editorElem=null},h.prototype.addEventListener=function(){J.Browser.isDevice&&"safari"===J.Browser.info.name&&(J.Browser.isIos||J.Browser.isIos7)?J.EventHandler.add(this.parent.element,"touchend",this.tapHandler,this):J.EventHandler.add(this.parent.element,"dblclick",this.dblClickHandler,this),this.parent.on(ps,this.mouseDownHandler,this),this.parent.on(vs,this.keyUpHandler,this),this.parent.on(ys,this.keyDownHandler,this),this.parent.on(us,this.performEditOperation,this),this.parent.on(dl,this.initiateCurPosition,this),this.parent.on(cl,this.updateFormulaBarValue,this),this.parent.on(ul,this.addressHandler,this),this.parent.on(fl,this.initiateRefSelection,this),this.parent.on(gl,this.refSelectionRender,this),this.parent.on(zt,this.checkUniqueRange,this),this.parent.on(jt,this.reApplyFormula,this),this.parent.on(na,this.sheetChangeHandler,this),this.parent.on($a,this.readOnlyAlertHandler,this)},h.prototype.removeEventListener=function(){J.Browser.isDevice&&"safari"===J.Browser.info.name&&(J.Browser.isIos||J.Browser.isIos7)?J.EventHandler.remove(this.parent.element,"touchend",this.tapHandler):J.EventHandler.remove(this.parent.element,"dblclick",this.dblClickHandler),this.parent.isDestroyed||(this.parent.off(ps,this.mouseDownHandler),this.parent.off(vs,this.keyUpHandler),this.parent.off(ys,this.keyDownHandler),this.parent.off(us,this.performEditOperation),this.parent.off(dl,this.initiateCurPosition),this.parent.off(cl,this.updateFormulaBarValue),this.parent.off(ul,this.addressHandler),this.parent.off(fl,this.initiateRefSelection),this.parent.off(gl,this.refSelectionRender),this.parent.off(zt,this.checkUniqueRange),this.parent.off(jt,this.reApplyFormula),this.parent.off(na,this.sheetChangeHandler),this.parent.off($a,this.readOnlyAlertHandler))},h.prototype.getModuleName=function(){return"edit"},h.prototype.performEditOperation=function(e){var t,r;switch(e.action){case"renderEditor":this.renderEditor(),e.initLoad&&J.Browser.isDevice&&"safari"===J.Browser.info.name&&(J.Browser.isIos||J.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(){ae(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(hs,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}},h.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&&!od(e.keyCode))&&this.refreshEditor(t.textContent,this.isCellEdit),!X(this.editCellData.value,!0)||e&&(16===e.keyCode||17===e.keyCode||e.shiftKey&&od(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)))},h.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(hl,{range:e,formulaSheetIdx:t})},h.prototype.keyDownHandler=function(e){var t,r,n,i,o,s,a,l=e.target,h=e.keyCode,d=this.parent.getActiveSheet(),p=W(d.activeCell),c=ie(p[0],p[1],d,!1,!0);if(!J.closest(l,".e-spreadsheet .e-dialog"))if(!d.isProtected||l.classList.contains("e-sheet-rename")||!Vn(c,se(d,p[1]))||l.classList.contains("e-formula-bar")&&!l.disabled)if(this.isEdit){var u,f=this.getEditElement(d),g=X(this.editCellData.value,!0);if((this.isCellEdit||g&&this.editCellData.value!==f.textContent&&16!==e.keyCode&&17!==e.keyCode)&&(p[1]<this.parent.frozenColCount(d)&&(!d.frozenRows||p[0]>=this.parent.frozenRowCount(d))&&f&&"auto"!==f.style.height&&Sd(f.textContent,c.style,this.parent.cellStyle)>parseInt(f.style.maxWidth,10)&&(f.style.height="auto"),Sd(f.textContent,c.style,this.parent.cellStyle)>parseInt(f.style.maxWidth,10)-5&&(f.style.height="auto"),p[0]<this.parent.frozenRowCount(d)&&f&&!f.style.overflow&&Sd(f.textContent,c.style,this.parent.cellStyle)>parseInt(f.style.maxWidth,10)&&(f.style.overflow="auto"),e.shiftKey&&(!e.shiftKey||od(e.keyCode))||this.refreshEditor(f.textContent,this.isCellEdit,!1,!1,!1)),!e.altKey)switch(h){case this.keyCodes.ENTER:J.Browser.isWindows&&e.preventDefault(),this.isAltEnter&&(u=f.textContent)&&-1<u.indexOf("\n")&&(Hi(this.parent.getActiveSheet().selectedRange,!0,this.parent,!0),this.refreshEditor(f.textContent,this.isCellEdit,!1,!1,!1),this.isAltEnter=!1),g&&((u=this.parent.element.querySelector(".e-formularef-indicator"))&&u.parentElement.removeChild(u),ne(this.parent,this.editCellData.sheetIndex).id!==d.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(l.classList.contains("e-spreadsheet")||J.closest(l,".e-sheet-panel"))&&(13===h&&"true"===l.contentEditable&&e.preventDefault(),p=String.fromCharCode(h),c=h>=this.keyCodes.FIRSTALPHABET&&h<=this.keyCodes.LASTALPHABET||p.toLowerCase()!==p.toUpperCase()&&!(112<=h&&h<=123),p=h>=this.keyCodes.FIRSTNUMBER&&h<=this.keyCodes.LASTNUMBER,t=h>=this.keyCodes.FIRSTNUMPAD&&h<=this.keyCodes.LASTNUMPAD,r=(r=h>=this.keyCodes.SYMBOLSETONESTART&&h<=this.keyCodes.SYMBOLSETONEEND)||h>=this.keyCodes.SYMBOLSETTWOSTART&&h<=this.keyCodes.SYMBOLSETTWOEND,n=h===this.keyCodes.FIREFOXEQUALPLUS||h===this.keyCodes.FIREFOXMINUS,i=!e.shiftKey&&!e.ctrlKey&&!e.metaKey&&h===this.keyCodes.F2,o=h===this.keyCodes.BACKSPACE,s=/(Macintosh|MacIntel|MacPPC|Mac68K|Mac|Mac OS|iPod|iPad)/i.test(navigator.userAgent)&&o,a=this.parent.element.querySelector(".e-readonly-alert-dlg"),(!e.ctrlKey&&!e.metaKey&&!e.altKey&&(!e.shiftKey&&h===this.keyCodes.SPACE||c||p||t||r||"mozilla"===J.Browser.info.name&&n)||i||o)&&(i&&(this.isNewValueEdit=!1),c=this.parent.element.getElementsByClassName("e-ss-overlay-active"),a||(Bd(this.parent)?this.parent.notify($a,null):c.length?o&&!s&&this.editingHandler("delete"):(this.startEdit(null,null,!0,!0),ae(this.getEditElement(d))))),h!==this.keyCodes.DELETE&&!s||(p=d.isProtected&&kd(this.parent),a)||(p?this.parent.notify(Ka,null):Bd(this.parent)?this.parent.notify($a,null):(this.editingHandler("delete"),this.parent.notify(Lt,null))));else!(h>=this.keyCodes.FIRSTALPHABET&&h<=this.keyCodes.LASTALPHABET||h>=this.keyCodes.FIRSTNUMBER&&h<=this.keyCodes.LASTNUMBER||h===this.keyCodes.DELETE||h===this.keyCodes.BACKSPACE||h===this.keyCodes.SPACE||h>=this.keyCodes.FIRSTNUMPAD&&h<=this.keyCodes.LASTNUMPAD||h>=this.keyCodes.SYMBOLSETONESTART&&h<=this.keyCodes.SYMBOLSETONEEND||219<=h&&h<=222)&&(e.shiftKey||e.ctrlKey||e.metaKey||h!==this.keyCodes.F2)||67===h||89===h||90===h||d.protectSettings.insertLink&&75===h||e.ctrlKey||70===e.keyCode||this.parent.element.querySelector(".e-editAlert-dlg")||l.parentElement.classList.contains("e-unprotectpwd-content")||l.parentElement.classList.contains("e-password-content")||l.parentElement.classList.contains("e-sheet-password-content")||l.parentElement.classList.contains("e-unprotectsheetpwd-content")||l.parentElement.classList.contains("e-reenterpwd-content")||this.parent.notify(Ka,null)},h.prototype.renderEditor=function(){if(!this.editorElem||!J.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(fs,{action:"renderAutoComplete"})},h.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(gs,{action:"refreshFormulabar",value:e}),this.parent.isEdit&&n&&i&&this.editCellData.value===n.textContent&&this.triggerEvent("cellEditing").cancel&&this.cancelEdit(!1,!1,null,!0)},h.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=ie(o[0],o[1],i,!1,!0);if(yd(this.parent,o[0],o[1],this.parent.activeSheetIndex)){var o=this.parent.getCell(o[0],o[1]),s=!1,a=o.innerHTML;if(s=o&&-1<a.indexOf("<")&&-1<a.indexOf(">")&&-1<a.indexOf("input")?!0:s)return}o=this.updateEditCellDetail(e,t);this.initiateEditor(r,o),this.positionEditor(),this.parent.isEdit=this.isEdit=!0,this.parent.notify(Hs,null),this.parent.notify(Os,[{enable:!1}]),i.formula&&!n&&this.parent.notify(hl,{range:i.formula,formulaSheetIdx:this.editCellData.sheetIndex})},h.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()},h.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},h.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(wl,{id:r[0].id,sheetIdx:this.parent.activeSheetIndex+1}):this.parent.notify(Sl,{id:r[0].id,sheetIdx:this.parent.activeSheetIndex+1});else{var i=this.parent.getActiveSheet(),n=y(e=i.selectedRange),e=ee(n[0]>n[2]||n[1]>n[3]?te(n):n),r={address:i.name+"!"+e,cancel:!1};if(this.parent.notify(gt,{action:"cellDelete",eventArgs:r}),r.cancel)return;n=Q(e=C(r.address)),Od(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=ie((n=Q(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=Q(this.uniqueColl),s=o[0];s<=o[2];s++)for(var a=o[1];a<=o[3];a++)this.parent.updateCell({value:"",formula:""},ee([s,a]));this.parent.notify(_t,null),this.uniqueColl=""}else if(r.isUnique){var l=Q(this.uniqueColl);if("#SPILL!"===ie(l[0],l[1],i).value){for(var h=!1,a=l[0];a<=l[2];a++)for(var d=l[1];d<=l[3];d++){var p=ie(a,d,i);a===l[0]&&d===l[1]?h=!1:p&&!J.isNullOrUndefined(p.value)&&""!==p.value&&(h=!0)}h||this.reApplyFormula()}}r.isUnique?this.parent.notify(oe,{action:"cellDelete",eventArgs:{address:i.name+"!"+e,isSpill:t}}):this.parent.notify(oe,{action:"cellDelete",eventArgs:{address:i.name+"!"+e}})}},h.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},h.prototype.mouseDownHandler=function(e){if(!J.closest(e.target,".e-findtool-dlg")&&!J.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"),s=(this.isCellEdit=t.classList.contains("e-spreadsheet-edit"),X(this.editCellData.value,!0)),a=this.getEditElement(i),l=["+","-","*","/",this.parent.listSeparator,"(","=","&",":"];if(t.classList.contains("e-cell")||t.classList.contains("e-header-cell")||t.classList.contains("e-selectall")||J.closest(t,".e-toolbar-item.e-active")||J.closest(t,".e-table"))if(this.isAltEnter&&(d=a.textContent)&&-1<d.indexOf("\n")&&(this.isAltEnter=!1,Hi(this.parent.getActiveSheet().selectedRange,!0,this.parent),this.refreshEditor(a.textContent,this.isCellEdit)),!s||this.endFormulaRef)this.endFormulaRef=!1,this.endEdit(!1,e);else{var h,d=W(i.activeCell),d=ie(d[0],d[1],i),p=document.activeElement.classList.contains("e-formula-bar")?document.activeElement.value:a.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(a.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))&&On(p.substring(r,n))&&p.indexOf(":")!==n&&(this.editCellData.value=p.substring(0,r)+p.substring(n,p.length));d&&(s=d.formula&&(X(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)&&!Y(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!s||this.editCellData.value!==a.textContent||a.textContent.indexOf("(")===a.textContent.length-1||this.isCellEdit||t.classList.contains("e-formula-bar")||-1!==l.indexOf(this.editCellData.value.substring(r-1,r))||ne(this.parent,this.editCellData.sheetIndex).id===i.id&&(h=window.getSelection().focusOffset,-1===l.indexOf(a.textContent.substring(h-1,h)))&&(o&&o.parentElement.removeChild(o),this.parent.goTo(this.editCellData.fullAddr),this.isEdit)&&this.endEdit(!1,e)}},h.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"))&&ae(e)},300))},h.prototype.dblClickHandler=function(e){var t,r,n,e=e.target;J.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")||J.closest(e,".e-sheet-content")||e.classList.contains("e-table"))||(ni(n=ie((r=W((t=this.parent.getActiveSheet()).activeCell))[0],r[1],t,!1,!0),se(t,r[1]),ch(t,r[0]))?this.parent.notify($a,null):t.isProtected&&Vn(n,se(t,r[1]))?this.parent.notify(Ka,null):this.isEdit?e.classList.contains("e-spreadsheet-edit")||X(this.editCellData.value)&&(n=this.editCellData.fullAddr.substring(0,this.editCellData.fullAddr.indexOf("!")),this.parent.getActiveSheet().name!==n)||this.endEdit():(this.isNewValueEdit=!1,this.startEdit(),ae(this.getEditElement(t))))},h.prototype.updateEditCellDetail=function(e,t){var r,n,i,o,s,a,l=J.isNullOrUndefined(this.editCellData.sheetIndex)?e&&1<e.split("!").length?B(this.parent,xi(e)):this.parent.activeSheetIndex:this.editCellData.sheetIndex;return this.editCellData.addr?X(this.editCellData.value,!0)&&(r=ne(this.parent,l),this.isNewValueEdit=!1):(r=ne(this.parent,l),e=e?C(e):r.activeCell),e&&((1<(s=ie(i=(a=Q(e))[0],o=a[1],r,!1,!0)).colSpan||1<s.rowSpan)&&(ei(s={sheet:r,cell:s,rowIdx:i,colIdx:o}),i=s.rowIdx,o=s.colIdx,n=s.isMergedHiddenCell),s=this.parent.getCell(i,o),a=Wh(r,a,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:ki(this.parent,l)+"!"+e,rowIndex:i,colIndex:o,sheetIndex:l,element:s,value:t||"",position:a}),n},h.prototype.initiateEditor=function(o,e){var s=this;ai(this.parent,this.editCellData.fullAddr,!1,e).then(function(e){s.parent&&e.forEach(function(t){function e(){var e={cell:t,value:t?t.value:"",showFormattedText:s.editCellData.showFormattedText};s.parent.notify(Dt,e),r=t?t.formula||e.value:"",s.editCellData.oldValue=r}e();var r,n,i=s.triggerEvent("cellEdit",null,r);i.cancel?s.cancelEdit(!0,!1,null,!0):(i.showFormattedText&&(s.editCellData.showFormattedText=!0,e()),s.editCellData.value?r=s.editCellData.value:s.editCellData.value=r,s.isNewValueEdit?(n=r,r=""):s.isNewValueEdit=!0,J.isUndefined(r)||s.refreshEditor(r,!1,!0,!1,!1,n),o&&s.setCursorPosition())})})},h.prototype.positionEditor=function(e){var t,r,n,i,o,s,a,l,h,d,p,c,u,f,g,m=this.editCellData.element,v={isEdit:!1};this.parent.notify(hs,v),v.isEdit&&J.isNullOrUndefined(m)&&(v=this.parent.getCell(this.editCellData.rowIndex,this.editCellData.colIndex),this.editCellData.element=m=v),m&&(m.classList.add("e-ss-edited"),v=this.parent.getActiveSheet(),t=ie(this.editCellData.rowIndex,this.editCellData.colIndex,v,!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(Tr,o),i=vh(v,o.range[0],o.range[2])-3,o=Ih(v,o.range[1],o.range[3])-3,f=(c=this.parent.getMainContent()).parentElement,d=void 0,p=this.parent.frozenColCount(v),a=s=void 0,l=this.parent.frozenRowCount(v),h=void 0,this.editCellData.colIndex<p?(d=Math.abs(this.parent.getRowHeaderContent().getBoundingClientRect()[this.parent.enableRtl?"left":"right"]-m.getBoundingClientRect()[this.parent.enableRtl?"right":"left"])-1,this.editCellData.rowIndex<l?"2"===this.parent.getRowHeaderContent().style.zIndex&&(s="3"):Sd(t.value,t.style,this.parent.cellStyle)>d&&(h=!0)):(d=f.offsetWidth-(r-c.scrollLeft)-28-this.parent.sheetModule.getRowHeaderWidth(v),p=m.getBoundingClientRect(),c=f.getBoundingClientRect(),f=this.parent.enableRtl?p.left:p.right,c=this.parent.enableRtl?c.left:c.right,g=this.parent.getScrollElement(),u=this.parent.sheetModule.getScrollSize(),this.parent.enableRtl?f<c+u&&(g.scrollLeft-=p.width):c-u<f&&(g.scrollLeft+=p.width)),c=!(a=this.editCellData.rowIndex<l?!0:a)&&(t&&t.wrap||m&&e||h)?"auto;":i+"px;",u="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:"+c+(t&&t.wrap?"width:"+o+"px;":"")+"min-height:"+i+"px;"+(s?"z-index: "+s+";":"")+(a&&(t&&!t.wrap||m&&e)&&(Sd(t.value,t.style,this.parent.cellStyle)>d||m&&e)?"overflow: auto;":""),u+=m.style.cssText,(f=this.getEditElement(v,!0)).setAttribute("style",u),Sd(f.textContent,t.style,this.parent.cellStyle)>d&&(f.style.height="auto"),(g=this.parent.element.querySelector(".e-active-cell"))&&(g.style.height=4+i+"px"),m.classList.contains("e-right-align")?f.classList.add("e-right-align"):m.classList.contains("e-center-align")&&f.classList.add("e-center-align"))},h.prototype.updateEditedValue=function(t,r,n,e){var i,o,s,a,l,h,d,p=this,c=this.editCellData.oldValue,u=(r&&(this.editCellData.value=r),this.editCellData.value),f=(this.parent.notify(Ia,{args:{action:"beforeCellSave",eventArgs:{address:this.editCellData.addr}}}),!0);this.parent.allowDataValidation&&(i=ie((h=Q((s=this.parent.getActiveSheet()).activeCell))[0],h[1],s,!1,!0),o=se(s,h[1]),i.validation||Rh(o,h[0],h[1]))&&(o=Jn([this.editCellData.value||this.getEditElement(s).innerText],this.parent.locale)[0],h=this.parent.activeSheetIndex,s={value:o,range:"string"==typeof this.editCellData.addr?Q(this.editCellData.addr):this.editCellData.addr,sheetIdx:h,isCell:!0,td:null,isValid:!0},this.parent.notify(hr,s),(f=s.isValid)?(i.format&&o!==s.value||!this.editCellData.value&&s.value)&&(this.editCellData.value=s.value):this.isCellEdit=!0),!e&&X(this.editCellData.value)&&(a={formula:this.editCellData.value},this.parent.notify(vn,a),a.isInvalid)&&(f=!(this.isCellEdit=!0),h=this.parent.serviceLocator.getService(A),(d=this.parent.serviceLocator.getService(k)).show({width:400,isModal:!0,showCloseIcon:!0,target:this.parent.element,cssClass:"e-validation-error-dlg",content:h.getConstant("CellReferenceTypoError")+"<br>"+a.formula,beforeOpen:function(){return p.editCellData.element.focus()},buttons:[{buttonModel:{content:h.getConstant("Yes"),isPrimary:!0},click:function(){l=!0,d.hide()}},{buttonModel:{content:h.getConstant("No")},click:function(){return d.hide()}}],close:function(){var e;l?(r=p.editCellData.value=a.formula,p.updateCell(c,t,r,u,n),p.parent.notify(gs,{action:"refreshFormulabar",value:a.formula})):(e=p.getEditElement(p.parent.getActiveSheet())).innerText&&window.getSelection().selectAllChildren(e)}},!1)),f?this.updateCell(c,t,r,u,n):n&&n.preventDefault()},h.prototype.updateCell=function(e,t,r,n,i){var o=e?e.toString().toUpperCase():"";if(e!==this.editCellData.value||-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 s=this.parent.getActiveSheet(),o=Q(s.activeCell),a=(e&&-1<e.toString().indexOf("=UNIQUE(")&&""===this.editCellData.value&&this.parent.notify(_t,null),{cellIdx:o,isUnique:!1}),a=(this.checkUniqueRange(a),a.isUnique);if(a&&""!==e&&""===this.editCellData.value)if(-1===ie((c=Q(this.uniqueColl))[0],c[1],s).value.toString().indexOf("#SPILL!"))return;e&&-1<e.toString().indexOf("UNIQUE")&&this.editCellData.value&&-1<this.editCellData.value.toString().indexOf("UNIQUE")&&a&&this.updateUniqueRange("");var l,h={action:"updateCellValue",address:this.editCellData.addr,value:this.editCellData.value,skipCellFormat:this.editCellData.showFormattedText},d=(this.parent.notify(kt,h),ie(o[0],o[1],s,!0)),p=void 0;if(J.isNullOrUndefined(d)||(p=d.value.toString()),-1<this.formulaErrorStrings.indexOf(p)||p&&p.includes("circular reference:"))return delete d.value,delete d.formula,void(i&&(l=i.target,["e-toolbar-item","e-tab-wrap","e-text-wrap","e-tab-text","e-caret"].some(function(e){return l.classList.contains(e)})&&J.closest(l,".e-ribbon")||["e-scroller","e-main-panel","e-autofill"].some(function(e){return l.classList.contains(e)})||this.showFormulaAlertDlg(p),i.preventDefault()));var c,d=void 0,p=(h.isFormulaDependent&&(d=Qn(this.parent,this.parent.viewport)),this.parent.notify(qr,{cell:null,rIdx:this.editCellData.rowIndex,cIdx:this.editCellData.colIndex,viewportIndexes:d}),s.conditionalFormats&&s.conditionalFormats.length&&this.parent.notify(Mr,{indexes:[this.editCellData.rowIndex,this.editCellData.colIndex],isAction:!0,refreshAll:h.isFormulaDependent,isEdit:!0}),ie(o[0],o[1],s,!0)),d=this.getRefreshNodeArgs(p,this.editCellData.element,this.editCellData.rowIndex,this.editCellData.colIndex);if(this.editCellData.value=d.value,p&&p.formula&&(this.editCellData.formula=p.formula),p&&p.wrap&&this.parent.notify(nr,{range:o,wrap:!0,sheet:s}),t&&this.parent.refreshNode(this.editCellData.element,d),p&&p.hyperlink&&this.parent.serviceLocator.getService("cell").refreshRange(o),a)if(-1<ie((c=Q(this.uniqueColl))[0],c[1],s).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 u=!1,f=c[0];f<=c[2];f++)for(var g=c[1];g<=c[3];g++){var m=ie(f,g,s);f===c[0]&&g===c[1]?u=!1:m&&!J.isNullOrUndefined(m.value)&&""!==m.value&&(u=!0)}u||this.reApplyFormula()}else this.updateUniqueRange(n)}this.triggerEvent("cellSave",i,r),this.resetEditState(),this.focusElement(i)},h.prototype.checkUniqueRange=function(e){var t={range:[]},r=(this.parent.notify(Ut,t),t.range);e.sheetName||(e.sheetName=this.parent.getActiveSheet().name);for(var n=0;n<r.length;n++)if(r[n].split("!")[0]===e.sheetName)for(var i=Q(r[n]),o=i[0];o<=i[2];o++)for(var s,a,l,h=i[1];h<=i[3];h++)e.cellIdx[0]===o&&e.cellIdx[1]===h&&(e.isUnique=!0,this.uniqueCell=!0,s=""!==this.uniqueColl?Q(this.uniqueColl):[0,0,0,0],a=Q(r[n]),s[0]===a[0]&&s[1]===a[1]?((l=[s[0],a[1],s[0],a[1]])[2]=(s[2]>a[2]?s:a)[2],l[3]=(s[3]>a[3]?s:a)[3],this.uniqueColl=ee(l),e.uniqueRange=ee(l)):(this.uniqueColl=r[n],e.uniqueRange=r[n]))},h.prototype.updateUniqueRange=function(e){var t=Q(this.uniqueColl),r=!1;"#SPILL!"!==ie(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!"},ee([n,i])):ee([n,i]).split(":")[0]===this.editCellData.addr?this.parent.updateCell({value:e},ee([n,i])):this.parent.updateCell({value:""},ee([n,i])))},h.prototype.reApplyFormula=function(){for(var e=Q(this.uniqueColl),t=ie(e[0],e[1],this.parent.getActiveSheet()),r=(this.parent.updateCell({value:""},ee([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(re,{action:"computeExpression",formula:n}),this.uniqueCell=!1,""!==this.uniqueActCell&&(this.editCellData.value=this.uniqueActCell,this.uniqueActCell="")},h.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=ne(this.parent,r),n=void 0;if(n=$(r,e)||Eh(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=ie(e,t,r),r=Q(r.activeCell),r=(r[0]===e&&r[1]===t&&(this.uniqueActCell=i.value),this.getRefreshNodeArgs(i,n,e,t));this.parent.refreshNode(n,r)}}},h.prototype.getRefreshNodeArgs=function(e,t,r,n){e={value:(e=e||{}).value,format:e.format,formattedText:"",isRightAlign:!1,type:"General",cell:e,rowIndex:r,td:t,colIndex:n,refresh:!0,isEdit:!0};return this.parent.notify(St,e),{isRightAlign:e.isRightAlign,type:e.type,value:e.value,result:this.parent.allowNumberFormatting?e.formattedText:e.value,curSymbol:e.curSymbol,isRowFill:e.isRowFill,rowIndex:r,colIndex:n}},h.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=ie(this.editCellData.rowIndex,this.editCellData.colIndex,this.parent.getActiveSheet()),Hi(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))},h.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):this.triggerEvent("cellEdited")),this.resetEditState(),this.focusElement()},h.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")))&&ae(e):ae(this.parent.element),this.parent.notify(Os,[{enable:!0}])},h.prototype.triggerEvent=function(e,t,r){var n,i=this.parent.getActiveSheet(),o=ie(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)};if(r.address&&(n={cellIdx:Q(r.address),isUnique:!1},this.checkUniqueRange(n),n.isUnique)&&(r.isSpill=this.isSpill),r.value!==r.oldValue){if("cellSave"!==e&&(r.cancel=!1),"beforeCellSave"===e){this.parent.notify(gt,{eventArgs:r,action:"cellSave",preventAction:!0});o=X(r.value)?{formula:r.value}:{value:r.value};if(Gn(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),r.originalEvent=t,this.parent.notify(oe,{eventArgs:r,action:"cellSave"}))}else"beforeCellSave"!==e&&("cellSave"===e?this.parent.trigger("cellEdited",r):this.parent.trigger(e,r));return r},h.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)},h.prototype.resetEditState=function(e){(e=void 0===e?!0:e)&&(!X((e=this.getEditElement(this.parent.getActiveSheet())).textContent)&&""!==e.textContent||this.parent.notify(pl,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")):J.detach(e)),this.editCellData={},this.parent.isEdit=this.isEdit=!1,this.isCellEdit=!0,this.parent.notify(fs,{action:"endEdit"}),this.parent.showSheetTabs&&!this.parent.isProtected&&(e=this.parent.element.querySelector(".e-add-sheet-tab"))&&e.removeAttribute("disabled")},h.prototype.refSelectionRender=function(){var e=this.getEditElement(this.parent.getActiveSheet());e&&X(e.textContent)&&this.parent.notify(hl,{range:e.textContent,formulaSheetIdx:this.editCellData.sheetIndex})},h.prototype.initiateRefSelection=function(){var e=this.editCellData.fullAddr.substring(0,this.editCellData.fullAddr.indexOf("!")),t=this.editCellData.value;this.parent.getActiveSheet().name===e&&X(this.editCellData.value,!0)&&(this.startEdit(this.editCellData.addr,t,!1),this.parent.notify(hl,{range:this.editCellData.value,formulaSheetIdx:this.editCellData.sheetIndex}),this.getEditElement(this.parent.getActiveSheet()).textContent=t),this.initiateCurPosition()},h.prototype.addressHandler=function(e){var t,r,n,i,o,s,a=this.parent.serviceLocator.getService(k).dialogInstance;a&&a.element&&a.element.classList.contains("e-validation-error-dlg")?e.isAlertDlgOpen=!0:(this.curStartPos||((a=this.getCurPosition()).start&&(this.curStartPos=a.start),a.end&&(this.curEndPos=a.end)),a=e.range,t=this.editCellData.sheetIndex,r=this.getEditElement(this.parent.getActiveSheet()),this.parent.activeSheetIndex!==t&&(a="'"+this.parent.getActiveSheet().name+"'!"+a),n=this.editCellData.value,e.isSelect?this.parent.notify(hl,{range:n+a,formulaSheetIdx:t}):this.parent.activeSheetIndex===t&&(o=i=void 0,s=document.activeElement.classList.contains("e-formula-bar")?document.activeElement.value:r.textContent,e.isMouseDown&&s!==n?(i=s.substring(0,this.curEndPos)+this.parent.listSeparator,o=s.substring(this.curEndPos),this.refreshEditor(i+o,!1,!0),this.parent.notify(hl,{range:r.textContent,formulaSheetIdx:t}),this.curEndPos+=this.parent.listSeparator.length,this.curStartPos=this.curEndPos,i+=a):(i=n.substring(0,this.curStartPos)+a,o=n.substring(this.curStartPos)),r.textContent=i+o,this.curEndPos=i.length))},h.prototype.updateFormulaBarValue=function(e){var t,r,n,i=this.editCellData.value,o=this.parent.getActiveSheet().selectedRange.split(" "),s=he(y(s=o[o.length-1]))?s.split(":")[0]:s,a=this.parent.element.querySelector(".e-formula-bar");i&&X(i,!0)&&(t=this.editCellData.fullAddr.substring(0,this.editCellData.fullAddr.indexOf("!")),r=void((t=this.parent.getActiveSheet().name!==t)&&(s="'"+this.parent.getActiveSheet().name+"'!"+s)),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+=s):(r=i.substring(0,this.curStartPos)+s,n=i.substring(this.curStartPos)),a.value=r+n,this.curEndPos=r.length)},h.prototype.setFormulaBarCurPosition=function(e,t,r){e.setSelectionRange&&(e.focus(),e.selectionStart=t,e.selectionEnd=t,e.setSelectionRange(t,r))},h.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))))},h.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},h.prototype.sheetChangeHandler=function(){this.isEdit||(this.editCellData.value=null)},h.prototype.showFormulaAlertDlg=function(e){var n,i=this,t=this.parent.serviceLocator.getService(A),r=this.parent.serviceLocator.getService("dialog"),e=this.getFormulaErrorKey(e);r.show({width:400,isModal:!0,showCloseIcon:!0,target:this.parent.element,cssClass:"e-validation-error-dlg",content:t.getConstant(e),beforeOpen:function(){var e;0<window.getSelection().rangeCount&&(e=window.getSelection().getRangeAt(0),n=e.endOffset)},buttons:[{buttonModel:{content:t.getConstant("Ok"),isPrimary:!0},click:function(){r.hide()}}],close:function(){var e=i.getEditElement(i.parent.getActiveSheet()),t=document.getSelection(),r=document.createRange();r.setStart(e.firstChild,n),r.collapse(!0),t.removeAllRanges(),t.addRange(r),e.focus()}},!1)},h.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;default:t=e.includes("circular reference")?"FormulaCircularRef":"InvalidFormulaError"}return t},h.prototype.readOnlyAlertHandler=function(){var e,r=this,n=this.parent.serviceLocator.getService(A),i=this.parent.serviceLocator.getService("dialog"),t=this.parent.element.querySelector(".e-find-dlg");J.isNullOrUndefined(t)||(e=J.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,Ph(function(){i.destroyDialog()})),i.dialogInstance.content=t.content,ae(r.parent.element)},close:function(){J.isNullOrUndefined(t)||(i.dialogInstance=e),ae(r.parent.element)}})};var tp=h;function h(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()}d.prototype.addEventListener=function(){this.parent.on(ds,this.init,this),this.parent.on(ps,this.mouseDownHandler,this),this.parent.on(ws,this.virtualContentLoadedHandler,this),this.parent.on(Is,this.cellNavigateHandler,this),this.parent.on(Ds,this.selectRange,this),this.parent.on(Qs,this.rowHeightChanged,this),this.parent.on(ea,this.colWidthChanged,this),this.parent.on(Qa,this.protectHandler,this),this.parent.on(hl,this.initiateFormulaSelection,this),this.parent.on(pl,this.clearBorder,this),this.parent.on(Cl,this.getRowIdxFromClientY,this),this.parent.on(bl,this.getColIdxFromClientX,this),this.parent.on(Cn,this.getRowIdxFromClientY,this),this.parent.on(bn,this.getColIdxFromClientX,this),this.parent.on(Al,this.chartBorderHandler,this),this.parent.on(jl,this.isTouchSelectionStarted,this),this.parent.on(Ls,this.selectionByKeydown,this)},d.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(ds,this.init),this.parent.off(ps,this.mouseDownHandler),this.parent.off(ws,this.virtualContentLoadedHandler),this.parent.off(Is,this.cellNavigateHandler),this.parent.off(Ds,this.selectRange),this.parent.off(Qs,this.rowHeightChanged),this.parent.off(ea,this.colWidthChanged),this.parent.off(Qa,this.protectHandler),this.parent.off(hl,this.initiateFormulaSelection),this.parent.off(pl,this.clearBorder),this.parent.off(Cl,this.getRowIdxFromClientY),this.parent.off(bl,this.getColIdxFromClientX),this.parent.off(Cn,this.getRowIdxFromClientY),this.parent.off(bn,this.getColIdxFromClientX),this.parent.off(Al,this.chartBorderHandler),this.parent.off(jl,this.isTouchSelectionStarted),this.parent.off(Ls,this.selectionByKeydown))},d.prototype.isTouchSelectionStarted=function(e){e.touchSelectionStarted=this.touchSelectionStarted},d.prototype.selectionByKeydown=function(e){this.selectRangeByIdx(e.range,e.e,!1,!1,!1,!1,void 0,!1)},d.prototype.rowHeightChanged=function(s){var a=this;s.threshold&&Ph(function(){var e,t,r,n,i,o;a.parent&&(o=a.parent.getActiveSheet(),(e=a.getActiveCell())&&(o.frozenRows||o.frozenColumns||o.selectedRange.includes(" "))?a.selectRange({address:o.selectedRange}):(i={range:t=te(Q(o.selectedRange)),isActiveCell:!1,skipChecking:!0},e&&(r=W(o.activeCell)[0],a.parent.notify(Or,i),i.isActiveCell&&(n=1<ie(t[0],t[1],o,!1,!0).rowSpan&&t[0]<=s.rowIdx&&t[2]>=s.rowIdx),r===s.rowIdx||n?e.style.height=parseFloat(e.style.height)+s.threshold+"px":r>s.rowIdx&&(e.style.top=parseFloat(e.style.top)+s.threshold+"px")),!(e=a.getSelectionElement())||n||t[0]===t[2]&&t[1]===t[3]||(i=t[0],o=t[2],i<=s.rowIdx&&o>=s.rowIdx&&e?e.style.height=parseFloat(e.style.height)+s.threshold+"px":i>s.rowIdx&&e&&(e.style.top=parseFloat(e.style.top)+s.threshold+"px"))))})},d.prototype.colWidthChanged=function(a){var l=this;a.threshold&&Ph(function(){var e,t,r,n,i,o,s;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}):(s={range:r=te(Q(o.selectedRange)),isActiveCell:!1,skipChecking:!0},e&&(l.parent.notify(Or,s),n=W(o.activeCell)[1],s.isActiveCell&&(i=1<(s=ie(r[0],r[1],o,!1,!0)).rowSpan||1<s.colSpan),n===a.colIdx||i?e.style.width=parseFloat(e.style.width)+a.threshold+"px":n>a.colIdx&&(t?e.style.right=parseFloat(e.style.right)+a.threshold+"px":e.style.left=parseFloat(e.style.left)+a.threshold+"px")),!(e=l.getSelectionElement())||i||r[0]===r[2]&&r[1]===r[3]||(o=r[1],s=r[3],o<=a.colIdx&&s>=a.colIdx&&e?e.style.width=parseFloat(e.style.width)+a.threshold+"px":o>a.colIdx&&e&&(t?e.style.right=parseFloat(e.style.right)+a.threshold+"px":e.style.left=parseFloat(e.style.left)+a.threshold+"px"))))})},d.prototype.selectRange=function(e){e.address="Single"===this.parent.selectionSettings.mode?ee(W(e.address)):e.address,this.selectMultiRange(e.address,null,null,e.skipChecking)},d.prototype.init=function(){this.createSelectionElement();var e=this.parent.getActiveSheet(),t=te(Q(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)},d.prototype.selectMultiRange=function(e,r,n,i){var o=this,t=this.parent.activeSheetIndex;-1<e.indexOf("!")&&(t=B(this.parent,xi(e)),e=e.split("!")[1]),this.parent.activeSheetIndex===t?e.split(" ").forEach(function(e,t){o.selectRangeByIdx(Q(e),{type:"mousedown",ctrlKey:0!==t},null,n,r,i)}):wi(this.parent,e,this.parent.sheets[t])},d.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)},d.prototype.mouseDownHandler=function(e){var t=this;if(!(J.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(us,r),X(r.editedValue,!0)),i=W(this.parent.getActiveSheet().activeCell),o=this.parent.getCell(i[0],i[1]);if(!J.isNullOrUndefined(o)&&null!==o.children&&0<o.children.length&&-1<document.activeElement.className.indexOf("e-addNoteContainer")&&o.children[o.children.length-1].classList.contains("e-addNoteIndicator")&&(o=ie(i[0],i[1],n),s=document.getElementsByClassName("e-addNoteContainer")[0],a=ki(this.parent,this.parent.activeSheetIndex)+"!"+this.parent.getActiveSheet().activeCell,J.isNullOrUndefined(s)||J.isNullOrUndefined(s.value)||"e-addNoteContainer"===e.target.className||!J.isNullOrUndefined(o)&&!J.isNullOrUndefined(o.notes)&&o.notes===s.value||(this.parent.notify(Ia,{args:{action:"beforeCellSave",eventArgs:{address:a}}}),Gn(this.parent,this.parent.getActiveSheet(),{rowIdx:i[0],colIdx:i[1],preventEvt:!0,cell:{notes:s.value,isNoteEditable:!1}}),o={notes:s.value,address:a},this.parent.notify(oe,{eventArgs:o,action:"addNote"})),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(va,""),this.isNoteTouch&&-1<e.type.indexOf("mouse")&&(this.isNoteTouch=!1),!this.parent.isEdit||r){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(J.closest(e.target,".e-datavisualization-chart"))return;if(n.isProtected&&!n.protectSettings.selectCells&&!n.protectSettings.selectUnLockedCells)return;if(!J.closest(e.target,".e-findtool-dlg")&&this.getSheetElement().contains(e.target)&&!e.target.classList.contains("e-colresize")&&!e.target.classList.contains("e-rowresize")){var s=this.parent.getActiveSheet(),a=this.parent.selectionSettings.mode,o=this.getRowIdxFromClientY({clientY:ad(e),target:e.target}),i=this.getColIdxFromClientX({clientX:sd(e),target:e.target}),n=W(s.activeCell),l=void 0,h=void 0;if(s.showHeaders&&(p=e.target,s.frozenColumns||s.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"),l=(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")):(l=this.parent.getRowHeaderContent().contains(e.target),h=this.parent.getColumnHeaderContent().contains(e.target))),3===e.which&&this.isSelected(o,i))return;e.target.classList.contains("e-autofill")&&(this.isautoFillClicked=!0,(c=e.target.parentElement.querySelector(".e-dragfill-ddb"))&&!c.classList.contains("e-hide")||(this.dAutoFillCell=s.selectedRange));var d,p=Q(s.topLeftCell),c=void 0,p=(l?(this.isRowSelected=!0,e.shiftKey&&"Single"!==a||(this.startCell=[o,0]),c=[this.startCell[0],s.frozenColumns?p[1]:0,o,s.colCount-1]):h?(this.isColSelected=!0,e.shiftKey&&"Single"!==a||(this.startCell=[0,i]),c=[s.frozenRows?p[0]:0,this.startCell[1],s.rowCount-1,i]):J.closest(e.target,".e-select-all-cell")?(this.startCell=[s.frozenRows?p[0]:0,s.frozenColumns?p[1]:0],c=[].concat(this.startCell,[s.rowCount-1,s.colCount-1])):e.target.classList.contains("e-sheet-content")||(e.shiftKey&&"Single"!==a||(this.startCell=[o,i]),this.isautoFillClicked)||J.closest(e.target,".e-filloption")||(c=[].concat(this.startCell||W(s.activeCell),[o,i])),Qh(e)&&!l&&!h&&c&&(p=this.isRowColSelected(c),this.isRowSelected=p.isRowSelected,this.isColSelected=p.isColSelected),e.ctrlKey&&c&&s.selectedRange.includes(ee(c))),s=(!p&&"Multiple"===a&&(!td(e)&&(!Qh(e)||Qh(e)&&n[0]===o&&n[1]===i)||h||l)?(document.addEventListener(Zh().split(" ")[0],this.mouseMoveEvt),J.Browser.isPointer||(J.Browser.isIos&&Qh(e)&&e.target&&e.target.classList.contains("e-cell")&&e.preventDefault(),document.addEventListener(Zh().split(" ")[1],this.mouseMoveEvt,{passive:!1})),this.touchSelectionStarted=!0):this.touchSelectionStarted=!1,td(e)||(p?this.parent.isEdit&&(d=function(e){J.EventHandler.remove(document,Jh(),d),t.updateFormulaCursorPosition(e)},J.EventHandler.add(document,Jh(),d,this)):J.EventHandler.add(document,Jh(),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(Qh(e)&&s&&(a=W(ee(c).split(":")[0]),this.parent.notify(fa,{rowIndex:a[0],columnIndex:a[1],isNoteEditable:!1}),this.isNoteTouch=!0,this.parent.spreadsheetNoteModule.isNoteVisibleOnTouch=!0),Qh(e)&&!h&&!l)return void(this.touchEvt=e);c&&this.selectRangeByIdx(c,e),!this.isNoteTouch&&-1<e.type.indexOf("mouse")&&s&&(o=W(ee(c).split(":")[0]),this.parent.notify(fa,{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=he(y((n=(c=this.parent.getActiveSheet().selectedRange).split(" "))[n.length-1]))?n[n.length-1].split(":")[0]:n[n.length-1],this.parent.notify(ul,{range:c,isSelect:!1,isMouseDown:e.ctrlKey}))}},d.prototype.mouseMoveHandler=function(e){var t,r,n,i,o,s,a,l,h,d=this,p=this.parent.getActiveSheet(),c=(ed(e)&&e.preventDefault(),{action:"getCurrentEditValue",editedValue:""}),c=(this.parent.notify(us,c),X(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),y=g.right-Uh(),C=g.top,b=g.bottom,g=sd(e),x=ad(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?Q((I=p.selectedRange.split(" "))[I.length-1]):Q(p.selectedRange),J.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(Tr,I),I.range[2]===r[2]&&I.range[3]===r[3]&&x<=b&&C<=x&&g<=y&&v<=g||(I=this.parent.frozenRowCount(p),n=b<x&&w<p.rowCount,i=x<C&&0<=w&&!this.isColSelected&&!!u.scrollTop,w<I&&(i=n=!1),o=y<g&&S<p.colCount,s=g<v&&0<=S&&!this.isRowSelected&&!!f.scrollLeft,S<m&&(s=o=!1),this.clearInterval(),c||this.isColSelected||this.isRowSelected||(r=W(p.activeCell)),n||i||o||s?((i||s)&&(a=w,l=S),(h=function(){if((n||i)&&!d.isColSelected){if((w=d.getRowIdxFromClientY({clientY:n?b:C}))>=p.rowCount)return void d.clearInterval();u.scrollTop+=(n?1:-1)*gh(p,w)}if((o||s)&&!d.isRowSelected){if((S=d.getColIdxFromClientX({clientX:o?y:v}))>=p.colCount)return void d.clearInterval();f.scrollLeft+=(o?1:-1)*wh(p,S)}i&&p.frozenRows&&!u.scrollTop||s&&p.frozenColumns&&!f.scrollLeft?(d.selectRangeByIdx([].concat(r[0],r[1],[a,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($l,g={e:e,indexes:null}),t=x=g.indexes),this.selectRangeByIdx(x,e)),c&&this.parent.isEdit&&!J.closest(e.target,"#"+this.parent.element.id+"_edit")&&(I=(this.isautoFillClicked?ee(t):this.parent.getActiveSheet().selectedRange).split(" "),this.parent.notify(ul,{range:I[I.length-1],isSelect:!1})))},d.prototype.mouseUpHandler=function(e){var t=this.getRowIdxFromClientY({clientY:ad(e),target:e.target}),r=this.getColIdxFromClientX({clientX:sd(e),target:e.target}),n=(this.clearInterval(),!td(e)||this.isColSelected||this.isRowSelected||this.getRowIdxFromClientY({clientY:ad(this.touchEvt),target:e.target})!==t||this.getColIdxFromClientX({clientX:sd(this.touchEvt),target:e.target})!==r||this.mouseDownHandler(e),document.removeEventListener(Zh().split(" ")[0],this.mouseMoveEvt),J.Browser.isPointer||document.removeEventListener(Zh().split(" ")[1],this.mouseMoveEvt),J.EventHandler.remove(document,Jh(),this.mouseUpHandler),this.parent.getActiveSheet());(n.frozenRows||n.frozenColumns)&&Yh(this.parent.element,null,"e-cur-selection",!0,!0),this.parent.notify(Es,e),this.isautoFillClicked?(n=Q(this.parent.getActiveSheet().selectedRange),this.isColSelected&&n[1]===r||this.isRowSelected&&n[0]===t||this.parent.notify(Kl,{event:e,dAutoFillCell:this.dAutoFillCell}),this.isautoFillClicked=!1):e.ctrlKey||Fd(Ii(this.parent.getActiveSheet()))?this.parent.notify(Zl,null):this.parent.notify(Yl,null),this.updateFormulaCursorPosition(e)},d.prototype.updateFormulaCursorPosition=function(e){var t;this.parent.isEdit&&(this.parent.notify(us,t={action:"getCurrentEditValue",editedValue:""}),X(t.editedValue,!0))&&this.parent.notify(dl,{isCellEdit:e.target.classList.contains("e-spreadsheet-edit")})},d.prototype.isSelected=function(e,t){for(var r,n=!1,i=this.parent.getActiveSheet().selectedRange.split(" "),o=0;o<i.length;o++)if((r=te(Q(i[o])))[0]<=e&&e<=r[2]&&r[1]<=t&&t<=r[3]){n=!0;break}return n},d.prototype.virtualContentLoadedHandler=function(n){var i,o,s,a=this,l=this.parent.getActiveSheet();l.selectedRange.split(" ").forEach(function(e,t){var r;i=Q(e),s=0===i[1]&&i[3]===n.prevRowColCnt.colCount-1,o=0===i[0]&&i[2]===n.prevRowColCnt.rowCount-1,s||o?(i=o&&s?[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?a.selectRangeByIdx(i,{type:"mousedown",ctrlKey:0!==t},!1,!1,!1,!1,void 0,!0):a.selectRangeByIdx(i,null,!0,null,null,null,t)):(i=Q(e),e=a.parent.viewport.topIndex+a.parent.frozenRowCount(l),r=a.parent.viewport.leftIndex+a.parent.frozenColCount(l),a.highlightHdr(i,0!==t,i[0]>=e||i[2]>=e,i[1]>=r||i[3]>=r))})},d.prototype.clearInterval=function(){this.scrollInterval&&(clearInterval(this.scrollInterval),this.scrollInterval=null)},d.prototype.getScrollLeft=function(){return this.parent.scrollModule?this.parent.scrollModule.prevScroll.scrollLeft:0},d.prototype.cellNavigateHandler=function(e){var t=this.parent.getActiveSheet();t.isProtected&&!t.protectSettings.selectCells&&!t.protectSettings.selectUnLockedCells||this.selectRangeByIdx(e.range.concat(e.range),void 0,!1,!1,!1,!1,void 0,e.preventAnimation)},d.prototype.getColIdxFromClientX=function(e){var t,r,n=0,i=this.parent.getActiveSheet(),o=0;e.isImage?o=e.clientX:(t=document.getElementById(this.parent.element.id+"_sheet").getBoundingClientRect(),o=this.parent.enableRtl?t.right-this.parent.sheetModule.getRowHeaderWidth(i,!0)-1-e.clientX:e.clientX-(t.left+this.parent.sheetModule.getRowHeaderWidth(i,!0)+1),o+=this.parent.viewport.beforeFreezeWidth,e.target&&(J.closest(e.target,".e-row-header")||J.closest(e.target,".e-selectall-container"))&&!this.isScrollableArea(e.clientX,e.target,!0)||(this.parent.frozenColCount(i)?(t=this.parent.element.querySelector(".e-frozen-column"),o=parseInt(t.style.left,10)>o?o:o+this.getScrollLeft()):o+=this.getScrollLeft()));for(var s=0;;s++)if(r=n+=wh(i,s,null,!e.isImage),o<(e.isImage?Number(Pd(r).toFixed(2)):r)||this.parent.scrollSettings.isFinite&&s===i.colCount-1)return e.isImage||(e.size=o),e.clientX=s},d.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)},d.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:0)),e.target&&J.closest(e.target,".e-header-panel")&&!this.isScrollableArea(e.clientY,e.target)||(o+=this.parent.getMainContent().parentElement.scrollTop));for(var s=0;;s++)if(r=n+=gh(i,s,!e.isImage),o<(e.isImage?Number(Pd(r).toFixed(2)):r)||this.parent.scrollSettings.isFinite&&s===i.rowCount-1)return e.isImage||(e.size=o),e.clientY=s},d.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),Gh(this.parent,t,e,"e-formularef-indicator"))},d.prototype.isMouseEvent=function(e){return rd(e)||id(e)||nd(e)},d.prototype.selectRangeByIdx=function(e,t,r,n,i,o,s,a){var l=this,h=t&&this.isMouseEvent(t);if(!(t&&t.target&&h&&J.closest(t.target,"#"+this.parent.element.id+"_edit"))){var d,p,c={action:"getCurrentEditValue",editedValue:"",endFormulaRef:!1},c=(this.parent.notify(us,c),!!this.parent.isEdit&&X(c.editedValue,!0)&&!c.endFormulaRef),u=t&&t.ctrlKey&&rd(t),f=(u||(d=this.getSelectionElement(t,s)),this.parent.getActiveSheet()),g=Q(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(Or,o),e!==o.range&&(p=!0),e=o.range,new Promise(function(e){e(void 0)})),C={range:ee(e),cancel:!1};if(f.isProtected){var b=ie(e[2],e[3],f);if(f.protectSettings.selectUnLockedCells&&!f.protectSettings.selectCells)if(J.isNullOrUndefined(b)){if(!f.protectSettings.selectCells)return}else{if(!0===b.isLocked||J.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(Xl,null),!he(e)&&!o.isActiveCell||u){if(u){if(void 0===s){b=ee(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,s)}if(c&&this.parent.isEdit){if(t&&t.target&&(!h||!t.target.classList.contains("e-spreadsheet-edit"))&&this.parent.isEdit){S={range:ee(e),isSelect:!0};if(this.parent.notify(ul,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",nd(t)&&d.classList.contains("e-cur-selection")?d.classList.add("e-hide"):d.classList.add(x)),!u)&&(this.isColSelected||this.isRowSelected)&&rd(t)&&(Yh(this.parent.getSelectAllContent(),null,"e-selection"),Yh(this.parent.getColumnHeaderContent(),null,"e-selection"),Yh(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=Gh(this.parent,d,e,x,a,u,u&&!t.target)||y}}else if(d&&(d.classList.contains("e-multi-range")||d.classList.add("e-hide"),f.frozenRows||f.frozenColumns)&&(x=nd(t)?"e-cur-selection":"e-selection",Yh(this.parent.getSelectAllContent(),null,x,!0),Yh(this.parent.getColumnHeaderContent(),null,x,!0),Yh(this.parent.getRowHeaderContent(),null,x,!0)),f.frozenColumns||f.frozenRows||!d||Gh(this.parent,d,e),c&&t&&t.target&&(!h||!t.target.classList.contains("e-spreadsheet-edit"))&&this.parent.isEdit){var S={range:ee(e).split(":")[0],isSelect:!0};if(this.parent.notify(ul,S),S.isAlertDlgOpen)return;this.initFormulaReferenceIndicator(e)}var w,m={action:"getCurrentEditSheetIdx",sheetIndex:null},o=(this.parent.notify(us,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),ee(e));t&&t.ctrlKey&&(nd(t)||id(t))&&!c?o=f.selectedRange.slice(0,f.selectedRange.lastIndexOf(" "))+" "+o:-1<s&&((w=f.selectedRange.split(" "))[s]=o,o=w.join(" ")),c||this.isautoFillClicked?i||this.isautoFillClicked||wi(this.parent,o,f,u):(b=!1,f.selectedRange!==o&&(b=!0),wi(this.parent,o,f,u),b&&y.then(function(){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||ed(t))||(c?m.sheetIndex===this.parent.getActiveSheet().id-1&&i?this.updateActiveCell((n=!0)?Q(f.activeCell):e,i,a):this.parent.isEdit||this.updateActiveCell(n?Q(f.activeCell):e,i,a):this.updateActiveCell(n?Q(f.activeCell):e,i,a)),J.isNullOrUndefined(t)&&(t={type:"mousedown"}),c&&i||this.parent.notify(dn,t),u||Fd(Ii(this.parent.getActiveSheet()))?this.parent.notify(Zl,null):this.parent.notify(Yl,{preventAnimation:a}),this.parent.showAggregate&&this.parent.notify(il,{}),this.parent.notify(vl,null)}}},d.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}},d.prototype.updateActiveCell=function(e,t,r){var n,i,o=this.parent.getActiveSheet(),s=Q(o.topLeftCell),a=(i=(this.isColSelected?s:e)[0],e[1]),s={range:[i,a=this.isRowSelected?s[1]:a].concat([i,a])};this.parent.notify(Tr,s),e!==s.range&&(n=!0),o.activeCell!==G((e=s.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"),(a=Vn(ie(e[0],e[1],o),se(o,e[1])))&&i&&!i.disabled?i.disabled=!0:!a&&i&&i.disabled&&(i.disabled=!1)),this.getActiveCell()&&(s=this.getOffset(e[2],e[3]),n&&(s.left={idx:0,size:0}),Gh(this.parent,this.getActiveCell(),e,"e-active-cell",r)),this.parent.notify(Lt,null)):Gh(this.parent,this.getActiveCell(),e,"e-active-cell",r)},d.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},d.prototype.getSelectionElement=function(e,t){var r,n=this.parent.getActiveSheet();return e&&e.ctrlKey&&!this.parent.isEdit?id(e)||nd(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"),Gh(this.parent,e,te(Q(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){J.remove(e)}),this.parent.getMainContent().getElementsByClassName("e-selection")[0])},d.prototype.getActiveCell=function(){return this.parent.getMainContent().getElementsByClassName("e-active-cell")[0]},d.prototype.getSheetElement=function(){return document.getElementById(this.parent.element.id+"_sheet")},d.prototype.highlightHdr=function(e,t,r,n){var i,o,s,a,l,h,d,p,c,u=this,f=(void 0===r&&(r=!0),void 0===n&&(n=!0),this.parent.getActiveSheet());f.showHeaders&&(t||(J.removeClass(this.getSheetElement().querySelectorAll(".e-highlight"),"e-highlight"),J.removeClass(this.getSheetElement().querySelectorAll(".e-prev-highlight"),"e-prev-highlight")),(t=this.parent.element.getElementsByClassName("e-select-all-cell")[0])&&J.removeClass([t],["e-prev-highlight-right","e-prev-highlight-bottom"]),i=[],o=[],s=te(e),this.isRowSelected&&(s[1]=K(f,s[1],!0,"columns")),this.isColSelected&&(s[0]=K(f,s[0],!0)),a=[0,0,0,0],l=[0,0,0,0],h=W(f.topLeftCell),e=function(e,t,r){var n,i,o;e&&s[p]<e?(h[p]=K(f,h[p],!0,t),(o=K(f,s[p],!0,t))===h[p]&&(s[p]=o),n=u.parent.hiddenCount(h[p],s[p]-1,t,f),a[p]=s[p]-n-h[p],i=s[c]<e?s[c]:e-1,a[c]=i-u.parent.hiddenCount(s[p],i,t,f)-n-h[p]+1,i=u.parent.viewport[""+r]+e,s[c]>=i&&(l[p]=0,l[p]-=u.parent.hiddenCount(i,i,t,f),l[c]=s[c]-u.parent.hiddenCount(i,s[c],t,f)-i+1)):((i=K(f,u.parent.viewport[""+r]+e,!0,t))===(o=K(f,s[p],!0,t))&&(s[p]=i),n=u.parent.hiddenCount(i,s[p]-1,t,f),l[p]=s[p]-n-i,l[c]=s[c]-u.parent.hiddenCount(s[p],s[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(a,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(a,r,o),d(l,this.parent.getColumnHeaderContent(),o)),f.isProtected&&!f.protectSettings.selectCells?J.removeClass([].concat(i,o),"e-highlight"):J.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)&&(K(f,s[0],!0)===K(f,0,!0)&&t.classList.add("e-prev-highlight-bottom"),K(f,s[1],!0,"columns")===K(f,0,!0,"columns"))&&t.classList.add("e-prev-highlight-right")},d.prototype.protectHandler=function(){var e=Q(this.parent.getActiveSheet().selectedRange),t=te(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)},d.prototype.initiateFormulaSelection=function(e){this.processFormulaEditRange(e.range,e.formulaSheetIdx)},d.prototype.processFormulaEditRange=function(e,t){for(var r,n,i=t,o=0,e={formula:e},s=(this.parent.notify(yn,e),e.formulaArr),a=s.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<a&&(n=s[o],!(-1<this.invalidOperators.indexOf(n)));)On(n.toUpperCase())&&(n=n.replace(/\$/g,""),0<o&&s[o-1].indexOf("!")===s[o-1].length-1&&(r=s[o-1].split("!"),i=B(this.parent,r[0].substring(1,r[0].length-1))),":"===s[o+1]&&s[++o+1]&&On(s[o+1].toUpperCase())&&(n=n+":"+s[o+1],o++),d===i&&this.updateFormulaEditRange(n,l,h),i=t,l++),o++},d.prototype.updateFormulaEditRange=function(e,t,r){var n=Q(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])},d.prototype.chartBorderHandler=function(e){this.focusBorder(e.startcell,e.endcell,e.classes,!0)},d.prototype.focusBorder=function(e,t,r,n){n=!J.isNullOrUndefined(n)&&n;var i,o=this.parent.getActiveSheet(),e=te([e.rowIndex,e.colIndex,t.rowIndex,t.colIndex]),t=Q(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"})),Gh(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"))}))},d.prototype.getEleFromRange=function(e){var t,r,n,i=e[0],o=e[1],s=e[2],a=e[3],l=[];if(s<i&&(r=i,i=s,s=r),a<o&&(r=o,o=a,a=r),this.parent.scrollSettings.enableVirtualization)for(t=i;t<=s;t++)-1<(n=t)&&(n=this.parent.getRow(n,null))&&(n=n.getElementsByClassName("e-cell"),n=a===o?[n[a]]:this.getRowCells(n,o,a+1),this.merge(l,n));return l},d.prototype.getRowCells=function(e,t,r){for(var n=[];t<r;t++)e[t]&&n.push(e[t]);return n},d.prototype.merge=function(e,t){e&&t&&Array.prototype.push.apply(e,t)},d.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){J.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])},d.prototype.getModuleName=function(){return"selection"},d.prototype.destroy=function(){this.removeEventListener(),this.parent=null};var rp=d;function d(e){this.invalidOperators=["%"],this.formulaRange=[],this.isNoteTouch=!1,this.parent=e,this.addEventListener(),this.mouseMoveEvt=this.mouseMoveHandler.bind(this)}ip.prototype.onContentScroll=function(e){var t,r,n,i,o,s,a;this.parent&&(t=this.parent.getMainContent().parentElement,a=e.scrollLeft,t=e.scrollTop||t.scrollTop,r=a&&this.parent.enableRtl?this.initScrollValue-a:a,this.parent.allowAutoFill&&(i=document.querySelector("#"+this.parent.element.id+"_autofilloptionbtn-popup"),s=document.querySelector("#"+this.parent.element.id+"_autofilloptionbtn"),i)&&J.getComponent(s,"dropdown-btn").toggle(),J.isNullOrUndefined(a)||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=a,this.parent.getMainContent().scrollLeft=a,e.scrollLeft=a),n={cur:this.offset.left,prev:{idx:this.leftIndex,size:o},increase:i,preventScroll:e.preventScroll},this.updateTopLeftCell(i,!0),this.parent.notify(bs,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}),s=t>this.prevScroll.scrollTop,o=this.offset.top.size,this.offset.top=this.getRowOffset(t,s),n={cur:this.offset.top,prev:{idx:this.topIndex,size:o},increase:s,preventScroll:e.preventScroll},this.updateTopLeftCell(s),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(Cs,n),this.updateNoteContainer()),this.parent.scrollSettings.enableVirtualization||!s||this.parent.scrollSettings.isFinite||this.updateNonVirtualRows(),this.topIndex=n.prev.idx,this.prevScroll.scrollTop=t),this.parent.notify(hs,a={isEdit:!1}),a.isEdit&&this.parent.element.querySelector(".e-formula-bar").focus(),this.isKeyScroll=!0)},ip.prototype.updateNoteContainer=function(){document.getElementsByClassName("e-addNoteContainer")&&0<document.getElementsByClassName("e-addNoteContainer").length&&this.parent.notify(ma,null)},ip.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)},ip.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)},ip.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)},ip.prototype.updateTopLeftCell=function(e,t){var r=this.parent.getActiveSheet(),n=this.offset.top.idx,i=this.offset.left.idx;e||(n=K(r,n+(e=this.parent.frozenRowCount(r)),!0)-e,i=K(r,i+(e=this.parent.frozenColCount(r)),!0,"columns")-e),t?this.parent.updateTopLeftCell(null,i,"row"):this.parent.updateTopLeftCell(n,null,"col")},ip.prototype.getRowOffset=function(e,t){var r=this.offset.top.size,n=this.parent.getActiveSheet(),i=t?this.offset.top.idx+1:this.offset.top.idx?this.offset.top.idx-1:0,o=this.parent.frozenRowCount(n),s=this.parent.scrollSettings.isFinite?n.rowCount:1/0;for(e=Math.round(e);i<s;)if(t){if(r+=gh(n,i-1+o,!0),Math.abs(Math.round(r)-e)<=1)return{idx:K(n,i+o,!0)-o,size:r};if(Math.round(r)>e)return{idx:i-1,size:r-gh(n,i-1+o,!0)};i++}else{if((r-=gh(n,i+o,!0))<=0)return{idx:0,size:0};if(Math.abs(Math.round(r)-e)<=1)return{idx:i,size:r};if(Math.round(r)<e)return r+=gh(n,i+o,!0),Math.round(r)>e?{idx:i,size:r-gh(n,i+o,!0)<0?0:r-gh(n,i+o,!0)}:{idx:K(n,i+1+o,!0)-o,size:r};i--}return{idx:this.offset.top.idx,size:this.offset.top.size}},ip.prototype.getColOffset=function(e,t,r){for(var n=this.offset.left.size,i=this.parent.getActiveSheet(),o=t?this.offset.left.idx+1:this.offset.left.idx?this.offset.left.idx-1:0,s=this.parent.frozenColCount(i),a=this.parent.scrollSettings.isFinite?i.colCount:1/0;o<a;)if(t){if(n+=wh(i,o-1+s,r,!0),Math.abs(Math.round(n)-e)<=1)return{idx:K(i,o+s,!0,"columns")-s,size:n};if(Math.round(n)>e)return{idx:o-1,size:n-wh(i,o-1+s,r,!0)};o++}else{if((n-=wh(i,o+s,r,!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+=wh(i,o+s,r,!0),Math.round(n)>e?{idx:o,size:(n-=wh(i,o+s,r,!0))<0?0:n}:{idx:K(i,o+1+s,!0,"columns")-s,size:n};o--}return{idx:this.offset.left.idx,size:this.offset.left.size}},ip.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)},ip.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"},ip.prototype.onHeaderWheel=function(e){e.preventDefault(),this.parent.getMainContent().parentElement.scrollTop+=e.deltaY,this.parent.getScrollElement().scrollLeft+=e.deltaX},ip.prototype.onContentWheel=function(e){0!==e.deltaX&&(e.preventDefault(),this.parent.getScrollElement().scrollLeft+=e.deltaX)},ip.prototype.scrollHandler=function(e){this.onContentScroll({scrollLeft:e.target.scrollLeft})},ip.prototype.updateScroll=function(e){J.isNullOrUndefined(e.left)?this.parent.sheetModule.contentPanel.scrollTop=e.top:this.parent.getScrollElement().scrollLeft=e.left},ip.prototype.setScrollEvent=function(e){(e=void 0===e?{set:!0}:e).set?(J.EventHandler.add(this.parent.sheetModule.contentPanel,"scroll",this.onContentScroll,this),J.EventHandler.add(this.parent.getColumnHeaderContent(),"wheel",this.onHeaderWheel,this),J.EventHandler.add(this.parent.getSelectAllContent(),"wheel",this.onHeaderWheel,this),J.EventHandler.add(this.parent.getMainContent(),"wheel",this.onContentWheel,this),J.EventHandler.add(this.parent.getRowHeaderContent(),"wheel",this.onContentWheel,this),J.EventHandler.add(this.parent.getScrollElement(),"scroll",this.scrollHandler,this)):(J.EventHandler.remove(this.parent.sheetModule.contentPanel,"scroll",this.onContentScroll),J.EventHandler.remove(this.parent.getColumnHeaderContent(),"wheel",this.onHeaderWheel),J.EventHandler.remove(this.parent.getSelectAllContent(),"wheel",this.onHeaderWheel),J.EventHandler.remove(this.parent.getMainContent(),"wheel",this.onContentWheel),J.EventHandler.remove(this.parent.getRowHeaderContent(),"wheel",this.onContentWheel),J.EventHandler.remove(this.parent.getScrollElement(),"scroll",this.scrollHandler))},ip.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}}},ip.prototype.setPadding=function(e){this.parent.sheetModule.contentPanel.style.overflowY="scroll";var t,r,n=Uh();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)},ip.prototype.setClientX=function(e){var t;"mousedown"===e.type||"mouse"===e.pointerType||(this.parent.notify(jl,t={touchSelectionStarted:!1}),t.touchSelectionStarted)||t.isOverlayClicked||(this.clientX=this.getPointX(e),t=document.getElementById(this.parent.element.id+"_sheet"),J.EventHandler.add(t,J.Browser.isPointer?"pointermove":"touchmove",this.onTouchScroll,this),J.EventHandler.add(t,J.Browser.isPointer?"pointerup":"touchend",this.pointerUpHandler,this))},ip.prototype.getPointX=function(e){return(e.touches&&e.touches.length?e.touches[0]:e).clientX},ip.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,Ph(function(){n.scrollLeft+=r}))},ip.prototype.pointerUpHandler=function(){var e=document.getElementById(this.parent.element.id+"_sheet");J.EventHandler.remove(e,J.Browser.isPointer?"pointermove":"touchmove",this.onTouchScroll),J.EventHandler.remove(e,J.Browser.isPointer?"pointerup":"touchend",this.pointerUpHandler)},ip.prototype.addEventListener=function(){this.parent.on(ds,this.contentLoaded,this),this.parent.on(ta,this.onContentScroll,this),this.parent.on(Gl,this.updateScroll,this),this.parent.on(ra,this.initProps,this),this.parent.on(cs,this.destroy,this),this.parent.on(Va,this.setScrollEvent,this),this.parent.on(ps,this.setClientX,this),this.parent.on(th,this.updateScrollValue,this),this.parent.scrollSettings.enableVirtualization||(this.parent.on(ws,this.updateNonVirualScrollWidth,this),this.parent.on(ea,this.updateNonVirualScrollWidth,this))},ip.prototype.destroy=function(){this.removeEventListener();var e=document.querySelector("#"+this.parent.element.id+"_autofilloptionbtn");e&&(e=J.getComponent(e,"dropdown-btn"))&&e.destroy(),this.parent=null},ip.prototype.removeEventListener=function(){this.parent.off(ds,this.contentLoaded),this.parent.off(ta,this.onContentScroll),this.parent.off(Gl,this.updateScroll),this.parent.off(ra,this.initProps),this.parent.off(cs,this.destroy),this.parent.off(Va,this.setScrollEvent),this.parent.off(ps,this.setClientX),this.parent.off(th,this.updateScrollValue),this.parent.scrollSettings.enableVirtualization||(this.parent.off(ws,this.updateNonVirualScrollWidth),this.parent.off(ea,this.updateNonVirualScrollWidth))};var np=ip;function ip(e){this.clientX=0,this.isKeyScroll=!0,this.parent=e,this.addEventListener(),this.initProps()}sp.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),s=(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)),a=W(t.topLeftCell),l=(e.top&&(i=e.top,t.frozenRows&&(i+=vh(t,a[0],s-1,!0)),s=W(t.paneTopLeftCell)[0]),i+=vh(t,s,this.scroll[this.parent.activeSheetIndex].rowCount-1,!0),o=this.parent.viewport.rightIndex,0),h=this.parent.frozenColCount(t),s=e.left?(l=e.left,h&&(l+=Ih(t,a[1],h-1,!0)),W(t.paneTopLeftCell)[1]):h,a=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+=Ih(t,s,o,!0),this.setScrollCount(t.colCount,"col"),l+Ih(t,o+1,this.scroll[this.parent.activeSheetIndex].colCount-1,!0)):(this.parent.scrollSettings.isFinite||this.parent.setSheetPropertyOnMute(t,"colCount",o+1),l+=Ih(t,s,t.colCount-1,!0),this.scroll[this.parent.activeSheetIndex].colCount=t.colCount,l),s=(J.isNullOrUndefined(this.parent.viewport.leftIndex)&&(this.parent.viewport.leftIndex=0),J.isNullOrUndefined(this.parent.viewport.topIndex)&&(this.parent.viewport.topIndex=0),e.left&&(l=Ih(t,this.parent.viewport.leftIndex+h,o,!0)),J.isNullOrUndefined(this.translateX)&&(this.translateX=0),J.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",s.style.height=i+"px",e.style.width=a+"px",this.colHeader.style.transform="translate("+this.translateX+"px, 0px)",this.content.style.transform="translate("+this.translateX+"px, "+this.translateY+"px)",this.content.style.width=l+"px",n.style.height=i+"px",n.style.width=a+"px",this.parent.allowScrolling&&((t=e.cloneNode(!0)).style.width=a+(this.parent.scrollSettings.isFinite?this.parent.sheetModule.getScrollSize():0)+"px",this.parent.getScrollElement().appendChild(t))},sp.prototype.initScroll=function(){for(var e=0;e<this.parent.sheets.length;)this.scroll[e]||this.scroll.push({rowCount:0,colCount:0}),e++},sp.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)},sp.prototype.getRowAddress=function(e){var t=this.parent.getActiveSheet();return ee([e[0],t.frozenColumns?W(t.topLeftCell)[1]:this.parent.viewport.leftIndex,e[1],this.parent.viewport.rightIndex])},sp.prototype.getColAddress=function(e){var t=this.parent.getActiveSheet();return ee([t.frozenRows?W(t.topLeftCell)[0]:this.parent.viewport.topIndex,e[0],this.parent.viewport.bottomIndex,e[1]])},sp.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)},sp.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 s,a=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?(a=K(h,d,!0),l=K(h,this.parent.viewport.topIndex+d-1,!1),this.parent.viewport.topIndex=a-d,f=this.skipHiddenLastIdx(this.parent.viewport.bottomIndex-(l-a+1-this.hiddenCount(a,l)),this.parent.viewport.bottomIndex),this.parent.viewport.bottomIndex=K(h,f,!1),this.parent.renderModule.refreshUI({colIndex:u,rowIndex:a,direction:"last",refresh:"RowPart",skipUpdateOnFirst:!0,frozenIndexes:p},this.getRowAddress([a,K(h,l,!1)]))):(s=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=s),this.translate({refresh:"Row"})),ae(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===K(h,h.rowCount-1,!1)){var d=this.parent.frozenRowCount(h),p=this.parent.viewport.topIndex+d+Q(h.paneTopLeftCell)[0]-1;if(p<t+d)return void(e.prev.idx=t);i=p-(t+d)}if(o<t){if(s=this.parent.viewport.topIndex,this.parent.viewport.topIndex=t-o,e.increase&&s>this.parent.viewport.topIndex)return void(this.parent.viewport.topIndex=s);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(a=this.parent.viewport.bottomIndex+1,l=this.parent.viewport.bottomIndex+(this.parent.viewport.topIndex-s),(l-=this.hiddenCount(s+d,this.parent.viewport.topIndex-1+d))<=this.parent.viewport.bottomIndex||this.parent.scrollSettings.isFinite&&a>K(h,h.rowCount-1,!1,"rows"))return void(this.parent.viewport.topIndex=s);p=this.parent.skipHidden(a,l,"rows",!1),i=this.checkLastIdx(p[1],"row"),a=p[0],l=i.index,p=this.parent.viewport.topIndex+d;i.diff&&(p=K(h,s,!0,"rows",l-a+1-this.hiddenCount(a,l))+d),this.parent.viewport.topIndex=K(h,p,!i.diff)-d,this.setThresholdHeight(r,t-this.parent.viewport.topIndex,d,!!i.diff,s===K(h,d,!0)),this.parent.viewport.bottomIndex=l,this.parent.renderModule.refreshUI({colIndex:u,rowIndex:a,direction:"first",refresh:"RowPart",frozenIndexes:n},this.getRowAddress([a,l]))}else{if((a=K(h,this.parent.viewport.topIndex+d,!1))<d&&(a=K(h,a=d,!0)),this.parent.viewport.topIndex=a-d,(l=K(h,s+d-1,!1))<d||l<a)return void(this.parent.viewport.topIndex=s);var f=this.skipHiddenLastIdx(this.parent.viewport.bottomIndex-(l-a+1-this.hiddenCount(a,l)),this.parent.viewport.bottomIndex);this.parent.viewport.bottomIndex=K(h,f,!1),this.setThresholdHeight(r,t-this.parent.viewport.topIndex,d),this.parent.renderModule.refreshUI({colIndex:u,rowIndex:a,direction:"last",refresh:"RowPart",frozenIndexes:n},this.getRowAddress([a,l]))}else s=this.parent.viewport.leftIndex,this.parent.viewport.topIndex=K(h,this.parent.viewport.topIndex+d,!1)-d,this.parent.viewport.topIndex<0&&(this.parent.viewport.topIndex=K(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=s),this.setThresholdHeight(r,t-this.parent.viewport.topIndex,d,this.parent.scrollSettings.isFinite&&this.parent.viewport.bottomIndex===K(h,h.rowCount-1,!1)),this.translate({refresh:"Row"});this.updateScrollCount(t,"row",o),this.focusSheet()}}e.prev.idx=t}},sp.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},sp.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},sp.prototype.checkLastIdx=function(e,t){var r,n=0;return this.parent.scrollSettings.isFinite&&(r=K(r=this.parent.getActiveSheet(),r[t+"Count"]-1,!1))<e&&(n=e-r,e=r),{index:e,diff:n}},sp.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 s,a=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?(a=K(h,d,!0,"columns"),l=K(h,this.parent.viewport.leftIndex+d-1,!1,"columns"),this.parent.viewport.leftIndex=a-d,f=this.skipHiddenLastIdx(this.parent.viewport.rightIndex-(l-a+1-this.hiddenCount(a,l,"columns")),this.parent.viewport.rightIndex,"columns"),this.parent.viewport.rightIndex=K(h,f,!1,"columns"),this.parent.renderModule.refreshUI({rowIndex:u,colIndex:a,direction:"last",refresh:"ColumnPart",skipUpdateOnFirst:!0,frozenIndexes:p},this.getColAddress([a,K(h,l,!1,"columns")]))):(s=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=s),this.translate({refresh:"Column"})),ae(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===K(h,h.colCount-1,!1,"columns")){var d=this.parent.frozenColCount(h),p=this.parent.viewport.leftIndex+d+Q(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(s=this.parent.viewport.leftIndex,this.parent.viewport.leftIndex=t-o,e.increase&&s>this.parent.viewport.leftIndex)return void(this.parent.viewport.leftIndex=s);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(a=this.parent.viewport.rightIndex+1,l=this.parent.viewport.rightIndex+(this.parent.viewport.leftIndex-s),(l-=this.hiddenCount(s+d,this.parent.viewport.leftIndex-1+d,"columns"))<=this.parent.viewport.rightIndex||this.parent.scrollSettings.isFinite&&a>K(h,h.colCount-1,!1,"columns"))return void(this.parent.viewport.leftIndex=s);p=this.parent.skipHidden(a,l,"columns",!1),i=this.checkLastIdx(p[1],"col"),a=p[0],l=i.index;this.parent.viewport.leftIndex=K(h,this.parent.viewport.leftIndex-i.diff+d,!i.diff,"columns")-d,this.setThresholdWidth(r,t-this.parent.viewport.leftIndex,d,!!i.diff,s===K(h,d,!0,"columns")),this.parent.viewport.rightIndex=l,this.parent.renderModule.refreshUI({rowIndex:u,colIndex:a,direction:"first",refresh:"ColumnPart",frozenIndexes:n},this.getColAddress([a,l]))}else{if((a=K(h,this.parent.viewport.leftIndex+d,!1,"columns"))<d&&(a=K(h,a=d,!0,"columns")),this.parent.viewport.leftIndex=a-d,(l=K(h,s+d-1,!1,"columns"))<d||l<a)return void(this.parent.viewport.leftIndex=s);var f=this.skipHiddenLastIdx(this.parent.viewport.rightIndex-(l-a+1-this.hiddenCount(a,l,"columns")),this.parent.viewport.rightIndex,"columns");this.parent.viewport.rightIndex=K(h,f,!1,"columns"),this.setThresholdWidth(r,t-this.parent.viewport.leftIndex,d),this.parent.renderModule.refreshUI({rowIndex:u,colIndex:a,direction:"last",refresh:"ColumnPart",frozenIndexes:n},this.getColAddress([a,l]))}else s=this.parent.viewport.topIndex,this.parent.viewport.leftIndex=K(h,this.parent.viewport.leftIndex+d,!1,"columns")-d,this.parent.viewport.leftIndex<0&&(this.parent.viewport.leftIndex=K(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=s),this.setThresholdWidth(r,t-this.parent.viewport.leftIndex,d,this.parent.scrollSettings.isFinite&&this.parent.viewport.rightIndex===K(h,h.colCount-1,!1,"columns")),this.translate({refresh:"Column"});this.updateScrollCount(t,"col",o),this.focusSheet()}}e.prev.idx=t}},sp.prototype.focusSheet=function(){document.activeElement.classList.contains("e-text-findNext-short")&&J.closest(document.activeElement,"#"+this.parent.element.id)||ae(this.parent.element)},sp.prototype.setThresholdHeight=function(e,t,r,n,i){var o=this.parent.getActiveSheet(),s=this.parent.viewport.topIndex+r,t=s+t-1;this.translateY=n||i||t<s?s<=r?0:vh(o,r,s-1,!0):e-vh(o,s,t,!0)},sp.prototype.setThresholdWidth=function(e,t,r,n,i){var o=this.parent.getActiveSheet(),s=this.parent.viewport.leftIndex+r,t=s+t-1;this.translateX=n||i||t<s?s<=r?0:Ih(o,r,s-1,!0):e-Ih(o,s,t,!0)},sp.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)")},sp.prototype.updateColumnWidth=function(e){var t,r,n,i;"Column"===e.refresh?(this.content.style.width="",r=Ih(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)))},sp.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+=vh(t,this.scroll[this.parent.activeSheetIndex].rowCount,e.index,!0):n+=vh(t,e.start,e.end,!0):void 0===e.start?n-=vh(t,e.index+1,this.scroll[this.parent.activeSheetIndex].rowCount-1,!0):n-=vh(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+=Ih(t,this.scroll[this.parent.activeSheetIndex].colCount,e.index,!0):n+=Ih(t,e.start,e.end,!0):void 0===e.start?n-=Ih(t,e.index+1,this.scroll[this.parent.activeSheetIndex].colCount-1,!0):n-=Ih(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))))},sp.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)},sp.prototype.updateVTrackHeight=function(e){var t=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>=t&&e.rowIdx<this.parent.viewport.topIndex+t&&(t=this.parent.element.getElementsByClassName("e-main-panel")[0],this.parent.scrollModule.prevScroll.scrollTop=t.scrollTop+e.threshold,this.parent.scrollModule.offset.top.size+=e.threshold,t.scrollTop+=e.threshold,this.translateY+=e.threshold,this.translate({refresh:"Row"}))},sp.prototype.updateVTrackWidth=function(e){var t,r;Eh(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"})))},sp.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")},sp.prototype.deInitProps=function(){this.parent.viewport.leftIndex=null,this.parent.viewport.topIndex=null,this.parent.viewport.bottomIndex=null,this.translateX=null,this.translateY=null},sp.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})})},sp.prototype.sliceScrollProps=function(e){J.isNullOrUndefined(e.sheetIndex)?this.scroll.length=0:this.scroll.splice(e.sheetIndex,1)},sp.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"}))},sp.prototype.addEventListener=function(){this.parent.on(xs,this.createVirtualElement,this),this.parent.on(Ss,this.translate,this),this.parent.on(ws,this.updateColumnWidth,this),this.parent.on(Nl,this.updateColumnWidth,this),this.parent.on(Cs,this.onVerticalScroll,this),this.parent.on(bs,this.onHorizontalScroll,this),this.parent.on(At,this.updateRowColCount,this),this.parent.on(Qs,this.updateVTrackHeight,this),this.parent.on(ea,this.updateVTrackWidth,this),this.parent.on(ra,this.deInitProps,this),this.parent.on(Ht,this.sliceScrollProps,this),this.parent.on(Bt,this.updateScrollProps,this),this.parent.on(Ql,this.updateTranslate,this),this.parent.on(cs,this.destroy,this)},sp.prototype.destroy=function(){this.removeEventListener();var e=document.querySelectorAll(".e-addNoteIndicator");e&&e.forEach(function(e){e.remove()}),this.rowHeader&&(Mh(this.rowHeader),this.rowHeader.remove()),this.colHeader&&(Mh(this.colHeader),this.colHeader.remove()),this.content&&(Mh(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},sp.prototype.removeEventListener=function(){this.parent.off(xs,this.createVirtualElement),this.parent.off(Ss,this.translate),this.parent.off(ws,this.updateColumnWidth),this.parent.off(Nl,this.updateColumnWidth),this.parent.off(Cs,this.onVerticalScroll),this.parent.off(bs,this.onHorizontalScroll),this.parent.off(At,this.updateRowColCount),this.parent.off(Qs,this.updateVTrackHeight),this.parent.off(ea,this.updateVTrackWidth),this.parent.off(Ht,this.sliceScrollProps),this.parent.off(Bt,this.updateScrollProps),this.parent.off(Ql,this.updateTranslate),this.parent.off(cs,this.destroy)};var op=sp;function sp(e){this.scroll=[],this.parent=e,this.addEventListener()}lp.prototype.addEventListener=function(){this.parent.on(ys,this.keyDownHandler,this)},lp.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off(ys,this.keyDownHandler)},lp.prototype.keyDownHandler=function(t){var r=this,e=t.target;if(t.altKey&&38===t.keyCode&&this.parent.element.lastElementChild.classList.contains("e-filter-popup"))this.parent.notify(Pa,{closePopup:!0});else if(t.ctrlKey&&80===t.keyCode&&this.parent.allowPrint)t.preventDefault(),this.parent.print();else{var n=t.target;if(!J.isNullOrUndefined(n)&&n.classList.contains("e-addNoteContainer"))"Escape"===t.key&&(m=ie((i=W(this.parent.getActiveSheet().activeCell))[0],i[1],this.parent.getActiveSheet()),s=this.parent.getCell(i[0],i[1]),o=ki(this.parent,this.parent.activeSheetIndex)+"!"+this.parent.getActiveSheet().activeCell,!J.isNullOrUndefined(n)&&!J.isNullOrUndefined(n.value)&&(J.isNullOrUndefined(m)||J.isNullOrUndefined(m.notes)||m.notes!==n.value)&&-1<document.activeElement.className.indexOf("e-addNoteContainer")&&(this.parent.notify(Ia,{args:{action:"beforeCellSave",eventArgs:{address:o}}}),Gn(this.parent,this.parent.getActiveSheet(),{rowIdx:i[0],colIdx:i[1],preventEvt:!0,cell:{notes:n.value,isNoteEditable:!1}}),h={notes:n.value,address:o},this.parent.notify(oe,{eventArgs:h,action:"addNote"})),this.parent.spreadsheetNoteModule.isShowNote=null,this.parent.notify(va,""),ae(s));else{var i=this.parent.serviceLocator.getService(k).dialogInstance,n=e.id===this.parent.element.id+"_name_box";if("None"===this.parent.selectionSettings.mode||i||this.parent.isEdit||e.classList.contains("e-ss-ddb")&&117!==t.keyCode&&9!==t.keyCode||n&&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(i){if(13===t.keyCode)i.element.classList.contains("e-spreadsheet-function-dlg")&&(e.classList.contains("e-formula-list")||e.classList.contains("e-list-item"))&&ae(i.element.querySelector(".e-footer-content .e-primary"));else if(9===t.keyCode)if(i.element.classList.contains("e-find-dlg")){var o=i.element.querySelectorAll(".e-footer-content .e-btn:not(:disabled)"),s=o.length?o[o.length-1].className:"e-findnreplace-checkmatch";t.shiftKey?document.activeElement.classList.contains("e-dlg-closeicon-btn")&&(t.preventDefault(),o.length?ae(o[o.length-1]):(o=i.element.querySelector(".e-findnreplace-exactmatchcheckbox"))&&(ae(o.querySelector(".e-findnreplace-checkmatch")),o.classList.add("e-focus"))):document.activeElement.className.includes(s)&&ae(i.element)}else if(i.element.classList.contains("e-protect-dlg"))(t.shiftKey?document.activeElement.classList.contains("e-primary"):document.activeElement.id===this.parent.element.id+"_protect_check")&&(a=i.element.querySelector(".e-protect-option-list"))&&!a.querySelector(".e-list-item.e-focused")&&(c=a.querySelector(".e-list-item"))&&c.classList.add("e-focused");else if(i.element.classList.contains("e-custom-format-dlg"))if(t.shiftKey)document.activeElement.className.includes("e-list-item e-active")&&(a=J.closest(document.activeElement,".e-custom-listview"))&&ae(a);else if(document.activeElement.classList.contains("e-btn")&&document.activeElement.parentElement.classList.contains("e-custom-dialog")){var a=i.element.querySelector(".e-custom-listview"),l=J.getComponent(a,"listview");if(a){if(!(c=a.querySelector(".e-list-item.e-active"))){if(!(c=a.querySelector(".e-list-item")))return;l.selectItem(c)}t.preventDefault(),c.focus()}}else document.activeElement.classList.contains("e-list-item")&&ae(i.element);else i.element.classList.contains("e-spreadsheet-function-dlg")?t.shiftKey&&document.activeElement.className.includes("e-list-item e-active")&&(a=J.closest(document.activeElement,".e-formula-list"))&&ae(a):i.element.classList.contains("e-goto-dlg")&&!i.element.classList.contains("e-dlg-modal")&&(t.shiftKey?document.activeElement.className.includes("e-dlg-closeicon-btn")&&(o=i.element.querySelector(".e-footer-content .e-btn"))&&(t.preventDefault(),ae(o)):document.activeElement.className.includes("e-btn-goto-ok")&&ae(i.element))}else n&&9===t.keyCode&&t.shiftKey&&this.focusEle(t,".e-formula-bar",!1,!0);var h={action:"getCurrentEditValue",editedValue:""},s=(this.parent.notify(us,h),X(h.editedValue,!0));this.parent.isEdit&&s&&t.shiftKey&&!t.ctrlKey&&od(t.keyCode)&&this.shiftSelection(t)}else{var d=this.parent.getActiveSheet(),p=W(d.activeCell);if(t.altKey){if(40===t.keyCode){if(e.classList.contains("e-dropdown-btn")||e.classList.contains("e-split-btn"))return;var c={e:t,isFilterCell:!1};if(this.parent.notify(Pa,c),c.isFilterCell)return}if(40===t.keyCode&&!document.getElementById(this.parent.element.id+"listValid_popup"))if(m=this.parent.getCell(p[0],p[1])){a=m.querySelector(".e-validation-list .e-ddl");if(a)return ae(a),o=a.querySelector(".e-dropdownlist")||a,void((l=J.getComponent(o,"dropdownlist"))&&l.showPopup())}}e.id===this.parent.element.id+"_File"&&ae(this.parent.element);var u,f,g,m,i=e.classList.contains("e-add-sheet-tab")||e.classList.contains("e-sheets-list")||e.classList.contains("e-tab-wrap")&&!!J.closest(e,".e-sheet-tabs-items")||e.classList.contains("e-aggregate-list")||e.classList.contains("e-scroll-nav"),v=(-1<[9,37,38,39,40,33,34,35,36].indexOf(t.keyCode)&&!i&&t.preventDefault(),Q(d.selectedRange));if(36===t.keyCode){var y,h=this.parent.frozenColCount(d),s=void 0;t.ctrlKey||t.metaKey?(c=K(d,this.parent.frozenRowCount(d),!0),t.shiftKey?s=[p[0],p[1],c,K(d,h,!0,"columns")]:(s=[c,K(d,h,!0,"columns"),c])[3]=s[1],(b=this.parent.element.querySelector(".e-main-panel")).scrollTop&&(b.scrollTop=0),(a=this.parent.getScrollElement()).scrollLeft&&(a.scrollLeft=0)):t.shiftKey?(y=K(d,h,!0,"columns"),s=d.frozenColumns&&K(d,p[1],!0,"columns")===y?[v[0],p[1],v[2],K(d,0,!0,"columns")]:[v[0],p[1],v[2],y],this.scrollNavigation([s[2],s[3]],!0)):(y=K(d,h,!0,"columns"),!d.frozenColumns||y!==p[1]&&h!==p[1]||(y=K(d,0,!0,"columns")),s=[p[0],y,p[0],y],this.scrollNavigation([s[0],s[1]],!0)),this.updateSelection(d,s)}else if(t.ctrlKey||t.metaKey)35===t.keyCode?(t.preventDefault(),o=-1<(o=K(d,d.usedRange.rowIndex,!1))?o:d.usedRange.rowIndex,l=-1<(l=K(d,d.usedRange.colIndex,!1,"columns"))?l:d.usedRange.colIndex,t.shiftKey||(p[0]=o,p[1]=l),p[2]=o,p[3]=l,this.updateSelection(d,p),this.scrollNavigation([o,l],!0)):32!==t.keyCode||t.shiftKey||(v[0]=0,v[2]=d.rowCount-1,this.updateSelection(d,v)),40===t.keyCode||39===t.keyCode||38===t.keyCode||37===t.keyCode?t.shiftKey?(40===t.keyCode?v[2]=this.getNextNonEmptyCell(v[2],p[1],"down"):39===t.keyCode?v[3]=this.getNextNonEmptyCell(p[0],v[3],"right"):38===t.keyCode?v[2]=this.getNextNonEmptyCell(v[2],p[1],"top"):v[3]=this.getNextNonEmptyCell(p[0],v[3],"left"),this.updateSelection(d,v),this.scrollNavigation([v[2],v[3]],!0)):(37===t.keyCode?p[1]=this.getNextNonEmptyCell(p[0],p[1],"left"):38===t.keyCode?p[0]=this.getNextNonEmptyCell(p[0],p[1],"top"):39===t.keyCode?p[1]=this.getNextNonEmptyCell(p[0],p[1],"right"):p[0]=this.getNextNonEmptyCell(p[0],p[1],"down"),this.parent.selectRange(ee(p)),this.scrollNavigation([p[0],p[1]],!0)):117===t.keyCode&&((c=document.activeElement).classList.contains("e-spreadsheet")||J.closest(c,".e-sheet")?this.setFocus("Sheet",t,!0):i?this.setFocus("SheetTabs",t):J.closest(c,".e-ribbon")?this.setFocus("Ribbon",t):(n||c.classList.contains("e-insert-function"))&&this.setFocus("FormulaBar",t));else{if(t.shiftKey){if(32===t.keyCode&&(t.preventDefault(),v[1]=0,v[3]=d.colCount-1,this.updateSelection(d,v)),this.shiftSelection(t),(34===t.keyCode||33===t.keyCode)&&this.parent.scrollModule&&this.parent.scrollModule.isKeyScroll){var C=0,b=this.parent.element.querySelector(".e-main-panel"),a=K(d,W(d.paneTopLeftCell)[0],!0),x=Dd(this.parent,a).height;if(34===t.keyCode)C=x+this.parent.scrollModule.offset.top.size,this.parent.scrollSettings.isFinite||(N=this.parent.getMainContent().querySelector(".e-virtualtrack"))&&parseFloat(N.style.height)<C+x&&(N.style.height=C+x+"px");else if(C=this.parent.scrollModule.offset.top.size-x,Math.round(C)<0){if(!b.scrollTop)return void this.parent.selectRange(ee([v[0],v[1],a,v[3]]));C=0}var h=K(d,Q(d.selectedRange)[2],!0),S=h<a?0:h-a;this.parent.scrollModule&&b.scrollTop&&(this.parent.scrollModule.isKeyScroll=!1),b.scrollTop=C,Ph(function(){34===t.keyCode?(v[2]=K(d,W(d.paneTopLeftCell)[0]+S,!0),r.parent.scrollSettings.isFinite&&v[2]>d.rowCount-1&&(v[2]=K(d,d.rowCount-1,!1),v[2]=v[2]<0?0:v[2])):(v[2]=K(d,W(d.paneTopLeftCell)[0]+S,!1),v[2]=v[2]<0?0:v[2]),r.updateSelection(d,v)})}}else if(9===t.keyCode||(this.parent.enableRtl?37===t.keyCode:39===t.keyCode))(m=ie(p[0],p[1],d))&&1<m.colSpan&&(p[1]+=m.colSpan-1),p[1]<d.colCount-1&&(!d.isProtected||d.protectSettings.selectCells)?(p[1]+=1,u=!0):d.protectSettings.selectUnLockedCells&&(f=this.getNextUnlockedCell("right",p),u=p[1]!==f[1]||p[0]!==f[0],p[1]=f[1],p[0]=f[0]);else if(13===t.keyCode||40===t.keyCode)(m=ie(p[0],p[1],d))&&1<m.rowSpan&&(p[0]+=m.rowSpan-1),p[0]<d.rowCount-1&&(!d.isProtected||d.protectSettings.selectCells)?(u=!0,p[0]+=1):d.protectSettings.selectUnLockedCells&&(f=this.getNextUnlockedCell("down",p),u=p[0]!==f[0]||p[1]!==f[1],p[1]=f[1],p[0]=f[0]);else if((34===t.keyCode||33===t.keyCode)&&this.parent.scrollModule&&this.parent.scrollModule.isKeyScroll){var b=this.parent.element.querySelector(".e-main-panel"),C=0,w=K(d,W(d.paneTopLeftCell)[0],!0),I=K(d,W(d.activeCell)[0],!0),x=Dd(this.parent,w).height;if(34===t.keyCode)C=this.parent.scrollModule.offset.top.size+x,this.parent.scrollSettings.isFinite||(N=this.parent.getMainContent().querySelector(".e-virtualtrack"))&&parseFloat(N.style.height)<C+x&&(N.style.height=C+x+"px");else{if(C=this.parent.scrollModule.offset.top.size-x,d.frozenRows&&p[0]<this.parent.frozenRowCount(d))return void this.parent.selectRange(ee([w,v[1],w,v[1]]));if(Math.round(C)<0){if(!b.scrollTop)return;C=0}}var E=I<w?0:I-w;this.parent.scrollModule&&b.scrollTop&&(this.parent.scrollModule.isKeyScroll=!1),b.scrollTop=C,Ph(function(){var e;34===t.keyCode?(e=K(d,W(d.paneTopLeftCell)[0]+E,!0),r.parent.scrollSettings.isFinite&&e>d.rowCount-1&&(e=(e=K(d,d.rowCount-1,!1))<0?0:e)):(e=W(d.paneTopLeftCell)[0]+E,e-=r.parent.hiddenCount(w,I),e=(e=K(d,e,!1))<0?0:e),r.parent.notify(Is,{range:[e,p[1]],preventAnimation:!0})})}(t.shiftKey?9===t.keyCode:this.parent.enableRtl?39===t.keyCode:37===t.keyCode)?(0<p[1]&&(!d.isProtected||d.protectSettings.selectCells)?(--p[1],u=!0):d.protectSettings.selectUnLockedCells&&(f=this.getNextUnlockedCell("left",p),u=p[1]!==f[1]||p[0]!==f[0],p[1]=f[1],p[0]=f[0]),p[1]<=0&&(y=this.parent.getMainContent(),0===p[1])&&y.scrollLeft&&!this.parent.enableRtl&&(y.scrollLeft=0)):(t.shiftKey?13!==t.keyCode:38!==t.keyCode)||this.parent.element.querySelector(".e-find-toolbar")||(0<p[0]&&(!d.isProtected||d.protectSettings.selectCells)?(--p[0],u=!0):d.protectSettings.selectUnLockedCells&&(s=this.getNextUnlockedCell("up",p),u=p[0]!==s[0]||p[1]!==s[1],p[1]=s[1],p[0]=s[0]),p[0]<=0&&(o=this.parent.getMainContent().parentElement,0===p[0])&&o.scrollTop&&(o.scrollTop=0))}if(!u||this.parent.scrollModule&&!this.parent.scrollModule.isKeyScroll||i||J.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&&((l=this.parent.showRibbon&&J.closest(document.activeElement,".e-ribbon"))?J.closest(document.activeElement,".e-tab-header")?t.shiftKey||l.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"):J.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&&!l.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):i&&(t.shiftKey?(n=e.classList.contains("e-aggregate-list")||e.classList.contains("e-scroll-left-nav"),e.classList.contains("e-add-sheet-tab")||n||e.classList.contains("e-sheets-list")&&e.previousElementSibling&&e.previousElementSibling.disabled?(c=!n&&this.parent.element.querySelector(".e-aggregate-list"))?this.focusEle(t,null,!1,!1,c):!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):(g=[].slice.call(this.parent.element.querySelectorAll(".e-sheet-tab-panel .e-toolbar-item")))[g.length-1]&&this.focusEle(t,null,!0,!1,g[g.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===(f=(g=[].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,g[f-1].querySelector(".e-tab-wrap")))):(h=!!this.parent.element.querySelector(".e-aggregate-list"),e.classList.contains("e-aggregate-list")||!h&&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")&&((a=(g=[].slice.call(this.parent.element.querySelectorAll(".e-sheet-tab-panel .e-toolbar-item"))).indexOf(e.parentElement))===g.length-1?!(m=!!this.parent.element.querySelector(".e-sheet-tab-panel .e-scroll-nav"))&&h||this.focusEle(t,".e-sheet-tab-panel ."+(m?"e-scroll-nav":"e-icon-btn:not(:disabled)"),m):this.focusEle(t,null,!0,!1,g[a+1].querySelector(".e-tab-wrap"))))));else{if(40===t.keyCode||38===t.keyCode||13===t.keyCode)for(;$(d,p[0]);)if(40!==t.keyCode&&(t.shiftKey||13!==t.keyCode)||(p[0]=p[0]+1),(38===t.keyCode||t.shiftKey&&13===t.keyCode)&&(p[0]=p[0]-1,p[0]<0))return;if(37===t.keyCode||39===t.keyCode||9===t.keyCode)for(;Eh(d,p[1]);)if(39!==t.keyCode&&(t.shiftKey||9!==t.keyCode)||(p[1]=p[1]+1),(37===t.keyCode||t.shiftKey&&9===t.keyCode)&&(p[1]=p[1]-1,p[1]<0))return;this.scrollNavigation(p);var R=ee(p),N=function(e){var t;R!==d.selectedRange&&(r.parent.selectionModule.previousActiveCell=d.activeCell,document.getElementsByClassName("e-addNoteContainer")&&0<document.getElementsByClassName("e-addNoteContainer").length&&r.parent.notify(va,""),r.parent.setSheetPropertyOnMute(d,"activeCell",R),r.parent.notify(Is,{range:p,preventAnimation:e}),t=(t=J.Browser.isDevice&&"safari"===J.Browser.info.name&&(J.Browser.isIos||J.Browser.isIos7)?r.parent.element.querySelector(".e-ss-focus-edit"):t)||r.parent.getCell(p[0],p[1]))&&ae(t)};this.parent.scrollModule&&this.parent.scrollModule.isKeyScroll?R!==d.selectedRange&&Ph(N.bind(this,!0)):N()}}}}},lp.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"))},lp.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"))&&J.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(),ae(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()):ae(i))},lp.prototype.updateSelection=function(e,t){e.isProtected&&!e.protectSettings.selectCells&&e.protectSettings.selectUnLockedCells&&kd(this.parent,te(t))||this.parent.selectRange(ee(t))},lp.prototype.getNextNonEmptyCell=function(e,t,r){function n(e,t){return e=ie(e,t,o,null,!0).value,!J.isNullOrUndefined(e)&&""!==e}var i,o=this.parent.getActiveSheet();if("down"===r){for(var s=n(h=K(o,e+1,!0),t),a=K(o,o.rowCount-1,!1),l=h;l<o.rowCount;l++){if(l===a)return l;if(s){if(!n(K(o,l,!0),t))return K(o,l-1,!1)}else if(n(i=K(o,l+1,!0),t))return i}return e}if("top"===r){s=n(h=K(o,e-1,!1),t);for(var h,d=K(o,0,!0),p=h;0<=p;p--){if(p===d)return p;if(s){if(!n(K(o,p,!1),t))return K(o,p+1,!0)}else if(n(i=K(o,p-1,!1),t))return i}return e}if("right"===r){s=n(e,f=K(o,t+1,!0,"columns"));for(var c=K(o,o.colCount-1,!1,"columns"),u=f;u<o.colCount;u++){if(u===c)return u;if(s){if(!n(e,K(o,u,!0,"columns")))return K(o,u-1,!1,"columns")}else if(n(e,i=K(o,u+1,!0,"columns")))return i}}else{s=n(e,f=K(o,t-1,!1,"columns"));for(var f,d=K(o,0,!0,"columns"),g=f;0<=g;g--){if(g===d)return g;if(s){if(!n(e,K(o,g,!1,"columns")))return K(o,g+1,!0,"columns")}else if(n(e,i=K(o,g-1,!1,"columns")))return i}}return t},lp.prototype.getNextUnlockedCell=function(e,t){var r,n=this.parent.getActiveSheet();if("right"===e)for(var i=t[0],o=void 0,s=void 0,a=n.usedRange.rowIndex,l=n.usedRange.colIndex;i<=a;){for(o=void 0===o?t[1]+1:0,s&&i===t[0]&&(l=t[1]-1);o<=l;o++)if(!Vn(ie(i,o,n),r=se(n,o)||{})&&!r.hidden&&!$(n,i))return[i,o];i!==n.usedRange.rowIndex||s?i++:(a=t[i=0],s=!0)}else if("left"===e)for(i=t[0],o=void 0,s=void 0,a=0,l=0;a<=i;){for(o=void 0===o?t[1]-1:n.usedRange.colIndex,s&&i===t[0]&&(l=t[1]+1);l<=o;o--)if(!Vn(ie(i,o,n),r=se(n,o)||{})&&!r.hidden&&!$(n,i))return[i,o];0!==i||s?i--:(i=n.usedRange.rowIndex,a=t[0],s=!0)}else if("down"===e)for(o=t[1],i=void 0,s=void 0,l=n.usedRange.colIndex,a=n.usedRange.rowIndex;o<=l;){for(i=void 0===i?t[0]+1:0,s&&o===t[1]&&(a=t[0]-1);i<=a;i++)if(!Vn(ie(i,o,n),r=se(n,o)||{})&&!r.hidden&&!$(n,i))return[i,o];o!==n.usedRange.colIndex||s?o++:(l=t[1],s=!(o=0))}else for(o=t[1],i=void 0,s=void 0,l=0,a=0;l<=o;){for(i=void 0===i?t[0]-1:n.usedRange.rowIndex,s&&o===t[1]&&(a=t[0]+1);a<=i;i--)if(!Vn(ie(i,o,n),r=se(n,o)||{})&&!r.hidden&&!$(n,i))return[i,o];0!==o||s?o--:(o=n.usedRange.colIndex,l=t[1],s=!0)}return t},lp.prototype.shiftSelection=function(e){var t=this.parent.getActiveSheet(),r=Q(t.selectedRange),n=te(r),i=!0;if(38===e.keyCode){for(var o=n[1];o<=n[3];o++){var s=ie(r[2],o,t);if(!J.isNullOrUndefined(s)&&s.rowSpan&&s.rowSpan<0){r[2]=K(t,r[2]-(Math.abs(s.rowSpan)+1),!1),i=!1;break}}if(i&&(r[2]=K(t,r[2]-1,!1)),r[2]<0)return}if(40===e.keyCode){for(o=n[1];o<=n[3];o++){s=ie(r[2],o,t);if(!J.isNullOrUndefined(s)&&s.rowSpan&&0<s.rowSpan){r[2]=K(t,r[2]+Math.abs(s.rowSpan),!0),i=!1;break}}if(i&&(r[2]=K(t,r[2]+1,!0)),r[2]>=t.rowCount&&(r[2]=K(t,t.rowCount-1,!1),r[2]<0))return}if(39===e.keyCode){for(o=n[0];o<=n[2];o++){s=ie(o,r[3],t);if(!J.isNullOrUndefined(s)&&s.colSpan&&0<s.colSpan){r[3]=K(t,r[3]+Math.abs(s.colSpan),!0,"columns"),i=!1;break}}if(i&&(r[3]=K(t,r[3]+1,!0,"columns")),r[3]>=t.colCount&&(r[3]=K(t,t.colCount-1,!1,"columns"),r[3]<0))return}if(37===e.keyCode){for(o=n[0];o<=n[2];o++){s=ie(o,r[3],t);if(!J.isNullOrUndefined(s)&&s.colSpan&&s.colSpan<0){r[3]=K(t,r[3]-(Math.abs(s.colSpan)+1),!1,"columns"),i=!1;break}}if(i&&(r[3]=K(t,r[3]-1,!1,"columns")),r[3]<0)return}if(e.shiftKey&&e.ctrlKey&&!this.parent.scrollSettings.enableVirtualization){var a=[t.usedRange.rowIndex,t.usedRange.colIndex];if(37===e.keyCode&&(r[3]<=a[1]?r[3]=K(t,0,!0,"columns"):r[3]=K(t,a[1],!0,"columns")),38===e.keyCode&&(r[2]<=a[0]?r[2]=K(t,0,!0):r[2]=K(t,a[0],!0)),39===e.keyCode&&(r[3]<=a[1]?r[3]=K(t,a[1],!1,"columns"):r[3]=K(t,t.colCount,!1,"columns"),r[3]<0))return;if(40===e.keyCode&&(r[2]<=a[0]?r[2]=K(t,a[0],!1):r[2]=K(t,t.rowCount,!1),r[2]<0))return}37!==e.keyCode&&39!==e.keyCode&&38!==e.keyCode&&40!==e.keyCode||(a=W(t.activeCell),this.parent.isEdit&&e.shiftKey?(e.preventDefault(),this.parent.notify(Ls,{range:r,e:e}),this.parent.notify(ul,{range:ee(te(r)),isSelect:!1}),this.parent.notify(dl,{})):this.parent.selectRange(ee(r)),this.scrollNavigation([Ln(t,r)?a[0]:r[2],Dn(t,r)?a[1]:r[3]]))},lp.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(),s=te(Q(o.selectedRange)),a=W(o.topLeftCell),l=this.parent.frozenRowCount(o),h=this.parent.frozenColCount(o),d=W(o.paneTopLeftCell),a=K(o,(e[0]<l?a:d)[0],!0),p=this.parent.scrollModule.offset.top.size;if(n.scrollTop)if(l&&e[0]!==s[2]){if(e[0]===l)return void(n.scrollTop=0);e[0]===l-1&&(n.scrollTop=0)}else if(e[0]===K(o,0,!0))return void(n.scrollTop=0);if(i&&i.scrollLeft)if(h&&e[1]!==s[3]){if(e[1]===h)return void(i.scrollLeft=0);e[1]===h-1&&(i.scrollLeft=0)}else if(e[1]===K(o,0,!0,"columns"))return void(i.scrollLeft=0);var c,s=Dd(this.parent,a).index,l=(s<=e[0]?e[0]>=l&&(t?(l=n.getBoundingClientRect().height,c=vh(o,d[0],e[0],!0),n.scrollTop=2*l<c?p+c-l:p+c-gh(o,e[0],!0),ae(this.parent.element)):n.scrollTop=p+vh(o,s,e[0],!0)):a>e[0]&&(n.scrollTop&&(this.parent.scrollModule.isKeyScroll=!1),n.scrollTop=p-Math.ceil(vh(o,e[0],a-1,!0)),t)&&ae(this.parent.element),Ld(this.parent,d[1]));l<=e[1]&&i?e[1]>=h&&(t?(c=i.getBoundingClientRect().width,s=Ih(o,d[1],e[1],!0),i.scrollLeft=2*c<s?(this.parent.scrollModule.offset.left.size+s-c)*r:(this.parent.scrollModule.offset.left.size+(s-wh(o,e[0],null,!0)))*r,ae(this.parent.element)):i.scrollLeft=(this.parent.scrollModule.offset.left.size+Ih(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-Ih(o,e[1],d[1]-1,!0))*r,t)&&ae(this.parent.element)}},lp.prototype.getModuleName=function(){return"keyboardNavigation"},lp.prototype.destroy=function(){this.removeEventListener(),this.parent=null};var ap=lp;function lp(e){this.parent=e,this.addEventListener()}dp.prototype.addEventListener=function(){this.parent.on(ys,this.keyDownHandler,this),this.parent.on(vs,this.keyUpHandler,this)},dp.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(ys,this.keyDownHandler),this.parent.off(vs,this.keyUpHandler))},dp.prototype.isTrgtNotInput=function(e){e=e.target;return!(J.closest(e,".e-filter-popup")||J.closest(e,".e-find-dlg")||J.closest(e,".e-hyperlink-dlg")||J.closest(e,".e-sheet-tab")||J.closest(e,".e-name-box")||J.closest(e,".e-link-dialog"))},dp.prototype.ribbonShortCuts=function(e){if(this.parent.showRibbon&&e.altKey&&!e.ctrlKey&&!e.shiftKey){var t=J.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(),J.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(Ma,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"||J.closest(i,".e-dropdown-btn")||J.closest(i,".e-split-btn")||J.closest(i,".e-popup-open"))){n=this.parent.getCell(n[0],n[1]);if(n&&n.querySelector(".e-validation-list"))return;if(J.closest(i,".e-ribbon"))return void ae(this.parent.element);for(var o,s=0;s<=this.parent.ribbonModule.ribbon.items.length;s++)if(s===this.parent.ribbonModule.ribbon.selectedTab)return(o=this.parent.element.querySelector(".e-toolbar-items").children[s+2].children[0]).setAttribute("tabindex","0"),void ae(o)}}}r&&(t.items[r].disabled||t.items[r].cssClass.includes("e-hide")?ae(this.parent.element):(e.preventDefault(),t.select(r,Object.assign(e,{isShortcut:!0}))))}},dp.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"))&&ae(t):13===e.keyCode&&(r=e.target).classList.contains("e-scroll-nav")&&(n=function(){r.getAttribute("tabindex")||(r.setAttribute("tabindex","0"),ae(r)),J.EventHandler.remove(r,"blur",n)},J.EventHandler.add(r,"blur",n,this))},dp.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(J.isNullOrUndefined(o)||!o.classList.contains("e-addNoteContainer")){if((e.ctrlKey||e.metaKey)&&this.isTrgtNotInput(e)){!J.closest(i,".e-find-dlg")&&!r&&(-1<[79,83].indexOf(e.keyCode)||65===e.keyCode&&!this.parent.isEdit)&&e.preventDefault();var s=W(n.activeCell);if(79===e.keyCode)this.parent.allowOpen&&this.parent.openUrl&&J.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=te(Q(n.selectedRange)),a={colIndex:o[1],rowIndex:o[0]},l=void 0,h=void 0;if(68===e.keyCode?(o[0]===o[2]?a.rowIndex=o[0]-1:o[0]+=1,h=ee([a.rowIndex,a.colIndex,a.rowIndex,o[3]]),l="Down"):(o[1]===o[3]?a.colIndex=o[1]-1:o[1]+=1,l="Right",h=ee([a.rowIndex,a.colIndex,o[2],a.colIndex])),a.rowIndex<0||a.colIndex<0)return;this.parent.notify(Kl,{fillType:ie(a.rowIndex,a.colIndex,n,!1,!0).formula?"FillSeries":"CopyCells",dAutoFillCell:h,rangeInfo:{direction:l,startCell:a,endCell:{rowIndex:o[2],colIndex:o[3]},fillRange:o}}),this.parent.notify(dn,{type:"mousedown"}),this.parent.notify(jr,null)}}else this.parent.isEdit||(e.preventDefault(),this.parent.notify(Sa,{isUndo:!1}));else this.parent.isEdit||(e.preventDefault(),this.parent.notify(Sa,{isUndo:!0}));else{var h=n.rows[s[0]],l=void 0;e.preventDefault(),J.isNullOrUndefined(h)||(l=h.cells[s[1]]),J.isNullOrUndefined(l)&&Mi(s[0],s[1],n,l,!1),l&&l.hyperlink?this.parent.notify(ha,null):this.parent.notify(la,null)}else this.parent.notify(Ms,{promise:Promise});var d,a=n.isProtected&&Vn(ie(s[0],s[1],n),se(n,s[1]));70===e.keyCode&&!r&&this.parent.allowFindAndReplace&&(e.preventDefault(),this.parent.notify(vt,{})),a&&n.isProtected&&86!==e.keyCode||70===e.keyCode||r||(71===e.keyCode?(e.preventDefault(),this.parent.notify(Wa,null)):72===e.keyCode?(e.preventDefault(),this.parent.notify(Ga,null)):88===e.keyCode?this.parent.notify(Ps,{promise:Promise}):86===e.keyCode&&this.parent.notify(Bs,{isAction:!0}),!e.shiftKey)||76!==e.keyCode||this.parent.isEdit||n.isProtected||(e.preventDefault(),this.parent.notify(Na,{})),r||n.isProtected&&!n.protectSettings.formatCells||(66===e.keyCode?(e.preventDefault(),d=this.parent.getCellStyleValue(["fontWeight"],s).fontWeight,this.parent.notify(It,{style:{fontWeight:d="bold"===d?"normal":"bold"},onActionUpdate:!0,refreshRibbon:!0})):73===e.keyCode?(e.preventDefault(),d=this.parent.getCellStyleValue(["fontStyle"],s).fontStyle,this.parent.notify(It,{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(Hs,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.formatColumns||(e.preventDefault(),s=Q(n.selectedRange),this.parent.notify(Lr,{startIndex:s[0],endIndex:s[2],hide:!e.shiftKey,isCol:!1,actionUpdate:!0})):48!==e.keyCode||n.isProtected&&!n.protectSettings.formatRows||(s=Q(n.selectedRange),this.parent.notify(Lr,{startIndex:s[1],endIndex:s[3],hide:!e.shiftKey,isCol:!0,actionUpdate:!0}))),e.shiftKey&&!r&&(113===e.keyCode?(e.preventDefault(),0<e.target.children.length&&-1<e.target.children[e.target.children.length-1].className.indexOf("e-addNoteIndicator")?this.parent.notify(ca,null):this.parent.notify(pa,null)):114===e.keyCode?(e.preventDefault(),this.parent.notify(ih,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"].some(function(e){return t.includes(e)}))&&this.focusTarget(n)),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=xo("General"):52===e.keyCode?l="$#,##0.00;[Red]($#,##0.00)":53===e.keyCode?l="0%":54===e.keyCode?l=xo("Scientific"):51===e.keyCode?l="dd-mmm-yy":50===e.keyCode?l="h:mm AM/PM":49===e.keyCode?l=xo("Number"):55===e.keyCode&&(e.preventDefault(),this.parent.notify(It,{style:{border:"1px solid #000000"},onActionUpdate:!0,borderType:"Outer"})),l&&(this.parent.notify(xt,{format:l,range:h}),this.parent.notify(dn,{type:"mousedown"}),this.parent.notify(jr,null))),85===e.keyCode)&&(e.preventDefault(),a=this.parent.element.querySelector(".e-formula-bar-panel .e-drop-icon"))&&a.click(),122!==e.keyCode||!e.shiftKey||e.ctrlKey||this.parent.isProtected||this.parent.notify(ar,{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()}},dp.prototype.focusTarget=function(e){var t,r,n,i,o,s,a,l,h,d=te(Q(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]=K(e,d[0],!0),s=K(e,Q(e.paneTopLeftCell)[0],!0),a=Dd(this.parent,s).index,n=void 0,(n=d[0]>s&&d[0]<a?this.parent.getRow(d[0],this.parent.getRowHeaderTable()):d[0]>=a?this.parent.getRow(a-1,this.parent.getRowHeaderTable()):this.parent.getRow(s+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]=K(e,d[1],!0,"columns"),l=K(e,Q(e.paneTopLeftCell)[1],!0,"columns"),h=Ld(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=Q(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=Q(e.paneTopLeftCell)[1],h=Ld(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?(s=Q(e.paneTopLeftCell)[0],a=Dd(this.parent,s).index,d[0]>s&&d[0]<a?this.parent.getCell(d[0],d[1]):d[0]>=a?this.parent.getCell(a-1,d[1]):this.parent.getCell(s+1,d[1])):(s=Q(e.paneTopLeftCell)[0],a=Dd(this.parent,s).index,l=Q(e.paneTopLeftCell)[1],h=Ld(this.parent,l),d[0]>s&&d[0]<a?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]>=a?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):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)))||this.parent.getCell(p[0]+1,p[1]+1)))&&ae(t)},dp.prototype.getModuleName=function(){return"keyboardShortcut"},dp.prototype.destroy=function(){this.removeEventListener(),this.parent=null};var hp=dp;function dp(e){this.parent=e,this.addEventListener()}cp.prototype.applyCellFormat=function(t){var e,r,n,i,o,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&&Ad(e,t.rowIdx)<=20&&!r.length||((r=t.td||this.parent.getCell(t.rowIdx,t.colIdx))?(this.updateMergeBorder(t,e),t.formatColor&&r.style.color===t.formatColor&&delete t.style.color,void 0!==t.style.border||void 0!==t.style.borderTop||void 0!==t.style.borderLeft?(n={},Object.keys(t.style).forEach(function(e){n[""+e]=t.style[""+e]}),void 0!==n.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 n.border),void 0!==n.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 n.borderTop),void 0!==n.borderLeft&&(this.setLeftBorder(t.style.borderLeft,r,t.rowIdx,t.colIdx,t.row,t.onActionUpdate,t.first,e),delete n.borderLeft),Object.keys(n).length&&(void 0!==n.borderBottom&&this.setThickBorderHeight(n.borderBottom,t.rowIdx,t.colIdx,r,t.row,t.hRow,t.onActionUpdate,t.lastCell,t.manualUpdate),Object.assign(r.style,n))):(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),(i=ie(t.rowIdx,t.colIdx,e))&&(i.rowSpan||i.colSpan)&&0<r.offsetHeight&&(s=bd(this.parent,i.style||this.parent.cellStyle))>r.offsetHeight&&Cd(this.parent,e,r.offsetHeight,t.rowIdx)),i=ie(t.rowIdx,t.colIdx,e,null,!0),e.rows[t.rowIdx]&&e.rows[t.rowIdx].customHeight?i.wrap||!t.style.fontSize&&!t.style.fontFamily||((o=gh(e,t.rowIdx,!0)-Id(t.rowIdx,t.colIdx,e))<bd(this.parent,i.style)?r.style.lineHeight=o+"px":r.style.lineHeight&&(r.style.lineHeight="")):t.isHeightCheckNeeded&&(t.manualUpdate?(this.checkHeight||(this.checkHeight=zn(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),this.updateRowHeight(t.rowIdx,t.colIdx,t.lastCell,t.onActionUpdate),i.wrap&&(t.style.fontSize||t.style.fontFamily)&&(r.style.lineHeight=parseFloat(i.style&&i.style.fontSize||this.parent.cellStyle.fontSize)*xd(i.style&&i.style.fontFamily?i.style:this.parent.cellStyle)+"pt")):(!i.wrap&&zn(t.style)&&Nd(e,t.rowIdx,t.colIdx,Rd(this.parent,t.rowIdx,t.colIdx,e,t.style)),t.lastCell&&20<(s=Ad(e,t.rowIdx))&&s>gh(e,t.rowIdx)&&Cd(this.parent,e,s,t.rowIdx,t.row,t.hRow,this.parent.scrollSettings.isFinite)))):this.updateRowHeight(t.rowIdx,t.colIdx,!0,t.onActionUpdate)))},cp.prototype.updateRowHeight=function(e,t,r,n,i){if(this.checkHeight){var o=this.parent.getActiveSheet(),s=ie(e,t,o,null,!0);if(!s.rowSpan){var a=0,a=Rd(this.parent,e,t,o,s.style||this.parent.cellStyle,s.wrap?wd(this.parent.getDisplayText(s),Ed(o,e,t),s.style,this.parent.cellStyle):1),l=s.value&&s.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=wd(d[h],Ed(o,e,t),s.style,this.parent.cellStyle);p+=u=0===u?1:u}a=Rd(this.parent,e,t,o,s.style||this.parent.cellStyle,p)}Nd(o,e,t,a=a<20?20:a),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,a=Ad(o,e),l=gh(o,e),n?a!==l:l<a)&&(i?(l=dd(l),mh(o,e,a),this.parent.setProperties({sheets:this.parent.sheets},!0),this.parent.notify(Qs,{rowIdx:e,threshold:dd(a)-l})):Cd(this.parent,o,a,e,null,null,!0))}}},cp.prototype.updateMergeBorder=function(e,t){var r,n=ie(e.rowIdx,e.colIdx,t,null,!0),i={range:[e.rowIdx,e.colIdx,e.rowIdx,e.colIdx]};this.parent.notify(Tr,i),1<n.rowSpan&&!e.style.borderBottom&&(r=ie(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=ie(i.range[0],i.range[3],t,null,!0)).style&&r.style.borderRight&&(e.style.borderRight=r.style.borderRight)},cp.prototype.setLeftBorder=function(e,t,r,n,i,o,s,a){s&&s.includes("Column")||((s=this.parent.enableRtl?this.parent.getCell(r,n+1,i):this.parent.getCell(r,n-1,i))?(i=ie(r,n-1,a,!1,!0)).rowSpan&&1!==i.rowSpan||i.colSpan&&1!==i.colSpan?(this.parent.notify(Tr,r={range:[r,n-1,r,n-1]}),(i=ie(r.range[0],r.range[1],a,!1,!0)).style&&i.style.borderRight&&"none"!==i.style.borderRight||(i=ie(r.range[0],r.range[3],a,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)),s.style.borderRight="none"===e?s.style.borderRight:e):t.style.borderLeft=e)},cp.prototype.setTopBorder=function(e,t,r,n,i,o,s,a,l,h,d){if(!a||!a.includes("Row")){var a=n,p=ie(r,n,d,!1,!0),a=(1<p.colSpan&&Eh(d,n)&&(a=K(d,n,!0,"columns"))>n+p.colSpan-1&&(a=n),this.parent.getCell(r-1,a,i));if(a)if((p=ie(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(Tr,c),(p=ie(c.range[0],c.range[1],d,!1,!0)).style&&p.style.borderBottom&&"none"!==p.style.borderBottom||(p=ie(c.range[2],c.range[1],d,null,!0)).style&&p.style.borderBottom&&"none"!==p.style.borderBottom||(t.style.borderTop=e)}else{if($(d,r-1)){c=[Number(a.parentElement.getAttribute("aria-rowindex"))-1,n];if(this.parent.getCellStyleValue(["bottomPriority"],c).bottomPriority)return}s&&""!==e&&d.topLeftCell.includes(""+(r+1))&&(this.parent.getMainContent().parentElement.scrollTop-=this.getBorderSize(e)),this.setThickBorderHeight(e,r-1,n,a,i,o,s,l,h),a.style.borderBottom="none"===e?a.style.borderBottom:e}else t.style.borderTop=e}},cp.prototype.setThickBorderHeight=function(e,t,r,n,i,o,s,a,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,a,s)):gh(h,t)<(l=Math.ceil(this.parent.calculateHeight(this.parent.getCellStyleValue(["fontFamily","fontSize"],[t,r]),1,3)))&&(Cd(this.parent,h,l,t,i,o,!1),this.parent.notify(Qs,{rowIdx:t,threshold:l-20}))),!s||!a&&this.checkHeight||!(e<3)||h.rows[t]&&h.rows[t].customHeight||(this.checkHeight||(this.checkHeight=!0),this.updateRowHeight(t,r,a,s))},cp.prototype.getBorderSize=function(e){e=e.split(" ")[0];return"thin"===e?1:"medium"===e?2:"thick"===e?3:parseInt(e,10)?parseInt(e,10):1},cp.prototype.clearObj=function(e){function t(){e.isAction&&s.parent.notify(gt,{action:"beforeClear",eventArgs:m})}function r(){e.isAction&&(m={range:p.name+"!"+l,type:a.type,sheetIndex:h},o&&(m.cfClearActionArgs=o.cfClearActionArgs),s.parent.notify(oe,{eventArgs:m,action:"clear"}))}var n,i,o,s=this,a=e.options,l=a.range?0<a.range.indexOf("!")?a.range.split("!")[1]:a.range.split("!")[0]:this.parent.getActiveSheet().selectedRange,h=a.range&&0<a.range.indexOf("!")?B(this.parent,a.range.split("!")[0]):this.parent.activeSheetIndex,d=te(Q(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:a.type,requestType:"clear",sheetIndex:h},v="Clear All"===a.type;if(g)f[0].classList.contains("e-datavisualization-chart")?"Clear Contents"!==a.type&&!v||(t(),this.parent.notify(wl,{id:f[0].id,sheetIdx:this.parent.activeSheetIndex+1}),r()):v&&(t(),this.parent.notify(Sl,{id:f[0].id,sheetIdx:this.parent.activeSheetIndex+1}),r());else{if(t(),"Clear Formats"===a.type||v)for(o={range:l,sheetIdx:h,isClear:!0},this.parent.notify(Br,o),e.cfClearActionArgs=o.cfClearActionArgs,v&&(this.parent.notify(dr,{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=ie(c,n,p),C=this.parent.getCell(c,n);y&&(v&&y.formula&&this.parent.notify(qt,{cellRef:ee([c,n,c,n])}),y.wrap&&this.parent.notify(nr,{range:[c,n,c,n],wrap:!1,sheet:p}),y.hyperlink)&&(C&&J.removeClass(C.querySelectorAll(".e-hyperlink"),"e-hyperlink-style"),v)&&this.parent.removeHyperlink(p.name+"!"+ee([c,n,c,n]))}"Clear Hyperlinks"===a.type&&this.parent.removeHyperlink(p.name+"!"+l),this.parent.notify(Hr,{range:p.name+"!"+l,type:a.type}),this.parent.serviceLocator.getService("cell").refreshRange(te(Q(l)),!1,!1,!1,!1,Td(this.parent),!v),this.parent.notify(pr,{range:l,isclearFormat:!0}),e.isFromUpdateAction||this.parent.notify(Ds,{address:l}),this.parent.notify(Lt,null),r()}},cp.prototype.addEventListener=function(){this.parent.on(Nt,this.applyCellFormat,this),this.parent.on(ll,this.clearObj,this)},cp.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(Nt,this.applyCellFormat),this.parent.off(ll,this.clearObj))},cp.prototype.destroy=function(){this.removeEventListener(),this.parent=null,this.checkHeight=null},cp.prototype.getModuleName=function(){return"cellformat"};var pp=cp;function cp(e){this.checkHeight=!1,this.parent=e,this.addEventListener()}fp.prototype.addEventListener=function(){this.parent.on(ds,this.wireEvents,this),this.parent.on(sa,this.autoFit,this),this.parent.on(Ba,this.setAutoFitHandler,this)},fp.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)},fp.prototype.wireEvents=function(){var e=this.parent.getRowHeaderContent(),t=this.parent.element.getElementsByClassName("e-header-panel")[0];t&&(J.EventHandler.add(t,"dblclick",this.dblClickHandler,this),J.EventHandler.add(e,"dblclick",this.dblClickHandler,this),J.EventHandler.add(t,"mousedown",this.mouseDownHandler,this),J.EventHandler.add(e,"mousedown",this.mouseDownHandler,this),this.wireResizeCursorEvent(e,t))},fp.prototype.wireResizeCursorEvent=function(e,t){J.EventHandler.add(e,"mousemove",this.setTarget,this),J.EventHandler.add(t,"mousemove",this.setTarget,this)},fp.prototype.unWireResizeCursorEvent=function(){J.EventHandler.remove(this.parent.getRowHeaderContent(),"mousemove",this.setTarget);var e=this.parent.element.getElementsByClassName("e-header-panel")[0];e&&J.EventHandler.remove(e,"mousemove",this.setTarget)},fp.prototype.unwireEvents=function(){J.EventHandler.remove(this.parent.getColumnHeaderContent(),"dblclick",this.dblClickHandler),J.EventHandler.remove(this.parent.getRowHeaderContent(),"dblclick",this.dblClickHandler),J.EventHandler.remove(this.parent.getColumnHeaderContent(),"mousedown",this.mouseDownHandler),J.EventHandler.remove(this.parent.getRowHeaderContent(),"mousedown",this.mouseDownHandler),this.unWireResizeCursorEvent()},fp.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(ds,this.wireEvents),this.parent.off(sa,this.autoFit),this.parent.off(Ba,this.setAutoFitHandler))},fp.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"))},fp.prototype.mouseDownHandler=function(e){var t,r;J.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(),J.EventHandler.add(this.parent.element,"mousemove",this.mouseMoveHandler,this),J.EventHandler.add(document,"mouseup",this.mouseUpHandler,this))},fp.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&&(J.detach(t),this.updateCursor()),e&&e.remove(),J.EventHandler.remove(document,"mouseup",this.mouseUpHandler),J.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(Yl,null),this.parent.notify(Xl,null)},fp.prototype.dblClickHandler=function(e){var t;J.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=wh(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=gh(this.parent.getActiveSheet(),e)+"px",this.setAutofit(e,!1,t)),this.parent.notify(Yl,null))},fp.prototype.setTarget=function(e){if(J.closest(e.target,".e-header-cell")&&!e.target.className.includes("e-filter-icon")){var t,r,n,i,o,s=e.target,a=this.parent.getActiveSheet();if(a.isProtected&&(!a.protectSettings.formatColumns||!a.protectSettings.formatRows)){if(!a.protectSettings.formatRows&&!a.protectSettings.formatColumns)return;if(a.protectSettings.formatRows&&J.closest(s,".e-colhdr-table"))return;if(a.protectSettings.formatColumns&&J.closest(s,".e-rowhdr-table"))return}if(J.closest(s,".e-header-row")?(r=s.offsetWidth,n="e-colresize",i=this.parent.enableRtl?r-e.offsetX:e.offsetX,(o=this.getColPrevSibling(s))&&!o.classList.contains("e-select-all-cell")?t=o:1<Number(s.getAttribute("aria-colindex"))&&(t=s)):J.closest(s,".e-row")&&(i=e.offsetY,r=s.offsetHeight,n="e-rowresize",(o=this.getRowPrevSibling(s))?t=o.firstElementChild:1<Number(s.parentElement.getAttribute("aria-rowindex"))&&(t=s)),r-2<8&&i!==Math.ceil((r-2)/2))i<Math.ceil((r-2)/2)?(s.classList.add(n),t.classList.add(n)):i>Math.ceil((r-2)/2)&&s.classList.add(n);else if(r-5<i&&i<=r&&10<=r)s.classList.add(n);else if(i<5&&t&&10<=r)s.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)}},fp.prototype.getColPrevSibling=function(e){var t=this.parent.frozenColCount(this.parent.getActiveSheet());return e.previousElementSibling||(t&&J.closest(e,".e-column-header")?this.parent.getSelectAllContent().querySelector(".e-header-row").lastElementChild:null)},fp.prototype.getRowPrevSibling=function(e){var t=this.parent.frozenRowCount(this.parent.getActiveSheet());return e.parentElement.previousElementSibling||(t&&J.closest(e,".e-row-header")?this.parent.getSelectAllContent().querySelector("tbody").lastElementChild:null)},fp.prototype.updateTarget=function(e,t){var r,n,i,o;J.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))&&!Eh(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))||$(r,n))&&("dblclick"===e.type&&$(r,n)?(o=void 0,o=n<=(t=te(Q(r.selectedRange)))[2]&&n>t[0]&&Dn(r,t)?{startIndex:t[0],endIndex:t[2],hide:!1,autoFit:!0}:{startIndex:n,endIndex:n,hide:!1,autoFit:!0},this.parent.notify(Lr,o)):$(r,n)||(this.trgtEle=i.getElementsByClassName("e-header-cell")[0]))},fp.prototype.setAutoFitHandler=function(e){e.isCol&&Eh(this.parent.getActiveSheet(),e.idx)?this.showHiddenColumns(e.idx):this.setAutofit(e.idx,e.isCol)},fp.prototype.getWrapText=function(e,r,n){function i(){var e=parseInt(h.toString(),10);(t<e||e===t&&Sd(p.trim(),n,s.parent.cellStyle)>Sd(d,n,s.parent.cellStyle))&&(d=p.trim(),t=e)}var o,s=this,a=e.toString().split(" "),l=Sd(" ",n,this.parent.cellStyle),t=0,h=0,d=e,p="";return a.forEach(function(e,t){o=Sd(e,n,s.parent.cellStyle),1<(h+o)/r?(i(),p="",h=o):h+=o+=1<=(h+o+l)/r?0:l,p+=e+" ",t===a.length-1&&i()}),d},fp.prototype.setAutofit=function(e,t,r,n){var i,o=this,s=this.parent.getActiveSheet();if(n){var a={cancel:!1,index:e,isCol:t,sheetIndex:this.parent.activeSheetIndex};if(t?(a.oldWidth=r,a.autoFitWithHeader=!1):a.oldHeight=r,this.parent.notify(gt,{eventArgs:a,action:"resizeToFit"}),a.cancel)return;a=a.autoFitWithHeader}var l,h,d={},p=this.parent.createElement("table",{className:this.parent.getContentTable().className+" e-resizetable",styles:"height: auto"}),c=this.parent.createElement("tbody"),u=this.parent.createElement("tr",{className:"e-row"}),f=this.parent.createElement("td",{className:"e-cell"});if(t){p.style.width="auto";var g,m=function(e){(l=f.cloneNode()).textContent=e,l.style.fontFamily=d.style&&d.style.fontFamily||o.parent.cellStyle.fontFamily,l.style.fontSize=d.style&&d.style.fontSize||o.parent.cellStyle.fontSize,l.style.fontWeight=d.style&&d.style.fontWeight||o.parent.cellStyle.fontWeight,(g=u.cloneNode()).appendChild(l),c.appendChild(g)};a&&m(n.textContent);for(var v=0,y=s.rows.length;v<y;v++)(d=ie(v,e,s))&&(d.wrap?(h=!0,m(this.getWrapText(this.parent.getDisplayText(d),Ed(s,e,e,1<d.colSpan?e+d.colSpan-1:e),d.style))):m(this.parent.getDisplayText(d)));i=wh(s,e)}else{for(var C=s.rows[e]&&s.rows[e].cells?s.rows[e].cells.length:0,b=this.parent.createElement("colgroup"),x=0;x<C;x++)(d=ie(e,x,s))&&(l=f.cloneNode(),d.wrap&&l.classList.add("e-wraptext"),l.textContent=this.parent.getDisplayText(d),l.style.fontFamily=d.style&&d.style.fontFamily||this.parent.cellStyle.fontFamily,l.style.fontSize=d.style&&d.style.fontSize||this.parent.cellStyle.fontSize,u.appendChild(l),b.appendChild(this.parent.createElement("col",{styles:"width:"+wh(s,x,!1,!0)+"px"})));p.appendChild(b),c.appendChild(u),i=gh(s,e)}p.appendChild(c);var S,a=this.parent.createElement("div",{className:this.parent.element.className,styles:"display: block"}),n=(a.appendChild(p),document.body.appendChild(a),p.getBoundingClientRect()),p=(document.body.removeChild(a),Math.ceil(t?n.width:n.height)),a=(t?this.getFloatingElementWidth(p+(h?1:0),e):p)||i;t?(S=0<a?-(i-a):-i,(n=this.parent.frozenColCount(s))&&e>=Q(s.topLeftCell)[1]&&e<n||e>=this.parent.viewport.leftIndex+n&&e<=this.parent.viewport.rightIndex?(se(s,e).width=0<a?a:0,this.resizeStart(e,this.parent.getViewportIndex(e,!0),a+"px",t,!0,r),this.parent.notify(ea,{threshold:S,colIdx:e})):(this.parent.notify(ea,{threshold:S,colIdx:e}),se(s,e).width=0<a?a:0)):(S=-(i-(a=20<a?a:20)),(p=this.parent.frozenRowCount(s))&&e>=Q(s.topLeftCell)[0]&&e<p||e>=this.parent.viewport.topIndex+p&&e<=this.parent.viewport.bottomIndex?(mh(s,e,a),uh(s,e,{customHeight:!1}),this.resizeStart(e,this.parent.getViewportIndex(e),a+"px",t,!0,r),this.parent.notify(Qs,{threshold:S,rowIdx:e})):(this.parent.notify(Qs,{threshold:S,rowIdx:e}),mh(s,e,a))),this.parent.selectRange(s.selectedRange)},fp.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()},fp.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="Width:("+Math.round(e.getBoundingClientRect().width).toString()+" pixels)":i&&(o.content="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()))},fp.prototype.setColWidth=function(e,t,r,n){var i=this.parent.getActiveSheet(),o=dd(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(oe,{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"),Sh(i,e,{width:r,customWidth:!0}),this.parent.notify(ea,{threshold:o,colIdx:e,checkWrapCell:!0})):this.isMouseMoved&&(this.parent.hideColumn(e),this.showHideCopyIndicator(),this.parent.notify(oe,{eventArgs:{index:e,width:"0px",isCol:!0,sheetIndex:this.parent.activeSheetIndex,oldWidth:n+"px",hide:!0},action:"resize"}))},fp.prototype.showHideCopyIndicator=function(){var e=this.parent.element.getElementsByClassName("e-copy-indicator")[0],t=!1;e&&(J.detach(e),this.parent.notify(Zl,null),t=!0),t&&this.parent.notify(ds,{})},fp.prototype.showHiddenColumns=function(e,t){var r,n,i,o=this,s=this.parent.getActiveSheet(),a=Q(s.selectedRange);if(e>=a[1]&&e<=a[3]&&a[2]===s.rowCount-1&&W(s.activeCell)[0]===W(s.topLeftCell)[0]?(r=a[1],n=a[3],i=this.parent.getMainContent().querySelector("colgroup")):r=n=e,void 0!==t)for(var l=r;l<=n;l++)Sh(s,l,{width:t,customWidth:!0}),l>=this.parent.viewport.leftIndex&&l<=this.parent.viewport.rightIndex&&!Eh(s,l)&&(i.children[this.parent.getViewportIndex(l,!0)].style.width=t+"px");this.trgtEle&&this.trgtEle.classList.remove("e-unhide-column");var h,a={startIndex:r,endIndex:n,hide:!1,isCol:!0,autoFit:!0};this.parent.notify(Lr,a),this.showHideCopyIndicator(),void 0===t&&(a.autoFit?this.autoFit({isRow:!1,startIndex:r,endIndex:n}):(h=function(){o.parent.off(ds,h),o.autoFit({isRow:!1,startIndex:r,endIndex:n})},this.parent.on(ds,h,this)))},fp.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),s=dd(parseInt(r,10))-o;s<0&&o<-s&&(s=-o),this.resizeStart(e,t,r,!1,!1,n),uh(i,e,{height:0<parseInt(r,10)?parseInt(r,10):0,customHeight:!0}),this.parent.notify(Qs,{threshold:s,rowIdx:e,isCustomHgt:!0})},fp.prototype.resizeOn=function(e){var t=this,r=this.parent.getActiveSheet(),n=Q(r.activeCell),i=ie(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&&$(r,o)&&this.trgtEle.classList.contains("e-skip-resize")&&e.clientY>this.trgtEle.getBoundingClientRect().top){this.trgtEle.classList.remove("e-skip-resize");var s={startIndex:o,endIndex:o,hide:!1,skipAppend:!0},a=(this.parent.notify(Lr,s),this.parent.getRowHeaderTable().tBodies[0]),l=this.parent.getContentTable().tBodies[0];s.hdrRow.style.display="none",s.row.style.display="none",a.insertBefore(s.hdrRow,a.children[s.insertIdx]),l.insertBefore(s.row,l.children[s.insertIdx]),this.trgtEle=s.hdrRow.firstElementChild,s.hdrRow.nextElementSibling.classList.remove("e-hide-end"),s.mergeCollection.forEach(function(e){t.parent.notify(kr,e)})}else if(this.trgtEle.classList.contains("e-skip-resize")){if(this.trgtEle.classList.remove("e-skip-resize"),!this.isMouseMoved&&$(r,o)||!this.trgtEle.parentElement.previousElementSibling)return;this.trgtEle=this.trgtEle.parentElement.previousElementSibling.getElementsByClassName("e-header-cell")[0]}var h=a=parseInt(this.trgtEle.parentElement.getAttribute("aria-rowindex"),10)-1,a=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(),uh(r,h,{height:0,customHeight:!0}),void this.parent.notify(oe,{eventArgs:{index:h,height:"0px",isCol:!1,sheetIndex:this.parent.activeSheetIndex,oldHeight:d},action:"resize"});if(this.setRowHeight(h,a,u+"px",d),"none"===this.trgtEle.parentElement.style.display){var p=this.parent.getActiveSheet(),c=te(Q(p.selectedRange));if(h<=c[2]&&h>c[0]){for(var u=gh(p,h),f=void 0,g=c[0];g<=c[2];g++)g!==h&&(d=gh(p,g)+"px",uh(p,g,{customHeight:!0,height:u}),$(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(oe,{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(),a+=Math.abs(h-f)}else 0===a||$(p,h-1)?0!==a&&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[a].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),a=parseInt(this.trgtEle.getAttribute("aria-colindex"),10)-1,s=void 0,s=this.trgtEle.classList.contains("e-unhide-column")?(--a,0):wh(this.parent.getActiveSheet(),a),this.setColWidth(a,this.parent.getViewportIndex(a,!0),(this.parent.enableRtl?this.event.clientX-e.clientX:e.clientX-this.event.clientX)+s,s));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]})},fp.prototype.resizeStart=function(e,t,r,n,i,o){fd(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(oe,{eventArgs:t,action:i?"resizeToFit":"resize"})},fp.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")},fp.prototype.getFloatingElementWidth=function(e,t){var r=e,n={filterRange:[],hasFilter:!1};return this.parent.notify(Ma,n),r=n.hasFilter&&n.filterRange&&n.filterRange[1]<=t&&n.filterRange[3]>=t?e+22:r},fp.prototype.destroy=function(){this.unwireEvents(),this.removeEventListener(),this.trgtEle&&this.trgtEle.remove(),this.trgtEle=null,this.event=null,this.parent=null},fp.prototype.getModuleName=function(){return"resize"};var up=fp;function fp(e){this.parent=e,this.addEventListener()}mp.prototype.hideShow=function(t){var e,r=this,n=J.isUndefined(t.sheetIndex)?this.parent.activeSheetIndex:t.sheetIndex,i=ne(this.parent,n);if(Bd(this.parent,Q(this.parent.getActiveSheet().selectedRange)))this.parent.notify($a,null);else{if(t.startIndex>t.endIndex&&(a=t.startIndex,t.startIndex=t.endIndex,t.endIndex=a),t.actionUpdate){if(t.sheetIndex=n,this.parent.notify(gt,e={eventArgs:t,action:"hideShow"}),t.cancel)return;delete t.cancel}var o,s,a=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),a(!0),delete t.freezePane,void 0!==o&&(s=t.startIndex,t.endIndex=o,t.startIndex=n,a(),t.startIndex=s)):a(),t.actionUpdate&&(this.updateIndexOnlyForHiddenColumnsAndRows(t,i),this.parent.notify(oe,e),ae(this.parent.element))}},mp.prototype.updateIndexOnlyForHiddenColumnsAndRows=function(e,t){for(var r=e.startIndex,n=e.endIndex,i=e.startIndex;i<=n;i++)if(!1===(e.isCol?se(t,i):ch(t,i)||{}).hidden){e.startIndex=i;break}for(var o=e.endIndex;r<=o;o--)if(!1===(e.isCol?se(t,o):ch(t,o)||{}).hidden){e.endIndex=o;break}},mp.prototype.hideRow=function(e){var t,r,n,i,M=this,o=J.isUndefined(e.sheetIndex)?this.parent.activeSheetIndex:e.sheetIndex,s=ne(this.parent,o),a=0,l=Object.assign({},e),h=this.parent.scrollSettings.isFinite&&!l.freezePane;if(h){if(l.startIndex>=s.rowCount)return;l.endIndex>=s.rowCount&&(l.endIndex=s.rowCount-1),i=0}var d=this.parent.frozenRowCount(s);if(l.hide){for(var p,c=void 0,u=void 0,f=[],g=[],m=h&&l.endIndex===K(s,s.rowCount-1,!1),v=l.startIndex;v<=l.endIndex;v++)if($(s,v))l.isFiltering&&!fh(s,v)&&uh(s,v,{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(v),a=0),n={hidden:!0},l.isFiltering&&(n.isFiltered=!0),l.isFiltering||(f=Md(this.parent)),uh(s,v,n),l.isFiltering||(g=Md(this.parent)),o===this.parent.activeSheetIndex)if(h&&(i+=gh(s,v,!0,!0)),this.refreshChart(v,"rows"),l.isFiltering||this.refreshChartCellModel(f,g),u=c&&c.rows[t]){if(!r)for(var y=0;y<=s.usedRange.colIndex;y++)if(((L=ie(v,y,s)||{}).colSpan||L.rowSpan)&&(l.startIndex>=this.parent.viewport.topIndex||this.parent.scrollSettings.enableVirtualization)){r=!0;break}if(!r&&(p.rows[t]&&J.detach(p.rows[t]),J.detach(u),a++,(u=c.rows[t])&&v===l.endIndex))for(var B,C,H=(C=K(s,v+1,!0))!==K(s,0,!0)&&C===(this.parent.viewport.topIndex>=l.startIndex?l.endIndex+1:this.parent.viewport.topIndex)?"Row":"",y=this.parent.viewport.leftIndex;y<=this.parent.viewport.rightIndex;y++)""!==(P=this.parent.getCellStyleValue(["borderTop"],[C,y]).borderTop)&&(B=u.cells[y],this.parent.notify(Nt,{onActionUpdate:!1,rowIdx:C,colIdx:y,style:{borderTop:P},row:u,pRow:u.previousElementSibling,first:H,td:B}))}else v<=this.parent.viewport.bottomIndex?a++:a--;if(!l.refreshUI)if(r&&(l.startIndex>=this.parent.viewport.topIndex||!this.parent.scrollSettings.enableVirtualization))l.isFiltering?e.refreshUI=!0:(this.parent.selectRange(s.selectedRange),s.frozenRows||s.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(a){this.parent.selectRange(s.selectedRange);var V=function(){var e;s.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(s.paneTopLeftCell)[0]||a>this.parent.viewport.rowCount){if(l.isFiltering)return void(e.refreshUI=!0);this.parent.updateTopLeftCell(K(s,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+a-1,"rows",!1);if(b=x[0],x=x[1],h){if(b>=s.rowCount)return void(this.parent.viewport.topIndex+d===K(s,d,!0)?(V(),this.parent.notify(Ql,{isHide:!0,height:i}),m&&(this.parent.viewport.bottomIndex=K(s,s.rowCount-1,!1))):this.parent.renderModule.refreshSheet(!1,!1,!0));if(x>=s.rowCount)return void this.parent.renderModule.refreshSheet(!1,!1,!0);this.parent.notify(Ql,{isHide:!0,height:i})}this.parent.viewport.bottomIndex=x;var m=void 0,S=this.parent.frozenColCount(s),w=[],m=S?(w.push(d),w.push(this.parent.viewport.leftIndex+S),W(s.topLeftCell)[1]):this.parent.viewport.leftIndex;this.parent.renderModule.refreshUI({colIndex:m,rowIndex:b,direction:"",refresh:"RowPart",frozenIndexes:w},G(b,m)+":"+G(x,this.parent.viewport.rightIndex))}}V()}}else{for(var U,I=void 0,E=void 0,u=void 0,R=void 0,_=void 0,c=void 0,N=void 0,A=void 0,k=l.startIndex-1,F=[],O=l.freezePane,T="lastElementChild",z=0,f=(h&&(S=K(s,s.rowCount-1,!1),this.parent.viewport.bottomIndex===S)&&(this.parent.viewport.topIndex+d===K(s,d,!0)?O=!0:(w=Q(s.paneTopLeftCell)[0],s.rowCount-1-w+1-this.parent.hiddenCount(w,s.rowCount-1)<this.parent.viewport.rowCount+Math.round(this.parent.getThreshold("row")/2)&&(T="firstElementChild"))),Md(this.parent)),v=l.startIndex,j=l.endIndex;v<=j;v++)if($(s,v)){if(void 0!==R)j=v;else if(n={hidden:!1},l.isFiltering&&(n.isFiltered=!1),!O&&v>this.parent.viewport.bottomIndex){if(uh(s,v,n),void 0===A)return}else if(void 0===A&&(A=v),uh(s,v,n),o===this.parent.activeSheetIndex){h&&(i+=gh(s,v,!0,!0)),this.refreshChart(v,"rows"),void 0===t&&(I=document.createDocumentFragment(),E=document.createDocumentFragment(),_=this.parent.serviceLocator.getService("row"),l.freezePane?(N=this.parent.sheetModule.getSelectAllTable(),c=this.parent.getColHeaderTable()):(N=this.parent.getRowHeaderTable(),c=this.parent.getContentTable(),v<this.parent.viewport.topIndex+d&&(this.parent.viewport.topIndex=v-d)),t=this.parent.getViewportIndex(v)),k++,U=_.refresh(v,null,null,!0,!0),I.appendChild(U),N&&N.rows.length&&!O&&J.detach(N.tBodies[0][""+T]),u=E.appendChild(_.refresh(v,u,U)),c&&c.rows.length&&!O&&(J.detach(c.tBodies[0][""+T]),"firstElementChild"===T)&&(void 0!==t&&-1<t-1&&--t,z+=gh(s,this.parent.viewport.topIndex,!0),this.parent.viewport.topIndex=K(s,this.parent.viewport.topIndex+1,!0));for(var D,L,y=this.parent.viewport.leftIndex;y<=this.parent.viewport.rightIndex;y++)void 0===(L=ie(v,y,s)||{}).rowSpan&&void 0===L.colSpan||(this.parent.notify(Tr,D={range:[v,y,v,y],isAction:!1,merge:!0,type:"All",skipChecking:!0}),F.length&&D.range[1]===F[F.length-1].range[1]&&D.range[0]===F[F.length-1].range[0])||F.push(D)}}else{if(l.startIndex===l.endIndex)return;void 0===t?k++:R=v}g=Md(this.parent);if(this.refreshChartCellModel(f,g),void 0!==t){if(!l.freezePane){if(l.isFiltering&&l.startIndex<W(s.paneTopLeftCell)[0]&&(e.refreshUI=!0,void 0===R||R===l.endIndex))return;this.parent.viewport.bottomIndex=this.parent.viewport.topIndex+d+this.parent.viewport.rowCount+2*this.parent.getThreshold("row"),a=this.parent.hiddenCount(this.parent.viewport.topIndex+d,l.startIndex)+this.parent.hiddenCount(l.endIndex+1,this.parent.viewport.bottomIndex),this.parent.viewport.bottomIndex+=a,h&&this.parent.viewport.bottomIndex>=s.rowCount&&(this.parent.viewport.bottomIndex=K(s,s.rowCount-1,!1))}if(l.insertIdx=e.insertIdx=t,l.row=e.row=E.querySelector(".e-row"),l.mergeCollection=e.mergeCollection=F,s.showHeaders&&(e.hdrRow=l.hdrRow=I.querySelector(".e-row"),0!==t&&!$(s,k-1)&&N.rows[t-1]&&N.rows[t-1].classList.remove("e-hide-start"),0!==l.startIndex&&$(s,l.startIndex-1)&&l.hdrRow.classList.add("e-hide-end"),$(s,k+1)?I.lastElementChild.classList.add("e-hide-start"):N.rows[t]&&N.rows[t].classList.remove("e-hide-end")),u&&c&&c.rows[t]){C=K(s,k+1,!0);for(var P,q,v=this.parent.viewport.leftIndex;v<=this.parent.viewport.rightIndex;v++)""!==(P=this.parent.getCellStyleValue(["borderTop"],[C,v]).borderTop)&&(this.parent.notify(Nt,{onActionUpdate:!1,rowIdx:C,colIdx:v,style:{borderTop:P},pRow:u,td:c.rows[t].cells[v],first:""}),-1<(q=K(s,A-1,!1))?!c.rows[t-1]||this.parent.getCellStyleValue(["borderBottom"],[q,v]).borderBottom||this.parent.getCellStyleValue(["borderTop"],[A,v]).borderTop||(c.rows[t-1].cells[v].style.borderBottom=""):c.rows[t].cells[v].style.borderTop="")}l.skipAppend||(h&&this.parent.notify(Ql,{height:i,size:z}),Math.abs(k-A)>this.parent.viewport.rowCount+2*this.parent.getThreshold("row")?this.parent.renderModule.refreshSheet(!1,!1,!0):(N&&(N.tBodies[0].rows.length?N.tBodies[0].insertBefore(I,N.rows[t]):N.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(s.selectedRange),l.autoFit&&s.showHeaders&&this.parent.notify(sa,{startIndex:l.startIndex,endIndex:l.endIndex,isRow:!0}),F.forEach(function(e){M.parent.notify(kr,e)}),void 0!==R&&R!==l.endIndex&&(l.startIndex=R,this.hideRow(l))))}}},mp.prototype.hideCol=function(t){for(var e,r,n,i=this,o=J.isUndefined(t.sheetIndex)?this.parent.activeSheetIndex:t.sheetIndex,s=ne(this.parent,o),a=[],l=[],h=W(s.paneTopLeftCell),d=this.parent.frozenColCount(s),p=this.parent.frozenRowCount(s),c=this.parent.viewport.leftIndex+d,u=K(s,s.colCount-1,!1,"columns"),f=t.startIndex;f<=t.endIndex;f++)(t.hide?!Eh(s,f):Eh(s,f))&&(r=Md(this.parent),Sh(s,f,{hidden:t.hide}),n=Md(this.parent),this.refreshChart(f,"columns"),this.refreshChartCellModel(r,n),this.parent.scrollSettings.enableVirtualization&&!t.freezePane&&(f<c||f>this.parent.viewport.rightIndex&&(!this.parent.scrollSettings.isFinite||!(u===this.parent.viewport.rightIndex&&u<=f&&f<s.colCount)))?f<c&&l.push(f):(a.push(f),t.hide&&f<=h[1]&&(e=!0)));if((l.length||a.length)&&o===this.parent.activeSheetIndex){var g,m,v=W(s.topLeftCell),o=function(){var e=i.parent.scrollSettings.enableVirtualization?[p?v[0]:i.parent.viewport.topIndex,i.parent.viewport.bottomIndex]:[0,s.rowCount-1];return m=t.freezePane?(g=i.parent.getRowHeaderTable(),i.parent.sheetModule.getSelectAllTable()):(g=i.parent.getContentTable(),i.parent.getColHeaderTable()),e};if(t.hide){if(a.length){if((a.length<=this.parent.getThreshold("col")||!this.parent.scrollSettings.enableVirtualization||t.freezePane)&&this.removeCell(s,a,o(),g,m),!t.freezePane&&this.parent.scrollSettings.enableVirtualization){if(e)return this.parent.updateTopLeftCell(null,K(s,a[0]-1<d?d:a[0]-1,!0,"columns")-d,"row"),void this.parent.renderModule.refreshSheet(!1,!1,!0);var y=[],C=this.parent.viewport.topIndex,b=p?v[0]:C;if(p&&(y=[p+C,d]),this.parent.scrollSettings.isFinite){var x,S=K(s,s.colCount-1,!1,"columns"),w=this.parent.viewport.leftIndex+d,I=this.parent.viewport.rightIndex;if(S<=I+a.length)return d<=(x=K(s,w-(I+a.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+d||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+d===K(s,d,!0,"columns")}),p&&(this.parent.viewport.topIndex=C)):this.parent.notify(Nl,{refresh:"Column",isUpdate:!0}),void this.parent.selectRange(s.selectedRange)}a.length<=this.parent.getThreshold("col")?(x=this.parent.skipHidden(this.parent.viewport.rightIndex+1,this.parent.viewport.rightIndex+a.length,"columns"),this.parent.viewport.rightIndex=x[1],this.parent.renderModule.refreshUI({rowIndex:b,colIndex:x[0],direction:"",refresh:"ColumnPart",frozenIndexes:y},""+ee([b,x[0],this.parent.viewport.bottomIndex,x[1]]))):(this.parent.renderModule.refreshUI({skipUpdateOnFirst:this.parent.viewport.leftIndex+d===K(s,d,!0,"columns"),rowIndex:b,colIndex:this.parent.viewport.leftIndex,refresh:"Column",frozenIndexes:y}),p&&(this.parent.viewport.topIndex=C))}this.parent.selectRange(s.selectedRange)}}else l.length&&this.parent.scrollSettings.enableVirtualization?(l.sort(function(e,t){return e-t}),this.parent.updateTopLeftCell(null,K(s,l[0]-1<d?d:l[0]-1,!0,"columns")-d,"row"),this.parent.renderModule.refreshSheet(!1,!1,!0),t.autoFit&&(t.autoFit=!1)):((!this.parent.scrollSettings.isFinite||this.parent.viewport.rightIndex<u)&&(a.length<=this.parent.getThreshold("col")||!this.parent.scrollSettings.enableVirtualization||t.freezePane)?(this.appendCell(s,a,o(),g,m,t.freezePane),this.parent.scrollSettings.enableVirtualization&&!t.freezePane&&this.parent.notify(ws,{refresh:"Column",prevRowColCnt:{rowCount:s.rowCount,colCount:s.colCount}})):(C=this.parent.viewport.topIndex,b=p?v[0]:C,this.parent.renderModule.refreshUI({skipUpdateOnFirst:this.parent.viewport.leftIndex+d===K(s,d,!0,"columns"),rowIndex:b,colIndex:this.parent.viewport.leftIndex,refresh:"Column",frozenIndexes:p?[p+C,d]:[]}),p&&(this.parent.viewport.topIndex=C),t.autoFit&&(t.autoFit=!1)),this.parent.selectRange(s.selectedRange))}},mp.prototype.removeCell=function(r,n,e,t,i){var o,s,a,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=K(r,g-1,!1);for(r.showHeaders&&(a=i.getElementsByTagName("colgroup")[0],o=i.rows[0]);p<=c;)$(r,p)?p++:(s=g&&p<g?i.rows[u+1]:t.rows[u],n.forEach(function(e,t){0===u&&g<=p&&(r.showHeaders&&(J.detach(a.children[v]),J.detach(o.cells[v])),J.detach(m.children[v])),J.detach(s.cells[v]),0===t&&(void 0!==(l=ie(p,e,r,!1,!0)).colSpan&&(void 0===l.rowSpan||1<l.colSpan)||l.rowSpan<0&&-1<p-1&&$(r,p-1)&&Math.abs(l.rowSpan)===d.parent.hiddenCount(p+l.rowSpan,p,"rows",r))&&d.parent.notify(el,{rowIdx:p,colIdx:e,model:"col",start:n[0],end:n[f]}),t===f&&(h=K(r,e+1,!0,"columns"),""!==(t=d.parent.getCellStyleValue(["borderLeft"],[u,h]).borderLeft)&&d.parent.notify(Nt,{onActionUpdate:!1,rowIdx:u,colIdx:h,style:{borderLeft:t},row:s,first:""}),void 0!==(l=ie(p,e,r)||{}).colSpan&&(void 0===l.rowSpan||1<l.colSpan)||l.rowSpan<0&&-1<p-1&&$(r,p-1)&&Math.abs(l.rowSpan)===d.parent.hiddenCount(p+l.rowSpan,p,"rows",r))&&d.parent.notify(el,{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")},mp.prototype.appendCell=function(r,n,e,t,i,o){for(var s,a,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],s=i.rows[0]),this.parent.serviceLocator.getService("cell")),b=(n.sort(function(e,t){return e-t}),[]),x=[],S=K(r,v-1,!1);u<=f;)$(r,u)?u++:(a=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=s.cells[x[t]])&&(0===t&&n[t]&&!Eh(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,s,h)):(y.appendChild(c.parent.sheetModule.updateCol(r,e)),r.showHeaders&&C.renderColHeader(e,s)),o||(J.detach(y.lastChild),r.showHeaders&&J.detach(s.lastChild)),r.showHeaders)&&t===m&&(J.detach(l),i.insertBefore(y.cloneNode(!0),i.tHead)),o||J.detach(a.lastChild),h=a.cells[x[t]],p={rowIdx:u,colIdx:e,cell:ie(u,e,r),row:a,address:G(u,e),lastCell:e===m,isHeightCheckNeeded:!0,first:e!==K(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,K(r,n[n.length-1]+1,!0,"columns")]).borderLeft&&-1<(d=K(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=ie(u,e,r)||{}).colSpan&&(void 0===d.rowSpan||1<d.colSpan)||d.rowSpan<0&&-1<u-1&&$(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(Tr,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(kr,e)}),this.parent.viewport.rightIndex=K(r,this.parent.viewport.rightIndex-n.length,!1,"columns")},mp.prototype.refreshChart=function(e,t){this.parent.notify(qr,{rIdx:e,showHide:t})},mp.prototype.refreshChartCellModel=function(e,t){this.parent.notify(El,{prevChartIndexes:e,currentChartIndexes:t})},mp.prototype.addEventListener=function(){this.parent.on(Lr,this.hideShow,this),this.parent.on(cs,this.destroy,this)},mp.prototype.destroy=function(){this.removeEventListener(),this.parent=null},mp.prototype.removeEventListener=function(){this.parent.off(Lr,this.hideShow),this.parent.off(cs,this.destroy)};var gp=mp;function mp(e){this.parent=e,this.addEventListener()}yp.prototype.destroy=function(){this.removeEventListener(),this.parent=null},yp.prototype.addEventListener=function(){this.parent.on(la,this.initiateHyperlinkHandler,this),this.parent.on(ha,this.editHyperlinkHandler,this),this.parent.on(da,this.openHyperlinkHandler,this),this.parent.on(ms,this.hyperlinkClickHandler,this),this.parent.on(Ca,this.createHyperlinkEle,this),this.parent.on(vs,this.keyUpHandler,this),this.parent.on(Qr,this.removeHyperlink,this),this.parent.on(ya,this.removeHyperlinkHandler,this)},yp.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(la,this.initiateHyperlinkHandler),this.parent.off(ha,this.editHyperlinkHandler),this.parent.off(da,this.openHyperlinkHandler),this.parent.off(ms,this.hyperlinkClickHandler),this.parent.off(Ca,this.createHyperlinkEle),this.parent.off(vs,this.keyUpHandler),this.parent.off(Qr,this.removeHyperlink),this.parent.off(ya,this.removeHyperlinkHandler))},yp.prototype.getModuleName=function(){return"spreadsheetHyperlink"},yp.prototype.keyUpHandler=function(e){var t,r,n,e=e.target;J.closest(e,".e-document")&&(t=document.querySelector(".e-hyp-text"),r=this.parent.element.querySelector(".e-hyperlink-alert-span"),n=(J.closest(e,".e-hyperlink-dlg")||J.closest(e,".e-edithyperlink-dlg")).getElementsByClassName("e-footer-content")[0].firstChild,t)&&!J.isNullOrUndefined(t.value)&&(On(t.value.toUpperCase())?r&&(r.remove(),n.removeAttribute("disabled")):(this.showDialog(),n.setAttribute("disabled","true"))),e.classList.contains("e-text")&&J.closest(e,".e-cont")&&J.closest(e,".e-webpage")&&J.closest(e,".e-webpage").getElementsByClassName("e-cont")[1]===e.parentElement&&(n=(J.closest(e,".e-hyperlink-dlg")||J.closest(e,".e-edithyperlink-dlg")).getElementsByClassName("e-footer-content")[0].firstChild,""!==e.value?n.removeAttribute("disabled"):J.closest(e,".e-link-dialog").querySelector(".e-webpage").querySelectorAll(".e-cont")[1].querySelector(".e-text").value||n.setAttribute("disabled","true"))},yp.prototype.initiateHyperlinkHandler=function(){var r,n,i=this,e=this.parent.getActiveSheet();!e.isProtected||e.protectSettings.insertLink&&!kd(this.parent)?Bd(this.parent)?this.parent.notify($a,null):(e=this.parent.serviceLocator.getService(A),this.parent.element.querySelector(".e-hyperlink-dlg")||(r=this.parent.serviceLocator.getService(k)).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(),ae(i.parent.element))},open:function(){setTimeout(function(){ae(r.dialogInstance.element.querySelectorAll(".e-webpage input")[1])})},buttons:[{buttonModel:{content:e.getConstant("Insert"),isPrimary:!0,disabled:!0},click:function(){i.dlgClickHandler(n),r.hide()}}]})):this.parent.notify(Ka,null)},yp.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 s=r.getElementsByClassName("e-cont")[2].querySelector(".e-active").textContent,a=0;a<this.parent.definedNames.length;a++)this.parent.definedNames[a].name===s&&(o={address:this.parent.definedNames[a].name},this.parent.insertHyperlink(o,n,t,!1))}},yp.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(A),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)},yp.prototype.editHyperlinkHandler=function(){var r,n=this,e=this.parent.serviceLocator.getService(A),i=this.parent.serviceLocator.getService(k);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(),ae(n.parent.element)},open:function(){setTimeout(function(){i.dialogInstance.element.querySelector(".e-webpage")?ae(i.dialogInstance.element.querySelectorAll(".e-webpage input")[1]):ae(i.dialogInstance.element.querySelectorAll(".e-document input")[1])})},buttons:[{buttonModel:{content:e.getConstant("Update"),isPrimary:!0},click:function(){n.dlgClickHandler(r),i.hide()}}]})},yp.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)},yp.prototype.hlOpenHandler=function(e,t){var r=this;if(e.classList.contains("e-hyperlink")){e=J.closest(e,".e-cell");if(e){var n=["",""],i=void 0,o=!0,s=this.parent.getActiveSheet(),a=parseInt(e.getAttribute("aria-colindex"),10)-1,l=parseInt(e.parentElement.getAttribute("aria-rowindex"),10)-1,h=ie(l,a,s,!1,!0);h.style&&"#00e"===h.style.color&&(Gn(this.parent,s,{rowIdx:l,colIdx:a,preventEvt:!0,cell:{style:{color:"#551a8b"}}}),e.style.color="#551a8b");var d=void 0,l={hyperlink:h.hyperlink,address:s.activeCell,target:"_blank",cancel:!1};if(this.parent.trigger(Jt,l),!l.cancel){var p,e={hyperlink:a=l.hyperlink,address:s.activeCell},c=("string"==typeof a&&(d=a),d="object"==typeof a?a.address:d);if(-1===d.indexOf("http://")&&-1===d.indexOf("https://")&&-1===d.indexOf("ftp://")){if(!J.isNullOrUndefined(d)){if(this.parent.definedNames)for(var u=0;u<this.parent.definedNames.length;u++)if(this.parent.definedNames[u].name===d){d=(d=this.parent.definedNames[u].refersTo).slice(1);break}-1!==d.indexOf("!")?-1!==(n=d.split("!"))[0].indexOf(" ")&&(n[0]=n[0].slice(1,n[0].length-1)):(n[0]=this.parent.getActiveSheet().name,n[1]=d);for(var u=0;u<this.parent.sheets.length;u++)this.parent.sheets[u].name===n[0]&&(p=u);s=this.parent.sheets[p],-1!==n[1].indexOf(":")&&(h=n[1].indexOf(":"),a=n[1].substr(0,h),h=n[1].substr(h+1,n[1].length),a=a.replace("$",""),(h=h.replace("$","")).match(/\D/g)&&!h.match(/[0-9]/g)&&a.match(/\D/g)&&!a.match(/[0-9]/g)?(h+=s.rowCount,n[1]=(a+="1")+":"+h):!h.match(/\D/g)&&h.match(/[0-9]/g)&&!a.match(/\D/g)&&a.match(/[0-9]/g)&&(o=!(i=[parseInt(a,10)-1,0,parseInt(h,10)-1,s.colCount-1])));var f,g=void 0,m=this.parent.definedNames;if(!J.isNullOrUndefined(m))for(u=0;u<m.length;u++)if(m[u].name===c){g=!0;break}On(n[1])||g?(i=o?Q(n[1]):i,this.parent.scrollSettings.enableVirtualization&&(i[0]=i[0]>=this.parent.viewport.topIndex?i[0]-this.parent.viewport.topIndex:i[0],i[1]=i[1]>=this.parent.viewport.leftIndex?i[1]-this.parent.viewport.leftIndex:i[1]),J.isNullOrUndefined(s)||(f=ee(i),s===this.parent.getActiveSheet()?Ph(function(){r.parent.goTo(f)}):(0<=f.indexOf(":")&&(f=(a=f.split(":"))[0]===a[1]?a[0]:f),Ph(function(){r.parent.goTo(r.parent.sheets[p].name+"!"+f)})))):this.showInvalidHyperlinkDialog()}}else t||(this.isValidUrl(d)?window.open(d,l.target):this.showInvalidHyperlinkDialog());this.parent.trigger(Qt,e)}}}},yp.prototype.isValidUrl=function(e){return/(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/.test(e)},yp.prototype.showInvalidHyperlinkDialog=function(){var e=this.parent.serviceLocator.getService(k),t=this.parent.serviceLocator.getService(A);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)},yp.prototype.hyperlinkClickHandler=function(e){var t,r,n,i,o,s,a,e=e.target;J.closest(e,".e-link-dialog")&&J.closest(e,".e-toolbar-item")&&(a=(s=J.closest(e,".e-hyperlink-dlg")||J.closest(e,".e-edithyperlink-dlg")).getElementsByClassName("e-footer-content")[0].firstChild,n=s.querySelector(".e-document"),i=((t=s.querySelector(".e-webpage"))||n).querySelectorAll(".e-cont")[0].querySelector(".e-text").value,r=n?n.querySelectorAll(".e-cont")[0].querySelector(".e-text").value:i,J.closest(e,".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,J.closest(o,".e-list-item").classList.contains("e-level-2")&&a.hasAttribute("disabled")?a.removeAttribute("disabled"):J.closest(o,".e-list-item").classList.contains("e-level-1")&&!a.hasAttribute("disabled")&&a.setAttribute("disabled","true")):(n=!t.querySelectorAll(".e-cont")[1].querySelector(".e-text").value,t.querySelectorAll(".e-cont")[0].querySelector(".e-text").value=r,n&&!a.hasAttribute("disabled")?a.setAttribute("disabled","true"):!n&&a.hasAttribute("disabled")&&a.removeAttribute("disabled"))),J.closest(e,".e-list-item")&&e.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],a=(s=J.closest(e,".e-hyperlink-dlg")||J.closest(e,".e-edithyperlink-dlg")).getElementsByClassName("e-footer-content")[0].firstChild,J.closest(e,".e-list-item").classList.contains("e-level-2")?"defName"===J.closest(e,".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")),a.hasAttribute("disabled")&&a.removeAttribute("disabled")):"sheet"===J.closest(e,".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")),On(o.value.toUpperCase()))&&a.hasAttribute("disabled")&&a.removeAttribute("disabled"):J.closest(e,".e-list-item").classList.contains("e-level-1")&&a.setAttribute("disabled","true")):this.hlOpenHandler(e,!0)},yp.prototype.createHyperlinkEle=function(e){var t,r,n,i=e.cell;J.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"===So(i.format)?r.innerHTML=t.innerHTML:r.innerText=""!==t.innerText?t.innerText:n,t.textContent="",t.innerText="",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"),Gn(this.parent,this.parent.getActiveSheet(),{rowIdx:e.rowIdx,colIdx:e.colIdx,preventEvt:!0,cell:{style:i}}))},yp.prototype.hyperEditContent=function(){for(var e,t=!0,r=this.hyperlinkContent(),n=Q(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),s=0,a=this.parent.definedNames,l=this.parent.sheets,h=0,d=a.length;h<d;h++)a[h].name===e&&o++;for(h=0,d=l.length;h<d;h++)e.includes(l[h].name)&&s++;0===o&&0===s&&(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"),i=(t.getElementsByClassName("e-cont")[0].getElementsByClassName("e-text")[0].setAttribute("value",n),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 u=t.getElementsByClassName("e-cont")[2].querySelectorAll(".e-list-item.e-level-1")[1],h=0;h<u.getElementsByTagName("li").length;h++)u.getElementsByTagName("li")[h].innerText===e&&u.getElementsByTagName("li")[h].classList.add("e-active")}else{var f=(i=e&&-1!==e.indexOf("!")?e.split("!"):i)[0];t.getElementsByClassName("e-cont")[1].querySelector(".e-text").setAttribute("value",i[1]);for(u=t.getElementsByClassName("e-cont")[2].querySelectorAll(".e-list-item.e-level-1")[0],h=0;h<u.getElementsByTagName("li").length;h++)if(u.getElementsByTagName("li")[h].innerText===f){if(u.getElementsByTagName("li")[h].classList.contains("e-active"))break;u.getElementsByTagName("li")[h].classList.add("e-active")}else u.getElementsByTagName("li")[h].classList.contains("e-active")&&u.getElementsByTagName("li")[h].classList.remove("e-active")}}return r},yp.prototype.hyperlinkContent=function(){var e,t,r=this.parent.serviceLocator.getService(A),n=0,i=0,o=!0,s=!0,a=Q(this.parent.getActiveSheet().activeCell),l=this.parent.getActiveSheet(),a=ie(a[0],a[1],l),l=!0;if(a){var l=!!(a.value&&"string"==typeof a.value&&null!==a.value.match("[A-Za-z]+")||""===a.value||J.isNullOrUndefined(a.value)),h=a.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){s=!(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=(new F.Tab({selectedItem:i,items:[{header:{text:r.getConstant("WebPage")},content:h},{header:{text:r.getConstant("ThisDocument")},content:C}]}).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=(l||(S.classList.add("e-disabled"),S.setAttribute("readonly","true"),S.setAttribute("disabled","true")),a&&J.isNullOrUndefined(a.hyperlink)&&S.setAttribute("value",this.parent.getDisplayText(a)),this.parent.createElement("input",{className:"e-input e-text",attrs:{type:"Text"}})),I=(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=[],R=this.parent.sheets;n<this.parent.sheets.length;n++){var N=this.parent.sheets[n].name;"Visible"===this.parent.sheets[n].state&&(R[n]===this.parent.getActiveSheet()?I.push({nodeId:"sheet",nodeText:-1!==N.indexOf(" ")?"'"+N+"'":N,selected:!0}):I.push({nodeId:"sheet",nodeText:-1!==N.indexOf(" ")?"'"+N+"'":N}))}for(n=0;n<this.parent.definedNames.length;n++)E.push({nodeId:"defName",nodeText:this.parent.definedNames[n].name});b=[{nodeId:"01",nodeText:r.getConstant("CellReference"),expanded:s,nodeChild:I},{nodeId:"02",nodeText:r.getConstant("DefinedNames"),expanded:e,nodeChild:E}],S=new F.TreeView({fields:{dataSource:b,id:"nodeId",text:"nodeText",child:"nodeChild"}}),x=this.parent.createElement("div",{className:"e-cont"}),w=this.parent.createElement("div",{className:"e-header"}),w.innerText=r.getConstant("CellReference"),h=this.parent.createElement("input",{className:"e-input e-text e-hyp-text",attrs:{type:"Text"}}),h.setAttribute("value","A1"),x.appendChild(h),x.insertBefore(w,h),i=this.parent.createElement("div",{className:"e-cont"}),o=this.parent.createElement("div",{className:"e-header"}),o.innerText=r.getConstant("DisplayText"),b=this.parent.createElement("input",{className:"e-input e-text",attrs:{type:"Text"}}),l||(b.classList.add("e-disabled"),b.setAttribute("readonly","true"),b.setAttribute("disabled","true")),a&&J.isNullOrUndefined(a.hyperlink)&&b.setAttribute("value",this.parent.getDisplayText(a)),b.setAttribute("placeholder",r.getConstant("EnterTheTextToDisplay")),i.appendChild(b),i.insertBefore(o,b),w=this.parent.createElement("div",{className:"e-cont"}),h=this.parent.createElement("div",{className:"e-header"}),h.innerText=r.getConstant("Sheet"),l=this.parent.createElement("div",{className:"e-refcont"});return w.appendChild(l),w.insertBefore(h,l),C.appendChild(x),C.insertBefore(i,x),S.appendTo(l),C.appendChild(w),y},yp.prototype.removeHyperlink=function(e){var t=ie(e.rowIdx,e.colIdx,e.sheet);t&&t.hyperlink&&("string"==typeof t.hyperlink?t.value=t.value||t.hyperlink: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(jr,null),e.preventRefresh||this.parent.serviceLocator.getService("cell").refresh(e.rowIdx,e.colIdx,!1,null,!0,!1,Td(this.parent)))},yp.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 o=r.split("!"),s=this.parent.sheets,a=0;a<s.length;a++)s[a].name===o[0]&&(t=a);n=this.parent.sheets[t],r=o[1]}for(var l,h,d=Q(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(oe,{action:"removeHyperlink",eventArgs:{address:-1===r.indexOf("!")?n.name+"!"+r:r}})};var vp=yp;function yp(e){this.parent=e,this.addEventListener()}var Cp=function(){return(Cp=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)},bp=(xp.prototype.setActionData=function(e){var t,r=this.parent.getActiveSheet(),n=[],i=e.args,o=i.eventArgs;switch(i.action){case"format":t=Q(i.eventArgs.range);break;case"clipboard":s=o.copiedInfo,t=Q(C(o.pastedRange)),s&&s.isCut&&(n=this.getCellDetails(s.range,ne(this.parent,bi(this.parent,s.sId)),"clipboard"));break;case"beforeSort":(t=Q(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":t=Q(o.address);break;case"beforeWrap":case"beforeReplace":case"chartDesign":t=this.parent.getAddressInfo(o.address).indices;break;case"beforeClear":case"beforeInsertImage":t=Q(o.range);break;case"deleteImage":t=Q(o.address);break;case"beforeInsertChart":case"filter":t=Q(o.range);break;case"autofill":t=Q(o.fillRange);break;case"removeValidation":if(o.isColSelected){this.beforeActionData={cellDetails:[]};for(var s=o.range.split("!")[1].split(":"),a=R(s[0]),l=R(s[1]);a<=l;a++)r.columns[a]&&r.columns[a].validation&&this.beforeActionData.cellDetails.push({colIndex:a,validation:r.columns[a].validation})}else t=Q(o.range);break;case"hyperlink":case"removeHyperlink":t=Q(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})},xp.prototype.getBeforeActionData=function(e){e.beforeDetails=this.beforeActionData},xp.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={};if(!e.isPublic){var o=t.eventArgs.beforeActionData;if(delete t.eventArgs.beforeActionData,n={action:t.action,eventArgs:{}},J.extend(n.eventArgs,t.eventArgs,null,!0),t.eventArgs.beforeActionData=o,n.eventArgs.cancel=!1,t.preventAction=n.preventAction=!0,e.isUndo?n.isUndo=!0: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"removeHyperlink":t=this.performOperation(t,e.preventEvt,e.preventReSelect);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":vd(t,this.parent,!e.isUndo);break;case"replace":t=this.performOperation(t);break;case"replaceAll":t.eventArgs.isAction=!1,e.isUndo&&(i.value=t.eventArgs.replaceValue,i.replaceValue=t.eventArgs.value,i.skipFormatCheck=Td(this.parent)),this.parent.notify(gr,Cp({},t.eventArgs,i));break;case"insert":case"filter":vd(t,this.parent,!e.isUndo,null,n),r="filter"===t.action;break;case"delete":vd(t,this.parent,!e.isUndo);break;case"validation":case"addHighlight":case"removeHighlight":vd(t,this.parent,!e.isUndo);break;case"merge":t.eventArgs.merge=t.isFromUpdateAction?t.eventArgs.merge:!t.eventArgs.merge,vd(t,this.parent,!1);break;case"clear":t=this.performOperation(t),e.isUndo&&t.eventArgs.cfClearActionArgs&&vd({action:"clearCF",eventArgs:t.eventArgs.cfClearActionArgs},this.parent,!e.isUndo);break;case"conditionalFormat":vd(t,this.parent,!e.isUndo,this.undoCollection);break;case"clearCF":vd(t,this.parent,!e.isUndo);break;case"insertImage":case"deleteImage":case"imageRefresh":vd(t,this.parent,!e.isUndo);break;case"insertChart":case"deleteChart":case"chartRefresh":vd(t,this.parent,!e.isUndo);break;case"chartDesign":t.eventArgs.isUndo=e.isUndo,this.parent.notify(Ml,t.eventArgs);break;case"addDefinedName":vd(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(oe,J.extend({isUndoRedo:!0,isUndo:e.isUndo},t)),this.parent.notify(jr,null)}},xp.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))&&J.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=Q(e.eventArgs.range);if(t){if(this.parent.notify(Xt,{result:e.eventArgs.beforeActionData.cellDetails,range:o,sheet:ne(this.parent,i),jsonData:e.eventArgs.beforeActionData.sortedCellDetails,isUndo:!0}),this.parent.notify(Kt,{range:e.eventArgs.range}),this.parent.sortCollection&&e.eventArgs.previousSort)for(var s=this.parent.sortCollection.length-1;0<=s;s--)if(this.parent.sortCollection[s].sheetIndex===i){r(s,!1),this.parent.sortCollection.splice(s,1);var a=e.eventArgs.previousSort;if(Array.isArray(a))for(var l=0;l<a.length;l++)this.parent.sortCollection.splice(l,0,a[l]),r(l,!0);this.parent.sortCollection.length||(this.parent.sortCollection=void 0);break}}else if(vd(e,this.parent,!0),e.eventArgs.previousSort){var h=0;if(this.parent.sortCollection)for(s=this.parent.sortCollection.length-1;0<=s;s--)this.parent.sortCollection[s].sheetIndex===i&&(r(s,!1),h=s,this.parent.sortCollection.splice(s,1));else this.parent.sortCollection=[];this.parent.sortCollection.splice(h,0,{sortRange:e.eventArgs.range.split("!")[1],sheetIndex:i,columnIndex:R(e.eventArgs.sortOptions.sortDescriptors.field),order:e.eventArgs.sortOptions.sortDescriptors.order}),r(h,!0)}},xp.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","addDefinedName","removeValidation","removeHighlight","addHighlight","hyperlink","removeHyperlink","deleteImage","chartDesign","replaceAll","addNote"],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&&"removeValidation"!==n&&"addDefinedName"!==n&&"hyperlink"!==n&&"removeHyperlink"!==n&&"deleteImage"!==n&&"chartDesign"!==n&&"addNote"!==n||(this.parent.notify(Ea,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,ne(this.parent,t.sheetIndex),n)),this.undoCollection.push(e.args),this.redoCollection=[],this.undoCollection.length>this.undoRedoStep&&this.undoCollection.splice(0,1),this.updateUndoRedoIcons())},xp.prototype.clearUndoRedoCollection=function(){this.undoCollection=[],this.redoCollection=[],this.updateUndoRedoIcons()},xp.prototype.updateUndoRedoIcons=function(){var e=this.parent.serviceLocator.getService(A);this.parent.notify(Os,[{tab:e.getConstant("Home"),items:[this.parent.element.id+"_undo"],enable:0<this.undoCollection.length}]),this.parent.notify(Os,[{tab:e.getConstant("Home"),items:[this.parent.element.id+"_redo"],enable:0<this.redoCollection.length}])},xp.prototype.undoForClipboard=function(e,t,r){var n,i,o,s=this,a=e.eventArgs,l=a.pastedRange.split("!"),h=Q(l[1]),d=B(this.parent,l[0]),p=ne(this.parent,d),c=a.copiedInfo,u=a.beforeActionData,f=e.isFromUpdateAction,g=d===this.parent.activeSheetIndex;return r&&(r.isUndoRedo=!0,r.eventArgs.beforeActionData=u),"imagePaste"===e.eventArgs.requestType?(i=a.copiedShapeInfo,t?(n=i.pictureElem,i.isCut?(this.parent.notify(Sl,{id:n.id,sheetIdx:a.pasteSheetIndex+1}),this.parent.notify(xl,{options:{src:n.style.backgroundImage.replace(/url\((['"])?(.*?)\1\)/gi,"$2"),height:i.height,width:i.width,imageId:n.id},range:i.copiedRange,isPublic:!1,isUndoRedo:!0})):this.parent.notify(Sl,{id:a.pastedPictureElement.id,sheetIdx:a.pasteSheetIndex+1})):i.isCut?(n=i.pictureElem,this.parent.notify(Sl,{id:n.id,sheetIdx:i.sId}),this.parent.notify(xl,{options:{src:n.style.backgroundImage.replace(/url\((['"])?(.*?)\1\)/gi,"$2"),height:i.height,width:i.width,imageId:n.id},range:i.pastedRange,isPublic:!1,isUndoRedo:!0})):(n=a.pastedPictureElement,this.parent.notify(xl,{options:{src:n.style.backgroundImage.replace(/url\((['"])?(.*?)\1\)/gi,"$2"),height:n.offsetHeight,width:n.offsetWidth,imageId:n.id},range:i.pastedRange,isPublic:!1,isUndoRedo:!0}))):(t?(c.isCut&&(n=u.cutCellDetails,this.updateCellDetails(n,ne(this.parent,bi(this.parent,c.sId)),te(c.range),g,e),a.cfClearActionArgs)&&vd({action:"clearCF",eventArgs:a.cfClearActionArgs},this.parent,!1),u&&this.updateCellDetails(u.cellDetails,p,h,g,e,null,null,r?r.isUndoRedo:null),a.cfActionArgs&&a.cfActionArgs.cfModel.forEach(function(e){vd({eventArgs:{range:e.range,type:e.type,cFColor:e.cFColor,value:e.value,sheetIdx:a.cfActionArgs.sheetIdx,cancel:!0},action:"conditionalFormat"},s.parent,!1)}),Nd(p,h[0],h[1],gh(p,h[0])),i=Ad(p,h[0]),Cd(this.parent,p,i,h[0]),a.mergeCollection.forEach(function(e){e.merge=!e.merge,s.parent.notify(kr,e),e.merge=!e.merge}),r&&!f&&this.parent.notify(oe,r)):c.isExternal?(o=this.parent.getAddressInfo(a.pastedRange),this.updateCellDetails(c.cellDetails,ne(this.parent,o.sheetIndex),o.indices,!0,e,null,null,r?r.isUndoRedo:null),r&&!f&&this.parent.notify(oe,r)):(t=new Promise(function(e){e(void 0)}),o=this.parent.getAddressInfo(a.copiedRange),this.parent.notify(a.copiedInfo.isCut?Ps:Ms,{range:o.indices,sId:ne(this.parent,o.sheetIndex).id,promise:t,invokeCopy:!0,isPublic:!0,isFromUpdateAction:f}),t.then(function(){s.parent.notify(Bs,{range:l&&y(a.pastedRange),sIdx:l&&B(s.parent,xi(a.pastedRange)),type:a.type,isAction:!1,isInternal:!0,isFromUpdateAction:f}),r&&!f&&s.parent.notify(oe,r)})),g&&!f?(this.parent.notify(Ds,{address:a.selectedRange}),this.parent.notify(Yl,{})):this.checkRefreshNeeded(d,f)),e},xp.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,vd(e,this.parent,!1),this.parent.getActiveSheet()),r=Q(n.activeCell),n=ie(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},xp.prototype.performOperation=function(e,t,r){var n,i=e.eventArgs,o=[],o=("autofill"===e.action?i.fillRange:"cellSave"===e.action||"wrap"===e.action||"replace"===e.action||"cellDelete"===e.action||"hyperlink"===e.action||"addNote"===e.action||"removeHyperlink"===e.action?i.address:i.range).split("!"),s=B(this.parent,o[0]),a=ne(this.parent,s),l=n=i.isColSelected?[0,R((h=o[1].split(":"))[0]),a.rowCount-1,R(h[1])]:te(Q(o[1])),h=i.beforeActionData,d=e.isFromUpdateAction,s=this.checkRefreshNeeded(s,d),p={cellIdx:[n[0],n[1]],isUnique:!1,uniqueRange:""};if(i.isColSelected||this.parent.notify(zt,p),this.isUndo){if(p.isUnique&&i.formula&&-1<i.formula.indexOf("UNIQUE"))if("#SPILL!"!==ie((f=Q(p.uniqueRange))[0],f[1],this.parent.getActiveSheet()).value)for(var c=f[0];c<=f[2];c++)for(var u=f[1];u<=f[3];u++)c===f[0]&&u===f[1]&&(u+=1),this.parent.updateCell({value:""},ee([c,u]));if(this.updateCellDetails(h.cellDetails,a,n,s,e,t,i.isColSelected),p.isUnique&&"cellDelete"===e.action&&i.isSpill){for(var f,g=ie((f=Q(p.uniqueRange))[0],f[1],this.parent.getActiveSheet()),m=f[0];m<=f[2];m++)for(c=f[1];c<=f[3];c++)for(u=n[0];u<=n[2];u++)for(var v=n[1];v<=n[3];v++)m===u&&c===v||this.parent.updateCell({value:""},G(m,c));g.value="#SPILL!",this.parent.updateCell(g,G(f[0],f[1]))}if(!i.isSpill&&""!==p.uniqueRange){for(var y=Q(p.uniqueRange),c=y[0];c<=y[2];c++)for(u=y[1];u<=y[3];u++)c===y[0]&&u===y[1]&&(u+=1),this.parent.updateCell({value:""},ee([c,u]));this.parent.notify(jt,null)}}else{var h=e.eventArgs,t=Q(a.activeCell),C=this.parent.getCellStyleValue(["textDecoration"],t).textDecoration;if(h&&h.style&&h.style.textDecoration){var b=h.style.textDecoration,t=b,x=void 0,S=!1;"underline"===C?t="underline"===b?"none":"underline line-through":"line-through"===C?t="line-through"===b?"none":"underline line-through":"underline line-through"===C&&(t="underline"===b?"line-through":"underline",S=!0),"none"===t&&(S=!0),h.style.textDecoration=t,e.eventArgs=h;for(m=l[0];m<=l[2];m++)for(c=l[1];c<=l[3];c++){if(x={},"none"===(C=this.parent.getCellStyleValue(["textDecoration"],[m,c]).textDecoration)){if(S)continue;x.textDecoration=b}else if("underline"===C||"line-through"===C)if(S){if(b!==C)continue;x.textDecoration="none"}else x.textDecoration=b!==C?"underline line-through":b;else if("underline line-through"===C){if(!S)continue;x.textDecoration="underline"===b?"line-through":"underline"}this.parent.notify(It,{style:{textDecoration:x.textDecoration},range:[m,c,m,c],refreshRibbon:!0,onActionUpdate:!0})}h.style.textDecoration=b,e.eventArgs=h}else{if(!J.isNullOrUndefined(i.oldValue)&&i.oldValue!==i.value&&p.isUnique){var w=Q(p.uniqueRange);if("#SPILL!"!==ie(w[0],w[1],this.parent.getActiveSheet()).value)for(c=w[0];c<=w[2];c++)for(u=w[1];u<=w[3];u++)c===w[0]&&u===w[1]&&(this.parent.updateCell({value:"#SPILL!"},ee([w[0],w[1]])),u+=1),this.parent.updateCell({value:""},ee([c,u]))}if(vd(e,this.parent,!0),p.isUnique&&"cellDelete"===e.action&&i.isSpill){for(var I=Q(p.uniqueRange),E=!1,m=I[0];m<=I[1];m++)for(c=I[1];c<=I[3];c++)m===I[0]&&c===I[1]&&c++,ie(m,c,a)&&!J.isNullOrUndefined(ie(m,c,a).value)&&""!==ie(m,c,a).value&&(E=!0);E||((g=ie(I[0],I[1],this.parent.getActiveSheet())).value="",this.parent.updateCell(g,G(I[0],I[1])),this.parent.notify(jt,null))}}}return"autofill"===e.action&&(o[1]=this.isUndo?e.eventArgs.dataRange:e.eventArgs.selectedRange),!s||r||d||(i.isColSelected&&(o[1]=a.selectedRange),this.parent.notify(Ds,{address:o[1]})),this.parent.showAggregate&&this.parent.notify(il,{}),e},xp.prototype.getCellDetails=function(e,t,r){for(var n,i=[],o="cellDelete"===r,s=(e=te(e))[0];s<=e[2];s++)if(!o||!fh(t,s))for(var a=e[1];a<=e[3];a++)n=ie(s,a,t),i.push({rowIndex:s,colIndex:a,format:n?n.format:null,isLocked:n?n.isLocked:null,style:n&&n.style?Object.assign({},n.style):null,value:n?n.value:"",formula:n?n.formula:"",wrap:n&&n.wrap,rowSpan:n&&n.rowSpan,colSpan:n&&n.colSpan,hyperlink:n&&(J.isObject(n.hyperlink)?J.extend({},n.hyperlink):n.hyperlink),image:n&&n.image,chart:n&&n.chart&&JSON.parse(JSON.stringify(n.chart)),validation:n&&n.validation,notes:n?n.notes:null,isReadOnly:n?n.isReadOnly:null});return i},xp.prototype.updateCellDetails=function(r,n,e,t,i,o,s,a){for(var l,h,d,p,c=this,u=r.length,f=i&&!o&&("cellSave"===i.action||"cellDelete"===i.action||"autofill"===i.action||"clipboard"===i.action),g=i&&!i.eventArgs.cfClearActionArgs&&n.conditionalFormats&&n.conditionalFormats.length&&[].slice.call(n.conditionalFormats),m=[],v=this,y=0;y<u;y++)!function(t){if(s)return Sh(n,r[t].colIndex,{validation:r[t].validation});(l=ie(r[t].rowIndex,r[t].colIndex,n,!1,!0)).style&&i&&("format"===i.action||"clipboard"===i.action)&&(!l.style.borderTop||r[t].style&&r[t].style.borderTop||v.parent.setBorder({borderTop:""},n.name+"!"+G(r[t].rowIndex,r[t].colIndex),null,a),!l.style.borderLeft||r[t].style&&r[t].style.borderLeft||v.parent.setBorder({borderLeft:""},n.name+"!"+G(r[t].rowIndex,r[t].colIndex),null,a),!l.style.borderRight||r[t].style&&r[t].style.borderRight||v.parent.setBorder({borderRight:""},n.name+"!"+G(r[t].rowIndex,r[t].colIndex),null,a),!l.style.fontSize||r[t].style&&r[t].style.fontSize||(l.style.fontSize="11pt",h=!0,v.parent.notify(Nt,{style:{fontSize:"11pt"},rowIdx:r[t].rowIndex,colIdx:r[t].colIndex,lastCell:!0,isHeightCheckNeeded:!0,manualUpdate:!0,onActionUpdate:!0})),!l.style.fontFamily||r[t].style&&r[t].style.fontFamily||(h=!0,l.style.fontFamily="Calibri",v.parent.notify(Nt,{style:{fontFamily:"Calibri"},rowIdx:r[t].rowIndex,colIdx:r[t].colIndex,lastCell:!0,isHeightCheckNeeded:!0,manualUpdate:!0,onActionUpdate:!0}))),l.image&&i&&"clipboard"===i.action&&l.image.forEach(function(e){c.parent.notify(Sl,{id:e.id,sheet:n,preventEventTrigger:!0,rowIdx:r[t].rowIndex,colIdx:r[t].colIndex})}),Mi(r[t].rowIndex,r[t].colIndex,n,{value:r[t].formula&&r[t].formula.toUpperCase().includes("UNIQUE")?null:r[t].value,format:r[t].format,isLocked:r[t].isLocked,style:r[t].style&&Object.assign({},r[t].style),formula:r[t].formula,wrap:r[t].wrap,rowSpan:r[t].rowSpan,colSpan:r[t].colSpan,hyperlink:r[t].hyperlink,validation:r[t]&&r[t].validation,image:r[t].image,notes:r[t].notes,isReadOnly:r[t].isReadOnly}),p={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(v.parent,n.name),skipFormatCheck:Td(v.parent)},v.parent.notify(kt,p),g&&!d&&(d=p.isFormulaDependent),(i&&"wrap"===i.action&&i.eventArgs.wrap||l.wrap&&!r[t].wrap)&&v.parent.notify(nr,{range:[r[t].rowIndex,r[t].colIndex,r[t].rowIndex,r[t].colIndex],wrap:!1,sheet:n}),i&&r[t].hyperlink&&"clear"===i.action&&(i.eventArgs.range=n.name+"!"+ee([r[t].rowIndex,r[t].colIndex,r[t].rowIndex,r[t].colIndex]),p=v.parent.getCell(r[t].rowIndex,r[t].colIndex),"Clear All"===i.eventArgs.type||"Clear Hyperlinks"===i.eventArgs.type?v.parent.addHyperlink(r[t].hyperlink,i.eventArgs.range,r[t].value):"Clear Formats"===i.eventArgs.type&&p&&J.addClass(p.querySelectorAll(".e-hyperlink"),"e-hyperlink-style")),f&&r[t].value!==l.value&&v.parent.trigger("cellSave",{element:null,value:r[t].value,oldValue:l.value,formula:r[t].formula,cancel:!1,address:n.name+"!"+G(r[t].rowIndex,r[t].colIndex),displayText:v.parent.getDisplayText(r[t])}),g&&!d&&$n(g,m,r[t].rowIndex,r[t].colIndex)}(y);t&&(e[0]===e[2]&&e[1]===e[3]&&(1<(o=ie(e[0],e[1],n)).rowSpan&&(e[2]=e[0]+o.rowSpan-1),1<o.colSpan)&&(e[3]=e[1]+o.colSpan-1),this.parent.serviceLocator.getService("cell").refreshRange(e,!1,!1,!0,!1,Td(this.parent)),(m.length||d)&&this.parent.notify(Mr,{cfModel:!d&&m,refreshAll:d,isAction:!0}),h)&&Ph(function(){c.parent.selectRange(n.selectedRange)})},xp.prototype.checkRefreshNeeded=function(e,t){var r=!0;return e!==this.parent.activeSheetIndex&&(t||(this.parent.activeSheetIndex=e,this.parent.dataBind()),r=!1),r},xp.prototype.addEventListener=function(){this.parent.on(Sa,this.performUndoRedo,this),this.parent.on(wa,this.updateUndoRedoCollection,this),this.parent.on(Ia,this.setActionData,this),this.parent.on(Ea,this.getBeforeActionData,this),this.parent.on(Ra,this.clearUndoRedoCollection,this),this.parent.on(Za,this.updateUndoRedoIcons,this)},xp.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(Sa,this.performUndoRedo),this.parent.off(wa,this.updateUndoRedoCollection),this.parent.off(Ia,this.setActionData),this.parent.off(Ea,this.getBeforeActionData),this.parent.off(Ra,this.clearUndoRedoCollection),this.parent.off(Za,this.updateUndoRedoIcons))},xp.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},xp.prototype.getModuleName=function(){return"undoredo"},xp);function xp(e){this.undoCollection=[],this.redoCollection=[],this.isUndo=!1,this.undoRedoStep=100,this.parent=e,this.addEventListener()}wp.prototype.addEventListener=function(){this.parent.on(Fs,this.ribbonClickHandler,this),this.parent.on(nr,this.wrapTextHandler,this),this.parent.on(Qs,this.rowHeightChangedHandler,this),this.parent.on(ea,this.colWidthChanged,this)},wp.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(Fs,this.ribbonClickHandler),this.parent.off(nr,this.wrapTextHandler),this.parent.off(Qs,this.rowHeightChangedHandler),this.parent.off(ea,this.colWidthChanged))},wp.prototype.wrapTextHandler=function(e){if((e.initial||qh(this.parent,e.range,!0))&&!Bd(this.parent,e.range)){e.initial&&!e.td&&qh(this.parent,e.range,!0)&&(e.initial=!1);for(var t,r=void 0,n=void 0,i=void 0,o=void 0,s=e.range[0];s<=e.range[2];s++)for(var a,n=0,l=(a=ch(e.sheet,s).customHeight)||e.isCustomHgt,h=e.range[1];h<=e.range[3];h++)if(!((t=ie(s,h,e.sheet,null,!0)).rowSpan<0||t.colSpan<0)){var d=1<t.rowSpan||1<t.colSpan;if((r=e.initial?e.td:this.parent.getCell(s,h))?(e.wrap?(o=xd(t.style&&t.style.fontFamily?t.style:this.parent.cellStyle),r.classList.add(Ah)):(r.classList.remove(Ah),o=null),(l||d)&&this.updateWrapCell(s,h,e.sheet,r),J.Browser.isIE&&r.classList.add("e-ie-wrap")):o=null,!l&&!d){var p=Ed(e.sheet,s,h,1<t.colSpan?h+t.colSpan-1:h),c=this.parent.getDisplayText(t).toString();if(c=r&&c.indexOf("\n")<0&&(y=this.parent.element.querySelector(".e-spreadsheet-edit"))&&-1<y.textContent.indexOf("\n")?y.textContent:c)if(e.wrap){r&&r.classList.contains("e-alt-unwrap")&&r.classList.remove("e-alt-unwrap");var u=void 0,f=0,g=void 0;if(-1<c.indexOf("\n")){for(var m=c.split("\n"),v=m.length,g=0;g<v;g++)f+=u=0===(u=wd(m[g],p,t.style,this.parent.cellStyle))?1:u;u=f}else u=wd(c,p,t.style,this.parent.cellStyle);if(i=Rd(this.parent,s,h,e.sheet,t.style||this.parent.cellStyle,u,o),n=Math.max(n,i),1<t.rowSpan){var y=vh(e.sheet,s,s+(t.rowSpan-1));if(n<=y)return;i=n=gh(e.sheet,s)+(n-y)}Nd(e.sheet,s,h,i)}else r&&-1<c.indexOf("\n")&&r.classList.add("e-alt-unwrap"),i=Rd(this.parent,s,h,e.sheet,t.style||this.parent.cellStyle,1,o),Nd(e.sheet,s,h,i),n=Math.max(Ad(e.sheet,s),20);else e.wrap&&c||(Nd(e.sheet,s,h,20),n=Math.max(Ad(e.sheet,s),20));h===e.range[3]&&(e.wrap&&20<n&&Ad(e.sheet,s)<=n||(!e.wrap||!c)&&Ad(e.sheet,s)<gh(e.sheet,s)&&20<gh(e.sheet,s))&&(r?(Cd(this.parent,e.sheet,n,s,e.row,e.hRow),e.sheet.conditionalFormats&&e.sheet.conditionalFormats.length&&this.parent.notify(Mr,{indexes:[s,h],isAction:!0})):(mh(e.sheet,s,n),this.parent.setProperties({sheets:this.parent.sheets},!0)))}r&&(l&&!d&&(c=this.parent.getDisplayText(t),e.wrap?r.classList.contains("e-alt-unwrap")&&r.classList.remove("e-alt-unwrap"):-1<c.indexOf("\n")&&r.classList.add("e-alt-unwrap")),e.wrap?a?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(Yl,null)}},wp.prototype.ribbonClickHandler=function(e){var t,r,e=J.closest(e.originalEvent.target,".e-btn");e&&e.id===this.parent.element.id+"_wrap"&&(e=e.classList.contains("e-active"),r={address:t=b(this.parent.getActiveSheet()),wrap:e,cancel:!1},Bd(this.parent)?this.parent.notify($a,null):(this.parent.notify(gt,{action:"beforeWrap",eventArgs:r}),r.cancel||(Hi(this.parent.getActiveSheet().selectedRange,e,this.parent),this.parent.notify(oe,{action:"wrap",eventArgs:{address:t,wrap:e}}))))},wp.prototype.rowHeightChangedHandler=function(e){if(e.isCustomHgt)for(var t=this.parent.getActiveSheet(),r=void 0,n=this.parent.viewport.leftIndex,i=this.parent.viewport.rightIndex;n<=i;n++)ie(e.rowIdx,n,t,!1,!0).wrap&&(r=this.parent.getCell(e.rowIdx,n),this.updateWrapCell(e.rowIdx,n,t,r),r.style.lineHeight)&&(r.style.lineHeight="")},wp.prototype.colWidthChanged=function(e){if(e.checkWrapCell)for(var t=this.parent.getActiveSheet(),r=this.parent.viewport.topIndex,n=this.parent.viewport.bottomIndex;r<=n;r++)ie(r,e.colIdx,t,!1,!0).wrap&&this.updateWrapCell(r,e.colIdx,t,this.parent.getCell(r,e.colIdx))},wp.prototype.updateWrapCell=function(e,t,r,n){if(n&&!n.querySelector(".e-wrap-content")){for(var i=this.wrapCell.cloneNode(),o=n.querySelector(".e-filter-btn");n.childElementCount&&!J.isNullOrUndefined(n.firstElementChild)&&-1===n.firstElementChild.className.indexOf("e-addNoteIndicator");)i.appendChild(n.firstElementChild);var s=void 0;!J.isNullOrUndefined(n.firstElementChild)&&-1<n.firstElementChild.className.indexOf("e-addNoteIndicator")&&(s=document.getElementsByClassName("e-addNoteIndicator")[0]),o&&(n.firstChild?n.insertBefore(o,n.firstChild):n.appendChild(o)),ie(e,t,r,!1,!0).hyperlink||((o=n.lastChild)&&3===o.nodeType?(i.appendChild(document.createTextNode(o.textContent)),o.textContent=""):(i.appendChild(document.createTextNode(n.textContent)),n.textContent="")),n.appendChild(i),J.isNullOrUndefined(s)||n.appendChild(s)}},wp.prototype.getModuleName=function(){return"wrapText"},wp.prototype.destroy=function(){this.removeEventListener(),this.wrapCell&&(this.wrapCell.remove(),this.wrapCell=null),this.parent=null};var Sp=wp;function wp(e){this.parent=e,this.wrapCell=this.parent.createElement("span",{className:"e-wrap-content"}),this.addEventListener()}Ep.prototype.insert=function(e){var t,r,n,i,o,s=e.eventArgs,a=(this.parent.notify(Zr,s),ne(this.parent,s.activeSheetIndex));switch(s.modelType){case"Sheet":this.parent.notify(Ns,{startIdx:s.index,endIdx:s.index+(s.model.length-1),preventUpdate:!s.isAction}),this.parent.renderModule.refreshSheet();break;case"Row":s.activeSheetIndex===this.parent.activeSheetIndex&&(r=this.parent.frozenRowCount(a),!this.parent.scrollSettings.enableVirtualization||s.index<=this.parent.viewport.bottomIndex?s.freezePane?this.parent.renderModule.refreshSheet(!1,!1,!0):(this.parent.scrollSettings.enableVirtualization?(t=this.parent.frozenColCount(a),s.index>=this.parent.viewport.topIndex+r&&(n=[],i=void 0,t?(i=W(a.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===K(a,r,!0)}),t)&&(this.parent.viewport.leftIndex=o),i=W(a.paneTopLeftCell)[0],s.index<i&&(this.parent.notify(th,{scrollTop:vh(a,r,i-1,!0)}),this.parent.goTo(G(s.index,K(a,t,!0,"columns"))))):this.parent.renderModule.refreshUI({skipUpdateOnFirst:!0,rowIndex:this.parent.viewport.topIndex,colIndex:0,refresh:"Row"}),this.parent.selectRange(a.selectedRange)):!this.parent.scrollSettings.isFinite||this.parent.viewport.topIndex+r!==K(a,0,!0)&&this.parent.viewport.bottomIndex!==K(a,a.rowCount-s.model.length-1,!1)||this.parent.renderModule.refreshSheet(!1,!1,!0));break;case"Column":s.activeSheetIndex===this.parent.activeSheetIndex&&(t=this.parent.frozenColCount(a),!this.parent.scrollSettings.enableVirtualization||s.index<=this.parent.viewport.rightIndex?s.freezePane?this.parent.renderModule.refreshSheet(!1,!1,!0):(this.parent.scrollSettings.enableVirtualization?(r=this.parent.frozenRowCount(a),s.index>=this.parent.viewport.leftIndex+t&&(n=[],r&&(n=[r+this.parent.viewport.topIndex,t]),o=r?W(a.topLeftCell)[0]:this.parent.viewport.topIndex,i=this.parent.viewport.topIndex,this.parent.renderModule.refreshUI({skipUpdateOnFirst:this.parent.viewport.leftIndex+t===K(a,t,!0,"columns"),rowIndex:o,colIndex:this.parent.viewport.leftIndex,refresh:"Column",frozenIndexes:n}),r)&&(this.parent.viewport.topIndex=i),o=W(a.paneTopLeftCell)[1],s.index<o&&(this.parent.notify(th,{scrollLeft:Ih(a,0,o-1,!0)}),this.parent.goTo(G(K(a,r,!0),s.index)))):this.parent.renderModule.refreshUI({skipUpdateOnFirst:!0,rowIndex:0,colIndex:this.parent.viewport.leftIndex,refresh:"Column"}),this.parent.selectRange(a.selectedRange)):!this.parent.scrollSettings.isFinite||this.parent.viewport.leftIndex+t!==K(a,0,!0,"columns")&&this.parent.viewport.rightIndex!==K(a,a.colCount-s.model.length-1,!1,"columns")||this.parent.renderModule.refreshSheet(!1,!1,!0))}this.refreshImgElement(s.model.length,this.parent.activeSheetIndex,s.modelType,s.index),s.isAction?(delete s.isAction,this.parent.notify(oe,e),ae(this.parent.element)):s.isUndoRedo||(s.isMethod=!0,this.parent.notify(ct,e))},Ep.prototype.refreshImgElement=function(e,t,r,n){for(var i,o=this.parent.sheets[t],s=[0,0,o.usedRange.rowIndex,o.usedRange.colIndex],a=0;a<=s[2];a++)for(var l=s[1];l<=s[3];l++)(i=ie(a,l,o))&&i.image&&0<i.image.length&&("Row"===r&&n<=a||"Column"===r&&n<=l)&&this.parent.notify(Rl,{rowIdx:a,colIdx:l,sheetIdx:t,type:r,count:e,status:"insert"})},Ep.prototype.addEventListener=function(){this.parent.on(or,this.insert,this)},Ep.prototype.destroy=function(){this.removeEventListener(),this.parent=null},Ep.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off(or,this.insert)},Ep.prototype.getModuleName=function(){return"insert"};var Ip=Ep;function Ep(e){this.parent=e,this.addEventListener()}Np.prototype.delete=function(e){var t,r,n,i,o,s,a,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),this.parent.notify(ls,null),t&&this.parent.renderModule.refreshSheet(!1,!1,!0)):l.activeSheetIndex===this.parent.activeSheetIndex&&(t=this.parent.getActiveSheet(),r=this.parent.frozenRowCount(t),n=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(K(t,l.startIndex-1<r?r:l.startIndex-1,!0)-r,null,"col"),this.parent.renderModule.refreshSheet(!1,!1,!0)):l.freezePane||this.parent.scrollSettings.isFinite&&this.parent.viewport.bottomIndex>=K(t,t.rowCount-1,!1)?this.parent.renderModule.refreshSheet(!1,!1,!0):(o=[],s=this.parent.frozenColCount(t),i=void 0,a=this.parent.viewport.leftIndex,i=s?(o.push(r),o.push(a+s),W(t.topLeftCell)[1]):a,this.parent.renderModule.refreshUI({rowIndex:this.parent.viewport.topIndex,refresh:"Row",colIndex:i,skipUpdateOnFirst:this.parent.viewport.topIndex+r===K(t,r,!0),frozenIndexes:o}),s&&(this.parent.viewport.leftIndex=a),this.parent.selectRange(t.selectedRange)):r||n?this.parent.renderModule.refreshSheet(!1,!1,!0):(this.parent.renderModule.refreshUI({skipUpdateOnFirst:!0,refresh:"Row",rowIndex:this.parent.viewport.topIndex,colIndex:0}),this.parent.selectRange(t.selectedRange))):(!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,K(t,l.startIndex-1<n?n:l.startIndex-1,!0,"columns")-n,"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=[],s=this.parent.viewport.topIndex,a=i?W(t.topLeftCell)[0]:s,i&&(o=[i+s,n]),this.parent.renderModule.refreshUI({rowIndex:a,refresh:"Column",colIndex:this.parent.viewport.leftIndex,insertDelete:!0,skipUpdateOnFirst:this.parent.viewport.leftIndex+n===K(t,n,!0,"columns"),frozenIndexes:o}),i&&(this.parent.viewport.topIndex=s),this.parent.selectRange(t.selectedRange)):r||n?this.parent.renderModule.refreshSheet(!1,!1,!0):(this.parent.renderModule.refreshUI({skipUpdateOnFirst:!0,refresh:"Column",rowIndex:0,colIndex:this.parent.viewport.leftIndex,insertDelete:!0}),this.parent.selectRange(t.selectedRange))),delete l.refreshSheet)),this.refreshImgElement(l.deletedModel.length,this.parent.activeSheetIndex,l.modelType,l.startIndex),l.isAction?(delete l.isAction,this.parent.notify(oe,e),ae(this.parent.element)):l.isUndoRedo||(l.isMethod=!0,this.parent.notify(ct,e))},Np.prototype.addEventListener=function(){this.parent.on(sr,this.delete,this)},Np.prototype.destroy=function(){this.removeEventListener(),this.parent=null},Np.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off(sr,this.delete)},Np.prototype.getModuleName=function(){return"delete"},Np.prototype.refreshImgElement=function(e,t,r,n){for(var i,o=this.parent.sheets[t],s=[0,0,o.usedRange.rowIndex,o.usedRange.colIndex],a=0;a<=s[2];a++)for(var l=s[1];l<=s[3];l++)(i=ie(a,l,o))&&i.image&&0<i.image.length&&("Row"===r&&n<=a||"Column"===r&&n<=l)&&this.parent.notify(Rl,{rowIdx:a,colIdx:l,sheetIdx:t,type:r,count:e,status:"delete"})};var Rp=Np;function Np(e){this.parent=e,this.addEventListener()}kp.prototype.destroy=function(){this.removeEventListener();var e=J.select("#"+this.parent.element.id+"_datavalidation-popup");e&&e.remove(),this.data=[],this.typeData=[],this.operatorData=[],this.parent=null},kp.prototype.addEventListener=function(){J.Browser.isDevice&&"safari"===J.Browser.info.name&&(J.Browser.isIos||J.Browser.isIos7)?J.EventHandler.add(this.parent.element,"touchend",this.listOpen,this):J.EventHandler.add(this.parent.element,"dblclick",this.listOpen,this),this.parent.on(Ua,this.initiateDataValidationHandler,this),this.parent.on(_a,this.invalidDataHandler,this),this.parent.on(hr,this.checkDataValidation,this),this.parent.on(Lt,this.listHandler,this),this.parent.on(vs,this.keyUpHandler,this),this.parent.on(nl,this.removeValidationHandler,this),this.parent.on($r,this.InvalidElementHandler,this)},kp.prototype.removeEventListener=function(){J.Browser.isDevice&&"safari"===J.Browser.info.name&&(J.Browser.isIos||J.Browser.isIos7)?J.EventHandler.remove(this.parent.element,"touchend",this.listOpen):J.EventHandler.remove(this.parent.element,"dblclick",this.listOpen),this.parent.isDestroyed||(this.parent.off(Ua,this.initiateDataValidationHandler),this.parent.off(_a,this.invalidDataHandler),this.parent.off(hr,this.checkDataValidation),this.parent.off(Lt,this.listHandler),this.parent.off(vs,this.keyUpHandler),this.parent.off(nl,this.removeValidationHandler),this.parent.off($r,this.InvalidElementHandler))},kp.prototype.removeValidationHandler=function(e){var t,r,n,i={cancel:!1,isColSelected:e.isCol};e.range;if(e.range&&e.range.includes("!")){if(a=e.range,!(s=ne(this.parent,B(this.parent,a.split("!")[0]))))return}else{var o,s,a=(s=this.parent.getActiveSheet()).name+"!";e.range?a+=e.range:(a+=(o=this.getRange(s.selectedRange)).range,i.isColSelected=o.isColSelected)}o=s.selectedRange,i.range=a,e.isAction&&this.parent.notify(gt,{eventArgs:i,action:"removeValidation"}),i.cancel||(n=r=t=void 0,s.name===this.parent.getActiveSheet().name&&(n=W(s.activeCell),o=te(Q(o)),n[0]>=o[0])&&n[1]>=o[1]&&n[0]<=o[2]&&n[1]<=o[3]&&(t=(r=i.isColSelected?se(s,n[1])||{}:ie(n[0],n[1],s,!1,!0)).validation&&"List"===r.validation.type),this.parent.notify(dr,{range:a,isRemoveValidation:!0,viewport:this.parent.viewport}),t&&!r.validation&&(o=this.parent.getCell(n[0],n[1]))&&o.getElementsByClassName("e-validation-list")[0]&&(this.listObj.destroy(),o.removeChild(o.getElementsByClassName("e-validation-list")[0]),this.removeNoteIndicator(o,n[0],n[1])),e.isAction&&(delete i.cancel,this.parent.notify(oe,{eventArgs:i,action:"removeValidation"})))},kp.prototype.removeNoteIndicator=function(e,t,r){!J.isNullOrUndefined(e.children)&&0<e.children.length&&-1<e.children[e.childElementCount-1].className.indexOf("e-addNoteIndicator")&&(e.removeChild(e.children[e.children.length-1]),this.parent.notify(ga,{targetElement:e,rowIndex:t,columnIndex:r}))},kp.prototype.keyUpHandler=function(e){var t=e.target,r=this.parent.element.querySelector(".e-datavalidation-dlg");J.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)},kp.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()},kp.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(oe,t)},kp.prototype.listHandler=function(){var t=this;if(this.parent.allowDataValidation){var r,e=this.parent.getActiveSheet(),n=W(e.activeCell),i=ie(n[0],n[1],e),o=this.parent.getCell(n[0],n[1]),s=!1;if(o){document.getElementsByClassName("e-validation-list")[0]&&(this.listObj&&this.listObj.destroy(),J.remove(document.getElementsByClassName("e-validation-list")[0]),J.isNullOrUndefined(this.parent.selectionModule.previousActiveCell)||(a=W(this.parent.selectionModule.previousActiveCell),l=this.parent.getCell(a[0],a[1]),!J.isNullOrUndefined(l.children)&&0<l.children.length&&-1<l.children[l.childElementCount-1].className.indexOf("e-addNoteIndicator")&&(l.removeChild(l.children[l.children.length-1]),this.parent.notify(ga,{targetElement:l,rowIndex:a[0],columnIndex:a[1]}))),this.data=[]);var a,l=i&&i.validation||e.columns&&e.columns[n[1]]&&e.columns[n[1]].validation;if(l&&"List"===l.type){if(l.address&&!Mn(l.address,n[0],n[1]))return;l.ignoreBlank=!!J.isNullOrUndefined(l.ignoreBlank)||l.ignoreBlank,l.inCellDropDown=!!J.isNullOrUndefined(l.inCellDropDown)||l.inCellDropDown,l.inCellDropDown&&(a=this.parent.createElement("div",{className:"e-validation-list"}),e=this.parent.createElement("input",{id:this.parent.element.id+"listValid"}),a.appendChild(e),l.inCellDropDown||(a.style.display="none"),!J.isNullOrUndefined(o.children)&&0<o.children.length&&-1<o.children[o.childElementCount-1].className.indexOf("e-addNoteIndicator")&&(o.removeChild(o.children[o.children.length-1]),s=!0),(e=o.getElementsByClassName("e-wrap-content")[0]||o).insertBefore(a,e.firstChild),a=this.updateDataSource(i,l),this.listObj=new I.DropDownList({index:this.setDropDownListIndex(a,i),dataSource:a,fields:{text:"text",value:"id"},width:"0px",popupHeight:"200px",change:function(){return t.listValueChange(t.listObj.text)},beforeOpen:function(){(r=window.browserDetails.isDevice)&&(window.browserDetails.isDevice=!1)},open:function(e){e.popup.offsetX=4-(o.offsetWidth-20),e.popup.offsetY=-(o.querySelector(".e-control-wrapper.e-ddl").offsetHeight-18),e.popup.element.style.width=o.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()),ae(t.parent.element)}}),this.listObj.appendTo("#"+this.parent.element.id+"listValid"),s)&&this.parent.notify(ga,{targetElement:o,rowIndex:n[0],columnIndex:n[1]})}i&&i.validation&&(i.validation=l)}}},kp.prototype.setDropDownListIndex=function(e,t){if(t&&t.value)for(var r=0,n=e.length;r<n;r++)if(e[r].text===t.value.toString())return r;return null},kp.prototype.updateDataSource=function(t,r){var n=this,e=(this.data=[],0),i=this.parent.definedNames,o=r.value1,s=-1!==o.indexOf("=");if(0<i.length&&s)for(var a=o.split("=")[1],l=0,h=i.length;l<h;l++)if(i[l].name===a){for(var d=i[l].refersTo;d.includes("'");)d=d.replace("'","");o=d}if(s)for(var p,c,u=-1<o.indexOf("!")?ne(this.parent,B(this.parent,o.split("=")[1].split("!")[0])):this.parent.getActiveSheet(),s=(-1<o.indexOf("!")?o.split("!"):o.split("="))[1],f=this.parent.getActiveSheet(),g=(u.name!==f.name&&(c=Q(f.selectedRange),u.ranges.forEach(function(e){e.info&&e.info.loadedRange&&e.info.loadedRange.length||(p=!0)}),p)&&(this.parent.showSpinner(),ai(this.parent,u.name+"!"+s).then(function(){var e;n.parent.hideSpinner(),f.name===n.parent.getActiveSheet().name&&(e=Q(n.parent.getActiveSheet().selectedRange))[0]===c[0]&&e[1]===c[1]&&(n.listObj.dataSource=n.updateDataSource(t,r),n.listObj.dataBind())})),void 0),m=s.split(":"),v=(g=m[0].match(/[a-z]+$/gi)&&m[1].match(/[a-z]+$/gi)||m[0].match(/^[0-9]/g)&&m[1].match(/^[0-9]/g)?(m=this.parent.getIndexes(s)).isCol?[0,m.startIdx,u.usedRange.rowIndex,m.startIdx]:[m.startIdx,0,m.startIdx,u.usedRange.colIndex]:Q(s))[0];v<=g[2];v++){u.rows[v]||uh(u,v,{});for(var y=g[1];y<=g[3];y++){u.rows[v].cells||Mi(v,y,u,{}),e+=1,t=u.rows[v].cells[y];var C=this.parent.getDisplayText(t)||"";this.data.push({text:C,id:"list-"+e})}}else for(var b=o.split(","),l=0;l<b.length;l++)this.data.push({text:b[l],id:"list-"+(e+=1)});return this.data},kp.prototype.listValueChange=function(e){this.parent.notify(gs,{action:"refreshFormulabar",value:e});var t,r=this.parent.getActiveSheet(),n=y(r.activeCell),i=Object.assign({},ie(n[0],n[1],r));r.isProtected&&Vn(i,se(r,n[1]))?this.parent.notify(Ka,null):ni(i,se(r,n[1]),ch(r,n[0]))?this.parent.notify($a,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||(Gn(this.parent,r,{cell:{value:e},rowIdx:n[0],colIdx:n[1],valChange:!0,lastCell:!0,uiRefresh:!0,checkCF:!0}),this.parent.notify(oe,{action:"cellSave",eventArgs:{value:e,oldValue:i.value,address:r.name+"!"+r.activeCell}})))},kp.prototype.getRange=function(e){var t,r=Q(e),n=this.parent.getActiveSheet(),i=n.rowCount,n=n.colCount;return r[2]===i-1&&0===r[0]?(e=e.replace(/[0-9]/g,""),t=!0):r[3]===n-1&&0===r[2]&&(e=e.replace(/\D/g,"")),{range:e,isColSelected:t}},kp.prototype.initiateDataValidationHandler=function(e,r){var n,i,o,s,t,a=this,l=this.parent.serviceLocator.getService(A),h=!0,d=!0,p=!0,c=this.parent.getActiveSheet(),u=te(Q(f=c.selectedRange)),f=this.getRange(f).range,g=this.validateRange(u,c);if(!g.extendValidation&&!g.moreValidation||e){for(var m,v=u[0];v<=u[2];v++)if(c.rows[v])for(var y=u[1];y<=u[3];y++)c.rows[v].cells&&c.rows[v].cells[y]&&(t=c.rows[v].cells[y]).validation&&(p=!1,n=t.validation.type,i=t.validation.operator,o=t.validation.value1,s=t.validation.value2,h=J.isNullOrUndefined(t.validation.ignoreBlank)?h:t.validation.ignoreBlank,d=J.isNullOrUndefined(t.validation.inCellDropDown)?d:t.validation.inCellDropDown);if(p)for(var C=u[1];C<=u[3];C++){var b=se(c,C);b&&b.validation&&(p=!1,n=b.validation.type,i=b.validation.operator,o=b.validation.value1,s=b.validation.value2,h=J.isNullOrUndefined(b.validation.ignoreBlank)?h:b.validation.ignoreBlank,d=J.isNullOrUndefined(b.validation.inCellDropDown)?d:b.validation.inCellDropDown)}this.parent.element.querySelector(".e-datavalidation-dlg")||((m=this.parent.serviceLocator.getService(k)).show({width:375,showCloseIcon:!0,isModal:!0,cssClass:"e-datavalidation-dlg",header:l.getConstant("DataValidation"),beforeOpen:function(e){var t={dialogName:"ValidationDialog",element:e.element,target:e.target,cancel:e.cancel};a.parent.trigger("dialogBeforeOpen",t),t.cancel&&(e.cancel=!0),r&&(p=!0),m.dialogInstance.content=a.dataValidationContent(p,n,i,o,s,h,d,f),m.dialogInstance.dataBind(),ae(a.parent.element)},buttons:[{buttonModel:{content:l.getConstant("ClearAll"),cssClass:"e-btn e-clearall-btn e-flat"},click:function(){m.dialogInstance.content=a.dataValidationContent(!0,n,i,o,s,h,d,f),m.dialogInstance.dataBind()}},{buttonModel:{content:l.getConstant("Apply"),isPrimary:!0},click:function(){a.dlgClickHandler(m)}}]}),m.dialogInstance.refresh())}else g.moreValidation&&this.moreValidationDlg(),g.extendValidation&&this.extendValidationDlg()},kp.prototype.dataValidationContent=function(e,t,r,n,i,o,s,a){var l,h=this,d=this.parent.serviceLocator.getService(A),p=(e?l=b="0":b="Date"===t?(l=(p=function(e){var t;return Y(e)?(h.parent.notify(Dt,t={cell:{value:e},type:"date",value:e}),t.value):e})(l),p(b)):(l=n,i),this.parent.createElement("div",{className:"e-validation-dlg"})),n=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=(p.appendChild(n),p.appendChild(i),p.appendChild(c),p.appendChild(u),this.parent.createElement("span",{className:"e-header"})),a=(f.innerText=d.getConstant("CellRange"),this.parent.createElement("input",{className:"e-input",attrs:{value:a,"aria-label":d.getConstant("CellRange")}})),f=(n.appendChild(f),n.appendChild(a),this.parent.createElement("div",{className:"e-allow"})),n=this.parent.createElement("div",{className:"e-data"}),a=(i.appendChild(f),i.appendChild(n),this.parent.createElement("span",{className:"e-header"})),i=(a.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"}],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"})),g=(t=t&&this.formattedType(t),0);if(!e)for(var m=0;m<this.typeData.length;m++)if(t===this.formattedType(this.typeData[m].text)){g=m;break}if(e||"List"!==t){var v=0,y=this.parent.createElement("span",{className:"e-header"}),C=(y.innerText=d.getConstant("Data"),this.parent.createElement("input",{className:"e-select"}));if(!e)for(m=0;m<this.operatorData.length;m++)if(r===this.formattedValue(this.operatorData[m].text)){v=m;break}n.appendChild(y),n.appendChild(C),this.dataList=new I.DropDownList({dataSource:this.operatorData,index:v,popupHeight:"200px",change:function(){h.userInput(x,h.dataList)}}),this.dataList.appendTo(C)}else{y=this.parent.createElement("input",{className:"e-checkbox"});n.appendChild(y),new w.CheckBox({label:d.getConstant("InCellDropDown"),checked:s}).appendTo(y)}f.appendChild(a),f.appendChild(i);var b,x=new I.DropDownList({dataSource:this.typeData,index:g,popupHeight:"200px",change:function(){h.userInput(x,h.dataList)}}),s=(x.appendTo(i),e||x.value!==d.getConstant("List")&&(this.dataList.value===d.getConstant("Between")||this.dataList.value===d.getConstant("NotBetween"))?(C=this.parent.createElement("div",{className:"e-minimum"}),n=this.parent.createElement("div",{className:"e-maximum"}),c.appendChild(C),c.appendChild(n),(s=this.parent.createElement("span",{className:"e-header"})).innerText=d.getConstant("Minimum"),(y=this.parent.createElement("span",{className:"e-header"})).innerText=d.getConstant("Maximum"),a=this.parent.createElement("input",{id:"minvalue",className:"e-input",attrs:{value:l,"aria-label":d.getConstant("Minimum")}}),f=this.parent.createElement("input",{id:"maxvalue",className:"e-input",attrs:{value:b,"aria-label":d.getConstant("Maximum")}}),C.appendChild(s),C.appendChild(a),n.appendChild(y),n.appendChild(f),new S.NumericTextBox({value:0}).appendTo("#minvalue"),new S.NumericTextBox({value:0}).appendTo("#maxvalue")):(b=((i=this.parent.createElement("span",{className:"e-header"})).innerText=e||"List"!==t?d.getConstant("Value"):d.getConstant("Sources"),this.parent.createElement("input",{className:"e-input",attrs:{value:l}})),c.appendChild(i),c.appendChild(b)),o),C=this.parent.createElement("input",{className:"e-checkbox"});return u.appendChild(C),new w.CheckBox({label:d.getConstant("IgnoreBlank"),checked:s}).appendTo(C),p},kp.prototype.validateRange=function(e,t){for(var r=!1,n=!1,i=[],o=[],s=[],a=[],l=e[0];l<=e[2];l++)if(t.rows[l])for(var h=e[1];h<=e[3];h++)t.rows[l].cells&&t.rows[l].cells[h]&&(m=t.rows[l].cells[h]).validation&&(i.push(m.validation.type),o.push(m.validation.operator),s.push(m.validation.value1),a.push(m.validation.value2));for(var d=e[1];d<=e[3];d++)(v=se(t,d))&&v.validation&&(i.push(v.validation.type),o.push(v.validation.operator),s.push(v.validation.value1),a.push(v.validation.value2));for(var p=[],d=0;d<i.length;d++)-1===p.indexOf(i[d])&&p.push(i[d]);if(!(r=1<p.length?!0:r)){for(var p=[],c=0;c<o.length;c++)-1===p.indexOf(o[c])&&p.push(o[c]);1<p.length&&(r=!0)}if(!r){p=[];for(c=0;c<s.length;c++)-1===p.indexOf(s[c])&&p.push(s[c]);1<p.length&&(r=!0)}if(!r){p=[];for(c=0;c<a.length;c++)-1===p.indexOf(a[c])&&p.push(a[c]);1<p.length&&(r=!0)}if(!r){for(var u=0,f=0,g=e[0];g<=e[2];g++)if(t.rows[g])for(var m,h=e[1];h<=e[3];h++)t.rows[g].cells&&t.rows[g].cells[h]&&(f++,(m=t.rows[g].cells[h]).validation)&&u++;if(0===u)for(var v,d=e[1];d<=e[3];d++)(v=se(t,d))&&v.validation&&u++;0<u&&1<f&&u!==f&&(n=!0)}return{moreValidation:r,extendValidation:n}},kp.prototype.moreValidationDlg=function(){var r=this,n=this.parent.serviceLocator.getService(A),i=this.parent.serviceLocator.getService(k),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(),ae(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)},kp.prototype.extendValidationDlg=function(){var r=this,n=this.parent.serviceLocator.getService(A),i=this.parent.serviceLocator.getService(k),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(),ae(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)},kp.prototype.userInput=function(e,t){for(var r,n=this.parent.element.querySelector(".e-datavalidation-dlg").querySelector(".e-validation-dlg"),i=n.querySelector(".e-allowdata"),o=n.querySelector(".e-values"),n=this.parent.serviceLocator.getService(A),s=i.querySelector(".e-data");o.lastChild;)o.removeChild(o.lastChild);if(e.value===n.getConstant("List")){for(;s.lastChild;)s.removeChild(s.lastChild);var i=this.parent.createElement("input",{className:"e-checkbox"});s.appendChild(i),new w.CheckBox({label:n.getConstant("InCellDropDown"),checked:!0}).appendTo(i)}else if(s.getElementsByClassName("e-checkbox-wrapper")[0]){for(;s.lastChild;)s.removeChild(s.lastChild);var i=this.parent.createElement("span",{className:"e-header"}),a=(i.innerText=n.getConstant("Data"),this.parent.createElement("input",{className:"e-select"}));s.appendChild(i),s.appendChild(a),t.appendTo(a)}e.value===n.getConstant("List")||t.value!==n.getConstant("Between")&&t.value!==n.getConstant("NotBetween")?((i=this.parent.createElement("span",{className:"e-header"})).innerText=e.value===n.getConstant("List")?n.getConstant("Sources"):n.getConstant("Value"),a=e.value===n.getConstant("List")?this.parent.createElement("input",{className:"e-input",attrs:{placeholder:"Enter value"}}):this.parent.createElement("input",{className:"e-input",attrs:{value:"0"}}),o.appendChild(i),o.appendChild(a)):(t=this.parent.createElement("div",{className:"e-minimum"}),e=this.parent.createElement("div",{className:"e-maximum"}),o.appendChild(t),o.appendChild(e),(i=this.parent.createElement("span",{className:"e-header"})).innerText=n.getConstant("Minimum"),(a=this.parent.createElement("span",{className:"e-header"})).innerText=n.getConstant("Maximum"),n=this.parent.createElement("input",{id:"min",className:"e-input",attrs:{value:"0"}}),r=this.parent.createElement("input",{id:"max",className:"e-input",attrs:{value:"0"}}),new S.NumericTextBox({value:0}).appendTo("min"),new S.NumericTextBox({value:0}).appendTo("max"),t.appendChild(i),t.appendChild(n),e.appendChild(a),e.appendChild(r))},kp.prototype.dlgClickHandler=function(e){var t,r,n,i,o,s=this.parent.serviceLocator.getService(A),a=this.parent.element.querySelector(".e-datavalidation-dlg"),l=a.querySelector(".e-footer-content"),a=a.getElementsByClassName("e-dlg-content")[0].getElementsByClassName("e-validation-dlg")[0],h=a.getElementsByClassName("e-allowdata")[0],d=h.getElementsByClassName("e-allow")[0].getElementsByTagName("input")[0],p=h.getElementsByClassName("e-data")[0].getElementsByTagName("input")[0],c=a.getElementsByClassName("e-values")[0],u=[],f=(u[0]=c.getElementsByTagName("input")[0].value,u[1]=c.getElementsByTagName("input")[1]?c.getElementsByTagName("input")[1].value:"",Jn(u,this.parent.locale),a.querySelector(".e-ignoreblank .e-checkbox").checked),h=h.querySelector(".e-data").querySelector(".e-checkbox-wrapper")?!!h.querySelector(".e-data").querySelector(".e-checkbox-wrapper").querySelector(".e-check"):null,a=a.querySelector(".e-cellrange").getElementsByTagName("input")[0].value,d=this.formattedType(d.value),p=(p&&(r=p.value,r=this.formattedValue(r)),[]),g=[],m=(""!==u[0]&&g.push(u[0]),""!==u[1]&&g.push(u[1]),!0);"List"===d&&(-1!==u[0].indexOf("=")?-1===u[0].indexOf(":")||(i=(-1<u[0].indexOf("!")?u[0].split("!"):u[0].split("="))[1],o=!(-1<u[0].indexOf("!"))||-1<B(this.parent,u[0].split("=")[1].split("!")[0]),p=i.split(":"),n=!!i.match(/[a-z]/gi)&&p[0].replace(/[0-9]/g,"")===p[1].replace(/[0-9]/g,""),i=!!i.match(/\d/g)&&p[0].replace(/\D/g,"")===p[1].replace(/\D/g,""),m=o&&(n||i))||(t=s.getConstant("DialogError")):256<u[0].length&&(m=!1,t=s.getConstant("ListLengthError"))),m&&(p=this.parent.getActiveSheet(),o=this.isDialogValidator(g,d,r),"Between"===r&&o.isValidate&&!isNaN(parseFloat(g[0]))&&!isNaN(parseFloat(g[1]))&&parseFloat(g[0])>parseFloat(g[1])&&(o.isValidate=!1,o.errorMsg=s.getConstant("MinMaxError")),t=o.errorMsg,m=o.isValidate)&&(u=(i=ie((n=W(p.activeCell))[0],n[1],p,!1,!0)).validation&&"List"===i.validation.type,s={range:p.name+"!"+a,value1:g[0],value2:g[1]||"",ignoreBlank:f,type:d,operator:r,inCellDropDown:h,cancel:!1},this.parent.notify(gt,{eventArgs:s,action:"validation"}),s.cancel||(this.parent.notify(dr,{rules:{type:s.type,operator:s.operator,value1:s.value1,value2:s.value2,ignoreBlank:s.ignoreBlank,inCellDropDown:s.inCellDropDown},range:s.range}),(i=ie(n[0],n[1],p,!1,!0)).validation&&(u&&(o=this.parent.getCell(n[0],n[1]))&&o.getElementsByClassName("e-validation-list")[0]&&(this.listObj.destroy(),o.removeChild(o.getElementsByClassName("e-validation-list")[0]),this.removeNoteIndicator(o,n[0],n[1])),"List"===i.validation.type)&&this.listHandler(),delete s.cancel,document.getElementsByClassName("e-validation-error-dlg")[0]||(e.dialogInstance||e).hide(),this.parent.notify(oe,{eventArgs:s,action:"validation"}))),m||((a=this.parent.createElement("div",{className:"e-dlg-error",id:"e-invalid"})).innerText=t,c.appendChild(a),l.querySelector(".e-primary").setAttribute("disabled","true"))},kp.prototype.formattedValue=function(e){var t=this.parent.serviceLocator.getService(A);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},kp.prototype.formattedType=function(e){var t=this.parent.serviceLocator.getService(A);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"}return e},kp.prototype.isDialogValidator=function(e,t,r){var n,i=this.parent.serviceLocator.getService(A),o=0;if("List"!==t&&("Between"===r||"NotBetween"===r)?2!==e.length:!(0<e.length))n={isValidate:!1,errorMsg:i.getConstant("EmptyError")};else{for(var s=void 0,a=0;a<e.length&&(X(e[a])?s=this.parent.computeExpression(e[a]).toString():"Date"===t||"Time"===t?(s=this.getDateAsNumber({range:[],cell:{value:e[a]}},e[a]),"Date"===t&&(e[a]=s)):s=e[a],(n=this.formatValidation(s,t,!0)).isValidate);a++)o+=1;n.isValidate=o===e.length}return{isValidate:n.isValidate,errorMsg:n.errorMsg}},kp.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(Ft,e),e.updatedVal||t},kp.prototype.isValidationHandler=function(t){var e,r=this.parent.serviceLocator.getService(A),n=(t.value=t.value||"",t.value),i=this.parent.sheets[t.sheetIdx],o=ie(t.range[0],t.range[1],i),s=se(i,t.range[1]);if(o&&o.validation?e=o.validation:Rh(s,t.range[0],t.range[1])&&(e=s.validation),e){var a=e.value1,l=e.value2,h=(X(a)&&"List"!==e.type&&(a=this.parent.computeExpression(a).toString()),X(l)&&"List"!==e.type&&(l=this.parent.computeExpression(l).toString()),X(t.value)&&"List"!==e.type&&(t.value=this.parent.computeExpression(t.value).toString()),t.value),d=e.operator||"Between",p=e.type||"WholeNumber",c=!!J.isNullOrUndefined(e.ignoreBlank)||e.ignoreBlank;if(c&&""===n)C=!0;else{var u="Date"===p||"Time"===p;if(t.value&&!Y(t.value))if(u||"TextLength"===e.type)h=t.value=this.getDateAsNumber(t,t.value);else{var f=o&&o.format,g=void 0;if(f){if("@"!==f)try{for(var m=Vi(f);m;)m=Vi(f=f.split("["+m+"]").join(""));var v=new J.Internationalization(this.parent.locale),y=J.getNumberDependable(A,J.defaultCurrencyCode);(f="$"!==y&&f.includes("$")&&t.value.includes(y)?f.split("$").join(y):f).includes("%")&&0<t.value.indexOf("%")?(g=v.getNumberParser({format:"n"})(t.value),b=f.indexOf("%"),'"'!==f[b-1]&&(g/=100)):g=v.getNumberParser({format:f})(t.value)}catch(e){g=t.value}}else{y={formattedText:t.value,value:t.value,format:"General",cell:{value:t.value,format:"General"}};this.parent.notify(St,y),g=y.value}g!==t.value&&Y(g)&&(h=t.value=g.toString())}var v=this.formatValidation(t.value,p),C=v.isValidate,y=v.errorMsg;if(C)if(C=!1,u?(a&&!Y(a)&&(a=this.getDateAsNumber(t,a)),l&&!Y(l)&&(l=this.getDateAsNumber(t,l))):"TextLength"===e.type&&(h=t.value.toString().length.toString()),"List"===p){if(-1!==a.indexOf("=")){this.data=J.isNullOrUndefined(this.data)||this.data.length?this.data:this.updateDataSource(o,e);for(var b=0;b<this.data.length;b++)t.value.toString()===this.data[b].text&&(C=!0)}else for(var x=a.split(","),b=0;b<x.length;b++)t.value.toString()===x[b]&&(C=!0);!C&&c&&""===t.value.toString()&&(C=!0)}else switch(l="Decimal"===p||"Time"===p?(h=parseFloat(h.toString()),a=parseFloat(a.toString()),l?parseFloat(l.toString()):null):(h=parseInt(h.toString(),10),a=parseInt(a.toString(),10),l?parseInt(l.toString(),10):null),d){case"EqualTo":C=h===a||!(!c||""!==n);break;case"NotEqualTo":C=h!==a||!(!c||""!==n);break;case"Between":C=a<=h&&h<=l||!(!c||""!==n);break;case"NotBetween":C=!(a<=h&&h<=l);break;case"GreaterThan":C=a<h||!(!c||""!==n);break;case"LessThan":C=h<a||!(!c||""!==n);break;case"GreaterThanOrEqualTo":C=a<=h||!(!c||""!==n);break;case"LessThanOrEqualTo":C=h<=a||!(!c||""!==n)}}}return y=r.getConstant("ValidationError"),C&&(o&&o.validation&&o.validation.isHighlighted||s&&s.validation&&s.validation.isHighlighted)&&(g=this.parent.getCellStyleValue(["backgroundColor","color"],[t.range[0],t.range[1]]),$(i,t.range[0])||this.parent.notify(Nt,{style:g,rowIdx:t.range[0],colIdx:t.range[1],isHeightCheckNeeded:!0,manualUpdate:!0,onActionUpdate:!0,td:t.td})),{isValidate:C,errorMsg:y}},kp.prototype.checkDataValidation=function(e){var t,r=ie(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&&(X(r.validation.value1)&&!On(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(Wt,n)),!n.skip)&&X(r.validation.value2)&&!On(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(Wt,n)),n.skip||(!(r=this.isValidationHandler(e)).isValidate&&e.isCell&&this.validationErrorHandler(r.errorMsg),e.isValid=r.isValidate)},kp.prototype.formatValidation=function(e,t,r){var n,i,o=this.parent.element.getElementsByClassName("e-sheet-panel")[0],s=this.parent.createElement("form",{id:"formId",className:"form-horizontal"}),a=this.parent.createElement("input",{id:"e-validation"});switch(a.setAttribute("name","validation"),a.setAttribute("type","text"),"Date"===t&&Y(e)&&2===(l=e.toString().split(".")).length&&(e=l[0]),a.setAttribute("value",e),s.appendChild(a),o.appendChild(s),t){case"Date":i={rules:{validation:{date:!0}},customPlacement:function(e,t){n=t.innerText}};break;case"Decimal":i={rules:{validation:{number:!0}},customPlacement:function(e,t){n=t.innerText}};break;case"WholeNumber":i={rules:{validation:{regex:/^-?\d*\.?[0]*$/}},customPlacement:function(e,t){n=t.innerText}};break;case"TextLength":r&&(i={rules:{validation:{regex:/^\d*\.?[0]*$/}},customPlacement:function(e,t){n=t.innerText}})}var l=new S.FormValidator("#formId",i).validate();return o.removeChild(o.getElementsByClassName("form-horizontal")[0]),{isValidate:l,errorMsg:n}},kp.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(Nt,{style:n,rowIdx:t,colIdx:r,td:e.td})):this.parent.notify(Nt,{style:{backgroundColor:"#ffff00",color:"#ff0000"},rowIdx:t,colIdx:r,td:e.td})},kp.prototype.validationErrorHandler=function(r){var n,i=this,o=document.getElementsByClassName("e-spreadsheet-edit")[0],e=this.parent.serviceLocator.getService(A);this.parent.element.querySelector(".e-validation-error-dlg")||(n=this.parent.serviceLocator.getService(k),e={width:400,height:200,isModal:!0,showCloseIcon:!0,cssClass:"e-validation-error-dlg",target:document.querySelector(".e-control.e-spreadsheet"),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))},kp.prototype.errorDlgHandler=function(e,t){"Retry"===t?(t=document.getElementsByClassName("e-spreadsheet-edit")[0],e.hide(),t.innerText&&(window.getSelection().selectAllChildren(t),this.listObj)&&!this.listObj.isDestroyed&&this.listObj.showPopup()):(t=(t=ie((t=W(this.parent.getActiveSheet().activeCell))[0],t[1],this.parent.getActiveSheet()))?this.parent.getDisplayText(t):"",this.parent.notify(us,{action:"cancelEdit",value:t,refreshFormulaBar:!0,refreshEditorElem:!0,isAppend:!1,trigEvent:!0}),e.hide())},kp.prototype.getModuleName=function(){return"dataValidation"};var Ap=kp;function kp(e){this.data=[],this.parent=e,this.addEventListener()}Op.prototype.init=function(){this.addEventListener()},Op.prototype.destroy=function(){this.removeEventListener(),this.parent=null},Op.prototype.addEventListener=function(){this.parent.on(ja,this.protect,this),this.parent.on(za,this.protectSheetHandler,this),this.parent.on(Ka,this.editProtectedAlert,this),this.parent.on(Bl,this.protectWorkbook,this),this.parent.on(vs,this.KeyUpHandler,this),this.parent.on(Hl,this.unProtectWorkbook,this),this.parent.on(Jl,this.unProtectSheetPassword,this),this.parent.on(Vl,this.getPassWord,this),this.parent.on(zl,this.importProtectWorkbook,this),this.parent.on(Ul,this.protectWorkbookHandler,this),this.parent.on(_l,this.removeWorkbookProtection,this),this.parent.on(oh,this.toggleProtect,this)},Op.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(ja,this.protect),this.parent.off(za,this.protectSheetHandler),this.parent.off(Ka,this.editProtectedAlert),this.parent.off(Bl,this.protectWorkbook),this.parent.off(vs,this.KeyUpHandler),this.parent.off(Hl,this.unProtectWorkbook),this.parent.off(Jl,this.unProtectSheetPassword),this.parent.off(Vl,this.getPassWord),this.parent.off(zl,this.importProtectWorkbook),this.parent.off(Ul,this.protectWorkbookHandler),this.parent.off(_l,this.removeWorkbookProtection),this.parent.off(oh,this.toggleProtect))},Op.prototype.protect=function(e){var t;e.isActive&&(t=this.parent.getActiveSheet()).isImportProtected&&(t.isImportProtected=!1),this.parent.notify(Hs,null),e.isActive?(this.parent.setSheetPropertyOnMute(ne(this.parent,e.sheetIndex),"isProtected",!1),this.parent.notify(aa,{props:"Protect"}),this.parent.notify(za,e),this.parent.notify(Qa,null)):this.createDialogue()},Op.prototype.createDialogue=function(){var r=this,e=this.parent.serviceLocator.getService(A),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"})),s=(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"}),a=(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+a.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),ae(r.parent.element)},beforeClose:function(){J.EventHandler.remove(s.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,s.appendTo("#"+this.parent.element.id+"_protect_check"),this.optionList.appendTo("#"+this.parent.element.id+"_option_list"),this.optionList.selectMultipleItems([{id:"1"},{id:"6"}]),J.EventHandler.add(s.element,"click",this.checkBoxClickHandler,this)},Op.prototype.checkBoxClickHandler=function(){!1===document.getElementById(this.parent.element.id+"_protect_check").checked?this.dialog.dialogInstance.element.getElementsByClassName("e-footer-content")[0].querySelector("button").disabled=!0:this.dialog.dialogInstance.element.getElementsByClassName("e-footer-content")[0].querySelector("button").disabled=!1},Op.prototype.dialogOpen=function(e){var t=this.parent.serviceLocator.getService(A);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"})},Op.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&&kd(this.parent,Q(e.selectedRange)))&&this.parent.notify(Zl,null)):this.reEnterSheetPassword()},Op.prototype.selectSheetPassword=function(){var e,t=this.parent.serviceLocator.getService(A),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"),J.getComponent(e,"dialog").destroy(),r.protectSettings.selectCells||r.protectSettings.selectUnLockedCells||this.parent.notify(Zl,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))},Op.prototype.updateProtectSheet=function(e){var t=this.parent.serviceLocator.getService(A),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(wr,{protectSettings:r,password:e,triggerEvent:!0}),this.parent.notify(Qa,null),this.parent.notify(Ra,null)},Op.prototype.protectSheetHandler=function(e){var t=J.isNullOrUndefined(e&&e.sheetIndex)?this.parent.activeSheetIndex:e.sheetIndex,r=ne(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"],s=[n+"_insert_function"],a=[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&&!kd(this.parent,Q(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(qa,{disableHomeBtnId:i,enableHomeBtnId:o,enableFrmlaBtnId:s,enableInsertBtnId:a,findBtnId:h,dataValidationBtnId:d,imageBtnId:l,chartBtnId:n}),this.parent.notify(Ja,null),r.isProtected&&this.parent.notify(aa,{props:"Protect"}),e&&e.triggerEvent&&this.parent.notify(oe,{action:"protectSheet",eventArgs:{sheetIndex:t,isProtected:r.isProtected,password:r.password,protectSettings:r.protectSettings.properties||r.protectSettings}})},Op.prototype.editProtectedAlert=function(){var r=this,n=this.parent.serviceLocator.getService(A);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,Ph(function(){r.dialog.destroyDialog()})),r.dialog.dialogInstance.content=t.content,ae(r.parent.element)},close:function(){return ae(r.parent.element)}})},Op.prototype.protectWorkbook=function(){var r=this,e=this.parent.serviceLocator.getService(A),n=this.parent.serviceLocator.getService(k);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)}}]})},Op.prototype.passwordProtectContent=function(){var e=this.parent.serviceLocator.getService(A),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"})),s=(o.innerText=e.getConstant("ConfirmPassword"),this.parent.createElement("input",{className:"e-input e-text",attrs:{type:"password"}})),a=this.parent.createElement("input",{className:"e-input e-text",attrs:{type:"password"}});return s.setAttribute("placeholder",e.getConstant("EnterThePassword")),a.setAttribute("placeholder",e.getConstant("EnterTheConfirmPassword")),r.appendChild(s),r.insertBefore(i,s),n.appendChild(a),n.insertBefore(o,a),t.appendChild(n),t.insertBefore(r,n),t},Op.prototype.KeyUpHandler=function(e){var t,r,e=e.target;e.classList.contains("e-text")&&J.closest(e,".e-password-content")&&J.closest(e,".e-password-dialog")&&J.closest(e,".e-password-dialog").getElementsByClassName("e-password-content")[1]===e.parentElement&&(t=J.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")&&J.closest(e,".e-unprotectpwd-content")&&J.closest(e,".e-unprotectpwd-dialog")&&J.closest(e,".e-unprotectpwd-dialog").getElementsByClassName("e-unprotectpwd-content")[0]===e.parentElement&&(t=J.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")&&J.closest(e,".e-reenterpwd-content")&&J.closest(e,".e-reenterpwd-dialog")&&J.closest(e,".e-reenterpwd-dialog").getElementsByClassName("e-reenterpwd-content")[0]===e.parentElement&&(t=J.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")&&J.closest(e,".e-unprotectsheetpwd-content")&&J.closest(e,".e-unprotectsheetpwd-dialog")&&J.closest(e,".e-unprotectsheetpwd-dialog").getElementsByClassName("e-unprotectsheetpwd-content")[0]===e.parentElement&&(r=J.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")&&J.closest(e,".e-importprotectpwd-content")&&J.closest(e,".e-importprotectpwd-dialog")&&J.closest(e,".e-importprotectpwd-dialog").getElementsByClassName("e-importprotectpwd-content")[0]===e.parentElement&&(r=J.closest(e,".e-importprotectworkbook-dlg").getElementsByClassName("e-footer-content")[0].firstChild,""!==e.value?r.removeAttribute("disabled"):r.setAttribute("disabled","true"))},Op.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()},Op.prototype.dlgClickHandler=function(e){var t=this.parent.serviceLocator.getService(A),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(aa,{props:"Protectworkbook"}),this.protectWorkbookHandler({password:r.value}),this.parent.notify(oe,{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)},Op.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(aa,{props:"Protectworkbook"})},Op.prototype.unProtectWorkbook=function(){var r=this,e=this.parent.serviceLocator.getService(A),n=this.parent.serviceLocator.getService(k);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)}}]})},Op.prototype.unProtectsheet=function(e){var r=this,t=this.parent.serviceLocator.getService(A),n=this.parent.serviceLocator.getService(k);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)}}]})},Op.prototype.reEnterSheetPassword=function(){var r=this,e=this.parent.serviceLocator.getService(A),n=this.parent.serviceLocator.getService(k);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(),ae(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()}}]})},Op.prototype.unProtectPasswordContent=function(){var e=this.parent.serviceLocator.getService(A),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},Op.prototype.reEnterSheetPasswordContent=function(){var e=this.parent.serviceLocator.getService(A),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},Op.prototype.unProtectSheetPasswordContent=function(){var e=this.parent.serviceLocator.getService(A),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},Op.prototype.unprotectdlgOkClick=function(e){var t=this.parent.serviceLocator.getService(A),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(oe,{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))},Op.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(aa,{props:"Protectworkbook"})},Op.prototype.unprotectSheetdlgOkClick=function(e,t){var r=this.parent.serviceLocator.getService(A),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))},Op.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(ja,{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)},Op.prototype.getPassWord=function(e){e.passWord=this.password},Op.prototype.importProtectWorkbook=function(r){var n=this,e=this.parent.serviceLocator.getService(A),i=this.parent.serviceLocator.getService(k);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)}}]})},Op.prototype.importProtectPasswordContent=function(e){var t=this.parent.serviceLocator.getService(A),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},Op.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)},Op.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(ja,{isActive:t,id:e+"_protect",sheetIndex:this.parent.activeSheetIndex,triggerEvent:!0}))},Op.prototype.getModuleName=function(){return"protectSheet"};var Fp=Op;function Op(e){this.password="",this.parent=e,this.init()}Dp.prototype.addEventListener=function(){this.parent.on(Ga,this.renderFindDlg,this),this.parent.on(Wa,this.renderGotoDlg,this),this.parent.on(ur,this.gotoHandler,this),this.parent.on(Ya,this.findHandler,this),this.parent.on(mr,this.showFindAlert,this),this.parent.on(Ir,this.replaceAllDialog,this),this.parent.on(vr,this.findKeyUp,this),this.parent.on(vt,this.findToolDlg,this),this.parent.on(na,this.refreshFindDlg,this)},Dp.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(Ga,this.renderFindDlg),this.parent.off(Wa,this.renderGotoDlg),this.parent.off(ur,this.gotoHandler),this.parent.off(Ya,this.findHandler),this.parent.off(mr,this.showFindAlert),this.parent.off(Ir,this.replaceAllDialog),this.parent.off(vr,this.findKeyUp),this.parent.off(vt,this.findToolDlg),this.parent.off(na,this.refreshFindDlg))},Dp.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?J.closest(r.event.target,"#"+c.parent.element.id+"_findbtn"):J.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(Ya,{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(br,t),i.textContent=t.findCount,"0 of 0"!==t.findCount),l.enableItems(1,e),l.enableItems(2,e)))}var i,o,s,a,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=J.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(A),o.setAttribute("placeholder",d.getConstant("FindValue")),i=this.parent.createElement("span",{className:"e-input-group-icon"}),a=100<f.usedRange.rowIndex*f.usedRange.colIndex,o.onkeyup=function(e){a?(s&&clearTimeout(s),s=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 F.Toolbar({clicked:function(e){"e-findRib-next"===e.item.cssClass?(c.parent.notify(Ya,{findOption:"next"}),c.updateCount(i)):"e-findRib-prev"===e.item.cssClass?(c.parent.notify(Ya,{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(){J.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(br,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");ae(e),e.classList.add("e-input-focus"),e.setSelectionRange(0,e.value.length)}),p&&c.findDialog.setProperties({animationSettings:p},!0)},beforeOpen:function(){return ae(c.parent.element)},beforeClose:function(){c.findValue=o.value||null,l.destroy(),J.EventHandler.remove(document,"click",c.closeDialog)},close:function(){c.findDialog.destroy(),c.findDialog=null,J.detach(u),h.style.position="",ae(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()}},J.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))},Dp.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}))},Dp.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(" ")},Dp.prototype.closeDialog=function(e){!J.closest(e.target,".e-findRib-close")&&J.closest(e.target,".e-spreadsheet")||!this.findDialog||this.findToolDlg({})},Dp.prototype.renderFindDlg=function(){var e,r=this,n=this.parent.serviceLocator.getService(k);this.parent.element.querySelector(".e-find-dlg")?n.hide():(e={isModal:!1,showCloseIcon:!0,cssClass:"e-find-dlg",header:(e=this.parent.serviceLocator.getService(A)).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()),ae(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(fr)}},{buttonModel:{content:e.getConstant("ReplaceAllBtn"),isPrimary:!0,cssClass:"e-btn-replaceAll",disabled:!0},click:function(){r.dialogMessage(),r.replaceHandler(gr)}}],open:function(){var e,t=r.parent.element.querySelector(".e-text-findNext");t.value&&(e=r.parent.element.querySelector(".e-btn-findPrevious"),J.getComponent(e,"btn").disabled=!1,J.getComponent(r.parent.element.querySelector(".e-btn-findNext"),"btn").disabled=!1),Ph(function(){ae(t)})},close:function(){return n.hide()}},n.show(e))},Dp.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()},Dp.prototype.renderGotoDlg=function(){var r=this,e=this.parent.serviceLocator.getService(A),n=this.parent.serviceLocator.getService(k);J.isNullOrUndefined(this.parent.element.querySelector(".e-find-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()),ae(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()},Dp.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()})},Dp.prototype.findHandler=function(e){var t,r,n,i,o,s=this.parent.element.querySelector(".e-text-findNext"),a=((s=s||this.parent.element.querySelector(".e-text-findNext-short"))||this.gotoAlert(),s.value);""===s.value||(s=this.parent.getActiveSheet()).isProtected&&!s.protectSettings.selectCells&&!s.protectSettings.selectUnLockedCells||(s=this.parent.activeSheetIndex,t=void 0,t=!!(r=this.parent.element.querySelector(".e-findnreplace-checkcase"))&&J.getComponent(r,"checkbox").checked,r=void 0,r=!!(n=this.parent.element.querySelector(".e-findnreplace-checkmatch"))&&J.getComponent(n,"checkbox").checked,n=void 0,n=(i=this.parent.element.querySelector(".e-findnreplace-searchby"))?J.getComponent(i,"dropdownlist").value.toString():"By Row",i=void 0,i=(o=this.parent.element.querySelector(".e-findnreplace-searchwithin"))?J.getComponent(o,"dropdownlist").value.toString():"Sheet",o={value:a,sheetIndex:s,findOpt:e.findOption,mode:i,isCSen:t,isEMatch:r,searchBy:n,isAction:!0},this.parent.find(o))},Dp.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,s=this.parent.element.querySelector(".e-searchby .e-ddl-hidden").value;this.parent.notify(e,{value:t,mode:o,isCSen:n,isEMatch:i,searchBy:s,findOpt:"next",replaceValue:r,replaceBy:e,sheetIndex:this.parent.activeSheetIndex,isAction:!0})},Dp.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.split("!")[1]:e).split("$").join("")).includes(":")?e.split(":")[0]:e).match(/\d+/),o=e.match(/[A-Z]+/i);!i||!o||0!==o.index||1048576<=(i=te(Q(e)))[2]||16384<=i[3]?(this.gotoAlert(),t=!1):this.parent.goTo(r)}return t},Dp.prototype.gotoAlert=function(){var e=this.parent.serviceLocator.getService(A),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)},Dp.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(A).getConstant("NoElements"),t.appendChild(e))},Dp.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(A),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)},Dp.prototype.findKeyUp=function(e){e.target.classList.contains("e-text-findNext")&&(e=this.parent.element.querySelector(".e-text-findNext").value,J.isNullOrUndefined(e)||""===e?(J.getComponent(this.parent.element.querySelector(".e-btn-findPrevious"),"btn").disabled=!0,J.getComponent(this.parent.element.querySelector(".e-btn-findNext"),"btn").disabled=!0,this.dialogMessage()):(e=this.parent.element.querySelector(".e-btn-findPrevious"),J.getComponent(e,"btn").disabled=!1,J.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;J.isNullOrUndefined(e)||J.isNullOrUndefined(t)||""===e||""===t?(J.getComponent(this.parent.element.querySelector(".e-btn-replace"),"btn").disabled=!0,J.getComponent(this.parent.element.querySelector(".e-btn-replaceAll"),"btn").disabled=!0):this.parent.getActiveSheet().isProtected||(J.getComponent(this.parent.element.querySelector(".e-btn-replace"),"btn").disabled=!1,J.getComponent(this.parent.element.querySelector(".e-btn-replaceAll"),"btn").disabled=!1)},Dp.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.parent.serviceLocator.getService(A),i=(e.appendChild(t),this.parent.createElement("div",{className:"e-cont"})),o=this.parent.createElement("p",{className:"e-header"}),s=(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=(i.appendChild(s),i.insertBefore(o,s),t.appendChild(i),new S.TextBox({width:"70%"})),i=(o.createElement=this.parent.createElement,o.appendTo(s),this.parent.createElement("div",{className:"e-cont"})),o=this.parent.createElement("p",{className:"e-header"}),s=(o.innerText=n.getConstant("ReplaceWith"),this.parent.createElement("input",{className:"e-input e-text-replaceInp",attrs:{type:"Text",placeholder:n.getConstant("ReplaceValue")}})),o=(i.appendChild(s),i.insertBefore(o,s),t.appendChild(i),new S.TextBox({width:"70%"})),i=(o.createElement=this.parent.createElement,o.appendTo(s),[{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}),s=n.getConstant("SearchWithin"),i=this.parent.createElement("input",{className:"e-findnreplace-searchwithin",attrs:{type:"select",label:s}}),a=this.parent.createElement("p",{className:"e-header"}),a=(a.innerText=s,t.appendChild(a),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:a,cssClass:"e-searchby",fields:{value:"Id",text:"Search"},width:"50%",index:0}),s=n.getConstant("SearchBy"),i=this.parent.createElement("input",{className:"e-findnreplace-searchby",attrs:{type:"select",label:s}}),a=this.parent.createElement("p",{className:"e-header"}),s=(a.innerText=s,t.appendChild(a),t.appendChild(i),o.createElement=this.parent.createElement,o.appendTo(i),new w.CheckBox({label:n.getConstant("MatchCase"),checked:!1,cssClass:"e-findnreplace-casecheckbox"})),a=this.parent.createElement("input",{className:"e-findnreplace-checkcase",attrs:{type:"checkbox"}}),o=(r.appendChild(a),s.createElement=this.parent.createElement,s.appendTo(a),new w.CheckBox({label:n.getConstant("MatchExactCellElements"),checked:!1,cssClass:"e-findnreplace-exactmatchcheckbox"})),i=this.parent.createElement("input",{className:"e-findnreplace-checkmatch",attrs:{type:"checkbox"}});return r.appendChild(i),o.createElement=this.parent.createElement,o.appendTo(i),t.appendChild(r),e},Dp.prototype.GotoContent=function(){var e=this.parent.serviceLocator.getService(A),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},Dp.prototype.destroy=function(){this.removeEventListener(),this.findDialog&&this.findDialog.hide(),this.parent=null},Dp.prototype.getModuleName=function(){return"findAndReplace"};var Tp=Dp;function Dp(e){this.shortValue="",this.parent=e,this.addEventListener()}Pp.prototype.merge=function(e){this.parent.serviceLocator.getService("cell").refresh(e.rowIdx,e.colIdx,e.lastCell,e.element,!1,!1,Td(this.parent))},Pp.prototype.hideHandler=function(e){var t,r=this.parent.getActiveSheet(),n={range:[e.rowIdx,e.colIdx,e.rowIdx,e.colIdx]},i=(this.parent.notify(Tr,n),ie(n.range[0],n.range[1],r)||{}),o="row"===e.model?n.range[0]:n.range[1],s=o+((i[e.model+"Span"]||1)-1);!e.isEnd&&(e.start===o||Eh(r,o))||e.isEnd&&e.start>o&&!Eh(r,o)||1<i[e.model+"Span"]&&s>=e.start&&(("row"===e.model?$:Eh)(r,o)?e.colIdx<=s&&(o=K(r,n.range[1],!0,"columns"))<=s&&(t=n.range[0],1<i.rowSpan&&(t=(t=K(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?K(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])})))},Pp.prototype.checkPrevMerge=function(a){function e(e){if(l.range=l.range,$(d,l.range[0])&&a.rowIdx>=l.range[0]&&a.rowIdx<=l.range[2]){o=!1;for(var t,r=l.range[0];r<a.rowIdx;r++)if(!$(d,r)){o=!0;break}1<n.rowSpan&&!o&&0<(t=n.rowSpan-h.parent.hiddenCount(l.range[0],l.range[2]))&&(p(),a.td.style.display="",a.colSpan=i,a.rowSpan=t,a.cell=n,a.isMerged=!1)}else if(e){for(r=l.range[0];s&&r<a.rowIdx;r++)if(!$(d,r)){o=!0;break}o||(p(),a.td.style.display="",a.colSpan=i,a.cell=n,a.isMerged=!1)}}var n,l,i,o,s,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 s=a.colIdx;s<=l.range[3];s++)(n=h.parent.getCell(r,s,s<o?i:t))&&(1<n.colSpan||1<n.rowSpan)&&(n.style.display="none",n.removeAttribute("colSpan"),n.removeAttribute("rowSpan"))}}};if(a.cell.colSpan<0){if(-1<a.colIdx-1&&Eh(d,a.colIdx-1)&&(n=ie(a.rowIdx,a.colIdx-1,d,!1,!0),s=-1<a.rowIdx-1&&$(d,a.rowIdx-1),void 0!==n.colSpan||void 0!==n.rowSpan)&&(void 0===n.rowSpan||1<n.rowSpan||s)&&(l={range:[a.rowIdx,a.colIdx-1,a.rowIdx,a.colIdx-1]},this.parent.notify(Tr,l),l.range,n=ie(l.range[0],l.range[1],d,!1,!0),Eh(d,l.range[1]))&&a.colIdx>=l.range[1]&&a.colIdx<=l.range[3]){for(var t=l.range[1];t<a.colIdx;t++)if(!Eh(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<a.rowIdx-1&&$(d,a.rowIdx-1)&&void 0!==(n=ie(a.rowIdx-1,a.colIdx,d,!1,!0)).rowSpan&&(l={range:[a.rowIdx-1,a.colIdx,a.rowIdx-1,a.colIdx]},this.parent.notify(Tr,l),l.range=l.range,n=ie(l.range[0],l.range[1],d,!1,!0),e())},Pp.prototype.checkMerge=function(e){var t,r=this.parent.getActiveSheet(),n=ie(e.rowIdx,e.colIdx,r)||{};if(e.isRow){if(void 0===n.colSpan||Eh(r,e.colIdx-1))if((t={range:[e.rowIdx,e.colIdx,e.rowIdx,e.colIdx]}).range,this.parent.notify(Tr,t),Eh(r,e.colIdx-1)&&!Eh(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)&&Eh(r,e.colIdx-1))for(var i=t.range[1];void 0!==n.colSpan&&i<e.colIdx;i++)if(!Eh(r,i))return;var o,n=ie(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||$(r,e.rowIdx-1))if((t={range:[e.rowIdx,e.colIdx,e.rowIdx,e.colIdx]}).range=t.range,this.parent.notify(Tr,t),$(r,e.rowIdx-1)&&!$(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)&&$(r,e.rowIdx-1))for(var s=t.range[0];void 0!==n.rowSpan&&s<e.rowIdx;s++)if(!$(r,s))return;n=ie(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="")}},Pp.prototype.addEventListener=function(){this.parent.on(Fr,this.merge,this),this.parent.on(el,this.hideHandler,this),this.parent.on(tl,this.checkPrevMerge,this),this.parent.on(rl,this.checkMerge,this)},Pp.prototype.destroy=function(){this.removeEventListener(),this.parent=null},Pp.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(Fr,this.merge),this.parent.off(el,this.hideHandler),this.parent.off(tl,this.checkPrevMerge),this.parent.off(rl,this.checkMerge))},Pp.prototype.getModuleName=function(){return"merge"};var Lp=Pp;function Pp(e){this.parent=e,this.addEventListener()}Bp.prototype.destroy=function(){this.removeEventListener(),this.parent=null},Bp.prototype.addEventListener=function(){this.parent.on(Mr,this.applyCF,this),this.parent.on(al,this.renderCFDlg,this),this.parent.on(Vr,this.clearCF,this)},Bp.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(Mr,this.applyCF),this.parent.off(al,this.renderCFDlg),this.parent.off(Vr,this.clearCF))},Bp.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,s,a;J.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])&&((s={})[""+e]=o,l.parent.notify(Nt,{style:s,rowIdx:t,colIdx:r,td:i}))}),[".e-cf-databar",".e-iconsetspan"].forEach(function(e){(a=i.querySelector(e))&&(i.removeChild(a),i.textContent=l.parent.getDisplayText(n))})})},Bp.prototype.renderCFDlg=function(e){var t=this,r=this.parent.serviceLocator.getService(A),n=this.parent.serviceLocator.getService(k);n.show({width:375,showCloseIcon:!0,isModal:!0,cssClass:"e-conditionalformatting-dlg",header:e.action.replace("...",""),beforeOpen:function(){n.dialogInstance.content=t.cfDlgContent(e.action),n.dialogInstance.dataBind(),ae(t.parent.element)},buttons:[{buttonModel:{content:r.getConstant("Ok"),isPrimary:!0},click:function(){t.dlgClickHandler(e.action),n.hide()}}]})},Bp.prototype.dlgClickHandler=function(e){var t,r=this.parent.serviceLocator.getService(A),n=["",""],i=this.parent.element.querySelector(".e-conditionalformatting-dlg").getElementsByClassName("e-dlg-content")[0].querySelector(".e-cf-dlg"),o=i.querySelector(".e-cfmain"),o=(o&&((t=o.getElementsByTagName("input")[0])&&t.parentElement.classList.contains("e-cfmain")&&(n[0]=o.getElementsByTagName("input")[0].value),n[1]=o.getElementsByTagName("input")[1]?i.querySelector(".e-cfmain").getElementsByTagName("input")[1].value:"",Jn(n,this.parent.locale)),{type:e===r.getConstant("DuplicateValues")+"..."?t.value===r.getConstant("Duplicate")?"Duplicate":"Unique":this.getType(e),cFColor:this.getCFColor(i.querySelector(".e-cfsub").getElementsByTagName("input")[0].value),range:this.parent.getActiveSheet().selectedRange});o.value=""!==n[0]?n[0]+(""!==n[1]?","+n[1]:""):n[1],this.parent.notify(Pr,{cfModel:o,isAction:!0})},Bp.prototype.getType=function(e){var t,r=this.parent.serviceLocator.getService(A);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},Bp.prototype.getCFColor=function(e){var t=this.parent.serviceLocator.getService(A),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},Bp.prototype.cfDlgContent=function(e){var t,r=this.getDlgText(e),n=this.parent.serviceLocator.getService(A),i=this.parent.createElement("div",{className:"e-cf-dlg"}),o=this.parent.createElement("div",{className:"e-cfmain"}),s=this.parent.createElement("div",{className:"e-cfsub"}),a=this.parent.createElement("span",{className:"e-header e-top-header"}),r=(a.innerText=r,this.parent.createElement("input",{className:"e-input",id:"valueInput",attrs:{type:"text","aria-label":r}})),l=this.parent.createElement("input",{className:"e-select"}),h=this.parent.createElement("span",{className:"e-header"}),d=(h.innerText=n.getConstant("With"),this.parent.createElement("input",{className:"e-select"})),e=(i.appendChild(o),i.appendChild(s),o.appendChild(a),e!==n.getConstant("DuplicateValues")+"..."?e!==n.getConstant("AboveAverage")+"..."&&e!==n.getConstant("BelowAverage")+"..."&&(o.appendChild(r),t=!0,a=e===n.getConstant("Top10")+" %..."||e===n.getConstant("Bottom10")+" %...",e!==n.getConstant("Top10Items")+"..."&&e!==n.getConstant("Bottom10Items")+"..."&&!a||(r.maxLength=a?3:4,new S.NumericTextBox({value:10,min:1,max:a?100:1e3,format:"###"}).appendTo(r))):(o.appendChild(l),a=[{text:n.getConstant("Duplicate"),id:"duplicate"},{text:n.getConstant("Unique"),id:"unique"}],new I.DropDownList({dataSource:a,index:0,popupHeight:"200px"}).appendTo(l)),e===n.getConstant("Between")+"..."&&((a=this.parent.createElement("span",{className:"e-header e-header-2"})).innerText=n.getConstant("And"),l=this.parent.createElement("input",{className:"e-input e-between"}),o.appendChild(a),o.appendChild(l),l.addEventListener("input",this.validateCFInput.bind(this))),t&&(this.validateCFInput({target:r}),r.addEventListener("input",this.validateCFInput.bind(this))),s.appendChild(h),s.appendChild(d),[{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"}]);return new I.DropDownList({dataSource:e,index:0,popupHeight:"200px"}).appendTo(d),i},Bp.prototype.validateCFInput=function(e){var t=this.parent.serviceLocator.getService(k),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()},Bp.prototype.checkCellHandler=function(e,t,r){for(var n=r.range.trim().split(","),i=0;i<n.length;i++){var o=Q(n[i].includes(":")?n[i]:n[i]+":"+n[i]);if(e>=o[0]&&e<=o[2]&&t>=o[1]&&t<=o[3])return!0}return!1},Bp.prototype.getDlgText=function(e){var t=this.parent.serviceLocator.getService(A),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},Bp.prototype.updateResult=function(e,t,r,n,i,o,s,a){for(var l,h,d={},p={},c=e.range.split(","),u=[],f=r?function(){var e;Y(l)&&(0<=(e=parseFloat(l))?(void 0===u[0]||e>u[0])&&(u[0]=e):(void 0===u[1]||e<u[1])&&(u[1]=e))}:n?function(){var e;Y(l)&&(e=parseFloat(l),u.push(Number(e)))}:i?(u=[0,0],function(){Y(l)&&(u[0]+=parseFloat(l),u[1]++)}):o?function(){Y(l)&&u.push(parseFloat(l))}:s?function(){var e;Y(l)&&(e=parseInt(l,10),(void 0===u[0]||e<u[0])&&(u[0]=e),void 0===u[1]||e>u[1])&&(u[1]=e)}:function(){d[""+l]?""===l||p[""+l]||(p[""+l]=!0,u.push(l)):d[""+l]=!0},g=0;g<c.length;g++)for(var m,v=(m=Q(c[g]))[0];v<=m[2];v++)for(var y=m[1];y<=m[3];y++)h=ie(v,y,t,!1,!0),J.isNullOrUndefined(h.value)?h.formula&&(this.parent.notify("calculateFormula",{cell:h,rowIdx:v,colIdx:y,sheetIndex:this.parent.activeSheetIndex}),l=h.value.toString().toLowerCase(),f()):(l=h.value.toString().toLowerCase(),f());n||o?(u=u.sort(function(e,t){return e-t}),e.type.includes("Bottom")||(u=u.reverse()),o&&(r=parseFloat(a),e.type.includes("Percentage")&&(r=(r/=100/u.length)<1?1:r),u=u.slice(0,r))):i&&!(u=[u[0]/u[1]])[0]&&(u=[]),e.result=u},Bp.prototype.applyCF=function(e){var t,r=!e.cfModel,n=this.parent.getActiveSheet(),i=e.cfModel||n.conditionalFormats,o=[e.indexes];e.refreshAll&&(o=Qn(this.parent,this.parent.viewport));for(var s=i.length-1;0<=s;s--)r&&(2===o[0].length?!this.checkCellHandler(e.indexes[0],e.indexes[1],i[s]):!Zn(o,i[s].range))||(t=this.updateCF(e,n,i[s],t))},Bp.prototype.updateCF=function(h,e,d,p){var c,u,f=this;if(d.value){var t=d.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===g&&(g=r.substring(0,r.length-1),r="");c=r.substring(0,r.length-1)}else for(var g=t[0],n=1;n<t.length;n++)c+=n+1===t.length?t[n]:t[n]+",";else g=t[0]||d.value}d.type||(d.type="GreaterThan"),d.format&&d.format.style?(u=Bi(d.format.style,!0),Object.keys(u).length||d.cFColor||(d.cFColor="RedFT")):(u={},d.cFColor||(d.cFColor="RedFT"));function i(e,t,r,n){var i,o,s,a=r&&!J.isNullOrUndefined(r.value)?r.value.toString():"",l=!0;switch(d.type){case"GreaterThan":case"LessThan":i=f.isGreaterThanLessThan(d,a,g);break;case"Between":i=Y(a)&&f.isBetWeen(d,a,g,c);break;case"EqualTo":i=Y(a)&&f.isEqualTo(d,a,g);break;case"ContainsText":i=a&&f.isContainsText(a,g);break;case"DateOccur":o={value:g,cell:{},updatedVal:""},f.parent.notify(Ft,o),i=a===o.updatedVal;break;case"Unique":i=-1===d.result.indexOf(a.toLowerCase());break;case"Duplicate":i=-1<d.result.indexOf(a.toLowerCase());break;case"Top10Items":case"Bottom10Items":case"Top10Percentage":case"Bottom10Percentage":d.result&&(o=parseFloat(a),Rn(a)&&(o=En(a)),i=-1<d.result.indexOf(o));break;case"AboveAverage":i=d.result.length&&parseFloat(a)>d.result[0];break;case"BelowAverage":i=d.result.length&&parseFloat(a)<d.result[0];break;default:l=!1,m?f.applyDataBars(a,d,n,e):v?f.applyColorScale(a,d,n,r,e,t):f.applyIconSet(a,d,n)}h.isAction&&l&&(f.parent.trigger("beforeConditionalFormat",{conditionalFormat:d,cell:r,element:n,apply:i,address:G(e,t)}),i||!h.isEdit||p||(h.indexes&&h.indexes[0]===e&&h.indexes[1]===t&&(p=!0),d.cFColor?n.className.includes("e-"+d.cFColor.toLowerCase())&&(n.classList.remove("e-"+d.cFColor.toLowerCase()),n.style.backgroundColor="",n.style.color="",(s=J.extend({},f.parent.commonCellStyle,r&&r.style)).backgroundColor||s.color)&&f.parent.notify(Nt,{rowIdx:e,colIdx:t,td:n,style:{backgroundColor:s.backgroundColor,color:s.color}}):(n.removeAttribute("style"),s=J.extend({},f.parent.commonCellStyle,r&&r.style),Object.keys(s).length&&f.parent.notify(Nt,{style:s,rowIdx:e,colIdx:t,td:n})))),i&&(h.isEdit&&h.indexes&&h.indexes[0]===e&&h.indexes[1]===t&&(p=!0),J.removeClass([n],["e-redft","e-yellowft","e-greenft","e-redf","e-redt"]),d.cFColor&&(n.classList.add("e-"+d.cFColor.toLowerCase()),f.setCFStyle(u,d)),Object.assign(n.style,u))}var o=d.type.includes("Average"),s=d.type.includes("10")&&Y(g),a=d.type.includes("Three")||d.type.includes("Four")||d.type.includes("Five"),m=d.type.includes("DataBar"),v=d.type.includes("ColorScale");h.isRender&&d.result||!("Duplicate"===d.type||"Unique"===d.type||m||v||o||s||a)||this.updateResult(d,e,m,v,o,s,a,g);if(h.ele)i(h.indexes[0],h.indexes[1],h.cell,h.ele);else for(var l=d.range.split(","),y=this.parent.frozenRowCount(e),C=this.parent.frozenColCount(e),b=W(e.topLeftCell),x=0;x<l.length;x++)this.updateRange(e,Q(l[x]),y,C,b,i);return p},Bp.prototype.updateRange=function(e,t,r,n,i,o){var s;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 a=t[0];a<=t[2];a++)if(!$(e,a=r&&a===r?this.parent.viewport.topIndex+r:a))for(var l=t[1];l<=t[3];l++)Eh(e,l=n&&l===n?this.parent.viewport.leftIndex+n:l)||(s=this.parent.getCell(a,l))&&o(a,l,ie(a,l,e),s)},Bp.prototype.applyIconSet=function(e,t,r){r.classList.contains("e-iconset")&&(r.classList.remove("e-iconset"),l=r.querySelector(".e-iconsetspan"))&&r.removeChild(l);var n,i,o,s,a,l=parseInt(e,10),e=t.result;isNaN(l)||void 0===e[0]&&void 0===e[1]||(n=e[0],e=e[1],3===(t=this.getIconList(t.type).split(",")).length?i="e-"+(n+.67*(e-n)<=l?t[0]:n+.33*(e-n)<=l?t[1]:t[2]).trim():4===t.length?(o=n+.25*(e-n),s=n+.5*(e-n),i="e-"+((a=n+.75*(e-n))<=l?t[0]:s<=l?t[1]:o<=l?t[2]:t[3]).trim()):5===t.length&&(o=n+.2*(e-n),s=n+.4*(e-n),a=n+.6*(e-n),i="e-"+(n+.8*(e-n)<=l?t[0]:a<=l?t[1]:s<=l?t[2]:o<=l?t[3]:t[4]).trim()),e=this.parent.createElement("span",{className:"e-icon e-iconsetspan "+i}),r.insertBefore(e,r.childNodes[0]),r.classList.add("e-iconset"))},Bp.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-1,4rating-2,4rating-3,4rating-4";case"FiveQuarters":return"5quarters-1,5quarters-2,5quarters-3,5quarters-4,5quarters-5";case"FiveRating":return"5rating-1,5rating-2,5rating-3,5rating-4,5rating-5";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"},Bp.prototype.applyColorScale=function(e,t,r,n,i,o){e=parseFloat(e);isNaN(e)?r.style.backgroundColor&&(r.style.backgroundColor="",(n=J.extend({},this.parent.commonCellStyle,n&&n.style)).backgroundColor)&&this.parent.notify(Nt,{style:{backgroundColor:n.backgroundColor},td:r,rowIdx:i,colIdx:o}):(i=(n=t.result).indexOf(e),o=this.getColor(t.type),r.style.backgroundColor=0===i?o[0]:i===n.length-1?o[o.length-1]:3===n.length&&1===i?o[1]:this.getGradient(i,o[0],o[1],o[2],n.length))},Bp.prototype.applyDataBars=function(e,t,r,n){var i,o,s,a,l,h,d=this.parent.getActiveSheet(),p=t.result,c=0;Y(e)&&(o=parseFloat(e)),void 0===p[0]&&void 0===p[1]||isNaN(o)?(e=r.getElementsByClassName("e-cf-databar")[0])&&r.removeChild(e):(void 0!==p[0]&&void 0!==p[1]?(i=p[0]+Math.abs(p[1]),c=Math.abs(p[1]/i*100)):i=void 0!==p[0]?p[0]:p[1],e=this.parent.createElement("div",{id:"spreadsheet-databar",className:"e-cf-databar"}),s=this.parent.createElement("span",{id:"spreadsheet-leftspan",className:"e-databar"}),a=this.parent.createElement("span",{id:"spreadsheet-rightspan",className:"e-databar"}),l=this.parent.createElement("span",{id:"spreadsheet-dataspan",className:"e-databar-value"}),(h=r.querySelector(".e-iconsetspan"))&&r.insertBefore(h,r.firstElementChild),h=gh(d,n,!0),e.style.height=h-1+"px","L"===(d=t.type[0])&&(d+="B"),void 0===p[1]?(a.style.width=Math.ceil(Math.abs(o/i*100))+"%",a.style.height=h-3+"px",a.style.backgroundColor=this.getColor(d)[0],a.style.left="0px"):void 0===p[0]?(a.style.width=Math.ceil(Math.abs(o/i*100))+"%",a.style.height=h-3+"px",a.style.backgroundColor=this.getColor("R")[0],a.style.left="0px"):0<=o?(s.style.width=c+"%",s.style.height=h-3+"px",s.style.backgroundColor="transparent",s.style.left="0px",a.style.width=Math.ceil(Math.abs(o/i*100))+"%",a.style.height=h-3+"px",a.style.backgroundColor=this.getColor(d)[0],a.style.left=c+"%"):(s.style.width=Math.ceil(Math.abs(o/i*100))+"%",s.style.height=h-3+"px",s.style.backgroundColor=this.getColor("R")[0],s.style.width===c+"%"?s.style.left="0px":s.style.right=100-c+"%"),l.style.fontSize=r.style.fontSize||"11pt",(n=r.querySelector("#"+this.parent.element.id+"_currency"))&&e.appendChild(n),(t=r.querySelector(".e-hyperlink"))?l.appendChild(t):(l.innerText=r.textContent,""===r.textContent&&l.appendChild(document.createTextNode(r.textContent))),e.appendChild(s),e.appendChild(a),e.appendChild(l),r.textContent="",r.appendChild(e))},Bp.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},Bp.prototype.getGradient=function(e,t,r,n,i){return J.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)},Bp.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)},Bp.prototype.byteLinear=function(e,t,r){e=parseInt(e,16)*(1-r)+parseInt(t,16)*r|0;return Math.abs(e).toString(16)},Bp.prototype.isGreaterThanLessThan=function(e,t,r){var n;return Y(t)?Y(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(Ft,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},Bp.prototype.isBetWeen=function(e,t,r,n){var i,o,s=new RegExp(/[^.-a-zA-Z 0-9]+/g);return r=r.replace(s,""),n=n.replace(s,""),Y(r)?(s=parseFloat(r),(i=parseFloat(n))<s&&(s=(o=[i,s])[0],i=o[1]),parseFloat(t)>=s&&parseFloat(t)<=i):!(!r||!n)&&(o={value:n,cell:{},updatedVal:""},this.parent.notify(Ft,s={value:r,cell:{},updatedVal:""}),this.parent.notify(Ft,o),(s.isDate||s.isTime)&&(o.isDate||o.isTime)?(e.value=s.updatedVal+","+o.updatedVal,s.updatedVal>o.updatedVal&&(i=[o.updatedVal,s.updatedVal],s.updatedVal=i[0],o.updatedVal=i[1]),t>=s.updatedVal&&t<=o.updatedVal):t.toLowerCase()>=r.toLowerCase()&&t.toLowerCase()<=n.toLowerCase())},Bp.prototype.isEqualTo=function(e,t,r){var n;return Y(r)?(n=new RegExp(/[^.-a-zA-Z 0-9]+/g),parseFloat(t)===parseFloat(r.replace(n,""))):(this.parent.notify(Ft,n={value:r,cell:{},updatedVal:""}),n.isTime||n.isDate?(e.value=n.updatedVal,t===n.updatedVal):t.toLowerCase()===r.toLowerCase())},Bp.prototype.isContainsText=function(e,t){var r=new RegExp(/[^.-a-zA-Z 0-9]+/g);return Y(t.replace(r,""))?(t=t.replace(r,""),-1<(e=Rn(e)?En(e).toString():e).indexOf(t)):Rn(t)?-1<(e=Rn(e)?En(e).toString():e).indexOf(En(t).toString()):-1<e.toLowerCase().indexOf(t.toLowerCase())},Bp.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},Bp.prototype.getModuleName=function(){return"conditionalFormatting"};var Mp=Bp;function Bp(e){this.parent=e,this.addEventListener()}Vp.prototype.getfillItems=function(){var e=this.parent.serviceLocator.getService(A);return[{text:e.getConstant("CopyCells")},{text:e.getConstant("FillSeries")},{text:e.getConstant("FillFormattingOnly")},{text:e.getConstant("FillWithoutFormatting")}]},Vp.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}))},Vp.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},Vp.prototype.getFillType=function(e){var t=this.parent.serviceLocator.getService(A),e=e===t.getConstant("CopyCells")?"CopyCells":e===t.getConstant("FillSeries")?"FillSeries":e===t.getConstant("FillFormattingOnly")?"FillFormattingOnly":"FillWithoutFormatting";return e},Vp.prototype.autoFillClick=function(){var e=this.parent.serviceLocator.getService(A),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))},Vp.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]}},Vp.prototype.autoFillOptionClick=function(e){var t=this.parent.serviceLocator.getService(A),r=this.parent.getActiveSheet(),n=te(Q(this.parent.selectionModule.dAutoFillCell)),i=Q(r.selectedRange),o=n[0],s=n[1],a=n[2],n=n[3],l=this.getDirection({rowIndex:a,colIndex:n},{rowIndex:i[2],colIndex:i[3]}),h=[o,s,a,n],o=this.getFillRange({rowIndex:o,colIndex:s},{rowIndex:a,colIndex:n},{rowIndex:i[2],colIndex:i[3]},l),s=(this.refreshAutoFillOption(t.getConstant(e.type)),{isUndo:!0,isPublic:!0,preventReSelect:!0,preventEvt:"FillWithoutFormatting"===e.type,setCollection:"FillFormattingOnly"===e.type||"FillWithoutFormatting"===e.type}),a=(this.parent.notify(Sa,s),{dataRange:r.name+"!"+ee(h),fillRange:r.name+"!"+ee(o),direction:l,fillType:e.type,isFillOptClick:!0}),n=(this.isVerticalFill="Down"===a.direction||"Up"===a.direction,this.parent.notify(tn,a),this.positionAutoFillElement({isautofill:!0}),{dataRange:a.dataRange,fillRange:a.fillRange,fillType:a.fillType,direction:a.direction,selectedRange:r.name+"!"+ee(i),undoArgs:s.undoArgs});this.parent.notify(oe,{eventArgs:n,action:"autofill"}),this.parent.showAggregate&&this.parent.notify(il,{}),this.autoFillClick()},Vp.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()},Vp.prototype.positionAutoFillElement=function(e){var t,r=0,n=0,i=this.parent.getActiveSheet(),o=te(Q(i.selectedRange)),s=-5,a=-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);Eh(i,o[3])||$(i,o[2])||g&&g.classList.contains("e-formularef-selection")||i.isProtected&&i.protectSettings.selectUnLockedCells&&kd(this.parent,o)?this.hideAutoFillElement():(i.isProtected&&(i.protectSettings.selectCells||i.protectSettings.selectUnLockedCells)||!i.isProtected)&&(d?(s=-5,a=-1,l=6,c=o[h=2],u=o[1]):p&&(a=-5,l=1,h=6,c=o[s=0],u=o[3]),i.frozenColumns||i.frozenRows?(p||d?(Gh(this.parent,this.autoFillElement,o,"e-autofill",e&&e.preventAnimation),this.parent.autoFillSettings.showFillOptions&&e&&e.isautofill&&Gh(this.parent,this.autoFillDropDown.element,o,"e-filloption")):(Gh(this.parent,this.autoFillElement,[c,u,c,u],"e-autofill",e&&e.preventAnimation),this.parent.autoFillSettings.showFillOptions&&e&&e.isautofill&&Gh(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")[0])&&(t=g.getBoundingClientRect(),this.autoFillElementPosition={left:t.left,top:t.top})):(o=Wh(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=vh(i,c,c,!0),i=Ih(i,u,u,!0),p||(r+=g),d||(n+=i),r+=Math.round(o.top)+s,n+=Math.round(o.left)+a,this.autoFillElement&&(J.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&&(J.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")))},Vp.prototype.hideAutoFillElement=function(){var t=this.parent.element;[].slice.call(t.querySelectorAll(".e-autofill")).forEach(function(e){t&&J.addClass([e],"e-hide")})},Vp.prototype.hideAutoFillOptions=function(){var t=this.parent.element;[].slice.call(t.querySelectorAll(".e-filloption")).forEach(function(e){t&&J.addClass([e],"e-hide")})},Vp.prototype.selectAutoFillRange=function(e){var t={clientY:ad(e.e),target:e.e.target},r={clientX:sd(e.e),target:e.e.target},n=this.parent.getActiveSheet(),t=(this.parent.notify(Cl,t),this.parent.notify(bl,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]:Q(n.selectedRange);return e.indexes=r},Vp.prototype.getAutoFillRange=function(e){var t=this.parent.getActiveSheet(),r=this.autoFillCell,t=te(Q(t.selectedRange)),n=t[0],i=t[1],o=t[2],s=t[3],a=Bn(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:s},t=this.modifyRangeForMerge(e.rowIndex,e.colIndex,r.rowIndex,r.colIndex,t);return e.rowIndex<r.rowIndex?n-e.rowIndex>e.colIndex-s&&n-e.rowIndex>i-e.colIndex?a?{startCell:l,endCell:{rowIndex:e.rowIndex,colIndex:s}}:{startCell:p,endCell:{rowIndex:t.rowIndex,colIndex:i},fillRange:[t.rowIndex,i,n-1,s],direction:"Up"}:e.colIndex>r.colIndex?{startCell:l,endCell:{rowIndex:o,colIndex:e.colIndex},fillRange:[n,s+1,o,e.colIndex],direction:"Right"}:e.colIndex<r.colIndex?a?{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-s?{startCell:l,endCell:{rowIndex:e.rowIndex,colIndex:s},fillRange:[o+1,i,e.rowIndex,s],direction:"Down"}:{startCell:l,endCell:{rowIndex:o,colIndex:t.colIndex},fillRange:[n,s+1,o,t.colIndex],direction:"Right"}:e.colIndex<r.colIndex?e.rowIndex-o>s-e.colIndex||e.rowIndex-n>s-e.colIndex&&e.rowIndex!==o?{startCell:l,endCell:{rowIndex:e.rowIndex,colIndex:s},fillRange:[o+1,i,e.rowIndex,s],direction:"Down"}:a?{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:s},fillRange:[o+1,i,t.rowIndex,s],direction:"Down"}:(e.rowIndex===r.rowIndex&&(e.colIndex,r.colIndex),{startCell:h,endCell:d})},Vp.prototype.modifyRangeForMerge=function(e,t,r,n,i){var o,s,a,l={rowIndex:e,colIndex:t};return this.isMergedRange(i)&&(o=i[2]-i[0]+1,s=i[3]-i[1]+1,a=void 0,e<r?(a=(i[2]-e+1)%o)&&0<=e-(o-a)&&(l.rowIndex=e-(o-a)):n<t?(a=(t-i[1]+1)%s)&&(l.colIndex=t+(s-a)):t<n?(a=(i[3]-t+1)%s)&&0<=t-(s-a)&&(l.colIndex=t-(s-a)):r<e&&(a=(e-i[0]+1)%o)&&(l.rowIndex=e+(o-a))),l},Vp.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:ad(e.event),target:e.event.target},n={clientX:sd(e.event),target:e.event.target},this.parent.notify(Cl,r),this.parent.notify(bl,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+"!"+ee(t.fillRange),direction:t.direction,fillType:e.fillType||this.parent.autoFillSettings.fillType,cancel:!1},Bd(this.parent,Q(e.dAutoFillCell))||Bd(this.parent,t.fillRange)?this.parent.notify($a,null):(this.parent.notify(gt,{eventArgs:n,action:"autofill"}),n.cancel||(i=kd(this.parent,t.fillRange),r.isProtected&&i?this.parent.notify(Ka,null):e.rangeInfo?this.performAutoFillAction(n,null,i):(this.performAutoFillAction(n,t,i),this.positionAutoFillElement({isautofill:!0}))))))},Vp.prototype.refreshCell=function(e){this.parent.serviceLocator.getService("cell").refreshRange([e.rowIndex,e.colIndex,e.rowIndex,e.colIndex])},Vp.prototype.getDirection=function(e,t,r){if(r=J.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},Vp.prototype.performAutoFillAction=function(e,t,r){var n,i=this,o=this.parent.getActiveSheet(),s=this.parent.serviceLocator.getService(A);this.isMergedRange(Q(e.fillRange))?(n=this.parent.serviceLocator.getService(k)).show({isModal:!0,showCloseIcon:!0,height:180,width:400,content:s.getConstant("AutoFillMergeAlertMsg"),buttons:[{buttonModel:{content:this.parent.serviceLocator.getService(A).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}),s=t?ee([t.startCell.rowIndex,t.startCell.colIndex,t.endCell.rowIndex,t.endCell.colIndex]):o.selectedRange,wi(this.parent,s,o),r={dataRange:e.dataRange,fillRange:e.fillRange,fillType:e.fillType,direction:e.direction,selectedRange:s},this.parent.notify(oe,{eventArgs:r,action:"autofill"}),this.parent.trigger("select",{range:this.parent.getActiveSheet().selectedRange}),this.parent.showAggregate&&this.parent.notify(il,{}))},Vp.prototype.getRangeData=function(e){for(var t,r=[],n=this.parent.getActiveSheet(),i=e.range[0],o=e.range[1],s=e.range[2],a=e.range[3],l=o;i<=s;){if($(n,i));else for(o=l;o<=a;)Eh(n,o)||(t=ie(i,o,n),r.push(t)),o++;i++}return r},Vp.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},Vp.prototype.addEventListener=function(){this.parent.on(ds,this.createAutoFillElement,this),this.parent.on(Yl,this.positionAutoFillElement,this),this.parent.on(Xl,this.hideAutoFillOptions,this),this.parent.on(Zl,this.hideAutoFillElement,this),this.parent.on(Kl,this.performAutoFill,this),this.parent.on($l,this.selectAutoFillRange,this),this.parent.on(rn,this.refreshCell,this),this.parent.on(on,this.getautofillDDB,this)},Vp.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(ds,this.createAutoFillElement),this.parent.off(Yl,this.positionAutoFillElement),this.parent.off(Xl,this.hideAutoFillOptions),this.parent.off(Zl,this.hideAutoFillElement),this.parent.off(Kl,this.performAutoFill),this.parent.off($l,this.selectAutoFillRange),this.parent.off(rn,this.refreshCell),this.parent.off(on,this.getautofillDDB))},Vp.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&&(Mh(this.splitBtnElem),this.splitBtnElem.remove()),this.splitBtnElem=null,this.parent=null},Vp.prototype.getModuleName=function(){return"autofill"};var Hp=Vp;function Vp(e){this.fillOptionIndex=0,this.parent=e,this.addEventListener()}_p.prototype.destroy=function(){this.removeEventListener(),this.parent=null,this.isNoteVisible=null},_p.prototype.addEventListener=function(){this.parent.on(pa,this.addNote,this),this.parent.on(ca,this.editNote,this),this.parent.on(ua,this.deleteNote,this),this.parent.on(ga,this.createNoteIndicator,this),this.parent.on(fa,this.showNote,this),this.parent.on(va,this.removeNoteContainer,this),this.parent.on(ma,this.updateNoteContainer,this)},_p.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(pa,this.addNote),this.parent.off(ca,this.editNote),this.parent.off(fa,this.showNote),this.parent.off(ua,this.deleteNote),this.parent.off(ga,this.createNoteIndicator),this.parent.off(va,this.removeNoteContainer),this.parent.off(ma,this.updateNoteContainer))},_p.prototype.getModuleName=function(){return"spreadsheetNote"},_p.prototype.addNote=function(){var e=W(this.parent.getActiveSheet().activeCell),t=this.parent.getCell(e[0],e[1]);!J.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))},_p.prototype.deleteNote=function(e){var t=this,r=W(this.parent.getActiveSheet().activeCell),n=J.isNullOrUndefined(e)||J.isNullOrUndefined(e.rowIndex)?r[0]:e.rowIndex,i=J.isNullOrUndefined(e)||J.isNullOrUndefined(e.columnIndex)?r[1]:e.columnIndex,o=this.parent.getCell(n,i);0<o.children.length&&-1<o.children[o.children.length-1].className.indexOf("e-addNoteIndicator")&&(o.removeChild(o.children[o.children.length-1]),o.removeEventListener("mouseover",function(){return t.mouseOver(r[0],r[1])}),o.removeEventListener("mouseout",function(){return t.mouseOut()}),o=ki(this.parent,this.parent.activeSheetIndex)+"!"+this.parent.getActiveSheet().activeCell,n=ie(n,i,this.parent.getActiveSheet()),!J.isNullOrUndefined(e)&&e.isDeleteFromMenu&&this.parent.notify(Ia,{args:{action:"beforeCellSave",eventArgs:{address:o}}}),!J.isNullOrUndefined(n)&&n.notes&&delete n.notes,!J.isNullOrUndefined(e))&&e.isDeleteFromMenu&&(i={notes:n.notes,address:o},this.parent.notify(oe,{eventArgs:i,action:"addNote"}),this.isShowNote=null)},_p.prototype.editNote=function(){var e=W(this.parent.getActiveSheet().activeCell),t=(this.showNote({rowIndex:e[0],columnIndex:e[1],isNoteEditable:!0}),document.getElementsByClassName("e-addNoteContainer")[0]);Gn(this.parent,this.parent.getActiveSheet(),{rowIdx:e[0],colIdx:e[1],preventEvt:!0,cell:{isNoteEditable:!0}}),t&&this.getNoteFocus(t)},_p.prototype.createNoteIndicator=function(e){var t=this,r=this.parent.createElement("div",{className:"e-addNoteIndicator",styles:"position: absolute;top: 0;right: 0;width: 0;height: 0;border-left: 8px solid transparent;border-top: 8px solid red;cursor: pointer;"});0<e.targetElement.children.length&&(-1<e.targetElement.children[e.targetElement.childElementCount-1].className.indexOf("e-filter-btn")||-1<e.targetElement.children[e.targetElement.childElementCount-1].className.indexOf("e-validation-list"))&&(-1<e.targetElement.children[e.targetElement.childElementCount-1].className.indexOf("e-filter-btn")?r.style.right=document.getElementsByClassName("e-filter-btn")[0].getBoundingClientRect().width+2+"px":r.style.right=document.getElementsByClassName("e-validation-list")[0].getBoundingClientRect().width+2+"px"),(!J.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.targetElement.addEventListener("mouseover",function(){return t.mouseOver(e.rowIndex,e.columnIndex)}),e.targetElement.addEventListener("mouseout",function(){return t.mouseOut()}),e.targetElement.appendChild(r))},_p.prototype.mouseOver=function(e,t){(this.isNoteVisibleOnTouch&&!J.isNullOrUndefined(document.getElementsByClassName("e-addNoteContainer")[0])||J.isNullOrUndefined(document.getElementsByClassName("e-addNoteContainer")[0]))&&(J.isNullOrUndefined(document.getElementsByClassName("e-addNoteContainer")[0])||this.removeNoteContainer(),this.showNote({rowIndex:e,columnIndex:t,isNoteEditable:!1}),this.isNoteVisible=!0)},_p.prototype.mouseOut=function(){!this.isNoteVisible||this.isNoteVisibleOnTouch||J.isNullOrUndefined(document.getElementsByClassName("e-addNoteContainer")[0])||-1===document.activeElement.className.indexOf("e-addNoteContainer")&&(this.removeNoteContainer(),this.isNoteVisible=!1)},_p.prototype.createNoteContainer=function(e,t,r,n,i){t=ie(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)},_p.prototype.getNoteFocus=function(e){e.selectionStart=e.value.length,e.focus()},_p.prototype.createContainer=function(e,t,r,n){var i=5,o=(r.top>=document.getElementsByClassName("e-select-all-cell")[0].getBoundingClientRect().bottom&&r.right>=document.getElementsByClassName("e-select-all-cell")[0].getBoundingClientRect().right?(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()),s=this.parent.element.style.getPropertyValue("position");e.style.position="absolute",e.style.top=r.top-(o.top-("absolute"===s?0:this.parent.element.offsetTop))-i+"px",e.style.left=r.left+r.width-(o.left-("absolute"===s?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||J.isNullOrUndefined(t)||J.isNullOrUndefined(t.notes)?e.innerHTML="":e.innerHTML=t.notes,this.parent.element.appendChild(e)},_p.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"},_p.prototype.showNote=function(e){var t=this.parent.getCell(e.rowIndex,e.columnIndex),r=document.getElementById(this.parent.element.id+"_contextmenu"),r=J.isNullOrUndefined(r)?"none":r.style.getPropertyValue("display"),r=!!e.isNoteEditable||"block"!==r;!J.isNullOrUndefined(t)&&J.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)},_p.prototype.removeNoteContainer=function(){this.parent.element.removeChild(document.getElementsByClassName("e-addNoteContainer")[0]),this.parent.element.removeChild(document.getElementsByClassName("e-connectorLine")[0]),this.isNoteVisible=!1,this.isNoteVisibleOnTouch=!1},_p.prototype.updateNoteContainer=function(){var e,t=W(this.parent.getActiveSheet().activeCell),r=ie(t[0],t[1],this.parent.getActiveSheet()),n=document.getElementsByClassName("e-addNoteContainer")[0];(J.isNullOrUndefined(r)||J.isNullOrUndefined(r.notes)||r.notes!==n.value)&&-1<document.activeElement.className.indexOf("e-addNoteContainer")&&(this.parent.getCell(t[0],t[1]),e=ki(this.parent,this.parent.activeSheetIndex)+"!"+this.parent.getActiveSheet().activeCell,this.parent.notify(Ia,{args:{action:"beforeCellSave",eventArgs:{address:e}}}),Gn(this.parent,this.parent.getActiveSheet(),{rowIdx:t[0],colIdx:t[1],preventEvt:!0,cell:{notes:n.value,isNoteEditable:!0}}),n={notes:n.value,address:e},this.parent.notify(oe,{eventArgs:n,action:"addNote"}),this.isShowNote=null),this.isShowNote=J.isNullOrUndefined(this.isShowNote)?-1<document.activeElement.className.indexOf("e-addNoteContainer"):this.isShowNote,this.isShowNote?(e=!J.isNullOrUndefined(r)&&!J.isNullOrUndefined(r.isNoteEditable)&&r.isNoteEditable,this.parent.notify(va,""),this.parent.notify(fa,{rowIndex:t[0],columnIndex:t[1],isNoteEditable:!0,isScrollWithNote:e})):(this.parent.notify(va,""),this.isShowNote=null)};var Up=_p;function _p(e){this.isNoteVisible=!1,this.isNoteVisibleOnTouch=!1,this.parent=e,this.addEventListener()}jp.prototype.show=function(e,t){var r=this,n=(t=!!J.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()},J.extend(i,e),t&&(e=this.parent.serviceLocator.getService(A).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.refreshPosition()},jp.prototype.destroyDialog=function(){this.dialogInstance.destroy(),J.remove(this.dialogInstance.element),this.dialogInstance=null},jp.prototype.hide=function(e){this.dialogInstance&&(e&&(this.dialogInstance.animationSettings.effect="None",this.dialogInstance.dataBind()),this.dialogInstance.hide())},jp.prototype.destroy=function(){this.parent=null};var zp=jp;function jp(e){this.parent=e}Wp.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"})}},Wp.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"})}},Wp.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})},Wp.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&&"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(Ia,{args:e}),t&&(e.preventAction=!0),r.isUndo&&(e.isUndo=!0),!1===r.isUndo&&(e.isRedo=!0)},Wp.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(wa,{args:e}),this.parent.notify(Yl,null)},Wp.prototype.addEventListener=function(){this.parent.on(oe,this.actionCompleteHandler,this),this.parent.on(gt,this.actionBeginHandler,this),this.parent.on(cs,this.removeEventListener,this)},Wp.prototype.removeEventListener=function(){this.parent.off(oe,this.actionCompleteHandler),this.parent.off(gt,this.actionBeginHandler),this.parent.off(cs,this.removeEventListener)};var qp=Wp;function Wp(e){this.parent=e,this.addEventListener()}Yp.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])&&(J.removeClass([o],"e-ss-overlay-active"),this.parent.notify(Dl,{})),e.classList.add("e-ss-overlay-active")),Q(t)),t=this.parent.sheets[r],s=this.parent.frozenRowCount(t),a=this.parent.frozenColCount(t),l=Wh(t,o,s,a,this.parent.viewport.beforeFreezeHeight,this.parent.viewport.beforeFreezeWidth,this.parent.sheetModule.colGroupWidth,!0);return o[0]>=s&&o[1]<a&&(n=this.parent.sheetModule.contentPanel).scrollTop&&(l.top-=n.scrollTop,l.top+=this.parent.getColumnHeaderContent().parentElement.getBoundingClientRect().height),o[1]>=a&&o[0]<s&&(n=this.parent.getScrollElement()).scrollLeft&&(l.left-=n.scrollLeft,l.left+=this.parent.sheetModule.getRowHeaderWidth(t)),o[0]<s||o[1]<a?(i=this.parent.element.querySelector("#"+this.parent.element.id+"_sheet"),s&&(o[0]>=s?l.top+=(t.showHeaders?31:0)+vh(t,W(t.topLeftCell)[0],s-1):a||(l.left+=this.parent.sheetModule.getRowHeaderWidth(t,!0))),a&&(o[1]>=a?l.left+=this.parent.sheetModule.getRowHeaderWidth(t):s||(l.left+=t.showHeaders?31:0))):i=this.parent.getMainContent(),e.style.top=Number(Pd(l.top).toFixed(2))+"px",e.style.left=Number(Pd(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}},Yp.prototype.adjustFreezePaneSize=function(e,t,r){var r=Q(r),n=this.parent.getActiveSheet(),i=this.parent.frozenRowCount(n),o=this.parent.frozenColCount(n);r[0]<i||r[1]<o?(J.isNullOrUndefined(e.top)||(t.style.top=e.top+(n.showHeaders?31:0)-this.parent.viewport.beforeFreezeHeight+"px"),J.isNullOrUndefined(e.left)||(t.style.left=e.left+this.parent.sheetModule.getRowHeaderWidth(n,!0)-this.parent.viewport.beforeFreezeWidth+"px")):(J.isNullOrUndefined(e.top)||(t.style.top=e.top-this.parent.viewport.beforeFreezeHeight-(i?vh(n,W(n.topLeftCell)[0],i-1):0)+"px"),J.isNullOrUndefined(e.left)||(t.style.left=e.left-this.parent.viewport.beforeFreezeWidth-(o?Ih(n,W(n.topLeftCell)[1],o-1):0)+"px")),J.isNullOrUndefined(e.top)&&(t=W(n.topLeftCell)[0],e.top=this.parent.viewport.beforeFreezeHeight+(i&&t===r[0]?0:vh(n,i?t:0,r[0]-1))),J.isNullOrUndefined(e.left)&&(i=W(n.topLeftCell)[1],e.left=this.parent.viewport.beforeFreezeWidth+(o&&i===r[1]?0:Ih(n,o?i:0,r[1]-1)))},Yp.prototype.addEventListener=function(e){J.EventHandler.add(e,$h(),this.overlayClickHandler,this),J.EventHandler.add(e,Zh(),this.overlayMouseMoveHandler,this),J.EventHandler.add(this.parent.element.querySelector("#"+this.parent.element.id+"_sheet"),Zh(),this.overlayMouseMoveHandler,this),J.EventHandler.add(document,Jh(),this.overlayMouseUpHandler,this),this.parent.on(Wl,this.setOriginalSize,this)},Yp.prototype.setOriginalSize=function(e){this.originalHeight=e.height,this.originalWidth=e.width},Yp.prototype.overlayMouseMoveHandler=function(e){var t,r,n=e.target,i=document.getElementsByClassName("e-ss-overlay-active")[0],o=this.parent.getActiveSheet(),s=o.frozenRows||o.frozenColumns?[29,this.parent.sheetModule.getRowHeaderWidth(o,!0)]:[-1,-1];if(this.isOverlayClicked&&this.isResizerClicked)switch(ed(e)&&e.preventDefault(),this.resizer){case"e-ss-overlay-t":r=Math.max(this.originalMouseY-ad(e)+this.originalHeight,20),t=ad(e)-(this.originalMouseY-this.originalResizeTop),20<r&&s[0]<t&&(i.style.height=r+"px",i.style.top=t+"px",this.resizedReorderTop=t,this.currenHeight=r,this.parent.notify(Wr,{height:i.style.height,width:i.style.width,overlayEle:i}));break;case"e-ss-overlay-r":20<(t=this.originalWidth+(ld(e)-this.originalMouseX))&&(i.style.width=t+"px",this.currentWidth=t,this.parent.notify(Wr,{height:i.style.height,width:i.style.width,overlayEle:i}));break;case"e-ss-overlay-b":20<(r=this.originalHeight+(hd(e)-this.originalMouseY))&&(i.style.height=r+"px",this.currenHeight=r,this.parent.notify(Wr,{height:i.style.height,width:i.style.width,overlayEle:i}));break;case"e-ss-overlay-l":t=Math.max(this.originalMouseX-sd(e)+this.originalWidth,20),r=sd(e)-(this.originalMouseX-this.originalResizeLeft),20<t&&s[1]<r&&(i.style.width=t+"px",i.style.left=r+"px",this.resizedReorderLeft=r,this.currentWidth=t,this.parent.notify(Wr,{height:i.style.height,width:i.style.width,overlayEle:i}))}else this.isOverlayClicked&&(ed(e)&&e.preventDefault(),J.closest(n,".e-sheet")&&!n.classList.contains("e-sheet-content")||n.classList.contains("e-cell")?i&&(o=sd(e)-this.diffX,n=ad(e)-this.diffY,s[1]<o&&(i.style.left=o+"px"),s[0]<n&&(i.style.top=n+"px"),this.resizedReorderLeft=o<0?0:o,this.resizedReorderTop=n<0?0:n):this.overlayMouseUpHandler(e,!0))},Yp.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=J.closest(e.target,".e-datavisualization-chart")?J.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,s={clientY:i.prevTop,isImage:!0},a={clientX:i.prevLeft,isImage:!0},l=this.parent.element.getElementsByClassName("e-ss-overlay-active")[0];if(e.frozenRows||e.frozenColumns){if(!l)return;a.isImage=s.isImage=!1,a.target=s.target=l,i.prevTop<this.parent.getColumnHeaderContent().getBoundingClientRect().bottom&&(s.target=this.parent.getColumnHeaderContent()),i.prevLeft<this.parent.getRowHeaderContent().getBoundingClientRect().right&&(a.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(Cl,s),this.parent.notify(Cl,t),this.parent.notify(bl,a),this.parent.notify(bl,o),t.size&&(i.currentTop=t.size),o.size&&(i.currentLeft=o.size),i.prevRowIdx=s.clientY,i.prevColIdx=a.clientX,i.currentRowIdx=t.clientY,i.currentColIdx=o.clientX,!e.frozenColumns&&!e.frozenRows||J.closest(l,".e-sheet-content")||(h=this.parent.frozenColCount(e),s=this.parent.frozenRowCount(e),i.currentRowIdx>=s&&i.currentColIdx>=h&&(a=parseInt(l.style.top,10),t=parseInt(l.style.left,10),a=(a+=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=a+"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(Il,i)):this.parent.notify(yl,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(Il,i)):this.parent.notify(yl,i),this.originalHeight=this.currenHeight,this.originalWidth=this.currentWidth)}this.isOverlayClicked=!1}},Yp.prototype.isOverlaySelected=function(e){e.isOverlayClicked=this.isOverlayClicked},Yp.prototype.refreshOverlayElem=function(e){if(e){var t=".e-ss-overlay-active"+(e&&e.selector||""),e=this.parent.element.querySelector(t);e&&(J.removeClass([e],"e-ss-overlay-active"),this.parent.notify(Dl,{}))}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&&(J.removeClass([i],"e-ss-overlay-active"),this.parent.notify(Dl,{}))}this.parent.notify(kl,null)},Yp.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,J.closest(e.target,".e-datavisualization-chart")&&(r=J.closest(e.target,".e-datavisualization-chart"))),((i=this.parent.getActiveSheet()).frozenColumns||i.frozenRows)&&J.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=sd(e),this.originalMouseY=ad(e),this.diffX=this.originalMouseX-this.originalReorderLeft,this.diffY=this.originalMouseY-this.originalReorderTop,(i=document.getElementsByClassName("e-ss-overlay-active")[0])&&J.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(Tl,{id:r.id})),o=r.getBoundingClientRect(),this.prevX=o.left,this.prevY=o.top)},Yp.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"+(J.Browser.isDevice?" e-ss-resizer-touch":""),styles:"width: 8px; height: 8px; border-radius: 4px;"}),e.appendChild(t),n++},Yp.prototype.removeEventListener=function(){var e=this.parent.element.querySelectorAll(".e-ss-overlay");if(e.length)for(var t=0;t<e.length;t++)J.EventHandler.remove(e[t],$h(),this.overlayClickHandler),J.EventHandler.remove(e[t],Zh(),this.overlayMouseMoveHandler);var r=this.parent.element.querySelector("#"+this.parent.element.id+"_sheet");r&&J.EventHandler.remove(r,Zh(),this.overlayMouseMoveHandler),document&&J.EventHandler.remove(document,Jh(),this.overlayMouseUpHandler),this.parent.isDestroyed||(this.parent.off(Wl,this.setOriginalSize),this.parent.off(jl,this.isOverlaySelected),this.parent.off(vl,this.refreshOverlayElem),this.parent.off(cs,this.destroy))},Yp.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 Gp=Yp;function Yp(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(jl,this.isOverlaySelected,this),this.parent.on(vl,this.refreshOverlayElem,this),this.parent.on(cs,this.destroy,this)}Xp=function(e,t){return(Xp=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 Xp,Kp,hh=function(e,t){function r(){this.constructor=e}Xp(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},$p=function(){return($p=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)},Zp=function(e,t,r,n){var i,o=arguments.length,s=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;0<=a;a--)(i=e[a])&&(s=(o<3?i(s):3<o?i(t,r,s):i(t,r))||s);return 3<o&&s&&Object.defineProperty(t,r,s),s},Jp=(Kp=J.ChildProperty,hh(Qp,Kp),Zp([J.Property("")],Qp.prototype,"text",void 0),Zp([J.Property("")],Qp.prototype,"iconCss",void 0),Zp([J.Property("left")],Qp.prototype,"iconPosition",void 0),Qp);function Qp(){return null!==Kp&&Kp.apply(this,arguments)||this}ec=J.ChildProperty,hh(rc,ec),Zp([J.Complex({},Jp)],rc.prototype,"header",void 0),Zp([J.Collection([],F.Item)],rc.prototype,"content",void 0),Zp([J.Property("")],rc.prototype,"cssClass",void 0),Zp([J.Property(!1)],rc.prototype,"disabled",void 0);var ec,tc=rc;function rc(){return null!==ec&&ec.apply(this,arguments)||this}nc=J.Component,hh(oc,nc),oc.prototype.preRender=function(){},oc.prototype.render=function(){this.element.id||(this.element.id=J.getUniqueID("ribbon")),this.renderRibbon()},oc.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"))&&J.getComponent(e,"menu").destroy(),this.toolbarObj&&this.toolbarObj.destroy(),this.tabObj&&this.tabObj.destroy(),this.element.innerHTML="",this.toolbarObj=null,this.tabObj=null,nc.prototype.destroy.call(this)},oc.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},oc.prototype.initMenu=function(t){var r=this,e=this.createElement("ul",{id:this.element.id+"_menu"}),n=(this.element.appendChild(e),new F.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||J.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},oc.prototype.renderRibbon=function(){var r,n=this,e=this.createElement("div"),t=this.createElement("div"),t=(this.toolbarObj=new F.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 F.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.element.classList.contains("e-collapsed")&&J.EventHandler.remove(e.selectedItem,"click",n.ribbonExpandCollapse),t=void 0,n.menuItems.length?(--(t=$p({},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)},oc.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"),J.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"),J.EventHandler.add(t,"click",this.ribbonExpandCollapse,this)),this.trigger("expandCollapse",r)},oc.prototype.getIndex=function(e,t){return this.menuItems.length?t?e-1:e+1:e},oc.prototype.updateToolbar=function(e){this.toolbarObj.items=this.items[e].content,this.toolbarObj.dataBind()},oc.prototype.enableMenuItems=function(e,t,r){void 0===t&&(t=!0),this.menuItems.length&&J.getComponent(document.getElementById(this.element.id+"_menu"),"menu").enableItems(e,t,r)},oc.prototype.hideMenuItems=function(e,t,r){var n;void 0===t&&(t=!0),this.menuItems.length&&(n=J.getComponent(document.getElementById(this.element.id+"_menu"),"menu"),t?n.hideItems(e,r):n.showItems(e,r))},oc.prototype.addMenuItems=function(e,t,r,n){var i;void 0===r&&(r=!0),this.menuItems.length&&(i=J.getComponent(document.getElementById(this.element.id+"_menu"),"menu"),r?i.insertAfter(e.reverse(),t,n):i.insertBefore(e,t,n))},oc.prototype.hideTabs=function(e,t){var r,n,i,o,s=this;if((t=void 0===t?!0:t)||(o=this.isAllHidden()),e.forEach(function(e){-1<(r=s.getTabIndex(e,-1))&&(t?s.items[r].cssClass.includes(" e-hide")||(s.items[r].cssClass=s.items[r].cssClass+" e-hide",s.tabObj.items[s.getIndex(r)].cssClass=s.items[r].cssClass,void 0===n&&r===s.selectedTab&&(n=!0),i=!0):s.items[r].cssClass.includes(" e-hide")&&(s.items[r].cssClass=s.items[r].cssClass.replace(" e-hide",""),s.tabObj.items[s.getIndex(r)].cssClass=s.items[r].cssClass,void 0===n&&r===s.selectedTab&&(n=!0),i=!0))}),this.setProperties({items:this.items},!0),this.tabObj.items=this.tabObj.items,this.tabObj.dataBind(),t&&(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 a=0;a<this.items.length;a++)if(!this.items[a].cssClass.includes(" e-hide")){this.tabObj.selectedItem=this.getIndex(a),this.tabObj.dataBind();break}},oc.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},oc.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)},oc.prototype.addTabs=function(e,t){var r=this,n=this.getTabIndex(t);e.forEach(function(e){e=new tc(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)},oc.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},oc.prototype.addToolbarItems=function(e,t,r){var n=this,i=this.getTabIndex(e);J.isNullOrUndefined(r)&&(r=this.items[i].content.length),t.forEach(function(e){e=new F.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)},oc.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)},oc.prototype.hideToolbarItems=function(e,t,r){var n,i,o=this;void 0===r&&(r=!0);for(var s=0;s<this.items.length;s++)if(this.items[s].header.text===e){n=s,t.forEach(function(e){(i=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)},oc.prototype.getModuleName=function(){return"ribbon"},oc.prototype.getPersistData=function(){return this.addOnPersist([])},oc.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())},Zp([J.Property("")],oc.prototype,"cssClass",void 0),Zp([J.Property(!0)],oc.prototype,"menuType",void 0),Zp([J.Collection([],F.MenuItem)],oc.prototype,"menuItems",void 0),Zp([J.Property(0)],oc.prototype,"selectedTab",void 0),Zp([J.Collection([],tc)],oc.prototype,"items",void 0),Zp([J.Event()],oc.prototype,"selecting",void 0),Zp([J.Event()],oc.prototype,"fileMenuItemSelect",void 0),Zp([J.Event()],oc.prototype,"beforeFileMenuItemRender",void 0),Zp([J.Event()],oc.prototype,"beforeOpen",void 0),Zp([J.Event()],oc.prototype,"beforeClose",void 0),Zp([J.Event()],oc.prototype,"selectFormat",void 0),Zp([J.Event()],oc.prototype,"clicked",void 0),Zp([J.Event()],oc.prototype,"created",void 0),Zp([J.Event()],oc.prototype,"expandCollapse",void 0);var nc,ic=Zp([J.NotifyPropertyChanges],oc);function oc(e,t){return nc.call(this,e)||this}ac.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:Oh,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(It,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",J.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:Th,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(It,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",J.addClass([n.nextElementSibling.getElementsByClassName("e-selected-color")[0]],["e-icons","e-fill-color"])},ac.prototype.updateSelectedColor=function(e,t,r,n){r=this.parent.serviceLocator.getService(A).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},ac.prototype.openHandler=function(e){e.element.querySelector(".e-mode-switch-btn").title=this.parent.serviceLocator.getService(A).getConstant("MoreColors")},ac.prototype.beforeCloseHandler=function(e){e.modeSwitcher||e.setProperties({modeSwitcher:!0},!0),e.showButtons&&e.setProperties({showButtons:!1},!0),ae(e.element.parentElement.querySelector(".e-split-colorpicker"))},ac.prototype.beforeModeSwitch=function(e,t){var r=this.parent.serviceLocator.getService(A);"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"))},ac.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)},ac.prototype.addEventListener=function(){this.parent.on(Js,this.render,this),this.parent.on("destroyRibbonComponents",this.destroy,this),this.parent.on(cs,this.destroy,this)},ac.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(Js,this.render),this.parent.off("destroyRibbonComponents",this.destroy),this.parent.off(cs,this.destroy))};var sc=ac;function ac(e){this.parent=e,this.addEventListener()}p.prototype.getModuleName=function(){return"ribbon"},p.prototype.ribbonOperation=function(e){e&&e.onPropertyChange?this.onPropertyChanged(e.prop):this.initialize()},p.prototype.initialize=function(e){this.parent.notify(Js,{}),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))},p.prototype.getRibbonMenuItems=function(){var e=this.parent.serviceLocator.getService(A),t=this.parent.element.id,r=[{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"}]}]}];return this.parent.allowPrint&&r[0].items.push({text:e.getConstant("Print"),id:t+"_Print",iconCss:"e-print e-icons"}),r},p.prototype.getRibbonItems=function(){var e=this,t=this.parent.element.id,r=this.parent.serviceLocator.getService(A),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(){J.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"}]},{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},p.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(Bs,{type:e.item.id,isAction:!0,isInternal:!0})},click:function(){n.setAttribute("aria-label",t.getConstant("Paste")),r.parent.notify(Bs,{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},p.prototype.getHyperlinkDlg=function(){var e,t=Q(this.parent.getActiveSheet().activeCell),r=this.parent.sheets[this.parent.activeSheetIndex].rows[t[0]];J.isNullOrUndefined(r)||(e=r.cells[t[1]]),J.isNullOrUndefined(e)&&Mi(t[0],t[1],this.parent.getActiveSheet(),e,!1),e&&e.hyperlink?this.parent.notify(ha,null):this.parent.notify(la,null)},p.prototype.passwordProtectDlg=function(){0<this.parent.password.length?this.parent.notify(Hl,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(Bl,null)},p.prototype.getLocaleText=function(e){var t=this.parent.serviceLocator.getService(A),t=this.parent.getActiveSheet()["show"+e]?t.getConstant("Hide"+e):t.getConstant("Show"+e);return t},p.prototype.getLocaleProtectText=function(e,t){var r=this.parent.serviceLocator.getService(A),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},p.prototype.getLocaleProtectWorkbook=function(e,t){var r=this.parent.serviceLocator.getService(A),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},p.prototype.insertDesignChart=function(){var e=this,t=this.parent.serviceLocator.getService(A),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(Ll,{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))},p.prototype.removeDesignChart=function(){var e=this.parent.serviceLocator.getService(A),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)},p.prototype.createRibbon=function(e){var t=this.parent.createElement("div",{id:this.parent.element.id+"_ribbon"});this.ribbon=new ic({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)}),this.ribbon.createElement=this.parent.createElement,e?this.parent.element.insertBefore(t,e):this.parent.element.appendChild(t),this.ribbon.appendTo(t)},p.prototype.tabSelecting=function(e){if(e.selectingIndex!==this.ribbon.selectedTab){var t=this.parent.serviceLocator.getService(A);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(Ts,{activeTab:e.selectingIndex})}},p.prototype.beforeRenderHandler=function(e){var t=this.parent.serviceLocator.getService(A);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")},p.prototype.getChartThemeDDB=function(e){var t,r=this,n=this.parent.serviceLocator.getService(A),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"),s=(o&&((t=o.querySelector(".e-chart"))?i=J.getComponent(t,"chart").theme:(t=o.querySelector(".e-accumulationchart"))&&(i=J.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")||(s.content=e.item.text,s.dataBind(),r.parent.notify(Ll,{chartTheme:e.item.id,triggerEvent:!0}),s.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(A).getConstant("Chart"))}}));return s.createElement=this.parent.createElement,s.appendTo(e),e},p.prototype.getNumFormatDDB=function(e,t){var n=this,r=this.parent.createElement("button",{id:e+"_number_format",attrs:{type:"button"},className:"e-ss-ddb"}),i=this.parent.createElement("span",{className:"e-tbar-btn-text"}),o=(i.innerText=t.getConstant("General"),r.appendChild(i),["General","0","0.00","#,##0","#,##0.00","#,##0_);(#,##0)","#,##0_);[Red](#,##0)","#,##0.00_);(#,##0.00)","#,##0.00_);[Red](#,##0.00)",si.currency[4],si.currency[2],si.currency[3],si.currency[5],"0%","0.00%","0.00E+00","##0.0E+0","# ?/?","# ??/??","dd-MM-yy","dd-MMM-yy","dd-MMM","MMM-yy","h:mm AM/PM","h:mm:ss AM/PM","h:mm","h:mm:ss","dd-MM-yy h:mm","mm:ss","mm:ss.0","@","[h]:mm:ss",si.accounting[1],'_(* #,##0_);_(* (#,##0);_(* "-"_);_(@_)',si.accounting[0],'_(* #,##0.00_);_(* (#,##0.00);_(* "-"??_);_(@_)']);return this.numFormatDDB=new m.DropDownButton({items:this.getNumFormatDdbItems(e),createPopupOnClick:!0,select:function(e){var t,r=n.parent.serviceLocator.getService(A);e.item.text===r.getConstant("Custom")?n.renderCustomFormatDialog(o):(r=e.item.id.split(n.parent.element.id+"_")[1],n.applyNumFormat(xo(r),e.item.text),t=W((e=n.parent.getActiveSheet()).activeCell),n.refreshTextAlign(e,ie(t[0],t[1],e,!1,!0),r,t),n.numFormatDDB.element.setAttribute("aria-label",r))},open:function(e){return n.numDDBOpen(e)},beforeItemRender:function(e){return n.previewNumFormat(e)},cssClass:"e-flat e-numformat-ddb",beforeOpen:function(e){n.tBarDdbBeforeOpen(e.element,e.items,n.parent.serviceLocator.getService(A).getConstant("NumberFormat"))}}),this.numFormatDDB.createElement=this.parent.createElement,this.numFormatDDB.appendTo(r),r},p.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(A).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(It,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},p.prototype.getChartDDB=function(e,t){var r,n,i=this.parent.serviceLocator.getService(A);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},p.prototype.closeDropdownPopup=function(e){(e.altKey&&38===e.keyCode||27===e.keyCode)&&(e=this[1])&&(e.toggle(),ae(e.element))},p.prototype.createChartDdb=function(e,t){var r,n=this,i=this.parent.serviceLocator.getService(A),o=t?"e-chart-menu":"e-chart-type-menu",s=this.parent.createElement("ul",{id:this.parent.element.id+(t?"_chart_menu":"_chart_type_menu")}),a=new m.DropDownButton({iconCss:"e-icons "+(t?"e-chart-icon":"e-chart-type-icon"),cssClass:t?"e-chart-ddb":"e-chart-type-ddb",target:s,createPopupOnClick:!0,beforeOpen:function(e){r=n.createChartMenu(s,o,i,a),n.tBarDdbBeforeOpen(e.element,r.items,n.parent.serviceLocator.getService(A).getConstant("Chart")),J.EventHandler.add(s,"keydown",n.closeDropdownPopup,[n,a])},open:function(){return ae(s)},beforeClose:function(e){e.event&&J.closest(e.event.target,"."+o)?e.cancel=!0:(J.EventHandler.remove(s,"keydown",n.closeDropdownPopup),r.destroy())}});a.createElement=this.parent.createElement,a.appendTo(e)},p.prototype.createChartMenu=function(e,t,r,n){var i=this,t=new F.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),J.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:J.EventHandler.remove(e.element,"keydown",i.menuIconKeyDown)}}),o=this.parent.createElement("div",{id:"column_main",className:"e-column-main"}),s=this.parent.createElement("div",{id:"column1_text",className:"e-column1-text"}),a=(s.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"}),s=(o.appendChild(s),o.appendChild(a),r.getConstant("ClusteredColumn")),h=this.parent.createElement("span",{id:"clusteredColumn",className:"e-clusteredcolumn e-column-icon e-menu-icon e-icons",attrs:{title:s,"aria-label":s,tabindex:"-1"}}),s=r.getConstant("StackedColumn"),d=this.parent.createElement("span",{id:"stackedColumn",className:"e-stackedcolumn e-column-icon e-menu-icon e-icons",attrs:{title:s,"aria-label":s,tabindex:"-1"}}),p=(s=r.getConstant("StackedColumn100"),this.parent.createElement("span",{id:"stackedColumn100",className:"e-stackedcolumn100 e-column-icon e-menu-icon e-icons",attrs:{title:s,"aria-label":s,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=(a.appendChild(h),a.appendChild(d),a.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"})),a=this.parent.createElement("div",{id:"bar2_cont",className:"e-bar2-cont"}),p=(g.appendChild(h),g.appendChild(d),s=r.getConstant("ClusteredBar"),this.parent.createElement("span",{id:"clusteredBar",className:"e-clusteredbar e-bar-icon e-menu-icon e-icons",attrs:{title:s,"aria-label":s,tabindex:"-1"}})),c=(s=r.getConstant("StackedBar"),this.parent.createElement("span",{id:"stackedBar",className:"e-stackedbar e-bar-icon e-menu-icon e-icons",attrs:{title:s,"aria-label":s,tabindex:"-1"}})),u=(s=r.getConstant("StackedBar100"),this.parent.createElement("span",{id:"stackedBar100",className:"e-stackedbar100 e-bar-icon e-menu-icon e-icons",attrs:{title:s,"aria-label":s,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),a.appendChild(l),a.appendChild(f),a.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),s=r.getConstant("Area"),this.parent.createElement("span",{id:"area",className:"e-area e-area-icon e-menu-icon e-icons",attrs:{title:s,"aria-label":s,tabindex:"-1"}})),u=(s=r.getConstant("StackedArea"),this.parent.createElement("span",{id:"stackedArea",className:"e-stackedarea e-area-icon e-menu-icon e-icons",attrs:{title:s,"aria-label":s,tabindex:"-1"}})),l=(s=r.getConstant("StackedArea100"),this.parent.createElement("span",{id:"stackedArea100",className:"e-stackedarea100 e-area-icon e-menu-icon e-icons",attrs:{title:s,"aria-label":s,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"}),a=(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(a),v.appendChild(h),s=r.getConstant("Line"),this.parent.createElement("span",{id:"line",className:"e-line e-line-icon e-menu-icon e-icons",attrs:{title:s,"aria-label":s,tabindex:"-1"}})),d=(s=r.getConstant("StackedLine"),this.parent.createElement("span",{id:"stackedLine",className:"e-stackedline e-line-icon e-menu-icon e-icons",attrs:{title:s,"aria-label":s,tabindex:"-1"}})),u=(s=r.getConstant("StackedLine100"),this.parent.createElement("span",{id:"stackedLine100",className:"e-stackedline100 e-line-icon e-menu-icon e-icons",attrs:{title:s,"aria-label":s,tabindex:"-1"}})),c=(s=r.getConstant("LineMarker"),this.parent.createElement("span",{id:"lineMarker",className:"e-line-marker e-line-icon e-menu-icon e-icons",attrs:{title:s,"aria-label":s,tabindex:"-1"}})),l=(s=r.getConstant("StackedLineMarker"),this.parent.createElement("span",{id:"stackedLineMarker",className:"e-stackedline-marker e-line-icon e-menu-icon e-icons",attrs:{title:s,"aria-label":s,tabindex:"-1"}})),f=(s=r.getConstant("StackedLine100Marker"),this.parent.createElement("span",{id:"stackedLine100Marker",className:"e-stackedline100-marker e-line-icon e-menu-icon e-icons",attrs:{title:s,"aria-label":s,tabindex:"-1"}})),y=(a.appendChild(p),a.appendChild(d),a.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"})),a=(y.appendChild(p),y.appendChild(d),s=r.getConstant("Pie"),this.parent.createElement("span",{id:"pie",className:"e-pie e-pie-icon e-menu-icon e-icons",attrs:{title:s,"aria-label":s,tabindex:"-1"}})),u=(s=r.getConstant("Doughnut"),this.parent.createElement("span",{id:"doughnut",className:"e-doughnut e-pie-icon e-menu-icon e-icons",attrs:{title:s,"aria-label":s,tabindex:"-1"}})),C=(d.appendChild(a),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"}),a=(s=r.getConstant("Scatter"),p.innerText=s,this.parent.createElement("div",{id:"scatter_cont",className:"e-scatter-cont"})),d=(b.appendChild(p),b.appendChild(a),this.parent.createElement("span",{id:"scatter",className:"e-scatter e-scatter-icon e-menu-icon e-icons",attrs:{title:s,"aria-label":s,tabindex:"-1"}}));return a.appendChild(d),t.createElement=this.parent.createElement,t.appendTo(e),e.classList.add("e-ul"),t},p.prototype.getAddChartEleDBB=function(e){var t,r=this,n=this.parent.serviceLocator.getService(A),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 ae(r.parent.element)},beforeOpen:function(e){t=r.createAddChartMenu(i,n),r.tBarDdbBeforeOpen(e.element,t.items),J.EventHandler.add(i,"keydown",r.closeDropdownPopup,[r,r.addChartDdb])},open:function(){return ae(i)},beforeClose:function(e){e.event&&J.closest(e.event.target,".e-addchart-menu")?e.cancel=!0:(J.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},p.prototype.createAddChartMenu=function(e,n){var r=this,t=new F.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"))&&J.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},p.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 ae(r.parent.element)},beforeOpen:function(e){t=r.createCFMenu(n),r.tBarDdbBeforeOpen(e.element,t.items,r.parent.serviceLocator.getService(A).getConstant("ConditionalFormatting")),J.EventHandler.add(n,"keydown",r.closeDropdownPopup,[r,r.cfDdb])},open:function(){return ae(n)},beforeClose:function(e){e.event&&J.closest(e.event.target,".e-cf-menu")?e.cancel=!0:(t.destroy(),J.EventHandler.remove(n,"keydown",r.closeDropdownPopup))}}),this.cfDdb.createElement=this.parent.createElement,this.cfDdb.appendTo(this.parent.createElement("button",{id:e+"_conditionalformatting",attrs:{type:"button"}})),this.cfDdb.element},p.prototype.createCFMenu=function(e){function t(e,t,r){var n;e.forEach(function(e){n=a.getConstant(e+t),r.appendChild(s.parent.createElement("span",{id:e+t,className:"e-"+e.toLowerCase()+" e-cf-icon",attrs:{title:n,"aria-label":n,tabindex:"-1"}}))})}var r,n,i,o,s=this,a=this.parent.serviceLocator.getService(A),l=new F.Menu({cssClass:"e-cf-menu",items:[{iconCss:"e-icons e-hlcellrules",text:a.getConstant("HighlightCellsRules"),items:[{iconCss:"e-icons e-greaterthan",id:"cf_greaterthan_dlg",text:a.getConstant("GreaterThan")+"..."},{iconCss:"e-icons e-lessthan",id:"cf_lessthan_dlg",text:a.getConstant("LessThan")+"..."},{iconCss:"e-icons e-between",id:"cf_between_dlg",text:a.getConstant("Between")+"..."},{iconCss:"e-icons e-equalto",id:"cf_eqaulto_dlg",text:a.getConstant("CFEqualTo")+"..."},{iconCss:"e-icons e-textcontains",id:"cf_textcontains_dlg",text:a.getConstant("TextThatContains")+"..."},{iconCss:"e-icons e-adateoccuring",id:"cf_adateoccuring_dlg",text:a.getConstant("ADateOccuring")+"..."},{iconCss:"e-icons e-duplicate",id:"cf_duplicatevalues_dlg",text:a.getConstant("DuplicateValues")+"..."}]},{iconCss:"e-icons e-topbottomrules",text:a.getConstant("TopBottomRules"),items:[{iconCss:"e-icons e-top10items",id:"cf_top10items_dlg",text:a.getConstant("Top10Items")+"..."},{iconCss:"e-icons e-top10",id:"cf_top10_dlg",text:a.getConstant("Top10")+" %..."},{iconCss:"e-icons e-bottom10items",id:"cf_bottom10items_dlg",text:a.getConstant("Bottom10Items")+"..."},{iconCss:"e-icons e-bottom10",id:"cf_bottom10_dlg",text:a.getConstant("Bottom10")+" %..."},{iconCss:"e-icons e-aboveaverage",id:"cf_aboveaverage_dlg",text:a.getConstant("AboveAverage")+"..."},{iconCss:"e-icons e-belowaverage",id:"cf_belowaverage_dlg",text:a.getConstant("BelowAverage")+"..."}]},{iconCss:"e-icons e-databars",text:a.getConstant("DataBars"),items:[{id:"db_icons1"},{id:"db_icons2"}]},{iconCss:"e-icons e-colorscales",text:a.getConstant("ColorScales"),items:[{id:"cs_icons1"},{id:"cs_icons2"},{id:"cs_icons3"}]},{iconCss:"e-icons e-iconsets",text:a.getConstant("IconSets"),items:[{id:"is_icons"}]},{iconCss:"e-icons e-clearrules",text:a.getConstant("ClearRules"),items:[{id:"cf_cr_cells",text:a.getConstant("SelectedCells")},{id:"cf_cr_sheet",text:a.getConstant("EntireSheet")}]}],orientation:"Vertical",beforeOpen:function(e){"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),J.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),J.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"),e.element.firstChild.appendChild(h),J.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&&J.EventHandler.remove(e.element,"keydown",s.menuIconKeyDown)}}),h=(l.createElement=this.parent.createElement,this.parent.createElement("div",{id:"is",className:"e-is"}));return[{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){r=s.parent.createElement("div",{id:"is"+(t+1),className:"e-is"+(t+1)}),e.hdr?r.innerText=a.getConstant(e.hdr):e.cont.forEach(function(e){for(i=a.getConstant(e.key),n=s.parent.createElement("div",{id:e.id||e.key,className:"e-"+e.cls+" e-is-wrapper",attrs:{title:i,"aria-label":i,tabindex:"-1"}}),o=0;o<e.count;o++)n.appendChild(s.createElement("span","e-"+e.cls+"-"+(o+1)+" e-iconsetspan"));r.appendChild(n)}),h.appendChild(r)}),l.createElement=this.parent.createElement,l.appendTo(e),e.classList.add("e-ul"),l},p.prototype.menuIconKeyDown=function(e,t,r){var n,i,o,s,a=[];r?40!==r.keyCode&&39!==r.keyCode&&38!==r.keyCode&&37!==r.keyCode||(r.preventDefault(),-1===(n=(a=[].slice.call(document.querySelectorAll("."+e))).indexOf(r.target))?n=0:39===r.keyCode?++n===a.length&&(n=0):37===r.keyCode?-1===--n&&(n=a.length-1):e.includes("e-menu-icon")||(i=a.length,s=o=void 0,t||(t=2,s=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:s&&-1<s.indexOf(n)?3:t,o&&i++,i<=n&&(n=n-i+1)):0===n?n=i-1:(n-=o&&-1<o.indexOf(n)?1:s&&-1<s.indexOf(n)?3:t)<0&&(n=o?i:i+n-1))):(n=0,a=[].slice.call(document.querySelectorAll("."+e))),a[n]&&ae(a[n])},p.prototype.createElement=function(e,t){return this.parent.createElement(e,{className:t})},p.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(A).getConstant("Borders"),1),J.EventHandler.add(n,"keydown",r.closeDropdownPopup,[r,r.bordersDdb])},open:function(){return ae(n)},beforeClose:function(e){e.event&&J.closest(e.event.target,".e-borders-menu")?e.cancel=!0:(J.EventHandler.remove(n,"keydown",r.closeDropdownPopup),t.destroy())},close:function(){return ae(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},p.prototype.createBorderMenu=function(e){var r=this,t=this.parent.serviceLocator.getService(A),n=this.parent.element.id,i=new F.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"&&(!J.closest(e.event.target,".e-border-colorpicker")||J.closest(e.event.target,".e-apply")||J.closest(e.event.target,".e-cancel")?(r.colorPicker=J.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"))&&ae(e)},onClose:function(){return ae(i.element)},select:function(e){r.borderSelected(e,i)}});return i.createElement=this.parent.createElement,i.appendTo(e),e.classList.add("e-ul"),i},p.prototype.chartSelected=function(e,t){var r=!J.isNullOrUndefined(J.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(Fl,{action:n,id:t,isChart:r}))},p.prototype.addChartEleSelected=function(e){var t=e.element.id;this.parent.notify(Ll,{addChartEle:t,triggerEvent:!0}),!e.item||e.item.items&&e.item.items.length||this.addChartDdb.toggle()},p.prototype.cfSelected=function(e){var t,r=this.parent.getActiveSheet();e.item.id.includes("_dlg")?this.parent.notify(al,{action:e.item.text}):e.item.id.includes("icons")?(t=e.event.target,this.parent.notify(Pr,{cfModel:{type:t.id||t.parentElement.id,range:r.selectedRange},isAction:!0})):"cf_cr_cells"===e.item.id?this.parent.notify(Br,{range:r.selectedRange,isAction:!0}):"cf_cr_sheet"===e.item.id&&(this.parent.conditionalFormat=null,this.parent.notify(Br,{isAction:!0})),!e.item||e.item.items&&e.item.items.length||this.cfDdb.toggle()},p.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(It,{style:{borderTop:this.border},onActionUpdate:!0});break;case i+"_border_leftborders":this.parent.notify(It,{style:{borderLeft:this.border},onActionUpdate:!0});break;case i+"_border_rightborders":this.parent.notify(It,{style:{borderRight:this.border},onActionUpdate:!0});break;case i+"_border_bottomborders":this.parent.notify(It,{style:{borderBottom:this.border},onActionUpdate:!0});break;case i+"_border_allborders":this.parent.notify(It,{style:{border:this.border},onActionUpdate:!0});break;case i+"_border_horizontalborders":this.parent.notify(It,{style:{border:this.border},onActionUpdate:!0,borderType:"Horizontal"});break;case i+"_border_verticalborders":this.parent.notify(It,{style:{border:this.border},onActionUpdate:!0,borderType:"Vertical"});break;case i+"_border_outsideborders":this.parent.notify(It,{style:{border:this.border},onActionUpdate:!0,borderType:"Outer"});break;case i+"_border_insideborders":this.parent.notify(It,{style:{border:this.border},onActionUpdate:!0,borderType:"Inner"});break;case i+"_border_noborders":this.parent.notify(It,{style:{border:""},onActionUpdate:!0})}this.parent.hideSpinner()}},p.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(It,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(A).getConstant("Font"))}}),this.fontNameDdb.createElement=this.parent.createElement,this.fontNameDdb.appendTo(n),n},p.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},p.prototype.datavalidationDDB=function(e){var t,r=this,n=this.parent.serviceLocator.getService(A);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(Ua,null);break;case n.getConstant("HighlightInvalidData"):r.parent.notify(_a,{isRemoveHighlight:!1});break;case n.getConstant("ClearHighlight"):r.parent.notify(_a,{isRemoveHighlight:!0});break;case n.getConstant("ClearValidation"):r.parent.notify(nl,{isAction:!0});break;default:t=e.item.text===n.getConstant("SortAscending")?"Ascending":"Descending",r.parent.notify(oa,{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},p.prototype.getTextAlignDDB=function(e){var r=this,n=this.parent.serviceLocator.getService(A);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(It,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},p.prototype.getVerticalAlignDDB=function(e){var r=this,n=this.parent.serviceLocator.getService(A);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(It,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},p.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(A));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},p.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)},p.prototype.unMerge=function(e){this.parent.showSpinner();var t=this.parent.getActiveSheet().selectedRange;this.parent.notify(kr,{merge:!1,range:e&&e.range||t,isAction:!0,refreshRibbon:!0,type:"All"}),this.toggleActiveState(!1),this.parent.hideSpinner()},p.prototype.merge=function(e){var t,r=this,n=this.parent.getActiveSheet(),i=Q(n.selectedRange);if(Bd(this.parent,te(i)))this.parent.notify($a,null);else{for(var o,s,a=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]&&a||l===i[0]&&e.includes("merge_vertically")||h===i[1]&&e.includes("_merge_horizontally")||((t=ie(l,h,n)||{}).value||t.formula)&&(o=!0);o?(s=this.parent.serviceLocator.getService(k)).show({height:200,width:400,isModal:!0,showCloseIcon:!0,cssClass:"e-merge-alert-dlg",content:this.parent.serviceLocator.getService(A).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:ae(r.parent.element)},buttons:[{buttonModel:{content:this.parent.serviceLocator.getService(A).getConstant("Ok"),isPrimary:!0},click:function(){s.hide(),r.performMerge(e),a&&r.toggleActiveState(!0)}}]}):(this.performMerge(e),a&&this.toggleActiveState(!0))}},p.prototype.performMerge=function(e){var t=this.parent.element.id;switch(this.parent.showSpinner(),e){case t+"_merge_all":this.parent.notify(kr,{merge:!0,range:this.parent.getActiveSheet().selectedRange,type:"All",isAction:!0,refreshRibbon:!0});break;case t+"_merge_horizontally":this.parent.notify(kr,{merge:!0,range:this.parent.getActiveSheet().selectedRange,type:"Horizontally",isAction:!0});break;case t+"_merge_vertically":this.parent.notify(kr,{merge:!0,range:this.parent.getActiveSheet().selectedRange,type:"Vertically",isAction:!0})}this.parent.hideSpinner()},p.prototype.getSortFilterDDB=function(r){var i,o=this,s=this.parent.serviceLocator.getService(A);return this.sortingDdb=new m.DropDownButton({cssClass:"e-sort-filter-ddb",iconCss:"e-icons e-sort-filter-icon",items:[{text:s.getConstant("SortAscending"),iconCss:"e-icons e-sort-asc"},{text:s.getConstant("SortDescending"),iconCss:"e-icons e-sort-desc"},{text:s.getConstant("CustomSort")+"...",iconCss:"e-icons e-sort-custom"},{separator:!0},{text:s.getConstant("Filter"),iconCss:"e-icons e-filter-apply",id:r+"_applyfilter"},{text:s.getConstant("ClearAllFilter"),iconCss:"e-icons e-filter-clear",id:r+"_clearfilter"},{text:s.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(La,t),o.parent.allowSorting||e.item.text!==s.getConstant("SortAscending")&&e.item.text!==s.getConstant("SortDescending")&&e.item.text!==s.getConstant("CustomSort")+"..."||e.element.classList.add("e-disabled"),o.parent.allowFiltering||e.item.text!==s.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(A).getConstant("SortAndFilter"))},select:function(e){var t=[];if(e.item.text===s.getConstant("SortAscending")||e.item.text===s.getConstant("SortDescending")||e.item.text===s.getConstant("CustomSort")+"..."){var r=Q(o.parent.getActiveSheet().selectedRange),r=Yn(r[0],r[1],o.parent.getActiveSheet());if(Bd(o.parent,r))return void o.parent.notify($a,null)}switch(e.item.text){case s.getConstant("Filter"):o.parent.notify(Na,{});break;case s.getConstant("ClearAllFilter"):o.parent.notify(Da,{isAction:!0});break;case s.getConstant("ReapplyFilter"):o.parent.notify(Oa,null);break;case s.getConstant("CustomSort")+"...":o.parent.notify(ia,null);break;default:if(i=e.item.text===s.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(Fa,{sortOptions:{sortDescriptors:{order:i}}}),o.parent.notify(oa,{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},p.prototype.getFindBtn=function(e){var t=this,e=this.parent.createElement("button",{id:e+"_findbtn",attrs:{type:"button","aria-label":this.parent.serviceLocator.getService(A).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},p.prototype.getClearDDB=function(t){var r=this,e=this.parent.serviceLocator.getService(A);return this.clearDdb=new m.DropDownButton({cssClass:"e-clear-ddb",iconCss:"e-icons e-clear-icon",items:[{text:e.getConstant("ClearAll"),id:t+"_Clear All"},{text:e.getConstant("ClearFormats"),id:t+"_Clear Formats"},{text:e.getConstant("ClearContents"),id:t+"_Clear Contents"},{text:e.getConstant("ClearHyperlinks"),id:t+"_Clear Hyperlinks"}],createPopupOnClick:!0,beforeOpen:function(e){e.element.setAttribute("aria-label",r.parent.serviceLocator.getService(A).getConstant("Clear"))},select:function(e){r.parent.notify(ll,{options:{type:e.item.id.replace(t+"_","")},isAction:!0}),r.clearDdb.element.setAttribute("aria-label",e.item.text)}}),this.clearDdb.createElement=this.parent.createElement,this.clearDdb.appendTo(this.parent.createElement("button",{id:t+"_clear",attrs:{type:"button"},className:"e-ss-ddb"})),this.clearDdb.element},p.prototype.ribbonCreated=function(){var e=this.parent.serviceLocator.getService(A).getConstant("CollapseToolbar");J.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())},p.prototype.alignItemRender=function(e){e.element.title=this.parent.serviceLocator.getService(A).getConstant("Align"+this.getAlignText(e))},p.prototype.getAlignText=function(e){e=e.item.iconCss.split(" e-")[1].split("-icon")[0];return e[0].toUpperCase()+e.slice(1,e.length)},p.prototype.toggleBtnClicked=function(e){var t,r,n,i,o,e=J.closest(e.target,".e-btn"),s=this.parent.element.id,a=e.id,l=It;switch(a){case s+"_bold":r={fontWeight:"normal"},n={fontWeight:"bold"},o="fontWeight";break;case s+"_italic":r={fontStyle:"normal"},n={fontStyle:"italic"},o="fontStyle";break;case s+"_line-through":l=Rt,n=r={textDecoration:"line-through"},o="textDecoration";break;case s+"_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))},p.prototype.getCellStyleValue=function(e,t){var t=ie(t[0],t[1],this.parent.getActiveSheet()),r=this.parent.cellStyle[""+e];return r=t&&t.style&&t.style[""+e]?t.style[""+e]:r},p.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}},p.prototype.expandCollapseHandler=function(e){var t=this.ribbon.element.querySelector(".e-drop-icon"),r=this.parent.serviceLocator.getService(A);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()},p.prototype.getChartThemeDdbItems=function(t){var r=this.parent.serviceLocator.getService(A),n=[];return["Material","Fabric","Bootstrap","HighContrastLight","MaterialDark","FabricDark","HighContrast","BootstrapDark","Bootstrap4","Bootstrap5Dark","Bootstrap5","TailwindDark","Tailwind","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},p.prototype.getNumFormatDdbItems=function(e){var t=this.parent.serviceLocator.getService(A);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")}]},p.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"}]},p.prototype.applyNumFormat=function(e,t){var r=this.parent.getActiveSheet(),e={format:e,range:r.selectedRange,cancel:!1,requestType:"NumberFormat"},r={range:r.name+"!"+e.range,format:e.format,requestType:"NumberFormat"},n=Bd(this.parent,te(Q(e.range)));!n&&(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"}),this.refreshNumFormatSelection(t),n)||this.parent.notify(oe,{eventArgs:r,action:"format"})},p.prototype.renderCustomFormatDialog=function(t){function r(e){-1===t.indexOf(e.format)&&t.push(e.format)}var n=this,i=this.parent.serviceLocator.getService(A),e=this.parent.createElement("div"),o=this.parent.createElement("div",{className:"e-custom-dialog"}),s=this.parent.createElement("button",{className:"e-btn",attrs:{type:"button"}}),a=(s.innerText=i.getConstant("Apply"),this.parent.createElement("div",{className:"e-custom-sample"})),l=(a.innerText=i.getConstant("CustomFormatTypeList")+":",this.parent.createElement("input",{className:"e-input e-dialog-input",attrs:{type:"text",name:"input",placeholder:i.getConstant("CustomFormatPlaceholder"),spellcheck:"false"}})),h=this.parent.createElement("div",{className:"e-custom-listview"}),d=this.parent.serviceLocator.getService(k),p=new f.ListView({dataSource:t,select:function(e){l.value=e.text,e.event&&"keydown"===e.event.type&&e.item&&e.item.focus()}}),a=(o.appendChild(l),o.appendChild(s),o.appendChild(a),o.appendChild(h),p.appendTo(h),this.parent.on(mn,r,this),s.addEventListener("click",function(){var e=l.value;n.applyNumFormat(e,i.getConstant("Custom")),p.destroy(),d.hide(),r({format:e})}),d.show({header:i.getConstant("CustomFormat"),cssClass:"e-custom-format-dlg",height:-1<this.parent.cssClass.indexOf("e-bigger")?502:480,width:440,isModal:!0,showCloseIcon:!0,content:o,footerTemplate:e,beforeOpen:function(){return ae(n.parent.element)}}),this.parent.getActiveSheet()),h=W(a.activeCell),s=ie(h[0],h[1],a);s&&s.format&&p.selectItem(s.format)},p.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)},p.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"},p.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=ie((r=W((n=this.parent.getActiveSheet()).activeCell))[0],r[1],n,!1,!0),J.isNullOrUndefined(r.value)&&""===r.value||(n=xo(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:Td(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))},p.prototype.refreshRibbonContent=function(e){if(this.ribbon){J.isNullOrUndefined(e)&&(e=this.ribbon.selectedTab);var t=this.parent.serviceLocator.getService(A),r=this.parent.getActiveSheet();switch(this.ribbon.items[e].header.text){case t.getConstant("Home"):this.refreshHomeTabContent(W(r.activeCell));break;case t.getConstant("Insert"):case t.getConstant("Formulas"):break;case t.getConstant("Data"):this.refreshDataTabContent(e);break;case t.getConstant("View"):this.refreshViewTabContent(e)}}},p.prototype.refreshHomeTabContent=function(e){J.isNullOrUndefined(document.getElementById(this.parent.element.id+"_number_format"))||(this.numFormatDDB=J.getComponent(document.getElementById(this.parent.element.id+"_number_format"),m.DropDownButton));var t,r=this.parent.getActiveSheet(),n=W(this.parent.getActiveSheet().activeCell),i=this.parent.serviceLocator.getService(A),n=ie(n[0],n[1],this.parent.getActiveSheet())||{},o=So(n.format||"General",!0);this.numFormatDDB&&(r.isProtected&&!r.protectSettings.formatCells?this.refreshNumFormatSelection(o="General"):(n.format&&"General"===o&&"General"!==n.format&&(o="Custom"),this.refreshNumFormatSelection(i.getConstant(o)))),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,n,o,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<n.rowSpan||1<n.colSpan)?(this.enableToolbarItems([{tab:i.getConstant("Home"),items:[this.parent.element.id+"_merge_cells"],enable:!0}]),this.toggleActiveState(!0)):(o=Q(r.selectedRange),this.enableToolbarItems([{tab:i.getConstant("Home"),items:[this.parent.element.id+"_merge_cells"],enable:o[0]!==o[2]||o[1]!==o[3]}]),this.toggleActiveState(!1))},p.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||Y(t.value)&&"Text"!==r)?"right":n).toLowerCase()+"-icon")!==this.textAlignDdb.iconCss&&(this.textAlignDdb.iconCss=e,this.textAlignDdb.dataBind()))},p.prototype.toggleActiveState=function(e){var t=this.parent.serviceLocator.getService(A);this.parent.getActiveSheet().isProtected||(e?(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")))},p.prototype.refreshToggleBtn=function(r){var n,i,o=this,s=this.parent.getActiveSheet(),a=this.parent.element.id,l=ie(r[0],r[1],s),h=["fontWeight","fontStyle","textDecoration","textDecoration"];["bold","italic","line-through","underline","wrap"].forEach(function(e,t){(n=document.getElementById(a+"_"+e))&&(s.isProtected&&!s.protectSettings.formatCells?n.classList.remove("e-active"):i="wrap"===e?l&&l.wrap:-1<o.getCellStyleValue(h[t],r).toLowerCase().indexOf(e),i?n.classList.add("e-active"):n.classList.contains("e-active")&&n.classList.remove("e-active"))})},p.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)},p.prototype.refreshNumFormatSelection=function(e){for(var t=0;t<this.numFormatDDB.items.length;t++)""!==this.numFormatDDB.items[t].iconCss&&(this.numFormatDDB.items[t].iconCss=""),this.numFormatDDB.items[t].text===e&&(this.numFormatDDB.items[t].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)},p.prototype.fileMenuItemSelect=function(e){var t,r=this,n=J.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":J.select("#"+i+"_fileUpload",this.parent.element).click(),ae(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(k)).show({height:200,width:400,isModal:!0,showCloseIcon:!0,content:this.parent.serviceLocator.getService(A).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:ae(r.parent.element)},buttons:[{buttonModel:{content:this.parent.serviceLocator.getService(A).getConstant("Ok"),isPrimary:!0},click:function(){t.hide(),r.parent.refresh(!0)}}]})}},p.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(oe,{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(oe,{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(oh,{});break;case n+"_undo":this.parent.notify(Sa,{isUndo:!0});break;case n+"_redo":this.parent.notify(Sa,{isUndo:!1});break;case n+"_freezepanes":t=W(i.topLeftCell),r=i.frozenRows||i.frozenColumns?t:W(i.activeCell),this.parent.notify(ql,{row:r[0]-t[0],column:r[1]-t[1],triggerEvent:!0});break;case n+"_freezerows":this.parent.notify(ql,{row:i.frozenRows?0:W(i.activeCell)[0]-W(i.topLeftCell)[0],column:i.frozenColumns,triggerEvent:!0});break;case n+"_freezecolumns":this.parent.notify(ql,{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(Hl,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(oe,{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(Bl,null)}this.parent.notify(Fs,e)}},p.prototype.toggleRibbonItems=function(e){var t="",r=this.parent.serviceLocator.getService(A).getConstant("View"),n=this.parent.serviceLocator.getService(A).getConstant("Data");if(this.ribbon.items[this.ribbon.selectedTab].header.text===r){if(J.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 s=this.getLocaleText(e.props),a=("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===a&&(this.ribbon.items[e.activeTab].content[i].text=s,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(),s)}if(this.ribbon.items[this.ribbon.selectedTab].header.text===n){if(J.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((a=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(a===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===a&&(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)}},p.prototype.enableFileMenuItems=function(e){this.ribbon.enableMenuItems(e.items,e.enable,e.isUniqueId)},p.prototype.hideRibbonTabs=function(e){this.ribbon.hideTabs(e.tabs,e.hide)},p.prototype.addRibbonTabs=function(e){this.ribbon.addTabs(e.items,e.insertBefore),J.select(".e-ribbon .e-tab-header .e-toolbar-item:not(.e-menu-tab).e-hide",this.parent.element)&&this.parent.updateActiveBorder(J.selectAll(".e-ribbon .e-tab-header .e-toolbar-item:not(.e-menu-tab)",this.parent.element)[this.ribbon.selectedTab])},p.prototype.updateToggleText=function(e,t){var r=J.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),Ph(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})},p.prototype.refreshViewTabContent=function(e){for(var t,r=this.parent.element.id,n=this.parent.getActiveSheet(),i=this.parent.serviceLocator.getService(A),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)))},p.prototype.updateViewTabContent=function(e,t,r){var n=this.parent.getActiveSheet(),i=this.parent.serviceLocator.getService(A);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))},p.prototype.updateRibbonItemText=function(e,t,r,n){e=this.parent.serviceLocator.getService(A).getConstant(e+t);return this.ribbon.items[n].content[r].text=e,this.ribbon.setProperties({items:this.ribbon.items},!0),e},p.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)}},p.prototype.updateDataTabContent=function(e,t,r){var n=this.parent.getActiveSheet(),i=this.parent.serviceLocator.getService(A);"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(A),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)))},p.prototype.updateProtectBtn=function(e,t,r,n){e=this.parent.serviceLocator.getService(A).getConstant(e+t);this.ribbon.items[n].content[r].text=e,this.ribbon.setProperties({items:this.ribbon.items},!0),this.updateToggleText("protect",e)},p.prototype.updateProtectWorkbookBtn=function(e,t,r,n){e=this.parent.serviceLocator.getService(A).getConstant(e);this.ribbon.items[n].content[r].text=e,this.ribbon.setProperties({items:this.ribbon.items},!0),this.updateToggleText("protectworkbook",e)},p.prototype.addToolbarItems=function(e){var t=this.parent.serviceLocator.getService(A);this.ribbon.addToolbarItems(t.getConstant(e.tab),e.items,e.index)},p.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)})},p.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 F.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 F.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()},p.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 ae(t.parent.element)}})),i=(o.createElement=this.parent.createElement,o.appendTo(n),new F.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=""},p.prototype.fileMenuBeforeOpen=function(e){var n,i=this,t=this.parent.serviceLocator.getService(A),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",this.parent.serviceLocator.getService(A).getConstant("File"))},p.prototype.enableRibbonTabs=function(e){this.ribbon.enableTabs(e.tabs,e.enable)},p.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"&&Ph(function(){var e=t.ribbon.element.querySelector(".e-tab-header .e-toolbar-item .e-tab-wrap");e&&(ae(e),e=e.querySelector(".e-menu-item.e-focused"))&&e.classList.remove("e-focused")})},p.prototype.hideFileMenuItems=function(e){this.ribbon.hideMenuItems(e.items,e.hide,e.isUniqueId)},p.prototype.addFileMenuItems=function(e){this.ribbon.addMenuItems(e.items,e.text,e.insertAfter,e.isUniqueId)},p.prototype.hideToolbarItems=function(e){this.ribbon.hideToolbarItems(e.tab,e.indexes,e.hide)},p.prototype.protectSheetHandler=function(e){for(var t=this.parent.getActiveSheet(),r=this.parent.serviceLocator.getService(A),n=(t.isProtected&&t.protectSettings.formatCells||!t.isProtected?(this.parent.allowCellFormatting?this.enableToolbarItems([{tab:r.getConstant("Home"),items:e.enableHomeBtnId,enable:!0}]):this.enableToolbarItems([{tab:r.getConstant("Home"),items:e.enableHomeBtnId.slice(2,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(Za,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}]))},p.prototype.updateMergeItem=function(e){"mousemove"!==e.type&&"pointermove"!==e.type&&"touchmove"!==e.type&&(!e.shiftKey||"mousedown"!==e.type&&"touchend"!==e.type)||(e=Q(this.parent.getActiveSheet().selectedRange))[1]===e[3]&&e[0]===e[2]||this.parent.getActiveSheet().isProtected||!this.parent.allowMerge||(this.enableToolbarItems([{tab:this.parent.serviceLocator.getService(A).getConstant("Home"),items:[this.parent.element.id+"_merge_cells"],enable:!0}]),this.toggleActiveState(!1))},p.prototype.onPropertyChanged=function(e){var t=this.parent.serviceLocator.getService(A),r=this.parent.element.id;switch(e){case"allowFreezePane":this.ribbon.enableItems(t.getConstant("View"),[r+"_freezepanes",r+"_freezerows",r+"_freezecolumns"],this.parent.allowFreezePane);break;case"showRibbon":this.parent.showRibbon?this.initialize(!0):this.ribbon&&this.destroy();break;case"allowImage":this.ribbon.enableItems(t.getConstant("Insert"),[r+"_image"],this.parent.allowImage);break;case"allowChart":this.ribbon.enableItems(t.getConstant("Insert"),[r+"_chart"],this.parent.allowChart),this.parent.allowChart||this.removeDesignChart()}},p.prototype.addEventListener=function(){this.parent.on(os,this.ribbonOperation,this),this.parent.on(Os,this.enableToolbarItems,this),this.parent.on(Lt,this.refreshRibbonContent,this),this.parent.on(aa,this.toggleRibbonItems,this),this.parent.on(qs,this.enableFileMenuItems,this),this.parent.on(Ys,this.hideRibbonTabs,this),this.parent.on(Ks,this.addRibbonTabs,this),this.parent.on($s,this.addToolbarItems,this),this.parent.on(Ws,this.hideFileMenuItems,this),this.parent.on(Gs,this.addFileMenuItems,this),this.parent.on(Zs,this.hideToolbarItems,this),this.parent.on(Xs,this.enableRibbonTabs,this),this.parent.on(qa,this.protectSheetHandler,this),this.parent.on(dn,this.updateMergeItem,this),this.parent.on(jr,this.refreshRibbonContent,this),this.parent.on(Tl,this.insertDesignChart,this),this.parent.on(Dl,this.removeDesignChart,this),this.parent.on(gn,this.unMerge,this)},p.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(A),s=J.getComponent(t.querySelector(".e-tab"),"tab");s&&(e=s.selectedItem),this.switchRibbonTab(o.getConstant("Home")),["bold","italic","line-through","underline"].forEach(function(e){ud(J.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=null,this.detachPopupElement(i),this.parent.notify("destroyRibbonComponents",null),e&&(s.selectedItem=e,s.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.ribbon&&this.ribbon.destroy(),r&&J.detach(r),this.ribbon=null,n&&J.detach(n),this.cPickerEle=null,this.datavalidationDdb&&this.datavalidationDdb.destroy(),this.datavalidationDdb=null,this.border&&(this.border=""),this.fontNameIndex&&(this.fontNameIndex=null),this.preTabIdx&&(this.preTabIdx=null),this.numPopupWidth&&(this.numPopupWidth=null),this.removeEventListener(),this.parent=null},p.prototype.destroyComponent=function(e,t){var r,e="string"==typeof e?document.getElementById(e):e;e&&(("menu"!==t||e.childElementCount)&&(r=J.getComponent(e,t))&&(r.destroy(),"dropdown-btn"===t)&&(r=document.getElementById(e.id+"-popup"))&&J.detach(r),"menu"===t)&&J.detach(e)},p.prototype.detachPopupElement=function(t){["_conditionalformatting","_chart-type-btn","_chart-btn","_borders"].forEach(function(e){e=document.getElementById(""+t+e+"-popup");e&&J.detach(e)})},p.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=J.getComponent(this.parent.element.querySelector(".e-tab"),"tab");o&&!J.isNullOrUndefined(t)&&(o.selectedItem=o.getItemIndex(t),o.dataBind())},p.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(os,this.ribbonOperation),this.parent.off(Os,this.enableToolbarItems),this.parent.off(Lt,this.refreshRibbonContent),this.parent.off(aa,this.toggleRibbonItems),this.parent.off(qs,this.enableFileMenuItems),this.parent.off(Ys,this.hideRibbonTabs),this.parent.off(Ks,this.addRibbonTabs),this.parent.off($s,this.addToolbarItems),this.parent.off(Ws,this.hideFileMenuItems),this.parent.off(Gs,this.addFileMenuItems),this.parent.off(Zs,this.hideToolbarItems),this.parent.off(Xs,this.enableRibbonTabs),this.parent.off(qa,this.protectSheetHandler),this.parent.off(dn,this.updateMergeItem),this.parent.off(jr,this.refreshRibbonContent),this.parent.off(Tl,this.insertDesignChart),this.parent.off(Dl,this.removeDesignChart),this.parent.off(gn,this.unMerge),this.parent.off(mn))};var lc=p;function p(e){this.border="1px solid #000000",this.fontNameIndex=5,this.numPopupWidth=0,this.preTabIdx=1,this.parent=e,this.addEventListener(),new sc(e)}dc.prototype.getModuleName=function(){return"formulaBar"},dc.prototype.createFormulaBar=function(e){var t,r,n,i,o=this;!this.parent.showFormulaBar&&this.insertFnRipple?this.destroy():(t=this.parent.serviceLocator.getService(A),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:J.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=J.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"),J.EventHandler.add(i,"focus",this.textAreaFocusIn,this),J.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))},dc.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)},dc.prototype.textAreaFocusOut=function(){var e=this.parent.element.querySelector(".e-formula-bar-panel");e.classList.remove("e-focused"),J.detach(e.querySelector(".e-formula-submit"))},dc.prototype.keyDownHandler=function(e){var t=e.target;!this.parent.isEdit||this.parent.getActiveSheet().isProtected&&(!t.classList.contains("e-formula-bar")||t.disabled)||(X(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||od(e.keyCode))||this.parent.notify(us,{action:"refreshEditor",value:t.value,refreshEditorElem:!0})},dc.prototype.keyUpHandler=function(e){var t,r;this.parent.isEdit&&(t=e.target).classList.contains("e-formula-bar")&&(this.parent.notify(us,r={action:"getCurrentEditValue",editedValue:""}),r.editedValue===t.value||16===e.keyCode||17===e.keyCode||e.shiftKey&&(!e.shiftKey||od(e.keyCode))||this.parent.notify(us,{action:"refreshEditor",value:t.value,refreshEditorElem:!0}))},dc.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))},dc.prototype.nameBoxBlur=function(){this.comboBoxInstance.element.classList.contains("e-name-editing")&&(this.comboBoxInstance.element.classList.remove("e-name-editing"),this.UpdateValueAfterMouseUp())},dc.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,xi(e))))&&(e=C(e),r=ne(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),ae(this.parent.element)):(wi(this.parent,e,r),this.parent.activeSheetIndex=t))},dc.prototype.formulaBarUpdateHandler=function(a){var e,t,l=this,r=this.parent.getActiveSheet().selectedRange.split(":"),h={action:"getElement",element:null},d=(this.parent.notify(us,h),this.parent.element.querySelector(".e-formula-bar"));"mousemove"===a.type||"pointermove"===a.type?(e=Q(r[0]),t=Q(r[1]),e=Math.abs(e[0]-t[0])+1+"R x "+(Math.abs(e[1]-t[1])+1)+"C",this.parent.isEdit&&(a.target&&!a.target.classList.contains("e-spreadsheet-edit")?this.parent.notify(cl,{}):h.element&&(d.value=h.element.textContent))):(e=r[0],t=ki(this.parent)+"!"+e,ai(this.parent,t,!1,!0).then(function(e){var o,s;l.parent&&(o="",e.forEach(function(e){e&&(e.formula?o=e.formula:J.isNullOrUndefined(e.value)||""===e.value?e.hyperlink&&(o="string"==typeof e.hyperlink?e.hyperlink:e.hyperlink.address||""):(r={},"date"===(r=e.format&&_i(e.format,!0,r,!0)&&r.type)||"time"===r||"datetime"===r?(s=In(Number(e.value)))&&"Invalid Date"!==s.toString()&&1900<=s.getFullYear()&&(n=new J.Internationalization,i=e.format.toLowerCase(),"time"!==r||!i.includes("m")||i.includes(":m")||i.includes("m:")||i.includes("[m")||i.includes("am")||(r="date"),i=(t=2===(i=e.value.toString().split(".")).length)?In(parseFloat(i[0]+1+"."+i[1])||Number(e.value)):s,"date"===r?(o=n.formatDate(s,{type:"date",skeleton:"yMd"}),t&&(o+=" "+n.formatDate(i,{type:"dateTime",skeleton:"hms"}))):((1<=Number(e.value)||"datetime"===r)&&(o=n.formatDate(s,{type:"dateTime",skeleton:"yMd"})+" "),o+=n.formatDate(i,{type:"dateTime",skeleton:"hms"}))):e.format&&e.format.includes("%")&&Y(e.value)&&((o=l.parent.getDisplayText(e)).includes("%")||(o="")),o||("true"===(o=e.value.toString()).toLowerCase()||"false"===o.toLowerCase()?o=o.toUpperCase():"en-US"!==l.parent.locale&&"."!==(t=J.getNumericObject(l.parent.locale).decimal)&&Y(o)&&o.includes(".")&&(o=o.replace(".",t)))));var t,r={action:"getCurrentEditValue",editedValue:""},n=(l.parent.notify(us,r),document.getElementById(l.parent.element.id+"_formula_input")),i=n.value;n.value=o,r.editedValue&&X(r.editedValue.toString(),!0)||l.parent.notify(us,{action:"refreshEditor",value:o,refreshEditorElem:!0}),l.parent.isEdit&&(a.target&&!a.target.classList.contains("e-spreadsheet-edit")?l.parent.notify(cl,{isMouseDown:rd(a),formulaBarVal:i}):h.element&&(d.value=h.element.textContent))}))})),this.updateComboBoxValue(e)},dc.prototype.UpdateValueAfterMouseUp=function(){this.updateComboBoxValue(this.parent.getActiveSheet().selectedRange.split(":")[0])},dc.prototype.updateComboBoxValue=function(e){var t=this.parent.getActiveSheet(),t={action:"getNameFromRange",range:ki(this.parent)+"!"+t.selectedRange,definedName:null};this.parent.notify(fs,t),t.definedName&&(e=t.definedName.name),this.parent.isMobileView()||this.comboBoxInstance.text!==e&&(this.comboBoxInstance.text=e,this.comboBoxInstance.dataBind())},dc.prototype.disabletextarea=function(){var e=this.getFormulaBar();this.parent.getActiveSheet().isProtected&&!this.parent.isEdit?e.disabled=!0:e.disabled=!1},dc.prototype.formulaBarScrollEdit=function(){var e=Q(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(us,{action:"startEdit",refreshCurPos:!1})},dc.prototype.formulaBarClickHandler=function(e){var t,e=e.target,r=this.parent.getActiveSheet(),n=r.isProtected,i=W(r.activeCell),o=ie(i[0],i[1],r),s=Vn(o,se(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(ni(o,se(r,i[1]),ch(r,i[0])))return void this.parent.notify($a,null);!this.parent.isEdit&&(!n||!s)||this.parent.isEdit&&n&&!e.disabled?this.formulaBarScrollEdit():n&&s&&this.parent.notify(Ka,null)}else e.parentElement&&e.parentElement.classList.contains("e-name-box")&&(e.classList.contains("e-ddl-icon")?(this.parent.notify(fs,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()));!J.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()},dc.prototype.renderInsertDlg=function(){var e,t,r,n,i,o,s,a=this,l=this.parent.getActiveSheet(),h=W(l.activeCell);l.isProtected&&Vn(ie(h[0],h[1],l),se(l,h[1]))&&!this.parent.isEdit?this.parent.notify(Ka,null):ni(ie(h[0],h[1],l),se(l,h[1]),ch(l,h[0]))?this.parent.notify($a,null):(l=this.parent.serviceLocator.getService(A),h={action:"getCurrentEditValue",editedValue:""},(t=!this.parent.isEdit)||(this.parent.notify(fs,e={action:"isFormulaEditing",isFormulaEdit:!1}),t=e.isFormulaEdit,this.parent.notify(us,h)),!t&&""!==h.editedValue||(""===h.editedValue&&this.parent.notify(us,{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(re,s={action:"getFormulaCategory",categoryCollection:[]}),this.categoryCollection=s.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(re,s={action:"getLibraryFormulas",formulaCollection:[]}),this.formulaCollection=s.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(k),this.parent.element.querySelector(".e-spreadsheet-function-dlg"))||(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};a.parent.trigger("dialogBeforeOpen",t),t.cancel&&(e.cancel=!0),ae(a.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||a.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"),J.EventHandler.add(this.formulaList.element,"dblclick",this.formulaClickHandler,this)))},dc.prototype.toggleFormulaBar=function(e){var t=e.parentElement,r=this.parent.serviceLocator.getService(A);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()},dc.prototype.dialogOpen=function(){var r=this;Ph(function(){var e=r.dialog.dialogInstance.element.querySelector(".e-footer-content .e-primary"),t=r.parent.serviceLocator.getService(A);e.setAttribute("aria-label",t.getConstant("InsertFunction")+" "+t.getConstant("Ok")),r.categoryList&&ae(r.categoryList.element)})},dc.prototype.dialogClose=function(){var e={action:"getCurrentEditValue",editedValue:""};this.parent.notify(us,e),"="===e.editedValue.toString().trim()&&this.parent.notify(us,{action:"refreshEditor",value:""})},dc.prototype.dialogBeforeClose=function(){J.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},dc.prototype.selectFormula=function(){var e=this.formulaList.getSelectedItems().text,t=ne(this.parent,this.parent.activeSheetIndex);this.parent.isEdit?this.parent.notify(us,{action:"refreshEditor",value:e+"(",refreshFormulaBar:!0,refreshEditorElem:!0,isAppend:!0}):(this.parent.notify(us,{action:"startEdit",value:"="+e+"(",address:t.activeCell}),this.parent.notify(gs,{action:"refreshFormulabar",value:"="+e+"("})),this.dialog.dialogInstance.storeActiveElement=document.getElementById(this.parent.element.id+"_edit"),this.dialog.hide()},dc.prototype.listSelected=function(e){this.updateFormulaDescription(),e.isInteracted&&e.item&&e.item.focus()},dc.prototype.updateFormulaList=function(){this.activeListFormula(),this.updateFormulaDescription()},dc.prototype.dropDownSelect=function(e){this.formulaCollection=[];var t={action:"getLibraryFormulas",formulaCollection:[]};"All"===e.item.textContent?(this.parent.notify(re,t),this.formulaCollection=t.formulaCollection):(t={action:"dropDownSelectFormulas",formulaCollection:[],selectCategory:e.item.textContent},this.parent.notify(re,t),this.formulaCollection=t.formulaCollection),this.formulaList.dataSource=this.formulaCollection.sort()},dc.prototype.activeListFormula=function(){var e=document.getElementById(this.parent.element.id+"_formula_list").children[0].children[0].firstElementChild;this.formulaList.selectItem(e)},dc.prototype.updateFormulaDescription=function(){var e={action:"getFormulaDescription",description:"",selectedList:r=this.formulaList.getSelectedItems().text,isCustom:!1},t=(this.parent.notify(re,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(A).getConstant(r)},dc.prototype.formulaClickHandler=function(e){var e=e.target,t=ne(this.parent,this.parent.activeSheetIndex);(e.offsetParent.classList.contains("e-text-content")||e.classList.contains("e-list-item"))&&(this.parent.isEdit?this.parent.notify(us,{action:"refreshEditor",value:e.innerText+"(",refreshFormulaBar:!0,refreshEditorElem:!0,isAppend:!0}):(this.parent.notify(us,{action:"startEdit",value:"="+e.innerText+"(",address:t.activeCell}),this.parent.notify(gs,{action:"refreshFormulabar",value:"="+e.innerText+"("})),this.dialog.hide())},dc.prototype.addEventListener=function(){this.parent.on(ss,this.createFormulaBar,this),this.parent.on(ms,this.formulaBarClickHandler,this),this.parent.on(ys,this.keyDownHandler,this),this.parent.on(ih,this.renderInsertDlg,this),this.parent.on(vs,this.keyUpHandler,this),this.parent.on(dn,this.formulaBarUpdateHandler,this),this.parent.on(Es,this.UpdateValueAfterMouseUp,this),this.parent.on(gs,this.editOperationHandler,this),this.parent.on(Ja,this.disabletextarea,this),this.parent.on(hs,this.isFormulaBarEdit,this)},dc.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&&(Mh(e),J.detach(e)),this.parent=null},dc.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(ss,this.createFormulaBar),this.parent.off(ms,this.formulaBarClickHandler),this.parent.off(ih,this.renderInsertDlg),this.parent.off(ys,this.keyDownHandler),this.parent.off(vs,this.keyUpHandler),this.parent.off(dn,this.formulaBarUpdateHandler),this.parent.off(Es,this.UpdateValueAfterMouseUp),this.parent.off(gs,this.editOperationHandler),this.parent.off(Ja,this.disabletextarea),this.parent.off(hs,this.isFormulaBarEdit))},dc.prototype.editOperationHandler=function(e){switch(e.action){case"refreshFormulabar":this.getFormulaBar().value=J.isUndefined(e.value)?"":e.value;break;case"getElement":e.element=this.getFormulaBar()}},dc.prototype.isFormulaBarEdit=function(e){this.parent.isEdit&&this.isGoto?e.isEdit=!0:e.isEdit=!1},dc.prototype.getFormulaBar=function(){return J.select("#"+this.parent.element.id+"_formula_input",this.parent.element)};var hc=dc;function dc(e){this.categoryCollection=[],this.formulaCollection=[],this.isGoto=!1,this.parent=e,this.addEventListener()}cc.prototype.getModuleName=function(){return"formula"},cc.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},cc.prototype.addEventListener=function(){this.parent.on(fs,this.performFormulaOperation,this),this.parent.on(vs,this.keyUpHandler,this),this.parent.on(ys,this.keyDownHandler,this),this.parent.on(ms,this.formulaClick,this),this.parent.on(Ha,this.refreshFormulaDatasource,this)},cc.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(fs,this.performFormulaOperation),this.parent.off(vs,this.keyUpHandler),this.parent.off(ys,this.keyDownHandler),this.parent.off(ms,this.formulaClick),this.parent.off(Ha,this.refreshFormulaDatasource))},cc.prototype.performFormulaOperation=function(e){var t,r,n=this,i=e.action,o=this.parent.serviceLocator.getService(A);switch(i){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=ki(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":t=this.parent.serviceLocator.getService(k),r=o.getConstant("CircularReference"),t.dialogInstance&&t.dialogInstance.visible&&t.dialogInstance.content===r||t.show({height:180,width:400,isModal:!0,showCloseIcon:!0,content:o.getConstant("CircularReference"),beforeOpen:function(e){var t={dialogName:"CircularReferenceDialog",element:e.element,target:e.target,cancel:e.cancel};n.parent.trigger("dialogBeforeOpen",t),t.cancel&&(e.cancel=!0)}}),e.argValue="0"}},cc.prototype.renderAutoComplete=function(){var e,t;J.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(re,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)},cc.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(Dh.DOWN)})},cc.prototype.onSuggestionClose=function(e){this.isPreventClose?e.cancel=!0:this.isPopupOpened=!1},cc.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(us,{action:"refreshEditor",value:n,refreshFormulaBar:!0,refreshEditorElem:!0,refreshCurPos:!this.isFormulaBar}),this.isPopupOpened&&(this.hidePopUp(),(r=J.select("#"+this.parent.element.id+"_ac_popup"))&&J.detach(r),this.isPopupOpened=!1)},cc.prototype.onSuggestionComplete=function(e){this.isPreventClose=0<e.result.length,this.isPreventClose||(e.cancel=!0,this.hidePopUp())},cc.prototype.refreshFormulaDatasource=function(){var e={action:"getLibraryFormulas",formulaCollection:[]};this.parent.notify(re,e),this.autocompleteInstance&&(this.autocompleteInstance.dataSource=e.formulaCollection)},cc.prototype.keyUpHandler=function(e){var t;this.parent.isEdit?(t=this.getEditingValue(),this.isFormula=X(t),(this.isFormula||this.isPopupOpened)&&(e.keyCode!==Dh.TAB&&this.isFormula&&(t=this.getSuggestionKeyFromFormula(t)),this.refreshFormulaSuggestion(e,t))):this.isPopupOpened&&this.hidePopUp()},cc.prototype.keyDownHandler=function(e){var t=e.keyCode;if(this.isFormula){if(this.isPopupOpened)switch(t){case Dh.UP:case Dh.DOWN:e.preventDefault(),this.triggerKeyDownEvent(t);break;case Dh.TAB:e.preventDefault(),this.triggerKeyDownEvent(Dh.ENTER)}}else{var r=e.target;if(r.id===this.parent.element.id+"_name_box")switch(t){case Dh.ENTER:document.querySelector(".e-name-box.e-popup-open")||(this.addDefinedName({name:r.value}),ae(this.parent.element));break;case Dh.ESC:ae(this.parent.element)}}},cc.prototype.formulaClick=function(e){this.parent.isEdit&&(e=e.target,this.isFormulaBar=e.classList.contains("e-formula-bar"))},cc.prototype.refreshFormulaSuggestion=function(e,t){var r,n;0<t.length?(r=this.autocompleteInstance.element,e=e.keyCode,n=this.isPopupOpened,od(e)||(r.value=t,r.dispatchEvent(new Event("input")),r.dispatchEvent(new Event("keyup")),n&&this.triggerKeyDownEvent(Dh.DOWN))):this.isPopupOpened&&(this.isPreventClose=!1,this.hidePopUp())},cc.prototype.endEdit=function(){var e;this.isSubFormula=!1,this.isPreventClose=!1,this.isFormula=!1,this.isFormulaBar=!1,this.isPopupOpened&&(this.hidePopUp(),(e=J.select("#"+this.parent.element.id+"_ac_popup"))&&J.detach(e),this.isPopupOpened=!1)},cc.prototype.hidePopUp=function(){this.autocompleteInstance.hidePopup()},cc.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},cc.prototype.getRelateToElem=function(){var e={action:"getElement"};return this.isFormulaBar?this.parent.notify(gs,e):this.parent.notify(us,e),e.element},cc.prototype.getEditingValue=function(){var e={action:"getCurrentEditValue",editedValue:""};return this.parent.notify(us,e),e.editedValue},cc.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)},cc.prototype.getNames=function(t){return this.parent.definedNames.filter(function(e){return"Workbook"===e.scope||""===e.scope||e.scope===t})},cc.prototype.getNameFromRange=function(t){var r=t.slice(0,t.indexOf(":")),e=t.slice(t.indexOf("!")+1).split(":"),n=1<e.length&&e[0]===e[1],e=this.parent.definedNames.filter(function(e){e=e.refersTo.split("!"),e[0].includes("'")&&e[0].match(/^='.*'$/)&&(e[0]="="+e[0].slice(2,-1)),e=e[0]+"!"+e[1].split("$").join("");return n&&e=="="+r||e=="="+t});return e&&e[0]},cc.prototype.addDefinedName=function(e){var t,r,n,i,o,s=this,a=e.name,l=!1;return a&&On(a.toUpperCase())?this.parent.goTo(a):(e.refersTo||(o=ne(this.parent,this.parent.activeSheetIndex),t=-1!==(t=ki(this.parent)).indexOf(" ")?"'"+t+"'":t,i=o.selectedRange,J.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<a.length&&/^([a-zA-Z_0-9.]){0,255}$/.test(a)?(this.parent.notify(re,o={action:"addDefinedName",definedName:e,isAdded:!1}),(l=o.isAdded)||this.parent.serviceLocator.getService(k).show({content:this.parent.serviceLocator.getService(A).getConstant("DefineNameExists"),width:"300",beforeOpen:function(e){var t={dialogName:"DefineNameExistsDialog",element:e.element,target:e.target,cancel:e.cancel};s.parent.trigger("dialogBeforeOpen",t),t.cancel&&(e.cancel=!0)}})):this.parent.serviceLocator.getService(k).show({content:this.parent.serviceLocator.getService(A).getConstant("DefineNameInValid"),width:"300",beforeOpen:function(e){var t={dialogName:"DefineNameInValidDialog",element:e.element,target:e.target,cancel:e.cancel};s.parent.trigger("dialogBeforeOpen",t),t.cancel&&(e.cancel=!0)}})),l};var pc=cc;function cc(e){this.isFormulaBar=!1,this.isFormula=!1,this.isPopupOpened=!1,this.isPreventClose=!1,this.isSubFormula=!1,this.parent=e,this.addEventListener()}fc.prototype.getModuleName=function(){return"sheetTabs"},fc.prototype.createSheetTabs=function(){var r=this;if(!this.parent.showSheetTabs&&this.tabInstance)this.destroy();else{for(var t,n=this.parent.serviceLocator.getService(A),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=J.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"})),s=(this.tabInstance=new F.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"),J.EventHandler.add(e,"dblclick",r.renameSheetTab,r)}}),e.appendChild(i),this.tabInstance.createElement=this.parent.createElement,this.tabInstance.appendTo(i),J.EventHandler.remove(this.tabInstance.element,"keydown",this.tabInstance.spaceKeyDown),o.tabItems.length),a=0;a<s;a++){var l={action:"addSheet",sheetName:"Sheet"+(l=ne(this.parent,a)).id,sheetId:l.id,visibleName:l.name};this.parent.notify(re,l)}this.parent.notify(re,{action:"initiateDefinedNames"}),this.parent.notify(za,null)}},fc.prototype.goToSheet=function(e,t,r){var n,i=this;e.selectedIndex!==e.previousIndex&&(t?(this.tabInstance.selectedItem=e.previousIndex,this.tabInstance.dataBind(),ae(this.parent.element)):(this.parent.notify(Dl,{}),!this.parent.isEdit||(t=window.getSelection(),this.parent.notify(us,n={action:"getCurrentEditValue",editedValue:""}),n=!(n=!!n.editedValue&&X(n.editedValue,!0))&&t&&t.focusNode&&t.focusNode.classList&&t.focusNode.classList.contains("e-formula-bar-panel")?X(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(re,t),r&&(this.parent.notify(oe,{eventArgs:{previousSheetIndex:e.previousIndex,currentSheetIndex:e.selectedIndex},action:"gotoSheet"}),Ph(function(){ae(i.parent.element)}))))},fc.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)},fc.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)},fc.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="",ae(t)},fc.prototype.getSheetTabItems=function(){var r,n=this,i=[],o=[];return this.parent.sheets.forEach(function(e,t){r=ki(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}},fc.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()},fc.prototype.addSheetTab=function(){this.parent.notify(ar,{model:this.parent,start:this.parent.activeSheetIndex+1,end:this.parent.activeSheetIndex+1,modelType:"Sheet",isAction:!0,activeSheetIndex:this.parent.activeSheetIndex+1})},fc.prototype.insertSheetTab=function(e){this.parent.notify(Dl,{}),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})},fc.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(za,null)},fc.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(oe,{action:"showSheet",eventArgs:{sheetIndex:e.sheetIndex}})},fc.prototype.switchSheetTab=function(e){var t=J.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)}},fc.prototype.skipHiddenSheets=function(){var t=this.parent.sheets.length;return this.parent.sheets.forEach(function(e){"Visible"!==e.state&&--t}),t},fc.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),J.EventHandler.add(document,"mousedown touchstart",this.renameInputFocusOut,this),J.EventHandler.add(t,"keydown",this.renameKeyDown,this),J.EventHandler.add(t,"input",this.updateWidth,this),t.focus(),t.setSelectionRange(0,e.length),J.EventHandler.remove(J.closest(r,".e-toolbar-items"),"dblclick",this.renameSheetTab)))},fc.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"},fc.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)},fc.prototype.renameInputFocusOut=function(e){var t=e.target;if("mousedown"!==e.type&&"touchstart"!==e.type||!t.classList.contains("e-sheet-rename")&&!J.closest(t,".e-dlg-container")){var r=(t=document.getElementById(this.parent.element.id+"_rename_input")).value,n=this.parent.serviceLocator.getService(A);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,s=this.parent.sheets.length;o<s;o++)if(o!==this.parent.activeSheetIndex&&this.parent.sheets[o].name.toLowerCase()===r.toLowerCase())return void this.showRenameDialog(t,n.getConstant("SheetRenameAlreadyExistsAlert"));var a=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:a})),"keydown"===e.type?this.focusTab(a):J.closest(e.target,".e-spreadsheet")&&ae(this.parent.element)}}else this.showRenameDialog(t,n.getConstant("SheetRenameEmptyAlert"));this.parent.notify(oe,{eventArgs:{index:this.parent.getActiveSheet().id,value:r},action:"renameSheet"})}},fc.prototype.focusTab=function(e){ae(J.select(".e-toolbar-item.e-active .e-tab-wrap",e))},fc.prototype.updateSheetName=function(t){var r,n=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(re,{action:"renameUpdation",value:t.value,pName:n}),this.parent.allowChart&&this.parent.chartColl.forEach(function(e){e.range.includes("!")&&(r=e.range.split("!"))[0].toLowerCase()===n.toLowerCase()&&(r[0]=t.value,e.range=r.join("!"))})},fc.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(ne(this.parent,e.sheetIndex),"state","Hidden"),this.tabInstance.hideTab(e.sheetIndex),e.triggerEvent&&(delete t.eventArgs.cancel,this.parent.notify(oe,t)))},fc.prototype.removeRenameInput=function(e){var t=e.parentElement.querySelector(".e-tab-text"),r=J.closest(e,".e-toolbar-items");return J.EventHandler.add(r,"dblclick",this.renameSheetTab,this),J.EventHandler.remove(document,"mousedown touchstart",this.renameInputFocusOut),J.EventHandler.remove(e,"keydown",this.renameKeyDown),J.EventHandler.remove(e,"input",this.updateWidth),J.remove(e),t.style.display="",r},fc.prototype.showRenameDialog=function(r,n){var i=this;this.parent.serviceLocator.getService(k).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(A).getConstant("Ok")),r.focus()},close:function(){return r.setSelectionRange(0,r.value.length)}})},fc.prototype.focusRenameInput=function(){var e=document.getElementById(this.parent.element.id+"_rename_input");e&&e.focus()},fc.prototype.removeSheetTab=function(e){var r,t,n,i,o,s=this;e.count&&e.count===this.parent.sheets.length||(r=this.parent.serviceLocator.getService(A),1<this.skipHiddenSheets()?(t=e.sheetName?ne(this.parent,B(this.parent,e.sheetName)):this.parent.getActiveSheet(),n=J.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(k),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};s.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")),ae(s.parent.element)},buttons:[{buttonModel:{content:r.getConstant("Ok"),isPrimary:!0},click:function(){o.hide(),s.forceDelete(n),s.parent.notify(Ra,null),e&&!e.isAction&&(i.sheetCount=s.parent.sheets.length,s.parent.notify(oe,{eventArgs:i,action:"removeSheet"}))}}]})):(this.parent.notify(re,{action:"deleteSheetTab",sheetId:ne(this.parent,n).id}),this.destroySheet(n),this.parent.notify(Ra,null),e&&!e.isAction&&(i.sheetCount=this.parent.sheets.length,this.parent.notify(oe,{eventArgs:i,action:"removeSheet"})))):this.parent.serviceLocator.getService(k).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};s.parent.trigger("dialogBeforeOpen",t),t.cancel&&(e.cancel=!0)}}))},fc.prototype.forceDelete=function(e){this.parent.notify(Dl,{}),this.parent.notify(re,{action:"deleteSheetTab",sheetId:ne(this.parent,e).id}),this.destroySheet(e)},fc.prototype.destroySheet=function(e){e=J.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(za,null)},fc.prototype.showAggregate=function(){var t,e,r,n,i=this;he(Q(this.parent.getActiveSheet().selectedRange))||(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 ae(i.parent.element)},cssClass:e}),this.aggregateDropDown.createElement=this.parent.createElement,this.aggregateDropDown.appendTo(n))):this.removeAggregate())},fc.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},fc.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)},fc.prototype.removeAggregate=function(){J.isNullOrUndefined(this.aggregateDropDown)||(this.aggregateDropDown.destroy(),J.remove(this.aggregateDropDown.element),this.aggregateDropDown=null)},fc.prototype.addEventListener=function(){this.parent.on(as,this.createSheetTabs,this),this.parent.on(ls,this.refreshSheetTab,this),this.parent.on(Ns,this.insertSheetTab,this),this.parent.on(As,this.removeSheetTab,this),this.parent.on(ks,this.renameSheetTab,this),this.parent.on(Rs,this.switchSheetTab,this),this.parent.on(na,this.updateSheetTab,this),this.parent.on(Lt,this.removeAggregate,this),this.parent.on(Cs,this.focusRenameInput,this),this.parent.on(bs,this.focusRenameInput,this),this.parent.on(ba,this.updateSheetName,this),this.parent.on(xa,this.hideSheet,this),this.parent.on(il,this.showAggregate,this),this.parent.on(ol,this.goToSheet,this),this.parent.on(sl,this.showSheet,this)},fc.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,J.EventHandler.remove(document,"mousedown touchstart",this.renameInputFocusOut);var e=document.getElementById(this.parent.element.id+"_sheet_tab_panel");e&&J.remove(e),this.selaggregateCnt&&(this.selaggregateCnt=null),this.parent=null},fc.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(as,this.createSheetTabs),this.parent.off(ls,this.refreshSheetTab),this.parent.off(Ns,this.insertSheetTab),this.parent.off(As,this.removeSheetTab),this.parent.off(ks,this.renameSheetTab),this.parent.off(Rs,this.switchSheetTab),this.parent.off(na,this.updateSheetTab),this.parent.off(Lt,this.removeAggregate),this.parent.off(Cs,this.focusRenameInput),this.parent.off(bs,this.focusRenameInput),this.parent.off(ba,this.updateSheetName),this.parent.off(xa,this.hideSheet),this.parent.off(il,this.showAggregate),this.parent.off(ol,this.goToSheet),this.parent.off(sl,this.showSheet))};var uc=fc;function fc(e){this.aggregateContent="",this.selaggregateCnt="Sum",this.parent=e,this.addEventListener()}mc.prototype.addEventListener=function(){this.parent.on(Pt,this.openSuccess,this),this.parent.on(Mt,this.openFailed,this)},mc.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(Pt,this.openSuccess),this.parent.off(Mt,this.openFailed))},mc.prototype.renderFileUpload=function(){var e=this.parent.element.id+"_fileUpload",e=(this.parent.element.appendChild(this.parent.createElement("input",{id:e,attrs:{type:"file",accept:".xls, .xlsx, .csv, .xlsm, .xlsb",name:"fileUpload"}})),document.getElementById(e));e.onchange=this.fileSelect.bind(this),e.onerror=this.openFailed.bind(this),e.style.display="none"},mc.prototype.fileSelect=function(e){e=e.target.files[0];e&&e.length<1||(this.parent.open({file:e}),document.getElementById(this.parent.element.id+"_fileUpload").value="")},mc.prototype.openSuccess=function(t){function e(e){r.parent.serviceLocator.getService(k).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(A);if(n[2]===t.data)this.parent.element.querySelector(".e-importprotectworkbook-dlg")||this.parent.notify(zl,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(k).hide(!0),i=t.data.includes("ExternalWorkbook"),this.parent.serviceLocator.getService(k).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(k).hide(!0),i=t.data.includes("LimitExceeded"),this.parent.serviceLocator.getService(k).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(Jl,null),this.parent.serviceLocator.getService(k).hide(),this.parent.hideSpinner()}}else this.parent.serviceLocator.getService(k).hide(),this.parent.showSpinner();this.parent.element&&n[5]!==t.data&&(t.isOpenFromJson||(this.parent.trigger("openComplete",{response:t}),this.parent.notify(oe,{response:t,action:"import"})),this.parent.notify(qt,{cellRef:null,isOpen:!0}),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(ls,null),this.isImportedFile=!0,this.preventFormatCheck=t.eventArgs&&t.eventArgs.file&&t.eventArgs.file.name&&!t.eventArgs.file.name.includes(".csv"),this.unProtectSheetIdx=[],this.parent.hideSpinner())},mc.prototype.openFailed=function(e){this.parent.trigger("openFailure",e),this.parent.hideSpinner()},mc.prototype.destroy=function(){this.removeEventListener(),this.parent=null},mc.prototype.getModuleName=function(){return"open"};var gc=mc;function mc(e){this.isImportedFile=!1,this.unProtectSheetIdx=[],this.parent=e,this.addEventListener(),this.renderFileUpload()}yc.prototype.destroy=function(){this.removeEventListener(),this.parent=null},yc.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)},yc.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))},yc.prototype.getModuleName=function(){return"save"},yc.prototype.initiateSave=function(){this.parent.showSpinner()},yc.prototype.saveCompleted=function(){this.parent.hideSpinner()},yc.prototype.showErrorDialog=function(e){var t=this;this.parent.serviceLocator.getService(k).show({isModal:!0,showCloseIcon:!0,height:180,width:400,content:e.content,beforeOpen:function(){return ae(t.parent.element)}})},yc.prototype.exportDialog=function(r){var e,n=this,i=this.parent.serviceLocator.getService(A),o=this.parent.serviceLocator.getService(k),s=r?r.item.id.split(this.parent.element.id+"_")[1]:"xlsx";J.isNullOrUndefined(this.parent.element.querySelector(".e-find-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(s),o.dialogInstance.dataBind(),n.parent.element.querySelector(".e-text-open").setSelectionRange(0,n.parent.element.querySelector(".e-text-open").value.length),ae(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"),J.getComponent(e,"btn").disabled=!0,e=n.parent.serviceLocator.getService(A),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()},yc.prototype.checkValidName=function(e){var t=!0;return t=e.match(new RegExp('.*[\\[\\]\\*\\\\/\\?\\:\\<\\>\\|\\"].*'))||e.length<1||218<e.length?!1:t},yc.prototype.OpenContent=function(e){var t=this,r=this.parent.serviceLocator.getService(A),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"}),s=(n.appendChild(i),n.appendChild(o),r.getConstant("FileName")),a=this.parent.element.id+"_filename",r=this.parent.createElement("p",{className:"e-header",id:a,attrs:{"aria-label":r.getConstant("SaveAs")+" "+s}}),s=(r.innerText=s,this.parent.createElement("input",{className:"e-input e-text-open",attrs:{type:"Text","aria-labelledby":a}})),a=this.parent.createElement("span",{className:"e-input-group-icon"});return s.onkeyup=function(e){t.parent.element.querySelector(".e-file-alert-span")&&13!==e.keyCode&&(e=t.parent.element.querySelector(".e-btn-open-ok"),J.getComponent(e,"btn").disabled=!1,t.parent.element.querySelector(".e-file-alert-span").remove())},i.appendChild(r),a.textContent="."+e.toLowerCase(),o.appendChild(s),s.setAttribute("value","Sample"),o.appendChild(a),n};var vc=yc;function yc(e){this.parent=e,this.addEventListener()}bc.prototype.init=function(){this.initContextMenu(),this.addEventListener()},bc.prototype.initContextMenu=function(){var e=document.createElement("ul");e.id=this.parent.element.id+"_contextmenu",this.parent.element.appendChild(e),this.contextMenuInstance=new F.ContextMenu({cssClass:"e-spreadsheet-contextmenu",target:"#"+this.parent.element.id,filter:"e-numericcontainer e-active-cell e-selection e-row e-header-row e-select-all-cell e-sheet-tabs-items",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")},bc.prototype.beforeCloseHandler=function(e){var t=this;this.parent.trigger("contextMenuBeforeClose",e),this.parent.enableKeyboardShortcut&&e.event&&27===e.event.keyCode&&Ph(function(){ae(t.parent.element)})},bc.prototype.selectHandler=function(e){var t,r=J.extend({cancel:!1},e),n=(this.parent.trigger("contextMenuItemSelect",r),this.parent.element.id+"_cmenu"),i=Q(this.parent.getActiveSheet().selectedRange),o=[];if(this.parent.sortCollection)for(var s=this.parent.sortCollection.length-1;0<=s;s--)this.parent.sortCollection[s]&&this.parent.sortCollection[s].sheetIndex===this.parent.activeSheetIndex&&(o.push(this.parent.sortCollection[s]),this.parent.sortCollection.splice(s,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 a=ch(this.parent.getActiveSheet(),i[0]),l=se(this.parent.getActiveSheet(),i[1]);if(a&&!a.isReadOnly&&l&&!l.isReadOnly&&Bd(this.parent,i))return void this.parent.notify($a,null)}if(e.item.id===n+"_ascending"||e.item.id===n+"_descending"||e.item.id===n+"_customsort"){a=Yn(i[0],i[1],this.parent.getActiveSheet());if(Bd(this.parent,a))return void this.parent.notify($a,null)}if(!r.cancel){var h=void 0;switch(e.item.id){case n+"_cut":this.parent.notify(Ps,{invokeCopy:!0,promise:Promise});break;case n+"_copy":this.parent.notify(Ms,{invokeCopy:!0,promise:Promise});break;case n+"_paste":this.parent.notify(Bs,{isAction:!0,isInternal:!0,focus:!0});break;case n+"_pastevalues":this.parent.notify(Bs,{type:"Values",isAction:!0,isInternal:!0,focus:!0});break;case n+"_pasteformats":this.parent.notify(Bs,{type:"Formats",isAction:!0,isInternal:!0,focus:!0});break;case n+"_rename":this.parent.notify(ks,{});break;case n+"_delete_sheet":this.parent.notify(As,{}),ae(this.parent.element);break;case n+"_insert_sheet":this.parent.notify(ar,{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(xa,{sheetIndex:this.parent.activeSheetIndex,triggerEvent:!0});break;case n+"_duplicate":Oi(this.parent,void 0,!0),ae(this.parent.element);break;case n+"_move_right":Fi(this.parent,this.parent.activeSheetIndex+1,null,!0),ae(this.parent.element);break;case n+"_move_left":Fi(this.parent,this.parent.activeSheetIndex-1,null,!0),ae(this.parent.element);break;case n+"_ascending":this.parent.notify(Fa,{sortOptions:{sortDescriptors:{order:"Ascending"}}}),this.parent.notify(oa,{sortOptions:{sortDescriptors:{order:"Ascending"}},previousSort:o});break;case n+"_descending":this.parent.notify(Fa,{sortOptions:{sortDescriptors:{order:"Descending"}}}),this.parent.notify(oa,{sortOptions:{sortDescriptors:{order:"Descending"}},previousSort:o});break;case n+"_customsort":this.parent.notify(ia,null);break;case n+"_filtercellvalue":this.parent.notify(Ta,null);break;case n+"_clearfilter":t=le(W(this.parent.getActiveSheet().activeCell)[1]+1),this.parent.notify(Da,{field:t});break;case n+"_reapplyfilter":this.parent.notify(Oa,null);break;case n+"_hide_row":h=Q(this.parent.getActiveSheet().selectedRange),this.parent.notify(Lr,{startIndex:h[0],endIndex:h[2],hide:!0,isCol:!1,actionUpdate:!0});break;case n+"_unhide_row":h=Q(this.parent.getActiveSheet().selectedRange),this.parent.notify(Lr,{startIndex:h[0],endIndex:h[2],hide:!1,isCol:!1,actionUpdate:!0});break;case n+"_hide_column":h=Q(this.parent.getActiveSheet().selectedRange),this.parent.notify(Lr,{startIndex:h[1],endIndex:h[3],hide:!0,isCol:!0,actionUpdate:!0});break;case n+"_unhide_column":h=Q(this.parent.getActiveSheet().selectedRange),this.parent.notify(Lr,{startIndex:h[1],endIndex:h[3],hide:!1,isCol:!0,actionUpdate:!0});break;case n+"_insert_row_above":case n+"_delete_row":h=Q(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=te(Q(this.parent.getActiveSheet().selectedRange)),this.parent.notify(ar,{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=Q(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=te(Q(this.parent.getActiveSheet().selectedRange)),this.parent.notify(ar,{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(pa,null);break;case n+"_editNote":this.parent.notify(ca,null);break;case n+"_deleteNote":this.parent.notify(ua,{rowIndex:null,columnIndex:null,isDeleteFromMenu:!0});break;case n+"_hyperlink":this.parent.notify(la,null);break;case n+"_editHyperlink":this.parent.notify(ha,null);break;case n+"_openHyperlink":this.parent.notify(da,null);break;case n+"_removeHyperlink":this.parent.notify(ya,{range:this.parent.getActiveSheet().selectedRange});break;case n+"_protect":this.parent.notify(oh,{})}}},bc.prototype.getInsertModel=function(e,t){for(var r=[],n=e;n<=t;n++)r.push(n===e?{index:n}:{});return r},bc.prototype.beforeOpenHandler=function(e){var t,r=e.event.target,n=this.getTarget(r);if(e.element.classList.contains("e-contextmenu")){var i,o=this.parent.getActiveSheet();if(e.event.target&&(r.classList.contains("e-rowresize")||r.classList.contains("e-colresize"))){var s=Q(o.selectedRange);if(!(r.classList.contains("e-rowresize")?0===s[1]&&s[3]===o.colCount-1:0===s[0]&&s[2]===o.rowCount-1))return void(e.cancel=!0);t=(r.classList.contains("e-rowresize")?this.parent.hiddenCount(s[0],s[2])!==Math.abs(s[2]-s[0])+1:this.parent.hiddenCount(s[1],s[3],"columns")!==Math.abs(s[3]-s[1])+1)?this.getDataSource(n):this.getDataSource(n,r)}else"Content"===n&&(i=0===(s=Q(o.selectedRange))[1]&&s[3]===o.colCount-1,s=0===s[0]&&s[2]===o.rowCount-1,n=i&&s?"SelectAll":i?"RowHeader":s?"ColumnHeader":"Content"),t=this.getDataSource(n);this.contextMenuInstance.items=t,this.contextMenuInstance.dataBind()}else t=e.items;"None"===this.parent.selectionSettings.mode&&"Content"===n&&this.parent.enableContextMenuItems(["Filter"],!1,!1),"ColumnHeader"===n||"RowHeader"===n?e.element&&0<e.element.childElementCount&&(o="ColumnHeader"===n?e.element.querySelector("#"+this.parent.element.id+"_cmenu_insert_column"):e.element.querySelector("#"+this.parent.element.id+"_cmenu_insert_row"),i="ColumnHeader"===n?e.element.querySelector("#"+this.parent.element.id+"_cmenu_delete_column"):e.element.querySelector("#"+this.parent.element.id+"_cmenu_delete_row"),this.parent.allowInsert&&o.classList.contains("e-disabled")?o.classList.remove("e-disabled"):this.parent.allowInsert&&!this.parent.element.querySelector(".e-selectall.e-highlight")||o.classList.contains("e-disabled")||o.classList.add("e-disabled"),this.parent.allowDelete&&i.classList.contains("e-disabled")?i.classList.remove("e-disabled"):this.parent.allowDelete||i.classList.contains("e-disabled")||i.classList.add("e-disabled"),"None"===this.parent.selectionSettings.mode)&&("ColumnHeader"===n&&this.parent.enableContextMenuItems(["Insert Column","Delete Column","Hide Column"],!1,!1),"RowHeader"===n)&&this.parent.enableContextMenuItems(["Insert Row","Delete Row","Hide Row"],!1,!1):"Footer"===n&&(0===(s=B(this.parent,r.textContent))&&e.element.querySelector("#"+this.parent.element.id+"_cmenu_move_left").classList.add("e-disabled"),s===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(Rs,J.extend(e,{target:n,items:t}))},bc.prototype.getTarget=function(e){return J.closest(e,".e-sheet-content")?"Content":J.closest(e,".e-column-header")?e.classList.contains("e-header-cell")?"ColumnHeader":"Content":J.closest(e,".e-row-header")?e.classList.contains("e-header-cell")?"RowHeader":"Content":J.closest(e,".e-sheet-tabs-items")?"Footer":J.closest(e,".e-selectall-container")?e.classList.contains("e-header-cell")?J.closest(e,".e-header-row")?"ColumnHeader":"RowHeader":J.closest(e,".e-select-all-cell")?"SelectAll":"Content":""},bc.prototype.getDataSource=function(e,t){var r,n=this.parent.serviceLocator.getService(A),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=Q(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=Q(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),i.push({text:n.getConstant("MoveRight"),id:o+"_move_right"}),i.push({text:n.getConstant("MoveLeft"),id:o+"_move_left"})),i},bc.prototype.setProtectSheetItems=function(e,t){var r=this.parent.serviceLocator.getService(A);this.parent.getActiveSheet().isProtected?e.push({text:r.getConstant("UnprotectSheet"),id:t+"_protect",iconCss:"e-icons e-protect-icon"}):e.push({text:r.getConstant("ProtectSheet"),id:t+"_protect",iconCss:"e-icons e-protect-icon"})},bc.prototype.setFilterItems=function(e,t){var r,n;this.parent.allowFiltering&&(r=this.parent.serviceLocator.getService(A),this.parent.notify(La,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"}]}))},bc.prototype.setSortItems=function(e,t){var r=this.parent.serviceLocator.getService(A);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"}]})},bc.prototype.setHyperLink=function(e,t){var r;this.parent.allowHyperlink&&(r=this.parent.serviceLocator.getService(A),document.activeElement.getElementsByClassName("e-hyperlink")[0]||document.activeElement.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"}))},bc.prototype.setNotesMenu=function(e,t){var r,n;this.parent.enableNotes&&(r=this.parent.serviceLocator.getService(A),n=W(this.parent.getActiveSheet().activeCell),0<(n=this.parent.getCell(n[0],n[1])).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"}))},bc.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"}]}))},bc.prototype.setInsertDeleteItems=function(t,r,n,i,o,s){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=[],s.forEach(function(e){t[t.length-1].items.push({text:r.getConstant(e),id:t[t.length-1].id+"_"+e.toLowerCase()})}))})},bc.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())})},bc.prototype.addEventListener=function(){this.parent.on(_s,this.addItemsHandler,this),this.parent.on(zs,this.removeItemsHandler,this),this.parent.on(js,this.enableItemsHandler,this)},bc.prototype.addItemsHandler=function(e){e.insertAfter?this.contextMenuInstance.insertAfter(e.items,e.text,e.isUniqueId):this.contextMenuInstance.insertBefore(e.items,e.text,e.isUniqueId)},bc.prototype.removeItemsHandler=function(e){this.contextMenuInstance.removeItems(e.items,e.isUniqueId)},bc.prototype.enableItemsHandler=function(e){this.contextMenuInstance.enableItems(e.items,e.enable,e.isUniqueId)},bc.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(_s,this.addItemsHandler),this.parent.off(zs,this.removeItemsHandler),this.parent.off(js,this.enableItemsHandler))},bc.prototype.getModuleName=function(){return"contextMenu"},bc.prototype.destroy=function(){this.removeEventListener(),this.contextMenuInstance.destroy();var e=document.getElementById(this.parent.element.id+"_contextmenu");e&&J.detach(e),this.contextMenuInstance=null,this.parent=null};var Cc=bc;function bc(e){this.parent=e,this.init()}Sc.prototype.refreshCellElement=function(e){e.cellEle&&this.parent.refreshNode(e.cellEle,e)},Sc.prototype.getTextSpace=function(e){e.width=Sd(e.char,e.cell.style,this.parent.cellStyle)},Sc.prototype.rowFillHandler=function(e){var t,r,n,i,o=e.cellEle;o&&(t=Sd(e.repeatChar,e.cell.style,this.parent.cellStyle),n=e.colIdx,1<e.cell.colSpan&&(r={range:[e.rowIdx,e.colIdx,e.rowIdx,e.colIdx]},this.parent.notify(Tr,r),n=r.range[3]),r=Ed(this.parent.getActiveSheet(),e.rowIdx,e.colIdx,n),o.innerText="",e.beforeFillText&&(o.innerText=e.beforeFillText,r-=Sd(e.beforeFillText,e.cell.style,this.parent.cellStyle)),n=this.parent.createElement("span",{className:"e-fill"}),o.appendChild(n),e.afterFillText&&((i=this.parent.createElement("span",{className:"e-fill-sec"})).innerText=e.afterFillText,o.appendChild(i),r-=Sd(e.afterFillText,e.cell.style,this.parent.cellStyle)),o=parseInt((r/t).toString(),10),e.formattedText=0<o?e.repeatChar.repeat(o):"",n.textContent=e.formattedText)},Sc.prototype.addEventListener=function(){this.parent.on(wt,this.refreshCellElement,this),this.parent.on(sn,this.rowFillHandler,this),this.parent.on(an,this.getTextSpace,this)},Sc.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(wt,this.refreshCellElement),this.parent.off(sn,this.rowFillHandler),this.parent.off(an,this.getTextSpace))},Sc.prototype.destroy=function(){this.removeEventListener(),this.parent=null},Sc.prototype.getModuleName=function(){return"numberFormat"};var xc=Sc;function Sc(e){this.parent=e,this.addEventListener()}Ic.prototype.destroy=function(){this.removeEventListener(),this.parent=null},Ic.prototype.addEventListener=function(){this.parent.on(oa,this.applySortHandler,this),this.parent.on(Kt,this.sortCompleteHandler,this),this.parent.on(ia,this.initiateCustomSortHandler,this),this.parent.on(mt,this.sortImport,this)},Ic.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(oa,this.applySortHandler),this.parent.off(Kt,this.sortCompleteHandler),this.parent.off(ia,this.initiateCustomSortHandler),this.parent.off(mt,this.sortImport))},Ic.prototype.getModuleName=function(){return"sort"},Ic.prototype.isValidSortRange=function(){var e=this.parent.getActiveSheet(),t=te(y(e.selectedRange));return!(t[0]>e.usedRange.rowIndex||t[1]>e.usedRange.colIndex)},Ic.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 s=0;s<n;s++)if((t=this.parent.getCell(s,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"))},Ic.prototype.sortRangeAlertHandler=function(r){var n=this,i=this.parent.serviceLocator.getService(k),o=this.parent.serviceLocator.getService(A);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:ae(n.parent.element),i.dialogInstance.content=t.content}}),this.parent.hideSpinner()},Ic.prototype.initiateCustomSortHandler=function(){var n,i,o=this,e=this.parent.serviceLocator.getService(A),t=this.parent.getActiveSheet();this.isValidSortRange()&&0!==t.rows.length?Fd(t.selectedRange)?this.sortRangeAlertHandler({error:e.getConstant("MultiRangeSortError")}):(n=this.parent.serviceLocator.getService(k)).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(),ae(o.parent.element)},buttons:[{buttonModel:{content:e.getConstant("Ok"),isPrimary:!0},click:function(){var e=n.dialogInstance.content,t=J.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&&Ph(function(){o.applySortHandler({sortOptions:i})})}}):this.sortRangeAlertHandler({error:e.getConstant("SortOutOfRangeError")})},Ic.prototype.validateError=function(e,t,r){var n,i,o,s,a=this.parent.serviceLocator.getService(A);return e.some(function(e){return""===e.field.toString()})?(Array.prototype.some.call(t.getElementsByClassName("e-sort-field"),function(e){var t=!J.getComponent(e,"dropdownlist").value;return t&&e.parentElement.classList.add("e-error"),t}),r.innerText=a.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&&(s=0,Array.prototype.some.call(t.getElementsByClassName("e-sort-field"),function(e){var t=J.getComponent(e,"dropdownlist");return t.value===i&&(e.parentElement.classList.add("e-error"),o=t.text,s++),2===s}),r.innerText="",(e=this.parent.createElement("strong")).innerText=o,r.appendChild(e),r.appendChild(document.createTextNode(a.getConstant("SortDuplicateFieldError"))),!0))},Ic.prototype.customSortContent=function(){var e=this.parent.createElement("div",{className:"e-sort-dialog"}),t=this.getFields(),r=J.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},Ic.prototype.getFields=function(){var e,t=this.parent.getActiveSheet(),r=te(y(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(Ma,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=ie(r[0],r[1],t),s="Column "+le(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=s,n.push({text:i,value:s})}return n},Ic.prototype.setHeaderTab=function(r,t,n){var i=this,o=this.parent.serviceLocator.getService(A),e=this.parent.createElement("div",{className:"e-sort-header"}),s=(r.appendChild(e),this.parent.createElement("button",{className:"e-btn e-sort-addbtn e-flat",attrs:{type:"button"}})),a=(s.innerText=o.getConstant("AddColumn"),this.parent.element.querySelector(".e-customsort-dlg .e-footer-content")),l=(a.insertBefore(s,a.firstElementChild),s.addEventListener("click",function(){var e;t&&(e=J.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=J.getComponent(e,"dropdownlist");e.dataSource=null,e.dataSource=n,e.fields=t,e.dataBind()})},cssClass:"e-sort-headercheckbox"})),a=this.parent.createElement("input",{className:"e-sort-checkheader",attrs:{type:"checkbox"}}),s=(e.appendChild(a),l.createElement=this.parent.createElement,l.appendTo(a),new w.CheckBox({label:o.getConstant("CaseSensitive"),checked:!1,cssClass:"e-sort-casecheckbox"})),a=this.parent.createElement("input",{className:"e-sort-checkcase",attrs:{type:"checkbox"}});e.appendChild(a),s.createElement=this.parent.createElement,s.appendTo(a)},Ic.prototype.getCustomListview=function(e){e=[{id:e,text:this.parent.serviceLocator.getService(A).getConstant("SortBy"),field:"",order:"ascending"}];return J.enableRipple(!1),new f.ListView({dataSource:e,fields:{id:"id"},height:"100%",template:J.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"})},Ic.prototype.deleteHandler=function(e,t){e.getElementsByClassName("e-sort-delete")[0].addEventListener("click",function(){e&&t.removeItem(e)})},Ic.prototype.renderListItem=function(r,n,e,t,i){var o=this,s=this.parent.serviceLocator.getService(A),a=n.element.querySelector("li[data-uid="+r+"]"),e=e?{text:"text",value:"value"}:{text:"value"},l=a.getElementsByClassName("e-sort-field")[0],t=new I.DropDownList({dataSource:t,width:"auto",cssClass:"e-sort-field-ddl",fields:e,placeholder:s.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),a.getElementsByClassName("e-sort-order")[0]),l="ascending"===e.getElementsByClassName("e-sort-ordertxt")[0].innerText.toLocaleLowerCase(),i=new w.RadioButton({label:s.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:s.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(a,n)},Ic.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})},Ic.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")}))},Ic.prototype.applySortHandler=function(e){var t=this,r=this.parent.getActiveSheet(),n=te(y(e&&e.range||r.selectedRange)),i=e&&e.sortOptions||{sortDescriptors:{}},o=n[0]===n[2],s={filterRange:[],hasFilter:!1,sheetIdx:this.parent.activeSheetIndex},s=(this.parent.notify(Ma,s),s.hasFilter&&(o?Pn(s.filterRange,n[0],n[1]):s.filterRange[0]===n[0]&&(this.parent.element.querySelector(".e-selectall.e-highlight")||n[1]>=s.filterRange[1]&&n[1]<=s.filterRange[3]||n[3]>=s.filterRange[1]&&n[3]<=s.filterRange[3]))&&(n[0]=s.filterRange[0],n[1]=s.filterRange[1],n[2]=r.usedRange.rowIndex,n[3]=r.usedRange.colIndex,i.containsHeader=!s.allowHeaderFilter,o=!1),{range:r=ee(n),sortOptions:i,cancel:!1});this.parent.trigger(Gt,s),s.cancel||(this.parent.notify(gt,{eventArgs:s,action:"beforeSort"}),this.parent.showSpinner(),n=new Promise(function(e){e(void 0)}),i={args:{range:s.range,sortOptions:s.sortOptions,checkForHeader:o&&r!==s.range},promise:n,previousSort:e&&e.previousSort},this.parent.notify(Yt,i),i.promise.then(function(e){return t.sortCompleteHandler(e),t.parent.trigger(Kt,e),t.parent.notify(oe,{eventArgs:e,action:"sorting"}),"BODY"===document.activeElement.tagName&&ae(t.parent.element),Promise.resolve(e)}).catch(function(e){return t.sortRangeAlertHandler({error:e}),Promise.reject(e)}))},Ic.prototype.sortCompleteHandler=function(e){for(var t,r,n,i=this.parent.activeSheetIndex,o=(n=e.range.includes("!")?(t=e.range.split("!"),i=B(this.parent,t[0]),r=ne(this.parent,i),Q(t[1])):(r=this.parent.getActiveSheet(),Q(e.range)))[0];o<=n[2];o++)for(var s=n[1];s<=n[3];s++)this.parent.notify(re,{action:"refreshCalculate",rowIndex:o,colIndex:s});this.parent.serviceLocator.getService("cell").refreshRange(n,!0,!0,!1,!1,Td(this.parent)),i===this.parent.activeSheetIndex&&r.conditionalFormats&&r.conditionalFormats.length&&this.parent.notify(Mr,{indexes:n}),this.parent.hideSpinner(),this.parent.notify(ka,null)};var wc=Ic;function Ic(e){this.parent=e,this.addEventListener()}c.prototype.destroy=function(){var r=this;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),this.parent=null},c.prototype.addEventListener=function(){this.parent.on(rr,this.filterRangeAlertHandler,this),this.parent.on(Na,this.initiateFilterUIHandler,this),this.parent.on(ps,this.filterMouseDownHandler,this),this.parent.on(Aa,this.renderFilterCellHandler,this),this.parent.on(ka,this.refreshFilterRange,this),this.parent.on(Fa,this.updateSortCollectionHandler,this),this.parent.on(E.beforeFltrcMenuOpen,this.beforeFilterMenuOpenHandler,this),this.parent.on(E.filterCmenuSelect,this.closeDialog,this),this.parent.on(Oa,this.reapplyFilterHandler,this),this.parent.on(Ta,this.filterByCellValueHandler,this),this.parent.on(Da,this.clearFilterHandler,this),this.parent.on(La,this.getFilteredColumnHandler,this),this.parent.on(Rs,this.cMenuBeforeOpenHandler,this),this.parent.on(E.filterCboxValue,this.filterCboxValueHandler,this),this.parent.on(Ma,this.getFilterRangeHandler,this),this.parent.on(Pa,this.filterCellKeyDownHandler,this),this.parent.on(Ct,this.setFilteredCollection,this),this.parent.on(ds,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(E.filterDialogCreated,this.filterDialogCreatedHandler,this),this.parent.on(E.filterDialogClose,this.removeFilterClass,this),this.parent.on(fn,this.duplicateSheetFilterHandler,this),this.parent.on(E.fltrPrevent,this.beforeFilteringHandler,this),this.parent.on(E.beforeCustomFilterOpen,this.customFilterOpen,this)},c.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(rr,this.filterRangeAlertHandler),this.parent.off(Na,this.initiateFilterUIHandler),this.parent.off(ps,this.filterMouseDownHandler),this.parent.off(Aa,this.renderFilterCellHandler),this.parent.off(ka,this.refreshFilterRange),this.parent.off(Fa,this.updateSortCollectionHandler),this.parent.off(E.beforeFltrcMenuOpen,this.beforeFilterMenuOpenHandler),this.parent.off(E.filterCmenuSelect,this.closeDialog),this.parent.off(Oa,this.reapplyFilterHandler),this.parent.off(Ta,this.filterByCellValueHandler),this.parent.off(Da,this.clearFilterHandler),this.parent.off(La,this.getFilteredColumnHandler),this.parent.off(Rs,this.cMenuBeforeOpenHandler),this.parent.on(E.filterCboxValue,this.filterCboxValueHandler),this.parent.off(Ma,this.getFilterRangeHandler),this.parent.off(Pa,this.filterCellKeyDownHandler),this.parent.off(Ct,this.setFilteredCollection),this.parent.off(ds,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(E.filterDialogCreated,this.filterDialogCreatedHandler),this.parent.off(E.filterDialogClose,this.removeFilterClass),this.parent.off(fn,this.duplicateSheetFilterHandler),this.parent.off(E.fltrPrevent,this.beforeFilteringHandler),this.parent.off(E.beforeCustomFilterOpen,this.customFilterOpen))},c.prototype.getModuleName=function(){return"filter"},c.prototype.isInValidFilterRange=function(e,t){var t=te(y(t||e.selectedRange)),r=!1;return 0===e.usedRange.colIndex&&0===e.usedRange.rowIndex&&J.isNullOrUndefined(e.rows[e.usedRange.rowIndex])&&(r=!0),t[0]>e.usedRange.rowIndex||t[1]>e.usedRange.colIndex||r},c.prototype.filterRangeAlertHandler=function(e){var r=this;this.parent.serviceLocator.getService(k).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:ae(r.parent.element)}}),this.parent.hideSpinner()},c.prototype.beforeFilterMenuOpenHandler=function(e){var t=this.parent.serviceLocator.getService(A),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)},c.prototype.addMenuItem=function(e,t,r,n){r=this.parent.createElement("li",{className:r+" e-menu-item"});r.innerText=t,r.insertBefore(this.parent.createElement("span",{className:"e-menu-icon e-icons "+n}),r.firstChild),e.insertBefore(r,e.firstChild)},c.prototype.initiateFilterUIHandler=function(t){function r(){e&&e.resolve()}var e,n=this,i=t?t.predicates:null,o=t.sIdx,s=(o||0===o||(o=t.isOpen?0:this.parent.activeSheetIndex),t.promise&&(e=new V.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,s,!1),r();else{var a=ne(this.parent,o);if(this.isInValidFilterRange(a,t.range))c=this.parent.serviceLocator.getService(A),this.filterRangeAlertHandler({error:c.getConstant("FilterOutOfRangeError")}),r();else{var l,h,d,p,c=t.range||a.selectedRange;if(!s){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||!s&&c!==l.range?s||(c=l.range):(p=Q(c))[0]===p[2]&&p[1]===p[3]&&(c=ee(p=Yn(p[0],p[1],a)),s||(l.range=c)),i){if(i.length)return(p=this.filterRange.get(o))&&(t.useFilterRange=p.useFilterRange,t.allowHeaderFilter=p.allowHeaderFilter),this.processRange(a,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]=a.usedRange.rowIndex),p[1]=p[3]=R(i[0].field),d=a.name+"!"+this.getPredicateRange(p,i.slice(1,i.length)),p=ee(p),void ai(this.parent,d,!0,!0,null,!0,null,null,!1,p).then(function(e){n.filterSuccessHandler(new V.DataManager(e),{action:"filtering",filterCollection:i,field:i[0].field,sIdx:t.sIdx,isInternal:s,isOpen:t.isOpen,prevPredicates:l&&l.previousPredicates}),r()});this.clearFilterHandler({sheetIndex:o})}else this.processRange(a,o,c,!1,t.useFilterRange,t.allowHeaderFilter);r(),s||(this.parent.notify(oe,h),ae(this.parent.element))}}},c.prototype.processRange=function(e,t,r,n,i,o){r=te(y(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)},c.prototype.removeFilter=function(e,t,r){var n,i=this.filterRange.get(e),o=i.range.slice(),i=i.allowHeaderFilter,s=ee(o);if(!t){if(this.parent.notify(gt,n={action:"filter",eventArgs:{range:s,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(oe,n)},c.prototype.filterByCellValueHandler=function(){var e,t,r,n,i,o,s,a,l=this,h=this.parent.activeSheetIndex,d=this.parent.getActiveSheet();this.isInValidFilterRange(d)?(a=this.parent.serviceLocator.getService(A),this.filterRangeAlertHandler({error:a.getConstant("FilterOutOfRangeError")})):(a=Q(d.activeCell),this.isFilterRange(h,a[0],a[1])||(e=!0,this.processRange(d,h)),s=ee(r=(t=this.filterRange.get(h)).range.slice()),r[0]=r[0]+1,r[2]=d.usedRange.rowIndex,r[1]=r[3]=a[1],n=le(a[1]+1),o=ie(a[0],a[1],d),o=li(this.parent,o,a[0],a[1]),i=[{field:n,operator:"equal",type:this.getColumnType(d,a[1],a).type,matchCase:!1,value:o}],(a=[].slice.call(this.filterCollection.get(h))).length||(a=void 0),this.parent.notify(gt,{action:"filter",eventArgs:o={range:s,predicates:i,previousPredicates:a,sheetIndex:h,cancel:!1,allowHeaderFilter:!1}}),o.cancel?e&&this.removeFilter(h,!0):(o.allowHeaderFilter&&(t.allowHeaderFilter=o.allowHeaderFilter,r[0]--),s=d.name+"!"+this.getPredicateRange(r,this.filterCollection.get(h)),a=ee(r),ai(this.parent,s,!0,!0,null,!0,null,null,!1,a).then(function(e){l.filterSuccessHandler(new V.DataManager(e),{action:"filtering",filterCollection:i,field:n,isFilterByValue:!0})})))},c.prototype.renderFilterCellHandler=function(e){var t=J.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,s=le(e.colIndex+1),a=this.filterCollection.get(t),l=0;l<a.length;l++)if(a[l].field===s){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),r&&this.parent.notify(ga,{targetElement:e.td,rowIndex:e.rowIndex,columnIndex:e.colIndex}))}}},c.prototype.refreshFilterRange=function(e,t,r,n){for(var i,o,s,a=r,r=(a||0===a||(a=this.parent.activeSheetIndex),this.filterRange&&this.filterRange.get(a)),l=(r?(e=e||r.range.slice(),n=r.allowHeaderFilter):e=e||[0,0,0,0],e),h=this.parent.frozenColCount(ne(this.parent,a)),d=l[1];d<=l[3];d++)i=n?(i=(i=d<h?this.parent.sheetModule.getSelectAllTable():this.parent.getColHeaderTable())&&this.parent.getRow(0,i))&&this.parent.getCell(0,d,i):this.parent.getCell(l[0],d),t?i&&(o=i.querySelector(".e-filter-btn"))&&(s=!1,0<i.children.length&&-1<i.children[i.childElementCount-1].className.indexOf("e-addNoteIndicator")&&(i.removeChild(i.children[i.childElementCount-1]),s=!0),o.parentElement.removeChild(o),s)&&this.parent.notify(ga,{targetElement:i,rowIndex:l[0],columnIndex:d}):this.renderFilterCellHandler({td:i,rowIndex:l[0],colIndex:d,sIdx:a});this.parent.sortCollection&&this.parent.notify(mt,null)},c.prototype.isFilterCell=function(e,t,r){e=this.filterRange.get(e)&&this.filterRange.get(e).range;return e&&e[0]===t&&e[1]<=r&&e[3]>=r},c.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},c.prototype.getFilteredColumnHandler=function(t){var e,r,n,i,o=J.isUndefined(t.sheetIndex)?this.parent.activeSheetIndex:t.sheetIndex,s=this.parent.serviceLocator.getService(A);t.clearFilterText=s.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=ne(this.parent,o)).activeCell),this.isFilterRange(o,n[0],n[1])&&(t.field=le(n[1]+1),o=ie(i[0],n[1],r),i=this.parent.getDisplayText(o),t.clearFilterText=s.getConstant("ClearFilterFrom")+'"'+(i?i.toString():"Column "+t.field)+'"',e.some(function(e){return t.isFiltered=e.field===t.field,t.isFiltered}))))},c.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))},c.prototype.closeDialog=function(){var e,t=document.querySelector(".e-filter-popup");t&&t.id.includes(this.parent.element.id)&&(e=J.getComponent(t,"dialog"),J.EventHandler.remove(t,$h(),this.filterMouseDownHandler),e&&e.hide(),this.parent.notify(E.filterDialogClose,null))},c.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")},c.prototype.isPopupOpened=function(){var e=document.getElementsByClassName("e-filter-popup")[0];return e&&e.id.includes(this.parent.element.id)&&"none"!==e.style.display},c.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)))},c.prototype.filterMouseDownHandler=function(e){var t;J.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(E.parentsUntil(e,"e-cell")||E.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()))},c.prototype.cboxListSelected=function(e,t,r,n,i){n=E.parentsUntil(n.target,"e-ftrchk");if(n){var o=i&&n.querySelector(".e-add-current");if(o)return o.classList.contains("e-check")?(J.classList(o,["e-uncheck"],["e-check"]),t.length||(e.btnObj.element.disabled=!0),!1):(J.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 s=n.querySelector(".e-frame").classList.contains("e-check"),a=void 0,l=void 0,h=i?2:1,d=e.element.childElementCount;h<d;h++)a=e.element.children[h].querySelector(".e-frame"),J.removeClass([a],["e-check","e-stop","e-uncheck"]),s?(e.element.children[h].querySelector(".e-chk-hidden").checked=!1,a.classList.add("e-uncheck"),t.splice(0,1)):(e.element.children[h].querySelector(".e-chk-hidden").checked=!0,a.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),E.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},c.prototype.initCboxList=function(h,d){var n,i,p,c,u,f=this,g=h.column.field,e=new V.DataManager(h.dataSource).executeLocal((new V.Query).sortBy(g+"_value","ascending")),m=[],o=this.parent.getActiveSheet(),v=this.parent.serviceLocator.getService(A),s=document.createDocumentFragment(),a=this.createSelectAll(h,d),l=(s.appendChild(a),{}),y=[],C=[],b=(e.forEach(function(e){var t,r;""===e[g]?l.isBlank||(l.isBlank=!0,(t={})[g]=v.getConstant("Blanks"),n=fh(o,Number(e.__rowIndex)-1),r=E.createCboxWithWrap(E.getUid("cbox"),d.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)||(y.push(t[g]),C.push(t[g])):l[e[g]]||(l[e[g]]=!0,n=fh(o,Number(e.__rowIndex)-1),i=e[g],s.appendChild(E.createCboxWithWrap(E.getUid("cbox"),d.createCheckbox(i,!n,e),"e-ftrchk")),m.push(i),n)||(y.push(i),C.push(i))}),h.element.appendChild(s),a.querySelector(".e-frame")),x=(b.classList.add("e-selectall"),a.querySelector(".e-chk-hidden")),S=(this.updateState(h,b,x,C.length!==m.length,C.length),[].slice.call(h.element.childNodes));h.element.addEventListener("click",function(e){var t;p?null!==(t=f.cboxListSelected(h,p,h.element.childElementCount-2,e,!0))&&(u=t):f.cboxListSelected(h,C,m.length,e)});this.wireFilterEvents(h,function(){if(c)if(u){var e;C=y;for(var t=0,r=c.length;t<r;t++)e=c[t],c.length===p.length||-1<p.indexOf(e)?-1===C.indexOf(e)&&C.push(e):-1<(e=C.indexOf(e))&&C.splice(e,1)}else C=p;var n=C.length;if(n===m.length)f.filterSuccessHandler(new V.DataManager(h.dataSource),{action:"clear-filter",field:h.column.field});else{var i=[],o={field:g,ignoreAccent:!1,matchCase:!1,isFilterByMenu:!0},s=J.getNumberDependable(A,J.defaultCurrencyCode),a=J.getNumericObject(f.parent.locale),l=function(e){var t=h.type;"number"===t&&(e===v.getConstant("Blanks")?(e="",t="string"):Y(Jn([e],f.parent.locale,s,a)[0])||(t="string")),i.push(Object.assign({value:e,type:t},o))};if(n>m.length/2){o.operator="notequal",o.predicate="and";for(t=0,r=m.length;t<r;t++)-1===C.indexOf(m[t])&&l(m[t])}else{o.operator="equal",o.predicate="or";for(t=0,r=n;t<r;t++)l(C[t])}d.initiateFilter(i)}},function(e){var r;if("keyup"===e.event.type)r=e.event.target.value.toLowerCase();else if(e.event.target.classList.contains("e-search-icon"))return;var t,n=document.createDocumentFragment();n.appendChild(a),r?(c=[],p=[],m.forEach(function(e){var t;e.toLowerCase().includes(r)&&((t={})[h.column.field]=e,n.appendChild(E.createCboxWithWrap(E.getUid("cbox"),d.createCheckbox(e,!0,t),"e-ftrchk")),c.push(e),p.push(e))}),p.length?(f.updateState(h,b,x,!1,0),a.classList.remove("e-hide"),(e={})[h.column.field]=v.getConstant("AddCurrentSelection"),e=E.createCboxWithWrap(E.getUid("cbox"),d.createCheckbox(e[h.column.field],!1,e),"e-ftrchk"),n.insertBefore(e,n.children[1]),e.querySelector(".e-frame").classList.add("e-add-current")):(a.classList.add("e-hide"),e=f.parent.createElement("div",{className:"e-checkfltrnmdiv"}),(t=f.parent.createElement("span")).innerText=v.getConstant("NoResult"),e.appendChild(t),n.appendChild(e),h.btnObj.element.disabled=!0)):S&&(c=p=null,f.updateState(h,b,x,C.length!==m.length,C.length),a.classList.remove("e-hide"),S.forEach(function(e){n.appendChild(e)})),h.element.innerHTML="",h.element.appendChild(n)}.bind(this))},c.prototype.createSelectAll=function(e,t){var r={};return r[e.column.field]=this.parent.serviceLocator.getService(A).getConstant("SelectAll"),E.createCboxWithWrap(E.getUid("cbox"),t.createCheckbox(r[e.column.field],!1,r),"e-ftrchk")},c.prototype.updateState=function(e,t,r,n,i){J.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},c.prototype.beforeFilteringHandler=function(n){var s,e,t,a=this;n.instance&&n.instance.options&&(n.isOpen&&"string"===n.instance.options.type&&"."!==(e=J.getNumericObject(this.parent.locale)).decimal&&2===(t=n.arg3.toString().split(".")).length&&(t=t.join(e.decimal),Y(new J.Internationalization(this.parent.locale).parseNumber(t,{format:"n"})))&&(n.arg3=t),s=function(e,t){var r,n,i,o;return t&&("notequal"===t||a.isCustomNumFilter(t))?e?Y(e)?e=parseFloat(e.toString()):"string"==typeof e&&(i=J.getNumericObject(a.parent.locale),r=new J.Internationalization(a.parent.locale),o={},(o=!e.includes(i.percentSign)||""===(n=e.trim().split("%"))[0]||n[1]?o:kn({value:n[0]},a.parent.locale,i.group,i.decimal)).isNumber?e=Number(o.value)/100:Y(n=r.parseNumber(e.trim(),{format:"n"}))?e=n:(i=e.trim(),a.parent.notify(Ft,o={value:i,cell:{value:i}}),(o.isTime||o.isDate)&&(e=parseFloat(o.updatedVal)))):"notequal"===t&&null===e&&(e=""):"equal"===t&&(Y(e)?e=e.toString():"string"==typeof e&&Y(s(e,"notequal"))?e=e.trim():null===e&&(e="")),e},"date"!==n.instance.options.type?(n.arg3=s(n.arg3,n.arg2),n.arg8=s(n.arg8,n.arg7)):"yMd"===n.instance.options.format&&(e=function(e,t){var r;return e&&("string"==typeof e?(r=e.trim(),a.parent.notify(Ft,r={value:r,cell:{value:r}}),r.isDate?e="equal"===t?r.dateObj:parseFloat(r.updatedVal):"equal"!==t&&"notequal"!==t||(Y(r=s(e,"notequal"))?(n.instance.options.type="number","notequal"===t&&(e=r)):n.instance.options.type="string")):Rn(e)&&"equal"!==t&&(e=En(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))))},c.prototype.customFilterOpen=function(e){for(var t=document.querySelectorAll(".e-xlfl-optrdiv input.e-dropdownlist"),r=[],n=0;n<t.length;n++){var i=J.getComponent(t[n],"dropdownlist");i&&r.push(i.value)}var o=[];if(2===r.length)for(var s,a=this.filterCollection.get(this.parent.activeSheetIndex),n=0;n<a.length;n++)a[n].field===e.column&&null!==a[n].value&&-1<(s=r.indexOf(a[n].operator))&&("equal"===a[n].operator&&Rn(a[n].value)?o[s]=En(a[n].value,!0).toString():o[s]=a[n].value.toString(),r[s]="");function l(e){if("."!==h.decimal&&Y(e)){var t=e.toString();if(t.includes("."))return t.replace(".",h.decimal)}return e}var h=J.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(A).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=Y(o[n])?this.parent.getDisplayText({value:o[n],format:xo("ShortDate")+(o[n].includes(".")?" "+xo("Time"):"")}):l(o[n]),(u=J.getComponent(c[n],"datepicker"))&&(u.value=f,c[n].value=f)},c.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(nh,r),n.parent.off(E.filterDialogClose,i),ae(n.parent.element)});this.parent.on(E.filterDialogClose,i,this),this.parent.on(nh,r,this)},c.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,s,a,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(s=e[t.column.field])&&Date.parse(s.toString())?(i=s.getFullYear().toString(),f[""+i]||((d={__rowIndex:i,hasChild:!0})[t.column.field]=i,g.push(d),f[""+i]=!0),h=s.getMonth(),f[a=i+" "+(o=C[h])]||((d={__rowIndex:a,pId:i,hasChild:!0,month:h})[t.column.field]=o,m.push(d),f[a]=!0),h=s.getDate(),l=a+" "+h.toString(),f[""+l]||((d={__rowIndex:l,pId:a})[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(A).getConstant("Blanks")),f[""+l]||((d={__rowIndex:l})[t.column.field]=i,y.push(d),r(e)))}),g=new V.DataManager(g).executeLocal((new V.Query).sortBy(t.column.field,"decending")),m=new V.DataManager(m).executeLocal((new V.Query).sortBy("month","ascending")),v=new V.DataManager(v).executeLocal((new V.Query).sortBy(t.column.field,"ascending")),v=g.concat(m.concat(v)),y.length&&(y=new V.DataManager(y).executeLocal((new V.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 F.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 V.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))},c.prototype.generatePredicate=function(e,t,r,n,i,o){function s(){"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 a(){(h=new Date(Number(l[0]),u[l[1]],Number(l[2]))).getDate()?c.push(Object.assign({value:h,type:t},f)):s()}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(" "),a());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?a:s)()}n.initiateFilter(c)},c.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;s.length&&!t.fields.dataSource.length&&((e=t.element.parentElement).getElementsByClassName("e-spreadsheet-ftrchk")[0].classList.remove("e-hide"),J.detach(e.getElementsByClassName("e-checkfltrnmdiv")[0])),t.fields.dataSource=s,t.dataBind()}if(o){var o,s=new V.DataManager(e).executeLocal((new V.Query).where(new V.Predicate(t.fields.text,"contains",o,!0))),a={},l=[],h=void 0,n=void 0,d=void 0,p=void 0;if(isNaN(Number(o))){for(var c=0;c<s.length;c++)s[c].hasChild&&(l.push(new V.Predicate("pId","equal",s[c].__rowIndex,!1)),a[""+(h=s[c].pId)]||(l.push(new V.Predicate("__rowIndex","equal",h,!1)),a[""+h]=!0));n=s,p=1}else{for(var u,f={},d=[],c=0;c<s.length;c++)(h=s[c].pId)?(u=h.split(" ")[0],a[""+h]||(l.push(new V.Predicate("__rowIndex","equal",h,!1)),a[""+h]=!0,d.push(u),d.push(h)),f[""+u]||(a[""+u]||(l.push(new V.Predicate("__rowIndex","equal",u,!1)),a[""+u]=!0),l.push(new V.Predicate("__rowIndex","equal",s[c].__rowIndex,!1)))):f[""+(h=s[c].__rowIndex)]||(l.push(new V.Predicate("__rowIndex","contains",h,!1)),f[""+h]=!0);n=[]}s.length?(l.length&&(s=n.concat(new V.DataManager(e).executeLocal((new V.Query).where(V.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(A).getConstant("NoResult"),p.appendChild(o),n.appendChild(p))}else s=e,i(),t.checkedNodes=r,t.dataBind()},c.prototype.openDialog=function(h){var d,p,c=this,e=parseInt(h.getAttribute("aria-colindex"),10),u=le(e),t=(this.parent.showSpinner(),this.parent.activeSheetIndex),r=this.filterRange.get(t),n=r.range.slice(),i=this.parent.getActiveSheet(),o=ie(n[0],e-1,i),f=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),g=r.otherColPredicate,m=r.curPredicate,t=(m.length&&((d={})[u]=m),i.name+"!"+r.address),o=ee(o),i=this.getColumnType(i,e-1,n),v=i.type,y="date"===v||i.isDateAvail,C="number"===v,b=y||C,x=i.isMultiFormattedCol;b&&!r.filteredCol&&(p=[]),ai(this.parent,t,!0,!0,null,!0,null,null,!1,o,null,p).then(function(e){c.parent.element.style.position="relative",c.parent.element.classList.add("e-filter-open"),l=b?(s=p||!g.length?new V.DataManager(p||e):(i=c.getPredicates(g),i=ri(new V.DataManager(e),i.predicates,i.equalOrPredicates),new V.DataManager(i)),c.parent.on(rh,t=function(e){c.parent.off(rh,t),e.isCheckboxFilterTemplate=!0,y?c.initTreeView(e,a):c.initCboxList(e,a)},c),[]):(s=g.length?(l=c.getPredicates(g),i=ri(new V.DataManager(e),l.predicates,l.equalOrPredicates),new V.DataManager(i)):new V.DataManager(e),c.getClonedPredicates(m));var t,r,n,i=h.querySelector(".e-filter-btn"),o={field:u,filter:{}},s=(C&&(r=c.parent,o.filterTemplate=function(e){if(!r.isReact||!e)return[r.createElement("input",{className:"e-ss-filter-input"})];e.appendChild(r.createElement("input",{className:"e-ss-filter-input"}))},o.getFilterTemplate=function(){return a=o.filterTemplate,function(e,t,r,n,i,o,s){return a(s)};var a},r.isReact)&&!r.renderTemplates&&(r.renderTemplates=function(e){return e()}),{type:v,field:u,format:"date"===v?"yMd":null,displayName:f||"Column "+u,dataSource:s||[],height:c.parent.element.classList.contains("e-bigger")?800:500,columns:[],hideSearchbox:!1,filteredColumns:l,column:o,handler:c.filterSuccessHandler.bind(c,new V.DataManager(e)),target:i,position:{X:0,Y:0},localeObj:c.parent.serviceLocator.getService(A),actualPredicate:d,isFormatted:b&&!y,isMultiFormattedCol:x}),a=new E.ExcelFilterBase(c.parent,c.getLocalizedCustomOperators()),l=(a.openDialog(s),document.querySelector(".e-filter-popup"));l&&l.id.includes(c.parent.element.id)&&(J.EventHandler.add(l,$h(),c.filterMouseDownHandler,c),e=c.parent.element.getBoundingClientRect(),s=i.getBoundingClientRect(),i=l.getBoundingClientRect(),(n=s.right-e.left-i.width)<0&&(n=s.left-e.left),l.style.left=n+"px",l.style.top="0px",l.style.visibility="hidden",l.classList.contains("e-hide")&&l.classList.remove("e-hide"),n=s.bottom-e.top,0<i.height-(e.bottom-s.bottom)&&(n-=i.height-(e.bottom-s.bottom))<0&&(n=0),l.style.top=n+"px",l.style.visibility=""),c.parent.hideSpinner()})},c.prototype.getPredicateRange=function(t,e,r){var n,i,o,s=ee(t),a=[],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),s.includes(i)||(s+=","+i,o<t[1]&&(t[1]=o),o>t[3]&&(t[3]=o)),void 0!==r)&&(o===r?(n=!0,l):a).push(e)}):n=!0,void 0===r?s:{address:s,filteredCol:n,otherColPredicate:a,curPredicate:l}},c.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")},c.prototype.filterCboxValueHandler=function(e){var t;e.column&&e.data&&(t=e.column.field,e.value)&&(t=ie((t=W(t+e.data.dataObj.__rowIndex))[0],t[1],this.parent.getActiveSheet()))&&t.format&&(e.value=this.parent.getDisplayText(t))},c.prototype.selectSortItemHandler=function(e){var t=this.parent.serviceLocator.getService(A),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),Bd(this.parent,i))this.closeDialog(),this.parent.notify($a,null);else{this.parent.sortCollection=this.parent.sortCollection||[];for(var o=[],s=this.parent.sortCollection.length-1;0<=s;s--)this.parent.sortCollection[s]&&this.parent.sortCollection[s].sheetIndex===n&&(o.push(this.parent.sortCollection[s]),this.parent.sortCollection.splice(s,1));this.parent.sortCollection.push({sortRange:ee(i),columnIndex:y(e.activeCell)[1],order:r,sheetIndex:n}),this.parent.notify(oa,{sortOptions:{sortDescriptors:{order:r},containsHeader:!1},previousSort:o,range:ee(i)}),this.refreshFilterRange(),this.closeDialog()}}},c.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]=ne(this.parent,r).usedRange.rowIndex),this.applyFilter(i,ee(e.range),r,n,!1,t.isInternal,t.isFilterByValue))},c.prototype.isCustomNumFilter=function(e){return e.includes("greaterthan")||e.includes("lessthan")||"between"===e},c.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)&&Y(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},c.prototype.updatePredicate=function(e,t){for(var r=new V.DataManager(e),n=new V.Query,i=r.executeLocal(n.where("field","equal",t)),o=0;o<i.length;o++){for(var s=-1,a=0;a<e.length;a++)if(e[a].field===i[o].field){s=a;break}-1!==s&&e.splice(s,1)}},c.prototype.applyFilter=function(e,t,r,n,i,o,s){var a=this,l={range:t,predicates:[].slice.call(this.filterCollection.get(r)),previousPredicates:n,sheetIndex:r,cancel:!1};!o&&!s&&(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},s=Md(this.parent),this.parent.notify(tr,n),r=Md(this.parent),this.parent.notify(El,{prevChartIndexes:s,currentChartIndexes:r}),n.promise.then(function(e){return a.refreshFilterRange(),a.parent.hideSpinner(),o||(delete l.cancel,a.parent.notify(oe,{action:"filter",eventArgs:l}),document.activeElement.id!==a.parent.element.id+"_SearchBox"&&ae(a.parent.element)),Promise.resolve(e)}).catch(function(e){return a.filterRangeAlertHandler({error:e}),Promise.reject(e)}))},c.prototype.getPredicates=function(e){var o,t=[],r=this.getClonedPredicates(e,t);if(t.length){for(var n,i,s,a=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--,a.has(n)?a.get(n).push(i):a.set(n,[i]));o=[],a.forEach(function(e){s=[];for(var t=E.CheckBoxFilterBase.getPredicate(e),r=0,n=Object.keys(t);r<n.length;r++){var i=n[r];s.push(t[""+i])}o.push(s)})}for(var h=[],d=E.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}},c.prototype.getColumnType=function(e,t,r){for(var n,i,o,s,a=0,l=0,h=0,d=r[0];d<=r[2];d++)if(n=ie(d,t,e)){if(n.format&&"General"!==n.format){switch(So(n.format).toLowerCase()){case"number":case"currency":case"accounting":case"percentage":a++;break;case"shortdate":case"longdate":h++;break;case"time":a++;break;default:_i(n.format,!0,i={})?"date"===i.type?h++:a++:Y(n.value)?a++:n.value&&l++}o=o||n.format}else Y(n.value)?a++:n.value&&l++;o&&o!==n.format&&(s=!0)}return{type:l<a&&h<a&&0<a?"number":a<=l&&h<=l&&0<=l?"string":a<h&&l<h&&0<h?"date":"datetime",isDateAvail:!!h,isMultiFormattedCol:s}},c.prototype.clearFilterHandler=function(e){var t=e&&void 0!==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:ee(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=ne(this.parent,t),o=this.filterRange.get(t),s=o.range;if(!r||(n={range:ee(s),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 a=o.useFilterRange?s[2]:i.usedRange.rowIndex;if(this.parent.scrollSettings.enableVirtualization&&a-s[0]+1>this.parent.viewport.rowCount+2*this.parent.getThreshold("row")){for(var l=0;l<=a;l++)uh(i,l,{hidden:!1,isFiltered:!1});e&&e.preventRefresh||this.parent.renderModule.refreshSheet(!1,!1,!0)}else{this.refreshFilterRange(null,null,t);o={startIndex:s[0],hide:!1,isFiltering:!0,refreshUI:!1,endIndex:o.useFilterRange?s[2]:i.usedRange.rowIndex,sheetIndex:t};this.parent.notify(Lr,o),!o.refreshUI||e&&e.preventRefresh||this.parent.renderModule.refreshSheet(!1,!1,!0)}r&&(delete n.cancel,this.parent.notify(oe,{action:"filter",eventArgs:n}),ae(this.parent.element))}}}},c.prototype.reapplyFilterHandler=function(r,n){var i,o,e,t,s=this,a=this.parent.activeSheetIndex;this.filterRange.has(a)&&(i=this.filterCollection.get(a))&&i.length&&(t=ne(this.parent,a),e=(o=this.filterRange.get(a)).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)),ai(this.parent,t,!0,!0,null,!0,null,null,!1,ee(e)).then(function(e){var t=s.getPredicates(s.filterCollection.get(a));s.applyFilter({predicates:t.predicates,datasource:new V.DataManager(e),equalOrPredicates:t.equalOrPredicates},ee(o.range),a,[].slice.call(i),n,r)}))},c.prototype.getFilterRangeHandler=function(e){var t=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)},c.prototype.getLocalizedCustomOperators=function(){var e=this.parent.serviceLocator.getService(A),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")}]}},c.prototype.setFilteredCollection=function(o){var s=this,e={sheetIdx:o.sheetIdx};if(this.getFilterRangeHandler(e),e.hasFilter){for(var t,a,l={sheetIndex:o.sheetIdx,filterRange:ee(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 J.isNullOrUndefined(e)?"":o.isSaveAction&&"date"===a?(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?(a=Rn(t.value)?"date":"string",l.value.push(h(t.value)),l.dataType.push(a)):(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,s.getColData(d,t,o.sheetIdx));for(var r=p.get(t),e=s.getPredicates(e).predicates,n=new V.DataManager(r).executeLocal((new V.Query).where(V.Predicate.and(e))),i=0;i<n.length;i++)l.column.push(d),l.criteria.push("equal"),a=Rn(n[i][t])?"date":"string",l.value.push(h(n[i][t])),l.dataType.push(a),l.predicates.push("or")})}},c.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 s=(r=this.parent.filterCollection[o]).sheetIndex;if(0!==o||this.parent.isOpen||e.isOpen||(s=0),t=[],r.column)for(var a=0;a<r.column.length;a++)if(i={field:le(r.column[a]+1),operator:this.getFilterOperator(r.criteria[a]),value:"string"==typeof r.value[a]?r.value[a].split("*").join(""):r.value[a],predicate:r.predicates&&r.predicates[a],type:r.dataType&&r.dataType[a]},-1<["year","month","day"].indexOf(i.type)){var l={value:i.value,cell:{value:i.value}};if(this.parent.notify(Ft,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[a],i.field,o));for(var d=new V.DataManager(n[i.field]).executeLocal((new V.Query).where(V.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)&&Y(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(Na,{predicates:t.length?t:void 0,range:r.filterRange,sIdx:s,isInternal:!0,isOpen:e.isOpen})}this.parent.sortCollection&&this.parent.notify(mt,null),this.parent.filterCollection=null}},c.prototype.getColData=function(e,t,r){var n=ne(this.parent,r);if(!n.rows||!n.rows.length)return[];for(var i,o,s=[],a=1,l=n.rows.length;a<l;a++)n.rows[a]&&(o=ie(a,e,n,!1,!0))&&o.value&&((i={})[t]=li(this.parent,o,a,e),s.push(i));return s},c.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},c.prototype.beforeInsertHandler=function(r){if("Column"===r.modelType){var e,t=(J.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=le(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)})}},c.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,s=i.length-1;0<=s;s--){var a=R(i[s].field);e.end<a?i[s].field=le(a-(e.end-e.start+1)+1):e.start<=a&&e.end>=a&&(o=!0,i.splice(s,1))}var l=this.parent.sortCollection;if(l)for(s=0;s<l.length;s++)if(l[s].sheetIndex===t){if(e.end<l[s].columnIndex){l[s].columnIndex=l[s].columnIndex-(e.end-e.start+1);break}if(e.start<=l[s].columnIndex&&e.end>=l[s].columnIndex){l.splice(s,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))}}}},c.prototype.deleteSheetHandler=function(e){if(J.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}},c.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(),Pn(e.indices,t[0],t[1]))&&Pn(e.indices,t[0],t[3])&&this.removeFilter(e.sheetIndex)},c.prototype.duplicateSheetFilterHandler=function(e){this.filterCollection.has(e.sheetIndex)&&this.filterCollection.set(e.newSheetIndex,this.filterCollection.get(e.sheetIndex)),this.filterRange.has(e.sheetIndex)&&this.filterRange.set(e.newSheetIndex,this.filterRange.get(e.sheetIndex))},c.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 s=0;s<o.length;s++)this.parent.sortCollection.push({sortRange:ee(i),columnIndex:R(o[s].field),order:o[s].order,sheetIndex:r});else this.parent.sortCollection.push({sortRange:ee(i),columnIndex:y(t.activeCell)[1],order:o.order,sheetIndex:r})}};var Ec=c;function c(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()}Nc.prototype.addEventListener=function(){this.parent.on(ml,this.insertImage,this),this.parent.on(yl,this.refreshImgCellObj,this),this.parent.on(xl,this.createImageElement,this),this.parent.on(Sl,this.deleteImage,this),this.parent.on(Rl,this.refreshInsDelImagePosition,this)},Nc.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)},Nc.prototype.imageSelect=function(e){var t=e.target.files[0];t&&(t.type.includes("image")?this.insertImage({file:t}):this.parent.serviceLocator.getService(k).show({content:this.parent.serviceLocator.getService("spreadsheetLocale").getConstant("UnsupportedFile"),width:"300"}),e.target.value="")},Nc.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(ml,this.insertImage),this.parent.off(yl,this.refreshImgCellObj),this.parent.off(xl,this.createImageElement),this.parent.off(Sl,this.deleteImage),this.parent.off(Rl,this.refreshInsDelImagePosition))},Nc.prototype.insertImage=function(e,t){var r=this;this.binaryStringVal(e).then(function(e){return r.createImageElement({options:{src:e},range:t,isPublic:!0})})},Nc.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)}})},Nc.prototype.createImageElement=function(e){var t,r,n=e.range?0<e.range.indexOf("!")?e.range.split("!")[1]:e.range.split("!")[0]:this.parent.getActiveSheet().selectedRange,i=e.range&&0<e.range.indexOf("!")?B(this.parent,e.range.split("!")[0]):this.parent.activeSheetIndex,o=this.parent.serviceLocator.getService(Fh),s=e.options.imageId||J.getUniqueID(this.parent.element.id+"_overlay_picture_"),a=Q(n),l=J.isUndefined(i)?this.parent.getActiveSheet():this.parent.sheets[i];this.parent.element.querySelector("#"+s)||(t={requestType:"beforeInsertImage",range:l.name+"!"+n,imageData:e.options.src,sheetIndex:i},e.isPublic&&this.parent.notify("actionBegin",{eventArgs:t,action:"beforeInsertImage"}),t.cancel)||((r=o.insertOverlayElement(s,n,i)).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",J.isNullOrUndefined(e.options.top)||(r.element.style.top=Number(Pd(e.options.top).toFixed(2))+"px"),J.isNullOrUndefined(e.options.left)||(r.element.style.left=Number(Pd(e.options.left).toFixed(2))+"px")),(l.frozenRows||l.frozenColumns)&&o.adjustFreezePaneSize(e.options,r.element,n),o={src:e.options.src,id:s,height:parseFloat(r.element.style.height.replace("px","")),width:parseFloat(r.element.style.width.replace("px","")),top:l.frozenRows||l.frozenColumns?a[0]?vh(l,0,a[0]-1):0:(J.isNullOrUndefined(e.options.top)?r:e.options).top,left:l.frozenRows||l.frozenColumns?a[1]?Ih(l,0,a[1]-1):0:(J.isNullOrUndefined(e.options.left)?r:e.options).left},this.parent.setUsedRange(a[0],a[1]),(e.isPublic||e.isUndoRedo)&&this.parent.notify(Ur,{options:[o],range:l.name+"!"+n}),(r=ie(a[0],a[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+"!"+n,imageHeight:e.options.height||300,imageWidth:e.options.width||400,imageData:e.options.src,id:s,sheetIndex:i},this.parent.notify("actionComplete",{eventArgs:t,action:"insertImage"})))},Nc.prototype.refreshInsDelImagePosition=function(e){for(var t,r,n,i=e.count,o=e.sheetIdx,o=this.parent.sheets[o],s=ie(e.rowIdx,e.colIdx,o),a=s.image.length,l=0;l<a;l++)t=document.getElementById(s.image[l].id),r="Row"===e.type?"insert"===e.status?s.image[l].top+20*i:s.image[l].top-20*i:s.image[l].top,n="Column"===e.type?"insert"===e.status?s.image[l].left+64*i:s.image[l].left-64*i:s.image[l].left,s.image[l].top=r,s.image[l].left=n,t.style.top=r+"px",t.style.left=n+"px"},Nc.prototype.refreshImgCellObj=function(e){var t,r,n=J.isUndefined(e.sheetIdx)?this.parent.activeSheetIndex:e.sheetIdx,n=ne(this.parent,n),i=ie(e.prevRowIdx,e.prevColIdx,n),o=ie(e.currentRowIdx,e.currentColIdx,n),s=i?i.image:[],a=s&&s.length?s.length:0;if(i&&i.image&&0<s.length){for(var l=0;l<a;l++)s[l]&&s[l].id===e.id&&((t=s[l]).height=e.currentHeight,t.width=e.currentWidth,t.top=e.currentTop,t.left=e.currentLeft,s.splice(l,1));o&&o.image&&(r=o.image,t)&&r.push(t),Mi(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"}))}},Nc.prototype.deleteImage=function(e){var t,r,n=e.sheet||this.parent.getActiveSheet(),i=document.getElementById(e.id),o=e.rowIdx,s=e.colIdx;if(i){if(void 0===e.rowIdx&&void 0===e.colIdx&&(r=a=void 0,n.frozenRows||n.frozenColumns?(a={clientY:(t=i.getBoundingClientRect()).top},r={clientX:t.left},t.top<this.parent.getColumnHeaderContent().getBoundingClientRect().bottom&&(a.target=this.parent.getColumnHeaderContent()),t.left<this.parent.getRowHeaderContent().getBoundingClientRect().right&&(r.target=this.parent.getRowHeaderTable())):(a={clientY:parseFloat(i.style.top),isImage:!0},r={clientX:parseFloat(i.style.left),isImage:!0}),this.parent.notify(Cl,a),this.parent.notify(bl,r),o=a.clientY,s=r.clientX),t=n.name+"!"+G(o,s),!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||(a=e.range?0<e.range.indexOf("!")?e.range.split("!")[1]:e.range.split("!")[0]:this.parent.getActiveSheet().selectedRange,r=e.range&&0<e.range.indexOf("!")?B(this.parent,e.range.split("!")[0]):this.parent.activeSheetIndex,o=(i=Q(a))[0],s=i[1],n=this.parent.sheets[r]);for(var a=ie(o,s,n),l=a&&a.image?a.image:[],h={},d=l.length-1;0<=d;d--)l[d].id===e.id&&(h=l.splice(d,1)[0]);Mi(o,s,n,{image:l},!0),e.preventEventTrigger||this.parent.notify(oe,{action:"deleteImage",eventArgs:{address:t,id:h.id,imageData:h.src,imageWidth:h.width,imageHeight:h.height,cancel:!1}})},Nc.prototype.destroy=function(){this.removeEventListener(),this.parent=null},Nc.prototype.getModuleName=function(){return"spreadsheetImage"};var Rc=Nc;function Nc(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);kc.prototype.addEventListener=function(){this.parent.on(zr,this.initiateChartHandler,this),this.parent.on(Il,this.refreshChartCellObj,this),this.parent.on(El,this.refreshChartCellModel,this),this.parent.on(xn,this.refreshChartCellObj,this),this.parent.on(Gr,this.updateChartHandler,this),this.parent.on(wl,this.deleteChart,this),this.parent.on(kl,this.clearBorder,this),this.parent.on(Fl,this.insertChartHandler,this),this.parent.on(Ol,this.chartRangeHandler,this),this.parent.on(Ll,this.chartDesignTabHandler,this),this.parent.on(Pl,this.updateChartElement,this),this.parent.on(Ml,this.undoRedoForChartDesign,this)},kc.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(_r,{chart:[{type:r,markerSettings:{visible:n,isFilled:!0}}]}),Ph(function(){ae(t.parent.element)})):this.parent.notify(Ll,{chartType:r,triggerEvent:!0,markerVisible:n})},kc.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.parent.notify(zr,{option:r[i],isRefresh:!0})}},kc.prototype.updateChartHandler=function(e){var t,r=this.initiateChartHandler({option:e.chart,isRefresh:!0}),e=this.parent.element.querySelector("."+e.chart.id);e&&(t=J.getComponent(e,"chart"),(t=J.isNullOrUndefined(t)?J.getComponent(e,"accumulationchart"):t).series=r,t.refresh())},kc.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,s=e.currentChartIndexes[t].chartRowIdx,a=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:s,currentColIdx:a,currentHeight:n.height,currentWidth:n.width,id:n.id,requestType:"chartRefreshOnFilter"};this.parent.notify(Il,i)}},kc.prototype.refreshChartCellObj=function(e){var t,r,n=J.isUndefined(e.sheetIdx)?this.parent.activeSheetIndex:e.sheetIdx,i=ne(this.parent,n),o=ie(e.prevRowIdx,e.prevColIdx,i),s=ie(e.currentRowIdx,e.currentColIdx,i),a=o?o.chart:[],l=a&&a.length?a.length:0;if(l){for(var h=0;h<l;h++)if(a[h].id===e.id.split("_overlay")[0]){(t=a[h]).height=e.currentHeight,t.width=e.currentWidth,t.top=e.currentTop,t.left=e.currentLeft,a.splice(h,1);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)}s&&s.chart&&(r=s.chart,t)&&r.push(t),Mi(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"}))}},kc.prototype.processChartRange=function(e,t,r){function n(e,t,r,n){var i,o;return!(r=ie(e,t,ne(l.parent,r)))||(o=void 0,o=r.format?(e={value:r.value,format:r.format,formattedText:r.value,cell:r,rowIndex:e,colIndex:t},l.parent.notify(St,e),(t=Y(r.value))&&!_i(r.format,!0,null,!0)?(i=new RegExp("[!@#$%^&()+=';,{}|\":<>~_-]","g"),e.formattedText=e.formattedText.toString().replace(i,""),parseInt(e.formattedText.toString(),10)):(n&&t&&(a=!0),e.formattedText&&e.formattedText.toString())):r.value,J.isNullOrUndefined(o))?"":o}var i,o,s,a,l=this,h=e[0],d=e[1],p=!1,c=e[2],e=e[3],u=h===c,f=d===e,g=n(h,e,t,!0),m=n(c,d,t),t=n(h,d,t);return Y(m)&&t||(p=!0),!J.isNullOrUndefined(t)&&("Scatter"!==r.type||r.isSeriesInRows)||u||f?J.isNullOrUndefined(m)||!p||u||f||a?(o=[h,d,c,e],J.isNullOrUndefined(g)||Y(g)||a?J.isNullOrUndefined(t)&&(u||f)&&(s=[h,d,h,e],u?(o[1]=o[1]+1,s[3]=s[1]):o[0]=o[0]+1):(s=[h,d,h,e],o[0]=o[0]+1)):J.isNullOrUndefined(g)||Y(g)&&t?(i=[h,d,c,d],o=[h,d+1,c,e]):(i=[h+1,d,c,d],o=[h+1,d+1,c,e],s=[h,d+1,h,e]):(i=[h+1,d,c,d],o=[h+1,d+1,c,e],s=[h,d+1,h,e]),{xRange:i,yRange:o,lRange:s,isStringSeries:p}},kc.prototype.toIntrnlRange=function(e,t){return e?"string"==typeof e&&(e=Q[""+e]):e=Q[this.parent.sheets[t].selectedRange],e},kc.prototype.getRangeData=function(e){e.range=this.toIntrnlRange(e.range,e.sheetIdx);var t=[];return this.pushRowData(e,e.range[0],e.range[1],e.range[2],e.range[3],t,[],!0,e.isYvalue),t},kc.prototype.pushRowData=function(e,t,r,n,i,o,s,a,l){for(var h,d,p=r,c=this.parent.sheets[e.sheetIdx];t<=n;){if($(c,t));else for(r=p;r<=i;)Eh(c,r)?r++:(d=(h=ie(t,r,c,!1,!0)).format&&!l?(d={value:h.value,format:h.format,formattedText:h.value,rowIndex:t,colIndex:r,cell:h},this.parent.notify(St,d),d.formattedText?d.formattedText.toString():null):h.value||(0===h.value?0:null),o.push({value:d}),r++);t++}s.push(t)},kc.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},kc.prototype.getVirtualXValues=function(e){for(var t=1,r=[];t<e;)r.push(t.toString()),t++;return r},kc.prototype.processChartSeries=function(e,t,r,n,i){e=e||{};var o,s,a,l,h,d,p,c="",u={},f={},g=0,m=0,v=this.parent.isPrintingProcessing,y=[],C=(t=J.isNullOrUndefined(t)?this.parent.getActiveSheet().index:t,this.parent.sheets[t]),b=this.getRangeData({range:n,sheetIdx:t,skipFormula:!0,isYvalue:!0}),x=n[2]-n[0]+1-this.parent.hiddenCount(n[0],n[2],"rows",C),C=n[3]-n[1]+1-this.parent.hiddenCount(n[1],n[3],"columns",C),S=e.isSeriesInRows?(o=i?this.toArrayData(this.getRangeData({range:i,sheetIdx:t,skipFormula:!1,isYvalue:!1})):this.getVirtualXValues(1+C),r&&(s=this.toArrayData(this.getRangeData({range:r,sheetIdx:t,skipFormula:!1,isYvalue:!1}))),x):(o=r?this.toArrayData(this.getRangeData({range:r,sheetIdx:t,skipFormula:!1,isYvalue:!1})):this.getVirtualXValues(1+x),i&&(s=this.toArrayData(this.getRangeData({range:i,sheetIdx:t,skipFormula:!1,isYvalue:!1}))),C),w=o.length,I=e.isSeriesInRows?1:S;for(J.isNullOrUndefined(e.dataLabelSettings)||(u.visible=e.dataLabelSettings.visible,u.position=e.dataLabelSettings.position);g<S;){for(l=0,a=[],m=e.isSeriesInRows?m:g;l<w;)b[m]&&(d=Y(d=b[m].value)?Number(d):(h={value:J.isNullOrUndefined(d)?"":d.toString(),sheetIndex:t,updatedVal:""},this.parent.notify(Ft,h),h.isDate||h.isTime?h.updatedVal:0),J.isNullOrUndefined(o[l])&&!J.isNullOrUndefined(d)&&(o[l]=J.getUniqueID("spread-chart-empty-label-")),a.push({x:o[l],y:d})),m+=I,l++;var E,R,N,c=s&&0<s.length?s[g]:"Scatter"===e.type?"series"+(g+1):"series"+g;J.isNullOrUndefined(c)&&(c=""),e.type&&(f="Line"===(E=e.type)||"StackingLine"===E||"StackingLine100"===E?{dataSource:a,type:e.type,xName:"x",yName:"y",name:c.toString(),animation:{enable:!v},marker:e.markerSettings?{visible:e.markerSettings.visible,width:e.markerSettings.size,height:e.markerSettings.size,shape:e.markerSettings.shape,dataLabel:u,isFilled:e.markerSettings.isFilled,border:e.markerSettings.border,fill:e.markerSettings.isFilled?e.markerSettings.fill:null}:{dataLabel:u}}:"Scatter"===E?{dataSource:a,type:e.type,xName:"x",yName:"y",name:c.toString(),animation:{enable:!v},marker:{visible:!1,width:12,height:12,shape:"Circle",dataLabel:u}}:"Pie"===E||"Doughnut"===E?(E="Pie"===e.type?"0%":"40%",R=u.visible,N=!J.isNullOrUndefined(u.position)&&"Outer"===u.position?"Outside":"Inside",{dataSource:a,dataLabel:{visible:!J.isNullOrUndefined(R)&&R,position:N,name:"text",font:{fontWeight:"600"}},animation:{enable:!v},radius:"100%",xName:"x",yName:"y",innerRadius:E}):{dataSource:a,type:e.type,xName:"x",yName:"y",animation:{enable:!v},name:c.toString(),marker:{dataLabel:u}}),y.push(f),g++}return p=e.type?{series:y,xRange:e.isSeriesInRows?i:r,yRange:n,lRange:e.isSeriesInRows?r:i}:p},kc.prototype.primaryYAxisFormat=function(e){var t="";return J.isNullOrUndefined(e)||(e=ie(e[0],e[1],this.parent.getActiveSheet()))&&e.format&&(t=e.format),t},kc.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(Al,{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(Al,{startcell:{rowIndex:e[0],colIndex:e[1]},endcell:{rowIndex:e[2],colIndex:e[3]},classes:[i[2],i[3]]})),o&&n?this.parent.notify(Al,{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(Al,{startcell:{rowIndex:t[0],colIndex:t[1]},endcell:{rowIndex:t[2],colIndex:t[3]},classes:[i[4],i[5]]})},kc.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){J.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]),s=0,a=o.length;s<a;s++)o[s].classList.remove(r[n])},kc.prototype.initiateChartHandler=function(e){var t,r=this,n=e.option,i=!!J.isNullOrUndefined(e.isInitCell)||!e.isInitCell,o=(e.triggerEvent=!!J.isNullOrUndefined(e.triggerEvent)||e.triggerEvent,e.isRefresh=!J.isNullOrUndefined(e.isRefresh)&&e.isRefresh,n.range&&0<n.range.indexOf("!")?B(this.parent,n.range.split("!")[0]):this.parent.activeSheetIndex),s=ne(this.parent,o),a=Q(d=n.range||this.parent.getActiveSheet().selectedRange),l={};if(this.parent.allowChart||!s.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,h=(0<a.length&&a[2]-a[0]<a[3]-a[1]&&(p=!0),(l=l||{}).isSeriesInRows=!!p||l.isSeriesInRows||!1,e.dataSheetIdx=J.isNullOrUndefined(e.dataSheetIdx)?o:e.dataSheetIdx,this.processChartRange(a,e.dataSheetIdx,l)),p=h.xRange,a=h.yRange,c=h.lRange;if(o===this.parent.activeSheetIndex&&i&&this.focusChartRange(p,a,c),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,p,a,c),i={majorGridLines:n.primaryXAxis&&n.primaryXAxis.majorGridLines&&!J.isNullOrUndefined(n.primaryXAxis.majorGridLines.width)?{width:n.primaryXAxis.majorGridLines.width}:{width:0},minorGridLines:n.primaryXAxis&&n.primaryXAxis.minorGridLines&&!J.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||h.isStringSeries||n.isSeriesInRows?"Category":"Double",rangePadding:"Scatter"!==n.type||h.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&&!J.isNullOrUndefined(n.primaryYAxis.majorGridLines.width)?{width:n.primaryYAxis.majorGridLines.width}:{width:1},minorGridLines:n.primaryYAxis&&n.primaryYAxis.minorGridLines&&!J.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&&(p=this.parent.element.querySelector("."+n.id))&&(J.getComponent(p,"chart").primaryXAxis.valueType=h.isStringSeries||n.isSeriesInRows?"Category":"Double"),o.series;var c=n.id+"_overlay",p=this.parent.serviceLocator.getService(Fh),h=!J.isNullOrUndefined(e.isInitCell)&&e.isInitCell?e.range:d,d=p.insertOverlayElement(c,h,N(this.parent,h)),c=(d.element.classList.add("e-datavisualization-chart"),d.element.style.width=n.width+"px",d.element.style.height=n.height+"px",s.frozenRows||s.frozenColumns?p.adjustFreezePaneSize(n,d.element,h):(J.isNullOrUndefined(n.top)?n.top=d.top:d.element.style.top=Number(Pd(n.top).toFixed(2))+"px",J.isNullOrUndefined(n.left)?n.left=d.left:d.element.style.left=Number(Pd(n.left).toFixed(2))+"px"),this.parent.notify(Wl,{height:n.height,width:n.width}),"Pie"===n.type||"Doughnut"===n.type?{position:"Bottom",visible:!0}:{}),s=(J.isNullOrUndefined(n.legendSettings)||(c.visible=n.legendSettings.visible,c.position=n.legendSettings.position),this.parent.createElement("div",{id:n.id,className:n.id})),p=n.theme||"Material",u=this.primaryYAxisFormat(a),h=2*Math.round(parseFloat(getComputedStyle(d.element).borderWidth)),a=parseFloat(d.element.style.height)-(isNaN(h)?0:h)+"px";"Pie"!==n.type&&"Doughnut"!==n.type?this.chart=new v.Chart({primaryXAxis:i,primaryYAxis:l,background:this.getThemeBgColor(p),chartArea:{border:{width:0}},title:n.title,legendSettings:c,theme:p,series:o.series,tooltip:{enable:!0},width:d.element.style.width,height:a,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&&!J.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&&(e.text=Y(e.text)?e.text:(e.axis.labels.indexOf(e.text)+1).toString())}}):this.chart=new v.AccumulationChart({title:n.title,legendSettings:c,theme:p,background:this.getThemeBgColor(p),series:o.series,width:d.element.style.width,height:a,center:{x:"50%",y:"50%"},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(s),d.element.appendChild(s),d.element.classList.contains("e-ss-overlay-active")&&!this.parent.isPrintingProcessing&&this.parent.notify(Tl,{id:d.element.id}),e.triggerEvent&&this.parent.notify(oe,{eventArgs:t,action:"insertChart"})}},kc.prototype.deleteChart=function(e){this.clearBorder();var t=null,r=this.parent.getActiveSheet();if(J.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)),!J.isNullOrUndefined(e.id)){e.id=e.id.includes("overlay")?e.id:e.id+"_overlay";for(var n,i,o=!1,s=0,a=this.parent.chartColl.length;s<a;s++)if(this.parent.chartColl[s].id===e.id.split("_overlay")[0]){i=this.parent.chartColl[s];break}for(var l,h,d={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},p=(r=t?(p=h=void 0,r.frozenRows||r.frozenColumns?(h={clientY:(l=t.getBoundingClientRect()).top},p={clientX:l.left},l.top<this.parent.getColumnHeaderContent().getBoundingClientRect().bottom&&(h.target=this.parent.getColumnHeaderContent()),l.left<this.parent.getRowHeaderContent().getBoundingClientRect().right&&(p.target=this.parent.getRowHeaderTable())):(h={clientY:parseFloat(t.style.top),isImage:!0},p={clientX:parseFloat(t.style.left),isImage:!0}),this.parent.notify(Yr,{id:e.id}),this.parent.notify(Cl,h),this.parent.notify(bl,p),o=!0,l=h.clientY,h=p.clientX,this.parent.sheets[this.parent.activeSheetIndex]):(this.parent.notify(Yr,{id:e.id}),t=e.range&&0<e.range.indexOf("!")?B(this.parent,e.range.split("!")[0]):this.parent.activeSheetIndex,l=(p=Q(e.range?0<e.range.indexOf("!")?e.range.split("!")[1]:e.range.split("!")[0]:this.parent.getActiveSheet().selectedRange))[0],h=p[1],this.parent.sheets[t]),ie(l,h,r)),c=(n=p?p.chart:n)?n.length:null,s=0;s<c;s++)e.id===n[s].id+"_overlay"&&(n.splice(s,1),c=n.length);o&&(document.getElementById(e.id).remove(),this.parent.notify(Dl,{})),Mi(l,h,r,{chart:n},!0),d.posRange=G(l,h),e.isUndoRedo||this.parent.notify(oe,{eventArgs:d,action:"deleteChart"})}},kc.prototype.updateChartModel=function(e,t,r,n,i){var o=t,s=this.parent.chartColl[n].id;if(!(i&&-1<["PHAxes","PVAxes","PHAxisTitle","PVAxisTitle","GLMajorHorizontal","GLMajorVertical","GLMinorHorizontal","GLMinorVertical"].indexOf(e)))for(var a,l=0,h=r.chart.length;l<h;l++)if(r.chart[l].id===s)switch(e){case"PHAxes":case"PHAxisTitle":J.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":J.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":J.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,a=void 0,a=i?"Outside"===o.series[0].dataLabel.position?"Outer":"Middle":t.series[0].marker.dataLabel.position,r.chart[l].dataLabelSettings.position=a,this.parent.chartColl[n].dataLabelSettings.position=a);break;case"GLMajorHorizontal":J.isNullOrUndefined(r.chart[l].primaryYAxis)&&(r.chart[l].primaryYAxis={},this.parent.chartColl[n].primaryYAxis={}),J.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":J.isNullOrUndefined(r.chart[l].primaryXAxis)&&(r.chart[l].primaryXAxis={},this.parent.chartColl[n].primaryXAxis={}),J.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":J.isNullOrUndefined(r.chart[l].primaryYAxis)&&(r.chart[l].primaryYAxis={},this.parent.chartColl[n].primaryYAxis={}),J.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":J.isNullOrUndefined(r.chart[l].primaryXAxis)&&(r.chart[l].primaryXAxis={},this.parent.chartColl[n].primaryXAxis={}),J.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":J.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)}},kc.prototype.updateChartElement=function(e,t,r,n,i,o,s,a){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),a&&(r={addChartEle:e,id:t.element.id+"_overlay",title:i,address:s},this.parent.notify(oe,{action:"chartDesign",eventArgs:r}))}},kc.prototype.undoRedoForChartDesign=function(e){var t=document.getElementById(e.id);if(t){for(var r,n=this.getChartElement(t),t=J.getComponent(n,"chart"),i=(J.isNullOrUndefined(t)&&(t=J.getComponent(n,"accumulationchart")),this.parent.getAddressInfo(e.address)),i=ie(i.indices[0],i.indices[1],ne(this.parent,i.sheetIndex)),o=this.getChartCollectionId(n.id),s=e.addChartEle,a=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=!J.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(s){case"DLNone":case"DLCenter":case"DLInsideend":case"DLInsidebase":case"DLOutsideend":s="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":s="Right"===(d=r.legendSettings&&r.legendSettings.position)?"LegendsRight":"Left"===d?"LegendsLeft":"Bottom"!==d&&"Top"===d?"LegendsTop":"LegendsBottom";break;case"PVAxisTitle":a=r.primaryYAxis&&r.primaryYAxis.title;break;case"PHAxisTitle":a=r.primaryXAxis&&r.primaryXAxis.title;break;case"ChartTitleNone":case"ChartTitleAbove":a=r.title}}this.updateChartElement(s,t,i,o,a,null,e.address)}}},kc.prototype.chartDesignTabHandler=function(e){var t=!1,r=this.parent.sheets[this.parent.activeSheetIndex],n=e.switchRowColumn,i=e.chartType,o=e.chartTheme,s=e.addChartEle,a=null,l=e.id?document.getElementById(e.id):document.querySelector(".e-datavisualization-chart.e-ss-overlay-active");if(l){var h="ChartTitleAbove"===s||"PHAxisTitle"===s||"PVAxisTitle"===s,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(Cl,c),this.parent.notify(bl,u),ie(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&&(a=J.getComponent(c,"chart"),J.isNullOrUndefined(a))&&(a=J.getComponent(c,"accumulationchart"),t=!0),n&&!t&&this.switchRowColumn(f,u,a,d),i&&this.switchChartType(f,u,i,a,d,e.markerVisible),o&&this.switchChartTheme(f,u,o,a,d),s)if(h&&!e.title){if(0<this.parent.element.getElementsByClassName("e-title-dlg").length)return;this.titleDlgHandler(s,a,d,f,t,r,e.triggerEvent)}else this.updateChartElement(s,a,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(oe,{action:"chartDesign",eventArgs:p}))}},kc.prototype.switchRowColumn=function(e,t,r,n){this.parent.chartColl[e].isSeriesInRows=!!J.isNullOrUndefined(this.parent.chartColl[e].isSeriesInRows)||!this.parent.chartColl[e].isSeriesInRows;for(var i=0,o=n.chart.length;i<o;i++)n.chart[i].id===t&&(n.chart[i].isSeriesInRows=this.parent.chartColl[e].isSeriesInRows);var s=this.initiateChartHandler({option:this.parent.chartColl[e],isRefresh:!0,isSwitchRowColumn:!0});r.series=s},kc.prototype.switchChartTheme=function(e,t,r,n,i){this.parent.chartColl[e].theme=r;for(var o=0,s=i.chart.length;o<s;o++)i.chart[o].id===t&&(i.chart[o].theme=r);n.setProperties({theme:r,background:this.getThemeBgColor(r)},!0),n.refresh()},kc.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"FluentDark":t="#1b1a19";break;case"Fluent2Dark":t="#292929";break;case"Material3Dark":t="#1C1B1F"}else t=e.includes("HighContrast")?"#000000":"#FFFFFF";return t},kc.prototype.switchChartType=function(e,t,r,n,i,o,s,a){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,J.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&&Y(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=J.isNullOrUndefined(f[d].marker.shape)?"Circle":f[d].marker.shape,"undoRedo"===a&&(f[d].marker.visible=s)):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)},kc.prototype.getChartElement=function(e){var t=e.querySelector(".e-chart");return t=J.isNullOrUndefined(t)?e.querySelector(".e-accumulationchart"):t},kc.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},kc.prototype.changeCharType=function(e){var t=document.getElementById(this.parent.chartColl[e].id),r=J.closest(t,".e-datavisualization-chart");r.remove(),this.parent.notify(zr,{option:this.parent.chartColl[e],isInitCell:!1,triggerEvent:!1,isPaste:!1}),t=document.getElementById(this.parent.chartColl[e].id),(r=J.closest(t,".e-datavisualization-chart")).classList.contains("e-ss-overlay-active")||r.classList.add("e-ss-overlay-active")},kc.prototype.titleDlgHandler=function(t,r,n,i,e,o,s){var a,l,h=this;e&&("PHAxisTitle"===t||"PVAxisTitle"===t)||(e=this.parent.serviceLocator.getService(A),(l=this.parent.serviceLocator.getService(k)).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];a=e.getElementsByTagName("input")[0].value,l.hide(),h.updateChartElement(t,r,n,i,a,null,o,s)}}]}),l.dialogInstance.refresh())},kc.prototype.titleDlgContent=function(e,t){var r=this.parent.serviceLocator.getService(A),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},kc.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(zr,this.initiateChartHandler),this.parent.off(Il,this.refreshChartCellObj),this.parent.off(xn,this.refreshChartCellModel),this.parent.off(El,this.refreshChartCellModel),this.parent.off(Gr,this.updateChartHandler),this.parent.off(wl,this.deleteChart),this.parent.off(kl,this.clearBorder),this.parent.off(Fl,this.insertChartHandler),this.parent.off(Ol,this.chartRangeHandler),this.parent.off(Ll,this.chartDesignTabHandler),this.parent.off(Pl,this.updateChartElement),this.parent.off(Ml,this.undoRedoForChartDesign))},kc.prototype.destroy=function(){this.removeEventListener();var e=this.parent=null;this.chart&&(e=this.chart.element,this.chart.destroy()),e&&J.detach(e),this.chart=null},kc.prototype.getModuleName=function(){return"spreadsheetChart"};var Ac=kc;function kc(e){this.parent=e,this.addEventListener()}Oc.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!J.isNullOrUndefined(e.dataSource)})&&(this.allowTimer=!0,n=e.sheets[o],i=y(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])}},Oc.prototype.activeSheetPrint=function(e,t,r,n){this.pageCounts=this.calculatePageCount(t,1e3,r.allowRowColumnHeader),this.initialRowCount=0,this.parent.currentPrintSheetIndex=n,this.endRow=t.rows.length,this.processCell(0,0,this.endRow,2,[],void 0,void 0,t,this,0,0,!0,n,r)},Oc.prototype.processCell=function(p,e,c,I,E,R,N,A,k,F,O,t,T,D){for(var L=this,P=(void 0===F&&(F=0),void 0===O&&(O=0),void 0===t&&(t=!0),0),M=D.allowRowColumnHeader,B=37,H=0,K=(this.chartHeight=0,!1),V=p;V<this.pageCounts.length;V++){this.chartLoadedCount=0,this.totalCharts=0,this.imageLoadedCount=0,this.totalImages=0,F+=0===V?0:1100,N=document.createElement("canvas"),R=N.getContext("2d"),N.width=1e3,N.height=1100,R.font="11pt Calibri",R.textBaseline="bottom",R.index=V,R.width=1e3,!t&&(this.isImageLoaded||this.isChartLoaded)||(E=[],O=I=0);for(var U=e;U<this.endRow;U++){var _=!(t=!0),z=(this.isColumn=this.isColumn||0===U,{borderBottom:"1px solid black"}),j=A.rows[U]&&A.rows[U].height||this.defaultCellHeight,q=(this.initialRowCount=U,I=P,0===V?0:this.pageCounts[V-1]+1),W=this.pageCounts[V],G=(O+=J.isNullOrUndefined(A.rows[U])?this.defaultCellHeight:j+(0===U&&M?this.defaultCellHeight:0),!J.isNullOrUndefined(A.rows[U])&&A.rows[U]&&A.rows[U].height||this.defaultCellHeight);if(1080<O){if(this.startNewPageCount=U,H=M?j+(0===U&&M?this.defaultCellHeight:0):0,_=!1,this.isColumn=!0,this.isImageLoaded||this.isChartLoaded)break;F+=1100,t&&this.multipleCanvasDataURL.push(N.toDataURL()),t=!0,N=document.createElement("canvas"),R=N.getContext("2d"),N.width=1e3,N.height=1100,R.font="11pt Calibri",R.textBaseline="bottom",R.index=V,R.width=1e3;for(var r=0;r<E.length;r++)void 0!==E[r]&&(E[r]-=O-G);O=M||D.allowGridLines?j+(M?this.defaultCellHeight:0):j}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=le(n+1),o=n===q?2:1;R.font="11pt Calibri";for(r=0;r<o;r++){var s,a,l=0===r&&2==o?B:A.columns[n]&&A.columns[n].hidden?0:A.columns[n]&&A.columns[n].width||this.defaultCellWidth;0!==(l=1e3<I+l?l-1-(I+l-1e3):l)?(s=R.measureText(i).width,s=k.calculateTextPosition(s,l,I,"Center"),a=this.defaultCellHeight,R.fillText(n===q&&0===r?"":i,s,a),k.drawBorder(R,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(J.isNullOrUndefined(A.rows[U])||!J.isNullOrUndefined(A.rows[U].hidden)&&A.rows[U].hidden){if(J.isNullOrUndefined(A.rows[U])){var h={borderBottom:"1px solid black",borderTop:"1px solid black",borderLeft:"1px solid black",borderRight:"1px solid black"};_=1080<O+G+(0===U&&M?this.defaultCellHeight:0)||U===A.rows.length-1||U===this.endRow-1;for(n=q;n<=W;n++){M&&n===q&&(k.rowHeaderText((U+1).toString(),R,k,B,I,h,E[n],this.defaultCellHeight),I+=B);var d=A.columns[n]&&A.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(R,h,I,E[n],d,G):M&&!D.allowGridLines&&n===W&&k.drawBorder(R,{borderRight:"1px solid black"},I,E[n],d,G),I+=d,n===W&&M&&_&&(k.drawBorder(R,z,0,E[n],I,G),_=!1),E[n]+=G}}}else for(var Z,_=this.endRow===A.rows.length&&(1080<O+(A.rows[U+1]&&A.rows[U+1].height||this.defaultCellHeight)+(0===U&&M?this.defaultCellHeight:0)||U===A.rows.length-1),X=this,n=q;n<=W;n++)!function(e){var n=A.rows[U]&&!J.isNullOrUndefined(A.rows[U].cells)&&A.rows[U].cells[e];if(J.isNullOrUndefined(A.columns[e])||J.isNullOrUndefined(A.columns[e].hidden)||!A.columns[e].hidden){var i,t=!J.isNullOrUndefined(A.rows[U].cells)&&!J.isNullOrUndefined(A.rows[U].cells[e])&&!isNaN(A.rows[U].cells[e].colSpan)&&q>e+A.rows[U].cells[e].colSpan,r=!(J.isNullOrUndefined(A.rows[U].cells)||J.isNullOrUndefined(A.rows[U].cells[e])||isNaN(A.rows[U].cells[e].rowSpan)||U+A.rows[U].cells[e].rowSpan>X.startNewPageCount||0===X.startNewPageCount),o="",s=J.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){R.font="11pt Calibri";var a=E[e];if(0<s)for(var l=0;l<(0===s?1:s);l++)a+=(I=0)===l?0:A.rows[U+l]&&A.rows[U+l-1].height||X.defaultCellHeight,k.rowHeaderText((U+1+l).toString(),R,k,B,I,Y,a,A.rows[U+l].height||X.defaultCellHeight),I+=B;else I=0,I+=B}if(!J.isNullOrUndefined(n)&&n){var h,r=n.style&&n.style.fontSize||"11pt",d=n.style&&n.style.color||"#000000";if(!isNaN(A.rows[U].cells[e].rowSpan)&&1<A.rows[U].cells[e].rowSpan&&isNaN(A.rows[U+1].cells[e].rowSpan)&&X.parent.merge(""+le(e+1)+(U+1)+":"+le(e+1)+(U+A.rows[U].cells[e].rowSpan-1)),!isNaN(A.rows[U].cells[e].colSpan)&&1<A.rows[U].cells[e].colSpan)if(!J.isNullOrUndefined(A.rows[U+1].cells)&&0<A.rows[U+1].cells.length&&!J.isNullOrUndefined(A.rows[U+1].cells[e])&&isNaN(A.rows[U+1].cells[e].colSpan))X.parent.merge(""+le(e+1)+(U+1)+":"+le(e+1+A.rows[U].cells[e].colSpan-1)+(U+1));else if(J.isNullOrUndefined(A.rows[U].cells[e+1].colSpan))for(var p=1;p<A.rows[U].cells[e].colSpan;p++)A.rows[U].cells[e+p].colSpan=-p;h=isNaN(A.rows[U].cells[e].colSpan)||t?1:Math.max(A.rows[U].cells[e].colSpan,0),A.rows[U].cells[e].rowSpan&&!t&&A.rows[U].cells[e].rowSpan<0&&(t=A.rows[U+A.rows[U].cells[e].rowSpan].cells[e].colSpan,h=t||h),(e===q||0<e&&A.columns&&A.columns[e-1]&&A.columns[e-1].hidden&&A.rows[U].cells[e-1]&&1<A.rows[U].cells[e-1].colSpan)&&h<=0&&(h=1);var t=n.style&&n.style.backgroundColor||"#ffffff",c=n.style?n.style.textAlign:"",u=(R.font=r,R.fillStyle=d,[]);if(1<h){for(var f=A.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?A.columns[e]&&A.columns[e].width||X.defaultCellWidth:0,i=1e3<I+i?i-1-(I+i-1e3):i,G=1<s?A.rows.slice(U,U+s).map(function(e){return e.height||L.defaultCellHeight}).reduce(function(e,t){return e+(t||L.defaultCellHeight)},0):1===s?j:0;var g,m,v,y,C,b,x,r=(n.style&&n.style.verticalAlign||"Bottom").toLowerCase();!J.isNullOrUndefined(n.image)&&0<n.image.length&&X.processImages(V,U,n,N,R,O,X.endRow,j,H,M,D,A,k,I,E,F,T),!J.isNullOrUndefined(n.chart)&&0<n.chart.length&&X.handleCharts(V,U,n,R,N,O,X.endRow,X.initialRowCount,H,j,M,D,A,k,X.multipleCanvasDataURL,I,E,F,T),J.isNullOrUndefined(n.value)&&J.isNullOrUndefined(n.formula)&&J.isNullOrUndefined(n.hyperlink)?k.rowHeaderRect(R,I,E[e],i,G,t):(g=n.formula&&n.format?(X.parent.workbookFormulaModule.refreshCalculate(U,e,n.formula,!0,T,!1),x={value:n.value,format:n.format,rowIndex:U,colIndex:e,sheetIndex:X.parent.activeSheetIndex,cell:n,refresh:!0},o=n.format?X.parent.workbookNumberFormatModule.getFormattedCell(x):n.value,""+(c||(x.isRightAlign?"Right":"Left"))):n.format?(x={value:n.value,format:n.format,rowIndex:U,colIndex:e,sheetIndex:X.parent.activeSheetIndex,cell:n,refresh:!0},o=n.format?X.parent.workbookNumberFormatModule.getFormattedCell(x):n.value,""+(c||(x.isRightAlign?"Right":"Left"))):n.formula?(X.parent.workbookFormulaModule.refreshCalculate(U,e,n.formula,!0,T,!1),o=n.value,""+(c||"Left")):(J.isNullOrUndefined(n.hyperlink)||(J.isNullOrUndefined(n.value)&&(n.value=n.hyperlink||n.hyperlink.address),d=n.style&&n.style.color||"#00e"),o=n.value,x=!J.isNullOrUndefined(n.value)&&""!==n.value&&new RegExp("^[^\\p{L}]*$","u").test(n.value),""+(c||(x?"Right":"Left"))),c=n.style&&n.style.fontSize||"11pt",x=n.style&&n.style.fontFamily||"Calibri",y=n.style&&n.style.fontStyle||"",S=n.style&&n.style.fontWeight||"normal",R.font=y+" "+S+" "+c+" "+x,m=R.measureText(o),v=m.width,y=m.actualBoundingBoxAscent+m.actualBoundingBoxDescent,n.wrap?(C=X.defaultCellHeight<G?parseInt(c.replace("pt",""),10)/72*96:G,x=1===(S=k.wrapText(R,o,i)).length?G:S.length*C!==G&&S.length*C<G?G-(S.length-1)*C:C,b=E[e]+("top"===r?C:"middle"===r&&C+x/4<x?C+x/4:x),R.save(),R.beginPath(),R.rect(I,E[e],i,G),R.clip(),R.fillStyle=t,R.fillRect(I,E[e],i,G+("top"===r?C:0)),S.forEach(function(e,t){R.fillStyle=d,m=R.measureText(e),v=m.width;var r=k.calculateTextPosition(v,i,I,g);R.fillText(e,r,b+t*C),k.textDecoration(n,R,r,b+t*C,d,m,o,i)}),R.restore()):(R.save(),R.beginPath(),R.rect(I,E[e],i,G),R.clip(),R.fillStyle=t,R.fillRect(I,E[e],i,G),R.fillStyle=d,c=k.calculateTextPosition(v,i,I,g),x=E[e]+("top"===r?y+2:"middle"===r&&G/2+y/2<G?G/2+y/2:G),R.fillText(o,c,x),R.restore(),k.textDecoration(n,R,c,x,d,m,o,i))),n.style&&(0<i||0<G)&&(n.style.borderBottom||n.style.borderTop||n.style.borderLeft||n.style.borderRight)&&k.drawBorder(R,n.style,I,E[e]<=0?2:E[e]-2,i,0<G?G:2)}var S=h<=0?i:i||A.columns[e]&&A.columns[e].width||X.defaultCellWidth,t=(D.allowGridLines&&(Y.borderRight=e===W&&M?void 0:"1px solid black",k.drawBorder(R,Y,I,E[e],S,G)),I+=S,0);if(1<s){for(t=E[e],p=e;p<e+h;p++){var w=A.rows[U]&&!J.isNullOrUndefined(A.rows[U].cells)&&A.rows[U].cells[p];w&&!J.isNullOrUndefined(w.image)?X.processImages(V,U,w,N,R,O,X.endRow,j,H,M,D,A,k,I,E,F,T):w&&!J.isNullOrUndefined(w.chart)&&X.handleCharts(V,U,w,R,N,O,X.endRow,X.initialRowCount,H,j,M,D,A,k,X.multipleCanvasDataURL,I,E,F,T),w.style&&p===e&&0<G&&(w.style.borderBottom||w.style.borderTop||w.style.borderLeft||w.style.borderRight)&&k.drawBorder(R,w.style,I,E[e],2,G),E[p]=(isNaN(E[p])?P:E[p])+G}e+=h-1}e===W&&M&&k.drawBorder(R,$,I-2,E[e]-t,2,G),e===W&&M&&_&&!K&&(k.drawBorder(R,z,0,E[e]-t,I,G),_=!1),s<=1&&(E[e]+=G)}else if(M&&e===q){s=J.isNullOrUndefined(n)||isNaN(A.rows[U].cells[e].rowSpan)?1:Math.max(A.rows[U].cells[e].rowSpan,0),a=(E[e]=isNaN(E[e])?P:E[e],E[e]);R.font="11pt Calibri";for(l=0;l<s;l++)a+=(I=0)===l?0:A.rows[U+l]&&A.rows[U+l-1].height||X.defaultCellHeight,k.rowHeaderText((U+1+l).toString(),R,k,B,I,Y,a,A.rows[U+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(N.toDataURL()),e=0,this.pageCounts.length-1===V&&k.canvasPrint(this.parent,T,D)}},Oc.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},Oc.prototype.handleCharts=function(s,r,e,a,l,h,t,n,d,p,c,u,f,g,m,v,y,C,b){var x=this;if(!J.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=J.isNullOrUndefined(i.left)?0:i.left,i.top=J.isNullOrUndefined(i.top)?0:i.top,document.getElementById(i.id));J.isNullOrUndefined(t)&&(S.parent.insertChart([i]),t=document.getElementById(i.id),S.chartElements.push(i.id+"_overlay")),J.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);a.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(s,r+1===e?e:r,e,v,y,a,l,f,g,C,h,!1,b,u)))},o.src=t,S.isChartLoaded=!0)}(o[i])},Oc.prototype.processImages=function(s,t,e,a,l,h,r,n,d,p,c,u,f,g,m,v,y){var C=this;if(!J.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=J.isNullOrUndefined(i.left)?0:i.left,i.top=J.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),a.height>h+(b.chartHeight-e)?b.endRow+=Math.ceil((b.chartHeight-e)/19):b.endRow+=Math.ceil((a.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(a.toDataURL()),r=C.initialRowCount===u.rows.length-1&&h<1080?u.rows.length:C.initialRowCount,e=C.endRow,C.processCell(s,r+1===e?e:r,e,g,m,l,a,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(a.toDataURL()),e=C.initialRowCount===u.rows.length-1&&h<1080?u.rows.length:C.initialRowCount,t=C.endRow,C.processCell(s,e+1===t?t:e,t,g,m,l,a,u,f,v,h,!1,y,c)))}}(o[i]);this.isImageLoaded=!0}},Oc.prototype.textDecoration=function(e,t,r,n,i,o,s,a){""!==s&&(!J.isNullOrUndefined(e.style)&&!J.isNullOrUndefined(e.style.textDecoration)&&-1<e.style.textDecoration.toLowerCase().indexOf("underline")||!J.isNullOrUndefined(e.hyperlink))&&(t.beginPath(),t.moveTo(r,n-3),t.lineTo(r+(o.width>a?a:o.width),n-3),t.strokeStyle=i,t.lineWidth=1,t.stroke())},Oc.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()},Oc.prototype.rowHeaderText=function(e,t,r,n,i,o,s,a){var l=t.measureText(e).width,l=r.calculateTextPosition(l,n,i,"Center"),h=s;t.save(),t.beginPath(),t.rect(i,s,n,a),t.clip(),t.fillStyle="#000000",t.fillText(e,l,h+a),r.drawBorder(t,o,i,s||0,n,a),t.restore()},Oc.prototype.canvasPrint=function(o,e,t){var s=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 a,i=0;i<this.chartElements.length;i++){var l=document.getElementById(this.chartElements[i]);J.isNullOrUndefined(l)||l.remove()}0<this.multipleCanvasDataURL.length&&(n=navigator.userAgent,(a=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")?(a.document.write("<!DOCTYPE html>"),a.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>")):(a.document.write("<!DOCTYPE html>"),a.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=a.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===s.multipleCanvasDataURL.length-1&&(o.isPrintingProcessing=!1,a.print(),a.document.close(),a.close(),o.printModule.setToDefault())},i.src=e,a.document.body.appendChild(r)}))}},Oc.prototype.drawBorder=function(e,t,r,n,i,o){var s=t.borderBottom,a=t.borderLeft,l=t.borderRight,h=t.borderTop,d=t.borderColor,t=t.borderWidth;e.strokeStyle=d||"black",e.lineWidth=t||1,J.isNullOrUndefined(s)||-1!==s.indexOf("#FFFFFF")||(this.drawPath(r,n+o,r+i,n+o,e),e.strokeStyle=s.split(" ")[2]),J.isNullOrUndefined(a)||-1!==a.indexOf("#FFFFFF")||(this.drawPath(r,n,r,n+o,e),e.strokeStyle=a.split(" ")[2]),J.isNullOrUndefined(l)||-1!==l.indexOf("#FFFFFF")||(this.drawPath(r+i,n,r+i,n+o,e),e.strokeStyle=l.split(" ")[2]),J.isNullOrUndefined(h)||-1!==h.indexOf("#FFFFFF")||(this.drawPath(r,n,r+i,n,e),e.strokeStyle=h.split(" ")[2])},Oc.prototype.drawPath=function(e,t,r,n,i){i.beginPath(),i.moveTo(e,t),i.lineTo(r,n),i.stroke()},Oc.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},Oc.prototype.calculatePageCount=function(e,t,r){var n=r,r=e.usedRange.colIndex;if(0===e.columns.length)return l=Math.floor(t/this.defaultCellWidth)-(n?1:0),Array(Math.max(1,Math.ceil(r/l))).fill(l);var i=0,o=!1,s=e.columns.length-1,a=e.usedRange.colIndex,l=Math.max(e.usedRange.rowIndex,e.rows.length-1);if(r<=s)for(var h=l;0<=h;h--){var d=e.rows[h];if(d&&d.cells)for(var p=s;p>e.usedRange.colIndex;p--)if(d.cells[p]){o=!0,a=Math.max(a,p);break}}for(var c=0===r?s:o?a:r,u=[],p=0;p<=c;p++){var f=e.columns&&e.columns[p],f=(n?27:0)+(f&&f.hidden?0:f&&!J.isNullOrUndefined(f.width)?f.width:this.defaultCellWidth),n=!1;t<(i+=f)&&(u.push(p-1),n=!0,i=f)}return(0===u.length||u[u.length-1]<c)&&u.push(c),u},Oc.prototype.wrapText=function(e,t,r){if(J.isNullOrUndefined(t))return[""];for(var n=(t="number"==typeof t?t+"":t).split(" "),i=[],o="",s=0;s<n.length;s++)var a=o+n[s]+" ",o=r<e.measureText(a).width&&0<s?(i.push(o),n[s]+" "):a;return i.push(o),i},Oc.prototype.getModuleName=function(){return"print"},Oc.prototype.destroy=function(){this.setToDefault(),this.totalSheetCount=[],this.parent=null};var Fc=Oc;function Oc(e){this.totalSheetCount=[],this.workbookActiveSheetCount=0,this.defaultCellWidth=64,this.defaultCellHeight=19,this.pageCounts=[],this.initialRowCount=0,this.chartHeight=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}Tc=function(e,t){return(Tc=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 Tc,Dc,Lc,Jp=function(e,t,r,n){var i,o=arguments.length,s=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;0<=a;a--)(i=e[a])&&(s=(o<3?i(s):3<o?i(t,r,s):i(t,r))||s);return 3<o&&s&&Object.defineProperty(t,r,s),s},hh=(function(e,t){function r(){this.constructor=e}Tc(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}(u,Dc=e),(Lc=u).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},u.prototype.getRow=function(e,t,r){var n,i;return t||(i=this.getActiveSheet(),n=this.frozenRowCount(i),i=this.frozenColCount(i),t=J.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},u.prototype.hiddenCount=function(e,t,r,n){void 0===r&&(r="rows"),void 0===n&&(n=this.getActiveSheet());for(var i,o=0,s=e;s<=t;s++)(i=n[""+r][s])&&i.hidden&&o++;return o},u.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},u.prototype.preRender=function(){Dc.prototype.preRender.call(this),this.serviceLocator=new es,this.initServices()},u.prototype.initServices=function(){this.serviceLocator.register(A,new J.L10n(this.getModuleName(),Lh,this.locale)),this.serviceLocator.register(k,new zp(this)),this.serviceLocator.register(kh,new qp(this)),this.serviceLocator.register(Fh,new Gp(this))},u.prototype.render=function(){var e;Dc.prototype.render.call(this),this.element.setAttribute("tabindex","0"),this.renderModule=new Kd(this),this.renderSpreadsheet(),this.wireEvents(),this.created&&(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)))},u.prototype.renderSpreadsheet=function(){this.cssClass&&J.addClass([this.element],this.cssClass.split(" ")),this.setHeight(),this.setWidth(),g.createSpinner({target:this.element},this.createElement),this.isMobileView()&&-1===this.cssClass.indexOf("e-mobile-view")&&this.element.classList.add("e-mobile-view"),J.Browser.isDevice&&this.element.classList.add("e-device"),this.sheetModule=this.serviceLocator.getService("sheet"),this.allowScrolling&&(this.scrollModule=new np(this)),this.scrollSettings.enableVirtualization&&new op(this),this.renderModule.render(),new gp(this)},u.prototype.showSpinner=function(){g.showSpinner(this.element)},u.prototype.hideSpinner=function(){g.hideSpinner(this.element)},u.prototype.protectSheet=function(e,t,r){Dc.prototype.protectSheet.call(this,e,t,r)},u.prototype.unprotectSheet=function(e){Dc.prototype.unprotectSheet.call(this,e)},u.prototype.find=function(e){var t=this.getActiveSheet().activeCell;if(Dc.prototype.findHandler.call(this,e),!e.isAction)return t!==this.getActiveSheet().activeCell?this.getActiveSheet().name+"!"+this.getActiveSheet().activeCell:null},u.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:J.isUndefined(e.sheetIndex)?this.activeSheetIndex:e.sheetIndex,findOpt:e.findOpt||""},Dc.prototype.replaceHandler.call(this,e)},u.prototype.findAll=function(e,t,r,n,i){i=i<this.sheets.length?i:this.activeSheetIndex;var o=[];return this.notify(Et,{value:e,mode:t=t||"Sheet",sheetIndex:i,isCSen:r=r||!1,isEMatch:n=n||!1,findCollection:o}),o},u.prototype.goTo=function(e){if(e.includes("!")){var t,r,n,i,o=B(this,xi(e));if(void 0===o)return;if(o!==this.activeSheetIndex)return d=(r=e.split("!")[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]||(s=this.frozenRowCount(t),p=this.frozenColCount(t),n=[],i=[],w=W(t.paneTopLeftCell),s?(n.push(d[0]),r[0]>=s?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 s=Q(e),a=this.getActiveSheet(),l=this.frozenRowCount(a),h=this.frozenColCount(a),d=this.insideViewport(s[0],s[1]);if(d){this.selectRange(e);var p=W(a.paneTopLeftCell),c=this.viewport.height-this.getScrollElement().parentElement.getBoundingClientRect().height,u=0,f=0;if(l)for(var g=W(a.topLeftCell)[0];g<l;g++)if(c<(u+=gh(a,g))){f=g;break}if(0===f)for(g=p[0];g<=this.viewport.bottomIndex;g++){if(c<(u+=gh(a,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(a.topLeftCell)[1];g<h;g++)if(c<(u+=wh(a,g))){m=g;break}if(0===m)for(g=p[1];g<=this.viewport.rightIndex;g++){if(c<(u+=wh(a,g))){m=g;break}g===this.viewport.rightIndex&&(m=this.viewport.rightIndex)}if(p[3]=m,s[0]>=p[0]&&s[0]<p[2]&&s[1]>=p[1]&&s[1]<p[3])return;if(l||h){if(p=[].concat(W(a.topLeftCell),[l,p[3]]),s[0]>=p[0]&&s[0]<p[2]&&s[1]>=p[1]&&s[1]<p[3])return;if(p[2]=f,p[3]=h,s[0]>=p[0]&&s[0]<p[2]&&s[1]>=p[1]&&s[1]<p[3])return}}var v,y,C,b,x,S,w=this.getMainContent().parentElement;s[0]===l?C=0:(C=vh(a,l,s[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",Ph(function(){v.style.height=x+"px"}))),w.scrollTop=C,w=this.element.getElementsByClassName("e-scroller")[0],s[1]===h?C=0:(C=Ih(a,h,s[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",Ph(function(){v.style.width=b+"px",y.style.width=b+"px"}))),w.scrollLeft=C,d||this.selectRange(e)},u.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},u.prototype.resize=function(){this.renderModule.setSheetPanelSize(),this.scrollSettings.enableVirtualization&&this.renderModule.refreshSheet(!1,!0)},u.prototype.cut=function(e){var t=new Promise(function(e){e(void 0)});return this.notify(Ps,e?{range:y(e),sId:(this.sheets[B(this,xi(e))]?this.sheets[B(this,xi(e))]:this.getActiveSheet()).id,promise:t,invokeCopy:!0,isPublic:!0}:{promise:t,invokeCopy:!0,isPublic:!0}),t},u.prototype.copy=function(e){var t=new Promise(function(e){e(void 0)});return this.notify(Ms,e?{range:y(e),sId:(this.sheets[B(this,xi(e))]?this.sheets[B(this,xi(e))]:this.getActiveSheet()).id,promise:t,invokeCopy:!0,isPublic:!0}:{promise:t,invokeCopy:!0,isPublic:!0}),t},u.prototype.paste=function(e,t){this.notify(Bs,{range:e&&y(e),sIdx:e&&B(this,xi(e)),type:t,isAction:!0,isInternal:!0})},u.prototype.updateAction=function(e){vd(e,this)},u.prototype.setHeight=function(){this.height&&(-1<this.height.toString().indexOf("%")&&(this.element.style.minHeight="400px"),this.element.style.height=J.formatUnit(this.height))},u.prototype.setWidth=function(){this.width&&((-1<this.width.toString().indexOf("%")||"auto"===this.width)&&(this.element.style.minWidth="300px"),this.element.style.width=J.formatUnit(this.width))},u.prototype.setColWidth=function(e,t,r){void 0===e&&(e=64),void 0===t&&(t=0);var n,i,o,s=J.isNullOrUndefined(r)?this.getActiveSheet():this.sheets[r];s&&(n=t,i="number"==typeof e?e+"px":e,t=J.isNullOrUndefined(t)?W(s.activeCell)[1]:t,r=function(){se(s,n).width=0<parseInt(i,10)?parseInt(i,10):0,s.columns[n].customWidth=!0},e=this.frozenColCount(s),s.id===this.getActiveSheet().id?(t>=this.viewport.leftIndex+e&&t<=this.viewport.rightIndex||e&&t<e?(t=this.getViewportIndex(t,!0),e=wh(s,n,null,!0),(o=dd(parseInt(i,10))-e)<0&&e<-o&&(o=-e),r(),this.notify(ea,{threshold:o,colIdx:n,checkWrapCell:!0}),fd(n,t,i,!0,this)):(e=wh(s,t),o=void 0,o=0<parseInt(i,10)?-(e-parseInt(i,10)):-e,r(),this.notify(ea,{threshold:o,colIdx:t})),this.notify(Yl,null)):r())},u.prototype.setRowHeight=function(e,t,r,n,i){void 0===e&&(e=20),void 0===t&&(t=0);var o,s,a,l=J.isNullOrUndefined(r)?this.getActiveSheet():this.sheets[r];l&&(o=t,t=J.isNullOrUndefined(t)?W(l.activeCell)[0]:t,i&&l.rows[t]&&l.rows[t].customHeight||(s="number"==typeof e?e+"px":e,r=function(){mh(l,o,0<parseInt(s,10)?parseInt(s,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=gh(l,o,!0),(a=dd(parseInt(s,10))-e)<0&&e<-a&&(a=-e),r(),this.notify(Qs,{threshold:a,rowIdx:o,isCustomHgt:!0}),(n=J.isNullOrUndefined(n)?!1:n)||(fd(o,t,s,!1,this),n=!1)):(i=gh(l,t),a=void 0,a=0<parseInt(s,10)?-(i-parseInt(s,10)):-i,r(),this.notify(Qs,{threshold:a,rowIdx:o})),this.notify(Yl,null)):r()))},u.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)},u.prototype.setColumnsWidth=function(e,t){void 0===e&&(e=64),t=t||["A:"+le(this.getActiveSheet().usedRange.colIndex+1)],this.setSize(e,t,R,this.setColWidth.bind(this))},u.prototype.setSize=function(r,e,n,i,o){var s,a,l,h,d=this;e.forEach(function(e){e.includes("!")?(a=e.split("!"),s=B(d,a[0]),e=a[1]):s=d.activeSheetIndex,e.includes(":")?(a=e.split(":"),l=n(a[0]),h=n(a[1])):l=h=n(e);for(var t=l;t<=h;t++)i(r,t,s,!1,o)})},u.prototype.autoFit=function(e){var e=this.getIndexes(e),t=e.startIdx,r=e.endIdx,n=e.isCol,e=n?R("XFD"):1048576;if(t<=e)for(e<r&&(r=e);t<=r;t++)this.notify(Ba,{idx:t,isCol:n})},u.prototype.getIndexes=function(e){i=-1!==e.indexOf(":")?(n=(i=e.split(":"))[0],i[1]):n=e,J.isNullOrUndefined(n)||(n=(e=this.getAddress(n)).address,t=e.isCol),J.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}},u.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}},u.prototype.addHyperlink=function(e,t,r){this.insertHyperlink(e,t,r,!0)},u.prototype.removeHyperlink=function(e){this.notify(ya,{range:e,preventEventTrigger:!0})},u.prototype.insertHyperlink=function(e,t,r,n){if(this.allowHyperlink){var i,o=void 0,s=this.getActiveSheet();if(Bd(this,i=Q(t=t||s.name+"!"+s.activeCell)))this.notify($a,null);else{for(var a=this.getCell(i[0],i[1]),l=[],h=0;a&&h<a.classList.length;h++)l.push(a.classList[h]);var d={hyperlink:e,address:t,displayText:r,cancel:!1},p={hyperlink:e,address:t,displayText:r};if(n||(this.trigger($t,d),this.notify(gt,{action:"hyperlink",eventArgs:d})),!d.cancel){if(this.notify(er,{hyperlink:e=d.hyperlink,cell:t=d.address,displayText:r,triggerEvt:!n}),t&&-1!==t.indexOf("!")){for(var c=t.split("!"),u=this.sheets,f=0;f<u.length;f++)u[f].name===c[0]&&(o=f);s=this.sheets[o],t=c[1]}if(s&&(i=Q(t=t||this.getActiveSheet().activeCell),n||(this.trigger(Zt,p),this.notify(oe,{action:"hyperlink",eventArgs:d})),s===this.getActiveSheet())){this.serviceLocator.getService("cell").refreshRange(i,!1,!1,!1,!0,Td(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(jr,null)}}}}},u.prototype.addDataValidation=function(e,t){Dc.prototype.addDataValidation.call(this,e,t)},u.prototype.removeDataValidation=function(e){this.notify(dr,{range:e,isRemoveValidation:!0,viewport:this.viewport})},u.prototype.addInvalidHighlight=function(e){e=e||this.dataValidationRange;if(-1<e.indexOf(","))for(var t="",r=(e.includes("!")&&(t=e.split("!")[0]+"!",e=e.split("!")[1]),e.split(",")),n=0;n<r.length-1;n++)Dc.prototype.addInvalidHighlight.call(this,t+r[n]);else Dc.prototype.addInvalidHighlight.call(this,e)},u.prototype.removeInvalidHighlight=function(e){e=e||this.dataValidationRange;if(-1<e.indexOf(","))for(var t="",r=(e.includes("!")&&(t=e.split("!")[0]+"!",e=e.split("!")[1]),e.split(",")),n=0;n<r.length-1;n++)Dc.prototype.removeInvalidHighlight.call(this,t+r[n]);else Dc.prototype.removeInvalidHighlight.call(this,e)},u.prototype.conditionalFormat=function(e){Dc.prototype.conditionalFormat.call(this,e)},u.prototype.clearConditionalFormat=function(e){e=e||this.getActiveSheet().selectedRange,Dc.prototype.clearConditionalFormat.call(this,e)},u.prototype.setPanelSize=function(){var e;"auto"!==this.height&&((e=document.getElementById(this.element.id+"_sheet_panel")).style.height=this.element.getBoundingClientRect().height-zh(e)+"px")},u.prototype.open=function(e){this.isOpen=!0,Dc.prototype.open.call(this,e),this.isOpen&&this.showSpinner()},u.prototype.hideRow=function(e,t,r){void 0===t&&(t=e),void 0===r&&(r=!0),this.renderModule?this.notify(Lr,{startIndex:e,endIndex:t,hide:r}):Dc.prototype.hideRow.call(this,e,t,r)},u.prototype.hideColumn=function(e,t,r){void 0===t&&(t=e),void 0===r&&(r=!0),this.renderModule?this.notify(Lr,{startIndex:e,endIndex:t,hide:r,isCol:!0}):Dc.prototype.hideColumn.call(this,e,t,r)},u.prototype.clear=function(e){this.notify(ll,{options:e})},u.prototype.refresh=function(e){this.isReact&&this.clearTemplate(),e?(this.notify(Hs,null),this.sheets.length=0,this.sheetNameCount=1,this.notify(Ht,{}),this.notify(Ra,null),this.createSheet(),this.activeSheetIndex=this.sheets.length-1,this.notify(ls,null),this.notify(re,{action:"initSheetInfo"}),this.renderModule.refreshSheet(),this.openModule.isImportedFile=this.openModule.preventFormatCheck=!1,this.openModule.unProtectSheetIdx=[]):Dc.prototype.refresh.call(this)},u.prototype.insertImage=function(e,t){for(var r=0;r<e.length;r++)this.notify(xl,{options:e[r],range:t||this.getActiveSheet().selectedRange,isPublic:!0})},u.prototype.deleteImage=function(e,t){this.notify(Sl,{id:e,range:t||this.getActiveSheet().selectedRange})},u.prototype.getRowHeaderContent=function(){return this.sheetModule.getRowHeaderPanel()},u.prototype.getColumnHeaderContent=function(){return this.sheetModule.getColHeaderPanel()},u.prototype.getMainContent=function(){return this.sheetModule.getContentPanel()},u.prototype.getSelectAllContent=function(){return this.sheetModule.getSelectAllContent()},u.prototype.getScrollElement=function(){return this.sheetModule.getScrollElement()},u.prototype.getContentTable=function(){return this.sheetModule.getContentTable()},u.prototype.getRowHeaderTable=function(){return this.sheetModule.getRowHeaderTable()},u.prototype.getColHeaderTable=function(){return this.sheetModule.getColHeaderTable()},u.prototype.getThreshold=function(e){e=Math.round((this.viewport[e+"Count"]+1)/2);return e<15?15:e},u.prototype.isMobileView=function(){return!J.isNullOrUndefined(this.cssClass)&&(-1<this.cssClass.indexOf("e-mobile-view")||J.Browser.isDevice)&&-1===this.cssClass.indexOf("e-desktop-view")&&!1},u.prototype.getValueRowCol=function(e,t,r,n,i,o,s){return Dc.prototype.getValueRowCol.call(this,e,t,r,n,i,o,s)},u.prototype.updateCell=function(e,t){t=t||this.getActiveSheet().activeCell,Bd(this,Q(t))||Dc.prototype.updateCell.call(this,e,t)},u.prototype.getRowData=function(e,t){return Dc.prototype.getRowData.call(this,e,t)},u.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(Fa,{sortOptions:e}),Dc.prototype.sort.call(this,e,t,n).then(function(e){return r.notify(Kt,e),Promise.resolve(e)})},u.prototype.setValueRowCol=function(e,t,r,n,i,o){if("circular reference: "===t&&(this.notify(fs,s={action:"isCircularReference",argValue:t}),t=s.argValue),Dc.prototype.setValueRowCol.call(this,e,t,r,n,i,o),this.allowEditing)this.notify(us,{action:"refreshDependentCellValue",rowIdx:r,colIdx:n,sheetIdx:bi(this,e)});else{var s=bi(this,e);if(r--,n--,this.activeSheetIndex===s){t=ne(this,s),i=void 0;if(i=$(t,r)||Eh(t,n)?i:this.getCell(r,n)){if(i.parentElement){o=i.parentElement.getAttribute("aria-rowindex");if(o&&Number(o)-1!==r)return}e=ie(r,n,t),s={value:e.value,format:e.format,onLoad:!0,formattedText:"",isRightAlign:!1,type:"General",cell:e,rowIndex:r,colIndex:n,isRowFill:!1},o=(this.notify(St,s),s.formattedText=this.allowNumberFormatting?s.formattedText:s.value,{isRightAlign:s.isRightAlign,result:s.formattedText,type:s.type,value:s.value,curSymbol:s.curSymbol,isRowFill:s.isRowFill});this.refreshNode(i,o)}}}},u.prototype.getModuleName=function(){return"spreadsheet"},u.prototype.refreshNode=function(e,t){var r;if(e){if(t){t.result=J.isNullOrUndefined(t.result)?"":t.result.toString(),!t.isRowFill&&((s=J.select(".e-fill",e))&&(J.detach(s),e.style.display="table-cell"),s=J.select(".e-fill-sec",e))&&J.detach(s);var n,i,o,s=J.select("#"+this.element.id+"_currency",e);if(s&&J.detach(s),"Accounting"===t.type&&Y(t.value)&&t.result.includes(t.curSymbol))return n=i=s=void 0,i=t.result.trim().endsWith(t.curSymbol)?t.result:(s=t.result.includes(" "+t.curSymbol)?" "+t.curSymbol:t.curSymbol,t.result.split(s).join("")),h=e.querySelector(".e-databar-value"),o=void 0,0<(a=e).children.length&&-1<e.children[e.childElementCount-1].className.indexOf("e-addNoteIndicator")&&(o=document.getElementsByClassName("e-addNoteIndicator")[0]),h?(this.refreshNode(h,{result:i}),a=e.querySelector(".e-cf-databar")||e):e.querySelector("a")?e.querySelector("a").textContent=i:(n=!0,e.innerText=""),s&&((h=this.createElement("span",{id:this.element.id+"_currency",styles:"float: left"})).innerText=s,a.appendChild(h),J.isNullOrUndefined(o)||a.appendChild(o)),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=J.isNullOrUndefined(r)?"":r,J.isNullOrUndefined(t.rowIndex)||J.isNullOrUndefined(t.colIndex)||J.attributes(e,{"aria-label":(r?r+" ":"")+G(t.rowIndex,t.colIndex)});var a,l=e.lastChild,h=(e.querySelector(".e-databar-value")&&(l=e.querySelector(".e-databar-value").lastChild),e.querySelector(".e-hyperlink")&&(l=e.querySelector(".e-hyperlink").lastChild),e.querySelector(".e-addNoteIndicator")&&(l=e.firstChild),e.querySelector(".e-wrap-content"));h&&(h.lastChild||h.appendChild(document.createTextNode("")),l=h.lastChild),(this.isAngular||this.isVue)&&e.classList.contains("e-cell-template")&&l&&(8===l.nodeType||3===l.nodeType)?3!==l.nodeType&&""===r||(a=function(){e.childElementCount||(3===l.nodeType?t.isRowFill||(l.nodeValue=r):e.appendChild(document.createTextNode(r)))},this.isAngular?Ph(a):a()):!l||3!==l.nodeType&&1!==l.nodeType?e.appendChild(document.createTextNode(r)):t.isRowFill||(!J.isNullOrUndefined(l.className)&&-1<l.className.indexOf("e-addNoteIndicator")?(l=e.lastChild).nodeValue=r:l.nodeValue=r)}},u.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},u.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 s=e;s<=t;s++)if(o[""+r][s]&&o[""+r][s].hidden){if(e===s&&e++,t++,n&&i<t){t=i;break}}else if(!n&&this.scrollSettings.isFinite&&i<t&&o[""+r][s-1]&&o[""+r][s-1].hidden){t--;break}return[e,t]},u.prototype.updateActiveBorder=function(e,t){t=J.select((t=void 0===t?".e-ribbon":t)+" .e-tab-header .e-indicator",this.element);t.style.display="none",J.setStyleAttribute(t,{left:"",right:""}),J.setStyleAttribute(t,{left:e.offsetLeft+"px",right:e.parentElement.offsetWidth-(e.offsetLeft+e.offsetWidth)+"px"}),t.style.display=""},u.prototype.undo=function(){this.notify(Sa,{isUndo:!0,isPublic:!0})},u.prototype.redo=function(){this.notify(Sa,{isUndo:!1,isPublic:!0})},u.prototype.updateUndoRedoCollection=function(e){this.notify(wa,{args:e,isPublic:!0})},u.prototype.addDefinedName=function(e){e={action:"addDefinedName",isAdded:!1,definedName:e};return this.notify(fs,e),e.isAdded},u.prototype.removeDefinedName=function(e,t){return Dc.prototype.removeDefinedName.call(this,e,t)},u.prototype.mouseClickHandler=function(e){this.notify(ms,e)},u.prototype.mouseDownHandler=function(e){this.notify(ps,e)},u.prototype.keyUpHandler=function(e){J.closest(e.target,".e-find-dlg")?this.notify(vr,e):this.notify(vs,e)},u.prototype.keyDownHandler=function(e){var t,r,n=J.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")&&ae(n)):(this.notify(ys,e),!this.enableKeyboardNavigation&&document.activeElement.classList.contains("e-cell")&&-1<[38,40,33,34,35,36].indexOf(e.keyCode)&&e.preventDefault())},u.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(ds,this.freezePaneUpdated,this),this.freezePanes(e.row,e.column),this.notify(jr,null)}},u.prototype.freezePaneUpdated=function(){this.off(ds,this.freezePaneUpdated);var e=this.getActiveSheet();ae(this.element),this.notify(oe,{eventArgs:{row:e.frozenRows,column:e.frozenColumns,sheetIndex:this.activeSheetIndex},action:"freezePanes"})},u.prototype.wireEvents=function(){J.EventHandler.add(this.element,"click",this.mouseClickHandler,this),J.EventHandler.add(this.element,$h(),this.mouseDownHandler,this),J.EventHandler.add(this.element,"keyup",this.keyUpHandler,this),J.EventHandler.add(this.element,"keydown",this.keyDownHandler,this),J.EventHandler.add(this.element,"noderefresh",this.refreshNode,this),this.on(ql,this.freeze,this),this.on(pn,this.refreshInsertDelete,this)},u.prototype.destroy=function(){this.isReact&&this.clearTemplate(),this.unwireEvents(),this.notify(cs,null),Dc.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()},u.prototype.unwireEvents=function(){J.EventHandler.remove(this.element,"click",this.mouseClickHandler),J.EventHandler.remove(this.element,$h(),this.mouseDownHandler),J.EventHandler.remove(this.element,"keyup",this.keyUpHandler),J.EventHandler.remove(this.element,"keydown",this.keyDownHandler),J.EventHandler.remove(this.element,"noderefresh",this.refreshNode),this.off(ql,this.freeze),this.off(pn,this.refreshInsertDelete)},u.prototype.refreshInsertDelete=function(t){var r,n=this;t.sheet.ranges.forEach(function(e){e.template&&e.address&&(r=Q(e.address),n.updateRangeOnInsertDelete(t,r))&&(e.address=ee(r))}),this.setSheetPropertyOnMute(t.sheet,"ranges",t.sheet.ranges)},u.prototype.addContextMenuItems=function(e,t,r,n){this.notify(_s,{items:e,text:t,insertAfter:r=void 0===r?!0:r,isUniqueId:n})},u.prototype.removeContextMenuItems=function(e,t){this.notify(zs,{items:e,isUniqueId:t})},u.prototype.enableContextMenuItems=function(e,t,r){this.notify(js,{items:e,enable:t=void 0===t?!0:t,isUniqueId:r})},u.prototype.enableFileMenuItems=function(e,t,r){this.notify(qs,{items:e,enable:t=void 0===t?!0:t,isUniqueId:r})},u.prototype.hideFileMenuItems=function(e,t,r){this.notify(Ws,{items:e,hide:t=void 0===t?!0:t,isUniqueId:r})},u.prototype.addFileMenuItems=function(e,t,r,n){this.notify(Gs,{items:e,text:t,insertAfter:r=void 0===r?!0:r,isUniqueId:n})},u.prototype.hideRibbonTabs=function(e,t){this.notify(Ys,{tabs:e,hide:t=void 0===t?!0:t})},u.prototype.enableRibbonTabs=function(e,t){this.notify(Xs,{tabs:e,enable:t=void 0===t?!0:t})},u.prototype.addRibbonTabs=function(e,t){this.notify(Ks,{items:e,insertBefore:t})},u.prototype.enableToolbarItems=function(e,t,r){this.notify(Os,[{tab:e,items:t,enable:void 0===r||r}])},u.prototype.hideToolbarItems=function(e,t,r){this.notify(Zs,{tab:e,indexes:t,hide:r=void 0===r?!0:r})},u.prototype.addToolbarItems=function(e,t,r){this.notify($s,{tab:e,items:t,index:r})},u.prototype.selectRange=function(e){this.isEdit&&this.notify(us,{action:"endEdit"}),this.notify(Ds,{address:e})},u.prototype.selectChart=function(e){this.selectOverlay(e,!0)},u.prototype.selectImage=function(e){this.selectOverlay(e)},u.prototype.selectOverlay=function(e,t){var r,n,i=this.getActiveSheet();!i.isProtected&&this.allowEditing&&(e||(n=ie((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(kl,null),r.classList.add("e-ss-overlay-active"),r.classList.contains("e-datavisualization-chart")?(this.notify(Xr,{id:r.id}),i||this.notify(Tl,{id:r.id})):i&&this.notify(Dl,null))},u.prototype.deselectChart=function(){this.notify(vl,{selector:".e-datavisualization-chart"})},u.prototype.deselectImage=function(){this.notify(vl,{selector:":not(.e-datavisualization-chart)"})},u.prototype.startEdit=function(){this.notify(us,{action:"startEdit",isNewValueEdit:!1})},u.prototype.closeEdit=function(){this.notify(us,{action:"cancelEdit"})},u.prototype.endEdit=function(){this.notify(us,{action:"endEdit",isPublic:!0})},u.prototype.print=function(e){void 0===e&&(e={type:"ActiveSheet",allowRowColumnHeader:!1,allowGridLines:!1}),this.allowPrint&&!J.isNullOrUndefined(this.printModule)&&this.printModule.print(this,e)},u.prototype.onPropertyChanged=function(c,u){var f,g=this;Dc.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,s=void 0,a=this.getActiveSheet(),l=this.getScrollElement();switch(i){case"enableRtl":if(!c.locale&&(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=J.getComponent(r,"dropdown-btn"))&&(r.enableRtl=c.enableRtl,r.dataBind()),this.sheetModule.setPanelWidth(a,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"))?J.getComponent(h,"accumulationchart"):(h=m.querySelector(".e-chart"))&&J.getComponent(h,"chart"))&&p.destroy(),J.detach(m),v===y&&this.notify(hn,{});l&&(l.scrollLeft=0),this.selectRange(a.selectedRange)}break;case"cssClass":u.cssClass&&J.removeClass([this.element],u.cssClass.split(" ")),c.cssClass&&J.addClass([this.element],c.cssClass.split(" "));break;case"activeSheetIndex":this.renderModule.refreshSheet(),this.notify(na,{idx:c.activeSheetIndex});break;case"width":this.setWidth(),this.resize();break;case"height":this.setHeight(),this.resize();break;case"showRibbon":this.notify(os,{prop:"showRibbon",onPropertyChange:!0});break;case"showFormulaBar":this.notify(ss,{uiUpdate:!0});break;case"showSheetTabs":this.notify(as,null);break;case"cellStyle":this.renderModule.refreshSheet();break;case"allowEditing":this.allowEditing?(this.notify(us,{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(vl,null);break;case"allowInsert":(s=this.element.getElementsByClassName("e-add-sheet-tab")[0])&&(s.disabled=!this.allowInsert,this.allowInsert?s.classList.contains("e-disabled")&&s.classList.remove("e-disabled"):s.classList.contains("e-disabled")||s.classList.add("e-disabled"));break;case"sheets":c.sheets===this.sheets?(this.renderModule.refreshSheet(),this.notify(ls,null),this.notify(re,{action:"initSheetInfo"})):Object.keys(c.sheets).forEach(function(e,t){var r,n,i,o,s,a,l,h=Number(e),d=c.sheets[h],p=ne(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){(J.isUndefined(r)||r===t)&&(n=Number(e),i=d.ranges[n],o=p.ranges[n],s=i.dataSource,s=i.fieldsOrder&&o.info&&!s&&o.dataSource?o.dataSource:s)&&g.notify(dt,{sheetIdx:h,rangeIdx:n,changedData:s})})):d.paneTopLeftCell&&u.sheets&&u.sheets[""+h]&&u.sheets[""+h].paneTopLeftCell?g.activeSheetIndex===Number(h)&&(e=W(d.paneTopLeftCell),a=W(u.sheets[""+h].paneTopLeftCell),e[0]!==a[0]&&(l=g.frozenRowCount(g.getActiveSheet()),l=e[0]>l?vh(g.getActiveSheet(),l,e[0]-1):0,g.notify(Gl,{top:l})),e[1]!==a[1])&&(l=g.frozenColCount(g.getActiveSheet()),a=e[1]>l?Ih(g.getActiveSheet(),l,e[1]-1):0,g.notify(Gl,{left:a})):(0===t&&g.renderModule.refreshSheet(),g.showSheetTabs&&d.name&&!f&&(l=J.select(".e-sheet-tabs-items",g.element),e=Number(h),l.children[e+1]?g.notify(ba,{items:l,value:d.name,idx:e}):(g.notify(ls,null),f=!0)))});break;case"locale":this.refresh();break;case"currencyCode":c.locale||this.notify(hn,{});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(os,{prop:"allowFreezePane",onPropertyChange:!0});break;case"allowImage":case"allowChart":this.renderModule.refreshSheet(),this.notify(os,{prop:i,onPropertyChange:!0})}}},u.prototype.requiredModules=function(){return Nh(this)},u.prototype.appendTo=function(e){Dc.prototype.appendTo.call(this,e)},u.prototype.filter=function(e,t){return this.allowFiltering?(t=t||this.getActiveSheet().selectedRange,Dc.prototype.filter.call(this,e,t)):Promise.reject()},u.prototype.clearFilter=function(e){this.notify(Da,{field:e})},u.prototype.applyFilter=function(e,t){var r,n,i=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},i.notify(E.fltrPrevent,n),e.value=n.arg3}),this.notify(Na,e={predicates:e,range:t,isInternal:!0,promise:r}),e.promise):Promise.reject()},u.prototype.addCustomFunction=function(e,t,r){Dc.prototype.addCustomFunction.call(this,e,t,r),this.notify(Ha,null)},u.prototype.setRangeReadOnly=function(e,t,r){t=t||this.getActiveSheet().selectedRange;var r=r||this.activeSheetIndex,n=te(Q(t)),i=ne(this,r);if(!J.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,s=n[1];s<=n[3];s++)e?Sh(i,s,{isReadOnly:e}):(o=se(i,s))&&o.isReadOnly&&delete o.isReadOnly;else if(this.isRowRange(t)||0===n[1]&&n[3]===i.colCount-1)for(var a,l=n[0];l<=n[2];l++)e?uh(i,l,{isReadOnly:e}):(a=ch(i,l))&&a.isReadOnly&&delete a.isReadOnly;else for(var h=n[1];h<=n[3];h++)for(var d=n[0];d<=n[2];d++)e?Mi(d,h,i,{isReadOnly:e},!0):(u=ie(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}})}},u.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},u.prototype.isRowRange=function(e){var t=!0;return Array.from(e).forEach(function(e){"0"<=e&&e<="9"||":"===e||(t=!1)}),t},Jp([J.Property("")],u.prototype,"cssClass",void 0),Jp([J.Property(!0)],u.prototype,"allowScrolling",void 0),Jp([J.Property(!0)],u.prototype,"allowResizing",void 0),Jp([J.Property(!0)],u.prototype,"showAggregate",void 0),Jp([J.Property(!0)],u.prototype,"enableClipboard",void 0),Jp([J.Property(!0)],u.prototype,"enableContextMenu",void 0),Jp([J.Property(!0)],u.prototype,"enableKeyboardNavigation",void 0),Jp([J.Property(!0)],u.prototype,"enableKeyboardShortcut",void 0),Jp([J.Property(!0)],u.prototype,"allowUndoRedo",void 0),Jp([J.Property(!0)],u.prototype,"allowWrap",void 0),Jp([J.Complex({},n)],u.prototype,"selectionSettings",void 0),Jp([J.Complex({},Ud)],u.prototype,"scrollSettings",void 0),Jp([J.Event()],u.prototype,"beforeCellRender",void 0),Jp([J.Event()],u.prototype,"beforeSelect",void 0),Jp([J.Event()],u.prototype,"select",void 0),Jp([J.Event()],u.prototype,"contextMenuBeforeOpen",void 0),Jp([J.Event()],u.prototype,"fileMenuBeforeOpen",void 0),Jp([J.Event()],u.prototype,"contextMenuBeforeClose",void 0),Jp([J.Event()],u.prototype,"dialogBeforeOpen",void 0),Jp([J.Event()],u.prototype,"fileMenuBeforeClose",void 0),Jp([J.Event()],u.prototype,"contextMenuItemSelect",void 0),Jp([J.Event()],u.prototype,"fileMenuItemSelect",void 0),Jp([J.Event()],u.prototype,"beforeDataBound",void 0),Jp([J.Event()],u.prototype,"dataBound",void 0),Jp([J.Event()],u.prototype,"dataSourceChanged",void 0),Jp([J.Event()],u.prototype,"cellEdit",void 0),Jp([J.Event()],u.prototype,"cellEditing",void 0),Jp([J.Event()],u.prototype,"cellEdited",void 0),Jp([J.Event()],u.prototype,"cellSave",void 0),Jp([J.Event()],u.prototype,"beforeCellSave",void 0),Jp([J.Event()],u.prototype,"created",void 0),Jp([J.Event()],u.prototype,"beforeSort",void 0),Jp([J.Event()],u.prototype,"beforeHyperlinkCreate",void 0),Jp([J.Event()],u.prototype,"afterHyperlinkCreate",void 0),Jp([J.Event()],u.prototype,"beforeHyperlinkClick",void 0),Jp([J.Event()],u.prototype,"afterHyperlinkClick",void 0),Jp([J.Event()],u.prototype,"beforeConditionalFormat",void 0),Jp([J.Event()],u.prototype,"actionBegin",void 0),Jp([J.Event()],u.prototype,"actionComplete",void 0),Jp([J.Event()],u.prototype,"openComplete",void 0),Jp([J.Event()],u.prototype,"sortComplete",void 0),Jp([J.Property("USD")],u.prototype,"currencyCode",void 0),Lc=Jp([J.NotifyPropertyChanges],u));function u(e,t){e=Dc.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},e.needsID=!0,Lc.Inject(lc,hc,uc,rp,tp,ap,hp,Qd,zi,gc,Cc,vc,xc,pp,pc,Sp,Do,qi,$i,Oo,bo,Co,wc,wo,up,bp,Eo,Ec,vp,Po,Ip,Rp,Bo,Vo,Ap,_o,Fc,Fp,Go,Tp,qo,Lp,Xo,Rc,Mp,No,$o,Ac,ko,Hp,Jo,Up),t&&e.appendTo(t),e}z.AutoFill=Hp,z.AutoFillSettings=U,z.Axis=Je,z.BasicFormulas=so,z.Border=Ue,z.CalcSheetFamilyItem=vo,z.Calculate=uo,z.CalculateCommon=t,z.Cell=Li,z.CellFormat=pp,z.CellRenderer=Yd,z.CellStyle=_,z.Chart=tt,z.Clipboard=Qd,z.Column=bh,z.ConditionalFormat=Oe,z.ConditionalFormatting=Mp,z.ContextMenu=Cc,z.DISABLED="e-disabled",z.DataBind=zi,z.DataLabelSettings=Be,z.DataValidation=Ap,z.DefineName=me,z.Delete=Rp,z.Edit=tp,z.Filter=Ec,z.FilterCollection=de,z.FindAndReplace=Tp,z.Format=Ae,z.Formula=pc,z.FormulaBar=hc,z.FormulaError=fo,z.FormulaInfo=go,z.Hyperlink=Se,z.Image=it,z.Insert=Ip,z.KeyboardNavigation=ap,z.KeyboardShortcut=hp,z.LegendSettings=Le,z.MajorGridLines=Ge,z.MarkerSettings=je,z.Merge=Lp,z.MinorGridLines=Ke,z.ModuleLoader=io,z.NumberFormat=xc,z.Open=gc,z.Parser=ao,z.ProtectSettings=Ce,z.ProtectSheet=Fp,z.Range=ci,z.Render=Kd,z.Resize=up,z.Ribbon=lc,z.Row=dh,z.RowRenderer=Wd,z.Save=vc,z.Scroll=np,z.ScrollSettings=Ud,z.Selection=rp,z.SelectionSettings=n,z.Sheet=yi,z.SheetRender=qd,z.SheetTabs=uc,z.ShowHide=gp,z.Sort=wc,z.SortCollection=ue,z.Spreadsheet=hh,z.SpreadsheetChart=Ac,z.SpreadsheetHyperlink=vp,z.SpreadsheetImage=Rc,z.SpreadsheetNote=Up,z.UndoRedo=bp,z.UsedRange=gi,z.Validation=Ee,z.ValueChangedArgs=yo,z.VirtualScroll=op,z.WRAPTEXT=Ah,z.Workbook=e,z.WorkbookAutoFill=Jo,z.WorkbookCellFormat=Oo,z.WorkbookChart=ko,z.WorkbookConditionalFormat=$o,z.WorkbookDataValidation=_o,z.WorkbookDelete=Vo,z.WorkbookEdit=Do,z.WorkbookFilter=Eo,z.WorkbookFindAndReplace=qo,z.WorkbookFormula=Co,z.WorkbookHyperlink=Po,z.WorkbookImage=No,z.WorkbookInsert=Bo,z.WorkbookMerge=Xo,z.WorkbookNumberFormat=bo,z.WorkbookOpen=qi,z.WorkbookProtectSheet=Go,z.WorkbookSave=$i,z.WorkbookSort=wo,z.WrapText=Sp,z.actionEvents=kh,z.activeCellChanged=Lt,z.activeCellMergedRange=Tr,z.activeSheetChanged=na,z.addChartEle=Pl,z.addContextMenuItems=_s,z.addDPRValue=Pd,z.addFileMenuItems=Gs,z.addFormatToCustomFormatDlg=mn,z.addHighlight=pr,z.addHyperlink="addHyperlink",z.addNote=pa,z.addRibbonTabs=Ks,z.addToolbarItems=$s,z.addressHandle=ul,z.afterHyperlinkClick=Qt,z.afterHyperlinkCreate=Zt,z.aggregateComputation=Vt,z.applyCF=Mr,z.applyCellFormat=Nt,z.applyLockCells="applyLockCells",z.applyMerge=Fr,z.applyNumberFormatting=xt,z.applyPredicates=ri,z.applyProtect=ja,z.applySort=oa,z.autoFill="autoFill",z.autoFit=sa,z.beforeCellUpdate=un,z.beforeCheckboxRender=rh,z.beforeContentLoaded=xs,z.beforeDataBound=Us,z.beforeDelete=Jr,z.beforeFilter="beforeFilter",z.beforeHyperlinkClick=Jt,z.beforeHyperlinkCreate=$t,z.beforeInsert=Zr,z.beforeRibbonCreate=Js,z.beforeSort=Gt,z.beforeVirtualContentLoaded=Ss,z.beginAction=gt,z.beginSave=ft,z.cMenuBeforeOpen=Rs,z.cellNavigate=Is,z.cellValidation=dr,z.chartDesignTab=Ll,z.chartRangeSelection=Ol,z.checkColumnValidation=Rh,z.checkDateFormat=Ft,z.checkFormulaRef=vn,z.checkIsFormula=X,z.checkMerge=rl,z.checkNumberFormat=Ot,z.checkPrevMerge=tl,z.checkRange=Zn,z.checkUniqueRange=zt,z.clear=Hr,z.clearAllFilter="clearAllFilter",z.clearCF=Vr,z.clearCFRule=Br,z.clearCellRef=pl,z.clearChartBorder=kl,z.clearCopy=Hs,z.clearFilter=Da,z.clearFormulaDependentCells=qt,z.clearInvalid="clearInvalid",z.clearRange=Od,z.clearUndoRedoCollection=Ra,z.clearViewer=ll,z.click=ms,z.colWidthChanged=ea,z.collaborativeUpdate="collaborativeUpdate",z.columnIndex=_n,z.completeAction=oe,z.contentLoaded=ds,z.contextMenuOpen="contextMenuOpen",z.copy=Ms,z.count=br,z.createHyperlinkElement=Ca,z.createImageElement=xl,z.createNoteIndicator=ga,z.created=Xa,z.currencyFormat=si,z.cut=Ps,z.dataBound=Vs,z.dataChanged=pt,z.dataSourceChanged=dt,z.dataValidate="dataValidate",z.dateToInt=En,z.deInitProperties=ra,z.defaultLocale=Lh,z.deleteAction=sr,z.deleteChart=wl,z.deleteChartColl=Yr,z.deleteFormatRange=Kn,z.deleteHyperlink=Qr,z.deleteImage=Sl,z.deleteModel=lr,z.deleteNote=ua,z.destroyComponent=ud,z.dialog=k,z.duplicateSheet=Oi,z.duplicateSheetFilterHandler=fn,z.editAlert=Ka,z.editHyperlink=ha,z.editNote=ca,z.editOperation=us,z.editValue=cl,z.enableContextMenuItems=js,z.enableFileMenuItems=qs,z.enableFormulaInput=Ja,z.enableRibbonTabs=Xs,z.enableToolbarItems=Os,z.executeTaskAsync=T,z.exportDialog=yt,z.fillColor=Th,z.filterByCellValue=Ta,z.filterCellKeyDown=Pa,z.filterComplete="filterComplete",z.filterRangeAlert=rr,z.find=cr,z.findAllValues=Et,z.findCount="findCount",z.findDlg=Ga,z.findHandler=Ya,z.findKeyUp=vr,z.findMaxValue=md,z.findToolDlg=vt,z.findWorkbookHandler="findHandler",z.focus=ae,z.focusBorder=Al,z.focusChartBorder=Xr,z.fontColor=Oh,z.forRefSelRender=gl,z.formulaBar=ss,z.formulaBarOperation=gs,z.formulaBarUpdate="formulaBarUpdate",z.formulaInValidation=Wt,z.formulaKeyUp="formulaKeyUp",z.formulaOperation=fs,z.freeze=ql,z.getAddressFromSelectedRange=b,z.getAddressInfo=x,z.getAlphalabel=j,z.getAutoDetectFormatParser=ti,z.getBeforeActionData=Ea,z.getBorderHeight=Id,z.getBottomOffset=Dd,z.getCell=ie,z.getCellAddress=G,z.getCellIndexes=W,z.getCellPosition=Wh,z.getChartColIdxFromClientX=bn,z.getChartRowIdxFromClientY=Cn,z.getChartsIndexes=Md,z.getClientX=sd,z.getClientY=ad,z.getColGroupWidth=Bh,z.getColIdxFromClientX=bl,z.getColIndex=R,z.getColorCode=Vi,z.getColumn=se,z.getColumnHeaderText=le,z.getColumnWidth=wh,z.getColumnsWidth=Ih,z.getCustomColors=Ui,z.getDPRValue=dd,z.getData=ai,z.getDataRange=Yn,z.getEndEvent=Jh,z.getExcludedColumnWidth=Ed,z.getFillInfo=nn,z.getFilterRange=Ma,z.getFilteredColumn=La,z.getFormatFromType=xo,z.getFormattedBarText=Dt,z.getFormattedCellObject=St,z.getGcd=wn,z.getIndexesFromAddress=y,z.getLeadingSpaces=qn,z.getLineHeight=xd,z.getLines=wd,z.getMaxHgt=Ad,z.getMaxSheetId=Ni,z.getModel=function(e,t){var r,n,i;if(J.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=to,z.getMoveEvent=Zh,z.getPageX=ld,z.getPageY=hd,z.getPassWord=Vl,z.getRangeAddress=ee,z.getRangeFromAddress=C,z.getRangeIndexes=Q,z.getRequiredModules=Nh,z.getRightIdx=Ld,z.getRow=ch,z.getRowHeight=gh,z.getRowIdxFromClientY=Cl,z.getRowsHeight=vh,z.getScrollBarWidth=Uh,z.getSelectedRange=Ii,z.getSheet=ne,z.getSheetIndex=B,z.getSheetIndexByName=Si,z.getSheetIndexFromAddress=N,z.getSheetIndexFromId=bi,z.getSheetName=ki,z.getSheetNameCount=Ri,z.getSheetNameFromAddress=xi,z.getSheetProperties=function(e,t){var r,n,i,o,s=[],a=(t?(r=(a=Object.getPrototypeOf(new Li(e,"cells",{},!0)).constructor.prototype.propList).colPropNames.concat(a.complexPropNames).concat(a.propNames),n=(a=Object.getPrototypeOf(new dh(e,"rows",{},!0)).constructor.prototype.propList).colPropNames.concat(a.complexPropNames).concat(a.propNames),i=(a=Object.getPrototypeOf(new bh(e,"columns",{},!0)).constructor.prototype.propList).colPropNames.concat(a.complexPropNames).concat(a.propNames),(a=(a=Object.getPrototypeOf(new yi(e,"sheets",{},!0)).constructor.prototype.propList).colPropNames.concat(a.complexPropNames).concat(a.propNames)).splice(a.indexOf("rows"),1),a.splice(a.indexOf("columns"),1),a.splice(a.indexOf("cells"),1),n.splice(n.indexOf("cells"),1),s.push.apply(s,a),-1===t.indexOf("rows")&&s.push.apply(s,n),-1===t.indexOf("columns")&&s.push.apply(s,i),-1===t.indexOf("cells")&&s.push.apply(s,r),t.forEach(function(e){o=s.indexOf(e),-1<s.indexOf(e)&&s.splice(o,1)})):s.push("ranges"),{skipProps:s});return e.notify("getStringifyObject",a),a.model},z.getSiblingsHeight=zh,z.getSingleSelectedRange=Ei,z.getSkeletonVal=Qi,z.getSplittedAddressForColumn=Hn,z.getStartEvent=$h,z.getSwapRange=te,z.getTextHeight=bd,z.getTextHeightWithBorder=Rd,z.getTextSpace=an,z.getTextWidth=Sd,z.getTrailingSpaces=Wn,z.getTypeFromFormat=So,z.getUniqueRange=Ut,z.getUpdateUsingRaf=Ph,z.getUpdatedFormula=jn,z.getUpdatedFormulaOnInsertDelete=cn,z.getUpdatedScrollPosition=eh,z.getValue=ro,z.getValueFromFormat=li,z.getViewportIndexes=Qn,z.getWorkbookRequiredModules=P,z.getautofillDDB=on,z.goToSheet=ol,z.goto=ur,z.gotoDlg=Wa,z.hasTemplate=yd,z.hiddenMerge=el,z.hideAutoFillElement=Zl,z.hideAutoFillOptions=Xl,z.hideFileMenuItems=Ws,z.hideRibbonTabs=Ys,z.hideSheet=xa,z.hideShow=Lr,z.hideToolbarItems=Zs,z.importProtectWorkbook=zl,z.inRange=Pn,z.inView=qh,z.initSheet=Ai,z.initiateChart=zr,z.initiateChartModel="initiateChartModel",z.initiateCur=dl,z.initiateCustomSort=ia,z.initiateDataValidation=Ua,z.initiateEdit=fl,z.initiateFilter=tr,z.initiateFilterUI=Na,z.initiateFormulaReference=hl,z.initiateHyperlink=la,z.initiateSort=Yt,z.initiatelink="initiatelink",z.insert=or,z.insertChart=Fl,z.insertDesignChart=Tl,z.insertFormatRange=Xn,z.insertImage=ml,z.insertMerge=Dr,z.insertModel=ar,z.insertSheetTab=Ns,z.intToDate=In,z.invalidData=_a,z.isCellReference=On,z.isChar=Tn,z.isColumnSelected=Ln,z.isCustomDateTime=_i,z.isDateTime=Rn,z.isDiscontinuousRange=Fd,z.isExternalFileLink=eo,z.isFilterHidden=fh,z.isFormulaBarEdit=hs,z.isHeightCheckNeeded=zn,z.isHiddenCol=Eh,z.isHiddenRow=$,z.isImported=Td,z.isInMultipleRange=Mn,z.isInRange=Bn,z.isLocked=Vn,z.isLockedCells=kd,z.isMouseDown=rd,z.isMouseMove=nd,z.isMouseUp=id,z.isNavigationKey=od,z.isNumber=Y,z.isReadOnly=ni,z.isReadOnlyCells=Bd,z.isRowSelected=Dn,z.isSingleCell=he,z.isTouchEnd=td,z.isTouchMove=ed,z.isTouchStart=Qh,z.isUndefined=function(e){return void 0===e},z.isValidCellReference=Un,z.isValidation=hr,z.keyCodes=Dh,z.keyDown=ys,z.keyUp=vs,z.locale=A,z.localeData=oi,z.locateElem=Xh,z.mergedRange=Or,z.mouseDown=ps,z.mouseUpAfterSelection=Es,z.moveOrDuplicateSheet=en,z.moveSheet=Fi,z.onContentScroll=ta,z.onHorizontalScroll=bs,z.onSave=ir,z.onVerticalScroll=Cs,z.openFailure=Mt,z.openHyperlink=da,z.openSuccess=Pt,z.overlay=Fh,z.overlayEleSize=Wl,z.parseDecimalNumber=Tt,z.parseFormulaArgument=yn,z.parseIntValue=An,z.parseLocaleNumber=Jn,z.paste=Bs,z.performAutoFill=Kl,z.performUndoRedo=Sa,z.positionAutoFillElement=Yl,z.processIdx=hi,z.protectCellFormat=qa,z.protectSelection=Qa,z.protectSheet=za,z.protectSheetWorkBook=xr,z.protectWorkbook=Bl,z.protectsheetHandler=wr,z.queryCellInfo=Cr,z.rangeSelectionByKeydown=Ls,z.reApplyFormula=jt,z.readonlyAlert=$a,z.reapplyFilter=Oa,z.refreshCell=rn,z.refreshCellElement=wt,z.refreshChart=qr,z.refreshChartCellModel=El,z.refreshChartCellObj=Il,z.refreshChartCellOnInit=xn,z.refreshChartSize=Wr,z.refreshCheckbox=nh,z.refreshClipboard=ln,z.refreshFilterRange=ka,z.refreshFormulaDatasource=Ha,z.refreshImagePosition=Rl,z.refreshImgCellObj=yl,z.refreshInsertDelete=pn,z.refreshOverlayElem=vl,z.refreshRibbon="ribbonRefresh",z.refreshRibbonIcons=jr,z.refreshSheetTabs=ls,z.removeAllChildren=Mh,z.removeContextMenuItems=zs,z.removeDataValidation=nl,z.removeDesignChart=Dl,z.removeHighlight=yr,z.removeHyperlink=ya,z.removeNoteContainer=va,z.removeRangeEle=Yh,z.removeSheetTab=As,z.removeUniquecol=_t,z.removeWorkbookProtection=_l,z.renameSheetTab=ks,z.renderCFDlg=al,z.renderFilterCell=Aa,z.renderInsertDlg=ih,z.replace=fr,z.replaceAll=gr,z.replaceAllDialog=Ir,z.ribbon=os,z.ribbonClick=Fs,z.rowFillHandler=sn,z.rowHeightChanged=Qs,z.saveCompleted=bt,z.saveError=Kr,z.selectAutoFillRange=$l,z.selectRange=Ds,z.selectionComplete=dn,z.selectionStatus=jl,z.setActionData=Ia,z.setAriaOptions=cd,z.setAutoFill=tn,z.setAutoFit=Ba,z.setCFRule=Pr,z.setCell=Mi,z.setCellFormat=It,z.setChart=_r,z.setColMinWidth=function(e,t){e.renderModule.setSheetPanelSize(t)},z.setColumn=Sh,z.setFilteredCollection=Ct,z.setImage=Ur,z.setLinkModel=er,z.setLockCells=Ar,z.setMaxHgt=Nd,z.setMerge=kr,z.setPosition=Gh,z.setProtectWorkbook=Ul,z.setResize=fd,z.setRow=uh,z.setRowEleHeight=Cd,z.setRowHeight=mh,z.setScrollEvent=Va,z.setStyleAttribute=Kh,z.setTextLineHeight=function(e){Vh=e},z.setUndoRedo=Za,z.setValue=no,z.setVisibleMergeIndex=ei,z.setWidthAndHeight=gd,z.sheetCreated=Bt,z.sheetNameUpdate=ba,z.sheetTabs=as,z.sheetsDestroyed=Ht,z.showAggregate=il,z.showFindAlert=mr,z.showNote=fa,z.showSheet=sl,z.skipDefaultValue=Bi,z.skipHiddenIdx=K,z.sortComplete=Kt,z.sortImport=mt,z.sortRangeAlert="sortRangeAlert",z.spreadsheetDestroyed=cs,z.startEdit="startEdit",z.tabSwitch=Ts,z.textDecorationUpdate=Rt,z.toDate=Nn,z.toFraction=Sn,z.toggleProtect=oh,z.triggerDataChange=ct,z.unMerge=gn,z.unProtectSheetPassword=Jl,z.unProtectWorkbook=Hl,z.undoRedoForChartDesign=Ml,z.unprotectSheet="unprotectSheet",z.unprotectsheetHandler=Er,z.updateAction=vd,z.updateCFModel=$n,z.updateCell=Gn,z.updateChart=Gr,z.updateNoteContainer=ma,z.updateRowColCount=At,z.updateScroll=Gl,z.updateScrollValue=th,z.updateSelectedRange=wi,z.updateSheetFromDataSource=ht,z.updateSortCollection=Fa,z.updateSortedDataOnCell=Xt,z.updateTableWidth=Nl,z.updateToggle=Sr,z.updateToggleItem=aa,z.updateTranslate=Ql,z.updateUndoRedoCollection=wa,z.updateUsedRange="updateUsedRange",z.updateView=hn,z.validationError="validationError",z.validationHighlight=$r,z.virtualContentLoaded=ws,z.workBookeditAlert=Rr,z.workbookDestroyed=lt,z.workbookEditOperation=kt,z.workbookFormulaOperation=re,z.workbookLocale=ii,z.workbookOpen=ut,z.workbookReadonlyAlert=Nr,z.wrap=Hi,z.wrapEvent=nr,Object.defineProperty(z,"__esModule",{value:!0})});
2
11
  //# sourceMappingURL=ej2-spreadsheet.umd.min.js.map