@syncfusion/ej2-spreadsheet 25.2.6 → 25.2.7

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 : 25.2.7
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.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(e,t,r,n,i,a,o,s,l,h,d,p){"use strict";function c(e){var r,n=[];e=-1===(e=e.indexOf("!")>-1?e.split("!")[1]:e).indexOf(":")?e+":"+e:e;if(!new RegExp(/^(?=.*[a-zA-Z])(?=.*\d)/g).test(e)){var i=e.split(":");e=t.isNullOrUndefined(e.match(/[0-9]/))?i[0]+"1:"+i[1]+"1":"A"+i[0]+":A"+i[1]}return e.split(":").forEach(function(e){r=u(e),n.push(r[0]),n.push(r[1])}),n}function u(e){return[parseInt(e.match(/\d+/)[0],10)-1,f(e.match(/[A-Z]+/i)[0].toUpperCase())]}function f(e){for(var t=0,r=(e=e.split("").reverse().join("")).length-1;r>=0;r--)t+=(e[r].charCodeAt(0)-64)*Math.pow(26,r);return t-1}function g(e,t){return v(t+1)+(e+1)}function m(e){return g(e[0],e[1])+":"+(t.isNullOrUndefined(e[2])?g(e[0],e[1]):g(e[2],e[3]))}function v(e){return e/26>1?v(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 c(C(e))}function C(e){return e.split("!")[1]||e}function b(e){return e.name+"!"+e.selectedRange}function x(e,t){return{sheetIndex:S(e,t),indices:y(t)}}function S(e,t){return t.indexOf("!")>-1?ce(e,fe(t)):e.activeSheetIndex}function w(e){var t=e.slice();return e[0]>e[2]&&I(t,0,2),e[1]>e[3]&&I(t,1,3),t}function I(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function E(e){return e[0]===e[2]&&e[1]===e[3]}function R(e,t,r,n,i){return new er(e,t,r,n,i)}function k(e,t){return void 0===t&&(t=[]),t.push({member:"dataBind",args:[e]}),t.push({member:"workbookProtectSheet",args:[e]}),e.allowSave&&t.push({member:"workbookSave",args:[e]}),e.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}function F(e){var t=e.toString();if(e===parseInt(t,10))return parseInt(t,10)+" ";var r=t.indexOf(".")>-1?t.split(".")[1]:0,n=Math.pow(10,r.toString().replace("-","").length),i=Math.abs(A(r,n));return r/i+"/"+n/i}function A(e,t){return e=Number(e),(t=Number(t))?A(t,e%t):e}function N(e){(e=(e=Number(e))>0&&e<1?1+e:0===e?1:e)>60&&(e-=1);var t=new Date("01/01/1900"),r=Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds());return new Date(new Date(864e5*(e-1)+r).toUTCString().replace(" GMT",""))}function O(e,t,r){var n=new Date("01/01/1900"),i=T(e)?e:new Date(e),a=Date.UTC(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds()),o=(Date.UTC(i.getFullYear(),i.getMonth(),i.getDate(),i.getHours(),i.getMinutes(),i.getSeconds(),i.getMilliseconds())-a)/864e5;return(t?o:parseInt(o.toString(),10))+(r?0:o>60?2:1)}function T(e){return"[object Date]"===Object.prototype.toString.call(e)&&!isNaN(e.valueOf())}function D(e){return e-parseFloat(e)>=0}function L(e,r,n,i,a,o){var s,l=t.IntlBase.getDependables(t.cldrData,n,null).dateObject,h=l.dateTimeFormats.availableFormats,d={dateObj:null,isCustom:!1,type:""},p=function(){"time"===d.type&&(d.dateObj=new Date((s?s.toDateString():"01/01/1900")+" "+d.dateObj.toLocaleTimeString()))};if(i&&(d.dateObj=r.parseDate(e,{format:i}),d.dateObj&&(d.type=e.toString().indexOf(":")>-1?"time":"datetime",p(),d.isCustom=!0)),t.isNullOrUndefined(d.dateObj)){if((e=e.toString())&&e.indexOf("/")>-1||e.indexOf("-")>0){var c=a&&a.format||i,u=c.includes("dd-MM-yy");if((u||c.includes("dd/MM/yy"))&&(c=u?"d-M-y":"d/M/y",d.dateObj=r.parseDate(e,{format:c,skeleton:"yMd"}),d.dateObj))return d.type="date",d}var f=function(e){if(e.indexOf(":")<0)for(var n=0,i=Object.keys(l.dateFormats);n<i.length;n++){var a=i[n];if(d.dateObj=r.parseDate(e,{format:l.dateFormats[""+a],skeleton:a}),d.dateObj){d.type="date",d.isCustom=!1;break}}if(t.isNullOrUndefined(d.dateObj))for(var o=void 0,s=0,c=Object.keys(h);s<c.length;s++){a=c[s];if(o=h[""+a],d.dateObj=r.parseDate(e,{format:o,skeleton:a}),!d.dateObj&&e.indexOf(":")>-1&&o.indexOf(":")>-1&&(d.dateObj=r.parseDate(e,{format:o.split(" ")[0]})),d.dateObj){d.type=e.toString().indexOf(":")>-1?"time":"datetime",p(),d.isCustom=!0;break}}if(t.isNullOrUndefined(d.dateObj))for(var u=0,f=Object.keys(l.timeFormats);u<f.length;u++){a=f[u];if(d.dateObj=r.parseDate(e,{format:l.timeFormats[""+a],skeleton:a}),d.dateObj){d.type="time",p(),d.isCustom=!1;break}}};if(o){var g=e.split(" ");g.length>=2&&(f(g.shift()),d.dateObj&&(s=d.dateObj,d.dateObj=null,f(g.join(" ")),d.dateObj&&(d.type="datetime")))}else f(e)}return"#DIV/0!"===e||d.dateObj||"Invalid Date"===new Date(e).toString()||(d.dateObj=new Date(e),d.type="date"),d}function P(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 M(e,t,r,n,i){var a=e.value;return D(a)?{isNumber:!0,value:a}:(a&&(i&&a.includes(i)&&(e.format.includes(i)||e.format.includes("$"))&&(a=a.replace(i,"")),a.includes(r)&&H(a,t,r,n)&&(a=a.split(r).join("")),"."!==n&&a.includes(n)&&(a=a.replace(n,"."))),{isNumber:D(a),value:a})}function H(e,r,n,i){for(var a=!1,o=123456..toLocaleString(r).split(n).reverse(),s=e.split(i)[0].split(n),l=0;l<s.length&&(a=l===s.length-1?s[l].length===o[0].length:!t.isUndefined(o[1])&&(0===l?s[l].length<=o[1].length:s[l].length===o[1].length));l++);return a}function B(e,t){return e&&"="===e[0]&&(e.length>1||t)}function U(e){var t=e;if((t=t.split("$").join("")).indexOf(":")>-1){var r=t.split(":");if(X(r[0])&&X(r[1]))return!0}else if(t.indexOf(":")<0&&X(t))return!0;return!1}function V(e){return e.charCodeAt(0)>=65&&e.charCodeAt(0)<=90||e.charCodeAt(0)>=97&&e.charCodeAt(0)<=122}function _(e,t){return 0===t[1]&&t[3]===e.colCount-1}function z(e,t){return 0===t[0]&&t[2]===e.rowCount-1}function j(e,t,r){return e&&t>=e[0]&&t<=e[2]&&r>=e[1]&&r<=e[3]}function q(e,t,r){for(var n,i,a=e.split(" "),o=0,s=a.length;o<s&&(n=c(a[o]),!(i=j(n,t,r)));o++);return i}function W(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 G(e,t,r){var n=v(r+1);return e?e.split(" ").forEach(function(r){var i=c(r);if(W(i,t))e=e.split(r).join(n+(i[0]+1)+":"+n+t[0]+" "+n+(t[2]+2)+":"+n+(i[2]+1));else if(W(i,t,!0)){var a=void 0;a=t[0]>i[0]?n+(i[0]+1)+":"+n+t[0]:n+(t[2]+2)+":"+n+(i[2]+1),e=e.split(r).join(a)}}):e=n+"1:"+n+t[0]+" "+n+(t[2]+2)+":"+n+"1048576",e}function Y(e,t){return e||(e={}),!!e.isLocked||!1!==e.isLocked&&(!(!t||!t.isLocked)||!(e.isLocked||!t||!1===t.isLocked))}function X(e){for(var t=e,r=0,n="",i=t.length,a=0;a<i;a++)V(t[a])&&r++;var o=(n=t.substring(0,r)).length;if(o!==i&&o<4&&1!==i&&isNaN(parseInt(t,10))){if(K(n)>16384)return!1;var s=parseFloat(t.substring(r,i));if(s>0&&s<1048577)return!0}return!1}function K(e){var t=0,r=0;if(e=e.toUpperCase(),t<e.length&&"!"===e[t]){for(t++;t<e.length&&"!"!==e[t];)t++;t++}for(;t<e.length&&V(e[t]);){r=26*r+e[t].charCodeAt(0)-64,t++}return 0===r?-1:r}function $(e,t,r,n,i){void 0===n&&(n="rows");var a;if(r)for(var o=t;o<1/0;o++)if((a=e[""+n])[t]&&a[t].hidden)t++;else{if(!i)break;i--,t++}else for(o=t;o>-1&&((a=e[""+n])[t]&&a[t].hidden);o--)t--;return t}function Z(e,t){var r=Object.keys(e);return(t?r.indexOf("fontSize")>-1:r.indexOf("fontSize")>-1&&Number(e.fontSize.split("pt")[0])>12)||r.indexOf("fontFamily")>-1||r.indexOf("borderTop")>-1||r.indexOf("borderBottom")>-1}function Q(e,t,r,n,i,a){var o,s;if(t&&(o=(s=i||Re(t[0],t[1],r,!1,!0)).formula||""),o){a&&n.notify(on,{cellRef:g(t[0],t[1])}),0===o.indexOf("=")&&(o=o.slice(1));for(var l=["+","-","*","/",">=","<=","<>",">","<","=","%"],h=void 0,d=o=o.split("(").join(n.listSeparator).split(")").join(n.listSeparator),p=0;p<l.length;p++)d=(h=d.split(l[p])).join(n.listSeparator);h=d.split(n.listSeparator);for(var u=[],f=void 0,m=void 0,v=void 0,y=void 0,C=void 0,b=0;b<h.length;b++)if(v=h[b].includes("!"),C=v?(y=h[b].split("!"))[1].toUpperCase():h[b].toUpperCase(),U(C)&&!C.includes("$")){var x=c(C),S=[e[0]-(t[0]-x[0]),e[1]-(t[1]-x[1]),e[0]-(t[0]-x[2]),e[1]-(t[1]-x[3])];S[1]<0||S[2]<0||S[3]<0||!a&&S[0]<0?f="#REF!":(a&&S[0]<0&&(S[0]=S[2]),f=g(S[0],S[1]),C.includes(":")&&(f+=":"+g(S[2],S[3])),f=U(f)?f:"#REF!"),m={},v&&(f=y[0]+"!"+f),m[h[b]]=f,h[b].includes(":")?u.splice(0,0,m):u.push(m)}var w=void 0,I=void 0,E=o=s.formula;for(b=0;b<u.length;b++){w=Object.keys(u[b])[0],I=u[b][""+w];for(var R=w.length,k=E.indexOf(w),F="",A=0;A<I.length;A++)F+=" ";o=o.slice(0,k)+I+o.slice(k+R),E=E.slice(0,k)+F+E.slice(k+R)}return o}return null}function J(e,t,r){var n={cell:r.cell,rowIndex:r.rowIdx,colIndex:r.colIdx,cancel:!1,sheet:t.name};if(r.preventEvt||e.trigger(Ii,n),!r.eventOnly&&!n.cancel)if(r.valChange){var i=Re(n.rowIndex,n.colIndex,t),a=!r.preventEvt&&e.getDisplayText(i),o=!(!i||!i.formula);ke(n.rowIndex,n.colIndex,t,n.cell,!r.pvtExtend);var s=Re(n.rowIndex,n.colIndex,t,!1,!0);r.mergedCells&&(delete s.value,delete s.formula);var l={action:"updateCellValue",address:[n.rowIndex,n.colIndex],sheetIndex:ce(e,t.name),value:o&&!s.formula?s.value||(0===s.value?"0":""):s.formula||s.value||(0===s.value?"0":""),skipFormatCheck:r.skipFormatCheck,isRandomFormula:r.isRandomFormula};if(e.notify(qr,l),r.isFormulaDependent=l.isFormulaDependent,r.requestType&&null===n.cell&&ke(n.rowIndex,n.colIndex,t,n.cell,!r.pvtExtend),r.cellDelete&&(delete s.value,delete s.formula,delete s.hyperlink),r.uiRefresh&&e.serviceLocator.getService("cell").refresh(n.rowIndex,n.colIndex,r.lastCell,r.td,r.checkCF,r.checkWrap,r.skipFormatCheck,r.isRandomFormula),!r.preventEvt){var h=e.getDisplayText(s);if(h!==a){var d=Re(n.rowIndex,n.colIndex,t,!1,!0).value,p={value:d=d||(0===d?"0":""),oldValue:a,formula:s.formula||"",address:t.name+"!"+g(n.rowIndex,n.colIndex),displayText:h};r.requestType&&(p.requestType=r.requestType),e.trigger("cellSave",p)}}}else ke(n.rowIndex,n.colIndex,t,n.cell,!r.pvtExtend);return n.cancel}function ee(e,r,n){for(var i=e,a=e,o=r,s=r,l=n.usedRange.rowIndex,h=n.usedRange.colIndex,d=function(e){for(var r=0;r<=h;r++)if(!t.isUndefined(Re(e,r,n,null,!0).value))return!1;return!0},p=function(e){for(var r=i;r<=a;r++)if(!t.isUndefined(Re(r,e,n,null,!0).value))return!1;return!0},c=i;c<=l&&(!t.isUndefined(Re(c,r,n,null,!0).value)||!d(c));c++)a=c;for(c=i;c>=0&&(!t.isUndefined(Re(c,r,n,null,!0).value)||!d(c));c--)i=c;for(c=o;c<=h&&(!t.isUndefined(Re(e,c,n,null,!0).value)||!p(c));c++)s=c;for(c=o;c>=0&&(!t.isUndefined(Re(e,c,n,null,!0).value)||!p(c));c--)o=c;return[i,o,a,s]}function te(e,t,r){var n=c(e.model.selectedRange),i=0,a=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,a=n[3]-n[1]+1):n[1]<t[1]&&(i=a=n[3]-n[1]+1):t[1]<=n[3]&&t[3]>=n[3]?(i=0,a=n[3]-n[1]+1):n[3]<t[3]&&(i=a=n[3]-n[1]+1),[t[0],t[1]+i,t[2],t[3]+a]):(r&&(n=[e.start,0,e.end,0]),"above"===e.insertType?t[0]<=n[0]&&t[2]>=n[0]?(i=0,a=n[2]-n[0]+1):n[0]<t[0]&&(i=a=n[2]-n[0]+1):t[0]<=n[2]&&t[2]>=n[2]?(i=0,a=n[2]-n[0]+1):n[2]<t[2]&&(i=a=n[2]-n[0]+1),[t[0]+i,t[1],t[2]+a,t[3]])}function re(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 ne(e,t,r,n){for(var i,a,o=e.length-1;o>=0;o--){i=e[o].range.trim().split(",");for(var s=0;s<i.length;s++)if(a=c(i[s].includes(":")?i[s]:i[s]+":"+i[s]),r>=a[0]&&n>=a[1]&&r<=a[2]&&n<=a[3]){t.push(e[o]),e.splice(o,1);break}}}function ie(e,t){for(var r,n,i,a,o,s=t.trim().split(","),l=function(e){for(var t=0;t<s.length;t++){if(o=c(s[t].includes(":")?s[t]:s[t]+":"+s[t]),e[0]<=o[0]&&e[1]<=o[1]&&e[2]>=o[2]&&e[3]>=o[3])return!0;if(i=e[0]>=o[0]&&e[0]<=o[2],a=e[2]>=o[0]&&e[2]<=o[2],r=e[1]>=o[1]&&e[1]<=o[3],n=e[3]>=o[1]&&e[3]<=o[3],i&&a){if(r||n||e[1]<o[1]&&e[3]>o[3]){if(e[0]-o[0]>0)return!0;if(o[2]-e[2]>0)return!0}if(r&&e[1]!==o[1])return!0;if(n&&e[3]!==o[3])return!0}else if(r&&n){if(i||a||e[0]<o[0]&&e[2]>o[2]){if(e[1]-o[1]>0)return!0;if(o[3]-e[3]>0)return!0}if(i){if(e[0]!==o[0])return!0}else if(a&&e[2]!==o[2])return!0}else if(i||a){if(r){if(e[1]!==o[1])return!0;if(e[0]-o[0]>0)return!0;if(o[2]-e[2]>0)return!0}else if(n){if(e[3]!==o[3])return!0;if(e[0]-o[0]>0)return!0;if(o[2]-e[2]>0)return!0}else if(e[1]<o[1]&&e[3]>o[3])return!0}else if((r||n)&&e[0]<o[0]&&e[2]>o[2])return!0}return!1},h=0;h<e.length;h++)if(l(e[h]))return!0;return!1}function ae(e,r,n,i){var a,o;n||(n=t.getNumberDependable(r,t.defaultCurrencyCode)),i||(i=t.getNumericObject(r));for(var s=0;s<e.length;s++)2===(o=(a=e[s].toString().split(n).join("")).split(i.group)).length&&H(a,r,i.group,i.decimal)&&(a=o.join("")),"."!==i.decimal&&a.includes(i.decimal)&&(a=a.replace(i.decimal,".")),D(a)&&(e[s]=a);return e}function oe(e,t){var r=e.getActiveSheet(),n=[[t.topIndex+e.frozenRowCount(r),t.leftIndex+e.frozenColCount(r),t.bottomIndex,t.rightIndex]];if(r.frozenRows||r.frozenColumns){var i=e.frozenRowCount(r),a=e.frozenColCount(r),o=u(r.topLeftCell);if(i&&a){n.push([o[0],o[1],i-1,a-1]);var s=u(r.paneTopLeftCell);n.push([s[0],o[1],t.bottomIndex,a-1])}i&&n.push([o[0],t.leftIndex+a,i-1,t.rightIndex]),a&&n.push([t.topIndex+i,o[1],t.bottomIndex,a-1])}return n}function se(e){if(je(e.sheet,e.rowIdx)){(t=$(e.sheet,e.rowIdx,!0))<e.rowIdx+e.cell.rowSpan&&(e.rowIdx=t,e.isMergedHiddenCell=!0)}if(Qe(e.sheet,e.colIdx)){var t;(t=$(e.sheet,e.colIdx,!0,"columns"))<e.colIdx+e.cell.colSpan&&(e.colIdx=t,e.isMergedHiddenCell=!0)}}function le(e){var r=new t.Internationalization,n={};r.getNumberFormat(n);var i={intl:r,updateValue:!0,value:""},a={args:i,intl:r,currencySymbol:t.getNumberDependable(e.locale,n.currency)};return function(t){t.format||!t.value||D(t.value)||(i.cell=t,i.value=t.value,e.notify(Wr,i),t.format||!t.value.includes(a.currencySymbol)&&!t.value.includes("%")||(a.fResult=t.value,e.notify(Gr,a)))}}function he(e,r,n,i,a,o,s,l,h,d,p,u){return void 0===h&&(h=!0),new Promise(function(f,m){f(function(){var f;r.indexOf("!")>-1?(f=ce(e,r.split("!")[0]),r=r.slice(r.indexOf("!")+1,r.length)):f=e.activeSheetIndex;var m=Ce(e,f),C=y(d||r),b={sheet:m,indexes:C,formulaCellRef:s,sheetIndex:l,isFinite:e.scrollSettings&&e.scrollSettings.isFinite,promise:new Promise(function(e,t){e(void 0)})};return e.notify(wr,b),b.promise.then(function(){var s,l,d,f=C[0],y=e.frozenRowCount(m),b=e.frozenColCount(m),x=!!u;if(n){d=[];var S,w,I,E,R,k,F;i&&(k=t.getNumericObject(e.locale),F=new t.Internationalization(e.locale)),r.split(",").forEach(function(r,n){for(C=c(r),S=0,f=C[0];f<=C[2];){for(w=d[S]||{},l=_e(m,f),s=C[1];s<=C[3];)if(h&&je(m,f)&&!o)f++;else{I=v(s+1);var a=l?Re(f,s,m):null;i?(w[I]=de(e,a,f,s,!1,F),"string"==typeof(E=a&&(a.value||0===a.value)?a.value:null)&&("."!==k.decimal&&E.includes(k.decimal)?D(R=E.replace(k.decimal,"."))&&(E=parseFloat(R)):D(E)&&(E=parseFloat(E))),w[I+"_value"]=E):(a&&(a.formula||!t.isNullOrUndefined(a.value))||Object.keys(w).length)&&(s===p?("string"!=typeof(E=t.extend({},a,{value:de(e,a,f,s,!0)})).value||!D(E.value)||a.format&&"@"===a.format||(E.value=parseFloat(E.value)),w[I]=E):w[I]=a),s===C[3]&&Object.keys(w).length&&(w.__rowIndex=(f+1).toString(),d[S]=w,x&&0===n&&!qe(m,f)&&u.push(w),S++),s++}f++}})}else{d=new Map;for(var A=!(i||!a||!a.length);f<=C[2];)if(A&&f>=y&&f<a[0])f=a[0];else if(i||!je(m,f)){for(l=_e(m,f),s=C[1];s<=C[3];){var N={cell:Re(f,s,m),address:g(f,s),rowIndex:f,colIndex:s};e.trigger(Dn,N);var O=Re(f,s,m,!1,!0);if(O.formula&&O.formula.toUpperCase().includes("UNIQUE")&&e.notify("calculateFormula",{cell:O,rowIdx:f,colIdx:s,sheetIndex:e.activeSheetIndex,address:N.address}),O.colSpan>1&&O.rowSpan>1)for(var T=void 0,L=f,P=f+O.rowSpan;L<P;L++)for(var M=s,H=s+O.colSpan;M<H;M++)L===f&&M===s||(T=new Object,L!==f&&(T.rowSpan=f-L),M!==s&&(T.colSpan=s-M),m.rows[L]&&m.rows[L].cells&&m.rows[L].cells[M]&&(delete m.rows[L].cells[M].value,delete m.rows[L].cells[M].formula),ke(L,M,m,T,!0));else if(O.colSpan>1)for(L=s+1,P=s+O.colSpan;L<P;L++)ke(f,L,m,{colSpan:s-L},!0),m.rows[f]&&m.rows[f].cells&&m.rows[f].cells[L]&&(delete m.rows[f].cells[L].value,delete m.rows[f].cells[L].formula);else if(O.rowSpan>1)for(L=f+1,P=f+O.rowSpan;L<P;L++)ke(L,s,m,{rowSpan:f-L},!0),m.rows[L]&&m.rows[L].cells&&m.rows[L].cells[s]&&(delete m.rows[L].cells[s].value,delete m.rows[L].cells[s].formula);if(i||!Qe(m,s))if(A&&s>=b&&s<a[1])s=a[1];else{if(O.style){var B={};Object.assign(B,O.style),O.style=B}d.set(N.address,O),s++}else s++}f++}else f++}return d})}())})}function de(e,r,n,i,a,o){if(r){if(t.isNullOrUndefined(r.value))return"";if(r.format){var s={value:r.value,formattedText:r.value,cell:r,format:r.format,checkDate:!a,rowIndex:n,colIndex:i,dataUpdate:!0};return e.notify(Mr,s),s.dateObj&&"Invalid Date"!==s.dateObj.toString()?s.dateObj:a?s.value:s.formattedText.trim()}if(a)return r.value;var l=r.value;if(D(l)&&((l=Number(r.value).toString()).includes(".")||l.length>11)){var h={args:{value:l,updateValue:!0},fResult:l,cellVal:l,intl:o};e.notify(Yr,h),l=h.fResult}return l}return""}function pe(e,r,n){for(var i,a,o,s=0,l=e.length,h=function(h){if(t.isNullOrUndefined(e[h])||t.isUndefined(e[h].index)||(a=s=e[h].index-h,delete e[h].index),s>0){for(i=0;s--;)r?(n.createSheet(h+i),i++):e.splice(h,0,null);h+=a,l+=a}if(r){e[h].id<1&&(e[h].id=xe(n.sheets),e[h].properties&&(e[h].properties.id=e[h].id)),e[h].name||n.setSheetPropertyOnMute(e[h],"name","Sheet"+be(n));var d=0;e[h].rows.forEach(function(e){d=Math.max(d,e&&e.cells&&e.cells.length-1||0)}),n.setSheetPropertyOnMute(e[h],"usedRange",{rowIndex:e[h].rows.length?e[h].rows.length-1:0,colIndex:d})}o=h},d=0;d<l;d++)h(d),d=o}function ce(e,t){var r;t.startsWith("'")&&t.endsWith("'")&&(t=(t=t.replace(/''/g,"'")).slice(1,-1));for(var n=0;n<e.sheets.length;n++)if(e.sheets[n].name.toLowerCase()===t.toLowerCase()){r=n;break}return r}function ue(e,t){for(var r,n=0;n<e.sheets.length;n++)if(e.sheets[n].id===t){r=n;break}return r}function fe(e){return e.split("!")[0].replace(/\'/gi,"")}function ge(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 me(e,t,r,n){void 0===r&&(r={}),e.setSheetPropertyOnMute(r,"selectedRange",n?r.selectedRange+" "+t:t)}function ve(e){return e&&e.selectedRange||"A1"}function ye(e){return e.selectedRange.split(" ")[0]}function Ce(e,t){return e.sheets[t]}function be(e){var t=[];e.sheets.forEach(function(e){t.push(e.name.toLowerCase())});for(var r=0;r<t.length;r++){if(!(t.indexOf("sheet"+e.sheetNameCount)>-1))return e.sheetNameCount++;e.sheetNameCount++}return e.sheetNameCount++}function xe(e){var t=0;return e.forEach(function(e){t=Math.max(e.id,t)}),t+1}function Se(e,r,n){var i=r||e.sheets;i.forEach(function(r){if(r.id=r.id||0,r.name=r.name||"",r.rowCount=t.isUndefined(r.rowCount)?100:r.rowCount,r.colCount=t.isUndefined(r.colCount)?100:r.colCount,r.topLeftCell=r.topLeftCell||"A1",r.activeCell=r.activeCell||"A1",r.selectedRange=r.selectedRange||r.activeCell+":"+r.activeCell,r.usedRange=r.usedRange||{rowIndex:0,colIndex:0},e.setSheetPropertyOnMute(r,"ranges",r.ranges?r.ranges:[]),e.setSheetPropertyOnMute(r,"rows",r.rows&&t.extend([],r.rows,null,!0)||[]),e.setSheetPropertyOnMute(r,"columns",r.columns||[]),r.showHeaders=!!t.isUndefined(r.showHeaders)||r.showHeaders,r.showGridLines=!!t.isUndefined(r.showGridLines)||r.showGridLines,r.state=r.state||"Visible",r.maxHgts=r.maxHgts||[],r.isImportProtected=r.isProtected&&n,r.protectSettings=r.protectSettings||{selectCells:!1,formatCells:!1,formatRows:!1,formatColumns:!1,insertLink:!1},r.isProtected=r.isProtected||!1,!r.paneTopLeftCell||"A1"===r.paneTopLeftCell){r.frozenRows=r.frozenRows?r.frozenRows:0,r.frozenColumns=r.frozenColumns?r.frozenColumns:0;var i=u(r.topLeftCell);e.setSheetPropertyOnMute(r,"paneTopLeftCell",g(r.frozenRows?i[0]+r.frozenRows:i[0],r.frozenColumns?i[1]+r.frozenColumns:i[1]))}pe(r.columns),function(e){e.forEach(function(e){e&&e.cells&&pe(e.cells)}),pe(e)}(r.rows)}),pe(i,!0,e)}function we(e,t){return void 0===t&&(t=e.activeSheetIndex),Ce(e,t).name}function Ie(e,t,r,n,i){var a=!!r;r=r||[e.activeSheetIndex];var o=we(e),s={action:"moveSheet",eventArgs:{position:t=function(e,t,r){for(var n=t;r?n>=0:n<e.length;r?n--:n++)if("Hidden"!==e[n].state&&"VeryHidden"!==e[n].state){t=n;break}return t}(e.sheets,t,e.activeSheetIndex>t),sheetIndexes:r,cancel:!1}};n&&e.trigger("actionBegin",s),s.eventArgs.cancel||(r.forEach(function(r,n){e.sheets.splice(t+n,0,e.sheets.splice(r+(t>r?-1*n:0),1)[0])}),e.setProperties({activeSheetIndex:i?ce(e,o):t>r[0]?t-(r.length-1):t},!0),e.notify(ci,{refresh:a}),n&&(delete s.eventArgs.cancel,e.trigger("actionComplete",s)))}function Ee(e,r,n,i){var a={action:"duplicateSheet",eventArgs:{sheetIndex:r=t.isUndefined(r)?e.activeSheetIndex:r,cancel:!1}};if(n&&e.trigger("actionBegin",a),!a.eventArgs.cancel){var o=Ce(e,r),s=t.extend({},o.properties?o.properties:o,{},!0);s.id=xe(e.sheets);var l=s.name;/^\(\d+\)$/.test("("+l.split(" (")[1])&&(l=l.split(" (")[0]);var h=[];e.sheets.forEach(function(e){h.push(e.name)});for(var d=2;;d++)if(-1===h.indexOf(l+" ("+d+")")){s.name=l+" ("+d+")";break}e.notify(Ei,{sheetIndex:r,newSheetIndex:r+1}),e.createSheet(r+1,[s]),e.notify(jr,{action:"addSheet",sheetName:"Sheet"+s.id,visibleName:s.name,sheetId:s.id}),i||e.setProperties({activeSheetIndex:r+1},!0),e.notify(ci,{refresh:!0,isDuplicate:!0}),n&&(delete a.eventArgs.cancel,e.trigger("actionComplete",a))}}function Re(e,t,r,n,i){var a=_e(r,e);if(!a||!a.cells){if(!n)return i?{}:null;a?r.rows[e].cells=[]:r.rows[e]={cells:[]}}return r.rows[e].cells[t]||(i?{}:null)}function ke(e,r,n,i,a){n.rows[e]?n.rows[e].cells||(n.rows[e].cells=[]):n.rows[e]={cells:[]},a&&n.rows[e].cells[r]?t.extend(n.rows[e].cells[r],i,null,!0):n.rows[e].cells[r]=i}function Fe(e,t){var r,n={fontFamily:"Calibri",verticalAlign:"bottom",textIndent:"0pt",backgroundColor:"#ffffff",color:"#000000",textAlign:"left",fontSize:"11pt",fontWeight:"normal",fontStyle:"normal",textDecoration:"none",border:"",borderLeft:"",borderTop:"",borderRight:"",borderBottom:""},i={};return Object.keys(t?n:e).forEach(function(t){(r=e[""+t])!==n[""+t]&&(i[""+t]=r)}),i}function Ae(e,t,r,n){void 0===t&&(t=!0);for(var i=r.getAddressInfo(e),a=i.indices,o=Ce(r,i.sheetIndex),s=i.sheetIndex===r.activeSheetIndex,l=a[0];l<=a[2];l++)for(var h=a[1];h<=a[3];h++)!J(r,o,{cell:{wrap:t},rowIdx:l,colIdx:h,preventEvt:n})&&s&&r.notify(yn,{range:[l,h,l,h],wrap:t,sheet:o,initial:!0});r.setProperties({sheets:r.sheets},!0)}function Ne(e){var t;if(e.indexOf("[")>-1){var r=e.split("[")[1].split("]")[0];["Black","Blue","Cyan","Green","Magenta","Red","White","Yellow"].indexOf(r)>-1&&(t=r)}return t}function Oe(){return["Black","Blue","Cyan","Green","Magenta","Red","White","Yellow"]}function Te(e,t,r,n){var i;return!e.includes("d")&&!e.includes("y")||e.includes("#")||Ne(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("#")&&!Ne(e)&&/^[dyMhHmsaAP0,\:[\]\-. \/]*$/.test(e)&&(r&&(r.type=r.type||"",r.type+="time"),i=!0),i}function De(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 Le(t){var r=!1;for(var n in e.ExcelFileFormats)if(t.indexOf("."+n+"]")>-1){r=!0;break}return r}function Pe(e){var t=[];return e.includeBasicFormulas&&t.push({member:"basic-formulas",args:[e]}),t}function Me(e,r){for(var n=r,i=e.replace(/\[/g,".").replace(/\]/g,"").split("."),a=0;a<i.length&&!t.isUndefined(n);a++)n=n[i[a]];return n}function He(e,r,n){var i,a,o=e.replace(/\[/g,".").replace(/\]/g,"").split("."),s=n||{},l=s,h=o.length;for(i=0;i<h;i++)a=o[i],i+1===h?l[""+a]=void 0===r?{}:r:t.isNullOrUndefined(l[""+a])&&(l[""+a]={}),l=l[""+a];return s}function Be(e){for(var t=[],r=0;e>0&&r<9;){e--;var n="A".charCodeAt(0);t[r]=String.fromCharCode(e%26+n),e=parseInt((e/26).toString(),10),r++}for(var i=[],a=0;a<r;a++)i[r-a-1]=t[a];return i.join("")}function Ue(e){var t="General";switch(e.split(" ").join("")){case"Number":t="0.00";break;case"Currency":t=Li.currency[0];break;case"Accounting":t=Li.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 Ve(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&&(Li.currency.indexOf(e)>-1?r="Currency":Li.accounting.indexOf(e)>-1||'_(* #,##0_);_(* (#,##0);_(* "-"_);_(@_)'===e||'_(* #,##0.00_);_(* (#,##0.00);_(* "-"??_);_(@_)'===e?r="Accounting":e.includes("?/?")?r="Fraction":e.includes("[$")&&(r=e.includes("* ")?"Accounting":"Currency"),t=!1)}return t&&("Currency"===r&&"$#,##0.00"!==Li.currency[0]||"Accounting"===r&&'_($* #,##0.00_);_($* (#,##0.00);_($* "-"??_);_(@_)'!==Li.accounting[0])&&(r="General"),r}function _e(e,t){return e.rows[t]}function ze(e,t,r){e.rows[t]||(e.rows[t]={}),Object.keys(r).forEach(function(n){e.rows[t][""+n]=r[""+n]})}function je(e,t){return e.rows[t]&&e.rows[t].hidden}function qe(e,t){return e.rows[t]&&e.rows[t].isFiltered}function We(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;if(r&&window.devicePixelRatio%1>0){var a=i*window.devicePixelRatio%1;return i+(a?(a>.5?1-a:-1*a)/window.devicePixelRatio:0)}return i}function Ge(e,t,r){e&&e.rows&&(e.rows[t]||(e.rows[t]={}),e.rows[t].height=r)}function Ye(e,t,r,n,i){void 0===r&&(r=t);var a,o=0;t>r&&(a=t,t=r,r=a);for(var s=t;s<=r;s++)o+=We(e,s,n,i);return o}function Xe(e,t){return e.columns?e.columns[t]||(e.columns[t]={}):(e.columns=[],e.columns[t]={}),e.columns[t]}function Ke(e,t,r){var n=Xe(e,t);Object.keys(r).forEach(function(e){n[""+e]=r[""+e]})}function $e(e,t,r,n){var i;if(e&&e.columns&&e.columns[t]){if(!r&&e.columns[t].hidden)return 0;i=e.columns[t].width||e.columns[t].customWidth?e.columns[t].width:64}else i=64;if(n&&window.devicePixelRatio%1>0){var a=i*window.devicePixelRatio%1;return i+(a?(a>.5?1-a:-1*a)/window.devicePixelRatio:0)}return i}function Ze(e,t,r,n){void 0===r&&(r=t);var i=0;if(t>r){var a=t;t=r,r=a}for(var o=t;o<=r;o++)i+=$e(e,o,null,n);return i}function Qe(e,t){return e.columns[t]&&e.columns[t].hidden}function Je(e,t,r){return!!(e&&e.validation&&(!e.validation.address||e.validation.address&&q(e.validation.address,t,r)))}function et(e){var t=[];return function(e,t){e.showRibbon&&t.push({member:"ribbon",args:[e]});e.showFormulaBar&&t.push({member:"formulaBar",args:[e]});e.showSheetTabs&&t.push({member:"sheetTabs",args:[e]});e.allowEditing&&(t.push({member:"edit",args:[e]}),t.push({member:"formula",args:[e]}));e.allowOpen&&t.push({member:"open",args:[e]});e.allowSave&&t.push({member:"save",args:[e]});e.enableContextMenu&&t.push({member:"contextMenu",args:[e]});e.allowAutoFill&&t.push({member:"autofill",args:[e]});"None"!==e.selectionSettings.mode&&t.push({member:"selection",args:[e]});e.enableKeyboardNavigation&&t.push({member:"keyboardNavigation",args:[e]});e.allowNumberFormatting&&t.push({member:"numberFormat",args:[e]});e.enableKeyboardShortcut&&t.push({member:"keyboardShortcut",args:[e]});e.enableClipboard&&t.push({member:"clipboard",args:[e]});e.allowCellFormatting&&t.push({member:"cellformat",args:[e]});e.allowSorting&&t.push({member:"sort",args:[e]});e.allowResizing&&t.push({member:"resize",args:[e]});t.push({member:"protectSheet",args:[e]}),t.push({member:"workbookFormula",args:[e]}),t.push({member:"workbookEdit",args:[e]}),e.allowHyperlink&&t.push({member:"spreadsheetHyperlink",args:[e]});e.allowUndoRedo&&t.push({member:"undoredo",args:[e]});e.allowFiltering&&t.push({member:"filter",args:[e]});e.allowWrap&&t.push({member:"wrapText",args:[e]});e.allowInsert&&t.push({member:"insert",args:[e]});e.allowDelete&&t.push({member:"delete",args:[e]});e.allowDataValidation&&t.push({member:"dataValidation",args:[e]});e.allowFindAndReplace&&t.push({member:"findAndReplace",args:[e]});e.allowMerge&&t.push({member:"merge",args:[e]});e.allowConditionalFormat&&t.push({member:"conditionalFormatting",args:[e]});e.allowImage&&t.push({member:"spreadsheetImage",args:[e]});e.allowChart&&t.push({member:"spreadsheetChart",args:[e]})}(e,t),k(e,t),t}function tt(e){requestAnimationFrame(function(){e()})}function rt(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function nt(e){var t=30;return e.toString().length>3&&(t=10*e.toString().length),t}function it(){if(null!==Ll)return Ll;var e=document.createElement("div"),t=0;return e.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),Ll=t}function at(e,t){void 0===t&&(t=Ml);return ot(e,"previous",t)+ot(e,"next",t)}function ot(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 st(e,t,r){if(e.scrollSettings.enableVirtualization){var n=e.getActiveSheet(),i=e.frozenRowCount(n),a=e.frozenColCount(n),o=e.viewport.topIndex+i,s=e.viewport.leftIndex+a,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(o<=t[0]&&l>=t[2]&&s<=t[1]&&h>=t[3])return!0;var d=!1;if(r){if(t[0]<o&&t[2]<o||t[0]>l&&t[2]>l)return!1;if(t[0]<o&&t[2]>o&&t[0]>=i&&(t[0]=o,d=!0),t[2]>l&&(t[2]=l,d=!0),t[1]<s&&t[3]<s||t[1]>h&&t[3]>h)return!1;t[1]<s&&t[3]>s&&t[1]>=a&&(t[1]=s,d=!0),t[3]>h&&(t[3]=h,d=!0)}return d}return!0}function lt(e,t,r,n,i,a,o,s){var l,h={idx:0,size:0},d={idx:0,size:0},p=d.size,c=h.size;for(l=d.idx;l<t[0];l++)r&&r-1<t[0]&&l<r||(p+=We(e,l,!s));for(l=h.idx;l<t[1];l++)n&&n-1<t[1]&&l<n||(c+=$e(e,l,null,!s));return r&&t[0]<r&&(e.showHeaders&&(p+=30),i&&(p-=i)),n&&t[1]<n&&(e.showHeaders&&(c+=o||30),a&&(c-=a)),{top:p,left:c}}function ht(e,r,n,i,a,o,s){void 0===i&&(i="e-selection");var l=e.getActiveSheet();if(!l.frozenRows&&!l.frozenColumns){var h=pt(e,r,n,l,e.enableRtl,0,0,a);return r&&!e.getMainContent().querySelector("."+i)&&e.getMainContent().appendChild(r),h}var d,p=e.frozenRowCount(l),c=e.frozenColCount(l);if("e-active-cell"===i){if(n[0]<p||n[1]<c){r.style.display="none";(m=(d=n[0]<p&&n[1]<c?e.getSelectAllContent():n[0]<p?e.getColumnHeaderContent():e.getRowHeaderContent()).querySelector("."+i))||(m=r.cloneNode(!0),d.appendChild(m)),pt(e,r=m,n,l,e.enableRtl,p,c,a,!0,e.viewport.beforeFreezeHeight,e.viewport.beforeFreezeWidth,e.sheetModule.colGroupWidth)}else pt(e,r,n,l,e.enableRtl,p,c,a);r.style.display&&(r.style.display=""),dt(e.getSelectAllContent(),d,"e-active-cell"),dt(e.getColumnHeaderContent(),d,"e-active-cell"),dt(e.getRowHeaderContent(),d,"e-active-cell")}else if("e-autofill"===i){var u=void 0,f=e.frozenRowCount(l),g=e.frozenColCount(l);if(n[0]<f||n[1]<g){r.style.display="none";(m=(u=n[0]<f&&n[1]<g?e.getSelectAllContent():n[0]<f?e.getColumnHeaderContent():e.getRowHeaderContent()).querySelector("."+i))||(m=r.cloneNode(!0),u.appendChild(m)),pt(e,r=m,n,l,e.enableRtl,f,g,a,!0,e.viewport.beforeFreezeHeight,e.viewport.beforeFreezeWidth,e.sheetModule.colGroupWidth,"e-autofill")}else pt(e,r,n,l,e.enableRtl,f,g,a,!1,0,0,0,"e-autofill");r.style.display&&(r.style.display=""),dt(e.getSelectAllContent(),u,"e-autofill"),dt(e.getColumnHeaderContent(),u,"e-autofill"),dt(e.getRowHeaderContent(),u,"e-autofill")}else if("e-filloption"===i){u=void 0,f=e.frozenRowCount(l),g=e.frozenColCount(l);if(n[0]<f||n[1]<g)if(n[3]+1===g&&n[2]+1>f)pt(e,e.getMainContent().querySelector(".e-filloption"),n,l,e.enableRtl,f,g,a,!1,0,0,0,"e-filloption",!0,{left:-4});else if(n[2]+1===f&&n[3]+1>g)pt(e,e.getMainContent().querySelector(".e-filloption"),n,l,e.enableRtl,f,g,a,!1,0,0,0,"e-filloption",!0,{top:-4});else if(n[3]+1===g&&n[2]+1<f){(u=e.getColumnHeaderContent()).querySelector("."+i)||e.notify(mi,{id:e.element.id+"_autofilloptionbtn",appendElem:u}),r=e.autofillModule.autoFillDropDown.element,pt(e,r,n,l,e.enableRtl,f,g,a,!1,0,0,0,"e-filloption",!0,{left:-4})}else if(n[2]+1===f&&n[3]+1===g)pt(e,e.getMainContent().querySelector(".e-filloption"),n,l,e.enableRtl,f,g,a,!1,0,0,0,"e-filloption",!0,{top:-4,left:-4});else{var m;(m=(u=n[0]<f&&n[1]<g?e.getSelectAllContent():n[0]<f?e.getColumnHeaderContent():e.getRowHeaderContent()).querySelector("."+i))||e.notify(mi,{id:e.element.id+"_autofilloptionbtn",appendElem:u}),r=e.autofillModule.autoFillDropDown.element,pt(e,r,n,l,e.enableRtl,f,g,a,!0,e.viewport.beforeFreezeHeight,e.viewport.beforeFreezeWidth,e.sheetModule.colGroupWidth,"e-filloption",!0)}else pt(e,e.getMainContent().querySelector(".e-filloption"),n,l,e.enableRtl,f,g,a,!1,0,0,0,"e-filloption",!0);r.style.display&&(r.style.display=""),dt(e.getSelectAllContent(),u,"e-filloption"),dt(e.getColumnHeaderContent(),u,"e-filloption"),dt(e.getRowHeaderContent(),u,"e-filloption")}else{var v=w(n);if(v[0]<p||v[1]<c){r&&!r.classList.contains("e-multi-range")&&r.classList.add("e-hide");var y=[];v[0]<p&&v[1]<c?v[2]<p&&v[3]<c?(y.push(n),o||(dt(e.getColumnHeaderContent(),d,i,!0),dt(e.getRowHeaderContent(),d,i,!0))):v[2]>p-1?v[3]<c?(o||dt(e.getColumnHeaderContent(),d,i,!0),y.push([v[0],v[1],p-1,v[3]]),y.push([p,v[1],v[2],v[3]])):(y.push([v[0],v[1],p-1,c-1]),y.push([p,v[1],v[2],c-1]),y.push([v[0],c,p-1,v[3]]),y.push([p,c,v[2],v[3]])):v[2]<p?(y.push([v[0],v[1],v[2],c-1]),y.push([v[0],c,v[2],v[3]]),o||dt(e.getRowHeaderContent(),d,i,!0)):(y.push([p,v[1],v[2],c-1]),y.push([v[0],v[1],p-1,c-1]),y.push([p,c,v[2],v[3]]),y.push([v[0],c,p-1,v[3]])):v[0]<p?v[2]<p?(y.push(n),o||dt(e.getRowHeaderContent(),d,i,!0)):(y.push([v[0],v[1],p-1,v[3]]),y.push([p,v[1],v[2],v[3]]),o||(dt(e.getSelectAllContent(),d,i,!0),dt(e.getRowHeaderContent(),d,i,!0))):v[3]<c?(y.push(n),o||dt(e.getSelectAllContent(),d,i,!0)):(y.push([v[0],v[1],v[2],c-1]),y.push([v[0],c,v[2],v[3]]),o||(dt(e.getSelectAllContent(),d,i,!0),dt(e.getColumnHeaderContent(),d,i,!0)));var C;y.forEach(function(n){d=n[2]<p&&n[3]<c?e.getSelectAllContent():n[2]<p?e.getColumnHeaderContent():n[3]<c?e.getRowHeaderContent():e.getMainContent();var h;"e-copy-indicator"===i||"e-range-indicator"===i?(h=r.cloneNode(!0),d.appendChild(h),p&&(n[2]+1===p&&y.forEach(function(e){e!==n&&(C=h.getElementsByClassName("e-bottom")[0])&&e[0]===p&&t.detach(C)}),n[0]===p&&d.parentElement.classList.contains("e-main-panel")&&y.forEach(function(e){e!==n&&(C=h.getElementsByClassName("e-top")[0])&&e[2]+1===p&&t.detach(C)})),c&&(n[3]+1===c&&y.forEach(function(e){e!==n&&(C=h.getElementsByClassName("e-right")[0])&&e[1]===c&&t.detach(C)}),n[1]===c&&(d.classList.contains("e-sheet-content")||d.classList.contains("e-column-header"))&&y.forEach(function(e){e!==n&&(C=h.getElementsByClassName("e-left")[0])&&e[3]+1===c&&t.detach(C)}))):((h=d.querySelector("."+i))||(h=r.cloneNode(!0),o&&!h.classList.contains("e-multi-range")&&h.classList.add("e-multi-range"),d.appendChild(h)),s&&h.classList.remove(i)),pt(e,h,n,l,e.enableRtl,p,c,a,!1,e.viewport.beforeFreezeHeight,e.viewport.beforeFreezeWidth,e.sheetModule.colGroupWidth),h.classList.contains("e-hide")&&h.classList.remove("e-hide")})}else o||(dt(e.getSelectAllContent(),null,i,!0),dt(e.getColumnHeaderContent(),null,i,!0),dt(e.getRowHeaderContent(),null,i,!0)),pt(e,r,n,l,e.enableRtl,p,c,a),"e-range-indicator"!==i&&e.getMainContent().querySelector("."+i)||e.getMainContent().appendChild(r),r.classList.contains("e-hide")&&r.classList.remove("e-hide"),s&&r.classList.remove(i)}}function dt(e,r,n,i,a){if(i||e!==r)if(a)for(var o=e.querySelectorAll("."+n),s=0;s<o.length;)o[s].classList.remove(n),s++;else{var l=e.querySelector("."+n);l&&!l.classList.contains("e-multi-range")&&t.detach(l)}}function pt(e,r,n,i,a,o,s,l,h,d,p,c,u,f,g){var m,v,y=w(n),C=lt(i,y,o,s,d,p,c),b=[$(i,0,!0),$(i,0,!0,"columns")];e.scrollSettings.isFinite?(m=y[0]>=i.rowCount?0:Ye(i,y[0],y[2]<i.rowCount?y[2]:i.rowCount-1,!0),v=y[1]>=i.colCount?0:Ze(i,y[1],y[3]<i.colCount?y[3]:i.colCount-1,!0)):(m=Ye(i,y[0],y[2],!0),v=Ze(i,y[1],y[3],!0));var x=0===y[1]&&y[3]===i.colCount-1,S=0===y[0]&&y[2]===i.rowCount-1,I=0,E=-5,R=-5,k=0,F=6,A=6;if(t.isNullOrUndefined(u)){if((N={top:(y[0]===b[0]?C.top:C.top-kt(1))+"px",height:m&&m+(y[0]===b[0]?0:kt(1))+"px",width:v&&v+(y[1]===b[1]?0:kt(1))+(h&&s&&y[1]<s&&y[3]>=s?1:0)+"px"})[a?"right":"left"]=(y[1]===b[1]?C.left:C.left-1)+"px",r){return ct([{element:r,attrs:N}],l)}}else{x&&(E=-5,R=-2,F=6,A=3),S&&(R=-5,E=0,F=1,A=6),S||(I+=m),x||(k+=v),I+=Math.round(C.top)+E,k+=Math.round(C.left)+R;var N={};f?(t.removeClass([r],"e-hide"),I=g&&g.top?g.top:I,k=g&&g.left?g.left:k,(N={top:I+F+"px"})[a?"right":"left"]=k+A+"px",r&&ct([{element:r,attrs:N}],l)):((N={top:I+"px"})[a?"right":"left"]=k+"px",r&&ct([{element:r,attrs:N}],l))}}function ct(e,r){return new Promise(function(n){var i=function(){e.forEach(function(e){t.setStyleAttribute(e.element,e.attrs),n()})};r?i():requestAnimationFrame(function(){return i()})})}function ut(){return t.Browser.isPointer?"pointerdown":"mousedown touchstart"}function ft(){return t.Browser.isPointer?"pointermove":"mousemove touchmove"}function gt(){return t.Browser.isPointer?"pointerup":"mouseup touchend"}function mt(e){return"touchstart"===e.type||"pointerdown"===e.type&&"touch"===e.pointerType}function vt(e){return"touchmove"===e.type||"pointermove"===e.type&&"touch"===e.pointerType}function yt(e){return"touchend"===e.type||"pointerup"===e.type&&"touch"===e.pointerType}function Ct(e){return e&&("mousedown"===e.type||"pointerdown"===e.type)}function bt(e){return e&&("mousemove"===e.type||"pointermove"===e.type)}function xt(e){return e&&("mouseup"===e.type||"pointerup"===e.type)}function St(e){return e===Tl.UP||e===Tl.DOWN||e===Tl.LEFT||e===Tl.RIGHT}function wt(e){return e.changedTouches?e.changedTouches[0].clientX:e.clientX}function It(e){return e.changedTouches?e.changedTouches[0].clientY:e.clientY}function Et(e){return e.changedTouches?e.changedTouches[0].pageX:e.pageX}function Rt(e){return e.changedTouches?e.changedTouches[0].pageY:e.pageY}function kt(e,t){if(window.devicePixelRatio%1>0){var r=e*window.devicePixelRatio%1;return e+(r?(r>.5||t?1-r:-1*r)/window.devicePixelRatio:0)}return e}function Ft(e,t){Object.keys(t).forEach(function(r){e&&e.setAttribute(Hl[""+r],t[""+r])})}function At(e,r){if(e){var n=t.getComponent(e,r);n&&n.destroy()}}function Nt(e,t,r,n,i){var a,o,s,l,h,d,p,c,u,f=i.getActiveSheet(),g=i.frozenRowCount(f),m=i.frozenColCount(f);if(n){var v=e<m?i.getSelectAllContent():i.getColumnHeaderContent();a=v.getElementsByTagName("th")[t],o=v.getElementsByTagName("col")[t],s=(e<m?i.getRowHeaderContent():i.getMainContent()).getElementsByTagName("col")[t]}else{a=o=g||m?i.getRow(e,null,m-1):i.getRow(e,i.getRowHeaderTable()),o.style.height=parseInt(r,10)>0?kt(parseInt(r,10))+"px":"2px",(s=i.getRow(e,null,m)).style.height=parseInt(r,10)>0?kt(parseInt(r,10))+"px":"0px";var y=void 0;if(f.showHeaders){var C=i.getRowHeaderContent().getElementsByClassName("e-row"),b=[];b[0]=C[t].getElementsByTagName("td")[0].cloneNode(!0),y=Tt(i.getRowHeaderTable(),b,!1,i)+1}for(var x=i.getMainContent().getElementsByClassName("e-row"),S=[],w=0;w<x[t].getElementsByTagName("td").length;w++)S[w]=x[t].getElementsByTagName("td")[w].cloneNode(!0);var I=Tt(i.getContentTable(),S,!1,i)+1,E=y>=I?y:I;parseInt(s.style.height,10)<E||a&&a.classList.contains("e-reach-fntsize")&&parseInt(s.style.height,10)===E?(f.showHeaders&&(a.classList.add("e-reach-fntsize"),o.style.lineHeight=parseInt(r,10)>=4?parseInt(r,10)-4+"px":parseInt(r,10)>0?parseInt(r,10)-1+"px":"0px"),s.style.lineHeight=parseInt(r,10)>0?parseInt(r,10)-1+"px":"0px"):(o&&o.style.removeProperty("line-height"),s.style.removeProperty("line-height"),a&&a.classList.contains("e-reach-fntsize")&&a.classList.remove("e-reach-fntsize"))}if(d=s.previousElementSibling,u=s.nextElementSibling,d&&(f.showHeaders&&(l=a.previousElementSibling,h=o.previousElementSibling),d=s.previousElementSibling),u&&(f.showHeaders&&(p=a.nextElementSibling,c=o.nextElementSibling),u=s.nextElementSibling),parseInt(r,10)<=0&&!s.classList.contains("e-zero")&&!s.classList.contains("e-zero-start")){if(d&&u)if(n?(f.showHeaders&&(o.style.width="2px"),s.style.width="0px"):(f.showHeaders&&(o.style.height="2px"),s.style.height="0px"),d.classList.contains("e-zero-start")?(f.showHeaders&&a.classList.add("e-zero-start"),s.classList.add("e-zero-start")):(f.showHeaders&&a.classList.add("e-zero"),s.classList.add("e-zero")),!p||p.classList.contains("e-zero")||p.classList.contains("e-zero-last")||(f.showHeaders&&a.classList.add("e-zero-last"),s.classList.add("e-zero-last")),d.classList.contains("e-zero-last")&&(f.showHeaders&&l.classList.remove("e-zero-last"),d.classList.remove("e-zero-last")),f.showHeaders&&l.classList.contains("e-zero")?(a.classList.contains("e-zero-end"),Ot(h,-2,n)):f.showHeaders&&Ot(h,-1,n),f.showHeaders&&l.classList.contains("e-zero-start")&&Ot(o,-1,n),f.showHeaders&&p.classList.contains("e-zero"))if(a.classList.contains("e-zero-start"))for(;p;){if(p.classList.contains("e-zero")&&0!==parseInt(c.style.height,10)&&!n||0!==parseInt(c.style.width,10)&&n){n?(o.style.width=parseInt(o.style.width,10)-1+"px",c.style.width=parseInt(c.style.width,10)-1+"px"):(o.style.height=parseInt(o.style.height,10)-1+"px",c.style.height=parseInt(c.style.height,10)-1+"px"),p.classList.remove("e-zero"),p.classList.add("e-zero-start");break}var R=void 0;p.classList.remove("e-zero"),p.classList.add("e-zero-start"),n?(R=parseInt(p.getAttribute("aria-colindex"),10)-1,p=i.getColHeaderTable().getElementsByTagName("th")[R+1],c=i.getColHeaderTable().getElementsByTagName("col")[R+1]):(R=parseInt(p.getAttribute("aria-rowindex"),10)-1,p=i.getRowHeaderTable().getElementsByTagName("tr")[R+1],c=i.getRowHeaderTable().getElementsByTagName("tr")[R+1])}else Ot(o,-2,n);else f.showHeaders&&(p.classList.contains("e-zero-end")?n?o.style.width="0px":o.style.height="0px":Ot(c,-1,n));else if(d)n?(f.showHeaders&&(o.style.width="1px"),s.style.width="0px"):(f.showHeaders&&(o.style.height="1px"),s.style.height="0px"),f.showHeaders&&a.classList.add("e-zero-end"),s.classList.add("e-zero-end"),f.showHeaders&&a.classList.add("e-zero-last"),s.classList.add("e-zero-last"),f.showHeaders&&l.classList.contains("e-zero")?Ot(h,-2,n):Ot(h,-1,n);else if(p)if(a.classList.add("e-zero-start"),s.classList.add("e-zero-start"),p.classList.contains("e-zero")||(a.classList.add("e-zero-last"),s.classList.add("e-zero-last")),n?(o.style.width="1px",s.style.width="0px"):(o.style.height="1px",s.style.height="0px"),f.showHeaders&&p.classList.contains("e-zero"))for(;p;){if(p.classList.contains("e-zero")&&0!==parseInt(c.style.width,10)&&n||0!==parseInt(c.style.height,10)&&!n){n?(c.style.width=parseInt(c.style.width,10)-1+"px",o.style.width=parseInt(o.style.width,10)-1+"px"):(c.style.height=parseInt(c.style.height,10)-1+"px",o.style.height=parseInt(o.style.height,10)-1+"px"),p.classList.add("e-zero-start"),p.classList.remove("e-zero");break}R=void 0;p.classList.add("e-zero-start"),p.classList.remove("e-zero"),n?(R=parseInt(p.getAttribute("aria-colindex"),10)-1,c=i.getColHeaderTable().getElementsByTagName("col")[R+1],p=i.getColHeaderTable().getElementsByTagName("th")[R+1]):(R=parseInt(p.getAttribute("aria-rowindex"),10)-1,c=i.getRowHeaderTable().getElementsByTagName("tr")[R+1],p=i.getRowHeaderTable().getElementsByTagName("tr")[R+1])}else f.showHeaders&&Ot(c,-1,n)}else if(parseInt(r,10)>0){var k=kt(parseInt(r,10))+"px";n?(o.style.width=k,s.style.width=k):(o.style.height=k,s.style.height=k),f.showHeaders&&l&&p?(l.classList.contains("e-zero")?a.classList.contains("e-zero")?n?(h.style.width=parseInt(h.style.width,10)+2+"px",o.style.width=parseInt(o.style.width,10)-1+"px"):(h.style.height=parseInt(h.style.height,10)+2+"px",o.style.height=parseInt(o.style.height,10)-1+"px"):Ot(o,-1,n):a.classList.contains("e-zero")?Ot(h,1,n):a.classList.contains("e-zero-start")&&(n?(h.style.width=parseInt(h.style.width,10)+1+"px",o.style.width=parseInt(o.style.width,10)-1+"px"):(h.style.height=parseInt(h.style.height,10)+1+"px",o.style.height=parseInt(o.style.height,10)-1+"px")),p.classList.contains("e-zero")?Ot(o,-1,n):(a.classList.contains("e-zero")||a.classList.contains("e-zero-start"))&&Ot(c,1,n),a.classList.contains("e-zero")&&a.classList.remove("e-zero"),a.classList.contains("e-zero-start")&&a.classList.remove("e-zero-start"),s.classList.contains("e-zero")&&s.classList.remove("e-zero"),s.classList.contains("e-zero-start")&&s.classList.remove("e-zero-start"),a.classList.contains("e-zero-last")&&a.classList.remove("e-zero-last"),s.classList.contains("e-zero-last")&&s.classList.remove("e-zero-last"),(l.classList.contains("e-zero")||l.classList.contains("e-zero-start"))&&(l.classList.add("e-zero-last"),d.classList.add("e-zero-last"))):f.showHeaders&&l?(l.classList.contains("e-zero")?a.classList.contains("e-zero")?n?(o.style.width=parseInt(o.style.width,10)-1+"px",h.style.width=parseInt(h.style.width,10)+2+"px"):(o.style.height=parseInt(o.style.height,10)-1+"px",h.style.height=parseInt(h.style.height,10)+2+"px"):Ot(o,-1,n):a.classList.contains("e-zero")?Ot(h,1,n):Ot(o,-1,n),a.classList.contains("e-zero")&&a.classList.remove("e-zero"),a.classList.contains("e-zero-end")&&a.classList.remove("e-zero-end"),s.classList.contains("e-zero")&&s.classList.remove("e-zero"),s.classList.contains("e-zero-end")&&s.classList.remove("e-zero-end")):f.showHeaders&&p&&(p.classList.contains("e-zero")?Ot(o,-1,n):a.classList.contains("e-zero-start")&&(Ot(c,1,n),a.classList.remove("e-zero-start")),a.classList.contains("e-zero")&&a.classList.remove("e-zero"),s.classList.contains("e-zero")&&s.classList.remove("e-zero"),a.classList.contains("e-zero-start")&&a.classList.remove("e-zero-start"),s.classList.contains("e-zero-start")&&s.classList.remove("e-zero-start"))}}function Ot(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 Tt(e,t,r,n,i,a){var o=n.createElement("div",{className:n.element.className,styles:"display: block"}),s=n.createElement("table",{className:e.className+"e-resizetable",styles:"width: auto;height: auto"}),l=n.createElement("tr");r?t.forEach(function(e){var t=l.cloneNode();t.appendChild(e),s.appendChild(t)}):(t.forEach(function(e){l.appendChild(e.cloneNode(!0))}),s.appendChild(l)),o.appendChild(s),document.body.appendChild(o);var h,d,p=s.getBoundingClientRect().width,c=s.getBoundingClientRect().height;return a?(h=r&&parseInt(i,10)>p?p:parseInt(i,10),d=!r&&parseInt(i,10)>c?c:parseInt(i,10)):(d=c,h=p),document.body.removeChild(o),r?Math.ceil(h):Math.ceil(d)}function Dt(e,r,n,i,a,o){var s,l,h,d,p,c,u,f,g,m,v,C,b=e.eventArgs,w=e.isFromUpdateAction||t.isUndefined(n);if(e.isUndoRedo)return w=e.isFromUpdateAction=!0,delete e.isUndoRedo,void r.notify(Lo,e);if(w&&!o){var I=b.address||b.range||b.pastedRange||b.addressCollection&&b.addressCollection[0]||b.dataRange;if((N=t.isUndefined(b.sheetIndex)?t.isUndefined(b.sheetIdx)?t.isUndefined(b.activeSheetIndex)?I?S(r,I):r.activeSheetIndex:b.activeSheetIndex:b.sheetIdx:b.sheetIndex)!==r.activeSheetIndex){var E={sheet:Ce(r,N),resolveAfterFullDataLoaded:!0,indexes:[0,0,0,0],promise:new Promise(function(e){e(void 0)})};return r.notify(wr,E),void E.promise.then(function(){Dt(e,r,n,i,a,!0)})}}var R,k,F;switch(e.action){case"sorting":d={args:{range:e.eventArgs.range,sortOptions:e.eventArgs.sortOptions,cancel:!1},promise:h=new Promise(function(e,t){e(void 0)})},r.notify(ln,d),d.promise.then(function(e){r.serviceLocator.getService("cell").refreshRange(y(e.range))});break;case"cellSave":c=(R={element:(p=e.eventArgs).element,value:p.value,oldValue:p.oldValue,address:p.address,displayText:p.displayText,formula:p.formula,originalEvent:p.originalEvent}).formula?{formula:R.formula}:{value:R.value},r.updateCell(c,R.address),!0===n&&r.trigger("cellSave",R);break;case"cellDelete":k=x(r,e.eventArgs.address),Xt(r,k.indices,k.sheetIndex);break;case"format":if("CellFormat"===b.requestType){if(b.style&&b.style.border&&!t.isNullOrUndefined(b.borderType)){var A={};Object.assign(A,b.style,null,!0),b.style.border=void 0,r.notify(Br,{style:b.style,refreshRibbon:!0,range:b.range}),b.style.border=A.border,r.setBorder(b.style,b.range,b.borderType),b.style=A}else r.notify(Br,{style:b.style,refreshRibbon:!0,range:b.range});tt(function(){return r.selectRange(r.getActiveSheet().selectedRange)})}else r.numberFormat(b.format,b.range);break;case"clipboard":u=new Promise(function(e){e(void 0)}),C=r.getAddressInfo(b.copiedRange),r.notify(b.copiedInfo.isCut?to:ro,{range:C.indices,sId:Ce(r,C.sheetIndex).id,promise:h,invokeCopy:!0,isPublic:!0,isFromUpdateAction:!0}),u.then(function(){return r.notify(no,{range:y(b.pastedRange),sIdx:ce(r,fe(b.pastedRange)),type:b.type,isAction:!1,isInternal:!0,isFromUpdateAction:!0})});break;case"gridLines":r.setSheetPropertyOnMute(r.sheets[b.sheetIdx],"showGridLines",b.isShow),r.serviceLocator.getService("sheet").toggleGridlines(),r.notify(ti,null);break;case"headers":r.setSheetPropertyOnMute(r.sheets[b.sheetIdx],"showHeaders",b.isShow),r.serviceLocator.getService("sheet").showHideHeaders(),r.notify(ti,null);break;case"resize":case"resizeToFit":w&&(m=Xe(g=r.sheets[b.sheetIndex],b.index),v=_e(g,b.index),(b.isCol&&m&&m.hidden||v&&v.hidden)&&r.notify(Gn,{startIndex:b.index,endIndex:b.index,hide:!1,isCol:b.isCol,sheetIndex:b.sheetIndex})),b.isCol?void 0===b.hide?r.setColWidth(w&&!t.isUndefined(n)?b.oldWidth:b.width,b.index,b.sheetIndex):r.hideColumn(b.index,b.index,b.hide):void 0===b.hide?r.setRowHeight(w&&!t.isUndefined(n)?b.oldHeight:b.height,b.index,b.sheetIndex):r.hideRow(b.index,b.index,b.hide);break;case"renameSheet":var N=ue(r,b.index);r.setSheetPropertyOnMute(r.sheets[N],"name",b.value),r.notify(To,{items:r.element.querySelector(".e-sheet-tabs-items"),value:b.value,idx:N});break;case"hideSheet":r.notify(Do,{sheetIndex:b.sheetIndex});break;case"showSheet":r.notify(vs,b);break;case"removeSheet":r.notify(Xa,{index:b.index,isAction:!0,count:b.sheetCount,clicked:!0});break;case"gotoSheet":r.notify(ms,{selectedIndex:b.currentSheetIndex,previousIndex:b.previousSheetIndex});break;case"moveSheet":Ie(r,b.position,b.sheetIndexes,null,w);break;case"wrap":Ae(e.eventArgs.address,e.eventArgs.wrap,r);break;case"hideShow":b.isCol?r.notify(Gn,{startIndex:b.startIndex,endIndex:b.endIndex,isCol:!0,hide:!1===n?!b.hide:b.hide,sheetIndex:b.sheetIndex}):r.notify(Gn,{startIndex:b.startIndex,endIndex:b.endIndex,hide:!1===n?!b.hide:b.hide,sheetIndex:b.sheetIndex});break;case"replace":r.notify(Fn,{value:b.compareValue,replaceValue:b.replaceValue,sheetIndex:b.sheetIndex,address:b.address});break;case"replaceAll":r.notify(An,b);break;case"filter":h=new Promise(function(e,t){e(void 0)}),!1===n?r.notify(Uo,{predicates:b.previousPredicates,range:b.range,sIdx:b.sheetIndex,promise:h,isInternal:!0}):r.notify(Uo,{predicates:b.predicates,range:b.range,sIdx:b.sheetIndex,promise:h,isInternal:!0,useFilterRange:b.useFilterRange,allowHeaderFilter:b.allowHeaderFilter}),a&&!w&&h.then(function(){r.notify(Yo,t.extend({isUndo:!n,isUndoRedo:!w},a))});break;case"insert":if("Sheet"===e.eventArgs.modelType)g=r;else if(!(g=Ce(r,e.eventArgs.activeSheetIndex)))break;!1===n?r.notify(wn,{model:g,start:e.eventArgs.index,isUndoRedo:!0,end:e.eventArgs.index+(e.eventArgs.model.length-1),modelType:e.eventArgs.modelType}):r.notify(Sn,{model:g,start:e.eventArgs.index,end:e.eventArgs.index+(e.eventArgs.model.length-1),modelType:e.eventArgs.modelType,checkCount:void 0===n?e.eventArgs.sheetCount:null,activeSheetIndex:e.eventArgs.activeSheetIndex,isUndoRedo:!0,insertType:e.eventArgs.insertType,isFromUpdateAction:w});break;case"delete":if("Sheet"===e.eventArgs.modelType)g=r;else if(!(g=Ce(r,e.eventArgs.activeSheetIndex)))break;!1===n?r.notify(Sn,{model:g,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}):r.notify(wn,{model:g,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===n?r.notify(fs,{range:b.range}):r.notify(En,{rules:{type:b.type,operator:b.operator,value1:b.value1,value2:b.value2,ignoreBlank:b.ignoreBlank,inCellDropDown:b.inCellDropDown},range:b.range});break;case"removeHighlight":case"addHighlight":r.notify(es,{isRemoveHighlight:"removeHighlight"===e.action?!1!==n:!1===n,range:b.range,isPublic:!0});break;case"merge":e.eventArgs.isAction=!1,f=[];for(var O=0,T=b.model.length;O<T;O++){f.push({cells:[]});for(var D=0,L=b.model[O].cells.length;D<L;D++)f[O].cells[D]={},Object.assign(f[O].cells[D],b.model[O].cells[D])}r.notify(_n,e.eventArgs),b.model=f;break;case"clear":F={options:e.eventArgs,isFromUpdateAction:w},r.notify(Cs,F),!w&&F.cfClearActionArgs&&(b.cfClearActionArgs.previousConditionalFormats=F.cfClearActionArgs.previousConditionalFormats,b.cfClearActionArgs.conditionalFormats=F.cfClearActionArgs.conditionalFormats);break;case"conditionalFormat":!1===n?r.notify(Kn,{range:b.range,cfModel:{type:b.type,cFColor:b.cFColor,value:b.value},sheetIdx:b.sheetIdx,isUndoRedo:!b.cancel,isFromUpdateAction:w}):r.notify(Yn,{cfModel:{type:b.type,cFColor:b.cFColor,value:b.value,range:b.range},sheetIdx:b.sheetIdx,isUndoRedo:!0,isFromUpdateAction:w});break;case"clearCF":if(!1===n)r.notify(Kn,{oldCFModel:b.previousConditionalFormats,updatedCFModel:b.conditionalFormats,range:b.selectedRange,isUndo:!0,sheetIdx:b.sheetIdx});else{var P={range:b.selectedRange,sheetIdx:b.sheetIdx,isUndoRedo:!0,isFromUpdateAction:w};r.notify(Kn,P),w||(b.previousConditionalFormats=P.oldCFModel,P.updatedCFModel.length?b.conditionalFormats=P.updatedCFModel:delete b.conditionalFormats)}break;case"insertImage":!1===n?r.notify(Ds,{id:e.eventArgs.id,sheetIdx:e.eventArgs.sheetIndex+1,range:e.eventArgs.range,preventEventTrigger:!0}):r.notify(Ts,{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===n?r.notify(Ts,{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}):r.notify(Ds,{id:e.eventArgs.id,range:e.eventArgs.address,preventEventTrigger:!0});break;case"imageRefresh":l=document.getElementById(e.eventArgs.id),!1===n?r.notify(As,{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,r.notify(As,e.eventArgs)),l&&(l.style.height=!1===n?e.eventArgs.prevHeight+"px":e.eventArgs.currentHeight+"px",l.style.width=!1===n?e.eventArgs.prevWidth+"px":e.eventArgs.currentWidth+"px",l.style.top=!1===n?e.eventArgs.prevTop+"px":e.eventArgs.currentTop+"px",l.style.left=!1===n?e.eventArgs.prevLeft+"px":e.eventArgs.currentLeft+"px");break;case"insertChart":if(!1===n)r.notify(Ls,{id:b.id,range:b.range,isUndoRedo:!0});else{var M=[{type:b.type,theme:b.theme,markerSettings:b.markerSettings,isSeriesInRows:b.isSeriesInRows,range:b.range,id:b.id,height:b.height,width:b.width,top:b.top,left:b.left}];r.notify(Jn,{chart:M,isUndoRedo:!1,range:b.posRange})}break;case"deleteChart":if(!1===n){var H=[{type:b.type,theme:b.theme,markerSettings:b.markerSettings,isSeriesInRows:b.isSeriesInRows,range:b.range,id:b.id,height:b.height,width:b.width,top:b.top,left:b.left}];r.notify(Jn,{chart:H,isUndoRedo:!1,range:b.posRange})}else r.notify(Ls,{id:b.id,range:b.range,isUndoRedo:!0});break;case"chartRefresh":(s=document.getElementById(e.eventArgs.id))&&(s.style.height=!1===n?e.eventArgs.prevHeight+"px":e.eventArgs.currentHeight+"px",s.style.width=!1===n?e.eventArgs.prevWidth+"px":e.eventArgs.currentWidth+"px",s.style.top=!1===n?e.eventArgs.prevTop+"px":e.eventArgs.currentTop+"px",s.style.left=!1===n?e.eventArgs.prevLeft+"px":e.eventArgs.currentLeft+"px"),!1===n?(r.notify(Ps,t.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})),r.notify(ni,{height:e.eventArgs.prevHeight.toString(),width:e.eventArgs.prevWidth.toString(),overlayEle:s})):(e.eventArgs.isUndoRedo=!0,r.notify(Ps,e.eventArgs),r.notify(ni,{height:e.eventArgs.currentHeight.toString(),width:e.eventArgs.currentWidth.toString(),overlayEle:s}));break;case"chartDesign":r.notify(Ws,e.eventArgs);break;case"autofill":w&&b.undoArgs&&(b.undoArgs.isFromUpdateAction=b.undoArgs.isUndo=b.undoArgs.preventEvt=!0,b.undoArgs.isPublic=!0,r.notify(Lo,b.undoArgs)),r.notify(ui,{fillRange:e.eventArgs.fillRange,dataRange:e.eventArgs.dataRange,fillType:e.eventArgs.fillType,direction:e.eventArgs.direction});break;case"removeValidation":!1!==n&&r.notify(fs,{range:b.range,isCol:b.isColSelected});break;case"addDefinedName":if(!1===n)r.notify(jr,{action:"removeDefinedName",isRemoved:!1,definedName:b.name,scope:b.scope,isEventTrigger:!0});else{var B={name:b.name,refersTo:b.refersTo,scope:b.scope,comment:b.comment};r.notify(jr,{action:"addDefinedName",isAdded:!1,definedName:B,isEventTrigger:!0})}break;case"hyperlink":r.notify(gn,{hyperlink:b.hyperlink,cell:b.address,displayText:b.displayText,triggerEvt:!1}),r.serviceLocator.getService("cell").refreshRange(y(b.address),!1,!1,!1,!1,Kt(r));break;case"removeHyperlink":r.notify(No,{range:b.address,preventEventTrigger:!0});break;case"freezePanes":r.freezePanes(b.row,b.column,b.sheetIndex);break;case"duplicateSheet":Ee(r,b.sheetIndex,null,w);break;case"protectSheet":b.isProtected?r.notify(Hn,b):(r.setSheetPropertyOnMute(Ce(r,b.sheetIndex),"password",""),r.notify(rs,{isActive:!0,sheetIndex:b.sheetIndex}));break;case"protectWorkbook":b.isProtected?r.notify(Zs,b):r.notify(Qs,null);break;case"lockCells":r.notify(Vn,b)}}function Lt(e,t,r,n){for(var i,a=e.sheets[n].ranges,o=0,s=a.length;o<s;o++)if(a[o].template&&(i=c(a[o].address.length?a[o].address:a[o].startCell))[0]<=t&&i[1]<=r&&i[2]>=t&&i[3]>=r)return!0;return!1}function Pt(e,t,r,n,i,a,o){void 0===o&&(o=!0);var s=We(t,n,!0),l=e.frozenColCount(t),h=kt(r);if((i=i||(t.frozenRows?e.getRow(n,null,l):e.getRow(n)))&&(i.style.height=h+"px"),t.frozenColumns)a=a||e.getRow(n,null,l-1);else{var d=e.frozenRowCount(t);a=a||e.getRow(n,n<d?e.sheetModule.getSelectAllTable():e.getRowHeaderTable())}a&&(a.style.height=h+"px"),Ge(t,n,r),e.setProperties({sheets:e.sheets},!0),o&&e.notify(yo,{rowIdx:n,threshold:h-s})}function Mt(e,t,r,n){void 0===r&&(r=1);var i=t&&t.fontSize||e.cellStyle.fontSize,a=(i.indexOf("pt")>-1?parseInt(i,10)/.75:parseInt(i,10))*(n||Ht(t&&t.fontFamily?t:e.cellStyle))*r;return Math.ceil(a%1>.9?a+1:a)}function Ht(e){var t=Pl;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 Bt(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:kt(i.measureText(e).width,!0)}function Ut(e,t,r,n){var i,a,o,s,l,h=0,d=e.toString().split(" "),p=Bt(" ",r,n),c=0,u=0,f=0,g=function(e,a){h&&c++,i/t>=1&&(e.split("").forEach(function(e){s=Bt(e,r,n,!0),(o+=s)>t&&(c++,o=s)}),i=kt(o,!0)),a||m(i),h=i},m=function(e){i+=(e+p)/t>=1?0:p};return d.forEach(function(e){o=0,s=0,i=Bt(e,r,n),(h+i)/t>1?(a=e.split("-")).length>1?a.forEach(function(p){o=0,s=0,l||(l=Bt("-",r,n)),i=Bt(p,r,n),a[a.length-1]!==p&&(i+=l),(h+i)/t>=1?g(p,a[a.length-1]!==p):(a[a.length-1]===p&&d[d.length-1]!==e&&m(h+i),h+=i)}):g(e,!1):(m(h+i),h+=i)}),h&&(u=(h-p)/t,f=parseFloat(u.toString().split(".")[0]),c+=u+.05>=f+1?Math.ceil(u)+1:Math.ceil(u)),c}function Vt(e,t,r){var n=0,i=Re(e,t,r,null,!0);i.style&&(i.style.border?n=(0===e?2:1)*parseFloat(i.style.border.split("px")[0]):(0===e&&i.style.borderTop&&(n=parseFloat(i.style.borderTop.split("px")[0])),i.style.borderBottom&&(n+=parseFloat(i.style.borderBottom.split("px")[0]))));var a=Re(e+1,t,r,null,!0);return i.style&&(i.style.border||i.style.borderBottom)||!a.style||!a.style.borderTop||(n+=parseFloat(a.style.borderTop.split("px")[0])),Math.ceil(n)||1}function _t(e,t,r,n){return void 0===n&&(n=r),Ze(e,r,n,!0)-kt(4+(function(e,t,r){var n=0,i=Re(e,t,r,null,!0),a=Re(e,t+1,r,null,!0);return i.style&&(i.style.border?n=(0===t?2:1)*parseFloat(i.style.border.split("px")[0]):(0===t&&i.style.borderLeft&&(n=parseFloat(i.style.borderLeft.split("px")[0])),i.style.borderRight&&(n+=parseFloat(i.style.borderRight.split("px")[0])))),i.style&&(i.style.border||i.style.borderRight)||!a.style||!a.style.borderLeft||(n+=parseFloat(a.style.borderLeft.split("px")[0])),n>0&&n<1?1:n}(t,r,e)||1))}function zt(e,t,r,n,i,a,o){return Mt(e,i,a,o)+Vt(t,r,n)}function jt(e,t,r,n){e.maxHgts[t]||(e.maxHgts[t]={}),e.maxHgts[t][r]=n}function qt(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 Wt(e){if(!document.activeElement.classList.contains("e-text-findNext-short"))if(t.Browser.isIE){var r=window.scrollX,n=window.scrollY;e.focus(),window.scrollTo(r,n)}else{if(e.classList.contains("e-input")){var i=e,a=i.value.length;i.setSelectionRange(a,a)}e.focus({preventScroll:!0})}}function Gt(e,r){for(var n,i=e.getActiveSheet(),a=t.isNullOrUndefined(r)?w(c(i.selectedRange)):r,o=a[0];o<=a[2];o++)for(var s=a[1];s<=a[3];s++){if(Y(Re(o,s,i),Xe(i,s))){n=!0;break}}return n}function Yt(e){return e.includes(" ")}function Xt(e,t,r){for(var n,i,a,o,s,l,h=Ce(e,r),d=r===e.activeSheetIndex,p=h.conditionalFormats&&h.conditionalFormats.length&&[].slice.call(h.conditionalFormats),c=[],u=t[0],f=t[2];u<=f;u++)if(!qe(h,u))for(var g=t[1],m=t[3];g<=m;g++){var v={cellIdx:[u,g],isUnique:!1,uniqueRange:""};if(e.notify(nn,v),n=!1,""!==v.uniqueRange){var C=y(v.uniqueRange);n="#SPILL!"===Re(C[0],C[1],h).value}if((!v.isUnique||n)&&(i=Re(u,g,h))){a={},i.formula&&(a.formula=""),(i.value||0===i.value)&&(a.value=""),i.hyperlink&&(a.hyperlink="");var b={sheet:h,cell:i,rowIdx:u,colIdx:g};if((i.colSpan>1||i.rowSpan>1)&&se(b),o=e.getCell(b.rowIdx,b.colIdx),s={cell:a,rowIdx:u,colIdx:g,valChange:!0,uiRefresh:d,td:o,cellDelete:!0},!Object.keys(a).length||J(e,h,s))continue;p&&!l&&((l=s.isFormulaDependent)||ne(p,c,u,g)),o&&(o.querySelector(".e-cf-databar")&&o.removeChild(o.querySelector(".e-cf-databar")),o.querySelector(".e-iconsetspan")&&o.removeChild(o.querySelector(".e-iconsetspan")))}}(c.length||l)&&d&&e.notify(Xn,{cfModel:!l&&c,refreshAll:l,isAction:!0,isEdit:!0})}function Kt(e){return e.allowOpen&&e.openModule.preventFormatCheck}function $t(e,t){for(var r=0,n=e.getActiveSheet(),i=(n.frozenRows?e.viewport.height-e.sheetModule.getColHeaderHeight(n,!0):e.viewport.height)-17||20,a=t;;a++)if((r+=We(n,a,!0))>=i)return{index:a,height:r}}function Zt(e,t){for(var r=0,n=e.getActiveSheet(),i=e.getMainContent().parentElement.offsetWidth-e.sheetModule.getRowHeaderWidth(n)-e.sheetModule.getScrollSize(),a=t;;a++)if((r+=$e(n,a,null,!0))>=i)return a}function Qt(e){if(window.devicePixelRatio%1>0){var t=e*window.devicePixelRatio%1;return e+(t?(t>.5?1-t:-1*t)/window.devicePixelRatio:0)}return e}function Jt(e){for(var t,r=[],n=e.getActiveSheet().name,i=0,a=e.chartColl.length;i<a;i++)if(t=e.chartColl[i],n===fe(t.range)){var o={clientY:t.top,isImage:!0},s={clientX:t.left,isImage:!0};e.notify(Ns,o),e.notify(Os,s),r.push({chart:t,chartRowIdx:o.clientY,chartColIdx:s.clientX})}return r}var er=function(){function e(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()}return e.prototype.terminate=function(){this.worker.terminate(),URL.revokeObjectURL(this.workerUrl)},e.prototype.initWorker=function(){var e=new Blob([this.getFnCode()],{type:"text/javascript"});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)},e.prototype.messageFromWorker=function(e){this.terminate(),this.defaultListener.apply(this.context,[e.data])},e.prototype.onError=function(e){if(this.terminate(),!e.message||!e.message.includes("FormData"))throw e.message||e;this.defaultListener.apply(this.context,[{isFormDataError:!0}])},e.prototype.getFnCode=function(){var e,t,r="",n="",i=!1;if("function"==typeof this.workerTask)this.workerTask.toString().indexOf("function")<0?n="function "+this.workerTask.toString():(n=this.workerTask.toString(),i=!0),r+="self.workerTask = "+n+"; \n";else if("object"==typeof this.workerTask)for(t=Object.keys(this.workerTask),e=0;e<t.length;e++)this.workerTask[t[e]].toString().indexOf("function")<0?n="function "+this.workerTask[t[e]].toString():(n=this.workerTask[t[e]].toString(),i=!0),r+=(0===e?"self.workerTask":t[e])+"= "+n+"; \n";return r+="self.onmessage = "+(i?"":" function ")+(this.preventCallback?this.getMessageFn.toString():this.getCallbackMessageFn.toString())+"; \n"},e.prototype.getCallbackMessageFn=function(e){postMessage(this.workerTask.apply(this,e.data))},e.prototype.getMessageFn=function(e){this.workerTask.apply(this,e.data)},e}(),tr=function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),rr=function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},nr=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return tr(r,e),rr([t.Property("Calibri")],r.prototype,"fontFamily",void 0),rr([t.Property("bottom")],r.prototype,"verticalAlign",void 0),rr([t.Property("left")],r.prototype,"textAlign",void 0),rr([t.Property("0pt")],r.prototype,"textIndent",void 0),rr([t.Property("#000000")],r.prototype,"color",void 0),rr([t.Property("#ffffff")],r.prototype,"backgroundColor",void 0),rr([t.Property("normal")],r.prototype,"fontWeight",void 0),rr([t.Property("normal")],r.prototype,"fontStyle",void 0),rr([t.Property("11pt")],r.prototype,"fontSize",void 0),rr([t.Property("none")],r.prototype,"textDecoration",void 0),rr([t.Property("")],r.prototype,"border",void 0),rr([t.Property("")],r.prototype,"borderTop",void 0),rr([t.Property("")],r.prototype,"borderBottom",void 0),rr([t.Property("")],r.prototype,"borderLeft",void 0),rr([t.Property("")],r.prototype,"borderRight",void 0),r}(t.ChildProperty),ir=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return tr(r,e),rr([t.Property()],r.prototype,"sheetIndex",void 0),rr([t.Property()],r.prototype,"filterRange",void 0),rr([t.Property(!1)],r.prototype,"hasFilter",void 0),rr([t.Property()],r.prototype,"column",void 0),rr([t.Property()],r.prototype,"criteria",void 0),rr([t.Property()],r.prototype,"value",void 0),rr([t.Property()],r.prototype,"dataType",void 0),rr([t.Property()],r.prototype,"predicates",void 0),r}(t.ChildProperty),ar=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return tr(r,e),rr([t.Property()],r.prototype,"sortRange",void 0),rr([t.Property()],r.prototype,"columnIndex",void 0),rr([t.Property()],r.prototype,"order",void 0),rr([t.Property()],r.prototype,"sheetIndex",void 0),r}(t.ChildProperty),or=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return tr(r,e),rr([t.Property("")],r.prototype,"name",void 0),rr([t.Property("")],r.prototype,"scope",void 0),rr([t.Property("")],r.prototype,"comment",void 0),rr([t.Property("")],r.prototype,"refersTo",void 0),r}(t.ChildProperty),sr=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return tr(r,e),rr([t.Property(!1)],r.prototype,"selectCells",void 0),rr([t.Property(!1)],r.prototype,"selectUnLockedCells",void 0),rr([t.Property(!1)],r.prototype,"formatCells",void 0),rr([t.Property(!1)],r.prototype,"formatRows",void 0),rr([t.Property(!1)],r.prototype,"formatColumns",void 0),rr([t.Property(!1)],r.prototype,"insertLink",void 0),r}(t.ChildProperty),lr=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return tr(r,e),rr([t.Property("")],r.prototype,"address",void 0),r}(t.ChildProperty),hr=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return tr(r,e),rr([t.Property("WholeNumber")],r.prototype,"type",void 0),rr([t.Property("Between")],r.prototype,"operator",void 0),rr([t.Property("0")],r.prototype,"value1",void 0),rr([t.Property("0")],r.prototype,"value2",void 0),rr([t.Property(!0)],r.prototype,"ignoreBlank",void 0),rr([t.Property(!0)],r.prototype,"inCellDropDown",void 0),rr([t.Property(!1)],r.prototype,"isHighlighted",void 0),rr([t.Property("")],r.prototype,"address",void 0),r}(t.ChildProperty),dr=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return tr(r,e),rr([t.Property("General")],r.prototype,"format",void 0),rr([t.Complex({},nr)],r.prototype,"style",void 0),rr([t.Property(!0)],r.prototype,"isLocked",void 0),r}(t.ChildProperty),pr=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return tr(r,e),rr([t.Property("GreaterThan")],r.prototype,"type",void 0),rr([t.Complex({},dr)],r.prototype,"format",void 0),rr([t.Property("RedFT")],r.prototype,"cFColor",void 0),rr([t.Property("")],r.prototype,"value",void 0),rr([t.Property("")],r.prototype,"range",void 0),r}(t.ChildProperty),cr=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return tr(r,e),rr([t.Property(!0)],r.prototype,"visible",void 0),rr([t.Property("Auto")],r.prototype,"position",void 0),r}(t.ChildProperty),ur=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return tr(r,e),rr([t.Property(!1)],r.prototype,"visible",void 0),rr([t.Property("Auto")],r.prototype,"position",void 0),r}(t.ChildProperty),fr=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return tr(r,e),rr([t.Property("")],r.prototype,"color",void 0),rr([t.Property(1)],r.prototype,"width",void 0),r}(t.ChildProperty),gr=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return tr(r,e),rr([t.Property(!1)],r.prototype,"visible",void 0),rr([t.Property("Circle")],r.prototype,"shape",void 0),rr([t.Property(5)],r.prototype,"size",void 0),rr([t.Property(null)],r.prototype,"fill",void 0),rr([t.Property(!0)],r.prototype,"isFilled",void 0),rr([t.Complex({},fr)],r.prototype,"border",void 0),r}(t.ChildProperty),mr=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return tr(r,e),rr([t.Property(0)],r.prototype,"width",void 0),r}(t.ChildProperty),vr=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return tr(r,e),rr([t.Property(0)],r.prototype,"width",void 0),r}(t.ChildProperty),yr=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return tr(r,e),rr([t.Property("")],r.prototype,"title",void 0),rr([t.Complex({},mr)],r.prototype,"majorGridLines",void 0),rr([t.Complex({},vr)],r.prototype,"minorGridLines",void 0),rr([t.Property(!0)],r.prototype,"visible",void 0),r}(t.ChildProperty),Cr=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return tr(r,e),rr([t.Property("Line")],r.prototype,"type",void 0),rr([t.Property("Material")],r.prototype,"theme",void 0),rr([t.Property(!1)],r.prototype,"isSeriesInRows",void 0),rr([t.Complex({},gr)],r.prototype,"markerSettings",void 0),rr([t.Property("")],r.prototype,"range",void 0),rr([t.Property("")],r.prototype,"id",void 0),rr([t.Property("")],r.prototype,"title",void 0),rr([t.Property(290)],r.prototype,"height",void 0),rr([t.Property(480)],r.prototype,"width",void 0),rr([t.Property(0)],r.prototype,"top",void 0),rr([t.Property(0)],r.prototype,"left",void 0),rr([t.Complex({},cr)],r.prototype,"legendSettings",void 0),rr([t.Complex({},yr)],r.prototype,"primaryXAxis",void 0),rr([t.Complex({},yr)],r.prototype,"primaryYAxis",void 0),rr([t.Complex({},ur)],r.prototype,"dataLabelSettings",void 0),r}(t.ChildProperty),br=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return tr(r,e),rr([t.Property("")],r.prototype,"src",void 0),rr([t.Property("")],r.prototype,"id",void 0),rr([t.Property(300)],r.prototype,"height",void 0),rr([t.Property(400)],r.prototype,"width",void 0),rr([t.Property(0)],r.prototype,"top",void 0),rr([t.Property(0)],r.prototype,"left",void 0),r}(t.ChildProperty),xr=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return tr(r,e),rr([t.Property("FillSeries")],r.prototype,"fillType",void 0),rr([t.Property(!0)],r.prototype,"showFillOptions",void 0),r}(t.ChildProperty),Sr="workbookDestroyed",wr="updateSheetFromDataSource",Ir="dataSourceChanged",Er="dataChanged",Rr="triggerDataChange",kr="workbookOpen",Fr="beginSave",Ar="actionBegin",Nr="sortImport",Or="findToolDlg",Tr="exportDialog",Dr="setFilteredCollection",Lr="saveCompleted",Pr="applyNumber",Mr="getFormattedCell",Hr="refreshCellElem",Br="setCellFormat",Ur="findAllValues",Vr="textDecorationUpdate",_r="applyCellFormat",zr="updateRowColCount",jr="workbookFormulaOperation",qr="workbookEditOperation",Wr="checkDateFormat",Gr="checkNumberFormat",Yr="parseDecimalNumber",Xr="getFormattedBarText",Kr="activeCellChanged",$r="openSuccess",Zr="openFailure",Qr="sheetCreated",Jr="sheetsDestroyed",en="aggregateComputation",tn="getUniqueRange",rn="removeUniquecol",nn="checkUniqueRange",an="reApplyFormula",on="clearFormulaDependentCells",sn="formulaInValidation",ln="initiateSort",hn="updateSortedDataOnCell",dn="sortComplete",pn="beforeHyperlinkCreate",cn="afterHyperlinkCreate",un="beforeHyperlinkClick",fn="afterHyperlinkClick",gn="setLinkModel",mn="initiateFilter",vn="filterRangeAlert",yn="wrapText",Cn="onSave",bn="insert",xn="delete",Sn="insertModel",wn="deleteModel",In="isValidation",En="cellValidation",Rn="addHighlight",kn="gotoHandler",Fn="replace",An="replaceAll",Nn="showFindAlert",On="findKeyUp",Tn="removeHighlight",Dn="queryCellInfo",Ln="count",Pn="protectSheet",Mn="updateToggleItem",Hn="protectsheetHandler",Bn="replaceAllDialog",Un="unprotectsheetHandler",Vn="setLockCells",_n="setMerge",zn="applyMerge",jn="mergedRange",qn="activeCellMergedRange",Wn="insertMerge",Gn="hideShow",Yn="setCFRule",Xn="applyCF",Kn="clearCFRule",$n="clear",Zn="clearCF",Qn="setImage",Jn="setChart",ei="initiateChart",ti="refreshRibbonIcons",ri="refreshChart",ni="refreshChartSize",ii="updateChart",ai="deleteChartColl",oi="focusChartBorder",si="saveError",li="validationHighlight",hi="beforeInsert",di="beforeDelete",pi="deleteHyperlink",ci="moveOrDuplicateSheet",ui="setAutoFill",fi="refreshCell",gi="getFillInfo",mi="getautofillDDB",vi="rowFillHandler",yi="getTextSpace",Ci="refreshClipboard",bi="updateView",xi="selectionComplete",Si="refreshInsertDelete",wi="getUpdatedFormulaOnInsertDelete",Ii="beforeCellUpdate",Ei="duplicateSheetFilterHandler",Ri="addFormatToCustomFormatDlg",ki="checkFormulaRef",Fi="parseFormulaArgument",Ai="getChartRowIdxFromClientY",Ni="getChartColIdxFromClientX",Oi="refreshChartCellOnInit",Ti="spreadsheetLocale",Di={SortOutOfRangeError:"Select a cell or range inside the used range and try again."},Li={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);_($* "-"_);_(@_)']},Pi=function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Mi=function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},Hi=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return Pi(r,e),r.prototype.setProperties=function(t,r){var n=this;if(this.parentObj.isComplexArraySetter&&this.controlParent&&this.controlParent.isAngular)if(Object.keys(t).length){void 0===this.parentObj.currRangeIdx?this.parentObj.currRangeIdx=0:this.parentObj.currRangeIdx+=1;var i=this.parentObj.ranges[this.parentObj.currRangeIdx];i&&i.info&&(this.info=i.info),setTimeout(function(){void 0!==n.parentObj.currRangeIdx&&delete n.parentObj.currRangeIdx})}else if(this.controlParent.tagObjects[0].instance&&this.controlParent.tagObjects[0].instance.hasChanges&&!this.controlParent.tagObjects[0].instance.isInitChanges){var a=this.controlParent.sheets.indexOf(this.parentObj);if(void 0===this.parentObj.changedRangeIdx){for(var o,s=this.controlParent.tagObjects[0].instance.list[a].tagObjects,l=0;l<s.length;l++)if("ranges"===s[l].name){s[l].instance.list.forEach(function(e,t){e.hasChanges&&(o=t)});break}this.parentObj.changedRangeIdx=o}}e.prototype.setProperties.call(this,t,r)},Mi([t.Property(null)],r.prototype,"dataSource",void 0),Mi([t.Property("A1")],r.prototype,"startCell",void 0),Mi([t.Property(null)],r.prototype,"query",void 0),Mi([t.Property(!0)],r.prototype,"showFieldAsHeader",void 0),Mi([t.Property("")],r.prototype,"template",void 0),Mi([t.Property("A1")],r.prototype,"address",void 0),r}(t.ChildProperty),Bi=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return Pi(r,e),Mi([t.Property(0)],r.prototype,"rowIndex",void 0),Mi([t.Property(0)],r.prototype,"colIndex",void 0),r}(t.ChildProperty),Ui=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return Pi(r,e),Mi([t.Property(null)],r.prototype,"rows",void 0),Mi([t.Property(null)],r.prototype,"columns",void 0),Mi([t.Complex({},sr)],r.prototype,"protectSettings",void 0),Mi([t.Collection([],Hi)],r.prototype,"ranges",void 0),Mi([t.Collection([],pr)],r.prototype,"conditionalFormats",void 0),Mi([t.Property(0)],r.prototype,"index",void 0),Mi([t.Property("")],r.prototype,"name",void 0),Mi([t.Property(100)],r.prototype,"rowCount",void 0),Mi([t.Property(100)],r.prototype,"colCount",void 0),Mi([t.Property("A1:A1")],r.prototype,"selectedRange",void 0),Mi([t.Property("A1")],r.prototype,"activeCell",void 0),Mi([t.Property({})],r.prototype,"usedRange",void 0),Mi([t.Property("A1")],r.prototype,"topLeftCell",void 0),Mi([t.Property(!0)],r.prototype,"showHeaders",void 0),Mi([t.Property(!0)],r.prototype,"showGridLines",void 0),Mi([t.Property(!1)],r.prototype,"isProtected",void 0),Mi([t.Property("Visible")],r.prototype,"state",void 0),Mi([t.Property(0)],r.prototype,"frozenRows",void 0),Mi([t.Property(0)],r.prototype,"frozenColumns",void 0),Mi([t.Property("A1")],r.prototype,"paneTopLeftCell",void 0),Mi([t.Property("")],r.prototype,"password",void 0),r}(t.ChildProperty),Vi=function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),_i=function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},zi=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return Vi(r,e),_i([t.Collection([],br)],r.prototype,"image",void 0),_i([t.Collection([],Cr)],r.prototype,"chart",void 0),_i([t.Property("")],r.prototype,"value",void 0),_i([t.Property("")],r.prototype,"formula",void 0),_i([t.Property(0)],r.prototype,"index",void 0),_i([t.Property("General")],r.prototype,"format",void 0),_i([t.Complex({},nr)],r.prototype,"style",void 0),_i([t.Property("")],r.prototype,"hyperlink",void 0),_i([t.Property(!1)],r.prototype,"wrap",void 0),_i([t.Property(!0)],r.prototype,"isLocked",void 0),_i([t.Property("")],r.prototype,"validation",void 0),_i([t.Property(1)],r.prototype,"colSpan",void 0),_i([t.Property(1)],r.prototype,"rowSpan",void 0),r}(t.ChildProperty),ji=function(){function e(e){this.parent=e,this.requestedInfo=[],this.addEventListener()}return e.prototype.addEventListener=function(){this.parent.on(wr,this.updateSheetFromDataSourceHandler,this),this.parent.on(Ir,this.dataSourceChangedHandler,this),this.parent.on(Er,this.dataChangedHandler,this),this.parent.on(Rr,this.triggerDataChangeHandler,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(wr,this.updateSheetFromDataSourceHandler),this.parent.off(Ir,this.dataSourceChangedHandler),this.parent.off(Er,this.dataChangedHandler),this.parent.off(Rr,this.triggerDataChangeHandler))},e.prototype.updateSheetFromDataSourceHandler=function(e){var t,n,i,a,o,s,l,h,d,p,u,f=this,g=[],m=[],v=new r.Deferred;e.promise=v.promise;var y,C=e.autoDetectFormat,b=C&&le(this.parent);if(e.sheet&&e.sheet.ranges.length)for(var x=function(x){var w=e.sheet.ranges[x];y=c(w.startCell),e.isSaveAction&&(e.indexes=y);var I=e.indexes[0],E=e.indexes[2];d=y[0],s=w.dataSource instanceof r.DataManager?w.dataSource:w.dataSource?new r.DataManager(w.dataSource):new r.DataManager,o=o||s.dataSource.url,e.sheet.isLocalData=!s.dataSource.url,d<=I?I-=d:d<=E?(E-=d,I=0):I=-1,w.showFieldAsHeader&&0!==I&&(I-=1);var R=!1,k=0;S.initRangeInfo(w);var F=S.getMaxCount(w);if(u=S.getLoadedInfo(I,E,w),I=u.unloadedRange[0],E=u.unloadedRange[1],w.info.insertRowRange&&(w.info.insertRowRange.forEach(function(e){k+=e[1]-e[0]+1}),I-=k,E-=k),I>=F?R=!0:E>F&&(E=F),e.loadComplete||S.requestedInfo.push({deferred:v,indexes:e.indexes,isNotLoaded:u.isNotLoaded}),I>=0&&u.isNotLoaded&&!R){m[x]=I,g[x]=!1;var A=(w.query?w.query:new r.Query).clone();s.executeQuery(A.range(I,E>=F?E:E+1).requiresCount()).then(function(r){if(f.parent&&!f.parent.isDestroyed){if(a=r.result&&r.result.result?r.result.result:r.result,i=c(w.startCell),d=i[0],p=i[1],a&&a.length){if(w.info.count||(F=r.count,w.info.count=r.count),n=w.info.flds||Object.keys(a[0]),w.info.fldLen||(w.info.fldLen=n.length,w.info.flds=n),w.info.insertColumnRange){var o=0;w.info.insertColumnRange.forEach(function(e){for(var t=e[0];t<=e[1];t++)t<=p?n.splice(0,0,"emptyCell"+o):n.splice(t-p,0,"emptyCell"+o),o++})}0===m[x]&&w.showFieldAsHeader&&(l=d+m[x]+k,n.forEach(function(r,n){(t=Re(l,p+n,e.sheet,!0))?r.includes("emptyCell")||(t.value=r):e.sheet.rows[d+m[x]].cells[p+n]=r.includes("emptyCell")?{}:{value:r}})),a.forEach(function(r,i){l=d+m[x]+i+(w.showFieldAsHeader?1:0)+k;for(var a=0;a<n.length;a++)(t=Re(l,h=p+a,e.sheet,!0))?n[a].includes("emptyCell")||ke(l,h,e.sheet,f.getCellDataFromProp(r[n[a]]),!0):t=e.sheet.rows[l].cells[h]=n[a].includes("emptyCell")?{}:f.getCellDataFromProp(r[n[a]]),C&&b(t)})}else n=[];var s;s=d+(F||r.count)>0?d+(F||r.count)+(w.showFieldAsHeader?1:0)+k-1:e.sheet.usedRange.rowIndex;var v=p+n.length-1<0?e.sheet.usedRange.colIndex:p+n.length-1,y={rowIndex:s,colIndex:v};if(e.isFinite&&(y.rowIndex=s<e.sheet.rowCount?s:e.sheet.rowCount-1,y.colIndex=v<e.sheet.colCount?v:e.sheet.colCount-1),e.sheet.usedRange.rowIndex<y.rowIndex&&(e.sheet.usedRange.rowIndex=y.rowIndex),e.sheet.usedRange.colIndex<y.colIndex&&(e.sheet.usedRange.colIndex=y.colIndex),k?(u=f.getLoadedInfo(I,E,w),I=u.unloadedRange[0],E=u.unloadedRange[1],I>F&&(u.isNotLoaded=!1),u.isNotLoaded&&(E>F&&(E=F),w.info.loadedRange.push([I,E]))):w.info.loadedRange.push([I,E]),g[x]=!0,-1===g.indexOf(!1)){var S=void 0;if(E+d<d+w.info.count){e.rangeSettingCount||(e.rangeSettingCount=[]),e.rangeSettingCount.push(x),S=!0;var R={sheet:e.sheet,indexes:[0,0,s,v],promise:new Promise(function(e,t){e(void 0)}),rangeSettingCount:e.rangeSettingCount,isFinite:e.isFinite,loadComplete:e.loadComplete,autoDetectFormat:e.autoDetectFormat,resolveAfterFullDataLoaded:e.resolveAfterFullDataLoaded};f.updateSheetFromDataSourceHandler(R),R.promise.then(function(){"workbook"!==f.parent.getModuleName()&&(e.rangeSettingCount.pop(),e.rangeSettingCount.length||f.parent.notify("created",null),e.formulaCellRef?f.notfyFormulaCellRefresh(e.formulaCellRef,e.sheetIndex):e.loadComplete&&e.loadComplete())})}else e.formulaCellRef?f.notfyFormulaCellRefresh(e.formulaCellRef,e.sheetIndex):e.loadComplete&&e.loadComplete();S&&e.resolveAfterFullDataLoaded||(f.checkResolve(e.indexes),e.resolveAfterFullDataLoaded&&f.checkResolve([0,0,0,0]))}}})}else 0===x&&-1===g.indexOf(!1)&&S.checkResolve(e.indexes)},S=this,w=e.sheet.ranges.length-1;w>=0;w--)x(w);else v.resolve()},e.prototype.notfyFormulaCellRefresh=function(e,t){this.parent.formulaRefCell=null,this.parent.notify("updateView",{indexes:c(e),sheetIndex:t,refreshing:!0})},e.prototype.checkResolve=function(e){var t,r,n=0;this.requestedInfo.forEach(function(i,a){((r=JSON.stringify(i.indexes)===JSON.stringify(e))||t)&&(0===a?(i.deferred.resolve(),n++,t=!0):!t||!i.isLoaded&&i.isNotLoaded?r&&t?(i.deferred.resolve(),n++):r?i.isLoaded=!0:t=!1:(i.deferred.resolve(),n++))}),this.requestedInfo.splice(0,n)},e.prototype.getCellDataFromProp=function(e){var r={};return"[object Object]"===Object.prototype.toString.call(e)?e.formula?r.formula=e.formula:t.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."))?(r.hyperlink=e.value,r.style={textDecoration:"underline",color:"#00e"}):r.value=e.value):B(e)?r.formula=e:"string"==typeof e&&(0===e.indexOf("http://")||0===e.indexOf("https://")||0===e.indexOf("ftp://")||0===e.indexOf("www."))?(r.hyperlink=e,r.style={textDecoration:"underline",color:"#00e"}):r.value=e,r},e.prototype.getLoadedInfo=function(e,t,r){var n=!0;return r.info.loadedRange.forEach(function(r){r[0]<=e&&e<=r[1]?r[0]<=t&&t<=r[1]?n=!1:e=r[1]+1:r[0]<=t&&t<=r[1]&&(t=r[0]-1)}),{isNotLoaded:n,unloadedRange:[e,t]}},e.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},e.prototype.initRangeInfo=function(e){e.info||(e.info={loadedRange:[]})},e.prototype.dataSourceChangedHandler=function(e){var t,r=this,n=this.parent.sheets[e.sheetIdx],i=n.ranges[e.rangeIdx];if(i&&(this.checkRangeHasChanges(n,e.rangeIdx)||!i.info)){var a=i.showFieldAsHeader,o=u(i.startCell);i.info&&(i.info.loadedRange.forEach(function(e){for(var r=e[0];r<=e[1]&&r<i.info.count+(a?1:0);r++)if(t=n.rows[r+o[0]])for(var s=o[1];s<o[1]+i.info.fldLen;s++)t.cells&&t.cells[s]&&delete t.cells[s]}),i.info=null);var s=this.parent.viewport,l=[s.topIndex,s.leftIndex,s.bottomIndex,s.rightIndex],h={sheet:n,indexes:l,dataSourceChange:!0,promise:new Promise(function(e,t){e(void 0)})};this.updateSheetFromDataSourceHandler(h),h.promise.then(function(){r.parent.trigger("dataSourceChanged",{data:e.changedData,action:"dataSourceChanged",rangeIndex:Number(e.rangeIdx),sheetIndex:Number(e.sheetIdx)}),r.parent.notify("updateView",{indexes:l,checkWrap:!0,checkCF:!0})})}},e.prototype.checkRangeHasChanges=function(e,t){return!this.parent.isAngular||e.changedRangeIdx===parseInt(t,10)&&(delete e.changedRangeIdx,!0)},e.prototype.dataChangedHandler=function(e){var t,r,n,i,a,o,s,l,h,d=this,p=[{}],f=void 0===e.sheetIdx?this.parent.activeSheetIndex:e.sheetIdx,m=this.parent.sheets[f];m.ranges.forEach(function(v,y){if(v.dataSource){var C=void 0;if(i=u(v.startCell),n=i.concat([i[0]+v.info.count+(v.showFieldAsHeader?0:-1),i[1]+v.info.fldLen-1]),"Row"===e.modelType||"Column"===e.modelType){if("Column"===e.modelType){if(e.insertType)a=n[1]<e.index&&n[3]>=e.index,l=[e.index],a?(e.model.forEach(function(){v.info.flds.splice(e.index-i[1],0,"")}),v.info.fldLen+=e.model.length):n[3]+1===e.index&&"after"===e.insertType?(e.model.forEach(function(){v.info.flds.splice(e.index-i[1],0,"")}),v.info.fldLen+=e.model.length):n[1]>=e.index&&(v.startCell=g(i[0],i[1]+e.model.length));else if(a=n[1]<=e.startIndex&&n[3]>=e.startIndex)for(var b=e.startIndex;b<=e.endIndex;b++)b<=n[3]&&(v.info.flds.splice(e.startIndex,1),v.info.fldLen-=1);return}if(e.insertType){if(a=(v.showFieldAsHeader||"above"!==e.insertType&&!e.isMethod?n[0]<e.index:n[0]<=e.index)&&n[2]>=e.index,l=[e.index],a?(C=!0,v.info.count+=e.model.length):n[2]+1===e.index&&"below"===e.insertType?(C=!0,v.info.count+=e.model.length):n[0]>=e.index&&(v.startCell=g(i[0]+e.model.length,i[1])),e.isMethod)return}else a=n[0]<=e.startIndex&&n[2]>=e.startIndex,e.isDataRequest?l=[e.startIndex,n[1],e.startIndex,n[1]]:t="delete"}else{l=c(e.requestType&&e.requestType.toLowerCase().includes("paste")?e.pastedRange.split("!")[1]:e.sheetIdx>-1?e.address:(e.address||e.range||e.fillRange).split("!")[1]);var x=[v.showFieldAsHeader?n[0]+1:n[0]].concat(n.slice(1,4));if(v.showFieldAsHeader&&l[0]===i[0])for(b=l[1];b<=l[3];b++)b>=x[1]&&b<=x[3]&&(v.info.flds[b-i[1]]=Re(i[0],b,m,!1,!0).value||"");if(a=W(x,l,!0),"paste"===e.requestType&&e.copiedInfo.isCut){if(h=[].slice.call(e.copiedInfo.range),v.showFieldAsHeader&&h[0]===i[0]){for(b=h[1];b<=h[3];b++)b>=x[1]&&b<=x[3]&&(v.info.flds[b-i[1]]="");a=!1}o=W(x,h,!0)}}if(a||C||o){if("Row"!==e.modelType||e.insertType||e.isDataRequest){t=C?"add":"edit";var S=0;if(o){S=h[2]-h[0]+1;var w=function(e){p[e]={},v.info.flds.forEach(function(t,n){t&&(r=Re(h[0]+e,i[1]+n,m),p[e][""+t]=d.getFormattedValue(r))})};for(b=0;b<S;b++)w(b)}if(a||C)for(var I,E=!(e.isDataRequest||o||C||e.skipFilterCheck),R=function(e,t){if(E&&qe(m,l[0]+e))return I=t,"continue";p[t+S]={},v.info.flds.forEach(function(n,a){n&&(r=Re(l[0]+e,i[1]+a,m),p[t+S][""+n]=d.getFormattedValue(r))}),I=++t},k=(b=0,0);b<(C?e.model.length:l[2]-l[0]+1||1);b++)R(b,k),k=I}else{if(e.deletedModel.forEach(function(e,t){p[t]={},v.info.flds.forEach(function(n,a){e.cells?(r=e.cells[i[1]+a],p[t][""+n]=d.getFormattedValue(r)):p[t][""+n]=null}),v.info.count-=1}),e.isMethod)return;s={count:e.deletedModel.length,index:e.endIndex}}e.isDataRequest?e.data=p:d.parent.trigger("dataSourceChanged",{data:p,action:t,rangeIndex:y,sheetIndex:f})}else s&&s.count&&n[0]>s.index&&(v.startCell=g(i[0]-s.count,i[1]))}})},e.prototype.getFormattedValue=function(e){var t=this.parent.getDisplayText(e);return""===t?null:e&&!e.format&&"number"==typeof e.value?e.value:t},e.prototype.triggerDataChangeHandler=function(e){var r=!0;if(("delete"===e.action||"insert"===e.action)&&["Sheet"].indexOf(e.eventArgs.modelType)>-1?r=!1:"clear"===e.action&&["Clear Formats","Clear Hyperlinks"].indexOf(e.eventArgs.type)>-1?r=!1:"clipboard"===e.action&&"Formats"===e.eventArgs.requestType&&(r=!1),r&&["insert","delete","edit","cellDelete","cellSave","autofill","clipboard","clear"].indexOf(e.action)>-1){var n=void 0;!e.isUndo||"delete"!==e.action&&"insert"!==e.action?n=e.eventArgs:(n=t.extend({},e.eventArgs),"delete"===e.action?(n.index=n.startIndex,n.model=n.deletedModel,n.insertType="below"):(n.startIndex=n.index,n.endIndex=e.eventArgs.index+e.eventArgs.model.length-1,n.deletedModel=n.model,delete n.insertType)),this.parent.notify(Er,n)}},e.prototype.getModuleName=function(){return"dataBind"},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null,this.requestedInfo=[]},e}(),qi=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.open=function(e){var r=this;if(this.parent.allowOpen)if(e.jsonObject)this.fetchSuccess(e.jsonObject,e,null,!0,!0);else{var n=new FormData;if(e.file)n.append("file",e.file);else{if(!(e.sheetIndex>=0))return void(this.parent.isOpen=!1);n.append("sheetPassword",e.sheetPassword),n.append("sheetIndex",e.sheetIndex.toString())}var i={passWord:""};e.password&&e.password.length&&(i.passWord=e.password),i.passWord&&i.passWord.length&&(e.password=i.passWord),e.password&&n.append("password",e.password);var a={file:e.file||null,cancel:!1,requestData:{method:"POST",body:n},password:i.passWord},o=e.guid;t.isNullOrUndefined(e.sheetPassword)&&!o?(this.parent.trigger("beforeOpen",a),this.parent.notify(Ar,{eventArgs:a,action:"beforeOpen"})):o&&n.append("guid",o),a.cancel?this.parent.isOpen=!1:fetch(this.parent.openUrl,a.requestData).then(function(e){return e.ok?e.json():Promise.reject({status:e.status,statusText:e.statusText,url:e.url})}).then(function(t){return r.fetchSuccess(t,a,e.orginalFile,void 0,!0)}).catch(function(e){return r.fetchFailure(e)})}},e.prototype.fetchFailure=function(e){t.isUndefined(e.status)&&t.isUndefined(e.statusText)&&(e.statusText="Improper response"),this.parent.notify(Zr,e),this.parent.isOpen=!1},e.prototype.fetchSuccess=function(e,t,r,n,i){var a="string"==typeof e?JSON.parse(e):e,o=a.Workbook;if(["UnsupportedFile","InvalidUrl","NeedPassword","InCorrectPassword","InCorrectSheetPassword","CorrectSheetPassword","DataLimitExceeded","FileSizeLimitExceeded","ExternalWorkbook"].indexOf(o)>-1)return r&&(t.file=r),void this.parent.notify($r,{context:this,data:o,guid:a.Guid,eventArgs:t,isOpenFromJson:n});this.updateModel(o,n,i),this.parent.notify($r,{context:this,data:o,isOpenFromJson:n,eventArgs:t}),this.parent.isOpen=!1,t&&t.password&&t.password.length>0&&(this.parent.showSheetTabs&&(this.parent.element.querySelector(".e-add-sheet-tab").removeAttribute("disabled"),this.parent.element.querySelector(".e-add-sheet-tab").classList.remove("e-disabled")),this.parent.password="")},e.prototype.updateModel=function(e,r,n){this.parent.notify(jr,{action:"unRegisterSheet"}),this.setSelectAllRange(e.sheets,r),this.parent.sheetNameCount=1,this.parent.sheets=[],this.parent.notify(Jr,{}),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),t.isNullOrUndefined(e.showSheetTabs)||(this.parent.showSheetTabs=e.showSheetTabs),Se(this.parent,void 0,n),this.parent.notify(Qr,null),this.parent.notify(jr,{action:"registerSheet",isImport:!0}),this.parent.notify(jr,{action:"initiateDefinedNames"}),this.parent.notify(Pn,null)},e.prototype.setSelectAllRange=function(e,r){var n,i,a=this;e.forEach(function(e){if(e.selectedRange){var o=c(e.selectedRange),s=(t.isUndefined(e.rowCount)?100:e.rowCount)-1,l=(t.isUndefined(e.colCount)?100:e.colCount)-1;65535===o[2]&&(o[2]=s),255===o[3]&&(o[3]=l),65535===o[0]&&(o[0]=s),255===o[1]&&(o[1]=l),e.selectedRange=m(o)}if(r&&a.parent.isAngular)for(var h=0;h<a.parent.sheets.length;h++)if(n=Ce(a.parent,h),e.name===n.name){e.ranges&&e.ranges.forEach(function(e,t){(i=n.ranges[t])&&i.template&&(e.template=i.template)});break}})},e.prototype.addEventListener=function(){this.parent.on(kr,this.open.bind(this))},e.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off(kr,this.open.bind(this))},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.getModuleName=function(){return"workbookOpen"},e}(),Wi=function(){function e(e){this.parent=e}return e.prototype.processSheet=function(e,t){return[t,JSON.parse(e,function(e,t){if(!Array.isArray(t)&&"string"!=typeof t||t.length)return t})]},e.prototype.processSave=function(e,t,r,n,i){var a,o=this,s=new FormData,l=Object.keys(t);for(s.append("JSONData",JSON.stringify(e)),a=0;a<l.length;a++)s.append(l[a],t[l[a]]);for(l=Object.keys(r),a=0;a<l.length;a++)s.append(l[a],r[l[a]]);s.append("pdfLayoutSettings",JSON.stringify(n)),fetch(t.url,{method:"POST",body:s}).then(function(e){return e.ok?e.blob():Promise.reject({message:e.statusText})}).then(function(e){new Promise(function(t){var n=new FileReader;n.onload=function(){var a=n.result.toString(),s=r.customParams&&"string"==typeof r.customParams&&"saveashtml"===r.customParams.toLowerCase();if(a.indexOf("data:text/plain;base64,")>-1||!s&&a.indexOf("data:text/html;base64,")>-1||a.indexOf("data:application/json;base64,")>-1){var l=void 0;if(a=a.replace("data:text/plain;base64,",""),(a=a.replace("data:text/html;base64,","")).indexOf("data:application/json;base64,")>-1?(a=a.replace("data:application/json;base64,",""),l=atob(a).split(".")):l=atob(a).split(/(\r\n|\n|\r)/gm),l.length){var h=l[0].length>1&&'"'===l[0][0]?l[0].split('"')[1]+".":l[0];i?i.apply(o,[{dialog:h}]):postMessage({dialog:h})}}else i?i.apply(o,[e]):postMessage(e);t(n.result)},n.readAsDataURL(e)})}).catch(function(e){i?i.apply(o,[{error:e.message}]):postMessage({error:e.message})})},e}(),Gi=function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Yi=function(){return(Yi=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e}).apply(this,arguments)},Xi=function(e){function r(t){var r=e.call(this,t)||this;return r.isProcessCompleted=!1,r.saveJSON={},r.isFullPost=!1,r.needBlobData=!1,r.customParams=null,r.pdfLayoutSettings={fitSheetOnOnePage:!1},r.addEventListener(),r}return Gi(r,e),r.prototype.getModuleName=function(){return"workbookSave"},r.prototype.destroy=function(){this.removeEventListener(),this.parent=null},r.prototype.addEventListener=function(){this.parent.on(Fr,this.initiateSave,this),this.parent.on("getStringifyObject",this.performStringifyAction,this)},r.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(Fr,this.initiateSave),this.parent.off("getStringifyObject",this.performStringifyAction))},r.prototype.initiateSave=function(e){var t=e.saveSettings;this.saveSettings={saveType:t.saveType,url:t.url,fileName:t.fileName||"Sample"},this.isFullPost=e.isFullPost,this.needBlobData=e.needBlobData,this.needBlobData&&(this.isFullPost=!1),this.customParams=e.customParams,this.pdfLayoutSettings=e.pdfLayoutSettings,this.updateBasicSettings(),this.processSheets(t.autoDetectFormat)},r.prototype.updateBasicSettings=function(){var e=this.getStringifyObject(this.parent,["sheets","_isScalar","observers","closed","isStopped","hasError","__isAsync","beforeCellFormat","beforeCellRender","beforeDataBound","beforeOpen","beforeSave","beforeSelect","beforeSort","cellEdit","cellEdited","cellEditing","cellSave","beforeCellSave","contextMenuItemSelect","contextMenuBeforeClose","contextMenuBeforeOpen","created","dataBound","fileMenuItemSelect","fileMenuBeforeClose","fileMenuBeforeOpen","saveComplete","sortComplete","select","actionBegin","actionComplete","afterHyperlinkClick","afterHyperlinkCreate","beforeHyperlinkClick","beforeHyperlinkCreate","openComplete","openFailure","queryCellInfo","dialogBeforeOpen","dataSourceChanged","beforeConditionalFormat","beforeCellUpdate"]),t=JSON.parse(e);this.parent.sheets.length&&(t.sheets=[]),this.saveJSON=t,this.saveJSON.filterCollection=[]},r.prototype.processSheets=function(e){var t=this,r=["dataSource","startCell","query","showFieldAsHeader","result"];this.parent.isAngular&&r.push("template");for(var n,i,a,o,s=0,l=this.parent.sheets.length;s<l;s++){n=!1,i=!1;for(var h=0,d=(a=this.parent.sheets[s]).ranges.length;h<d;h++)if((o=a.ranges[h]).dataSource&&(i=!0,!o.info||!o.info.loadedRange||!o.info.loadedRange.length)){n=!0;break}if(n){var p=this.parent;this.parent.notify(wr,{sheet:a,sheetIndex:s,loadComplete:function(e){R(t,t.processSheet,t.updateSheet,[t.getStringifyObject(t.parent.sheets[e],r,e,!1,!0),e])}.bind(this,s),isFinite:p.scrollSettings&&p.scrollSettings.isFinite,isSaveAction:!0,autoDetectFormat:e})}else R(this,this.processSheet,this.updateSheet,[this.getStringifyObject(a,r,s,e&&i,!0),s])}},r.prototype.updateSheet=function(e){this.saveJSON.sheets[e[0]]=e[1],this.isProcessCompleted=this.getSheetLength(this.saveJSON.sheets)===this.parent.sheets.length,this.isProcessCompleted&&this.save(this.saveSettings)},r.prototype.getSheetLength=function(e){var t=0;return e.forEach(function(e){e&&t++}),t},r.prototype.save=function(e){var t={cancel:!1,jsonObject:this.saveJSON};this.parent.notify(Cn,t),t.cancel||(this.isFullPost?(this.initiateFullPostSave(),this.saveJSON={}):R(this,{workerTask:this.processSave},this.updateSaveResult,[this.saveJSON,e,this.customParams,this.pdfLayoutSettings],!0))},r.prototype.updateSaveResult=function(e){if(e.isFormDataError)this.processSave(this.saveJSON,this.saveSettings,this.customParams,this.pdfLayoutSettings,this.updateSaveResult);else{this.saveJSON={};var t={status:"Success",message:"",url:this.saveSettings.url,fileName:this.saveSettings.fileName,saveType:this.saveSettings.saveType,blobData:null};"object"==typeof e&&e.error?(t.status="Failure",t.message=e.error.toString()):"object"==typeof e&&e.dialog?this.parent.notify(si,{content:e.dialog}):this.needBlobData?t.blobData=e:this.ClientFileDownload(e),this.parent.trigger("saveComplete",t),this.parent.notify(Lr,t)}},r.prototype.ClientFileDownload=function(e){var t=this.parent.createElement("a",{attrs:{download:this.getFileNameWithExtension()}}),r=URL.createObjectURL(e);t.href=r,document.body.appendChild(t),t.click(),URL.revokeObjectURL(r),document.body.removeChild(t)},r.prototype.initiateFullPostSave=function(){var e,r=Object.keys(this.saveSettings),n=this.parent.createElement("form",{attrs:{method:"POST",action:this.saveSettings.url}}),i=this.parent.createElement("input",{attrs:{type:"hidden",name:"JSONData"}});for(i.value=JSON.stringify(this.saveJSON),n.appendChild(i),e=0;e<r.length;e++)(i=this.parent.createElement("input",{attrs:{type:"hidden",name:r[e]}})).value=this.saveSettings[r[e]],n.appendChild(i);for(r=Object.keys(this.customParams),e=0;e<r.length;e++)(i=this.parent.createElement("input",{attrs:{type:"hidden",name:r[e]}})).value=this.customParams[r[e]],n.appendChild(i);(i=this.parent.createElement("input",{attrs:{type:"hidden",name:"pdfLayoutSettings"}})).value=JSON.stringify(this.pdfLayoutSettings),n.appendChild(i),document.body.appendChild(n),n.submit(),t.detach(n),this.parent.notify(Lr,{})},r.prototype.performStringifyAction=function(e){e.model='{"jsonObject":{"Workbook":{"sheets":[';for(var t=0,r=this.parent.sheets.length-1;t<=r;t++)e.model+=this.getStringifyObject(this.parent.sheets[t],e.skipProps,t)+(t<r?",":"]}}}")},r.prototype.getStringifyObject=function(e,t,r,n,i){var a=this;void 0===t&&(t=[]),0===r&&this.parent.notify(rn,{clearAll:!0}),i&&this.parent.notify(Dr,{sheetIdx:r,isSaveAction:!0,saveJson:this.saveJSON});var o,s=[],l=n&&le(this.parent),h=JSON.stringify(e,function(i,h){if(!(t.indexOf(i)>-1)){if("cellStyle"===i)return a.parent.commonCellStyle;if(h&&h.cells)for(var d=0,p=h.cells.length;d<p;d++){var c=h.cells[d],u=[Number(i),d];if(c&&(c.value?n&&!c.formula&&l(c):c.formula&&c.formula.indexOf("=UNIQUE(")<0&&(a.parent.notify(jr,{action:"refreshCalculate",value:c.formula,rowIndex:u[0],colIndex:d,isFormula:B(c.formula),sheetIndex:r,isRefreshing:!0}),c.value=Re(u[0],d,e).value),c.chart)){s.push({index:u,chart:c.chart}),o=[];for(var f=0,g=c.chart.length;f<g;f++){var m=Object.assign({},c.chart[f]);delete m.id,o.push(m)}c.chart=o}}return h&&h.properties&&h.maxHgts&&(h.properties=Yi({},h.properties,{maxHgts:h.maxHgts})),h&&"object"==typeof h&&h.hasOwnProperty("properties")?h.properties:null!==h?h:void 0}}),d=Ce(this.parent,r);return s.forEach(function(e){ke(e.index[0],e.index[1],d,{chart:e.chart},!0)}),h},r.prototype.getFileNameWithExtension=function(e){e||(e=this.saveSettings.fileName);var t=this.getFileExtension(),r=e.lastIndexOf(".");return r>-1&&(e=e.substr(0,r)),e+t},r.prototype.getFileExtension=function(){return"."+this.saveSettings.saveType.toLowerCase()},r}(Wi);!function(e){e[e.na=0]="na",e[e.value=1]="value",e[e.ref=2]="ref",e[e.divzero=3]="divzero",e[e.num=4]="num",e[e.name=5]="name",e[e.null=6]="null"}(e.CommonErrors||(e.CommonErrors={})),function(e){e[e.operators_cannot_start_with_expression=0]="operators_cannot_start_with_expression",e[e.reservedWord_And=1]="reservedWord_And",e[e.reservedWord_Xor=2]="reservedWord_Xor",e[e.reservedWord_If=3]="reservedWord_If",e[e.number_contains_2_decimal_points=4]="number_contains_2_decimal_points",e[e.reservedWord_Else=5]="reservedWord_Else",e[e.reservedWord_Not=6]="reservedWord_Not",e[e.invalid_char_in_number=7]="invalid_char_in_number",e[e.invalid_characters_following_with_operator=6]="invalid_characters_following_with_operator",e[e.mismatched_parentheses=8]="mismatched_parentheses",e[e.unknown_formula_name=9]="unknown_formula_name",e[e.requires_a_single_argument=10]="requires_a_single_argument",e[e.requires_3_args=11]="requires_3_args",e[e.invalid_Math_argument=12]="invalid_Math_argument",e[e.requires_2_args=13]="requires_2_args",e[e.bad_index=14]="bad_index",e[e.too_complex=15]="too_complex",e[e.circular_reference=16]="circular_reference",e[e.missing_formula=17]="missing_formula",e[e.improper_formula=18]="improper_formula",e[e.invalid_expression=19]="invalid_expression",e[e.cell_empty=20]="cell_empty",e[e.bad_formula=21]="bad_formula",e[e.empty_expression=22]="empty_expression",e[e.virtual_mode_required=23]="virtual_mode_required",e[e.mismatched_tics=24]="mismatched_tics",e[e.wrong_number_arguments=25]="wrong_number_arguments",e[e.invalid_arguments=26]="invalid_arguments",e[e.iterations_do_not_converge=27]="iterations_do_not_converge",e[e.calculation_overflow=29]="calculation_overflow",e[e.already_registered=28]="already_registered",e[e.missing_sheet=30]="missing_sheet",e[e.cannot_parse=31]="cannot_parse",e[e.expression_cannot_end_with_an_operator=32]="expression_cannot_end_with_an_operator",e[e.spill=33]="spill",e[e.div=34]="div"}(e.FormulasErrorsStrings||(e.FormulasErrorsStrings={})),function(e){e.xlsx="xlsx",e.xlsm="xlsm",e.xlsb="xlsb",e.xltx="xltx",e.xltm="xltm",e.xls="xls",e.xml="xml",e.xlam="xlam",e.xla="xla",e.xlw="xlw",e.xlr="xlr",e.prn="prn",e.txt="txt",e.csv="csv",e.dif="dif",e.slk="slk"}(e.ExcelFileFormats||(e.ExcelFileFormats={}));var Ki=function(){function e(e){this.parent=e}return e.prototype.getModuleName=function(){return"calc-common"},e}(),$i=function(){function e(e){this.loadedModules=[],this.parent=e}return e.prototype.inject=function(e,t){var r=e.length;if(0!==r){this.loadedModules.length&&this.clearUnusedModule(e);for(var n=0;n<r;n++)for(var i=e[n],a=0,o=t;a<o.length;a++){var s=o[a],l=i.member;if(s.prototype.getModuleName()===i.member&&!this.isModuleLoaded(l)){var h=this.createInstance(s,i.args),d=this.getMemberName(l);i.isProperty?He(d,s,this.parent):He(d,h,this.parent);var p=i;p.member=d,this.loadedModules.push(p)}}}else this.clean()},e.prototype.createInstance=function(e,t){var r=t;return r.unshift(void 0),new(Function.prototype.bind.apply(e,r))},e.prototype.clean=function(){for(var e=0,t=this.loadedModules;e<t.length;e++){var r=t[e];r.isProperty||Me(r.member,this.parent).destroy()}this.loadedModules=[]},e.prototype.clearUnusedModule=function(e){for(var t=this,r=e.map(function(e){return t.getMemberName(e.member)}),n=0,i=this.loadedModules.filter(function(e){return-1===r.indexOf(e.member)});n<i.length;n++){var a=i[n];a.isProperty||Me(a.member,this.parent).destroy(),this.loadedModules.splice(this.loadedModules.indexOf(a),1),this.deleteObject(this.parent,a.member)}},e.prototype.getMemberName=function(e){return e[0].toLowerCase()+e.substring(1)+"Module"},e.prototype.deleteObject=function(e,t){delete e[""+t]},e.prototype.isModuleLoaded=function(e){for(var t=0,r=this.loadedModules;t<r.length;t++){if(r[t].member===this.getMemberName(e))return!0}return!1},e}(),Zi=function(){function n(e){this.formulas=[{formulaName:"SUM",category:"Math & Trig",description:"Sums individual values, cell references or ranges."},{formulaName:"SUMIFS",category:"Math & Trig",description:"Sums the cells specified by a given set of conditionsor criteria."},{formulaName:"SUMPRODUCT",category:"Math & Trig",description:"Returns sum of the product of given ranges of arrays."},{formulaName:"ABS",category:"Math & Trig",description:"Returns the absolute value of a number."},{formulaName:"RAND",category:"Math & Trig",description:"Return a random number between 0 and 1."},{formulaName:"FLOOR",category:"Math & Trig",description:"Returns the round a number down to the nearest integer."},{formulaName:"CEILING",category:"Math & Trig",description:"Returns a number rounded up to a multiple of another number."},{formulaName:"SUMIF",category:"Math & Trig",description:"It will sum up cells that meet the given criteria."},{formulaName:"PRODUCT",category:"Math & Trig",description:"Multiplies all the numbers given as arguments and returns the product."},{formulaName:"AVERAGE",category:"Statistical",description:"The sum of the numbers divided by how many numbers are being averaged."},{formulaName:"AVERAGEIF",category:"Statistical",description:"Computes the average of the numbers in a range that meet the supplied criteria."},{formulaName:"COUNT",category:"Statistical",description:"Counts the numbers in the list of arguments, exclude text entries."},{formulaName:"COUNTA",category:"Statistical",description:"Counts the non-empty values in the list of arguments."},{formulaName:"COUNTIF",category:"Statistical",description:"Counts the number of cells in a range that meet a specified condition."},{formulaName:"COUNTIFS",category:"Statistical",description:"Counts the number of times each cells in all the ranges that meet the specific conditions."},{formulaName:"AVERAGEA",category:"Statistical",description:"Calculates the average of values in the list of arguments.Arguments can be numbers, names, arrays or references."},{formulaName:"AVERAGEIFS",category:"Statistical",description:"Conditionally returns the average of the contents of cells for the set of ranges."},{formulaName:"MIN",category:"Statistical",description:"Returns the smaller number in set of arguments."},{formulaName:"MAX",category:"Statistical",description:"Returns the largest number in set of arguments."},{formulaName:"DATE",category:"Date",description:"Returns the date, given the year, month and day of the month."},{formulaName:"DAY",category:"Date",description:"Returns the day of a given date."},{formulaName:"TODAY",category:"Date",description:"Returns the current date as date value."},{formulaName:"DAYS",category:"Date",description:"Returns the number of days between two dates."},{formulaName:"WEEKDAY",category:"Date",description:"Returns the day of the week corresponding to a date."},{formulaName:"IF",category:"Logical",description:"Returns one value if a logical expression is TRUE and another if it is FALSE"},{formulaName:"AND",category:"Logical",description:"Returns TRUE if all the arguments are considered TRUE, and FALSE otherwise."},{formulaName:"IFS",category:"Logical",description:"Checks multiple conditions and returns a value corresponding to the first TRUE result."},{formulaName:"IFERROR",category:"Logical",description:"Returns a value you specify if a formula evaluates to an error; otherwise, it returns the result of the formula."},{formulaName:"CHOOSE",category:"Lookup & Reference",description:"Returns a value from a list, given an index number."},{formulaName:"INDEX",category:"Lookup & Reference",description:"Returns a value from a table, given a row and column number."},{formulaName:"FIND",category:"Text",description:"Returns the position of a string of text within another string."},{formulaName:"CONCATENATE",category:"Text",description:" Used to join two or more strings together."},{formulaName:"CONCAT",category:"Text",description:"Concatenates a list or range of text strings."},{formulaName:"SUBTOTAL",category:"Lookup & Reference",description:"Returns a subtotal in a list or database."},{formulaName:"RADIANS",category:"Math & Trig",description:"Converts degrees to radians."},{formulaName:"OR",category:"Logical",description:"Returns TRUE if any arguments considered TRUE, and all the arguments are FALSE it will return FALSE."},{formulaName:"NOT",category:"Logical",description:"Returns the inverse of a given logical expression."},{formulaName:"MATCH",category:"Lookup & Reference",description:"Returns the relative position of an checked item in range that matches a specified value in a specified order"},{formulaName:"RANDBETWEEN",category:"Math & Trig",description:"Returns an integer random number in a specified range."},{formulaName:"SLOPE",category:"Statistical",description:"Returns the slope of the line from linear regression of the data points."},{formulaName:"INTERCEPT",category:"Statistical",description:"Calculates the point of the Y-intercept line via linear regression."},{formulaName:"RSQ",category:"Statistical",description:"Returns the square of the Pearson product moment correlation coefficient based on data points in known_ys and known_xs"},{formulaName:"UNIQUE",category:"Lookup & Reference",description:"Returns a unique values from a range or array."},{formulaName:"ROUNDUP",category:"Math & Trig",description:"Rounds a number away from zero."},{formulaName:"ROUNDDOWN",category:"Math & Trig",description:"Rounds a number down, toward zero."},{formulaName:"INT",category:"Math & Trig",description:"Returns a number to the nearest integer."},{formulaName:"LN",category:"Math & Trig",description:"Returns the natural logarithm of a number."},{formulaName:"ISNUMBER",category:"Information",description:"Returns TRUE, if the argument is number and FALSE otherwise."},{formulaName:"ROUND",category:"Math & Trig",description:"Rounds a number to a specified number of digits."},{formulaName:"LOG",category:"Math & Trig",description:"Returns the logarithm of a number to the base that you specify."},{formulaName:"POWER",category:"Math & Trig",description:"Returns the result of a number raised to power."},{formulaName:"SQRT",category:"Math & Trig",description:"Returns the square root of a positive number."},{formulaName:"TRUNC",category:"Math & Trig",description:"Returns the truncated value of a number to a specified number of decimal places."},{formulaName:"EXP",category:"Math & Trig",description:"Returns e raised to the power of the given number."},{formulaName:"GEOMEAN",category:"Statistical",description:"Returns the geometric mean of an array or range of positive data."},{formulaName:"TEXT",category:"Lookup & Reference",description:"Converts a value to text in specified number format."},{formulaName:"SORT",category:"Lookup & Reference",description:"Sorts a range of an array."},{formulaName:"LOOKUP",category:"Lookup & Reference",description:"Looks for a value in a one-row or one-column range, then returns a value from the same position in a second one-row or one-column range."},{formulaName:"VLOOKUP",category:"Lookup & Reference",description:"Looks for a specific value in the first column of a lookup range and returns a corresponding value from a different column within the same row."},{formulaName:"HLOOKUP",category:"Lookup & Reference",description:"Looks for a value in the top row of the array of values and then returns a value in the same column from a row in the array that you specify."},{formulaName:"T",category:"Text",description:"Checks whether a value is text or not and returns the text."},{formulaName:"EXACT",category:"Text",description:"Checks whether a two text strings are exactly same and returns TRUE or FALSE."},{formulaName:"LEN",category:"Text",description:"Returns a number of characters in a given string."},{formulaName:"MOD",category:"Math & Trig",description:"Returns a remainder after a number is divided by divisor."},{formulaName:"ODD",category:"Math & Trig",description:"Rounds a positive number up and negative number down to the nearest odd integer."},{formulaName:"PI",category:"Math & Trig",description:"Returns the value of pi."},{formulaName:"COUNTBLANK",category:"Statistical",description:"Returns the number of empty cells in a specified range of cells."},{formulaName:"EVEN",category:"Math & Trig",description:"Rounds a positive number up and negative number down to the nearest even integer."},{formulaName:"FACT",category:"Math & Trig",description:"Returns the factorial of a number."},{formulaName:"DECIMAL",category:"Math & Trig",description:"Converts a text representation of a number in a given base into a decimal number."},{formulaName:"DEGREES",category:"Math & Trig",description:"Converts radians to degrees."},{formulaName:"ADDRESS",category:"Lookup & Reference",description:"Returns a cell reference as text, given specified row and column numbers."},{formulaName:"TIME",category:"Date & Time",description:"Converts hours, minutes, seconds to the time formatted text."},{formulaName:"CHAR",category:"Text",description:"Returns the character from the specified number."},{formulaName:"CODE",category:"Text",description:"Returns the numeric code for the first character in a given string."},{formulaName:"DOLLAR",category:"Text",description:"Converts the number to currency formatted text."},{formulaName:"SMALL",category:"Statistical",description:"Returns the k-th smallest value in a given array."},{formulaName:"LARGE",category:"Statistical",description:"Returns the k-th largest value in a given array."},{formulaName:"MEDIAN",category:"Statistical",description:"Returns the median of the given set of numbers."},{formulaName:"EDATE",category:"Date & Time",description:"Returns a date with given number of months before or after the specified date."},{formulaName:"EOMONTH",category:"Date & Time",description:"Returns the last day of the month that is a specified number of months before or after an initially supplied start date."},{formulaName:"DATEVALUE",category:"Date & Time",description:"Converts a date string into date value."},{formulaName:"HOUR",category:"Date & Time",description:"Returns the number of hours in a specified time string."},{formulaName:"MINUTE",category:"Date & Time",description:"Returns the number of minutes in a specified time string."},{formulaName:"SECOND",category:"Date & Time",description:"Returns the number of seconds in a specified time string."},{formulaName:"NOW",category:"Date & Time",description:"Returns the current date and time."},{formulaName:"MONTH",category:"Date & Time",description:"Returns the number of months in a specified date string."},{formulaName:"PROPER",category:"Text",description:"Converts a text to proper case; first letter to uppercase and other letters to lowercase."}],this.isConcat=!1,this.parent=e,this.init()}return n.prototype.init=function(){for(var e,r=0;r<this.formulas.length;r++)e=t.getValue("Compute"+this.formulas[r].formulaName,this).bind(this),this.addFormulaCollection(this.formulas[r].formulaName.toUpperCase(),e,this.formulas[r].category,this.formulas[r].description)},n.prototype.addFormulaCollection=function(e,t,r,n){this.parent.libraryFormulas={fName:e,handler:t,category:r,description:n}},n.prototype.ComputeSUM=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var i=!1;if(r.length&&"isSubtotal"===r[r.length-1]&&(i=!0,r.pop()),t.isNullOrUndefined(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_arguments];var a,o,s=0,l=0;if(!t.isNullOrUndefined(r))for(var h=r,d=function(e){e.toString().indexOf(".")>-1&&(l=Math.max(l,e.split(".")[1].length))},p=0;p<h.length;p++){var c=h[p].toString();if(c.indexOf(":")>-1&&this.parent.isCellReference(c)){for(var u=this.parent.getCellCollection(c.split(this.parent.tic).join("")),f=0;f<u.length;f++)if(a=i?this.parent.getValueFromArg(u[f],null,null,!0):this.parent.getValueFromArg(u[f]),!i||!a.includes("SUBTOTAL(")){if(this.parent.getErrorStrings().indexOf(a)>-1)return a;t.isNullOrUndefined(a[0])||isNaN(this.parent.parseFloat(a))||(d(a),s+=this.parent.parseFloat(a))}}else{if(h[p].indexOf(this.parent.tic)>-1&&(isNaN(this.parent.parseFloat(h[p].split(this.parent.tic).join("")))||""===h[p].split(this.parent.tic).join("").trim()))return this.parent.getErrorStrings()[e.CommonErrors.value];if(h[p].split(this.parent.tic).join("")===this.parent.trueValue&&(h[p]="1"),h[p].split(this.parent.tic).join("")===this.parent.falseValue&&(h[p]="0"),o=i?this.parent.getValueFromArg(h[p].split(this.parent.tic).join(""),null,null,!0):this.parent.getValueFromArg(h[p].split(this.parent.tic).join("")),i&&o.includes("SUBTOTAL("))continue;if(this.parent.getErrorStrings().indexOf(o)>-1)return o;if(t.isNullOrUndefined(o)||isNaN(this.parent.parseFloat(o)))continue;o.length>0&&(d(o),s+=this.parent.parseFloat(o+""))}}return s.toString().indexOf(".")>-1?s.toFixed(l):s},n.prototype.ComputeINT=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var i,a,o;if((!t.isNullOrUndefined(r)&&1!==r.length||""===r[0])&&(i=this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_arguments]),""!==r[0]&&1===r.length){if(i=r[0],o=i.indexOf('"'),i=i.indexOf('"')>-1?i.replace('"',""):i,i=i.indexOf('"')>-1?i.replace('"',""):i,i=this.parent.getValueFromArg(i),this.parent.getErrorStrings().indexOf(i)>-1)return i;var s=i.toUpperCase();i="TRUE"===s?"1":"FALSE"===s?"0":i,a=this.parent.parseFloat(i),a=Math.floor(a)}return isNaN(a)&&(i=o>-1?this.parent.getErrorStrings()[e.CommonErrors.value]:this.parent.getErrorStrings()[e.CommonErrors.name]),a||i},n.prototype.ComputeTODAY=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n;if(1!==t.length||""!==t[0])n=this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_arguments];else{var i=new Date(Date.now());"spreadsheet"===this.parent.parentObject.getModuleName()?(n=this.parent.parentObject.dateToInt(i),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)):n=i.getFullYear()+"/"+this.parent.calculateDate((i.getMonth()+1).toString())+"/"+this.parent.calculateDate(i.getDate().toString())}return n},n.prototype.ComputeWEEKDAY=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];if(""===r[0]&&t.isNullOrUndefined(r[1])||r.length>2)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_arguments];if(""===r[0]&&""===r[1]||""===r[1])return this.parent.getErrorStrings()[e.CommonErrors.num].toString();if(1===r.length&&r.push("1"),r[0].indexOf(this.parent.tic)>-1&&""===r[0].split(this.parent.tic).join("").trim()||""===r[1].split(this.parent.tic).join("").trim()||r[1].indexOf(this.parent.tic)>-1&&isNaN(this.parent.parseFloat(r[1].split(this.parent.tic).join(""))))return this.parent.getErrorStrings()[e.CommonErrors.value];var i,a,o;if(this.parent.isCellReference(r[0])){if((i=this.parent.getValueFromArg(r[0].split(this.parent.tic).join(""))||"0").indexOf(this.parent.tic)>-1)return this.parent.getErrorStrings()[e.CommonErrors.value]}else i=r[0].indexOf(this.parent.tic)>-1&&isNaN(this.parent.parseFloat(r[0].split(this.parent.tic).join("")))?this.parent.getValueFromArg(r[0]):this.parent.getValueFromArg(r[0].split(this.parent.tic).join(""))||"0";if(a=this.parent.isCellReference(r[1])?this.parent.getValueFromArg(r[1].split(this.parent.tic).join(""))||"0":this.parent.getValueFromArg(r[1].split(this.parent.tic).join("")),this.parent.getErrorStrings().indexOf(i)>-1)return i;if(this.parent.getErrorStrings().indexOf(a)>-1)return a;if(i=i===this.parent.trueValue?"1":i===this.parent.falseValue?"0":i,a=a===this.parent.trueValue?"1":a===this.parent.falseValue?"0":a,o=this.parent.parseFloat(i),a=this.parent.parseFloat(a),isNaN(a)||isNaN(o))return this.parent.getErrorStrings()[e.CommonErrors.value];if(o<0||o>2958465)return this.parent.getErrorStrings()[e.CommonErrors.num].toString();switch(a=parseInt(a.toString(),10),o=o<1?0:Math.floor(o)%7,a){case 1:case 17:o=o<=0?o+7:o;break;case 2:case 11:o=(o-=1)<=0?o+7:o;break;case 3:o=(o-=2)<0?o+7:o;break;case 12:o=(o+=5)>7?o-7:o;break;case 13:o=(o+=4)>7?o-7:o;break;case 14:o=(o+=3)>7?o-7:o;break;case 15:o=(o+=2)>7?o-7:o;break;case 16:o=(o+=1)>7?o-7:o;break;default:o=this.parent.getErrorStrings()[e.CommonErrors.num].toString()}return o},n.prototype.ComputePROPER=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n,i;if(t.length&&"nestedFormulaTrue"===t[t.length-1]&&(i=!0,t.pop()),t&&""===t[0]||1!==t.length)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_arguments];var a=this.parent.getValueFromArg(t[0]).split(this.parent.tic).join("");if(this.parent.getErrorStrings().indexOf(a)>-1)return a;for(var o=a.toLowerCase().split(" "),s=0;s<o.length;s++)if(o[s][0])for(var l=0;l<o[s].length;l++)if(o[s].charCodeAt(l)>=97&&o[s].charCodeAt(l)<=122){o[s]=o[s].replace(o[s][l],o[s][l].toUpperCase());break}if((n=o.join(" ")).indexOf("-")>0){var h=n.split("-");for(s=0;s<h.length;s++)if(h[s][0])for(l=0;l<h[s].length;l++)if(h[s].charCodeAt(l)>=97&&h[s].charCodeAt(l)<=122){h[s]=h[s].replace(h[s][l],h[s][l].toUpperCase());break}n=h.join("-")}if(n.indexOf(",")>0){var d=n.split(",");for(s=0;s<d.length;s++)if(d[s][0])for(l=0;l<d[s].length;l++)if(d[s].charCodeAt(l)>=97&&d[s].charCodeAt(l)<=122){d[s]=d[s].replace(d[s][l],d[s][l].toUpperCase());break}n=d.join(",")}return i&&(n=this.parent.tic+n+this.parent.tic),n},n.prototype.ComputeSUMPRODUCT=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var i,a;if(t.isNullOrUndefined(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_arguments];for(var o,s=0,l=0,h=null,d=r,p=[],c=0;c<d.length;c++)p.push(this.parent.getCellCollection(d[c]).length);for(var u=0;u<p.length;u++)if(p[u]&&p[u+1]&&p[u]!==p[u+1])return this.parent.getErrorStrings()[e.CommonErrors.value];for(var f=0;f<d.length;++f){var g=d[f];if(g.startsWith(this.parent.tic)||!this.parent.isCellReference(g)){var m=this.parent.getValueFromArg(g);return o=m.indexOf('"'),this.parent.getErrorStrings().indexOf(m)>-1?m:o>-1?0:this.parent.getErrorStrings()[e.CommonErrors.value]}c=g.indexOf(":");var v=this.parent.rowIndex(g.substr(0,c)),y=this.parent.rowIndex(g.substr(c+1));if(!(-1!==v||-1===y)==(-1===v||-1!==y))return this.parent.getErrorStrings()[e.CommonErrors.name];v>y&&(v=(i=[y,v])[0],y=i[1]);var C=this.parent.colIndex(g.substr(0,c)),b=this.parent.colIndex(g.substr(c+1));if(C>b&&(C=(a=[b,C])[0],b=a[1]),null===h)for(l=(y-v+1)*(b-C+1),h=[],c=0;c<l;++c)h[c]=1;c=0;for(var x=v;x<=y;++x)for(var S=C;S<=b;++S){var w=this.getSheetReference(g)+this.parent.convertAlpha(S)+x,I=this.parent.getValueFromArg(w);if(this.parent.getErrorStrings().indexOf(I)>-1)return I;if(isNaN(this.parent.parseFloat(I)))h[c]=0;else{if(isNaN(h[c]))return this.parent.getErrorStrings()[e.CommonErrors.name];h[c]=h[c]*this.parent.parseFloat(I)}c++}}for(c=0;c<l;++c)s+=h[c];return s},n.prototype.ComputeROUNDUP=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var i,a,o,s,l,h=r.length;if(!t.isNullOrUndefined(r)&&h>2&&(i=this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_arguments]),1===h&&""!==r[0])s=r[0].indexOf('"'),a="TRUE"===(a=(a=r[0].indexOf('"')>-1?r[0].replace('"',""):r[0]).indexOf('"')>-1?a.replace('"',""):a).toUpperCase()?"1":"FALSE"===a?"0":a,a=this.parent.getValueFromArg(a),(l=this.parent.parseFloat(a))>0?l+=.4999999999:l<0&&(l-=.4999999999),i=(l=this.parent.parseFloat(l.toFixed(0))).toString();else if(2===h){if(s=r[0].indexOf('"')>-1?r[0].indexOf('"'):r[1].indexOf('"')>-1?r[1].indexOf('"'):-1,this.parent.isCellReference(r[0]))a=this.parent.getValueFromArg(r[0])||"0";else{if(r[0].indexOf(this.parent.tic)>-1&&(r[0].split(this.parent.tic).join("")===this.parent.trueValue||r[0].split(this.parent.tic).join("")===this.parent.falseValue))return this.parent.getErrorStrings()[e.CommonErrors.value];a=this.parent.getValueFromArg(r[0]).split(this.parent.tic).join("")}if(this.parent.getErrorStrings().indexOf(a)>-1)return a;if(this.parent.isCellReference(r[1]))o=this.parent.getValueFromArg(r[1])||"0";else{if(r[1].indexOf(this.parent.tic)>-1&&(r[1].split(this.parent.tic).join("")===this.parent.trueValue||r[1].split(this.parent.tic).join("")===this.parent.falseValue))return this.parent.getErrorStrings()[e.CommonErrors.value];o=this.parent.getValueFromArg(r[1]).split(this.parent.tic).join("")}if(this.parent.getErrorStrings().indexOf(o)>-1)return o;a="TRUE"===a.toUpperCase()?"1":"FALSE"===a?"0":a,o="TRUE"===o.toUpperCase()?"1":"FALSE"===o?"0":o;var d=isNaN(Number(a))||""===a.trim(),p=isNaN(Number(o))||""===o.trim();if((r[0].indexOf('"')>-1||this.parent.isCellReference(r[0]))&&d||(r[1].indexOf('"')>-1||this.parent.isCellReference(r[1]))&&p)return this.parent.getErrorStrings()[e.CommonErrors.value];var c=Math.ceil(this.parent.parseFloat(o));if(l=this.parent.parseFloat(a),c>0){l>0?l+=.4999999999/Math.pow(10,c):l<0&&(l-=.4999999999/Math.pow(10,c));var u=a.split("."),f=2===u.length?u[1].length>=c?c:u[1].length:0;i=(l=this.parent.parseFloat(l.toFixed(f))).toString(),isNaN(l)&&(i=c.toString().indexOf('"')>-1?this.parent.getErrorStrings()[e.CommonErrors.value]:this.parent.getErrorStrings()[e.CommonErrors.name])}else l>0?l=l/Math.pow(10,-c)+.49999:l<0&&(l=l/Math.pow(10,-c)-.49999),i=(l=l>0&&c<-9?1*Math.pow(10,-c):this.parent.parseFloat(l.toFixed(0))*Math.pow(10,-c)).toString(),isNaN(l)&&(i=c.toString().indexOf('"')>-1?this.parent.getErrorStrings()[e.CommonErrors.value]:i=this.parent.getErrorStrings()[e.CommonErrors.name])}else i=s>-1?this.parent.getErrorStrings()[e.CommonErrors.value]:this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_arguments];return i},n.prototype.ComputeROUNDDOWN=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var i,a,o,s,l,h=r.length;if(!t.isNullOrUndefined(r)&&h>2&&(i=this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_arguments]),1===h&&""!==r[0])s=r[0].indexOf('"'),a="TRUE"===(a=(a=r[0].indexOf('"')>-1?r[0].replace('"',""):r[0]).indexOf('"')>-1?a.replace('"',""):a).toUpperCase()?"1":"FALSE"===a?"0":a,a=this.parent.getValueFromArg(a),(l=this.parent.parseFloat(a))>0?l-=.4999999999:l<0&&(l+=.4999999999),i=(l=this.parent.parseFloat(l.toFixed(0))).toString();else if(2===h){if(s=r[0].indexOf('"')>-1?r[0].indexOf('"'):r[1].indexOf('"')>-1?r[1].indexOf('"'):-1,this.parent.isCellReference(r[0]))a=this.parent.getValueFromArg(r[0])||"0";else{if(r[0].indexOf(this.parent.tic)>-1&&(r[0].split(this.parent.tic).join("")===this.parent.trueValue||r[0].split(this.parent.tic).join("")===this.parent.falseValue))return this.parent.getErrorStrings()[e.CommonErrors.value];a=this.parent.getValueFromArg(r[0]).split(this.parent.tic).join("")}if(this.parent.getErrorStrings().indexOf(a)>-1)return a;if(this.parent.isCellReference(r[1]))o=this.parent.getValueFromArg(r[1])||"0";else{if(r[1].indexOf(this.parent.tic)>-1&&(r[1].split(this.parent.tic).join("")===this.parent.trueValue||r[1].split(this.parent.tic).join("")===this.parent.falseValue))return this.parent.getErrorStrings()[e.CommonErrors.value];o=this.parent.getValueFromArg(r[1]).split(this.parent.tic).join("")}if(this.parent.getErrorStrings().indexOf(o)>-1)return o;a="TRUE"===a.toUpperCase()?"1":"FALSE"===a?"0":a,o="TRUE"===o.toUpperCase()?"1":"FALSE"===o?"0":o;var d=isNaN(Number(a))||""===a.trim(),p=isNaN(Number(o))||""===o.trim();if((r[0].indexOf('"')>-1||this.parent.isCellReference(r[0]))&&d||(r[1].indexOf('"')>-1||this.parent.isCellReference(r[1]))&&p)return this.parent.getErrorStrings()[e.CommonErrors.value];var c=Math.ceil(this.parent.parseFloat(o));if(l=this.parent.parseFloat(a),c>0){l>0?l-=.4999999999/Math.pow(10,c):l<0&&(l+=.4999999999/Math.pow(10,c));var u=a.indexOf("."),f=0;-1!==u&&(f=(f=a.length-u-1)>=c?c:f),i=(l=this.parent.parseFloat(this.preciseRound(l,f))).toString(),isNaN(l)&&(i=c.toString().indexOf('"')>-1?this.parent.getErrorStrings()[e.CommonErrors.value]:this.parent.getErrorStrings()[e.CommonErrors.name])}else l>0?l=l/Math.pow(10,-c)-.49999:l<0&&(l=l/Math.pow(10,-c)+.49999),i=(l=l>0&&c<-9?1*Math.pow(10,-c):this.parent.parseFloat(l.toFixed(0))*Math.pow(10,-c)).toString(),isNaN(l)&&(i=c.toString().indexOf('"')>-1?this.parent.getErrorStrings()[e.CommonErrors.value]:i=this.parent.getErrorStrings()[e.CommonErrors.name])}else i=s>-1?this.parent.getErrorStrings()[e.CommonErrors.value]:this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_arguments];return i},n.prototype.ComputeCOUNT=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var i=!1;if(r.length&&"isSubtotal"===r[r.length-1]&&(i=!0,r.pop()),t.isNullOrUndefined(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];for(var a,o,s,l,h=r,d=0,p=0;p<h.length;p++)if(a=h[p],this.parent.isCellReference(a))if(a.indexOf(":")>-1){o=this.parent.getCellCollection(a.split(this.parent.tic).join(""));for(var c=0;c<o.length;c++)s=i?this.parent.getValueFromArg(o[c],null,null,!0):this.parent.getValueFromArg(o[c]),i&&s.includes("SUBTOTAL(")||isNaN(this.parent.parseFloat(s))||a.length>0&&""!==s.trim()&&d++}else{if(s=i?this.parent.getValueFromArg(a,null,null,!0):this.parent.getValueFromArg(a),i&&s.includes("SUBTOTAL("))continue;isNaN(this.parent.parseFloat(s))||a.length>0&&""!==s.trim()&&d++}else l=this.parent.getValueFromArg(a).split(this.parent.tic).join(""),0===a.length&&""===l.trim()?d++:isNaN(this.parent.parseFloat(l))&&a!==this.parent.trueValue&&a!==this.parent.falseValue||a.length>0&&""!==a.trim()&&""!==l.trim()&&d++;return d},n.prototype.ComputeDATE=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var i;if(r.length&&"nestedFormulaTrue"===r[r.length-1]&&(i=!0,r.pop()),t.isNullOrUndefined(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];if(3!==r.length)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];for(var a=[],o=0;o<r.length;++o)a[o]=this.parent.getValueFromArg(r[o]);a[0]=a[0]===this.parent.trueValue?"1":a[0]===this.parent.falseValue?"0":a[0],a[1]=a[1]===this.parent.trueValue?"1":a[1]===this.parent.falseValue?"0":a[1],a[2]=a[2]===this.parent.trueValue?"1":a[2]===this.parent.falseValue?"0":a[2];for(var s=0;s<a.length;s++){var l=a[s];if(this.parent.getErrorStrings().indexOf(l)>-1)return l;if('""'===l||'"0"'===l&&'"0"'!==r[s]||'"TRUE"'===l||'"FALSE"'===l)return this.parent.getErrorStrings()[e.CommonErrors.value].toString()}var h=Math.floor(this.parent.parseFloat(a[0].split(this.parent.tic).join(""))),d=Math.floor(this.parent.parseFloat(a[1].split(this.parent.tic).join(""))),p=Math.floor(this.parent.parseFloat(a[2].split(this.parent.tic).join(""))),c=0;if(isNaN(h)||isNaN(d)||isNaN(p))return this.parent.getErrorStrings()[e.CommonErrors.value].toString();if(h<0&&d<=12||h>=1e4&&d>0)return this.parent.getErrorStrings()[e.CommonErrors.num].toString();for(;d>12;)d-=12,h++;if(0===(c=this.parent.getSerialDateFromDate(h,d,p)))return this.parent.getErrorStrings()[e.CommonErrors.num].toString();var u=this.parent.fromOADate(c);if("Invalid Date"!==u.toString()){if(u.getFullYear()<1900||1e4<=u.getFullYear())return this.parent.getErrorStrings()[e.CommonErrors.num].toString();if(!i)return new t.Internationalization(this.parent.parentObject.locale||"en-US").formatDate(u,{type:"date",skeleton:"yMd"})}return c.toString()},n.prototype.ComputeFLOOR=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];if(t.isNullOrUndefined(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_arguments];var i,a=r;if(2!==a.length)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];if(""===a[0]&&""===a[1]||""===a[0]&&!a[1].includes('"'))return 0;""!==a[1]||a[0].includes('"')||(a[1]="0");for(var o=0;o<a.length;o++){var s=a[o].split(this.parent.tic).join("").trim();if(""===s||a[o].indexOf(this.parent.tic)>-1&&isNaN(this.parent.parseFloat(s)))return this.parent.getErrorStrings()[e.CommonErrors.value];if(U(a[o])){if(i=this.parent.getValueFromArg(a[o])||"0",(i=i===this.parent.trueValue?"1":i===this.parent.falseValue?"0":i).toUpperCase().match(/[A-Z]/)||i.includes('"')||!this.parent.isNumber(i))return this.parent.getErrorStrings()[e.CommonErrors.value]}else if(i=this.parent.getValueFromArg(a[o].split(this.parent.tic).join("")),(i=i===this.parent.trueValue?"1":i===this.parent.falseValue?"0":i).toUpperCase().match(/[A-Z]/)||i.includes('"')||!this.parent.isNumber(i))return this.parent.getErrorStrings()[e.CommonErrors.value];a[o]=i}var l=this.parent.parseFloat(a[0]),h=this.parent.parseFloat(a[1]);return l>0&&h<0?this.parent.getErrorStrings()[e.CommonErrors.num]:(l>0||l<0)&&0===h?this.parent.getErrorStrings()[e.CommonErrors.divzero]:isNaN(l)?this.parent.getErrorStrings()[e.CommonErrors.name]:0===l&&0===h?0:Math.floor(l/h)*h},n.prototype.ComputeCEILING=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];if(t.isNullOrUndefined(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_arguments];var i,a=r;if(2!==a.length)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];if(""===a[0]&&""===a[1]||""===a[0]&&!a[1].includes('"'))return 0;""!==a[1]||a[0].includes('"')||(a[1]="0");for(var o=0;o<a.length;o++){var s=a[o].split(this.parent.tic).join("").trim();if(""===s||a[o].indexOf(this.parent.tic)>-1&&isNaN(this.parent.parseFloat(s)))return this.parent.getErrorStrings()[e.CommonErrors.value];if(U(a[o])){if(i=this.parent.getValueFromArg(a[o])||"0",(i=i===this.parent.trueValue?"1":i===this.parent.falseValue?"0":i).toUpperCase().match(/[A-Z]/)||i.includes('"')||!this.parent.isNumber(i))return this.parent.getErrorStrings()[e.CommonErrors.value]}else if(i=this.parent.getValueFromArg(a[o].split(this.parent.tic).join("")),(i=i===this.parent.trueValue?"1":i===this.parent.falseValue?"0":i).toUpperCase().match(/[A-Z]/)||i.includes('"')||!this.parent.isNumber(i))return this.parent.getErrorStrings()[e.CommonErrors.value];a[o]=i}var l=this.parent.parseFloat(a[0]),h=this.parent.parseFloat(a[1]);return l>0&&h<0?this.parent.getErrorStrings()[e.CommonErrors.num]:isNaN(l)?this.parent.getErrorStrings()[e.CommonErrors.name]:(l>0||0===l)&&0===h?0:Math.ceil(l/h)*h},n.prototype.ComputeDAY=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var i,a,o=r;if(t.isNullOrUndefined(o)||1===o.length&&""===o[0])return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_arguments];if(o.length>1)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];var s=o[0].startsWith(this.parent.tic)&&o[0].endsWith(this.parent.tic);if(!s&&this.parent.isCellReference(o[0])){if((a=this.parent.getValueFromArg(o[0].split(this.parent.tic).join(""))).startsWith(this.parent.tic)&&a.endsWith(this.parent.tic))return this.parent.getErrorStrings()[e.CommonErrors.value]}else if(s){if(""===(a=o[0].split(this.parent.tic).join(""))||a===this.parent.trueValue||a===this.parent.falseValue)return this.parent.getErrorStrings()[e.CommonErrors.value]}else a=this.parent.getValueFromArg(o[0].split(this.parent.tic).join(""));return this.parent.getErrorStrings().indexOf(a)>-1?a:Number(a)<0?this.parent.getErrorStrings()[e.CommonErrors.num]:0===Math.floor(Number(a))||a===this.parent.falseValue?0:a===this.parent.trueValue?1:(i=this.parent.isNaN(Number(a))?this.parent.parseDate(a):this.parent.intToDate(a),"[object Date]"===Object.prototype.toString.call(i)&&(i=new Date(i).getFullYear()<1900||new Date(i).getFullYear()>9999?"NaN":i.getDate()),"NaN"===i.toString()?this.parent.getErrorStrings()[e.CommonErrors.value]:i)},n.prototype.ComputeIF=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var i;if(r.length&&"nestedFormulaTrue"===r[r.length-1]&&(i=!0,r.pop()),t.isNullOrUndefined(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_arguments];if(this.parent.getErrorStrings().indexOf(r[0])>0)return r[0];var a,o=r;4===o.length&&"nestedFormulaTrue"===o[3]&&(a=!0,o.pop());var s,l;if(o.length>3||1===o.length)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];if(o.length<=3){var h=void 0,d=void 0,p="";if(s=this.parent.getValueFromArg(o[0]),this.parent.getErrorStrings().indexOf(s)>-1)return s;var c=s.toUpperCase(),u=this.parent.parseFloat(s);if(c===this.parent.trueValue||u<0||u>0){if(i&&o[1].includes(":")){h=this.parent.getCellCollection(o[1]);for(var f=0;f<h.length;f++)d=this.parent.getValueFromArg(h[f]),isNaN(this.parent.parseFloat(d))||(p+=d+",");return p.slice(0,p.length-1)}l=""===o[1]?"0":this.parent.getValueFromArg(o[1])}else{if(c!==this.parent.falseValue&&0!==u)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.requires_3_args];if(t.isNullOrUndefined(o[2]))return this.parent.falseValue;if(i&&o[2].includes(":")){h=this.parent.getCellCollection(o[2]);for(f=0;f<h.length;f++)d=this.parent.getValueFromArg(h[f]),isNaN(this.parent.parseFloat(d))||(p+=d+",");return p.slice(0,p.length-1)}l=""===o[2]?"0":this.parent.getValueFromArg(o[2])}}return!a&&l.indexOf(this.parent.tic)>-1?l.split(this.parent.tic).join(""):""===l?"0":l},n.prototype.ComputeIFERROR=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];if(t.isNullOrUndefined(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_arguments];var i,a=r;if(2!==a.length)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];if(this.parent.isCellReference(a[0])){if(i=this.parent.getValueFromArg(a[0])||"0",-1===this.parent.getErrorStrings().indexOf(i)&&"NaN"!==i)return i}else if(i=this.parent.getValueFromArg(a[0],null,!0)||"0",-1===this.parent.getErrorStrings().indexOf(i)&&"NaN"!==i)return i=i.split(this.parent.tic).join("").trim();return i=this.parent.isCellReference(a[1])?this.parent.getValueFromArg(a[1])||"0":(i=this.parent.getValueFromArg(a[1])||"0").split(this.parent.tic).join("").trim()},n.prototype.ComputePRODUCT=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var i=!1;if(r.length&&"isSubtotal"===r[r.length-1]&&(i=!0,r.pop()),t.isNullOrUndefined(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_arguments];var a,o,s,l=1,h=!0;if(!t.isNullOrUndefined(r))for(var d=r,p=0;p<d.length;p++){var c=d[p];if(c.indexOf(":")>-1&&this.parent.isCellReference(c)){for(var u=this.parent.getCellCollection(c),f=0;f<u.length;f++)if(a=i?this.parent.getValueFromArg(u[f],null,null,!0):this.parent.getValueFromArg(u[f]),(!i||!a.includes("SUBTOTAL("))&&D(a)){if(this.parent.getErrorStrings().indexOf(a)>-1)return a;s=this.parent.parseFloat(a),isNaN(s)||a.length>0&&(l*=s,h=!1)}}else if(-1===c.indexOf(":")&&this.parent.isCellReference(c)){if(o=i?this.parent.getValueFromArg(d[p],null,null,!0):this.parent.getValueFromArg(d[p]),i&&o.includes("SUBTOTAL("))continue;if(!D(o))continue;if(this.parent.getErrorStrings().indexOf(o)>-1)return o}else{if((o=d[p]).indexOf(this.parent.tic)>-1&&""===o.split(this.parent.tic).join("").trim()||d[p].indexOf(this.parent.tic)>-1&&isNaN(this.parent.parseFloat(o.split(this.parent.tic).join(""))))return this.parent.getErrorStrings()[e.CommonErrors.value];if(o=this.parent.getValueFromArg(d[p].split(this.parent.tic).join("")),o=o===this.parent.trueValue?"1":o===this.parent.falseValue?"0":o.split(this.parent.tic).join(""),this.parent.getErrorStrings().indexOf(o)>-1)return o}s=this.parent.parseFloat(o),isNaN(s)||o.length>0&&(l*=s,h=!1)}return h?"0":l.toString()},n.prototype.ComputeDAYS=function(){for(var r=this,n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];var a;if(t.isNullOrUndefined(n)&&1===n.length&&""===n[0])return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_arguments];if(2!==n.length)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];var o=n,s=function(e){return e=e.split(r.parent.tic).join(""),r.parent.isCellReference(e)&&(e=r.parent.getValueFromArg(e)),e===r.parent.trueValue?e="1":e===r.parent.falseValue?e="0":e||(e=new Date(Date.parse("1899-12-31")).toDateString()),e},l=s(o[0]),h=s(o[1]);if("#"===l[0])return l;if("#"===h[0])return h;var d=this.parent.isNaN(Number(l))?this.parent.parseDate(l):this.parent.intToDate(l),p=this.parent.isNaN(Number(h))?this.parent.parseDate(h):this.parent.intToDate(h);return"#"===d.toString()[0]?d.toString():"#"===p.toString()[0]?p.toString():"[object Date]"!==Object.prototype.toString.call(d)||"[object Date]"!==Object.prototype.toString.call(p)?this.parent.getErrorStrings()[e.CommonErrors.value]:(a=Math.ceil(d.getTime()-p.getTime())/864e5,Math.round(a))},n.prototype.ComputeUNIQUE=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var i,a,o,s=r;if("isComputeExp"===s[s.length-1]&&(a=!0,s.pop()),t.isNullOrUndefined(r)||""===r[0]||s.length>3)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];var l=s[1]?s[1].toUpperCase():"FALSE",h=s[2]?s[2].toUpperCase():"FALSE",d=[],p=o=this.parent.actCell;if(s[0].indexOf(":")>-1){if(t.isNullOrUndefined(s[0].match(/[0-9]/))){var c=s[0].split(":");s[0]=c[0]+"1:"+c[1]+(this.parent.spreadSheetUsedRange[0]+1)}else if(t.isNullOrUndefined(s[0].toUpperCase().match(/[A-Z]/))){c=s[0].split(":");s[0]="A"+c[0]+":"+Be(this.parent.spreadSheetUsedRange[1]+1)+c[1]}var u=s[0].split(":");if(this.parent.isCellReference(u[0])&&this.parent.isCellReference(u[1])){for(var f=this.parent.dependencyCollection,g=0;g<f.length&&!a;g++)f[g].split(":")[0]===s[0].split(":")[0]&&this.clearDependency(f[g]);-1===this.parent.dependencyCollection.indexOf(s[0])?a||this.parent.dependencyCollection.push(s[0]):this.clearDependency(s[0]);var m=s[0].indexOf(":"),v=void 0,y=this.parent.rowIndex(this.parent.substring(s[0],0,m)),C=this.parent.colIndex(this.parent.substring(s[0],0,m)),b=this.parent.rowIndex(this.parent.substring(s[0],m+1,m+s[0].length-m-1)),x=this.parent.colIndex(this.parent.substring(s[0],m+1,m+s[0].length-m-1));y>b&&(v=b,b=y,y=v),C>x&&(v=x,x=C,C=v);var S="";0===s[0].indexOf("!")&&(S=s[0].substring(0,s[0].replace("!","").indexOf("!")+2)),s[0]=S+Be(C)+y+":"+Be(x)+b;var w=this.parent.getCellCollection(s[0]),I=x-C,E=[];for(g=0;g<w.length;g++)E.push(w[g]);if("FALSE"===l)if(0===I)for(g=0;g<E.length;g++){N=""===(N=this.parent.getValueFromArg(E[g]))?"0":N,d.push(N)}else{var R="",k=I;for(g=0;g<E.length;g++){if(g===E.length-1){R=R+(N=""===(N=this.parent.getValueFromArg(E[g]))?"0":N)+"+",d.push(R.substring(0,R.length-1))}if(g<=k){R=R+(N=""===(N=this.parent.getValueFromArg(E[g]))?"0":N)+"+"}else{d.push(R.substring(0,R.length-1)),k=I+g;R=(N=""===(N=this.parent.getValueFromArg(E[g]))?"0":N)+"+"}}}else{R="",k=I+1;var F=b-y;for(g=0;g<k;g++){for(var A=0;A<=F;A++){var N;R=R+(N=""===(N=this.parent.getValueFromArg(E[A*k+g]))?"0":N)+"+"}d.push(R.substring(0,R.length-1)),R=""}}var O=[],T=[];for(g=0;g<d.length;g++)-1===O.indexOf(d[g])?O.push(d[g]):T.push(d[g]);if("TRUE"===h){var D=[];for(g=0;g<O.length;g++)-1===T.indexOf(O[g])&&D.push(O[g]);O=D}if(a){var L;return 0!==I?(L=[],O.forEach(function(e){L=L.concat(e.split("+"))})):L="FALSE"===l?O:O[0].split("+"),L}p=p.indexOf("!")>-1?p.split("!")[1]:p;var P=this.parent.rowIndex(p),M=this.parent.colIndex(p);if(0===this.parent.dependencyLevel){var H=!1;if("FALSE"===l)for(g=P,k=O.length+P;g<k;g++)for(var B=M,U=(q=O[0].split("+")).length+M;B<U;B++)g===k-1&&B===U-1&&-1===this.parent.uniqueRange.indexOf(o+":"+Be(B)+g)&&this.parent.uniqueRange.push(o+":"+Be(B)+g),this.checkSpill(B,g)&&(H=!0);else for(g=M,k=O.length+M;g<k;g++){var V=P;for(U=(q=O[0].split("+")).length+P;V<U;V++)g===k-1&&V===U-1&&-1===this.parent.uniqueRange.indexOf(this.parent.actCell+":"+Be(g)+V)&&this.parent.uniqueRange.push(this.parent.actCell+":"+Be(g)+V),this.checkSpill(g,V)&&(H=!0)}if(H)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.spill]}else if(this.parent.dependencyLevel>0&&this.parent.getValueFromArg(Be(M)+P,!0).indexOf("#SPILL!")>-1)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.spill];if("FALSE"===l){var _=this.parent.getSheetFamilyItem(this.parent.grid),z="",j=void 0;null!==_.sheetNameToParentObject&&_.sheetNameToParentObject.size>0&&(j=(z=_.parentObjectToToken.get(this.parent.grid))+p);for(g=0;g<O.length;g++){var q=O[g].split("+");g>0&&(P++,M=this.parent.colIndex(p));for(var W=0;W<q.length;W++)this.setValueRefresh(q[W],P,M,p),(g>0||W>0)&&this.parent.refresh(z+Be(M)+P.toString(),j),q[W+1]&&M++}i=O[0].split("+")[0]}else{for(g=0;g<O.length;g++){q=O[g].split("+");for(var G=0;G<q.length;G++)this.setValueRefresh(q[G],P,M,p),q[G+1]?P++:(M++,P=this.parent.rowIndex(p))}i=O[0].split("+")[0]}}}else{if(!this.parent.isCellReference(s[0]))return s[0].split('"').join("");-1===this.parent.dependencyCollection.indexOf(s[0])?a||this.parent.dependencyCollection.push(s[0]):this.clearDependency(s[0]),i=this.parent.getValueFromArg(s[0])}return i},n.prototype.setValueRefresh=function(e,t,r,n){this.parent.parentObject.setValueRowCol(this.parent.getSheetId(this.parent.grid),e,t,r)},n.prototype.checkSpill=function(t,r){var n,i=!1,a=this.parent.getValueFromArg(Be(t)+r,!0),o="!"+this.parent.getSheetID(this.parent.grid)+"!"+Be(t)+r;return this.parent.getFormulaInfoTable().get(o)&&(n=this.parent.getFormulaInfoTable().get(o).formulaText),a&&(a.toUpperCase().indexOf("UNIQUE")<0||n&&!n.toUpperCase().includes("UNIQUE"))&&a!==this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments]&&(i=!0),i},n.prototype.clearDependency=function(e){var t=this.parent.actCell,r="";if(t.indexOf("!")>-1){var n=t.split("!");t=n[1],r=n[0]+"!"}for(var i=this.parent.rowIndex(t),a=this.parent.colIndex(t),o=e.indexOf(":"),s=this.parent.rowIndex(this.parent.substring(e,0,o)),l=this.parent.colIndex(this.parent.substring(e,0,o)),h=this.parent.rowIndex(this.parent.substring(e,o+1,o+e.length-o-1))-s+i,d=this.parent.colIndex(this.parent.substring(e,o+1,o+e.length-o-1))-l+a,p=this.parent.getFormulaInfoTable().get("!"+this.parent.getSheetID(this.parent.grid)+"!"+t)?this.parent.getFormulaInfoTable().get("!"+this.parent.getSheetID(this.parent.grid)+"!"+t).getFormulaText():"",c=i;c<=h;c++)for(var u=a;u<=d;u++)if(this.parent.dependencyLevel>0||p.indexOf("UNIQUE")>-1){if(this.parent.getValueFromArg("!"+this.parent.getSheetID(this.parent.grid)+"!"+Be(a)+i,!0).indexOf("#SPILL!")>-1)return;this.parent.parentObject.setValueRowCol(this.parent.getSheetID(this.parent.grid)+1,"",c,u),this.parent.refresh("!"+this.parent.getSheetID(this.parent.grid)+"!"+Be(u)+c,t),this.parent.actCell=r+t}},n.prototype.ComputeT=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var i,a="";if(r.length&&"nestedFormulaTrue"===r[r.length-1]&&(i=!0,r.pop()),t.isNullOrUndefined(r)||1!==r.length||""===r[0])return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_arguments];var o=r[0];o=o.indexOf(":")>-1?o.split(":")[0]:o;return null===(o=this.parent.getValueFromArg(o)).match(/^[0-9.]+$/)&&"TRUE"!==o.toUpperCase()&&"FALSE"!==o.toUpperCase()&&(a=o,i&&(a=this.parent.tic+a+this.parent.tic)),a},n.prototype.ComputeHOUR=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];if(1!==r.length||t.isNullOrUndefined(r)||""===r[0])return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_arguments];if(""===r[0].split(this.parent.tic).join("").trim())return this.parent.getErrorStrings()[e.CommonErrors.value];var i;if(this.parent.isCellReference(r[0])){if((i=this.parent.getValueFromArg(r[0].split(this.parent.tic).join(""))||"0").indexOf(this.parent.tic)>-1)return this.parent.getErrorStrings()[e.CommonErrors.value]}else{if(r[0].indexOf(this.parent.tic)>-1&&(r[0].split(this.parent.tic).join("")===this.parent.trueValue||r[0].split(this.parent.tic).join("")===this.parent.falseValue))return this.parent.getErrorStrings()[e.CommonErrors.value];i=this.parent.getValueFromArg(r[0]).split(this.parent.tic).join("")}if(this.parent.getErrorStrings().indexOf(i)>-1)return i;i=i===this.parent.trueValue?"1":i===this.parent.falseValue?"0":i;var a;if(this.parent.isNumber(i)){if(this.parent.parseFloat(i)<0||this.parent.parseFloat(i)>2958465)return this.parent.getErrorStrings()[e.CommonErrors.num];a=this.parent.intToTime(i)}else{var o={value:i.toString()};if(this.parent.parentObject.notify(Wr,o),!o.isDate&&!o.isTime)return this.parent.getErrorStrings()[e.CommonErrors.value];a=o.dateObj}if("Invalid Date"===a.toString()&&(a=new Date(Date.parse(i))),"Invalid Date"===a.toString()){var s=new Date(Date.now()).toLocaleDateString()+" "+i;a=new Date(Date.parse(s))}return"Invalid Date"===a.toString()&&(a=this.parent.fromOADate(this.parent.parseFloat(i))),"Invalid Date"===a.toString()?this.parent.getErrorStrings()[e.CommonErrors.value]:a.getFullYear()<1900||a.getFullYear()>9999?this.parent.getErrorStrings()[e.CommonErrors.value]:a.getHours()},n.prototype.ComputeMINUTE=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];if(1!==r.length||t.isNullOrUndefined(r)||""===r[0])return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_arguments];if(""===r[0].split(this.parent.tic).join("").trim())return this.parent.getErrorStrings()[e.CommonErrors.value];var i;if(this.parent.isCellReference(r[0])){if((i=this.parent.getValueFromArg(r[0].split(this.parent.tic).join(""))||"0").indexOf(this.parent.tic)>-1)return this.parent.getErrorStrings()[e.CommonErrors.value]}else{if(r[0].indexOf(this.parent.tic)>-1&&(r[0].split(this.parent.tic).join("")===this.parent.trueValue||r[0].split(this.parent.tic).join("")===this.parent.falseValue))return this.parent.getErrorStrings()[e.CommonErrors.value];i=this.parent.getValueFromArg(r[0]).split(this.parent.tic).join("")}if(this.parent.getErrorStrings().indexOf(i)>-1)return i;i=i===this.parent.trueValue?"1":i===this.parent.falseValue?"0":i;var a;if(this.parent.isNumber(i)){if(this.parent.parseFloat(i)<0||this.parent.parseFloat(i)>2958465)return this.parent.getErrorStrings()[e.CommonErrors.num];a=this.parent.intToTime(i)}else{var o={value:i.toString()};if(this.parent.parentObject.notify(Wr,o),!o.isDate&&!o.isTime)return this.parent.getErrorStrings()[e.CommonErrors.value];a=o.dateObj}if("Invalid Date"===a.toString()&&(a=new Date(Date.parse(i))),"Invalid Date"===a.toString()){var s=new Date(Date.now()).toLocaleDateString()+" "+i;a=new Date(Date.parse(s))}return"Invalid Date"===a.toString()&&(a=this.parent.fromOADate(this.parent.parseFloat(i))),"Invalid Date"===a.toString()?this.parent.getErrorStrings()[e.CommonErrors.value]:a.getFullYear()<1900||a.getFullYear()>9999?this.parent.getErrorStrings()[e.CommonErrors.value]:a.getMinutes()},n.prototype.ComputeSECOND=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];if(1!==r.length||t.isNullOrUndefined(r)||""===r[0])return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_arguments];if(""===r[0].split(this.parent.tic).join("").trim())return this.parent.getErrorStrings()[e.CommonErrors.value];var i;if(this.parent.isCellReference(r[0])){if((i=this.parent.getValueFromArg(r[0].split(this.parent.tic).join(""))||"0").indexOf(this.parent.tic)>-1)return this.parent.getErrorStrings()[e.CommonErrors.value]}else{if(r[0].indexOf(this.parent.tic)>-1&&(r[0].split(this.parent.tic).join("")===this.parent.trueValue||r[0].split(this.parent.tic).join("")===this.parent.falseValue))return this.parent.getErrorStrings()[e.CommonErrors.value];i=this.parent.getValueFromArg(r[0]).split(this.parent.tic).join("")}if(this.parent.getErrorStrings().indexOf(i)>-1)return i;i=i===this.parent.trueValue?"1":i===this.parent.falseValue?"0":i;var a;if(this.parent.isNumber(i)){if(this.parent.parseFloat(i)<0||this.parent.parseFloat(i)>2958465)return this.parent.getErrorStrings()[e.CommonErrors.num];a=this.parent.intToTime(i)}else{var o={value:i.toString()};if(this.parent.parentObject.notify(Wr,o),!o.isDate&&!o.isTime)return this.parent.getErrorStrings()[e.CommonErrors.value];a=o.dateObj}if("Invalid Date"===a.toString()&&(a=new Date(Date.parse(i))),"Invalid Date"===a.toString()){var s=new Date(Date.now()).toLocaleDateString()+" "+i;a=new Date(Date.parse(s))}return"Invalid Date"===a.toString()&&(a=this.parent.fromOADate(this.parent.parseFloat(i))),"Invalid Date"===a.toString()?this.parent.getErrorStrings()[e.CommonErrors.value]:a.getFullYear()<1900||a.getFullYear()>9999?this.parent.getErrorStrings()[e.CommonErrors.value]:a.getSeconds()},n.prototype.ComputeMONTH=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];if(""===r[0])return this.parent.getErrorStrings()[e.CommonErrors.value];if(1!==r.length||t.isNullOrUndefined(r))return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_arguments];if(!this.parent.isCellReference(r[0])&&-1===r[0].indexOf(this.parent.tic))return this.parent.getErrorStrings()[e.CommonErrors.value];var i=this.spreadsheetFormat(r[0]),a=this.spreadsheetDisplayText(r[0]),o=this.parent.getValueFromArg(r[0]).split(this.parent.tic).join(""),s=this.parseDouble(o),l=0,h=new Date(Date.parse(o));!isNaN(s)&&h.getFullYear()>9999&&(h=this.parent.fromOADate(s));var d=parseInt(o,10);return d<0?this.parent.getErrorStrings()[e.CommonErrors.num]:(0===d&&o!==i&&i.indexOf("h:mm")>-1&&(h=this.parent.fromOADate(parseInt(a,10))),"Invalid Date"===h.toString()&&(this.parent.isNumber(o)?h=this.parent.fromOADate(parseInt(o,10)):this.parent.checkDateFormat(o)),"Invalid Date"===h.toString()?this.parent.getErrorStrings()[e.CommonErrors.value]:("Invalid Date"!==h.toString()&&(l=h.getMonth()+1),l.toString()))},n.prototype.ComputeNOW=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];if(1!==r.length||""!==r[0])return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_arguments];var i=new Date(Date.now()),a=(new t.Internationalization).getDateFormat({format:"M/d/yyyy h:mm:ss a"});return this.parent.parentObject.dateToInt(a(i),!0).toString()},n.prototype.ComputeEXACT=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var i,a=!1;if(r.length&&"nestedFormulaTrue"===r[r.length-1]&&(i=!0,r.pop()),t.isNullOrUndefined(r)||2!==r.length)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_arguments];var o=this.parent.getValueFromArg(r[0]).split(this.parent.tic).join("");if(this.parent.getErrorStrings().indexOf(o)>-1)return o;var s=this.parent.getValueFromArg(r[1]).split(this.parent.tic).join("");return this.parent.getErrorStrings().indexOf(s)>-1?s:(o===s&&(a=!0),i&&(a=this.parent.tic+a+this.parent.tic),a)},n.prototype.ComputeLEN=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];if(t.isNullOrUndefined(r)||1!==r.length)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_arguments];if(""===r[0])return this.parent.getErrorStrings()[e.CommonErrors.value];var i=this.parent.getValueFromArg(r[0]).split(this.parent.tic).join("");return this.parent.getErrorStrings().indexOf(i)>-1?i:i.length},n.prototype.ComputeMOD=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var i;if(t.isNullOrUndefined(r)||2!==r.length)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_arguments];if(""===r[1]&&!r[0].includes('"'))return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.div];if(""===r[0]&&!r[1].includes('"'))return 0;for(var a=0;a<r.length;a++){var o=r[a].split(this.parent.tic).join("").trim();if(""===o||r[a].indexOf(this.parent.tic)>-1&&isNaN(this.parent.parseFloat(o)))return this.parent.getErrorStrings()[e.CommonErrors.value];if(U(r[a])){if(i=this.parent.getValueFromArg(r[a])||"0",(i=i===this.parent.trueValue?"1":i===this.parent.falseValue?"0":i).toUpperCase().match(/[A-Z]/)||i.includes('"')||!this.parent.isNumber(i))return this.parent.getErrorStrings()[e.CommonErrors.value]}else if(i=this.parent.getValueFromArg(r[a].split(this.parent.tic).join("")),i=i===this.parent.trueValue?"1":i===this.parent.falseValue?"0":i,this.parent.getErrorStrings().indexOf(i)>-1)return i;r[a]=i}var s=r[0],l=r[1];if("0"===l||""===l)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.div];if("0"===s||""===s)return 0;var h=((s=parseFloat(s))%(l=parseFloat(l))+l)%l;return isNaN(h)?this.parent.getErrorStrings()[e.CommonErrors.name]:h},n.prototype.ComputeODD=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];if(t.isNullOrUndefined(r)||1!==r.length||""===r[0])return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_arguments];var i=r[0].split(this.parent.tic).join("").trim();if(""===i||r[0].indexOf(this.parent.tic)>-1&&isNaN(this.parent.parseFloat(i)))return this.parent.getErrorStrings()[e.CommonErrors.value];var a;if(U(r[0])){if((a=this.parent.getValueFromArg(r[0]))===this.parent.trueValue)a="1";else if(""===a||a===this.parent.falseValue)a="0";else if(a.toUpperCase().match(/[A-Z]/)||a.includes('"')||!this.parent.isNumber(a))return this.parent.getErrorStrings()[e.CommonErrors.value]}else{if("#NAME?"===(a=this.parent.getValueFromArg(r[0].split(this.parent.tic).join(""))))return this.parent.getErrorStrings()[e.CommonErrors.name];if(a===this.parent.trueValue)a="1";else if(""===a||a===this.parent.falseValue)a="0";else if(a.toUpperCase().match(/[A-Z]/)||!this.parent.isNumber(a))return this.parent.getErrorStrings()[e.CommonErrors.value]}var o=Math.ceil(parseInt(a,10)),s=0===o;return o=o%2==0?o>0?o+1:o-1:o,Math.ceil(parseInt(a,10))%2!=0&&(parseInt(a,10)>0&&parseFloat(a)>parseInt(a,10)?o+=2:parseInt(a,10)<0&&parseFloat(a)<parseInt(a,10)&&(o-=2)),isNaN(o)?this.parent.getErrorStrings()[e.CommonErrors.name]:s?1:o},n.prototype.ComputeEVEN=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];if(t.isNullOrUndefined(r)||1!==r.length||""===r[0])return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_arguments];var i=r[0].split(this.parent.tic).join("").trim();if(""===i||r[0].indexOf(this.parent.tic)>-1&&isNaN(this.parent.parseFloat(i)))return this.parent.getErrorStrings()[e.CommonErrors.value];var a;if(U(r[0])){if((a=this.parent.getValueFromArg(r[0]))===this.parent.trueValue)a="1";else if(""===a||a===this.parent.falseValue)a="0";else if(a.toUpperCase().match(/[A-Z]/)||a.includes('"')||!this.parent.isNumber(a))return this.parent.getErrorStrings()[e.CommonErrors.value]}else{if("#NAME?"===(a=this.parent.getValueFromArg(r[0].split(this.parent.tic).join(""))))return this.parent.getErrorStrings()[e.CommonErrors.name];if(a===this.parent.trueValue)a="1";else if(""===a||a===this.parent.falseValue)a="0";else if(a.toUpperCase().match(/[A-Z]/)||!this.parent.isNumber(a))return this.parent.getErrorStrings()[e.CommonErrors.value]}var o=Math.ceil(parseInt(a,10));return o=o%2==0?o:o>0?o+1:o-1,Math.ceil(parseInt(a,10))%2==0&&(parseInt(a,10)>0&&parseFloat(a)>parseInt(a,10)?o+=2:parseInt(a,10)<0&&parseFloat(a)<parseInt(a,10)&&(o-=2)),isNaN(o)?this.parent.getErrorStrings()[e.CommonErrors.name]:o},n.prototype.ComputePI=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return t&&""!==t[0]?this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_arguments]:Math.PI},n.prototype.ComputeMEDIAN=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var i,a=[];if(t.isNullOrUndefined(r)||""===r[0]&&1===r.length)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_arguments];for(var o=0;o<r.length;o++)if(this.parent.isCellReference(r[o]))if(r[o].indexOf(":")>-1)for(var s=this.parent.getCellCollection(r[o]),l=0;l<s.length;l++){var h=this.parent.getValueFromArg(s[l]);if(this.parent.getErrorStrings().indexOf(h)>-1)return h;""!==h.trim()&&a.push(this.parent.parseFloat(h))}else{var d=this.parent.getValueFromArg(r[o]);if(this.parent.getErrorStrings().indexOf(d)>-1)return d;""!==d.trim()&&a.push(this.parent.parseFloat(d))}else if(""===r[o]||r[o]===this.parent.falseValue&&!this.parent.isCellReference(r[o]))a.push(0);else if(r[o]!==this.parent.trueValue||this.parent.isCellReference(r[o])){if(r[o].indexOf(this.parent.tic)>-1&&isNaN(parseFloat(r[o].split(this.parent.tic).join(""))))return this.parent.getErrorStrings()[e.CommonErrors.value];var p=this.parent.getValueFromArg(r[o]).split(this.parent.tic).join("");if(this.parent.getErrorStrings().indexOf(p)>-1)return p;a.push(this.parent.parseFloat(p))}else a.push(1);for(var c=(a=a.sort(function(e,t){return e-t})).length,u=0;u<c&&(!isNaN(a[u])||(a.splice(u,1),c=a.length,u--,0!==a.length));u++);if(a.length%2==0||isNaN(a[parseInt((a.length/2).toString(),10)])){if(isNaN(a[a.length/2])||isNaN(a[a.length/2-1]))return this.parent.getErrorStrings()[e.CommonErrors.num];i=(a[a.length/2]+a[a.length/2-1])/2}else i=a[parseInt((a.length/2).toString(),10)];return i},n.prototype.ComputeEDATE=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];if(2!==r.length||t.isNullOrUndefined(r))return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_arguments];if(""===r[0]||""===r[1])return this.parent.getErrorStrings()[e.CommonErrors.na];if(""===r[0].split(this.parent.tic).join("")||""===r[1].split(this.parent.tic).join("")||r[1].indexOf(this.parent.tic)>-1&&isNaN(this.parent.parseFloat(r[1].split(this.parent.tic).join(""))))return this.parent.getErrorStrings()[e.CommonErrors.value];var i,a;if(this.parent.isCellReference(r[0])){if(r[0].indexOf(":")>-1)return this.parent.getErrorStrings()[e.CommonErrors.value];if((i=this.parent.getValueFromArg(r[0].split(this.parent.tic).join(""))||"0").indexOf(this.parent.tic)>-1)return this.parent.getErrorStrings()[e.CommonErrors.value]}else i=this.parent.getValueFromArg(r[0].split(this.parent.tic).join(""));if(this.parent.isCellReference(r[1])){if(r[1].indexOf(":")>-1)return this.parent.getErrorStrings()[e.CommonErrors.value];a=this.parent.getValueFromArg(r[1].split(this.parent.tic).join(""))||"0"}else a=this.parent.getValueFromArg(r[1].split(this.parent.tic).join(""));if(this.parent.getErrorStrings().indexOf(a)>-1)return a;a=parseInt(a,10);var o;if(this.parent.isNumber(i)){if((i=parseInt(i,10))<0||i>2958465)return this.parent.getErrorStrings()[e.CommonErrors.num];o=this.parent.fromOADate(i)}else o=this.parent.checkDateFormat(i);if(isNaN(a)||t.isNullOrUndefined(this.parent.isDate(o))||o.getFullYear()>9999)return this.parent.getErrorStrings()[e.CommonErrors.value];var s=o.getDate();o.setMonth(o.getMonth()+a),s!==o.getDate()&&o.setDate(0);var l=this.parent.parentObject.dateToInt(o);return"0"===i.toString()&&(l-=1),l<0||l>2958465?this.parent.getErrorStrings()[e.CommonErrors.num]:l.toString()},n.prototype.ComputeEOMONTH=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];if(2!==r.length||t.isNullOrUndefined(r))return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_arguments];if(""===r[0]||""===r[1])return this.parent.getErrorStrings()[e.CommonErrors.na];if(""===r[0].split(this.parent.tic).join("")||""===r[1].split(this.parent.tic).join("")||r[1].indexOf(this.parent.tic)>-1&&isNaN(this.parent.parseFloat(r[1].split(this.parent.tic).join(""))))return this.parent.getErrorStrings()[e.CommonErrors.value];var i,a;if(this.parent.isCellReference(r[0])){if(r[0].indexOf(":")>-1)return this.parent.getErrorStrings()[e.CommonErrors.value];if((i=this.parent.getValueFromArg(r[0].split(this.parent.tic).join(""))||"0").indexOf(this.parent.tic)>-1)return this.parent.getErrorStrings()[e.CommonErrors.value]}else i=this.parent.getValueFromArg(r[0]).split(this.parent.tic).join("");if(this.parent.getErrorStrings().indexOf(i)>-1)return i;if(this.parent.isCellReference(r[1])){if(r[1].indexOf(":")>-1)return this.parent.getErrorStrings()[e.CommonErrors.value];a=this.parent.getValueFromArg(r[1].split(this.parent.tic).join(""))||"0"}else a=this.parent.getValueFromArg(r[1].split(this.parent.tic).join(""));if(this.parent.getErrorStrings().indexOf(a)>-1)return a;a=parseInt(a,10);var o;if(this.parent.isNumber(i)){if((i=parseInt(i,10))<0||i>2958465)return this.parent.getErrorStrings()[e.CommonErrors.num];o=this.parent.fromOADate(i)}else o=this.parent.checkDateFormat(i);if(isNaN(a)||t.isNullOrUndefined(this.parent.isDate(o))||o.getFullYear()>9999)return this.parent.getErrorStrings()[e.CommonErrors.value];o=new Date(o.getFullYear(),o.getMonth()+(a+1),0);var s=this.parent.parentObject.dateToInt(o);return s<0||s>2958465||o.getFullYear()<1900?this.parent.getErrorStrings()[e.CommonErrors.num]:s.toString()},n.prototype.ComputeDATEVALUE=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var i;if(1!==r.length||t.isNullOrUndefined(r))return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_arguments];if(""===r[0]||this.parent.isCellReference(r[0]))return this.parent.getErrorStrings()[e.CommonErrors.value];if(-1===r[0].indexOf(this.parent.tic))return this.parent.getErrorStrings()[e.CommonErrors.value];i=this.parent.getValueFromArg(r[0]).split(this.parent.tic).join("");var a=this.parent.isNumber(i)?this.parent.fromOADate(parseInt(i,10)):this.parent.checkDateFormat(i);return!a||t.isNullOrUndefined(this.parent.isDate(a))||"Invalid Date"===a.toString()||a.getFullYear()<1900||a.getFullYear()>9999?this.parent.getErrorStrings()[e.CommonErrors.value]:parseFloat(i).toFixed(0).toString()},n.prototype.ComputeCOUNTBLANK=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var i=0;if(1!==r.length||t.isNullOrUndefined(r)||!this.parent.isCellReference(r[0]))return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_arguments];if(""===r[0])return this.parent.getErrorStrings()[e.CommonErrors.value];for(var a=this.parent.getCellCollection(r[0]),o=0;o<a.length;o++)""===this.parent.getValueFromArg(a[o])&&i++;return i},n.prototype.ComputeFACT=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var i=1;if(t.isNullOrUndefined(r)||1!==r.length)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_arguments];if(""===r[0])return this.parent.getErrorStrings()[e.CommonErrors.value];var a=parseInt(this.parent.getValueFromArg(r[0]).split(this.parent.tic).join(""),10);if(this.parent.getValueFromArg(r[0]).split(this.parent.tic).join("").toUpperCase().match(/[A-Z]/))return this.parent.getErrorStrings()[e.CommonErrors.value];if(a<0)return this.parent.getErrorStrings()[e.CommonErrors.num];for(var o=1;o<=a;o++)i*=o;return i},n.prototype.ComputeDECIMAL=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var i;if(t.isNullOrUndefined(r)||2!==r.length)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_arguments];if(r[0].match(/[@#$%^&*()?:{}|<>+-]/g))return this.parent.getErrorStrings()[e.CommonErrors.num];if(r[1].indexOf(this.parent.tic)>-1&&isNaN(this.parent.parseFloat(r[1].split(this.parent.tic).join(""))))return this.parent.getErrorStrings()[e.CommonErrors.value];var a=void 0,o=void 0;a=this.parent.isCellReference(r[0].toString())?this.parent.getValueFromArg(r[0]):this.parent.getValueFromArg(r[0]).split(this.parent.tic).join(""),o=this.parent.isCellReference(r[1].toString())?this.parent.getValueFromArg(r[1]):this.parent.getValueFromArg(r[1]).split(this.parent.tic).join("");var s=parseInt(a,10),l=parseInt(o,10);return this.parent.getErrorStrings().indexOf(a)>-1?a:this.parent.getErrorStrings().indexOf(o)>-1?o:""===a&&""!==o?0:""===a||s<0||!isNaN(s)&&!Number.isInteger(parseFloat(a))?this.parent.getErrorStrings()[e.CommonErrors.num]:""===o||l<2||l>36||isNaN(l)?this.parent.getErrorStrings()[e.CommonErrors.num]:isNaN(this.parent.parseFloat(a))&&this.parent.parseFloat(o)<=10?this.parent.getErrorStrings()[e.CommonErrors.num]:(i=parseInt(a,parseInt(o,10)),isNaN(i)?this.parent.getErrorStrings()[e.CommonErrors.num]:i)},n.prototype.ComputeDEGREES=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var i;if(t.isNullOrUndefined(r)||1!==r.length||""===r[0])return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_arguments];var a=Math.PI,o=this.parent.getValueFromArg(r[0]).split(this.parent.tic).join("");return o.toUpperCase().match(/[A-Z]/)?this.parent.getErrorStrings()[e.CommonErrors.value]:isNaN(parseInt(o,10))?this.parent.getErrorStrings()[e.CommonErrors.value]:(i=parseFloat(o)*(180/a),parseInt(i.toString(),10))},n.prototype.ComputeADDRESS=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var i;if(t.isNullOrUndefined(r)||r.length>5||""===r[0]||""===r[1]||r.length<2)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_arguments];r[2]=r[2]?r[2]:"1",r[3]=r[3]?r[3]:"TRUE";var a=this.parent.getValueFromArg(r[0]),o=this.parent.getValueFromArg(r[1]),s=this.parent.getValueFromArg(r[2]),l=this.parent.getValueFromArg(r[3]);if(s=s.split(this.parent.tic).join(""),l=l.split(this.parent.tic).join(""),a=a.split(this.parent.tic).join(""),o=o.split(this.parent.tic).join(""),parseInt(a,10)<=0||parseInt(o,10)<=0)return this.parent.getErrorStrings()[e.CommonErrors.value];if(a.toUpperCase().match(/[A-Z]/)||o.toUpperCase().match(/[A-Z]/)||s.toUpperCase().match(/[A-Z]/))return this.parent.getErrorStrings()[e.CommonErrors.value];"TRUE"===l||"1"===l?"1"===s?i="$"+Be(parseInt(o,10))+"$"+parseInt(a,10):"2"===s?i=Be(parseInt(o,10))+"$"+parseInt(a,10):"3"===s?i="$"+Be(parseInt(o,10))+parseInt(a,10):"4"===s&&(i=Be(parseInt(o,10))+parseInt(a,10)):"FALSE"!==l&&"0"!==l||("1"===s?i="R"+parseInt(a,10)+"C"+parseInt(o,10):"2"===s?i="R"+parseInt(a,10)+"C["+parseInt(o,10)+"]":"3"===s?i="R["+parseInt(a,10)+"]C"+parseInt(o,10):"4"===s&&(i="R["+parseInt(a,10)+"]C["+parseInt(o,10)+"]"));if(-1===["TRUE","FALSE","1","0"].indexOf(l))return this.parent.getErrorStrings()[e.CommonErrors.name];if(!t.isNullOrUndefined(r[4])&&""!==r[4]){var h=this.parent.getValueFromArg(r[4]).split(this.parent.tic).join("");if("#NAME?"===h)return this.parent.getErrorStrings()[e.CommonErrors.name];i=h+"!"+i}return i},n.prototype.ComputeTIME=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var i;if(t.isNullOrUndefined(r)||3!==r.length)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_arguments];if(r[0].indexOf(this.parent.tic)>-1&&""===r[0].split(this.parent.tic).join("").trim())return this.parent.getErrorStrings()[e.CommonErrors.value];if(r[1].indexOf(this.parent.tic)>-1&&""===r[1].split(this.parent.tic).join("").trim())return this.parent.getErrorStrings()[e.CommonErrors.value];if(r[2].indexOf(this.parent.tic)>-1&&""===r[2].split(this.parent.tic).join("").trim())return this.parent.getErrorStrings()[e.CommonErrors.value];var a,o,s;if(this.parent.isCellReference(r[0])){if((a=this.parent.getValueFromArg(r[0].split(this.parent.tic).join(""))||"0").indexOf(this.parent.tic)>-1)return this.parent.getErrorStrings()[e.CommonErrors.value]}else{if(r[0].indexOf(this.parent.tic)>-1&&(r[0].split(this.parent.tic).join("")===this.parent.trueValue||r[0].split(this.parent.tic).join("")===this.parent.falseValue))return this.parent.getErrorStrings()[e.CommonErrors.value];a=this.parent.getValueFromArg(r[0]).split(this.parent.tic).join("")||"0"}if(this.parent.getErrorStrings().indexOf(a)>-1)return a;if(isNaN(this.parent.parseFloat(a))&&a!==this.parent.trueValue&&a!==this.parent.falseValue)return this.parent.getErrorStrings()[e.CommonErrors.value];if(this.parent.isCellReference(r[1])){if((o=this.parent.getValueFromArg(r[1].split(this.parent.tic).join(""))||"0").indexOf(this.parent.tic)>-1)return this.parent.getErrorStrings()[e.CommonErrors.value]}else{if(r[1].indexOf(this.parent.tic)>-1&&(r[1].split(this.parent.tic).join("")===this.parent.trueValue||r[1].split(this.parent.tic).join("")===this.parent.falseValue))return this.parent.getErrorStrings()[e.CommonErrors.value];o=this.parent.getValueFromArg(r[1]).split(this.parent.tic).join("")||"0"}if(this.parent.getErrorStrings().indexOf(o)>-1)return o;if(isNaN(this.parent.parseFloat(o))&&o!==this.parent.trueValue&&o!==this.parent.falseValue)return this.parent.getErrorStrings()[e.CommonErrors.value];if(this.parent.isCellReference(r[2])){if((s=this.parent.getValueFromArg(r[2].split(this.parent.tic).join(""))||"0").indexOf(this.parent.tic)>-1)return this.parent.getErrorStrings()[e.CommonErrors.value]}else{if(r[2].indexOf(this.parent.tic)>-1&&(r[2].split(this.parent.tic).join("")===this.parent.trueValue||r[2].split(this.parent.tic).join("")===this.parent.falseValue))return this.parent.getErrorStrings()[e.CommonErrors.value];s=this.parent.getValueFromArg(r[2]).split(this.parent.tic).join("")||"0"}if(this.parent.getErrorStrings().indexOf(s)>-1)return s;if(isNaN(this.parent.parseFloat(s))&&s!==this.parent.trueValue&&s!==this.parent.falseValue)return this.parent.getErrorStrings()[e.CommonErrors.value];if(a=a===this.parent.trueValue?"1":a===this.parent.falseValue?"0":a,o=o===this.parent.trueValue?"1":o===this.parent.falseValue?"0":o,s=s===this.parent.trueValue?"1":s===this.parent.falseValue?"0":s,a=parseInt(this.parent.parseFloat(a).toString(),10),o=parseInt(this.parent.parseFloat(o).toString(),10),s=parseInt(this.parent.parseFloat(s).toString(),10),isNaN(a)||isNaN(o)||isNaN(s))return this.parent.getErrorStrings()[e.CommonErrors.value];if(a>32767||o>32767||s>32767)return this.parent.getErrorStrings()[e.CommonErrors.num];var l=new Date(1900,0,1,a,o,s);if(l.getFullYear()<1900)return this.parent.getErrorStrings()[e.CommonErrors.num];var h=l.getHours(),d=l.getMinutes(),p=l.getSeconds(),c="AM",u=h;u>=12&&(u=h-12,c="PM"),0===u&&(u=12),d=d<10?"0"+d:d,p=p<10?"0"+p:p;var f={value:(i=(u=u<10?"0"+u:u)+":"+d+":"+p+" "+c).toString()};return this.parent.parentObject.notify(Wr,f),f.isTime&&(i=f.updatedVal),i},n.prototype.ComputeCHAR=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];if(t.isNullOrUndefined(r)||1!==r.length||""===r[0])return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_arguments];var i=this.parent.getValueFromArg(r[0]).split(this.parent.tic).join("");if("#NAME?"===i)return this.parent.getErrorStrings()[e.CommonErrors.name];if(!i.toUpperCase().match(/^[0-9]+$/))return this.parent.getErrorStrings()[e.CommonErrors.value];var a=parseInt(i,10);return a>255||a<=0?this.parent.getErrorStrings()[e.CommonErrors.value]:String.fromCharCode(a)},n.prototype.ComputeCODE=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];if(t.isNullOrUndefined(r)||1!==r.length||""===r[0])return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_arguments];var i=this.parent.getValueFromArg(r[0]).split(this.parent.tic).join("");return this.parent.getErrorStrings().indexOf(i)>-1?i:""===i?this.parent.getErrorStrings()[e.CommonErrors.value]:i.charCodeAt(0)},n.prototype.ComputeDOLLAR=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var i,a,o;if(r.length&&"nestedFormulaTrue"===r[r.length-1]&&(o=!0,r.pop()),1===r.length&&(""===r[0]&&(a=!0),r.push("2")),t.isNullOrUndefined(r)||2!==r.length||a)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_arguments];for(var s=0;s<r.length;s++)if(r[s].indexOf(this.parent.tic)>-1&&isNaN(this.parent.parseFloat(r[s])))return this.parent.getErrorStrings()[e.CommonErrors.value];var l=this.parent.getValueFromArg(r[0]).split(this.parent.tic).join(""),h=this.parent.getValueFromArg(r[1]).split(this.parent.tic).join("");if(l=""===l||l===this.parent.falseValue?"0":l===this.parent.trueValue?"1":l,h=""===h||h===this.parent.falseValue?"0":h===this.parent.trueValue?"1":h,"#NAME?"===l||"#NAME?"===h)return this.parent.getErrorStrings()[e.CommonErrors.name];if(!l.toUpperCase().match(/^[-]?[0-9.]+$/)||!h.toUpperCase().match(/^[-]?[0-9.]+$/))return this.parent.getErrorStrings()[e.CommonErrors.value];for(var d=new t.Internationalization,p=parseInt(h,10),c=Math.pow(10,-1*p),u="",f=1;f<=p;f++)u+="0";var g=Math.round(this.parent.parseFloat(l)/c)*c;return i=isNaN(g)?this.parent.getErrorStrings()[e.CommonErrors.value]:d.formatNumber(g,{format:"$#,##0."+u+";($#,##0."+u+");$0."+u}),o&&(i=this.parent.tic+i+this.parent.tic),i},n.prototype.ComputeSMALL=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];if(t.isNullOrUndefined(r)||""===r[0]||2!==r.length)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_arguments];for(var i=this.parent.getCellCollection(r[0]),a=[],o=0;o<i.length;o++)a.push(parseFloat(this.parent.getValueFromArg(i[o]).split(this.parent.tic).join("")));for(var s=(a=a.sort(function(e,t){return e-t})).length,l=0;l<s&&(!isNaN(a[l])||(a.splice(l,1),s=a.length,l--,0!==a.length));l++);var h=this.parent.getValueFromArg(r[1]).split(this.parent.tic).join("");return"#NAME?"===h?this.parent.getErrorStrings()[e.CommonErrors.name]:(h=parseInt(h,10)).toString().toUpperCase().match(/^[0-9]+$/)&&a[h-1]&&a[h-1].toString().toUpperCase().match(/^[-.0-9]+$/)&&0!==h?a[h-1]:t.isNullOrUndefined(a[h-1])?this.parent.getErrorStrings()[e.CommonErrors.num]:this.parent.getErrorStrings()[e.CommonErrors.value]},n.prototype.ComputeLARGE=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];if(t.isNullOrUndefined(r)||2!==r.length||""===r[0])return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_arguments];for(var i=this.parent.getCellCollection(r[0]),a=[],o=0;o<i.length;o++)a.push(parseFloat(this.parent.getValueFromArg(i[o]).split(this.parent.tic).join("")));a=a.sort(function(e,t){return t-e});for(var s=0;s<a.length&&(!isNaN(a[s])||(a.splice(s,1),s--,0!==a.length));s++);var l=this.parent.getValueFromArg(r[1]).split(this.parent.tic).join("");return"#NAME?"===l?this.parent.getErrorStrings()[e.CommonErrors.name]:(l=parseInt(l,10)).toString().toUpperCase().match(/^[0-9]+$/)&&a[l-1]&&a[l-1].toString().toUpperCase().match(/^[-.0-9]+$/)&&0!==l?a[l-1]:t.isNullOrUndefined(a[l-1])?this.parent.getErrorStrings()[e.CommonErrors.num]:this.parent.getErrorStrings()[e.CommonErrors.value]},n.prototype.ComputeCHOOSE=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];if(t.isNullOrUndefined(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_arguments];if(r.length<2)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];var i=r;if(i[0].indexOf(":")>-1&&this.parent.isCellReference(i[0])){if(1!==(l=this.parent.getCellCollection(i[0])).length)return this.parent.getErrorStrings()[e.CommonErrors.value];i[0]=l[0]}var a=this.parent.getValueFromArg(i[0]);if(this.parent.getErrorStrings().indexOf(a)>-1)return a;var o=this.parent.parseFloat(this.parent.getValueFromArg(i[0].split(this.parent.tic).join("")));if(o<1)return this.parent.getErrorStrings()[e.CommonErrors.value];o=Math.floor(o);var s;if(t.isNullOrUndefined(i[o]))return this.parent.getErrorStrings()[e.CommonErrors.value];if(""===(s=i[o])&&(s="0"),s.indexOf(":")>-1&&this.parent.isCellReference(s)){var l;if(1!==(l=this.parent.getCellCollection(i[0].split(this.parent.tic).join(""))).length)return this.parent.getErrorStrings()[e.CommonErrors.value];i[0]=l[0]}return this.parent.getValueFromArg(s).split(this.parent.tic).join("")},n.prototype.ComputeSUMIF=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=t;if(n[0].indexOf(":")<0&&!this.parent.isCellReference(n[0])||n[2]&&n[2].indexOf(":")<0&&!this.parent.isCellReference(n[2]))return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.improper_formula];if(n.length>3||n.length<2)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];var i=this.parent.computeSumIfAndAvgIf(t,!1);return"string"==typeof i&&(this.parent.formulaErrorStrings.indexOf(i)||this.parent.getErrorStrings().indexOf(i))?i:i[0]},n.prototype.ComputeABS=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n,i=t,a="";if(0===t.length||t.length>1)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];if(""===i[0])return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_arguments];var o=i[0].split(this.parent.tic).join("").trim();if(""===o||i[0].indexOf(this.parent.tic)>-1&&isNaN(this.parent.parseFloat(o)))return this.parent.getErrorStrings()[e.CommonErrors.value];if(this.parent.isCellReference(i[0])){if(a=this.parent.getValueFromArg(i[0]),this.parent.getErrorStrings().indexOf(a)>-1)return this.parent.getErrorStrings()[e.CommonErrors.value];if(a===this.parent.trueValue&&(a="1"),""!==a&&a!==this.parent.falseValue||(a="0"),n=this.parent.parseFloat(a),isNaN(n)&&!this.parent.isNumber(a))return this.parent.getErrorStrings()[e.CommonErrors.value]}else{if((a=this.parent.getValueFromArg(i[0]).split(this.parent.tic).join())===this.parent.trueValue&&(a="1"),a===this.parent.falseValue&&(a="0"),this.parent.getErrorStrings().indexOf(a)>-1)return a;if(n=this.parent.parseFloat(a),isNaN(n)&&!this.parent.isNumber(a))return this.parent.getErrorStrings()[e.CommonErrors.value]}return Math.abs(n)},n.prototype.ComputeAVERAGE=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var i=!1;if(r.length&&"isSubtotal"===r[r.length-1]&&(i=!0,r.pop()),t.isNullOrUndefined(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_arguments];for(var a=r,o=0;o<a.length;o++)if(a[o].indexOf(":")>-1&&a[o].indexOf(this.parent.tic)>-1)return this.parent.getErrorStrings()[e.CommonErrors.value];return this.parent.calculateAvg(a,i)},n.prototype.ComputeAVERAGEIF=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=t;if(n[0].indexOf(":")<0&&!this.parent.isCellReference(n[0]))return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.improper_formula];var i=this.parent.computeSumIfAndAvgIf(t,!0);return 0===i[1]||"NaN"===i[0].toString()?this.parent.formulaErrorStrings[e.FormulasErrorsStrings.div]:"string"==typeof i&&(this.parent.formulaErrorStrings.indexOf(i)||this.parent.getErrorStrings().indexOf(i))?i:this.parent.parseFloat(i[0])/this.parent.parseFloat(i[1])},n.prototype.ComputeCONCATENATE=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];if(t.isNullOrUndefined(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_arguments];for(var i=r,a="",o="",s=0;s<i.length;s++){if(i[s].indexOf(":")>-1&&this.parent.isCellReference(i[s])){if(!this.isConcat)return this.parent.getErrorStrings()[e.CommonErrors.value];for(var l=this.parent.getCellCollection(i[s]),h=0;h<l.length;h++)a+=o=this.parent.getValueFromArg(l[h])}else{if(1===i.length&&i[0].indexOf(this.parent.tic)<0)return this.parent.getErrorStrings()[e.CommonErrors.name];a+=o=this.parent.getValueFromArg(i[s])}if(this.parent.getErrorStrings().indexOf(o)>-1)return o}return a.split(this.parent.tic).join("")},n.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)},n.prototype.ComputeMAX=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this.parent.computeMinMax(e,"max")},n.prototype.ComputeMIN=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this.parent.computeMinMax(e,"min")},n.prototype.ComputeRAND=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return 1===t.length&&""===t[0]&&(t.length=0),t.length>0?this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments]:Math.random().toString()},n.prototype.ComputeAND=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var i=r;return t.isNullOrUndefined(r)||1===i.length&&""===i[0]?this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_arguments]:this.parent.computeAndOrNot(i,"and")},n.prototype.ComputeOR=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var i=r;return t.isNullOrUndefined(r)||1===i.length&&""===i[0]?this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_arguments]:this.parent.computeAndOrNot(i,"or")},n.prototype.ComputeNOT=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var i=r;return t.isNullOrUndefined(r)||r.length>1||""===r[0]?this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments]:this.parent.computeAndOrNot(i,"not")},n.prototype.ComputeFIND=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];if(t.isNullOrUndefined(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];var i=r;if(i.length>3)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];var a=this.parent.removeTics(this.parent.getValueFromArg(i[0]));if(this.parent.getErrorStrings().indexOf(a)>-1)return a;var o=this.parent.removeTics(this.parent.getValueFromArg(i[1]));if(this.parent.getErrorStrings().indexOf(o)>-1)return o;var s=1;if(3===i.length){if(s=this.parent.removeTics(this.parent.getValueFromArg(i[2])),this.parent.getErrorStrings().indexOf(s)>-1)return s;s=this.parent.parseFloat(s),isNaN(s)&&(s=1)}if(s<=0||s>o.length)return this.parent.getErrorStrings()[e.CommonErrors.value];var l=o.indexOf(a,s-1);return l<0?this.parent.getErrorStrings()[e.CommonErrors.value]:(Number(l)+Number(1)).toString()},n.prototype.ComputeINDEX=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var i,a=r;a.length&&"nestedFormulaTrue"===a[a.length-1]&&(i=!0,a.pop());var o=a.length;if(t.isNullOrUndefined(r)||1===a.length&&""===a[0])return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];if(o>3)return this.parent.getErrorStrings()[e.CommonErrors.ref];var s="",l=[];if(o>2)for(var h=0;h<o;h++){if(this.parent.isCellReference(a[h])&&a[h].indexOf(":")<0){var d=this.parent.getValueFromArg(a[h]);if(this.parent.getErrorStrings().indexOf(d)>-1)return this.parent.getErrorStrings()[e.CommonErrors.ref];l[h]=d}this.parent.isCellReference(a[h])&&(l[h]=a[h])}if(s=a[0],a[1]=""===a[1]?"1":a[1],a[1]=this.parent.getValueFromArg(a[1]),this.parent.getErrorStrings().indexOf(a[1])>-1)return a[1];if(!t.isNullOrUndefined(a[2])){if(a[2]=""===a[2]?"1":a[2],a[2]=this.parent.getValueFromArg(a[2]),this.parent.getErrorStrings().indexOf(a[2])>-1)return a[2];if("0"===a[2])return this.parent.getErrorStrings()[e.CommonErrors.value]}var p=parseFloat(a[1]);p=isNaN(p)?-1:p;var c=parseFloat(a[2]?a[2]:"1");if(c=isNaN(c)?-1:c,-1===p||-1===c)return this.parent.getErrorStrings()[e.CommonErrors.value];var u=a[0].indexOf(":"),f=this.parent.rowIndex(s.substring(0,u)),g=this.parent.rowIndex(s.substring(u+1)),m=this.parent.colIndex(s.substring(0,u)),v=this.parent.colIndex(s.substring(u+1));if(p>g-f+1||c>v-m+1)return this.parent.getErrorStrings()[e.CommonErrors.ref];p=f+p-1,c=m+c-1;var y=this.getSheetReference(s)+this.parent.convertAlpha(c)+p,C=this.parent.getValueFromArg(y);return""===C?0:i&&!D(C)&&C!==this.parent.trueValue&&C!==this.parent.falseValue&&-1===this.parent.getErrorStrings().indexOf(C)?'"'+C+'"':C},n.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):""},n.prototype.ComputeIFS=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var i=r;if(t.isNullOrUndefined(r)||1===i.length&&""===i[0]||i.length%2!=0)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];for(var a="",o="",s=0;s<i.length;s++){if(a=this.parent.getValueFromArg(i[s]),""===i[s])return this.parent.getErrorStrings()[e.CommonErrors.na];if(this.parent.getErrorStrings().indexOf(a)>-1)return a;if(a!==this.parent.trueValue&&a!==this.parent.falseValue)return this.parent.getErrorStrings()[e.CommonErrors.value];if(a===this.parent.trueValue)return this.parent.isCellReference(i[s+1].split(this.parent.tic).join(""))||i[s+1].includes(this.parent.arithMarker)?o=""===(o=this.parent.getValueFromArg(i[s+1]))?"0":o:(o=""===i[s+1]?"0":this.parent.getValueFromArg(i[s+1])).indexOf(this.parent.tic)>-1&&(o=o.split(this.parent.tic).join("")),s+=1,o;a===this.parent.falseValue&&(s+=1)}return this.parent.getErrorStrings()[e.CommonErrors.na]},n.prototype.ComputeCOUNTA=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var i=!1;if(r.length&&"isSubtotal"===r[r.length-1]&&(i=!0,r.pop()),t.isNullOrUndefined(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];for(var a,o,s,l=r,h=0,d=0;d<l.length;d++)if(this.parent.isCellReference(l[d]))if(l[d].indexOf(":")>-1){a=this.parent.getCellCollection(l[d].split(this.parent.tic).join(""));for(var p=0;p<a.length;p++)o=i?this.parent.getValueFromArg(a[p],null,null,!0):this.parent.getValueFromArg(a[p]),i&&o.includes("SUBTOTAL(")||o.length>0&&h++}else{if(o=i?this.parent.getValueFromArg(l[d],null,null,!0):this.parent.getValueFromArg(l[d]),i&&o.includes("SUBTOTAL("))continue;o.length>0&&h++}else(s=this.parent.getValueFromArg(l[d]).split(this.parent.tic).join("")).length>0?h++:0===s.length&&""===s.trim()&&h++;return h},n.prototype.ComputeAVERAGEA=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];if(t.isNullOrUndefined(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];for(var i,a,o,s,l=r,h=0,d=0,p=0;p<l.length;p++)if(this.parent.isCellReference(l[p]))if(l[p].indexOf(":")>-1){i=this.parent.getCellCollection(l[p].split(this.parent.tic).join(""));for(var c=0;c<i.length;c++){if(a=this.parent.getValueFromArg(i[c]),a=this.processLogicalCellValue(a),this.parent.getErrorStrings().indexOf(a)>-1)return a;t.isNullOrUndefined(a)||""===a||(s=this.parent.parseFloat(a),h+=a=isNaN(s)?0:s,d+=1)}}else{if(a=this.parent.getValueFromArg(l[p]),a=this.processLogicalCellValue(a),this.parent.getErrorStrings().indexOf(a)>-1)return a;if(t.isNullOrUndefined(a)||""===a)continue;s=this.parent.parseFloat(a),h+=a=isNaN(s)?0:s,d+=1}else{if(l[p].indexOf(this.parent.tic)>-1&&(isNaN(this.parent.parseFloat(l[p].split(this.parent.tic).join("")))||""===l[p].split(this.parent.tic).join("").trim()))return this.parent.getErrorStrings()[e.CommonErrors.value];if(l[p]=this.processLogicalCellValue(l[p]),o=this.parent.getValueFromArg(l[p].split(this.parent.tic).join("")),this.parent.getErrorStrings().indexOf(o)>-1)return o;h+=this.parent.parseFloat(o),d+=1}return 0===d?this.parent.getErrorStrings()[e.CommonErrors.divzero]:h/d},n.prototype.processLogicalCellValue=function(e){var t=e;return t.toUpperCase()===this.parent.trueValue?t="1":t.toUpperCase()===this.parent.falseValue&&(t="0"),t},n.prototype.ComputeSORT=function(){for(var n=this,i=[],a=0;a<arguments.length;a++)i[a]=arguments[a];var o,s;i.length&&"nestedFormulaTrue"===i[i.length-1]&&(o=!0,i.pop());var l,h=i,d=[];if(t.isNullOrUndefined(i)||""===i[0]||h.length>4)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];h[1]=h[1]?h[1]:"1",h[2]=h[2]?h[2]:"1",h[3]=h[3]?h[3]:"FALSE",h[0]=h[0].split("$").join("");var p,c=[];if(h[0].indexOf(":")>-1){var u=h[0].split(":");if(this.parent.isCellReference(u[0])&&this.parent.isCellReference(u[1])){var f=h[0].indexOf(":"),g=void 0,m=this.parent.rowIndex(this.parent.substring(h[0],0,f)),v=this.parent.colIndex(this.parent.substring(h[0],0,f)),y=this.parent.rowIndex(this.parent.substring(h[0],f+1,f+h[0].length-f-1)),C=this.parent.colIndex(this.parent.substring(h[0],f+1,f+h[0].length-f-1));if(m>y&&(g=y,y=m,m=g),v>C&&(g=C,C=v,v=g),this.parent.isCellReference(h[3])){if(h[3]=this.parent.getValueFromArg(h[3]).toUpperCase(),h[3]!==this.parent.trueValue&&h[3]!==this.parent.falseValue)if(D(h[3]))h[3]=0===Number(h[3])?this.parent.falseValue:this.parent.trueValue;else{if(""!==h[3])return this.parent.getErrorStrings()[e.CommonErrors.value];h[3]=this.parent.falseValue}}else if(s=h[3].startsWith(this.parent.tic)&&h[3].endsWith(this.parent.tic),h[3]=this.parent.getValueFromArg(h[3]),h[3]=D(h[3])?0===Number(h[3])?this.parent.falseValue:this.parent.trueValue:h[3].split(this.parent.tic).join("").toUpperCase(),h[3]!==this.parent.trueValue&&h[3]!==this.parent.falseValue)return this.parent.getErrorStrings()[s?e.CommonErrors.value:e.CommonErrors.name];if(this.parent.isCellReference(h[2])?(h[2]=this.parent.getValueFromArg(h[2]),h[2]=h[2]===this.parent.trueValue?"1":h[2]):(h[2]=this.parent.getValueFromArg(h[2]),h[2]=h[2]===this.parent.trueValue?"1":h[2].split(this.parent.tic).join("")),h[2]=D(h[2])?Math.floor(Number(h[2])).toString():h[2],"1"!==h[2]&&"-1"!==h[2])return this.parent.getErrorStrings().indexOf(h[2])>-1?this.parent.getErrorStrings()[e.CommonErrors.name]:this.parent.getErrorStrings()[e.CommonErrors.value];var b="1"===h[2]?"Ascending":"Descending";if(this.parent.isCellReference(h[1])){if(h[1]=this.parent.getValueFromArg(h[1]),h[1]=D(h[1])?Math.floor(Number(h[1])).toString():h[1]===this.parent.trueValue?"1":h[1]===this.parent.falseValue?"0":h[1],isNaN(this.parseDouble(h[1]))||(this.parseDouble(h[1])<1||(h[3]===this.parent.trueValue?y-m+1<this.parseDouble(h[1]):C-v+1<this.parseDouble(h[1]))))return this.parent.getErrorStrings()[e.CommonErrors.value]}else if(s=h[1].startsWith(this.parent.tic)&&h[1].endsWith(this.parent.tic),h[1]=this.parent.getValueFromArg(h[1]),h[1]=D(h[1])?Math.floor(Number(h[1])).toString():h[1]===this.parent.trueValue?"1":h[1]===this.parent.falseValue?"0":h[1].split(this.parent.tic).join(""),isNaN(this.parseDouble(h[1]))?s:this.parseDouble(h[1])<1||(h[3]===this.parent.trueValue?y-m+1<this.parseDouble(h[1]):C-v+1<this.parseDouble(h[1])))return this.parent.getErrorStrings()[e.CommonErrors.value];var x="";0===h[0].indexOf("!")&&(x=(x=(x=h[0]).replace("!","")).indexOf("!"),x=h[0].substring(0,x+2)),h[0]=x+Be(v)+m+":"+Be(C)+y,p=this.parent.getCellCollection(h[0]);for(var S=0;S<p.length;S++)c.push(this.parent.getValueFromArg(p[S]));var w=[],I=[],E=[],R=[],k=[],F=C-v+1,A=function(e){e?"TRUE"===e.toUpperCase()||"FALSE"===e.toUpperCase()?(R.push(e),w.push(e)):isNaN(n.parseDouble(e))?(E.push(e),w.push(e)):(I.push(n.parseDouble(e)),w.push(n.parseDouble(e))):""===e&&(k.push(n.parseDouble(e).toString()),w.push(n.parseDouble(e).toString()))};if("TRUE"===h[3])for(S=0;S<F;S++)A(c[S+(this.parseDouble(h[1])-1)*F]);if("FALSE"===h[3])for(S=0;S<c.length;S++)A(c[S*F+this.parseDouble(h[1])-1]);for(var N=I.length>0?r.DataUtil.sort(I,null,r.DataUtil.fnSort(b)):[],O=E.length>0?r.DataUtil.sort(E,null,r.DataUtil.fnSort(b)):[],T=R.length>0?r.DataUtil.sort(R,null,r.DataUtil.fnSort(b)):[],L="Ascending"===b?N.concat(O,T,k):T.concat(O,N,k),P=[],M=0;M<L.length;M++)for(var H=0;H<w.length;H++)JSON.stringify(L[M])===JSON.stringify(w[H])&&-1===P.indexOf(H)&&P.push(H);if("TRUE"===h[3]){for(var B=m,U=0;B<=y;B++,U++){M=0;for(var V=0;M<P.length;M++,V++){var _=this.parent.getValueFromArg(x+Be(P[M]+v)+B);if(o&&""!==_)d.push(_);else{_=""===_?"0":_;G=(G=this.parent.actCell).indexOf("!")>-1?G.split("!")[1]:G;var z=this.parent.rowIndex(G),j=this.parent.colIndex(G);this.parent.parentObject.setValueRowCol(this.parent.getSheetID(this.parent.grid)+1,_,z+U,j+V)}}}l=this.parent.getValueFromArg(x+Be(P[0]+v)+m)}if("FALSE"===h[3]){for(M=0,U=0;M<P.length;M++,U++){var q=v;for(V=0;q<=C;q++,V++){var W=this.parent.getValueFromArg(x+Be(q)+(P[M]+m));if(o&&""!==W)d.push(W);else{W=""===W?"0":W;var G;G=(G=this.parent.actCell).indexOf("!")>-1?G.split("!")[1]:G;j=this.parent.colIndex(G),z=this.parent.rowIndex(G);this.parent.parentObject.setValueRowCol(this.parent.getSheetID(this.parent.grid)+1,W,z+U,j+V)}}}l=this.parent.getValueFromArg(x+Be(v)+(P[0]+m))}}}return o?d.join(","):""===l?"0":l},n.prototype.ComputeCOUNTIF=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var i=r;if(t.isNullOrUndefined(r)||""===r[0]||2!==i.length)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];if(i[0].indexOf(":")<0&&!this.parent.isCellReference(i[0]))return this.parent.getErrorStrings()[e.CommonErrors.name];var a,o,s=0,l=[],h="equal";if(""===i[1])return 0;var d=i[1].startsWith(this.parent.tic)&&i[1].endsWith(this.parent.tic),p=i[1].split(this.parent.tic).join(""),c=p.includes("*"),u="*"===p||"<>*"===p,f=c&&!u?p.replace(/\*/g,"").trim():p,g=!1;if(!d&&this.parent.isCellReference(f)&&(f=this.parent.getValueFromArg(f),g=!0),c&&!u){var m=p.indexOf("*");"*"===p[0]&&(f="*"+f),"*"===p[p.length-1]&&(f+="*"),m>0&&m<p.length-1&&(f=p.substring(0,m)+"*"+p.substring(m+1))}(p=f).startsWith("<=")?(h="lessEq",p=p.substring(2)):p.startsWith(">=")?(h="greaterEq",p=p.substring(2)):p.startsWith("<>")?(h="notEq",p=p.substring(2)):p.startsWith("<")?(h="less",p=p.substring(1)):p.startsWith(">")?(h="greater",p=p.substring(1)):p.startsWith("=")&&(h="equal",p=p.substring(1));var v=p.indexOf("*")>-1||p.indexOf("?")>-1;if((!d&&this.parent.isCellReference(p)&&!g||p.includes(this.parent.arithMarker)||p.includes(this.parent.getParseDecimalSeparator())&&!v)&&(p=this.parent.getValueFromArg(p)),i[0].indexOf(":")>-1&&this.parent.isCellReference(i[0])){a=this.parent.getCellCollection(i[0].split(this.parent.tic).join(""));for(var y=0;y<a.length;y++)o=this.parent.getValueFromArg(a[y]),v&&(o=this.parent.findWildCardValue(p.toLowerCase(),o.toLowerCase())),l.push(o),l.push(p),this.parent.processLogical(l,h)===this.parent.trueValue&&s++}return s},n.prototype.ComputeSUMIFS=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this.calculateIFS(e)},n.prototype.calculateIFS=function(r,n){var i=this;if(t.isNullOrUndefined(r)||""===r[0]||r.length<2||r.length>127)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];if(3===r.length&&r[2].includes(this.parent.tic+this.parent.tic)){var a,o="",s=this.parent.getParseArgumentSeparator();return r[2].split(this.parent.tic+this.parent.tic).forEach(function(e){(e=e.trim().split(i.parent.tic).join(""))&&(a=i.parent.computeIfsFormulas([r[0],r[1],e],i.parent.falseValue,n).toString(),o+=(o?s:"")+a)}),o}return this.parent.computeIfsFormulas(r,this.parent.falseValue,n)},n.prototype.ComputeTEXT=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var i=r.length,a=r[0],o=r[1];if(2!==i)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];var s=a,l=o;if(""===o)return this.parent.getValueFromArg(s);var h=new Date(1900,0,1,0,0,0),d=s+","+l,p=new t.Internationalization;if(this.parent.getErrorStrings().indexOf(d)>-1)return d;if(s=this.parent.getValueFromArg(s),D(s.split(this.parent.tic).join(""))&&(s=s.split(this.parent.tic).join("")),""===(l=o.startsWith('"')&&o.endsWith('"')?l.split(this.parent.tic).join(""):this.parent.getValueFromArg(l)))return"";""===s&&(l.length>0&&(l.toUpperCase().indexOf("M")>-1||l.toUpperCase().indexOf("D")>-1||l.toUpperCase().indexOf("Y")>-1||l.toUpperCase().indexOf("S")>-1||l.toUpperCase().indexOf("T")>-1)||l.toUpperCase().indexOf("H")>-1)&&(s=h.toString());var c=this.parseDouble(s);if(isNaN(c)&&null!==this.parent.isDate(new Date(s))&&(c=this.parent.toOADate(new Date(s))),h=Date.parse(s.split(this.parent.tic).join("")),!isNaN(c)||!isNaN(h))if(l.length>0&&-1===l.indexOf("#")&&(l.toUpperCase().indexOf("M")>-1||l.toUpperCase().indexOf("D")>-1||l.toUpperCase().indexOf("Y")>-1||l.toUpperCase().indexOf("S")>-1||l.toUpperCase().indexOf("T")>-1)||l.toUpperCase().indexOf("H")>-1){var u=(l=(l=l.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(""),f=!1,g=!1,m=0,v=0,y=0;for(m=0;m<u.length;){var C=u[m];"s"===C&&"M"===u[v]&&(u[v]="m","M"===u[v-1]&&(u[v-1]="m")),this.parent.isChar(C)?(v=m,"M"===C&&y++):y>1&&y++,"M"===C&&f&&(u[m]="m",g=!0),"h"===C?f=!0:this.parent.isChar(C)&&"M"!==C&&"h"!==C&&!g&&(f=!1,g=!1),m++}l=(l=String(u)).split(",").join("").split("\n").join(" ");var b=this.parent.fromOADate(c);0===c&&(b=h);var x=De(l);if(""===x){var S=O(b);return this.parent.parentObject.getDisplayText({format:l,value:S})}s=p.getDateFormat({skeleton:x,type:"date"})(new Date(b.toString()))}else s=this.parent.parentObject.getDisplayText({format:l,value:c});return s},n.prototype.ComputeCOUNTIFS=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this.parent.computeIfsFormulas(e,this.parent.trueValue)},n.prototype.ComputeAVERAGEIFS=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this.calculateIFS(e,this.parent.trueValue)},n.prototype.ComputeMATCH=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var i=r;if(t.isNullOrUndefined(i)||1===i.length&&""===i[0]||i.length<2||i.length>3)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];var a,o=[],s=i[0].split(this.parent.tic).join("");if(this.parent.isCellReference(s)&&(s=this.parent.getValueFromArg(s)),!s.toString().length)return this.parent.getErrorStrings()[e.CommonErrors.na];i[2]=t.isNullOrUndefined(i[2])?"1":i[2].split(this.parent.tic).join(""),i[2].split(this.parent.tic).join("")===this.parent.trueValue&&(i[2]="1"),i[2].split(this.parent.tic).join("")===this.parent.falseValue&&(i[2]="0");var l=parseFloat(i[2]);if(-1!==l&&0!==l&&1!==l)return this.parent.getErrorStrings()[e.CommonErrors.na];var h=0,d="";if(i[1].indexOf(":")>-1||this.parent.isCellReference(i[1])){a=this.parent.getCellCollection(i[1].split(this.parent.tic).join(""));for(var p=0;p<a.length;p++)o[p]=this.parent.getValueFromArg(a[p]).split(this.parent.tic).join("");for(var c=0;c<o.length;c++)if(o[c].toString().length)if(1===l){if(s===o[c])return c+1;s>o[c]&&(d?o[c]>d&&(h=c+1,d=o[c]):(h=c+1,d=o[c]))}else if(0===l){if((s.indexOf("*")>-1||s.indexOf("?")>-1)&&(o[c]=this.parent.findWildCardValue(s,o[c])),s===o[c])return c+1;if(this.parent.parseFloat(s)===this.parent.parseFloat(o[c]))return c+1}else if(-1===l){if(s===o[c])return c+1;s<o[c]&&(d?o[c]<d&&(h=c+1,d=o[c]):(h=c+1,d=o[c]))}}return h||this.parent.getErrorStrings()[e.CommonErrors.na]},n.prototype.ComputeLOOKUP=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var i=r;return t.isNullOrUndefined(i)||1===i.length&&""===i[0]?this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments]:this.parent.computeLookup(i)},n.prototype.ComputeVLOOKUP=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var i=r;return t.isNullOrUndefined(i)||1===i.length&&""===i[0]||i.length<3||i.length>4?this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments]:this.parent.computeVHLookup(i,!0)},n.prototype.ComputeHLOOKUP=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var i=r;return t.isNullOrUndefined(i)||1===i.length&&""===i[0]||i.length<3||i.length>4?this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments]:this.parent.computeVHLookup(i)},n.prototype.ComputeSUBTOTAL=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=t,i="";if(n.length<2)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];var a=this.parent.parseFloat(this.parent.getValueFromArg(n[0].split(this.parent.tic).join(""))),o=n.slice(1,n.length);switch(a){case 1:case 101:i=this.ComputeAVERAGE.apply(this,o.concat(["isSubtotal"]));break;case 2:case 102:i=this.ComputeCOUNT.apply(this,o.concat(["isSubtotal"]));break;case 3:case 103:i=this.ComputeCOUNTA.apply(this,o.concat(["isSubtotal"]));break;case 4:case 104:i=this.ComputeMAX.apply(this,o.concat(["isSubtotal"]));break;case 5:case 105:i=this.ComputeMIN.apply(this,o.concat(["isSubtotal"]));break;case 6:case 106:i=this.ComputePRODUCT.apply(this,o.concat(["isSubtotal"]));break;case 7:case 107:i=this.ComputeDAY.apply(this,o);break;case 8:case 108:i=this.ComputeCONCAT.apply(this,o);break;case 9:case 109:i=this.ComputeSUM.apply(this,o.concat(["isSubtotal"]));break;case 10:case 110:i=this.ComputeAVERAGEA.apply(this,o);break;case 11:case 111:i=this.ComputeABS.apply(this,o);break;default:i=this.parent.getErrorStrings()[e.CommonErrors.value]}return i},n.prototype.ComputeRADIANS=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=t;if(""===n[0]||n.length>1)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];if(n[0].indexOf(":")>-1||""===n[0].split(this.parent.tic).join(""))return this.parent.getErrorStrings()[e.CommonErrors.value];var i=n[0].split(this.parent.tic).join("");n[0]=isNaN(this.parent.parseFloat(i))?n[0]:i;var a=this.parent.getValueFromArg(n[0]);if(this.parent.getErrorStrings().indexOf(a)>-1)return a;var o=this.parent.parseFloat(a);return isNaN(o)?a.indexOf(this.parent.tic)>-1?this.parent.getErrorStrings()[e.CommonErrors.value]:this.parent.getErrorStrings()[e.CommonErrors.name]:Math.PI*o/180},n.prototype.ComputeRANDBETWEEN=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n,i,a,o=t.length;if(2!==o)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];for(var s=0;s<o;s++){if(""===t[s])return this.parent.getErrorStrings()[e.CommonErrors.na];if(t[s].indexOf(this.parent.tic)>-1){if(isNaN(parseFloat(t[s].split(this.parent.tic).join(""))))return this.parent.getErrorStrings()[e.CommonErrors.value];t[s]=t[s].split(this.parent.tic).join("")}var l=this.parent.getValueFromArg(t[s]);if(this.parent.getErrorStrings().indexOf(l)>-1)return l;if(a=parseFloat(l),this.parent.isCellReference(t[s])){if(a=""===this.parent.getValueFromArg(t[s])?0:a,0===s?n=a:i=a,0===n&&0===i)return"0";if(isNaN(a))return this.parent.getErrorStrings()[e.CommonErrors.value]}else{if(isNaN(a))return this.parent.getErrorStrings()[e.CommonErrors.name];0===s?n=a:i=a}}return i<n?this.parent.getErrorStrings()[e.CommonErrors.num]:0===n?Math.floor(Math.random()*(i-(n-1)))+n:i-n==1?Math.round(Math.random()*(i-n)+n):Math.floor(Math.random()*(i-(n-1)))+n},n.prototype.ComputeSLOPE=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=t;if(2!==n.length||""===n[0])return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];var i=this.parent.getCellCollection(n[1].split(this.parent.tic).join("")),a=this.parent.getCellCollection(n[0].split(this.parent.tic).join(""));if(a.length!==i.length)return this.parent.getErrorStrings()[e.CommonErrors.na];for(var o=this.getDataCollection(a),s=0;s<o.length;s++)if(this.parent.getErrorStrings().indexOf(o[s])>-1)return o[s];for(var l=this.getDataCollection(i),h=0;h<l.length;h++)if(this.parent.getErrorStrings().indexOf(l[h])>-1)return l[h];for(var d=0,p=0,c=0,u=0,f=0,g=l.length;f<g;++f)"NaN"!==Number(l[f]).toString()&&"NaN"!==Number(o[f]).toString()&&(d+=Number(l[f])*Number(o[f]),c+=Number(l[f]),u+=Number(o[f]),p+=Number(l[f])*Number(l[f]));var m=((d-c*u/l.length)/(p-c*c/l.length)).toString();return"NaN"===m?this.parent.getErrorStrings()[e.CommonErrors.divzero]:m},n.prototype.ComputeINTERCEPT=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=t;if(""===n[0]||2!==n.length)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];var i=this.parent.getCellCollection(n[0].split(this.parent.tic).join("")),a=this.parent.getCellCollection(n[1].split(this.parent.tic).join(""));if(i.length!==a.length)return this.parent.getErrorStrings()[e.CommonErrors.na];for(var o=this.getDataCollection(a),s=0;s<o.length;s++)if(this.parent.getErrorStrings().indexOf(o[s])>-1)return o[s];for(var l=this.getDataCollection(i),h=0;h<l.length;h++)if(this.parent.getErrorStrings().indexOf(l[h])>-1)return l[h];for(var d=0,p=0,c=0,u=o.length;c<u;++c)d+=Number(o[c]),p+=Number(l[c]);d/=o.length,p/=o.length;var f,g=0,m=0;for(c=0,u=o.length;c<u;++c)g+=(f=Number(o[c])-d)*(Number(l[c])-p),m+=f*f;var v=(p-g/m*d).toString();return"NaN"===v?this.parent.getErrorStrings()[e.CommonErrors.divzero]:v},n.prototype.ComputeLN=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n,i,a=t,o="";if(0===t.length||t.length>1)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];if(this.parent.isCellReference(a[0])){if(o=this.parent.getValueFromArg(a[0]),(n=this.parent.parseFloat(o))<=0||""===o)return this.parent.getErrorStrings()[e.CommonErrors.num];if(isNaN(n))return this.parent.getErrorStrings()[e.CommonErrors.value]}else{if(i=this.parent.getValueFromArg(a[0].split(this.parent.tic).join("")),(n=this.parent.parseFloat(i))<=0||""===n.toString())return this.parent.getErrorStrings()[e.CommonErrors.num];if(isNaN(n))return this.parent.getErrorStrings()[e.CommonErrors.value]}return Math.log(n)},n.prototype.ComputeISNUMBER=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=t;if(0===t.length||t.length>1)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];var i=this.parent.isCellReference(n[0])?this.parent.getValueFromArg(n[0]):this.parent.getValueFromArg(n[0].split(this.parent.tic).join(""));if(""===i.toString())return!1;var a=this.parent.parseFloat(i);return!isNaN(a)},n.prototype.ComputeROUND=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];if(!t.length||1===t.length||t.length>2)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];var n=t;if(1===t.length){var i="TRUE"===n[0].split(this.parent.tic).join("")?"1":"FALSE"===n[0].split(this.parent.tic).join("")?"0":n[0];return isNaN(this.parent.parseFloat(i))?this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_arguments]:Math.round(this.parent.parseFloat(i)).toString()}var a=this.parent.getValueFromArg(n[0]);if(this.parent.getErrorStrings().indexOf(a)>-1)return a;var o=this.parent.getValueFromArg(n[1]);if(this.parent.getErrorStrings().indexOf(o)>-1)return o;a="TRUE"===a?"1":"FALSE"===a?"0":a,o="TRUE"===o?"1":"FALSE"===o?"0":o,a=a.split(this.parent.tic).join(""),o=o.split(this.parent.tic).join("");var s=isNaN(Number(a))||""===a.trim(),l=isNaN(Number(o))||""===o.trim();if((n[0].indexOf('"')>-1||this.parent.isCellReference(n[0]))&&s||(n[1].indexOf('"')>-1||this.parent.isCellReference(n[1]))&&l)return this.parent.getErrorStrings()[e.CommonErrors.value];if(""===a&&""===o||""===a)return 0;var h,d=this.parent.parseFloat(a),p=this.parent.parseFloat(o);if(!isNaN(p)&&!isNaN(d)&&p>0)h=this.parent.parseFloat(this.preciseRound(d,p));else{var c=Math.pow(10,-p);h=Math.round(d/c)*c}return h.toString()},n.prototype.preciseRound=function(e,t){var r=e>=0?1:-1;return(Math.round(e*Math.pow(10,t)+.001*r)/Math.pow(10,t)).toFixed(t)},n.prototype.ComputePOWER=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n,i,a=t;if(0===t.length||t.length>2)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];n=this.parent.getValueFromArg(a[0]),i=this.parent.getValueFromArg(a[1]),n="TRUE"===n?"1":"FALSE"===n?"0":n,i="TRUE"===i?"1":"FALSE"===i?"0":i;var o=this.parent.parseFloat(n),s=this.parent.parseFloat(i);return isNaN(o)||isNaN(s)?this.parent.getErrorStrings()[e.CommonErrors.value]:0===o&&s<0?this.parent.getErrorStrings()[e.CommonErrors.divzero]:0===o&&0===s?this.parent.getErrorStrings()[e.CommonErrors.num]:Math.pow(o,s).toString()},n.prototype.ComputeSQRT=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n,i=t[0];if(0===t.length||t.length>1||""===i)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];if(""===i.split(this.parent.tic).join("").trim())return this.parent.getErrorStrings()[e.CommonErrors.value];if(this.parent.isCellReference(i)){if((n=this.parent.getValueFromArg(i)||"0").indexOf(this.parent.tic)>-1)return this.parent.getErrorStrings()[e.CommonErrors.value]}else{if(i.indexOf(this.parent.tic)>-1&&(i.split(this.parent.tic).join("")===this.parent.trueValue||i.split(this.parent.tic).join("")===this.parent.falseValue))return this.parent.getErrorStrings()[e.CommonErrors.value];n=this.parent.getValueFromArg(i).split(this.parent.tic).join("")}if(this.parent.getErrorStrings().indexOf(n)>-1)return n;if(n=n===this.parent.trueValue?"1":n===this.parent.falseValue?"0":n,this.parent.parseFloat(n)<0)return this.parent.getErrorStrings()[e.CommonErrors.num];if(isNaN(this.parent.parseFloat(n))){var a={value:n};if(this.parent.parentObject.notify(Wr,a),!a.isDate&&!a.isTime)return this.parent.getErrorStrings()[e.CommonErrors.value];n=a.updatedVal}return Math.sqrt(this.parent.parseFloat(n))},n.prototype.ComputeLOG=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n,i,a=t;if(0===t.length||t.length>2)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];if(n=this.parent.getValueFromArg(a[0]),i=2===t.length?this.parent.getValueFromArg(a[1]):"10",""===n||null===n||""===i||null===i)return this.parent.getErrorStrings()[e.CommonErrors.num];n="TRUE"===n.split(this.parent.tic).join("")?"1":"FALSE"===n.split(this.parent.tic).join("")?"0":n,i="TRUE"===i.split(this.parent.tic).join("")?"1":"FALSE"===i.split(this.parent.tic).join("")?"0":i;var o=this.parent.parseFloat(n),s=this.parent.parseFloat(i);return o<=0||s<=0?this.parent.getErrorStrings()[e.CommonErrors.num]:1===s?this.parent.getErrorStrings()[e.CommonErrors.divzero]:isNaN(o)||isNaN(s)?this.parent.getErrorStrings()[e.CommonErrors.value]:(Math.log(o)/Math.LN10/(Math.log(s)/Math.LN10)).toString()},n.prototype.ComputeTRUNC=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n,i=t,a=0;if(0===t.length||t.length>2)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];if(2===t.length){if(a=this.parent.getValueFromArg(i[1]),this.parent.getErrorStrings().indexOf(a)>-1)return a;a="TRUE"===a.split(this.parent.tic).join("")?"1":"FALSE"===a.split(this.parent.tic).join("")?"0":a,a=this.parent.parseFloat(a)}if(n=this.parent.getValueFromArg(i[0]),this.parent.getErrorStrings().indexOf(n)>-1)return n;n="TRUE"===n.split(this.parent.tic).join("")?"1":"FALSE"===n.split(this.parent.tic).join("")?"0":n;var o=this.parent.parseFloat(n.split(this.parent.tic).join(""));if(isNaN(o)||isNaN(a))return i[0]===this.parent.tic||this.parent.isCellReference(i[0])||i[1]===this.parent.tic||this.parent.isCellReference(i[1])?this.parent.getErrorStrings()[e.CommonErrors.value]:this.parent.getErrorStrings()[e.CommonErrors.name];var s=Math.pow(10,a);return((o<0?-1:1)*Math.floor(s*Math.abs(o))/s).toString()},n.prototype.ComputeEXP=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n,i=t;if(0===t.length||t.length>1)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];if(n=this.parent.getValueFromArg(i[0]),this.parent.getErrorStrings().indexOf(n)>-1)return n;""===(n="TRUE"===n.split(this.parent.tic).join("")?"1":"FALSE"===n.split(this.parent.tic).join("")?"0":n)&&(n="0");var a=this.parent.parseFloat(n);return a>709?this.parent.getErrorStrings()[e.CommonErrors.num]:isNaN(a)?i[0]===this.parent.tic||this.parent.isCellReference(i[0])?this.parent.getErrorStrings()[e.CommonErrors.value]:this.parent.getErrorStrings()[e.CommonErrors.name]:Math.exp(a).toString()},n.prototype.ComputeGEOMEAN=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n,i,a,o,s=t,l=1,h=0,d=0,p=0;if(0===t.length)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];if(1===s.length&&""===s[0])return l.toString();var c;for(i=0;i<s.length;i++)if(s[i].indexOf(":")>-1){if(s[0]===this.parent.tic)return this.parent.getErrorStrings()[e.CommonErrors.value];for(o=this.parent.getCellCollection(s[i].split(this.parent.tic).join("")),a=0;a<o.length;a++){if(d=this.parent.getValueFromArg(o[a]),p=d.split(this.parent.tic).join(""),c=p===this.parent.trueValue||p===this.parent.falseValue,(n=this.parent.parseFloat(d))<=0)return this.parent.getErrorStrings()[e.CommonErrors.num];c||this.parent.getErrorStrings().indexOf(d)>-1||(isNaN(n)||(h++,l*=n))}}else{if(d=this.parent.getValueFromArg(s[i]),this.parent.getErrorStrings().indexOf(d)>-1)return d;var u=d.split(this.parent.tic).join("");if(d.indexOf('"')>-1&&isNaN(this.parent.parseFloat(u)))return this.parent.getErrorStrings()[e.CommonErrors.value];if(s[i]=s[i].startsWith("n")?s[i].slice(1):s[i],""===d&&""===s[i])return this.parent.getErrorStrings()[e.CommonErrors.num];if(("TRUE"===u||"FALSE"===u)&&this.parent.isCellReference(s[i]))continue;if(d.length>0){if(d=d.indexOf('"')>-1?u:d,d="TRUE"===d.split(this.parent.tic).join("")?"1":"FALSE"===d.split(this.parent.tic).join("")?"0":d,!this.parent.isCellReference(s[i])&&isNaN(this.parent.parseFloat(d)))return this.parent.getErrorStrings()[e.CommonErrors.value];if((n=this.parent.parseFloat(d))<=0)return this.parent.getErrorStrings()[e.CommonErrors.num];isNaN(n)||(h++,l*=n)}}return h>0&&(l=Math.pow(l,1/h)),l.toString()},n.prototype.ComputeRSQ=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=0,i=t;if(2!==i.length)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];if(""===i[0]||""===i[1])return this.parent.getErrorStrings()[e.CommonErrors.value];if(i[0].includes('"')||i[1].includes('"'))return this.parent.getErrorStrings()[e.CommonErrors.na];if(-1===i[0].indexOf(":")&&U(i[0])&&-1===i[1].indexOf(":")&&U(i[1]))return this.parent.getErrorStrings()[e.CommonErrors.divzero];var a=this.parent.getCellCollection(i[0]),o=this.parent.getCellCollection(i[1]);if(a.length!==o.length)return this.parent.getErrorStrings()[e.CommonErrors.na];for(var s=this.getDataCollection(o),l=0;l<s.length;l++)if(this.parent.getErrorStrings().indexOf(s[l])>-1)return s[l];for(var h=this.getDataCollection(a),d=0;d<h.length;d++)if(this.parent.getErrorStrings().indexOf(h[d])>-1)return h[d];for(var p,c,u=0;u<s.length;u++)p=Number(s[u]),c=Number(h[u]),D(p)&&D(c)&&n++;if(n<=1)return this.parent.getErrorStrings()[e.CommonErrors.divzero];if(2===n)return 1;var f=this.getMeanArray(s,h),g=f[0],m=f[1],v=this.getCorrelation(s,h,g,m);return Math.pow(v,2)},n.prototype.getCorrelation=function(e,t,r,n){for(var i,a,o=0,s=0,l=0,h=0;h<e.length;h++)D(e[h])&&D(t[h])&&(o+=(a=Number(e[h])-r)*(i=Number(t[h])-n),s+=Math.pow(a,2),l+=Math.pow(i,2));return o/Math.sqrt(s*l)},n.prototype.getMeanArray=function(e,t){for(var r=0,n=0,i=0,a=0,o=0,s=0;s<e.length;s++)D(e[s])&&D(t[s])&&(n+=Number(e[s]),i+=Number(t[s]),r++);return a=n/r,o=i/r,[a,o]},n.prototype.getDataCollection=function(e){for(var t=[],r=0,n=e.length;r<n;r++)t.push(this.parent.getValueFromArg(e[r]));return t},n.prototype.parseDouble=function(e){var t=this.parent.parseFloat(e.toString());return isNaN(t)?NaN:t},n.prototype.spreadsheetDisplayText=function(e){if(this.parent.parentObject&&this.parent.parentObject.element&&this.parent.parentObject.element.classList.contains("e-spreadsheet")&&this.parent.isCellReference(e)){var t=this.parent.parentObject.getIndexes(e);e=this.parent.parentObject.getDisplayText(this.parent.parentObject.getActiveSheet().rows[t.startIdx].cells[t.endIdx])}return e},n.prototype.spreadsheetFormat=function(e){if(this.parent.parentObject&&this.parent.parentObject.element&&this.parent.parentObject.element.classList.contains("e-spreadsheet")&&this.parent.isCellReference(e)){var t=this.parent.parentObject.getIndexes(e);e=this.parent.parentObject.getActiveSheet().rows[t.startIdx].cells[t.endIdx].format}return e},n.prototype.getModuleName=function(){return"basic-formulas"},n}(),Qi=function(){function r(e){this.emptyStr="",this.storedStringText=this.emptyStr,this.sheetToken="!",this.tokenAdd="a",this.tokenSubtract="s",this.tokenMultiply="m",this.tokenDivide="d",this.tokenLess="l",this.charEm="r",this.charEp="x",this.tokenGreater="g",this.tokenEqual="e",this.tokenLessEq="k",this.tokenGreaterEq="j",this.tokenNotEqual="o",this.tokenAnd="c",this.tokenEm="v",this.tokenEp="t",this.tokenOr=String.fromCharCode(126),this.charAnd="i",this.charLess="<",this.charGreater=">",this.charEqual="=",this.charLessEq="f",this.charGreaterEq="h",this.charNoEqual="z",this.stringGreaterEq=">=",this.stringLessEq="<=",this.stringNoEqual="<>",this.stringAnd="&",this.stringOr="^",this.charOr="w",this.charAdd="+",this.charSubtract="-",this.charMultiply="*",this.charDivide="/",this.fixedReference="$",this.spaceString=" ",this.ignoreBracet=!1,this.isError=!1,this.isFormulaParsed=!1,this.findNamedRange=!1,this.stringsColl=new Map,this.tokens=[this.tokenAdd,this.tokenSubtract,this.tokenMultiply,this.tokenDivide,this.tokenLess,this.tokenGreater,this.tokenEqual,this.tokenLessEq,this.tokenGreaterEq,this.tokenNotEqual,this.tokenAnd,this.tokenOr],this.charNOTop=String.fromCharCode(167),this.specialSym=["~","@","#","?"],this.isFailureTriggered=!1,this.parent=e}return r.prototype.parse=function(r,n){var i=this;if(this.parent.isTextEmpty(r))return r;if(Le(r))return this.parent.getErrorStrings()[e.CommonErrors.ref];this.parent.getFormulaCharacter()!==String.fromCharCode(0)&&this.parent.getFormulaCharacter()===r[0]&&(r=r.substring(1)),(this.parent.namedRanges.size>0||this.parent.storedData.size>0)&&(r=this.checkForNamedRangeAndKeyValue(r),this.findNamedRange=!1),r=(r=r.replace(/[-+*\/\&\^]+/g,function(t){for(var r="";1<t.length;)switch(t.substring(0,2)){case"++":case"--":t="+"+t.substring(2);break;case"+-":case"-+":t="-"+t.substring(2);break;case"*+":t="*"+t.substring(2);break;case"/+":t="/"+t.substring(2);break;case"^+":t="^"+t.substring(2);break;case"&+":t="&"+t.substring(2);break;case"*-":case"/-":case"^-":case"&-":r=t.substring(0,1),t=t.substring(1);break;default:throw new ra(i.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_expression],!0)}return r+t})).split("-(-").join("(");var a=this.storeStrings(r);r=this.storedStringText;var o=0;if(t.isNullOrUndefined(a)&&(r=r.split(" ").join("")),r=r.split("=>").join(">="),(r=r.split("=<").join("<="))[r.length-1]===this.parent.arithMarker&&this.indexOfAny(r,this.tokens)===r.length-2||(r=r.toUpperCase()),r.indexOf(this.sheetToken)>-1){var s=this.parent.getSheetFamilyItem(this.parent.grid);if(null!=s.sheetNameToParentObject&&s.sheetNameToParentObject.size>0){r[0]!==this.sheetToken.toString()&&(r=this.parent.setTokensForSheets(r));var l=this.parent.getSheetToken(r.split(this.parent.tic).join(this.emptyStr)),h=this.checkScopedRange(r.split('"').join(this.emptyStr).split(this.sheetToken).join(""));t.isNullOrUndefined(l)&&""!==l&&this.parent.namedRanges.size>0&&""!==h&&(r=h)}}r=this.markLibraryFormulas(r);try{r=this.formulaAutoCorrection(r)}catch(t){if(!(c={message:t.message,exception:t,isForceCalculable:t.formulaCorrection,computeForceCalculate:!1}).isForceCalculable)throw this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_expression];if(this.isFailureTriggered||(this.parent.trigger("onFailure",c),this.isFailureTriggered=!0),!c.isForceCalculable||!c.computeForceCalculate)throw this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_expression];r=this.formulaAutoCorrection(r,c),this.parent.storedData.get(n).formulaText="="+r}if(!this.ignoreBracet)for(o=r.indexOf(")");o>-1;){var d=r.substring(0,o).lastIndexOf("(");if(-1===d)throw new ra(this.parent.formulaErrorStrings[e.FormulasErrorsStrings.mismatched_parentheses]);if(d===o-1)throw new ra(this.parent.formulaErrorStrings[e.FormulasErrorsStrings.empty_expression]);var p=this.emptyStr;p=this.ignoreBracet?this.parent.substring(r,d,o-d+1):this.parent.substring(r,d+1,o-d-1);try{r=r.substring(0,d)+this.parseSimple(p)+r.substring(o+1)}catch(e){var c=this.exceptionArgs(e);this.isFailureTriggered||(this.parent.trigger("onFailure",c),this.isFailureTriggered=!0);var u="string"==typeof c.exception?c.exception:c.message;return(this.parent.getErrorLine(e)?"":"#"+this.parent.getErrorLine(e)+": ")+u}o=r.indexOf(")")}if(!this.ignoreBracet&&r.indexOf("(")>-1)throw new ra(this.parent.formulaErrorStrings[e.FormulasErrorsStrings.mismatched_parentheses]);return r=this.parseSimple(r),null!==a&&a.size>0&&(r=this.setStrings(r,a)),r},r.prototype.exceptionArgs=function(e){return{message:e.message,exception:e,isForceCalculable:e.formulaCorrection,computeForceCalculate:!1}},r.prototype.formulaAutoCorrection=function(r,n){var i=["*","+","-","/","^","&"],a=[">","=","<"],o=0,s="",l="",h="",d="",p="",c="",u="",f=0;if(this.parent.formulaErrorStrings.indexOf(r)>-1)return r;if(this.indexOfAny(r,this.specialSym)>-1)throw new ra(this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_expression],!1);for(;o<r.length;)if(r=r.split("-*").join("-").split("/*").join("/").split("*/").join("*").split("-/").join("-").split("*+").join("*").split("+*").join("+"),this.parent.isDigit(r[o])&&r.length>o+1&&this.indexOfAny(r[o+1],i)>-1&&r.length>o+2&&!t.isNullOrUndefined(r[o+2])&&this.indexOfAny(r[o+2],i)>-1&&("-"!==r[o+2]||"*"!==r[o+1]&&"/"!==r[o+1]&&"^"!==r[o+1]&&"&"!==r[o+1])){if(!n||!n.computeForceCalculate)throw this.parent.formulaErrorStrings[e.FormulasErrorsStrings.improper_formula];this.parent.isDigit(r[o])?(f<1?(c=r[o],h=r[o+1],t.isNullOrUndefined(h)&&(h=this.emptyStr),f+=1,s=s+c+(h="&"===h?"":h)):f<2&&(u=r[o],d=r[o-1],p=r[o+1],f=0,s="-"===d?s+d+u+(p="&"===(p=t.isNullOrUndefined(p)?this.emptyStr:p)?"":p):s+u+(p=t.isNullOrUndefined(p)?this.emptyStr:p)),o+=2):(s="-"===r[o]?s+r[o]:s,o+=1)}else if((this.parent.isDigit(r[o])||r[o]===this.parent.rightBracket||this.parent.storedData.has(r[o].toUpperCase()))&&(t.isNullOrUndefined(r[o+1])||this.indexOfAny(r[o+1],i)>-1))l="&"===(l=t.isNullOrUndefined(r[o+1])?this.emptyStr:r[o+1])&&"-"!==r[o+2]?"":l,s="-"===r[o-1]?s+r[o-1]+r[o]+l:s+r[o]+l,o+=2;else if(this.indexOfAny(r[o],a)>-1&&!t.isNullOrUndefined(r[o-1])&&!t.isNullOrUndefined(r[o+1]))s+=r[o],o+=1;else if("q"===r[o])for(;r[o]!==this.parent.leftBracket;)s+=r[o],o+=1;else r[o]===this.parent.leftBracket||r[o]===this.parent.rightBracket||"{"===r[o]||"}"===r[o]||"("===r[o]||")"===r[o]?(s+=r[o],o+=1):this.parent.isUpperChar(r[o])||r[o].indexOf(":")>-1||r[o]===this.parent.getParseArgumentSeparator()||"%"===r[o]&&this.parent.isDigit(r[o-1])?(s+=r[o],o+=1):r[o]===this.parent.tic||" "===r[o]||r[o]===this.parent.getParseDecimalSeparator()||r[o]===this.sheetToken||"$"===r[o]||"_"===r[o]?(s+=r[o],o+=1):(this.parent.isDigit(r[o])&&(s="-"===r[o-1]?s+r[o-1]+r[o]:s+r[o]),"-"!==r[o]&&"+"!==r[o]||(s=(s+=r[o]).split("++").join("+").split("+-").join("-").split("-+").join("-")),"/"!==r[o]&&"*"!==r[o]&&"^"!==r[o]||(s+=r[o]),o+=1);return s=s===this.emptyStr?r:s,this.indexOfAny(s[s.length-1],i)>-1&&(s=s.substring(0,s.length-1)),s=s.split("--").join("-").split("-+").join("-").split("+-").join("-")},r.prototype.checkScopedRange=function(e){var r=this,n=this.emptyStr,i="NaN",a=this.parent.getSheetID(this.parent.grid),o=this.parent.getSheetFamilyItem(this.parent.grid);if(e[0]===this.sheetToken.toString()){var s=e.indexOf(this.sheetToken,1),l=parseInt(e.substr(1,s-1),10);s>1&&!this.parent.isNaN(l)&&(e=e.substring(s+1),a=l)}var h="!"+a.toString();return null===o||null==o.sheetNameToToken?i:(o.sheetNameToToken.forEach(function(a,s){if(o.sheetNameToToken.get(s).toString()===h+"!"){var l=r.emptyStr;r.parent.namedRanges.forEach(function(a,s){l=t.isNullOrUndefined(r.parent.parentObject)?o.sheetNameToToken.get(s).toUpperCase():r.parent.parentObject.getActiveSheet().name+r.sheetToken+e.toUpperCase(),r.parent.getNamedRanges().has(l)&&(n=r.parent.getNamedRanges().get(l).toUpperCase(),i=n)})}}),i)},r.prototype.storeStrings=function(t){var r,n=0,i=0,a=0,o="",s=null;if(t.indexOf(this.parent.tic)>-1)for(n=t.indexOf(this.parent.tic);n>-1&&t.length>0;){if(null===s&&(s=this.stringsColl),-1===(i=n+1<t.length?t.indexOf(this.parent.tic,n+1):-1))throw new ra(this.parent.formulaErrorStrings[e.FormulasErrorsStrings.mismatched_tics]);r=this.parent.substring(t,n,i-n+1),o=this.parent.tic+this.spaceString+a.toString()+this.parent.tic,s=s.set(o,r),t=t.substring(0,n)+o+t.substring(i+1),(n+=o.length)<=t.length&&(n=t.indexOf(this.parent.tic,n)),a++}return this.storedStringText=t,s},r.prototype.setStrings=function(e,t){for(var r=0;r<t.size;r++)t.forEach(function(t,r){e=e.split(r).join(t)});return e},r.prototype.parseSimple=function(e){var t=e;if(t.length>0&&"+"===t[0]&&(t=t.substring(1)),"#DIV/0!"===t)return"#DIV/0!";if("#NAME?"===t)return"#NAME?";if(""===t)return t;if(this.parent.formulaErrorStrings.indexOf(t)>-1)return t;t=(t=(t=(t=(t=(t=t.split(this.stringLessEq).join(this.charLessEq)).split(this.stringGreaterEq).join(this.charGreaterEq)).split(this.stringNoEqual).join(this.charNoEqual)).split(this.stringAnd).join(this.charAnd)).split(this.stringOr).join(this.charOr)).split(this.fixedReference).join(this.emptyStr);var r=[this.tokenEp,this.tokenEm],n=[this.tokenMultiply,this.tokenDivide],i=[this.tokenAdd,this.tokenSubtract],a=[this.charMultiply,this.charDivide],o=[this.charAdd,this.charSubtract],s=[this.tokenLess,this.tokenGreater,this.tokenEqual,this.tokenLessEq,this.tokenGreaterEq,this.tokenNotEqual],l=[this.charLess,this.charGreater,this.charEqual,this.charLessEq,this.charGreaterEq,this.charNoEqual],h=[this.charEp,this.charEm],d=[this.tokenAnd],p=[this.charAnd],c=[this.charOr],u=[this.tokenOr];return t=this.parseSimpleOperators(t,r,h),t=this.parseSimpleOperators(t,u,c),t=this.parseSimpleOperators(t,n,a),t=this.parseSimpleOperators(t,i,o),t=this.parseSimpleOperators(t,s,l),t=this.parseSimpleOperators(t,d,p)},r.prototype.parseSimpleOperators=function(r,n,i){if(this.parent.getErrorStrings().indexOf(r)>-1)return r;for(var a=r,o=0,s="",l=0;l<i.length;l++)s+=i[l];if(a=a.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"),(a=a.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>0&&"-"===a[0])a="0-"+(a=a.substring(1).split("-").join(this.tokenOr)),a=(a=this.parseSimpleOperators(a,[this.tokenSubtract],[this.charSubtract])).split(this.tokenOr).join("-");else if(a.length>0&&a.indexOf("u")>-1){for(var h=a.split(this.parent.getParseArgumentSeparator()),d=0;d<h.length;d++)if(h[d].startsWith("u")){var p=h[d].split("u").join("0-");p=this.parseSimpleOperators(p,[this.tokenSubtract],[this.charSubtract]),h[d]=p}a=h.join(this.parent.getParseArgumentSeparator())}else a.length>0&&"+"===a[0]?a=a.substring(1):a.length>0&&"+"===a[a.length-1]&&(a=a.substring(0,a.length-1));try{if(this.indexOfAny(a,i)>-1){if(a.includes(" ")){for(var c="",u=0;u<a.length;u++){var f=a[u];if(i.indexOf(f)>=0)c=c.trim()+f;else{if(" "===f&&i.indexOf(c[c.length-1])>=0)continue;c+=f}}a=c}o=this.indexOfAny(a,i);for(var g=this.parent.getParseDecimalSeparator();o>-1;){var m="",v="",y=0,C=0,b=!1,x=["*","+","-","/","w","=","<",">"],S=0;if(a[o]===this.charNOTop)y=o;else if(S=o-1,a[S]===this.parent.arithMarker){if((I=this.findLeftMarker(a.substring(0,S-1)))<0)throw new ra(this.parent.formulaErrorStrings[e.FormulasErrorsStrings.cannot_parse]);m=this.parent.substring(a,I+1,S-I-1),y=I+1}else if(a[S]===this.parent.rightBracket){for(var w=0,I=S-1;I>0&&("q"!==a[I]||0!==w);)"q"===a[I]?w--:a[I]===this.parent.rightBracket&&w++,I--;if(I<0)throw new ra(this.parent.formulaErrorStrings[e.FormulasErrorsStrings.cannot_parse]);m=this.parent.substring(a,I,S-I+1),y=I}else if(a[S]===this.parent.tic[0]){var E=a.substring(0,S-1).lastIndexOf(this.parent.tic);if(E<0)throw new ra(this.parent.formulaErrorStrings[e.FormulasErrorsStrings.cannot_parse]);m=this.parent.substring(a,E,S-E+1),y=E}else{for(var R=!1;S>-1&&(this.parent.isDigit(a[S])||!R&&(a[S]===g||"%"===a[S]));)this.parent.isDigit(a[S])||"%"===a[S]||(R=!0),S-=1;if(S>-1&&R&&a[S]===g)throw new ra(this.parent.formulaErrorStrings[e.FormulasErrorsStrings.number_contains_2_decimal_points]);if(0===(S+=1)||S>0&&!this.parent.isUpperChar(a[S-1]))m="n"+this.parent.substring(a,S,o-S),y=S;else if(S>0&&"E"===a[S-1]&&("TRUE"===a.substring(S-4,S)&&(t.isNullOrUndefined(a[S-5])||x.indexOf(a[S-5])>-1)||"FALSE"===a.substring(S-5,S)&&(t.isNullOrUndefined(a[S-6])||x.indexOf(a[S-6])>-1))&&("TRUE"===a.substring(S+1,S+5)||"FALSE"===a.substring(S+1,S+6)))S="TRUE"===a.substring(S-4,S)?S-4:S-5,m="TRUE"===a.substring(S,o)?"n1":"FALSE"===a.substring(S,o)?"n0":m,y=S,b=!0;else{for(S-=1;S>-1&&(this.parent.isUpperChar(a[S])||this.parent.isDigit(a[S]));)S-=1;if(S>-1&&a[S]===this.sheetToken){for(S-=1;S>-1&&a[S]!==this.sheetToken;)S-=1;S>-1&&a[S]===this.sheetToken&&(S-=1)}if(S>-1&&":"===a[S]){for(S-=1;S>-1&&this.parent.isDigit(a[S]);)S-=1;for(;S>-1&&this.parent.isUpperChar(a[S]);)S-=1;if(S>-1&&a[S]===this.sheetToken){for(S--;S>-1&&a[S]!==this.sheetToken;)S--;S>-1&&a[S]===this.sheetToken&&S--}S+=1,m=this.parent.substring(a,S,o-S),m=this.parent.getCellFrom(m)}else{var k=!1;S>0&&!this.parent.isUpperChar(a[S])&&(k="u"===a[S]&&a[S-1]===this.parent.getParseArgumentSeparator()),k||(S+=1),m=this.parent.substring(a,S,o-S)}this.parent.updateDependentCell(m),y=S}(this.parent.namedRanges.size>0&&this.parent.namedRanges.has(m.toUpperCase())||this.parent.storedData.has(m.toUpperCase()))&&(m="n"+this.checkForNamedRangeAndKeyValue(m))}if(o===a.length-1)throw new ra(this.parent.formulaErrorStrings[e.FormulasErrorsStrings.expression_cannot_end_with_an_operator]);if((k="u"===a[S=o+1])&&(S+=1),a[S]===this.parent.tic[0]){if((I=a.substring(S+1).indexOf(this.parent.tic))<0)throw this.parent.formulaErrorStrings[e.FormulasErrorsStrings.cannot_parse];v=this.parent.substring(a,S,I+2),C=I+S+2}else if(a[S]===this.parent.arithMarker){if((I=this.findRightMarker(a.substring(S+1)))<0)throw new ra(this.parent.formulaErrorStrings[e.FormulasErrorsStrings.cannot_parse]);v=this.parent.substring(a,S+1,I),C=I+S+2}else if("q"===a[S]){for(w=0,I=S+1;I<a.length&&(a[I]!==this.parent.rightBracket||0!==w);)a[I]===this.parent.rightBracket?w++:"q"===a[I]&&w--,I++;if(I===a.length)throw this.parent.formulaErrorStrings[e.FormulasErrorsStrings.cannot_parse];v=this.parent.substring(a,S,I-S+1),k&&(v="u"+v),C=I+1}else if(this.parent.isDigit(a[S])||a[S]===g){R=a[S]===g;for(S+=1;S<a.length&&(this.parent.isDigit(a[S])||!R&&a[S]===g);)a[S]===g&&(R=!0),S+=1;if(S<a.length&&"%"===a[S]&&(S+=1),R&&S<a.length&&a[S]===g)throw this.parent.formulaErrorStrings[e.FormulasErrorsStrings.number_contains_2_decimal_points];v="n"+this.parent.substring(a,o+1,S-o-1),C=S}else if(this.parent.isUpperChar(a[S])||a[S]===this.sheetToken||"u"===a[S]){if(a[S]===this.sheetToken)for(S+=1;S<a.length&&a[S]!==this.sheetToken;)S+=1;S+=1;for(var F=0,A=!1;S<a.length&&(this.parent.isUpperChar(a[S])||"_"===a[S]||a[S]===g||"["===a[S]||"]"===a[S]||"#"===a[S]||" "===a[S]||"%"===a[S]||a[S]===g&&A);)S!==a.length-1&&"["===a[S]&&"["===a[S+1]&&(A=!0),S!==a.length-1&&"]"===a[S]&&"]"===a[S+1]&&(A=!1),S++,F++;var N=S===a.length||!this.parent.isDigit(a[S]);if(F>1){for(;S<a.length&&(this.parent.isUpperChar(a[S])||this.parent.isDigit(a[S])||" "===a[S]||"_"===a[S]);)S++;N=!0}for(;S<a.length&&this.parent.isDigit(a[S]);)S+=1;if(S<a.length&&":"===a[S]){if((S+=1)<a.length&&a[S]===this.sheetToken){for(S++;S<a.length&&a[S]!==this.sheetToken;)S+=1;S<a.length&&a[S]===this.sheetToken&&S++}for(;S<a.length&&this.parent.isUpperChar(a[S]);)S+=1;for(;S<a.length&&this.parent.isDigit(a[S]);)S+=1;S-=1,v=this.parent.substring(a,o+1,S-o),v=this.parent.getCellFrom(v)}else S-=1,v=this.parent.substring(a,o+1,S-o),(k="u"===a[S])&&(v="u"+v);N&&v.startsWith(this.sheetToken)&&(N=!this.parent.isCellReference(v)),N||this.parent.updateDependentCell(v),(this.parent.namedRanges.size>0&&this.parent.namedRanges.has(v.toUpperCase())||this.parent.storedData.has(v.toUpperCase()))&&(v="n"+this.checkForNamedRangeAndKeyValue(v));var O=["*","+","-","/","w"].indexOf(a[S-v.length])>-1;v="TRUE"===v&&(b||O)?"n1":"FALSE"===v&&(b||O)?"n0":v,C=S+1}var T=s.indexOf(a[o]),D=this.parent.arithMarker+m+v+n[T]+this.parent.arithMarker;y>0&&(D=a.substring(0,y)+D),C<a.length&&(D+=a.substring(C)),a=D=D.split(this.parent.arithMarker2).join(this.parent.arithMarker.toString()),o=this.indexOfAny(a,i)}}else if(a.length>0&&(this.parent.isUpperChar(a[0])||a[0]===this.sheetToken)){var L=!0,P=!0,M=!1,H=a.length;for(I=0;I<H;++I)if(a[I]===this.sheetToken){if(I>0&&!M)throw this.parent.getErrorStrings()[e.CommonErrors.ref];for(M=!0,I++;I<H&&this.parent.isDigit(a[I]);)I++;if(I===H||a[I]!==this.sheetToken){L=!1;break}}else{if(!P&&this.parent.isChar(a[I])){L=!1;break}if(!this.parent.isChar(a[I])&&!this.parent.isDigit(a[I])&&a[I]!==this.sheetToken){L=!1;break}P=this.parent.isUpperChar(a[I])}L&&this.parent.updateDependentCell(a)}return a}catch(e){return e}},r.prototype.indexOfAny=function(e,t){for(var r=0;r<e.length;r++)if(t.indexOf(e[r])>-1)return r;return-1},r.prototype.findLeftMarker=function(e){var t=-1;if(e.indexOf(this.parent.arithMarker)>-1)for(var r=0,n=e.length-1;n>=0;--n)if(e[n]===this.parent.rightBracket)r--;else if(e[n]===this.parent.leftBracket)r++;else if(e[n]===this.parent.arithMarker&&0===r){t=n;break}return t},r.prototype.findRightMarker=function(e){var t=-1;if(e.indexOf(this.parent.arithMarker)>-1)for(var r=0,n=0;n<e.length;++n)if(e[n]===this.parent.rightBracket)r--;else if(e[n]===this.parent.leftBracket)r++;else if(e[n]===this.parent.arithMarker&&0===r){t=n;break}return t},r.prototype.parseFormula=function(r,n){if(r.length>0&&r[0]===this.parent.getFormulaCharacter()&&(r=r.substring(1)),r.indexOf("#REF!")>-1)return this.parent.getErrorStrings()[e.CommonErrors.ref];r.length>0&&"+"===r[0]&&(r=r.substring(1));try{this.isFailureTriggered=!1,this.isError=!1,r=this.parse(r.trim(),n),this.isFormulaParsed=!0}catch(e){var i=this.exceptionArgs(e);this.isFailureTriggered||(this.parent.trigger("onFailure",i),this.isFailureTriggered=!0);var a="string"==typeof i.exception?i.exception:i.message;r=(t.isNullOrUndefined(this.parent.getErrorLine(e))?"":"#"+this.parent.getErrorLine(e)+": ")+a,this.isError=!0}return r},r.prototype.markLibraryFormulas=function(r){var n=0,i=r.indexOf(")");if(-1===i)r=this.markNamedRanges(r);else for(;i>-1;){for(var a=0,o=i-1;o>-1&&("("!==r[o]||0!==a);)")"===r[o]&&a++,o--;if(-1===o)throw new ra(this.parent.formulaErrorStrings[e.FormulasErrorsStrings.mismatched_parentheses]);for(var s=o-1;s>-1&&this.parent.isChar(r[s]);)s--;var l=o-s-1,h=this.parent.substring(r,s+1,l);if(l>0&&!t.isNullOrUndefined(this.parent.getFunction(h))){var d=this.parent.substring(r,o,i-o+1),p=this.parent.getParseArgumentSeparator();if("AREAS"===h)this.ignoreBracet=!0;else if(this.ignoreBracet=!1,h.includes("IFS")&&"COUNTIFS"!==h&&d.includes("{")){var c=d.indexOf("{"),u=this.parent.substring(d,c,d.indexOf("}")-c+1);d=d.split(u).join(u.split(p).join(this.parent.tic+this.parent.tic))}try{var f=void 0;d=d.split("(").join("").split(")").join(""),d="("+this.formulaAutoCorrection(d,f)+")"}catch(t){if(!(f={message:t.message,exception:t,isForceCalculable:t.formulaCorrection,computeForceCalculate:!1}).isForceCalculable)throw this.parent.formulaErrorStrings[e.FormulasErrorsStrings.improper_formula];if(this.isFailureTriggered||(this.parent.trigger("onFailure",f),this.isFailureTriggered=!0,n+=1),f.computeForceCalculate=n>0||f.computeForceCalculate,!f.isForceCalculable)throw this.parent.formulaErrorStrings[e.FormulasErrorsStrings.improper_formula];if(!f.computeForceCalculate)throw this.parent.formulaErrorStrings[e.FormulasErrorsStrings.improper_formula];d=d.split("(").join("").split(")").join(""),d="("+this.formulaAutoCorrection(d,f)+")"}d=this.markNamedRanges(d),d=this.swapInnerParens(d);-1===(d=this.addParensToArgs(d)).lastIndexOf(p)&&d.length>2&&"("===d[0]&&")"===d[d.length-1]&&"{"!==d[1]&&"("!==d[1]&&(d=(d=d.substring(0,d.length-1)+"}"+d.substring(d.length-1))[0]+"{"+d.substring(1)),r=r.substring(0,s+1)+"q"+this.parent.substring(r,s+1,l)+d.split("(").join(this.parent.leftBracket).split(")").join(this.parent.rightBracket)+r.substring(i+1)}else{if(l>0)return this.parent.getErrorStrings()[e.CommonErrors.name];var g=this.emptyStr;o>0&&(g=r.substring(0,o)),g=g+"{"+this.parent.substring(r,o+1,i-o-1)+"}",i<r.length&&(g+=r.substring(i+1)),r=g=this.markNamedRanges(g)}i=r.indexOf(")")}return r=r.split("{").join("(").split("}").join(")")},r.prototype.swapInnerParens=function(e){return e.length>2&&(e=e[0]+e.substr(1,e.length-2).split("(").join("{").split(")").join("}")+e[e.length-1]),e},r.prototype.addParensToArgs=function(e){if(0===e.length)return this.emptyStr;var t=[];t.push(this.parent.getParseArgumentSeparator()),t.push(this.parent.rightBracket);var r=e.lastIndexOf(this.parent.getParseArgumentSeparator()),n=0;if(-1===r){if(e.length>2&&"("===e[0]&&")"===e[e.length-1])if("{"!==e[1]&&"("!==e[1])e=(e=e.substring(0,e.length-1)+"}"+e.substring(e.length-1))[0]+"{"+e.substring(1);else{r=this.lastIndexOfAny(e,["+","-","*","/"]),0===n&&")"===e[e.length-1]&&(n=e.length-1),n>0&&"{"!==e[r+1]&&"}"===e[r-1]&&(e=(e=e.substr(0,n)+"}"+e.substr(n)).substr(0,r+1)+"{"+e.substr(r+1))}}else for(var i=!0;r>-1;){var a=this.indexOfAny(e.substring(r+1,e.length),t);a>=0?a=r+a+1:-1===a&&")"===e[e.length-1]&&(a=e.length-1),a>0&&"{"!==e[r+1]&&"}"!==e[a-1]&&"¢"!==e[a-1]&&(e=(e=e.substr(0,a).trim()+"}"+e.substr(a)).substr(0,r+1)+"{"+e.substr(r+1).trim()),r=e.substr(0,r).lastIndexOf(this.parent.getParseArgumentSeparator()),i&&-1===r&&"("===e[0]&&(r=0,i=!1)}return e=e.split("{}").join(this.emptyStr)},r.prototype.lastIndexOfAny=function(e,t){for(var r=e.length-1;r>-1;r--)if(t.indexOf(e[r])>-1)return r;return-1},r.prototype.markNamedRanges=function(e){var r=[")",this.parent.getParseArgumentSeparator(),"}","+","-","*","/","<",">","=","&",":"],n=e.length>0&&("("===e[0]||"{"===e[0])?1:0;e.indexOf("#N/A")>-1&&(e=e.split("#N/A").join("#N~A")),e.indexOf("#DIV/0!")>-1&&(e=e.split("#DIV/0!").join("#DIV~0!"));for(var i=this.indexOfAny(e.substring(n),r);i>-1&&i+n<e.length;){var a=this.emptyStr,o=null;if(this.parent.substring(e,n,i).indexOf("[")>-1?o=this.getTableRange(this.parent.substring(e,n,i)):this.parent.storedData.has(this.parent.substring(e,n,i))?o=this.checkForNamedRangeAndKeyValue(this.parent.substring(e,n,i)):this.parent.namedRanges.has(this.parent.substring(e,n,i))&&(o=this.checkForNamedRangeAndKeyValue(this.parent.substring(e,n,i))),t.isNullOrUndefined(o)&&("NaN"!==(a=this.checkScopedRange(this.parent.substring(e,n,i)))?(this.findNamedRange=!0,o=a):this.parent.substring(e,n,i).startsWith(this.sheetToken.toString()),!t.isNullOrUndefined(o)&&this.findNamedRange&&o.indexOf(this.fixedReference)>-1&&(o=o.split(this.fixedReference).join(this.emptyStr))),t.isNullOrUndefined(o)||(o=o.toUpperCase(),o=this.parent.setTokensForSheets(o),o=this.markLibraryFormulas(o)),t.isNullOrUndefined(o)||o===this.emptyStr)for(n+=i+1;n<e.length&&!this.parent.isUpperChar(e[n])&&e[n]!==this.sheetToken;)n++;else e=e.substring(0,n)+o+e.substring(n+i),n+=o.length+1;for(i=n,n<e.length-1&&"{"===e[n]&&(n+=1),i=this.indexOfAny(e.substring(n),r);0===i&&n<e.length-1;)n++,i=this.indexOfAny(e.substring(n),r);if((-1===i||e.substring(n).indexOf("[")>-1)&&n<e.length){if(o=e.substring(n).indexOf("[")>-1?this.getTableRange(e.substring(n)):this.parent.storedData.has(e.substring(n))?this.parent.storedData.size>0?this.checkForNamedRangeAndKeyValue(e.substring(n)):o:this.parent.namedRanges.size>0?this.checkForNamedRangeAndKeyValue(e.substring(n)):o,t.isNullOrUndefined(o)&&"NaN"!==(a=this.checkScopedRange(e.substring(n)))&&(o=a),!t.isNullOrUndefined(o)&&o!==this.emptyStr&&(o=o.toUpperCase(),o=this.parent.setTokensForSheets(o),null!=(o=this.markLibraryFormulas(o)))){var s=e.substring(n);e=")"===s[s.length-1]?e.substring(0,n)+o+")":e.substring(0,n)+o,n+=o.toString().length+1}i=n<e.length?this.indexOfAny(e.substring(n),r):-1}}return e.indexOf("#N~A")>-1&&(e=e.split("#N~A").join("#N/A")),e.indexOf("#DIV~0!")>-1&&(e=e.split("#DIV~0!").join("#DIV/0!")),e},r.prototype.checkForNamedRangeAndKeyValue=function(e){var r=this.emptyStr;if(e.indexOf("[")>-1){var n=this.getTableRange(e);t.isNullOrUndefined(n)||(this.findNamedRange=!0,e=n)}if("NaN"!==(r=this.checkScopedRange(e)))this.findNamedRange=!0,e=r;else{if(e.indexOf(this.sheetToken)>-1){var i=this.parent.getSheetFamilyItem(this.parent.grid),a=e.split('"').join(this.emptyStr);if(a=a.substr(0,a.indexOf(this.sheetToken)),i.sheetNameToToken.has(a.toUpperCase()))parseInt(i.sheetNameToToken.get(a.toUpperCase()).split(this.sheetToken).join(this.emptyStr))}this.parent.storedData.size>0&&this.parent.storedData.has(e)&&(e="A"+this.parent.colIndex(e)),this.parent.namedRanges.size>0&&this.parent.namedRanges.has(e.toUpperCase())&&(t.isNullOrUndefined(this.parent.parentObject)?(e=this.parse(this.parent.namedRanges.get(e.toUpperCase())),(e=this.parent.setTokensForSheets(e)).indexOf(this.fixedReference)>-1&&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]&&(e=this.parent.setTokensForSheets(e)).indexOf(this.fixedReference)>-1&&(e=e.split(this.fixedReference).join(this.emptyStr))}return e},r.prototype.getTableRange=function(e){var t=(e=e.replace(" ",this.emptyStr).toUpperCase()).replace("]",this.emptyStr).replace("#DATA",this.emptyStr);t.indexOf(this.parent.getParseArgumentSeparator())>-1&&(t.substring(0,t.indexOf(this.parent.getParseArgumentSeparator())).replace("[",this.emptyStr),t=t.replace("[",this.emptyStr).replace(this.parent.getParseArgumentSeparator(),"_"));this.emptyStr;return t.toUpperCase()},r.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},r}(),Ji=function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),ea=function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},ta=function(r){function n(e){var n=r.call(this,null,null)||this;n.lFormulas=new Map,n.storedData=new Map,n.keyToRowsMap=new Map,n.rowsToKeyMap=new Map,n.rightBracket=String.fromCharCode(161),n.leftBracket=String.fromCharCode(162),n.sheetToken="!",n.emptyString="",n.leftBrace="{",n.rightBrace="}",n.cell=n.emptyString,n.cellPrefix="!0!A",n.treatEmptyStringAsZero=!1,n.tic='"',n.singleTic="'",n.trueValue="TRUE",n.falseValue="FALSE",n.parseDecimalSeparator=".",n.arithMarker=String.fromCharCode(180),n.arithMarker2=n.arithMarker+n.arithMarker,n.dependentCells=null,n.dependentFormulaCells=null,n.minValue=Number.MIN_SAFE_INTEGER,n.maxValue=Number.MAX_SAFE_INTEGER,n.categoryCollection=["All"],n.dependencyLevel=0,n.randomValues=new Map,n.isRandomVal=!1,n.randCollection=[],n.dependencyCollection=[],n.uniqueRange=[],n.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!"],n.errorStrings=null,n.parseArgumentSeparator=",",n.dateTime1900=new Date(1900,0,1,0,0,0),n.isParseDecimalSeparatorChanged=!1,n.isArgumentSeparatorChanged=!1,n.sheetFamilyID=0,n.defaultFamilyItem=null,n.sheetFamiliesList=null,n.modelToSheetID=null,n.tokenCount=0,n.sortedSheetNames=null,n.tempSheetPlaceHolder=String.fromCharCode(133),n.namedRanges=new Map,n.formulaInfoTable=null,n.oaDate=new Date(1899,11,30),n.millisecondsOfaDay=864e5,n.parseDateTimeSeparator="/";var a=new $i(n);return n.includeBasicFormulas&&i.Inject(Zi),n.injectedModules&&n.injectedModules.length&&a.inject(n.requiredModules(),n.injectedModules),n.parentObject=t.isNullOrUndefined(e)?n:e,n.grid=n.parentObject,n.parser=new Qi(n),n}Ji(n,r),i=n,Object.defineProperty(n.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}),n.prototype.getParseArgumentSeparator=function(){return this.isArgumentSeparatorChanged||","===this.parseArgumentSeparator||(this.parseArgumentSeparator=","),this.parseArgumentSeparator},n.prototype.setParseArgumentSeparator=function(e){this.parseArgumentSeparator=e,this.isArgumentSeparatorChanged=!0},n.prototype.getParseDateTimeSeparator=function(){return this.parseDateTimeSeparator},n.prototype.setTreatEmptyStringAsZero=function(e){this.treatEmptyStringAsZero=e},n.prototype.getTreatEmptyStringAsZero=function(){return this.treatEmptyStringAsZero},n.prototype.setParseDateTimeSeparator=function(e){this.parseDateTimeSeparator=e},n.prototype.requiredModules=function(){return Pe(this)},n.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])},n.prototype.getInjectedModules=function(){return this.injectedModules},n.prototype.onPropertyChanged=function(e,t){},n.prototype.getModuleName=function(){return"calculate"},n.prototype.getFormulaCharacter=function(){return"="},n.prototype.isUpperChar=function(e){var t=e.charCodeAt(0);return t>64&&t<91},n.prototype.resetKeys=function(){this.storedData.clear(),this.keyToRowsMap.clear(),this.rowsToKeyMap.clear()},n.prototype.updateDependentCell=function(e){var t=this.getSheetFamilyItem(this.grid),r=this.cell;if(r!==this.emptyString){if(null!==t.sheetNameToParentObject){var n=t.parentObjectToToken.get(this.grid);-1===r.indexOf(this.sheetToken)&&(r=n+r),-1===e.indexOf(this.sheetToken)&&(e=n+e)}if(this.getDependentCells().has(e)){var i=this.getDependentCells().get(e);i.indexOf(r)<0&&r!==e&&i.push(r)}else this.getDependentCells().set(e,[r]);this.addToFormulaDependentCells(e)}},n.prototype.addToFormulaDependentCells=function(e){var t=this.cell,r=this.getSheetFamilyItem(this.grid);if(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))},n.prototype.getDependentCells=function(){return null==this.dependentCells&&(this.dependentCells=new Map),this.dependentCells},n.prototype.getDependentFormulaCells=function(){if(this.isSheetMember()){var e=this.getSheetFamilyItem(this.grid);return null==e.sheetDependentFormulaCells&&(e.sheetDependentFormulaCells=new Map),e.sheetDependentFormulaCells}return null==this.dependentFormulaCells&&(this.dependentFormulaCells=new Map),this.dependentFormulaCells},n.prototype.getLibraryFormulas=function(){return this.lFormulas},n.prototype.getFunction=function(e){return this.getLibraryFormulas().has(e.toUpperCase())?this.getLibraryFormulas().get(e.toUpperCase()).handler:null},n.prototype.intToDate=function(e){var t=Number(e);(t=t>0&&t<1?1+t:0===t?1:t)>60&&(t-=1);var r=new Date("01/01/1900"),n=Date.UTC(r.getFullYear(),r.getMonth(),r.getDate(),r.getHours(),r.getMinutes(),r.getSeconds(),r.getMilliseconds());return new Date(new Date(864e5*(t-1)+n).toUTCString().replace(" GMT",""))},n.prototype.getFormulaInfoTable=function(){if(this.isSheetMember()){var e=this.getSheetFamilyItem(this.grid);return null===e.sheetFormulaInfotable&&(e.sheetFormulaInfotable=new Map),e.sheetFormulaInfotable}return null===this.formulaInfoTable&&(this.formulaInfoTable=new Map),this.formulaInfoTable},n.prototype.getFormula=function(e){return e=e.toUpperCase(),this.storedData.has(e)?this.storedData.get(e).getFormulaText():""},n.prototype.getParseDecimalSeparator=function(){return this.isParseDecimalSeparatorChanged||"."===this.parseDecimalSeparator||(this.parseDecimalSeparator="."),this.parseDecimalSeparator},n.prototype.setParseDecimalSeparator=function(e){this.parseDecimalSeparator=e,this.isParseDecimalSeparatorChanged=!0},n.prototype.getSheetToken=function(t){var r=0,n=this.emptyString;if(r<t.length&&t[r]===this.sheetToken){for(r++;r<t.length&&t[r]!==this.sheetToken;)r++;n=t.substring(0,r+1)}if(r<t.length)return n;throw this.formulaErrorStrings[e.FormulasErrorsStrings.bad_index]},n.prototype.getSheetID=function(e){var t=this.getSheetFamilyItem(e);if(null!=t.sheetNameToParentObject&&t.sheetNameToParentObject.size>0){var r=t.parentObjectToToken.get(e);if(r){r=r.split(this.sheetToken).join(this.emptyString);var n=this.parseFloat(r);if(!this.isNaN(n))return n}}return-1},n.prototype.parseFloat=function(e){var t=Number(e);return isNaN(t)&&"string"==typeof e&&e.includes(",")&&(t=Number(e.split(",").join(""))),t},n.prototype.rowIndex=function(t){var r=0,n=!1;if(r<t.length&&t[r]===this.sheetToken){for(r++;r<t.length&&t[r]!==this.sheetToken;)r++;r++}for(;r<t.length&&this.isChar(t[r]);)n=!0,r++;var i=parseInt(t.substring(r),10);if(r<t.length&&!this.isNaN(i))return i;if(n)return-1;throw this.formulaErrorStrings[e.FormulasErrorsStrings.bad_index]},n.prototype.colIndex=function(e){var t=0,r=0;if(e=e.toUpperCase(),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=26*r+e[t].charCodeAt(0)-64,t++}return 0===r?-1:r},n.prototype.getErrorStrings=function(){return null===this.errorStrings&&(this.errorStrings=["#N/A","#VALUE!","#REF!","#DIV/0!","#NUM!","#NAME?","#NULL!"]),this.errorStrings},n.prototype.substring=function(e,t,r){return e.substring(t,r+t)},n.prototype.isChar=function(e){return e.charCodeAt(0)>=65&&e.charCodeAt(0)<=90||e.charCodeAt(0)>=97&&e.charCodeAt(0)<=122},n.prototype.getSheetFamilyItem=function(e,t){return 0===this.sheetFamilyID?(null==this.defaultFamilyItem&&(this.defaultFamilyItem=new ia),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 ia),this.sheetFamiliesList.get(t))},n.prototype.setKeyValue=function(e,t){e=e.toUpperCase();var r=t.toString().trim();this.storedData.get(e)&&0!==r.indexOf(this.leftBrace)||(this.storedData.set(e,new na),this.keyToRowsMap.set(e,this.keyToRowsMap.size+1),this.rowsToKeyMap.set(this.rowsToKeyMap.size+1,e));var n=this.storedData.get(e);if(null!=n.getFormulaText()&&n.getFormulaText().length>0&&n.getFormulaText()!==r){var i=this.cellPrefix+this.keyToRowsMap.get(e).toString();null!=this.getDependentFormulaCells().get(i)&&this.clearFormulaDependentCells(i)}r.length>0&&r[0]===this.getFormulaCharacter()?n.setFormulaText(r):n.getFormulaValue()!==r&&(n.setFormulaText(""),n.setParsedFormula(""),n.setFormulaValue(r))},n.prototype.clearFormulaDependentCells=function(e){var t=this,r=this.getDependentFormulaCells().get(e);r&&(r.forEach(function(r,n){var i=n,a=t.getDependentCells().get(i);t.arrayRemove(a,e),0===a.length&&t.getDependentCells().delete(i)}),this.getDependentFormulaCells().delete(e))},n.prototype.arrayRemove=function(e,t){var r=e.indexOf(t);return-1!==r&&e.splice(r,1),e},n.prototype.getKeyValue=function(e){if(e=e.toUpperCase(),null!==this.storedData.has(e)){var r=this.storedData.get(e),n=r.getFormulaText();if(n.length>0&&n[0]===this.getFormulaCharacter()){this.cell=this.cellPrefix+this.keyToRowsMap.get(e).toString(),n=n.substring(1);try{r.setParsedFormula(this.parser.parseFormula(n,e))}catch(t){var i={message:t.message,exception:t,isForceCalculable:!1,computeForceCalculate:!1};return this.trigger("onFailure",i),r.setFormulaValue(i.message),this.storedData.get(e).getFormulaValue()}try{r.setFormulaValue(this.computeFormula(r.getParsedFormula()))}catch(e){i={message:e.message,exception:e,isForceCalculable:!1,computeForceCalculate:!1};this.trigger("onFailure",i);var a="string"==typeof i.exception?i.exception:i.message;return(t.isNullOrUndefined(this.getErrorLine(e))?"":"#"+this.getErrorLine(e)+": ")+a}}return this.storedData.get(e).getFormulaValue()}return this.emptyString},n.prototype.getNamedRanges=function(){return this.namedRanges},n.prototype.addNamedRange=function(e,t){var r=e.split(this.sheetToken);if(r.length>1){var n=this.getSheetId(this.grid).toString();if(!this.getSheetFamilyItem(n).parentObjectToToken.get(n))return!1;e=r[0]+this.sheetToken+r[1].toUpperCase()}else e=e.toUpperCase();return this.namedRanges.set(e,t),!0},n.prototype.updateNamedRange=function(e,t){var r=new Map;this.namedRanges.forEach(function(n,i){var a=i;if(i.includes(e)){var o=i.split("!");o[0]=t,a=o.join("!")}r.set(a,n)}),this.namedRanges=r},n.prototype.removeNamedRange=function(e){return e=e.toUpperCase(),null!=this.namedRanges.get(e)&&(this.namedRanges.delete(e),!0)},n.prototype.convertAlpha=function(e){for(var t=[],r=0;e>0;){e--;var n="A".charCodeAt(0);t[r]=String.fromCharCode(e%26+n),e=parseInt((e/26).toString(),10),r++}for(var i=[],a=0;a<r;a++)i[r-a-1]=t[a];return i.join("")},n.prototype.getCellCollection=function(e){if(e.indexOf(":")<0){if(!this.isCellReference(e))return e.split(this.getParseArgumentSeparator());e=e+":"+e}var t=this.emptyString,r=e.indexOf(this.sheetToken);if(r>-1)for(var n=r+1;n<e.length;){if(e[n]===this.sheetToken){t=e.substr(0,n+1);break}n++}var i,a,o,s,l=e.indexOf(":");if(l>0&&this.isChar(e[l-1]))for(var h=l-2;h>=0&&this.isDigit(e[h]);)h--;i=this.rowIndex(this.substring(e,0,l)),a=this.rowIndex(this.substring(e,l+1,l+e.length-l-1)),o=this.colIndex(this.substring(e,0,l)),s=this.colIndex(this.substring(e,l+1,l+e.length-l-1)),i>a&&(l=a,a=i,i=l),o>s&&(l=s,s=o,o=l);var d,p=[],c=0;for(l=i;l<=a;l++)for(d=o;d<=s;d++)p[c]=t+this.emptyString+this.convertAlpha(d)+l.toString(),c++;return p},n.prototype.computeFormula=function(e,t){return this.calculateFormula(e,!1,t)},n.prototype.calculateFormula=function(r,n,i){var a,o,s,l,h=this,d=!1;if(this.parser.isError)return r;a=this.parser.isFormulaParsed?r:this.parser.parseFormula(r),this.parser.isFormulaParsed=!1;try{if((o=this.findLastIndexOfq(a))>0&&(d=!0),a!==this.emptyString&&o>-1)for(var p=o+1,c=function(){if(a[p]!==u.rightBracket)return p++,"continue";var r=a.substring(o,p+1),c=r.split(u.leftBracket)[0].split("q").join(u.emptyString),f=void 0;if(u.getLibraryFormulas().get(c.toUpperCase()).isCustom){f=r.substring(r.indexOf(u.leftBracket)+1,r.indexOf(u.rightBracket)).split(u.getParseArgumentSeparator());var g=0,m=[],v=void 0;for(g=0;g<f.length;g++)f[g].includes(":")&&u.isCellReference(f[g])&&(v=u.getCellCollection(f[g])).length>1?(m.push(f[g]),v.forEach(function(e){h.updateDependentCell(e)})):m.push(u.getValueFromArg(f[g]));f=m}else{var y=r.substring(r.indexOf(u.leftBracket)+1,r.indexOf(u.rightBracket));f=[];for(var C=u.getParseArgumentSeparator(),b="",x=void 0,S=0,w=y.length-1;S<=w;S++)'"'===y[S]&&(x=!x),y[S]!==C||x?(b+=y[S],S===w&&f.push(b)):(f.push(b),b="",S===w&&f.push(b));if(f.length||(f=[""]),d&&c){["IF","INDEX","SORT","T","EXACT","PROPER","DOLLAR","DATE"].some(function(e){return e===c})&&f.push("nestedFormulaTrue"),"IF"===c&&f.push("nestedFormulaTrue")}i&&"UNIQUE"===c&&f.push("isComputeExp")}if(s=t.isNullOrUndefined(u.getFunction(c))?u.getErrorStrings()[e.CommonErrors.name]:u.getFunction(c).apply(void 0,f),d){l=u.processNestedFormula(a,r,s);var I=u.findLastIndexOfq(l);return 0===I&&(d=!1),-1===I&&(s=u.computeValue(l,n)),o=p=I,a=l,"continue"}return"break"},u=this;p>-1;){if("break"===c())break}else this.formulaErrorStrings.indexOf(a)>-1?s=a:a!==this.emptyString&&-1===o&&(s=this.computeValue(a,n))}catch(e){var f={message:e.message,exception:e,isForceCalculable:!1,computeForceCalculate:!1};this.trigger("onFailure",f);var g="string"==typeof f.exception?f.exception:f.message;s=(t.isNullOrUndefined(this.getErrorLine(e))?"":"#"+this.getErrorLine(e)+": ")+g}return s},n.prototype.computeSumIfAndAvgIf=function(r,n){if(t.isNullOrUndefined(r)||r[0]===this.emptyString||0===r.length)return this.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];for(var i=r,a=0;a<i.length;a++)if(this.isCellReference(i[a])&&t.isNullOrUndefined(i[a].match(/[0-9]/))&&i[a].indexOf("!")<0){var o=i[a].split(":");i[a]=o[0]+"1:"+o[1]+this.spreadSheetUsedRange[0]}var s=i.length;if(2!==s&&3!==s&&0===s)return this.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];if(""===i[1])return n?this.getErrorStrings()[e.CommonErrors.divzero]:"0";var l=i[0],h=i[1].startsWith(this.tic)&&i[1].endsWith(this.tic),d=i[1].split(this.tic).join(this.emptyString);if(d.length>255)return this.getErrorStrings()[e.CommonErrors.value];var p=d.includes("*"),c=d.includes("?"),u=p?d.replace(/\*/g,"").trim():d,f=!1;if(!h&&this.isCellReference(u)&&(u=this.getValueFromArg(u),f=!0),p){var g=d.indexOf("*");"*"===d[0]&&(u="*"+u),"*"===d[d.length-1]&&(u+="*"),g>0&&g<d.length-1&&(u=d.substring(0,g)+"*"+d.substring(g+1))}d=u;var m=this.parser.tokenEqual;d.startsWith("<=")?(m=this.parser.tokenLessEq,d=d.substring(2)):d.startsWith(">=")?(m=this.parser.tokenGreaterEq,d=d.substring(2)):d.startsWith("<>")?(m=this.parser.tokenNotEqual,d=d.substring(2)):d.startsWith("<")?(m=this.parser.tokenLess,d=d.substring(1)):d.startsWith(">")?(m=this.parser.tokenGreater,d=d.substring(1)):d.startsWith("=")&&(m=this.parser.tokenEqual,d=d.substring(1)),(!h&&this.isCellReference(d)&&!f||d.includes(this.arithMarker)||d.includes(this.getParseDecimalSeparator())&&!p&&!c)&&(d=this.getValueFromArg(d));var v=this.parseFloat(d),y=i[0],C=this.getCellCollection(s>2?i[2]:l),b=this.getCellCollection(y);if(b.length>C.length){var x=this.colIndex(C[C.length-1])+this.colIndex(b[b.length-1])-this.colIndex(b[0]),S=i[2].split(":");S[1]=(this.convertAlpha(x)+this.rowIndex(b[b.length-1])).toString(),C=this.getCellCollection(S.join(":"))}var w=this.getComputeSumIfValue(b,C,d.toLowerCase(),v,m,p,c);return[w[0],w[1]]},n.prototype.computeLookup=function(r){var n,i,a,o,s,l,h=[],d=[],p=[],u=[],f=[],g=r,m=g.length;if(1===m||m>3)return this.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];if(""===g[1]||""===g[2])return this.getErrorStrings()[e.CommonErrors.value];if(s=this.getValueFromArg(g[0]),g[0].indexOf(this.tic)>-1&&g[0].toUpperCase().split(this.tic).join("")!==this.trueValue&&g[0].toUpperCase().split(this.tic).join("")!==this.falseValue&&this.isNaN(this.parseFloat(g[0].split(this.tic).join("")))&&(s=s.split(this.tic).join("")),this.getErrorStrings().indexOf(s)>-1)return s;var v=g[1].split(":");if(2===v.length&&this.isCellReference(v[0])&&this.isCellReference(v[1])&&2===m){var y=g[1].indexOf(":"),C=this.rowIndex(this.substring(g[1],0,y)),b=this.colIndex(this.substring(g[1],0,y)),x=this.rowIndex(this.substring(g[1],y+1,y+g[1].length-y-1)),S=this.colIndex(this.substring(g[1],y+1,y+g[1].length-y-1));C>x&&(C=(n=[x,C])[0],x=n[1]),b>S&&(b=(i=[S,b])[0],S=i[1]);var w="";0===g[1].indexOf("!")&&(w=(w=(w=g[1]).replace("!","")).indexOf("!"),w=g[1].substring(0,w+2));var I=S-b+1,E=x-C+1;E>I||E===I?(a=w+Be(b)+C+":"+Be(b)+x,o=w+Be(S)+C+":"+Be(S)+x):E<I&&(a=w+Be(b)+C+":"+Be(S)+C,o=w+Be(b)+x+":"+Be(S)+x),C===x&&b===S||(l=!0)}if(l)h=this.getCellCollection(a),d=this.getCellCollection(o);else{h=this.getCellCollection(g[1]);var R=2===m?g[1]:g[2];d=this.getCellCollection(R);var k=c(g[1]),F=c(R),A=k[1]===k[3]||k[0]===k[2],N=F[1]===F[3]||F[0]===F[2];if(!A||!N)return this.getErrorStrings()[e.CommonErrors.na]}for(var O=0;O<h.length;O++)u.push(this.getValueFromArg(h[O]).split(this.tic).join(""));var T=u.map(function(e){return""===e?NaN:Number(e)}).sort(function(e,t){return e-t}),D=T[T.length-1],L=T[0],P=this.parseFloat(s);if(this.isNaN(P)){for(var M=0;M<h.length;M++)if(p[M]=this.getValueFromArg(h[M]).split(this.tic).join(""),!t.isNullOrUndefined(d[M])&&""!==s&&""!==p[M])if(s.toUpperCase()===p[M].toUpperCase())f.push(this.getValueFromArg(d[M]).split(this.tic).join("")||"0");else if(s.indexOf("*")>-1||s.indexOf("?")>-1){var H=s;if(s.indexOf("*")>-1){H=H.replace(/\*/g,"").trim(),this.isCellReference(H)&&(H=this.getValueFromArg(H));var B=s.indexOf("*");"*"===s[0]&&(H="*"+H),"*"===s[s.length-1]&&(H+="*"),B>0&&B<s.length-1&&(H=s.substring(0,B)+"*"+s.substring(B+1))}var U=[],V=this.findWildCardValue(H.toLowerCase(),p[M].toLowerCase());U.push(V),U.push(s),this.processLogical(U,"equal")===this.trueValue&&f.push(this.getValueFromArg(d[M]).split(this.tic).join("")||"0")}}else for(var _=0;_<T.length;_++)p[_]=T[_].toString().split(this.tic).join(""),t.isNullOrUndefined(d[_])||""===p[_]||P!==this.parseFloat(p[_])||f.push(this.getValueFromArg(d[_]).split(this.tic).join("")||"0");if(f.length>0)return f[f.length-1];if(P>D&&!t.isNullOrUndefined(d[h.length-1]))return this.getValueFromArg(d[h.length-1]).split(this.tic).join("")||"0";if(P<L)return this.getErrorStrings()[e.CommonErrors.na];if(u.indexOf(s.split(this.tic).join(""))<0&&s!==this.trueValue&&s!==this.falseValue)if(this.isNaN(P)||this.isNaN(D)||this.isNaN(L)){if(this.isNaN(P)&&""!==s&&/^[a-zA-Z!@#$%^&*()_+{}\[\]:;<>,.?~\\/-]/.test(s)){var z=u.sort();y=this.findClosestMatch(s.split(this.tic).join(""),z);if(!t.isNullOrUndefined(d[y])&&y>=0)return this.getValueFromArg(d[y]).split(this.tic).join("")||"0"}}else{for(var j=[],q=0;q<T.length;q++)P>T[q]&&j.push(T[q]);var y=j.length-1;if(!t.isNullOrUndefined(d[y])&&y>=0)return this.getValueFromArg(d[y]).split(this.tic).join("")||"0"}return this.getErrorStrings()[e.CommonErrors.na]},n.prototype.computeVHLookup=function(r,n){var i,a,o,s,l,h,d,p=[],c=[],u=[],f=r,g=n?this.trueValue:this.falseValue;if(""===f[0]||""===f[1])return this.getErrorStrings()[e.CommonErrors.na];if(o=this.getValueFromArg(f[0]),f[0].indexOf(this.tic)>-1&&f[0].toUpperCase().split(this.tic).join("")!==this.trueValue&&f[0].toUpperCase().split(this.tic).join("")!==this.falseValue&&this.isNaN(this.parseFloat(f[0].split(this.tic).join("")))&&(o=o.split(this.tic).join("")),this.getErrorStrings().indexOf(o)>-1)return o;s=(s=this.isCellReference(f[2])||f[2].includes(this.arithMarker)?this.getValueFromArg(f[2])||"0":this.getValueFromArg(f[2]).split(this.tic).join("")).toUpperCase()===this.trueValue?"1":s.toUpperCase()===this.falseValue?"0":s;var m=this.parseFloat(s),v=f[1].split(":");if(this.isCellReference(v[0])&&this.isCellReference(v[1])){var y=f[1].indexOf(":"),C=this.rowIndex(this.substring(f[1],0,y)),b=this.colIndex(this.substring(f[1],0,y)),x=this.rowIndex(this.substring(f[1],y+1,y+f[1].length-y-1)),S=this.colIndex(this.substring(f[1],y+1,y+f[1].length-y-1));C>x&&(C=(i=[x,C])[0],x=i[1]),b>S&&(b=(a=[S,b])[0],S=a[1]);var w="";0===f[1].indexOf("!")&&(w=(w=(w=f[1]).replace("!","")).indexOf("!"),w=f[1].substring(0,w+2)),l=g===this.trueValue?w+Be(b)+C+":"+Be(b)+x:w+Be(b)+C+":"+Be(S)+C;var I=void 0;if(g===this.trueValue){if((I=b+m-1)>S)return this.getErrorStrings()[e.CommonErrors.ref]}else if((I=C+m-1)>x)return this.getErrorStrings()[e.CommonErrors.ref];if(m<1||this.isNaN(m))return this.getErrorStrings()[e.CommonErrors.value];h=g===this.trueValue?w+Be(I)+C+":"+Be(I)+x:w+Be(b)+I+":"+Be(S)+I}if(f[3]=f[3]?f[3]:this.trueValue,this.isCellReference(f[3])?f[3]=this.getValueFromArg(f[3]):f[3]=this.getValueFromArg(f[3]).split(this.tic).join(""),this.getErrorStrings().indexOf(f[3])>-1)return f[3];if(f[3].toUpperCase()===this.falseValue||"0"===f[3])d=this.falseValue;else{if(f[3].toUpperCase()!==this.trueValue&&"1"!==f[3])return this.getErrorStrings()[e.CommonErrors.value];d=this.trueValue}for(var E=this.getCellCollection(l),R=this.getCellCollection(h),k=0;k<E.length;k++)c.push(this.getValueFromArg(E[k]).split(this.tic).join(""));var F=this.parseFloat(o);if("FALSE"===d){for(var A=0;A<E.length;A++)if(p[A]=this.getValueFromArg(E[A]).split(this.tic).join(""),!t.isNullOrUndefined(R[A]))if(this.isNaN(F)||""===p[A]||F!==this.parseFloat(p[A])){if(""!==p[A]&&o.toUpperCase()===p[A].toUpperCase())u.push(this.getValueFromArg(R[A]).split(this.tic).join("")||"0");else if(o.indexOf("*")>-1||o.indexOf("?")>-1){var N=o;if(o.indexOf("*")>-1){N=N.replace(/\*/g,"").trim(),this.isCellReference(N)&&(N=this.getValueFromArg(N));var O=o.indexOf("*");"*"===o[0]&&(N="*"+N),"*"===o[o.length-1]&&(N+="*"),O>0&&O<o.length-1&&(N=o.substring(0,O)+"*"+o.substring(O+1))}var T=[],D=this.findWildCardValue(N.toLowerCase(),p[A].toLowerCase());T.push(D),T.push(o),this.processLogical(T,"equal")===this.trueValue&&u.push(this.getValueFromArg(R[A]).split(this.tic).join("")||"0")}}else u.push(this.getValueFromArg(R[A]).split(this.tic).join("")||"0");return u.length>0?u[0]:this.getErrorStrings()[e.CommonErrors.na]}if("TRUE"===d){for(var L=c.map(function(e){return""===e?NaN:Number(e)}).sort(function(e,t){return e-t}),P=L[L.length-1],M=L[0],H=o.toUpperCase(),B=0;B<E.length;B++)p[B]=this.getValueFromArg(E[B]).split(this.tic).join(""),t.isNullOrUndefined(R[B])||""===o||""===p[B]||H!==this.trueValue&&H!==this.falseValue||H!==p[B].toUpperCase()?t.isNullOrUndefined(R[B])||""===o||""===p[B]||H!==p[B].toUpperCase()||u.push(this.getValueFromArg(R[B]).split(this.tic).join("")||"0"):u.push(this.getValueFromArg(R[B]).split(this.tic).join("")||"0");for(var U=0;U<L.length;U++)p[U]=L[U].toString().split(this.tic).join(""),t.isNullOrUndefined(R[U])||""===o||this.isNaN(F)||""===p[U]||F!==this.parseFloat(p[U])||u.push(this.getValueFromArg(R[U]).split(this.tic).join("")||"0");if(u.length>0)return u[u.length-1];if(o.indexOf("*")>-1||o.indexOf("?")>-1||H.split(this.tic).join("")===this.trueValue||H.split(this.tic).join("")===this.falseValue)return this.getErrorStrings()[e.CommonErrors.na];if(F>P&&!t.isNullOrUndefined(R[E.length-1]))return this.getValueFromArg(R[E.length-1]).split(this.tic).join("");if(c.indexOf(o.split(this.tic).join(""))<0&&o!==this.trueValue&&o!==this.falseValue)if(this.isNaN(F)||""===o||this.isNaN(P)||this.isNaN(M)){if(this.isNaN(F)&&""!==o&&this.isNaN(P)&&this.isNaN(M)){var V=c.sort();y=this.findClosestMatch(o.split(this.tic).join(""),V);if(!t.isNullOrUndefined(R[y])&&y>=0)return this.getValueFromArg(R[y]).split(this.tic).join("")||"0"}}else{for(var _=[],z=0;z<L.length;z++)F>L[z]&&_.push(L[z]);var y=_.length-1;if(!t.isNullOrUndefined(R[y])&&y>=0)return this.getValueFromArg(R[y]).split(this.tic).join("")||"0"}}return this.getErrorStrings()[e.CommonErrors.na]},n.prototype.findClosestMatch=function(e,t){for(var r=0,n=t.length-1;r<=n;){var i=Math.floor((r+n)/2),a=t[i],o=this.compareStrings(e.toLowerCase(),a.toLowerCase());if(0===o)return i;1===o?r=i+1:n=i-1}for(var s=r-1;s>=0;s--)if(-1!==this.compareStrings(e.toLowerCase(),t[s].toLowerCase()))return s;return-1},n.prototype.compareStrings=function(e,t){for(var r=Math.min(e.length,t.length),n=0;n<r;n++){var i=e.charCodeAt(n),a=t.charCodeAt(n);if(i<a)return-1;if(i>a)return 1}return e.length<t.length?-1:e.length>t.length?1:0},n.prototype.findWildCardValue=function(e,t){var r="";if(e.indexOf("?")>-1){var n=RegExp(e.replace(/\?/g,"[\\s\\S]"));r=t.length===e.length&&this.isNaN(this.parseFloat(t))&&t.match(n)?e:t}else if(e.indexOf("*")>-1){for(var i=e.indexOf("*"),a="",o="",s=this.falseValue,l=this.falseValue,h=i-1;h>=0;h--)a+=e[h],l=this.trueValue;for(h=i+1;h<e.length;h++)o+=e[h],s=this.trueValue;var d=""===a?-1:t.indexOf(a.split("").reverse().join("")),p=""===o?-1:t.indexOf(o);if(d>-1||p>-1){var c=a.split("").reverse().join("")===t.substr(0,a.length),u=o===t.substring(t.length-o.length,t.length);l===this.trueValue&&s===this.trueValue&&this.isNaN(this.parseFloat(a))&&this.isNaN(this.parseFloat(o))?r=c&&u?e:t:l===this.trueValue&&this.isNaN(this.parseFloat(a))?r=c?e:t:s===this.trueValue&&this.isNaN(this.parseFloat(o))&&(r=u?e:t)}else r=t}return r},n.prototype.getComputeSumIfValue=function(e,t,r,n,i,a,o){var s=0,l=0;switch(i){case this.parser.tokenEqual:for(var h=a?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);if(c===r&&u===n){var f=this.getValueFromArg(t[d].split(this.tic).join("")),g=this.parseFloat(f);this.isNaN(g)||(s+=g,l+=1)}else if(c===r)this.isNaN(p)||(s+=p,l+=1);else if(a&&h&&c&&this.isNaN(this.parseFloat(c))){var m=r.indexOf("*");"*"===r[0]&&h.length<=c.length&&h===c.slice(c.length-h.length,c.length)?this.isNaN(p)||(s+=p,l+=1):"*"===r[r.length-1]&&h.length<=c.length&&h===c.slice(0,h.length)?this.isNaN(p)||(s+=p,l+=1):m>-1&&c.startsWith(r.substr(0,m))&&c.endsWith(r.substr(m+1))&&(this.isNaN(p)||(s+=p,l+=1))}else if(a&&!h&&c&&this.isNaN(this.parseFloat(c)))this.isNaN(p)||(s+=p,l+=1);else if(o&&h&&c&&this.isNaN(this.parseFloat(c))){var v=RegExp(h.replace(/\?/g,"[\\s\\S]"));c.length===r.length&&c.match(v)&&(this.isNaN(p)||(s+=p,l+=1))}}break;case this.parser.tokenLess:for(d=0;d<e.length;d++){c=this.getValueFromArg(e[d].split(this.tic).join(""));if((u=this.parseFloat(c))<n){f=this.getValueFromArg(t[d].split(this.tic).join("")),g=this.parseFloat(f);this.isNaN(g)||(s+=g,l+=1)}}break;case this.parser.tokenGreater:for(d=0;d<e.length;d++){c=this.getValueFromArg(e[d].split(this.tic).join(""));if((u=this.parseFloat(c))>n){f=this.getValueFromArg(t[d].split(this.tic).join("")),g=this.parseFloat(f);this.isNaN(g)||(s+=g,l+=1)}}break;case this.parser.tokenLessEq:for(d=0;d<e.length;d++){c=this.getValueFromArg(e[d].split(this.tic).join(""));if((u=this.parseFloat(c))<=n){f=this.getValueFromArg(t[d].split(this.tic).join("")),g=this.parseFloat(f);this.isNaN(g)||(s+=g,l+=1)}}break;case this.parser.tokenGreaterEq:for(d=0;d<e.length;d++){c=this.getValueFromArg(e[d].split(this.tic).join(""));if((u=this.parseFloat(c))>=n){f=this.getValueFromArg(t[d].split(this.tic).join("")),g=this.parseFloat(f);this.isNaN(g)||(s+=g,l+=1)}}break;case this.parser.tokenNotEqual:for(h=a?r.replace(/\*/g,""):r,d=0;d<e.length;d++){p=this.getValueFromRange(t,d),c=this.getValueFromArg(e[d].split(this.tic).join("")).toLowerCase(),u=this.parseFloat(c);if(c===r||u===n||a||o)if(a&&h&&c&&this.isNaN(this.parseFloat(c))){m=r.indexOf("*");"*"===r[0]&&h.length<=c.length&&h!==c.slice(c.length-h.length,c.length)?this.isNaN(p)||(s+=p,l+=1):"*"===r[r.length-1]&&h.length<=c.length&&h!==c.slice(0,h.length)?this.isNaN(p)||(s+=p,l+=1):(m>-1&&!c.startsWith(r.substr(0,m))||!c.endsWith(r.substr(m+1)))&&(this.isNaN(p)||(s+=p,l+=1))}else if(!a||h||this.isNaN(this.parseFloat(c))){if(o&&h&&c&&this.isNaN(this.parseFloat(c))){v=RegExp(h.replace(/\?/g,"[\\s\\S]"));c.length===r.length&&c.match(v)||this.isNaN(p)||(s+=p,l+=1)}}else this.isNaN(p)||(s+=p,l+=1);else{f=this.getValueFromArg(t[d].split(this.tic).join("")),g=this.parseFloat(f);this.isNaN(g)||(s+=g,l+=1)}}}return[s,l]},n.prototype.getValueFromRange=function(e,t){var r=e[t];return r=this.getValueFromArg(r),this.parseFloat(r.toString())},n.prototype.computeAndOrNot=function(t,r){for(var n,i,a=this,o="and"===r,s="or"===r,l="not"===r,h=!(!o&&!l),d=[],p=t,c=0;c<p.length;c++){if(p[c]===this.tic)return this.getErrorStrings()[e.CommonErrors.value];if(this.isCellReference(p[c]))for(var u=this.getCellCollection(p[c]),f=0;f<u.length;f++){if(this.getErrorStrings().indexOf(u[f])>-1)return u[f];if(u[f][0]===this.tic)return this.getErrorStrings()[e.CommonErrors.name];if(n=this.getValueFromArg(u[f]),this.getErrorStrings().indexOf(n)>-1)return n;i=this.parseFloat(n),n===this.falseValue||""!==n&&0===i||l&&""===n?d.push(this.falseValue):n===this.trueValue||!isNaN(i)&&""!==n?d.push(this.trueValue):(""===n||isNaN(i))&&d.push(this.getErrorStrings()[e.CommonErrors.value])}else{if(n=this.getValueFromArg(p[c]).split(this.tic).join("").toUpperCase(),this.getErrorStrings().indexOf(n)>-1)return n;i=this.parseFloat(n),n===this.falseValue||""===p[c]||""!==n&&0===i?d.push(this.falseValue):n===this.trueValue||!isNaN(i)&&""!==n?d.push(this.trueValue):(""===n||isNaN(i))&&d.push(this.getErrorStrings()[e.CommonErrors.value])}}if(d.every(function(t){return t===a.getErrorStrings()[e.CommonErrors.value]}))return this.getErrorStrings()[e.CommonErrors.value];for(f=0;f<d.length;f++){if((o||l)&&d[f]===this.falseValue){h=!1;break}if(s&&d[f]===this.trueValue){h=!0;break}}return(h=l?!h:h)?this.trueValue:this.falseValue},n.prototype.removeTics=function(e){return e.length>1&&e[0]===this.tic[0]&&e[e.length-1]===this.tic[0]&&(e=this.substring(e,1,e.length-2)),e},n.prototype.getCellFrom=function(e){var t,r="",n=e.indexOf(":")>-1?e.split(":"):[e],i=n.length-1,a=this.rowIndex(n[0]);if(a===this.rowIndex(n[i])){var o=this.colIndex(n[0]),s=this.colIndex(n[i]),l=this.colIndex(this.cell);l>=o&&l<=s&&(r=Be(l).toString()+a.toString())}else if(this.colIndex(n[0])===this.colIndex(n[i])){t=this.colIndex(n[0]);var h=this.rowIndex(n[i]),d=this.rowIndex(this.cell);d>=a&&d<=h&&(r=Be(t).toString()+d.toString())}return r},n.prototype.computeValue=function(t,r,n){try{var i=[],a=0,o="";i.length=0;for(var s=this.getParseDecimalSeparator();a<t.length;){var l="u"===t[a];if(l&&(a+=1),t[a]!==this.arithMarker){if(this.isDigit(t[a])){for(var h=this.emptyString;a<t.length&&(this.isDigit(t[a])||t[a]===s);)h+=t[a]===s?".":t[a],a+=1;if(i.push(h),!t[a])return i.toString()}if(t[a]===this.sheetToken){for(o=t[a],a+=1;a<t.length&&t[a]!==this.sheetToken;)o+=t[a],a+=1;a<t.length&&(o+=t[a],a+=1)}else if(this.isUpperChar(t[a])){h=this.emptyString;for(var d="";a<t.length&&this.isUpperChar(t[a]);){h+=t[a],a+=1}for(;a<t.length&&this.isDigit(t[a]);){h+=t[a],a+=1}if(a<t.length&&":"===t[a]){if(h+=t[a],(a+=1)<t.length&&t[a]===this.sheetToken)for(h+=t[a],a+=1;a<t.length&&t[a]!==this.sheetToken;)h+=t[a],a+=1;for(;a<t.length&&this.isUpperChar(t[a]);)h+=t[a],a+=1;for(;a<t.length&&this.isDigit(t[a]);)h+=t[a],a+=1;h=o+this.getCellFrom(h)}else h=o+h;if(d=this.getParentObjectCellValue(h,r).toString(),o="","string"==typeof d&&this.getErrorStrings().indexOf(d)>-1)return d;l&&(d=this.isNaN(this.parseFloat(d))?"-"+d:(-this.parseFloat(d)).toString()),i.push(d)}else if("q"===t[a]){var p=t.substring(a+1).indexOf(this.leftBracket),c=t.substring(a+p+1).indexOf(this.rightBracket);t=this.substring(t,a+p+2,c-1)}else if(t[a]===this.tic[0]){h=t[a].toString();for(a+=1;a<t.length&&t[a]!==this.tic[0];)h+=t[a],a+=1;(d=h.split(this.tic).join(this.emptyString))===this.trueValue||d===this.falseValue||!this.isNaN(this.parseFloat(d))&&""!==d?i.push(this.tic+d+this.tic):i.push(d),a+=1}else if("%"===t[a]&&i.length>0){var u=i[0],f=this.parseFloat(u);this.isNaN(f)||(i.pop(),i.push((f/100).toString())),a+=1}else if(0===t.substring(a).indexOf(this.trueValue))i.push(this.trueValue),a+=this.trueValue.length;else if(0===t.substring(a).indexOf(this.falseValue))i.push(this.falseValue),a+=this.falseValue.length;else if(t[a]===this.tic[0]||"|"===t[a]){h=t[a].toString();for(a++;a<t.length&&t[a]!==this.tic[0];)h+=t[a],a+=1;i.push(h+this.tic),a+=1}else{if(" "===t[a]&&a<t.length-1){a+=1;continue}switch(t[a]){case"#":var g=0;this.getErrorStrings().indexOf(t.substring(a))>-1?(g=-1===t.indexOf("!")||-1===t.substring(a).indexOf("!")?t.indexOf("#N/A")>-1?t.indexOf("#N/A")+4+a:t.indexOf("?")+1+a:t.indexOf("!")+1+a,i.push(this.substring(t,a,g-a))):(g=a+1,i.push(this.substring(t,a,g-a))),a=g;break;case"n":h="";if("n"===t[a+=1])continue;if(0===t.substring(a).indexOf("Infinity"))a+=(h="Infinity").length;else{for(("u"===t[a]||l||"-"===t[a])&&(h="-",l?l=!1:a+=1);a<t.length&&(this.isDigit(t[a])||t[a]===s||"."===t[a]);)h+=t[a]===s?".":t[a],a+=1;if(a<t.length&&"%"===t[a])if(a+=1,""===h){if(i.length>0){u=i[0],f=this.parseFloat(u);this.isNaN(f)||(i.pop(),i.push((f/100).toString()))}}else h=(this.parseFloat(h)/100).toString()}h&&i.push(h);break;case this.parser.tokenAdd:this.getValArithmetic(i,"add",n),a+=1;break;case this.parser.tokenSubtract:this.getValArithmetic(i,"sub",n),a+=1;break;case this.parser.tokenMultiply:this.getValArithmetic(i,"mul",n),a+=1;break;case this.parser.tokenDivide:this.getValArithmetic(i,"div",n),a+=1;break;case this.parser.tokenLess:this.processLogical(i,"less"),a+=1;break;case this.parser.tokenGreater:this.processLogical(i,"greater"),a+=1;break;case this.parser.tokenGreaterEq:this.processLogical(i,"greaterEq"),a+=1;break;case this.parser.tokenLessEq:this.processLogical(i,"lessEq"),a+=1;break;case this.parser.tokenNotEqual:this.processLogical(i,"notEq"),a+=1;break;case this.parser.tokenOr:this.processLogical(i,"or"),a+=1;break;case this.parser.tokenAnd:this.processLogical(i,"and"),a+=1;break;case this.parser.tokenEqual:this.processLogical(i,"equal"),a+=1;break;default:return this.getErrorStrings()[e.CommonErrors.value]}}}else a+=1}if(0===i.length)return this.emptyString;h=this.emptyString;for(var m=i.length;m>0;){var v=i.pop();if(this.getErrorStrings().indexOf(v)>-1)return v;if((h=v+h)===this.emptyString&&this.isCellReference(t)&&this.getTreatEmptyStringAsZero())return"0";m--}return h}catch(t){if(this.getErrorStrings().indexOf(t)>-1||this.formulaErrorStrings.indexOf(t)>-1)throw t;throw new ra(this.formulaErrorStrings[e.FormulasErrorsStrings.invalid_expression])}},n.prototype.getValArithmetic=function(t,r,n){var i=!1,a=t.pop(),o=t.pop();a=(a=a===this.trueValue?"1":a===this.falseValue?"0":a)===this.emptyString?"0":this.getErrorStrings().indexOf(a.toString())<0?this.parseFloat(a+"").toString():a;var s=Number(a);isNaN(s)&&!n&&(i=!0,a===this.getErrorStrings()[e.CommonErrors.divzero]?t.push(this.getErrorStrings()[e.CommonErrors.divzero]):t.push(this.getErrorStrings()[e.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)&&!n&&(i=!0,o===this.getErrorStrings()[e.CommonErrors.divzero]?t.push(this.getErrorStrings()[e.CommonErrors.divzero]):t.push(this.getErrorStrings()[e.CommonErrors.value])),"add"!==r||i||t.push((Number(o)+Number(a)).toString()),"sub"!==r||i||t.push((Number(o)-Number(a)).toString()),"mul"!==r||i||t.push((Number(o)*Number(a)).toString()),"div"!==r||i||(this.isNaN(this.parseFloat(a))||this.isNaN(this.parseFloat(o))?t.push(this.getErrorStrings()[e.CommonErrors.value]):0===this.parseFloat(a)?t.push(this.getErrorStrings()[e.CommonErrors.divzero]):t.push((Number(o)/Number(a)).toString()))},n.prototype.processLogical=function(r,n){var i,a,o,s,l,h,d=!1;return"and"!==n&&"equal"!==n&&(i=r.pop(),a=r.pop(),this.getErrorStrings().indexOf(i)>-1?(h=i,d=!0):this.getErrorStrings().indexOf(a)>-1&&(h=a,d=!0),this.isNaN(this.parseFloat(i))&&this.isNaN(this.parseFloat(a))&&(i=i.toString().toLowerCase(),a=a.toString().toLowerCase()),t.isNullOrUndefined(i)||(o=i.indexOf(this.tic)>-1?i:this.parseFloat(i)),t.isNullOrUndefined(a)||(s=a.indexOf(this.tic)>-1?a:this.parseFloat(a)),"*"===i&&this.isNaN(this.parseFloat(a))&&""!==a&&(l=!0)),"less"!==n||d||(h=this.isNaN(o)||this.isNaN(s)?a.toUpperCase().split(this.tic).join("").localeCompare(i.toUpperCase().split(this.tic).join(""))<0?this.trueValue:this.falseValue:s<o?this.trueValue:this.falseValue),"greater"!==n||d||(h=this.isNaN(o)||this.isNaN(s)?a.toUpperCase().split(this.tic).join("").localeCompare(i.toUpperCase().split(this.tic).join(""))>0?this.trueValue:this.falseValue:s>o?this.trueValue:this.falseValue),"lessEq"!==n||d||(h=this.isNaN(o)||this.isNaN(s)?a.toUpperCase().split(this.tic).join("").localeCompare(i.toUpperCase().split(this.tic).join(""))<=0?this.trueValue:this.falseValue:s<=o?this.trueValue:this.falseValue),"greaterEq"!==n||d||(h=this.isNaN(o)||this.isNaN(s)?a.toUpperCase().split(this.tic).join("").localeCompare(i.toUpperCase().split(this.tic).join(""))>=0?this.trueValue:this.falseValue:s>=o?this.trueValue:this.falseValue),"notEq"!==n||d||(h=a!==i?this.trueValue:this.falseValue,l&&(h=this.falseValue)),"and"!==n||d||(i=r.pop().toString(),a="",r.length>0&&(a=r.pop().toString()),h=this.getErrorStrings().indexOf(i)>-1?i:this.getErrorStrings().indexOf(a)>-1?a:(h=this.emptyString+a+i+this.emptyString).split(this.tic).join("")),"equal"!==n||d||(i=r.pop(),a=r.pop(),this.getErrorStrings().indexOf(i)>-1?h=i:this.getErrorStrings().indexOf(a)>-1?h=a:(this.isNaN(this.parseFloat(i))&&this.isNaN(this.parseFloat(a))&&(i=i.toString().toLowerCase(),a=a.toString().toLowerCase()),"*"===i&&this.isNaN(this.parseFloat(a))&&""!==a&&(l=!0),h=i===a||l?this.trueValue:this.falseValue)),"or"!==n||d||(h=Math.pow(this.parseFloat(s),this.parseFloat(o)).toString(),h=this.isNaN(this.parseFloat(h))?this.getErrorStrings()[e.CommonErrors.value]:h),r.push(h),h},n.prototype.computeStoreCells=function(e){for(var t,r=e.cellValue,n=e.cellRange,i=e.criteria,a=e.argArray,o=e.isCriteria,s=e.storedCells,l=e.isCountIfS===this.trueValue,h=e.countVal||0,d=o===this.trueValue?s:r,p=[],f=0;f<d.length;f++){var m=[],v=this.getValueFromArg(r[f]),y=a[l?1+2*h:2+h],C=y.startsWith(this.tic)&&y.endsWith(this.tic),b=(t=y.trim().split(this.tic).join(this.emptyString)).includes("*"),x="*"===t||"<>*"===t,S=b&&!x?t.replace(/\*/g,"").trim():t,w=!1;if(!C&&this.isCellReference(S)&&(S=this.getValueFromArg(S),w=!0),b&&!x){var I=t.indexOf("*");"*"===t[0]&&(S="*"+S),"*"===t[t.length-1]&&(S+="*"),I>0&&I<t.length-1&&(S=t.substring(0,I)+"*"+t.substring(I+1))}t=S;var E="";if((o=l?this.trueValue:o)===this.trueValue){var R="",k=0,F=0,A=void 0,N=void 0,O=void 0,T=void 0;s[f]=l&&!h?r[f]:s[f],R=s[f],h&&(N=(A=n[h-1]).indexOf("!")>-1?c(A.substring(A.lastIndexOf("!")+1)):c(A),O=R.indexOf("!")>-1?u(R.substring(R.lastIndexOf("!")+1)):u(R),T=n[h].indexOf("!")>-1?c(n[h].substring(n[h].lastIndexOf("!")+1)):c(n[h]));var D=R.indexOf("!")>-1,L=void 0,P="",M="";for(D&&(M=R.substring(0,R.lastIndexOf("!")+1),R=R.substring(R.lastIndexOf("!")+1));!this.isDigit(R[k]);)k+=1;if(this.isCellReference(n[h])&&n[h].indexOf(":")>-1)for(E=l&&!h?d[f].indexOf("!")>-1?d[f].substring(d[f].lastIndexOf("!")+1):d[f]:g(T[0]+(O[0]-N[0]),T[1]+(O[1]-N[1])),(L=n[h].indexOf("!")>-1)&&(P=n[h].substring(0,n[h].lastIndexOf("!")+1));!this.isDigit(E[F]);)F+=1;var H=this.substring(R,k),B=this.substring(E,F),U=this.substring(R,k,R.length-k),V=this.substring(E,F,E.length-k);D&&(H=M+H,B=M+B),U!==V&&(s[f]=this.substring(s[f],D?M.length+k:k)+V),E=s[f].split(H).join(B),L?(E.indexOf("!")>-1&&(E=E.substring(E.lastIndexOf("!")+1)),E=P+E):E=E.substring(E.lastIndexOf("!")+1),v=this.getValueFromArg(E),t=l?t:i[h-1].split(this.tic).join(this.emptyString)}var _="equal";t.startsWith("<=")?(_="lessEq",t=t.substring(2)):t.startsWith(">=")?(_="greaterEq",t=t.substring(2)):t.startsWith("<>")?(_="notEq",t=t.substring(2)):t.startsWith("<")?(_="less",t=t.substring(1)):t.startsWith(">")?(_="greater",t=t.substring(1)):t.startsWith("=")&&(_="equal",t=t.substring(1)),(!C&&this.isCellReference(t)&&(!w||""!==E&&!l)||t.includes(this.arithMarker))&&(t=this.getValueFromArg(t)),(t.indexOf("*")>-1||t.indexOf("?")>-1)&&(v=this.findWildCardValue(t.toLowerCase(),v.toLowerCase())),m.push(v.toLowerCase()),m.push(t.toLowerCase()),this.processLogical(m,_)===this.trueValue&&(o===this.falseValue?p.push(r[f]):p.push(E))}return s=p,p=[],s},n.prototype.computeIfsFormulas=function(r,n,i){if(n===this.trueValue&&(t.isNullOrUndefined(r)||""===r[0]||r.length<2||r.length>127||r.length%2!=0))return this.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];for(var a=r,o=[],s=[],l=[],h=0,d=0;d<a.length;d++)a[d].indexOf(":")>-1&&this.isCellReference(a[d])?o.push(a[d].trim()):s.push(a[d].trim());var p=[];for(d=0;d<o.length;d++)p.push(this.getCellCollection(o[d]).length);for(var f=0;f<p.length;f++)if(p[f]&&p[f+1]&&p[f]!==p[f+1])return this.getErrorStrings()[e.CommonErrors.value];for(var m=0;m<s.length;m++)if(""===s[m])return i===this.trueValue?this.getErrorStrings()[e.CommonErrors.divzero]:0;var v,y;if(n===this.falseValue){y=this.falseValue;var C={cellValue:v=this.getCellCollection(o[1]),cellRange:o,criteria:s,argArray:a,isCriteria:y,storedCells:l,isCountIfS:n};if(l=this.computeStoreCells(C),0===l.length)return i===this.trueValue?this.getErrorStrings()[e.CommonErrors.divzero]:0}for(d=n===this.trueValue?0:2;d<o.length;d++){y=this.trueValue,y=n===this.trueValue&&0===d?this.falseValue:this.trueValue;C={cellValue:v=this.getCellCollection(o[d]),cellRange:o,criteria:s,argArray:a,isCriteria:y,storedCells:l,isCountIfS:n,countVal:d};if(l=this.computeStoreCells(C),0===l.length)return i===this.trueValue?this.getErrorStrings()[e.CommonErrors.divzero]:0}var b=0,x=o[0].indexOf("!")>-1?c(o[0].substring(o[0].lastIndexOf("!")+1)):c(o[0]),S=o[o.length-1],w=S.indexOf("!")>-1?c(S.substring(S.lastIndexOf("!")+1)):c(S);for(f=0;f<l.length;f++){var I="",E="",R=0,k=0,F=(I=l[f]).indexOf("!")>-1,A=void 0,N="",O="";for(F&&(O=I.substring(0,I.lastIndexOf("!")+1),I=I.substring(I.lastIndexOf("!")+1));!this.isDigit(I[R]);)R+=1;if(this.isCellReference(o[0])&&o[0].indexOf(":")>-1)for(E=g(x[0]+(u(I)[0]-w[0]),x[1]+(u(I)[1]-w[1])),(A=o[0].indexOf("!")>-1)&&(N=o[0].substring(0,o[0].lastIndexOf("!")+1));!this.isDigit(E[k]);)k+=1;var T=this.substring(I,R),D=this.substring(E,k),L=this.substring(I,R,I.length-R),P=this.substring(E,k,E.length-R);if(F&&(T=O+T,D=O+D),L!==P&&(l[f]=this.substring(l[f],F?O.length+R:R)+P),v=l[f].split(T).join(D),A?(v.indexOf("!")>-1&&(v=v.substring(v.lastIndexOf("!")+1)),v=N+v):v=v.substring(v.lastIndexOf("!")+1),n===this.trueValue)h+=1;else{var M=this.getValueFromArg(v),H=parseFloat(""===M&&i!==this.trueValue?"0":M);this.isNumber(H)&&(b++,h+=H)}}return i===this.trueValue&&(h/=b),h},n.prototype.processNestedFormula=function(e,t,r){if(r&&!r.toString().includes('"')){if('"'===e[e.indexOf(t)+t.length]&&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)},n.prototype.isNaN=function(e){return"NaN"===e.toString()||"string"==typeof e},n.prototype.isNumber=function(e){return e-parseFloat(e)>=0},n.prototype.fromOADate=function(e){(e=e>0&&e<1?1+e:0===e?1:e)>60&&(e-=1);var t=new Date("01/01/1900"),r=Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds());return new Date(new Date((e-1)*this.millisecondsOfaDay+r).toUTCString().replace(" GMT",""))},n.prototype.getSerialDateFromDate=function(e,t,r){var n=0;e<1900&&(e+=1900);for(var i=!1;!i;){for(;t>12;)e++,t-=12;for(;t<1;)t+=12,e--;i=!0;for(var a=new Date(e,t,1,-1).getDate();r>a;)a=new Date(e,t,1,-1).getDate(),t++,r-=a,i=!1;r<1&&(--t<1&&(t=12,e--),r=(a=new Date(e,t,1,-1).getDate())+r,i=!1)}var o=Date.parse(e+"/"+t+"/"+r);return this.isNaN(o)||(n=this.toOADate(new Date(o))),n},n.prototype.intToTime=function(e){var r=e.toString().split(".");return t.isNullOrUndefined(r[1])||(e=parseFloat(r[0]+1+"."+r[1])||e),this.intToDate(e.toString())},n.prototype.toOADate=function(e,t,r){var n=new Date("01/01/1900"),i=T(e)?e:new Date(e),a=Date.UTC(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds()),o=(Date.UTC(i.getFullYear(),i.getMonth(),i.getDate(),i.getHours(),i.getMinutes(),i.getSeconds(),i.getMilliseconds())-a)/864e5;return(t?o:parseInt(o.toString(),10))+(r?0:o>60?2:1)},n.prototype.calculateDate=function(e){return this.parseFloat(e)<10?"0"+e:e},n.prototype.isTextEmpty=function(e){return null===e||""===e},n.prototype.isDigit=function(e){var t=e.charCodeAt(0);return t>47&&t<58},n.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},n.prototype.getValueFromArg=function(r,n,i,a){var o=r=r.trim(),s=this.dateTime1900,l=o;if(t.isNullOrUndefined(o)||this.isTextEmpty(o))return o;if(r[0]===this.tic||r[0]===this.singleTic){var h=r.split(this.tic).join("");if(s=this.isDate(h),this.isNaN(this.parseFloat(h))&&!t.isNullOrUndefined(s)&&!this.isNaN(s.getDate())&&this.dateTime1900<=s)return this.toOADate(s,!0).toString();if(r[r.length-1]===this.tic){"."!==(d=this.getParseDecimalSeparator())&&h.includes(d)&&(h=h.replace(d,"."),this.isNumber(h)&&(r=h))}return r}r=r.split("u").join("-");var d=this.getParseDecimalSeparator();if(!this.isUpperChar(o[0])&&(this.isDigit(o[0])||o[0]===d||"-"===o[0]||"n"===o[0])){if("n"===o[0]&&(o=o.substring(1)).indexOf('"n')>-1&&(o=o.replace('"n','"')),"."!==d&&o.includes(d)){h=o.replace(d,".");this.isNumber(h)&&(o=h)}return o}if(-1===this.parser.indexOfAny(o,["+","-","/","*",")",")","{"])&&this.isUpperChar(o[0])||o[0]===this.sheetToken){if(o!==this.trueValue&&o!==this.falseValue&&this.isCellReference(o)){var p=this.getSheetFamilyItem(this.grid);if(null!==p.sheetNameToParentObject&&p.sheetNameToParentObject.size>0&&-1===o.indexOf(this.sheetToken)){o=p.parentObjectToToken.get(this.grid)+o}}if(o===this.cell){var c=this.getDependentCells().get(o);if(null!=c&&c.indexOf(o)>-1&&this.arrayRemove(c,o),this.getDependentFormulaCells().has(this.cell)||this.clearFormulaDependentCells(this.cell),!n)throw this.formulaErrorStrings[e.FormulasErrorsStrings.circular_reference]+o}return l=this.getParentObjectCellValue(o,!1,n,a),this.updateDependentCell(o),l.toString()}return this.getErrorStrings().indexOf(r)>-1?r:this.computeValue(l.toString(),!1,i)},n.prototype.isDate=function(e){if("object"==typeof e||null!==Date.parse(e)){var t=void 0;return(t="string"==typeof e?this.checkDateFormat(e):new Date(Date.parse(e)))>=this.dateTime1900?t:null}return null},n.prototype.isValidCellReference=function(e){var r=0,n=0,i=[89,71,69],a=this.emptyString;if(this.namedRanges.has(e))return!1;for(var o=0;o<e.length;o++)this.isChar(e[o])&&r++;if((a=e.substring(0,r)).length<4){for(;n<a.length;){if(t.isNullOrUndefined(a[n])||!(a[n].charCodeAt(0)<i[n])){if(t.isNullOrUndefined(a[n])&&n>0)break;return!1}n++}if(this.parseFloat(e.substring(r,e.length))<1048576)return!0}return!1},n.prototype.parseDate=function(t){if(!this.isNaN(t)){if(t instanceof Date)return new Date(t);var r=parseInt(t,10);return r<0?this.getErrorStrings()[e.CommonErrors.num]:r<=60?new Date(this.dateTime1900.getTime()+864e5*(r-1)):new Date(this.dateTime1900.getTime()+864e5*(r-2))}return"string"!=typeof t||(t=this.checkDateFormat(t,!0),this.isNaN(t))?this.getErrorStrings()[e.CommonErrors.value]:t},n.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))},n.prototype.isCellReference=function(e){if((e=e.trim())===this.emptyString)return!1;e=this.setTokensForSheets(e);var t=this.getSheetToken(e),r=!1;""!==t&&(e=e.split(t).join(this.emptyString));var n=!1,i=!1;if(e.indexOf(":")!==e.lastIndexOf(":"))return!1;for(var a=e.split("").join(this.getParseArgumentSeparator()).split(this.getParseArgumentSeparator()),o=0;o<a.length;o++)if(this.isChar(a[o]))n=!0;else if(this.isDigit(a[o]))i=!0;else{if(":"!==a[o])return!1;n&&i&&(r=!0),n=!1,i=!1}return e.indexOf(":")>-1&&-1===e.indexOf(this.tic)?!!(r&&n&&i)||!(!(n&&!i||!n&&i)||r):!!(n&&i&&-1===e.indexOf(this.tic)&&this.isValidCell(e))},n.prototype.setTokensForSheets=function(e){var t=this.getSheetFamilyItem(this.grid),r=this.getSortedSheetNames();if(null!=r)for(var n=0;n<r.length;n++){var i=t.sheetNameToToken.get(r[n]);i=i.split(this.sheetToken).join(this.tempSheetPlaceHolder);var a=this.singleTic+"SHEET"+r[n]+this.singleTic+this.sheetToken;-1===e.indexOf(a)&&(a="SHEET"+r[n]+this.sheetToken),e=e.split(a).join(i),a=r[n]+this.sheetToken,e=e.split(a).join(i)}if((e=e.split(this.tempSheetPlaceHolder).join(this.sheetToken)).indexOf("!!")>-1){var o=(e=e.replace("!!","!")).split("!");o[1]=(parseInt(o[1],10)+1).toString(),e=o.join("!")}return e},n.prototype.getParentObjectCellValue=function(t,r,n,i){if(t===this.trueValue||t===this.falseValue)return t;var a=t.lastIndexOf(this.sheetToken),o=0,s=0,l=this.grid,h=this.getSheetFamilyItem(l);if(a>-1&&null!==h.tokenToParentObject)this.grid=h.tokenToParentObject.get(t.substring(0,a+1)),o=this.rowIndex(t),s=this.colIndex(t);else if(-1===a){for(var d=0;d<t.length&&this.isChar(t[d]);)d++;if(d===t.length||!this.isValidCell(t))return""===(t=t.toLowerCase())?this.getErrorStrings()[e.CommonErrors.value]:this.getErrorStrings()[e.CommonErrors.name];o=this.rowIndex(t),s=this.colIndex(t),h.isSheetMember&&null!=h.parentObjectToToken&&(t=h.parentObjectToToken.get(this.grid)+t)}var p=""===this.cell||null===this.cell?"":this.cell;if(this.cell=t,p===this.cell&&!n)throw this.formulaErrorStrings[e.FormulasErrorsStrings.circular_reference];var c=this.getParentCellValue(o,s,this.grid,p,l,r,n,i);return this.grid=l,this.cell=p,c},n.prototype.getParentCellValue=function(e,r,n,i,a,o,s,l){var h,d=this.getSheetId(n);if(void 0===this.parentObject.getValueRowCol?h=this.getValueRowCol(d,e,r):(i&&(i=a===n?"":i+","+(a&&"string"==typeof a&&Number(a)>-1?a:this.getSheetID(a))),h=this.parentObject.getValueRowCol(d,e,r,i,o,s,l)),t.isNullOrUndefined(h))h=this.emptyString;else{h=h.toString();var p=this.getParseDecimalSeparator();if("."!==p&&h.includes(p)){var c=h.replace(p,".");this.isNumber(c)&&(h=c)}}return h},n.prototype.isValidCell=function(e){if(0===e.search(/\d/)){var t=e.search(/[a-zA-Z]/);e=e.substring(t,e.length)+e.substring(0,t)}var r=this.rowIndex(e),n=this.colIndex(e);return r>0&&r<=1048576&&n>0&&n<=16384},n.prototype.getSheetId=function(e){return e&&"string"==typeof e&&Number(e)>-1?Number(e):this.getSheetID(e)+1},n.prototype.getValueRowCol=function(e,t,r){var n=this.rowsToKeyMap.get(t).toString(),i=this.getKeyValue(n).toString();if(null!=i&&"%"===i[i.length-1]&&i.length>1){var a=this.parseFloat(i.substring(0,i.length-1));this.isNaN(a)&&(i=(Number(a)/100).toString())}return i},n.prototype.defineFunction=function(e,r,n){"string"==typeof r&&(r=t.getValue(r,window)),e=e.toUpperCase(),this.libraryFormulas.set(e,{handler:r,isCustom:!0,description:n})},n.prototype.valueChanged=function(e,r,n,i,a,o,s,l){var h=e;this.spreadSheetUsedRange=i,this.grid=e;var d=!0,p=!0,c=this.getSheetFamilyItem(h),u=Be(r.getColIndex())+r.getRowIndex().toString();if(this.actCell=o+"!"+u,null!==c.sheetNameToParentObject&&c.sheetNameToParentObject.size>0){u=c.parentObjectToToken.get(h)+u}var f=r.getValue().toUpperCase();if(f.indexOf("=RAND()")>-1||f.indexOf("=NOW()")>-1||f.indexOf("NOW()")>-1||f.indexOf("RAND()")>-1||f.indexOf("=RANDBETWEEN(")>-1||f.indexOf("RANDBETWEEN(")>-1||this.randomValues.has(u)){var g=this.randCollection.toString();this.randomValues.has(u)?this.randomValues.has(u)&&(f.indexOf("=RAND()")>-1||f.indexOf("=NOW()")>-1||f.indexOf("NOW()")>-1||f.indexOf("RAND()")>-1||f.indexOf("=RANDBETWEEN(")>-1||f.indexOf("RANDBETWEEN(")>-1?this.randomValues.set(u,r.getValue()):r.getValue().toUpperCase()!==this.randomValues.get(u.toUpperCase())&&(this.randomValues.delete(u),g=g.split(u+this.parseArgumentSeparator).join("").split(this.parseArgumentSeparator+u).join("").split(u).join(""),this.randCollection=g.split(this.parseArgumentSeparator)),0===this.randomValues.size&&this.randCollection.length&&(this.isRandomVal=!1,this.randomValues.clear(),this.randCollection=[])):(this.randomValues.set(u,r.getValue()),this.randCollection.push(u),this.isRandomVal=!0)}if(r.getValue()&&r.getValue()[0]===this.getFormulaCharacter()){this.cell=u;var m=void 0;if(t.isNullOrUndefined(p)||(p=n),this.getFormulaInfoTable().has(u)){if(m=this.getFormulaInfoTable().get(u),r.getValue()!==m.getFormulaText()||null==m.getParsedFormula()){m.setFormulaText(r.getValue()),this.getDependentFormulaCells().has(this.cell)&&this.clearFormulaDependentCells(this.cell);try{m.setParsedFormula(this.parser.parseFormula(r.getValue()))}catch(e){m.setFormulaValue(e),p=!1}}if(p){this.parser.isFormulaParsed=!0;var v=this.calculateFormula(m.getParsedFormula(),a);d=v!==m.getFormulaValue(),m.setFormulaValue(v)}}else{(m=new na).setFormulaText(r.getValue()),this.getDependentFormulaCells().has(u)||this.getDependentFormulaCells().set(u,new Map);try{m.setParsedFormula(this.parser.parseFormula(r.getValue()))}catch(e){m.setFormulaValue(e),p=!1}p&&m.setFormulaValue(this.calculateFormula(m.getParsedFormula(),a)),this.getFormulaInfoTable().has(u),this.getFormulaInfoTable().set(u,m)}p&&(void 0===this.parentObject.setValueRowCol?this.setValueRowCol(this.getSheetID(h)+1,m.getFormulaValue(),r.getRowIndex(),r.getColIndex()):this.parentObject.setValueRowCol(this.getSheetId(h),m.getFormulaValue(),r.getRowIndex(),r.getColIndex(),m.getFormulaText(),s))}else this.getFormulaInfoTable().has(u)&&(this.getFormulaInfoTable().delete(u),this.getDependentFormulaCells().has(u)&&this.clearFormulaDependentCells(u));p&&d&&this.getDependentCells().has(u)&&this.getDependentCells().get(u).toString()!==u&&this.refresh(u,void 0,void 0,l)},n.prototype.setValueRowCol=function(e,t,r,n){},n.prototype.getSortedSheetNames=function(){var e=this.getSheetFamilyItem(this.grid);if(null!=e&&null!=e.sheetNameToToken){var t=[];e.sheetNameToToken.forEach(function(e,r){t.push(r),t.sort()}),this.sortedSheetNames=t,this.sortedSheetNames.sort(),this.sortedSheetNames.length>9&&this.sortedSheetNames[0].includes("1")&&this.sortedSheetNames[1].includes("10")&&(this.sortedSheetNames.splice(this.sortedSheetNames.indexOf("2"),0,this.sortedSheetNames[0]),this.sortedSheetNames.splice(0,1))}return this.sortedSheetNames},n.prototype.getErrorLine=function(e){var t=e.stack?e.stack.split("\n")[1].split(":"):null;return t?t[t.length-2]:null},n.prototype.createSheetFamilyID=function(){return this.sheetFamilyID===Number.MAX_SAFE_INTEGER&&(this.sheetFamilyID=Number.MIN_SAFE_INTEGER),this.sheetFamilyID++},n.prototype.computeMinMax=function(r,n){var i,a,o=!1;if(r.length&&"isSubtotal"===r[r.length-1]&&(o=!0,r.pop()),t.isNullOrUndefined(r)||0===r.length)return this.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];i="max"===n?this.minValue:this.maxValue;for(var s=0,l=r.length;s<l;s++)r[s].split(this.tic).join("").trim()===this.emptyString&&(i=0);var h=r;if(h.length>255)return this.getErrorStrings()[e.CommonErrors.value];for(var d=0;d<h.length;d++)if(h[d].indexOf(":")>-1&&this.isCellReference(h[d])){for(var p=this.getCellCollection(h[d]),c=0;c<p.length;c++)if(a=o?this.getValueFromArg(p[c],null,null,!0):this.getValueFromArg(p[c]),!o||!a.includes("SUBTOTAL(")){var u=this.parseFloat(a);""===a||this.isNaN(this.parseFloat(u))||this.getErrorStrings().indexOf(a)>-1||(i="max"===n?Math.max(i,u):Math.min(i,u))}}else{var f=o?this.getValueFromArg(h[d],null,null,!0):this.getValueFromArg(h[d]);if(o&&f.includes("SUBTOTAL("))continue;u=0;var g=this.isCellReference(h[d]),m=""===f&&g,v=this.isNaN(this.parseFloat(f))&&g,y=f===(this.trueValue||this.falseValue)&&g;if(h[d]=h[d].startsWith("n")?h[d].slice(1):h[d],this.getErrorStrings().indexOf(f)>-1)return f;if(f===this.trueValue&&h[d]===this.trueValue)f="1";else if(f===this.falseValue&&h[d]===this.falseValue)f="0";else if(m||v||y)continue;if(f.indexOf('"')>-1&&(f=f.split(this.tic).join("")),this.isNaN(this.parseFloat(f)))return this.getErrorStrings()[e.CommonErrors.value];u=this.parseFloat(f),i="max"===n?Math.max(i,u):Math.min(i,u)}return i!==this.minValue&&i!==this.maxValue||(i=0),i.toString()},n.prototype.calculateAvg=function(r,n){for(var i,a,o=r,s=[],l=0,h=0,d=0;d<o.length;d++)if(this.isCellReference(o[d]))if(o[d].indexOf(":")>-1){s=this.getCellCollection(o[d]);for(var p=0;p<s.length;p++)if(i=n?this.getValueFromArg(s[p],null,null,!0):this.getValueFromArg(s[p]),!n||!i.includes("SUBTOTAL(")){if(this.getErrorStrings().indexOf(i)>-1)return i;t.isNullOrUndefined(i)||isNaN(this.parseFloat(i))||""===i||(l+=this.parseFloat(i),h+=1)}}else{if(i=n?this.getValueFromArg(o[d],null,null,!0):this.getValueFromArg(o[d]),n&&i.includes("SUBTOTAL("))continue;if(this.getErrorStrings().indexOf(i)>-1)return i;if(t.isNullOrUndefined(i)||isNaN(this.parseFloat(i))||""===i)continue;l+=this.parseFloat(i),h+=1}else{if(o[d].indexOf(this.tic)>-1&&(isNaN(this.parseFloat(o[d].split(this.tic).join("")))||""===o[d].split(this.tic).join("").trim()))return this.getErrorStrings()[e.CommonErrors.value];if(0!==o[d].length&&r[d]!==this.falseValue||(o[d]="0"),r[d]===this.trueValue&&(o[d]="1"),a=this.getValueFromArg(o[d].split(this.tic).join("")),this.getErrorStrings().indexOf(a)>-1)return a;l+=this.parseFloat(a),h+=1}return 0===h?this.getErrorStrings()[e.CommonErrors.divzero]:(l/h).toString()},n.prototype.registerGridAsSheet=function(e,r,n){t.isNullOrUndefined(this.modelToSheetID)&&(this.modelToSheetID=new Map),t.isNullOrUndefined(this.modelToSheetID.get(r))&&this.modelToSheetID.set(r,n);var i=this.getSheetFamilyItem(r);i.isSheetMember=!0;var a=e.toUpperCase();if(0===i.parentObjectToToken.size&&(i.parentObjectToToken=new Map),0===i.sheetNameToParentObject.size&&(i.sheetNameToParentObject=new Map),0===i.sheetNameToToken.size&&(i.sheetNameToToken=new Map),0===i.tokenToParentObject.size&&(i.tokenToParentObject=new Map),t.isUndefined(i.sheetNameToParentObject.get(a))){o=this.sheetToken+this.tokenCount.toString()+this.sheetToken;this.tokenCount++,i.tokenToParentObject.set(o,r),i.parentObjectToToken.set(r,o),i.sheetNameToToken.set(a,o),i.sheetNameToParentObject.set(a,r)}else{var o=i.sheetNameToToken.get(a);i.tokenToParentObject.set(o,r),i.parentObjectToToken.set(r,o)}return e},n.prototype.unregisterGridAsSheet=function(e,r,n){var i=this,a=[r];n&&(a=[],t.isNullOrUndefined(this.modelToSheetID)||this.modelToSheetID.forEach(function(e,t){a.push(t)})),a.forEach(function(t){var r=i.getSheetFamilyItem(t),a=(n?t:e).toUpperCase();if(null!=r.sheetNameToParentObject&&r.sheetNameToParentObject.has(a)){r.sheetNameToParentObject.delete(a);var o=r.sheetNameToToken.get(a);r.sheetNameToToken.delete(a),r.tokenToParentObject.delete(o),r.parentObjectToToken.delete(t)}})},n.prototype.computeExpression=function(e,t){var r=this.parser.parseFormula(e);return this.computeFormula(r,t)},n.prototype.isSheetMember=function(){var e=this.getSheetFamilyItem(this.grid);return!t.isNullOrUndefined(e)&&e.isSheetMember},n.prototype.dispose=function(){this.resetKeys(),this.namedRanges.clear(),this.lFormulas.clear()},n.prototype.refreshRandValues=function(e){var t,r,n,i,a="";if(this.randomValues.has(e)){this.randomValues.delete(e);var o=this.randCollection.indexOf(e);o>-1&&this.randCollection.splice(o,1),0!==this.randomValues.size||this.randCollection.length||(this.randomValues.clear(),this.randCollection=[])}for(var s=0;s<this.randomValues.size;s++)t=this.rowIndex(this.randCollection[s]),r=this.colIndex(this.randCollection[s]),a=(parseFloat(this.getSheetToken(this.randCollection[s]).split(this.sheetToken).join(""))+1).toString(),i=this.getSheetFamilyItem(a),this.grid=i.sheetNameToParentObject.get(a),n=this.randomValues.get(this.randCollection[s]),n=this.computeFormula(n),void 0===this.parentObject.setValueRowCol?this.setValueRowCol(this.getSheetID(this.grid)+1,n,t,r):this.parentObject.setValueRowCol(this.getSheetId(this.grid),n,t,r)},n.prototype.refresh=function(e,t,r,n){var i,a=this;if(r||(i=!0,r=[]),this.getDependentCells().has(e)){var o=this.getSheetFamilyItem(this.grid);try{var s=this.getDependentCells().get(e),l=void 0;for(l=0;l<s.length;l++){var h=s[l];if(!(t&&h.indexOf(t)>-1||h===e||r.indexOf(h)>-1)){var d=this.getSheetToken(h),p=this.parentObject.sheets,c=this.parentObject.activeSheetIndex;if(d.length){this.grid=o.tokenToParentObject.get(d);var u=Number(this.grid),f="";if(!this.isNaN(u)&&p)for(var g=0;g<p.length;g++)p[g].id===u&&(f=p[g].name,c=g);this.actCell=f+"!"+h.split(d)[1]}else this.actCell=h.split(d)[1];try{var m=function(e,t){t&&(a.cell=e,a.parser.isFormulaParsed=!0,t.setFormulaValue(a.calculateFormula(t.getParsedFormula(),!0)))},v=this.rowIndex(h),y=this.colIndex(h),C=this.getFormulaInfoTable().get(h);if(void 0===this.parentObject.setValueRowCol)m(h,C),this.setValueRowCol(this.getSheetID(this.grid)+1,C.getFormulaValue(),v,y);else{var b=p&&p[c].rows&&p[c].rows[v-1]&&p[c].rows[v-1].cells&&p[c].rows[v-1].cells[y-1],x=void 0;if(b&&b.formula&&b.formula.toLowerCase().includes("unique")){if(this.uniqueCells&&-1!==this.uniqueCells.indexOf(h))continue;this.uniqueCells||(this.uniqueCells=[]),this.uniqueCells.push(h),m(h,C),x=C.getFormulaValue(),this.uniqueCells.splice(this.uniqueCells.indexOf(h),1),this.uniqueCells.length||(this.uniqueCells=null)}else-1===r.indexOf(h)&&r.push(h),x=null;this.parentObject.setValueRowCol(this.getSheetId(this.grid),x,v,y,C.getFormulaText())}this.refresh(h,null,r)}catch(e){continue}}}if(i){var S,w,I,E,R,k=this.parentObject.sheets;k||(r=[]),r.forEach(function(e){S=a.getSheetId(o.tokenToParentObject.get(a.getSheetToken(e)));for(var t=0;t<k.length;t++)if(k[t].id===S){w=t;break}I=a.rowIndex(e)-1,E=a.colIndex(e)-1,(R=k[w].rows[I]&&k[w].rows[I].cells[E])&&a.parentObject.notify("calculateFormula",{cell:R,rowIdx:I,colIdx:E,sheetIndex:w,isDependentRefresh:!0,isRandomFormula:n})})}}finally{this.grid=o.tokenToParentObject.get(this.getSheetToken(e))}}};var i;return ea([t.Property(!0)],n.prototype,"includeBasicFormulas",void 0),ea([t.Event()],n.prototype,"onFailure",void 0),n=i=ea([t.NotifyPropertyChanges],n)}(t.Base),ra=function(){return function(e,t){this.formulaCorrection=!1,this.message=e,this.formulaCorrection=t}}(),na=function(){function e(){this.calcID=Number.MIN_VALUE+1,this.calcID1=Number.MIN_VALUE+1}return e.prototype.getFormulaText=function(){return this.formulaText},e.prototype.setFormulaText=function(e){this.formulaText=e},e.prototype.getFormulaValue=function(){return this.formulaValue},e.prototype.setFormulaValue=function(e){this.formulaValue=e},e.prototype.getParsedFormula=function(){return this.parsedFormula},e.prototype.setParsedFormula=function(e){this.parsedFormula=e},e}(),ia=function(){return 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}}(),aa=function(){return function(e,t,r){return this.row=e,this.col=t,this.value=r,this.getRowIndex=function(){return e},this.setRowIndex=function(t){e=t},this.getColIndex=function(){return t},this.setColIndex=function(e){t=e},this.getValue=function(){return r},this}}(),oa=function(){function r(e){this.uniqueOBracket=String.fromCharCode(129),this.uniqueCBracket=String.fromCharCode(130),this.uniqueCSeparator=String.fromCharCode(131),this.uniqueCOperator=String.fromCharCode(132),this.uniquePOperator=String.fromCharCode(133),this.uniqueSOperator=String.fromCharCode(134),this.uniqueMOperator=String.fromCharCode(135),this.uniqueDOperator=String.fromCharCode(136),this.uniqueModOperator=String.fromCharCode(137),this.uniqueConcateOperator=String.fromCharCode(138),this.uniqueEqualOperator=String.fromCharCode(139),this.uniqueExpOperator=String.fromCharCode(140),this.uniqueGTOperator=String.fromCharCode(141),this.uniqueLTOperator=String.fromCharCode(142),this.sheetInfo=[],this.parent=e,this.init()}return r.prototype.init=function(){var e=this;this.addEventListener(),this.initCalculate(),this.registerSheet(),this.parent.customFormulaCollection.forEach(function(t,r){e.addCustomFunction(t.handler,r,t.description)})},r.prototype.destroy=function(){var e=this;if(this.removeEventListener(),this.parent.refreshing){this.clearAllUniqueFormulaValue();this.calculateInstance.getLibraryFormulas().forEach(function(t,r){t.isCustom&&e.parent.customFormulaCollection.set(r,{handler:t.handler,description:t.description})})}this.calculateInstance.dispose(),this.calculateInstance=null,this.sheetInfo&&(this.sheetInfo=[]),this.parent=null},r.prototype.addEventListener=function(){this.parent.on(jr,this.performFormulaOperation,this),this.parent.on(en,this.aggregateComputation,this),this.parent.on(tn,this.getUniqueRange,this),this.parent.on(rn,this.removeUniquecol,this),this.parent.on(on,this.clearFormulaDependentCells,this),this.parent.on(sn,this.formulaInValidation,this),this.parent.on(Si,this.refreshInsertDelete,this),this.parent.on(wi,this.getUpdatedFormulaOnInsertDelete,this),this.parent.on(ki,this.autoCorrectCellRef,this),this.parent.on(Fi,this.parseFormulaArgument,this)},r.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(jr,this.performFormulaOperation),this.parent.off(en,this.aggregateComputation),this.parent.off(tn,this.getUniqueRange),this.parent.off(rn,this.removeUniquecol),this.parent.off(on,this.clearFormulaDependentCells),this.parent.off(sn,this.formulaInValidation),this.parent.off(Si,this.refreshInsertDelete),this.parent.off(wi,this.getUpdatedFormulaOnInsertDelete),this.parent.off(ki,this.autoCorrectCellRef),this.parent.off(Fi,this.parseFormulaArgument))},r.prototype.getModuleName=function(){return"workbookFormula"},r.prototype.initCalculate=function(){this.calculateInstance=new ta(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=t.getNumericObject(this.parent.locale).decimal;"."!==e&&this.parent.listSeparator!==e&&this.calculateInstance.setParseDecimalSeparator(e)},r.prototype.clearFormulaDependentCells=function(e){if(e.isOpen)return this.calculateInstance.getDependentCells().clear(),void this.calculateInstance.getFormulaInfoTable().clear();var r=e.cellRef.split(":")[0],n=this.parent.getActiveSheet().id.toString(),i=this.calculateInstance.getSheetFamilyItem(n);i.isSheetMember&&!t.isNullOrUndefined(i.parentObjectToToken)&&(r=i.parentObjectToToken.get(n)+r),this.calculateInstance.clearFormulaDependentCells(r)},r.prototype.formulaInValidation=function(e){var r=this.calculateInstance.getLibraryFormulas().get(e.value);e.skip=t.isNullOrUndefined(r)},r.prototype.performFormulaOperation=function(e){var r,n,i=e.action;"refreshCalculate"!==i&&(r=this.calculateInstance.getLibraryFormulas(),n=Array.from(r.values()));var a;switch(i){case"getLibraryFormulas":e.formulaCollection=Array.from(r.keys());break;case"getFormulaCategory":a=["All"];for(var o=1;o<Array.from(r.values()).length;o++)a.indexOf(n[o].category)<0&&a.push(n[o].category);e.categoryCollection=a;break;case"dropDownSelectFormulas":for(o=0;o<Array.from(r.values()).length;o++)e.selectCategory===n[o].category&&(e.formulaCollection[o]=Array.from(r.keys())[o]);break;case"getFormulaDescription":for(o=0;o<Array.from(r.values()).length;o++)e.selectedList===Array.from(r.keys())[o]&&(e.description=n[o].description,e.isCustom=n[o].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("&"):e.value;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(o=0;o<this.sheetInfo.length;o++)if(this.sheetInfo[o].index===e.sheetId){var s=this.sheetInfo[o].visibleName,l=this.sheetInfo[o].sheet;this.sheetInfo.splice(o,1);var h=e.sheetId.toString();this.sheetDeletion(l,h),this.calculateInstance.unregisterGridAsSheet(h,h),this.definedNamesDeletion(s);break}break;case"getReferenceError":e.refError=this.referenceError();break;case"getAlpha":e.col=Be(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":var d=this.calculateInstance.getSheetFamilyItem(e.sheetId);d.isSheetMember&&!t.isNullOrUndefined(d.parentObjectToToken)&&(e.address=d.parentObjectToToken.get(e.sheetId)+e.address),"checkFormulaAdded"===i?e.added=this.calculateInstance.getFormulaInfoTable().has(e.address):e.isAvailable=this.calculateInstance.getDependentCells().has(e.address)}},r.prototype.definedNamesDeletion=function(e){var t=this.parent.definedNames;if(t&&t.length>0)for(var r=t.length-1;r>=0;r--)t[r].refersTo.split("=")[1].split("!")[0].split("'").join("")===e&&this.removeDefinedName(t[r].name,t[r].scope)},r.prototype.referenceError=function(){return this.calculateInstance.getErrorStrings()[e.CommonErrors.ref]},r.prototype.getSheetInfo=function(){return this.sheetInfo},r.prototype.addCustomFunction=function(e,t,r){this.calculateInstance.defineFunction(t,e,r)},r.prototype.updateSheetInfo=function(){var e=this;this.sheetInfo=[],this.parent.sheets.forEach(function(t){e.sheetInfo.push({visibleName:t.name,sheet:"Sheet"+t.id,index:t.id})})},r.prototype.sheetDeletion=function(e,r){var n,i,a,o,s,l,h,d=this,p=this.calculateInstance.getDependentCells(),c=this.calculateInstance.getSheetFamilyItem(r),u=this.calculateInstance.namedRanges;u&&u.size&&(l=Array.from(u.keys()),h=Array.from(u.values()));var f,g;p.forEach(function(p,m){p.forEach(function(p){if(n=d.calculateInstance.getFormulaInfoTable().get(p),!t.isNullOrUndefined(n)){var v=!1;if(!(i=n.formulaText).includes(e)&&u&&u.size){var y=i.replace(/\w+/g,function(e){var t=l.indexOf(e);return-1!==t?(v=!0,h[t]):e});i=y}f=e.toUpperCase(),i=i.toUpperCase(),(g=i.indexOf(f))>-1&&("'"===i[g-1]&&"'"===i[g+f.length]&&(f="'"+f+"'"),f+=d.calculateInstance.sheetToken,i=i.split(f).join(d.referenceError()),a=d.calculateInstance.rowIndex(p),o=d.calculateInstance.colIndex(p),s=p.slice(0,p.lastIndexOf(d.calculateInstance.sheetToken)+1),d.updateDataContainer([a-1,o-1],{value:i,visible:!1,isNamedRange:v,sheetId:c.tokenToParentObject.has(s)?Number(c.tokenToParentObject.get(s)):parseInt(p.split("!")[1],10)+1}),d.calculateInstance.refresh(n.getParsedFormula()))}s=m.slice(0,m.lastIndexOf(d.calculateInstance.sheetToken)+1),r===(c.tokenToParentObject.has(s)?c.tokenToParentObject.get(s):m.split("!")[1])&&(d.calculateInstance.getFormulaInfoTable().delete(m),d.calculateInstance.clearFormulaDependentCells(m))})})},r.prototype.renameUpdation=function(e,t){var r,n,i=this,a=t.toUpperCase(),o=new RegExp("[!@#$%^&()+=';,.{}|\\\":<>~_-]","g"),s=new RegExp(t.replace(o,"\\$&")+'(?=[\'!])(?=[^"]*(?:"[^"]*"[^"]*)*$)',"gi"),l=function(t){B(t.value1)&&t.value1.toUpperCase().includes(a)&&t.value1.match(s)&&(t.value1=t.value1.replace(s,e)),B(t.value2)&&t.value2.toUpperCase().includes(a)&&t.value2.match(s)&&(t.value2=t.value2.replace(s,e))};this.sheetInfo.forEach(function(o,h){if((r=Ce(i.parent,h))&&r.rows&&r.rows.length)for(var d=0,p=r.rows.length;d<p;d++)if(r.rows[d]&&r.rows[d].cells)for(var c=0,u=r.rows[d].cells.length;c<u;c++)(n=Re(d,c,r,!1,!0)).formula&&B(n.formula)&&n.formula.toUpperCase().includes(a)&&n.formula.match(s)&&(n.formula=n.formula.replace(s,e)),n.validation&&l(n.validation);if(r&&r.columns&&r.columns.length)for(var f=void 0,g=(d=0,r.columns.length);d<g;d++)(f=r.columns[d])&&f.validation&&l(f.validation);var m=i.parent.definedNames;for(d=0;d<m.length;d++)B(m[d].refersTo)&&m[d].refersTo.includes(t)&&m[d].refersTo.match(s)&&(m[d].refersTo=m[d].refersTo.replace(s,e),m[d].scope.includes(t)&&(m[d].scope=e));i.calculateInstance.updateNamedRange(t,e),o.visibleName===t&&(o.visibleName=e)})},r.prototype.updateDataContainer=function(e,t){for(var r,n,i,a=0,o=this.parent.sheets.length;a<o;a++)if((r=Ce(this.parent,a)).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?a===this.parent.activeSheetIndex&&r.activeCell===g(e[0],e[1])&&this.parent.notify(xi,{}):i.value=this.referenceError()):n.cells[e[1]]=i={}):(n=r.rows[e[0]]={})[e[1]]=i={};break}},r.prototype.parseSheetRef=function(e,t){var r,n=new RegExp("[!@#$%^&()+=';,.{}|\":<>~_-]","g"),i=0,a=this.getSheetInfo(),o=a.length,s=[];s.length=0;var l,h,d,p,c,u='(?=[\'!])(?=[^"]*(?:"[^"]*"[^"]*)*$)',f=RegExp;for(i=0;i<o;i++)if(a[i].sheet!==a[i].visibleName&&(r=new f(a[i].visibleName.replace(n,"\\$&")+u,"gi"),d=i,e.match(r))){for(var g=i+1;g<o;g++)a[g].visibleName.includes(a[i].visibleName)&&(l=new f(a[g].visibleName.replace(n,"\\$&")+u,"gi"),h=e.search(l),p=e.search(r),h>-1&&(h<p||h===p&&a[g].visibleName.length>a[i].visibleName.length)&&(c=new RegExp("Sheet","gi"),0!==a[g].visibleName.search(c)&&(r=l,d=g)));e=e.replace(r,d+"/"),s.push(d)}i=0;for(var m;i<s.length;)r=new f(s[i]+"/"+u,"gi"),m=t?"`"+a[s[i]].sheet+"`":a[s[i]].sheet,e=e.replace(r,m),i++;return e},r.prototype.registerSheet=function(e,t){void 0===e&&(e=0),void 0===t&&(t=this.parent.sheets.length);for(var r;e<t;)r=Ce(this.parent,e).id+"",this.calculateInstance.registerGridAsSheet(r,r,this.calcID),e++},r.prototype.unRegisterSheet=function(e,t,r){void 0===e&&(e=0),void 0===t&&(t=this.parent.sheets.length);var n;if(this.calculateInstance.tokenCount=0,r)this.calculateInstance.unregisterGridAsSheet(n,n,r);else for(;e<t;)n=Ce(this.parent,e).id+"",this.calculateInstance.unregisterGridAsSheet(n,n),e++},r.prototype.getUniqueRange=function(e){e.range=this.calculateInstance.uniqueRange},r.prototype.removeUniquecol=function(e){if(e&&e.clearAll)this.clearAllUniqueFormulaValue();else for(var 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=c(this.calculateInstance.uniqueRange[r]);this.calculateInstance.uniqueRange.splice(r,1);for(var a=i[0];a<=i[2];a++)for(var o=i[1];o<=i[3];o++){Re(a,o,this.parent.getActiveSheet()).formula="",this.parent.updateCell({value:"",formula:""},m([a,o]))}}}},r.prototype.refreshCalculate=function(e,r,n,i,a,o,s,l){var h=this,d=t.isNullOrUndefined(a)?this.parent.getActiveSheet():Ce(this.parent,a),p=d.id+"",u=d.name,f=this.calculateInstance.getSheetFamilyItem(p),g=v(r+1)+(e+1);if(f.isSheetMember&&!t.isNullOrUndefined(f.parentObjectToToken)&&(g=f.parentObjectToToken.get(p)+g),i){var m=n;n=this.parseSheetRef(n);var y=new aa(e+1,r+1,n),C=[d.usedRange.rowIndex,d.usedRange.colIndex];this.calculateInstance.valueChanged(p,y,!0,C,o,u,l),!0!==this.calculateInstance.isRandomVal||l||this.refreshRandomFormula();var b=Re(e,r,d);if(b&&m&&!s){var x=void 0;if(0===(m=m.toString().toUpperCase()).indexOf("=SUM(")?x="=SUM(":0===m.indexOf("=AVERAGE(")?x="=AVERAGE(":0===m.indexOf("=ROUNDDOWN(")?x="=ROUNDDOWN(":0===m.indexOf("=ROUNDUP(")?x="=ROUNDUP(":0===m.indexOf("=MOD(")&&(x="=MOD("),x){if((m=m.replace(x,"")).includes(")")){m=m.slice(0,m.lastIndexOf(")"));for(var S=void 0,w=void 0;m.includes("(")&&m.includes(")");)w=m.indexOf("("),S=m.slice(w+1),m=m.slice(0,w)+(S.includes(")")?S.slice(S.indexOf(")")+1):S)}var I,E,R,k=m.split(this.calculateInstance.getParseArgumentSeparator()),F=void 0,A=void 0,N=void 0,O=void 0;for(w=0;w<k.length;w++)if((I=k[w].split(":")[0]).includes("!")?(R=(N=I.split("!"))[0].split("'").join(""),I=N[1]):R="",U(I)&&(A=R&&void 0!==(E=ce(this.parent,R))?Ce(this.parent,E):d,O=c(I),(F=Re(O[0],O[1],A))&&F.format)){b.format=F.format;break}}else{var T=this.calculateInstance.getDependentFormulaCells().get(g);if(T&&T.size&&this.calculateInstance.getFormulaInfoTable().has(g)&&-1===this.calculateInstance.getFormulaInfoTable().get(g).getParsedFormula().lastIndexOf("q")&&!b.format){var D,L,P,M,H,B,V=this.calculateInstance.getSheetFamilyItem(null,this.calcID);T.forEach(function(e){D||(P=e.slice(0,e.lastIndexOf("!")+1),U(e=e.replace(P,""))&&(B=c(e),V.tokenToParentObject.has(P)?(H=ue(h.parent,Number(V.tokenToParentObject.get(P))),M=void 0!==H?Ce(h.parent,H):d):M=d,(L=Re(B[0],B[1],M))&&L.format&&(D=L.format)))}),D&&(b.format=D)}}}}else this.calculateInstance.getFormulaInfoTable().has(g)&&(this.calculateInstance.getFormulaInfoTable().delete(g),this.calculateInstance.clearFormulaDependentCells(g)),this.calculateInstance.refresh(g),this.calculateInstance.refreshRandValues(g);return this.calculateInstance.cell="",this.calculateInstance.getDependentCells().has(g)},r.prototype.refreshRandomFormula=function(){var e,t,r="",n=this.calculateInstance.randCollection;if(this.calculateInstance.randomValues.size>1&&this.calculateInstance.randomValues.size===n.length)for(var i=0;i<this.calculateInstance.randomValues.size;i++){e=this.calculateInstance.rowIndex(n[i]),t=this.calculateInstance.colIndex(n[i]),r=this.calculateInstance.randomValues.get(n[i]);var a=(parseFloat(this.calculateInstance.getSheetToken(n[i]).split(this.calculateInstance.sheetToken).join(""))+1).toString(),o=new aa(e,t,r);this.calculateInstance.valueChanged(a,o,!0,void 0,void 0,void 0,!1,!0)}},r.prototype.autoCorrectFormula=function(e,r,n,i){if(!t.isNullOrUndefined(e)){2===(e=(e=this.autoCorrectCellRef({formula:e})).toString()).split("(").length&&e.indexOf(")")<0&&(e+=")");var a=void 0;0===e.indexOf("=")&&(e=e.slice(1),a=!0);var o=e.match(/</g),s=e.match(/>/g),l=e.match(/=/g);if(o){for(var h="",d=0;d<o.length;d++)h+=o[d];e=e.replace(h,"<")}if(s){for(var p="",c=0;c<s.length;c++)p+=s[c];e=e.replace(p,">")}if(l){for(var u="",f=0;f<l.length;f++)u+=l[f];e=e.split(u).join("=")}e=a?"="+e:e,(o||s||l)&&(Re(r,n,t.isNullOrUndefined(i)?this.parent.getActiveSheet():Ce(this.parent,i)).formula=e)}return e},r.prototype.correctCellReference=function(e){var t,r,n,i,a,o=this,s=e.split(":");return s.forEach(function(l,h){if(r=l.split("!"),e=r[1]||l,a=null,e.includes("&"))t=e.split("&"),o.calculateInstance.isCellReference(t[1].split("$").join(""))&&(t[1]=o.getUpdatedCellRef(t[1]),a=t.join("&"));else if(o.calculateInstance.isCellReference(e.split("$").join("")))a=o.getUpdatedCellRef(e),r.length>1&&(a=r[0]+"!"+a);else if(n=l.match(/[\/\+\-\*\^\>\<\>=\<=\<>]+/g)){t=l.split(n[0]);for(var d=0;d<t.length;d++)r=t[d].split("!"),e=r[1]||r[0],o.calculateInstance.isCellReference(e.split("$").join(""))&&(t[d]=o.getUpdatedCellRef(e),r.length>1&&(t[d]=r[0]+"!"+t[d]));a=t.join(n[0])}a&&a!==l&&(i=!0,s[h]=a)}),{isInvalid:i,ref:s.join(":")}},r.prototype.autoCorrectCellRef=function(e){var t,r=e.formula.lastIndexOf(")");if(r>-1&&2===e.formula.split(")").length){for(var n=r-1;n>-1&&"("!==e.formula[n];){if(")"===e.formula[n])return e.formula;n--}if(n>-1){for(var i=e.formula.substring(n+1,r),a=this.calculateInstance.getParseArgumentSeparator(),o=i.split(a),s=void 0,l=0;l<o.length;l++)(t=this.correctCellReference(o[l])).isInvalid&&(s=!0,o[l]=t.ref);s&&(e.formula=e.formula.split(i).join(o.join(a)),e.isInvalid=!0)}}else e.formula.startsWith("=")&&!e.formula.includes(")")&&(t=this.correctCellReference(e.formula.substring(1,e.formula.length))).isInvalid&&(e.formula="="+t.ref,e.isInvalid=!0);return e.formula},r.prototype.getUpdatedCellRef=function(e){var t=e,r=0===(e=e.trim()).indexOf("$"),n=e.search(/[a-zA-Z]/),i=e.search(/\d/);return n=r?n-1:n,(r?i>1:i>0)&&D(e.substring(i,e.length))?t:e.substring(n,e.length)+e.substring(0,n)},r.prototype.initiateDefinedNames=function(){for(var e=this.parent.definedNames,t=0;t<e.length;){var r=e[t],n=this.parseSheetRef(r.refersTo),i=C(n),a=!1,o=n.indexOf("http:")>-1||n.indexOf("https:")>-1;if(i=i.split("$").join(""),(i=i.split("=").join("")).indexOf(":")>-1){var s=i.split(":");(U(s[0])&&U(s[1])||s[0].match(/[0-9]/)&&s[1].match(/[0-9]/)||s[0].toUpperCase().match(/[A-Z]/)&&s[1].toUpperCase().match(/[A-Z]/))&&(a=!0)}else i.indexOf(":")<0&&U(i)&&(a=!0);o&&(a=!1),a?this.addDefinedName(r,!0,void 0,!0):(this.removeDefinedName(r.name,r.scope,!0),t--),t++}},r.prototype.addDefinedName=function(e,t,r,n){(void 0===r||r<-1)&&(r=this.parent.definedNames.length);var i,a=!0,o=e.name;if(e.refersTo.indexOf("!")<0){var s=we(this.parent);s=-1!==s.indexOf(" ")?"'"+s+"'":s,e.refersTo=s+"!"+(e.refersTo.indexOf("=")<0?e.refersTo:e.refersTo.split("=")[1])}var l=e.refersTo,h=this.parseSheetRef(e.refersTo);e.scope?(i=ce(this.parent,e.scope))>-1&&(o=we(this.parent,i)+"!"+o):e.scope="",e.comment||(e.comment=""),!t&&this.checkIsNameExist(e.name,e.scope)?a=!1:(this.calculateInstance.addNamedRange(o,"="===h[0]?h.substr(1):h),"="!==h[0]&&(e.refersTo="="+l),this.parent.definedNames.indexOf(e)<0&&this.parent.definedNames.splice(r,0,e));var d={name:e.name,scope:e.scope,comment:e.comment,refersTo:e.refersTo,cancel:!1};return n||this.parent.notify("actionComplete",{eventArgs:d,action:"addDefinedName"}),a},r.prototype.removeDefinedName=function(e,t,r){var n=!1,i=this.getIndexFromNameColl(e,t);if(i>-1){var a=e;if(t){var o=ce(this.parent,t);o>-1&&(a=we(this.parent,o)+"!"+e)}if(this.calculateInstance.removeNamedRange(a),this.parent.definedNames.splice(i,1),!r){var s={name:e,scope:t,cancel:!1};this.parent.notify("actionComplete",{eventArgs:s,action:"removeDefinedName"})}n=!0}return n},r.prototype.checkIsNameExist=function(e,t){return this.parent.definedNames.some(function(r){return r.name===e&&(t?r.scope===t:""===r.scope)})},r.prototype.getIndexFromNameColl=function(e,t){void 0===t&&(t="");var r=-1;return this.parent.definedNames.filter(function(n,i){n.name===e&&n.scope===t&&(r=i)}),r},r.prototype.toFixed=function(e){var t=Number(e);return Math.round(t)!==t&&(e=t.toFixed(2)),e},r.prototype.aggregateComputation=function(e){var t=this.parent.getActiveSheet(),r=ye(t),n=c(r.split(":")[1]);n[0]+1===t.rowCount&&n[1]+1===t.colCount&&(r="A1:"+g(t.usedRange.rowIndex,t.usedRange.colIndex));var i,a,o=this.calculateInstance.getCellCollection(r);for(a=0;a<o.length;a++)if(i=this.calculateInstance.getValueFromArg(o[a]),D(i)){e.countOnly=!1;break}if(e.Count=this.calculateInstance.getFunction("COUNTA")(r),e.Count&&!e.countOnly){var s=["SUM","AVERAGE","MIN","MAX"],l=[],h=c(t.activeCell),d=Re(h[0],h[1],t,!1,!0);for(a=0;a<4;a++){if(i=this.toFixed(this.calculateInstance.getFunction(s[a])(r)),d.format){var p={formattedText:i,value:i,format:d.format,cell:{value:i,format:d.format}};this.parent.notify(Mr,p),i=p.formattedText}l.push(i)}e.Sum=l[0],e.Avg=l[1],e.Min=l[2],e.Max=l[3]}},r.prototype.refreshInsertDelete=function(e){var t,r=this,n=this.calculateInstance.getDependentFormulaCells(),i=ue(this.parent,e.sheet.id);this.parent.sheets.forEach(function(n,a){for(var o=0,s=n.usedRange.rowIndex;o<=s;o++)for(var l=0,h=n.usedRange.colIndex;l<=h;l++)(t=Re(o,l,n,!1,!0)).formula&&B(t.formula)&&(a===i?!e.isInsert&&("Row"===e.modelType?o>=e.startIndex&&o<=e.endIndex:l>=e.startIndex&&l<=e.endIndex)||r.updateFormula(e,t,o,l,i):t.formula.includes(e.sheet.name)&&r.updateFormula(e,t,o,l,i,!0,n))}),n.clear(),this.calculateInstance.getDependentCells().clear(),this.calculateInstance.getFormulaInfoTable().clear(),this.refreshNamedRange(e)},r.prototype.getUpdatedFormulaOnInsertDelete=function(e){this.updateFormula(e.insertDeleteArgs,e.cell,e.row,e.col,e.sheetIdx)},r.prototype.updateFormula=function(r,n,i,a,o,s,l){var h,d,p,u,f,g,y,C,b=new RegExp(/^(?=.*[a-zA-Z])(?=.*\d)/g);n.formula&&n.formula.includes("UNIQUE")&&this.clearUniqueRange(i,a,l||r.sheet);for(var x,S,I,E=function(){var e=(I?"$":"")+v(p[1]+1)+(I?"$":"")+(p[0]+1);return p[0]===p[2]&&p[1]===p[3]||(e+=":"+(I?"$":"")+v(p[3]+1)+(I?"$":"")+(p[2]+1)),e},R=this.parseFormulaArgument({formula:this.parseSheetRef(n.formula,!0),rangeRef:!0}),k=this.getSheetInfo(),F=0;F<R.length;F++)if(h=R[F].trim(),(I=h.includes("$"))&&(h=h.replace(/[$]/g,"")),y=!0,this.calculateInstance.isCellReference(h)){if(g=h.includes(":"),(d=F&&R[F-1].trim())&&"!"===d[d.length-1]){if(d=d.replace(/['!]/g,""),x=k[o].sheet===k[o].visibleName?r.sheet.name:"`"+k[o].sheet+"`",d!==x)continue}else if(s)continue;!b.test(h)&&h.indexOf(":")>-1&&(y=!1,C=!!t.isNullOrUndefined(h.match(/[0-9]/))),p=c(h),u=this.parent.updateRangeOnInsertDelete(r,p,g),f=w(p),u&&(R[F]=f[2]<f[0]||f[3]<f[1]?this.calculateInstance.getErrorStrings()[e.CommonErrors.ref]:y?E():C?m(p).replace(/\d/g,""):m(p).replace(/[a-zA-Z]/g,""),S=!0)}var A="="+R.join("");if(S){var N,O=RegExp;k.forEach(function(e){A.includes("`"+e.sheet+"`")&&(N=new O("`"+e.sheet+"`","gi"),A=A.replace(N,e.visibleName))}),n.formula!==A&&(n.formula=A,n.value=null)}},r.prototype.clearUniqueRange=function(e,t,r){var n={cellIdx:[e,t,e,t],isUnique:!1,uniqueRange:"",sheetName:r.name};this.parent.notify(nn,n);for(var i=c(n.uniqueRange),a=i[0];a<=i[2];a++)for(var o=i[1];o<=i[3];o++)delete Re(a,o,r,!1,!0).value},r.prototype.clearAllUniqueFormulaValue=function(){for(var e,t,r,n,i=this.calculateInstance.uniqueRange,a=0;a<i.length;a++)if(e=i[a].split("!"),r=Ce(this.parent,ce(this.parent,e[0])),n=c(e[1]),!(t=Re(n[0],n[1],r))||"#SPILL!"!==t.value)for(var o=n[0];o<=n[2];o++)for(var s=n[1];s<=n[3];s++)(t=Re(o,s,r))&&t.value&&delete t.value},r.prototype.parseFormulaArgument=function(e){for(var t,r,n=0,i=[],a=this.markSpecialChar(e.formula.replace("=",""),e.rangeRef),o=RegExp,s=new o(e.rangeRef?/\(|\)|=|\^|>|<|\+|-|\*|\/|%|&/g:/\(|\)|=|\^|>|<|:|\+|-|\*|\/|%|&/g),l=new o(this.parent.listSeparator,"g"),h=(a=a.split(new o(s.source+"|"+l.source,"g"))).length;n<h;)(t=a[n])?(1===t.length?i.push(this.isUniqueChar(t)?this.getUniqueCharVal(t):t):(r=t[0],t.indexOf("!")>0?(this.isUniqueChar(r)&&(i.push(this.getUniqueCharVal(r)),t=t.substr(1)),r=t.indexOf("!")+1,i.push(t.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++):n++;return e.formulaArr=i,i},r.prototype.getUniqueCharVal=function(e){switch(e){case this.uniqueOBracket:return"(";case this.uniqueCBracket:return")";case this.uniqueCSeparator:return this.parent.listSeparator;case this.uniqueCOperator:return":";case this.uniquePOperator:return"+";case this.uniqueSOperator:return"-";case this.uniqueMOperator:return"*";case this.uniqueDOperator:return"/";case this.uniqueModOperator:return"%";case this.uniqueConcateOperator:return"&";case this.uniqueEqualOperator:return"=";case this.uniqueExpOperator:return"^";case this.uniqueGTOperator:return">";case this.uniqueLTOperator:return"<"}return""},r.prototype.isUniqueChar=function(e){var t=e.charCodeAt(e);return t>=129&&t<=142},r.prototype.markSpecialChar=function(e,t){e=e.replace(/\(/g,"("+this.uniqueOBracket).replace(/\)/g,")"+this.uniqueCBracket);var r=RegExp;return e=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),e=e.replace(/\+/g,"+"+this.uniquePOperator).replace(/-/g,"-"+this.uniqueSOperator),e=e.replace(/\*/g,"*"+this.uniqueMOperator).replace(/\//g,"/"+this.uniqueDOperator),e=e.replace(/&/g,"&"+this.uniqueConcateOperator),e=e.replace(/=/g,"="+this.uniqueEqualOperator),e=e.replace(/\^/g,"^"+this.uniqueExpOperator),(e=e.replace(/>/g,">"+this.uniqueGTOperator).replace(/</g,"<"+this.uniqueLTOperator)).replace(/%/g,"%"+this.uniqueModOperator)},r.prototype.refreshNamedRange=function(e){var r=this;if(e.definedNames&&e.definedNames.length)e.definedNames.forEach(function(e){r.parent.removeDefinedName(e.name,e.scope),r.parent.addDefinedName(e)});else{var n=this.parent.definedNames.length;if(n)for(var i,a,o,s,l,h,d,p,u,f=Object.assign({},this.parent.definedNames),g=new RegExp(/^(?=.*[a-zA-Z])(?=.*\d)/g),v=0;v<n;v++)p=!0,(h=a=(o=(s=f[v]).refersTo.split("!"))[0].split("=")[1]).match(/'/g)&&(h=h.slice(1,-1)),h===e.sheet.name&&(!g.test(o[1])&&o[1].indexOf(":")>-1&&(p=!1,u=!!t.isNullOrUndefined(o[1].match(/[0-9]/))),i=c(o[1]),l=this.parent.updateRangeOnInsertDelete(e,i),d=p?m(i):u?m(i).replace(/\d/g,""):m(i).replace(/[a-zA-Z]/g,""),e.isInsert?this.updateDefinedNames(s,a,d,l):"Row"===e.modelType?this.updateDefinedNames(s,a,d,l,[i[0],i[2]],e):"Column"===e.modelType&&this.updateDefinedNames(s,a,d,l,[i[1],i[3]],e))}},r.prototype.updateDefinedNames=function(e,t,r,n,i,a){if(n){var o=this.parent.definedNames.indexOf(e),s={action:"removeDefinedName",isRemoved:!1,definedName:e.name,scope:e.scope,isEventTrigger:!0};if(this.parent.notify(jr,s),i){var l={name:e.name,comment:e.comment,refersTo:e.refersTo,scope:e.scope};if(l=new or(this.parent,"definedNames",l,!0),a.definedNames?a.definedNames.push(l):a.definedNames=[l],i[1]<i[0])return}e.refersTo=t+"!"+r,this.parent.notify(jr,{action:"addDefinedName",definedName:e,isAdded:!1,index:o,isEventTrigger:!0});var h={name:e.name,scope:e.scope,comment:e.comment,refersTo:e.refersTo,cancel:!1};this.parent.notify("actionComplete",{eventArgs:h,action:"refreshNamedRange"})}},r}(),sa=function(){function e(e){this.parent=e,this.localeObj&&(Li.currency=["$#,##0.00","$#,##0","$#,##0_);[Red]($#,##0)","$#,##0.00_);($#,##0.00)","$#,##0_);($#,##0)","$#,##0.00_);[Red]($#,##0.00)"],Li.accounting=['_($* #,##0.00_);_($* (#,##0.00);_($* "-"??_);_(@_)','_($* #,##0_);_($* (#,##0);_($* "-"_);_(@_)']),this.localeObj=t.getNumericObject(this.parent.locale),this.decimalSep=this.localeObj.decimal,this.groupSep=this.localeObj.group;var r=t.IntlBase.getDependables(t.cldrData,this.parent.locale,null).dateObject;r.dayPeriods&&r.dayPeriods&&r.dayPeriods.format&&r.dayPeriods.format.wide?(this.localeObj.am=r.dayPeriods.format.wide.am||"AM",this.localeObj.pm=r.dayPeriods.format.wide.pm||"PM"):(this.localeObj.am="AM",this.localeObj.pm="PM");var n={},i=new t.Internationalization;i.getNumberFormat(n);if("$"!==t.getNumberDependable(this.parent.locale,n.currency)){var a=i.getNumberPattern({currency:"$",useGrouping:!0,format:"c0"},!0);if(a&&a.endsWith("$")){var o=a[a.indexOf("$")-1].trim().length?"":" ";Li.currency.forEach(function(e,t){if(e.includes("$#,##0")){var r="",n=e.split("$#,##0.")[1];if(n)for(var i=0;"0"==n[i];)r+="0",i++;r&&(r="."+r),Li.currency[t]=e.split("$#,##0"+r).join("#,##0"+r+o+"$")}}),Li.accounting.forEach(function(e,t){if(e.slice(0,e.indexOf("#")).includes("$")){var r,n=e.split(";");n.forEach(function(e,t){e.includes("$")&&(e=e.replace("$",""),(r=e.includes("0)")?e.indexOf("0)")+2:e.lastIndexOf(e.includes("0")?"0":e.includes("?")?"?":e.includes('"-"')?'"':"#")+1)>0&&(n[t]=e.slice(0,r)+o+"$"+e.slice(r)))}),Li.accounting[t]=n.join(";")}})}}this.addEventListener()}return e.prototype.numberFormatting=function(e){var t=this.parent.activeSheetIndex,r=!0;e.range&&e.range.indexOf("!")>-1&&(r=(t=ce(this.parent,e.range.split("!")[0]))===this.parent.activeSheetIndex);for(var n,i,a,o=Ce(this.parent,t),s=c(e.range?e.range.indexOf("!")>-1?e.range.split("!")[1]:e.range:o.selectedRange),l=s[0];l<=s[2];l++)for(var h=s[1];h<=s[3];h++)a=Re(l,h,o,!1,!0).format,J(this.parent,o,{cell:{format:e.format},rowIdx:l,colIdx:h})||((i=Re(l,h,o)).rowSpan<0||i.colSpan<0||(n={value:i.value,format:i.format,rowIndex:l,colIndex:h,sheetIndex:t,cell:i,refresh:r},this.getFormattedCell(n),r&&(this.setCell(n),this.parent.notify(Hr,{isRightAlign:n.isRightAlign,result:n.formattedText,rowIndex:l,colIndex:h,sheetIndex:n.sheetIndex,type:n.type,curSymbol:n.curSymbol,value:n.value||0===n.value?n.value:"",isRowFill:n.isRowFill,cellEle:n.td}),a&&a!==e.format&&a.includes("[")&&-1===["Black","Blue","Cyan","Green","Magenta","Red","White","Yellow"].indexOf(Ne(e.format))&&this.removeFormatColor(n,{format:a,style:i.style}))),this.parent.setUsedRange(l,h))},e.prototype.getFormattedCell=function(e){var r=void 0===e.value||null===e.value?"":e.value;e.sheetIndex=void 0===e.sheetIndex?this.parent.activeSheetIndex:e.sheetIndex;var n=Ce(this.parent,e.sheetIndex),i=e.cell||Re(e.rowIndex,e.colIndex,n,!1,!0),a=!1,o={},s=new t.Internationalization;s.getNumberFormat(o);var l=t.getNumberDependable(this.parent.locale,o.currency);if(e.format&&"General"!==e.format||e.skipFormatCheck||i.formula&&i.formula.toLowerCase().startsWith("=text("))e.type=Ve(e.format),e.skipFormatCheck&&!e.format&&"General"===e.type&&(e.format="General");else if(e.type=e.format="General",!i.formula||i.formula&&-1===i.formula.indexOf("&-")){var h={value:r,updatedVal:r,cell:i,isEdit:e.isEdit,intl:s};this.checkDateFormat(h),(h.isDate||h.isTime)&&(a=!0,i.value=e.value=h.updatedVal,i.format&&"General"!==i.format?(e.format=i.format,e.type=Ve(e.format)):i.format=e.format=Ue(h.isDate?"ShortDate":"Time"))}if(i.format&&this.isCustomType(i)){e.type="Custom";var d=i.format.indexOf("@")>-1;""!==r&&!d&&this.isPercentageValue(r.toString(),e,i)&&(r=e.value.toString());var p=void 0,c={},u=i.format;if(i.format=i.format.split("\\").join(""),i.format.indexOf(";")>-1)i.format.indexOf("<")>-1||i.format.indexOf(">")>-1?e.result=this.processCustomConditions(i,e):(e.result=this.processCustomAccounting(i,e,l),p=!D(i.value)||"@"===i.format),i.format=u;else if(Te(i.format,!0,c,!0))""!==r&&(e.result=this.processCustomDateTime(e,i,"time"!==c.type),p=!e.formatApplied),e.result=e.result||i.value;else if(d)p=!0,e.result=this.processCustomText(i.format,r,e);else{var f=M({value:r},this.parent.locale,this.groupSep,this.decimalSep);if(f.isNumber)if(i.value=e.value=f.value,i.format.includes("E+0")){e.format!==i.format&&(e.format=i.format),this.checkAndSetColor(e);var g=e.format.split("E")[0],m=g.split(".");"."!==this.decimalSep&&1===m.length&&(m=g.split(this.decimalSep)),e.result=m[0].length>1?this.scientificHashFormat(e,m):this.scientificFormat(e)}else e.result=this.processCustomNumberFormat(i,e),p=!D(i.value);else i.format&&i.format.includes("[")&&this.removeFormatColor(e,{format:i.format,style:i.style}),p=e.dataUpdate=!0}e.dataUpdate?e.formattedText=e.result||(t.isNullOrUndefined(e.value)?"":e.value.toString()):(e.value=e.result,e.formattedText=t.isNullOrUndefined(e.value)?"":e.value.toString()),e.isRightAlign=!p&&!t.isNullOrUndefined(e.value)}else{var v=this.processFormats(e,r,a,i,s,l,o.currency,n);e.formattedText=v.fResult||(void 0===e.value||null===e.value?"":e.value.toString()),e.isRightAlign=v.rightAlign}return e.curSymbol=l,e.formattedText},e.prototype.isCustomType=function(e){var t=Ve(e.format);return"General"===t&&"General"!==e.format||"Time"===t&&this.parent.isEdit},e.prototype.processCustomFill=function(e,t,r,n){var i=e[e.indexOf("*")+1],a=e.split("*"+i);if(void 0===r.rowIndex||r.dataUpdate)n=n||this.processCustomNumberFormat({format:a.join(""),value:t.value},r);else{var o=void 0;if(a[1]){var s=parseFloat(t.value);s<0?(o=this.processCustomNumberFormat({format:a[1],value:Math.abs(s).toString()},r),n="-"+a[0].split("'").join("")):(o=this.processCustomNumberFormat({format:a[1],value:t.value},r),n=a[0].split("'").join("")),0===s&&(o=o.split("0").join(""))}else n=n||this.processCustomNumberFormat({format:a[0],value:t.value},r);r.isRowFill=!0,this.setCell(r),this.parent.notify(vi,{cell:t,cellEle:r.td,rowIdx:r.rowIndex,colIdx:r.colIndex,beforeFillText:n,repeatChar:i,afterFillText:o})}return n},e.prototype.processCustomDateTime=function(e,r,n){var i,a=this;if(!D(r.value)&&!(i=function(){var e=r.value.toString();if(e.includes(a.localeObj.dateSeparator)||e.indexOf("-")>0||e.includes(a.localeObj.timeSeparator))return!0;var n=t.IntlBase.getDependables(t.cldrData,a.parent.locale,null).dateObject,i=n.months["stand-alone"]&&n.months["stand-alone"].abbreviated;return i&&!!Object.keys(i).find(function(t){return e.includes(i[""+t])})}()))return r.value||"";var o,s=r.format,l=new t.Internationalization,h=function(h){var p,c;if(i){if(c=L(r.value,new t.Internationalization,a.parent.locale,s,r),p=c.dateObj&&"Invalid Date"!==c.dateObj.toString()){if(c.dateObj.getFullYear()<1900)return"";r.value=O(c.dateObj,r.value.toString().includes(":"),"time"===c.type).toString()}}else{if(a.checkAndProcessNegativeValue(e,r.value))return e.formatApplied=!0,e.formattedText;p=(c={dateObj:N(parseFloat(r.value))}).dateObj&&"Invalid Date"!==c.dateObj.toString()}if(p){h&&n&&(e.dateObj=c.dateObj),e.formatApplied=!0;var u=void 0;if(s.startsWith("MM-dd-yyyy "))s=s.split(" ").splice(1).join(" "),u=l.formatDate(c.dateObj,{type:"date",skeleton:"yMd"})+(s?" "+l.formatDate(c.dateObj,{type:o,format:s}):"");else if(u=l.formatDate(c.dateObj,{type:o,format:s}),(s=s.toLowerCase()).startsWith("[h]")){u=(24*Number(r.value.toString().split(".")[0])+c.dateObj.getHours()).toString()+u.slice(u.indexOf("]")+1)}else if(s.startsWith("[m")){u=(1440*Number(r.value.toString().split(".")[0])+60*c.dateObj.getHours()+c.dateObj.getMinutes()).toString()+u.slice(u.indexOf("]")+1)}else s.startsWith("[s")&&(u=(86400*Number(r.value.toString().split(".")[0])+60*(60*c.dateObj.getHours()+c.dateObj.getMinutes())+c.dateObj.getSeconds()).toString());return d?u.replace(a.localeObj.am,"A").replace(a.localeObj.pm,"P"):u}return""};s=s.split("_(").join(" ").split("_)").join(" "),r.format.indexOf("h")>-1&&(s=s.split("h").join("H"),o="time"),r.format.indexOf("s")>-1&&(o="time");var d=r.format.indexOf("A/P")>-1;if((r.format.indexOf("AM/PM")>-1||d)&&(s=(s=s.split("H").join("h")).split("A/P").join("AM/PM").split("AM/PM").join("a"),o="time"),r.format.indexOf("d")>-1){o="date";for(var p=s.split(" "),c=void 0,u=0;u<p.length;u++)(c=p[u].match(/d/g))&&c.length>2&&(p[u]=p[u].split("d").join("E"));s=p.join(" ")}if(r.format.indexOf("m")>-1)if(r.format.indexOf("s")>-1||r.format.indexOf("h")>-1){if(o="time",r.format.includes(" ")){((p=s.split(" "))[0].includes("d")||p[0].includes("y"))&&(p[0]=p[0].split("m").join("M"),s=p.join(" "))}}else if(o="date",s=s.split("m").join("M"),r.format.indexOf("mmmmm")>-1){s="MMMM";var f=h()[0];return s=r.format.split("mmmmm").join("p"),h(e.checkDate).split("p").join(f)}return h(e.checkDate)},e.prototype.processCustomConditions=function(e,t){if(D(e.value)){for(var r=e.format.split(";"),n=Number(e.value),i=void 0,a=void 0,o=void 0,s=void 0,l=0;l<r.length;l++){if(e.format=r[l],(s=Ne(e.format))&&(e.format=e.format.split("["+s+"]").join("")),!e.format.includes("[")){e.format=r[l],o=!1;break}if(i=e.format.split("[")[1].split("]")[0],2===(a=i.split("<=")).length&&n<=Number(a[1])||1===a.length&&2===(a=i.split(">=")).length&&n>=Number(a[1])||1===a.length&&2===(a=i.split("<")).length&&n<Number(a[1])||1===a.length&&2===(a=i.split(">")).length&&n>Number(a[1])){e.format=r[l].split("["+i+"]").join(""),o=!1;break}o=2===a.length}return o?(this.removeFormatColor(t,{format:r.join(""),style:e.style}),this.processCustomFill("*#",e,t,"#####")):this.processCustomNumberFormat(e,t)}return e.value},e.prototype.processCustomAccounting=function(e,t,r){var n,i=e.format.split(";"),a=M(e,this.parent.locale,this.groupSep,this.decimalSep,r);a.isNumber&&(e.value=a.value,n=parseFloat(a.value));var o;if(n>0)o=i[0];else if(0===n)o=i[2]?i[2].includes(r+"0")?i[2].split("0").join("#"):i[2]:i[0];else{if(!D(n)){var s=e.value||0===e.value?e.value:"";return e.format="@",i[3]?this.processCustomText(i[3],s,t):s.toString()}o=i[1]}return this.processCustomNumberFormat({format:e.format,value:n<0?Math.abs(n).toString():e.value,style:e.style},t,o)},e.prototype.processCustomText=function(e,t,r){t=t.toString();var n=this.processCustomNumberFormat({format:e.split("@").join("#"),value:t.split(t).join("1")},r);return n&&n.split("1").join(t)},e.prototype.thousandSeparator=function(e,t){for(;e;)t/=1e3,e--;return t},e.prototype.getSeparatorCount=function(e){for(var t=0,r=["#","0"],n=0;n<e.format.length;n++)","!==e.format[n]||r.indexOf(e.format[n+1])>-1||t++;return t},e.prototype.processDigits=function(e,t){t=t.split("?").join("0");var r=e.value.toString();if((r=this.getFormattedNumber(t,parseFloat(r)))&&r.includes(this.decimalSep)){var n=r.split(this.decimalSep);r=n[0]+this.decimalSep+n[1].split("0").join(" ")}return r||e.value},e.prototype.processFormatWithSpace=function(e,t,r){var n={cell:t,char:" ",width:0};this.parent.notify(yi,n);for(var i,a=n.width,o={format:e,formattedText:""},s=0;s<e.length;s++)if("_"===e[s]){n.char=e[s+1],this.parent.notify(yi,n);var l=n.width;i=Math.round(l/a),e=e.replace(e[s]+e[s+1]," ".repeat(i))}var h=e.length-e.trim().length;if(h>0){if(o.formattedText=this.getFormattedNumber(e.trim(),r)," "===e[0]){for(var d=1,p=1;" "===e[p];)d++,p++;h-=d,o.formattedText=" ".repeat(d)+o.formattedText}o.formattedText+=" ".repeat(h)}else o.formattedText=this.getFormattedNumber(e,r);return o.format=e,o},e.prototype.removeFormatColor=function(e,t){["Black","Blue","Cyan","Green","Magenta","Red","White","Yellow"].indexOf(Ne(t.format))>-1&&(e.color=t.style&&t.style.color?t.style.color:"",this.applyColor(e))},e.prototype.processCustomNumberFormat=function(e,t,r){if(!e.format)return"";var n,i,a=e.value,o=e&&M(e,this.parent.locale,this.groupSep,this.decimalSep).value;if(D(o)){e.value=o,o=parseFloat(o.toString());var s=r||e.format;if(e.format.indexOf("[")>-1){var l=Ne(s);l?(s=s.split("["+l+"]").join(""),t.color=l.toLowerCase(),this.applyColor(t)):this.removeFormatColor(t,e)}(s.indexOf('"')>-1||s.indexOf("\\")>-1)&&(s=this.processText(s),(i=0===o&&!s.includes("#")&&!s.includes("0"))&&(s+="#"));var h=this.getSeparatorCount(e);if(h){n=!0;var d=this.thousandSeparator(h,o);-1===s.indexOf(".")&&(d=Math.round(d)),a=this.getFormattedNumber(s.split(",").join(""),d),0===d&&(a=a.replace("0",""))}if(s.indexOf("?")>-1&&(n=!0,a=this.processDigits(e,s),s=s.split("?").join("")),s.indexOf("_")>-1){n=!0;s=(d=this.processFormatWithSpace(s,e,o)).format,a=d.formattedText}if(a&&s.indexOf("?")>-1&&(a=a.replace("?"," ")),s.indexOf("*")>-1&&(n=!0,a=this.processCustomFill(s,e,t)),"General"===s&&(n=!0,a=o.toString()),n||(a=this.getFormattedNumber(s,o)),i&&a&&(a=a.replace("0","")),"#"===s[0]&&o>=0&&o<1){var p=s.split("#").join("").split(".");if(!p[0].includes("0")){0!==o||!s.includes(".")||p[1]&&p[1].includes("0")||(a=(a=this.getFormattedNumber(s,.1)).replace("1",""));var c=a.split(this.decimalSep);c[0]=c[0].toString().replace(/^0+/,""),a=c.join(this.decimalSep)}}"-0"===a&&(a="0")}return a},e.prototype.processText=function(e){var t=e;return t.indexOf('"')>-1?t=t.split('"').join("'"):t.indexOf("\\")>-1&&(t=t.split("\\").join("")),t},e.prototype.processFormats=function(e,t,r,n,i,a,o,s){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:a,fResult:t,intl:i,isRightAlign:r,curCode:o,cell:n,rowIdx:Number(e.rowIndex),colIdx:Number(e.colIndex),sheet:s}).fResult.toString().startsWith("\n")||l.fResult.toString().endsWith("\n ")||this.autoDetectGeneralFormat(l),t=l.fResult,r=l.isRightAlign;break;case"Number":(h=M({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=M({value:t,format:e.format},this.parent.locale,this.groupSep,this.decimalSep,a)).isNumber&&(n.value=e.value=h.value,t=this.currencyFormat(e,i,o,n),r=!0);break;case"Percentage":(h=M({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,a,o,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=M({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=M({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&&D(t)&&t.toString().includes(".")&&(t=t.toString().replace(".",this.decimalSep)),r=!1}}return{fResult:t,rightAlign:r}},e.prototype.autoDetectGeneralFormat=function(e){var r,n=e.fResult,i=e.args.cell&&e.args.cell.formula&&e.args.cell.formula.indexOf("ADDRESS(")>0,a=e.args.cell&&e.args.cell.formula&&e.args.cell.formula.indexOf("DOLLAR(")>0,o=e.args.cell&&e.args.cell.formula&&e.args.cell.formula.indexOf("TEXT(")>0;if(!(a&&e.fResult&&e.fResult.toString().includes(e.currencySymbol)||o)){if(e.fResult&&"."!==this.decimalSep){r=s=e.fResult.toString(),s.includes(this.decimalSep)&&D(s=s.replace(this.decimalSep,"."))&&(s.includes("E")?e.fResult=s:(e.fResult=e.args.value=s=Number(s).toString(),ke(e.rowIdx,e.colIdx,e.sheet,{value:s},!0)),r=s.replace(".",this.decimalSep))}if(D(e.fResult)){var s=Number(e.fResult).toString();if(e.fResult.toString().includes("E")?(e.args.format=Ue("Scientific"),ke(e.rowIdx,e.colIdx,e.sheet,{value:s,format:e.args.format},!0),e.args.value=s,e.fResult=this.scientificFormat(e.args)):e.args.format&&(e.args.format.indexOf("%")>-1?e.fResult=this.percentageFormat(e.args,e.intl):e.args.format.indexOf(e.currencySymbol)>-1?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){if(e.args.cell&&e.args.cell.formula&&s.includes(".")&&s.length>11){var l=s.indexOf(".")+1;r=null,e.args.cell.formula.includes("RANDBETWEEN")&&(e.fResult=s=l<7?s:parseFloat(s).toFixed(0))}e.cellVal=s,e.prevVal=r,this.parseDecimalNumber(e),t.isNullOrUndefined(e.fResult)&&!t.isNullOrUndefined(e.cellVal)&&(e.fResult=e.cellVal)}e.isRightAlign=!0}e.fResult&&this.updateAutoDetectNumberFormat(e),i&&(e.isRightAlign=!1,e.fResult=n)}},e.prototype.parseDecimalNumber=function(e){var t=e.cellVal.split(".");if(t[0].length>11){e.cellVal=Math.abs(Number(t[0])).toString().substring(0,6).replace(/0+$/,"");(i=e.cellVal.length-1)>-1&&(e.fResult=this.scientificFormat(e.args,i>5?5:i))}else if(t[1])if(e.cellVal.length>11){var r=10-(t[0].length-(Math.sign(Number(e.cellVal))<0?1:0));e.fResult=e.intl.formatNumber(Number(e.cellVal),{format:r>0?"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))}else if(e.cellVal.includes("e-")){var n=e.cellVal.split("e-"),i=Number(n[1])+(n[0].includes(".")?n[0].split(".")[1].length:0);n[0]=n[0].replace(".",this.decimalSep),1===n[1].length&&(n[1]="0"+n[1]),e.args.updateValue||ke(e.rowIdx,e.colIdx,e.sheet,{value:Number(e.cellVal).toFixed(i)},!0),e.fResult=n.join("E-")}else e.prevVal?e.fResult=e.prevVal:e.args.updateValue&&"."!==this.decimalSep&&(e.fResult=e.cellVal.replace(".",this.decimalSep))},e.prototype.updateAutoDetectNumberFormat=function(e){var t=e.fResult.toString(),r=e.args.cell||e.cell;if(this.isPercentageValue(t,e.args,r))r.format=t.includes(this.decimalSep)?Ue("Percentage"):"0%",e.args.updateValue||(e.args.format=r.format,e.fResult=this.percentageFormat(e.args,e.intl),e.isRightAlign=!0);else{var n="";t.includes(e.currencySymbol)&&(n=t.includes(this.decimalSep)?Li.currency[0]:Li.currency[1],t=t.replace(e.currencySymbol,""));("."===this.decimalSep||e.args.isEdit&&!r.formula)&&t.includes(this.groupSep)&&H(t,this.parent.locale,this.groupSep,this.decimalSep)&&(t=t.split(this.groupSep).join(""),n||(n=t.includes(this.decimalSep)?"#,##0.00":"#,##0")),n?D(t=t.replace(this.decimalSep,"."))&&(e.args.value=Number(t).toString(),e.args.updateValue?(e.args.cell.value=e.args.value,e.args.cell.format=n):(ke(e.rowIdx,e.colIdx,e.sheet,{value:e.args.value,format:n},!0),e.fResult=this.getFormattedNumber(n,Number(e.args.value)),e.isRightAlign=!0)):"."!==this.decimalSep&&"General"===e.args.format&&D(t)&&t.includes(".")&&(e.fResult=Number(t).toString().replace(".",this.decimalSep))}},e.prototype.isPercentageValue=function(e,t,r){if(e.includes("%")){var n=e.split("%");if(""!==n[0]&&""===n[1].trim()){var i=M({value:n[0]},this.parent.locale,this.groupSep,this.decimalSep);if(i.isNumber)return t.value=Number(i.value)/100,r.value=t.value.toString(),!0}}return!1},e.prototype.findSuffix=function(e,t){var r=e.length-t.length;return e.substr(0,r<0?0:r)+t},e.prototype.applyNumberFormat=function(e,r){e.format=this.isCustomFormat(e.format);var n=e.format.split(";");if(Number(e.value)>0)e.format=n[0];else if(0===Number(e.value)){if(e.format=n[2]?n[2]:n[0],e.format.indexOf('"')>-1&&-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=t.isNullOrUndefined(n[1])?n[0]:n[1].split("*").join(" "),e.format.indexOf("-")>-1&&(e.value=e.value.toString().split("-").join(""));else if(e.format=n[3]?n[3]:n[0],e.format=e.format.split("_").join(" ").split("*").join(" ").split("?").join(" "),e.format.indexOf("@")>-1)return e.format.split("@").join(e.value.toString());if(e.format=e.format.split("_").join(" ").split("*").join(" ").split('"').join(""),e.format.indexOf("?")>-1&&e.format.indexOf(this.decimalSep)>-1){var i=e.format.split(this.decimalSep)[1].length,a="";if(Number(e.value)%1){a=i>e.value.toString().split(".")[1].length?" ":"0"}e.format=e.format.split("?").join(a)}else e.format=e.format.split("?").join(" ");return Number(e.value)<0&&e.cell&&e.cell.format&&(e.format=e.cell.format),r.formatNumber(Number(e.value),{format:e.format})},e.prototype.isCustomFormat=function(e){return'_-* #,##0.00_-;-* #,##0.00_-;_-* "-"_-;_-@_-'!==e&&'_-* #,##0_-;-* #,##0_-;_-* "-"_-;_-@_-'!==e||(e=""),e=""===e?Ue("Number"):e,e=e.toString().split("_)").join(" ").split("_(").join(" ").split("[Red]").join("")},e.prototype.currencyFormat=function(e,r,n,i){e.format=e.format||Ue("Currency"),e.format=e.format.split("_(").join(" ").split("_)").join(" ");var a=e.format.split(";"),o=Ne(e.format),s=Number(e.value);return s>=0||t.isNullOrUndefined(a[1])?(o&&(e.color=i.style&&i.style.color?i.style.color:"",this.applyColor(e)),e.format=a[0]):(s=Math.abs(s),e.format=a[1].split("["+o+"]").join("").split("*").join(" "),o&&(e.color=o.toLowerCase(),this.applyColor(e))),e.format=this.getFormatForOtherCurrency(e.format),r.formatNumber(s,{format:e.format,currency:n})},e.prototype.applyColor=function(e){e.refresh&&(this.setCell(e),e.td&&e.td.style.color!==e.color&&this.parent.notify(_r,{style:{color:e.color},rowIdx:e.rowIndex,colIdx:e.colIndex,td:e.td}))},e.prototype.setCell=function(e){if(!e.td){var t={sheet:Ce(this.parent,e.sheetIndex),cell:e.cell,rowIdx:e.rowIndex,colIdx:e.colIndex};(e.cell.rowSpan>1||e.cell.colSpan>1)&&se(t),e.td=this.parent.getCell(t.rowIdx,t.colIdx)}},e.prototype.percentageFormat=function(e,t){return e.format=""===e.format?Ue("Percentage"):e.format,t.formatNumber(Number(e.value),{format:e.format})},e.prototype.accountingFormat=function(e,t,r,n,i,a){e.format=e.format||Ue("Accounting"),e.format=e.format.split("_(").join(" ").split("_)").join(" ").split("[Red]").join("").split("_").join("");var o=e.format.split(";"),s=M({value:t},this.parent.locale,this.groupSep,this.decimalSep);if(s.isNumber){a.value=e.value=s.value;var l=Number(e.value);if(l>=0?e.format=0===l&&o[2]?o[2]:o[0]:(e.format=o[1].split("*").join(" "),l=Math.abs(l)),e.format.includes(n)||e.format.includes("$")||(i=n=""),e.format=this.getFormatForOtherCurrency(e.format),e.formatApplied=!0,0===l){if(e.format=this.processText(e.format.split("*").join(" ").split("?").join(" ")),!e.format.includes("#")&&!e.format.includes("0")){e.format+="#";var h=r.formatNumber(l,{format:e.format,currency:i});return h.includes("0")&&(h=h.replace("0","")),h}return r.formatNumber(l,{format:e.format,currency:i})}return r.formatNumber(l,{format:e.format,currency:i})}return o[3]?this.processCustomText(o[3],t,e):t},e.prototype.getFormatForOtherCurrency=function(e){if(e.indexOf("[$")>-1){var t=e.split("]")[0].split("[$")[1].split("-")[0];e=e.indexOf("0")>e.indexOf("[$")?t+e.slice(e.indexOf("]")+1,e.length):e.slice(0,e.indexOf("[$"))+t}return e},e.prototype.checkAndProcessNegativeValue=function(e,t){if(t&&D(t)&&Number(t)<0){if(void 0===e.rowIndex||e.dataUpdate)return e.formattedText="#".repeat(e.dataUpdate?7:10),!0;e.isRowFill=!0,this.setCell(e);var r={cell:e.cell,cellEle:e.td,rowIdx:e.rowIndex,colIdx:e.colIndex,repeatChar:"#"};return this.parent.notify(vi,r),e.formattedText=r.formattedText,!0}return!1},e.prototype.shortDateFormat=function(e,t){var r,n;if(""===e.format||"General"===e.format||e.format===Ue("ShortDate")?(n="MM-dd-yyyy",r={type:"date",skeleton:"yMd"}):r={type:"date",format:n=e.format},e.value&&(e.value=e.value.toString(),!D(e.value)&&(e.value.includes(this.localeObj.dateSeparator)||e.value.indexOf("-")>0))){"dd-MM-yyyy"!==n&&"dd/MM/yyyy"!==n||(n="");var i=L(e.value,t,this.parent.locale,n,e.cell).dateObj;if(i&&"Invalid Date"!==i.toString())return i.getFullYear()<1900?D(e.value)?e.value:"":(e.value=O(i).toString(),e.cell&&(e.cell.value=e.value),e.checkDate&&(e.dateObj=i),t.formatDate(i,r))}var a=N(e.value);return a&&"Invalid Date"!==a.toString()&&a.getFullYear()<1900?D(e.value)?e.value.toString():"":(e.checkDate&&(e.dateObj=a),t.formatDate(a,r))},e.prototype.longDateFormat=function(e,t){e.value=e.value.toString();var r;if((e.value.includes(this.localeObj.dateSeparator)||e.value.indexOf("-")>0)&&!D(e.value)){if(!((r=L(e.value,t,this.parent.locale,"",e.cell).dateObj)&&"Invalid Date"!==r.toString()&&r.getFullYear()>=1900))return D(e.value)?e.value:"";e.value=O(r).toString(),e.cell&&(e.cell.value=e.value)}else if((r=N(e.value))&&"Invalid Date"!==r.toString()&&r.getFullYear()<1900)return D(e.value)?e.value:"";var n=""===e.format||"General"===e.format?Ue("LongDate"):e.format.toString();return n===Ue("LongDate")&&(n="EEEE, MMMM d, y"),e.checkDate&&(e.dateObj=r),t.formatDate(r,{type:"date",format:n})},e.prototype.timeFormat=function(e,r){if(t.isNullOrUndefined(e.value))return"";var n=""===e.format||"General"===e.format||e.format===Ue("Time")?"h:mm:ss a":e.format,i=e.value.toString();if(!D(i)&&i.includes(this.localeObj.timeSeparator)){var a=L(i,r,this.parent.locale,n,e.cell);if(!a.dateObj||"Invalid Date"===a.dateObj.toString())return"";i=e.value=O(a.dateObj,!0,a.type&&"time"===a.type).toString(),e.cell&&(e.cell.value=e.value)}var o=i.split(".");return t.isNullOrUndefined(o[1])||(e.value=parseFloat(o[0]+1+"."+o[1])||e.value),r.formatDate(N(e.value),{type:"time",skeleton:"medium",format:n})},e.prototype.scientificHashFormat=function(e,t){var r,n=this.findDecimalPlaces(e.format),i=t[0].split("0").length-1+(t[0].split("#").length-1),a=Number(e.value).toExponential(n+i);if(a.includes("e+"))r="e+";else{if(!a.includes("e-"))return a;r="e-"}var o,s=a.split(r),l=s[0].split("."),h=Number(s[1]);if("e-"===r){var d=h+Math.abs(h-i*(h>i?2:1));o=d-h,s[1]=d.toString()}else o=h%i,s[1]=(h-o).toString();o>0&&(l[0]+=l[1].substring(0,o),l[1]=l[1].slice(o),s[0]=l.join("."));var p=Number("1"+"0".repeat(n));return this.getFormattedNumber(t.join("."),Number((Math.round(Number(s[0])*p)/p).toFixed(n)))+r.toUpperCase()+this.findSuffix(e.format.split("+")[1],s[1])},e.prototype.scientificFormat=function(e,t){e.format||(e.format=Ue("Scientific"));var r=e.format.split("+")[1]||"00";void 0===t&&(t=this.findDecimalPlaces(e.format));var n=Number(e.value).toExponential(t);return n.indexOf("e+")>-1?n=n.split("e+")[0]+"E+"+this.findSuffix(r,n.split("e+")[1]):n.indexOf("e-")>-1&&(n=n.split("e-")[0]+"E-"+this.findSuffix(r,n.split("e-")[1])),n.replace(".",this.decimalSep)},e.prototype.fractionFormat=function(e){e.format=e.format||Ue("Fraction"),this.checkAndSetColor(e);var t=e.value.toString().split("."),r=this.getFormattedNumber(e.format.split(" ")[0],Number(t[0])),n=e.format.split("?").length/2;if(2===t.length&&!t[1].startsWith("0".repeat(n))){var i=F(Number(e.value));if(i)return r+" "+i}return r+" "+" ".repeat(2*n)},e.prototype.checkAndSetColor=function(e){var t=Ne(e.format);t&&(e.format=e.format.split("["+t+"]").join(""),e.color=t.toLowerCase(),this.applyColor(e))},e.prototype.findDecimalPlaces=function(e){var t=e.toUpperCase().indexOf("E");if(t>-1){var r=e.indexOf(this.decimalSep);return-1===r&&"."!==this.decimalSep&&(r=e.indexOf(".")),r>0?e.substring(r+1,t).length:0}return 2},e.prototype.checkDateFormat=function(e){if(!t.isNullOrUndefined(e.value)){var r=e.cell||Re(e.rowIndex,e.colIndex,Ce(this.parent,t.isNullOrUndefined(e.sheetIndex)?this.parent.activeSheetIndex:e.sheetIndex),!1,!0),n=this.checkCustomDateFormat(e.value.toString(),r,e.isEdit);if("Invalid"!==n.val){var i=L(n.val,e.intl||new t.Internationalization(this.parent.locale),this.parent.locale,n.format,e.skipCellFormat&&r,n.isDateTime);if(!t.isNullOrUndefined(i.dateObj)&&"Invalid Date"!==i.dateObj.toString()&&i.dateObj.getFullYear()>=1900){if(n.val=O(i.dateObj,n.val.indexOf(":")>-1,i.type&&"time"===i.type).toString(),(!r.format||"General"===r.format)&&("time"===i.type?r.format=Ue("Time"):r.format=Ue("ShortDate"),e.updateValue))return void(r.value=n.val);e.isDate="date"===i.type||"datetime"===i.type,e.isTime="time"===i.type,e.dateObj=i.dateObj}e.updatedVal=n.val}}},e.prototype.checkCustomTimeFormat=function(e,t){var r=this,n=[],i=" "+this.localeObj.am,a=" "+this.localeObj.pm,o=e.includes(i)||e.includes(a);o||(e.includes(i.toLowerCase())||e.includes(a.toLowerCase()))&&(e=e.replace(i.toLowerCase(),i).replace(a.toLowerCase(),a),o=!0);var s,l=e.split(this.localeObj.timeSeparator),h=3===l.length&&o;if(l.length<=3){var d,p,c=o?12:24;l.forEach(function(t,o){t.includes(i)||t.includes(a)?(s=" AM/PM",t=t.replace(i,"").replace(a,"")):s="",D(d=Number(t))&&d>=0?d<=c&&0===o?(n.push("h"+s),1===l.length&&(s?((p=e.split(" "))[0]+=r.localeObj.timeSeparator+"00",l[0]=p.join(" ")):(n=[],e="Invalid"))):d<=60&&(1===n.length||2===n.length)?(1===n.length?n.push("mm"+s):n.push("ss"),1===t.length&&(l[o]="0"+l[o])):(n=[],e="Invalid"):(n=[],e="Invalid")})}else e="Invalid";return!n.length||(e=l.join(this.localeObj.timeSeparator),t.format&&"General"!==t.format||h)?{val:e,format:""}:(t.format=n.join(":"),{val:e,format:t.format})},e.prototype.checkCustomDateFormat=function(e,r,n){var i,a,o=this,s=r.format;if(e.includes(this.localeObj.dateSeparator)&&(!e.includes(" "+this.localeObj.am)&&!e.includes(" "+this.localeObj.pm)||e.replace(" "+this.localeObj.am,"").replace(" "+this.localeObj.pm,"").includes(this.localeObj.dateSeparator))){if(i=this.localeObj.dateSeparator,e.includes(this.localeObj.timeSeparator)&&e.includes(" ")){var l=e.split(" ");if(e=l.shift(),"Invalid"===(a=this.checkCustomTimeFormat(l.join(" "),r)).val)return{val:"Invalid",format:""}}}else{if(!(e.indexOf("-")>0))return e.includes(this.localeObj.timeSeparator)||e.includes(" "+this.localeObj.am)||e.includes(" "+this.localeObj.pm)?this.checkCustomTimeFormat(e,r):{val:"Invalid",format:""};i="-"}var h,d=e.split(i),p="",c=[],u=function(){p=c.join(i),s&&"General"!==s||(r.format=p+(r.format&&"General"!==r.format?" "+r.format:""))},f=t.IntlBase.getDependables(t.cldrData,this.parent.locale,null).dateObject,g=f.months["stand-alone"]?f.months["stand-alone"].wide:{},m=f.months["stand-alone"]?f.months["stand-alone"].abbreviated:{1:""},v=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],y=function(e,t,r,n){if(m[""+t]&&m[""+t].toLowerCase()===r)h=m[""+t];else{e.substring(0,n)===r&&(h=m[""+t]||v[Number(t)-1])}};if(2===d.length){var C=function(t){e=h,c[0]="MMM",Number(t)<=31?(e=t+i+e,"/"!==o.localeObj.dateSeparator&&"-"!==i&&(e+=i+(new Date).getFullYear()),c.splice(0,0,"dd"),u()):Number(t)>=1900&&Number(t)<=9999?(e="1"+i+e+i+t,c[1]="yy",u(),c[1]="yyyy",p=c.join(i)):e="Invalid"};d[0]=d[0].toLowerCase().trim(),d[1]=d[1].toLowerCase().trim(),!Number(d[0])&&d[0].length>=m[1].length?(Object.keys(g).find(function(e){return y(g[""+e].toLowerCase(),e,d[0],d[0].length)}),t.isNullOrUndefined(h)||d[0].includes(",")||C(d[1])):!Number(d[1])&&d[1].length>=m[1].length?(Object.keys(g).find(function(e){return y(g[""+e].toLowerCase(),e,d[1],d[1].length)}),t.isNullOrUndefined(h)||C(d[0])):Number(d[0])&&Number(d[0])<=12&&Number(d[1])&&("/"===this.localeObj.dateSeparator||"-"===i||n&&!r.formula)&&(h=v[Number(d[0])-1],C(d[1])),c.length||(e="Invalid")}else if(d.length>2)for(var b=function(r){Number(d[r])>-1||(d[r]=d[r].trim(),Object.keys(g).find(function(e){return y(g[""+e].toLowerCase(),e,d[r].trim().toLowerCase(),d[r].length)}),t.isNullOrUndefined(h)?e="Invalid":1===r&&(c[1]="MMM",d[2]=d[2].trim(),Number(d[0])<31&&Number(d[2])>=1900&&Number(d[2])<=9999&&(e=d[0]+i+h,e+=i+d[2],c[0]="d",c[2]="yy",u(),c[2]="yyyy",p=c.join(i))))},x=0;x<d.length;x++)b(x);var S;return a&&"Invalid"!==e&&(p||s&&"General"!==s?a.format&&(p+=" "+a.format):r.format=Ue("ShortDate")+" "+(a.format||Ue("Time")),e+=" "+a.val,S=!0),{val:e,format:p,isDateTime:S}},e.prototype.formattedBarText=function(e){var r=this;if(""!==e.value&&!t.isNullOrUndefined(e.value)){var n={},i=e.cell&&e.cell.format||"",a=e.type||(i&&Te(i,!0,n,!0)?n.type:""),o=new t.Internationalization,s=e.value,l=!e.showFormattedText||"dd-MM-yyyy"!==i&&"dd/MM/yyyy"!==i?Ue("ShortDate"):i,h=Ue("Time"),d=i.toLowerCase(),p=function(){"."!==r.decimalSep&&e.value&&(e.value=e.value.toString(),D(e.value)&&e.value.includes(".")&&(e.value=e.value.replace(".",r.decimalSep)))};if("time"!==a||!d.includes("m")||d.includes(":m")||d.includes("m:")||d.includes("[m")||d.includes("am")||(a="date"),"date"===a){var c=e.value.toString();e.value=this.shortDateFormat({type:a,value:e.value,format:l,cell:e.cell},o),e.value&&c.includes(".")&&(e.value+=" "+this.timeFormat({type:a,value:c,format:h},o))}else a.includes("time")?s&&Number(s)>=1||"datetime"===a?e.value=this.shortDateFormat({type:a,value:e.value,format:l},o)+" "+this.timeFormat({type:a,value:e.value,format:h},o):e.value=this.timeFormat({type:a,value:e.value,format:h},o):e.cell.format&&e.cell.format.includes("%")&&D(e.cell.value)?(e.value=this.parent.getDisplayText(e.cell),e.value.includes("%")||(e.value=s,p())):p();(!e.value||e.value&&e.value.toString().indexOf("null")>-1)&&(e.value=s)}},e.prototype.getFormattedNumber=function(e,r){return(new t.Internationalization).formatNumber(Number(r),{format:e})||""},e.prototype.addEventListener=function(){this.parent.on(Pr,this.numberFormatting,this),this.parent.on(Mr,this.getFormattedCell,this),this.parent.on(Wr,this.checkDateFormat,this),this.parent.on(Xr,this.formattedBarText,this),this.parent.on(Gr,this.updateAutoDetectNumberFormat,this),this.parent.on(Yr,this.parseDecimalNumber,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(Pr,this.numberFormatting),this.parent.off(Mr,this.getFormattedCell),this.parent.off(Wr,this.checkDateFormat),this.parent.off(Xr,this.formattedBarText),this.parent.off(Gr,this.updateAutoDetectNumberFormat),this.parent.off(Yr,this.parseDecimalNumber))},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.getModuleName=function(){return"workbookNumberFormat"},e}(),la=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.addEventListener=function(){this.parent.on(ln,this.initiateSortHandler,this),this.parent.on(hn,this.updateSortedDataOnCell,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(ln,this.initiateSortHandler),this.parent.off(hn,this.updateSortedDataOnCell))},e.prototype.initiateSortHandler=function(e){var n=this,i=e.args,a=new r.Deferred,o=this.parent.getAddressInfo(i.range),s=Ce(this.parent,o.sheetIndex),l=w(o.indices),h=i.sortOptions||{sortDescriptors:{},containsHeader:!0},d=!1;if(e.promise=a.promise,l[0]>s.usedRange.rowIndex||l[1]>s.usedRange.colIndex)a.reject(this.parent.serviceLocator.getService(Ti).getConstant("SortOutOfRangeError"));else{var p=h.containsHeader,c=i.checkForHeader;if((l[0]===l[2]||c)&&(c||(l=ee(l[0],l[1],s)),d=!0,t.isNullOrUndefined(h.containsHeader)&&(p=typeof Re(l[0],l[1],s,null,!0).value!=typeof Re(l[0]+1,l[1],s,null,!0).value||!this.isSameStyle(Re(l[0],l[1],s,null,!0).style,Re(l[0]+1,l[1],s,null,!0).style))),(t.isNullOrUndefined(i.sortOptions)||t.isNullOrUndefined(i.sortOptions.containsHeader))&&!d){var g=Re(l[0],l[1],s),y=Re(l[0]+1,l[1],s);g&&y&&(p=typeof g.value!=typeof y.value||!this.isSameStyle(g.style,y.style))}l[0]=p?l[0]+1:l[0];var C=v(u(s.activeCell)[1]+1);delete h.containsHeader;var b=h.sortDescriptors,x=new r.Query;if(Array.isArray(b)){b&&0!==b.length||(b=[{field:C}]);for(var S=b.length,I=S-1;I>-1;I--)if(b[S-1].field||(b[S-1].field=C),b[I].field){var E=b[I].sortComparer||this.sortComparer.bind(this,b[I],h.caseSensitive);x.sortBy(b[I].field,E),C=b[I].field}}else{b||(b={field:C}),b.field||(b.field=C);E=b.sortComparer||this.sortComparer.bind(this,b,h.caseSensitive);x.sortBy(b.field,E),C=b.field}var R=m(l);he(this.parent,s.name+"!"+R,!0,null,null,null,null,null,void 0,null,f(C)).then(function(t){new r.DataManager(t).executeQuery(x).then(function(r){n.parent.notify("setActionData",{args:{action:"beforeSort",eventArgs:{range:R,cellDetails:t,sortedCellDetails:r.result}}}),n.updateSortedDataOnCell({result:r.result,range:l,sheet:s,jsonData:t});var o={range:s.name+"!"+R,sortOptions:i.sortOptions};e.previousSort&&(o.previousSort=e.previousSort),a.resolve(o)})})}},e.prototype.updateSortedDataOnCell=function(e){for(var r,n,i,a=this,o=[],s=function(n,i){for(var s=e.range[1],l=0;s<=e.range[3];s++,l++){if(o[l]||(o[l]=v(s+1)),i[o[l]])r=t.extend({},i[o[l]],null,!0);else{if(!Re(n,s,e.sheet))continue;r=null}(r=a.skipBorderOnSorting(n,s,e.sheet,r))&&r.formula&&(r.formula=Q([n,s],[parseInt(i.__rowIndex,10)-1,s],e.sheet,a.parent,r,!0)),ke(n,s,e.sheet,r)}},l=e.isUndo&&{},h=e.range[0],d=0;h<=e.range[2];h++,d++)if(je(e.sheet,h))d--;else if(i=e.result[d],e.isUndo){if(i&&(n=parseInt(i.__rowIndex,10)-1,l[n]=!0,s(n,i),h===n))continue;!l[h]&&e.sheet.rows[h]&&s(h,{})}else s(h,i||{})},e.prototype.skipBorderOnSorting=function(e,t,r,n){var i=Re(e,t,r),a=["borderBottom","borderTop","borderRight","borderLeft","border"];if(n&&n.style)for(var o=0,s=a;o<s.length;o++){var l=s[o];delete n.style[""+l]}if(i&&i.style)for(var h=0,d=a;h<d.length;h++){l=d[h];i.style[""+l]&&(n||(n={}),n.style||(n.style={}),n.style[""+l]=i.style[""+l])}return n},e.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},e.prototype.sortComparer=function(e,n,i,a){var o=e.order||"",s=r.DataUtil.fnSort(o),l=!1;if(i&&a&&("string"==typeof i.value||"string"==typeof a.value)&&""!==i.value&&""!==a.value&&(D(i.value)&&(i.value=P(i.value)),D(a.value)&&(a.value=P(a.value),l=!0),!l&&!l)){var h={sensitivity:n?"case":"base"},d=new Intl.Collator(this.parent.locale,h);return o&&"ascending"!==o.toLowerCase()?-1*d.compare(i.value,a.value):d.compare(i.value,a.value)}var p=t.isNullOrUndefined(i)||i&&(t.isNullOrUndefined(i.value)||""===i.value),c=t.isNullOrUndefined(a)||a&&(t.isNullOrUndefined(a.value)||""===a.value);return p&&c?-1:p?1:c?-1:s(i?i.value:i,a?a.value:a)},e.prototype.getModuleName=function(){return"workbookSort"},e}(),ha=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.addEventListener=function(){this.parent.on(mn,this.initiateFilterHandler,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off(mn,this.initiateFilterHandler)},e.prototype.initiateFilterHandler=function(e){var t=this,n=e.args,i=new r.Deferred,a=Ce(this.parent,S(this.parent,n.range)),o=n.filterOptions||{};if(e.promise=i.promise,o.datasource){this.setFilter(o.datasource,o.predicates,n.range,e.refresh);var s={range:n.range,filterOptions:o};i.resolve(s)}else{var l=w(y(n.range));if(l[0]>a.usedRange.rowIndex||l[1]>a.usedRange.colIndex)return void i.reject("Select a cell or range inside the used range and try again.");l[0]===l[2]&&l[2]-l[0]==0&&(l[0]=0,l[1]=0,l[3]=a.usedRange.colIndex),l[2]=a.usedRange.rowIndex,l[0]=l[0]+1;var h=m(l);he(this.parent,a.name+"!"+h,!0,!0,null,null,null,null,!1).then(function(a){var s=new r.DataManager(a);t.setFilter(s,o.predicates,n.range,e.refresh);var l={range:h,filterOptions:o};i.resolve(l)})}},e.prototype.setFilter=function(e,t,n,i){var a=this;if(e&&t){var o=e.dataSource.json,s=new r.Query;t.length&&s.where(r.Predicate.and(t));var l,h,d=e.executeLocal(s),p="__rowIndex";if(n.indexOf("!")>-1?(h=ce(this.parent,n.split("!")[0]),l=Ce(this.parent,h)):(l=this.parent.getActiveSheet(),h=ce(this.parent,l.name)),"spreadsheet"===this.parent.getModuleName()){var u,f,g=this.parent;if(g.scrollSettings.enableVirtualization&&(l.rows||o).length>g.viewport.rowCount+2*g.getThreshold("row")||l.frozenRows||l.frozenColumns||i){o.forEach(function(e){u=d.indexOf(e)<0,ze(l,Number(e[""+p])-1,{hidden:u,isFiltered:u})}),f=h===g.activeSheetIndex;var m=c(l.paneTopLeftCell);this.parent.updateTopLeftCell($(l,m[0],!0)-this.parent.frozenRowCount(l),null,"col")}else o.forEach(function(e){if(u=d.indexOf(e)<0,f)ze(l,Number(e[""+p])-1,{hidden:u,isFiltered:u});else{var t={startIndex:Number(e[""+p])-1,hide:u,isFiltering:!0,sheetIndex:h};t.endIndex=t.startIndex,a.parent.notify(Gn,t),f=t.refreshUI}});f&&g.renderModule.refreshSheet(!1,!1,document.activeElement.id!==this.parent.element.id+"_SearchBox")}else{var v;o.forEach(function(e){v=d.indexOf(e)<0,ze(l,Number(e[""+p])-1,{hidden:v,isFiltered:v})})}}},e.prototype.getModuleName=function(){return"workbookFilter"},e}(),da=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.setImage=function(e){var r,n=e.range?e.range.indexOf("!")>0?e.range.split("!")[1]:e.range.split("!")[0]:this.parent.getActiveSheet().selectedRange,i=e.range&&e.range.indexOf("!")>0?ce(this.parent,e.range.split("!")[0]):this.parent.activeSheetIndex,a=c(n),o=t.isUndefined(i)?this.parent.getActiveSheet():Ce(this.parent,i),s=Re(a[0],a[1],o),l=e.options;if(s&&s.image){r=s.image;for(var h=0;h<l.length;h++)r.push(l[h])}ke(a[0],a[1],o,{image:s&&s.image?r:l},!0)},e.prototype.addEventListener=function(){this.parent.on(Qn,this.setImage,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off(Qn,this.setImage)},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.getModuleName=function(){return"workbookImage"},e}(),pa=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.addEventListener=function(){this.parent.on(Jn,this.setChartHandler,this),this.parent.on(ri,this.refreshChartData,this),this.parent.on(ai,this.deleteChartColl,this),this.parent.on(ni,this.refreshChartSize,this),this.parent.on(oi,this.focusChartBorder,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(Jn,this.setChartHandler),this.parent.off(ri,this.refreshChartData),this.parent.off(ai,this.deleteChartColl),this.parent.off(ni,this.refreshChartSize),this.parent.off(oi,this.focusChartBorder))},e.prototype.setChartHandler=function(e){var r=0;e.isInitCell=!t.isNullOrUndefined(e.isInitCell)&&e.isInitCell,e.isUndoRedo=!!t.isNullOrUndefined(e.isUndoRedo)||e.isUndoRedo,e.isPaste=!t.isNullOrUndefined(e.isPaste)&&e.isPaste;var n,i=e.chart;if(i.length>0)for(;r<i.length;){if(!1===e.isCut&&document.getElementById(e.chart[r].id)&&(i[r]={range:i[r].range,id:t.getUniqueID("e_spreadsheet_chart"),theme:i[r].theme,isSeriesInRows:i[r].isSeriesInRows,type:i[r].type,markerSettings:i[r].markerSettings}),document.getElementById(e.chart[r].id))return;(n=i[r]).theme=n.theme||"Material",n.type=n.type||"Line",n.isSeriesInRows=n.isSeriesInRows||!1,n.range=n.range||this.parent.getActiveSheet().selectedRange;var a=m(w(c(n.range)));if(n.range.indexOf("!")>0?n.range=n.range.split("!")[0]+"!"+a:n.range=this.parent.getActiveSheet().name+"!"+a,t.isNullOrUndefined(n.id)&&(n.id=t.getUniqueID("e_spreadsheet_chart")),n.markerSettings&&n.markerSettings.visible&&(void 0===n.markerSettings.isFilled&&(n.markerSettings.isFilled=!0),void 0===n.markerSettings.shape&&(n.markerSettings.shape="Circle")),n.height=n.height||290,n.width=n.width||480,this.parent.notify(ei,{option:n,isInitCell:e.isInitCell,triggerEvent:e.isUndoRedo,dataSheetIdx:e.dataSheetIdx,range:e.range,isPaste:e.isPaste}),this.parent.chartColl.push(n),!e.isInitCell||e.isPaste){var o=void 0===e.sheetId?n.range&&n.range.indexOf("!")>0?ce(this.parent,n.range.split("!")[0]):this.parent.activeSheetIndex:ue(this.parent,e.sheetId),s={clientY:n.top,isImage:!0},l={clientX:n.left,isImage:!0};this.parent.notify(Ai,s),this.parent.notify(Ni,l);var h=t.isUndefined(o)?this.parent.getActiveSheet():this.parent.sheets[o],d=Re(s.clientY,l.clientX,h);d&&d.chart?d.chart.push(n):ke(s.clientY,l.clientX,h,{chart:[n]},!0)}else{var p=c(e.range);s={clientY:n.top,isImage:!0},l={clientX:n.left,isImage:!0};this.parent.notify(Ai,s),this.parent.notify(Ni,l);var u={prevTop:n.top,prevLeft:n.left,prevRowIdx:p[0],prevColIdx:p[1],prevHeight:n.height,prevWidth:n.width,currentTop:n.top,currentLeft:n.left,currentRowIdx:s.clientY,currentColIdx:l.clientX,currentHeight:n.height,currentWidth:n.width,id:n.id,requestType:"chartRefreshOnInit"};p[0]===s.clientY&&p[1]===l.clientX||this.parent.notify(Oi,u)}r++}},e.prototype.refreshChartData=function(e){if(this.parent.chartColl&&this.parent.chartColl.length)for(var t,r,n,i,a=0,o=this.parent.chartColl.length;a<o;a++){if((t=this.parent.chartColl[a]).range.includes("!")){if(r=t.range.split("!"),this.parent.activeSheetIndex!==ce(this.parent,r[0]))continue;n=r[1]}else n=t.range;if(e.viewportIndexes){for(var s=0;s<e.viewportIndexes.length;s++)if(ie([e.viewportIndexes[s]],n)){i=!0;break}}else i=e.range?ie([e.range],n):e.showHide?this.inRowColumnRange(c(n),e.rIdx,e.showHide):j(c(n),e.rIdx,e.cIdx);i&&this.parent.notify(ii,{chart:t})}},e.prototype.inRowColumnRange=function(e,t,r){return"rows"===r?t>=e[0]&&t<=e[2]:t>=e[1]&&t<=e[3]},e.prototype.refreshChartSize=function(e){for(var r,n=1,i=this.parent.sheets.length+1;n<i;){var a=this.parent.chartColl;if(r=a?a.length:0)for(;r--;){var o=this.parent.chartColl[r];if(!t.isNullOrUndefined(e.overlayEle.querySelector("#"+o.id))){var s=this.parent.element.querySelector("."+o.id),l=t.getComponent(s,"chart");l&&(l.height=e.height,l.width=e.width)}}n++}},e.prototype.focusChartBorder=function(e){for(var r=0;r<this.parent.chartColl.length;r++){var n=document.getElementById(e.id),i=document.getElementById(this.parent.chartColl[r].id);n&&i&&t.closest(i,"."+n.classList[1])===n&&this.parent.notify(ei,{option:this.parent.chartColl[r],isRefresh:!0})}},e.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)},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.getModuleName=function(){return"workbookChart"},e}(),ca=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.format=function(e){var t,r=this,n=e.range;n&&"string"==typeof n&&n.indexOf("!")>-1?(n=n.split("!")[1],t=this.parent.sheets[ce(this.parent,e.range.split("!")[0])]):t=this.parent.getActiveSheet(),void 0===n&&(n=t.selectedRange);var i="object"!=typeof n&&e.onActionUpdate,a={range:n,style:Object.assign({},e.style),requestType:"CellFormat"};e.borderType&&(a.borderType=e.borderType);var o={};if(Object.assign(o,a.style,null,!0),i&&(this.parent.trigger("beforeCellFormat",a),this.parent.notify("actionBegin",{eventArgs:a,action:"format"}),a.cancel))e.cancel=!0;else{var s="object"==typeof a.range?a.range:w(c(a.range));e.borderType&&(this.setTypedBorder(t,e.style.border,s,e.borderType,e.onActionUpdate),delete e.style.border,delete a.style.border);var l,h,d={cell:null,rowIdx:0,colIdx:0,eventOnly:!0,preventEvt:!i},p=function(e){return d.cell={style:e},d.rowIdx=l,d.colIdx=h,J(r.parent,t,d)};if(void 0!==a.style.borderTop){for(h=s[1];h<=s[3];h++)l=s[0],p({borderTop:a.style.borderTop})||(e.isUndoRedo||(this.checkAdjacentBorder(t,"borderBottom",l-1,h),this.checkFullBorder(t,"borderBottom",l-1,h)),this.checkFullBorder(t,"borderTop",l,h),this.setCellBorder(t,d.cell.style,l,h,e.onActionUpdate,h===s[3],null,null,e.isUndoRedo));delete a.style.borderTop}if(void 0!==a.style.borderBottom){var u=void 0,f=void 0;for(h=s[1];h<=s[3];h++)f=(u=Re(l=s[0],h,t,!1,!0)).rowSpan>0?Re(s[2],s[1],t,!1,!0):Re(s[2],s[3],t,!1,!0),u.rowSpan>1&&f.rowSpan<0||(l=s[2]),p({borderBottom:a.style.borderBottom})||(e.isUndoRedo||(this.checkAdjacentBorder(t,"borderTop",s[2]+1,h),this.checkFullBorder(t,"borderTop",s[2]+1,h)),this.checkFullBorder(t,"borderBottom",s[2],h),this.setCellBorder(t,d.cell.style,l,h,e.onActionUpdate,h===s[3],null,null,e.isUndoRedo),this.setBottomBorderPriority(t,s[2],h));delete a.style.borderBottom}if(void 0!==a.style.borderLeft){for(var g=s[0];g<=s[2];g++)h=s[1],p({borderLeft:a.style.borderLeft})||(e.isUndoRedo||(this.checkAdjacentBorder(t,"borderRight",g,h-1),this.checkFullBorder(t,"borderRight",g,h-1)),this.checkFullBorder(t,"borderLeft",g,h),this.setCellBorder(t,d.cell.style,g,h,e.onActionUpdate,null,null,null,e.isUndoRedo));delete a.style.borderLeft}if(void 0!==a.style.borderRight){for(var m=s[0];m<=s[2];m++)h=s[3],p({borderRight:a.style.borderRight})||(e.isUndoRedo||(this.checkAdjacentBorder(t,"borderLeft",m,h+1),this.checkFullBorder(t,"borderLeft",m,h+1)),this.checkFullBorder(t,"borderRight",m,h),this.setCellBorder(t,d.cell.style,m,h,e.onActionUpdate,null,null,null,e.isUndoRedo));delete a.style.borderRight}var v,y,C;if(Object.keys(a.style).length){var b=this.parent,x=b.viewport&&this.parent.getActiveSheet().id===t.id,S=this.parent.frozenRowCount(t),I=this.parent.frozenColCount(t),E=[S+b.viewport.topIndex,I+b.viewport.leftIndex,b.viewport.bottomIndex,b.viewport.rightIndex],R=void 0,k=void 0,F=void 0,A=void 0;for(l=s[0];l<=s[2];l++)if(!(k=_e(t,l)||{}).isFiltered)for(R=l>=E[0]&&l<=E[2]||l<S,F=!1,h=s[1];h<=s[3];h++)if(!p(a.style)){if(void 0===y&&(void 0!==a.style.border?(v=a.style.border,delete a.style.border,y=!0):y=!1),(C=Re(l,h,t,!1,!0)).rowSpan>1||C.colSpan>1)for(var N=l,O=C.rowSpan>1?l+(C.rowSpan-1):l;N<=O;N++)for(var T=h,D=C.colSpan>1?h+(C.colSpan-1):h;T<=D;T++)y&&this.setFullBorder(t,v,s,N,T,e.onActionUpdate,!0),this.setCellStyle(t,N,T,a.style);if(y&&this.setFullBorder(t,v,s,l,h,e.onActionUpdate),this.setCellStyle(t,l,h,a.style),x)if(R&&(h>=E[1]&&h<=E[3]||h<I)){if(A=null,a.style.color&&C.format&&C.format.includes("[")){var L=Ne(C.format);L&&(A=L.toLowerCase())}this.parent.notify(_r,{style:a.style,rowIdx:l,colIdx:h,lastCell:h===s[3],isHeightCheckNeeded:!0,manualUpdate:!0,onActionUpdate:e.onActionUpdate,formatColor:A})}else k.customHeight||(F=F||Z(a.style,e.onActionUpdate))&&this.parent.notify(_r,{rowIdx:l,colIdx:h,lastCell:h===s[3],checkHeight:!0,outsideViewport:!R,onActionUpdate:e.onActionUpdate})}}y&&(a.style.border=v),this.parent.setUsedRange(s[2],s[3]),e.refreshRibbon&&this.parent.notify(Kr,null),i&&(a.style=o,a.range=t.name+"!"+n,this.parent.notify("actionComplete",{eventArgs:a,action:"format"}))}},e.prototype.setBottomBorderPriority=function(e,t,r){if(je(e,t+1)){var n=this.skipHiddenRows(e,t+1);""!==this.parent.getCellStyleValue(["borderTop"],[n,r]).borderTop&&(e.rows[t].cells[r].style.bottomPriority=!0)}},e.prototype.setFullBorder=function(e,t,r,n,i,a,o){var s={};n===r[0]&&(this.checkAdjacentBorder(e,"borderBottom",n-1,i),this.checkFullBorder(e,"borderBottom",n-1,i)),i===r[1]&&(this.checkAdjacentBorder(e,"borderRight",n,i-1),this.checkFullBorder(e,"borderRight",n,i-1)),i===r[3]?(this.checkAdjacentBorder(e,"borderLeft",n,i+1),this.checkFullBorder(e,"borderLeft",n,i+1)):this.checkAdjacentBorder(e,"border",n,i+1),s.borderRight=t,s.borderTop=t,s.borderLeft=t,s.borderBottom=t,this.setCellBorder(e,s,n,i,a,i===r[3],null,o),n===r[2]?(this.checkAdjacentBorder(e,"borderTop",n+1,i),this.checkFullBorder(e,"borderTop",n+1,i),this.setBottomBorderPriority(e,n,i)):this.checkAdjacentBorder(e,"border",n+1,i)},e.prototype.checkAdjacentBorder=function(e,t,r,n){var i={};""!==this.parent.getCellStyleValue([t],[r,n])[""+t]&&(i[""+t]=void 0,this.setCellStyle(e,r,n,i))},e.prototype.checkFullBorder=function(e,t,r,n){var i=this.parent.getCellStyleValue(["border"],[r,n]).border;if(""!==i){var a={border:void 0};["borderBottom","borderTop","borderLeft","borderRight"].forEach(function(e){e!==t&&(a[""+e]=i)}),this.setCellStyle(e,r,n,a)}},e.prototype.textDecorationActionUpdate=function(e){var t=this.parent.getActiveSheet(),r={range:t.selectedRange,style:e.style,requestType:"CellFormat"};if(this.parent.trigger("beforeCellFormat",r),this.parent.notify("actionBegin",{eventArgs:r,action:"format"}),r.cancel)e.cancel=!0;else{var n,i=w(c(t.selectedRange)),a=e.style.textDecoration,o=a,s=c(t.activeCell),l=this.parent.getCellStyleValue(["textDecoration"],s).textDecoration,h=!1;"underline"===l?o="underline"===a?"none":"underline line-through":"line-through"===l?o="line-through"===a?"none":"underline line-through":"underline line-through"===l&&(o="underline"===a?"line-through":"underline",h=!0),"none"===o&&(h=!0),this.format({style:{textDecoration:o},range:s,refreshRibbon:e.refreshRibbon,onActionUpdate:!0});for(var d=i[0];d<=i[2];d++)for(var p=i[1];p<=i[3];p++)if(d!==s[0]||p!==s[1]){if(n={},"none"===(l=this.parent.getCellStyleValue(["textDecoration"],[d,p]).textDecoration)){if(h)continue;n.textDecoration=a}else if("underline"===l||"line-through"===l)if(h){if(a!==l)continue;n.textDecoration="none"}else n.textDecoration=a!==l?"underline line-through":a;else if("underline line-through"===l){if(!h)continue;n.textDecoration="underline"===a?"line-through":"underline"}this.format({style:n,range:[d,p,d,p],refreshRibbon:e.refreshRibbon,onActionUpdate:!0})}r.range=t.name+"!"+r.range,r.style.textDecoration=o,this.parent.notify("actionComplete",{eventArgs:r,action:"format"})}},e.prototype.setTypedBorder=function(e,t,r,n,i){var a;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 l=r[0];l<=r[2];l++)for(var h=r[1];h<=r[3];h++){var d={};""!==(a=this.parent.getCellStyleValue(["border"],[l,h]).border)&&(d.border=void 0,h!==r[3]&&h!==r[1]&&l!==r[0]&&l!==r[2]||(l===r[0]&&(d.borderTop=a),l===r[2]&&(d.borderBottom=a),h===r[3]&&(d.borderRight=a),h===r[1]&&(d.borderLeft=a))),h!==r[3]&&(d.borderRight=t),l!==r[0]&&(d.borderTop=t),l!==r[2]&&(d.borderBottom=t),h!==r[1]&&(d.borderLeft=t),this.setCellBorder(e,d,l,h,i,h===r[3])}else if("Vertical"===n)for(l=r[0];l<=r[2];l++)for(h=r[1];h<=r[3];h++){d={borderRight:t,borderLeft:t};h===r[1]&&(this.checkAdjacentBorder(e,"borderRight",l,h-1),this.checkFullBorder(e,"borderRight",l,h-1)),h===r[3]&&(this.checkAdjacentBorder(e,"borderLeft",l,h+1),this.checkFullBorder(e,"borderLeft",l,h+1)),this.setCellBorder(e,d,l,h,i)}else for(l=r[0];l<=r[2];l++)for(h=r[1];h<=r[3];h++){d={borderTop:t,borderBottom:t};l===r[0]&&(this.checkAdjacentBorder(e,"borderBottom",l-1,h),this.checkFullBorder(e,"borderBottom",l-1,h)),this.setCellBorder(e,d,l,h,i,h===r[3]),l===r[2]&&(this.checkAdjacentBorder(e,"borderTop",l+1,h),this.checkFullBorder(e,"borderTop",l+1,h),this.setBottomBorderPriority(e,l,h))}},e.prototype.setCellBorder=function(e,t,r,n,i,a,o,s,l){if(this.setCellStyle(e,r,n,t),!s&&this.parent.getActiveSheet().id===e.id){if("Outer"===o&&(t.borderBottom||t.borderRight)){var h={range:[r,n,r,n]};this.parent.notify(qn,h),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(_r,{style:t,rowIdx:r,colIdx:n,onActionUpdate:i,first:"",lastCell:a,isHeightCheckNeeded:!0,manualUpdate:!0})}},e.prototype.setCellStyle=function(e,t,r,n){e.rows[t]?e.rows[t].cells||(e.rows[t].cells=[]):e.rows[t]={cells:[]},e.rows[t].cells[r]||(e.rows[t].cells[r]={}),e.rows[t].cells[r].style||(e.rows[t].cells[r].style={}),Object.assign(e.rows[t].cells[r].style,n,null,!0)},e.prototype.skipHiddenRows=function(e,t){return t++,je(e,t)&&(t=this.skipHiddenRows(e,t)),t},e.prototype.addEventListener=function(){this.parent.on(Br,this.format,this),this.parent.on(Vr,this.textDecorationActionUpdate,this),this.parent.on($n,this.clearCellObj,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(Br,this.format),this.parent.off(Vr,this.textDecorationActionUpdate),this.parent.off($n,this.clearCellObj))},e.prototype.clearCellObj=function(e){for(var t,r,n,i,a,o=e.range?e.range.indexOf("!")>0?e.range.split("!")[1]:e.range.split("!")[0]:this.parent.getActiveSheet().selectedRange,s=e.range&&e.range.indexOf("!")>0?ce(this.parent,e.range.split("!")[0]):this.parent.activeSheetIndex,l=Ce(this.parent,s),h=w(y(o)),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=Re(d,n,l);if(f)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(pi,{sheet:l,rowIdx:d,colIdx:n,preventRefresh:!0}),a=!(!f.value&&!f.formula),delete f.value,delete f.formula,a&&(r={action:"refreshCalculate",rowIndex:d,colIndex:n,sheetIndex:s},this.parent.notify(jr,r),c&&!t&&((t=r.isFormulaDependent)||ne(c,u,d,n)));break;case"Clear Hyperlinks":delete f.hyperlink;break;case"Clear All":a=!(!f.value&&!f.formula),ke(d,n,l,{},!1),a&&(r={action:"refreshCalculate",rowIndex:d,colIndex:n,sheetIndex:s},this.parent.notify(jr,r),c&&!t&&(t=r.isFormulaDependent))}}(u.length||t)&&s===this.parent.activeSheetIndex&&this.parent.notify(Xn,{cfModel:!t&&u,refreshAll:t,isAction:!0})},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.getModuleName=function(){return"workbookcellformat"},e}(),ua=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.addEventListener=function(){this.parent.on(qr,this.performEditOperation,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off(qr,this.performEditOperation)},e.prototype.getModuleName=function(){return"workbookEdit"},e.prototype.performEditOperation=function(e){switch(e.action){case"updateCellValue":e.isFormulaDependent=this.updateCellValue(e.address,e.value,e.sheetIndex,e.isValueOnly,e.skipFormatCheck,e.isRandomFormula,e.skipCellFormat)}},e.prototype.updateCellValue=function(e,r,n,i,a,o,s){void 0===n&&(n=this.parent.activeSheetIndex);var l,h;l="string"==typeof e?c(e):e;var d=Ce(this.parent,n),p=Re(l[0],l[1],d,!0);if(p||(p=d.rows[l[0]].cells[l[1]]={}),i)p.value=r;else{var u=B(r);u="#SPILL!"===r||u;var f=!1;p.formula&&p.formula.indexOf("UNIQUE")>-1&&""===r&&(f=!0);var m=!("Text"===Ve(p.format)||u&&r.toLowerCase().startsWith("=text("));u||f||(p.formula&&(p.formula=""),p.value=m?P(r):r);var v={action:"refreshCalculate",value:r,rowIndex:l[0],colIndex:l[1],sheetIndex:n,isFormula:u,isRandomFormula:o};if(m&&!a){var y={value:r,rowIndex:l[0],colIndex:l[1],sheetIndex:n,updatedVal:"",skipCellFormat:s};u?r.toLowerCase().includes("unique(")&&(y.updatedVal=r):this.parent.notify(Wr,y),!t.isNullOrUndefined(y.updatedVal)&&y.updatedVal.length>0&&(p.value=y.updatedVal)}if("#SPILL!"===r)p.value=r;else{var C={cellIdx:l,isUnique:!1};if(this.parent.notify(nn,C),f?r=p.value:(this.parent.notify(jr,v),h=v.isFormulaDependent),u){p.formula=v.value,r=p.value;var b=p.formula.toLowerCase();"=now()"!==b||p.format&&"General"!==p.format?b.includes("=time(")&&!p.format&&(p.format="h:mm AM/PM"):p.format=Ue("ShortDate")+" h:mm"}else!p.value||"string"!=typeof p.value||0!==p.value.indexOf("www.")&&0!==p.value.indexOf("https://")&&0!==p.value.indexOf("http://")&&0!==p.value.indexOf("ftp://")||this.parent.notify(gn,{hyperlink:p.value,cell:d.name+"!"+g(l[0],l[1])})}}return this.parent.setUsedRange(l[0],l[1],d),!this.parent.chartColl.length||this.parent.isEdit||o||this.parent.notify(ri,{cell:p,rIdx:l[0],cIdx:l[1],sheetIdx:n}),h},e}(),fa=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.addEventListener=function(){this.parent.on(gn,this.setLinkHandler,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off(gn,this.setLinkHandler)},e.prototype.setLinkHandler=function(e){var r,n=e.hyperlink,i=e.cell;if(i&&-1!==i.indexOf("!")){var a=i.split("!");if(r=Ce(this.parent,ce(this.parent,a[0])),i=a[1],!r)return}else r=this.parent.getActiveSheet(),i=i||r.selectedRange;var o=!e.triggerEvt&&r.isProtected;if(!o||r.protectSettings.insertLink){var s=w(c(i));"string"==typeof n?0===n.toLowerCase().indexOf("www.")&&(n="http://"+n):0===n.address.toLowerCase().indexOf("www.")&&(n.address="http://"+n.address);for(var l,h=c(r.activeCell),d=s[0];d<=s[2];d++)for(var p=s[1];p<=s[3];p++)o&&Y(Re(d,p,r),Xe(r,p))||(l={hyperlink:n},t.isNullOrUndefined(e.displayText)||d!==h[0]||p!==h[1]||(e.triggerEvt?d===h[0]&&p===h[1]&&(l.value=e.displayText):t.isNullOrUndefined(Re(d,p,r,!1,!0).value)&&(l.value=e.displayText)),l.style={textDecoration:"underline",color:"#00e"},J(this.parent,r,{cell:l,rowIdx:d,colIdx:p,preventEvt:!e.triggerEvt}))}},e.prototype.getModuleName=function(){return"workbookHyperlink"},e}(),ga=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.insertModel=function(e){var t,r,n,i,a=this;if(e.model){var o,s,l,h,d=[];if("number"==typeof e.start){o=e.start,e.end=e.end||o,o>e.end&&(o=e.end,e.end=e.start),"Row"===e.modelType&&o<e.model.maxHgts.length&&(h=[]);for(var p=o;p<=e.end;p++)d.push({}),h&&h.push(null)}else e.start?(o=e.start[0].index||0,d=e.start,l=!0):(o=0,d.push({})),"Row"===e.modelType&&o<e.model.maxHgts.length&&(h=[],d.forEach(function(){h.push(null)}));var c={model:d,index:o,modelType:e.modelType,insertType:e.insertType,cancel:!1,isUndoRedo:e.isUndoRedo},u={eventArgs:c,action:"insert"};if(e.isAction){if(this.parent.notify(Ar,u),c.cancel)return;delete c.cancel,c.isAction=e.isAction}var f={startIndex:o,endIndex:o+d.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(Si,f),e.model=e.model,e.model.rows||(e.model.rows=[]),l&&e.model.usedRange.rowIndex>-1&&o>e.model.usedRange.rowIndex)for(p=e.model.usedRange.rowIndex;p<o-1;p++)d.splice(0,0,{});var g=this.parent.frozenRowCount(e.model);o<g&&(this.parent.setSheetPropertyOnMute(e.model,"frozenRows",e.model.frozenRows+d.length),c.freezePane=!0),(t=e.model.rows).splice.apply(t,[o,0].concat(d)),h&&(r=e.model.maxHgts).splice.apply(r,[o,0].concat(h)),this.setRowColCount(f.startIndex,f.endIndex,e.model,"row"),o>e.model.usedRange.rowIndex?this.parent.setUsedRange(o+(d.length-1),e.model.usedRange.colIndex,e.model,!0):this.parent.setUsedRange(e.model.usedRange.rowIndex+d.length,e.model.usedRange.colIndex,e.model,!0);var m,v=o+d.length,y=void 0,C=function(t){e.model.rows[v]&&e.model.rows[v].cells&&e.model.rows[v].cells[t]&&(void 0!==(y=e.model.rows[v].cells[t]).rowSpan&&y.rowSpan<0&&void 0===y.colSpan&&b.parent.notify(Wn,{range:[v,t,v,t],insertCount:d.length,insertModel:"Row"}),y.style&&Re(o-1,t,e.model,!1,!0).style&&(m=b.checkBorder(y.style,e.model.rows[o-1].cells[t].style))!=={}&&d.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,m)}))},b=this;for(p=0;p<=e.model.usedRange.colIndex;p++)C(p);c.sheetCount=e.model.rows.length}else if("Column"===e.modelType){if(void 0!==e.checkCount&&e.model.columns&&e.checkCount===e.model.columns.length)return;this.parent.notify(Si,f),e.model=e.model,e.model.columns||(e.model.columns=[]),o&&!e.model.columns[o-1]&&(e.model.columns[o-1]={}),(n=e.model.columns).splice.apply(n,[o,0].concat(d));var x=this.parent.frozenColCount(e.model);o<x&&(this.parent.setSheetPropertyOnMute(e.model,"frozenColumns",e.model.frozenColumns+d.length),c.freezePane=!0),this.setRowColCount(f.startIndex,f.endIndex,e.model,"col"),o>e.model.usedRange.colIndex?this.parent.setUsedRange(e.model.usedRange.rowIndex,o+(d.length-1),e.model,!0):this.parent.setUsedRange(e.model.usedRange.rowIndex,e.model.usedRange.colIndex+d.length,e.model,!0),e.model.rows||(e.model.rows=[]);var S=[];e.columnCellsModel||(e.columnCellsModel=[]);for(p=0;p<d.length;p++)S.push(null);s=[];y=void 0;var w=void 0;for(p=0;p<=e.model.usedRange.rowIndex;p++){e.model.rows[p]?e.model.rows[p].cells||(e.model.rows[p].cells=[]):e.model.rows[p]={cells:[]},o&&!e.model.rows[p].cells[o-1]&&(e.model.rows[p].cells[o-1]={}),(i=e.model.rows[p].cells).splice.apply(i,[o,0].concat(e.columnCellsModel[p]&&e.columnCellsModel[p].cells?e.columnCellsModel[p].cells:S));v=o+d.length;if(e.model.rows[p].cells[v]&&(void 0!==(y=e.model.rows[p].cells[v]).colSpan&&y.colSpan<0&&void 0===y.rowSpan&&s.push({range:[p,v,p,v],insertCount:S.length,insertModel:"Column"}),y.style&&Re(p,o-1,e.model,!1,!0).style&&(w=this.checkBorder(y.style,e.model.rows[p].cells[o-1].style))!=={}))for(var I=o;I<v;I++)e.model.rows[p].cells[I]||(e.model.rows[p].cells[I]={}),e.model.rows[p].cells[I].style||(e.model.rows[p].cells[I].style={}),Object.assign(e.model.rows[p].cells[I].style,w)}s.forEach(function(e){a.parent.notify(Wn,e)}),c.sheetCount=e.model.columns.length}else{if(void 0!==e.checkCount&&e.checkCount===this.parent.sheets.length)return;var E=d,R=we(this.parent),k=e.isFromUpdateAction;for(p=0;p<E.length;p++)if(E[p].name)for(I=0;I<this.parent.sheets.length;I++)if(E[p].name===this.parent.sheets[I].name){E.splice(p,1),p--;break}if(!E.length)return;delete d[0].index,this.parent.createSheet(o,d);var F;e.activeSheetIndex?(c.activeSheetIndex=e.activeSheetIndex,this.parent.setProperties({activeSheetIndex:e.activeSheetIndex},!0)):!e.isAction&&e.start<this.parent.activeSheetIndex&&this.parent.setProperties({activeSheetIndex:this.parent.skipHiddenSheets(this.parent.activeSheetIndex)},!0),k&&this.parent.setProperties({activeSheetIndex:ce(this.parent,R)},!0),d.forEach(function(e){l&&a.updateRangeModel(e.ranges);var t=a.parent.viewport,r={sheet:e,resolveAfterFullDataLoaded:!0,indexes:[t.topIndex,t.leftIndex,t.bottomIndex,t.rightIndex],promise:new Promise(function(e){e(void 0)})};a.parent.notify(wr,r),F=e.id,a.parent.notify(jr,{action:"addSheet",visibleName:e.name,sheetName:"Sheet"+F,sheetId:F})}),c.activeSheetIndex=e.activeSheetIndex,c.sheetCount=this.parent.sheets.length}"Sheet"!==e.modelType&&(this.insertConditionalFormats(e),this.parent.notify(Ci,{start:o,end:o+d.length-1,modelType:e.modelType,model:e.model,isInsert:!0}),c.activeSheetIndex=ce(this.parent,e.model.name)),this.parent.notify(bn,u)}},e.prototype.setRowColCount=function(e,t,r,n){var i=n+"Count";this.parent.setSheetPropertyOnMute(r,i,r[""+i]+(t-e+1)),r.id===this.parent.getActiveSheet().id&&this.parent.notify(zr,{index:r[""+i]-1,update:n,isInsert:!0,start:e,end:t})},e.prototype.updateRangeModel=function(e){e.forEach(function(e){e.dataSource&&(e.startCell=e.startCell||"A1",e.showFieldAsHeader=void 0===e.showFieldAsHeader||e.showFieldAsHeader,e.template=e.template||"",e.address=e.address||"A1")})},e.prototype.checkBorder=function(e,t){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},e.prototype.setInsertInfo=function(e,t,r,n,i){void 0===i&&(i="Row");var a=r=t+(r-1);e.ranges.forEach(function(e){e.info&&t<e.info[""+n]&&(e.info["insert"+i+"Range"]?e.info["insert"+i+"Range"].push([t,a]):e.info["insert"+i+"Range"]=[[t,a]],e.info[""+n]+=a-t+1)})},e.prototype.insertConditionalFormats=function(e){var 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=m(te(e,c(t[r].range),!e.isAction&&!e.isUndoRedo))},e.prototype.addEventListener=function(){this.parent.on(Sn,this.insertModel,this)},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off(Sn,this.insertModel)},e.prototype.getModuleName=function(){return"workbookinsert"},e}(),ma=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.deleteModel=function(e){var t=this,r=this.parent.sheets.length;if("Sheet"!==e.modelType||1!==r){var n=e.modelType.toLowerCase()+"s";if(e.start=e.start,e.start>e.end){var i=e.start;e.start=e.end,e.end=i}var a={startIndex:e.start,endIndex:e.end,modelType:e.modelType,cancel:!1,isUndoRedo:e.isUndoRedo},o={eventArgs:a,action:"delete"};if(!e.isAction||(this.parent.notify(Ar,o),!a.cancel)){var s,l,h=[],d=e.end-e.start+1,p={startIndex:e.start,endIndex:e.end,modelType:e.modelType,sheet:e.model},c=this.parent.scrollSettings.isFinite;if("Row"===e.modelType){if(void 0!==e.checkCount&&e.checkCount===e.model.usedRange.rowIndex)return;if(this.parent.notify(Si,p),e.model=e.model,c){if(e.start>=e.model.rowCount)return;e.end>=e.model.rowCount&&(e.end=e.model.rowCount-1)}else{if(e.start>e.model.usedRange.rowIndex)return;e.end>e.model.usedRange.rowIndex&&(e.end-=e.end-e.model.usedRange.rowIndex)}this.setRowColCount(e.start,e.end,e.model,"row"),e.start<=e.model.usedRange.rowIndex&&(e.model.usedRange.rowIndex-=e.end-e.start+1,e.model.usedRange.rowIndex<0&&(e.model.usedRange.rowIndex=0));var u=this.parent.frozenRowCount(e.model);e.start<u&&(u=e.end<u?e.end-e.start+1:u-e.start,u=e.model.frozenRows-u,this.parent.setSheetPropertyOnMute(e.model,"frozenRows",u),a.freezePane=!0);var f=e.end+1,g=void 0,m=void 0;if(e.model.rows[e.start]&&e.model.rows[e.start].cells)for(var v=0;v<=e.model.usedRange.colIndex;v++){if(e.model.rows[e.start].cells[v]&&void 0!==e.model.rows[e.start].cells[v].rowSpan&&e.model.rows[e.start].cells[v].rowSpan<0&&void 0===e.model.rows[e.start].cells[v].colSpan&&(m={range:[e.start,v,e.start,v]},this.parent.notify(qn,m),m.range=m.range,m.range[2]<=e.end&&((l=Re(m.range[0],v,e.model))&&l.rowSpan>1&&(l.rowSpan-(m.range[2]-e.start+1)>1?ke(m.range[0],v,e.model,{colSpan:l.rowSpan-(m.range[2]-e.start+1)},!0):delete e.model.rows[m.range[0]].cells[v].rowSpan),m=null)),e.model.rows[f]&&e.model.rows[f].cells&&e.model.rows[f].cells[v]&&void 0!==e.model.rows[f].cells[v].rowSpan&&e.model.rows[f].cells[v].rowSpan<0&&void 0===e.model.rows[f].cells[v].colSpan&&(m||(m={range:[f,v,f,v]},this.parent.notify(qn,m)),g=new Object,m.range=m.range,Object.assign(g,Re(m.range[0],m.range[1],e.model)),g&&g.rowSpan&&(g.rowSpan>1||g.colSpan>1))){(b=[])[1]=v,b[3]=g.colSpan>1?v+(g.colSpan-1):v,m.range=m.range,m.range[0]<e.start?(b[0]=b[2]=m.range[0],g.rowSpan-d>1&&(b[2]+=g.rowSpan-d-1)):(b[0]=b[2]=e.start,g.rowSpan-(e.end-m.range[0]+1)>1&&(b[2]+=g.rowSpan-(e.end-m.range[0]+1)-1)),h.push({range:b,isAction:!1,preventRefresh:!0,merge:!0,type:"All",skipChecking:!0})}m=null}a.sheetCount=e.model.usedRange.rowIndex}else if("Column"===e.modelType){if(void 0!==e.checkCount&&e.checkCount===e.model.usedRange.colIndex)return;if(this.parent.notify(Si,p),e.model=e.model,c){if(e.start>=e.model.colCount)return;e.end>=e.model.colCount&&(e.end=e.model.colCount-1)}else{if(e.start>e.model.usedRange.colIndex)return;e.end>e.model.usedRange.colIndex&&(e.end-=e.end-e.model.usedRange.colIndex)}this.setRowColCount(e.start,e.end,e.model,"col"),e.start<=e.model.usedRange.colIndex&&(e.model.usedRange.colIndex-=d,e.model.usedRange.colIndex<0&&(e.model.usedRange.colIndex=0));var y=this.parent.frozenColCount(e.model);e.start<y&&(y=e.end<y?e.end-e.start+1:y-e.start,y=e.model.frozenColumns-y,this.parent.setSheetPropertyOnMute(e.model,"frozenColumns",y),this.parent.updateTopLeftCell(),a.freezePane=!0),s=[];for(f=e.end+1,g=void 0,m=void 0,v=0;v<=e.model.usedRange.rowIndex;v++)if(s.push({}),e.model.rows[v]&&e.model.rows[v].cells){if(e.model.rows[v].cells[e.start]&&void 0!==e.model.rows[v].cells[e.start].colSpan&&e.model.rows[v].cells[e.start].colSpan<0&&void 0===e.model.rows[v].cells[e.start].rowSpan&&(m={range:[v,e.start,v,e.start]},this.parent.notify(qn,m),m.range=m.range,m.range[3]<=e.end)){var C=Re(v,m.range[1],e.model);C&&C.colSpan>1&&(C.colSpan-(m.range[3]-e.start+1)>1?ke(v,m.range[1],e.model,{colSpan:C.colSpan-(m.range[3]-e.start+1)},!0):delete e.model.rows[v].cells[m.range[1]].colSpan),m=null}if(e.model.rows[v].cells[f]&&void 0!==e.model.rows[v].cells[f].colSpan&&e.model.rows[v].cells[f].colSpan<0&&void 0===e.model.rows[v].cells[f].rowSpan&&(m||(m={range:[v,f,v,f]},this.parent.notify(qn,m)),g=new Object,m.range=m.range,Object.assign(g,Re(m.range[0],m.range[1],e.model)),g&&g.colSpan&&(g.colSpan>1||g.rowSpan>1))){var b;(b=[])[0]=v,b[2]=g.rowSpan>1?v+(g.rowSpan-1):v,m.range=m.range,m.range[1]<e.start?(b[1]=b[3]=m.range[1],g.colSpan-d>1&&(b[3]+=g.colSpan-d-1)):(b[1]=b[3]=e.start,g.colSpan-(e.end-m.range[1]+1)>1&&(b[3]+=g.colSpan-(e.end-m.range[1]+1)-1)),h.push({range:b,isAction:!1,preventRefresh:!0,merge:!0,type:"All",skipChecking:!0})}s[v].cells=e.model.rows[v].cells.splice(e.start,d),m=null}a.sheetCount=e.model.usedRange.colIndex,a.deletedCellsModel=s}else{if(e.end-e.start==this.parent.sheets.length-1||void 0!==e.checkCount&&e.checkCount===this.parent.sheets.length)return;a.sheetCount=this.parent.sheets.length,a.activeSheetIndex=this.parent.activeSheetIndex}var x=[],S="Row"===e.modelType&&e.start<e.model.maxHgts.length;for(v=e.start;v<=e.end;v++){var w=e.model[""+n];"Sheet"===e.modelType&&w[v]&&this.parent.notify(jr,{action:"deleteSheetTab",sheetId:w[v].id}),w[e.start]||e.start<w.length?(x.push(w[e.start]||{}),w.splice(e.start,1)):x.push({}),v===e.start&&(x[0].index=e.start),S&&e.model.maxHgts.splice(e.start,1)}h.forEach(function(e){return t.parent.notify(_n,e)}),this.parent.notify(di,e),"Sheet"!==e.modelType&&(this.parent.notify(Ci,e),a.refreshSheet=e.refreshSheet,a.activeSheetIndex=ce(this.parent,e.model.name),a.conditionalFormats=[],this.deleteConditionalFormats(e,a)),a.definedNames=p.definedNames,a.isAction=e.isAction,a.deletedModel=x,delete a.cancel,this.parent.notify(xn,o)}}},e.prototype.setRowColCount=function(e,t,r,n){var i=n+"Count",a=r[""+i];t>=a&&(t=a-1),t<e||(this.parent.setSheetPropertyOnMute(r,i,a-(t-e+1)),r.id===this.parent.getActiveSheet().id&&this.parent.notify(zr,{index:a-1,update:n,isDelete:!0,start:e,end:t}))},e.prototype.setDeleteInfo=function(e,t,r,n){void 0===n&&(n="Row");var i=t-e+1,a=[];this.parent.getActiveSheet().ranges.forEach(function(o){o.info&&e<o.info[""+r]&&(o.info["delete"+n+"Range"]?o.info["delete"+n+"Range"].push([e,t]):o.info["delete"+n+"Range"]=[[e,t]],o.info[""+r]-=i,o.info["insert"+n+"Range"]&&(o.info["insert"+n+"Range"]=a))})},e.prototype.deleteConditionalFormats=function(e,r){var n=e.model.conditionalFormats;if(n)for(var i=0;i<n.length;i++){r.conditionalFormats.push(t.extend({},n[i],null,!0));var a=c(n[i].range),o=c(e.model.selectedRange);"Column"===e.modelType&&o[1]<=a[1]&&o[3]>=a[3]||"Row"===e.modelType&&o[0]<=a[0]&&o[2]>=a[2]?(n.splice(n.indexOf(n[i]),1),i--):n[i].range=m(re(e,a))}},e.prototype.addEventListener=function(){this.parent.on(wn,this.deleteModel,this)},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off(wn,this.deleteModel)},e.prototype.getModuleName=function(){return"workbookdelete"},e}(),va=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.addEventListener=function(){this.parent.on(En,this.validationHandler,this),this.parent.on(Rn,this.addHighlightHandler,this),this.parent.on(Tn,this.removeHighlightHandler,this),this.parent.on(hi,this.beforeInsertDeleteHandler,this),this.parent.on(di,this.beforeInsertDeleteHandler,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(En,this.validationHandler),this.parent.off(Rn,this.addHighlightHandler),this.parent.off(Tn,this.removeHighlightHandler),this.parent.off(hi,this.beforeInsertDeleteHandler),this.parent.off(di,this.beforeInsertDeleteHandler))},e.prototype.validationHandler=function(e){var r=this,n=e.range,i="";e.range.indexOf("!")>-1&&(n=e.range.split("!")[1],i=e.range.split("!")[0]);var a=Ce(this.parent,i?ce(this.parent,i):this.parent.activeSheetIndex);this.parent.dataValidationRange=(this.parent.dataValidationRange.indexOf("!")>-1?"":a.name+"!")+this.parent.dataValidationRange+n+",";var o=this.getRangeWhenColumnSelected(n,a);n=o.range,t.isNullOrUndefined(i)||(e.range=i+"!"+n),e.range=e.range||a.selectedRange;var s,l,h,d=w(c(e.range));e.viewport&&o.isFullCol&&(h=oe(this.parent,e.viewport)),","!==this.parent.listSeparator&&!e.isRemoveValidation&&"List"===e.rules.type&&e.rules.value1.includes(this.parent.listSeparator)&&(e.rules.value1=e.rules.value1.split(this.parent.listSeparator).join(","));for(var p=function(t){if(o.isFullCol){if(l=Xe(a,t),!e.isRemoveValidation)return l=Xe(a,t),l.validation={operator:e.rules.operator,type:e.rules.type,value1:e.rules.value1,value2:e.rules.value2,inCellDropDown:e.rules.inCellDropDown,ignoreBlank:e.rules.ignoreBlank},"continue";if(l&&l.validation)return delete l.validation,h&&h.forEach(function(e){for(var n=e[0];n<=e[2];n++)s=Re(n,t,a),r.parent.notify(_r,{rowIdx:n,colIdx:t,style:r.parent.getCellStyleValue(["backgroundColor","color"],[n,t])})}),"continue"}for(var n=d[0];n<=d[2];n++)e.isRemoveValidation?(n===d[2]&&(l=Xe(a,t))&&l.validation&&(l.validation.address=G(l.validation.address,[d[0],t,d[2],t],t)),(s=Re(n,t,a))&&s.validation&&!J(u.parent,a,{cell:{validation:{}},rowIdx:n,colIdx:t})&&(delete s.validation,u.parent.notify(_r,{rowIdx:n,colIdx:t,style:u.parent.getCellStyleValue(["backgroundColor","color"],[n,t])}))):(s={validation:Object.assign({},e.rules)},J(u.parent,a,{cell:s,rowIdx:n,colIdx:t}))},u=this,f=d[1];f<=d[3];f++)p(f)},e.prototype.addHighlightHandler=function(e){this.InvalidDataHandler(e.range,!1,e.td,e.isclearFormat)},e.prototype.removeHighlightHandler=function(e){this.InvalidDataHandler(e.range,!0)},e.prototype.getRange=function(e){var t=c(e),r=this.parent.getActiveSheet(),n=r.colCount,i=r.rowCount;return t[2]===i-1&&0===t[0]?e=e.replace(/[0-9]/g,""):t[3]===n-1&&0===t[2]&&(e=e.replace(/\D/g,"")),e},e.prototype.InvalidDataHandler=function(e,t,r,n){for(var i,a,o=e?S(this.parent,e):this.parent.activeSheetIndex,s=Ce(this.parent,o),l=(e=e||s.selectedRange).includes("!")?fe(e):s.name,h=this.getRangeWhenColumnSelected(C(e),s),d=h.isFullCol,p=(e=l+"!"+h.range)?w(c(e)):[],u=(e=this.getRange(e))?p[0]:0,f=e?p[2]:s.rows.length;u<=f;u++)if(s.rows[u])for(var g=e?p[1]:0,m=e?p[3]:s.rows[u].cells.length;g<=m;g++){var v=void 0;if(s.rows[u].cells&&s.rows[u].cells[g]){var y=Xe(s,g);if((i=s.rows[u].cells[g])&&i.validation){if(v=i.validation,n&&!v.isHighlighted)return;t?v.isHighlighted&&(i.validation.isHighlighted=!1):i.validation.isHighlighted=!0}else if(y&&y.validation){if(v=y.validation,n&&!v.isHighlighted)return;t&&d?v.isHighlighted&&(y.validation.isHighlighted=!1):d&&(y.validation.isHighlighted=!0)}a=i.value?i.value:"";var b=[u,g];if(v&&this.parent.allowDataValidation){var x={value:a,range:b,sheetIdx:o,isCell:!1,td:r,isValid:!0};this.parent.notify(In,x);x.isValid||je(s,u)||o!==this.parent.activeSheetIndex||this.parent.notify(li,{isRemoveHighlightedData:t,rowIdx:u,colIdx:g,td:r})}}}},e.prototype.beforeInsertDeleteHandler=function(e){if("Sheet"!==e.modelType)for(var t,r,n=0,i=this.parent.sheets.length;n<i;n++)for(var a=0,o=(r=this.parent.sheets[n]).rows.length;a<o;a++)if(r.rows[a]&&r.rows[a].cells)for(var s=0,l=r.rows[a].cells.length;s<l;s++)if((t=r.rows[a].cells[s])&&t.validation){var h="beforeInsert"===e.name,d=e.index+(e.model.length-1),p="Row"===e.modelType?a>=e.index&&a<=d:s>=e.index&&s<=d,c=void 0;c=h?{insertDeleteArgs:{startIndex:e.index,endIndex:e.index+e.model.length-1,modelType:e.modelType,isInsert:!0,sheet:Ce(this.parent,e.activeSheetIndex)},row:a,col:s,sheetIdx:n}:{insertDeleteArgs:{startIndex:e.start,modelType:e.modelType,endIndex:e.end,sheet:e.model},row:a,col:s,sheetIdx:n},B(t.validation.value1)&&!p&&(c.cell={formula:t.validation.value1},this.parent.notify(wi,c),t.validation.value1=c.cell.formula),B(t.validation.value2)&&!p&&(c.cell={formula:t.validation.value2},this.parent.notify(wi,c),t.validation.value2=c.cell.formula),e.activeSheetIndex===n&&h&&this.updateValidationForInsertedModel(e,r,a,s,t.validation)}},e.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}},e.prototype.updateValidationForInsertedModel=function(e,r,n,i,a){var o=e.index+(e.model.length-1);if("Column"===e.modelType){if("before"===e.insertType&&o===i-1||"after"===e.insertType&&e.index-1===i)for(var s=e.index;s<=o;s++)ke(n,s,r,{validation:t.extend({},a)},!0)}else if("Row"===e.modelType&&("above"===e.insertType&&o===n-1||"below"===e.insertType&&e.index-1===n))for(s=e.index;s<=o;s++)ke(s,i,r,{validation:t.extend({},a)},!0)},e.prototype.getModuleName=function(){return"workbookDataValidation"},e}(),ya=function(){return(ya=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e}).apply(this,arguments)},Ca=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.addEventListener=function(){this.parent.on("find",this.find,this),this.parent.on(Fn,this.replace,this),this.parent.on(An,this.replaceAll,this),this.parent.on(Ln,this.totalCount,this),this.parent.on(Ur,this.findAllValues,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off("find",this.find),this.parent.off(Fn,this.replace),this.parent.off(An,this.replaceAll),this.parent.off(Ln,this.totalCount),this.parent.off(Ur,this.findAllValues))},e.prototype.find=function(e){e.sheetIndex=t.isUndefined(e.sheetIndex)?this.parent.activeSheetIndex:e.sheetIndex;var r=this.parent.sheets[e.sheetIndex],n=c(r.activeCell),i={startRow:n[0],startCol:n[1],findVal:e.isCSen?e.value:e.value.toLowerCase(),activeCell:n};("By Row"===e.searchBy?i.startRow>r.usedRange.rowIndex:i.startCol>r.usedRange.colIndex)?"next"===e.findOpt?i.startRow=i.startCol=0:(i.startRow=r.usedRange.rowIndex,i.startCol=r.usedRange.colIndex):"By Row"===e.searchBy?i.startCol>r.usedRange.colIndex&&("next"===e.findOpt?(i.startRow++,i.startRow>r.usedRange.rowIndex&&(i.startRow=0),i.startCol=0):(i.startRow--,i.startRow<0&&(i.startRow=r.usedRange.rowIndex),i.startCol=r.usedRange.colIndex)):i.startRow>r.usedRange.rowIndex&&("next"===e.findOpt?(i.startCol++,i.startCol>r.usedRange.colIndex&&(i.startRow=0),i.startRow=0):(i.startCol--,i.startCol<0&&(i.startCol=r.usedRange.colIndex),i.startRow=r.usedRange.colIndex)),"Workbook"===e.mode?(i.sheets=this.parent.sheets,i.sheetIdx=e.sheetIndex):(i.sheets=[r],i.sheetIdx=0);var a,o=e.showDialog&&this.parent.element&&this.parent.element.querySelector(".e-header-panel");o&&(a=(o.offsetHeight||(r.showHeaders?30:0))+1),"next"===e.findOpt?this.findNext(e,i):this.findPrevious(e,i),e.showDialog&&this.parent.notify(Or,{findValue:e.value,isPublic:!0,headerHgt:a})},e.prototype.findNext=function(e,t){var r=this,n=function(n,i,a){for(var o,s,l=n;l<=i&&(o=t.sheets[l],!(s=l===t.sheetIdx?a?r.findNextOnSheet(e,t.startRow,t.startCol,t.findVal,o,void 0,t.activeCell):r.findNextOnSheet(e,0,0,t.findVal,o,"By Row"===e.searchBy?t.startRow:t.startCol):r.findNextOnSheet(e,0,0,t.findVal,o)));l++);return s},i=n(t.sheetIdx,t.sheets.length-1,!0);i||(i=n(0,t.sheetIdx)),i?this.parent.notify(kn,{address:i}):this.parent.notify(Nn,null)},e.prototype.findNextOnSheet=function(e,t,r,n,i,a,o){var s,l,h;if("By Row"===e.searchBy){void 0===a&&(a=i.rows.length-1);var d=void 0;for(l=t;l<=a;l++)if(!je(i,l))for(h=o&&l===t?r:0,d=i.rows[l]&&i.rows[l].cells&&i.rows[l].cells.length;h<d;h++)if(!Qe(i,h)&&(s=this.checkMatch(e,n,l,h,i,o)))return s}else{void 0===a&&(a=i.usedRange.colIndex);var p=i.rows&&i.rows.length-1;for(h=r;h<=a;h++)if(!Qe(i,h))for(l=o&&h===r?t:0;l<=p;l++)if(!je(i,l)&&(s=this.checkMatch(e,n,l,h,i,o)))return s}return s},e.prototype.findPrevious=function(e,t){var r,n=this,i=function(r,i,a){for(var o,s,l=r;l>=i&&(o=t.sheets[l],!(s=l===t.sheetIdx?a?n.findPrevOnSheet(e,t.startRow,t.startCol,0,0,t.findVal,o,t.activeCell):"By Row"===e.searchBy?n.findPrevOnSheet(e,o.usedRange.rowIndex,o.usedRange.colIndex,t.startRow,0,t.findVal,o):n.findPrevOnSheet(e,o.usedRange.rowIndex,o.usedRange.colIndex,0,t.startCol,t.findVal,o):n.findPrevOnSheet(e,o.usedRange.rowIndex,o.usedRange.colIndex,0,0,t.findVal,o)));l--);return s};(r=i(t.sheetIdx,0,!0))||(r=i(t.sheets.length-1,t.sheetIdx)),r?this.parent.notify(kn,{address:r}):this.parent.notify(Nn,null)},e.prototype.findPrevOnSheet=function(e,t,r,n,i,a,o,s){var l,h,d;if("By Row"===e.searchBy){for(d=t;d>=n;d--)if(!je(o,d))for(h=s&&d===t?r:o.rows[d]&&o.rows[d].cells&&o.rows[d].cells.length-1;h>=i;h--)if(!Qe(o,h)&&(l=this.checkMatch(e,a,d,h,o,s)))return l}else for(h=r;h>=i;h--)if(!Qe(o,h))for(d=s&&h===r?t:o.rows&&o.rows.length-1;d>=n;d--)if(!je(o,d)&&(l=this.checkMatch(e,a,d,h,o,s)))return l;return l},e.prototype.checkMatch=function(e,t,r,n,i,a){if(a&&r===a[0]&&n===a[1])return null;var o=Re(r,n,i,!1,!0);if(i.isProtected&&!i.protectSettings.selectCells&&i.protectSettings.selectUnLockedCells&&Y(o,Xe(i,n)))return null;var s=this.parent.getDisplayText(o);if(s)if(e.isCSen||(s=s.toLowerCase()),e.isEMatch){if(s===t)return i.name+"!"+g(r,n)}else if(s.includes(t))return i.name+"!"+g(r,n);return null},e.prototype.replace=function(e){var r=t.isUndefined(e.sheetIndex)?this.parent.activeSheetIndex:e.sheetIndex,n=Ce(this.parent,e.sheetIndex);if(n.isProtected)this.parent.notify("editAlert",null);else{var i,a=c(e.address||n.activeCell),o=this.parent.getDisplayText(Re(a[0],a[1],n,!1,!0)).toString();e.value=e.value.toString(),e.isCSen||(i=e.value.toLowerCase());var s=this.getReplaceValue(e,o,i);if(s||(e.findOpt="next",this.find(e),a=u(n.activeCell),o=this.parent.getDisplayText(Re(a[0],a[1],n)).toString(),s=this.getReplaceValue(e,o,i))){var l={address:n.name+"!"+g(a[0],a[1]),cancel:!1,compareValue:e.value,replaceValue:e.replaceValue,sheetIndex:r};if(e.isAction){if(this.parent.notify(Ar,{action:"beforeReplace",eventArgs:l}),l.cancel)return;delete l.cancel}J(this.parent,n,{cell:{value:s},rowIdx:a[0],colIdx:a[1],uiRefresh:!0,valChange:!0}),e.isAction&&this.parent.notify("actionComplete",{action:"replace",eventArgs:l})}}},e.prototype.replaceAll=function(e){for(var t,r,n,i=this,a="Sheet"===e.mode?e.sheetIndex:0,o=this.parent.sheets[a],s=o.usedRange.rowIndex,l=0,h=o.usedRange.colIndex,d=0,p=[],c=e.isAction,f=ya({addressCollection:p,cancel:!1},e),m=function(t,r){requestAnimationFrame?requestAnimationFrame(function(){if(!f.cancel&&f.addressCollection[r]){var n=u(f.addressCollection[r].split("!")[1]),a=S(i.parent,f.addressCollection[r]);J(i.parent,i.parent.sheets[a],{cell:{value:t},rowIdx:n[0],uiRefresh:!0,colIdx:n[1],valChange:!0,skipFormatCheck:e.skipFormatCheck}),r===f.addressCollection.length-1&&c&&i.parent.notify("actionComplete",{action:"replaceAll",eventArgs:f})}}):i.parent.updateCell({value:t},f.addressCollection[r])};l<=s+1;l++){if(d>h&&l>s&&"Workbook"===e.mode){if(a++,!(o=this.parent.sheets[a]))break;d=0,l=0,h=o.usedRange.colIndex,s=o.usedRange.rowIndex}if(r=o.rows[l])for(d===h+1&&(d=0);d<=h;d++)if(r&&r.cells&&r.cells[d]&&(t=this.parent.getDisplayText(o.rows[l].cells[d]).toString()))if(e.isCSen)e.isEMatch?t===e.value&&(m(e.replaceValue,p.length),p.push(o.name+"!"+g(l,d))):t.indexOf(e.value)>-1&&(m(t.replace(e.value,e.replaceValue),p.length),p.push(o.name+"!"+g(l,d)));else if(e.isEMatch)t.toLowerCase()===e.value&&(m(e.replaceValue,p.length),p.push(o.name+"!"+g(l,d)));else{var v=t.toLowerCase();if(t===e.value||v.indexOf(e.value.toString().toLowerCase())>-1||v===e.value||t===e.value||v.indexOf(e.value)>-1){n=new RegExp(e.value.toString().replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"ig"),m(t.replace(n,e.replaceValue),p.length),p.push(o.name+"!"+g(l,d))}}}p.length&&c?(this.parent.notify("actionBegin",{action:"beforeReplaceAll",eventArgs:f}),f.cancel||this.parent.notify(Bn,{count:f.addressCollection.length,replaceValue:f.replaceValue})):this.parent.notify(Bn,{count:f.addressCollection.length,replaceValue:f.replaceValue})},e.prototype.getReplaceValue=function(e,t,r){if(e.isCSen)return e.isEMatch?t===e.value&&e.replaceValue:t.indexOf(e.value)>-1&&t.replace(e.value,e.replaceValue);if(e.isEMatch)return t.toLowerCase()===r&&e.replaceValue;var n=RegExp;return t.toLowerCase().includes(r)&&t.replace(new n(e.value.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"ig"),e.replaceValue)},e.prototype.totalCount=function(e){var t=this,r=this.parent.sheets[e.sheetIndex],n=u(r.activeCell),i=0,a=0,o=e.value.toLowerCase();r.rows.filter(function(e,s){return e&&e.cells&&!e.isFiltered&&!e.hidden&&e.cells.filter(function(e,l){!e||!e.value&&0!==e.value||Qe(r,l)||r.isProtected&&!r.protectSettings.selectCells&&Y(e,Xe(r,l))||(e.format?t.parent.getDisplayText(e):e.value.toString()).toLowerCase().includes(o)&&(i++,(s===n[0]&&l>=n[1]||s>n[0])&&a++)})});var s=i;(i=s-(a-=1))>s&&(i=s),0===i||this.parent.getDisplayText(Re(n[0],n[1],r)).toLowerCase().includes(o)||(i-=1),e.findCount=i+" of "+s},e.prototype.findAllValues=function(e){for(var r,n=e.sheetIndex,i=this.parent.sheets[n],a=i.usedRange.rowIndex,o=0,s=i.usedRange.colIndex,l=0,h=this.parent.sheets.length,d=e.sheetIndex;o<=a+1;o++){if(1!==d&&e.sheetIndex===h&&(n=1),o>a&&l>s&&"Workbook"===e.mode){if(++n>h-1&&(n=0),d===n)return void 0;(i=this.parent.sheets[n])&&(o=0,l=0,s=i.usedRange.colIndex,a=i.usedRange.rowIndex)}if(!t.isNullOrUndefined(i)&&i.rows[o]){var p=i.rows[o];for(l===s+2&&(l=0);l<=s+1;l++)if(p&&p.cells&&p.cells[l]){var c=i.rows[o].cells[l];if(c&&!t.isNullOrUndefined(c.value)&&""!==c.value&&(!i.isProtected||i.protectSettings.selectCells||i.protectSettings.selectUnLockedCells&&!Y(c,Xe(i,l)))){var u=void 0;if(c.format){u=this.parent.getDisplayText(i.rows[o].cells[l]).toString()}else u=c.value.toString();if(e.isCSen&&e.isEMatch)u===e.value&&(r=i.name+"!"+g(o,l),e.findCollection.push(r),0);else if(e.isCSen&&!e.isEMatch){var f=u.indexOf(e.value)>-1;(u===e.value||f)&&(r=i.name+"!"+g(o,l),e.findCollection.push(r),0)}else if(!e.isCSen&&e.isEMatch){(m=u.toString().toLowerCase())===e.value.toLowerCase()&&(r=i.name+"!"+g(o,l),e.findCollection.push(r),0)}else if(!e.isCSen&&!e.isEMatch){var m;f=(m=u.toString().toLowerCase()).indexOf(e.value.toLowerCase())>-1;(m===e.value||u===e.value||f||u===e.value)&&(r=i.name+"!"+g(o,l),e.findCollection.push(r),0)}}}}}},e.prototype.getModuleName=function(){return"workbookfindAndReplace"},e}(),ba=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.protectsheetHandler=function(e){var r=t.isNullOrUndefined(e.sheetIndex)?this.parent.activeSheetIndex:e.sheetIndex,n=Ce(this.parent,r);this.parent.setSheetPropertyOnMute(n,"isProtected",!0),this.parent.setSheetPropertyOnMute(n,"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(Pn,{sheetIndex:r,triggerEvent:e.triggerEvent}),this.parent.notify(Mn,{props:"Protect"}),n.password=e.password?e.password:"",n.columns.forEach(function(e){e&&t.isUndefined(e.isLocked)&&(e.isLocked=!0)})},e.prototype.unprotectsheetHandler=function(e){var t=this.parent.getActiveSheet();t.isImportProtected&&(t.isImportProtected=!1),e.sheet&&(t=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(Pn,t.protectSettings),this.parent.notify(Mn,{props:"Protect"})},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.addEventListener=function(){this.parent.on(Hn,this.protectsheetHandler,this),this.parent.on(Un,this.unprotectsheetHandler,this),this.parent.on(Vn,this.lockCells,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(Hn,this.protectsheetHandler),this.parent.off(Vn,this.lockCells),this.parent.off(Hn,this.unprotectsheetHandler))},e.prototype.lockCells=function(e){var t=this.parent.getAddressInfo(e.range),r=w(t.indices),n=Ce(this.parent,t.sheetIndex),i=!!e.isLocked&&e.isLocked;if(0===r[0]&&r[2]===n.rowCount-1)for(var a=r[1];a<=r[3];a++)Ke(n,a,{isLocked:e.isLocked});for(a=r[0];a<=r[2];a++)for(var o=r[1];o<=r[3];o++)ke(a,o,n,{isLocked:i},!0);e.triggerEvent&&this.parent.notify("actionComplete",{action:"lockCells",eventArgs:e})},e.prototype.getModuleName=function(){return"workbookProtectSheet"},e}(),xa=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.merge=function(e){e.sheetIndex=t.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=c(e.range));var r=e.range=w(e.range);if(e.skipChecking||this.mergedRange(e),e.merge&&"All"!==e.type){if("Horizontally"===e.type)for(var n=e.range[0],i=e.range[2];n<=i;n++)e.range=[n,r[1],n,r[3]],this.mergeAll(e,n-r[0]);else if("Vertically"===e.type){var a=e.range[1];for(i=e.range[3];a<=i;a++)e.range=[r[0],a,r[2],a],this.mergeAll(e,0,a-r[1])}}else this.mergeAll(e),e.refreshRibbon&&this.parent.notify(Kr,null);e.range=r,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:Ce(this.parent,e.sheetIndex).selectedRange,skipChecking:!0}),this.parent.chartColl&&this.parent.chartColl.length&&this.parent.notify(ri,{range:e.range}))},e.prototype.mergeAll=function(e,r,n){void 0===r&&(r=0),void 0===n&&(n=0);var i,a=0;e.range=e.range;for(var o,s,l,h,d,p=t.isUndefined(e.sheetIndex)?this.parent.getActiveSheet():Ce(this.parent,e.sheetIndex),c={cell:new Object,rowIdx:e.range[0],colIdx:e.range[1],valChange:!e.merge,preventEvt:!0,uiRefresh:!e.preventRefresh,skipFormatCheck:!0},u=e.range[0],f=r;u<=e.range[2];u++,f++){o=0,e.isAction&&!e.model[f]&&e.model.push({cells:[]});for(var g=e.range[1],m=n;g<=e.range[3];g++,m++){if((i=Re(u,g,p))&&(i.value||0===i.value||i.formula)&&!s&&(s=i.formula||i.value,h=i.format),e.isAction&&e.merge&&(d=e.model[f].cells[m]={},t.extend(d,i,null,!0)),i&&(delete i.rowSpan,delete i.colSpan,(d=!e.merge&&!e.isAction&&e.model&&e.model[f]&&e.model[f].cells[m])&&ke(u,g,p,d)),u===e.range[0]&&g===e.range[1]){if(e.merge){e.range[3]-e.range[1]>0&&(c.cell.colSpan=e.range[3]-e.range[1]+1),e.range[2]-e.range[0]>0&&(c.cell.rowSpan=e.range[2]-e.range[0]+1),J(this.parent,p,c),c.valChange=c.mergedCells=!0;continue}}else c.rowIdx=u,c.colIdx=g,c.cell={},e.merge&&(u!==e.range[0]&&(c.cell.rowSpan=-a),g!==e.range[1]&&(o++,c.cell.colSpan=-o));J(this.parent,p,c),l||(l=c.isFormulaDependent)}a++}if(e.merge)if(s||0===s){delete c.mergedCells,c.cell={};var v=Re(e.range[0],e.range[1],p);v&&(v.value||v.formula)||(B(s)?c.cell.formula=s:c.cell.value=s,h&&(c.cell.format=h)),c.rowIdx=e.range[0],c.colIdx=e.range[1],J(this.parent,p,c)}else e.preventRefresh||this.parent.notify(zn,{rowIdx:e.range[0],colIdx:e.range[1]});e.preventRefresh||this.refreshCF(p,e.range[0],e.range[1],l)},e.prototype.refreshCF=function(e,t,r,n){e.conditionalFormats&&e.conditionalFormats.length&&this.parent.notify(Xn,{indexes:[t,r],refreshAll:n,isAction:!0})},e.prototype.activeCellRange=function(e){e.range=e.range;var r=this.parent.getActiveSheet(),n=Re(e.range[0],e.range[1],r);n&&(!t.isNullOrUndefined(n.rowSpan)&&n.rowSpan<0&&(e.range[0]+=n.rowSpan,e.insertCount&&(e.range[0]-=e.insertCount)),!t.isNullOrUndefined(n.colSpan)&&n.colSpan<0&&(e.range[1]+=n.colSpan,e.insertCount&&(e.range[1]-=e.insertCount)),(n=Re(e.range[0],e.range[1],r))&&(n.rowSpan>1&&(e.range[0]+(n.rowSpan-1)>=e.range[2]||e.insertCount)&&(e.range[2]=e.range[0]+(n.rowSpan-1)),n.colSpan>1&&(e.range[1]+(n.colSpan-1)>=e.range[3]||e.insertCount)&&(e.range[3]=e.range[1]+(n.colSpan-1))))},e.prototype.mergedRange=function(e){"string"==typeof e.range&&(e.range=c(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)},e.prototype.forward=function(e){e.range=e.range;var r,n,i=t.isUndefined(e.sheetIndex)?this.parent.getActiveSheet():Ce(this.parent,e.sheetIndex),a=Re(e.range[0],e.range[1],i),o=r=e.range[0],s=n=e.range[1];if(a&&(!t.isNullOrUndefined(a.rowSpan)&&a.rowSpan<0&&(o=r=e.range[0]+a.rowSpan),!t.isNullOrUndefined(a.colSpan)&&a.colSpan<0&&(s=n=e.range[1]+a.colSpan),(a=Re(o,s,i))&&(a.rowSpan>1&&(r+=a.rowSpan-1,o+(a.rowSpan-1)>=e.range[2]&&(e.range[2]=e.range[0],e.range[2]=o+(a.rowSpan-1))),a.colSpan>1&&(n+=a.colSpan-1,s+(a.colSpan-1)>=e.range[3]&&(e.range[3]=e.range[1],e.range[3]=s+(a.colSpan-1))))),e.range[0]=o,e.range[1]=s,e.range[0]===o&&e.range[1]===s&&e.range[2]===r&&e.range[3]===n&&(e.isActiveCell=!0),!e.skipChecking){for(var l=e.range[1];l<=e.range[3];l++)(a=Re(e.range[2],l,i))&&(o=e.range[2],s=l,!t.isNullOrUndefined(a.colSpan)&&a.colSpan<0&&(s+=a.colSpan)<e.range[1]&&(e.range[1]=s),!t.isNullOrUndefined(a.rowSpan)&&a.rowSpan<0&&(o+=a.rowSpan)<e.range[0]&&(e.range[0]=o),(a=Re(o,s,i))&&(a.colSpan>1&&s+(a.colSpan-1)>e.range[3]&&(e.range[3]=s,e.range[3]=s+(a.colSpan-1)),a.rowSpan>1&&o+(a.rowSpan-1)>e.range[2]&&(e.range[2]=o,e.range[2]=o+(a.rowSpan-1))));var h,d;for(l=e.range[1];l<=e.range[3];l++)(a=Re(e.range[0],l,i))&&(d=l,h=e.range[0],!t.isNullOrUndefined(a.colSpan)&&a.colSpan<0&&(d+=a.colSpan)<e.range[1]&&(e.range[1]=d),!t.isNullOrUndefined(a.rowSpan)&&a.rowSpan<0&&(h+=a.rowSpan)<e.range[0]&&(e.range[0]=h));for(l=e.range[0];l<=e.range[2];l++)(a=Re(l,e.range[3],i))&&(o=l,s=e.range[3],!t.isNullOrUndefined(a.rowSpan)&&a.rowSpan<0&&(o+=a.rowSpan)<e.range[0]&&(e.range[0]=o),!t.isNullOrUndefined(a.colSpan)&&a.colSpan<0&&(s+=a.colSpan)<e.range[1]&&(e.range[1]=s),(a=Re(o,s,i))&&(a.rowSpan>1&&o+(a.rowSpan-1)>e.range[2]&&(e.range[2]=o,e.range[2]=o+(a.rowSpan-1)),a.colSpan>1&&s+(a.colSpan-1)>e.range[3]&&(e.range[3]=s,e.range[3]=s+(a.colSpan-1))))}},e.prototype.forwardReverse=function(e){var r=this.parent.getActiveSheet();e.range=e.range;var n=e.range[1],i=Re(e.range[0],e.range[1],r),a=e.range[0];if(i&&(!t.isNullOrUndefined(i.colSpan)&&i.colSpan<0&&(n+=i.colSpan,e.range[3]>=n&&(e.range[3]=n)),!t.isNullOrUndefined(i.rowSpan)&&i.rowSpan<0&&(a+=i.rowSpan)<e.range[0]&&(e.range[0]=a),(i=Re(a,n,r))&&(i.rowSpan>1&&a+(i.rowSpan-1)>=e.range[2]&&(e.range[2]=a+(i.rowSpan-1)),i.colSpan>1&&n+(i.colSpan-1)>=e.range[1]&&(e.range[1]=n+(i.colSpan-1)))),e.range[0]=a,!e.skipChecking){for(var o,s,l=e.range[3];l<=e.range[1];l++)(i=Re(e.range[2],l,r))&&(s=l,o=e.range[2],!t.isNullOrUndefined(i.rowSpan)&&i.rowSpan<0&&(o+=i.rowSpan)<e.range[0]&&(e.range[0]=o),!t.isNullOrUndefined(i.colSpan)&&i.colSpan<0&&(s+=i.colSpan)<e.range[3]&&(e.range[3]=s),(i=Re(o,s,r))&&(i.rowSpan>1&&o+(i.rowSpan-1)>e.range[2]&&(e.range[2]=o+(i.rowSpan-1)),i.colSpan>1&&s+(i.colSpan-1)>e.range[1]&&(e.range[1]=s+(i.colSpan-1))));var h;for(l=e.range[3];l<=e.range[1];l++)(i=Re(e.range[0],l,r))&&(s=l,h=e.range[0],!t.isNullOrUndefined(i.rowSpan)&&i.rowSpan<0&&(h+=i.rowSpan)<e.range[0]&&(e.range[0]=h),!t.isNullOrUndefined(i.colSpan)&&i.colSpan<0&&(s+=i.colSpan),(i=Re(h,s,r))&&(i.rowSpan>1&&h+(i.rowSpan-1)>e.range[2]&&(e.range[2]=h+(i.rowSpan-1)),i.colSpan>1&&s+(i.colSpan-1)>e.range[1]&&(e.range[1]=s,e.range[1]=s+(i.colSpan-1))));var d;for(l=e.range[0];l<=e.range[2];l++)(i=Re(l,e.range[3],r))&&(h=l,d=e.range[3],!t.isNullOrUndefined(i.rowSpan)&&i.rowSpan<0&&(h+=i.rowSpan)<e.range[0]&&(e.range[0]=h),!t.isNullOrUndefined(i.colSpan)&&i.colSpan<0&&(d+=i.colSpan)<e.range[3]&&(e.range[3]=d),(i=Re(h,d,r))&&(i.rowSpan>1&&h+(i.rowSpan-1)>e.range[2]&&(e.range[2]=h,e.range[2]=h+(i.rowSpan-1)),i.colSpan>1&&d+(i.colSpan-1)>e.range[1]&&(e.range[1]=d,e.range[1]=d+(i.colSpan-1))))}},e.prototype.reverse=function(e){e.range=e.range;var r=e.range[1],n=t.isUndefined(e.sheetIndex)?this.parent.getActiveSheet():Ce(this.parent,e.sheetIndex),i=Re(e.range[0],e.range[1],n),a=e.range[0];i&&(!t.isNullOrUndefined(i.colSpan)&&i.colSpan<0&&(r+=i.colSpan),!t.isNullOrUndefined(i.rowSpan)&&i.rowSpan<0&&(a+=i.rowSpan),e.range[2]>=a&&(e.range[2]=a,e.isActiveCell=!0),e.range[3]>=r?(e.range[3]=r,e.range[2]===a&&(e.isActiveCell=!0)):e.isActiveCell&&(e.isActiveCell=!1),(i=Re(a,r,n))&&(i.rowSpan>1&&a+(i.rowSpan-1)>=e.range[0]&&(e.range[0]=a,e.range[0]=a+(i.rowSpan-1)),i.colSpan>1&&r+(i.colSpan-1)>=e.range[1]&&(e.range[1]=r,e.range[1]=r+(i.colSpan-1))));var o=e.range[3];if(!e.skipChecking){for(var s=e.range[3];s<=e.range[1];s++)(i=Re(e.range[2],s,n))&&(o=s,a=e.range[2],!t.isNullOrUndefined(i.rowSpan)&&i.rowSpan<0&&(a+=i.rowSpan)<e.range[2]&&(e.range[2]=a),!t.isNullOrUndefined(i.colSpan)&&i.colSpan<0&&(o+=i.colSpan)<e.range[3]&&(e.range[3]=o),(i=Re(a,o,n))&&(i.rowSpan>1&&a+(i.rowSpan-1)>e.range[0]&&(e.range[0]=a,e.range[0]=a+(i.rowSpan-1)),i.colSpan>1&&o+(i.colSpan-1)>e.range[1]&&(e.range[1]=o,e.range[1]=o+(i.colSpan-1))));o=e.range[3];for(s=e.range[3];s<=e.range[1];s++)(i=Re(e.range[0],s,n))&&(o=s,a=e.range[0],!t.isNullOrUndefined(i.colSpan)&&i.colSpan<0&&(o+=i.colSpan),!t.isNullOrUndefined(i.rowSpan)&&i.rowSpan<0&&(a+=i.rowSpan),(i=Re(a,o,n))&&(i.colSpan>1&&o+(i.colSpan-1)>e.range[1]&&(e.range[1]=o,e.range[1]=o+(i.colSpan-1)),i.rowSpan>1&&a+(i.rowSpan-1)>e.range[0]&&(e.range[0]=a,e.range[0]=a+(i.rowSpan-1))));var l,h;for(s=e.range[2];s<=e.range[0];s++)(i=Re(s,e.range[3],n))&&(h=s,l=e.range[3],!t.isNullOrUndefined(i.rowSpan)&&i.rowSpan<0&&(h+=i.rowSpan)<e.range[2]&&(e.range[2]=h),!t.isNullOrUndefined(i.colSpan)&&i.colSpan<0&&(l+=i.colSpan)<e.range[3]&&(e.range[3]=l),(i=Re(h,l,n))&&(i.rowSpan>1&&h+(i.rowSpan-1)>e.range[0]&&(e.range[0]=h,e.range[0]=h+(i.rowSpan-1)),i.colSpan>1&&l+(i.colSpan-1)>e.range[1]&&(e.range[1]=l,e.range[1]=l+(i.colSpan-1))))}},e.prototype.reverseForward=function(e){e.range=e.range;var r=t.isUndefined(e.sheetIndex)?this.parent.getActiveSheet():Ce(this.parent,e.sheetIndex),n=e.range[0],i=e.range[1],a=Re(e.range[0],e.range[1],r);if(a&&(!t.isNullOrUndefined(a.rowSpan)&&a.rowSpan<0&&(n+=a.rowSpan,e.range[2]>=n&&(e.range[2]=n)),!t.isNullOrUndefined(a.colSpan)&&a.colSpan<0&&(i+=a.colSpan),(a=Re(n,i,r))&&(a.rowSpan>1&&n+(a.rowSpan-1)>=e.range[0]&&(e.range[0]=n,e.range[0]=n+(a.rowSpan-1)),a.colSpan>1&&i+(a.colSpan-1)>=e.range[3]&&(e.range[3]=e.range[1],e.range[3]=i+(a.colSpan-1)))),!e.skipChecking){for(var o,s=e.range[3],l=e.range[1];l<=e.range[3];l++)(a=Re(e.range[2],l,r))&&(o=e.range[2],s=l,!t.isNullOrUndefined(a.rowSpan)&&a.rowSpan<0&&(o+=a.rowSpan)<e.range[2]&&(e.range[2]=o),!t.isNullOrUndefined(a.colSpan)&&a.colSpan<0&&(s+=a.colSpan)<e.range[1]&&(e.range[1]=s),(a=Re(o,s,r))&&(a.colSpan>1&&s+(a.colSpan-1)>e.range[3]&&(e.range[3]=s+(a.colSpan-1)),a.rowSpan>1&&a.rowSpan-1+o>e.range[0]&&(e.range[0]=a.rowSpan-1+o)));var h,d;for(l=e.range[1];l<=e.range[3];l++)(a=Re(e.range[0],l,r))&&(d=l,h=e.range[0],!t.isNullOrUndefined(a.colSpan)&&a.colSpan<0&&(d+=a.colSpan)<e.range[1]&&(e.range[1]=d),!t.isNullOrUndefined(a.rowSpan)&&a.rowSpan<0&&(h+=a.rowSpan),(a=Re(h,d,r))&&a.rowSpan>1&&h+(a.rowSpan-1)>e.range[0]&&(e.range[0]=h+(a.rowSpan-1)));var p;for(l=e.range[2];l<=e.range[0];l++)(a=Re(l,e.range[3],r))&&(o=l,p=e.range[3],!t.isNullOrUndefined(a.rowSpan)&&a.rowSpan<0&&(o+=a.rowSpan)<e.range[2]&&(e.range[2]=o),!t.isNullOrUndefined(a.colSpan)&&a.colSpan<0&&(p+=a.colSpan)<e.range[1]&&(e.range[1]=p),(a=Re(o,p,r))&&(a.rowSpan>1&&a.rowSpan-1+o>e.range[0]&&(e.range[0]=a.rowSpan-1+o),a.colSpan>1&&a.colSpan-1+p>e.range[3]&&(e.range[3]=p,e.range[3]=a.colSpan-1+p)))}},e.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)},e.prototype.addEventListener=function(){this.parent.on(_n,this.merge,this),this.parent.on(jn,this.mergedRange,this),this.parent.on(qn,this.activeCellRange,this),this.parent.on(Wn,this.insertHandler,this)},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(_n,this.merge),this.parent.off(jn,this.mergedRange),this.parent.off(qn,this.activeCellRange),this.parent.off(Wn,this.insertHandler))},e.prototype.getModuleName=function(){return"workbookmerge"},e}(),Sa=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.addEventListener=function(){this.parent.on(Yn,this.setCFRule,this),this.parent.on(Kn,this.clearCFRule,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(Yn,this.setCFRule),this.parent.off(Kn,this.clearCFRule))},e.prototype.setCFRule=function(e){var t=e.cfModel,r=void 0===e.sheetIdx?S(this.parent,t.range):e.sheetIdx,n=Ce(this.parent,r);t.range=t.range||n.selectedRange;var i=w(c(t.range));if(t.range=m(i),e.isAction){var a={range:t.range,type:t.type,cancel:!1,cFColor:t.cFColor,value:t.value,sheetIdx:r};if(this.parent.notify(Ar,{eventArgs:a,action:"conditionalFormat"}),a.cancel)return;t.type=a.type,t.cFColor=a.cFColor,t.value=a.value,a.range!==t.range&&(t.range=a.range,i=w(c(a.range))),delete a.cancel}n.conditionalFormats||this.parent.setSheetPropertyOnMute(n,"conditionalFormats",[]),n.conditionalFormats.push(t),r!==this.parent.activeSheetIndex?e.isUndoRedo&&!e.isFromUpdateAction&&this.parent.notify(kn,{address:n.name+"!"+t.range}):this.parent.notify(Xn,{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"})},e.prototype.clearCFRule=function(e){void 0===e.sheetIdx&&(e.sheetIdx=this.parent.activeSheetIndex);var t=Ce(this.parent,e.sheetIdx),r=t.conditionalFormats;if(e.isUndo){if(e.updatedCFModel){var n;e.updatedCFModel.forEach(function(e){(n=r.indexOf(e))>-1&&r.splice(n,1)})}return r.splice.apply(r,[r.length,0].concat(e.oldCFModel)),this.parent.notify(Xn,{cfModel:e.oldCFModel,isAction:!0}),void(e.sheetIdx!==this.parent.activeSheetIndex&&this.parent.notify(kn,{address:t.name+"!"+e.range}))}if(r&&r.length){var i,a,o,s,l,h,d,p,u,f=e.range&&("string"==typeof e.range?c(e.range):e.range);e.oldCFModel=[],e.updatedCFModel=[];for(var g=[],v=[],y=[],C=0;C<r.length;C++){a=(i=r[C]).range.split(",");for(var b=0;b<a.length;b++){if(o=c(a[b]),e.range)if(f[0]<=o[0]&&f[1]<=o[1]&&f[2]>=o[2]&&f[3]>=o[3])a.splice(b,1),b--;else{if(d=f[0]>=o[0]&&f[0]<=o[2],p=f[2]>=o[0]&&f[2]<=o[2],l=f[1]>=o[1]&&f[1]<=o[3],h=f[3]>=o[1]&&f[3]<=o[3],s=[],d&&p?((l||h||f[1]<o[1]&&f[3]>o[3])&&(f[0]-o[0]>0&&s.push(m([o[0],o[1],f[0]-1,o[3]])),o[2]-f[2]>0&&s.push(m([f[2]+1,o[1],o[2],o[3]]))),l&&f[1]!==o[1]&&s.push(m([f[0],o[1],f[2],f[1]-1])),h&&f[3]!==o[3]&&s.push(m([f[0],f[3]+1,f[2],o[3]]))):l&&h?((d||p||f[0]<o[0]&&f[2]>o[2])&&(f[1]-o[1]>0&&s.push(m([o[0],o[1],o[2],f[1]-1])),o[3]-f[3]>0&&s.push(m([o[0],f[3]+1,o[2],o[3]]))),d?f[0]!==o[0]&&s.push(m([o[0],f[1],f[0]-1,f[3]])):p&&f[2]!==o[2]&&s.push(m([f[2]+1,f[1],o[2],f[3]]))):(d||p)&&(l?(f[1]!==o[1]&&s.push(m([o[0],o[1],o[2],f[1]-1])),f[0]-o[0]>0?s.push(m([o[0],f[1],f[0]-1,o[3]])):o[2]-f[2]>0&&s.push(m([f[2]+1,f[1],o[2],o[3]]))):h&&(f[3]!==o[3]&&s.push(m([o[0],f[3]+1,o[2],o[3]])),f[0]-o[0]>0?s.push(m([o[0],o[1],f[0]-1,f[3]])):o[2]-f[2]>0&&s.push(m([f[2]+1,o[1],o[2],f[3]])))),!s.length)continue;a[b]=s.join(",")}else f=o,a.splice(b,1),b--;e.sheetIdx===this.parent.activeSheetIndex&&this.parent.notify(Zn,{indexes:f})}if((u=a.join(","))!==i.range){if(e.cfModel&&(e.cfModel.cFColor!==i.cFColor||e.cfModel.type!==i.type||e.cfModel.value!==i.value)){y.push(i);continue}v.push(i.range),u?(e.oldCFModel.push({type:i.type,cFColor:i.cFColor,format:i.format,range:i.range,value:i.value}),i.range=u,i.result&&(delete i.result,this.parent.notify(Xn,{cfModel:[i],isAction:!0})),e.updatedCFModel.push(i),g.push(i)):(e.oldCFModel.push(i),g.concat(r.splice(C,1)),C--)}}if(e.sheetIdx!==this.parent.activeSheetIndex?e.isUndoRedo&&!e.isFromUpdateAction&&this.parent.notify(kn,{address:t.name+"!"+e.range}):y.length&&this.parent.notify(Xn,{cfModel:y,isAction:!0}),(e.isAction||e.isClear)&&e.oldCFModel.length){var x={cFormats:g,oldRange:v,previousConditionalFormats:e.oldCFModel,sheetIdx:e.sheetIdx,selectedRange:e.range};e.updatedCFModel.length&&(x.conditionalFormats=e.updatedCFModel),e.isClear?e.cfClearActionArgs=x:this.parent.notify("actionComplete",{eventArgs:x,action:"clearCF"})}}},e.prototype.getModuleName=function(){return"workbookConditionalFormatting"},e}(),wa=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.getFillInfo=function(e){for(var r=this.parent.serviceLocator.getService(Ti),n="",i=!0,a="CopyCells",o=[],s=["Down","Up"].indexOf(e.direction)>-1,l=this.getRangeData({range:e.dataRange,sheetIdx:this.parent.activeSheetIndex}),h=l.join().replace(/,/g,"").length,d=this.isRange(e.dataRange)&&h?l.length:1;d--;)if(n=l[d]&&!t.isNullOrUndefined(l[d].value)?l[d].value:"",D(n)||B(n)||D(n[n.length-1])){i=!1,a=this.parent.autoFillSettings.fillType;break}return h&&!i||(o.push(r.getConstant("FillSeries")),a="FillSeries"===e.fillType?a:e.fillType),(!s||s&&e.dataRange[1]!==e.dataRange[3])&&o.push("Flash Fill"),{fillType:a,disableItems:o}},e.prototype.isRange=function(e){return e&&(e[0]!==e[2]||e[1]!==e[3])},e.prototype.autoFill=function(e){if(e.dataRange&&e.fillRange&&e.direction&&this.parent.allowEditing&&(!this.parent.getActiveSheet().isProtected||!e.isLockedCell)){var t=w(c(e.dataRange)),r=w(c(e.fillRange)),n={dataRange:t,fillRange:r,direction:e.direction,fillType:e.fillType||this.fillInfo.fillType,sheetIndex:S(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.fillType:this.fillInfo.fillType,e.fillType){case"FillSeries":case"FillWithoutFormatting":this.fillSeries(n);break;case"CopyCells":case"FillFormattingOnly":this.copyCells(n)}}},e.prototype.fillSeries=function(e){for(var r,n,i,a,o,s,l,h,d,p,c,u,f,g,m,y,C,b,x,S,w,I,E,R,k,F,A={},T=0,L=t.isUndefined(e.sheetIndex)?this.parent.activeSheetIndex:e.sheetIndex,P=Ce(this.parent,L),M=e.dataRange[0],H=e.dataRange[1],U=e.dataRange[2],V=e.dataRange[3],_=e.fillRange[0],z=e.fillRange[1],j=e.fillRange[2],q=e.fillRange[3],W=["Down","Up"].indexOf(e.direction)>-1,G=["Up","Left"].indexOf(e.direction)>-1,Y=W?V-H:U-M,X="FillSeries"===e.fillType,K=P.conditionalFormats&&P.conditionalFormats.length&&[].slice.call(P.conditionalFormats),$=[];T<=Y;){if(o=this.updateFillValues(W,M,H,U,V,_,z,j,q,T),s=o.patternRange,l=o.fillRange,i=this.getPattern(s,{isReverseFill:G,isVFill:W}),h=this.getRangeData({range:s,sheetIdx:L}),u=h.length,!i||!i.length)return;for(n=i.length,S=(x=this.getSelectedRange(P,{rowIndex:l[0],colIndex:l[1]},{rowIndex:l[2],colIndex:l[3]})).length,G&&(x=x.reverse(),i=i.reverse(),i=this.ensurePattern(i),h=h.reverse()),f=0;f<S;){switch(w=x[f],a=i[f%n],D(a)&&(a=i[a]),m=f%u,a.type){case"number":case"date":if((a=a).isStartWithMonth&&1===u?(E=N(a.regVal.a),R=new Date(E),E.setMonth(E.getMonth()+a.regVal.b*a.i),R.getDate()>28&&R.getDate()!==E.getDate()&&(R.setDate(1),R.setMonth(R.getMonth()+a.regVal.b*a.i),R.setDate(new Date(R.getFullYear(),R.getMonth()+1,0).getDate()),E=R),r=O(E).toString()):(r=this.round(a.regVal.a+a.regVal.b*a.i,5).toString(),a.val&&(p="string"==typeof a.val[0]&&a.val[0].match(/^0+/))&&(d=this.getNextFormattedValue(a.val[0],Number(r)))),a.dataVal){if(void 0===a.copy&&!p&&(a.copy=a.val.length>2,a.copy))for(var Z=2;Z<a.val.length&&(a.copy=Math.abs(this.round(a.regVal.a+a.regVal.b*Z,5))!==a.val[Z],!a.copy);Z++);r=a.copy?h[m]&&!t.isNullOrUndefined(h[m].value)?h[m].value:"":a.start?Math.abs(Number(r))+a.dataVal:p?a.dataVal+d:a.dataVal+Math.abs(Number(r))}G?a.i--:a.i++;break;case"string":var Q=a.i%a.val.length;r=a.val[Q],a.i++;break;case"formula":for(b=!1,r="=",g=0,y=a.val.length;g<y;)"object"==typeof(c=a.val[g])?(b=!0,r+=(C=this.round(c.a+c.b*a.i,5))<1?"#REF!":W?c.c+(c.b?C:"$"+C):(c.b?v(C):c.c.substring(0,c.c.search(/\d/))+"$"+v(C))+c.c.trim()):r+=c,g++;b&&G?a.i--:a.i++;break;case"time":r=(a.regVal.a+a.regVal.b*a.i).toString(),G?a.i--:a.i++}I=Re(w.rowIndex,w.colIndex,P,!1,!0),X?Object.assign(A,h[m],null,!0):(A.style=I.style,A.format=I.format,A.wrap=I.wrap,A.rowSpan=I.rowSpan,A.colSpan=I.colSpan),A.value=r,B(r)&&(A.formula=r),k={cell:A,rowIdx:w.rowIndex,colIdx:w.colIndex,valChange:!0,uiRefresh:!0,pvtExtend:!0,skipFormatCheck:!0},J(this.parent,P,k),K&&!F&&((F=k.isFormulaDependent)||ne(K,$,w.rowIndex,w.colIndex)),A={},f++}T++}($.length||F)&&this.parent.notify(Xn,{cfModel:!F&&$,refreshAll:F,isAction:!0,isEdit:!0})},e.prototype.copyCells=function(e){for(var r,n,i,a,o,s,l,h,d,p,c,u,f,g=0,m={},v=e.dataRange[0],y=e.dataRange[1],C=e.dataRange[2],b=e.dataRange[3],x=e.fillRange[0],S=e.fillRange[1],w=e.fillRange[2],I=e.fillRange[3],E=["Down","Up"].indexOf(e.direction)>-1,R=["Up","Left"].indexOf(e.direction)>-1,k=E?b-y:C-v,F=t.isUndefined(e.sheetIndex)?this.parent.activeSheetIndex:e.sheetIndex,A=Ce(this.parent,F),N="FillFormattingOnly"===e.fillType,O=A.conditionalFormats&&A.conditionalFormats.length&&[].slice.call(A.conditionalFormats),T=[];g<=k;){for(i=(o=this.updateFillValues(E,v,y,C,b,x,S,w,I,g)).patternRange,a=o.fillRange,l=(s=this.getRangeData({range:i,sheetIdx:F})).length,d=(h=this.getSelectedRange(A,{rowIndex:a[0],colIndex:a[1]},{rowIndex:a[2],colIndex:a[3]})).length,r=0,R&&(h=h.reverse());r<d;)n=r%l,p=h[r],N&&(c=Re(p.rowIndex,p.colIndex,A)),Object.assign(m,s[n],null,!0),N&&(m.value=c.value,m.formula=c.formula),f={cell:m,rowIdx:p.rowIndex,colIdx:p.colIndex,valChange:!0,uiRefresh:!0,pvtExtend:!0},J(this.parent,A,f),O&&!u&&((u=f.isFormulaDependent)||ne(O,T,p.rowIndex,p.colIndex)),m={},r++;g++}(T.length||u)&&this.parent.notify(Xn,{cfModel:!u&&T,refreshAll:u,isAction:!0,isEdit:!0})},e.prototype.updateFillValues=function(e,t,r,n,i,a,o,s,l,h){var d,p,c,u;e?(d={rowIndex:t,colIndex:r+h},p={rowIndex:n,colIndex:r+h},c={rowIndex:a,colIndex:o+h},u={rowIndex:s,colIndex:o+h}):(d={rowIndex:t+h,colIndex:r},p={rowIndex:t+h,colIndex:i},c={rowIndex:a+h,colIndex:o},u={rowIndex:a+h,colIndex:l});return{patternRange:[d.rowIndex,d.colIndex,p.rowIndex,p.colIndex],fillRange:[c.rowIndex,c.colIndex,u.rowIndex,u.colIndex]}},e.prototype.getDataPattern=function(e){var r,n,i,a,o,s=0,l={val:null,type:null},h=[],d=this.getRangeData({range:e,sheetIdx:this.parent.activeSheetIndex}),p=d.length;if(p){for(var c=void 0,u=void 0,f=void 0,g=void 0,m=function(e){return!a&&e&&"-"===e[e.length-1]?e.slice(0,e.length-1):e};s<p;){if(o=!1,d[s])if(d[s].formula&&B(d[s].formula))r=d[s].formula,i="formula";else{r=t.isNullOrUndefined(d[s].value)?"":d[s].value;var v={};if(f=d[s].format,g=D(r),f&&Te(f,!0,v)){if(i=v.type,r&&!g){var y={value:r,updatedVal:r,cell:d[s]};this.parent.notify(Wr,y),y.isDate||y.isTime?d[s].value=r=y.updatedVal:i="string"}o="date"===i&&f.toLowerCase().startsWith("mmm")}else i=g?"number":"string"}else r="",i="string";if(u="","string"===i){if(a=!1,D(r[0])){c=0;do{c++}while(D(r[c]));" "===r[c]&&(a=!0,i="number",u=r.slice(c,r.length),r=Number(r.slice(0,c)))}if(r=r,!a&&D(r[r.length-1])){c=1;do{c++}while(D(r[r.length-c]));i="number",c-=1,u=r.slice(0,r.length-c),r=(n=r.slice(r.length-c,r.length)).match(/^0+/)?n:Number(n),l.dataVal&&l.dataVal!==u&&l.dataVal===m(u)&&(u=l.dataVal)}}0===s?(l={val:[r],type:i,isStartWithMonth:o},u&&(l.dataVal=u,l.start=a)):i!==l.type||l.dataVal&&m(l.dataVal)!==m(u)?(h.push(l),l={val:[r],type:i},u&&(l.dataVal=u,l.start=a)):l.val.push(r),s++}return h.push(l),h}return[{val:null,type:null}]},e.prototype.getPredictionValue=function(e,t){for(var r=0,n=0,i=0,a=0,o=0,s=0,l=0,h=e.length;r<h;)n+=r,i+=Number(e[r]),a+=r*Number(e[r]),o+=r*r,r++;return t?(s=(i*o-n*a)/(h*o-n*n),l=(h*a-n*i)/(h*o-n*n)):(s=this.round((i*o-n*a)/(h*o-n*n),5),l=this.round((h*a-n*i)/(h*o-n*n),5)),{a:s,b:l}},e.prototype.getPattern=function(e,t){var r,n,i,a,o,s,l=0,h=[],d=this.getDataPattern(e),p=d.length;if(d){for(;l<p;){switch((s=d[l]).type){case"number":case"date":if(n=h.length,o=s.val.length,a=t.isReverseFill?-1:o,1===o){var c=parseFloat(s.val[0])+1;"string"==typeof s.val[0]&&s.val[0].match(/^0+/)?s.val.push(this.getNextFormattedValue(s.val[0],c)):s.val.push(c)}for(i={regVal:this.getPredictionValue(s.dataVal?s.val.slice(0,2):s.val),type:s.type,i:a,isStartWithMonth:s.isStartWithMonth},s.dataVal&&(i.dataVal=s.dataVal,i.val=s.val,i.start=s.start),h.push(i),r=1;r<o;)h.push(n),r++;break;case"string":for(n=h.length,i={val:s.val,type:s.type,i:0},h.push(i),r=1,o=s.val.length;r<o;)h.push(n),r++;break;case"formula":if(o=s.val.length,s=this.getFormulaPattern(s.val,t),a=t.isReverseFill?-1:o,s.isInPattern)for(n=h.length,i={val:s.val,type:"formula",i:a},h.push(i),r=1;r<o;)h.push(n),r++;else for(r=0,a=t.isReverseFill?-1:1;r<o;)h.push({val:s.val[r],type:"formula",i:a}),r++;break;case"time":if(n=h.length,o=s.val.length,a=t.isReverseFill?-1:o,1===o){var u=N(s.val[0]),f=Number(s.val[0]),g=f>0&&f<1,m=O(new Date(u.getTime()+36e5),!0,g);s.val.push(m)}for(i={regVal:this.getPredictionValue(s.val,!0),type:s.type,i:a},h.push(i),r=1;r<o;)h.push(n),r++}l++}return h}return[{regVal:null}]},e.prototype.getNextFormattedValue=function(e,r){return(new t.Internationalization).formatNumber(Math.abs(r),{minimumIntegerDigits:e.length,useGrouping:!1})},e.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"},e.prototype.round=function(e,t){return Number(Math.round(parseFloat(e+"e"+t))+"e-"+t)||Number(e)},e.prototype.getRangeData=function(e){for(var t,r=[],n=this.parent.getActiveSheet(),i=e.range[0],a=e.range[1],o=e.range[2],s=e.range[3],l=a;i<=o;)if(je(n,i))i++;else{for(a=l;a<=s;)Qe(n,a)?a++:(t=Re(i,a,n),r.push(t),a++);i++}return r},e.prototype.getFormulaPattern=function(e,t){for(var r,n,i,a,o=[],s=0,l=e.length,h={};s<l;)h.formula=e[s],this.parent.notify(Fi,h),o.push(h.formulaArr),s++;var d=this.isInPattern(o,t.isVFill);if(d){for(s=(i=o[0]).length;s--;)n=i[s],(a=this.isCellReference(n))&&"absolute"!==a&&(i[s]=this.getCellRefPrediction(n,t,null,a));return{isInPattern:d,val:i}}for(s=0;s<l;){for(r=(i=o[s]).length;r--;)n=i[r],(a=this.isCellReference(n.trim()))&&"absolute"!==a&&(o[s][r]=this.getCellRefPrediction(n,t,l,a));s++}return{isInPattern:d,val:o}},e.prototype.generateColCount=function(e){for(var t=0,r=e.split("").reverse().join(""),n=r.length-1;n>=0;n--)t+=(e[n].charCodeAt(parseInt(r[n],10))-64)*Math.pow(26,n);return t},e.prototype.getCellRefPrediction=function(e,t,r,n){e=e.toUpperCase();var i=new RegExp("[a-z$]","gi"),a=new RegExp("[0-9$]","g"),o=t.isVFill?e.replace(a,""):e.replace(i,""),s=t.isVFill?Number(e.replace(i,"")):this.generateColCount(e.replace(a,"").trim()),l=null,h=[s],d="$"===e[0];if(!d&&e.includes("$")&&"$"===e.trim()[0])for(var p=1;p<e.length;p++)if("$"===e[p]){l=p,d=!0;break}return r&&1!==r?h.push(s+r):h.push(s+1),s=this.getPredictionValue(h),n&&"mixed"===n&&(d===t.isVFill?o=l?o.substring(0,l)+"$"+o.substring(l):"$"+o:s.b=0),s.c=o,s},e.prototype.isInPattern=function(e,t){var r,n,i,a,o,s,l,h,d=0,p=1,c=e.length,u=new RegExp("[0-9$]","g"),f=new RegExp("[a-z$]","gi");if(1===c)return!1;for(;p<c;){if(r=e[d],i=e[p],n=r.length,a=i.length,n!==a)return!1;for(;n--;)if(o=r[n],s=i[n],this.isCellReference(o)===this.isCellReference(s)){if(t?(l=Number(o.replace(f,"")),h=Number(s.replace(f,""))):(l=this.generateColCount(o.replace(u,"")),h=this.generateColCount(s.replace(u,""))),l!==h-1)return!1}else if(o!==s)return!1;d++,p++}return!0},e.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},e.prototype.getSelectedRange=function(e,t,r){var n,i,a,o=[],s=w([t.rowIndex,t.colIndex,r.rowIndex,r.colIndex]);n=s[0];for(var l=s[2];n<=l;)if(qe(e,n))n++;else{for(i=s[1],a=s[3];i<=a;)o.push({rowIndex:n,colIndex:i}),i++;n++}return o},e.prototype.getFillType=function(e){return e.fillType=this.fillInfo.fillType,e.disableItems=this.fillInfo.disableItems,e},e.prototype.addEventListener=function(){this.parent.on(ui,this.autoFill,this),this.parent.on(gi,this.getFillType,this)},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(ui,this.autoFill),this.parent.off(gi,this.getFillType))},e.prototype.getModuleName=function(){return"workbookautofill"},e}(),Ia=function(){function e(){this.services={}}return e.prototype.getService=function(e){if(t.isNullOrUndefined(this.services[""+e]))throw"The service "+e+" is not registered";return this.services[""+e]},e.prototype.register=function(e,r){t.isNullOrUndefined(this.services[""+e])&&(this.services[""+e]=r)},e}(),Ea="ribbon",Ra="formulaBar",ka="sheetTabs",Fa="refreshSheetTabs",Aa="isFormulaBarEdit",Na="contentLoaded",Oa="mouseDown",Ta="spreadsheetDestroyed",Da="editOperation",La="formulaOperation",Pa="formulaBarOperation",Ma="click",Ha="keyUp",Ba="keyDown",Ua="verticalScroll",Va="horizontalScroll",_a="beforeContentLoaded",za="beforeVirtualContentLoaded",ja="virtualContentLoaded",qa="cellNavigate",Wa="mouseUpAfterSelection",Ga="contextmenuBeforeOpen",Ya="insertSheetTab",Xa="removeSheetTab",Ka="renameSheetTab",$a="ribboClick",Za="enableToolbarItems",Qa="tabSwitch",Ja="selectRange",eo="rangeSelectionByKeydown",to="cut",ro="copy",no="paste",io="clearCopy",ao="addContextMenuItems",oo="removeContextMenuItems",so="enableContextMenuItems",lo="enableFileMenuItems",ho="hideFileMenuItems",po="addFileMenuItems",co="hideRibbonTabs",uo="enableRibbonTabs",fo="addRibbonTabs",go="addToolbarItems",mo="hideToolbarItems",vo="beforeRibbonCreate",yo="rowHeightChanged",Co="colWidthChanged",bo="onContentScroll",xo="deInitProperties",So="activeSheetChanged",wo="initiateCustomSort",Io="applySort",Eo="autoFitRowsColumns",Ro="updateToggleItem",ko="initiateHyperlink",Fo="editHyperlink",Ao="openHyperlink",No="removeHyperlink",Oo="createHyperlinkElement",To="sheetNameUpdate",Do="hideSheet",Lo="performUndoRedo",Po="updateUndoRedoCollection",Mo="setActionData",Ho="getBeforeActionData",Bo="clearUndoRedoCollection",Uo="initiateFilterUI",Vo="renderFilterCell",_o="refreshFilterRange",zo="updateSortCollection",jo="reapplyFilter",qo="filterByCellValue",Wo="clearFilter",Go="getFilteredColumn",Yo="actionComplete",Xo="filterCellKeyDown",Ko="getFilterRange",$o="setAutoFit",Zo="refreshFormulaDatasource",Qo="setScrollEvent",Jo="initiatedatavalidation",es="invalidData",ts="protectSheet",rs="applyProtect",ns="protectCellFormat",is="renderGotoDlgt",as="renderFindDlg",os="findHandler",ss="editAlert",ls="setUndoRedo",hs="enableFormulaInput",ds="protectSelection",ps="hiddenMerge",cs="checkPrevMerge",us="checkMerge",fs="removeDataValidation",gs="showAggregate",ms="goToSheet",vs="showSheet",ys="renderCFDlg",Cs="clearViewer",bs="initiateFormulaReference",xs="initiateCur",Ss="clearCellRef",ws="editValue",Is="addressHandle",Es="initiateEdit",Rs="forRefSelRender",ks="insertImage",Fs="refreshOverlayElem",As="refreshImgCellObj",Ns="getRowIdxFromClientY",Os="getColIdxFromClientX",Ts="createImageElement",Ds="deleteImage",Ls="deleteChart",Ps="refreshChartCellObj",Ms="refreshChartCellModel",Hs="refreshImagePosition",Bs="updateTableWidth",Us="focusBorder",Vs="clearChartBorder",_s="insertChart",zs="chartRangeSelection",js="insertDesignChart",qs="removeDesignChart",Ws="chartDesignTab",Gs="addChartEle",Ys="undoRedoForChartDesign",Xs="protectWorkbook",Ks="unProtectWorkbook",$s="getPassWord",Zs="setProtectWorkbook",Qs="removeWorkbookProtection",Js="importProtectWorkbook",el="selectionStatus",tl="freeze",rl="overlayEleSize",nl="updateScroll",il="positionAutoFillElement",al="hideAutoFillOptions",ol="performAutoFill",sl="selectAutoFillRange",ll="hideAutoFillElement",hl="unProtectSheetPassword",dl="updateTranslate",pl="getUpdatedScrollPosition",cl="updateScrollValue",ul="beforeCheckboxfilterRenderer",fl="refreshCheckbox",gl="renderInsertDlg",ml="toggleProtect",vl=function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),yl=function(){return(yl=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e}).apply(this,arguments)},Cl=function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},bl=function(e){function r(t){var r=e.call(this,t)||this;return r.isEdit=!1,r.sheetNameCount=1,r.dataValidationRange="",r.isOpen=!1,r.chartColl=[],r.customFormulaCollection=new Map,n.Inject(ji,Xi,qi,sa,ca,ua,oa,la,fa,ha,ga,Ca,va,ba,xa,Sa,da,pa,wa),r.commonCellStyle={},t&&t.cellStyle&&(r.commonCellStyle=t.cellStyle),"workbook"===r.getModuleName()&&(r.serviceLocator=new Ia,r.initWorkbookServices(),r.dataBind(),r.initEmptySheet()),r}vl(r,e),n=r,r.prototype.preRender=function(){Object.keys(this.commonCellStyle).length||(this.commonCellStyle=Fe(this.cellStyle,!0)),"spreadsheet"!==this.getModuleName()||this.refreshing||this.initEmptySheet()},r.prototype.initWorkbookServices=function(){this.serviceLocator.register(Ti,new t.L10n(this.getModuleName(),Di,this.locale))},r.prototype.render=function(){},r.prototype.requiredModules=function(){return k(this)},r.prototype.getPersistData=function(){return this.addOnPersist([])},r.prototype.cellFormat=function(e,t){var r=this.getActiveSheet();t=t||r.selectedRange,this.notify(Br,{style:e,range:t,refreshRibbon:t.indexOf(r.activeCell)>-1})},r.prototype.lockCells=function(e,t){var r=this.getActiveSheet();e=e||r.selectedRange,this.notify(Vn,{range:e,isLocked:t,triggerEvent:!0})},r.prototype.getCellStyleValue=function(e,t){var r=this,n=Re(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},r.prototype.numberFormat=function(e,t){this.notify(Pr,{format:e,range:t}),this.notify(Ri,{format:e})},r.prototype.createSheet=function(e,t){void 0===e&&(e=this.sheets.length),void 0===t&&(t=[{}]);var r;(r=this.sheets).splice.apply(r,[e,0].concat(t)),Se(this,t),this.notify(Qr,{sheetIndex:e||0,sheets:t}),this.notify(jr,{action:"registerSheet",sheetIndex:e||0,sheetCount:e+t.length})},r.prototype.removeSheet=function(e){this.sheets.splice(e,1)},r.prototype.destroy=function(){this.notify(Sr,null),e.prototype.destroy.call(this)},r.prototype.onPropertyChanged=function(e,r){for(var n=0,i=Object.keys(e);n<i.length;n++){switch(i[n]){case"cellStyle":t.merge(this.commonCellStyle,e.cellStyle);break;case"sheets":e.sheets===this.sheets?(this.notify(jr,{action:"unRegisterSheet",propertyChange:!0}),this.sheetNameCount=1,this.notify(Jr,{}),Se(this),this.notify(Qr,null),this.notify(jr,{action:"registerSheet"})):Se(this);break;case"listSeparator":this.notify(jr,{action:"setArgumentSeparator"})}}},r.prototype.appendTo=function(t){e.prototype.appendTo.call(this,t)},r.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++)ze(n,i,{hidden:r})},r.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++)Ke(n,i,{hidden:r})},r.prototype.setBorder=function(e,t,r,n){this.notify(Br,{style:e,borderType:r,range:t||this.getActiveSheet().selectedRange,isUndoRedo:n})},r.prototype.insertRow=function(e,t,r){this.notify(Sn,{model:this.getSheetModel(r),start:e,end:t,modelType:"Row",insertType:"below"})},r.prototype.insertColumn=function(e,t,r){this.notify(Sn,{model:this.getSheetModel(r),start:e,end:t,modelType:"Column",insertType:"after"})},r.prototype.insertSheet=function(e,t){this.notify(Sn,{model:this,start:e,end:t,modelType:"Sheet"})},r.prototype.delete=function(e,r,n,i){e=e||0;var a;if(n&&"Sheet"!==n){if(!(a=this.getSheetModel(i)))return}else a=this;this.notify(wn,{model:a,start:e,end:t.isNullOrUndefined(r)?e:r,modelType:n||"Sheet"})},r.prototype.moveSheet=function(e,t){Ie(this,e,t)},r.prototype.duplicateSheet=function(e){Ee(this,e)},r.prototype.getSheetModel=function(e){if(t.isNullOrUndefined(e))return this.getActiveSheet();var r="string"==typeof e?ce(this,e):e;return t.isNullOrUndefined(r)||r>=this.sheets.length?null:this.sheets[r]},r.prototype.merge=function(e,t){var r,n;e?n=Ce(this,r=S(this,e)):e=(n=this.getActiveSheet()).selectedRange,this.notify(_n,{merge:!0,range:e,type:t||"All",sheetIndex:r,refreshRibbon:e.indexOf(n.activeCell)>-1,preventRefresh:this.activeSheetIndex!==r})},r.prototype.unMerge=function(e){var t,r;e?r=Ce(this,t=S(this,e)):e=(r=this.getActiveSheet()).selectedRange,this.notify(_n,{merge:!1,range:e,sheetIndex:t,type:"All",refreshRibbon:e.indexOf(r.activeCell)>-1,preventRefresh:this.activeSheetIndex!==t})},r.prototype.computeExpression=function(e){var t={action:"computeExpression",formula:e,isFromComputeExpression:!0};return this.notify(jr,t),t.calcValue},r.prototype.initEmptySheet=function(){this.sheets.length?Se(this):this.createSheet()},r.prototype.getActiveSheet=function(){return this.sheets[this.activeSheetIndex]},r.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},r.prototype.setUsedRange=function(e,t,r,n,i){if(void 0===r&&(r=this.getActiveSheet()),i)return r.usedRange.rowIndex=e,void(r.usedRange.colIndex=t);e>r.usedRange.rowIndex&&(r.usedRange.rowIndex=e,r!==this.getActiveSheet()||n||this.notify(zr,{index:e,update:"row"})),t>r.usedRange.colIndex&&(r.usedRange.colIndex=t,r!==this.getActiveSheet()||n||this.notify(zr,{index:t,update:"col"}))},r.prototype.getData=function(e){return he(this,e)},r.prototype.getModuleName=function(){return"workbook"},r.prototype.goTo=function(e){},r.prototype.getValueRowCol=function(e,r,n,i,a,o,s){var l={action:"getSheetInfo",sheetInfo:[]};if(this.notify(jr,l),-1===ge(0,"Sheet"+e,l.sheetInfo)){var h={action:"getReferenceError",refError:""};return this.notify(jr,h),h.refError}var d=ue(this,e),p=Ce(this,d),c=Re(r-1,n-1,p);if(i&&i.includes("!")&&!c&&p.ranges&&p.ranges.length){var u;if(this.formulaRefCell&&this.formulaRefCell===i)return c&&c.value;if(p.ranges.forEach(function(e){e.info&&e.info.loadedRange&&e.info.loadedRange.length||(u=!0)}),u){if(this.formulaRefCell=i,d=ue(this,Number(i.substring(i.lastIndexOf(",")+1,i.length))),t.isNullOrUndefined(d))return c&&c.value;i=i.substring(i.lastIndexOf("!")+1,i.lastIndexOf(",")),he(this,p.name+"!A1:"+g(r-1,n-1),null,null,null,null,i,d)}}else c&&c.formula&&(a||t.isNullOrUndefined(c.value))&&!o&&this.notify("calculateFormula",{cell:c,rowIdx:r-1,colIdx:n-1,sheetIndex:d,formulaRefresh:!0});if(c&&!D(c.value)&&!this.isEdit){var f={formattedText:c.value,value:c.value,format:c.format,cell:c,skipFormatCheck:!1};this.notify(Mr,f),c=f.cell}return s&&c&&c.formula&&c.formula.includes("SUBTOTAL(")?c.formula:c&&c.value},r.prototype.setValueRowCol=function(e,t,r,n,i,a){this.notify(qr,{action:"updateCellValue",address:[r-1,n-1],value:t,sheetIndex:ue(this,e),isValueOnly:!0,formula:i,isRandomFormula:a})},r.prototype.open=function(e){this.notify(kr,e)},r.prototype.openFromJson=function(e){this.isOpen=!0;var t="object"==typeof e.file?JSON.stringify(e.file):e.file;this.notify(kr,{jsonObject:t,triggerEvent:e.triggerEvent})},r.prototype.save=function(e){if(void 0===e&&(e={}),this.allowSave){var t={url:this.saveUrl,fileName:e.fileName||"Sample",saveType:"Xlsx"},r=yl({},t,e,{customParams:{},isFullPost:!0,needBlobData:!1,cancel:!1,autoDetectFormat:!1,pdfLayoutSettings:{fitSheetOnOnePage:!1,orientation:"Portrait"}});this.trigger("beforeSave",r),this.notify(Ar,{eventArgs:r,action:"beforeSave"}),r.cancel||this.notify(Fr,{saveSettings:r,isFullPost:r.isFullPost,needBlobData:r.needBlobData,customParams:r.customParams,pdfLayoutSettings:r.pdfLayoutSettings})}},r.prototype.saveAsJson=function(){var e=this;return new Promise(function(t){e.on(Cn,function(r){r.cancel=!0,e.off(Cn),t({jsonObject:{Workbook:r.jsonObject}}),e.notify(Lr,r)}),e.save()})},r.prototype.addHyperlink=function(e,t){var r={hyperlink:e,cell:t};this.notify(gn,r)},r.prototype.findHandler=function(e){this.notify("find",e)},r.prototype.replaceHandler=function(e){"replace"===e.replaceBy?this.notify(Fn,e):this.notify(An,e)},r.prototype.protectSheet=function(e,r,n){t.isNullOrUndefined(e)?e=this.activeSheetIndex:"string"==typeof e&&(e=ce(this,e));var i=this.sheets[e];i&&(this.setSheetPropertyOnMute(i,"isProtected",!0),this.setSheetPropertyOnMute(i,"password",n||""),this.setSheetPropertyOnMute(i,"protectSettings",r||{}),this.notify(Hn,{protectSettings:i.protectSettings,password:i.password,sheetIndex:e}))},r.prototype.unprotectSheet=function(e){if(t.isNullOrUndefined(e)?e=this.activeSheetIndex:"string"==typeof e&&(e=ce(this,e)),this.sheets[e]){var r={sheet:e};this.notify(Un,r)}},r.prototype.sort=function(e,t,r){if(!this.allowSorting)return Promise.reject();var n={args:{range:t||this.getActiveSheet().selectedRange,sortOptions:e||{sortDescriptors:{}},cancel:!1},promise:new Promise(function(e,t){e(void 0)}),previousSort:r};return this.notify(ln,n),n.promise},r.prototype.addDataValidation=function(e,t){"List"===e.type&&e.value1.length>256&&(e.value1=e.value1.substring(0,255)),this.notify(En,{rules:e,range:t||this.getActiveSheet().selectedRange})},r.prototype.removeDataValidation=function(e){this.notify(En,{range:e,isRemoveValidation:!0})},r.prototype.addInvalidHighlight=function(e){this.notify(Rn,{range:e})},r.prototype.removeInvalidHighlight=function(e){this.notify(Tn,{range:e})},r.prototype.isValidCell=function(e){var t=u(e),r=Re(t[0],t[1],this.getActiveSheet());if(r&&r.validation){var n={value:r.value?r.value:"",range:t,sheetIdx:this.activeSheetIndex,isCell:!1,td:null,isValid:!0};return this.notify(In,n),n.isValid}return!0},r.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(Yn,{cfModel:e})},r.prototype.clearConditionalFormat=function(e){var t={};if(e&&e.includes("!")){var r=e.split("!");t.range=r[1],t.sheetIdx=ce(this,r[0])}else t.range=e||this.getActiveSheet().selectedRange,t.sheetIdx=this.activeSheetIndex;this.notify(Kn,t)},r.prototype.updateCell=function(e,r){var n,i;if(r||(r=this.getActiveSheet().activeCell),r.includes("!")){if(n=y(r),void 0===(i=ce(this,r.split("!")[0])))return}else n=c(r),i=this.activeSheetIndex;var a=Ce(this,i);J(this,a,{cell:e,rowIdx:n[0],colIdx:n[1],preventEvt:!0});var o=t.isNullOrUndefined(e.value)?e.formula||null:e.value;if(null!==o&&this.notify(qr,{action:"updateCellValue",address:n,value:o,sheetIndex:i}),i===this.activeSheetIndex){var s=void 0,l=Re(n[0],n[1],a,!1,!0),h={sheet:a,cell:l,rowIdx:n[0],colIdx:n[1]};(l.rowSpan>1||l.colSpan>1)&&(se(h),s=this.getCell(h.rowIdx,h.colIdx)),this.serviceLocator.getService("cell").refresh(n[0],n[1],!0,s,null!==o),this.notify(Kr,null),j(c(a.activeCell),h.rowIdx,h.colIdx)&&this.notify(Pa,{action:"refreshFormulabar",value:this.getDisplayText(e)||e.formula})}},r.prototype.getRowData=function(e,r){t.isNullOrUndefined(e)&&(e=0),t.isNullOrUndefined(r)&&(r=this.activeSheetIndex);var n={sheetIdx:r,startIndex:e,modelType:"Row",isDataRequest:!0};return this.notify(Er,n),n.data},r.prototype.updateRange=function(e,r){var n=Ce(this,r=r?r-1:this.activeSheetIndex),i=n.ranges;t.isNullOrUndefined(n)||(i.push(e),n.ranges=i)},r.prototype.wrap=function(e,t){void 0===t&&(t=!0),Ae(e,t,this)},r.prototype.addDefinedName=function(e){var t={action:"addDefinedName",isAdded:!1,definedName:e};return this.notify(jr,t),t.isAdded},r.prototype.removeDefinedName=function(e,t){void 0===t&&(t="");var r={action:"removeDefinedName",isRemoved:!1,definedName:e,scope:t};return this.notify(jr,r),r.isRemoved},r.prototype.clearRange=function(e,t,r){},r.prototype.insertImage=function(e,t){this.notify(Qn,{options:e,range:t||this.getActiveSheet().selectedRange})},r.prototype.autoFill=function(e,t,r,n){var i={dataRange:t||this.getActiveSheet().selectedRange,fillRange:e,direction:r||"Down",fillType:n||"FillSeries"};this.notify(ui,i)},r.prototype.insertChart=function(e){this.notify(Jn,{chart:e})},r.prototype.deleteChart=function(e){this.notify(Ls,{id:e})},r.prototype.filter=function(e,t){if(!this.allowFiltering)return Promise.reject();var r={args:{range:t||this.getActiveSheet().selectedRange,filterOptions:e,cancel:!1},promise:new Promise(function(e,t){e(void 0)})};return this.notify(mn,r),r.promise},r.prototype.addCustomFunction=function(e,t,r){var n={action:"addCustomFunction",functionHandler:e,functionName:t=t||("string"==typeof e?e:e.name.replace("bound ","")),formulaDescription:r};this.notify(jr,n)},r.prototype.clear=function(e){this.notify($n,e)},r.prototype.getDisplayText=function(e){if(!e)return"";if(e.format&&!t.isNullOrUndefined(e.value)){var r={formattedText:e.value,value:e.value,format:e.format,cell:e,skipFormatCheck:!0};return this.notify(Mr,r),r.formattedText}return!e.value&&e.hyperlink?"string"==typeof e.hyperlink?e.hyperlink:e.hyperlink.address:e.value||"number"==typeof e.value?e.value.toString():""},r.prototype.freezePanes=function(e,t,r){void 0===e&&(e=1),void 0===t&&(t=1);var n=this.getSheetModel(r);!this.allowFreezePane||n.frozenRows===e&&n.frozenColumns===t||(this.setSheetPropertyOnMute(n,"frozenRows",e),this.setSheetPropertyOnMute(n,"frozenColumns",t),this.updateTopLeftCell(),n.id===this.getActiveSheet().id&&"spreadsheet"===this.getModuleName()&&this.renderModule.refreshSheet())},r.prototype.Unfreeze=function(e){this.freezePanes(0,0,e)},r.prototype.unfreezePanes=function(e){this.freezePanes(0,0,e)},r.prototype.updateTopLeftCell=function(e,r,n,i){i||(i=this.getActiveSheet());var a=u(i.topLeftCell);i.frozenRows||i.frozenColumns?((t.isNullOrUndefined(e)||e<0)&&(e=i.frozenRows?0:a[0]),(t.isNullOrUndefined(r)||r<0)&&(r=i.frozenColumns?0:a[1]),e+=this.frozenRowCount(i),r+=this.frozenColCount(i),n&&("row"===n?e=u(i.paneTopLeftCell)[0]:r=u(i.paneTopLeftCell)[1]),this.setSheetPropertyOnMute(i,"paneTopLeftCell",g(e,r)),i.frozenRows&&(e=a[0]),i.frozenColumns&&(r=a[1])):(t.isNullOrUndefined(e)&&(e=a[0]),t.isNullOrUndefined(r)&&(r=a[1]),this.setSheetPropertyOnMute(i,"paneTopLeftCell",g(e,r))),this.setSheetPropertyOnMute(i,"topLeftCell",g(e,r))},r.prototype.getAddressInfo=function(e){return x(this,e)},r.prototype.setSheetPropertyOnMute=function(e,t,r){this.isProtectedOnChange=!0,e[""+t]=r,this.isProtectedOnChange=!1},r.prototype.frozenRowCount=function(e){return e.frozenRows?"A1"===e.topLeftCell?e.frozenRows:u(e.topLeftCell)[0]+e.frozenRows:0},r.prototype.frozenColCount=function(e){return e.frozenColumns?"A1"===e.topLeftCell?e.frozenColumns:u(e.topLeftCell)[1]+e.frozenColumns:0},r.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?((n=t[0]-e.startIndex)>0&&(t[0]>e.endIndex?(n=e.endIndex-e.startIndex+1)>0&&(t[0]-=n,i=!0):(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)):((n=t[1]-e.startIndex)>0&&(t[1]>e.endIndex?(n=e.endIndex-e.startIndex+1)>0&&(t[1]-=n,i=!0):(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},r.prototype.getCell=function(e,t,r){return null},r.prototype.dateToInt=function(e,t){return O(e,t)},r.prototype.setDateFormat=function(e,t,r){var n=Ce(this,ue(this,e)),i=Re(t,r,n,null,!0).format;i&&"General"!==i||ke(t,r,n,{format:Ue("ShortDate")},!0)};var n;return Cl([t.Collection([],Ui)],r.prototype,"sheets",void 0),Cl([t.Property(0)],r.prototype,"activeSheetIndex",void 0),Cl([t.Property("100%")],r.prototype,"height",void 0),Cl([t.Property(!0)],r.prototype,"allowFindAndReplace",void 0),Cl([t.Property()],r.prototype,"filterCollection",void 0),Cl([t.Property()],r.prototype,"sortCollection",void 0),Cl([t.Property("100%")],r.prototype,"width",void 0),Cl([t.Property(!0)],r.prototype,"showRibbon",void 0),Cl([t.Property(!0)],r.prototype,"showFormulaBar",void 0),Cl([t.Property(!0)],r.prototype,"showSheetTabs",void 0),Cl([t.Property(!0)],r.prototype,"allowEditing",void 0),Cl([t.Property(!0)],r.prototype,"allowOpen",void 0),Cl([t.Property(!0)],r.prototype,"allowSave",void 0),Cl([t.Property(!0)],r.prototype,"allowSorting",void 0),Cl([t.Property(!0)],r.prototype,"allowFiltering",void 0),Cl([t.Property(!0)],r.prototype,"allowNumberFormatting",void 0),Cl([t.Property(!0)],r.prototype,"allowCellFormatting",void 0),Cl([t.Property(!0)],r.prototype,"allowHyperlink",void 0),Cl([t.Property(!0)],r.prototype,"allowInsert",void 0),Cl([t.Property(!0)],r.prototype,"allowDelete",void 0),Cl([t.Property(!0)],r.prototype,"allowMerge",void 0),Cl([t.Property(!0)],r.prototype,"allowDataValidation",void 0),Cl([t.Property(!0)],r.prototype,"allowImage",void 0),Cl([t.Property(!0)],r.prototype,"allowChart",void 0),Cl([t.Property(!0)],r.prototype,"allowAutoFill",void 0),Cl([t.Complex({},xr)],r.prototype,"autoFillSettings",void 0),Cl([t.Property(!0)],r.prototype,"allowConditionalFormat",void 0),Cl([t.Complex({},nr)],r.prototype,"cellStyle",void 0),Cl([t.Property("")],r.prototype,"openUrl",void 0),Cl([t.Property("")],r.prototype,"saveUrl",void 0),Cl([t.Property("")],r.prototype,"password",void 0),Cl([t.Property(!1)],r.prototype,"isProtected",void 0),Cl([t.Collection([],or)],r.prototype,"definedNames",void 0),Cl([t.Event()],r.prototype,"beforeOpen",void 0),Cl([t.Event()],r.prototype,"openFailure",void 0),Cl([t.Event()],r.prototype,"beforeSave",void 0),Cl([t.Event()],r.prototype,"saveComplete",void 0),Cl([t.Event()],r.prototype,"beforeCellFormat",void 0),Cl([t.Event()],r.prototype,"queryCellInfo",void 0),Cl([t.Event()],r.prototype,"beforeCellUpdate",void 0),Cl([t.Property(!0)],r.prototype,"allowFreezePane",void 0),Cl([t.Property(",")],r.prototype,"listSeparator",void 0),r=n=Cl([t.NotifyPropertyChanges],r)}(t.Component),xl=function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Sl=function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},wl=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return xl(r,e),Sl([t.Collection([],zi)],r.prototype,"cells",void 0),Sl([t.Property(0)],r.prototype,"index",void 0),Sl([t.Property(20)],r.prototype,"height",void 0),Sl([t.Property(!1)],r.prototype,"customHeight",void 0),Sl([t.Property(!1)],r.prototype,"hidden",void 0),Sl([t.Complex({},dr)],r.prototype,"format",void 0),r}(t.ChildProperty),Il=function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),El=function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},Rl=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return Il(r,e),El([t.Property(0)],r.prototype,"index",void 0),El([t.Property(64)],r.prototype,"width",void 0),El([t.Property(!1)],r.prototype,"customWidth",void 0),El([t.Property(!1)],r.prototype,"hidden",void 0),El([t.Complex({},dr)],r.prototype,"format",void 0),El([t.Property(!0)],r.prototype,"isLocked",void 0),El([t.Property("")],r.prototype,"validation",void 0),r}(t.ChildProperty),kl="e-wraptext",Fl="spreadsheetLocale",Al="dialog",Nl={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"]},Ol={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"]},Tl={UP:38,DOWN:40,LEFT:37,RIGHT:39,FIRSTALPHABET:65,LASTALPHABET:90,SPACE:32,BACKSPACE:8,TAB:9,DELETE:46,ENTER:13,ESC:27},Dl={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",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",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.",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",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?"},Ll=null,Pl=1.24,Ml=["e-ribbon","e-formula-bar-panel","e-sheet-tab-panel","e-header-toolbar"],Hl={role:"role",selected:"aria-selected",multiselectable:"aria-multiselectable",busy:"aria-busy",colcount:"aria-colcount"},Bl=function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Ul=function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},Vl=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return Bl(r,e),Ul([t.Property(!1)],r.prototype,"isFinite",void 0),Ul([t.Property(!0)],r.prototype,"enableVirtualization",void 0),r}(t.ChildProperty),_l=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return Bl(r,e),Ul([t.Property("Multiple")],r.prototype,"mode",void 0),r}(t.ChildProperty),zl=function(){function e(e){this.colGroupWidth=30,this.parent=e,this.col=e.createElement("col"),this.rowRenderer=e.serviceLocator.getService("row"),this.cellRenderer=e.serviceLocator.getService("cell"),this.addEventListener()}return e.prototype.refreshSelectALLContent=function(){var e,t=this.parent.getActiveSheet();if(t.frozenColumns||t.frozenRows){var r=this.getSelectAllTable().querySelector("thead"),n=this.rowRenderer.render();r.appendChild(n),e=this.parent.createElement("th",{className:"e-select-all-cell"}),n.appendChild(e)}else(e=this.headerPanel.firstElementChild).classList.add("e-select-all-cell");e.appendChild(this.parent.createElement("button",{className:"e-selectall",id:this.parent.element.id+"_select_all",attrs:{"aria-label":this.parent.serviceLocator.getService(Fl).getConstant("SelectAll"),type:"button"}}))},e.prototype.updateLeftColGroup=function(e,t){e&&(this.colGroupWidth=e),t||(t=this.getRowHeaderPanel());var r,n=t.querySelector("table"),i=this.parent.getActiveSheet();if(e)n.querySelector("colgroup").firstElementChild.style.width=this.colGroupWidth+"px";else{r=this.parent.createElement("colgroup");var a=this.col.cloneNode();a.style.width=this.colGroupWidth+"px",r.appendChild(a),n.insertBefore(r,n.querySelector("tbody"))}(i.frozenRows||i.frozenColumns)&&(n=this.getSelectAllTable(),e?n.querySelector("colgroup").firstElementChild.style.width=this.colGroupWidth+"px":n.insertBefore(r.cloneNode(!0),n.querySelector("thead"))),this.setPanelWidth(i,t),this.setPanelHeight(i)},e.prototype.setPanelWidth=function(e,r,n){var i,a=this.getScrollSize(!0),o=this.getRowHeaderWidth(e),s=this.parent.enableRtl?"right":"left";if(n&&(i=this.parent.enableRtl?"left":"right",this.getContentPanel().style[""+i]=this.getColHeaderPanel().style[""+i]=""),e.frozenColumns){var l=document.getElementById(this.parent.element.id+"_sheet").getElementsByClassName("e-frozen-column")[0];l.style.height="calc(100% - "+a+"px)",n&&(l.style[""+i]=""),l.style[""+s]=o-kt(1)+"Px",l.style.display=""}this.setHeaderPanelWidth(this.getSelectAllContent(),o),this.getColHeaderPanel().style.width="calc(100% - "+o+"px)",this.getColHeaderPanel().style[""+s]=o+"px",this.setHeaderPanelWidth(r,o),this.getContentPanel().style.width="calc(100% - "+o+"px)",this.getContentPanel().style[""+s]=o+"px";var h=this.contentPanel.nextElementSibling?this.contentPanel.nextElementSibling:null;h&&(a?h.style.height=a+1+"px":(h.style.height="1px",h.style.borderTopWidth="0px"),h=h.firstElementChild,n&&(h.style[""+i]=""),h.style[""+s]=o+"px",h.style.width="calc(100% - "+o+"px)",t.Browser.userAgent.indexOf("Mac OS")>-1&&"safari"===t.Browser.info.name&&(h.style.height="7px",h.style.top="-7px"))},e.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},e.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"},e.prototype.setPanelHeight=function(e){var r=this.getScrollSize(!0);if(e.frozenRows){var n=this.getColHeaderHeight(e);e.showHeaders||e.frozenColumns?this.headerPanel.style.height="":this.headerPanel.style.height=n+"px",this.contentPanel.style.height="calc(100% - "+(n+r)+"px)";var i=document.getElementById(this.parent.element.id+"_sheet").getElementsByClassName("e-frozen-row")[0];i.style.width=t.Browser.isDevice?"100%":"calc(100% - "+r+"px)",i.style.top=n-1-(e.showHeaders?1:0)+"px",i.style.display=""}else this.contentPanel.style.height="calc(100% - "+((e.showHeaders?kt(31):0)+r)+"px)"},e.prototype.renderPanel=function(){this.contentPanel=this.parent.createElement("div",{className:"e-main-panel",attrs:{tabindex:"0"}});var e=this.parent.getActiveSheet(),r=this.parent.element.id;this.contentPanel.appendChild(this.parent.createElement("div",{className:"e-row-header",id:r+"_row_header"})),this.initHeaderPanel(),this.parent.allowScrolling&&this.parent.scrollModule.setPadding();var n=document.getElementById(this.parent.element.id+"_sheet");e.frozenColumns&&n.classList.add("e-frozen-columns"),e.frozenRows&&n.classList.add("e-frozen-rows"),this.updateHideHeaders(e,n),e.showGridLines||n.classList.add("e-hide-gridlines");var i=this.contentPanel.appendChild(this.parent.createElement("div",{className:"e-sheet-content",id:r+"_main_content"}));this.parent.allowScrolling||(i.style.overflow="hidden"),e.frozenRows&&n.appendChild(this.parent.createElement("div",{className:"e-frozen-row",styles:"display: none"})),e.frozenColumns&&n.appendChild(this.parent.createElement("div",{className:"e-frozen-column",styles:"display: none"})),t.Browser.userAgent.indexOf("Mac OS")>-1&&"safari"===t.Browser.info.name&&n.classList.add("e-mac-safari")},e.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"}))},e.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)},e.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))})},e.prototype.renderTable=function(e){var r,n,i,a=this,o=this.parent.getActiveSheet(),s=document.createDocumentFragment();if(s.appendChild(this.headerPanel),s.appendChild(this.contentPanel),this.parent.allowScrolling){var l=this.parent.createElement("div",{className:"e-scrollbar"});l.appendChild(this.parent.createElement("div",{className:"e-scroller"})),s.appendChild(l)}this.createHeaderTable(),this.updateTable(["tbody"],"content",this.contentPanel.lastElementChild);var h,d=this.parent.createElement("colgroup"),p=this.contentPanel.querySelector(".e-sheet-content tbody");this.refreshSelectALLContent();var u=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"),y=this.headerPanel.querySelector(".e-column-header thead"),C=this.headerPanel.querySelector(".e-column-header tbody"),b=this.rowRenderer.render();y.appendChild(b),this.getColHeaderTable().insertBefore(d,y);var x=this.parent.frozenRowCount(o),S=this.parent.frozenColCount(o),w=$(o,S-1,!1,"columns");this.parent.notify(_a,{top:e.top,left:e.left});var I=o.colCount.toString(),E=o.colCount.toString(),R=e.top&&e.left?"RowColumn":e.top?"Row":e.left?"Column":"";this.parent.getColHeaderTable().setAttribute("aria-colcount",I),this.parent.getRowHeaderTable().setAttribute("aria-rowcount",E);var k;t.attributes(this.parent.getContentTable(),{"aria-rowcount":E,"aria-colcount":I}),e.cells.forEach(function(t,s){if((r=c(s))[1]!==e.indexes[1]&&n||(r[1]===e.indexes[1]&&(i=a.rowRenderer.render(r[0],!0)),S&&x&&r[1]<S&&r[0]<x?((k=v.querySelector(".e-empty"))?v.insertBefore(i,k):v.appendChild(i),n=i):S&&r[1]<S?(m.appendChild(i),n=i):(n=a.rowRenderer.render(r[0]),x&&r[0]<x?(k=C.querySelector(".e-empty"))?C.insertBefore(n,k):C.appendChild(n):p.appendChild(n),r[1]===e.indexes[1]&&(x&&r[0]<x?v.appendChild(i):m.appendChild(i))),r[1]===e.indexes[1]&&a.cellRenderer.renderRowHeader(r[0],i)),a.cellRenderer.render({colIdx:r[1],rowIdx:r[0],cell:t,address:s,lastCell:r[1]===e.indexes[3],isHeightCheckNeeded:!0,row:n,hRow:i,pRow:n.previousSibling,pHRow:i.previousSibling,isRefreshing:e.isRefreshing,first:R?R.includes("Row")?r[0]===e.indexes[0]?"Row":R.includes("Column")&&r[1]===e.indexes[1]?"Column":"":r[1]===e.indexes[1]?"Column":"":""}),S&&r[1]===w&&(n=null),r[0]===e.indexes[0])if(S&&r[1]<S){h=a.updateCol(o,r[1],u);var l=f.querySelector(".e-empty");l?f.insertBefore(h.cloneNode(!0),l):f.appendChild(h.cloneNode(!0)),a.cellRenderer.renderColHeader(r[1],g)}else a.updateCol(o,r[1],d),a.cellRenderer.renderColHeader(r[1],b)}),this.parent.isReact&&this.parent.renderReactTemplates(),p.parentElement.insertBefore(d.cloneNode(!0),p),tt(function(){if(a.parent){var t=a.parent.getMainContent(),r=document.getElementById(a.parent.element.id+"_sheet");if(r.childElementCount&&r.querySelector(".e-header-panel")!==a.headerPanel)for(var n=r.children,i=0;i<n.length;i++)n[i].classList.contains("e-frozen-row")||n[i].classList.contains("e-frozen-column")||n[i].classList.contains("e-ss-overlay")||r.removeChild(n[i]);if(r.appendChild(s),r.style.backgroundColor="",o.conditionalFormats&&o.conditionalFormats.length&&a.parent.notify(Xn,{indexes:e.indexes}),a.checkRowHeightChanged(e,o),e.top&&(t.parentElement.scrollTop=e.top),e.left&&(t.scrollLeft=e.left,a.parent.getColumnHeaderContent().scrollLeft=e.left),a.parent.notify(Na,e),a.checkTableWidth(o),a.parent.notify(Da,{action:"renderEditor",initLoad:e.initLoad&&!a.parent.isOpen}),e.initLoad||a.parent.isOpen||a.parent.hideSpinner(),Ft(t,{busy:!1}),a.parent.trigger("dataBound",{}),a.parent.isEdit&&a.parent.notify(Es,null),e.openOptions&&e.openOptions.eventArgs&&e.openOptions.eventArgs.triggerEvent&&a.parent.trigger("openComplete",{response:e.openOptions}),e.initLoad){var l=!0;if(a.parent.scrollSettings.enableVirtualization)for(i=0;i<o.ranges.length;i++)if(o.ranges[i].info.count-1>a.parent.viewport.bottomIndex){l=!1;break}l?a.parent.isReact?setTimeout(function(){a.parent&&a.triggerCreatedEvent()}):a.triggerCreatedEvent():a.parent.isOpen||a.parent.hideSpinner()}}})},e.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("created",null),this.parent.notify(Bo,null))},e.prototype.checkRowHeightChanged=function(e,t){var r={top:e.top,left:e.left,sheet:t};this.parent.notify(pl,r),e.top!==r.top&&(this.parent.scrollModule&&this.parent.scrollModule.offset.top.idx&&r.top-e.top<We(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<$e(t,this.parent.scrollModule.offset.left.idx)&&(this.parent.scrollModule.offset.left.size=r.left),e.left=r.left)},e.prototype.checkTableWidth=function(e){if(this.parent.scrollSettings.isFinite&&!this.parent.scrollSettings.enableVirtualization&&e.colCount-1===this.parent.viewport.rightIndex){var t=Ze(e,this.parent.viewport.leftIndex+this.parent.frozenColCount(e),this.parent.viewport.rightIndex),r=this.getRowHeaderWidth(e),n=this.getScrollSize();t<this.contentPanel.getBoundingClientRect().width-r-n?(this.getContentPanel().style.width=t+"px",this.getColHeaderPanel().style.width=t+"px"):this.getContentPanel().style.width.includes("calc")||(this.getContentPanel().style.width="calc(100% - "+r+"px)",this.getColHeaderPanel().style.width="calc(100% - "+r+"px)")}},e.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},e.prototype.refreshColumnContent=function(e){var t,r,n,i,a,o=this,s=0,l=this.parent.getActiveSheet(),h=document.createDocumentFragment(),d=document.createDocumentFragment(),p=this.parent.element.querySelector(".e-sheet-content tbody"),u=this.parent.element.querySelector(".e-column-header tbody"),f=this.parent.element.querySelector(".e-sheet-content colgroup");f=f.cloneNode(),h.appendChild(f),p=h.appendChild(p.cloneNode(!0));var g=f.cloneNode();d.appendChild(g);var m;m=this.parent.element.querySelector(".e-column-header thead");var v=(m=d.appendChild(m.cloneNode(!0))).querySelector("tr");v.innerText="";var y=this.parent.frozenRowCount(l),C=this.parent.frozenColCount(l);y&&(u=d.appendChild(u.cloneNode(!0)));var b=$(l,y-1,!1),x=this.parent.scrollSettings.enableVirtualization&&this.parent.viewport.topIndex!==$(l,0,!0);this.clearCFResult(l),e.cells.forEach(function(n,h){if((t=c(h))[0]===e.indexes[0]&&(a=o.updateCol(l,t[1],g),f.appendChild(a.cloneNode()),o.cellRenderer.renderColHeader(t[1],v)),t[1]-C===e.indexes[1]){if(!(r=t[0]<y?u.children[s]:p.children[s]))return;r.innerText="",s++}r&&(i=o.cellRenderer.render({colIdx:t[1],rowIdx:t[0],cell:n,address:h,row:r,pRow:r.previousSibling,first:e.skipUpdateOnFirst||t[1]!==e.indexes[1]?x&&t[0]===e.indexes[0]?"Row":"":"Column",isRefreshing:!0}),o.checkColMerge(t,e.indexes,i,n),y&&t[0]===b&&(s=0))});var S=function(){rt(n=o.getColHeaderTable()),n.appendChild(d),rt(n=o.getContentTable()),n.appendChild(h),o.parent.notify(ja,{refresh:"Column",prevRowColCnt:e.prevRowColCnt}),l.conditionalFormats&&l.conditionalFormats.length&&o.parent.notify(Xn,{indexes:e.indexes,isRender:!0}),o.parent.isEdit&&o.parent.notify(Rs,{}),o.parent.allowChart&&o.parent.notify(zs,null),o.parent.isOpen||o.parent.hideSpinner(),Ft(o.parent.getMainContent(),{busy:!1})};e.insertDelete?S():tt(function(){return S()})},e.prototype.refreshRowContent=function(e){var r,n,i,a,o=this,s=this.colGroupWidth,l=this.parent.getActiveSheet(),h=document.createDocumentFragment(),d=this.parent.createElement("tbody"),p=document.createDocumentFragment(),u=d.cloneNode();p.appendChild(u),h.appendChild(d);var f=this.parent.frozenColCount(l),g=$(l,f-1,!1,"columns"),m=this.parent.scrollSettings.enableVirtualization&&this.parent.viewport.leftIndex!==$(l,0,!0,"columns");this.clearCFResult(l),e.cells.forEach(function(t,l){(r=c(l))[1]!==e.indexes[1]&&n||(r[1]===e.indexes[1]&&(i=o.rowRenderer.render(r[0],!0)),f&&r[1]<f?(u.appendChild(i),n=i):(r[1]===e.indexes[1]&&u.appendChild(i),n=o.rowRenderer.render(r[0]),d.appendChild(n)),r[1]===e.indexes[1]&&(o.cellRenderer.renderRowHeader(r[0],i),s=nt(r[0]+1))),f&&(i=u.lastElementChild||i),a=o.cellRenderer.render({rowIdx:r[0],colIdx:r[1],cell:t,address:l,lastCell:r[1]===e.indexes[3],row:n,hRow:i,pRow:n.previousSibling,pHRow:i.previousSibling,isHeightCheckNeeded:!0,first:e.skipUpdateOnFirst||r[0]!==e.indexes[0]?m&&r[1]===e.indexes[1]?"Column":"":"Row",isRefreshing:!0}),o.checkRowMerge(r,e.indexes,a,t),f&&r[1]===g&&(n=null)}),this.colGroupWidth!==s&&this.updateLeftColGroup(s),this.contentPanel.querySelector(".e-row-header tbody")&&(t.detach(this.contentPanel.querySelector(".e-row-header tbody")),this.getRowHeaderTable().appendChild(p)),this.contentPanel.querySelector(".e-sheet-content tbody")&&(t.detach(this.contentPanel.querySelector(".e-sheet-content tbody")),this.getContentTable().appendChild(h)),this.parent.notify(ja,{refresh:"Row",prevRowColCnt:e.prevRowColCnt}),l.conditionalFormats&&l.conditionalFormats.length&&this.parent.notify(Xn,{indexes:e.indexes,isRender:!0}),this.parent.allowChart&&this.parent.notify(zs,{}),this.parent.isEdit&&this.parent.notify(Rs,null),this.parent.isOpen||this.parent.hideSpinner(),Ft(this.parent.getMainContent(),{busy:!1})},e.prototype.updateCol=function(e,r,n){var i=this.col.cloneNode();if(i.style.width=t.formatUnit($e(e,r,null,!0)),n){var a=n.querySelector(".e-empty");return a?n.insertBefore(i,a):n.appendChild(i)}return i},e.prototype.updateColContent=function(e){var r=this;tt(function(){var n,i,a,o,s,l,h,d=0,p=r.parent.getActiveSheet(),u=r.parent.element.querySelector(".e-column-header .e-header-row"),f=u.firstElementChild,g=r.parent.element.querySelector(".e-sheet-content colgroup"),m=r.parent.element.querySelector(".e-column-header colgroup"),v=g.firstElementChild,y=m.firstElementChild,C=r.parent.element.querySelector(".e-sheet-content tbody"),b=r.parent.element.querySelector(".e-column-header tbody"),x=r.parent.frozenRowCount(p),S=r.parent.frozenColCount(p),w=$(p,x-1,!1),I=$(p,e.indexes[0],!0);r.clearCFResult(p),e.cells.forEach(function(E,R){if(!l){if(n=c(R),"first"===e.direction&&n[1]===e.indexes[1]&&r.checkColMerge([n[0],r.parent.viewport.leftIndex+S],e.indexes,((n[0]<x?b:C).rows[d]||{cells:[]}).cells[e.indexes[3]-e.indexes[1]+1],Re(n[0],r.parent.viewport.leftIndex+S,p)||{}),n[0]===I&&("last"===e.direction?((s=r.col.cloneNode()).style.width=t.formatUnit($e(p,n[1],null,!0)),g.insertBefore(s,v),m.insertBefore(s.cloneNode(),y),r.cellRenderer.renderColHeader(n[1],u,f)):(s=r.updateCol(p,n[1],g),m.appendChild(s.cloneNode()),r.cellRenderer.renderColHeader(n[1],u)),r.parent.scrollSettings.enableVirtualization&&e.direction&&(t.detach(g[e.direction+"ElementChild"]),t.detach(m[e.direction+"ElementChild"]),t.detach(u[e.direction+"ElementChild"]))),n[1]===e.indexes[1]){if(n[0]<x)i=b.children[d];else if(!(i=C.children[d]))return void(l=!0);d++,a=i.firstElementChild}h={colIdx:n[1],rowIdx:n[0],cell:E,address:R,row:i,lastCell:n[1]===e.indexes[3],isHeightCheckNeeded:"first"===e.direction,first:"last"!==e.direction||e.skipUpdateOnFirst||n[1]!==e.indexes[1]?"":"Column",checkNextBorder:"last"===e.direction&&n[3]===e.indexes[3]?"Column":"",isRefreshing:"first"===e.direction},"last"===e.direction?(h.refChild=a,o=r.cellRenderer.render(h),r.checkColMerge(n,e.indexes,o,E,((n[0]<x?b:C).rows[d-1]||{cells:[]}).cells[1])):o=r.cellRenderer.render(h),r.parent.scrollSettings.enableVirtualization&&e.direction&&t.detach(i[e.direction+"ElementChild"]),x&&n[0]===w&&(d=0)}}),r.parent.notify(ja,{refresh:"Column",prevRowColCnt:e.prevRowColCnt}),p.conditionalFormats&&p.conditionalFormats.length&&r.parent.notify(Xn,{indexes:e.indexes,isRender:!0}),r.parent.allowChart&&r.parent.notify(zs,null),r.parent.isEdit&&r.parent.notify(Rs,{}),r.parent.isOpen||r.parent.hideSpinner(),Ft(r.parent.getMainContent(),{busy:!1})})},e.prototype.updateRowContent=function(e){var r=this,n=this.parent.getMainContent();if(""!==e.direction||n.children.length){var i,a,o,s,l=this.colGroupWidth,h=this.parent.getActiveSheet(),d=0,p=n.querySelector("tbody"),u=this.parent.getRowHeaderContent().querySelector("tbody"),f=document.createDocumentFragment(),g=document.createDocumentFragment();this.parent.showSpinner();var m,v=this.parent.frozenColCount(h),y=this.parent.frozenRowCount(h),C=$(h,e.indexes[1],!0,"columns"),b=$(h,v-1,!1,"columns");this.clearCFResult(h),e.cells.forEach(function(n,x){s=c(x),"first"===e.direction&&s[0]===e.indexes[0]&&(void 0===m&&(m=(s[1]<v?u:p).rows[e.indexes[2]-e.indexes[0]+1]||null),r.checkRowMerge([r.parent.viewport.topIndex+y,s[1]],e.indexes,(m||{cells:[]}).cells[s[1]<v?d+1:d],Re(r.parent.viewport.topIndex+y,s[1],h)||{})),s[1]!==C&&i||(s[1]===C&&(a=r.rowRenderer.render(s[0],!0)),v&&s[1]<v?(f.appendChild(a),i=a):(i=r.rowRenderer.render(s[0]),g.appendChild(i),s[1]===C&&f.appendChild(a),r.parent.scrollSettings.enableVirtualization&&e.direction&&t.detach(p[e.direction+"ElementChild"])),s[1]===C&&(r.cellRenderer.renderRowHeader(s[0],a),l=nt(s[0]+1),r.parent.scrollSettings.enableVirtualization&&e.direction&&t.detach(u[e.direction+"ElementChild"]))),v&&(a=f.lastElementChild||a),o=r.cellRenderer.render({colIdx:s[1],rowIdx:s[2],cell:n,address:x,row:i,lastCell:s[1]===e.indexes[3],pHRow:a.previousSibling,checkNextBorder:"last"===e.direction&&s[2]===e.indexes[2]?"Row":"",pRow:i.previousSibling,isHeightCheckNeeded:"first"===e.direction||""===e.direction,hRow:a,first:"last"!==e.direction||e.skipUpdateOnFirst||s[0]!==e.indexes[0]?"":"Row",isRefreshing:"first"===e.direction}),"last"===e.direction&&p.rows.length&&r.checkRowMerge(s,e.indexes,o,n,(s[1]<v?u:p).rows[0].cells[s[1]<v?d+1:d]),d++,v&&s[1]===b&&(i=null,m=void 0,d=0)}),this.colGroupWidth!==l&&this.updateLeftColGroup(l),"last"===e.direction?(u.insertBefore(f,u.firstElementChild),p.insertBefore(g,p.firstElementChild)):(u.appendChild(f),p.appendChild(g)),this.parent.scrollSettings.enableVirtualization&&this.parent.notify(ja,{refresh:"Row",prevRowColCnt:e.prevRowColCnt}),h.conditionalFormats&&h.conditionalFormats.length&&this.parent.notify(Xn,{indexes:e.indexes,isRender:!0}),this.parent.isEdit&&this.parent.notify(Rs,null),this.parent.allowChart&&this.parent.notify(zs,{}),this.parent.isOpen||this.parent.hideSpinner(),Ft(this.parent.getMainContent(),{busy:!1})}},e.prototype.checkRowMerge=function(e,r,n,i,a){if(this.parent.scrollSettings.enableVirtualization&&n&&(!t.isNullOrUndefined(i.rowSpan)||!t.isNullOrUndefined(i.colSpan))){var o=this.parent.frozenRowCount(this.parent.getActiveSheet());if(e[0]===this.parent.viewport.topIndex+o){if(i.rowSpan<0){var s={td:n,rowIdx:e[0],colIdx:e[1],isRow:!0,isFreezePane:!0};if(this.parent.notify(us,s),s.insideFreezePane)return;this.parent.viewport.topIndex+o>=r[2]&&this.refreshPrevMerge(r[2]+1,e[1])}a&&this.refreshFirstCell(e[0]+(r[2]-r[0])+1,e[1],a)}else if(i.rowSpan>1){var l=r[2]+1;e[0]+i.rowSpan-1>=l&&e[0]<l&&this.refreshPrevMerge(l,e[1],this.parent.viewport.topIndex+o)}}},e.prototype.refreshPrevMerge=function(e,t,r){var n=this.parent.getCell(e,t,this.parent.getRow(r||0,null,t));n&&this.cellRenderer.refresh(e,t,null,n)},e.prototype.refreshFirstCell=function(e,t,r){var n=Re(e,t,this.parent.getActiveSheet(),!1,!0);(n.rowSpan<0||n.colSpan<0)&&this.cellRenderer.refresh(e,t,null,r)},e.prototype.checkColMerge=function(e,r,n,i,a){if(this.parent.scrollSettings.enableVirtualization&&n&&(!t.isNullOrUndefined(i.rowSpan)||!t.isNullOrUndefined(i.colSpan))){var o=this.parent.frozenColCount(this.parent.getActiveSheet());if(e[1]===this.parent.viewport.leftIndex+o){if(i.colSpan<0){var s={td:n,colIdx:e[1],rowIdx:e[0],isFreezePane:!0};if(this.parent.notify(us,s),s.insideFreezePane)return;if(this.parent.viewport.leftIndex+o>=r[3]){(l=this.parent.getCell(e[0],e[3]+1,this.parent.getRow(e[0],null,e[3]+1)))&&this.cellRenderer.refresh(e[0],r[3]+1,null,l)}}a&&this.refreshFirstCell(e[0],e[1]+(r[3]-r[1])+1,a)}else if(i.colSpan>1&&e[1]+i.colSpan-1>=r[3]+1&&e[1]<r[3]+1){var l;(l=this.parent.getCell(e[0],e[3]+1,this.parent.getRow(e[0],null,e[3]+1)))&&this.cellRenderer.refresh(e[0],r[3]+1,null,l)}}},e.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")},e.prototype.showHideHeaders=function(){var e=this,t=this.parent.getActiveSheet();tt(function(){if(t.showHeaders){var r=e.getContentPanel();e.setPanelWidth(t,e.getRowHeaderPanel()),e.setPanelHeight(t),document.getElementById(e.parent.element.id+"_sheet").classList.remove("e-hide-headers"),e.getColHeaderPanel().scrollLeft=r.scrollLeft,e.parent.selectRange(t.selectedRange)}else e.updateHideHeaders(t,document.getElementById(e.parent.element.id+"_sheet")),e.setPanelHeight(t),e.parent.frozenColCount(t)||e.parent.frozenRowCount(t)?(e.setPanelWidth(t,e.getRowHeaderPanel()),e.parent.selectRange(t.selectedRange)):(e.getContentPanel().style.width="",e.getContentPanel().style[e.parent.enableRtl?"right":"left"]=""),e.getScrollElement().style.left=e.getRowHeaderWidth(t)+"px"})},e.prototype.updateHideHeaders=function(e,t){e.showHeaders||t.classList.add("e-hide-headers")},e.prototype.rowHeightChanged=function(e){if(e.threshold||e.isHideShow){var t=this.parent.getActiveSheet();e.rowIdx<this.parent.frozenRowCount(t)&&this.setPanelHeight(t)}},e.prototype.colWidthChanged=function(e){if(e.threshold||e.isHideShow){var t=this.parent.getActiveSheet();e.colIdx<this.parent.frozenColCount(t)&&this.setPanelWidth(t,this.getRowHeaderPanel()),this.checkTableWidth(t)}},e.prototype.getRowHeaderWidth=function(e,t){var r=0;if(!t&&e.frozenColumns){var n=u(e.topLeftCell)[1];r=Ze(e,n,n+e.frozenColumns-1,!0)}return r+=e.showHeaders?kt(this.colGroupWidth):0},e.prototype.getColHeaderHeight=function(e,t){var r=u(e.topLeftCell)[0];return(e.showHeaders&&!t?kt(31):0)+Ye(e,r,r+e.frozenRows-1,!0)},e.prototype.getSelectAllContent=function(){return this.headerPanel.getElementsByClassName("e-selectall-container")[0]},e.prototype.getScrollElement=function(){var e=this.contentPanel.parentElement||this.contentPanel.nextElementSibling;return e&&e.querySelector(".e-scroller")},e.prototype.getSelectAllTable=function(){return this.headerPanel.getElementsByClassName("e-selectall-table")[0]},e.prototype.getColHeaderTable=function(){return this.headerPanel.getElementsByClassName("e-colhdr-table")[0]},e.prototype.getRowHeaderTable=function(){return this.contentPanel.getElementsByClassName("e-rowhdr-table")[0]},e.prototype.getContentTable=function(){return this.contentPanel.getElementsByClassName("e-content-table")[0]},e.prototype.getRowHeaderPanel=function(){return this.contentPanel.getElementsByClassName("e-row-header")[0]},e.prototype.getColHeaderPanel=function(){return this.headerPanel.getElementsByClassName("e-column-header")[0]},e.prototype.getContentPanel=function(){return this.contentPanel.getElementsByClassName("e-sheet-content")[0]},e.prototype.addEventListener=function(){this.parent.on("created",this.triggerCreatedEvent,this),this.parent.on(yo,this.rowHeightChanged,this),this.parent.on(Co,this.colWidthChanged,this),this.parent.on(Ta,this.removeEventListener,this)},e.prototype.destroy=function(){this.headerPanel&&this.headerPanel.remove(),this.headerPanel=null,this.contentPanel&&this.contentPanel.remove(),this.contentPanel=null,this.col&&this.col.remove(),this.col=null,this.rowRenderer=null,this.cellRenderer=null,this.colGroupWidth=null,this.parent=null},e.prototype.removeEventListener=function(){this.parent.off("created",this.triggerCreatedEvent),this.parent.off(yo,this.rowHeightChanged),this.parent.off(Co,this.colWidthChanged),this.parent.off(Ta,this.removeEventListener)},e}(),jl=function(){function e(e){this.parent=e,this.element=this.parent.createElement("tr"),this.cellRenderer=e.serviceLocator.getService("cell"),this.parent.on(xo,this.initProps,this)}return e.prototype.render=function(e,r,n){var i=this.element.cloneNode();if(void 0===e)return i.classList.add("e-header-row"),i;i.classList.add("e-row");var a=this.parent.getActiveSheet();t.attributes(i,{"aria-rowindex":(e+1).toString()});var o=We(a,e,!0);i.style.height=o+"px";var s=We(a,e);if(!this.bottomBorderWidth){var l=1;if(window.devicePixelRatio%1>0){var h=1*window.devicePixelRatio%1;l=1+(h?(h>.5?1-h:-1*h)/window.devicePixelRatio:0)}this.bottomBorderWidth=l}if(s<20&&(i.style.lineHeight=o>this.bottomBorderWidth?o-this.bottomBorderWidth+"px":"0px"),r&&!n){if(s<20){l=this.bottomBorderWidth-1+4;i.style.lineHeight=o>=l?o-l+"px":o>this.bottomBorderWidth?o-this.bottomBorderWidth+"px":"0px",i.classList.contains("e-reach-fntsize")||i.classList.add("e-reach-fntsize")}je(a,e+1)&&!je(a,e-1)&&i.classList.add("e-hide-start"),0!==e&&je(a,e-1)&&!je(a,e+1)&&i.classList.add("e-hide-end")}return i},e.prototype.refresh=function(e,t,r,n,i){var a,o=this,s=this.parent.getActiveSheet();if(n)a=this.render(e,n,i),this.cellRenderer.renderRowHeader(e,a);else{var l,h,d=function(){for(;l<=h;)Qe(s,l)||o.cellRenderer.render({colIdx:l,rowIdx:e,cell:Re(e,l,s),address:g(e,l),lastCell:l===h,row:a,hRow:r,isHeightCheckNeeded:!0,pRow:t,first:e===o.parent.viewport.topIndex&&$(s,e,!0)!==$(s,0,!0)?"Row":"",skipFormatCheck:Kt(o.parent),checkCF:!0}),l++},p=this.parent.frozenColCount(s);p&&(a=r,l=u(s.topLeftCell)[0],h=p-1,d()),a=this.render(e,n,i),l=this.parent.viewport.leftIndex+p,h=this.parent.viewport.rightIndex,d()}return a},e.prototype.initProps=function(){this.bottomBorderWidth=null},e.prototype.destroy=function(){this.parent.off(xo,this.initProps),this.element&&this.element.remove(),this.bottomBorderWidth&&(this.bottomBorderWidth=null),this.parent=null,this.element=null},e}(),ql=function(){function e(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(bi,this.updateView,this),this.parent.on("calculateFormula",this.calculateFormula,this)}return e.prototype.renderColHeader=function(e,r,n){var i=this.th.cloneNode(),a=v(e+1);i.innerText=a;var o=this.parent.getActiveSheet();Qe(o,e+1)&&i.classList.add("e-hide-start"),0!==e&&Qe(o,e-1)&&i.classList.add("e-hide-end"),n?r.insertBefore(i,n):r.appendChild(i),this.parent.trigger("beforeCellRender",{cell:null,element:i,address:a,colIndex:e}),this.parent.notify(Vo,{td:i,rowIndex:0,colIndex:e}),t.attributes(i,{"aria-colindex":(e+1).toString(),tabindex:"-1"})},e.prototype.renderRowHeader=function(e,r,n){var i=this.element.cloneNode();t.addClass([i],"e-header-cell"),t.attributes(i,{role:"rowheader",tabindex:"-1"}),i.innerText=(e+1).toString(),n?r.insertBefore(i,n):r.appendChild(i),this.parent.trigger("beforeCellRender",{cell:null,element:i,address:""+(e+1),rowIndex:e})},e.prototype.render=function(e){var r=this.parent.getActiveSheet();if(e.td=this.element.cloneNode(),e.td.className="e-cell",t.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=Kt(this.parent),this.update(e),e.checkCF&&e.cell&&r.conditionalFormats&&r.conditionalFormats.length&&this.parent.notify(Xn,{indexes:[e.rowIdx,e.colIdx],cell:e.cell,ele:e.td,isRender:!0}),e.td.classList.contains("e-cell-template")||this.parent.notify(Vo,{td:e.td,rowIndex:e.rowIdx,colIndex:e.colIdx}),e.refChild?e.row.insertBefore(e.td,e.refChild):e.row.appendChild(e.td);var n={cell:e.cell,element:e.td,address:e.address,rowIndex:e.rowIdx,colIndex:e.colIdx,needHeightCheck:!1,row:e.row};if(this.parent.trigger("beforeCellRender",n),!r.rows[e.rowIdx]||!r.rows[e.rowIdx].customHeight){if(n.element&&n.element.children.length||n.needHeightCheck){var i=n.element.cloneNode(!0);i.style.width=$e(r,e.colIdx,!0)+"px",this.tableRow.appendChild(i)}if(e.lastCell&&this.tableRow.childElementCount||n.needHeightCheck){var a=e.row||this.parent.getRow(e.rowIdx),o=We(r,e.rowIdx),s=this.getRowHeightOnInit();if(s>o){var l=kt(s);a.style.height=l+"px",(e.hRow||this.parent.getRow(e.rowIdx,this.parent.getRowHeaderTable())).style.height=l+"px",Ge(r,e.rowIdx,s)}this.tableRow.innerText=""}}return this.setWrapByValue(r,e),n.element},e.prototype.setWrapByValue=function(e,r){r.cell&&t.isNullOrUndefined(r.cell.wrap)&&r.cell.value&&r.cell.value.toString().includes("\n")&&(ke(r.rowIdx,r.colIdx,e,{wrap:!0},!0),this.parent.notify(yn,{range:[r.rowIdx,r.colIdx,r.rowIdx,r.colIdx],wrap:!0,initial:!0,sheet:e,td:r.td,row:r.row,hRow:r.hRow}))},e.prototype.update=function(e){var r=this.parent.getActiveSheet();if(!e.isRefresh||e.cell&&e.cell.template){var n=this.processTemplates(e.cell,e.rowIdx,e.colIdx);n&&("string"==typeof n?e.td.innerHTML=n:(rt(e.td),t.append(n,e.td)),e.td.classList.add("e-cell-template"))}if(e.isRefresh){if(e.td.rowSpan&&(this.mergeFreezeRow(r,e.rowIdx,e.colIdx,e.td.rowSpan,e.row,!0),e.td.removeAttribute("rowSpan")),e.td.colSpan&&(this.mergeFreezeCol(r,e.rowIdx,e.colIdx,e.td.colSpan,!0),e.td.removeAttribute("colSpan")),this.checkMerged(e))return;if(e.cell&&!e.cell.hyperlink){var i=e.td.querySelector(".e-hyperlink");i&&t.detach(i)}!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 a={value:e.cell&&e.cell.value,type:e.cell&&Ve(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};e.cell&&this.parent.notify(Mr,a),this.parent.refreshNode(e.td,{type:a.type,result:a.formattedText,curSymbol:a.curSymbol,isRightAlign:a.isRightAlign,value:a.value||0===a.value?a.value:"",isRowFill:a.isRowFill,rowIndex:e.rowIdx,colIndex:e.colIdx});var o={};if(e.cell){if(e.cell.style&&(o=e.cell.style.properties?Fe(e.cell.style,!0):e.cell.style),void 0!==a.color&&(o.color=a.color),this.createImageAndChart(e),e.cell.hyperlink&&this.parent.notify(Oo,{cell:e.cell,style:o,td:e.td,rowIdx:e.rowIdx,colIdx:e.colIdx}),e.cell.rowSpan>1){var s=e.rowSpan||e.cell.rowSpan-this.parent.hiddenCount(e.rowIdx,e.rowIdx+(e.cell.rowSpan-1));s>1&&(e.td.rowSpan=s,this.mergeFreezeRow(r,e.rowIdx,e.colIdx,s,e.row))}if(e.cell.colSpan>1){var l=e.colSpan||e.cell.colSpan-this.parent.hiddenCount(e.colIdx,e.colIdx+(e.cell.colSpan-1),"columns");l>1&&(e.td.colSpan=l,this.mergeFreezeCol(r,e.rowIdx,e.colIdx,l))}}if(e.isRefresh&&this.removeStyle(e.td,e.rowIdx,e.colIdx),e.lastCell&&this.parent.chartColl&&this.parent.chartColl.length&&this.parent.notify(ri,{cell:e.cell,rIdx:e.rowIdx,cIdx:e.colIdx,sheetIdx:this.parent.activeSheetIndex}),this.applyStyle(e,o),"Row"===e.checkNextBorder){var h=this.parent.getCellStyleValue(["borderTop"],[Number(this.parent.getContentTable().rows[0].getAttribute("aria-rowindex"))-1,e.colIdx]).borderTop;""===h||e.cell&&e.cell.style&&e.cell.style.bottomPriority||(e.style={borderBottom:h},this.parent.notify(_r,e))}if("Column"===e.checkNextBorder){var d=this.parent.getCellStyleValue(["borderLeft"],[e.rowIdx,e.colIdx+1]).borderLeft;""===d||e.cell&&e.cell.style&&(e.cell.style.borderRight||e.cell.style.border)||(e.style={borderRight:d},this.parent.notify(_r,e))}e.cell&&!t.isNullOrUndefined(e.cell.wrap)&&this.parent.notify(yn,{range:[e.rowIdx,e.colIdx,e.rowIdx,e.colIdx],wrap:e.cell.wrap,sheet:r,initial:!0,td:e.td,row:e.row,hRow:e.hRow,isCustomHgt:!e.isRefresh&&We(r,e.rowIdx)>20});var p=e.cell&&e.cell.validation||r.columns&&r.columns[e.colIdx]&&r.columns[e.colIdx].validation;p&&p.isHighlighted&&this.parent.notify(Rn,{range:m([e.rowIdx,e.colIdx]),td:e.td}),e.cell&&e.cell.validation&&e.cell.validation.isHighlighted&&this.parent.notify(Rn,{range:m([e.rowIdx,e.colIdx]),td:e.td})},e.prototype.applyStyle=function(e,r){(Object.keys(r).length||Object.keys(this.parent.commonCellStyle).length||e.lastCell)&&(e.style=t.extend({},this.parent.commonCellStyle,r),this.parent.notify(_r,e))},e.prototype.createImageAndChart=function(e){if(e.cell.chart&&e.cell.chart.length>0&&this.parent.notify(Jn,{chart:e.cell.chart,isInitCell:!0,range:g(e.rowIdx,e.colIdx),isUndoRedo:!1}),e.cell.image&&e.cell.image.length>0)for(var t=0;t<e.cell.image.length;t++)e.cell.image[t]&&this.parent.notify(Ts,{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:m([e.rowIdx,e.colIdx,e.rowIdx,e.colIdx]),isPublic:!1})},e.prototype.calculateFormula=function(e){if(void 0!==e.cell.value&&null!==e.cell.value){var r={action:"checkFormulaAdded",added:!0,address:e.address,sheetId:(void 0===e.sheetIndex?this.parent.getActiveSheet():Ce(this.parent,e.sheetIndex)).id.toString()};if(this.parent.notify(jr,r),r.added)return}else e.formulaRefresh&&(e.cell.value="");var n=B(e.cell.formula),i={action:"refreshCalculate",value:e.cell.formula,rowIndex:e.rowIdx,colIndex:e.colIdx,isFormula:n,sheetIndex:e.sheetIndex,isRefreshing:e.isRefreshing,isDependentRefresh:e.isDependentRefresh,isRandomFormula:e.isRandomFormula};this.parent.notify(jr,i),e.cell.value=Re(e.rowIdx,e.colIdx,t.isNullOrUndefined(e.sheetIndex)?this.parent.getActiveSheet():Ce(this.parent,e.sheetIndex)).value,e.cell.formula=e.cell.formula.indexOf("^+")>-1||e.cell.formula.indexOf("&+")>-1?i.value:e.cell.formula},e.prototype.checkMerged=function(e){if(e.cell&&(e.cell.colSpan<0||e.cell.rowSpan<0)){var t=this.parent.getActiveSheet();if(t.frozenRows||t.frozenColumns){var r={range:[e.rowIdx,e.colIdx,e.rowIdx,e.colIdx]};this.parent.notify(qn,r);var n=this.parent.frozenRowCount(t),i=this.parent.frozenColCount(t);r.range=r.range,(t.frozenRows&&t.frozenColumns?r.range[0]<n&&r.range[1]<i?e.rowIdx<n&&e.colIdx<i:r.range[0]<n?e.rowIdx<n:!(r.range[1]<i)||e.colIdx<i:n?r.range[0]>=n||e.rowIdx<n:r.range[1]>=i||e.colIdx<i)&&(e.td.style.display="none")}else e.td.style.display="none";e.isMerged=!0;var a=e.cell.rowSpan,o=e.cell.colSpan;return(o<0||a<0)&&(this.parent.notify(cs,e),o<0&&e.cell.style&&e.cell.style.borderTop&&this.applyStyle(e,{borderTop:e.cell.style.borderTop}),a<0&&e.cell.style&&e.cell.style.borderLeft&&this.applyStyle(e,{borderLeft:e.cell.style.borderLeft})),e.isMerged}return!1},e.prototype.mergeFreezeRow=function(e,r,n,i,a,o){var s=this.parent.frozenRowCount(e);if(s&&r<s&&r+(i-1)>=s){var l=void 0,h=0,d=void 0,p=this.parent.frozenColCount(e),c=a||this.parent.getRow(r,null,n),f=[].slice.call(c.parentElement.querySelectorAll(".e-empty"));if(o){var g=r+i-s;if(g<f.length)return;var m=0;if(g===f.length){var v=void 0,y=void 0,C=void 0;for(p&&n<p?(y=u(e.topLeftCell)[1],C=p):(y=this.parent.viewport.leftIndex+p,C=this.parent.viewport.rightIndex);y<C;y++)y!==n&&(v=Re(r,y,e,!1,!0)).rowSpan&&r+v.rowSpan-s>m&&(m=r+v.rowSpan-s);if(m===g)return}else m=g;var b=r+(i-1);for(y=m,C=f.length;y<C;y++)h+=We(e,b),b--,t.detach(f.pop());return this.updateSpanTop(n,p,h,!0),void(f.length||this.updateColZIndex(n,p,!0))}this.updateColZIndex(n,p);for(y=s,C=r+(i-1);y<=C;y++)h+=-(d=We(e,$(e,y,!0),!0)),s+f.length>y||((l=c.cloneNode()).classList.add("e-empty"),l.style.visibility="hidden",l.style.height=d+"px",c.parentElement.appendChild(l));this.updateSpanTop(n,p,h)}},e.prototype.updateSpanTop=function(e,t,r,n){var i=this.parent.serviceLocator.getService("sheet").contentPanel;if(n){if(!parseInt(i.style.top,10))return;r=parseInt(i.style.top,10)+r}if(t&&e<t&&(n||!parseInt(i.style.top,10)||r<parseInt(i.style.top,10))){i.style.top=r+"px";var a=i.nextElementSibling;a&&(a.style.top=r+"px")}},e.prototype.mergeFreezeCol=function(e,r,n,i,a){var o=this.parent.frozenColCount(e);if(o&&n<o&&n+(i-1)>=o){var s=void 0,l=void 0,h=this.parent.frozenRowCount(e),d=(r<h?this.parent.getSelectAllContent():this.parent.getRowHeaderContent()).querySelector("colgroup"),p=[].slice.call(d.querySelectorAll(".e-empty"));if(a){var c=n+i-o;if(c<p.length)return;var f=0;if(c===p.length){var g=void 0,m=void 0,v=void 0;for(h&&r<o?(m=h,v=u(e.topLeftCell)[0]):(m=this.parent.viewport.bottomIndex,v=this.parent.viewport.topIndex+h);v<m;v++)v!==r&&(g=Re(v,n,e,!1,!0)).colSpan&&n+g.colSpan-o>f&&(f=n+g.colSpan-o);if(f===c)return}else f=c;for(v=f,m=p.length;v<m;v++)t.detach(p.pop());return this.parent.serviceLocator.getService("sheet").setPanelWidth(e,this.parent.getRowHeaderContent()),void(p.length||this.updateRowZIndex(r,h,!0))}this.updateRowZIndex(r,h);for(v=o,m=n+(i-1);v<=m;v++)o+p.length>v||((s=d.childNodes[0].cloneNode()).classList.add("e-empty"),s.style.visibility="hidden",l=$e(e,$(e,v,!0,"columns"),null,!0),s.style.width=l+"px",d.appendChild(s),v===m&&this.parent.serviceLocator.getService("sheet").setPanelWidth(e,this.parent.getRowHeaderContent()))}},e.prototype.updateColZIndex=function(e,t,r){e<t?this.updateSelectAllZIndex(r):(this.parent.getColumnHeaderContent().style.zIndex=r?"":"2",this.updatedHeaderZIndex(r))},e.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"},e.prototype.updatedHeaderZIndex=function(e){if(!e&&"2"===this.parent.getSelectAllContent().style.zIndex){this.parent.getSelectAllContent().style.zIndex="3";var t=this.parent.element.querySelector(".e-frozen-row"),r=this.parent.element.querySelector(".e-frozen-column");r&&(r.style.zIndex="4"),t&&(t.style.zIndex="4")}},e.prototype.updateRowZIndex=function(e,t,r){e<t?this.updateSelectAllZIndex(r):(this.parent.getRowHeaderContent().style.zIndex=r?"":"2",this.updatedHeaderZIndex(r))},e.prototype.processTemplates=function(e,t,r){for(var n,i=this.parent.getActiveSheet(),a=i.ranges,o=0,s=a.length;o<s;o++)if(a[o].template&&(n=c(a[o].address.length?a[o].address:a[o].startCell))[0]<=t&&n[1]<=r&&n[2]>=t&&n[3]>=r){if(e)return this.compileCellTemplate(a[o].template,Object.assign({rowIndex:t,colIndex:r},e));if(!Re(t,r,i,!0))return this.compileCellTemplate(a[o].template,Object.assign({rowIndex:t,colIndex:r},Re(t,r,i,null,!0)))}return""},e.prototype.compileCellTemplate=function(e,r){var n;if("string"==typeof e){var i=void 0;return i=0===e.trim().indexOf("#")?document.querySelector(e).innerHTML.trim():e,n=t.compile(i),!this.parent.isVue||this.isSelector(e)?n(r,this.parent,"ranges","",!0)[0].outerHTML:n(r,this.parent,"ranges","")}var a=(n=t.compile(e))(r,this.parent,"ranges","");return a[0]?a:[a]},e.prototype.isSelector=function(e){try{return!!document.querySelector(e)}catch(e){return!1}},e.prototype.getRowHeightOnInit=function(){var e=this.parent.createElement("table",{className:"e-table e-test-table"});e.appendChild(this.parent.createElement("tbody")).appendChild(this.tableRow),this.parent.element.appendChild(e);var t=Math.round(this.tableRow.getBoundingClientRect().height);return this.parent.element.removeChild(e),t<20?20:t},e.prototype.removeStyle=function(e,t,r){var n;if(e.style.length){var i=(n=this.parent.getCellStyleValue(["borderLeft","border"],[t,r+1])).borderLeft||n.border,a=(n=this.parent.getCellStyleValue(["borderTop","border"],[t+1,r])).borderTop||n.border;i||a?[].slice.call(e.style).forEach(function(t){i&&a?t.includes("border-right")||t.includes("border-bottom")||e.style.removeProperty(t):(!i||t.indexOf("border-right")>-1||a&&"none"!==a)&&(!a||t.indexOf("border-bottom")>-1||i&&"none"!==i)||e.style.removeProperty(t)}):e.removeAttribute("style")}var o=this.parent.getCell(t-1,r);if(o&&o.style.borderBottom){var s=Number(o.parentElement.getAttribute("aria-rowindex"))-1;(n=this.parent.getCellStyleValue(["borderBottom","border"],[s,r])).borderBottom||n.border||(o.style.borderBottom="")}var l=e.previousElementSibling;l&&l.style.borderRight&&(r=Number(l.getAttribute("aria-colindex"))-1,(n=this.parent.getCellStyleValue(["borderRight","border"],[t,r])).borderRight||n.border||(l.style.borderRight=""))},e.prototype.refreshRange=function(e,t,r,n,i,a,o){var s,l,h=this.parent.getActiveSheet(),d=e.slice();if(st(this.parent,d,!0))for(var p=d[0];p<=d[2];p++)if(!je(h,p))for(var c=d[1];c<=d[3];c++)Qe(h,c)||(l=this.parent.getCell(p,c))&&(s={rowIdx:p,colIdx:c,td:l,cell:Re(p,c,h),isRefreshing:t,lastCell:c===d[3],isRefresh:!0,isHeightCheckNeeded:!0,manualUpdate:!0,first:"",onActionUpdate:n,skipFormatCheck:a},o&&(s.address=g(p,c)),this.update(s),i&&h.conditionalFormats&&h.conditionalFormats.length&&this.parent.notify(Xn,{indexes:[p,c],isAction:!0}),this.parent.notify(Vo,{td:l,rowIndex:p,colIndex:c}),r&&this.setWrapByValue(h,s))},e.prototype.refresh=function(e,t,r,n,i,a,o,s){var l=this.parent.getActiveSheet();if((n||!je(l,e)&&!Qe(l,t))&&(n||!this.parent.scrollSettings.enableVirtualization||this.parent.insideViewport(e,t))){var h=n||this.parent.getCell(e,t);if(!h)return;var d={rowIdx:e,colIdx:t,td:h,cell:Re(e,t,l),isRefresh:!0,lastCell:r,isHeightCheckNeeded:!0,manualUpdate:!0,first:"",skipFormatCheck:o,isRandomFormula:s};this.update(d),i&&l.conditionalFormats&&l.conditionalFormats.length&&this.parent.notify(Xn,{indexes:[e,t],isAction:!0}),this.parent.notify(Vo,{td:h,rowIndex:e,colIndex:t}),a&&this.setWrapByValue(l,d)}},e.prototype.updateView=function(e){if(t.isNullOrUndefined(e.sheetIndex)||e.sheetIndex===this.parent.activeSheetIndex){if(!e.indexes){var r=this.parent.getActiveSheet(),n=this.parent.frozenRowCount(r),i=this.parent.frozenColCount(r),a=c(r.topLeftCell);n&&i&&this.refreshRange([a[0],a[1],n-1,i-1],e.refreshing,e.checkWrap,!1,e.checkCF),n&&this.refreshRange([a[0],this.parent.viewport.leftIndex+i,n-1,this.parent.viewport.rightIndex],e.refreshing,e.checkWrap,!1,e.checkCF),i&&this.refreshRange([this.parent.viewport.topIndex+n,a[1],this.parent.viewport.bottomIndex,i-1],e.refreshing,e.checkWrap,!1,e.checkCF),e.indexes=[this.parent.viewport.topIndex+n,this.parent.viewport.leftIndex+i,this.parent.viewport.bottomIndex,this.parent.viewport.rightIndex]}this.refreshRange(e.indexes,e.refreshing,e.checkWrap,!1,e.checkCF)}else e.refreshing&&this.calculateFormula({cell:Re(e.indexes[0],e.indexes[1],Ce(this.parent,e.sheetIndex),!0,!0),rowIdx:e.indexes[0],colIdx:e.indexes[1],sheetIndex:e.sheetIndex})},e.prototype.destroy=function(){this.parent.off(bi,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},e}(),Wl=function(){function e(e){this.parent=e,this.addEventListener(),this.instantiateRenderer()}return e.prototype.render=function(){this.parent.setProperties({activeSheetIndex:this.parent.skipHiddenSheets(this.parent.activeSheetIndex)},!0),this.parent.isMobileView()||(this.parent.notify(Ea,null),this.parent.notify(Ra,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(ka,null):(this.parent.notify(jr,{action:"initSheetInfo"}),this.parent.notify(jr,{action:"initiateDefinedNames"})),this.parent.isMobileView()&&(this.parent.notify(Ra,null),this.parent.notify(Ea,null)),(this.parent.password.length>0||this.parent.isProtected)&&(this.parent.isProtected=!0,this.parent.showSheetTabs&&(this.parent.element.querySelector(".e-add-sheet-tab").setAttribute("disabled","true"),this.parent.element.querySelector(".e-add-sheet-tab").classList.add("e-disabled"))),"None"===this.parent.selectionSettings.mode&&(this.parent.allowAutoFill=!1),this.setSheetPanelSize(),this.renderSheet(e),this.checkTopLeftCell(!this.parent.refreshing)},e.prototype.checkTopLeftCell=function(e,t,r,n,i,a){var o=this.parent.getActiveSheet();this.parent.showSpinner();var s,l="A1"===o.topLeftCell,h=u(o.topLeftCell);if(o.topLeftCell!==o.paneTopLeftCell&&(o.frozenRows||o.frozenColumns)){var d=u(o.paneTopLeftCell);s=this.parent.scrollSettings.enableVirtualization,l=o.frozenRows&&o.frozenColumns?h[0]+o.frozenRows===d[0]&&h[1]+o.frozenColumns===d[1]:o.frozenRows?h[0]+o.frozenRows===d[0]&&0===h[1]:h[1]+o.frozenColumns===d[1]&&0===h[0],h[0]&&d[0]>h[0]?this.parent.viewport.beforeFreezeHeight=Ye(o,0,h[0]-1,!0):this.parent.viewport.beforeFreezeHeight=0,h[1]&&d[1]>h[1]?this.parent.viewport.beforeFreezeWidth=Ze(o,0,h[1]-1,!0):this.parent.viewport.beforeFreezeWidth=0}else this.parent.viewport.beforeFreezeHeight=this.parent.viewport.beforeFreezeWidth=0;var p=this.parent.frozenRowCount(o),c=this.parent.frozenColCount(o);if(!this.parent.scrollSettings.enableVirtualization||l)this.refreshUI({rowIndex:h[0],colIndex:h[1],refresh:"All"},null,e,t,i,a),s&&(this.parent.viewport.topIndex=$(o,p,!0)-p,this.parent.viewport.leftIndex=$(o,c,!0,"columns")-c);else{var f=o.paneTopLeftCell===o.topLeftCell?h:u(o.paneTopLeftCell),g={preventScroll:!0};g.scrollTop=r||(f[0]>p?Ye(o,p,f[0]-1,!0):0),g.scrollLeft=n||(f[1]>c?Ze(o,c,f[1]-1,!0):0),this.parent.notify(bo,g);var m=this.parent.getThreshold("row"),v=o.frozenRows?h[0]:h[0]>m?$(o,h[0]-m,!0):0,y=[];o.frozenRows&&y.push(f[0]-m>p?f[0]-m:p),m=this.parent.getThreshold("col");var C=o.frozenColumns?h[1]:h[1]>m?$(o,h[1]-m,!0,"columns"):0;o.frozenColumns?(y.length||y.push(p),y.push(f[1]-m>c?f[1]-m:c)):y.length&&y.push(c),this.refreshUI({rowIndex:v,colIndex:C,refresh:"All",top:g.scrollTop,left:g.scrollLeft,frozenIndexes:y},null,e,t,i,a),s&&(p&&y[0]>=p&&(this.parent.viewport.topIndex=$(o,y[0],!0)-p),c&&y[1]>=c&&(this.parent.viewport.leftIndex=$(o,y[1],!0,"columns")-c))}},e.prototype.renderSheet=function(e){void 0===e&&(e=document.getElementById(this.parent.element.id+"_sheet_panel")),e.appendChild(this.parent.createElement("div",{className:"e-sheet",id:this.parent.element.id+"_sheet",styles:"background-color: #fff"})),this.parent.serviceLocator.getService("sheet").renderPanel()},e.prototype.refreshUI=function(e,r,n,i,a,o){var s=this;"All"!==e.refresh&&this.parent.showSpinner();var l=this.parent.serviceLocator.getService("sheet"),h=this.parent.getActiveSheet(),d=we(this.parent),p={rowCount:h.rowCount,colCount:h.colCount};if(e.frozenIndexes=e.frozenIndexes?e.frozenIndexes:[],!r)if(this.parent.scrollSettings.enableVirtualization){var c=e.rowIndex+this.parent.viewport.rowCount+2*this.parent.getThreshold("row"),f=e.colIndex+this.parent.viewport.colCount+2*this.parent.getThreshold("col"),m=this.parent.frozenRowCount(h),v=this.parent.frozenColCount(h);e.frozenIndexes.length&&(c+=e.frozenIndexes[0]-m,f+=e.frozenIndexes[1]-v),"Row"===e.refresh?c+=m:c+=h.frozenRows,"Column"===e.refresh?f+=v:f+=h.frozenColumns;var y=e.frozenIndexes[0]>m?e.frozenIndexes[0]:e.rowIndex+("Row"===e.refresh?m:h.frozenRows),C=this.parent.skipHidden(y,c,"rows",!1);if(c=C[1],y!==C[0]){(I=u(h.paneTopLeftCell))[0]===y&&this.parent.updateTopLeftCell(C[0]-m,I[1],"col")}C[0]-=m;var b=h.rowCount-1,x=0,S=e.rowIndex;if(this.parent.scrollSettings.isFinite&&c>b&&(x=c-b,c=$(h,b,!1),C[0]+m>$(h,m,!0))){R=(R=e.rowIndex-x)<0?0:R,R=this.decreaseHidden(R,e.rowIndex-1,m),e.top&&R<e.rowIndex&&this.parent.notify(dl,{height:Ye(h,R+m,e.rowIndex-1+m,!0),isRender:!0}),this.parent.viewport.topIndex=C[0]=R,S="Row"===e.refresh?R:S}"Row"===e.refresh?e.rowIndex=$(h,S+m,!0)-m:S=e.rowIndex=m?$(h,S,!0):C[0];var w=e.frozenIndexes[1]>v?e.frozenIndexes[1]:e.colIndex+("Column"===e.refresh?v:h.frozenColumns);if(C=this.parent.skipHidden(w,f,"columns",!1),f=C[1],w!==C[0]){var I;(I=u(h.paneTopLeftCell))[1]===w&&this.parent.updateTopLeftCell(I[0],C[0]-v,"row")}C[0]-=v,b=h.colCount-1,x=0;var E=e.colIndex;if(this.parent.scrollSettings.isFinite&&f>b&&(x=f-b,f=$(h,b,!1,"columns"),C[0]+v>$(h,v,!0,"columns"))){var R;R=(R=e.colIndex-x)>-1?R:0,R=this.decreaseHidden(R,e.colIndex-1,v,"columns"),e.left&&R<e.colIndex&&this.parent.notify(dl,{width:Ze(h,R+v,e.colIndex-1+v,!0),isRender:!0}),this.parent.viewport.leftIndex=C[0]=R,E="Column"===e.refresh?R:E}"Column"===e.refresh?e.colIndex=$(h,E+v,!0,"columns")-v:E=e.colIndex=v?$(h,E,!0,"columns"):C[0],"Row"===e.refresh&&(S+=m,m&&(c+=u(h.topLeftCell)[0]),f=this.parent.viewport.rightIndex),"Column"===e.refresh&&(E+=v,v&&(f+=u(h.topLeftCell)[1]),c=this.parent.viewport.bottomIndex),this.parent.viewport.topIndex=e.rowIndex,this.parent.viewport.bottomIndex=c,this.parent.viewport.leftIndex=e.colIndex,this.parent.viewport.rightIndex=f,r=g(S,E)+":"+g(c,f)}else"All"===e.refresh&&this.updateTopLeftScrollPosition(t.extend(e,{sheet:h})),this.parent.viewport.bottomIndex=h.rowCount-1,this.parent.viewport.rightIndex=h.colCount-1,r=g(e.rowIndex,e.colIndex)+":"+g(this.parent.viewport.bottomIndex,this.parent.viewport.rightIndex);"All"===e.refresh&&this.parent.trigger("beforeDataBound",{});var k=this.parent.isOpen||this.parent.refreshing;Ft(this.parent.getMainContent(),{busy:!0});var F=this.parent.sheets.length;he(this.parent,d+"!"+r,null,null,e.frozenIndexes).then(function(t){if(s.parent&&!(F<s.parent.sheets.length)){var d=s.parent.sheets.indexOf(h);if(a||-1!==d&&d===s.parent.activeSheetIndex){var c,f=[e.rowIndex,e.colIndex].concat(u(r.split(":")[1]));switch(e.refresh){case"All":l.renderTable({cells:t,indexes:f,top:e.top,left:e.left,initLoad:n,isRefreshing:i,isOpen:k,openOptions:o});break;case"Row":l.refreshRowContent({cells:t,indexes:f,skipUpdateOnFirst:e.skipUpdateOnFirst,prevRowColCnt:p}),c={isEdit:!1},s.parent.notify(Aa,c),c.isEdit&&s.parent.notify(Da,{action:"startEdit",refreshCurPos:!1});break;case"Column":l.refreshColumnContent({cells:t,indexes:f,skipUpdateOnFirst:e.skipUpdateOnFirst,prevRowColCnt:p,insertDelete:e.insertDelete});break;case"RowPart":l.updateRowContent({cells:t,indexes:f,direction:e.direction,skipUpdateOnFirst:e.skipUpdateOnFirst,prevRowColCnt:p});break;case"ColumnPart":l.updateColContent({cells:t,indexes:f,direction:e.direction,skipUpdateOnFirst:e.skipUpdateOnFirst,prevRowColCnt:p})}s.parent&&s.parent.isReact&&s.parent.renderReactTemplates()}else d>-1&&s.checkTopLeftCell()}}),this.parent.notify(za,{refresh:e.refresh,skipTranslate:e.skipTranslate})},e.prototype.updateTopLeftScrollPosition=function(e){var t=u(e.sheet.topLeftCell),r=u(e.sheet.paneTopLeftCell);if(e.sheet.frozenRows){var n=this.parent.frozenRowCount(e.sheet);r[0]>n&&(e.top=Ye(e.sheet,n,r[0]-1,!0))}else e.rowIndex&&(e.rowIndex=0),0!==t[0]&&(e.top=Ye(e.sheet,0,t[0]-1,!0));if(e.sheet.frozenColumns){var i=this.parent.frozenColCount(e.sheet);r[1]>i&&(e.left=Ze(e.sheet,i,r[1]-1,!0))}else e.colIndex&&(e.colIndex=0),0!==t[1]&&(e.left=Ze(e.sheet,0,t[1]-1,!0))},e.prototype.removeSheet=function(){t.remove(document.getElementById(this.parent.element.id+"_sheet"))},e.prototype.refreshSheet=function(e,t,r,n,i){var a=0,o=0;if(t){var s=this.parent.element.getElementsByClassName("e-main-panel")[0];s&&(a=s.scrollTop);var l=this.parent.getMainContent();l&&(o=l.scrollLeft)}this.removeSheet(),this.renderSheet(),this.parent.notify(xo,{}),this.checkTopLeftCell(!1,e,a,o,n,i),r&&Wt(this.parent.element)},e.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-at(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)},e.prototype.roundValue=function(e,t){var r=e/t,n=Math.round(r);return Math.abs(r-n)<.5?n:n-1},e.prototype.moveOrDuplicateSheetHandler=function(e){this.parent.notify(Fa,null),e.refresh&&this.refreshSheet(e.isDuplicate)},e.prototype.decreaseHidden=function(e,t,r,n){void 0===n&&(n="rows"),e+=r,t+=r;for(var i=this.parent.getActiveSheet(),a=t;a>=e;a--)if(i[""+n][a]&&i[""+n][a].hidden&&--e<r){e=$(i,r,!0,n);break}return e-r},e.prototype.instantiateRenderer=function(){this.parent.serviceLocator.register("cell",new ql(this.parent)),this.parent.serviceLocator.register("row",new jl(this.parent)),this.parent.serviceLocator.register("sheet",new zl(this.parent))},e.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},e.prototype.addEventListener=function(){this.parent.on(Ta,this.destroy,this),this.parent.on(ci,this.moveOrDuplicateSheetHandler,this),this.parent.on(pl,this.updateTopLeftScrollPosition,this)},e.prototype.removeEventListener=function(){this.parent.off(Ta,this.destroy),this.parent.off(ci,this.moveOrDuplicateSheetHandler),this.parent.off(pl,this.updateTopLeftScrollPosition)},e}(),Gl=function(e,t,r,n){return new(r||(r=Promise))(function(i,a){function o(e){try{l(n.next(e))}catch(e){a(e)}}function s(e){try{l(n.throw(e))}catch(e){a(e)}}function l(e){e.done?i(e.value):new r(function(t){t(e.value)}).then(o,s)}l((n=n.apply(e,t||[])).next())})},Yl=function(e,t){function r(r){return function(o){return function(r){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,i&&(a=2&r[0]?i.return:r[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,r[1])).done)return a;switch(i=0,a&&(r=[2&r[0],a.value]),r[0]){case 0:case 1:a=r;break;case 4:return s.label++,{value:r[1],done:!1};case 5:s.label++,i=r[1],r=[0];continue;case 7:r=s.ops.pop(),s.trys.pop();continue;default:if(a=s.trys,!(a=a.length>0&&a[a.length-1])&&(6===r[0]||2===r[0])){s=0;continue}if(3===r[0]&&(!a||r[1]>a[0]&&r[1]<a[3])){s.label=r[1];break}if(6===r[0]&&s.label<a[1]){s.label=a[1],a=r;break}if(a&&s.label<a[2]){s.label=a[2],s.ops.push(r);break}a[2]&&s.ops.pop(),s.trys.pop();continue}r=t.call(e,s)}catch(e){r=[6,e],i=0}finally{n=a=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}([r,o])}}var n,i,a,o,s={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return o={next:r(0),throw:r(1),return:r(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o},Xl=function(){function e(e){this.parent=e,this.init(),this.addEventListener()}return e.prototype.init=function(){this.parent.element.appendChild(this.parent.createElement("input",{className:"e-clipboard",attrs:{contenteditable:"true",tabindex:"-1","aria-hidden":"true"}}))},e.prototype.addEventListener=function(){var e=this.getClipboardEle();this.parent.on(to,this.cut,this),this.parent.on(ro,this.copy,this),this.parent.on(no,this.paste,this),this.parent.on(io,this.clearCopiedInfo,this),this.parent.on(Qa,this.tabSwitchHandler,this),this.parent.on(Ga,this.cMenuBeforeOpenHandler,this),this.parent.on($a,this.ribbonClickHandler,this),this.parent.on(Na,this.initCopyIndicator,this),this.parent.on(yo,this.rowHeightChanged,this),this.parent.on(Co,this.colWidthChanged,this),this.parent.on(Ci,this.refreshOnInsertDelete,this),t.EventHandler.add(e,"cut",this.cut,this),t.EventHandler.add(e,"copy",this.copy,this),t.EventHandler.add(e,"paste",this.paste,this)},e.prototype.removeEventListener=function(){var e=this.getClipboardEle();this.parent.isDestroyed||(this.parent.off(to,this.cut),this.parent.off(ro,this.copy),this.parent.off(no,this.paste),this.parent.off(io,this.clearCopiedInfo),this.parent.off(Qa,this.tabSwitchHandler),this.parent.off(Ga,this.cMenuBeforeOpenHandler),this.parent.off($a,this.ribbonClickHandler),this.parent.off(Na,this.initCopyIndicator),this.parent.off(yo,this.rowHeightChanged),this.parent.off(Co,this.colWidthChanged),this.parent.off(Ci,this.refreshOnInsertDelete)),t.EventHandler.remove(e,"cut",this.cut),t.EventHandler.remove(e,"copy",this.copy),t.EventHandler.remove(e,"paste",this.paste)},e.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})}},e.prototype.tabSwitchHandler=function(e){0!==e.activeTab||this.copiedInfo||this.copiedShapeInfo||this.hidePaste()},e.prototype.cMenuBeforeOpenHandler=function(e){var t=this.parent.getActiveSheet(),r=this.parent.serviceLocator.getService(Fl),n=[],i=[],a=[],o=[],s=u(t.activeCell),l=Re(s[0],s[1],t),h=t.isProtected&&Y(l,Xe(t,s[1]));"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&&!h)),this.parent.enableContextMenuItems([r.getConstant("Cut")],!h)),"Content"===e.target&&(h?this.parent.enableContextMenuItems([r.getConstant("Cut"),r.getConstant("Filter"),r.getConstant("Sort"),r.getConstant("Hyperlink")],!1):t.isProtected&&!t.protectSettings.insertLink&&this.parent.enableContextMenuItems([r.getConstant("Hyperlink")],!1)),t.isProtected&&("ColumnHeader"===e.target&&(a=[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(a,!1),this.parent.enableContextMenuItems(o,t.protectSettings.formatColumns)),"RowHeader"===e.target&&(n=[r.getConstant("DeleteRow"),r.getConstant("DeleteRows"),r.getConstant("InsertRow"),r.getConstant("InsertRows")],i=[r.getConstant("HideRow"),r.getConstant("HideRows"),r.getConstant("UnhideRows")],this.parent.enableContextMenuItems(n,!1),this.parent.enableContextMenuItems(i,t.protectSettings.formatRows)))},e.prototype.rowHeightChanged=function(e){if(this.copiedInfo){var t=this.getCopyIndicator();t&&(this.copiedInfo.range[0]>e.rowIdx?t.style.top=parseFloat(t.style.top)+e.threshold+"px":j(this.copiedInfo.range,e.rowIdx,this.copiedInfo.range[1])&&(t.style.height=parseFloat(t.style.height)+e.threshold+"px"))}},e.prototype.colWidthChanged=function(e){if(this.copiedInfo){var t=this.getCopyIndicator();t&&(this.copiedInfo.range[1]>e.colIdx?t.style.left=parseFloat(t.style.left)+e.threshold+"px":j(this.copiedInfo.range,this.copiedInfo.range[0],e.colIdx)&&(t.style.width=parseFloat(t.style.width)+e.threshold+"px"))}},e.prototype.cut=function(e){this.setCopiedInfo(e,!0)},e.prototype.copy=function(e){this.setCopiedInfo(e,!1)},e.prototype.paste=function(e){if(this.parent.isEdit||this.parent.element.getElementsByClassName("e-dlg-overlay").length>0){this.parent.element.getElementsByClassName("e-spreadsheet-edit")[0].style.height="auto"}else{var r,n=e&&e.clipboardData||window.clipboardData;if(!(n&&e.clipboardData&&e.clipboardData.getData("isInternalCut").length)||this.copiedInfo)if(n||this.copiedShapeInfo||e.isInternal&&this.copiedInfo){e.isInternal=!n;var i=void 0,a=this.getCopiedIdx();e.isAction=!!n||e.isAction;var o=e&&e.sIdx>-1?e.sIdx:this.parent.activeSheetIndex,s=Ce(this.parent,o),l=w(e&&e.range||c(s.selectedRange)),h=void 0,d=void 0;if(n){if(h=this.getExternalCells(e),d=h.model,!e.isInternal&&h.internal&&(n=!1,!this.copiedInfo))return;if(!d||!d.length){if(h.file)return void this.parent.notify(ks,{file:h.file});if(!this.copiedInfo)return;n=!1}}h=h;var p=Object.assign({isExternal:n},this.copiedInfo),u=void 0,f=void 0,g=void 0,v=void 0,y=void 0,C=void 0,b=void 0,x=void 0,S=void 0;n?(f=o,b=Ce(this.parent,f),g={},y="Sheet"!==(C=h.selection)&&(l[2]-l[0]+1)%h.rowCount==0&&(l[3]-l[1]+1)%h.colCount==0,u=[0,0,h.usedRowIndex,h.usedColIndex]):(f=a,g=Xe(s,(u=w(this.copiedShapeInfo?c(s.selectedRange):this.copiedInfo.range))[1]),v=E(u)&&this.isRangeMerged(l,s),b=Ce(this.parent,f),y=!v&&(l[2]-l[0]+1)%(u[2]-u[0]+1)==0&&(l[3]-l[1]+1)%(u[3]-u[1]+1)==0,b&&(x=0===u[1]&&u[3]===b.colCount-1,S=0===u[0]&&u[2]===b.rowCount-1,x?S?(C="Sheet",u[2]=b.usedRange.rowIndex,u[3]=b.usedRange.colIndex):(C="Row",u[3]=b.usedRange.colIndex):S&&(C="Column",u[2]=b.usedRange.rowIndex))),r=y?l:[l[0],l[1]].concat([l[0]+u[2]-u[0],l[1]+u[3]-u[1]||l[1]]),C&&(("Sheet"===C||"Column"===C)&&r[2]<s.usedRange.rowIndex&&(r[2]=s.usedRange.rowIndex),("Sheet"===C||"Row"===C)&&r[3]<s.usedRange.colIndex&&(r[3]=s.usedRange.colIndex));var I=e&&e.type||"All";if(e.isAction&&!this.copiedShapeInfo){var R={requestType:"paste",copiedInfo:this.copiedInfo,copiedRange:m(u),pastedRange:m(r),type:I,cancel:!1};if(this.parent.notify(Ar,{eventArgs:R,action:"clipboard"}),R.cancel)return;l=c(R.pastedRange),r=(y=n?"Sheet"!==h.selection&&(l[2]-l[0]+1)%h.rowCount==0&&(l[3]-l[1]+1)%h.colCount==0:!v&&(l[2]-l[0]+1)%(u[2]-u[0]+1)==0&&(l[3]-l[1]+1)%(u[3]-u[1]+1)==0)?l:[l[0],l[1]].concat([l[0]+u[2]-u[0],l[1]+u[3]-u[1]||l[1]]),I=R.type}var k=void 0;C?(k=[].concat(r),"Sheet"!==C&&"Column"!==C||(r[2]<s.usedRange.rowIndex&&(r[2]=s.usedRange.rowIndex),u[2]<s.usedRange.rowIndex&&(u[2]+=s.usedRange.rowIndex-u[2]),k[2]<s.rowCount&&(k[2]=s.rowCount-1)),"Sheet"!==C&&"Row"!==C||(r[3]<s.usedRange.colIndex&&(u[3]+=s.usedRange.colIndex-r[3],r[3]=s.usedRange.colIndex),u[3]<s.usedRange.colIndex&&(u[3]+=s.usedRange.colIndex-u[3]),k[3]<s.colCount&&(k[3]=s.colCount-1))):k=r;var F=void 0,A=void 0,N=void 0,O=l[0],T=[];if(s.isProtected&&Gt(this.parent,r))return void this.parent.notify(ss,null);if(this.copiedShapeInfo&&!this.copiedInfo){var D=this.copiedShapeInfo.pictureElem;D.classList.contains("e-datavisualization-chart")?(this.copiedShapeInfo.chartInfo.top=null,this.copiedShapeInfo.chartInfo.left=null,this.parent.notify(Jn,{chart:[this.copiedShapeInfo.chartInfo],isInitCell:!0,isUndoRedo:!0,isPaste:!0,dataSheetIdx:this.copiedShapeInfo.sheetIdx,isCut:this.copiedShapeInfo.isCut,range:e.range||s.selectedRange,sheetId:s.id})):this.parent.notify(Ts,{options:{src:D.style.backgroundImage.replace(/url\((['"])?(.*?)\1\)/gi,"$2"),height:this.copiedShapeInfo.height,width:this.copiedShapeInfo.width,imageId:this.copiedShapeInfo.isCut?D.id:""},range:m([O,l[1],O,l[1]]),isPublic:!1,isUndoRedo:!0});var L=Re(O,l[1],s);if(L&&!t.isNullOrUndefined(L.image)&&L.image.length>0){var P={requestType:"imagePaste",copiedShapeInfo:this.copiedShapeInfo,pasteSheetIndex:this.parent.activeSheetIndex,pastedRange:we(this.parent)+"!"+m([O,l[1],O,l[1]]),pastedPictureElement:document.getElementById(L.image[L.image.length-1].id)};this.parent.notify(Yo,{eventArgs:P,action:"clipboard"})}}else{var M=[],H=this.isInRange(u,l,a),B=!1,U=!1,V=0,_=[];y||"Values"===I||this.setCF(u,r,b,s,_);for(var z=void 0,q=!1,W=[],G={sheet:s,isExternal:!!n},Y=this.setCell(G),X=!n&&this.copiedInfo.isCut&&this.setCell({sheet:b}),K=u[0],$=0;K<=u[2];K++,$++)if(n||p.isCut||!qe(b,K)){H&&(M[l[0]+$]={cells:[]});for(var Z=u[1],J=0;Z<=u[3];Z++,J++){if(H&&(M[l[0]+$].cells[l[1]+J]=Re(l[0]+$,l[1]+J,b,!1,!0)),F=n?d[K]&&d[K].cells[Z]||{}:t.extend({},H&&M[K]&&M[K].cells[Z]?M[K].cells[Z]:Re(K,Z,b),null,!0),g=Xe(s,Z),!F.validation&&g.validation&&(F.validation=g.validation),x||S){if(F&&F.rowSpan)if(F.rowSpan>0)F.rowSpan+K-1<=u[2]?B=!0:F={};else if(B){if(F.rowSpan<0){var ee=F.rowSpan,te=F.colSpan?F.colSpan:0,re=Re(O+ee,l[1]+J+te,s);re&&!re.rowSpan&&(F={})}}else F={};F&&F.colSpan&&(F.colSpan>0?F.colSpan+Z-1<=u[3]?U=!0:F={}:U||(F={}))}if(F&&I){var ne=void 0;switch(I){case"Formats":ne={format:F.format,style:F.style},this.copiedInfo&&!this.copiedInfo.isCut&&(F.rowSpan&&(ne.rowSpan=F.rowSpan),F.colSpan&&(ne.colSpan=F.colSpan)),F=ne;break;case"Values":if((F={value:F.value}).value&&F.value.toString().indexOf("\n")>-1){this.parent.getCell(l[0],l[1]).classList.add("e-alt-unwrap")}}A=["Formats","Values"].indexOf(I)>-1}if(!this.parent.scrollSettings.isFinite&&(u[2]-u[0]>1048575-l[0]||u[3]-u[1]>16383-l[1])||this.parent.scrollSettings.isFinite&&(u[2]-u[0]>s.rowCount-1-l[0]||u[3]-u[1]>s.colCount-1-l[1]))return void this.showDialog();if(y){for(var ie=l[0];ie<=l[2];ie+=u[2]-u[0]+1)if(p.isCut||V||!qe(s,ie+$))for(var ae=l[1];ae<=l[3];ae+=u[3]-u[1]+1){if(K!==u[0]||Z!==u[1]||void 0!==z&&!z.length||"Values"===I||(z=this.setCF(u,[ie,ae,ie+(u[2]-u[0]),ae+(u[3]-u[1])],b,s,_,z)),N=Re(ie+$,ae+J,s,!1,!0),!(n||t.isNullOrUndefined(N.colSpan)&&t.isNullOrUndefined(N.rowSpan))){if(x||S)continue;var oe={range:[ie+$,ae+J,ie+$,ae+J],merge:!1,isAction:!1,type:"All",sheetIndex:o,preventRefresh:o!==this.parent.activeSheetIndex};T.push(oe),this.parent.notify(_n,oe)}var se=ae+J;if(F=t.extend({},F||{},null,!0),!A&&this.copiedInfo&&!this.copiedInfo.isCut&&F.formula){var le=Q([ie+$,se],[K,Z],b,this.parent,H?F:null);t.isNullOrUndefined(le)||(F.formula=le)}s.isProtected&&F&&!1!==F.isLocked&&(F.isLocked=N.isLocked),N&&N.formula&&N.formula.indexOf("=UNIQUE(")>-1&&this.parent.notify(rn,null);var he={cellIdx:[K,Z],isUnique:!1,uniqueRange:"",sheetName:b.name};this.parent.notify(nn,he),he.isUnique&&(F.value=null),q=!1,F&&F.formula&&F.formula.indexOf("=UNIQUE(")>-1&&(q=!0,W.push([ie,se]),F.value=null),Y(ie+$,se,F,se===l[3],A,q)||F.formula&&this.copiedInfo&&this.copiedInfo.isCut&&this.parent.notify(on,{cellRef:m([K,Z,K,Z])})}}else!n&&Lt(this.parent,K,Z,a)||(v?Y(O,l[1]+J,{value:F.value},Z===u[3],!0):Y(O,l[1]+J,F,Z===u[3],A));if(!n&&this.copiedInfo.isCut&&(!j(l,K,Z)||a!==this.parent.activeSheetIndex)){var de=Re(K,Z,b);if(de)if(de.isLocked||t.isNullOrUndefined(de.isLocked))if(!x&&!S||void 0===de.rowSpan&&void 0===de.colSpan)de=null;else{if(!(de.rowSpan>1||de.colSpan>1))continue;this.parent.notify(_n,{merge:!1,range:[K,Z,K,Z],type:"All"}),de=null}else!1===de.isLocked&&(de=b.isProtected?{isLocked:!1}:null);X(K,Z,de,Z===u[3])}}O++}else $--,V++;if(W.length)for(K=0;K<W.length;K++)this.parent.serviceLocator.getService("cell").refresh(W[K][0],W[K][1]);G.isRandFormula&&this.parent.notify(jr,{action:"refreshRandomFormula"}),this.parent.notify(ti,null);var pe=r[2]-V,ce=k[2]-V;r[2]=pe,k[2]=ce,this.parent.setUsedRange(r[2],r[3]);var ue=m(k);o!==this.parent.activeSheetIndex||e.isFromUpdateAction||this.parent.notify(Ja,{address:ue}),!n&&this.copiedInfo.isCut&&(i=this.copiedInfo.isCut,a===this.parent.activeSheetIndex&&this.parent.serviceLocator.getService("cell").refreshRange(u),this.clearCopiedInfo()),(n||H)&&this.copiedInfo&&this.clearCopiedInfo();var fe=void 0;if(i){z&&z.length&&"Values"!==I&&(fe={range:u,sheetIdx:f,isClear:!0},this.parent.notify(Kn,fe)),jt(b,u[0],u[1],(this.parent.getRow(u[0],null,this.parent.frozenColCount(b))||{offsetHeight:20}).offsetHeight);var ge=qt(b,u[0]);Pt(this.parent,b,ge,u[0])}_.length&&o===this.parent.activeSheetIndex&&this.parent.notify(Xn,{cfModel:_,isAction:!0});var me=Ce(this.parent,a);if(!n&&u[0]===u[2]&&"Row"===C){for(ge=me.rows[u[0]].height,K=l[0];K<=l[2];K++)Pt(this.parent,this.parent.getActiveSheet(),ge,K);i&&Pt(this.parent,me,20,u[0])}if(e.isAction){P={requestType:"paste",copiedInfo:p,mergeCollection:T,pasteSheetIndex:this.parent.activeSheetIndex,copiedRange:b.name+"!"+(p.range?m(p.range):b.selectedRange),pastedRange:s.name+"!"+m(r),type:I||"All",selectedRange:ue};V&&(P.skipFilterCheck=!0),fe&&fe.cfClearActionArgs&&(P.cfClearActionArgs=fe.cfClearActionArgs),_.length&&(P.cfActionArgs={cfModel:_,sheetIdx:o}),this.parent.notify(Yo,{eventArgs:P,action:"clipboard"})}e.focus&&Wt(this.parent.element)}}else this.getClipboardEle().select()}},e.prototype.setCF=function(e,t,r,n,i,a){var o,s,l=this,h=function(r){o=[t[0]+(s[0]<=e[0]?0:s[0]-e[0]),t[1]+(s[1]<=e[1]?0:s[1]-e[1]),t[2]-(s[2]>=e[2]?0:e[2]-s[2]),t[3]-(s[3]>=e[3]?0:e[3]-s[3])],n.conditionalFormats||l.parent.setSheetPropertyOnMute(n,"conditionalFormats",[]);var a={range:m(o),type:r.type,cFColor:r.cFColor,value:r.value,format:r.format};n.conditionalFormats.push(a),i.push(a)};if(a)for(var d=0,p=a.length;d<p;d++)s=c(a[d].range),h(a[d]);else if(a=[],r.conditionalFormats)for(d=0,p=r.conditionalFormats.length;d<p;d++)s=c(r.conditionalFormats[d].range),ie([e],r.conditionalFormats[d].range)&&(a.push(r.conditionalFormats[d]),h(r.conditionalFormats[d]));return a},e.prototype.isRangeMerged=function(e,t){var r=Re(e[0],e[1],t);if(r&&(r.colSpan>1||r.rowSpan>1)){var n={range:e.slice(2,4).concat(e.slice(2,4))};return this.parent.notify(qn,n),n.range[0]===e[0]&&n.range[1]===e[1]&&n.range[2]===e[2]&&n.range[3]===e[3]}return!1},e.prototype.updateFilter=function(e,t){var r,n;this.parent.notify(Dr,null);for(var i=0;i<this.parent.sheets.length;i++)if(this.parent.filterCollection&&this.parent.filterCollection[i]&&this.parent.filterCollection[i].sheetIndex===ue(this.parent,e.sId)){var a=e.range,o=c(this.parent.filterCollection[i].filterRange);a=w(a),o[0]===a[0]&&o[2]===a[2]&&o[1]===a[1]&&o[3]===a[3]&&(r=!0,n=[Math.abs(a[0]-o[0]),Math.abs(a[1]-o[1]),Math.abs(a[2]-o[2]),Math.abs(a[3]-o[3])])}var s=this.parent.getCell(e.range[0],e.range[1]),l=(s=s?s.querySelector(".e-filter-icon")?s:this.parent.getCell(e.range[2],e.range[3]):s)?s.querySelector(".e-sortasc-filter"):s,h=s?s.querySelector(".e-sortdesc-filter"):s;if(r)for(var d=0;d<this.parent.filterCollection.length;d++){var p=this.parent.filterCollection[d],u=e&&e.sId?ue(this.parent,e.sId):this.parent.activeSheetIndex;if(p.sheetIndex===u&&this.parent.notify(Uo,{predicates:null,range:p.filterRange,sIdx:u,isCut:!0}),p.sheetIndex===u&&u===this.parent.activeSheetIndex&&(n=[t[0]+n[0],t[1]+n[1],Math.abs(t[2]-n[2]),Math.abs(t[3]-n[3])],this.parent.notify(Uo,{predicates:null,range:m(n),sIdx:null,isCut:!0}),e.range[3]===e.range[1])){var f=this.parent.getCell(t[0],t[1]);l&&f&&f.querySelector(".e-filter-icon").classList.add("e-sortasc-filter"),h&&f&&f.querySelector(".e-filter-icon").classList.add("e-sortdesc-filter")}}},e.prototype.isInRange=function(e,t,r){var n=this.parent.activeSheetIndex;return j(e,t[0],t[1])&&r===n||j(e,t[2],t[3])&&r===n},e.prototype.setCell=function(e){var t=this,r=e.sheet,n=r.name===this.parent.getActiveSheet().name;return function(i,a,o,s,l,h){o&&o.formula&&(o.formula.indexOf("RANDBETWEEN(")>-1||o.formula.indexOf("RAND(")>-1||o.formula.indexOf("NOW(")>-1)&&(e.isRandFormula=!0);var d=J(t.parent,r,{cell:o,rowIdx:i,colIdx:a,pvtExtend:!l,valChange:!h,lastCell:s,uiRefresh:n,requestType:"paste",skipFormatCheck:!e.isExternal,isRandomFormula:e.isRandFormula});if(!d&&o){if(o.validation){var p=g(i,a);t.parent.dataValidationRange+=p+":"+p+","}if(o.style&&e.isExternal){var c=zt(t.parent,i,a,r,o.style||t.parent.cellStyle,o.wrap?Ut(t.parent.getDisplayText(o),_t(r,i,a),o.style,t.parent.cellStyle):1);(c=Math.round(c))<20&&(c=20),jt(r,i,a,c);var u=Ye(r,i),f=qt(r,i);f>u&&Pt(t.parent,r,f,i)}}return d}},e.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},e.prototype.setCopiedInfo=function(e,n){var i=this;if(!this.parent.isEdit){var a=new r.Deferred;e.promise=a.promise;var o,s=this.parent.getActiveSheet();if(e&&e.range){var l=0===e.range[1]&&e.range[3]===s.colCount-1,h=0===e.range[0]&&e.range[2]===s.rowCount-1,d={range:e.range};l||h||this.parent.notify(jn,d),o=d.range}else o=c(s.selectedRange);if(e&&!e.isPublic&&!e.clipboardData){var p={copiedRange:s.name+"!"+m(o),cancel:!1,action:n?"cut":"copy"};if(this.parent.notify(Ar,p),p.cancel)return}var u={sheet:s,indexes:[0,0,s.rowCount-1,s.colCount-1],isFinite:this.parent.scrollSettings.isFinite,promise:new Promise(function(e,t){e(void 0)})},f=document.getElementsByClassName("e-ss-overlay-active"),g=f.length;!s.isLocalData||e&&e.clipboardData||0!==o[0]||o[2]!==s.rowCount-1||g||(this.parent.showSpinner(),this.parent.notify("updateSheetFromDataSource",u)),this.checkForUncalculatedFormula(o,e&&e.sId?e.sId:s.id),u.promise.then(function(){if(g>0){var r={clientY:f[0].offsetTop,isImage:!0};i.parent.notify(Ns,r);var l={clientX:f[0].offsetLeft,isImage:!0};if(i.parent.notify(Os,l),i.copiedShapeInfo={sId:e&&e.sId?e.sId:s.id,sheetIdx:s.index,isCut:n,pictureElem:f[0],copiedRange:m([r.clientY,l.clientX,r.clientY,l.clientX]),height:f[0].offsetHeight,width:f[0].offsetWidth,chartInfo:i.getChartElemInfo(f[0])},!f[0].classList.contains("e-datavisualization-chart")){var h=window.getComputedStyle(f[0]).backgroundImage.slice(5,-2);i.addImgToClipboard(h,i.copiedShapeInfo.height,i.copiedShapeInfo.width)}i.hidePaste(!0),n&&(f[0].classList.contains("e-datavisualization-chart")?i.parent.deleteChart(i.copiedShapeInfo.chartInfo.id):i.parent.notify(Ds,{id:i.copiedShapeInfo.pictureElem.id,sheetIdx:i.copiedShapeInfo.sId,range:i.copiedShapeInfo.copiedRange}))}else e&&e.clipboardData||(i.copiedInfo&&i.clearCopiedInfo(),i.copiedInfo={range:o,sId:e&&e.sId?e.sId:s.id,isCut:n},i.hidePaste(!0),e.isFromUpdateAction||i.initCopyIndicator(),t.Browser.isIE||i.getClipboardEle().select(),e&&e.invokeCopy&&document.execCommand(n?"cut":"copy"),i.parent.hideSpinner());t.Browser.isIE&&i.setExternalCells(e,n),a.resolve()}),e&&e.clipboardData&&(this.setExternalCells(e,n),this.getClipboardEle().setAttribute("aria-label",s.selectedRange+" "+this.parent.serviceLocator.getService(Fl).getConstant(n?"Cut":"Copy")))}},e.prototype.imageToCanvas=function(e,t,r){return new Promise(function(n){var i=document.createElement("canvas"),a=i.getContext("2d"),o=new Image;o.src=e,o.crossOrigin="anonymous",o.onload=function(){i.width=r,i.height=t,a.drawImage(o,0,0,r,t),i.toBlob(function(e){n(e)},"image/png")}})},e.prototype.addImgToClipboard=function(e,t,r){return Gl(this,void 0,void 0,function(){var n,i,a;return Yl(this,function(o){switch(o.label){case 0:return i=window.navigator,[4,this.imageToCanvas(e,t,r)];case 1:return a=o.sent(),[4,i.clipboard.write([new ClipboardItem((n={},n[a.type]=a,n))])];case 2:return o.sent(),[2]}})})},e.prototype.checkForUncalculatedFormula=function(e,r){for(var n,i=ue(this.parent,r),a=Ce(this.parent,i),o=e[0];o<=e[2];o++)for(var s=e[1];s<=e[3];s++)(n=Re(o,s,a,null,!0)).formula&&t.isUndefined(n.value)&&this.parent.notify(jr,{action:"refreshCalculate",value:n.formula,rowIndex:o,colIndex:s,isFormula:B(n.formula),sheetIndex:i})},e.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},e.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())},e.prototype.removeIndicator=function(e){if(e){var r=e.getElementsByClassName("e-copy-indicator")[0];r&&t.detach(r)}},e.prototype.initCopyIndicator=function(){if(this.copiedInfo&&this.parent.getActiveSheet().id===this.copiedInfo.sId){var e=this.parent.createElement("div",{className:"e-copy-indicator"});e.appendChild(this.parent.createElement("div",{className:"e-top"})),e.appendChild(this.parent.createElement("div",{className:"e-bottom"})),e.appendChild(this.parent.createElement("div",{className:"e-left"})),e.appendChild(this.parent.createElement("div",{className:"e-right"})),ht(this.parent,e,this.copiedInfo.range,"e-copy-indicator")}},e.prototype.showDialog=function(){var e=this;this.parent.serviceLocator.getService(Al).show({header:"Spreadsheet",height:205,width:340,isModal:!0,showCloseIcon:!0,content:this.parent.serviceLocator.getService(Fl).getConstant("PasteAlert"),beforeOpen:function(t){var r={dialogName:"PasteDialog",element:t.element,target:t.target,cancel:t.cancel};e.parent.trigger("dialogBeforeOpen",r),r.cancel&&(t.cancel=!0)}})},e.prototype.hidePaste=function(e){this.parent.getActiveSheet().isProtected&&(e=!1),this.parent.notify(Za,[{items:[this.parent.element.id+"_paste"],enable:e||!1}])},e.prototype.setExternalCells=function(e,r){var n,i,a,o="",s=this.parent.getActiveSheet(),l=w(this.copiedInfo.range),h=0===l[1]&&l[3]===s.colCount-1,d=0===l[0]&&l[2]===s.rowCount-1,p='<html><body><table class="e-spreadsheet" xmlns="http://www.w3.org/1999/xhtml"';(h||d)&&(p+=' aria-rowcount="'+s.usedRange.rowIndex+'" aria-colcount="'+s.usedRange.colIndex+'"',p+=' aria-label="'+(h&&d?"Sheet":h?"Row":"Column")+'"'),p+="><tbody>";for(var c=l[0];c<=l[2];c++)if(r||!qe(s,c)){p+="<tr>";for(var u=l[1];u<=l[3];u++)if(!((n=Re(c,u,s,!1,!0)).colSpan<0||n.rowSpan<0)){if(p+="<td",n.colSpan&&(p+=' colspan="'+n.colSpan+'"'),n.rowSpan&&(p+=' rowspan="'+n.rowSpan+'"'),n.style?(a="",n.style.whiteSpace||(a+="white-space:"+(n.wrap?"normal":"nowrap")+";"),n.style.verticalAlign||(a+="vertical-align:bottom;"),Object.keys(n.style).forEach(function(e){var t=e.match(/[A-Z]/);a+=("backgroundColor"===e?"background":t?e.replace(t[0],"-"+t[0].toLowerCase()):e)+":"+("backgroundColor"===e||"color"===e?n.style[""+e].slice(0,7):n.style[""+e])+";"}),p+=a.includes('"')?" style='"+a+"'":' style="'+a+'"'):p+=' style="white-space:'+(n.wrap?"normal":"nowrap")+';vertical-align:bottom;"',t.isNullOrUndefined(n.value))p+="></td>";else{if(i=n.value,n.format&&"General"!==n.format){p+=n.value.toString().includes('"')?" cell-value='"+i+"'":' cell-value="'+n.value+'"',p+=n.format.includes('"')?" num-format='"+n.format+"'":' num-format="'+n.format+'"';var f={formattedText:i,value:i,format:n.format,cell:n,rowIndex:c,colIndex:u};this.parent.notify(Mr,f),i=f.formattedText}p+=">",p+=i,o+=i,p+="</td>"}o+=u===l[3]?"":"\t"}p+="</tr>",o+=c===l[2]?"":"\n"}p+="</tbody></table></body></html>",t.Browser.isIE?(window.clipboardData.setData("text",o),r&&window.clipboardData.setData("isInternalCut",o)):(e.clipboardData.setData("text/html",p),e.clipboardData.setData("text/plain",o),r&&e.clipboardData.setData("isInternalCut",o),e.preventDefault())},e.prototype.getExternalCells=function(e){var r,n,i=this,a=[],o={model:a},s=this.parent.createElement("span"),l=function(){return setTimeout(function(){i.getClipboardEle().innerHTML=""},0)};if(t.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 h=!1;if(!this.copiedInfo.isCut){var d={sheetIdx:ue(this.parent,this.copiedInfo.sId)};if(this.parent.notify(Ko,d),d.isFiltered){var p=d.filterRange,c=this.copiedInfo.range;h=p[0]===c[0]&&p[1]===c[1]&&p[2]===c[2]&&p[3]===c[3]}}if(!h)return l(),{internal:!0}}s.innerHTML=r}if(s.querySelector("table"))this.generateCells(s,o);else if(s.querySelector("img")){var u=s.querySelector("img");this.parent.notify(Ts,{options:{src:u.src,height:u.height,width:u.width},isPublic:!0})}else if(n){var f,g,m,v=[];r&&(g=[].slice.call(s.children));var y=this.cellStyle(s);o.colCount=1,n.split("\n").forEach(function(e){f=null,r&&(m=g.filter(function(t){return t.textContent&&t.textContent.replace(/(\r\n|\n|\r|\s)/gm," ").trim()===e.trim()})[0])&&(f=y(m),g.splice(g.indexOf(m),1)),e.split("\t").forEach(function(e,t){(e||f)&&(v[t]={},f&&(f.whiteSpace&&"nowrap"!==f.whiteSpace?(v[t].wrap=!0,delete f.whiteSpace,Object.keys(f).length&&(v[t].style=f)):v[t].style=f),e&&(B(e)?v[t].formula=e:v[t].value=P(e.trim())))}),a.push({cells:v}),o.colCount=Math.max(o.colCount,v.length),v=[]}),o.rowCount=a.length,o.usedRowIndex=a.length-1,o.usedColIndex=o.colCount-1}else if(e.clipboardData.files&&e.clipboardData.files[0]&&e.clipboardData.files[0].type.includes("image"))return l(),{file:e.clipboardData.files[0]};return l(),o},e.prototype.generateCells=function(e,r){var n=r.model,i=e.querySelector("table"),a=i.classList.contains("e-spreadsheet"),o={},s={};r.usedRowIndex=i.rows.length-1,r.rowCount=i.rows.length,a&&(r.selection=i.getAttribute("aria-label"),r.selection&&("Sheet"===r.selection?(r.usedRowIndex=Number(i.getAttribute("aria-rowcount")),r.usedColIndex=Number(i.getAttribute("aria-colcount"))):"Row"===r.selection?r.usedColIndex=Number(i.getAttribute("aria-colcount")):r.usedRowIndex=Number(i.getAttribute("aria-rowcount"))));var l=[];t.isNullOrUndefined(i)||t.isNullOrUndefined(i.getAttribute("style"))||(l.push(i.getAttribute("style")),this.generateStyles(l,o));var h,d,p,c,u,f,g,m=this.cellStyle(e,a),v=1;r.colCount=1;for(var y=[],C=0,b=r.usedRowIndex;C<=b;C++){h=i.rows[C],t.isNullOrUndefined(h.getAttribute("style"))||(y.push(h.getAttribute("style")),this.generateStyles(y,s)),n[C]||(n[C]={cells:[]}),d=n[C].cells,r.colCount=Math.max(r.colCount,h.cells.length),u=r.usedColIndex<h.cells.length?r.usedColIndex:h.cells.length-1;for(var x=0;x<=u;x++){if(c=h.cells[x],g=x,d[x]&&(x=this.getNewIndex(d,x)),d[x]={},p=p=m(c,s,o),c.textContent=c.textContent.replace(/(\r\n|\n|\r)/gm,""),c.textContent=c.textContent.replace(/\s+/g," "),p.whiteSpace&&"nowrap"!==p.whiteSpace&&(d[x].wrap=!0,delete p.whiteSpace),Object.keys(p).length&&(p.border&&(["borderBottom","borderTop","borderLeft","borderRight"].forEach(function(e){p[""+e]=p.border}),delete p.border),d[x].style=p),c.textContent&&(d[x].value=P(c.textContent.trim())),f=a?"num-format":"number-format",c.getAttribute(f)&&(d[x].format=c.getAttribute(f),d[x].value&&c.getAttribute("cell-value")&&(d[x].value=P(c.getAttribute("cell-value").trim()))),c.getAttribute("colspan")&&parseInt(c.getAttribute("colspan"),10)>1&&(d[x].colSpan=parseInt(c.getAttribute("colspan"),10)),c.getAttribute("rowspan")&&parseInt(c.getAttribute("rowspan"),10)>1&&(d[x].rowSpan=parseInt(c.getAttribute("rowspan"),10)),d[x].colSpan>1&&d[x].rowSpan>1)for(var S=void 0,w=C,I=C+d[x].rowSpan;w<I;w++)for(var E=x,R=x+d[x].colSpan;E<R;E++)w===C&&E===x||(S=d[x].style?{style:t.extend({},d[x].style)}:{},w!==C&&(S.rowSpan=C-w),E!==x&&(S.colSpan=x-E),n[w]||(n[w]={cells:[]}),n[w].cells[E]=S);else if(d[x].colSpan>1)for(w=x+1,I=x+d[x].colSpan;w<I;w++)d[w]={colSpan:x-w,style:t.extend({},p)};else if(d[x].rowSpan>1)for(w=C+1,I=C+d[x].rowSpan;w<I;w++)n[w]||(n[w]={cells:[]}),n[w].cells[x]={rowSpan:C-w,style:t.extend({},p)};x=g}v=Math.max(v,d.length)}r.usedColIndex=v-1},e.prototype.getNewIndex=function(e,t){return e[t]&&(t++,t=this.getNewIndex(e,t)),t},e.prototype.cellStyle=function(e,t){var r,n,i=this;if(!t){r=e.querySelector("style")&&e.querySelector("style").innerHTML;var a=Object.keys(this.parent.commonCellStyle);if(a&&a.length&&r){var o=r.includes("td")?r.split("td")[1]:r;o=o.includes("{")?o.split("{")[1].split("}")[0]:o.split("}")[0],n={};for(var s=0;s<a.length;s++){var l=a[s],h=l.match(/[A-Z]/);h&&(l=l.replace(h[0],"-"+h[0].toLowerCase())),o.indexOf(l)>-1&&(n[a[s]]=o.split(l+":")[1].split(";")[0].trim())}}}return function(e,a,o){var s,l={};if(t){if(!e.getAttribute("style"))return l;s=e.getAttribute("style").split(";")}else{if(s=[],r&&e.className&&r.includes(e.classList[0])){var h=r.split(e.classList[0]);s.push(h[h.length-1].split("{")[1].split("}")[0])}var d=[].slice.call(e.querySelectorAll("*"));d.unshift(e),d.forEach(function(e){e.getAttribute("style")&&s.push(e.getAttribute("style")),"B"===e.tagName&&s.push("font-weight:bold"),"I"===e.tagName&&s.push("font-style:italic"),"U"===e.tagName&&s.push("text-decoration:underline")}),Object.assign(l,o,a,n)}return s.length&&i.generateStyles(s,l),e.querySelector("S")&&(l.textDecoration=l.textDecoration?"underline line-through":"line-through"),l.textDecoration&&-1===["underline","line-through","underline line-through","none"].indexOf(l.textDecoration)&&(l.textDecoration="none"),l.textAlign&&-1===["left","center","right"].indexOf(l.textAlign)&&(l.textAlign="left"),l.verticalAlign&&-1===["bottom","middle","top"].indexOf(l.verticalAlign)&&(l.verticalAlign="bottom"),l.fontSize&&(l.fontSize=Math.round(parseFloat(l.fontSize.indexOf("px")>-1?(.75*parseFloat(l.fontSize)).toString():l.fontSize.indexOf("em")>-1?(16*parseFloat(l.fontSize)/1.3333).toString():l.fontSize))+"pt"),l.fontWeight&&-1===["bold","normal"].indexOf(l.fontWeight)&&(l.fontWeight=l.fontWeight>"599"?"bold":"normal"),l}},e.prototype.generateStyles=function(e,t){var r,n,i,a,o,s=["font-family","vertical-align","text-align","text-indent","color","white-space","font-weight","font-style","font-size","text-decoration","background","background-color"],l=["fontFamily","verticalAlign","textAlign","textIndent","color","whiteSpace","fontWeight","fontStyle","fontSize","textDecoration","backgroundColor","backgroundColor"],h=["border-bottom","border-top","border-right","border-left","border"],d=["borderBottom","borderTop","borderRight","borderLeft","border"];e&&e.length&&e.forEach(function(e){e.split(";").forEach(function(e){if(n=e.split(":")[0].trim(),(r=s.indexOf(n))>-1)n=e.split(":")[1].trim(),t[l[r]]=n;else if((r=h.indexOf(n))>-1){if("none"===(n=e.split(":")[1].trim()))n=void 0;else if(n.includes("pt")){i=n.split("pt"),a=i[0].split(" ");for(var p=0;p<a.length;p++)if(o=parseFloat(a[p])){a.splice(p,1),a.unshift((o/.75).toFixed(2)+"px"),i[0]=a.join(" ");break}n=i.join("")}t[d[r]]=n}})})},e.prototype.refreshOnInsertDelete=function(e){if(this.copiedInfo){if(e.model.id!==this.copiedInfo.sId)return;var t=this.copiedInfo.range;if(e.isInsert){if("Column"===e.modelType){if(e.start<=t[3]){if(e.start<=t[1]){var r=e.end-e.start+1;t[1]+=r,t[3]+=r}else t[3]=t[1]+(e.start-t[1]-1);this.performAction()}}else if(e.start<=t[2]){if(e.start<=t[0]){r=e.end-e.start+1;t[0]+=r,t[2]+=r}else t[2]=t[1]+(e.start-t[1]-1);this.performAction()}}else this.clearCopiedInfo()}},e.prototype.performAction=function(){var e=this.getCopyIndicator();e&&ht(this.parent,e,this.copiedInfo.range,"e-copy-indicator")},e.prototype.getClipboardEle=function(){return this.parent.element.getElementsByClassName("e-clipboard")[0]},e.prototype.getCopyIndicator=function(){return this.parent.element.getElementsByClassName("e-copy-indicator")[0]},e.prototype.getModuleName=function(){return"clipboard"},e.prototype.destroy=function(){this.removeEventListener();var e=this.getClipboardEle();t.detach(e),this.parent=null},e}(),Kl=function(){function e(e){this.editorElem=null,this.editCellData={},this.isEdit=!1,this.isCellEdit=!0,this.isNewValueEdit=!0,this.isAltEnter=!1,this.formulaBarCurStartPos=null,this.curEndPos=null,this.curStartPos=null,this.selectionStart=null,this.selectionEnd=null,this.uniqueColl="",this.uniqueActCell="",this.isSpill=!1,this.keyCodes={BACKSPACE:8,SPACE:32,TAB:9,DELETE:46,ESC:27,ENTER:13,FIRSTALPHABET:65,LASTALPHABET:90,FIRSTNUMBER:48,LASTNUMBER:59,FIRSTNUMPAD:96,LASTNUMPAD:111,SYMBOLSETONESTART:186,SYMBOLSETONEEND:192,SYMBOLSETTWOSTART:219,SYMBOLSETTWOEND:222,FIREFOXEQUALPLUS:61,FIREFOXMINUS:173,F2:113},this.formulaErrorStrings=["mismatched parentheses","requires 3 arguments","improper formula","empty expression","mismatched string quotes","wrong number of arguments","invalid arguments"],this.parent=e,this.addEventListener()}return e.prototype.destroy=function(){this.isEdit&&this.cancelEdit(!0,!1),this.removeEventListener(),this.parent=null,this.editorElem=null},e.prototype.addEventListener=function(){t.Browser.isDevice&&"safari"===t.Browser.info.name&&(t.Browser.isIos||t.Browser.isIos7)?t.EventHandler.add(this.parent.element,"touchend",this.tapHandler,this):t.EventHandler.add(this.parent.element,"dblclick",this.dblClickHandler,this),this.parent.on(Oa,this.mouseDownHandler,this),this.parent.on(Ha,this.keyUpHandler,this),this.parent.on(Ba,this.keyDownHandler,this),this.parent.on(Da,this.performEditOperation,this),this.parent.on(xs,this.initiateCurPosition,this),this.parent.on(ws,this.updateFormulaBarValue,this),this.parent.on(Is,this.addressHandler,this),this.parent.on(Es,this.initiateRefSelection,this),this.parent.on(Rs,this.refSelectionRender,this),this.parent.on(nn,this.checkUniqueRange,this),this.parent.on(an,this.reApplyFormula,this),this.parent.on(So,this.sheetChangeHandler,this)},e.prototype.removeEventListener=function(){t.Browser.isDevice&&"safari"===t.Browser.info.name&&(t.Browser.isIos||t.Browser.isIos7)?t.EventHandler.remove(this.parent.element,"touchend",this.tapHandler):t.EventHandler.remove(this.parent.element,"dblclick",this.dblClickHandler),this.parent.isDestroyed||(this.parent.off(Oa,this.mouseDownHandler),this.parent.off(Ha,this.keyUpHandler),this.parent.off(Ba,this.keyDownHandler),this.parent.off(Da,this.performEditOperation),this.parent.off(xs,this.initiateCurPosition),this.parent.off(ws,this.updateFormulaBarValue),this.parent.off(Is,this.addressHandler),this.parent.off(Es,this.initiateRefSelection),this.parent.off(Rs,this.refSelectionRender),this.parent.off(nn,this.checkUniqueRange),this.parent.off(an,this.reApplyFormula),this.parent.off(So,this.sheetChangeHandler))},e.prototype.getModuleName=function(){return"edit"},e.prototype.performEditOperation=function(e){switch(e.action){case"renderEditor":if(this.renderEditor(),e.initLoad&&t.Browser.isDevice&&"safari"===t.Browser.info.name&&(t.Browser.isIos||t.Browser.isIos7)){var r=this.parent.createElement("div",{className:"e-ss-focus-edit",attrs:{contentEditable:"true",inputmode:"none",tabindex:"-1"}}),n=this.parent.element.querySelector(".e-sheet-panel");n&&(n.style.position="relative",n.appendChild(r)),this.parent.element.onfocus=function(){Wt(r)}}break;case"refreshEditor":this.refreshEditor(e.value,e.refreshFormulaBar,e.refreshEditorElem,e.isAppend,e.trigEvent),e.refreshCurPos&&this.setCursorPosition();break;case"startEdit":if(this.isEdit){var i={isEdit:!1};this.parent.notify(Aa,i),i.isEdit&&(this.isNewValueEdit=e.isNewValueEdit,this.startEdit(e.address,e.value,e.refreshCurPos))}else 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}},e.prototype.keyUpHandler=function(e){if(this.isEdit){var 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&&!St(e.keyCode))&&this.refreshEditor(t.textContent,this.isCellEdit);if(B(this.editCellData.value,!0)&&(!e||16!==e.keyCode&&(!e.shiftKey||e.shiftKey&&!St(e.keyCode)))&&(this.updateFormulaReference(t),this.endFormulaRef)){var r=this.getCurPosition(),n=["+","-","*","/",this.parent.listSeparator,"(","=","&",":"];r.end&&n.indexOf(this.editCellData.value[r.end-1])>-1&&(this.endFormulaRef=!1)}}},e.prototype.updateFormulaReference=function(e){var t=this.parent.element.querySelector(".e-formularef-indicator");t&&t.parentElement.removeChild(t),this.editCellData.value!==e.textContent&&this.refreshEditor(e.textContent,!0);var r=this.editCellData.sheetIndex,n=this.editCellData.value;this.parent.notify(bs,{range:n,formulaSheetIdx:r})},e.prototype.keyDownHandler=function(e){var r=e.target,n=e.keyCode,i=this.parent.getActiveSheet(),a=u(i.activeCell),o=Re(a[0],a[1],i,!1,!0);if(!t.closest(r,".e-spreadsheet .e-dialog"))if(!i.isProtected||r.classList.contains("e-sheet-rename")||!Y(o,Xe(i,a[1]))||r.classList.contains("e-formula-bar")&&!r.disabled){if(this.isEdit){var s=this.getEditElement(i),l=B(this.editCellData.value,!0);if((this.isCellEdit||l&&this.editCellData.value!==s.textContent&&16!==e.keyCode)&&(a[1]<this.parent.frozenColCount(i)&&(!i.frozenRows||a[0]>=this.parent.frozenRowCount(i))&&s&&"auto"!==s.style.height&&Bt(s.textContent,o.style,this.parent.cellStyle)>parseInt(s.style.maxWidth,10)&&(s.style.height="auto"),Bt(s.textContent,o.style,this.parent.cellStyle)>parseInt(s.style.maxWidth,10)-5&&(s.style.height="auto"),a[0]<this.parent.frozenRowCount(i)&&s&&!s.style.overflow&&Bt(s.textContent,o.style,this.parent.cellStyle)>parseInt(s.style.maxWidth,10)&&(s.style.overflow="auto"),(!e.shiftKey||e.shiftKey&&!St(e.keyCode))&&this.refreshEditor(s.textContent,this.isCellEdit,!1,!1,!1)),!e.altKey)switch(n){case this.keyCodes.ENTER:if(t.Browser.isWindows&&e.preventDefault(),this.isAltEnter){var h=s.textContent;h&&h.indexOf("\n")>-1&&(Ae(this.parent.getActiveSheet().selectedRange,!0,this.parent,!0),this.refreshEditor(s.textContent,this.isCellEdit,!1,!1,!1),this.isAltEnter=!1)}if(l){var d=this.parent.element.querySelector(".e-formularef-indicator");d&&d.parentElement.removeChild(d),Ce(this.parent,this.editCellData.sheetIndex).id===i.id?this.endEdit(!1,e):(this.parent.goTo(this.editCellData.fullAddr),this.endEdit(!1,e))}else 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 if(r.classList.contains("e-spreadsheet")||t.closest(r,".e-sheet-panel")){13===n&&"true"===r.contentEditable&&e.preventDefault();var p=String.fromCharCode(n),c=n>=this.keyCodes.FIRSTALPHABET&&n<=this.keyCodes.LASTALPHABET||p.toLowerCase()!==p.toUpperCase()&&!(n>=112&&n<=123),f=n>=this.keyCodes.FIRSTNUMBER&&n<=this.keyCodes.LASTNUMBER,g=n>=this.keyCodes.FIRSTNUMPAD&&n<=this.keyCodes.LASTNUMPAD,m=n>=this.keyCodes.SYMBOLSETONESTART&&n<=this.keyCodes.SYMBOLSETONEEND;m||(m=n>=this.keyCodes.SYMBOLSETTWOSTART&&n<=this.keyCodes.SYMBOLSETTWOEND);var v=n===this.keyCodes.FIREFOXEQUALPLUS||n===this.keyCodes.FIREFOXMINUS,y=!e.shiftKey&&!e.ctrlKey&&!e.metaKey&&n===this.keyCodes.F2,C=n===this.keyCodes.BACKSPACE,b=/(Macintosh|MacIntel|MacPPC|Mac68K|Mac|Mac OS|iPod|iPad)/i.test(navigator.userAgent)&&C;if(!e.ctrlKey&&!e.metaKey&&!e.altKey&&(!e.shiftKey&&n===this.keyCodes.SPACE||c||f||g||m||"mozilla"===t.Browser.info.name&&v)||y||C){y&&(this.isNewValueEdit=!1);this.parent.element.getElementsByClassName("e-ss-overlay-active").length?C&&!b&&this.editingHandler("delete"):(this.startEdit(null,null,!0,!0),Wt(this.getEditElement(i)))}if(n===this.keyCodes.DELETE||b){i.isProtected&&Gt(this.parent)?this.parent.notify(ss,null):(this.editingHandler("delete"),this.parent.notify(Kr,null))}}}else if((n>=this.keyCodes.FIRSTALPHABET&&n<=this.keyCodes.LASTALPHABET||n>=this.keyCodes.FIRSTNUMBER&&n<=this.keyCodes.LASTNUMBER||n===this.keyCodes.DELETE||n===this.keyCodes.BACKSPACE||n===this.keyCodes.SPACE||n>=this.keyCodes.FIRSTNUMPAD&&n<=this.keyCodes.LASTNUMPAD||n>=this.keyCodes.SYMBOLSETONESTART&&n<=this.keyCodes.SYMBOLSETONEEND||n>=219&&n<=222||!e.shiftKey&&!e.ctrlKey&&!e.metaKey&&n===this.keyCodes.F2)&&67!==n&&89!==n&&90!==n){if(i.protectSettings.insertLink&&75===n)return;e.ctrlKey||70===e.keyCode||this.parent.element.querySelector(".e-editAlert-dlg")||r.parentElement.classList.contains("e-unprotectpwd-content")||r.parentElement.classList.contains("e-password-content")||r.parentElement.classList.contains("e-sheet-password-content")||r.parentElement.classList.contains("e-unprotectsheetpwd-content")||r.parentElement.classList.contains("e-reenterpwd-content")||this.parent.notify(ss,null)}},e.prototype.renderEditor=function(){if(!this.editorElem||!t.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"}});this.parent.element.getElementsByClassName("e-spreadsheet-edit")[0]&&this.parent.element.getElementsByClassName("e-spreadsheet-edit")[0].remove();var r=this.parent.element.querySelector(".e-sheet-content");if(!r)return;r.appendChild(e),this.editorElem=e}this.parent.notify(La,{action:"renderAutoComplete"})},e.prototype.refreshEditor=function(e,t,r,n,i,a){void 0===i&&(i=!0),n?e=this.editCellData.value=this.editCellData.value+e:this.editCellData.value=a||e;var o=this.getEditElement(this.parent.getActiveSheet());r&&o&&(o.textContent=e),t&&this.parent.notify(Pa,{action:"refreshFormulabar",value:e}),this.parent.isEdit&&o&&i&&this.editCellData.value===o.textContent&&this.triggerEvent("cellEditing").cancel&&this.cancelEdit(!1,!1,null,!0)},e.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(),a=u(i.activeCell),o=Re(a[0],a[1],i,!1,!0);if(Lt(this.parent,a[0],a[1],this.parent.activeSheetIndex)){var s=this.parent.getCell(a[0],a[1]),l=!1,h=s.innerHTML;if(s&&h.indexOf("<")>-1&&h.indexOf(">")>-1&&h.indexOf("input")>-1&&(l=!0),l)return}var d=this.updateEditCellDetail(e,t);this.initiateEditor(r,d),this.positionEditor(),this.parent.isEdit=this.isEdit=!0,this.parent.notify(io,null),this.parent.notify(Za,[{enable:!1}]),o.formula&&!n&&this.parent.notify(bs,{range:o.formula,formulaSheetIdx:this.editCellData.sheetIndex})},e.prototype.setCursorPosition=function(){var e=this.getEditElement(this.parent.getActiveSheet()),t=e.textContent.length;if(t){var r=document.getSelection(),n=document.createRange();n.setStart(e.firstChild,t),n.collapse(!0),r.removeAllRanges(),r.addRange(n)}e.focus()},e.prototype.hasFormulaSuggSelected=function(){var e=document.getElementById(this.parent.element.id+"_ac_popup");return e&&"visible"===e.style.visibility&&e.querySelectorAll(".e-item-focus").length>0},e.prototype.editingHandler=function(e){var r,n=document.getElementsByClassName("e-ss-overlay-active"),i=n.length;switch(e){case"delete":if(i>0)n[0].classList.contains("e-datavisualization-chart")?this.parent.notify(Ls,{id:n[0].id,sheetIdx:this.parent.activeSheetIndex+1}):this.parent.notify(Ds,{id:n[0].id,sheetIdx:this.parent.activeSheetIndex+1});else{var a=this.parent.getActiveSheet(),o=a.selectedRange,s=y(o);o=m(s=s[0]>s[2]||s[1]>s[3]?w(s):s);var l={address:a.name+"!"+o,cancel:!1};if(this.parent.notify(Ar,{action:"cellDelete",eventArgs:l}),l.cancel)return;s=c(o=C(l.address)),Xt(this.parent,s,this.parent.activeSheetIndex),this.parent.notify(xi,{}),0===s[0]&&0===s[1]&&s[2]>=a.usedRange.rowIndex&&s[3]>=a.usedRange.colIndex&&this.parent.setUsedRange(0,0,a,!1,!0);var h={cellIdx:s,isUnique:!1};if(this.checkUniqueRange(h),h.isUnique){var d=c(this.uniqueColl);(x=Re(d[0],d[1],this.parent.getActiveSheet()))&&x.value&&(r=x.value.toString().indexOf("#SPILL!")>-1)}if(h.isUnique&&this.uniqueColl.split(":")[0]===o.split(":")[0]){for(var p=c(this.uniqueColl),u=p[0];u<=p[2];u++)for(var f=p[1];f<=p[3];f++)this.parent.updateCell({value:"",formula:""},m([u,f]));this.parent.notify(rn,null),this.uniqueColl=""}else if(h.isUnique){var g=c(this.uniqueColl);if("#SPILL!"===Re(g[0],g[1],a).value){var v=!1;for(f=g[0];f<=g[2];f++)for(var b=g[1];b<=g[3];b++){var x=Re(f,b,a);f===g[0]&&b===g[1]?v=!1:x&&!t.isNullOrUndefined(x.value)&&""!==x.value&&(v=!0)}v||this.reApplyFormula()}}h.isUnique?this.parent.notify(Yo,{action:"cellDelete",eventArgs:{address:a.name+"!"+o,isSpill:r}}):this.parent.notify(Yo,{action:"cellDelete",eventArgs:{address:a.name+"!"+o}})}}},e.prototype.getCurPosition=function(){var e={},t=window.getSelection();if(this.editorElem.textContent===this.editCellData.value&&(e.start=t.anchorOffset,e.end=t.focusOffset,e.start>e.end)){var r=e.start;e.start=e.end,e.end=r}if(t&&t.focusNode&&t.focusNode.classList&&t.focusNode.classList.contains("e-formula-bar-panel")&&this.editorElem.textContent===this.editCellData.value){var n=t.focusNode.getElementsByClassName("e-formula-bar e-css")[0];e.start=n.selectionStart,e.end=n.selectionEnd}return e},e.prototype.mouseDownHandler=function(e){if(!t.closest(e.target,".e-findtool-dlg")&&!t.closest(e.target,".e-validation-error-dlg")&&this.isEdit){var r=this.getCurPosition();r.start&&(this.curStartPos=this.selectionStart=r.start),r.end&&(this.curEndPos=this.selectionEnd=r.end);var n=e.target,i=this.parent.getActiveSheet(),a=this.parent.element.querySelector(".e-formularef-indicator");this.isCellEdit=n.classList.contains("e-spreadsheet-edit");var o=B(this.editCellData.value,!0),s=this.getEditElement(i),l=["+","-","*","/",this.parent.listSeparator,"(","=","&",":"];if(n.classList.contains("e-cell")||n.classList.contains("e-header-cell")||n.classList.contains("e-selectall")||t.closest(n,".e-toolbar-item.e-active")||t.closest(n,".e-table")){if(this.isAltEnter){var h=s.textContent;h&&h.indexOf("\n")>-1&&(this.isAltEnter=!1,Ae(this.parent.getActiveSheet().selectedRange,!0,this.parent),this.refreshEditor(s.textContent,this.isCellEdit))}if(!o||this.endFormulaRef)this.endFormulaRef=!1,this.endEdit(!1,e);else{var d=this.selectionEnd,p=u(i.activeCell),c=Re(p[0],p[1],i);if(this.selectionStart!==this.selectionEnd&&this.editCellData.value===s.textContent&&-1!==l.indexOf(s.textContent.substring(this.selectionStart-1,this.selectionStart))&&U(s.textContent.substring(this.selectionStart,this.selectionEnd))&&s.textContent.indexOf(":")!==this.selectionEnd&&(this.editCellData.value=s.textContent.substring(0,this.selectionStart)+s.textContent.substring(this.selectionEnd,s.textContent.length)),this.editCellData.value===s.textContent&&s.textContent.indexOf("(")!==s.textContent.length-1&&-1!==s.textContent.indexOf("(")&&this.selectionStart===this.selectionEnd)if(this.editCellData.sheetIndex!==ce(this.parent,i.name)){var f=this.parent.element.querySelector(".e-formula-bar");if(s.textContent.substring(f.selectionEnd-1,f.selectionEnd)!==this.parent.listSeparator&&!e.shiftKey)return a&&a.parentElement.removeChild(a),this.parent.goTo(this.editCellData.fullAddr),void this.endEdit(!1,e)}else if(-1===l.indexOf(s.textContent.substring(d-1,d)))return a&&a.parentElement.removeChild(a),void this.endEdit(!1,e);if(!c)return;if((o=!!c.formula&&(B(Re(p[0],p[1],i).formula)||this.editCellData.value&&0===this.editCellData.value.toString().indexOf("=")))&&this.parent.isEdit){var g=this.selectionEnd;this.editCellData.value.length===g?(")"===this.editCellData.value.substring(this.editCellData.value.length-1)||D(this.editCellData.value.substring(this.editCellData.value.length-1)))&&(a&&a.parentElement.removeChild(a),this.endEdit(!1,e)):this.editCellData.value===s.textContent&&(-1===l.indexOf((this.editCellData.value+i.selectedRange).substring(g-1,g))?(a&&a.parentElement.removeChild(a),this.endEdit(!1,e)):(-1===l.indexOf(s.textContent.substring(g-1,g))||")"!==s.textContent.substring(g,g+1)&&-1===l.indexOf(s.textContent.substring(g,g+1)))&&(a&&a.parentElement.removeChild(a),this.endEdit(!1,e)))}}}else if(o&&this.editCellData.value===s.textContent&&s.textContent.indexOf("(")!==s.textContent.length-1&&!this.isCellEdit&&-1===l.indexOf(this.editCellData.value.substring(this.selectionStart-1,this.selectionStart))&&Ce(this.parent,this.editCellData.sheetIndex).id===i.id){d=window.getSelection().focusOffset;if(-1===l.indexOf(s.textContent.substring(d-1,d)))return a&&a.parentElement.removeChild(a),this.parent.goTo(this.editCellData.fullAddr),void(this.isEdit&&this.endEdit(!1,e))}}},e.prototype.tapHandler=function(e){var t=this;if(!this.tapedTwice)return this.tapedTwice=!0,void setTimeout(function(){if(t.tapedTwice=!1,!t.parent.isEdit&&e.target.classList.contains("e-cell")){var r=t.parent.element.querySelector(".e-ss-focus-edit");r&&Wt(r)}},300);e.preventDefault(),this.dblClickHandler(e)},e.prototype.dblClickHandler=function(e){var r=e.target;if(!t.closest(r,".e-datavisualization-chart")&&!r.classList.contains("e-ss-overlay")&&(r.classList.contains("e-active-cell")||r.classList.contains("e-cell")||r.classList.contains("e-wrap-content")||t.closest(r,".e-sheet-content")||r.classList.contains("e-table"))){var n=this.parent.getActiveSheet(),i=u(n.activeCell),a=Re(i[0],i[1],n,!1,!0);if(n.isProtected&&Y(a,Xe(n,i[1])))this.parent.notify(ss,null);else if(this.isEdit){if(!r.classList.contains("e-spreadsheet-edit"))if(B(this.editCellData.value)){var o=this.editCellData.fullAddr.substring(0,this.editCellData.fullAddr.indexOf("!"));this.parent.getActiveSheet().name===o&&this.endEdit()}else this.endEdit()}else this.isNewValueEdit=!1,this.startEdit(),Wt(this.getEditElement(n))}},e.prototype.updateEditCellDetail=function(e,r){var n,i,a;if(n=t.isNullOrUndefined(this.editCellData.sheetIndex)?e&&e.split("!").length>1?ce(this.parent,fe(e)):this.parent.activeSheetIndex:this.editCellData.sheetIndex,this.editCellData.addr?B(this.editCellData.value,!0)&&(i=Ce(this.parent,n),this.isNewValueEdit=!1):(i=Ce(this.parent,n),e=e?C(e):i.activeCell),e){var o=c(e),s=o[0],l=o[1],h=Re(s,l,i,!1,!0);if(h.colSpan>1||h.rowSpan>1){var d={sheet:i,cell:h,rowIdx:s,colIdx:l};se(d),s=d.rowIdx,l=d.colIdx,a=d.isMergedHiddenCell}var p=this.parent.getCell(s,l),u=lt(i,o,this.parent.frozenRowCount(i),this.parent.frozenColCount(i),this.parent.viewport.beforeFreezeHeight,this.parent.viewport.beforeFreezeWidth,this.parent.sheetModule.colGroupWidth);this.editCellData={addr:e,fullAddr:we(this.parent,n)+"!"+e,rowIndex:s,colIndex:l,sheetIndex:n,element:p,value:r||"",position:u}}return a},e.prototype.initiateEditor=function(e,r){var n=this;he(this.parent,this.editCellData.fullAddr,!1,r).then(function(r){n.parent&&r.forEach(function(r){var i,a=function(){var e={cell:r,value:r?r.value:"",showFormattedText:n.editCellData.showFormattedText};n.parent.notify(Xr,e),i=r?r.formula||e.value:"",n.editCellData.oldValue=i};a();var o=n.triggerEvent("cellEdit",null,i);if(o.cancel)n.cancelEdit(!0,!1,null,!0);else{o.showFormattedText&&(n.editCellData.showFormattedText=!0,a()),n.editCellData.value?i=n.editCellData.value:n.editCellData.value=i;var s;n.isNewValueEdit?(s=i,i=""):n.isNewValueEdit=!0,t.isUndefined(i)||n.refreshEditor(i,!1,!0,!1,!1,s),e&&n.setCursorPosition()}})})},e.prototype.positionEditor=function(e){var r,n=this.editCellData.element,i={isEdit:!1};if(this.parent.notify(Aa,i),i.isEdit&&t.isNullOrUndefined(n)&&(n=r=this.parent.getCell(this.editCellData.rowIndex,this.editCellData.colIndex),this.editCellData.element=r),n){n.classList.add("e-ss-edited");var a=this.parent.getActiveSheet(),o=Re(this.editCellData.rowIndex,this.editCellData.colIndex,a,!1,!0),s=this.editCellData.position.left+1,l=this.editCellData.position.top+1,h={range:[this.editCellData.rowIndex,this.editCellData.colIndex,this.editCellData.rowIndex,this.editCellData.colIndex]};this.parent.notify(qn,h);var d=Ye(a,h.range[0],h.range[2])-3,p=Ze(a,h.range[1],h.range[3])-3,c=this.parent.getMainContent(),u=c.parentElement,f=void 0,g=this.parent.frozenColCount(a),m=void 0,v=void 0,y=this.parent.frozenRowCount(a),C=void 0;if(this.editCellData.colIndex<g)f=Math.abs(this.parent.getRowHeaderContent().getBoundingClientRect()[this.parent.enableRtl?"left":"right"]-n.getBoundingClientRect()[this.parent.enableRtl?"right":"left"])-1,this.editCellData.rowIndex<y?"2"===this.parent.getRowHeaderContent().style.zIndex&&(m="3"):Bt(o.value,o.style,this.parent.cellStyle)>f&&(C=!0);else{f=u.offsetWidth-(s-c.scrollLeft)-28-this.parent.sheetModule.getRowHeaderWidth(a);var b=n.getBoundingClientRect(),x=u.getBoundingClientRect(),S=this.parent.enableRtl?b.left:b.right,w=this.parent.enableRtl?x.left:x.right,I=this.parent.getScrollElement(),E=this.parent.sheetModule.getScrollSize();this.parent.enableRtl?w+E>S&&(I.scrollLeft-=b.width):w-E<S&&(I.scrollLeft+=b.width)}this.editCellData.rowIndex<y&&(v=!0);var R=!v&&(o&&o.wrap||n&&e||C)?"auto;":d+"px;",k="display:block;top:"+l+"px;"+(this.parent.enableRtl?"right:":"left:")+s+"px;min-width:"+p+"px;max-width:"+(o&&o.wrap?p:f)+"px;height:"+R+(o&&o.wrap?"width:"+p+"px;":"")+"min-height:"+d+"px;"+(m?"z-index: "+m+";":"")+(v&&(o&&!o.wrap||n&&e)&&(Bt(o.value,o.style,this.parent.cellStyle)>f||n&&e)?"overflow: auto;":"");k+=n.style.cssText;var F=this.getEditElement(a,!0);F.setAttribute("style",k),Bt(F.textContent,o.style,this.parent.cellStyle)>f&&(F.style.height="auto");var A=this.parent.element.querySelector(".e-active-cell");A&&(A.style.height=d+4+"px"),n.classList.contains("e-right-align")?F.classList.add("e-right-align"):n.classList.contains("e-center-align")&&F.classList.add("e-center-align")}},e.prototype.updateEditedValue=function(e,t,r,n){var i=this,a=this.editCellData.oldValue;t&&(this.editCellData.value=t);var o=this.editCellData.value;this.parent.notify(Mo,{args:{action:"beforeCellSave",eventArgs:{address:this.editCellData.addr}}});var s=!0;if(this.parent.allowDataValidation){var l=this.parent.getActiveSheet(),h=c(l.activeCell),d=Re(h[0],h[1],l,!1,!0),p=Xe(l,h[1]);if(d.validation||Je(p,h[0],h[1])){var u=ae([this.editCellData.value||this.getEditElement(l).innerText],this.parent.locale)[0],f=this.parent.activeSheetIndex,g={value:u,range:"string"==typeof this.editCellData.addr?c(this.editCellData.addr):this.editCellData.addr,sheetIdx:f,isCell:!0,td:null,isValid:!0};this.parent.notify(In,g),(s=g.isValid)?(d.format&&u!==g.value||!this.editCellData.value&&g.value)&&(this.editCellData.value=g.value):this.isCellEdit=!0}}if(!n&&B(this.editCellData.value)){var m={formula:this.editCellData.value};if(this.parent.notify(ki,m),m.isInvalid){var v;this.isCellEdit=!0,s=!1;var y=this.parent.serviceLocator.getService(Fl),C=this.parent.serviceLocator.getService(Al);C.show({width:400,isModal:!0,showCloseIcon:!0,target:this.parent.element,cssClass:"e-validation-error-dlg",content:y.getConstant("CellReferenceTypoError")+"<br>"+m.formula,beforeOpen:function(){return i.editCellData.element.focus()},buttons:[{buttonModel:{content:y.getConstant("Yes"),isPrimary:!0},click:function(){v=!0,C.hide()}},{buttonModel:{content:y.getConstant("No")},click:function(){return C.hide()}}],close:function(){if(v)t=i.editCellData.value=m.formula,i.updateCell(a,e,t,o,r),i.parent.notify(Pa,{action:"refreshFormulabar",value:m.formula});else{var n=i.getEditElement(i.parent.getActiveSheet());n.innerText&&window.getSelection().selectAllChildren(n)}}},!1)}}s?this.updateCell(a,e,t,o,r):r&&r.preventDefault()},e.prototype.updateCell=function(e,r,n,i,a){var o=e?e.toString().toUpperCase():"";if(e!==this.editCellData.value||o.indexOf("=NOW()")>-1||o.indexOf("NOW()")>-1||o.indexOf("=RAND()")>-1||o.indexOf("RAND()")>-1||o.indexOf("=RANDBETWEEN(")>-1||o.indexOf("RANDBETWEEN(")>-1){var s=this.parent.getActiveSheet(),l=c(s.activeCell);e&&e.toString().indexOf("=UNIQUE(")>-1&&""===this.editCellData.value&&this.parent.notify(rn,null);var h={cellIdx:l,isUnique:!1};this.checkUniqueRange(h);var d=h.isUnique;if(d&&""!==e&&""===this.editCellData.value){if(-1===Re((C=c(this.uniqueColl))[0],C[1],s).value.toString().indexOf("#SPILL!"))return}e&&e.toString().indexOf("UNIQUE")>-1&&this.editCellData.value&&this.editCellData.value.toString().indexOf("UNIQUE")>-1&&d&&this.updateUniqueRange("");var p={action:"updateCellValue",address:this.editCellData.addr,value:this.editCellData.value,skipCellFormat:this.editCellData.showFormattedText};this.parent.notify(qr,p);var u=Re(l[0],l[1],s,!0),f=void 0;t.isNullOrUndefined(u)||(f=u.value.toString());if(this.formulaErrorStrings.indexOf(f)>-1||f&&f.includes("circular reference:")){if(delete u.value,delete u.formula,a){var g=a.target;["e-toolbar-item","e-tab-wrap","e-text-wrap","e-tab-text","e-caret"].some(function(e){return g.classList.contains(e)})&&t.closest(g,".e-ribbon")||["e-scroller","e-main-panel","e-autofill"].some(function(e){return g.classList.contains(e)})||this.showFormulaAlertDlg(f),a.preventDefault()}return}var m=void 0;p.isFormulaDependent&&(m=oe(this.parent,this.parent.viewport)),this.parent.notify(ri,{cell:null,rIdx:this.editCellData.rowIndex,cIdx:this.editCellData.colIndex,viewportIndexes:m}),s.conditionalFormats&&s.conditionalFormats.length&&this.parent.notify(Xn,{indexes:[this.editCellData.rowIndex,this.editCellData.colIndex],isAction:!0,refreshAll:p.isFormulaDependent,isEdit:!0});var v=Re(l[0],l[1],s,!0),y=this.getRefreshNodeArgs(v,this.editCellData.element,this.editCellData.rowIndex,this.editCellData.colIndex);if(this.editCellData.value=y.value,v&&v.formula&&(this.editCellData.formula=v.formula),v&&v.wrap&&this.parent.notify(yn,{range:l,wrap:!0,sheet:s}),r&&this.parent.refreshNode(this.editCellData.element,y),v&&v.hyperlink&&this.parent.serviceLocator.getService("cell").refreshRange(l),d){var C;if(Re((C=c(this.uniqueColl))[0],C[1],s).value.toString().indexOf("#SPILL!")>-1&&(this.isSpill=!0),""!==e&&""===this.editCellData.value||this.editCellData.formula&&this.editCellData.formula.length>1&&e!==this.editCellData.formula){for(var b=!1,x=C[0];x<=C[2];x++)for(var S=C[1];S<=C[3];S++){var w=Re(x,S,s);x===C[0]&&S===C[1]?b=!1:w&&!t.isNullOrUndefined(w.value)&&""!==w.value&&(b=!0)}b||this.reApplyFormula()}else this.updateUniqueRange(i)}}this.triggerEvent("cellSave",a,n),this.resetEditState(),this.focusElement(a)},e.prototype.checkUniqueRange=function(e){var t={range:[]};this.parent.notify(tn,t);var r=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=c(r[n]),a=i[0];a<=i[2];a++)for(var o=i[1];o<=i[3];o++)if(e.cellIdx[0]===a&&e.cellIdx[1]===o){e.isUnique=!0,this.uniqueCell=!0;var s=""!==this.uniqueColl?c(this.uniqueColl):[0,0,0,0],l=c(r[n]);if(s[0]===l[0]&&s[1]===l[1]){var h=[s[0],l[1],s[0],l[1]];h[2]=s[2]>l[2]?s[2]:l[2],h[3]=s[3]>l[3]?s[3]:l[3],this.uniqueColl=m(h),e.uniqueRange=m(h)}else this.uniqueColl=r[n],e.uniqueRange=r[n]}},e.prototype.updateUniqueRange=function(e){var t=c(this.uniqueColl),r=!1;"#SPILL!"!==Re(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!"},m([n,i])):m([n,i]).split(":")[0]===this.editCellData.addr?this.parent.updateCell({value:e},m([n,i])):this.parent.updateCell({value:""},m([n,i])))},e.prototype.reApplyFormula=function(){var e=c(this.uniqueColl),t=Re(e[0],e[1],this.parent.getActiveSheet());this.parent.updateCell({value:""},m([e[0],e[1]]));for(var r=this.parent.sheets,n=t.formula,i=0;i<r.length;i++)n.indexOf(r[i].name)>-1&&(n=n.replace(r[i].name,"!"+i));this.parent.notify(jr,{action:"computeExpression",formula:n}),this.uniqueCell=!1,""!==this.uniqueActCell&&(this.editCellData.value=this.uniqueActCell,this.uniqueActCell="")},e.prototype.refreshDependentCellValue=function(e,t,r){if(e&&t&&(e--,t--,(this.editCellData.rowIndex!==e||this.editCellData.colIndex!==t)&&this.parent.activeSheetIndex===r||this.uniqueCell&&this.parent.activeSheetIndex===r)){var n=Ce(this.parent,r),i=void 0;if(je(n,e)||Qe(n,t)||(i=this.parent.getCell(e,t)),i){if(i.parentElement){var a=i.parentElement.getAttribute("aria-rowindex");if(a&&Number(a)-1!==e)return}var o=Re(e,t,n),s=c(n.activeCell);s[0]===e&&s[1]===t&&(this.uniqueActCell=o.value);var l=this.getRefreshNodeArgs(o,i,e,t);this.parent.refreshNode(i,l)}}},e.prototype.getRefreshNodeArgs=function(e,t,r,n){var i={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(Mr,i),{isRightAlign:i.isRightAlign,type:i.type,value:i.value,result:this.parent.allowNumberFormatting?i.formattedText:i.value,curSymbol:i.curSymbol,isRowFill:i.isRowFill,rowIndex:r,colIndex:n}},e.prototype.endEdit=function(e,t,r){void 0===e&&(e=!1),e&&this.refreshEditor(this.editCellData.oldValue,!1,!0,!1,!1);var n=this.triggerEvent("beforeCellSave");if(n.cancel)this.parent.isEdit&&t&&t.preventDefault();else{if(n.value&&n.value.toString().indexOf("\n")>-1){var i=Re(this.editCellData.rowIndex,this.editCellData.colIndex,this.parent.getActiveSheet());Ae(this.parent.getActiveSheet().selectedRange,!i||!1!==i.wrap,this.parent),this.refreshEditor(n.value,this.isCellEdit,!1,!1,!1)}this.updateEditedValue(!0,n.value,t,r)}},e.prototype.cancelEdit=function(e,t,r,n){void 0===e&&(e=!0),void 0===t&&(t=!0),this.refreshEditor(this.editCellData.oldValue,e,!1,!1,!1),n||(t?this.triggerEvent("cellSave",r):this.triggerEvent("cellEdited")),this.resetEditState(),this.focusElement()},e.prototype.focusElement=function(e){if(e&&9===e.keyCode&&document.activeElement.classList.contains("e-formula-bar")){var t=this.parent.element.querySelector(".e-formula-bar-panel "+(e.shiftKey?".e-insert-function":".e-combobox"));t&&Wt(t)}else Wt(this.parent.element);this.parent.notify(Za,[{enable:!0}])},e.prototype.triggerEvent=function(e,t,r){var n=this.parent.getActiveSheet(),i=Re(this.editCellData.rowIndex,this.editCellData.colIndex,n),a={element:this.editCellData.element,value:r||this.editCellData.value,oldValue:this.editCellData.oldValue,address:this.editCellData.fullAddr,displayText:this.parent.getDisplayText(i)};if(a.address){var o={cellIdx:c(a.address),isUnique:!1};this.checkUniqueRange(o),o.isUnique&&(a.isSpill=this.isSpill)}if(a.value!==a.oldValue){if("cellSave"!==e&&(a.cancel=!1),"beforeCellSave"===e){this.parent.notify(Ar,{eventArgs:a,action:"cellSave",preventAction:!0}),i=B(a.value)?{formula:a.value}:{value:a.value};if(J(this.parent,n,{cell:i,rowIdx:this.editCellData.rowIndex,colIdx:this.editCellData.colIndex,eventOnly:!0}))return this.cancelEdit(!1,!1,null,!0),a.cancel=!0,a}this.parent.trigger(e,a),"cellSave"===e&&(this.parent.trigger("cellEdited",a),this.editCellData.formula&&(a.formula=this.editCellData.formula),a.originalEvent=t,this.parent.notify(Yo,{eventArgs:a,action:"cellSave"}))}else"beforeCellSave"!==e&&("cellSave"===e?this.parent.trigger("cellEdited",a):this.parent.trigger(e,a));return a},e.prototype.altEnter=function(){this.positionEditor(!0);var e,t=window.getSelection(),r=t.anchorNode,n=document.createRange();0===(e=3===r.nodeType?t.anchorOffset:r.textContent.length)&&r.textContent.length>0&&(e=r.textContent.length);var i=r.textContent,a=i.slice(0,e),o=i.slice(e)||" ";r.textContent=a+"\n"+o,n=document.createRange(),3===r.nodeType?(n.setStart(r,e+1),n.setEnd(r,e+1)):1===r.nodeType&&(n.setStart(r.firstChild,e+1),n.setEnd(r.firstChild,e+1)),t.removeAllRanges(),t.addRange(n)},e.prototype.resetEditState=function(e){if(void 0===e&&(e=!0),e){var r=this.getEditElement(this.parent.getActiveSheet());(B(r.textContent)||""===r.textContent)&&this.parent.notify(Ss,null),this.editCellData.element&&(this.editCellData.element.classList.remove("e-ss-edited"),this.editorElem.textContent="",r===this.editorElem?(this.editorElem.removeAttribute("style"),this.editorElem.classList.remove("e-right-align")):t.detach(r))}if(this.editCellData={},this.parent.isEdit=this.isEdit=!1,this.isCellEdit=!0,this.parent.notify(La,{action:"endEdit"}),this.parent.showSheetTabs&&!this.parent.isProtected){var n=this.parent.element.querySelector(".e-add-sheet-tab");n&&n.removeAttribute("disabled")}},e.prototype.refSelectionRender=function(){var e=this.getEditElement(this.parent.getActiveSheet());e&&B(e.textContent)&&this.parent.notify(bs,{range:e.textContent,formulaSheetIdx:this.editCellData.sheetIndex})},e.prototype.initiateRefSelection=function(){var e=this.editCellData.fullAddr.substring(0,this.editCellData.fullAddr.indexOf("!")),t=this.editCellData.value;this.parent.getActiveSheet().name===e&&B(this.editCellData.value,!0)?(this.startEdit(this.editCellData.addr,t,!1),this.parent.notify(bs,{range:this.editCellData.value,formulaSheetIdx:this.editCellData.sheetIndex}),this.getEditElement(this.parent.getActiveSheet()).textContent=t,this.initiateCurPosition()):this.initiateCurPosition()},e.prototype.addressHandler=function(e){var t=this.parent.serviceLocator.getService(Al).dialogInstance;if(t&&t.element&&t.element.classList.contains("e-validation-error-dlg"))e.isAlertDlgOpen=!0;else{var r=window.getSelection();if(this.selectionStart=r.anchorOffset,this.selectionEnd=r.focusOffset,this.selectionStart>this.selectionEnd){var n=this.selectionStart;this.selectionStart=this.selectionEnd,this.selectionEnd=n}if(r&&r.focusNode&&r.focusNode.classList&&r.focusNode.classList.contains("e-formula-bar-panel")){var i=r.focusNode.getElementsByClassName("e-formula-bar e-css")[0];this.selectionStart=i.selectionStart,this.selectionEnd=i.selectionEnd}var a={action:"getCurrentEditValue",editedValue:""};this.parent.notify(Da,a);var o=e.range,s=this.editCellData.fullAddr.substring(0,this.editCellData.fullAddr.indexOf("!")),l=this.editCellData.sheetIndex,h=this.getEditElement(this.parent.getActiveSheet());if(this.parent.getActiveSheet().name!==s&&(o="'"+this.parent.getActiveSheet().name+"'!"+o),e.isSelect)this.parent.notify(bs,{range:a.editedValue+o,formulaSheetIdx:l});else{var d=this.editCellData.fullAddr.substring(0,this.editCellData.fullAddr.indexOf("!")),p=["+","-","*","/",this.parent.listSeparator,"(","=","&",":"];if(this.parent.getActiveSheet().name===d){var c=a.editedValue;this.selectionStart!==this.selectionEnd?(this.formulaBarCurStartPos=this.selectionStart,this.curStartPos=this.selectionStart,this.curEndPos=this.selectionStart+o.length,h.textContent=c.substring(0,this.selectionStart)+o+c.substring(this.selectionStart)):c.indexOf(")")===c.length-1&&this.selectionEnd===c.length?(h.textContent=c.substring(0,c.length-1)+o+c.substring(c.length-1),this.curEndPos=h.textContent.length-1):c.indexOf(")")!==c.length-1?(h.textContent=c+o,this.curEndPos=h.textContent.length):h.textContent!==c?(h.textContent=c.substring(0,this.curStartPos)+o+c.substring(this.curStartPos),this.curEndPos=this.curStartPos+o.length):this.selectionStart!==this.selectionEnd||-1===p.indexOf(c.substring(this.selectionStart-1,this.selectionEnd))||-1===p.indexOf(c.substring(this.selectionStart,this.selectionEnd+1))&&")"!==c.substring(this.selectionStart,this.selectionEnd+1)||(h.textContent=c.substring(0,this.selectionStart)+o+c.substring(this.selectionEnd),this.curStartPos=this.selectionStart,this.curEndPos=this.selectionStart+o.length,this.formulaBarCurStartPos=this.curStartPos)}}}},e.prototype.updateFormulaBarValue=function(){var e=window.getSelection(),r=this.editCellData.value,n=this.parent.getActiveSheet().selectedRange;n=E(y(n))?n.split(":")[0]:n;var i=this.parent.element.querySelector(".e-formula-bar");if(r&&B(r,!0)){var a=this.editCellData.fullAddr.substring(0,this.editCellData.fullAddr.indexOf("!"));this.parent.getActiveSheet().name!==a&&(n="'"+this.parent.getActiveSheet().name+"'!"+n),t.isNullOrUndefined(this.formulaBarCurStartPos)?r.indexOf(")")===r.length-1&&e.focusOffset===r.length?i.value=r.substring(0,r.length-1)+n+r.substring(r.length-1):r.indexOf(")")!==r.length-1?i.value=r+n:i.value!==r&&(i.value=r.substring(0,this.curStartPos)+n+r.substring(this.curStartPos)):i.value=r.substring(0,this.formulaBarCurStartPos)+n+r.substring(this.formulaBarCurStartPos),this.curEndPos=this.curStartPos+n.length}},e.prototype.setFormulaBarCurPosition=function(e,t,r){e.setSelectionRange&&(e.focus(),e.selectionStart=t,e.selectionEnd=t,e.setSelectionRange(t,r))},e.prototype.initiateCurPosition=function(e){void 0===e&&(e={isCellEdit:!1});var t=this.getEditElement(this.parent.getActiveSheet(),!0);if(e.isCellEdit){var r=this.getCurPosition();if(!this.endFormulaRef&&r.start===r.end){this.updateFormulaReference(t);var n=["+","-","*","/",this.parent.listSeparator,"(","=","&",":"];r.end&&-1===n.indexOf(this.editCellData.value[r.end-1])&&(this.endFormulaRef=!0)}}else{var i=t.innerText,a=window.getSelection();if(a&&a.focusNode&&a.focusNode.classList&&a.focusNode.classList.contains("e-formula-bar-panel")){var o=this.parent.element.querySelector(".e-formula-bar");this.setFormulaBarCurPosition(o,this.curEndPos,this.curEndPos)}else{if(i){var s=document.createRange();i.indexOf(")"),i.length,s.setStart(t.childNodes[0],this.curEndPos),s.setEnd(t.childNodes[0],this.curEndPos),a.removeAllRanges(),a.addRange(s)}if(this.editCellData.sheetIndex!==this.parent.getActiveSheet().id-1){var l=this.parent.element.querySelector(".e-formula-bar");if(l.value){var h=l.value.length;l.value.indexOf(")")===h-1?this.setFormulaBarCurPosition(l,h-1,h-1):this.setFormulaBarCurPosition(l,h,h)}}}}},e.prototype.getEditElement=function(e,t){if((this.isEdit||t)&&(e.frozenRows||e.frozenColumns)){var r=this.parent.frozenRowCount(e),n=this.parent.frozenColCount(e),i=u(e.activeCell),a=void 0;if(i[0]<r&&i[1]<n)a=this.parent.getSelectAllContent();else if(i[0]<r)a=this.parent.getColumnHeaderContent();else{if(!(i[1]<n))return this.editorElem;a=this.parent.getRowHeaderContent()}var o=a.getElementsByClassName("e-spreadsheet-edit")[0];return!o&&t&&(o=a.appendChild(this.editorElem.cloneNode())),o}return this.editorElem},e.prototype.sheetChangeHandler=function(){this.isEdit||(this.editCellData.value=null)},e.prototype.showFormulaAlertDlg=function(e){var t,r=this,n=this.parent.serviceLocator.getService(Fl),i=this.parent.serviceLocator.getService("dialog"),a=this.getFormulaErrorKey(e);i.show({width:400,isModal:!0,showCloseIcon:!0,target:this.parent.element,cssClass:"e-validation-error-dlg",content:n.getConstant(a),beforeOpen:function(){if(window.getSelection().rangeCount>0){var e=window.getSelection().getRangeAt(0);t=e.endOffset}},buttons:[{buttonModel:{content:n.getConstant("Ok"),isPrimary:!0},click:function(){i.hide()}}],close:function(){var e=r.getEditElement(r.parent.getActiveSheet()),n=document.getSelection(),i=document.createRange();i.setStart(e.firstChild,t),i.collapse(!0),n.removeAllRanges(),n.addRange(i),e.focus()}},!1)},e.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},e}(),$l=function(){function e(e){this.invalidOperators=["%"],this.formulaRange=[],this.parent=e,this.addEventListener(),this.mouseMoveEvt=this.mouseMoveHandler.bind(this)}return e.prototype.addEventListener=function(){this.parent.on(Na,this.init,this),this.parent.on(Oa,this.mouseDownHandler,this),this.parent.on(ja,this.virtualContentLoadedHandler,this),this.parent.on(qa,this.cellNavigateHandler,this),this.parent.on(Ja,this.selectRange,this),this.parent.on(yo,this.rowHeightChanged,this),this.parent.on(Co,this.colWidthChanged,this),this.parent.on(ds,this.protectHandler,this),this.parent.on(bs,this.initiateFormulaSelection,this),this.parent.on(Ss,this.clearBorder,this),this.parent.on(Ns,this.getRowIdxFromClientY,this),this.parent.on(Os,this.getColIdxFromClientX,this),this.parent.on(Ai,this.getRowIdxFromClientY,this),this.parent.on(Ni,this.getColIdxFromClientX,this),this.parent.on(Us,this.chartBorderHandler,this),this.parent.on(el,this.isTouchSelectionStarted,this),this.parent.on(eo,this.selectionByKeydown,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(Na,this.init),this.parent.off(Oa,this.mouseDownHandler),this.parent.off(ja,this.virtualContentLoadedHandler),this.parent.off(qa,this.cellNavigateHandler),this.parent.off(Ja,this.selectRange),this.parent.off(yo,this.rowHeightChanged),this.parent.off(Co,this.colWidthChanged),this.parent.off(ds,this.protectHandler),this.parent.off(bs,this.initiateFormulaSelection),this.parent.off(Ss,this.clearBorder),this.parent.off(Ns,this.getRowIdxFromClientY),this.parent.off(Os,this.getColIdxFromClientX),this.parent.off(Ai,this.getRowIdxFromClientY),this.parent.off(Ni,this.getColIdxFromClientX),this.parent.off(Us,this.chartBorderHandler),this.parent.off(el,this.isTouchSelectionStarted),this.parent.off(eo,this.selectionByKeydown))},e.prototype.isTouchSelectionStarted=function(e){e.touchSelectionStarted=this.touchSelectionStarted},e.prototype.selectionByKeydown=function(e){this.selectRangeByIdx(e.range,e.e,!1,!1,!1,!1,void 0,!1)},e.prototype.rowHeightChanged=function(e){var t=this;e.threshold&&tt(function(){if(t.parent){var r=t.parent.getActiveSheet(),n=t.getActiveCell();if(n&&(r.frozenRows||r.frozenColumns||r.selectedRange.includes(" ")))t.selectRange({address:r.selectedRange});else{var i,a=w(c(r.selectedRange)),o={range:a,isActiveCell:!1,skipChecking:!0};if(n){var s=u(r.activeCell)[0];if(t.parent.notify(jn,o),o.isActiveCell){i=Re(a[0],a[1],r,!1,!0).rowSpan>1&&a[0]<=e.rowIdx&&a[2]>=e.rowIdx}s===e.rowIdx||i?n.style.height=parseFloat(n.style.height)+e.threshold+"px":s>e.rowIdx&&(n.style.top=parseFloat(n.style.top)+e.threshold+"px")}if(n=t.getSelectionElement()){if(i||a[0]===a[2]&&a[1]===a[3])return;var l=a[0],h=a[2];l<=e.rowIdx&&h>=e.rowIdx&&n?n.style.height=parseFloat(n.style.height)+e.threshold+"px":l>e.rowIdx&&n&&(n.style.top=parseFloat(n.style.top)+e.threshold+"px")}}}})},e.prototype.colWidthChanged=function(e){var t=this;e.threshold&&tt(function(){if(t.parent){var r=t.parent.getActiveSheet(),n=t.getActiveCell(),i=t.parent.enableRtl;if(n&&(r.frozenRows||r.frozenColumns||r.selectedRange.includes(" ")))t.selectRange({address:r.selectedRange});else{var a,o=w(c(r.selectedRange)),s={range:o,isActiveCell:!1,skipChecking:!0};if(n){t.parent.notify(jn,s);var l=u(r.activeCell)[1];if(s.isActiveCell){var h=Re(o[0],o[1],r,!1,!0);a=h.rowSpan>1||h.colSpan>1}l===e.colIdx||a?n.style.width=parseFloat(n.style.width)+e.threshold+"px":l>e.colIdx&&(i?n.style.right=parseFloat(n.style.right)+e.threshold+"px":n.style.left=parseFloat(n.style.left)+e.threshold+"px")}if((n=t.getSelectionElement())&&!a&&(o[0]!==o[2]||o[1]!==o[3])){var d=o[1],p=o[3];d<=e.colIdx&&p>=e.colIdx&&n?n.style.width=parseFloat(n.style.width)+e.threshold+"px":d>e.colIdx&&n&&(i?n.style.right=parseFloat(n.style.right)+e.threshold+"px":n.style.left=parseFloat(n.style.left)+e.threshold+"px")}}}})},e.prototype.selectRange=function(e){e.address="Single"===this.parent.selectionSettings.mode?m(u(e.address)):e.address,this.selectMultiRange(e.address,null,null,e.skipChecking)},e.prototype.init=function(){this.createSelectionElement();var e=this.parent.getActiveSheet(),t=w(c(e.selectedRange)),r=u(e.activeCell),n=t[0]<=r[0]&&t[2]>=r[0]&&t[1]<=r[1]&&t[3]>=r[1];this.selectMultiRange(e.selectedRange,!0,n)},e.prototype.selectMultiRange=function(e,t,r,n){var i=this,a=this.parent.activeSheetIndex;e.indexOf("!")>-1&&(a=ce(this.parent,fe(e)),e=e.split("!")[1]),this.parent.activeSheetIndex===a?e.split(" ").forEach(function(e,a){i.selectRangeByIdx(c(e),{type:"mousedown",ctrlKey:0!==a},null,r,t,n)}):me(this.parent,e,this.parent.sheets[a])},e.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)},e.prototype.mouseDownHandler=function(e){if(!(t.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();this.parent.notify(Da,r);var i=B(r.editedValue,!0);if(!this.parent.isEdit||i){var a=document.getElementById(this.parent.element.id+"_overlay");if("string"==typeof e.target.className){if(e.target.className.indexOf("e-ss-overlay")>-1)return}else a&&a.classList.remove("e-ss-overlay-active");if(t.closest(e.target,".e-datavisualization-chart"))return;if(n.isProtected&&!n.protectSettings.selectCells&&!n.protectSettings.selectUnLockedCells)return;if(!t.closest(e.target,".e-findtool-dlg")&&this.getSheetElement().contains(e.target)&&!e.target.classList.contains("e-colresize")&&!e.target.classList.contains("e-rowresize")){var o=this.parent.getActiveSheet(),s=this.parent.selectionSettings.mode,l=this.getRowIdxFromClientY({clientY:It(e),target:e.target}),h=this.getColIdxFromClientX({clientX:wt(e),target:e.target}),d=u(o.activeCell),p=(Re(l,h,o),void 0),f=void 0;if(o.showHeaders){var g=e.target;if(o.frozenColumns||o.frozenRows){var v=this.parent.getSelectAllContent().querySelector("thead");f=v?(this.parent.getColumnHeaderContent().contains(g)||v.contains(g))&&g.classList.contains("e-header-cell"):this.parent.getColumnHeaderContent().contains(g)&&g.classList.contains("e-header-cell"),p=(v=this.parent.getSelectAllContent().querySelector("tbody"))?(this.parent.getRowHeaderContent().contains(g)||v.contains(g))&&g.classList.contains("e-header-cell"):this.parent.getRowHeaderContent().contains(g)&&g.classList.contains("e-header-cell")}else p=this.parent.getRowHeaderContent().contains(e.target),f=this.parent.getColumnHeaderContent().contains(e.target)}if(3===e.which&&this.isSelected(l,h))return;if(e.target.classList.contains("e-autofill")){this.isautoFillClicked=!0;var C=e.target.parentElement.querySelector(".e-dragfill-ddb");C&&!C.classList.contains("e-hide")||(this.dAutoFillCell=o.selectedRange)}var b=c(o.topLeftCell),x=void 0;if(p?(this.isRowSelected=!0,e.shiftKey&&"Single"!==s||(this.startCell=[l,0]),x=[this.startCell[0],o.frozenColumns?b[1]:0,l,o.colCount-1]):f?(this.isColSelected=!0,e.shiftKey&&"Single"!==s||(this.startCell=[0,h]),x=[o.frozenRows?b[0]:0,this.startCell[1],o.rowCount-1,h]):t.closest(e.target,".e-select-all-cell")?(this.startCell=[o.frozenRows?b[0]:0,o.frozenColumns?b[1]:0],x=[].concat(this.startCell,[o.rowCount-1,o.colCount-1])):e.target.classList.contains("e-sheet-content")||(e.shiftKey&&"Single"!==s||(this.startCell=[l,h]),this.isautoFillClicked||t.closest(e.target,".e-filloption")||(x=[].concat(this.startCell?this.startCell:u(o.activeCell),[l,h]))),mt(e)&&!p&&!f&&x){var S=this.isRowColSelected(x);this.isRowSelected=S.isRowSelected,this.isColSelected=S.isColSelected}var w=e.ctrlKey&&x&&o.selectedRange.includes(m(x));if(!w&&"Multiple"===s&&(!yt(e)&&(!mt(e)||mt(e)&&d[0]===l&&d[1]===h)||f||p)?(document.addEventListener(ft().split(" ")[0],this.mouseMoveEvt),t.Browser.isPointer||(t.Browser.isIos&&mt(e)&&e.target&&e.target.classList.contains("e-cell")&&e.preventDefault(),document.addEventListener(ft().split(" ")[1],this.mouseMoveEvt,{passive:!1})),this.touchSelectionStarted=!0):this.touchSelectionStarted=!1,w||yt(e)||t.EventHandler.add(document,gt(),this.mouseUpHandler,this),mt(e)&&!f&&!p)return void(this.touchEvt=e);x&&this.selectRangeByIdx(x,e),this.parent.isMobileView()&&(this.parent.element.classList.add("e-mobile-focused"),this.parent.renderModule.setSheetPanelSize())}}if(i&&(e.target.classList.contains("e-cell")||e.target.classList.contains("e-wrap-content")||e.target.classList.contains("e-header-cell"))&&this.parent.isEdit){x=E(y(x=this.parent.getActiveSheet().selectedRange))?x.split(":")[0]:x,this.parent.notify(Is,{range:x,isSelect:!1})}}},e.prototype.mouseMoveHandler=function(e){var r=this,n=this.parent.getActiveSheet();vt(e)&&e.preventDefault();var i={action:"getCurrentEditValue",editedValue:""};this.parent.notify(Da,i);var a,o,s=B(i.editedValue,!0),l=this.parent.getMainContent().parentElement,h=this.parent.element.getElementsByClassName("e-scroller")[0],d=l.getBoundingClientRect(),p=this.parent.frozenColCount(n),f=d.left+this.parent.sheetModule.getRowHeaderWidth(n),g=d.top,v=d.right-it(),y=d.bottom,C=wt(e),b=It(e),x=this.isRowSelected?n.colCount-1:this.getColIdxFromClientX({clientX:C,target:e.target}),S=this.isColSelected?n.rowCount-1:this.getRowIdxFromClientY({clientY:b,target:e.target});if(e.ctrlKey){var w=n.selectedRange.split(" ");a=c(w[w.length-1])}else a=c(n.selectedRange);if(t.Browser.isDevice){var I=screen.availWidth;v>=I-40&&(v-=40-(I-v)),!n.showHeaders&&f<40&&(f+=40-f)}var E={range:[S,x,S,x]};if(this.parent.notify(qn,E),!(E.range[2]===a[2]&&E.range[3]===a[3]&&b<=y&&b>=g&&C<=v&&C>=f)){var R=this.parent.frozenRowCount(n),k=b>y&&S<n.rowCount,F=b<g&&S>=0&&!this.isColSelected&&!!l.scrollTop;R>S&&(k=!1,F=!1);var A=C>v&&x<n.colCount,N=C<f&&x>=0&&!this.isRowSelected&&!!h.scrollLeft;p>x&&(A=!1,N=!1),this.clearInterval();var O,T;if(s||this.isColSelected||this.isRowSelected||(a=u(n.activeCell)),k||F||A||N){(F||N)&&(O=S,T=x);var D=function(){if((k||F)&&!r.isColSelected){if((S=r.getRowIdxFromClientY({clientY:k?y:g}))>=n.rowCount)return void r.clearInterval();l.scrollTop+=(k?1:-1)*We(n,S)}if((A||N)&&!r.isRowSelected){if((x=r.getColIdxFromClientX({clientX:A?v:f}))>=n.colCount)return void r.clearInterval();h.scrollLeft+=(A?1:-1)*$e(n,x)}if(F&&n.frozenRows&&!l.scrollTop||N&&n.frozenColumns&&!h.scrollLeft)return r.selectRangeByIdx([].concat(a[0],a[1],[O,T]),e),void r.clearInterval();r.selectRangeByIdx([].concat(a[0],a[1],[S,x]),e)};D(),this.scrollInterval=setInterval(function(){D(),r.clearInterval(),r.scrollInterval=setInterval(D,100)})}else{var L=[].concat(a[0],a[1],[S,x]);if(R&&L[0]<R&&L[2]>=R&&l.scrollTop&&(l.scrollTop=0,L[2]=R),p&&L[1]<p&&L[3]>=p&&h.scrollLeft&&(h.scrollLeft=0,L[3]=p),this.isautoFillClicked){e.target.classList.contains("e-autofill")&&(this.dAutoFillCell=n.selectedRange);var P={e:e,indexes:null};this.parent.notify(sl,P),o=L=P.indexes}this.selectRangeByIdx(L,e)}if(s&&this.parent.isEdit&&!t.closest(e.target,"#"+this.parent.element.id+"_edit")){var M=void 0;M=this.isautoFillClicked?m(o):this.parent.getActiveSheet().selectedRange,this.parent.notify(Is,{range:M,isSelect:!1})}}},e.prototype.mouseUpHandler=function(e){var r=this.getRowIdxFromClientY({clientY:It(e),target:e.target}),n=this.getColIdxFromClientX({clientX:wt(e),target:e.target});this.clearInterval(),!yt(e)||this.isColSelected||this.isRowSelected||this.getRowIdxFromClientY({clientY:It(this.touchEvt),target:e.target})!==r||this.getColIdxFromClientX({clientX:wt(this.touchEvt),target:e.target})!==n||this.mouseDownHandler(e),document.removeEventListener(ft().split(" ")[0],this.mouseMoveEvt),t.Browser.isPointer||document.removeEventListener(ft().split(" ")[1],this.mouseMoveEvt),t.EventHandler.remove(document,gt(),this.mouseUpHandler);var i=this.parent.getActiveSheet();if((i.frozenRows||i.frozenColumns)&&dt(this.parent.element,null,"e-cur-selection",!0,!0),this.parent.notify(Wa,e),this.isautoFillClicked){var a=c(this.parent.getActiveSheet().selectedRange);this.isColSelected&&a[1]===n||this.isRowSelected&&a[0]===r||this.parent.notify(ol,{event:e,dAutoFillCell:this.dAutoFillCell}),this.isautoFillClicked=!1}else e.ctrlKey||Yt(ve(this.parent.getActiveSheet()))?this.parent.notify(ll,null):this.parent.notify(il,null);var o={action:"getCurrentEditValue",editedValue:""};this.parent.notify(Da,o);var s=B(o.editedValue)||o.editedValue&&0===o.editedValue.toString().indexOf("=");this.parent.isEdit&&s&&this.parent.notify(xs,{isCellEdit:e.target.classList.contains("e-spreadsheet-edit")})},e.prototype.isSelected=function(e,t){for(var r,n=!1,i=this.parent.getActiveSheet().selectedRange.split(" "),a=0;a<i.length;a++)if((r=w(c(i[a])))[0]<=e&&e<=r[2]&&r[1]<=t&&t<=r[3]){n=!0;break}return n},e.prototype.virtualContentLoadedHandler=function(e){var t,r,n,i=this,a=this.parent.getActiveSheet();a.selectedRange.split(" ").forEach(function(o,s){if(t=c(o),n=0===t[1]&&t[3]===e.prevRowColCnt.colCount-1,r=0===t[0]&&t[2]===e.prevRowColCnt.rowCount-1,n||r)t=r&&n?[0,0,a.rowCount-1,a.colCount-1]:r?[0,t[1],a.rowCount-1,t[3]]:[t[0],0,t[2],a.colCount-1],a.frozenRows||a.frozenColumns?i.selectRangeByIdx(t,{type:"mousedown",ctrlKey:0!==s},!1,!1,!1,!1,void 0,!0):i.selectRangeByIdx(t,null,!0,null,null,null,s);else{t=c(o);var l=i.parent.viewport.topIndex+i.parent.frozenRowCount(a),h=i.parent.viewport.leftIndex+i.parent.frozenColCount(a);i.highlightHdr(t,0!==s,t[0]>=l||t[2]>=l,t[1]>=h||t[3]>=h)}})},e.prototype.clearInterval=function(){this.scrollInterval&&(clearInterval(this.scrollInterval),this.scrollInterval=null)},e.prototype.getScrollLeft=function(){return this.parent.scrollModule?this.parent.scrollModule.prevScroll.scrollLeft:0},e.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)},e.prototype.getColIdxFromClientX=function(e){var r=0,n=this.parent.getActiveSheet(),i=0;if(e.isImage)i=e.clientX;else{var a=document.getElementById(this.parent.element.id+"_sheet").getBoundingClientRect();if(i=this.parent.enableRtl?a.right-this.parent.sheetModule.getRowHeaderWidth(n,!0)-1-e.clientX:e.clientX-(a.left+this.parent.sheetModule.getRowHeaderWidth(n,!0)+1),i+=this.parent.viewport.beforeFreezeWidth,!e.target||!t.closest(e.target,".e-row-header")&&!t.closest(e.target,".e-selectall-container")||this.isScrollableArea(e.clientX,e.target,!0))if(this.parent.frozenColCount(n)){var o=this.parent.element.querySelector(".e-frozen-column");i=parseInt(o.style.left,10)>i?i:i+this.getScrollLeft()}else i+=this.getScrollLeft()}for(var s,l=0;;l++)if(s=r+=$e(n,l,null,!e.isImage),i<(e.isImage?Number(Qt(s).toFixed(2)):s)||this.parent.scrollSettings.isFinite&&l===n.colCount-1)return e.isImage||(e.size=i),e.clientX=l,l},e.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)},e.prototype.getRowIdxFromClientY=function(e){var r=0,n=this.parent.getActiveSheet(),i=0;if(e.isImage)i=e.clientY;else{var a=document.getElementById(this.parent.element.id+"_sheet");i=e.clientY+this.parent.viewport.beforeFreezeHeight-(a.getBoundingClientRect().top+(n.showHeaders?31:0)),e.target&&t.closest(e.target,".e-header-panel")&&!this.isScrollableArea(e.clientY,e.target)||(i+=this.parent.getMainContent().parentElement.scrollTop)}for(var o,s=0;;s++)if(o=r+=We(n,s,!e.isImage),i<(e.isImage?Number(Qt(o).toFixed(2)):o)||this.parent.scrollSettings.isFinite&&s===n.rowCount-1)return e.isImage||(e.size=i),e.clientY=s,s},e.prototype.initFormulaReferenceIndicator=function(e){if(this.parent.isEdit){var t=this.parent.createElement("div",{className:"e-formularef-indicator"});t.appendChild(this.parent.createElement("div",{className:"e-top"})),t.appendChild(this.parent.createElement("div",{className:"e-bottom"})),t.appendChild(this.parent.createElement("div",{className:"e-left"})),t.appendChild(this.parent.createElement("div",{className:"e-right"})),this.parent.getMainContent().appendChild(t),ht(this.parent,t,e,"e-formularef-indicator")}},e.prototype.isMouseEvent=function(e){return Ct(e)||xt(e)||bt(e)},e.prototype.selectRangeByIdx=function(e,r,n,i,a,o,s,l){var h=this,d=r&&this.isMouseEvent(r);if(!(r&&r.target&&d&&t.closest(r.target,"#"+this.parent.element.id+"_edit"))){var p={action:"getCurrentEditValue",editedValue:"",endFormulaRef:!1};this.parent.notify(Da,p);var u,f=!!this.parent.isEdit&&B(p.editedValue,!0)&&!p.endFormulaRef,g=r&&r.ctrlKey&&Ct(r);g||(u=this.getSelectionElement(r,s));var v,y=this.parent.getActiveSheet(),C=c(y.topLeftCell),b=this.parent.element.querySelector(".e-formularef-indicator"),x={range:[].slice.call(e),isActiveCell:!1,skipChecking:o},S=this.isRowColSelected(e);S.isColSelected||S.isRowSelected||this.parent.notify(jn,x),e!==x.range&&(v=!0),e=x.range;var w=new Promise(function(e){e(void 0)}),I={range:m(e),cancel:!1};if(y.isProtected){var R=Re(e[2],e[3],y);if(y.protectSettings.selectUnLockedCells&&!y.protectSettings.selectCells)if(t.isNullOrUndefined(R)){if(!y.protectSettings.selectCells)return}else{if(!0===R.isLocked||t.isNullOrUndefined(R.isLocked))return;var k=this.parent.element.getElementsByClassName("e-sheet-panel")[0];k&&k.classList.contains("e-protected")&&k.classList.remove("e-protected")}}if(this.parent.trigger("beforeSelect",I),!I.cancel){if(f&&b&&b.parentElement.removeChild(b),this.parent.notify(al,null),!E(e)&&!x.isActiveCell||g){if(g)if(void 0===s){var F=m(e);if(y.selectedRange.includes(F)){return(L=y.selectedRange.split(" ")).length>1?(L.splice(L.indexOf(F),1),F=L.join(" ")):F=y.activeCell+":"+y.activeCell,void this.selectRange({address:F})}u=this.getSelectionElement(r,s)}else u=this.getSelectionElement(r,s);if(f&&this.parent.isEdit){if(r&&r.target&&(!d||!r.target.classList.contains("e-spreadsheet-edit"))&&this.parent.isEdit){O={range:m(e),isSelect:!0};if(this.parent.notify(Is,O),O.isAlertDlgOpen)return;this.initFormulaReferenceIndicator(e)}}else{N=void 0;u&&(u.classList.remove("e-hide"),(y.frozenRows||y.frozenColumns)&&((r&&r.target||g)&&(N="e-cur-selection",bt(r)&&u.classList.contains("e-cur-selection")?u.classList.add("e-hide"):u.classList.add(N)),!g&&(this.isColSelected||this.isRowSelected)&&Ct(r)&&(dt(this.parent.getSelectAllContent(),null,"e-selection"),dt(this.parent.getColumnHeaderContent(),null,"e-selection"),dt(this.parent.getRowHeaderContent(),null,"e-selection"))));var A=this.isColSelected&&this.isRowSelected?void 0:this.getOffset(e[2],e[3]);v&&A&&(A.left={idx:0,size:0}),w=ht(this.parent,u,e,N,l,g,g&&!r.target)||w}}else{if(u&&(u.classList.contains("e-multi-range")||u.classList.add("e-hide"),y.frozenRows||y.frozenColumns)){var N=bt(r)?"e-cur-selection":"e-selection";dt(this.parent.getSelectAllContent(),null,N,!0),dt(this.parent.getColumnHeaderContent(),null,N,!0),dt(this.parent.getRowHeaderContent(),null,N,!0)}if(y.frozenColumns||y.frozenRows||!u||ht(this.parent,u,e),f&&r&&r.target&&(!d||!r.target.classList.contains("e-spreadsheet-edit"))&&this.parent.isEdit){var O={range:m(e).split(":")[0],isSelect:!0};if(this.parent.notify(Is,O),O.isAlertDlgOpen)return;this.initFormulaReferenceIndicator(e)}}var T={action:"getCurrentEditSheetIdx",sheetIndex:null};this.parent.notify(Da,T),y.frozenColumns&&e[1]>0&&e[1]===C[1]&&e[3]===y.colCount-1&&(e[1]=0),y.frozenRows&&e[0]>0&&e[0]===C[0]&&e[2]===y.rowCount-1&&(e[0]=0);var D=m(e);if(r&&r.ctrlKey&&(bt(r)||xt(r)))D=y.selectedRange.slice(0,y.selectedRange.lastIndexOf(" "))+" "+D;else if(s>-1){var L;(L=y.selectedRange.split(" "))[s]=D,D=L.join(" ")}if(f||this.isautoFillClicked)a||this.isautoFillClicked||me(this.parent,D,y,g);else{var P=!1;y.selectedRange!==D&&(P=!0),me(this.parent,D,y,g),P&&w.then(function(){h.parent.trigger("select",{range:h.parent.getActiveSheet().selectedRange})})}S=this.isRowColSelected(e),this.isRowSelected=S.isRowSelected,this.isColSelected=S.isColSelected,this.highlightHdr(e,r&&r.ctrlKey),n||r&&("mousemove"===r.type||vt(r))||(f?T.sheetIndex===this.parent.getActiveSheet().id-1&&a?(i=!0,this.updateActiveCell(i?c(y.activeCell):e,a,l)):this.parent.isEdit||this.updateActiveCell(i?c(y.activeCell):e,a,l):this.updateActiveCell(i?c(y.activeCell):e,a,l)),t.isNullOrUndefined(r)&&(r={type:"mousedown"}),f?a||this.parent.notify(xi,r):this.parent.notify(xi,r),g||Yt(ve(this.parent.getActiveSheet()))?this.parent.notify(ll,null):this.parent.notify(il,{preventAnimation:l}),this.parent.showAggregate&&this.parent.notify(gs,{}),this.parent.notify(Fs,null)}}},e.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}},e.prototype.updateActiveCell=function(e,t,r){var n,i,a,o=this.parent.getActiveSheet(),s=c(o.topLeftCell);this.isColSelected?(n=s[0],i=e[1],this.isRowSelected&&(i=s[1])):(n=e[0],i=e[1],this.isRowSelected&&(i=s[1]));var l={range:[n,i].concat([n,i])};if(this.parent.notify(qn,l),e!==l.range&&(a=!0),e=l.range,o.activeCell!==g(e[0],e[1])||t){if(this.parent.setSheetPropertyOnMute(o,"activeCell",g(e[0],e[1])),o.isProtected){var h=this.parent.element.querySelector(".e-formula-bar"),d=Y(Re(e[0],e[1],o),Xe(o,e[1]));d&&h&&!h.disabled?h.disabled=!0:!d&&h&&h.disabled&&(h.disabled=!1)}if(this.getActiveCell()){var p=this.getOffset(e[2],e[3]);a&&(p.left={idx:0,size:0}),ht(this.parent,this.getActiveCell(),e,"e-active-cell",r)}this.parent.notify(Kr,null)}else ht(this.parent,this.getActiveCell(),e,"e-active-cell",r)},e.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},e.prototype.getSelectionElement=function(e,r){var n=this.parent.getActiveSheet();if(e&&e.ctrlKey){if(xt(e)||bt(e)){if(n.frozenColumns||n.frozenRows){return(i=this.parent.getMainContent().querySelector(".e-cur-selection"))||(i=this.parent.element.querySelector(".e-multi-range"))&&i.cloneNode()}return this.parent.getMainContent().querySelector(".e-selection:last-child")}var i,a=this.parent.getMainContent().getElementsByClassName("e-selection")[0];return(i=a.cloneNode()).classList.add("e-multi-range"),n.frozenColumns||n.frozenRows?(n.selectedRange.includes(" ")||(a.classList.remove("e-hide"),ht(this.parent,a,w(c(n.selectedRange)),void 0,!1,!0)),!this.parent.getMainContent().querySelector(".e-multi-range")&&a.classList.contains("e-hide")?a:i):(a.classList.remove("e-hide"),this.parent.getMainContent().appendChild(i))}if(r>-1)return n.frozenRows||n.frozenColumns?this.parent.element.querySelector(".e-sheet").getElementsByClassName("e-selection")[r]:this.parent.getMainContent().getElementsByClassName("e-selection")[r];return[].slice.call(this.parent.element.getElementsByClassName("e-multi-range")).forEach(function(e){t.remove(e)}),this.parent.getMainContent().getElementsByClassName("e-selection")[0]},e.prototype.getActiveCell=function(){return this.parent.getMainContent().getElementsByClassName("e-active-cell")[0]},e.prototype.getSheetElement=function(){return document.getElementById(this.parent.element.id+"_sheet")},e.prototype.highlightHdr=function(e,r,n,i){var a=this;void 0===n&&(n=!0),void 0===i&&(i=!0);var o=this.parent.getActiveSheet();if(o.showHeaders){r||(t.removeClass(this.getSheetElement().querySelectorAll(".e-highlight"),"e-highlight"),t.removeClass(this.getSheetElement().querySelectorAll(".e-prev-highlight"),"e-prev-highlight"));var s=this.parent.element.getElementsByClassName("e-select-all-cell")[0];s&&t.removeClass([s],["e-prev-highlight-right","e-prev-highlight-bottom"]);var l=[],h=[],d=w(e);this.isRowSelected&&(d[1]=$(o,d[1],!0,"columns")),this.isColSelected&&(d[0]=$(o,d[0],!0));var p,c,f=[0,0,0,0],g=[0,0,0,0],m=u(o.topLeftCell),v=function(e,t,r){var n,i;if(e&&d[p]<e){m[p]=$(o,m[p],!0,t);(s=$(o,d[p],!0,t))===m[p]&&(d[p]=s),i=a.parent.hiddenCount(m[p],d[p]-1,t,o),f[p]=d[p]-i-m[p],n=d[c]<e?d[c]:e-1,f[c]=n-a.parent.hiddenCount(d[p],n,t,o)-i-m[p]+1,n=a.parent.viewport[""+r]+e,d[c]>=n&&(g[p]=0,g[p]-=a.parent.hiddenCount(n,n,t,o),g[c]=d[c]-a.parent.hiddenCount(n,d[c],t,o)-n+1)}else{var s;(n=$(o,a.parent.viewport[""+r]+e,!0,t))===(s=$(o,d[p],!0,t))&&(d[p]=n),i=a.parent.hiddenCount(n,d[p]-1,t,o),g[p]=d[p]-i-n,g[c]=d[c]-a.parent.hiddenCount(d[p],d[c],t,o)-i-n+1}},y=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])};if(n){if(p=0,c=2,v(this.parent.frozenRowCount(o),"rows","topIndex"),o.frozenRows){var C=this.parent.getSelectAllContent().querySelector("tbody");C&&y(f,C,l)}y(g,this.parent.getRowHeaderContent(),l)}if(i){if(p=1,c=3,v(this.parent.frozenColCount(o),"columns","leftIndex"),o.frozenColumns){var b=this.parent.getSelectAllContent().querySelector("thead");b&&y(f,b,h)}y(g,this.parent.getColumnHeaderContent(),h)}o.isProtected&&!o.protectSettings.selectCells?t.removeClass([].concat(l,h),"e-highlight"):t.addClass([].concat(l,h),"e-highlight"),l.length&&l[0].parentElement.previousElementSibling&&l[0].parentElement.previousElementSibling.classList.add("e-prev-highlight"),h.length&&h[0].previousElementSibling&&h[0].previousElementSibling.classList.add("e-prev-highlight"),this.isRowSelected&&this.isColSelected&&(o.isProtected&&!o.protectSettings.selectCells?document.getElementById(this.parent.element.id+"_select_all").classList.remove("e-highlight"):document.getElementById(this.parent.element.id+"_select_all").classList.add("e-highlight")),s&&($(o,d[0],!0)===$(o,0,!0)&&s.classList.add("e-prev-highlight-bottom"),$(o,d[1],!0,"columns")===$(o,0,!0,"columns")&&s.classList.add("e-prev-highlight-right"))}},e.prototype.protectHandler=function(){var e=c(this.parent.getActiveSheet().selectedRange),t=w(e),r=u(this.parent.getActiveSheet().activeCell),n=t[0]<=r[0]&&t[2]>=r[0]&&t[1]<=r[1]&&t[3]>=r[1];this.selectRangeByIdx(e,null,null,n)},e.prototype.initiateFormulaSelection=function(e){this.processFormulaEditRange(e.range,e.formulaSheetIdx)},e.prototype.processFormulaEditRange=function(e,t){var r,n=t,i=0,a={formula:e};this.parent.notify(Fi,a);var o=a.formulaArr,s=o.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"]];this.clearBorder();for(var d=this.parent.getActiveSheet().id-1;i<s&&(r=o[i],!(this.invalidOperators.indexOf(r)>-1));){if(U(r.toUpperCase())){if(r=r.replace(/\$/g,""),i>0&&o[i-1].indexOf("!")===o[i-1].length-1){var p=o[i-1].split("!");n=ce(this.parent,p[0].substring(1,p[0].length-1))}":"===o[i+1]&&o[++i+1]&&U(o[i+1].toUpperCase())&&(r=r+":"+o[i+1],i++),d===n&&this.updateFormulaEditRange(r,l,h),n=t,l++}i++}},e.prototype.updateFormulaEditRange=function(e,t,r){var n=c(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])},e.prototype.chartBorderHandler=function(e){this.focusBorder(e.startcell,e.endcell,e.classes,!0)},e.prototype.focusBorder=function(e,r,n,i){i=!t.isNullOrUndefined(i)&&i;var a=this.parent.getActiveSheet(),o=w([e.rowIndex,e.colIndex,r.rowIndex,r.colIndex]),s=c(a.topLeftCell),l=this.parent.hiddenCount(s[1],o[3]-1,"columns",a);if(i&&l>0&&(o[1]-=l,o[3]-=l),a.frozenRows||a.frozenColumns){var h=this.parent.createElement("div",{className:i?"e-range-indicator e-chart-range":"e-range-indicator e-formuala-range"});return h.appendChild(this.parent.createElement("div",{className:"e-top"})),h.appendChild(this.parent.createElement("div",{className:"e-bottom"})),h.appendChild(this.parent.createElement("div",{className:"e-left"})),h.appendChild(this.parent.createElement("div",{className:"e-right"})),void ht(this.parent,h,o,"e-range-indicator")}var d=o[0],p=o[1],u=o[2],f=o[3];d&&this.getEleFromRange([d-1,p,d-1,f]).forEach(function(e){e&&(e.classList.add(n[1]),i||e.classList.add("e-formularef-selection"))}),this.getEleFromRange([d,f,u,f]).forEach(function(e){e&&(e.classList.add(n[0]),i||e.classList.add("e-formularef-selection"))}),this.getEleFromRange([u,p,u,f]).forEach(function(e){e&&(e.classList.add(n[1]),i||e.classList.add("e-formularef-selection"))}),p&&this.getEleFromRange([d,p-1,u,p-1]).forEach(function(e){e&&(e.classList.add(n[0]),i||e.classList.add("e-formularef-selection"))})},e.prototype.getEleFromRange=function(e){var t,r,n,i,a=e[0],o=e[1],s=e[2],l=e[3],h=[],d=[];if(a>s&&(n=a,a=s,s=n),o>l&&(n=o,o=l,l=n),this.parent.scrollSettings.enableVirtualization)for(t=a;t<=s;t++)if((r=t)>-1){var p=this.parent.getRow(r,null);p&&(i=p.getElementsByClassName("e-cell"),h=l===o?[i[l]]:this.getRowCells(i,o,l+1),this.merge(d,h))}return d},e.prototype.getRowCells=function(e,t,r){for(var n=[];t<r;t++)e[t]&&n.push(e[t]);return n},e.prototype.merge=function(e,t){e&&t&&Array.prototype.push.apply(e,t)},e.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){t.detach(e)})}else for(var r=this.parent.element.getElementsByClassName("e-formularef-selection"),n=r.length-1;n>=0;n--)for(var i=r[n],a=["e-vborderright","e-vborderbottom","e-pborderright","e-pborderbottom","e-cborderright","e-cborderbottom","e-gborderright","e-gborderbottom","e-oborderright","e-oborderbottom","e-bborderright","e-bborderbottom","e-formularef-selection"],o=0;o<a.length;o++)i.classList.remove(a[o])},e.prototype.getModuleName=function(){return"selection"},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e}(),Zl=function(){function e(e){this.clientX=0,this.isKeyScroll=!0,this.parent=e,this.addEventListener(),this.initProps()}return e.prototype.onContentScroll=function(e){if(this.parent){var r,n,i=this.parent.getMainContent().parentElement,a=e.scrollLeft,o=e.scrollTop||i.scrollTop,s=a&&this.parent.enableRtl?this.initScrollValue-a:a;if(this.parent.allowAutoFill){var l=document.querySelector("#"+this.parent.element.id+"_autofilloptionbtn-popup"),h=document.querySelector("#"+this.parent.element.id+"_autofilloptionbtn");if(l){t.getComponent(h,"dropdown-btn").toggle()}}if(!t.isNullOrUndefined(a)&&this.prevScroll.scrollLeft!==s){var d=s>this.prevScroll.scrollLeft;n=this.offset.left.size,this.offset.left=this.getColOffset(s,d,e.skipHidden),e.preventScroll||(this.parent.getColumnHeaderContent().scrollLeft=a,this.parent.getMainContent().scrollLeft=a,e.scrollLeft=a),r={cur:this.offset.left,prev:{idx:this.leftIndex,size:n},increase:d,preventScroll:e.preventScroll},this.updateTopLeftCell(d,!0),this.parent.notify(Va,r),this.parent.scrollSettings.enableVirtualization||!d||this.parent.scrollSettings.isFinite||this.updateNonVirtualCols(),this.leftIndex=r.prev.idx,this.prevScroll.scrollLeft=s}if(Math.round(this.prevScroll.scrollTop)!==Math.round(o)){e.skipRowVirualScroll&&(this.prevScroll.scrollTop=0,this.offset.top={idx:0,size:0});var p=o>this.prevScroll.scrollTop;n=this.offset.top.size,this.offset.top=this.getRowOffset(o,p),r={cur:this.offset.top,prev:{idx:this.topIndex,size:n},increase:p,preventScroll:e.preventScroll},this.updateTopLeftCell(p),e.preventScroll&&this.offset.top.idx<=this.parent.getThreshold("row")?this.offset.top={idx:0,size:0}:e.skipRowVirualScroll?r.prev.idx=r.cur.idx:this.parent.notify(Ua,r),this.parent.scrollSettings.enableVirtualization||!p||this.parent.scrollSettings.isFinite||this.updateNonVirtualRows(),this.topIndex=r.prev.idx,this.prevScroll.scrollTop=o}var c={isEdit:!1};if(this.parent.notify(Aa,c),c.isEdit){this.parent.element.querySelector(".e-formula-bar").focus()}this.isKeyScroll=!0}},e.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)},e.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)},e.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)},e.prototype.updateTopLeftCell=function(e,t){var r=this.parent.getActiveSheet(),n=this.offset.top.idx,i=this.offset.left.idx;if(!e){var a=this.parent.frozenRowCount(r);n=$(r,n+a,!0)-a;var o=this.parent.frozenColCount(r);i=$(r,i+o,!0,"columns")-o}t?this.parent.updateTopLeftCell(null,i,"row"):this.parent.updateTopLeftCell(n,null,"col")},e.prototype.getRowOffset=function(e,t){var r=this.offset.top.size,n=this.parent.getActiveSheet(),i=t?this.offset.top.idx+1:this.offset.top.idx?this.offset.top.idx-1:0,a=this.parent.frozenRowCount(n),o=this.parent.scrollSettings.isFinite?n.rowCount:1/0;for(e=Math.round(e);i<o;)if(t){if(r+=We(n,i-1+a,!0),Math.abs(Math.round(r)-e)<=1)return{idx:$(n,i+a,!0)-a,size:r};if(Math.round(r)>e)return{idx:i-1,size:r-We(n,i-1+a,!0)};i++}else{if((r-=We(n,i+a,!0))<=0)return{idx:0,size:0};if(Math.abs(Math.round(r)-e)<=1)return{idx:i,size:r};if(Math.round(r)<e)return r+=We(n,i+a,!0),Math.round(r)>e?{idx:i,size:r-We(n,i+a,!0)<0?0:r-We(n,i+a,!0)}:{idx:$(n,i+1+a,!0)-a,size:r};i--}return{idx:this.offset.top.idx,size:this.offset.top.size}},e.prototype.getColOffset=function(e,t,r){for(var n=this.offset.left.size,i=this.parent.getActiveSheet(),a=t?this.offset.left.idx+1:this.offset.left.idx?this.offset.left.idx-1:0,o=this.parent.frozenColCount(i),s=this.parent.scrollSettings.isFinite?i.colCount:1/0;a<s;)if(t){if(n+=$e(i,a-1+o,r,!0),Math.abs(Math.round(n)-e)<=1)return{idx:$(i,a+o,!0,"columns")-o,size:n};if(Math.round(n)>e)return{idx:a-1,size:n-$e(i,a-1+o,r,!0)};a++}else{if((n-=$e(i,a+o,r,!0))<=0)return{idx:0,size:0};if(Math.abs(Math.round(n)-e)<=1)return{idx:a,size:n};if(Math.round(n)<e)return n+=$e(i,a+o,r,!0),Math.round(n)>e?(n-=$e(i,a+o,r,!0),{idx:a,size:n<0?0:n}):{idx:$(i,a+1+o,!0,"columns")-o,size:n};a--}return{idx:this.offset.left.idx,size:this.offset.left.size}},e.prototype.contentLoaded=function(e){if(!this.parent.scrollSettings.enableVirtualization){var t=this.parent.createElement("div",{className:"e-virtualtrack"});this.updateNonVirualScrollWidth({scrollTrack:t}),this.parent.getScrollElement().appendChild(t)}e.left&&(this.parent.getScrollElement().scrollLeft=e.left),this.setScrollEvent(),this.parent.enableRtl&&(this.initScrollValue=this.parent.getScrollElement().scrollLeft)},e.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"},e.prototype.onHeaderWheel=function(e){e.preventDefault(),this.parent.getMainContent().parentElement.scrollTop+=e.deltaY,this.parent.getScrollElement().scrollLeft+=e.deltaX},e.prototype.onContentWheel=function(e){0!==e.deltaX&&(e.preventDefault(),this.parent.getScrollElement().scrollLeft+=e.deltaX)},e.prototype.scrollHandler=function(e){this.onContentScroll({scrollLeft:e.target.scrollLeft})},e.prototype.updateScroll=function(e){t.isNullOrUndefined(e.left)?this.parent.sheetModule.contentPanel.scrollTop=e.top:this.parent.getScrollElement().scrollLeft=e.left},e.prototype.setScrollEvent=function(e){void 0===e&&(e={set:!0}),e.set?(t.EventHandler.add(this.parent.sheetModule.contentPanel,"scroll",this.onContentScroll,this),t.EventHandler.add(this.parent.getColumnHeaderContent(),"wheel",this.onHeaderWheel,this),t.EventHandler.add(this.parent.getSelectAllContent(),"wheel",this.onHeaderWheel,this),t.EventHandler.add(this.parent.getMainContent(),"wheel",this.onContentWheel,this),t.EventHandler.add(this.parent.getRowHeaderContent(),"wheel",this.onContentWheel,this),t.EventHandler.add(this.parent.getScrollElement(),"scroll",this.scrollHandler,this)):(t.EventHandler.remove(this.parent.sheetModule.contentPanel,"scroll",this.onContentScroll),t.EventHandler.remove(this.parent.getColumnHeaderContent(),"wheel",this.onHeaderWheel),t.EventHandler.remove(this.parent.getSelectAllContent(),"wheel",this.onHeaderWheel),t.EventHandler.remove(this.parent.getMainContent(),"wheel",this.onContentWheel),t.EventHandler.remove(this.parent.getRowHeaderContent(),"wheel",this.onContentWheel),t.EventHandler.remove(this.parent.getScrollElement(),"scroll",this.scrollHandler))},e.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}}},e.prototype.setPadding=function(e){this.parent.sheetModule.contentPanel.style.overflowY="scroll";var t=it();if(t>0){var r=this.parent.getColumnHeaderContent(),n=this.parent.enableRtl?{margin:"marginLeft",border:"borderLeftWidth"}:{margin:"marginRight",border:"borderRightWidth"};r.parentElement.style[n.margin]=t+"px",r.style[n.border]="1px"}e&&(this.initScrollValue=0)},e.prototype.setClientX=function(e){if("mousedown"!==e.type&&"mouse"!==e.pointerType){var r={touchSelectionStarted:!1};if(this.parent.notify(el,r),!r.touchSelectionStarted&&!r.isOverlayClicked){this.clientX=this.getPointX(e);var n=document.getElementById(this.parent.element.id+"_sheet");t.EventHandler.add(n,t.Browser.isPointer?"pointermove":"touchmove",this.onTouchScroll,this),t.EventHandler.add(n,t.Browser.isPointer?"pointerup":"touchend",this.pointerUpHandler,this)}}},e.prototype.getPointX=function(e){return e.touches&&e.touches.length?e.touches[0].clientX:e.clientX},e.prototype.onTouchScroll=function(e){if("mouse"!==e.pointerType){var t=this.getPointX(e),r=this.clientX-t,n=this.parent.element.getElementsByClassName("e-scroller")[0];(r>10||r<-10)&&n.scrollLeft+r>=0&&(e.preventDefault(),this.clientX=t,tt(function(){n.scrollLeft+=r}))}},e.prototype.pointerUpHandler=function(){var e=document.getElementById(this.parent.element.id+"_sheet");t.EventHandler.remove(e,t.Browser.isPointer?"pointermove":"touchmove",this.onTouchScroll),t.EventHandler.remove(e,t.Browser.isPointer?"pointerup":"touchend",this.pointerUpHandler)},e.prototype.addEventListener=function(){this.parent.on(Na,this.contentLoaded,this),this.parent.on(bo,this.onContentScroll,this),this.parent.on(nl,this.updateScroll,this),this.parent.on(xo,this.initProps,this),this.parent.on(Ta,this.destroy,this),this.parent.on(Qo,this.setScrollEvent,this),this.parent.on(Oa,this.setClientX,this),this.parent.on(cl,this.updateScrollValue,this),this.parent.scrollSettings.enableVirtualization||(this.parent.on(ja,this.updateNonVirualScrollWidth,this),this.parent.on(Co,this.updateNonVirualScrollWidth,this))},e.prototype.destroy=function(){this.removeEventListener();var e=document.querySelector("#"+this.parent.element.id+"_autofilloptionbtn");if(e){var r=t.getComponent(e,"dropdown-btn");r&&r.destroy()}this.parent=null},e.prototype.removeEventListener=function(){this.parent.off(Na,this.contentLoaded),this.parent.off(bo,this.onContentScroll),this.parent.off(nl,this.updateScroll),this.parent.off(xo,this.initProps),this.parent.off(Ta,this.destroy),this.parent.off(Qo,this.setScrollEvent),this.parent.off(Oa,this.setClientX),this.parent.off(cl,this.updateScrollValue),this.parent.scrollSettings.enableVirtualization||(this.parent.off(ja,this.updateNonVirualScrollWidth),this.parent.off(Co,this.updateNonVirualScrollWidth))},e}(),Ql=function(){function e(e){this.scroll=[],this.parent=e,this.addEventListener()}return e.prototype.createVirtualElement=function(e){var r=this.parent.getActiveSheet(),n=this.parent.getMainContent();this.content=this.parent.createElement("div",{className:"e-virtualable"}),this.content.appendChild(n.querySelector(".e-table")),n.appendChild(this.content);var i,a=n.appendChild(this.parent.createElement("div",{className:"e-virtualtrack"})),o=0;this.parent.sheets.length>this.scroll.length&&this.initScroll();var s=this.parent.viewport.bottomIndex;r.rowCount>s+1||r.usedRange.rowIndex>s?(!this.parent.scrollSettings.isFinite&&r.rowCount<=r.usedRange.rowIndex&&this.parent.setSheetPropertyOnMute(r,"rowCount",r.usedRange.rowIndex+1),this.setScrollCount(r.rowCount,"row")):(this.parent.scrollSettings.isFinite||this.parent.setSheetPropertyOnMute(r,"rowCount",s+1),this.scroll[this.parent.activeSheetIndex].rowCount=r.rowCount);var l=this.parent.frozenRowCount(r),h=u(r.topLeftCell);e.top&&(o=e.top,r.frozenRows&&(o+=Ye(r,h[0],l-1,!0)),l=u(r.paneTopLeftCell)[0]),o+=Ye(r,l,this.scroll[this.parent.activeSheetIndex].rowCount-1,!0),s=this.parent.viewport.rightIndex;var d=0,p=this.parent.frozenColCount(r);e.left?(d=e.left,p&&(d+=Ze(r,h[1],p-1,!0)),l=u(r.paneTopLeftCell)[1]):l=p,r.colCount>s+1||r.usedRange.colIndex>s?(!this.parent.scrollSettings.isFinite&&r.colCount<=r.usedRange.colIndex&&this.parent.setSheetPropertyOnMute(r,"colCount",r.usedRange.colIndex+1),d+=Ze(r,l,s,!0),this.setScrollCount(r.colCount,"col"),i=d+Ze(r,s+1,this.scroll[this.parent.activeSheetIndex].colCount-1,!0)):(this.parent.scrollSettings.isFinite||this.parent.setSheetPropertyOnMute(r,"colCount",s+1),d+=Ze(r,l,r.colCount-1,!0),this.scroll[this.parent.activeSheetIndex].colCount=r.colCount,i=d),t.isNullOrUndefined(this.parent.viewport.leftIndex)&&(this.parent.viewport.leftIndex=0),t.isNullOrUndefined(this.parent.viewport.topIndex)&&(this.parent.viewport.topIndex=0),e.left&&(d=Ze(r,this.parent.viewport.leftIndex+p,s,!0)),t.isNullOrUndefined(this.translateX)&&(this.translateX=0),t.isNullOrUndefined(this.translateY)&&(this.translateY=0),n=this.parent.getRowHeaderContent(),this.rowHeader=this.content.cloneNode(),this.rowHeader.appendChild(n.querySelector(".e-table")),n.appendChild(this.rowHeader);var c=n.appendChild(a.cloneNode());this.rowHeader.style.transform="translate(0px, "+this.translateY+"px)",n=this.parent.getColumnHeaderContent(),this.colHeader=this.content.cloneNode(),this.colHeader.appendChild(n.querySelector(".e-table")),n.appendChild(this.colHeader);var f=n.appendChild(a.cloneNode());if(this.colHeader.style.width=d+"px",c.style.height=o+"px",f.style.width=i+"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=d+"px",a.style.height=o+"px",a.style.width=i+"px",this.parent.allowScrolling){var g=f.cloneNode(!0);g.style.width=i+(this.parent.scrollSettings.isFinite?this.parent.sheetModule.getScrollSize():0)+"px",this.parent.getScrollElement().appendChild(g)}},e.prototype.initScroll=function(){for(var e=0;e<this.parent.sheets.length;)this.scroll[e]||this.scroll.push({rowCount:0,colCount:0}),e++},e.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)},e.prototype.getRowAddress=function(e){var t=this.parent.getActiveSheet();return m([e[0],t.frozenColumns?u(t.topLeftCell)[1]:this.parent.viewport.leftIndex,e[1],this.parent.viewport.rightIndex])},e.prototype.getColAddress=function(e){var t=this.parent.getActiveSheet();return m([t.frozenRows?u(t.topLeftCell)[0]:this.parent.viewport.topIndex,e[0],this.parent.viewport.bottomIndex,e[1]])},e.prototype.updateScrollCount=function(e,t,r){void 0===r&&(r=e);var n=this.parent.getActiveSheet(),i=e+this.parent.viewport[t+"Count"]+1+r,a=this.scroll[this.parent.activeSheetIndex][t+"Count"];if(i<a){if(n[t+"Count"]===a)return;i=a}this.parent.scrollSettings.isFinite||this.parent.setSheetPropertyOnMute(n,t+"Count",i)},e.prototype.onVerticalScroll=function(e){var t=e.cur.idx,r=e.cur.size,n=e.prev.idx,i=Math.abs(t-n),a=this.parent.getThreshold("row");if(i>Math.round(a/2)){var o=void 0,s=void 0,l=void 0,h=this.parent.getActiveSheet();if(t<=a&&!e.increase){if(this.translateY&&n>a){this.translateY=0;var d=this.parent.frozenColCount(h),p=this.parent.frozenRowCount(h);if(e.preventScroll)this.parent.viewport.topIndex=n-(a-p);else{var f=d?u(h.topLeftCell)[1]:this.parent.viewport.leftIndex,g=d?[p,this.parent.viewport.leftIndex+d]:[];if(i<this.parent.viewport.rowCount+a){o=$(h,p,!0),s=$(h,this.parent.viewport.topIndex+p-1,!1),this.parent.viewport.topIndex=o-p;var m=this.skipHiddenLastIdx(this.parent.viewport.bottomIndex-(s-o+1-this.hiddenCount(o,s)),this.parent.viewport.bottomIndex);this.parent.viewport.bottomIndex=$(h,m,!1),this.parent.renderModule.refreshUI({colIndex:f,rowIndex:o,direction:"last",refresh:"RowPart",skipUpdateOnFirst:!0,frozenIndexes:g},this.getRowAddress([o,$(h,s,!1)]))}else{var v=this.parent.viewport.leftIndex;this.parent.renderModule.refreshUI({rowIndex:0,colIndex:f,refresh:"Row",skipUpdateOnFirst:!0,frozenIndexes:g,skipTranslate:!0}),d&&(this.parent.viewport.leftIndex=v),this.translate({refresh:"Row"})}Wt(this.parent.element),t=0}}this.updateScrollCount(a,"row")}if(n<a&&(i=Math.abs(t-a)),!e.increase&&this.parent.scrollSettings.isFinite&&this.parent.viewport.bottomIndex===$(h,h.rowCount-1,!1)){p=this.parent.frozenRowCount(h);var y=this.parent.viewport.topIndex+p+c(h.paneTopLeftCell)[0]-1;if(t+p>y)return void(e.prev.idx=t);i=y-(t+p)}if(t>a){if(l=this.parent.viewport.topIndex,this.parent.viewport.topIndex=t-a,e.increase&&l>this.parent.viewport.topIndex)return void(this.parent.viewport.topIndex=l);p=this.parent.frozenRowCount(h);if(e.preventScroll)this.setThresholdHeight(r,a,p),this.translate({refresh:"Row"});else{f=void 0;var C=[];if((d=this.parent.frozenColCount(h))?(f=u(h.topLeftCell)[1],C.push(p),C.push(this.parent.viewport.leftIndex+d)):f=this.parent.viewport.leftIndex,i<this.parent.viewport.rowCount+a)if(e.increase){if(o=this.parent.viewport.bottomIndex+1,s=this.parent.viewport.bottomIndex+(this.parent.viewport.topIndex-l),(s-=this.hiddenCount(l+p,this.parent.viewport.topIndex-1+p))<=this.parent.viewport.bottomIndex||this.parent.scrollSettings.isFinite&&o>$(h,h.rowCount-1,!1,"rows"))return void(this.parent.viewport.topIndex=l);var b=this.parent.skipHidden(o,s,"rows",!1),x=this.checkLastIdx(b[1],"row");o=b[0],s=x.index;var S=this.parent.viewport.topIndex+p;if(x.diff){S=$(h,l,!0,"rows",s-o+1-this.hiddenCount(o,s))+p}this.parent.viewport.topIndex=$(h,S,!x.diff)-p,this.setThresholdHeight(r,t-this.parent.viewport.topIndex,p,!!x.diff,l===$(h,p,!0)),this.parent.viewport.bottomIndex=s,this.parent.renderModule.refreshUI({colIndex:f,rowIndex:o,direction:"first",refresh:"RowPart",frozenIndexes:C},this.getRowAddress([o,s]))}else{if((o=$(h,this.parent.viewport.topIndex+p,!1))<p&&(o=$(h,o=p,!0)),this.parent.viewport.topIndex=o-p,(s=$(h,l+p-1,!1))<p||s<o)return void(this.parent.viewport.topIndex=l);m=this.skipHiddenLastIdx(this.parent.viewport.bottomIndex-(s-o+1-this.hiddenCount(o,s)),this.parent.viewport.bottomIndex);this.parent.viewport.bottomIndex=$(h,m,!1),this.setThresholdHeight(r,t-this.parent.viewport.topIndex,p),this.parent.renderModule.refreshUI({colIndex:f,rowIndex:o,direction:"last",refresh:"RowPart",frozenIndexes:C},this.getRowAddress([o,s]))}else l=this.parent.viewport.leftIndex,this.parent.viewport.topIndex=$(h,this.parent.viewport.topIndex+p,!1)-p,this.parent.viewport.topIndex<0&&(this.parent.viewport.topIndex=$(h,p,!0)-p),this.parent.renderModule.refreshUI({rowIndex:this.parent.viewport.topIndex,colIndex:f,refresh:"Row",frozenIndexes:C,skipTranslate:!0}),d&&(this.parent.viewport.leftIndex=l),this.setThresholdHeight(r,t-this.parent.viewport.topIndex,p,this.parent.scrollSettings.isFinite&&this.parent.viewport.bottomIndex===$(h,h.rowCount-1,!1)),this.translate({refresh:"Row"});this.updateScrollCount(t,"row",a),this.focusSheet()}}e.prev.idx=t}},e.prototype.skipHiddenLastIdx=function(e,t,r){void 0===r&&(r="rows");for(var n=this.parent.getActiveSheet(),i=0,a=e;a<=t;a++)n[""+r][a]&&n[""+r][a].hidden&&i++;return i&&(e=this.skipHiddenLastIdx(e-i,e-1,r)),e},e.prototype.hiddenCount=function(e,t,r){void 0===r&&(r="rows");for(var n=0,i=this.parent.getActiveSheet(),a=e;a<=t;a++)i[""+r][a]&&i[""+r][a].hidden&&n++;return n},e.prototype.checkLastIdx=function(e,t){var r=0;if(this.parent.scrollSettings.isFinite){var n=this.parent.getActiveSheet(),i=$(n,n[t+"Count"]-1,!1);e>i&&(r=e-i,e=i)}return{index:e,diff:r}},e.prototype.onHorizontalScroll=function(e){var t=e.cur.idx,r=e.cur.size,n=e.prev.idx,i=Math.abs(t-n),a=this.parent.getThreshold("col");if(i>Math.round(a/2)){var o=void 0,s=void 0,l=void 0,h=this.parent.getActiveSheet();if(t<=a&&!e.increase){if(this.translateX&&n>a){this.translateX=0;var d=this.parent.frozenColCount(h),p=this.parent.frozenRowCount(h);if(e.preventScroll)this.parent.viewport.leftIndex=n-(a-d);else{var f=p?u(h.topLeftCell)[0]:this.parent.viewport.topIndex,g=p?[this.parent.viewport.topIndex+p,d]:[];if(i<this.parent.viewport.colCount+a){o=$(h,d,!0,"columns"),s=$(h,this.parent.viewport.leftIndex+d-1,!1,"columns"),this.parent.viewport.leftIndex=o-d;var m=this.skipHiddenLastIdx(this.parent.viewport.rightIndex-(s-o+1-this.hiddenCount(o,s,"columns")),this.parent.viewport.rightIndex,"columns");this.parent.viewport.rightIndex=$(h,m,!1,"columns"),this.parent.renderModule.refreshUI({rowIndex:f,colIndex:o,direction:"last",refresh:"ColumnPart",skipUpdateOnFirst:!0,frozenIndexes:g},this.getColAddress([o,$(h,s,!1,"columns")]))}else{var v=this.parent.viewport.topIndex;this.parent.renderModule.refreshUI({rowIndex:f,colIndex:0,refresh:"Column",skipUpdateOnFirst:!0,frozenIndexes:g,skipTranslate:!0}),p&&(this.parent.viewport.topIndex=v),this.translate({refresh:"Column"})}Wt(this.parent.element),t=0}}this.updateScrollCount(a,"col")}if(n<a&&(i=Math.abs(t-a)),!e.increase&&this.parent.scrollSettings.isFinite&&this.parent.viewport.rightIndex===$(h,h.colCount-1,!1,"columns")){d=this.parent.frozenColCount(h);var y=this.parent.viewport.leftIndex+d+c(h.paneTopLeftCell)[1]-1;if(y+=this.hiddenCount(this.parent.viewport.leftIndex+d,y),t+d>y)return void(e.prev.idx=t);i=y-(t+d)}if(t>a){if(l=this.parent.viewport.leftIndex,this.parent.viewport.leftIndex=t-a,e.increase&&l>this.parent.viewport.leftIndex)return void(this.parent.viewport.leftIndex=l);d=this.parent.frozenColCount(h);if(e.preventScroll)this.setThresholdWidth(r,a,d),this.translate({refresh:"Column"});else{f=(p=this.parent.frozenRowCount(h))?u(h.topLeftCell)[0]:this.parent.viewport.topIndex;var C=[];if(p&&(C=[p+this.parent.viewport.topIndex,d]),i<this.parent.viewport.colCount+a)if(e.increase){if(o=this.parent.viewport.rightIndex+1,s=this.parent.viewport.rightIndex+(this.parent.viewport.leftIndex-l),(s-=this.hiddenCount(l+d,this.parent.viewport.leftIndex-1+d,"columns"))<=this.parent.viewport.rightIndex||this.parent.scrollSettings.isFinite&&o>$(h,h.colCount-1,!1,"columns"))return void(this.parent.viewport.leftIndex=l);var b=this.parent.skipHidden(o,s,"columns",!1),x=this.checkLastIdx(b[1],"col");o=b[0],s=x.index,this.parent.viewport.leftIndex=$(h,this.parent.viewport.leftIndex-x.diff+d,!x.diff,"columns")-d,this.setThresholdWidth(r,t-this.parent.viewport.leftIndex,d,!!x.diff,l===$(h,d,!0,"columns")),this.parent.viewport.rightIndex=s,this.parent.renderModule.refreshUI({rowIndex:f,colIndex:o,direction:"first",refresh:"ColumnPart",frozenIndexes:C},this.getColAddress([o,s]))}else{if((o=$(h,this.parent.viewport.leftIndex+d,!1,"columns"))<d&&(o=$(h,o=d,!0,"columns")),this.parent.viewport.leftIndex=o-d,(s=$(h,l+d-1,!1,"columns"))<d||s<o)return void(this.parent.viewport.leftIndex=l);m=this.skipHiddenLastIdx(this.parent.viewport.rightIndex-(s-o+1-this.hiddenCount(o,s,"columns")),this.parent.viewport.rightIndex,"columns");this.parent.viewport.rightIndex=$(h,m,!1,"columns"),this.setThresholdWidth(r,t-this.parent.viewport.leftIndex,d),this.parent.renderModule.refreshUI({rowIndex:f,colIndex:o,direction:"last",refresh:"ColumnPart",frozenIndexes:C},this.getColAddress([o,s]))}else l=this.parent.viewport.topIndex,this.parent.viewport.leftIndex=$(h,this.parent.viewport.leftIndex+d,!1,"columns")-d,this.parent.viewport.leftIndex<0&&(this.parent.viewport.leftIndex=$(h,d,!0,"columns")-d),this.parent.renderModule.refreshUI({rowIndex:f,colIndex:this.parent.viewport.leftIndex,refresh:"Column",frozenIndexes:C,skipTranslate:!0}),p&&(this.parent.viewport.topIndex=l),this.setThresholdWidth(r,t-this.parent.viewport.leftIndex,d,this.parent.scrollSettings.isFinite&&this.parent.viewport.rightIndex===$(h,h.colCount-1,!1,"columns")),this.translate({refresh:"Column"});this.updateScrollCount(t,"col",a),this.focusSheet()}}e.prev.idx=t}},e.prototype.focusSheet=function(){document.activeElement.classList.contains("e-text-findNext-short")&&t.closest(document.activeElement,"#"+this.parent.element.id)||Wt(this.parent.element)},e.prototype.setThresholdHeight=function(e,t,r,n,i){var a=this.parent.getActiveSheet(),o=this.parent.viewport.topIndex+r,s=o+t-1;this.translateY=n||i||s<o?o<=r?0:Ye(a,r,o-1,!0):e-Ye(a,o,s,!0)},e.prototype.setThresholdWidth=function(e,t,r,n,i){var a=this.parent.getActiveSheet(),o=this.parent.viewport.leftIndex+r,s=o+t-1;this.translateX=n||i||s<o?o<=r?0:Ze(a,r,o-1,!0):e-Ze(a,o,s,!0)},e.prototype.translate=function(e){if(!e.skipTranslate&&this.content){var t=this.translateX||0;t=this.parent.enableRtl?-t:t,"Row"!==e.refresh&&"RowPart"!==e.refresh||(this.content.style.transform="translate("+t+"px, "+this.translateY+"px)",this.rowHeader.style.transform="translate(0px, "+this.translateY+"px)"),"Column"!==e.refresh&&"ColumnPart"!==e.refresh||(this.content.style.transform="translate("+t+"px, "+this.translateY+"px)",this.colHeader.style.transform="translate("+t+"px, 0px)")}},e.prototype.updateColumnWidth=function(e){if("Column"===e.refresh){this.content.style.width="";var t=this.parent.getActiveSheet(),r=Ze(t,this.parent.viewport.leftIndex+this.parent.frozenColCount(t),this.parent.viewport.rightIndex,!0);if(this.colHeader.style.width=r+"px",this.content.style.width=r+"px",!this.parent.scrollSettings.isFinite||e.isUpdate){var n=this.parent.element.querySelector(".e-scroller .e-virtualtrack");if(!n)return;var i=parseInt(n.style.width,10),a=r+this.translateX+this.parent.viewport.beforeFreezeWidth;if(a>i){var o=a-i;n.style.width=i+o+"px"}else{o=i-a;var s=this.parent.getMainContent().getElementsByClassName("e-virtualtrack")[0];i-o<parseInt(s.style.width,10)&&(n.style.width=s.style.width)}}}else if(!this.parent.scrollSettings.isFinite){s=this.parent.getMainContent().getElementsByClassName("e-virtualtrack")[0];var l=parseInt(s.style.height,10),h=this.content.getBoundingClientRect().height+this.translateY+this.parent.viewport.beforeFreezeHeight;if(h>l){o=h-l;s.style.height=l+o+"px"}else{o=l-h;var d=this.parent.getRowHeaderContent().getElementsByClassName("e-virtualtrack")[0];l-o<parseInt(d.style.height,10)&&(s.style.height=d.style.height)}}},e.prototype.updateRowColCount=function(e){if(this.scroll.length){var t=this.parent.getActiveSheet();if("row"===e.update){if(e.index!==this.scroll[this.parent.activeSheetIndex].rowCount-1){var r=this.getVTrackHeight("height"),n=r;if(e.index>=this.scroll[this.parent.activeSheetIndex].rowCount?void 0===e.start?n+=Ye(t,this.scroll[this.parent.activeSheetIndex].rowCount,e.index,!0):n+=Ye(t,e.start,e.end,!0):void 0===e.start?n-=Ye(t,e.index+1,this.scroll[this.parent.activeSheetIndex].rowCount-1,!0):n-=Ye(t,e.start,e.end,!0),!e.isDelete&&n<r)return;this.scroll[this.parent.activeSheetIndex].rowCount=e.index+1,this.updateVTrack(this.rowHeader,n,"height"),this.scroll[this.parent.activeSheetIndex].rowCount>t.rowCount&&this.parent.setSheetPropertyOnMute(t,"rowCount",this.scroll[this.parent.activeSheetIndex].rowCount)}}else if(e.index!==this.scroll[this.parent.activeSheetIndex].colCount-1){var i=this.getVTrackHeight("width"),a=i;if(e.index>=this.scroll[this.parent.activeSheetIndex].colCount?void 0===e.start?a+=Ze(t,this.scroll[this.parent.activeSheetIndex].colCount,e.index,!0):a+=Ze(t,e.start,e.end,!0):void 0===e.start?a-=Ze(t,e.index+1,this.scroll[this.parent.activeSheetIndex].colCount-1,!0):a-=Ze(t,e.start,e.end,!0),!e.isDelete&&a<i)return;this.scroll[this.parent.activeSheetIndex].colCount=e.index+1,this.updateVTrack(this.colHeader,a,"width"),this.scroll[this.parent.activeSheetIndex].colCount>t.colCount&&this.parent.setSheetPropertyOnMute(t,"colCount",this.scroll[this.parent.activeSheetIndex].colCount)}}},e.prototype.getVTrackHeight=function(e){var t=this.content.nextElementSibling.style[""+e];if(t.includes("e+")){var r=(t=t.split("px")[0]).split("e+");return Number(r[0])*Math.pow(10,Number(r[1]))}return parseFloat(t)},e.prototype.updateVTrackHeight=function(e){var t=this.parent.frozenRowCount(this.parent.getActiveSheet());if(e.rowIdx<this.scroll[this.parent.activeSheetIndex].rowCount&&this.updateVTrack(this.rowHeader,this.getVTrackHeight("height")+e.threshold,"height"),e.rowIdx>=t&&e.rowIdx<this.parent.viewport.topIndex+t){var r=this.parent.element.getElementsByClassName("e-main-panel")[0];this.parent.scrollModule.prevScroll.scrollTop=r.scrollTop+e.threshold,this.parent.scrollModule.offset.top.size+=e.threshold,r.scrollTop+=e.threshold,this.translateY+=e.threshold,this.translate({refresh:"Row"})}},e.prototype.updateVTrackWidth=function(e){if(!Qe(this.parent.getActiveSheet(),e.colIdx)){var t=this.parent.frozenColCount(this.parent.getActiveSheet());if(e.colIdx>=this.parent.viewport.leftIndex+t&&e.colIdx<=this.parent.viewport.rightIndex){var r=this.parent.getColumnHeaderContent().getElementsByClassName("e-virtualtrack")[0];r.style.width=parseFloat(r.style.width)+e.threshold+"px";var n=this.parent.getMainContent().getElementsByClassName("e-virtualtrack")[0];n.style.width=parseFloat(n.style.width)+e.threshold+"px";var i=this.parent.getScrollElement().getElementsByClassName("e-virtualtrack")[0];i.style.width=parseFloat(i.style.width)+e.threshold+"px";var a=this.parent.getColumnHeaderContent().getElementsByClassName("e-virtualable")[0];a.style.width=parseFloat(a.style.width)+e.threshold+"px";var o=this.parent.getMainContent().getElementsByClassName("e-virtualable")[0];o.style.width=parseFloat(o.style.width)+e.threshold+"px"}else e.colIdx>=t&&e.colIdx<this.parent.viewport.leftIndex+t&&(this.parent.scrollModule.offset.left.size+=e.threshold,this.translateX+=e.threshold,this.translate({refresh:"Column"}))}},e.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")},e.prototype.deInitProps=function(){this.parent.viewport.leftIndex=null,this.parent.viewport.topIndex=null,this.parent.viewport.bottomIndex=null,this.translateX=null,this.translateY=null},e.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})})},e.prototype.sliceScrollProps=function(e){t.isNullOrUndefined(e.sheetIndex)?this.scroll.length=0:this.scroll.splice(e.sheetIndex,1)},e.prototype.updateTranslate=function(e){if(e.height){if(e.isRender)this.translateY-=e.height;else{var t=parseInt(this.parent.getMainContent().getElementsByClassName("e-virtualtrack")[0].style.height,10);e.isHide?(this.updateVTrack(this.rowHeader,t-e.height,"height"),this.setThresholdHeight(this.translateY,e.prevSize-1-this.parent.viewport.topIndex+1,this.parent.frozenRowCount(this.parent.getActiveSheet()))):(this.updateVTrack(this.rowHeader,t+e.height,"height"),this.translateY=this.translateY+e.size)}this.translate({refresh:"Row"})}e.width&&(this.translateX-=e.width,this.translate({refresh:"Column"}))},e.prototype.addEventListener=function(){this.parent.on(_a,this.createVirtualElement,this),this.parent.on(za,this.translate,this),this.parent.on(ja,this.updateColumnWidth,this),this.parent.on(Bs,this.updateColumnWidth,this),this.parent.on(Ua,this.onVerticalScroll,this),this.parent.on(Va,this.onHorizontalScroll,this),this.parent.on(zr,this.updateRowColCount,this),this.parent.on(yo,this.updateVTrackHeight,this),this.parent.on(Co,this.updateVTrackWidth,this),this.parent.on(xo,this.deInitProps,this),this.parent.on(Jr,this.sliceScrollProps,this),this.parent.on(Qr,this.updateScrollProps,this),this.parent.on(dl,this.updateTranslate,this),this.parent.on(Ta,this.destroy,this)},e.prototype.destroy=function(){this.removeEventListener(),this.rowHeader&&this.rowHeader.remove(),this.colHeader&&this.colHeader.remove(),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},e.prototype.removeEventListener=function(){this.parent.off(_a,this.createVirtualElement),this.parent.off(za,this.translate),this.parent.off(ja,this.updateColumnWidth),this.parent.off(Bs,this.updateColumnWidth),this.parent.off(Ua,this.onVerticalScroll),this.parent.off(Va,this.onHorizontalScroll),this.parent.off(zr,this.updateRowColCount),this.parent.off(yo,this.updateVTrackHeight),this.parent.off(Co,this.updateVTrackWidth),this.parent.off(Jr,this.sliceScrollProps),this.parent.off(Qr,this.updateScrollProps),this.parent.off(dl,this.updateTranslate),this.parent.off(Ta,this.destroy)},e}(),Jl=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.addEventListener=function(){this.parent.on(Ba,this.keyDownHandler,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off(Ba,this.keyDownHandler)},e.prototype.keyDownHandler=function(e){var r=this,n=e.target;if(e.altKey&&38===e.keyCode&&this.parent.element.lastElementChild.classList.contains("e-filter-popup"))this.parent.notify(Xo,{closePopup:!0});else{var i=this.parent.serviceLocator.getService(Al).dialogInstance,a=n.id===this.parent.element.id+"_name_box";if("None"===this.parent.selectionSettings.mode||i||this.parent.isEdit||n.classList.contains("e-ss-ddb")&&117!==e.keyCode&&9!==e.keyCode||a&&117!==e.keyCode||n.classList.contains("e-sheet-rename")||n.id===this.parent.element.id+"_SearchBox"||n.classList.contains("e-chk-hidden")||n.classList.contains("e-ddl")&&n.classList.contains("e-input-focus")){if(i){if(13===e.keyCode)i.element.classList.contains("e-spreadsheet-function-dlg")&&(n.classList.contains("e-formula-list")||n.classList.contains("e-list-item"))&&Wt(i.element.querySelector(".e-footer-content .e-primary"));else if(9===e.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";if(e.shiftKey){if(document.activeElement.classList.contains("e-dlg-closeicon-btn"))if(e.preventDefault(),o.length)Wt(o[o.length-1]);else{var l=i.element.querySelector(".e-findnreplace-exactmatchcheckbox");l&&(Wt(l.querySelector(".e-findnreplace-checkmatch")),l.classList.add("e-focus"))}}else document.activeElement.className.includes(s)&&Wt(i.element)}else if(i.element.classList.contains("e-protect-dlg")){if(e.shiftKey?document.activeElement.classList.contains("e-primary"):document.activeElement.id===this.parent.element.id+"_protect_check"){if((h=i.element.querySelector(".e-protect-option-list"))&&!h.querySelector(".e-list-item.e-focused")){(p=h.querySelector(".e-list-item"))&&p.classList.add("e-focused")}}}else if(i.element.classList.contains("e-custom-format-dlg"))if(e.shiftKey){if(document.activeElement.className.includes("e-list-item e-active")){(h=t.closest(document.activeElement,".e-custom-listview"))&&Wt(h)}}else if(document.activeElement.classList.contains("e-btn")&&document.activeElement.parentElement.classList.contains("e-custom-dialog")){var h=i.element.querySelector(".e-custom-listview"),d=t.getComponent(h,"listview");if(h){var p;if(!(p=h.querySelector(".e-list-item.e-active"))){if(!(p=h.querySelector(".e-list-item")))return;d.selectItem(p)}e.preventDefault(),p.focus()}}else document.activeElement.classList.contains("e-list-item")&&Wt(i.element);else if(i.element.classList.contains("e-spreadsheet-function-dlg")){if(e.shiftKey&&document.activeElement.className.includes("e-list-item e-active")){(h=t.closest(document.activeElement,".e-formula-list"))&&Wt(h)}}else if(i.element.classList.contains("e-goto-dlg")&&!i.element.classList.contains("e-dlg-modal"))if(e.shiftKey){if(document.activeElement.className.includes("e-dlg-closeicon-btn")){var f=i.element.querySelector(".e-footer-content .e-btn");f&&(e.preventDefault(),Wt(f))}}else document.activeElement.className.includes("e-btn-goto-ok")&&Wt(i.element)}else a&&9===e.keyCode&&e.shiftKey&&this.focusEle(e,".e-formula-bar",!1,!0);var g={action:"getCurrentEditValue",editedValue:""};this.parent.notify(Da,g);var v=B(g.editedValue,!0);this.parent.isEdit&&v&&e.shiftKey&&!e.ctrlKey&&St(e.keyCode)&&this.shiftSelection(e)}else{var y=this.parent.getActiveSheet(),C=u(y.activeCell);if(e.altKey){if(40===e.keyCode){if(n.classList.contains("e-dropdown-btn")||n.classList.contains("e-split-btn"))return;var b={e:e,isFilterCell:!1};if(this.parent.notify(Xo,b),b.isFilterCell)return}if(40===e.keyCode&&!document.getElementById(this.parent.element.id+"listValid_popup")){if(z=this.parent.getCell(C[0],C[1])){var x=z.querySelector(".e-validation-list .e-ddl");if(x){Wt(x);var S=x.querySelector(".e-dropdownlist")||x;return void((d=t.getComponent(S,"dropdownlist"))&&d.showPopup())}}}}n.id===this.parent.element.id+"_File"&&Wt(this.parent.element);var w=n.classList.contains("e-add-sheet-tab")||n.classList.contains("e-sheets-list")||n.classList.contains("e-tab-wrap")&&!!t.closest(n,".e-sheet-tabs-items")||n.classList.contains("e-aggregate-list")||n.classList.contains("e-scroll-nav");[9,37,38,39,40,33,34,35,36].indexOf(e.keyCode)>-1&&!w&&e.preventDefault();var I,E=c(y.selectedRange);if(36===e.keyCode){var R=this.parent.frozenColCount(y),k=void 0;if(e.ctrlKey||e.metaKey){var F=$(y,this.parent.frozenRowCount(y),!0);e.shiftKey?k=[C[0],C[1],F,$(y,R,!0,"columns")]:(k=[F,$(y,R,!0,"columns"),F])[3]=k[1];(P=this.parent.element.querySelector(".e-main-panel")).scrollTop&&(P.scrollTop=0);var A=this.parent.getScrollElement();A.scrollLeft&&(A.scrollLeft=0)}else if(e.shiftKey){var N=$(y,R,!0,"columns");k=y.frozenColumns&&$(y,C[1],!0,"columns")===N?[E[0],C[1],E[2],$(y,0,!0,"columns")]:[E[0],C[1],E[2],N],this.scrollNavigation([k[2],k[3]],!0)}else{N=$(y,R,!0,"columns");!y.frozenColumns||N!==C[1]&&R!==C[1]||(N=$(y,0,!0,"columns")),k=[C[0],N,C[0],N],this.scrollNavigation([k[0],k[1]],!0)}this.updateSelection(y,k)}else if(e.ctrlKey||e.metaKey){if(35===e.keyCode){e.preventDefault();var O=$(y,y.usedRange.rowIndex,!1);O=O>-1?O:y.usedRange.rowIndex;var T=$(y,y.usedRange.colIndex,!1,"columns");T=T>-1?T:y.usedRange.colIndex,e.shiftKey||(C[0]=O,C[1]=T),C[2]=O,C[3]=T,this.updateSelection(y,C),this.scrollNavigation([O,T],!0)}else 32!==e.keyCode||e.shiftKey||(E[0]=0,E[2]=y.rowCount-1,this.updateSelection(y,E));if(40===e.keyCode||39===e.keyCode||38===e.keyCode||37===e.keyCode)e.shiftKey?(40===e.keyCode?E[2]=this.getNextNonEmptyCell(E[2],C[1],"down"):39===e.keyCode?E[3]=this.getNextNonEmptyCell(C[0],E[3],"right"):38===e.keyCode?E[2]=this.getNextNonEmptyCell(E[2],C[1],"top"):E[3]=this.getNextNonEmptyCell(C[0],E[3],"left"),this.updateSelection(y,E),this.scrollNavigation([E[2],E[3]],!0)):(37===e.keyCode?C[1]=this.getNextNonEmptyCell(C[0],C[1],"left"):38===e.keyCode?C[0]=this.getNextNonEmptyCell(C[0],C[1],"top"):39===e.keyCode?C[1]=this.getNextNonEmptyCell(C[0],C[1],"right"):C[0]=this.getNextNonEmptyCell(C[0],C[1],"down"),this.parent.selectRange(m(C)),this.scrollNavigation([C[0],C[1]],!0));else if(117===e.keyCode){var D=document.activeElement;D.classList.contains("e-spreadsheet")||t.closest(D,".e-sheet")?this.setFocus("Sheet",e,!0):w?this.setFocus("SheetTabs",e):t.closest(D,".e-ribbon")?this.setFocus("Ribbon",e):(a||D.classList.contains("e-insert-function"))&&this.setFocus("FormulaBar",e)}}else{if(e.shiftKey){if(32===e.keyCode&&(e.preventDefault(),E[1]=0,E[3]=y.colCount-1,this.updateSelection(y,E)),this.shiftSelection(e),(34===e.keyCode||33===e.keyCode)&&this.parent.scrollModule&&this.parent.scrollModule.isKeyScroll){var L=0,P=this.parent.element.querySelector(".e-main-panel"),M=$(y,u(y.paneTopLeftCell)[0],!0),H=$t(this.parent,M).height;if(34===e.keyCode){if(L=H+this.parent.scrollModule.offset.top.size,!this.parent.scrollSettings.isFinite){(W=this.parent.getMainContent().querySelector(".e-virtualtrack"))&&parseFloat(W.style.height)<L+H&&(W.style.height=L+H+"px")}}else if(L=this.parent.scrollModule.offset.top.size-H,Math.round(L)<0){if(!P.scrollTop)return void this.parent.selectRange(m([E[0],E[1],M,E[3]]));L=0}var U=$(y,c(y.selectedRange)[2],!0),V=M>U?0:U-M;this.parent.scrollModule&&P.scrollTop&&(this.parent.scrollModule.isKeyScroll=!1),P.scrollTop=L,tt(function(){34===e.keyCode?(E[2]=$(y,u(y.paneTopLeftCell)[0]+V,!0),r.parent.scrollSettings.isFinite&&E[2]>y.rowCount-1&&(E[2]=$(y,y.rowCount-1,!1),E[2]=E[2]<0?0:E[2])):(E[2]=$(y,u(y.paneTopLeftCell)[0]+V,!1),E[2]=E[2]<0?0:E[2]),r.updateSelection(y,E)})}}else if(9===e.keyCode||(this.parent.enableRtl?37===e.keyCode:39===e.keyCode)){if((z=Re(C[0],C[1],y))&&z.colSpan>1&&(C[1]+=z.colSpan-1),C[1]<y.colCount-1&&(!y.isProtected||y.protectSettings.selectCells))C[1]+=1,I=!0;else if(y.protectSettings.selectUnLockedCells){var _=this.getNextUnlockedCell("right",C);I=C[1]!==_[1]||C[0]!==_[0],C[1]=_[1],C[0]=_[0]}}else if(13===e.keyCode||40===e.keyCode){var z;if((z=Re(C[0],C[1],y))&&z.rowSpan>1&&(C[0]+=z.rowSpan-1),C[0]<y.rowCount-1&&(!y.isProtected||y.protectSettings.selectCells))I=!0,C[0]+=1;else if(y.protectSettings.selectUnLockedCells){_=this.getNextUnlockedCell("down",C);I=C[0]!==_[0]||C[1]!==_[1],C[1]=_[1],C[0]=_[0]}}else if((34===e.keyCode||33===e.keyCode)&&this.parent.scrollModule&&this.parent.scrollModule.isKeyScroll){P=this.parent.element.querySelector(".e-main-panel"),L=0;var j=$(y,u(y.paneTopLeftCell)[0],!0),q=$(y,u(y.activeCell)[0],!0);H=$t(this.parent,j).height;if(34===e.keyCode){if(L=this.parent.scrollModule.offset.top.size+H,!this.parent.scrollSettings.isFinite){var W;(W=this.parent.getMainContent().querySelector(".e-virtualtrack"))&&parseFloat(W.style.height)<L+H&&(W.style.height=L+H+"px")}}else{if(L=this.parent.scrollModule.offset.top.size-H,y.frozenRows&&C[0]<this.parent.frozenRowCount(y))return void this.parent.selectRange(m([j,E[1],j,E[1]]));if(Math.round(L)<0){if(!P.scrollTop)return;L=0}}var G=j>q?0:q-j;this.parent.scrollModule&&P.scrollTop&&(this.parent.scrollModule.isKeyScroll=!1),P.scrollTop=L,tt(function(){var t;34===e.keyCode?(t=$(y,u(y.paneTopLeftCell)[0]+G,!0),r.parent.scrollSettings.isFinite&&t>y.rowCount-1&&(t=(t=$(y,y.rowCount-1,!1))<0?0:t)):(t=u(y.paneTopLeftCell)[0]+G,t-=r.parent.hiddenCount(j,q),t=(t=$(y,t,!1))<0?0:t),r.parent.notify(qa,{range:[t,C[1]],preventAnimation:!0})})}if(e.shiftKey?9===e.keyCode:this.parent.enableRtl?39===e.keyCode:37===e.keyCode){if(C[1]>0&&(!y.isProtected||y.protectSettings.selectCells))C[1]-=1,I=!0;else if(y.protectSettings.selectUnLockedCells){_=this.getNextUnlockedCell("left",C);I=C[1]!==_[1]||C[0]!==_[0],C[1]=_[1],C[0]=_[0]}if(C[1]<=0){var Y=this.parent.getMainContent();0===C[1]&&Y.scrollLeft&&!this.parent.enableRtl&&(Y.scrollLeft=0)}}else if((e.shiftKey?13===e.keyCode:38===e.keyCode)&&!this.parent.element.querySelector(".e-find-toolbar")){if(C[0]>0&&(!y.isProtected||y.protectSettings.selectCells))C[0]-=1,I=!0;else if(y.protectSettings.selectUnLockedCells){var X=this.getNextUnlockedCell("up",C);I=C[0]!==X[0]||C[1]!==X[1],C[1]=X[1],C[0]=X[0]}if(C[0]<=0){var K=this.parent.getMainContent().parentElement;0===C[0]&&K.scrollTop&&(K.scrollTop=0)}}}if(!I||this.parent.scrollModule&&!this.parent.scrollModule.isKeyScroll||w||t.closest(document.activeElement,".e-ribbon")||n.classList.contains("e-insert-function")||n.classList.contains("e-formula-bar")&&(!n.classList.contains("e-formula-bar")||"TEXTAREA"!==n.nodeName||13!==e.keyCode)){if(9===e.keyCode){var Z=this.parent.showRibbon&&t.closest(document.activeElement,".e-ribbon");if(Z)t.closest(document.activeElement,".e-tab-header")?e.shiftKey||Z.classList.contains("e-collapsed")?this.focusEle(e,".e-ribbon .e-drop-icon"):this.focusEle(e,".e-ribbon .e-content .e-toolbar-item:not(.e-separator):not(.e-overlay) .e-btn"):t.closest(document.activeElement,".e-content")?e.shiftKey?this.focusEle(e,".e-ribbon .e-toolbar-items .e-toolbar-item.e-active .e-tab-wrap",!0):this.focusEle(e,".e-ribbon .e-drop-icon"):document.activeElement.classList.contains("e-drop-icon")&&(e.shiftKey&&!Z.classList.contains("e-collapsed")?this.focusEle(e,".e-ribbon .e-content .e-toolbar-item:not(.e-separator):not(.e-overlay) .e-btn"):this.focusEle(e,".e-ribbon .e-toolbar-items .e-toolbar-item.e-active .e-tab-wrap",!0));else if(n.classList.contains("e-insert-function"))e.shiftKey?this.focusEle(e,".e-formula-bar-panel .e-combobox"):this.focusEle(e,".e-formula-bar",!1,!0);else if(w)if(e.shiftKey){var Q=n.classList.contains("e-aggregate-list")||n.classList.contains("e-scroll-left-nav");if(n.classList.contains("e-add-sheet-tab")||Q||n.classList.contains("e-sheets-list")&&n.previousElementSibling&&n.previousElementSibling.disabled){var J=!Q&&this.parent.element.querySelector(".e-aggregate-list");if(J)this.focusEle(e,null,!1,!1,J);else if(!n.classList.contains("e-scroll-left-nav")&&this.parent.element.querySelector(".e-sheet-tab-panel .e-scroll-nav"))this.focusEle(e,".e-sheet-tab-panel .e-scroll-right-nav",!0);else{(te=[].slice.call(this.parent.element.querySelectorAll(".e-sheet-tab-panel .e-toolbar-item")))[te.length-1]&&this.focusEle(e,null,!0,!1,te[te.length-1].querySelector(".e-tab-wrap"))}}else if(n.classList.contains("e-scroll-right-nav"))this.focusEle(e,".e-sheet-tab-panel .e-scroll-left-nav",!0);else if(n.classList.contains("e-tab-wrap")){0===(_=(te=[].slice.call(this.parent.element.querySelectorAll(".e-sheet-tab-panel .e-toolbar-item"))).indexOf(n.parentElement))?this.focusEle(e,".e-sheet-tab-panel .e-sheets-list"):this.focusEle(e,null,!0,!1,te[_-1].querySelector(".e-tab-wrap"))}}else{var ee=!!this.parent.element.querySelector(".e-aggregate-list");if(n.classList.contains("e-aggregate-list")||!ee&&n.classList.contains("e-scroll-right-nav"))this.focusEle(e,".e-sheet-tab-panel .e-icon-btn:not(:disabled)");else if(n.classList.contains("e-sheets-list"))this.focusEle(e,".e-sheet-tab-panel .e-toolbar-item .e-tab-wrap",!0);else if(n.classList.contains("e-scroll-left-nav"))this.focusEle(e,".e-sheet-tab-panel .e-scroll-right-nav",!0);else if(n.classList.contains("e-tab-wrap")){var te,re=(te=[].slice.call(this.parent.element.querySelectorAll(".e-sheet-tab-panel .e-toolbar-item"))).indexOf(n.parentElement);if(re===te.length-1){var ne=!!this.parent.element.querySelector(".e-sheet-tab-panel .e-scroll-nav");!ne&&ee||this.focusEle(e,".e-sheet-tab-panel ."+(ne?"e-scroll-nav":"e-icon-btn:not(:disabled)"),ne)}else this.focusEle(e,null,!0,!1,te[re+1].querySelector(".e-tab-wrap"))}}}}else{if(40===e.keyCode||38===e.keyCode||13===e.keyCode)for(;je(y,C[0]);)if((40===e.keyCode||!e.shiftKey&&13===e.keyCode)&&(C[0]=C[0]+1),(38===e.keyCode||e.shiftKey&&13===e.keyCode)&&(C[0]=C[0]-1,C[0]<0))return;if(37===e.keyCode||39===e.keyCode||9===e.keyCode)for(;Qe(y,C[1]);)if((39===e.keyCode||!e.shiftKey&&9===e.keyCode)&&(C[1]=C[1]+1),(37===e.keyCode||e.shiftKey&&9===e.keyCode)&&(C[1]=C[1]-1,C[1]<0))return;this.scrollNavigation(C);var ie=m(C),ae=function(e){if(ie!==y.selectedRange){r.parent.setSheetPropertyOnMute(y,"activeCell",ie),r.parent.notify(qa,{range:C,preventAnimation:e});var n;t.Browser.isDevice&&"safari"===t.Browser.info.name&&(t.Browser.isIos||t.Browser.isIos7)&&(n=r.parent.element.querySelector(".e-ss-focus-edit")),(n=n||r.parent.getCell(C[0],C[1]))&&Wt(n)}};if(this.parent.scrollModule&&this.parent.scrollModule.isKeyScroll){if(ie===y.selectedRange)return;tt(ae.bind(this,!0))}else ae()}}}},e.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"))},e.prototype.focusEle=function(e,r,n,i,a){if(a=a||this.parent.element.querySelector(r),n&&!a){var o=(s=this.parent.element.querySelector(".e-ribbon .e-tab"))&&t.getComponent(s,"tab").selectedItem||0;a=(a=this.parent.element.querySelector(".e-tab-header").getElementsByClassName("e-toolbar-item")[o])&&a.querySelector(".e-tab-wrap")}if(a)if(e.preventDefault(),i)a.click(),Wt(a),a.setSelectionRange(a.value.length,a.value.length);else if(n){if(a.setAttribute("tabindex","0"),a.parentElement.classList.contains("e-active")&&a.parentElement.classList.contains("e-toolbar-item")){var s;!(s=this.parent.element.querySelector(".e-sheet-tab-panel .e-sheet-tab"))&&s.classList.contains("e-focused")&&s.classList.add("e-focused")}a.focus()}else Wt(a)},e.prototype.updateSelection=function(e,t){e.isProtected&&!e.protectSettings.selectCells&&e.protectSettings.selectUnLockedCells?Gt(this.parent,w(t))||this.parent.selectRange(m(t)):this.parent.selectRange(m(t))},e.prototype.getNextNonEmptyCell=function(e,r,n){var i,a,o=this.parent.getActiveSheet(),s=function(e,r){var n=Re(e,r,o,null,!0).value;return!t.isNullOrUndefined(n)&&""!==n};if("down"===n){i=s(d=$(o,e+1,!0),r);for(var l=$(o,o.rowCount-1,!1),h=d;h<o.rowCount;h++){if(h===l)return h;if(i){if(!s($(o,h,!0),r))return $(o,h-1,!1)}else if(a=$(o,h+1,!0),s(a,r))return a}return e}if("top"===n){var d;i=s(d=$(o,e-1,!1),r);for(var p=$(o,0,!0),c=d;c>=0;c--){if(c===p)return c;if(i){if(!s($(o,c,!1),r))return $(o,c+1,!0)}else if(a=$(o,c-1,!1),s(a,r))return a}return e}if("right"===n){i=s(e,g=$(o,r+1,!0,"columns"));for(var u=$(o,o.colCount-1,!1,"columns"),f=g;f<o.colCount;f++){if(f===u)return f;if(i){if(!s(e,$(o,f,!0,"columns")))return $(o,f-1,!1,"columns")}else if(a=$(o,f+1,!0,"columns"),s(e,a))return a}return r}var g;i=s(e,g=$(o,r-1,!1,"columns"));p=$(o,0,!0,"columns");for(var m=g;m>=0;m--){if(m===p)return m;if(i){if(!s(e,$(o,m,!1,"columns")))return $(o,m+1,!0,"columns")}else if(a=$(o,m-1,!1,"columns"),s(e,a))return a}return r},e.prototype.getNextUnlockedCell=function(e,t){var r,n,i=this.parent.getActiveSheet();if("right"===e)for(var a=t[0],o=void 0,s=void 0,l=i.usedRange.rowIndex,h=i.usedRange.colIndex;a<=l;){for(o=void 0===o?t[1]+1:0,s&&a===t[0]&&(h=t[1]-1);o<=h;o++)if(r=Re(a,o,i),n=Xe(i,o)||{},!Y(r,n)&&!n.hidden&&!je(i,a))return[a,o];a!==i.usedRange.rowIndex||s?a++:(a=0,l=t[0],s=!0)}else if("left"===e)for(a=t[0],o=void 0,s=void 0,l=0,h=0;a>=l;){for(o=void 0===o?t[1]-1:i.usedRange.colIndex,s&&a===t[0]&&(h=t[1]+1);o>=h;o--)if(r=Re(a,o,i),n=Xe(i,o)||{},!Y(r,n)&&!n.hidden&&!je(i,a))return[a,o];0!==a||s?a--:(a=i.usedRange.rowIndex,l=t[0],s=!0)}else if("down"===e)for(o=t[1],a=void 0,s=void 0,h=i.usedRange.colIndex,l=i.usedRange.rowIndex;o<=h;){for(a=void 0===a?t[0]+1:0,s&&o===t[1]&&(l=t[0]-1);a<=l;a++)if(r=Re(a,o,i),n=Xe(i,o)||{},!Y(r,n)&&!n.hidden&&!je(i,a))return[a,o];o!==i.usedRange.colIndex||s?o++:(o=0,h=t[1],s=!0)}else for(o=t[1],a=void 0,s=void 0,h=0,l=0;o>=h;){for(a=void 0===a?t[0]-1:i.usedRange.rowIndex,s&&o===t[1]&&(l=t[0]+1);a>=l;a--)if(r=Re(a,o,i),n=Xe(i,o)||{},!Y(r,n)&&!n.hidden&&!je(i,a))return[a,o];0!==o||s?o--:(o=i.usedRange.colIndex,h=t[1],s=!0)}return t},e.prototype.shiftSelection=function(e){var r=this.parent.getActiveSheet(),n=c(r.selectedRange),i=w(n),a=!0;if(38===e.keyCode){for(var o=i[1];o<=i[3];o++){var s=Re(n[2],o,r);if(!t.isNullOrUndefined(s)&&s.rowSpan&&s.rowSpan<0){n[2]=$(r,n[2]-(Math.abs(s.rowSpan)+1),!1),a=!1;break}}if(a&&(n[2]=$(r,n[2]-1,!1)),n[2]<0)return}if(40===e.keyCode){for(o=i[1];o<=i[3];o++){s=Re(n[2],o,r);if(!t.isNullOrUndefined(s)&&s.rowSpan&&s.rowSpan>0){n[2]=$(r,n[2]+Math.abs(s.rowSpan),!0),a=!1;break}}if(a&&(n[2]=$(r,n[2]+1,!0)),n[2]>=r.rowCount&&(n[2]=$(r,r.rowCount-1,!1),n[2]<0))return}if(39===e.keyCode){for(o=i[0];o<=i[2];o++){s=Re(o,n[3],r);if(!t.isNullOrUndefined(s)&&s.colSpan&&s.colSpan>0){n[3]=$(r,n[3]+Math.abs(s.colSpan),!0,"columns"),a=!1;break}}if(a&&(n[3]=$(r,n[3]+1,!0,"columns")),n[3]>=r.colCount&&(n[3]=$(r,r.colCount-1,!1,"columns"),n[3]<0))return}if(37===e.keyCode){for(o=i[0];o<=i[2];o++){s=Re(o,n[3],r);if(!t.isNullOrUndefined(s)&&s.colSpan&&s.colSpan<0){n[3]=$(r,n[3]-(Math.abs(s.colSpan)+1),!1,"columns"),a=!1;break}}if(a&&(n[3]=$(r,n[3]-1,!1,"columns")),n[3]<0)return}if(e.shiftKey&&e.ctrlKey&&!this.parent.scrollSettings.enableVirtualization){var l=[r.usedRange.rowIndex,r.usedRange.colIndex];if(37===e.keyCode&&(n[3]<=l[1]?n[3]=$(r,0,!0,"columns"):n[3]=$(r,l[1],!0,"columns")),38===e.keyCode&&(n[2]<=l[0]?n[2]=$(r,0,!0):n[2]=$(r,l[0],!0)),39===e.keyCode&&(n[3]<=l[1]?n[3]=$(r,l[1],!1,"columns"):n[3]=$(r,r.colCount,!1,"columns"),n[3]<0))return;if(40===e.keyCode&&(n[2]<=l[0]?n[2]=$(r,l[0],!1):n[2]=$(r,r.rowCount,!1),n[2]<0))return}if(37===e.keyCode||39===e.keyCode||38===e.keyCode||40===e.keyCode){var h=u(r.activeCell);this.parent.isEdit&&e.shiftKey?(e.preventDefault(),this.parent.notify(eo,{range:n,e:e}),this.parent.notify(Is,{range:m(w(n)),isSelect:!1}),this.parent.notify(xs,{})):this.parent.selectRange(m(n)),this.scrollNavigation([z(r,n)?h[0]:n[2],_(r,n)?h[1]:n[3]])}},e.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(),a=this.parent.getActiveSheet(),o=w(c(a.selectedRange)),s=u(a.topLeftCell),l=this.parent.frozenRowCount(a),h=this.parent.frozenColCount(a),d=u(a.paneTopLeftCell),p=$(a,e[0]<l?s[0]:d[0],!0),f=this.parent.scrollModule.offset.top.size;if(n.scrollTop)if(l&&e[0]!==o[2]){if(e[0]===l)return void(n.scrollTop=0);e[0]===l-1&&(n.scrollTop=0)}else if(e[0]===$(a,0,!0))return void(n.scrollTop=0);if(i&&i.scrollLeft)if(h&&e[1]!==o[3]){if(e[1]===h)return void(i.scrollLeft=0);e[1]===h-1&&(i.scrollLeft=0)}else if(e[1]===$(a,0,!0,"columns"))return void(i.scrollLeft=0);var g=$t(this.parent,p).index;if(g<=e[0]){if(e[0]>=l)if(t){var m=n.getBoundingClientRect().height,v=Ye(a,d[0],e[0],!0);n.scrollTop=v>2*m?f+v-m:f+v-We(a,e[0],!0),Wt(this.parent.element)}else n.scrollTop=f+Ye(a,g,e[0],!0)}else p>e[0]&&(n.scrollTop&&(this.parent.scrollModule.isKeyScroll=!1),n.scrollTop=f-Math.ceil(Ye(a,e[0],p-1,!0)),t&&Wt(this.parent.element));var y=Zt(this.parent,d[1]);if(y<=e[1]&&i){if(e[1]>=h)if(t){var C=i.getBoundingClientRect().width,b=Ze(a,d[1],e[1],!0);i.scrollLeft=b>2*C?(this.parent.scrollModule.offset.left.size+b-C)*r:(this.parent.scrollModule.offset.left.size+(b-$e(a,e[0],null,!0)))*r,Wt(this.parent.element)}else i.scrollLeft=(this.parent.scrollModule.offset.left.size+Ze(a,y,e[1],!0))*r}else d[1]>e[1]&&i&&(i.scrollLeft&&(this.parent.scrollModule.isKeyScroll=!1),i.scrollLeft=(this.parent.scrollModule.offset.left.size-Ze(a,e[1],d[1]-1,!0))*r,t&&Wt(this.parent.element))}},e.prototype.getModuleName=function(){return"keyboardNavigation"},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e}(),eh=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.addEventListener=function(){this.parent.on(Ba,this.keyDownHandler,this),this.parent.on(Ha,this.keyUpHandler,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(Ba,this.keyDownHandler),this.parent.off(Ha,this.keyUpHandler))},e.prototype.isTrgtNotInput=function(e){var r=e.target;return!(t.closest(r,".e-filter-popup")||t.closest(r,".e-find-dlg")||t.closest(r,".e-hyperlink-dlg")||t.closest(r,".e-sheet-tab")||t.closest(r,".e-name-box")||t.closest(r,".e-link-dialog"))},e.prototype.ribbonShortCuts=function(e){if(this.parent.showRibbon&&e.altKey&&!e.ctrlKey&&!e.shiftKey){var r=t.getComponent(this.parent.element.querySelector(".e-ribbon .e-tab"),"tab"),n=void 0;if(72===e.keyCode)n=1;else if(78===e.keyCode)n=2;else if(65===e.keyCode)n=4;else if(87===e.keyCode)n=5;else if(77===e.keyCode)n=3;else if(70===e.keyCode)e.preventDefault(),t.select("#"+this.parent.element.id+"_File",this.parent.element).click();else if(18===e.keyCode){e.preventDefault();var i=u(this.parent.getActiveSheet().activeCell),a={sheetIdx:this.parent.activeSheetIndex};if(this.parent.notify(Ko,a),!(a.hasFilter&&a.filterRange&&a.filterRange[0]===i[0]&&a.filterRange[1]<=i[1]&&a.filterRange[3]>=i[1])){var o=document.activeElement;if(!(o.classList.contains("e-spreadsheet-edit")||o.classList.contains("e-sheet-rename")||o.id===this.parent.element.id+"_name_box"||t.closest(o,".e-dropdown-btn")||t.closest(o,".e-split-btn")||t.closest(o,".e-popup-open"))){var s=this.parent.getCell(i[0],i[1]);if(s&&s.querySelector(".e-validation-list"))return;if(t.closest(o,".e-ribbon"))return void Wt(this.parent.element);for(var l=0;l<=this.parent.ribbonModule.ribbon.items.length;l++)if(l===this.parent.ribbonModule.ribbon.selectedTab){var h=this.parent.element.querySelector(".e-toolbar-items").children[l+2].children[0];return h.setAttribute("tabindex","0"),void Wt(h)}}}}n&&(r.items[n].disabled||r.items[n].cssClass.includes("e-hide")?Wt(this.parent.element):(e.preventDefault(),r.select(n,Object.assign(e,{isShortcut:!0}))))}},e.prototype.keyUpHandler=function(e){if(37===e.keyCode||39===e.keyCode){var r=document.activeElement;if(r.classList.contains("e-colorpicker-wrapper")||r.classList.contains("e-split-btn-wrapper")){var n=r.querySelector(".e-split-btn");n&&Wt(n)}}else if(13===e.keyCode){var i=e.target;if(i.classList.contains("e-scroll-nav")){var a=function(){i.getAttribute("tabindex")||(i.setAttribute("tabindex","0"),Wt(i)),t.EventHandler.remove(i,"blur",a)};t.EventHandler.add(i,"blur",a,this)}}},e.prototype.keyDownHandler=function(e){var r="None"===this.parent.selectionSettings.mode;this.ribbonShortCuts(e);var n=this.parent.getActiveSheet(),i=e.target;if((e.ctrlKey||e.metaKey)&&this.isTrgtNotInput(e)){t.closest(i,".e-find-dlg")||r||([79,83].indexOf(e.keyCode)>-1?e.preventDefault():65!==e.keyCode||this.parent.isEdit||e.preventDefault());var a=u(n.activeCell);if(79===e.keyCode)this.parent.allowOpen&&this.parent.openUrl&&t.select("#"+this.parent.element.id+"_fileUpload",this.parent.element).click();else if(83===e.keyCode)this.parent.saveUrl&&this.parent.allowSave&&this.parent.notify(Tr,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=w(c(n.selectedRange)),s={colIndex:o[1],rowIndex:o[0]},l=void 0,h=void 0;if(68===e.keyCode?(o[0]===o[2]?s.rowIndex=o[0]-1:o[0]+=1,h=m([s.rowIndex,s.colIndex,s.rowIndex,o[3]]),l="Down"):(o[1]===o[3]?s.colIndex=o[1]-1:o[1]+=1,l="Right",h=m([s.rowIndex,s.colIndex,o[2],s.colIndex])),s.rowIndex<0||s.colIndex<0)return;this.parent.notify(ol,{fillType:Re(s.rowIndex,s.colIndex,n,!1,!0).formula?"FillSeries":"CopyCells",dAutoFillCell:h,rangeInfo:{direction:l,startCell:s,endCell:{rowIndex:o[2],colIndex:o[3]},fillRange:o}}),this.parent.notify(xi,{type:"mousedown"}),this.parent.notify(ti,null)}}else this.parent.isEdit||(e.preventDefault(),this.parent.notify(Lo,{isUndo:!1}));else this.parent.isEdit||(e.preventDefault(),this.parent.notify(Lo,{isUndo:!0}));else{var d=n.rows[a[0]],p=void 0;e.preventDefault(),t.isNullOrUndefined(d)||(p=d.cells[a[1]]),t.isNullOrUndefined(p)&&ke(a[0],a[1],n,p,!1),p&&p.hyperlink?this.parent.notify(Fo,null):this.parent.notify(ko,null)}else this.parent.notify(ro,{promise:Promise});var f=n.isProtected&&Y(Re(a[0],a[1],n),Xe(n,a[1]));if(70===e.keyCode&&!r&&this.parent.allowFindAndReplace&&(e.preventDefault(),this.parent.notify(Or,{})),f&&n.isProtected&&86!==e.keyCode||70===e.keyCode||r||(71===e.keyCode?(e.preventDefault(),this.parent.notify(is,null)):72===e.keyCode?(e.preventDefault(),this.parent.notify(as,null)):88===e.keyCode?this.parent.notify(to,{promise:Promise}):86===e.keyCode&&this.parent.notify(no,{isAction:!0}),!e.shiftKey||76!==e.keyCode||this.parent.isEdit||n.isProtected||(e.preventDefault(),this.parent.notify(Uo,{}))),!r&&(!n.isProtected||n.protectSettings.formatCells))if(66===e.keyCode){e.preventDefault();g="bold"===(g=this.parent.getCellStyleValue(["fontWeight"],a).fontWeight)?"normal":"bold",this.parent.notify(Br,{style:{fontWeight:g},onActionUpdate:!0,refreshRibbon:!0})}else if(73===e.keyCode){e.preventDefault();var g;g="italic"===(g=this.parent.getCellStyleValue(["fontStyle"],a).fontStyle)?"normal":"italic",this.parent.notify(Br,{style:{fontStyle:g},onActionUpdate:!0,refreshRibbon:!0})}else e.ctrlKey&&85===e.keyCode&&!e.shiftKey?(e.preventDefault(),this.parent.notify(Vr,{style:{textDecoration:"underline"},refreshRibbon:!0})):e.ctrlKey&&53===e.keyCode&&!e.shiftKey&&(e.preventDefault(),this.parent.notify(Vr,{style:{textDecoration:"line-through"},refreshRibbon:!0}))}if(27===e.keyCode&&this.parent.notify(io,null),((e.ctrlKey||e.metaKey)&&119===e.keyCode||13===e.keyCode&&i.classList.contains("e-drop-icon"))&&this.parent.showRibbon){e.preventDefault();var v=this.parent.element.querySelector(".e-drop-icon");v&&v.click()}if((e.ctrlKey||e.metaKey)&&!r)if(57===e.keyCode){if(!n.isProtected||n.protectSettings.formatColumns){e.preventDefault();a=c(n.selectedRange);this.parent.notify(Gn,{startIndex:a[0],endIndex:a[2],hide:!e.shiftKey,isCol:!1,actionUpdate:!0})}}else if(48===e.keyCode&&(!n.isProtected||n.protectSettings.formatRows)){a=c(n.selectedRange);this.parent.notify(Gn,{startIndex:a[1],endIndex:a[3],hide:!e.shiftKey,isCol:!0,actionUpdate:!0})}if(e.shiftKey&&!r)if(114===e.keyCode)e.preventDefault(),this.parent.notify(gl,null);else if(116===e.keyCode&&this.parent.allowFindAndReplace)e.preventDefault(),this.parent.notify(Or,{});else if(121===e.keyCode){var y=document.activeElement.className;["e-spreadsheet","e-cell","e-header-cell","e-clipboard"].some(function(e){return y.includes(e)})&&this.focusTarget(n)}if(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(Tr,null))),(e.ctrlKey||e.metaKey)&&e.shiftKey&&!r){if(!n.isProtected||n.protectSettings.formatCells){var C=n.selectedRange,b=void 0;if(192===e.keyCode)b=Ue("General");else if(52===e.keyCode)b="$#,##0.00;[Red]($#,##0.00)";else if(53===e.keyCode)b="0%";else if(54===e.keyCode)b=Ue("Scientific");else if(51===e.keyCode)b="dd-mmm-yy";else if(50===e.keyCode)b="h:mm AM/PM";else if(49===e.keyCode)b=Ue("Number");else if(55===e.keyCode){e.preventDefault();this.parent.notify(Br,{style:{border:"1px solid #000000"},onActionUpdate:!0,borderType:"Outer"})}b&&(this.parent.notify(Pr,{format:b,range:C}),this.parent.notify(xi,{type:"mousedown"}),this.parent.notify(ti,null))}if(85===e.keyCode){e.preventDefault();var x=this.parent.element.querySelector(".e-formula-bar-panel .e-drop-icon");x&&x.click()}}122!==e.keyCode||!e.shiftKey||e.ctrlKey||this.parent.isProtected||this.parent.notify(Sn,{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()},e.prototype.focusTarget=function(e){var t,r=w(c(e.selectedRange)),n=0===r[1]&&r[3]===e.colCount-1,i=0===r[0]&&r[2]===e.rowCount-1;if(n&&i)t=this.parent.element.querySelector(".e-selectall");else if(n){var a=this.parent.frozenRowCount(e);if(r[0]<a){t=(d=this.parent.getRow(r[0],this.parent.sheetModule.getSelectAllTable()))&&d.cells[0]}else{r[0]=$(e,r[0],!0);var o=$(e,c(e.paneTopLeftCell)[0],!0),s=$t(this.parent,o).index,l=void 0;t=(l=r[0]>o&&r[0]<s?this.parent.getRow(r[0],this.parent.getRowHeaderTable()):r[0]>=s?this.parent.getRow(s-1,this.parent.getRowHeaderTable()):this.parent.getRow(o+1,this.parent.getRowHeaderTable()))&&l.cells[0]}}else if(i){var h=this.parent.frozenColCount(e);if(r[1]<h){var d;t=(d=this.parent.element.querySelector(".e-selectall-container .e-header-row"))&&this.parent.getCell(0,r[1],d)}else{r[1]=$(e,r[1],!0,"columns");var p=$(e,c(e.paneTopLeftCell)[1],!0,"columns"),u=Zt(this.parent,p);l=this.parent.element.querySelector(".e-column-header .e-header-row");t=r[1]>p&&r[1]<u?l&&this.parent.getCell(0,r[1],l):r[1]>=u?l&&this.parent.getCell(0,u-1,l):l&&this.parent.getCell(0,p+1,l)}}else{var f=c(e.paneTopLeftCell);t=this.parent.getCell(r[0],r[1]);a=this.parent.frozenRowCount(e),h=this.parent.frozenColCount(e);if(r[0]<a&&r[1]<h)t=this.parent.getCell(r[0],r[1]);else if(r[0]<a){p=c(e.paneTopLeftCell)[1],u=Zt(this.parent,p);t=r[1]>p&&r[1]<u?this.parent.getCell(r[0],r[1]):r[1]>=u?this.parent.getCell(r[0],u-1):this.parent.getCell(r[0],p+1)}else if(r[1]<h){o=c(e.paneTopLeftCell)[0],s=$t(this.parent,o).index;t=r[0]>o&&r[0]<s?this.parent.getCell(r[0],r[1]):r[0]>=s?this.parent.getCell(s-1,r[1]):this.parent.getCell(o+1,r[1])}else{o=c(e.paneTopLeftCell)[0],s=$t(this.parent,o).index,p=c(e.paneTopLeftCell)[1],u=Zt(this.parent,p);t=r[0]>o&&r[0]<s?r[1]>p&&r[1]<u?this.parent.getCell(r[0],r[1]):r[1]>=u?this.parent.getCell(r[0],u-1):this.parent.getCell(r[0],p+1):r[0]>=s?r[1]>p&&r[1]<u?this.parent.getCell(s-1,r[1]):r[1]>=u?this.parent.getCell(s-1,u-1):this.parent.getCell(s-1,p+1):r[1]>p&&r[1]<u?this.parent.getCell(o+1,r[1]):r[1]>=u?this.parent.getCell(o+1,u-1):this.parent.getCell(o+1,p+1)}t||(t=this.parent.getCell(f[0]+1,f[1]+1))}t&&Wt(t)},e.prototype.getModuleName=function(){return"keyboardShortcut"},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e}(),th=function(){function e(e){this.checkHeight=!1,this.parent=e,this.addEventListener()}return e.prototype.applyCellFormat=function(e){if(e.checkHeight)return this.checkHeight||(this.checkHeight=!0),void this.updateRowHeight(e.rowIdx,e.colIdx,e.lastCell,e.onActionUpdate,e.outsideViewport);var t=Object.keys(e.style),r=this.parent.getActiveSheet();if(!(e.lastCell&&qt(r,e.rowIdx)<=20)||t.length){var n=e.td||this.parent.getCell(e.rowIdx,e.colIdx);if(n){if(this.updateMergeBorder(e,r),e.formatColor&&n.style.color===e.formatColor&&delete e.style.color,void 0!==e.style.border||void 0!==e.style.borderTop||void 0!==e.style.borderLeft){var i={};Object.keys(e.style).forEach(function(t){i[""+t]=e.style[""+t]}),void 0!==i.border&&(Object.assign(n.style,{borderRight:e.style.border,borderBottom:e.style.border}),this.setLeftBorder(e.style.border,n,e.rowIdx,e.colIdx,e.row,e.onActionUpdate,e.first,r),this.setTopBorder(e.style.border,n,e.rowIdx,e.colIdx,e.pRow,e.pHRow,e.onActionUpdate,e.first,e.lastCell,e.manualUpdate,r),delete i.border),void 0!==i.borderTop&&(this.setTopBorder(e.style.borderTop,n,e.rowIdx,e.colIdx,e.pRow,e.pHRow,e.onActionUpdate,e.first,e.lastCell,e.manualUpdate,r),delete i.borderTop),void 0!==i.borderLeft&&(this.setLeftBorder(e.style.borderLeft,n,e.rowIdx,e.colIdx,e.row,e.onActionUpdate,e.first,r),delete i.borderLeft),Object.keys(i).length&&(void 0!==i.borderBottom&&this.setThickBorderHeight(i.borderBottom,e.rowIdx,e.colIdx,n,e.row,e.hRow,e.onActionUpdate,e.lastCell,e.manualUpdate),Object.assign(n.style,i))}else{void 0!==e.style.borderBottom&&this.setThickBorderHeight(e.style.borderBottom,e.rowIdx,e.colIdx,n,e.row,e.hRow,e.onActionUpdate,e.lastCell,e.manualUpdate),Object.assign(n.style,e.style);var a=Re(e.rowIdx,e.colIdx,r);if(a&&(a.rowSpan||a.colSpan)&&n.offsetHeight>0){(l=Mt(this.parent,a.style||this.parent.cellStyle))>n.offsetHeight&&Pt(this.parent,r,n.offsetHeight,e.rowIdx)}}var o=Re(e.rowIdx,e.colIdx,r,null,!0);if(r.rows[e.rowIdx]&&r.rows[e.rowIdx].customHeight){if(!o.wrap&&(e.style.fontSize||e.style.fontFamily)){var s=We(r,e.rowIdx,!0)-Vt(e.rowIdx,e.colIdx,r);s<Mt(this.parent,o.style)?n.style.lineHeight=s+"px":n.style.lineHeight&&(n.style.lineHeight="")}}else if(e.isHeightCheckNeeded)if(e.manualUpdate)this.checkHeight||(this.checkHeight=Z(e.style,e.onActionUpdate)),n&&n.children[0]&&"e-cf-databar"===n.children[0].className&&e.style.fontSize&&(n.children[0].querySelector(".e-databar-value").style.fontSize=e.style.fontSize),this.updateRowHeight(e.rowIdx,e.colIdx,e.lastCell,e.onActionUpdate),o.wrap&&(e.style.fontSize||e.style.fontFamily)&&(n.style.lineHeight=parseFloat(o.style&&o.style.fontSize||this.parent.cellStyle.fontSize)*Ht(o.style&&o.style.fontFamily?o.style:this.parent.cellStyle)+"pt");else if(!o.wrap&&Z(e.style)&&jt(r,e.rowIdx,e.colIdx,zt(this.parent,e.rowIdx,e.colIdx,r,e.style)),e.lastCell){var l;(l=qt(r,e.rowIdx))>20&&l>We(r,e.rowIdx)&&Pt(this.parent,r,l,e.rowIdx,e.row,e.hRow,this.parent.scrollSettings.isFinite)}}else this.updateRowHeight(e.rowIdx,e.colIdx,!0,e.onActionUpdate)}},e.prototype.updateRowHeight=function(e,t,r,n,i){if(this.checkHeight){var a=this.parent.getActiveSheet(),o=Re(e,t,a,null,!0);if(!o.rowSpan){var s=0;s=zt(this.parent,e,t,a,o.style||this.parent.cellStyle,o.wrap?Ut(this.parent.getDisplayText(o),_t(a,e,t),o.style,this.parent.cellStyle):1);var l=o.value&&o.value.toString();if(l&&l.indexOf("\n")>-1){var h=void 0,d=l.split("\n"),p=0,c=d.length;for(h=0;h<c;h++){var u=Ut(d[h],_t(a,e,t),o.style,this.parent.cellStyle);0===u&&(u=1),p+=u}s=zt(this.parent,e,t,a,o.style||this.parent.cellStyle,p)}if(s<20&&(s=20),jt(a,e,t,s),!i){var f=this.parent.getCell(e,t);f&&f.children[0]&&"e-cf-databar"===f.children[0].className&&(f.children[0].style.height="100%",f.children[0].firstElementChild.nextElementSibling.style.height="100%")}if(r){this.checkHeight=!1;var g=qt(a,e),m=We(a,e);(n?g!==m:g>m)&&(i?(m=kt(m),Ge(a,e,g),this.parent.setProperties({sheets:this.parent.sheets},!0),this.parent.notify(yo,{rowIdx:e,threshold:kt(g)-m})):Pt(this.parent,a,g,e,null,null,!0))}}}},e.prototype.updateMergeBorder=function(e,t){var r=Re(e.rowIdx,e.colIdx,t,null,!0),n={range:[e.rowIdx,e.colIdx,e.rowIdx,e.colIdx]};if(this.parent.notify(qn,n),r.rowSpan>1&&!e.style.borderBottom){var i=Re(n.range[2],n.range[1],t,null,!0);i.style&&i.style.borderBottom&&(e.style.borderBottom=i.style.borderBottom)}if(r.colSpan>1&&!e.style.borderRight){var a=Re(n.range[0],n.range[3],t,null,!0);a.style&&a.style.borderRight&&(e.style.borderRight=a.style.borderRight)}},e.prototype.setLeftBorder=function(e,t,r,n,i,a,o,s){if(!o||!o.includes("Column")){var l=this.parent.enableRtl?this.parent.getCell(r,n+1,i):this.parent.getCell(r,n-1,i);if(l){var h=Re(r,n-1,s,!1,!0);if(h.rowSpan&&1!==h.rowSpan||h.colSpan&&1!==h.colSpan){var d={range:[r,n-1,r,n-1]};if(this.parent.notify(qn,d),(h=Re(d.range[0],d.range[1],s,!1,!0)).style&&h.style.borderRight&&"none"!==h.style.borderRight)return;if((h=Re(d.range[0],d.range[3],s,null,!0)).style&&h.style.borderRight&&"none"!==h.style.borderRight)return;t.style.borderLeft=e}else a&&""!==e&&n===this.parent.viewport.leftIndex&&(this.parent.getMainContent().scrollLeft-=this.getBorderSize(e)),l.style.borderRight="none"===e?l.style.borderRight:e}else t.style.borderLeft=e}},e.prototype.setTopBorder=function(e,t,r,n,i,a,o,s,l,h,d){if(!s||!s.includes("Row")){var p=n,c=Re(r,n,d,!1,!0);c.colSpan>1&&Qe(d,n)&&(p=$(d,n,!0,"columns"))>n+c.colSpan-1&&(p=n);var u=this.parent.getCell(r-1,p,i);if(u)if((c=Re(r-1,n,d,!1,!0)).rowSpan&&1!==c.rowSpan||c.colSpan&&1!==c.colSpan){var f={range:[r-1,n,r-1,n]};if(this.parent.notify(qn,f),(c=Re(f.range[0],f.range[1],d,!1,!0)).style&&c.style.borderBottom&&"none"!==c.style.borderBottom)return;if((c=Re(f.range[2],f.range[1],d,null,!0)).style&&c.style.borderBottom&&"none"!==c.style.borderBottom)return;t.style.borderTop=e}else{if(je(d,r-1)){var g=[Number(u.parentElement.getAttribute("aria-rowindex"))-1,n];if(this.parent.getCellStyleValue(["bottomPriority"],g).bottomPriority)return}o&&""!==e&&d.topLeftCell.includes(""+(r+1))&&(this.parent.getMainContent().parentElement.scrollTop-=this.getBorderSize(e)),this.setThickBorderHeight(e,r-1,n,u,i,a,o,l,h),u.style.borderBottom="none"===e?u.style.borderBottom:e}else t.style.borderTop=e}},e.prototype.setThickBorderHeight=function(e,t,r,n,i,a,o,s,l){var h=e?this.getBorderSize(e):1,d=this.parent.getActiveSheet();if(h>2&&(!d.rows[t]||!d.rows[t].customHeight))if(l)this.checkHeight||(this.checkHeight=!0),this.updateRowHeight(t,r,s,o);else{var p=We(d,t),c=Math.ceil(this.parent.calculateHeight(this.parent.getCellStyleValue(["fontFamily","fontSize"],[t,r]),1,3));c>p&&(Pt(this.parent,d,c,t,i,a,!1),this.parent.notify(yo,{rowIdx:t,threshold:c-20}))}!o||!s&&this.checkHeight||!(h<3)||d.rows[t]&&d.rows[t].customHeight||(this.checkHeight||(this.checkHeight=!0),this.updateRowHeight(t,r,s,o))},e.prototype.getBorderSize=function(e){var t=e.split(" ")[0];return"thin"===t?1:"medium"===t?2:"thick"===t?3:parseInt(t,10)?parseInt(t,10):1},e.prototype.clearObj=function(e){var r,n,i,a=this,o=e.options,s=o.range?o.range.indexOf("!")>0?o.range.split("!")[1]:o.range.split("!")[0]:this.parent.getActiveSheet().selectedRange,l=o.range&&o.range.indexOf("!")>0?ce(this.parent,o.range.split("!")[0]):this.parent.activeSheetIndex,h=w(c(s)),d=this.parent.sheets[l],p=h[0],u=h[2],f=this.parent.element.getElementsByClassName("e-ss-overlay-active"),g=f.length>0,v={range:s,type:o.type,requestType:"clear",sheetIndex:l},y=function(){e.isAction&&a.parent.notify(Ar,{action:"beforeClear",eventArgs:v})},C=function(){e.isAction&&(v={range:d.name+"!"+s,type:o.type,sheetIndex:l},i&&(v.cfClearActionArgs=i.cfClearActionArgs),a.parent.notify(Yo,{eventArgs:v,action:"clear"}))},b="Clear All"===o.type;if(g)f[0].classList.contains("e-datavisualization-chart")?("Clear Contents"===o.type||b)&&(y(),this.parent.notify(Ls,{id:f[0].id,sheetIdx:this.parent.activeSheetIndex+1}),C()):b&&(y(),this.parent.notify(Ds,{id:f[0].id,sheetIdx:this.parent.activeSheetIndex+1}),C());else{if(y(),"Clear Formats"===o.type||b)for(i={range:s,sheetIdx:l,isClear:!0},this.parent.notify(Kn,i),e.cfClearActionArgs=i.cfClearActionArgs,b&&(this.parent.notify(En,{range:s,isRemoveValidation:!0,viewport:this.parent.viewport}),0===p&&0===h[1]&&u>=d.usedRange.rowIndex&&h[3]>=d.usedRange.colIndex&&this.parent.setUsedRange(p,h[1],d,!1,!0));p<=u;p++)for(r=h[1],n=h[3];r<=n;r++){var x=Re(p,r,d),S=this.parent.getCell(p,r);x&&(b&&x.formula&&this.parent.notify(on,{cellRef:m([p,r,p,r])}),x.wrap&&this.parent.notify(yn,{range:[p,r,p,r],wrap:!1,sheet:d}),x.hyperlink&&(S&&t.removeClass(S.querySelectorAll(".e-hyperlink"),"e-hyperlink-style"),b&&this.parent.removeHyperlink(d.name+"!"+m([p,r,p,r]))))}"Clear Hyperlinks"===o.type&&this.parent.removeHyperlink(d.name+"!"+s),this.parent.notify($n,{range:d.name+"!"+s,type:o.type}),this.parent.serviceLocator.getService("cell").refreshRange(w(c(s)),!1,!1,!1,!1,Kt(this.parent),!b),this.parent.notify(Rn,{range:s,isclearFormat:!0}),e.isFromUpdateAction||this.parent.notify(Ja,{address:s}),this.parent.notify(Kr,null),C()}},e.prototype.addEventListener=function(){this.parent.on(_r,this.applyCellFormat,this),this.parent.on(Cs,this.clearObj,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(_r,this.applyCellFormat),this.parent.off(Cs,this.clearObj))},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null,this.checkHeight=null},e.prototype.getModuleName=function(){return"cellformat"},e}(),rh=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.addEventListener=function(){this.parent.on(Na,this.wireEvents,this),this.parent.on(Eo,this.autoFit,this),this.parent.on($o,this.setAutoFitHandler,this)},e.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)},e.prototype.wireEvents=function(){var e=this.parent.getRowHeaderContent(),r=this.parent.element.getElementsByClassName("e-header-panel")[0];r&&(t.EventHandler.add(r,"dblclick",this.dblClickHandler,this),t.EventHandler.add(e,"dblclick",this.dblClickHandler,this),t.EventHandler.add(r,"mousedown",this.mouseDownHandler,this),t.EventHandler.add(e,"mousedown",this.mouseDownHandler,this),this.wireResizeCursorEvent(e,r))},e.prototype.wireResizeCursorEvent=function(e,r){t.EventHandler.add(e,"mousemove",this.setTarget,this),t.EventHandler.add(r,"mousemove",this.setTarget,this)},e.prototype.unWireResizeCursorEvent=function(){t.EventHandler.remove(this.parent.getRowHeaderContent(),"mousemove",this.setTarget);var e=this.parent.element.getElementsByClassName("e-header-panel")[0];e&&t.EventHandler.remove(e,"mousemove",this.setTarget)},e.prototype.unwireEvents=function(){t.EventHandler.remove(this.parent.getColumnHeaderContent(),"dblclick",this.dblClickHandler),t.EventHandler.remove(this.parent.getRowHeaderContent(),"dblclick",this.dblClickHandler),t.EventHandler.remove(this.parent.getColumnHeaderContent(),"mousedown",this.mouseDownHandler),t.EventHandler.remove(this.parent.getRowHeaderContent(),"mousedown",this.mouseDownHandler),this.unWireResizeCursorEvent()},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(Na,this.wireEvents),this.parent.off(Eo,this.autoFit),this.parent.off($o,this.setAutoFitHandler))},e.prototype.mouseMoveHandler=function(e){var t=this.parent.element.getElementsByClassName("e-colresize-handler")[0],r=this.parent.element.getElementsByClassName("e-rowresize-handler")[0];if(this.resizeTooltip(null,!0,e),t||r){this.isMouseMoved=!0;var n=this.parent.enableRtl;t?(n?e.x<this.trgtEle.parentElement.firstChild.getBoundingClientRect().right:e.x>this.trgtEle.parentElement.firstChild.getBoundingClientRect().left)&&(t.style.left=e.clientX-document.getElementById(this.parent.element.id+"_sheet").getBoundingClientRect().left+"px"):r&&e.y>=this.trgtEle.parentElement.parentElement.firstChild.getBoundingClientRect().top&&(r.style.top=e.clientY-document.getElementById(this.parent.element.id+"_sheet").getBoundingClientRect().top+"px")}},e.prototype.mouseDownHandler=function(e){if(t.closest(e.target,".e-header-cell")&&!e.target.className.includes("e-filter-icon")){if(this.event=e,this.trgtEle=e.target,this.trgtEle.parentElement.classList.contains("e-hide-end")||this.trgtEle.classList.contains("e-hide-end")){var r=this.trgtEle.offsetHeight,n=e.offsetY;(r>=10&&n<5||r-2<8&&n<Math.ceil((n-2)/2))&&this.trgtEle.classList.add("e-skip-resize")}this.updateTarget(e,this.trgtEle);var i=this.trgtEle,a=i.classList.contains("e-colresize")?"e-colresize-handler":i.classList.contains("e-rowresize")?"e-rowresize-handler":"";this.createResizeHandler(i,a),this.unWireResizeCursorEvent(),t.EventHandler.add(this.parent.element,"mousemove",this.mouseMoveHandler,this),t.EventHandler.add(document,"mouseup",this.mouseUpHandler,this)}},e.prototype.mouseUpHandler=function(e){var r=this.parent.element.getElementsByClassName("e-resize-handle")[0];this.resizeOn(e),this.isMouseMoved=null;var n=document.querySelector(".e-header-tooltip");r&&(t.detach(r),this.updateCursor()),n&&n.remove(),t.EventHandler.remove(document,"mouseup",this.mouseUpHandler),t.EventHandler.remove(this.parent.element,"mousemove",this.mouseMoveHandler);var i=this.parent.element.getElementsByClassName("e-header-panel")[0];i&&this.wireResizeCursorEvent(this.parent.getRowHeaderContent(),i),this.parent.notify(il,null),this.parent.notify(al,null)},e.prototype.dblClickHandler=function(e){if(t.closest(e.target,".e-header-cell")&&!e.target.className.includes("e-filter-icon")){if(this.trgtEle=e.target,this.updateTarget(e,this.trgtEle),this.trgtEle.classList.contains("e-colresize")){var r=parseInt(this.trgtEle.getAttribute("aria-colindex"),10)-1,n=$e(this.parent.getActiveSheet(),r)+"px";this.trgtEle.classList.contains("e-unhide-column")?this.showHiddenColumns(r-1):this.setAutofit(r,!0,n,this.trgtEle)}else if(this.trgtEle.classList.contains("e-rowresize")){var i=parseInt(this.trgtEle.parentElement.getAttribute("aria-rowindex"),10)-1,a=We(this.parent.getActiveSheet(),i)+"px";this.setAutofit(i,!1,a)}this.parent.notify(il,null)}},e.prototype.setTarget=function(e){if(t.closest(e.target,".e-header-cell")&&!e.target.className.includes("e-filter-icon")){var r=e.target,n=this.parent.getActiveSheet();if(n.isProtected&&(!n.protectSettings.formatColumns||!n.protectSettings.formatRows)){if(!n.protectSettings.formatRows&&!n.protectSettings.formatColumns)return;if(n.protectSettings.formatRows&&t.closest(r,".e-colhdr-table"))return;if(n.protectSettings.formatColumns&&t.closest(r,".e-rowhdr-table"))return}var i,a,o,s;if(t.closest(r,".e-header-row")){a=r.offsetWidth,s="e-colresize",o=this.parent.enableRtl?a-e.offsetX:e.offsetX;(l=this.getColPrevSibling(r))&&!l.classList.contains("e-select-all-cell")?i=l:Number(r.getAttribute("aria-colindex"))>1&&(i=r)}else if(t.closest(r,".e-row")){o=e.offsetY,a=r.offsetHeight,s="e-rowresize";var l;(l=this.getRowPrevSibling(r))?i=l.firstElementChild:Number(r.parentElement.getAttribute("aria-rowindex"))>1&&(i=r)}if(a-2<8&&o!==Math.ceil((a-2)/2))o<Math.ceil((a-2)/2)?(r.classList.add(s),i.classList.add(s)):o>Math.ceil((a-2)/2)&&r.classList.add(s);else if(a-5<o&&o<=a&&a>=10)r.classList.add(s);else if(o<5&&i&&a>=10)r.classList.add(s),i.classList.add(s);else for(var h=this.parent.element.getElementsByClassName(s),d=0;d<h.length;d++)h[d].classList.remove(s)}},e.prototype.getColPrevSibling=function(e){var r=this.parent.frozenColCount(this.parent.getActiveSheet());return e.previousElementSibling||(r&&t.closest(e,".e-column-header")?this.parent.getSelectAllContent().querySelector(".e-header-row").lastElementChild:null)},e.prototype.getRowPrevSibling=function(e){var r=this.parent.frozenRowCount(this.parent.getActiveSheet());return e.parentElement.previousElementSibling||(r&&t.closest(e,".e-row-header")?this.parent.getSelectAllContent().querySelector("tbody").lastElementChild:null)},e.prototype.updateTarget=function(e,r){if(t.closest(r,".e-header-row")){var n=this.parent.enableRtl?r.offsetWidth-e.offsetX:e.offsetX;if(r.offsetWidth<10&&n<Math.ceil((r.offsetWidth-2)/2)||n<5&&r.offsetWidth>=10&&r.classList.contains("e-colresize")){var i=this.parent.getActiveSheet(),a=Number(this.trgtEle.getAttribute("aria-colindex"))-2;(o=this.getColPrevSibling(r))&&!Qe(i,a)?this.trgtEle=o:a>-1&&this.trgtEle.classList.add("e-unhide-column")}}else if(r.offsetHeight<10&&e.offsetY<Math.ceil((r.offsetHeight-2)/2)||e.offsetY<5&&r.offsetHeight>=10&&r.classList.contains("e-rowresize")){var o;i=this.parent.getActiveSheet(),a=Number(r.parentElement.getAttribute("aria-rowindex"))-2;if((o=this.getRowPrevSibling(r))||je(i,a))if("dblclick"===e.type&&je(i,a)){var s=w(c(i.selectedRange)),l=void 0;l=a<=s[2]&&a>s[0]&&_(i,s)?{startIndex:s[0],endIndex:s[2],hide:!1,autoFit:!0}:{startIndex:a,endIndex:a,hide:!1,autoFit:!0},this.parent.notify(Gn,l)}else je(i,a)||(this.trgtEle=o.getElementsByClassName("e-header-cell")[0])}},e.prototype.setAutoFitHandler=function(e){e.isCol&&Qe(this.parent.getActiveSheet(),e.idx)?this.showHiddenColumns(e.idx):this.setAutofit(e.idx,e.isCol)},e.prototype.getWrapText=function(e,t,r){var n,i=this,a=e.toString().split(" "),o=Bt(" ",r,this.parent.cellStyle),s=0,l=0,h=e,d="",p=function(){var e=parseInt(l.toString(),10);(e>s||e===s&&Bt(d.trim(),r,i.parent.cellStyle)>Bt(h,r,i.parent.cellStyle))&&(h=d.trim(),s=e)};return a.forEach(function(e,s){n=Bt(e,r,i.parent.cellStyle),(l+n)/t>1?(p(),d="",l=n):l+=n+=(l+n+o)/t>=1?0:o,d+=e+" ",s===a.length-1&&p()}),h},e.prototype.setAutofit=function(e,t,r,n){var i,a=this,o=this.parent.getActiveSheet();if(n){var s={cancel:!1,index:e,isCol:t,sheetIndex:this.parent.activeSheetIndex};if(t?(s.oldWidth=r,s.autoFitWithHeader=!1):s.oldHeight=r,this.parent.notify(Ar,{eventArgs:s,action:"resizeToFit"}),s.cancel)return;i=s.autoFitWithHeader}var l,h,d,p,u={},f=this.parent.createElement("table",{className:this.parent.getContentTable().className+" e-resizetable",styles:"height: auto"}),g=this.parent.createElement("tbody"),m=this.parent.createElement("tr",{className:"e-row"}),v=this.parent.createElement("td",{className:"e-cell"});if(t){var y;f.style.width="auto";var C=function(e){(h=v.cloneNode()).textContent=e,h.style.fontFamily=u.style&&u.style.fontFamily||a.parent.cellStyle.fontFamily,h.style.fontSize=u.style&&u.style.fontSize||a.parent.cellStyle.fontSize,h.style.fontWeight=u.style&&u.style.fontWeight||a.parent.cellStyle.fontWeight,(y=m.cloneNode()).appendChild(h),g.appendChild(y)};i&&C(n.textContent);for(var b=0,x=o.rows.length;b<x;b++)(u=Re(b,e,o))&&(u.wrap?(p=!0,C(this.getWrapText(this.parent.getDisplayText(u),_t(o,e,e,u.colSpan>1?e+u.colSpan-1:e),u.style))):C(this.parent.getDisplayText(u)));l=$e(o,e)}else{var S=o.rows[e]&&o.rows[e].cells?o.rows[e].cells.length:0;d=this.parent.createElement("colgroup");for(var w=0;w<S;w++)(u=Re(e,w,o))&&(h=v.cloneNode(),u.wrap&&h.classList.add("e-wraptext"),h.textContent=this.parent.getDisplayText(u),h.style.fontFamily=u.style&&u.style.fontFamily||this.parent.cellStyle.fontFamily,h.style.fontSize=u.style&&u.style.fontSize||this.parent.cellStyle.fontSize,m.appendChild(h),d.appendChild(this.parent.createElement("col",{styles:"width:"+$e(o,w,!1,!0)+"px"})));f.appendChild(d),g.appendChild(m),l=We(o,e)}f.appendChild(g);var I=this.parent.createElement("div",{className:this.parent.element.className,styles:"display: block"});I.appendChild(f),document.body.appendChild(I);var E=f.getBoundingClientRect();document.body.removeChild(I);var R,k=Math.ceil(t?E.width:E.height),F=(t?this.getFloatingElementWidth(k+(p?1:0),e):k)||l;if(t){R=F>0?-(l-F):-l;var A=this.parent.frozenColCount(o);A&&e>=c(o.topLeftCell)[1]&&e<A||e>=this.parent.viewport.leftIndex+A&&e<=this.parent.viewport.rightIndex?(Xe(o,e).width=F>0?F:0,this.resizeStart(e,this.parent.getViewportIndex(e,!0),F+"px",t,!0,r),this.parent.notify(Co,{threshold:R,colIdx:e})):(this.parent.notify(Co,{threshold:R,colIdx:e}),Xe(o,e).width=F>0?F:0)}else{var N=this.parent.frozenRowCount(o);R=-(l-(F=F>20?F:20)),N&&e>=c(o.topLeftCell)[0]&&e<N||e>=this.parent.viewport.topIndex+N&&e<=this.parent.viewport.bottomIndex?(Ge(o,e,F),ze(o,e,{customHeight:!1}),this.resizeStart(e,this.parent.getViewportIndex(e),F+"px",t,!0,r),this.parent.notify(yo,{threshold:R,rowIdx:e})):(this.parent.notify(yo,{threshold:R,rowIdx:e}),Ge(o,e,F))}this.parent.selectRange(o.selectedRange)},e.prototype.createResizeHandler=function(e,t){var r=this.parent.createElement("div",{className:t});r.classList.add("e-resize-handle");var n=document.getElementById(this.parent.element.id+"_sheet");e.classList.contains("e-colresize")?(r.style.height=this.parent.getMainContent().parentElement.clientHeight+this.parent.getColumnHeaderContent().offsetHeight+"px",r.style.left=this.event.clientX-n.getBoundingClientRect().left+"px",r.style.top="0px"):e.classList.contains("e-rowresize")&&(r.style.width=this.parent.getMainContent().parentElement.clientWidth+"px",r.style.left="0px",r.style.top=this.event.clientY-n.getBoundingClientRect().top+"px"),n.appendChild(r),this.resizeTooltip(e,!1),this.updateCursor()},e.prototype.resizeTooltip=function(e,t,r){if(t){var i=this.parent.enableRtl,a=document.querySelector(".e-header-tooltip"),o=this.parent.element.getElementsByClassName("e-colresize-handler")[0],s=this.parent.element.getElementsByClassName("e-rowresize-handler")[0];if(o){var l=i?Math.round(this.trgtEle.getBoundingClientRect().right)-r.clientX:r.clientX-Math.round(this.trgtEle.getBoundingClientRect().left);a&&(a.firstChild.textContent=l>0?"Width:("+l.toString()+" pixels)":"Width: 0.00")}else if(s){var h=r.clientY-Math.round(this.trgtEle.getBoundingClientRect().top);a&&(a.firstChild.textContent=h>0?"Height:("+h.toString()+" pixels)":"Height: 0.00")}}else{var d=e.classList.contains("e-colresize"),p=e.classList.contains("e-rowresize");if(d||p){var c=d?"e-colresize-handler":"e-rowresize-handler",u=new n.Tooltip({cssClass:"e-header-tooltip",showTipPointer:!1});d?u.content="Width:("+Math.round(e.getBoundingClientRect().width).toString()+" pixels)":p&&(u.content="Height:("+Math.round(e.getBoundingClientRect().height).toString()+" pixels)",u.offsetX=-(this.parent.getMainContent().parentElement.clientWidth/2-Math.round(e.getBoundingClientRect().width))),u.appendTo("."+c),u.open(),u.refresh()}}},e.prototype.setColWidth=function(e,t,r,n){var i=this.parent.getActiveSheet(),a=kt(r)-n;if(a<0&&n<-a&&(a=-n),r>0){if(this.isMouseMoved&&this.trgtEle.classList.contains("e-unhide-column"))return this.showHiddenColumns(e,r),void this.parent.notify(Yo,{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"),Ke(i,e,{width:r,customWidth:!0}),this.parent.notify(Co,{threshold:a,colIdx:e,checkWrapCell:!0})}else this.isMouseMoved&&(this.parent.hideColumn(e),this.showHideCopyIndicator(),this.parent.notify(Yo,{eventArgs:{index:e,width:"0px",isCol:!0,sheetIndex:this.parent.activeSheetIndex,oldWidth:n+"px",hide:!0},action:"resize"}))},e.prototype.showHideCopyIndicator=function(){var e=this.parent.element.getElementsByClassName("e-copy-indicator")[0],r=!1;e&&(t.detach(e),this.parent.notify(ll,null),r=!0),r&&this.parent.notify(Na,{})},e.prototype.showHiddenColumns=function(e,t){var r,n,i,a=this,o=this.parent.getActiveSheet(),s=c(o.selectedRange);if(e>=s[1]&&e<=s[3]&&s[2]===o.rowCount-1&&u(o.activeCell)[0]===u(o.topLeftCell)[0]?(r=s[1],n=s[3],i=this.parent.getMainContent().querySelector("colgroup")):r=n=e,void 0!==t)for(var l=r;l<=n;l++)Ke(o,l,{width:t,customWidth:!0}),l>=this.parent.viewport.leftIndex&&l<=this.parent.viewport.rightIndex&&!Qe(o,l)&&(i.children[this.parent.getViewportIndex(l,!0)].style.width=t+"px");this.trgtEle&&this.trgtEle.classList.remove("e-unhide-column");var h={startIndex:r,endIndex:n,hide:!1,isCol:!0,autoFit:!0};if(this.parent.notify(Gn,h),this.showHideCopyIndicator(),void 0===t)if(h.autoFit)this.autoFit({isRow:!1,startIndex:r,endIndex:n});else{var d=function(){a.parent.off(Na,d),a.autoFit({isRow:!1,startIndex:r,endIndex:n})};this.parent.on(Na,d,this)}},e.prototype.setRowHeight=function(e,t,r,n){var i=this.parent.getActiveSheet(),a=this.parent.frozenColCount(i),o=parseInt(this.parent.getRow(e,null,a).style.height,10),s=r,l=kt(parseInt(s,10))-o;l<0&&o<-l&&(l=-o),this.resizeStart(e,t,s,!1,!1,n),ze(i,e,{height:parseInt(s,10)>0?parseInt(s,10):0,customHeight:!0}),this.parent.notify(yo,{threshold:l,rowIdx:e,isCustomHgt:!0})},e.prototype.resizeOn=function(e){var t,r,n=this,i=this.parent.getActiveSheet(),a=c(i.activeCell),o=Re(a[0],a[1],i);if(this.trgtEle.classList.contains("e-rowresize")){var s=Number(this.trgtEle.parentElement.getAttribute("aria-rowindex"))-2;if(this.isMouseMoved&&je(i,s)&&this.trgtEle.classList.contains("e-skip-resize")&&e.clientY>this.trgtEle.getBoundingClientRect().top){this.trgtEle.classList.remove("e-skip-resize");var l={startIndex:s,endIndex:s,hide:!1,skipAppend:!0};this.parent.notify(Gn,l);var h=this.parent.getRowHeaderTable().tBodies[0],d=this.parent.getContentTable().tBodies[0];l.hdrRow.style.display="none",l.row.style.display="none",h.insertBefore(l.hdrRow,h.children[l.insertIdx]),d.insertBefore(l.row,d.children[l.insertIdx]),this.trgtEle=l.hdrRow.firstElementChild,l.hdrRow.nextElementSibling.classList.remove("e-hide-end"),l.mergeCollection.forEach(function(e){n.parent.notify(_n,e)})}else if(this.trgtEle.classList.contains("e-skip-resize")){if(this.trgtEle.classList.remove("e-skip-resize"),!this.isMouseMoved&&je(i,s)||!this.trgtEle.parentElement.previousElementSibling)return;this.trgtEle=this.trgtEle.parentElement.previousElementSibling.getElementsByClassName("e-header-cell")[0]}r=t=parseInt(this.trgtEle.parentElement.getAttribute("aria-rowindex"),10)-1,t=this.parent.getViewportIndex(r);var p=this.parent.frozenColCount(i),u=this.parent.getRow(r,null,p).style.height,f=e.clientY-this.event.clientY+parseInt(u,10);if(f<=0)return this.parent.hideRow(r),this.showHideCopyIndicator(),ze(i,r,{height:0,customHeight:!0}),void this.parent.notify(Yo,{eventArgs:{index:r,height:"0px",isCol:!1,sheetIndex:this.parent.activeSheetIndex,oldHeight:u},action:"resize"});if(this.setRowHeight(r,t,f+"px",u),"none"===this.trgtEle.parentElement.style.display){var g=this.parent.getActiveSheet(),m=w(c(g.selectedRange));if(r<=m[2]&&r>m[0]){f=We(g,r);for(var v=void 0,y=m[0];y<=m[2];y++)y!==r&&(u=We(g,y)+"px",ze(g,y,{customHeight:!0,height:f}),je(g,y)?v||(v=y):(this.parent.getRow(y).style.height=f+"px",g.showHeaders&&(this.parent.getRow(y,this.parent.getRowHeaderTable()).style.height=f+"px")),this.parent.notify(Yo,{eventArgs:{index:y,height:f+"px",isCol:!1,sheetIndex:this.parent.activeSheetIndex,oldHeight:u},action:"resize"}));this.parent.hideRow(m[0],r-1,!1),this.showHideCopyIndicator(),t+=Math.abs(r-v)}else 0===t||je(g,r-1)?0!==t&&this.trgtEle.parentElement.classList.add("e-hide-end"):this.trgtEle.parentElement.previousElementSibling.classList.remove("e-hide-start"),this.parent.selectRange(g.selectedRange);this.trgtEle.parentElement.style.display="",this.parent.getContentTable().rows[t].style.display=""}}else if(this.trgtEle.classList.contains("e-colresize")){this.isMouseMoved&&this.trgtEle.classList.contains("e-unhide-column")&&e.clientX<this.trgtEle.getBoundingClientRect().left&&(this.trgtEle.classList.remove("e-unhide-column"),this.trgtEle.previousElementSibling&&(this.trgtEle=this.trgtEle.previousElementSibling)),t=parseInt(this.trgtEle.getAttribute("aria-colindex"),10)-1;var C=void 0;this.trgtEle.classList.contains("e-unhide-column")?(t-=1,C=0):C=$e(this.parent.getActiveSheet(),t),this.setColWidth(t,this.parent.getViewportIndex(t,!0),(this.parent.enableRtl?this.event.clientX-e.clientX:e.clientX-this.event.clientX)+C,C)}o&&o.format&&o.format.includes("*")&&this.parent.notify(Mr,{value:o.value,format:o.format,cell:o,formattedText:o.value,rowIndex:a[0],colIndex:a[1]})},e.prototype.resizeStart=function(e,t,r,n,i,a){Nt(e,t,r,n,this.parent);var o,s,l=i?"resizeToFit":"resize";n?(o={index:e,width:r,isCol:n,sheetIndex:this.parent.activeSheetIndex,oldWidth:a},s=a!==r):(o={index:e,height:r,isCol:n,sheetIndex:this.parent.activeSheetIndex,oldHeight:a},s=a!==r),s&&this.parent.notify(Yo,{eventArgs:o,action:l})},e.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")},e.prototype.getFloatingElementWidth=function(e,t){var r=e,n={filterRange:[],hasFilter:!1};return this.parent.notify(Ko,n),n.hasFilter&&n.filterRange&&n.filterRange[1]<=t&&n.filterRange[3]>=t&&(r=e+22),r},e.prototype.destroy=function(){this.unwireEvents(),this.removeEventListener(),this.trgtEle&&this.trgtEle.remove(),this.trgtEle=null,this.parent=null},e.prototype.getModuleName=function(){return"resize"},e}(),nh=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.hideShow=function(e){var r=this,n=t.isUndefined(e.sheetIndex)?this.parent.activeSheetIndex:e.sheetIndex,i=Ce(this.parent,n);if(e.startIndex>e.endIndex){var a=e.startIndex;e.startIndex=e.endIndex,e.endIndex=a}var o;if(e.actionUpdate){if(e.sheetIndex=n,o={eventArgs:e,action:"hideShow"},this.parent.notify(Ar,o),e.cancel)return;delete e.cancel}var s=function(t){e.isCol?(r.hideCol(e),t&&r.parent.sheetModule.colWidthChanged({colIdx:e.startIndex,isHideShow:!0})):(r.hideRow(e),t&&r.parent.sheetModule.rowHeightChanged({rowIdx:e.startIndex,isHideShow:!0}))},l=e.isCol?this.parent.frozenColCount(i):this.parent.frozenRowCount(i);if(l&&e.startIndex<l){var h=void 0;if(e.freezePane=!0,e.endIndex>=l&&(h=e.endIndex,e.endIndex=l-1),s(!0),delete e.freezePane,void 0!==h){var d=e.startIndex;e.endIndex=h,e.startIndex=l,s(),e.startIndex=d}}else s();e.actionUpdate&&(this.updateIndexOnlyForHiddenColumnsAndRows(e,i),this.parent.notify(Yo,o),Wt(this.parent.element))},e.prototype.updateIndexOnlyForHiddenColumnsAndRows=function(e,t){for(var r=e.startIndex,n=e.endIndex,i=e.startIndex;i<=n;i++)if(!1===(e.isCol?Xe(t,i):_e(t,i)||{}).hidden){e.startIndex=i;break}for(var a=e.endIndex;a>=r;a--)if(!1===(e.isCol?Xe(t,a):_e(t,a)||{}).hidden){e.endIndex=a;break}},e.prototype.hideRow=function(e){var r,n,i,a,o,s,l=this,h=t.isUndefined(e.sheetIndex)?this.parent.activeSheetIndex:e.sheetIndex,d=Ce(this.parent,h),p=0,f=Object.assign({},e),m=this.parent.scrollSettings.isFinite&&!f.freezePane;if(m){if(f.startIndex>=d.rowCount)return;f.endIndex>=d.rowCount&&(f.endIndex=d.rowCount-1),s=0}var v=this.parent.frozenRowCount(d);if(f.hide){for(var y,C=void 0,b=void 0,x=[],S=[],w=m&&f.endIndex===$(d,d.rowCount-1,!1),I=f.startIndex;I<=f.endIndex;I++)if(je(d,I))f.isFiltering&&!qe(d,I)&&ze(d,I,{isFiltered:!0});else if(void 0===n&&(f.freezePane?(y=this.parent.sheetModule.getSelectAllTable(),C=this.parent.getColHeaderTable()):(y=this.parent.getRowHeaderTable(),C=this.parent.getContentTable()),n=this.parent.getViewportIndex(I),p=0),o={hidden:!0},f.isFiltering&&(o.isFiltered=!0),f.isFiltering||(x=Jt(this.parent)),ze(d,I,o),f.isFiltering||(S=Jt(this.parent)),h===this.parent.activeSheetIndex)if(m&&(s+=We(d,I,!0,!0)),this.refreshChart(I,"rows"),f.isFiltering||this.refreshChartCellModel(x,S),b=C&&C.rows[n]){if(!a)for(var E=0;E<=d.usedRange.colIndex;E++)if(((r=Re(I,E,d)||{}).colSpan||r.rowSpan)&&(f.startIndex>=this.parent.viewport.topIndex||this.parent.scrollSettings.enableVirtualization)){a=!0;break}if(a)continue;if(y.rows[n]&&t.detach(y.rows[n]),t.detach(b),p++,(b=C.rows[n])&&I===f.endIndex){var R=void 0,k=(i=$(d,I+1,!0))!==$(d,0,!0)&&i===(this.parent.viewport.topIndex>=f.startIndex?f.endIndex+1:this.parent.viewport.topIndex)?"Row":"";for(E=this.parent.viewport.leftIndex;E<=this.parent.viewport.rightIndex;E++){""!==(Q=this.parent.getCellStyleValue(["borderTop"],[i,E]).borderTop)&&(R=b.cells[E],this.parent.notify(_r,{onActionUpdate:!1,rowIdx:i,colIdx:E,style:{borderTop:Q},row:b,pRow:b.previousElementSibling,first:k,td:R}))}}}else I<=this.parent.viewport.bottomIndex?p++:p--;if(f.refreshUI)return;if(a&&(f.startIndex>=this.parent.viewport.topIndex||!this.parent.scrollSettings.enableVirtualization))return void(f.isFiltering?e.refreshUI=!0:(this.parent.selectRange(d.selectedRange),d.frozenRows||d.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"})));if(!p)return;this.parent.selectRange(d.selectedRange);var F=function(){if(d.showHeaders){var e=f.freezePane?1:0;n===e?y.rows[e]&&y.rows[e].classList.add("e-hide-end"):(y&&y.rows[n-1]&&y.rows[n-1].classList.add("e-hide-start"),y&&y.rows[n]&&y.rows[n].classList.add("e-hide-end"))}};if(!f.freezePane&&this.parent.scrollSettings.enableVirtualization){var A=f.startIndex,N=f.startIndex;if(f.startIndex<u(d.paneTopLeftCell)[0]||p>this.parent.viewport.rowCount){if(f.isFiltering)return void(e.refreshUI=!0);this.parent.updateTopLeftCell($(d,f.startIndex-1<v?v:f.startIndex-1,!0)-v,null,"col"),this.parent.renderModule.refreshSheet(!1,!1,!0)}else{N=(A=this.parent.viewport.bottomIndex+1)+p-1;var O=this.parent.skipHidden(A,N,"rows",!1);if(A=O[0],N=O[1],m){if(A>=d.rowCount)return void(this.parent.viewport.topIndex+v===$(d,v,!0)?(F(),this.parent.notify(dl,{isHide:!0,height:s}),w&&(this.parent.viewport.bottomIndex=$(d,d.rowCount-1,!1))):this.parent.renderModule.refreshSheet(!1,!1,!0));if(N>=d.rowCount)return void this.parent.renderModule.refreshSheet(!1,!1,!0);this.parent.notify(dl,{isHide:!0,height:s})}this.parent.viewport.bottomIndex=N;var T=void 0,D=this.parent.frozenColCount(d),L=[];D?(L.push(v),L.push(this.parent.viewport.leftIndex+D),T=u(d.topLeftCell)[1]):T=this.parent.viewport.leftIndex,this.parent.renderModule.refreshUI({colIndex:T,rowIndex:A,direction:"",refresh:"RowPart",frozenIndexes:L},g(A,T)+":"+g(N,this.parent.viewport.rightIndex))}}F()}else{var P=void 0,M=void 0,H=void 0,B=(b=void 0,void 0),U=void 0,V=(C=void 0,void 0),_=void 0,z=f.startIndex-1,j=[],q=f.freezePane,W="lastElementChild",G=0;if(m){var Y=$(d,d.rowCount-1,!1);if(this.parent.viewport.bottomIndex===Y)if(this.parent.viewport.topIndex+v===$(d,v,!0))q=!0;else{var X=c(d.paneTopLeftCell)[0];d.rowCount-1-X+1-this.parent.hiddenCount(X,d.rowCount-1)<this.parent.viewport.rowCount+Math.round(this.parent.getThreshold("row")/2)&&(W="firstElementChild")}}x=Jt(this.parent),I=f.startIndex;for(var K=f.endIndex;I<=K;I++)if(je(d,I))if(void 0===B){if(o={hidden:!1},f.isFiltering&&(o.isFiltered=!1),!q&&I>this.parent.viewport.bottomIndex){if(ze(d,I,o),void 0===_)return}else if(void 0===_&&(_=I),ze(d,I,o),h===this.parent.activeSheetIndex){m&&(s+=We(d,I,!0,!0)),this.refreshChart(I,"rows"),void 0===n&&(P=document.createDocumentFragment(),M=document.createDocumentFragment(),U=this.parent.serviceLocator.getService("row"),f.freezePane?(V=this.parent.sheetModule.getSelectAllTable(),C=this.parent.getColHeaderTable()):(V=this.parent.getRowHeaderTable(),C=this.parent.getContentTable(),I<this.parent.viewport.topIndex+v&&(this.parent.viewport.topIndex=I-v)),n=this.parent.getViewportIndex(I)),z++,H=U.refresh(I,null,null,!0,!0),P.appendChild(H),V&&V.rows.length&&!q&&t.detach(V.tBodies[0][""+W]),b=M.appendChild(U.refresh(I,b,H)),C&&C.rows.length&&!q&&(t.detach(C.tBodies[0][""+W]),"firstElementChild"===W&&(void 0!==n&&n-1>-1&&(n-=1),G+=We(d,this.parent.viewport.topIndex,!0),this.parent.viewport.topIndex=$(d,this.parent.viewport.topIndex+1,!0)));for(E=this.parent.viewport.leftIndex;E<=this.parent.viewport.rightIndex;E++)if(void 0!==(r=Re(I,E,d)||{}).rowSpan||void 0!==r.colSpan){var Z={range:[I,E,I,E],isAction:!1,merge:!0,type:"All",skipChecking:!0};this.parent.notify(qn,Z),j.length&&Z.range[1]===j[j.length-1].range[1]&&Z.range[0]===j[j.length-1].range[0]||j.push(Z)}}}else K=I;else{if(f.startIndex===f.endIndex)return;void 0===n?z++:B=I}S=Jt(this.parent);if(this.refreshChartCellModel(x,S),void 0===n)return;if(!f.freezePane){if(f.isFiltering&&f.startIndex<u(d.paneTopLeftCell)[0]&&(e.refreshUI=!0,void 0===B||B===f.endIndex))return;this.parent.viewport.bottomIndex=this.parent.viewport.topIndex+v+this.parent.viewport.rowCount+2*this.parent.getThreshold("row"),p=this.parent.hiddenCount(this.parent.viewport.topIndex+v,f.startIndex)+this.parent.hiddenCount(f.endIndex+1,this.parent.viewport.bottomIndex),this.parent.viewport.bottomIndex+=p,m&&this.parent.viewport.bottomIndex>=d.rowCount&&(this.parent.viewport.bottomIndex=$(d,d.rowCount-1,!1))}if(f.insertIdx=e.insertIdx=n,f.row=e.row=M.querySelector(".e-row"),f.mergeCollection=e.mergeCollection=j,d.showHeaders&&(e.hdrRow=f.hdrRow=P.querySelector(".e-row"),0!==n&&!je(d,z-1)&&V.rows[n-1]&&V.rows[n-1].classList.remove("e-hide-start"),0!==f.startIndex&&je(d,f.startIndex-1)&&f.hdrRow.classList.add("e-hide-end"),je(d,z+1)?P.lastElementChild.classList.add("e-hide-start"):V.rows[n]&&V.rows[n].classList.remove("e-hide-end")),b&&C&&C.rows[n]){i=$(d,z+1,!0);for(I=this.parent.viewport.leftIndex;I<=this.parent.viewport.rightIndex;I++){var Q;if(""!==(Q=this.parent.getCellStyleValue(["borderTop"],[i,I]).borderTop)){this.parent.notify(_r,{onActionUpdate:!1,rowIdx:i,colIdx:I,style:{borderTop:Q},pRow:b,td:C.rows[n].cells[I],first:""});var J=$(d,_-1,!1);J>-1?!C.rows[n-1]||this.parent.getCellStyleValue(["borderBottom"],[J,I]).borderBottom||this.parent.getCellStyleValue(["borderTop"],[_,I]).borderTop||(C.rows[n-1].cells[I].style.borderBottom=""):C.rows[n].cells[I].style.borderTop=""}}}if(f.skipAppend)return;m&&this.parent.notify(dl,{height:s,size:G}),Math.abs(z-_)>this.parent.viewport.rowCount+2*this.parent.getThreshold("row")?this.parent.renderModule.refreshSheet(!1,!1,!0):(V&&(V.tBodies[0].rows.length?V.tBodies[0].insertBefore(P,V.rows[n]):V.tBodies[0].appendChild(P)),C&&C.tBodies[0]&&(C.tBodies[0].rows.length?C.tBodies[0].insertBefore(M,C.rows[n]):C.tBodies[0].appendChild(M)),this.parent.selectRange(d.selectedRange),f.autoFit&&d.showHeaders&&this.parent.notify(Eo,{startIndex:f.startIndex,endIndex:f.endIndex,isRow:!0}),j.forEach(function(e){l.parent.notify(_n,e)}),void 0!==B&&B!==f.endIndex&&(f.startIndex=B,this.hideRow(f)))}},e.prototype.hideCol=function(e){for(var r,n=this,i=t.isUndefined(e.sheetIndex)?this.parent.activeSheetIndex:e.sheetIndex,a=Ce(this.parent,i),o=[],s=[],l=u(a.paneTopLeftCell),h=this.parent.frozenColCount(a),d=this.parent.frozenRowCount(a),p=this.parent.viewport.leftIndex+h,c=e.startIndex;c<=e.endIndex;c++)if(e.hide?!Qe(a,c):Qe(a,c)){var f=Jt(this.parent);Ke(a,c,{hidden:e.hide});var g=Jt(this.parent);this.refreshChart(c,"columns"),this.refreshChartCellModel(f,g),this.parent.scrollSettings.enableVirtualization&&!e.freezePane&&(c<p||c>this.parent.viewport.rightIndex)?c<p&&s.push(c):(o.push(c),e.hide&&c<=l[1]&&(r=!0))}if((s.length||o.length)&&i===this.parent.activeSheetIndex){var v,y,C=u(a.topLeftCell),b=function(){var t;return t=n.parent.scrollSettings.enableVirtualization?[d?C[0]:n.parent.viewport.topIndex,n.parent.viewport.bottomIndex]:[0,a.rowCount-1],e.freezePane?(v=n.parent.getRowHeaderTable(),y=n.parent.sheetModule.getSelectAllTable()):(v=n.parent.getContentTable(),y=n.parent.getColHeaderTable()),t};if(e.hide){if(!o.length)return;if((o.length<=this.parent.getThreshold("col")||!this.parent.scrollSettings.enableVirtualization||e.freezePane)&&this.removeCell(a,o,b(),v,y),!e.freezePane&&this.parent.scrollSettings.enableVirtualization){if(r)return this.parent.updateTopLeftCell(null,$(a,o[0]-1<h?h:o[0]-1,!0,"columns")-h,"row"),void this.parent.renderModule.refreshSheet(!1,!1,!0);var x=[],S=this.parent.viewport.topIndex,w=d?C[0]:S;if(d&&(x=[d+S,h]),this.parent.scrollSettings.isFinite){var I=$(a,a.colCount-1,!1,"columns"),E=this.parent.viewport.leftIndex+h,R=this.parent.viewport.rightIndex;if(R+o.length>=I){var k=$(a,E-(R+o.length-I),!1,"columns");return k>=h&&(this.parent.viewport.leftIndex=k,this.parent.viewport.leftIndex-=this.parent.hiddenCount(R,I)),this.parent.viewport.rightIndex=I,E!==this.parent.viewport.leftIndex+h||R!==this.parent.viewport.rightIndex?(this.parent.renderModule.refreshUI({colIndex:this.parent.viewport.leftIndex,refresh:"Column",frozenIndexes:x,rowIndex:w,skipUpdateOnFirst:this.parent.viewport.leftIndex+h===$(a,h,!0,"columns")}),d&&(this.parent.viewport.topIndex=S)):this.parent.notify(Bs,{refresh:"Column",isUpdate:!0}),void this.parent.selectRange(a.selectedRange)}}if(o.length<=this.parent.getThreshold("col")){var F=this.parent.skipHidden(this.parent.viewport.rightIndex+1,this.parent.viewport.rightIndex+o.length,"columns");this.parent.viewport.rightIndex=F[1],this.parent.renderModule.refreshUI({rowIndex:w,colIndex:F[0],direction:"",refresh:"ColumnPart",frozenIndexes:x},""+m([w,F[0],this.parent.viewport.bottomIndex,F[1]]))}else this.parent.renderModule.refreshUI({skipUpdateOnFirst:this.parent.viewport.leftIndex+h===$(a,h,!0,"columns"),rowIndex:w,colIndex:this.parent.viewport.leftIndex,refresh:"Column",frozenIndexes:x}),d&&(this.parent.viewport.topIndex=S)}this.parent.selectRange(a.selectedRange)}else{if(s.length&&this.parent.scrollSettings.enableVirtualization){s.sort(function(e,t){return e-t});var A=s[0]-1<h?h:s[0]-1;return this.parent.updateTopLeftCell(null,$(a,A,!0,"columns")-h,"row"),this.parent.renderModule.refreshSheet(!1,!1,!0),void(e.autoFit&&(e.autoFit=!1))}if(o.length<=this.parent.getThreshold("col")||!this.parent.scrollSettings.enableVirtualization||e.freezePane)this.appendCell(a,o,b(),v,y,e.freezePane),this.parent.scrollSettings.enableVirtualization&&!e.freezePane&&this.parent.notify(ja,{refresh:"Column",prevRowColCnt:{rowCount:a.rowCount,colCount:a.colCount}});else{S=this.parent.viewport.topIndex,w=d?C[0]:S;this.parent.renderModule.refreshUI({skipUpdateOnFirst:this.parent.viewport.leftIndex+h===$(a,h,!0,"columns"),rowIndex:w,colIndex:this.parent.viewport.leftIndex,refresh:"Column",frozenIndexes:d?[d+S,h]:[]}),d&&(this.parent.viewport.topIndex=S),e.autoFit&&(e.autoFit=!1)}this.parent.selectRange(a.selectedRange)}}},e.prototype.removeCell=function(e,r,n,i,a){var o,s,l,h,d,p=this,c=n[0],u=n[1],f=0,g=r.length-1,m=this.parent.frozenRowCount(e),v=i.getElementsByTagName("colgroup")[0],y=this.parent.getViewportIndex(r[0],!0)+1,C=$(e,m-1,!1);for(e.showHeaders&&(l=a.getElementsByTagName("colgroup")[0],o=a.rows[0]);c<=u;)je(e,c)?c++:(s=m&&c<m?a.rows[f+1]:i.rows[f],r.forEach(function(n,i){if(0===f&&c>=m&&(e.showHeaders&&(t.detach(l.children[y]),t.detach(o.cells[y])),t.detach(v.children[y])),t.detach(s.cells[y]),0===i&&(void 0!==(h=Re(c,n,e,!1,!0)).colSpan&&(void 0===h.rowSpan||h.colSpan>1)||h.rowSpan<0&&c-1>-1&&je(e,c-1)&&Math.abs(h.rowSpan)===p.parent.hiddenCount(c+h.rowSpan,c,"rows",e))&&p.parent.notify(ps,{rowIdx:c,colIdx:n,model:"col",start:r[0],end:r[g]}),i===g){d=$(e,n+1,!0,"columns");var a=p.parent.getCellStyleValue(["borderLeft"],[f,d]).borderLeft;""!==a&&p.parent.notify(_r,{onActionUpdate:!1,rowIdx:f,colIdx:d,style:{borderLeft:a},row:s,first:""}),(void 0!==(h=Re(c,n,e)||{}).colSpan&&(void 0===h.rowSpan||h.colSpan>1)||h.rowSpan<0&&c-1>-1&&je(e,c-1)&&Math.abs(h.rowSpan)===p.parent.hiddenCount(c+h.rowSpan,c,"rows",e))&&p.parent.notify(ps,{rowIdx:c,colIdx:n,model:"col",start:r[0],end:r[g],isEnd:!0})}}),m&&c===C?(f=0,c=this.parent.viewport.topIndex+m):(f++,c++));y-1>-1&&e.showHeaders&&o.cells[y-1]&&o.cells[y-1].classList.add("e-hide-start"),e.showHeaders&&o.cells[y]&&o.cells[y].classList.add("e-hide-end")},e.prototype.appendCell=function(e,r,n,i,a,o){var s,l,h,d,p=this,c=n[0],u=n[1],f=0,m=r.length-1,v=this.parent.frozenRowCount(e),y=i.getElementsByTagName("colgroup")[0];e.showHeaders&&(h=a.getElementsByTagName("colgroup")[0],s=a.rows[0]);var C=this.parent.serviceLocator.getService("cell");r.sort(function(e,t){return e-t});for(var b,x,S,w,I=[],E=[],R=$(e,v-1,!1);c<=u;)je(e,c)?c++:(l=v&&c<v?a.rows[f+1]:i.rows[f],r.forEach(function(n,i){if(0===f&&(E[i]=p.parent.getViewportIndex(n,!0),e.showHeaders&&(x=s.cells[E[i]])&&(0===i&&r[i]&&!Qe(e,r[i]-1)&&x.previousSibling&&x.previousElementSibling.classList.remove("e-hide-start"),i===m&&x.classList.remove("e-hide-end")),c>=v&&(y.children[E[i]]?(y.insertBefore(p.parent.sheetModule.updateCol(e,n),y.children[E[i]]),e.showHeaders&&C.renderColHeader(n,s,x)):(y.appendChild(p.parent.sheetModule.updateCol(e,n)),e.showHeaders&&C.renderColHeader(n,s)),o||(t.detach(y.lastChild),e.showHeaders&&t.detach(s.lastChild)),e.showHeaders&&i===m&&(t.detach(h),a.insertBefore(y.cloneNode(!0),a.tHead)))),o||t.detach(l.lastChild),x=l.cells[E[i]],w={rowIdx:c,colIdx:n,cell:Re(c,n,e),row:l,address:g(c,n),lastCell:n===m,isHeightCheckNeeded:!0,first:n!==$(e,0,!0,"columns")&&n===p.parent.viewport.leftIndex?"Column":"",checkNextBorder:i===m?"Column":"",checkCF:!0},x&&(w.refChild=x),b=C.render(w),0===i&&b.previousSibling){""!==p.parent.getCellStyleValue(["borderLeft"],[f,$(e,r[r.length-1]+1,!0,"columns")]).borderLeft&&(d=$(e,r[0]-1,!1,"columns"))>-1&&!p.parent.getCellStyleValue(["borderRight"],[f,d]).borderRight&&!p.parent.getCellStyleValue(["borderLeft"],[f,r[0]]).borderLeft&&(b.previousSibling.style.borderRight="")}if(void 0!==(S=Re(c,n,e)||{}).colSpan&&(void 0===S.rowSpan||S.colSpan>1)||S.rowSpan<0&&c-1>-1&&je(e,c-1)&&Math.abs(S.rowSpan)===p.parent.hiddenCount(c+S.rowSpan,c,"rows",e)){var u={range:[c,n,c,n],isAction:!1,merge:!0,type:"All",skipChecking:!0};p.parent.notify(qn,u),I.length&&u.range[1]===I[I.length-1].range[1]&&u.range[0]===I[I.length-1].range[0]||I.push(u)}}),v&&c===R?(c=this.parent.viewport.topIndex+v,f=0):(c++,f++));I.forEach(function(e){p.parent.notify(_n,e)}),this.parent.viewport.rightIndex=$(e,this.parent.viewport.rightIndex-r.length,!1,"columns")},e.prototype.refreshChart=function(e,t){this.parent.notify(ri,{rIdx:e,showHide:t})},e.prototype.refreshChartCellModel=function(e,t){this.parent.notify(Ms,{prevChartIndexes:e,currentChartIndexes:t})},e.prototype.addEventListener=function(){this.parent.on(Gn,this.hideShow,this),this.parent.on(Ta,this.destroy,this)},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.removeEventListener=function(){this.parent.off(Gn,this.hideShow),this.parent.off(Ta,this.destroy)},e}(),ih=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.addEventListener=function(){this.parent.on(ko,this.initiateHyperlinkHandler,this),this.parent.on(Fo,this.editHyperlinkHandler,this),this.parent.on(Ao,this.openHyperlinkHandler,this),this.parent.on(Ma,this.hyperlinkClickHandler,this),this.parent.on(Oo,this.createHyperlinkEle,this),this.parent.on(Ha,this.keyUpHandler,this),this.parent.on(pi,this.removeHyperlink,this),this.parent.on(No,this.removeHyperlinkHandler,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(ko,this.initiateHyperlinkHandler),this.parent.off(Fo,this.editHyperlinkHandler),this.parent.off(Ao,this.openHyperlinkHandler),this.parent.off(Ma,this.hyperlinkClickHandler),this.parent.off(Oo,this.createHyperlinkEle),this.parent.off(Ha,this.keyUpHandler),this.parent.off(pi,this.removeHyperlink),this.parent.off(No,this.removeHyperlinkHandler))},e.prototype.getModuleName=function(){return"spreadsheetHyperlink"},e.prototype.keyUpHandler=function(e){var r=e.target;if(t.closest(r,".e-document")){var n=document.querySelector(".e-hyp-text"),i=this.parent.element.querySelector(".e-hyperlink-alert-span"),a=(t.closest(r,".e-hyperlink-dlg")||t.closest(r,".e-edithyperlink-dlg")).getElementsByClassName("e-footer-content")[0].firstChild;n&&!t.isNullOrUndefined(n.value)&&(U(n.value.toUpperCase())?i&&(i.remove(),a.removeAttribute("disabled")):(this.showDialog(),a.setAttribute("disabled","true")))}if(r.classList.contains("e-text")&&t.closest(r,".e-cont")&&t.closest(r,".e-webpage")&&t.closest(r,".e-webpage").getElementsByClassName("e-cont")[1]===r.parentElement){a=(t.closest(r,".e-hyperlink-dlg")||t.closest(r,".e-edithyperlink-dlg")).getElementsByClassName("e-footer-content")[0].firstChild;if(""!==r.value)a.removeAttribute("disabled");else{!!t.closest(r,".e-link-dialog").querySelector(".e-webpage").querySelectorAll(".e-cont")[1].querySelector(".e-text").value||a.setAttribute("disabled","true")}}},e.prototype.initiateHyperlinkHandler=function(){var e=this,t=this.parent.getActiveSheet();if(!t.isProtected||t.protectSettings.insertLink&&!Gt(this.parent)){var r=this.parent.serviceLocator.getService(Fl);if(!this.parent.element.querySelector(".e-hyperlink-dlg")){var n,i=this.parent.serviceLocator.getService(Al);i.show({width:323,isModal:!0,showCloseIcon:!0,cssClass:"e-hyperlink-dlg",header:r.getConstant("InsertLink"),beforeOpen:function(t){var r={dialogName:"InsertLinkDialog",element:t.element,target:t.target,cancel:t.cancel};e.parent.trigger("dialogBeforeOpen",r),r.cancel?t.cancel=!0:(i.dialogInstance.content=e.hyperlinkContent(),n=i.dialogInstance.content.querySelector(".e-text").value,i.dialogInstance.dataBind(),Wt(e.parent.element))},open:function(){setTimeout(function(){Wt(i.dialogInstance.element.querySelectorAll(".e-webpage input")[1])})},buttons:[{buttonModel:{content:r.getConstant("Insert"),isPrimary:!0,disabled:!0},click:function(){e.dlgClickHandler(n),i.hide()}}]})}}else this.parent.notify(ss,null)},e.prototype.dlgClickHandler=function(e){var t,r,n=this.parent.getActiveSheet(),i=n.name+"!"+n.selectedRange,a=this.parent.element.querySelector(".e-link-dialog").getElementsByClassName("e-content")[0].querySelector(".e-item.e-active");if(a)if((t=a.getElementsByClassName("e-cont")[0].querySelector(".e-text").value)===e&&(t=null),a.querySelector(".e-webpage")){var o={address:r=a.getElementsByClassName("e-cont")[1].querySelector(".e-text").value};this.parent.insertHyperlink(o,i,t,!1)}else{r=a.getElementsByClassName("e-cont")[1].querySelector(".e-text").value;var s=a.getElementsByClassName("e-cont")[2];if(s.getElementsByClassName("e-list-item")[0].querySelector(".e-active")){o={address:r=a.getElementsByClassName("e-cont")[2].querySelector(".e-active").textContent+"!"+r.toUpperCase()};this.parent.insertHyperlink(o,i,t,!1)}else if(s.querySelector(".e-active"))for(var l=a.getElementsByClassName("e-cont")[2].querySelector(".e-active").textContent,h=0;h<this.parent.definedNames.length;h++)if(this.parent.definedNames[h].name===l){o={address:this.parent.definedNames[h].name};this.parent.insertHyperlink(o,i,t,!1)}}},e.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(Fl),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)},e.prototype.editHyperlinkHandler=function(){var e,t=this,r=this.parent.serviceLocator.getService(Fl),n=this.parent.serviceLocator.getService(Al);n.show({width:323,isModal:!0,showCloseIcon:!0,cssClass:"e-edithyperlink-dlg",header:r.getConstant("EditLink"),beforeOpen:function(r){var i={dialogName:"EditLinkDialog",element:r.element,target:r.target,cancel:r.cancel};t.parent.trigger("dialogBeforeOpen",i),i.cancel&&(r.cancel=!0),n.dialogInstance.content=t.hyperEditContent(),e=n.dialogInstance.content.querySelector(".e-text").value,n.dialogInstance.dataBind(),Wt(t.parent.element)},open:function(){setTimeout(function(){n.dialogInstance.element.querySelector(".e-webpage")?Wt(n.dialogInstance.element.querySelectorAll(".e-webpage input")[1]):Wt(n.dialogInstance.element.querySelectorAll(".e-document input")[1])})},buttons:[{buttonModel:{content:r.getConstant("Update"),isPrimary:!0},click:function(){t.dlgClickHandler(e),n.hide()}}]})},e.prototype.openHyperlinkHandler=function(){var e=u(this.parent.getActiveSheet().activeCell),t=this.parent.getCell(e[0],e[1]);t.getElementsByClassName("e-hyperlink")[0]&&(t=t.querySelector(".e-hyperlink")),this.hlOpenHandler(t)},e.prototype.hlOpenHandler=function(e,r){var n=this;if(e.classList.contains("e-hyperlink")){var i=t.closest(e,".e-cell");if(!i)return;var a=["",""],o=void 0,s=!0,l=this.parent.getActiveSheet(),h=parseInt(i.getAttribute("aria-colindex"),10)-1,d=parseInt(i.parentElement.getAttribute("aria-rowindex"),10)-1,p=Re(d,h,l,!1,!0);p.style&&"#00e"===p.style.color&&(J(this.parent,l,{rowIdx:d,colIdx:h,preventEvt:!0,cell:{style:{color:"#551a8b"}}}),i.style.color="#551a8b");var u=p.hyperlink,f=void 0,g={hyperlink:u,address:l.activeCell,target:"_blank",cancel:!1};if(this.parent.trigger(un,g),g.cancel)return;var v={hyperlink:u=g.hyperlink,address:l.activeCell};"string"==typeof u&&(f=u),"object"==typeof u&&(f=u.address);var y=f;if(-1===f.indexOf("http://")&&-1===f.indexOf("https://")&&-1===f.indexOf("ftp://")){if(!t.isNullOrUndefined(f)){if(this.parent.definedNames)for(var C=0;C<this.parent.definedNames.length;C++)if(this.parent.definedNames[C].name===f){f=(f=this.parent.definedNames[C].refersTo).slice(1);break}-1!==f.indexOf("!")?-1!==(a=f.split("!"))[0].indexOf(" ")&&(a[0]=a[0].slice(1,a[0].length-1)):(a[0]=this.parent.getActiveSheet().name,a[1]=f);var b;for(C=0;C<this.parent.sheets.length;C++)this.parent.sheets[C].name===a[0]&&(b=C);if(l=this.parent.sheets[b],-1!==a[1].indexOf(":")){var x=a[1].indexOf(":"),S=a[1].substr(0,x),w=a[1].substr(x+1,a[1].length);S=S.replace("$",""),(w=w.replace("$","")).match(/\D/g)&&!w.match(/[0-9]/g)&&S.match(/\D/g)&&!S.match(/[0-9]/g)?(S+="1",w+=l.rowCount,a[1]=S+":"+w):!w.match(/\D/g)&&w.match(/[0-9]/g)&&!S.match(/\D/g)&&S.match(/[0-9]/g)&&(o=[parseInt(S,10)-1,0,parseInt(w,10)-1,l.colCount-1],s=!1)}var I=void 0,E=this.parent.definedNames;if(!t.isNullOrUndefined(E))for(C=0;C<E.length;C++)if(E[C].name===y){I=!0;break}if(U(a[1])||I){if(o=s?c(a[1]):o,this.parent.scrollSettings.enableVirtualization&&(o[0]=o[0]>=this.parent.viewport.topIndex?o[0]-this.parent.viewport.topIndex:o[0],o[1]=o[1]>=this.parent.viewport.leftIndex?o[1]-this.parent.viewport.leftIndex:o[1]),!t.isNullOrUndefined(l)){var R=m(o);if(l===this.parent.getActiveSheet())tt(function(){n.parent.goTo(R)});else{if(R.indexOf(":")>=0){var k=R.split(":");R=k[0]===k[1]?k[0]:R}tt(function(){n.parent.goTo(n.parent.sheets[b].name+"!"+R)})}}}else this.showInvalidHyperlinkDialog()}}else r||(this.isValidUrl(f)?window.open(f,g.target):this.showInvalidHyperlinkDialog());this.parent.trigger(fn,v)}},e.prototype.isValidUrl=function(e){return/(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/.test(e)},e.prototype.showInvalidHyperlinkDialog=function(){var e=this.parent.serviceLocator.getService(Al),t=this.parent.serviceLocator.getService(Fl);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)},e.prototype.hyperlinkClickHandler=function(e){var r=e.target;if(t.closest(r,".e-link-dialog")&&t.closest(r,".e-toolbar-item")){var n=(p=t.closest(r,".e-hyperlink-dlg")||t.closest(r,".e-edithyperlink-dlg")).getElementsByClassName("e-footer-content")[0].firstChild,i=p.querySelector(".e-document"),a=p.querySelector(".e-webpage"),o=a?a.querySelectorAll(".e-cont")[0].querySelector(".e-text").value:i.querySelectorAll(".e-cont")[0].querySelector(".e-text").value,s=i?i.querySelectorAll(".e-cont")[0].querySelector(".e-text").value:o;if(t.closest(r,".e-toolbar-items").getElementsByClassName("e-toolbar-item")[1].classList.contains("e-active")){var l=i.querySelectorAll(".e-cont")[2].querySelector(".e-active");i.querySelectorAll(".e-cont")[0].querySelector(".e-text").value=o,t.closest(l,".e-list-item").classList.contains("e-level-2")&&n.hasAttribute("disabled")?n.removeAttribute("disabled"):t.closest(l,".e-list-item").classList.contains("e-level-1")&&!n.hasAttribute("disabled")&&n.setAttribute("disabled","true")}else{var h=!a.querySelectorAll(".e-cont")[1].querySelector(".e-text").value;a.querySelectorAll(".e-cont")[0].querySelector(".e-text").value=s,h&&!n.hasAttribute("disabled")?n.setAttribute("disabled","true"):!h&&n.hasAttribute("disabled")&&n.removeAttribute("disabled")}}if(t.closest(r,".e-list-item")&&r.classList.contains("e-fullrow")){var d=this.parent.element.getElementsByClassName("e-link-dialog")[0];if(!d)return;var p,c=(d=d.getElementsByClassName("e-content")[0].getElementsByClassName("e-active")[0]).getElementsByClassName("e-cont")[1].getElementsByClassName("e-text")[0];n=(p=t.closest(r,".e-hyperlink-dlg")||t.closest(r,".e-edithyperlink-dlg")).getElementsByClassName("e-footer-content")[0].firstChild;t.closest(r,".e-list-item").classList.contains("e-level-2")?"defName"===t.closest(r,".e-list-item").getAttribute("data-uid")?(c.classList.contains("e-disabled")||c.hasAttribute("readonly")||(c.setAttribute("readonly","true"),c.classList.add("e-disabled"),c.setAttribute("disabled","true")),n.hasAttribute("disabled")&&n.removeAttribute("disabled")):"sheet"===t.closest(r,".e-list-item").getAttribute("data-uid")&&(c.classList.contains("e-disabled")&&c.hasAttribute("readonly")&&(c.removeAttribute("readonly"),c.classList.remove("e-disabled"),c.removeAttribute("disabled")),U(c.value.toUpperCase())&&n.hasAttribute("disabled")&&n.removeAttribute("disabled")):t.closest(r,".e-list-item").classList.contains("e-level-1")&&n.setAttribute("disabled","true")}else this.hlOpenHandler(r,!0)},e.prototype.createHyperlinkEle=function(e){var r=e.cell;if(!t.isNullOrUndefined(r.hyperlink)){var n=e.td,i=this.parent.createElement("a",{className:"e-hyperlink e-hyperlink-style"}),a=void 0;if("string"==typeof r.hyperlink?(0===r.hyperlink.toLowerCase().indexOf("www.")&&(r.hyperlink="http://"+r.hyperlink),a=r.hyperlink):0===(a=r.hyperlink.address).toLowerCase().indexOf("www.")&&(r.hyperlink.address=a="http://"+a),0===a.indexOf("http://")||0===a.indexOf("https://")||0===a.indexOf("ftp://")?(i.setAttribute("href",a),i.setAttribute("target","_blank")):(a.includes("=")||a.includes("!"))&&i.setAttribute("ref",a),"Accounting"===Ve(r.format)?i.innerHTML=n.innerHTML:i.innerText=""!==n.innerText?n.innerText:a,n.textContent="",n.innerText="",n.appendChild(i),!e.style.color||!e.style.textDecoration){var o={};e.style.color||(e.style.color=o.color="#00e"),e.style.textDecoration||(e.style.textDecoration=o.textDecoration="underline"),J(this.parent,this.parent.getActiveSheet(),{rowIdx:e.rowIdx,colIdx:e.colIdx,preventEvt:!0,cell:{style:o}})}}},e.prototype.hyperEditContent=function(){var e=!0,t=this.hyperlinkContent(),r=c(this.parent.getActiveSheet().activeCell),n=this.parent.sheets[this.parent.getActiveSheet().id-1].rows[r[0]].cells[r[1]];this.parent.scrollSettings.enableVirtualization&&(r[0]=r[0]-this.parent.viewport.topIndex,r[1]=r[1]-this.parent.viewport.leftIndex);var i,a=this.parent.getDisplayText(n),o=n.hyperlink;"string"==typeof o?(i=o,a=a||i,-1===i.indexOf("http://")&&-1===i.indexOf("https://")&&-1===i.indexOf("ftp://")&&(e=!1)):"object"==typeof o&&(i=o.address,a=a||i,-1===i.indexOf("http://")&&-1===i.indexOf("https://")&&-1===i.indexOf("ftp://")&&(e=!1));for(var s=0,l=0,h=this.parent.definedNames,d=this.parent.sheets,p=0,u=h.length;p<u;p++)h[p].name===i&&s++;for(p=0,u=d.length;p<u;p++)i.includes(d[p].name)&&l++;0===s&&0===l&&(e=!0);var f=t.querySelector(".e-content");if(e){var g=f.querySelector(".e-webpage");if(g.getElementsByClassName("e-cont")[0].getElementsByClassName("e-text")[0].setAttribute("value",a),"string"==typeof o)g.getElementsByClassName("e-cont")[1].querySelector(".e-text").setAttribute("value",o);else{g.getElementsByClassName("e-cont")[1].querySelector(".e-text").setAttribute("value",o.address)}}else{var m=void 0,v=f.querySelector(".e-document");v.getElementsByClassName("e-cont")[0].getElementsByClassName("e-text")[0].setAttribute("value",a);var y=void 0;if(this.parent.definedNames)for(p=0;p<this.parent.definedNames.length;p++)if(this.parent.definedNames[p].name===i){m=!0;break}if(m){var C=v.getElementsByClassName("e-cont")[1].getElementsByClassName("e-text")[0];C.setAttribute("readonly","true"),C.classList.add("e-disabled"),C.setAttribute("disabled","true");var b=v.getElementsByClassName("e-cont")[2].querySelectorAll(".e-list-item.e-level-1")[1];for(p=0;p<b.getElementsByTagName("li").length;p++)b.getElementsByTagName("li")[p].innerText===i&&b.getElementsByTagName("li")[p].classList.add("e-active")}else{i&&-1!==i.indexOf("!")&&(y=i.split("!"));var x=y[0];v.getElementsByClassName("e-cont")[1].querySelector(".e-text").setAttribute("value",y[1]);for(b=v.getElementsByClassName("e-cont")[2].querySelectorAll(".e-list-item.e-level-1")[0],p=0;p<b.getElementsByTagName("li").length;p++)if(b.getElementsByTagName("li")[p].innerText===x){if(b.getElementsByTagName("li")[p].classList.contains("e-active"))break;b.getElementsByTagName("li")[p].classList.add("e-active")}else b.getElementsByTagName("li")[p].classList.contains("e-active")&&b.getElementsByTagName("li")[p].classList.remove("e-active")}}return t},e.prototype.hyperlinkContent=function(){var e,r,n=this.parent.serviceLocator.getService(Fl),a=0,o=0,s=!0,l=!0,h=c(this.parent.getActiveSheet().activeCell),d=this.parent.getActiveSheet(),p=Re(h[0],h[1],d),u=!0;if(p){u=!!(p.value&&"string"==typeof p.value&&null!==p.value.match("[A-Za-z]+")||""===p.value||t.isNullOrUndefined(p.value));var f=p.hyperlink;if("string"==typeof f){-1===(g=f).indexOf("http://")&&-1===g.indexOf("https://")&&-1===g.indexOf("ftp://")&&(r=f,s=!1)}else if("object"==typeof f){var g;-1===(g=f.address).indexOf("http://")&&-1===g.indexOf("https://")&&-1===g.indexOf("ftp://")&&(r=f.address,s=!1)}if(r){for(var m=0,v=0,y=this.parent.definedNames,C=this.parent.sheets,b=0,x=C.length;b<x;b++)r.includes(C[b].name)&&v++;var S=0;for(x=y.length;S<x;S++)y[S].name===r&&m++;0===m&&0===v&&(s=!0)}if(o=s?0:1,this.parent.definedNames)for(var w=0;w<this.parent.definedNames.length;w++)if(this.parent.definedNames[w].name===r){e=!0,l=!1;break}}var I=this.parent.createElement("div",{className:"e-link-dialog"}),E=this.parent.createElement("div",{className:"e-webpage"}),R=this.parent.createElement("div",{className:"e-document"});new i.Tab({selectedItem:o,items:[{header:{text:n.getConstant("WebPage")},content:E},{header:{text:n.getConstant("ThisDocument")},content:R}]}).appendTo(I),s?I.querySelector(".e-toolbar-items").querySelector(".e-indicator").setAttribute("style","left: 0; right: 136px"):I.querySelector(".e-toolbar-items").querySelector(".e-indicator").setAttribute("style","left: 136px; right: 0");var k=this.parent.createElement("div",{className:"e-cont"}),F=this.parent.createElement("div",{className:"e-cont"}),A=this.parent.createElement("div",{className:"e-header"});A.innerText=n.getConstant("DisplayText");var N=this.parent.createElement("div",{className:"e-header"});N.innerText=n.getConstant("Url");var O=this.parent.createElement("input",{className:"e-input e-text",attrs:{type:"Text"}});u||(O.classList.add("e-disabled"),O.setAttribute("readonly","true"),O.setAttribute("disabled","true")),p&&t.isNullOrUndefined(p.hyperlink)&&O.setAttribute("value",this.parent.getDisplayText(p));var T=this.parent.createElement("input",{className:"e-input e-text",attrs:{type:"Text"}});O.setAttribute("placeholder",n.getConstant("EnterTheTextToDisplay")),T.setAttribute("placeholder",n.getConstant("EnterTheUrl")),k.appendChild(O),k.insertBefore(A,O),F.appendChild(T),F.insertBefore(N,T),E.appendChild(F),E.insertBefore(k,F);for(var D=[],L=[],P=this.parent.sheets;a<this.parent.sheets.length;a++){var M=this.parent.sheets[a].name;"Visible"===this.parent.sheets[a].state&&(P[a]===this.parent.getActiveSheet()?D.push({nodeId:"sheet",nodeText:-1!==M.indexOf(" ")?"'"+M+"'":M,selected:!0}):D.push({nodeId:"sheet",nodeText:-1!==M.indexOf(" ")?"'"+M+"'":M}))}for(a=0;a<this.parent.definedNames.length;a++)L.push({nodeId:"defName",nodeText:this.parent.definedNames[a].name});var H=[{nodeId:"01",nodeText:n.getConstant("CellReference"),expanded:l,nodeChild:D},{nodeId:"02",nodeText:n.getConstant("DefinedNames"),expanded:e,nodeChild:L}],B=new i.TreeView({fields:{dataSource:H,id:"nodeId",text:"nodeText",child:"nodeChild"}}),U=this.parent.createElement("div",{className:"e-cont"}),V=this.parent.createElement("div",{className:"e-header"});V.innerText=n.getConstant("CellReference");var _=this.parent.createElement("input",{className:"e-input e-text e-hyp-text",attrs:{type:"Text"}});_.setAttribute("value","A1"),U.appendChild(_),U.insertBefore(V,_);var z=this.parent.createElement("div",{className:"e-cont"}),j=this.parent.createElement("div",{className:"e-header"});j.innerText=n.getConstant("DisplayText");var q=this.parent.createElement("input",{className:"e-input e-text",attrs:{type:"Text"}});u||(q.classList.add("e-disabled"),q.setAttribute("readonly","true"),q.setAttribute("disabled","true")),p&&t.isNullOrUndefined(p.hyperlink)&&q.setAttribute("value",this.parent.getDisplayText(p)),q.setAttribute("placeholder",n.getConstant("EnterTheTextToDisplay")),z.appendChild(q),z.insertBefore(j,q);var W=this.parent.createElement("div",{className:"e-cont"}),G=this.parent.createElement("div",{className:"e-header"});G.innerText=n.getConstant("Sheet");var Y=this.parent.createElement("div",{className:"e-refcont"});return W.appendChild(Y),W.insertBefore(G,Y),R.appendChild(U),R.insertBefore(z,U),B.appendTo(Y),R.appendChild(W),I},e.prototype.removeHyperlink=function(e){var t=Re(e.rowIdx,e.colIdx,e.sheet);t&&t.hyperlink&&("string"==typeof t.hyperlink?t.value=t.value?t.value:t.hyperlink:t.value=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(ti,null),e.preventRefresh||this.parent.serviceLocator.getService("cell").refresh(e.rowIdx,e.colIdx,!1,null,!0,!1,Kt(this.parent))))},e.prototype.removeHyperlinkHandler=function(e){var t,r,n=e.range,i=this.parent.getActiveSheet();if(!e.preventEventTrigger){var a={address:-1===n.indexOf("!")?i.name+"!"+n:n,cancel:!1};if(this.parent.notify(Ar,{action:"removeHyperlink",eventArgs:a}),a.cancel)return}if(n&&-1!==n.indexOf("!")){t=n.split("!");for(var o=this.parent.sheets,s=0;s<o.length;s++)o[s].name===t[0]&&(r=s);i=this.parent.sheets[r],n=t[1]}for(var l,h,d=c(n||i.activeCell),p=d[0];p<=d[2];p++)for(var u=d[1];u<=d[3];u++)if(i&&i.rows[p]&&i.rows[p].cells[u]){if(h=[],l=this.parent.getCell(p,u))for(var f=0;f<l.classList.length;f++)h.push(l.classList[f]);this.parent.notify(pi,{sheet:i,rowIdx:p,colIdx:u});for(f=0;f<h.length;f++)l.classList.contains(h[f])||l.classList.add(h[f])}e.preventEventTrigger||this.parent.notify(Yo,{action:"removeHyperlink",eventArgs:{address:-1===n.indexOf("!")?i.name+"!"+n:n}})},e}(),ah=function(){return(ah=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e}).apply(this,arguments)},oh=function(){function e(e){this.undoCollection=[],this.redoCollection=[],this.isUndo=!1,this.undoRedoStep=100,this.parent=e,this.addEventListener()}return e.prototype.setActionData=function(e){var t,r=this.parent.getActiveSheet(),n=[],i=[],a=e.args,o=a.eventArgs,s={};switch(a.action){case"format":t=c(a.eventArgs.range);break;case"clipboard":s=o.copiedInfo,t=c(C(o.pastedRange)),s&&s.isCut&&(i=this.getCellDetails(s.range,Ce(this.parent,ue(this.parent,s.sId)),"clipboard"));break;case"beforeSort":(t=c(a.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":t=c(o.address);break;case"beforeWrap":case"beforeReplace":case"chartDesign":t=this.parent.getAddressInfo(o.address).indices;break;case"beforeClear":case"beforeInsertImage":t=c(o.range);break;case"deleteImage":t=c(o.address);break;case"beforeInsertChart":case"filter":t=c(o.range);break;case"autofill":t=c(o.fillRange);break;case"removeValidation":if(o.isColSelected){this.beforeActionData={cellDetails:[]};for(var l=o.range.split("!")[1].split(":"),h=f(l[0]),d=f(l[1]);h<=d;h++)r.columns[h]&&r.columns[h].validation&&this.beforeActionData.cellDetails.push({colIndex:h,validation:r.columns[h].validation})}else t=c(o.range);break;case"hyperlink":case"removeHyperlink":t=c(o.address)}"beforeSort"===a.action?(this.beforeActionData={cellDetails:o.cellDetails},this.beforeActionData.sortedCellDetails=o.sortedCellDetails):t&&(n=this.getCellDetails(t,r,a.action),this.beforeActionData={cellDetails:n,cutCellDetails:i})},e.prototype.getBeforeActionData=function(e){e.beforeDetails=this.beforeActionData},e.prototype.performUndoRedo=function(e){var r;e.isFromUpdateAction?r=e:(r=e.isUndo?this.undoCollection.pop():this.redoCollection.pop(),e.setCollection&&(e.undoArgs=r)),this.isUndo=e.isUndo;var n;if(r){var i=void 0,a={};if(!e.isPublic){var o=r.eventArgs.beforeActionData;if(delete r.eventArgs.beforeActionData,i={action:r.action,eventArgs:{}},t.extend(i.eventArgs,r.eventArgs,null,!0),r.eventArgs.beforeActionData=o,i.eventArgs.cancel=!1,r.preventAction=i.preventAction=!0,e.isUndo?i.isUndo=!0:i.isRedo=!0,e.isFromUpdateAction||this.parent.notify(Ar,i),i.eventArgs.cancel)return void this.updateUndoRedoIcons();delete i.eventArgs.cancel}switch(r.action){case"cellSave":case"format":case"wrap":case"cellDelete":case"autofill":case"removeValidation":case"hyperlink":case"removeHyperlink":r=this.performOperation(r,e.preventEvt,e.preventReSelect,e.isPublic);break;case"sorting":this.undoForSorting(r,e.isUndo);break;case"clipboard":r=this.undoForClipboard(r,e.isUndo,i),n=!0;break;case"resize":case"resizeToFit":r=this.undoForResize(r);break;case"hideShow":Dt(r,this.parent,!e.isUndo);break;case"replace":r=this.performOperation(r);break;case"replaceAll":r.eventArgs.isAction=!1,e.isUndo&&(a.value=r.eventArgs.replaceValue,a.replaceValue=r.eventArgs.value,a.skipFormatCheck=Kt(this.parent)),this.parent.notify(An,ah({},r.eventArgs,a));break;case"insert":case"filter":Dt(r,this.parent,!e.isUndo,null,i),n="filter"===r.action;break;case"delete":Dt(r,this.parent,!e.isUndo);break;case"validation":case"addHighlight":case"removeHighlight":Dt(r,this.parent,!e.isUndo);break;case"merge":r.eventArgs.merge=r.isFromUpdateAction?r.eventArgs.merge:!r.eventArgs.merge,Dt(r,this.parent,!1);break;case"clear":r=this.performOperation(r),e.isUndo&&r.eventArgs.cfClearActionArgs&&Dt({action:"clearCF",eventArgs:r.eventArgs.cfClearActionArgs},this.parent,!e.isUndo);break;case"conditionalFormat":Dt(r,this.parent,!e.isUndo,this.undoCollection);break;case"clearCF":Dt(r,this.parent,!e.isUndo);break;case"insertImage":case"deleteImage":case"imageRefresh":Dt(r,this.parent,!e.isUndo);break;case"insertChart":case"deleteChart":case"chartRefresh":Dt(r,this.parent,!e.isUndo);break;case"chartDesign":r.eventArgs.isUndo=e.isUndo,this.parent.notify(Ys,r.eventArgs);break;case"addDefinedName":Dt(r,this.parent,!e.isUndo)}e.isFromUpdateAction||(e.isUndo?this.redoCollection.push(r):this.undoCollection.push(r),this.undoCollection.length>this.undoRedoStep&&this.undoCollection.splice(0,1),this.redoCollection.length>this.undoRedoStep&&this.redoCollection.splice(0,1),this.updateUndoRedoIcons(),e.isPublic||n||this.parent.notify(Yo,t.extend({isUndoRedo:!0,isUndo:e.isUndo},r))),this.parent.notify(ti,null)}},e.prototype.undoForSorting=function(e,r){var n=this,i=S(this.parent,e.eventArgs.range),a=c(e.eventArgs.range),o=function(e,r){if(i===n.parent.activeSheetIndex){var o=n.parent.getCell(a[0]-1,n.parent.sortCollection[e].columnIndex);o&&(o=t.select(".e-filter-icon",o))&&(r?o.classList.add("e-sort"+("Ascending"===n.parent.sortCollection[e].order?"asc":"desc")+"-filter"):o.classList.remove("e-sort"+("Ascending"===n.parent.sortCollection[e].order?"asc":"desc")+"-filter"))}};if(r){if(this.parent.notify(hn,{result:e.eventArgs.beforeActionData.cellDetails,range:a,sheet:Ce(this.parent,i),jsonData:e.eventArgs.beforeActionData.sortedCellDetails,isUndo:!0}),this.parent.notify(dn,{range:e.eventArgs.range}),this.parent.sortCollection&&e.eventArgs.previousSort)for(var s=this.parent.sortCollection.length-1;s>=0;s--)if(this.parent.sortCollection[s].sheetIndex===i){o(s,!1),this.parent.sortCollection.splice(s,1);var l=e.eventArgs.previousSort;if(Array.isArray(l))for(var h=0;h<l.length;h++)this.parent.sortCollection.splice(h,0,l[h]),o(h,!0);this.parent.sortCollection.length||(this.parent.sortCollection=void 0);break}}else if(Dt(e,this.parent,!0),e.eventArgs.previousSort){var d=0;if(this.parent.sortCollection)for(s=this.parent.sortCollection.length-1;s>=0;s--)this.parent.sortCollection[s].sheetIndex===i&&(o(s,!1),d=s,this.parent.sortCollection.splice(s,1));else this.parent.sortCollection=[];this.parent.sortCollection.splice(d,0,{sortRange:e.eventArgs.range.split("!")[1],sheetIndex:i,columnIndex:f(e.eventArgs.sortOptions.sortDescriptors.field),order:e.eventArgs.sortOptions.sortDescriptors.order}),o(d,!0)}},e.prototype.updateUndoRedoCollection=function(e){var t=["clipboard","format","sorting","cellSave","resize","resizeToFit","wrap","hideShow","replace","validation","merge","clear","conditionalFormat","clearCF","insertImage","imageRefresh","insertChart","deleteChart","chartRefresh","filter","cellDelete","autofill","addDefinedName","removeValidation","removeHighlight","addHighlight","hyperlink","removeHyperlink","deleteImage","chartDesign","replaceAll"];"insert"!==e.args.action&&"delete"!==e.args.action||"Sheet"===e.args.eventArgs.modelType||t.push(e.args.action);var r=e.args.action;if(-1!==t.indexOf(r)||e.isPublic){var n=e.args.eventArgs;if("clipboard"===r||"sorting"===r||"format"===r||"cellSave"===r||"wrap"===r||"replace"===r||"validation"===r||"clear"===r||"conditionalFormat"===r||"clearCF"===r||"insertImage"===r||"imageRefresh"===r||"insertChart"===r||"chartRefresh"===r||"filter"===r||"cellDelete"===r||"autofill"===r||"removeValidation"===r||"addDefinedName"===r||"hyperlink"===r||"removeHyperlink"===r||"deleteImage"===r||"chartDesign"===r){var i={beforeDetails:{cellDetails:[]}};this.parent.notify(Ho,i),n.beforeActionData=i.beforeDetails}if("clipboard"===r&&n.copiedInfo&&n.copiedInfo.isExternal){var a=this.parent.getAddressInfo(n.pastedRange);n.copiedInfo.cellDetails=this.getCellDetails(a.indices,Ce(this.parent,a.sheetIndex),r)}this.undoCollection.push(e.args),this.redoCollection=[],this.undoCollection.length>this.undoRedoStep&&this.undoCollection.splice(0,1),this.updateUndoRedoIcons()}},e.prototype.clearUndoRedoCollection=function(){this.undoCollection=[],this.redoCollection=[],this.updateUndoRedoIcons()},e.prototype.updateUndoRedoIcons=function(){var e=this.parent.serviceLocator.getService(Fl);this.parent.notify(Za,[{tab:e.getConstant("Home"),items:[this.parent.element.id+"_undo"],enable:this.undoCollection.length>0}]),this.parent.notify(Za,[{tab:e.getConstant("Home"),items:[this.parent.element.id+"_redo"],enable:this.redoCollection.length>0}])},e.prototype.undoForClipboard=function(e,t,r){var n,i=this,a=e.eventArgs,o=a.pastedRange.split("!"),s=c(o[1]),l=ce(this.parent,o[0]),h=Ce(this.parent,l),d=a.copiedInfo,p=a.beforeActionData,u=e.isFromUpdateAction,f=l===this.parent.activeSheetIndex;if(r&&(r.isUndoRedo=!0,r.eventArgs.beforeActionData=p),"imagePaste"===e.eventArgs.requestType){var g=a.copiedShapeInfo;t?(n=g.pictureElem,g.isCut?(this.parent.notify(Ds,{id:n.id,sheetIdx:a.pasteSheetIndex+1}),this.parent.notify(Ts,{options:{src:n.style.backgroundImage.replace(/url\((['"])?(.*?)\1\)/gi,"$2"),height:g.height,width:g.width,imageId:n.id},range:g.copiedRange,isPublic:!1,isUndoRedo:!0})):this.parent.notify(Ds,{id:a.pastedPictureElement.id,sheetIdx:a.pasteSheetIndex+1})):g.isCut?(n=g.pictureElem,this.parent.notify(Ds,{id:n.id,sheetIdx:g.sId}),this.parent.notify(Ts,{options:{src:n.style.backgroundImage.replace(/url\((['"])?(.*?)\1\)/gi,"$2"),height:g.height,width:g.width,imageId:n.id},range:g.pastedRange,isPublic:!1,isUndoRedo:!0})):(n=a.pastedPictureElement,this.parent.notify(Ts,{options:{src:n.style.backgroundImage.replace(/url\((['"])?(.*?)\1\)/gi,"$2"),height:n.offsetHeight,width:n.offsetWidth,imageId:n.id},range:g.pastedRange,isPublic:!1,isUndoRedo:!0}))}else{if(t){if(d.isCut){var m=p.cutCellDetails;this.updateCellDetails(m,Ce(this.parent,ue(this.parent,d.sId)),w(d.range),f,e),a.cfClearActionArgs&&Dt({action:"clearCF",eventArgs:a.cfClearActionArgs},this.parent,!1)}p&&this.updateCellDetails(p.cellDetails,h,s,f,e,null,null,r?r.isUndoRedo:null),a.cfActionArgs&&a.cfActionArgs.cfModel.forEach(function(e){Dt({eventArgs:{range:e.range,type:e.type,cFColor:e.cFColor,value:e.value,sheetIdx:a.cfActionArgs.sheetIdx,cancel:!0},action:"conditionalFormat"},i.parent,!1)}),jt(h,s[0],s[1],We(h,s[0]));var v=qt(h,s[0]);Pt(this.parent,h,v,s[0]),a.mergeCollection.forEach(function(e){e.merge=!e.merge,i.parent.notify(_n,e),e.merge=!e.merge}),r&&!u&&this.parent.notify(Yo,r)}else if(d.isExternal){var C=this.parent.getAddressInfo(a.pastedRange);this.updateCellDetails(d.cellDetails,Ce(this.parent,C.sheetIndex),C.indices,!0,e,null,null,r?r.isUndoRedo:null),r&&!u&&this.parent.notify(Yo,r)}else{var b=new Promise(function(e){e(void 0)});C=this.parent.getAddressInfo(a.copiedRange);this.parent.notify(a.copiedInfo.isCut?to:ro,{range:C.indices,sId:Ce(this.parent,C.sheetIndex).id,promise:b,invokeCopy:!0,isPublic:!0,isFromUpdateAction:u}),b.then(function(){i.parent.notify(no,{range:o?y(a.pastedRange):o,sIdx:o?ce(i.parent,fe(a.pastedRange)):o,type:a.type,isAction:!1,isInternal:!0,isFromUpdateAction:u}),r&&!u&&i.parent.notify(Yo,r)})}f&&!u?(this.parent.notify(Ja,{address:a.selectedRange}),this.parent.notify(il,{})):this.checkRefreshNeeded(l,u)}return e},e.prototype.undoForResize=function(e){var t=e.eventArgs;if(void 0===t.hide)if(t.isCol){var r=t.oldWidth;t.oldWidth=t.width,t.width=r}else{r=t.oldHeight;t.oldHeight=t.height,t.height=r}else t.hide=!t.hide;Dt(e,this.parent,!1);var n=this.parent.getActiveSheet(),i=c(n.activeCell),a=Re(i[0],i[1],n);if(a&&a.rowSpan){var o=this.parent.getCell(i[0],i[1]);this.parent.element.querySelector(".e-active-cell").style.height=o.offsetHeight+"px"}else if(a&&a.colSpan){o=this.parent.getCell(i[0],i[1]);this.parent.element.querySelector(".e-active-cell").style.width=o.offsetWidth+"px"}return e},e.prototype.performOperation=function(e,r,n,i){var a=e.eventArgs,o=[];o="autofill"===e.action?a.fillRange.split("!"):"cellSave"===e.action||"wrap"===e.action||"replace"===e.action||"cellDelete"===e.action||"hyperlink"===e.action||"removeHyperlink"===e.action?a.address.split("!"):a.range.split("!");var s,l=ce(this.parent,o[0]),h=Ce(this.parent,l);if(a.isColSelected){var d=o[1].split(":");s=[0,f(d[0]),h.rowCount-1,f(d[1])]}else s=w(c(o[1]));var p=s,u=a.beforeActionData,v=e.isFromUpdateAction,y=this.checkRefreshNeeded(l,v),C={cellIdx:[s[0],s[1]],isUnique:!1,uniqueRange:""};if(a.isColSelected||this.parent.notify(nn,C),this.isUndo){if(C.isUnique&&a.formula&&a.formula.indexOf("UNIQUE")>-1){if("#SPILL!"!==Re((S=c(C.uniqueRange))[0],S[1],this.parent.getActiveSheet()).value)for(var b=S[0];b<=S[2];b++)for(var x=S[1];x<=S[3];x++)b===S[0]&&x===S[1]&&(x+=1),this.parent.updateCell({value:""},m([b,x]))}if(this.updateCellDetails(u.cellDetails,h,s,y,e,r,a.isColSelected),C.isUnique&&"cellDelete"===e.action&&a.isSpill){for(var S,I=Re((S=c(C.uniqueRange))[0],S[1],this.parent.getActiveSheet()),E=S[0];E<=S[2];E++)for(b=S[1];b<=S[3];b++)for(x=s[0];x<=s[2];x++)for(var R=s[1];R<=s[3];R++)E===x&&b===R||this.parent.updateCell({value:""},g(E,b));I.value="#SPILL!",this.parent.updateCell(I,g(S[0],S[1]))}if(!a.isSpill&&""!==C.uniqueRange){var k=c(C.uniqueRange);for(b=k[0];b<=k[2];b++)for(x=k[1];x<=k[3];x++)b===k[0]&&x===k[1]&&(x+=1),this.parent.updateCell({value:""},m([b,x]));this.parent.notify(an,null)}}else{var F=e.eventArgs,A=c(h.activeCell),N=this.parent.getCellStyleValue(["textDecoration"],A).textDecoration;if(F&&F.style&&F.style.textDecoration){var O=F.style.textDecoration,T=O,D=void 0,L=!1;"underline"===N?T="underline"===O?"none":"underline line-through":"line-through"===N?T="line-through"===O?"none":"underline line-through":"underline line-through"===N&&(T="underline"===O?"line-through":"underline",L=!0),"none"===T&&(L=!0),F.style.textDecoration=T,e.eventArgs=F;for(E=p[0];E<=p[2];E++)for(b=p[1];b<=p[3];b++){if(D={},"none"===(N=this.parent.getCellStyleValue(["textDecoration"],[E,b]).textDecoration)){if(L)continue;D.textDecoration=O}else if("underline"===N||"line-through"===N)if(L){if(O!==N)continue;D.textDecoration="none"}else D.textDecoration=O!==N?"underline line-through":O;else if("underline line-through"===N){if(!L)continue;D.textDecoration="underline"===O?"line-through":"underline"}this.parent.notify(Br,{style:{textDecoration:D.textDecoration},range:[E,b,E,b],refreshRibbon:!0,onActionUpdate:!0})}F.style.textDecoration=O,e.eventArgs=F}else{if(!t.isNullOrUndefined(a.oldValue)&&a.oldValue!==a.value&&C.isUnique){var P=c(C.uniqueRange);if("#SPILL!"!==Re(P[0],P[1],this.parent.getActiveSheet()).value)for(b=P[0];b<=P[2];b++)for(x=P[1];x<=P[3];x++)b===P[0]&&x===P[1]&&(this.parent.updateCell({value:"#SPILL!"},m([P[0],P[1]])),x+=1),this.parent.updateCell({value:""},m([b,x]))}if(Dt(e,this.parent,!0),C.isUnique&&"cellDelete"===e.action&&a.isSpill){var M=c(C.uniqueRange),H=!1;for(E=M[0];E<=M[1];E++)for(b=M[1];b<=M[3];b++)E===M[0]&&b===M[1]&&b++,Re(E,b,h)&&!t.isNullOrUndefined(Re(E,b,h).value)&&""!==Re(E,b,h).value&&(H=!0);if(!H){(I=Re(M[0],M[1],this.parent.getActiveSheet())).value="",this.parent.updateCell(I,g(M[0],M[1])),this.parent.notify(an,null)}}}}return"autofill"===e.action&&(o[1]=this.isUndo?e.eventArgs.dataRange:e.eventArgs.selectedRange),!y||n||v||(a.isColSelected&&(o[1]=h.selectedRange),this.parent.notify(Ja,{address:o[1]})),this.parent.showAggregate&&this.parent.notify(gs,{}),e},e.prototype.getCellDetails=function(e,r,n){for(var i,a=[],o="cellDelete"===n,s=(e=w(e))[0];s<=e[2];s++)if(!o||!qe(r,s))for(var l=e[1];l<=e[3];l++)i=Re(s,l,r),a.push({rowIndex:s,colIndex:l,format:i?i.format:null,isLocked:i?i.isLocked:null,style:i&&i.style?Object.assign({},i.style):null,value:i?i.value:"",formula:i?i.formula:"",wrap:i&&i.wrap,rowSpan:i&&i.rowSpan,colSpan:i&&i.colSpan,hyperlink:i&&(t.isObject(i.hyperlink)?t.extend({},i.hyperlink):i.hyperlink),image:i&&i.image,chart:i&&i.chart&&JSON.parse(JSON.stringify(i.chart)),validation:i&&i.validation});return a},e.prototype.updateCellDetails=function(e,r,n,i,a,o,s,l){for(var h,d,p,c,u,f=this,v=e.length,y=a&&!o&&("cellSave"===a.action||"cellDelete"===a.action||"autofill"===a.action||"clipboard"===a.action),C=a&&!a.eventArgs.cfClearActionArgs&&r.conditionalFormats&&r.conditionalFormats.length&&[].slice.call(r.conditionalFormats),b=[],x=function(n){if(s)return Ke(r,e[n].colIndex,{validation:e[n].validation}),"continue";(d=Re(e[n].rowIndex,e[n].colIndex,r,!1,!0)).style&&a&&("format"===a.action||"clipboard"===a.action)&&(!d.style.borderTop||e[n].style&&e[n].style.borderTop||S.parent.setBorder({borderTop:""},r.name+"!"+g(e[n].rowIndex,e[n].colIndex),null,l),!d.style.borderLeft||e[n].style&&e[n].style.borderLeft||S.parent.setBorder({borderLeft:""},r.name+"!"+g(e[n].rowIndex,e[n].colIndex),null,l),!d.style.borderRight||e[n].style&&e[n].style.borderRight||S.parent.setBorder({borderRight:""},r.name+"!"+g(e[n].rowIndex,e[n].colIndex),null,l),!d.style.fontSize||e[n].style&&e[n].style.fontSize||(d.style.fontSize="11pt",p=!0,S.parent.notify(_r,{style:{fontSize:"11pt"},rowIdx:e[n].rowIndex,colIdx:e[n].colIndex,lastCell:!0,isHeightCheckNeeded:!0,manualUpdate:!0,onActionUpdate:!0})),!d.style.fontFamily||e[n].style&&e[n].style.fontFamily||(p=!0,d.style.fontFamily="Calibri",S.parent.notify(_r,{style:{fontFamily:"Calibri"},rowIdx:e[n].rowIndex,colIdx:e[n].colIndex,lastCell:!0,isHeightCheckNeeded:!0,manualUpdate:!0,onActionUpdate:!0}))),d.image&&a&&"clipboard"===a.action&&d.image.forEach(function(t){f.parent.notify(Ds,{id:t.id,sheet:r,preventEventTrigger:!0,rowIdx:e[n].rowIndex,colIdx:e[n].colIndex})}),ke(e[n].rowIndex,e[n].colIndex,r,{value:e[n].formula&&e[n].formula.toUpperCase().includes("UNIQUE")?null:e[n].value,format:e[n].format,isLocked:e[n].isLocked,style:e[n].style&&Object.assign({},e[n].style),formula:e[n].formula,wrap:e[n].wrap,rowSpan:e[n].rowSpan,colSpan:e[n].colSpan,hyperlink:e[n].hyperlink,validation:e[n]&&e[n].validation,image:e[n].image}),u={action:"updateCellValue",address:[e[n].rowIndex,e[n].colIndex,e[n].rowIndex,e[n].colIndex],value:e[n].formula?e[n].formula:e[n].value,sheetIndex:ce(S.parent,r.name),skipFormatCheck:Kt(S.parent)},S.parent.notify(qr,u),C&&!c&&(c=u.isFormulaDependent),(a&&"wrap"===a.action&&a.eventArgs.wrap||d.wrap&&!e[n].wrap)&&S.parent.notify(yn,{range:[e[n].rowIndex,e[n].colIndex,e[n].rowIndex,e[n].colIndex],wrap:!1,sheet:r}),a&&e[n].hyperlink&&"clear"===a.action&&(a.eventArgs.range=r.name+"!"+m([e[n].rowIndex,e[n].colIndex,e[n].rowIndex,e[n].colIndex]),h=S.parent.getCell(e[n].rowIndex,e[n].colIndex),"Clear All"===a.eventArgs.type||"Clear Hyperlinks"===a.eventArgs.type?S.parent.addHyperlink(e[n].hyperlink,a.eventArgs.range,e[n].value):"Clear Formats"===a.eventArgs.type&&h&&t.addClass(h.querySelectorAll(".e-hyperlink"),"e-hyperlink-style")),y&&e[n].value!==d.value&&S.parent.trigger("cellSave",{element:null,value:e[n].value,oldValue:d.value,formula:e[n].formula,cancel:!1,address:r.name+"!"+g(e[n].rowIndex,e[n].colIndex),displayText:S.parent.getDisplayText(e[n])}),C&&!c&&ne(C,b,e[n].rowIndex,e[n].colIndex)},S=this,w=0;w<v;w++)x(w);if(i){if(n[0]===n[2]&&n[1]===n[3]){var I=Re(n[0],n[1],r);I.rowSpan>1&&(n[2]=n[0]+I.rowSpan-1),I.colSpan>1&&(n[3]=n[1]+I.colSpan-1)}this.parent.serviceLocator.getService("cell").refreshRange(n,!1,!1,!0,!1,Kt(this.parent)),(b.length||c)&&this.parent.notify(Xn,{cfModel:!c&&b,refreshAll:c,isAction:!0}),p&&tt(function(){return f.parent.selectRange(r.selectedRange)})}},e.prototype.checkRefreshNeeded=function(e,t){var r=!0;return e!==this.parent.activeSheetIndex&&(t||(this.parent.activeSheetIndex=e,this.parent.dataBind()),r=!1),r},e.prototype.addEventListener=function(){this.parent.on(Lo,this.performUndoRedo,this),this.parent.on(Po,this.updateUndoRedoCollection,this),this.parent.on(Mo,this.setActionData,this),this.parent.on(Ho,this.getBeforeActionData,this),this.parent.on(Bo,this.clearUndoRedoCollection,this),this.parent.on(ls,this.updateUndoRedoIcons,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(Lo,this.performUndoRedo),this.parent.off(Po,this.updateUndoRedoCollection),this.parent.off(Mo,this.setActionData),this.parent.off(Ho,this.getBeforeActionData),this.parent.off(Bo,this.clearUndoRedoCollection),this.parent.off(ls,this.updateUndoRedoIcons))},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.getModuleName=function(){return"undoredo"},e}(),sh=function(){function e(e){this.parent=e,this.wrapCell=this.parent.createElement("span",{className:"e-wrap-content"}),this.addEventListener()}return e.prototype.addEventListener=function(){this.parent.on($a,this.ribbonClickHandler,this),this.parent.on(yn,this.wrapTextHandler,this),this.parent.on(yo,this.rowHeightChangedHandler,this),this.parent.on(Co,this.colWidthChanged,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off($a,this.ribbonClickHandler),this.parent.off(yn,this.wrapTextHandler),this.parent.off(yo,this.rowHeightChangedHandler),this.parent.off(Co,this.colWidthChanged))},e.prototype.wrapTextHandler=function(e){if(e.initial||st(this.parent,e.range,!0)){e.initial&&!e.td&&st(this.parent,e.range,!0)&&(e.initial=!1);for(var r=void 0,n=void 0,i=void 0,a=void 0,o=void 0,s=void 0,l=void 0,h=void 0,d=e.range[0];d<=e.range[2];d++){a=0,s=(l=_e(e.sheet,d).customHeight)||e.isCustomHgt;for(var p=e.range[1];p<=e.range[3];p++)if(!((n=Re(d,p,e.sheet,null,!0)).rowSpan<0||n.colSpan<0)){var c=n.rowSpan>1||n.colSpan>1;if((r=e.initial?e.td:this.parent.getCell(d,p))?(e.wrap?(h=Ht(n.style&&n.style.fontFamily?n.style:this.parent.cellStyle),r.classList.add(kl)):(r.classList.remove(kl),h=null),(s||c)&&this.updateWrapCell(d,p,e.sheet,r),t.Browser.isIE&&r.classList.add("e-ie-wrap")):h=null,!s&&!c){i=_t(e.sheet,d,p,n.colSpan>1?p+n.colSpan-1:p);var u=this.parent.getDisplayText(n).toString();if(r&&u.indexOf("\n")<0){var f=this.parent.element.querySelector(".e-spreadsheet-edit");f&&f.textContent.indexOf("\n")>-1&&(u=f.textContent)}if(u)if(e.wrap){r&&r.classList.contains("e-alt-unwrap")&&r.classList.remove("e-alt-unwrap");var g=void 0,m=0,v=void 0;if(u.indexOf("\n")>-1){var y=u.split("\n"),C=y.length;for(v=0;v<C;v++)0===(g=Ut(y[v],i,n.style,this.parent.cellStyle))&&(g=1),m+=g;g=m}else g=Ut(u,i,n.style,this.parent.cellStyle);if(o=zt(this.parent,d,p,e.sheet,n.style||this.parent.cellStyle,g,h),a=Math.max(a,o),n.rowSpan>1){var b=Ye(e.sheet,d,d+(n.rowSpan-1));if(b>=a)return;o=a=We(e.sheet,d)+(a-b)}jt(e.sheet,d,p,o)}else r&&u.indexOf("\n")>-1&&r.classList.add("e-alt-unwrap"),o=zt(this.parent,d,p,e.sheet,n.style||this.parent.cellStyle,1,h),jt(e.sheet,d,p,o),a=Math.max(qt(e.sheet,d),20);else e.wrap&&u||(jt(e.sheet,d,p,20),a=Math.max(qt(e.sheet,d),20));p===e.range[3]&&(e.wrap&&a>20&&qt(e.sheet,d)<=a||(!e.wrap||!u)&&qt(e.sheet,d)<We(e.sheet,d)&&We(e.sheet,d)>20)&&(r?(Pt(this.parent,e.sheet,a,d,e.row,e.hRow),e.sheet.conditionalFormats&&e.sheet.conditionalFormats.length&&this.parent.notify(Xn,{indexes:[d,p],isAction:!0})):(Ge(e.sheet,d,a),this.parent.setProperties({sheets:this.parent.sheets},!0)))}if(r){if(s&&!c){u=this.parent.getDisplayText(n);e.wrap?r.classList.contains("e-alt-unwrap")&&r.classList.remove("e-alt-unwrap"):u.indexOf("\n")>-1&&r.classList.add("e-alt-unwrap")}e.wrap?l?r.style.lineHeight&&(r.style.lineHeight=""):r.style.lineHeight=parseFloat(n.style&&n.style.fontSize||this.parent.cellStyle.fontSize)*h+"pt":r.style.lineHeight=""}}}e.initial||this.parent.notify(il,null)}},e.prototype.ribbonClickHandler=function(e){var r=t.closest(e.originalEvent.target,".e-btn");if(r&&r.id===this.parent.element.id+"_wrap"){var n=r.classList.contains("e-active"),i=b(this.parent.getActiveSheet()),a={address:i,wrap:n,cancel:!1};this.parent.notify(Ar,{action:"beforeWrap",eventArgs:a}),a.cancel||(Ae(this.parent.getActiveSheet().selectedRange,n,this.parent),this.parent.notify(Yo,{action:"wrap",eventArgs:{address:i,wrap:n}}))}},e.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++)Re(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=""))},e.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++)Re(r,e.colIdx,t,!1,!0).wrap&&this.updateWrapCell(r,e.colIdx,t,this.parent.getCell(r,e.colIdx))},e.prototype.updateWrapCell=function(e,t,r,n){if(n&&!n.querySelector(".e-wrap-content")){for(var i=this.wrapCell.cloneNode(),a=n.querySelector(".e-filter-btn");n.childElementCount;)i.appendChild(n.firstElementChild);if(a&&(n.firstChild?n.insertBefore(a,n.firstChild):n.appendChild(a)),!Re(e,t,r,!1,!0).hyperlink){var o=n.lastChild;o&&3===o.nodeType?(i.appendChild(document.createTextNode(o.textContent)),o.textContent=""):(i.appendChild(document.createTextNode(n.textContent)),n.textContent="")}n.appendChild(i)}},e.prototype.getModuleName=function(){return"wrapText"},e.prototype.destroy=function(){this.removeEventListener(),this.wrapCell&&(this.wrapCell.remove(),this.wrapCell=null),this.parent=null},e}(),lh=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.insert=function(e){var t=e.eventArgs;this.parent.notify(hi,t);var r=Ce(this.parent,t.activeSheetIndex);switch(t.modelType){case"Sheet":this.parent.notify(Ya,{startIdx:t.index,endIdx:t.index+(t.model.length-1),preventUpdate:!t.isAction}),this.parent.renderModule.refreshSheet();break;case"Row":if(t.activeSheetIndex===this.parent.activeSheetIndex){var n=this.parent.frozenRowCount(r);if(!this.parent.scrollSettings.enableVirtualization||t.index<=this.parent.viewport.bottomIndex)if(t.freezePane)this.parent.renderModule.refreshSheet(!1,!1,!0);else if(this.parent.scrollSettings.enableVirtualization){var i=this.parent.frozenColCount(r);if(t.index>=this.parent.viewport.topIndex+n){var a=[],o=void 0;i?(o=u(r.topLeftCell)[1],a.push(n),a.push(this.parent.viewport.leftIndex+i)):o=this.parent.viewport.leftIndex;var s=this.parent.viewport.leftIndex;this.parent.renderModule.refreshUI({rowIndex:this.parent.viewport.topIndex,colIndex:o,refresh:"Row",frozenIndexes:a,skipUpdateOnFirst:this.parent.viewport.topIndex+n===$(r,n,!0)}),i&&(this.parent.viewport.leftIndex=s)}var l=u(r.paneTopLeftCell)[0];t.index<l&&(this.parent.notify(cl,{scrollTop:Ye(r,n,l-1,!0)}),this.parent.goTo(g(t.index,$(r,i,!0,"columns")))),this.parent.selectRange(r.selectedRange)}else this.parent.renderModule.refreshUI({skipUpdateOnFirst:!0,rowIndex:this.parent.viewport.topIndex,colIndex:0,refresh:"Row"}),this.parent.selectRange(r.selectedRange);else!this.parent.scrollSettings.isFinite||this.parent.viewport.topIndex+n!==$(r,0,!0)&&this.parent.viewport.bottomIndex!==$(r,r.rowCount-t.model.length-1,!1)||this.parent.renderModule.refreshSheet(!1,!1,!0)}break;case"Column":if(t.activeSheetIndex===this.parent.activeSheetIndex){i=this.parent.frozenColCount(r);if(!this.parent.scrollSettings.enableVirtualization||t.index<=this.parent.viewport.rightIndex)if(t.freezePane)this.parent.renderModule.refreshSheet(!1,!1,!0);else if(this.parent.scrollSettings.enableVirtualization){n=this.parent.frozenRowCount(r);if(t.index>=this.parent.viewport.leftIndex+i){a=[];n&&(a=[n+this.parent.viewport.topIndex,i]);var h=n?u(r.topLeftCell)[0]:this.parent.viewport.topIndex,d=this.parent.viewport.topIndex;this.parent.renderModule.refreshUI({skipUpdateOnFirst:this.parent.viewport.leftIndex+i===$(r,i,!0,"columns"),rowIndex:h,colIndex:this.parent.viewport.leftIndex,refresh:"Column",frozenIndexes:a}),n&&(this.parent.viewport.topIndex=d)}var p=u(r.paneTopLeftCell)[1];t.index<p&&(this.parent.notify(cl,{scrollLeft:Ze(r,0,p-1,!0)}),this.parent.goTo(g($(r,n,!0),t.index))),this.parent.selectRange(r.selectedRange)}else this.parent.renderModule.refreshUI({skipUpdateOnFirst:!0,rowIndex:0,colIndex:this.parent.viewport.leftIndex,refresh:"Column"}),this.parent.selectRange(r.selectedRange);else!this.parent.scrollSettings.isFinite||this.parent.viewport.leftIndex+i!==$(r,0,!0,"columns")&&this.parent.viewport.rightIndex!==$(r,r.colCount-t.model.length-1,!1,"columns")||this.parent.renderModule.refreshSheet(!1,!1,!0)}}this.refreshImgElement(t.model.length,this.parent.activeSheetIndex,t.modelType,t.index),t.isAction?(delete t.isAction,this.parent.notify(Yo,e),Wt(this.parent.element)):t.isUndoRedo||(t.isMethod=!0,this.parent.notify(Rr,e))},e.prototype.refreshImgElement=function(e,t,r,n){for(var i,a=this.parent.sheets[t],o=[0,0,a.usedRange.rowIndex,a.usedRange.colIndex],s=0;s<=o[2];s++)for(var l=o[1];l<=o[3];l++)(i=Re(s,l,a))&&i.image&&i.image.length>0&&("Row"===r&&s>=n||"Column"===r&&l>=n)&&this.parent.notify(Hs,{rowIdx:s,colIdx:l,sheetIdx:t,type:r,count:e,status:"insert"})},e.prototype.addEventListener=function(){this.parent.on(bn,this.insert,this)},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off(bn,this.insert)},e.prototype.getModuleName=function(){return"insert"},e}(),hh=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.delete=function(e){var t=e.eventArgs;if("Sheet"===t.modelType){var r=t.activeSheetIndex>=t.startIndex&&t.activeSheetIndex<=t.endIndex;r&&this.parent.setProperties({activeSheetIndex:this.parent.skipHiddenSheets(t.startIndex<this.parent.sheets.length?t.startIndex:t.startIndex?t.startIndex-1:0)},!0),this.parent.notify(Fa,null),r&&this.parent.renderModule.refreshSheet(!1,!1,!0)}else if(t.activeSheetIndex===this.parent.activeSheetIndex){var n=this.parent.getActiveSheet(),i=this.parent.frozenRowCount(n),a=this.parent.frozenColCount(n);if("Row"===t.modelType){if(!this.parent.scrollSettings.enableVirtualization||t.startIndex<=this.parent.viewport.bottomIndex)if(this.parent.scrollSettings.enableVirtualization)if(t.startIndex<u(n.paneTopLeftCell)[0])this.parent.updateTopLeftCell($(n,t.startIndex-1<i?i:t.startIndex-1,!0)-i,null,"col"),this.parent.renderModule.refreshSheet(!1,!1,!0);else if(t.freezePane||this.parent.scrollSettings.isFinite&&this.parent.viewport.bottomIndex>=$(n,n.rowCount-1,!1))this.parent.renderModule.refreshSheet(!1,!1,!0);else{var o=[],s=this.parent.frozenColCount(n),l=void 0,h=this.parent.viewport.leftIndex;s?(o.push(i),o.push(h+s),l=u(n.topLeftCell)[1]):l=h,this.parent.renderModule.refreshUI({rowIndex:this.parent.viewport.topIndex,refresh:"Row",colIndex:l,skipUpdateOnFirst:this.parent.viewport.topIndex+i===$(n,i,!0),frozenIndexes:o}),s&&(this.parent.viewport.leftIndex=h),this.parent.selectRange(n.selectedRange)}else i||a?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(n.selectedRange))}else{if(!1!==t.refreshSheet&&(!this.parent.scrollSettings.enableVirtualization||t.startIndex<=this.parent.viewport.rightIndex))if(this.parent.scrollSettings.enableVirtualization)if(t.startIndex<u(n.paneTopLeftCell)[1])this.parent.updateTopLeftCell(null,$(n,t.startIndex-1<a?a:t.startIndex-1,!0,"columns")-a,"row"),this.parent.renderModule.refreshSheet(!1,!1,!0);else if(t.freezePane||!0===t.refreshSheet)this.parent.renderModule.refreshSheet(!1,!1,!0);else{var d=this.parent.frozenRowCount(n),p=(o=[],this.parent.viewport.topIndex),c=d?u(n.topLeftCell)[0]:p;d&&(o=[d+p,a]),this.parent.renderModule.refreshUI({rowIndex:c,refresh:"Column",colIndex:this.parent.viewport.leftIndex,insertDelete:!0,skipUpdateOnFirst:this.parent.viewport.leftIndex+a===$(n,a,!0,"columns"),frozenIndexes:o}),d&&(this.parent.viewport.topIndex=p),this.parent.selectRange(n.selectedRange)}else i||a?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(n.selectedRange));delete t.refreshSheet}}this.refreshImgElement(t.deletedModel.length,this.parent.activeSheetIndex,t.modelType,t.startIndex),t.isAction?(delete t.isAction,this.parent.notify(Yo,e),Wt(this.parent.element)):t.isUndoRedo||(t.isMethod=!0,this.parent.notify(Rr,e))},e.prototype.addEventListener=function(){this.parent.on(xn,this.delete,this)},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off(xn,this.delete)},e.prototype.getModuleName=function(){return"delete"},e.prototype.refreshImgElement=function(e,t,r,n){for(var i,a=this.parent.sheets[t],o=[0,0,a.usedRange.rowIndex,a.usedRange.colIndex],s=0;s<=o[2];s++)for(var l=o[1];l<=o[3];l++)(i=Re(s,l,a))&&i.image&&i.image.length>0&&("Row"===r&&s>=n||"Column"===r&&l>=n)&&this.parent.notify(Hs,{rowIdx:s,colIdx:l,sheetIdx:t,type:r,count:e,status:"delete"})},e}(),dh=function(){function e(e){this.data=[],this.parent=e,this.addEventListener()}return e.prototype.destroy=function(){this.removeEventListener();var e=t.select("#"+this.parent.element.id+"_datavalidation-popup");e&&e.remove(),this.data=[],this.typeData=[],this.operatorData=[],this.parent=null},e.prototype.addEventListener=function(){t.Browser.isDevice&&"safari"===t.Browser.info.name&&(t.Browser.isIos||t.Browser.isIos7)?t.EventHandler.add(this.parent.element,"touchend",this.listOpen,this):t.EventHandler.add(this.parent.element,"dblclick",this.listOpen,this),this.parent.on(Jo,this.initiateDataValidationHandler,this),this.parent.on(es,this.invalidDataHandler,this),this.parent.on(In,this.checkDataValidation,this),this.parent.on(Kr,this.listHandler,this),this.parent.on(Ha,this.keyUpHandler,this),this.parent.on(fs,this.removeValidationHandler,this),this.parent.on(li,this.InvalidElementHandler,this)},e.prototype.removeEventListener=function(){t.Browser.isDevice&&"safari"===t.Browser.info.name&&(t.Browser.isIos||t.Browser.isIos7)?t.EventHandler.remove(this.parent.element,"touchend",this.listOpen):t.EventHandler.remove(this.parent.element,"dblclick",this.listOpen),this.parent.isDestroyed||(this.parent.off(Jo,this.initiateDataValidationHandler),this.parent.off(es,this.invalidDataHandler),this.parent.off(In,this.checkDataValidation),this.parent.off(Kr,this.listHandler),this.parent.off(Ha,this.keyUpHandler),this.parent.off(fs,this.removeValidationHandler),this.parent.off(li,this.InvalidElementHandler))},e.prototype.removeValidationHandler=function(e){var t,r,n={cancel:!1,isColSelected:e.isCol},i=e.range;if(e.range&&e.range.includes("!")){if(r=e.range,!(t=Ce(this.parent,ce(this.parent,r.split("!")[0]))))return}else if(t=this.parent.getActiveSheet(),r=t.name+"!",e.range)r+=e.range;else{var a=this.getRange(t.selectedRange);r+=a.range,n.isColSelected=a.isColSelected}if(i=t.selectedRange,n.range=r,e.isAction&&this.parent.notify(Ar,{eventArgs:n,action:"removeValidation"}),!n.cancel){var o=void 0,s=void 0,l=void 0;if(t.name===this.parent.getActiveSheet().name){l=u(t.activeCell);var h=w(c(i));l[0]>=h[0]&&l[1]>=h[1]&&l[0]<=h[2]&&l[1]<=h[3]&&(o=(s=n.isColSelected?Xe(t,l[1])||{}:Re(l[0],l[1],t,!1,!0)).validation&&"List"===s.validation.type)}if(this.parent.notify(En,{range:r,isRemoveValidation:!0,viewport:this.parent.viewport}),o&&!s.validation){var d=this.parent.getCell(l[0],l[1]);d&&d.getElementsByClassName("e-validation-list")[0]&&(this.listObj.destroy(),d.removeChild(d.getElementsByClassName("e-validation-list")[0]))}e.isAction&&(delete n.cancel,this.parent.notify(Yo,{eventArgs:n,action:"removeValidation"}))}},e.prototype.keyUpHandler=function(e){var r=e.target,n=this.parent.element.querySelector(".e-datavalidation-dlg");if(t.closest(r,".e-values")&&n&&13!==e.keyCode){var i=n.querySelector(".e-values"),a=i.querySelector(".e-dlg-error"),o=n.querySelector(".e-footer-content").querySelector(".e-primary");o.hasAttribute("disabled")&&o.removeAttribute("disabled"),a&&i.removeChild(a)}},e.prototype.listOpen=function(e){var t=e.target;this.listObj&&t.classList.contains("e-cell")&&t.querySelector(".e-validation-list")&&this.parent.isEdit&&this.listObj.showPopup()},e.prototype.invalidDataHandler=function(e){var t={range:e.range||this.parent.dataValidationRange,cancel:!1};if(t.range){var r;!e.isPublic&&(r={eventArgs:t,action:e.isRemoveHighlight?"removeHighlight":"addHighlight"},this.parent.notify(Ar,r),t.cancel)||(e.isRemoveHighlight?this.parent.removeInvalidHighlight(t.range):this.parent.addInvalidHighlight(t.range),e.isPublic||this.parent.notify(Yo,r))}},e.prototype.listHandler=function(){var e=this;if(this.parent.allowDataValidation){var r,n=this.parent.getActiveSheet(),i=u(n.activeCell),a=Re(i[0],i[1],n),o=this.parent.getCell(i[0],i[1]);if(!o)return;document.getElementsByClassName("e-validation-list")[0]&&(this.listObj&&this.listObj.destroy(),t.remove(document.getElementsByClassName("e-validation-list")[0]),this.data=[]);var l=a&&a.validation||n.columns&&n.columns[i[1]]&&n.columns[i[1]].validation;if(l&&"List"===l.type){if(l.address&&!q(l.address,i[0],i[1]))return;if(l.ignoreBlank=!!t.isNullOrUndefined(l.ignoreBlank)||l.ignoreBlank,l.inCellDropDown=!!t.isNullOrUndefined(l.inCellDropDown)||l.inCellDropDown,l.inCellDropDown){var h=this.parent.createElement("div",{className:"e-validation-list"}),d=this.parent.createElement("input",{id:this.parent.element.id+"listValid"});h.appendChild(d),l.inCellDropDown||(h.style.display="none");var p=o.getElementsByClassName("e-wrap-content")[0]||o;p.insertBefore(h,p.firstChild);var c=this.updateDataSource(a,l);this.listObj=new s.DropDownList({index:this.setDropDownListIndex(c,a),dataSource:c,fields:{text:"text",value:"id"},width:"0px",popupHeight:"200px",change:function(){return e.listValueChange(e.listObj.text)},beforeOpen:function(e){(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(t){t.event&&(13===t.event.keyCode||t.event.altKey&&38===t.event.keyCode)&&(t.event.preventDefault(),t.event.stopPropagation()),Wt(e.parent.element)}}),this.listObj.appendTo("#"+this.parent.element.id+"listValid")}}a&&a.validation&&(a.validation=l)}},e.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},e.prototype.updateDataSource=function(e,t){var r=this;this.data=[];var n=0,i=this.parent.definedNames,a=t.value1,o=-1!==a.indexOf("=");if(i.length>0&&o)for(var s=a.split("=")[1],l=0,h=i.length;l<h;l++)if(i[l].name===s){for(var d=i[l].refersTo;d.includes("'");)d=d.replace("'","");a=d}if(o){var p=a.indexOf("!")>-1?Ce(this.parent,ce(this.parent,a.split("=")[1].split("!")[0])):this.parent.getActiveSheet(),u=a.indexOf("!")>-1?a.split("!")[1]:a.split("=")[1],f=this.parent.getActiveSheet();if(p.name!==f.name){var g,m=c(f.selectedRange);p.ranges.forEach(function(e){e.info&&e.info.loadedRange&&e.info.loadedRange.length||(g=!0)}),g&&(this.parent.showSpinner(),he(this.parent,p.name+"!"+u).then(function(){if(r.parent.hideSpinner(),f.name===r.parent.getActiveSheet().name){var n=c(r.parent.getActiveSheet().selectedRange);n[0]===m[0]&&n[1]===m[1]&&(r.listObj.dataSource=r.updateDataSource(e,t),r.listObj.dataBind())}}))}var v=void 0,y=u.split(":");if(y[0].match(/[a-z]+$/gi)&&y[1].match(/[a-z]+$/gi)||y[0].match(/^[0-9]/g)&&y[1].match(/^[0-9]/g)){var C=this.parent.getIndexes(u);v=C.isCol?[0,C.startIdx,p.usedRange.rowIndex,C.startIdx]:[C.startIdx,0,C.startIdx,p.usedRange.colIndex]}else v=c(u);for(var b=v[0];b<=v[2];b++){p.rows[b]||ze(p,b,{});for(var x=v[1];x<=v[3];x++){p.rows[b].cells||ke(b,x,p,{}),n+=1,e=p.rows[b].cells[x];var S=this.parent.getDisplayText(e)||"";this.data.push({text:S,id:"list-"+n})}}}else{var w=a.split(",");for(l=0;l<w.length;l++)n+=1,this.data.push({text:w[l],id:"list-"+n})}return this.data},e.prototype.listValueChange=function(e){this.parent.notify(Pa,{action:"refreshFormulabar",value:e});var t=this.parent.getActiveSheet(),r=y(t.activeCell),n=Object.assign({},Re(r[0],r[1],t));if(t.isProtected&&Y(n,Xe(t,r[1])))this.parent.notify(ss,null);else{this.parent.isEdit&&this.parent.closeEdit();var i={value:e,oldValue:n.value,address:t.name+"!"+t.activeCell,cancel:!1};if(this.parent.notify(Ar,{action:"cellSave",eventArgs:i}),i.cancel)return;J(this.parent,t,{cell:{value:e},rowIdx:r[0],colIdx:r[1],valChange:!0,lastCell:!0,uiRefresh:!0,checkCF:!0}),this.parent.notify(Yo,{action:"cellSave",eventArgs:{value:e,oldValue:n.value,address:t.name+"!"+t.activeCell}})}},e.prototype.getRange=function(e){var t,r=c(e),n=this.parent.getActiveSheet(),i=n.rowCount,a=n.colCount;return r[2]===i-1&&0===r[0]?(e=e.replace(/[0-9]/g,""),t=!0):r[3]===a-1&&0===r[2]&&(e=e.replace(/\D/g,"")),{range:e,isColSelected:t}},e.prototype.initiateDataValidationHandler=function(e,r){var n,i,a,o,s,l=this,h=this.parent.serviceLocator.getService(Fl),d=!0,p=!0,u=!0,f=this.parent.getActiveSheet(),g=f.selectedRange,m=w(c(g));g=this.getRange(g).range;var v=this.validateRange(m,f);if(!v.extendValidation&&!v.moreValidation||e){for(var y=m[0];y<=m[2];y++)if(f.rows[y])for(var C=m[1];C<=m[3];C++)f.rows[y].cells&&f.rows[y].cells[C]&&(s=f.rows[y].cells[C]).validation&&(u=!1,n=s.validation.type,i=s.validation.operator,a=s.validation.value1,o=s.validation.value2,d=t.isNullOrUndefined(s.validation.ignoreBlank)?d:s.validation.ignoreBlank,p=t.isNullOrUndefined(s.validation.inCellDropDown)?p:s.validation.inCellDropDown);if(u)for(var b=m[1];b<=m[3];b++){var x=Xe(f,b);x&&x.validation&&(u=!1,n=x.validation.type,i=x.validation.operator,a=x.validation.value1,o=x.validation.value2,d=t.isNullOrUndefined(x.validation.ignoreBlank)?d:x.validation.ignoreBlank,p=t.isNullOrUndefined(x.validation.inCellDropDown)?p:x.validation.inCellDropDown)}if(!this.parent.element.querySelector(".e-datavalidation-dlg")){var S=this.parent.serviceLocator.getService(Al);S.show({width:375,showCloseIcon:!0,isModal:!0,cssClass:"e-datavalidation-dlg",header:h.getConstant("DataValidation"),beforeOpen:function(e){var t={dialogName:"ValidationDialog",element:e.element,target:e.target,cancel:e.cancel};l.parent.trigger("dialogBeforeOpen",t),t.cancel&&(e.cancel=!0),r&&(u=!0),S.dialogInstance.content=l.dataValidationContent(u,n,i,a,o,d,p,g),S.dialogInstance.dataBind(),Wt(l.parent.element)},buttons:[{buttonModel:{content:h.getConstant("ClearAll"),cssClass:"e-btn e-clearall-btn e-flat"},click:function(){S.dialogInstance.content=l.dataValidationContent(!0,n,i,a,o,d,p,g),S.dialogInstance.dataBind()}},{buttonModel:{content:h.getConstant("Apply"),isPrimary:!0},click:function(){l.dlgClickHandler(S)}}]}),S.dialogInstance.refresh()}}else v.moreValidation&&this.moreValidationDlg(),v.extendValidation&&this.extendValidationDlg()},e.prototype.dataValidationContent=function(e,t,r,n,i,l,h,d){var p,c,u=this,f=this.parent.serviceLocator.getService(Fl);if(e)p=c="0";else if("Date"===t){var g=function(e){if(D(e)){var t={cell:{value:e},type:"date",value:e};return u.parent.notify(Xr,t),t.value}return e};p=g(p),c=g(c)}else p=n,c=i;var m=this.parent.createElement("div",{className:"e-validation-dlg"}),v=this.parent.createElement("div",{className:"e-cellrange"}),y=this.parent.createElement("div",{className:"e-allowdata"}),C=this.parent.createElement("div",{className:"e-values"}),b=this.parent.createElement("div",{className:"e-ignoreblank"});m.appendChild(v),m.appendChild(y),m.appendChild(C),m.appendChild(b);var x=this.parent.createElement("span",{className:"e-header"});x.innerText=f.getConstant("CellRange");var S=this.parent.createElement("input",{className:"e-input",attrs:{value:d,"aria-label":f.getConstant("CellRange")}});v.appendChild(x),v.appendChild(S);var w=this.parent.createElement("div",{className:"e-allow"}),I=this.parent.createElement("div",{className:"e-data"});y.appendChild(w),y.appendChild(I);var E=this.parent.createElement("span",{className:"e-header"});E.innerText=f.getConstant("Allow"),this.typeData=[{text:f.getConstant("WholeNumber"),id:"type-1"},{text:f.getConstant("Decimal"),id:"type-2"},{text:f.getConstant("Date"),id:"type-3"},{text:f.getConstant("Time"),id:"type-4"},{text:f.getConstant("TextLength"),id:"type-5"},{text:f.getConstant("List"),id:"type-6"}],this.operatorData=[{text:f.getConstant("Between"),id:"operator-1"},{text:f.getConstant("NotBetween"),id:"operator-2"},{text:f.getConstant("EqualTo"),id:"operator-3"},{text:f.getConstant("NotEqualTo"),id:"operator-4"},{text:f.getConstant("GreaterThan"),id:"operator-5"},{text:f.getConstant("LessThan"),id:"operator-6"},{text:f.getConstant("GreaterThanOrEqualTo"),id:"operator-7"},{text:f.getConstant("LessThanOrEqualTo"),id:"operator-8"}];var R=this.parent.createElement("input",{className:"e-select"});t&&(t=this.formattedType(t));var k=0;if(!e)for(var F=0;F<this.typeData.length;F++)if(t===this.formattedType(this.typeData[F].text)){k=F;break}if(e||"List"!==t){var A=0,N=this.parent.createElement("span",{className:"e-header"});N.innerText=f.getConstant("Data");var O=this.parent.createElement("input",{className:"e-select"});if(!e)for(F=0;F<this.operatorData.length;F++)if(r===this.formattedValue(this.operatorData[F].text)){A=F;break}I.appendChild(N),I.appendChild(O),this.dataList=new s.DropDownList({dataSource:this.operatorData,index:A,popupHeight:"200px",change:function(){u.userInput(L,u.dataList)}}),this.dataList.appendTo(O)}else{var T=this.parent.createElement("input",{className:"e-checkbox"});I.appendChild(T);new o.CheckBox({label:f.getConstant("InCellDropDown"),checked:h}).appendTo(T)}w.appendChild(E),w.appendChild(R);var L=new s.DropDownList({dataSource:this.typeData,index:k,popupHeight:"200px",change:function(){u.userInput(L,u.dataList)}});if(L.appendTo(R),e||L.value!==f.getConstant("List")&&(this.dataList.value===f.getConstant("Between")||this.dataList.value===f.getConstant("NotBetween"))){var P=this.parent.createElement("div",{className:"e-minimum"}),M=this.parent.createElement("div",{className:"e-maximum"});C.appendChild(P),C.appendChild(M);var H=this.parent.createElement("span",{className:"e-header"});H.innerText=f.getConstant("Minimum");var B=this.parent.createElement("span",{className:"e-header"});B.innerText=f.getConstant("Maximum");var U=this.parent.createElement("input",{id:"minvalue",className:"e-input",attrs:{value:p,"aria-label":f.getConstant("Minimum")}}),V=this.parent.createElement("input",{id:"maxvalue",className:"e-input",attrs:{value:c,"aria-label":f.getConstant("Maximum")}});P.appendChild(H),P.appendChild(U),M.appendChild(B),M.appendChild(V);new a.NumericTextBox({value:0}).appendTo("#minvalue");new a.NumericTextBox({value:0}).appendTo("#maxvalue")}else if(e||"List"!==t){(_=this.parent.createElement("span",{className:"e-header"})).innerText=f.getConstant("Value");z=this.parent.createElement("input",{className:"e-input",attrs:{value:p}});C.appendChild(_),C.appendChild(z)}else{var _;(_=this.parent.createElement("span",{className:"e-header"})).innerText=f.getConstant("Sources");var z=this.parent.createElement("input",{className:"e-input",attrs:{value:p}});C.appendChild(_),C.appendChild(z)}var j=l,q=this.parent.createElement("input",{className:"e-checkbox"});b.appendChild(q);return new o.CheckBox({label:f.getConstant("IgnoreBlank"),checked:j}).appendTo(q),m},e.prototype.validateRange=function(e,t){for(var r=!1,n=!1,i=[],a=[],o=[],s=[],l=e[0];l<=e[2];l++)if(t.rows[l])for(var h=e[1];h<=e[3];h++)if(t.rows[l].cells&&t.rows[l].cells[h]){(m=t.rows[l].cells[h]).validation&&(i.push(m.validation.type),a.push(m.validation.operator),o.push(m.validation.value1),s.push(m.validation.value2))}for(var d=e[1];d<=e[3];d++){(v=Xe(t,d))&&v.validation&&(i.push(v.validation.type),a.push(v.validation.operator),o.push(v.validation.value1),s.push(v.validation.value2))}var p=[];for(d=0;d<i.length;d++)-1===p.indexOf(i[d])&&p.push(i[d]);if(p.length>1&&(r=!0),!r){p=[];for(var c=0;c<a.length;c++)-1===p.indexOf(a[c])&&p.push(a[c]);p.length>1&&(r=!0)}if(!r){p=[];for(c=0;c<o.length;c++)-1===p.indexOf(o[c])&&p.push(o[c]);p.length>1&&(r=!0)}if(!r){p=[];for(c=0;c<s.length;c++)-1===p.indexOf(s[c])&&p.push(s[c]);p.length>1&&(r=!0)}if(!r){for(var u=0,f=0,g=e[0];g<=e[2];g++)if(t.rows[g])for(h=e[1];h<=e[3];h++)if(t.rows[g].cells&&t.rows[g].cells[h]){var m;f++,(m=t.rows[g].cells[h]).validation&&u++}if(0===u)for(d=e[1];d<=e[3];d++){var v;(v=Xe(t,d))&&v.validation&&u++}u>0&&f>1&&u!==f&&(n=!0)}return{moreValidation:r,extendValidation:n}},e.prototype.moreValidationDlg=function(){var e=this,t=this.parent.serviceLocator.getService(Fl),r=this.parent.serviceLocator.getService(Al),n=!1,i={width:350,isModal:!0,showCloseIcon:!0,cssClass:"e-goto-dlg",header:t.getConstant("Spreadsheet"),beforeOpen:function(n){var i={dialogName:"MoreValidation",element:n.element,target:n.target,cancel:n.cancel};e.parent.trigger("dialogBeforeOpen",i),i.cancel&&(n.cancel=!0),r.dialogInstance.content=t.getConstant("MoreValidation"),r.dialogInstance.dataBind(),Wt(e.parent.element)},buttons:[{buttonModel:{content:t.getConstant("Ok"),isPrimary:!0,cssClass:"e-btn-goto-ok"},click:function(){r.hide(),n=!0}}],close:function(){n?(e.initiateDataValidationHandler(!0),n=!1):r.hide()}};r.show(i)},e.prototype.extendValidationDlg=function(){var e=this,t=this.parent.serviceLocator.getService(Fl),r=this.parent.serviceLocator.getService(Al),n=!1,i=!1,a={width:550,isModal:!0,showCloseIcon:!0,cssClass:"e-goto-dlg",header:t.getConstant("Spreadsheet"),beforeOpen:function(n){var i={dialogName:"ExtendValidation",element:n.element,target:n.target,cancel:n.cancel};e.parent.trigger("dialogBeforeOpen",i),i.cancel&&(n.cancel=!0),r.dialogInstance.content=t.getConstant("ExtendValidation"),r.dialogInstance.dataBind(),Wt(e.parent.element)},buttons:[{buttonModel:{content:t.getConstant("Yes"),isPrimary:!0,cssClass:"e-btn-goto-ok"},click:function(){r.hide(),n=!0}},{buttonModel:{content:t.getConstant("No"),isPrimary:!0,cssClass:"e-btn-goto-ok"},click:function(){r.hide(),n=!0,i=!0}}],close:function(){n?(e.initiateDataValidationHandler(!0,i),n=!1):r.hide()}};r.show(a)},e.prototype.userInput=function(e,t){for(var r=this.parent.element.querySelector(".e-datavalidation-dlg").querySelector(".e-validation-dlg"),n=r.querySelector(".e-allowdata"),i=r.querySelector(".e-values"),s=this.parent.serviceLocator.getService(Fl),l=n.querySelector(".e-data");i.lastChild;)i.removeChild(i.lastChild);if(e.value===s.getConstant("List")){for(;l.lastChild;)l.removeChild(l.lastChild);var h=this.parent.createElement("input",{className:"e-checkbox"});l.appendChild(h);new o.CheckBox({label:s.getConstant("InCellDropDown"),checked:!0}).appendTo(h)}else if(l.getElementsByClassName("e-checkbox-wrapper")[0]){for(;l.lastChild;)l.removeChild(l.lastChild);var d=this.parent.createElement("span",{className:"e-header"});d.innerText=s.getConstant("Data");var p=this.parent.createElement("input",{className:"e-select"});l.appendChild(d),l.appendChild(p),t.appendTo(p)}if(e.value===s.getConstant("List")||t.value!==s.getConstant("Between")&&t.value!==s.getConstant("NotBetween")){var c=this.parent.createElement("span",{className:"e-header"});c.innerText=e.value===s.getConstant("List")?s.getConstant("Sources"):s.getConstant("Value");var u=e.value===s.getConstant("List")?this.parent.createElement("input",{className:"e-input",attrs:{placeholder:"Enter value"}}):this.parent.createElement("input",{className:"e-input",attrs:{value:"0"}});i.appendChild(c),i.appendChild(u)}else{var f=this.parent.createElement("div",{className:"e-minimum"}),g=this.parent.createElement("div",{className:"e-maximum"});i.appendChild(f),i.appendChild(g);var m=this.parent.createElement("span",{className:"e-header"});m.innerText=s.getConstant("Minimum");var v=this.parent.createElement("span",{className:"e-header"});v.innerText=s.getConstant("Maximum");var y=this.parent.createElement("input",{id:"min",className:"e-input",attrs:{value:"0"}}),C=this.parent.createElement("input",{id:"max",className:"e-input",attrs:{value:"0"}});new a.NumericTextBox({value:0}).appendTo("min");new a.NumericTextBox({value:0}).appendTo("max"),f.appendChild(m),f.appendChild(y),g.appendChild(v),g.appendChild(C)}},e.prototype.dlgClickHandler=function(e){var t,r=this.parent.serviceLocator.getService(Fl),n=this.parent.element.querySelector(".e-datavalidation-dlg"),i=n.querySelector(".e-footer-content"),a=n.getElementsByClassName("e-dlg-content")[0].getElementsByClassName("e-validation-dlg")[0],o=a.getElementsByClassName("e-allowdata")[0],s=o.getElementsByClassName("e-allow")[0].getElementsByTagName("input")[0],l=o.getElementsByClassName("e-data")[0].getElementsByTagName("input")[0],h=a.getElementsByClassName("e-values")[0],d=[];d[0]=h.getElementsByTagName("input")[0].value,d[1]=h.getElementsByTagName("input")[1]?h.getElementsByTagName("input")[1].value:"",ae(d,this.parent.locale);var p,c=a.querySelector(".e-ignoreblank .e-checkbox").checked,f=o.querySelector(".e-data").querySelector(".e-checkbox-wrapper")?!!o.querySelector(".e-data").querySelector(".e-checkbox-wrapper").querySelector(".e-check"):null,g=a.querySelector(".e-cellrange").getElementsByTagName("input")[0].value,m=this.formattedType(s.value);l&&(p=l.value,p=this.formattedValue(p));var v=[],y=[];""!==d[0]&&y.push(d[0]),""!==d[1]&&y.push(d[1]);var C=!0;if("List"===m)if(-1!==d[0].indexOf("=")){if(-1!==d[0].indexOf(":")){var b=d[0].indexOf("!")>-1?d[0].split("!")[1]:d[0].split("=")[1],x=!(d[0].indexOf("!")>-1)||ce(this.parent,d[0].split("=")[1].split("!")[0])>-1;v=b.split(":");var S=!!b.match(/[a-z]/gi)&&v[0].replace(/[0-9]/g,"")===v[1].replace(/[0-9]/g,""),w=!!b.match(/\d/g)&&v[0].replace(/\D/g,"")===v[1].replace(/\D/g,"");(C=!!x&&(!!S||!!w))||(t=r.getConstant("DialogError"))}}else d[0].length>256&&(C=!1,t=r.getConstant("ListLengthError"));if(C){var I=this.parent.getActiveSheet(),E=this.isDialogValidator(y,m,p);if("Between"===p&&E.isValidate&&!isNaN(parseFloat(y[0]))&&!isNaN(parseFloat(y[1]))&&parseFloat(y[0])>parseFloat(y[1])&&(E.isValidate=!1,E.errorMsg=r.getConstant("MinMaxError")),t=E.errorMsg,C=E.isValidate){var R=u(I.activeCell),k=Re(R[0],R[1],I,!1,!0),F=k.validation&&"List"===k.validation.type,A={range:I.name+"!"+g,value1:y[0],value2:y[1]||"",ignoreBlank:c,type:m,operator:p,inCellDropDown:f,cancel:!1};if(this.parent.notify(Ar,{eventArgs:A,action:"validation"}),!A.cancel){if(this.parent.notify(En,{rules:{type:A.type,operator:A.operator,value1:A.value1,value2:A.value2,ignoreBlank:A.ignoreBlank,inCellDropDown:A.inCellDropDown},range:A.range}),(k=Re(R[0],R[1],I,!1,!0)).validation){if(F){var N=this.parent.getCell(R[0],R[1]);N&&N.getElementsByClassName("e-validation-list")[0]&&(this.listObj.destroy(),N.removeChild(N.getElementsByClassName("e-validation-list")[0]))}"List"===k.validation.type&&this.listHandler()}delete A.cancel,document.getElementsByClassName("e-validation-error-dlg")[0]||(e.dialogInstance?e.dialogInstance.hide():e.hide()),this.parent.notify(Yo,{eventArgs:A,action:"validation"})}}}if(!C){var O=this.parent.createElement("div",{className:"e-dlg-error",id:"e-invalid"});O.innerText=t,h.appendChild(O),i.querySelector(".e-primary").setAttribute("disabled","true")}},e.prototype.formattedValue=function(e){var t=this.parent.serviceLocator.getService(Fl);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},e.prototype.formattedType=function(e){var t=this.parent.serviceLocator.getService(Fl);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},e.prototype.isDialogValidator=function(e,t,r){var n,i=this.parent.serviceLocator.getService(Fl),a=0;if("List"===t?!(e.length>0):"Between"===r||"NotBetween"===r?2!==e.length:!(e.length>0))n={isValidate:!1,errorMsg:i.getConstant("EmptyError")};else{for(var o=void 0,s=0;s<e.length&&(B(e[s])?o=this.parent.computeExpression(e[s]).toString():"Date"===t||"Time"===t?(o=this.getDateAsNumber({range:[],cell:{value:e[s]}},e[s]),"Date"===t&&(e[s]=o)):o=e[s],(n=this.formatValidation(o,t,!0)).isValidate);s++)a+=1;n.isValidate=a===e.length}return{isValidate:n.isValidate,errorMsg:n.errorMsg}},e.prototype.getDateAsNumber=function(e,t){var r={value:t,rowIndex:e.range[0],cell:e.cell,colIndex:e.range[1],sheetIndex:e.sheetIdx,updatedVal:""};return this.parent.notify(Wr,r),r.updatedVal||t},e.prototype.isValidationHandler=function(e){var r=this.parent.serviceLocator.getService(Fl);e.value=e.value?e.value:"";var n,i,a,o=e.value,s=this.parent.sheets[e.sheetIdx],l=Re(e.range[0],e.range[1],s),h=Xe(s,e.range[1]);if(l&&l.validation?a=l.validation:Je(h,e.range[0],e.range[1])&&(a=h.validation),a){var d=a.value1,p=a.value2;B(d)&&"List"!==a.type&&(d=this.parent.computeExpression(d).toString()),B(p)&&"List"!==a.type&&(p=this.parent.computeExpression(p).toString()),B(e.value)&&"List"!==a.type&&(e.value=this.parent.computeExpression(e.value).toString());var c=e.value,u=a.operator||"Between",f=a.type||"WholeNumber",g=!!t.isNullOrUndefined(a.ignoreBlank)||a.ignoreBlank;if(g&&""===o)n=!0;else{var m="Date"===f||"Time"===f;if(e.value&&!D(e.value))if(m||"TextLength"===a.type)c=e.value=this.getDateAsNumber(e,e.value);else{var v=l&&l.format,y=void 0;if(v){if("@"!==v)try{for(var C=Ne(v);C;)C=Ne(v=v.split("["+C+"]").join(""));var b=new t.Internationalization(this.parent.locale),x=t.getNumberDependable(Fl,t.defaultCurrencyCode);if("$"!==x&&v.includes("$")&&e.value.includes(x)&&(v=v.split("$").join(x)),v.includes("%")&&e.value.indexOf("%")>0){y=b.getNumberParser({format:"n"})(e.value);'"'!==v[(I=v.indexOf("%"))-1]&&(y/=100)}else y=b.getNumberParser({format:v})(e.value)}catch(t){y=e.value}}else{var S={formattedText:e.value,value:e.value,format:"General",cell:{value:e.value,format:"General"}};this.parent.notify(Mr,S),y=S.value}y!==e.value&&D(y)&&(c=e.value=y.toString())}var w=this.formatValidation(e.value,f);if(n=w.isValidate,i=w.errorMsg,n)if(n=!1,m?(d&&!D(d)&&(d=this.getDateAsNumber(e,d)),p&&!D(p)&&(p=this.getDateAsNumber(e,p))):"TextLength"===a.type&&(c=e.value.toString().length.toString()),"List"===f){if(-1!==d.indexOf("=")){this.data=t.isNullOrUndefined(this.data)||this.data.length?this.data:this.updateDataSource(l,a);for(var I=0;I<this.data.length;I++)e.value.toString()===this.data[I].text&&(n=!0)}else{var E=d.split(",");for(I=0;I<E.length;I++)e.value.toString()===E[I]&&(n=!0)}!n&&g&&""===e.value.toString()&&(n=!0)}else switch("Decimal"===f||"Time"===f?(c=parseFloat(c.toString()),d=parseFloat(d.toString()),p=p?parseFloat(p.toString()):null):(c=parseInt(c.toString(),10),d=parseInt(d.toString(),10),p=p?parseInt(p.toString(),10):null),u){case"EqualTo":n=c===d||!(!g||""!==o);break;case"NotEqualTo":n=c!==d||!(!g||""!==o);break;case"Between":n=c>=d&&c<=p||!(!g||""!==o);break;case"NotBetween":n=!(c>=d&&c<=p);break;case"GreaterThan":n=c>d||!(!g||""!==o);break;case"LessThan":n=c<d||!(!g||""!==o);break;case"GreaterThanOrEqualTo":n=c>=d||!(!g||""!==o);break;case"LessThanOrEqualTo":n=c<=d||!(!g||""!==o)}}}if(i=r.getConstant("ValidationError"),n&&(l&&l.validation&&l.validation.isHighlighted||h&&h.validation&&h.validation.isHighlighted)){var R=this.parent.getCellStyleValue(["backgroundColor","color"],[e.range[0],e.range[1]]);je(s,e.range[0])||this.parent.notify(_r,{style:R,rowIdx:e.range[0],colIdx:e.range[1],isHeightCheckNeeded:!0,manualUpdate:!0,onActionUpdate:!0,td:e.td})}return{isValidate:n,errorMsg:i}},e.prototype.checkDataValidation=function(e){var t=Re(e.range[0],e.range[1],this.parent.getActiveSheet());e.td=e.td||this.parent.getCell(e.range[0],e.range[1]),e.sheetIdx=e.sheetIdx||this.parent.activeSheetIndex;var r={skip:!1,value:""};if(t&&t.validation){if(B(t.validation.value1)&&!U(t.validation.value1.substring(1,t.validation.value1.length))&&t.validation.value1.indexOf("(")>-1){var n=t.validation.value1;n=n.substring(n.indexOf("=")+1,n.indexOf("(")),r.value=n.toUpperCase(),this.parent.notify(sn,r)}if(!r.skip&&B(t.validation.value2)&&!U(t.validation.value2.substring(1,t.validation.value2.length))&&t.validation.value1.indexOf("(")>-1){var i=t.validation.value2;i=i.substring(i.indexOf("=")+1,i.indexOf("(")),r.value=i.toUpperCase(),this.parent.notify(sn,r)}}if(!r.skip){var a=this.isValidationHandler(e);!a.isValidate&&e.isCell&&this.validationErrorHandler(a.errorMsg),e.isValid=a.isValidate}},e.prototype.formatValidation=function(e,t,r){var n,i=this.parent.element.getElementsByClassName("e-sheet-panel")[0],o=this.parent.createElement("form",{id:"formId",className:"form-horizontal"}),s=this.parent.createElement("input",{id:"e-validation"});if(s.setAttribute("name","validation"),s.setAttribute("type","text"),"Date"===t&&D(e)){var l=e.toString().split(".");2==l.length&&(e=l[0])}s.setAttribute("value",e),o.appendChild(s),i.appendChild(o);var h;switch(t){case"Date":h={rules:{validation:{date:!0}},customPlacement:function(e,t){n=t.innerText}};break;case"Decimal":h={rules:{validation:{number:!0}},customPlacement:function(e,t){n=t.innerText}};break;case"WholeNumber":h={rules:{validation:{regex:/^-?\d*\.?[0]*$/}},customPlacement:function(e,t){n=t.innerText}};break;case"TextLength":r&&(h={rules:{validation:{regex:/^\d*\.?[0]*$/}},customPlacement:function(e,t){n=t.innerText}})}var d=new a.FormValidator("#formId",h).validate();return i.removeChild(i.getElementsByClassName("form-horizontal")[0]),{isValidate:d,errorMsg:n}},e.prototype.InvalidElementHandler=function(e){var t=e.rowIdx,r=e.colIdx,n=e.isRemoveHighlightedData;if(n){if(n){var i=this.parent.getCellStyleValue(["backgroundColor","color"],[t,r]);this.parent.notify(_r,{style:i,rowIdx:t,colIdx:r,td:e.td})}}else this.parent.notify(_r,{style:{backgroundColor:"#ffff00",color:"#ff0000"},rowIdx:t,colIdx:r,td:e.td})},e.prototype.validationErrorHandler=function(e){var t=this,r=document.getElementsByClassName("e-spreadsheet-edit")[0],n=this.parent.serviceLocator.getService(Fl);if(!this.parent.element.querySelector(".e-validation-error-dlg")){var i=this.parent.serviceLocator.getService(Al),a={width:400,height:200,isModal:!0,showCloseIcon:!0,cssClass:"e-validation-error-dlg",target:document.querySelector(".e-control.e-spreadsheet"),beforeOpen:function(n){var a={dialogName:"ValidationErrorDialog",element:n.element,target:n.target,cancel:n.cancel,content:e};t.parent.trigger("dialogBeforeOpen",a),a.cancel&&(t.errorDlgHandler(i,"Cancel"),n.cancel=!0),r.focus(),i.dialogInstance.content=a.content,i.dialogInstance.dataBind()},buttons:[{buttonModel:{content:n.getConstant("Retry"),isPrimary:!0},click:function(){t.errorDlgHandler(i,"Retry")}},{buttonModel:{content:n.getConstant("Cancel")},click:function(){t.errorDlgHandler(i,"Cancel")}}]};i.show(a,!1)}},e.prototype.errorDlgHandler=function(e,t){if("Retry"===t){var r=document.getElementsByClassName("e-spreadsheet-edit")[0];e.hide(),r.innerText&&(window.getSelection().selectAllChildren(r),this.listObj&&!this.listObj.isDestroyed&&this.listObj.showPopup())}else{var n=u(this.parent.getActiveSheet().activeCell),i=Re(n[0],n[1],this.parent.getActiveSheet()),a=i?this.parent.getDisplayText(i):"";this.parent.notify(Da,{action:"cancelEdit",value:a,refreshFormulaBar:!0,refreshEditorElem:!0,isAppend:!1,trigEvent:!0}),e.hide()}},e.prototype.getModuleName=function(){return"dataValidation"},e}(),ph=function(){function e(e){this.password="",this.parent=e,this.init()}return e.prototype.init=function(){this.addEventListener()},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.addEventListener=function(){this.parent.on(rs,this.protect,this),this.parent.on(ts,this.protectSheetHandler,this),this.parent.on(ss,this.editProtectedAlert,this),this.parent.on(Xs,this.protectWorkbook,this),this.parent.on(Ha,this.KeyUpHandler,this),this.parent.on(Ks,this.unProtectWorkbook,this),this.parent.on(hl,this.unProtectSheetPassword,this),this.parent.on($s,this.getPassWord,this),this.parent.on(Js,this.importProtectWorkbook,this),this.parent.on(Zs,this.protectWorkbookHandler,this),this.parent.on(Qs,this.removeWorkbookProtection,this),this.parent.on(ml,this.toggleProtect,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(rs,this.protect),this.parent.off(ts,this.protectSheetHandler),this.parent.off(ss,this.editProtectedAlert),this.parent.off(Xs,this.protectWorkbook),this.parent.off(Ha,this.KeyUpHandler),this.parent.off(Ks,this.unProtectWorkbook),this.parent.off(hl,this.unProtectSheetPassword),this.parent.off($s,this.getPassWord),this.parent.off(Js,this.importProtectWorkbook),this.parent.off(Zs,this.protectWorkbookHandler),this.parent.off(Qs,this.removeWorkbookProtection),this.parent.off(ml,this.toggleProtect))},e.prototype.protect=function(e){if(e.isActive){var t=this.parent.getActiveSheet();t.isImportProtected&&(t.isImportProtected=!1)}this.parent.notify(io,null),e.isActive?(this.parent.setSheetPropertyOnMute(Ce(this.parent,e.sheetIndex),"isProtected",!1),this.parent.notify(Ro,{props:"Protect"}),this.parent.notify(ts,e),this.parent.notify(ds,null)):this.createDialogue()},e.prototype.createDialogue=function(){var e=this,r=this.parent.serviceLocator.getService(Fl),n=[{text:r.getConstant("SelectCells"),id:"1"},{text:r.getConstant("SelectUnlockedCells"),id:"6"},{text:r.getConstant("FormatCells"),id:"2"},{text:r.getConstant("FormatRows"),id:"3"},{text:r.getConstant("FormatColumns"),id:"4"},{text:r.getConstant("InsertLinks"),id:"5"}];this.optionList=new l.ListView({width:"250px",dataSource:n,showCheckBox:!0,select:this.dialogOpen.bind(this)});var i=this.parent.createElement("div",{className:"e-sheet-password-dialog"}),a=this.parent.createElement("div",{className:"e-sheet-password-content"}),s=this.parent.createElement("div",{className:"e-header"});s.innerText=r.getConstant("SheetPassword");var h=this.parent.createElement("input",{className:"e-input e-text",attrs:{type:"password"}});h.setAttribute("placeholder",r.getConstant("EnterThePassword")),a.appendChild(h),a.insertBefore(s,h),i.appendChild(a);var d=this.parent.createElement("div",{className:"e-protect-content"});d.innerText=r.getConstant("ProtectAllowUser"),this.parent.setSheetPropertyOnMute(this.parent.getActiveSheet(),"isProtected",!1);var p=new o.CheckBox({checked:!0,label:r.getConstant("ProtectContent"),cssClass:"e-protect-checkbox"}),c=this.parent.createElement("div",{className:"e-protect-option-list",id:this.parent.element.id+"_option_list"}),u=this.parent.createElement("div",{className:"e-header-content"});u.innerText=r.getConstant("ProtectSheet");var f=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:u.outerHTML,content:i.outerHTML+f.outerHTML+d.outerHTML+c.outerHTML,showCloseIcon:!0,isModal:!0,cssClass:"e-protect-dlg",beforeOpen:function(t){var r={dialogName:"ProtectSheetDialog",element:t.element,target:t.target,cancel:t.cancel};e.parent.trigger("dialogBeforeOpen",r),r.cancel&&(t.cancel=!0),Wt(e.parent.element)},beforeClose:function(){t.EventHandler.remove(p.element,"click",e.checkBoxClickHandler)},buttons:[{click:this.selectOption.bind(this,this.dialog,this),buttonModel:{content:r.getConstant("Ok"),isPrimary:!0}},{click:function(){return e.dialog.hide()},buttonModel:{content:r.getConstant("Cancel")}}]},!1),this.protectSheetDialog=this.dialog.dialogInstance,p.appendTo("#"+this.parent.element.id+"_protect_check"),this.optionList.appendTo("#"+this.parent.element.id+"_option_list"),this.optionList.selectMultipleItems([{id:"1"},{id:"6"}]),t.EventHandler.add(p.element,"click",this.checkBoxClickHandler,this)},e.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},e.prototype.dialogOpen=function(e){var t=this.parent.serviceLocator.getService(Fl);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"})},e.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&&Gt(this.parent,c(e.selectedRange))&&this.parent.notify(ll,null):this.parent.notify(ll,null)):this.reEnterSheetPassword()},e.prototype.selectSheetPassword=function(){var e=this.parent.serviceLocator.getService(Fl),r=this.parent.getActiveSheet(),n=this.parent.element.querySelector(".e-sheet-password-dialog").getElementsByClassName("e-sheet-password-content")[0].querySelector(".e-input"),i=this.parent.element.querySelector(".e-reenterpwd-dialog").getElementsByClassName("e-reenterpwd-content")[0].querySelector(".e-input"),a=this.parent.createElement("span",{className:"e-reenterpwd-alert-span"});if(n.value===i.value){this.parent.setSheetPropertyOnMute(r,"isProtected",!0),this.parent.setSheetPropertyOnMute(r,"password",n.value),this.updateProtectSheet(n.value),this.dialog.hide(),this.protectSheetDialog&&(this.protectSheetDialog=null);var o=document.querySelector(".e-protect-dlg.e-dialog");t.getComponent(o,"dialog").destroy(),r.protectSettings.selectCells||r.protectSettings.selectUnLockedCells||this.parent.notify(ll,null)}else""===n.value?a.textContent=e.getConstant("PasswordAlertMsg"):""===i.value?a.textContent=e.getConstant("ConfirmPasswordAlertMsg"):n.value!==i.value&&(a.textContent=e.getConstant("PasswordAlert")),this.parent.element.querySelector(".e-reenterpwd-dlg").querySelector(".e-reenterpwd-dialog").appendChild(a)},e.prototype.updateProtectSheet=function(e){var t=this.parent.serviceLocator.getService(Fl),r=this.optionList.getSelectedItems(),n={selectCells:r.text.indexOf(t.getConstant("SelectCells"))>-1,formatCells:r.text.indexOf(t.getConstant("FormatCells"))>-1,formatRows:r.text.indexOf(t.getConstant("FormatRows"))>-1,formatColumns:r.text.indexOf(t.getConstant("FormatColumns"))>-1,insertLink:r.text.indexOf(t.getConstant("InsertLinks"))>-1,selectUnLockedCells:r.text.indexOf(t.getConstant("SelectUnlockedCells"))>-1};this.parent.notify(Hn,{protectSettings:n,password:e,triggerEvent:!0}),this.parent.notify(ds,null),this.parent.notify(Bo,null)},e.prototype.protectSheetHandler=function(e){var r=t.isNullOrUndefined(e&&e.sheetIndex)?this.parent.activeSheetIndex:e.sheetIndex,n=Ce(this.parent,r),i=this.parent.element.id,a=[i+"_undo",i+"_redo",i+"_cut",i+"_copy",i+"_paste",i+"_number_format",i+"_font_name",i+"_font_size",i+"_bold",i+"_italic",i+"_line-through",i+"_underline",i+"_font_color_picker",i+"_fill_color_picker",i+"_borders",i+"_merge_cells",i+"_text_align",i+"_vertical_align",i+"_wrap",i+"_sorting",i+"_clear",i+"_conditionalformatting"],o=[i+"_cut",i+"_copy",i+"_number_format",i+"_font_name",i+"_font_size",i+"_bold",i+"_italic",i+"_line-through",i+"_underline",i+"_font_color_picker",i+"_fill_color_picker",i+"_borders",i+"_text_align",i+"_vertical_align",i+"_wrap",i+"_sorting",i+"_clear",i+"_conditionalformatting"],s=[i+"_insert_function"],l=[i+"_hyperlink",i+"_",i+"_chart"],h=[i+"_image"],d=[i+"_find"],p=[i+"_datavalidation"],u=[i+"_chart"],f=document.getElementById(this.parent.element.id+"_sheet_panel");f&&(n.isProtected?n.protectSettings.selectCells?f.classList.remove("e-protected"):n.protectSettings.selectUnLockedCells&&!Gt(this.parent,c(n.selectedRange))?f.classList.remove("e-protected"):f.classList.add("e-protected"):f.classList.add("e-protected"),n.isProtected||f.classList.remove("e-protected")),this.parent.dataBind(),this.parent.notify(ns,{disableHomeBtnId:a,enableHomeBtnId:o,enableFrmlaBtnId:s,enableInsertBtnId:l,findBtnId:d,dataValidationBtnId:p,imageBtnId:h,chartBtnId:u}),this.parent.notify(hs,null),n.isProtected&&this.parent.notify(Ro,{props:"Protect"}),e&&e.triggerEvent&&this.parent.notify(Yo,{action:"protectSheet",eventArgs:{sheetIndex:r,isProtected:n.isProtected,password:n.password,protectSettings:n.protectSettings.properties||n.protectSettings}})},e.prototype.editProtectedAlert=function(){var e=this,t=this.parent.serviceLocator.getService(Fl);this.dialog=this.parent.serviceLocator.getService("dialog"),this.dialog.show({content:t.getConstant("EditAlert"),isModal:!0,closeOnEscape:!0,showCloseIcon:!0,width:"400px",cssClass:"e-editAlert-dlg",beforeOpen:function(r){var n={dialogName:"EditAlertDialog",content:t.getConstant("EditAlert"),element:r.element,target:r.target,cancel:r.cancel};e.parent.trigger("dialogBeforeOpen",n),n.cancel&&(r.cancel=!0,tt(function(){return e.dialog.destroyDialog()})),e.dialog.dialogInstance.content=n.content,Wt(e.parent.element)},close:function(){return Wt(e.parent.element)}})},e.prototype.protectWorkbook=function(){var e=this,t=this.parent.serviceLocator.getService(Fl),r=this.parent.serviceLocator.getService(Al);r.show({width:323,isModal:!0,showCloseIcon:!0,cssClass:"e-protectworkbook-dlg",header:t.getConstant("ProtectWorkbook"),beforeOpen:function(t){var n={dialogName:"ProtectWorkbook",element:t.element,target:t.target,cancel:t.cancel};e.parent.trigger("dialogBeforeOpen",n),n.cancel&&(t.cancel=!0),r.dialogInstance.content=e.passwordProtectContent(),r.dialogInstance.dataBind(),e.parent.element.focus()},buttons:[{buttonModel:{content:t.getConstant("Ok"),isPrimary:!0},click:function(){e.alertMessage(),e.dlgClickHandler(r)}}]})},e.prototype.passwordProtectContent=function(){var e=this.parent.serviceLocator.getService(Fl),t=this.parent.createElement("div",{className:"e-password-dialog"}),r=this.parent.createElement("div",{className:"e-password-content"}),n=this.parent.createElement("div",{className:"e-password-content"}),i=this.parent.createElement("div",{className:"e-header"});i.innerText=e.getConstant("Password");var a=this.parent.createElement("div",{className:"e-header"});a.innerText=e.getConstant("ConfirmPassword");var o=this.parent.createElement("input",{className:"e-input e-text",attrs:{type:"password"}}),s=this.parent.createElement("input",{className:"e-input e-text",attrs:{type:"password"}});return o.setAttribute("placeholder",e.getConstant("EnterThePassword")),s.setAttribute("placeholder",e.getConstant("EnterTheConfirmPassword")),r.appendChild(o),r.insertBefore(i,o),n.appendChild(s),n.insertBefore(a,s),t.appendChild(n),t.insertBefore(r,n),t},e.prototype.KeyUpHandler=function(e){var r=e.target;if(r.classList.contains("e-text")&&t.closest(r,".e-password-content")&&t.closest(r,".e-password-dialog")&&t.closest(r,".e-password-dialog").getElementsByClassName("e-password-content")[1]===r.parentElement){var n=t.closest(r,".e-protectworkbook-dlg").getElementsByClassName("e-footer-content")[0].firstChild;""!==r.value?n.removeAttribute("disabled"):n.setAttribute("disabled","true")}if(r.classList.contains("e-text")&&t.closest(r,".e-unprotectpwd-content")&&t.closest(r,".e-unprotectpwd-dialog")&&t.closest(r,".e-unprotectpwd-dialog").getElementsByClassName("e-unprotectpwd-content")[0]===r.parentElement){var i=t.closest(r,".e-unprotectworkbook-dlg").getElementsByClassName("e-footer-content")[0].firstChild;""!==r.value?i.removeAttribute("disabled"):i.setAttribute("disabled","true")}if(r.classList.contains("e-text")&&t.closest(r,".e-reenterpwd-content")&&t.closest(r,".e-reenterpwd-dialog")&&t.closest(r,".e-reenterpwd-dialog").getElementsByClassName("e-reenterpwd-content")[0]===r.parentElement){var a=t.closest(r,".e-reenterpwd-dlg").getElementsByClassName("e-footer-content")[0].firstChild;""!==r.value?a.removeAttribute("disabled"):a.setAttribute("disabled","true")}if(r.classList.contains("e-text")&&t.closest(r,".e-unprotectsheetpwd-content")&&t.closest(r,".e-unprotectsheetpwd-dialog")&&t.closest(r,".e-unprotectsheetpwd-dialog").getElementsByClassName("e-unprotectsheetpwd-content")[0]===r.parentElement){var o=t.closest(r,".e-unprotectworksheet-dlg").getElementsByClassName("e-footer-content")[0].firstChild;""!==r.value?o.removeAttribute("disabled"):o.setAttribute("disabled","true")}if(r.classList.contains("e-text")&&t.closest(r,".e-importprotectpwd-content")&&t.closest(r,".e-importprotectpwd-dialog")&&t.closest(r,".e-importprotectpwd-dialog").getElementsByClassName("e-importprotectpwd-content")[0]===r.parentElement){o=t.closest(r,".e-importprotectworkbook-dlg").getElementsByClassName("e-footer-content")[0].firstChild;""!==r.value?o.removeAttribute("disabled"):o.setAttribute("disabled","true")}},e.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()},e.prototype.dlgClickHandler=function(e){var t=this.parent.serviceLocator.getService(Fl),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(Ro,{props:"Protectworkbook"}),this.protectWorkbookHandler({password:r.value}),this.parent.notify(Yo,{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)},e.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(Ro,{props:"Protectworkbook"})},e.prototype.unProtectWorkbook=function(){var e=this,t=this.parent.serviceLocator.getService(Fl),r=this.parent.serviceLocator.getService(Al);r.show({width:323,isModal:!0,showCloseIcon:!0,cssClass:"e-unprotectworkbook-dlg",header:t.getConstant("UnprotectWorkbook"),beforeOpen:function(t){var n={dialogName:"UnprotectWorkbook",element:t.element,target:t.target,cancel:t.cancel};e.parent.trigger("dialogBeforeOpen",n),n.cancel&&(t.cancel=!0),r.dialogInstance.content=e.unProtectPasswordContent(),r.dialogInstance.dataBind(),e.parent.element.focus()},buttons:[{buttonModel:{content:t.getConstant("Ok"),isPrimary:!0,disabled:!0},click:function(){e.alertMessage(),e.unprotectdlgOkClick(r)}}]})},e.prototype.unProtectsheet=function(e){var t=this,r=this.parent.serviceLocator.getService(Fl),n=this.parent.serviceLocator.getService(Al);n.show({width:323,isModal:!0,showCloseIcon:!0,cssClass:"e-unprotectworksheet-dlg",header:r.getConstant("UnprotectWorksheet"),beforeOpen:function(e){var r={dialogName:"UnProtectSheet",element:e.element,target:e.target,cancel:e.cancel};t.parent.trigger("dialogBeforeOpen",r),r.cancel&&(e.cancel=!0),n.dialogInstance.content=t.unProtectSheetPasswordContent(),n.dialogInstance.dataBind(),t.parent.element.focus()},buttons:[{buttonModel:{content:r.getConstant("Ok"),isPrimary:!0,disabled:!this.parent.allowOpen||!this.parent.openModule.isImportedFile||-1!==this.parent.openModule.unProtectSheetIdx.indexOf(this.parent.activeSheetIndex)},click:function(){t.alertMessage(),t.unprotectSheetdlgOkClick(n,e)}}]})},e.prototype.reEnterSheetPassword=function(){var e=this,t=this.parent.serviceLocator.getService(Fl),r=this.parent.serviceLocator.getService(Al);r.show({width:323,isModal:!0,showCloseIcon:!0,cssClass:"e-reenterpwd-dlg",header:t.getConstant("ConfirmPassword"),beforeOpen:function(t){var n={dialogName:"Re-enterPassword",element:t.element,target:t.target,cancel:t.cancel};e.parent.trigger("dialogBeforeOpen",n),n.cancel&&(t.cancel=!0),r.dialogInstance.content=e.reEnterSheetPasswordContent(),r.dialogInstance.dataBind();Wt(e.parent.element.querySelector(".e-protect-dlg.e-dialog .e-footer-content .e-btn")||e.parent.element)},close:function(){e.dialog.dialogInstance=e.protectSheetDialog},buttons:[{buttonModel:{content:t.getConstant("Ok"),isPrimary:!0,disabled:!0},click:function(){e.alertMessage(),e.selectSheetPassword()}}]})},e.prototype.unProtectPasswordContent=function(){var e=this.parent.serviceLocator.getService(Fl),t=this.parent.createElement("div",{className:"e-unprotectpwd-dialog"}),r=this.parent.createElement("div",{className:"e-unprotectpwd-content"}),n=this.parent.createElement("div",{className:"e-header"});n.innerText=e.getConstant("EnterThePassword");var i=this.parent.createElement("input",{className:"e-input e-text",attrs:{type:"password"}});return r.appendChild(i),r.insertBefore(n,i),t.appendChild(r),t},e.prototype.reEnterSheetPasswordContent=function(){var e=this.parent.serviceLocator.getService(Fl),t=this.parent.createElement("div",{className:"e-reenterpwd-dialog"}),r=this.parent.createElement("div",{className:"e-reenterpwd-content"}),n=this.parent.createElement("div",{className:"e-header"});n.innerText=e.getConstant("ReEnterPassword");var i=this.parent.createElement("input",{className:"e-input e-text",attrs:{type:"password"}});return r.appendChild(i),r.insertBefore(n,i),t.appendChild(r),t},e.prototype.unProtectSheetPasswordContent=function(){var e=this.parent.serviceLocator.getService(Fl),t=this.parent.createElement("div",{className:"e-unprotectsheetpwd-dialog"}),r=this.parent.createElement("div",{className:"e-unprotectsheetpwd-content"}),n=this.parent.createElement("div",{className:"e-header"});n.innerText=e.getConstant("EnterThePassword");var i=this.parent.createElement("input",{className:"e-input e-text",attrs:{type:"password"}});return r.appendChild(i),r.insertBefore(n,i),t.appendChild(r),t},e.prototype.unprotectdlgOkClick=function(e){var t=this.parent.serviceLocator.getService(Fl),r=this.parent.element.querySelector(".e-unprotectpwd-dialog").getElementsByClassName("e-unprotectpwd-content")[0].querySelector(".e-input");if(this.parent.password===r.value)e.hide(),this.removeWorkbookProtection(),this.parent.notify(Yo,{action:"protectWorkbook",eventArgs:{isProtected:!1}});else{var n=this.parent.createElement("span",{className:"e-unprotectpwd-alert-span"});n.innerText=t.getConstant("UnprotectPasswordAlert"),this.parent.element.querySelector(".e-unprotectworkbook-dlg").querySelector(".e-dlg-content").appendChild(n)}},e.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(Ro,{props:"Protectworkbook"})},e.prototype.unprotectSheetdlgOkClick=function(e,t){var r=this.parent.serviceLocator.getService(Fl),n=this.parent.getActiveSheet(),i=this.parent.element.querySelector(".e-unprotectsheetpwd-dialog").getElementsByClassName("e-unprotectsheetpwd-content")[0].querySelector(".e-input");if(t&&0===n.password.length){var a={sheetPassword:i.value,sheetIndex:this.parent.activeSheetIndex};this.parent.open(a)}else if(n.password===i.value)e.hide(),this.unProtectSheetPassword();else{var o=this.parent.createElement("span",{className:"e-unprotectsheetpwd-alert-span"});o.innerText=r.getConstant("UnprotectPasswordAlert"),this.parent.element.querySelector(".e-unprotectworksheet-dlg").querySelector(".e-dlg-content").appendChild(o)}},e.prototype.unProtectSheetPassword=function(){var e=this.parent.getActiveSheet(),t=this.parent.activeSheetIndex;this.parent.setSheetPropertyOnMute(e,"isProtected",!e.isProtected),this.parent.setSheetPropertyOnMute(e,"password","");var r=!e.isProtected;this.parent.notify(rs,{isActive:r,id:this.parent.element.id+"_protect",sheetIndex:t,triggerEvent:!0}),this.parent.allowOpen&&this.parent.openModule.isImportedFile&&-1===this.parent.openModule.unProtectSheetIdx.indexOf(t)&&this.parent.openModule.unProtectSheetIdx.push(t)},e.prototype.getPassWord=function(e){e.passWord=this.password},e.prototype.importProtectWorkbook=function(e){var t=this,r=this.parent.serviceLocator.getService(Fl),n=this.parent.serviceLocator.getService(Al);n.show({width:323,isModal:!0,showCloseIcon:!0,cssClass:"e-importprotectworkbook-dlg",header:r.getConstant("UnprotectWorkbook"),beforeOpen:function(r){var i={dialogName:"ImportProtectWorkbook",element:r.element,target:r.target,cancel:r.cancel};t.parent.trigger("dialogBeforeOpen",i),i.cancel&&(r.cancel=!0),n.dialogInstance.content=t.importProtectPasswordContent(e),n.dialogInstance.dataBind(),t.parent.element.focus()},buttons:[{buttonModel:{content:r.getConstant("Ok"),isPrimary:!0,disabled:!0},click:function(){t.alertMessage(),t.importOkClick(e)}}]})},e.prototype.importProtectPasswordContent=function(e){var t=this.parent.serviceLocator.getService(Fl),r=this.parent.createElement("div",{className:"e-importprotectpwd-dialog"}),n=this.parent.createElement("div",{className:"e-importprotectpwd-content"}),i=this.parent.createElement("span",{className:"e-header"});i.innerText='"'+e.file.name+'" '+t.getConstant("IsProtected");var a=this.parent.createElement("input",{className:"e-input e-text",attrs:{type:"password"}});return a.setAttribute("placeholder",t.getConstant("EnterThePassword")),n.appendChild(i),n.appendChild(a),r.appendChild(n),r},e.prototype.importOkClick=function(e){var t=this.parent.element.querySelector(".e-importprotectpwd-dialog").getElementsByClassName("e-importprotectpwd-content")[0].querySelector(".e-input");this.parent.password=t.value;var r={file:e.file,password:t.value};this.parent.open(r)},e.prototype.toggleProtect=function(e){var t,r=this.parent.element.id,n=this.parent.getActiveSheet();n.isProtected&&this.parent.allowOpen&&n.isImportProtected&&this.parent.openModule.isImportedFile&&-1===this.parent.openModule.unProtectSheetIdx.indexOf(this.parent.activeSheetIndex)?this.unProtectsheet(!0):n.password&&n.password.length>0?this.unProtectsheet():(this.parent.setSheetPropertyOnMute(n,"isProtected",!n.isProtected),t=!n.isProtected,this.parent.notify(rs,{isActive:t,id:r+"_protect",sheetIndex:this.parent.activeSheetIndex,triggerEvent:!0}))},e.prototype.getModuleName=function(){return"protectSheet"},e}(),ch=function(){function e(e){this.shortValue="",this.parent=e,this.addEventListener()}return e.prototype.addEventListener=function(){this.parent.on(as,this.renderFindDlg,this),this.parent.on(is,this.renderGotoDlg,this),this.parent.on(kn,this.gotoHandler,this),this.parent.on(os,this.findHandler,this),this.parent.on(Nn,this.showFindAlert,this),this.parent.on(Bn,this.replaceAllDialog,this),this.parent.on(On,this.findKeyUp,this),this.parent.on(Or,this.findToolDlg,this),this.parent.on(So,this.refreshFindDlg,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(as,this.renderFindDlg),this.parent.off(is,this.renderGotoDlg),this.parent.off(kn,this.gotoHandler),this.parent.off(os,this.findHandler),this.parent.off(Nn,this.showFindAlert),this.parent.off(Bn,this.replaceAllDialog),this.parent.off(On,this.findKeyUp),this.parent.off(Or,this.findToolDlg),this.parent.off(So,this.refreshFindDlg))},e.prototype.findToolDlg=function(e){var r=this,a=function(n){var i=r.parent.showRibbon&&r.parent.element.querySelector(".e-ribbon");if(i){var a=e.event&&e.event.target?t.closest(e.event.target,"#"+r.parent.element.id+"_findbtn"):t.select("#"+r.parent.element.id+"_findbtn",i);a&&(n?a.classList.add("e-disabled"):a.classList.remove("e-disabled"),a.disabled=n)}},o=e.dialogEle||this.parent.element.getElementsByClassName("e-findtool-dlg")[0];e.isPublic&&(this.findValue=e.findValue);var s,l,h,d=this.parent.getActiveSheet(),p=function(e){if(l&&(!d.isProtected||d.protectSettings.selectCells||d.protectSettings.selectUnLockedCells)){var t=l.value;if(e&&13===e.keyCode)l.value&&"0 of 0"!==h.textContent&&(r.parent.notify(os,{findOption:e.shiftKey?"prev":"next"}),r.updateCount(h,e.shiftKey));else{var n=void 0;if(""===t)h.textContent="0 of 0",n=!1;else{var i={value:t,mode:"Sheet",isCSen:!1,sheetIndex:r.parent.activeSheetIndex,isEMatch:!1,searchBy:"By Row"};r.parent.notify(Ln,i),h.textContent=i.findCount,n="0 of 0"!==i.findCount}s.enableItems(1,n),s.enableItems(2,n)}}};if(o)if(e.isPublic||e.refreshPosition){if(e.isPublic&&((l=o.querySelector(".e-text-findNext-short")).value=this.findValue,h=o.querySelector(".e-input-group-icon"),s=t.getComponent(o.querySelector(".e-find-toolbar"),"toolbar"),p()),e.refreshPosition){var c=void 0;if(this.parent.getActiveSheet().showHeaders){var u=this.parent.getColumnHeaderContent().parentElement;c=(u&&u.offsetHeight||30)+1}else c=1;o.style.top=c+"px"}}else a(!0),this.findDialog.hide();else{var f=this.parent.createElement("div",{className:"e-input-group"});l=this.parent.createElement("input",{className:"e-input e-text-findNext-short",attrs:{type:"Text"}}),this.findValue&&(l.value=this.findValue);var g=this.parent.serviceLocator.getService(Fl);l.setAttribute("placeholder",g.getConstant("FindValue")),h=this.parent.createElement("span",{className:"e-input-group-icon"});var m,v=d.usedRange.rowIndex*d.usedRange.colIndex>100;l.onkeyup=function(e){v?(m&&clearTimeout(m),m=setTimeout(p.bind(r,e),500)):p(e)},f.appendChild(l),f.appendChild(h);var y=[{type:"Input",template:f},{prefixIcon:"e-icons e-prev-icon",tooltipText:g.getConstant("FindPreviousBtn"),type:"Button",cssClass:"e-findRib-prev",disabled:!0},{prefixIcon:"e-icons e-next-icon",tooltipText:g.getConstant("FindNextBtn"),type:"Button",cssClass:"e-findRib-next",disabled:!0},{type:"Separator"},{prefixIcon:"e-icons e-option-icon",tooltipText:g.getConstant("MoreOptions"),type:"Button",cssClass:"e-findRib-more"},{prefixIcon:"e-icons e-close",tooltipText:g.getConstant("Close"),type:"Button",cssClass:"e-findRib-close"}];s=new i.Toolbar({clicked:function(e){"e-findRib-next"===e.item.cssClass?(r.parent.notify(os,{findOption:"next"}),r.updateCount(h)):"e-findRib-prev"===e.item.cssClass?(r.parent.notify(os,{findOption:"prev"}),r.updateCount(h,!0)):"e-findRib-more"===e.item.cssClass&&(r.findDialog.animationSettings.effect="None",r.findDialog.setProperties({animationSettings:r.findDialog.animationSettings},!0),r.renderFindDlg(),r.findDialog.hide())},width:"auto",height:"auto",items:y,cssClass:"e-find-toolObj",created:function(){s.element.querySelectorAll(".e-toolbar-item .e-tbar-btn").forEach(function(e){return e.removeAttribute("tabindex")})}});var C=this.parent.createElement("div",{className:"e-find-toolbar",attrs:{tabindex:"-1"}});s.createElement=this.parent.createElement,s.appendTo(C),o=this.parent.createElement("div",{className:"e-dlg-div",attrs:{"aria-label":g.getConstant("FindValue")}});var b=this.parent.element.getElementsByClassName("e-sheet-panel")[0],x={cssClass:"e-findtool-dlg",visible:!1,enableRtl:this.parent.enableRtl,target:b,open:function(){if(t.EventHandler.add(document,"click",r.closeDialog,r),r.findValue&&(!d.isProtected||d.protectSettings.selectCells||d.protectSettings.selectUnLockedCells)){var e={value:r.findValue,mode:"Sheet",isCSen:!1,sheetIndex:r.parent.activeSheetIndex,isEMatch:!1,searchBy:"By Row"};r.parent.notify(Ln,e),h.textContent=e.findCount;var n="0 of 0"!==e.findCount;s.enableItems(1,n),s.enableItems(2,n)}else h.textContent="0 of 0";a(!1);var i=s.element.querySelector(".e-input-group");i&&i.addEventListener("focus",function(){var e=s.element.querySelector(".e-text-findNext-short");Wt(e),e.classList.add("e-input-focus"),e.setSelectionRange(0,e.value.length)}),S&&r.findDialog.setProperties({animationSettings:S},!0)},beforeOpen:function(){return Wt(r.parent.element)},beforeClose:function(){r.findValue=l.value||null,s.destroy(),t.EventHandler.remove(document,"click",r.closeDialog)},close:function(){r.findDialog.destroy(),r.findDialog=null,t.detach(o),b.style.position="",Wt(r.parent.element),a(!1)},created:function(){b.style.position="relative",o.style.width=r.parent.getMainContent().offsetWidth+"px",o.style.visibility="hidden",o.style.display="block",r.findDialog.width=2*parseInt(getComputedStyle(o).borderLeftWidth,10)+o.querySelector(".e-toolbar-items").getBoundingClientRect().width+"px",o.style.display="",o.style.width="",o.style.visibility="",o.style.top=(e&&e.headerHgt||r.parent.getColumnHeaderContent().parentElement.offsetHeight+1)+"px",o.style.left="",o.style[r.parent.enableRtl?"left":"right"]=r.parent.sheetModule.getScrollSize()+"px",r.findDialog.show()}};t.Browser.isDevice?(x.header=C,x.allowDragging=!0):x.content=C,this.findDialog=new n.Dialog(x),this.findDialog.createElement=this.parent.createElement;var S;e&&e.isPublic&&(S={effect:this.findDialog.animationSettings.effect},this.findDialog.setProperties({animationSettings:{effect:"None"}},!0)),this.findDialog.appendTo(o)}},e.prototype.refreshFindDlg=function(e){var t=this.findDialog&&this.parent.element.getElementsByClassName("e-findtool-dlg")[0];if(t){var r=t.querySelector(".e-text-findNext-short");this.findToolDlg({findValue:r.value,isPublic:!0,refreshPosition:!0,dialogEle:t})}},e.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(" ")},e.prototype.closeDialog=function(e){!t.closest(e.target,".e-findRib-close")&&t.closest(e.target,".e-spreadsheet")||!this.findDialog||this.findToolDlg({})},e.prototype.renderFindDlg=function(){var e=this,r=this.parent.serviceLocator.getService(Al);if(this.parent.element.querySelector(".e-find-dlg"))r.hide();else{var n=this.parent.serviceLocator.getService(Fl),i={isModal:!1,showCloseIcon:!0,cssClass:"e-find-dlg",header:n.getConstant("FindAndReplace"),beforeOpen:function(t){var n={dialogName:"FindAndReplaceDialog",element:t.element,target:t.target,cancel:t.cancel};e.parent.trigger("dialogBeforeOpen",n),n.cancel?t.cancel=!0:(r.dialogInstance.content=e.findandreplaceContent(),r.dialogInstance.dataBind()),Wt(e.parent.element)},buttons:[{buttonModel:{content:n.getConstant("FindPreviousBtn"),isPrimary:!0,cssClass:"e-btn-findPrevious",disabled:!0},click:function(t){e.dialogMessage(),e.findHandler({findOption:t&&13===t.keyCode?"next":"prev"})}},{buttonModel:{content:n.getConstant("FindNextBtn"),isPrimary:!0,cssClass:"e-btn-findNext",disabled:!0},click:function(){e.dialogMessage(),e.findHandler({findOption:"next"})}},{buttonModel:{content:n.getConstant("ReplaceBtn"),isPrimary:!0,cssClass:"e-btn-replace",disabled:!0},click:function(){e.dialogMessage(),e.replaceHandler(Fn)}},{buttonModel:{content:n.getConstant("ReplaceAllBtn"),isPrimary:!0,cssClass:"e-btn-replaceAll",disabled:!0},click:function(){e.dialogMessage(),e.replaceHandler(An)}}],open:function(){var r=e.parent.element.querySelector(".e-text-findNext");if(r.value){var n=e.parent.element.querySelector(".e-btn-findPrevious");t.getComponent(n,"btn").disabled=!1,t.getComponent(e.parent.element.querySelector(".e-btn-findNext"),"btn").disabled=!1}tt(function(){Wt(r)})},close:function(){return r.hide()}};r.show(i)}},e.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()},e.prototype.renderGotoDlg=function(){var e=this,r=this.parent.serviceLocator.getService(Fl),n=this.parent.serviceLocator.getService(Al);if(t.isNullOrUndefined(this.parent.element.querySelector(".e-find-dlg"))){var i={width:300,isModal:!1,showCloseIcon:!0,cssClass:"e-goto-dlg",header:r.getConstant("GotoHeader"),beforeOpen:function(t){var r={dialogName:"GoToDialog",element:t.element,target:t.target,cancel:t.cancel};e.parent.trigger("dialogBeforeOpen",r),r.cancel?t.cancel=!0:(n.dialogInstance.content=e.GotoContent(),n.dialogInstance.dataBind()),Wt(e.parent.element)},buttons:[{buttonModel:{content:r.getConstant("Ok"),isPrimary:!0,cssClass:"e-btn-goto-ok"},click:function(){e.gotoHandler()&&n.hide()}}],open:function(){e.textFocus()}};n.show(i,!1)}else n.hide()},e.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()})},e.prototype.findHandler=function(e){var r=this.parent.element.querySelector(".e-text-findNext");r||(r=this.parent.element.querySelector(".e-text-findNext-short"))||this.gotoAlert();var n=r.value;if(""!==r.value){var i=this.parent.getActiveSheet();if(i.isProtected&&!i.protectSettings.selectCells&&!i.protectSettings.selectUnLockedCells)return;var a=this.parent.activeSheetIndex,o=this.parent.element.querySelector(".e-findnreplace-checkcase"),s=void 0;if(o){s=t.getComponent(o,"checkbox").checked}else s=!1;var l=this.parent.element.querySelector(".e-findnreplace-checkmatch"),h=void 0;if(l){h=t.getComponent(l,"checkbox").checked}else h=!1;var d=this.parent.element.querySelector(".e-findnreplace-searchby"),p=void 0;if(d){p=t.getComponent(d,"dropdownlist").value.toString()}else p="By Row";var c=this.parent.element.querySelector(".e-findnreplace-searchwithin"),u=void 0;if(c){u=t.getComponent(c,"dropdownlist").value.toString()}else u="Sheet";var f={value:n,sheetIndex:a,findOpt:e.findOption,mode:u,isCSen:s,isEMatch:h,searchBy:p,isAction:!0};this.parent.find(f)}},e.prototype.replaceHandler=function(e){var t=this.parent.element.querySelector(".e-find-dlg").querySelector(".e-text-findNext").value,r=this.parent.element.querySelector(".e-text-replaceInp").value,n=this.parent.element.querySelector(".e-findnreplace-checkcase").checked,i=this.parent.element.querySelector(".e-findnreplace-checkmatch").checked,a=this.parent.element.querySelector(".e-search-within .e-ddl-hidden").value,o=this.parent.element.querySelector(".e-searchby .e-ddl-hidden").value;this.parent.notify(e,{value:t,mode:a,isCSen:n,isEMatch:i,searchBy:o,findOpt:"next",replaceValue:r,replaceBy:e,sheetIndex:this.parent.activeSheetIndex,isAction:!0})},e.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 i=r;r.includes("!")&&(i=r.split("!")[1]),(i=i.split("$").join("")).includes(":")&&(i=i.split(":")[0]);var a=i.match(/\d+/),o=i.match(/[A-Z]+/i);if(a&&o&&0===o.index){var s=w(c(i));s[2]>=1048576||s[3]>=16384?(this.gotoAlert(),t=!1):this.parent.goTo(r)}else this.gotoAlert(),t=!1}return t},e.prototype.gotoAlert=function(){var e=this.parent.serviceLocator.getService(Fl),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)},e.prototype.showFindAlert=function(){this.parent.element.querySelector(".e-replace-alert-span")&&this.parent.element.querySelector(".e-replace-alert-span").remove();var e=this.parent.element.querySelector(".e-find-dlg .e-dlg-content");if(e){var t=this.parent.createElement("span",{className:"e-find-alert-span"});t.innerText=this.parent.serviceLocator.getService(Fl).getConstant("NoElements"),e.appendChild(t)}},e.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(Fl),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)},e.prototype.findKeyUp=function(e){if(e.target.classList.contains("e-text-findNext")){var r=this.parent.element.querySelector(".e-text-findNext").value;if(t.isNullOrUndefined(r)||""===r)t.getComponent(this.parent.element.querySelector(".e-btn-findPrevious"),"btn").disabled=!0,t.getComponent(this.parent.element.querySelector(".e-btn-findNext"),"btn").disabled=!0,this.dialogMessage();else{var n=this.parent.element.querySelector(".e-btn-findPrevious");t.getComponent(n,"btn").disabled=!1,t.getComponent(this.parent.element.querySelector(".e-btn-findNext"),"btn").disabled=!1}}var i=this.parent.element.querySelector(".e-text-findNext").value,a=this.parent.element.querySelector(".e-text-replaceInp").value;t.isNullOrUndefined(i)||t.isNullOrUndefined(a)||""===i||""===a?(t.getComponent(this.parent.element.querySelector(".e-btn-replace"),"btn").disabled=!0,t.getComponent(this.parent.element.querySelector(".e-btn-replaceAll"),"btn").disabled=!0):this.parent.getActiveSheet().isProtected||(t.getComponent(this.parent.element.querySelector(".e-btn-replace"),"btn").disabled=!1,t.getComponent(this.parent.element.querySelector(".e-btn-replaceAll"),"btn").disabled=!1)},e.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(Fl);e.appendChild(t);var i=this.parent.createElement("div",{className:"e-cont"}),l=this.parent.createElement("p",{className:"e-header"});l.innerText=n.getConstant("FindWhat");var h=this.parent.createElement("input",{className:"e-input e-text-findNext",attrs:{type:"Text",placeholder:n.getConstant("FindValue"),value:this.shortValue}});i.appendChild(h),i.insertBefore(l,h),t.appendChild(i);var d=new a.TextBox({width:"70%"});d.createElement=this.parent.createElement,d.appendTo(h);var p=this.parent.createElement("div",{className:"e-cont"}),c=this.parent.createElement("p",{className:"e-header"});c.innerText=n.getConstant("ReplaceWith");var u=this.parent.createElement("input",{className:"e-input e-text-replaceInp",attrs:{type:"Text",placeholder:n.getConstant("ReplaceValue")}});p.appendChild(u),p.insertBefore(c,u),t.appendChild(p);var f=new a.TextBox({width:"70%"});f.createElement=this.parent.createElement,f.appendTo(u);var g=[{Id:"Sheet",Within:n.getConstant("Sheet")},{Id:"Workbook",Within:n.getConstant("Workbook")}],m=new s.DropDownList({dataSource:g,cssClass:"e-search-within",fields:{value:"Id",text:"Within"},width:"50%",index:0}),v=n.getConstant("SearchWithin"),y=this.parent.createElement("input",{className:"e-findnreplace-searchwithin",attrs:{type:"select",label:v}}),C=this.parent.createElement("p",{className:"e-header"});C.innerText=v,t.appendChild(C),t.appendChild(y),m.createElement=this.parent.createElement,m.appendTo(y);var b=[{Id:"By Row",Search:n.getConstant("ByRow")},{Id:"By Column",Search:n.getConstant("ByColumn")}],x=new s.DropDownList({dataSource:b,cssClass:"e-searchby",fields:{value:"Id",text:"Search"},width:"50%",index:0});v=n.getConstant("SearchBy");var S=this.parent.createElement("input",{className:"e-findnreplace-searchby",attrs:{type:"select",label:v}}),w=this.parent.createElement("p",{className:"e-header"});w.innerText=v,t.appendChild(w),t.appendChild(S),x.createElement=this.parent.createElement,x.appendTo(S);var I=new o.CheckBox({label:n.getConstant("MatchCase"),checked:!1,cssClass:"e-findnreplace-casecheckbox"}),E=this.parent.createElement("input",{className:"e-findnreplace-checkcase",attrs:{type:"checkbox"}});r.appendChild(E),I.createElement=this.parent.createElement,I.appendTo(E);var R=new o.CheckBox({label:n.getConstant("MatchExactCellElements"),checked:!1,cssClass:"e-findnreplace-exactmatchcheckbox"}),k=this.parent.createElement("input",{className:"e-findnreplace-checkmatch",attrs:{type:"checkbox"}});return r.appendChild(k),R.createElement=this.parent.createElement,R.appendTo(k),t.appendChild(r),e},e.prototype.GotoContent=function(){var e=this.parent.serviceLocator.getService(Fl),t=this.parent.createElement("div",{className:"e-link-dialog"}),r=this.parent.createElement("div",{className:"e-goto"});t.appendChild(r);var n=this.parent.createElement("div",{className:"e-cont"}),i=this.parent.createElement("p",{className:"e-header"});i.innerText=e.getConstant("Reference");var o=new a.TextBox({placeholder:e.getConstant("EnterCellAddress")}),s=this.parent.createElement("input",{className:"e-text-goto",attrs:{type:"Text"}});return n.appendChild(s),n.insertBefore(i,s),r.appendChild(n),o.createElement=this.parent.createElement,o.appendTo(s),t},e.prototype.destroy=function(){this.removeEventListener(),this.findDialog&&this.findDialog.hide(),this.parent=null},e.prototype.getModuleName=function(){return"findAndReplace"},e}(),uh=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.merge=function(e){this.parent.serviceLocator.getService("cell").refresh(e.rowIdx,e.colIdx,e.lastCell,e.element,!1,!1,Kt(this.parent))},e.prototype.hideHandler=function(e){var t=this.parent.getActiveSheet(),r={range:[e.rowIdx,e.colIdx,e.rowIdx,e.colIdx]};this.parent.notify(qn,r),r.range=r.range;var n=Re(r.range[0],r.range[1],t)||{},i="row"===e.model?r.range[0]:r.range[1],a=i+((n[e.model+"Span"]||1)-1);if(!(!e.isEnd&&(e.start===i||Qe(t,i))||e.isEnd&&e.start>i&&!Qe(t,i))&&n[e.model+"Span"]>1&&a>=e.start)if("row"===e.model?je(t,i):Qe(t,i)){if(e.colIdx<=a){var o=$(t,r.range[1],!0,"columns");if(o<=a){var s=r.range[0];n.rowSpan>1&&(s=(s=$(t,r.range[0],!0))<=r.range[2]?s:r.range[0]);var l=this.parent.getCell(s,o);l&&(l.style.display="",this.parent.serviceLocator.getService("cell").refresh(r.range[0],r.range[1],!0,l,!0,!0))}}}else{s=n.rowSpan>1?$(t,r.range[0],!0):r.range[0];this.merge({rowIdx:r.range[0],colIdx:r.range[1],element:this.parent.getCell(s,r.range[1])})}},e.prototype.checkPrevMerge=function(e){var t,r,n,i,a,o=this,s=this.parent.getActiveSheet(),l=function(){var t=o.parent.getContentTable(),n=t&&t.rows[0];if(n){var i=parseInt(n.getAttribute("aria-rowindex"),10)-1;if(r.range=r.range,i>o.parent.viewport.topIndex+o.parent.frozenRowCount(s)&&i>r.range[0]&&i<=r.range[2]){var a=void 0,l=o.parent.getRowHeaderTable(),h=l&&l.rows[0],d=o.parent.frozenColCount(s);if(d&&!h)return;for(var p=e.colIdx;p<=r.range[3];p++)(a=o.parent.getCell(i,p,p<d?h:n))&&(a.colSpan>1||a.rowSpan>1)&&(a.style.display="none",a.removeAttribute("colSpan"),a.removeAttribute("rowSpan"))}}},h=function(h){if(r.range=r.range,je(s,r.range[0])&&e.rowIdx>=r.range[0]&&e.rowIdx<=r.range[2]){i=!1;for(var d=r.range[0];d<e.rowIdx;d++)if(!je(s,d)){i=!0;break}if(t.rowSpan>1&&!i){var p=t.rowSpan-o.parent.hiddenCount(r.range[0],r.range[2]);p>0&&(l(),e.td.style.display="",e.colSpan=n,e.rowSpan=p,e.cell=t,e.isMerged=!1)}}else if(h){for(d=r.range[0];a&&d<e.rowIdx;d++)if(!je(s,d)){i=!0;break}i||(l(),e.td.style.display="",e.colSpan=n,e.cell=t,e.isMerged=!1)}};if(e.cell.colSpan<0){if(e.colIdx-1>-1&&Qe(s,e.colIdx-1)&&(void 0!==(t=Re(e.rowIdx,e.colIdx-1,s,!1,!0)).colSpan||void 0!==t.rowSpan)&&(void 0===t.rowSpan||t.rowSpan>1||(a=e.rowIdx-1>-1&&je(s,e.rowIdx-1)))&&(r={range:[e.rowIdx,e.colIdx-1,e.rowIdx,e.colIdx-1]},this.parent.notify(qn,r),r.range=r.range,t=Re(r.range[0],r.range[1],s,!1,!0),Qe(s,r.range[1])&&e.colIdx>=r.range[1]&&e.colIdx<=r.range[3])){for(var d=r.range[1];d<e.colIdx;d++)if(!Qe(s,d)){i=!0;break}t.colSpan>1&&!i&&(n=t.colSpan-this.parent.hiddenCount(r.range[1],r.range[3],"columns"))>0&&h(!0)}}else e.rowIdx-1>-1&&je(s,e.rowIdx-1)&&void 0!==(t=Re(e.rowIdx-1,e.colIdx,s,!1,!0)).rowSpan&&(r={range:[e.rowIdx-1,e.colIdx,e.rowIdx-1,e.colIdx]},this.parent.notify(qn,r),r.range=r.range,t=Re(r.range[0],r.range[1],s,!1,!0),h())},e.prototype.checkMerge=function(e){var t,r=this.parent.getActiveSheet(),n=Re(e.rowIdx,e.colIdx,r)||{};if(e.isRow){if(void 0===n.colSpan||Qe(r,e.colIdx-1)){if(t={range:[e.rowIdx,e.colIdx,e.rowIdx,e.colIdx]},t.range=t.range,this.parent.notify(qn,t),Qe(r,e.colIdx-1)&&!Qe(r,t.range[1])||e.isFreezePane&&t.range[0]<this.parent.frozenRowCount(r))return void(e.insideFreezePane=t.range[0]<this.parent.frozenRowCount(r));if(e.colIdx!==this.parent.viewport.leftIndex+this.parent.frozenColCount(r)&&Qe(r,e.colIdx-1))for(var i=t.range[1];void 0!==n.colSpan&&i<e.colIdx;i++)if(!Qe(r,i))return;n=Re(t.range[0],t.range[1],r);(o=t.range[2]-e.rowIdx+1-this.parent.hiddenCount(e.rowIdx,t.range[2]))>=1&&(this.merge({rowIdx:t.range[0],colIdx:t.range[1],element:e.td}),1===o?e.td.removeAttribute("rowspan"):e.td.rowSpan=o,e.td.style.display="")}}else if(void 0===n.rowSpan||je(r,e.rowIdx-1)){if(t={range:[e.rowIdx,e.colIdx,e.rowIdx,e.colIdx]},t.range=t.range,this.parent.notify(qn,t),je(r,e.rowIdx-1)&&!je(r,t.range[0])||e.isFreezePane&&t.range[1]<this.parent.frozenColCount(r))return void(e.insideFreezePane=t.range[1]<this.parent.frozenColCount(r));if(e.rowIdx!==this.parent.viewport.topIndex+this.parent.frozenRowCount(r)&&je(r,e.rowIdx-1))for(var a=t.range[0];void 0!==n.rowSpan&&a<e.rowIdx;a++)if(!je(r,a))return;n=Re(t.range[0],t.range[1],r);var o;(o=t.range[3]-e.colIdx+1-this.parent.hiddenCount(e.colIdx,t.range[3],"columns"))>=1&&(this.merge({rowIdx:t.range[0],colIdx:t.range[1],element:e.td}),1===o?e.td.removeAttribute("colspan"):e.td.colSpan=o,e.td.style.display="")}},e.prototype.addEventListener=function(){this.parent.on(zn,this.merge,this),this.parent.on(ps,this.hideHandler,this),this.parent.on(cs,this.checkPrevMerge,this),this.parent.on(us,this.checkMerge,this)},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(zn,this.merge),this.parent.off(ps,this.hideHandler),this.parent.off(cs,this.checkPrevMerge),this.parent.off(us,this.checkMerge))},e.prototype.getModuleName=function(){return"merge"},e}(),fh=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.addEventListener=function(){this.parent.on(Xn,this.applyCF,this),this.parent.on(ys,this.renderCFDlg,this),this.parent.on(Zn,this.clearCF,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(Xn,this.applyCF),this.parent.off(ys,this.renderCFDlg),this.parent.off(Zn,this.clearCF))},e.prototype.clearCF=function(e){var r=this,n=this.parent.getActiveSheet();this.updateRange(n,e.indexes,this.parent.frozenRowCount(n),this.parent.frozenColCount(n),u(n.topLeftCell),function(e,n,i,a){t.removeClass([a],["e-redft","e-yellowft","e-greenft","e-redf","e-redt","e-iconset"]);var o,s;["backgroundColor","color"].forEach(function(t){a.style[""+t]&&(a.style[""+t]="",(o=i&&i.style&&i.style[""+t]||r.parent.commonCellStyle[""+t])&&((s={})[""+t]=o,r.parent.notify(_r,{style:s,rowIdx:e,colIdx:n,td:a})))});var l;[".e-cf-databar",".e-iconsetspan"].forEach(function(e){(l=a.querySelector(e))&&(a.removeChild(l),a.textContent=r.parent.getDisplayText(i))})})},e.prototype.renderCFDlg=function(e){var t=this,r=this.parent.serviceLocator.getService(Fl),n=this.parent.serviceLocator.getService(Al);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(),Wt(t.parent.element)},buttons:[{buttonModel:{content:r.getConstant("Ok"),isPrimary:!0},click:function(){t.dlgClickHandler(e.action),n.hide()}}]})},e.prototype.dlgClickHandler=function(e){var t,r=this.parent.serviceLocator.getService(Fl),n=["",""],i=this.parent.element.querySelector(".e-conditionalformatting-dlg").getElementsByClassName("e-dlg-content")[0].querySelector(".e-cf-dlg"),a=i.querySelector(".e-cfmain");a&&((t=a.getElementsByTagName("input")[0])&&t.parentElement.classList.contains("e-cfmain")&&(n[0]=a.getElementsByTagName("input")[0].value),n[1]=a.getElementsByTagName("input")[1]?i.querySelector(".e-cfmain").getElementsByTagName("input")[1].value:"",ae(n,this.parent.locale));var o={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(Yn,{cfModel:o,isAction:!0})},e.prototype.getType=function(e){var t,r=this.parent.serviceLocator.getService(Fl);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},e.prototype.getCFColor=function(e){var t=this.parent.serviceLocator.getService(Fl),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},e.prototype.cfDlgContent=function(e){var t=this.getDlgText(e),r=this.parent.serviceLocator.getService(Fl),n=this.parent.createElement("div",{className:"e-cf-dlg"}),i=this.parent.createElement("div",{className:"e-cfmain"}),o=this.parent.createElement("div",{className:"e-cfsub"}),l=this.parent.createElement("span",{className:"e-header e-top-header"});l.innerText=t;var h=this.parent.createElement("input",{className:"e-input",id:"valueInput",attrs:{type:"text","aria-label":t}}),d=this.parent.createElement("input",{className:"e-select"}),p=this.parent.createElement("span",{className:"e-header"});p.innerText=r.getConstant("With");var c=this.parent.createElement("input",{className:"e-select"});n.appendChild(i),n.appendChild(o),i.appendChild(l);var u;if(e!==r.getConstant("DuplicateValues")+"..."){if(e!==r.getConstant("AboveAverage")+"..."&&e!==r.getConstant("BelowAverage")+"..."){i.appendChild(h),u=!0;var f=e===r.getConstant("Top10")+" %..."||e===r.getConstant("Bottom10")+" %...";if(e===r.getConstant("Top10Items")+"..."||e===r.getConstant("Bottom10Items")+"..."||f){h.maxLength=f?3:4;new a.NumericTextBox({value:10,min:1,max:f?100:1e3,format:"###"}).appendTo(h)}}}else{i.appendChild(d);var g=[{text:r.getConstant("Duplicate"),id:"duplicate"},{text:r.getConstant("Unique"),id:"unique"}];new s.DropDownList({dataSource:g,index:0,popupHeight:"200px"}).appendTo(d)}if(e===r.getConstant("Between")+"..."){var m=this.parent.createElement("span",{className:"e-header e-header-2"});m.innerText=r.getConstant("And");var v=this.parent.createElement("input",{className:"e-input e-between"});i.appendChild(m),i.appendChild(v),v.addEventListener("input",this.validateCFInput.bind(this))}u&&(this.validateCFInput({target:h}),h.addEventListener("input",this.validateCFInput.bind(this))),o.appendChild(p),o.appendChild(c);var y=[{text:r.getConstant("LightRedFillWithDarkRedText"),value:"redft",id:"redft"},{text:r.getConstant("YellowFillWithDarkYellowText"),id:"yellowft"},{text:r.getConstant("GreenFillWithDarkGreenText"),id:"greenft"},{text:r.getConstant("RedFill"),id:"redf"},{text:r.getConstant("RedText"),id:"redt"}];return new s.DropDownList({dataSource:y,index:0,popupHeight:"200px"}).appendTo(c),n},e.prototype.validateCFInput=function(e){var t=this.parent.serviceLocator.getService(Al),r=e.target.value,n=t.dialogInstance.element.getElementsByClassName("e-primary")[0];r&&(e.target.classList.contains("e-between")||e.target.parentElement.querySelector(".e-between"))&&(r=e.target.parentElement.querySelector(e.target.classList.contains("e-between")?".e-input":".e-between").value),n.disabled=!r.trim()},e.prototype.checkCellHandler=function(e,t,r){for(var n=r.range.trim().split(","),i=0;i<n.length;i++){var a=c(n[i].includes(":")?n[i]:n[i]+":"+n[i]);if(e>=a[0]&&e<=a[2]&&t>=a[1]&&t<=a[3])return!0}return!1},e.prototype.getDlgText=function(e){var t=this.parent.serviceLocator.getService(Fl),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},e.prototype.updateResult=function(e,r,n,i,a,o,s,l){var h,d,p,u={},f={},g=e.range.split(","),m=[];n?p=function(){if(D(d)){var e=parseFloat(d);e>=0?(void 0===m[0]||e>m[0])&&(m[0]=e):(void 0===m[1]||e<m[1])&&(m[1]=e)}}:i?p=function(){if(D(d)){var e=parseFloat(d);m.push(Number(e))}}:a?(m=[0,0],p=function(){D(d)&&(m[0]+=parseFloat(d),m[1]++)}):p=o?function(){D(d)&&m.push(parseFloat(d))}:s?function(){if(D(d)){var e=parseInt(d,10);(void 0===m[0]||e<m[0])&&(m[0]=e),(void 0===m[1]||e>m[1])&&(m[1]=e)}}:function(){u[""+d]?""!==d&&(f[""+d]||(f[""+d]=!0,m.push(d))):u[""+d]=!0};for(var v,y=0;y<g.length;y++)for(var C=(h=c(g[y]))[0];C<=h[2];C++)for(var b=h[1];b<=h[3];b++)v=Re(C,b,r,!1,!0),t.isNullOrUndefined(v.value)?v.formula&&(this.parent.notify("calculateFormula",{cell:v,rowIdx:C,colIdx:b,sheetIndex:this.parent.activeSheetIndex}),d=v.value.toString().toLowerCase(),p()):(d=v.value.toString().toLowerCase(),p());if(i||o){if(m=m.sort(function(e,t){return e-t}),e.type.includes("Bottom")||(m=m.reverse()),o){var x=parseFloat(l);e.type.includes("Percentage")&&(x=(x/=100/m.length)<1?1:x),m=m.slice(0,x)}}else a&&((m=[m[0]/m[1]])[0]||(m=[]));e.result=m},e.prototype.applyCF=function(e){var t,r=!e.cfModel,n=this.parent.getActiveSheet(),i=e.cfModel||n.conditionalFormats,a=[e.indexes];e.refreshAll&&(a=oe(this.parent,this.parent.viewport));for(var o=i.length-1;o>=0;o--)(!r||(2===a[0].length?this.checkCellHandler(e.indexes[0],e.indexes[1],i[o]):ie(a,i[o].range)))&&(t=this.updateCF(e,n,i[o],t))},e.prototype.updateCF=function(e,r,n,i){var a,o,s=this;if(n.value){var l=n.value.split(",").filter(function(e){return!!e.trim()});if(l.length>1)if(l[0].split("(").length>1){for(var h="",d=0;d<l.length;d++)(h+=l[d]+",").split("(").length===h.split(")").length&&void 0===a&&(a=h.substring(0,h.length-1),h="");o=h.substring(0,h.length-1)}else{a=l[0];for(d=1;d<l.length;d++)o+=d+1===l.length?l[d]:l[d]+","}else a=l[0]||n.value}n.type||(n.type="GreaterThan");var p;n.format&&n.format.style?(p=Fe(n.format.style,!0),Object.keys(p).length||n.cFColor||(n.cFColor="RedFT")):(p={},n.cFColor||(n.cFColor="RedFT"));var f,m,v,y=n.type.includes("DataBar"),C=n.type.includes("ColorScale");e.isRender&&n.result||!("Duplicate"===n.type||"Unique"===n.type||y||C||(f=n.type.includes("Average"))||(m=n.type.includes("10")&&D(a))||(v=n.type.includes("Three")||n.type.includes("Four")||n.type.includes("Five")))||this.updateResult(n,r,y,C,f,m,v,a);var b=function(r,l,h,d){var c,u,f=h&&!t.isNullOrUndefined(h.value)?h.value.toString():"",m=!0;switch(n.type){case"GreaterThan":case"LessThan":c=s.isGreaterThanLessThan(n,f,a);break;case"Between":c=D(f)&&s.isBetWeen(n,f,a,o);break;case"EqualTo":c=D(f)&&s.isEqualTo(n,f,a);break;case"ContainsText":c=f&&s.isContainsText(f,a);break;case"DateOccur":u={value:a,cell:{},updatedVal:""},s.parent.notify(Wr,u),c=f===u.updatedVal;break;case"Unique":c=-1===n.result.indexOf(f.toLowerCase());break;case"Duplicate":c=n.result.indexOf(f.toLowerCase())>-1;break;case"Top10Items":case"Bottom10Items":case"Top10Percentage":case"Bottom10Percentage":if(n.result){var v=parseFloat(f);T(f)&&(v=O(f)),c=n.result.indexOf(v)>-1}break;case"AboveAverage":c=n.result.length&&parseFloat(f)>n.result[0];break;case"BelowAverage":c=n.result.length&&parseFloat(f)<n.result[0];break;default:m=!1,y?s.applyDataBars(f,n,d,r):C?s.applyColorScale(f,n,d,h,r,l):s.applyIconSet(f,n,d)}if(e.isAction&&m&&(s.parent.trigger("beforeConditionalFormat",{conditionalFormat:n,cell:h,element:d,apply:c,address:g(r,l)}),!c&&e.isEdit&&!i)){var b;e.indexes&&e.indexes[0]===r&&e.indexes[1]===l&&(i=!0),n.cFColor?d.className.includes("e-"+n.cFColor.toLowerCase())&&(d.classList.remove("e-"+n.cFColor.toLowerCase()),d.style.backgroundColor="",d.style.color="",((b=t.extend({},s.parent.commonCellStyle,h&&h.style)).backgroundColor||b.color)&&s.parent.notify(_r,{rowIdx:r,colIdx:l,td:d,style:{backgroundColor:b.backgroundColor,color:b.color}})):(d.removeAttribute("style"),b=t.extend({},s.parent.commonCellStyle,h&&h.style),Object.keys(b).length&&s.parent.notify(_r,{style:b,rowIdx:r,colIdx:l,td:d}))}c&&(e.isEdit&&e.indexes&&e.indexes[0]===r&&e.indexes[1]===l&&(i=!0),t.removeClass([d],["e-redft","e-yellowft","e-greenft","e-redf","e-redt"]),n.cFColor&&(d.classList.add("e-"+n.cFColor.toLowerCase()),s.setCFStyle(p,n)),Object.assign(d.style,p))};if(e.ele)b(e.indexes[0],e.indexes[1],e.cell,e.ele);else for(var x=n.range.split(","),S=this.parent.frozenRowCount(r),w=this.parent.frozenColCount(r),I=u(r.topLeftCell),E=0;E<x.length;E++)this.updateRange(r,c(x[E]),S,w,I,b);return i},e.prototype.updateRange=function(e,t,r,n,i,a){t[0]=t[0]<r?t[0]<i[0]?i[0]:t[0]:t[0]<this.parent.viewport.topIndex+r?this.parent.viewport.topIndex+r:t[0],t[1]=t[1]<n?t[1]<i[1]?i[1]:t[1]:t[1]<this.parent.viewport.leftIndex+n?this.parent.viewport.leftIndex+n:t[1],t[2]=t[2]<r?t[2]<i[0]?i[0]-1:t[2]:t[2]>this.parent.viewport.bottomIndex?this.parent.viewport.bottomIndex:t[2],t[3]=t[3]<n?t[3]<i[1]?i[1]-1:t[3]:t[3]>this.parent.viewport.rightIndex?this.parent.viewport.rightIndex:t[3];for(var o,s=t[0];s<=t[2];s++)if(r&&s===r&&(s=this.parent.viewport.topIndex+r),!je(e,s))for(var l=t[1];l<=t[3];l++)n&&l===n&&(l=this.parent.viewport.leftIndex+n),Qe(e,l)||(o=this.parent.getCell(s,l))&&a(s,l,Re(s,l,e),o)},e.prototype.applyIconSet=function(e,t,r){if(r.classList.contains("e-iconset")){r.classList.remove("e-iconset");var n=r.querySelector(".e-iconsetspan");n&&r.removeChild(n)}var i=parseInt(e,10),a=t.result;if(!(isNaN(i)||void 0===a[0]&&void 0===a[1])){var o,s=a[0],l=a[1],h=this.getIconList(t.type).split(",");if(3===h.length){var d=s+.33*(l-s);o="e-"+(i>=s+.67*(l-s)?h[0].trim():i>=d?h[1].trim():h[2].trim())}else if(4===h.length){var p=s+.25*(l-s),c=s+.5*(l-s);o="e-"+(i>=(u=s+.75*(l-s))?h[0].trim():i>=c?h[1].trim():i>=p?h[2].trim():h[3].trim())}else if(5===h.length){p=s+.2*(l-s),c=s+.4*(l-s);var u=s+.6*(l-s);o="e-"+(i>=s+.8*(l-s)?h[0].trim():i>=u?h[1].trim():i>=c?h[2].trim():i>=p?h[3].trim():h[4].trim())}var f=this.parent.createElement("span",{className:"e-icon e-iconsetspan "+o});r.insertBefore(f,r.childNodes[0]),r.classList.add("e-iconset")}},e.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"},e.prototype.applyColorScale=function(e,r,n,i,a,o){var s=parseFloat(e);if(isNaN(s)){if(n.style.backgroundColor){n.style.backgroundColor="";var l=t.extend({},this.parent.commonCellStyle,i&&i.style);l.backgroundColor&&this.parent.notify(_r,{style:{backgroundColor:l.backgroundColor},td:n,rowIdx:a,colIdx:o})}}else{var h=r.result,d=h.indexOf(s),p=this.getColor(r.type);n.style.backgroundColor=0===d?p[0]:d===h.length-1?p[p.length-1]:3===h.length&&1===d?p[1]:this.getGradient(d,p[0],p[1],p[2],h.length)}},e.prototype.applyDataBars=function(e,t,r,n){var i,a,o=this.parent.getActiveSheet(),s=t.result,l=0;if(D(e)&&(a=parseFloat(e)),void 0===s[0]&&void 0===s[1]||isNaN(a)){var h=r.getElementsByClassName("e-cf-databar")[0];h&&r.removeChild(h)}else{void 0!==s[0]&&void 0!==s[1]?(i=s[0]+Math.abs(s[1]),l=Math.abs(s[1]/i*100)):i=void 0!==s[0]?s[0]:s[1];var d=this.parent.createElement("div",{id:"spreadsheet-databar",className:"e-cf-databar"}),p=this.parent.createElement("span",{id:"spreadsheet-leftspan",className:"e-databar"}),c=this.parent.createElement("span",{id:"spreadsheet-rightspan",className:"e-databar"}),u=this.parent.createElement("span",{id:"spreadsheet-dataspan",className:"e-databar-value"}),f=r.querySelector(".e-iconsetspan");f&&r.insertBefore(f,r.firstElementChild);var g=We(o,n,!0);d.style.height=g-1+"px";var m=t.type[0];"L"===m&&(m+="B"),void 0===s[1]?(c.style.width=Math.ceil(Math.abs(a/i*100))+"%",c.style.height=g-3+"px",c.style.backgroundColor=this.getColor(m)[0],c.style.left="0px"):void 0===s[0]?(c.style.width=Math.ceil(Math.abs(a/i*100))+"%",c.style.height=g-3+"px",c.style.backgroundColor=this.getColor("R")[0],c.style.left="0px"):a>=0?(p.style.width=l+"%",p.style.height=g-3+"px",p.style.backgroundColor="transparent",p.style.left="0px",c.style.width=Math.ceil(Math.abs(a/i*100))+"%",c.style.height=g-3+"px",c.style.backgroundColor=this.getColor(m)[0],c.style.left=l+"%"):(p.style.width=Math.ceil(Math.abs(a/i*100))+"%",p.style.height=g-3+"px",p.style.backgroundColor=this.getColor("R")[0],p.style.width===l+"%"?p.style.left="0px":p.style.right=100-l+"%"),u.style.fontSize=r.style.fontSize||"11pt";var v=r.querySelector("#"+this.parent.element.id+"_currency");v&&d.appendChild(v);var y=r.querySelector(".e-hyperlink");y?u.appendChild(y):(u.innerText=r.textContent,""===r.textContent&&u.appendChild(document.createTextNode(r.textContent))),d.appendChild(p),d.appendChild(c),d.appendChild(u),r.textContent="",r.appendChild(d)}},e.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},e.prototype.getGradient=function(e,r,n,i,a){if(t.isNullOrUndefined(i))return this.getLinear(r,n,e/a);var o=a/2;return e>=o?this.getLinear(n,i,Math.abs((e-o)/o)):this.getLinear(r,n,e/o)},e.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)},e.prototype.byteLinear=function(e,t,r){var n=parseInt(e,16)*(1-r)+parseInt(t,16)*r|0;return Math.abs(n).toString(16)},e.prototype.isGreaterThanLessThan=function(e,t,r){if(D(t)){if(D(r)){var n=new RegExp(/[^.-a-zA-Z 0-9]+/g);return"GreaterThan"===e.type?parseFloat(t)>parseFloat(r.replace(n,"")):parseFloat(t)<parseFloat(r.replace(n,""))}var i={value:r,rowIndex:0,colIndex:0,sheetIndex:0,isDate:!1,updatedVal:"",isTime:!1};return this.parent.notify(Wr,i),i.isDate||i.isTime?(e.value=i.updatedVal.toString(),"GreaterThan"===e.type?Number(t)>Number(i.updatedVal):Number(t)<Number(i.updatedVal)):"GreaterThan"===e.type?t.toLowerCase()>r.toLowerCase():t.toLowerCase()<r.toLowerCase()}return""===t&&Number(r)>0&&"LessThan"===e.type},e.prototype.isBetWeen=function(e,t,r,n){var i,a,o=new RegExp(/[^.-a-zA-Z 0-9]+/g);if(r=r.replace(o,""),n=n.replace(o,""),D(r)){var s=parseFloat(r),l=parseFloat(n);return s>l&&(s=(i=[l,s])[0],l=i[1]),parseFloat(t)>=s&&parseFloat(t)<=l}if(r&&n){var h={value:r,cell:{},updatedVal:""},d={value:n,cell:{},updatedVal:""};return this.parent.notify(Wr,h),this.parent.notify(Wr,d),(h.isDate||h.isTime)&&(d.isDate||d.isTime)?(e.value=h.updatedVal+","+d.updatedVal,h.updatedVal>d.updatedVal&&(a=[d.updatedVal,h.updatedVal],h.updatedVal=a[0],d.updatedVal=a[1]),t>=h.updatedVal&&t<=d.updatedVal):t.toLowerCase()>=r.toLowerCase()&&t.toLowerCase()<=n.toLowerCase()}return!1},e.prototype.isEqualTo=function(e,t,r){if(D(r)){var n=new RegExp(/[^.-a-zA-Z 0-9]+/g);return parseFloat(t)===parseFloat(r.replace(n,""))}var i={value:r,cell:{},updatedVal:""};return this.parent.notify(Wr,i),i.isTime||i.isDate?(e.value=i.updatedVal,t===i.updatedVal):t.toLowerCase()===r.toLowerCase()},e.prototype.isContainsText=function(e,t){var r=new RegExp(/[^.-a-zA-Z 0-9]+/g);return D(t.replace(r,""))?(t=t.replace(r,""),T(e)&&(e=O(e).toString()),e.indexOf(t)>-1):T(t)?(T(e)&&(e=O(e).toString()),e.indexOf(O(t).toString())>-1):e.toLowerCase().indexOf(t.toLowerCase())>-1},e.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},e.prototype.getModuleName=function(){return"conditionalFormatting"},e}(),gh=function(){function e(e){this.fillOptionIndex=0,this.parent=e,this.addEventListener()}return e.prototype.getfillItems=function(){var e=this.parent.serviceLocator.getService(Fl);return[{text:e.getConstant("CopyCells")},{text:e.getConstant("FillSeries")},{text:e.getConstant("FillFormattingOnly")},{text:e.getConstant("FillWithoutFormatting")}]},e.prototype.createAutoFillElement=function(){if(this.parent.allowAutoFill){var e=this.parent.getMainContent(),t=this.parent.createElement("div",{className:"e-autofill"});e.lastElementChild&&e.lastElementChild.classList.contains("e-ss-overlay")?e.insertBefore(t,e.getElementsByClassName("e-ss-overlay")[0]):e.appendChild(t),this.autoFillElement=t,this.getautofillDDB({id:this.parent.element.id+"_autofilloptionbtn",appendElem:e})}},e.prototype.getautofillDDB=function(e){var t=this,r=this.parent.createElement("button",{id:e.id,className:"e-filloption",attrs:{type:"button"}});return r.appendChild(this.parent.createElement("span",{className:"e-tbar-btn-text"})),this.autoFillDropDown=new h.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(r),e.appendElem.appendChild(r),this.autoFillDropDown},e.prototype.getFillType=function(e){var t=this.parent.serviceLocator.getService(Fl);return e===t.getConstant("CopyCells")?"CopyCells":e===t.getConstant("FillSeries")?"FillSeries":e===t.getConstant("FillFormattingOnly")?"FillFormattingOnly":"FillWithoutFormatting"},e.prototype.autoFillClick=function(){var e=this.parent.serviceLocator.getService(Fl),t={fillType:"FillSeries",disableItems:[""]};this.parent.notify(gi,t),this.autoFillDropDown.setProperties({items:this.getfillItems()},!0),this.autoFillDropDown.removeItems(t.disableItems),this.refreshAutoFillOption(e.getConstant(t.fillType))},e.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]}},e.prototype.autoFillOptionClick=function(e){var t=this.parent.serviceLocator.getService(Fl),r=this.parent.getActiveSheet(),n=w(c(this.parent.selectionModule.dAutoFillCell)),i=c(r.selectedRange),a=n[0],o=n[1],s=n[2],l=n[3],h=this.getDirection({rowIndex:s,colIndex:l},{rowIndex:i[2],colIndex:i[3]}),d=[a,o,s,l],p=this.getFillRange({rowIndex:a,colIndex:o},{rowIndex:s,colIndex:l},{rowIndex:i[2],colIndex:i[3]},h);this.refreshAutoFillOption(t.getConstant(e.type));var u={isUndo:!0,isPublic:!0,preventReSelect:!0,preventEvt:"FillWithoutFormatting"===e.type,setCollection:"FillFormattingOnly"===e.type||"FillWithoutFormatting"===e.type};this.parent.notify(Lo,u);var f={dataRange:r.name+"!"+m(d),fillRange:r.name+"!"+m(p),direction:h,fillType:e.type,isFillOptClick:!0};this.isVerticalFill="Down"===f.direction||"Up"===f.direction,this.parent.notify(ui,f),this.positionAutoFillElement({isautofill:!0});var g={dataRange:f.dataRange,fillRange:f.fillRange,fillType:f.fillType,direction:f.direction,selectedRange:r.name+"!"+m(i),undoArgs:u.undoArgs};this.parent.notify(Yo,{eventArgs:g,action:"autofill"}),this.parent.showAggregate&&this.parent.notify(gs,{}),this.autoFillClick()},e.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()},e.prototype.positionAutoFillElement=function(e){var r,n,i,a=0,o=0,s=this.parent.getActiveSheet(),l=w(c(s.selectedRange)),h=-5,d=-5,p=6,u=6,f=0===l[1]&&l[3]===s.colCount-1,g=0===l[0]&&l[2]===s.rowCount-1,m=l[2],v=l[3],y=this.parent.enableRtl,C=this.parent.getCell(m,v);if(Qe(s,l[3])||je(s,l[2])||C&&C.classList.contains("e-formularef-selection")||s.isProtected&&s.protectSettings.selectUnLockedCells&&Gt(this.parent,l))this.hideAutoFillElement();else if(s.isProtected&&(s.protectSettings.selectCells||s.protectSettings.selectUnLockedCells)||!s.isProtected)if(f?(h=-5,d=-1,p=6,u=2,m=l[2],v=l[1]):g&&(d=-5,h=0,p=1,u=6,m=l[0],v=l[3]),s.frozenColumns||s.frozenRows){if(g||f?(ht(this.parent,this.autoFillElement,l,"e-autofill",e&&e.preventAnimation),this.parent.autoFillSettings.showFillOptions&&e&&e.isautofill&&ht(this.parent,this.autoFillDropDown.element,l,"e-filloption")):(ht(this.parent,this.autoFillElement,[m,v,m,v],"e-autofill",e&&e.preventAnimation),this.parent.autoFillSettings.showFillOptions&&e&&e.isautofill&&ht(this.parent,this.autoFillDropDown.element,[m,v,m,v],"e-filloption")),this.autoFillElement){this.autoFillCell={rowIndex:m,colIndex:v};var b=this.parent.element.querySelectorAll(".e-autofill")[0];if(b){var x=b.getBoundingClientRect();this.autoFillElementPosition={left:x.left,top:x.top}}}}else if(i=lt(s,[m,v,m,v],this.parent.frozenRowCount(s),this.parent.frozenColCount(s),this.parent.viewport.beforeFreezeHeight,this.parent.viewport.beforeFreezeWidth,this.parent.sheetModule.colGroupWidth),r=Ye(s,m,m,!0),n=Ze(s,v,v,!0),g||(a+=r),f||(o+=n),a+=Math.round(i.top)+h,o+=Math.round(i.left)+d,this.autoFillElement){t.removeClass([this.autoFillElement],"e-hide"),this.autoFillElement.style.top=a+"px",y?this.autoFillElement.style.right=o+"px":this.autoFillElement.style.left=o+"px",this.autoFillCell={rowIndex:m,colIndex:v};x=this.autoFillElement.getBoundingClientRect();this.autoFillElementPosition={left:x.left,top:x.top},this.parent.autoFillSettings.showFillOptions&&e&&e.isautofill&&(t.removeClass([this.autoFillDropDown.element],"e-hide"),this.autoFillDropDown.element.style.top=a+p+"px",y?this.autoFillDropDown.element.style.right=o+u+"px":this.autoFillDropDown.element.style.left=o+u+"px")}},e.prototype.hideAutoFillElement=function(){var e=this.parent.element;[].slice.call(e.querySelectorAll(".e-autofill")).forEach(function(r){e&&t.addClass([r],"e-hide")})},e.prototype.hideAutoFillOptions=function(){var e=this.parent.element;[].slice.call(e.querySelectorAll(".e-filloption")).forEach(function(r){e&&t.addClass([r],"e-hide")})},e.prototype.selectAutoFillRange=function(e){var t={clientY:It(e.e),target:e.e.target},r={clientX:wt(e.e),target:e.e.target},n=this.parent.getActiveSheet();this.parent.notify(Ns,t),this.parent.notify(Os,r);var i,a=this.getAutoFillRange({rowIndex:t.clientY,colIndex:r.clientX});return i=a&&a.fillRange?[a.startCell.rowIndex,a.startCell.colIndex,a.endCell.rowIndex,a.endCell.colIndex]:c(n.selectedRange),e.indexes=i,i},e.prototype.getAutoFillRange=function(e){var t=this.parent.getActiveSheet(),r=this.autoFillCell,n=w(c(t.selectedRange)),i=n[0],a=n[1],o=n[2],s=n[3],l=W(n,[e.rowIndex,e.colIndex,e.rowIndex,e.colIndex],!0),h={rowIndex:i,colIndex:a},d={rowIndex:n[0],colIndex:n[1]},p={rowIndex:n[2],colIndex:n[3]},u={rowIndex:o,colIndex:s},f=this.modifyRangeForMerge(e.rowIndex,e.colIndex,r.rowIndex,r.colIndex,n);return e.rowIndex<r.rowIndex?i-e.rowIndex>e.colIndex-s&&i-e.rowIndex>a-e.colIndex?l?{startCell:h,endCell:{rowIndex:e.rowIndex,colIndex:s}}:{startCell:u,endCell:{rowIndex:f.rowIndex,colIndex:a},fillRange:[f.rowIndex,a,i-1,s],direction:"Up"}:e.colIndex>r.colIndex?{startCell:h,endCell:{rowIndex:o,colIndex:e.colIndex},fillRange:[i,s+1,o,e.colIndex],direction:"Right"}:e.colIndex<r.colIndex?l?{startCell:h,endCell:u}:{startCell:u,endCell:{rowIndex:i,colIndex:e.colIndex},fillRange:[i,e.colIndex,o,a-1],direction:"Left"}:{startCell:d,endCell:p}:e.colIndex>r.colIndex?e.rowIndex-o>e.colIndex-s?{startCell:h,endCell:{rowIndex:e.rowIndex,colIndex:s},fillRange:[o+1,a,e.rowIndex,s],direction:"Down"}:{startCell:h,endCell:{rowIndex:o,colIndex:f.colIndex},fillRange:[i,s+1,o,f.colIndex],direction:"Right"}:e.colIndex<r.colIndex?e.rowIndex-o>s-e.colIndex||e.rowIndex-i>s-e.colIndex&&e.rowIndex!==o?{startCell:h,endCell:{rowIndex:e.rowIndex,colIndex:s},fillRange:[o+1,a,e.rowIndex,s],direction:"Down"}:l?{startCell:h,endCell:u}:{startCell:u,endCell:{rowIndex:i,colIndex:f.colIndex},fillRange:[i,f.colIndex,o,a-1],direction:"Left"}:e.rowIndex>r.rowIndex?{startCell:h,endCell:{rowIndex:f.rowIndex,colIndex:s},fillRange:[o+1,a,f.rowIndex,s],direction:"Down"}:(e.rowIndex===r.rowIndex&&(e.colIndex,r.colIndex),{startCell:d,endCell:p})},e.prototype.modifyRangeForMerge=function(e,t,r,n,i){var a={rowIndex:e,colIndex:t};if(this.isMergedRange(i)){var o=i[2]-i[0]+1,s=i[3]-i[1]+1,l=void 0;e<r?(l=(i[2]-e+1)%o)&&e-(o-l)>=0&&(a.rowIndex=e-(o-l)):t>n?(l=(t-i[1]+1)%s)&&(a.colIndex=t+(s-l)):t<n?(l=(i[3]-t+1)%s)&&t-(s-l)>=0&&(a.colIndex=t-(s-l)):e>r&&(l=(e-i[0]+1)%o)&&(a.rowIndex=e+(o-l))}return a},e.prototype.performAutoFill=function(e){if(!e.rangeInfo&&(e.event.clientX>this.autoFillElementPosition.left&&e.event.clientX<this.autoFillElementPosition.left+10)&&(e.event.clientY>this.autoFillElementPosition.top&&e.event.clientY<this.autoFillElementPosition.top+10))this.positionAutoFillElement({isautofill:!1});else{var t=void 0;if(e.rangeInfo)t=e.rangeInfo;else{var r={clientY:It(e.event),target:e.event.target},n={clientX:wt(e.event),target:e.event.target};this.parent.notify(Ns,r),this.parent.notify(Os,n),t=this.getAutoFillRange({rowIndex:r.clientY,colIndex:n.clientX})}var i=this.parent.getActiveSheet();if(t&&t.fillRange){var a={dataRange:i.name+"!"+e.dAutoFillCell,fillRange:i.name+"!"+m(t.fillRange),direction:t.direction,fillType:e.fillType||this.parent.autoFillSettings.fillType,cancel:!1};if(this.parent.notify(Ar,{eventArgs:a,action:"autofill"}),a.cancel)return;var o=Gt(this.parent,t.fillRange);if(i.isProtected&&o)return void this.parent.notify(ss,null);e.rangeInfo?this.performAutoFillAction(a,null,o):(this.performAutoFillAction(a,t,o),this.positionAutoFillElement({isautofill:!0}))}}},e.prototype.refreshCell=function(e){this.parent.serviceLocator.getService("cell").refreshRange([e.rowIndex,e.colIndex,e.rowIndex,e.colIndex])},e.prototype.getDirection=function(e,r,n){if(n=t.isNullOrUndefined(n)?this.isVerticalFill:n){if(r.rowIndex<e.rowIndex)return"Up";if(r.rowIndex>e.rowIndex)return"Down";if(r.colIndex>e.colIndex)return"Right";if(r.colIndex<e.colIndex)return"Left"}else{if(r.colIndex>e.colIndex)return"Right";if(r.colIndex<e.colIndex)return"Left";if(r.rowIndex<e.rowIndex)return"Up";if(r.rowIndex>e.rowIndex)return"Down"}return null},e.prototype.performAutoFillAction=function(e,t,r){var n=this,i=this.parent.getActiveSheet(),a=this.parent.serviceLocator.getService(Fl);if(this.isMergedRange(c(e.fillRange))){var o=this.parent.serviceLocator.getService(Al);o.show({isModal:!0,showCloseIcon:!0,height:180,width:400,content:a.getConstant("AutoFillMergeAlertMsg"),buttons:[{buttonModel:{content:this.parent.serviceLocator.getService(Fl).getConstant("Ok"),isPrimary:!0},click:function(){o.hide(),n.parent.selectRange(e.dataRange)}}],close:function(){o.hide(),n.parent.selectRange(e.dataRange)}},!1)}else{this.isVerticalFill="Down"===e.direction||"Up"===e.direction,this.parent.notify(ui,{dataRange:e.dataRange,fillRange:e.fillRange,direction:e.direction,fillType:e.fillType,isLockedCell:r});var s=t?m([t.startCell.rowIndex,t.startCell.colIndex,t.endCell.rowIndex,t.endCell.colIndex]):i.selectedRange;me(this.parent,s,i);var l={dataRange:e.dataRange,fillRange:e.fillRange,fillType:e.fillType,direction:e.direction,selectedRange:s};this.parent.notify(Yo,{eventArgs:l,action:"autofill"}),this.parent.trigger("select",{range:this.parent.getActiveSheet().selectedRange}),this.parent.showAggregate&&this.parent.notify(gs,{})}},e.prototype.getRangeData=function(e){for(var t,r=[],n=this.parent.getActiveSheet(),i=e.range[0],a=e.range[1],o=e.range[2],s=e.range[3],l=a;i<=o;)if(je(n,i))i++;else{for(a=l;a<=s;)Qe(n,a)?a++:(t=Re(i,a,n),r.push(t),a++);i++}return r},e.prototype.isMergedRange=function(e){var t=0,r=this.getRangeData({range:e,sheetIdx:this.parent.activeSheetIndex});for(t=0;t<r.length;t++)if(r[t]&&(r[t].rowSpan||r[t].colSpan))return!0;return!1},e.prototype.addEventListener=function(){this.parent.on(Na,this.createAutoFillElement,this),this.parent.on(il,this.positionAutoFillElement,this),this.parent.on(al,this.hideAutoFillOptions,this),this.parent.on(ll,this.hideAutoFillElement,this),this.parent.on(ol,this.performAutoFill,this),this.parent.on(sl,this.selectAutoFillRange,this),this.parent.on(fi,this.refreshCell,this),this.parent.on(mi,this.getautofillDDB,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(Na,this.createAutoFillElement),this.parent.off(il,this.positionAutoFillElement),this.parent.off(al,this.hideAutoFillOptions),this.parent.off(ll,this.hideAutoFillElement),this.parent.off(ol,this.performAutoFill),this.parent.off(sl,this.selectAutoFillRange),this.parent.off(fi,this.refreshCell),this.parent.off(mi,this.getautofillDDB))},e.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.parent=null},e.prototype.getModuleName=function(){return"autofill"},e}(),mh=function(){function e(e){this.parent=e}return e.prototype.show=function(e,r){var i,a=this;r=!!t.isNullOrUndefined(r);var o=e.close||null,s={header:"Spreadsheet",cssClass:this.parent.cssClass,target:this.parent.element,buttons:[],allowDragging:!0};e.close=function(){a.destroyDialog(),o&&o()},t.extend(s,e),r&&(i=this.parent.serviceLocator.getService(Fl).getConstant(s.buttons.length?"Cancel":"Ok"),s.buttons.push({buttonModel:{content:i,isPrimary:0===s.buttons.length},click:this.hide.bind(this)}));var l=this.parent.createElement("div");document.body.appendChild(l),this.dialogInstance=new n.Dialog(s),this.dialogInstance.createElement=this.parent.createElement,this.dialogInstance.appendTo(l),this.dialogInstance.refreshPosition()},e.prototype.destroyDialog=function(){this.dialogInstance.destroy(),t.remove(this.dialogInstance.element),this.dialogInstance=null},e.prototype.hide=function(e){this.dialogInstance&&(e&&(this.dialogInstance.animationSettings.effect="None",this.dialogInstance.dataBind()),this.dialogInstance.hide())},e.prototype.destroy=function(){this.parent=null},e}(),vh=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.initializeActionBegin=function(){var e=this,t=this.parent.beforeCellFormat;this.parent.beforeCellFormat=function(r){e.actionEventHandler({evtArgs:r,evtFunc:t,actionType:"begin",eventType:"format"})};var r=this.parent.beforeOpen;this.parent.beforeOpen=function(t){e.actionEventHandler({evtArgs:t,evtFunc:r,actionType:"begin",eventType:"beforeOpen"})};var n=this.parent.beforeSave;this.parent.beforeSave=function(t){e.actionEventHandler({evtArgs:t,evtFunc:n,actionType:"begin",eventType:"beforeSave"})};var i=this.parent.beforeSort;this.parent.beforeSort=function(t){e.actionEventHandler({evtArgs:t,evtFunc:i,actionType:"begin",eventType:"beforeSort"})}},e.prototype.initializeActionComplete=function(){var e=this,t=this.parent.sortComplete;this.parent.sortComplete=function(r){e.actionEventHandler({evtArgs:r,evtFunc:t,actionType:"complete",eventType:"sorting"})};var r=this.parent.cellSave;this.parent.cellSave=function(t){e.actionEventHandler({evtArgs:t,evtFunc:r,actionType:"complete",eventType:"cellSave"})}},e.prototype.actionEventHandler=function(e){e.evtFunc&&e.evtFunc.apply(this,[e]),"begin"===e.actionType?this.actionBeginHandler({eventArgs:e.evtArgs,action:e.eventType}):this.actionCompleteHandler({eventArgs:e.evtArgs,action:e.eventType})},e.prototype.actionBeginHandler=function(e){var t=e.preventAction;delete e.preventAction;var r={action:e.action};e.isUndo&&(r.isUndo=!0,delete e.isUndo),e.isRedo&&(r.isUndo=!1,delete e.isRedo),r.args=e,this.parent.trigger("actionBegin",r),t||"clipboard"!==e.action&&"format"!==e.action&&"cellSave"!==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(Mo,{args:e}),t&&(e.preventAction=!0),r.isUndo&&(e.isUndo=!0),!1===r.isUndo&&(e.isRedo=!0)},e.prototype.actionCompleteHandler=function(e){var t=e.preventAction;delete e.preventAction,this.parent.notify(Rr,e),e.preventEventTrigger||this.parent.trigger("actionComplete",e),t||"undoRedo"===e.action||"gotoSheet"===e.action||this.parent.notify(Po,{args:e}),this.parent.notify(il,null)},e.prototype.addEventListener=function(){this.parent.on(Yo,this.actionCompleteHandler,this),this.parent.on(Ar,this.actionBeginHandler,this),this.parent.on(Ta,this.removeEventListener,this)},e.prototype.removeEventListener=function(){this.parent.off(Yo,this.actionCompleteHandler),this.parent.off(Ar,this.actionBeginHandler),this.parent.off(Ta,this.removeEventListener)},e}(),yh=function(){function e(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(el,this.isOverlaySelected,this),this.parent.on(Fs,this.refreshOverlayElem,this),this.parent.on(Ta,this.destroy,this)}return e.prototype.insertOverlayElement=function(e,r,n){var i=this.parent.createElement("div",{id:e,attrs:{class:"e-ss-overlay"},styles:"width: "+this.minWidth+"; height: "+this.minHeight});if(this.parent.allowEditing){var a=this.parent.element.getElementsByClassName("e-ss-overlay-active")[0];a&&(t.removeClass([a],"e-ss-overlay-active"),this.parent.notify(qs,{})),i.classList.add("e-ss-overlay-active")}var o=c(r),s=this.parent.sheets[n],l=this.parent.frozenRowCount(s),h=this.parent.frozenColCount(s),d=lt(s,o,l,h,this.parent.viewport.beforeFreezeHeight,this.parent.viewport.beforeFreezeWidth,this.parent.sheetModule.colGroupWidth,!0);if(o[0]>=l&&o[1]<h){var p=this.parent.sheetModule.contentPanel;p.scrollTop&&(d.top-=p.scrollTop,d.top+=this.parent.getColumnHeaderContent().parentElement.getBoundingClientRect().height)}if(o[1]>=h&&o[0]<l){var f=this.parent.getScrollElement();f.scrollLeft&&(d.left-=f.scrollLeft,d.left+=this.parent.sheetModule.getRowHeaderWidth(s))}var g;return o[0]<l||o[1]<h?(g=this.parent.element.querySelector("#"+this.parent.element.id+"_sheet"),l&&(o[0]>=l?d.top+=(s.showHeaders?31:0)+Ye(s,u(s.topLeftCell)[0],l-1):h||(d.left+=this.parent.sheetModule.getRowHeaderWidth(s,!0))),h&&(o[1]>=h?d.left+=this.parent.sheetModule.getRowHeaderWidth(s):l||(d.left+=s.showHeaders?31:0))):g=this.parent.getMainContent(),i.style.top=Number(Qt(d.top).toFixed(2))+"px",i.style.left=Number(Qt(d.left).toFixed(2))+"px",n===this.parent.activeSheetIndex&&(g.appendChild(i),this.renderResizeHandler(i),this.addEventListener(i)),this.originalWidth=parseFloat(getComputedStyle(i,null).getPropertyValue("width").replace("px","")),this.originalHeight=parseFloat(getComputedStyle(i,null).getPropertyValue("height").replace("px","")),{element:i,top:d.top,left:d.left}},e.prototype.adjustFreezePaneSize=function(e,r,n){var i=c(n),a=this.parent.getActiveSheet(),o=this.parent.frozenRowCount(a),s=this.parent.frozenColCount(a);if(i[0]<o||i[1]<s?(t.isNullOrUndefined(e.top)||(r.style.top=e.top+(a.showHeaders?31:0)-this.parent.viewport.beforeFreezeHeight+"px"),t.isNullOrUndefined(e.left)||(r.style.left=e.left+this.parent.sheetModule.getRowHeaderWidth(a,!0)-this.parent.viewport.beforeFreezeWidth+"px")):(t.isNullOrUndefined(e.top)||(r.style.top=e.top-this.parent.viewport.beforeFreezeHeight-(o?Ye(a,u(a.topLeftCell)[0],o-1):0)+"px"),t.isNullOrUndefined(e.left)||(r.style.left=e.left-this.parent.viewport.beforeFreezeWidth-(s?Ze(a,u(a.topLeftCell)[1],s-1):0)+"px")),t.isNullOrUndefined(e.top)){var l=u(a.topLeftCell)[0];e.top=this.parent.viewport.beforeFreezeHeight+(o&&l===i[0]?0:Ye(a,o?l:0,i[0]-1))}if(t.isNullOrUndefined(e.left)){var h=u(a.topLeftCell)[1];e.left=this.parent.viewport.beforeFreezeWidth+(s&&h===i[1]?0:Ze(a,s?h:0,i[1]-1))}},e.prototype.addEventListener=function(e){var r=e;t.EventHandler.add(r,ut(),this.overlayClickHandler,this),t.EventHandler.add(r,ft(),this.overlayMouseMoveHandler,this),t.EventHandler.add(this.parent.element.querySelector("#"+this.parent.element.id+"_sheet"),ft(),this.overlayMouseMoveHandler,this),t.EventHandler.add(document,gt(),this.overlayMouseUpHandler,this),this.parent.on(rl,this.setOriginalSize,this)},e.prototype.setOriginalSize=function(e){this.originalHeight=e.height,this.originalWidth=e.width},e.prototype.overlayMouseMoveHandler=function(e){var r,n,i,a,o,s,l=e.target,h=document.getElementsByClassName("e-ss-overlay-active")[0],d=this.parent.getActiveSheet(),p=d.frozenRows||d.frozenColumns?[29,this.parent.sheetModule.getRowHeaderWidth(d,!0)]:[-1,-1];if(this.isOverlayClicked&&this.isResizerClicked)switch(vt(e)&&e.preventDefault(),this.resizer){case"e-ss-overlay-t":r=Math.max(this.originalMouseY-It(e)+this.originalHeight,20),n=It(e)-(this.originalMouseY-this.originalResizeTop),r>20&&n>p[0]&&(h.style.height=r+"px",h.style.top=n+"px",this.resizedReorderTop=n,this.currenHeight=r,this.parent.notify(ni,{height:h.style.height,width:h.style.width,overlayEle:h}));break;case"e-ss-overlay-r":(i=this.originalWidth+(Et(e)-this.originalMouseX))>20&&(h.style.width=i+"px",this.currentWidth=i,this.parent.notify(ni,{height:h.style.height,width:h.style.width,overlayEle:h}));break;case"e-ss-overlay-b":(a=this.originalHeight+(Rt(e)-this.originalMouseY))>20&&(h.style.height=a+"px",this.currenHeight=a,this.parent.notify(ni,{height:h.style.height,width:h.style.width,overlayEle:h}));break;case"e-ss-overlay-l":o=Math.max(this.originalMouseX-wt(e)+this.originalWidth,20),s=wt(e)-(this.originalMouseX-this.originalResizeLeft),o>20&&s>p[1]&&(h.style.width=o+"px",h.style.left=s+"px",this.resizedReorderLeft=s,this.currentWidth=o,this.parent.notify(ni,{height:h.style.height,width:h.style.width,overlayEle:h}))}else if(this.isOverlayClicked)if(vt(e)&&e.preventDefault(),t.closest(l,".e-sheet")&&!l.classList.contains("e-sheet-content")||l.classList.contains("e-cell")){if(!h)return;var c=wt(e)-this.diffX,u=It(e)-this.diffY;c>p[1]&&(h.style.left=c+"px"),u>p[0]&&(h.style.top=u+"px"),this.resizedReorderLeft=c<0?0:c,this.resizedReorderTop=u<0?0:u}else this.overlayMouseUpHandler(e,!0)},e.prototype.overlayMouseUpHandler=function(e,r){if(this.parent&&!this.parent.getActiveSheet().isProtected&&this.parent.allowEditing){this.isResizerClicked=!1;var n=e.target,i=document.getElementsByClassName("e-datavisualization-chart e-ss-overlay-active");n.classList.contains("e-ss-overlay")||(n=t.closest(e.target,".e-datavisualization-chart")?t.closest(e.target,".e-datavisualization-chart"):n);var a=this.parent.getActiveSheet(),o={prevTop:a.frozenRows||a.frozenColumns?this.prevY:this.originalReorderTop,prevLeft:a.frozenRows||a.frozenColumns?this.prevX:this.originalReorderLeft,currentTop:this.resizedReorderTop>=0?parseInt(this.resizedReorderTop.toString(),10):this.originalReorderTop,currentLeft:this.resizedReorderLeft>=0?parseInt(this.resizedReorderLeft.toString(),10):this.originalReorderLeft,id:n.id,currentHeight:this.currenHeight,currentWidth:this.currentWidth,requestType:"imageRefresh",prevHeight:this.originalHeight,prevWidth:this.originalWidth};if(this.isOverlayClicked||r){var s=void 0,l=void 0,h={clientY:o.prevTop,isImage:!0},d={clientX:o.prevLeft,isImage:!0},p=this.parent.element.getElementsByClassName("e-ss-overlay-active")[0];if(a.frozenRows||a.frozenColumns){if(!p)return;h.isImage=!1,d.isImage=!1,h.target=p,d.target=p,o.prevTop<this.parent.getColumnHeaderContent().getBoundingClientRect().bottom&&(h.target=this.parent.getColumnHeaderContent()),o.prevLeft<this.parent.getRowHeaderContent().getBoundingClientRect().right&&(d.target=this.parent.getRowHeaderTable());var c=p.getBoundingClientRect();s={clientY:c.top},l={clientX:c.left},c.top<this.parent.getColumnHeaderContent().getBoundingClientRect().bottom&&(s.target=this.parent.getColumnHeaderContent()),c.left<this.parent.getRowHeaderContent().getBoundingClientRect().right&&(l.target=this.parent.getRowHeaderTable())}else s={clientY:o.currentTop,isImage:!0},l={clientX:o.currentLeft,isImage:!0};if(this.parent.notify(Ns,h),this.parent.notify(Ns,s),this.parent.notify(Os,d),this.parent.notify(Os,l),s.size&&(o.currentTop=s.size),l.size&&(o.currentLeft=l.size),o.prevRowIdx=h.clientY,o.prevColIdx=d.clientX,o.currentRowIdx=s.clientY,o.currentColIdx=l.clientX,(a.frozenColumns||a.frozenRows)&&!t.closest(p,".e-sheet-content")){var u=this.parent.frozenColCount(a),f=this.parent.frozenRowCount(a);if(o.currentRowIdx>=f&&o.currentColIdx>=u){var g=parseInt(p.style.top,10),m=parseInt(p.style.left,10);g+=this.parent.sheetModule.contentPanel.scrollTop,g-=this.parent.getColumnHeaderContent().parentElement.getBoundingClientRect().height;m+=this.parent.getScrollElement().scrollLeft,m-=this.parent.sheetModule.getRowHeaderWidth(a),p.style.top=g+"px",p.style.left=m+"px",this.parent.getMainContent().appendChild(p)}}i&&i[0]&&i[0].querySelector(".e-control")&&(o.id=i[0].id),this.originalReorderTop!==this.resizedReorderTop||this.originalReorderLeft!==this.resizedReorderLeft?(o.id=p.id,i&&i[0]?(o.requestType="chartRefresh",this.parent.notify(Ps,o)):this.parent.notify(As,o),this.resizedReorderTop=this.originalReorderTop,this.resizedReorderLeft=this.originalReorderLeft):this.currenHeight===this.originalHeight&&this.originalWidth===this.currentWidth||(o.id=n.id.indexOf("overlay")>0?n.id:n.parentElement&&n.parentElement.classList.contains("e-ss-overlay")?n.parentElement.id:p.id,i&&i[0]?(o.requestType="chartRefresh",this.parent.notify(Ps,o)):this.parent.notify(As,o),this.originalHeight=this.currenHeight,this.originalWidth=this.currentWidth)}this.isOverlayClicked=!1}},e.prototype.isOverlaySelected=function(e){e.isOverlayClicked=this.isOverlayClicked},e.prototype.refreshOverlayElem=function(e){if(e){var r=".e-ss-overlay-active"+(e&&e.selector||""),n=this.parent.element.querySelector(r);n&&(t.removeClass([n],"e-ss-overlay-active"),this.parent.notify(qs,{}))}else{r="e-ss-overlay-active";for(var i=Array.from(this.parent.element.getElementsByClassName(r)),a=0;a<i.length;a++){var o=i[a];o&&(t.removeClass([o],"e-ss-overlay-active"),this.parent.notify(qs,{}))}}this.parent.notify(Vs,null)},e.prototype.overlayClickHandler=function(e){if(!this.parent.getActiveSheet().isProtected&&this.parent.allowEditing){this.isOverlayClicked=!0;var r=e.target,n=e.target;r.classList.contains("e-ss-overlay")||(n=r.parentElement,t.closest(e.target,".e-datavisualization-chart")&&(n=t.closest(e.target,".e-datavisualization-chart")));var i=this.parent.getActiveSheet();if((i.frozenColumns||i.frozenRows)&&t.closest(n,".e-sheet-content")){var a=parseInt(n.style.top,10),o=parseInt(n.style.left,10);a-=this.parent.sheetModule.contentPanel.scrollTop,a+=this.parent.getColumnHeaderContent().parentElement.getBoundingClientRect().height;o-=this.parent.getScrollElement().scrollLeft,o+=this.parent.sheetModule.getRowHeaderWidth(i),n.style.top=a+"px",n.style.left=o+"px",this.parent.element.querySelector("#"+this.parent.element.id+"_sheet").appendChild(n)}this.originalWidth=this.currentWidth=parseFloat(n.style.width),this.originalHeight=this.currenHeight=parseFloat(n.style.height),this.originalReorderLeft=parseFloat(n.style.left),this.originalReorderTop=parseFloat(n.style.top),this.resizedReorderLeft=parseFloat(n.style.left),this.resizedReorderTop=parseFloat(n.style.top),this.originalResizeTop=this.originalReorderTop,this.originalResizeLeft=this.originalReorderLeft,this.originalMouseX=wt(e),this.originalMouseY=It(e),this.diffX=this.originalMouseX-this.originalReorderLeft,this.diffY=this.originalMouseY-this.originalReorderTop;var s=document.getElementsByClassName("e-ss-overlay-active")[0];s&&t.removeClass([s],"e-ss-overlay-active"),this.parent.element.querySelector("#"+n.id).classList.add("e-ss-overlay-active"),r.classList.contains("e-ss-resizer")&&(this.resizer=r.classList[0],this.isResizerClicked=!0),n.classList.contains("e-datavisualization-chart")&&(this.parent.notify(oi,{id:n.id}),s||this.parent.notify(js,{id:n.id}));var l=n.getBoundingClientRect();this.prevX=l.left,this.prevY=l.top}},e.prototype.renderResizeHandler=function(e){for(var r,n=["e-ss-overlay-t","e-ss-overlay-r","e-ss-overlay-b","e-ss-overlay-l"],i=0;i<n.length;)r=this.parent.createElement("div",{className:n[i]+" e-ss-resizer"+(t.Browser.isDevice?" e-ss-resizer-touch":""),styles:"width: 8px; height: 8px; border-radius: 4px;"}),e.appendChild(r),i++},e.prototype.removeEventListener=function(){var e=this.parent.element.querySelectorAll(".e-ss-overlay");if(e.length)for(var r=0;r<e.length;r++)t.EventHandler.remove(e[r],ut(),this.overlayClickHandler),t.EventHandler.remove(e[r],ft(),this.overlayMouseMoveHandler);var n=this.parent.element.querySelector("#"+this.parent.element.id+"_sheet");n&&t.EventHandler.remove(n,ft(),this.overlayMouseMoveHandler),document&&t.EventHandler.remove(document,gt(),this.overlayMouseUpHandler),this.parent.isDestroyed||(this.parent.off(rl,this.setOriginalSize),this.parent.off(el,this.isOverlaySelected),this.parent.off(Fs,this.refreshOverlayElem),this.parent.off(Ta,this.destroy))},e.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},e}(),Ch=function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),bh=function(){return(bh=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e}).apply(this,arguments)},xh=function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},Sh=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return Ch(r,e),xh([t.Property("")],r.prototype,"text",void 0),xh([t.Property("")],r.prototype,"iconCss",void 0),xh([t.Property("left")],r.prototype,"iconPosition",void 0),r}(t.ChildProperty),wh=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return Ch(r,e),xh([t.Complex({},Sh)],r.prototype,"header",void 0),xh([t.Collection([],i.Item)],r.prototype,"content",void 0),xh([t.Property("")],r.prototype,"cssClass",void 0),xh([t.Property(!1)],r.prototype,"disabled",void 0),r}(t.ChildProperty),Ih=function(e){function r(t,r){return e.call(this,t)||this}return Ch(r,e),r.prototype.preRender=function(){},r.prototype.render=function(){this.element.id||(this.element.id=t.getUniqueID("ribbon")),this.renderRibbon()},r.prototype.destroy=function(){var r=this.element.querySelector(".e-drop-icon");if(r&&r.removeEventListener("click",this.ribbonExpandCollapse.bind(this)),this.menuItems.length){var n=document.getElementById(this.element.id+"_menu");n&&t.getComponent(n,"menu").destroy()}this.toolbarObj&&this.toolbarObj.destroy(),this.tabObj&&this.tabObj.destroy(),this.element.innerHTML="",this.toolbarObj=null,this.tabObj=null,e.prototype.destroy.call(this)},r.prototype.getTabItems=function(){var e=this,t=[];return this.menuItems.length&&t.push({header:{text:this.initMenu(this.menuItems)},content:this.toolbarObj.element,cssClass:"e-menu-tab"}),this.items.forEach(function(r){t.push({header:r.header,content:e.toolbarObj.element})}),t},r.prototype.initMenu=function(e){var r=this,n=this.createElement("ul",{id:this.element.id+"_menu"});this.element.appendChild(n);var a=new i.Menu({cssClass:"e-file-menu",items:e,showItemOnClick:!0,beforeOpen:function(t){t.parentItem.text===e[0].text&&(a.showItemOnClick=!1),r.trigger("beforeOpen",t)},select:function(e){r.trigger("fileMenuItemSelect",e)},beforeClose:function(n){"mouseover"!==n.event.type||t.closest(n.event.target,".e-menu-popup")?(r.trigger("beforeClose",n),n.parentItem&&n.parentItem.text!==e[0].text||a.setProperties({showItemOnClick:!0},!0)):n.cancel=!0},beforeItemRender:function(e){r.trigger("beforeFileMenuItemRender",e)},created:function(){a.element.removeAttribute("tabindex");var e=a.element.querySelector(".e-menu-item");e&&e.removeAttribute("tabindex")}});return a.createElement=this.createElement,a.appendTo(n),n.parentElement},r.prototype.renderRibbon=function(){var e,r=this,n=this.createElement("div"),a=this.createElement("div");this.toolbarObj=new i.Toolbar({items:this.items[this.selectedTab].content,clicked:function(e){return r.trigger("clicked",e)}}),this.toolbarObj.createElement=this.createElement,this.toolbarObj.appendTo(a),this.tabObj=new i.Tab({selectedItem:this.getIndex(this.selectedTab),animation:{next:{duration:0},previous:{duration:0}},items:this.getTabItems(),selecting:function(n){if(n.isSwiped)n.cancel=!0;else if(e=n.event&&n.event.isShortcut,r.menuItems.length&&0===n.selectingIndex){if(n.cancel=!0,(!n.event||e||"keydown"===n.event.type)&&n.selectingItem){var i=n.selectingItem.querySelector(".e-file-menu .e-menu-item");i&&i.click()}}else{if(n.selectingIndex===r.getIndex(r.selectedTab))return;r.updateToolbar(r.getIndex(n.selectingIndex,!0)),r.toolbarObj.dataBind(),r.element.classList.contains("e-collapsed")&&t.EventHandler.remove(n.selectedItem,"click",r.ribbonExpandCollapse);var a=void 0;r.menuItems.length?((a=bh({},n)).selectingIndex-=1,a.selectedIndex-=1):a=n,r.trigger("selecting",a)}},selected:function(t){t.isInteracted||e||(t.preventFocus=!0),t.selectedIndex!==r.getIndex(r.selectedTab)&&(r.setProperties({selectedTab:r.getIndex(t.selectedIndex,!0)},!0),r.element.classList.contains("e-collapsed")&&(r.element.classList.remove("e-collapsed"),r.trigger("expandCollapse",{element:r.toolbarObj.element,expanded:!0})))},created:function(){r.toolbarObj.refreshOverflow()}}),this.element.appendChild(n),this.tabObj.createElement=this.createElement,this.tabObj.appendTo(n);var o=this.createElement("span",{className:"e-drop-icon e-icons"});o.addEventListener("click",this.ribbonExpandCollapse.bind(this)),this.element.appendChild(o)},r.prototype.ribbonExpandCollapse=function(e){var r,n={element:this.toolbarObj.element,expanded:!0};this.element.classList.contains("e-collapsed")?(r=this.tabObj.element.querySelector(".e-tab-header").getElementsByClassName("e-toolbar-item")[this.tabObj.selectedItem],this.element.classList.remove("e-collapsed"),r.classList.add("e-active"),t.EventHandler.remove(r,"click",this.ribbonExpandCollapse),this.trigger("expandCollapse",n)):(r=this.tabObj.element.querySelector(".e-tab-header .e-toolbar-item.e-active"),this.element.classList.add("e-collapsed"),n.expanded=!1,r.classList.remove("e-active"),t.EventHandler.add(r,"click",this.ribbonExpandCollapse,this),this.trigger("expandCollapse",n))},r.prototype.getIndex=function(e,t){return this.menuItems.length?t?e-1:e+1:e},r.prototype.updateToolbar=function(e){this.toolbarObj.items=this.items[e].content,this.toolbarObj.dataBind()},r.prototype.enableMenuItems=function(e,r,n){void 0===r&&(r=!0),this.menuItems.length&&t.getComponent(document.getElementById(this.element.id+"_menu"),"menu").enableItems(e,r,n)},r.prototype.hideMenuItems=function(e,r,n){if(void 0===r&&(r=!0),this.menuItems.length){var i=t.getComponent(document.getElementById(this.element.id+"_menu"),"menu");r?i.hideItems(e,n):i.showItems(e,n)}},r.prototype.addMenuItems=function(e,r,n,i){if(void 0===n&&(n=!0),this.menuItems.length){var a=t.getComponent(document.getElementById(this.element.id+"_menu"),"menu");n?a.insertAfter(e.reverse(),r,i):a.insertBefore(e,r,i)}},r.prototype.hideTabs=function(e,t){var r=this;void 0===t&&(t=!0);var n,i,a,o;if(t||(o=this.isAllHidden()),e.forEach(function(e){(n=r.getTabIndex(e,-1))>-1&&(t?r.items[n].cssClass.includes(" e-hide")||(r.items[n].cssClass=r.items[n].cssClass+" e-hide",r.tabObj.items[r.getIndex(n)].cssClass=r.items[n].cssClass,void 0===i&&n===r.selectedTab&&(i=!0),a=!0):r.items[n].cssClass.includes(" e-hide")&&(r.items[n].cssClass=r.items[n].cssClass.replace(" e-hide",""),r.tabObj.items[r.getIndex(n)].cssClass=r.items[n].cssClass,void 0===i&&n===r.selectedTab&&(i=!0),a=!0))}),this.setProperties({items:this.items},!0),this.tabObj.items=this.tabObj.items,this.tabObj.dataBind(),t&&(o=this.isAllHidden())&&(i=!1),!t&&o&&(i=!i),a&&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"))),i)for(var s=0;s<this.items.length;s++)if(!this.items[s].cssClass.includes(" e-hide")){this.tabObj.selectedItem=this.getIndex(s),this.tabObj.dataBind();break}},r.prototype.isAllHidden=function(){for(var e=!0,t=0;t<this.items.length;t++)if(!this.items[t].cssClass.includes(" e-hide")){e=!1;break}return e},r.prototype.enableTabs=function(e,t){var r=this;void 0===t&&(t=!0),e.forEach(function(e){var n=r.getTabIndex(e,-1);n>-1&&(r.items[n].disabled=!t,n=r.getIndex(n),r.tabObj.enableTab(n,t))}),this.setProperties({items:this.items},!0)},r.prototype.addTabs=function(e,t){var r=this,n=this.getTabIndex(t);e.forEach(function(e){e=new wh(r.items[0],"items",e,!0),r.items.splice(n,0,e),r.tabObj.addTab([{header:e.header,content:r.toolbarObj.element}],r.getIndex(n)),n++}),this.setProperties({items:this.items},!0),this.setProperties({selectedTab:this.getIndex(this.tabObj.selectedItem,!0)},!0)},r.prototype.getTabIndex=function(e,t){if(void 0===t&&(t=this.items.length),e)for(var r=0;r<this.items.length;r++)if(this.items[r].header.text===e){t=r;break}return t},r.prototype.addToolbarItems=function(e,r,n){var a=this,o=this.getTabIndex(e);t.isNullOrUndefined(n)&&(n=this.items[o].content.length),r.forEach(function(e){e=new i.Item(a.items[o].content[0],"content",e,!0),a.items[o].content.splice(n,0,e),n++}),this.setProperties({items:this.items},!0),o===this.selectedTab&&r.length&&this.updateToolbar(o)},r.prototype.enableItems=function(e,t,r){if(void 0===r&&(r=!0),t){var n=this.getTabIndex(e,-1);if(n<0)return;for(var i=0;i<t.length;i++){if("string"==typeof t[i])for(var a=0;a<this.items[n].content.length;a++)if(this.items[n].content[a].id===t[i]){t[i]=a;break}if("string"==typeof t[i]){if(t.length-1>i)continue;return}this.items[n].content[t[i]].disabled=!r,this.setProperties({items:this.items},!0),n===this.selectedTab&&this.toolbarObj.enableItems(t[i],r)}}else this.toolbarObj.disable(!r)},r.prototype.hideToolbarItems=function(e,t,r){var n=this;void 0===r&&(r=!0);for(var i,a,o=0;o<this.items.length;o++)if(this.items[o].header.text===e){i=o,t.forEach(function(e){(a=n.items[i].content[e])&&(r?a.cssClass.includes(" e-hide")||(a.cssClass=a.cssClass+" e-hide"):a.cssClass.includes(" e-hide")&&(a.cssClass=a.cssClass.replace(" e-hide","")))});break}this.setProperties({items:this.items},!0),void 0!==i&&i===this.selectedTab&&this.updateToolbar(i)},r.prototype.getModuleName=function(){return"ribbon"},r.prototype.getPersistData=function(){return this.addOnPersist([])},r.prototype.onPropertyChanged=function(e,t){for(var r=0,n=Object.keys(e);r<n.length;r++){switch(n[r]){case"selectedTab":this.tabObj.selectedItem=this.getIndex(e.selectedTab),this.tabObj.dataBind()}}},xh([t.Property("")],r.prototype,"cssClass",void 0),xh([t.Property(!0)],r.prototype,"menuType",void 0),xh([t.Collection([],i.MenuItem)],r.prototype,"menuItems",void 0),xh([t.Property(0)],r.prototype,"selectedTab",void 0),xh([t.Collection([],wh)],r.prototype,"items",void 0),xh([t.Event()],r.prototype,"selecting",void 0),xh([t.Event()],r.prototype,"fileMenuItemSelect",void 0),xh([t.Event()],r.prototype,"beforeFileMenuItemRender",void 0),xh([t.Event()],r.prototype,"beforeOpen",void 0),xh([t.Event()],r.prototype,"beforeClose",void 0),xh([t.Event()],r.prototype,"selectFormat",void 0),xh([t.Event()],r.prototype,"clicked",void 0),xh([t.Event()],r.prototype,"created",void 0),xh([t.Event()],r.prototype,"expandCollapse",void 0),r=xh([t.NotifyPropertyChanges],r)}(t.Component),Eh=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.render=function(){var e=this,r=this.parent.element.id,n=this.parent.createElement("input",{attrs:{type:"color"}}),i=function(e){e.element.tabIndex=-1};this.fontColorPicker=new a.ColorPicker({value:"#000000ff",mode:"Palette",showButtons:!1,presetColors:Nl,enableOpacity:!1,cssClass:"e-spreadsheet-color-popup",beforeTileRender:i,beforeClose:function(){return e.beforeCloseHandler(e.fontColorPicker)},open:this.openHandler.bind(this),beforeModeSwitch:function(t){return e.beforeModeSwitch(e.fontColorPicker,t)},change:function(t){var r={style:{color:e.fontColorPicker.getValue(t.currentValue.rgba)},onActionUpdate:!0};e.parent.notify(Br,r),r.cancel?e.fontColorPicker.setProperties({value:e.fontColorPicker.getValue(t.previousValue.rgba,"HEXA")},!0):e.updateSelectedColor(r.style.color,e.fontColorPicker.element,"TextColor")},created:function(){return e.updateSelectedColor("#000000",e.fontColorPicker.element,"TextColor",!0)}}),this.fontColorPicker.createElement=this.parent.createElement,this.parent.element.appendChild(n),this.fontColorPicker.appendTo(n),n.parentElement.id=r+"_font_color_picker",t.addClass([n.nextElementSibling.getElementsByClassName("e-selected-color")[0]],["e-icons","e-font-color"]),n=this.parent.createElement("input",{attrs:{type:"color"}}),this.filColorPicker=new a.ColorPicker({value:"#ffff00ff",mode:"Palette",presetColors:Ol,showButtons:!1,enableOpacity:!1,cssClass:"e-spreadsheet-color-popup",open:this.openHandler.bind(this),beforeTileRender:i,beforeClose:function(){return e.beforeCloseHandler(e.filColorPicker)},beforeModeSwitch:function(t){return e.beforeModeSwitch(e.filColorPicker,t)},change:function(t){var r={style:{backgroundColor:e.filColorPicker.getValue(t.currentValue.rgba)},onActionUpdate:!0};e.parent.notify(Br,r),r.cancel?e.filColorPicker.setProperties({value:e.filColorPicker.getValue(t.previousValue.rgba,"HEXA")},!0):e.updateSelectedColor(r.style.backgroundColor,e.filColorPicker.element,"FillColor")},created:function(){return e.updateSelectedColor("#ffff00",e.filColorPicker.element,"FillColor",!0)}}),this.filColorPicker.createElement=this.parent.createElement,this.parent.element.appendChild(n),this.filColorPicker.appendTo(n),n.parentElement.id=r+"_fill_color_picker",t.addClass([n.nextElementSibling.getElementsByClassName("e-selected-color")[0]],["e-icons","e-fill-color"])},e.prototype.updateSelectedColor=function(e,t,r,n){var i=this.parent.serviceLocator.getService(Fl).getConstant(r);n&&t.parentElement.querySelector(".e-dropdown-btn").setAttribute("aria-label",i);var a=t.parentElement.querySelector(".e-split-colorpicker");a.setAttribute("aria-label",i+" "+e),a.firstElementChild.style.borderBottomColor=e},e.prototype.openHandler=function(e){e.element.querySelector(".e-mode-switch-btn").title=this.parent.serviceLocator.getService(Fl).getConstant("MoreColors")},e.prototype.beforeCloseHandler=function(e){e.modeSwitcher||e.setProperties({modeSwitcher:!0},!0),e.showButtons&&e.setProperties({showButtons:!1},!0),Wt(e.element.parentElement.querySelector(".e-split-colorpicker"))},e.prototype.beforeModeSwitch=function(e,t){var r=this.parent.serviceLocator.getService(Fl);"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"))},e.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)},e.prototype.addEventListener=function(){this.parent.on(vo,this.render,this),this.parent.on("destroyRibbonComponents",this.destroy,this),this.parent.on(Ta,this.destroy,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(vo,this.render),this.parent.off("destroyRibbonComponents",this.destroy),this.parent.off(Ta,this.destroy))},e}(),Rh=function(){function e(e){this.border="1px solid #000000",this.fontNameIndex=5,this.numPopupWidth=0,this.preTabIdx=1,this.parent=e,this.addEventListener(),new Eh(e)}return e.prototype.getModuleName=function(){return"ribbon"},e.prototype.ribbonOperation=function(e){e&&e.onPropertyChange?this.onPropertyChanged(e.prop):this.initialize()},e.prototype.initialize=function(e){if(this.parent.notify(vo,{}),this.parent.isMobileView())this.createMobileView();else{var t=e&&(this.parent.element.querySelector(".e-formula-bar-panel")||document.getElementById(this.parent.element.id+"_sheet_panel"));this.createRibbon(t)}},e.prototype.getRibbonMenuItems=function(){var e=this.parent.serviceLocator.getService(Fl),t=this.parent.element.id;return[{text:this.parent.isMobileView()?"":e.getConstant("File"),iconCss:this.parent.isMobileView()?"e-icons e-file-menu-icon":null,id:t+"_File",items:[{text:e.getConstant("New"),id:t+"_New",iconCss:"e-new e-icons"},{text:e.getConstant("Open"),id:t+"_Open",iconCss:"e-open e-icons"},{text:e.getConstant("SaveAs"),iconCss:"e-save e-icons",id:t+"_Save_As",items:[{text:e.getConstant("ExcelXlsx"),id:t+"_Xlsx",iconCss:"e-xlsx e-icons"},{text:e.getConstant("ExcelXls"),id:t+"_Xls",iconCss:"e-xls e-icons"},{text:e.getConstant("CSV"),id:t+"_Csv",iconCss:"e-csv e-icons"},{text:e.getConstant("PDF"),id:t+"_Pdf",iconCss:"e-pdf e-icons"}]}]}]},e.prototype.getRibbonItems=function(){var e=this,r=this.parent.element.id,n=this.parent.serviceLocator.getService(Fl),i=[{header:{text:n.getConstant("Home")},content:[{prefixIcon:"e-undo-icon",tooltipText:n.getConstant("Undo")+" (Ctrl+Z)",htmlAttributes:{"aria-label":n.getConstant("Undo")},id:r+"_undo",disabled:!0},{prefixIcon:"e-redo-icon",tooltipText:n.getConstant("Redo")+" (Ctrl+Y)",htmlAttributes:{"aria-label":n.getConstant("Redo")},id:r+"_redo",disabled:!0},{type:"Separator",id:r+"_separator_1"},{prefixIcon:"e-cut-icon",tooltipText:n.getConstant("Cut")+" (Ctrl+X)",htmlAttributes:{"aria-label":n.getConstant("Cut")},id:r+"_cut"},{prefixIcon:"e-copy-icon",tooltipText:n.getConstant("Copy")+" (Ctrl+C)",htmlAttributes:{"aria-label":n.getConstant("Copy")},id:r+"_copy"},{tooltipText:n.getConstant("Paste")+" (Ctrl+V)",template:this.getPasteBtn(r,n),id:r+"_paste",disabled:!0},{type:"Separator",id:r+"_separator_2"},{template:this.getNumFormatDDB(r,n),tooltipText:n.getConstant("NumberFormat"),id:r+"_number_format"},{type:"Separator",id:r+"_separator_3"},{template:this.getFontNameDDB(r),tooltipText:n.getConstant("Font"),id:r+"_font_name"},{type:"Separator",id:r+"_separator_4"},{template:this.getFontSizeDDB(r),tooltipText:n.getConstant("FontSize"),id:r+"_font_size"},{type:"Separator",id:r+"_separator_5"},{template:this.getBtn(r,"bold",n.getConstant("Bold")),tooltipText:n.getConstant("Bold")+" (Ctrl+B)",id:r+"_bold"},{template:this.getBtn(r,"italic",n.getConstant("Italic")),tooltipText:n.getConstant("Italic")+" (Ctrl+I)",id:r+"_italic"},{template:this.getBtn(r,"line-through",n.getConstant("Strikethrough")),tooltipText:n.getConstant("Strikethrough")+" (Ctrl+5)",id:r+"_line-through"},{template:this.getBtn(r,"underline",n.getConstant("Underline")),tooltipText:n.getConstant("Underline")+" (Ctrl+U)",id:r+"_underline"},{template:document.getElementById(r+"_font_color_picker"),tooltipText:n.getConstant("TextColor"),id:r+"_font_color_picker"},{type:"Separator",id:r+"_separator_6"},{template:document.getElementById(r+"_fill_color_picker"),tooltipText:n.getConstant("FillColor"),id:r+"_fill_color_picker"},{template:this.getBordersDBB(r),tooltipText:n.getConstant("Borders"),id:r+"_borders"},{template:this.getMergeSplitBtn(r),tooltipText:n.getConstant("MergeCells"),id:r+"_merge_cells",disabled:!0},{type:"Separator",id:r+"_separator_7"},{template:this.getTextAlignDDB(r),tooltipText:n.getConstant("HorizontalAlignment"),id:r+"_text_align"},{template:this.getVerticalAlignDDB(r),tooltipText:n.getConstant("VerticalAlignment"),id:r+"_vertical_align"},{template:this.getBtn(r,"wrap",n.getConstant("WrapText"),!1),tooltipText:""+n.getConstant("WrapText"),id:r+"_wrap"}]},{header:{text:n.getConstant("Insert")},content:[{prefixIcon:"e-hyperlink-icon",text:n.getConstant("Link"),id:r+"_hyperlink",tooltipText:n.getConstant("Link"),click:function(){e.getHyperlinkDlg()}},{prefixIcon:"e-image-icon",text:n.getConstant("Image"),id:r+"_image",tooltipText:n.getConstant("Image"),click:function(){t.select("#"+r+"_imageUpload",e.parent.element).click()}}]},{header:{text:n.getConstant("Formulas")},content:[{prefixIcon:"e-insert-function",tooltipText:n.getConstant("InsertFunction"),text:n.getConstant("InsertFunction"),id:r+"_insert_function"}]},{header:{text:n.getConstant("Data")},content:[{prefixIcon:"e-protect-icon",text:n.getConstant("ProtectSheet"),id:r+"_protect",tooltipText:n.getConstant("ProtectSheet")},{prefixIcon:"e-password-protect-icon",text:n.getConstant("ProtectWorkbook"),id:r+"_protectworkbook",tooltipText:n.getConstant("ProtectWorkbook")},{type:"Separator",id:r+"_separator_8"},{template:this.datavalidationDDB(r),tooltipText:n.getConstant("DataValidation"),id:r+"_datavalidation"}]},{header:{text:n.getConstant("View")},content:[{prefixIcon:"e-hide-headers",text:this.getLocaleText("Headers"),id:r+"_headers",tooltipText:this.getLocaleText("Headers")},{type:"Separator",id:r+"_separator_9"},{prefixIcon:"e-hide-gridlines",text:this.getLocaleText("GridLines"),id:r+"_gridlines",tooltipText:this.getLocaleText("GridLines")},{type:"Separator",id:r+"_separator_13"},{prefixIcon:"e-freeze-pane",text:n.getConstant("FreezePanes"),id:r+"_freezepanes",tooltipText:n.getConstant("FreezePanes"),disabled:!this.parent.allowFreezePane},{prefixIcon:"e-freeze-row",text:n.getConstant("FreezeRows"),id:r+"_freezerows",tooltipText:n.getConstant("FreezeRows"),disabled:!this.parent.allowFreezePane},{prefixIcon:"e-freeze-column",text:n.getConstant("FreezeColumns"),id:r+"_freezecolumns",tooltipText:n.getConstant("FreezeColumns"),disabled:!this.parent.allowFreezePane}]}];return this.parent.allowConditionalFormat&&i.find(function(e){return e.header&&e.header.text===n.getConstant("Home")}).content.push({type:"Separator",id:r+"_separator_10"},{template:this.getCFDBB(r),tooltipText:n.getConstant("ConditionalFormatting"),id:r+"_conditionalformatting"}),this.parent.allowChart&&i.find(function(e){return e.header&&e.header.text===n.getConstant("Insert")}).content.push({type:"Separator",id:r+"_separator_11"},{template:this.getChartDDB(r,!0),text:n.getConstant("Chart"),tooltipText:n.getConstant("Chart"),id:r+"_chart"}),this.parent.allowCellFormatting&&i.find(function(e){return e.header&&e.header.text===n.getConstant("Home")}).content.push({type:"Separator",id:r+"_separator_12"},{template:this.getClearDDB(r),tooltipText:n.getConstant("Clear"),id:r+"_clear"}),(this.parent.allowSorting||this.parent.allowFiltering)&&i.find(function(e){return e.header&&e.header.text===n.getConstant("Home")}).content.push({template:this.getSortFilterDDB(r),tooltipText:n.getConstant("SortAndFilter"),id:r+"_sorting"}),this.parent.allowFindAndReplace&&i.find(function(e){return e.header&&e.header.text===n.getConstant("Home")}).content.push({template:this.getFindBtn(r),prefixIcon:"e-tbar-search-icon tb-icons",tooltipText:n.getConstant("FindReplaceTooltip"),id:r+"_find"}),i},e.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 h.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(no,{type:e.item.id,isAction:!0,isInternal:!0})},click:function(){n.setAttribute("aria-label",t.getConstant("Paste")),r.parent.notify(no,{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},e.prototype.getHyperlinkDlg=function(){var e,r=c(this.parent.getActiveSheet().activeCell),n=this.parent.sheets[this.parent.activeSheetIndex].rows[r[0]];t.isNullOrUndefined(n)||(e=n.cells[r[1]]),t.isNullOrUndefined(e)&&ke(r[0],r[1],this.parent.getActiveSheet(),e,!1),e&&e.hyperlink?this.parent.notify(Fo,null):this.parent.notify(ko,null)},e.prototype.passwordProtectDlg=function(){this.parent.password.length>0?this.parent.notify(Ks,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(Xs,null)},e.prototype.getLocaleText=function(e){var t=this.parent.serviceLocator.getService(Fl);return this.parent.getActiveSheet()["show"+e]?t.getConstant("Hide"+e):t.getConstant("Show"+e)},e.prototype.getLocaleProtectText=function(e,t){var r,n=this.parent.serviceLocator.getService(Fl);return this.parent.getActiveSheet().isProtected?(t&&this.parent.getMainContent().classList.remove("e-hide-"+e.toLowerCase()),r=n.getConstant("Unprotect"+e)):(t&&this.parent.getMainContent().classList.add("e-hide-"+e.toLowerCase()),r=n.getConstant("Protect"+e)),r},e.prototype.getLocaleProtectWorkbook=function(e,t){var r,n=this.parent.serviceLocator.getService(Fl);return this.parent.isProtected?(t&&this.parent.getMainContent().classList.remove("e-hide-"+e.toLowerCase()),r=n.getConstant(e)):(t&&this.parent.getMainContent().classList.add("e-hide-"+e.toLowerCase()),r=n.getConstant(e)),r},e.prototype.insertDesignChart=function(){var e=this,t=this.parent.serviceLocator.getService(Fl),r=this.ribbon.items.length-1,n=t.getConstant("ChartDesign");if(this.parent.allowChart&&this.ribbon.items[r]&&this.ribbon.items[r].header.text!==n){this.preTabIdx=this.ribbon.selectedTab;var i=this.parent.element.id,a=[{header:{text:n},content:[{template:this.getAddChartEleDBB(i),tooltipText:t.getConstant("AddChartElement"),id:i+"add_chart_ element_chart"},{type:"Separator"},{prefixIcon:"e-switch-row-column-icon",text:t.getConstant("SwitchRowColumn"),tooltipText:t.getConstant("SwitchRowColumn"),id:i+"switch_row_column_chart",click:function(){e.parent.notify(Ws,{switchRowColumn:!0,triggerEvent:!0})}},{type:"Separator"},{template:this.getChartThemeDDB(i),tooltipText:t.getConstant("ChartTheme"),id:i+"_chart_theme"},{type:"Separator"},{template:this.getChartDDB(i,!1),tooltipText:t.getConstant("ChartType"),id:i+"_chart_type"}]}];this.addRibbonTabs({items:a}),this.ribbon.tabObj.select(this.ribbon.items.length)}},e.prototype.removeDesignChart=function(){var e=this.parent.serviceLocator.getService(Fl),t=this.ribbon.items.length-1;this.ribbon.items[t]&&this.ribbon.items[t].header.text===e.getConstant("ChartDesign")&&(this.ribbon.tabObj.select(this.preTabIdx+1),this.parent.hideRibbonTabs([e.getConstant("ChartDesign")],!0),document.getElementsByClassName("e-addchart-ddb").length>0&&document.getElementsByClassName("e-addchart-ddb")[0].remove(),document.getElementsByClassName("e-chart-type-ddb").length>0&&document.getElementsByClassName("e-chart-type-ddb")[0].remove(),document.getElementsByClassName("e-charttheme-ddb").length>0&&document.getElementsByClassName("e-charttheme-ddb")[0].remove(),delete this.ribbon.items[t].content[0],this.ribbon.items.length=this.ribbon.items.length-1)},e.prototype.createRibbon=function(e){var t=this.parent.createElement("div",{id:this.parent.element.id+"_ribbon"});this.ribbon=new Ih({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)},e.prototype.tabSelecting=function(e){if(e.selectingIndex!==this.ribbon.selectedTab){var t=this.parent.serviceLocator.getService(Fl);if(this.ribbon.items[e.selectingIndex]&&this.ribbon.items[e.selectingIndex].header.text===t.getConstant("Insert"))for(var r=(n=this.ribbon.items[e.selectingIndex].content).length-1;r>=0;r--)if(n[r].id===this.parent.element.id+"_chart"){(i=n[r].template)&&!i.classList.contains("e-dropdown-btn")&&this.createChartDdb(document.getElementById(this.parent.element.id+"_chart-btn"),!0);break}if(this.ribbon.items[e.selectedIndex]&&this.ribbon.items[e.selectedIndex].header.text===t.getConstant("Insert")){var n;for(r=(n=this.ribbon.items[e.selectedIndex].content).length-1;r>=0;r--)if(n[r].id===this.parent.element.id+"_chart"){var i;(i=n[r].template)&&i.classList.contains("e-dropdown-btn")&&this.destroyComponent(i,"dropdown-btn");break}}this.refreshRibbonContent(e.selectingIndex),this.parent.notify(Qa,{activeTab:e.selectingIndex})}},e.prototype.beforeRenderHandler=function(e){var t=this.parent.serviceLocator.getService(Fl);e.item.text!==t.getConstant("Open")||this.parent.openUrl&&this.parent.allowOpen||e.element.classList.add("e-disabled"),e.item.text!==t.getConstant("SaveAs")||this.parent.saveUrl&&this.parent.allowSave||e.element.classList.add("e-disabled")},e.prototype.getChartThemeDDB=function(e){var r=this,n=this.parent.serviceLocator.getService(Fl),i=this.parent.createElement("button",{id:e+"_chart_theme",attrs:{type:"button"},className:"e-ss-ddb"});i.appendChild(this.parent.createElement("span",{className:"e-tbar-btn-text"}));var a="Material",o=this.parent.element.querySelector(".e-ss-overlay-active");if(o){var s=o.querySelector(".e-chart");s?a=t.getComponent(s,"chart").theme:(s=o.querySelector(".e-accumulationchart"))&&(a=t.getComponent(s,"accumulationchart").theme)}var l=new h.DropDownButton({items:this.getChartThemeDdbItems(a),content:n.getConstant(a),createPopupOnClick:!0,select:function(e){r.parent.notify(xi,{type:"mousedown"}),e.element&&e.element.querySelector(".e-selected-icon")||(l.content=e.item.text,l.dataBind(),r.parent.notify(Ws,{chartTheme:e.item.id,triggerEvent:!0}),l.setProperties({items:r.getChartThemeDdbItems(e.item.id)},!0))},cssClass:"e-flat e-charttheme-ddb",beforeOpen:function(e){r.tBarDdbBeforeOpen(e.element,e.items,r.parent.serviceLocator.getService(Fl).getConstant("Chart"))}});return l.createElement=this.parent.createElement,l.appendTo(i),i},e.prototype.getNumFormatDDB=function(e,t){var r=this,n=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"});i.innerText=t.getConstant("General"),n.appendChild(i);var a=["General","0","0.00","#,##0","#,##0.00","#,##0_);(#,##0)","#,##0_);[Red](#,##0)","#,##0.00_);(#,##0.00)","#,##0.00_);[Red](#,##0.00)",Li.currency[4],Li.currency[2],Li.currency[3],Li.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",Li.accounting[1],'_(* #,##0_);_(* (#,##0);_(* "-"_);_(@_)',Li.accounting[0],'_(* #,##0.00_);_(* (#,##0.00);_(* "-"??_);_(@_)'];return this.numFormatDDB=new h.DropDownButton({items:this.getNumFormatDdbItems(e),createPopupOnClick:!0,select:function(e){var t=r.parent.serviceLocator.getService(Fl);if(e.item.text===t.getConstant("Custom"))r.renderCustomFormatDialog(a);else{var n=e.item.id.split(r.parent.element.id+"_")[1];r.applyNumFormat(Ue(n),e.item.text);var i=r.parent.getActiveSheet(),o=u(i.activeCell);r.refreshTextAlign(i,Re(o[0],o[1],i,!1,!0),n,o),r.numFormatDDB.element.setAttribute("aria-label",n)}},open:function(e){return r.numDDBOpen(e)},beforeItemRender:function(e){return r.previewNumFormat(e)},cssClass:"e-flat e-numformat-ddb",beforeOpen:function(e){r.tBarDdbBeforeOpen(e.element,e.items,r.parent.serviceLocator.getService(Fl).getConstant("NumberFormat"))}}),this.numFormatDDB.createElement=this.parent.createElement,this.numFormatDDB.appendTo(n),n},e.prototype.getFontSizeDDB=function(e){var t=this;return this.fontSizeDdb=new h.DropDownButton({cssClass:"e-font-size-ddb",content:"11",createPopupOnClick:!0,items:[{text:"8"},{text:"9"},{text:"10"},{text:"11"},{text:"12"},{text:"14"},{text:"16"},{text:"18"},{text:"20"},{text:"22"},{text:"24"},{text:"26"},{text:"28"},{text:"36"},{text:"48"},{text:"72"}],beforeOpen:function(e){t.tBarDdbBeforeOpen(e.element,e.items,t.parent.serviceLocator.getService(Fl).getConstant("FontSize")),t.refreshSelected(t.fontSizeDdb,e.element,"content","text")},select:function(e){var r={style:{fontSize:e.item.text+"pt"},onActionUpdate:!0};t.parent.notify(Br,r),r.cancel||(t.fontSizeDdb.content=r.style.fontSize.split("pt")[0],t.fontSizeDdb.dataBind()),t.fontSizeDdb.element.setAttribute("aria-label",e.item.text)}}),this.fontSizeDdb.createElement=this.parent.createElement,this.fontSizeDdb.appendTo(this.parent.createElement("button",{id:e+"_font_size",attrs:{type:"button"},className:"e-ss-ddb"})),this.fontSizeDdb.element},e.prototype.getChartDDB=function(e,t){var r,n=this.parent.serviceLocator.getService(Fl);if(t){r=this.parent.createElement("button",{id:e+"_chart-btn",attrs:{type:"button"}});(i=this.parent.createElement("span",{id:e+"_chart"})).innerText=n.getConstant("Chart"),r.appendChild(i)}else{r=this.parent.createElement("button",{id:e+"_chart-type-btn",attrs:{type:"button"}});var i;(i=this.parent.createElement("span",{id:e+"_chart_type"})).innerText=n.getConstant("ChartType"),r.appendChild(i),this.createChartDdb(r,!1)}return r},e.prototype.closeDropdownPopup=function(e){if(e.altKey&&38===e.keyCode||27===e.keyCode){var t=this[1];t&&(t.toggle(),Wt(t.element))}},e.prototype.createChartDdb=function(e,r){var n,i=this,a=this.parent.serviceLocator.getService(Fl),o=r?"e-chart-menu":"e-chart-type-menu",s=this.parent.createElement("ul",{id:this.parent.element.id+(r?"_chart_menu":"_chart_type_menu")}),l=new h.DropDownButton({iconCss:"e-icons "+(r?"e-chart-icon":"e-chart-type-icon"),cssClass:r?"e-chart-ddb":"e-chart-type-ddb",target:s,createPopupOnClick:!0,beforeOpen:function(e){n=i.createChartMenu(s,o,a,l),i.tBarDdbBeforeOpen(e.element,n.items,i.parent.serviceLocator.getService(Fl).getConstant("Chart")),t.EventHandler.add(s,"keydown",i.closeDropdownPopup,[i,l])},open:function(){return Wt(s)},beforeClose:function(e){e.event&&t.closest(e.event.target,"."+o)?e.cancel=!0:(t.EventHandler.remove(s,"keydown",i.closeDropdownPopup),n.destroy())}});l.createElement=this.parent.createElement,l.appendTo(e)},e.prototype.createChartMenu=function(e,r,n,a){var o=this,s=new i.Menu({cssClass:r,items:[{iconCss:"e-icons e-column",text:n.getConstant("Column"),items:[{id:"column_chart"}]},{iconCss:"e-icons e-bar",text:n.getConstant("Bar"),items:[{id:"bar_chart"}]},{iconCss:"e-icons e-area",text:n.getConstant("Area"),items:[{id:"area_chart"}]},{iconCss:"e-icons e-pie-doughnut",text:n.getConstant("PieAndDoughnut"),items:[{id:"pie_doughnut_chart"}]},{iconCss:"e-icons e-line",text:n.getConstant("Line"),items:[{id:"line_chart"}]},{iconCss:"e-icons e-scatter",text:n.getConstant("Scatter"),items:[{id:"scatter_chart"}]}],orientation:"Vertical",beforeOpen:function(e){var r;e.parentItem.text===n.getConstant("Column")?(e.element.firstChild.appendChild(l),r="e-column-chart"):e.parentItem.text===n.getConstant("Bar")?(e.element.firstChild.appendChild(C),r="e-bar-chart"):e.parentItem.text===n.getConstant("Area")?(e.element.firstChild.appendChild(A),r="e-area-chart"):e.parentItem.text===n.getConstant("Line")?(e.element.firstChild.appendChild(P),r="e-line-chart"):e.parentItem.text===n.getConstant("PieAndDoughnut")?(e.element.firstChild.appendChild(W),r="e-pie-doughnut-chart"):e.parentItem.text===n.getConstant("Radar")?(e.element.firstChild.appendChild($),r="e-radar-chart"):e.parentItem.text===n.getConstant("Scatter")&&(e.element.firstChild.appendChild(te),r="e-scatter-chart"),r&&(e.element.parentElement.classList.add(r),t.EventHandler.add(e.element,"keydown",o.menuIconKeyDown.bind(o,r+" .e-menu-icon",0)))},select:function(e){return o.chartSelected(e,a)},beforeItemRender:function(e){e.item.text||e.element.removeAttribute("tabindex")},beforeClose:function(e){e.event&&37===e.event.keyCode?e.cancel=!0:t.EventHandler.remove(e.element,"keydown",o.menuIconKeyDown)}}),l=this.parent.createElement("div",{id:"column_main",className:"e-column-main"}),h=this.parent.createElement("div",{id:"column1_text",className:"e-column1-text"});h.innerText=n.getConstant("Column");var d=this.parent.createElement("div",{id:"column1_cont",className:"e-column1-cont"}),p=this.parent.createElement("div",{id:"column2_cont",className:"e-column2-cont"});l.appendChild(h),l.appendChild(d);var c=n.getConstant("ClusteredColumn"),u=this.parent.createElement("span",{id:"clusteredColumn",className:"e-clusteredcolumn e-column-icon e-menu-icon e-icons",attrs:{title:c,"aria-label":c,tabindex:"-1"}});c=n.getConstant("StackedColumn");var f=this.parent.createElement("span",{id:"stackedColumn",className:"e-stackedcolumn e-column-icon e-menu-icon e-icons",attrs:{title:c,"aria-label":c,tabindex:"-1"}});c=n.getConstant("StackedColumn100");var g=this.parent.createElement("span",{id:"stackedColumn100",className:"e-stackedcolumn100 e-column-icon e-menu-icon e-icons",attrs:{title:c,"aria-label":c,tabindex:"-1"}}),m=this.parent.createElement("span",{id:"clusteredColumn3D",className:"e-clusteredColumn3D e-column-icon"}),v=this.parent.createElement("span",{id:"stackedColumn3D",className:"e-stackedColumn3D e-column-icon"}),y=this.parent.createElement("span",{id:"stackedColumn1003D",className:"e-stackedColumn1003D e-column-icon"});d.appendChild(u),d.appendChild(f),d.appendChild(g),p.appendChild(m),p.appendChild(v),p.appendChild(y);var C=this.parent.createElement("div",{id:"bar_main",className:"e-bar-main"}),b=this.parent.createElement("div",{id:"bar1_text",className:"e-bar1-text"});b.innerText=n.getConstant("Bar");var x=this.parent.createElement("div",{id:"bar1_cont",className:"e-bar1-cont"}),S=this.parent.createElement("div",{id:"bar2_cont",className:"e-bar2-cont"});C.appendChild(b),C.appendChild(x),c=n.getConstant("ClusteredBar");var w=this.parent.createElement("span",{id:"clusteredBar",className:"e-clusteredbar e-bar-icon e-menu-icon e-icons",attrs:{title:c,"aria-label":c,tabindex:"-1"}});c=n.getConstant("StackedBar");var I=this.parent.createElement("span",{id:"stackedBar",className:"e-stackedbar e-bar-icon e-menu-icon e-icons",attrs:{title:c,"aria-label":c,tabindex:"-1"}});c=n.getConstant("StackedBar100");var E=this.parent.createElement("span",{id:"stackedBar100",className:"e-stackedbar100 e-bar-icon e-menu-icon e-icons",attrs:{title:c,"aria-label":c,tabindex:"-1"}}),R=this.parent.createElement("span",{id:"clusteredBar3D",className:"e-clusteredBar3D e-bar-icon"}),k=this.parent.createElement("span",{id:"stackedBar3D",className:"e-stackedBar3D e-bar-icon"}),F=this.parent.createElement("span",{id:"stackedBar1003D",className:"e-stackedBar1003D e-bar-icon"});x.appendChild(w),x.appendChild(I),x.appendChild(E),S.appendChild(R),S.appendChild(k),S.appendChild(F);var A=this.parent.createElement("div",{id:"area_main",className:"e-area-main"}),N=this.parent.createElement("div",{id:"area_text",className:"e-area-text"});N.innerText=n.getConstant("Area");var O=this.parent.createElement("div",{id:"area_cont",className:"e-area-cont"});A.appendChild(N),A.appendChild(O),c=n.getConstant("Area");var T=this.parent.createElement("span",{id:"area",className:"e-area e-area-icon e-menu-icon e-icons",attrs:{title:c,"aria-label":c,tabindex:"-1"}});c=n.getConstant("StackedArea");var D=this.parent.createElement("span",{id:"stackedArea",className:"e-stackedarea e-area-icon e-menu-icon e-icons",attrs:{title:c,"aria-label":c,tabindex:"-1"}});c=n.getConstant("StackedArea100");var L=this.parent.createElement("span",{id:"stackedArea100",className:"e-stackedarea100 e-area-icon e-menu-icon e-icons",attrs:{title:c,"aria-label":c,tabindex:"-1"}});O.appendChild(T),O.appendChild(D),O.appendChild(L);var P=this.parent.createElement("div",{id:"line_main",className:"e-line-main"}),M=this.parent.createElement("div",{id:"line_text",className:"e-line-text"});M.innerText=n.getConstant("Line");var H=this.parent.createElement("div",{id:"line_cont",className:"e-line-cont"}),B=this.parent.createElement("div",{id:"line_cont_marker",className:"e-line-cont"});P.appendChild(M),P.appendChild(H),P.appendChild(B),c=n.getConstant("Line");var U=this.parent.createElement("span",{id:"line",className:"e-line e-line-icon e-menu-icon e-icons",attrs:{title:c,"aria-label":c,tabindex:"-1"}});c=n.getConstant("StackedLine");var V=this.parent.createElement("span",{id:"stackedLine",className:"e-stackedline e-line-icon e-menu-icon e-icons",attrs:{title:c,"aria-label":c,tabindex:"-1"}});c=n.getConstant("StackedLine100");var _=this.parent.createElement("span",{id:"stackedLine100",className:"e-stackedline100 e-line-icon e-menu-icon e-icons",attrs:{title:c,"aria-label":c,tabindex:"-1"}});c=n.getConstant("LineMarker");var z=this.parent.createElement("span",{id:"lineMarker",className:"e-line-marker e-line-icon e-menu-icon e-icons",attrs:{title:c,"aria-label":c,tabindex:"-1"}});c=n.getConstant("StackedLineMarker");var j=this.parent.createElement("span",{id:"stackedLineMarker",className:"e-stackedline-marker e-line-icon e-menu-icon e-icons",attrs:{title:c,"aria-label":c,tabindex:"-1"}});c=n.getConstant("StackedLine100Marker");var q=this.parent.createElement("span",{id:"stackedLine100Marker",className:"e-stackedline100-marker e-line-icon e-menu-icon e-icons",attrs:{title:c,"aria-label":c,tabindex:"-1"}});H.appendChild(U),H.appendChild(V),H.appendChild(_),B.appendChild(z),B.appendChild(j),B.appendChild(q);var W=this.parent.createElement("div",{id:"pie_main",className:"e-pie-main"}),G=this.parent.createElement("div",{id:"pie_text",className:"e-pie-text"});G.innerText=n.getConstant("Pie");var Y=this.parent.createElement("div",{id:"pie_cont",className:"e-pie-cont"});W.appendChild(G),W.appendChild(Y),c=n.getConstant("Pie");var X=this.parent.createElement("span",{id:"pie",className:"e-pie e-pie-icon e-menu-icon e-icons",attrs:{title:c,"aria-label":c,tabindex:"-1"}});c=n.getConstant("Doughnut");var K=this.parent.createElement("span",{id:"doughnut",className:"e-doughnut e-pie-icon e-menu-icon e-icons",attrs:{title:c,"aria-label":c,tabindex:"-1"}});Y.appendChild(X),Y.appendChild(K);var $=this.parent.createElement("div",{id:"radar_main",className:"e-radar-main"}),Z=this.parent.createElement("div",{id:"radar_text",className:"e-radar-text"});Z.innerText=n.getConstant("Radar");var Q=this.parent.createElement("div",{id:"radar_cont",className:"e-radar-cont"});$.appendChild(Z),$.appendChild(Q);var J=this.parent.createElement("span",{id:"radar",className:"e-radar e-radar-icon e-menu-icon e-icons",attrs:{tabindex:"-1"}}),ee=this.parent.createElement("span",{id:"radar_markers",className:"e-radar-markers e-radar-icon e-menu-icon e-icons",attrs:{tabindex:"-1"}});J.title=n.getConstant("BlueDataBar"),ee.title=n.getConstant("GreenDataBar"),Q.appendChild(J),Q.appendChild(ee);var te=this.parent.createElement("div",{id:"scatter_main",className:"e-scatter-main"}),re=this.parent.createElement("div",{id:"scatter_text",className:"e-scatter-text"});c=n.getConstant("Scatter"),re.innerText=c;var ne=this.parent.createElement("div",{id:"scatter_cont",className:"e-scatter-cont"});te.appendChild(re),te.appendChild(ne);var ie=this.parent.createElement("span",{id:"scatter",className:"e-scatter e-scatter-icon e-menu-icon e-icons",attrs:{title:c,"aria-label":c,tabindex:"-1"}});return ne.appendChild(ie),s.createElement=this.parent.createElement,s.appendTo(e),e.classList.add("e-ul"),s},e.prototype.getAddChartEleDBB=function(e){var r,n=this,i=this.parent.serviceLocator.getService(Fl),a=this.parent.createElement("ul",{id:e+"_add_chart_menu"});this.addChartDdb=new h.DropDownButton({iconCss:"e-icons e-addchart-icon",cssClass:"e-addchart-ddb",target:a,createPopupOnClick:!0,close:function(){return Wt(n.parent.element)},beforeOpen:function(e){r=n.createAddChartMenu(a,i),n.tBarDdbBeforeOpen(e.element,r.items),t.EventHandler.add(a,"keydown",n.closeDropdownPopup,[n,n.addChartDdb])},open:function(){return Wt(a)},beforeClose:function(e){e.event&&t.closest(e.event.target,".e-addchart-menu")?e.cancel=!0:(t.EventHandler.remove(a,"keydown",n.closeDropdownPopup),r.destroy())}}),this.addChartDdb.createElement=this.parent.createElement;var o=this.parent.createElement("button",{id:e+"_addchart",attrs:{type:"button"}}),s=this.parent.createElement("span",{id:e+"_chart"});return s.innerText=i.getConstant("AddChartElement"),o.appendChild(s),this.addChartDdb.appendTo(o),this.addChartDdb.element},e.prototype.createAddChartMenu=function(e,r){var n=this,a=new i.Menu({cssClass:"e-addchart-menu",title:r.getConstant("AddChartElement"),items:[{iconCss:"e-icons e-axes",text:r.getConstant("Axes"),items:[{iconCss:"e-icons e-ph-axes",id:"PHAxes",text:r.getConstant("PrimaryHorizontal")},{iconCss:"e-icons e-pv-axes",id:"PVAxes",text:r.getConstant("PrimaryVertical")}]},{iconCss:"e-icons e-axis-title",text:r.getConstant("AxisTitle"),items:[{iconCss:"e-icons e-ph-axistitle",id:"PHAxisTitle",text:r.getConstant("PrimaryHorizontal")},{iconCss:"e-icons e-pv-axistitle",id:"PVAxisTitle",text:r.getConstant("PrimaryVertical")}]},{iconCss:"e-icons e-chart-title",text:r.getConstant("ChartTitle"),items:[{iconCss:"e-icons e-ct-none",id:"ChartTitleNone",text:r.getConstant("None")},{iconCss:"e-icons e-ct-abovechart",id:"ChartTitleAbove",text:r.getConstant("AboveChart")}]},{iconCss:"e-icons e-data-labels",id:this.parent.element.id+"data-labels",text:r.getConstant("DataLabels"),items:[{iconCss:"e-icons e-dl-none",id:"DLNone",text:r.getConstant("None")},{iconCss:"e-icons e-dl-center",id:"DLCenter",text:r.getConstant("Center")},{iconCss:"e-icons e-dl-insideend",id:"DLInsideend",text:r.getConstant("InsideEnd")},{iconCss:"e-icons e-dl-insidebase",id:"DLInsidebase",text:r.getConstant("InsideBase")},{iconCss:"e-icons e-dl-outsideend",id:"DLOutsideend",text:r.getConstant("OutsideEnd")}]},{iconCss:"e-icons e-gridlines",text:r.getConstant("Gridlines"),items:[{iconCss:"e-icons e-gl-major-horizontal",id:"GLMajorHorizontal",text:r.getConstant("PrimaryMajorHorizontal")},{iconCss:"e-icons e-gl-major-vertical",id:"GLMajorVertical",text:r.getConstant("PrimaryMajorVertical")},{iconCss:"e-icons e-gl-minor-horizontal",id:"GLMinorHorizontal",text:r.getConstant("PrimaryMinorHorizontal")},{iconCss:"e-icons e-gl-minor-vertical",id:"GLMinorVertical",text:r.getConstant("PrimaryMinorVertical")}]},{iconCss:"e-icons e-legends",text:r.getConstant("Legends"),items:[{iconCss:"e-icons e-legends-none",id:"LegendNone",text:r.getConstant("None")},{iconCss:"e-icons e-legends-right",id:"LegendsRight",text:r.getConstant("Right")},{iconCss:"e-icons e-legends-left",id:"LegendsLeft",text:r.getConstant("Left")},{iconCss:"e-icons e-legends-bottom",id:"LegendsBottom",text:r.getConstant("Bottom")},{iconCss:"e-icons e-legends-top",id:"LegendsTop",text:r.getConstant("Top")}]}],orientation:"Vertical",select:this.addChartEleSelected.bind(this),beforeOpen:function(e){if(e.parentItem.id===n.parent.element.id+"data-labels"){var i=n.parent.element.querySelector(".e-ss-overlay-active");if(i){var a=i.querySelector(".e-chart");if(a){if(t.getComponent(a,"chart").series[0].type.includes("Line")){var o=function(e,t){if(e){var n=e.parentElement;n.innerHTML="",n.appendChild(e),n.appendChild(document.createTextNode(r.getConstant(t)))}};o(e.element.querySelector(".e-dl-insideend"),"Above"),o(e.element.querySelector(".e-dl-insidebase"),"Below");var s=e.element.querySelector(".e-dl-outsideend");s&&(s.parentElement.style.display="none")}}}}}});return a.createElement=this.parent.createElement,a.appendTo(e),e.classList.add("e-ul"),a},e.prototype.getCFDBB=function(e){var r,n=this,i=this.parent.createElement("ul",{id:e+"_cf_menu"});return this.cfDdb=new h.DropDownButton({iconCss:"e-icons e-conditionalformatting-icon",cssClass:"e-cf-ddb",target:i,createPopupOnClick:!0,close:function(){return Wt(n.parent.element)},beforeOpen:function(e){r=n.createCFMenu(i),n.tBarDdbBeforeOpen(e.element,r.items,n.parent.serviceLocator.getService(Fl).getConstant("ConditionalFormatting")),t.EventHandler.add(i,"keydown",n.closeDropdownPopup,[n,n.cfDdb])},open:function(){return Wt(i)},beforeClose:function(e){e.event&&t.closest(e.event.target,".e-cf-menu")?e.cancel=!0:(r.destroy(),t.EventHandler.remove(i,"keydown",n.closeDropdownPopup))}}),this.cfDdb.createElement=this.parent.createElement,this.cfDdb.appendTo(this.parent.createElement("button",{id:e+"_conditionalformatting",attrs:{type:"button"}})),this.cfDdb.element},e.prototype.createCFMenu=function(e){var r=this,n=this.parent.serviceLocator.getService(Fl),a=function(e,t,i){var a;e.forEach(function(e){a=n.getConstant(e+t),i.appendChild(r.parent.createElement("span",{id:e+t,className:"e-"+e.toLowerCase()+" e-cf-icon",attrs:{title:a,"aria-label":a,tabindex:"-1"}}))})},o=new i.Menu({cssClass:"e-cf-menu",items:[{iconCss:"e-icons e-hlcellrules",text:n.getConstant("HighlightCellsRules"),items:[{iconCss:"e-icons e-greaterthan",id:"cf_greaterthan_dlg",text:n.getConstant("GreaterThan")+"..."},{iconCss:"e-icons e-lessthan",id:"cf_lessthan_dlg",text:n.getConstant("LessThan")+"..."},{iconCss:"e-icons e-between",id:"cf_between_dlg",text:n.getConstant("Between")+"..."},{iconCss:"e-icons e-equalto",id:"cf_eqaulto_dlg",text:n.getConstant("CFEqualTo")+"..."},{iconCss:"e-icons e-textcontains",id:"cf_textcontains_dlg",text:n.getConstant("TextThatContains")+"..."},{iconCss:"e-icons e-adateoccuring",id:"cf_adateoccuring_dlg",text:n.getConstant("ADateOccuring")+"..."},{iconCss:"e-icons e-duplicate",id:"cf_duplicatevalues_dlg",text:n.getConstant("DuplicateValues")+"..."}]},{iconCss:"e-icons e-topbottomrules",text:n.getConstant("TopBottomRules"),items:[{iconCss:"e-icons e-top10items",id:"cf_top10items_dlg",text:n.getConstant("Top10Items")+"..."},{iconCss:"e-icons e-top10",id:"cf_top10_dlg",text:n.getConstant("Top10")+" %..."},{iconCss:"e-icons e-bottom10items",id:"cf_bottom10items_dlg",text:n.getConstant("Bottom10Items")+"..."},{iconCss:"e-icons e-bottom10",id:"cf_bottom10_dlg",text:n.getConstant("Bottom10")+" %..."},{iconCss:"e-icons e-aboveaverage",id:"cf_aboveaverage_dlg",text:n.getConstant("AboveAverage")+"..."},{iconCss:"e-icons e-belowaverage",id:"cf_belowaverage_dlg",text:n.getConstant("BelowAverage")+"..."}]},{iconCss:"e-icons e-databars",text:n.getConstant("DataBars"),items:[{id:"db_icons1"},{id:"db_icons2"}]},{iconCss:"e-icons e-colorscales",text:n.getConstant("ColorScales"),items:[{id:"cs_icons1"},{id:"cs_icons2"},{id:"cs_icons3"}]},{iconCss:"e-icons e-iconsets",text:n.getConstant("IconSets"),items:[{id:"is_icons"}]},{iconCss:"e-icons e-clearrules",text:n.getConstant("ClearRules"),items:[{id:"cf_cr_cells",text:n.getConstant("SelectedCells")},{id:"cf_cr_sheet",text:n.getConstant("EntireSheet")}]}],orientation:"Vertical",beforeOpen:function(e){"e-icons e-databars"===e.parentItem.iconCss?(e.element.parentElement.classList.add("e-databars"),a(["Blue","Green","Red"],"DataBar",e.element.firstChild),a(["Orange","LightBlue","Purple"],"DataBar",e.element.lastChild),t.EventHandler.add(e.element,"keydown",r.menuIconKeyDown.bind(r,"e-cf-icon",3))):"e-icons e-colorscales"===e.parentItem.iconCss?(e.element.parentElement.classList.add("e-colorscales"),a(["GYR","RYG","GWR","RWG"],"ColorScale",e.element.firstChild),a(["BWR","RWB","WR","RW"],"ColorScale",e.element.querySelector("#cs_icons2")),a(["GW","WG","GY","YG"],"ColorScale",e.element.lastChild),t.EventHandler.add(e.element,"keydown",r.menuIconKeyDown.bind(r,"e-cf-icon",4))):"e-icons e-iconsets"===e.parentItem.iconCss&&(e.element.parentElement.classList.add("e-iconsets"),e.element.firstChild.appendChild(p),t.EventHandler.add(e.element,"keydown",r.menuIconKeyDown.bind(r,"e-is-wrapper",0)))},select:this.cfSelected.bind(this),beforeItemRender:function(e){(e.item.id.includes("db_icons")||e.item.id.includes("cs_icons")||"is_icons"===e.item.id)&&e.element.removeAttribute("tabindex")},beforeClose:function(e){var n=["e-icons e-databars","e-icons e-colorscales","e-icons e-iconsets"].indexOf(e.parentItem.iconCss)>-1;e.cancel=e.event&&37===e.event.keyCode&&n,n&&!e.cancel&&t.EventHandler.remove(e.element,"keydown",r.menuIconKeyDown)}});o.createElement=this.parent.createElement;var s,l,h,d,p=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){s=r.parent.createElement("div",{id:"is"+(t+1),className:"e-is"+(t+1)}),e.hdr?s.innerText=n.getConstant(e.hdr):e.cont.forEach(function(e){for(h=n.getConstant(e.key),l=r.parent.createElement("div",{id:e.id||e.key,className:"e-"+e.cls+" e-is-wrapper",attrs:{title:h,"aria-label":h,tabindex:"-1"}}),d=0;d<e.count;d++)l.appendChild(r.createElement("span","e-"+e.cls+"-"+(d+1)+" e-iconsetspan"));s.appendChild(l)}),p.appendChild(s)}),o.createElement=this.parent.createElement,o.appendTo(e),e.classList.add("e-ul"),o},e.prototype.menuIconKeyDown=function(e,t,r){var n,i=[];if(r){if(40===r.keyCode||39===r.keyCode||38===r.keyCode||37===r.keyCode)if(r.preventDefault(),i=[].slice.call(document.querySelectorAll("."+e)),-1===(n=i.indexOf(r.target)))n=0;else if(39===r.keyCode)++n===i.length&&(n=0);else if(37===r.keyCode)-1===--n&&(n=i.length-1);else if(!e.includes("e-menu-icon")){var a=i.length,o=void 0,s=void 0;t||(t=2,40===r.keyCode?(o=[6,11,14,19],s=[5,10,13]):(o=[7,12,15],s=[8,13,16]),a--),40===r.keyCode?n===a-1?n=0:(n+=o&&o.indexOf(n)>-1?1:s&&s.indexOf(n)>-1?3:t,o&&a++,n>=a&&(n=n-a+1)):0===n?n=a-1:(n-=o&&o.indexOf(n)>-1?1:s&&s.indexOf(n)>-1?3:t)<0&&(n=o?a:a+n-1)}}else n=0,i=[].slice.call(document.querySelectorAll("."+e));i[n]&&Wt(i[n])},e.prototype.createElement=function(e,t){return this.parent.createElement(e,{className:t})},e.prototype.getBordersDBB=function(e){var r=this,n=this.parent.createElement("ul",{id:e+"_borders_menu"});this.cPickerEle=this.parent.createElement("input",{id:e+"_cell_border_color",attrs:{type:"color"}}),this.parent.element.appendChild(this.cPickerEle),this.colorPicker=new a.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);var i;return this.bordersDdb=new h.DropDownButton({iconCss:"e-icons e-bottom-borders",cssClass:"e-borders-ddb",target:n,createPopupOnClick:!0,beforeOpen:function(e){i=r.createBorderMenu(n),r.tBarDdbBeforeOpen(e.element,i.items,r.parent.serviceLocator.getService(Fl).getConstant("Borders"),1),t.EventHandler.add(n,"keydown",r.closeDropdownPopup,[r,r.bordersDdb])},open:function(){return Wt(n)},beforeClose:function(e){e.event&&t.closest(e.event.target,".e-borders-menu")?e.cancel=!0:(t.EventHandler.remove(n,"keydown",r.closeDropdownPopup),i.destroy())},close:function(){return Wt(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},e.prototype.createBorderMenu=function(e){var r=this,n=this.parent.serviceLocator.getService(Fl),a=this.parent.element.id,o=new i.Menu({cssClass:"e-borders-menu",items:[{iconCss:"e-icons e-top-borders",text:n.getConstant("TopBorders"),id:a+"_border_topborders"},{iconCss:"e-icons e-left-borders",text:n.getConstant("LeftBorders"),id:a+"_border_leftborders"},{iconCss:"e-icons e-right-borders",text:n.getConstant("RightBorders"),id:a+"_border_rightborders"},{iconCss:"e-icons e-bottom-borders",text:n.getConstant("BottomBorders"),id:a+"_border_bottomborders"},{iconCss:"e-icons e-all-borders",text:n.getConstant("AllBorders"),id:a+"_border_allborders"},{iconCss:"e-icons e-horizontal-borders",text:n.getConstant("HorizontalBorders"),id:a+"_border_horizontalborders"},{iconCss:"e-icons e-vertical-borders",text:n.getConstant("VerticalBorders"),id:a+"_border_verticalborders"},{iconCss:"e-icons e-outside-borders",text:n.getConstant("OutsideBorders"),id:a+"_border_outsideborders"},{iconCss:"e-icons e-inside-borders",text:n.getConstant("InsideBorders"),id:a+"_border_insideborders"},{iconCss:"e-icons e-no-borders",text:n.getConstant("NoBorders"),id:a+"_border_noborders"},{separator:!0},{text:n.getConstant("BorderColor"),items:[{id:a+"_border_colors"}],id:a+"_border_bordercolor"},{text:n.getConstant("BorderStyle"),items:[{iconCss:"e-icons e-selected-icon",id:a+"_1px"},{id:a+"_2px"},{id:a+"_3px"},{id:a+"_dashed"},{id:a+"_dotted"},{id:a+"_double"}]}],orientation:"Vertical",beforeOpen:function(e){if(e.parentItem.id===a+"_border_bordercolor"){r.colorPicker.refresh();var t=r.colorPicker.element.parentElement;e.element.firstElementChild.appendChild(t),t.style.display="inline-block",e.element.parentElement.classList.add("e-border-color"),e.element.firstElementChild.removeAttribute("tabindex")}else e.element.classList.add("e-border-style")},beforeClose:function(e){if(e.event&&e.parentItem.id===a+"_border_bordercolor")if(!t.closest(e.event.target,".e-border-colorpicker")||t.closest(e.event.target,".e-apply")||t.closest(e.event.target,".e-cancel")){r.colorPicker=t.getComponent(r.cPickerEle,"colorpicker"),"Picker"===r.colorPicker.mode&&(r.colorPicker.mode="Palette",r.colorPicker.dataBind());var n=r.colorPicker.element.parentElement;n.style.display="",r.parent.element.appendChild(n)}else e.cancel=!0},onOpen:function(e){if(e.parentItem.id===a+"_border_bordercolor"){e.element.parentElement.style.overflow="visible";var t=e.element.querySelector(".e-color-palette .e-palette");t&&Wt(t)}},onClose:function(){return Wt(o.element)},select:function(e){r.borderSelected(e,o)}});return o.createElement=this.parent.createElement,o.appendTo(e),e.classList.add("e-ul"),o},e.prototype.chartSelected=function(e,r){var n=!t.isNullOrUndefined(t.closest(e.element,".e-chart-menu")),i=e.element.id;if("column_chartbar_chartarea_chartpie_doughnut_chartline_chartradar_chartscatter_chart".includes(i)){!e.item||e.item.items&&e.item.items.length||r.toggle();var a=e.event.target.id;this.parent.notify(_s,{action:i,id:a,isChart:n})}},e.prototype.addChartEleSelected=function(e){var t=e.element.id;this.parent.notify(Ws,{addChartEle:t,triggerEvent:!0}),!e.item||e.item.items&&e.item.items.length||this.addChartDdb.toggle()},e.prototype.cfSelected=function(e){var t=this.parent.getActiveSheet();if(e.item.id.includes("_dlg"))this.parent.notify(ys,{action:e.item.text});else if(e.item.id.includes("icons")){var r=e.event.target;this.parent.notify(Yn,{cfModel:{type:r.id||r.parentElement.id,range:t.selectedRange},isAction:!0})}else"cf_cr_cells"===e.item.id?this.parent.notify(Kn,{range:t.selectedRange,isAction:!0}):"cf_cr_sheet"===e.item.id&&(this.parent.conditionalFormat=null,this.parent.notify(Kn,{isAction:!0}));!e.item||e.item.items&&e.item.items.length||this.cfDdb.toggle()},e.prototype.borderSelected=function(e,t){this.bordersDdb.element.setAttribute("aria-label",e.item.text);var r=this.parent.element.id;if(!e.item.items.length&&e.item.id!==r+"_border_colors"){if(!e.item.text){var n=this.border.split(" "),i="solid"===n[1]?r+"_"+n[0]:r+"_"+n[1];if(i===e.item.id)return;return e.item.id===r+"_1px"||e.item.id===r+"_2px"||e.item.id===r+"_3px"?(n[0]=e.item.id.split(r+"_")[1],n[1]="solid"):(n[1]=e.item.id.split(r+"_")[1],n[0]="double"===n[1]?"3px":"1px"),this.border=n.join(" "),t.items[12].items.forEach(function(t){t.id===i&&(t.iconCss=null),t.id===e.item.id&&(t.iconCss="e-icons e-selected-icon")}),void t.setProperties({items:t.items},!0)}switch(this.bordersDdb.toggle(),this.parent.showSpinner(),e.item.id){case r+"_border_topborders":this.parent.notify(Br,{style:{borderTop:this.border},onActionUpdate:!0});break;case r+"_border_leftborders":this.parent.notify(Br,{style:{borderLeft:this.border},onActionUpdate:!0});break;case r+"_border_rightborders":this.parent.notify(Br,{style:{borderRight:this.border},onActionUpdate:!0});break;case r+"_border_bottomborders":this.parent.notify(Br,{style:{borderBottom:this.border},onActionUpdate:!0});break;case r+"_border_allborders":this.parent.notify(Br,{style:{border:this.border},onActionUpdate:!0});break;case r+"_border_horizontalborders":this.parent.notify(Br,{style:{border:this.border},onActionUpdate:!0,borderType:"Horizontal"});break;case r+"_border_verticalborders":this.parent.notify(Br,{style:{border:this.border},onActionUpdate:!0,borderType:"Vertical"});break;case r+"_border_outsideborders":this.parent.notify(Br,{style:{border:this.border},onActionUpdate:!0,borderType:"Outer"});break;case r+"_border_insideborders":this.parent.notify(Br,{style:{border:this.border},onActionUpdate:!0,borderType:"Inner"});break;case r+"_border_noborders":this.parent.notify(Br,{style:{border:""},onActionUpdate:!0})}this.parent.hideSpinner()}},e.prototype.getFontNameDDB=function(e){var t=this,r=this.parent.createElement("button",{id:e+"_font_name",attrs:{type:"button"},className:"e-ss-ddb"}),n=this.parent.createElement("span",{className:"e-tbar-btn-text"});return n.innerText="Calibri",r.appendChild(n),this.fontNameDdb=new h.DropDownButton({cssClass:"e-font-family",items:this.getFontFamilyItems(),createPopupOnClick:!0,select:function(e){var n={style:{fontFamily:e.item.text},onActionUpdate:!0};t.parent.notify(Br,n),r.setAttribute("aria-label",e.item.text),n.cancel||t.refreshFontNameSelection(n.style.fontFamily)},beforeOpen:function(e){t.tBarDdbBeforeOpen(e.element,e.items,t.parent.serviceLocator.getService(Fl).getConstant("Font"))}}),this.fontNameDdb.createElement=this.parent.createElement,this.fontNameDdb.appendTo(r),r},e.prototype.getBtn=function(e,t,r,n){void 0===n&&(n=!0);var i=new o.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},e.prototype.datavalidationDDB=function(e){var t,r=this,n=this.parent.serviceLocator.getService(Fl);return this.datavalidationDdb=new h.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(Jo,null);break;case n.getConstant("HighlightInvalidData"):r.parent.notify(es,{isRemoveHighlight:!1});break;case n.getConstant("ClearHighlight"):r.parent.notify(es,{isRemoveHighlight:!0});break;case n.getConstant("ClearValidation"):r.parent.notify(fs,{isAction:!0});break;default:t=e.item.text===n.getConstant("SortAscending")?"Ascending":"Descending",r.parent.notify(Io,{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},e.prototype.getTextAlignDDB=function(e){var t=this,r=this.parent.serviceLocator.getService(Fl);return this.textAlignDdb=new h.DropDownButton({cssClass:"e-align-ddb",iconCss:"e-icons e-left-icon",items:[{iconCss:"e-icons e-left-icon"},{iconCss:"e-icons e-center-icon"},{iconCss:"e-icons e-right-icon"}],beforeItemRender:this.alignItemRender.bind(this),createPopupOnClick:!0,beforeOpen:function(e){t.refreshSelected(t.textAlignDdb,e.element,"iconCss"),e.element.setAttribute("aria-label",r.getConstant("HorizontalAlignment"))},select:function(e){var n={style:{textAlign:e.item.iconCss.split(" e-")[1].split("-icon")[0]},onActionUpdate:!0};t.parent.notify(Br,n),n.cancel||(t.textAlignDdb.iconCss="e-icons e-"+n.style.textAlign+"-icon",t.textAlignDdb.dataBind()),t.textAlignDdb.element.setAttribute("aria-label",r.getConstant("HorizontalAlignment")+" "+r.getConstant("Align"+t.getAlignText(e)))}}),this.textAlignDdb.createElement=this.parent.createElement,this.textAlignDdb.appendTo(this.parent.createElement("button",{id:e+"_text_align",attrs:{type:"button"},className:"e-ss-ddb"})),this.textAlignDdb.element},e.prototype.getVerticalAlignDDB=function(e){var t=this,r=this.parent.serviceLocator.getService(Fl);return this.verticalAlignDdb=new h.DropDownButton({cssClass:"e-align-ddb",iconCss:"e-icons e-bottom-icon",items:[{iconCss:"e-icons e-top-icon"},{iconCss:"e-icons e-middle-icon"},{iconCss:"e-icons e-bottom-icon"}],beforeItemRender:this.alignItemRender.bind(this),createPopupOnClick:!0,beforeOpen:function(e){t.refreshSelected(t.verticalAlignDdb,e.element,"iconCss"),e.element.setAttribute("aria-label",r.getConstant("VerticalAlignment"))},select:function(e){var n={style:{verticalAlign:e.item.iconCss.split(" e-")[1].split("-icon")[0]},onActionUpdate:!0};t.parent.notify(Br,n),n.cancel||(t.verticalAlignDdb.iconCss="e-icons e-"+n.style.verticalAlign+"-icon",t.verticalAlignDdb.dataBind()),t.verticalAlignDdb.element.setAttribute("aria-label",r.getConstant("VerticalAlignment")+" "+r.getConstant("Align"+t.getAlignText(e)))}}),this.verticalAlignDdb.createElement=this.parent.createElement,this.verticalAlignDdb.appendTo(this.parent.createElement("button",{id:e+"_vertical_align",attrs:{type:"button"},className:"e-ss-ddb"})),this.verticalAlignDdb.element},e.prototype.getMergeSplitBtn=function(e){var t=this;this.parent.element.appendChild(this.parent.createElement("button",{id:e+"_merge",attrs:{type:"button"}}));var r=this.parent.serviceLocator.getService(Fl);return this.mergeSplitBtn=new h.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},e.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)},e.prototype.unMerge=function(e){this.parent.showSpinner();var t=this.parent.getActiveSheet().selectedRange;this.parent.notify(_n,{merge:!1,range:e?e.range||t:t,isAction:!0,refreshRibbon:!0,type:"All"}),this.toggleActiveState(!1),this.parent.hideSpinner()},e.prototype.merge=function(e){for(var t,r,n=this,i=this.parent.getActiveSheet(),a=c(i.selectedRange),o=e.includes("merge_all"),s=a[0];s<=a[2];s++)for(var l=a[1];l<=a[3];l++)s===a[0]&&l===a[1]&&o||s===a[0]&&e.includes("merge_vertically")||l===a[1]&&e.includes("_merge_horizontally")||((t=Re(s,l,i)||{}).value||t.formula)&&(r=!0);if(!r)return this.performMerge(e),void(o&&this.toggleActiveState(!0));var h=this.parent.serviceLocator.getService(Al);h.show({height:200,width:400,isModal:!0,showCloseIcon:!0,cssClass:"e-merge-alert-dlg",content:this.parent.serviceLocator.getService(Fl).getConstant("MergeCellsAlert"),beforeOpen:function(e){var t={dialogName:"MergeAlertDialog",element:e.element,target:e.target,cancel:e.cancel};n.parent.trigger("dialogBeforeOpen",t),t.cancel?e.cancel=!0:Wt(n.parent.element)},buttons:[{buttonModel:{content:this.parent.serviceLocator.getService(Fl).getConstant("Ok"),isPrimary:!0},click:function(){h.hide(),n.performMerge(e),o&&n.toggleActiveState(!0)}}]})},e.prototype.performMerge=function(e){var t=this.parent.element.id;switch(this.parent.showSpinner(),e){case t+"_merge_all":this.parent.notify(_n,{merge:!0,range:this.parent.getActiveSheet().selectedRange,type:"All",isAction:!0,refreshRibbon:!0});break;case t+"_merge_horizontally":this.parent.notify(_n,{merge:!0,range:this.parent.getActiveSheet().selectedRange,type:"Horizontally",isAction:!0});break;case t+"_merge_vertically":this.parent.notify(_n,{merge:!0,range:this.parent.getActiveSheet().selectedRange,type:"Vertically",isAction:!0})}this.parent.hideSpinner()},e.prototype.getSortFilterDDB=function(e){var t,r=this,n=this.parent.serviceLocator.getService(Fl);return this.sortingDdb=new h.DropDownButton({cssClass:"e-sort-filter-ddb",iconCss:"e-icons e-sort-filter-icon",items:[{text:n.getConstant("SortAscending"),iconCss:"e-icons e-sort-asc"},{text:n.getConstant("SortDescending"),iconCss:"e-icons e-sort-desc"},{text:n.getConstant("CustomSort")+"...",iconCss:"e-icons e-sort-custom"},{separator:!0},{text:n.getConstant("Filter"),iconCss:"e-icons e-filter-apply",id:e+"_applyfilter"},{text:n.getConstant("ClearAllFilter"),iconCss:"e-icons e-filter-clear",id:e+"_clearfilter"},{text:n.getConstant("ReapplyFilter"),iconCss:"e-icons e-filter-reapply",id:e+"_reapplyfilter"}],createPopupOnClick:!0,beforeItemRender:function(t){var i={isFiltered:!1,isClearAll:!0};r.parent.notify(Go,i),r.parent.allowSorting||t.item.text!==n.getConstant("SortAscending")&&t.item.text!==n.getConstant("SortDescending")&&t.item.text!==n.getConstant("CustomSort")+"..."||t.element.classList.add("e-disabled"),r.parent.allowFiltering||t.item.text!==n.getConstant("Filter")||t.element.classList.add("e-disabled"),t.item.id!==e+"_clearfilter"&&t.item.id!==e+"_reapplyfilter"||(i.isFiltered?t.element.classList.remove("e-disabled"):t.element.classList.add("e-disabled"))},beforeOpen:function(e){r.refreshSelected(r.sortingDdb,e.element,"iconCss"),e.element.setAttribute("aria-label",r.parent.serviceLocator.getService(Fl).getConstant("SortAndFilter"))},select:function(e){switch(e.item.text){case n.getConstant("Filter"):r.parent.notify(Uo,{});break;case n.getConstant("ClearAllFilter"):r.parent.notify(Wo,{isAction:!0});break;case n.getConstant("ReapplyFilter"):r.parent.notify(jo,null);break;case n.getConstant("CustomSort")+"...":r.parent.notify(wo,null);break;default:t=e.item.text===n.getConstant("SortAscending")?"Ascending":"Descending";var i=[];if(r.parent.sortCollection)for(var a=r.parent.sortCollection.length-1;a>=0;a--)r.parent.sortCollection[a]&&r.parent.sortCollection[a].sheetIndex===r.parent.activeSheetIndex&&(i.push(r.parent.sortCollection[a]),r.parent.sortCollection.splice(a,1));r.parent.notify(zo,{sortOptions:{sortDescriptors:{order:t}}}),r.parent.notify(Io,{sortOptions:{sortDescriptors:{order:t}},previousSort:i})}r.sortingDdb.element.setAttribute("aria-label",e.item.text)}}),this.sortingDdb.createElement=this.parent.createElement,this.sortingDdb.appendTo(this.parent.createElement("button",{id:e+"_sorting",attrs:{type:"button"},className:"e-ss-ddb"})),this.sortingDdb.element},e.prototype.getFindBtn=function(e){var t=this,r=this.parent.createElement("button",{id:e+"_findbtn",attrs:{type:"button","aria-label":this.parent.serviceLocator.getService(Fl).getConstant("FindReplaceTooltip")}});return this.findDdb=new o.Button({cssClass:"e-spreadsheet-find-ddb e-flat",iconCss:"e-icons e-search-icon"}),this.findDdb.createElement=this.parent.createElement,this.findDdb.appendTo(r),r.onclick=function(e){t.parent.notify(Or,{event:e})},this.findDdb.element},e.prototype.getClearDDB=function(e){var t=this,r=this.parent.serviceLocator.getService(Fl);return this.clearDdb=new h.DropDownButton({cssClass:"e-clear-ddb",iconCss:"e-icons e-clear-icon",items:[{text:r.getConstant("ClearAll"),id:e+"_Clear All"},{text:r.getConstant("ClearFormats"),id:e+"_Clear Formats"},{text:r.getConstant("ClearContents"),id:e+"_Clear Contents"},{text:r.getConstant("ClearHyperlinks"),id:e+"_Clear Hyperlinks"}],createPopupOnClick:!0,beforeOpen:function(e){e.element.setAttribute("aria-label",t.parent.serviceLocator.getService(Fl).getConstant("Clear"))},select:function(r){t.parent.notify(Cs,{options:{type:r.item.id.replace(e+"_","")},isAction:!0}),t.clearDdb.element.setAttribute("aria-label",r.item.text)}}),this.clearDdb.createElement=this.parent.createElement,this.clearDdb.appendTo(this.parent.createElement("button",{id:e+"_clear",attrs:{type:"button"},className:"e-ss-ddb"})),this.clearDdb.element},e.prototype.ribbonCreated=function(){var e=this.parent.serviceLocator.getService(Fl).getConstant("CollapseToolbar");t.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())},e.prototype.alignItemRender=function(e){e.element.title=this.parent.serviceLocator.getService(Fl).getConstant("Align"+this.getAlignText(e))},e.prototype.getAlignText=function(e){var t=e.item.iconCss.split(" e-")[1].split("-icon")[0];return t[0].toUpperCase()+t.slice(1,t.length)},e.prototype.toggleBtnClicked=function(e){var r,n,i,a,o,s=t.closest(e.target,".e-btn"),l=this.parent.element.id,h=s.id,d=Br;switch(h){case l+"_bold":n={fontWeight:"normal"},i={fontWeight:"bold"},o="fontWeight";break;case l+"_italic":n={fontStyle:"normal"},i={fontStyle:"italic"},o="fontStyle";break;case l+"_line-through":d=Vr,i=n={textDecoration:"line-through"},o="textDecoration";break;case l+"_underline":d=Vr,i=n={textDecoration:"underline"},o="textDecoration"}s.classList.contains("e-active")?(r=i[""+o],a={style:i,onActionUpdate:!0},this.parent.notify(d,a),a.cancel&&s.classList.remove("e-active")):(r=n[""+o],a={style:n,onActionUpdate:!0},this.parent.notify(d,a),a.cancel&&s.classList.add("e-active")),a.cancel||r===a.style[""+o]||this.refreshToggleBtn(u(this.parent.getActiveSheet().activeCell))},e.prototype.getCellStyleValue=function(e,t){var r=Re(t[0],t[1],this.parent.getActiveSheet()),n=this.parent.cellStyle[""+e];return r&&r.style&&r.style[""+e]&&(n=r.style[""+e]),n},e.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}},e.prototype.expandCollapseHandler=function(e){var t=this.ribbon.element.querySelector(".e-drop-icon"),r=this.parent.serviceLocator.getService(Fl);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()},e.prototype.getChartThemeDdbItems=function(e){var t=this.parent.serviceLocator.getService(Fl),r=[];return["Material","Fabric","Bootstrap","HighContrastLight","MaterialDark","FabricDark","HighContrast","BootstrapDark","Bootstrap4","Bootstrap5Dark","Bootstrap5","TailwindDark","Tailwind","FluentDark","Fluent","Material3","Material3Dark"].forEach(function(n){r.push({id:n,text:t.getConstant(n),iconCss:n===e?"e-icons e-selected-icon":""})}),r},e.prototype.getNumFormatDdbItems=function(e){var t=this.parent.serviceLocator.getService(Fl);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")}]},e.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"}]},e.prototype.applyNumFormat=function(e,t){var r=this.parent.getActiveSheet(),n={format:e,range:r.selectedRange,cancel:!1,requestType:"NumberFormat"},i={range:r.name+"!"+n.range,format:n.format,requestType:"NumberFormat"};this.parent.trigger("beforeCellFormat",n),this.parent.notify(Ar,{eventArgs:n,action:"format"}),n.cancel||(this.parent.notify(Pr,n),this.parent.notify(xi,{type:"mousedown"}),this.refreshNumFormatSelection(t),this.parent.notify(Yo,{eventArgs:i,action:"format"}))},e.prototype.renderCustomFormatDialog=function(e){var t=this,r=this.parent.serviceLocator.getService(Fl),n=this.parent.createElement("div"),i=this.parent.createElement("div",{className:"e-custom-dialog"}),a=this.parent.createElement("button",{className:"e-btn",attrs:{type:"button"}});a.innerText=r.getConstant("Apply");var o=this.parent.createElement("div",{className:"e-custom-sample"});o.innerText=r.getConstant("CustomFormatTypeList")+":";var s=this.parent.createElement("input",{className:"e-input e-dialog-input",attrs:{type:"text",name:"input",placeholder:r.getConstant("CustomFormatPlaceholder"),spellcheck:"false"}}),h=this.parent.createElement("div",{className:"e-custom-listview"}),d=this.parent.serviceLocator.getService(Al),p=new l.ListView({dataSource:e,select:function(e){s.value=e.text,e.event&&"keydown"===e.event.type&&e.item&&e.item.focus()}});i.appendChild(s),i.appendChild(a),i.appendChild(o),i.appendChild(h),p.appendTo(h);var c=function(t){-1===e.indexOf(t.format)&&e.push(t.format)};this.parent.on(Ri,c,this),a.addEventListener("click",function(){var e=s.value;t.applyNumFormat(e,r.getConstant("Custom")),p.destroy(),d.hide(),c({format:e})}),d.show({header:r.getConstant("CustomFormat"),cssClass:"e-custom-format-dlg",height:this.parent.cssClass.indexOf("e-bigger")>-1?502:480,width:440,isModal:!0,showCloseIcon:!0,content:i,footerTemplate:n,beforeOpen:function(){return Wt(t.parent.element)}});var f=this.parent.getActiveSheet(),g=u(f.activeCell),m=Re(g[0],g[1],f);m&&m.format&&p.selectItem(m.format)},e.prototype.tBarDdbBeforeOpen=function(e,t,r,n){void 0===n&&(n=0);var i=this.parent.viewport.height,a=parseInt(getComputedStyle(e.firstElementChild).height,10)*(t.length-n)+2*parseInt(getComputedStyle(e).paddingTop,10);if(n){var o=getComputedStyle(e.querySelector(".e-separator"));a+=n*(parseInt(o.borderBottomWidth,10)+2*parseInt(o.marginTop,10))}a>i?(e.style.height=i+"px",e.style.overflowY="auto"):e.style.height&&(e.style.height="",e.style.overflowY=""),e.setAttribute("aria-label",r)},e.prototype.numDDBOpen=function(e){this.numPopupWidth=0;for(var t=e.element.querySelectorAll("span.e-numformat-preview-text"),r=0,n=t.length;r<n;r++)this.numPopupWidth<t[r].offsetWidth&&(this.numPopupWidth=t[r].offsetWidth);var i=this.numPopupWidth+160;document.querySelector(".e-numformat-ddb.e-dropdown-popup").style.width=i+"px"},e.prototype.previewNumFormat=function(e){if(!e.item.id.includes("_Custom")){var r=this.parent.createElement("div",{className:"e-numformat-text",styles:"width:100%",innerHTML:e.element.innerHTML});e.element.innerHTML="";var n=this.parent.getActiveSheet(),i=u(n.activeCell),a=Re(i[0],i[1],n,!1,!0);if(!t.isNullOrUndefined(a.value)||""!==a.value){var o=Ue(e.item.id.split(this.parent.element.id+"_")[1]),s={type:e.item.text,formattedText:"",value:a.value,format:o,cell:{value:a.value,format:o},skipFormatCheck:Kt(this.parent)};this.parent.notify(Mr,s);var l=this.parent.createElement("span",{className:"e-numformat-preview-text",styles:"float:right;"});l.innerText=s.formattedText,r.appendChild(l)}e.element.appendChild(r)}},e.prototype.refreshRibbonContent=function(e){if(this.ribbon){t.isNullOrUndefined(e)&&(e=this.ribbon.selectedTab);var r=this.parent.serviceLocator.getService(Fl),n=this.parent.getActiveSheet();switch(this.ribbon.items[e].header.text){case r.getConstant("Home"):this.refreshHomeTabContent(u(n.activeCell));break;case r.getConstant("Insert"):case r.getConstant("Formulas"):break;case r.getConstant("Data"):this.refreshDataTabContent(e);break;case r.getConstant("View"):this.refreshViewTabContent(e)}}},e.prototype.refreshHomeTabContent=function(e){t.isNullOrUndefined(document.getElementById(this.parent.element.id+"_number_format"))||(this.numFormatDDB=t.getComponent(document.getElementById(this.parent.element.id+"_number_format"),h.DropDownButton));var r=this.parent.getActiveSheet(),n=u(this.parent.getActiveSheet().activeCell),i=this.parent.serviceLocator.getService(Fl),a=Re(n[0],n[1],this.parent.getActiveSheet())||{},o=Ve(a.format||"General",!0);if(this.numFormatDDB&&(r.isProtected&&!r.protectSettings.formatCells?(o="General",this.refreshNumFormatSelection(o)):(a.format&&"General"===o&&"General"!==a.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){var s=this.getCellStyleValue("fontSize",e);r.isProtected&&!r.protectSettings.formatCells?this.fontSizeDdb.content="11":(s=s.includes("pt")?s.split("pt")[0]:"11")!==this.fontSizeDdb.content&&(this.fontSizeDdb.content=s,this.fontSizeDdb.dataBind())}if(this.refreshTextAlign(r,a,o,e),this.verticalAlignDdb){s="e-icons e-"+this.getCellStyleValue("verticalAlign",e).toLowerCase()+"-icon";r.isProtected&&!r.protectSettings.formatCells?this.verticalAlignDdb.iconCss="e-icons e-bottom-icon":s!==this.verticalAlignDdb.iconCss&&(this.verticalAlignDdb.iconCss=s,this.verticalAlignDdb.dataBind())}if(this.refreshToggleBtn(e),!r.isProtected&&(a.rowSpan>1||a.colSpan>1))this.enableToolbarItems([{tab:i.getConstant("Home"),items:[this.parent.element.id+"_merge_cells"],enable:!0}]),this.toggleActiveState(!0);else{var l=c(r.selectedRange);this.enableToolbarItems([{tab:i.getConstant("Home"),items:[this.parent.element.id+"_merge_cells"],enable:l[0]!==l[2]||l[1]!==l[3]}]),this.toggleActiveState(!1)}},e.prototype.refreshTextAlign=function(e,t,r,n){if(this.textAlignDdb){var i=this.getCellStyleValue("textAlign",n);if(e.isProtected&&!e.protectSettings.formatCells)this.textAlignDdb.iconCss="e-icons e-left-icon";else{void 0!==t.value&&"left"===i&&("Accounting"===r||D(t.value)&&"Text"!==r)&&(i="right");var a="e-icons e-"+i.toLowerCase()+"-icon";a!==this.textAlignDdb.iconCss&&(this.textAlignDdb.iconCss=a,this.textAlignDdb.dataBind())}}},e.prototype.toggleActiveState=function(e){var t=this.parent.serviceLocator.getService(Fl);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")))},e.prototype.refreshToggleBtn=function(e){var t,r,n,i=this,a=this.parent.getActiveSheet(),o=this.parent.element.id,s=Re(e[0],e[1],a),l=["fontWeight","fontStyle","textDecoration","textDecoration"];["bold","italic","line-through","underline","wrap"].forEach(function(h,d){(t=document.getElementById(o+"_"+h))&&(a.isProtected&&!a.protectSettings.formatCells?t.classList.remove("e-active"):"wrap"===h?n=s&&s.wrap:(r=i.getCellStyleValue(l[d],e).toLowerCase(),n=r.indexOf(h)>-1),n?t.classList.add("e-active"):t.classList.contains("e-active")&&t.classList.remove("e-active"))})},e.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)},e.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)},e.prototype.fileMenuItemSelect=function(e){var r=this,n=t.extend({cancel:!1},e);this.parent.trigger("fileMenuItemSelect",n);var i,a=this.parent.element.id;if(!n.cancel)switch(e.item.id){case a+"_Open":t.select("#"+a+"_fileUpload",this.parent.element).click(),Wt(this.parent.element);break;case a+"_Xlsx":case a+"_Xls":case a+"_Csv":case a+"_Pdf":this.parent.notify(Tr,e);break;case a+"_New":(i=this.parent.serviceLocator.getService(Al)).show({height:200,width:400,isModal:!0,showCloseIcon:!0,content:this.parent.serviceLocator.getService(Fl).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:Wt(r.parent.element)},buttons:[{buttonModel:{content:this.parent.serviceLocator.getService(Fl).getConstant("Ok"),isPrimary:!0},click:function(){i.hide(),r.parent.refresh(!0)}}]})}},e.prototype.toolbarClicked=function(e){if(e.item&&"spreadsheet_find"!==e.item.id){var t=this.parent.element.id,r=this.parent.getActiveSheet(),n=void 0,i=void 0,a=void 0,o=void 0;switch(e.item.id){case t+"_headers":if(n={isShow:!r.showHeaders,sheetIdx:this.parent.activeSheetIndex,cancel:!1},this.parent.notify(Yo,{eventArgs:n,action:"headers"}),n.cancel)return;this.parent.setSheetPropertyOnMute(r,"showHeaders",!r.showHeaders),this.parent.serviceLocator.getService("sheet").showHideHeaders(),this.toggleRibbonItems({props:"Headers",activeTab:this.ribbon.selectedTab});break;case t+"_gridlines":if(i={isShow:!r.showGridLines,sheetIdx:this.parent.activeSheetIndex,cancel:!1},this.parent.notify(Yo,{eventArgs:i,action:"gridLines"}),i.cancel)return;this.parent.setSheetPropertyOnMute(r,"showGridLines",!r.showGridLines),this.toggleRibbonItems({props:"GridLines",activeTab:this.ribbon.selectedTab});break;case t+"_protect":this.parent.notify(ml,{});break;case t+"_undo":this.parent.notify(Lo,{isUndo:!0});break;case t+"_redo":this.parent.notify(Lo,{isUndo:!1});break;case t+"_freezepanes":a=u(r.topLeftCell),o=r.frozenRows||r.frozenColumns?a:u(r.activeCell),this.parent.notify(tl,{row:o[0]-a[0],column:o[1]-a[1],triggerEvent:!0});break;case t+"_freezerows":this.parent.notify(tl,{row:r.frozenRows?0:u(r.activeCell)[0]-u(r.topLeftCell)[0],column:r.frozenColumns,triggerEvent:!0});break;case t+"_freezecolumns":this.parent.notify(tl,{row:r.frozenRows,column:r.frozenColumns?0:u(r.activeCell)[1]-u(r.topLeftCell)[1],triggerEvent:!0});break;case t+"_protectworkbook":this.parent.password.length>0?this.parent.notify(Ks,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(Yo,{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(Xs,null)}this.parent.notify($a,e)}},e.prototype.toggleRibbonItems=function(e){var r="",n=this.parent.serviceLocator.getService(Fl).getConstant("View"),i=this.parent.serviceLocator.getService(Fl).getConstant("Data");if(this.ribbon.items[this.ribbon.selectedTab].header.text===n){if(t.isNullOrUndefined(e.activeTab))for(var a=0,o=this.ribbon.items.length;a<o;a++)if(this.ribbon.items[a].header.text===n){e.activeTab=a;break}var s=this.getLocaleText(e.props);"GridLines"===e.props&&this.parent.serviceLocator.getService("sheet").toggleGridlines();var l=this.parent.element.id+"_"+e.props.toLowerCase(),h=this.ribbon.items[e.activeTab].content.length;for(a=void 0;a<h;a++)"Separator"!==this.ribbon.items[e.activeTab].content[a].type&&this.ribbon.items[e.activeTab].content[a].id===l&&(this.ribbon.items[e.activeTab].content[a].text=s,this.ribbon.setProperties({items:this.ribbon.items},!0));this.ribbon.items[this.ribbon.selectedTab].header.text===n&&"Protect"!==e.props&&this.updateToggleText(e.props.toLowerCase(),s)}if(this.ribbon.items[this.ribbon.selectedTab].header.text===i){if(t.isNullOrUndefined(e.activeTab)){a=0;for(var d=this.ribbon.items.length;a<d;a++)if(this.ribbon.items[a].header.text===i){e.activeTab=a;break}}if((l=this.parent.element.id+"_"+e.props.toLowerCase())===this.parent.element.id+"_protect"){var p=this.ribbon.items[this.ribbon.selectedTab].content.length,c=void 0;for(c=0;c<p&&this.ribbon.items[this.ribbon.selectedTab].content[c].id!==this.parent.element.id+"_protect";c++);r=this.getLocaleProtectText("Sheet",!0)}else if(l===this.parent.element.id+"_protectworkbook"){var u=this.ribbon.items[this.ribbon.selectedTab].content.length;c=void 0;for(c=0;c<u&&this.ribbon.items[this.ribbon.selectedTab].content[c].id!==this.parent.element.id+"_protectworkbook";c++);this.parent.isProtected||this.parent.password.length>0?r=this.getLocaleProtectWorkbook("UnprotectWorkbook"):this.parent.isProtected||(r=this.getLocaleProtectWorkbook("ProtectWorkbook"))}for(h=this.ribbon.items[e.activeTab].content.length,a=void 0;a<h;a++)"Separator"!==this.ribbon.items[e.activeTab].content[a].type&&this.ribbon.items[e.activeTab].content[a].id===l&&(this.ribbon.items[e.activeTab].content[a].text=r,this.ribbon.setProperties({items:this.ribbon.items},!0));this.ribbon.items[this.ribbon.selectedTab].header.text===i&&this.updateToggleText(e.props.toLowerCase(),r)}},e.prototype.enableFileMenuItems=function(e){this.ribbon.enableMenuItems(e.items,e.enable,e.isUniqueId)},e.prototype.hideRibbonTabs=function(e){this.ribbon.hideTabs(e.tabs,e.hide)},e.prototype.addRibbonTabs=function(e){this.ribbon.addTabs(e.items,e.insertBefore);t.select(".e-ribbon .e-tab-header .e-toolbar-item:not(.e-menu-tab).e-hide",this.parent.element)&&this.parent.updateActiveBorder(t.selectAll(".e-ribbon .e-tab-header .e-toolbar-item:not(.e-menu-tab)",this.parent.element)[this.ribbon.selectedTab])},e.prototype.updateToggleText=function(e,r){var n=t.select("#"+this.parent.element.id+"_"+e+" .e-tbar-btn-text",this.ribbon.element);if("protect"===e||"protectworkbook"===e?n.parentElement.setAttribute("aria-label",r):n.parentElement.setAttribute("aria-label",n.textContent),tt(function(){n&&(n.textContent=r)}),"headers"===e){var i=this.parent.element.getElementsByClassName("e-findtool-dlg")[0];i&&i.classList.contains("e-popup-open")&&this.parent.notify(Or,{refreshPosition:!0,dialogEle:i})}},e.prototype.refreshViewTabContent=function(e){for(var t,r=this.parent.element.id,n=this.parent.getActiveSheet(),i=this.parent.serviceLocator.getService(Fl),a=0;a<this.ribbon.items[e].content.length;a++)"Separator"!==(t=this.ribbon.items[e].content[a]).type&&(t.id===r+"_headers"&&this.updateViewTabContent(e,"Headers",a),t.id===r+"_gridlines"&&this.updateViewTabContent(e,"GridLines",a),t.id===r+"_freezepanes"&&(n.frozenRows||n.frozenColumns?t.text===i.getConstant("FreezePanes")&&this.updateToggleText("freezepanes",this.updateRibbonItemText("Unfreeze","Panes",a,e)):t.text===i.getConstant("UnfreezePanes")&&this.updateToggleText("freezepanes",this.updateRibbonItemText("Freeze","Panes",a,e))),t.id===r+"_freezerows"&&(n.frozenRows?t.text===i.getConstant("FreezeRows")&&this.updateToggleText("freezerows",this.updateRibbonItemText("Unfreeze","Rows",a,e)):t.text===i.getConstant("UnfreezeRows")&&this.updateToggleText("freezerows",this.updateRibbonItemText("Freeze","Rows",a,e))),t.id===r+"_freezecolumns"&&(n.frozenColumns?t.text===i.getConstant("FreezeColumns")&&this.updateToggleText("freezecolumns",this.updateRibbonItemText("Unfreeze","Columns",a,e)):t.text===i.getConstant("UnfreezeColumns")&&this.updateToggleText("freezecolumns",this.updateRibbonItemText("Freeze","Columns",a,e))))},e.prototype.updateViewTabContent=function(e,t,r){var n=this.parent.getActiveSheet(),i=this.parent.serviceLocator.getService(Fl);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))},e.prototype.updateRibbonItemText=function(e,t,r,n){var i=this.parent.serviceLocator.getService(Fl).getConstant(e+t);return this.ribbon.items[n].content[r].text=i,this.ribbon.setProperties({items:this.ribbon.items},!0),i},e.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)}},e.prototype.updateDataTabContent=function(e,t,r){var n=this.parent.getActiveSheet(),i=this.parent.serviceLocator.getService(Fl);if("Sheet"===t)n.isProtected?this.ribbon.items[e].content[r].text===i.getConstant("Protect"+t)&&(this.ribbon.items[e].content[r].cssClass="e-active",this.updateProtectBtn("Unprotect",t,r,e)):this.updateProtectBtn("Protect",t,r,e);else if("Workbook"===t){var a=this.parent.serviceLocator.getService(Fl);this.parent.isProtected?this.ribbon.items[e].content[r].text===a.getConstant("Protect"+t)&&this.updateToggleText("protectworkbook",this.updateRibbonItemText("Unprotect",t,r,e)):this.ribbon.items[e].content[r].text===a.getConstant("Unprotect"+t)&&this.updateToggleText("protectworkbook",this.updateRibbonItemText("Protect",t,r,e))}},e.prototype.updateProtectBtn=function(e,t,r,n){var i=this.parent.serviceLocator.getService(Fl).getConstant(e+t);this.ribbon.items[n].content[r].text=i,this.ribbon.setProperties({items:this.ribbon.items},!0),this.updateToggleText("protect",i)},e.prototype.updateProtectWorkbookBtn=function(e,t,r,n){var i=this.parent.serviceLocator.getService(Fl).getConstant(e);this.ribbon.items[n].content[r].text=i,this.ribbon.setProperties({items:this.ribbon.items},!0),this.updateToggleText("protectworkbook",i)},e.prototype.addToolbarItems=function(e){var t=this.parent.serviceLocator.getService(Fl);this.ribbon.addToolbarItems(t.getConstant(e.tab),e.items,e.index)},e.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)})},e.prototype.createMobileView=function(){var e=this,t=this.parent.element.id,r=this.parent.createElement("div",{className:"e-header-toolbar"}),n=this.parent.createElement("ul");r.appendChild(n);var a=new i.Toolbar({items:[{prefixIcon:"e-tick-icon",align:"Left",id:t+"focused_tick",cssClass:"e-focused-tick"},{template:n,align:"Right",id:t+"file_menu"}],clicked:function(r){switch(r.item.id){case t+"focused_tick":e.parent.element.classList.remove("e-mobile-focused"),e.parent.renderModule.setSheetPanelSize()}},created:function(){var t=new i.Menu({cssClass:"e-mobile e-file-menu",enableRtl:!0,showItemOnClick:!0,items:e.getRibbonMenuItems(),select:e.fileMenuItemSelect.bind(e),beforeOpen:function(t){t.element.parentElement.classList.remove("e-rtl"),e.fileMenuBeforeOpen(t)},beforeClose:e.fileMenuBeforeClose.bind(e)});t.createElement=e.parent.createElement,t.appendTo(n)}});a.createElement=this.parent.createElement,a.appendTo(r),this.parent.element.insertBefore(r,this.parent.element.firstElementChild),this.renderMobileToolbar()},e.prototype.renderMobileToolbar=function(){var e=this,t=this.parent.createElement("div",{className:"e-toolbar-panel e-ribbon"}),r=this.parent.createElement("div"),a=this.parent.createElement("button",{attrs:{type:"button"}});t.appendChild(r),t.appendChild(a),t.style.display="block",this.parent.element.appendChild(t);var o=new h.DropDownButton({cssClass:"e-caret-hide",content:this.ribbon.items[0].header.text,items:[{text:this.ribbon.items[0].header.text},{text:this.ribbon.items[1].header.text},{text:this.ribbon.items[2].header.text},{text:this.ribbon.items[3].header.text}],createPopupOnClick:!0,select:function(t){t.item.text!==o.content&&(s.element.style.display="none",o.content=t.item.text,o.dataBind(),s.items=e.ribbon.items[o.items.indexOf(t.item)+1].content,s.width="calc(100% - "+a.getBoundingClientRect().width+"px)",s.element.style.display="",s.dataBind(),s.items[0].text=t.item.text,s.dataBind())},open:function(e){var t=e.element.parentElement,r=t.getBoundingClientRect(),i=n.calculatePosition(o.element,"right","bottom");t.style.left=i.left-r.width+"px",t.style.top=i.top-r.height+"px";for(var a=0;a<o.items.length;a++)if(o.content===o.items[a].text){e.element.children[a].classList.add("e-selected");break}},close:function(){return Wt(e.parent.element)}});o.createElement=this.parent.createElement,o.appendTo(a);var s=new i.Toolbar({width:"calc(100% - "+a.getBoundingClientRect().width+"px)",items:this.ribbon.items[0].content,clicked:this.toolbarClicked.bind(this)});s.createElement=this.parent.createElement,s.appendTo(r),t.style.display=""},e.prototype.fileMenuBeforeOpen=function(e){var t,r=this,n=this.parent.serviceLocator.getService(Fl),i=[".xlsx",".xls",".csv",".pdf"];e.parentItem.text===n.getConstant("SaveAs")&&[].slice.call(e.element.children).forEach(function(e,n){t=r.parent.createElement("div",{innerHTML:e.innerHTML}),e.innerHTML="";var a=r.parent.createElement("span",{className:"e-extension"});a.innerText=i[n],t.appendChild(a),e.appendChild(t)}),this.parent.trigger("fileMenuBeforeOpen",e),e.element.setAttribute("aria-label",this.parent.serviceLocator.getService(Fl).getConstant("File"))},e.prototype.enableRibbonTabs=function(e){this.ribbon.enableTabs(e.tabs,e.enable)},e.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"&&tt(function(){var e=t.ribbon.element.querySelector(".e-tab-header .e-toolbar-item .e-tab-wrap");if(e){Wt(e);var r=e.querySelector(".e-menu-item.e-focused");r&&r.classList.remove("e-focused")}})},e.prototype.hideFileMenuItems=function(e){this.ribbon.hideMenuItems(e.items,e.hide,e.isUniqueId)},e.prototype.addFileMenuItems=function(e){this.ribbon.addMenuItems(e.items,e.text,e.insertAfter,e.isUniqueId)},e.prototype.hideToolbarItems=function(e){this.ribbon.hideToolbarItems(e.tab,e.indexes,e.hide)},e.prototype.protectSheetHandler=function(e){var t=this.parent.getActiveSheet(),r=this.parent.serviceLocator.getService(Fl);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(ls,null)):this.enableToolbarItems([{tab:r.getConstant("Home"),items:e.disableHomeBtnId,enable:!1}]),t.isProtected&&t.protectSettings.insertLink||!t.isProtected?!this.parent.allowHyperlink||t.isProtected&&t.protectSettings.insertLink?this.enableToolbarItems([{tab:r.getConstant("Insert"),items:e.enableInsertBtnId.slice(0,1),enable:!1}]):this.enableToolbarItems([{tab:r.getConstant("Insert"),items:e.enableInsertBtnId,enable:!0}]):this.enableToolbarItems([{tab:r.getConstant("Insert"),items:e.enableInsertBtnId,enable:!1}]),this.enableToolbarItems([{tab:r.getConstant("Home"),items:e.findBtnId,enable:!t.isProtected||t.protectSettings.selectCells||t.protectSettings.selectUnLockedCells}]);var n,i=this.ribbon.items[this.ribbon.selectedTab].content.length;for(n=0;n<i&&this.ribbon.items[this.ribbon.selectedTab].content[n].id!==this.parent.element.id+"_protectworkbook";n++);t.isProtected?(this.parent.isProtected&&this.parent.element.querySelector("#"+this.parent.element.id+"_protectworkbook")&&this.parent.element.querySelector("#"+this.parent.element.id+"_protectworkbook").querySelector(".e-tbar-btn-text").textContent===r.getConstant("UnprotectWorkbook")?this.ribbon.items[this.ribbon.selectedTab].header.text===r.getConstant("Data")&&(this.ribbon.items[this.ribbon.selectedTab].content[n].text=r.getConstant("UnprotectWorkbook")):this.ribbon.items[this.ribbon.selectedTab].header.text===r.getConstant("Data")&&(this.ribbon.items[this.ribbon.selectedTab].content[n].text=r.getConstant("ProtectWorkbook")),this.enableToolbarItems([{tab:r.getConstant("Insert"),items:e.imageBtnId,enable:!1}]),this.enableToolbarItems([{tab:r.getConstant("Data"),items:e.dataValidationBtnId,enable:!1}]),this.enableToolbarItems([{tab:r.getConstant("Formulas"),items:e.enableFrmlaBtnId,enable:!1}]),this.enableToolbarItems([{tab:r.getConstant("Insert"),items:e.chartBtnId,enable:!1}])):(this.parent.isProtected&&this.parent.element.querySelector("#"+this.parent.element.id+"_protectworkbook")&&this.parent.element.querySelector("#"+this.parent.element.id+"_protectworkbook").querySelector(".e-tbar-btn-text").textContent===r.getConstant("UnprotectWorkbook")?this.ribbon.items[this.ribbon.selectedTab].header.text===r.getConstant("Data")&&(this.ribbon.items[this.ribbon.selectedTab].content[n].text=r.getConstant("UnprotectWorkbook")):this.ribbon.items[this.ribbon.selectedTab].header.text===r.getConstant("Data")&&(this.ribbon.items[this.ribbon.selectedTab].content[n].text=r.getConstant("ProtectWorkbook")),this.enableToolbarItems([{tab:r.getConstant("Insert"),items:e.imageBtnId,enable:this.parent.allowImage}]),this.enableToolbarItems([{tab:r.getConstant("Data"),items:e.dataValidationBtnId,enable:this.parent.allowDataValidation}]),this.enableToolbarItems([{tab:r.getConstant("Formulas"),items:e.enableFrmlaBtnId,enable:!0}]),this.enableToolbarItems([{tab:r.getConstant("Insert"),items:e.chartBtnId,enable:this.parent.allowChart}]))},e.prototype.updateMergeItem=function(e){if("mousemove"===e.type||"pointermove"===e.type||"touchmove"===e.type||e.shiftKey&&("mousedown"===e.type||"touchend"===e.type)){var t=c(this.parent.getActiveSheet().selectedRange);t[1]===t[3]&&t[0]===t[2]||this.parent.getActiveSheet().isProtected||!this.parent.allowMerge||(this.enableToolbarItems([{tab:this.parent.serviceLocator.getService(Fl).getConstant("Home"),items:[this.parent.element.id+"_merge_cells"],enable:!0}]),this.toggleActiveState(!1))}},e.prototype.onPropertyChanged=function(e){var t=this.parent.serviceLocator.getService(Fl),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()}},e.prototype.addEventListener=function(){this.parent.on(Ea,this.ribbonOperation,this),this.parent.on(Za,this.enableToolbarItems,this),this.parent.on(Kr,this.refreshRibbonContent,this),this.parent.on(Ro,this.toggleRibbonItems,this),this.parent.on(lo,this.enableFileMenuItems,this),this.parent.on(co,this.hideRibbonTabs,this),this.parent.on(fo,this.addRibbonTabs,this),this.parent.on(go,this.addToolbarItems,this),this.parent.on(ho,this.hideFileMenuItems,this),this.parent.on(po,this.addFileMenuItems,this),this.parent.on(mo,this.hideToolbarItems,this),this.parent.on(uo,this.enableRibbonTabs,this),this.parent.on(ns,this.protectSheetHandler,this),this.parent.on(xi,this.updateMergeItem,this),this.parent.on(ti,this.refreshRibbonContent,this),this.parent.on(js,this.insertDesignChart,this),this.parent.on(qs,this.removeDesignChart,this),this.parent.on("unMerge",this.unMerge,this)},e.prototype.destroy=function(){var e=this.parent.element,r=this.ribbon?this.ribbon.element:null,n=this.cPickerEle,i=e.id;["bold","italic","line-through","underline"].forEach(function(r){At(t.select("#"+i+"_"+r,e),o.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),this.ribbon&&this.ribbon.destroy(),r&&t.detach(r),this.ribbon=null,n&&t.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},e.prototype.destroyComponent=function(e,r){var n="string"==typeof e?document.getElementById(e):e;if(n){if("menu"!==r||n.childElementCount){var i=t.getComponent(n,r);if(i&&(i.destroy(),"dropdown-btn"===r)){var a=document.getElementById(n.id+"-popup");a&&t.detach(a)}}"menu"===r&&t.detach(n)}},e.prototype.detachPopupElement=function(e){["_conditionalformatting","_chart-type-btn","_chart-btn","_borders"].forEach(function(r){var n=document.getElementById(""+e+r+"-popup");n&&t.detach(n)})},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(Ea,this.ribbonOperation),this.parent.off(Za,this.enableToolbarItems),this.parent.off(Kr,this.refreshRibbonContent),this.parent.off(Ro,this.toggleRibbonItems),this.parent.off(lo,this.enableFileMenuItems),this.parent.off(co,this.hideRibbonTabs),this.parent.off(fo,this.addRibbonTabs),this.parent.off(go,this.addToolbarItems),this.parent.off(ho,this.hideFileMenuItems),this.parent.off(po,this.addFileMenuItems),this.parent.off(mo,this.hideToolbarItems),this.parent.off(uo,this.enableRibbonTabs),this.parent.off(ns,this.protectSheetHandler),this.parent.off(xi,this.updateMergeItem),this.parent.off(ti,this.refreshRibbonContent),this.parent.off(js,this.insertDesignChart),this.parent.off(qs,this.removeDesignChart),this.parent.off("unMerge",this.unMerge),this.parent.off(Ri))},e}(),kh=function(){function e(e){this.categoryCollection=[],this.formulaCollection=[],this.isGoto=!1,this.parent=e,this.addEventListener()}return e.prototype.getModuleName=function(){return"formulaBar"},e.prototype.createFormulaBar=function(e){var r=this;if(this.parent.showFormulaBar||!this.insertFnRipple){var n=this.parent.serviceLocator.getService(Fl),i=this.parent.element.id,a=this.parent.createElement("div",{className:"e-formula-bar-panel"});if(!this.parent.isMobileView()){var o=this.parent.createElement("input",{id:i+"_name_box",attrs:{type:"text"}});a.appendChild(o),this.comboBoxInstance=new s.ComboBox({value:"A1",cssClass:"e-name-box",width:"",noRecordsTemplate:t.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(e){r.isDevice&&(window.browserDetails.isDevice=!0)},change:function(){}}),this.comboBoxInstance.createElement=this.parent.createElement,this.comboBoxInstance.appendTo(o),this.comboBoxInstance.element.parentElement.title=n.getConstant("NameBox")}a.appendChild(this.parent.createElement("button",{className:"e-btn e-css e-flat e-icon-btn e-insert-function",attrs:{title:n.getConstant("InsertFunction"),type:"button"}})).appendChild(this.parent.createElement("span",{className:"e-btn-icon e-icons"})),this.insertFnRipple=t.rippleEffect(a,{selector:".e-insert-function"}),a.appendChild(this.parent.createElement("div",{className:"e-separator"}));var l=n.getConstant("FormulaBar"),h=a.appendChild(this.parent.createElement("textarea",{className:"e-formula-bar e-css",id:i+"_formula_input",attrs:{title:l,"aria-label":l,spellcheck:"false"}}));if(h.rows=1,this.parent.isMobileView())h.placeholder=n.getConstant("MobileFormulaBarPlaceHolder"),t.EventHandler.add(h,"focus",this.textAreaFocusIn,this),t.EventHandler.add(h,"blur",this.textAreaFocusOut,this);else{var d=n.getConstant("ExpandFormulaBar");a.appendChild(this.parent.createElement("span",{className:"e-drop-icon e-icons",attrs:{title:d,role:"button",tabindex:"-1","aria-label":d}}))}e&&e.uiUpdate?this.parent.element.insertBefore(a,document.getElementById(i+"_sheet_panel")):this.parent.element.appendChild(a)}else this.destroy()},e.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)},e.prototype.textAreaFocusOut=function(){var e=this.parent.element.querySelector(".e-formula-bar-panel");e.classList.remove("e-focused"),t.detach(e.querySelector(".e-formula-submit"))},e.prototype.keyDownHandler=function(e){var t=e.target;if(this.parent.isEdit&&(!this.parent.getActiveSheet().isProtected||t.classList.contains("e-formula-bar")&&!t.disabled)){if((B(t.value)||t.validity&&0===t.value.toString().indexOf("="))&&16===e.keyCode)return;t.classList.contains("e-formula-bar")&&(!e.shiftKey||e.shiftKey&&!St(e.keyCode))&&this.parent.notify(Da,{action:"refreshEditor",value:t.value,refreshEditorElem:!0})}},e.prototype.keyUpHandler=function(e){if(this.parent.isEdit){var t=e.target;if(t.classList.contains("e-formula-bar")){var r={action:"getCurrentEditValue",editedValue:""};this.parent.notify(Da,r),r.editedValue===t.value||16===e.keyCode||e.shiftKey&&(!e.shiftKey||St(e.keyCode))||this.parent.notify(Da,{action:"refreshEditor",value:t.value,refreshEditorElem:!0})}}},e.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))},e.prototype.nameBoxBlur=function(){this.comboBoxInstance.element.classList.contains("e-name-editing")&&(this.comboBoxInstance.element.classList.remove("e-name-editing"),this.UpdateValueAfterMouseUp())},e.prototype.nameBoxSelect=function(e){if(e.isInteracted&&(!e.e||"keydown"!==e.e.type||40!==e.e.keyCode&&38!==e.e.keyCode)){var t=e.itemData.refersTo.substr(1),r=ce(this.parent,fe(t));if(void 0===r)return;var n=C(t),i=Ce(this.parent,r),a=void 0,o=void 0;if(-1===n.indexOf(":"))a=o=n.replace("$","");else{var s=n.indexOf(":");a=n.substr(0,s).replace("$",""),o=n.substr(s+1,n.length).replace("$","")}o.match(/\D/g)&&!o.match(/[0-9]/g)&&a.match(/\D/g)&&!a.match(/[0-9]/g)?n=(a+="1")+":"+(o+=i.rowCount):!o.match(/\D/g)&&o.match(/[0-9]/g)&&!a.match(/\D/g)&&a.match(/[0-9]/g)&&(n=(a=g(parseInt(a,10)-1,0))+":"+(o=g(parseInt(o,10)-1,i.colCount-1))),r===this.parent.activeSheetIndex?(this.parent.selectRange(n),Wt(this.parent.element)):(me(this.parent,n,i),this.parent.activeSheetIndex=r)}},e.prototype.formulaBarUpdateHandler=function(e){var r,n=this,i=this.parent.getActiveSheet().selectedRange.split(":"),a={action:"getElement",element:null};this.parent.notify(Da,a);var o=this.parent.element.querySelector(".e-formula-bar");if("mousemove"===e.type||"pointermove"===e.type){var s=c(i[0]),l=c(i[1]);r=Math.abs(s[0]-l[0])+1+"R x "+(Math.abs(s[1]-l[1])+1)+"C",this.parent.isEdit&&(e.target&&!e.target.classList.contains("e-spreadsheet-edit")?this.parent.notify(ws,null):a.element&&(o.value=a.element.textContent))}else{r=i[0];var h=we(this.parent)+"!"+r;he(this.parent,h,!1,!0).then(function(r){if(n.parent){var i,s="";r.forEach(function(r){if(r)if(r.formula)s=r.formula;else if(t.isNullOrUndefined(r.value)||""===r.value)r.hyperlink&&(s="string"==typeof r.hyperlink?r.hyperlink:r.hyperlink.address||"");else{var l={},h=r.format&&Te(r.format,!0,l,!0)&&l.type;if("date"===h||"time"===h||"datetime"===h){if((i=N(Number(r.value)))&&"Invalid Date"!==i.toString()&&i.getFullYear()>=1900){var d=new t.Internationalization,p=r.format.toLowerCase();"time"!==h||!p.includes("m")||p.includes(":m")||p.includes("m:")||p.includes("[m")||p.includes("am")||(h="date");var c=r.value.toString().split("."),u=2===c.length,f=u?N(parseFloat(c[0]+1+"."+c[1])||Number(r.value)):i;if("date"===h){var g={type:"date"};g.skeleton="yMd",s=d.formatDate(i,g),u&&(s+=" "+d.formatDate(f,{type:"dateTime",skeleton:"hms"}))}else(Number(r.value)>=1||"datetime"===h)&&(s=d.formatDate(i,{type:"dateTime",skeleton:"yMd"})+" "),s+=d.formatDate(f,{type:"dateTime",skeleton:"hms"})}}else r.format&&r.format.includes("%")&&D(r.value)&&((s=n.parent.getDisplayText(r)).includes("%")||(s=""));if(!s)if("true"===(s=r.value.toString()).toLowerCase()||"false"===s.toLowerCase())s=s.toUpperCase();else if("en-US"!==n.parent.locale){var m=t.getNumericObject(n.parent.locale).decimal;"."!==m&&D(s)&&s.includes(".")&&(s=s.replace(".",m))}}var v={action:"getCurrentEditValue",editedValue:""};n.parent.notify(Da,v);document.getElementById(n.parent.element.id+"_formula_input").value=s,v.editedValue&&B(v.editedValue.toString(),!0)||n.parent.notify(Da,{action:"refreshEditor",value:s,refreshEditorElem:!0}),n.parent.isEdit&&(e.target&&!e.target.classList.contains("e-spreadsheet-edit")?n.parent.notify(ws,null):a.element&&(o.value=a.element.textContent))})}})}this.updateComboBoxValue(r)},e.prototype.UpdateValueAfterMouseUp=function(){this.updateComboBoxValue(this.parent.getActiveSheet().selectedRange.split(":")[0])},e.prototype.updateComboBoxValue=function(e){var t=this.parent.getActiveSheet(),r={action:"getNameFromRange",range:we(this.parent)+"!"+t.selectedRange,definedName:null};if(this.parent.notify(La,r),r.definedName&&(e=r.definedName.name),!this.parent.isMobileView()){if(this.comboBoxInstance.text===e)return;this.comboBoxInstance.text=e,this.comboBoxInstance.dataBind()}},e.prototype.disabletextarea=function(){var e=this.getFormulaBar();this.parent.getActiveSheet().isProtected&&!this.parent.isEdit?e.disabled=!0:e.disabled=!1},e.prototype.formulaBarScrollEdit=function(){var e=c(this.parent.getActiveSheet().selectedRange),t=u(this.parent.getActiveSheet().topLeftCell);e[0]<t[0]&&(this.parent.goTo(this.parent.getActiveSheet().selectedRange),this.isGoto=!0),this.parent.notify(Da,{action:"startEdit",refreshCurPos:!1})},e.prototype.formulaBarClickHandler=function(e){var r=e.target,n=this.parent.getActiveSheet(),i=n.isProtected,a=u(n.activeCell),o=Y(Re(a[0],a[1],n),Xe(n,a[1]));if(r.classList.contains("e-drop-icon")&&r.parentElement.classList.contains("e-formula-bar-panel"))this.toggleFormulaBar(r);else if(r.classList.contains("e-formula-bar"))!this.parent.isEdit&&(!i||i&&!o)||this.parent.isEdit&&i&&!r.disabled?this.formulaBarScrollEdit():i&&o&&this.parent.notify(ss,null);else if(r.parentElement&&r.parentElement.classList.contains("e-name-box"))if(r.classList.contains("e-ddl-icon")){var s={action:"getNames",names:[]};if(this.parent.notify(La,s),this.comboBoxInstance.dataSource.length!==s.names.length||this.comboBoxInstance.value===this.comboBoxInstance.text){var l=this.comboBoxInstance.text;this.comboBoxInstance.dataSource=s.names;var h=s.names.find(function(e){return e.name==l});this.comboBoxInstance.value=h?h.refersTo:this.comboBoxInstance.value,this.comboBoxInstance.dataBind()}}else this.comboBoxInstance.element.classList.add("e-name-editing"),this.comboBoxInstance.element.select();!t.isNullOrUndefined(r.offsetParent)&&(r.offsetParent.classList.contains("e-insert-function")||r.classList.contains("e-insert-function")||this.parent.element.id+"_insert_function"===r.offsetParent.id||this.parent.element.id+"_insert_function"===r.id||r.parentElement.classList.contains("e-insert-function")||this.parent.element.id+"_insert_function"===r.parentElement.id)&&this.renderInsertDlg()},e.prototype.renderInsertDlg=function(){var e=this,r=this.parent.getActiveSheet();if(r.isProtected){var n=u(r.activeCell);if(Y(Re(n[0],n[1],r),Xe(r,n[1]))&&!this.parent.isEdit)return void this.parent.notify(ss,null)}var i=this.parent.serviceLocator.getService(Fl),a=!this.parent.isEdit,o={action:"getCurrentEditValue",editedValue:""};if(!a){var h={action:"isFormulaEditing",isFormulaEdit:!1};this.parent.notify(La,h),a=h.isFormulaEdit,this.parent.notify(Da,o)}if(a||""===o.editedValue){""===o.editedValue&&this.parent.notify(Da,{action:"refreshEditor",value:"="});var d=this.parent.createElement("div",{className:"e-formula-description",id:this.parent.element.id+"_description_content"}),p=this.parent.createElement("div",{className:"e-category-content",id:this.parent.element.id+"_category_content"});p.innerText=i.getConstant("PickACategory");var c=this.parent.createElement("input",{className:"e-formula-category",id:this.parent.element.id+"_formula_category"}),f=this.parent.createElement("div",{className:"e-formula-list",id:this.parent.element.id+"_formula_list"}),g=this.parent.createElement("div",{className:"e-description-content"});g.innerText=i.getConstant("Description");var m=this.parent.createElement("div",{className:"e-header-content"});m.innerText=i.getConstant("InsertFunction");var v={action:"getFormulaCategory",categoryCollection:[]};this.parent.notify(jr,v),this.categoryCollection=v.categoryCollection;var y;this.categoryList=new s.DropDownList({dataSource:this.categoryCollection,cssClass:"e-ss-formula-category",index:0,width:"285px",popupHeight:"210px",select:this.dropDownSelect.bind(this),open:function(){return y=!0},close:function(){return y=!1}});var C={action:"getLibraryFormulas",formulaCollection:[]};this.parent.notify(jr,C),this.formulaCollection=C.formulaCollection,this.formulaList=new l.ListView({dataSource:this.formulaCollection.sort(),actionComplete:this.updateFormulaList.bind(this),select:this.listSelected.bind(this),width:"285px",height:"200px"}),this.dialog=this.parent.serviceLocator.getService(Al),this.parent.element.querySelector(".e-spreadsheet-function-dlg")||(this.dialog.show({header:m.outerHTML,content:p.outerHTML+c.outerHTML+f.outerHTML+g.outerHTML+d.outerHTML,width:"320px",height:"485px",cssClass:"e-spreadsheet-function-dlg",showCloseIcon:!0,isModal:!0,beforeOpen:function(t){var r={dialogName:"InsertFunctionDialog",element:t.element,target:t.target,cancel:t.cancel};e.parent.trigger("dialogBeforeOpen",r),r.cancel&&(t.cancel=!0),Wt(e.parent.element)},open:this.dialogOpen.bind(this),beforeClose:this.dialogBeforeClose.bind(this),close:this.dialogClose.bind(this),buttons:[{click:function(t){t&&13===t.keyCode&&!y||e.selectFormula()},buttonModel:{content:i.getConstant("Ok"),isPrimary:!0}}]}),this.categoryList.appendTo("#"+this.parent.element.id+"_formula_category"),this.formulaList.appendTo("#"+this.parent.element.id+"_formula_list"),t.EventHandler.add(this.formulaList.element,"dblclick",this.formulaClickHandler,this))}},e.prototype.toggleFormulaBar=function(e){var t=e.parentElement,r=this.parent.serviceLocator.getService(Fl);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()},e.prototype.dialogOpen=function(){var e=this;tt(function(){var t=e.dialog.dialogInstance.element.querySelector(".e-footer-content .e-primary"),r=e.parent.serviceLocator.getService(Fl);t.setAttribute("aria-label",r.getConstant("InsertFunction")+" "+r.getConstant("Ok")),e.categoryList&&Wt(e.categoryList.element)})},e.prototype.dialogClose=function(){var e={action:"getCurrentEditValue",editedValue:""};this.parent.notify(Da,e),"="===e.editedValue.toString().trim()&&this.parent.notify(Da,{action:"refreshEditor",value:""})},e.prototype.dialogBeforeClose=function(){t.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},e.prototype.selectFormula=function(){var e=this.formulaList.getSelectedItems().text,t=Ce(this.parent,this.parent.activeSheetIndex);this.parent.isEdit?this.parent.notify(Da,{action:"refreshEditor",value:e+"(",refreshFormulaBar:!0,refreshEditorElem:!0,isAppend:!0}):(this.parent.notify(Da,{action:"startEdit",value:"="+e+"(",address:t.activeCell}),this.parent.notify(Pa,{action:"refreshFormulabar",value:"="+e+"("})),this.dialog.dialogInstance.storeActiveElement=document.getElementById(this.parent.element.id+"_edit"),this.dialog.hide()},e.prototype.listSelected=function(e){this.updateFormulaDescription(),e.isInteracted&&e.item&&e.item.focus()},e.prototype.updateFormulaList=function(){this.activeListFormula(),this.updateFormulaDescription()},e.prototype.dropDownSelect=function(e){this.formulaCollection=[];var t={action:"getLibraryFormulas",formulaCollection:[]};if("All"===e.item.textContent)this.parent.notify(jr,t),this.formulaCollection=t.formulaCollection;else{var r={action:"dropDownSelectFormulas",formulaCollection:[],selectCategory:e.item.textContent};this.parent.notify(jr,r),this.formulaCollection=r.formulaCollection}this.formulaList.dataSource=this.formulaCollection.sort()},e.prototype.activeListFormula=function(){var e=document.getElementById(this.parent.element.id+"_formula_list").children[0].children[0].firstElementChild;this.formulaList.selectItem(e)},e.prototype.updateFormulaDescription=function(){var e=this.formulaList.getSelectedItems().text,t={action:"getFormulaDescription",description:"",selectedList:e,isCustom:!1};this.parent.notify(jr,t);var r=this.dialog.dialogInstance.element.querySelector(".e-footer-content .e-primary");r.hasAttribute("aria-label")&&r.removeAttribute("aria-label");var n=document.getElementById(this.parent.element.id+"_description_content");e="AND"===e?"CalculateAND":"OR"===e?"CalculateOR":e,n.textContent=t.isCustom?t.description:this.parent.serviceLocator.getService(Fl).getConstant(e)},e.prototype.formulaClickHandler=function(e){var t=e.target,r=Ce(this.parent,this.parent.activeSheetIndex);(t.offsetParent.classList.contains("e-text-content")||t.classList.contains("e-list-item"))&&(this.parent.isEdit?this.parent.notify(Da,{action:"refreshEditor",value:t.innerText+"(",refreshFormulaBar:!0,refreshEditorElem:!0,isAppend:!0}):(this.parent.notify(Da,{action:"startEdit",value:"="+t.innerText+"(",address:r.activeCell}),this.parent.notify(Pa,{action:"refreshFormulabar",value:"="+t.innerText+"("})),this.dialog.hide())},e.prototype.addEventListener=function(){this.parent.on(Ra,this.createFormulaBar,this),this.parent.on(Ma,this.formulaBarClickHandler,this),this.parent.on(Ba,this.keyDownHandler,this),this.parent.on(gl,this.renderInsertDlg,this),this.parent.on(Ha,this.keyUpHandler,this),this.parent.on(xi,this.formulaBarUpdateHandler,this),this.parent.on(Wa,this.UpdateValueAfterMouseUp,this),this.parent.on(Pa,this.editOperationHandler,this),this.parent.on(hs,this.disabletextarea,this),this.parent.on(Aa,this.isFormulaBarEdit,this)},e.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&&(rt(e),t.detach(e)),this.parent=null},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(Ra,this.createFormulaBar),this.parent.off(Ma,this.formulaBarClickHandler),this.parent.off(gl,this.renderInsertDlg),this.parent.off(Ba,this.keyDownHandler),this.parent.off(Ha,this.keyUpHandler),this.parent.off(xi,this.formulaBarUpdateHandler),this.parent.off(Wa,this.UpdateValueAfterMouseUp),this.parent.off(Pa,this.editOperationHandler),this.parent.off(hs,this.disabletextarea),this.parent.off(Aa,this.isFormulaBarEdit))},e.prototype.editOperationHandler=function(e){switch(e.action){case"refreshFormulabar":this.getFormulaBar().value=t.isUndefined(e.value)?"":e.value;break;case"getElement":e.element=this.getFormulaBar()}},e.prototype.isFormulaBarEdit=function(e){this.parent.isEdit&&this.isGoto?e.isEdit=!0:e.isEdit=!1},e.prototype.getFormulaBar=function(){return t.select("#"+this.parent.element.id+"_formula_input",this.parent.element)},e}(),Fh=function(){function e(e){this.isFormulaBar=!1,this.isFormula=!1,this.isPopupOpened=!1,this.isPreventClose=!1,this.isSubFormula=!1,this.parent=e,this.addEventListener()}return e.prototype.getModuleName=function(){return"formula"},e.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},e.prototype.addEventListener=function(){this.parent.on(La,this.performFormulaOperation,this),this.parent.on(Ha,this.keyUpHandler,this),this.parent.on(Ba,this.keyDownHandler,this),this.parent.on(Ma,this.formulaClick,this),this.parent.on(Zo,this.refreshFormulaDatasource,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(La,this.performFormulaOperation),this.parent.off(Ha,this.keyUpHandler),this.parent.off(Ba,this.keyDownHandler),this.parent.off(Ma,this.formulaClick),this.parent.off(Zo,this.refreshFormulaDatasource))},e.prototype.performFormulaOperation=function(e){var t,r,n=this,i=e.action,a=this.parent.serviceLocator.getService(Fl);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=we(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(Al),r=a.getConstant("CircularReference"),t.dialogInstance&&t.dialogInstance.visible&&t.dialogInstance.content===r||t.show({height:180,width:400,isModal:!0,showCloseIcon:!0,content:a.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"}},e.prototype.renderAutoComplete=function(){if(!t.select("#"+this.parent.element.id+"_ac",this.parent.element)){var e=this.parent.createElement("input",{id:this.parent.element.id+"_ac",className:"e-ss-ac"});this.parent.element.appendChild(e);var r={action:"getLibraryFormulas",formulaCollection:[]};this.parent.notify(jr,r);var n={dataSource:r.formulaCollection,cssClass:"e-ss-atc",popupWidth:"130px",allowFiltering:!0,filterType:"StartsWith",sortOrder:"Ascending",open:this.onSuggestionOpen.bind(this),close:this.onSuggestionClose.bind(this),select:this.onSelect.bind(this),actionComplete:this.onSuggestionComplete.bind(this)};this.autocompleteInstance=new s.AutoComplete(n,e),this.autocompleteInstance.createElement=this.parent.createElement,this.acInputElement=e}},e.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,t){setTimeout(function(){e()},100)}).then(function(){t.triggerKeyDownEvent(Tl.DOWN)})},e.prototype.onSuggestionClose=function(e){this.isPreventClose?e.cancel=!0:this.isPopupOpened=!1},e.prototype.onSelect=function(e){var r="="+e.itemData.value+"(";if(this.isSubFormula){var n=this.getEditingValue(),i=n.lastIndexOf(this.parent.listSeparator);i>-1?r=n.slice(0,i+1):(i=n.lastIndexOf("("))>-1&&(r=n.slice(0,i+1)),r+=e.itemData.value+"("}if(this.parent.notify(Da,{action:"refreshEditor",value:r,refreshFormulaBar:!0,refreshEditorElem:!0,refreshCurPos:!this.isFormulaBar}),this.isPopupOpened){this.hidePopUp();var a=t.select("#"+this.parent.element.id+"_ac_popup");a&&t.detach(a),this.isPopupOpened=!1}},e.prototype.onSuggestionComplete=function(e){this.isPreventClose=e.result.length>0,this.isPreventClose||(e.cancel=!0,this.hidePopUp())},e.prototype.refreshFormulaDatasource=function(){var e={action:"getLibraryFormulas",formulaCollection:[]};this.parent.notify(jr,e),this.autocompleteInstance&&(this.autocompleteInstance.dataSource=e.formulaCollection)},e.prototype.keyUpHandler=function(e){if(this.parent.isEdit){var t=this.getEditingValue();this.isFormula=B(t),(this.isFormula||this.isPopupOpened)&&(e.keyCode!==Tl.TAB&&this.isFormula&&(t=this.getSuggestionKeyFromFormula(t)),this.refreshFormulaSuggestion(e,t))}else this.isPopupOpened&&this.hidePopUp()},e.prototype.keyDownHandler=function(e){var t=e.keyCode;if(this.isFormula){if(this.isPopupOpened)switch(t){case Tl.UP:case Tl.DOWN:e.preventDefault(),this.triggerKeyDownEvent(t);break;case Tl.TAB:e.preventDefault(),this.triggerKeyDownEvent(Tl.ENTER)}}else{var r=e.target;if(r.id===this.parent.element.id+"_name_box")switch(t){case Tl.ENTER:document.querySelector(".e-name-box.e-popup-open")||(this.addDefinedName({name:r.value}),Wt(this.parent.element));break;case Tl.ESC:Wt(this.parent.element)}}},e.prototype.formulaClick=function(e){if(this.parent.isEdit){var t=e.target;this.isFormulaBar=t.classList.contains("e-formula-bar")}},e.prototype.refreshFormulaSuggestion=function(e,t){if(t.length>0){var r=this.autocompleteInstance.element,n=e.keyCode,i=this.isPopupOpened;St(n)||(r.value=t,r.dispatchEvent(new Event("input")),r.dispatchEvent(new Event("keyup")),i&&this.triggerKeyDownEvent(Tl.DOWN))}else this.isPopupOpened&&(this.isPreventClose=!1,this.hidePopUp())},e.prototype.endEdit=function(){if(this.isSubFormula=!1,this.isPreventClose=!1,this.isFormula=!1,this.isFormulaBar=!1,this.isPopupOpened){this.hidePopUp();var e=t.select("#"+this.parent.element.id+"_ac_popup");e&&t.detach(e),this.isPopupOpened=!1}},e.prototype.hidePopUp=function(){this.autocompleteInstance.hidePopup()},e.prototype.getSuggestionKeyFromFormula=function(e){var t="";if(e=e.substr(1)){var r=e.lastIndexOf("("),n=(e=e.substr(r+1)).split(this.parent.listSeparator);1===n.length?(t=n[0],this.isSubFormula=r>-1):(t=n[n.length-1],this.isSubFormula=!0);var i=t.match(/\w/);(!i||i&&0!==i.index)&&(t="")}return t},e.prototype.getRelateToElem=function(){var e={action:"getElement"};return this.isFormulaBar?this.parent.notify(Pa,e):this.parent.notify(Da,e),e.element},e.prototype.getEditingValue=function(){var e={action:"getCurrentEditValue",editedValue:""};return this.parent.notify(Da,e),e.editedValue},e.prototype.triggerKeyDownEvent=function(e){var t=this.autocompleteInstance.element;t.dispatchEvent(new Event("input"));var r=new Event("keydown");r.keyCode=e,r.which=e,r.altKey=!1,r.shiftKey=!1,r.ctrlKey=!1,t.dispatchEvent(r)},e.prototype.getNames=function(e){return this.parent.definedNames.filter(function(t){return"Workbook"===t.scope||""===t.scope||t.scope===e})},e.prototype.getNameFromRange=function(e){var t=e.slice(0,e.indexOf(":")),r=e.slice(e.indexOf("!")+1).split(":"),n=r.length>1&&r[0]===r[1],i=this.parent.definedNames.filter(function(r){var i=r.refersTo.split("!");i[0].includes("'")&&i[0].match(/^='.*'$/)&&(i[0]="="+i[0].slice(2,-1));var a=i[0]+"!"+i[1].split("$").join("");return!(!n||a!=="="+t)||a==="="+e});return i&&i[0]},e.prototype.addDefinedName=function(e){var r=this,n=e.name,i=!1;if(n&&U(n.toUpperCase()))return this.parent.goTo(n),i;if(!e.refersTo){var a=Ce(this.parent,this.parent.activeSheetIndex),o=we(this.parent);o=-1!==o.indexOf(" ")?"'"+o+"'":o;var s=a.selectedRange;if(!t.isNullOrUndefined(s)){var l=s.indexOf(":"),h=s.substr(0,l),d=s.substr(l+1,s.length);parseInt(d.replace(/\D/g,""),10)===a.rowCount&&1===parseInt(h.replace(/\D/g,""),10)?(d=d.replace(/[0-9]/g,""),s="$"+(h=h.replace(/[0-9]/g,""))+":$"+d):u(d)[1]===a.colCount-1&&0===u(h)[1]?(d=d.replace(/\D/g,""),s="$"+(h=h.replace(/\D/g,""))+":$"+d):s=h===d?h:s}e.refersTo=o+"!"+s,e.scope="Workbook"}if(n.length>0&&/^([a-zA-Z_0-9.]){0,255}$/.test(n)){var p={action:"addDefinedName",definedName:e,isAdded:!1};this.parent.notify(jr,p),i=p.isAdded,p.isAdded||this.parent.serviceLocator.getService(Al).show({content:this.parent.serviceLocator.getService(Fl).getConstant("DefineNameExists"),width:"300",beforeOpen:function(e){var t={dialogName:"DefineNameExistsDialog",element:e.element,target:e.target,cancel:e.cancel};r.parent.trigger("dialogBeforeOpen",t),t.cancel&&(e.cancel=!0)}})}else this.parent.serviceLocator.getService(Al).show({content:this.parent.serviceLocator.getService(Fl).getConstant("DefineNameInValid"),width:"300",beforeOpen:function(e){var t={dialogName:"DefineNameInValidDialog",element:e.element,target:e.target,cancel:e.cancel};r.parent.trigger("dialogBeforeOpen",t),t.cancel&&(e.cancel=!0)}});return i},e}(),Ah=function(){function e(e){this.aggregateContent="",this.selaggregateCnt="Sum",this.parent=e,this.addEventListener()}return e.prototype.getModuleName=function(){return"sheetTabs"},e.prototype.createSheetTabs=function(){var e=this;if(this.parent.showSheetTabs||!this.tabInstance){var r=this.parent.serviceLocator.getService(Fl),n=this.parent.createElement("div",{className:"e-sheet-tab-panel",id:this.parent.element.id+"_sheet_tab_panel"}),a=this.parent.createElement("button",{className:"e-add-sheet-tab e-btn e-css e-flat e-icon-btn"+(this.parent.allowInsert?"":" e-disabled"),attrs:{title:r.getConstant("AddSheet"),type:"button"}});a.appendChild(this.parent.createElement("span",{className:"e-btn-icon e-icons e-add-icon"})),a.addEventListener("click",this.addSheetTab.bind(this)),a.disabled=!this.parent.allowInsert,n.appendChild(a),this.addBtnRipple=t.rippleEffect(n,{selector:".e-add-sheet-tab"});var o=this.parent.createElement("button",{attrs:{title:r.getConstant("ListAllSheets"),type:"button"}});n.appendChild(o),this.parent.element.appendChild(n);var s=this.getSheetTabItems();this.dropDownInstance=new h.DropDownButton({iconCss:"e-icons",items:s.ddbItems,createPopupOnClick:!0,beforeItemRender:function(t){var r=e.parent.sheets[e.dropDownInstance.items.indexOf(t.item)];"Hidden"===r.state?t.element.classList.add("e-hide"):"VeryHidden"===r.state&&(t.element.style.display="none")},select:function(t){return e.updateSheetTab({idx:e.dropDownInstance.items.indexOf(t.item)})},beforeOpen:function(t){return e.beforeOpenHandler(e.dropDownInstance,t.element,r.getConstant("ListAllSheets"))},open:function(t){return e.openHandler(e.dropDownInstance,t.element,"left")},cssClass:"e-sheets-list e-flat e-caret-hide",close:function(){return e.focusTab(e.tabInstance.element)}}),this.dropDownInstance.createElement=this.parent.createElement,this.dropDownInstance.appendTo(o);var l,d=this.parent.createElement("div",{className:"e-sheet-tab"});this.tabInstance=new i.Tab({selectedItem:this.parent.activeSheetIndex,overflowMode:"Scrollable",items:s.tabItems,scrollStep:250,selecting:function(t){if(t.selectingIndex!==t.selectedIndex)if(l)l=!1;else{var r={currentSheetIndex:t.selectingIndex,previousSheetIndex:t.selectedIndex,cancel:!1};e.parent.notify(Ar,{eventArgs:r,action:"gotoSheet"}),l=r.cancel}},selected:function(t){t.isInteracted||(t.preventFocus=!0),e.goToSheet(t,l,!0)},created:function(){var r=e.tabInstance.element.querySelector(".e-toolbar-items");r.classList.add("e-sheet-tabs-items"),t.EventHandler.add(r,"dblclick",e.renameSheetTab,e)}}),n.appendChild(d),this.tabInstance.createElement=this.parent.createElement,this.tabInstance.appendTo(d),t.EventHandler.remove(this.tabInstance.element,"keydown",this.tabInstance.spaceKeyDown);for(var p,c=s.tabItems.length,u=0;u<c;u++){var f={action:"addSheet",sheetName:"Sheet"+(p=Ce(this.parent,u)).id,sheetId:p.id,visibleName:p.name};this.parent.notify(jr,f)}this.parent.notify(jr,{action:"initiateDefinedNames"}),this.parent.notify(ts,null)}else this.destroy()},e.prototype.goToSheet=function(e,t,r){var n=this;if(e.selectedIndex!==e.previousIndex){if(t)return this.tabInstance.selectedItem=e.previousIndex,this.tabInstance.dataBind(),void Wt(this.parent.element);if(this.parent.notify(qs,{}),this.parent.isEdit){var i=window.getSelection(),a={action:"getCurrentEditValue",editedValue:""};this.parent.notify(Da,a);var o=!!a.editedValue&&B(a.editedValue,!0);!o&&i&&i.focusNode&&i.focusNode.classList&&i.focusNode.classList.contains("e-formula-bar-panel")&&(o=B(this.parent.element.querySelector(".e-formula-bar").value,!0)),o||this.parent.endEdit()}this.parent.activeSheetIndex=e.selectedIndex,this.parent.dataBind(),this.updateDropDownItems(e.selectedIndex,e.previousIndex);var s={action:"registerGridInCalc",sheetID:(e.selectedIndex+1).toString()};this.parent.notify(jr,s),r&&(this.parent.notify(Yo,{eventArgs:{previousSheetIndex:e.previousIndex,currentSheetIndex:e.selectedIndex},action:"gotoSheet"}),tt(function(){return Wt(n.parent.element)}))}},e.prototype.updateDropDownItems=function(e,t){t>-1&&(this.dropDownInstance.items[t].iconCss=""),this.dropDownInstance.items[e].iconCss="e-selected-icon e-icons",this.dropDownInstance.setProperties({items:this.dropDownInstance.items},!0)},e.prototype.beforeOpenHandler=function(e,t,r){var n=this.parent.viewport.height;parseInt(getComputedStyle(t.firstElementChild).height,10)*e.items.length+2*parseInt(getComputedStyle(t).paddingTop,10)>n&&(t.style.height=n+"px",t.style.overflowY="auto"),t.parentElement.style.visibility="hidden",r&&t.setAttribute("aria-label",r)},e.prototype.openHandler=function(e,t,r){var i,a=t.parentElement;if(-1===n.isCollide(a).indexOf("bottom")){i="auto"===t.style.overflowY?this.parent.viewport.height:a.getBoundingClientRect().height;var o=n.calculatePosition(e.element,r,"top");"right"===r&&(o.left-=a.getBoundingClientRect().width),a.style.left=o.left+"px",a.style.top=o.top-i+"px"}a.style.visibility="",Wt(t)},e.prototype.getSheetTabItems=function(){var e,t=this,r=[],n=[];return this.parent.sheets.forEach(function(i,a){e=we(t.parent,a).replace(/</g,"&lt;").replace(/>/g,"&gt;"),r.push({header:{text:e},visible:"Visible"===i.state}),n.push({text:e,iconCss:a===t.parent.activeSheetIndex?"e-selected-icon e-icons":""})}),{tabItems:r,ddbItems:n}},e.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()},e.prototype.addSheetTab=function(){this.parent.notify(Sn,{model:this.parent,start:this.parent.activeSheetIndex+1,end:this.parent.activeSheetIndex+1,modelType:"Sheet",isAction:!0,activeSheetIndex:this.parent.activeSheetIndex+1})},e.prototype.insertSheetTab=function(e){this.parent.notify(qs,{}),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})},e.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(ts,null)},e.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(Yo,{action:"showSheet",eventArgs:{sheetIndex:e.sheetIndex}})},e.prototype.switchSheetTab=function(e){var r=t.closest(e.event.target,".e-toolbar-item");if(r){for(var n=r.querySelector(".e-tab-text").textContent,i=[],a=this.parent.element.id+"_cmenu",o=0,s=this.parent.sheets.length;o<s;o++)if(this.parent.sheets[o].name===n){this.parent.activeSheetIndex!==o&&this.updateSheetTab({idx:o});break}e.element.classList.contains("e-contextmenu")&&e.items[0]&&e.items[0].id===this.parent.element.id+"_cmenu_insert_sheet"&&(1===this.skipHiddenSheets()&&i.push(a+"_hide_sheet",a+"_delete_sheet"),this.parent.allowInsert&&!this.parent.isProtected||i.push(a+"_insert_sheet"),!this.parent.allowDelete&&i.indexOf(a+"_delete_sheet")>-1&&i.push(a+"_delete_sheet")),(this.parent.password.length>0||this.parent.isProtected)&&(i.indexOf(a+"_insert_sheet")>-1&&i.push(a+"_insert_sheet"),i.indexOf(a+"_delete_sheet")>-1&&i.push(a+"_delete_sheet"),i.push(a+"_duplicate",a+"_rename",a+"_hide_sheet",a+"_delete_sheet",a+"_insert_sheet",a+"_move_left",a+"_move_right")),this.parent.enableContextMenuItems(i,!1,!0)}},e.prototype.skipHiddenSheets=function(){var e=this.parent.sheets.length;return this.parent.sheets.forEach(function(t){"Visible"!==t.state&&--e}),e},e.prototype.renameSheetTab=function(){var e=this.tabInstance.element.querySelector(".e-toolbar-item.e-active");if(e){var r=(e=e.querySelector(".e-text-wrap")).querySelector(".e-tab-text").textContent,n={eventArgs:{name:r,index:this.parent.getActiveSheet().id},action:"renameSheet",cancel:!1};if(this.parent.trigger("actionBegin",n),n.cancel||this.parent.isProtected)return;var i=this.parent.createElement("input",{id:this.parent.element.id+"_rename_input",className:"e-input e-sheet-rename",styles:"width: "+e.getBoundingClientRect().width+"px",attrs:{type:"text",name:"Rename",required:"",value:r,spellcheck:"false",maxlength:"31"}});e.firstElementChild.style.display="none",e.appendChild(i),t.EventHandler.add(document,"mousedown touchstart",this.renameInputFocusOut,this),t.EventHandler.add(i,"keydown",this.renameKeyDown,this),t.EventHandler.add(i,"input",this.updateWidth,this),i.focus(),i.setSelectionRange(0,r.length),t.EventHandler.remove(t.closest(e,".e-toolbar-items"),"dblclick",this.renameSheetTab)}},e.prototype.updateWidth=function(e){var t=e.target,r=t.value.length,n=t.value.split(" ");if(n.length){var i=n.length-1;r-=i,r+=.5*i}t.style.width=r+"ch"},e.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)},e.prototype.renameInputFocusOut=function(e){var r=e.target;if("mousedown"!==e.type&&"touchstart"!==e.type||!r.classList.contains("e-sheet-rename")&&!t.closest(r,".e-dlg-container")){var n=(r=document.getElementById(this.parent.element.id+"_rename_input")).value,i=this.parent.serviceLocator.getService(Fl);if(n){var a=this.tabInstance.selectedItem;if(n.match(new RegExp(".*[\\[\\]\\*\\\\/\\?].*")))this.showRenameDialog(r,i.getConstant("SheetRenameInvalidAlert"));else{if(this.parent.sheets[a].name!==n)for(var o=0,s=this.parent.sheets.length;o<s;o++)if(o!==this.parent.activeSheetIndex&&this.parent.sheets[o].name.toLowerCase()===n.toLowerCase())return void this.showRenameDialog(r,i.getConstant("SheetRenameAlreadyExistsAlert"));var l=this.removeRenameInput(r);this.parent.sheets[a].name!==n&&(this.parent.setSheetPropertyOnMute(this.parent.sheets[a],"name",n),this.updateSheetName({value:n,idx:a,items:l})),"keydown"===e.type?this.focusTab(l):t.closest(e.target,".e-spreadsheet")&&Wt(this.parent.element)}}else this.showRenameDialog(r,i.getConstant("SheetRenameEmptyAlert"));this.parent.notify(Yo,{eventArgs:{index:this.parent.getActiveSheet().id,value:n},action:"renameSheet"})}},e.prototype.focusTab=function(e){Wt(t.select(".e-toolbar-item.e-active .e-tab-wrap",e))},e.prototype.updateSheetName=function(e){var t=this.tabInstance.items[e.idx].header.text.replace(/&lt;/g,"<").replace(/&gt;/g,">"),r=e.value.replace(/</g,"&lt;").replace(/>/g,"&gt;");this.tabInstance.items[e.idx].header.text=r,this.dropDownInstance.items[e.idx].text=r,this.dropDownInstance.setProperties({items:this.dropDownInstance.items},!0);var n=e.items.querySelectorAll(".e-toolbar-item")[e.idx].querySelector(".e-tab-text");if(n.textContent="",n.appendChild(document.createTextNode(e.value)),e.value.indexOf(" ")>-1?this.tabInstance.setProperties({items:this.tabInstance.items},!0):this.tabInstance.dataBind(),this.parent.notify(jr,{action:"renameUpdation",value:e.value,pName:t}),this.parent.allowChart){var i;this.parent.chartColl.forEach(function(r){r.range.includes("!")&&(i=r.range.split("!"))[0].toLowerCase()===t.toLowerCase()&&(i[0]=e.value,r.range=i.join("!"))})}},e.prototype.hideSheet=function(e){var t={action:"hideSheet",eventArgs:{sheetIndex:e.sheetIndex,cancel:!1}};e.triggerEvent&&(this.parent.notify(Ar,t),t.eventArgs.cancel)||(this.parent.setSheetPropertyOnMute(Ce(this.parent,e.sheetIndex),"state","Hidden"),this.tabInstance.hideTab(e.sheetIndex),e.triggerEvent&&(delete t.eventArgs.cancel,this.parent.notify(Yo,t)))},e.prototype.removeRenameInput=function(e){var r=e.parentElement.querySelector(".e-tab-text"),n=t.closest(e,".e-toolbar-items");return t.EventHandler.add(n,"dblclick",this.renameSheetTab,this),t.EventHandler.remove(document,"mousedown touchstart",this.renameInputFocusOut),t.EventHandler.remove(e,"keydown",this.renameKeyDown),t.EventHandler.remove(e,"input",this.updateWidth),t.remove(e),r.style.display="",n},e.prototype.showRenameDialog=function(e,t){var r=this;this.parent.serviceLocator.getService(Al).show({height:180,width:400,isModal:!0,showCloseIcon:!0,content:t,beforeOpen:function(n){var i={dialogName:"SheetRenameDialog",element:n.element,target:n.target,cancel:n.cancel};r.parent.trigger("dialogBeforeOpen",i),i.cancel&&(n.cancel=!0),n.element.querySelector(".e-footer-content .e-primary").setAttribute("aria-label",t+" "+r.parent.serviceLocator.getService(Fl).getConstant("Ok")),e.focus()},close:function(){return e.setSelectionRange(0,e.value.length)}})},e.prototype.focusRenameInput=function(){var e=document.getElementById(this.parent.element.id+"_rename_input");e&&e.focus()},e.prototype.removeSheetTab=function(e){var r=this;if(!e.count||e.count!==this.parent.sheets.length){var n=this.parent.serviceLocator.getService(Fl);if(this.skipHiddenSheets()>1){var i=e.sheetName?Ce(this.parent,ce(this.parent,e.sheetName)):this.parent.getActiveSheet(),a=t.isNullOrUndefined(e.index)?ce(this.parent,i.name):e.index,o={index:a,sheetCount:this.parent.sheets.length,sheetName:i.name};if(!(!i.rows||!i.rows.length)&&(1!==i.rows.length||!(!i.rows[0].cells||!i.rows[0].cells.length))){var s=this.parent.serviceLocator.getService(Al);e.clicked?this.forceDelete(a):s.show({height:200,width:400,isModal:!0,showCloseIcon:!0,cssClass:"e-delete-sheet-dlg",content:n.getConstant("DeleteSheetAlert"),beforeOpen:function(e){var t={dialogName:"DeleteSheetDialog",element:e.element,target:e.target,cancel:e.cancel};r.parent.trigger("dialogBeforeOpen",t),t.cancel&&(e.cancel=!0),e.element.querySelector(".e-footer-content .e-primary").setAttribute("aria-label",n.getConstant("DeleteSheetAlert")+" "+n.getConstant("Ok")),Wt(r.parent.element)},buttons:[{buttonModel:{content:n.getConstant("Ok"),isPrimary:!0},click:function(){s.hide(),r.forceDelete(a),r.parent.notify(Bo,null),e&&!e.isAction&&(o.sheetCount=r.parent.sheets.length,r.parent.notify(Yo,{eventArgs:o,action:"removeSheet"}))}}]})}else this.parent.notify(jr,{action:"deleteSheetTab",sheetId:Ce(this.parent,a).id}),this.destroySheet(a),this.parent.notify(Bo,null),e&&!e.isAction&&(o.sheetCount=this.parent.sheets.length,this.parent.notify(Yo,{eventArgs:o,action:"removeSheet"}))}else this.parent.serviceLocator.getService(Al).show({height:180,width:400,isModal:!0,showCloseIcon:!0,content:n.getConstant("DeleteSingleLastSheetAlert"),beforeOpen:function(e){var t={dialogName:"DeleteSingleSheetDialog",element:e.element,target:e.target,cancel:e.cancel};r.parent.trigger("dialogBeforeOpen",t),t.cancel&&(e.cancel=!0)}})}},e.prototype.forceDelete=function(e){this.parent.notify(qs,{}),this.parent.notify(jr,{action:"deleteSheetTab",sheetId:Ce(this.parent,e).id}),this.destroySheet(e)},e.prototype.destroySheet=function(e){var r=t.isNullOrUndefined(e)?this.parent.activeSheetIndex:e;this.parent.removeSheet(r),this.parent.notify(Jr,{sheetIndex:r}),this.dropDownInstance.items.splice(r,1),this.dropDownInstance.setProperties({items:this.dropDownInstance.items},!0),this.tabInstance.removeTab(r);var n=this.parent.skipHiddenSheets(this.tabInstance.selectedItem);this.parent.activeSheetIndex=n,this.parent.setProperties({activeSheetIndex:n},!0),this.parent.renderModule.refreshSheet(),this.tabInstance.selectedItem=n,this.tabInstance.dataBind(),this.updateDropDownItems(n),this.parent.notify(ts,null)},e.prototype.showAggregate=function(){var e=this;if(!E(c(this.parent.getActiveSheet().selectedRange))){var t={Count:0,Sum:"0",Avg:"0",Min:"0",Max:"0",countOnly:!0};if(this.parent.notify(en,t),t.Count>1){this.aggregateContent=t.countOnly?"Count":this.selaggregateCnt,t.countOnly&&(this.aggregateContent="Count",delete t.Sum,delete t.Avg,delete t.Min,delete t.Max);var r=t.countOnly?"e-aggregate-list e-flat e-aggregate-list-countonly e-caret-hide":"e-aggregate-list e-flat";delete t.countOnly;var n=this.aggregateContent,i=n+": "+t[n.toString()];if(this.aggregateDropDown)this.updateAggregateContent(i,t);else{var a=this.parent.createElement("button",{id:this.parent.element.id+"_aggregate",attrs:{type:"button"}});document.getElementById(this.parent.element.id+"_sheet_tab_panel").appendChild(a),this.aggregateDropDown=new h.DropDownButton({content:i,items:this.getAggregateItems(t),createPopupOnClick:!0,select:function(r){e.parent.notify(en,t),e.updateAggregateContent(r.item.text,{Count:t.Count,Sum:t.Sum,Avg:t.Avg,Min:t.Min,Max:t.Max},!0)},beforeOpen:function(t){return e.beforeOpenHandler(e.aggregateDropDown,t.element)},open:function(t){return e.openHandler(e.aggregateDropDown,t.element,"right")},close:function(){return Wt(e.parent.element)},cssClass:r}),this.aggregateDropDown.createElement=this.parent.createElement,this.aggregateDropDown.appendTo(a)}}else this.removeAggregate()}},e.prototype.getAggregateItems=function(e){var t,r,n,i=this,a=[];return Object.keys(e).forEach(function(o){(n=e[""+o])!==en&&(t=o+": "+n,r=o===i.aggregateContent?"e-selected-icon e-icons":"",a.push({text:t,iconCss:r}))}),a},e.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)},e.prototype.removeAggregate=function(){t.isNullOrUndefined(this.aggregateDropDown)||(this.aggregateDropDown.destroy(),t.remove(this.aggregateDropDown.element),this.aggregateDropDown=null)},e.prototype.addEventListener=function(){this.parent.on(ka,this.createSheetTabs,this),this.parent.on(Fa,this.refreshSheetTab,this),this.parent.on(Ya,this.insertSheetTab,this),this.parent.on(Xa,this.removeSheetTab,this),this.parent.on(Ka,this.renameSheetTab,this),this.parent.on(Ga,this.switchSheetTab,this),this.parent.on(So,this.updateSheetTab,this),this.parent.on(Kr,this.removeAggregate,this),this.parent.on(Ua,this.focusRenameInput,this),this.parent.on(Va,this.focusRenameInput,this),this.parent.on(To,this.updateSheetName,this),this.parent.on(Do,this.hideSheet,this),this.parent.on(gs,this.showAggregate,this),this.parent.on(ms,this.goToSheet,this),this.parent.on(vs,this.showSheet,this)},e.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,t.EventHandler.remove(document,"mousedown touchstart",this.renameInputFocusOut);var e=document.getElementById(this.parent.element.id+"_sheet_tab_panel");e&&t.remove(e),this.selaggregateCnt&&(this.selaggregateCnt=null),this.parent=null},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(ka,this.createSheetTabs),this.parent.off(Fa,this.refreshSheetTab),this.parent.off(Ya,this.insertSheetTab),this.parent.off(Xa,this.removeSheetTab),this.parent.off(Ka,this.renameSheetTab),this.parent.off(Ga,this.switchSheetTab),this.parent.off(So,this.updateSheetTab),this.parent.off(Kr,this.removeAggregate),this.parent.off(Ua,this.focusRenameInput),this.parent.off(Va,this.focusRenameInput),this.parent.off(To,this.updateSheetName),this.parent.off(Do,this.hideSheet),this.parent.off(gs,this.showAggregate),this.parent.off(ms,this.goToSheet),this.parent.off(vs,this.showSheet))},e}(),Nh=function(){function e(e){this.isImportedFile=!1,this.unProtectSheetIdx=[],this.parent=e,this.addEventListener(),this.renderFileUpload()}return e.prototype.addEventListener=function(){this.parent.on($r,this.openSuccess,this),this.parent.on(Zr,this.openFailed,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off($r,this.openSuccess),this.parent.off(Zr,this.openFailed))},e.prototype.renderFileUpload=function(){var e=this.parent.element.id+"_fileUpload";this.parent.element.appendChild(this.parent.createElement("input",{id:e,attrs:{type:"file",accept:".xls, .xlsx, .csv, .xlsm, .xlsb",name:"fileUpload"}}));var t=document.getElementById(e);t.onchange=this.fileSelect.bind(this),t.onerror=this.openFailed.bind(this),t.style.display="none"},e.prototype.fileSelect=function(e){var t=e.target.files[0];if(!(t&&t.length<1)){var r={file:t};this.parent.open(r),document.getElementById(this.parent.element.id+"_fileUpload").value=""}},e.prototype.openSuccess=function(e){var t=this,r=["UnsupportedFile","InvalidUrl","NeedPassword","InCorrectPassword","InCorrectSheetPassword","CorrectSheetPassword","DataLimitExceeded","FileSizeLimitExceeded","ExternalWorkbook"],n=function(r){t.parent.serviceLocator.getService(Al).hide(!0);var n=new File([],e.guid,{type:r.toLowerCase()});t.parent.open({file:n,guid:e.guid,password:e.eventArgs.password,orginalFile:e.eventArgs.file})};if(r.indexOf(e.data)>-1){var i=this.parent.serviceLocator.getService(Fl);if(r[2]===e.data)this.parent.element.querySelector(".e-importprotectworkbook-dlg")||this.parent.notify(Js,e.eventArgs);else if(r[3]===e.data){(a=this.parent.createElement("span",{className:"e-importprotectpwd-alert-span"})).innerText=i.getConstant("IncorrectPassword"),this.parent.element.querySelector(".e-importprotectworkbook-dlg").querySelector(".e-dlg-content").appendChild(a)}else if(r[4]===e.data){var a;(a=this.parent.createElement("span",{className:"e-unprotectsheetpwd-alert-span"})).innerText=i.getConstant("IncorrectPassword"),this.parent.element.querySelector(".e-unprotectworksheet-dlg").querySelector(".e-dlg-content").appendChild(a)}else{if(r[5]!==e.data){if(r[8]===e.data){this.parent.serviceLocator.getService(Al).hide(!0);var o=e.data.includes("ExternalWorkbook");return this.parent.serviceLocator.getService(Al).show({content:this.parent.serviceLocator.getService("spreadsheetLocale").getConstant("ExternalWorkbook"),width:"350",buttons:o?[{click:n.bind(this,e.data+"Yes"),buttonModel:{content:i.getConstant("Yes"),isPrimary:!0}},{click:n.bind(this,e.data+"No"),buttonModel:{content:i.getConstant("No")}}]:[],beforeOpen:function(e){var r={dialogName:"OpenDialog",element:e.element,target:e.target,cancel:e.cancel};t.parent.trigger("dialogBeforeOpen",r),r.cancel&&(e.cancel=!0)}},!!o||null),void this.parent.hideSpinner()}this.parent.serviceLocator.getService(Al).hide(!0);var s=e.data.includes("LimitExceeded");return this.parent.serviceLocator.getService(Al).show({content:this.parent.serviceLocator.getService("spreadsheetLocale").getConstant(e.data),width:"300",buttons:s?[{click:n.bind(this,e.data+"Open"),buttonModel:{content:i.getConstant("Ok"),isPrimary:!0}},{click:n.bind(this,e.data+"Cancel"),buttonModel:{content:i.getConstant("Cancel")}}]:[],beforeOpen:function(e){var r={dialogName:"OpenDialog",element:e.element,target:e.target,cancel:e.cancel};t.parent.trigger("dialogBeforeOpen",r),r.cancel&&(e.cancel=!0)}},!!s||null),void this.parent.hideSpinner()}this.parent.isOpen=!1,this.parent.notify(hl,null);this.parent.serviceLocator.getService(Al).hide(),this.parent.hideSpinner()}}else{this.parent.serviceLocator.getService(Al).hide(),this.parent.showSpinner()}this.parent.element&&r[5]!==e.data&&(e.isOpenFromJson||(this.parent.trigger("openComplete",{response:e}),this.parent.notify(Yo,{response:e,action:"import"})),this.parent.notify(on,{cellRef:null,isOpen:!0}),this.parent.isProtected&&this.parent.showSheetTabs&&e.isOpenFromJson&&(this.parent.element.querySelector(".e-add-sheet-tab").setAttribute("disabled","true"),this.parent.element.querySelector(".e-add-sheet-tab").classList.add("e-disabled")),this.parent.renderModule.refreshSheet(e.isOpenFromJson,!1,!1,!1,e),this.parent.notify(Fa,null),this.isImportedFile=!0,this.preventFormatCheck=e.eventArgs&&e.eventArgs.file&&e.eventArgs.file.name&&!e.eventArgs.file.name.includes(".csv"),this.unProtectSheetIdx=[],this.parent.hideSpinner())},e.prototype.openFailed=function(e){this.parent.trigger("openFailure",e),this.parent.hideSpinner()},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.getModuleName=function(){return"open"},e}(),Oh=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.addEventListener=function(){this.parent.on(Fr,this.initiateSave,this),this.parent.on(Lr,this.saveCompleted,this),this.parent.on(si,this.showErrorDialog,this),this.parent.on(Tr,this.exportDialog,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(Fr,this.initiateSave),this.parent.off(Lr,this.saveCompleted),this.parent.off(si,this.showErrorDialog),this.parent.off(Tr,this.exportDialog))},e.prototype.getModuleName=function(){return"save"},e.prototype.initiateSave=function(){this.parent.showSpinner()},e.prototype.saveCompleted=function(){this.parent.hideSpinner()},e.prototype.showErrorDialog=function(e){var t=this;this.parent.serviceLocator.getService(Al).show({isModal:!0,showCloseIcon:!0,height:180,width:400,content:e.content,beforeOpen:function(){return Wt(t.parent.element)}})},e.prototype.exportDialog=function(e){var r=this,n=this.parent.serviceLocator.getService(Fl),i=this.parent.serviceLocator.getService(Al),a=e?e.item.id.split(this.parent.element.id+"_")[1]:"xlsx";if(t.isNullOrUndefined(this.parent.element.querySelector(".e-find-dlg"))){var o={isModal:!0,showCloseIcon:!0,cssClass:"e-open-dlg",header:n.getConstant("SaveAs"),beforeOpen:function(e){var t={dialogName:n.getConstant("SaveAs"),element:e.element,target:e.target,cancel:e.cancel};r.parent.trigger("dialogBeforeOpen",t),t.cancel&&(e.cancel=!0),i.dialogInstance.content=r.OpenContent(a),i.dialogInstance.dataBind(),r.parent.element.querySelector(".e-text-open").setSelectionRange(0,r.parent.element.querySelector(".e-text-open").value.length),Wt(r.parent.element)},buttons:[{buttonModel:{content:n.getConstant("Save"),isPrimary:!0,cssClass:"e-btn-open-ok"},click:function(){var n=r.parent.element.querySelector(".e-text-open").value;if(r.checkValidName(n)){i.hide();var a=e?e.item.id.split(r.parent.element.id+"_")[1]:"Xlsx";r.parent.save({saveType:a,fileName:n})}else{var o=r.parent.element.querySelector(".e-btn-open-ok");t.getComponent(o,"btn").disabled=!0;var s=r.parent.serviceLocator.getService(Fl),l=0===n.length?s.getConstant("EmptyFileName"):n.length>218?s.getConstant("LargeName"):s.getConstant("FileNameError"),h=r.parent.createElement("span",{className:"e-file-alert-span"});h.innerText=l,r.parent.element.querySelector(".e-file-alert-span")&&r.parent.element.querySelector(".e-file-alert-span").remove(),r.parent.element.querySelector(".e-open-dlg").querySelector(".e-dlg-content").appendChild(h)}}}],close:function(){i.hide()}};i.show(o)}else i.hide()},e.prototype.checkValidName=function(e){var t=!0;return(e.match(new RegExp('.*[\\[\\]\\*\\\\/\\?\\:\\<\\>\\|\\"].*'))||e.length<1||e.length>218)&&(t=!1),t},e.prototype.OpenContent=function(e){var r=this,n=this.parent.serviceLocator.getService(Fl),i=this.parent.createElement("div",{className:"e-open-dialog"}),a=this.parent.createElement("div",{className:"e-open-head"}),o=this.parent.createElement("div",{className:"e-input-group"});i.appendChild(a),i.appendChild(o);var s=n.getConstant("FileName"),l=this.parent.element.id+"_filename",h=this.parent.createElement("p",{className:"e-header",id:l,attrs:{"aria-label":n.getConstant("SaveAs")+" "+s}});h.innerText=s;var d=this.parent.createElement("input",{className:"e-input e-text-open",attrs:{type:"Text","aria-labelledby":l}}),p=this.parent.createElement("span",{className:"e-input-group-icon"});return d.onkeyup=function(e){if(r.parent.element.querySelector(".e-file-alert-span")&&13!==e.keyCode){var n=r.parent.element.querySelector(".e-btn-open-ok");t.getComponent(n,"btn").disabled=!1,r.parent.element.querySelector(".e-file-alert-span").remove()}},a.appendChild(h),p.textContent="."+e.toLowerCase(),o.appendChild(d),d.setAttribute("value","Sample"),o.appendChild(p),i},e}(),Th=function(){function e(e){this.parent=e,this.init()}return e.prototype.init=function(){this.initContextMenu(),this.addEventListener()},e.prototype.initContextMenu=function(){var e=document.createElement("ul");e.id=this.parent.element.id+"_contextmenu",this.parent.element.appendChild(e),this.contextMenuInstance=new i.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")},e.prototype.beforeCloseHandler=function(e){var t=this;this.parent.trigger("contextMenuBeforeClose",e),this.parent.enableKeyboardShortcut&&e.event&&27===e.event.keyCode&&tt(function(){return Wt(t.parent.element)})},e.prototype.selectHandler=function(e){var r=t.extend({cancel:!1},e);this.parent.trigger("contextMenuItemSelect",r);var n=this.parent.element.id+"_cmenu",i=[];if(this.parent.sortCollection)for(var a=this.parent.sortCollection.length-1;a>=0;a--)this.parent.sortCollection[a]&&this.parent.sortCollection[a].sheetIndex===this.parent.activeSheetIndex&&(i.push(this.parent.sortCollection[a]),this.parent.sortCollection.splice(a,1));var o;if(!r.cancel){var s=void 0;switch(e.item.id){case n+"_cut":this.parent.notify(to,{invokeCopy:!0,promise:Promise});break;case n+"_copy":this.parent.notify(ro,{invokeCopy:!0,promise:Promise});break;case n+"_paste":this.parent.notify(no,{isAction:!0,isInternal:!0,focus:!0});break;case n+"_pastevalues":this.parent.notify(no,{type:"Values",isAction:!0,isInternal:!0,focus:!0});break;case n+"_pasteformats":this.parent.notify(no,{type:"Formats",isAction:!0,isInternal:!0,focus:!0});break;case n+"_rename":this.parent.notify(Ka,{});break;case n+"_delete_sheet":this.parent.notify(Xa,{}),Wt(this.parent.element);break;case n+"_insert_sheet":this.parent.notify(Sn,{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(Do,{sheetIndex:this.parent.activeSheetIndex,triggerEvent:!0});break;case n+"_duplicate":Ee(this.parent,void 0,!0),Wt(this.parent.element);break;case n+"_move_right":Ie(this.parent,this.parent.activeSheetIndex+1,null,!0),Wt(this.parent.element);break;case n+"_move_left":Ie(this.parent,this.parent.activeSheetIndex-1,null,!0),Wt(this.parent.element);break;case n+"_ascending":this.parent.notify(zo,{sortOptions:{sortDescriptors:{order:"Ascending"}}}),this.parent.notify(Io,{sortOptions:{sortDescriptors:{order:"Ascending"}},previousSort:i});break;case n+"_descending":this.parent.notify(zo,{sortOptions:{sortDescriptors:{order:"Descending"}}}),this.parent.notify(Io,{sortOptions:{sortDescriptors:{order:"Descending"}},previousSort:i});break;case n+"_customsort":this.parent.notify(wo,null);break;case n+"_filtercellvalue":this.parent.notify(qo,null);break;case n+"_clearfilter":o=v(u(this.parent.getActiveSheet().activeCell)[1]+1),this.parent.notify(Wo,{field:o});break;case n+"_reapplyfilter":this.parent.notify(jo,null);break;case n+"_hide_row":s=c(this.parent.getActiveSheet().selectedRange),this.parent.notify(Gn,{startIndex:s[0],endIndex:s[2],hide:!0,isCol:!1,actionUpdate:!0});break;case n+"_unhide_row":s=c(this.parent.getActiveSheet().selectedRange),this.parent.notify(Gn,{startIndex:s[0],endIndex:s[2],hide:!1,isCol:!1,actionUpdate:!0});break;case n+"_hide_column":s=c(this.parent.getActiveSheet().selectedRange),this.parent.notify(Gn,{startIndex:s[1],endIndex:s[3],hide:!0,isCol:!0,actionUpdate:!0});break;case n+"_unhide_column":s=c(this.parent.getActiveSheet().selectedRange),this.parent.notify(Gn,{startIndex:s[1],endIndex:s[3],hide:!1,isCol:!0,actionUpdate:!0});break;case n+"_insert_row_above":case n+"_delete_row":s=c(this.parent.getActiveSheet().selectedRange),this.parent.notify(e.item.id.substr(n.length+1,6)+"Model",{model:this.parent.getActiveSheet(),start:s[0],end:s[2],modelType:"Row",isAction:!0,insertType:"above"});break;case n+"_insert_row_below":s=w(c(this.parent.getActiveSheet().selectedRange)),this.parent.notify(Sn,{model:this.parent.getActiveSheet(),start:s[2]+1,end:s[2]+1+(s[2]-s[0]),modelType:"Row",isAction:!0,insertType:"below"});break;case n+"_insert_column_before":case n+"_delete_column":s=c(this.parent.getActiveSheet().selectedRange),this.parent.notify(e.item.id.substr(n.length+1,6)+"Model",{model:this.parent.getActiveSheet(),start:s[1],end:s[3],modelType:"Column",isAction:!0,insertType:"before"});break;case n+"_insert_column_after":s=w(c(this.parent.getActiveSheet().selectedRange)),this.parent.notify(Sn,{model:this.parent.getActiveSheet(),start:s[3]+1,end:s[3]+1+(s[3]-s[1]),modelType:"Column",isAction:!0,insertType:"after"});break;case n+"_hyperlink":this.parent.notify(ko,null);break;case n+"_editHyperlink":this.parent.notify(Fo,null);break;case n+"_openHyperlink":this.parent.notify(Ao,null);break;case n+"_removeHyperlink":this.parent.notify(No,{range:this.parent.getActiveSheet().selectedRange});break;case n+"_protect":this.parent.notify(ml,{})}}},e.prototype.getInsertModel=function(e,t){for(var r=[],n=e;n<=t;n++)n===e?r.push({index:n}):r.push({});return r},e.prototype.beforeOpenHandler=function(e){var r,n=e.event.target,i=this.getTarget(n);if(e.element.classList.contains("e-contextmenu")){var a=this.parent.getActiveSheet();if(e.event.target&&(n.classList.contains("e-rowresize")||n.classList.contains("e-colresize"))){var o=c(a.selectedRange);if(!(n.classList.contains("e-rowresize")?0===o[1]&&o[3]===a.colCount-1:0===o[0]&&o[2]===a.rowCount-1))return void(e.cancel=!0);r=(n.classList.contains("e-rowresize")?this.parent.hiddenCount(o[0],o[2])!==Math.abs(o[2]-o[0])+1:this.parent.hiddenCount(o[1],o[3],"columns")!==Math.abs(o[3]-o[1])+1)?this.getDataSource(i):this.getDataSource(i,n)}else{if("Content"===i){var s=0===(o=c(a.selectedRange))[1]&&o[3]===a.colCount-1,l=0===o[0]&&o[2]===a.rowCount-1;i=s&&l?"SelectAll":s?"RowHeader":l?"ColumnHeader":"Content"}r=this.getDataSource(i)}this.contextMenuInstance.items=r,this.contextMenuInstance.dataBind()}else r=e.items;if("None"===this.parent.selectionSettings.mode&&"Content"===i&&this.parent.enableContextMenuItems(["Filter"],!1,!1),"ColumnHeader"===i||"RowHeader"===i){if(e.element&&e.element.childElementCount>0){var h="ColumnHeader"===i?e.element.querySelector("#"+this.parent.element.id+"_cmenu_insert_column"):e.element.querySelector("#"+this.parent.element.id+"_cmenu_insert_row"),d="ColumnHeader"===i?e.element.querySelector("#"+this.parent.element.id+"_cmenu_delete_column"):e.element.querySelector("#"+this.parent.element.id+"_cmenu_delete_row");this.parent.allowInsert&&h.classList.contains("e-disabled")?h.classList.remove("e-disabled"):this.parent.allowInsert&&!this.parent.element.querySelector(".e-selectall.e-highlight")||h.classList.contains("e-disabled")||h.classList.add("e-disabled"),this.parent.allowDelete&&d.classList.contains("e-disabled")?d.classList.remove("e-disabled"):this.parent.allowDelete||d.classList.contains("e-disabled")||d.classList.add("e-disabled"),"None"===this.parent.selectionSettings.mode&&("ColumnHeader"===i&&this.parent.enableContextMenuItems(["Insert Column","Delete Column","Hide Column"],!1,!1),"RowHeader"===i&&this.parent.enableContextMenuItems(["Insert Row","Delete Row","Hide Row"],!1,!1))}}else if("Footer"===i){var p=ce(this.parent,n.textContent);0===p&&e.element.querySelector("#"+this.parent.element.id+"_cmenu_move_left").classList.add("e-disabled"),p===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(Ga,t.extend(e,{target:i,items:r}))},e.prototype.getTarget=function(e){return t.closest(e,".e-sheet-content")?"Content":t.closest(e,".e-column-header")?e.classList.contains("e-header-cell")?"ColumnHeader":"Content":t.closest(e,".e-row-header")?e.classList.contains("e-header-cell")?"RowHeader":"Content":t.closest(e,".e-sheet-tabs-items")?"Footer":t.closest(e,".e-selectall-container")?e.classList.contains("e-header-cell")?t.closest(e,".e-header-row")?"ColumnHeader":"RowHeader":t.closest(e,".e-select-all-cell")?"SelectAll":"Content":""},e.prototype.getDataSource=function(e,t){var r=this.parent.serviceLocator.getService(Fl),n=[],i=this.parent.element.id+"_cmenu";if("Content"===e)this.setClipboardData(n,r,i),n.push({separator:!0}),this.setFilterItems(n,i),this.setSortItems(n,i),n.push({separator:!0}),this.setHyperLink(n,i);else if("RowHeader"===e){this.setClipboardData(n,r,i);var a=c(this.parent.getActiveSheet().selectedRange);this.setInsertDeleteItems(n,r,"Row",i,[a[0],a[2]],["Above","Below"]),t&&!t.classList.contains("e-rowresize")&&t.parentElement&&t.parentElement.classList.value.includes("e-hide")||this.setHideShowItems(n,r,"Row",i,[a[0],a[2]])}else if("ColumnHeader"===e){this.setClipboardData(n,r,i);a=c(this.parent.getActiveSheet().selectedRange);this.setInsertDeleteItems(n,r,"Column",i,[a[1],a[3]],["Before","After"]),t&&t.classList.value.includes("e-hide")||this.setHideShowItems(n,r,"Column",i,[a[1],a[3]])}else"SelectAll"===e?(this.setClipboardData(n,r,i),this.setFilterItems(n,i),this.setSortItems(n,i)):"Footer"===e&&(n.push({text:r.getConstant("Insert"),id:i+"_insert_sheet"}),n.push({text:r.getConstant("Delete"),iconCss:"e-icons e-delete",id:i+"_delete_sheet"}),n.push({text:r.getConstant("DuplicateSheet"),id:i+"_duplicate"}),n.push({text:r.getConstant("Rename"),id:i+"_rename"}),n.push({text:r.getConstant("Hide"),id:i+"_hide_sheet"}),this.setProtectSheetItems(n,i),n.push({text:r.getConstant("MoveRight"),id:i+"_move_right"}),n.push({text:r.getConstant("MoveLeft"),id:i+"_move_left"}));return n},e.prototype.setProtectSheetItems=function(e,t){var r=this.parent.serviceLocator.getService(Fl);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"})},e.prototype.setFilterItems=function(e,t){if(this.parent.allowFiltering){var r=this.parent.serviceLocator.getService(Fl),n={clearFilterText:null,isFiltered:!1};this.parent.notify(Go,n),e.push({text:r.getConstant("Filter"),id:t+"_filter",iconCss:"",items:[{text:n.clearFilterText,iconCss:"e-icons e-filter-clear",id:t+"_clearfilter"},{text:r.getConstant("ReapplyFilter"),iconCss:"e-icons e-filter-reapply",id:t+"_reapplyfilter"},{separator:!0},{text:r.getConstant("FilterCellValue"),iconCss:"",id:t+"_filtercellvalue"}]})}},e.prototype.setSortItems=function(e,t){var r=this.parent.serviceLocator.getService(Fl);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"}]})},e.prototype.setHyperLink=function(e,t){this.parent.getActiveSheet();if(this.parent.allowHyperlink){var r=this.parent.serviceLocator.getService(Fl);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"})}},e.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"}]}))},e.prototype.setInsertDeleteItems=function(e,t,r,n,i,a){e.push({separator:!0}),["Insert","Delete"].forEach(function(o){i[0]===i[1]?e.push({text:t.getConstant(""+o+r),id:n+"_"+o.toLowerCase()+"_"+r.toLowerCase()}):e.push({text:t.getConstant(""+o+r+"s"),id:n+"_"+o.toLowerCase()+"_"+r.toLowerCase()}),"Insert"===o&&(e[e.length-1].items=[],a.forEach(function(r){e[e.length-1].items.push({text:t.getConstant(r),id:e[e.length-1].id+"_"+r.toLowerCase()})}))})},e.prototype.setHideShowItems=function(e,t,r,n,i){if(i[0]===i[1])e.push({text:t.getConstant("Hide"+r),id:n+"_hide_"+r.toLowerCase()});else{var a=i[0];i[0]=i[0]>i[1]?i[1]:i[0],i[1]=i[1]>a?i[1]:a,e.push({text:t.getConstant("Hide"+r+"s"),id:n+"_hide_"+r.toLowerCase()})}this.parent.hiddenCount(i[0],i[1],r.toLowerCase()+"s")&&e.push({text:t.getConstant("Unhide"+r+"s"),id:n+"_unhide_"+r.toLowerCase()})},e.prototype.addEventListener=function(){this.parent.on(ao,this.addItemsHandler,this),this.parent.on(oo,this.removeItemsHandler,this),this.parent.on(so,this.enableItemsHandler,this)},e.prototype.addItemsHandler=function(e){e.insertAfter?this.contextMenuInstance.insertAfter(e.items,e.text,e.isUniqueId):this.contextMenuInstance.insertBefore(e.items,e.text,e.isUniqueId)},e.prototype.removeItemsHandler=function(e){this.contextMenuInstance.removeItems(e.items,e.isUniqueId)},e.prototype.enableItemsHandler=function(e){this.contextMenuInstance.enableItems(e.items,e.enable,e.isUniqueId)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(ao,this.addItemsHandler),this.parent.off(oo,this.removeItemsHandler),this.parent.off(so,this.enableItemsHandler))},e.prototype.getModuleName=function(){return"contextMenu"},e.prototype.destroy=function(){this.removeEventListener(),this.contextMenuInstance.destroy();var e=document.getElementById(this.parent.element.id+"_contextmenu");e&&t.detach(e),this.contextMenuInstance=null,this.parent=null},e}(),Dh=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.refreshCellElement=function(e){e.cellEle&&this.parent.refreshNode(e.cellEle,e)},e.prototype.getTextSpace=function(e){e.width=Bt(e.char,e.cell.style,this.parent.cellStyle)},e.prototype.rowFillHandler=function(e){var t=e.cellEle;if(t){var r=Bt(e.repeatChar,e.cell.style,this.parent.cellStyle),n=e.colIdx;if(e.cell.colSpan>1){var i={range:[e.rowIdx,e.colIdx,e.rowIdx,e.colIdx]};this.parent.notify(qn,i),n=i.range[3]}var a=_t(this.parent.getActiveSheet(),e.rowIdx,e.colIdx,n);t.innerText="",e.beforeFillText&&(t.innerText=e.beforeFillText,a-=Bt(e.beforeFillText,e.cell.style,this.parent.cellStyle));var o=this.parent.createElement("span",{className:"e-fill"});if(t.appendChild(o),e.afterFillText){var s=this.parent.createElement("span",{className:"e-fill-sec"});s.innerText=e.afterFillText,t.appendChild(s),a-=Bt(e.afterFillText,e.cell.style,this.parent.cellStyle)}var l=parseInt((a/r).toString(),10);e.formattedText=l>0?e.repeatChar.repeat(l):"",o.textContent=e.formattedText}},e.prototype.addEventListener=function(){this.parent.on(Hr,this.refreshCellElement,this),this.parent.on(vi,this.rowFillHandler,this),this.parent.on(yi,this.getTextSpace,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(Hr,this.refreshCellElement),this.parent.off(vi,this.rowFillHandler),this.parent.off(yi,this.getTextSpace))},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.getModuleName=function(){return"numberFormat"},e}(),Lh=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.addEventListener=function(){this.parent.on(Io,this.applySortHandler,this),this.parent.on(dn,this.sortCompleteHandler,this),this.parent.on(wo,this.initiateCustomSortHandler,this),this.parent.on(Nr,this.sortImport,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(Io,this.applySortHandler),this.parent.off(dn,this.sortCompleteHandler),this.parent.off(wo,this.initiateCustomSortHandler),this.parent.off(Nr,this.sortImport))},e.prototype.getModuleName=function(){return"sort"},e.prototype.isValidSortRange=function(){var e=this.parent.getActiveSheet(),t=w(y(e.selectedRange));return!(t[0]>e.usedRange.rowIndex||t[1]>e.usedRange.colIndex)},e.prototype.sortImport=function(e){for(var t,r=this.parent.sortCollection,n=this.parent.getActiveSheet().usedRange.rowIndex-1,i=e?e.sheetIdx:this.parent.activeSheetIndex,a=0;a<r.length;a++)if(r[a].sheetIndex===i)for(var o=0;o<n;o++)if((t=this.parent.getCell(o,r[a].columnIndex))&&t.querySelector(".e-filter-icon"))return void("Ascending"===r[a].order||"OnTop"===r[a].order?t.querySelector(".e-filter-icon").classList.contains("e-sortasc-filter")||t.querySelector(".e-filter-icon").classList.add("e-sortasc-filter"):t.querySelector(".e-filter-icon").classList.contains("e-sortdesc-filter")||t.querySelector(".e-filter-icon").classList.add("e-sortdesc-filter"))},e.prototype.sortRangeAlertHandler=function(e){var t=this,r=this.parent.serviceLocator.getService(Al),n=this.parent.serviceLocator.getService(Fl);r.show({height:180,width:400,isModal:!0,showCloseIcon:!0,content:e.error,beforeOpen:function(i){var a={dialogName:e.error===n.getConstant("MultiRangeSortError")?"MultiRangeSortDialog":"SortRangeDialog",content:e.error,element:i.element,target:i.target,cancel:i.cancel};t.parent.trigger("dialogBeforeOpen",a),a.cancel?i.cancel=!0:Wt(t.parent.element),r.dialogInstance.content=a.content}}),this.parent.hideSpinner()},e.prototype.initiateCustomSortHandler=function(){var e=this,r=this.parent.serviceLocator.getService(Fl),n=this.parent.getActiveSheet();if(this.isValidSortRange()&&0!==n.rows.length)if(Yt(n.selectedRange))this.sortRangeAlertHandler({error:r.getConstant("MultiRangeSortError")});else{var i,a=this.parent.serviceLocator.getService(Al);a.show({height:400,width:560,isModal:!0,showCloseIcon:!0,cssClass:"e-customsort-dlg",header:r.getConstant("CustomSort"),beforeOpen:function(t){var r={dialogName:"CustomSortDialog",element:t.element,target:t.target,cancel:t.cancel};e.parent.trigger("dialogBeforeOpen",r),r.cancel&&(t.cancel=!0),a.dialogInstance.content=e.customSortContent(),a.dialogInstance.dataBind(),Wt(e.parent.element)},buttons:[{buttonModel:{content:r.getConstant("Ok"),isPrimary:!0},click:function(){var r=a.dialogInstance.content,n=t.getComponent(r.getElementsByClassName("e-list-sort e-listview e-lib")[0],"listview").dataSource;e.clearError();var o=r.getElementsByClassName("e-sort-error")[0];o.style.display="block",e.validateError(n,r,o)||(i={sortDescriptors:n,containsHeader:r.getElementsByClassName("e-sort-checkheader")[0].checked,caseSensitive:r.getElementsByClassName("e-sort-checkcase")[0].checked},a.hide())}}],close:function(){i&&tt(function(){return e.applySortHandler({sortOptions:i})})}})}else this.sortRangeAlertHandler({error:r.getConstant("SortOutOfRangeError")})},e.prototype.validateError=function(e,r,n){var i=this.parent.serviceLocator.getService(Fl);if(e.some(function(e){return""===e.field.toString()}))return Array.prototype.some.call(r.getElementsByClassName("e-sort-field"),function(e){var r=!t.getComponent(e,"dropdownlist").value;return r&&e.parentElement.classList.add("e-error"),r}),n.innerText=i.getConstant("SortEmptyFieldError"),!0;var a=new Set,o="",s="";if(e.some(function(e){return o=e.field.toString(),a.size===a.add(e.field).size})){var l=0;Array.prototype.some.call(r.getElementsByClassName("e-sort-field"),function(e){var r=t.getComponent(e,"dropdownlist");return r.value===o&&(e.parentElement.classList.add("e-error"),s=r.text,l++),2===l}),n.innerText="";var h=this.parent.createElement("strong");return h.innerText=s,n.appendChild(h),n.appendChild(document.createTextNode(i.getConstant("SortDuplicateFieldError"))),!0}return!1},e.prototype.customSortContent=function(){var e=this.parent.createElement("div",{className:"e-sort-dialog"}),r=this.getFields(),n=t.getUniqueID("customSort"),i=this.getCustomListview(n);this.setHeaderTab(e,i,r);var a=this.parent.createElement("div",{className:"e-sort-listsection",styles:""});e.appendChild(a);var o=this.parent.createElement("div",{className:"e-list-sort",styles:""});a.appendChild(o),i.createElement=this.parent.createElement,i.appendTo(o),o.removeAttribute("tabindex"),this.renderListItem(n,i,!0,r);var s=this.parent.createElement("div",{className:"e-sort-error"});return e.appendChild(s),e},e.prototype.getFields=function(){var e=this.parent.getActiveSheet(),t=w(y(e.selectedRange));if(t[0]===t[2]&&t[2]-t[0]==0){t[0]=0,t[1]=0,t[3]=e.usedRange.colIndex;var r={filterRange:[],hasFilter:!1};this.parent.notify(Ko,r),r.hasFilter&&r.filterRange&&(t[0]=r.filterRange[0])}var n,i,a=[];for(t[1];t[1]<=t[3];t[1]++){var o=Re(t[0],t[1],e);if(i="Column "+v(t[1]+1),o&&o.value){if(n=o.value,o.format){var s={formattedText:n,value:n,format:o.format,rowIndex:t[0],colIndex:t[1]};this.parent.notify(Mr,s),n=s.formattedText}}else n=i;a.push({text:n,value:i})}return a},e.prototype.setHeaderTab=function(e,r,n){var i=this,a=this.parent.serviceLocator.getService(Fl),s=this.parent.createElement("div",{className:"e-sort-header"});e.appendChild(s);var l=this.parent.createElement("button",{className:"e-btn e-sort-addbtn e-flat",attrs:{type:"button"}});l.innerText=a.getConstant("AddColumn");var h=this.parent.element.querySelector(".e-customsort-dlg .e-footer-content");h.insertBefore(l,h.firstElementChild),l.addEventListener("click",function(){if(r){var e=t.getUniqueID("customSort");r.addItem([{id:e,text:a.getConstant("ThenBy"),field:"",order:"ascending"}]),i.renderListItem(e,r,d.checked,n,!0)}});var d=new o.CheckBox({label:a.getConstant("ContainsHeader"),checked:!0,change:function(r){var i=r.checked?{text:"text",value:"value"}:{text:"value"};Array.prototype.forEach.call(e.getElementsByClassName("e-sort-field e-dropdownlist e-lib"),function(e){var r=t.getComponent(e,"dropdownlist");r.dataSource=null,r.dataSource=n,r.fields=i,r.dataBind()})},cssClass:"e-sort-headercheckbox"}),p=this.parent.createElement("input",{className:"e-sort-checkheader",attrs:{type:"checkbox"}});s.appendChild(p),d.createElement=this.parent.createElement,d.appendTo(p);var c=new o.CheckBox({label:a.getConstant("CaseSensitive"),checked:!1,cssClass:"e-sort-casecheckbox"}),u=this.parent.createElement("input",{className:"e-sort-checkcase",attrs:{type:"checkbox"}});s.appendChild(u),c.createElement=this.parent.createElement,c.appendTo(u)},e.prototype.getCustomListview=function(e){var r=[{id:e,text:this.parent.serviceLocator.getService(Fl).getConstant("SortBy"),field:"",order:"ascending"}];t.enableRipple(!1);return new l.ListView({dataSource:r,fields:{id:"id"},height:"100%",template:t.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"})},e.prototype.deleteHandler=function(e,t){e.getElementsByClassName("e-sort-delete")[0].addEventListener("click",function(){e&&t.removeItem(e)})},e.prototype.renderListItem=function(e,t,r,n,i){var a=this,l=this.parent.serviceLocator.getService(Fl),h=t.element.querySelector("li[data-uid="+e+"]"),d=r?{text:"text",value:"value"}:{text:"value"},p=h.getElementsByClassName("e-sort-field")[0],c=new s.DropDownList({dataSource:n,width:"auto",cssClass:"e-sort-field-ddl",fields:d,placeholder:l.getConstant("SelectAColumn"),change:function(r){r.value&&(Array.prototype.some.call(t.dataSource,function(t){return t.id===e&&(t.field=r.value.toString().replace("Column ","")),t.id===e}),a.clearError())}});c.createElement=this.parent.createElement,c.appendTo(p),i||(c.index=0);var u=h.getElementsByClassName("e-sort-order")[0],f="ascending"===u.getElementsByClassName("e-sort-ordertxt")[0].innerText.toLocaleLowerCase(),g=new o.RadioButton({label:l.getConstant("SortAscending"),name:"sortAZ_"+e,value:"ascending",checked:f,cssClass:"e-sort-radiobutton",change:function(r){a.setRadioBtnValue(t,e,r.value)}}),m=this.parent.createElement("input",{id:"orderAsc_"+e,className:"e-sort-radioasc",styles:"",attrs:{type:"radio"}});u.appendChild(m),g.createElement=this.parent.createElement,g.appendTo(m);var v=new o.RadioButton({label:l.getConstant("SortDescending"),name:"sortAZ_"+e,value:"descending",checked:!f,cssClass:"e-sort-radiobutton",change:function(r){a.setRadioBtnValue(t,e,r.value)}}),y=this.parent.createElement("input",{id:"orderDesc_"+e,className:"e-sort-radiodesc",styles:"",attrs:{type:"radio"}});u.appendChild(y),v.createElement=this.parent.createElement,v.appendTo(y),this.deleteHandler(h,t)},e.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})},e.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")}))},e.prototype.applySortHandler=function(e){var t=this,r=this.parent.getActiveSheet(),n=e&&e.range||r.selectedRange,i=w(y(n)),a=e&&e.sortOptions||{sortDescriptors:{}},o=i[0]===i[2],s={filterRange:[],hasFilter:!1,sheetIdx:this.parent.activeSheetIndex};this.parent.notify(Ko,s),s.hasFilter&&(o?j(s.filterRange,i[0],i[1]):s.filterRange[0]===i[0]&&(this.parent.element.querySelector(".e-selectall.e-highlight")||i[1]>=s.filterRange[1]&&i[1]<=s.filterRange[3]||i[3]>=s.filterRange[1]&&i[3]<=s.filterRange[3]))&&(i[0]=s.filterRange[0],i[1]=s.filterRange[1],i[2]=r.usedRange.rowIndex,i[3]=r.usedRange.colIndex,a.containsHeader=!s.allowHeaderFilter,o=!1);var l={range:n=m(i),sortOptions:a,cancel:!1};if(this.parent.trigger("beforeSort",l),!l.cancel){this.parent.notify(Ar,{eventArgs:l,action:"beforeSort"}),this.parent.showSpinner();var h=new Promise(function(e,t){e(void 0)}),d={args:{range:l.range,sortOptions:l.sortOptions,checkForHeader:o&&n!==l.range},promise:h,previousSort:e&&e.previousSort};this.parent.notify(ln,d),d.promise.then(function(e){return t.sortCompleteHandler(e),t.parent.trigger(dn,e),t.parent.notify(Yo,{eventArgs:e,action:"sorting"}),"BODY"===document.activeElement.tagName&&Wt(t.parent.element),Promise.resolve(e)}).catch(function(e){return t.sortRangeAlertHandler({error:e}),Promise.reject(e)})}},e.prototype.sortCompleteHandler=function(e){var t,r,n=this.parent.activeSheetIndex;if(e.range.includes("!")){var i=e.range.split("!");n=ce(this.parent,i[0]),t=Ce(this.parent,n),r=c(i[1])}else t=this.parent.getActiveSheet(),r=c(e.range);for(var a=r[0];a<=r[2];a++)for(var o=r[1];o<=r[3];o++)this.parent.notify(jr,{action:"refreshCalculate",rowIndex:a,colIndex:o});this.parent.serviceLocator.getService("cell").refreshRange(r,!0,!0,!1,!1,Kt(this.parent)),n===this.parent.activeSheetIndex&&t.conditionalFormats&&t.conditionalFormats.length&&this.parent.notify(Xn,{indexes:r}),this.parent.hideSpinner(),this.parent.notify(_o,null)},e}(),Ph=function(){function e(e){this.parent=e,this.filterCollection=new Map,this.filterRange=new Map,this.filterBtn=e.createElement("div",{className:"e-filter-btn e-control e-btn e-lib e-filter-iconbtn e-icon-btn"}),this.filterBtn.appendChild(e.createElement("span",{className:"e-btn-icon e-icons e-filter-icon"})),this.addEventListener()}return e.prototype.destroy=function(){var e=this;this.removeEventListener(),this.parent.refreshing&&this.filterRange.size&&(this.parent.filterCollection=[],this.filterRange.forEach(function(t,r){e.setFilteredCollection({sheetIdx:r,saveJson:{filterCollection:e.parent.filterCollection}})})),this.filterRange=null,this.filterCollection=null,this.filterBtn&&this.filterBtn.remove(),this.filterBtn=null,this.treeViewObj&&this.treeViewObj.destroy(),this.treeViewObj=null,this.treeViewEle&&this.treeViewEle.remove(),this.treeViewEle=null,this.cBox&&(this.cBox.remove(),this.cBox=null),this.parent=null},e.prototype.addEventListener=function(){this.parent.on(vn,this.filterRangeAlertHandler,this),this.parent.on(Uo,this.initiateFilterUIHandler,this),this.parent.on(Oa,this.filterMouseDownHandler,this),this.parent.on(Vo,this.renderFilterCellHandler,this),this.parent.on(_o,this.refreshFilterRange,this),this.parent.on(zo,this.updateSortCollectionHandler,this),this.parent.on(d.beforeFltrcMenuOpen,this.beforeFilterMenuOpenHandler,this),this.parent.on(d.filterCmenuSelect,this.closeDialog,this),this.parent.on(jo,this.reapplyFilterHandler,this),this.parent.on(qo,this.filterByCellValueHandler,this),this.parent.on(Wo,this.clearFilterHandler,this),this.parent.on(Go,this.getFilteredColumnHandler,this),this.parent.on(Ga,this.cMenuBeforeOpenHandler,this),this.parent.on(d.filterCboxValue,this.filterCboxValueHandler,this),this.parent.on(Ko,this.getFilterRangeHandler,this),this.parent.on(Xo,this.filterCellKeyDownHandler,this),this.parent.on(Dr,this.setFilteredCollection,this),this.parent.on(Na,this.updateFilter,this),this.parent.on(hi,this.beforeInsertHandler,this),this.parent.on(di,this.beforeDeleteHandler,this),this.parent.on(Jr,this.deleteSheetHandler,this),this.parent.on($n,this.clearHandler,this),this.parent.on(d.filterDialogCreated,this.filterDialogCreatedHandler,this),this.parent.on(d.filterDialogClose,this.removeFilterClass,this),this.parent.on(Ei,this.duplicateSheetFilterHandler,this),this.parent.on(d.fltrPrevent,this.beforeFilteringHandler,this),this.parent.on(d.beforeCustomFilterOpen,this.customFilterOpen,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(vn,this.filterRangeAlertHandler),this.parent.off(Uo,this.initiateFilterUIHandler),this.parent.off(Oa,this.filterMouseDownHandler),this.parent.off(Vo,this.renderFilterCellHandler),this.parent.off(_o,this.refreshFilterRange),this.parent.off(zo,this.updateSortCollectionHandler),this.parent.off(d.beforeFltrcMenuOpen,this.beforeFilterMenuOpenHandler),this.parent.off(d.filterCmenuSelect,this.closeDialog),this.parent.off(jo,this.reapplyFilterHandler),this.parent.off(qo,this.filterByCellValueHandler),this.parent.off(Wo,this.clearFilterHandler),this.parent.off(Go,this.getFilteredColumnHandler),this.parent.off(Ga,this.cMenuBeforeOpenHandler),this.parent.on(d.filterCboxValue,this.filterCboxValueHandler),this.parent.off(Ko,this.getFilterRangeHandler),this.parent.off(Xo,this.filterCellKeyDownHandler),this.parent.off(Dr,this.setFilteredCollection),this.parent.off(Na,this.updateFilter),this.parent.off(hi,this.beforeInsertHandler),this.parent.off(di,this.beforeDeleteHandler),this.parent.off(Jr,this.deleteSheetHandler),this.parent.off($n,this.clearHandler),this.parent.off(d.filterDialogCreated,this.filterDialogCreatedHandler),this.parent.off(d.filterDialogClose,this.removeFilterClass),this.parent.off(Ei,this.duplicateSheetFilterHandler),this.parent.off(d.fltrPrevent,this.beforeFilteringHandler),this.parent.off(d.beforeCustomFilterOpen,this.customFilterOpen))},e.prototype.getModuleName=function(){return"filter"},e.prototype.isInValidFilterRange=function(e,r){var n=w(y(r||e.selectedRange)),i=!1;return 0===e.usedRange.colIndex&&0===e.usedRange.rowIndex&&t.isNullOrUndefined(e.rows[e.usedRange.rowIndex])&&(i=!0),n[0]>e.usedRange.rowIndex||n[1]>e.usedRange.colIndex||i},e.prototype.filterRangeAlertHandler=function(e){var t=this;this.parent.serviceLocator.getService(Al).show({content:e.error,isModal:!0,height:180,width:400,showCloseIcon:!0,beforeOpen:function(e){var r={dialogName:"FilterRangeDialog",element:e.element,target:e.target,cancel:e.cancel};t.parent.trigger("dialogBeforeOpen",r),r.cancel?e.cancel=!0:Wt(t.parent.element)}}),this.parent.hideSpinner()},e.prototype.beforeFilterMenuOpenHandler=function(e){var t=this.parent.serviceLocator.getService(Fl);e.element.classList.add("e-spreadsheet-contextmenu");var r=e.element.querySelector("ul");this.addMenuItem(r,t.getConstant("SortDescending"),"e-filter-sortdesc","e-sort-desc"),this.addMenuItem(r,t.getConstant("SortAscending"),"e-filter-sortasc","e-sort-asc"),e.element.appendChild(r)},e.prototype.addMenuItem=function(e,t,r,n){var i=this.parent.createElement("li",{className:r+" e-menu-item"});i.innerText=t,i.insertBefore(this.parent.createElement("span",{className:"e-menu-icon e-icons "+n}),i.firstChild),e.insertBefore(i,e.firstChild)},e.prototype.initiateFilterUIHandler=function(e){var t=this,n=e?e.predicates:null,i=e.sIdx;i||0===i||(i=e.isOpen?0:this.parent.activeSheetIndex);var a;e.promise&&(a=new r.Deferred,e.promise=a.promise);var o=function(){a&&a.resolve()},s=e.isInternal||e.isCut;if(this.filterRange.size>0&&this.filterRange.has(i)&&!this.parent.isOpen&&!n)return this.removeFilter(i,s,!1),void o();var l=Ce(this.parent,i);if(this.isInValidFilterRange(l,e.range)){var h=this.parent.serviceLocator.getService(Fl);return this.filterRangeAlertHandler({error:h.getConstant("FilterOutOfRangeError")}),void o()}var d,p,u=e.range||l.selectedRange;if(!s){if(d={range:u,sheetIndex:i,cancel:!1,allowHeaderFilter:!1},e.predicates?(d.predicates=e.predicates,d.previousPredicates=this.filterCollection.get(i)&&[].slice.call(this.filterCollection.get(i))):d.filterOptions={predicates:e.predicates},d.useFilterRange=!1,p={action:"filter",eventArgs:d},this.parent.notify(Ar,p),d.cancel)return void o();delete d.cancel,e.useFilterRange=d.useFilterRange,e.allowHeaderFilter=d.allowHeaderFilter}if(e.range||!s&&u!==d.range)s||(u=d.range);else{var g=c(u);g[0]===g[2]&&g[1]===g[3]&&(u=m(g=ee(g[0],g[1],l)),s||(d.range=u))}if(n){if(n.length){var v=this.filterRange.get(i);v&&(e.useFilterRange=v.useFilterRange,e.allowHeaderFilter=v.allowHeaderFilter),this.processRange(l,i,u,!0,e.useFilterRange,e.allowHeaderFilter);var y=this.filterRange.get(i).range.slice();e.allowHeaderFilter||(y[0]=y[0]+1),e.useFilterRange||(y[2]=l.usedRange.rowIndex),y[1]=y[3]=f(n[0].field);var C=l.name+"!"+this.getPredicateRange(y,n.slice(1,n.length)),b=m(y);return void he(this.parent,C,!0,!0,null,!0,null,null,!1,b).then(function(i){t.filterSuccessHandler(new r.DataManager(i),{action:"filtering",filterCollection:n,field:n[0].field,sIdx:e.sIdx,isInternal:s,isOpen:e.isOpen,prevPredicates:d&&d.previousPredicates}),o()})}this.clearFilterHandler({sheetIndex:i}),o()}else this.processRange(l,i,u,!1,e.useFilterRange,e.allowHeaderFilter),o();s||(this.parent.notify(Yo,p),Wt(this.parent.element))},e.prototype.processRange=function(e,t,r,n,i,a){var o=w(y(r||e.selectedRange));o[0]===o[2]&&o[1]===o[3]?(o[0]=0,o[1]=0,o[2]=e.usedRange.rowIndex,o[3]=e.usedRange.colIndex):o[3]>e.usedRange.colIndex&&(o[3]=e.usedRange.colIndex);var s={useFilterRange:i,range:o};a&&(s.allowHeaderFilter=a),this.filterRange.set(t,s),this.filterCollection.set(t,[]),n||this.refreshFilterRange(o,!1,t)},e.prototype.removeFilter=function(e,t,r){var n,i=this.filterRange.get(e),a=i.range.slice(),o=i.allowHeaderFilter,s=m(a);if(!t){if(n={action:"filter",eventArgs:{range:s,sheetIndex:e,cancel:!1}},this.parent.notify(Ar,n),n.eventArgs.cancel)return;delete n.eventArgs.cancel}(this.filterCollection.get(e).length||r)&&this.clearFilterHandler({preventRefresh:r,sheetIndex:e}),this.filterRange.delete(e),this.filterCollection.delete(e),this.refreshFilterRange(a,!0,e,o),t||this.parent.notify(Yo,n)},e.prototype.filterByCellValueHandler=function(){var e=this,t=this.parent.activeSheetIndex,n=this.parent.getActiveSheet();if(this.isInValidFilterRange(n)){var i=this.parent.serviceLocator.getService(Fl);this.filterRangeAlertHandler({error:i.getConstant("FilterOutOfRangeError")})}else{var a,o=c(n.activeCell);this.isFilterRange(t,o[0],o[1])||(a=!0,this.processRange(n,t));var s=this.filterRange.get(t),l=s.range.slice(),h=m(l);l[0]=l[0]+1,l[2]=n.usedRange.rowIndex,l[1]=l[3]=o[1];var d=v(o[1]+1),p=Re(o[0],o[1],n),u=de(this.parent,p,o[0],o[1]),f=[{field:d,operator:"equal",type:this.getColumnType(n,o[1],o).type,matchCase:!1,value:u}],g=[].slice.call(this.filterCollection.get(t));g.length||(g=void 0);var y={range:h,predicates:f,previousPredicates:g,sheetIndex:t,cancel:!1,allowHeaderFilter:!1};if(this.parent.notify(Ar,{action:"filter",eventArgs:y}),y.cancel)a&&this.removeFilter(t,!0);else{y.allowHeaderFilter&&(s.allowHeaderFilter=y.allowHeaderFilter,l[0]--);var C=n.name+"!"+this.getPredicateRange(l,this.filterCollection.get(t)),b=m(l);he(this.parent,C,!0,!0,null,!0,null,null,!1,b).then(function(t){e.filterSuccessHandler(new r.DataManager(t),{action:"filtering",filterCollection:f,field:d,isFilterByValue:!0})})}}},e.prototype.renderFilterCellHandler=function(e){var r=t.isNullOrUndefined(e.sIdx)?this.parent.activeSheetIndex:e.sIdx;if(r===this.parent.activeSheetIndex){var n=this.filterRange.get(r)&&this.filterRange.get(r),i=n&&n.range;if(i&&(i[0]===e.rowIndex||n.allowHeaderFilter)&&i[1]<=e.colIndex&&i[3]>=e.colIndex){if(!e.td||e.td.classList.contains(n.allowHeaderFilter?"e-cell":"e-header-cell"))return;for(var a=e.td.querySelector(".e-filter-icon"),o="",s=this.parent.sortCollection,l=v(e.colIndex+1),h=this.filterCollection.get(r),d=0;d<h.length;d++)if(h[d].field===l){o=" e-filtered";break}if(s)for(d=0;d<s.length;d++)if(s[d].sheetIndex===r&&s[d].columnIndex===e.colIndex){o+="Ascending"===s[d].order?" e-sortasc-filter":" e-sortdesc-filter";break}a?a.className="e-btn-icon e-icons e-filter-icon"+o:((a=this.filterBtn.cloneNode(!0)).firstElementChild.className="e-btn-icon e-icons e-filter-icon"+o,e.td.insertBefore(a,e.td.firstChild))}}},e.prototype.refreshFilterRange=function(e,t,r,n){var i=r;i||0===i||(i=this.parent.activeSheetIndex);var a=this.filterRange&&this.filterRange.get(i);a?(e=e||a.range.slice(),n=a.allowHeaderFilter):e||(e=[0,0,0,0]);for(var o,s=e,l=this.parent.frozenColCount(Ce(this.parent,i)),h=s[1];h<=s[3];h++){if(n){var d=h<l?this.parent.sheetModule.getSelectAllTable():this.parent.getColHeaderTable(),p=d&&this.parent.getRow(0,d);o=p&&this.parent.getCell(0,h,p)}else o=this.parent.getCell(s[0],h);if(t){if(o){var c=o.querySelector(".e-filter-btn");c&&c.parentElement.removeChild(c)}}else this.renderFilterCellHandler({td:o,rowIndex:s[0],colIndex:h,sIdx:i})}this.parent.sortCollection&&this.parent.notify(Nr,null)},e.prototype.isFilterCell=function(e,t,r){var n=this.filterRange.get(e)&&this.filterRange.get(e).range;return n&&n[0]===t&&n[1]<=r&&n[3]>=r},e.prototype.isFilterRange=function(e,t,r){var n=this.filterRange.get(e)&&this.filterRange.get(e).range;return n&&n[0]<=t&&n[2]>=t&&n[1]<=r&&n[3]>=r},e.prototype.getFilteredColumnHandler=function(e){var r=t.isUndefined(e.sheetIndex)?this.parent.activeSheetIndex:e.sheetIndex,n=this.parent.serviceLocator.getService(Fl);if(e.clearFilterText=n.getConstant("ClearFilter"),this.filterRange.has(r)){var i=this.filterCollection.get(r);if(e.isClearAll)return void(e.isFiltered=i&&i.length>0);var a=this.filterRange.get(r).range.slice(),o=Ce(this.parent,r),s=u(o.activeCell);if(this.isFilterRange(r,s[0],s[1])){e.field=v(s[1]+1);var l=Re(a[0],s[1],o),h=this.parent.getDisplayText(l);e.clearFilterText=n.getConstant("ClearFilterFrom")+'"'+(h?h.toString():"Column "+e.field)+'"',i.some(function(t){return e.isFiltered=t.field===e.field,e.isFiltered})}}},e.prototype.cMenuBeforeOpenHandler=function(e){var t=this.parent.element.id+"_cmenu";if(e.parentItem&&e.parentItem.id===t+"_filter"&&""===e.target){var r={isFiltered:!1};this.getFilteredColumnHandler(r),this.parent.enableContextMenuItems([t+"_clearfilter",t+"_reapplyfilter"],!!r.isFiltered,!0)}},e.prototype.closeDialog=function(){var e=document.querySelector(".e-filter-popup");if(e&&e.id.includes(this.parent.element.id)){var r=t.getComponent(e,"dialog");t.EventHandler.remove(e,ut(),this.filterMouseDownHandler),r&&r.hide(),this.parent.notify(d.filterDialogClose,null)}},e.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")},e.prototype.isPopupOpened=function(){var e=document.getElementsByClassName("e-filter-popup")[0];return e&&e.id.includes(this.parent.element.id)&&"none"!==e.style.display},e.prototype.filterCellKeyDownHandler=function(e){var t=u(this.parent.getActiveSheet().activeCell);if(this.isFilterCell(this.parent.activeSheetIndex,t[0],t[1]))if(e.closePopup)this.closeDialog();else if(e.isFilterCell=!0,!this.isPopupOpened()){var r=this.parent.getCell(t[0],t[1]);r&&this.openDialog(r)}},e.prototype.filterMouseDownHandler=function(e){if(!(t.Browser.isDevice&&"mousedown"===e.type||this.parent.getActiveSheet().isProtected)){var r=e.target;if(r.classList.contains("e-filter-icon")||r.classList.contains("e-filter-btn"))this.isPopupOpened()&&this.closeDialog(),this.openDialog(d.parentsUntil(r,"e-cell")||d.parentsUntil(r,"e-header-cell"));else if(this.isPopupOpened()){var n=r.offsetParent;r.classList.contains("e-searchinput")||r.classList.contains("e-searchclear")||!n||n.classList.contains("e-filter-popup")||n.classList.contains("e-text-content")||n.classList.contains("e-checkboxtree")||n.classList.contains("e-checkbox-wrapper")?this.selectSortItemHandler(r):this.closeDialog()}}},e.prototype.cboxListSelected=function(e,r,n,i,a){var o=d.parentsUntil(i.target,"e-ftrchk");if(o){var s=a&&o.querySelector(".e-add-current");if(s)return s.classList.contains("e-check")?(t.classList(s,["e-uncheck"],["e-check"]),r.length||(e.btnObj.element.disabled=!0),!1):(t.classList(s,["e-check"],["e-uncheck"]),e.btnObj.element.disabled=!1,!0);var l=o.querySelector(".e-selectall");if(l){o.querySelector(".e-chk-hidden").indeterminate=!1;for(var h=o.querySelector(".e-frame").classList.contains("e-check"),p=void 0,c=void 0,u=a?2:1,f=e.element.childElementCount;u<f;u++)p=e.element.children[u].querySelector(".e-frame"),t.removeClass([p],["e-check","e-stop","e-uncheck"]),h?(e.element.children[u].querySelector(".e-chk-hidden").checked=!1,p.classList.add("e-uncheck"),r.splice(0,1)):(e.element.children[u].querySelector(".e-chk-hidden").checked=!0,p.classList.add("e-check"),c=e.element.children[u].querySelector(".e-checkboxfiltertext").textContent,-1===r.indexOf(c)&&r.push(c))}else{c=o.querySelector(".e-checkboxfiltertext").textContent;o.querySelector(".e-frame").classList.contains("e-check")?r.splice(r.indexOf(c),1):r.push(c),d.toogleCheckbox(o),l=e.element.querySelector(".e-selectall")}this.updateState(e,l,l.parentElement.querySelector(".e-chk-hidden"),r.length!==n,r.length)}return null},e.prototype.initCboxList=function(e,n){var i=this,a=e.column.field,o=new r.DataManager(e.dataSource).executeLocal((new r.Query).sortBy(a+"_value","ascending")),s=[],l=this.parent.getActiveSheet(),h=this.parent.serviceLocator.getService(Fl),p=document.createDocumentFragment(),c=this.createSelectAll(e,n);p.appendChild(c);var u,f,g={},m=[],v=[];o.forEach(function(e){if(""===e[a]){if(!g.isBlank){g.isBlank=!0;var t={};t[a]=h.getConstant("Blanks"),u=qe(l,Number(e.__rowIndex)-1);var r=d.createCboxWithWrap(d.getUid("cbox"),n.createCheckbox(t[a],!u,t),"e-ftrchk");1===p.childElementCount?p.appendChild(r):p.insertBefore(r,p.children[1]),s.splice(0,0,t[a]),u||(m.push(t[a]),v.push(t[a]))}}else g[e[a]]||(g[e[a]]=!0,u=qe(l,Number(e.__rowIndex)-1),f=e[a],p.appendChild(d.createCboxWithWrap(d.getUid("cbox"),n.createCheckbox(f,!u,e),"e-ftrchk")),s.push(f),u||(m.push(f),v.push(f)))}),e.element.appendChild(p);var y=c.querySelector(".e-frame");y.classList.add("e-selectall");var C=c.querySelector(".e-chk-hidden");this.updateState(e,y,C,v.length!==s.length,v.length);var b,x,S,w=[].slice.call(e.element.childNodes);e.element.addEventListener("click",function(t){if(b){var r=i.cboxListSelected(e,b,e.element.childElementCount-2,t,!0);null!==r&&(S=r)}else i.cboxListSelected(e,v,s.length,t)});this.wireFilterEvents(e,function(){if(x)if(S){var o=void 0,l=void 0;v=m;for(var d=0,p=x.length;d<p;d++)o=x[d],x.length===b.length||b.indexOf(o)>-1?-1===v.indexOf(o)&&v.push(o):(l=v.indexOf(o))>-1&&v.splice(l,1)}else v=b;var c=v.length;if(c===s.length)i.filterSuccessHandler(new r.DataManager(e.dataSource),{action:"clear-filter",field:e.column.field});else{var u=[],f={field:a,ignoreAccent:!1,matchCase:!1,isFilterByMenu:!0},g=t.getNumberDependable(Fl,t.defaultCurrencyCode),y=t.getNumericObject(i.parent.locale),C=function(t){var r=e.type;"number"===r&&(t===h.getConstant("Blanks")?(t="",r="string"):D(ae([t],i.parent.locale,g,y)[0])||(r="string")),u.push(Object.assign({value:t,type:r},f))};if(c>s.length/2)for(f.operator="notequal",f.predicate="and",d=0,p=s.length;d<p;d++)-1===v.indexOf(s[d])&&C(s[d]);else for(f.operator="equal",f.predicate="or",d=0,p=c;d<p;d++)C(v[d]);n.initiateFilter(u)}},function(t){var r;if("keyup"===t.event.type)r=t.event.target.value.toLowerCase();else if(t.event.target.classList.contains("e-search-icon"))return;var a=document.createDocumentFragment();if(a.appendChild(c),r)if(x=[],b=[],s.forEach(function(t){if(t.toLowerCase().includes(r)){var i={};i[e.column.field]=t,a.appendChild(d.createCboxWithWrap(d.getUid("cbox"),n.createCheckbox(t,!0,i),"e-ftrchk")),x.push(t),b.push(t)}}),b.length){i.updateState(e,y,C,!1,0),c.classList.remove("e-hide");var o={};o[e.column.field]=h.getConstant("AddCurrentSelection");var l=d.createCboxWithWrap(d.getUid("cbox"),n.createCheckbox(o[e.column.field],!1,o),"e-ftrchk");a.insertBefore(l,a.children[1]),l.querySelector(".e-frame").classList.add("e-add-current")}else{c.classList.add("e-hide");var p=i.parent.createElement("div",{className:"e-checkfltrnmdiv"}),u=i.parent.createElement("span");u.innerText=h.getConstant("NoResult"),p.appendChild(u),a.appendChild(p),e.btnObj.element.disabled=!0}else w&&(b=null,x=null,i.updateState(e,y,C,v.length!==s.length,v.length),c.classList.remove("e-hide"),w.forEach(function(e){a.appendChild(e)}));e.element.innerHTML="",e.element.appendChild(a)}.bind(this))},e.prototype.createSelectAll=function(e,t){var r={};r[e.column.field]=this.parent.serviceLocator.getService(Fl).getConstant("SelectAll");return d.createCboxWithWrap(d.getUid("cbox"),t.createCheckbox(r[e.column.field],!1,r),"e-ftrchk")},e.prototype.updateState=function(e,r,n,i,a){if(t.removeClass([r],["e-check","e-stop","e-uncheck"]),e.btnObj.element.disabled&&(e.btnObj.element.disabled=!1),i)if(a)r.classList.add("e-stop");else{r.classList.add("e-uncheck");var o=e.element.querySelector(".e-add-current");e.btnObj.element.disabled=!o||!o.classList.contains("e-check")}else r.classList.add("e-check");n.indeterminate=i,n.checked=!i},e.prototype.beforeFilteringHandler=function(e){var r=this;if(e.instance&&e.instance.options){if(e.isOpen&&"string"===e.instance.options.type){var n=t.getNumericObject(this.parent.locale);if("."!==n.decimal){var i=e.arg3.toString().split(".");if(2===i.length){var a=i.join(n.decimal);D(new t.Internationalization(this.parent.locale).parseNumber(a,{format:"n"}))&&(e.arg3=a)}}}var o=function(e,n){if(n&&("notequal"===n||r.isCustomNumFilter(n)))if(e){if(D(e))e=parseFloat(e.toString());else if("string"==typeof e){var i=t.getNumericObject(r.parent.locale),a=new t.Internationalization(r.parent.locale),s={};if(e.includes(i.percentSign)){var l=e.trim().split("%");""===l[0]||l[1]||(s=M({value:l[0]},r.parent.locale,i.group,i.decimal))}if(s.isNumber)e=Number(s.value)/100;else{var h=a.parseNumber(e.trim(),{format:"n"});if(D(h))e=h;else{var d=e.trim(),p={value:d,cell:{value:d}};r.parent.notify(Wr,p),(p.isTime||p.isDate)&&(e=parseFloat(p.updatedVal))}}}}else"notequal"===n&&null===e&&(e="");else"equal"===n&&(D(e)?e=e.toString():"string"==typeof e&&D(o(e,"notequal"))?e=e.trim():null===e&&(e=""));return e};if("date"!==e.instance.options.type)e.arg3=o(e.arg3,e.arg2),e.arg8=o(e.arg8,e.arg7);else if("yMd"===e.instance.options.format){var s=function(t,n){if(t)if("string"==typeof t){var i=t.trim(),a={value:i,cell:{value:i}};if(r.parent.notify(Wr,a),a.isDate)t="equal"===n?a.dateObj:parseFloat(a.updatedVal);else if("equal"===n||"notequal"===n){var s=o(t,"notequal");D(s)?(e.instance.options.type="number","notequal"===n&&(t=s)):e.instance.options.type="string"}}else T(t)&&"equal"!==n&&(t=O(t,!0));return t},l=document.querySelectorAll(".e-xlfl-valuediv input.e-datepicker");2===l.length?(e.arg3=s(e.arg3||l[0].value,e.arg2),e.arg8=s(e.arg8||l[1].value,e.arg7)):e.arg3&&(e.arg3=s(e.arg3,e.arg2))}}},e.prototype.customFilterOpen=function(e){for(var r=document.querySelectorAll(".e-xlfl-optrdiv input.e-dropdownlist"),n=[],i=0;i<r.length;i++){var o=t.getComponent(r[i],"dropdownlist");o&&n.push(o.value)}var s=[];if(2===n.length){var l=this.filterCollection.get(this.parent.activeSheetIndex),h=void 0;for(i=0;i<l.length;i++)l[i].field===e.column&&null!==l[i].value&&(h=n.indexOf(l[i].operator))>-1&&("equal"===l[i].operator&&T(l[i].value)?s[h]=O(l[i].value,!0).toString():s[h]=l[i].value.toString(),n[h]="")}var d=t.getNumericObject(this.parent.locale),p=function(e){if("."!==d.decimal&&D(e)){var t=e.toString();if(t.includes("."))return t.replace(".",d.decimal)}return e},c=document.querySelectorAll(".e-xlfl-valuediv input.e-ss-filter-input");if(c.length)for(i=0;i<c.length;i++){var u=new a.TextBox({placeholder:this.parent.serviceLocator.getService(Fl).getConstant("CustomFilterPlaceHolder")});s[i]&&(u.value=p(s[i])),u.appendTo(c[i])}else{var f=document.querySelectorAll(".e-xlfl-valuediv input.e-datepicker"),g=void 0,m=void 0;for(i=0;i<f.length;i++)m=D(s[i])?this.parent.getDisplayText({value:s[i],format:Ue("ShortDate")+(s[i].includes(".")?" "+Ue("Time"):"")}):p(s[i]),(g=t.getComponent(f[i],"datepicker"))&&(g.value=m,f[i].value=m)}},e.prototype.wireFilterEvents=function(e,t,r){var n=this;e.btnObj.element.addEventListener("click",t.bind(this)),e.searchBox.addEventListener("keydown",function(e){13===e.keyCode&&t()});var i=function(){n.parent.off(fl,r),n.parent.off(d.filterDialogClose,i),Wt(n.parent.element)};this.parent.on(d.filterDialogClose,i,this),this.parent.on(fl,r,this)},e.prototype.initTreeView=function(e,t){var n,a,o,s,l,h,d,p,c=this,u=[],f=[],g={},m=[],v=[],y=[],C=[],b=["January","February","March","April","May","June","July","August","September","October","November","December"],x=!1,S=this.parent.getActiveSheet(),w=function(e){g[""+h]=!0,qe(S,Number(e.__rowIndex)-1)?x=!0:u.push(h),f.push(h)};e.dataSource.forEach(function(t){"object"==typeof(s=t[e.column.field])&&Date.parse(s.toString())?(n=s.getFullYear().toString(),g[""+n]||((p={__rowIndex:n,hasChild:!0})[e.column.field]=n,m.push(p),g[""+n]=!0),d=s.getMonth(),g[""+(l=n+" "+(a=b[d]))]||((p={__rowIndex:l,pId:n,hasChild:!0,month:d})[e.column.field]=a,v.push(p),g[""+l]=!0),o=s.getDate(),h=l+" "+o.toString(),g[""+h]||((p={__rowIndex:h,pId:l})[e.column.field]=o,y.push(p),w(t))):(t[e.column.field]||0===t[e.column.field]?(h="text "+t[e.column.field].toString().toLowerCase(),n=t[e.column.field]):(h="blanks",n=c.parent.serviceLocator.getService(Fl).getConstant("Blanks")),g[""+h]||((p={__rowIndex:h})[e.column.field]=n,C.push(p),w(t)))}),m=new r.DataManager(m).executeLocal((new r.Query).sortBy(e.column.field,"decending")),v=new r.DataManager(v).executeLocal((new r.Query).sortBy("month","ascending")),y=new r.DataManager(y).executeLocal((new r.Query).sortBy(e.column.field,"ascending")),y=m.concat(v.concat(y)),C.length&&(C=new r.DataManager(C).executeLocal((new r.Query).sortBy(e.column.field,"ascending")),y=y.concat(C));var I=function(e){var t=[e.node];if(e.event.target.classList.contains("e-fullrow")||"Enter"==e.event.key){"true"===A.getNode(e.node).isChecked?A.uncheckAll(t):A.checkAll(t)}},E=this.createSelectAll(e,t);E.addEventListener("click",function(){k.indeterminate=!1,R.classList.contains("e-check")?(A.uncheckAll(),R.classList.add("e-uncheck"),k.checked=!1):(A.checkAll(),R.classList.add("e-check"),k.checked=!0)}.bind(this)),E.classList.add("e-spreadsheet-ftrchk");var R=E.querySelector(".e-frame");R.classList.add("e-selectall"),e.element.appendChild(E);var k=E.querySelector(".e-chk-hidden"),F=this.parent.createElement("div"),A=new i.TreeView({fields:{dataSource:y,id:"__rowIndex",parentID:"pId",text:e.column.field,hasChildren:"hasChild"},enableRtl:this.parent.enableRtl,showCheckBox:!0,cssClass:"e-checkboxtree",checkedNodes:u,nodeClicked:I.bind(this),keyPress:I.bind(this),nodeChecked:function(t){"indeterminate"!==t.action&&(x=A.checkedNodes.length!==A.fields.dataSource.length,c.updateState(e,R,k,x,A.checkedNodes.length))}});A.createElement=this.parent.createElement,A.appendTo(F),e.element.appendChild(F),u=A.checkedNodes,this.updateState(e,R,k,x,A.checkedNodes.length);this.treeViewObj=A,this.treeViewEle=F,this.cBox=k,this.wireFilterEvents(e,function(){A.checkedNodes.length===y.length?c.filterSuccessHandler(new r.DataManager(e.dataSource),{action:"clear-filter",field:e.column.field}):c.generatePredicate(A.checkedNodes,C.length?"string":e.type,e.column.field,t,f,A.checkedNodes.length>y.length/2)},this.refreshCheckbox.bind(this,y,A,u))},e.prototype.generatePredicate=function(e,t,r,n,i,a){var o,s,l,h,d,p=[],c={January:0,February:1,March:2,April:3,May:4,June:5,July:6,August:7,September:8,October:9,November:10,December:11},u=function(){"blanks"===s[0]?p.push(Object.assign({value:"",type:t},o)):"text"===s[0]&&(s.splice(0,1),h=s.join(" "),isNaN(Number(h))?d="string":(h=Number(h),d="number"),p.push(Object.assign({value:h,type:d},o)))},f=function(){(l=new Date(Number(s[0]),c[s[1]],Number(s[2]))).getDate()?p.push(Object.assign({value:l,type:t},o)):u()};if(a){o={field:r,ignoreAccent:!1,matchCase:!1,predicate:"and",operator:"notequal",isFilterByMenu:!0};for(var g=0,m=i.length;g<m;g++)-1===e.indexOf(i[g])&&(s=i[g].split(" "),f())}else{o={field:r,ignoreAccent:!1,matchCase:!1,predicate:"or",operator:"equal",isFilterByMenu:!0};for(g=0,m=e.length;g<m;g++)3===(s=e[g].split(" ")).length?f():u()}n.initiateFilter(p)},e.prototype.refreshCheckbox=function(e,n,i,a){var o;if("keyup"===a.event.type)o=a.event.target.value;else if(a.event.target.classList.contains("e-search-icon"))return;var s,l=function(){if(s.length&&!n.fields.dataSource.length){var e=n.element.parentElement;e.getElementsByClassName("e-spreadsheet-ftrchk")[0].classList.remove("e-hide"),t.detach(e.getElementsByClassName("e-checkfltrnmdiv")[0])}n.fields.dataSource=s,n.dataBind()};if(o){s=new r.DataManager(e).executeLocal((new r.Query).where(new r.Predicate(n.fields.text,"contains",o,!0)));var h={},d=[],p=void 0,c=void 0,u=void 0,f=void 0;if(isNaN(Number(o))){for(var g=0;g<s.length;g++)s[g].hasChild&&(d.push(new r.Predicate("pId","equal",s[g].__rowIndex,!1)),h[""+(p=s[g].pId)]||(d.push(new r.Predicate("__rowIndex","equal",p,!1)),h[""+p]=!0));c=s,f=1}else{var m=void 0,v={};u=[];for(g=0;g<s.length;g++)(p=s[g].pId)?(m=p.split(" ")[0],h[""+p]||(d.push(new r.Predicate("__rowIndex","equal",p,!1)),h[""+p]=!0,u.push(m),u.push(p)),v[""+m]||(h[""+m]||(d.push(new r.Predicate("__rowIndex","equal",m,!1)),h[""+m]=!0),d.push(new r.Predicate("__rowIndex","equal",s[g].__rowIndex,!1)))):v[""+(p=s[g].__rowIndex)]||(d.push(new r.Predicate("__rowIndex","contains",p,!1)),v[""+p]=!0);c=[]}if(s.length){d.length&&(s=c.concat(new r.DataManager(e).executeLocal((new r.Query).where(r.Predicate.or(d))))),l(),n.checkAll();var y=n.animation.expand.duration;n.animation.expand.duration=0,n.expandAll(u,f),n.animation.expand.duration=y}else if(n.fields.dataSource.length){l();var C=n.element.parentElement;C.getElementsByClassName("e-spreadsheet-ftrchk")[0].classList.add("e-hide");var b=this.parent.createElement("div",{className:"e-checkfltrnmdiv"}),x=this.parent.createElement("span");x.innerText=this.parent.serviceLocator.getService(Fl).getConstant("NoResult"),b.appendChild(x),C.appendChild(b)}}else s=e,l(),n.checkedNodes=i,n.dataBind()},e.prototype.openDialog=function(e){var n=this,i=parseInt(e.getAttribute("aria-colindex"),10),a=v(i);this.parent.showSpinner();var o=this.parent.activeSheetIndex,s=this.filterRange.get(o),l=s.range.slice(),h=this.parent.getActiveSheet(),p=Re(l[0],i-1,h),c=this.parent.getDisplayText(p);s.allowHeaderFilter||(l[0]=l[0]+1),s.useFilterRange||(l[2]=h.usedRange.rowIndex);var u,f=[l[0],i-1,l[2],i-1],g=this.getPredicateRange(f,this.filterCollection.get(o),i-1),y=g.otherColPredicate;g.curPredicate.length&&((u={})[a]=g.curPredicate);var C,b=h.name+"!"+g.address,x=m(f),S=this.getColumnType(h,i-1,l),w=S.type,I="date"===w||S.isDateAvail,E="number"===w,R=I||E,k=S.isMultiFormattedCol;R&&!g.filteredCol&&(C=[]),he(this.parent,b,!0,!0,null,!0,null,null,!1,x,null,C).then(function(i){var s;if(n.parent.element.style.position="relative",n.parent.element.classList.add("e-filter-open"),R){if(C||!y.length)s=new r.DataManager(C||i);else{var l=new r.DataManager(i).executeLocal((new r.Query).where(r.Predicate.and(n.getPredicates(n.getClonedPredicates(y)))));s=new r.DataManager(l)}var h=function(e){n.parent.off(ul,h),e.isCheckboxFilterTemplate=!0,I?n.initTreeView(e,v):n.initCboxList(e,v)};n.parent.on(ul,h,n)}else s=new r.DataManager(i);var p=e.querySelector(".e-filter-btn"),f={field:a,filter:{}};if(E){var g=n.parent;f.filterTemplate=function(e){if(!g.isReact||!e)return[g.createElement("input",{className:"e-ss-filter-input"})];e.appendChild(g.createElement("input",{className:"e-ss-filter-input"}))};f.getFilterTemplate=function(){return function(e){return function(t,r,n,i,a,o,s){return e(s)}}(f.filterTemplate)},g.isReact&&!g.renderTemplates&&(g.renderTemplates=function(e){return e()})}var m={type:w,field:a,format:"date"===w?"yMd":null,displayName:c||"Column "+a,dataSource:s||[],height:n.parent.element.classList.contains("e-bigger")?800:500,columns:[],hideSearchbox:!1,filteredColumns:n.getClonedPredicates(n.filterCollection.get(o)),column:f,handler:n.filterSuccessHandler.bind(n,new r.DataManager(i)),target:p,position:{X:0,Y:0},localeObj:n.parent.serviceLocator.getService(Fl),actualPredicate:u,isFormatted:R&&!I,isMultiFormattedCol:k},v=new d.ExcelFilterBase(n.parent,n.getLocalizedCustomOperators());v.openDialog(m);var b=document.querySelector(".e-filter-popup");if(b&&b.id.includes(n.parent.element.id)){t.EventHandler.add(b,ut(),n.filterMouseDownHandler,n);var x=n.parent.element.getBoundingClientRect(),S=p.getBoundingClientRect(),F=b.getBoundingClientRect(),A=S.right-x.left-F.width;A<0&&(A=S.left-x.left),b.style.left=A+"px",b.style.top="0px",b.style.visibility="hidden",b.classList.contains("e-hide")&&b.classList.remove("e-hide");var N=S.bottom-x.top;F.height-(x.bottom-S.bottom)>0&&(N-=F.height-(x.bottom-S.bottom))<0&&(N=0),b.style.top=N+"px",b.style.visibility=""}n.parent.hideSpinner()})},e.prototype.getPredicateRange=function(e,t,r){var n,i=m(e),a=[],o=[];if(t&&t.length){var s,l;t.forEach(function(t){t.field&&(s=""+t.field+(e[0]+1)+":"+t.field+(e[2]+1),l=f(t.field),i.includes(s)||(i+=","+s,l<e[1]&&(e[1]=l),l>e[3]&&(e[3]=l)),void 0!==r&&(l===r?(n=!0,o.push(t)):a.push(t)))})}else n=!0;return void 0===r?i:{address:i,filteredCol:n,otherColPredicate:a,curPredicate:o}},e.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")},e.prototype.filterCboxValueHandler=function(e){if(e.column&&e.data){var t=e.column.field;if(e.value){var r=u(t+e.data.dataObj.__rowIndex),n=Re(r[0],r[1],this.parent.getActiveSheet());n&&n.format&&(e.value=this.parent.getDisplayText(n))}}},e.prototype.selectSortItemHandler=function(e){var t=this.parent.serviceLocator.getService(Fl),r=e.classList.contains("e-filter-sortasc")?"Ascending":e.classList.contains("e-filter-sortdesc")?"Descending":null;if("Ascending"===r?e.setAttribute("aria-label",t.getConstant("SortAscending")):e.setAttribute("aria-label",t.getConstant("SortDescending")),r){var n=this.parent.getActiveSheet(),i=this.parent.activeSheetIndex,a=this.filterRange.get(i),o=a.range.slice();a.allowHeaderFilter||(o[0]=o[0]+1),a.useFilterRange||(o[2]=n.usedRange.rowIndex),this.parent.sortCollection=this.parent.sortCollection?this.parent.sortCollection:[];for(var s=[],l=this.parent.sortCollection.length-1;l>=0;l--)this.parent.sortCollection[l]&&this.parent.sortCollection[l].sheetIndex===i&&(s.push(this.parent.sortCollection[l]),this.parent.sortCollection.splice(l,1));this.parent.sortCollection.push({sortRange:m(o),columnIndex:y(n.activeCell)[1],order:r,sheetIndex:i}),this.parent.notify(Io,{sortOptions:{sortDescriptors:{order:r},containsHeader:!1},previousSort:s,range:m(o)}),this.refreshFilterRange(),this.closeDialog()}},e.prototype.filterSuccessHandler=function(e,t){var r=t.sIdx;r||0===r||(r=t.isOpen?0:this.parent.activeSheetIndex);var n=t.prevPredicates||[].slice.call(this.filterCollection.get(r));t.isFilterByValue&&!n.length&&(n=void 0);var i=this.filterCollection.get(r);if(this.updatePredicate(i,t.field),"clear-filter"!==t.action||i.length!==n.length){"filtering"===t.action&&(i=i.concat(t.filterCollection)),this.filterCollection.set(r,i);var a={datasource:e,predicates:this.getPredicates(this.getClonedPredicates(i))},o=this.filterRange.get(r);o.useFilterRange||(o.range[2]=Ce(this.parent,r).usedRange.rowIndex),this.applyFilter(a,m(o.range),r,n,!1,t.isInternal,t.isFilterByValue)}},e.prototype.isCustomNumFilter=function(e){return e.includes("greaterthan")||e.includes("lessthan")||"between"===e},e.prototype.getClonedPredicates=function(e){for(var t,r=[],n=0;n<e.length;n++)t=e[n],(this.isCustomNumFilter(t.operator)||!t.isFilterByMenu&&"notequal"===t.operator)&&D(t.value)?r.push(Object.assign({},t,{field:t.field+"_value",type:"number"})):r.push(t);return r},e.prototype.updatePredicate=function(e,t){for(var n=new r.DataManager(e),i=new r.Query,a=n.executeLocal(i.where("field","equal",t)),o=0;o<a.length;o++){for(var s=-1,l=0;l<e.length;l++)if(e[l].field===a[o].field){s=l;break}-1!==s&&e.splice(s,1)}},e.prototype.applyFilter=function(e,t,r,n,i,a,o){var s=this,l={range:t,predicates:[].slice.call(this.filterCollection.get(r)),previousPredicates:n,sheetIndex:r,cancel:!1};if(a||o||(this.parent.notify(Ar,{action:"filter",eventArgs:l}),!l.cancel)){t.indexOf("!")<0&&(t=this.parent.sheets[r].name+"!"+t),this.parent.showSpinner();var h={args:{range:t,filterOptions:e},promise:new Promise(function(e,t){e(void 0)}),refresh:i},d=Jt(this.parent);this.parent.notify(mn,h);var p=Jt(this.parent);this.parent.notify(Ms,{prevChartIndexes:d,currentChartIndexes:p}),h.promise.then(function(e){return s.refreshFilterRange(),s.parent.hideSpinner(),a||(delete l.cancel,s.parent.notify(Yo,{action:"filter",eventArgs:l}),document.activeElement.id!==s.parent.element.id+"_SearchBox"&&Wt(s.parent.element)),Promise.resolve(e)}).catch(function(e){return s.filterRangeAlertHandler({error:e}),Promise.reject(e)})}},e.prototype.getPredicates=function(e){for(var t=[],r=d.CheckBoxFilterBase.getPredicate(e),n=0,i=Object.keys(r);n<i.length;n++){var a=i[n];t.push(r[""+a])}return t},e.prototype.getColumnType=function(e,t,r){for(var n,i,a,o,s=0,l=0,h=0,d=r[0];d<=r[2];d++)if(n=Re(d,t,e)){if(n.format&&"General"!==n.format){switch(Ve(n.format).toLowerCase()){case"number":case"currency":case"accounting":case"percentage":s++;break;case"shortdate":case"longdate":h++;break;case"time":s++;break;default:i={},Te(n.format,!0,i)?"date"===i.type?h++:s++:D(n.value)?s++:n.value&&l++}a||(a=n.format)}else D(n.value)?s++:n.value&&l++;a&&a!==n.format&&(o=!0)}return{type:s>l&&s>h&&s>0?"number":l>=s&&l>=h&&l>=0?"string":h>s&&h>l&&h>0?"date":"datetime",isDateAvail:!!h,isMultiFormattedCol:o}},e.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:m(this.filterRange.get(t).range),sIdx:t}))}else{var n=e&&e.isAction,i={isFiltered:!1,isClearAll:!0,sheetIndex:t};if(this.getFilteredColumnHandler(i),i.isFiltered||e&&e.preventRefresh){var a=void 0,o=Ce(this.parent,t),s=this.filterRange.get(t),l=s.range;if(n&&(a={range:m(l),predicates:[],previousPredicates:this.filterCollection.get(t),sheetIndex:t,cancel:!1},this.parent.notify(Ar,{action:"filter",eventArgs:a}),a.cancel))return;this.filterCollection.set(t,[]);var h=s.useFilterRange?l[2]:o.usedRange.rowIndex;if(this.parent.scrollSettings.enableVirtualization&&h-l[0]+1>this.parent.viewport.rowCount+2*this.parent.getThreshold("row")){for(var d=0;d<=h;d++)ze(o,d,{hidden:!1,isFiltered:!1});e&&e.preventRefresh||this.parent.renderModule.refreshSheet(!1,!1,!0)}else{this.refreshFilterRange(null,null,t);var p={startIndex:l[0],hide:!1,isFiltering:!0,refreshUI:!1,endIndex:s.useFilterRange?l[2]:o.usedRange.rowIndex,sheetIndex:t};this.parent.notify(Gn,p),!p.refreshUI||e&&e.preventRefresh||this.parent.renderModule.refreshSheet(!1,!1,!0)}n&&(delete a.cancel,this.parent.notify(Yo,{action:"filter",eventArgs:a}),Wt(this.parent.element))}}},e.prototype.reapplyFilterHandler=function(e,t){var n=this,i=this.parent.activeSheetIndex;if(this.filterRange.has(i)){var a=this.filterCollection.get(i);if(a&&a.length){var o=Ce(this.parent,i),s=this.filterRange.get(i),l=s.range.slice();s.allowHeaderFilter||(l[0]=l[0]+1),s.useFilterRange||(l[2]=o.usedRange.rowIndex),l[1]=l[3]=f(a[0].field);var h=o.name+"!"+this.getPredicateRange(l,a.slice(1,a.length));he(this.parent,h,!0,!0,null,!0,null,null,!1,m(l)).then(function(o){var l=n.getPredicates(n.getClonedPredicates(n.filterCollection.get(i)));n.applyFilter({predicates:l,datasource:new r.DataManager(o)},m(s.range),i,[].slice.call(a),t,e)})}}},e.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)&&this.filterCollection.get(t).length>0):(e.hasFilter=!1,e.filterRange=null)},e.prototype.getLocalizedCustomOperators=function(){var e=this.parent.serviceLocator.getService(Fl),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")}]}},e.prototype.setFilteredCollection=function(e){var n=this,i={sheetIdx:e.sheetIdx};if(this.getFilterRangeHandler(i),i.hasFilter){var a={sheetIndex:e.sheetIdx,filterRange:m(i.filterRange),hasFilter:!0,column:[],criteria:[],value:[],dataType:[],predicates:[]};e.saveJson.filterCollection.push(a);for(var o,s=this.filterCollection.get(e.sheetIdx),l=new Map,h=void 0,d=function(r){if(t.isNullOrUndefined(r))return"";if(e.isSaveAction&&"date"===o){var n=r;r=n.getMonth()+1+"/"+n.getDate()+"/"+n.getFullYear()+" "+n.getHours()+":"+n.getMinutes()+":"+n.getSeconds()}return r},p=0;p<s.length;p++)h=s[p],e.isSaveAction&&"notequal"===h.operator&&h.isFilterByMenu?l.has(h.field)?l.get(h.field).push(h):l.set(h.field,[h]):(a.column.push(f(h.field)),a.criteria.push(h.operator),e.isSaveAction?"equal"===h.operator?(o=T(h.value)?"date":"string",a.value.push(d(h.value)),a.dataType.push(o)):(a.value.push(h.value),a.dataType.push("custom")):(a.value.push(h.value),a.dataType.push(h.type)),a.predicates.push(h.predicate));var c,u=new Map;l.forEach(function(t,i){c=f(i),u.has(i)||u.set(i,n.getColData(c,i,e.sheetIdx));for(var s=u.get(i),l=n.getPredicates(t),h=new r.DataManager(s).executeLocal((new r.Query).where(r.Predicate.and(l))),p=0;p<h.length;p++)a.column.push(c),a.criteria.push("equal"),o=T(h[p][i])?"date":"string",a.value.push(d(h[p][i])),a.dataType.push(o),a.predicates.push("or")})}},e.prototype.updateFilter=function(e){if(this.parent.filterCollection&&(e.initLoad||e.isOpen)){for(var t=void 0,n=void 0,i=void 0,a={},o=void 0,s=void 0,l=void 0,h=0;h<this.parent.filterCollection.length;h++){var d=(i=this.parent.filterCollection[h]).sheetIndex;if(0!==h||this.parent.isOpen||e.isOpen||(d=0),n=[],i.column)for(var p=0;p<i.column.length;p++)if(s={field:v(i.column[p]+1),operator:this.getFilterOperator(i.criteria[p]),value:"string"==typeof i.value[p]?i.value[p].split("*").join(""):i.value[p],predicate:i.predicates&&i.predicates[p],type:i.dataType&&i.dataType[p]},["year","month","day"].indexOf(s.type)>-1){var c={value:s.value,cell:{value:s.value}};if(this.parent.notify(Wr,c),c.isDate){var u=c.dateObj;if(s.value=u,"day"===s.type)s.type="date",s.predicate="or",n.push(s);else{s.operator="greaterthanorequal",s.predicate="and";var f=s.type;s.type="date",t=this.getPredicates([s,{field:s.field,operator:"lessthanorequal",predicate:"and",type:"date",value:new Date(u.getFullYear(),"year"===f?12:u.getMonth()+1,0,0,0,0)}]),a[s.field]||(a[s.field]=this.getColData(i.column[p],s.field,h)),o=new r.DataManager(a[s.field]).executeLocal((new r.Query).where(r.Predicate.and(t)));for(var g=0;g<o.length;g++)n.push({field:s.field,operator:"equal",predicate:"or",type:"date",value:o[g][s.field]})}}}else{if(l={isOpen:!0,instance:{options:{type:s.type}},arg3:s.value,arg2:s.operator},this.beforeFilteringHandler(l),s.value=l.arg3,"string"===s.type||"custom"===s.type)this.isCustomNumFilter(s.operator)&&D(s.value)&&(s.type="number");else if("date"===s.type&&"equal"===s.operator&&"string"==typeof s.value&&s.value.includes("/")&&s.value.includes(":")){var m=s.value.split(" ");if(2===m.length){var y=m[0].split("/"),C=m[1].split(":");3===y.length&&3===C.length&&(s.value=new Date(Number(y[2]),Number(y[0])-1,Number(y[1]),Number(C[0]),Number(C[1]),Number(C[2])))}}n.push(s)}if(!e.isOpen)for(var b=0;b<n.length-1;b++)n[b].field===n[b+1].field&&(n[b].predicate||(n[b].predicate="or"),n[b+1].predicate||(n[b+1].predicate="or"));this.parent.notify(Uo,{predicates:n.length?n:void 0,range:i.filterRange,sIdx:d,isInternal:!0,isOpen:e.isOpen})}this.parent.sortCollection&&this.parent.notify(Nr,null),this.parent.filterCollection=null}},e.prototype.getColData=function(e,t,r){var n=Ce(this.parent,r);if(!n.rows||!n.rows.length)return[];for(var i,a,o=[],s=1,l=n.rows.length;s<l;s++)n.rows[s]&&(a=Re(s,e,n,!1,!0))&&a.value&&((i={})[t]=de(this.parent,a,s,e),o.push(i));return o},e.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},e.prototype.beforeInsertHandler=function(e){if("Column"===e.modelType){var r=t.isUndefined(e.activeSheetIndex)?this.parent.activeSheetIndex:e.activeSheetIndex;if(this.filterRange.size&&this.filterRange.has(r)){var n=this.filterRange.get(r).range;(this.isFilterCell(r,n[0],e.index)||e.index<n[1])&&(n[3]+=e.model.length,e.index<=n[1]&&(n[1]+=e.model.length),this.filterCollection.get(r).forEach(function(t){var r=f(t.field);e.index<=r&&(t.field=v(r+e.model.length+1))}),this.parent.sortCollection&&this.parent.sortCollection.forEach(function(t){t.sheetIndex===r&&e.index<=t.columnIndex&&(t.columnIndex+=e.model.length)}))}}else if("Sheet"===e.modelType){for(var i=0,a=Array.from(this.filterRange.keys()).sort().reverse();i<a.length;i++){var o=a[i];e.index<=o&&(this.filterRange.set(o+e.model.length,this.filterRange.get(o)),this.filterRange.delete(o),this.filterCollection.set(o+e.model.length,this.filterCollection.get(o)),this.filterCollection.delete(o))}this.parent.sortCollection&&this.parent.sortCollection.forEach(function(t){e.index<=t.sheetIndex&&(t.sheetIndex+=e.model.length)})}},e.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),a=void 0,o=i.length-1;o>=0;o--){var s=f(i[o].field);e.end<s?i[o].field=v(s-(e.end-e.start+1)+1):e.start<=s&&e.end>=s&&(a=!0,i.splice(o,1))}var l=this.parent.sortCollection;if(l)for(o=0;o<l.length;o++)if(l[o].sheetIndex===t){if(e.end<l[o].columnIndex){l[o].columnIndex=l[o].columnIndex-(e.end-e.start+1);break}if(e.start<=l[o].columnIndex&&e.end>=l[o].columnIndex){l.splice(o,1);break}}n.some(function(e){return e<0})?(this.removeFilter(t,!0,!0),e.refreshSheet=!0):a&&(i&&i.length?(this.reapplyFilterHandler(!0,!0),e.refreshSheet=!1):(this.clearFilterHandler({preventRefresh:!0}),e.refreshSheet=!0))}}}},e.prototype.deleteSheetHandler=function(e){if(t.isUndefined(e.sheetIndex))this.filterRange.get(this.parent.activeSheetIndex)&&(this.filterRange.delete(this.parent.activeSheetIndex),this.filterCollection.delete(this.parent.activeSheetIndex));else{for(var r=0,n=Array.from(this.filterRange.keys()).sort().reverse();r<n.length;r++){var i=n[r];e.sheetIndex===i?(this.filterRange.delete(i),this.filterCollection.delete(i)):e.sheetIndex<i&&(this.filterRange.set(i-1,this.filterRange.get(i)),this.filterRange.delete(i),this.filterCollection.set(i-1,this.filterCollection.get(i)),this.filterCollection.delete(i))}var a=this.parent.sortCollection;if(a)for(var o=a.length-1;o>=0;o--)e.sheetIndex===a[o].sheetIndex?a.splice(o,1):e.sheetIndex<a[o].sheetIndex&&(a[o].sheetIndex-=1)}},e.prototype.clearHandler=function(e){var t=this.parent.getAddressInfo(e.range);if(this.filterRange.has(t.sheetIndex)){var r=this.filterRange.get(t.sheetIndex).range.slice();j(t.indices,r[0],r[1])&&j(t.indices,r[0],r[3])&&this.removeFilter(t.sheetIndex)}},e.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))},e.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();n.allowHeaderFilter||(i[0]=i[0]+1),n.useFilterRange||(i[2]=t.usedRange.rowIndex);var a=e.sortOptions.sortDescriptors;if(this.parent.sortCollection=this.parent.sortCollection?this.parent.sortCollection:[],Array.isArray(a))for(var o=0;o<a.length;o++)this.parent.sortCollection.push({sortRange:m(i),columnIndex:f(a[o].field),order:a[o].order,sheetIndex:r});else this.parent.sortCollection.push({sortRange:m(i),columnIndex:y(t.activeCell)[1],order:a.order,sheetIndex:r})}},e}(),Mh=function(){function e(e){this.parent=e,this.addEventListener(),this.renderImageUpload()}return e.prototype.addEventListener=function(){this.parent.on(ks,this.insertImage,this),this.parent.on(As,this.refreshImgCellObj,this),this.parent.on(Ts,this.createImageElement,this),this.parent.on(Ds,this.deleteImage,this),this.parent.on(Hs,this.refreshInsDelImagePosition,this)},e.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)},e.prototype.imageSelect=function(e){var t=e.target.files[0];t&&(t.type.includes("image")?this.insertImage({file:t}):this.parent.serviceLocator.getService(Al).show({content:this.parent.serviceLocator.getService("spreadsheetLocale").getConstant("UnsupportedFile"),width:"300"}),e.target.value="")},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(ks,this.insertImage),this.parent.off(As,this.refreshImgCellObj),this.parent.off(Ts,this.createImageElement),this.parent.off(Ds,this.deleteImage),this.parent.off(Hs,this.refreshInsDelImagePosition))},e.prototype.insertImage=function(e,t){var r=this;this.binaryStringVal(e).then(function(e){return r.createImageElement({options:{src:e},range:t,isPublic:!0})})},e.prototype.binaryStringVal=function(e){return new Promise(function(t,r){var n=new FileReader;n.readAsDataURL(e.file),n.onload=function(){return t(n.result)},n.onerror=function(e){return r(e)}})},e.prototype.createImageElement=function(e){var r=e.range?e.range.indexOf("!")>0?e.range.split("!")[1]:e.range.split("!")[0]:this.parent.getActiveSheet().selectedRange,n=e.range&&e.range.indexOf("!")>0?ce(this.parent,e.range.split("!")[0]):this.parent.activeSheetIndex,i=this.parent.serviceLocator.getService("shape"),a=e.options.imageId?e.options.imageId:t.getUniqueID(this.parent.element.id+"_overlay_picture_"),o=c(r),s=t.isUndefined(n)?this.parent.getActiveSheet():this.parent.sheets[n];if(!this.parent.element.querySelector("#"+a)){var l={requestType:"beforeInsertImage",range:s.name+"!"+r,imageData:e.options.src,sheetIndex:n};if(e.isPublic&&this.parent.notify("actionBegin",{eventArgs:l,action:"beforeInsertImage"}),!l.cancel){var h=i.insertOverlayElement(a,r,n);h.element.style.backgroundImage="url('"+e.options.src+"')",(e.options.height||e.options.left)&&(h.element.style.height=e.options.height+"px",h.element.style.width=e.options.width+"px",t.isNullOrUndefined(e.options.top)||(h.element.style.top=Number(Qt(e.options.top).toFixed(2))+"px"),t.isNullOrUndefined(e.options.left)||(h.element.style.left=Number(Qt(e.options.left).toFixed(2))+"px")),(s.frozenRows||s.frozenColumns)&&i.adjustFreezePaneSize(e.options,h.element,r);var d={src:e.options.src,id:a,height:parseFloat(h.element.style.height.replace("px","")),width:parseFloat(h.element.style.width.replace("px","")),top:s.frozenRows||s.frozenColumns?o[0]?Ye(s,0,o[0]-1):0:t.isNullOrUndefined(e.options.top)?h.top:e.options.top,left:s.frozenRows||s.frozenColumns?o[1]?Ze(s,0,o[1]-1):0:t.isNullOrUndefined(e.options.left)?h.left:e.options.left};this.parent.setUsedRange(o[0],o[1]),(e.isPublic||e.isUndoRedo)&&this.parent.notify(Qn,{options:[d],range:s.name+"!"+r});var p=Re(o[0],o[1],s);p.image[p.image.length-1].id||(p.image[p.image.length-1].id=d.id),!e.isUndoRedo&&e.isPublic&&(l={requestType:"insertImage",range:s.name+"!"+r,imageHeight:e.options.height?e.options.height:300,imageWidth:e.options.width?e.options.width:400,imageData:e.options.src,id:a,sheetIndex:n},this.parent.notify("actionComplete",{eventArgs:l,action:"insertImage"}))}}},e.prototype.refreshInsDelImagePosition=function(e){for(var t,r,n,i=e.count,a=e.sheetIdx,o=this.parent.sheets[a],s=Re(e.rowIdx,e.colIdx,o),l=s.image.length,h=0;h<l;h++)t=document.getElementById(s.image[h].id),r="Row"===e.type?"insert"===e.status?s.image[h].top+20*i:s.image[h].top-20*i:s.image[h].top,n="Column"===e.type?"insert"===e.status?s.image[h].left+64*i:s.image[h].left-64*i:s.image[h].left,s.image[h].top=r,s.image[h].left=n,t.style.top=r+"px",t.style.left=n+"px"},e.prototype.refreshImgCellObj=function(e){var r,n,i=t.isUndefined(e.sheetIdx)?this.parent.activeSheetIndex:e.sheetIdx,a=Ce(this.parent,i),o=Re(e.prevRowIdx,e.prevColIdx,a),s=Re(e.currentRowIdx,e.currentColIdx,a),l=o?o.image:[],h=l&&l.length?l.length:0;if(o&&o.image&&l.length>0){for(var d=0;d<h;d++)l[d]&&l[d].id===e.id&&((r=l[d]).height=e.currentHeight,r.width=e.currentWidth,r.top=e.currentTop,r.left=e.currentLeft,l.splice(d,1));if(s&&s.image&&(n=s.image,r&&n.push(r)),ke(e.currentRowIdx,e.currentColIdx,a,n?{image:n}:{image:[r]},!0),"imageRefresh"===e.requestType&&!e.isUndoRedo){var p={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:p,action:"imageRefresh"})}}},e.prototype.deleteImage=function(e){var t,r=e.sheet||this.parent.getActiveSheet(),n=document.getElementById(e.id),i=e.rowIdx,a=e.colIdx;if(n){if(void 0===e.rowIdx&&void 0===e.colIdx){var o=void 0,s=void 0;if(r.frozenRows||r.frozenColumns){var l=n.getBoundingClientRect();o={clientY:l.top},s={clientX:l.left},l.top<this.parent.getColumnHeaderContent().getBoundingClientRect().bottom&&(o.target=this.parent.getColumnHeaderContent()),l.left<this.parent.getRowHeaderContent().getBoundingClientRect().right&&(s.target=this.parent.getRowHeaderTable())}else o={clientY:parseFloat(n.style.top),isImage:!0},s={clientX:parseFloat(n.style.left),isImage:!0};this.parent.notify(Ns,o),this.parent.notify(Os,s),i=o.clientY,a=s.clientX}if(t=r.name+"!"+g(i,a),!e.preventEventTrigger){var h={address:t,cancel:!1};if(this.parent.notify(Ar,{action:"deleteImage",eventArgs:h}),h.cancel)return}document.getElementById(e.id).remove()}else if(!e.sheet){var d=e.range?e.range.indexOf("!")>0?e.range.split("!")[1]:e.range.split("!")[0]:this.parent.getActiveSheet().selectedRange,p=e.range&&e.range.indexOf("!")>0?ce(this.parent,e.range.split("!")[0]):this.parent.activeSheetIndex,u=c(d);i=u[0],a=u[1],r=this.parent.sheets[p]}for(var f=Re(i,a,r).image,m={},v=f.length-1;v>=0;v--)f[v].id===e.id&&(m=f.splice(v,1)[0]);ke(i,a,r,{image:f},!0),e.preventEventTrigger||this.parent.notify(Yo,{action:"deleteImage",eventArgs:{address:t,id:m.id,imageData:m.src,imageWidth:m.width,imageHeight:m.height,cancel:!1}})},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.getModuleName=function(){return"spreadsheetImage"},e}();p.Chart.Inject(p.ColumnSeries,p.LineSeries,p.BarSeries,p.AreaSeries,p.StackingColumnSeries,p.StackingLineSeries,p.StackingBarSeries,p.ScatterSeries),p.Chart.Inject(p.StackingAreaSeries,p.Category,p.Legend,p.Tooltip,p.DataLabel),p.AccumulationChart.Inject(p.PieSeries,p.AccumulationTooltip,p.AccumulationDataLabel,p.AccumulationLegend);var Hh=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.addEventListener=function(){this.parent.on(ei,this.initiateChartHandler,this),this.parent.on(Ps,this.refreshChartCellObj,this),this.parent.on(Ms,this.refreshChartCellModel,this),this.parent.on(Oi,this.refreshChartCellObj,this),this.parent.on(ii,this.updateChartHandler,this),this.parent.on(Ls,this.deleteChart,this),this.parent.on(Vs,this.clearBorder,this),this.parent.on(_s,this.insertChartHandler,this),this.parent.on(zs,this.chartRangeHandler,this),this.parent.on(Ws,this.chartDesignTabHandler,this),this.parent.on(Gs,this.updateChartElement,this),this.parent.on(Ys,this.undoRedoForChartDesign,this)},e.prototype.insertChartHandler=function(e){var t=this,r="Column",n=!1;switch(e.id){case"clusteredColumn":r="Column";break;case"stackedColumn":r="StackingColumn";break;case"stackedColumn100":r="StackingColumn100";break;case"clusteredBar":r="Bar";break;case"stackedBar":r="StackingBar";break;case"stackedBar100":r="StackingBar100";break;case"area":r="Area";break;case"stackedArea":r="StackingArea";break;case"stackedArea100":r="StackingArea100";break;case"line":r="Line";break;case"lineMarker":r="Line",n=!0;break;case"stackedLine":r="StackingLine";break;case"stackedLineMarker":r="StackingLine",n=!0;break;case"stackedLine100":r="StackingLine100";break;case"stackedLine100Marker":r="StackingLine100",n=!0;break;case"pie":r="Pie";break;case"doughnut":r="Doughnut";break;case"scatter":r="Scatter"}var i=[{type:r,markerSettings:{visible:n,isFilled:!0}}];e.isChart?(this.parent.notify(Jn,{chart:i}),tt(function(){return Wt(t.parent.element)})):this.parent.notify(Ws,{chartType:r,triggerEvent:!0,markerVisible:n})},e.prototype.chartRangeHandler=function(){var e=document.querySelector(".e-datavisualization-chart.e-ss-overlay-active");if(e)for(var t=e.getElementsByClassName("e-control")[0].id,r=this.parent.chartColl,n=r.length,i=0;i<n;i++){var a=document.getElementById(r[i].id);e&&a&&r[i].id===t&&this.parent.notify(ei,{option:r[i],isRefresh:!0})}},e.prototype.updateChartHandler=function(e){var r=this.initiateChartHandler({option:e.chart,isRefresh:!0}),n=this.parent.element.querySelector("."+e.chart.id);if(n){var i=t.getComponent(n,"chart");t.isNullOrUndefined(i)&&(i=t.getComponent(n,"accumulationchart")),i.series=r,i.refresh()}},e.prototype.refreshChartCellModel=function(e){for(var t=0,r=e.prevChartIndexes.length;t<r;t++){var n=e.prevChartIndexes[t].chart,i=e.prevChartIndexes[t].chartRowIdx,a=e.prevChartIndexes[t].chartColIdx,o=e.currentChartIndexes[t].chartRowIdx,s=e.currentChartIndexes[t].chartColIdx,l={prevTop:n.top,prevLeft:n.left,prevRowIdx:i,prevColIdx:a,prevHeight:n.height,prevWidth:n.width,currentTop:n.top,currentLeft:n.left,currentRowIdx:o,currentColIdx:s,currentHeight:n.height,currentWidth:n.width,id:n.id,requestType:"chartRefreshOnFilter"};this.parent.notify(Ps,l)}},e.prototype.refreshChartCellObj=function(e){var r,n,i=t.isUndefined(e.sheetIdx)?this.parent.activeSheetIndex:e.sheetIdx,a=Ce(this.parent,i),o=Re(e.prevRowIdx,e.prevColIdx,a),s=Re(e.currentRowIdx,e.currentColIdx,a),l=o?o.chart:[],h=l&&l.length?l.length:0;if(h){for(var d=0;d<h;d++)if(l[d].id===e.id.split("_overlay")[0]){(r=l[d]).height=e.currentHeight,r.width=e.currentWidth,r.top=e.currentTop,r.left=e.currentLeft,l.splice(d,1);for(var p=0,c=this.parent.chartColl.length;p<c;p++)r.id===this.parent.chartColl[p].id&&(r.height=e.currentHeight,this.parent.chartColl[p].width=e.currentWidth,this.parent.chartColl[p].top=e.currentTop,this.parent.chartColl[p].left=e.currentLeft)}if(s&&s.chart&&(n=s.chart,r&&n.push(r)),ke(e.currentRowIdx,e.currentColIdx,a,n?{chart:n}:{chart:[r]},!0),"chartRefresh"===e.requestType&&!e.isUndoRedo){var u={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:i};this.parent.notify("actionComplete",{eventArgs:u,action:"chartRefresh"})}}},e.prototype.processChartRange=function(e,r,n){var i,a,o,s,l=this,h=e[0],d=e[1],p=!1,c=e[2],u=e[3],f=h===c,g=d===u,m=function(e,r,n,i){var a=Re(e,r,Ce(l.parent,n));if(a){var o=void 0;if(a.format){var h={value:a.value,format:a.format,formattedText:a.value,cell:a,rowIndex:e,colIndex:r};l.parent.notify(Mr,h);var d=D(a.value);if(d&&!Te(a.format,!0,null,!0)){var p=new RegExp("[!@#$%^&()+=';,{}|\":<>~_-]","g");h.formattedText=h.formattedText.toString().replace(p,""),o=parseInt(h.formattedText.toString(),10)}else i&&d&&(s=!0),o=h.formattedText&&h.formattedText.toString()}else o=a.value;return t.isNullOrUndefined(o)?"":o}return""},v=m(h,u,r,!0),y=m(c,d,r),C=m(h,d,r);return D(y)&&C||(p=!0),!t.isNullOrUndefined(C)&&("Scatter"!==n.type||n.isSeriesInRows)||f||g?t.isNullOrUndefined(y)||!p||f||g||s?(a=[h,d,c,u],t.isNullOrUndefined(v)||D(v)||s?t.isNullOrUndefined(C)&&(f||g)&&(o=[h,d,h,u],f?(a[1]=a[1]+1,o[3]=o[1]):a[0]=a[0]+1):(o=[h,d,h,u],a[0]=a[0]+1)):t.isNullOrUndefined(v)||D(v)&&C?(i=[h,d,c,d],a=[h,d+1,c,u]):(i=[h+1,d,c,d],a=[h+1,d+1,c,u],o=[h,d+1,h,u]):(i=[h+1,d,c,d],a=[h+1,d+1,c,u],o=[h,d+1,h,u]),{xRange:i,yRange:a,lRange:o,isStringSeries:p}},e.prototype.toIntrnlRange=function(e,t){return e?"string"==typeof e&&(e=c[""+e]):e=c[this.parent.sheets[t].selectedRange],e},e.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},e.prototype.pushRowData=function(e,t,r,n,i,a,o,s,l){for(var h,d=r,p=this.parent.sheets[e.sheetIdx];t<=n;)if(je(p,t))t++;else{for(r=d;r<=i;)if(Qe(p,r))r++;else{var c=Re(t,r,p,!1,!0);if(c.format&&!l){var u={value:c.value,format:c.format,formattedText:c.value,rowIndex:t,colIndex:r,cell:c};this.parent.notify(Mr,u),h=u.formattedText?u.formattedText.toString():null}else h=c.value||(0===c.value?0:null);a.push({value:h}),r++}t++}o.push(t)},e.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},e.prototype.getVirtualXValues=function(e){for(var t=1,r=[];t<e;)r.push(t.toString()),t++;return r},e.prototype.processChartSeries=function(e,r,n,i,a){e=e||{};var o,s,l,h,d,p,c="",u={},f={},g=0,m=0,v=[];r=t.isNullOrUndefined(r)?this.parent.getActiveSheet().index:r;var y=this.parent.sheets[r],C=this.getRangeData({range:i,sheetIdx:r,skipFormula:!0,isYvalue:!0}),b=i[2]-i[0]+1-this.parent.hiddenCount(i[0],i[2],"rows",y),x=i[3]-i[1]+1-this.parent.hiddenCount(i[1],i[3],"columns",y);e.isSeriesInRows?(s=a?this.toArrayData(this.getRangeData({range:a,sheetIdx:r,skipFormula:!1,isYvalue:!1})):this.getVirtualXValues(x+1),n&&(l=this.toArrayData(this.getRangeData({range:n,sheetIdx:r,skipFormula:!1,isYvalue:!1}))),h=b):(s=n?this.toArrayData(this.getRangeData({range:n,sheetIdx:r,skipFormula:!1,isYvalue:!1})):this.getVirtualXValues(b+1),a&&(l=this.toArrayData(this.getRangeData({range:a,sheetIdx:r,skipFormula:!1,isYvalue:!1}))),h=x);var S=s.length,w=e.isSeriesInRows?1:h;for(t.isNullOrUndefined(e.dataLabelSettings)||(u.visible=e.dataLabelSettings.visible,u.position=e.dataLabelSettings.position);g<h;){for(p=0,d=[],m=e.isSeriesInRows?m:g;p<S;){if(C[m]){if(o=C[m].value,D(o))o=Number(o);else{var I={value:t.isNullOrUndefined(o)?"":o.toString(),sheetIndex:r,updatedVal:""};this.parent.notify(Wr,I),o=I.isDate||I.isTime?I.updatedVal:0}t.isNullOrUndefined(s[p])&&!t.isNullOrUndefined(o)&&(s[p]=t.getUniqueID("spread-chart-empty-label-")),d.push({x:s[p],y:o})}m+=w,p++}if(c=l&&l.length>0?l[g]:"Scatter"===e.type?"series"+(g+1):"series"+g,t.isNullOrUndefined(c)&&(c=""),e.type){var E=e.type;if("Line"===E||"StackingLine"===E||"StackingLine100"===E)f={dataSource:d,type:e.type,xName:"x",yName:"y",name:c.toString(),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}};else if("Scatter"===E)f={dataSource:d,type:e.type,xName:"x",yName:"y",name:c.toString(),marker:{visible:!1,width:12,height:12,shape:"Circle",dataLabel:u}};else if("Pie"===E||"Doughnut"===E){var R="Pie"===e.type?"0%":"40%",k=u.visible,F=t.isNullOrUndefined(u.position)?"Inside":"Outer"===u.position?"Outside":"Inside";f={dataSource:d,dataLabel:{visible:!t.isNullOrUndefined(k)&&k,position:F,name:"text",font:{fontWeight:"600"}},radius:"100%",xName:"x",yName:"y",innerRadius:R}}else f={dataSource:d,type:e.type,xName:"x",yName:"y",name:c.toString(),marker:{dataLabel:u}}}v.push(f),g++}var A;return e.type&&(A={series:v,xRange:e.isSeriesInRows?a:n,yRange:i,lRange:e.isSeriesInRows?n:a}),A},e.prototype.primaryYAxisFormat=function(e){var r="";if(!t.isNullOrUndefined(e)){var n=Re(e[0],e[1],this.parent.getActiveSheet());n&&n.format&&(r=n.format)}return r},e.prototype.focusChartRange=function(e,t,r){var n=["e-rcborderright","e-rcborderbottom","e-vcborderright","e-vcborderbottom","e-bcborderright","e-bcborderbottom"];this.clearBorder();var i,a=this.parent.getActiveSheet(),o=!(!a.frozenRows&&!a.frozenColumns);r&&(o?i=r:this.parent.notify(Us,{startcell:{rowIndex:r[0],colIndex:r[1]},endcell:{rowIndex:r[2],colIndex:r[3]},classes:[n[0],n[1]]})),e&&(o?i?(i[0]=Math.min(r[0],e[0]),i[1]=Math.min(r[1],e[1]),i[2]=Math.max(r[2],e[2]),i[3]=Math.max(r[3],e[3])):i=e:this.parent.notify(Us,{startcell:{rowIndex:e[0],colIndex:e[1]},endcell:{rowIndex:e[2],colIndex:e[3]},classes:[n[2],n[3]]})),o&&i?this.parent.notify(Us,{startcell:{rowIndex:Math.min(i[0],t[0]),colIndex:Math.min(i[1],t[1])},endcell:{rowIndex:Math.max(i[2],t[2]),colIndex:Math.max(i[3],t[3])},classes:[n[4],n[5]]}):this.parent.notify(Us,{startcell:{rowIndex:t[0],colIndex:t[1]},endcell:{rowIndex:t[2],colIndex:t[3]},classes:[n[4],n[5]]})},e.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){t.detach(e)})}else for(var r=this.parent.getMainContent(),n=["e-rcborderright","e-rcborderbottom","e-vcborderright","e-vcborderbottom","e-bcborderright","e-bcborderbottom"],i=0,a=n.length;i<a;i++)for(var o=r.querySelectorAll("."+n[i]),s=0,l=o.length;s<l;s++){o[s].classList.remove(n[i])}},e.prototype.initiateChartHandler=function(e){var r=this,n=e.option,i=!0;i=!!t.isNullOrUndefined(e.isInitCell)||!e.isInitCell,e.triggerEvent=!!t.isNullOrUndefined(e.triggerEvent)||e.triggerEvent;e.isRefresh=!t.isNullOrUndefined(e.isRefresh)&&e.isRefresh;var a,o,s=n.range&&n.range.indexOf("!")>0?ce(this.parent,n.range.split("!")[0]):this.parent.activeSheetIndex,l=Ce(this.parent,s),h=n.range?n.range:this.parent.getActiveSheet().selectedRange,d=c(h),u={};if(this.parent.allowChart||!l.isProtected){var f={sheetIndex:s,reqType:"shape",type:"actionBegin",shapeType:"chart",action:"create",options:n,range:h,operation:"create"};if(u=f.options,h=f.range,u=u||{},d.length>0){d[2]-d[0]<d[3]-d[1]&&(a=!0)}u.isSeriesInRows=!!a||!!u.isSeriesInRows&&u.isSeriesInRows,e.dataSheetIdx=t.isNullOrUndefined(e.dataSheetIdx)?s:e.dataSheetIdx;var g=this.processChartRange(d,e.dataSheetIdx,u),m=g.xRange,v=g.yRange,y=g.lRange;if(s===this.parent.activeSheetIndex&&i&&this.focusChartRange(m,v,y),e.triggerEvent&&!e.isRefresh){if(o={type:n.type,theme:n.theme,isSeriesInRows:n.isSeriesInRows,range:n.range,markerSettings:u.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(Ar,{eventArgs:o,action:"beforeInsertChart"}),o.cancel)return[];n.type=o.type,n.theme=o.theme,n.isSeriesInRows=o.isSeriesInRows,n.markerSettings=o.markerSettings,n.range=o.range,n.id=o.id,n.height=o.height,n.width=o.width}var C=this.processChartSeries(u,e.dataSheetIdx,m,v,y),b={majorGridLines:n.primaryXAxis&&n.primaryXAxis.majorGridLines&&!t.isNullOrUndefined(n.primaryXAxis.majorGridLines.width)?{width:n.primaryXAxis.majorGridLines.width}:{width:0},minorGridLines:n.primaryXAxis&&n.primaryXAxis.minorGridLines&&!t.isNullOrUndefined(n.primaryXAxis.minorGridLines.width)?{width:n.primaryXAxis.minorGridLines.width}:{width:0},minorTicksPerInterval:n.primaryXAxis&&n.primaryXAxis.minorGridLines&&n.primaryXAxis.minorGridLines.width>0?5:0,lineStyle:{width:0},valueType:"Scatter"!==n.type||g.isStringSeries||n.isSeriesInRows?"Category":"Double",rangePadding:"Scatter"!==n.type||g.isStringSeries||n.isSeriesInRows?"Auto":"Round",visible:!n.primaryXAxis||n.primaryXAxis.visible,title:n.primaryXAxis?n.primaryXAxis.title:"",edgeLabelPlacement:"Shift"},x={lineStyle:{width:0},majorGridLines:n.primaryYAxis&&n.primaryYAxis.majorGridLines&&!t.isNullOrUndefined(n.primaryYAxis.majorGridLines.width)?{width:n.primaryYAxis.majorGridLines.width}:{width:1},minorGridLines:n.primaryYAxis&&n.primaryYAxis.minorGridLines&&!t.isNullOrUndefined(n.primaryYAxis.minorGridLines.width)?{width:n.primaryYAxis.minorGridLines.width}:{width:0},minorTicksPerInterval:n.primaryYAxis&&n.primaryYAxis.minorGridLines&&n.primaryYAxis.minorGridLines.width>0?5:0,visible:!n.primaryYAxis||n.primaryYAxis.visible,title:n.primaryYAxis?n.primaryYAxis.title:"",edgeLabelPlacement:"Shift"};if(e.isRefresh){if(e.isSwitchRowColumn&&"Scatter"===n.type){var w=this.parent.element.querySelector("."+n.id);if(w){t.getComponent(w,"chart").primaryXAxis.valueType=g.isStringSeries||n.isSeriesInRows?"Category":"Double"}}return C.series}var I=n.id+"_overlay",E=this.parent.serviceLocator.getService("shape"),R=!t.isNullOrUndefined(e.isInitCell)&&e.isInitCell?e.range:h,k=E.insertOverlayElement(I,R,S(this.parent,R));k.element.classList.add("e-datavisualization-chart"),k.element.style.width=n.width+"px",k.element.style.height=n.height+"px",l.frozenRows||l.frozenColumns?E.adjustFreezePaneSize(n,k.element,R):(t.isNullOrUndefined(n.top)?n.top=k.top:k.element.style.top=Number(Qt(n.top).toFixed(2))+"px",t.isNullOrUndefined(n.left)?n.left=k.left:k.element.style.left=Number(Qt(n.left).toFixed(2))+"px"),this.parent.notify(rl,{height:n.height,width:n.width});var F="Pie"===n.type||"Doughnut"===n.type?{position:"Bottom",visible:!0}:{};t.isNullOrUndefined(n.legendSettings)||(F.visible=n.legendSettings.visible,F.position=n.legendSettings.position);var A=this.parent.createElement("div",{id:n.id,className:n.id}),N=n.theme||"Material",O=this.primaryYAxisFormat(v),T=2*Math.round(parseFloat(getComputedStyle(k.element).borderWidth)),L=parseFloat(k.element.style.height)-(isNaN(T)?0:T)+"px";"Pie"!==n.type&&"Doughnut"!==n.type?(this.chart=new p.Chart({primaryXAxis:b,primaryYAxis:x,background:this.getThemeBgColor(N),chartArea:{border:{width:0}},title:n.title,legendSettings:F,theme:N,series:C.series,tooltip:{enable:!0},width:k.element.style.width,height:L,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&&O&&!t.isNullOrUndefined(e.value)&&r.parent?e.text=r.parent.getDisplayText({format:O,value:e.value.toString()}):"primaryXAxis"===e.axis.name&&e.text.startsWith("spread-chart-empty-label-")&&(e.text=""),"primaryXAxis"===e.axis.name&&"Scatter"===n.type&&e.axis.labels.length>0&&(e.text=D(e.text)?e.text:(e.axis.labels.indexOf(e.text)+1).toString())}}),this.chart.appendTo(A)):(this.chart=new p.AccumulationChart({title:n.title,legendSettings:F,theme:N,background:this.getThemeBgColor(N),series:C.series,width:k.element.style.width,height:L,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(A)),k.element.appendChild(A),k.element.classList.contains("e-ss-overlay-active")&&this.parent.notify(js,{id:k.element.id}),e.triggerEvent&&this.parent.notify(Yo,{eventArgs:o,action:"insertChart"})}},e.prototype.deleteChart=function(e){this.clearBorder();var r=null,n=this.parent.getActiveSheet();if(t.isNullOrUndefined(e.id)?(r=document.querySelector(".e-datavisualization-chart.e-ss-overlay-active"),e.id=r?r.getElementsByClassName("e-control")[0].id:null):(e.id=e.id.includes("overlay")?e.id:e.id+"_overlay",r=document.getElementById(e.id)),!t.isNullOrUndefined(e.id)){e.id=e.id.includes("overlay")?e.id:e.id+"_overlay";for(var i,a,o,s,l=!1,h=0,d=this.parent.chartColl.length;h<d;h++)if(this.parent.chartColl[h].id===e.id.split("_overlay")[0]){s=this.parent.chartColl[h];break}var p={id:s.id,range:s.range,type:s.type,markerSettings:s.markerSettings,theme:s.theme,height:s.height,width:s.width,isSeriesInRows:s.isSeriesInRows,isInitCell:!0,posRange:null,top:s.top,left:s.left,cancel:!1};if(r){var u=void 0,f=void 0;if(n.frozenRows||n.frozenColumns){var m=r.getBoundingClientRect();u={clientY:m.top},f={clientX:m.left},m.top<this.parent.getColumnHeaderContent().getBoundingClientRect().bottom&&(u.target=this.parent.getColumnHeaderContent()),m.left<this.parent.getRowHeaderContent().getBoundingClientRect().right&&(f.target=this.parent.getRowHeaderTable())}else u={clientY:parseFloat(r.style.top),isImage:!0},f={clientX:parseFloat(r.style.left),isImage:!0};this.parent.notify(ai,{id:e.id}),this.parent.notify(Ns,u),this.parent.notify(Os,f),l=!0,i=u.clientY,a=f.clientX,n=this.parent.sheets[this.parent.activeSheetIndex]}else{this.parent.notify(ai,{id:e.id});var v=e.range&&e.range.indexOf("!")>0?ce(this.parent,e.range.split("!")[0]):this.parent.activeSheetIndex,y=c(e.range?e.range.indexOf("!")>0?e.range.split("!")[1]:e.range.split("!")[0]:this.parent.getActiveSheet().selectedRange);i=y[0],a=y[1],n=this.parent.sheets[v]}var C=Re(i,a,n);C&&(o=C.chart);var b=o?o.length:null;for(h=0;h<b;h++)e.id===o[h].id+"_overlay"&&o.splice(h,1);l&&(document.getElementById(e.id).remove(),this.parent.notify(qs,{})),ke(i,a,n,{chart:o},!0),p.posRange=g(i,a),e.isUndoRedo||this.parent.notify(Yo,{eventArgs:p,action:"deleteChart"})}},e.prototype.updateChartModel=function(e,r,n,i,a){var o=r;r=r;var s=this.parent.chartColl[i].id;if(!(a&&["PHAxes","PVAxes","PHAxisTitle","PVAxisTitle","GLMajorHorizontal","GLMajorVertical","GLMinorHorizontal","GLMinorVertical"].indexOf(e)>-1))for(var l=0,h=n.chart.length;l<h;l++)if(n.chart[l].id===s)switch(e){case"PHAxes":case"PHAxisTitle":t.isNullOrUndefined(n.chart[l].primaryXAxis)&&(n.chart[l].primaryXAxis={},this.parent.chartColl[i].primaryXAxis={}),"PHAxes"===e?(n.chart[l].primaryXAxis.visible=r.primaryXAxis.visible,this.parent.chartColl[i].primaryXAxis.visible=r.primaryXAxis.visible):"PHAxisTitle"===e&&(n.chart[l].primaryXAxis.title=r.primaryXAxis.title,this.parent.chartColl[i].primaryXAxis.title=r.primaryXAxis.title);break;case"PVAxes":case"PVAxisTitle":t.isNullOrUndefined(n.chart[l].primaryYAxis)&&(n.chart[l].primaryYAxis={},this.parent.chartColl[i].primaryYAxis={}),"PVAxes"===e?(n.chart[l].primaryYAxis.visible=r.primaryYAxis.visible,this.parent.chartColl[i].primaryYAxis.visible=r.primaryYAxis.visible):"PVAxisTitle"===e&&(n.chart[l].primaryYAxis.title=r.primaryYAxis.title,this.parent.chartColl[i].primaryYAxis.title=r.primaryYAxis.title);break;case"ChartTitleNone":case"ChartTitleAbove":n.chart[l].title=r.title,this.parent.chartColl[i].title=r.title;break;case"DLNone":case"DLCenter":case"DLInsideend":case"DLInsidebase":case"DLOutsideend":if(t.isNullOrUndefined(n.chart[l].dataLabelSettings)&&(n.chart[l].dataLabelSettings={},this.parent.chartColl[i].dataLabelSettings={}),"DLNone"===e)n.chart[l].dataLabelSettings.visible=!1,this.parent.chartColl[i].dataLabelSettings.visible=!1;else{n.chart[l].dataLabelSettings.visible=!0,this.parent.chartColl[i].dataLabelSettings.visible=!0;var d=void 0;d=a?"Outside"===o.series[0].dataLabel.position?"Outer":"Middle":r.series[0].marker.dataLabel.position,n.chart[l].dataLabelSettings.position=d,this.parent.chartColl[i].dataLabelSettings.position=d}break;case"GLMajorHorizontal":t.isNullOrUndefined(n.chart[l].primaryYAxis)&&(n.chart[l].primaryYAxis={},this.parent.chartColl[i].primaryYAxis={}),t.isNullOrUndefined(n.chart[l].primaryYAxis.majorGridLines)&&(n.chart[l].primaryYAxis.majorGridLines={},this.parent.chartColl[i].primaryYAxis.majorGridLines={}),n.chart[l].primaryYAxis.majorGridLines.width=r.primaryYAxis.majorGridLines.width,this.parent.chartColl[i].primaryYAxis.majorGridLines.width=r.primaryYAxis.majorGridLines.width;break;case"GLMajorVertical":t.isNullOrUndefined(n.chart[l].primaryXAxis)&&(n.chart[l].primaryXAxis={},this.parent.chartColl[i].primaryXAxis={}),t.isNullOrUndefined(n.chart[l].primaryXAxis.majorGridLines)&&(n.chart[l].primaryXAxis.majorGridLines={},this.parent.chartColl[i].primaryXAxis.majorGridLines={}),n.chart[l].primaryXAxis.majorGridLines.width=r.primaryXAxis.majorGridLines.width,this.parent.chartColl[i].primaryXAxis.majorGridLines.width=r.primaryXAxis.majorGridLines.width;break;case"GLMinorHorizontal":t.isNullOrUndefined(n.chart[l].primaryYAxis)&&(n.chart[l].primaryYAxis={},this.parent.chartColl[i].primaryYAxis={}),t.isNullOrUndefined(n.chart[l].primaryYAxis.minorGridLines)&&(n.chart[l].primaryYAxis.minorGridLines={},this.parent.chartColl[i].primaryYAxis.minorGridLines={}),n.chart[l].primaryYAxis.minorGridLines.width=r.primaryYAxis.minorGridLines.width,this.parent.chartColl[i].primaryYAxis.minorGridLines.width=r.primaryYAxis.minorGridLines.width;break;case"GLMinorVertical":t.isNullOrUndefined(n.chart[l].primaryXAxis)&&(n.chart[l].primaryXAxis={},this.parent.chartColl[i].primaryXAxis={}),t.isNullOrUndefined(n.chart[l].primaryXAxis.minorGridLines)&&(n.chart[l].primaryXAxis.minorGridLines={},this.parent.chartColl[i].primaryXAxis.minorGridLines={}),n.chart[l].primaryXAxis.minorGridLines.width=r.primaryXAxis.minorGridLines.width,this.parent.chartColl[i].primaryXAxis.minorGridLines.width=r.primaryXAxis.minorGridLines.width;break;case"LegendNone":case"LegendsRight":case"LegendsLeft":case"LegendsBottom":case"LegendsTop":if(t.isNullOrUndefined(n.chart[l].legendSettings)&&(n.chart[l].legendSettings={},this.parent.chartColl[i].legendSettings={}),n.chart[l].legendSettings.visible=r.legendSettings.visible,this.parent.chartColl[i].legendSettings.visible=r.legendSettings.visible,"LegendNone"!==e){n.chart[l].legendSettings.position=r.legendSettings.position,this.parent.chartColl[i].legendSettings.position=r.legendSettings.position;break}}},e.prototype.updateChartElement=function(e,t,r,n,i,a,o,s){if(!(a&&["PHAxes","PVAxes","PHAxisTitle","PVAxisTitle","GLMajorHorizontal","GLMajorVertical","GLMinorHorizontal","GLMinorVertical"].indexOf(e)>-1)){var l;switch(e){case"PHAxes":(t=t).primaryXAxis.visible=!t.primaryXAxis.visible;break;case"PVAxes":(t=t).primaryYAxis.visible=!t.primaryYAxis.visible;break;case"PHAxisTitle":(t=t).primaryXAxis.title=i;break;case"PVAxisTitle":(t=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(t=t,l=t.series,"DLNone"===e)for(var h=0,d=l.length;h<d;h++)a?l[h].dataLabel.visible=!1:l[h].marker.dataLabel.visible=!1;else for(h=0,d=l.length;h<d;h++)if(a){var p="DLOutsideend"===e?"Outside":"Inside";l[h].dataLabel.visible=!0,l[h].dataLabel.position=p}else{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,a&&t.refresh();break;case"GLMajorHorizontal":(t=t).primaryYAxis.majorGridLines.width=0===t.primaryYAxis.majorGridLines.width?1:0;break;case"GLMajorVertical":(t=t).primaryXAxis.majorGridLines.width=0===t.primaryXAxis.majorGridLines.width?1:0;break;case"GLMinorHorizontal":(t=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=t).primaryXAxis.minorTicksPerInterval=0===t.primaryXAxis.minorGridLines.width?5:0,t.primaryXAxis.minorGridLines.width=0===t.primaryXAxis.minorGridLines.width?1:0;break;case"LegendNone":t.legendSettings.visible=!1;break;case"LegendsRight":case"LegendsLeft":case"LegendsBottom":case"LegendsTop":t.legendSettings.visible=!0,t.legendSettings.position="LegendsRight"===e?"Right":"LegendsLeft"===e?"Left":"LegendsBottom"===e?"Bottom":"LegendsTop"===e?"Top":t.legendSettings.position}if(this.updateChartModel(e,t,r,n,a),s){var c={addChartEle:e,id:t.element.id+"_overlay",title:i,address:o};this.parent.notify(Yo,{action:"chartDesign",eventArgs:c})}}},e.prototype.undoRedoForChartDesign=function(e){var r=document.getElementById(e.id);if(r){var n=this.getChartElement(r),i=t.getComponent(n,"chart");t.isNullOrUndefined(i)&&(i=t.getComponent(n,"accumulationchart"));for(var a,o=this.parent.getAddressInfo(e.address),s=Re(o.indices[0],o.indices[1],Ce(this.parent,o.sheetIndex)),l=this.getChartCollectionId(n.id),h=e.addChartEle,d=e.title,p=0;p<e.beforeActionData.cellDetails[0].chart.length;p++)if(n.id===e.beforeActionData.cellDetails[0].chart[p].id){a=e.beforeActionData.cellDetails[0].chart[p];break}var c=!t.isNullOrUndefined(a.markerSettings)&&a.markerSettings.visible;if(e.switchRowColumn)this.switchRowColumn(l,n.id,i,s);else if(e.chartTheme)this.switchChartTheme(l,n.id,e.isUndo?a.theme:e.chartTheme,i,s);else if(e.chartType)this.switchChartType(l,n.id,e.isUndo?a.type:e.chartType,i,s,!1,e.isUndo?c:e.chartMarker,"undoRedo");else if(e.addChartEle){if(e.isUndo){var u=void 0;switch(h){case"DLNone":case"DLCenter":case"DLInsideend":case"DLInsidebase":case"DLOutsideend":h="Middle"===(u=a.dataLabelSettings&&a.dataLabelSettings.position)?"DLCenter":"Top"===u?"DLInsideend":"Bottom"===u?"DLInsidebase":"Outer"===u?"DLOutsideend":"DLNone";break;case"LegendNone":case"LegendsRight":case"LegendsLeft":case"LegendsBottom":case"LegendsTop":a.legendSettings&&!a.legendSettings.visible?u="LegendNone":h="Right"===(u=a.legendSettings&&a.legendSettings.position)?"LegendsRight":"Left"===u?"LegendsLeft":"Bottom"===u?"LegendsBottom":"Top"===u?"LegendsTop":"LegendsBottom";break;case"PVAxisTitle":d=a.primaryYAxis&&a.primaryYAxis.title;break;case"PHAxisTitle":d=a.primaryXAxis&&a.primaryXAxis.title;break;case"ChartTitleNone":case"ChartTitleAbove":d=a.title}}this.updateChartElement(h,i,s,l,d,null,e.address)}}},e.prototype.chartDesignTabHandler=function(e){var r=!1,n=this.parent.sheets[this.parent.activeSheetIndex],i=e.switchRowColumn,a=e.chartType,o=e.chartTheme,s=e.addChartEle,l=null,h=e.id?document.getElementById(e.id):document.querySelector(".e-datavisualization-chart.e-ss-overlay-active");if(h){var d,p,c="ChartTitleAbove"===s||"PHAxisTitle"===s||"PVAxisTitle"===s;if(n.frozenRows||n.frozenColumns){var u=h.getBoundingClientRect();d={clientY:u.top},p={clientX:u.left},u.top<this.parent.getColumnHeaderContent().getBoundingClientRect().bottom&&(d.target=this.parent.getColumnHeaderContent()),u.left<this.parent.getRowHeaderContent().getBoundingClientRect().right&&(p.target=this.parent.getRowHeaderTable())}else d={clientY:h.offsetTop,isImage:!0},p={clientX:h.offsetLeft,isImage:!0};this.parent.notify(Ns,d),this.parent.notify(Os,p);var f=Re(d.clientY,p.clientX,n),m=n.name+"!"+g(d.clientY,p.clientX);if(e.triggerEvent){var v={switchRowColumn:e.switchRowColumn,chartType:e.chartType,chartTheme:e.chartTheme,addChartEle:e.addChartEle,id:h.id,address:m,cancel:!1};if(this.parent.notify(Ar,{action:"chartDesign",eventArgs:v}),v.cancel)return}var y=this.getChartElement(h),C=y.getAttribute("id"),b=this.getChartCollectionId(C);if(y&&(l=t.getComponent(y,"chart"),t.isNullOrUndefined(l)&&(l=t.getComponent(y,"accumulationchart"),r=!0)),i&&!r&&this.switchRowColumn(b,C,l,f),a&&this.switchChartType(b,C,a,l,f,e.markerVisible),o&&this.switchChartTheme(b,C,o,l,f),s)if(c&&!e.title){if(this.parent.element.getElementsByClassName("e-title-dlg").length>0)return;this.titleDlgHandler(s,l,f,b,r,m,e.triggerEvent)}else this.updateChartElement(s,l,f,b,e.title,r);if(e.triggerEvent&&!c){v={switchRowColumn:e.switchRowColumn,chartType:e.chartType,chartMarker:e.markerVisible,chartTheme:e.chartTheme,addChartEle:e.addChartEle,id:h.id,address:m};this.parent.notify(Yo,{action:"chartDesign",eventArgs:v})}}},e.prototype.switchRowColumn=function(e,r,n,i){this.parent.chartColl[e].isSeriesInRows=!!t.isNullOrUndefined(this.parent.chartColl[e].isSeriesInRows)||!this.parent.chartColl[e].isSeriesInRows;for(var a=0,o=i.chart.length;a<o;a++)i.chart[a].id===r&&(i.chart[a].isSeriesInRows=this.parent.chartColl[e].isSeriesInRows);var s=this.initiateChartHandler({option:this.parent.chartColl[e],isRefresh:!0,isSwitchRowColumn:!0});n.series=s},e.prototype.switchChartTheme=function(e,t,r,n,i){this.parent.chartColl[e].theme=r;for(var a=0,o=i.chart.length;a<o;a++)i.chart[a].id===t&&(i.chart[a].theme=r);n.setProperties({theme:r,background:this.getThemeBgColor(r)},!0),n.refresh()},e.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"Material3Dark":t="#1C1B1F"}else t=e.includes("HighContrast")?"#000000":"#FFFFFF";return t},e.prototype.switchChartType=function(e,r,n,i,a,o,s,l){var h=this.parent.chartColl[e].type;this.parent.chartColl[e].type=n;for(var d=0,p=a.chart.length;d<p;d++)a.chart[d].id===r&&(a.chart[d].type=n,t.isNullOrUndefined(a.chart[d].markerSettings)||(a.chart[d].markerSettings.visible=o));if("Pie"!==n&&"Doughnut"!==n)if("Pie"===h||"Doughnut"===h)this.changeCharType(e);else{if(h!==n)if("Scatter"===n){var c=i.primaryXAxis.labels;c&&c.length>0&&D(c[c.length-1])&&(i.primaryXAxis.valueType="Double")}else"Double"===i.primaryXAxis.valueType&&(i.primaryXAxis.valueType="Category");for(var u=i.series,f="Line"===n||"StackingLine"===n||"StackingLine100"===n,g=(d=0,u.length);d<g;d++)u[d].type=n,f?(u[d].marker.visible=o,u[d].marker.shape=t.isNullOrUndefined(u[d].marker.shape)?"Circle":u[d].marker.shape,"undoRedo"===l&&(u[d].marker.visible=s)):u[d].marker.visible=!1;i.series=u,i.refresh()}else if("Pie"===h||"Doughnut"===h){for(d=0,g=(u=i.series).length;d<g;d++)u[d].innerRadius="Pie"===n?"0%":"40%";i.series=u,i.refresh()}else this.changeCharType(e)},e.prototype.getChartElement=function(e){var r=e.querySelector(".e-chart");return t.isNullOrUndefined(r)&&(r=e.querySelector(".e-accumulationchart")),r},e.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},e.prototype.changeCharType=function(e){var r=document.getElementById(this.parent.chartColl[e].id),n=t.closest(r,".e-datavisualization-chart");n.remove(),this.parent.notify(ei,{option:this.parent.chartColl[e],isInitCell:!1,triggerEvent:!1,isPaste:!1}),r=document.getElementById(this.parent.chartColl[e].id),(n=t.closest(r,".e-datavisualization-chart")).classList.contains("e-ss-overlay-active")||n.classList.add("e-ss-overlay-active")},e.prototype.titleDlgHandler=function(e,t,r,n,i,a,o){var s=this,l="";if(!i||"PHAxisTitle"!==e&&"PVAxisTitle"!==e){var h=this.parent.serviceLocator.getService(Fl),d=this.parent.serviceLocator.getService(Al);d.show({width:375,showCloseIcon:!0,isModal:!0,cssClass:"e-title-dlg",header:"chart_abovechart"===e?h.getConstant("ChartTitle"):"PHAxisTitle"===e?h.getConstant("HorizontalAxisTitle"):h.getConstant("VerticalAxisTitle"),beforeOpen:function(){d.dialogInstance.content=s.titleDlgContent(e,t),d.dialogInstance.dataBind(),s.parent.element.focus()},buttons:[{buttonModel:{content:h.getConstant("Ok"),isPrimary:!0,cssClass:"e-btn e-clearall-btn e-flat"},click:function(){var i=s.parent.element.querySelector(".e-title-dlg").getElementsByClassName("e-title-dlg-content")[0];l=i.getElementsByTagName("input")[0].value,d.hide(),s.updateChartElement(e,t,r,n,l,null,a,o)}}]}),d.dialogInstance.refresh()}},e.prototype.titleDlgContent=function(e,t){var r=this.parent.serviceLocator.getService(Fl),n=this.parent.createElement("div",{className:"e-title-dlg-content"}),i=this.parent.createElement("span",{className:"e-header e-top-header"});i.innerText=r.getConstant("EnterTitle");var a=this.parent.createElement("input",{className:"e-input",id:"titleInput",attrs:{type:"text"}});return n.appendChild(i),n.appendChild(a),t&&(a.value="PHAxisTitle"===e?t.primaryXAxis.title?t.primaryXAxis.title:a.value:"PVAxisTitle"===e?t.primaryYAxis.title?t.primaryYAxis.title:a.value:t.title?t.title:a.value),n},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(ei,this.initiateChartHandler),this.parent.off(Ps,this.refreshChartCellObj),this.parent.off(Oi,this.refreshChartCellModel),this.parent.off(Ms,this.refreshChartCellModel),this.parent.off(ii,this.updateChartHandler),this.parent.off(Ls,this.deleteChart),this.parent.off(Vs,this.clearBorder),this.parent.off(_s,this.insertChartHandler),this.parent.off(zs,this.chartRangeHandler),this.parent.off(Ws,this.chartDesignTabHandler),this.parent.off(Gs,this.updateChartElement),this.parent.off(Ys,this.undoRedoForChartDesign))},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null;var e=null;this.chart&&(e=this.chart.element,this.chart.destroy()),e&&t.detach(e),this.chart=null},e.prototype.getModuleName=function(){return"spreadsheetChart"},e}(),Bh=function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Uh=function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},Vh=function(e){function r(t,r){var n=e.call(this,t)||this;return n.viewport={rowCount:0,colCount:0,height:0,topIndex:0,leftIndex:0,width:0,bottomIndex:0,rightIndex:0,beforeFreezeHeight:0,beforeFreezeWidth:0},n.needsID=!0,i.Inject(Rh,kh,Ah,$l,Kl,Jl,eh,Xl,ji,Nh,Th,Oh,Dh,th,Fh,sh,ua,qi,Xi,ca,sa,oa,Lh,la,rh,oh,ha,Ph,ih,fa,lh,hh,ga,ma,dh,va,ph,ba,ch,Ca,uh,xa,Mh,fh,da,Sa,Hh,pa,gh,wa),r&&n.appendTo(r),n}Bh(r,e),i=r,r.prototype.getCell=function(e,t,r){var n;return this.insideViewport(e,t)&&(r||(r=this.getRow(e,null,t)),t=this.getViewportIndex(t,!0),n=r?r.cells[t]:r),n},r.prototype.getRow=function(e,r,n){if(!r){var i=this.getActiveSheet(),a=this.frozenRowCount(i),o=this.frozenColCount(i);r=t.isNullOrUndefined(n)||e>a-1&&n>o-1?this.getContentTable():e<a&&n<o?this.sheetModule.getSelectAllTable():e<a?this.getColHeaderTable():this.getRowHeaderTable()}return e=this.getViewportIndex(e),r?r.rows[e]:null},r.prototype.hiddenCount=function(e,t,r,n){void 0===r&&(r="rows"),void 0===n&&(n=this.getActiveSheet());for(var i,a=0,o=e;o<=t;o++)(i=n[""+r][o])&&i.hidden&&a++;return a},r.prototype.getViewportIndex=function(e,t){var r=this.getActiveSheet(),n=this.frozenColCount(r),i=this.frozenRowCount(r);if(t){if(n){var a=u(r.topLeftCell)[1];return e<n?(e-=this.hiddenCount(a,e,"columns"),(e-=a)+1):(e-=this.hiddenCount(this.viewport.leftIndex+n,e,"columns"),e-=this.viewport.leftIndex+n)}e-=this.hiddenCount(this.viewport.leftIndex,e,"columns"),e-=this.viewport.leftIndex}else{if(i){var o=u(r.topLeftCell)[0];return e<i?(e-=this.hiddenCount(o,e),(e-=o)+1):(e-=this.hiddenCount(this.viewport.topIndex+i,e),e-=this.viewport.topIndex+i)}e-=this.hiddenCount(this.viewport.topIndex,e),e-=this.viewport.topIndex}return e},r.prototype.preRender=function(){e.prototype.preRender.call(this),this.serviceLocator=new Ia,this.initServices()},r.prototype.initServices=function(){this.serviceLocator.register(Fl,new t.L10n(this.getModuleName(),Dl,this.locale)),this.serviceLocator.register(Al,new mh(this)),this.serviceLocator.register("actionEvents",new vh(this)),this.serviceLocator.register("shape",new yh(this))},r.prototype.render=function(){if(e.prototype.render.call(this),this.element.setAttribute("tabindex","0"),this.renderModule=new Wl(this),this.renderSpreadsheet(),this.wireEvents(),this.created)if(this.created.observers){if(this.created.observers.length>0){var t={observers:this.created.observers};this.isAngular&&(t={observers:this.created.observers,currentObservers:this.created.observers},this.created.currentObservers=[]),this.createdHandler=t,this.created.observers=[]}}else this.createdHandler=this.created,this.setProperties({created:void 0},!0)},r.prototype.renderSpreadsheet=function(){this.cssClass&&t.addClass([this.element],this.cssClass.split(" ")),this.setHeight(),this.setWidth(),n.createSpinner({target:this.element},this.createElement),this.isMobileView()&&-1===this.cssClass.indexOf("e-mobile-view")&&this.element.classList.add("e-mobile-view"),t.Browser.isDevice&&this.element.classList.add("e-device"),this.sheetModule=this.serviceLocator.getService("sheet"),this.allowScrolling&&(this.scrollModule=new Zl(this)),this.scrollSettings.enableVirtualization&&new Ql(this),this.renderModule.render(),new nh(this)},r.prototype.showSpinner=function(){n.showSpinner(this.element)},r.prototype.hideSpinner=function(){n.hideSpinner(this.element)},r.prototype.protectSheet=function(t,r,n){e.prototype.protectSheet.call(this,t,r,n)},r.prototype.unprotectSheet=function(t){e.prototype.unprotectSheet.call(this,t)},r.prototype.find=function(t){var r=this.getActiveSheet().activeCell;if(e.prototype.findHandler.call(this,t),!t.isAction)return r!==this.getActiveSheet().activeCell?this.getActiveSheet().name+"!"+this.getActiveSheet().activeCell:null},r.prototype.replace=function(r){r={value:r.value,mode:r.mode?r.mode:"Sheet",isCSen:!!r.isCSen&&r.isCSen,isEMatch:!!r.isEMatch&&r.isEMatch,searchBy:r.searchBy?r.searchBy:"By Row",replaceValue:r.replaceValue,replaceBy:r.replaceBy,sheetIndex:t.isUndefined(r.sheetIndex)?this.activeSheetIndex:r.sheetIndex,findOpt:r.findOpt?r.findOpt:""},e.prototype.replaceHandler.call(this,r)},r.prototype.findAll=function(e,t,r,n,i){var a=[],o={value:e,mode:t=t||"Sheet",sheetIndex:i=i<this.sheets.length?i:this.activeSheetIndex,isCSen:r=r||!1,isEMatch:n=n||!1,findCollection:a};return this.notify(Ur,o),a},r.prototype.goTo=function(e){if(e.includes("!")){var t=ce(this,fe(e));if(void 0===t)return;if(t!==this.activeSheetIndex){var r=e.split("!")[1],n=r.split(":")[0],i=this.sheets[t];this.setSheetPropertyOnMute(i,"activeCell",n),this.setSheetPropertyOnMute(i,"selectedRange",r);var a=u(n);if(i.frozenColumns||i.frozenRows){var o=u(i.topLeftCell);if(!(i.frozenRows&&a[0]<o[0]||i.frozenColumns&&a[1]<o[1])){var s=this.frozenRowCount(i),l=this.frozenColCount(i),h=[],d=[],p=u(i.paneTopLeftCell);s?(h.push(o[0]),a[0]>=s?d.push(a[0]):d.push(p[0])):(h.push(a[0]),d.push(a[0])),l?(h.push(o[1]),a[1]>=l?d.push(a[1]):d.push(p[1])):(h.push(a[1]),d.push(a[1])),this.setSheetPropertyOnMute(i,"topLeftCell",g(h[0],h[1])),this.setSheetPropertyOnMute(i,"paneTopLeftCell",g(d[0],d[1]))}}else a[0]<this.viewport.rowCount&&(a[0]=0),a[1]<this.viewport.colCount&&(a[1]=0),this.updateTopLeftCell(a[0],a[1],null,i);return this.activeSheetIndex=t,void this.dataBind()}}var f=c(e),m=this.getActiveSheet(),v=this.frozenRowCount(m),y=this.frozenColCount(m),C=this.insideViewport(f[0],f[1]);if(C){this.selectRange(e);var b=u(m.paneTopLeftCell),x=this.viewport.height-this.getScrollElement().parentElement.getBoundingClientRect().height,S=0,w=0;if(v)for(var I=u(m.topLeftCell)[0];I<v;I++)if((S+=We(m,I))>x){w=I;break}if(0===w)for(I=b[0];I<=this.viewport.bottomIndex;I++){if((S+=We(m,I))>x){w=I;break}I===this.viewport.bottomIndex&&(w=this.viewport.bottomIndex)}b[2]=w;var E=0;if(S=0,x=this.viewport.width-this.sheetModule.getScrollSize(),y)for(I=u(m.topLeftCell)[1];I<y;I++)if((S+=$e(m,I))>x){E=I;break}if(0===E)for(I=b[1];I<=this.viewport.rightIndex;I++){if((S+=$e(m,I))>x){E=I;break}I===this.viewport.rightIndex&&(E=this.viewport.rightIndex)}if(b[3]=E,f[0]>=b[0]&&f[0]<b[2]&&f[1]>=b[1]&&f[1]<b[3])return;if(v||y){if(b=[].concat(u(m.topLeftCell),[v,b[3]]),f[0]>=b[0]&&f[0]<b[2]&&f[1]>=b[1]&&f[1]<b[3])return;if(b[2]=w,b[3]=y,f[0]>=b[0]&&f[0]<b[2]&&f[1]>=b[1]&&f[1]<b[3])return}}var R,k,F,A,N,O,T=this.getMainContent().parentElement;f[0]===v?F=0:(F=Ye(m,v,f[0]-1,!0),this.scrollSettings.enableVirtualization&&(O=F+this.getContentTable().getBoundingClientRect().height)>(N=parseFloat(T.querySelector(".e-virtualtrack").style.height))&&(O+=10,(R=T.querySelector(".e-virtualtrack")).style.height=O+"px",tt(function(){R.style.height=N+"px"}))),T.scrollTop=F,T=this.element.getElementsByClassName("e-scroller")[0],f[1]===y?F=0:(F=Ze(m,y,f[1]-1,!0),this.scrollSettings.enableVirtualization&&(O=F+this.getContentTable().getBoundingClientRect().width)>(A=parseFloat(T.querySelector(".e-virtualtrack").style.width))&&(O+=10,(R=T.querySelector(".e-virtualtrack")).style.width=O+"px",(k=this.getColumnHeaderContent().querySelector(".e-virtualtrack")).style.width=O+"px",(R=this.getMainContent().querySelector(".e-virtualtrack")).style.width=O+"px",tt(function(){R.style.width=A+"px",k.style.width=A+"px"}))),T.scrollLeft=F,C||this.selectRange(e)},r.prototype.insideViewport=function(e,t){var r=this.getActiveSheet();if(r.frozenRows||r.frozenColumns){var n=this.frozenRowCount(r),i=this.frozenColCount(r),a=u(r.topLeftCell);return(e>=a[0]&&e<n||e>=this.viewport.topIndex+n&&e<=this.viewport.bottomIndex)&&(t>=a[1]&&t<i||t>=this.viewport.leftIndex+i&&t<=this.viewport.rightIndex)}return e>=this.viewport.topIndex&&e<=this.viewport.bottomIndex&&t>=this.viewport.leftIndex&&t<=this.viewport.rightIndex},r.prototype.resize=function(){this.renderModule.setSheetPanelSize(),this.scrollSettings.enableVirtualization&&this.renderModule.refreshSheet(!1,!0)},r.prototype.cut=function(e){var t=new Promise(function(e,t){e(void 0)});return this.notify(to,e?{range:y(e),sId:this.sheets[ce(this,fe(e))]?this.sheets[ce(this,fe(e))].id:this.getActiveSheet().id,promise:t,invokeCopy:!0,isPublic:!0}:{promise:t,invokeCopy:!0,isPublic:!0}),t},r.prototype.copy=function(e){var t=new Promise(function(e,t){e(void 0)});return this.notify(ro,e?{range:y(e),sId:this.sheets[ce(this,fe(e))]?this.sheets[ce(this,fe(e))].id:this.getActiveSheet().id,promise:t,invokeCopy:!0,isPublic:!0}:{promise:t,invokeCopy:!0,isPublic:!0}),t},r.prototype.paste=function(e,t){this.notify(no,{range:e?y(e):e,sIdx:e?ce(this,fe(e)):e,type:t,isAction:!0,isInternal:!0})},r.prototype.updateAction=function(e){Dt(e,this)},r.prototype.setHeight=function(){this.height.toString().indexOf("%")>-1&&(this.element.style.minHeight="400px"),this.element.style.height=t.formatUnit(this.height)},r.prototype.setWidth=function(){(this.width.toString().indexOf("%")>-1||"auto"===this.width)&&(this.element.style.minWidth="300px"),this.element.style.width=t.formatUnit(this.width)},r.prototype.setColWidth=function(e,r,n){void 0===e&&(e=64),void 0===r&&(r=0);var i=t.isNullOrUndefined(n)?this.getActiveSheet():this.sheets[n];if(i){var a=r,o="number"==typeof e?e+"px":e;r=t.isNullOrUndefined(r)?u(i.activeCell)[1]:r;var s=function(){Xe(i,a).width=parseInt(o,10)>0?parseInt(o,10):0,i.columns[a].customWidth=!0},l=this.frozenColCount(i);if(i.id===this.getActiveSheet().id){if(r>=this.viewport.leftIndex+l&&r<=this.viewport.rightIndex||l&&r<l){r=this.getViewportIndex(r,!0);var h=$e(i,a,null,!0);(p=kt(parseInt(o,10))-h)<0&&h<-p&&(p=-h),s(),this.notify(Co,{threshold:p,colIdx:a,checkWrapCell:!0}),Nt(a,r,o,!0,this)}else{var d=$e(i,r),p=void 0;p=parseInt(o,10)>0?-(d-parseInt(o,10)):-d,s(),this.notify(Co,{threshold:p,colIdx:r})}this.notify(il,null)}else s()}},r.prototype.setRowHeight=function(e,r,n,i,a){void 0===e&&(e=20),void 0===r&&(r=0);var o=t.isNullOrUndefined(n)?this.getActiveSheet():this.sheets[n];if(o){var s=r;if(r=t.isNullOrUndefined(r)?u(o.activeCell)[0]:r,a&&o.rows[r]&&o.rows[r].customHeight)return;var l="number"==typeof e?e+"px":e,h=function(){Ge(o,s,parseInt(l,10)>0?parseInt(l,10):0),o.rows[s].customHeight=!0};if(o.id===this.getActiveSheet().id){var d=this.frozenRowCount(o);if(r>=this.viewport.topIndex+d&&r<=this.viewport.bottomIndex||d&&r<d){r=this.getViewportIndex(s);var p=We(o,s,!0);(f=kt(parseInt(l,10))-p)<0&&p<-f&&(f=-p),h(),this.notify(yo,{threshold:f,rowIdx:s,isCustomHgt:!0}),t.isNullOrUndefined(i)&&(i=!1),i||(Nt(s,r,l,!1,this),i=!1)}else{var c=We(o,r),f=void 0;f=parseInt(l,10)>0?-(c-parseInt(l,10)):-c,h(),this.notify(yo,{threshold:f,rowIdx:s})}this.notify(il,null)}else h()}},r.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)},r.prototype.setColumnsWidth=function(e,t){void 0===e&&(e=64),t||(t=["A:"+v(this.getActiveSheet().usedRange.colIndex+1)]),this.setSize(e,t,function(e){return f(e)},this.setColWidth.bind(this))},r.prototype.setSize=function(e,t,r,n,i){var a,o,s,l,h=this;t.forEach(function(t){t.includes("!")?(o=t.split("!"),a=ce(h,o[0]),t=o[1]):a=h.activeSheetIndex,t.includes(":")?(o=t.split(":"),s=r(o[0]),l=r(o[1])):s=l=r(t);for(var d=s;d<=l;d++)n(e,d,a,!1,i)})},r.prototype.autoFit=function(e){var t=this.getIndexes(e),r=t.startIdx,n=t.endIdx,i=t.isCol,a=i?f("XFD"):1048576;if(r<=a)for(n>a&&(n=a);r<=n;r++)this.notify($o,{idx:r,isCol:i})},r.prototype.getIndexes=function(e){var r,n,i,a;if(-1!==e.indexOf(":")){var o=e.split(":");i=o[0],a=o[1]}else i=e,a=e;if(!t.isNullOrUndefined(i)){var s=this.getAddress(i);i=s.address,r=s.isCol}if(!t.isNullOrUndefined(a)){var l=this.getAddress(a);a=l.address,n=l.isCol}var h=!0===r&&!0===n;return{startIdx:h?f(i.toUpperCase()):parseInt(i,10),endIdx:h?f(a.toUpperCase()):parseInt(a,10),isCol:h}},r.prototype.getAddress=function(e){var t;return e.substring(0,1).match(/\D/g)?(t=!0,e=e.replace(/[0-9]/g,""),{address:e,isCol:t}):e.substring(0,1).match(/[0-9]/g)&&e.match(/\D/g)?{address:"",isCol:!1}:(e=(parseInt(e,10)-1).toString(),{address:e,isCol:t})},r.prototype.addHyperlink=function(e,t,r){this.insertHyperlink(e,t,r,!0)},r.prototype.removeHyperlink=function(e){this.notify(No,{range:e,preventEventTrigger:!0})},r.prototype.insertHyperlink=function(e,t,r,n){if(this.allowHyperlink){var i=void 0,a=void 0,o=void 0,s=this.getActiveSheet();o=c(t=t||s.name+"!"+s.activeCell);for(var l=this.getCell(o[0],o[1]),h=[],d=0;l&&d<l.classList.length;d++)h.push(l.classList[d]);var p={hyperlink:e,address:t,displayText:r,cancel:!1},u={hyperlink:e,address:t,displayText:r};if(n||(this.trigger(pn,p),this.notify(Ar,{action:"hyperlink",eventArgs:p})),!p.cancel){var f={hyperlink:e=p.hyperlink,cell:t=p.address,displayText:r,triggerEvt:!n};if(this.notify(gn,f),t&&-1!==t.indexOf("!")){i=t.split("!");for(var g=this.sheets,m=0;m<g.length;m++)g[m].name===i[0]&&(a=m);s=this.sheets[a],t=i[1]}if(!s)return;if(t=t||this.getActiveSheet().activeCell,o=c(t),n||(this.trigger(cn,u),this.notify(Yo,{action:"hyperlink",eventArgs:p})),s===this.getActiveSheet()){this.serviceLocator.getService("cell").refreshRange(o,!1,!1,!1,!0,Kt(this));for(d=0;d<h.length;d++)this.getCell(o[0],o[1]).classList.contains(h[d])||this.getCell(o[0],o[1]).classList.add(h[d]);this.notify(ti,null)}}}},r.prototype.addDataValidation=function(t,r){e.prototype.addDataValidation.call(this,t,r)},r.prototype.removeDataValidation=function(e){this.notify(En,{range:e,isRemoveValidation:!0,viewport:this.viewport})},r.prototype.addInvalidHighlight=function(t){var r=t||this.dataValidationRange;if(r.indexOf(",")>-1){var n="";r.includes("!")&&(n=r.split("!")[0]+"!",r=r.split("!")[1]);for(var i=r.split(","),a=0;a<i.length-1;a++)e.prototype.addInvalidHighlight.call(this,n+i[a])}else e.prototype.addInvalidHighlight.call(this,r)},r.prototype.removeInvalidHighlight=function(t){var r=t||this.dataValidationRange;if(r.indexOf(",")>-1){var n="";r.includes("!")&&(n=r.split("!")[0]+"!",r=r.split("!")[1]);for(var i=r.split(","),a=0;a<i.length-1;a++)e.prototype.removeInvalidHighlight.call(this,n+i[a])}else e.prototype.removeInvalidHighlight.call(this,r)},r.prototype.conditionalFormat=function(t){e.prototype.conditionalFormat.call(this,t)},r.prototype.clearConditionalFormat=function(t){t=t||this.getActiveSheet().selectedRange,e.prototype.clearConditionalFormat.call(this,t)},r.prototype.setPanelSize=function(){if("auto"!==this.height){var e=document.getElementById(this.element.id+"_sheet_panel");e.style.height=this.element.getBoundingClientRect().height-at(e)+"px"}},r.prototype.open=function(t){this.isOpen=!0,e.prototype.open.call(this,t),this.isOpen&&this.showSpinner()},r.prototype.hideRow=function(t,r,n){void 0===r&&(r=t),void 0===n&&(n=!0),this.renderModule?this.notify(Gn,{startIndex:t,endIndex:r,hide:n}):e.prototype.hideRow.call(this,t,r,n)},r.prototype.hideColumn=function(t,r,n){void 0===r&&(r=t),void 0===n&&(n=!0),this.renderModule?this.notify(Gn,{startIndex:t,endIndex:r,hide:n,isCol:!0}):e.prototype.hideColumn.call(this,t,r,n)},r.prototype.clear=function(e){this.notify(Cs,{options:e})},r.prototype.refresh=function(t){this.isReact&&this.clearTemplate(),t?(this.notify(io,null),this.sheets.length=0,this.sheetNameCount=1,this.notify(Jr,{}),this.notify(Bo,null),this.createSheet(),this.activeSheetIndex=this.sheets.length-1,this.notify(Fa,null),this.notify(jr,{action:"initSheetInfo"}),this.renderModule.refreshSheet(),this.openModule.isImportedFile=this.openModule.preventFormatCheck=!1,this.openModule.unProtectSheetIdx=[]):e.prototype.refresh.call(this)},r.prototype.insertImage=function(e,t){var r;for(r=0;r<e.length;r++)this.notify(Ts,{options:e[r],range:t||this.getActiveSheet().selectedRange,isPublic:!0})},r.prototype.deleteImage=function(e,t){this.notify(Ds,{id:e,range:t||this.getActiveSheet().selectedRange})},r.prototype.getRowHeaderContent=function(){return this.sheetModule.getRowHeaderPanel()},r.prototype.getColumnHeaderContent=function(){return this.sheetModule.getColHeaderPanel()},r.prototype.getMainContent=function(){return this.sheetModule.getContentPanel()},r.prototype.getSelectAllContent=function(){return this.sheetModule.getSelectAllContent()},r.prototype.getScrollElement=function(){return this.sheetModule.getScrollElement()},r.prototype.getContentTable=function(){return this.sheetModule.getContentTable()},r.prototype.getRowHeaderTable=function(){return this.sheetModule.getRowHeaderTable()},r.prototype.getColHeaderTable=function(){return this.sheetModule.getColHeaderTable()},r.prototype.getThreshold=function(e){var t=Math.round((this.viewport[e+"Count"]+1)/2);return t<15?15:t},r.prototype.isMobileView=function(){return(this.cssClass.indexOf("e-mobile-view")>-1||t.Browser.isDevice)&&-1===this.cssClass.indexOf("e-desktop-view")&&!1},r.prototype.getValueRowCol=function(t,r,n,i,a,o,s){return e.prototype.getValueRowCol.call(this,t,r,n,i,a,o,s)},r.prototype.updateCell=function(t,r){r=r||this.getActiveSheet().activeCell,e.prototype.updateCell.call(this,t,r)},r.prototype.getRowData=function(t,r){return e.prototype.getRowData.call(this,t,r)},r.prototype.sort=function(t,r){var n=this;if(!this.allowSorting)return Promise.reject();var i=[];if(this.sortCollection)for(var a=this.sortCollection.length-1;a>=0;a--)this.sortCollection[a]&&this.sortCollection[a].sheetIndex===this.activeSheetIndex&&(i.push(this.sortCollection[a]),this.sortCollection.splice(a,1));return this.notify(zo,{sortOptions:t}),e.prototype.sort.call(this,t,r,i).then(function(e){return n.notify(dn,e),Promise.resolve(e)})},r.prototype.setValueRowCol=function(t,r,n,i,a,o){if("circular reference: "===r){var s={action:"isCircularReference",argValue:r};this.notify(La,s),r=s.argValue}if(e.prototype.setValueRowCol.call(this,t,r,n,i,a,o),this.allowEditing)this.notify(Da,{action:"refreshDependentCellValue",rowIdx:n,colIdx:i,sheetIdx:ue(this,t)});else{var l=ue(this,t);if(n--,i--,this.activeSheetIndex===l){var h=Ce(this,l),d=void 0;if(je(h,n)||Qe(h,i)||(d=this.getCell(n,i)),d){if(d.parentElement){var p=d.parentElement.getAttribute("aria-rowindex");if(p&&Number(p)-1!==n)return}var c=Re(n,i,h),u={value:c.value,format:c.format,onLoad:!0,formattedText:"",isRightAlign:!1,type:"General",cell:c,rowIndex:n,colIndex:i,isRowFill:!1};this.notify(Mr,u),u.formattedText=this.allowNumberFormatting?u.formattedText:u.value;var f={isRightAlign:u.isRightAlign,result:u.formattedText,type:u.type,value:u.value,curSymbol:u.curSymbol,isRowFill:u.isRowFill};this.refreshNode(d,f)}}}},r.prototype.getModuleName=function(){return"spreadsheet"},r.prototype.refreshNode=function(e,r){var n;if(e){if(r){if(r.result=t.isNullOrUndefined(r.result)?"":r.result.toString(),!r.isRowFill){var i=t.select(".e-fill",e);i&&(t.detach(i),e.style.display="table-cell");var a=t.select(".e-fill-sec",e);a&&t.detach(a)}var o=t.select("#"+this.element.id+"_currency",e);if(o&&t.detach(o),"Accounting"===r.type&&D(r.value)&&r.result.includes(r.curSymbol)){var s=void 0,l=void 0,h=void 0;r.result.trim().endsWith(r.curSymbol)?l=r.result:(s=r.result.includes(" "+r.curSymbol)?" "+r.curSymbol:r.curSymbol,l=r.result.split(s).join(""));var d=e.querySelector(".e-databar-value"),p=e;if(d?(this.refreshNode(d,{result:l}),p=e.querySelector(".e-cf-databar")||e):e.querySelector("a")?e.querySelector("a").textContent=l:(h=!0,e.innerText=""),s){var c=this.createElement("span",{id:this.element.id+"_currency",styles:"float: left"});c.innerText=s,p.appendChild(c)}return h&&(e.innerHTML+=l),void e.classList.add("e-right-align")}var u=void 0;!r.result||"true"!==r.result.toLowerCase()&&"false"!==r.result.toLowerCase()?u="e-right-align":(r.result=r.result.toUpperCase(),u="e-center-align",r.isRightAlign=!0),n=r.result,this.allowWrap||n.toString().includes("\n")&&(n=n.replace(/\n/g,"")),r.isRightAlign?e.classList.add(u):e.classList.remove(u)}n=t.isNullOrUndefined(n)?"":n,t.isNullOrUndefined(r.rowIndex)||t.isNullOrUndefined(r.colIndex)||t.attributes(e,{"aria-label":(n?n+" ":"")+g(r.rowIndex,r.colIndex)});var f=e.lastChild;e.querySelector(".e-databar-value")&&(f=e.querySelector(".e-databar-value").lastChild),e.querySelector(".e-hyperlink")&&(f=e.querySelector(".e-hyperlink").lastChild);var m=e.querySelector(".e-wrap-content");if(m&&(m.lastChild||m.appendChild(document.createTextNode("")),f=m.lastChild),(this.isAngular||this.isVue)&&e.classList.contains("e-cell-template")&&f&&(8===f.nodeType||3===f.nodeType)){if(3===f.nodeType||""!==n){var v=function(){e.childElementCount||(3===f.nodeType?r.isRowFill||(f.nodeValue=n):e.appendChild(document.createTextNode(n)))};this.isAngular?tt(v):v()}}else!f||3!==f.nodeType&&1!==f.nodeType?e.appendChild(document.createTextNode(n)):r.isRowFill||(f.nodeValue=n)}},r.prototype.calculateHeight=function(e,t,r){void 0===t&&(t=1),void 0===r&&(r=1);var n=e&&e.fontSize||this.cellStyle.fontSize,i="Arial Black"===e.fontFamily?1.44:1.24;return(n.indexOf("pt")>-1?1.33*parseInt(n,10):parseInt(n,10))*i*t+r*i},r.prototype.skipHidden=function(e,t,r,n){void 0===r&&(r="rows"),void 0===n&&(n=this.scrollSettings.isFinite);var i,a=this.getActiveSheet();this.scrollSettings.isFinite&&(i=("rows"===r?a.rowCount:a.colCount)-1);for(var o=e;o<=t;o++)if(a[""+r][o]&&a[""+r][o].hidden){if(e===o&&e++,t++,n&&t>i){t=i;break}}else if(!n&&this.scrollSettings.isFinite&&t>i&&a[""+r][o-1]&&a[""+r][o-1].hidden){t--;break}return[e,t]},r.prototype.updateActiveBorder=function(e,r){void 0===r&&(r=".e-ribbon");var n=t.select(r+" .e-tab-header .e-indicator",this.element);n.style.display="none",t.setStyleAttribute(n,{left:"",right:""}),t.setStyleAttribute(n,{left:e.offsetLeft+"px",right:e.parentElement.offsetWidth-(e.offsetLeft+e.offsetWidth)+"px"}),n.style.display=""},r.prototype.undo=function(){this.notify(Lo,{isUndo:!0,isPublic:!0})},r.prototype.redo=function(){this.notify(Lo,{isUndo:!1,isPublic:!0})},r.prototype.updateUndoRedoCollection=function(e){this.notify(Po,{args:e,isPublic:!0})},r.prototype.addDefinedName=function(e){var t={action:"addDefinedName",isAdded:!1,definedName:e};return this.notify(La,t),t.isAdded},r.prototype.removeDefinedName=function(t,r){return e.prototype.removeDefinedName.call(this,t,r)},r.prototype.mouseClickHandler=function(e){this.notify(Ma,e)},r.prototype.mouseDownHandler=function(e){this.notify(Oa,e)},r.prototype.keyUpHandler=function(e){t.closest(e.target,".e-find-dlg")?this.notify(On,e):this.notify(Ha,e)},r.prototype.keyDownHandler=function(e){var r=t.closest(e.target,".e-findtool-dlg");if(r){if(9===e.keyCode){var n=e.target;if(e.shiftKey){if(n.classList.contains("e-text-findNext-short")){var i=r.querySelector(".e-findRib-close .e-tbar-btn");i&&(e.preventDefault(),i.focus())}}else n.classList.contains("e-tbar-btn")&&n.parentElement.classList.contains("e-findRib-close")&&Wt(r)}}else this.notify(Ba,e),!this.enableKeyboardNavigation&&document.activeElement.classList.contains("e-cell")&&[38,40,33,34,35,36].indexOf(e.keyCode)>-1&&e.preventDefault()},r.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(Ar,{eventArgs:t,action:"freezePanes"}),t.cancel)return}this.on(Na,this.freezePaneUpdated,this),this.freezePanes(e.row,e.column),this.notify(ti,null)}},r.prototype.freezePaneUpdated=function(){this.off(Na,this.freezePaneUpdated);var e=this.getActiveSheet();Wt(this.element),this.notify(Yo,{eventArgs:{row:e.frozenRows,column:e.frozenColumns,sheetIndex:this.activeSheetIndex},action:"freezePanes"})},r.prototype.wireEvents=function(){t.EventHandler.add(this.element,"click",this.mouseClickHandler,this),t.EventHandler.add(this.element,ut(),this.mouseDownHandler,this),t.EventHandler.add(this.element,"keyup",this.keyUpHandler,this),t.EventHandler.add(this.element,"keydown",this.keyDownHandler,this),t.EventHandler.add(this.element,"noderefresh",this.refreshNode,this),this.on(tl,this.freeze,this),this.on(Si,this.refreshInsertDelete,this)},r.prototype.destroy=function(){this.isReact&&this.clearTemplate(),this.unwireEvents(),this.notify(Ta,null),e.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()},r.prototype.unwireEvents=function(){t.EventHandler.remove(this.element,"click",this.mouseClickHandler),t.EventHandler.remove(this.element,ut(),this.mouseDownHandler),t.EventHandler.remove(this.element,"keyup",this.keyUpHandler),t.EventHandler.remove(this.element,"keydown",this.keyDownHandler),t.EventHandler.remove(this.element,"noderefresh",this.refreshNode),this.off(tl,this.freeze),this.off(Si,this.refreshInsertDelete)},r.prototype.refreshInsertDelete=function(e){var t,r=this;e.sheet.ranges.forEach(function(n){n.template&&n.address&&(t=c(n.address),r.updateRangeOnInsertDelete(e,t)&&(n.address=m(t)))}),this.setSheetPropertyOnMute(e.sheet,"ranges",e.sheet.ranges)},r.prototype.addContextMenuItems=function(e,t,r,n){void 0===r&&(r=!0),this.notify(ao,{items:e,text:t,insertAfter:r,isUniqueId:n})},r.prototype.removeContextMenuItems=function(e,t){this.notify(oo,{items:e,isUniqueId:t})},r.prototype.enableContextMenuItems=function(e,t,r){void 0===t&&(t=!0),this.notify(so,{items:e,enable:t,isUniqueId:r})},r.prototype.enableFileMenuItems=function(e,t,r){void 0===t&&(t=!0),this.notify(lo,{items:e,enable:t,isUniqueId:r})},r.prototype.hideFileMenuItems=function(e,t,r){void 0===t&&(t=!0),this.notify(ho,{items:e,hide:t,isUniqueId:r})},r.prototype.addFileMenuItems=function(e,t,r,n){void 0===r&&(r=!0),this.notify(po,{items:e,text:t,insertAfter:r,isUniqueId:n})},r.prototype.hideRibbonTabs=function(e,t){void 0===t&&(t=!0),this.notify(co,{tabs:e,hide:t})},r.prototype.enableRibbonTabs=function(e,t){void 0===t&&(t=!0),this.notify(uo,{tabs:e,enable:t})},r.prototype.addRibbonTabs=function(e,t){this.notify(fo,{items:e,insertBefore:t})},r.prototype.enableToolbarItems=function(e,t,r){this.notify(Za,[{tab:e,items:t,enable:void 0===r||r}])},r.prototype.hideToolbarItems=function(e,t,r){void 0===r&&(r=!0),this.notify(mo,{tab:e,indexes:t,hide:r})},r.prototype.addToolbarItems=function(e,t,r){this.notify(go,{tab:e,items:t,index:r})},r.prototype.selectRange=function(e){this.isEdit&&this.notify(Da,{action:"endEdit"}),this.notify(Ja,{address:e})},r.prototype.selectChart=function(e){this.selectOverlay(e,!0)},r.prototype.selectImage=function(e){this.selectOverlay(e)},r.prototype.selectOverlay=function(e,t){var r=this.getActiveSheet();if(!r.isProtected&&this.allowEditing){if(!e){var n=u(r.activeCell),i=Re(n[0],n[1],r,!1,!0);t?i.chart&&i.chart.length&&(e=i.chart[i.chart.length-1].id):i.image&&i.image.length&&(e=i.image[i.image.length-1].id)}var a;if(e?(a=this.element.querySelector("#"+e)).classList.contains("e-ss-overlay")||(a=a.parentElement):a=this.element.querySelector(".e-ss-overlay"+(t?".e-datavisualization-chart":":not(.e-datavisualization-chart)")),a){var o=void 0,s=this.element.getElementsByClassName("e-ss-overlay-active")[0];s&&(s.classList.remove("e-ss-overlay-active"),(o=s.classList.contains("e-datavisualization-chart"))&&this.notify(Vs,null)),a.classList.add("e-ss-overlay-active"),a.classList.contains("e-datavisualization-chart")?(this.notify(oi,{id:a.id}),o||this.notify(js,{id:a.id})):o&&this.notify(qs,null)}}},r.prototype.deselectChart=function(){this.notify(Fs,{selector:".e-datavisualization-chart"})},r.prototype.deselectImage=function(){this.notify(Fs,{selector:":not(.e-datavisualization-chart)"})},r.prototype.startEdit=function(){this.notify(Da,{action:"startEdit",isNewValueEdit:!1})},r.prototype.closeEdit=function(){this.notify(Da,{action:"cancelEdit"})},r.prototype.endEdit=function(){this.notify(Da,{action:"endEdit",isPublic:!0})},r.prototype.onPropertyChanged=function(r,n){var i=this;e.prototype.onPropertyChanged.call(this,r,n);for(var a,o=0,s=Object.keys(r);o<s.length;o++){var l=s[o],h=void 0,d=void 0;switch(l){case"enableRtl":if(r.locale)break;if((h=this.getColumnHeaderContent())&&(h=h.parentElement),!h)break;if(r.enableRtl?(h.style.marginRight="",document.getElementById(this.element.id+"_sheet_panel").classList.add("e-rtl")):(h.style.marginLeft="",document.getElementById(this.element.id+"_sheet_panel").classList.remove("e-rtl")),this.allowScrolling&&this.scrollModule.setPadding(!0),this.allowAutoFill){var p=this.element.querySelector(".e-dragfill-ddb");if(p){var c=t.getComponent(p,"dropdown-btn");c&&(c.enableRtl=r.enableRtl,c.dataBind())}}var f=this.getActiveSheet();if(this.sheetModule.setPanelWidth(f,this.getRowHeaderContent(),!0),this.allowImage||this.allowChart)for(var g=this.element.getElementsByClassName("e-ss-overlay"),m=void 0,v=void 0,y=void 0,C=0,b=g.length-1;C<=b;C++)(v=g[0]).classList.contains("e-datavisualization-chart")&&(m=(y=v.querySelector(".e-accumulationchart"))?t.getComponent(y,"accumulationchart"):(y=v.querySelector(".e-chart"))&&t.getComponent(y,"chart"))&&m.destroy(),t.detach(v),C===b&&this.notify(bi,{});var x=this.getScrollElement();x&&(x.scrollLeft=0),this.selectRange(f.selectedRange);break;case"cssClass":n.cssClass&&t.removeClass([this.element],n.cssClass.split(" ")),r.cssClass&&t.addClass([this.element],r.cssClass.split(" "));break;case"activeSheetIndex":this.renderModule.refreshSheet(),this.notify(So,{idx:r.activeSheetIndex});break;case"width":this.setWidth(),this.resize();break;case"height":this.setHeight(),this.resize();break;case"showRibbon":this.notify(Ea,{prop:"showRibbon",onPropertyChange:!0});break;case"showFormulaBar":this.notify(Ra,{uiUpdate:!0});break;case"showSheetTabs":this.notify(ka,null);break;case"cellStyle":this.renderModule.refreshSheet();break;case"allowEditing":if(this.allowEditing){if(this.notify(Da,{action:"renderEditor"}),this.enableKeyboardNavigation){this.enableKeyboardNavigation=!1,this.dataBind(),this.enableKeyboardNavigation=!0,this.dataBind();var S=this.selectionSettings.mode;"None"!==S&&(this.selectionSettings.mode="None",this.dataBind(),this.selectionSettings.mode=S,this.dataBind())}}else this.notify(Fs,null);break;case"allowInsert":(d=this.element.getElementsByClassName("e-add-sheet-tab")[0])&&(d.disabled=!this.allowInsert,this.allowInsert?d.classList.contains("e-disabled")&&d.classList.remove("e-disabled"):d.classList.contains("e-disabled")||d.classList.add("e-disabled"));break;case"sheets":if(r.sheets===this.sheets){this.renderModule.refreshSheet(),this.notify(Fa,null),this.notify(jr,{action:"initSheetInfo"});break}Object.keys(r.sheets).forEach(function(e,o){var s=r.sheets[""+e];if(s.ranges&&Object.keys(s.ranges).length){var l,h=Object.keys(s.ranges);h.forEach(function(e,t){s.ranges[""+e].info||(l=t)}),h.forEach(function(r,n){s.ranges[""+r].dataSource&&(t.isUndefined(l)||!t.isUndefined(l)&&l===n)&&i.notify(Ir,{sheetIdx:e,rangeIdx:r,isLastRange:h.length-1===n,changedData:s.ranges[""+r].dataSource})})}else if(s.paneTopLeftCell&&n.sheets&&n.sheets[""+e]&&n.sheets[""+e].paneTopLeftCell){if(i.activeSheetIndex!==Number(e))return;var d=u(s.paneTopLeftCell),p=u(n.sheets[""+e].paneTopLeftCell);if(d[0]!==p[0]){var c=i.frozenRowCount(i.getActiveSheet()),f=d[0]>c?Ye(i.getActiveSheet(),c,d[0]-1):0;i.notify(nl,{top:f})}if(d[1]!==p[1]){var g=i.frozenColCount(i.getActiveSheet()),m=d[1]>g?Ze(i.getActiveSheet(),g,d[1]-1):0;i.notify(nl,{left:m})}}else if(0===o&&i.renderModule.refreshSheet(),i.showSheetTabs&&s.name&&!a){var v=t.select(".e-sheet-tabs-items",i.element),y=Number(e);v.children[y+1]?i.notify(To,{items:v,value:s.name,idx:y}):(i.notify(Fa,null),a=!0)}});break;case"locale":this.refresh();break;case"currencyCode":r.locale||this.notify(bi,{});break;case"password":this.password.length>0&&this.showSheetTabs&&(this.element.querySelector(".e-add-sheet-tab").setAttribute("disabled","true"),this.element.querySelector(".e-add-sheet-tab").classList.add("e-disabled"));break;case"isProtected":if(this.isProtected){var w=this.element.getElementsByClassName("e-add-sheet-tab")[0];w&&(w.disabled=this.isProtected,this.isProtected?w.classList.contains("e-disabled")&&w.classList.add("e-disabled"):w.classList.contains("e-disabled")||w.classList.remove("e-disabled"))}break;case"allowFreezePane":this.notify(Ea,{prop:"allowFreezePane",onPropertyChange:!0});break;case"allowImage":case"allowChart":this.renderModule.refreshSheet(),this.notify(Ea,{prop:l,onPropertyChange:!0})}}},r.prototype.requiredModules=function(){return et(this)},r.prototype.appendTo=function(t){e.prototype.appendTo.call(this,t)},r.prototype.filter=function(t,r){return this.allowFiltering?(r=r||this.getActiveSheet().selectedRange,e.prototype.filter.call(this,t,r)):Promise.reject()},r.prototype.clearFilter=function(e){this.notify(Wo,{field:e})},r.prototype.applyFilter=function(e,t){var r=this;if(!this.allowFiltering)return Promise.reject();var n=new Promise(function(e,t){e(void 0)});if(e&&e.length){var i;e.forEach(function(e){i={instance:{options:{type:e.type,format:"date"===e.type&&"yMd"}},arg3:e.value,arg2:e.operator},r.notify(d.fltrPrevent,i),e.value=i.arg3})}var a={predicates:e,range:t,isInternal:!0,promise:n};return this.notify(Uo,a),a.promise},r.prototype.addCustomFunction=function(t,r,n){e.prototype.addCustomFunction.call(this,t,r,n),this.notify(Zo,null)};var i;return Uh([t.Property("")],r.prototype,"cssClass",void 0),Uh([t.Property(!0)],r.prototype,"allowScrolling",void 0),Uh([t.Property(!0)],r.prototype,"allowResizing",void 0),Uh([t.Property(!0)],r.prototype,"showAggregate",void 0),Uh([t.Property(!0)],r.prototype,"enableClipboard",void 0),Uh([t.Property(!0)],r.prototype,"enableContextMenu",void 0),Uh([t.Property(!0)],r.prototype,"enableKeyboardNavigation",void 0),Uh([t.Property(!0)],r.prototype,"enableKeyboardShortcut",void 0),Uh([t.Property(!0)],r.prototype,"allowUndoRedo",void 0),Uh([t.Property(!0)],r.prototype,"allowWrap",void 0),Uh([t.Complex({},_l)],r.prototype,"selectionSettings",void 0),Uh([t.Complex({},Vl)],r.prototype,"scrollSettings",void 0),Uh([t.Event()],r.prototype,"beforeCellRender",void 0),Uh([t.Event()],r.prototype,"beforeSelect",void 0),Uh([t.Event()],r.prototype,"select",void 0),Uh([t.Event()],r.prototype,"contextMenuBeforeOpen",void 0),Uh([t.Event()],r.prototype,"fileMenuBeforeOpen",void 0),Uh([t.Event()],r.prototype,"contextMenuBeforeClose",void 0),Uh([t.Event()],r.prototype,"dialogBeforeOpen",void 0),Uh([t.Event()],r.prototype,"fileMenuBeforeClose",void 0),Uh([t.Event()],r.prototype,"contextMenuItemSelect",void 0),Uh([t.Event()],r.prototype,"fileMenuItemSelect",void 0),Uh([t.Event()],r.prototype,"beforeDataBound",void 0),Uh([t.Event()],r.prototype,"dataBound",void 0),Uh([t.Event()],r.prototype,"dataSourceChanged",void 0),Uh([t.Event()],r.prototype,"cellEdit",void 0),Uh([t.Event()],r.prototype,"cellEditing",void 0),Uh([t.Event()],r.prototype,"cellEdited",void 0),Uh([t.Event()],r.prototype,"cellSave",void 0),Uh([t.Event()],r.prototype,"beforeCellSave",void 0),Uh([t.Event()],r.prototype,"created",void 0),Uh([t.Event()],r.prototype,"beforeSort",void 0),Uh([t.Event()],r.prototype,"beforeHyperlinkCreate",void 0),Uh([t.Event()],r.prototype,"afterHyperlinkCreate",void 0),Uh([t.Event()],r.prototype,"beforeHyperlinkClick",void 0),Uh([t.Event()],r.prototype,"afterHyperlinkClick",void 0),Uh([t.Event()],r.prototype,"beforeConditionalFormat",void 0),Uh([t.Event()],r.prototype,"actionBegin",void 0),Uh([t.Event()],r.prototype,"actionComplete",void 0),Uh([t.Event()],r.prototype,"openComplete",void 0),Uh([t.Event()],r.prototype,"sortComplete",void 0),Uh([t.Property("USD")],r.prototype,"currencyCode",void 0),r=i=Uh([t.NotifyPropertyChanges],r)}(bl);e.Workbook=bl,e.Range=Hi,e.UsedRange=Bi,e.Sheet=Ui,e.getSheetIndex=ce,e.getSheetIndexFromId=ue,e.getSheetNameFromAddress=fe,e.getSheetIndexByName=ge,e.updateSelectedRange=me,e.getSelectedRange=ve,e.getSingleSelectedRange=ye,e.getSheet=Ce,e.getSheetNameCount=be,e.getMaxSheetId=xe,e.initSheet=Se,e.getSheetName=we,e.moveSheet=Ie,e.duplicateSheet=Ee,e.Row=wl,e.getRow=_e,e.setRow=ze,e.isHiddenRow=je,e.isFilterHidden=qe,e.getRowHeight=We,e.setRowHeight=Ge,e.getRowsHeight=Ye,e.Column=Rl,e.getColumn=Xe,e.setColumn=Ke,e.getColumnWidth=$e,e.getColumnsWidth=Ze,e.isHiddenCol=Qe,e.checkColumnValidation=Je,e.Cell=zi,e.getCell=Re,e.setCell=ke,e.skipDefaultValue=Fe,e.wrap=Ae,e.getColorCode=Ne,e.getCustomColors=Oe,e.isCustomDateTime=Te,e.getData=he,e.getValueFromFormat=de,e.getModel=function(e,r){var n,i,a;if(t.isUndefined(e[r])||!e[r]||e[r].index!==r)for(var o=0;o<=r;o++)if(e&&e[o]){if((n=e[o].index-o)>0){for(e.forEach(function(e,t){e&&e.index&&(a=e.index,i=1),e&&!e.index&&0!==t&&(e.index=a+i),i++});n--;)e.splice(o,0,null);o+=n}}else e?e[o]=null:e=[];return e[r]},e.processIdx=pe,e.getRangeIndexes=c,e.getCellIndexes=u,e.getColIndex=f,e.getCellAddress=g,e.getRangeAddress=m,e.getColumnHeaderText=v,e.getIndexesFromAddress=y,e.getRangeFromAddress=C,e.getAddressFromSelectedRange=b,e.getAddressInfo=x,e.getSheetIndexFromAddress=S,e.getSwapRange=w,e.isSingleCell=E,e.executeTaskAsync=R,e.getWorkbookRequiredModules=k,e.CellStyle=nr,e.FilterCollection=ir,e.SortCollection=ar,e.DefineName=or,e.ProtectSettings=sr,e.Hyperlink=lr,e.Validation=hr,e.Format=dr,e.ConditionalFormat=pr,e.LegendSettings=cr,e.DataLabelSettings=ur,e.Border=fr,e.MarkerSettings=gr,e.MajorGridLines=mr,e.MinorGridLines=vr,e.Axis=yr,e.Chart=Cr,e.Image=br,e.AutoFillSettings=xr,e.workbookDestroyed=Sr,e.updateSheetFromDataSource=wr,e.dataSourceChanged=Ir,e.dataChanged=Er,e.triggerDataChange=Rr,e.workbookOpen=kr,e.beginSave=Fr,e.beginAction=Ar,e.sortImport=Nr,e.findToolDlg=Or,e.exportDialog=Tr,e.setFilteredCollection=Dr,e.saveCompleted=Lr,e.applyNumberFormatting=Pr,e.getFormattedCellObject=Mr,e.refreshCellElement=Hr,e.setCellFormat=Br,e.findAllValues=Ur,e.textDecorationUpdate=Vr,e.applyCellFormat=_r,e.updateUsedRange="updateUsedRange",e.updateRowColCount=zr,e.workbookFormulaOperation=jr,e.workbookEditOperation=qr,e.checkDateFormat=Wr,e.checkNumberFormat=Gr,e.parseDecimalNumber=Yr,e.getFormattedBarText=Xr,e.activeCellChanged=Kr,e.openSuccess=$r,e.openFailure=Zr,e.sheetCreated=Qr,e.sheetsDestroyed=Jr,e.aggregateComputation=en,e.getUniqueRange=tn,e.removeUniquecol=rn,e.checkUniqueRange=nn,e.reApplyFormula=an,e.clearFormulaDependentCells=on,e.formulaInValidation=sn,e.beforeSort="beforeSort",e.initiateSort=ln,e.updateSortedDataOnCell=hn,e.sortComplete=dn,e.sortRangeAlert="sortRangeAlert",e.initiatelink="initiatelink",e.beforeHyperlinkCreate=pn,e.afterHyperlinkCreate=cn,e.beforeHyperlinkClick=un,e.afterHyperlinkClick=fn,e.addHyperlink="addHyperlink",e.setLinkModel=gn,e.beforeFilter="beforeFilter",e.initiateFilter=mn,e.filterComplete="filterComplete",e.filterRangeAlert=vn,e.clearAllFilter="clearAllFilter",e.wrapEvent=yn,e.onSave=Cn,e.insert=bn,e.deleteAction=xn,e.insertModel=Sn,e.deleteModel=wn,e.isValidation=In,e.cellValidation=En,e.addHighlight=Rn,e.dataValidate="dataValidate",e.find="find",e.goto=kn,e.findWorkbookHandler="findHandler",e.replace=Fn,e.replaceAll=An,e.showFindAlert=Nn,e.findKeyUp=On,e.removeHighlight=Tn,e.queryCellInfo=Dn,e.count=Ln,e.findCount="findCount",e.protectSheetWorkBook=Pn,e.updateToggle=Mn,e.protectsheetHandler=Hn,e.replaceAllDialog=Bn,e.unprotectsheetHandler=Un,e.workBookeditAlert="editAlert",e.setLockCells=Vn,e.applyLockCells="applyLockCells",e.setMerge=_n,e.applyMerge=zn,e.mergedRange=jn,e.activeCellMergedRange=qn,e.insertMerge=Wn,e.hideShow=Gn,e.setCFRule=Yn,e.applyCF=Xn,e.clearCFRule=Kn,e.clear=$n,e.clearCF=Zn,e.setImage=Qn,e.setChart=Jn,e.initiateChart=ei,e.refreshRibbonIcons=ti,e.refreshChart=ri,e.refreshChartSize=ni,e.updateChart=ii,e.deleteChartColl=ai,e.initiateChartModel="initiateChartModel",e.focusChartBorder=oi,e.saveError=si,e.validationHighlight=li,e.beforeInsert=hi,e.beforeDelete=di,e.deleteHyperlink=pi,e.moveOrDuplicateSheet=ci,e.setAutoFill=ui,e.refreshCell=fi,e.getFillInfo=gi,e.getautofillDDB=mi,e.rowFillHandler=vi,e.getTextSpace=yi,e.refreshClipboard=Ci,e.updateView=bi,e.selectionComplete=xi,e.refreshInsertDelete=Si,e.getUpdatedFormulaOnInsertDelete=wi,e.beforeCellUpdate=Ii,e.duplicateSheetFilterHandler=Ei,e.unMerge="unMerge",e.addFormatToCustomFormatDlg=Ri,e.checkFormulaRef=ki,e.parseFormulaArgument=Fi,e.getChartRowIdxFromClientY=Ai,e.getChartColIdxFromClientX=Ni,e.refreshChartCellOnInit=Oi,e.checkIsFormula=B,e.isCellReference=U,e.isChar=V,e.isRowSelected=_,e.isColumnSelected=z,e.inRange=j,e.isInMultipleRange=q,e.isInRange=W,e.getSplittedAddressForColumn=G,e.isLocked=Y,e.isValidCellReference=X,e.columnIndex=K,e.skipHiddenIdx=$,e.isHeightCheckNeeded=Z,e.getUpdatedFormula=Q,e.updateCell=J,e.getDataRange=ee,e.insertFormatRange=te,e.deleteFormatRange=re,e.updateCFModel=ne,e.checkRange=ie,e.parseLocaleNumber=ae,e.getViewportIndexes=oe,e.setVisibleMergeIndex=se,e.getAutoDetectFormatParser=le,e.toFraction=F,e.getGcd=A,e.intToDate=N,e.dateToInt=O,e.isDateTime=T,e.isNumber=D,e.toDate=L,e.parseIntValue=P,e.workbookLocale=Ti,e.localeData=Di,e.currencyFormat=Li,e.DataBind=ji,e.WorkbookOpen=qi,e.WorkbookSave=Xi,e.WorkbookFormula=oa,e.WorkbookNumberFormat=sa,e.getFormatFromType=Ue,e.getTypeFromFormat=Ve,e.WorkbookSort=la,e.WorkbookFilter=ha,e.WorkbookImage=da,e.WorkbookChart=pa,e.WorkbookCellFormat=ca,e.WorkbookEdit=ua,e.WorkbookHyperlink=fa,e.WorkbookInsert=ga,e.WorkbookDelete=ma,e.WorkbookDataValidation=va,e.WorkbookFindAndReplace=Ca,e.WorkbookProtectSheet=ba,e.WorkbookMerge=xa,e.WorkbookConditionalFormat=Sa,e.WorkbookAutoFill=wa,e.getRequiredModules=et,e.ribbon=Ea,e.formulaBar=Ra,e.sheetTabs=ka,e.refreshSheetTabs=Fa,e.isFormulaBarEdit=Aa,e.contentLoaded=Na,e.mouseDown=Oa,e.spreadsheetDestroyed=Ta,e.editOperation=Da,e.formulaOperation=La,e.formulaBarOperation=Pa,e.click=Ma,e.keyUp=Ha,e.keyDown=Ba,e.formulaKeyUp="formulaKeyUp",e.formulaBarUpdate="formulaBarUpdate",e.onVerticalScroll=Ua,e.onHorizontalScroll=Va,e.beforeContentLoaded=_a,e.beforeVirtualContentLoaded=za,e.virtualContentLoaded=ja,e.contextMenuOpen="contextMenuOpen",e.cellNavigate=qa,e.mouseUpAfterSelection=Wa,e.cMenuBeforeOpen=Ga,e.insertSheetTab=Ya,e.removeSheetTab=Xa,e.renameSheetTab=Ka,e.ribbonClick=$a,e.refreshRibbon="ribbonRefresh",e.enableToolbarItems=Za,e.tabSwitch=Qa,e.selectRange=Ja,e.rangeSelectionByKeydown=eo,e.cut=to,e.copy=ro,e.paste=no,e.clearCopy=io,e.dataBound="dataBound",e.beforeDataBound="beforeDataBound",e.addContextMenuItems=ao,e.removeContextMenuItems=oo,e.enableContextMenuItems=so,e.enableFileMenuItems=lo,e.hideFileMenuItems=ho,e.addFileMenuItems=po,e.hideRibbonTabs=co,e.enableRibbonTabs=uo,e.addRibbonTabs=fo,e.addToolbarItems=go,e.hideToolbarItems=mo,e.beforeRibbonCreate=vo,e.rowHeightChanged=yo,e.colWidthChanged=Co,e.onContentScroll=bo,e.deInitProperties=xo,e.activeSheetChanged=So,e.initiateCustomSort=wo,e.applySort=Io,e.collaborativeUpdate="collaborativeUpdate",e.autoFit=Eo,e.updateToggleItem=Ro,e.initiateHyperlink=ko,e.editHyperlink=Fo,e.openHyperlink=Ao,e.removeHyperlink=No,e.createHyperlinkElement=Oo,e.sheetNameUpdate=To,e.hideSheet=Do,e.performUndoRedo=Lo,e.updateUndoRedoCollection=Po,e.setActionData=Mo,e.getBeforeActionData=Ho,e.clearUndoRedoCollection=Bo,e.initiateFilterUI=Uo,e.renderFilterCell=Vo,e.refreshFilterRange=_o,e.updateSortCollection=zo,e.reapplyFilter=jo,e.filterByCellValue=qo,e.clearFilter=Wo,e.getFilteredColumn=Go,e.completeAction=Yo,e.filterCellKeyDown=Xo,e.getFilterRange=Ko,e.setAutoFit=$o,e.refreshFormulaDatasource=Zo,e.setScrollEvent=Qo,e.initiateDataValidation=Jo,e.validationError="validationError",e.startEdit="startEdit",e.invalidData=es,e.clearInvalid="clearInvalid",e.protectSheet=ts,e.applyProtect=rs,e.unprotectSheet="unprotectSheet",e.protectCellFormat=ns,e.gotoDlg=is,e.findDlg=as,e.findHandler=os,e.created="created",e.editAlert=ss,e.setUndoRedo=ls,e.enableFormulaInput=hs,e.protectSelection=ds,e.hiddenMerge=ps,e.checkPrevMerge=cs,e.checkMerge=us,e.removeDataValidation=fs,e.showAggregate=gs,e.goToSheet=ms,e.showSheet=vs,e.renderCFDlg=ys,e.clearViewer=Cs,e.initiateFormulaReference=bs,e.initiateCur=xs,e.clearCellRef=Ss,e.editValue=ws,e.addressHandle=Is,e.initiateEdit=Es,e.forRefSelRender=Rs,e.insertImage=ks,e.refreshOverlayElem=Fs,e.refreshImgCellObj=As,e.getRowIdxFromClientY=Ns,e.getColIdxFromClientX=Os,e.createImageElement=Ts,e.deleteImage=Ds,e.deleteChart=Ls,e.refreshChartCellObj=Ps,e.refreshChartCellModel=Ms,e.refreshImagePosition=Hs,e.updateTableWidth=Bs,e.focusBorder=Us,e.clearChartBorder=Vs,e.insertChart=_s,e.chartRangeSelection=zs,e.insertDesignChart=js,e.removeDesignChart=qs,e.chartDesignTab=Ws,e.addChartEle=Gs,e.undoRedoForChartDesign=Ys,e.protectWorkbook=Xs,e.unProtectWorkbook=Ks,e.getPassWord=$s,e.setProtectWorkbook=Zs,e.removeWorkbookProtection=Qs,e.importProtectWorkbook=Js,e.selectionStatus=el,e.freeze=tl,e.overlayEleSize=rl,e.updateScroll=nl,e.positionAutoFillElement=il,e.hideAutoFillOptions=al,e.performAutoFill=ol,e.selectAutoFillRange=sl,e.autoFill="autoFill",e.hideAutoFillElement=ll,e.unProtectSheetPassword=hl,e.updateTranslate=dl,e.getUpdatedScrollPosition=pl,e.updateScrollValue=cl,e.beforeCheckboxRender=ul,e.refreshCheckbox=fl,e.renderInsertDlg=gl,e.toggleProtect=ml,e.getUpdateUsingRaf=tt,e.removeAllChildren=rt,e.getColGroupWidth=nt,e.getScrollBarWidth=it,e.getSiblingsHeight=at,e.inView=st,e.getCellPosition=lt,e.setPosition=ht,e.removeRangeEle=dt,e.locateElem=pt,e.setStyleAttribute=ct,e.getStartEvent=ut,e.getMoveEvent=ft,e.getEndEvent=gt,e.isTouchStart=mt,e.isTouchMove=vt,e.isTouchEnd=yt,e.isMouseDown=Ct,e.isMouseMove=bt,e.isMouseUp=xt,e.isNavigationKey=St,e.getClientX=wt,e.getClientY=It,e.getPageX=Et,e.getPageY=Rt,e.getDPRValue=kt,e.setAriaOptions=Ft,e.destroyComponent=At,e.setResize=Nt,e.setWidthAndHeight=Ot,e.setTextLineHeight=function(e){Pl=e},e.findMaxValue=Tt,e.updateAction=Dt,e.hasTemplate=Lt,e.setRowEleHeight=Pt,e.getTextHeight=Mt,e.getLineHeight=Ht,e.getTextWidth=Bt,e.getLines=Ut,e.getBorderHeight=Vt,e.getExcludedColumnWidth=_t,e.getTextHeightWithBorder=zt,e.setMaxHgt=jt,e.getMaxHgt=qt,e.focus=Wt,e.isLockedCells=Gt,e.isDiscontinuousRange=Yt,e.clearRange=Xt,e.isImported=Kt,e.getBottomOffset=$t,e.getRightIdx=Zt,e.setColMinWidth=function(e,t){e.renderModule.setSheetPanelSize(t)},e.addDPRValue=Qt,e.getSheetProperties=function(e,t){var r=[];if(t){var n=Object.getPrototypeOf(new zi(e,"cells",{},!0)).constructor.prototype.propList,i=n.colPropNames.concat(n.complexPropNames).concat(n.propNames),a=(n=Object.getPrototypeOf(new wl(e,"rows",{},!0)).constructor.prototype.propList).colPropNames.concat(n.complexPropNames).concat(n.propNames),o=(n=Object.getPrototypeOf(new Rl(e,"columns",{},!0)).constructor.prototype.propList).colPropNames.concat(n.complexPropNames).concat(n.propNames),s=(n=Object.getPrototypeOf(new Ui(e,"sheets",{},!0)).constructor.prototype.propList).colPropNames.concat(n.complexPropNames).concat(n.propNames);s.splice(s.indexOf("rows"),1),s.splice(s.indexOf("columns"),1),s.splice(s.indexOf("cells"),1),a.splice(a.indexOf("cells"),1),r.push.apply(r,s),-1===t.indexOf("rows")&&r.push.apply(r,a),-1===t.indexOf("columns")&&r.push.apply(r,o),-1===t.indexOf("cells")&&r.push.apply(r,i);var l;t.forEach(function(e){l=r.indexOf(e),r.indexOf(e)>-1&&r.splice(l,1)})}else r.push("ranges");var h={skipProps:r};return e.notify("getStringifyObject",h),h.model},e.getChartsIndexes=Jt,e.ScrollSettings=Vl,e.SelectionSettings=_l,e.DISABLED="e-disabled",e.WRAPTEXT=kl,e.locale=Fl,e.dialog=Al,e.actionEvents="actionEvents",e.overlay="shape",e.fontColor=Nl,e.fillColor=Ol,e.keyCodes=Tl,e.defaultLocale=Dl,e.Spreadsheet=Vh,e.Clipboard=Xl,e.Edit=Kl,e.Selection=$l,e.Scroll=Zl,e.VirtualScroll=Ql,e.KeyboardNavigation=Jl,e.KeyboardShortcut=eh,e.CellFormat=th,e.Resize=rh,e.ShowHide=nh,e.SpreadsheetHyperlink=ih,e.UndoRedo=oh,e.WrapText=sh,e.Insert=lh,e.Delete=hh,e.DataValidation=dh,e.ProtectSheet=ph,e.FindAndReplace=ch,e.Merge=uh,e.ConditionalFormatting=fh,e.AutoFill=gh,e.Ribbon=Rh,e.FormulaBar=kh,e.Formula=Fh,e.SheetTabs=Ah,e.Open=Nh,e.Save=Oh,e.ContextMenu=Th,e.NumberFormat=Dh,e.Sort=Lh,e.Filter=Ph,e.SpreadsheetImage=Mh,e.SpreadsheetChart=Hh,e.Render=Wl,e.SheetRender=zl,e.RowRenderer=jl,e.CellRenderer=ql,e.Calculate=ta,e.FormulaError=ra,e.FormulaInfo=na,e.CalcSheetFamilyItem=ia,e.getAlphalabel=Be,e.ValueChangedArgs=aa,e.Parser=Qi,e.CalculateCommon=Ki,e.isUndefined=function(e){return void 0===e},e.getSkeletonVal=De,e.isExternalFileLink=Le,e.getModules=Pe,e.getValue=Me,e.setValue=He,e.ModuleLoader=$i,e.BasicFormulas=Zi,Object.defineProperty(e,"__esModule",{value:!0})});
2
11
  //# sourceMappingURL=ej2-spreadsheet.umd.min.js.map