text: !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@syncfusion/ej2-base"),require("@syncfusion/ej2-data"),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-popups"),require("@syncfusion/ej2-grids")):"function"==typeof define&&define.amd?define(["exports","@syncfusion/ej2-base","@syncfusion/ej2-data","@syncfusion/ej2-navigations","@syncfusion/ej2-inputs","@syncfusion/ej2-buttons","@syncfusion/ej2-dropdowns","@syncfusion/ej2-lists","@syncfusion/ej2-splitbuttons","@syncfusion/ej2-popups","@syncfusion/ej2-grids"],t):t(e.ej={},e.ej2Base,e.ej2Data,e.ej2Navigations,e.ej2Inputs,e.ej2Buttons,e.ej2Dropdowns,e.ej2Lists,e.ej2Splitbuttons,e.ej2Popups,e.ej2Grids)}(this,function(e,t,r,n,i,o,s,a,l,h,p){"use strict";function d(e){var t,r=[];return e=e.indexOf("!")>-1?e.split("!")[1]:e,(e=-1===e.indexOf(":")?e+":"+e:e).split(":").forEach(function(e){t=c(e),r.push(t[0]),r.push(t[1])}),r}function c(e){return[parseInt(e.match(/\d+/)[0],10)-1,u(e.match(/[A-Z]+/i)[0].toUpperCase())]}function u(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 f(e,t){return m(t+1)+(e+1)}function g(e){return f(e[0],e[1])+":"+(t.isNullOrUndefined(e[2])?f(e[0],e[1]):f(e[2],e[3]))}function m(e){return e/26>1?m(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 v(e){return d(y(e))}function y(e){return e.split("!")[1]||e}function C(e){return e.name+"!"+e.selectedRange}function b(e,t){var r;return r=t.indexOf("!")>-1?se(e,le(t)):e.activeSheetIndex,{sheetIndex:r,indices:v(t)}}function S(e){var t=e.slice();return e[0]>e[2]&&x(t,0,2),e[1]>e[3]&&x(t,1,3),t}function x(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function w(e){return e[0]===e[2]&&e[1]===e[3]}function I(e,t,r,n,i){return new Ke(e,t,r,n,i)}function E(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(k(r,n));return r/i+"/"+n/i}function k(e,t){return e=Number(e),(t=Number(t))?k(t,e%t):e}function R(e){return e=Number(e),(e=e>0&&e<1?1+e:0===e?1:e)>60&&(e-=1),new Date(864e5*(e-1)+new Date("01/01/1900").getTime())}function A(e,t){var r=(new Date).getTimezoneOffset(),n=new Date("01/01/1900").toUTCString().replace(" GMT",""),i=new Date(n),o=T(e)?e:new Date(e),s=new Date(o.toUTCString().replace(" GMT","")).getTime()-i.getTime(),a=s;t||(a=r>0?s+60*r*1e3:s-60*r*1e3);var l=a/864e5;return t?l:parseInt(l.toString(),10)+2}function T(e){return"[object Date]"===Object.prototype.toString.call(e)&&!isNaN(e.valueOf())}function F(e){return e-parseFloat(e)>=0}function N(e,r){var n=t.getDefaultDateObject(),i=n.dateTimeFormats.availableFormats,o={dateObj:null,isCustom:!1,type:""};"string"==typeof e&&(e=e.toUpperCase());for(var s=0,a=Object.keys(n.dateFormats);s<a.length;s++){var l=a[s];if(o.dateObj=r.parseDate(e,{format:n.dateFormats[l],skeleton:l}),o.dateObj){o.type="date",o.isCustom=!1;break}}if(t.isNullOrUndefined(o.dateObj))for(var h=0,p=Object.keys(i);h<p.length;h++){l=p[h];if(o.dateObj=r.parseDate(e,{format:i[l],skeleton:l}),o.dateObj){if(o.type=e.toString().indexOf(":")>-1?"time":"datetime","time"===o.type){var d=o.dateObj.toLocaleTimeString();o.dateObj=new Date("01/01/1900 "+d)}o.isCustom=!0;break}}if(t.isNullOrUndefined(o.dateObj))for(var c=0,u=Object.keys(n.timeFormats);c<u.length;c++){l=u[c];if(o.dateObj=r.parseDate(e,{format:n.timeFormats[l],skeleton:l}),o.dateObj){d=o.dateObj.toLocaleTimeString();o.dateObj=new Date("01/01/1900 "+d),o.type="time",o.isCustom=!1;break}}return"#DIV/0!"===e||o.dateObj||"Invalid Date"===new Date(e).toString()||(o.dateObj=new Date(e)),o}function O(e){var t="General";switch(e.split(" ").join("")){case"Number":t="0.00";break;case"Currency":t="$#,##0.00";break;case"Accounting":t='_($* #,##0.00_);_($* (#,##0.00);_($* "-"??_);_(@_)';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 D(e){var t="General";switch(e){case"0.00":t="Number";break;case"$#,##0.00":case"$#,##0_);[Red]($#,##0)":case"$#,##0.00_);[Red]($#,##0.00)":case"$#,##0.00_);($#,##0.00)":case"$#,##0_);($#,##0)":t="Currency";break;case'_($*#,##0.00_);_($*(#,##0.00);_($*"-"??_);_(@_)':case'_($*#,##0.00_);_($* (#,##0.00);_($*"-"??_);_(@_)':case'_($* #,##0.00_);_($* (#,##0.00);_($* "-"??_);_(@_)':t="Accounting";break;case"mm-dd-yyyy":case"dd-mm-yyyy":case"dd-mm-yy":case"mm-dd-yy":t="ShortDate";break;case"dddd, mmmm dd, yyyy":t="LongDate";break;case"h:mm:ss AM/PM":t="Time";break;case"0.00%":case"0%":t="Percentage";break;case"# ?/?":case"# ??/??":case"# ???/???":t="Fraction";break;case"0.00E+00":t="Scientific";break;case"@":t="Text"}return t}function L(e){var t=[];return e.includeBasicFormulas&&t.push({member:"basic-formulas",args:[e]}),t}function H(e,r){for(var n=r,i=e.replace(/\[/g,".").replace(/\]/g,"").split("."),o=0;o<i.length&&!t.isUndefined(n);o++)n=n[i[o]];return n}function B(e,r,n){var i,o,s=e.replace(/\[/g,".").replace(/\]/g,"").split("."),a=n||{},l=a,h=s.length;for(i=0;i<h;i++)o=s[i],i+1===h?l[o]=void 0===r?{}:r:t.isNullOrUndefined(l[o])&&(l[o]={}),l=l[o];return a}function M(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=[],o=0;o<r;o++)i[r-o-1]=t[o];return i.join("")}function _(e,t){return void 0===t&&(t=[]),t.push({member:"workbookBasic",args:[]}),t.push({member:"workbookAll",args:[]}),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.allowDataValidation&&t.push({member:"workbookConditionalFormatting",args:[e]}),e.allowImage&&t.push({member:"workbookImage",args:[e]}),t}function P(e){return e&&"="===e[0]&&e.length>1}function V(e){for(var t=e,r=0,n=0,i=[89,71,69],o="",s=t.length,a=0;a<s;a++)U(t[a])&&r++;var l=(o=t.substring(0,r)).length;if(l!==s&&l<4&&1!==s&&isNaN(parseInt(t,10))){for(;n<l;){if(!(o[n]&&o[n].charCodeAt(0)<i[n])){if(!o[n]&&n>0)break;return!1}n++}var h=parseFloat(t.substring(r,s));if(h>0&&h<1048577)return!0}return!1}function U(e){return e.charCodeAt(0)>=65&&e.charCodeAt(0)<=90||e.charCodeAt(0)>=97&&e.charCodeAt(0)<=122}function j(e,t,r,n){var i=K(r,e);if(!i||!i.cells){if(!n)return null;i?r.rows[e].cells=[]:r.rows[e]={cells:[]}}return r.rows[e].cells[t]||null}function q(e,r,n,i,o){n.rows[e]?n.rows[e].cells||(n.rows[e].cells=[]):n.rows[e]={cells:[]},o&&n.rows[e].cells[r]?t.extend(n.rows[e].cells[r],i,null,!0):n.rows[e].cells[r]=i}function z(e,t){var r={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:""},n={};return Object.keys(t?r:e).forEach(function(t){e[t]!==r[t]&&(n[t]=e[t])}),n}function W(e,t,r){void 0===t&&(t=!0);for(var n=r.getAddressInfo(e),i=n.indices,o=de(r,n.sheetIndex),s=i[0];s<=i[2];s++)for(var a=i[1];a<=i[3];a++)q(s,a,o,{wrap:t},!0);r.setProperties({sheets:r.sheets},!0),r.notify(Nt,{range:i,wrap:t,sheet:o})}function G(e,t,r,n){return new Promise(function(i,o){i(function(){var i,o,s=new Map,a=se(e,le(t)),l=de(e,a),h=v(t),p=h[0],d=0,c={sheet:l,indexes:h,promise:new Promise(function(e,t){e(void 0)})};return e.notify(Je,c),c.promise.then(function(){for(;p<=h[2];){var t={};for(o=K(l,p),i=h[1];i<=h[3];){if(r){s instanceof Map&&(s=[]);var c=m(i+1);t[c]=n?o?function(e,t,r,n,i){var o=j(t,r,i);{if(o){if(o.format){var s={value:e.getDisplayText(o),rowIndex:t,colIndex:r,sheetIndex:n,dateObj:"",isDate:!1,isTime:!1};return e.notify(ct,s),s.isDate?s.dateObj:o.value}return o.value}return""}}(e,p,i,a,l):"":o?j(p,i,l):null,h[3]<i+1&&(t.__rowIndex=(p+1).toString()),s[d.toString()]=t}else{var u={};if(Object.assign(u,o?j(p,i,l):null),u.colSpan>1&&u.rowSpan>1)for(var g=void 0,v=p,y=p+u.rowSpan;v<y;v++)for(var C=i,b=i+u.colSpan;C<b;C++)v===p&&C===i||(g=new Object,v!==p&&(g.rowSpan=p-v),C!==i&&(g.colSpan=i-C),l.rows[v]&&l.rows[v].cells&&l.rows[v].cells[C]&&(delete l.rows[v].cells[C].value,delete l.rows[v].cells[C].formula),q(v,C,l,g,!0));else if(u.colSpan>1)for(v=i+1,y=i+u.colSpan;v<y;v++)q(p,v,l,{colSpan:i-v},!0),l.rows[p]&&l.rows[p].cells&&l.rows[p].cells[v]&&(delete l.rows[p].cells[v].value,delete l.rows[p].cells[v].formula);else if(u.rowSpan>1)for(v=p+1,y=p+u.rowSpan;v<y;v++)q(v,i,l,{rowSpan:p-v},!0),l.rows[v]&&l.rows[v].cells&&l.rows[v].cells[i]&&(delete l.rows[v].cells[i].value,delete l.rows[v].cells[i].formula);if(!n&&J(l,p)){p++;continue}if(!n&&oe(l,i)){i++;continue}if(u.style){var S={};Object.assign(S,u.style),u.style=S}var x={cell:u,address:f(p,i)};e.trigger($t,x),s.set(x.address,x.cell)}i++}p++,d++}return s})}())})}function Y(e,r,n){for(var i,o,s,a=0,l=e.length,h=function(h){if(t.isNullOrUndefined(e[h])||t.isUndefined(e[h].index)||(o=a=e[h].index-h,delete e[h].index),a>0){for(i=0;a--;)r?(n.createSheet(h+i),i++):e.splice(h,0,null);h+=o,l+=o}if(r){e[h].id<1&&(e[h].id=ue(n.sheets)),e[h].name||(e[h].name="Sheet"+ce(n));var p=0;e[h].rows.forEach(function(e){p=Math.max(p,e&&e.cells&&e.cells.length-1||0)}),e[h].usedRange={rowIndex:e[h].rows.length-1,colIndex:p}}s=h},p=0;p<l;p++)h(p),p=s}function X(e,r,n,i){for(var o,s,a=de(e,n),l=v(r),h=l[0],p=l[2];h<=p;h++)for(o=l[1],s=l[3];o<=s;o++){var d=j(h,o,a);e.notify(fr,{rowIdx:h,colIdx:o}),!t.isNullOrUndefined(d)&&i&&(delete d.value,t.isNullOrUndefined(d.formula)||delete d.formula)}}function K(e,t){return e.rows[t]}function $(e,t,r){e.rows[t]||(e.rows[t]={}),Object.keys(r).forEach(function(n){e.rows[t][n]=r[n]})}function J(e,t){return e.rows[t]&&e.rows[t].hidden}function Z(e,t){return e&&e.rows&&e.rows[t]?e.rows[t].hidden?0:void 0===e.rows[t].height?20:e.rows[t].height:20}function Q(e,t,r){e&&e.rows&&(e.rows[t]||(e.rows[t]={}),e.rows[t].height=r)}function ee(e,t,r){void 0===r&&(r=t);var n,i=0;t>r&&(n=t,t=r,r=n);for(var o=t;o<=r;o++)i+=Z(e,o);return i}function te(e,t){return e.columns?e.columns[t]||(e.columns[t]={}):(e.columns=[],e.columns[t]={}),e.columns[t]}function re(e,t,r){var n=te(e,t);Object.keys(r).forEach(function(e){n[e]=r[e]})}function ne(e,t,r){return e&&e.columns&&e.columns[t]?!r&&e.columns[t].hidden?0:e.columns[t].width||e.columns[t].customWidth?e.columns[t].width:64:64}function ie(e,t,r){void 0===r&&(r=t);var n=0;if(t>r){var i=t;t=r,r=i}for(var o=t;o<=r;o++)n+=ne(e,o);return n}function oe(e,t){return e.columns[t]&&e.columns[t].hidden}function se(e,t){for(var r,n=0;n<e.sheets.length;n++)if(e.sheets[n].name.toLowerCase()===t.toLowerCase()){r=n;break}return r}function ae(e,t){for(var r,n=0;n<e.sheets.length;n++)if(e.sheets[n].id===t){r=n;break}return r}function le(e){return e.split("!")[0].replace(/\'/gi,"")}function he(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 pe(e,t,r){void 0===r&&(r={}),r.selectedRange=t}function de(e,t){return e.sheets[t]}function ce(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 ue(e){var t=0;return e.forEach(function(e){t=Math.max(e.id,t)}),t+1}function fe(e,r){var n=r||e.sheets;n.forEach(function(e){e.id=e.id||0,e.name=e.name||"",e.rowCount=t.isUndefined(e.rowCount)?100:e.rowCount,e.colCount=t.isUndefined(e.colCount)?100:e.colCount,e.topLeftCell=e.topLeftCell||"A1",e.activeCell=e.activeCell||"A1",e.selectedRange=e.selectedRange||"A1",e.usedRange=e.usedRange||{rowIndex:0,colIndex:0},e.ranges=e.ranges?function(e){return e.forEach(function(e){e.startCell=e.startCell||"A1",e.address=e.address||"A1",e.template=e.template||"",e.showFieldAsHeader=!!t.isUndefined(e.showFieldAsHeader)||e.showFieldAsHeader}),e}(e.ranges):[],e.rows=e.rows||[],e.columns=e.columns||[],e.showHeaders=!!t.isUndefined(e.showHeaders)||e.showHeaders,e.showGridLines=!!t.isUndefined(e.showGridLines)||e.showGridLines,e.state=e.state||"Visible",e.maxHgts=[],e.protectSettings=e.protectSettings||{selectCells:!1,formatCells:!1,formatRows:!1,formatColumns:!1,insertLink:!1},e.isProtected=e.isProtected||!1,Y(e.columns),function(e){e.forEach(function(e){e&&e.cells&&Y(e.cells)}),Y(e)}(e.rows)}),Y(n,!0,e)}function ge(e,t){return void 0===t&&(t=e.activeSheetIndex),de(e,t).name}function me(e){var t=[];return function(e,t){t.push({member:"basic",args:[]}),t.push({member:"all",args:[]}),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]}),t.push({member:"workbookFormula",args:[e]}),t.push({member:"workbookEdit",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]});"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:"collaborativeEditing",args:[e]}),t.push({member:"protectSheet",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,t),_(e,t),t}function ve(e){requestAnimationFrame(function(){e()})}function ye(e,t){for(;e.firstChild;)e.removeChild(e.firstChild)}function Ce(e){var t=30;return e.toString().length>3&&(t=10*e.toString().length),t}function be(){if(null!==Go)return Go;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),Go=t}function Se(e,t){void 0===t&&(t=Yo);return xe(e,"previous",t)+xe(e,"next",t)}function xe(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 we(e,t,r){if(e.scrollSettings.enableVirtualization){var n=e.viewport.topIndex,i=e.viewport.leftIndex,o=n+e.viewport.rowCount+2*e.getThreshold("row"),s=i+e.viewport.colCount+2*e.getThreshold("col"),a=n<=t[0]&&o>=t[2]&&i<=t[1]&&s>=t[3];if(a)return!0;if(r){if(t[0]<n&&t[2]<n||t[0]>o&&t[2]>o)return!1;if(t[0]<n&&t[2]>n&&(t[0]=n,a=!0),t[2]>o&&(t[2]=o,a=!0),t[1]<i&&t[3]<i||t[1]>s&&t[3]>s)return!1;t[1]<i&&t[3]>i&&(t[1]=i,a=!0),t[3]>s&&(t[3]=s,a=!0)}return a}return!0}function Ie(e,t,r){void 0===r&&(r={left:{idx:0,size:0},top:{idx:0,size:0}});var n,i=r.top.size,o=r.left.size;for(n=r.top.idx;n<t[0];n++)i+=ee(e,n);for(n=r.left.idx;n<t[1];n++)o+=ie(e,n);return{top:i,left:o}}function Ee(e,t,r,n,i){var o=S(t),s=Ie(r,o,i),a=[Xe(r,0,!0),Xe(r,0,!0,"columns")],l={top:(o[0]===a[0]?s.top:s.top-1)+"px",height:ee(r,t[0],t[2])+(o[0]===a[0]?0:1)+"px",width:ie(r,t[1],t[3])+(o[1]===a[1]?0:1)+"px"};l[n?"right":"left"]=(o[1]===a[1]?s.left:s.left-1)+"px",ke([{element:e,attrs:l}])}function ke(e){requestAnimationFrame(function(){e.forEach(function(e){t.setStyleAttribute(e.element,e.attrs)})})}function Re(){return t.Browser.isPointer?"pointerdown":"mousedown touchstart"}function Ae(){return t.Browser.isPointer?"pointermove":"mousemove touchmove"}function Te(){return t.Browser.isPointer?"pointerup":"mouseup touchend"}function Fe(e){return"touchstart"===e.type||"pointerdown"===e.type&&"touch"===e.pointerType}function Ne(e){return"touchmove"===e.type||"pointermove"===e.type&&"touch"===e.pointerType}function Oe(e){return"touchend"===e.type||"pointerup"===e.type&&"touch"===e.pointerType}function De(e){return e.changedTouches?e.changedTouches[0].clientX:e.clientX}function Le(e){return e.changedTouches?e.changedTouches[0].clientY:e.clientY}function He(e,t){Object.keys(t).forEach(function(r){e&&e.setAttribute(Xo[r],t[r])})}function Be(e,r){if(e){var n=t.getComponent(e,r);n&&n.destroy()}}function Me(e,t,r,n){var i,o,s,a,l,h,p,d;n.getActiveSheet();if(r)i=n.element.getElementsByClassName("e-column-header")[0].getElementsByTagName("th")[e],o=n.element.getElementsByClassName("e-column-header")[0].getElementsByTagName("col")[e],s=n.element.getElementsByClassName("e-sheet-content")[0].getElementsByTagName("col")[e];else{i=n.element.getElementsByClassName("e-row-header")[0].getElementsByTagName("tr")[e],o=n.element.getElementsByClassName("e-row-header")[0].getElementsByTagName("tr")[e],s=n.element.getElementsByClassName("e-sheet-content")[0].getElementsByTagName("tr")[e],o.style.height=parseInt(t,10)>0?t:"2px",s.style.height=parseInt(t,10)>0?t:"0px";var c=n.getRowHeaderContent().getElementsByClassName("e-row"),u=[];u[0]=c[e].getElementsByTagName("td")[0].cloneNode(!0);for(var f=Pe(n.getRowHeaderTable(),u,!1,n)+1,g=n.getMainContent().getElementsByClassName("e-row"),m=[],v=0;v<g[e].getElementsByTagName("td").length;v++)m[v]=g[e].getElementsByTagName("td")[v].cloneNode(!0);var y=Pe(n.getContentTable(),m,!1,n)+1,C=f>=y?f:y;parseInt(s.style.height,10)<C||i.classList.contains("e-reach-fntsize")&&parseInt(s.style.height,10)===C?(i.classList.add("e-reach-fntsize"),o.style.lineHeight=parseInt(t,10)>=4?parseInt(t,10)-4+"px":parseInt(t,10)>0?parseInt(t,10)-1+"px":"0px",s.style.lineHeight=parseInt(t,10)>0?parseInt(t,10)-1+"px":"0px"):(o.style.removeProperty("line-height"),s.style.removeProperty("line-height"),i.classList.contains("e-reach-fntsize")&&i.classList.remove("e-reach-fntsize"))}if(a=i.previousElementSibling,p=i.nextElementSibling,a&&(a=i.previousElementSibling,l=o.previousElementSibling,h=s.previousElementSibling),p&&(p=i.nextElementSibling,d=o.nextElementSibling,s.nextElementSibling),parseInt(t,10)<=0&&!i.classList.contains("e-zero")&&!i.classList.contains("e-zero-start")){if(a&&p)if(r?(o.style.width="2px",s.style.width="0px"):(o.style.height="2px",s.style.height="0px"),a.classList.contains("e-zero-start")?(i.classList.add("e-zero-start"),s.classList.add("e-zero-start")):(i.classList.add("e-zero"),s.classList.add("e-zero")),p.classList.contains("e-zero")||p.classList.contains("e-zero-last")||(i.classList.add("e-zero-last"),s.classList.add("e-zero-last")),a.classList.contains("e-zero-last")&&(a.classList.remove("e-zero-last"),h.classList.remove("e-zero-last")),a.classList.contains("e-zero")?(i.classList.contains("e-zero-end"),_e(l,-2,r)):_e(l,-1,r),a.classList.contains("e-zero-start")&&_e(o,-1,r),p.classList.contains("e-zero"))if(i.classList.contains("e-zero-start"))for(;p;){if(p.classList.contains("e-zero")&&0!==parseInt(d.style.height,10)&&!r||0!==parseInt(d.style.width,10)&&r){r?(o.style.width=parseInt(o.style.width,10)-1+"px",d.style.width=parseInt(d.style.width,10)-1+"px"):(o.style.height=parseInt(o.style.height,10)-1+"px",d.style.height=parseInt(d.style.height,10)-1+"px"),p.classList.remove("e-zero"),p.classList.add("e-zero-start");break}var b=void 0;p.classList.remove("e-zero"),p.classList.add("e-zero-start"),r?(b=parseInt(p.getAttribute("aria-colindex"),10)-1,p=n.getColHeaderTable().getElementsByTagName("th")[b+1],d=n.getColHeaderTable().getElementsByTagName("col")[b+1]):(b=parseInt(p.getAttribute("aria-rowindex"),10)-1,p=n.getRowHeaderTable().getElementsByTagName("tr")[b+1],d=n.getRowHeaderTable().getElementsByTagName("tr")[b+1])}else _e(o,-2,r);else p.classList.contains("e-zero-end")?r?o.style.width="0px":o.style.height="0px":_e(d,-1,r);else if(a)r?(o.style.width="1px",s.style.width="0px"):(o.style.height="1px",s.style.height="0px"),i.classList.add("e-zero-end"),s.classList.add("e-zero-end"),i.classList.add("e-zero-last"),s.classList.add("e-zero-last"),a.classList.contains("e-zero")?_e(l,-2,r):_e(l,-1,r);else if(p)if(i.classList.add("e-zero-start"),s.classList.add("e-zero-start"),p.classList.contains("e-zero")||(i.classList.add("e-zero-last"),s.classList.add("e-zero-last")),r?(o.style.width="1px",s.style.width="0px"):(o.style.height="1px",s.style.height="0px"),p.classList.contains("e-zero"))for(;p;){if(p.classList.contains("e-zero")&&0!==parseInt(d.style.width,10)&&r||0!==parseInt(d.style.height,10)&&!r){r?(d.style.width=parseInt(d.style.width,10)-1+"px",o.style.width=parseInt(o.style.width,10)-1+"px"):(d.style.height=parseInt(d.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}b=void 0;p.classList.add("e-zero-start"),p.classList.remove("e-zero"),r?(b=parseInt(p.getAttribute("aria-colindex"),10)-1,d=n.getColHeaderTable().getElementsByTagName("col")[b+1],p=n.getColHeaderTable().getElementsByTagName("th")[b+1]):(b=parseInt(p.getAttribute("aria-rowindex"),10)-1,d=n.getRowHeaderTable().getElementsByTagName("tr")[b+1],p=n.getRowHeaderTable().getElementsByTagName("tr")[b+1])}else _e(d,-1,r)}else parseInt(t,10)>0&&(r?(o.style.width=t,s.style.width=t):(o.style.height=t,s.style.height=t),a&&p?(a.classList.contains("e-zero")?i.classList.contains("e-zero")?r?(l.style.width=parseInt(l.style.width,10)+2+"px",o.style.width=parseInt(o.style.width,10)-1+"px"):(l.style.height=parseInt(l.style.height,10)+2+"px",o.style.height=parseInt(o.style.height,10)-1+"px"):_e(o,-1,r):i.classList.contains("e-zero")?_e(l,1,r):i.classList.contains("e-zero-start")&&(r?(l.style.width=parseInt(l.style.width,10)+1+"px",o.style.width=parseInt(o.style.width,10)-1+"px"):(l.style.height=parseInt(l.style.height,10)+1+"px",o.style.height=parseInt(o.style.height,10)-1+"px")),p.classList.contains("e-zero")?_e(o,-1,r):(i.classList.contains("e-zero")||i.classList.contains("e-zero-start"))&&_e(d,1,r),i.classList.contains("e-zero")&&i.classList.remove("e-zero"),i.classList.contains("e-zero-start")&&i.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"),i.classList.contains("e-zero-last")&&i.classList.remove("e-zero-last"),s.classList.contains("e-zero-last")&&s.classList.remove("e-zero-last"),(a.classList.contains("e-zero")||a.classList.contains("e-zero-start"))&&(a.classList.add("e-zero-last"),h.classList.add("e-zero-last"))):a?(a.classList.contains("e-zero")?i.classList.contains("e-zero")?r?(o.style.width=parseInt(o.style.width,10)-1+"px",l.style.width=parseInt(l.style.width,10)+2+"px"):(o.style.height=parseInt(o.style.height,10)-1+"px",l.style.height=parseInt(l.style.height,10)+2+"px"):_e(o,-1,r):i.classList.contains("e-zero")?_e(l,1,r):_e(o,-1,r),i.classList.contains("e-zero")&&i.classList.remove("e-zero"),i.classList.contains("e-zero-end")&&i.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")):p&&(p.classList.contains("e-zero")?_e(o,-1,r):i.classList.contains("e-zero-start")&&(_e(d,1,r),i.classList.remove("e-zero-start")),i.classList.contains("e-zero")&&i.classList.remove("e-zero"),s.classList.contains("e-zero")&&s.classList.remove("e-zero"),i.classList.contains("e-zero-start")&&i.classList.remove("e-zero-start"),s.classList.contains("e-zero-start")&&s.classList.remove("e-zero-start")))}function _e(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 Pe(e,t,r,n,i,o){var s=n.createElement("div",{className:n.element.className,styles:"display: block"}),a=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),a.appendChild(t)}):(t.forEach(function(e){l.appendChild(e.cloneNode(!0))}),a.appendChild(l)),s.appendChild(a),document.body.appendChild(s);var h,p;return o?(p=parseInt(i,10),h=parseInt(i,10)):(p=a.getBoundingClientRect().height,h=a.getBoundingClientRect().width),document.body.removeChild(s),r?Math.ceil(h):Math.ceil(p)}function Ve(e,t,r){var n=e.eventArgs;switch(e.action){case"sorting":var i={args:{range:e.eventArgs.range,sortOptions:e.eventArgs.sortOptions,cancel:!1},promise:new Promise(function(e,t){e(void 0)})};t.notify(bt,i),i.promise.then(function(e){t.serviceLocator.getService("cell").refreshRange(v(e.range))});break;case"cellSave":var o=e.eventArgs,s=n.formula?{formula:o.formula}:{value:o.value};t.updateCell(s,o.address);break;case"format":"CellFormat"===n.requestType?t.cellFormat(n.style,n.range):t.numberFormat(n.format,n.range);break;case"clipboard":if(n.copiedInfo.isCut&&!r)return;(n.copiedInfo.isCut?t.cut(n.copiedRange):t.copy(n.copiedRange)).then(function(e){t.paste(n.pastedRange,n.type)});break;case"gridLines":t.sheets[n.sheetIdx].showGridLines=n.isShow;break;case"headers":t.sheets[n.sheetIdx].showHeaders=n.isShow;break;case"resize":case"resizeToFit":n.isCol?void 0===n.hide?t.setColWidth(n.width,n.index,n.sheetIdx):t.hideColumn(n.index,n.index,n.hide):void 0===n.hide?t.setRowHeight(n.height,n.index,n.sheetIdx):t.hideRow(n.index,n.index,n.hide);break;case"renameSheet":t.sheets[n.index-1].name=n.value;break;case"removeSheet":t.notify(Gr,{index:n.index,isAction:!0,count:n.sheetCount,clicked:!0});break;case"wrap":W(e.eventArgs.address,e.eventArgs.wrap,t);break;case"hideShow":n.isCol?t.hideColumn(n.startIndex,n.endIndex,n.hide):t.hideRow(n.startIndex,n.endIndex,n.hide);break;case"replace":t.updateCell({value:n.compareVal},n.address);break;case"insert":!1===r?t.delete(e.eventArgs.index,e.eventArgs.index+(e.eventArgs.model.length-1),e.eventArgs.modelType):t.notify(Ht,{model:"Sheet"===e.eventArgs.modelType?t:t.getActiveSheet(),start:e.eventArgs.index,end:e.eventArgs.index+(e.eventArgs.model.length-1),modelType:e.eventArgs.modelType,isAction:!1,checkCount:e.eventArgs.sheetCount,activeSheetIndex:e.eventArgs.activeSheetIndex});break;case"delete":!1===r?t.notify(Ht,{model:"Sheet"===e.eventArgs.modelType?t:t.getActiveSheet(),start:e.eventArgs.deletedModel,modelType:e.eventArgs.modelType,isAction:!1,columnCellsModel:e.eventArgs.deletedCellsModel}):t.delete(e.eventArgs.startIndex,e.eventArgs.endIndex,e.eventArgs.modelType);break;case"validation":if(r){var a={type:n.type,operator:n.operator,value1:n.value1,value2:n.value2,ignoreBlank:n.ignoreBlank,inCellDropDown:n.inCellDropDown};t.notify(_t,{rules:a,range:n.range})}else t.notify(Xt,{range:n.range});break;case"merge":e.eventArgs.isAction=!1,t.notify(ir,e.eventArgs);break;case"clear":t.notify(bi,{options:e.eventArgs,isPublic:!0});break;case"conditionalFormat":if(r){var l={type:n.type,cFColor:n.cFColor,value:n.value,range:n.range};t.notify(pr,{conditionalFormat:l})}else t.notify(cr,{range:n.range});break;case"clearCF":r?t.notify(cr,{range:n.selectedRange}):t.notify(vr,{conditionalFormats:n.cFormats,oldRange:n.oldRange,selectedRange:n.selectedRange});break;case"insertImage":r?t.notify(Li,{options:{data:e.eventArgs.imageData,height:e.eventArgs.imageHeight,width:e.eventArgs.imageWidth,imageId:e.eventArgs.id},range:e.eventArgs.range,isPublic:!1,isUndoRedo:!0}):t.notify(Hi,{id:e.eventArgs.id,sheetIdx:e.eventArgs.sheetIndex+1,range:e.eventArgs.range});break;case"imageRefresh":var h=document.getElementById(e.eventArgs.id);r?(e.eventArgs.isUndoRedo=!0,t.notify(Ni,e.eventArgs)):t.notify(Ni,{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}),h.style.height=r?e.eventArgs.currentHeight+"px":e.eventArgs.prevHeight+"px",h.style.width=r?e.eventArgs.currentWidth+"px":e.eventArgs.prevWidth+"px",h.style.top=r?e.eventArgs.currentTop+"px":e.eventArgs.prevTop+"px",h.style.left=r?e.eventArgs.currentLeft+"px":e.eventArgs.prevLeft+"px"}}function Ue(e,t,r,n){for(var i,o=e.sheets[n].ranges,s=0,a=o.length;s<a;s++)if(o[s].template&&(i=d(o[s].address.length?o[s].address:o[s].startCell))[0]<=t&&i[1]<=r&&i[2]>=t&&i[3]>=r)return!0;return!1}function je(e,t,r,n,i,o,s){void 0===s&&(s=!0);var a=Z(t,n),l=e.element.querySelector(".e-spreadsheet-edit");if(l&&l.innerHTML.indexOf("\n")>-1){var h=c(e.getActiveSheet().activeCell),p=j(h[0],h[1],t),d=void 0,u=l.innerHTML.split("\n"),f=0,g=u.length;for(d=0;d<g;d++){var m=We(u[d],ne(t,h[1]),p.style,e.cellStyle);0===m&&(m=1),f+=m}r=qe(e,p.style||e.cellStyle,f)+1}(i||e.getRow(n)).style.height=r+"px",t.showHeaders&&((o||e.getRow(n,e.getRowHeaderTable())).style.height=r+"px"),Q(t,n,r),e.setProperties({sheets:e.sheets},!0),s&&e.notify(fn,{rowIdx:n,threshold:r-a})}function qe(e,t,r){void 0===r&&(r=1);var n=t&&t.fontSize||e.cellStyle.fontSize,i=n.indexOf("pt")>-1?1.33*parseInt(n,10):parseInt(n,10);return Math.ceil(i*(t&&"Arial Black"===t.fontFamily?1.44:1.24)*r)}function ze(e,t,r){t||(t=r);var n=document.createElement("canvas").getContext("2d");return n.font=(t.fontStyle||r.fontStyle)+" "+(t.fontWeight||r.fontWeight)+" "+(t.fontSize||r.fontSize)+" "+(t.fontFamily||r.fontFamily),n.measureText(e).width}function We(e,t,r,n){var i,o=0,s=e.toString().split(" "),a=ze(" ",r,n),l=0;return t-=5,s.forEach(function(e){var s=0,h=0;i=ze(e,r,n),(o+i)/t>=1?(o&&l++,i/t>=1?(e.split("").forEach(function(e){h=ze(e,r,n),(s+=h)>t&&(l++,s=h)}),o=s+a):o=i+a):o+=i+a}),o&&(l+=Math.ceil((o-a)/t)),l}function Ge(e,t,r,n){e.maxHgts[t]||(e.maxHgts[t]={}),e.maxHgts[t][r]=n}function Ye(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 Xe(e,t,r,n){return void 0===n&&(n="rows"),t<0&&(t=-1),e[n][t]&&e[n][t].hidden&&(r?t++:t--,t=Xe(e,t,r,n)),t}var Ke=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){throw this.terminate(),e.message||e},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}(),$e="workbookDestroyed",Je="updateSheetFromDataSource",Ze="dataSourceChanged",Qe="workbookOpen",et="beginSave",tt="saveCompleted",rt="applyNumber",nt="getFormattedCell",it="refreshCellElem",ot="setCellFormat",st="findAllValues",at="textDecorationUpdate",lt="applyCellFormat",ht="updateUsedRange",pt="workbookFormulaOperation",dt="workbookEditOperation",ct="checkDateFormat",ut="getFormattedBarText",ft="activeCellChanged",gt="openSuccess",mt="openFailure",vt="sheetCreated",yt="sheetsDestroyed",Ct="aggregateComputation",bt="initiateSort",St="sortComplete",xt="beforeHyperlinkCreate",wt="afterHyperlinkCreate",It="beforeHyperlinkClick",Et="afterHyperlinkClick",kt="setLinkModel",Rt="initiateFilter",At="filterComplete",Tt="filterRangeAlert",Ft="clearAllFilter",Nt="wrapText",Ot="onSave",Dt="insert",Lt="delete",Ht="insertModel",Bt="deleteModel",Mt="isValidation",_t="setValidation",Pt="addHighlight",Vt="findNext",Ut="findPrevious",jt="gotoHandler",qt="replace",zt="replaceAll",Wt="ShowDialog",Gt="findUndoRedo",Yt="findKeyUp",Xt="removeValidation",Kt="removeHighlight",$t="queryCellInfo",Jt="protectSheet",Zt="updateToggleItem",Qt="protectsheetHandler",er="replaceAllDialog",tr="unprotectsheetHandler",rr="setLockCells",nr="applyLockCells",ir="setMerge",or="applyMerge",sr="mergedRange",ar="activeCellMergedRange",lr="insertMerge",hr="pasteMerge",pr="setCFRule",dr="cFInitialCheck",cr="clearCFRule",ur="cFRender",fr="cFDelete",gr="clear",mr="clearCF",vr="clearCells",yr="setImage",Cr=function(){function e(e){this.parent=e,this.localeObj=t.getNumericObject(this.parent.locale),this.decimalSep=this.localeObj.decimal,this.groupSep=this.localeObj.group,this.addEventListener()}return e.prototype.numberFormatting=function(e){var t=this.parent.activeSheetIndex;e.range&&e.range.indexOf("!")>-1&&(t=se(this.parent,e.range.split("!")[0]));for(var r,n=this.parent.sheets[t],i=d(e.range?e.range.indexOf("!")>-1?e.range.split("!")[1]:e.range:n.selectedRange),o=i[0];o<=i[2];o++)for(var s=i[1];s<=i[3];s++)q(o,s,n,{format:e.format},!0),r=j(o,s,n,!0),this.getFormattedCell({type:D(r.format),value:r.value,format:r.format,rowIndex:o,colIndex:s,sheetIndex:t,cell:r})},e.prototype.getFormattedCell=function(e){var r=t.isNullOrUndefined(e.value)?"":e.value,n=this.parent.sheets[t.isNullOrUndefined(e.sheetIndex)?this.parent.activeSheetIndex:e.sheetIndex],i=d(n.activeCell),o=Number(e.sheetIndex)?Number(e.sheetIndex):this.parent.activeSheetIndex,s=e.cell?e.cell:j(i[0],i[1],n),a=!1,l=t.getNumberDependable(this.parent.locale,"USD");if(""===e.format||"General"===e.format){s=s||{};var h={value:e.value,rowIndex:i[0],colIndex:i[1],sheetIndex:this.parent.activeSheetIndex,updatedVal:e.value,isDate:!1,isTime:!1};this.checkDateFormat(h),h.isDate?(a=!0,s.value=e.value=h.updatedVal,s.format=e.format=O("ShortDate")):h.isTime&&(a=!0,s.value=e.value=h.updatedVal,s.format=e.format=O("Time"))}e.type=e.format?D(e.format):"General";var p=this.processFormats(e,r,a,s);return this.parent.getActiveSheet().id-1===o&&this.parent.notify(it,{isRightAlign:p.rightAlign,result:p.fResult||e.value,rowIndex:e.rowIndex,colIndex:e.colIndex,sheetIndex:e.sheetIndex,type:e.type,curSymbol:l,value:e.value||""}),!e.onLoad&&(e.rowIndex>n.usedRange.rowIndex||e.colIndex>n.usedRange.colIndex)&&this.parent.setUsedRange(e.rowIndex,e.colIndex),e.formattedText=p.fResult||e.value,e.isRightAlign=p.rightAlign,e.curSymbol=l,e.formattedText},e.prototype.processFormats=function(e,r,n,i){var o,s=new t.Internationalization,a=t.getNumberDependable(this.parent.locale,"USD");if(e.format=e.format?e.format:"General",""!==r)switch(e.type){case"General":r=(o=this.autoDetectGeneralFormat({args:e,currencySymbol:a,fResult:r,intl:s,isRightAlign:n,curCode:"USD",cell:i,rowIdx:Number(e.rowIdx),colIdx:Number(e.colIdx)})).fResult,n=o.isRightAlign;break;case"Number":F(r)&&(r=this.applyNumberFormat(e,s),n=!0);break;case"Currency":F(r)&&(r=this.currencyFormat(e,s),n=!0);break;case"Percentage":F(r)&&(r=this.percentageFormat(e,s),n=!0);break;case"Accounting":F(r)&&(r=this.accountingFormat(e,s),n=!0);break;case"ShortDate":n=!!(r=this.shortDateFormat(e,s));break;case"LongDate":n=!!(r=this.longDateFormat(e,s));break;case"Time":n=!!(r=this.timeFormat(e,s));break;case"Fraction":F(r)&&(r=this.fractionFormat(e),n=!0);break;case"Scientific":F(r)&&(r=this.scientificFormat(e),n=!0);break;case"Text":n=!1}return{fResult:r,rightAlign:n}},e.prototype.autoDetectGeneralFormat=function(e){d(this.parent.getActiveSheet().activeCell);if(F(e.fResult)&&(e.args.format&&""!==e.args.format&&(e.args.format.toString().indexOf("%")>-1?e.fResult=this.percentageFormat(e.args,e.intl):e.args.format.toString().indexOf(e.currencySymbol)>-1?e.fResult=this.currencyFormat(e.args,e.intl):e.fResult=this.applyNumberFormat(e.args,e.intl)),e.fResult&&e.fResult.toString().split(this.decimalSep)[0].length>11&&(e.fResult=this.scientificFormat(e.args)),e.isRightAlign=!0),!t.isNullOrUndefined(e.fResult)){var r=e.fResult.toString();r.indexOf("%")>-1&&""!==r.split("%")[0]&&""===r.split("%")[1].trim()&&"NaN"!==Number(r.split("%")[0].split(this.groupSep).join("")).toString()?(e.args.value=Number(r.split("%")[0].split(this.groupSep).join("")),e.cell.format=e.args.format=O("Percentage"),e.fResult=this.percentageFormat(e.args,e.intl),e.cell.value=e.args.value.toString(),q(e.rowIdx,e.colIdx,this.parent.getActiveSheet(),e.cell,!0),e.isRightAlign=!0):r.indexOf(e.currencySymbol)>-1&&""!==r.split(e.currencySymbol)[1]&&"NaN"!==Number(r.split(e.currencySymbol)[1].split(this.groupSep).join("")).toString()&&(e.args.value=Number(r.split(e.currencySymbol)[1].split(this.groupSep).join("")),e.cell.format=e.args.format=O("Currency"),e.fResult=this.currencyFormat(e.args,e.intl),e.cell.value=e.args.value.toString(),q(e.rowIdx,e.colIdx,this.parent.getActiveSheet(),e.cell,!0),e.isRightAlign=!0)}return{isRightAlign:e.isRightAlign,fResult:e.fResult}},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=""===e.format?O("Number"):e.format,e.format=e.format.toString().split("_)").join(" ").split("_(").join(" ").split("[Red]").join("");var n=e.format.toString().split(";");return Number(e.value)>=0?e.format=n[0]:e.format=t.isNullOrUndefined(n[1])?n[0]:n[1].split("*").join(" "),r.formatNumber(Number(e.value),{format:e.format})},e.prototype.currencyFormat=function(e,r){e.format=""===e.format?O("Currency"):e.format,e.format=e.format.toString().split("_(").join(" ").split("_)").join(" ").split("[Red]").join("");var n=e.format.toString().split(";");return Number(e.value)>=0?e.format=n[0]:e.format=t.isNullOrUndefined(n[1])?n[0]:n[1].split("*").join(" "),r.formatNumber(Number(e.value),{format:e.format,currency:"USD"})},e.prototype.percentageFormat=function(e,t){return e.format=""===e.format?O("Percentage"):e.format,t.formatNumber(Number(e.value),{format:e.format})},e.prototype.accountingFormat=function(e,r){e.format=""===e.format?O("Accounting"):e.format,e.format=e.format.split("_(").join(" ").split("_)").join(" ").split("[Red]").join("");var n=t.getNumberDependable(this.parent.locale,"USD"),i=e.format.split(";");return Number(e.value)>=0?e.format=i[0]:e.format=i[1].split("*").join(" "),0===Number(e.value)?n+"- ":r.formatNumber(Number(e.value),{format:e.format,currency:"USD"}).split("-").join("")},e.prototype.shortDateFormat=function(e,t){var r,n=R(e.value),i=""===e.format||"General"===e.format?O("ShortDate"):e.format.toString();return i===O("ShortDate")?(i="M/d/yy",r={type:"date",skeleton:"yMd"}):r={type:"date",format:i},t.formatDate(n,r)},e.prototype.longDateFormat=function(e,t){var r=R(e.value),n=""===e.format||"General"===e.format?O("LongDate"):e.format.toString();return n===O("LongDate")&&(n="EEEE, MMMM d, y"),t.formatDate(r,{type:"date",format:n})},e.prototype.timeFormat=function(e,r){if(t.isNullOrUndefined(e.value))return"";t.isNullOrUndefined(e.value.toString().split(this.decimalSep)[1])||(e.value=parseFloat("1"+this.decimalSep+e.value.split(this.decimalSep)[1])||e.value);var n=R(e.value),i=""===e.format||"General"===e.format?O("Time"):e.format.toString();return i===O("Time")&&(i="h:mm:ss a"),r.formatDate(n,{type:"time",skeleton:"medium",format:i})},e.prototype.scientificFormat=function(e){e.format=""===e.format?O("Scientific"):e.format;var t=e.format.split("+")[1],r=this.findDecimalPlaces(e.format,"Scientific"),n=Number(e.value).toExponential(r);return n.indexOf("e+")>-1?n=n.split("e+")[0]+"E+"+this.findSuffix(t,n.split("e+")[1]):n.indexOf("e-")>-1&&(n=n.split("e-")[0]+"E-"+ +this.findSuffix(t,n.split("e-")[1])),n},e.prototype.fractionFormat=function(e){e.format=""===e.format?O("Fraction"):e.format;var t,r="";return e.value.toString().indexOf(this.decimalSep)>-1&&F(e.value)?(r=e.value.toString().split(this.decimalSep)[0],t=E(Number(e.value)),0===Number(r)?" "+t:r+" "+t):r},e.prototype.findDecimalPlaces=function(e,t){switch(t){case"Scientific":var r=e.toUpperCase().indexOf("E"),n=e.indexOf(this.decimalSep);if(r>-1)return e.substring(n+1,r).length}return 2},e.prototype.checkDateFormat=function(e){var r,n,i=new t.Internationalization,o=t.isNullOrUndefined(e.value)?"":e.value.toString(),s=j(e.rowIndex,e.colIndex,de(this.parent,t.isNullOrUndefined(e.sheetIndex)?this.parent.activeSheetIndex:e.sheetIndex));n=this.checkCustomDateFormat(o),o&&(o.indexOf("/")>-1||o.indexOf("-")>0||o.indexOf(":")>-1)&&"Invalid"!==n&&(((o=n)&&o.indexOf("/")>-1||o.indexOf("-")>0||o.indexOf(":")>-1)&&(r=N(o,i),t.isNullOrUndefined(r.dateObj)||"Invalid Date"===r.dateObj.toString()||(s=s||{},o=A(r.dateObj,o.indexOf(":")>-1).toString(),s.format&&""!==s.format||("time"===r.type?s.format=O("Time"):s.format=O("ShortDate")),e.isDate="date"===r.type||"datetime"===r.type,e.isTime="time"===r.type,e.dateObj=r.dateObj)),e.updatedVal=o)},e.prototype.checkCustomDateFormat=function(e){var t=e.indexOf("/")>-1?e.split("/"):e.indexOf("-")>0?e.split("-"):"",r=["jan","feb","mar","apr","may","jun","jul","aug","sep","sept","oct","nov","dec"];return 2===t.length?r.indexOf(t[0].toLowerCase())>-1&&Number(t[1])<=31?"01-"+t[0]+"-"+t[1]:r.indexOf(t[1].toLowerCase())>-1&&Number(t[0])<=31?t[0]+"-"+t[1]+"-"+(new Date).getFullYear():Number(t[0])<=31&&Number(t[1])<=12?t[0]+"-"+t[1]+"-"+(new Date).getFullYear():Number(t[1])<=31&&Number(t[0])<=12?t[0]+"-"+t[1]+"-"+(new Date).getFullYear():Number(t[0])<=12&&Number(t[1])<=9999&&Number(t[1])>=1900?"01-"+t[0]+"-"+t[1]:"Invalid":e},e.prototype.formattedBarText=function(e){var r=D(e.cell?e.cell.format:""),n=new t.Internationalization,i=e.value,o=O("ShortDate"),s=O("Time");switch(r){case"ShortDate":case"LongDate":e.value=this.shortDateFormat({type:r,value:e.value,format:o},n);break;case"Time":e.value=this.shortDateFormat({type:r,value:e.value,format:o},n)+" "+this.timeFormat({type:r,value:e.value,format:s},n)}(!e.value||e.value&&e.value.toString().indexOf("null")>-1)&&(e.value=i)},e.prototype.addEventListener=function(){this.parent.on(rt,this.numberFormatting,this),this.parent.on(nt,this.getFormattedCell,this),this.parent.on(ct,this.checkDateFormat,this),this.parent.on(ut,this.formattedBarText,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(rt,this.numberFormatting),this.parent.off(nt,this.getFormattedCell),this.parent.off(ct,this.checkDateFormat),this.parent.off(ut,this.formattedBarText))},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.getModuleName=function(){return"workbookNumberFormat"},e}(),br=function(){function e(e){this.parent=e,this.requestedInfo=[],this.addEventListener()}return e.prototype.addEventListener=function(){this.parent.on(Je,this.updateSheetFromDataSourceHandler,this),this.parent.on(Ze,this.dataSourceChangedHandler,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(Je,this.updateSheetFromDataSourceHandler),this.parent.off(Ze,this.dataSourceChangedHandler))},e.prototype.updateSheetFromDataSourceHandler=function(e){var t,n,i,o,s,a,l,h,p,c,u=this,f=[],g=[],m=new r.Deferred;if(e.promise=m.promise,e.sheet&&e.sheet.ranges.length)for(var v=function(v){var C=e.indexes[0],b=e.indexes[2],S=e.sheet.ranges[v];h=d(S.startCell)[0],a=S.dataSource instanceof r.DataManager?S.dataSource:S.dataSource?new r.DataManager(S.dataSource):new r.DataManager,s=s||a.dataSource.url,e.sheet.isLocalData=!a.dataSource.url,h<=C?C-=h:h<=b?(b-=h,C=0):C=-1,S.showFieldAsHeader&&0!==C&&(C-=1);var x=!1,w=0;y.initRangeInfo(S);var I=y.getMaxCount(S);if(c=y.getLoadedInfo(C,b,S),C=c.unloadedRange[0],b=c.unloadedRange[1],S.info.insertRowRange&&(S.info.insertRowRange.forEach(function(e){w+=e[1]-e[0]+1}),C-=w,b-=w),C>I?x=!0:b>I&&(b=I),y.requestedInfo.push({deferred:m,indexes:e.indexes,isNotLoaded:c.isNotLoaded}),C>=0&&c.isNotLoaded&&!x){g[v]=C,f.push(!1);var E=(S.query?S.query:new r.Query).clone();a.executeQuery(E.range(C,b>=I?b:b+1).requiresCount()).then(function(r){if(u.parent&&!u.parent.isDestroyed){if(o=r.result&&r.result.result?r.result.result:r.result,i=d(S.startCell),h=i[0],p=i[1],o.length){if(S.info.count||(I=r.count,S.info.count=r.count),n=Object.keys(o[0]),S.info.fldLen||(S.info.fldLen=n.length),S.info.insertColumnRange){var s=0;S.info.insertColumnRange.forEach(function(e){for(var t=e[0];t<=e[1];t++)t<=p?n.splice(0,0,"emptyCell"+s):n.splice(t-p,0,"emptyCell"+s),s++})}0===g[v]&&S.showFieldAsHeader&&(l=h+g[v]+w,n.forEach(function(r,n){(t=j(l,p+n,e.sheet,!0))?t.value||r.includes("emptyCell")||(t.value=r):e.sheet.rows[h+g[v]].cells[p+n]=r.includes("emptyCell")?{}:{value:r}})),o.forEach(function(r,i){l=h+g[v]+i+(S.showFieldAsHeader?1:0)+w;for(var o=0;o<n.length;o++)(t=j(l,p+o,e.sheet,!0))?t.value||n[o].includes("emptyCell")||q(l,p+o,e.sheet,u.getCellDataFromProp(r[n[o]]),!0):e.sheet.rows[l].cells[p+o]=n[o].includes("emptyCell")?{}:u.getCellDataFromProp(r[n[o]]),u.checkDataForFormat({args:e,cell:t,colIndex:p+o,rowIndex:l,i:i,j:o,k:v,range:S,sRanges:g,value:r[n[o]]})})}else n=[];if(e.sheet.usedRange.rowIndex=Math.max(h+(I||r.count)+(S.showFieldAsHeader?1:0)+w-1,e.sheet.usedRange.rowIndex),e.sheet.usedRange.colIndex=Math.max(p+n.length-1,e.sheet.usedRange.colIndex),w?(c=u.getLoadedInfo(C,b,S),C=c.unloadedRange[0],b=c.unloadedRange[1],C>I&&(c.isNotLoaded=!1),c.isNotLoaded&&(b>I&&(b=I),S.info.loadedRange.push([C,b]))):S.info.loadedRange.push([C,b]),f[v]=!0,-1===f.indexOf(!1)){if(b+h<e.sheet.usedRange.rowIndex){e.rangeSettingCount||(e.rangeSettingCount=[]),e.rangeSettingCount.push(v);var a={sheet:e.sheet,indexes:[0,0,e.sheet.usedRange.rowIndex,e.sheet.usedRange.colIndex],promise:new Promise(function(e,t){e(void 0)}),rangeSettingCount:e.rangeSettingCount};u.updateSheetFromDataSourceHandler(a),a.promise.then(function(){"workbook"!==u.parent.getModuleName()&&(e.rangeSettingCount.pop(),e.rangeSettingCount.length||u.parent.notify("created",null))})}u.checkResolve(e.indexes)}}})}else 0===v&&-1===f.indexOf(!1)&&y.checkResolve(e.indexes)},y=this,C=e.sheet.ranges.length-1;C>=0;C--)v(C);else m.resolve()},e.prototype.checkResolve=function(e){var t,r,n=0;this.requestedInfo.forEach(function(i,o){((r=JSON.stringify(i.indexes)===JSON.stringify(e))||t)&&(0===o?(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 t={};return"[object Object]"===Object.prototype.toString.call(e)?e.formula?t.formula=e.formula:e.value&&("string"==typeof e.value&&(0===e.value.indexOf("http://")||0===e.value.indexOf("https://")||0===e.value.indexOf("ftp://")||0===e.value.indexOf("www."))?t.hyperlink=e.value:t.value=e.value):P(e)?t.formula=e:"string"==typeof e&&(0===e.indexOf("http://")||0===e.indexOf("https://")||0===e.indexOf("ftp://")||0===e.indexOf("www."))?t.hyperlink=e:t.value=e,t},e.prototype.checkDataForFormat=function(e){if(""!==e.value){var t={value:e.value,rowIndex:e.rowIndex,colIndex:e.colIndex,isDate:!1,updatedVal:e.value,isTime:!1};this.parent.notify(ct,t),t.isDate?e.cell?(e.cell.format=O("ShortDate"),e.cell.value=t.updatedVal):(e.args.sheet.rows[e.rowIndex].cells[e.colIndex].format=O("ShortDate"),e.args.sheet.rows[e.rowIndex].cells[e.colIndex].value=t.updatedVal):t.isTime&&(e.cell?(e.cell.format=O("Time"),e.cell.value=t.updatedVal):(e.args.sheet.rows[e.rowIndex].cells[e.colIndex].format=O("Time"),e.args.sheet.rows[e.rowIndex].cells[e.colIndex].value=t.updatedVal))}},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=e.oldProp.sheets[e.sheetIdx],n=this.parent.sheets[e.sheetIdx],i=r&&r.ranges&&r.ranges[e.rangeIdx];if(i){var o=d(i.startCell);n.ranges[e.rangeIdx].info.loadedRange=[],i.info.loadedRange.forEach(function(e){for(var r=e[0];r<e[1];r++){t=n.rows[r+o[0]];for(var s=o[1];s<o[1]+i.info.fldLen;s++)t.cells[s].value=""}})}this.parent.notify("data-refresh",{sheetIdx:e.sheetIdx})},e.prototype.getModuleName=function(){return"dataBind"},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null,this.requestedInfo=[]},e}(),Sr="ribbon",xr="formulaBar",wr="sheetTabs",Ir="refreshSheetTabs",Er="dataRefresh",kr="initialLoad",Rr="contentLoaded",Ar="mouseDown",Tr="spreadsheetDestroyed",Fr="editOperation",Nr="formulaOperation",Or="formulaBarOperation",Dr="click",Lr="keyUp",Hr="keyDown",Br="verticalScroll",Mr="horizontalScroll",_r="beforeContentLoaded",Pr="beforeVirtualContentLoaded",Vr="virtualContentLoaded",Ur="cellNavigate",jr="mouseUpAfterSelection",qr="selectionComplete",zr="contextmenuBeforeOpen",Wr="insertSheetTab",Gr="removeSheetTab",Yr="renameSheetTab",Xr="ribboClick",Kr="enableToolbarItems",$r="tabSwitch",Jr="selectRange",Zr="paste",Qr="clearCopy",en="beforeDataBound",tn="addContextMenuItems",rn="removeContextMenuItems",nn="enableContextMenuItems",on="enableFileMenuItems",sn="hideFileMenuItems",an="addFileMenuItems",ln="hideRibbonTabs",hn="enableRibbonTabs",pn="addRibbonTabs",dn="addToolbarItems",cn="hideToolbarItems",un="beforeRibbonCreate",fn="rowHeightChanged",gn="colWidthChanged",mn="beforeHeaderLoaded",vn="onContentScroll",yn="deInitProperties",Cn="activeSheetChanged",bn="renameSheet",Sn="initiateCustomSort",xn="applySort",wn="collaborativeUpdate",In="hideShow",En="autoFitRowsColumns",kn="updateToggleItem",Rn="initiateHyperlink",An="editHyperlink",Tn="openHyperlink",Fn="removeHyperlink",Nn="createHyperlinkElement",On="sheetNameUpdate",Dn="hideSheet",Ln="performUndoRedo",Hn="updateUndoRedoCollection",Bn="setActionData",Mn="getBeforeActionData",_n="clearUndoRedoCollection",Pn="initiateFilterUI",Vn="renderFilterCell",Un="reapplyFilter",jn="filterByCellValue",qn="clearFilter",zn="getFilteredColumn",Wn="actionComplete",Gn="actionBegin",Yn="filterCellKeyDown",Xn="getFilterRange",Kn="setAutoFit",$n="refreshFormulaDatasource",Jn="setScrollEvent",Zn="initiatedatavalidation",Qn="invalidData",ei="protectSheet",ti="applyProtect",ri="protectCellFormat",ni="renderGotoDlgt",ii="renderFindDlg",oi="findHandler",si="replaceHandler",ai="created",li="editAlert",hi="setUndoRedo",pi="enableFormulaInput",di="protectSelection",ci="hiddenMerge",ui="checkPrevMerge",fi="checkMerge",gi="removeDataValidation",mi="showAggregate",vi="initiateConditionalFormat",yi="checkConditionalFormat",Ci="setCF",bi="clearViewer",Si="initiateFormulaReference",xi="initiateCur",wi="clearCellRef",Ii="editValue",Ei="addressHandle",ki="initiateEdit",Ri="forRefSelRender",Ai="blankWorkbook",Ti="insertImage",Fi="refreshImgElem",Ni="refreshImgCellObj",Oi="getRowIdxFromClientY",Di="getColIdxFromClientX",Li="createImageElement",Hi="deleteImage",Bi="refreshImagePosition",Mi=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.open=function(e){var t=this;if(this.parent.allowOpen)if(e.jsonObject)this.fetchSuccess(e.jsonObject);else{var r=new FormData;if(e.file){r.append("file",e.file);var n={file:e.file||null,cancel:!1,requestData:{method:"POST",body:r}};this.parent.trigger("beforeOpen",n),this.parent.notify(Gn,{eventArgs:n,action:"beforeOpen"}),n.cancel||fetch(this.parent.openUrl,n.requestData).then(function(e){return e.ok?e.json():Promise.reject({status:e.status,statusText:e.statusText,url:e.url})}).then(function(e){return t.fetchSuccess(e)}).catch(function(e){return t.fetchFailure(e)})}else this.parent.isOpen=!1}},e.prototype.fetchFailure=function(e){t.isUndefined(e.status)&&t.isUndefined(e.statusText)&&(e.statusText="Improper response"),this.parent.notify(mt,e),this.parent.isOpen=!1},e.prototype.fetchSuccess=function(e){var t=("string"==typeof e?JSON.parse(e):e).Workbook;["UnsupportedFile","InvalidUrl"].indexOf(t)>-1?this.parent.notify(gt,{context:this,data:t}):(this.updateModel(t),this.parent.notify(gt,{context:this,data:t}),this.parent.isOpen=!1)},e.prototype.updateModel=function(e){this.parent.notify(pt,{action:"unRegisterSheet"}),this.parent.sheetNameCount=1,this.parent.sheets=[],this.parent.notify(yt,{}),e.activeSheetIndex=e.activeSheetIndex||0,this.parent.setProperties({sheets:e.sheets,activeSheetIndex:e.activeSheetIndex,definedNames:e.definedNames||[]},!0),fe(this.parent),this.parent.notify(vt,null),this.parent.notify(pt,{action:"registerSheet",isImport:!0}),this.parent.notify(pt,{action:"initiateDefinedNames"}),this.parent.notify(Jt,null)},e.prototype.addEventListener=function(){this.parent.on(Qe,this.open.bind(this))},e.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off(Qe,this.open.bind(this))},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.getModuleName=function(){return"workbookOpen"},e}(),_i=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){var n,i=new FormData,o=Object.keys(t);for(i.append("JSONData",JSON.stringify(e)),n=0;n<o.length;n++)i.append(o[n],t[o[n]]);for(o=Object.keys(r),n=0;n<o.length;n++)i.append(o[n],r[o[n]]);fetch(t.url,{method:"POST",body:i}).then(function(e){return e.ok?e.blob():Promise.reject({message:e.statusText})}).then(function(e){postMessage(e)}).catch(function(e){postMessage({error:e.message})})},e}(),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)}}(),Vi=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.addEventListener(),r}return Pi(r,e),r.prototype.getModuleName=function(){return"workbookSave"},r.prototype.destroy=function(){this.removeEventListener(),this.parent=null},r.prototype.addEventListener=function(){this.parent.on(et,this.initiateSave,this)},r.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off(et,this.initiateSave)},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.updateBasicSettings(),this.processSheets()},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","cellEditing","cellSave","beforeCellSave","contextMenuItemSelect","contextMenuBeforeClose","contextMenuBeforeOpen","created","dataBound","fileMenuItemSelect","fileMenuBeforeClose","fileMenuBeforeOpen","saveComplete","sortComplete","select","actionBegin","actionComplete","afterHyperlinkClick","afterHyperlinkCreate","beforeHyperlinkClick","beforeHyperlinkCreate","openComplete","openFailure","queryCellInfo","dialogBeforeOpen"]),t=JSON.parse(e);this.parent.sheets.length&&(t.sheets=[]),this.saveJSON=t},r.prototype.processSheets=function(){for(var e=0,t=this.parent.sheets.length;e<t;)I(this,this.processSheet,this.updateSheet,[this.getStringifyObject(this.parent.sheets[e]),e]),e++},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(Ot,t),t.cancel||(this.isFullPost?this.initiateFullPostSave():I(this,{workerTask:this.processSave},this.updateSaveResult,[this.saveJSON,e,this.customParams],!0)),this.saveJSON={}},r.prototype.updateSaveResult=function(e){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()):this.needBlobData?t.blobData=e:this.ClientFileDownload(e,this.saveSettings.fileName),this.parent.trigger("saveComplete",t),this.parent.notify(tt,t)},r.prototype.ClientFileDownload=function(e,t){var r=this.parent.createElement("a",{attrs:{download:this.getFileNameWithExtension()}}),n=URL.createObjectURL(e);r.href=n,document.body.appendChild(r),r.click(),URL.revokeObjectURL(n),document.body.removeChild(r)},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);document.body.appendChild(n),n.submit(),t.detach(n),this.parent.notify(tt,{})},r.prototype.getStringifyObject=function(e,t){return void 0===t&&(t=[]),JSON.stringify(e,function(e,r){return t.indexOf(e)>-1?void 0:r&&"object"==typeof r&&r.hasOwnProperty("properties")?r.properties:null!==r?r:void 0})},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}(_i),Ui=function(){function e(e){this.parent=e}return e.prototype.getModuleName=function(){return"calc-common"},e}(),ji=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],o=0,s=t;o<s.length;o++){var a=s[o],l=i.member;if(a.prototype.getModuleName()===i.member&&!this.isModuleLoaded(l)){var h=this.createInstance(a,i.args),p=this.getMemberName(l);i.isProperty?B(p,a,this.parent):B(p,h,this.parent);var d=i;d.member=p,this.loadedModules.push(d)}}}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||H(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 o=i[n];o.isProperty||H(o.member,this.parent).destroy(),this.loadedModules.splice(this.loadedModules.indexOf(o),1),this.deleteObject(this.parent,o.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}();!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.FormulasErrorsStrings||(e.FormulasErrorsStrings={}));var qi=function(){function r(e){this.formulas=[{formulaName:"SUM",category:"Math & Trig",description:"Sums individual values, cell references or ranges."},{formulaName:"SUMIFS",category:"Math & Trig",description:"Sums the cells specified by a given set of conditionsor criteria."},{formulaName:"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:"DAYS",category:"Date",description:"Returns the number of days between two dates."},{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:"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:"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:"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."}],this.isConcat=!1,this.parent=e,this.init()}return r.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)},r.prototype.addFormulaCollection=function(e,t,r,n){this.parent.libraryFormulas={fName:e,handler:t,category:r,description:n}},r.prototype.ComputeSUM=function(){for(var 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,o,s=0;if(!t.isNullOrUndefined(r))for(var a=r,l=0;l<a.length;l++){var h=a[l].toString();if(h.indexOf(":")>-1&&this.parent.isCellReference(h))for(var p=this.parent.getCellCollection(h.split(this.parent.tic).join("")),d=0;d<p.length;d++){if(i=this.parent.getValueFromArg(p[d]),this.parent.getErrorStrings().indexOf(i)>-1)return i;t.isNullOrUndefined(i[0])||isNaN(this.parent.parseFloat(i))||(s+=this.parent.parseFloat(i))}else{if(a[l].split(this.parent.tic).join("")===this.parent.trueValue&&(a[l]="1"),a[l].split(this.parent.tic).join("")===this.parent.falseValue&&(a[l]="0"),o=this.parent.getValueFromArg(a[l].split(this.parent.tic).join("")),this.parent.getErrorStrings().indexOf(o)>-1)return o;if(t.isNullOrUndefined(o)||isNaN(this.parent.parseFloat(o)))continue;o.length>0&&(s+=this.parent.parseFloat(o+""))}}return s},r.prototype.ComputeCOUNT=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,o,s,a=r,l=0,h=0;h<a.length;h++)if((i=a[h]).indexOf(":")>-1&&this.parent.isCellReference(i)){o=this.parent.getCellCollection(i.split(this.parent.tic).join(""));for(var p=0;p<o.length;p++)s=this.parent.getValueFromArg(o[p]),isNaN(this.parent.parseFloat(s))||i.length>0&&""!==i&&" "!==i&&l++}else i=i.split(this.parent.tic).join(""),isNaN(this.parent.parseFloat(this.parent.getValueFromArg(i)))||i.length>0&&""!==i&&" "!==i&&l++;return l},r.prototype.ComputeDATE=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(3!==i.length)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];for(var o=0;o<i.length;++o)i[o]=this.parent.getValueFromArg(i[o]);i[0]="TRUE"===i[0].split(this.parent.tic).join("")?"1":"FALSE"===i[0].split(this.parent.tic).join("")?"0":i[0],i[1]="TRUE"===i[1].split(this.parent.tic).join("")?"1":"FALSE"===i[1].split(this.parent.tic).join("")?"0":i[1],i[2]="TRUE"===i[2].split(this.parent.tic).join("")?"1":"FALSE"===i[2].split(this.parent.tic).join("")?"0":i[2];var s=this.parent.parseFloat(i[0].split(this.parent.tic).join("")),a=this.parent.parseFloat(i[1].split(this.parent.tic).join("")),l=this.parent.parseFloat(i[2].split(this.parent.tic).join("")),h=0;if(isNaN(s)||isNaN(a)||isNaN(l))return this.parent.getErrorStrings()[e.CommonErrors.value].toString();if(s<0)return this.parent.getErrorStrings()[e.CommonErrors.num].toString();for(;a>12;)a-=12,s++;if(0===(h=this.parent.getSerialDateFromDate(s,a,l)))return this.parent.getErrorStrings()[e.CommonErrors.num].toString();var p=this.parent.fromOADate(h);return"Invalid Date"!==p.toString()?p.getFullYear()+"/"+this.parent.calculateDate((p.getMonth()+1).toString())+"/"+this.parent.calculateDate(p.getDate().toString()):h.toString()},r.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,o,s=r,a=s.length,l=s[1].split(this.parent.tic).join(""),h=[];if(2!==a)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];if(h.push(i=this.parent.parseFloat(this.parent.getValueFromArg(s[0].split(this.parent.tic).join("")))),s[1]=l===this.parent.trueValue?"1":l===this.parent.falseValue?"0":s[1],h.push(o=this.parent.parseFloat(this.parent.getValueFromArg(s[1].split(this.parent.tic).join("")))),i>0&&o<0)return this.parent.getErrorStrings()[e.CommonErrors.num];if(i>0&&0===o)return this.parent.getErrorStrings()[e.CommonErrors.divzero];for(var p=0;p<s.length;p++)if(s[p].indexOf(this.parent.tic)>-1)return this.parent.getErrorStrings()[e.CommonErrors.value];return isNaN(i)?this.parent.getErrorStrings()[e.CommonErrors.name]:Math.floor(i/o)*o},r.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,o,s=r,a=[],l=s.length,h=s[1].split(this.parent.tic).join("");if(2!==l)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];if(a.push(i=this.parent.parseFloat(this.parent.getValueFromArg(s[0].split(this.parent.tic).join("")))),s[1]=h===this.parent.trueValue?"1":h===this.parent.falseValue?"0":s[1],a.push(o=this.parent.parseFloat(this.parent.getValueFromArg(s[1].split(this.parent.tic).join("")))),i>0&&o<0)return this.parent.getErrorStrings()[e.CommonErrors.num];for(var p=0;p<s.length;p++)if(s[p].indexOf(this.parent.tic)>-1)return this.parent.getErrorStrings()[e.CommonErrors.value];return isNaN(i)?this.parent.getErrorStrings()[e.CommonErrors.name]:0===o?0:Math.ceil(i/o)*o},r.prototype.ComputeDAY=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var i,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=this.parent.getValueFromArg(o[0].split(this.parent.tic).join(""));return isNaN(this.parent.parseFloat(s))?(s=s,i=this.parent.parseDate(s),"[object Date]"===Object.prototype.toString.call(i)&&(i=i.getDate()),i):this.parent.getErrorStrings()[e.CommonErrors.name]},r.prototype.ComputeIF=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(this.parent.getErrorStrings().indexOf(r[0])>0)return r[0];var i,o,s=r;if(s.length>3||1===s.length)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];if(s.length<=3){if(i=this.parent.getValueFromArg(s[0]),this.parent.getErrorStrings().indexOf(i)>-1)return i;if(i===this.parent.trueValue||this.parent.parseFloat(i)>0||this.parent.parseFloat(i)<0)o=this.parent.getValueFromArg(s[1]);else{if(i!==this.parent.falseValue&&0!==this.parent.parseFloat(i))return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.requires_3_args];if(t.isNullOrUndefined(s[2]))return this.parent.falseValue;o=this.parent.getValueFromArg(s[2])}}return o.indexOf(this.parent.tic)>-1?o.split(this.parent.tic).join(""):o},r.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,o=r;return 2!==o.length?this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments]:(i=this.parent.getValueFromArg(o[0]))===this.parent.trueValue||i===this.parent.falseValue?i:(i[0]===this.parent.arithMarker&&(i=i.replace(this.parent.arithMarker," ")),"#"===(i=this.parent.getValueFromArg(i).toUpperCase().split(this.parent.tic).join(""))[0]||i.indexOf("Infinity")>-1||this.parent.getErrorStrings().indexOf(i)>-1?this.parent.getValueFromArg(o[1]).split(this.parent.tic).join(""):i)},r.prototype.ComputePRODUCT=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,o,s,a=1,l=!0;if(!t.isNullOrUndefined(r))for(var h=r,p=0;p<h.length;p++){var d=h[p];if(d.indexOf(":")>-1&&this.parent.isCellReference(d))for(var c=this.parent.getCellCollection(d),u=0;u<c.length;u++){if(i=this.parent.getValueFromArg(c[u].split(this.parent.tic).join("")),this.parent.getErrorStrings().indexOf(i)>-1)return i;i="TRUE"===i.split(this.parent.tic).join("")?"1":"FALSE"===i.split(this.parent.tic).join("")?"0":i,s=this.parent.parseFloat(i),isNaN(s)||i.length>0&&(a*=s,l=!1)}else{if(o=this.parent.getValueFromArg(h[p].split(this.parent.tic).join("")),this.parent.getErrorStrings().indexOf(o)>-1)return o;if(o="TRUE"===o.split(this.parent.tic).join("")?"1":"FALSE"===o.split(this.parent.tic).join("")?"0":o,s=this.parent.parseFloat(o),isNaN(s)||o.length>0&&(a*=s,l=!1),this.parent.getErrorStrings().indexOf(o)>-1)return o}}return l?"0":a.toString()},r.prototype.ComputeDAYS=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];if(2!==r.length)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];var o=r;o[0].split(this.parent.tic).join("")===this.parent.trueValue&&(o[0]="1"),o[0].split(this.parent.tic).join("")===this.parent.falseValue&&(o[0]="0");var s=this.parent.getValueFromArg(o[0].split(this.parent.tic).join("")),a=this.parent.getValueFromArg(o[1].split(this.parent.tic).join(""));if(a=""===a||null==a?new Date(Date.parse("1899-12-31")).toDateString():a,"#"===(s=""===s||null==s?new Date(Date.parse("1899-12-31")).toDateString():s)[0])return s;if("#"===a[0])return a;var l=this.parent.intToDate(s),h=this.parent.intToDate(a);return"#"===l.toString()[0]?l.toString():"#"===h.toString()[0]?h.toString():"[object Date]"!==Object.prototype.toString.call(l)||"[object Date]"!==Object.prototype.toString.call(h)?this.parent.getErrorStrings()[e.CommonErrors.value]:(i=Math.ceil(l.getTime()-h.getTime())/864e5,Math.round(i))},r.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 o=this.parent.getValueFromArg(i[0]);if(this.parent.getErrorStrings().indexOf(o)>-1)return o;var s=this.parent.parseFloat(this.parent.getValueFromArg(i[0].split(this.parent.tic).join("")));if(s<1)return this.parent.getErrorStrings()[e.CommonErrors.value];s=Math.floor(s);var a;if(t.isNullOrUndefined(i[s]))return this.parent.getErrorStrings()[e.CommonErrors.value];if(""===(a=i[s])&&(a="0"),a.indexOf(":")>-1&&this.parent.isCellReference(a)){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(a).split(this.parent.tic).join("")},r.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]))return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.improper_formula];var i=this.parent.computeSumIfAndAvgIf(t);return"string"==typeof i&&(this.parent.formulaErrorStrings.indexOf(i)||this.parent.getErrorStrings().indexOf(i))?i:i[0]},r.prototype.ComputeABS=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n,i=t,o="";if(0===t.length||t.length>1)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];if(""===i[0].toString().split(this.parent.tic).join("").trim()||i[0].indexOf(this.parent.tic)>-1)return this.parent.getErrorStrings()[e.CommonErrors.value];if(this.parent.isCellReference(i[0])){if(""===(o=this.parent.getValueFromArg(i[0])))return this.parent.getErrorStrings()[e.CommonErrors.name];if(n=this.parent.parseFloat(o),isNaN(n))return this.parent.getErrorStrings()[e.CommonErrors.value]}else if(n=this.parent.parseFloat(i[0]),isNaN(n))return this.parent.getErrorStrings()[e.CommonErrors.name];return Math.abs(n)},r.prototype.ComputeAVERAGE=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,o=0;o<i.length;o++)if(i[o].indexOf(":")>-1&&i[o].indexOf(this.parent.tic)>-1)return this.parent.getErrorStrings()[e.CommonErrors.value];return this.parent.calculateAvg(i)},r.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);return"string"==typeof i&&(this.parent.formulaErrorStrings.indexOf(i)||this.parent.getErrorStrings().indexOf(i))?i:this.parent.parseFloat(i[0])/this.parent.parseFloat(i[1])},r.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,o="",s="",a=0;a<i.length;a++){if(i[a].indexOf(":")>-1&&this.parent.isCellReference(i[a])){if(!this.isConcat)return this.parent.getErrorStrings()[e.CommonErrors.value];for(var l=this.parent.getCellCollection(i[a]),h=0;h<l.length;h++)o+=s=this.parent.getValueFromArg(l[h])}else{if(1===i.length&&i[0].indexOf(this.parent.tic)<0)return this.parent.getErrorStrings()[e.CommonErrors.name];o+=s=this.parent.getValueFromArg(i[a])}if(this.parent.getErrorStrings().indexOf(s)>-1)return s}return o.split(this.parent.tic).join("")},r.prototype.ComputeCONCAT=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this.isConcat=!0,this.ComputeCONCATENATE.apply(this,e)},r.prototype.ComputeMAX=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this.parent.computeMinMax(e,"max")},r.prototype.ComputeMIN=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this.parent.computeMinMax(e,"min")},r.prototype.ComputeRAND=function(){for(var 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()},r.prototype.ComputeAND=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this.parent.computeAndOr(e,"and")},r.prototype.ComputeOR=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this.parent.computeAndOr(e,"or")},r.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 o=this.parent.removeTics(this.parent.getValueFromArg(i[0])),s=this.parent.removeTics(this.parent.getValueFromArg(i[1]));if(this.parent.getErrorStrings().indexOf(o)>-1||this.parent.getErrorStrings().indexOf(s)>-1)return this.parent.getErrorStrings()[e.CommonErrors.name];var a,l=1;if(3===i.length){if(l=this.parent.removeTics(this.parent.getValueFromArg(i[2])),this.parent.getErrorStrings().indexOf(l)>-1)return l;l=this.parent.parseFloat(l),isNaN(l)&&(l=1)}return l<=0||l>s.length?this.parent.getErrorStrings()[e.CommonErrors.value]:(a=s.indexOf(o,l-1))<0?this.parent.getErrorStrings()[e.CommonErrors.value]:(Number(a)+Number(1)).toString()},r.prototype.ComputeINDEX=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var i=r,o=i.length;if(t.isNullOrUndefined(r)||1===i.length&&""===i[0])return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];if(o>3)return this.parent.getErrorStrings()[e.CommonErrors.ref];var s="",a=[];if(o>2)for(var l=0;l<o;l++){if(this.parent.isCellReference(i[l])&&i[l].indexOf(":")<0)return this.parent.getErrorStrings()[e.CommonErrors.ref];this.parent.isCellReference(i[l])&&(a[l]=i[l])}if(s=i[0],i[1]=""===i[1]?"1":i[1],i[1]=this.parent.getValueFromArg(i[1]),this.parent.getErrorStrings().indexOf(i[1])>-1)return i[1];if(!t.isNullOrUndefined(i[2])){if(i[2]=""===i[2]?"1":i[2],i[2]=this.parent.getValueFromArg(i[2]),this.parent.getErrorStrings().indexOf(i[2])>-1)return i[2];if("0"===i[2])return this.parent.getErrorStrings()[e.CommonErrors.value]}var h=parseFloat(i[1]);h=isNaN(h)?-1:h;var p=parseFloat(i[2]?i[2]:"1");if(p=isNaN(p)?-1:p,-1===h||-1===p)return this.parent.getErrorStrings()[e.CommonErrors.value];var d=i[0].indexOf(":"),c=this.parent.rowIndex(s.substring(0,d)),u=this.parent.rowIndex(s.substring(d+1)),f=this.parent.colIndex(s.substring(0,d)),g=this.parent.colIndex(s.substring(d+1));if(h>u-c+1||p>g-f+1)return this.parent.getErrorStrings()[e.CommonErrors.ref];h=c+h-1,p=f+p-1;var m=""+this.parent.convertAlpha(p)+h,v=this.parent.getValueFromArg(m);return""===v?0:v},r.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])return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];for(var o="",s="",a=0;a<i.length;a++){if((o=this.parent.getValueFromArg(i[a]))!==this.parent.trueValue&&o!==this.parent.falseValue)return this.parent.getErrorStrings()[e.CommonErrors.value];if(o===this.parent.trueValue)return i[a+1].indexOf(this.parent.arithMarker)>-1?this.parent.trueValue:(s=this.parent.isCellReference(i[a+1].split(this.parent.tic).join(""))?this.parent.getValueFromArg(i[a+1]):i[a+1].indexOf(this.parent.tic)>-1?i[a+1].split(this.parent.tic).join(""):this.parent.getErrorStrings()[e.CommonErrors.name],a+=1,s);o===this.parent.falseValue&&(a+=1)}return this.parent.getErrorStrings()[e.CommonErrors.na]},r.prototype.ComputeCOUNTA=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,o=r,s=0,a=0;a<o.length;a++)if(o[a].indexOf(":")>-1&&this.parent.isCellReference(o[a])){i=this.parent.getCellCollection(o[a].split(this.parent.tic).join(""));for(var l=0;l<i.length;l++)this.parent.getValueFromArg(i[l]).length>0&&s++}else{this.parent.getValueFromArg(o[a].split(this.parent.tic).join("")).length>0&&s++}return s},r.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,o,s,a=r,l=0,h=0,p=0;p<a.length;p++){if(a[p].indexOf(":")>-1&&this.parent.isCellReference(a[p])){i=this.parent.getCellCollection(a[p].split(this.parent.tic).join(""));for(var d=0;d<i.length;d++)if((o=this.parent.getValueFromArg(i[d])).toUpperCase()===this.parent.trueValue)o="1";else if(o.toUpperCase()===this.parent.falseValue||""===o)o="0";else{if(this.parent.getErrorStrings().indexOf(o)>-1)return o;o.length>0&&(s=parseFloat(o),l+=o=isNaN(s)?0:s,h+=1)}h=i.length}else{if(a[p]===this.parent.trueValue&&(a[p]="1"),a[p]!==this.parent.falseValue&&""!==a[p]||(a[p]="0"),o=this.parent.getValueFromArg(a[p].split(this.parent.tic).join("")),this.parent.getErrorStrings().indexOf(o)>-1)return o;o.length>0&&(s=parseFloat(o),l+=o=isNaN(s)?0:s,h+=1)}if(0===h)return this.parent.getErrorStrings()[e.CommonErrors.divzero]}return l/h},r.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]||i.length<2)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];var o,s,a=0,l=[],h="equal",p=i[1].split(this.parent.tic).join("");if(p.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)),i[0].indexOf(":")>-1&&this.parent.isCellReference(i[0])){o=this.parent.getCellCollection(i[0].split(this.parent.tic).join(""));for(var d=0;d<o.length;d++)s=this.parent.getValueFromArg(o[d]),(p.indexOf("*")>-1||p.indexOf("?")>-1)&&(s=this.parent.findWildCardValue(p,s)),l.push(s),l.push(p),this.parent.processLogical(l,h)===this.parent.trueValue&&a++}return a},r.prototype.ComputeSUMIFS=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this.parent.computeIfsFormulas(e,this.parent.falseValue)},r.prototype.ComputeCOUNTIFS=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this.parent.computeIfsFormulas(e,this.parent.trueValue)},r.prototype.ComputeAVERAGEIFS=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this.parent.computeIfsFormulas(e,this.parent.falseValue,this.parent.trueValue)},r.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 o,s=[],a=i[0].split(this.parent.tic).join("");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,p="";if(i[1].indexOf(":")>-1||this.parent.isCellReference(i[1])){o=this.parent.getCellCollection(i[1].split(this.parent.tic).join(""));for(var d=0;d<o.length;d++)s[d]=this.parent.getValueFromArg(o[d]).split(this.parent.tic).join("");for(var c=0;c<s.length;c++)if(1===l){if(a===s[c])return c+1;a>s[c]&&(p?s[c]>p&&(h=c+1,p=s[c]):(h=c+1,p=s[c]))}else if(0===l){if((a.indexOf("*")>-1||a.indexOf("?")>-1)&&(s[c]=this.parent.findWildCardValue(a,s[c])),a===s[c])return c+1;if(this.parent.parseFloat(a)===this.parent.parseFloat(s[c]))return c+1}else if(-1===l){if(a===s[c])return c+1;a<s[c]&&(p?s[c]<p&&(h=c+1,p=s[c]):(h=c+1,p=s[c]))}}return h||this.parent.getErrorStrings()[e.CommonErrors.na]},r.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]||i.length<2||i.length>3?this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments]:this.parent.computeLookup(i)},r.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.computeVLookup(i)},r.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 o=this.parent.parseFloat(this.parent.getValueFromArg(n[0].split(this.parent.tic).join("")));isNaN(o)&&this.parent.getErrorStrings()[e.CommonErrors.value],(o<1||o>11)&&(o<101||o>111)&&this.parent.getErrorStrings()[e.CommonErrors.value];var s=n.slice(1,n.length);switch(o){case 1:case 101:i=this.ComputeAVERAGE.apply(this,s);break;case 2:case 102:i=this.ComputeCOUNT.apply(this,s);break;case 3:case 103:i=this.ComputeCOUNTA.apply(this,s);break;case 4:case 104:i=this.ComputeMAX.apply(this,s);break;case 5:case 105:i=this.ComputeMIN.apply(this,s);break;case 6:case 106:i=this.ComputePRODUCT.apply(this,s);break;case 7:case 107:i=this.ComputeDAY.apply(this,s);break;case 8:case 108:i=this.ComputeCONCAT.apply(this,s);break;case 9:case 109:i=this.ComputeSUM.apply(this,s);break;case 10:case 110:i=this.ComputeAVERAGEA.apply(this,s);break;case 11:case 111:i=this.ComputeABS.apply(this,s);break;default:i=this.parent.getErrorStrings()[e.CommonErrors.value]}return i},r.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 o=this.parent.getValueFromArg(n[0]),s=this.parent.parseFloat(o);return isNaN(s)?o.indexOf(this.parent.tic)>-1?this.parent.getErrorStrings()[e.CommonErrors.value]:this.parent.getErrorStrings()[e.CommonErrors.name]:Math.PI*s/180},r.prototype.ComputeRANDBETWEEN=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n,i,o,s=t.length;if(2!==s)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];for(var a=0;a<s;a++){if(""===t[a])return this.parent.getErrorStrings()[e.CommonErrors.na];if(t[a].indexOf(this.parent.tic)>-1){if(isNaN(parseFloat(t[a].split(this.parent.tic).join(""))))return this.parent.getErrorStrings()[e.CommonErrors.value];t[a]=t[a].split(this.parent.tic).join("")}if(o=parseFloat(this.parent.getValueFromArg(t[a])),this.parent.isCellReference(t[a])){if(o=""===this.parent.getValueFromArg(t[a])?0:o,0===a?n=o:i=o,0===n&&0===i)return"0";if(isNaN(o))return this.parent.getErrorStrings()[e.CommonErrors.value]}else{if(isNaN(o))return this.parent.getErrorStrings()[e.CommonErrors.name];0===a?n=o:i=o}}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},r.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,o,s=this.parent.getCellCollection(n[1].split(this.parent.tic).join("")),a=this.parent.getCellCollection(n[0].split(this.parent.tic).join(""));if(a.length!==s.length)return this.parent.getErrorStrings()[e.CommonErrors.na];if(i=this.getDataCollection(a),(o=this.getDataCollection(s)).indexOf("#NAME?")>-1||i.indexOf("#NAME?")>-1)return this.parent.getErrorStrings()[e.CommonErrors.name];for(var l=0,h=0,p=0,d=0,c=0,u=o.length;c<u;++c)"NaN"!==Number(o[c]).toString()&&"NaN"!==Number(i[c]).toString()&&(l+=Number(o[c])*Number(i[c]),p+=Number(o[c]),d+=Number(i[c]),h+=Number(o[c])*Number(o[c]));l-p*d!=0&&h-p*p!=0||this.parent.getErrorStrings()[e.CommonErrors.divzero];var f=((l-p*d/o.length)/(h-p*p/o.length)).toString();return"NaN"===f?this.parent.getErrorStrings()[e.CommonErrors.divzero]:f},r.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,o,s=this.parent.getCellCollection(n[0].split(this.parent.tic).join("")),a=this.parent.getCellCollection(n[1].split(this.parent.tic).join(""));if(s.length!==a.length)return this.parent.getErrorStrings()[e.CommonErrors.na];if(i=this.getDataCollection(a),o=this.getDataCollection(s),i.indexOf("#NAME?")>-1||o.indexOf("#NAME?")>-1)return this.parent.getErrorStrings()[e.CommonErrors.name];for(var l=0,h=0,p=0,d=i.length;p<d;++p)l+=Number(i[p]),h+=Number(o[p]);l/=i.length,h/=i.length;var c,u=0,f=0;for(p=0,d=i.length;p<d;++p)u+=(c=Number(i[p])-l)*(Number(o[p])-h),f+=c*c;var g=(h-u/f*l).toString();return h-u!=0&&f*l!=0||this.parent.getErrorStrings()[e.CommonErrors.divzero],"NaN"===g?this.parent.getErrorStrings()[e.CommonErrors.divzero]:g},r.prototype.ComputeLN=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n,i,o=t,s="";if(0===t.length||t.length>1)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];if(this.parent.isCellReference(o[0])){if(s=this.parent.getValueFromArg(o[0]),(n=this.parent.parseFloat(s))<=0||""===s)return this.parent.getErrorStrings()[e.CommonErrors.num];if(isNaN(n))return this.parent.getErrorStrings()[e.CommonErrors.value]}else{if(i=this.parent.getValueFromArg(o[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)},r.prototype.ComputeISNUMBER=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n,i,o=t;return 0===t.length||t.length>1?this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments]:""!==(i=this.parent.isCellReference(o[0])?this.parent.getValueFromArg(o[0]):this.parent.getValueFromArg(o[0].split(this.parent.tic).join(""))).toString()&&(n=this.parent.parseFloat(i),!isNaN(n))},r.prototype.ComputeROUND=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n,i,o,s,a,l=t,h=0,p=0;return 0===t.length||t.length>2?this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments]:1===t.length?(n="TRUE"===l[0].split(this.parent.tic).join("")?"1":"FALSE"===l[0].split(this.parent.tic).join("")?"0":l[0],Math.round(this.parent.parseFloat(n)).toString()):(o=this.parent.getValueFromArg(l[0]),s=""===l[1].split(this.parent.tic).join("")?"0":this.parent.getValueFromArg(l[1].split(this.parent.tic).join("")),o="TRUE"===o.split(this.parent.tic).join("")?"1":"FALSE"===o.split(this.parent.tic).join("")?"0":o,s="TRUE"===s.split(this.parent.tic).join("")?"1":"FALSE"===s.split(this.parent.tic).join("")?"0":s,""!==o&&""!==s&&(h=this.parent.parseFloat(o),p=this.parent.parseFloat(s),!isNaN(p)&&!isNaN(h)&&p>0?i=h.toFixed(p):(a=Math.pow(10,-p),i=Math.round(h/a)*a)),i.toString())},r.prototype.ComputePOWER=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n,i,o,s,a=t;return 0===t.length||t.length>2?this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments]:(n=this.parent.getValueFromArg(a[0]),i=this.parent.getValueFromArg(a[1]),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,o=this.parent.parseFloat(n),s=this.parent.parseFloat(i),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())},r.prototype.ComputeLOG=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n,i,o,s,a=t;return 0===t.length||t.length>2?this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments]:(n=this.parent.getValueFromArg(a[0]),i=2===t.length?this.parent.getValueFromArg(a[1]):"10",""===n||null===n||""===i||null===i?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,o=this.parent.parseFloat(n),s=this.parent.parseFloat(i),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()))},r.prototype.ComputeTRUNC=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n,i,o,s=t,a=0;return 0===t.length||t.length>2?this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments]:(2===t.length&&(a="TRUE"===(a=this.parent.getValueFromArg(s[1])).split(this.parent.tic).join("")?"1":"FALSE"===a.split(this.parent.tic).join("")?"0":a,a=this.parent.parseFloat(a)),n=this.parent.getValueFromArg(s[0]),n="TRUE"===n.split(this.parent.tic).join("")?"1":"FALSE"===n.split(this.parent.tic).join("")?"0":n,i=this.parent.parseFloat(n.split(this.parent.tic).join("")),isNaN(i)||isNaN(a)?s[0]===this.parent.tic||this.parent.isCellReference(s[0])||s[1]===this.parent.tic||this.parent.isCellReference(s[1])?this.parent.getErrorStrings()[e.CommonErrors.value]:this.parent.getErrorStrings()[e.CommonErrors.name]:(o=Math.pow(10,a),((i<0?-1:1)*Math.floor(o*Math.abs(i))/o).toString()))},r.prototype.ComputeEXP=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n,i,o=t;return 0===t.length||t.length>1?this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments]:(n=this.parent.getValueFromArg(o[0]),""===(n="TRUE"===n.split(this.parent.tic).join("")?"1":"FALSE"===n.split(this.parent.tic).join("")?"0":n)&&(n="0"),(i=this.parent.parseFloat(n))>709?this.parent.getErrorStrings()[e.CommonErrors.num]:isNaN(i)?o[0]===this.parent.tic||this.parent.isCellReference(o[0])?this.parent.getErrorStrings()[e.CommonErrors.value]:this.parent.getErrorStrings()[e.CommonErrors.name]:Math.exp(i).toString())},r.prototype.ComputeGEOMEAN=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n,i,o,s,a=t,l=1,h=0,p=0;if(0===t.length)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];for(i=0;i<a.length;i++)if(a[i].indexOf(":")>-1){if(a[0]===this.parent.tic)return this.parent.getErrorStrings()[e.CommonErrors.value];for(s=this.parent.getCellCollection(a[i].split(this.parent.tic).join("")),o=0;o<s.length;o++){if(p=this.parent.getValueFromArg(s[o]),p="TRUE"===p.split(this.parent.tic).join("")?"1":"FALSE"===p.split(this.parent.tic).join("")?"0":p,(n=this.parent.parseFloat(p))<=0)return this.parent.getErrorStrings()[e.CommonErrors.num];isNaN(n)||(h++,l*=n)}}else if((p=this.parent.getValueFromArg(a[i])).length>0){if(p="TRUE"===p.split(this.parent.tic).join("")?"1":"FALSE"===p.split(this.parent.tic).join("")?"0":p,!this.parent.isCellReference(a[i])&&isNaN(this.parent.parseFloat(p)))return this.parent.getErrorStrings()[e.CommonErrors.name];if((n=this.parent.parseFloat(p))<=0)return this.parent.getErrorStrings()[e.CommonErrors.num];isNaN(n)||(h++,l*=n)}return h>0&&(l=Math.pow(l,1/h)),l.toString()},r.prototype.getDataCollection=function(e){for(var t=[],r=0,n=e.length;r<n;r++)t.push(this.parent.getValueFromArg(e[r]));return t},r.prototype.getModuleName=function(){return"basic-formulas"},r}(),zi=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){if(this.parent.isTextEmpty(r))return r;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=(r=r.split("-+").join("-")).split("--").join("+")).split("+-").join("-")).split("-(-").join("(");var i=this.storeStrings(r);r=this.storedStringText;var o=0;if(t.isNullOrUndefined(i)&&(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 a=this.parent.getSheetToken(r.split(this.parent.tic).join(this.emptyStr)),l=this.checkScopedRange(r.split('"').join(this.emptyStr).split(this.sheetToken).join(""));t.isNullOrUndefined(a)&&""!==a&&this.parent.namedRanges.size>0&&""!==l&&(r=l)}}r=this.markLibraryFormulas(r);try{r=this.formulaAutoCorrection(r)}catch(t){if(!(d={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",d),this.isFailureTriggered=!0),!d.isForceCalculable||!d.computeForceCalculate)throw this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_expression];r=this.formulaAutoCorrection(r,d),this.parent.storedData.get(n).formulaText="="+r}if(!this.ignoreBracet)for(o=r.indexOf(")");o>-1;){var h=r.substring(0,o).lastIndexOf("(");if(-1===h)throw new Xi(this.parent.formulaErrorStrings[e.FormulasErrorsStrings.mismatched_parentheses]);if(h===o-1)throw new Xi(this.parent.formulaErrorStrings[e.FormulasErrorsStrings.empty_expression]);var p=this.emptyStr;p=this.ignoreBracet?this.parent.substring(r,h,o-h+1):this.parent.substring(r,h+1,o-h-1);try{r=r.substring(0,h)+this.parseSimple(p)+r.substring(o+1)}catch(e){var d=this.exceptionArgs(e);this.isFailureTriggered||(this.parent.trigger("onFailure",d),this.isFailureTriggered=!0);var c="string"==typeof d.exception?d.exception:d.message;return(this.parent.getErrorLine(e)?"":"#"+this.parent.getErrorLine(e)+": ")+c}o=r.indexOf(")")}if(!this.ignoreBracet&&r.indexOf("(")>-1)throw new Xi(this.parent.formulaErrorStrings[e.FormulasErrorsStrings.mismatched_parentheses]);return r=this.parseSimple(r),null!==i&&i.size>0&&(r=this.setStrings(r,i)),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=["*","+","-","/","^","&"],o=[">","=","<"],s=0,a="",l="",h="",p="",d="",c="",u="",f=0;if(this.parent.formulaErrorStrings.indexOf(r)>-1)return r;if(this.indexOfAny(r,this.specialSym)>-1)throw new Xi(this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_expression],!1);for(;s<r.length;)if(r.indexOf("&")>-1||this.parent.isDigit(r[s])&&r.length>s+1&&this.indexOfAny(r[s+1],i)>-1&&r.length>s+2&&!t.isNullOrUndefined(r[s+2])&&this.indexOfAny(r[s+2],i)>-1){if(t.isNullOrUndefined(n))throw new Xi(this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_expression],!0);if(!n.computeForceCalculate)throw this.parent.formulaErrorStrings[e.FormulasErrorsStrings.improper_formula];this.parent.isDigit(r[s])?(f<1?(c=r[s],h=r[s+1],t.isNullOrUndefined(h)&&(h=this.emptyStr),f+=1,a=a+c+(h="&"===h?"":h)):f<2&&(u=r[s],p=r[s-1],d=r[s+1],f=0,a="-"===p?a+p+u+(d="&"===(d=t.isNullOrUndefined(d)?this.emptyStr:d)?"":d):a+u+(d=t.isNullOrUndefined(d)?this.emptyStr:d)),s+=2):(a="-"===r[s]?a+r[s]:a,s+=1)}else if((this.parent.isDigit(r[s])||r[s]===this.parent.rightBracket||this.parent.storedData.has(r[s].toUpperCase()))&&(t.isNullOrUndefined(r[s+1])||this.indexOfAny(r[s+1],i))>-1)l="&"===(l=t.isNullOrUndefined(r[s+1])?this.emptyStr:r[s+1])?"":l,a="-"===r[s-1]?a+r[s-1]+r[s]+l:a+r[s]+l,s+=2;else if(this.indexOfAny(r[s],o)>-1&&!t.isNullOrUndefined(r[s-1])&&!t.isNullOrUndefined(r[s+1]))a+=r[s],s+=1;else if("q"===r[s])for(;r[s]!==this.parent.leftBracket;)a+=r[s],s+=1;else r[s]===this.parent.leftBracket||r[s]===this.parent.rightBracket||"{"===r[s]||"}"===r[s]||"("===r[s]||")"===r[s]?(a+=r[s],s+=1):this.parent.isUpperChar(r[s])||r[s].indexOf(":")>-1||r[s]===this.parent.getParseArgumentSeparator()||"%"===r[s]&&this.parent.isDigit(r[s-1])?(a+=r[s],s+=1):r[s]===this.parent.tic||" "===r[s]||"."===r[s]||r[s]===this.sheetToken||"$"===r[s]?(a+=r[s],s+=1):(this.parent.isDigit(r[s])&&(a="-"===r[s-1]?a+r[s-1]+r[s]:a+r[s]),"-"===r[s]&&(a=(a+=r[s]).split("++").join("+").split("+-").join("-").split("-").join("-")),s+=1);return a=a===this.emptyStr?r:a,this.indexOfAny(a[a.length-1],i)>-1&&(a=a.substring(0,a.length-1)),a=a.split("--").join("-").split("-+").join("-").split("+-").join("-")},r.prototype.checkScopedRange=function(e){var r=this,n=this.emptyStr,i="NaN",o=this.parent.getSheetID(this.parent.grid),s=this.parent.getSheetFamilyItem(this.parent.grid);if(e[0]===this.sheetToken.toString()){var a=e.indexOf(this.sheetToken,1),l=parseInt(e.substr(1,a-1),10);a>1&&!this.parent.isNaN(l)&&(e=e.substring(a+1),o=l)}var h="!"+o.toString()+"!";return null===s||null==s.sheetNameToToken?i:(s.sheetNameToToken.forEach(function(o,a){if(s.sheetNameToToken.get(a).toString()===h){var l=r.emptyStr;r.parent.namedRanges.forEach(function(o,a){l=t.isNullOrUndefined(r.parent.parentObject)?s.sheetNameToToken.get(a).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,o=0,s="",a=null,l=t.indexOf(this.parent.tic);t.indexOf(this.parent.singleTic);if(l>-1)for(n=(t=t.split(this.parent.singleTic).join(this.parent.tic)).indexOf(this.parent.tic);n>-1&&t.length>0;){if(null===a&&(a=this.stringsColl),-1===(i=n+1<t.length?t.indexOf(this.parent.tic,n+1):-1))throw new Xi(this.parent.formulaErrorStrings[e.FormulasErrorsStrings.mismatched_tics]);r=this.parent.substring(t,n,i-n+1),s=this.parent.tic+this.spaceString+o.toString()+this.parent.tic,a=a.set(s,r),t=t.substring(0,n)+s+t.substring(i+1),(n+=s.length)<t.length&&(n=t.indexOf(this.parent.tic,n)),o++}return this.storedStringText=t,a},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],o=[this.charMultiply,this.charDivide],s=[this.charAdd,this.charSubtract],a=[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],p=[this.tokenAnd],d=[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,o),t=this.parseSimpleOperators(t,i,s),t=this.parseSimpleOperators(t,a,l),t=this.parseSimpleOperators(t,p,d)},r.prototype.parseSimpleOperators=function(t,r,n){if(this.parent.getErrorStrings().indexOf(t)>-1)return t;for(var i=t,o=0,s="",a=0;a<n.length;a++)s+=n[a];(i=(i=i.split("---").join("-").split("--").join("+").split(this.parent.getParseArgumentSeparator()+"-").join(this.parent.getParseArgumentSeparator()+"u").split(this.parent.leftBracket+"-").join(this.parent.leftBracket+"u").split("=-").join("=u")).split(",+").join(",").split(this.parent.leftBracket+"+").join(this.parent.leftBracket).split("=+").join("=").split(">+").join(">").split("<+").join("<").split("/+").join("/").split("*+").join("*").split("++").join("+").split("*-").join("*u").toString()).length>0&&"-"===i[0]?(i="0-"+(i=i.substring(1).split("-").join(this.tokenOr)),i=(i=this.parseSimpleOperators(i,[this.tokenSubtract],[this.charSubtract])).split(this.tokenOr).join("-")):i.length>0&&"+"===i[0]?i=i.substring(1):i.length>0&&"+"===i[i.length-1]&&(i=i.substring(0,i.length-1));try{if(this.indexOfAny(i,n)>-1)for(o=this.indexOfAny(i,n);o>-1;){var l="",h="",p=0,d=0,c=0;if(i[o]===this.charNOTop)p=o;else if(c=o-1,i[c]===this.parent.arithMarker){if((f=this.findLeftMarker(i.substring(0,c-1)))<0)throw new Xi(this.parent.formulaErrorStrings[e.FormulasErrorsStrings.cannot_parse]);l=this.parent.substring(i,f+1,c-f-1),p=f+1}else if(i[c]===this.parent.rightBracket){for(var u=0,f=c-1;f>0&&("q"!==i[f]||0!==u);)"q"===i[f]?u--:i[f]===this.parent.rightBracket&&u++,f--;if(f<0)throw new Xi(this.parent.formulaErrorStrings[e.FormulasErrorsStrings.cannot_parse]);l=this.parent.substring(i,f,c-f+1),p=f}else if(i[c]===this.parent.tic[0]){var g=i.substring(0,c-1).lastIndexOf(this.parent.tic);if(g<0)throw new Xi(this.parent.formulaErrorStrings[e.FormulasErrorsStrings.cannot_parse]);l=this.parent.substring(i,g,c-g+1),p=g}else{for(var m=!1;c>-1&&(this.parent.isDigit(i[c])||!m&&i[c]===this.parent.getParseDecimalSeparator());)i[c]===this.parent.getParseDecimalSeparator()&&(m=!0),c-=1;if(c>-1&&m&&i[c]===this.parent.getParseDecimalSeparator())throw new Xi(this.parent.formulaErrorStrings[e.FormulasErrorsStrings.number_contains_2_decimal_points]);if(0===(c+=1)||c>0&&!this.parent.isUpperChar(i[c-1]))l="n"+this.parent.substring(i,c,o-c),p=c;else{for(c-=1;c>-1&&(this.parent.isUpperChar(i[c])||this.parent.isDigit(i[c]));)c-=1;if(c>-1&&i[c]===this.sheetToken){for(c-=1;c>-1&&i[c]!==this.sheetToken;)c-=1;c>-1&&i[c]===this.sheetToken&&(c-=1)}c+=1,l=this.parent.substring(i,c,o-c),this.parent.updateDependentCell(l),p=c}(this.parent.namedRanges.size>0&&this.parent.namedRanges.has(l.toUpperCase())||this.parent.storedData.has(l.toUpperCase()))&&(l="n"+this.checkForNamedRangeAndKeyValue(l))}if(o===i.length-1)throw new Xi(this.parent.formulaErrorStrings[e.FormulasErrorsStrings.expression_cannot_end_with_an_operator]);var v="u"===i[c=o+1];if(v&&(c+=1),i[c]===this.parent.tic[0]){if((f=i.substring(c+1).indexOf(this.parent.tic))<0)throw this.parent.formulaErrorStrings[e.FormulasErrorsStrings.cannot_parse];h=this.parent.substring(i,c,f+2),d=f+c+2}else if(i[c]===this.parent.arithMarker){if((f=this.findRightMarker(i.substring(c+1)))<0)throw new Xi(this.parent.formulaErrorStrings[e.FormulasErrorsStrings.cannot_parse]);h=this.parent.substring(i,c+1,f),d=f+c+2}else if("q"===i[c]){for(u=0,f=c+1;f<i.length&&(i[f]!==this.parent.rightBracket||0!==u);)i[f]===this.parent.rightBracket?u++:"q"===i[f]&&u--,f++;if(f===i.length)throw this.parent.formulaErrorStrings[e.FormulasErrorsStrings.cannot_parse];h=this.parent.substring(i,c,f-c+1),v&&(h="u"+h),d=f+1}else if(this.parent.isDigit(i[c])||i[c]===this.parent.getParseDecimalSeparator()){m=i[c]===this.parent.getParseDecimalSeparator();for(c+=1;c<i.length&&(this.parent.isDigit(i[c])||!m&&i[c]===this.parent.getParseDecimalSeparator());)i[c]===this.parent.getParseDecimalSeparator()&&(m=!0),c+=1;if(c<i.length&&"%"===i[c]&&(c+=1),m&&c<i.length&&i[c]===this.parent.getParseDecimalSeparator())throw this.parent.formulaErrorStrings[e.FormulasErrorsStrings.number_contains_2_decimal_points];h="n"+this.parent.substring(i,o+1,c-o-1),d=c}else if(this.parent.isUpperChar(i[c])||i[c]===this.sheetToken||"u"===i[c]){if(i[c]===this.sheetToken)for(c+=1;c<i.length&&i[c]!==this.sheetToken;)c+=1;c+=1;for(var y=0,C=!1;c<i.length&&(this.parent.isUpperChar(i[c])||"_"===i[c]||"."===i[c]||"["===i[c]||"]"===i[c]||"#"===i[c]||" "===i[c]||"%"===i[c]||i[c]===this.parent.getParseDecimalSeparator()&&C);)c!==i.length-1&&"["===i[c]&&"["===i[c+1]&&(C=!0),c!==i.length-1&&"]"===i[c]&&"]"===i[c+1]&&(C=!1),c++,y++;var b=c===i.length||!this.parent.isDigit(i[c]);if(y>1){for(;c<i.length&&(this.parent.isUpperChar(i[c])||this.parent.isDigit(i[c])||" "===i[c]||"_"===i[c]);)c++;b=!0}for(;c<i.length&&this.parent.isDigit(i[c]);)c+=1;if(c<i.length&&":"===i[c]){if((c+=1)<i.length&&i[c]===this.sheetToken){for(c++;c<i.length&&i[c]!==this.sheetToken;)c+=1;c<i.length&&i[c]===this.sheetToken&&c++}for(;c<i.length&&this.parent.isUpperChar(i[c]);)c+=1;for(;c<i.length&&this.parent.isDigit(i[c]);)c+=1;c-=1,h=this.parent.substring(i,o+1,c-o)}else c-=1,h=this.parent.substring(i,o+1,c-o),(v="u"===i[c])&&(h="u"+h);b&&h.startsWith(this.sheetToken)&&(b=!this.parent.isCellReference(h)),b||this.parent.updateDependentCell(h),(this.parent.namedRanges.size>0&&this.parent.namedRanges.has(h.toUpperCase())||this.parent.storedData.has(h.toUpperCase()))&&(h="n"+this.checkForNamedRangeAndKeyValue(h)),d=c+1}var S=s.indexOf(i[o]),x=this.parent.arithMarker+l+h+r[S]+this.parent.arithMarker;p>0&&(x=i.substring(0,p)+x),d<i.length&&(x+=i.substring(d)),i=x=x.split(this.parent.arithMarker2).join(this.parent.arithMarker.toString()),o=this.indexOfAny(i,n)}else if(i.length>0&&(this.parent.isUpperChar(i[0])||i[0]===this.sheetToken)){var w=!0,I=!0,E=!1,k=i.length;for(f=0;f<k;++f)if(i[f]===this.sheetToken){if(f>0&&!E)throw this.parent.getErrorStrings()[e.CommonErrors.ref];for(E=!0,f++;f<k&&this.parent.isDigit(i[f]);)f++;if(f===k||i[f]!==this.sheetToken){w=!1;break}}else{if(!I&&this.parent.isChar(i[f])){w=!1;break}if(!this.parent.isChar(i[f])&&!this.parent.isDigit(i[f])&&i[f]!==this.sheetToken){w=!1;break}I=this.parent.isUpperChar(i[f])}w&&this.parent.updateDependentCell(i)}return i}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(e,r){e.length>0&&e[0]===this.parent.getFormulaCharacter()&&(e=e.substring(1)),e.length>0&&"+"===e[0]&&(e=e.substring(1));try{this.isFailureTriggered=!1,this.isError=!1,e=this.parse(e.trim(),r),this.isFormulaParsed=!0}catch(r){var n=this.exceptionArgs(r);this.isFailureTriggered||(this.parent.trigger("onFailure",n),this.isFailureTriggered=!0);var i="string"==typeof n.exception?n.exception:n.message;e=(t.isNullOrUndefined(this.parent.getErrorLine(r))?"":"#"+this.parent.getErrorLine(r)+": ")+i,this.isError=!0}return e},r.prototype.markLibraryFormulas=function(r){var n=0,i=r.indexOf(")");if(-1===i)r=this.markNamedRanges(r);else for(;i>-1;){for(var o=0,s=i-1;s>-1&&("("!==r[s]||0!==o);)")"===r[s]?o++:")"===r[s]&&o--,s--;if(-1===s)throw new Xi(this.parent.formulaErrorStrings[e.FormulasErrorsStrings.mismatched_parentheses]);for(var a=s-1;a>-1&&this.parent.isChar(r[a]);)a--;var l=s-a-1,h=this.parent.substring(r,a+1,l);if(l>0&&!t.isNullOrUndefined(this.parent.getFunction(h))){"AREAS"===this.parent.substring(r,a+1,l)?this.ignoreBracet=!0:this.ignoreBracet=!1;var p=this.parent.substring(r,s,i-s+1);try{var d=void 0;p=p.split("(").join("").split(")").join(""),p="("+this.formulaAutoCorrection(p,d)+")"}catch(t){if(!(d={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",d),this.isFailureTriggered=!0,n+=1),d.computeForceCalculate=n>0||d.computeForceCalculate,!d.isForceCalculable)throw this.parent.formulaErrorStrings[e.FormulasErrorsStrings.improper_formula];if(!d.computeForceCalculate)throw this.parent.formulaErrorStrings[e.FormulasErrorsStrings.improper_formula];p=p.split("(").join("").split(")").join(""),p="("+this.formulaAutoCorrection(p,d)+")"}p=this.markNamedRanges(p),p=this.swapInnerParens(p);-1===(p=this.addParensToArgs(p)).lastIndexOf(this.parent.getParseArgumentSeparator())&&p.length>2&&"("===p[0]&&")"===p[p.length-1]&&"{"!==p[1]&&"("!==p[1]&&(p=(p=p.substring(0,p.length-1)+"}"+p.substring(p.length-1))[0]+"{"+p.substring(1)),r=r.substring(0,a+1)+"q"+this.parent.substring(r,a+1,l)+p.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 c=this.emptyStr;s>0&&(c=r.substring(0,s)),c=c+"{"+this.parent.substring(r,s+1,i-s-1)+"}",i<r.length&&(c+=r.substring(i+1)),r=c=this.markNamedRanges(c)}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 o=this.indexOfAny(e.substring(r+1,e.length),t);o>=0?o=r+o+1:-1===o&&")"===e[e.length-1]&&(o=e.length-1),o>0&&"{"!==e[r+1]&&"}"!==e[o-1]&&(e=(e=e.substr(0,o)+"}"+e.substr(o)).substr(0,r+1)+"{"+e.substr(r+1)),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 o=this.emptyStr,s=null;if(this.parent.substring(e,n,i).indexOf("[")>-1?s=this.getTableRange(this.parent.substring(e,n,i)):this.parent.storedData.has(this.parent.substring(e,n,i))?s=this.checkForNamedRangeAndKeyValue(this.parent.substring(e,n,i)):this.parent.namedRanges.has(this.parent.substring(e,n,i))&&(s=this.checkForNamedRangeAndKeyValue(this.parent.substring(e,n,i))),t.isNullOrUndefined(s)){if("NaN"!==(o=this.checkScopedRange(this.parent.substring(e,n,i))))this.findNamedRange=!0,s=o;else if(this.parent.substring(e,n,i).startsWith(this.sheetToken.toString()))this.parent.substring(e,n,i).indexOf(this.sheetToken,1);!t.isNullOrUndefined(s)&&this.findNamedRange&&s.indexOf(this.fixedReference)>-1&&(s=s.split(this.fixedReference).join(this.emptyStr))}if(t.isNullOrUndefined(s)||(s=s.toUpperCase(),s=this.parent.setTokensForSheets(s),s=this.markLibraryFormulas(s)),t.isNullOrUndefined(s)||s===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)+s+e.substring(n+i),n+=s.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(s=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)):s:this.parent.namedRanges.size>0?this.checkForNamedRangeAndKeyValue(e.substring(n)):s,t.isNullOrUndefined(s)&&"NaN"!==(o=this.checkScopedRange(e.substring(n)))&&(s=o),!t.isNullOrUndefined(s)&&s!==this.emptyStr&&(s=s.toUpperCase(),s=this.parent.setTokensForSheets(s),null!=(s=this.markLibraryFormulas(s)))){var a=e.substring(n);e=")"===a[a.length-1]?e.substring(0,n)+s+")":e.substring(0,n)+s,n+=s.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),o=e.split('"').join(this.emptyStr);if(o=o.substr(0,o.indexOf(this.sheetToken)),i.sheetNameToToken.has(o.toUpperCase()))parseInt(i.sheetNameToToken.get(o.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}(),Wi=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)}}(),Gi=function(e,t,r,n){var i,o=arguments.length,s=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,r,s):i(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},Yi=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.refreshedCells=new Map,n.computedValues=null,n.randomValues=new Map,n.isRandomVal=!1,n.randCollection=[],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"],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 o=new ji(n);return n.includeBasicFormulas&&i.Inject(qi),n.injectedModules&&n.injectedModules.length&&o.inject(n.requiredModules(),n.injectedModules),n.parentObject=t.isNullOrUndefined(e)?n:e,n.grid=n.parentObject,n.parser=new zi(n),n}Wi(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 L(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&&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(){if(this.isSheetMember()){var e=this.getSheetFamilyItem(this.grid);return null==e.sheetDependentCells&&(e.sheetDependentCells=new Map),e.sheetDependentCells}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);return(t=t>0&&t<1?1+t:0===t?1:t)>60&&(t-=1),new Date(864e5*(t-1)+new Date("01/01/1900").getTime())},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);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){return Number(e)},n.prototype.rowIndex=function(t){var r,n=0,i=!1;if(n<t.length&&t[n]===this.sheetToken){for(n++;n<t.length&&t[n]!==this.sheetToken;)n++;n++}for(;n<t.length&&this.isChar(t[n]);)i=!0,n++;if(r=parseInt(t.substring(n),10),n<t.length&&!this.isNaN(r))return r;if(i)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){if(0===this.sheetFamilyID)return null==this.defaultFamilyItem&&(this.defaultFamilyItem=new $i),this.defaultFamilyItem;null==this.sheetFamiliesList&&(this.sheetFamiliesList=new Map);var t=this.modelToSheetID.get(e);return this.sheetFamiliesList.has(t)||this.sheetFamiliesList.set(t,new $i),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 Ki),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);null!=r&&(r.forEach(function(r,n){var i=n,o=t.getDependentCells().get(i);t.arrayRemove(o,e),0===o.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 o="string"==typeof i.exception?i.exception:i.message;return(t.isNullOrUndefined(this.getErrorLine(e))?"":"#"+this.getErrorLine(e)+": ")+o}}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){if(!this.getSheetFamilyItem(this.grid).parentObjectToToken.get(r[0]))return!1;e=r[0]+this.sheetToken+r[1].toUpperCase()}else e=e.toUpperCase();return this.namedRanges.set(e,t),!0},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++}return t.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,o,s,a,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)),o=this.rowIndex(this.substring(e,l+1,l+e.length-l-1)),s=this.colIndex(this.substring(e,0,l)),a=this.colIndex(this.substring(e,l+1,l+e.length-l-1)),i>o&&(l=o,o=i,i=l),s>a&&(l=a,a=s,s=l);var p,d=[],c=0;for(l=i;l<=o;l++)for(p=s;p<=a;p++)d[c]=t+this.emptyString+this.convertAlpha(p)+l.toString(),c++;return d},n.prototype.computeFormula=function(r){var n,i,o,s,a=!1;if(this.parser.isError)return r;n=this.parser.isFormulaParsed?r:this.parser.parseFormula(r),this.parser.isFormulaParsed=!1;try{if((i=this.findLastIndexOfq(n))>0&&(a=!0),n!==this.emptyString&&i>-1)for(var l=i+1;l>-1;)if(n[l]===this.rightBracket){var h=n.substring(i,l+1),p=h.split(this.leftBracket)[0].split("q").join(this.emptyString),d=h.substring(h.indexOf(this.leftBracket)+1,h.indexOf(this.rightBracket)).split(this.getParseArgumentSeparator());if(this.getLibraryFormulas().get(p.toUpperCase()).isCustom){var c=0,u=[];for(c=0;c<d.length;c++)u.push(this.getValueFromArg(d[c]));d=u}if(o=t.isNullOrUndefined(this.getFunction(p))?this.getErrorStrings()[e.CommonErrors.name]:this.getFunction(p).apply(void 0,d),!a)break;s=this.processNestedFormula(n,h,o);var f=this.findLastIndexOfq(s);0===f&&(a=!1),-1===f&&(o=this.computeValue(s)),i=l=f,n=s}else l++;else this.formulaErrorStrings.indexOf(n)>-1?o=n:n!==this.emptyString&&-1===i&&(o=this.computeValue(n))}catch(e){d={message:e.message,exception:e,isForceCalculable:!1,computeForceCalculate:!1};this.trigger("onFailure",d);var g="string"==typeof d.exception?d.exception:d.message;o=(t.isNullOrUndefined(this.getErrorLine(e))?"":"#"+this.getErrorLine(e)+": ")+g}return o},n.prototype.computeSumIfAndAvgIf=function(r){if(t.isNullOrUndefined(r)||r[0]===this.emptyString||0===r.length)return this.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];var n=r,i=n.length;if(2!==i&&3!==i&&0===i)return this.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];var o=n[0],s=i>2?n[2].trim():n[1].trim();if((s=s.split(this.tic).join(this.emptyString)).length>255)return this.getErrorStrings()[e.CommonErrors.value];var a=this.parser.tokenEqual;s.startsWith("<=")?(a=this.parser.tokenLessEq,s=s.substring(2)):s.startsWith(">=")?(a=this.parser.tokenGreaterEq,s=s.substring(2)):s.startsWith("<>")?(a=this.parser.tokenNotEqual,s=s.substring(2)):s.startsWith("<")?(a=this.parser.tokenLess,s=s.substring(1)):s.startsWith(">")?(a=this.parser.tokenGreater,s=s.substring(1)):s.startsWith("=")&&(a=this.parser.tokenEqual,s=s.substring(1));var l=this.parseFloat(s),h=2===i?o:n[1],p=this.getCellCollection(n[0]),d=this.getCellCollection(h),c=this.getComputeSumIfValue(d,p,s,l,a);return[c[0],c[1]]},n.prototype.computeLookup=function(t){if(0===t.length)return this.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];for(var r=[],n=[],i=t,o=i.length,s=i[0].split(this.tic).join(this.emptyString),a=i[1],l=2===o?a:i[2],h=this.getCellCollection(i[1]),p=this.getCellCollection(l),d=0;d<h.length;d++)n[d]=this.getValueFromArg(h[d]).split(this.tic).join("");for(var c=n.toString().split(this.getParseArgumentSeparator()),u=this.parseFloat(c[c.sort().length-1]),f=this.parseFloat(c[0]),g=0;g<h.length;g++){if(r[g]=this.getValueFromArg(h[g]).split(this.tic).join(""),s===r[g])return this.getValueFromArg(p[g]).split(this.tic).join("");if(this.parseFloat(s)===this.parseFloat(r[g]))return this.getValueFromArg(p[g]).split(this.tic).join("");if(this.parseFloat(s)<f)return this.getErrorStrings()[e.CommonErrors.na];if(this.parseFloat(s)>u){var m=n.indexOf(u.toString());return this.getValueFromArg(p[m]).split(this.tic).join("")}}if(n.indexOf(s)<0){for(var v=[],y=0;y<c.length;y++)this.parseFloat(s)>this.parseFloat(c[y])&&v.push(c[y]);m=n.indexOf(v[v.length-1]);return this.getValueFromArg(p[m]).split(this.tic).join("")}return this.getErrorStrings()[e.CommonErrors.na]},n.prototype.computeVLookup=function(r){var n=r,i=[],o=n[0].split(this.tic).join("");if(o.indexOf(":")>-1)return this.getErrorStrings()[e.CommonErrors.value];if(this.isCellReference(o)&&(o=this.getValueFromArg(o)),n[1].indexOf(":")<-1)return this.getErrorStrings()[e.CommonErrors.na];var s=[],a="",l="";if(this.isCellReference(n[1])&&(s=this.getCellCollection(n[1]),n[1].indexOf(":")>-1)){for(var h=n[1].indexOf(":"),p=0;p<h;p++){a+=this.isChar(n[1][p])?n[1][p]:""}for(var d=h;d<n[1].length;d++){l+=this.isChar(n[1][d])?n[1][d]:""}}var c=this.colIndex(a)+this.parseFloat(n[2]);if(c>this.colIndex(l))return this.getErrorStrings()[e.CommonErrors.na];if(c===this.colIndex(a))return this.getErrorStrings()[e.CommonErrors.na];var u=this.convertAlpha(c);n[3]=t.isNullOrUndefined(n[3])?this.trueValue:n[3].split(this.tic).join("");var f="";for(p=0;p<s.length;p++)i[p]=this.getValueFromArg(s[p]).split(this.tic).join("");var g=i.toString().split(this.getParseArgumentSeparator()),m=this.parseFloat(g[g.sort().length-1]),v=this.parseFloat(g[0]);for(d=0;d<s.length;d++){if(f=this.getValueFromArg(s[d]),n[3].toUpperCase()===this.trueValue){if(o===f)return this.getValueFromArg(u+d).split(this.tic).join("");if(this.parseFloat(o)===this.parseFloat(f))return this.getValueFromArg(u+d).split(this.tic).join("");if(this.parseFloat(o)<v)return this.getErrorStrings()[e.CommonErrors.na];if(this.parseFloat(o)>m){h=i.indexOf(m.toString());return this.getValueFromArg(u+h).split(this.tic).join("")}}if(n[3]===this.falseValue&&o===f)return this.getValueFromArg(u+d)}return this.getErrorStrings()[e.CommonErrors.na]},n.prototype.findWildCardValue=function(e,t){var r="";if(e.indexOf("?")>-1){var n=e[(s=e.indexOf("?"))-1],i=e[s+1];if(t.indexOf(n)>-1&&t.indexOf(i)>-1){var o=t.indexOf(n);r=t[o]===n&&t[o+2]===i?e:t}else r=t}else if(e.indexOf("*")>-1){for(var s=e.indexOf("*"),a="",l="",h=this.falseValue,p=this.falseValue,d=s-1;d>=0;d--)a+=e[d],p=this.trueValue;for(d=s+1;d<e.length;d++)l+=e[d],h=this.trueValue;var c=""===a?-1:t.indexOf(a.split("").reverse().join("")),u=""===l?-1:t.indexOf(l);c>-1||u>-1?p===this.trueValue?r=a.split("").reverse().join("")===t.substr(0,a.length)?e:t:h===this.trueValue&&(r=l===t.substring(t.length-l.length,t.length)?e:t):r=t}return r},n.prototype.getComputeSumIfValue=function(e,t,r,n,i){var o=0,s=0;switch(i){case this.parser.tokenEqual:for(var a=0;a<e.length;a++){var l=this.getValueFromArg(e[a].split(this.tic).join("")),h=this.parseFloat(l);if(l===r&&h===n){var p=this.getValueFromArg(t[a].split(this.tic).join(""));o+=this.parseFloat(p),s+=1}}break;case this.parser.tokenLess:for(a=0;a<e.length;a++){l=this.getValueFromArg(e[a].split(this.tic).join(""));if((h=this.parseFloat(l))<n){p=this.getValueFromArg(t[a].split(this.tic).join(""));o+=this.parseFloat(p),s+=1}}break;case this.parser.tokenGreater:for(a=0;a<e.length;a++){l=this.getValueFromArg(e[a].split(this.tic).join(""));if((h=this.parseFloat(l))>n){p=this.getValueFromArg(t[a].split(this.tic).join(""));o+=this.parseFloat(p),s+=1}}break;case this.parser.tokenLessEq:for(a=0;a<e.length;a++){l=this.getValueFromArg(e[a].split(this.tic).join(""));if((h=this.parseFloat(l))<=n){p=this.getValueFromArg(t[a].split(this.tic).join(""));o+=this.parseFloat(p),s+=1}}break;case this.parser.tokenGreaterEq:for(a=0;a<e.length;a++){l=this.getValueFromArg(e[a].split(this.tic).join(""));if((h=this.parseFloat(l))>=n){p=this.getValueFromArg(t[a].split(this.tic).join(""));o+=this.parseFloat(p),s+=1}}break;case this.parser.tokenNotEqual:for(a=0;a<e.length;a++){l=this.getValueFromArg(e[a].split(this.tic).join("")),h=this.parseFloat(l);if(l!==r&&h!==n){p=this.getValueFromArg(t[a].split(this.tic).join(""));o+=this.parseFloat(p),s+=1}}}return[o,s]},n.prototype.computeAndOr=function(t,r){var n,i,o="and"===r;if(0===t.length)return this.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];for(var s=0,a=t.length;s<a;s++)if(t[s].split(this.tic).join("").trim()===this.emptyString)return this.getErrorStrings()[e.CommonErrors.value];for(var l=t,h=0;h<l.length;h++){if(l[h]===this.tic)return this.getErrorStrings()[e.CommonErrors.value];if(l[h].indexOf(":")>-1&&this.isCellReference(l[h]))for(var p=this.getCellCollection(l[h]),d=0;d<p.length;d++){if(this.getErrorStrings().indexOf(p[d])>-1)return p[d];if(p[d][0]===this.tic)return this.getErrorStrings()[e.CommonErrors.name];if(""===(n=this.getValueFromArg(p[d]))&&(n=this.trueValue),this.getErrorStrings().indexOf(n)>-1)return n;i=this.parseFloat(n)}else{if(n=this.getValueFromArg(l[h]).split(this.tic).join("").toUpperCase(),this.getErrorStrings().indexOf(n)>-1)return n;var c=Date.parse(n.split(this.tic).join(""));if(isNaN(c)){if(n!==this.trueValue&&n!==this.falseValue)return this.getErrorStrings()[e.CommonErrors.value].toString()}else o=!0;i=this.parseFloat(n)}o="and"===r?o&&(n===this.trueValue||!isNaN(i)):o||n===this.trueValue||!isNaN(i)}return o?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.computeValue=function(t){try{var r=[],n=0,i="";for(r.length=0;n<t.length;){var o="u"===t[n];if(t[n]!==this.arithMarker){if(this.isDigit(t[n])){for(var s=this.emptyString;n<t.length&&this.isDigit(t[n]);)s+=t[n],n+=1;r.push(s)}if(t[n]===this.sheetToken){for(i=t[n],n+=1;n<t.length&&t[n]!==this.sheetToken;)i+=t[n],n+=1;n<t.length&&(i+=t[n],n+=1)}else if(this.isUpperChar(t[n])){s=this.emptyString;for(var a="";n<t.length&&this.isUpperChar(t[n]);)s+=t[n],n+=1;for(;n<t.length&&this.isDigit(t[n]);)s+=t[n],n+=1;if(s=i+s,"string"==typeof(a=this.getParentObjectCellValue(s).toString())&&this.getErrorStrings().indexOf(a)>-1)return a;r.push(a)}else if("q"===t[n]){var l=t.substring(n+1).indexOf(this.leftBracket),h=t.substring(n+l+1).indexOf(this.rightBracket);t=this.substring(t,n+l+2,h-1)}else if(t[n]===this.tic[0]){s=t[n].toString();for(n+=1;n<t.length&&t[n]!==this.tic[0];)s+=t[n],n+=1;r.push(s.split(this.tic).join(this.emptyString)),n+=1}else if("%"===t[n]&&r.length>0){var p=r[0],d=this.parseFloat(p);this.isNaN(d)||(r.pop(),r.push((d/100).toString())),n+=1}else if(0===t.substring(n).indexOf(this.trueValue))r.push(this.trueValue),n+=this.trueValue.length;else if(0===t.substring(n).indexOf(this.falseValue))r.push(this.falseValue),n+=this.falseValue.length;else if(t[n]===this.tic[0]||"|"===t[n]){s=t[n].toString();for(n++;n<t.length&&t[n]!==this.tic[0];)s+=t[n],n+=1;r.push(s+this.tic),n+=1}else switch(t[n]){case"#":var c=0;this.getErrorStrings().indexOf(t.substring(n))>-1?(c=-1===t.indexOf("!")||-1===t.substring(n).indexOf("!")?t.indexOf("#N/A")>-1?t.indexOf("#N/A")+4+n:t.indexOf("?")+1+n:t.indexOf("!")+1+n,r.push(this.substring(t,n,c-n))):(c=n+1,r.push(this.substring(t,n,c-n))),n=c;break;case"n":n+=1;s="";if(0===t.substring(n).indexOf("Infinity"))n+=(s="Infinity").length;else for(("u"===t[n]||o)&&(s="-",o?o=!1:n+=1);n<t.length&&this.isDigit(t[n])||t[n]===this.getParseDecimalSeparator();)s+=t[n],n+=1;r.push(s);break;case this.parser.tokenAdd:this.getValArithmetic(r,"add"),n+=1;break;case this.parser.tokenSubtract:this.getValArithmetic(r,"sub"),n+=1;break;case this.parser.tokenMultiply:this.getValArithmetic(r,"mul"),n+=1;break;case this.parser.tokenDivide:this.getValArithmetic(r,"div"),n+=1;break;case this.parser.tokenLess:this.processLogical(r,"less"),n+=1;break;case this.parser.tokenGreater:this.processLogical(r,"greater"),n+=1;break;case this.parser.tokenGreaterEq:this.processLogical(r,"greaterEq"),n+=1;break;case this.parser.tokenLessEq:this.processLogical(r,"lessEq"),n+=1;break;case this.parser.tokenNotEqual:this.processLogical(r,"notEq"),n+=1;break;case this.parser.tokenOr:this.processLogical(r,"or"),n+=1;break;case this.parser.tokenAnd:this.processLogical(r,"and"),n+=1;break;case this.parser.tokenEqual:this.processLogical(r,"equal"),n+=1;break;default:return this.getErrorStrings()[e.CommonErrors.value]}}else n+=1}if(0===r.length)return this.emptyString;s=this.emptyString;for(var u=r.length;u>0;){if((s=r.pop()+s)===this.emptyString&&this.isCellReference(t)&&this.getTreatEmptyStringAsZero())return"0";u--}return s}catch(t){if(this.getErrorStrings().indexOf(t)>-1||this.formulaErrorStrings.indexOf(t)>-1)throw t;throw new Xi(this.formulaErrorStrings[e.FormulasErrorsStrings.invalid_expression])}},n.prototype.getValArithmetic=function(t,r){var n=t.pop();n=n===this.emptyString?"0":n;var i=Number(n);if(isNaN(i))throw this.getErrorStrings()[e.CommonErrors.value];var o=t.pop();if(o=o===this.emptyString?"0":o,i=Number(o),isNaN(i))throw this.getErrorStrings()[e.CommonErrors.value];"add"===r&&t.push((Number(o)+Number(n)).toString()),"sub"===r&&t.push((Number(o)-Number(n)).toString()),"mul"===r&&t.push((Number(o)*Number(n)).toString()),"div"===r&&(this.isNaN(this.parseFloat(n))||this.isNaN(this.parseFloat(o))?t.push(this.getErrorStrings()[e.CommonErrors.value]):0===this.parseFloat(n)?t.push(this.getErrorStrings()[e.CommonErrors.divzero]):t.push((Number(o)/Number(n)).toString()))},n.prototype.processLogical=function(e,t){var r,n,i,o;"and"!==t&&"equal"!==t&&(r=e.pop(),n=e.pop(),i=r.indexOf(this.tic)>-1?r:this.parseFloat(r),o=n.indexOf(this.tic)>-1?n:this.parseFloat(n));var s;return"less"===t&&(s=this.isNaN(i)||this.isNaN(o)?n.toUpperCase().split(this.tic).join("").localeCompare(r.toUpperCase().split(this.tic).join(""))<0?this.trueValue:this.falseValue:o<i?this.trueValue:this.falseValue),"greater"===t&&(s=this.isNaN(i)||this.isNaN(o)?n.toUpperCase().split(this.tic).join("").localeCompare(r.toUpperCase().split(this.tic).join(""))>0?this.trueValue:this.falseValue:o>i?this.trueValue:this.falseValue),"lessEq"===t&&(s=this.isNaN(i)||this.isNaN(o)?n.toUpperCase().split(this.tic).join("").localeCompare(r.toUpperCase().split(this.tic).join(""))<=0?this.trueValue:this.falseValue:o<=i?this.trueValue:this.falseValue),"greaterEq"===t&&(s=this.isNaN(i)||this.isNaN(o)?n.toUpperCase().split(this.tic).join("").localeCompare(r.toUpperCase().split(this.tic).join(""))>=0?this.trueValue:this.falseValue:o>=i?this.trueValue:this.falseValue),"notEq"===t&&(s=n!==r?this.trueValue:this.falseValue),"and"===t&&(r=e.pop().toString(),n="",e.length>0&&(n=e.pop().toString()),s=(s=this.emptyString+n+r+this.emptyString).split(this.tic).join("")),"equal"===t&&(s=(r=e.pop().toString())===(n=e.pop().toString())?this.trueValue:this.falseValue),"or"===t&&(s=Math.pow(this.parseFloat(o),this.parseFloat(i)).toString()),e.push(s),s},n.prototype.computeStoreCells=function(e){for(var t=e.cellValue,r=e.cellRange,n=e.criteria,i=e.argArray,o=e.isCriteria,s=e.storedCells,a=e.isCountIfS,l=e.countVal,h=o===this.trueValue?s:t,p=[],d=0;d<h.length;d++){var c=[],u=this.getValueFromArg(t[d]),f=void 0,g="";if(f=i[2].split(this.tic).join(this.emptyString),(o=a===this.trueValue?this.trueValue:o)===this.trueValue){var m="",v=0,y=0;for(s[d]=a===this.trueValue&&0===l?t[d]:s[d],m=s[d];!this.isDigit(m[v]);)v+=1;if(this.isCellReference(r[l])&&r[l].indexOf(":")>-1){var C=r[l].indexOf(":");for(g=this.substring(r[l],C);!this.isDigit(g[y]);)y+=1}var b=this.substring(m,v),S=this.substring(g,y);g=s[d].split(b).join(S),u=this.getValueFromArg(g),f=a===this.trueValue?n[l].split(this.tic).join(this.emptyString):n[l-1].split(this.tic).join(this.emptyString)}var x="equal";f.startsWith("<=")?(x="lessEq",f=f.substring(2)):f.startsWith(">=")?(x="greaterEq",f=f.substring(2)):f.startsWith("<>")?(x="notEq",f=f.substring(2)):f.startsWith("<")?(x="less",f=f.substring(1)):f.startsWith(">")?(x="greater",f=f.substring(1)):f.startsWith("=")&&(x="equal",f=f.substring(1)),(f.indexOf("*")>-1||f.indexOf("?")>-1)&&(u=this.findWildCardValue(f,u)),c.push(u.toLowerCase()),c.push(f.toLowerCase()),this.processLogical(c,x)===this.trueValue&&(o===this.falseValue?p.push(t[d]):p.push(g))}return s=p,p=[],s},n.prototype.computeIfsFormulas=function(r,n,i){if(t.isNullOrUndefined(r)||""===r[0]||0===r.length)return this.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];var o=r,s=o.length;if(s<2||s>127)return this.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];for(var a=[],l=[],h=[],p=0,d=0;d<o.length;d++)o[d].indexOf(":")>-1&&this.isCellReference(o[d])?a.push(o[d]):l.push(o[d]);a=(a=a.toString().split(",,").join(",")).split(this.getParseArgumentSeparator());var c,u;if(n===this.falseValue){u=this.falseValue;var f={cellValue:c=this.getCellCollection(a[1]),cellRange:a,criteria:l,argArray:o,isCriteria:u,storedCells:h,isCountIfS:n};if(h=this.computeStoreCells(f),0===h.length)return 0}for(d=n===this.trueValue?0:2;d<a.length;d++){u=this.trueValue,u=n===this.trueValue&&0===d?this.falseValue:this.trueValue;f={cellValue:c=this.getCellCollection(a[d]),cellRange:a,criteria:l,argArray:o,isCriteria:u,storedCells:h,isCountIfS:n,countVal:d};if(h=this.computeStoreCells(f),0===h.length)return 0}for(var g=0;g<h.length;g++){var m="",v="",y=0,C=0;for(m=h[g];!this.isDigit(m[y]);)y+=1;if(this.isCellReference(a[0])&&a[0].indexOf(":")>-1){var b=a[0].indexOf(":");for(v=this.substring(a[0],b);!this.isDigit(v[C]);)C+=1}var S=this.substring(m,y),x=this.substring(v,C);if(c=h[g].split(S).join(x),n===this.trueValue)p+=1;else{var w=this.getValueFromArg(c);p+=parseFloat(""===w?"0":w)}}return i===this.trueValue&&(p/=c.length),p},n.prototype.processNestedFormula=function(e,t,r){this.findLastIndexOfq(e);return e.split(t).join("n"+r)},n.prototype.isNaN=function(e){return"NaN"===e.toString()||"string"==typeof e},n.prototype.fromOADate=function(e){var t=new Date;return t.setTime(e*this.millisecondsOfaDay+Date.parse(this.oaDate.toString())),t},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;i=!0;for(var o=new Date(e,t,1,-1).getDate();r>o;)o=new Date(e,t,1,-1).getDate(),t++,r-=o,i=!1;r<1&&(t--,r=(o=new Date(e,t,1,-1).getDate())-r)}var s=Date.parse(e.toString()+this.getParseDateTimeSeparator()+t.toString()+this.getParseDateTimeSeparator()+r.toString());return this.isNaN(s)||(n=this.toOADate(new Date(s))),n},n.prototype.toOADate=function(e){return(e.getTime()-Date.parse(this.oaDate.toString()))/this.millisecondsOfaDay},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){return e.lastIndexOf("q")},n.prototype.getValueFromArg=function(r){var n=r=r.trim(),i=this.dateTime1900,o=n;if(t.isNullOrUndefined(n)||this.isTextEmpty(n))return n;if(r[0]===this.tic||r[0]===this.singleTic)return i=this.isDate(r.split(this.tic).join("")),this.isNaN(this.parseFloat(r.split(this.tic).join("")))&&!t.isNullOrUndefined(i)&&!this.isNaN(i.getDate())&&this.dateTime1900<=i?this.toOADate(i).toString():r;if(r=r.split("u").join("-"),!this.isUpperChar(n[0])&&(this.isDigit(n[0])||n[0]===this.getParseDecimalSeparator()||"-"===n[0]||"n"===n[0]))return"n"===n[0]&&(n=n.substring(1)),n;if(-1===this.parser.indexOfAny(n,["+","-","/","*",")",")","{"])&&this.isUpperChar(n[0])||n[0]===this.sheetToken){if(n!==this.trueValue&&n!==this.falseValue&&this.isCellReference(n)){var s=this.getSheetFamilyItem(this.grid);if(null!==s.sheetNameToParentObject&&s.sheetNameToParentObject.size>0&&-1===n.indexOf(this.sheetToken)){n=s.parentObjectToToken.get(this.grid)+n}}if(n===this.cell){var a=this.getDependentCells().get(n);throw null!=a&&a.indexOf(n)>-1&&this.arrayRemove(a,n),this.getDependentFormulaCells().has(this.cell)||this.clearFormulaDependentCells(this.cell),this.formulaErrorStrings[e.FormulasErrorsStrings.circular_reference]+n}return o=this.getParentObjectCellValue(n),this.updateDependentCell(n),o.toString()}return this.getErrorStrings().indexOf(r)>-1?r:this.computeValue(o.toString())},n.prototype.isDate=function(e){if("object"==typeof e||null!==Date.parse(e)){var t=new Date(Date.parse(e));return t>=this.dateTime1900?t:null}return null},n.prototype.isValidCellReference=function(e){var r=0,n=0,i=[89,71,69],o=this.emptyString;if(this.namedRanges.has(e))return!1;for(var s=0;s<e.length;s++)this.isChar(e[s])&&r++;if((o=e.substring(0,r)).length<4){for(;n<o.length;){if(t.isNullOrUndefined(o[n])||!(o[n].charCodeAt(0)<i[n])){if(t.isNullOrUndefined(o[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=new Date(t),this.isNaN(t))?this.getErrorStrings()[e.CommonErrors.value]:t},n.prototype.isCellReference=function(e){if(e===this.emptyString)return!1;e=e.trim(),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 o=e.split("").join(this.getParseArgumentSeparator()).split(this.getParseArgumentSeparator()),s=0;s<o.length;s++)if(this.isChar(o[s]))n=!0;else if(this.isDigit(o[s]))i=!0;else{if(":"!==o[s])return!1;n&&i&&(r=!0),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))},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 o=this.singleTic+"SHEET"+r[n]+this.singleTic+this.sheetToken;-1===e.indexOf(o)&&(o="SHEET"+r[n]+this.sheetToken),e=e.split(o).join(i),o=r[n]+this.sheetToken,e=e.split(o).join(i)}if((e=e.split(this.tempSheetPlaceHolder).join(this.sheetToken)).indexOf("!!")>-1){var s=(e=e.replace("!!","!")).split("");s[1]=(parseInt(s[1],10)+1).toString(),e=s.join("")}return e},n.prototype.getParentObjectCellValue=function(t){if(t===this.trueValue||t===this.falseValue)return t;var r=t.lastIndexOf(this.sheetToken),n=0,i=0,o=this.grid,s=this.getSheetFamilyItem(o);if(r>-1&&null!==s.tokenToParentObject)this.grid=s.tokenToParentObject.get(t.substring(0,r+1)),n=this.rowIndex(t),i=this.colIndex(t);else if(-1===r){for(var a=0;a<t.length&&this.isChar(t[a]);)a++;if(a===t.length)return t=t.toLowerCase(),this.getErrorStrings()[e.CommonErrors.name];n=this.rowIndex(t),i=this.colIndex(t),s.isSheetMember&&null!=s.parentObjectToToken&&(t=s.parentObjectToToken.get(this.grid)+t)}var l=""===this.cell||null===this.cell?"":this.cell;if(this.cell=t,l===this.cell)throw this.formulaErrorStrings[e.FormulasErrorsStrings.circular_reference];var h=this.getParentCellValue(n,i,this.grid);return this.grid=o,this.cell=l,h},n.prototype.getParentCellValue=function(e,r,n){var i;return void 0!==this.parentObject.getValueRowCol?(i=this.parentObject.getValueRowCol(this.getSheetID(n),e,r),t.isNullOrUndefined(i)?this.emptyString:i.toString()):(""!==(i=this.getValueRowCol(this.getSheetID(n),e,r))&&void 0!==i||(i=""),i)},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 o=this.parseFloat(i.substring(0,i.length-1));this.isNaN(o)&&(i=(Number(o)/100).toString())}return i},n.prototype.defineFunction=function(e,r){"string"==typeof r&&(r=t.getValue(r,window)),e=e.toUpperCase(),this.libraryFormulas.set(e,{handler:r,isCustom:!0})},n.prototype.valueChanged=function(e,r,n){var i=e;this.grid=e;var o=!0,s=!0,a=this.getSheetFamilyItem(i),l=M(r.getColIndex())+r.getRowIndex().toString();if(null!==a.sheetNameToParentObject&&a.sheetNameToParentObject.size>0){l=a.parentObjectToToken.get(i)+l}var h=r.getValue().toUpperCase();if(h.indexOf("=RAND()")>-1||h.indexOf("RAND()")>-1||h.indexOf("=RANDBETWEEN(")>-1||h.indexOf("RANDBETWEEN(")>-1||this.randomValues.has(l)){var p=this.randCollection.toString();this.randomValues.has(l)?this.randomValues.has(l)&&(h.indexOf("=RAND()")>-1||h.indexOf("RAND()")>-1||h.indexOf("=RANDBETWEEN(")>-1||h.indexOf("RANDBETWEEN(")>-1?this.randomValues.set(l,r.getValue()):r.getValue().toUpperCase()!==this.randomValues.get(l.toUpperCase())&&(this.randomValues.delete(l),p=p.split(l+this.parseArgumentSeparator).join("").split(this.parseArgumentSeparator+l).join("").split(l).join(""),this.randCollection=p.split(this.parseArgumentSeparator)),0===this.randomValues.size&&this.randCollection.length&&(this.isRandomVal=!1,this.randomValues.clear(),this.randCollection=[])):(this.randomValues.set(l,r.getValue()),this.randCollection.push(l),this.isRandomVal=!0)}if(r.getValue()&&r.getValue()[0]===this.getFormulaCharacter()){this.cell=l;var d=void 0;if(t.isNullOrUndefined(s)||(s=n),this.getFormulaInfoTable().has(l)){if(d=this.getFormulaInfoTable().get(l),r.getValue()!==d.getFormulaText()||null==d.getParsedFormula()){d.setFormulaText(r.getValue()),this.getDependentFormulaCells().has(this.cell)&&this.clearFormulaDependentCells(this.cell);try{d.setParsedFormula(this.parser.parseFormula(r.getValue()))}catch(e){d.setFormulaValue(e),s=!1}}if(s){this.parser.isFormulaParsed=!0;var c=this.computeFormula(d.getParsedFormula());o=c!==d.getFormulaValue(),d.setFormulaValue(c)}}else{(d=new Ki).setFormulaText(r.getValue()),this.getDependentFormulaCells().has(l)||this.getDependentFormulaCells().set(l,new Map);try{d.setParsedFormula(this.parser.parseFormula(r.getValue()))}catch(e){d.setFormulaValue(e),s=!1}s&&d.setFormulaValue(this.computeFormula(d.getParsedFormula())),this.getFormulaInfoTable().has(l),this.getFormulaInfoTable().set(l,d)}s&&(void 0===this.parentObject.setValueRowCol?this.setValueRowCol(this.getSheetID(i)+1,d.getFormulaValue(),r.getRowIndex(),r.getColIndex()):this.parentObject.setValueRowCol(this.getSheetID(i)+1,d.getFormulaValue(),r.getRowIndex(),r.getColIndex()))}else this.getFormulaInfoTable().has(l)&&(this.getFormulaInfoTable().delete(l),this.getDependentFormulaCells().has(l)&&this.clearFormulaDependentCells(l));s&&o&&this.getDependentCells().has(l)&&this.getDependentCells().get(l).toString()!==l&&(this.getComputedValue().clear(),this.refresh(l))},n.prototype.getComputedValue=function(){return null===this.computedValues&&(this.computedValues=new Map),this.computedValues},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()}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,o,s=0;if(t.isNullOrUndefined(r)||0===r.length)return this.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];for(var a=0,l=r.length;a<l;a++)if(r[a].split(this.tic).join("").trim()===this.emptyString)return this.getErrorStrings()[e.CommonErrors.value];i="max"===n?this.minValue:this.maxValue;var h=r;if(h.length>255)return this.getErrorStrings()[e.CommonErrors.value];for(var p=0;p<h.length;p++)if(h[p].indexOf(":")>-1&&this.isCellReference(h[p]))for(var d=this.getCellCollection(h[p]),c=0;c<d.length;c++){if(o=this.getValueFromArg(d[c]),this.getErrorStrings().indexOf(o)>-1)return o;var u=this.parseFloat(o);""===o||this.isNaN(this.parseFloat(u))?(s+=1)===d.length&&(i=0):i="max"===n?Math.max(i,u):Math.min(i,u)}else{var f=void 0;if(f=this.getValueFromArg(h[p]),this.getErrorStrings().indexOf(f)>-1)return f;u=this.parseFloat(f);if(""===f||this.isNaN(this.parseFloat(u))){(s+=1)===o.length&&(i=0);continue}i="max"===n?Math.max(i,u):Math.min(i,u)}return i.toString()},n.prototype.calculateAvg=function(r){for(var n=0,i=r,o=[],s=0,a=0,l=0;l<i.length;l++)if(i[l].indexOf(":")>-1&&this.isCellReference(i[l])){a=0,o=this.getCellCollection(i[l]),s=0;for(var h=0;h<o.length;h++){var p=this.getValueFromArg(o[h]);t.isNullOrUndefined(p)||isNaN(this.parseFloat(p))||(s+=this.parseFloat(p),a+=1)}if(0===a)return this.getErrorStrings()[e.CommonErrors.divzero];n=(s/=a)+n}else{if(i[l].indexOf(this.tic)>-1&&isNaN(parseFloat(i[l].split(this.tic).join(""))))return this.getErrorStrings()[e.CommonErrors.value];0===i[l].length&&(i[l]="1");p=this.getValueFromArg(i[l].split(this.tic).join(""));if(t.isNullOrUndefined(p)||isNaN(this.parseFloat(p)))return this.getErrorStrings()[e.CommonErrors.name];n+=this.parseFloat(p)}return(n/(i.length-0)).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 o=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(o))){s=this.sheetToken+this.tokenCount.toString()+this.sheetToken;this.tokenCount++,i.tokenToParentObject.set(s,r),i.parentObjectToToken.set(r,s),i.sheetNameToToken.set(o,s),i.sheetNameToParentObject.set(o,r)}else{var s=i.sheetNameToToken.get(o);i.tokenToParentObject.set(s,r),i.parentObjectToToken.set(r,s)}return e},n.prototype.unregisterGridAsSheet=function(e,t){var r=this.getSheetFamilyItem(t),n=e.toUpperCase();if(null!=r.sheetNameToParentObject&&r.sheetNameToParentObject.has(n)){r.sheetNameToParentObject.delete(n);var i=r.sheetNameToToken.get(n);r.sheetNameToToken.delete(n),r.tokenToParentObject.delete(i),r.parentObjectToToken.delete(t)}},n.prototype.computeExpression=function(e){var t=this.parser.parseFormula(e);return this.computeFormula(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,o="",s=this.randCollection.toString();this.randomValues.has(e)&&(this.randomValues.delete(e),s=s.split(e+this.parseArgumentSeparator).join("").split(this.parseArgumentSeparator+e).join("").split(e).join(""),0===this.randomValues.size&&""===s?(this.randomValues.clear(),this.randCollection=[]):this.randCollection=s.split(this.parseArgumentSeparator));for(var a=0;a<this.randomValues.size;a++)t=this.rowIndex(this.randCollection[a]),r=this.colIndex(this.randCollection[a]),o=(parseFloat(this.getSheetToken(this.randCollection[a]).split(this.sheetToken).join(""))+1).toString(),i=this.getSheetFamilyItem(o),this.grid=i.sheetNameToParentObject.get(o),n=this.randomValues.get(this.randCollection[a]),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)+1,n,t,r)},n.prototype.refresh=function(e){if(0===this.dependencyLevel&&this.refreshedCells.clear(),this.getDependentCells().has(e)&&null!==this.getDependentCells().get(e)){var t=this.getSheetFamilyItem(this.grid);this.dependencyLevel=this.dependencyLevel+1;try{var r=this.getDependentCells().get(e),n=void 0;for(n=0;n<r.length;n++){var i=r[n],o=this.getSheetToken(i);o.length&&(this.grid=t.tokenToParentObject.get(o));try{var s=this.rowIndex(i),a=this.colIndex(i),l=this.getFormulaInfoTable().get(i),h=void 0;l&&(this.cell=i,this.getComputedValue().has(i)?h=this.getComputedValue().get(i):(this.parser.isFormulaParsed=!0,h=this.computeFormula(l.getParsedFormula()),this.computedValues.set(i,h)),l.setFormulaValue(h)),void 0===this.parentObject.setValueRowCol?this.setValueRowCol(this.getSheetID(this.grid)+1,l.getFormulaValue(),s,a):this.parentObject.setValueRowCol(this.getSheetID(this.grid)+1,l.getFormulaValue(),s,a),this.refreshedCells.has(i)||(this.refreshedCells.set(i,[]),this.refresh(i))}catch(e){continue}}}finally{this.grid=t.tokenToParentObject.get(this.getSheetToken(e)),this.dependencyLevel--,0===this.dependencyLevel&&this.refreshedCells.clear()}}};var i;return Gi([t.Property(!0)],n.prototype,"includeBasicFormulas",void 0),Gi([t.Event()],n.prototype,"onFailure",void 0),n=i=Gi([t.NotifyPropertyChanges],n)}(t.Base),Xi=function(){return function(e,t){this.formulaCorrection=!1,this.message=e,this.formulaCorrection=t}}(),Ki=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}(),$i=function(){return function(){this.isSheetMember=!1,this.parentObjectToToken=new Map,this.sheetDependentCells=new Map,this.sheetDependentFormulaCells=new Map,this.sheetNameToParentObject=new Map,this.sheetNameToToken=new Map,this.tokenToParentObject=new Map,this.sheetFormulaInfotable=new Map}}(),Ji=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.setValue=function(e){e=e},this}}(),Zi=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(){this.addEventListener(),this.initCalculate(),this.registerSheet()},r.prototype.destroy=function(){this.removeEventListener(),this.calculateInstance.dispose(),this.calculateInstance=null,this.parent=null},r.prototype.addEventListener=function(){this.parent.on(pt,this.performFormulaOperation,this),this.parent.on(Ct,this.aggregateComputation,this)},r.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(pt,this.performFormulaOperation),this.parent.off(Ct,this.aggregateComputation))},r.prototype.getModuleName=function(){return"workbookFormula"},r.prototype.initCalculate=function(){this.calculateInstance=new Yi(this.parent),this.calcID=this.calculateInstance.createSheetFamilyID(),this.calculateInstance.setTreatEmptyStringAsZero(!0),this.calculateInstance.grid=this.parent.getActiveSheet().id.toString()},r.prototype.performFormulaOperation=function(e){var t=e.action,r=this.calculateInstance.getLibraryFormulas(),n=Array.from(r.values());switch(t){case"getLibraryFormulas":e.formulaCollection=Array.from(r.keys());break;case"getFormulaCategory":for(var i=["All"],o=1;o<Array.from(r.values()).length;o++)i.indexOf(n[o].category)<0&&i.push(n[o].category);e.categoryCollection=i;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);break;case"registerSheet":this.registerSheet(e.sheetIndex,e.sheetCount),e.isImport&&this.updateSheetInfo();break;case"unRegisterSheet":this.unRegisterSheet(e.sheetIndex,e.sheetCount);break;case"refreshCalculate":e.value=this.autoCorrectFormula(e.value),this.refreshCalculate(e.rowIndex,e.colIndex,e.value,e.isFormula,e.sheetIndex);break;case"getArgumentSeparator":e.argumentSeparator=this.calculateInstance.getParseArgumentSeparator();break;case"addDefinedName":e.isAdded=this.addDefinedName(e.definedName);break;case"removeDefinedName":e.isRemoved=this.removeDefinedName(e.definedName,e.scope);break;case"initiateDefinedNames":this.initiateDefinedNames();break;case"renameUpdation":this.renameUpdation(e.value,e.sheetId);break;case"addSheet":this.sheetInfo.push({visibleName:e.visibleName,sheet:e.sheetName,index:e.index});break;case"getSheetInfo":e.sheetInfo=this.sheetInfo;break;case"deleteSheetTab":var s=this.sheetInfo.length;for(o=0;o<s;o++)if(this.sheetInfo[o].index===e.index){e.sheetName=this.sheetInfo[o].sheet,this.sheetInfo.splice(o,1);break}this.calculateInstance.unregisterGridAsSheet((e.index-1).toString(),e.index),this.calculateInstance.tokenCount=this.calculateInstance.tokenCount-1,this.sheetDeletion(e.sheetName,e.index,e.index);break;case"getReferenceError":e.refError=this.referenceError();break;case"getAlpha":e.col=M(e.col);break;case"addCustomFunction":this.addCustomFunction(e.functionHandler,e.functionName);break;case"computeExpression":e.calcValue=this.calculateInstance.computeExpression(e.formula);break;case"registerGridInCalc":this.calculateInstance.grid=e.sheetID;break;case"refreshInsDelFormula":this.refreshInsDelFormula(e.insertArgs);break;case"refreshNamedRange":this.refreshNamedRange(e.insertArgs,t)}},r.prototype.referenceError=function(){return this.calculateInstance.getErrorStrings()[e.CommonErrors.ref]},r.prototype.getSheetInfo=function(){return this.sheetInfo},r.prototype.addCustomFunction=function(e,t){this.calculateInstance.defineFunction(t,e)},r.prototype.updateSheetInfo=function(){var e=this;this.sheetInfo=[],this.parent.sheets.forEach(function(t,r){e.sheetInfo.push({visibleName:t.name,sheet:"Sheet"+t.id,index:r})})},r.prototype.sheetDeletion=function(e,r,n){var i,o,s=[],a=null,l="";this.calculateInstance.getDependentCells().forEach(function(e,t){s.push(t)}),this.removeSheetTokenIndex(l,n);for(var h=0;h<s.length;h++)for(var p=this.calculateInstance.getDependentCells().get(s[h]),d=0;d<p.length;d++)a=this.calculateInstance.getFormulaInfoTable().get(p[d]),r=parseInt(p[d].split("!")[1],10)+1,!t.isNullOrUndefined(a)&&r>-1&&(l=a.formulaText).toUpperCase().indexOf(e.toUpperCase())>-1&&(l=l.toUpperCase().split(e.toUpperCase()+this.calculateInstance.sheetToken).join(this.referenceError()),i=this.calculateInstance.rowIndex(p[d]),o=this.calculateInstance.colIndex(p[d]),this.updateDataContainer([i-1,o-1],{value:l,sheetId:r,visible:!1}),this.calculateInstance.refresh(a.getParsedFormula())),e.split("Sheet")[1]===s[h].split("!")[1]&&(this.calculateInstance.getFormulaInfoTable().delete(s[h]),this.calculateInstance.clearFormulaDependentCells(s[h]))},r.prototype.removeSheetTokenIndex=function(e,t){var r=this.calculateInstance.getSheetFamilyItem(this.calculateInstance.grid);return r.sheetNameToToken.delete(t.toString()),r.sheetNameToParentObject.delete(t.toString()),r.parentObjectToToken.delete(t.toString()),r.tokenToParentObject.delete("!"+(t-1).toString()+"!"),e},r.prototype.renameUpdation=function(e,t){var r,n,i,o=[],s="",a=[],l=!1;this.calculateInstance.getDependentCells().forEach(function(e,t){o.push(t)});for(var h=0;h<this.sheetInfo.length;h++)if(this.sheetInfo[h].index===t){this.sheetInfo[h].visibleName=e;break}var p=this.sheetInfo;for(h=0;h<o.length;h++)for(var d=this.calculateInstance.getDependentCells().get(o[h]),c=0;c<d.length;c++){s=this.calculateInstance.getFormulaInfoTable().get(d[c]).formulaText;for(var u=0;u<p.length;u++)if(p[u].visibleName!==p[u].sheet){var f=p[u].sheet.toUpperCase();s.toUpperCase().indexOf(f)>-1&&(s=s.toUpperCase().split(f).join(u+"/"),a.push(u),l=!0)}if(l){for(var g=0;g<a.length;g++)s=s.split(a[g].toString()+"/").join(p[a[g]].visibleName);r=this.calculateInstance.rowIndex(d[c]),n=this.calculateInstance.colIndex(d[c]),i=he(this.parent,"Sheet"+(parseInt(d[c].split("!")[1],10)+1),this.sheetInfo),this.updateDataContainer([r-1,n-1],{value:s,sheetId:i,visible:!0})}}},r.prototype.updateDataContainer=function(e,r){for(var n,i,o,s=e[0],a=e[1],l=this.parent.sheets.length,h=0;h<l;h++)if(this.parent.sheets[h].id===r.sheetId){n=this.parent.sheets[h].rows;break}t.isNullOrUndefined(r)||(s in n?a in(i=n[s]).cells?((o=i.cells[a]).formula=r.value,o.value=r.visible?o.value:this.referenceError()):i.cells[a]=o={}:(i=n[s]={})[a]=o={})},r.prototype.parseSheetRef=function(e){var t,r=new RegExp("[!@#$%^&()+=';,.{}|\":<>~_-]","g"),n=0,i=this.parent.sheets.length,o=[];o.length=0;var s=this.getSheetInfo(),a='(?=[\'!])(?=[^"]*(?:"[^"]*"[^"]*)*$)';for(n=0;n<i;n++)s[n].sheet!==s[n].visibleName&&(t=new RegExp(s[n].visibleName.replace(r,"\\$&")+a,"gi"),e.match(t)&&(e=e.replace(t,n+"/"),o.push(n)));for(n=0;n<o.length;)t=new RegExp(o[n]+"/"+a,"gi"),e=e.replace(t,s[o[n]].sheet),n++;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=de(this.parent,e).id+"",this.calculateInstance.registerGridAsSheet(r,r,this.calcID),e++},r.prototype.unRegisterSheet=function(e,t){void 0===e&&(e=0),void 0===t&&(t=this.parent.sheets.length);var r;for(this.calculateInstance.tokenCount=0;e<t;)r=de(this.parent,e).id+"",this.calculateInstance.unregisterGridAsSheet(r,r),e++},r.prototype.refreshCalculate=function(e,r,n,i,o){void 0===o&&(o=this.parent.activeSheetIndex);var s=de(this.parent,o).id+"";if(i){n=this.parseSheetRef(n);var a=new Ji(e+1,r+1,n);this.calculateInstance.valueChanged(s,a,!0);var l=this.calculateInstance.randCollection;if(!0===this.calculateInstance.isRandomVal){var h=void 0,p=void 0,d="";if(this.calculateInstance.randomValues.size>1&&this.calculateInstance.randomValues.size===l.length)for(var c=0;c<this.calculateInstance.randomValues.size;c++){h=this.calculateInstance.rowIndex(l[c]),p=this.calculateInstance.colIndex(l[c]),d=this.calculateInstance.randomValues.get(l[c]),s=(parseFloat(this.calculateInstance.getSheetToken(l[c]).split(this.calculateInstance.sheetToken).join(""))+1).toString();var u=new Ji(h,p,d);this.calculateInstance.valueChanged(s,u,!0)}}}else{var f=this.calculateInstance.getSheetFamilyItem(s),g=m(r+1)+(e+1);f.isSheetMember&&!t.isNullOrUndefined(f.parentObjectToToken)&&(g=f.parentObjectToToken.get(s)+g),this.calculateInstance.getFormulaInfoTable().has(g)&&(this.calculateInstance.getFormulaInfoTable().delete(g),this.calculateInstance.getDependentCells().has(g)&&this.calculateInstance.clearFormulaDependentCells(g)),this.calculateInstance.getComputedValue().clear(),this.calculateInstance.refresh(g),this.calculateInstance.refreshRandValues(g)}this.calculateInstance.cell=""},r.prototype.autoCorrectFormula=function(e){return t.isNullOrUndefined(e)||2===(e=e.toString()).split("(").length&&e.indexOf(")")<0&&(e+=")"),e},r.prototype.initiateDefinedNames=function(){for(var e=this.parent.definedNames,t=0;t<e.length;){var r=e[t],n=y(this.parseSheetRef(r.refersTo)),i=!1;if(n=n.split("$").join(""),(n=n.split("=").join("")).indexOf(":")>-1){var o=n.split(":");V(o[0])&&V(o[1])&&(i=!0)}else n.indexOf(":")<0&&V(n)&&(i=!0);i?this.addDefinedName(r,!0):(this.removeDefinedName(r.name,r.scope),t--),t++}},r.prototype.addDefinedName=function(e,t){var r,n=!0,i=e.name;if(e.refersTo.indexOf("!")<0){var o=ge(this.parent);o=-1!==o.indexOf(" ")?"'"+o+"'":o,e.refersTo=o+"!"+(e.refersTo.indexOf("=")<0?e.refersTo:e.refersTo.split("=")[1])}var s=e.refersTo,a=this.parseSheetRef(e.refersTo);return e.scope?(r=se(this.parent,e.scope))>-1&&(i=ge(this.parent,r)+"!"+i):e.scope="",e.comment||(e.comment=""),!t&&this.checkIsNameExist(e.name,e.scope)?n=!1:(this.calculateInstance.addNamedRange(i,"="===a[0]?a.substr(1):a),"="!==a[0]&&(e.refersTo="="+s),this.parent.definedNames.indexOf(e)<0&&this.parent.definedNames.push(e)),n},r.prototype.removeDefinedName=function(e,t){var r=!1,n=this.getIndexFromNameColl(e,t);if(n>-1){var i=e;if(t){var o=se(this.parent,t);o&&(i=ge(this.parent,o)+"!"+e)}this.calculateInstance.removeNamedRange(i),this.parent.definedNames.splice(n,1),r=!0}return r},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,r,n=this.parent.getActiveSheet(),i=n.selectedRange,o=d(i.split(":")[1]),s=["SUM","AVERAGE","MIN","MAX"],a=[];o[0]+1===n.rowCount&&o[1]+1===n.colCount&&(i="A1:"+f(n.usedRange.rowIndex,n.usedRange.colIndex));var l,h=d(n.activeCell),p=n.rows[h[0]]&&n.rows[h[0]].cells?n.rows[h[0]].cells[h[1]]:{},c=p?p.format:"",u=this.calculateInstance.getCellCollection(i);for(t=0;t<u.length;t++)if(l=this.calculateInstance.getValueFromArg(u[t]),F(l)){e.countOnly=!1;break}if(e.Count=this.calculateInstance.getFunction("COUNTA")(i),e.Count&&!e.countOnly){for(t=0;t<4;t++){var g={formattedText:r=this.toFixed(this.calculateInstance.getFunction(s[t])(i)),value:r,format:c,onLoad:!0};c&&(this.parent.notify(nt,g),r=g.formattedText),a.push(r)}e.Sum=a[0],e.Avg=a[1],e.Min=a[2],e.Max=a[3]}},r.prototype.clearFormula=function(e){this.parent.activeSheetIndex===e.sheetIdx&&(e.rowIdx="Row"===e.type?"insert"===e.status?e.rowIdx>=e.startIdx?e.rowIdx-e.count:e.rowIdx:e.rowIdx+e.count:e.rowIdx,e.colIdx="Column"===e.type?"insert"===e.status?e.colIdx>=e.startIdx?e.colIdx-e.count:e.colIdx:e.colIdx+e.count:e.colIdx);var t="!"+e.sheetIdx+"!"+M(-1===e.colIdx?e.colIdx+2:e.colIdx+1)+(-1===e.rowIdx?e.rowIdx+2:e.rowIdx+1);this.calculateInstance.getFormulaInfoTable().delete(t),this.calculateInstance.clearFormulaDependentCells(t)},r.prototype.refreshFormula=function(e,t,r,n,i,o){var s,a,l,h,p,c,u,f=e,m=[],v=this.parent.getActiveSheet(),y=[],C=[];if(P(f)){if("delete"===r)for(h=1;h<=t;h++)y.push(i+h);for(C=this.parseFormula(f),h=0;h<C.length;h++)if(p=C[h].trim(),this.calculateInstance.isCellReference(p)){if((u=h&&C[h-1].trim())&&"!"===u[u.length-1]){if((u=u.replace(/['!]/g,""))!==v.name)continue}else if(0===parseInt(u,10)&&void 0===u[u.length-1]&&v.id-1!==o)continue;m=d(p),s="Column"===n?"insert"===r?m[3]+t:m[3]-t:"insert"===r?m[2]+t:m[2]-t,a="Column"===n?"insert"===r?m[1]+t:m[1]-t:"insert"===r?m[0]+t:m[0]-t,a="Column"===n?i>m[1]?m[1]:a:i>m[0]?m[0]:a,s="Column"===n?i>m[3]?m[3]:s:i>m[2]?m[2]:s,l=a>-1?"Column"===n?g([m[0],a,m[2],s]).split(":")[0]:g([a,m[1],s,m[3]]).split(":")[0]:"#REF!","delete"===r&&(c=parseInt("Row"===n?p.replace(/[A-Z]/g,""):p.replace(/[0-9]/g,""),10),y.indexOf(c)>-1&&(l="#REF!")),C[h]=l}f="="+C.join("")}return f},r.prototype.refreshInsDelFormula=function(e){var t,r,n,i,o,s,a=this.parent.sheets.length;for(o=0;o<a;o++){t=e.model.length;for(var l=(n=[0,0,(r=this.parent.sheets[o]).usedRange.rowIndex,r.usedRange.colIndex])[2];l>=n[0];l--)for(var h=n[1];h<=n[3];h++)(i=j(l,h,r))&&i.formula&&P(i.formula)&&(this.clearFormula({rowIdx:l,colIdx:h,sheetIdx:o,count:t,status:e.name,type:e.modelType,startIdx:e.startIndex}),s=this.refreshFormula(i.formula,t,e.name,e.modelType,e.startIndex,o),this.parent.notify(dt,{action:"updateCellValue",address:[l,h,l,h],value:s,sheetIndex:o}))}},r.prototype.parseFormula=function(e){var t,r,n,i=0,o=[],s=[];for(n=(s=(s=this.markSpecialChar(e.replace("=",""))).split(/\(|\)|=|\^|>|<|,|:|\+|-|\*|\/|%|&/g)).length;i<n;)(t=s[i])?(1===t.length?o.push(this.isUniqueChar(t)?this.getUniqueCharVal(t):t):(r=t[0],t.indexOf("!")>0?(this.isUniqueChar(r)&&(o.push(this.getUniqueCharVal(r)),t=t.substr(1)),r=t.indexOf("!")+1,o.push(t.substr(0,r)),o.push(t.substr(r))):this.isUniqueChar(r)?(o.push(this.getUniqueCharVal(r)),o.push(t.substr(1))):o.push(t)),i++):i++;return o},r.prototype.getUniqueCharVal=function(e){switch(e){case this.uniqueOBracket:return"(";case this.uniqueCBracket:return")";case this.uniqueCSeparator:return",";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){return e=e.replace(/\(/g,"("+this.uniqueOBracket).replace(/\)/g,")"+this.uniqueCBracket),e=e.replace(/,/g,","+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,t){for(var r,n,i,o,s,a,l,h,p,c,u=!1,f=this.parent.definedNames,m=Object.assign({},f),v=f.length,y=0;y<v;y++){if(r=m[y],n=m[y].refersTo.split("!")[1],i=d(n),p=r.refersTo.split("!")[0].split("=")[1],c=se(this.parent,p.replace(/'/g,"")),de(this.parent,c),c===this.parent.activeSheetIndex&&("insert"===e.name?(o=e.model.length,s=e.index,a=e.index+o,"Row"===e.modelType?i[0]>=a||i[0]>=s&&i[2]>=a?(l=[i[0]+o,i[1],i[2]+o,i[3]],u=!0):(i[0]<=s&&i[2]>=s||i[2]>=a)&&(l=[i[0],i[1],i[2]+o,i[3]],u=!0):"Column"===e.modelType&&(i[1]>=a||i[1]>=s&&i[3]>=a?(l=[i[0],i[1]+o,i[2],i[3]+o],u=!0):(i[1]<=s&&i[3]>=s||i[3]>=a)&&(l=[i[0],i[1],i[2],i[3]+o],u=!0))):(o=e.deletedModel.length,s=e.startIndex,a=e.endIndex,"Row"===e.modelType?i[0]>=a||i[0]>=s&&i[2]>=a?(l=[i[0]-o,i[1],i[2]-o,i[3]],u=!0):(i[0]<=s&&i[2]>=s||i[2]>=a)&&(l=[i[0],i[1],i[2]-o,i[3]],u=!0):"Column"===e.modelType&&(i[1]>=a||i[1]>=s&&i[3]>=a?(l=[i[0],i[1]-o,i[2],i[3]-o],u=!0):(i[1]<=s&&i[3]>=s||i[3]>=a)&&(l=[i[0],i[1],i[2],i[3]-o],u=!0))),u)){h=g(l),r.refersTo=p+"!"+h,this.parent.removeDefinedName(r.name,r.scope);var C={action:"addDefinedName",definedName:r,isAdded:!1};this.parent.notify(pt,C)}f=m}},r}(),Qi=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(bt,this.initiateSortHandler,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off(bt,this.initiateSortHandler)},e.prototype.initiateSortHandler=function(e){var n=this,i=e.args,o=new r.Deferred,s=this.parent.getActiveSheet(),a=S(v(i.range)),l=i.sortOptions||{sortDescriptors:{},containsHeader:!0},h=!1;if(e.promise=o.promise,a[0]>s.usedRange.rowIndex||a[1]>s.usedRange.colIndex)o.reject(this.parent.serviceLocator.getService(Eo).getConstant("SortOutOfRangeError"));else{var p=l.containsHeader;a[0]===a[2]&&a[2]-a[0]==0&&(a[0]=0,a[1]=0,a[2]=s.usedRange.rowIndex,a[3]=s.usedRange.colIndex,h=!0,p=!!t.isNullOrUndefined(l.containsHeader)||l.containsHeader),!t.isNullOrUndefined(i.sortOptions)&&!t.isNullOrUndefined(i.sortOptions.containsHeader)||h||t.isNullOrUndefined(j(a[0],a[1],s))||t.isNullOrUndefined(j(a[0]+1,a[1],s))||(p=typeof j(a[0],a[1],s).value!=typeof j(a[0]+1,a[1],s).value);var d,u,f=a[0]=p?a[0]+1:a[0],y=m(c(s.activeCell)[1]+1),C=l.sortDescriptors,b=g(a);G(this.parent,s.name+"!"+b,!0).then(function(e){var t=new r.DataManager(e),h=new r.Query;if(Array.isArray(C)){C&&0!==C.length||(C=[{field:y}]);for(var p=C.length,c=p-1;c>-1;c--)if(C[p-1].field||(C[p-1].field=y),C[c].field){var g=C[c].sortComparer||n.sortComparer.bind(n,C[c],l.caseSensitive);h.sortBy(C[c].field,g)}}else{C||(C={field:y}),C.field||(C.field=y);g=C.sortComparer||n.sortComparer.bind(n,C,l.caseSensitive);h.sortBy(C.field,g)}t.executeQuery(h).then(function(t){var r,n={};Array.prototype.forEach.call(t.result,function(t,i){if(t)for(d=a[1],u=a[3],f=parseInt(e[i].__rowIndex,10)-1;d<=u;d++)r=m(d+1),n=t[r],q(f,d,s,n)});var l={range:s.name+"!"+b,sortOptions:i.sortOptions};o.resolve(l)})})}},e.prototype.sortComparer=function(e,t,n,i){var o=e.order||"",s=r.DataUtil.fnSort(o),a={sensitivity:t?"case":"base"};if(n&&i&&"string"==typeof n.value){var l=new Intl.Collator(this.parent.locale,a);return o&&"ascending"!==o.toLowerCase()?-1*l.compare(n.value,i.value):l.compare(n.value,i.value)}return s(n?n.value:n,i?i.value:i)},e.prototype.getModuleName=function(){return"workbookSort"},e}(),eo=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.destroy=function(){this.removeEventListener(),this.filterRange=null,this.parent=null},e.prototype.addEventListener=function(){this.parent.on(Rt,this.initiateFilterHandler,this),this.parent.on(Ft,this.clearAllFilterHandler,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(Rt,this.initiateFilterHandler),this.parent.off(Ft,this.clearAllFilterHandler))},e.prototype.initiateFilterHandler=function(e){var t=this,n=e.args,i=new r.Deferred,o=this.parent.getActiveSheet(),s=n.filterOptions||{};if(e.promise=i.promise,this.filterRange=n.range,s.datasource){this.setFilter(s.datasource,s.predicates);var a={range:n.range,filterOptions:s};i.resolve(a)}else{var l=S(v(n.range));if(l[0]>o.usedRange.rowIndex||l[1]>o.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]=o.usedRange.colIndex),l[2]=o.usedRange.rowIndex,l[0]=l[0]+1;var h=g(l);G(this.parent,o.name+"!"+h,!0,!0).then(function(e){var n=new r.DataManager(e);t.setFilter(n,s.predicates);var o={range:h,filterOptions:s};i.resolve(o)})}},e.prototype.setFilter=function(e,t){var n=this;if(e&&t){var i=e.dataSource.json,o=new r.Query;t.length&&o.where(r.Predicate.and(t));var s=e.executeLocal(o);i.forEach(function(e,t){e&&n.parent.hideRow(parseInt(e.__rowIndex,10)-1,void 0,s.indexOf(e)<0)})}},e.prototype.clearAllFilterHandler=function(){if(this.filterRange){var e=c(this.filterRange),t=this.parent.getActiveSheet();this.parent.hideRow(e[0],t.usedRange.rowIndex-1,!1)}},e.prototype.getModuleName=function(){return"workbookFilter"},e}(),to=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.setImage=function(e){var t,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?se(this.parent,e.range.split("!")[0]):this.parent.activeSheetIndex,i=d(r),o=n?this.parent.sheets[n]:this.parent.getActiveSheet(),s=j(i[0],i[1],o),a=e.options;if(s&&s.image){t=s.image;for(var l=0;l<a.length;l++)t.push(a[l])}q(i[0],i[1],o,{image:s&&s.image?t:a},!0)},e.prototype.addEventListener=function(){this.parent.on(yr,this.setImage,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off(yr,this.setImage)},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.getModuleName=function(){return"workbookImage"},e}(),ro=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.format=function(e){var t,r,n=e.range;n&&"string"==typeof n&&n.indexOf("!")>-1?(n=n.split("!")[1],t=this.parent.sheets[se(this.parent,e.range.split("!")[0])]):t=this.parent.getActiveSheet(),void 0===n&&(n=t.selectedRange);var i="object"!=typeof n&&e.onActionUpdate;if(r={range:n,style:e.style,requestType:"CellFormat"},i&&(this.parent.trigger("beforeCellFormat",r),this.parent.notify("actionBegin",{eventArgs:r,action:"format"}),r.cancel))e.cancel=!0;else{var o="object"==typeof r.range?r.range:S(d(r.range));if(e.borderType&&(this.setTypedBorder(t,e.style.border,o,e.borderType,e.onActionUpdate),delete e.style.border),void 0!==r.style.borderTop){for(var s=o[1];s<=o[3];s++)this.checkAdjustantBorder(t,"borderBottom",o[0]-1,s),this.checkFullBorder(t,"borderBottom",o[0]-1,s),this.checkFullBorder(t,"borderTop",o[0],s),this.setCellBorder(t,{borderTop:r.style.borderTop},o[0],s,e.onActionUpdate,s===o[3]);delete r.style.borderTop}if(void 0!==r.style.borderBottom){for(s=o[1];s<=o[3];s++)this.checkAdjustantBorder(t,"borderTop",o[2]+1,s),this.checkFullBorder(t,"borderTop",o[2]+1,s),this.checkFullBorder(t,"borderBottom",o[2],s),this.setCellBorder(t,{borderBottom:r.style.borderBottom},o[2],s,e.onActionUpdate,s===o[3]),this.setBottomBorderPriority(t,o[2],s);delete r.style.borderBottom}if(void 0!==r.style.borderLeft){for(s=o[0];s<=o[2];s++)this.checkAdjustantBorder(t,"borderRight",s,o[1]-1),this.checkFullBorder(t,"borderRight",s,o[1]-1),this.checkFullBorder(t,"borderLeft",s,o[1]),this.setCellBorder(t,{borderLeft:r.style.borderLeft},s,o[1],e.onActionUpdate);delete r.style.borderLeft}if(void 0!==r.style.borderRight){for(s=o[0];s<=o[2];s++)this.checkAdjustantBorder(t,"borderLeft",s,o[3]-1),this.checkFullBorder(t,"borderLeft",s,o[3]-1),this.checkFullBorder(t,"borderRight",s,o[3]),this.setCellBorder(t,{borderRight:r.style.borderRight},s,o[3],e.onActionUpdate);delete r.style.borderRight}var a,l;if(Object.keys(e.style).length)for(s=o[0];s<=o[2];s++)for(var h=o[1];h<=o[3];h++)void 0===l&&(void 0!==r.style.border?(a=r.style.border,r.style.border=void 0,l=!0):l=!1),l&&this.setFullBorder(t,a,o,s,h,e.onActionUpdate),this.setCellStyle(t,s,h,r.style),this.parent.getActiveSheet().id===t.id&&this.parent.notify(lt,{style:r.style,rowIdx:s,colIdx:h,lastCell:h===o[3],isHeightCheckNeeded:!0,manualUpdate:!0,onActionUpdate:e.onActionUpdate});l&&(r.style.border=a),this.parent.setUsedRange(o[2],o[3]),e.refreshRibbon&&this.parent.notify(ft,null),i&&(r.range=t.name+"!"+n,this.parent.notify("actionComplete",{eventArgs:r,action:"format"}))}},e.prototype.setBottomBorderPriority=function(e,t,r){if(J(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,o){var s={};n===r[0]&&(this.checkAdjustantBorder(e,"borderBottom",n-1,i),this.checkFullBorder(e,"borderBottom",n-1,i)),i===r[1]&&(this.checkAdjustantBorder(e,"borderRight",n,i-1),this.checkFullBorder(e,"borderRight",n,i-1)),i===r[3]?(this.checkAdjustantBorder(e,"borderLeft",n,i+1),this.checkFullBorder(e,"borderLeft",n,i+1)):this.checkAdjustantBorder(e,"border",n,i+1),s.borderRight=t,s.borderTop=t,s.borderLeft=t,s.borderBottom=t,this.setCellBorder(e,s,n,i,o,i===r[3]),n===r[2]?(this.checkAdjustantBorder(e,"borderTop",n+1,i),this.checkFullBorder(e,"borderTop",n+1,i),this.setBottomBorderPriority(e,n,i)):this.checkAdjustantBorder(e,"border",n+1,i)},e.prototype.checkAdjustantBorder=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 o={border:void 0};["borderBottom","borderTop","borderLeft","borderRight"].forEach(function(e){e!==t&&(o[e]=i)}),this.setCellStyle(e,r,n,o)}},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=S(d(t.selectedRange)),o=e.style.textDecoration,s=o,a=d(t.activeCell),l=this.parent.getCellStyleValue(["textDecoration"],a).textDecoration,h=!1;"underline"===l?s="underline"===o?"none":"underline line-through":"line-through"===l?s="line-through"===o?"none":"underline line-through":"underline line-through"===l&&(s="underline"===o?"line-through":"underline",h=!0),"none"===s&&(h=!0),this.format({style:{textDecoration:s},range:a,refreshRibbon:e.refreshRibbon,onActionUpdate:!0});for(var p=i[0];p<=i[2];p++)for(var c=i[1];c<=i[3];c++)if(p!==a[0]||c!==a[1]){if(n={},"none"===(l=this.parent.getCellStyleValue(["textDecoration"],[p,c]).textDecoration)){if(h)continue;n.textDecoration=o}else if("underline"===l||"line-through"===l)if(h){if(o!==l)continue;n.textDecoration="none"}else n.textDecoration=o!==l?"underline line-through":o;else if("underline line-through"===l){if(!h)continue;n.textDecoration="underline"===o?"line-through":"underline"}this.format({style:n,range:[p,c,p,c],refreshRibbon:e.refreshRibbon,onActionUpdate:!0})}r.range=t.name+"!"+r.range,this.parent.notify("actionComplete",{eventArgs:r,action:"format"})}},e.prototype.setTypedBorder=function(e,t,r,n,i){var o;if("Outer"===n){for(var s=r[1];s<=r[3];s++)this.checkAdjustantBorder(e,"borderBottom",r[0]-1,s),this.checkFullBorder(e,"borderBottom",r[0]-1,s),this.setCellBorder(e,{borderTop:t},r[0],s,i,s===r[3]),this.checkAdjustantBorder(e,"borderTop",r[2]+1,s),this.checkFullBorder(e,"borderTop",r[2]+1,s),this.setCellBorder(e,{borderBottom:t},r[2],s,i,s===r[3]),this.setBottomBorderPriority(e,r[2],s);for(var a=r[0];a<=r[2];a++)this.checkAdjustantBorder(e,"borderRight",a,r[1]-1),this.checkFullBorder(e,"borderRight",a,r[1]-1),this.setCellBorder(e,{borderLeft:t},a,r[1],i),this.checkAdjustantBorder(e,"borderLeft",a,r[3]+1),this.checkFullBorder(e,"borderLeft",a,r[3]+1),this.setCellBorder(e,{borderRight:t},a,r[3],i)}else if("Inner"===n)for(var l=r[0];l<=r[2];l++)for(var h=r[1];h<=r[3];h++){var p={};""!==(o=this.parent.getCellStyleValue(["border"],[l,h]).border)&&(p.border=void 0,h!==r[3]&&h!==r[1]&&l!==r[0]&&l!==r[2]||(l===r[0]&&(p.borderTop=o),l===r[2]&&(p.borderBottom=o),h===r[3]&&(p.borderRight=o),h===r[1]&&(p.borderLeft=o))),h!==r[3]&&(p.borderRight=t),l!==r[0]&&(p.borderTop=t),l!==r[2]&&(p.borderBottom=t),h!==r[1]&&(p.borderLeft=t),this.setCellBorder(e,p,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++){p={borderRight:t,borderLeft:t};h===r[1]&&(this.checkAdjustantBorder(e,"borderRight",l,h-1),this.checkFullBorder(e,"borderRight",l,h-1)),h===r[3]&&(this.checkAdjustantBorder(e,"borderLeft",l,h+1),this.checkFullBorder(e,"borderLeft",l,h+1)),this.setCellBorder(e,p,l,h,i)}else for(l=r[0];l<=r[2];l++)for(h=r[1];h<=r[3];h++){p={borderTop:t,borderBottom:t};l===r[0]&&(this.checkAdjustantBorder(e,"borderBottom",l-1,h),this.checkFullBorder(e,"borderBottom",l-1,h)),this.setCellBorder(e,p,l,h,i,h===r[3]),l===r[2]&&(this.checkAdjustantBorder(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,o){this.setCellStyle(e,r,n,t),this.parent.getActiveSheet().id===e.id&&this.parent.notify(lt,{style:t,rowIdx:r,colIdx:n,onActionUpdate:i,first:"",lastCell:o,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++,J(e,t)&&(t=this.skipHiddenRows(e,t)),t},e.prototype.addEventListener=function(){this.parent.on(ot,this.format,this),this.parent.on(at,this.textDecorationActionUpdate,this),this.parent.on(gr,this.clearCellObj,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(ot,this.format),this.parent.off(at,this.textDecorationActionUpdate),this.parent.off(gr,this.clearCellObj))},e.prototype.clearCellObj=function(e){for(var t,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?se(this.parent,e.range.split("!")[0]):this.parent.activeSheetIndex,o=de(this.parent,i),s=v(n),a=s[0],l=s[2];a<=l;a++)for(t=s[1],r=s[3];t<=r;t++){var h=j(a,t,o);if(h)switch(e.type){case"Clear Formats":delete h.format,delete h.rowSpan,delete h.style,delete h.wrap,delete h.colSpan;break;case"Clear Contents":delete h.value,delete h.formula;break;case"Clear Hyperlinks":delete h.hyperlink;break;case"Clear All":q(a,t,o,{},!1)}}},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.getModuleName=function(){return"workbookcellformat"},e}(),no=function(){function e(e){this.parent=e,this.localeObj=t.getNumericObject(this.parent.locale),this.decimalSep=this.localeObj.decimal,this.addEventListener()}return e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.addEventListener=function(){this.parent.on(dt,this.performEditOperation,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off(dt,this.performEditOperation)},e.prototype.getModuleName=function(){return"workbookEdit"},e.prototype.performEditOperation=function(e){switch(e.action){case"updateCellValue":this.updateCellValue(e.address,e.value,e.sheetIndex,e.isValueOnly)}},e.prototype.checkDecimalPoint=function(e){if(Number(e)){var t=e.toString().indexOf(this.decimalSep)+1;e=e.toString().substr(t).length<=6?t<7?e:parseFloat(e).toFixed(0):t>7?parseFloat(e).toFixed(0):parseFloat(e).toFixed(6-t+2)}return e},e.prototype.updateCellValue=function(e,r,n,i){void 0===i&&(i=!1),void 0===n&&(n=this.parent.activeSheetIndex);var o;o="string"==typeof e?d(e):e;var s=de(this.parent,n);s.rows[o[0]]||(s.rows[o[0]]={},s.rows[o[0]].cells=[]),s.rows[o[0]].cells||(s.rows[o[0]].cells=[]),s.rows[o[0]].cells[o[1]]||(s.rows[o[0]].cells[o[1]]={});var a=j(o[0],o[1],s);if(i)r.toString().indexOf(this.decimalSep)>-1&&(r=this.checkDecimalPoint(r)),a.value=r;else{var l=P(r);l||(a.formula="",a.value=r);var h={action:"refreshCalculate",value:r,rowIndex:o[0],colIndex:o[1],sheetIndex:n,isFormula:l};this.parent.notify(pt,h),l&&(a.formula=h.value,r=a.value);var p={value:r,rowIndex:o[0],colIndex:o[1],sheetIndex:n,updatedVal:""};this.parent.notify(ct,p),!t.isNullOrUndefined(p.updatedVal)&&p.updatedVal.length>0&&(a.value=p.updatedVal)}this.parent.setUsedRange(o[0]+1,o[1])},e}(),io=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(kt,this.setLinkHandler,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off(kt,this.setLinkHandler)},e.prototype.setLinkHandler=function(e){var r,n,i,o,s=e.hyperlink,a=e.cell,l=this.parent.getActiveSheet();if(a&&-1!==a.indexOf("!")){r=a.split("!");for(var h=this.parent.sheets,p=0;p<h.length;p++)h[p].name===r[0]&&(n=p);l=this.parent.sheets[n],a=r[1]}var c=(i=d(a=a||this.parent.getActiveSheet().activeCell))[0],u=i[1];l&&(t.isNullOrUndefined(l.rows[c])&&(l.rows[c]={}),t.isNullOrUndefined(l.rows[c].cells)&&(l.rows[c].cells=[]),t.isNullOrUndefined(l.rows[c].cells[u])&&(l.rows[c].cells[u]={}),"string"==typeof s?(0!==s.indexOf("http://")&&0!==s.indexOf("https://")&&0!==s.indexOf("ftp://")&&(o=s=0===s.indexOf("www.")?"http://"+s:s),l.rows[c].cells[u].hyperlink=s):(0!==(o=s.address).indexOf("http://")&&0!==o.indexOf("https://")&&0!==o.indexOf("ftp://")&&(o=0===o.indexOf("www.")?"http://"+o:o),l.rows[c].cells[u].hyperlink={address:o}))},e.prototype.getModuleName=function(){return"workbookHyperlink"},e}(),oo=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.insertModel=function(e){var t,r,n,i,o,s=this,a=[];if("number"==typeof e.start){i=e.start,e.end=e.end||i,i>e.end&&(i=e.end,e.end=e.start);for(var l=i;l<=e.end;l++)a.push({})}else e.start?(i=e.start[0].index||0,a=e.start):(i=0,a.push({}));if("Row"===e.modelType){e.model=e.model,e.model.rows||(e.model.rows=[]),(t=e.model.rows).splice.apply(t,[i,0].concat(a)),i>e.model.usedRange.rowIndex?this.parent.setUsedRange(i+(a.length-1),e.model.usedRange.colIndex):this.parent.setUsedRange(e.model.usedRange.rowIndex+a.length,e.model.usedRange.colIndex);var h=i+a.length;for(l=0;l<=e.model.usedRange.colIndex;l++)e.model.rows[h]&&e.model.rows[h].cells[l]&&void 0!==e.model.rows[h].cells[l].rowSpan&&e.model.rows[h].cells[l].rowSpan<0&&void 0===e.model.rows[h].cells[l].colSpan&&this.parent.notify(lr,{range:[h,l,h,l],insertCount:a.length,insertModel:"Row"})}else if("Column"===e.modelType){e.model=e.model,e.model.columns||(e.model.columns=[]),(r=e.model.columns).splice.apply(r,[i,0].concat(a)),i>e.model.usedRange.colIndex?this.parent.setUsedRange(e.model.usedRange.rowIndex,i+(a.length-1)):this.parent.setUsedRange(e.model.usedRange.rowIndex,e.model.usedRange.colIndex+a.length),e.model.rows||(e.model.rows=[]);var p=[];e.columnCellsModel||(e.columnCellsModel=[]);for(l=0;l<a.length;l++)p.push({});o=[];for(l=0;l<=e.model.usedRange.rowIndex;l++){e.model.rows[l]?e.model.rows[l].cells||(e.model.rows[l].cells=[]):e.model.rows[l]={cells:[]},i&&!e.model.rows[l].cells[i-1]&&(e.model.rows[l].cells[i-1]={}),(n=e.model.rows[l].cells).splice.apply(n,[i,0].concat(e.columnCellsModel[l]&&e.columnCellsModel[l].cells?e.columnCellsModel[l].cells:p));h=i+a.length;e.model.rows[l].cells[h]&&void 0!==e.model.rows[l].cells[h].colSpan&&e.model.rows[l].cells[h].colSpan<0&&void 0===e.model.rows[l].cells[h].rowSpan&&o.push({range:[l,h,l,h],insertCount:p.length,insertModel:"Column"})}o.forEach(function(e){s.parent.notify(lr,e)})}else{if(void 0!==e.checkCount&&e.checkCount===this.parent.sheets.length)return;this.parent.createSheet(i,a);var d;e.activeSheetIndex&&this.parent.setProperties({activeSheetIndex:e.activeSheetIndex},!0),a.forEach(function(e){d=e.id,s.parent.notify(pt,{action:"addSheet",visibleName:e.name,sheetName:"Sheet"+d,index:d})})}var c={action:"refreshNamedRange",insertArgs:{model:a,index:i,modelType:e.modelType,isAction:e.isAction,activeSheetIndex:e.activeSheetIndex,sheetCount:this.parent.sheets.length,name:"insert"}},u={action:"refreshInsDelFormula",insertArgs:{model:a,startIndex:e.start,endIndex:e.end,modelType:e.modelType,name:"insert",activeSheetIndex:e.activeSheetIndex,sheetCount:this.parent.sheets.length}};"Column"!==e.modelType&&"Row"!==e.modelType||(this.parent.notify(pt,c),this.parent.notify(pt,u)),this.parent.notify(Dt,{model:a,index:i,modelType:e.modelType,isAction:e.isAction,activeSheetIndex:e.activeSheetIndex,sheetCount:this.parent.sheets.length})},e.prototype.setInsertInfo=function(e,t,r,n,i){void 0===i&&(i="Row");var o=r=t+(r-1);e.ranges.forEach(function(e){e.info&&t<e.info[n]&&(e.info["insert"+i+"Range"]?e.info["insert"+i+"Range"].push([t,o]):e.info["insert"+i+"Range"]=[[t,o]],e.info[n]+=o-t+1)})},e.prototype.addEventListener=function(){this.parent.on(Ht,this.insertModel,this)},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off(Ht,this.insertModel)},e.prototype.getModuleName=function(){return"workbookinsert"},e}(),so=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.deleteModel=function(e){var t=this,r=e.modelType.toLowerCase()+"s";if(e.start=e.start,e.start>e.end){var n=e.start;e.start=e.end,e.end=n}var i,o,s=[],a=e.end-e.start+1;if("Row"===e.modelType){if(e.model=e.model,e.start>e.model.usedRange.rowIndex)return;e.end>e.model.usedRange.rowIndex&&(e.end-=e.end-e.model.usedRange.rowIndex),e.model.usedRange.rowIndex-=e.end-e.start+1,e.model.usedRange.rowIndex<0&&(e.model.usedRange.rowIndex=0),this.parent.notify(ht,{index:e.model.usedRange.rowIndex,update:"row"});var l=e.end+1,h=void 0,p=void 0;if(e.model.rows[e.start]&&e.model.rows[e.start].cells)for(var d=0;d<=e.model.usedRange.colIndex;d++){if(e.model.rows[e.start].cells[d]&&void 0!==e.model.rows[e.start].cells[d].rowSpan&&e.model.rows[e.start].cells[d].rowSpan<0&&void 0===e.model.rows[e.start].cells[d].colSpan&&(p={range:[e.start,d,e.start,d]},this.parent.notify(ar,p),p.range=p.range,p.range[2]<=e.end&&((o=j(p.range[0],d,e.model))&&o.rowSpan>1&&(o.rowSpan-(p.range[2]-e.start+1)>1?q(p.range[0],d,e.model,{colSpan:o.rowSpan-(p.range[2]-e.start+1)},!0):delete e.model.rows[p.range[0]].cells[d].rowSpan),p=null)),e.model.rows[l].cells&&e.model.rows[l].cells[d]&&void 0!==e.model.rows[l].cells[d].rowSpan&&e.model.rows[l].cells[d].rowSpan<0&&void 0===e.model.rows[l].cells[d].colSpan&&(p||(p={range:[l,d,l,d]},this.parent.notify(ar,p)),h=new Object,p.range=p.range,Object.assign(h,j(p.range[0],p.range[1],e.model)),h&&h.rowSpan&&(h.rowSpan>1||h.colSpan>1))){(u=[])[1]=d,u[3]=h.colSpan>1?d+(h.colSpan-1):d,p.range=p.range,p.range[0]<e.start?(u[0]=u[2]=p.range[0],h.rowSpan-a>1&&(u[2]+=h.rowSpan-a-1)):(u[0]=u[2]=e.start,h.rowSpan-(e.end-p.range[0]+1)>1&&(u[2]+=h.rowSpan-(e.end-p.range[0]+1)-1)),s.push({range:u,isAction:!1,preventRefresh:!0,merge:!0,type:"All",skipChecking:!0})}p=null}}else if("Column"===e.modelType){if(e.model=e.model,e.start>e.model.usedRange.colIndex)return;e.end>e.model.usedRange.colIndex&&(e.end-=e.end-e.model.usedRange.colIndex),e.model.usedRange.colIndex-=a,e.model.usedRange.colIndex<0&&(e.model.usedRange.colIndex=0),this.parent.notify(ht,{index:e.model.usedRange.colIndex,update:"col"}),i=[];for(l=e.end+1,h=void 0,p=void 0,d=0;d<=e.model.usedRange.rowIndex;d++)if(i.push({}),e.model.rows[d]&&e.model.rows[d].cells){if(e.model.rows[d].cells[e.start]&&void 0!==e.model.rows[d].cells[e.start].colSpan&&e.model.rows[d].cells[e.start].colSpan<0&&void 0===e.model.rows[d].cells[e.start].rowSpan&&(p={range:[d,e.start,d,e.start]},this.parent.notify(ar,p),p.range=p.range,p.range[3]<=e.end)){var c=j(d,p.range[1],e.model);c&&c.colSpan>1&&(c.colSpan-(p.range[3]-e.start+1)>1?q(d,p.range[1],e.model,{colSpan:c.colSpan-(p.range[3]-e.start+1)},!0):delete e.model.rows[d].cells[p.range[1]].colSpan),p=null}if(e.model.rows[d].cells[l]&&void 0!==e.model.rows[d].cells[l].colSpan&&e.model.rows[d].cells[l].colSpan<0&&void 0===e.model.rows[d].cells[l].rowSpan&&(p||(p={range:[d,l,d,l]},this.parent.notify(ar,p)),h=new Object,p.range=p.range,Object.assign(h,j(p.range[0],p.range[1],e.model)),h&&h.colSpan&&(h.colSpan>1||h.rowSpan>1))){var u;(u=[])[0]=d,u[2]=h.rowSpan>1?d+(h.rowSpan-1):d,p.range=p.range,p.range[1]<e.start?(u[1]=u[3]=p.range[1],h.colSpan-a>1&&(u[3]+=h.colSpan-a-1)):(u[1]=u[3]=e.start,h.colSpan-(e.end-p.range[1]+1)>1&&(u[3]+=h.colSpan-(e.end-p.range[1]+1)-1)),s.push({range:u,isAction:!1,preventRefresh:!0,merge:!0,type:"All",skipChecking:!0})}i[d].cells=e.model.rows[d].cells.splice(e.start,a),p=null}}var f=[];for(d=e.start;d<=e.end;d++)e.model[r][e.start]?(f.push(e.model[r][e.start]),e.model[r].splice(e.start,1)):f.push({}),d===e.start&&(f[0].index=e.start);s.forEach(function(e){t.parent.notify(ir,e)}),se(this.parent,e.model.name);var g={action:"refreshNamedRange",insertArgs:{startIndex:e.start,endIndex:e.end,modelType:e.modelType,isAction:e.isAction,deletedModel:f,deletedCellsModel:i,activeSheetIndex:this.parent.activeSheetIndex,name:"delete"}},m={action:"refreshInsDelFormula",insertArgs:{model:f,startIndex:e.start,endIndex:e.end,modelType:e.modelType,name:"delete",activeSheetIndex:e.activeSheetIndex,sheetCount:this.parent.sheets.length}};this.parent.notify(pt,g),this.parent.notify(pt,m),this.parent.notify(Lt,{startIndex:e.start,endIndex:e.end,modelType:e.modelType,isAction:e.isAction,deletedModel:f,deletedCellsModel:i,activeSheetIndex:this.parent.activeSheetIndex})},e.prototype.setDeleteInfo=function(e,t,r,n){void 0===n&&(n="Row");var i=t-e+1,o=[];this.parent.getActiveSheet().ranges.forEach(function(s){s.info&&e<s.info[r]&&(s.info["delete"+n+"Range"]?s.info["delete"+n+"Range"].push([e,t]):s.info["delete"+n+"Range"]=[[e,t]],s.info[r]-=i,s.info["insert"+n+"Range"]&&(s.info["insert"+n+"Range"]=o))})},e.prototype.addEventListener=function(){this.parent.on(Bt,this.deleteModel,this)},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off(Bt,this.deleteModel)},e.prototype.getModuleName=function(){return"workbookdelete"},e}(),ao=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(_t,this.addValidationHandler,this),this.parent.on(Xt,this.removeValidationHandler,this),this.parent.on(Pt,this.addHighlightHandler,this),this.parent.on(Kt,this.removeHighlightHandler,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(_t,this.addValidationHandler),this.parent.off(Xt,this.removeValidationHandler),this.parent.off(Pt,this.addHighlightHandler),this.parent.off(Kt,this.removeHighlightHandler))},e.prototype.addValidationHandler=function(e){this.ValidationHandler(e.rules,e.range,!1)},e.prototype.removeValidationHandler=function(e){this.ValidationHandler(e.rules,e.range,!0)},e.prototype.ValidationHandler=function(e,t,r){for(var n,i=this.parent.getActiveSheet(),o=d(t=t||i.selectedRange),s=o[0];s<=o[2];s++){i.rows[s]||$(i,s,{});for(var a=o[1];a<=o[3];a++)if(i.rows[s].cells&&i.rows[s].cells[a]||q(s,a,i,{}),n=i.rows[s].cells[a],r){if(n.validation){delete n.validation;var l=this.parent.getCellStyleValue(["backgroundColor","color"],[s,a]);this.parent.notify(lt,{style:l,rowIdx:s,colIdx:a})}}else n.validation={type:e.type,operator:e.operator,value1:"List"===e.type&&e.value1.length>256?e.value1.substring(0,255):e.value1,value2:e.value2,ignoreBlank:e.ignoreBlank,inCellDropDown:e.inCellDropDown}}},e.prototype.addHighlightHandler=function(e){this.InvalidDataHandler(e.range,!1)},e.prototype.removeHighlightHandler=function(e){this.InvalidDataHandler(e.range,!0)},e.prototype.InvalidDataHandler=function(e,t){for(var r,n,i=this.parent.getActiveSheet(),o=(e=e||i.selectedRange)?d(e):[],s=e?o[0]:0,a=e?o[2]:i.rows.length;s<=a;s++)if(i.rows[s])for(var l=e?o[1]:0,h=e?o[3]:i.rows[s].cells.length;l<=h;l++)if(i.rows[s].cells[l]){n=(r=i.rows[s].cells[l]).value?r.value:"";var p=[s,l],c=this.parent.activeSheetIndex;if(r.validation&&this.parent.allowDataValidation){this.parent.notify(Mt,{value:n,range:p,sheetIdx:c,isCell:!1});var u=this.parent.allowDataValidation;if(this.parent.allowDataValidation=!0,!u)if(t){if(t){var f=this.parent.getCellStyleValue(["backgroundColor","color"],[s,l]);this.parent.notify(lt,{style:f,rowIdx:s,colIdx:l})}}else this.parent.notify(lt,{style:{backgroundColor:"#ffff00",color:"#ff0000"},rowIdx:s,colIdx:l})}}},e.prototype.getModuleName=function(){return"workbookDataValidation"},e}(),lo=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(Vt,this.findNext,this),this.parent.on(Ut,this.findPrevious,this),this.parent.on(qt,this.replace,this),this.parent.on(zt,this.replaceAll,this),this.parent.on("count",this.totalCount,this),this.parent.on(st,this.findAllValues,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(Vt,this.findNext),this.parent.off(Ut,this.findPrevious),this.parent.off(qt,this.replace),this.parent.off(zt,this.replaceAll),this.parent.off("count",this.totalCount),this.parent.off(st,this.findAllValues))},e.prototype.findNext=function(e){var t,r,n,i=this.parent.sheets,o=(e.sheetIndex,i[this.parent.activeSheetIndex]),s=c(o.activeCell),a=o.usedRange,l=a.colIndex,h=e.value.toString(),p=0,d=a.rowIndex,u=t=s[1],f=r=s[0];if(o.rows[r]&&o.rows[r].cells[t])if(o.rows[r].cells[t].format){n=this.parent.getDisplayText(o.rows[r].cells[t]).toString()}else n=o.rows[r].cells[t].value.toString();if(n){var g=n.toLowerCase(),m=n.indexOf(e.value)>-1,v=g.indexOf(e.value)>-1;(h===n||h===g||m||v)&&("By Column"===e.searchBy?r++:t++,p++)}(s[0]>o.usedRange.rowIndex||s[1]>o.usedRange.colIndex)&&(s[0]>o.usedRange.rowIndex&&s[1]<=o.usedRange.colIndex?(r=0,t=s[1]):s[0]<=o.usedRange.rowIndex&&s[1]>o.usedRange.colIndex?(r=s[0],t=0):(r=0,t=0));var y={rowIndex:r,colIndex:t,usedRange:a,endRow:d,endColumn:l,startRow:f,mode:e.mode,loopCount:0,count:p,args:e,val:void 0,stringValue:h,sheetIndex:this.parent.activeSheetIndex,startColumn:u,sheets:i};"By Row"===e.searchBy&&this.findNxtRow(y),"By Column"===e.searchBy&&this.findNxtCol(y)},e.prototype.findNxtRow=function(e){var t,r=e.sheets[e.sheetIndex],n=this.parent.sheets.length,i=c(r.activeCell);for(e.colIndex>=e.usedRange.colIndex+1&&(e.colIndex=0,e.rowIndex++),e.rowIndex;e.rowIndex<=e.endRow+1;e.rowIndex++){if(e.rowIndex>e.endRow){if("Workbook"===e.mode){var o=this.parent.activeSheetIndex;if(e.sheetIndex++,n===e.sheetIndex&&(e.sheetIndex=0),o===e.sheetIndex&&0===e.count)return void this.parent.notify(Wt,null);t=(r=e.sheets[e.sheetIndex]).usedRange,i=c(r.activeCell),e.rowIndex=0,e.colIndex=0,e.endColumn=t.colIndex,e.endRow=t.rowIndex}if(0===e.colIndex&&e.rowIndex>e.endRow)if(0===i[0]&&0===i[1]||i[0]>r.usedRange.rowIndex||i[1]>r.usedRange.colIndex){if(0===e.count)return void this.parent.notify(Wt,null)}else(0!==i[0]&&0!==i[1]||0!==i[0]||0!==i[1])&&(e.startColumn=0,e.startRow=0,e.endColumn=e.usedRange.colIndex,e.endRow=i[0],e.rowIndex=e.startRow,e.colIndex=e.startColumn,e.loopCount++)}if(e.count>0&&e.usedRange.rowIndex<e.rowIndex&&(e.rowIndex=0,0===e.rowIndex&&(e.colIndex=0)),r.rows[e.rowIndex]){var s=r.rows[e.rowIndex];for(e.colIndex;e.colIndex<=e.endColumn;e.colIndex++)if(s&&s.cells[e.colIndex]){if(this.nextCommon(e))return}if(e.colIndex>e.endColumn&&(e.colIndex=0),e.loopCount>0&&i[0]===e.rowIndex)return void this.parent.notify(Wt,null)}}0!==e.count||this.parent.notify(Wt,null)},e.prototype.findNxtCol=function(e){var t,r=e.sheets[e.sheetIndex],n=c(r.activeCell),i=this.parent.sheets.length;for(e.rowIndex>=e.usedRange.rowIndex&&(e.rowIndex=0,e.colIndex++),e.colIndex;e.colIndex<=e.usedRange.colIndex+1;e.colIndex++){if(e.colIndex>=e.endColumn+1&&"Workbook"===e.mode){if(t=this.parent.activeSheetIndex,e.sheetIndex++,i===e.sheetIndex&&(e.sheetIndex=0),t===e.sheetIndex&&0===e.count)return void this.parent.notify(Wt,null);r=e.sheets[e.sheetIndex],e.usedRange=r.usedRange,n=c(r.activeCell),e.colIndex=0,e.rowIndex=0,e.endColumn=e.usedRange.colIndex,e.endRow=e.usedRange.rowIndex}if(e.colIndex>=e.endColumn+1&&(e.colIndex=0),e.rowIndex>e.endRow&&0===e.colIndex)if(0===n[0]&&0===n[1]||n[1]>r.usedRange.rowIndex||n[0]>r.usedRange.colIndex){if(0===e.count)return void this.parent.notify(Wt,null)}else(0!==n[1]||0!==n[0]||0!==n[1]&&0!==n[0])&&(e.startRow=0,e.startColumn=0,e.endRow=n[0],e.endColumn=e.usedRange.colIndex,e.colIndex=e.startColumn,e.rowIndex=e.startRow,e.loopCount++);if(e.count>0&&e.usedRange.colIndex+1<e.colIndex&&(e.colIndex=0,e.rowIndex=0),e.rowIndex>=e.endRow&&(e.rowIndex=0),e.colIndex<=e.usedRange.colIndex){for(e.rowIndex;e.rowIndex<=e.usedRange.rowIndex;e.rowIndex++)if(r.rows[e.rowIndex]&&r.rows[e.rowIndex].cells[e.colIndex]){if(this.nextCommon(e))return}if(e.loopCount>0&&n[1]===e.colIndex)return void this.parent.notify(Wt,null)}}0!==e.count||this.parent.notify(Wt,null)},e.prototype.nextCommon=function(e){var t=e.sheets[e.sheetIndex];if(t.rows[e.rowIndex]&&t.rows[e.rowIndex].cells[e.colIndex]){var r=t.rows[e.rowIndex].cells[e.colIndex];if(r){var n=void 0;if(r.format){n=this.parent.getDisplayText(t.rows[e.rowIndex].cells[e.colIndex])}else n=t.rows[e.rowIndex].cells[e.colIndex].value.toString();if(e.args.isCSen&&e.args.isEMatch){if(n===e.stringValue){var i=t.name+"!"+f(e.rowIndex,e.colIndex);return this.parent.notify(jt,{address:i}),e.count++,!0}}else if(e.args.isCSen&&!e.args.isEMatch){var o=n.indexOf(e.args.value)>-1;if(n===e.stringValue||o){i=t.name+"!"+f(e.rowIndex,e.colIndex);return this.parent.notify(jt,{address:i}),e.count++,!0}}else if(!e.args.isCSen&&e.args.isEMatch){if(e.val=n.toString().toLowerCase(),e.val===e.stringValue){i=t.name+"!"+f(e.rowIndex,e.colIndex);return this.parent.notify(jt,{address:i}),e.count++,!0}}else if(!e.args.isCSen&&!e.args.isEMatch){e.val=n.toString().toLowerCase();o=n.indexOf(e.args.value)>-1;var s=e.val.indexOf(e.args.value)>-1;if(e.val===e.stringValue||n===e.stringValue||o||n===e.stringValue||s){i=t.name+"!"+f(e.rowIndex,e.colIndex);return this.parent.notify(jt,{address:i}),e.count++,!0}}}}return!1},e.prototype.findPrevious=function(e){var t,r=this.parent.sheets,n=e.sheetIndex,i=r[n],o=c(i.activeCell),s=0,a=i.usedRange.rowIndex,l=i.usedRange.colIndex,h=e.value.toString(),p=o[1],d=o[0],u=p,f=d;if(i.rows[d]&&i.rows[d].cells[p])if(i.rows[d].cells[p].format){t=this.parent.getDisplayText(i.rows[d].cells[p]).toString()}else t=i.rows[d].cells[p].value.toString();if(t){var g=t.toLowerCase(),m=t.indexOf(e.value)>-1,v=g.indexOf(e.value)>-1;(h===t||h===g||m||v)&&("By Row"===e.searchBy&&p--,"By Column"===e.searchBy&&d--,s++)}(o[0]>i.usedRange.rowIndex||o[1]>i.usedRange.colIndex)&&(o[0]>i.usedRange.rowIndex&&o[1]<=i.usedRange.colIndex?(d=i.usedRange.rowIndex,p=o[1]):o[0]<=i.usedRange.rowIndex&&o[1]>i.usedRange.colIndex?(d=o[0],p=i.usedRange.colIndex):(d=i.usedRange.rowIndex,p=i.usedRange.colIndex));var y={rowIndex:d,colIndex:p,endRow:a,endColumn:l,startRow:f,loopCount:0,count:s,args:e,val:void 0,stringValue:h,sheets:r,sheetIndex:n,startColumn:u};"By Row"===e.searchBy&&this.findPreRow(y),"By Column"===e.searchBy&&this.findPreCol(y)},e.prototype.findPreRow=function(e){var t,r=e.sheets[e.sheetIndex],n=this.parent.sheets.length,i=!1,o=c(r.activeCell);for(-1===e.colIndex&&(e.colIndex=e.endColumn,e.rowIndex--),e.rowIndex;e.rowIndex>=-1;e.rowIndex--){if(e.rowIndex<0&&e.colIndex<0){if("Workbook"===e.args.mode){var s=this.parent.activeSheetIndex;if(e.sheetIndex--,-1===e.sheetIndex&&(e.sheetIndex=n-1),s===e.sheetIndex&&0===e.count)return void this.parent.notify(Wt,null);t=(r=e.sheets[e.sheetIndex]).usedRange,o=c(r.activeCell),e.rowIndex=t.rowIndex,e.colIndex=t.colIndex,e.endColumn=0,e.endRow=0}i=this.commonCondition(e,o)}if(!i&&("Workbook"!==e.args.mode&&e.count>0&&-1===e.rowIndex&&(e.rowIndex=e.endRow),-1===e.rowIndex&&(e.rowIndex=r.usedRange.rowIndex,e.colIndex=r.usedRange.colIndex),r.rows[e.rowIndex])){for(-1===e.colIndex&&(e.colIndex=r.usedRange.colIndex),e.colIndex;e.colIndex>=0;e.colIndex--)if(r.rows[e.rowIndex]&&r.rows[e.rowIndex].cells[e.colIndex]){if(this.prevCommon(e))return}if(e.loopCount>0&&o[0]===e.rowIndex)return void this.parent.notify(Wt,null)}}i||0!==e.count||this.parent.notify(Wt,null)},e.prototype.findPreCol=function(e){var t,r=e.sheets[e.sheetIndex],n=this.parent.sheets.length,i=!1,o=c(r.activeCell);for(e.colIndex;e.colIndex>=-1;e.colIndex--){if(e.rowIndex<0&&e.colIndex<0){if("Workbook"===e.args.mode){var s=this.parent.activeSheetIndex;if(e.sheetIndex--,-1===e.sheetIndex&&(e.sheetIndex=n-1),s===e.sheetIndex&&0===e.count)return void this.parent.notify(Wt,null);t=(r=e.sheets[e.sheetIndex]).usedRange,o=c(r.activeCell),e.rowIndex=t.rowIndex,e.colIndex=t.colIndex,e.endColumn=0,e.endRow=0}i=this.commonCondition(e,o)}if(!i)for(e.count>0&&e.colIndex<0&&(e.colIndex=e.endColumn),e.rowIndex<0&&(e.rowIndex=r.usedRange.rowIndex),e.colIndex<-1&&(e.colIndex=r.usedRange.colIndex,e.rowIndex--),r.rows[e.rowIndex]&&r.rows[e.rowIndex].cells[e.colIndex]&&-1===e.rowIndex&&(e.rowIndex=r.usedRange.rowIndex),e.rowIndex;e.rowIndex>=0;e.rowIndex--){if(r.rows[e.rowIndex]&&r.rows[e.rowIndex].cells[e.colIndex]){if(this.prevCommon(e))return}if(e.loopCount>0&&o[1]===e.colIndex)return void this.parent.notify(Wt,null)}}i||0!==e.count||this.parent.notify(Wt,null)},e.prototype.commonCondition=function(e,t){var r,n=e.sheets[e.sheetIndex];return t[0]!==e.endRow&&t[1]!==e.endColumn||t[0]!==e.endRow||t[1]!==e.endColumn?(e.startColumn=n.usedRange.colIndex,e.startRow=n.usedRange.rowIndex,e.endColumn=0,e.endRow=t[0],e.rowIndex=e.startRow,e.colIndex=e.startColumn,e.loopCount++,r=!1):(t[0]===n.usedRange.rowIndex&&t[1]===n.usedRange.colIndex||t[0]>n.usedRange.rowIndex||t[1]>n.usedRange.colIndex)&&(this.parent.notify(Wt,null),r=!0),r},e.prototype.prevCommon=function(e){var t=e.sheets[e.sheetIndex];if(t.rows[e.rowIndex]&&t.rows[e.rowIndex].cells[e.colIndex]){var r=t.rows[e.rowIndex].cells[e.colIndex];if(r){var n=void 0;if(r.format){n=this.parent.getDisplayText(t.rows[e.rowIndex].cells[e.colIndex])}else n=t.rows[e.rowIndex].cells[e.colIndex].value.toString();if(e.args.isCSen&&e.args.isEMatch){if(n===e.stringValue){var i=t.name+"!"+f(e.rowIndex,e.colIndex);return this.parent.notify(jt,{address:i}),e.count++,!0}}else if(e.args.isCSen&&!e.args.isEMatch){var o=n.indexOf(e.args.value)>-1;if(n===e.stringValue||o){i=t.name+"!"+f(e.rowIndex,e.colIndex);return this.parent.notify(jt,{address:i}),e.count++,!0}}else if(!e.args.isCSen&&e.args.isEMatch){if(e.val=n.toString().toLowerCase(),e.val===e.stringValue){i=t.name+"!"+f(e.rowIndex,e.colIndex);return this.parent.notify(jt,{address:i}),e.count++,!0}}else if(!e.args.isCSen&&!e.args.isEMatch){e.val=n.toString().toLowerCase();o=n.indexOf(e.args.value)>-1;var s=e.val.indexOf(e.args.value)>-1;if(n===e.stringValue||n===e.stringValue||o||e.val===e.stringValue||s){i=t.name+"!"+f(e.rowIndex,e.colIndex);return this.parent.notify(jt,{address:i}),e.count++,!0}}}}return!1},e.prototype.replace=function(e){if(this.parent.getActiveSheet().isProtected)this.parent.notify("editAlert",null);else{var t=this.parent.getActiveSheet(),r=c(t.activeCell),n=t.rows[r[0]].cells[r[1]].value.toString(),i=n.indexOf(e.value)>-1,o=n.toLowerCase().indexOf(e.value)>-1,s=n.toString().toLowerCase();n===e.value||i||s===e.value||o||(e.findOpt="next",this.findNext(e)),this.parent.getActiveSheet();var a,l=c(t.activeCell),h=t.activeCell,p=t.rows[l[0]].cells[l[1]],d=t.rows[l[0]].cells[l[1]].format,u=t.name+"!"+f(l[0],l[1]);if(d){a=this.parent.getDisplayText(t.rows[l[0]].cells[l[1]]).toString()}else a=t.rows[l[0]].cells[l[1]].value.toString();var g={undoRedoOpt:"before",address:u,compareVal:a};this.parent.notify(Gt,g);var m=a.toLowerCase(),v=a.indexOf(e.value)>-1,y=m.indexOf(e.value)>-1;if(e.value===a||e.value===m){t.rows[l[0]].cells[l[1]].value=e.replaceValue,this.parent.updateCell(p,h);var C={address:u,compareVal:e.replaceValue,undoRedoOpt:"after"};this.parent.notify(Gt,C)}else if(v){var b=a.replace(e.value,e.replaceValue);t.rows[l[0]].cells[l[1]].value=b,this.parent.updateCell(p,h);var S={address:u,compareVal:e.replaceValue,undoRedoOpt:"after"};this.parent.notify(Gt,S)}else if(y){var x=new RegExp(e.value.toString().replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"ig"),w=a.replace(x,e.replaceValue);t.rows[l[0]].cells[l[1]].value=w,this.parent.updateCell(p,h);var I={address:u,compareVal:e.replaceValue,undoRedoOpt:"after"};this.parent.notify(Gt,I)}}},e.prototype.replaceAll=function(e){for(var t,r=0,n=this.parent.sheets[r],i=n.usedRange.rowIndex,o=0,s=0,a=n.usedRange.colIndex,l=0,h=[];s<=i;s++)if(l>a&&s===i&&"Workbook"===e.mode&&(r++,(n=this.parent.sheets[r])&&(l=0,s=0,a=n.usedRange.colIndex,i=n.usedRange.rowIndex,n=n)),n&&n.rows[s]){var p=n.rows[s];for(l===a+1&&(l=0);l<=a;l++){var d=n.rows[s].cells[l];if(p&&p.cells[l]){var c=n.rows[s].cells[l];if(c){var u=void 0;if(c.format){u=this.parent.getDisplayText(n.rows[s].cells[l]).toString()}else u=n.rows[s].cells[l].value.toString();if(e.isCSen&&e.isEMatch)u===e.value&&(n.rows[s].cells[l].value=e.replaceValue,t=n.name+"!"+f(s,l),this.parent.updateCell(d,t),h.push(t),o++);else if(e.isCSen&&!e.isEMatch){var g=u.indexOf(e.value)>-1;if(u===e.value||g){var m=u.replace(e.value,e.replaceValue);n.rows[s].cells[l].value=m,t=n.name+"!"+f(s,l),this.parent.updateCell(d,t),h.push(t),o++}}else if(!e.isCSen&&e.isEMatch){(v=u.toString().toLowerCase())===e.value&&(n.rows[s].cells[l].value=e.replaceValue,t=n.name+"!"+f(s,l),this.parent.updateCell(d,t),h.push(t),o++)}else if(!e.isCSen&&!e.isEMatch){var v=u.toString().toLowerCase(),y=(g=u.indexOf(e.value)>-1,v.indexOf(e.value)>-1);if(u===e.value||g||v===e.value||u===e.value||y){var C=new RegExp(e.value.toString().replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"ig");m=u.replace(C,e.replaceValue);n.rows[s].cells[l].value=m,t=n.name+"!"+f(s,l),this.parent.updateCell(d,t),h.push(t),o++}}}}}}var b={undoRedoOpt:"beforeReplaceAll",Collection:h,replaceValue:e.value};this.parent.notify(Gt,b),b={undoRedoOpt:"afterReplaceAll",Collection:h,replaceValue:e.replaceValue},this.parent.notify(Gt,b);var S=o;this.parent.notify(er,{count:S,replaceValue:e.replaceValue})},e.prototype.totalCount=function(e){for(var t=this.parent.sheets[0],r=t.usedRange.rowIndex,n=0,i=0,o=t.usedRange.colIndex,s=0;i<=r;i++)if(t.rows[i]){var a=t.rows[i];for(s===o+1&&(s=0);s<=o;s++)if(a&&a.cells[s]){var l=t.rows[i].cells[s];if(l){var h=void 0;if(l.format){h=this.parent.getDisplayText(t.rows[i].cells[s]).toString()}else h=l.value.toString();if(e.isCSen&&e.isEMatch)h===e.value&&n++;else if(e.isCSen&&!e.isEMatch){var p=h.indexOf(e.value)>-1;(h===e.value||p)&&n++}else if(!e.isCSen&&e.isEMatch){(d=h.toString().toLowerCase())===e.value&&n++}else if(!e.isCSen&&!e.isEMatch){var d=h.toString().toLowerCase(),c=(p=h.indexOf(e.value)>-1,d.indexOf(e.value)>-1);(d===e.value||h===e.value||p||h===e.value||c)&&n++}}}}var u=n;n=u-(this.requiredCount(e)-1),e.findCount=n+" of "+u},e.prototype.requiredCount=function(e){for(var t=this.parent.activeSheetIndex,r=this.parent.sheets[t],n=c(r.activeCell),i=r.usedRange.rowIndex,o=0,s=n[0],a=r.usedRange.colIndex,l=n[1];s<=i;s++)if(r.rows[s]){var h=r.rows[s];for(l===a+1&&(l=0);l<=a;l++)if(h&&h.cells[l]&&r.rows[s].cells[l]){var p=void 0;if(r.rows[s].cells[l].format){p=this.parent.getDisplayText(r.rows[s].cells[l]).toString()}else p=r.rows[s].cells[l].value.toString();if(e.isCSen&&!e.isEMatch){var d=p.indexOf(e.value)>-1;(p===e.value||d)&&o++}else if(e.isCSen&&e.isEMatch)p===e.value&&o++;else if(!e.isCSen&&e.isEMatch){(u=p.toString().toLowerCase())===e.value&&o++}else if(!e.isCSen&&!e.isEMatch){var u=p.toString().toLowerCase(),f=(d=p.indexOf(e.value)>-1,u.indexOf(e.value)>-1);(p===e.value||p===e.value||d||u===e.value||f)&&o++}}}return o},e.prototype.findAllValues=function(e){for(var r,n=e.sheetIndex,i=this.parent.sheets[n],o=i.usedRange.rowIndex,s=0,a=i.usedRange.colIndex,l=0,h=this.parent.sheets.length,p=e.sheetIndex;s<=o+1;s++){if(1!==p&&e.sheetIndex===h&&(n=1),s>o&&l>a&&"Workbook"===e.mode){if(n++,p===n)return void 0;n>h-1&&(n=0),(i=this.parent.sheets[n])&&(s=0,l=0,a=i.usedRange.colIndex,o=i.usedRange.rowIndex,i=i)}if(!t.isNullOrUndefined(i)&&i.rows[s]){var d=i.rows[s];for(l===a+2&&(l=0);l<=a+1;l++)if(d&&d.cells[l]){var c=i.rows[s].cells[l];if(c){var u=void 0;if(c.format){u=this.parent.getDisplayText(i.rows[s].cells[l]).toString()}else u=c.value.toString();if(e.isCSen&&e.isEMatch)u===e.value&&(r=i.name+"!"+f(s,l),e.findCollection.push(r),0);else if(e.isCSen&&!e.isEMatch){var g=u.indexOf(e.value)>-1;(u===e.value||g)&&(r=i.name+"!"+f(s,l),e.findCollection.push(r),0)}else if(!e.isCSen&&e.isEMatch){(m=u.toString().toLowerCase())===e.value&&(r=i.name+"!"+f(s,l),e.findCollection.push(r),0)}else if(!e.isCSen&&!e.isEMatch){var m=u.toString().toLowerCase();g=u.indexOf(e.value)>-1;(m===e.value||u===e.value||g||u===e.value)&&(r=i.name+"!"+f(s,l),e.findCollection.push(r),0)}}}}}},e.prototype.getModuleName=function(){return"workbookfindAndReplace"},e}(),ho=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.protectsheetHandler=function(e){var t=this.parent.getActiveSheet();t.protectSettings.selectCells=e.selectCells,t.protectSettings.formatCells=e.formatCells,t.protectSettings.formatColumns=e.formatColumns,t.protectSettings.formatRows=e.formatRows,t.protectSettings.insertLink=e.insertLink,this.parent.notify(Jt,t.protectSettings),this.parent.notify(Zt,{props:"Protect"})},e.prototype.unprotectsheetHandler=function(e){var t=this.parent.getActiveSheet();e.sheet&&(t=this.parent.sheets[e.sheet]),t.protectSettings.formatCells=t.protectSettings.formatColumns=!1,t.protectSettings.formatRows=t.protectSettings.selectCells=!1,t.isProtected=!1,this.parent.notify(Jt,t.protectSettings),this.parent.notify(Zt,{props:"Protect"})},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.addEventListener=function(){this.parent.on(Qt,this.protectsheetHandler,this),this.parent.on(tr,this.unprotectsheetHandler,this),this.parent.on(rr,this.lockCells,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(Qt,this.protectsheetHandler),this.parent.off(rr,this.lockCells),this.parent.off(Qt,this.unprotectsheetHandler))},e.prototype.lockCells=function(e){for(var t,r=this.parent.getActiveSheet(),n="object"==typeof(t=e?e.range:r.selectedRange)?t:S(d(t)),i=n[0];i<=n[2];i++)for(var o=n[1];o<=n[3];o++)this.parent.getActiveSheet().id===r.id&&this.parent.notify(nr,{rowIdx:i,colIdx:o,isLocked:e.isLocked})},e.prototype.getModuleName=function(){return"workbookProtectSheet"},e}(),po=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.merge=function(e){e.isAction&&(this.parent.notify("actionBegin",{eventArgs:e,action:"merge"}),e.model||(e.model=[])),"string"==typeof e.range&&(e.range=d(e.range)),e.range=S(e.range);var t=this.parent.getActiveSheet();e.skipChecking||this.mergedRange(e),e.merge&&"All"!==e.type?"Horizontally"===e.type?this.mergeHorizontally(e):"Vertically"===e.type&&this.mergeVertically(e):(this.mergeAll(e),e.refreshRibbon&&this.parent.notify(ft,null)),this.parent.setUsedRange(e.range[2],e.range[3]),e.isAction&&this.parent.notify("actionComplete",{eventArgs:e,action:"merge"}),this.parent.notify("selectRange",{indexes:d(t.selectedRange),skipChecking:!0})},e.prototype.mergeAll=function(e){var t,r=0;e.range=e.range;for(var n,i,o,s=this.parent.getActiveSheet(),a=e.range[0];a<=e.range[2];a++){n=0,e.isAction&&e.model.push({cells:[]});for(var l=e.range[1];l<=e.range[3];l++){if((t=j(a,l,s))&&(t.value||t.formula)&&!i&&(i=t.formula||t.value),e.isAction&&e.merge&&(e.model[a-e.range[0]].cells[l-e.range[1]]={},Object.assign(e.model[a-e.range[0]].cells[l-e.range[1]],t)),s.rows[a]&&s.rows[a].cells&&s.rows[a].cells[l]&&(delete s.rows[a].cells[l].rowSpan,delete s.rows[a].cells[l].colSpan,!e.merge&&!e.isAction&&e.model&&e.model[a-e.range[0]]&&e.model[a-e.range[0]].cells[l-e.range[1]]&&e.model[a-e.range[0]].cells[l-e.range[1]]!=={}&&q(a,l,s,e.model[a-e.range[0]].cells[l-e.range[1]])),e.merge){if(t=new Object,a===e.range[0]&&l===e.range[1]){e.range[3]-e.range[1]>0&&(t.colSpan=e.range[3]-e.range[1]+1),e.range[2]-e.range[0]>0&&(t.rowSpan=e.range[2]-e.range[0]+1),q(e.range[0],e.range[1],s,t,!0);continue}a!==e.range[0]&&(t.rowSpan=-r),l!==e.range[1]&&(n++,t.colSpan=-n),s.rows[a]&&s.rows[a].cells&&s.rows[a].cells[l]&&(delete s.rows[a].cells[l].value,delete s.rows[a].cells[l].formula),o=j(a,l,s)||{},q(a,l,s,Object.assign(t,o))}e.preventRefresh||this.parent.notify(or,{rowIdx:a,colIdx:l})}r++}e.merge&&(t=this.getCellValue(e.range[0],e.range[1],i),q(e.range[0],e.range[1],s,t,!0),e.preventRefresh||this.parent.notify(or,{rowIdx:e.range[0],colIdx:e.range[1]}))},e.prototype.mergeHorizontally=function(e){var t;e.range=e.range;for(var r,n,i,o,s=this.parent.getActiveSheet(),a=e.range[0];a<=e.range[2];a++){t=0,e.isAction&&e.model.push({cells:[]});for(var l=e.range[1];l<=e.range[3];l++){if(o=j(a,l,s),r=new Object,e.isAction&&(e.model[a-e.range[0]].cells[l-e.range[1]]={},Object.assign(e.model[a-e.range[0]].cells[l-e.range[1]],o)),l===e.range[1]){if(a===e.range[0])continue;i=a-1,s.rows[i]&&s.rows[i].cells&&s.rows[i].cells[l]&&delete s.rows[i].cells[l].rowSpan,r=this.getCellValue(i,l,n),e.range[3]-e.range[1]>0&&(r.colSpan=e.range[3]-e.range[1]+1),n=null,q(i,l,s,r,!0)}else o&&(o.value||o.formula)&&!n&&(n=o.formula||o.value),i=a,s.rows[i]&&s.rows[i].cells&&s.rows[i].cells[l]&&(delete s.rows[i].cells[l].rowSpan,delete s.rows[i].cells[l].value,delete s.rows[i].cells[l].formula),t++,r.colSpan=-t,q(i,l,s,r,!0);this.parent.notify(or,{rowIdx:i,colIdx:l})}}s.rows[e.range[2]]&&s.rows[e.range[2]].cells&&s.rows[e.range[2]].cells[e.range[1]]&&delete s.rows[e.range[2]].cells[e.range[1]].rowSpan,r=this.getCellValue(e.range[2],e.range[1],n),e.range[3]-e.range[1]>0&&(r.colSpan=e.range[3]-e.range[1]+1),q(e.range[2],e.range[1],s,r,!0),this.parent.notify(or,{rowIdx:e.range[2],colIdx:e.range[1]})},e.prototype.getCellValue=function(e,t,r){var n=this.parent.getActiveSheet(),i=new Object,o=j(e,t,n);return!r||o&&(o.value||o.formula)||(P(r)?i.formula=r:i.value=r),i},e.prototype.mergeVertically=function(e){var t=0;e.range=e.range;for(var r,n,i,o,s=this.parent.getActiveSheet(),a=e.range[1];a<=e.range[3];a++)for(var l=e.range[0];l<=e.range[2];l++){if(o=j(l,a,s),e.isAction&&(void 0===e.model[l-e.range[0]]&&(e.model[l-e.range[0]]={cells:[]}),e.model[l-e.range[0]].cells[a-e.range[1]]={},Object.assign(e.model[l-e.range[0]].cells[a-e.range[1]],o)),l===e.range[0]){if(t=0,a===e.range[1])continue;i=a-1,s.rows[l]&&s.rows[l].cells&&s.rows[l].cells[i]&&delete s.rows[l].cells[i].colSpan,r=this.getCellValue(l,i,n),e.range[2]-e.range[0]>0&&(r.rowSpan=e.range[2]-e.range[0]+1),n=null,q(l,i,s,r,!0)}else r=new Object,o&&(o.value||o.formula)&&!n&&(n=o.formula||o.value),t++,i=a,s.rows[l]&&s.rows[l].cells&&s.rows[l].cells[i]&&(delete s.rows[l].cells[i].colSpan,delete s.rows[l].cells[i].value,delete s.rows[l].cells[i].formula),r.rowSpan=-t,q(l,i,s,r,!0);this.parent.notify(or,{rowIdx:l,colIdx:i})}s.rows[e.range[0]]&&s.rows[e.range[0]].cells&&s.rows[e.range[0]].cells[e.range[3]]&&delete s.rows[e.range[0]].cells[e.range[3]].colSpan,r=this.getCellValue(e.range[0],e.range[1],n),e.range[2]-e.range[0]>0&&(r.rowSpan=e.range[2]-e.range[0]+1),q(e.range[0],e.range[3],s,r,!0),this.parent.notify(or,{rowIdx:e.range[0],colIdx:e.range[3]})},e.prototype.activeCellRange=function(e){e.range=e.range;var r=this.parent.getActiveSheet(),n=j(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=j(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=d(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=this.parent.getActiveSheet(),o=j(e.range[0],e.range[1],i),s=r=e.range[0],a=n=e.range[1];if(o&&(!t.isNullOrUndefined(o.rowSpan)&&o.rowSpan<0&&(s=r=e.range[0]+o.rowSpan),!t.isNullOrUndefined(o.colSpan)&&o.colSpan<0&&(a=n=e.range[1]+o.colSpan),(o=j(s,a,i))&&(o.rowSpan>1&&(r+=o.rowSpan-1,s+(o.rowSpan-1)>=e.range[2]&&(e.range[2]=e.range[0],e.range[2]=s+(o.rowSpan-1))),o.colSpan>1&&(n+=o.colSpan-1,a+(o.colSpan-1)>=e.range[3]&&(e.range[3]=e.range[1],e.range[3]=a+(o.colSpan-1))))),e.range[0]=s,e.range[1]=a,e.range[0]===s&&e.range[1]===a&&e.range[2]===r&&e.range[3]===n&&(e.isActiveCell=!0),!e.skipChecking){for(var l=e.range[1];l<=e.range[3];l++)(o=j(e.range[2],l,i))&&(s=e.range[2],a=l,!t.isNullOrUndefined(o.colSpan)&&o.colSpan<0&&(a+=o.colSpan)<e.range[1]&&(e.range[1]=a),!t.isNullOrUndefined(o.rowSpan)&&o.rowSpan<0&&(s+=o.rowSpan)<e.range[0]&&(e.range[0]=s),(o=j(s,a,i))&&(o.colSpan>1&&a+(o.colSpan-1)>e.range[3]&&(e.range[3]=a,e.range[3]=a+(o.colSpan-1)),o.rowSpan>1&&s+(o.rowSpan-1)>e.range[2]&&(e.range[2]=s,e.range[2]=s+(o.rowSpan-1))));var h,p;for(l=e.range[1];l<=e.range[3];l++)(o=j(e.range[0],l,i))&&(p=l,h=e.range[0],!t.isNullOrUndefined(o.colSpan)&&o.colSpan<0&&(p+=o.colSpan)<e.range[1]&&(e.range[1]=p),!t.isNullOrUndefined(o.rowSpan)&&o.rowSpan<0&&(h+=o.rowSpan)<e.range[0]&&(e.range[0]=h));for(l=e.range[0];l<=e.range[2];l++)(o=j(l,e.range[3],i))&&(s=l,a=e.range[3],!t.isNullOrUndefined(o.rowSpan)&&o.rowSpan<0&&(s+=o.rowSpan)<e.range[0]&&(e.range[0]=s),!t.isNullOrUndefined(o.colSpan)&&o.colSpan<0&&(a+=o.colSpan)<e.range[1]&&(e.range[1]=a),(o=j(s,a,i))&&(o.rowSpan>1&&s+(o.rowSpan-1)>e.range[2]&&(e.range[2]=s,e.range[2]=s+(o.rowSpan-1)),o.colSpan>1&&a+(o.colSpan-1)>e.range[3]&&(e.range[3]=a,e.range[3]=a+(o.colSpan-1))))}},e.prototype.forwardReverse=function(e){var r=this.parent.getActiveSheet();e.range=e.range;var n=e.range[1],i=j(e.range[0],e.range[1],r),o=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&&(o+=i.rowSpan)<e.range[0]&&(e.range[0]=o),(i=j(o,n,r))&&(i.rowSpan>1&&o+(i.rowSpan-1)>=e.range[2]&&(e.range[2]=o+(i.rowSpan-1)),i.colSpan>1&&n+(i.colSpan-1)>=e.range[1]&&(e.range[1]=n+(i.colSpan-1)))),e.range[0]=o,!e.skipChecking){for(var s,a,l=e.range[3];l<=e.range[1];l++)(i=j(e.range[2],l,r))&&(a=l,s=e.range[2],!t.isNullOrUndefined(i.rowSpan)&&i.rowSpan<0&&(s+=i.rowSpan)<e.range[0]&&(e.range[0]=s),!t.isNullOrUndefined(i.colSpan)&&i.colSpan<0&&(a+=i.colSpan)<e.range[3]&&(e.range[3]=a),(i=j(s,a,r))&&(i.rowSpan>1&&s+(i.rowSpan-1)>e.range[2]&&(e.range[2]=s+(i.rowSpan-1)),i.colSpan>1&&a+(i.colSpan-1)>e.range[1]&&(e.range[1]=a+(i.colSpan-1))));var h;for(l=e.range[3];l<=e.range[1];l++)(i=j(e.range[0],l,r))&&(a=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&&(a+=i.colSpan),(i=j(h,a,r))&&(i.rowSpan>1&&h+(i.rowSpan-1)>e.range[2]&&(e.range[2]=h+(i.rowSpan-1)),i.colSpan>1&&a+(i.colSpan-1)>e.range[1]&&(e.range[1]=a,e.range[1]=a+(i.colSpan-1))));var p;for(l=e.range[0];l<=e.range[2];l++)(i=j(l,e.range[3],r))&&(h=l,p=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&&(p+=i.colSpan)<e.range[3]&&(e.range[3]=p),(i=j(h,p,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&&p+(i.colSpan-1)>e.range[1]&&(e.range[1]=p,e.range[1]=p+(i.colSpan-1))))}},e.prototype.reverse=function(e){e.range=e.range;var r=e.range[1],n=this.parent.getActiveSheet(),i=j(e.range[0],e.range[1],n),o=e.range[0];i&&(!t.isNullOrUndefined(i.colSpan)&&i.colSpan<0&&(r+=i.colSpan),!t.isNullOrUndefined(i.rowSpan)&&i.rowSpan<0&&(o+=i.rowSpan),e.range[2]>=o&&(e.range[2]=o,e.isActiveCell=!0),e.range[3]>=r?(e.range[3]=r,e.range[2]===o&&(e.isActiveCell=!0)):e.isActiveCell&&(e.isActiveCell=!1),(i=j(o,r,n))&&(i.rowSpan>1&&o+(i.rowSpan-1)>=e.range[0]&&(e.range[0]=o,e.range[0]=o+(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 s=e.range[3];if(!e.skipChecking){for(var a=e.range[3];a<=e.range[1];a++)(i=j(e.range[2],a,n))&&(s=a,o=e.range[2],!t.isNullOrUndefined(i.rowSpan)&&i.rowSpan<0&&(o+=i.rowSpan)<e.range[2]&&(e.range[2]=o),!t.isNullOrUndefined(i.colSpan)&&i.colSpan<0&&(s+=i.colSpan)<e.range[3]&&(e.range[3]=s),(i=j(o,s,n))&&(i.rowSpan>1&&o+(i.rowSpan-1)>e.range[0]&&(e.range[0]=o,e.range[0]=o+(i.rowSpan-1)),i.colSpan>1&&s+(i.colSpan-1)>e.range[1]&&(e.range[1]=s,e.range[1]=s+(i.colSpan-1))));s=e.range[3];for(a=e.range[3];a<=e.range[1];a++)(i=j(e.range[0],a,n))&&(s=a,o=e.range[0],!t.isNullOrUndefined(i.colSpan)&&i.colSpan<0&&(s+=i.colSpan),!t.isNullOrUndefined(i.rowSpan)&&i.rowSpan<0&&(o+=i.rowSpan),(i=j(o,s,n))&&(i.colSpan>1&&s+(i.colSpan-1)>e.range[1]&&(e.range[1]=s,e.range[1]=s+(i.colSpan-1)),i.rowSpan>1&&o+(i.rowSpan-1)>e.range[0]&&(e.range[0]=o,e.range[0]=o+(i.rowSpan-1))));var l,h;for(a=e.range[2];a<=e.range[0];a++)(i=j(a,e.range[3],n))&&(h=a,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=j(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=this.parent.getActiveSheet(),n=e.range[0],i=e.range[1],o=j(e.range[0],e.range[1],r);if(o&&(!t.isNullOrUndefined(o.rowSpan)&&o.rowSpan<0&&(n+=o.rowSpan,e.range[2]>=n&&(e.range[2]=n)),!t.isNullOrUndefined(o.colSpan)&&o.colSpan<0&&(i+=o.colSpan),(o=j(n,i,r))&&(o.rowSpan>1&&n+(o.rowSpan-1)>=e.range[0]&&(e.range[0]=n,e.range[0]=n+(o.rowSpan-1)),o.colSpan>1&&i+(o.colSpan-1)>=e.range[3]&&(e.range[3]=e.range[1],e.range[3]=i+(o.colSpan-1)))),!e.skipChecking){for(var s,a=e.range[3],l=e.range[1];l<=e.range[3];l++)(o=j(e.range[2],l,r))&&(s=e.range[2],a=l,!t.isNullOrUndefined(o.rowSpan)&&o.rowSpan<0&&(s+=o.rowSpan)<e.range[2]&&(e.range[2]=s),!t.isNullOrUndefined(o.colSpan)&&o.colSpan<0&&(a+=o.colSpan)<e.range[1]&&(e.range[1]=a),(o=j(s,a,r))&&(o.colSpan>1&&a+(o.colSpan-1)>e.range[3]&&(e.range[3]=a+(o.colSpan-1)),o.rowSpan>1&&o.rowSpan-1+s>e.range[0]&&(e.range[0]=o.rowSpan-1+s)));var h,p;for(l=e.range[1];l<=e.range[3];l++)(o=j(e.range[0],l,r))&&(p=l,h=e.range[0],!t.isNullOrUndefined(o.colSpan)&&o.colSpan<0&&(p+=o.colSpan)<e.range[1]&&(e.range[1]=p),!t.isNullOrUndefined(o.rowSpan)&&o.rowSpan<0&&(h+=o.rowSpan),(o=j(h,p,r))&&o.rowSpan>1&&h+(o.rowSpan-1)>e.range[0]&&(e.range[0]=h+(o.rowSpan-1)));var d;for(l=e.range[2];l<=e.range[0];l++)(o=j(l,e.range[3],r))&&(s=l,d=e.range[3],!t.isNullOrUndefined(o.rowSpan)&&o.rowSpan<0&&(s+=o.rowSpan)<e.range[2]&&(e.range[2]=s),!t.isNullOrUndefined(o.colSpan)&&o.colSpan<0&&(d+=o.colSpan)<e.range[1]&&(e.range[1]=d),(o=j(s,d,r))&&(o.rowSpan>1&&o.rowSpan-1+s>e.range[0]&&(e.range[0]=o.rowSpan-1+s),o.colSpan>1&&o.colSpan-1+d>e.range[3]&&(e.range[3]=d,e.range[3]=o.colSpan-1+d)))}},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.pasteHandler=function(e){for(var t,r,n,i=this.parent.getActiveSheet(),o=c(i.activeCell),s=e.range[0],a=0;s<=e.range[2];s++,a++)for(var l=e.range[1],h=0;l<=e.range[3];l++,h++){if((t=j(s,l,e.prevSheet)||{}).rowSpan>1&&(n=j(o[0]+(t.rowSpan-1),o[1],i)||{},r=j(o[0]+1,o[1],i)||{},void 0!==n.colSpan&&n.colSpan<0||void 0!==r.colSpan&&r.colSpan<0))return e.cancel=!0,void this.parent.notify(or,{showDialog:!0});if(t.colSpan>1&&(n=j(o[0],o[1]+(t.colSpan-1),i)||{},r=j(o[0],o[1]+1,i)||{},void 0!==n.rowSpan&&n.rowSpan<0||void 0!==r.rowSpan&&r.rowSpan<0))return e.cancel=!0,void this.parent.notify(or,{showDialog:!0})}},e.prototype.addEventListener=function(){this.parent.on(ir,this.merge,this),this.parent.on(sr,this.mergedRange,this),this.parent.on(ar,this.activeCellRange,this),this.parent.on(lr,this.insertHandler,this),this.parent.on(hr,this.pasteHandler,this)},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(ir,this.merge),this.parent.off(sr,this.mergedRange),this.parent.off(ar,this.activeCellRange),this.parent.off(lr,this.insertHandler),this.parent.off(hr,this.pasteHandler))},e.prototype.getModuleName=function(){return"workbookmerge"},e}(),co=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(pr,this.setCFrulHandler,this),this.parent.on(cr,this.clearRules,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(pr,this.setCFrulHandler),this.parent.off(cr,this.clearRules))},e.prototype.setCFrulHandler=function(e){var t=e.conditionalFormat,r=t.range,n=this.parent.getActiveSheet();r=r||n.selectedRange,t.range=r;var i,o=d(r);n.conditionalFormats||(n.conditionalFormats=[]),i=n.conditionalFormats.length,n.conditionalFormats[i]=t;for(var s=o[0];s<=o[2];s++){n.rows[s]||$(n,s,{});for(var a=o[1];a<=o[3];a++){n.rows[s].cells&&n.rows[s].cells[a]||q(s,a,n,{});var l=n.rows[s].cells[a];this.parent.notify(dr,{rowIdx:s,colIdx:a,cell:l,conditionalFormat:t})}}},e.prototype.clearRules=function(e){for(var r,n,i,o,s,a,l,h,p=!!t.isNullOrUndefined(e.isPublic),c=[],u=[],f=!0,m=this.parent.getActiveSheet(),v=m.conditionalFormats,y=e.range,C=d(y),b=C[0];b<=C[2];b++)for(var S=C[1];S<=C[3];S++)this.parent.notify(mr,{rIdx:b,cIdx:S});if(v){for(var x=v.length-1;x>=0;x--){for(var w=!1,I="",E=v[x],k=E.range.split(","),R=0;R<k.length;R++){var A=!1,T=d(k[R]);l=T[0],h=T[0],s=T[1],a=T[1],T[0]>=C[0]&&T[2]<=C[2]&&T[1]>=C[1]&&T[3]<=C[3]&&(A=!0);for(var F=T[0];F<=T[2];F++){for(var N=0,O=T[1];O<=T[3];O++)for(var D=C[0];D<=C[2];D++)for(var L=C[1];L<=C[3];L++)if(D===F&&L===O){var H=this.parent.getCellStyleValue(["backgroundColor","color"],[D,L]);this.parent.notify(lt,{style:H,rowIdx:D,colIdx:L,lastCell:!0,isHeightCheckNeeded:!0,manualUpdate:!0}),N+=1,w=!0,D===T[0]?L===T[3]?s===T[1]?a===L?a=L:s=L-1:s!==T[1]&&a+1===L?(a=T[1],s-=1):s!==T[1]&&a===T[1]&&(s=C[1]-1):L===T[1]?a===T[1]&&(a=L+1):s===T[1]&&a===T[1]?(s=L,a=L):a=s===T[1]&&a!==T[1]?L+1:L:L===T[1]?a===T[1]&&T[1]!==T[3]&&(a=L+1):L===T[3]?s===T[1]?a===L?a=L:s=L-1:s!==T[1]&&a===T[1]?s=C[1]-1:s!==T[1]&&a+1===L?(a=T[1],s=C[1]-1):h=D:s===T[1]&&a===T[1]?(s=L,a=L):a!==T[1]&&s!==T[1]?a=L:s!==T[1]&&a===T[1]?s=L:a=L+1}N>0&&!A?(f&&(r=l,n=h,i=s,o=a),s===T[1]&&a!==T[1]?a===T[3]?(l!==F&&(I=I+" "+g([l,i,n,T[3]])),s===T[1]&&a===T[3]&&(F===T[2]?T[1]===C[3]&&(I=I+" "+g([F,a,F,T[3]])):(C[2]===T[0]&&a!==T[3]&&(I=I+" "+g([F,a,F,T[3]])),l=F+1,h=F+1,a=T[1]))):o!==a?(I=I+" "+g([l,o,F-1,T[3]]),a===T[3]&&s===T[1]?(l=F+1,h=F+1,a=T[1]):(l=F,h=F),a===T[3]&&s!==T[1]&&(s=T[1])):i!==s?(I=I+" "+g([l,T[1],F-1,i]),l=F+1,h=F+1,s=T[1],a=T[1]):F===T[2]?I=I+" "+g([l,a,F,T[3]]):(h<F||s===T[1]&&a===T[3])&&(h=F):a===T[1]&&s!==T[1]?(o!==a&&(I=I+" "+g([l,o,F-1,T[3]]),l=F,h=F),i!==s&&(I=I+" "+g([l,i,F-1,T[3]]),l=F,h=F),F===T[2]?I=I+" "+g([l,a,F,s]):h=F):a!==T[1]&&s!==T[1]?F===T[2]&&T[2]===C[0]?I=T[0]===T[2]?(I=I+" "+g([l,T[1],h,s-1]))+" "+g([l,a+1,h,T[3]]):(I=(I=I+" "+g([l,T[1],h,T[3]]))+" "+g([T[2],T[1],T[2],s-1]))+" "+g([T[2],a+1,T[2],T[3]]):F===T[2]?I=(I=I+" "+g([l,T[1],F,s-1]))+" "+g([l,a+1,F,T[3]]):(i===T[1]&&o===T[1]&&(I=I+" "+g([l,i,h,T[3]]),l=F),h=F):s===T[1]&&a===T[1]&&(C[2]!==T[0]?(T[2]>=C[2]&&F>C[2]&&(I=I+" "+g([l,s,h,T[3]])),T[1]===T[3]&&F<=T[2]&&r!==T[2]&&F!==r&&(I=I+" "+g([l,s,h,T[3]])),T[1]===T[3]&&(l=F+1,h=F+1)):((F===T[2]||F===T[0]&&T[1]!==T[3])&&(I=I+" "+g([l,s,h,a])),l=F+1,h=F+1),F===T[2]&&T[0]!==T[2]&&T[1]!==T[3]&&(I=I+" "+g([F,s,F,a]))),f||(r=l,n=h<=T[2]?h:T[2],i=s,o=a<=T[3]?a:T[3]),f=!1):A||(f&&(r=l,n=h,i=s,o=a),s===T[1]&&a===T[1]&&(F===T[2]&&(I=I+" "+g([l,s,F,T[3]])),h=F),a!==T[1]&&s!==T[1]&&(I=(I=I+" "+g([l,T[1],F-1,s-1]))+" "+g([l,a+1,F-1,T[3]]),l=F,h=F,s=T[1],a=T[1]),a!==T[1]&&s===T[1]&&(I=I+" "+g([l,a,F-1,T[3]]),l=F,h=F,s=T[1],a=T[1]),s!==T[1]&&a===T[1]&&(I=I+" "+g([l,a,F-1,s]),l=F,h=F,s=T[1],a=T[1]),f||(r=l,n=h<=T[2]?h:T[2],i=s,o=a<=T[3]?a:T[3]),f=!1)}}""===I?(u.push(this.parent.getActiveSheet().conditionalFormats[x].range),m.conditionalFormats.splice(x,1)):(u.push(this.parent.getActiveSheet().conditionalFormats[x].range),m.conditionalFormats[x].range=I.trim().replace(" ",",")),w&&!p&&(E.range=I.trim().replace(" ",","),c.push(E))}if(!p){var B={cFormats:c,oldRange:u,selectedRange:y};this.parent.notify(Wn,{eventArgs:B,action:"clearCF"})}}},e.prototype.getModuleName=function(){return"workbookConditionalFormatting"},e}(),uo=function(){function e(){Wo.Inject(br,Vi,Mi,Cr,ro,no,Zi,Qi,io,eo,oo,so,lo,ho,ao,po,co,to)}return e.prototype.getModuleName=function(){return"workbookBasic"},e.prototype.destroy=function(){},e}(),fo=function(){function e(){Wo.Inject(br,Vi,Cr,ro,no,Zi,Mi,Qi,io,eo,oo,so,lo,ho,ao,po,co,to)}return e.prototype.getModuleName=function(){return"workbook-all"},e.prototype.destroy=function(){},e}(),go=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)}}(),mo=function(e,t,r,n){var i,o=arguments.length,s=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,r,s):i(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},vo=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return go(r,e),mo([t.Property("Calibri")],r.prototype,"fontFamily",void 0),mo([t.Property("bottom")],r.prototype,"verticalAlign",void 0),mo([t.Property("left")],r.prototype,"textAlign",void 0),mo([t.Property("0pt")],r.prototype,"textIndent",void 0),mo([t.Property("#000000")],r.prototype,"color",void 0),mo([t.Property("#ffffff")],r.prototype,"backgroundColor",void 0),mo([t.Property("normal")],r.prototype,"fontWeight",void 0),mo([t.Property("normal")],r.prototype,"fontStyle",void 0),mo([t.Property("11pt")],r.prototype,"fontSize",void 0),mo([t.Property("none")],r.prototype,"textDecoration",void 0),mo([t.Property("")],r.prototype,"border",void 0),mo([t.Property("")],r.prototype,"borderTop",void 0),mo([t.Property("")],r.prototype,"borderBottom",void 0),mo([t.Property("")],r.prototype,"borderLeft",void 0),mo([t.Property("")],r.prototype,"borderRight",void 0),r}(t.ChildProperty),yo=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return go(r,e),mo([t.Property("")],r.prototype,"name",void 0),mo([t.Property("")],r.prototype,"scope",void 0),mo([t.Property("")],r.prototype,"comment",void 0),mo([t.Property("")],r.prototype,"refersTo",void 0),r}(t.ChildProperty),Co=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return go(r,e),mo([t.Property(!1)],r.prototype,"selectCells",void 0),mo([t.Property(!1)],r.prototype,"formatCells",void 0),mo([t.Property(!1)],r.prototype,"formatRows",void 0),mo([t.Property(!1)],r.prototype,"formatColumns",void 0),mo([t.Property(!1)],r.prototype,"insertLink",void 0),r}(t.ChildProperty),bo=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return go(r,e),mo([t.Property("")],r.prototype,"address",void 0),r}(t.ChildProperty),So=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return go(r,e),mo([t.Property("WholeNumber")],r.prototype,"type",void 0),mo([t.Property("Between")],r.prototype,"operator",void 0),mo([t.Property("0")],r.prototype,"value1",void 0),mo([t.Property("0")],r.prototype,"value2",void 0),mo([t.Property(!0)],r.prototype,"ignoreBlank",void 0),mo([t.Property(!0)],r.prototype,"inCellDropDown",void 0),mo([t.Property(!1)],r.prototype,"isHighlighted",void 0),r}(t.ChildProperty),xo=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return go(r,e),mo([t.Complex({},vo)],r.prototype,"style",void 0),r}(t.ChildProperty),wo=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return go(r,e),mo([t.Property("GreaterThan")],r.prototype,"type",void 0),mo([t.Complex({},xo)],r.prototype,"format",void 0),mo([t.Property("RedFT")],r.prototype,"cFColor",void 0),mo([t.Property("")],r.prototype,"value",void 0),mo([t.Property("")],r.prototype,"range",void 0),r}(t.ChildProperty),Io=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return go(r,e),mo([t.Property("")],r.prototype,"src",void 0),mo([t.Property("")],r.prototype,"id",void 0),mo([t.Property(300)],r.prototype,"height",void 0),mo([t.Property(400)],r.prototype,"width",void 0),mo([t.Property(0)],r.prototype,"top",void 0),mo([t.Property(0)],r.prototype,"left",void 0),r}(t.ChildProperty),Eo="spreadsheetLocale",ko={SortOutOfRangeError:"Select a cell or range inside the used range and try again."},Ro=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)}}(),Ao=function(e,t,r,n){var i,o=arguments.length,s=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,r,s):i(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},To=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return Ro(r,e),Ao([t.Collection([],Io)],r.prototype,"image",void 0),Ao([t.Property("")],r.prototype,"value",void 0),Ao([t.Property("")],r.prototype,"formula",void 0),Ao([t.Property(0)],r.prototype,"index",void 0),Ao([t.Property("General")],r.prototype,"format",void 0),Ao([t.Complex({},vo)],r.prototype,"style",void 0),Ao([t.Property("")],r.prototype,"hyperlink",void 0),Ao([t.Property(!1)],r.prototype,"wrap",void 0),Ao([t.Property(!0)],r.prototype,"isLocked",void 0),Ao([t.Property("")],r.prototype,"validation",void 0),Ao([t.Property(1)],r.prototype,"colSpan",void 0),Ao([t.Property(1)],r.prototype,"rowSpan",void 0),r}(t.ChildProperty),Fo=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)}}(),No=function(e,t,r,n){var i,o=arguments.length,s=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,r,s):i(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},Oo=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return Fo(r,e),No([t.Collection([],To)],r.prototype,"cells",void 0),No([t.Property(0)],r.prototype,"index",void 0),No([t.Property(20)],r.prototype,"height",void 0),No([t.Property(!1)],r.prototype,"customHeight",void 0),No([t.Property(!1)],r.prototype,"hidden",void 0),r}(t.ChildProperty),Do=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)}}(),Lo=function(e,t,r,n){var i,o=arguments.length,s=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,r,s):i(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},Ho=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return Do(r,e),Lo([t.Property(0)],r.prototype,"index",void 0),Lo([t.Property(64)],r.prototype,"width",void 0),Lo([t.Property(!1)],r.prototype,"customWidth",void 0),Lo([t.Property(!1)],r.prototype,"hidden",void 0),r}(t.ChildProperty),Bo=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)}}(),Mo=function(e,t,r,n){var i,o=arguments.length,s=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,r,s):i(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},_o=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return Bo(r,e),Mo([t.Property(null)],r.prototype,"dataSource",void 0),Mo([t.Property("A1")],r.prototype,"startCell",void 0),Mo([t.Property(null)],r.prototype,"query",void 0),Mo([t.Property(!0)],r.prototype,"showFieldAsHeader",void 0),Mo([t.Property("")],r.prototype,"template",void 0),Mo([t.Property("A1")],r.prototype,"address",void 0),r}(t.ChildProperty),Po=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return Bo(r,e),Mo([t.Property(0)],r.prototype,"rowIndex",void 0),Mo([t.Property(0)],r.prototype,"colIndex",void 0),r}(t.ChildProperty),Vo=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return Bo(r,e),Mo([t.Property(0)],r.prototype,"id",void 0),Mo([t.Collection([],Oo)],r.prototype,"rows",void 0),Mo([t.Collection([],Ho)],r.prototype,"columns",void 0),Mo([t.Complex({},Co)],r.prototype,"protectSettings",void 0),Mo([t.Collection([],_o)],r.prototype,"ranges",void 0),Mo([t.Collection([],wo)],r.prototype,"conditionalFormats",void 0),Mo([t.Property(0)],r.prototype,"index",void 0),Mo([t.Property("")],r.prototype,"name",void 0),Mo([t.Property(100)],r.prototype,"rowCount",void 0),Mo([t.Property(100)],r.prototype,"colCount",void 0),Mo([t.Property("A1")],r.prototype,"selectedRange",void 0),Mo([t.Property("A1")],r.prototype,"activeCell",void 0),Mo([t.Complex({},Po)],r.prototype,"usedRange",void 0),Mo([t.Property("A1")],r.prototype,"topLeftCell",void 0),Mo([t.Property(!0)],r.prototype,"showHeaders",void 0),Mo([t.Property(!0)],r.prototype,"showGridLines",void 0),Mo([t.Property(!1)],r.prototype,"isProtected",void 0),Mo([t.Property("Visible")],r.prototype,"state",void 0),Mo([t.Property([])],r.prototype,"maxHgts",void 0),r}(t.ChildProperty),Uo=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}(),jo=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)}}(),qo=function(){return(qo=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)},zo=function(e,t,r,n){var i,o=arguments.length,s=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,r,s):i(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},Wo=function(e){function r(t){var r=e.call(this,t)||this;return r.sheetNameCount=1,r.isOpen=!1,n.Inject(br,Vi,Mi,Cr,ro,no,Zi,Qi,io,eo,oo,lo,ao,ho,po,co,to),r.commonCellStyle={},t&&t.cellStyle&&(r.commonCellStyle=t.cellStyle),"workbook"===r.getModuleName()&&(r.serviceLocator=new Uo,r.initWorkbookServices(),r.dataBind(),r.initEmptySheet()),r}jo(r,e),n=r,r.prototype.preRender=function(){Object.keys(this.commonCellStyle).length||(this.commonCellStyle=z(this.cellStyle,!0)),"spreadsheet"!==this.getModuleName()||this.refreshing||this.initEmptySheet()},r.prototype.initWorkbookServices=function(){this.serviceLocator.register(Eo,new t.L10n(this.getModuleName(),ko,this.locale))},r.prototype.render=function(){},r.prototype.requiredModules=function(){return _(this)},r.prototype.getPersistData=function(){return this.addOnPersist([])},r.prototype.cellFormat=function(e,t){var r=this.getActiveSheet();t=t||r.selectedRange,this.notify(ot,{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(rr,{range:e,isLocked:t})},r.prototype.getCellStyleValue=function(e,t){var r=this,n=j(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(rt,{format:e,range:t})},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)),fe(this,t),this.notify(vt,{sheetIndex:e||0,sheets:t}),this.notify(pt,{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($e,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,z(e.cellStyle));break;case"sheets":fe(this)}}},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++)$(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++)re(n,i,{hidden:r})},r.prototype.setBorder=function(e,t,r){this.notify(ot,{style:e,borderType:r,range:t||this.getActiveSheet().selectedRange})},r.prototype.insertRow=function(e,t){this.notify(Ht,{model:this.getActiveSheet(),start:e,end:t,modelType:"Row"})},r.prototype.insertColumn=function(e,t){this.notify(Ht,{model:this.getActiveSheet(),start:e,end:t,modelType:"Column"})},r.prototype.insertSheet=function(e,t){this.notify(Ht,{model:this,start:e,end:t,modelType:"Sheet"})},r.prototype.delete=function(e,t,r){this.notify(Bt,{model:r&&"Sheet"!==r?this.getActiveSheet():this,start:e||0,end:t||0,modelType:r||"Sheet"})},r.prototype.merge=function(e,t){e=e||this.getActiveSheet().selectedRange,this.notify(ir,{merge:!0,range:e,type:t||"All",refreshRibbon:e.indexOf(this.getActiveSheet().activeCell)>-1})},r.prototype.computeExpression=function(e){var t={action:"computeExpression",formula:e};return this.notify(pt,t),t.calcValue},r.prototype.initEmptySheet=function(){this.sheets.length?fe(this):this.createSheet()},r.prototype.getActiveSheet=function(){return this.sheets[this.activeSheetIndex]},r.prototype.setUsedRange=function(e,t){var r=this.getActiveSheet();e>r.usedRange.rowIndex&&(r.usedRange.rowIndex=e,this.notify(ht,{index:e,update:"row"})),t>r.usedRange.colIndex&&(r.usedRange.colIndex=t,this.notify(ht,{index:t,update:"col"}))},r.prototype.getData=function(e){return G(this,e)},r.prototype.getModuleName=function(){return"workbook"},r.prototype.getValueRowCol=function(e,t,r){var n={action:"getSheetInfo",sheetInfo:[]};this.notify(pt,n);if(-1===he(0,"Sheet"+(e+1),n.sheetInfo)){var i={action:"getReferenceError",refError:""};return this.notify(pt,i),i.refError}var o=j(t-1,r-1,de(this,e=ae(this,e+1)));return o&&o.value||""},r.prototype.setValueRowCol=function(e,t,r,n){e=ae(this,e),this.notify(dt,{action:"updateCellValue",address:[r-1,n-1],value:t,sheetIndex:e,isValueOnly:!0})},r.prototype.open=function(e){this.notify(Qe,e)},r.prototype.openFromJson=function(e){this.isOpen=!0;var t="object"==typeof e.file?JSON.stringify(e.file):e.file;this.notify(Qe,{jsonObject:t})},r.prototype.save=function(e){if(void 0===e&&(e={}),this.allowSave){var t={url:this.saveUrl,fileName:e.fileName||"Sample",saveType:"Xlsx"},r=qo({},t,e,{customParams:{},isFullPost:!0,needBlobData:!1,cancel:!1});this.trigger("beforeSave",r),this.notify(Gn,{eventArgs:r,action:"beforeSave"}),r.cancel||this.notify(et,{saveSettings:r,isFullPost:r.isFullPost,needBlobData:r.needBlobData,customParams:r.customParams})}},r.prototype.saveAsJson=function(){var e=this;return new Promise(function(t){e.on(Ot,function(r){r.cancel=!0,e.off(Ot),t({jsonObject:{Workbook:r.jsonObject}}),e.notify(tt,r)}),e.save()})},r.prototype.addHyperlink=function(e,t){var r={hyperlink:e,cell:t};this.notify(kt,r)},r.prototype.findHandler=function(e){"next"===e.findOpt?this.notify(Vt,e):"prev"===e.findOpt&&this.notify(Ut,e)},r.prototype.replaceHandler=function(e){"replace"===e.replaceBy?this.notify(qt,e):this.notify(zt,e)},r.prototype.protectSheet=function(e,t){this.notify(Qt,t)},r.prototype.unprotectSheet=function(e){var t={sheet:e};this.notify(tr,t)},r.prototype.sort=function(e,t){if(!this.allowSorting)return Promise.reject();var r={args:{range:t||this.getActiveSheet().selectedRange,sortOptions:e||{sortDescriptors:{}},cancel:!1},promise:new Promise(function(e,t){e(void 0)})};return this.notify(bt,r),r.promise},r.prototype.addDataValidation=function(e,t){var r={range:t=t||this.getActiveSheet().selectedRange,type:e.type,operator:e.operator,value1:e.value1,value2:e.value2,ignoreBlank:e.ignoreBlank,inCellDropDown:e.inCellDropDown,cancel:!1};this.notify(Gn,{eventArgs:r,action:"validation"}),r.cancel||(t=r.range,e.type=r.type,e.operator=r.operator,e.value1=r.value1,e.value2=r.value2,e.ignoreBlank=r.ignoreBlank,e.inCellDropDown=r.inCellDropDown,this.notify(_t,{rules:e,range:t}),delete r.cancel,this.notify(Wn,{eventArgs:r,action:"validation"}))},r.prototype.removeDataValidation=function(e){this.notify(Xt,{range:e})},r.prototype.addInvalidHighlight=function(e){this.notify(Pt,{range:e})},r.prototype.removeInvalidHighlight=function(e){this.notify(Kt,{range:e})},r.prototype.conditionalFormat=function(e){e.range=e.range||this.getActiveSheet().selectedRange,this.notify(pr,{conditionalFormat:e})},r.prototype.clearConditionalFormat=function(e){e=e||this.getActiveSheet().selectedRange,this.notify(cr,{range:e})},r.prototype.updateCell=function(e,t){var r,n=v(t);t.includes("!")?void 0===(r=se(this,t.split("!")[0]))&&(r=this.activeSheetIndex):r=this.activeSheetIndex,q(n[0],n[1],this.sheets[r],e,!0),e.value&&this.notify(dt,{action:"updateCellValue",address:n,value:e.value,sheetIndex:r})},r.prototype.wrap=function(e,t){void 0===t&&(t=!0),W(e,t,this)},r.prototype.addDefinedName=function(e){var t={action:"addDefinedName",isAdded:!1,definedName:e};return this.notify(pt,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(pt,r),r.isRemoved},r.prototype.clearRange=function(e,r,n){void 0===n&&(n=!0),X(this,e||this.getActiveSheet().selectedRange,t.isNullOrUndefined(r)?this.activeSheetIndex:r,n)},r.prototype.insertImage=function(e,t){this.notify(yr,{options:e,range:t||this.getActiveSheet().selectedRange})},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(Rt,r),r.promise},r.prototype.clearFilter=function(){this.notify(Ft,null)},r.prototype.addCustomFunction=function(e,t){var r={action:"addCustomFunction",functionHandler:e,functionName:t=t||("string"==typeof e?e:e.name.replace("bound ",""))};this.notify(pt,r)},r.prototype.clear=function(e){this.notify(gr,e)},r.prototype.getDisplayText=function(e){if(!e)return"";if(e.value&&e.format){var t={formattedText:e.value,value:e.value,format:e.format,onLoad:!0};return this.notify(nt,t),t.formattedText}return!e.value&&e.hyperlink?"string"==typeof e.hyperlink?e.hyperlink:e.hyperlink.address:e.value?e.value.toString():""},r.prototype.getAddressInfo=function(e){return b(this,e)};var n;return zo([t.Property([])],r.prototype,"sheets",void 0),zo([t.Property(0)],r.prototype,"activeSheetIndex",void 0),zo([t.Property("100%")],r.prototype,"height",void 0),zo([t.Property(!0)],r.prototype,"allowFindAndReplace",void 0),zo([t.Property("100%")],r.prototype,"width",void 0),zo([t.Property(!0)],r.prototype,"showRibbon",void 0),zo([t.Property(!0)],r.prototype,"showFormulaBar",void 0),zo([t.Property(!0)],r.prototype,"showSheetTabs",void 0),zo([t.Property(!0)],r.prototype,"allowEditing",void 0),zo([t.Property(!0)],r.prototype,"allowOpen",void 0),zo([t.Property(!0)],r.prototype,"allowSave",void 0),zo([t.Property(!0)],r.prototype,"allowSorting",void 0),zo([t.Property(!0)],r.prototype,"allowFiltering",void 0),zo([t.Property(!0)],r.prototype,"allowNumberFormatting",void 0),zo([t.Property(!0)],r.prototype,"allowCellFormatting",void 0),zo([t.Property(!0)],r.prototype,"allowHyperlink",void 0),zo([t.Property(!0)],r.prototype,"allowInsert",void 0),zo([t.Property(!0)],r.prototype,"allowDelete",void 0),zo([t.Property(!0)],r.prototype,"allowMerge",void 0),zo([t.Property(!0)],r.prototype,"allowDataValidation",void 0),zo([t.Property(!0)],r.prototype,"allowImage",void 0),zo([t.Property(!0)],r.prototype,"allowConditionalFormat",void 0),zo([t.Complex({},vo)],r.prototype,"cellStyle",void 0),zo([t.Property("")],r.prototype,"openUrl",void 0),zo([t.Property("")],r.prototype,"saveUrl",void 0),zo([t.Collection([],yo)],r.prototype,"definedNames",void 0),zo([t.Event()],r.prototype,"beforeOpen",void 0),zo([t.Event()],r.prototype,"openFailure",void 0),zo([t.Event()],r.prototype,"beforeSave",void 0),zo([t.Event()],r.prototype,"saveComplete",void 0),zo([t.Event()],r.prototype,"beforeCellFormat",void 0),zo([t.Event()],r.prototype,"queryCellInfo",void 0),r=n=zo([t.NotifyPropertyChanges],r)}(t.Component),Go=null,Yo=["e-ribbon","e-formula-bar-panel","e-sheet-tab-panel","e-header-toolbar"],Xo={role:"role",selected:"aria-selected",multiselectable:"aria-multiselectable",busy:"aria-busy",colcount:"aria-colcount"},Ko=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"}}))},e.prototype.addEventListener=function(){var e=this.getClipboardEle();this.parent.on("cut",this.cut,this),this.parent.on("copy",this.copy,this),this.parent.on(Zr,this.paste,this),this.parent.on(Qr,this.clearCopiedInfo,this),this.parent.on($r,this.tabSwitchHandler,this),this.parent.on(zr,this.cMenuBeforeOpenHandler,this),this.parent.on(Xr,this.ribbonClickHandler,this),this.parent.on(Rr,this.initCopyIndicator,this),this.parent.on(fn,this.rowHeightChanged,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("cut",this.cut),this.parent.off("copy",this.copy),this.parent.off(Zr,this.paste),this.parent.off(Qr,this.clearCopiedInfo),this.parent.off($r,this.tabSwitchHandler),this.parent.off(zr,this.cMenuBeforeOpenHandler),this.parent.off(Xr,this.ribbonClickHandler),this.parent.off(Rr,this.initCopyIndicator),this.parent.off(fn,this.rowHeightChanged)),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({isAction:!0});break;case t+"_copy":this.copy({isAction:!0})}this.parent.element.focus()},e.prototype.tabSwitchHandler=function(e){0!==e.activeTab||this.copiedInfo||this.copiedShapeInfo||this.hidePaste()},e.prototype.cMenuBeforeOpenHandler=function(e){var r=this.parent.getActiveSheet(),n=this.parent.serviceLocator.getService(Us),i=[],o=[],s=[],a=[],l=c(r.activeCell),h=j(l[0],l[1],r),p=h?t.isNullOrUndefined(h.isLocked)?r.isProtected:h.isLocked:r.isProtected;"Content"!==e.target&&"RowHeader"!==e.target&&"ColumnHeader"!==e.target||(this.parent.enableContextMenuItems([n.getConstant("Paste"),n.getConstant("PasteSpecial")],!!(this.copiedInfo||this.copiedShapeInfo&&!p)),this.parent.enableContextMenuItems([n.getConstant("Cut")],!p)),"Content"===e.target&&p&&this.parent.enableContextMenuItems([n.getConstant("Cut"),n.getConstant("Filter"),n.getConstant("Sort")],!1),"Content"===e.target&&p&&!r.protectSettings.insertLink&&this.parent.enableContextMenuItems([n.getConstant("Hyperlink")],!1),"ColumnHeader"===e.target&&r.isProtected&&(s=[n.getConstant("DeleteColumn"),n.getConstant("DeleteColumns"),n.getConstant("InsertColumn"),n.getConstant("InsertColumns")],a=[n.getConstant("HideColumn"),n.getConstant("HideColumns"),n.getConstant("UnHideColumns")],this.parent.enableContextMenuItems(s,!1),this.parent.enableContextMenuItems(a,!!r.protectSettings.formatColumns)),"RowHeader"===e.target&&r.isProtected&&(i=[n.getConstant("DeleteRow"),n.getConstant("DeleteRows"),n.getConstant("InsertRow"),n.getConstant("InsertRows")],o=[n.getConstant("HideRow"),n.getConstant("HideRows"),n.getConstant("UnHideRows")],this.parent.enableContextMenuItems(i,!1),this.parent.enableContextMenuItems(o,!!r.protectSettings.formatRows))},e.prototype.rowHeightChanged=function(e){if(this.copiedInfo&&this.copiedInfo.range[0]>e.rowIdx){var t=this.parent.element.getElementsByClassName("e-copy-indicator")[0];t.style.top=parseInt(t.style.top,10)+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.copiedInfo&&e&&e.type)return e.preventDefault(),void document.getElementById(this.parent.element.id+"_edit").focus();var r,n,i=!this.copiedInfo&&(e&&e.clipboardData||window.clipboardData),o=this.getCopiedIdx(),s=Object.assign({},this.copiedInfo);if(this.copiedInfo||i||this.copiedShapeInfo){var a=e&&e.sIdx>-1?e.sIdx:this.parent.activeSheetIndex,l=de(this.parent,a),h=S(e&&e.range||d(l.selectedRange)),p=i&&this.getExternalCells(e);if(i&&!p.length)return;var c=h[0],u=i?[0,0,p.length-1,p[0].cells.length-1]:S(this.copiedShapeInfo?d(l.selectedRange):this.copiedInfo.range),f=(h[2]-h[0]+1)%(u[2]-u[0]+1)==0&&(h[3]-h[1]+1)%(u[3]-u[1]+1)==0;r=f?h:[h[0],h[1]].concat([h[0]+u[2]-u[0],h[1]+u[3]-u[1]||h[1]]);var m={requestType:"paste",copiedInfo:this.copiedInfo,copiedRange:g(u),pastedRange:g(r),type:e&&e.type||"All",cancel:!1};if(e.isAction&&!this.copiedShapeInfo&&this.copiedInfo&&this.parent.notify(Gn,{eventArgs:m,action:"clipboard"}),m.cancel)return;var v=void 0,y=void 0,C=void 0,b=[],x=de(this.parent,i?a:o);c=(h=d(m.pastedRange))[0];var w={range:u=i?[0,0,p.length-1,p[0].cells.length-1]:S(this.copiedShapeInfo?d(l.selectedRange):this.copiedInfo.range),prevSheet:x,cancel:!1};if(r=(f=(h[2]-h[0]+1)%(u[2]-u[0]+1)==0&&(h[3]-h[1]+1)%(u[3]-u[1]+1)==0)?h:[h[0],h[1]].concat([h[0]+u[2]-u[0],h[1]+u[3]-u[1]||h[1]]),this.copiedShapeInfo&&!this.copiedInfo){var I=this.copiedShapeInfo.pictureElem;this.parent.notify(Li,{options:{src:I.style.backgroundImage.replace(/url\((['"])?(.*?)\1\)/gi,"$2"),height:this.copiedShapeInfo.height,width:this.copiedShapeInfo.width,imageId:this.copiedShapeInfo.isCut?I.id:""},range:g([c,h[1],c,h[1]]),isPublic:!1,isUndoRedo:!0});var E=j(c,h[1],l);if(E&&!t.isNullOrUndefined(E.image)){var k=E.image?E.image.length-1:0,R={requestType:"imagePaste",copiedShapeInfo:this.copiedShapeInfo,pasteSheetIndex:this.parent.activeSheetIndex,pastedRange:ge(this.parent)+"!"+g([c,h[1],c,h[1]]),pastedPictureElement:document.getElementById(E.image[k].id)};this.parent.notify(Wn,{eventArgs:R,action:"clipboard"})}}else{if(this.parent.notify(hr,w),w.cancel)return;for(var A=u[0],T=0;A<=u[2];A++,T++){for(var F=u[1],N=0;F<=u[3];F++,N++){if((v=i?p[A].cells[F]:Object.assign({},j(A,F,x)))&&e&&e.type){switch(e.type){case"Formats":v={format:v.format,style:v.style};break;case"Values":if((v={value:v.value}).value.indexOf("\n")>-1){this.parent.getCell(h[0],h[1]).classList.add("e-alt-unwrap")}}y=["Formats","Values"].indexOf(e.type)>-1}if(!this.parent.scrollSettings.isFinite&&(u[2]-u[0]>1048575-h[0]||u[3]-u[1]>16383-h[1])||this.parent.scrollSettings.isFinite&&(u[2]-u[0]>l.rowCount-1-h[0]||u[3]-u[1]>l.colCount-1-h[1]))return void this.showDialog();if(f)for(var O=h[0];O<=h[2];O+=u[2]-u[0]+1)for(var D=h[1];D<=h[3];D+=u[3]-u[1]+1){if(void 0!==(C=j(O+T,D+N,l)||{}).colSpan||void 0!==C.rowSpan){var L={range:(w={range:[O+T,D+N,O+T,D+N]}).range,merge:!1,isAction:!1,type:"All"};b.push(L),this.parent.notify(ir,L)}this.setCell(O+T,D+N,l,v,y)}else Ue(this.parent,A,F,o)||this.setCell(c,h[1]+N,l,v,y);!i&&this.copiedInfo.isCut&&this.setCell(A,F,x,null,!1,!0)}c++}if(this.parent.setUsedRange(r[2]+1,r[3]),a===this.parent.activeSheetIndex&&(this.parent.serviceLocator.getService("cell").refreshRange(r),this.parent.notify(Jr,{indexes:r})),!i&&this.copiedInfo.isCut&&(n=this.copiedInfo.isCut,o===this.parent.activeSheetIndex&&this.parent.serviceLocator.getService("cell").refreshRange(u),this.clearCopiedInfo(),this.cutInfo=n),(i||e&&e.isAction)&&this.parent.element.focus(),e.isAction){var H=s&&s.sId?ae(this.parent,s.sId):this.parent.activeSheetIndex;R={requestType:"paste",copiedInfo:s,mergeCollection:b,pasteSheetIndex:this.parent.activeSheetIndex,copiedRange:this.parent.sheets[H].name+"!"+g(s&&s.range?s.range:d(this.parent.sheets[H].selectedRange)),pastedRange:ge(this.parent)+"!"+g(r),type:e&&e.type||"All"};this.parent.notify(Wn,{eventArgs:R,action:"clipboard"})}if(n){Ge(x,u[0],u[1],20);var B=Ye(x,u[0]);je(this.parent,x,B,u[0])}}}else this.getClipboardEle().select()},e.prototype.setCell=function(e,r,n,i,o,s){q(e,r,n,s?null:i,o),i&&i.formula&&this.parent.notify(pt,{action:"refreshCalculate",value:s?"":i.formula,rowIndex:e,colIndex:r,sheetIndex:this.parent.activeSheetIndex,isFormula:!0}),i&&!i.formula&&this.parent.notify(dt,{action:"updateCellValue",address:[e,r,e,r],value:i.value}),s&&i&&(i.style&&this.parent.notify(lt,{style:t.extend({},this.getEmptyStyle(i.style),this.parent.commonCellStyle),rowIdx:e,colIdx:r,cell:null,lastCell:null,row:null,hRow:null,isHeightCheckNeeded:!0,manualUpdate:!1}),i.wrap&&this.parent.notify(Nt,{range:[e,r,e,r],wrap:!1,sheet:n}))},e.prototype.getEmptyStyle=function(e){var t={};return Object.keys(e).forEach(function(e){t[e]=""}),t},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 o=new r.Deferred;e.promise=o.promise;var s=this.parent.getActiveSheet(),a=e&&e.range||d(s.selectedRange),l={sheet:s,indexes:[0,0,s.rowCount-1,s.colCount-1],promise:new Promise(function(e,t){e(void 0)})},h=document.getElementsByClassName("e-ss-overlay-active"),p=h.length;!s.isLocalData||e&&e.clipboardData||0!==a[0]||a[2]!==s.rowCount-1||(this.parent.showSpinner(),this.parent.notify("updateSheetFromDataSource",l)),l.promise.then(function(){if(p>0){var r={clientY:h[0].offsetTop,isImage:!0};i.parent.notify(Oi,r);var l={clientX:h[0].offsetLeft,isImage:!0};i.parent.notify(Di,l),i.copiedShapeInfo={sId:e&&e.sId?e.sId:s.id,isCut:n,pictureElem:h[0],copiedRange:g([r.clientY,l.clientX,r.clientY,l.clientX]),height:h[0].offsetHeight,width:h[0].offsetWidth},i.hidePaste(!0),n&&i.parent.notify(Hi,{id:i.copiedShapeInfo.pictureElem.id,sheetIdx:i.copiedShapeInfo.sId,range:i.copiedShapeInfo.copiedRange})}else e&&e.clipboardData||(i.copiedInfo&&i.clearCopiedInfo(),i.copiedInfo={range:a,sId:e&&e.sId?e.sId:s.id,isCut:n},i.hidePaste(!0),i.initCopyIndicator(),t.Browser.isIE||i.getClipboardEle().select(),e&&e.isAction&&document.execCommand(n?"cut":"copy"),i.parent.hideSpinner());t.Browser.isIE&&i.setExternalCells(e),o.resolve()}),e&&e.clipboardData&&(this.setExternalCells(e),this.parent.element.focus())}},e.prototype.clearCopiedInfo=function(){this.copiedInfo&&(this.parent.getActiveSheet().id===this.copiedInfo.sId&&t.detach(this.parent.getMainContent().getElementsByClassName("e-copy-indicator")[0]),this.copiedInfo=null,this.hidePaste()),this.copiedShapeInfo&&(this.copiedShapeInfo=null,this.hidePaste())},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"})),Ee(e,this.copiedInfo.range,this.parent.getActiveSheet(),!1),this.parent.getMainContent().appendChild(e)}},e.prototype.showDialog=function(){var e=this;this.parent.serviceLocator.getService(js).show({header:"Spreadsheet",target:this.parent.element,height:205,width:340,isModal:!0,showCloseIcon:!0,content:this.parent.serviceLocator.getService(Us).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(Kr,[{items:[this.parent.element.id+"_paste"],enable:e||!1}])},e.prototype.setExternalCells=function(e){for(var r,n="",i=this.copiedInfo.range,o=this.parent.getActiveSheet(),s='<html><body><table xmlns="http://www.w3.org/1999/xhtml"><tbody>',a=i[0];a<=i[2];a++){s+="<tr>";for(var l=i[1];l<=i[3];l++){if(s+='<td style="white-space:nowrap;vertical-align:bottom;',(r=j(a,l,o))&&r.style&&Object.keys(r.style).forEach(function(e){var t=e.match(/[A-Z]/);s+=("backgroundColor"===e?"background":t?e.replace(t[0],"-"+t[0].toLowerCase()):e)+":"+("backgroundColor"===e||"color"===e?r.style[e].slice(0,7):r.style[e])+";"}),s+='">',r&&r.value){var h={formattedText:r.value,value:r.value,format:r.format,onLoad:!0};r.format&&this.parent.notify(nt,h),s+=h.formattedText,n+=h.formattedText}s+="</td>",n+=l===i[3]?"":"\t"}s+="</tr>",n+=a===i[2]?"":"\n"}s+="</tbody></table></body></html>",t.Browser.isIE?window.clipboardData.setData("text",n):(e.clipboardData.setData("text/html",s),e.clipboardData.setData("text/plain",n),e.preventDefault())},e.prototype.getExternalCells=function(e){var r,n,i,o=this,s=[],a=[],l=this.parent.createElement("span");return t.Browser.isIE?n=window.clipboardData.getData("text"):(r=e.clipboardData.getData("text/html"),n=e.clipboardData.getData("text/plain"),l.innerHTML=r),l.querySelector("table")?l.querySelectorAll("tr").forEach(function(e){e.querySelectorAll("td").forEach(function(e,t){e.textContent=e.textContent.replace(/(\r\n|\n|\r)/gm,""),a[t]={value:e.textContent,style:o.getStyle(e,l)}}),s.push({cells:a}),a=[]}):n&&(r&&[].slice.call(l.children).forEach(function(e){e.getAttribute("style")&&(i=o.getStyle(e,l))}),n.trim().split("\n").forEach(function(e){e.split("\t").forEach(function(e,t){a[t]={style:i},P(e)?a[t].formula=e:a[t].value=e}),s.push({cells:a}),a=[]})),setTimeout(function(){o.getClipboardEle().innerHTML=""},0),s},e.prototype.getStyle=function(e,t){var r=[],n={};return(e.classList.length||e.getAttribute("style"))&&(e.classList.length&&r.push(t.querySelector("style").innerHTML.split(e.classList[0])[1].split("{")[1].split("}")[0]),e.getAttribute("style")&&r.push(e.getAttribute("style")),r.forEach(function(e){e.split(";").forEach(function(e){var t=e.split(":")[0].trim();if(["font-family","vertical-align","text-align","text-indent","color","background","font-weight","font-style","font-size","text-decoration"].indexOf(t)>-1){var r=(t="background"===t?"backgroundColor":t).match(/-[a-z]/);n[r?t.replace(r[0],r[0].charAt(1).toUpperCase()):t]=e.split(":")[1]}})})),n},e.prototype.getClipboardEle=function(){return this.parent.element.getElementsByClassName("e-clipboard")[0]},e.prototype.getModuleName=function(){return"clipboard"},e.prototype.destroy=function(){this.removeEventListener();var e=this.getClipboardEle();t.detach(e),this.parent=null},e}(),$o=function(){function e(e){this.editorElem=null,this.editCellData={},this.isEdit=!1,this.isCellEdit=!0,this.isNewValueEdit=!0,this.isAltEnter=!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.parent=e,this.init()}return e.prototype.init=function(){this.addEventListener()},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null,this.editorElem=null},e.prototype.addEventListener=function(){t.EventHandler.add(this.parent.element,"dblclick",this.dblClickHandler,this),this.parent.on(Ar,this.mouseDownHandler,this),this.parent.on(Lr,this.keyUpHandler,this),this.parent.on(Hr,this.keyDownHandler,this),this.parent.on(Fr,this.performEditOperation,this),this.parent.on(xi,this.initiateCurPosition,this),this.parent.on(Ii,this.updateFormulaBarValue,this),this.parent.on(Ei,this.addressHandler,this),this.parent.on(ki,this.initiateRefSelection,this),this.parent.on(Ri,this.refSelectionRender,this)},e.prototype.removeEventListener=function(){t.EventHandler.remove(this.parent.element,"dblclick",this.dblClickHandler),this.parent.isDestroyed||(this.parent.off(Ar,this.mouseDownHandler),this.parent.off(Lr,this.keyUpHandler),this.parent.off(Hr,this.keyDownHandler),this.parent.off(Fr,this.performEditOperation),this.parent.off(xi,this.initiateCurPosition),this.parent.off(Ii,this.updateFormulaBarValue),this.parent.off(Ei,this.addressHandler),this.parent.off(ki,this.initiateRefSelection),this.parent.off(Ri,this.refSelectionRender))},e.prototype.getModuleName=function(){return"edit"},e.prototype.performEditOperation=function(e){switch(e.action){case"renderEditor":this.renderEditor();break;case"refreshEditor":this.refreshEditor(e.value,e.refreshFormulaBar,e.refreshEditorElem,e.isAppend,e.trigEvent),e.refreshCurPos&&this.setCursorPosition();break;case"startEdit":this.isEdit||(this.isNewValueEdit=e.isNewValueEdit,this.startEdit(e.address,e.value,e.refreshCurPos));break;case"endEdit":this.isEdit&&this.endEdit(e.refreshFormulaBar);break;case"cancelEdit":this.isEdit&&this.cancelEdit(e.refreshFormulaBar);break;case"getCurrentEditValue":e.editedValue=this.editCellData.value;break;case"refreshDependentCellValue":this.refreshDependentCellValue(e.rowIdx,e.colIdx,e.sheetIdx);break;case"getPosition":e.position=this.editorElem.getBoundingClientRect();break;case"focusEditorElem":this.editorElem.focus();break;case"getCurrentEditSheetIdx":e.sheetIndex=this.editCellData.sheetIndex}},e.prototype.keyUpHandler=function(e){if(this.isEdit){if(e.altKey&&13===e.keyCode){this.parent.element.querySelector(".e-spreadsheet-edit").focus(),this.altEnter(),this.isAltEnter=!0}else this.isCellEdit&&this.editCellData.value!==this.editorElem.textContent&&16!==e.keyCode&&this.refreshEditor(this.editorElem.textContent,this.isCellEdit);if(P(this.editCellData.value)&&16!==e.keyCode){var t=this.parent.element.querySelector(".e-formularef-indicator");t&&t.parentElement.removeChild(t),this.editCellData.value!==this.editorElem.textContent&&this.refreshEditor(this.editorElem.textContent,!0);var r=this.editCellData.sheetIndex,n=this.editCellData.value;this.parent.notify(Si,{range:n,formulaSheetIdx:r})}}},e.prototype.keyDownHandler=function(e){var r=e.target,n=e.keyCode,i=this.parent.getActiveSheet(),o=c(i.activeCell),s=j(o[0],o[1],i)||{};if(!t.closest(e.target,".e-findtool-dlg")&&!t.closest(e.target,".e-validationerror-dlg"))if(!i.isProtected||t.closest(e.target,".e-sheet-rename")||!1===s.isLocked){if(this.isEdit){var a=P(this.editCellData.value);if((this.isCellEdit||a&&this.editCellData.value!==this.editorElem.textContent&&16!==e.keyCode)&&this.refreshEditor(this.editorElem.textContent,this.isCellEdit),!e.altKey)switch(n){case this.keyCodes.ENTER:if(t.Browser.isWindows&&e.preventDefault(),this.isAltEnter){var l=this.parent.element.querySelector(".e-spreadsheet-edit").textContent;l&&l.indexOf("\n")>-1&&(W(this.parent.getActiveSheet().selectedRange,!0,this.parent),this.refreshEditor(this.editorElem.textContent,this.isCellEdit),this.isAltEnter=!1)}if(a){var h=this.parent.element.querySelector(".e-formularef-indicator");h&&h.parentElement.removeChild(h),this.editCellData.sheetIndex===i.id-1?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(!this.isEdit&&(r.classList.contains("e-spreadsheet")||t.closest(r,".e-sheet-panel"))){var p=n>=this.keyCodes.FIRSTALPHABET&&n<=this.keyCodes.LASTALPHABET,d=n>=this.keyCodes.FIRSTNUMBER&&n<=this.keyCodes.LASTNUMBER,u=n>=this.keyCodes.FIRSTNUMPAD&&n<=this.keyCodes.LASTNUMPAD,f=n>=this.keyCodes.SYMBOLSETONESTART&&n<=this.keyCodes.SYMBOLSETONEEND;f||(f=n>=this.keyCodes.SYMBOLSETTWOSTART&&n<=this.keyCodes.SYMBOLSETTWOEND);var g=n===this.keyCodes.FIREFOXEQUALPLUS||n===this.keyCodes.FIREFOXMINUS,m=!e.shiftKey&&!e.ctrlKey&&n===this.keyCodes.F2,v=n===this.keyCodes.BACKSPACE;if(!e.ctrlKey&&!e.altKey&&(!e.shiftKey&&n===this.keyCodes.SPACE||p||d||u||f||"mozilla"===t.Browser.info.name&&g)||m||v){m&&(this.isNewValueEdit=!1);var y=document.getElementsByClassName("e-ss-overlay-active");y.length>0?this.parent.notify(Hi,{id:y[0].id,sheetIdx:this.parent.activeSheetIndex+1}):this.startEdit()}n===this.keyCodes.DELETE&&this.editingHandler("delete")}}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&&n===this.keyCodes.F2)&&67!==n&&89!==n&&90!==n){if(i.protectSettings.insertLink&&75===n)return;this.parent.element.querySelector(".e-editAlert-dlg")||this.parent.notify(li,null)}},e.prototype.renderEditor=function(){if(!this.editorElem||!this.parent.element.querySelector("#"+this.parent.element.id+"_edit")){var e=void 0;(e=this.parent.createElement("div",{id:this.parent.element.id+"_edit",className:"e-spreadsheet-edit"})).contentEditable="true",e.spellcheck=!1,this.editorElem=e,this.parent.element.getElementsByClassName("e-spreadsheet-edit")[0]&&this.parent.element.getElementsByClassName("e-spreadsheet-edit")[0].remove(),this.parent.element.querySelector(".e-sheet-content").appendChild(this.editorElem)}this.parent.notify(Nr,{action:"renderAutoComplete"})},e.prototype.refreshEditor=function(e,t,r,n,i){void 0===i&&(i=!0),n?e=this.editCellData.value=this.editCellData.value+e:this.editCellData.value=e,r&&(this.editorElem.textContent=e),t&&this.parent.notify(Or,{action:"refreshFormulabar",value:e}),i&&this.editCellData.value===this.editorElem.textContent&&this.triggerEvent("cellEditing")&&this.cancelEdit()},e.prototype.startEdit=function(e,t,r){void 0===r&&(r=!0);var n=this.parent.getActiveSheet(),i=c(n.activeCell),o=j(i[0],i[1],n)||{},s=d(this.parent.getActiveSheet().activeCell);if(!Ue(this.parent,s[0],s[1],this.parent.activeSheetIndex)&&(this.updateEditCellDetail(e,t),this.initiateEditor(r),this.positionEditor(),this.parent.isEdit=this.isEdit=!0,this.parent.notify(Qr,null),this.parent.notify(Kr,[{enable:!1}]),o.formula)){var a=this.editCellData.sheetIndex;this.parent.notify(Si,{range:o.formula,formulaSheetIdx:a})}},e.prototype.setCursorPosition=function(){var e=this.editorElem,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 t=document.getElementsByClassName("e-ss-overlay-active"),r=t.length;switch(e){case"delete":if(r>0)this.parent.notify(Hi,{id:t[0].id,sheetIdx:this.parent.activeSheetIndex+1});else{var n=this.parent.getActiveSheet().selectedRange,i=v(n);n=g(i=i[0]>i[2]?S(i):i),this.parent.clearRange(n,null,!0),this.parent.serviceLocator.getService("cell").refreshRange(i),this.parent.notify(qr,{})}}},e.prototype.mouseDownHandler=function(e){if(!t.closest(e.target,".e-findtool-dlg")&&this.isEdit){var r=e.target,n=this.parent.getActiveSheet(),i=this.parent.element.querySelector(".e-formularef-indicator");if(this.isCellEdit=r.classList.contains("e-spreadsheet-edit"),r.classList.contains("e-cell")||r.classList.contains("e-header-cell")||r.classList.contains("e-selectall")||t.closest(r,".e-toolbar-item.e-active")){if(this.isAltEnter){var o=this.parent.element.querySelector(".e-spreadsheet-edit").textContent;o&&o.indexOf("\n")>-1&&(this.isAltEnter=!1,W(this.parent.getActiveSheet().selectedRange,!0,this.parent),this.refreshEditor(this.editorElem.textContent,this.isCellEdit))}var s=P(this.editCellData.value);if(s){var a=window.getSelection().focusOffset,l=c(n.activeCell),h=j(l[0],l[1],n);if(this.editCellData.value===this.editorElem.textContent&&this.editorElem.textContent.indexOf("(")!==this.editorElem.textContent.length-1)if(this.editCellData.sheetIndex!==n.id-1){var p=this.parent.element.querySelector(".e-formula-bar");if(","!==this.editorElem.textContent.substring(p.selectionEnd-1,p.selectionEnd)&&!e.shiftKey)return i&&i.parentElement.removeChild(i),this.parent.goTo(this.editCellData.fullAddr),void this.endEdit(!1,e)}else if(","!==this.editorElem.textContent.substring(a-1,a))return i&&i.parentElement.removeChild(i),void this.endEdit(!1,e);if(!h)return;if(s=!!h.formula&&P(j(l[0],l[1],n).formula)){var d=window.getSelection().focusOffset;this.editCellData.value.length===d?")"===this.editCellData.value.substring(this.editCellData.value.length-1)&&(i&&i.parentElement.removeChild(i),this.endEdit(!1,e)):this.editCellData.value===this.editorElem.textContent&&(","!==(this.editCellData.value+n.selectedRange).substring(d-1,d)?(i&&i.parentElement.removeChild(i),this.endEdit(!1,e)):")"!==this.editCellData.value.substring(d)&&(i&&i.parentElement.removeChild(i),this.endEdit(!1,e)))}}else this.endEdit(!1,e)}else if(this.editCellData.value===this.editorElem.textContent&&this.editorElem.textContent.indexOf("(")!==this.editorElem.textContent.length-1&&this.editCellData.sheetIndex===n.id-1){a=window.getSelection().focusOffset;if(","!==this.editorElem.textContent.substring(a-1,a))return i&&i.parentElement.removeChild(i),this.parent.goTo(this.editCellData.fullAddr),void this.endEdit(!1,e)}}},e.prototype.dblClickHandler=function(e){var r=e.target,n=this.parent.getActiveSheet(),i=c(n.activeCell),o=j(i[0],i[1],n)||{};if(n.isProtected&&!1!==o.isLocked)(r.classList.contains("e-active-cell")||r.classList.contains("e-cell"))&&this.parent.notify(li,null);else if(r.className.indexOf("e-ss-overlay")<0&&(r.classList.contains("e-active-cell")||r.classList.contains("e-cell")||t.closest(r,".e-sheet-content")))if(this.isEdit)if(P(this.editCellData.value)){var s=this.editCellData.fullAddr.substring(0,this.editCellData.fullAddr.indexOf("!"));this.parent.getActiveSheet().name===s&&this.endEdit()}else this.endEdit();else this.isNewValueEdit=!1,this.startEdit()},e.prototype.updateEditCellDetail=function(e,t){var r,n;this.editCellData.sheetIndex||(r=e&&e.split("!").length>1?se(this.parent,le(e)):this.parent.activeSheetIndex),this.editCellData.addr?P(this.editCellData.value)&&(n=de(this.parent,r),this.isNewValueEdit=!1):(n=de(this.parent,r),e=e?y(e):n.activeCell);var i=d(e),o=i[0],s=i[1],a=this.parent.getCell(o,s),l=Ie(n,i);this.editCellData={addr:e,fullAddr:ge(this.parent,r)+"!"+e,rowIndex:o,colIndex:s,sheetIndex:r,element:a,value:t||"",position:l}},e.prototype.initiateEditor=function(e){var r=this;this.parent.getData(this.editCellData.fullAddr).then(function(n){n.forEach(function(n,i){var o={cell:n,value:n?n.value:""};r.parent.notify(ut,o);var s=n?o.value:"";n&&n.formula&&(s=n.formula),r.editCellData.oldValue=s,r.editCellData.value?s=r.editCellData.value:r.editCellData.value=s,r.isNewValueEdit?s="":r.isNewValueEdit=!0,t.isUndefined(s)||r.refreshEditor(s,!1,!0,!1,!1),e&&r.setCursorPosition(),r.triggerEvent("cellEdit")&&r.cancelEdit(!0,!1)})})},e.prototype.positionEditor=function(){var e=this.editCellData.element;e.classList.add("e-ss-edited");var t=j(this.editCellData.rowIndex,this.editCellData.colIndex,this.parent.getActiveSheet()),r=this.editCellData.position.left+1,n=this.editCellData.position.top+1,i=this.parent.getRow(this.editCellData.rowIndex).offsetHeight-3,o=this.editCellData.element.offsetWidth-3,s=this.parent.getMainContent().offsetWidth-r-28,a="display:block;top:"+n+"px;"+(this.parent.enableRtl?"right:":"left:")+r+"px;min-width:"+o+"px;max-width:"+s+"px;"+(t&&t.wrap?"height:auto;":"")+(t&&t.wrap?"width:"+o+"px;":"")+"min-height:"+i+"px;";a+=e.style.cssText,this.editorElem.setAttribute("style",a),this.parent.element.querySelector(".e-active-cell").style.height=this.editCellData.element.offsetHeight+2+"px",e.classList.contains("e-right-align")?this.editorElem.classList.add("e-right-align"):e.classList.contains("e-center-align")&&this.editorElem.classList.add("e-center-align")},e.prototype.updateEditedValue=function(e){void 0===e&&(e=!0);var t=this.editCellData.oldValue,r=t?t.toString().toUpperCase():"",n=!0,i=this.editCellData.addr,o=d(this.parent.getActiveSheet().activeCell),s=this.parent.getActiveSheet(),a=j(o[0],o[1],s);if(this.parent.notify(Bn,{args:{action:"beforeCellSave",eventArgs:{address:this.editCellData.addr}}}),this.parent.allowDataValidation&&a&&a.validation){var l=this.parent.element.getElementsByClassName("e-spreadsheet-edit")[0].innerText,h=this.parent.activeSheetIndex,p=void 0;p="string"==typeof i?d(i):i,this.parent.notify(Mt,{value:l,range:p,sheetIdx:h,isCell:!0}),n=this.parent.allowDataValidation,this.editCellData.value=n?l:this.editCellData.value,this.parent.allowDataValidation=!0}if((t!==this.editCellData.value||r.indexOf("=RAND()")>-1||r.indexOf("RAND()")>-1||r.indexOf("=RANDBETWEEN(")>-1||r.indexOf("RANDBETWEEN(")>-1)&&n){var c=this.parent.getActiveSheet(),u=d(c.activeCell);this.parent.notify(dt,{action:"updateCellValue",address:this.editCellData.addr,value:this.editCellData.value});var f=j(u[0],u[1],c,!0),g=this.getRefreshNodeArgs(f);this.editCellData.value=g.value,f&&f.formula&&(this.editCellData.formula=f.formula),f.wrap&&this.parent.notify(Nt,{range:u,wrap:!0,sheet:c}),e&&this.parent.refreshNode(this.editCellData.element,g)}return this.parent.allowConditionalFormat&&this.parent.notify(yi,{rowIdx:o[0],colIdx:o[1],cell:a}),n},e.prototype.refreshDependentCellValue=function(e,t,r){if(e&&t&&(e--,t--,(this.editCellData.rowIndex!==e||this.editCellData.colIndex!==t)&&this.parent.activeSheetIndex===r)){var n=this.parent.getCell(e,t);if(n){var i=j(e,t,de(this.parent,r)),o=this.getRefreshNodeArgs(i);this.parent.refreshNode(n,o)}}},e.prototype.getRefreshNodeArgs=function(e){var t=(e=e||{})&&e.format?e.format:"",r={value:e.value,format:t,onLoad:!0,formattedText:"",isRightAlign:!1,type:"General"};return this.parent.notify(nt,r),r.formattedText=this.parent.allowNumberFormatting?r.formattedText:r.value,{isRightAlign:r.isRightAlign,result:r.formattedText,type:r.type,value:r.value,curSymbol:r.curSymbol}},e.prototype.endEdit=function(e,t){if(void 0===e&&(e=!1),e&&this.refreshEditor(this.editCellData.oldValue,!1,!0,!1,!1),this.triggerEvent("beforeCellSave"))t.preventDefault();else{this.updateEditedValue()?(this.triggerEvent("cellSave",t),this.resetEditState(),this.focusElement()):t&&t.preventDefault()}},e.prototype.cancelEdit=function(e,t,r){void 0===e&&(e=!0),void 0===t&&(t=!0),this.refreshEditor(this.editCellData.oldValue,e,!1,!1,!1),t&&this.triggerEvent("cellSave",r),this.resetEditState(),this.focusElement()},e.prototype.focusElement=function(){this.parent.element.focus(),this.parent.notify(Kr,[{enable:!0}])},e.prototype.triggerEvent=function(e,t){var r={element:this.editCellData.element,value:this.editCellData.value,oldValue:this.editCellData.oldValue,address:this.editCellData.fullAddr};return"cellSave"===e&&(this.editCellData.formula&&(r.formula=this.editCellData.formula),r.originalEvent=t,this.parent.notify(Wn,{eventArgs:r,action:"cellSave"})),"cellSave"!==e&&(r.cancel=!1),this.parent.trigger(e,r),r.cancel},e.prototype.altEnter=function(){var e,t,r,n,i=window.getSelection(),o=i.anchorNode,s=document.createRange();0===(n=3===o.nodeType?i.anchorOffset:o.textContent.length)&&o.textContent.length>0&&(n=o.textContent.length),t=(e=o.textContent).slice(0,n),r=e.slice(n)||" ",o.textContent=t+"\n"+r,s=document.createRange(),3===o.nodeType?(s.setStart(o,n+1),s.setEnd(o,n+1)):1===o.nodeType&&(s.setStart(o.firstChild,n+1),s.setEnd(o.firstChild,n+1)),i.removeAllRanges(),i.addRange(s)},e.prototype.resetEditState=function(e){void 0===e&&(e=!0),e&&(P(this.editorElem.textContent)&&this.parent.notify(wi,null),this.editCellData.element.classList.remove("e-ss-edited"),this.editorElem.textContent="",this.editorElem.removeAttribute("style"),this.editorElem.classList.remove("e-right-align")),this.editCellData={},this.parent.isEdit=this.isEdit=!1,this.isCellEdit=!0,this.parent.notify(Nr,{action:"endEdit"})},e.prototype.refSelectionRender=function(){P(this.editorElem.textContent)&&this.parent.notify(Si,{range:this.editorElem.textContent,formulaSheetIdx:this.editCellData.sheetIndex})},e.prototype.initiateRefSelection=function(){var e=this.editCellData.fullAddr.substring(0,this.editCellData.fullAddr.indexOf("!")),t=this.parent.element.querySelector(".e-formula-bar").value;this.parent.getActiveSheet().name===e&&P(this.editCellData.value)?(this.startEdit(this.editCellData.addr,t,!1),this.parent.notify(Si,{range:this.editCellData.value,formulaSheetIdx:this.editCellData.sheetIndex}),this.parent.element.querySelector(".e-spreadsheet-edit").innerHTML=t,this.initiateCurPosition()):this.initiateCurPosition()},e.prototype.addressHandler=function(e){var t={action:"getCurrentEditValue",editedValue:""};this.parent.notify(Fr,t);var r=e.range,n=this.editCellData.fullAddr.substring(0,this.editCellData.fullAddr.indexOf("!")),i=this.editCellData.sheetIndex,o=this.parent.element.querySelector(".e-spreadsheet-edit");if(this.parent.getActiveSheet().name!==n&&(r="'"+this.parent.getActiveSheet().name+"'!"+r),e.isSelect)this.parent.notify(Si,{range:t.editedValue+r,formulaSheetIdx:i});else{var s=t.editedValue;s.indexOf(")")===s.length-1?o.textContent=s.substring(0,s.length-1)+r+s.substring(s.length-1):o.textContent=s+r}},e.prototype.updateFormulaBarValue=function(){var e=this.editCellData.value,t=this.parent.getActiveSheet().selectedRange,r=this.parent.element.querySelector(".e-formula-bar");if(e&&P(e)){var n=this.editCellData.fullAddr.substring(0,this.editCellData.fullAddr.indexOf("!"));this.parent.getActiveSheet().name!==n&&(t="'"+this.parent.getActiveSheet().name+"'!"+t),e.indexOf(")")===e.length-1?r.value=e.substring(0,e.length-1)+t+e.substring(e.length-1):r.value=e+t}},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(){var e=this.parent.element.querySelector(".e-spreadsheet-edit");if(e.innerText){var t=document.createRange();e.innerText.indexOf(")")===e.innerText.length-1?(t.setStart(e.childNodes[0],e.innerText.length-1),t.setEnd(e.childNodes[0],e.innerText.length-1)):(t.setStart(e.childNodes[0],e.innerText.length),t.setEnd(e.childNodes[0],e.innerText.length));var r=window.getSelection();r.removeAllRanges(),r.addRange(t)}if(this.editCellData.sheetIndex!==this.parent.getActiveSheet().id-1){var n=this.parent.element.querySelector(".e-formula-bar");if(n.value){var i=n.value.length;n.value.indexOf(")")===i-1?this.setFormulaBarCurPosition(n,i-1,i-1):this.setFormulaBarCurPosition(n,i,i)}}},e}(),Jo=function(){function e(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.invalidOperators=["%"],this.formulaRange=[],this.tableRangesFormula={},this.parent=e,this.addEventListener(),this.mouseMoveEvt=this.mouseMoveHandler.bind(this)}return e.prototype.addEventListener=function(){this.parent.on(Rr,this.init,this),this.parent.on(Ar,this.mouseDownHandler,this),this.parent.on(Vr,this.virtualContentLoadedHandler,this),this.parent.on(Ur,this.cellNavigateHandler,this),this.parent.on(Jr,this.selectRange,this),this.parent.on(fn,this.rowHeightChanged,this),this.parent.on(gn,this.colWidthChanged,this),this.parent.on(di,this.protectHandler,this),this.parent.on(Si,this.initiateFormulaSelection,this),this.parent.on(wi,this.clearBorder,this),this.parent.on(Oi,this.getRowIdxFromClientY,this),this.parent.on(Di,this.getColIdxFromClientX,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(Rr,this.init),this.parent.off(Ar,this.mouseDownHandler),this.parent.off(Vr,this.virtualContentLoadedHandler),this.parent.off(Ur,this.cellNavigateHandler),this.parent.off(Jr,this.selectRange),this.parent.off(fn,this.rowHeightChanged),this.parent.off(gn,this.colWidthChanged),this.parent.off(di,this.protectHandler),this.parent.off(Si,this.initiateFormulaSelection),this.parent.off(wi,this.clearBorder),this.parent.off(Oi,this.getRowIdxFromClientY),this.parent.off(Di,this.getColIdxFromClientX))},e.prototype.rowHeightChanged=function(e){var t=this;ve(function(){var r=t.getActiveCell(),n=c(t.parent.getActiveSheet().activeCell)[0];if(n===e.rowIdx&&r?r.style.height=parseInt(r.style.height,10)+e.threshold+"px":n>e.rowIdx&&r&&(r.style.top=parseInt(r.style.top,10)+e.threshold+"px"),r=t.getSelectionElement()){var i=S(d(t.parent.getActiveSheet().selectedRange)),o=i[0],s=i[2];o<=e.rowIdx&&s>=e.rowIdx&&r?r.style.height=parseInt(r.style.height,10)+e.threshold+"px":o>e.rowIdx&&r&&(r.style.top=parseInt(r.style.top,10)+e.threshold+"px")}})},e.prototype.colWidthChanged=function(e){var t=this;ve(function(){var r=t.getActiveCell(),n=c(t.parent.getActiveSheet().activeCell)[1];n===e.colIdx&&r?r.style.width=parseInt(r.style.width,10)+e.threshold+"px":n>e.colIdx&&r&&(r.style.left=parseInt(r.style.left,10)+e.threshold+"px"),r=t.getSelectionElement();var i=S(d(t.parent.getActiveSheet().selectedRange)),o=i[1],s=i[3];o<=e.colIdx&&s>=e.colIdx&&r?r.style.width=parseInt(r.style.width,10)+e.threshold+"px":o>e.colIdx&&r&&(r.style.left=parseInt(r.style.left,10)+e.threshold+"px")})},e.prototype.selectRange=function(e){this.selectRangeByIdx("Single"===this.parent.selectionSettings.mode?e.indexes.slice(0,2).concat(e.indexes.slice(0,2)):e.indexes,null,null,null,null,e.skipChecking)},e.prototype.init=function(){this.parent.getActiveSheet();var e=d(this.parent.getActiveSheet().selectedRange),t=S(e),r=c(this.parent.getActiveSheet().activeCell),n=t[0]<=r[0]&&t[2]>=r[0]&&t[1]<=r[1]&&t[3]>=r[1];this.createSelectionElement(),this.selectRangeByIdx(e,null,null,n,!0)},e.prototype.createSelectionElement=function(){var e=this.parent.getMainContent(),t=this.parent.createElement("div",{className:"e-selection"}),r=this.parent.createElement("div",{className:"e-active-cell"});e.appendChild(t),e.appendChild(r)},e.prototype.mouseDownHandler=function(e){var r={action:"getCurrentEditValue",editedValue:""};this.parent.notify(Fr,r);var n=P(r.editedValue);if(!this.parent.isEdit||n){var i=document.getElementById(this.parent.element.id+"_overlay");if(e.target.className.indexOf("e-ss-overlay")>-1)return;if(i&&i.classList.remove("e-ss-overlay-active"),this.parent.getActiveSheet().isProtected&&!this.parent.getActiveSheet().protectSettings.selectCells)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,a=this.getRowIdxFromClientY({clientY:Le(e)}),l=this.getColIdxFromClientX({clientX:De(e)}),h=c(o.activeCell),p=o.showHeaders&&this.parent.getRowHeaderContent().contains(e.target),d=o.showHeaders&&this.parent.getColumnHeaderContent().contains(e.target);if(3===e.which&&this.isSelected(a,l))return;if("Multiple"===s&&(!Oe(e)&&(!Fe(e)||Fe(e)&&h[0]===a&&h[1]===l)||d||p)&&(document.addEventListener(Ae().split(" ")[0],this.mouseMoveEvt),t.Browser.isPointer||document.addEventListener(Ae().split(" ")[1],this.mouseMoveEvt,{passive:!1})),Oe(e)||t.EventHandler.add(document,Te(),this.mouseUpHandler,this),Fe(e)&&!d&&!p)return void(this.touchEvt=e);p?(this.isRowSelected=!0,e.shiftKey&&"Single"!==s||(this.startCell=[a,0]),this.selectRangeByIdx([this.startCell[0],0,a,o.colCount-1],e)):d?(this.isColSelected=!0,e.shiftKey&&"Single"!==s||(this.startCell=[0,l]),this.selectRangeByIdx([0,this.startCell[1],o.rowCount-1,l],e)):e.target.classList.contains("e-selectall")?(this.startCell=[0,0],this.selectRangeByIdx([].concat(this.startCell,[o.rowCount-1,o.colCount-1]),e)):e.target.classList.contains("e-sheet-content")||(e.shiftKey&&"Single"!==s||(this.startCell=[a,l]),this.selectRangeByIdx([].concat(this.startCell?this.startCell:c(o.activeCell),[a,l]),e)),this.parent.isMobileView()&&(this.parent.element.classList.add("e-mobile-focused"),this.parent.renderModule.setSheetPanelSize())}}if(n&&(e.target.classList.contains("e-cell")||e.target.classList.contains("e-header-cell"))&&this.parent.isEdit){var u=this.parent.getActiveSheet().selectedRange;this.parent.notify(Ei,{range:u,isSelect:!1})}},e.prototype.mouseMoveHandler=function(e){var t=this,r=this.parent.getActiveSheet();Ne(e)&&e.preventDefault();var n={action:"getCurrentEditValue",editedValue:""};this.parent.notify(Fr,n);var i=P(n.editedValue),o=this.getScrollContent(),s=o.getBoundingClientRect(),a=De(e),l=Le(e),h=this.isRowSelected?r.colCount-1:this.getColIdxFromClientX({clientX:Math.min(a,s.right)}),p=this.isColSelected?r.rowCount-1:this.getRowIdxFromClientY({clientY:Math.min(l,s.bottom)}),u=d(r.selectedRange),f={range:[p,h,p,h]};if(this.parent.notify(ar,f),f.range[2]!==u[2]||f.range[3]!==u[3]){var g=l>s.bottom&&p<r.rowCount,m=l<s.top&&p>=0&&!this.isColSelected,v=a>s.right&&h<r.colCount,y=a<s.left&&h>=0&&!this.isRowSelected;if(this.clearInterval(),i||this.isColSelected||this.isRowSelected||(u=c(r.activeCell)),g||m||v||y?this.scrollInterval=setInterval(function(){if((g||m)&&!t.isColSelected){if((p=t.getRowIdxFromClientY({clientY:g?s.bottom:s.top}))>=r.rowCount)return void t.clearInterval();o.scrollTop+=(g?1:-1)*Z(r,p)}if((v||y)&&!t.isRowSelected){if((h=t.getColIdxFromClientX({clientX:v?s.right:s.left}))>=r.colCount)return void t.clearInterval();o.scrollLeft+=(v?1:-1)*ne(r,h)}t.selectRangeByIdx([].concat(u[0],u[1],[p,h]),e)},100):this.selectRangeByIdx([].concat(u[0],u[1],[p,h]),e),i){var C=this.parent.getActiveSheet().selectedRange;this.parent.notify(Ei,{range:C,isSelect:!1})}}},e.prototype.mouseUpHandler=function(e){var r=this.getRowIdxFromClientY({clientY:Le(e)}),n=this.getColIdxFromClientX({clientX:De(e)});this.clearInterval(),!Oe(e)||this.isColSelected||this.isRowSelected||this.getRowIdxFromClientY({clientY:Le(this.touchEvt)})!==r||this.getColIdxFromClientX({clientX:De(this.touchEvt)})!==n||this.mouseDownHandler(e),this.parent.trigger("select",{range:this.parent.getActiveSheet().selectedRange}),document.removeEventListener(Ae().split(" ")[0],this.mouseMoveEvt),t.Browser.isPointer||document.removeEventListener(Ae().split(" ")[1],this.mouseMoveEvt),t.EventHandler.remove(document,Te(),this.mouseUpHandler),this.parent.notify(jr,e);var i={action:"getCurrentEditValue",editedValue:""};this.parent.notify(Fr,i);P(i.editedValue)&&this.parent.isEdit&&!e.target.classList.contains("e-spreadsheet-edit")&&this.parent.notify(xi,{})},e.prototype.isSelected=function(e,t){var r=S(d(this.parent.getActiveSheet().selectedRange));return r[0]<=e&&e<=r[2]&&r[1]<=t&&t<=r[3]},e.prototype.virtualContentLoadedHandler=function(){var e=this.parent.getActiveSheet(),t=d(e.selectedRange);this.isColSelected&&this.isRowSelected?this.selectRangeByIdx([0,0,e.rowCount-1,e.colCount-1],null,!0):this.isColSelected?this.selectRangeByIdx([0,t[1],e.rowCount-1,t[3]],null,!0):this.isRowSelected?this.selectRangeByIdx([t[0],0,t[2],e.colCount-1],null,!0):this.highlightHdr(t,t[0]>=this.parent.viewport.topIndex||t[2]>=this.parent.viewport.topIndex,t[1]>=this.parent.viewport.leftIndex||t[3]>=this.parent.viewport.leftIndex)},e.prototype.clearInterval=function(){clearInterval(this.scrollInterval),this.scrollInterval=null},e.prototype.getScrollContent=function(){return this.parent.getMainContent()},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||this.selectRangeByIdx(e.range.concat(e.range))},e.prototype.getColIdxFromClientX=function(e){var t=0,r=this.parent.getActiveSheet(),n=this.parent.getMainContent().getBoundingClientRect(),i=0;i=e.isImage?e.clientX:(this.parent.enableRtl?n.right-e.clientX:e.clientX-n.left)+this.getScrollLeft();for(var o=0;;o++)if(t+=ie(r,o),i<t)return e.clientX=o,o},e.prototype.getRowIdxFromClientY=function(e){var t=0,r=this.parent.getActiveSheet(),n=0;n=e.isImage?e.clientY:e.clientY-this.parent.getMainContent().getBoundingClientRect().top+this.parent.getMainContent().scrollTop;for(var i=0;;i++)if(t+=Z(r,i),n<t)return e.clientY=i,i},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"})),Ee(t,e,this.parent.getActiveSheet(),!1),this.parent.getMainContent().appendChild(t)}},e.prototype.selectRangeByIdx=function(e,r,n,i,o,s){var a={action:"getCurrentEditValue",editedValue:""};this.parent.notify(Fr,a);var l,h=P(a.editedValue),p=this.getSelectionElement(),c=this.parent.getActiveSheet(),u=this.parent.element.querySelector(".e-formularef-indicator"),f={range:[].slice.call(e),isActiveCell:!1,skipChecking:s};this.isColSelected||this.isRowSelected||this.parent.notify(sr,f),e!==f.range&&(l=!0);var m={range:g(e=f.range),cancel:!1};if(this.parent.trigger("beforeSelect",m),!0!==m.cancel){if(h&&u&&u.parentElement.removeChild(u),w(e)||f.isActiveCell)p&&p.classList.add("e-hide"),h&&r&&!r.target.classList.contains("e-spreadsheet-edit")&&this.parent.isEdit&&(this.parent.notify(Ei,{range:g(e),isSelect:!0}),this.initFormulaReferenceIndicator(e));else if(h)r&&!r.target.classList.contains("e-spreadsheet-edit")&&this.parent.isEdit&&(this.parent.notify(Ei,{range:g(e),isSelect:!0}),this.initFormulaReferenceIndicator(e));else{p&&p.classList.remove("e-hide");var v=this.getOffset(e[2],e[3]);l&&(v.left={idx:0,size:0}),Ee(p,e,c,this.parent.enableRtl,v)}var y={action:"getCurrentEditSheetIdx",sheetIndex:null};this.parent.notify(Fr,y),h?o||pe(this.parent,g(e),c):pe(this.parent,g(e),c),this.UpdateRowColSelected(e),this.highlightHdr(e),n||r&&("mousemove"===r.type||Ne(r))||(h?y.sheetIndex===this.parent.getActiveSheet().id-1&&o?(i=!0,this.updateActiveCell(i?d(c.activeCell):e,o)):this.parent.isEdit||this.updateActiveCell(i?d(c.activeCell):e,o):this.updateActiveCell(i?d(c.activeCell):e,o)),t.isNullOrUndefined(r)&&(r={type:"mousedown"}),h?o||this.parent.notify(qr,r):this.parent.notify(qr,r),this.parent.notify(mi,{}),this.parent.notify(Fi,{})}},e.prototype.UpdateRowColSelected=function(e){var t=this.parent.getActiveSheet();this.isRowSelected=0===e[1]&&e[3]===t.colCount-1,this.isColSelected=0===e[0]&&e[2]===t.rowCount-1},e.prototype.updateActiveCell=function(e,t){var r,n,i,o=this.parent.getActiveSheet(),s=d(o.topLeftCell);this.isColSelected?(r=s[0],n=e[1],this.isRowSelected&&(n=s[1])):(r=e[0],n=e[1],this.isRowSelected&&(n=s[1]));var a={range:[r,n].concat([r,n])};if(this.parent.notify(ar,a),e!==a.range&&(i=!0),e=a.range,o.activeCell!==f(e[0],e[1])||t){if(o.activeCell=f(e[0],e[1]),this.getActiveCell()){var l=this.getOffset(e[2],e[3]);i&&(l.left={idx:0,size:0}),Ee(this.getActiveCell(),e,o,this.parent.enableRtl,l)}this.parent.notify(ft,null)}else Ee(this.getActiveCell(),e,o,this.parent.enableRtl,this.getOffset(e[2],e[3]))},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(){return this.parent.element.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){if(void 0===r&&(r=!0),void 0===n&&(n=!0),this.parent.getActiveSheet().showHeaders){var i=this.parent.getActiveSheet(),o=[],s=[],a=S(e);a=this.getHdrIndexes(a);var l=this.parent.element.getElementsByClassName("e-select-all-cell")[0];t.removeClass(this.getSheetElement().querySelectorAll(".e-highlight"),"e-highlight"),t.removeClass(this.getSheetElement().querySelectorAll(".e-prev-highlight"),"e-prev-highlight"),l&&t.removeClass([l],["e-prev-highlight-right","e-prev-highlight-bottom"]),r&&(o=[].slice.call(this.parent.getRowHeaderContent().querySelectorAll("td")).slice(a[0],a[2]+1)),n&&(s=[].slice.call(this.parent.getColumnHeaderContent().querySelectorAll("th")).slice(a[1],a[3]+1)),i.isProtected&&!i.protectSettings.selectCells?t.removeClass([].concat(o,s),"e-highlight"):t.addClass([].concat(o,s),"e-highlight"),o.length&&o[0].parentElement.previousElementSibling&&o[0].parentElement.previousElementSibling.classList.add("e-prev-highlight"),s.length&&s[0].previousElementSibling&&s[0].previousElementSibling.classList.add("e-prev-highlight"),this.isRowSelected&&this.isColSelected&&(i.isProtected&&!i.protectSettings.selectCells?document.getElementById(this.parent.element.id+"_select_all").classList.remove("e-highlight"):document.getElementById(this.parent.element.id+"_select_all").classList.add("e-highlight")),l&&(0===a[0]&&l.classList.add("e-prev-highlight-bottom"),0===a[1]&&l.classList.add("e-prev-highlight-right"))}},e.prototype.protectHandler=function(){var e=d(this.parent.getActiveSheet().selectedRange),t=S(e),r=c(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.getHdrIndexes=function(e){if(this.parent.scrollSettings.enableVirtualization){var t=[],r=this.parent.hiddenCount(this.parent.viewport.topIndex,e[0]),n=this.parent.hiddenCount(this.parent.viewport.leftIndex,e[1],"columns");return t[0]=this.isColSelected?e[0]:e[0]-this.parent.viewport.topIndex<0?0:e[0]-r-this.parent.viewport.topIndex,t[1]=this.isRowSelected?e[1]:e[1]-this.parent.viewport.leftIndex<0?0:e[1]-n-this.parent.viewport.leftIndex,t[2]=this.isColSelected?this.parent.viewport.rowCount+2*this.parent.getThreshold("row"):e[2]-this.parent.hiddenCount(e[0],e[2])-r-this.parent.viewport.topIndex,t[3]=this.isRowSelected?this.parent.viewport.colCount+2*this.parent.getThreshold("col"):e[3]-this.parent.hiddenCount(e[1],e[3],"columns")-n-this.parent.viewport.leftIndex,t}return e},e.prototype.initiateFormulaSelection=function(e){this.processFormulaEditRange(e.range,e.formulaSheetIdx)},e.prototype.processFormulaEditRange=function(e,t){var r,n,i=t,o=0,s=this.parseFormula(e),a=s.length,l=0,h=[["e-vborderright","e-vborderbottom"],["e-pborderright","e-pborderbottom"],["e-cborderright","e-cborderbottom"],["e-gborderright","e-gborderbottom"],["e-oborderright","e-oborderbottom"],["e-bborderright","e-bborderbottom"]];for(this.clearBorder(),n=this.parent.getActiveSheet().id-1;o<a&&(r=s[o],!(this.invalidOperators.indexOf(r)>-1));){if(V(r.toUpperCase())){if(r=r.replace(/\$/g,""),o>0&&s[o-1].indexOf("!")===s[o-1].length-1){var p=s[o-1].split("!");i=se(this.parent,p[0].substring(1,p[0].length-1))}":"===s[o+1]&&s[++o+1]&&V(s[o+1].toUpperCase())&&(r=r+":"+s[o+1],o++),n===i&&this.updateFormulaEditRange(r,l,h),i=t,l++}o++}},e.prototype.updateFormulaEditRange=function(e,t,r){var n=d(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.focusBorder=function(e,t,r){var n=S([e.rowIndex,e.colIndex,t.rowIndex,t.colIndex]),i=n[0],o=n[1],s=n[2],a=n[3];i&&this.getEleFromRange([i-1,o,i-1,a]).forEach(function(e){e&&(e.classList.add(r[1]),e.classList.add("e-formularef-selection"))}),this.getEleFromRange([i,a,s,a]).forEach(function(e){e&&(e.classList.add(r[0]),e.classList.add("e-formularef-selection"))}),this.getEleFromRange([s,o,s,a]).forEach(function(e){e&&(e.classList.add(r[1]),e.classList.add("e-formularef-selection"))}),o&&this.getEleFromRange([i,o-1,s,o-1]).forEach(function(e){e&&(e.classList.add(r[0]),e.classList.add("e-formularef-selection"))})},e.prototype.getEleFromRange=function(e,t){this.parent.getActiveSheet().index;this.parent.getActiveSheet();var r,n,i,o,s=e[0],a=e[1],l=e[2],h=e[3],p=[],d=[];if(s>l&&(i=s,s=l,l=i),a>h&&(i=a,a=h,h=i),this.parent.scrollSettings.enableVirtualization)for(r=s;r<=l;r++)if((n=r)>-1){var c=this.parent.getRow(n);c&&(o=c.getElementsByClassName("e-cell"),p=h===a?[o[h]]:this.getRowCells(o,a,h+1),this.merge(d,p))}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(){for(var e=this.parent.element.getElementsByClassName("e-formularef-selection"),t=0;t<e.length;t++)for(var r=e[t],n=["e-vborderright","e-vborderbottom","e-pborderright","e-pborderbottom","e-cborderright","e-cborderbottom","e-gborderright","e-gborderbottom","e-oborderright","e-oborderbottom","e-bborderright","e-bborderbottom"],i=0;i<n.length;i++)r.classList.remove(n[i]);for(t=0;t<e.length;t++)r=e[t]},e.prototype.parseFormula=function(e){var t,r,n,i=0,o=[],s=(e=this.markSpecialChar(e.replace("=",""))).split(/\(|\)|=|\^|>|<|,|:|\+|-|\*|\/|%|&/g);for(n=s.length;i<n;)if(t=s[i]){if(1===t.length)o.push(this.isUniqueChar(t)?this.getUniqueCharVal(t):t);else if(r=t[0],t.indexOf("!")>0){this.isUniqueChar(r)&&(o.push(this.getUniqueCharVal(r)),t=t.substr(1));var a=t.indexOf("!")+1;o.push(t.substr(0,a)),o.push(t.substr(a))}else this.isUniqueChar(r)?(o.push(this.getUniqueCharVal(r)),o.push(t.substr(1))):o.push(t);i++}else i++;return o},e.prototype.isUniqueChar=function(e){var t=e.charCodeAt(e.charAt[0]);return t>=129&&t<=142},e.prototype.getUniqueCharVal=function(e){switch(e){case this.uniqueOBracket:return"(";case this.uniqueCBracket:return")";case this.uniqueCOperator:return":";case this.uniqueSOperator:return"-";case this.uniquePOperator:return"+";case this.uniqueMOperator:return"*";case this.uniqueDOperator:return"/";case this.uniqueModOperator:return"%";case this.uniqueCSeparator:return",";case this.uniqueConcateOperator:return"&";case this.uniqueEqualOperator:return"=";case this.uniqueExpOperator:return"^";case this.uniqueLTOperator:return"<";case this.uniqueGTOperator:return">"}return""},e.prototype.markSpecialChar=function(e){return e=e.replace(/\(/g,"("+this.uniqueOBracket).replace(/\)/g,")"+this.uniqueCBracket),e=e.replace(/,/g,","+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)},e.prototype.getModuleName=function(){return"selection"},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e}(),Zo=function(){function e(e){this.parent=e,this.addEventListener(),this.initProps()}return e.prototype.onContentScroll=function(e){var t,r,n=this.parent.getMainContent(),i=e.scrollLeft||n.scrollLeft,o=e.scrollTop||n.scrollTop,s=this.parent.enableRtl?this.initScrollValue-i:i;if(this.prevScroll.scrollLeft!==s){var a=s>this.prevScroll.scrollLeft;r=this.offset.left.size,this.offset.left=this.getColOffset(s,a,e.skipHidden),this.parent.getActiveSheet().showHeaders&&(this.parent.getColumnHeaderContent().scrollLeft=i),t={cur:this.offset.left,prev:{idx:this.leftIndex,size:r},increase:a,preventScroll:e.preventScroll},this.parent.notify(Mr,t),this.updateTopLeftCell(a),this.parent.scrollSettings.enableVirtualization||!a||this.parent.scrollSettings.isFinite||this.updateNonVirtualCols(),this.leftIndex=t.prev.idx,this.prevScroll.scrollLeft=s}if(this.prevScroll.scrollTop!==o){var l=o>this.prevScroll.scrollTop;r=this.offset.top.size,this.offset.top=this.getRowOffset(o,l),this.parent.getActiveSheet().showHeaders&&(this.parent.getRowHeaderContent().scrollTop=o),t={cur:this.offset.top,prev:{idx:this.topIndex,size:r},increase:l,preventScroll:e.preventScroll},this.parent.notify(Br,t),this.updateTopLeftCell(l),this.parent.scrollSettings.enableVirtualization||!l||this.parent.scrollSettings.isFinite||this.updateNonVirtualRows(),this.topIndex=t.prev.idx,this.prevScroll.scrollTop=o}},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({colIndex:0,direction:"first",refresh:"RowPart"},f(e.rowCount,0)+":"+f(e.rowCount+t-1,e.colCount-1)),e.rowCount+=t)},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"},f(0,e.colCount)+":"+f(e.rowCount-1,e.colCount+t-1)),e.colCount+=t)},e.prototype.updateTopLeftCell=function(e){var t=this.offset.top.idx,r=this.offset.left.idx;if(!e){var n=this.parent.getActiveSheet();t=Xe(n,t,!0),r=Xe(n,r,!0,"columns")}this.parent.getActiveSheet().topLeftCell=f(t,r)},e.prototype.getRowOffset=function(e,t){var r,n=this.offset.top.size,i=this.parent.getActiveSheet(),o=t?this.offset.top.idx+1:this.offset.top.idx?this.offset.top.idx-1:0;if(this.parent.scrollSettings.isFinite){if(r=i.rowCount,t&&o+this.parent.viewport.rowCount+this.parent.getThreshold("row")>=r)return{idx:this.offset.top.idx,size:this.offset.top.size}}else r=1/0;for(;o<r;)if(t){if((n+=Z(i,o-1))===e)return{idx:o,size:n};if(n>e)return{idx:o-1,size:n-Z(i,o-1)};o++}else{if(0===n)return{idx:0,size:0};if((n-=Z(i,o))===e)return{idx:o,size:n};if(n<e)return(n+=Z(i,o))>e?{idx:o,size:n-Z(i,o)}:{idx:o+1,size:n};o--}return{idx:this.offset.top.idx,size:this.offset.top.size}},e.prototype.getColOffset=function(e,t,r){var n,i=this.offset.left.size,o=this.parent.getActiveSheet(),s=t?this.offset.left.idx+1:this.offset.left.idx-1;if(this.parent.scrollSettings.isFinite){if(n=o.colCount,t&&s+this.parent.viewport.colCount+this.parent.getThreshold("col")>=n)return{idx:this.offset.left.idx,size:this.offset.left.size}}else n=1/0;for(;s<n;)if(t){if((i+=ne(o,s-1,r))===e)return{idx:s,size:i};if(i>e)return{idx:s-1,size:i-ne(o,s-1,r)};s++}else{if(0===i)return{idx:0,size:0};if((i-=ne(o,s,r))===e)return{idx:s,size:i};if(i<e)return(i+=ne(o,s,r))>e?{idx:s,size:i-ne(o,s,r)}:{idx:s+1,size:i};s--}return{idx:this.offset.left.idx,size:this.offset.left.size}},e.prototype.contentLoaded=function(){this.onScroll=this.onContentScroll.bind(this),this.setScrollEvent(),this.parent.enableRtl&&(this.initScrollValue=this.parent.getMainContent().scrollLeft)},e.prototype.setScrollEvent=function(e){void 0===e&&(e={set:!0}),e.set?t.EventHandler.add(this.parent.getMainContent(),"scroll",this.onScroll,this):t.EventHandler.remove(this.parent.getMainContent(),"scroll",this.onScroll)},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.getThreshold=function(){return"mozilla"===t.Browser.info.name?.5:1},e.prototype.setPadding=function(){if(this.parent.allowScrolling){var e=this.parent.getColumnHeaderContent(),t=this.parent.getRowHeaderContent(),r=be()-this.getThreshold(),n=this.parent.enableRtl?{padding:"paddingLeft",border:"borderLeftWidth"}:{padding:"paddingRight",border:"borderRightWidth"};r>0&&(e.parentElement.style[n.padding]=r+"px",e.style[n.border]="1px",t.style.marginBottom=r+"px")}},e.prototype.addEventListener=function(){this.parent.on(Rr,this.contentLoaded,this),this.parent.on(vn,this.onContentScroll,this),this.parent.on(yn,this.initProps,this),this.parent.on(Tr,this.destroy,this),this.parent.on(Jn,this.setScrollEvent,this)},e.prototype.destroy=function(){t.EventHandler.remove(this.parent.getMainContent(),"scroll",this.onScroll),this.removeEventListener(),this.parent=null},e.prototype.removeEventListener=function(){this.parent.off(Rr,this.contentLoaded),this.parent.off(vn,this.onContentScroll),this.parent.off(yn,this.initProps),this.parent.off(Tr,this.destroy),this.parent.off(Jn,this.setScrollEvent)},e}(),Qo=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,o,s,a,l=n.appendChild(this.parent.createElement("div",{className:"e-virtualtrack"}));this.parent.sheets.length>this.scroll.length&&this.initScroll();var h=this.parent.viewport.rowCount+1+2*this.parent.getThreshold("row");r.rowCount>h||r.usedRange.rowIndex>h-1?(!this.parent.scrollSettings.isFinite&&r.rowCount<=r.usedRange.rowIndex&&(r.rowCount=r.usedRange.rowIndex+1),this.setScrollCount(r.rowCount,"row"),s=ee(r,0,this.scroll[this.parent.activeSheetIndex].rowCount-1)):(this.parent.scrollSettings.isFinite||(r.rowCount=h),this.scroll[this.parent.activeSheetIndex].rowCount=r.rowCount,s=1),h=this.parent.viewport.colCount+1+2*this.parent.getThreshold("col");var p;r.colCount>h||r.usedRange.colIndex>h-1?(!this.parent.scrollSettings.isFinite&&r.colCount<=r.usedRange.colIndex&&(r.colCount=r.usedRange.colIndex+1),p=ie(r,0,h-1),this.setScrollCount(r.colCount,"col"),a=p+ie(r,h,this.scroll[this.parent.activeSheetIndex].colCount-1)):(this.parent.scrollSettings.isFinite||(r.colCount=h),p=ie(r,0,r.colCount-1),this.scroll[this.parent.activeSheetIndex].colCount=r.colCount,a=p),e.startColIdx&&(p=ie(r,e.startColIdx,e.startColIdx+h-1)),t.isNullOrUndefined(this.parent.viewport.leftIndex)&&(this.parent.viewport.leftIndex=0),t.isNullOrUndefined(this.parent.viewport.topIndex)&&(this.parent.viewport.topIndex=0),t.isNullOrUndefined(this.translateX)&&(this.translateX=0),t.isNullOrUndefined(this.translateY)&&(this.translateY=0),r.showHeaders&&(n=this.parent.getRowHeaderContent(),this.rowHeader=this.content.cloneNode(),this.rowHeader.appendChild(n.querySelector(".e-table")),n.appendChild(this.rowHeader),o=n.appendChild(l.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),i=n.appendChild(l.cloneNode()),this.colHeader.style.width=p+"px",o.style.height=s+"px",i.style.width=a+"px",this.colHeader.style.transform="translate("+this.translateX+"px, 0px)"),this.content.style.transform="translate("+this.translateX+"px, "+this.translateY+"px)",this.content.style.width=p+"px",l.style.height=s+"px",l.style.width=a+"px"},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)},e.prototype.getRowAddress=function(e){return g([e[0],this.parent.viewport.leftIndex,e[1],this.parent.viewport.rightIndex])},e.prototype.getColAddress=function(e){return g([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,o=this.scroll[this.parent.activeSheetIndex][t+"Count"];if(i<o){if(n[t+"Count"]===o)return;i=o}this.parent.scrollSettings.isFinite||(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),o=this.parent.getThreshold("row");if(i>Math.round(o/2)){var s=void 0,a=void 0,l=void 0;if(t<=o&&!e.increase){if(this.translateY&&n>o&&(this.translateY=0,this.parent.viewport.topIndex=n-o,!e.preventScroll)){if(i<this.parent.viewport.rowCount+o){a=this.parent.viewport.topIndex-1,s=this.parent.skipHidden(0,a)[0],this.parent.viewport.topIndex=s;var h=this.hiddenCount(s,a),p=this.skipHiddenIdx(this.parent.viewport.bottomIndex-(a-s+1-h),e.increase);this.parent.viewport.bottomIndex-=a-s+1-h+this.hiddenCount(p,this.parent.viewport.bottomIndex),this.parent.renderModule.refreshUI({colIndex:this.parent.viewport.leftIndex,rowIndex:s,direction:"last",refresh:"RowPart",skipUpdateOnFirst:!0},this.getRowAddress([0,this.skipHiddenIdx(a,!1)]))}else this.parent.renderModule.refreshUI({rowIndex:0,colIndex:this.parent.viewport.leftIndex,refresh:"Row",skipUpdateOnFirst:!0});this.parent.element.focus()}this.updateScrollCount(o,"row")}if(n<o&&(i=Math.abs(t-o)),t>o){if(l=this.parent.viewport.topIndex,this.parent.viewport.topIndex=t-o,e.increase&&l>this.parent.viewport.topIndex)return void(this.parent.viewport.topIndex=l);if(this.translateY=r-this.getThresholdHeight(this.parent.viewport.topIndex,o),!e.preventScroll){if(i<this.parent.viewport.rowCount+o)if(e.increase){if(s=this.parent.viewport.bottomIndex+1,a=this.parent.viewport.bottomIndex+(this.parent.viewport.topIndex-l),a-=this.hiddenCount(l,this.parent.viewport.topIndex-1),this.parent.viewport.topIndex=this.skipHiddenIdx(this.parent.viewport.topIndex,e.increase),a<=this.parent.viewport.bottomIndex)return;var d=this.parent.skipHidden(s,a);s=d[0],a=this.checkLastIdx(d[1],"row"),this.parent.viewport.bottomIndex=a,this.parent.renderModule.refreshUI({colIndex:this.parent.viewport.leftIndex,rowIndex:s,direction:"first",refresh:"RowPart"},this.getRowAddress([s,a]))}else{a=(s=this.parent.viewport.topIndex)+i-1;h=this.hiddenCount(s,a),p=this.skipHiddenIdx(this.parent.viewport.bottomIndex-(a-s-h),e.increase);this.parent.viewport.bottomIndex-=i-h+this.hiddenCount(p,this.parent.viewport.bottomIndex),s=this.parent.skipHidden(s,a)[0],this.parent.viewport.topIndex=s,this.parent.renderModule.refreshUI({colIndex:this.parent.viewport.leftIndex,rowIndex:s,direction:"last",refresh:"RowPart"},this.getRowAddress([s,a]))}else this.parent.renderModule.refreshUI({rowIndex:this.parent.viewport.topIndex,colIndex:this.parent.viewport.leftIndex,refresh:"Row"});this.updateScrollCount(t,"row",o),this.parent.element.focus()}}e.prev.idx=t}},e.prototype.skipHiddenIdx=function(e,t,r,n){return void 0===r&&(r="rows"),void 0===n&&(n=this.parent.getActiveSheet()),n[r][e]&&n[r][e].hidden&&(t?e++:e--,e=this.skipHiddenIdx(e,t,r,n)),e},e.prototype.hiddenCount=function(e,t,r){void 0===r&&(r="rows");for(var n=0,i=this.parent.getActiveSheet(),o=e;o<=t;o++)i[r][o]&&i[r][o].hidden&&n++;return n},e.prototype.checkLastIdx=function(e,t){if(this.parent.scrollSettings.isFinite){var r=this.parent.getActiveSheet()[t+"Count"]-1;e>r&&(e=r)}return e},e.prototype.onHorizontalScroll=function(e){var t=e.cur.idx,r=e.cur.size,n=e.prev.idx,i=Math.abs(t-n),o=this.parent.getThreshold("col");if(i>Math.round(o/2)){var s=void 0,a=void 0,l=void 0;if(t<=o&&!e.increase){if(this.translateX&&n>o&&(this.translateX=0,this.parent.viewport.leftIndex=n-o,!e.preventScroll)){if(i<this.parent.viewport.colCount+o){a=this.parent.viewport.leftIndex-1,s=this.parent.skipHidden(0,a,"columns")[0],this.parent.viewport.leftIndex=s;var h=this.hiddenCount(s,a,"columns"),p=this.skipHiddenIdx(this.parent.viewport.rightIndex-(a-s+1-h),e.increase,"columns");this.parent.viewport.rightIndex-=a-s+1-h+this.hiddenCount(p,this.parent.viewport.rightIndex,"columns"),this.parent.renderModule.refreshUI({rowIndex:this.parent.viewport.topIndex,colIndex:s,direction:"last",refresh:"ColumnPart",skipUpdateOnFirst:!0},this.getColAddress([0,this.skipHiddenIdx(a,!1,"columns")]))}else this.parent.renderModule.refreshUI({rowIndex:this.parent.viewport.topIndex,colIndex:0,refresh:"Column",skipUpdateOnFirst:!0});this.parent.element.focus()}this.updateScrollCount(o,"col")}if(n<o&&(i=Math.abs(t-o)),t>o){if(l=this.parent.viewport.leftIndex,this.parent.viewport.leftIndex=t-o,e.increase&&l>this.parent.viewport.leftIndex)return void(this.parent.viewport.leftIndex=l);if(this.translateX=r-this.getThresholdWidth(this.parent.viewport.leftIndex,o),!e.preventScroll){if(i<this.parent.viewport.colCount+o)if(e.increase){if(s=this.parent.viewport.rightIndex+1,a=this.parent.viewport.rightIndex+(this.parent.viewport.leftIndex-l),a-=this.hiddenCount(l,this.parent.viewport.leftIndex-1,"columns"),this.parent.viewport.leftIndex=this.skipHiddenIdx(this.parent.viewport.leftIndex,e.increase,"columns"),a<=this.parent.viewport.rightIndex)return;var d=this.parent.skipHidden(s,a,"columns");s=d[0],a=this.checkLastIdx(d[1],"col"),this.parent.viewport.rightIndex=a,this.parent.renderModule.refreshUI({rowIndex:this.parent.viewport.topIndex,colIndex:s,direction:"first",refresh:"ColumnPart"},this.getColAddress([s,a]))}else{a=(s=this.parent.viewport.leftIndex)+i-1;h=this.hiddenCount(s,a,"columns"),p=this.skipHiddenIdx(this.parent.viewport.rightIndex-(a-s-h),e.increase,"columns");this.parent.viewport.rightIndex-=i-h+this.hiddenCount(p,this.parent.viewport.rightIndex,"columns"),s=this.parent.skipHidden(s,a,"columns")[0],this.parent.viewport.leftIndex=s,this.parent.renderModule.refreshUI({rowIndex:this.parent.viewport.topIndex,colIndex:s,direction:"last",refresh:"ColumnPart"},this.getColAddress([s,a]))}else this.parent.renderModule.refreshUI({rowIndex:this.parent.viewport.topIndex,colIndex:this.parent.viewport.leftIndex,refresh:"Column"});this.updateScrollCount(t,"col",o),this.parent.element.focus()}}e.prev.idx=t}},e.prototype.getThresholdHeight=function(e,t){for(var r=0,n=this.parent.getActiveSheet(),i=e;i<e+t;i++)r+=Z(n,i);return r},e.prototype.getThresholdWidth=function(e,t){for(var r=0,n=this.parent.getActiveSheet(),i=e;i<e+t;i++)r+=ne(n,i);return r},e.prototype.translate=function(e){var t=this.parent.getActiveSheet();if("Row"!==e.refresh&&"RowPart"!==e.refresh||(this.content.style.transform="translate("+this.translateX+"px, "+this.translateY+"px)",t.showHeaders&&(this.rowHeader.style.transform="translate(0px, "+this.translateY+"px)")),"Column"===e.refresh||"ColumnPart"===e.refresh){var r=this.parent.enableRtl?-this.translateX:this.translateX;this.content.style.transform="translate("+r+"px, "+this.translateY+"px)",t.showHeaders&&(this.colHeader.style.transform="translate("+r+"px, 0px)")}},e.prototype.updateColumnWidth=function(e){if("Column"===e.refresh){this.content.style.width="";var t=this.content.querySelector("tr").getBoundingClientRect().width;this.parent.getActiveSheet().showHeaders&&(this.colHeader.style.width=t+"px"),this.content.style.width=t+"px"}},e.prototype.updateUsedRange=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");e.index>=this.scroll[this.parent.activeSheetIndex].rowCount?r+=ee(t,this.scroll[this.parent.activeSheetIndex].rowCount,e.index):r-=ee(t,e.index+1,this.scroll[this.parent.activeSheetIndex].rowCount-1),this.scroll[this.parent.activeSheetIndex].rowCount=e.index+1,this.updateVTrack(this.rowHeader,r,"height"),this.scroll[this.parent.activeSheetIndex].rowCount>t.rowCount&&(t.rowCount=this.scroll[this.parent.activeSheetIndex].rowCount)}}else if(e.index>this.scroll[this.parent.activeSheetIndex].colCount){var n=this.getVTrackHeight("width");n+=ie(t,this.scroll[this.parent.activeSheetIndex].colCount,e.index),this.scroll[this.parent.activeSheetIndex].colCount=e.index+1,this.updateVTrack(this.colHeader,n,"width"),this.scroll[this.parent.activeSheetIndex].colCount>t.colCount&&(t.colCount=this.scroll[this.parent.activeSheetIndex].colCount)}}},e.prototype.createHeaderElement=function(e){this.rowHeader=this.content.cloneNode(),this.colHeader=this.rowHeader.cloneNode(),this.rowHeader.style.width="",this.rowHeader.style.transform="translate(0px, "+this.translateY+"px)",this.colHeader.style.transform="translate("+(this.parent.enableRtl?-this.translateX:this.translateX)+"px, 0px)",this.rowHeader.appendChild(e.element.querySelector("table")),e.element.appendChild(this.rowHeader);var t=this.parent.getColumnHeaderContent();this.colHeader.appendChild(t.querySelector("table")),t.appendChild(this.colHeader);var r=this.content.nextElementSibling.cloneNode(),n=r.cloneNode();r.style.width="",n.style.height="",e.element.appendChild(r),t.appendChild(n)},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 parseInt(t,10)},e.prototype.updateVTrackHeight=function(e){var t=this.parent.viewport.rowCount+1+2*this.parent.getThreshold("row");e.rowIdx>=t&&e.rowIdx<this.scroll[this.parent.activeSheetIndex].rowCount&&this.updateVTrack(this.rowHeader,this.getVTrackHeight("height")+e.threshold,"height")},e.prototype.updateVTrackWidth=function(e){if(e.colIdx>=this.parent.viewport.leftIndex&&e.colIdx<=this.parent.viewport.rightIndex){if(this.parent.getActiveSheet().showHeaders){var t=this.parent.getColumnHeaderContent().getElementsByClassName("e-virtualtrack")[0];t.style.width=parseInt(t.style.width,10)+e.threshold+"px"}var r=this.parent.getMainContent().getElementsByClassName("e-virtualtrack")[0];if(r.style.width=parseInt(r.style.width,10)+e.threshold+"px",this.parent.getActiveSheet().showHeaders){var n=this.parent.getColumnHeaderContent().getElementsByClassName("e-virtualable")[0];n.style.width=parseInt(n.style.width,10)+e.threshold+"px"}var i=this.parent.getMainContent().getElementsByClassName("e-virtualable")[0];i.style.width=parseInt(i.style.width,10)+e.threshold+"px"}},e.prototype.updateVTrack=function(e,t,r){this.parent.getActiveSheet().showHeaders&&(e.nextElementSibling.style[r]=t+"px"),this.content.nextElementSibling.style[r]=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.addEventListener=function(){this.parent.on(_r,this.createVirtualElement,this),this.parent.on(Pr,this.translate,this),this.parent.on(Vr,this.updateColumnWidth,this),this.parent.on(Br,this.onVerticalScroll,this),this.parent.on(Mr,this.onHorizontalScroll,this),this.parent.on(ht,this.updateUsedRange,this),this.parent.on(fn,this.updateVTrackHeight,this),this.parent.on(gn,this.updateVTrackWidth,this),this.parent.on(mn,this.createHeaderElement,this),this.parent.on(yn,this.deInitProps,this),this.parent.on(yt,this.sliceScrollProps,this),this.parent.on(vt,this.updateScrollProps,this),this.parent.on(Tr,this.destroy,this)},e.prototype.destroy=function(){this.removeEventListener(),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(_r,this.createVirtualElement),this.parent.off(Pr,this.translate),this.parent.off(Vr,this.updateColumnWidth),this.parent.off(Br,this.onVerticalScroll),this.parent.off(Mr,this.onHorizontalScroll),this.parent.off(ht,this.updateUsedRange),this.parent.off(fn,this.updateVTrackHeight),this.parent.off(gn,this.updateVTrackWidth),this.parent.off(mn,this.createHeaderElement),this.parent.off(yt,this.sliceScrollProps),this.parent.off(vt,this.updateScrollProps),this.parent.off(Tr,this.destroy)},e}(),es=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.addEventListener=function(){this.parent.on(Hr,this.keyDownHandler,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off(Hr,this.keyDownHandler)},e.prototype.keyDownHandler=function(e){if(!this.parent.isEdit&&(document.activeElement.classList.contains("e-spreadsheet")||t.closest(document.activeElement,".e-sheet"))){var r=void 0,n=this.parent.enableRtl,i=this.parent.getActiveSheet(),o={e:e,isFilterCell:!1},s=c(this.parent.getActiveSheet().activeCell);if([9,37,38,39,40].indexOf(e.keyCode)>-1&&e.preventDefault(),e.shiftKey||!e.altKey||38!==e.keyCode&&40!==e.keyCode||this.parent.notify(Yn,o),!e.shiftKey&&(!n&&37===e.keyCode||n&&39===e.keyCode)||e.shiftKey&&9===e.keyCode)if(s[1]>0)s[1]-=1,r=!0;else{var a=this.parent.getMainContent();0===s[1]&&a.scrollLeft&&!n&&(a.scrollLeft=0)}else if(!o.isFilterCell&&!e.shiftKey&&38===e.keyCode||e.shiftKey&&13===e.keyCode)if(s[0]>0)s[0]-=1,r=!0;else{a=this.parent.getMainContent();0===s[0]&&a.scrollTop&&(a.scrollTop=0)}else if(!e.shiftKey&&(!n&&39===e.keyCode||n&&37===e.keyCode)||9===e.keyCode){(l=j(s[0],s[1],i))&&l.colSpan>1&&(s[1]+=l.colSpan-1),s[1]<i.colCount-1&&(s[1]+=1,r=!0)}else if(!o.isFilterCell&&!e.shiftKey&&40===e.keyCode||13===e.keyCode){var l;(l=j(s[0],s[1],i))&&l.rowSpan>1&&(s[0]+=l.rowSpan-1),s[0]<i.rowCount-1&&(s[0]+=1,r=!0)}r&&(this.scrollNavigation(s,!1),i.activeCell=g(s),this.parent.notify(Ur,{range:s}))}e.target.classList.contains("e-sheet-rename")&&(32===e.keyCode?e.stopPropagation():13!==e.keyCode&&27!==e.keyCode||this.parent.notify(bn,e))},e.prototype.scrollNavigation=function(e,t){var r=this.parent.enableRtl?-1:1,n=this.parent.getMainContent(),i=this.parent.getActiveSheet(),o=(c(i.activeCell),c(i.topLeftCell));this.getBottomIdx(o)<=e[0]||t?n.scrollTop+=Z(i,e[0]):o[0]>e[0]&&(n.scrollTop-=Z(i,e[0])),this.getRightIdx(o)<=e[1]||t?n.scrollLeft+=ne(i,e[1])*r:o[1]>e[1]&&(n.scrollLeft-=ne(i,e[1])*r)},e.prototype.getBottomIdx=function(e){for(var t=0,r=this.parent.getActiveSheet(),n=e[0];;n++)if((t+=Z(r,n))>=this.parent.viewport.height-17)return n},e.prototype.getRightIdx=function(e){for(var t=0,r=this.parent.getActiveSheet(),n=this.parent.getMainContent().offsetWidth,i=e[1];;i++)if((t+=ne(r,i))>=n-17)return i},e.prototype.getModuleName=function(){return"keyboardNavigation"},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e}(),ts=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.addEventListener=function(){this.parent.on(Hr,this.keyDownHandler,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off(Hr,this.keyDownHandler)},e.prototype.keyDownHandler=function(e){if(e.ctrlKey){if(t.closest(e.target,".e-find-dlg")||[79,83,65].indexOf(e.keyCode)>-1&&e.preventDefault(),79===e.keyCode)this.parent.element.querySelector("#"+this.parent.element.id+"_fileUpload").click();else if(83===e.keyCode)this.parent.saveUrl&&this.parent.allowSave&&this.parent.save();else if(67===e.keyCode)this.parent.notify("copy",{promise:Promise});else if(75===e.keyCode){var r=c(this.parent.getActiveSheet().activeCell),n=this.parent.sheets[this.parent.getActiveSheet().id-1].rows[r[0]],i=void 0;e.preventDefault(),t.isNullOrUndefined(n)||(i=n.cells[r[1]]),t.isNullOrUndefined(i)&&q(r[0],r[1],this.parent.getActiveSheet(),i,!1),i&&i.hyperlink?this.parent.notify(An,null):this.parent.notify(Rn,null)}else 90===e.keyCode?this.parent.isEdit||(e.preventDefault(),this.parent.notify(Ln,{isUndo:!0})):89===e.keyCode&&(this.parent.isEdit||(e.preventDefault(),this.parent.notify(Ln,{isUndo:!1})));var o=this.parent.sheets[this.parent.getActiveSheet().id-1],s=c(o.activeCell),a=j(s[0],s[1],o),l=a?t.isNullOrUndefined(a.isLocked)?o.isProtected:a.isLocked:o.isProtected;if(!l||!o.isProtected){if(70===e.keyCode){e.preventDefault();var h=document.querySelector(".e-spreadsheet-find-ddb");t.isNullOrUndefined(h)||h.click()}else if(71===e.keyCode)e.preventDefault(),this.parent.notify(ni,null);else if(72===e.keyCode)e.preventDefault(),this.parent.notify(ii,null);else if(88===e.keyCode)this.parent.notify("cut",{promise:Promise});else if(86===e.keyCode)l||this.parent.notify(Zr,{isAction:!0});else if(66===e.keyCode){e.preventDefault();p="bold"===(p=this.parent.getCellStyleValue(["fontWeight"],c(this.parent.getActiveSheet().activeCell)).fontWeight)?"normal":"bold",this.parent.notify(ot,{style:{fontWeight:p},onActionUpdate:!0,refreshRibbon:!0})}else if(73===e.keyCode){e.preventDefault();var p;p="italic"===(p=this.parent.getCellStyleValue(["fontStyle"],c(this.parent.getActiveSheet().activeCell)).fontStyle)?"normal":"italic",this.parent.notify(ot,{style:{fontStyle:p},onActionUpdate:!0,refreshRibbon:!0})}else 85===e.keyCode?(e.preventDefault(),this.parent.notify(at,{style:{textDecoration:"underline"},refreshRibbon:!0})):53===e.keyCode&&(e.preventDefault(),this.parent.notify(at,{style:{textDecoration:"line-through"},refreshRibbon:!0}));e.shiftKey&&76===e.keyCode&&(this.parent.isEdit||(e.preventDefault(),this.parent.applyFilter()))}}27===e.keyCode&&this.parent.notify(Qr,null)},e.prototype.getModuleName=function(){return"keyboardShortcut"},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e}(),rs=function(){function e(e){this.checkHeight=!1,this.parent=e,this.row=e.createElement("tr",{className:"e-row"}),this.parent.on(kr,this.addEventListener,this)}return e.prototype.applyCellFormat=function(e){var t=Object.keys(e.style),r=this.parent.getActiveSheet();if(!(e.lastCell&&Ye(r,e.rowIdx)<=20)||t.length){var n=e.cell||this.parent.getCell(e.rowIdx,e.colIdx);if(n){if(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),this.setTopBorder(e.style.border,n,e.rowIdx,e.colIdx,e.pRow,e.pHRow,e.onActionUpdate,e.first,e.lastCell,e.manualUpdate),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),delete i.borderTop),void 0!==i.borderLeft&&(this.setLeftBorder(e.style.borderLeft,n,e.rowIdx,e.colIdx,e.row,e.onActionUpdate,e.first),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);if(e.isHeightCheckNeeded&&(!r.rows[e.rowIdx]||!r.rows[e.rowIdx].customHeight))if(e.manualUpdate)this.checkHeight||(this.checkHeight=this.isHeightCheckNeeded(e.style,e.onActionUpdate)),this.updateRowHeight(e.rowIdx,e.colIdx,e.lastCell,e.onActionUpdate);else{var o=j(e.rowIdx,e.colIdx,r);if(o&&o.wrap||!this.isHeightCheckNeeded(e.style)||Ge(r,e.rowIdx,e.colIdx,qe(this.parent,e.style)),e.lastCell){var s=Ye(r,e.rowIdx);s>20&&s>Z(r,e.rowIdx)&&je(this.parent,r,s,e.rowIdx,e.row,e.hRow,!1)}}}else this.updateRowHeight(e.rowIdx,e.colIdx,!0,e.onActionUpdate)}},e.prototype.updateRowHeight=function(e,r,n,i,o){if(void 0===o&&(o=0),this.checkHeight){var s=0,a=void 0,l=this.parent.getActiveSheet(),h=j(e,r,l);if(s=qe(this.parent,h&&h.style||this.parent.cellStyle,h&&h.wrap?We(this.parent.getDisplayText(h),ne(l,r),h.style,this.parent.cellStyle):1),h&&!t.isNullOrUndefined(h.value)){if(h.value.toString().indexOf("\n")>-1){var p=void 0,d=h.value.split("\n"),c=0,u=d.length;for(p=0;p<u;p++){var f=We(d[p],ne(l,r),h.style,this.parent.cellStyle);0===f&&(f=1),c+=f}s=qe(this.parent,h.style||this.parent.cellStyle,c)+1}}if(Ge(l,e,r,s+o),n){this.checkHeight=!1;var g=this.parent.getRow(e);if(!g)return;var m=Z(l,e);a=Ye(l,e);(i?a!==m:a>m)&&je(this.parent,l,a,e,g)}}},e.prototype.isHeightCheckNeeded=function(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},e.prototype.setLeftBorder=function(e,t,r,n,i,o,s){if(!s.includes("Column")){var a=this.parent.getCell(r,n-1,i);a?(o&&""!==e&&n===this.parent.viewport.leftIndex&&(this.parent.getMainContent().scrollLeft-=this.getBorderSize(e)),a.style.borderRight=e):t.style.borderLeft=e}},e.prototype.setTopBorder=function(e,t,r,n,i,o,s,a,l,h){if(!a.includes("Row")){var p=this.parent.getCell(r-1,n,i);if(p){if(J(this.parent.getActiveSheet(),r-1)){var d=[Number(p.parentElement.getAttribute("aria-rowindex"))-1,n];if(this.parent.getCellStyleValue(["bottomPriority"],d).bottomPriority)return}s&&""!==e&&this.parent.getActiveSheet().topLeftCell.includes(""+(r+1))&&(this.parent.getMainContent().scrollTop-=this.getBorderSize(e)),this.setThickBorderHeight(e,r-1,n,p,i,o,s,l,h),p.style.borderBottom=e}else t.style.borderTop=e}},e.prototype.setThickBorderHeight=function(e,t,r,n,i,o,s,a,l){var h=e?this.getBorderSize(e):1,p=this.parent.getActiveSheet();if(h>2&&(!p.rows[t]||!p.rows[t].customHeight))if(l)this.checkHeight||(this.checkHeight=!0),this.updateRowHeight(t,r,a,s,h);else{var d=Z(p,t),c=Math.ceil(this.parent.calculateHeight(this.parent.getCellStyleValue(["fontFamily","fontSize"],[t,r]),1,3));c>d&&(je(this.parent,p,c,t,i,o,!1),this.parent.notify(fn,{rowIdx:t,threshold:c-20}))}!s||!a&&this.checkHeight||!(h<3)||p.rows[t]&&p.rows[t].customHeight||(this.checkHeight||(this.checkHeight=!0),this.updateRowHeight(t,r,a,s,h))},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=e.options,o=i.range?i.range.indexOf("!")>0?i.range.split("!")[1]:i.range.split("!")[0]:this.parent.getActiveSheet().selectedRange,s=i.range&&i.range.indexOf("!")>0?se(this.parent,i.range.split("!")[0]):this.parent.activeSheetIndex,a=d(o),l=this.parent.sheets[s],h=a[0],p=a[2],c={range:o,type:i.type,requestType:"clear",sheetIndex:s};if(e.isPublic||this.parent.notify(Gn,{action:"beforeClear",eventArgs:c}),"Clear Formats"===i.type||"Clear All"===i.type)for(;h<=p;h++)for(r=a[1],n=a[3];r<=n;r++){var u=j(h,r,l),f=this.parent.getCell(h,r);u&&(u.wrap&&this.parent.notify(Nt,{range:[h,r,h,r],wrap:!1,sheet:l}),u.hyperlink&&(t.removeClass(f.querySelectorAll(".e-hyperlink"),"e-hyperlink-style"),"Clear All"===i.type&&this.parent.removeHyperlink(g([h,r,h,r]))))}"Clear Hyperlinks"===i.type&&this.parent.removeHyperlink(o),this.parent.notify(gr,{range:l.name+"!"+o,type:i.type}),this.parent.serviceLocator.getService("cell").refreshRange(d(o)),e.isPublic||(c={range:l.name+"!"+o,type:i.type,sheetIndex:s},this.parent.notify("actionComplete",{eventArgs:c,action:"clear"}))},e.prototype.addEventListener=function(){this.parent.on(lt,this.applyCellFormat,this),this.parent.on(bi,this.clearObj,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(kr,this.addEventListener),this.parent.off(lt,this.applyCellFormat),this.parent.off(bi,this.clearObj))},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null,this.row=null,this.checkHeight=null},e.prototype.getModuleName=function(){return"cellformat"},e}(),ns=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.addEventListener=function(){this.parent.on(Rr,this.wireEvents,this),this.parent.on(mn,this.wireEvents,this),this.parent.on(En,this.autoFit,this),this.parent.on(Kn,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(e){if(this.parent.getActiveSheet().showHeaders){var r=e?e.element:this.parent.getRowHeaderContent(),n=this.parent.getColumnHeaderContent();t.EventHandler.add(n,"dblclick",this.dblClickHandler,this),t.EventHandler.add(r,"dblclick",this.dblClickHandler,this),t.EventHandler.add(n,"mousedown",this.mouseDownHandler,this),t.EventHandler.add(r,"mousedown",this.mouseDownHandler,this),this.wireResizeCursorEvent(r,n)}},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),t.EventHandler.remove(this.parent.getColumnHeaderContent(),"mousemove",this.setTarget)},e.prototype.unwireEvents=function(){this.parent.getActiveSheet().showHeaders&&(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(Rr,this.wireEvents),this.parent.off(mn,this.wireEvents),this.parent.off(En,this.autoFit),this.parent.off(Kn,this.setAutoFitHandler))},e.prototype.mouseMoveHandler=function(e){var t=this.parent.element.getElementsByClassName("e-sheet-panel")[0],r=this.parent.element.getElementsByClassName("e-colresize-handler")[0],n=this.parent.element.getElementsByClassName("e-rowresize-handler")[0];(r||n)&&(this.isMouseMoved=!0,r?e.x>this.trgtEle.parentElement.firstChild.getBoundingClientRect().left&&(r.style.left=e.clientX-this.parent.element.getBoundingClientRect().left+"px"):n&&e.y>=this.trgtEle.parentElement.parentElement.firstChild.getBoundingClientRect().top&&(n.style.top=e.clientY-t.getBoundingClientRect().top+"px"))},e.prototype.mouseDownHandler=function(e){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,o=i.classList.contains("e-colresize")?"e-colresize-handler":i.classList.contains("e-rowresize")?"e-rowresize-handler":"";this.createResizeHandler(i,o),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-colresize-handler")[0],n=this.parent.element.getElementsByClassName("e-rowresize-handler")[0];this.resizeOn(e),this.isMouseMoved=null;var i=r||n;i&&(this.parent.element.getElementsByClassName("e-sheet-panel")[0].removeChild(i),this.updateCursor(e)),t.EventHandler.remove(document,"mouseup",this.mouseUpHandler),t.EventHandler.remove(this.parent.element,"mousemove",this.mouseMoveHandler),this.wireResizeCursorEvent(this.parent.getRowHeaderContent(),this.parent.getColumnHeaderContent())},e.prototype.dblClickHandler=function(e){if(this.trgtEle=e.target,this.updateTarget(e,this.trgtEle),this.trgtEle.classList.contains("e-colresize")){var t=parseInt(this.trgtEle.getAttribute("aria-colindex"),10)-1,r=ne(this.parent.getActiveSheet(),t)+"px";this.trgtEle.classList.contains("e-unhide-column")?this.showHiddenColumns(t-1):this.setAutofit(t,!0,r)}else if(this.trgtEle.classList.contains("e-rowresize")){var n=parseInt(this.trgtEle.parentElement.getAttribute("aria-rowindex"),10)-1,i=Z(this.parent.getActiveSheet(),n)+"px";this.setAutofit(n,!1,i)}},e.prototype.setTarget=function(e){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,o,s,a;if(t.closest(r,".e-header-row")?(s=e.offsetX,o=r.offsetWidth,a="e-colresize",r.previousElementSibling?i=r.previousElementSibling:Number(r.getAttribute("aria-colindex"))>1&&(i=r)):t.closest(r,".e-row")&&(s=e.offsetY,o=r.offsetHeight,a="e-rowresize",r.parentElement.previousElementSibling?i=r.parentElement.previousElementSibling.firstElementChild:Number(r.parentElement.getAttribute("aria-rowindex"))>1&&(i=r)),o-2<8&&s!==Math.ceil((o-2)/2))s<Math.ceil((o-2)/2)?(r.classList.add(a),i.classList.add(a)):s>Math.ceil((o-2)/2)&&r.classList.add(a);else if(o-5<s&&s<=o&&o>=10)r.classList.add(a);else if(s<5&&i&&o>=10)r.classList.add(a),i.classList.add(a);else for(var l="e-colresize"===a?r.parentElement.getElementsByClassName(a):this.parent.getRowHeaderTable().getElementsByClassName(a),h=0;h<l.length;h++)l[h].classList.remove(a)},e.prototype.updateTarget=function(e,r){if(t.closest(r,".e-header-row")){if(r.offsetWidth<10&&e.offsetX<Math.ceil((r.offsetWidth-2)/2)||e.offsetX<5&&r.offsetWidth>=10&&r.classList.contains("e-colresize")){var n=this.parent.getActiveSheet(),i=Number(this.trgtEle.getAttribute("aria-colindex"))-2;r.previousElementSibling&&!oe(n,i)?this.trgtEle=r.previousElementSibling:i>-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")){n=this.parent.getActiveSheet(),i=Number(r.parentElement.getAttribute("aria-rowindex"))-2;if(r.parentElement.previousElementSibling||J(n,i))if("dblclick"===e.type&&J(n,i)){var o=S(d(this.parent.getActiveSheet().selectedRange)),s=void 0;s=i<=o[2]&&i>o[0]?{startIndex:o[0],endIndex:o[2],hide:!1,autoFit:!0}:{startIndex:i,endIndex:i,hide:!1,autoFit:!0},this.parent.notify(In,s)}else J(n,i)||(this.trgtEle=r.parentElement.previousElementSibling.getElementsByClassName("e-header-cell")[0])}},e.prototype.setAutoFitHandler=function(e){this.setAutofit(e.idx,e.isCol)},e.prototype.setAutofit=function(e,t,r){var n=0,i=this.parent.getActiveSheet(),o=this.parent.getMainContent(),s=t?ne(this.parent.getActiveSheet(),e)+"px":Z(this.parent.getActiveSheet(),e)+"px",a=[],l=o.getElementsByClassName("e-content-table")[0];if(this.parent.getActiveSheet().showHeaders)(t?this.parent.getColHeaderTable():this.parent.getRowHeaderTable()).getElementsByTagName("tr");var h=!1;if(t){for(var p=i.rows.length,d=0;d<p;d++)if(i.rows[d]&&i.rows[d].cells&&i.rows[d].cells[e]){j(d,e,i).wrap&&(h=!0);var c=this.parent.createElement("td",{className:"e-cell",innerHTML:this.parent.getDisplayText(i.rows[d].cells[e])});if(i.rows[d].cells[e].style){(g=i.rows[d].cells[e].style).fontFamily&&(c.style.fontFamily=g.fontFamily),g.fontSize&&(c.style.fontSize=g.fontSize)}a[n]=c,n++}}else for(var u=i.rows[e]&&i.rows[e].cells?i.rows[e].cells.length:0,f=0;f<u;f++)if(i.rows[e]&&i.rows[e].cells[f]){j(e,f,i).wrap&&(h=!0);var g=i.rows[e].cells[f].style;c=this.parent.createElement("td",{innerHTML:this.parent.getDisplayText(i.rows[e].cells[f])});if(i.rows[e].cells[f].style){var m=i.rows[e].cells[f].style;m.fontFamily&&(c.style.fontFamily=m.fontFamily),m.fontSize&&(c.style.fontSize=m.fontSize)}a[n]=c,n++}var v=Pe(l,a,t,this.parent,r,h);t&&(v=this.getFloatingElementWidth(v,e));var y=0===v?parseInt(s,10):v,C=parseInt(s,10)>y?-(parseInt(s,10)-y):y-parseInt(s,10);if(t)if(e>=this.parent.viewport.leftIndex&&e<=this.parent.viewport.rightIndex)te(i,e).width=y>0?y:0,this.parent.notify(gn,{threshold:C,colIdx:e}),this.resizeStart(e,this.parent.getViewportIndex(e,!0),y+"px",t,!0,r);else{var b,S=ne(i,e);b=y>0?-(S-y):-S,this.parent.notify(gn,{threshold:b,colIdx:e}),te(i,e).width=y>0?y:0}else if(!t)if(e>=this.parent.viewport.topIndex&&e<=this.parent.viewport.bottomIndex)Q(i,e,(y=y>20?y:20)>0?y:0),this.parent.notify(fn,{threshold:C,rowIdx:e}),this.resizeStart(e,this.parent.getViewportIndex(e),y+"px",t,!0,r);else{var x,w=Z(i,e);x=y>0?-(w-y):-w,this.parent.notify(fn,{threshold:x,rowIdx:e}),Q(i,e,y>0?y:0)}},e.prototype.createResizeHandler=function(e,t){var r=this.parent.createElement("div",{className:t});e.classList.contains("e-colresize")?(r.style.height=this.parent.getMainContent().clientHeight+e.offsetHeight+"px",r.style.left=this.event.clientX-this.parent.element.getBoundingClientRect().left+"px",r.style.top="0px"):e.classList.contains("e-rowresize")&&(r.style.width=this.parent.getMainContent().clientWidth+e.offsetWidth+"px",r.style.left="0px",r.style.top=this.event.clientY-this.parent.element.getElementsByClassName("e-sheet-panel")[0].getBoundingClientRect().top+"px"),this.parent.element.getElementsByClassName("e-sheet-panel")[0].appendChild(r),this.updateCursor(this.event)},e.prototype.setColWidth=function(e,t,r,n){var i=this.parent.getActiveSheet(),o=r-n;if(o<0&&n<-o&&(o=-n),r>0){if(this.isMouseMoved&&this.trgtEle.classList.contains("e-unhide-column"))return this.showHiddenColumns(e,r),void this.parent.notify(Wn,{eventArgs:{index:e,width:"0px",isCol:!0,sheetIdx:this.parent.activeSheetIndex,oldWidth:n+"px",hide:!1},action:"resize"});this.parent.notify(gn,{threshold:o,colIdx:e}),this.resizeStart(e,t,r+"px",!0,!1,n+"px"),re(i,e,{width:r,customWidth:!0})}else this.isMouseMoved&&(this.parent.hideColumn(e),this.parent.notify(Wn,{eventArgs:{index:e,width:"0px",isCol:!0,sheetIdx:this.parent.activeSheetIndex,oldWidth:n+"px",hide:!0},action:"resize"}))},e.prototype.showHiddenColumns=function(e,t){var r,n,i,o=this.parent.getActiveSheet(),s=d(o.selectedRange);if(e>=s[1]&&e<=s[3]&&s[2]===o.rowCount-1&&c(o.activeCell)[0]===c(o.topLeftCell)[0]?(r=s[1],n=s[3],i=this.parent.getMainContent().querySelector("colgroup")):r=n=e,void 0!==t)for(var a=r;a<=n;a++)re(o,a,{width:t,customWidth:!0}),a>=this.parent.viewport.leftIndex&&a<=this.parent.viewport.rightIndex&&!oe(o,a)&&(i.children[this.parent.getViewportIndex(a,!0)].style.width=t+"px");this.trgtEle.classList.remove("e-unhide-column"),this.parent.hideColumn(r,n,!1),void 0===t&&this.autoFit({isRow:!1,startIndex:r,endIndex:n})},e.prototype.setRowHeight=function(e,t,r,n){var i=this.parent.getActiveSheet(),o=parseInt(this.parent.getMainContent().getElementsByTagName("tr")[t].style.height,10),s=r,a=parseInt(s,10)-o;a<0&&o<-a&&(a=-o),this.parent.notify(fn,{threshold:a,rowIdx:e,isCustomHgt:!0}),this.resizeStart(e,t,s,!1,!1,n),$(i,e,{height:parseInt(s,10)>0?parseInt(s,10):0,customHeight:!0})},e.prototype.resizeOn=function(e){var t,r,n=this;if(this.trgtEle.classList.contains("e-rowresize")){var i=this.parent.getActiveSheet(),o=Number(this.trgtEle.parentElement.getAttribute("aria-rowindex"))-2;if(this.isMouseMoved&&J(i,o)&&this.trgtEle.classList.contains("e-skip-resize")&&e.clientY>this.trgtEle.getBoundingClientRect().top){this.trgtEle.classList.remove("e-skip-resize");var s={startIndex:o,endIndex:o,hide:!1,skipAppend:!0};this.parent.notify(In,s);var a=this.parent.getRowHeaderTable().tBodies[0],l=this.parent.getContentTable().tBodies[0];s.hdrRow.style.display="none",s.row.style.display="none",a.insertBefore(s.hdrRow,a.children[s.insertIdx]),l.insertBefore(s.row,l.children[s.insertIdx]),this.trgtEle=s.hdrRow.firstElementChild,s.hdrRow.nextElementSibling.classList.remove("e-hide-end"),s.mergeCollection.forEach(function(e){n.parent.notify(ir,e)})}else if(this.trgtEle.classList.contains("e-skip-resize")){if(this.trgtEle.classList.remove("e-skip-resize"),!this.isMouseMoved&&J(i,o)||!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 h=this.parent.getMainContent().getElementsByClassName("e-row")[t].style.height,p=e.clientY-this.event.clientY+parseInt(h,10);if(p<=0)return this.parent.hideRow(r),$(i,r,{height:0,customHeight:!0}),void this.parent.notify(Wn,{eventArgs:{index:r,height:"0px",isCol:!1,sheetIdx:this.parent.activeSheetIndex,oldHeight:h},action:"resize"});if(this.setRowHeight(r,t,p+"px",h),"none"===this.trgtEle.parentElement.style.display){var c=this.parent.getActiveSheet(),u=S(d(c.selectedRange));if(r<=u[2]&&r>u[0]){p=c.rows[r].height;for(var f=void 0,g=u[0];g<=u[2];g++)g!==r&&(h=Z(c,g)+"px",$(c,g,{customHeight:!0,height:p}),J(c,g)?f||(f=g):(this.parent.getRow(g).style.height=p+"px",c.showHeaders&&(this.parent.getRow(g,this.parent.getRowHeaderTable()).style.height=p+"px")),this.parent.notify(Wn,{eventArgs:{index:g,height:p+"px",isCol:!1,sheetIdx:this.parent.activeSheetIndex,oldHeight:h},action:"resize"}));this.parent.hideRow(u[0],r-1,!1),t+=Math.abs(r-f)}else 0===t||J(c,r-1)?0!==t&&this.trgtEle.parentElement.classList.add("e-hide-end"):this.trgtEle.parentElement.previousElementSibling.classList.remove("e-hide-start"),this.parent.selectRange(c.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 m=void 0;this.trgtEle.classList.contains("e-unhide-column")?(t-=1,m=0):m=ne(this.parent.getActiveSheet(),t),this.setColWidth(t,this.parent.getViewportIndex(t,!0),e.clientX-this.event.clientX+m,m)}},e.prototype.setWidthAndHeight=function(e,t,r){r?e.style.width=parseInt(e.style.width,10)+t+"px":e.style.height=parseInt(e.style.height,10)+t+"px"},e.prototype.resizeStart=function(e,t,r,n,i,o){if(this.parent.getActiveSheet().showHeaders)Me(t,r,n,this.parent);else if(n){this.parent.element.getElementsByClassName("e-sheet-content")[0].getElementsByTagName("col")[t].style.width=r}else{this.parent.element.getElementsByClassName("e-sheet-content")[0].getElementsByTagName("tr")[t].style.height=r}var s,a,l=i?"resizeToFit":"resize";n?(s={index:e,width:r,isCol:n,sheetIdx:this.parent.activeSheetIndex,oldWidth:o},a=o!==r):(s={index:e,height:r,isCol:n,sheetIdx:this.parent.activeSheetIndex,oldHeight:o},a=o!==r),a&&this.parent.notify(Wn,{eventArgs:s,action:l})},e.prototype.updateCursor=function(e){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(Xn,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.parent=null},e.prototype.getModuleName=function(){return"resize"},e}(),is=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.refreshClients=function(e){Ve(e,this.parent)},e.prototype.addEventListener=function(){this.parent.on(wn,this.refreshClients,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off(wn,this.refreshClients)},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.getModuleName=function(){return"collaborativeEditing"},e}(),os=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.hideShow=function(e){if(e.startIndex>e.endIndex){var t=e.startIndex;e.startIndex=e.endIndex,e.endIndex=t}e.actionUpdate&&this.parent.notify(Gn,{eventArgs:e,action:"hideShow"}),e.isCol?this.hideCol(e):this.hideRow(e),e.actionUpdate&&this.parent.notify(Wn,{eventArgs:e,action:"hideShow"})},e.prototype.hideRow=function(e){var r,n,i,o,s=this,a=this.parent.getActiveSheet(),l=0;if(e.hide){for(var h=void 0,p=void 0,d=void 0,c=e.startIndex;c<=e.endIndex;c++)if(!J(a,c))if(void 0===n&&(a.showHeaders&&(p=this.parent.getRowHeaderTable()),h=this.parent.getContentTable(),n=this.parent.getViewportIndex(c),l=0),$(a,c,{hidden:!0}),d=h.rows[n]){if(!o)for(var u=0;u<=a.usedRange.colIndex;u++)if(((r=j(c,u,a)||{}).colSpan||r.rowSpan)&&(e.startIndex>=this.parent.viewport.topIndex||this.parent.scrollSettings.enableVirtualization)){o=!0;break}if(o)continue;if(a.showHeaders&&t.detach(p.rows[n]),t.detach(d),l++,(d=h.rows[n])&&c===e.endIndex){var g=void 0,m=(i=Xe(a,c+1,!0))!==Xe(a,0,!0)&&i===(this.parent.viewport.topIndex>=e.startIndex?e.endIndex+1:this.parent.viewport.topIndex)?"Row":"";for(u=this.parent.viewport.leftIndex;u<=this.parent.viewport.rightIndex;u++){""!==(F=this.parent.getCellStyleValue(["borderTop"],[i,u]).borderTop)&&(g=d.cells[u],this.parent.notify(lt,{onActionUpdate:!1,rowIdx:i,colIdx:u,style:{borderTop:F},row:d,pRow:d.previousElementSibling,first:m,cell:g}))}}}else c<=this.parent.viewport.bottomIndex?l++:l--;if(o&&(e.startIndex>=this.parent.viewport.topIndex||!this.parent.scrollSettings.enableVirtualization))return this.parent.selectRange(a.selectedRange),void this.parent.renderModule.refreshUI({rowIndex:this.parent.viewport.topIndex,colIndex:this.parent.viewport.leftIndex,refresh:"Row"});if(!l)return;if(this.parent.selectRange(a.selectedRange),this.parent.scrollSettings.enableVirtualization){this.parent.viewport.topIndex>=e.startIndex&&(this.parent.viewport.topIndex=e.endIndex+1),e.startIndex=this.parent.viewport.bottomIndex+1,e.endIndex=e.startIndex+l-1;var v=this.parent.skipHidden(e.startIndex,e.endIndex);e.startIndex=v[0],e.endIndex=v[1],this.parent.viewport.bottomIndex=e.endIndex,this.parent.renderModule.refreshUI({colIndex:this.parent.viewport.leftIndex,direction:"",refresh:"RowPart"},f(e.startIndex,this.parent.viewport.leftIndex)+":"+f(e.endIndex,this.parent.viewport.leftIndex+this.parent.viewport.colCount+2*this.parent.getThreshold("col")))}a.showHeaders&&(0===n?p.rows[0]&&p.rows[0].classList.add("e-hide-end"):(p.rows[n-1]&&p.rows[n-1].classList.add("e-hide-start"),p.rows[n]&&p.rows[n].classList.add("e-hide-end")))}else{for(var y=void 0,C=void 0,b=void 0,S=(d=void 0,void 0),x=void 0,w=void 0,I=void 0,E=e.startIndex-1,k=void 0,R=[],A=(c=e.startIndex,e.endIndex);c<=A;c++)if(J(a,c))if(void 0===k)if(c>this.parent.viewport.bottomIndex){if($(a,c,{hidden:!1}),void 0===I)return}else{void 0===I&&(I=c),$(a,c,{hidden:!1}),void 0===n&&(y=document.createDocumentFragment(),C=document.createDocumentFragment(),S=this.parent.serviceLocator.getService("row"),a.showHeaders&&(x=this.parent.getRowHeaderTable().tBodies[0]),w=this.parent.getContentTable().tBodies[0],c<this.parent.viewport.topIndex&&(this.parent.viewport.topIndex=c),n=0===c?0:this.parent.getViewportIndex(c)),E++,a.showHeaders&&(b=S.refresh(c,null,null,!0),y.appendChild(b),t.detach(x.lastElementChild)),d=C.appendChild(S.refresh(c,d,b)),t.detach(w.lastElementChild);for(u=this.parent.viewport.leftIndex;u<=this.parent.viewport.rightIndex;u++)if(void 0!==(r=j(c,u,a)||{}).rowSpan){var T={range:[c,u,c,u],isAction:!1,merge:!0,type:"All",skipChecking:!0};this.parent.notify(ar,T),R.length&&T.range[1]===R[R.length-1].range[1]||R.push(T)}}else A=c;else{if(e.startIndex===e.endIndex)return;void 0===n?E++:k=c}if(this.parent.viewport.bottomIndex=this.parent.viewport.topIndex+this.parent.viewport.rowCount+2*this.parent.getThreshold("row"),l=this.parent.hiddenCount(this.parent.viewport.topIndex,e.startIndex)+this.parent.hiddenCount(e.endIndex+1,this.parent.viewport.bottomIndex),this.parent.viewport.bottomIndex+=l,e.insertIdx=n,e.row=C.querySelector(".e-row"),e.mergeCollection=R,a.showHeaders&&(e.hdrRow=y.querySelector(".e-row"),0!==n&&!J(a,E-1)&&x.children[n-1]&&x.children[n-1].classList.remove("e-hide-start"),0!==e.startIndex&&J(a,e.startIndex-1)&&e.hdrRow.classList.add("e-hide-end"),J(a,E+1)?y.lastElementChild.classList.add("e-hide-start"):x.children[n]&&x.children[n].classList.remove("e-hide-end")),d&&w.children[n]){i=Xe(a,E+1,!0);for(c=this.parent.viewport.leftIndex;c<=this.parent.viewport.rightIndex;c++){var F;if(""!==(F=this.parent.getCellStyleValue(["borderTop"],[i,c]).borderTop)){this.parent.notify(lt,{onActionUpdate:!1,rowIdx:i,colIdx:c,style:{borderTop:F},pRow:d,cell:w.children[n].children[c],first:""});var N=Xe(a,I-1,!1);N>-1?!w.children[n-1]||this.parent.getCellStyleValue(["borderBottom"],[N,c]).borderBottom||this.parent.getCellStyleValue(["borderTop"],[I,c]).borderTop||(w.children[n-1].children[c].style.borderBottom=""):w.children[n].children[c].style.borderTop=""}}}if(e.skipAppend)return;a.showHeaders&&x.insertBefore(y,x.children[n]),w.insertBefore(C,w.children[n]),this.parent.selectRange(a.selectedRange),e.autoFit&&a.showHeaders&&this.parent.notify(En,{startIndex:e.startIndex,endIndex:e.endIndex,isRow:!0}),R.forEach(function(e){s.parent.notify(ir,e)}),void 0!==k&&k!==e.endIndex&&(e.startIndex=k,this.hideRow(e))}},e.prototype.hideCol=function(e){for(var t,r=this,n=this.parent.getActiveSheet(),i=[],o=[],s=c(n.topLeftCell),a=e.startIndex;a<=e.endIndex;a++)(e.hide?!oe(n,a):oe(n,a))&&(re(n,a,{hidden:e.hide}),this.parent.scrollSettings.enableVirtualization&&(a<this.parent.viewport.leftIndex||a>this.parent.viewport.rightIndex)?a<this.parent.viewport.leftIndex&&o.push(a):(i.push(a),e.hide&&s[1]===a&&(t=!0)));if(o.length||i.length)if(e.hide){if(!i.length)return;if((i.length<=this.parent.getThreshold("col")||!this.parent.scrollSettings.enableVirtualization)&&this.removeCell(n,i),this.parent.scrollSettings.enableVirtualization){if(i[0]===this.parent.viewport.leftIndex&&(this.parent.viewport.leftIndex=Xe(n,i[i.length-1]+1,!0,"columns")),t){var l=0;if(i.slice(0,i.indexOf(s[1])).forEach(function(e){l+=ne(n,e,!0)}),l){this.parent.notify(Jn,{set:!1});var h=this.parent.getMainContent();h.scrollLeft-=l,this.parent.notify(vn,{scrollLeft:h.scrollLeft,preventScroll:!0,skipHidden:!0}),ve(function(){return r.parent.notify(Jn,{set:!0})})}}if(this.parent.scrollSettings.isFinite){var p=Xe(n,n.colCount-1,!1,"columns"),d=this.parent.viewport.leftIndex,u=this.parent.viewport.rightIndex;if(u+i.length>=p){var m=Xe(n,d-(u+i.length-p),!1,"columns");return m>-1&&(this.parent.viewport.leftIndex=m,this.parent.viewport.leftIndex-=this.parent.hiddenCount(u,p)),this.parent.viewport.rightIndex=p,d===this.parent.viewport.leftIndex&&u===this.parent.viewport.rightIndex||this.parent.renderModule.refreshUI({skipUpdateOnFirst:this.parent.viewport.leftIndex===Xe(n,0,!0,"columns"),rowIndex:this.parent.viewport.topIndex,colIndex:this.parent.viewport.leftIndex,refresh:"Column"}),void this.parent.selectRange(n.selectedRange)}}if(i.length<=this.parent.getThreshold("col")){var v=this.parent.skipHidden(this.parent.viewport.rightIndex+1,this.parent.viewport.rightIndex+i.length,"columns");this.parent.viewport.rightIndex=v[1],this.parent.renderModule.refreshUI({rowIndex:this.parent.viewport.topIndex,colIndex:v[0],direction:"",refresh:"ColumnPart"},""+g([this.parent.viewport.topIndex,v[0],this.parent.viewport.bottomIndex,v[1]]))}else this.parent.renderModule.refreshUI({skipUpdateOnFirst:this.parent.viewport.leftIndex===Xe(n,0,!0,"columns"),rowIndex:this.parent.viewport.topIndex,colIndex:this.parent.viewport.leftIndex,refresh:"Column"})}this.parent.selectRange(n.selectedRange)}else{if(o.length){if(o.sort(function(e,t){return e-t}),this.parent.scrollSettings.enableVirtualization&&o[0]<this.parent.getThreshold("col")){var y=c(n.topLeftCell)[0]+1;n.topLeftCell="A"+y,this.parent.renderModule.refreshUI({skipUpdateOnFirst:!0,rowIndex:this.parent.viewport.topIndex,colIndex:0,refresh:"Column"}),this.parent.selectRange(n.selectedRange)}else this.parent.goTo(f(this.parent.viewport.topIndex,o[0]));return}i.length<=this.parent.getThreshold("col")||!this.parent.scrollSettings.enableVirtualization?(this.appendCell(n,i),this.parent.scrollSettings.enableVirtualization&&this.parent.notify(Vr,{refresh:"Column"})):this.parent.renderModule.refreshUI({skipUpdateOnFirst:this.parent.viewport.leftIndex===Xe(n,0,!0,"columns"),rowIndex:this.parent.viewport.topIndex,colIndex:this.parent.viewport.leftIndex,refresh:"Column"}),this.parent.selectRange(n.selectedRange)}},e.prototype.removeCell=function(e,r){var n,i,o,s,a,l,h,p=this,d=0,c=this.parent.getViewportIndex(r[0],!0)+1;this.parent.scrollSettings.enableVirtualization?(n=this.parent.viewport.topIndex,i=this.parent.viewport.bottomIndex):(n=0,i=e.rowCount-1);var u,f=this.parent.getContentTable();if(l=f.getElementsByTagName("colgroup")[0],e.showHeaders){var g=this.parent.getColHeaderTable();a=g.getElementsByTagName("colgroup")[0],o=g.rows[0]}for(var m=r.length-1;n<=i;)J(e,n)?n++:(s=f.rows[d],r.forEach(function(i,f){if(t.detach(s.cells[c]),0===d&&(e.showHeaders&&(t.detach(o.cells[c]),t.detach(a.children[c])),t.detach(l.children[c])),0===f&&void 0!==(h=j(n,i,e)||{}).colSpan&&(void 0===h.rowSpan||h.colSpan>1)&&p.parent.notify(ci,{rowIdx:n,colIdx:i,model:"col",start:r[0],end:r[m]}),f===m){u=Xe(e,i+1,!0,"columns");var g=p.parent.getCellStyleValue(["borderLeft"],[d,u]).borderLeft;""!==g&&p.parent.notify(lt,{onActionUpdate:!1,rowIdx:d,colIdx:u,style:{borderLeft:g},row:s,first:""}),void 0!==(h=j(n,i,e)||{}).colSpan&&(void 0===h.rowSpan||h.colSpan>1)&&p.parent.notify(ci,{rowIdx:n,colIdx:i,model:"col",start:r[0],end:r[m],isEnd:!0})}}),n++,d++);c-1>-1&&e.showHeaders&&o.cells[c-1]&&o.cells[c-1].classList.add("e-hide-start"),o.cells[c]&&o.cells[c].classList.add("e-hide-end")},e.prototype.appendCell=function(e,r){var n,i,o,s,a,l,h,p=this,d=0;document.createDocumentFragment(),document.createDocumentFragment(),document.createDocumentFragment();this.parent.scrollSettings.enableVirtualization?(n=this.parent.viewport.topIndex,i=this.parent.viewport.bottomIndex):(n=0,i=e.rowCount-1);var c=this.parent.getContentTable(),u=this.parent.getColHeaderTable();l=c.getElementsByTagName("colgroup")[0],e.showHeaders&&(a=u.getElementsByTagName("colgroup")[0],o=u.rows[0]);var g=this.parent.serviceLocator.getService("cell");r.sort(function(e,t){return e-t});for(var m,v,y,C=[],b=[],S=r.length-1;n<=i;)J(e,n)?n++:(s=c.rows[d],r.forEach(function(i,c){if(0===d&&(b[c]=p.parent.getViewportIndex(i,!0),l.children[b[c]]?(l.insertBefore(p.parent.sheetModule.updateCol(e,i),l.children[b[c]]),e.showHeaders&&(y=o.cells[b[c]],0===c&&r[c]&&!oe(e,r[c]-1)&&y.previousElementSibling.classList.remove("e-hide-start"),o.insertBefore(g.renderColHeader(i),y),c===S&&y.classList.remove("e-hide-end"))):(l.appendChild(p.parent.sheetModule.updateCol(e,i)),e.showHeaders&&o.appendChild(g.renderColHeader(i))),t.detach(l.lastChild),e.showHeaders&&(t.detach(o.lastChild),c===S&&(t.detach(a),u.insertBefore(l.cloneNode(!0),u.tHead[0])))),t.detach(s.lastChild),y=s.cells[b[c]],v=g.render({rowIdx:n,colIdx:i,cell:j(n,i,e),address:f(n,i),lastCell:i===S,isHeightCheckNeeded:!0,first:i!==Xe(e,0,!0,"columns")&&i===p.parent.viewport.leftIndex?"Column":"",checkNextBorder:c===S?"Column":""}),y?s.insertBefore(v,y):s.appendChild(v),0===c&&v.previousSibling){""!==p.parent.getCellStyleValue(["borderLeft"],[d,Xe(e,r[r.length-1]+1,!0,"columns")]).borderLeft&&(h=Xe(e,r[0]-1,!1,"columns"))>-1&&!p.parent.getCellStyleValue(["borderRight"],[d,h]).borderRight&&!p.parent.getCellStyleValue(["borderLeft"],[d,r[0]]).borderLeft&&(v.previousSibling.style.borderRight="")}if(void 0!==(m=j(d,i,e)||{}).colSpan&&(void 0===m.rowSpan||m.colSpan>1)){var x={range:[d,i,d,i],isAction:!1,merge:!0,type:"All",skipChecking:!0};p.parent.notify(ar,x),C.length&&x.range[1]===C[C.length-1].range[1]||C.push(x)}}),n++,d++);C.forEach(function(e){p.parent.notify(ir,e)}),this.parent.viewport.rightIndex=Xe(e,this.parent.viewport.rightIndex-r.length,!1,"columns")},e.prototype.addEventListener=function(){this.parent.on(In,this.hideShow,this),this.parent.on(Tr,this.destroy,this)},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.removeEventListener=function(){this.parent.off(In,this.hideShow),this.parent.off(Tr,this.destroy)},e}(),ss=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(Rn,this.initiateHyperlinkHandler,this),this.parent.on(An,this.editHyperlinkHandler,this),this.parent.on(Fn,this.removeHyperlinkHandler,this),this.parent.on(Tn,this.openHyperlinkHandler,this),this.parent.on(Dr,this.hyperlinkClickHandler,this),this.parent.on(Nn,this.createHyperlinkElementHandler,this),this.parent.on(Lr,this.keyUpHandler,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(Rn,this.initiateHyperlinkHandler),this.parent.off(An,this.editHyperlinkHandler),this.parent.off(Fn,this.removeHyperlinkHandler),this.parent.off(Tn,this.openHyperlinkHandler),this.parent.off(Dr,this.hyperlinkClickHandler),this.parent.off(Nn,this.createHyperlinkElementHandler),this.parent.off(Lr,this.keyUpHandler))},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"),o=(t.closest(r,".e-hyperlink-dlg")||t.closest(r,".e-edithyperlink-dlg")).getElementsByClassName("e-footer-content")[0].firstChild;n&&n.value&&(V(n.value.toUpperCase())?i&&(i.remove(),o.removeAttribute("disabled")):(this.showDialog(),o.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){o=(t.closest(r,".e-hyperlink-dlg")||t.closest(r,".e-edithyperlink-dlg")).getElementsByClassName("e-footer-content")[0].firstChild;if(""!==r.value)o.removeAttribute("disabled");else{!!t.closest(r,".e-link-dialog").querySelector(".e-webpage").querySelectorAll(".e-cont")[1].querySelector(".e-text").value||o.setAttribute("disabled","true")}}},e.prototype.initiateHyperlinkHandler=function(){var e=this,t=this.parent.serviceLocator.getService(Us),r=this.parent.getActiveSheet();if(!r.isProtected||r.protectSettings.insertLink){if(!this.parent.element.querySelector(".e-hyperlink-dlg")){var n=this.parent.serviceLocator.getService(js);n.show({width:323,isModal:!0,showCloseIcon:!0,cssClass:"e-hyperlink-dlg",header:t.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),n.dialogInstance.content=e.hyperlinkContent(),n.dialogInstance.dataBind(),e.parent.element.focus()},buttons:[{buttonModel:{content:t.getConstant("Insert"),isPrimary:!0,disabled:!0},click:function(){e.dlgClickHandler(n),n.hide()}}]})}}else this.parent.notify(li,null)},e.prototype.dlgClickHandler=function(e){var t,r,n=this.parent,i=this.parent.element.querySelector(".e-link-dialog").getElementsByClassName("e-content")[0].querySelector(".e-item.e-active");if(i)if(i.querySelector(".e-webpage")){t=i.getElementsByClassName("e-cont")[0].querySelector(".e-text").value;var o={address:r=i.getElementsByClassName("e-cont")[1].querySelector(".e-text").value};this.parent.insertHyperlink(o,this.parent.getActiveSheet().activeCell,t,!1)}else{t=i.getElementsByClassName("e-cont")[0].querySelector(".e-text").value,r=i.getElementsByClassName("e-cont")[1].querySelector(".e-text").value;var s=i.getElementsByClassName("e-cont")[2];if(s.getElementsByClassName("e-list-item")[0].querySelector(".e-active")){for(var a=i.getElementsByClassName("e-cont")[2].querySelector(".e-active").textContent,l=n.sheets,h=0;h<l.length;h++)l[h].name;o={address:r=a+"!"+r.toUpperCase()};this.parent.insertHyperlink(o,this.parent.getActiveSheet().activeCell,t,!1)}else if(s.querySelector(".e-active")){var p=i.getElementsByClassName("e-cont")[2].querySelector(".e-active").textContent;for(h=0;h<this.parent.definedNames.length;h++)if(this.parent.definedNames[h].name===p){o={address:this.parent.definedNames[h].name};this.parent.insertHyperlink(o,this.parent.getActiveSheet().activeCell,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(Us),t=this.parent.createElement("span",{className:"e-hyperlink-alert-span",innerHTML:e.getConstant("HyperlinkAlert")});this.parent.element.querySelector(".e-hyperlink-dlg").querySelector(".e-dlg-content").appendChild(t)},e.prototype.editHyperlinkHandler=function(){var e=this,t=this.parent.serviceLocator.getService(Us),r=this.parent.serviceLocator.getService(js);r.show({width:323,isModal:!0,showCloseIcon:!0,cssClass:"e-edithyperlink-dlg",header:t.getConstant("EditLink"),beforeOpen:function(t){var n={dialogName:"EditLinkDialog",element:t.element,target:t.target,cancel:t.cancel};e.parent.trigger("dialogBeforeOpen",n),n.cancel&&(t.cancel=!0),r.dialogInstance.content=e.hyperEditContent(),r.dialogInstance.dataBind(),e.parent.element.focus()},buttons:[{buttonModel:{content:t.getConstant("Update"),isPrimary:!0},click:function(){e.dlgClickHandler(r),r.hide()}}]})},e.prototype.openHyperlinkHandler=function(){var e=c(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.removeHyperlinkHandler=function(e){this.parent.removeHyperlink(e)},e.prototype.hlOpenHandler=function(e){var r=this;if(e.classList.contains("e-hyperlink")){var n=["",""],i=void 0,o=!0;e.style.color="#551A8B";var s=this.parent.getActiveSheet(),a=parseInt(e.parentElement.getAttribute("aria-colindex"),10)-1,l=parseInt(e.parentElement.parentElement.getAttribute("aria-rowindex"),10)-1,h=s.rows[l].cells[a].hyperlink,p=void 0,c=void 0,u=void 0;if(c={hyperlink:h,cell:this.parent.getActiveSheet().activeCell,target:"_blank",cancel:!1},this.parent.trigger(It,c),c.cancel)return;u={hyperlink:h=c.hyperlink,cell:this.parent.getActiveSheet().activeCell},"string"==typeof h&&(p=h),"object"==typeof h&&(p=h.address);var m=p;if(-1===p.indexOf("http://")&&-1===p.indexOf("https://")&&-1===p.indexOf("ftp://")){if(!t.isNullOrUndefined(p)){if(this.parent.definedNames)for(var v=0;v<this.parent.definedNames.length;v++)if(this.parent.definedNames[v].name===p){p=(p=this.parent.definedNames[v].refersTo).slice(1);break}-1!==p.indexOf("!")?-1!==(n=p.split("!"))[0].indexOf(" ")&&(n[0]=n[0].slice(1,n[0].length-1)):(n[0]=this.parent.getActiveSheet().name,n[1]=p),n[1];var y;for(v=0;v<this.parent.sheets.length;v++)this.parent.sheets[v].name===n[0]&&(y=v);if(s=this.parent.sheets[y],-1!==n[1].indexOf(":")){var C=n[1].indexOf(":"),b=n[1].substr(0,C),S=n[1].substr(C+1,n[1].length);b=b.replace("$",""),(S=S.replace("$","")).match(/\D/g)&&!S.match(/[0-9]/g)&&b.match(/\D/g)&&!b.match(/[0-9]/g)?(b+"1:"+S+s.rowCount,b+="1",S+=s.rowCount,n[1]=b+":"+S):!S.match(/\D/g)&&S.match(/[0-9]/g)&&!b.match(/\D/g)&&b.match(/[0-9]/g)&&(f(parseInt(b,10)-1,0)+":"+f(parseInt(S,10)-1,s.colCount-1),i=[parseInt(b,10)-1,0,parseInt(S,10)-1,s.colCount-1],o=!1)}var x=void 0,w=this.parent.definedNames;if(!t.isNullOrUndefined(w))for(v=0;v<w.length;v++)if(w[v].name===m){x=!0;break}if((V(n[1])||x)&&(i=o?d(n[1]):i,this.parent.scrollSettings.enableVirtualization&&(i[0]=i[0]>=this.parent.viewport.topIndex?i[0]-this.parent.viewport.topIndex:i[0],i[1]=i[1]>=this.parent.viewport.leftIndex?i[1]-this.parent.viewport.leftIndex:i[1]),!t.isNullOrUndefined(s))){var I=g(i);if(s===this.parent.getActiveSheet())ve(function(){r.parent.goTo(I)});else{if(I.indexOf(":")>=0){var E=I.split(":");I=E[0]===E[1]?E[0]:I}ve(function(){r.parent.goTo(r.parent.sheets[y].name+"!"+I)})}}}}else e.setAttribute("target",c.target);this.parent.trigger(Et,u)}},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"),o=p.querySelector(".e-webpage"),s=o?o.querySelectorAll(".e-cont")[0].querySelector(".e-text").value:i.querySelectorAll(".e-cont")[0].querySelector(".e-text").value,a=i?i.querySelectorAll(".e-cont")[0].querySelector(".e-text").value:s;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=s,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=!o.querySelectorAll(".e-cont")[1].querySelector(".e-text").value;o.querySelectorAll(".e-cont")[0].querySelector(".e-text").value=a,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 p,d=this.parent.element.getElementsByClassName("e-link-dialog")[0].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")?d.classList.contains("e-disabled")||d.hasAttribute("readonly")||(d.setAttribute("readonly","true"),d.classList.add("e-disabled"),d.setAttribute("disabled","true")):"sheet"===t.closest(r,".e-list-item").getAttribute("data-uid")&&d.classList.contains("e-disabled")&&d.hasAttribute("readonly")&&(d.removeAttribute("readonly"),d.classList.remove("e-disabled"),d.removeAttribute("disabled")),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)},e.prototype.createHyperlinkElementHandler=function(e){var r=e.cell,n=e.td,i=(e.rowIdx,e.colIdx,this.parent.createElement("a",{className:"e-hyperlink e-hyperlink-style"}));if(t.isNullOrUndefined(r.hyperlink)||n.querySelector("a"))n.querySelector("a")&&r.hyperlink&&"string"==typeof r.hyperlink&&n.querySelector("a").setAttribute("href",r.hyperlink);else{var o=r.hyperlink;"string"==typeof o?(-1===o.indexOf("http://")&&-1===o.indexOf("https://")&&-1===o.indexOf("ftp://")&&-1!==o.indexOf("www.")&&(o="http://"+o),0===o.indexOf("http://")||0===o.indexOf("https://")||0===o.indexOf("ftp://")?(i.setAttribute("href",o),i.setAttribute("target","_blank")):(o.includes("=")||o.includes("!"))&&i.setAttribute("ref",o),i.innerText=""!==n.innerText?n.innerText:o,n.textContent="",n.innerText="",n.appendChild(i)):"object"==typeof o&&(0===o.address.indexOf("http://")||0===o.address.indexOf("https://")||0===o.address.indexOf("ftp://")?(i.setAttribute("href",o.address),i.setAttribute("target","_blank")):(o.address.includes("=")||o.address.includes("!"))&&i.setAttribute("ref",o.address),"Accounting"===D(r.format)?i.innerHTML=n.innerHTML:i.innerText=""!==n.innerText?n.innerText:o.address,n.textContent="",n.innerText="",n.appendChild(i))}},e.prototype.hyperEditContent=function(){var e=!0,t=this.hyperlinkContent(),r=d(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,o=this.parent.getDisplayText(n),s=n.hyperlink;"string"==typeof s?(i=s,o=o||i,-1===i.indexOf("http://")&&-1===i.indexOf("https://")&&-1===i.indexOf("ftp://")&&(e=!1)):"object"==typeof s&&(i=s.address,o=o||i,-1===i.indexOf("http://")&&-1===i.indexOf("https://")&&-1===i.indexOf("ftp://")&&(e=!1));var a=t.querySelector(".e-content");if(e){var l=a.querySelector(".e-webpage");if(l.getElementsByClassName("e-cont")[0].getElementsByClassName("e-text")[0].setAttribute("value",o),"string"==typeof s)l.getElementsByClassName("e-cont")[1].querySelector(".e-text").setAttribute("value",s);else{l.getElementsByClassName("e-cont")[1].querySelector(".e-text").setAttribute("value",s.address)}}else{var h=void 0,p=a.querySelector(".e-document");p.getElementsByClassName("e-cont")[0].getElementsByClassName("e-text")[0].setAttribute("value",o);var c=void 0,u=(this.parent.getActiveSheet(),void 0);if(this.parent.definedNames)for(var f=0;f<this.parent.definedNames.length;f++)if(this.parent.definedNames[f].name===i){h=!0;break}if(h){var g=void 0;(g=p.getElementsByClassName("e-cont")[1].getElementsByClassName("e-text")[0]).setAttribute("readonly","true"),g.classList.add("e-disabled"),g.setAttribute("disabled","true");var m=p.getElementsByClassName("e-cont")[2].querySelectorAll(".e-list-item.e-level-1")[1];for(f=0;f<m.getElementsByTagName("li").length;f++)m.getElementsByTagName("li")[f].innerText===i&&m.getElementsByTagName("li")[f].classList.add("e-active")}else{i&&-1!==i.indexOf("!")&&(c=i.split("!"),u=parseInt(c[0].replace(/\D/g,""),10)-1,this.parent.sheets[u]);var v=c[0];p.getElementsByClassName("e-cont")[1].querySelector(".e-text").setAttribute("value",c[1]);for(m=p.getElementsByClassName("e-cont")[2].querySelectorAll(".e-list-item.e-level-1")[0],f=0;f<m.getElementsByTagName("li").length;f++)if(m.getElementsByTagName("li")[f].innerText===v){if(m.getElementsByTagName("li")[f].classList.contains("e-active"))break;m.getElementsByTagName("li")[f].classList.add("e-active")}else m.getElementsByTagName("li")[f].classList.contains("e-active")&&m.getElementsByTagName("li")[f].classList.remove("e-active")}}return t},e.prototype.hyperlinkContent=function(){var e,r,i=this.parent.serviceLocator.getService(Us),o=0,s=0,a=!0,l=!0,h=d(this.parent.getActiveSheet().activeCell),p=this.parent.getActiveSheet(),c=j(h[0],h[1],p),u=!0;if(c){u=!!(c.value&&"string"==typeof c.value&&null!==c.value.match("[A-Za-z]+")||""===c.value||t.isNullOrUndefined(c.value));var f=c.hyperlink;if("string"==typeof f){-1===(g=f).indexOf("http://")&&-1===g.indexOf("https://")&&-1===g.indexOf("ftp://")&&(r=f,a=!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,a=!1)}if(s=a?0:1,this.parent.definedNames)for(var m=0;m<this.parent.definedNames.length;m++)if(this.parent.definedNames[m].name===r){e=!0,l=!1;break}}var v=this.parent.createElement("div",{className:"e-link-dialog"}),y=this.parent.createElement("div",{className:"e-webpage"}),C=this.parent.createElement("div",{className:"e-document"});new n.Tab({selectedItem:s,items:[{header:{text:i.getConstant("WebPage")},content:y},{header:{text:i.getConstant("ThisDocument")},content:C}]}).appendTo(v),a?v.querySelector(".e-toolbar-items").querySelector(".e-indicator").setAttribute("style","left: 0; right: 136px"):v.querySelector(".e-toolbar-items").querySelector(".e-indicator").setAttribute("style","left: 136px; right: 0");var b=this.parent.createElement("div",{className:"e-cont"}),S=this.parent.createElement("div",{className:"e-cont"}),x=this.parent.createElement("div",{className:"e-header",innerHTML:i.getConstant("DisplayText")}),w=this.parent.createElement("div",{className:"e-header",innerHTML:i.getConstant("Url")}),I=this.parent.createElement("input",{className:"e-input e-text",attrs:{type:"Text"}});u||(I.classList.add("e-disabled"),I.setAttribute("readonly","true"),I.setAttribute("disabled","true")),c&&t.isNullOrUndefined(c.hyperlink)&&I.setAttribute("value",this.parent.getDisplayText(c));var E=this.parent.createElement("input",{className:"e-input e-text",attrs:{type:"Text"}});I.setAttribute("placeholder",i.getConstant("EnterTheTextToDisplay")),E.setAttribute("placeholder",i.getConstant("EnterTheUrl")),b.appendChild(I),b.insertBefore(x,I),S.appendChild(E),S.insertBefore(w,E),y.appendChild(S),y.insertBefore(b,S);for(var k=[],R=[],A=this.parent.sheets;o<this.parent.sheets.length;o++){var T=this.parent.sheets[o].name;A[o]===this.parent.getActiveSheet()?k.push({nodeId:"sheet",nodeText:-1!==T.indexOf(" ")?"'"+T+"'":T,selected:!0}):k.push({nodeId:"sheet",nodeText:-1!==T.indexOf(" ")?"'"+T+"'":T})}for(o=0;o<this.parent.definedNames.length;o++)R.push({nodeId:"defName",nodeText:this.parent.definedNames[o].name});var F=[{nodeId:"01",nodeText:i.getConstant("CellReference"),expanded:l,nodeChild:k},{nodeId:"02",nodeText:i.getConstant("DefinedNames"),expanded:e,nodeChild:R}],N=new n.TreeView({fields:{dataSource:F,id:"nodeId",text:"nodeText",child:"nodeChild"}}),O=this.parent.createElement("div",{className:"e-cont"}),D=this.parent.createElement("div",{className:"e-header",innerHTML:i.getConstant("CellReference")}),L=this.parent.createElement("input",{className:"e-input e-text e-hyp-text",attrs:{type:"Text"}});L.setAttribute("value","A1"),O.appendChild(L),O.insertBefore(D,L);var H=this.parent.createElement("div",{className:"e-cont"}),B=this.parent.createElement("div",{className:"e-header",innerHTML:i.getConstant("DisplayText")}),M=this.parent.createElement("input",{className:"e-input e-text",attrs:{type:"Text"}});u||(M.classList.add("e-disabled"),M.setAttribute("readonly","true"),M.setAttribute("disabled","true")),c&&t.isNullOrUndefined(c.hyperlink)&&M.setAttribute("value",this.parent.getDisplayText(c)),M.setAttribute("placeholder",i.getConstant("EnterTheTextToDisplay")),H.appendChild(M),H.insertBefore(B,M);var _=this.parent.createElement("div",{className:"e-cont"}),P=this.parent.createElement("div",{className:"e-header",innerHTML:i.getConstant("Sheet")}),V=this.parent.createElement("div",{className:"e-refcont"});return _.appendChild(V),_.insertBefore(P,V),C.appendChild(O),C.insertBefore(H,O),N.appendTo(V),C.appendChild(_),v},e}(),as=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=[],o=e.args,s=o.eventArgs;switch(o.action){case"format":t=d(o.eventArgs.range);break;case"clipboard":var a=s.copiedInfo;t=d(y(s.pastedRange)),a.isCut&&(i=this.getCellDetails(a.range,de(this.parent,ae(this.parent,a.sId))));break;case"beforeSort":(t=d(o.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":t=d(s.address);break;case"beforeWrap":case"beforeReplace":t=this.parent.getAddressInfo(s.address).indices;break;case"beforeClear":case"beforeInsertImage":t=d(s.range)}n=this.getCellDetails(t,r),this.beforeActionData={cellDetails:n,cutCellDetails:i}},e.prototype.getBeforeActionData=function(e){e.beforeDetails=this.beforeActionData},e.prototype.performUndoRedo=function(e){var t=e.isUndo?this.undoCollection.pop():this.redoCollection.pop();if(this.isUndo=e.isUndo,t){switch(t.action){case"cellSave":case"format":case"sorting":case"wrap":t=this.performOperation(t);break;case"clipboard":t=this.undoForClipboard(t);break;case"resize":t=this.undoForResize(t);break;case"hideShow":t.eventArgs.hide=!t.eventArgs.hide,Ve(t,this.parent);break;case"replace":t=this.performOperation(t);break;case"insert":case"delete":case"validation":Ve(t,this.parent,!e.isUndo);break;case"merge":t.eventArgs.merge=!t.eventArgs.merge,Ve(t,this.parent);break;case"clear":t=this.performOperation(t);break;case"conditionalFormat":case"clearCF":case"insertImage":case"imageRefresh":Ve(t,this.parent,!e.isUndo)}e.isUndo?this.redoCollection.push(t):this.undoCollection.push(t),this.undoCollection.length>this.undoRedoStep&&this.undoCollection.splice(0,1),this.redoCollection.length>this.undoRedoStep&&this.redoCollection.splice(0,1),this.updateUndoRedoIcons();var r=Object.assign({},t.eventArgs);r.requestType=e.isUndo?"undo":"redo",delete r.beforeActionData,e.isPublic||this.parent.notify(Wn,{eventArgs:r,action:"undoRedo"})}},e.prototype.updateUndoRedoCollection=function(e){var t=["clipboard","format","sorting","cellSave","resize","resizeToFit","wrap","hideShow","replace","validation","merge","clear","conditionalFormat","clearCF","insertImage","imageRefresh"];"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){var i={beforeDetails:{cellDetails:[]}};this.parent.notify(Mn,i),n.beforeActionData=i.beforeDetails}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(Us);this.parent.notify(Kr,[{tab:e.getConstant("Home"),items:[this.parent.element.id+"_undo"],enable:this.undoCollection.length>0}]),this.parent.notify(Kr,[{tab:e.getConstant("Home"),items:[this.parent.element.id+"_redo"],enable:this.redoCollection.length>0}])},e.prototype.undoForClipboard=function(e){var t,r=this,n=e.eventArgs,i=n.pastedRange.split("!"),o=d(i[1]),s=se(this.parent,i[0]),a=de(this.parent,s),l=n.copiedInfo,h=n.beforeActionData,p=this.checkRefreshNeeded(s);if("imagePaste"===e.eventArgs.requestType){var c=n.copiedShapeInfo;this.isUndo?(t=c.pictureElem,c.isCut?(this.parent.notify(Hi,{id:t.id,sheetIdx:n.pasteSheetIndex+1}),this.parent.notify(Li,{options:{data:t.style.backgroundImage.replace(/url\((['"])?(.*?)\1\)/gi,"$2"),height:c.height,width:c.width,imageId:t.id},range:c.copiedRange,isPublic:!1,isUndoRedo:!0})):this.parent.notify(Hi,{id:n.pastedPictureElement.id,sheetIdx:n.pasteSheetIndex+1})):c.isCut?(t=c.pictureElem,this.parent.notify(Hi,{id:t.id,sheetIdx:c.sId}),this.parent.notify(Li,{options:{data:t.style.backgroundImage.replace(/url\((['"])?(.*?)\1\)/gi,"$2"),height:c.height,width:c.width,imageId:t.id},range:c.pastedRange,isPublic:!1,isUndoRedo:!0})):(t=n.pastedPictureElement,this.parent.notify(Li,{options:{data:t.style.backgroundImage.replace(/url\((['"])?(.*?)\1\)/gi,"$2"),height:t.offsetHeight,width:t.offsetWidth,imageId:t.id},range:c.pastedRange,isPublic:!1,isUndoRedo:!0}))}else{if(this.isUndo){if(l.isCut){var u=h.cutCellDetails;this.updateCellDetails(u,de(this.parent,ae(this.parent,l.sId)),l.range,p)}this.updateCellDetails(h.cellDetails,a,o,p),Ge(a,o[0],o[1],20);var f=Ye(a,o[0]);je(this.parent,a,f,o[0]),n.mergeCollection.forEach(function(e){e.merge=!e.merge,r.parent.notify(ir,e),e.merge=!e.merge})}else Ve(e,this.parent,l.isCut);p&&this.parent.notify(Jr,{indexes:o})}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;return Ve(e,this.parent),e},e.prototype.performOperation=function(e){var t=e.eventArgs,r="cellSave"===e.action||"wrap"===e.action||"replace"===e.action?t.address.split("!"):t.range.split("!"),n=d(r[1]),i=se(this.parent,r[0]),o=de(this.parent,i),s=t.beforeActionData,a=this.checkRefreshNeeded(i);if(this.isUndo){this.updateCellDetails(s.cellDetails,o,n,a,e),Ge(o,n[0],n[1],20);var l=Ye(o,n[0]);je(this.parent,o,l,n[0])}else Ve(e,this.parent);return a&&this.parent.notify(Jr,{indexes:n}),e},e.prototype.getCellDetails=function(e,t){for(var r,n=[],i=e[0];i<=e[2];i++)for(var o=e[1];o<=e[3];o++)r=j(i,o,t),n.push({rowIndex:i,colIndex:o,format:r?r.format:null,style:r?r.style:null,value:r?r.value:"",formula:r?r.formula:"",wrap:r&&r.wrap,rowSpan:r&&r.rowSpan,colSpan:r&&r.colSpan,hyperlink:r&&r.hyperlink,image:r&&r.image});return n},e.prototype.updateCellDetails=function(e,r,n,i,o){for(var s,a=e.length,l=0;l<a;l++)q(e[l].rowIndex,e[l].colIndex,r,{value:e[l].value,format:e[l].format,style:e[l].style,formula:e[l].formula,wrap:e[l].wrap,rowSpan:e[l].rowSpan,colSpan:e[l].colSpan,hyperlink:e[l].hyperlink}),e[l].formula&&this.parent.notify(dt,{action:"updateCellValue",address:[e[l].rowIndex,e[l].colIndex,e[l].rowIndex,e[l].colIndex],value:e[l].formula}),o&&"wrap"===o.action&&o.eventArgs.wrap&&this.parent.notify(Nt,{range:[e[l].rowIndex,e[l].colIndex,e[l].rowIndex,e[l].colIndex],wrap:!1,sheet:r}),o&&e[l].hyperlink&&"clear"===o.action&&(o.eventArgs.range=r.name+"!"+g([e[l].rowIndex,e[l].colIndex,e[l].rowIndex,e[l].colIndex]),s=this.parent.getCell(e[l].rowIndex,e[l].colIndex),"Clear All"===o.eventArgs.type||"Clear Hyperlinks"===o.eventArgs.type?this.parent.addHyperlink(e[l].hyperlink,o.eventArgs.range):"Clear Formats"===o.eventArgs.type&&t.addClass(s.querySelectorAll(".e-hyperlink"),"e-hyperlink-style"));i&&this.parent.serviceLocator.getService("cell").refreshRange(n)},e.prototype.checkRefreshNeeded=function(e){var t=!0;return e!==this.parent.activeSheetIndex&&(this.parent.activeSheetIndex=e,this.parent.dataBind(),t=!1),t},e.prototype.addEventListener=function(){this.parent.on(Ln,this.performUndoRedo,this),this.parent.on(Hn,this.updateUndoRedoCollection,this),this.parent.on(Bn,this.setActionData,this),this.parent.on(Mn,this.getBeforeActionData,this),this.parent.on(_n,this.clearUndoRedoCollection,this),this.parent.on(hi,this.updateUndoRedoIcons,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(Ln,this.performUndoRedo),this.parent.off(Hn,this.updateUndoRedoCollection),this.parent.off(Bn,this.setActionData),this.parent.off(Mn,this.getBeforeActionData),this.parent.off(_n,this.clearUndoRedoCollection),this.parent.off(hi,this.updateUndoRedoIcons))},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.getModuleName=function(){return"undoredo"},e}(),ls=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.addEventListener=function(){this.parent.on(Xr,this.ribbonClickHandler,this),this.parent.on(Nt,this.wrapTextHandler,this),this.parent.on(fn,this.rowHeightChangedHandler,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(Xr,this.ribbonClickHandler),this.parent.off(Nt,this.wrapTextHandler),this.parent.off(fn,this.rowHeightChangedHandler))},e.prototype.wrapTextHandler=function(e){if(we(this.parent,e.range,!0))for(var t=void 0,r=void 0,n=void 0,i=void 0,o=void 0,s=void 0,a=e.range[0];a<=e.range[2];a++){o=0,i=K(e.sheet,a).customHeight;for(var l=e.range[1];l<=e.range[3];l++)if((t=e.initial?e.td:this.parent.getCell(a,l))&&(e.wrap?t.classList.add(Vs):t.classList.remove(Vs),i&&(t.innerHTML=this.parent.createElement("span",{className:"e-wrap-content",innerHTML:t.innerHTML}).outerHTML)),!i){n=ne(e.sheet,l),r=j(a,l,e.sheet);var h=this.parent.getDisplayText(r);if(h.indexOf("\n")<0){var p=this.parent.element.querySelector(".e-spreadsheet-edit");p&&p.textContent.indexOf("\n")>-1&&(h=p.textContent)}if(h)if(e.wrap){t.classList.contains("e-alt-unwrap")&&t.classList.remove("e-alt-unwrap");var d=void 0,c=0,u=void 0;if(h.indexOf("\n")>-1){var f=h.split("\n"),g=f.length;for(u=0;u<g;u++)0===(d=We(f[u],n,r.style,this.parent.cellStyle))&&(d=1),c+=d;d=c}else d=We(h,n,r.style,this.parent.cellStyle);s=qe(this.parent,r.style||this.parent.cellStyle,d)+1,o=Math.max(o,s),Ge(e.sheet,a,l,s)}else h.indexOf("\n")>-1&&t.classList.add("e-alt-unwrap"),s=qe(this.parent,r.style||this.parent.cellStyle,1),Ge(e.sheet,a,l,s),o=Math.max(Ye(e.sheet,a),20);else e.wrap||(Ge(e.sheet,a,l,20),o=20);l===e.range[3]&&(e.wrap&&o>20&&Ye(e.sheet,a)<=o||!e.wrap&&Ye(e.sheet,a)<Z(e.sheet,a)&&Z(e.sheet,a)>20)&&je(this.parent,e.sheet,o,a,e.row,e.hRow)}}},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=C(this.parent.getActiveSheet()),o={address:i,wrap:n,cancel:!1};this.parent.notify(Gn,{action:"beforeWrap",eventArgs:o}),o.cancel||(W(this.parent.getActiveSheet().selectedRange,n,this.parent),this.parent.notify(Wn,{action:"wrap",eventArgs:{address:i,wrap:n}}))}},e.prototype.getTextWidth=function(e,t){void 0===t&&(t=this.parent.cellStyle);var r=this.parent.cellStyle,n=document.createElement("canvas").getContext("2d");return n.font=(t.fontStyle||r.fontStyle)+" "+(t.fontWeight||r.fontWeight)+" "+(t.fontSize||r.fontSize)+" "+(t.fontFamily||r.fontFamily),n.measureText(e).width},e.prototype.rowHeightChangedHandler=function(e){if(e.isCustomHgt)for(var t=this.parent.getActiveSheet(),r=this.parent.viewport.leftIndex,n=r+this.parent.viewport.colCount+2*this.parent.getThreshold("col"),i=r;i<n;i++){var o=j(e.rowIdx,i,t);if(o&&o.wrap){var s=this.parent.getCell(e.rowIdx,i);s.innerHTML=this.parent.createElement("span",{className:"e-wrap-content",innerHTML:s.innerHTML}).outerHTML}}},e.prototype.getModuleName=function(){return"wrapText"},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e}(),hs=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.insert=function(e){var t;switch(e.isAction&&(t=!0,delete e.isAction),t&&this.parent.notify(Gn,{eventArgs:e,action:"insert"}),e.modelType){case"Sheet":this.parent.notify(Wr,{startIdx:e.index,endIdx:e.index+(e.model.length-1)}),this.parent.renderModule.refreshSheet(),this.parent.element.focus();break;case"Row":(!this.parent.scrollSettings.enableVirtualization||e.index<=this.parent.viewport.bottomIndex)&&(this.parent.scrollSettings.enableVirtualization?(e.index<this.parent.viewport.topIndex&&(this.parent.viewport.topIndex+=e.model.length),this.parent.renderModule.refreshUI({skipUpdateOnFirst:this.parent.viewport.topIndex===Xe(this.parent.getActiveSheet(),0,!0),rowIndex:this.parent.viewport.topIndex,colIndex:this.parent.viewport.leftIndex,refresh:"Row"})):this.parent.renderModule.refreshUI({skipUpdateOnFirst:!0,rowIndex:e.index,colIndex:0,refresh:"Row"}),this.parent.selectRange(this.parent.getActiveSheet().selectedRange));break;case"Column":(!this.parent.scrollSettings.enableVirtualization||e.index<=this.parent.viewport.rightIndex)&&(this.parent.scrollSettings.enableVirtualization?(e.index<this.parent.viewport.leftIndex&&(this.parent.viewport.leftIndex+=e.model.length),this.parent.renderModule.refreshUI({skipUpdateOnFirst:this.parent.viewport.leftIndex===Xe(this.parent.getActiveSheet(),0,!0,"columns"),rowIndex:this.parent.viewport.topIndex,colIndex:this.parent.viewport.leftIndex,refresh:"Column"})):this.parent.renderModule.refreshUI({skipUpdateOnFirst:!0,rowIndex:0,colIndex:e.index,refresh:"Column"}),this.parent.selectRange(this.parent.getActiveSheet().selectedRange))}this.refreshImgElement(e.model.length,this.parent.activeSheetIndex,e.modelType,e.index),t&&this.parent.notify(Wn,{eventArgs:e,action:"insert"})},e.prototype.refreshImgElement=function(e,t,r,n){for(var i,o=this.parent.sheets[t],s=[0,0,o.usedRange.rowIndex,o.usedRange.colIndex],a=0;a<=s[2];a++)for(var l=s[1];l<=s[3];l++)(i=j(a,l,o))&&i.image&&i.image.length>0&&("Row"===r&&a>=n||"Column"===r&&l>=n)&&this.parent.notify(Bi,{rowIdx:a,colIdx:l,sheetIdx:t,type:r,count:e,status:"insert"})},e.prototype.addEventListener=function(){this.parent.on(Dt,this.insert,this)},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off(Dt,this.insert)},e.prototype.getModuleName=function(){return"insert"},e}(),ps=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.delete=function(e){var t;e.isAction&&(t=!0,delete e.isAction),t&&this.parent.notify(Gn,{eventArgs:e,action:"delete"}),"Sheet"===e.modelType?(this.parent.setProperties({activeSheetIndex:e.activeSheetIndex-1},!0),this.parent.notify(Ir,this),this.parent.renderModule.refreshSheet(),this.parent.element.focus()):"Row"===e.modelType?((!this.parent.scrollSettings.enableVirtualization||e.startIndex<=this.parent.viewport.bottomIndex)&&(this.parent.scrollSettings.enableVirtualization?(e.startIndex<this.parent.viewport.topIndex&&(this.parent.viewport.topIndex-=e.model.length),this.parent.renderModule.refreshUI({skipUpdateOnFirst:this.parent.viewport.topIndex===Xe(this.parent.getActiveSheet(),0,!0),rowIndex:this.parent.viewport.topIndex,refresh:"Row",colIndex:this.parent.viewport.leftIndex})):this.parent.renderModule.refreshUI({skipUpdateOnFirst:!0,refresh:"Row",rowIndex:e.startIndex,colIndex:0})),this.parent.selectRange(this.parent.getActiveSheet().selectedRange)):((!this.parent.scrollSettings.enableVirtualization||e.startIndex<=this.parent.viewport.rightIndex)&&(this.parent.scrollSettings.enableVirtualization?(e.startIndex<this.parent.viewport.leftIndex&&(this.parent.viewport.leftIndex-=e.model.length),this.parent.renderModule.refreshUI({skipUpdateOnFirst:this.parent.viewport.leftIndex===Xe(this.parent.getActiveSheet(),0,!0,"columns"),rowIndex:this.parent.viewport.topIndex,refresh:"Column",colIndex:this.parent.viewport.leftIndex})):this.parent.renderModule.refreshUI({skipUpdateOnFirst:!0,refresh:"Column",rowIndex:0,colIndex:e.startIndex})),this.parent.selectRange(this.parent.getActiveSheet().selectedRange)),this.refreshImgElement(e.deletedModel.length,this.parent.activeSheetIndex,e.modelType,e.startIndex),t&&this.parent.notify(Wn,{eventArgs:e,action:"delete"})},e.prototype.refreshImgElement=function(e,t,r,n){for(var i,o=this.parent.sheets[t],s=[0,0,o.usedRange.rowIndex,o.usedRange.colIndex],a=0;a<=s[2];a++)for(var l=s[1];l<=s[3];l++)(i=j(a,l,o))&&i.image&&i.image.length>0&&("Row"===r&&a>=n||"Column"===r&&l>=n)&&this.parent.notify(Bi,{rowIdx:a,colIdx:l,sheetIdx:t,type:r,count:e,status:"delete"})},e.prototype.addEventListener=function(){this.parent.on(Lt,this.delete,this)},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off(Lt,this.delete)},e.prototype.getModuleName=function(){return"delete"},e}(),ds=function(){function e(e){this.data=[],this.parent=e,this.addEventListener()}return e.prototype.destroy=function(){this.removeEventListener();var e=document.querySelector("#"+this.parent.element.id+"_datavalidation-popup");e&&e.remove(),this.parent=null},e.prototype.addEventListener=function(){t.EventHandler.add(this.parent.element,"dblclick",this.listOpen,this),t.EventHandler.add(document,"mousedown",this.mouseDownHandler,this),this.parent.on(Zn,this.initiateDataValidationHandler,this),this.parent.on(Qn,this.invalidDataHandler,this),this.parent.on(Mt,this.checkDataValidation,this),this.parent.on(ft,this.listHandler,this),this.parent.on(Lr,this.keyUpHandler,this),this.parent.on(gi,this.removeValidationHandler,this)},e.prototype.removeEventListener=function(){t.EventHandler.remove(this.parent.element,"dblclick",this.listOpen),t.EventHandler.remove(document,"mousedown",this.mouseDownHandler),this.parent.isDestroyed||(this.parent.off(Zn,this.initiateDataValidationHandler),this.parent.off(Qn,this.invalidDataHandler),this.parent.off(Mt,this.checkDataValidation),this.parent.off(ft,this.listHandler),this.parent.off(Lr,this.keyUpHandler),this.parent.off(gi,this.removeValidationHandler))},e.prototype.removeValidationHandler=function(e){this.parent.removeDataValidation(this.parent.getActiveSheet().selectedRange)},e.prototype.mouseDownHandler=function(e){var r=e.target,n=t.closest(r,".e-ddl");n&&"listValid_popup"===n.getAttribute("id")&&this.parent.notify(Or,{action:"refreshFormulabar",value:r.innerText})},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"),o=i.querySelector(".e-dlg-error"),s=n.querySelector(".e-footer-content").querySelector(".e-primary");s.hasAttribute("disabled")&&s.removeAttribute("disabled"),o&&i.removeChild(o)}},e.prototype.listOpen=function(e){var t=e.target;this.listObj&&t.classList.contains("e-cell")&&t.querySelector(".e-validation-list")&&this.listObj.showPopup()},e.prototype.invalidDataHandler=function(e){e.isRemoveHighlight?this.parent.removeInvalidHighlight():this.parent.addInvalidHighlight()},e.prototype.listHandler=function(){var e=this;if(this.parent.allowDataValidation){var r,n=this.parent.getActiveSheet(),i=(this.parent.getMainContent(),c(n.activeCell)),o=j(i[0],i[1],n);if(!(r=this.parent.getCell(i[0],i[1])))return;if(document.getElementsByClassName("e-validation-list")[0]&&(t.remove(document.getElementsByClassName("e-validation-list")[0]),this.data=[]),o&&o.validation&&"List"===o.validation.type&&(o.validation.ignoreBlank=!!t.isNullOrUndefined(o.validation.ignoreBlank)||o.validation.ignoreBlank,o.validation.inCellDropDown=!!t.isNullOrUndefined(o.validation.inCellDropDown)||o.validation.inCellDropDown,o.validation.inCellDropDown)){var a=this.parent.createElement("div",{className:"e-validation-list"}),l=this.parent.createElement("input",{id:"listValid"});a.appendChild(l),o.validation.inCellDropDown||(a.style.display="none"),r.insertBefore(a,r.firstChild),this.listObj=new s.DropDownList({index:0,dataSource:this.data,fields:{text:"text",value:"id"},width:"0px",popupWidth:"200px",popupHeight:"200px",beforeOpen:function(){e.listObj.popupWidth=r.offsetWidth-1,e.data=[],e.updateDataSource(e.listObj,o)},change:function(){e.listValueChange(e.listObj.text)},open:function(e){e.popup.offsetX=4-(r.offsetWidth-20),e.popup.offsetY=-13}}),this.listObj.appendTo("#listValid")}}},e.prototype.updateDataSource=function(e,t){var r=0,n=this.parent.getActiveSheet(),i=t.validation.value1.toUpperCase();if(-1!==i.indexOf("="))for(var o=d(i),s=o[0];s<=o[2];s++){n.rows[s]||$(n,s,{});for(var a=o[1];a<=o[3];a++){n.rows[s].cells||q(s,a,n,{}),r+=1,t=n.rows[s].cells[a];var l=this.parent.getDisplayText(t)?this.parent.getDisplayText(t):"";this.data.push({text:l,id:"list-"+r})}}else for(var h=t.validation.value1.split(","),p=0;p<h.length;p++)r+=1,this.data.push({text:h[p],id:"list-"+r});e.dataSource=this.data},e.prototype.listValueChange=function(e){var r=this.parent.getActiveSheet(),n=v(r.activeCell),i=j(n[0],n[1],r);(i?t.isNullOrUndefined(i.isLocked)?r.isProtected:i.isLocked:r.isProtected)?this.parent.notify(li,null):(this.parent.notify(dt,{action:"updateCellValue",address:r.activeCell,value:e}),this.parent.serviceLocator.getService("cell").refreshRange(n))},e.prototype.initiateDataValidationHandler=function(){for(var e,t,r,n,i,o=this,s=this.parent.serviceLocator.getService(Us),a=!0,l=!0,h=!0,p=this.parent.getActiveSheet(),c=d(p.selectedRange),u=c[0];u<=c[2];u++)if(p.rows[u])for(var f=c[1];f<=c[3];f++)p.rows[u].cells&&p.rows[u].cells[f]&&(i=p.rows[u].cells[f]).validation&&(h=!1,e=i.validation.type,t=i.validation.operator,r=i.validation.value1,n=i.validation.value2,a=i.validation.ignoreBlank,l=i.validation.inCellDropDown);if(!this.parent.element.querySelector(".e-datavalidation-dlg")){var g=this.parent.serviceLocator.getService(js);g.show({width:375,showCloseIcon:!0,isModal:!0,cssClass:"e-datavalidation-dlg",header:s.getConstant("DataValidation"),target:document.querySelector(".e-control.e-spreadsheet"),beforeOpen:function(i){var s={dialogName:"ValidationDialog",element:i.element,target:i.target,cancel:i.cancel};o.parent.trigger("dialogBeforeOpen",s),s.cancel&&(i.cancel=!0),g.dialogInstance.content=o.dataValidationContent(h,e,t,r,n,a,l),g.dialogInstance.dataBind(),o.parent.element.focus()},buttons:[{buttonModel:{content:s.getConstant("CLEARALL"),cssClass:"e-btn e-clearall-btn e-flat"},click:function(){g.dialogInstance.content=o.dataValidationContent(!0,e,t,r,n,a,l),g.dialogInstance.dataBind(),o.parent.element.focus()}},{buttonModel:{content:s.getConstant("APPLY"),isPrimary:!0},click:function(){o.dlgClickHandler(g)}}]}),g.dialogInstance.refresh()}},e.prototype.dataValidationContent=function(e,t,r,n,a,l,h){var p=this,d=this.parent.serviceLocator.getService(Us),c=e?"0":n,u=e?"0":a,f=this.parent.createElement("div",{className:"e-validation-dlg"}),g=this.parent.createElement("div",{className:"e-cellrange"}),m=this.parent.createElement("div",{className:"e-allowdata"}),v=this.parent.createElement("div",{className:"e-values"}),y=this.parent.createElement("div",{className:"e-ignoreblank"});f.appendChild(g),f.appendChild(m),f.appendChild(v),f.appendChild(y);var C=this.parent.createElement("span",{className:"e-header",innerHTML:d.getConstant("CellRange")}),b=this.parent.createElement("input",{className:"e-input",attrs:{value:this.parent.getActiveSheet().selectedRange}});g.appendChild(C),g.appendChild(b);var S=this.parent.createElement("div",{className:"e-allow"}),x=this.parent.createElement("div",{className:"e-data"});m.appendChild(S),m.appendChild(x);var w=this.parent.createElement("span",{className:"e-header",innerHTML:d.getConstant("Allow")});this.typeData=[{text:d.getConstant("WholeNumber"),id:"type-1"},{text:d.getConstant("Decimal"),id:"type-2"},{text:d.getConstant("Date"),id:"type-3"},{text:d.getConstant("Time"),id:"type-4"},{text:d.getConstant("TextLength"),id:"type-5"},{text:d.getConstant("List"),id:"type-6"}],this.operatorData=[{text:d.getConstant("Between"),id:"operator-1"},{text:d.getConstant("NotBetween"),id:"operator-2"},{text:d.getConstant("EqualTo"),id:"operator-3"},{text:d.getConstant("NotEqualTo"),id:"operator-4"},{text:d.getConstant("Greaterthan"),id:"operator-5"},{text:d.getConstant("Lessthan"),id:"operator-6"},{text:d.getConstant("GreaterThanOrEqualTo"),id:"operator-7"},{text:d.getConstant("LessThanOrEqualTo"),id:"operator-8"}];var I=this.parent.createElement("input",{className:"e-select"}),E=0;if(!e)for(var k=0;k<this.typeData.length;k++)if(t===this.typeData[k].text.replace(" ","")){E=k;break}if(e||"List"!==t){var R=0,A=this.parent.createElement("span",{className:"e-header",innerHTML:d.getConstant("Data")}),T=this.parent.createElement("input",{className:"e-select"});if(!e)for(k=0;k<this.operatorData.length;k++)if(r===this.FormattedValue(this.operatorData[k].text)){R=k;break}x.appendChild(A),x.appendChild(T),this.dataList=new s.DropDownList({dataSource:this.operatorData,index:R,popupHeight:"200px",change:function(){p.userInput(N,p.dataList)}}),this.dataList.appendTo(T)}else{var F=this.parent.createElement("input",{className:"e-checkbox"});x.appendChild(F);new o.CheckBox({label:d.getConstant("InCellDropDown"),checked:h}).appendTo(F)}S.appendChild(w),S.appendChild(I);var N=new s.DropDownList({dataSource:this.typeData,index:E,popupHeight:"200px",change:function(){p.userInput(N,p.dataList)}});if(N.appendTo(I),e||"List"!==N.value&&("Between"===this.dataList.value||"Not between"===this.dataList.value)){var O=this.parent.createElement("div",{className:"e-minimum"}),D=this.parent.createElement("div",{className:"e-maximum"});v.appendChild(O),v.appendChild(D);var L=this.parent.createElement("span",{className:"e-header",innerHTML:"Minimum"}),H=this.parent.createElement("span",{className:"e-header",innerHTML:"Maximum"}),B=this.parent.createElement("input",{id:"minvalue",className:"e-input",attrs:{value:c}}),M=this.parent.createElement("input",{id:"maxvalue",className:"e-input",attrs:{value:u}});O.appendChild(L),O.appendChild(B),D.appendChild(H),D.appendChild(M);new i.NumericTextBox({value:0}).appendTo("#minvalue");new i.NumericTextBox({value:0}).appendTo("#maxvalue")}else if(e&&" List"!==t){_=this.parent.createElement("span",{className:"e-header",innerHTML:d.getConstant("Value")}),P=this.parent.createElement("input",{className:"e-input",attrs:{value:c}});v.appendChild(_),v.appendChild(P)}else{var _=this.parent.createElement("span",{className:"e-header",innerHTML:d.getConstant("Sources")}),P=this.parent.createElement("input",{className:"e-input",attrs:{value:c}});v.appendChild(_),v.appendChild(P)}var V=l,U=this.parent.createElement("input",{className:"e-checkbox"});y.appendChild(U);return new o.CheckBox({label:d.getConstant("IgnoreBlank"),checked:V}).appendTo(U),f},e.prototype.userInput=function(e,t){var r=this.parent.element.querySelector(".e-datavalidation-dlg").querySelector(".e-validation-dlg"),n=r.querySelector(".e-allowdata"),s=r.querySelector(".e-values"),a=this.parent.serviceLocator.getService(Us),l=n.querySelector(".e-data");for(l.querySelector(".e-valid-input");s.lastChild;)s.removeChild(s.lastChild);if("List"===e.value){for(;l.lastChild;)l.removeChild(l.lastChild);var h=this.parent.createElement("input",{className:"e-checkbox"});l.appendChild(h);new o.CheckBox({label:a.getConstant("InCellDropDown"),checked:!0}).appendTo(h)}else if(l.getElementsByClassName("e-checkbox-wrapper")[0]){for(;l.lastChild;)l.removeChild(l.lastChild);var p=this.parent.createElement("span",{className:"e-header",innerHTML:"Data"}),d=this.parent.createElement("input",{className:"e-select"});l.appendChild(p),l.appendChild(d),t.appendTo(d)}if("List"===e.value||"Between"!==t.value&&"Not between"!==t.value){var c="List"===e.value?a.getConstant("Sources"):a.getConstant("Value"),u=this.parent.createElement("span",{className:"e-header",innerHTML:c}),f="List"===e.value?this.parent.createElement("input",{className:"e-input",attrs:{placeholder:"Enter value"}}):this.parent.createElement("input",{className:"e-input",attrs:{value:"0"}});s.appendChild(u),s.appendChild(f)}else{var g=this.parent.createElement("div",{className:"e-minimum"}),m=this.parent.createElement("div",{className:"e-maximum"});s.appendChild(g),s.appendChild(m);var v=this.parent.createElement("span",{className:"e-header",innerHTML:"Minimum"}),y=this.parent.createElement("span",{className:"e-header",innerHTML:"Maximum"}),C=this.parent.createElement("input",{id:"min",className:"e-input",attrs:{value:"0"}}),b=this.parent.createElement("input",{id:"max",className:"e-input",attrs:{value:"0"}});new i.NumericTextBox({value:0}).appendTo("min");new i.NumericTextBox({value:0}).appendTo("max"),g.appendChild(v),g.appendChild(C),m.appendChild(y),m.appendChild(b)}},e.prototype.dlgClickHandler=function(e){var t,r,n=this.parent.serviceLocator.getService(Us),i=!0,o=this.parent.element.querySelector(".e-datavalidation-dlg"),s=o.querySelector(".e-footer-content"),a=o.getElementsByClassName("e-dlg-content")[0].getElementsByClassName("e-validation-dlg")[0],l=a.getElementsByClassName("e-allowdata")[0],h=l.getElementsByClassName("e-allow")[0].getElementsByTagName("input")[0],p=l.getElementsByClassName("e-data")[0].getElementsByTagName("input")[0],d=a.getElementsByClassName("e-values")[0],u=d.getElementsByTagName("input")[0].value,f=d.getElementsByTagName("input")[1]?d.getElementsByTagName("input")[1].value:"",g="true"===a.querySelector(".e-ignoreblank").querySelector(".e-checkbox-wrapper").getAttribute("aria-checked"),m=l.querySelector(".e-data").querySelector(".e-checkbox-wrapper")?!!l.querySelector(".e-data").querySelector(".e-checkbox-wrapper").querySelector(".e-check"):null,v=a.querySelector(".e-cellrange").getElementsByTagName("input")[0].value,y=h.value;p&&(r=p.value,r=this.FormattedValue(r)),y&&(y=y.replace(" ",""));var C=[],b=[];if(""!==u&&b.push(u),""!==f&&b.push(f),"List"===y)if(-1!==u.indexOf("=")){if(-1!==u.indexOf(":")){var S=C=u.split(":"),x=C,w=S[0].replace(/[0-9]/g,"").replace("=","")===S[1].replace(/[0-9]/g,""),I=x[0].replace(/\D/g,"").replace("=","")===x[1].replace(/\D/g,"");(i=!!w||!!I)||(t=n.getConstant("DialogError"))}}else u.length>256&&(i=!1,t=n.getConstant("ListLengthError"));if("List"!==y||i){var E=this.parent.getActiveSheet(),k=y,R=this.isDialogValidator(b,k,r);if(t=R.errorMsg,i=R.isValidate){var A=c(this.parent.getActiveSheet().activeCell);if(E&&E.rows[A[0]]&&E.rows[A[0]].cells[A[1]]&&E.rows[A[0]].cells[A[1]].validation&&"List"===E.rows[A[0]].cells[A[1]].validation.type){var T=this.parent.getMainContent().getElementsByTagName("tr")[A[0]].getElementsByClassName("e-cell")[A[1]];T&&T.getElementsByClassName("e-validation-list")[0]&&(T.removeChild(T.getElementsByClassName("e-validation-list")[0]),this.listObj.destroy())}var F={type:y,operator:r,value1:u,value2:f,ignoreBlank:g,inCellDropDown:m};this.parent.addDataValidation(F,v),"List"===y&&i&&this.listHandler(),document.getElementsByClassName("e-validationerror-dlg")[0]||(e.dialogInstance?e.dialogInstance.hide():e.hide())}}if(!i){var N=this.parent.createElement("div",{className:"e-dlg-error",id:"e-invalid",innerHTML:t});d.appendChild(N),s.querySelector(".e-primary").setAttribute("disabled","true")}},e.prototype.FormattedValue=function(e){switch(e){case"Between":e="Between";break;case"Not between":e="NotBetween";break;case"Equal to":e="EqualTo";break;case"Not equal to":e="NotEqualTo";break;case"Greater than":e="GreaterThan";break;case"Less than":e="LessThan";break;case"Greater than or equal to":e="GreaterThanOrEqualTo";break;case"Less than or equal to":e="LessThanOrEqualTo";break;default:e="Between"}return e},e.prototype.isDialogValidator=function(e,t,r){var n,i=this.parent.serviceLocator.getService(Us),o=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 s=0;s<e.length&&(n=this.formatValidation(e[s],t)).isValidate;s++)o+=1;n.isValidate=o===e.length}return{isValidate:n.isValidate,errorMsg:n.errorMsg}},e.prototype.isValidationHandler=function(e){var t=this.parent.serviceLocator.getService(Us);e.value=e.value?e.value:"";var r,n,i=e.value,o=this.parent.sheets[e.sheetIdx],s=j(e.range[0],e.range[1],o),a=e.value,l=s.validation.value1,h=s.validation.value2,p=s.validation.operator,d=s.validation.type,c=s.validation.ignoreBlank,u=this.formatValidation(e.value,d);if(r=u.isValidate,n=u.errorMsg,r){if(r=!1,"Date"===d||"Time"===d)for(var f=0;f<=3;f++){e.value=0===f?e.value:1===f?s.validation.value1:s.validation.value2;var g={value:e.value,rowIndex:e.range[0],colIndex:e.range[1],sheetIndex:e.sheetIdx,updatedVal:""};""!==e.value&&this.parent.notify(ct,g);var m=g.updatedVal;0===f?a="Date"===d?e.value:m.slice(m.indexOf(".")+1,m.length):1===f?l="Date"===d?m:m.slice(m.indexOf(".")+1,m.length):h="Date"===d?m:m.slice(m.indexOf(".")+1,m.length)}else"TextLength"===s.validation.type&&(a=e.value.toString().length.toString());if("List"===d)if(-1!==l.indexOf("="))for(f=0;f<this.data.length;f++)e.value===this.data[f].text&&(r=!0);else{var v=l.split(",");for(f=0;f<v.length;f++)e.value===v[f]&&(r=!0)}else switch("Decimal"===d?(a=parseFloat(a.toString()),l=parseFloat(l.toString()),h=h?parseFloat(h.toString()):null):(a=parseInt(a.toString(),10),l=parseInt(l.toString(),10),h=h?parseInt(h.toString(),10):null),p){case"EqualTo":r=a===l||!(!c||""!==i);break;case"NotEqualTo":r=a!==l||!(!c||""!==i);break;case"Between":r=a>=l&&a<=h||!(!c||""!==i);break;case"NotBetween":r=!(a>=l&&a<=h);break;case"GreaterThan":r=a>l||!(!c||""!==i);break;case"LessThan":r=a<l||!(!c||""!==i);break;case"GreaterThanOrEqualTo":r=a>=l||!(!c||""!==i);break;case"LessThanOrEqualTo":r=a<=l||!(!c||""!==i)}}if(n=t.getConstant("ValidationError"),r){var y=this.parent.getCellStyleValue(["backgroundColor","color"],[e.range[0],e.range[1]]);this.parent.notify(lt,{style:y,rowIdx:e.range[0],colIdx:e.range[1],isHeightCheckNeeded:!0,manualUpdate:!0,onActionUpdate:!0})}return{isValidate:r,errorMsg:n}},e.prototype.checkDataValidation=function(e){var t=this.isValidationHandler({value:e.value,range:e.range,sheetIdx:e.sheetIdx});!t.isValidate&&e.isCell&&this.validationErrorHandler(t.errorMsg),this.parent.allowDataValidation=t.isValidate},e.prototype.formatValidation=function(e,t){var r,n,o=this.parent.element.getElementsByClassName("e-sheet-panel")[0],s=this.parent.createElement("form",{id:"formId",className:"form-horizontal"}),a=this.parent.createElement("input",{id:"e-validation",innerHTML:e});a.setAttribute("name","validation"),a.setAttribute("type","text"),a.setAttribute("value",e),s.appendChild(a),o.appendChild(s);var l;switch(t){case"Date":l={rules:{validation:{date:!0}},customPlacement:function(e,t){n=t.innerText}};break;case"Decimal":l={rules:{validation:{number:!0}},customPlacement:function(e,t){n=t.innerText}};break;case"WholeNumber":l={rules:{validation:{regex:/^\d*\.?[0]*$/}},customPlacement:function(e,t){n=t.innerText}}}return r=new i.FormValidator("#formId",l).validate(),o.removeChild(o.getElementsByClassName("form-horizontal")[0]),{isValidate:r,errorMsg:n}},e.prototype.validationErrorHandler=function(e){var t=this,r=document.getElementsByClassName("e-spreadsheet-edit")[0],n=this.parent.serviceLocator.getService(Us);if(!this.parent.element.querySelector(".e-validationerror-dlg")){var i=this.parent.serviceLocator.getService(js),o={width:400,height:200,isModal:!0,showCloseIcon:!0,cssClass:"e-validationerror-dlg",target:document.querySelector(".e-control.e-spreadsheet"),beforeOpen:function(n){var o={dialogName:"ValidationErrorDialog",element:n.element,target:n.target,cancel:n.cancel};t.parent.trigger("dialogBeforeOpen",o),o.cancel&&(t.errorDlgHandler(i,"Cancel"),n.cancel=!0),r.focus(),i.dialogInstance.content=e,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(o,!1)}},e.prototype.errorDlgHandler=function(e,t){if("Retry"===t){var r=document.getElementsByClassName("e-spreadsheet-edit")[0];this.parent.getMainContent();if(e.hide(),r.innerText){var n=document.createRange();n.setStart(r.childNodes[0],0),n.setEnd(r.childNodes[0],r.innerText.length);var i=window.getSelection();i.removeAllRanges(),i.addRange(n),this.listObj&&this.listObj.showPopup()}}else{var o=c(this.parent.getActiveSheet().activeCell),s=this.parent.getDisplayText(this.parent.getActiveSheet().rows[o[0]].cells[o[1]]);this.parent.notify(Fr,{action:"cancelEdit",value:s,refreshFormulaBar:!0,refreshEditorElem:!0,isAppend:!1,trigEvent:!0}),e.hide()}},e.prototype.getModuleName=function(){return"dataValidation"},e}(),cs=function(){function e(e){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(ti,this.protect,this),this.parent.on(ei,this.protectSheetHandler,this),this.parent.on(li,this.editProtectedAlert,this),this.parent.on(nr,this.lockCellsHandler,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(ti,this.protect),this.parent.off(ei,this.protectSheetHandler),this.parent.off(li,this.editProtectedAlert),this.parent.off(nr,this.lockCellsHandler))},e.prototype.protect=function(e){this.parent.notify(Qr,null),e.isActive?(this.parent.getActiveSheet().isProtected=!1,this.parent.notify(kn,{props:"Protect"}),this.parent.notify(ei,{isActive:e.isActive}),this.parent.notify(di,null)):this.createDialogue()},e.prototype.createDialogue=function(){var e=this,r=this.parent.serviceLocator.getService(Us),n=[{text:r.getConstant("SelectCells"),id:"1"},{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 a.ListView({width:"250px",dataSource:n,showCheckBox:!0,select:this.dialogOpen.bind(this)});var i=this.parent.createElement("div",{className:"e-protect-content",innerHTML:r.getConstant("ProtectAllowUser")});this.parent.getActiveSheet().isProtected=!1;var s=new o.CheckBox({checked:!0,label:r.getConstant("ProtectContent"),cssClass:"e-protect-checkbox"}),l=this.parent.createElement("div",{className:"e-protect-option-list",id:this.parent.element.id+"_option_list"}),h=this.parent.createElement("div",{className:"e-header-content",innerHTML:r.getConstant("ProtectSheet")}),p=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:h.outerHTML,content:p.outerHTML+i.outerHTML+l.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),e.parent.element.focus()},open:function(){e.okBtnFocus()},beforeClose:function(){var r=document.getElementById(e.parent.element.id+"_protect_check");t.EventHandler.remove(r,"focus",e.okBtnFocus),t.EventHandler.remove(s.element,"click",e.checkBoxClickHandler),e.parent.element.focus()},buttons:[{click:this.selectOption.bind(this,this.dialog,this),buttonModel:{content:r.getConstant("Ok"),isPrimary:!0}}]}),s.appendTo("#"+this.parent.element.id+"_protect_check"),this.optionList.appendTo("#"+this.parent.element.id+"_option_list"),this.optionList.selectMultipleItems([{id:"1"}]),t.EventHandler.add(s.element,"click",this.checkBoxClickHandler,this)},e.prototype.okBtnFocus=function(){var e=this;document.getElementById(this.parent.element.id+"_protect_check").addEventListener("focus",function(){e.dialog.dialogInstance.element.getElementsByClassName("e-footer-content")[0].querySelector("button").focus()})},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,this.dialog.dialogInstance.element.getElementsByClassName("e-footer-content")[0].querySelector("button").focus())},e.prototype.dialogOpen=function(){this.dialog.dialogInstance.element.getElementsByClassName("e-footer-content")[0].querySelector("button").focus()},e.prototype.selectOption=function(){var e=this.parent.serviceLocator.getService(Us),t=this.optionList.getSelectedItems();this.parent.getActiveSheet().isProtected=!0;var r={selectCells:t.text.indexOf(e.getConstant("SelectCells"))>-1,formatCells:t.text.indexOf(e.getConstant("FormatCells"))>-1,formatRows:t.text.indexOf(e.getConstant("FormatRows"))>-1,formatColumns:t.text.indexOf(e.getConstant("FormatColumns"))>-1,insertLink:t.text.indexOf(e.getConstant("InsertLinks"))>-1};this.parent.protectSheet(null,r),this.parent.notify(di,null),this.parent.notify(_n,null),this.dialog.hide()},e.prototype.protectSheetHandler=function(e){var t=this.parent.getActiveSheet(),r=this.parent.element.id,n=[r+"_undo",r+"_redo",r+"_cut",r+"_copy",r+"_paste",r+"_number_format",r+"_font_name",r+"_font_size",r+"_bold",r+"_italic",r+"_line-through",r+"_underline",r+"_font_color_picker",r+"_fill_color_picker",r+"_borders",r+"_merge_cells",r+"_text_align",r+"_vertical_align",r+"_wrap",r+"_sorting",r+"_clear",r+"_conditionalformatting"],i=[r+"_cut",r+"_copy",r+"_number_format",r+"_font_name",r+"_font_size",r+"_bold",r+"_italic",r+"_line-through",r+"_underline",r+"_font_color_picker",r+"_fill_color_picker",r+"_borders",r+"_text_align",r+"_vertical_align",r+"_wrap",r+"_sorting",r+"_clear",r+"_conditionalformatting"],o=[r+"_insert_function"],s=[r+"_hyperlink",r+"_"],a=[r+"_"],l=[r+"_find"],h=[r+"_datavalidation"],p=document.getElementById(this.parent.element.id+"_sheet_panel");p&&(t.isProtected&&t.protectSettings.selectCells?p.classList.remove("e-protected"):p.classList.add("e-protected"),t.isProtected||p.classList.remove("e-protected")),this.parent.dataBind(),this.parent.notify(ri,{disableHomeBtnId:n,enableHomeBtnId:i,enableFrmlaBtnId:o,enableInsertBtnId:s,findBtnId:l,dataValidationBtnId:h,imageBtnId:a}),this.parent.notify(pi,null),this.parent.notify(kn,{props:"Protect"})},e.prototype.editProtectedAlert=function(){var e=this,t=this.parent.serviceLocator.getService(Us);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(t){var r={dialogName:"EditAlertDialog",element:t.element,target:t.target,cancel:t.cancel};e.parent.trigger("dialogBeforeOpen",r),r.cancel&&(t.cancel=!0),e.parent.element.focus()},close:function(){return e.parent.element.focus()}})},e.prototype.lockCellsHandler=function(e){var t=this.parent.getActiveSheet(),r={isLocked:!!e.isLocked&&e.isLocked};q(e.rowIdx,e.colIdx,t,r,!0)},e.prototype.getModuleName=function(){return"protectSheet"},e}(),us=function(){function e(e){this.shortValue="",this.parent=e,this.addEventListener()}return e.prototype.addEventListener=function(){this.parent.on(ii,this.renderFindDlg,this),this.parent.on(ni,this.renderGotoDlg,this),this.parent.on(jt,this.gotoHandler,this),this.parent.on(oi,this.findHandler,this),this.parent.on(si,this.replaceHandler,this),this.parent.on(Wt,this.showDialog,this),this.parent.on(er,this.replaceAllDialog,this),this.parent.on(Gt,this.findUndoRedo,this),this.parent.on(Yt,this.findKeyUp,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(ii,this.renderFindDlg),this.parent.off(ni,this.renderGotoDlg),this.parent.off(jt,this.gotoHandler),this.parent.off(oi,this.findHandler),this.parent.off(si,this.replaceHandler),this.parent.off(Wt,this.showDialog),this.parent.off(er,this.replaceAllDialog),this.parent.off(Gt,this.findUndoRedo),this.parent.off(Yt,this.findKeyUp))},e.prototype.findUndoRedo=function(e){var t={address:e.address,compareVal:e.compareVal,cancel:!1};if("before"===e.undoRedoOpt)this.parent.notify(Gn,{action:"beforeReplace",eventArgs:t});else if("after"===e.undoRedoOpt){if(!t.cancel){var r={address:e.address,compareVal:e.compareVal};this.parent.notify(Wn,{action:"replace",eventArgs:r})}}else if("beforeReplaceAll"===e.undoRedoOpt){if(!t.cancel){var n={replaceValue:e.replaceValue,addressCollection:e.Collection};this.parent.notify(Gn,{action:"beforeReplaceAll",eventArgs:n})}}else if("afterReplaceAll"===e.undoRedoOpt&&!t.cancel){var i={replaceValue:e.replaceValue,addressCollection:e.Collection};this.parent.notify(Wn,{action:"replaceAll",eventArgs:i})}},e.prototype.renderFindDlg=function(){var e=this,r=this.parent.serviceLocator.getService(Us),n=this.parent.serviceLocator.getService(js);if(t.isNullOrUndefined(this.parent.element.querySelector(".e-find-dlg"))){var i={isModal:!1,showCloseIcon:!0,cssClass:"e-find-dlg",allowDragging:!0,header:r.getConstant("FindAndReplace"),closeOnEscape:!1,beforeOpen:function(t){var r={dialogName:"FindAndReplaceDialog",element:t.element,target:t.target,cancel:t.cancel};e.parent.trigger("dialogBeforeOpen",r),r.cancel&&(t.cancel=!0),n.dialogInstance.content=e.findandreplaceContent(),n.dialogInstance.dataBind(),e.parent.element.focus()},buttons:[{buttonModel:{content:r.getConstant("FindPreviousBtn"),isPrimary:!0,cssClass:"e-btn-findPrevious",disabled:!0},click:function(){e.dialogMessage(),e.findDlgClick("prev")}},{buttonModel:{content:r.getConstant("FindNextBtn"),isPrimary:!0,cssClass:"e-btn-findNext",disabled:!0},click:function(){e.dialogMessage(),e.findDlgClick("next")}},{buttonModel:{content:r.getConstant("ReplaceBtn"),isPrimary:!0,cssClass:"e-btn-replace",disabled:!0},click:function(){e.dialogMessage(),e.findDlgClick("replace")}},{buttonModel:{content:r.getConstant("ReplaceAllBtn"),isPrimary:!0,cssClass:"e-btn-replaceAll",disabled:!0},click:function(){e.dialogMessage(),e.findDlgClick("replaceAll")}}],open:function(){if(e.parent.element.querySelector(".e-text-findNext").value){var r=e.parent.element.querySelector(".e-btn-findPrevious");t.getComponent(r,"btn").disabled=!1,t.getComponent(e.parent.element.querySelector(".e-btn-findNext"),"btn").disabled=!1}},close:function(){n.hide()}};n.show(i,!1)}else n.hide()},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(Us),n=this.parent.serviceLocator.getService(js);if(t.isNullOrUndefined(this.parent.element.querySelector(".e-find-dlg"))){var i={width:300,isModal:!1,showCloseIcon:!0,cssClass:"e-goto-dlg",allowDragging:!0,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(),e.parent.element.focus()},buttons:[{buttonModel:{content:r.getConstant("Ok"),isPrimary:!0,cssClass:"e-btn-goto-ok"},click:function(){e.gotoHandler()}}],close:function(){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.findDlgClick=function(e){"prev"===e?this.findHandler({findOption:e}):"next"===e?this.findHandler({findOption:e}):this.replaceHandler({findDlgArgs:e})},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.activeSheetIndex,o=this.parent.element.querySelector(".e-findnreplace-checkcase"),s=void 0;if(o){s=t.getComponent(o,"checkbox").checked}else s=!1;var a=this.parent.element.querySelector(".e-findnreplace-checkmatch"),l=void 0;if(a){l=t.getComponent(a,"checkbox").checked}else l=!1;var h=this.parent.element.querySelector(".e-findnreplace-searchby"),p=void 0;if(h){p=t.getComponent(h,"dropdownlist").value.toString()}else p="By Row";var d=this.parent.element.querySelector(".e-findnreplace-searchwithin"),c=void 0;if(d){c=t.getComponent(d,"dropdownlist").value.toString()}else c="Sheet";var u={value:n,sheetIndex:i,findOpt:e.findOption,mode:c,isCSen:s,isEMatch:l,searchBy:p};"next"===e.findOption||"prev"===e.findOption?this.parent.find(u):"count"===e.countArgs.countOpt&&(this.parent.notify("count",u),e.countArgs.findCount=u.findCount)}},e.prototype.replaceHandler=function(e){var r=this.parent.activeSheetIndex,n=this.parent.element.querySelector(".e-text-findNext"),i=this.parent.element.querySelector(".e-text-replaceInp"),o=this.parent.element.querySelector(".e-findnreplace-checkcase"),s=t.getComponent(o,"checkbox"),a=this.parent.element.querySelector(".e-findnreplace-checkmatch"),l=t.getComponent(a,"checkbox"),h=this.parent.element.querySelector(".e-findnreplace-searchby"),p=t.getComponent(h,"dropdownlist"),d=this.parent.element.querySelector(".e-findnreplace-searchwithin"),c=t.getComponent(d,"dropdownlist"),u={value:n.value,mode:c.value.toString(),isCSen:s.checked,isEMatch:l.checked,searchBy:p.value.toString(),findOpt:"next",replaceValue:i.value,replaceBy:e.findDlgArgs?e.findDlgArgs:e.replaceMode,sheetIndex:r};this.parent.replace(u)},e.prototype.gotoHandler=function(e){if(e)this.parent.goTo(e.address);else{var t=this.parent.element.querySelector(".e-text-goto").value,r=t.split("");if(""===t||isNaN(parseInt(r[1],10)))return void this.gotoAlert();var n=t.toString().toUpperCase();this.parent.goTo(n)}},e.prototype.gotoAlert=function(){var e=this.parent.serviceLocator.getService(Us),t=this.parent.createElement("span",{className:"e-goto-alert-span",innerHTML:e.getConstant("InsertingEmptyValue")});this.parent.element.querySelector(".e-goto-dlg").querySelector(".e-dlg-content").appendChild(t)},e.prototype.showDialog=function(){this.parent.element.querySelector(".e-replace-alert-span")&&this.parent.element.querySelector(".e-replace-alert-span").remove();var e=this.parent.serviceLocator.getService(Us),t=this.parent.createElement("span",{className:"e-find-alert-span",innerHTML:e.getConstant("NoElements")});this.parent.element.querySelector(".e-find-dlg").querySelector(".e-dlg-content").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(Us),r=this.parent.createElement("span",{className:"e-replace-alert-span",innerHTML:e.count+t.getConstant("ReplaceAllEnd")+e.replaceValue});this.parent.element.querySelector(".e-find-dlg").querySelector(".e-dlg-content").appendChild(r)},e.prototype.findKeyUp=function(e){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,o=this.parent.element.querySelector(".e-text-replaceInp").value;t.isNullOrUndefined(i)||t.isNullOrUndefined(o)||""===i||""===o?(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.dialogMessage()):!1===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(Us);e.appendChild(t);var a=this.parent.createElement("div",{className:"e-cont"}),l=this.parent.createElement("p",{className:"e-header",innerHTML:n.getConstant("FindWhat")}),h=this.parent.createElement("input",{className:"e-input e-text-findNext",attrs:{type:"Text",placeholder:n.getConstant("FindValue"),value:this.shortValue}});a.appendChild(h),a.insertBefore(l,h),t.appendChild(a);var p=new i.TextBox({width:"70%"});p.createElement=this.parent.createElement,p.appendTo(h);var d=this.parent.createElement("div",{className:"e-cont"}),c=this.parent.createElement("p",{className:"e-header",innerHTML:n.getConstant("ReplaceWith")}),u=this.parent.createElement("input",{className:"e-input e-text-replaceInp",attrs:{type:"Text",placeholder:n.getConstant("ReplaceValue")}});d.appendChild(u),d.insertBefore(c,u),t.appendChild(d);var f=new i.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-searchby",fields:{value:"Id",text:"Within"},width:"50%",index:0}),v=this.parent.createElement("input",{className:"e-findnreplace-searchwithin",attrs:{type:"select",label:n.getConstant("SearchBy")}}),y=this.parent.createElement("p",{className:"e-header",innerHTML:n.getConstant("SearchWithin")});t.appendChild(y),t.appendChild(v),m.createElement=this.parent.createElement,m.appendTo(v);var C=[{Id:"By Row",Search:n.getConstant("ByRow")},{Id:"By Column",Search:n.getConstant("ByColumn")}],b=new s.DropDownList({dataSource:C,cssClass:"e-searchby",fields:{value:"Id",text:"Search"},width:"50%",index:0}),S=this.parent.createElement("input",{className:"e-findnreplace-searchby",attrs:{type:"select",label:n.getConstant("SearchBy")}}),x=this.parent.createElement("p",{className:"e-header",innerHTML:n.getConstant("SearchBy")});t.appendChild(x),t.appendChild(S),b.createElement=this.parent.createElement,b.appendTo(S);var w=new o.CheckBox({label:n.getConstant("MatchCase"),checked:!1,cssClass:"e-findnreplace-casecheckbox"}),I=this.parent.createElement("input",{className:"e-findnreplace-checkcase",attrs:{type:"checkbox"}});r.appendChild(I),w.createElement=this.parent.createElement,w.appendTo(I);var E=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),E.createElement=this.parent.createElement,E.appendTo(k),t.appendChild(r),e},e.prototype.GotoContent=function(){var e=this.parent.serviceLocator.getService(Us),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"}),o=this.parent.createElement("p",{className:"e-header",innerHTML:e.getConstant("Reference")}),s=new i.TextBox({placeholder:e.getConstant("EntercellAddress")}),a=this.parent.createElement("input",{className:"e-text-goto",attrs:{type:"Text"}});return n.appendChild(a),n.insertBefore(o,a),r.appendChild(n),s.createElement=this.parent.createElement,s.appendTo(a),t},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.getModuleName=function(){return"findAndReplace"},e}(),fs=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.merge=function(e){var t=this;e.showDialog?this.parent.serviceLocator.getService(js).show({target:this.parent.element,height:180,width:400,isModal:!0,showCloseIcon:!0,content:this.parent.serviceLocator.getService(Us).getConstant("PasteMergeAlert"),beforeOpen:function(e){var r={dialogName:"MergeDialog",element:e.element,target:e.target,cancel:e.cancel};t.parent.trigger("dialogBeforeOpen",r),r.cancel&&(e.cancel=!0),t.parent.element.focus()}}):this.parent.serviceLocator.getService("cell").refresh(e.rowIdx,e.colIdx,e.lastCell,e.element)},e.prototype.hideHandler=function(e){var t=this.parent.getActiveSheet(),r={range:[e.rowIdx,e.colIdx,e.rowIdx,e.colIdx]};this.parent.notify(ar,r),r.range=r.range;var n,i=j(r.range[0],r.range[1],t)||{},o="row"===e.model?r.range[0]:r.range[1];if(n=o+((i[e.model+"Span"]||1)-1),!(!e.isEnd&&(e.start===o||oe(t,o))||e.isEnd&&e.start>o&&!oe(t,o))&&i[e.model+"Span"]>1&&n>=e.start)if("row"===e.model?J(t,o):oe(t,o)){if(e.end<n&&(n-e.end>1||i.rowSpan>1)){var s=this.parent.getCell(e.rowIdx,e.end+1);if(s&&(n-e.end>1&&(s.colSpan=n-e.end),s.style.display=""),i.rowSpan>1){var a=i.rowSpan-this.parent.hiddenCount(e.rowIdx,e.rowIdx+(i.rowSpan-1));a>1&&(s.rowSpan=a)}}}else this.merge({rowIdx:r.range[0],colIdx:r.range[1]})},e.prototype.checkPrevMerge=function(e){var t,r,n,i=this.parent.getActiveSheet();e.isRow?e.rowIdx-1>-1&&J(i,e.rowIdx-1)&&(void 0===(t=j(e.rowIdx-1,e.colIdx,i)||{}).rowSpan&&void 0===t.colSpan||!(void 0===t.colSpan||t.colSpan>1||e.colIdx-1>-1&&oe(i,e.colIdx-1))||(r={range:[e.rowIdx-1,e.colIdx,e.rowIdx-1,e.colIdx]},this.parent.notify(ar,r),r.range=r.range,J(i,r.range[0])&&r.range[2]>=e.rowIdx&&(t=j(r.range[0],r.range[1],i)||{}).rowSpan>1&&((n=r.range[2]-e.rowIdx+1-this.parent.hiddenCount(e.rowIdx,e.rowIdx+(r.range[2]-e.rowIdx)))>1&&(e.td.rowSpan=n,e.td.style.display=""),t.colSpan>1&&!(e.colIdx-1>-1&&oe(i,e.colIdx-1))&&(n=t.colSpan-this.parent.hiddenCount(e.colIdx,e.colIdx+(t.colSpan-1),"columns"))>1&&(e.td.colSpan=n,e.td.style.display="")))):e.colIdx-1>-1&&oe(i,e.colIdx-1)&&(void 0===(t=j(e.rowIdx,e.colIdx-1,i)||{}).colSpan&&void 0===t.rowSpan||!(void 0===t.rowSpan||t.rowSpan>1||e.rowIdx-1>-1&&J(i,e.rowIdx-1))||(r={range:[e.rowIdx,e.colIdx-1,e.rowIdx,e.colIdx-1]},this.parent.notify(ar,r),r.range=r.range,oe(i,r.range[1])&&r.range[3]>=e.colIdx&&(t=j(r.range[0],r.range[1],i)||{}).colSpan>1&&((n=r.range[3]-e.colIdx+1-this.parent.hiddenCount(e.colIdx,e.colIdx+(t.colSpan-1),"columns"))>1&&(e.td.colSpan=n,e.td.style.display=""),t.rowSpan>1&&!(e.rowIdx-1>-1&&J(i,e.rowIdx-1))&&(n=t.rowSpan-this.parent.hiddenCount(e.rowIdx,e.rowIdx+(t.rowSpan-1)))>1&&(e.td.rowSpan=n,e.td.style.display=""))))},e.prototype.checkMerge=function(e){var t=this.parent.getActiveSheet(),r=j(e.rowIdx,e.colIdx,t)||{};if(e.isRow){if(void 0===r.colSpan||oe(t,e.colIdx-1)){if((n={range:[e.rowIdx,e.colIdx,e.rowIdx,e.colIdx]}).range=n.range,this.parent.notify(ar,n),oe(t,e.colIdx-1)&&!oe(t,n.range[1]))return;r=j(n.range[0],n.range[1],t);(i=n.range[2]-e.rowIdx+1-this.parent.hiddenCount(e.rowIdx,n.range[2]))>1&&(this.merge({rowIdx:n.range[0],colIdx:n.range[1],element:e.td}),e.td.rowSpan=i)}}else if(void 0===r.rowSpan||J(t,e.rowIdx-1)){var n;if((n={range:[e.rowIdx,e.colIdx,e.rowIdx,e.colIdx]}).range=n.range,this.parent.notify(ar,n),J(t,e.rowIdx-1)&&!J(t,n.range[0]))return;r=j(n.range[0],n.range[1],t);var i;(i=n.range[3]-e.colIdx+1-this.parent.hiddenCount(e.colIdx,n.range[3],"columns"))>1&&(this.merge({rowIdx:n.range[0],colIdx:n.range[1],element:e.td}),e.td.colSpan=i)}},e.prototype.addEventListener=function(){this.parent.on(or,this.merge,this),this.parent.on(ci,this.hideHandler,this),this.parent.on(ui,this.checkPrevMerge,this),this.parent.on(fi,this.checkMerge,this)},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(or,this.merge),this.parent.off(ci,this.hideHandler),this.parent.off(ui,this.checkPrevMerge),this.parent.off(fi,this.checkMerge))},e.prototype.getModuleName=function(){return"merge"},e}(),gs=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.destroy=function(){this.removeEventListener()},e.prototype.addEventListener=function(){this.parent.on(ur,this.cFInitialRender,this),this.parent.on(dr,this.cFInitialCheckHandler,this),this.parent.on(yi,this.checkConditionalFormatHandler,this),this.parent.on(vi,this.initiateCFHandler,this),this.parent.on(Ci,this.setCFHandler,this),this.parent.on(fr,this.cFDeleteHandler,this),this.parent.on(mr,this.clearCFHandler,this),this.parent.on(vr,this.addClearCFHandler,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(ur,this.cFInitialRender),this.parent.off(dr,this.cFInitialCheckHandler),this.parent.off(yi,this.checkConditionalFormatHandler),this.parent.off(vi,this.initiateCFHandler),this.parent.off(Ci,this.setCFHandler),this.parent.off(fr,this.cFDeleteHandler),this.parent.off(mr,this.clearCFHandler))},e.prototype.setCF=function(e){e.range=e.range||this.parent.getActiveSheet().selectedRange;var t={range:e.range,type:e.type,cFColor:e.cFColor,value:e.value,cancel:!1};this.parent.notify(Gn,{eventArgs:t,action:"conditionalFormat"}),t.cancel||(e.type=t.type,e.cFColor=t.cFColor,e.value=t.value,e.range=t.range,this.parent.notify(pr,{conditionalFormat:e}),delete t.cancel,this.parent.notify(Wn,{eventArgs:t,action:"conditionalFormat"}))},e.prototype.addClearCFHandler=function(e){for(var t=this.parent.getActiveSheet(),r=e.conditionalFormats,n=e.oldRange,i=e.selectedRange,o=t.conditionalFormats,s=0;s<r.length;s++){for(var a=!1,l=0;l<o.length;l++)if(o[l].type===r[s].type&&o[l].range===r[s].range){a=!0,o[l].range=n[s],t.conditionalFormats[l].range=n[s];for(var h=d(i),p=n[s].split(","),c=0;c<p.length;c++)for(var u=d(p[c]),f=u[0];f<=u[2];f++)for(var g=u[1];g<=u[3];g++)for(var m=h[0];m<=h[2];m++)for(var v=h[1];v<=h[3];v++)if(m===f&&v===g){var y=this.parent.getCell(f,g),C=t.rows[f]&&t.rows[f].cells[g]?t.rows[f].cells[g]:null;C&&this.cFInitialCheckHandler({rowIdx:f,colIdx:g,cell:C,td:y,conditionalFormat:o[l]})}}if(!a){var b=r[s];b.range=n[s],this.parent.notify(pr,{conditionalFormat:b})}}},e.prototype.cFDeleteHandler=function(e){var t=this.parent.getCell(e.rowIdx,e.colIdx);t&&(t.querySelector(".e-cf-databar")&&t.removeChild(t.querySelector(".e-cf-databar")),t.querySelector(".e-iconsetspan")&&t.removeChild(t.querySelector(".e-iconsetspan")))},e.prototype.clearCFHandler=function(e){var t=this.parent.getActiveSheet(),r=this.parent.getCell(e.rIdx,e.cIdx),n=j(e.rIdx,e.cIdx,t);if(r){if(r.classList.remove("e-redft"),r.classList.remove("e-yellowft"),r.classList.remove("e-greenft"),r.classList.remove("e-redf"),r.classList.remove("e-redt"),r.classList.remove("e-iconset"),r.style){if(r.style.backgroundColor){r.style.backgroundColor="";var i=this.parent.getCellStyleValue(["backgroundColor"],[e.rIdx,e.cIdx]);this.parent.notify(lt,{style:i,rowIdx:e.rIdx,colIdx:e.cIdx})}if(r.style.color){r.style.color="";i=this.parent.getCellStyleValue(["color"],[e.rIdx,e.cIdx]);this.parent.notify(lt,{style:i,rowIdx:e.rIdx,colIdx:e.cIdx})}}r.querySelector(".e-cf-databar")&&(r.removeChild(r.querySelector(".e-cf-databar")),r.textContent=this.parent.getDisplayText(n)),r.querySelector(".e-iconsetspan")&&(r.removeChild(r.querySelector(".e-iconsetspan")),r.textContent=this.parent.getDisplayText(n))}},e.prototype.setCFHandler=function(e){"cf_databars"===e.action?this.setCF({type:e.id}):"cf_colorscales"===e.action?this.setCF({type:e.id}):"cf_iconsets"===e.action&&this.setCF({type:e.id})},e.prototype.initiateCFHandler=function(e){var t=this,r=this.parent.serviceLocator.getService(Us),n=this.parent.serviceLocator.getService(js);n.show({width:375,showCloseIcon:!0,isModal:!0,cssClass:"e-conditionalformatting-dlg",header:e.action.replace("...",""),target:document.querySelector(".e-control.e-spreadsheet"),beforeOpen:function(){n.dialogInstance.content=t.cFDlgContent(e.action),n.dialogInstance.dataBind(),t.parent.element.focus()},buttons:[{buttonModel:{content:r.getConstant("Ok"),isPrimary:!0,cssClass:"e-btn e-clearall-btn e-flat"},click:function(){t.dlgClickHandler(e.action),n.hide()}}]}),n.dialogInstance.refresh()},e.prototype.dlgClickHandler=function(e){var t="",r="",n=this.parent.element.querySelector(".e-conditionalformatting-dlg").getElementsByClassName("e-dlg-content")[0].querySelector(".e-cf-dlg"),i=n.querySelector(".e-cfmain");if(i){var o=i.getElementsByTagName("input")[0];o&&o.parentElement.classList.contains("e-cfmain")&&(t=i.getElementsByTagName("input")[0].value),r=i.getElementsByTagName("input")[1]?n.querySelector(".e-cfmain").getElementsByTagName("input")[1].value:""}var s=this.getCFColor(n.querySelector(".e-cfsub").getElementsByTagName("input")[0].value),a="Duplicate Values..."===e?n.querySelector(".e-cfmain").getElementsByTagName("input")[0].value:this.getType(e);""!==t&&""!==r?this.setCF({type:a,cFColor:s,value:t+","+r}):""!==t?this.setCF({type:a,cFColor:s,value:t}):this.setCF({type:a,cFColor:s,value:r})},e.prototype.getType=function(e){var t=this.parent.serviceLocator.getService(Us),r="";switch(e){case t.getConstant("GreaterThan")+"...":r="GreaterThan";break;case t.getConstant("LessThan")+"...":r="LessThan";break;case t.getConstant("Between")+"...":r="Between";break;case t.getConstant("CFEqualTo")+"...":r="EqualTo";break;case t.getConstant("TextThatContains")+"...":r="ContainsText";break;case t.getConstant("ADateOccuring")+"...":r="DateOccur";break;case t.getConstant("Top10Items")+"...":r="Top10Items";break;case t.getConstant("Bottom10Items")+"...":r="Bottom10Items";break;case t.getConstant("Top10")+" %...":r="Top10Percentage";break;case t.getConstant("Bottom10")+" %...":r="Bottom10Percentage";break;case t.getConstant("AboveAverage")+"...":r="AboveAverage";break;case t.getConstant("BelowAverage")+"...":r="BelowAverage"}return r},e.prototype.getCFColor=function(e){var t=this.parent.serviceLocator.getService(Us),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(Us),n=this.parent.createElement("div",{className:"e-cf-dlg"}),o=this.parent.createElement("div",{className:"e-cfmain"}),a=this.parent.createElement("div",{className:"e-cfsub"}),l=this.parent.createElement("span",{className:"e-header e-top-header",innerHTML:t}),h=this.parent.createElement("input",{className:"e-input",id:"valueInput",attrs:{type:"text"}}),p=this.parent.createElement("input",{className:"e-select"}),d=this.parent.createElement("span",{className:"e-header",innerHTML:"with"}),c=this.parent.createElement("input",{className:"e-select"});if(n.appendChild(o),n.appendChild(a),o.appendChild(l),e!==r.getConstant("DuplicateValues")+"..."){if(e!==r.getConstant("AboveAverage")+"..."&&e!==r.getConstant("BelowAverage")+"..."&&(o.appendChild(h),e===r.getConstant("Top10Items")+"..."||e===r.getConstant("Top10")+" %..."||e===r.getConstant("Bottom10Items")+"..."||e===r.getConstant("Bottom10")+" %...")){new i.NumericTextBox({value:10}).appendTo(h)}}else{o.appendChild(p);var u=[{text:r.getConstant("Duplicate"),id:"duplicate"},{text:r.getConstant("Unique"),id:"unique"}];new s.DropDownList({dataSource:u,index:0,popupHeight:"200px"}).appendTo(p)}if(e===r.getConstant("Between")+"..."){var f=this.parent.createElement("span",{className:"e-header e-header-2",innerHTML:r.getConstant("And")}),g=this.parent.createElement("input",{className:"e-input"});o.appendChild(f),o.appendChild(g)}a.appendChild(d),a.appendChild(c);var m=[{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:m,index:0,popupHeight:"200px"}).appendTo(c),n},e.prototype.checkCellHandler=function(e,t,r){for(var n=!1,i=r.range.trim().split(","),o=0;o<i.length;o++){var s=i[o],a=d(s=s.indexOf(":")>-1?s:s+":"+s);if(e>=a[0]&&e<=a[2]&&t>=a[1]&&t<=a[3]){n=!0;break}}return n},e.prototype.getDlgText=function(e){var t=this.parent.serviceLocator.getService(Us),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.cFInitialRender=function(e){var t=this.parent.getActiveSheet().conditionalFormats;if(t)for(var r=0;r<t.length;r++){this.checkCellHandler(e.rowIdx,e.colIdx,t[r])&&this.cFInitialCheckHandler({rowIdx:e.rowIdx,colIdx:e.colIdx,cell:e.cell,td:e.td,conditionalFormat:t[r]})}},e.prototype.cFInitialCheckHandler=function(e){this.parent.getActiveSheet();var t,r=["e-redft","e-yellowft","e-greenft","e-redf","e-redt"],n=e.cell.value||"",i=e.conditionalFormat,o=e.td||this.parent.getCell(e.rowIdx,e.colIdx);if(o&&(i.type=i.type||"GreaterThan",i.cFColor=i.cFColor?i.cFColor:i.format?i.cFColor:"RedFT",this.cFRCheck(i,n,o,e.rowIdx,e.colIdx,!0))){for(var s=0;s<r.length;s++)if(o.classList.contains(r[s])){o.classList.remove(r[s]);break}i.format&&i.format.style&&(t=i.format.style);var a={};i.cFColor?(o.classList.add("e-"+i.cFColor.toLowerCase()),a=this.setFormat(a,i)):a=t,a.backgroundColor&&o.style.setProperty("background-color",a.backgroundColor),a.color&&o.style.setProperty("color",a.color),a.fontWeight&&o.style.setProperty("font-weight",a.fontWeight),a.fontStyle&&o.style.setProperty("font-style",a.fontStyle),a.textDecoration&&o.style.setProperty("text-decoration",a.textDecoration)}},e.prototype.checkConditionalFormatHandler=function(e){var r,n,i=!1,o=!1,s=this.parent.getActiveSheet(),a=e.cell,l=s.conditionalFormats,h=(this.parent.getMainContent(),a?t.isNullOrUndefined(a.value)?"":a.value:""),p=["e-redft","e-yellowft","e-greenft","e-redf","e-redt"];if(n=this.parent.getCell(e.rowIdx,e.colIdx),l&&!(l.length<1))for(var c=0;c<l.length;c++){for(var u=l[c].range.trim().split(","),f=0;f<u.length;f++){if(m=(m=u[f]).indexOf(":")>-1?m:m+":"+m,r=d(m),e.rowIdx>=r[0]&&e.colIdx>=r[1]&&e.rowIdx<=r[2]&&e.colIdx<=r[3]){o=!0;break}}if(o){if("GreaterThanLessThanEqualToBetweenContainsTextDateOccur".includes(s.conditionalFormats[c].type)){var g=j(e.rowIdx,e.colIdx,s)&&j(e.rowIdx,e.colIdx,s).value?j(e.rowIdx,e.colIdx,s).value:"";i=(!t.isNullOrUndefined(g)||""!==g)&&this.cFRCheck(s.conditionalFormats[c],g,n),this.setColor(n,e.rowIdx,e.colIdx,c,i)}else if("Top10ItemsBottom10ItemsTop10%Bottom10%AboveAverageBelowAverageDuplicateUnique".includes(s.conditionalFormats[c].type))for(f=0;f<u.length;f++)for(var m,v=(r=d(m=(m=u[f]).indexOf(":")>-1?m:m+":"+m))[0];v<=r[2];v++){s.rows[v]||$(s,v,{});for(var y=r[1];y<=r[3];y++){s.rows[v].cells&&s.rows[v].cells[y]||q(v,y,s,{});g=j(v,y,s)&&j(v,y,s).value?j(v,y,s).value:"";i=this.cFRCheck(s.conditionalFormats[c],g,n,v,y,!1),n=this.parent.getCell(v,y),this.setColor(n,v,y,c,i)}}else if("BlueDataBarGreenDataBarRedDataBarOrangeDataBarLightBlueDataBarPurpleColorScaleGYRColorScaleRYGColorScaleGWRColorScaleRWGColorScaleBWRColorScaleRWBColorScaleWRColorScaleRWColorScaleGWColorScaleWGColorScaleGYColorScaleYGColorScaleThreeArrowsThreeArrowsGrayFourArrowsGrayFourArrowsFiveArrowsGrayFiveArrowsThreeTrafficLights1ThreeTrafficLights2ThreeSignsFourTrafficLightsFourRedToBlackThreeSymbolsThreeSymbols2ThreeFlagsFourRatingFiveQuartersFiveRatingThreeTrianglesThreeStarsFiveBoxes".includes(s.conditionalFormats[c].type)){for(var C=0;C<p.length;C++)n.classList.contains(p[C])&&n.classList.remove(p[C]);i=this.cFRCheck(s.conditionalFormats[c],h,n,e.rowIdx,e.colIdx,!1)}o=!1}}},e.prototype.setColor=function(e,t,r,n,i){var o=this.parent.getActiveSheet().conditionalFormats,s=["e-redft","e-yellowft","e-greenft","e-redf","e-redt"],a=!1;if(o[n].cFColor)e.classList.contains("e-"+o[n].cFColor.toLowerCase())&&(a=!0);else if(o[n].format.style.backgroundColor&&e.style.backgroundColor){var l=this.hexToRgb(o[n].format.style.backgroundColor);"rgb("+l.r+", "+l.g+", "+l.b+")"===e.style.backgroundColor&&(a=!0)}if(i){if(a)for(var h=0;h<s.length;h++)if(e.classList.contains(s[h])){e.classList.remove(s[h]);break}var p={};o[n].cFColor?(e.classList.add("e-"+o[n].cFColor.toLowerCase()),p=this.setFormat(p,o[n])):p=o[n].format.style,this.parent.notify(lt,{style:p,rowIdx:t,colIdx:r,lastCell:!0,isHeightCheckNeeded:!0,manualUpdate:!0})}else{if(a){for(h=0;h<s.length;h++)if(e.classList.contains(s[h])){e.classList.remove(s[h]);break}e.removeAttribute("style")}var d=j(t,r,this.parent.getActiveSheet());p=d.style?d.style:{};this.parent.notify(lt,{style:p,rowIdx:t,colIdx:r})}},e.prototype.hexToRgb=function(e){var t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:null},e.prototype.cFRCheck=function(e,t,r,n,i,o){var s="",a="",l=t.toString();if(e.value){var h=e.value.split(",");if(h.length>1)if(h[0].split("(").length>1){for(var p="",d=0;d<h.length;d++)(p+=h[d]+",").split("(").length===p.split(")").length&&""===s&&(s=p.substring(0,p.length-1),p="");a=p.substring(0,p.length-1)}else{s=h[0];for(d=1;d<h.length;d++)a+=d+1===h.length?h[d]:h[d]+","}else s=e.value}var c=!1,u=e.type;switch("BlueDataBarGreenDataBarRedDataBarOrangeDataBarLightBlueDataBarPurpleDataBar".includes(u)&&(u="DataBar"),"GYRColorScaleRYGColorScaleGWRColorScaleRWGColorScaleBWRColorScaleRWBColorScaleWRColorScaleRWColorScaleGWColorScaleWGColorScaleGYColorScaleYGColorScale".includes(u)&&(u="ColorScale"),"ThreeArrowsThreeArrowsGrayFourArrowsGrayFourArrowsFiveArrowsGrayFiveArrowsThreeTrafficLights1ThreeTrafficLights2ThreeSignsFourTrafficLightsFourRedToBlackThreeSymbolsThreeSymbols2ThreeFlagsFourRatingFiveQuartersFiveRatingThreeTrianglesThreeStarsFiveBoxes".includes(u)&&(u="IconSet"),u){case"GreaterThan":c=this.isGreaterThanLessThan(e,l,s,!0);break;case"LessThan":c=this.isGreaterThanLessThan(e,l,s,!1);break;case"Between":c=this.isBetWeen(e,l,s,a);break;case"EqualTo":c=this.isEqualTo(e,l,s);break;case"ContainsText":c=this.isContainsText(l,s);break;case"DateOccur":var f={value:s,rowIndex:0,colIndex:0,sheetIndex:0,updatedVal:""};this.parent.notify(ct,f),l===f.updatedVal&&(c=!0);break;case"Unique":case"Duplicate":c=this.isDuplicateUnique(l,e,!1);break;case"Top10Items":c=this.isTopBottomTenValue(l,s,e,!0);break;case"Bottom10Items":c=this.isTopBottomTenValue(l,s,e,!1);break;case"Top10Percentage":c=this.isTopBottomTenPercentage(l,s,e,!0);break;case"Bottom10Percentage":c=this.isTopBottomTenPercentage(l,s,e,!1);break;case"AboveAverage":c=this.isAboveBelowAverage(l,s,e,!0);break;case"BelowAverage":c=this.isAboveBelowAverage(l,s,e,!1);break;case"DataBar":case"ColorScale":case"IconSet":this.isDataBarColorScalesIconSets(u,l,e,r,n,i,o)}return c},e.prototype.isDataBarColorScalesIconSets=function(e,t,r,n,i,o,s){var a=this.parent.getActiveSheet();if(s)"DataBar"===e?this.applyDataBars(t,r,n,i,o):"ColorScale"===e?this.applyColorScale(t,r,n,i,o,s):this.applyIconSet(t,r,n,i,o,s);else{n=null;for(var l=r.range.split(","),h=0;h<l.length;h++)for(var p=d(l[h]),c=p[0];c<=p[2];c++)for(var u=p[1];u<=p[3];u++)if(j(c,u,a)){var f=j(c,u,a).value;n=this.parent.getCell(c,u),"DataBar"===e?this.applyDataBars(f,r,n,c,u):"ColorScale"===e?this.applyColorScale(f,r,n,c,u,s):this.applyIconSet(f,r,n,c,u,s)}}},e.prototype.applyIconSet=function(e,r,n,i,o,s){var a,l,h=parseInt(e,10),p=this.getIconList(r.type).split(","),c=[],u=this.parent.getActiveSheet(),f=u.rows[i]&&u.rows[i].cells[o]?u.rows[i].cells[o]:null;if(f){for(var g=n||this.parent.getMainContent().getElementsByClassName("e-row")[i].getElementsByClassName("e-cell")[o],m=r.range.split(","),v=0;v<m.length;v++){var y=d(m[v]);c=this.getNumericArray(y,c)}a=(c=c.sort(function(e,t){return e-t}))[0],l=c[c.length-1];var C;if(3===p.length){var b=a+.33*(l-a);C="e-"+(h>=a+.67*(l-a)?p[0].trim():h>=b?p[1].trim():p[2].trim())}else if(4===p.length){var S=a+.25*(l-a),x=a+.5*(l-a);C="e-"+(h>=(w=a+.75*(l-a))?p[0].trim():h>=x?p[1].trim():h>=S?p[2].trim():p[3].trim())}else if(5===p.length){S=a+.2*(l-a),x=a+.4*(l-a);var w=a+.6*(l-a);C="e-"+(h>=a+.8*(l-a)?p[0].trim():h>=w?p[1].trim():h>=x?p[2].trim():h>=S?p[3].trim():p[4].trim())}if(!t.isNullOrUndefined(f)){var I=this.parent.createElement("span",{className:"e-icon"});I.classList.add("e-iconsetspan"),I.classList.add(C),this.applyIconSetIcon({rowIndex:i,colIndex:o},I,g)}}},e.prototype.applyIconSetIcon=function(e,t,r){var n=this.parent.getActiveSheet(),i=j(e.rowIndex,e.colIndex,n).value,o=r;n.index;o.classList.contains("e-iconset")&&o.querySelector(".e-iconsetspan")&&o.removeChild(o.querySelector(".e-iconsetspan")),F(i)&&(o.insertBefore(t,o.childNodes[0]),o.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,o,s){var a,l=this.parent.getActiveSheet(),h=parseInt(e,10),p=[],c=this.getColor(r.type),u=l.rows[i]&&l.rows[i].cells[o]?l.rows[i].cells[o]:null;if(u){for(var f=r.range.split(","),g=n||this.parent.getMainContent().getElementsByClassName("e-row")[i].getElementsByClassName("e-cell")[o],m=0;m<f.length;m++){var v=d(f[m]);p=this.getNumericArray(v,p)}p=p.sort(function(e,t){return e-t}).reverse();for(var y=0;y<p.length;y++)if(p[y]===h){a=y;break}var C=0===a?c[0]:a===p.length-1?c[c.length-1]:3===p.length&&1===a?c[1]:this.getGradient(a,c[0],c[1],c[2],p.length);if(!t.isNullOrUndefined(u)){var b={};t.isNullOrUndefined(a)?(b=this.parent.getCellStyleValue(["backgroundColor"],[i,o]),g.style.backgroundColor=b.backgroundColor):(b={backgroundColor:C},g.style.backgroundColor=C)}}},e.prototype.applyDataBars=function(e,r,n,i,o){var s,a=this.parent.getActiveSheet(),l={},h={},p="",c="",u=r.type,f=a.rows[i]&&a.rows[i].cells[o]?a.rows[i].cells[o]:null;if(f){var g,m=[],v=this.parent.getMainContent().getElementsByClassName("e-row")[i],y=n||this.parent.getMainContent().getElementsByClassName("e-row")[i].getElementsByClassName("e-cell")[o],C=v&&v.style?parseInt(v.style.height,10):20,b=[],S=[],x=0;s=parseInt(e,10);for(var w=r.range.split(","),I=0;I<w.length;I++){var E=d(w[I]);m=this.getNumericArray(E,m)}for(var k=0;k<m.length;k++)m[k]>0?b.push(m[k]):S.push(m[k]);if(u="BlueDataBar"===u?"B":"GreenDataBar"===u?"G":"RedDataBar"===u?"R":"OrangeDataBar"===u?"O":"LightBlueDataBar"===u?"LB":"PurpleDataBar"===u?"P":"",p=this.getColor(u)[0],c=this.getColor("R")[0],b=b.sort(function(e,t){return e-t}).reverse(),(S=S.sort(function(e,t){return e-t})).length&&b.length)g=b[0]+Math.abs(S[0]),x=Math.abs(S[0]/g*100);else{if(!S.length&&!b.length)return;g=S.length?S[0]:b[0]}if(y&&(t.isNullOrUndefined(s)||""===e)&&y.getElementsByClassName("e-cf-databar")[0]&&y.removeChild(y.getElementsByClassName("e-cf-databar")[0]),F(s)){var R=this.parent.createElement("div",{id:"spreadsheet-databar",className:"e-cf-databar"}),A=this.parent.createElement("span",{id:"spreadsheet-leftspan",className:"e-databar"}),T=this.parent.createElement("span",{id:"spreadsheet-rightspan",className:"e-databar"}),N=this.parent.createElement("span",{id:"spreadsheet-dataspan",className:"e-databar-value"}),O=void 0;l=A.style,h=T.style,R.appendChild(N),R.insertBefore(T,N),R.insertBefore(A,T),y.querySelector(".e-iconsetspan")&&(O=y.querySelector(".e-iconsetspan")),y.textContent="",y.appendChild(R),O&&y.insertBefore(O,y.firstElementChild),N.innerHTML=this.parent.getDisplayText(f),R.style.height=C-1+"px",N.style.fontSize="11pt",S.length?b.length?s>-1?(l.width=x+"%",l.height=C-3+"px",l.backgroundColor="transparent",l.left="0px",h.width=Math.ceil(Math.abs(s/g*100))+"%",h.height=C-3+"px",h.backgroundColor=u=p,h.left=x+"%"):s<0&&(l.width=Math.ceil(Math.abs(s/g*100))+"%",l.height=C-3+"px",l.backgroundColor=c,l.width===x+"%"?l.left="0px":l.right=100-x+"%"):(h.width=Math.ceil(Math.abs(s/g*100))+"%",h.height=C-3+"px",h.backgroundColor=u=c,h.left="0px"):(h.width=Math.ceil(Math.abs(s/g*100))+"%",h.height=C-3+"px",h.backgroundColor=u=p,h.left="0px")}}},e.prototype.getNumericArray=function(e,r){for(var n=this.parent.getActiveSheet(),i=e[0];i<=e[2];i++)for(var o=e[1];o<=e[3];o++){var s=j(i,o,n)&&j(i,o,n).value?j(i,o,n).value:"";if(t.isNullOrUndefined(s)||F(s)||T(s)){var a=parseInt(s,10);t.isNullOrUndefined(s)||""===s||r.push(a)}}return r},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,o){if(t.isNullOrUndefined(i))return this.getLinear(r,n,e/o);var s=o/2;return e>=s?this.getLinear(n,i,Math.abs((e-s)/s)):this.getLinear(r,n,e/s)},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,n){var i=new RegExp(/[^.-a-zA-Z 0-9]+/g),o=!1;if(F(t))if(F(r))o=n?parseFloat(t)>parseFloat(r.replace(i,"")):parseFloat(t)<parseFloat(r.replace(i,""));else{var s={value:r,rowIndex:0,colIndex:0,sheetIndex:0,isDate:!1,updatedVal:"",isTime:!1};this.parent.notify(ct,s),s.isDate||s.isTime?(o=n?t>s.updatedVal:t<s.updatedVal,e.value=s.updatedVal.toString()):o=n?t.toLowerCase()>r.toLowerCase():t.toLowerCase()<r.toLowerCase()}else""!==t||n||(o=!0);return o},e.prototype.isBetWeen=function(e,t,r,n){var i=new RegExp(/[^.-a-zA-Z 0-9]+/g),o=!1;if(r=r.replace(i,""),n=n.replace(i,""),F(t))if(F(r))o=parseFloat(t)>=parseFloat(r)&&parseFloat(t)<=parseFloat(n);else if(r&&n){var s={value:r,rowIndex:0,colIndex:0,sheetIndex:0,isDate:!1,updatedVal:"",isTime:!1},a={value:n,rowIndex:0,colIndex:0,sheetIndex:0,isDate:!1,updatedVal:"",isTime:!1};this.parent.notify(ct,s),this.parent.notify(ct,a),(s.isDate||s.isTime)&&(a.isDate||a.isTime)?(o=t>=s.updatedVal&&t<=a.updatedVal,e.value=s.updatedVal.toString()+","+a.updatedVal.toString()):o=t.toLowerCase()>=r.toLowerCase()&&t.toLowerCase()<=n.toLowerCase()}return o},e.prototype.isEqualTo=function(e,t,r){var n=new RegExp(/[^.-a-zA-Z 0-9]+/g),i=!1;if(F(t))if(F(r))i=parseFloat(t)===parseFloat(r.replace(n,""));else{var o={value:r,rowIndex:0,colIndex:0,sheetIndex:0,isDate:!1,updatedVal:"",isTime:!1};this.parent.notify(ct,o),o.isTime||o.isDate?(i=t===o.updatedVal,e.value=o.updatedVal.toString()):i=t.toLowerCase()===r.toLowerCase()}return i},e.prototype.isContainsText=function(e,r){var n=new RegExp(/[^.-a-zA-Z 0-9]+/g),i=!1;return t.isNullOrUndefined(e)||!e.length?i=!1:F(r.replace(n,""))?(r=r.replace(n,""),T(e)&&(e=A(e).toString()),i=e.indexOf(r)>-1):T(r)?(T(e)&&(e=A(e).toString()),i=e.indexOf(A(r).toString())>-1):i=e.toLowerCase().indexOf(r.toLowerCase())>-1,i},e.prototype.isTopBottomTenValue=function(e,t,r,n){var i=this.parent.getActiveSheet(),o=new RegExp(/[^.-a-zA-Z 0-9]+/g),s=parseInt(e,10),a=parseInt(t,10),l=!1;if(F(t)){F(e)?(s=parseFloat(e),a=parseFloat(t.replace(o,""))):T(e)&&(s=A(e),a=parseFloat(t));for(var h=[],p=void 0,c=r.range.split(","),u=0;u<c.length;u++)for(var f=d(c[u]),g=f[0];g<=f[2];g++)for(var m=f[1];m<=f[3];m++)(p=j(g,m,i)&&j(g,m,i).value?j(g,m,i).value:"")&&F(p)&&(p=parseFloat(p),h.push(p));l=(h=(h=n?h.sort(function(e,t){return e-t}).reverse():h.sort(function(e,t){return e-t})).slice(0,a)).indexOf(s)>-1}return l},e.prototype.isTopBottomTenPercentage=function(e,t,r,n){var i=this.parent.getActiveSheet(),o=new RegExp(/[^.-a-zA-Z 0-9]+/g),s=parseInt(e,10),a=parseInt(t,10),l=!1;if(F(t)){F(e)?(s=parseFloat(e),a=parseFloat(t.replace(o,""))):T(e)&&(s=A(e),a=parseFloat(t));for(var h=[],p=void 0,c=0,u=void 0,f=r.range.split(","),g=0;g<f.length;g++)for(var m=d(f[g]),v=m[0];v<=m[2];v++)for(var y=m[1];y<=m[3];y++)(p=j(v,y,i)&&j(v,y,i).value?j(v,y,i).value:"")&&F(p)&&(p=parseFloat(p),h.push(p)),c++;u=a/(100/c),u=Math.ceil(u),l=(h=(h=n?h.sort(function(e,t){return e-t}).reverse():h.sort(function(e,t){return e-t})).slice(0,u||1)).indexOf(s)>-1}return l},e.prototype.isAboveBelowAverage=function(e,t,r,n){for(var i,o=this.parent.getActiveSheet(),s=parseFloat(e),a=r.range.split(","),l=[],h=0,p=0;p<a.length;p++)for(var c=d(a[p]),u=c[0];u<=c[2];u++)for(var f=c[1];f<=c[3];f++)(i=j(u,f,o)&&j(u,f,o).value?j(u,f,o).value:"")&&F(i)&&(i=parseFloat(i),l.push(i));for(var g=0;g<l.length;g++)h+=l[g];return h/=l.length,n?s>h:s<h},e.prototype.isDuplicateUnique=function(e,r,n){var i,o=r.type,s=0,a=this.parent.getActiveSheet(),l=e,h=r.range.split(",");if(t.isNullOrUndefined(l)||""===l)return!1;for(var p=0;p<h.length;p++)for(var c=d(h[p]),u=c[0];u<=c[2];u++)for(var f=c[1];f<=c[3];f++)if((i=j(u,f,a)&&j(u,f,a).value?j(u,f,a).value.toString():"")&&""!==i&&2===(s=l.toLowerCase()===i.toLowerCase()?s+1:s))return"Duplicate"===o;return"Duplicate"!==o},e.prototype.setFormat=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}(),ms=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)}}(),vs=function(){return(vs=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)},ys=function(e,t,r,n){var i,o=arguments.length,s=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,r,s):i(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},Cs=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return ms(r,e),ys([t.Property("")],r.prototype,"text",void 0),ys([t.Property("")],r.prototype,"iconCss",void 0),ys([t.Property("left")],r.prototype,"iconPosition",void 0),r}(t.ChildProperty),bs=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return ms(r,e),ys([t.Complex({},Cs)],r.prototype,"header",void 0),ys([t.Collection([],n.Item)],r.prototype,"content",void 0),ys([t.Property("")],r.prototype,"cssClass",void 0),ys([t.Property(!1)],r.prototype,"disabled",void 0),r}(t.ChildProperty),Ss=function(e){function r(t,r){return e.call(this,t)||this}return ms(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.destroy(),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,i=this.createElement("ul",{id:this.element.id+"_menu"});this.element.appendChild(i);var o=new n.Menu({cssClass:"e-file-menu",items:e,showItemOnClick:!0,beforeOpen:function(t){t.parentItem.text===e[0].text&&(o.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||requestAnimationFrame(function(){return o.setProperties({showItemOnClick:!0},!0)})):n.cancel=!0},beforeItemRender:function(e){r.trigger("beforeFileMenuItemRender",e)}});return o.createElement=this.createElement,o.appendTo(i),i.parentElement},r.prototype.renderRibbon=function(){var e=this,r=this.createElement("div"),i=this.createElement("div");this.toolbarObj=new n.Toolbar({items:this.items[this.selectedTab].content,clicked:function(t){return e.trigger("clicked",t)}}),this.toolbarObj.createElement=this.createElement,this.toolbarObj.appendTo(i),this.tabObj=new n.Tab({selectedItem:this.getIndex(this.selectedTab),animation:{next:{duration:0},previous:{duration:0}},items:this.getTabItems(),selecting:function(r){if(e.menuItems.length&&0===r.selectingIndex)r.cancel=!0;else{if(r.selectingIndex===e.getIndex(e.selectedTab))return;e.updateToolbar(e.getIndex(r.selectingIndex,!0)),e.toolbarObj.dataBind(),e.element.classList.contains("e-collapsed")&&t.EventHandler.remove(r.selectedItem,"click",e.ribbonExpandCollapse);var n=void 0;e.menuItems.length?((n=vs({},r)).selectingIndex-=1,n.selectedIndex-=1):n=r,e.trigger("selecting",n)}},selected:function(t){t.selectedIndex!==e.getIndex(e.selectedTab)&&(e.setProperties({selectedTab:e.getIndex(t.selectedIndex,!0)},!0),e.element.classList.contains("e-collapsed")&&(e.element.classList.remove("e-collapsed"),e.trigger("expandCollapse",{element:e.toolbarObj.element,expanded:!0})))},created:function(){e.toolbarObj.refreshOverflow()}}),this.element.appendChild(r),this.tabObj.createElement=this.createElement,this.tabObj.appendTo(r);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 o=t.getComponent(document.getElementById(this.element.id+"_menu"),"menu");n?o.insertAfter(e.reverse(),r,i):o.insertBefore(e,r,i)}},r.prototype.hideTabs=function(e,t){var r=this;void 0===t&&(t=!0);var n,i,o,s;if(t||(s=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),o=!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),o=!0))}),this.setProperties({items:this.items},!0),this.tabObj.items=this.tabObj.items,this.tabObj.dataBind(),t&&(s=this.isAllHidden())&&(i=!1),!t&&s&&(i=!i),o&&s&&(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 a=0;a<this.items.length;a++)if(!this.items[a].cssClass.includes(" e-hide")){this.tabObj.selectedItem=this.getIndex(a),this.tabObj.dataBind();break}},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 bs(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,i){var o=this,s=this.getTabIndex(e);t.isNullOrUndefined(i)&&(i=this.items[s].content.length),r.forEach(function(e){e=new n.Item(o.items[s].content[0],"content",e,!0),o.items[s].content.splice(i,0,e),i++}),this.setProperties({items:this.items},!0),s===this.selectedTab&&r.length&&this.updateToolbar(s)},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 o=0;o<this.items[n].content.length;o++)if(this.items[n].content[o].id===t[i]){t[i]=o;break}if("string"==typeof t[i])return;this.items[n].content[t[i]].disabled=!r}n===this.selectedTab&&this.updateToolbar(n)}else this.toolbarObj.disable(!r)},r.prototype.hideToolbarItems=function(e,t,r){var n=this;void 0===r&&(r=!0);for(var i,o=0;o<this.items.length;o++)if(this.items[o].header.text===e){i=o,t.forEach(function(e){n.items[i].content[e]&&(r?n.items[i].content[e].cssClass.includes(" e-hide")||(n.items[i].content[e].cssClass=n.items[i].content[e].cssClass+" e-hide"):n.items[i].content[e].cssClass.includes(" e-hide")&&(n.items[i].content[e].cssClass=n.items[i].content[e].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()}}},ys([t.Property("")],r.prototype,"cssClass",void 0),ys([t.Property(!0)],r.prototype,"menuType",void 0),ys([t.Collection([],n.MenuItem)],r.prototype,"menuItems",void 0),ys([t.Property(0)],r.prototype,"selectedTab",void 0),ys([t.Collection([],bs)],r.prototype,"items",void 0),ys([t.Event()],r.prototype,"selecting",void 0),ys([t.Event()],r.prototype,"fileMenuItemSelect",void 0),ys([t.Event()],r.prototype,"beforeFileMenuItemRender",void 0),ys([t.Event()],r.prototype,"beforeOpen",void 0),ys([t.Event()],r.prototype,"beforeClose",void 0),ys([t.Event()],r.prototype,"selectFormat",void 0),ys([t.Event()],r.prototype,"clicked",void 0),ys([t.Event()],r.prototype,"created",void 0),ys([t.Event()],r.prototype,"expandCollapse",void 0),r=ys([t.NotifyPropertyChanges],r)}(t.Component),xs=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"}});this.fontColorPicker=new i.ColorPicker({value:"#000000ff",mode:"Palette",showButtons:!1,presetColors:zs,enableOpacity:!1,beforeClose:function(t){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(ot,r),r.cancel?e.fontColorPicker.setProperties({value:e.fontColorPicker.getValue(t.previousValue.rgba,"HEXA")},!0):e.updateSelectedColor(r.style.color,e.fontColorPicker.element),e.parent.element.focus()},created:function(){return e.wireFocusEvent(e.fontColorPicker.element,"#000000")}}),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 i.ColorPicker({value:"#ffff00ff",mode:"Palette",presetColors:Ws,showButtons:!1,enableOpacity:!1,open:this.openHandler.bind(this),beforeClose:function(t){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(ot,r),r.cancel?e.filColorPicker.setProperties({value:e.filColorPicker.getValue(t.previousValue.rgba,"HEXA")},!0):e.updateSelectedColor(r.style.backgroundColor,e.filColorPicker.element),e.parent.element.focus()},created:function(){return e.wireFocusEvent(e.filColorPicker.element,"#ffff00")}}),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){t.nextElementSibling.querySelector(".e-selected-color").style.borderBottomColor=e},e.prototype.wireFocusEvent=function(e,t){var r=this;this.updateSelectedColor(t,e),(e=e.parentElement.querySelector(".e-split-colorpicker")).addEventListener("focus",function(){r.parent.element.focus()})},e.prototype.openHandler=function(e){e.element.querySelector(".e-mode-switch-btn").title=this.parent.serviceLocator.getService(Us).getConstant("MoreColors")},e.prototype.beforeCloseHandler=function(e){e.modeSwitcher||e.setProperties({modeSwitcher:!0},!0),e.showButtons&&e.setProperties({showButtons:!1},!0)},e.prototype.beforeModeSwitch=function(e,t){var r=this.parent.serviceLocator.getService(Us);"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.destroy(),this.fontColorPicker=null,this.filColorPicker.destroy(),this.filColorPicker=null,this.parent=null)},e.prototype.addEventListener=function(){this.parent.on(un,this.render,this),this.parent.on("destroyRibbonComponents",this.destroy,this),this.parent.on(Tr,this.destroy,this)},e.prototype.removeEventListener=function(){this.parent.off(un,this.render),this.parent.off("destroyRibbonComponents",this.destroy),this.parent.on(Tr,this.destroy,this)},e}(),ws=function(){function e(e){this.border="1px solid #000000",this.fontNameIndex=5,this.numPopupWidth=0,this.findValue="",this.parent=e,this.addEventListener(),new xs(e)}return e.prototype.getModuleName=function(){return"ribbon"},e.prototype.initRibbon=function(e){this.parent.showRibbon||!this.ribbon?(this.parent.notify(un,{}),this.parent.isMobileView()?this.createMobileView():this.createRibbon(e)):this.destroy()},e.prototype.getRibbonMenuItems=function(){var e=this.parent.serviceLocator.getService(Us),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"}]}]}]},e.prototype.getRibbonItems=function(){var e=this,t=this.parent.element.id,r=this.parent.serviceLocator.getService(Us),n=[{header:{text:r.getConstant("Home")},content:[{prefixIcon:"e-undo-icon",tooltipText:r.getConstant("Undo")+" (Ctrl+Z)",id:t+"_undo",disabled:!0},{prefixIcon:"e-redo-icon",tooltipText:r.getConstant("Redo")+" (Ctrl+Y)",id:t+"_redo",disabled:!0},{type:"Separator",id:t+"_separator_1"},{prefixIcon:"e-cut-icon",tooltipText:r.getConstant("Cut")+" (Ctrl+X)",id:t+"_cut"},{prefixIcon:"e-copy-icon",tooltipText:r.getConstant("Copy")+" (Ctrl+C)",id:t+"_copy"},{tooltipText:r.getConstant("Paste")+" (Ctrl+V)",template:this.getPasteBtn(t),id:t+"_paste",disabled:!0},{type:"Separator",id:t+"_separator_2"},{template:this.getNumFormatDDB(t),tooltipText:r.getConstant("NumberFormat"),id:t+"_number_format"},{type:"Separator",id:t+"_separator_3"},{template:this.getFontNameDDB(t),tooltipText:r.getConstant("Font"),id:t+"_font_name"},{type:"Separator",id:t+"_separator_4"},{template:this.getFontSizeDDB(t),tooltipText:r.getConstant("FontSize"),id:t+"_font_size"},{type:"Separator",id:t+"_separator_5"},{template:this.getBtn(t,"bold"),tooltipText:r.getConstant("Bold")+" (Ctrl+B)",id:t+"_bold"},{template:this.getBtn(t,"italic"),tooltipText:r.getConstant("Italic")+" (Ctrl+I)",id:t+"_italic"},{template:this.getBtn(t,"line-through"),tooltipText:r.getConstant("Strikethrough")+" (Ctrl+5)",id:t+"_line-through"},{template:this.getBtn(t,"underline"),tooltipText:r.getConstant("Underline")+" (Ctrl+U)",id:t+"_underline"},{template:document.getElementById(t+"_font_color_picker"),tooltipText:r.getConstant("TextColor"),id:t+"_font_color_picker"},{type:"Separator",id:t+"_separator_6"},{template:document.getElementById(t+"_fill_color_picker"),tooltipText:r.getConstant("FillColor"),id:t+"_fill_color_picker"},{template:this.getBordersDBB(t),tooltipText:r.getConstant("Borders"),id:t+"_borders"},{template:this.getMergeSplitBtn(t),tooltipText:r.getConstant("MergeCells"),id:t+"_merge_cells",disabled:!0},{type:"Separator",id:t+"_separator_7"},{template:this.getTextAlignDDB(t),tooltipText:r.getConstant("HorizontalAlignment"),id:t+"_text_align"},{template:this.getVerticalAlignDDB(t),tooltipText:r.getConstant("VerticalAlignment"),id:t+"_vertical_align"},{template:this.getBtn(t,"wrap",!1),tooltipText:""+r.getConstant("WrapText"),id:t+"_wrap"}]},{header:{text:r.getConstant("Insert")},content:[{prefixIcon:"e-hyperlink-icon",text:r.getConstant("Link"),id:t+"_hyperlink",tooltipText:r.getConstant("Link"),click:function(){e.getHyperlinkDlg()}},{prefixIcon:"e-image-icon",text:r.getConstant("Image"),id:t+"_",tooltipText:r.getConstant("Image"),click:function(){e.parent.element.querySelector("#"+t+"_imageUpload").click()}}]},{header:{text:r.getConstant("Formulas")},content:[{prefixIcon:"e-insert-function",tooltipText:r.getConstant("InsertFunction"),text:r.getConstant("InsertFunction"),id:t+"_insert_function"}]},{header:{text:r.getConstant("Data")},content:[{prefixIcon:"e-protect-icon",text:r.getConstant("ProtectSheet"),id:t+"_protect",tooltipText:r.getConstant("ProtectSheet")},{type:"Separator",id:t+"_separator_8"},{template:this.datavalidationDDB(t),tooltipText:r.getConstant("DataValidation"),id:t+"_datavalidation"}]},{header:{text:r.getConstant("View")},content:[{prefixIcon:"e-hide-headers",text:this.getLocaleText("Headers"),id:t+"_headers",tooltipText:this.getLocaleText("Headers")},{type:"Separator",id:t+"_separator_9"},{prefixIcon:"e-hide-gridlines",text:this.getLocaleText("GridLines"),id:t+"_gridlines",tooltipText:this.getLocaleText("GridLines")}]}];return this.parent.allowConditionalFormat&&n.find(function(e){return e.header&&e.header.text===r.getConstant("Home")}).content.push({type:"Separator",id:t+"_separator_10"},{template:this.getCFDBB(t),tooltipText:"Conditional Formatting",id:t+"_conditionalformatting"}),this.parent.allowCellFormatting&&n.find(function(e){return e.header&&e.header.text===r.getConstant("Home")}).content.push({type:"Separator",id:t+"_separator_10"},{template:this.getClearDDB(t),tooltipText:r.getConstant("Clear"),id:t+"_clear"}),(this.parent.allowSorting||this.parent.allowFiltering)&&n.find(function(e){return e.header&&e.header.text===r.getConstant("Home")}).content.push({template:this.getSortFilterDDB(t),tooltipText:r.getConstant("SortAndFilter"),id:t+"_sorting"}),this.parent.allowFindAndReplace&&n.find(function(e){return e.header&&e.header.text===r.getConstant("Home")}).content.push({template:this.getFindDDb(t),prefixIcon:"e-tbar-search-icon tb-icons",tooltipText:r.getConstant("FindReplaceTooltip"),id:t+"_find"}),n},e.prototype.getPasteBtn=function(e){var t=this,r=this.parent.element.appendChild(this.parent.createElement("button",{id:e+"_paste"})),n=this.parent.serviceLocator.getService(Us);return this.pasteSplitBtn=new l.SplitButton({iconCss:"e-icons e-paste-icon",items:[{text:n.getConstant("All"),id:"All"},{text:n.getConstant("Values"),id:"Values"},{text:n.getConstant("Formats"),id:"Formats"}],select:function(e){t.parent.notify(Zr,{type:e.item.id,isAction:!0})},click:function(){t.parent.notify(Zr,{isAction:!0})},close:function(){t.parent.element.focus()}}),this.pasteSplitBtn.createElement=this.parent.createElement,this.pasteSplitBtn.appendTo(r),r.parentElement},e.prototype.getHyperlinkDlg=function(){var e,r=d(this.parent.getActiveSheet().activeCell),n=this.parent.sheets[this.parent.getActiveSheet().id-1].rows[r[0]];t.isNullOrUndefined(n)||(e=n.cells[r[1]]),t.isNullOrUndefined(e)&&q(r[0],r[1],this.parent.getActiveSheet(),e,!1),e&&e.hyperlink?this.parent.notify(An,null):this.parent.notify(Rn,null)},e.prototype.getLocaleText=function(e,t){var r,n=this.parent.serviceLocator.getService(Us);return this.parent.getActiveSheet()["show"+e]?(t&&this.parent.getMainContent().classList.remove("e-hide-"+e.toLowerCase()),r=n.getConstant("Hide"+e)):(t&&this.parent.getMainContent().classList.add("e-hide-"+e.toLowerCase()),r=n.getConstant("Show"+e)),r},e.prototype.getLocaleProtectText=function(e,t){var r,n=this.parent.serviceLocator.getService(Us);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.createRibbon=function(e){var t=this.parent.createElement("div",{id:this.parent.element.id+"_ribbon"});if(this.ribbon=new Ss({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&&e.uiUpdate){var r=this.parent.element.querySelector(".e-formula-bar-panel")||document.getElementById(this.parent.element.id+"_sheet_panel");this.parent.element.insertBefore(t,r)}else this.parent.element.appendChild(t);this.ribbon.appendTo(t)},e.prototype.tabSelecting=function(e){e.selectingIndex!==this.ribbon.selectedTab&&(this.refreshRibbonContent(e.selectingIndex),this.parent.notify($r,{activeTab:e.selectingIndex}))},e.prototype.beforeRenderHandler=function(e){var t=this.parent.serviceLocator.getService(Us);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.getNumFormatDDB=function(e){var t=this,r=this.parent.createElement("button",{id:e+"_number_format"});return r.appendChild(this.parent.createElement("span",{className:"e-tbar-btn-text",innerHTML:"General"})),this.numFormatDDB=new l.DropDownButton({items:this.getNumFormatDdbItems(e),content:"",select:function(e){return t.numDDBSelect(e)},open:function(e){return t.numDDBOpen(e)},beforeItemRender:function(e){return t.previewNumFormat(e)},close:function(){return t.parent.element.focus()},cssClass:"e-flat e-numformat-ddb",beforeOpen:function(e){return t.tBarDdbBeforeOpen(e.element,e.items)}}),this.numFormatDDB.createElement=this.parent.createElement,this.numFormatDDB.appendTo(r),r},e.prototype.getFontSizeDDB=function(e){var t=this;return this.fontSizeDdb=new l.DropDownButton({cssClass:"e-font-size-ddb",content:"11",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.refreshSelected(t.fontSizeDdb,e.element,"content","text")},select:function(e){var r={style:{fontSize:e.item.text+"pt"},onActionUpdate:!0};t.parent.notify(ot,r),r.cancel||(t.fontSizeDdb.content=r.style.fontSize.split("pt")[0],t.fontSizeDdb.dataBind())},close:function(){return t.parent.element.focus()}}),this.fontSizeDdb.createElement=this.parent.createElement,this.fontSizeDdb.appendTo(this.parent.createElement("button",{id:e+"_font_size"})),this.fontSizeDdb.element},e.prototype.getCFDBB=function(e){var r=this,i=this.parent.serviceLocator.getService(Us);this.cFMenu=new n.Menu({cssClass:"e-cf-menu",items:[{iconCss:"e-icons e-hlcellrules",text:i.getConstant("HighlightCellsRules"),items:[{iconCss:"e-icons e-greaterthan",id:"cf_greaterthan",text:i.getConstant("GreaterThan")+"..."},{iconCss:"e-icons e-lessthan",id:"cf_lessthan",text:i.getConstant("LessThan")+"..."},{iconCss:"e-icons e-between",id:"cf_between",text:i.getConstant("Between")+"..."},{iconCss:"e-icons e-equalto",id:"cf_eqaulto",text:i.getConstant("CFEqualTo")+"..."},{iconCss:"e-icons e-textcontains",id:"cf_textthatcontains",text:i.getConstant("TextThatContains")+"..."},{iconCss:"e-icons e-adateoccuring",id:"cf_adateoccuring",text:i.getConstant("ADateOccuring")+"..."},{iconCss:"e-icons e-duplicate",id:"cf_duplicatevalues",text:i.getConstant("DuplicateValues")+"..."}]},{iconCss:"e-icons e-topbottomrules",text:i.getConstant("TopBottomRules"),items:[{iconCss:"e-icons e-top10items",id:"cf_top10items",text:i.getConstant("Top10Items")+"..."},{iconCss:"e-icons e-top10",id:"cf_top10",text:i.getConstant("Top10")+" %..."},{iconCss:"e-icons e-bottom10items",id:"cf_bottom10items",text:i.getConstant("Bottom10Items")+"..."},{iconCss:"e-icons e-bottom10",id:"cf_bottom10",text:i.getConstant("Bottom10")+" %..."},{iconCss:"e-icons e-aboveaverage",id:"cf_aboveaverage",text:i.getConstant("AboveAverage")+"..."},{iconCss:"e-icons e-belowaverage",id:"cf_belowaverage",text:i.getConstant("BelowAverage")+"..."}]},{iconCss:"e-icons e-databars",text:i.getConstant("DataBars"),items:[{id:"cf_databars"}]},{iconCss:"e-icons e-colorscales",text:i.getConstant("ColorScales"),items:[{id:"cf_colorscales"}]},{iconCss:"e-icons e-iconsets",text:i.getConstant("IconSets"),items:[{id:"cf_iconsets"}]},{iconCss:"e-icons e-clearrules",text:i.getConstant("ClearRules"),items:[{id:"cf_cr_cells",text:i.getConstant("SelectedCells")},{id:"cf_cr_sheet",text:i.getConstant("EntireSheet")}]}],orientation:"Vertical",beforeOpen:function(e){e.parentItem.text===i.getConstant("DataBars")?(e.element.firstChild.appendChild(o),e.element.parentElement.classList.add("e-databars")):e.parentItem.text===i.getConstant("ColorScales")?(e.element.firstChild.appendChild(g),e.element.parentElement.classList.add("e-colorscales")):e.parentItem.text===i.getConstant("IconSets")&&(e.element.firstChild.appendChild(N),e.element.parentElement.classList.add("e-iconsets"))},select:this.cFSelected.bind(this)});var o=this.parent.createElement("div",{id:"db",className:"e-db"}),s=this.parent.createElement("div",{id:"db1",className:"e-db1"}),a=this.parent.createElement("div",{id:"db2",className:"e-db2"});o.appendChild(s),o.appendChild(a);var h=this.parent.createElement("span",{id:"BlueDataBar",className:"e-bdatabar e-databar-icon"}),p=this.parent.createElement("span",{id:"GreenDataBar",className:"e-gdatabar e-databar-icon"}),d=this.parent.createElement("span",{id:"RedDataBar",className:"e-rdatabar e-databar-icon"}),c=this.parent.createElement("span",{id:"OrangeDataBar",className:"e-odatabar e-databar-icon"}),u=this.parent.createElement("span",{id:"LightBlueDataBar",className:"e-lbdatabar e-databar-icon"}),f=this.parent.createElement("span",{id:"PurpleDataBar",className:"e-pdatabar e-databar-icon"});s.appendChild(h),s.appendChild(p),s.appendChild(d),a.appendChild(c),a.appendChild(u),a.appendChild(f),this.cFMenu.createElement=this.parent.createElement;var g=this.parent.createElement("div",{id:"db",className:"e-cs"}),m=this.parent.createElement("div",{id:"cs1",className:"e-cs1"}),v=this.parent.createElement("div",{id:"cs2",className:"e-cs2"}),y=this.parent.createElement("div",{id:"cs3",className:"e-cs3"});g.appendChild(m),g.appendChild(v),g.appendChild(y);var C=this.parent.createElement("span",{id:"GYRColorScale",className:"e-gyr e-colorscale-icon"}),b=this.parent.createElement("span",{id:"RYGColorScale",className:"e-ryg e-colorscale-icon"}),S=this.parent.createElement("span",{id:"GWRColorScale",className:"e-gwr e-colorscale-icon"}),x=this.parent.createElement("span",{id:"RWGColorScale",className:"e-rwg e-colorscale-icon"}),w=this.parent.createElement("span",{id:"BWRColorScale",className:"e-bwr e-colorscale-icon"}),I=this.parent.createElement("span",{id:"RWBColorScale",className:"e-rwb e-colorscale-icon"}),E=this.parent.createElement("span",{id:"WRColorScale",className:"e-wr e-colorscale-icon"}),k=this.parent.createElement("span",{id:"RWColorScale",className:"e-rw e-colorscale-icon"}),R=this.parent.createElement("span",{id:"GWColorScale",className:"e-gw e-colorscale-icon"}),A=this.parent.createElement("span",{id:"WGColorScale",className:"e-wg e-colorscale-icon"}),T=this.parent.createElement("span",{id:"GYColorScale",className:"e-gy e-colorscale-icon"}),F=this.parent.createElement("span",{id:"YGColorScale",className:"e-yg e-colorscale-icon"});m.appendChild(C),m.appendChild(b),m.appendChild(S),m.appendChild(x),v.appendChild(w),v.appendChild(I),v.appendChild(E),v.appendChild(k),y.appendChild(R),y.appendChild(A),y.appendChild(T),y.appendChild(F);var N=this.parent.createElement("div",{id:"is",className:"e-is"}),O=this.parent.createElement("div",{id:"is1",className:"e-is1",innerHTML:"Directional"}),D=this.parent.createElement("div",{id:"is2",className:"e-is2"}),L=this.parent.createElement("div",{id:"is3",className:"e-is3",innerHTML:"Shapes"}),H=this.parent.createElement("div",{id:"is4",className:"e-is4"}),B=this.parent.createElement("div",{id:"is5",className:"e-is5",innerHTML:"Indicators"}),M=this.parent.createElement("div",{id:"is6",className:"e-is6"}),_=this.parent.createElement("div",{id:"is7",className:"e-is7",innerHTML:"Ratings"}),P=this.parent.createElement("div",{id:"is8",className:"e-is8"});N.appendChild(O),N.appendChild(D),N.appendChild(L),N.appendChild(H),N.appendChild(B),N.appendChild(M),N.appendChild(_),N.appendChild(P);var V=this.parent.createElement("div",{id:"ThreeArrows",className:"e-3arrows e-is-wrapper"}),U=this.parent.createElement("div",{id:"ThreeArrowsGray",className:"e-3arrowsgray e-is-wrapper"}),j=this.parent.createElement("div",{id:"ThreeTriangles",className:"e-3triangles e-is-wrapper"}),q=this.parent.createElement("div",{id:"FourArrowsGray",className:"e-4arrowsgray e-is-wrapper"}),z=this.parent.createElement("div",{id:"FourArrows",className:"e-4arrows e-is-wrapper"}),W=this.parent.createElement("div",{id:"FiveArrowsGray",className:"e-5arrowsgray e-is-wrapper"}),G=this.parent.createElement("div",{id:"FiveArrows",className:"e-5arrows e-is-wrapper"});D.appendChild(V),D.appendChild(U),D.appendChild(j),D.appendChild(q),D.appendChild(z),D.appendChild(W),D.appendChild(G);var Y=this.parent.createElement("div",{id:"ThreeTrafficLights1",className:"e-3trafficlights e-is-wrapper"}),X=this.parent.createElement("div",{id:"ThreeTrafficLights2",className:"e-3rafficlights2 e-is-wrapper"}),K=this.parent.createElement("div",{id:"ThreeSigns",className:"e-3signs e-is-wrapper"}),$=this.parent.createElement("div",{id:"FourTrafficLights",className:"e-4trafficlights e-is-wrapper"}),J=this.parent.createElement("div",{id:"FourRedToBlack",className:"e-4redtoblack e-is-wrapper"});H.appendChild(Y),H.appendChild(X),H.appendChild(K),H.appendChild($),H.appendChild(J);var Z=this.parent.createElement("div",{id:"ThreeSymbols",className:"e-3symbols e-is-wrapper"}),Q=this.parent.createElement("div",{id:"ThreeSymbols2",className:"e-3symbols2 e-is-wrapper"}),ee=this.parent.createElement("div",{id:"ThreeFlags",className:"e-3flags e-is-wrapper"});M.appendChild(Z),M.appendChild(Q),M.appendChild(ee);var te=this.parent.createElement("div",{id:"ThreeStars",className:"e-3stars e-is-wrapper"}),re=this.parent.createElement("div",{id:"FourRating",className:"e-4rating e-is-wrapper"}),ne=this.parent.createElement("div",{id:"FiveQuarters",className:"e-5quarters e-is-wrapper"}),ie=this.parent.createElement("div",{id:"FiveRating",className:"e-5rating e-is-wrapper"}),oe=this.parent.createElement("div",{id:"FiveBoxes",className:"e-5boxes e-is-wrapper"});P.appendChild(te),P.appendChild(re),P.appendChild(ne),P.appendChild(ie),P.appendChild(oe),V.appendChild(this.createElement("span","e-3arrows-1 e-iconsetspan")),V.appendChild(this.createElement("span","e-3arrows-2 e-iconsetspan")),V.appendChild(this.createElement("span","e-3arrows-3 e-iconsetspan")),U.appendChild(this.createElement("span","e-3arrowsgray-1 e-iconsetspan")),U.appendChild(this.createElement("span","e-3arrowsgray-2 e-iconsetspan")),U.appendChild(this.createElement("span","e-3arrowsgray-3 e-iconsetspan")),j.appendChild(this.createElement("span","e-3triangles-1 e-iconsetspan")),j.appendChild(this.createElement("span","e-3triangles-2 e-iconsetspan")),j.appendChild(this.createElement("span","e-3triangles-3 e-iconsetspan")),q.appendChild(this.createElement("span","e-4arrowsgray-1 e-iconsetspan")),q.appendChild(this.createElement("span","e-4arrowsgray-2 e-iconsetspan")),q.appendChild(this.createElement("span","e-4arrowsgray-3 e-iconsetspan")),q.appendChild(this.createElement("span","e-4arrowsgray-4 e-iconsetspan")),z.appendChild(this.createElement("span","e-4arrows-1 e-iconsetspan")),z.appendChild(this.createElement("span","e-4arrows-2 e-iconsetspan")),z.appendChild(this.createElement("span","e-4arrows-3 e-iconsetspan")),z.appendChild(this.createElement("span","e-4arrows-4 e-iconsetspan")),W.appendChild(this.createElement("span","e-5arrowsgray-1 e-iconsetspan")),W.appendChild(this.createElement("span","e-5arrowsgray-2 e-iconsetspan")),W.appendChild(this.createElement("span","e-5arrowsgray-3 e-iconsetspan")),W.appendChild(this.createElement("span","e-5arrowsgray-4 e-iconsetspan")),W.appendChild(this.createElement("span","e-5arrowsgray-5 e-iconsetspan")),G.appendChild(this.createElement("span","e-5arrows-1 e-iconsetspan")),G.appendChild(this.createElement("span","e-5arrows-2 e-iconsetspan")),G.appendChild(this.createElement("span","e-5arrows-3 e-iconsetspan")),G.appendChild(this.createElement("span","e-5arrows-4 e-iconsetspan")),G.appendChild(this.createElement("span","e-5arrows-5 e-iconsetspan")),Y.appendChild(this.createElement("span","e-3trafficlights-1 e-iconsetspan")),Y.appendChild(this.createElement("span","e-3trafficlights-2 e-iconsetspan")),Y.appendChild(this.createElement("span","e-3trafficlights-3 e-iconsetspan")),X.appendChild(this.createElement("span","e-3rafficlights2-1 e-iconsetspan")),X.appendChild(this.createElement("span","e-3rafficlights2-2 e-iconsetspan")),X.appendChild(this.createElement("span","e-3rafficlights2-3 e-iconsetspan")),K.appendChild(this.createElement("span","e-3signs-1 e-iconsetspan")),K.appendChild(this.createElement("span","e-3signs-2 e-iconsetspan")),K.appendChild(this.createElement("span","e-3signs-3 e-iconsetspan")),$.appendChild(this.createElement("span","e-4trafficlights-1 e-iconsetspan")),$.appendChild(this.createElement("span","e-4trafficlights-2 e-iconsetspan")),$.appendChild(this.createElement("span","e-4trafficlights-3 e-iconsetspan")),$.appendChild(this.createElement("span","e-4trafficlights-4 e-iconsetspan")),J.appendChild(this.createElement("span","e-4redtoblack-1 e-iconsetspan")),J.appendChild(this.createElement("span","e-4redtoblack-2 e-iconsetspan")),J.appendChild(this.createElement("span","e-4redtoblack-3 e-iconsetspan")),J.appendChild(this.createElement("span","e-4redtoblack-4 e-iconsetspan")),Z.appendChild(this.createElement("span","e-3symbols-1 e-iconsetspan")),Z.appendChild(this.createElement("span","e-3symbols-2 e-iconsetspan")),Z.appendChild(this.createElement("span","e-3symbols-3 e-iconsetspan")),Q.appendChild(this.createElement("span","e-3symbols2-1 e-iconsetspan")),Q.appendChild(this.createElement("span","e-3symbols2-2 e-iconsetspan")),Q.appendChild(this.createElement("span","e-3symbols2-3 e-iconsetspan")),ee.appendChild(this.createElement("span","e-3flags-1 e-iconsetspan")),ee.appendChild(this.createElement("span","e-3flags-2 e-iconsetspan")),ee.appendChild(this.createElement("span","e-3flags-3 e-iconsetspan")),te.appendChild(this.createElement("span","e-3stars-1 e-iconsetspan")),te.appendChild(this.createElement("span","e-3stars-2 e-iconsetspan")),te.appendChild(this.createElement("span","e-3stars-3 e-iconsetspan")),re.appendChild(this.createElement("span","e-4rating-1 e-iconsetspan")),re.appendChild(this.createElement("span","e-4rating-2 e-iconsetspan")),re.appendChild(this.createElement("span","e-4rating-3 e-iconsetspan")),re.appendChild(this.createElement("span","e-4rating-4 e-iconsetspan")),ne.appendChild(this.createElement("span","e-5quarters-1 e-iconsetspan")),ne.appendChild(this.createElement("span","e-5quarters-2 e-iconsetspan")),ne.appendChild(this.createElement("span","e-5quarters-3 e-iconsetspan")),ne.appendChild(this.createElement("span","e-5quarters-4 e-iconsetspan")),ne.appendChild(this.createElement("span","e-5quarters-5 e-iconsetspan")),ie.appendChild(this.createElement("span","e-5rating-1 e-iconsetspan")),ie.appendChild(this.createElement("span","e-5rating-2 e-iconsetspan")),ie.appendChild(this.createElement("span","e-5rating-3 e-iconsetspan")),ie.appendChild(this.createElement("span","e-5rating-4 e-iconsetspan")),ie.appendChild(this.createElement("span","e-5rating-5 e-iconsetspan")),oe.appendChild(this.createElement("span","e-5boxes-1 e-iconsetspan")),oe.appendChild(this.createElement("span","e-5boxes-2 e-iconsetspan")),oe.appendChild(this.createElement("span","e-5boxes-3 e-iconsetspan")),oe.appendChild(this.createElement("span","e-5boxes-4 e-iconsetspan")),oe.appendChild(this.createElement("span","e-5boxes-5 e-iconsetspan"));var se=this.parent.element.appendChild(this.parent.createElement("ul",{id:e+"_cf_menu",styles:"display: none;"}));return this.cFMenu.appendTo(se),se.classList.add("e-ul"),this.cFDdb=new l.DropDownButton({iconCss:"e-icons e-conditionalformatting-icon",cssClass:"e-cf-ddb",target:this.cFMenu.element.parentElement,created:function(){r.cFMenu.element.style.display=""},beforeClose:function(e){e.event&&t.closest(e.event.target,".e-cf-ddb")&&(e.cancel=!0)},close:function(){return r.parent.element.focus()}}),this.cFDdb.createElement=this.parent.createElement,this.cFDdb.appendTo(this.parent.createElement("button",{id:e+"_conditionalformatting"})),this.cFDdb.element},e.prototype.createElement=function(e,t,r){return this.parent.createElement(e,{className:t})},e.prototype.getBordersDBB=function(e){var r,o=this,s=this.parent.serviceLocator.getService(Us);this.bordersMenu=new n.Menu({cssClass:"e-borders-menu",items:[{iconCss:"e-icons e-top-borders",text:s.getConstant("TopBorders")},{iconCss:"e-icons e-left-borders",text:s.getConstant("LeftBorders")},{iconCss:"e-icons e-right-borders",text:s.getConstant("RightBorders")},{iconCss:"e-icons e-bottom-borders",text:s.getConstant("BottomBorders")},{iconCss:"e-icons e-all-borders",text:s.getConstant("AllBorders")},{iconCss:"e-icons e-horizontal-borders",text:s.getConstant("HorizontalBorders")},{iconCss:"e-icons e-vertical-borders",text:s.getConstant("VerticalBorders")},{iconCss:"e-icons e-outside-borders",text:s.getConstant("OutsideBorders")},{iconCss:"e-icons e-inside-borders",text:s.getConstant("InsideBorders")},{iconCss:"e-icons e-no-borders",text:s.getConstant("NoBorders")},{separator:!0},{text:s.getConstant("BorderColor"),items:[{id:e+"_border_colors"}]},{text:s.getConstant("BorderStyle"),items:[{iconCss:"e-icons e-selected-icon",id:e+"_1px"},{id:e+"_2px"},{id:e+"_3px"},{id:e+"_dashed"},{id:e+"_dotted"},{id:e+"_double"}]}],orientation:"Vertical",beforeOpen:function(e){"Border Color"===e.parentItem.text?(o.colorPicker.refresh(),r=o.colorPicker.element.parentElement,e.element.firstElementChild.appendChild(r),r.style.display="inline-block",e.element.parentElement.classList.add("e-border-color")):e.element.classList.add("e-border-style")},beforeClose:function(e){"Border Color"===e.parentItem.text&&(!t.closest(e.event.target,".e-border-colorpicker")||t.closest(e.event.target,".e-apply")||t.closest(e.event.target,".e-cancel")?(o.colorPicker=t.getComponent(h,"colorpicker"),"Picker"===o.colorPicker.mode&&(o.colorPicker.mode="Palette",o.colorPicker.dataBind()),r.style.display="",o.parent.element.appendChild(r)):e.cancel=!0)},onOpen:function(e){"Border Color"===e.parentItem.text&&(e.element.parentElement.style.overflow="visible")},select:this.borderSelected.bind(this)}),this.bordersMenu.createElement=this.parent.createElement;var a=this.parent.element.appendChild(this.parent.createElement("ul",{id:e+"_borders_menu",styles:"display: none;"}));this.bordersMenu.appendTo(a),a.classList.add("e-ul");var h=this.parent.createElement("input",{id:e+"_cell_border_color",attrs:{type:"color"}});return this.parent.element.appendChild(h),this.colorPicker=new i.ColorPicker({cssClass:"e-border-colorpicker",mode:"Palette",inline:!0,change:function(e){var t=o.border.split(" ");t[2]=e.currentValue.hex,o.border=t.join(" ")},created:function(){r=o.colorPicker.element.parentElement}}),this.colorPicker.createElement=this.parent.createElement,this.colorPicker.appendTo(h),this.bordersDdb=new l.DropDownButton({iconCss:"e-icons e-bottom-borders",cssClass:"e-borders-ddb",target:this.bordersMenu.element.parentElement,created:function(){o.bordersMenu.element.style.display=""},beforeOpen:function(e){return o.tBarDdbBeforeOpen(e.element.firstElementChild,o.bordersMenu.items,1)},beforeClose:function(e){e.event&&t.closest(e.event.target,".e-borders-menu")&&(e.cancel=!0)},close:function(){return o.parent.element.focus()}}),this.bordersDdb.createElement=this.parent.createElement,this.bordersDdb.appendTo(this.parent.createElement("button",{id:e+"_borders"})),this.bordersDdb.element},e.prototype.cFSelected=function(e){var t=e.element.id;if("cf_greaterthancf_lessthancf_betweencf_eqaultocf_textthatcontainscf_adateoccuringcf_duplicatevaluescf_top10itemscf_top10cf_bottom10itemscf_bottom10cf_aboveaveragecf_belowaverage".includes(t))this.parent.notify(vi,{action:e.item.text});else if("cf_databarscf_colorscales".includes(t)){var r=e.event.target.id;this.parent.notify(Ci,{action:t,id:r})}else if("cf_iconsets"===e.element.id){var n=e.event.target,i=""===n.id?n.parentElement.id:n.id;this.parent.notify(Ci,{action:t,id:i})}if("cf_cr_cells"===t)this.parent.notify(cr,{range:this.parent.getActiveSheet().selectedRange,isPublic:!1});else if("cf_cr_sheet"===t){var o=this.parent.getActiveSheet(),s=g([0,0,o.rowCount-1,o.colCount-1]);this.parent.conditionalFormat=null,this.parent.notify(cr,{range:s,isPublic:!1})}},e.prototype.borderSelected=function(e){if(!e.item.items.length&&e.item.id!==this.parent.element.id+"_border_colors"){if(!e.item.text){var t=this.parent.element.id,r=this.border.split(" "),n="solid"===r[1]?t+"_"+r[0]:t+"_"+r[1];if(n===e.item.id)return;return e.item.id===t+"_1px"||e.item.id===t+"_2px"||e.item.id===t+"_3px"?(r[0]=e.item.id.split(t+"_")[1],r[1]="solid"):(r[1]=e.item.id.split(t+"_")[1],r[0]="double"===r[1]?"3px":"1px"),this.border=r.join(" "),this.bordersMenu.items[12].items.forEach(function(t){t.id===n&&(t.iconCss=null),t.id===e.item.id&&(t.iconCss="e-icons e-selected-icon")}),void this.bordersMenu.setProperties({items:this.bordersMenu.items},!0)}switch(this.bordersDdb.toggle(),this.parent.showSpinner(),e.item.text){case"Top Borders":this.parent.notify(ot,{style:{borderTop:this.border},onActionUpdate:!0});break;case"Left Borders":this.parent.notify(ot,{style:{borderLeft:this.border},onActionUpdate:!0});break;case"Right Borders":this.parent.notify(ot,{style:{borderRight:this.border},onActionUpdate:!0});break;case"Bottom Borders":this.parent.notify(ot,{style:{borderBottom:this.border},onActionUpdate:!0});break;case"All Borders":this.parent.notify(ot,{style:{border:this.border},onActionUpdate:!0});break;case"Horizontal Borders":this.parent.notify(ot,{style:{border:this.border},onActionUpdate:!0,borderType:"Horizontal"});break;case"Vertical Borders":this.parent.notify(ot,{style:{border:this.border},onActionUpdate:!0,borderType:"Vertical"});break;case"Outside Borders":this.parent.notify(ot,{style:{border:this.border},onActionUpdate:!0,borderType:"Outer"});break;case"Inside Borders":this.parent.notify(ot,{style:{border:this.border},onActionUpdate:!0,borderType:"Inner"});break;case"No Borders":this.parent.notify(ot,{style:{border:""},onActionUpdate:!0})}this.parent.hideSpinner()}},e.prototype.getFontNameDDB=function(e){var t=this,r=this.parent.createElement("button",{id:e+"_font_name"});return r.appendChild(this.parent.createElement("span",{className:"e-tbar-btn-text",innerHTML:"Calibri"})),this.fontNameDdb=new l.DropDownButton({cssClass:"e-font-family",items:this.getFontFamilyItems(),select:function(e){var r={style:{fontFamily:e.item.text},onActionUpdate:!0};t.parent.notify(ot,r),r.cancel||t.refreshFontNameSelection(r.style.fontFamily)},close:function(){return t.parent.element.focus()},beforeOpen:function(e){return t.tBarDdbBeforeOpen(e.element,e.items)}}),this.fontNameDdb.createElement=this.parent.createElement,this.fontNameDdb.appendTo(r),r},e.prototype.getBtn=function(e,t,r){void 0===r&&(r=!0);var n=new o.Button({iconCss:"e-icons e-"+t+"-icon",isToggle:!0});return n.createElement=this.parent.createElement,n.appendTo(this.parent.createElement("button",{id:e+"_"+t})),r&&n.element.addEventListener("click",this.toggleBtnClicked.bind(this)),n.element},e.prototype.datavalidationDDB=function(e){var t=this,r=this.parent.serviceLocator.getService(Us);return this.datavalidationDdb=new l.DropDownButton({cssClass:"e-datavalidation-ddb",iconCss:"e-datavalidation-icon e-icons",items:[{text:r.getConstant("DataValidation")},{text:r.getConstant("HighlightInvalidData")},{text:r.getConstant("ClearHighlight")},{text:r.getConstant("ClearValidation")}],beforeOpen:function(e){t.refreshSelected(t.datavalidationDdb,e.element,"iconCss")},select:function(e){switch(e.item.text){case r.getConstant("DataValidation"):t.parent.notify(Zn,null);break;case r.getConstant("HighlightInvalidData"):t.parent.notify(Qn,{isRemoveHighlight:!1});break;case r.getConstant("ClearHighlight"):t.parent.notify(Qn,{isRemoveHighlight:!0});break;case r.getConstant("ClearValidation"):t.parent.notify(gi,null);break;default:var n=e.item.text===r.getConstant("SortAscending")?"Ascending":"Descending";t.parent.notify(xn,{sortOptions:{sortDescriptors:{order:n}}})}},close:function(){return t.parent.element.focus()}}),this.datavalidationDdb.createElement=this.parent.createElement,this.datavalidationDdb.appendTo(this.parent.createElement("button",{id:e+"_datavalidation"})),this.datavalidationDdb.element},e.prototype.getTextAlignDDB=function(e){var t=this;return this.textAlignDdb=new l.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),beforeOpen:function(e){t.refreshSelected(t.textAlignDdb,e.element,"iconCss")},select:function(e){var r={style:{textAlign:e.item.iconCss.split(" e-")[1].split("-icon")[0]},onActionUpdate:!0};t.parent.notify(ot,r),r.cancel||(t.textAlignDdb.iconCss="e-icons e-"+r.style.textAlign+"-icon",t.textAlignDdb.dataBind())},close:function(){return t.parent.element.focus()}}),this.textAlignDdb.createElement=this.parent.createElement,this.textAlignDdb.appendTo(this.parent.createElement("button",{id:e+"_text_align"})),this.textAlignDdb.element},e.prototype.getVerticalAlignDDB=function(e){var t=this;return this.verticalAlignDdb=new l.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),beforeOpen:function(e){t.refreshSelected(t.verticalAlignDdb,e.element,"iconCss")},select:function(e){var r={style:{verticalAlign:e.item.iconCss.split(" e-")[1].split("-icon")[0]},onActionUpdate:!0};t.parent.notify(ot,r),r.cancel||(t.verticalAlignDdb.iconCss="e-icons e-"+r.style.verticalAlign+"-icon",t.verticalAlignDdb.dataBind())},close:function(){return t.parent.element.focus()}}),this.verticalAlignDdb.createElement=this.parent.createElement,this.verticalAlignDdb.appendTo(this.parent.createElement("button",{id:e+"_vertical_align"})),this.verticalAlignDdb.element},e.prototype.getMergeSplitBtn=function(e){var t=this;this.parent.element.appendChild(this.parent.createElement("button",{id:e+"_merge"}));var r=this.parent.serviceLocator.getService(Us);return this.mergeSplitBtn=new l.SplitButton({cssClass:"e-merge-ddb",iconCss:"e-icons e-merge-icon",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),close:function(){return t.parent.element.focus()},click:function(e){e.element.classList.contains("e-active")?(t.toggleActiveState(!1),t.unMerge()):(t.toggleActiveState(!0),t.merge(t.parent.element.id+"_merge_all"))},created:function(){t.mergeSplitBtn.element.title=r.getConstant("MergeCells"),t.mergeSplitBtn.element.nextElementSibling.title=r.getConstant("SelectMergeType")}}),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)},e.prototype.unMerge=function(){this.parent.showSpinner(),this.parent.notify(ir,{merge:!1,range:this.parent.getActiveSheet().selectedRange,isAction:!0,refreshRibbon:!0,type:"All"}),this.parent.hideSpinner()},e.prototype.merge=function(e){for(var t,r,n=this,i=this.parent.getActiveSheet(),o=d(i.selectedRange),s=o[0];s<=o[2];s++)for(var a=o[1];a<=o[3];a++)s===o[0]&&a===o[1]&&e.includes("merge_all")||s===o[0]&&e.includes("merge_vertically")||a===o[1]&&e.includes("_merge_horizontally")||((t=j(s,a,i)||{}).value||t.formula)&&(r=!0);if(r){var l=this.parent.serviceLocator.getService(js);l.show({target:this.parent.element,height:200,width:400,isModal:!0,showCloseIcon:!0,content:this.parent.serviceLocator.getService(Us).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),n.parent.element.focus()},buttons:[{buttonModel:{content:this.parent.serviceLocator.getService(Us).getConstant("Ok"),isPrimary:!0},click:function(){l.hide(),n.performMerge(e)}}]})}else this.performMerge(e)},e.prototype.performMerge=function(e){var t=this.parent.element.id;switch(this.parent.showSpinner(),e){case t+"_merge_all":this.parent.notify(ir,{merge:!0,range:this.parent.getActiveSheet().selectedRange,type:"All",isAction:!0,refreshRibbon:!0});break;case t+"_merge_horizontally":this.parent.notify(ir,{merge:!0,range:this.parent.getActiveSheet().selectedRange,type:"Horizontally",isAction:!0});break;case t+"_merge_vertically":this.parent.notify(ir,{merge:!0,range:this.parent.getActiveSheet().selectedRange,type:"Vertically",isAction:!0})}this.parent.hideSpinner()},e.prototype.getSortFilterDDB=function(e){var t=this,r=this.parent.serviceLocator.getService(Us);return this.sortingDdb=new l.DropDownButton({cssClass:"e-sort-filter-ddb",iconCss:"e-icons e-sort-filter-icon",items:[{text:r.getConstant("SortAscending"),iconCss:"e-icons e-sort-asc"},{text:r.getConstant("SortDescending"),iconCss:"e-icons e-sort-desc"},{text:r.getConstant("CustomSort")+"...",iconCss:"e-icons e-sort-custom"},{separator:!0},{text:r.getConstant("Filter"),iconCss:"e-icons e-filter-apply",id:e+"_applyfilter"},{text:r.getConstant("ClearAllFilter"),iconCss:"e-icons e-filter-clear",id:e+"_clearfilter"},{text:r.getConstant("ReapplyFilter"),iconCss:"e-icons e-filter-reapply",id:e+"_reapplyfilter"}],beforeItemRender:function(r){var n={isFiltered:!1,isClearAll:!0};t.parent.notify(zn,n),r.item.id!==e+"_clearfilter"&&r.item.id!==e+"_reapplyfilter"||(n.isFiltered?r.element.classList.remove("e-disabled"):r.element.classList.add("e-disabled"))},beforeOpen:function(e){t.refreshSelected(t.sortingDdb,e.element,"iconCss")},select:function(e){switch(e.item.text){case r.getConstant("Filter"):t.parent.applyFilter();break;case r.getConstant("ClearAllFilter"):t.parent.clearFilter();break;case r.getConstant("ReapplyFilter"):t.parent.notify(Un,null);break;case r.getConstant("CustomSort")+"...":t.parent.notify(Sn,null);break;default:var n=e.item.text===r.getConstant("SortAscending")?"Ascending":"Descending";t.parent.notify(xn,{sortOptions:{sortDescriptors:{order:n}}})}},close:function(){return t.parent.element.focus()}}),this.sortingDdb.createElement=this.parent.createElement,this.sortingDdb.appendTo(this.parent.createElement("button",{id:e+"_sorting"})),this.sortingDdb.element},e.prototype.getFindDDb=function(e){var t=this,r=this.parent.createElement("button",{id:e+"_findbtn"});return this.findDdb=new o.Button({cssClass:"e-spreadsheet-find-ddb e-caret-hide",iconCss:"e-icons e-search-icon"}),this.findDdb.createElement=this.parent.createElement,this.findDdb.appendTo(r),r.onclick=function(){t.findToolDlg()},this.findDdb.element},e.prototype.findToolDlg=function(){var e,r=this;if(t.isNullOrUndefined(this.parent.element.querySelector(".e-findtool-dlg"))){var i,o=this.parent.createElement("div",{className:"e-input-group"}),s=this.parent.createElement("input",{className:"e-input e-text-findNext-short",attrs:{type:"Text",value:this.findValue}});s.setAttribute("placeholder","FindValue");var a=this.parent.createElement("span",{className:"e-input-group-icon"});s.onkeyup=function(){e={countOpt:"count",findCount:""},r.parent.notify(oi,{countArgs:e}),a.textContent=e.findCount;var n=document.querySelector(".e-text-findNext-short").value,o=document.querySelector(".e-findRib-next"),s=document.querySelector(".e-findRib-prev");t.isNullOrUndefined(n)||""===n||"1 of 0"===e.findCount?(i.enableItems(o,!1),i.enableItems(s,!1),a.textContent="0 of 0"):t.isNullOrUndefined(n)&&"1 of 0"===e.findCount||(i.enableItems(o,!0),i.enableItems(s,!0))},s.onkeydown=function(t){e={countOpt:"count",findCount:""},r.parent.notify(oi,{countArgs:e});var n=e.findCount;r.findOnKeyDown(t,n)},o.appendChild(s),o.appendChild(a);var l=[{type:"Input",template:o},{prefixIcon:"e-icons e-prev-icon",tooltipText:"Find Previous",type:"Button",cssClass:"e-findRib-prev",disabled:!0},{prefixIcon:"e-icons e-next-icon",tooltipText:"Find Next",type:"Button",cssClass:"e-findRib-next",disabled:!0},{type:"Separator"},{prefixIcon:"e-icons e-option-icon",tooltipText:"More Options",type:"Button",cssClass:"e-findRib-more"},{prefixIcon:"e-icons e-close",tooltipText:"Close",type:"Button",cssClass:"e-findRib-close"}];i=new n.Toolbar({clicked:function(e){if("e-findRib-next"===e.item.cssClass){var t={findOption:"next"};r.parent.notify(oi,t)}else if("e-findRib-prev"===e.item.cssClass){t={findOption:"prev"};r.parent.notify(oi,t)}else"e-findRib-more"===e.item.cssClass&&(r.parent.notify(ii,null),r.findDialog.hide())},width:"auto",height:"auto",items:l,cssClass:"e-find-toolObj"});var p=this.parent.createElement("div",{className:"e-find-toolbar"}),d=this.parent.createElement("div",{className:"e-dlg-div"});this.findDialog=new h.Dialog({isModal:!1,showCloseIcon:!1,cssClass:"e-findtool-dlg",content:p,visible:!1,allowDragging:!0,target:this.parent.element.querySelector(".e-main-panel"),beforeOpen:function(){t.EventHandler.add(document,"click",r.closeDialog,r)},open:function(){r.textFocus(i.element)},beforeClose:function(){r.findValue=r.parent.element.querySelector(".e-text-findNext-short").value,i.destroy();var e=document.querySelector(".e-find-toolbar");t.EventHandler.remove(e,"focus",r.textFocus),t.EventHandler.remove(document,"click",r.closeDialog),r.parent.element.focus()},created:function(){i.createElement=r.parent.createElement,i.appendTo(p),r.findDialog.width=getComputedStyle(document.querySelector(".e-findtool-dlg")).width;var e=r.parent.element.querySelector(".e-main-panel").getBoundingClientRect(),t=r.findDialog.width,n=e.width-parseInt(t.toString(),10)-14,o=r.parent.sheets[r.parent.activeSheetIndex].showHeaders?31:0;r.findDialog.position={X:n,Y:o},r.findDialog.dataBind(),r.findDialog.show()}}),this.findDialog.createElement=this.parent.createElement,this.findDialog.appendTo(d)}else t.isNullOrUndefined(this.parent.element.querySelector(".e-findtool-dlg"))||(this.findDialog.hide(),t.detach(this.parent.element.querySelector(".e-findtool-dlg")),this.findDialog=null,this.parent.element.focus())},e.prototype.findOnKeyDown=function(e,t){if(document.querySelector(".e-text-findNext-short").value&&"1 of 0"!==t)if(e.shiftKey){if(13===e.keyCode){this.parent.notify(oi,{findOption:"prev"})}}else if(13===e.keyCode){this.parent.notify(oi,{findOption:"next"})}},e.prototype.closeDialog=function(e){!t.closest(e.target,".e-findRib-close")&&t.closest(e.target,".e-spreadsheet")||t.isNullOrUndefined(this.findDialog)||(this.findDialog.hide(),t.detach(this.parent.element.querySelector(".e-findtool-dlg")),this.findDialog=null)},e.prototype.textFocus=function(e){document.querySelector(".e-find-toolbar").addEventListener("focus",function(){var e=document.querySelector(".e-text-findNext-short");e.focus(),e.classList.add("e-input-focus"),e.setSelectionRange(0,e.value.length)})},e.prototype.getClearDDB=function(e){var t=this,r=this.parent.serviceLocator.getService(Us);return this.clearDdb=new l.DropDownButton({cssClass:"e-clear-ddb",iconCss:"e-icons e-clear-icon",items:[{text:r.getConstant("ClearAll")},{text:r.getConstant("ClearFormats")},{text:r.getConstant("ClearContents")},{text:r.getConstant("ClearHyperlinks")}],select:function(e){t.parent.notify(bi,{options:{type:e.item.text}})},close:function(){return t.parent.element.focus()}}),this.clearDdb.createElement=this.parent.createElement,this.clearDdb.appendTo(this.parent.createElement("button",{id:e+"_clear"})),this.clearDdb.element},e.prototype.ribbonCreated=function(){this.ribbon.element.querySelector(".e-drop-icon").title=this.parent.serviceLocator.getService(Us).getConstant("CollapseToolbar")},e.prototype.alignItemRender=function(e){var t=e.item.iconCss.split(" e-")[1].split("-icon")[0];t=t[0].toUpperCase()+t.slice(1,t.length),e.element.title=this.parent.serviceLocator.getService(Us).getConstant("Align"+t)},e.prototype.toggleBtnClicked=function(e){var r,n,i,o,s,a=t.closest(e.target,".e-btn"),l=this.parent.element.id,h=a.id,p=ot;switch(h){case l+"_bold":n={fontWeight:"normal"},i={fontWeight:"bold"},s="fontWeight";break;case l+"_italic":n={fontStyle:"normal"},i={fontStyle:"italic"},s="fontStyle";break;case l+"_line-through":p=at,i=n={textDecoration:"line-through"},s="textDecoration";break;case l+"_underline":p=at,i=n={textDecoration:"underline"},s="textDecoration"}a.classList.contains("e-active")?(r=i[s],o={style:i,onActionUpdate:!0},this.parent.notify(p,o),o.cancel&&a.classList.remove("e-active")):(r=n[s],o={style:n,onActionUpdate:!0},this.parent.notify(p,o),o.cancel&&a.classList.add("e-active")),o.cancel||r===o.style[s]||this.refreshToggleBtn(c(this.parent.getActiveSheet().activeCell)),this.parent.element.focus()},e.prototype.getCellStyleValue=function(e,t){var r=j(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(Us);e.expanded?t.title=r.getConstant("CollapseToolbar"):t.title=r.getConstant("ExpandToolbar"),this.parent.setPanelSize()},e.prototype.getNumFormatDdbItems=function(e){var t=this.parent.serviceLocator.getService(Us);return[{id:e+"item1",text:t.getConstant("General")},{id:e+"item2",text:t.getConstant("Number")},{id:e+"item3",text:t.getConstant("Currency")},{id:e+"item4",text:t.getConstant("Accounting")},{id:e+"item5",text:t.getConstant("ShortDate")},{id:e+"item6",text:t.getConstant("LongDate")},{id:e+"item7",text:t.getConstant("Time")},{id:e+"item8",text:t.getConstant("Percentage")},{id:e+"item9",text:t.getConstant("Fraction")},{id:e+"item10",text:t.getConstant("Scientific")},{id:e+"item11",text:t.getConstant("Text")}]},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:"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.numDDBSelect=function(e){var t={format:O(e.item.text),range:this.parent.getActiveSheet().selectedRange,cancel:!1,requestType:"NumberFormat"},r={range:this.parent.getActiveSheet().name+"!"+t.range,format:t.format,requestType:"NumberFormat"};this.parent.trigger("beforeCellFormat",t),this.parent.notify(Gn,{eventArgs:t,action:"format"}),t.cancel||(this.parent.notify(rt,t),this.parent.notify(qr,{type:"mousedown"}),this.refreshNumFormatSelection(e.item.text),this.parent.notify(Wn,{eventArgs:r,action:"format"}))},e.prototype.tBarDdbBeforeOpen=function(e,t,r){void 0===r&&(r=0);var n=this.parent.viewport.height,i=parseInt(getComputedStyle(e.firstElementChild).height,10)*(t.length-r)+2*parseInt(getComputedStyle(e).paddingTop,10);if(r){var o=getComputedStyle(e.querySelector(".e-separator"));i+=r*(parseInt(o.borderBottomWidth,10)+2*parseInt(o.marginTop,10))}i>n?(e.style.height=n+"px",e.style.overflowY="auto"):e.style.height&&(e.style.height="",e.style.overflowY="")},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){var t=c(this.parent.getActiveSheet().activeCell),r=j(t[0],t[1],this.parent.getActiveSheet()),n={type:e.item.text,formattedText:"",value:r&&r.value?r.value:"",format:O(e.item.text),sheetIndex:this.parent.activeSheetIndex,onLoad:!0},i=this.parent.createElement("div",{className:"e-numformat-text",styles:"width:100%",innerHTML:e.element.innerHTML});e.element.innerHTML="",this.parent.notify(nt,n);var o=this.parent.createElement("span",{className:"e-numformat-preview-text",styles:"float:right;",innerHTML:n.formattedText.toString()});i.appendChild(o),e.element.appendChild(i)},e.prototype.refreshRibbonContent=function(e){if(this.ribbon){t.isNullOrUndefined(e)&&(e=this.ribbon.selectedTab);var r=this.parent.serviceLocator.getService(Us),n=this.parent.getActiveSheet();switch(this.ribbon.items[e].header.text){case r.getConstant("Home"):this.refreshHomeTabContent(c(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"),l.DropDownButton));var r=this.parent.getActiveSheet(),n=c(this.parent.getActiveSheet().activeCell),i=this.parent.serviceLocator.getService(Us),o=j(n[0],n[1],this.parent.getActiveSheet())||{},s=D(o.format?o.format:"General");if(this.numFormatDDB&&(r.isProtected&&!r.protectSettings.formatCells?(s="General",this.refreshNumFormatSelection(s)):this.refreshNumFormatSelection(i.getConstant(s))),this.fontNameDdb&&(r.isProtected&&!r.protectSettings.formatCells?this.refreshFontNameSelection("Calibri"):this.refreshFontNameSelection(this.getCellStyleValue("fontFamily",e))),this.fontSizeDdb){var a=this.getCellStyleValue("fontSize",e);r.isProtected&&!r.protectSettings.formatCells?this.fontSizeDdb.content="11":(a=a.includes("pt")?a.split("pt")[0]:"11")!==this.fontSizeDdb.content&&(this.fontSizeDdb.content=a,this.fontSizeDdb.dataBind())}if(this.textAlignDdb){var h=this.getCellStyleValue("textAlign",e);if(r.isProtected&&!r.protectSettings.formatCells)this.textAlignDdb.iconCss="e-icons e-left-icon";else{void 0===o.value||"left"!==h||"Accounting"!==s&&!F(o.value)||(h="right");(a="e-icons e-"+h.toLowerCase()+"-icon")!==this.textAlignDdb.iconCss&&(this.textAlignDdb.iconCss=a,this.textAlignDdb.dataBind())}}if(this.verticalAlignDdb){a="e-icons e-"+this.getCellStyleValue("verticalAlign",e).toLowerCase()+"-icon";r.isProtected&&!r.protectSettings.formatCells?this.verticalAlignDdb.iconCss="e-icons e-bottom-icon":a!==this.verticalAlignDdb.iconCss&&(this.verticalAlignDdb.iconCss=a,this.verticalAlignDdb.dataBind())}if(this.refreshToggleBtn(e),!r.isProtected&&(o.rowSpan>1||o.colSpan>1))this.enableToolbarItems([{tab:i.getConstant("Home"),items:[this.parent.element.id+"_merge_cells"],enable:!0}]),this.toggleActiveState(!0);else{var p=d(r.selectedRange);this.enableToolbarItems([{tab:i.getConstant("Home"),items:[this.parent.element.id+"_merge_cells"],enable:p[0]!==p[2]||p[1]!==p[3]}]),this.toggleActiveState(!1)}},e.prototype.toggleActiveState=function(e){var t=this.parent.serviceLocator.getService(Us);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,o=this.parent.getActiveSheet(),s=this.parent.element.id,a=j(e[0],e[1],o),l=["fontWeight","fontStyle","textDecoration","textDecoration"];["bold","italic","line-through","underline","wrap"].forEach(function(h,p){(t=document.getElementById(s+"_"+h))&&(o.isProtected&&!o.protectSettings.formatCells?t.classList.remove("e-active"):"wrap"===h?n=a&&a.wrap:(r=i.getCellStyleValue(l[p],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){if(e!==this.fontNameDdb.items[this.fontNameIndex].text){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",this.fontNameDdb.items[this.fontNameIndex].iconCss="",this.fontNameDdb.setProperties({items:this.fontNameDdb.items},!0),this.fontNameIndex=t;break}}},e.prototype.refreshNumFormatSelection=function(e){this.parent.serviceLocator.getService(Us);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)},e.prototype.fileMenuItemSelect=function(e){var r=this,n=t.extend({cancel:!1},e);this.parent.trigger("fileMenuItemSelect",n);var i=this.parent.element.id;if(!n.cancel)switch(e.item.id){case i+"_Open":this.parent.element.querySelector("#"+i+"_fileUpload").click();break;case i+"_Xlsx":case i+"_Xls":case i+"_Csv":this.parent.save({saveType:e.item.id.split(i+"_")[1]});break;case i+"_New":var o=this.parent.serviceLocator.getService(js);o.show({height:200,width:400,isModal:!0,showCloseIcon:!0,content:this.parent.serviceLocator.getService(Us).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),r.parent.element.focus()},buttons:[{buttonModel:{content:this.parent.serviceLocator.getService(Us).getConstant("Ok"),isPrimary:!0},click:function(){r.parent.sheets.length=0,r.parent.createSheet(),o.hide(),r.parent.activeSheetIndex=r.parent.sheets.length-1,r.parent.notify(Ir,{}),r.parent.notify(yt,{}),r.parent.renderModule.refreshSheet()}}]})}},e.prototype.toolbarClicked=function(e){if("spreadsheet_find"!==e.item.id){var t=this.parent.element.id,r=this.parent.getActiveSheet();switch(e.item.id){case t+"_headers":var n={isShow:!r.showHeaders,sheetIdx:this.parent.activeSheetIndex,cancel:!1};if(this.parent.notify(Wn,{eventArgs:n,action:"headers"}),n.cancel)return;r.showHeaders=!r.showHeaders,this.parent.serviceLocator.getService("sheet").showHideHeaders(),this.toggleRibbonItems({props:"Headers",activeTab:this.ribbon.selectedTab}),this.parent.element.focus();break;case t+"_gridlines":var i={isShow:!r.showGridLines,sheetIdx:this.parent.activeSheetIndex,cancel:!1};if(this.parent.notify(Wn,{eventArgs:i,action:"gridLines"}),i.cancel)return;r.showGridLines=!r.showGridLines,this.toggleRibbonItems({props:"GridLines",activeTab:this.ribbon.selectedTab}),this.parent.element.focus();break;case t+"_protect":r.isProtected=!r.isProtected,this.parent.setProperties({sheets:this.parent.sheets},!0);var o=!1;o=!r.isProtected,this.parent.notify(ti,{isActive:o,id:t+"_protect"});break;case t+"_undo":this.parent.notify(Ln,{isUndo:!0});break;case t+"_redo":this.parent.notify(Ln,{isUndo:!1})}this.parent.notify(Xr,e)}},e.prototype.toggleRibbonItems=function(e){var r=this.parent.serviceLocator.getService(Us).getConstant("View"),n=this.parent.serviceLocator.getService(Us).getConstant("Data");if(this.ribbon.items[this.ribbon.selectedTab].header.text===r){if(t.isNullOrUndefined(e.activeTab))for(var i=0,o=this.ribbon.items.length;i<o;i++)if(this.ribbon.items[i].header.text===r){e.activeTab=i;break}var s=this.getLocaleText(e.props,!0),a=this.parent.element.id+"_"+e.props.toLowerCase(),l=this.ribbon.items[e.activeTab].content.length;for(i=void 0;i<l;i++)"Separator"!==this.ribbon.items[e.activeTab].content[i].type&&this.ribbon.items[e.activeTab].content[i].id===a&&(this.ribbon.items[e.activeTab].content[i].text=s,this.ribbon.setProperties({items:this.ribbon.items},!0));this.ribbon.items[this.ribbon.selectedTab].header.text===r&&this.updateToggleText(e.props.toLowerCase(),s)}if(this.ribbon.items[this.ribbon.selectedTab].header.text===n){if(t.isNullOrUndefined(e.activeTab)){i=0;for(var h=this.ribbon.items.length;i<h;i++)if(this.ribbon.items[i].header.text===n){e.activeTab=i;break}}for(s=this.getLocaleProtectText("Sheet",!0),a=this.parent.element.id+"_"+e.props.toLowerCase(),l=this.ribbon.items[e.activeTab].content.length,i=void 0;i<l;i++)"Separator"!==this.ribbon.items[e.activeTab].content[i].type&&this.ribbon.items[e.activeTab].content[i].id===a&&(this.ribbon.items[e.activeTab].content[i].text=s,this.ribbon.setProperties({items:this.ribbon.items},!0));this.ribbon.items[this.ribbon.selectedTab].header.text===n&&this.updateToggleText(e.props.toLowerCase(),s)}},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,t){var r=this;ve(function(){r.ribbon.element.querySelector("#"+r.parent.element.id+"_"+e+" .e-tbar-btn-text").textContent=t})},e.prototype.refreshViewTabContent=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+"_headers"){if(this.updateViewTabContent(e,"Headers",n),t)break;t=!0}if(this.ribbon.items[e].content[n].id===r+"_gridlines"){if(this.updateViewTabContent(e,"GridLines",n),t)break;t=!0}}},e.prototype.updateViewTabContent=function(e,t,r){var n=this.parent.getActiveSheet(),i=this.parent.serviceLocator.getService(Us);n["show"+t]?this.ribbon.items[e].content[r].text===i.getConstant("Show"+t)&&this.updateShowHideBtn("Hide",t,r,e):this.ribbon.items[e].content[r].text===i.getConstant("Hide"+t)&&this.updateShowHideBtn("Show",t,r,e)},e.prototype.updateShowHideBtn=function(e,t,r,n){var i=this.parent.serviceLocator.getService(Us).getConstant(e+t);this.ribbon.items[n].content[r].text=i,this.ribbon.setProperties({items:this.ribbon.items},!0),this.updateToggleText(t.toLowerCase(),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&&this.ribbon.items[e].content[n].id===r+"_protect"){if(this.updateDataTabContent(e,"Sheet",n),t)break;t=!0}},e.prototype.updateDataTabContent=function(e,t,r){var n=this.parent.getActiveSheet(),i=this.parent.serviceLocator.getService(Us);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)},e.prototype.updateProtectBtn=function(e,t,r,n){var i=this.parent.serviceLocator.getService(Us).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.addToolbarItems=function(e){this.ribbon.addToolbarItems(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"}),i=this.parent.createElement("ul");r.appendChild(i);var o=new n.Toolbar({items:[{prefixIcon:"e-tick-icon",align:"Left",id:t+"focused_tick",cssClass:"e-focused-tick"},{template:i,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 n.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(i)}});o.createElement=this.parent.createElement,o.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"),i=this.parent.createElement("button");t.appendChild(r),t.appendChild(i),t.style.display="block",this.parent.element.appendChild(t);var o=new l.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}],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% - "+i.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(),n=h.calculatePosition(o.element,"right","bottom");t.style.left=n.left-r.width+"px",t.style.top=n.top-r.height+"px";for(var i=0;i<o.items.length;i++)if(o.content===o.items[i].text){e.element.children[i].classList.add("e-selected");break}},close:function(){return e.parent.element.focus()}});o.createElement=this.parent.createElement,o.appendTo(i);var s=new n.Toolbar({width:"calc(100% - "+i.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(Us),i=[".xlsx",".xls",".csv"];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="",t.appendChild(r.parent.createElement("span",{className:"e-extension",innerHTML:i[n]})),e.appendChild(t)}),this.parent.trigger("fileMenuBeforeOpen",e)},e.prototype.enableRibbonTabs=function(e){this.ribbon.enableTabs(e.tabs,e.enable)},e.prototype.fileMenuBeforeClose=function(e){this.parent.trigger("fileMenuBeforeClose",e)},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(Us);t.isProtected&&t.protectSettings.formatCells||!t.isProtected?(this.enableToolbarItems([{tab:r.getConstant("Home"),items:e.enableHomeBtnId,enable:!0}]),this.parent.notify(hi,null)):this.enableToolbarItems([{tab:r.getConstant("Home"),items:e.disableHomeBtnId,enable:!1}]),t.isProtected&&t.protectSettings.insertLink||!t.isProtected?this.enableToolbarItems([{tab:r.getConstant("Insert"),items:e.enableInsertBtnId,enable:!0}]):this.enableToolbarItems([{tab:r.getConstant("Insert"),items:e.enableInsertBtnId,enable:!1}]),t.isProtected&&t.protectSettings.selectCells||!t.isProtected?this.enableToolbarItems([{tab:r.getConstant("Home"),items:e.findBtnId,enable:!0}]):this.enableToolbarItems([{tab:r.getConstant("Home"),items:e.findBtnId,enable:!1}]),t.isProtected?(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.imageBtnId,enable:!1}])):(this.enableToolbarItems([{tab:r.getConstant("Data"),items:e.dataValidationBtnId,enable:!0}]),this.enableToolbarItems([{tab:r.getConstant("Formulas"),items:e.enableFrmlaBtnId,enable:!0}]),this.enableToolbarItems([{tab:r.getConstant("Insert"),items:e.imageBtnId,enable:!0}]))},e.prototype.updateMergeItem=function(e){if("mousemove"===e.type||"pointermove"===e.type||e.shiftKey&&"mousedown"===e.type){var t=d(this.parent.getActiveSheet().selectedRange);t[1]===t[3]&&t[0]===t[2]||this.parent.getActiveSheet().isProtected||(this.enableToolbarItems([{tab:this.parent.serviceLocator.getService(Us).getConstant("Home"),items:[this.parent.element.id+"_merge_cells"],enable:!0}]),this.toggleActiveState(!1))}},e.prototype.addEventListener=function(){this.parent.on(Sr,this.initRibbon,this),this.parent.on(Kr,this.enableToolbarItems,this),this.parent.on(ft,this.refreshRibbonContent,this),this.parent.on(kn,this.toggleRibbonItems,this),this.parent.on(on,this.enableFileMenuItems,this),this.parent.on(ln,this.hideRibbonTabs,this),this.parent.on(pn,this.addRibbonTabs,this),this.parent.on(dn,this.addToolbarItems,this),this.parent.on(sn,this.hideFileMenuItems,this),this.parent.on(an,this.addFileMenuItems,this),this.parent.on(cn,this.hideToolbarItems,this),this.parent.on(hn,this.enableRibbonTabs,this),this.parent.on(ri,this.protectSheetHandler,this),this.parent.on(qr,this.updateMergeItem,this)},e.prototype.destroy=function(){var e=this.parent.element,r=this.ribbon.element,n=e.id;["bold","italic","line-through","underline"].forEach(function(t){Be(e.querySelector("#"+n+"_"+t),o.Button)}),this.pasteSplitBtn.destroy(),this.pasteSplitBtn=null,this.mergeSplitBtn.destroy(),this.mergeSplitBtn=null,this.numFormatDDB.destroy(),this.numFormatDDB=null,this.fontSizeDdb.destroy(),this.fontSizeDdb=null,this.fontNameDdb.destroy(),this.fontNameDdb=null,this.textAlignDdb.destroy(),this.textAlignDdb=null,this.verticalAlignDdb.destroy(),this.verticalAlignDdb=null,this.sortingDdb.destroy(),this.sortingDdb=null,this.clearDdb.destroy(),this.clearDdb=null,this.colorPicker.destroy(),this.colorPicker=null,this.bordersMenu.destroy(),this.bordersMenu=null,this.bordersDdb.destroy(),this.bordersDdb=null,this.findDdb.destroy(),this.findDdb=null,this.parent.notify("destroyRibbonComponents",null),this.ribbon.destroy(),r&&t.detach(r),this.ribbon=null,this.removeEventListener()},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(Sr,this.initRibbon),this.parent.off(Kr,this.enableToolbarItems),this.parent.off(ft,this.refreshRibbonContent),this.parent.off(kn,this.toggleRibbonItems),this.parent.off(on,this.enableFileMenuItems),this.parent.off(ln,this.hideRibbonTabs),this.parent.off(pn,this.addRibbonTabs),this.parent.off(dn,this.addToolbarItems),this.parent.off(sn,this.hideFileMenuItems),this.parent.off(an,this.addFileMenuItems),this.parent.off(cn,this.hideToolbarItems),this.parent.off(hn,this.enableRibbonTabs),this.parent.off(ri,this.protectSheetHandler),this.parent.off(qr,this.updateMergeItem))},e}(),Is=function(){function e(e){this.categoryCollection=[],this.formulaCollection=[],this.parent=e,this.addEventListener()}return e.prototype.getModuleName=function(){return"formulaBar"},e.prototype.createFormulaBar=function(e){if(this.parent.showFormulaBar||!this.insertFnRipple){var r=this.parent.serviceLocator.getService(Us),n=this.parent.element.id,i=this.parent.createElement("div",{className:"e-formula-bar-panel"});if(!this.parent.isMobileView()){var o=this.parent.createElement("input",{id:n+"_name_box",attrs:{type:"text"}});i.appendChild(o),this.comboBoxInstance=new s.ComboBox({value:"A1",cssClass:"e-name-box",width:"",noRecordsTemplate:"",fields:{text:"name",value:"refersTo"},beforeOpen:this.nameBoxBeforeOpen.bind(this),blur:this.nameBoxBlur.bind(this),select:this.nameBoxSelect.bind(this),change:function(e){}}),this.comboBoxInstance.createElement=this.parent.createElement,this.comboBoxInstance.appendTo(o),this.comboBoxInstance.element.parentElement.title=r.getConstant("NameBox")}i.appendChild(this.parent.createElement("button",{className:"e-btn e-css e-flat e-icon-btn e-insert-function",attrs:{title:r.getConstant("InsertFunction")}})).appendChild(this.parent.createElement("span",{className:"e-btn-icon e-icons"})),this.insertFnRipple=t.rippleEffect(i,{selector:".e-insert-function"}),i.appendChild(this.parent.createElement("div",{className:"e-separator"}));var a=i.appendChild(this.parent.createElement("textarea",{className:"e-formula-bar e-css",id:n+"_formula_input",attrs:{title:r.getConstant("FormulaBar"),spellcheck:"false"}}));a.rows=1,this.parent.isMobileView()?(a.placeholder=r.getConstant("MobileFormulaBarPlaceHolder"),t.EventHandler.add(a,"focus",this.textAreaFocusIn,this),t.EventHandler.add(a,"blur",this.textAreaFocusOut,this)):i.appendChild(this.parent.createElement("span",{className:"e-drop-icon e-icons",attrs:{title:r.getConstant("ExpandFormulaBar")}})),e&&e.uiUpdate?this.parent.element.insertBefore(i,document.getElementById(n+"_sheet_panel")):this.parent.element.appendChild(i)}else this.destroy()},e.prototype.textAreaFocusIn=function(e){var t=this.parent.element.querySelector(".e-formula-bar-panel"),r=this.parent.createElement("button",{className:"e-btn e-css e-flat e-icon-btn e-formula-submit"});r.appendChild(this.parent.createElement("span",{className:"e-btn-icon e-icons e-tick-icon"})),t.classList.add("e-focused"),t.appendChild(r)},e.prototype.textAreaFocusOut=function(e){var r=this.parent.element.querySelector(".e-formula-bar-panel");r.classList.remove("e-focused"),t.detach(r.querySelector(".e-formula-submit"))},e.prototype.keyDownHandler=function(e){var t=e.target;if(this.parent.isEdit&&!this.parent.getActiveSheet().isProtected){if(P(t.value)&&16===e.keyCode)return;t.classList.contains("e-formula-bar")&&this.parent.notify(Fr,{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(Fr,r),r.editedValue!==t.value&&16!==e.keyCode&&this.parent.notify(Fr,{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()},e.prototype.nameBoxBlur=function(e){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){var t=e.itemData.refersTo.substr(1),r=se(this.parent,le(t)),n=y(t),i=de(this.parent,r);if(-1!==n.indexOf(":")){var o=n.indexOf(":"),s=n.substr(0,o),a=n.substr(o+1,n.length);s=s.replace("$",""),(a=a.replace("$","")).match(/\D/g)&&!a.match(/[0-9]/g)&&s.match(/\D/g)&&!s.match(/[0-9]/g)?n=(s+="1")+":"+(a+=i.rowCount):!a.match(/\D/g)&&a.match(/[0-9]/g)&&!s.match(/\D/g)&&s.match(/[0-9]/g)&&(n=(s=f(parseInt(s,10)-1,0))+":"+(a=f(parseInt(a,10)-1,i.colCount-1)))}r===this.parent.activeSheetIndex?(this.parent.selectRange(n),this.parent.element.focus()):(pe(this.parent,n,i),this.parent.activeSheetIndex=r)}},e.prototype.formulaBarUpdateHandler=function(e){var r,n=this,i=this.parent.getActiveSheet().selectedRange.split(":"),o=new t.Internationalization;if("mousemove"===e.type||"pointermove"===e.type){var s=d(i[0]),a=d(i[1]);r=Math.abs(s[0]-a[0])+1+"R x "+(Math.abs(s[1]-a[1])+1)+"C",this.parent.isEdit&&this.parent.notify(Ii,null)}else{r=i[0];this.parent.getData(ge(this.parent)+"!"+r).then(function(e){var r,i="";e.forEach(function(e,s){var a=e&&e.format?D(e.format):"General";e&&(t.isNullOrUndefined(e.value)||(r=R(Number(e.value)),i="Invalid Date"===r.toString()||"ShortDate"!==a&&"LongDate"!==a?"Invalid Date"!==r.toString()&&"Time"===a?o.formatDate(r,{type:"dateTime",skeleton:"yMd"})+" "+o.formatDate(r,{type:"dateTime",skeleton:"hms"}):e.value:o.formatDate(r,{type:"date",skeleton:"yMd"})),e.formula&&(i=e.formula));var l=document.getElementById(n.parent.element.id+"_formula_input");l.value=i,t.isNullOrUndefined(i)||n.parent.isEdit||n.parent.notify(Fr,{action:"refreshEditor",value:l.value,refreshEditorElem:!0}),n.parent.isEdit&&n.parent.notify(Ii,null)})})}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:ge(this.parent)+"!"+t.selectedRange,definedName:null};if(this.parent.notify(Nr,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?e.disabled=!0:e.disabled=!1},e.prototype.formulaBarClickHandler=function(e){var r=this,n=e.target;if(n.classList.contains("e-drop-icon")&&t.closest(n,".e-formula-bar-panel"))this.toggleFormulaBar(n);else if(n.classList.contains("e-formula-bar"))this.parent.isEdit||this.parent.getActiveSheet().isProtected?this.parent.getActiveSheet().isProtected&&this.parent.notify(li,null):this.parent.notify(Fr,{action:"startEdit",refreshCurPos:!1});else if(n.parentElement&&n.parentElement.classList.contains("e-name-box"))if(n.classList.contains("e-ddl-icon")){var i={action:"getNames",names:[]};this.parent.notify(Nr,i),this.comboBoxInstance.dataSource=i.names}else this.comboBoxInstance.element.classList.add("e-name-editing"),this.comboBoxInstance.element.select();if(!t.isNullOrUndefined(n.offsetParent)&&(n.offsetParent.classList.contains("e-insert-function")||n.classList.contains("e-insert-function")||this.parent.element.id+"_insert_function"===n.offsetParent.id||this.parent.element.id+"_insert_function"===n.id||n.parentElement.classList.contains("e-insert-function")||this.parent.element.id+"_insert_function"===n.parentElement.id)){if(this.parent.getActiveSheet().isProtected)return void this.parent.notify(li,null);var o=!this.parent.isEdit,l={action:"getCurrentEditValue",editedValue:""};if(!o){i={action:"isFormulaEditing",isFormulaEdit:!1};this.parent.notify(Nr,i),o=i.isFormulaEdit,this.parent.notify(Fr,l)}if(o||""===l.editedValue){""===l.editedValue&&this.parent.notify(Fr,{action:"refreshEditor",value:"="});var h=this.parent.serviceLocator.getService(Us),p=this.parent.createElement("div",{className:"e-formula-description",id:this.parent.element.id+"_description_content"}),d=this.parent.createElement("div",{className:"e-category-content",id:this.parent.element.id+"_category_content",innerHTML:h.getConstant("PickACategory")}),c=this.parent.createElement("input",{className:"e-formula-category",id:this.parent.element.id+"_formula_category"}),u=this.parent.createElement("div",{className:"e-formula-list",id:this.parent.element.id+"_formula_list"}),f=this.parent.createElement("div",{className:"e-description-content",innerHTML:h.getConstant("Description")}),g=this.parent.createElement("div",{className:"e-header-content",innerHTML:h.getConstant("InsertFunction")}),m={action:"getFormulaCategory",categoryCollection:[]};this.parent.notify(pt,m),this.categoryCollection=m.categoryCollection,this.categoryList=new s.DropDownList({dataSource:this.categoryCollection,index:0,width:"285px",popupHeight:"210px",select:this.dropDownSelect.bind(this)});var v={action:"getLibraryFormulas",formulaCollection:[]};this.parent.notify(pt,v),this.formulaCollection=v.formulaCollection,this.formulaList=new a.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("dialog"),this.dialog.show({header:g.outerHTML,content:d.outerHTML+c.outerHTML+u.outerHTML+f.outerHTML+p.outerHTML,width:"320px",height:"485px",cssClass:"e-spreadsheet-function-dlg",showCloseIcon:!0,isModal:!0,beforeOpen:function(e){var t={dialogName:"InsertFunctionDialog",element:e.element,target:e.target,cancel:e.cancel};r.parent.trigger("dialogBeforeOpen",t),t.cancel&&(e.cancel=!0),r.parent.element.focus()},open:this.dialogOpen.bind(this),beforeClose:this.dialogBeforeClose.bind(this),close:this.dialogClose.bind(this),buttons:[{click:this.selectFormula.bind(this,this.dialog,this),buttonModel:{content:h.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(Us);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")):(t.classList.add("e-expanded"),document.getElementById(this.parent.element.id+"_formula_input").rows=3,e.title=r.getConstant("CollapseFormulaBar")),this.parent.setPanelSize()},e.prototype.dialogOpen=function(){this.focusOkButton()},e.prototype.dialogClose=function(){var e={action:"getCurrentEditValue",editedValue:""};this.parent.notify(Fr,e),"="===e.editedValue.toString().trim()&&this.parent.notify(Fr,{action:"refreshEditor",value:""})},e.prototype.dialogBeforeClose=function(){t.EventHandler.remove(this.formulaList.element,"dblclick",this.formulaClickHandler);var e=document.getElementById("_dialog-content");e.parentNode.removeChild(e),this.dialog.dialogInstance.storeActiveElement=document.getElementById(this.parent.element.id+"_edit")},e.prototype.selectFormula=function(e,t){var r=t.formulaList.getSelectedItems().text,n=de(this.parent,this.parent.activeSheetIndex);this.parent.isEdit?this.parent.notify(Fr,{action:"refreshEditor",value:r+"(",refreshFormulaBar:!0,refreshEditorElem:!0,isAppend:!0}):(this.parent.notify(Fr,{action:"startEdit",value:"="+r+"(",address:n.activeCell}),this.parent.notify(Or,{action:"refreshFormulabar",value:"="+r+"("})),e.hide()},e.prototype.listSelected=function(){this.updateFormulaDescription()},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(pt,t),this.formulaCollection=t.formulaCollection;else{var r={action:"dropDownSelectFormulas",formulaCollection:[],selectCategory:e.item.textContent};this.parent.notify(pt,r),this.formulaCollection=r.formulaCollection}this.formulaList.dataSource=this.formulaCollection.sort()},e.prototype.focusOkButton=function(){document.getElementById("_dialog-content").nextElementSibling.firstElementChild.focus()},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,t=this.formulaList.getSelectedItems().text,r={action:"getFormulaDescription",description:"",selectedList:t};this.parent.notify(pt,r),this.focusOkButton(),e=document.getElementById(this.parent.element.id+"_description_content"),t="AND"===t?"CalculateAND":"OR"===t?"CalculateOR":t,e.innerHTML=this.parent.serviceLocator.getService(Us).getConstant(t)},e.prototype.formulaClickHandler=function(e){var t=e.target,r=de(this.parent,this.parent.activeSheetIndex);(t.offsetParent.classList.contains("e-text-content")||t.classList.contains("e-list-item"))&&(this.parent.isEdit?this.parent.notify(Fr,{action:"refreshEditor",value:t.innerText+"(",refreshFormulaBar:!0,refreshEditorElem:!0,isAppend:!0}):(this.parent.notify(Fr,{action:"startEdit",value:"="+t.innerText+"(",address:r.activeCell}),this.parent.notify(Or,{action:"refreshFormulabar",value:"="+t.innerText+"("})),this.dialog.hide())},e.prototype.addEventListener=function(){this.parent.on(xr,this.createFormulaBar,this),this.parent.on(Dr,this.formulaBarClickHandler,this),this.parent.on(Hr,this.keyDownHandler,this),this.parent.on(Lr,this.keyUpHandler,this),this.parent.on(qr,this.formulaBarUpdateHandler,this),this.parent.on(jr,this.UpdateValueAfterMouseUp,this),this.parent.on(Or,this.editOperationHandler,this),this.parent.on(pi,this.disabletextarea,this)},e.prototype.destroy=function(){this.removeEventListener(),this.comboBoxInstance.destroy(),this.comboBoxInstance=null,this.insertFnRipple(),this.insertFnRipple=null;var e=this.parent.element.querySelector(".e-formula-bar-panel");e&&t.detach(e)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(xr,this.createFormulaBar),this.parent.off(Dr,this.formulaBarClickHandler),this.parent.off(Hr,this.keyDownHandler),this.parent.off(Lr,this.keyUpHandler),this.parent.off(qr,this.formulaBarUpdateHandler),this.parent.off(jr,this.UpdateValueAfterMouseUp),this.parent.off(Or,this.editOperationHandler),this.parent.off(pi,this.disabletextarea))},e.prototype.editOperationHandler=function(e){switch(e.action){case"refreshFormulabar":this.getFormulaBar().value=t.isUndefined(e.value)?"":e.value;break;case"getPosition":e.position=this.getFormulaBar().getBoundingClientRect()}},e.prototype.getFormulaBar=function(){return this.parent.element.querySelector("#"+this.parent.element.id+"_formula_input")},e}(),Es=function(){function e(e){this.isFormulaBar=!1,this.isFormula=!1,this.isPopupOpened=!1,this.isPreventClose=!1,this.isSubFormula=!1,this.keyCodes={UP:38,DOWN:40,LEFT:37,RIGHT:39,FIRSTALPHABET:65,LASTALPHABET:90,SPACE:32,BACKSPACE:8,TAB:9,DELETE:46,ENTER:13,ESC:27},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=null,this.parent=null},e.prototype.addEventListener=function(){this.parent.on(Nr,this.performFormulaOperation,this),this.parent.on(Lr,this.keyUpHandler,this),this.parent.on(Hr,this.keyDownHandler,this),this.parent.on(Dr,this.formulaClick,this),this.parent.on($n,this.refreshFormulaDatasource,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(Nr,this.performFormulaOperation),this.parent.off(Lr,this.keyUpHandler),this.parent.off(Hr,this.keyDownHandler),this.parent.off(Dr,this.formulaClick),this.parent.off($n,this.refreshFormulaDatasource))},e.prototype.performFormulaOperation=function(e){var t=this;switch(e.action){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=ge(this.parent)),e.names=this.getNames(e.sheetName);break;case"getNameFromRange":e.definedName=this.getNameFromRange(e.range);break;case"isFormulaEditing":e.isFormulaEdit=this.isFormula;break;case"isCircularReference":var r=this.parent.serviceLocator.getService(Us);this.parent.serviceLocator.getService(js).show({height:180,width:400,isModal:!0,showCloseIcon:!0,content:r.getConstant("CircularReference"),beforeOpen:function(e){var r={dialogName:"CircularReferenceDialog",element:e.element,target:e.target,cancel:e.cancel};t.parent.trigger("dialogBeforeOpen",r),r.cancel&&(e.cancel=!0)}}),e.argValue="0"}},e.prototype.renderAutoComplete=function(){if(!this.parent.element.querySelector("#"+this.parent.element.id+"_ac")){var e=this.parent.createElement("input",{id:this.parent.element.id+"_ac",className:"e-ss-ac"});this.parent.element.appendChild(e);var t={action:"getLibraryFormulas",formulaCollection:[]};this.parent.notify(pt,t);var r={dataSource:t.formulaCollection,cssClass:"e-ss-atc",popupWidth:"130px",allowFiltering:!0,filterType:"StartsWith",sortOrder:"Ascending",open:this.onSuggestionOpen.bind(this),close:this.onSuggestionClose.bind(this),select:this.onSelect.bind(this),actionComplete:this.onSuggestionComplete.bind(this)};this.autocompleteInstance=new s.AutoComplete(r,e),this.autocompleteInstance.createElement=this.parent.createElement}},e.prototype.onSuggestionOpen=function(e){var t=this;this.isPopupOpened=!0;var r=this.getPopupPosition();e.popup.offsetX=r.left,e.popup.offsetY=r.top+r.height,e.popup.refreshPosition(),e.popup.element.firstChild.style.maxHeight="180px",new Promise(function(e,t){setTimeout(function(){e()},100)}).then(function(){t.triggerKeyDownEvent(t.keyCodes.DOWN)})},e.prototype.onSuggestionClose=function(e){this.isPreventClose?e.cancel=!0:this.isPopupOpened=!1},e.prototype.onSelect=function(e){var t="="+e.itemData.value+"(";if(this.isSubFormula){var r=this.getEditingValue(),n=r.lastIndexOf(this.getArgumentSeparator());n>-1?t=r.slice(0,n+1):(n=r.lastIndexOf("("))>-1&&(t=r.slice(0,n+1)),t+=e.itemData.value+"("}this.parent.notify(Fr,{action:"refreshEditor",value:t,refreshFormulaBar:!0,refreshEditorElem:!0,refreshCurPos:!this.isFormulaBar})},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(pt,e),this.autocompleteInstance.dataSource=e.formulaCollection},e.prototype.keyUpHandler=function(e){if(this.parent.isEdit){var t=this.getEditingValue();this.isFormula=P(t),(this.isFormula||this.isPopupOpened)&&(e.keyCode!==this.keyCodes.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 this.keyCodes.UP:case this.keyCodes.DOWN:e.preventDefault(),this.triggerKeyDownEvent(t);break;case this.keyCodes.TAB:e.preventDefault(),this.triggerKeyDownEvent(this.keyCodes.ENTER)}}else{var r=e.target;if(r.id===this.parent.element.id+"_name_box")switch(t){case this.keyCodes.ENTER:this.addDefinedName({name:r.value}),this.parent.element.focus();break;case this.keyCodes.ESC:this.parent.element.focus()}}},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;this.isNavigationKey(n)||(r.value=t,r.dispatchEvent(new Event("input")),r.dispatchEvent(new Event("keyup")),i&&this.triggerKeyDownEvent(this.keyCodes.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=document.querySelector("#"+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.getArgumentSeparator());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.getPopupPosition=function(){var e={position:null};return this.isFormulaBar?(e.action="getPosition",this.parent.notify(Or,e)):(e.action="getPosition",this.parent.notify(Fr,e)),e.position},e.prototype.getEditingValue=function(){var e={action:"getCurrentEditValue",editedValue:""};return this.parent.notify(Fr,e),e.editedValue},e.prototype.isNavigationKey=function(e){return e===this.keyCodes.UP||e===this.keyCodes.DOWN||e===this.keyCodes.LEFT||e===this.keyCodes.RIGHT},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.getArgumentSeparator=function(){if(this.argumentSeparator)return this.argumentSeparator;var e={action:"getArgumentSeparator",argumentSeparator:""};return this.parent.notify(pt,e),this.argumentSeparator=e.argumentSeparator,e.argumentSeparator},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,i){return!(!n||r.refersTo!=="="+t)||r.refersTo==="="+e});return i&&i[0]},e.prototype.addDefinedName=function(e){var r=this,n=e.name,i=!1;if(!e.refersTo){var o=de(this.parent,this.parent.activeSheetIndex),s=ge(this.parent);s=-1!==s.indexOf(" ")?"'"+s+"'":s;var a=o.selectedRange;if(!t.isNullOrUndefined(a)){var l=a.indexOf(":"),h=a.substr(0,l),p=a.substr(l+1,a.length);parseInt(p.replace(/\D/g,""),10)===o.rowCount&&1===parseInt(h.replace(/\D/g,""),10)?(p=p.replace(/[0-9]/g,""),a="$"+(h=h.replace(/[0-9]/g,""))+":$"+p):c(p)[1]===o.colCount-1&&0===c(h)[1]?(p=p.replace(/\D/g,""),a="$"+(h=h.replace(/\D/g,""))+":$"+p):a=h===p?h:a}e.refersTo=s+"!"+a,e.scope="Workbook"}if(n.length>0&&/^([a-zA-Z_0-9.]){0,255}$/.test(n)){var d={action:"addDefinedName",definedName:e,isAdded:!1};this.parent.notify(pt,d),i=d.isAdded,d.isAdded||this.parent.serviceLocator.getService(js).show({content:this.parent.serviceLocator.getService(Us).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(js).show({content:this.parent.serviceLocator.getService(Us).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}(),ks=function(){function e(e){this.aggregateContent="",this.isSelectCancel=!1,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(Us),i=this.parent.createElement("div",{className:"e-sheet-tab-panel",id:this.parent.element.id+"_sheet_tab_panel"}),o=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")}});o.appendChild(this.parent.createElement("span",{className:"e-btn-icon e-icons e-add-icon"})),o.addEventListener("click",this.addSheetTab.bind(this)),o.disabled=!this.parent.allowInsert,i.appendChild(o),this.parent.allowInsert&&(this.addBtnRipple=t.rippleEffect(i,{selector:".e-add-sheet-tab"}));var s=this.parent.createElement("button",{attrs:{title:r.getConstant("ListAllSheets")}});i.appendChild(s),this.parent.element.appendChild(i);var a=this.getSheetTabItems();this.dropDownInstance=new l.DropDownButton({iconCss:"e-icons",items:a.ddbItems,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)},open:function(t){return e.openHandler(e.dropDownInstance,t.element,"left")},cssClass:"e-sheets-list e-flat e-caret-hide",close:function(){return e.parent.element.focus()}}),this.dropDownInstance.createElement=this.parent.createElement,this.dropDownInstance.appendTo(s);var h=this.parent.createElement("div",{className:"e-sheet-tab"});this.tabInstance=new n.Tab({selectedItem:this.parent.activeSheetIndex,overflowMode:"Scrollable",items:a.tabItems,scrollStep:250,selecting:function(t){var r={currentSheetIndex:t.selectingIndex,previousSheetIndex:t.selectedIndex,cancel:!1};e.isSelectCancel||e.parent.notify(Gn,{eventArgs:r,action:"gotoSheet"}),e.isSelectCancel=r.cancel},selected:function(t){if(t.selectedIndex!==t.previousIndex)if(e.isSelectCancel)e.tabInstance.selectedItem=t.previousIndex,e.tabInstance.dataBind(),e.parent.element.focus();else{e.parent.activeSheetIndex=t.selectedIndex,e.parent.dataBind(),e.updateDropDownItems(t.selectedIndex,t.previousIndex),e.parent.element.focus();var r={previousSheetIndex:t.previousIndex,currentSheetIndex:t.selectedIndex};e.parent.notify(Wn,{eventArgs:r,action:"gotoSheet"});var n={action:"registerGridInCalc",sheetID:(t.selectedIndex+1).toString()};e.parent.notify(pt,n)}},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)}}),i.appendChild(h),this.tabInstance.createElement=this.parent.createElement,this.tabInstance.appendTo(h),t.EventHandler.remove(this.tabInstance.element,"keydown",this.tabInstance.spaceKeyDown);for(var p=a.tabItems.length,d=0;d<p;d++){var c={action:"addSheet",sheetName:"Sheet"+(d+1),index:d+1,visibleName:ge(this.parent,d)};this.parent.notify(pt,c)}this.parent.notify(pt,{action:"initiateDefinedNames"}),this.parent.notify(ei,null)}else this.destroy()},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){var r=this.parent.viewport.height;parseInt(getComputedStyle(t.firstElementChild).height,10)*e.items.length+2*parseInt(getComputedStyle(t).paddingTop,10)>r&&(t.style.height=r+"px",t.style.overflowY="auto"),t.parentElement.style.visibility="hidden"},e.prototype.openHandler=function(e,t,r){var n,i=t.parentElement;if(-1===h.isCollide(i).indexOf("bottom")){n="auto"===t.style.overflowY?this.parent.viewport.height:i.getBoundingClientRect().height;var o=h.calculatePosition(e.element,r,"top");"right"===r&&(o.left-=i.getBoundingClientRect().width),i.style.left=o.left+"px",i.style.top=o.top-n+"px"}i.style.visibility=""},e.prototype.getSheetTabItems=function(){var e,t=this,r=[],n=[];return this.parent.sheets.forEach(function(i,o){e=ge(t.parent,o),r.push({header:{text:e},cssClass:"Visible"===i.state?"":"e-hide"}),n.push({text:e,iconCss:o===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(){var e={action:"getCurrentEditValue",editedValue:""};this.parent.notify(Fr,e);P(e.editedValue)||(this.parent.notify(Ht,{model:this.parent,start:this.parent.activeSheetIndex+1,end:this.parent.activeSheetIndex+1,modelType:"Sheet",isAction:!0,activeSheetIndex:this.parent.activeSheetIndex+1}),this.parent.element.focus())},e.prototype.insertSheetTab=function(e){this.dropDownInstance.items[this.tabInstance.selectedItem].iconCss="";for(var t=e.startIdx;t<=e.endIdx;t++){var r=this.parent.sheets[t].name;this.dropDownInstance.items.splice(t,0,{text:r}),this.tabInstance.addTab([{header:{text:r},content:""}],t)}this.dropDownInstance.items[e.startIdx].iconCss="e-selected-icon e-icons",this.dropDownInstance.setProperties({items:this.dropDownInstance.items},!0),this.updateSheetTab({idx:e.startIdx})},e.prototype.updateSheetTab=function(e){"activeSheetChanged"===e.name?e.idx=this.parent.skipHiddenSheets(e.idx):"Hidden"===this.parent.sheets[e.idx].state&&(this.parent.sheets[e.idx].state="Visible",this.tabInstance.items[e.idx].cssClass="",this.tabInstance.items=this.tabInstance.items,this.tabInstance.dataBind()),this.tabInstance.selectedItem=e.idx,this.tabInstance.dataBind(),this.parent.notify(ei,null)},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=0,o=this.tabInstance.items.length;i<o;i++)if(this.tabInstance.items[i].header.text===n){this.parent.activeSheetIndex!==i&&this.updateSheetTab({idx:i});break}e.element.classList.contains("e-contextmenu")&&e.items[0]&&e.items[0].id===this.parent.element.id+"_cmenu_insert_sheet"&&(1===this.skipHiddenSheets()&&(e.element.children[1].classList.add("e-disabled"),e.element.children[3].classList.add("e-disabled")),this.parent.allowInsert||e.element.children[0].classList.add("e-disabled"))}},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=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(n),t.EventHandler.add(document,"mousedown touchstart",this.renameInputFocusOut,this),t.EventHandler.add(n,"input",this.updateWidth,this),n.focus(),n.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.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")){if(r=document.getElementById(this.parent.element.id+"_rename_input"),"keydown"===e.type&&27===e.keyCode)return this.removeRenameInput(r),void this.parent.element.focus();var n=r.value,i=this.parent.serviceLocator.getService(Us);if(n){var o=this.tabInstance.selectedItem;if(n.match(new RegExp(".*[\\[\\]\\*\\\\/\\?].*")))this.showRenameDialog(r,i.getConstant("SheetRenameInvalidAlert"));else{if(this.tabInstance.items[o].header.text!==n)for(var s=0,a=this.parent.sheets.length;s<a;s++)if(s!==this.parent.activeSheetIndex&&this.parent.sheets[s].name.toLowerCase()===n.toLowerCase())return void this.showRenameDialog(r,i.getConstant("SheetRenameAlreadyExistsAlert"));var l=this.removeRenameInput(r);this.tabInstance.items[o].header.text!==n&&(this.parent.sheets[o].name=n,this.updateSheetName({value:n,idx:o,items:l})),("keydown"===e.type||t.closest(e.target,".e-spreadsheet"))&&this.parent.element.focus()}}else this.showRenameDialog(r,i.getConstant("SheetRenameEmptyAlert"));var h=this.parent.getActiveSheet().id,p={action:"renameUpdation",value:n,sheetId:h};this.parent.notify(pt,p);var d={index:h,value:n};this.parent.notify(Wn,{eventArgs:d,action:"renameSheet"})}},e.prototype.updateSheetName=function(e){this.tabInstance.items[e.idx].header.text=e.value,this.dropDownInstance.items[e.idx].text=e.value,this.dropDownInstance.setProperties({items:this.dropDownInstance.items},!0),e.value.indexOf("  ")>-1?(this.tabInstance.setProperties({items:this.tabInstance.items},!0),e.items.querySelector(".e-toolbar-item.e-active .e-tab-text").textContent=e.value):(this.tabInstance.items=this.tabInstance.items,this.tabInstance.dataBind())},e.prototype.hideSheet=function(){this.parent.getActiveSheet().state="Hidden",this.tabInstance.items[this.parent.activeSheetIndex].cssClass="e-hide",this.tabInstance.items=this.tabInstance.items,this.tabInstance.dataBind(),this.tabInstance.selectedItem=this.parent.skipHiddenSheets(this.parent.activeSheetIndex===this.parent.sheets.length-1?this.parent.activeSheetIndex-1:this.parent.activeSheetIndex+1),this.tabInstance.dataBind()},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,"input",this.updateWidth),t.remove(e),r.style.display="",n},e.prototype.showRenameDialog=function(e,t){var r=this;this.parent.serviceLocator.getService(js).show({target:document.getElementById(this.parent.element.id+"_sheet_panel"),height:180,width:400,isModal:!0,showCloseIcon:!0,content:t,beforeOpen:function(t){var n={dialogName:"SheetRenameDialog",element:t.element,target:t.target,cancel:t.cancel};r.parent.trigger("dialogBeforeOpen",n),n.cancel&&(t.cancel=!0),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 t=this;if(!e.count||e.count!==this.parent.sheets.length){var r=this.parent.serviceLocator.getService(Us);if(this.skipHiddenSheets()>1){var n=e.sheetName?de(this.parent,se(this.parent,e.sheetName)):this.parent.getActiveSheet(),i=e.index||se(this.parent,n.name),o={index:i,sheetCount:this.parent.sheets.length,sheetName:n.name};if(!(!n.rows||!n.rows.length)&&(1!==n.rows.length||!(!n.rows[0].cells||!n.rows[0].cells.length))){var s=this.parent.serviceLocator.getService(js);e.clicked?this.forceDelete(i):s.show({height:200,width:400,isModal:!0,showCloseIcon:!0,content:r.getConstant("DeleteSheetAlert"),beforeOpen:function(e){var r={dialogName:"DeleteSheetDialog",element:e.element,target:e.target,cancel:e.cancel};t.parent.trigger("dialogBeforeOpen",r),r.cancel&&(e.cancel=!0),t.parent.element.focus()},buttons:[{buttonModel:{content:r.getConstant("Ok"),isPrimary:!0},click:function(){s.hide(),t.forceDelete(i),t.parent.notify(_n,null),e&&!e.isAction&&(o.sheetCount=t.parent.sheets.length,t.parent.notify(Wn,{eventArgs:o,action:"removeSheet"}))}}]})}else{var a={action:"deleteSheetTab",sheetName:"",index:i+1};this.parent.notify(pt,a),this.destroySheet(i),this.parent.notify(_n,null),e&&!e.isAction&&(o.sheetCount=this.parent.sheets.length,this.parent.notify(Wn,{eventArgs:o,action:"removeSheet"}))}}else this.parent.serviceLocator.getService(js).show({target:document.getElementById(this.parent.element.id+"_sheet_panel"),height:180,width:400,isModal:!0,showCloseIcon:!0,content:r.getConstant("DeleteSingleLastSheetAlert"),beforeOpen:function(e){var r={dialogName:"DeleteSingleSheetDialog",element:e.element,target:e.target,cancel:e.cancel};t.parent.trigger("dialogBeforeOpen",r),r.cancel&&(e.cancel=!0),t.parent.element.focus()}})}},e.prototype.forceDelete=function(e){var t={action:"deleteSheetTab",sheetName:"",index:e+1};this.parent.notify(pt,t),this.destroySheet(e)},e.prototype.destroySheet=function(e){var t=e||this.parent.activeSheetIndex;this.parent.removeSheet(t),this.parent.notify(yt,{sheetIndex:t}),this.dropDownInstance.items.splice(t,1),this.dropDownInstance.setProperties({items:this.dropDownInstance.items},!0),this.tabInstance.removeTab(t);var r=this.parent.skipHiddenSheets(this.tabInstance.selectedItem);this.parent.activeSheetIndex=r,this.parent.setProperties({activeSheetIndex:r},!0),this.parent.renderModule.refreshSheet(),this.tabInstance.selectedItem=r,this.tabInstance.dataBind(),this.updateDropDownItems(r),this.parent.notify(ei,null),this.parent.element.focus()},e.prototype.showAggregate=function(){var e=this;if(!w(d(this.parent.getActiveSheet().selectedRange))){var t={Count:0,Sum:"0",Avg:"0",Min:"0",Max:"0",countOnly:!0};if(this.parent.notify(Ct,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];if(this.aggregateDropDown)this.updateAggregateContent(i,t);else{var o=this.parent.createElement("button");document.getElementById(this.parent.element.id+"_sheet_tab_panel").appendChild(o),this.aggregateDropDown=new l.DropDownButton({content:i,items:this.getAggregateItems(t),select:function(r){return e.updateAggregateContent(r.item.text,t,!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 e.parent.element.focus()},cssClass:r}),this.aggregateDropDown.createElement=this.parent.createElement,this.aggregateDropDown.appendTo(o)}}else this.removeAggregate()}},e.prototype.getAggregateItems=function(e){var t,r,n=this,i=[];return Object.keys(e).forEach(function(o){e[o]!==Ct&&(t=o+": "+e[o],r=o===n.aggregateContent?"e-selected-icon e-icons":"",i.push({text:t,iconCss:r}))}),i},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(wr,this.createSheetTabs,this),this.parent.on(Ir,this.refreshSheetTab,this),this.parent.on(Wr,this.insertSheetTab,this),this.parent.on(Gr,this.removeSheetTab,this),this.parent.on(Yr,this.renameSheetTab,this),this.parent.on(zr,this.switchSheetTab,this),this.parent.on(Cn,this.updateSheetTab,this),this.parent.on(bn,this.renameInputFocusOut,this),this.parent.on(ft,this.removeAggregate,this),this.parent.on(Br,this.focusRenameInput,this),this.parent.on(Mr,this.focusRenameInput,this),this.parent.on(On,this.updateSheetName,this),this.parent.on(Dn,this.hideSheet,this),this.parent.on(mi,this.showAggregate,this)},e.prototype.destroy=function(){this.removeEventListener(),this.dropDownInstance.destroy(),this.dropDownInstance=null,this.tabInstance.destroy(),this.tabInstance=null,this.aggregateDropDown=null,this.aggregateContent=null,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.parent=null},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(wr,this.createSheetTabs),this.parent.off(Ir,this.refreshSheetTab),this.parent.off(Wr,this.insertSheetTab),this.parent.off(Gr,this.removeSheetTab),this.parent.off(Yr,this.renameSheetTab),this.parent.off(zr,this.switchSheetTab),this.parent.off(Cn,this.updateSheetTab),this.parent.off(bn,this.renameInputFocusOut),this.parent.off(ft,this.removeAggregate),this.parent.off(Br,this.focusRenameInput),this.parent.off(Mr,this.focusRenameInput),this.parent.off(On,this.updateSheetName),this.parent.off(Dn,this.hideSheet),this.parent.off(mi,this.showAggregate))},e}(),Rs=function(){function e(e){this.parent=e,this.addEventListener(),this.renderFileUpload()}return e.prototype.addEventListener=function(){this.parent.on(gt,this.openSuccess,this),this.parent.on(mt,this.openFailed,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(gt,this.openSuccess),this.parent.off(mt,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",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;if(["UnsupportedFile","InvalidUrl"].indexOf(e.data)>-1)return this.parent.serviceLocator.getService(js).show({content:this.parent.serviceLocator.getService("spreadsheetLocale").getConstant(e.data),width:"300",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)}}),void this.parent.hideSpinner();this.parent.element&&(this.parent.trigger("openComplete",{response:e}),this.parent.notify(Wn,{response:e,action:"import"}),this.parent.renderModule.refreshSheet(),this.parent.notify(Ir,this),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}(),As=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(et,this.initiateSave,this),this.parent.on(tt,this.saveCompleted,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(et,this.initiateSave),this.parent.off(tt,this.saveCompleted))},e.prototype.getModuleName=function(){return"save"},e.prototype.initiateSave=function(e){this.parent.showSpinner()},e.prototype.saveCompleted=function(e){this.parent.hideSpinner()},e}(),Ts=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 n.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)},e)},e.prototype.beforeCloseHandler=function(e){this.parent.trigger("contextMenuBeforeClose",e)},e.prototype.selectHandler=function(e){var r=t.extend({cancel:!1},e);this.parent.trigger("contextMenuItemSelect",r);var n=this.parent.element.id+"_cmenu";if(!r.cancel){this.parent.serviceLocator.getService(Us);var i=void 0;switch(e.item.id){case n+"_cut":this.parent.notify("cut",{isAction:!0,promise:Promise});break;case n+"_copy":this.parent.notify("copy",{isAction:!0,promise:Promise});break;case n+"_paste":this.parent.notify(Zr,{isAction:!0});break;case n+"_pastevalues":this.parent.notify(Zr,{type:"Values",isAction:!0});break;case n+"_pasteformats":this.parent.notify(Zr,{type:"Formats",isAction:!0});break;case n+"_rename":this.parent.notify(Yr,{});break;case n+"_delete_sheet":this.parent.notify(Gr,{});break;case n+"_insert_sheet":this.parent.notify(Ht,{model:this.parent,start:this.parent.activeSheetIndex,end:this.parent.activeSheetIndex,modelType:"Sheet",isAction:!0});break;case n+"_hide_sheet":this.parent.notify(Dn,null);break;case n+"_ascending":this.parent.notify(xn,null);break;case n+"_descending":this.parent.notify(xn,{sortOptions:{sortDescriptors:{order:"Descending"}}});break;case n+"_customsort":this.parent.notify(Sn,null);break;case n+"_filtercellvalue":this.parent.notify(jn,null);break;case n+"_clearfilter":var o=m(c(this.parent.getActiveSheet().activeCell)[1]+1);this.parent.notify(qn,{field:o});break;case n+"_reapplyfilter":this.parent.notify(Un,null);break;case n+"_hide_row":i=d(this.parent.getActiveSheet().selectedRange),this.parent.notify(In,{startIndex:i[0],endIndex:i[2],hide:!0,isCol:!1,actionUpdate:!0}),this.parent.element.focus();break;case n+"_unhide_row":i=d(this.parent.getActiveSheet().selectedRange),this.parent.notify(In,{startIndex:i[0],endIndex:i[2],hide:!1,isCol:!1,actionUpdate:!0}),this.parent.element.focus();break;case n+"_hide_column":i=d(this.parent.getActiveSheet().selectedRange),this.parent.notify(In,{startIndex:i[1],endIndex:i[3],hide:!0,isCol:!0,actionUpdate:!0}),this.parent.element.focus();break;case n+"_unhide_column":i=d(this.parent.getActiveSheet().selectedRange),this.parent.notify(In,{startIndex:i[1],endIndex:i[3],hide:!1,isCol:!0,actionUpdate:!0}),this.parent.element.focus();break;case n+"_insert_row_above":case n+"_delete_row":i=d(this.parent.getActiveSheet().selectedRange),this.parent.notify(e.item.id.substr(n.length+1,6)+"Model",{model:this.parent.getActiveSheet(),start:i[0],end:i[2],modelType:"Row",isAction:!0}),this.parent.element.focus();break;case n+"_insert_row_below":i=S(d(this.parent.getActiveSheet().selectedRange)),this.parent.notify(Ht,{model:this.parent.getActiveSheet(),start:i[2]+1,end:i[2]+1+(i[2]-i[0]),modelType:"Row",isAction:!0}),this.parent.element.focus();break;case n+"_insert_column_before":case n+"_delete_column":i=d(this.parent.getActiveSheet().selectedRange),this.parent.notify(e.item.id.substr(n.length+1,6)+"Model",{model:this.parent.getActiveSheet(),start:i[1],end:i[3],modelType:"Column",isAction:!0}),this.parent.element.focus();break;case n+"_insert_column_after":i=S(d(this.parent.getActiveSheet().selectedRange)),this.parent.notify(Ht,{model:this.parent.getActiveSheet(),start:i[3]+1,end:i[3]+1+(i[3]-i[1]),modelType:"Column",isAction:!0}),this.parent.element.focus();break;case n+"_hyperlink":this.parent.notify(Rn,null);break;case n+"_editHyperlink":this.parent.notify(An,null);break;case n+"_openHyperlink":this.parent.notify(Tn,null);break;case n+"_removeHyperlink":this.parent.removeHyperlink(this.parent.getActiveSheet().selectedRange);break;case n+"_protect":var s=this.parent.getActiveSheet();s.isProtected=!s.isProtected;var a=void 0;a=!s.isProtected,this.parent.notify(ti,{isActive:a})}}},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=this.getTarget(e.event.target);e.element.classList.contains("e-contextmenu")?(r=this.getDataSource(n),this.contextMenuInstance.items=r,this.contextMenuInstance.dataBind()):r=e.items,this.parent.trigger("contextMenuBeforeOpen",e),this.parent.notify(zr,t.extend(e,{target:n,items:r}))},e.prototype.getTarget=function(e){return t.closest(e,".e-sheet-content")?"Content":t.closest(e,".e-column-header")?"ColumnHeader":t.closest(e,".e-row-header")?"RowHeader":t.closest(e,".e-sheet-tabs-items")?"Footer":t.closest(e,".e-selectall-container")?"SelectAll":""},e.prototype.getDataSource=function(e){var t=this.parent.serviceLocator.getService(Us),r=[],n=this.parent.element.id+"_cmenu";if("Content"===e)this.setClipboardData(r,t,n),r.push({separator:!0}),this.setFilterItems(r,n),this.setSortItems(r,n),r.push({separator:!0}),this.setHyperLink(r,n);else if("RowHeader"===e){this.setClipboardData(r,t,n);var i=d(this.parent.getActiveSheet().selectedRange);this.setInsertDeleteItems(r,t,"Row",n,[i[0],i[2]],["Above","Below"]),this.setHideShowItems(r,t,"Row",n,[i[0],i[2]])}else if("ColumnHeader"===e){this.setClipboardData(r,t,n);i=d(this.parent.getActiveSheet().selectedRange);this.setInsertDeleteItems(r,t,"Column",n,[i[1],i[3]],["Before","After"]),this.setHideShowItems(r,t,"Column",n,[i[1],i[3]])}else"SelectAll"===e?(this.setClipboardData(r,t,n),this.setFilterItems(r,n),this.setSortItems(r,n)):"Footer"===e&&(r.push({text:t.getConstant("Insert"),id:n+"_insert_sheet"}),r.push({text:t.getConstant("Delete"),iconCss:"e-icons e-delete",id:n+"_delete_sheet"}),r.push({text:t.getConstant("Rename"),id:n+"_rename"}),r.push({text:t.getConstant("Hide"),id:n+"_hide_sheet"}),this.setProtectSheetItems(r,n));return r},e.prototype.setProtectSheetItems=function(e,t){var r=this.parent.serviceLocator.getService(Us);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(Us),n={clearFilterText:null,isFiltered:!1};this.parent.notify(zn,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(Us);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){var r=this.parent.getActiveSheet();if(this.parent.allowHyperlink){var n=this.parent.serviceLocator.getService(Us);!document.activeElement.getElementsByClassName("e-hyperlink")[0]&&!document.activeElement.classList.contains("e-hyperlink")||r.isProtected&&!r.protectSettings.insertLink?e.push({text:n.getConstant("Hyperlink"),iconCss:"e-icons e-hyperlink-icon",id:t+"_hyperlink"}):e.push({text:n.getConstant("EditHyperlink"),iconCss:"e-icons e-edithyperlink-icon",id:t+"_editHyperlink"},{text:n.getConstant("OpenHyperlink"),iconCss:"e-icons e-openhyperlink-icon",id:t+"_openHyperlink"},{text:n.getConstant("RemoveHyperlink"),iconCss:"e-icons e-removehyperlink-icon",id:t+"_removeHyperlink"})}},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,o){e.push({separator:!0}),["Insert","Delete"].forEach(function(s){i[0]===i[1]?e.push({text:t.getConstant(""+s+r),id:n+"_"+s.toLowerCase()+"_"+r.toLowerCase()}):e.push({text:t.getConstant(""+s+r+"s"),id:n+"_"+s.toLowerCase()+"_"+r.toLowerCase()}),"Insert"===s&&(e[e.length-1].items=[],o.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){i[0]===i[1]?e.push({text:t.getConstant("Hide"+r),id:n+"_hide_"+r.toLowerCase()}):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(tn,this.addItemsHandler,this),this.parent.on(rn,this.removeItemsHandler,this),this.parent.on(nn,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(tn,this.addItemsHandler),this.parent.off(rn,this.removeItemsHandler),this.parent.off(nn,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.parent=null},e}(),Fs=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.refreshCellElement=function(e){var r=this.parent.getCell(e.rowIndex,e.colIndex);t.isNullOrUndefined(r)||this.parent.refreshNode(r,e)},e.prototype.addEventListener=function(){this.parent.on(it,this.refreshCellElement,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off(it,this.refreshCellElement)},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.getModuleName=function(){return"numberFormat"},e}(),Ns=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.applySortHandler,this),this.parent.on(St,this.sortCompleteHandler,this),this.parent.on(Sn,this.initiateCustomSortHandler,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(xn,this.applySortHandler),this.parent.off(St,this.sortCompleteHandler),this.parent.off(Sn,this.initiateCustomSortHandler))},e.prototype.getModuleName=function(){return"sort"},e.prototype.isValidSortRange=function(){var e=this.parent.getActiveSheet(),t=S(v(e.selectedRange));return!(t[0]>e.usedRange.rowIndex||t[1]>e.usedRange.colIndex)},e.prototype.sortRangeAlertHandler=function(e){var t=this;this.parent.serviceLocator.getService(js).show({height:180,width:400,isModal:!0,showCloseIcon:!0,content:e.error,beforeOpen:function(e){var r={dialogName:"SortRangeDialog",element:e.element,target:e.target,cancel:e.cancel};t.parent.trigger("dialogBeforeOpen",r),r.cancel&&(e.cancel=!0)}}),this.parent.hideSpinner()},e.prototype.initiateCustomSortHandler=function(){var e=this,r=this.parent.serviceLocator.getService(Us);if(this.isValidSortRange()){var n=this.parent.serviceLocator.getService(js);n.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),n.dialogInstance.content=e.customSortContent(),n.dialogInstance.dataBind(),e.parent.element.focus()},buttons:[{buttonModel:{content:r.getConstant("Ok"),isPrimary:!0},click:function(){var r=n.dialogInstance.content,i=r.getElementsByClassName("e-list-sort e-listview e-lib")[0],o=t.getComponent(i,"listview").dataSource;e.clearError();var s=r.getElementsByClassName("e-sort-error")[0];if(s.style.display="block",!e.validateError(o,r,s)){n.hide();var a=r.getElementsByClassName("e-sort-checkheader")[0],l=t.getComponent(a,"checkbox"),h=t.getComponent(r.getElementsByClassName("e-sort-checkcase")[0],"checkbox"),p=l.checked;e.applySortHandler({sortOptions:{sortDescriptors:o,containsHeader:p,caseSensitive:h.checked}})}}}]})}else this.sortRangeAlertHandler({error:r.getConstant("SortOutOfRangeError")})},e.prototype.validateError=function(e,r,n){var i=this.parent.serviceLocator.getService(Us);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 o=new Set,s="",a="";if(e.some(function(e){return s=e.field.toString(),o.size===o.add(e.field).size})){var l=0;return Array.prototype.some.call(r.getElementsByClassName("e-sort-field"),function(e){var r=t.getComponent(e,"dropdownlist");return r.value===s&&(e.parentElement.classList.add("e-error"),a=r.text,l++),2===l}),n.innerHTML="<strong>"+a+"</strong>"+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 o=this.parent.createElement("div",{className:"e-sort-listsection",styles:""});e.appendChild(o);var s=this.parent.createElement("div",{className:"e-list-sort",styles:""});o.appendChild(s),i.createElement=this.parent.createElement,i.appendTo(s),this.renderListItem(n,i,!0,r);var a=this.parent.createElement("div",{className:"e-sort-error"});return e.appendChild(a),e},e.prototype.getFields=function(){var e=this.parent.getActiveSheet(),t=S(v(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(Xn,r),r.hasFilter&&r.filterRange&&(t[0]=r.filterRange[0])}var n,i=[];for(t[1];t[1]<=t[3];t[1]++){var o=j(t[0],t[1],e);if(o&&o.value){var s={formattedText:o.value,value:o.value,format:o.format,onLoad:!0};o.format&&this.parent.notify(nt,s),n=s.formattedText}else n="Column "+m(t[1]+1);i.push({text:n,value:"Column "+m(t[1]+1)})}return i},e.prototype.setHeaderTab=function(e,r,n){var i=this,s=this.parent.serviceLocator.getService(Us),a=this.parent.createElement("div",{className:"e-sort-header",styles:"",innerHTML:""});e.appendChild(a);var l=this.parent.createElement("button",{className:"e-btn e-sort-addbtn e-flat",innerHTML:s.getConstant("AddColumn")}),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:s.getConstant("ThenBy"),field:"",order:"ascending"}]),i.renderListItem(e,r,p.checked,n,!0)}});var p=new o.CheckBox({label:s.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"}),d=this.parent.createElement("input",{className:"e-sort-checkheader",attrs:{type:"checkbox"}});a.appendChild(d),p.createElement=this.parent.createElement,p.appendTo(d);var c=new o.CheckBox({label:s.getConstant("CaseSensitive"),checked:!1,cssClass:"e-sort-casecheckbox"}),u=this.parent.createElement("input",{className:"e-sort-checkcase",attrs:{type:"checkbox"}});a.appendChild(u),c.createElement=this.parent.createElement,c.appendTo(u)},e.prototype.getCustomListview=function(e){var r=[{id:e,text:this.parent.serviceLocator.getService(Us).getConstant("SortBy"),field:"",order:"ascending"}];t.enableRipple(!1);return new a.ListView({dataSource:r,fields:{id:"id"},height:"100%",template:'<div class="e-sort-listwrapper"><span class="text">${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;">${order}</span></div><span class="e-icons e-sort-delete"></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(Us),h=t.element.querySelector("li[data-uid="+e+"]"),p=r?{text:"text",value:"value"}:{text:"value"},d=h.getElementsByClassName("e-sort-field")[0],c=new s.DropDownList({dataSource:n,width:"auto",cssClass:"e-sort-field-ddl",fields:p,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(d),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={range:e&&e.range||r.selectedRange,sortOptions:e&&e.sortOptions||{sortDescriptors:{}},cancel:!1};if(this.parent.trigger("beforeSort",n),!n.cancel){this.parent.notify(Gn,{eventArgs:n,action:"beforeSort"}),this.parent.showSpinner();var i=S(v(n.range)),o={filterRange:[],hasFilter:!1};i[0]===i[2]&&i[2]-i[0]==0&&(this.parent.notify(Xn,o),o.hasFilter&&o.filterRange&&(i[0]=o.filterRange[0],i[1]=0,i[2]=r.usedRange.rowIndex,i[3]=r.usedRange.colIndex,n.sortOptions.containsHeader=!0)),this.parent.sort(n.sortOptions,g(i)).then(function(e){return t.parent.trigger(St,e),t.parent.notify(Wn,{eventArgs:e,action:"sorting"}),Promise.resolve(e)}).catch(function(e){return t.sortRangeAlertHandler({error:e}),Promise.reject(e)})}},e.prototype.sortCompleteHandler=function(e){var t=v(e.range);e.sortOptions.containsHeader&&(t[0]+=1),this.parent.serviceLocator.getService("cell").refreshRange(t),this.parent.hideSpinner()},e}(),Os=function(){function e(e){this.parent=e,this.filterCollection=new Map,this.filterClassList=new Map,this.filterRange=new Map,this.addEventListener()}return e.prototype.destroy=function(){this.removeEventListener(),this.filterRange=null,this.filterCollection=null,this.filterClassList=null,this.parent=null},e.prototype.addEventListener=function(){this.parent.on(Tt,this.filterRangeAlertHandler,this),this.parent.on(Pn,this.initiateFilterUIHandler,this),this.parent.on(Ar,this.filterMouseDownHandler,this),this.parent.on(Vn,this.renderFilterCellHandler,this),this.parent.on(Ft,this.clearAllFilterHandler,this),this.parent.on(p.beforeFltrcMenuOpen,this.beforeFilterMenuOpenHandler,this),this.parent.on(p.beforeCustomFilterOpen,this.beforeCustomFilterOpenHandler,this),this.parent.on(Un,this.reapplyFilterHandler,this),this.parent.on(jn,this.filterByCellValueHandler,this),this.parent.on(qn,this.clearFilterHandler,this),this.parent.on(zn,this.getFilteredColumnHandler,this),this.parent.on(zr,this.cMenuBeforeOpenHandler,this),this.parent.on(p.filterCboxValue,this.filterCboxValueHandler,this),this.parent.on(Xn,this.getFilterRangeHandler,this),this.parent.on(Yn,this.filterCellKeyDownHandler,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(Tt,this.filterRangeAlertHandler),this.parent.off(Pn,this.initiateFilterUIHandler),this.parent.off(Ar,this.filterMouseDownHandler),this.parent.off(Vn,this.renderFilterCellHandler),this.parent.off(Ft,this.clearAllFilterHandler),this.parent.off(p.beforeFltrcMenuOpen,this.beforeFilterMenuOpenHandler),this.parent.off(p.beforeCustomFilterOpen,this.beforeCustomFilterOpenHandler),this.parent.off(Un,this.reapplyFilterHandler),this.parent.off(jn,this.filterByCellValueHandler),this.parent.off(qn,this.clearFilterHandler),this.parent.off(zn,this.getFilteredColumnHandler),this.parent.off(zr,this.cMenuBeforeOpenHandler),this.parent.on(p.filterCboxValue,this.filterCboxValueHandler),this.parent.off(Xn,this.getFilterRangeHandler),this.parent.off(Yn,this.filterCellKeyDownHandler))},e.prototype.getModuleName=function(){return"filter"},e.prototype.isInValidFilterRange=function(e){var t=S(v(e.selectedRange));return t[0]>e.usedRange.rowIndex||t[1]>e.usedRange.colIndex},e.prototype.filterRangeAlertHandler=function(e){var t=this;this.parent.serviceLocator.getService(js).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)}}),this.parent.hideSpinner()},e.prototype.beforeFilterMenuOpenHandler=function(e){var t=this.parent.serviceLocator.getService(Us);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.innerHTML=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=this.parent.activeSheetIndex;if(!(this.filterRange.size>0&&this.filterRange.has(i))||(this.removeFilter(i),n)){var o=de(this.parent,i);if(this.isInValidFilterRange(o)){var s=this.parent.serviceLocator.getService(Us);this.filterRangeAlertHandler({error:s.getConstant("FilterOutOfRangeError")})}else if(this.processRange(o,i,e?e.range:null),n){var a=this.filterRange.get(i).slice();a[0]=a[0]+1,a[2]=o.usedRange.rowIndex,G(this.parent,o.name+"!"+g(a),!0,!0).then(function(e){t.filterSuccessHandler(new r.DataManager(e),{action:"filtering",filterCollection:n,field:n[0].field}),n.forEach(function(e){t.filterClassList.get(i)[e.field].indexOf(" e-filtered")<0&&(t.filterClassList.get(i)[e.field]+=" e-filtered")}),t.refreshFilterRange()})}}},e.prototype.processRange=function(e,t,r){var n=S(v(r||e.selectedRange));n[0]===n[2]&&n[2]-n[0]==0&&(n[0]=0,n[1]=0,n[2]=e.usedRange.rowIndex,n[3]=e.usedRange.colIndex),this.filterRange.set(t,n),this.filterCollection.set(t,[]),this.filterClassList.set(t,{}),this.refreshFilterRange(n)},e.prototype.removeFilter=function(e){this.filterCollection.get(e).length&&this.parent.clearFilter();var t=this.filterRange.get(e).slice();this.filterRange.delete(e),this.filterCollection.delete(e),this.filterClassList.delete(e),this.refreshFilterRange(t,!0)},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(Us);this.filterRangeAlertHandler({error:i.getConstant("FilterOutOfRangeError")})}else{var o=c(n.activeCell);this.isFilterRange(t,o[0],o[1])||this.processRange(n,t);var s=this.filterRange.get(t).slice();s[0]=s[0]+1,s[2]=n.usedRange.rowIndex;var a=m(o[1]+1),l=this.getColumnType(n,o[1]+1,s),h=[{field:a,operator:"date"===l||"datetime"===l||"boolean"===l?"equal":"contains",value:j(o[0],o[1],n).value,matchCase:!1,type:l}];G(this.parent,n.name+"!"+g(s),!0,!0).then(function(t){e.filterSuccessHandler(new r.DataManager(t),{action:"filtering",filterCollection:h,field:a})})}},e.prototype.renderFilterCellHandler=function(e){var r=this.parent.activeSheetIndex;if(this.filterRange.has(r)&&this.isFilterCell(r,e.rowIndex,e.colIndex)){if(!e.td)return;var n=m(e.colIndex+1);if(this.filterClassList.has(r)&&!this.filterClassList.get(r)[n]&&(this.filterClassList.get(r)[n]=""),e.td.querySelector(".e-filter-btn")){var i=e.td.querySelector(".e-filter-iconbtn");(a=t.getComponent(i,"btn")).iconCss="e-icons e-filter-icon"+this.filterClassList.get(r)[n]}else{var s=this.parent.createElement("div",{className:"e-filter-btn"}),a=new o.Button({iconCss:"e-icons e-filter-icon"+this.filterClassList.get(r)[n],cssClass:"e-filter-iconbtn"});e.td.insertBefore(s,e.td.firstChild),a.createElement=this.parent.createElement,a.appendTo(s)}}},e.prototype.refreshFilterRange=function(e,t){for(var r=e||this.filterRange.get(this.parent.activeSheetIndex).slice(),n=r[1];n<=r[3];n++){var i=this.parent.getCell(r[0],n);if(t){if(i.hasChildNodes()){var o=i.querySelector(".e-filter-btn");i.removeChild(o)}}else this.renderFilterCellHandler({td:i,rowIndex:r[0],colIndex:n})}},e.prototype.isFilterCell=function(e,t,r){var n=this.filterRange.get(e);return n&&n[0]===t&&n[1]<=r&&n[3]>=r},e.prototype.isFilterRange=function(e,t,r){var n=this.filterRange.get(e);return n&&n[0]<=t&&n[2]>=t&&n[1]<=r&&n[3]>=r},e.prototype.getFilteredColumnHandler=function(e){var t=this.parent.activeSheetIndex,r=this.parent.serviceLocator.getService(Us);if(e.clearFilterText=r.getConstant("ClearFilter"),this.filterRange.has(t)){var n=this.filterCollection.get(t);if(e.isClearAll)return void(e.isFiltered=n&&n.length>0);var i=this.filterRange.get(t).slice(),o=this.parent.getActiveSheet(),s=c(o.activeCell);if(this.isFilterRange(t,s[0],s[1])){e.field=m(s[1]+1);var a=j(i[0],s[1],o),l=this.parent.getDisplayText(a);e.clearFilterText=r.getConstant("ClearFilterFrom")+'"'+(l?l.toString():"Column "+e.field)+'"',n.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=this.parent.element.querySelector(".e-filter-popup"),r=t.getComponent(e,"dialog");r&&r.hide()},e.prototype.isPopupOpened=function(){var e=this.parent.element.querySelector(".e-filter-popup");return e&&"none"!==e.style.display},e.prototype.filterCellKeyDownHandler=function(e){var t=this.parent.activeSheetIndex,r=this.parent.getActiveSheet(),n=c(r.activeCell);if(this.isFilterCell(t,n[0],n[1])){e.isFilterCell=!0;var i=Ie(r,n),o=this.parent.getCell(n[0],n[1]);this.isPopupOpened()&&this.closeDialog(),this.openDialog(o,i.left,i.top)}else e.isFilterCell=!1},e.prototype.filterMouseDownHandler=function(e){var t=e.target;if(t.classList.contains("e-filter-icon")){if(this.isPopupOpened())return void this.closeDialog();this.openDialog(t,e.x,e.y)}else this.isPopupOpened()&&(t.classList.contains("e-searchinput")||t.classList.contains("e-searchclear")||!t.offsetParent||t.offsetParent.classList.contains("e-filter-popup")?this.selectSortItemHandler(t):this.closeDialog())},e.prototype.openDialog=function(e,t,n){var i=this,o=p.parentsUntil(e,"e-cell"),s=parseInt(o.getAttribute("aria-colindex"),10),a=m(s);this.parent.showSpinner();var l=this.parent.activeSheetIndex,h=this.filterRange.get(l).slice(),d=this.parent.getActiveSheet(),c=j(h[0],s-1,d),u=this.parent.getDisplayText(c);h[0]=h[0]+1,h[2]=d.usedRange.rowIndex,G(this.parent,d.name+"!"+g(h),!0,!0).then(function(o){var c;o.some(function(e,t){return e&&(c=new r.DataManager(o.slice(t))),!!e});var f={type:i.getColumnType(d,s,h),field:a,displayName:u||"Column "+a,dataSource:c,height:i.parent.element.classList.contains("e-bigger")?800:500,columns:[],hideSearchbox:!1,filteredColumns:i.filterCollection.get(l),column:{field:a,filter:{}},handler:i.filterSuccessHandler.bind(i,new r.DataManager(o)),target:e,position:{X:t,Y:n},localeObj:i.parent.serviceLocator.getService(Us)};new p.ExcelFilterBase(i.parent,i.getLocalizedCustomOperators()).openDialog(f),i.parent.hideSpinner()})},e.prototype.filterCboxValueHandler=function(e){if(e.column&&e.data){var t=c(e.column.field+e.data.dataObj.__rowIndex),r=j(t[0],t[1],this.parent.getActiveSheet());r&&r.format&&(e.value=this.parent.getDisplayText(r))}},e.prototype.selectSortItemHandler=function(e){var t=e.classList.contains("e-filter-sortasc")?"Ascending":e.classList.contains("e-filter-sortdesc")?"Descending":null;if(t){var r=this.parent.getActiveSheet(),n=this.parent.activeSheetIndex,i=this.filterRange.get(n).slice();i[0]=i[0]+1,i[2]=r.usedRange.rowIndex,this.parent.notify(xn,{sortOptions:{sortDescriptors:{order:t}},range:g(i)});for(var o=m(v(r.activeCell)[1]+1),s=0,a=Object.keys(this.filterClassList.get(n));s<a.length;s++){var l=a[s],h=this.filterClassList.get(n)[l].replace(/\se-sortasc-filter|\se-sortdesc-filter/gi,"");l===o&&(h+="Ascending"===t?" e-sortasc-filter":" e-sortdesc-filter"),this.filterClassList.get(n)[l]=h}this.refreshFilterRange(),this.closeDialog()}},e.prototype.filterSuccessHandler=function(e,t){for(var n=this.parent.activeSheetIndex,i=this.filterCollection.get(n),o=new r.DataManager(i),s=new r.Query,a=o.executeLocal(s.where("field","equal",t.field)),l=0;l<a.length;l++){for(var h=-1,p=0;p<i.length;p++)if(i[p].field===a[l].field){h=p;break}-1!==h&&i.splice(h,1)}"filtering"===t.action?(i=i.concat(t.filterCollection)).length&&this.filterClassList.get(n)[t.field].indexOf(" e-filtered")<0&&(this.filterClassList.get(n)[t.field]+=" e-filtered"):this.filterClassList.get(n)[t.field]=this.filterClassList.get(n)[t.field].replace(" e-filtered",""),this.filterCollection.set(n,i);var d={datasource:e,predicates:this.getPredicates(n)};this.filterRange.get(n)[2]=de(this.parent,n).usedRange.rowIndex,this.applyFilter(d,g(this.filterRange.get(n)))},e.prototype.applyFilter=function(e,t){var r=this,n={range:t,filterOptions:e,cancel:!1};this.parent.trigger("beforeFilter",n),n.cancel||(this.parent.showSpinner(),this.parent.filter(e,t).then(function(e){return r.refreshFilterRange(),r.parent.hideSpinner(),r.parent.trigger(At,e),Promise.resolve(e)}).catch(function(e){return r.filterRangeAlertHandler({error:e}),Promise.reject(e)}))},e.prototype.getPredicates=function(e){for(var t=[],r=p.CheckBoxFilterBase.getPredicate(this.filterCollection.get(e)),n=0,i=Object.keys(r);n<i.length;n++){var o=i[n];t.push(r[o])}return t},e.prototype.getColumnType=function(e,t,r){for(var n=0,i=0,o=0,s=r[0];s<=e.usedRange.rowIndex;s++){var a=j(s,t-1,e);if(a)if(a.format){switch(D(a.format).toLowerCase()){case"number":case"currency":case"accounting":case"percentage":n++;break;case"shortdate":case"longdate":o++;break;case"time":n++;break;default:i++}}else"string"==typeof a.value?i++:n++;else i++}return n>i&&n>o&&n>0?"number":i>n&&i>o&&i>0?"string":o>n&&o>i&&o>0?"date":"datetime"},e.prototype.beforeCustomFilterOpenHandler=function(){this.closeDialog()},e.prototype.clearAllFilterHandler=function(){if(this.filterRange.has(this.parent.activeSheetIndex)){this.filterCollection.set(this.parent.activeSheetIndex,[]);for(var e=0,t=Object.keys(this.filterClassList.get(this.parent.activeSheetIndex));e<t.length;e++){var r=t[e];this.filterClassList.get(this.parent.activeSheetIndex)[r]=""}this.refreshFilterRange()}},e.prototype.clearFilterHandler=function(e){this.filterSuccessHandler(null,{action:"clear-filter",filterCollection:[],field:e.field})},e.prototype.reapplyFilterHandler=function(){var e=this.parent.activeSheetIndex;this.filterRange.has(e)&&this.applyFilter({predicates:this.getPredicates(e)},g(this.filterRange.get(e)))},e.prototype.getFilterRangeHandler=function(e){var t=e.sheetIdx||this.parent.activeSheetIndex;this.filterRange&&this.filterRange.has(t)?(e.hasFilter=!0,e.filterRange=this.filterRange.get(t)):(e.hasFilter=!1,e.filterRange=null)},e.prototype.getLocalizedCustomOperators=function(){var e=this.parent.serviceLocator.getService(Us),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:"notequal",text:e.getConstant("NotEqual")}],numberOperator:t,dateOperator:t,datetimeOperator:t,booleanOperator:[{value:"equal",text:e.getConstant("Equal")},{value:"notequal",text:e.getConstant("NotEqual")}]}},e}(),Ds=function(){function e(e){this.pictureCount=1,this.parent=e,this.addEventListener(),this.renderImageUpload()}return e.prototype.addEventListener=function(){this.parent.on(Ti,this.insertImage,this),this.parent.on(Fi,this.refreshImgElem,this),this.parent.on(Ni,this.refreshImgCellObj,this),this.parent.on(Li,this.createImageElement,this),this.parent.on(Hi,this.deleteImage,this),this.parent.on(Bi,this.refreshInsDelImagePosition,this)},e.prototype.renderImageUpload=function(){var e=this.parent.element.id+"_imageUpload";this.parent.element.appendChild(this.parent.createElement("input",{id:e,attrs:{type:"file",accept:".image, .jpg, .png, .gif ,jpeg",name:"fileUpload"}}));var t=document.getElementById(e);t.onchange=this.imageSelect.bind(this),t.style.display="none"},e.prototype.imageSelect=function(e){var t=e.target.files[0];if(!(t&&t.length<1)){var r={file:t};0===r.file.type.indexOf("image")?this.insertImage(r):this.parent.serviceLocator.getService(js).show({content:this.parent.serviceLocator.getService("spreadsheetLocale").getConstant("UnsupportedFile"),width:"300"}),document.getElementById(this.parent.element.id+"_imageUpload").value=""}},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(Ti,this.insertImage),this.parent.off(Ni,this.refreshImgCellObj),this.parent.off(Li,this.createImageElement),this.parent.off(Hi,this.deleteImage),this.parent.off(Bi,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 t=e.range?e.range.indexOf("!")>0?e.range.split("!")[1]:e.range.split("!")[0]:this.parent.getActiveSheet().selectedRange,r=e.range&&e.range.indexOf("!")>0?se(this.parent,e.range.split("!")[0]):this.parent.activeSheetIndex,n=this.parent.serviceLocator.getService(qs),i=e.options.imageId?e.options.imageId:this.parent.element.id+"_overlay_picture_"+this.pictureCount,o=d(t),s=r?this.parent.sheets[r]:this.parent.getActiveSheet();if(!document.getElementById(i)){var a={requestType:"beforeInsertImage",range:s.name+"!"+t,imageData:e.options.src,sheetIndex:r};if(e.isPublic&&this.parent.notify("actionBegin",{eventArgs:a,action:"beforeInsertImage"}),!a.cancel){var l=n.insertOverlayElement(i,t,r);l.style.backgroundImage="url('"+e.options.src+"')",(e.options.height||e.options.left)&&(l.style.height=e.options.height+"px",l.style.width=e.options.width+"px",l.style.top=e.options.top+"px",l.style.left=e.options.left+"px"),e.options.imageId||this.pictureCount++;var h={src:e.options.src,id:i,height:parseFloat(l.style.height.replace("px","")),width:parseFloat(l.style.width.replace("px","")),top:parseFloat(l.style.top.replace("px","")),left:parseFloat(l.style.left.replace("px",""))};this.parent.setUsedRange(o[0],o[1]),(e.isPublic||e.isUndoRedo)&&this.parent.notify(yr,{options:[h],range:s.name+"!"+t});var p=j(o[0],o[1],s);p.image[p.image.length-1].id||(p.image[p.image.length-1].id=h.id),a={requestType:"insertImage",range:s.name+"!"+t,imageHeight:e.options.height?e.options.height:300,imageWidth:e.options.width?e.options.width:400,imageData:e.options.src,id:i,sheetIndex:r},!e.isUndoRedo&&e.isPublic&&this.parent.notify("actionComplete",{eventArgs:a,action:"insertImage"})}}},e.prototype.refreshImgElem=function(){var e=document.getElementsByClassName("e-ss-overlay-active")[0];e&&t.removeClass([e],"e-ss-overlay-active")},e.prototype.refreshInsDelImagePosition=function(e){for(var t,r,n,i=e.count,o=e.sheetIdx,s=this.parent.sheets[o],a=j(e.rowIdx,e.colIdx,s),l=a.image.length,h=0;h<l;h++)t=document.getElementById(a.image[h].id),r="Row"===e.type?"insert"===e.status?a.image[h].top+20*i:a.image[h].top-20*i:a.image[h].top,n="Column"===e.type?"insert"===e.status?a.image[h].left+64*i:a.image[h].left-64*i:a.image[h].left,a.image[h].top=r,a.image[h].left=n,t.style.top=r+"px",t.style.left=n+"px"},e.prototype.refreshImgCellObj=function(e){var t={clientY:e.prevTop,isImage:!0};this.parent.notify(Oi,t);var r={clientY:e.currentTop,isImage:!0};this.parent.notify(Oi,r);var n={clientX:e.prevLeft,isImage:!0};this.parent.notify(Di,n);var i={clientX:e.currentLeft,isImage:!0};this.parent.notify(Di,i);var o,s,a=this.parent.sheets[this.parent.activeSheetIndex],l=j(t.clientY,n.clientX,a),h=j(r.clientY,i.clientX,a),p=l?l.image:[],d=p&&p.length?p.length:0;if(l&&l.image){for(var c=0;c<d;c++)p[c].id===e.id&&((o=p[c]).height=e.currentHeight,o.width=e.currentWidth,o.top=e.currentTop,o.left=e.currentLeft,p.splice(c,1));if(h&&h.image&&(s=h.image,o&&s.push(o)),q(r.clientY,i.clientX,a,s?{image:s}:{image:[o]},!0),"imageRefresh"===e.requestType&&!e.isUndoRedo){var u={requestType:"imageRefresh",currentRowIdx:r.clientY,currentColIdx:i.clientX,prevRowIdx:t.clientY,prevColIdx:n.clientX,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:u,action:"imageRefresh"})}}},e.prototype.deleteImage=function(e){var t,r,n,i,o,s=document.getElementById(e.id);if(s){var a={clientY:s.offsetTop,isImage:!0};this.parent.notify(Oi,a);var l={clientX:s.offsetLeft,isImage:!0};this.parent.notify(Di,l),document.getElementById(e.id).remove(),r=a.clientY,n=l.clientX,t=this.parent.sheets[this.parent.activeSheetIndex]}else{var h=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?se(this.parent,e.range.split("!")[0]):this.parent.activeSheetIndex,c=d(h);r=c[0],n=c[1],t=this.parent.sheets[p]}o=(i=j(r,n,t).image).length;for(var u=0;u<o;u++)i[u].id===e.id&&i.splice(u,1);q(r,n,t,{image:i},!0)},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.getModuleName=function(){return"spreadsheetImage"},e}(),Ls=function(){function e(){ra.Inject(ws,Is,ks,Jo,$o,es,ts,Ko,br,Rs,Ts,As,Fs,rs,Es,Ns,is,as,ns,Os,ss,ls,hs,ps,cs,ds,us,fs,gs,Ds)}return e.prototype.getModuleName=function(){return"basic"},e.prototype.destroy=function(){},e}(),Hs=function(){function e(){ra.Inject(ws,Is,ks,Jo,$o,es,ts,Ko,br,Rs,As,Fs,rs,Es,Ns,ns,is,as,Os,ss,ls,hs,ps,ds,cs,us,fs,Ds,gs)}return e.prototype.getModuleName=function(){return"all"},e.prototype.destroy=function(){},e}(),Bs=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)}}(),Ms=function(e,t,r,n){var i,o=arguments.length,s=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,r,s):i(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},_s=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return Bs(r,e),Ms([t.Property(!1)],r.prototype,"isFinite",void 0),Ms([t.Property(!0)],r.prototype,"enableVirtualization",void 0),r}(t.ChildProperty),Ps=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return Bs(r,e),Ms([t.Property("Multiple")],r.prototype,"mode",void 0),r}(t.ChildProperty),Vs="e-wraptext",Us="spreadsheetLocale",js="dialog",qs="shape",zs={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"]},Ws={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"]},Gs={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 exact cell contents",Replace:"Replace...",Find:"Find and Replace...",Goto:"Goto...",EntercellAddress:"Enter cell address",GotoSpecial:"GotoSpecial...",FindAndReplace:"Find and Replace",FindNextBtn:"Find Next",FindPreviousBtn:"Find Previous",ReplaceBtn:"Replace",ReplaceAllBtn:"Replace All",GotoHeader:"Go To",GotoSpecialHeader:"Go To Special",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",SpreadsheetHyperlink:"SpreadsheetHyperlink",Hyperlink:"Hyperlink",EditHyperlink:"Edit Hyperlink",OpenHyperlink:"Open Hyperlink",RemoveHyperlink:"Remove Hyperlink",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?",PasteMergeAlert:'We can"t do that to a merge cell.',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",Rename:"Rename",Hide:"Hide",Unhide:"Unhide",NameBox:"Name Box",ShowHeaders:"Show Headers",HideHeaders:"Hide Headers",ShowGridLines:"Show Gridlines",HideGridLines:"Hide Gridlines",AddSheet:"Add Sheet",ListAllSheets:"List All Sheets",FullScreen:"Full Screen",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:"Sort criteria column should not be empty.",SortDuplicateFieldError:" is mentioned more than once. Duplicate columns must be removed.",SortOutOfRangeError:"Select a cell or range inside the used 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",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",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",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.",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",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.",SLOPE:"Returns the slope of the line from linear regression of the data points.",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.",ShowRowsWhere:"Show rows where:",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",EndsWith:"Ends With",StartsWith:"Starts With",ClearButton:"Clear",FilterButton:"Filter",CancelButton:"Cancel",OKButton:"OK",Search:"Search",ProtectSheet:"Protect Sheet",UnprotectSheet:"Unprotect Sheet",LockCells:"Lock Cells",SelectCells:"Select 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",CLEARALL:"CLEAR ALL",APPLY:"APPLY",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",Greaterthan:"Greater than",Lessthan:"Less than",GreaterThanOrEqualTo:"Greater than or equal to",LessThanOrEqualTo:"Less than or equal to",InCellDropDown:"In-cell-dropdown",Sources:"Sources",Value:"Value",Retry:"Retry",EnterValue:"Enter value",DialogError:"The list source must be a reference to single row or column.",ListLengthError:"The list values allows only upto 256 charcters",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",ADateOccuring:"A Date Occuring",DuplicateValues:"Duplicate Values",TopBottomRules:"Top/Bottom Rules",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:"ClearRules",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"},Ys=function(){function e(e){this.freezePane=!1,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;if(this.freezePane){var t=this.getSelectAllTable().querySelector("thead"),r=this.rowRenderer.render();t.appendChild(r),e=this.parent.createElement("th",{className:"e-select-all-cell"}),r.appendChild(e)}else(e=this.headerPanel.firstElementChild).classList.add("e-select-all-cell");e.appendChild(this.parent.createElement("button",{className:"e-selectall e-icons",id:this.parent.element.id+"_select_all"}))},e.prototype.updateLeftColGroup=function(e,t){e&&(this.colGroupWidth=e),t||(t=this.getRowHeaderPanel());var r=t.querySelector("table");this.detachColGroup(r);var n=this.parent.createElement("colgroup"),i=this.colGroupWidth+"px",o=this.col.cloneNode();o.style.width=i,n.appendChild(o),r.insertBefore(n,r.querySelector("tbody")),t.style.width=i,this.freezePane?(r=this.getSelectAllTable(),this.detachColGroup(r),r.insertBefore(n.cloneNode(!0),r.querySelector("thead"))):this.getSelectAllContent().style.width=i,this.parent.getActiveSheet().showHeaders&&(this.getColHeaderPanel().style.width="calc(100% - "+i+")",this.getContentPanel().style.width="calc(100% - "+i+")")},e.prototype.detachColGroup=function(e){var r=e.querySelector("colgroup");r&&t.detach(r)},e.prototype.renderPanel=function(){this.contentPanel=this.parent.createElement("div",{className:"e-main-panel"});var e=this.parent.getActiveSheet(),t=this.parent.element.id;e.showHeaders?(this.contentPanel.appendChild(this.parent.createElement("div",{className:"e-row-header",id:t+"_row_header"})),this.initHeaderPanel(),this.parent.allowScrolling&&this.parent.scrollModule.setPadding()):this.updateHideHeaders();var r=this.contentPanel.appendChild(this.parent.createElement("div",{className:"e-sheet-content",id:t+"_main_content"}));e.showGridLines||r.classList.add("e-hide-gridlines"),this.parent.allowScrolling||(r.style.overflow="hidden")},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.createTable=function(){this.parent.getActiveSheet().showHeaders&&this.createHeaderTable(),this.updateTable("tbody","content",this.contentPanel.lastElementChild)},e.prototype.createHeaderTable=function(e){void 0===e&&(e=this.contentPanel.querySelector(".e-row-header")),this.freezePane&&this.updateTable("thead","selectall",this.headerPanel.querySelector(".e-selectall-container")),this.updateTable("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.parent.createElement("table",{className:"e-table",attrs:{role:"grid"}});n.classList.add("e-"+t+"-table"),r.appendChild(n),n.appendChild(this.parent.createElement(e))},e.prototype.renderTable=function(e){var r,n,i,o=this,s=this.parent.getActiveSheet(),a=document.createDocumentFragment();this.createTable();var l,h,p,c=this.parent.createElement("colgroup"),u=this.contentPanel.querySelector(".e-sheet-content tbody");s.showHeaders&&(a.appendChild(this.headerPanel),this.refreshSelectALLContent(),l=this.contentPanel.querySelector(".e-row-header tbody"),h=this.headerPanel.querySelector(".e-column-header thead"),this.getColHeaderTable().insertBefore(c,h),p=this.rowRenderer.render(),h.appendChild(p)),a.appendChild(this.contentPanel),this.parent.notify(_r,{startColIdx:e.indexes[1]});var f=s.colCount.toString(),g=s.colCount.toString(),m=e.top&&e.left?"RowColumn":e.top?"Row":e.left?"Column":"";s.showHeaders&&(this.parent.getColHeaderTable().setAttribute("aria-colcount",f),this.parent.getRowHeaderTable().setAttribute("aria-rowcount",g)),t.attributes(this.parent.getContentTable(),{"aria-rowcount":g,"aria-colcount":f}),e.cells.forEach(function(t,a){(r=d(a))[1]===e.indexes[1]&&(s.showHeaders&&(i=o.rowRenderer.render(r[0],!0),l.appendChild(i),i.appendChild(o.cellRenderer.renderRowHeader(r[0]))),n=o.rowRenderer.render(r[0]),u.appendChild(n)),n.appendChild(o.cellRenderer.render({colIdx:r[1],rowIdx:r[0],cell:t,address:a,lastCell:r[1]===e.indexes[3],isHeightCheckNeeded:!0,row:n,hRow:i,pRow:n.previousSibling,pHRow:s.showHeaders?i.previousSibling:null,first:m?m.includes("Row")?r[0]===e.indexes[0]?"Row":m.includes("Column")&&r[1]===e.indexes[1]?"Column":"":r[1]===e.indexes[1]?"Column":"":""})),r[0]===e.indexes[0]&&(o.updateCol(s,r[1],c),s.showHeaders&&p.appendChild(o.cellRenderer.renderColHeader(r[1])))}),this.getContentTable().insertBefore(c.cloneNode(!0),u),ve(function(){var t=o.parent.getMainContent();if(document.getElementById(o.parent.element.id+"_sheet").appendChild(a),e.top&&(t.scrollTop=e.top,s.showHeaders&&(o.parent.getRowHeaderContent().scrollTop=e.top)),e.left&&(t.scrollLeft=e.left,s.showHeaders&&(o.parent.getColumnHeaderContent().scrollLeft=e.left)),o.parent.notify(Rr,null),o.parent.notify(Fr,{action:"renderEditor"}),e.initLoad||o.parent.isOpen||o.parent.hideSpinner(),He(o.parent.getMainContent(),{busy:!1}),o.parent.trigger("dataBound",{}),o.parent.isEdit&&o.parent.notify(ki,null),e.initLoad){var r=!0;if(o.parent.scrollSettings.enableVirtualization)for(var n=0;n<s.ranges.length;n++)if(s.ranges[n].info.count-1>o.parent.viewport.bottomIndex){r=!1;break}r&&o.triggerCreatedEvent()}})},e.prototype.triggerCreatedEvent=function(){this.parent.isOpen||this.parent.hideSpinner(),this.parent.createdHandler&&(this.parent.createdHandler.observers?this.parent[ai].observers=this.parent.createdHandler.observers:this.parent.setProperties({created:this.parent.createdHandler},!0),this.parent.createdHandler=void 0,this.parent.trigger(ai,null))},e.prototype.refreshColumnContent=function(e){var t,r,n,i,o=this,s=0,a=this.parent.getActiveSheet(),l=document.createDocumentFragment(),h=document.createDocumentFragment(),p=this.parent.element.querySelector(".e-sheet-content tbody");p=l.appendChild(p.cloneNode(!0));var c=this.parent.element.querySelector(".e-sheet-content colgroup");c=c.cloneNode();var u,f;a.showHeaders&&(h.appendChild(c),f=this.parent.element.querySelector(".e-column-header thead"),f=h.appendChild(f.cloneNode(!0)),(u=f.querySelector("tr")).innerHTML=""),e.cells.forEach(function(n,l){if((t=d(l))[0]===e.indexes[0]&&(o.updateCol(a,t[1],c),a.showHeaders&&u.appendChild(o.cellRenderer.renderColHeader(t[1]))),t[1]===e.indexes[1]){if(!(r=p.children[s]))return;r.innerHTML="",s++}i=r.appendChild(o.cellRenderer.render({colIdx:t[1],rowIdx:t[0],cell:n,address:l,row:r,pRow:r.previousSibling,first:e.skipUpdateOnFirst||t[1]!==e.indexes[1]?o.parent.scrollSettings.enableVirtualization&&t[0]===e.indexes[0]&&o.parent.viewport.topIndex!==Xe(a,0,!0)?"Row":"":"Column"})),o.checkColMerge(t,e.indexes,i,n)}),l.insertBefore(c.cloneNode(!0),p),ve(function(){a.showHeaders&&(ye(n=o.getColHeaderTable()),n.appendChild(h)),ye(n=o.getContentTable()),n.appendChild(l),o.parent.notify(Vr,{refresh:"Column"}),o.parent.isOpen||o.parent.hideSpinner(),He(o.parent.getMainContent(),{busy:!1})})},e.prototype.refreshRowContent=function(e){var r,n,i,o,s,a,l=this,h=this.colGroupWidth,p=this.parent.getActiveSheet(),c=document.createDocumentFragment(),u=this.parent.createElement("tbody");p.showHeaders&&(o=document.createDocumentFragment(),s=u.cloneNode(),o.appendChild(s)),c.appendChild(u),e.cells.forEach(function(t,o){(r=d(o))[1]===e.indexes[1]&&(p.showHeaders&&(i=l.rowRenderer.render(r[0],!0),s.appendChild(i),i.appendChild(l.cellRenderer.renderRowHeader(r[0])),h=Ce(r[0]+1)),n=l.rowRenderer.render(r[0]),u.appendChild(n)),a=n.appendChild(l.cellRenderer.render({rowIdx:r[0],colIdx:r[1],cell:t,address:o,lastCell:r[1]===e.indexes[3],row:n,hRow:i,pRow:n.previousSibling,pHRow:p.showHeaders?i.previousSibling:null,isHeightCheckNeeded:!0,first:e.skipUpdateOnFirst||r[0]!==e.indexes[0]?l.parent.scrollSettings.enableVirtualization&&r[1]===e.indexes[1]&&l.parent.viewport.leftIndex!==Xe(p,0,!0,"columns")?"Column":"":"Row"})),l.checkRowMerge(r,e.indexes,a,t)}),this.colGroupWidth!==h&&this.updateLeftColGroup(h),p.showHeaders&&(t.detach(this.contentPanel.querySelector(".e-row-header tbody")),this.getRowHeaderTable().appendChild(o)),t.detach(this.contentPanel.querySelector(".e-sheet-content tbody")),this.getContentTable().appendChild(c),this.parent.notify(Vr,{refresh:"Row"}),this.parent.isOpen||this.parent.hideSpinner(),He(this.parent.getMainContent(),{busy:!1})},e.prototype.updateCol=function(e,r,n){var i=this.col.cloneNode();return i.style.width=t.formatUnit(ne(e,r)),n?n.appendChild(i):i},e.prototype.updateColContent=function(e){var r=this;ve(function(){var n,i,o,s,a,l,h,p,c=0,u=r.parent.getActiveSheet();u.showHeaders&&(l=r.parent.element.querySelector(".e-column-header .e-header-row"),p=l.firstElementChild);var f,g=r.parent.element.querySelector(".e-sheet-content colgroup"),m=g.firstElementChild,v=r.parent.element.querySelector(".e-sheet-content tbody");e.cells.forEach(function(o,y){if(!f){if(n=d(y),"first"===e.direction&&n[1]===e.indexes[1]&&r.checkColMerge([n[0],r.parent.viewport.leftIndex],e.indexes,(v.rows[c]||{cells:[]}).cells[e.indexes[3]-e.indexes[1]+1],j(n[0],r.parent.viewport.leftIndex,u)||{}),n[0]===e.indexes[0]&&("last"===e.direction?((h=r.col.cloneNode()).style.width=t.formatUnit(ne(u,n[1])),g.insertBefore(h,m),u.showHeaders&&l.insertBefore(r.cellRenderer.renderColHeader(n[1]),p)):(r.updateCol(u,n[1],g),u.showHeaders&&l.appendChild(r.cellRenderer.renderColHeader(n[1]))),r.parent.scrollSettings.enableVirtualization&&e.direction&&(t.detach(g[e.direction+"ElementChild"]),u.showHeaders&&t.detach(l[e.direction+"ElementChild"]))),n[1]===e.indexes[1]){if(i=v.children[c],c++,!i)return void(f=!0);s=i.firstElementChild}a=r.cellRenderer.render({colIdx:n[1],rowIdx:n[0],cell:o,address:y,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":""}),"last"===e.direction?(r.checkColMerge(n,e.indexes,a,o,(v.rows[c-1]||{cells:[]}).cells[0]),i.insertBefore(a,s)):i.appendChild(a),r.parent.scrollSettings.enableVirtualization&&e.direction&&t.detach(i[e.direction+"ElementChild"])}}),u.showHeaders&&(o=r.getColHeaderTable(),t.detach(o.querySelector("colgroup")),o.insertBefore(g.cloneNode(!0),o.querySelector("thead"))),r.parent.scrollSettings.enableVirtualization&&r.parent.notify(Vr,{refresh:"Column"}),r.parent.isOpen||r.parent.hideSpinner(),He(r.parent.getMainContent(),{busy:!1})})},e.prototype.updateRowContent=function(e){var r,n,i,o,s,a=this,l=this.colGroupWidth,h=this.parent.getActiveSheet(),p=0,c=this.parent.getMainContent().querySelector("tbody");h.showHeaders&&(s=document.createDocumentFragment(),o=this.parent.getRowHeaderContent().querySelector("tbody"));var u,f=document.createDocumentFragment();this.parent.showSpinner(),e.cells.forEach(function(g,m){u=d(m),"first"===e.direction&&u[0]===e.indexes[0]&&a.checkRowMerge([a.parent.viewport.topIndex,u[1]],e.indexes,(c.rows[e.indexes[2]-e.indexes[0]+1]||{cells:[]}).cells[p],j(a.parent.viewport.topIndex,u[1],h)||{}),u[1]===e.indexes[1]&&(h.showHeaders&&(n=a.rowRenderer.render(u[0],!0),s.appendChild(n),n.appendChild(a.cellRenderer.renderRowHeader(u[0])),l=Ce(u[0]+1),a.parent.scrollSettings.enableVirtualization&&e.direction&&t.detach(o[e.direction+"ElementChild"])),r=a.rowRenderer.render(u[0]),f.appendChild(r),a.parent.scrollSettings.enableVirtualization&&e.direction&&t.detach(c[e.direction+"ElementChild"])),i=r.appendChild(a.cellRenderer.render({colIdx:u[1],rowIdx:u[2],cell:g,address:m,lastCell:u[1]===e.indexes[3],row:r,pHRow:h.showHeaders?n.previousSibling:null,checkNextBorder:"last"===e.direction&&u[2]===e.indexes[2]?"Row":"",pRow:r.previousSibling,isHeightCheckNeeded:"first"===e.direction||""===e.direction,hRow:n,first:"last"!==e.direction||e.skipUpdateOnFirst||u[0]!==e.indexes[0]?"":"Row"})),"last"===e.direction&&a.checkRowMerge(u,e.indexes,i,g,c.rows[0].cells[p]),p++}),this.colGroupWidth!==l&&this.updateLeftColGroup(l),"last"===e.direction?(h.showHeaders&&o.insertBefore(s,o.firstElementChild),c.insertBefore(f,c.firstElementChild)):(h.showHeaders&&o.appendChild(s),c.appendChild(f)),this.parent.scrollSettings.enableVirtualization&&this.parent.notify(Vr,{refresh:"Row"}),this.parent.element.getElementsByClassName("e-spreadsheet-edit")[0]&&P(this.parent.element.getElementsByClassName("e-spreadsheet-edit")[0].textContent)&&this.parent.notify(Ri,null),this.parent.isOpen||this.parent.hideSpinner(),He(this.parent.getMainContent(),{busy:!1})},e.prototype.checkRowMerge=function(e,r,n,i,o){!this.parent.scrollSettings.enableVirtualization||!n||e[0]!==this.parent.viewport.topIndex||t.isNullOrUndefined(i.rowSpan)&&t.isNullOrUndefined(i.colSpan)||(i.rowSpan<0&&this.parent.notify(fi,{td:n,rowIdx:e[0],colIdx:e[1],isRow:!0}),o&&(o.colSpan||o.rowSpan)&&this.cellRenderer.refresh(e[0]+(r[2]-r[0])+1,e[1],null,o))},e.prototype.checkColMerge=function(e,r,n,i,o){!this.parent.scrollSettings.enableVirtualization||!n||e[1]!==this.parent.viewport.leftIndex||t.isNullOrUndefined(i.rowSpan)&&t.isNullOrUndefined(i.colSpan)||(i.colSpan<0&&this.parent.notify(fi,{td:n,colIdx:e[1],rowIdx:e[0]}),o&&(o.colSpan||o.rowSpan)&&this.cellRenderer.refresh(e[0],e[1]+(r[3]-r[1])+1,null,o))},e.prototype.showHideHeaders=function(){var e=this,r=this.parent.getActiveSheet();if(r.showHeaders)if(this.parent.scrollSettings.enableVirtualization){var n=[this.parent.viewport.topIndex,this.parent.viewport.leftIndex,this.parent.viewport.bottomIndex,this.parent.viewport.rightIndex];this.renderHeaders([n[0],n[2]],[n[1],n[3]])}else this.renderHeaders([0,r.rowCount-1],[0,r.colCount-1]),"A1"!==r.topLeftCell&&this.parent.goTo(r.topLeftCell);else ve(function(){t.detach(e.headerPanel),t.detach(e.getRowHeaderPanel()),e.getContentPanel().style.width="",e.updateHideHeaders()})},e.prototype.renderHeaders=function(e,t){var r=this,n=this.parent.getActiveSheet();this.initHeaderPanel();var i=document.createDocumentFragment(),o=document.createDocumentFragment();i.appendChild(this.headerPanel);var s=o.appendChild(this.parent.createElement("div",{className:"e-row-header",id:this.parent.element.id+"_row_header"}));this.createHeaderTable(s),this.parent.notify(mn,{element:s}),this.refreshSelectALLContent();var a=s.querySelector("tbody"),l=this.headerPanel.querySelector(".e-column-header thead"),h=this.rowRenderer.render();l.appendChild(h);for(var p,d=t[0];d<=t[1];d++)oe(n,d)||h.appendChild(this.cellRenderer.renderColHeader(d));var c=Ce(e[1]);this.colGroupWidth!==c&&this.updateLeftColGroup(c,s);for(d=e[0];d<=e[1];d++)J(n,d)||((p=this.rowRenderer.render(d,!0)).appendChild(this.cellRenderer.renderRowHeader(d)),a.appendChild(p));ve(function(){r.getColHeaderTable().insertBefore(r.getContentTable().querySelector("colgroup").cloneNode(!0),l);var e=document.getElementById(r.parent.element.id+"_sheet");e.classList.remove("e-hide-headers"),e.insertBefore(i,r.contentPanel);var t=r.getContentPanel();r.contentPanel.insertBefore(o,t),r.parent.scrollModule.setPadding(),s.scrollTop=t.scrollTop,r.getColHeaderPanel().scrollLeft=t.scrollLeft})},e.prototype.updateHideHeaders=function(){document.getElementById(this.parent.element.id+"_sheet").classList.add("e-hide-headers"),this.headerPanel=null},e.prototype.getSelectAllContent=function(){return this.headerPanel.getElementsByClassName("e-selectall-container")[0]},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(ai,this.triggerCreatedEvent,this),this.parent.on(Tr,this.destroy,this)},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.removeEventListener=function(){this.parent.off(ai,this.triggerCreatedEvent),this.parent.off(Tr,this.destroy)},e}(),Xs=function(){function e(e){this.parent=e,this.element=this.parent.createElement("tr",{attrs:{role:"row"}}),this.cellRenderer=e.serviceLocator.getService("cell")}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 o=this.parent.getActiveSheet();return t.attributes(i,{"aria-rowindex":(e+1).toString()}),i.style.height=Z(o,e)+"px",r&&!n&&(J(o,e+1)&&!J(o,e-1)&&i.classList.add("e-hide-start"),0!==e&&J(o,e-1)&&!J(o,e+1)&&i.classList.add("e-hide-end")),i},e.prototype.refresh=function(e,t,r,n){var i,o=this.parent.getActiveSheet();if(n)(i=this.render(e,!0,!0)).appendChild(this.cellRenderer.renderRowHeader(e));else{i=this.render(e);for(var s=this.parent.viewport.leftIndex+this.parent.viewport.colCount+2*this.parent.getThreshold("col"),a=this.parent.viewport.leftIndex;a<=s;a++)i.appendChild(this.cellRenderer.render({colIdx:a,rowIdx:e,cell:j(e,a,o),address:f(e,a),lastCell:a===s,row:i,hRow:r,isHeightCheckNeeded:!0,pRow:t,first:e===this.parent.viewport.topIndex&&Xe(o,e,!0)!==Xe(o,0,!0)?"Row":""}))}return i},e}(),Ks=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"})}return e.prototype.renderColHeader=function(e){var r=this.th.cloneNode();t.attributes(r,{role:"columnheader","aria-colindex":(e+1).toString(),tabindex:"-1"}),r.innerHTML=m(e+1);var n=this.parent.getActiveSheet();return oe(n,e+1)&&r.classList.add("e-hide-start"),0!==e&&oe(n,e-1)&&r.classList.add("e-hide-end"),r},e.prototype.renderRowHeader=function(e){var r=this.element.cloneNode();return t.addClass([r],"e-header-cell"),t.attributes(r,{role:"rowheader",tabindex:"-1"}),r.innerHTML=(e+1).toString(),r},e.prototype.render=function(e){if(e.td=this.element.cloneNode(),e.td.className="e-cell",t.attributes(e.td,{role:"gridcell","aria-colindex":(e.colIdx+1).toString(),tabindex:"-1"}),this.checkMerged(e))return e.td;e.td.innerHTML=this.processTemplates(e.cell,e.rowIdx,e.colIdx),e.isRefresh=!1,this.update(e),e.cell&&e.td&&this.parent.notify(ur,{rowIdx:e.rowIdx,colIdx:e.colIdx,cell:e.cell,td:e.td,isChecked:!1}),Ue(this.parent,e.rowIdx,e.colIdx,this.parent.activeSheetIndex)||this.parent.notify(Vn,{td:e.td,rowIndex:e.rowIdx,colIndex:e.colIdx});var r={cell:e.cell,element:e.td,address:e.address};this.parent.trigger("beforeCellRender",r),this.updateRowHeight({rowIdx:e.rowIdx,cell:r.element,lastCell:e.lastCell,rowHgt:20,row:e.row,hRow:e.hRow});var n=e.td.classList.contains("e-wraptext"),i=e.td.innerHTML;if(i.indexOf("\n")>-1&&!n){var o=i.split("\n");if(o.length>1){W(e.address,!0,this.parent);var s=qe(this.parent,e.cell.style||this.parent.cellStyle,o.length);this.parent.setRowHeight(s,e.rowIdx,this.parent.activeSheetIndex+1,!0),this.parent.getRow(e.rowIdx,this.parent.getRowHeaderTable()).style.height=s+"px"}}return r.element},e.prototype.update=function(e){if(!e.isRefresh||(e.td.rowSpan&&e.td.removeAttribute("rowSpan"),e.td.colSpan&&e.td.removeAttribute("colSpan"),!this.checkMerged(e))){if(e.cell&&e.cell.formula&&!e.cell.value){var r=P(e.cell.formula),n={action:"refreshCalculate",value:e.cell.formula,rowIndex:e.rowIdx,colIndex:e.colIdx,isFormula:r};this.parent.notify(pt,n),e.cell.value=j(e.rowIdx,e.colIdx,this.parent.getActiveSheet()).value}var i={type:e.cell&&D(e.cell.format),value:e.cell&&e.cell.value,format:e.cell&&e.cell.format?e.cell.format:"General",formattedText:e.cell&&e.cell.value,onLoad:!0,isRightAlign:!1,cell:e.cell,rowIdx:e.rowIdx.toString(),colIdx:e.colIdx.toString()};e.cell&&this.parent.notify(nt,i),t.isNullOrUndefined(e.td)||this.parent.refreshNode(e.td,{type:i.type,result:i.formattedText,curSymbol:t.getNumberDependable(this.parent.locale,"USD"),isRightAlign:i.isRightAlign,value:i.value||""});var o={};if(e.cell){if(e.cell.style&&(o=e.cell.style.properties?z(e.cell.style,!0):e.cell.style),e.cell.hyperlink&&this.parent.notify(Nn,{cell:e.cell,td:e.td,rowIdx:e.rowIdx,colIdx:e.colIdx}),e.cell.wrap&&this.parent.notify(Nt,{range:[e.rowIdx,e.colIdx,e.rowIdx,e.colIdx],wrap:!0,sheet:this.parent.getActiveSheet(),initial:!0,td:e.td,row:e.row,hRow:e.hRow}),e.cell.rowSpan>1){var s=e.cell.rowSpan-this.parent.hiddenCount(e.rowIdx,e.rowIdx+(e.cell.rowSpan-1));s>1&&(e.td.rowSpan=s)}if(e.cell.colSpan>1){var a=e.cell.colSpan-this.parent.hiddenCount(e.colIdx,e.colIdx+(e.cell.colSpan-1),"columns");a>1&&(e.td.colSpan=a)}if(e.cell.image)for(var l=0;l<e.cell.image.length;l++)this.parent.notify(Li,{options:{src:e.cell.image[l].src,imageId:e.cell.image[l].id,height:e.cell.image[l].height,width:e.cell.image[l].width,top:e.cell.image[l].top,left:e.cell.image[l].left},range:g([e.rowIdx,e.colIdx,e.rowIdx,e.colIdx]),isPublic:!1})}if(e.isRefresh&&this.removeStyle(e.td,e.rowIdx,e.colIdx),this.parent.allowConditionalFormat&&e.lastCell&&this.parent.notify(yi,{rowIdx:e.rowIdx,colIdx:e.colIdx,cell:e.cell}),(Object.keys(o).length||Object.keys(this.parent.commonCellStyle).length||e.lastCell)&&this.parent.notify(lt,{style:t.extend({},this.parent.commonCellStyle,o),rowIdx:e.rowIdx,colIdx:e.colIdx,cell:e.td,first:e.first,row:e.row,lastCell:e.lastCell,hRow:e.hRow,pRow:e.pRow,isHeightCheckNeeded:e.isHeightCheckNeeded,manualUpdate:e.manualUpdate}),"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||this.parent.notify(lt,{style:{borderBottom:h},rowIdx:e.rowIdx,colIdx:e.colIdx,cell:e.td})}if("Column"===e.checkNextBorder){var p=this.parent.getCellStyleValue(["borderLeft"],[e.rowIdx,e.colIdx+1]).borderLeft;""===p||e.cell&&e.cell.style&&(e.cell.style.borderRight||e.cell.style.border)||this.parent.notify(lt,{style:{borderRight:p},rowIdx:e.rowIdx,colIdx:e.colIdx,cell:e.td})}if(e.cell&&e.cell.hyperlink&&!Ue(this.parent,e.rowIdx,e.colIdx,this.parent.activeSheetIndex)){var d=void 0;"string"==typeof e.cell.hyperlink?0!==(d=e.cell.hyperlink).indexOf("http://")&&0!==d.indexOf("https://")&&0!==d.indexOf("ftp://")&&(e.cell.hyperlink=0===d.indexOf("www.")?"http://"+d:d):0!==(d=e.cell.hyperlink.address).indexOf("http://")&&0!==d.indexOf("https://")&&0!==d.indexOf("ftp://")&&(e.cell.hyperlink.address=0===d.indexOf("www.")?"http://"+d:d),this.parent.notify(Nn,{cell:e.cell,td:e.td,rowIdx:e.rowIdx,colIdx:e.colIdx})}}},e.prototype.checkMerged=function(e){return!(!e.cell||!(e.cell.colSpan<0||e.cell.rowSpan<0))&&(e.td.style.display="none",e.cell.colSpan<0&&this.parent.notify(ui,e),e.cell.rowSpan<0&&(e.isRow=!0,this.parent.notify(ui,e)),!0)},e.prototype.processTemplates=function(e,t,r){for(var n,i=this.parent.getActiveSheet(),o=i.ranges,s=0,a=o.length;s<a;s++)if(o[s].template&&(n=d(o[s].address.length?o[s].address:o[s].startCell))[0]<=t&&n[1]<=r&&n[2]>=t&&n[3]>=r){if(e)return this.compileCellTemplate(o[s].template);if(!j(t,r,i,!0))return this.compileCellTemplate(o[s].template)}return""},e.prototype.compileCellTemplate=function(e){var r;r=0===e.trim().indexOf("#")?document.querySelector(e).innerHTML.trim():e;return t.compile(r)({},null,null,"",!0)[0].outerHTML},e.prototype.updateRowHeight=function(e){if(e.cell&&e.cell.children.length){var t=e.cell.cloneNode(!0);this.tableRow.appendChild(t)}if(e.lastCell&&this.tableRow.childElementCount){var r=this.parent.getActiveSheet(),n=e.row||this.parent.getRow(e.rowIdx),i=Z(r,e.rowIdx),o=this.getRowHeightOnInit();o>i&&(n.style.height=o+"px",r.showHeaders&&((e.hRow||this.parent.getRow(e.rowIdx,this.parent.getRowHeaderTable())).style.height=o+"px"),Q(r,e.rowIdx,o)),this.tableRow.innerHTML=""}},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){e.style.length&&e.removeAttribute("style");var n=this.parent.getCell(t-1,r);n&&n.style.borderBottom&&(t=Number(n.parentElement.getAttribute("aria-rowindex"))-1,this.parent.getCellStyleValue(["borderBottom"],[t,r]).borderBottom||(n.style.borderBottom=""));var i=e.previousElementSibling;i&&i.style.borderRight&&(r=Number(i.getAttribute("aria-colindex"))-1,this.parent.getCellStyleValue(["borderRight"],[t,r]).borderRight||(i.style.borderRight=""))},e.prototype.refreshRange=function(e){var t=this.parent.getActiveSheet(),r=e.slice();if(we(this.parent,r,!0))for(var n=r[0];n<=r[2];n++)if(!J(t,n))for(var i=r[1];i<=r[3];i++){var o=this.parent.getCell(n,i);o&&(this.update({rowIdx:n,colIdx:i,td:o,cell:j(n,i,t),lastCell:i===r[3],isRefresh:!0,isHeightCheckNeeded:!0,manualUpdate:!0,first:""}),this.parent.notify(Vn,{td:o,rowIndex:n,colIndex:i}))}},e.prototype.refresh=function(e,t,r,n){var i=this.parent.getActiveSheet();if((n||!J(i,e)&&!oe(i,t))&&(n||!this.parent.scrollSettings.enableVirtualization||e>=this.parent.viewport.topIndex&&e<=this.parent.viewport.bottomIndex&&t>=this.parent.viewport.leftIndex&&t<=this.parent.viewport.rightIndex)){var o=n||this.parent.getCell(e,t);this.update({rowIdx:e,colIdx:t,td:o,cell:j(e,t,i),lastCell:r,isRefresh:!0,isHeightCheckNeeded:!0,manualUpdate:!0,first:""}),this.parent.notify(Vn,{td:o,rowIndex:e,colIndex:t})}},e}(),$s=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.render=function(){this.parent.activeSheetIndex=this.parent.skipHiddenSheets(this.parent.activeSheetIndex),this.parent.isMobileView()||(this.parent.notify(Sr,null),this.parent.notify(xr,null));var e=this.parent.createElement("div",{id:this.parent.element.id+"_sheet_panel",className:"e-sheet-panel"});if(this.parent.enableRtl&&e.classList.add("e-rtl"),this.parent.element.appendChild(e),this.parent.showSheetTabs)this.parent.notify(wr,null);else{var t={action:"addSheet",sheetName:"Sheet1",index:1,visibleName:ge(this.parent,0)};this.parent.notify(pt,t),this.parent.notify(pt,{action:"initiateDefinedNames"})}this.parent.isMobileView()&&(this.parent.notify(xr,null),this.parent.notify(Sr,null)),this.setSheetPanelSize(),this.renderSheet(e),this.checkTopLeftCell(!0)},e.prototype.checkTopLeftCell=function(e){var t=this.parent.getActiveSheet();if(this.parent.scrollSettings.enableVirtualization&&"A1"!==t.topLeftCell){var r=c(t.topLeftCell),n=r[0]?ee(t,0,r[0]-1):0,i=r[1]?ie(t,0,r[1]-1):0;this.parent.notify(vn,{scrollLeft:i,scrollTop:n,preventScroll:!0});var o=this.parent.getThreshold("row"),s=r[0]>o?r[0]-o:0;o=this.parent.getThreshold("col");var a=r[1]>o?r[1]-o:0;this.refreshUI({rowIndex:s,colIndex:a,refresh:"All",top:n,left:i})}else this.refreshUI({rowIndex:0,colIndex:0,refresh:"All"},null,e)},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"})),this.parent.serviceLocator.getService("sheet").renderPanel()},e.prototype.refreshUI=function(e,t,r){var n=this.parent.serviceLocator.getService("sheet"),i=this.parent.getActiveSheet(),o=ge(this.parent);if(this.parent.showSpinner(),!t)if(this.parent.scrollSettings.enableVirtualization){var s=e.rowIndex+this.parent.viewport.rowCount+2*this.parent.getThreshold("row"),a=i.rowCount-1;this.parent.scrollSettings.isFinite&&s>a&&(s=a);var l=e.colIndex+this.parent.viewport.colCount+2*this.parent.getThreshold("col");a=i.colCount-1,this.parent.scrollSettings.isFinite&&l>a&&(l=a);var h=this.parent.skipHidden(e.rowIndex,s),p=e.rowIndex;if(e.rowIndex!==h[0]){(u=c(i.topLeftCell))[0]===e.rowIndex&&(i.topLeftCell=f(h[0],u[1])),e.rowIndex=h[0]}s=h[1],h=this.parent.skipHidden(e.colIndex,l,"columns");var d=e.colIndex;if(e.colIndex!==h[0]){var u;(u=c(i.topLeftCell))[1]===e.colIndex&&(i.topLeftCell=f(u[0],h[0])),e.colIndex=h[0]}l=h[1],this.parent.viewport.topIndex=e.rowIndex,this.parent.viewport.bottomIndex=s,this.parent.viewport.leftIndex=e.colIndex,this.parent.viewport.rightIndex=l,t=f(p,d)+":"+f(s,l)}else t="A1:"+f(i.rowCount-1,i.colCount-1);"All"===e.refresh&&this.parent.trigger(en,{}),He(this.parent.getMainContent(),{busy:!0}),this.parent.getData(o+"!"+t).then(function(i){var o=[e.rowIndex,e.colIndex].concat(c(t.split(":")[1]));switch(e.refresh){case"All":n.renderTable({cells:i,indexes:o,top:e.top,left:e.left,initLoad:r});break;case"Row":n.refreshRowContent({cells:i,indexes:o,skipUpdateOnFirst:e.skipUpdateOnFirst});break;case"Column":n.refreshColumnContent({cells:i,indexes:o,skipUpdateOnFirst:e.skipUpdateOnFirst});break;case"RowPart":n.updateRowContent({cells:i,indexes:o,direction:e.direction,skipUpdateOnFirst:e.skipUpdateOnFirst});break;case"ColumnPart":n.updateColContent({cells:i,indexes:o,direction:e.direction,skipUpdateOnFirst:e.skipUpdateOnFirst})}}),this.parent.notify(Pr,{refresh:e.refresh})},e.prototype.removeSheet=function(){t.remove(document.getElementById(this.parent.element.id+"_sheet"))},e.prototype.refreshSheet=function(){this.removeSheet(),this.renderSheet(),this.parent.notify(yn,{}),this.checkTopLeftCell()},e.prototype.setSheetPanelSize=function(){var e,t=document.getElementById(this.parent.element.id+"_sheet_panel"),r=this.parent.element.getBoundingClientRect();"auto"===this.parent.height?(t.style.height="260px",e=230):(e=r.height-Se(t),t.style.height=e+"px",e-=32),this.parent.viewport.height=e,this.parent.viewport.width=r.width-32,this.parent.viewport.rowCount=this.roundValue(e,20),this.parent.viewport.colCount=this.roundValue(r.width,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.instantiateRenderer=function(){this.parent.serviceLocator.register("cell",new Ks(this.parent)),this.parent.serviceLocator.register("row",new Xs(this.parent)),this.parent.serviceLocator.register("sheet",new Ys(this.parent))},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.addEventListener=function(){this.parent.on(kr,this.instantiateRenderer,this),this.parent.on(Er,this.refreshSheet,this),this.parent.on(Tr,this.destroy,this)},e.prototype.removeEventListener=function(){this.parent.off(kr,this.instantiateRenderer),this.parent.off(Er,this.refreshSheet),this.parent.off(Tr,this.destroy)},e}(),Js=function(){function e(e){this.parent=e}return e.prototype.show=function(e,r){var n,i=this;r=!!t.isNullOrUndefined(r);var o=e.close||null,s={header:"Spreadsheet",cssClass:this.parent.cssClass,target:this.parent.element,buttons:[]};e.close=function(){i.dialogInstance.destroy(),t.remove(i.dialogInstance.element),i.dialogInstance=null,o&&o()},t.extend(s,e),r&&(n=this.parent.serviceLocator.getService(Us).getConstant(s.buttons.length?"Cancel":"Ok"),s.buttons.push({buttonModel:{content:n,isPrimary:0===s.buttons.length},click:this.hide.bind(this)}));var a=this.parent.createElement("div");document.body.appendChild(a),this.dialogInstance=new h.Dialog(s),this.dialogInstance.createElement=this.parent.createElement,this.dialogInstance.appendTo(a),this.dialogInstance.refreshPosition()},e.prototype.hide=function(){this.dialogInstance&&this.dialogInstance.hide()},e.prototype.destroy=function(){this.parent=null},e}(),Zs=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){this.parent.trigger("actionBegin",{action:e.action,args:e}),"clipboard"!==e.action&&"beforeSort"!==e.action&&"format"!==e.action&&"cellSave"!==e.action&&"beforeWrap"!==e.action&&"beforeReplace"!==e.action&&"beforeClear"!==e.action&&"beforeInsertImage"!==e.action||this.parent.notify(Bn,{args:e})},e.prototype.actionCompleteHandler=function(e){this.parent.trigger("actionComplete",e),"undoRedo"!==e.action&&"gotoSheet"!==e.action&&this.parent.notify(Hn,{args:e})},e.prototype.addEventListener=function(){this.parent.on(Wn,this.actionCompleteHandler,this),this.parent.on(Gn,this.actionBeginHandler,this)},e.prototype.removeEventListener=function(){this.parent.off(Wn,this.actionCompleteHandler),this.parent.off(Gn,this.actionBeginHandler)},e}(),Qs=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}return e.prototype.insertOverlayElement=function(e,t,r){var n=this.parent.createElement("div",{id:e,attrs:{class:"e-ss-overlay"},styles:"width: "+this.minWidth+";  height: "+this.minHeight}),i=d(t),o=Ie(this.parent.sheets[r],i);return n.style.top=o.top+"px",n.style.left=o.left+"px",this.parent.getMainContent().appendChild(n),this.renderResizeHandles(n),this.addEventListener(n),this.sheetTop=document.getElementById(this.parent.element.id+"_sheet_panel").getClientRects()[0].top+31,this.sheetLeft=document.getElementById(this.parent.element.id+"_sheet_panel").getClientRects()[0].left+30,this.originalWidth=parseFloat(getComputedStyle(n,null).getPropertyValue("width").replace("px","")),this.originalHeight=parseFloat(getComputedStyle(n,null).getPropertyValue("height").replace("px","")),n},e.prototype.addEventListener=function(e){var r=e;t.EventHandler.add(r,"mousedown",this.overlayClickHandler,this),t.EventHandler.add(r,"mousemove",this.overlayMouseMoveHandler,this),t.EventHandler.add(this.parent.getMainContent(),"mousemove",this.overlayMouseMoveHandler,this),t.EventHandler.add(document,"mouseup",this.overlayMouseUpHandler,this)},e.prototype.overlayMouseMoveHandler=function(e){e.target;var t=document.getElementsByClassName("e-ss-overlay-active")[0];if(this.isOverlayClicked&&this.isResizerClicked)switch(this.resizer){case"e-ss-overlay-t":var r=Math.max(this.originalMouseY-e.clientY+this.originalHeight,20),n=e.clientY-(this.originalMouseY-this.originalResizeTop+this.sheetTop);r>180&&n>-1&&(t.style.height=r+"px",t.style.top=n+"px",this.resizedReorderTop=e.clientX,this.currenHeight=r);break;case"e-ss-overlay-r":var i=this.originalWidth+(e.pageX-this.originalMouseX);i>180&&(t.style.width=i+"px",this.currentWidth=i);break;case"e-ss-overlay-b":var o=this.originalHeight+(e.pageY-this.originalMouseY);o>180&&(t.style.height=o+"px",this.currenHeight=o);break;case"e-ss-overlay-l":var s=Math.max(this.originalMouseX-e.clientX+this.originalWidth,20),a=e.clientX-(this.originalMouseX-this.originalResizeLeft+this.sheetLeft);s>180&&a>-1&&(t.style.width=s+"px",t.style.left=a+"px",this.resizedReorderLeft=a,this.currentWidth=s)}else if(this.isOverlayClicked){var l=e.clientX,h=e.clientY,p=l-this.diffX,d=h-this.diffY;p>-1&&(t.style.left=p+"px"),d>-1&&(t.style.top=d+"px"),this.resizedReorderLeft=p,this.resizedReorderTop=d}},e.prototype.overlayMouseUpHandler=function(e){this.isOverlayClicked=!1,this.isResizerClicked=!1;var t=e.target,r={prevTop:this.originalReorderTop,prevLeft:this.originalReorderLeft,currentTop:this.resizedReorderTop?this.resizedReorderTop:this.originalReorderTop,currentLeft:this.resizedReorderLeft?this.resizedReorderLeft:this.originalReorderLeft,id:t.id,currentHeight:this.currenHeight,currentWidth:this.currentWidth,requestType:"imageRefresh",prevHeight:this.originalHeight,prevWidth:this.originalWidth};(t.id.indexOf("overlay")>0||t.classList.contains("e-ss-resizer"))&&(this.originalReorderTop!==this.resizedReorderTop||this.originalReorderLeft!==this.resizedReorderLeft?(r.id=t.id,this.parent.notify(Ni,r),this.resizedReorderTop=this.originalReorderTop,this.resizedReorderLeft=this.originalReorderLeft):this.currenHeight===this.originalHeight&&this.originalWidth===this.currentWidth||(r.id=t.id.indexOf("overlay")>0?t.id:t.parentElement.id,this.parent.notify(Ni,r),this.originalHeight=this.currenHeight,this.originalWidth=this.currentWidth))},e.prototype.overlayClickHandler=function(e){this.isOverlayClicked=!0;var r=e.target,n=e.target;r.classList.contains("e-ss-overlay")||(n=r.parentElement),this.originalReorderLeft=parseInt(n.style.left,10),this.originalReorderTop=parseInt(n.style.top,10),this.resizedReorderLeft=parseInt(n.style.left,10),this.resizedReorderTop=parseInt(n.style.top,10),this.originalResizeTop=this.originalReorderTop,this.originalResizeLeft=this.originalReorderLeft,this.originalMouseX=e.clientX,this.originalMouseY=e.clientY,this.diffX=this.originalMouseX-this.originalReorderLeft,this.diffY=this.originalMouseY-this.originalReorderTop;var i=document.getElementsByClassName("e-ss-overlay-active")[0];i&&t.removeClass([i],"e-ss-overlay-active"),document.getElementById(n.id).classList.add("e-ss-overlay-active"),r.classList.contains("e-ss-resizer")&&(this.resizer=r.classList[0],this.originalWidth=parseFloat(getComputedStyle(n,null).getPropertyValue("width").replace("px","")),this.originalHeight=parseFloat(getComputedStyle(n,null).getPropertyValue("height").replace("px","")),this.isResizerClicked=!0)},e.prototype.renderResizeHandles=function(e){for(var t,r=["e-ss-overlay-t","e-ss-overlay-r","e-ss-overlay-b","e-ss-overlay-l"],n=0,i=e;r.length>n;)t=this.parent.createElement("div",{attrs:{class:r[n]+" e-ss-resizer"},styles:"width: 8px; height: 8px; border-radius: 4px;"}),i.appendChild(t),n++},e.prototype.removeEventListener=function(){var e=document.getElementById(this.parent.element.id+"_overlay");t.EventHandler.remove(e,"mousedown",this.overlayClickHandler),t.EventHandler.remove(e,"mousemove",this.overlayMouseMoveHandler),t.EventHandler.remove(this.parent.getMainContent(),"mousemove",this.overlayMouseMoveHandler),t.EventHandler.remove(document,"mouseup",this.overlayMouseUpHandler)},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e}(),ea=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)}}(),ta=function(e,t,r,n){var i,o=arguments.length,s=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,r,s):i(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},ra=function(e){function r(t,r){var i=e.call(this,t)||this;return i.isEdit=!1,i.viewport={rowCount:0,colCount:0,height:0,topIndex:0,leftIndex:0,width:0,bottomIndex:0,rightIndex:0},i.needsID=!0,n.Inject(ws,Is,ks,Jo,$o,es,ts,Ko,br,Rs,Ts,As,Fs,rs,Es,ls,no,Mi,Vi,ro,Cr,Zi,Ns,Qi,ns,as,eo,Os,ss,io,hs,ps,oo,so,ds,ao,cs,us,lo,fs,po,Ds,gs,to,co),r&&i.appendTo(r),i}ea(r,e),n=r,r.prototype.getCell=function(e,t,r){return t=this.getViewportIndex(t,!0),r||(r=this.getRow(e)),r?r.cells[t]:r},r.prototype.getRow=function(e,t){return e=this.getViewportIndex(e),(t=t||this.getContentTable())?t.rows[e]:null},r.prototype.hiddenCount=function(e,t,r){void 0===r&&(r="rows");for(var n=this.getActiveSheet(),i=0,o=e;o<=t;o++)n[r][o]&&n[r][o].hidden&&i++;return i},r.prototype.getViewportIndex=function(e,t){return this.scrollSettings.enableVirtualization&&(t?(e-=this.hiddenCount(this.viewport.leftIndex,e,"columns"),e-=this.viewport.leftIndex):(e-=this.hiddenCount(this.viewport.topIndex,e),e-=this.viewport.topIndex)),e},r.prototype.preRender=function(){e.prototype.preRender.call(this),this.serviceLocator=new Uo,this.initServices()},r.prototype.initServices=function(){this.serviceLocator.register(Us,new t.L10n(this.getModuleName(),Gs,this.locale)),this.serviceLocator.register(js,new Js(this)),this.serviceLocator.register("actionEvents",new Zs(this)),this.serviceLocator.register(qs,new Qs(this))},r.prototype.render=function(){e.prototype.render.call(this),this.element.setAttribute("tabindex","0"),He(this.element,{role:"grid"}),this.renderModule=new $s(this),this.notify(kr,null),this.renderSpreadsheet(),this.wireEvents(),this.created&&(this[ai].observers?this[ai].observers.length>0&&(this.createdHandler={observers:this[ai].observers},this[ai].observers=[]):(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(),h.createSpinner({target:this.element},this.createElement),this.isMobileView()&&-1===this.cssClass.indexOf("e-mobile-view")&&this.element.classList.add("e-mobile-view"),this.sheetModule=this.serviceLocator.getService("sheet"),this.allowScrolling&&(this.scrollModule=new Zo(this)),this.scrollSettings.enableVirtualization&&new Qo(this),this.renderModule.render(),new os(this)},r.prototype.showSpinner=function(){h.showSpinner(this.element)},r.prototype.hideSpinner=function(){h.hideSpinner(this.element)},r.prototype.protectSheet=function(t,r){"string"==typeof t&&(t=se(this,t)),t&&(this.sheets[t].isProtected=!0,this.sheets[t].protectSettings=r),t=this.getActiveSheet().index,this.getActiveSheet().isProtected=!0,e.prototype.protectSheet.call(this,t,r)},r.prototype.unprotectSheet=function(t){"string"==typeof t&&(t=se(this,t)),t?this.sheets[t].isProtected=!1:this.getActiveSheet().isProtected=!1,e.prototype.unprotectSheet.call(this,t)},r.prototype.find=function(t){e.prototype.findHandler.call(this,t)},r.prototype.replace=function(t){e.prototype.replaceHandler.call(this,t)},r.prototype.findAll=function(e,t,r,n,i){var o=[],s={value:e,mode:t=t||"Sheet",sheetIndex:i=i||this.activeSheetIndex,isCSen:r=r||!1,isEMatch:n=n||!1,findCollection:o};return this.notify(st,s),o},r.prototype.goTo=function(e){if(e.includes("!")){var t=e.split("!"),r=se(this,t[0]);if(void 0===r)return;if(r!==this.activeSheetIndex){var n=t[1].split(":")[0];this.sheets[r].activeCell=n,this.sheets[r].selectedRange=t[1];var i=c(n);return i[0]<this.viewport.rowCount&&(i[0]=0),i[1]<this.viewport.colCount&&(i[1]=0),this.sheets[r].topLeftCell=f(i[0],i[1]),this.activeSheetIndex=r,void this.dataBind()}}var o=d(e),s=this.getActiveSheet(),a=o[0]>=this.viewport.topIndex&&o[0]<this.viewport.bottomIndex&&o[1]>=this.viewport.leftIndex&&o[1]<this.viewport.rightIndex;if(a){this.selectRange(e);var l=c(s.topLeftCell);if(l[2]=l[0]+this.viewport.rowCount,l[3]=l[1]+this.viewport.colCount,o[0]>=l[0]&&o[0]<l[2]&&o[1]>=l[1]&&o[1]<l[3])return}var h,p,u,g,m,v,y,C=this.getMainContent();0===o[0]?g=ee(s,0):(g=ee(s,0,o[0]-1),this.scrollSettings.enableVirtualization&&(y=g+this.getContentTable().getBoundingClientRect().height)>(v=parseInt(C.querySelector(".e-virtualtrack").style.height,10))&&(y+=10,(h=C.querySelector(".e-virtualtrack")).style.height=y+"px",s.showHeaders&&((u=this.getRowHeaderContent().querySelector(".e-virtualtrack")).style.height=y+"px"),ve(function(){h.style.height=v+"px",s.showHeaders&&(u.style.height=v+"px")}))),C.scrollTop=g,0===o[1]?g=ie(s,0):(g=ie(s,0,o[1]-1),this.scrollSettings.enableVirtualization&&(y=g+this.getContentTable().getBoundingClientRect().width)>(m=parseInt(C.querySelector(".e-virtualtrack").style.width,10))&&(y+=10,(h=C.querySelector(".e-virtualtrack")).style.width=y+"px",s.showHeaders&&((p=this.getColumnHeaderContent().querySelector(".e-virtualtrack")).style.width=y+"px"),ve(function(){h.style.width=m+"px",s.showHeaders&&(p.style.width=m+"px")}))),C.scrollLeft=g,a||this.selectRange(e)},r.prototype.resize=function(){this.renderModule.setSheetPanelSize(),this.scrollSettings.enableVirtualization&&this.renderModule.refreshSheet()},r.prototype.cut=function(e){var t=new Promise(function(e,t){e(void 0)});return this.notify("cut",e?{range:v(e),sId:this.sheets[se(this,le(e))].id,promise:t}:{promise:t}),t},r.prototype.copy=function(e){var t=new Promise(function(e,t){e(void 0)});return this.notify("copy",e?{range:v(e),sId:this.sheets[se(this,le(e))].id,promise:t}:{promise:t}),t},r.prototype.paste=function(e,t){this.notify(Zr,{range:v(e),sIdx:se(this,le(e)),type:t,isAction:!1})},r.prototype.updateAction=function(e){var t=JSON.parse(e);this.notify(wn,{action:t.action,eventArgs:t.eventArgs})},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=this.getThreshold("col"),o=this.viewport.leftIndex+this.viewport.colCount+2*i,s=t.isNullOrUndefined(n)?this.getActiveSheet():this.sheets[n];if(s){var a=r,l="number"==typeof e?e+"px":e;if(r=t.isNullOrUndefined(r)?c(s.activeCell)[1]:r,s===this.getActiveSheet())if(r>=this.viewport.leftIndex&&r<=o){this.scrollSettings.enableVirtualization&&(r-=this.viewport.leftIndex);var h=this.getColumnHeaderContent().getElementsByClassName("e-header-cell")[r],p=parseInt(this.getMainContent().getElementsByTagName("col")[r].style.width,10);(f=parseInt(l,10)-p)<0&&p<-f&&(c(s.activeCell),f=-p);var d=parseInt(h.getAttribute("aria-colindex"),10)-1;this.getActiveSheet()===s&&(this.notify(gn,{threshold:f,colIdx:d}),Me(r,l,!0,this))}else{var u=ne(s,r),f=void 0;f=parseInt(l,10)>0?-(u-parseInt(l,10)):-u,this.notify(gn,{threshold:f,colIdx:r})}te(s,a).width=parseInt(l,10)>0?parseInt(l,10):0,s.columns[a].customWidth=!0}},r.prototype.setRowHeight=function(e,r,n,i){void 0===e&&(e=20),void 0===r&&(r=0);var o=t.isNullOrUndefined(n)?this.getActiveSheet():this.sheets[n-1];if(o){var s=r,a="number"==typeof e?e+"px":e;if(r=t.isNullOrUndefined(r)?c(o.activeCell)[0]:r,o===this.getActiveSheet())if(r<=this.viewport.bottomIndex&&r>=this.viewport.topIndex){this.scrollSettings.enableVirtualization&&(r-=this.viewport.topIndex);var l=this.getRowHeaderContent().getElementsByClassName("e-header-cell")[r],h=parseInt(this.getMainContent().getElementsByTagName("tr")[r].style.height,10);(u=parseInt(a,10)-h)<0&&h<-u&&(u=-h);var p=parseInt(l.parentElement.getAttribute("aria-rowindex"),10)-1;this.getActiveSheet()===o&&(this.notify(fn,{threshold:u,rowIdx:p}),t.isNullOrUndefined(i)&&(i=!1),i||(Me(r,a,!1,this),i=!1))}else{var d=Z(o,r),u=void 0;u=parseInt(a,10)>0?-(d-parseInt(a,10)):-d,this.notify(fn,{threshold:u,rowIdx:r})}Q(o,s,parseInt(a,10)>0?parseInt(a,10):0),o.rows[s].customHeight=!0}},r.prototype.autoFit=function(e){var t=this.getIndexes(e),r=t.startIdx,n=t.endIdx,i=t.isCol,o=i?u("XFD"):1048576;if(r<=o)for(n>o&&(n=o);r<=n;r++)this.notify(Kn,{idx:r,isCol:i})},r.prototype.getIndexes=function(e){var r,n,i,o,s;if(-1!==e.indexOf(":")){var a=e.split(":");i=a[0],o=a[1]}else i=e,o=e;if(!t.isNullOrUndefined(i)){var l=this.getAddress(i);i=l.address,r=l.isCol}if(!t.isNullOrUndefined(o)){var h=this.getAddress(o);o=h.address,n=h.isCol}return{startIdx:(s=!0===r&&!0===n)?u(i.toUpperCase()):parseInt(i,10),endIdx:s?u(o.toUpperCase()):parseInt(o,10),isCol:s}},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){this.insertHyperlink(e,t,"",!0)},r.prototype.removeHyperlink=function(e){var t,r,n=this.getActiveSheet();if(e&&-1!==e.indexOf("!")){t=e.split("!");for(var i=this.sheets,o=0;o<i.length;o++)i[o].name===t[0]&&(r=o);n=this.sheets[r],e=t[1]}for(var s,a=d(e||this.getActiveSheet().activeCell),l=a[0];l<=a[2];l++)for(var h=a[1];h<=a[3];h++)if(n&&n.rows[l]&&n.rows[l].cells[h]&&(s=n.rows[l].cells[h])&&("string"==typeof s.hyperlink?s.value=s.value?s.value:s.hyperlink:s.value=s.value?s.value:s.hyperlink.address,delete s.hyperlink,n===this.getActiveSheet())){var p=void 0,c=void 0;this.scrollSettings.enableVirtualization&&(p=l-this.viewport.topIndex,c=h-this.viewport.leftIndex);var u=this.element.getElementsByClassName("e-sheet-content")[0].getElementsByClassName("e-row")[p].getElementsByClassName("e-cell")[c];u.getElementsByClassName("e-hyperlink")[0]&&(u.innerText=u.getElementsByClassName("e-hyperlink")[0].innerHTML)}},r.prototype.insertHyperlink=function(r,n,i,o){if(this.allowHyperlink){var s=void 0,a=void 0,l=void 0,h=this.getActiveSheet(),p={hyperlink:r,cell:n=n||this.getActiveSheet().activeCell,cancel:!1},c={hyperlink:r,cell:n};if(o||this.trigger(xt,p),!p.cancel){if(r=p.hyperlink,n=p.cell,e.prototype.addHyperlink.call(this,r,n),n&&-1!==n.indexOf("!")){s=n.split("!");for(var u=this.sheets,f=0;f<u.length;f++)u[f].name===s[0]&&(a=f);h=this.sheets[a],n=s[1]}if(!h)return;l=d(n=n||this.getActiveSheet().activeCell),"string"==typeof r?r:r.address;var g=h.rows[l[0]].cells[l[1]];t.isNullOrUndefined(g.value)||g.value,o||this.trigger(wt,c),h===this.getActiveSheet()&&this.serviceLocator.getService("cell").refreshRange(l)}}},r.prototype.addDataValidation=function(t,r){e.prototype.addDataValidation.call(this,t,r)},r.prototype.removeDataValidation=function(t){e.prototype.removeDataValidation.call(this,t)},r.prototype.addInvalidHighlight=function(t){e.prototype.addInvalidHighlight.call(this,t)},r.prototype.removeInvalidHighlight=function(t){e.prototype.removeInvalidHighlight.call(this,t)},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-Se(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(In,{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(In,{startIndex:t,endIndex:r,hide:n,isCol:!0}):e.prototype.hideColumn.call(this,t,r,n)},r.prototype.clear=function(e){this.notify(bi,{options:e,isPublic:!0})},r.prototype.refresh=function(t){t?this.notify(Ai,{}):e.prototype.refresh.call(this)},r.prototype.insertImage=function(e,t){var r;for(r=0;r<e.length;r++)this.notify(Li,{options:e[r],range:t||this.getActiveSheet().selectedRange,isPublic:!0})},r.prototype.deleteImage=function(e,t){this.notify(Hi,{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.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){return e.prototype.getValueRowCol.call(this,t,r,n)},r.prototype.updateCell=function(t,r){r=r||this.getActiveSheet().activeCell,e.prototype.updateCell.call(this,t,r),this.serviceLocator.getService("cell").refreshRange(v(r)),this.notify(ft,null)},r.prototype.sort=function(t,r){var n=this;return this.allowSorting?e.prototype.sort.call(this,t,r).then(function(e){return n.notify(St,e),Promise.resolve(e)}):Promise.reject()},r.prototype.setValueRowCol=function(t,r,n,i){if("circular reference: "===r){var o={action:"isCircularReference",argValue:r};this.notify(Nr,o),r=o.argValue}e.prototype.setValueRowCol.call(this,t,r,n,i),t=ae(this,t),this.notify(Fr,{action:"refreshDependentCellValue",rowIdx:n,colIdx:i,sheetIdx:t})},r.prototype.getModuleName=function(){return"spreadsheet"},r.prototype.refreshNode=function(e,r){var n,i=e.querySelector("#"+this.element.id+"_currency"),o="e-right-align";if(r){if(r.result=t.isNullOrUndefined(r.result)?"":r.result.toString(),i&&t.detach(i),"Accounting"===r.type&&F(r.value))return e.querySelector("a")?e.querySelector("a").textContent=r.result.split(r.curSymbol).join(""):e.innerHTML="",e.appendChild(this.createElement("span",{id:this.element.id+"_currency",innerHTML:""+r.curSymbol,styles:"float: left"})),e.querySelector("a")||(e.innerHTML+=r.result.split(r.curSymbol).join("")),void e.classList.add(o);!r.result||"true"!==r.result.toLowerCase()&&"false"!==r.result.toLowerCase()||(r.result=r.result.toUpperCase(),o="e-center-align",r.isRightAlign=!0),n=r.result,r.isRightAlign?e.classList.add(o):e.classList.remove(o)}if(n=t.isNullOrUndefined(n)?"":n,!t.isNullOrUndefined(e)){var s=e.lastChild;e.querySelector(".e-hyperlink")&&(s=e.querySelector(".e-hyperlink").lastChild),!s||3!==s.nodeType&&1!==s.nodeType?e.appendChild(document.createTextNode(n)):s.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){void 0===r&&(r="rows");var n,i=this.getActiveSheet();this.scrollSettings.isFinite&&(n=("rows"===r?i.rowCount:i.colCount)-1);for(var o=e;o<=t;o++)if(i[r][o]&&i[r][o].hidden&&(e===o&&e++,t++,n&&t>n)){t=n;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.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+1===this.sheets.length?e=t-1:e<t?e--:e++,e=this.skipHiddenSheets(e,t,++r)),r===this.sheets.length?(this.sheets[0].state="Visible",0):e},r.prototype.undo=function(){this.notify(Ln,{isUndo:!0,isPublic:!0})},r.prototype.redo=function(){this.notify(Ln,{isUndo:!1,isPublic:!0})},r.prototype.updateUndoRedoCollection=function(e){this.notify(Hn,{args:e,isPublic:!0})},r.prototype.addDefinedName=function(e){var t={action:"addDefinedName",isAdded:!1,definedName:e};return this.notify(Nr,t),t.isAdded},r.prototype.removeDefinedName=function(t,r){return e.prototype.removeDefinedName.call(this,t,r)},r.prototype.mouseClickHandler=function(e){this.notify(Dr,e)},r.prototype.mouseDownHandler=function(e){this.notify(Ar,e)},r.prototype.keyUpHandler=function(e){t.closest(e.target,".e-find-dlg")?this.notify(Yt,e):this.notify(Lr,e)},r.prototype.keyDownHandler=function(e){t.closest(e.target,".e-findtool-dlg")||this.notify(Hr,e)},r.prototype.wireEvents=function(){t.EventHandler.add(this.element,"click",this.mouseClickHandler,this),t.EventHandler.add(this.element,Re(),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)},r.prototype.destroy=function(){this.unwireEvents(),this.notify(Tr,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")},r.prototype.unwireEvents=function(){t.EventHandler.remove(this.element,"click",this.mouseClickHandler),t.EventHandler.remove(this.element,Re(),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)},r.prototype.addContextMenuItems=function(e,t,r,n){void 0===r&&(r=!0),this.notify(tn,{items:e,text:t,insertAfter:r,isUniqueId:n})},r.prototype.removeContextMenuItems=function(e,t){this.notify(rn,{items:e,isUniqueId:t})},r.prototype.enableContextMenuItems=function(e,t,r){void 0===t&&(t=!0),this.notify(nn,{items:e,enable:t,isUniqueId:r})},r.prototype.enableFileMenuItems=function(e,t,r){void 0===t&&(t=!0),this.notify(on,{items:e,enable:t,isUniqueId:r})},r.prototype.hideFileMenuItems=function(e,t,r){void 0===t&&(t=!0),this.notify(sn,{items:e,hide:t,isUniqueId:r})},r.prototype.addFileMenuItems=function(e,t,r,n){void 0===r&&(r=!0),this.notify(an,{items:e,text:t,insertAfter:r,isUniqueId:n})},r.prototype.hideRibbonTabs=function(e,t){void 0===t&&(t=!0),this.notify(ln,{tabs:e,hide:t})},r.prototype.enableRibbonTabs=function(e,t){void 0===t&&(t=!0),this.notify(hn,{tabs:e,enable:t})},r.prototype.addRibbonTabs=function(e,t){this.notify(pn,{items:e,insertBefore:t})},r.prototype.enableToolbarItems=function(e,t,r){this.notify(Kr,[{tab:e,items:t,enable:void 0===r||r}])},r.prototype.hideToolbarItems=function(e,t,r){void 0===r&&(r=!0),this.notify(cn,{tab:e,indexes:t,hide:r})},r.prototype.addToolbarItems=function(e,t,r){this.notify(dn,{tab:e,items:t,index:r})},r.prototype.selectRange=function(e){this.notify(Jr,{indexes:d(e)})},r.prototype.startEdit=function(){this.notify(Fr,{action:"startEdit",isNewValueEdit:!1})},r.prototype.closeEdit=function(){this.notify(Fr,{action:"cancelEdit"})},r.prototype.endEdit=function(){this.notify(Fr,{action:"endEdit"})},r.prototype.onPropertyChanged=function(r,n){var i=this;e.prototype.onPropertyChanged.call(this,r,n);for(var o=0,s=Object.keys(r);o<s.length;o++){switch(s[o]){case"enableRtl":r.enableRtl?document.getElementById(this.element.id+"_sheet_panel").classList.add("e-rtl"):document.getElementById(this.element.id+"_sheet_panel").classList.remove("e-rtl");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(Cn,{idx:r.activeSheetIndex});break;case"width":this.setWidth(),this.resize();break;case"height":this.setHeight(),this.resize();break;case"showRibbon":this.notify(Sr,{uiUpdate:!0});break;case"showFormulaBar":this.notify(xr,{uiUpdate:!0});break;case"showSheetTabs":this.notify(wr,null);break;case"cellStyle":this.renderModule.refreshSheet();break;case"allowEditing":this.allowEditing&&this.notify(Fr,{action:"renderEditor"});break;case"sheets":this.renderModule.refreshSheet(),this.showSheetTabs&&Object.keys(r.sheets).forEach(function(e){i.notify(On,{items:i.element.querySelector(".e-sheet-tabs-items").children[e],value:r.sheets[e].name,idx:e})});break;case"locale":this.refresh()}}},r.prototype.requiredModules=function(){return me(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(t){t?this.notify(qn,{field:t}):e.prototype.clearFilter.call(this)},r.prototype.applyFilter=function(e,t){this.notify(Pn,{predicates:e,range:t})},r.prototype.addCustomFunction=function(t,r){e.prototype.addCustomFunction.call(this,t,r),this.notify($n,null)};var n;return ta([t.Property("")],r.prototype,"cssClass",void 0),ta([t.Property(!0)],r.prototype,"allowScrolling",void 0),ta([t.Property(!0)],r.prototype,"allowResizing",void 0),ta([t.Property(!0)],r.prototype,"enableClipboard",void 0),ta([t.Property(!0)],r.prototype,"enableContextMenu",void 0),ta([t.Property(!0)],r.prototype,"enableKeyboardNavigation",void 0),ta([t.Property(!0)],r.prototype,"enableKeyboardShortcut",void 0),ta([t.Property(!0)],r.prototype,"allowUndoRedo",void 0),ta([t.Property(!0)],r.prototype,"allowWrap",void 0),ta([t.Complex({},Ps)],r.prototype,"selectionSettings",void 0),ta([t.Complex({},_s)],r.prototype,"scrollSettings",void 0),ta([t.Event()],r.prototype,"beforeCellRender",void 0),ta([t.Event()],r.prototype,"beforeSelect",void 0),ta([t.Event()],r.prototype,"select",void 0),ta([t.Event()],r.prototype,"contextMenuBeforeOpen",void 0),ta([t.Event()],r.prototype,"fileMenuBeforeOpen",void 0),ta([t.Event()],r.prototype,"contextMenuBeforeClose",void 0),ta([t.Event()],r.prototype,"dialogBeforeOpen",void 0),ta([t.Event()],r.prototype,"fileMenuBeforeClose",void 0),ta([t.Event()],r.prototype,"contextMenuItemSelect",void 0),ta([t.Event()],r.prototype,"fileMenuItemSelect",void 0),ta([t.Event()],r.prototype,"beforeDataBound",void 0),ta([t.Event()],r.prototype,"dataBound",void 0),ta([t.Event()],r.prototype,"cellEdit",void 0),ta([t.Event()],r.prototype,"cellEditing",void 0),ta([t.Event()],r.prototype,"cellSave",void 0),ta([t.Event()],r.prototype,"beforeCellSave",void 0),ta([t.Event()],r.prototype,"created",void 0),ta([t.Event()],r.prototype,"beforeSort",void 0),ta([t.Event()],r.prototype,"beforeHyperlinkCreate",void 0),ta([t.Event()],r.prototype,"afterHyperlinkCreate",void 0),ta([t.Event()],r.prototype,"beforeHyperlinkClick",void 0),ta([t.Event()],r.prototype,"afterHyperlinkClick",void 0),ta([t.Event()],r.prototype,"actionBegin",void 0),ta([t.Event()],r.prototype,"actionComplete",void 0),ta([t.Event()],r.prototype,"openComplete",void 0),ta([t.Event()],r.prototype,"sortComplete",void 0),r=n=ta([t.NotifyPropertyChanges],r)}(Wo);e.Workbook=Wo,e.Range=_o,e.UsedRange=Po,e.Sheet=Vo,e.getSheetIndex=se,e.getSheetIndexFromId=ae,e.getSheetNameFromAddress=le,e.getSheetIndexByName=he,e.updateSelectedRange=pe,e.getSelectedRange=function(e){return e&&e.selectedRange||"A1"},e.getSheet=de,e.getSheetNameCount=ce,e.getMaxSheetId=ue,e.initSheet=fe,e.getSheetName=ge,e.Row=Oo,e.getRow=K,e.setRow=$,e.isHiddenRow=J,e.getRowHeight=Z,e.setRowHeight=Q,e.getRowsHeight=ee,e.Column=Ho,e.getColumn=te,e.setColumn=re,e.getColumnWidth=ne,e.getColumnsWidth=ie,e.isHiddenCol=oe,e.Cell=To,e.getCell=j,e.setCell=q,e.skipDefaultValue=z,e.wrap=W,e.getData=G,e.getModel=function(e,r){var n,i,o;if(t.isUndefined(e[r])||!e[r]||e[r].index!==r)for(var s=0;s<=r;s++)if(e&&e[s]){if((n=e[s].index-s)>0){for(e.forEach(function(e,t){e&&e.index&&(o=e.index,i=1),e&&!e.index&&0!==t&&(e.index=o+i),i++});n--;)e.splice(s,0,null);s+=n}}else e?e[s]=null:e=[];return e[r]},e.processIdx=Y,e.clearRange=X,e.getRangeIndexes=d,e.getCellIndexes=c,e.getColIndex=u,e.getCellAddress=f,e.getRangeAddress=g,e.getColumnHeaderText=m,e.getIndexesFromAddress=v,e.getRangeFromAddress=y,e.getAddressFromSelectedRange=C,e.getAddressInfo=b,e.getSwapRange=S,e.isSingleCell=w,e.executeTaskAsync=I,e.WorkbookBasicModule=uo,e.WorkbookAllModule=fo,e.getWorkbookRequiredModules=_,e.CellStyle=vo,e.DefineName=yo,e.ProtectSettings=Co,e.Hyperlink=bo,e.Validation=So,e.Format=xo,e.ConditionalFormat=wo,e.Image=Io,e.workbookDestroyed=$e,e.updateSheetFromDataSource=Je,e.dataSourceChanged=Ze,e.workbookOpen=Qe,e.beginSave=et,e.saveCompleted=tt,e.applyNumberFormatting=rt,e.getFormattedCellObject=nt,e.refreshCellElement=it,e.setCellFormat=ot,e.findAllValues=st,e.textDecorationUpdate=at,e.applyCellFormat=lt,e.updateUsedRange=ht,e.workbookFormulaOperation=pt,e.workbookEditOperation=dt,e.checkDateFormat=ct,e.getFormattedBarText=ut,e.activeCellChanged=ft,e.openSuccess=gt,e.openFailure=mt,e.sheetCreated=vt,e.sheetsDestroyed=yt,e.aggregateComputation=Ct,e.beforeSort="beforeSort",e.initiateSort=bt,e.sortComplete=St,e.sortRangeAlert="sortRangeAlert",e.initiatelink="initiatelink",e.beforeHyperlinkCreate=xt,e.afterHyperlinkCreate=wt,e.beforeHyperlinkClick=It,e.afterHyperlinkClick=Et,e.addHyperlink="addHyperlink",e.setLinkModel=kt,e.beforeFilter="beforeFilter",e.initiateFilter=Rt,e.filterComplete=At,e.filterRangeAlert=Tt,e.clearAllFilter=Ft,e.wrapEvent=Nt,e.onSave=Ot,e.insert=Dt,e.deleteAction=Lt,e.insertModel=Ht,e.deleteModel=Bt,e.isValidation=Mt,e.setValidation=_t,e.addHighlight=Pt,e.dataValidate="dataValidate",e.findNext=Vt,e.findPrevious=Ut,e.goto=jt,e.findWorkbookHandler="findHandler",e.replaceHandler=qt,e.replaceAllHandler=zt,e.showDialog=Wt,e.findUndoRedo=Gt,e.findKeyUp=Yt,e.removeValidation=Xt,e.removeHighlight=Kt,e.queryCellInfo=$t,e.count="count",e.findCount="findCount",e.protectSheetWorkBook=Jt,e.updateToggle=Zt,e.protectsheetHandler=Qt,e.replaceAllDialog=er,e.unprotectsheetHandler=tr,e.workBookeditAlert="editAlert",e.setLockCells=rr,e.applyLockCells=nr,e.setMerge=ir,e.applyMerge=or,e.mergedRange=sr,e.activeCellMergedRange=ar,e.insertMerge=lr,e.pasteMerge=hr,e.setCFRule=pr,e.cFInitialCheck=dr,e.clearCFRule=cr,e.initiateClearCFRule="initiateClearCFRule",e.cFRender=ur,e.cFDelete=fr,e.clear=gr,e.clearCF=mr,e.clearCells=vr,e.setImage=yr,e.checkIsFormula=P,e.isCellReference=V,e.isChar=U,e.toFraction=E,e.getGcd=k,e.intToDate=R,e.dateToInt=A,e.isDateTime=T,e.isNumber=F,e.toDate=N,e.workbookLocale=Eo,e.localeData=ko,e.DataBind=br,e.WorkbookOpen=Mi,e.WorkbookSave=Vi,e.WorkbookFormula=Zi,e.WorkbookNumberFormat=Cr,e.getFormatFromType=O,e.getTypeFromFormat=D,e.WorkbookSort=Qi,e.WorkbookFilter=eo,e.WorkbookImage=to,e.WorkbookCellFormat=ro,e.WorkbookEdit=no,e.WorkbookHyperlink=io,e.WorkbookInsert=oo,e.WorkbookDelete=so,e.WorkbookDataValidation=ao,e.WorkbookFindAndReplace=lo,e.WorkbookProtectSheet=ho,e.WorkbookMerge=po,e.WorkbookConditionalFormat=co,e.getRequiredModules=me,e.ribbon=Sr,e.formulaBar=xr,e.sheetTabs=wr,e.refreshSheetTabs=Ir,e.dataRefresh=Er,e.initialLoad=kr,e.contentLoaded=Rr,e.mouseDown=Ar,e.spreadsheetDestroyed=Tr,e.editOperation=Fr,e.formulaOperation=Nr,e.formulaBarOperation=Or,e.click=Dr,e.keyUp=Lr,e.keyDown=Hr,e.formulaKeyUp="formulaKeyUp",e.formulaBarUpdate="formulaBarUpdate",e.onVerticalScroll=Br,e.onHorizontalScroll=Mr,e.beforeContentLoaded=_r,e.beforeVirtualContentLoaded=Pr,e.virtualContentLoaded=Vr,e.contextMenuOpen="contextMenuOpen",e.cellNavigate=Ur,e.mouseUpAfterSelection=jr,e.selectionComplete=qr,e.cMenuBeforeOpen=zr,e.insertSheetTab=Wr,e.removeSheetTab=Gr,e.renameSheetTab=Yr,e.ribbonClick=Xr,e.refreshRibbon="ribbonRefresh",e.enableToolbarItems=Kr,e.tabSwitch=$r,e.selectRange=Jr,e.cut="cut",e.copy="copy",e.paste=Zr,e.clearCopy=Qr,e.dataBound="dataBound",e.beforeDataBound=en,e.addContextMenuItems=tn,e.removeContextMenuItems=rn,e.enableContextMenuItems=nn,e.enableFileMenuItems=on,e.hideFileMenuItems=sn,e.addFileMenuItems=an,e.hideRibbonTabs=ln,e.enableRibbonTabs=hn,e.addRibbonTabs=pn,e.addToolbarItems=dn,e.hideToolbarItems=cn,e.beforeRibbonCreate=un,e.rowHeightChanged=fn,e.colWidthChanged=gn,e.beforeHeaderLoaded=mn,e.onContentScroll=vn,e.deInitProperties=yn,e.activeSheetChanged=Cn,e.renameSheet=bn,e.initiateCustomSort=Sn,e.applySort=xn,e.collaborativeUpdate=wn,e.hideShow=In,e.autoFit=En,e.updateToggleItem=kn,e.initiateHyperlink=Rn,e.editHyperlink=An,e.openHyperlink=Tn,e.removeHyperlink=Fn,e.createHyperlinkElement=Nn,e.sheetNameUpdate=On,e.hideSheet=Dn,e.performUndoRedo=Ln,e.updateUndoRedoCollection=Hn,e.setActionData=Bn,e.getBeforeActionData=Mn,e.clearUndoRedoCollection=_n,e.initiateFilterUI=Pn,e.renderFilterCell=Vn,e.reapplyFilter=Un,e.filterByCellValue=jn,e.clearFilter=qn,e.getFilteredColumn=zn,e.completeAction=Wn,e.beginAction=Gn,e.filterCellKeyDown=Yn,e.getFilterRange=Xn,e.setAutoFit=Kn,e.refreshFormulaDatasource=$n,e.setScrollEvent=Jn,e.initiateDataValidation=Zn,e.validationError="validationError",e.startEdit="startEdit",e.invalidData=Qn,e.clearInvalid="clearInvalid",e.protectSheet=ei,e.applyProtect=ti,e.unprotectSheet="unprotectSheet",e.protectCellFormat=ri,e.gotoDlg=ni,e.findDlg=ii,e.findHandler=oi,e.replace=si,e.created=ai,e.editAlert=li,e.setUndoRedo=hi,e.enableFormulaInput=pi,e.protectSelection=di,e.hiddenMerge=ci,e.checkPrevMerge=ui,e.checkMerge=fi,e.removeDataValidation=gi,e.showAggregate=mi,e.initiateConditionalFormat=vi,e.checkConditionalFormat=yi,e.setCF=Ci,e.clearViewer=bi,e.initiateFormulaReference=Si,e.initiateCur=xi,e.clearCellRef=wi,e.editValue=Ii,e.addressHandle=Ei,e.initiateEdit=ki,e.forRefSelRender=Ri,e.blankWorkbook=Ai,e.insertImage=Ti,e.refreshImgElem=Fi,e.refreshImgCellObj=Ni,e.getRowIdxFromClientY=Oi,e.getColIdxFromClientX=Di,e.createImageElement=Li,e.deleteImage=Hi,e.refreshImagePosition=Bi,e.getUpdateUsingRaf=ve,e.removeAllChildren=ye,e.getColGroupWidth=Ce,e.getScrollBarWidth=be,e.getSiblingsHeight=Se,e.inView=we,e.getCellPosition=Ie,e.locateElem=Ee,e.setStyleAttribute=ke,e.getStartEvent=Re,e.getMoveEvent=Ae,e.getEndEvent=Te,e.isTouchStart=Fe,e.isTouchMove=Ne,e.isTouchEnd=Oe,e.getClientX=De,e.getClientY=Le,e.setAriaOptions=He,e.destroyComponent=Be,e.setResize=Me,e.setWidthAndHeight=_e,e.findMaxValue=Pe,e.updateAction=Ve,e.hasTemplate=Ue,e.setRowEleHeight=je,e.getTextHeight=qe,e.getTextWidth=ze,e.getLines=We,e.setMaxHgt=Ge,e.getMaxHgt=Ye,e.skipHiddenIdx=Xe,e.BasicModule=Ls,e.AllModule=Hs,e.ScrollSettings=_s,e.SelectionSettings=Ps,e.DISABLED="e-disabled",e.WRAPTEXT=Vs,e.locale=Us,e.dialog=js,e.actionEvents="actionEvents",e.overlay=qs,e.fontColor=zs,e.fillColor=Ws,e.defaultLocale=Gs,e.Spreadsheet=ra,e.Clipboard=Ko,e.Edit=$o,e.Selection=Jo,e.Scroll=Zo,e.VirtualScroll=Qo,e.KeyboardNavigation=es,e.KeyboardShortcut=ts,e.CellFormat=rs,e.Resize=ns,e.CollaborativeEditing=is,e.ShowHide=os,e.SpreadsheetHyperlink=ss,e.UndoRedo=as,e.WrapText=ls,e.Insert=hs,e.Delete=ps,e.DataValidation=ds,e.ProtectSheet=cs,e.FindAndReplace=us,e.Merge=fs,e.ConditionalFormatting=gs,e.Ribbon=ws,e.FormulaBar=Is,e.Formula=Es,e.SheetTabs=ks,e.Open=Rs,e.Save=As,e.ContextMenu=Ts,e.NumberFormat=Fs,e.Sort=Ns,e.Filter=Os,e.SpreadsheetImage=Ds,e.Render=$s,e.SheetRender=Ys,e.RowRenderer=Xs,e.CellRenderer=Ks,e.Calculate=Yi,e.FormulaError=Xi,e.FormulaInfo=Ki,e.CalcSheetFamilyItem=$i,e.getAlphalabel=M,e.ValueChangedArgs=Ji,e.Parser=zi,e.CalculateCommon=Ui,e.isUndefined=function(e){return void 0===e},e.getModules=L,e.getValue=H,e.setValue=B,e.ModuleLoader=ji,e.BasicFormulas=qi,Object.defineProperty(e,"__esModule",{value:!0})});
  //# sourceMappingURL=ej2-spreadsheet.umd.min.js.map
  